tim-js-sdk.js 780 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436
  1. import {
  2. __commonJS
  3. } from "./chunk-Y2F7D3TJ.js";
  4. // E:/Project/2023/问诊平台/his_user_app/node_modules/tim-js-sdk/tim-js.js
  5. var require_tim_js = __commonJS({
  6. "E:/Project/2023/问诊平台/his_user_app/node_modules/tim-js-sdk/tim-js.js"(exports, module) {
  7. !function(e, t) {
  8. "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).TIM = t();
  9. }(exports, function() {
  10. function e(e2, t2) {
  11. var n2 = Object.keys(e2);
  12. if (Object.getOwnPropertySymbols) {
  13. var o2 = Object.getOwnPropertySymbols(e2);
  14. t2 && (o2 = o2.filter(function(t3) {
  15. return Object.getOwnPropertyDescriptor(e2, t3).enumerable;
  16. })), n2.push.apply(n2, o2);
  17. }
  18. return n2;
  19. }
  20. function t(t2) {
  21. for (var n2 = 1; n2 < arguments.length; n2++) {
  22. var o2 = null != arguments[n2] ? arguments[n2] : {};
  23. n2 % 2 ? e(Object(o2), true).forEach(function(e2) {
  24. r(t2, e2, o2[e2]);
  25. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t2, Object.getOwnPropertyDescriptors(o2)) : e(Object(o2)).forEach(function(e2) {
  26. Object.defineProperty(t2, e2, Object.getOwnPropertyDescriptor(o2, e2));
  27. });
  28. }
  29. return t2;
  30. }
  31. function n(e2) {
  32. return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e3) {
  33. return typeof e3;
  34. } : function(e3) {
  35. return e3 && "function" == typeof Symbol && e3.constructor === Symbol && e3 !== Symbol.prototype ? "symbol" : typeof e3;
  36. })(e2);
  37. }
  38. function o(e2, t2) {
  39. if (!(e2 instanceof t2))
  40. throw new TypeError("Cannot call a class as a function");
  41. }
  42. function s(e2, t2) {
  43. for (var n2 = 0; n2 < t2.length; n2++) {
  44. var o2 = t2[n2];
  45. o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e2, o2.key, o2);
  46. }
  47. }
  48. function a(e2, t2, n2) {
  49. return t2 && s(e2.prototype, t2), n2 && s(e2, n2), Object.defineProperty(e2, "prototype", { writable: false }), e2;
  50. }
  51. function r(e2, t2, n2) {
  52. return t2 in e2 ? Object.defineProperty(e2, t2, { value: n2, enumerable: true, configurable: true, writable: true }) : e2[t2] = n2, e2;
  53. }
  54. function i(e2, t2) {
  55. if ("function" != typeof t2 && null !== t2)
  56. throw new TypeError("Super expression must either be null or a function");
  57. e2.prototype = Object.create(t2 && t2.prototype, { constructor: { value: e2, writable: true, configurable: true } }), Object.defineProperty(e2, "prototype", { writable: false }), t2 && c(e2, t2);
  58. }
  59. function u(e2) {
  60. return (u = Object.setPrototypeOf ? Object.getPrototypeOf : function(e3) {
  61. return e3.__proto__ || Object.getPrototypeOf(e3);
  62. })(e2);
  63. }
  64. function c(e2, t2) {
  65. return (c = Object.setPrototypeOf || function(e3, t3) {
  66. return e3.__proto__ = t3, e3;
  67. })(e2, t2);
  68. }
  69. function l() {
  70. if ("undefined" == typeof Reflect || !Reflect.construct)
  71. return false;
  72. if (Reflect.construct.sham)
  73. return false;
  74. if ("function" == typeof Proxy)
  75. return true;
  76. try {
  77. return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  78. })), true;
  79. } catch (e2) {
  80. return false;
  81. }
  82. }
  83. function p(e2, t2, n2) {
  84. return (p = l() ? Reflect.construct : function(e3, t3, n3) {
  85. var o2 = [null];
  86. o2.push.apply(o2, t3);
  87. var s2 = new (Function.bind.apply(e3, o2))();
  88. return n3 && c(s2, n3.prototype), s2;
  89. }).apply(null, arguments);
  90. }
  91. function d(e2) {
  92. var t2 = "function" == typeof Map ? /* @__PURE__ */ new Map() : void 0;
  93. return (d = function(e3) {
  94. if (null === e3 || (n2 = e3, -1 === Function.toString.call(n2).indexOf("[native code]")))
  95. return e3;
  96. var n2;
  97. if ("function" != typeof e3)
  98. throw new TypeError("Super expression must either be null or a function");
  99. if (void 0 !== t2) {
  100. if (t2.has(e3))
  101. return t2.get(e3);
  102. t2.set(e3, o2);
  103. }
  104. function o2() {
  105. return p(e3, arguments, u(this).constructor);
  106. }
  107. return o2.prototype = Object.create(e3.prototype, { constructor: { value: o2, enumerable: false, writable: true, configurable: true } }), c(o2, e3);
  108. })(e2);
  109. }
  110. function g(e2, t2) {
  111. if (null == e2)
  112. return {};
  113. var n2, o2, s2 = function(e3, t3) {
  114. if (null == e3)
  115. return {};
  116. var n3, o3, s3 = {}, a3 = Object.keys(e3);
  117. for (o3 = 0; o3 < a3.length; o3++)
  118. n3 = a3[o3], t3.indexOf(n3) >= 0 || (s3[n3] = e3[n3]);
  119. return s3;
  120. }(e2, t2);
  121. if (Object.getOwnPropertySymbols) {
  122. var a2 = Object.getOwnPropertySymbols(e2);
  123. for (o2 = 0; o2 < a2.length; o2++)
  124. n2 = a2[o2], t2.indexOf(n2) >= 0 || Object.prototype.propertyIsEnumerable.call(e2, n2) && (s2[n2] = e2[n2]);
  125. }
  126. return s2;
  127. }
  128. function _(e2) {
  129. if (void 0 === e2)
  130. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  131. return e2;
  132. }
  133. function h(e2, t2) {
  134. if (t2 && ("object" == typeof t2 || "function" == typeof t2))
  135. return t2;
  136. if (void 0 !== t2)
  137. throw new TypeError("Derived constructors may only return object or undefined");
  138. return _(e2);
  139. }
  140. function f(e2) {
  141. var t2 = l();
  142. return function() {
  143. var n2, o2 = u(e2);
  144. if (t2) {
  145. var s2 = u(this).constructor;
  146. n2 = Reflect.construct(o2, arguments, s2);
  147. } else
  148. n2 = o2.apply(this, arguments);
  149. return h(this, n2);
  150. };
  151. }
  152. function v(e2, t2) {
  153. return M(e2) || function(e3, t3) {
  154. var n2 = null == e3 ? null : "undefined" != typeof Symbol && e3[Symbol.iterator] || e3["@@iterator"];
  155. if (null == n2)
  156. return;
  157. var o2, s2, a2 = [], r2 = true, i2 = false;
  158. try {
  159. for (n2 = n2.call(e3); !(r2 = (o2 = n2.next()).done) && (a2.push(o2.value), !t3 || a2.length !== t3); r2 = true)
  160. ;
  161. } catch (u2) {
  162. i2 = true, s2 = u2;
  163. } finally {
  164. try {
  165. r2 || null == n2.return || n2.return();
  166. } finally {
  167. if (i2)
  168. throw s2;
  169. }
  170. }
  171. return a2;
  172. }(e2, t2) || I(e2, t2) || T();
  173. }
  174. function m(e2) {
  175. return function(e3) {
  176. if (Array.isArray(e3))
  177. return C(e3);
  178. }(e2) || y(e2) || I(e2) || function() {
  179. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  180. }();
  181. }
  182. function M(e2) {
  183. if (Array.isArray(e2))
  184. return e2;
  185. }
  186. function y(e2) {
  187. if ("undefined" != typeof Symbol && null != e2[Symbol.iterator] || null != e2["@@iterator"])
  188. return Array.from(e2);
  189. }
  190. function I(e2, t2) {
  191. if (e2) {
  192. if ("string" == typeof e2)
  193. return C(e2, t2);
  194. var n2 = Object.prototype.toString.call(e2).slice(8, -1);
  195. return "Object" === n2 && e2.constructor && (n2 = e2.constructor.name), "Map" === n2 || "Set" === n2 ? Array.from(e2) : "Arguments" === n2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2) ? C(e2, t2) : void 0;
  196. }
  197. }
  198. function C(e2, t2) {
  199. (null == t2 || t2 > e2.length) && (t2 = e2.length);
  200. for (var n2 = 0, o2 = new Array(t2); n2 < t2; n2++)
  201. o2[n2] = e2[n2];
  202. return o2;
  203. }
  204. function T() {
  205. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  206. }
  207. function D(e2, t2) {
  208. var n2 = "undefined" != typeof Symbol && e2[Symbol.iterator] || e2["@@iterator"];
  209. if (!n2) {
  210. if (Array.isArray(e2) || (n2 = I(e2)) || t2 && e2 && "number" == typeof e2.length) {
  211. n2 && (e2 = n2);
  212. var o2 = 0, s2 = function() {
  213. };
  214. return { s: s2, n: function() {
  215. return o2 >= e2.length ? { done: true } : { done: false, value: e2[o2++] };
  216. }, e: function(e3) {
  217. throw e3;
  218. }, f: s2 };
  219. }
  220. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  221. }
  222. var a2, r2 = true, i2 = false;
  223. return { s: function() {
  224. n2 = n2.call(e2);
  225. }, n: function() {
  226. var e3 = n2.next();
  227. return r2 = e3.done, e3;
  228. }, e: function(e3) {
  229. i2 = true, a2 = e3;
  230. }, f: function() {
  231. try {
  232. r2 || null == n2.return || n2.return();
  233. } finally {
  234. if (i2)
  235. throw a2;
  236. }
  237. } };
  238. }
  239. var E = { SDK_READY: "sdkStateReady", SDK_NOT_READY: "sdkStateNotReady", SDK_DESTROY: "sdkDestroy", MESSAGE_RECEIVED: "onMessageReceived", MESSAGE_MODIFIED: "onMessageModified", MESSAGE_REVOKED: "onMessageRevoked", MESSAGE_READ_BY_PEER: "onMessageReadByPeer", MESSAGE_READ_RECEIPT_RECEIVED: "onMessageReadReceiptReceived", MESSAGE_EXTENSIONS_UPDATED: "onMessageExtensionsUpdated", MESSAGE_EXTENSIONS_DELETED: "onMessageExtensionsDeleted", CONVERSATION_LIST_UPDATED: "onConversationListUpdated", TOTAL_UNREAD_MESSAGE_COUNT_UPDATED: "onTotalUnreadMessageCountUpdated", CONVERSATION_GROUP_LIST_UPDATED: "onConversationGroupListUpdated", CONVERSATION_IN_GROUP_UPDATED: "onConversationInGroupUpdated", GROUP_LIST_UPDATED: "onGroupListUpdated", GROUP_SYSTEM_NOTICE_RECEIVED: "receiveGroupSystemNotice", GROUP_ATTRIBUTES_UPDATED: "groupAttributesUpdated", GROUP_COUNTER_UPDATED: "onGroupCounterUpdated", TOPIC_CREATED: "onTopicCreated", TOPIC_DELETED: "onTopicDeleted", TOPIC_UPDATED: "onTopicUpdated", PROFILE_UPDATED: "onProfileUpdated", USER_STATUS_UPDATED: "onUserStatusUpdated", BLACKLIST_UPDATED: "blacklistUpdated", FRIEND_LIST_UPDATED: "onFriendListUpdated", FRIEND_GROUP_LIST_UPDATED: "onFriendGroupListUpdated", FRIEND_APPLICATION_LIST_UPDATED: "onFriendApplicationListUpdated", KICKED_OUT: "kickedOut", ERROR: "error", NET_STATE_CHANGE: "netStateChange", SDK_RELOAD: "sdkReload" }, S = { MSG_TEXT: "TIMTextElem", MSG_IMAGE: "TIMImageElem", MSG_SOUND: "TIMSoundElem", MSG_AUDIO: "TIMSoundElem", MSG_FILE: "TIMFileElem", MSG_FACE: "TIMFaceElem", MSG_VIDEO: "TIMVideoFileElem", MSG_GEO: "TIMLocationElem", MSG_LOCATION: "TIMLocationElem", MSG_GRP_TIP: "TIMGroupTipElem", MSG_GRP_SYS_NOTICE: "TIMGroupSystemNoticeElem", MSG_CUSTOM: "TIMCustomElem", MSG_MERGER: "TIMRelayElem", MSG_PRIORITY_HIGH: "High", MSG_PRIORITY_NORMAL: "Normal", MSG_PRIORITY_LOW: "Low", MSG_PRIORITY_LOWEST: "Lowest", CONV_C2C: "C2C", CONV_GROUP: "GROUP", CONV_TOPIC: "TOPIC", CONV_SYSTEM: "@TIM#SYSTEM", CONV_AT_ME: 1, CONV_AT_ALL: 2, CONV_AT_ALL_AT_ME: 3, CONV_MARK_TYPE_STAR: 1, CONV_MARK_TYPE_UNREAD: 2, CONV_MARK_TYPE_FOLD: 4, CONV_MARK_TYPE_HIDE: 8, GRP_PRIVATE: "Private", GRP_WORK: "Private", GRP_PUBLIC: "Public", GRP_CHATROOM: "ChatRoom", GRP_MEETING: "ChatRoom", GRP_AVCHATROOM: "AVChatRoom", GRP_COMMUNITY: "Community", GRP_MBR_ROLE_OWNER: "Owner", GRP_MBR_ROLE_ADMIN: "Admin", GRP_MBR_ROLE_MEMBER: "Member", GRP_MBR_ROLE_CUSTOM: "Custom", GRP_TIP_MBR_JOIN: 1, GRP_TIP_MBR_QUIT: 2, GRP_TIP_MBR_KICKED_OUT: 3, GRP_TIP_MBR_SET_ADMIN: 4, GRP_TIP_MBR_CANCELED_ADMIN: 5, GRP_TIP_GRP_PROFILE_UPDATED: 6, GRP_TIP_MBR_PROFILE_UPDATED: 7, GRP_TIP_BAN_AVCHATROOM_MEMBER: 10, GRP_TIP_UNBAN_AVCHATROOM_MEMBER: 11, MSG_REMIND_ACPT_AND_NOTE: "AcceptAndNotify", MSG_REMIND_ACPT_NOT_NOTE: "AcceptNotNotify", MSG_REMIND_DISCARD: "Discard", GENDER_UNKNOWN: "Gender_Type_Unknown", GENDER_FEMALE: "Gender_Type_Female", GENDER_MALE: "Gender_Type_Male", KICKED_OUT_MULT_ACCOUNT: "multipleAccount", KICKED_OUT_MULT_DEVICE: "multipleDevice", KICKED_OUT_USERSIG_EXPIRED: "userSigExpired", KICKED_OUT_REST_API: "REST_API_Kick", ALLOW_TYPE_ALLOW_ANY: "AllowType_Type_AllowAny", ALLOW_TYPE_NEED_CONFIRM: "AllowType_Type_NeedConfirm", ALLOW_TYPE_DENY_ANY: "AllowType_Type_DenyAny", FORBID_TYPE_NONE: "AdminForbid_Type_None", FORBID_TYPE_SEND_OUT: "AdminForbid_Type_SendOut", JOIN_OPTIONS_FREE_ACCESS: "FreeAccess", JOIN_OPTIONS_NEED_PERMISSION: "NeedPermission", JOIN_OPTIONS_DISABLE_APPLY: "DisableApply", JOIN_STATUS_SUCCESS: "JoinedSuccess", JOIN_STATUS_ALREADY_IN_GROUP: "AlreadyInGroup", JOIN_STATUS_WAIT_APPROVAL: "WaitAdminApproval", INVITE_OPTIONS_DISABLE_INVITE: "DisableInvite", INVITE_OPTIONS_NEED_PERMISSION: "NeedPermission", INVITE_OPTIONS_FREE_ACCESS: "FreeAccess", GRP_PROFILE_OWNER_ID: "ownerID", GRP_PROFILE_CREATE_TIME: "createTime", GRP_PROFILE_LAST_INFO_TIME: "lastInfoTime", GRP_PROFILE_MEMBER_NUM: "memberNum", GRP_PROFILE_MAX_MEMBER_NUM: "maxMemberNum", GRP_PROFILE_JOIN_OPTION: "joinOption", GRP_PROFILE_INVITE_OPTION: "inviteOption", GRP_PROFILE_INTRODUCTION: "introduction", GRP_PROFILE_NOTIFICATION: "notification", GRP_PROFILE_MUTE_ALL_MBRS: "muteAllMembers", SNS_ADD_TYPE_SINGLE: "Add_Type_Single", SNS_ADD_TYPE_BOTH: "Add_Type_Both", SNS_DELETE_TYPE_SINGLE: "Delete_Type_Single", SNS_DELETE_TYPE_BOTH: "Delete_Type_Both", SNS_APPLICATION_TYPE_BOTH: "Pendency_Type_Both", SNS_APPLICATION_SENT_TO_ME: "Pendency_Type_ComeIn", SNS_APPLICATION_SENT_BY_ME: "Pendency_Type_SendOut", SNS_APPLICATION_AGREE: "Response_Action_Agree", SNS_APPLICATION_AGREE_AND_ADD: "Response_Action_AgreeAndAdd", SNS_CHECK_TYPE_BOTH: "CheckResult_Type_Both", SNS_CHECK_TYPE_SINGLE: "CheckResult_Type_Single", SNS_TYPE_NO_RELATION: "CheckResult_Type_NoRelation", SNS_TYPE_A_WITH_B: "CheckResult_Type_AWithB", SNS_TYPE_B_WITH_A: "CheckResult_Type_BWithA", SNS_TYPE_BOTH_WAY: "CheckResult_Type_BothWay", NET_STATE_CONNECTED: "connected", NET_STATE_CONNECTING: "connecting", NET_STATE_DISCONNECTED: "disconnected", MSG_AT_ALL: "__kImSDK_MesssageAtALL__", READ_ALL_C2C_MSG: "readAllC2CMessage", READ_ALL_GROUP_MSG: "readAllGroupMessage", READ_ALL_MSG: "readAllMessage", USER_STATUS_UNKNOWN: 0, USER_STATUS_ONLINE: 1, USER_STATUS_OFFLINE: 2, USER_STATUS_UNLOGINED: 3 }, k = function() {
  240. function e2() {
  241. o(this, e2), this.cache = [], this.options = null;
  242. }
  243. return a(e2, [{ key: "use", value: function(e3) {
  244. if ("function" != typeof e3)
  245. throw "middleware must be a function";
  246. return this.cache.push(e3), this;
  247. } }, { key: "next", value: function(e3) {
  248. if (this.middlewares && this.middlewares.length > 0)
  249. return this.middlewares.shift().call(this, this.options, this.next.bind(this));
  250. } }, { key: "run", value: function(e3) {
  251. return this.middlewares = this.cache.map(function(e4) {
  252. return e4;
  253. }), this.options = e3, this.next();
  254. } }]), e2;
  255. }(), L = function() {
  256. function e2() {
  257. var t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, n2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0;
  258. o(this, e2), this.high = t2, this.low = n2;
  259. }
  260. return a(e2, [{ key: "equal", value: function(e3) {
  261. return null !== e3 && (this.low === e3.low && this.high === e3.high);
  262. } }, { key: "toString", value: function() {
  263. var e3 = Number(this.high).toString(16), t2 = Number(this.low).toString(16);
  264. if (t2.length < 8)
  265. for (var n2 = 8 - t2.length; n2; )
  266. t2 = "0" + t2, n2--;
  267. return e3 + t2;
  268. } }]), e2;
  269. }(), A = { TEST: { CHINA: { DEFAULT: "wss://wss-dev.tim.qq.com" }, OVERSEA: { DEFAULT: "wss://wss-dev.tim.qq.com" }, SINGAPORE: { DEFAULT: "wss://wsssgp-dev.im.qcloud.com" }, KOREA: { DEFAULT: "wss://wsskr-dev.im.qcloud.com" }, GERMANY: { DEFAULT: "wss://wssger-dev.im.qcloud.com" }, IND: { DEFAULT: "wss://wssind-dev.im.qcloud.com" }, JPN: { DEFAULT: "wss://wssjpn-dev.im.qcloud.com" }, USA: { DEFAULT: "wss://wssusa-dev.im.qcloud.com" } }, PRODUCTION: { CHINA: { DEFAULT: "wss://wss.im.qcloud.com", BACKUP: "wss://wss.tim.qq.com", STAT: "https://events.im.qcloud.com", ANYCAST: "wss://162.14.13.203" }, OVERSEA: { DEFAULT: "wss://wss.im.qcloud.com", BACKUP: "wss://wss.my-imcloud.com", STAT: "https://api.my-imcloud.com" }, SINGAPORE: { DEFAULT: "wss://wsssgp.im.qcloud.com", BACKUP: "wss://wsssgp.my-imcloud.com", STAT: "https://apisgp.my-imcloud.com" }, KOREA: { DEFAULT: "wss://wsskr.im.qcloud.com", BACKUP: "wss://wsskr.my-imcloud.com", STAT: "https://apikr.my-imcloud.com" }, GERMANY: { DEFAULT: "wss://wssger.im.qcloud.com", BACKUP: "wss://wssger.my-imcloud.com", STAT: "https://apiger.my-imcloud.com" }, IND: { DEFAULT: "wss://wssind.my-imcloud.com", BACKUP: "wss://wssind.im.qcloud.com", STAT: "https://apiind.my-imcloud.com" }, JPN: { DEFAULT: "wss://wssjpn.im.qcloud.com", BACKUP: "wss://wssjpn.my-imcloud.com", STAT: "https://apijpn.my-imcloud.com" }, USA: { DEFAULT: "wss://wssusa.im.qcloud.com", BACKUP: "wss://wssusa.my-imcloud.com", STAT: "https://apiusa.my-imcloud.com" } } }, R = { ANDROID: 2, IOS: 3, MAC: 4, WEB: 7, WX_MP: 8, QQ_MP: 9, TT_MP: 10, BAIDU_MP: 11, ALI_MP: 12, IPAD: 13, UNI_NATIVE_APP: 15 }, N = "1.7.3", O = 537048168, G = "CHINA", U = "OVERSEA", P = "SINGAPORE", b = "KOREA", w = "GERMANY", F = "IND", q = "JPN", x = "USA", V = { HOST: { CURRENT: { DEFAULT: "wss://wss.im.qcloud.com", STAT: "https://events.im.qcloud.com" }, setCurrent: function() {
  270. var e2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : G;
  271. this.CURRENT = A.PRODUCTION[e2];
  272. } }, NAME: { OPEN_IM: "openim", OPEN_IM_MSG_EXT: "openim_msg_ext_http_svc", GROUP: "group_open_http_svc", GROUP_AVCHATROOM: "group_open_avchatroom_http_svc", GROUP_COMMUNITY: "million_group_open_http_svc", GROUP_ATTR: "group_open_attr_http_svc", FRIEND: "sns", PROFILE: "profile", RECENT_CONTACT: "recentcontact", PIC: "openpic", BIG_GROUP_NO_AUTH: "group_open_http_noauth_svc", BIG_GROUP_LONG_POLLING: "group_open_long_polling_http_svc", BIG_GROUP_LONG_POLLING_NO_AUTH: "group_open_long_polling_http_noauth_svc", IM_OPEN_STAT: "imopenstat", WEB_IM: "webim", IM_COS_SIGN: "im_cos_sign_svr", CUSTOM_UPLOAD: "im_cos_msg", HEARTBEAT: "heartbeat", IM_OPEN_PUSH: "im_open_push", IM_OPEN_STATUS: "im_open_status", IM_LONG_MESSAGE: "im_long_msg", IM_CONFIG_MANAGER: "im_sdk_config_mgr", STAT_SERVICE: "StatSvc", OVERLOAD_PUSH: "OverLoadPush", IM_MSG_AUDIT_MGR: "im_msg_audit_mgr", TUIROOM_SVR: "tui_room_svr", IM_OPEN_TRANSLATE: "im_open_translate" }, CMD: { LOGIN: "wslogin", LOGOUT_LONG_POLL: "longpollinglogout", LOGOUT: "wslogout", HELLO: "wshello", STAT_BACKGROUND: "ws_stat_background", STAT_FOREGROUND: "ws_stat_foreground", SET_TOKEN: "ws_stat_settoken", PORTRAIT_GET: "portrait_get_all", PORTRAIT_SET: "portrait_set", GET_LONG_POLL_ID: "getlongpollingid", LONG_POLL: "longpolling", AVCHATROOM_LONG_POLL: "get_msg", ADD_FRIEND: "friend_add", UPDATE_FRIEND: "friend_update", GET_FRIEND_LIST: "friend_get", GET_FRIEND_PROFILE: "friend_get_specified", DELETE_FRIEND: "friend_delete", CHECK_FRIEND: "friend_check", GET_FRIEND_GROUP_LIST: "group_get", RESPOND_FRIEND_APPLICATION: "friend_response", GET_FRIEND_APPLICATION_LIST: "pendency_get", DELETE_FRIEND_APPLICATION: "pendency_delete", REPORT_FRIEND_APPLICATION: "pendency_report", GET_GROUP_APPLICATION: "get_pendency", CREATE_FRIEND_GROUP: "group_add", DELETE_FRIEND_GROUP: "group_delete", UPDATE_FRIEND_GROUP: "group_update", GET_BLACKLIST: "black_list_get", ADD_BLACKLIST: "black_list_add", DELETE_BLACKLIST: "black_list_delete", CREATE_GROUP: "create_group", GET_JOINED_GROUPS: "get_joined_group_list", SET_GROUP_ATTRIBUTES: "set_group_attr", MODIFY_GROUP_ATTRIBUTES: "modify_group_attr", DELETE_GROUP_ATTRIBUTES: "delete_group_attr", CLEAR_GROUP_ATTRIBUTES: "clear_group_attr", GET_GROUP_ATTRIBUTES: "get_group_attr", SEND_MESSAGE: "sendmsg", REVOKE_C2C_MESSAGE: "msgwithdraw", DELETE_C2C_MESSAGE: "delete_c2c_msg_ramble", MODIFY_C2C_MESSAGE: "modify_c2c_msg", MODIFY_C2C_MESSAGE_EXTENSIONS: "set_key_values", GET_C2C_MESSAGE_EXTENSIONS: "get_key_values", SEND_GROUP_MESSAGE: "send_group_msg", REVOKE_GROUP_MESSAGE: "group_msg_recall", DELETE_GROUP_MESSAGE: "delete_group_ramble_msg_by_seq", MODIFY_GROUP_MESSAGE: "modify_group_msg", MODIFY_GROUP_MESSAGE_EXTENSIONS: "group_set_key_values", GET_GROUP_MESSAGE_EXTENSIONS: "group_get_key_values", GET_GROUP_INFO: "get_group_self_member_info", GET_GROUP_MEMBER_INFO: "get_specified_group_member_info", GET_GROUP_MEMBER_LIST: "get_group_member_info", GET_AVCHATROOM_MEMBER_LIST: "get_members", MARK_AVCHATROOM_MEMBER_INFO: "modify_user_info", QUIT_GROUP: "quit_group", CHANGE_GROUP_OWNER: "change_group_owner", DESTROY_GROUP: "destroy_group", ADD_GROUP_MEMBER: "add_group_member", DELETE_GROUP_MEMBER: "delete_group_member", BAN_AVCHATROOM_MEMBER: "ban_group_member", SEARCH_GROUP_BY_ID: "get_group_public_info", APPLY_JOIN_GROUP: "apply_join_group", HANDLE_APPLY_JOIN_GROUP: "handle_apply_join_group", HANDLE_INVITE_JOIN_GROUP: "handle_invite_join_permission_group", HANDLE_GROUP_INVITATION: "handle_invite_join_group", MODIFY_GROUP_INFO: "modify_group_base_info", MODIFY_GROUP_MEMBER_INFO: "modify_group_member_info", DELETE_GROUP_SYSTEM_MESSAGE: "deletemsg", DELETE_GROUP_AT_TIPS: "deletemsg", GET_GROUP_NOTIFY: "get_group_notify", GET_CONVERSATION_LIST: "get", PAGING_GET_CONVERSATION_LIST: "page_get", DELETE_CONVERSATION: "batch_delete", CLEAR_HISTORY_MESSAGE: "clear_msg", PIN_CONVERSATION: "top", SET_CONVERSATION_CUSTOM_DATA: "mark_contact", MARK_CONVERSATION: "mark_contact", CREATE_CONVERSATION_GROUP: "create_contact_group", DELETE_CONVERSATION_GROUP: "del_contact_group", UPDATE_CONVERSATION_GROUP: "update_contact_group", GET_CONVERSATION_GROUP_LIST: "get_contact_group", GET_MESSAGES: "getmsg", GET_C2C_ROAM_MESSAGES: "getroammsg", SET_C2C_PEER_MUTE_NOTIFICATIONS: "set_c2c_peer_mute_notifications", GET_C2C_PEER_MUTE_NOTIFICATIONS: "get_c2c_peer_mute_notifications", GET_GROUP_ROAM_MESSAGES: "group_msg_get", GET_READ_RECEIPT: "get_group_msg_receipt", GET_READ_RECEIPT_DETAIL: "get_group_msg_receipt_detail", SEND_READ_RECEIPT: "group_msg_receipt", SEND_C2C_READ_RECEIPT: "c2c_msg_read_receipt", SET_C2C_MESSAGE_READ: "msgreaded", GET_PEER_READ_TIME: "get_peer_read_time", SET_GROUP_MESSAGE_READ: "msg_read_report", FILE_READ_AND_WRITE_AUTHKEY: "authkey", FILE_UPLOAD: "pic_up", COS_SIGN: "cos", COS_PRE_SIG: "pre_sig", VIDEO_COVER: "video_cover", TIM_WEB_REPORT_V2: "tim_web_report_v2", BIG_DATA_HALLWAY_AUTH_KEY: "authkey", GET_ONLINE_MEMBER_NUM: "get_online_member_num", ALIVE: "alive", MESSAGE_PUSH: "msg_push", MULTI_MESSAGE_PUSH: "multi_msg_push_ws", MESSAGE_PUSH_ACK: "ws_msg_push_ack", STATUS_FORCE_OFFLINE: "stat_forceoffline", DOWNLOAD_MERGER_MESSAGE: "get_relay_json_msg", UPLOAD_MERGER_MESSAGE: "save_relay_json_msg", FETCH_CLOUD_CONTROL_CONFIG: "fetch_config", PUSHED_CLOUD_CONTROL_CONFIG: "push_configv2", FETCH_COMMERCIAL_CONFIG: "fetch_imsdk_purchase_bitsv2", PUSHED_COMMERCIAL_CONFIG: "push_imsdk_purchase_bitsv2", KICK_OTHER: "KickOther", OVERLOAD_NOTIFY: "notify2", SET_ALL_MESSAGE_READ: "read_all_unread_msg", CREATE_TOPIC: "create_topic", DELETE_TOPIC: "destroy_topic", UPDATE_TOPIC_PROFILE: "modify_topic", GET_TOPIC_LIST: "get_topic", SET_SELF_STATUS: "ws_set_custom_status", GET_USER_STATUS: "ws_get_user_status", SUBSCRIBE_USER_STATUS: "ws_status_subscribe", UNSUBSCRIBE_USER_STATUS: "ws_status_unsubscribe", GET_RPOFANITY_LIST: "get_local_words", TRANSLATE_TEXT: "ws_batch_trans_text", UPDATE_GROUP_COUNTER: "update_group_counter", GET_GROUP_COUNTER: "get_group_counter" }, CHANNEL: { SOCKET: 1, XHR: 2, AUTO: 0 }, NAME_VERSION: { openim: "v4", group_open_http_svc: "v4", sns: "v4", profile: "v4", recentcontact: "v4", openpic: "v4", group_open_http_noauth_svc: "v4", group_open_long_polling_http_svc: "v4", group_open_long_polling_http_noauth_svc: "v4", imopenstat: "v4", im_cos_sign_svr: "v4", im_cos_msg: "v4", webim: "v4", im_open_push: "v4", im_open_status: "v4" } }, B = { SEARCH_MSG: new L(0, Math.pow(2, 0)).toString(), SEARCH_GRP_SNS: new L(0, Math.pow(2, 1)).toString(), AVCHATROOM_HISTORY_MSG: new L(0, Math.pow(2, 2)).toString(), GRP_COMMUNITY: new L(0, Math.pow(2, 3)).toString(), MSG_TO_SPECIFIED_GRP_MBR: new L(0, Math.pow(2, 4)).toString(), AVCHATROOM_MBR_LIST: new L(0, Math.pow(2, 6)).toString(), USER_STATUS: new L(0, Math.pow(2, 7)).toString(), CONV_MARK: new L(0, Math.pow(2, 9)).toString(), CONV_GROUP: new L(0, Math.pow(2, 10)).toString(), AVCHATROOM_BAN_MBR: new L(0, Math.pow(2, 11)).toString(), MSG_EXT: new L(0, Math.pow(2, 13)).toString(), GRP_COUNTER: new L(0, Math.pow(2, 15)).toString() }, H = "c2c_text_message", K = "c2c_custom_message", W = "group_text_message", Y = "group_custom_message", j = "user_profile", z = "group_profile", J = "group_member_profile";
  273. V.HOST.setCurrent(G);
  274. var X = "undefined" != typeof wx && "function" == typeof wx.getSystemInfoSync && Boolean(wx.getSystemInfoSync().fontSizeSetting), Q = "undefined" != typeof qq && "function" == typeof qq.getSystemInfoSync && Boolean(qq.getSystemInfoSync().fontSizeSetting), Z = "undefined" != typeof tt && "function" == typeof tt.getSystemInfoSync && Boolean(tt.getSystemInfoSync().fontSizeSetting), $ = "undefined" != typeof swan && "function" == typeof swan.getSystemInfoSync && Boolean(swan.getSystemInfoSync().fontSizeSetting), ee = "undefined" != typeof my && "function" == typeof my.getSystemInfoSync && Boolean(my.getSystemInfoSync().fontSizeSetting), te = "undefined" != typeof jd && "function" == typeof jd.getSystemInfoSync, ne = "undefined" != typeof uni && "undefined" == typeof window && "function" == typeof uni.requireNativePlugin, oe = "undefined" != typeof uni, se = X || Q || Z || $ || ee || ne || te, ae = ("undefined" != typeof uni || "undefined" != typeof window) && !se, re = Q ? qq : Z ? tt : $ ? swan : ee ? my : X ? wx : ne ? uni : te ? jd : {}, ie = ae && window && window.navigator && window.navigator.userAgent || "", ue = /(micromessenger|webbrowser)/i.test(ie), ce = /AppleWebKit\/([\d.]+)/i.exec(ie);
  275. ce && parseFloat(ce.pop());
  276. var le, pe, de = (le = "WEB", ue ? le = "WEB" : Q ? le = "QQ_MP" : Z ? le = "TT_MP" : $ ? le = "BAIDU_MP" : ee ? le = "ALI_MP" : X ? le = "WX_MP" : ne && (le = "UNI_NATIVE_APP"), R[le]), ge = /iPad/i.test(ie), _e = /iPhone/i.test(ie) && !ge, he = /iPod/i.test(ie), fe = _e || ge || he, ve = (pe = ie.match(/OS (\d+)_/i)) && pe[1] ? pe[1] : null, me = /Android/i.test(ie), Me = function() {
  277. var e2 = ie.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);
  278. if (!e2)
  279. return null;
  280. var t2 = e2[1] && parseFloat(e2[1]), n2 = e2[2] && parseFloat(e2[2]);
  281. return t2 && n2 ? parseFloat(e2[1] + "." + e2[2]) : t2 || null;
  282. }();
  283. !function() {
  284. var e2 = ie.match(/Chrome\/(\d+)/);
  285. e2 && e2[1] && parseFloat(e2[1]);
  286. }();
  287. var ye = /MSIE/.test(ie) || ie.indexOf("Trident") > -1 && ie.indexOf("rv:11.0") > -1, Ie = function() {
  288. var e2 = /MSIE\s(\d+)\.\d/.exec(ie), t2 = e2 && parseFloat(e2[1]);
  289. return !t2 && /Trident\/7.0/i.test(ie) && /rv:11.0/.test(ie) && (t2 = 11), t2;
  290. }();
  291. !function() {
  292. var e2 = ie.match(/TBS\/(\d+)/i);
  293. if (e2 && e2[1])
  294. e2[1];
  295. }();
  296. var Ce, Te, De = /Windows/i.test(ie), Ee = /MAC OS X/i.test(ie), Se = ae && "undefined" != typeof Worker && !ye, ke = me || fe, Le = ae && void 0 !== window.tencent_cloud_im_csig_flutter_for_web_25F_cy;
  297. Ce = "undefined" != typeof console ? console : "undefined" != typeof global && global.console ? global.console : "undefined" != typeof window && window.console ? window.console : {};
  298. for (var Ae = function() {
  299. }, Re = ["assert", "clear", "count", "debug", "dir", "dirxml", "error", "group", "groupCollapsed", "groupEnd", "info", "log", "profile", "profileEnd", "table", "time", "timeEnd", "timeStamp", "trace", "warn"], Ne = Re.length; Ne--; )
  300. Te = Re[Ne], console[Te] || (Ce[Te] = Ae);
  301. var Oe = Ce, Ge = 0, Ue = function() {
  302. return (/* @__PURE__ */ new Date()).getTime() + Ge;
  303. }, Pe = function() {
  304. Ge = 0;
  305. }, be = function() {
  306. return Math.floor(Ue() / 1e3);
  307. }, we = 0;
  308. function Fe() {
  309. return Ht() ? "%c TIM %c" : "TIM";
  310. }
  311. function qe() {
  312. var e2, t2 = ((e2 = /* @__PURE__ */ new Date()).setTime(Ue()), e2);
  313. return t2.toLocaleTimeString("en-US", { hour12: false }) + "." + function(e3) {
  314. var t3;
  315. switch (e3.toString().length) {
  316. case 1:
  317. t3 = "00" + e3;
  318. break;
  319. case 2:
  320. t3 = "0" + e3;
  321. break;
  322. default:
  323. t3 = e3;
  324. }
  325. return t3;
  326. }(t2.getMilliseconds());
  327. }
  328. var xe = { arguments2String: function(e2) {
  329. var t2 = "";
  330. if (1 === e2.length)
  331. t2 = e2[0];
  332. else
  333. for (var n2 = 0, o2 = e2.length; n2 < o2; n2++)
  334. rt(e2[n2]) ? ut(e2[n2]) ? t2 += dt(e2[n2]) : t2 += JSON.stringify(e2[n2]) : t2 += e2[n2], t2 += " ";
  335. return t2;
  336. }, _exec: function(e2, t2) {
  337. Ht() ? Oe[e2](Fe(), "background:#0abf5b; padding:1px; border-radius:3px; color: #fff", "background:transparent", qe(), t2) : Oe[e2]("".concat(Fe(), " ").concat(qe(), " ").concat(t2));
  338. }, d: function() {
  339. if (we <= -1) {
  340. var e2 = this.arguments2String(arguments);
  341. this._exec("debug", e2);
  342. }
  343. }, l: function() {
  344. if (we <= 0) {
  345. var e2 = this.arguments2String(arguments);
  346. this._exec("log", e2);
  347. }
  348. }, log: function() {
  349. if (we <= 0) {
  350. var e2 = this.arguments2String(arguments);
  351. this._exec("log", e2);
  352. }
  353. }, i: function() {
  354. if (we <= 1) {
  355. var e2 = this.arguments2String(arguments);
  356. this._exec("info", e2);
  357. }
  358. }, w: function() {
  359. if (we <= 2) {
  360. var e2 = this.arguments2String(arguments);
  361. this._exec("warn", e2);
  362. }
  363. }, e: function() {
  364. if (we <= 3) {
  365. var e2 = this.arguments2String(arguments);
  366. this._exec("error", e2);
  367. }
  368. }, setLevel: function(e2) {
  369. e2 < 4 && this._exec("log", "set level from " + we + " to " + e2), we = e2;
  370. }, getLevel: function() {
  371. return we;
  372. } }, Ve = { JPG: 1, JPEG: 1, GIF: 2, PNG: 3, BMP: 4, UNKNOWN: 255 }, Be = { NICK: "Tag_Profile_IM_Nick", GENDER: "Tag_Profile_IM_Gender", BIRTHDAY: "Tag_Profile_IM_BirthDay", LOCATION: "Tag_Profile_IM_Location", SELFSIGNATURE: "Tag_Profile_IM_SelfSignature", ALLOWTYPE: "Tag_Profile_IM_AllowType", LANGUAGE: "Tag_Profile_IM_Language", AVATAR: "Tag_Profile_IM_Image", MESSAGESETTINGS: "Tag_Profile_IM_MsgSettings", ADMINFORBIDTYPE: "Tag_Profile_IM_AdminForbidType", LEVEL: "Tag_Profile_IM_Level", ROLE: "Tag_Profile_IM_Role" }, He = { UNKNOWN: "Gender_Type_Unknown", FEMALE: "Gender_Type_Female", MALE: "Gender_Type_Male" }, Ke = { NONE: "AdminForbid_Type_None", SEND_OUT: "AdminForbid_Type_SendOut" }, We = { NEED_CONFIRM: "AllowType_Type_NeedConfirm", ALLOW_ANY: "AllowType_Type_AllowAny", DENY_ANY: "AllowType_Type_DenyAny" }, Ye = "JoinedSuccess", je = "WaitAdminApproval", ze = "@TGS#_", Je = "@TOPIC#_", Xe = ["url"], Qe = function(e2) {
  373. return "map" === ct(e2);
  374. }, Ze = function(e2) {
  375. return "file" === ct(e2);
  376. }, $e = function(e2) {
  377. return null !== e2 && ("number" == typeof e2 && !isNaN(e2 - 0) || "object" === n(e2) && e2.constructor === Number);
  378. }, et = function(e2) {
  379. return "string" == typeof e2;
  380. }, nt = function(e2) {
  381. return null !== e2 && "object" === n(e2);
  382. }, ot = function(e2) {
  383. if ("object" !== n(e2) || null === e2)
  384. return false;
  385. var t2 = Object.getPrototypeOf(e2);
  386. if (null === t2)
  387. return true;
  388. for (var o2 = t2; null !== Object.getPrototypeOf(o2); )
  389. o2 = Object.getPrototypeOf(o2);
  390. return t2 === o2;
  391. }, st = function(e2) {
  392. return "function" == typeof Array.isArray ? Array.isArray(e2) : "array" === ct(e2);
  393. }, at = function(e2) {
  394. return void 0 === e2;
  395. }, rt = function(e2) {
  396. return st(e2) || nt(e2);
  397. }, it = function(e2) {
  398. return "function" == typeof e2;
  399. }, ut = function(e2) {
  400. return e2 instanceof Error;
  401. }, ct = function(e2) {
  402. return Object.prototype.toString.call(e2).match(/^\[object (.*)\]$/)[1].toLowerCase();
  403. }, lt = function(e2) {
  404. if ("string" != typeof e2)
  405. return false;
  406. var t2 = e2[0];
  407. return !/[^a-zA-Z0-9]/.test(t2);
  408. };
  409. Date.now || (Date.now = function() {
  410. return (/* @__PURE__ */ new Date()).getTime();
  411. });
  412. var pt = function e2(t2, n2, o2, s2) {
  413. if (!rt(t2) || !rt(n2))
  414. return 0;
  415. for (var a2, r2 = 0, i2 = Object.keys(n2), u2 = 0, c2 = i2.length; u2 < c2; u2++)
  416. if (a2 = i2[u2], !(at(n2[a2]) || o2 && o2.includes(a2)))
  417. if (rt(t2[a2]) && rt(n2[a2]))
  418. r2 += e2(t2[a2], n2[a2], o2, s2);
  419. else {
  420. if (s2 && s2.includes(n2[a2]))
  421. continue;
  422. t2[a2] !== n2[a2] && (t2[a2] = n2[a2], r2 += 1);
  423. }
  424. return r2;
  425. }, dt = function(e2) {
  426. return JSON.stringify(e2, ["message", "code"]);
  427. }, gt = function(e2) {
  428. if (0 === e2.length)
  429. return 0;
  430. for (var t2 = 0, n2 = 0, o2 = "undefined" != typeof document && void 0 !== document.characterSet ? document.characterSet : "UTF-8"; void 0 !== e2[t2]; )
  431. n2 += e2[t2++].charCodeAt[t2] <= 255 ? 1 : false === o2 ? 3 : 2;
  432. return n2;
  433. }, _t = function(e2) {
  434. var t2 = e2 || 99999999;
  435. return Math.round(Math.random() * t2);
  436. }, ht = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", ft = ht.length, vt = function(e2, t2) {
  437. for (var n2 in e2)
  438. if (e2[n2] === t2)
  439. return true;
  440. return false;
  441. }, mt = {}, Mt = function(e2) {
  442. return -1 === e2.indexOf("http://") || -1 === e2.indexOf("https://") ? "https://" + e2 : e2.replace(/https|http/, "https");
  443. }, yt = function e2(t2) {
  444. if (0 === Object.getOwnPropertyNames(t2).length)
  445. return /* @__PURE__ */ Object.create(null);
  446. var o2 = Array.isArray(t2) ? [] : /* @__PURE__ */ Object.create(null), s2 = "";
  447. for (var a2 in t2)
  448. null !== t2[a2] ? void 0 !== t2[a2] ? (s2 = n(t2[a2]), ["string", "number", "function", "boolean"].indexOf(s2) >= 0 ? o2[a2] = t2[a2] : o2[a2] = e2(t2[a2])) : o2[a2] = void 0 : o2[a2] = null;
  449. return o2;
  450. };
  451. function It(e2, t2) {
  452. if (!st(e2) || !st(t2))
  453. return false;
  454. var n2 = false;
  455. return t2.forEach(function(t3) {
  456. var o2 = t3.key, s2 = t3.value, a2 = e2.find(function(e3) {
  457. return e3.key === o2;
  458. });
  459. a2 ? a2.value !== s2 && (a2.value = s2, n2 = true) : (e2.push({ key: o2, value: s2 }), n2 = true);
  460. }), n2;
  461. }
  462. var Ct = function(e2) {
  463. return e2 === S.GRP_AVCHATROOM;
  464. }, Tt = function(e2) {
  465. var t2 = e2.type, n2 = e2.groupID;
  466. return t2 === S.GRP_COMMUNITY || "".concat(n2).startsWith(ze) && !"".concat(n2).includes(Je);
  467. }, Dt = function(e2) {
  468. return "".concat(e2).startsWith(ze) && "".concat(e2).includes(Je);
  469. }, Et = function(e2) {
  470. return et(e2) && e2.slice(0, 3) === S.CONV_C2C;
  471. }, St = function(e2) {
  472. return et(e2) && e2.slice(0, 5) === S.CONV_GROUP;
  473. }, kt = function(e2) {
  474. return et(e2) && e2 === S.CONV_SYSTEM;
  475. };
  476. function Lt(e2, t2) {
  477. var n2 = {};
  478. return Object.keys(e2).forEach(function(o2) {
  479. n2[o2] = t2(e2[o2], o2);
  480. }), n2;
  481. }
  482. function At(e2) {
  483. return se ? new Promise(function(t2, n2) {
  484. re.getImageInfo({ src: e2, success: function(e3) {
  485. t2({ width: e3.width, height: e3.height });
  486. }, fail: function() {
  487. t2({ width: 0, height: 0 });
  488. } });
  489. }) : ye && 9 === Ie ? Promise.resolve({ width: 0, height: 0 }) : new Promise(function(t2, n2) {
  490. var o2 = new Image();
  491. o2.onload = function() {
  492. t2({ width: this.width, height: this.height }), o2 = null;
  493. }, o2.onerror = function() {
  494. t2({ width: 0, height: 0 }), o2 = null;
  495. }, o2.src = e2;
  496. });
  497. }
  498. function Rt() {
  499. function e2() {
  500. return (65536 * (1 + Math.random()) | 0).toString(16).substring(1);
  501. }
  502. return "".concat(e2() + e2()).concat(e2()).concat(e2()).concat(e2()).concat(e2()).concat(e2()).concat(e2());
  503. }
  504. function Nt() {
  505. var e2 = "unknown";
  506. if (Ee && (e2 = "mac"), De && (e2 = "windows"), fe && (e2 = "ios"), me && (e2 = "android"), se)
  507. try {
  508. var t2 = re.getSystemInfoSync().platform;
  509. void 0 !== t2 && (e2 = t2);
  510. } catch (n2) {
  511. }
  512. return e2;
  513. }
  514. function Ot(e2, t2) {
  515. e2 = e2.split("."), t2 = t2.split(".");
  516. for (var n2 = Math.max(e2.length, t2.length); e2.length < n2; )
  517. e2.push("0");
  518. for (; t2.length < n2; )
  519. t2.push("0");
  520. for (var o2 = 0; o2 < n2; o2++) {
  521. var s2 = parseInt(e2[o2]), a2 = parseInt(t2[o2]);
  522. if (s2 > a2)
  523. return 1;
  524. if (s2 < a2)
  525. return -1;
  526. }
  527. return 0;
  528. }
  529. function Gt(e2) {
  530. var t2 = e2.originUrl, n2 = void 0 === t2 ? void 0 : t2, o2 = e2.originWidth, s2 = e2.originHeight, a2 = e2.min, r2 = void 0 === a2 ? 198 : a2, i2 = parseInt(o2), u2 = parseInt(s2), c2 = { url: void 0, width: 0, height: 0 };
  531. if ((i2 <= u2 ? i2 : u2) <= r2)
  532. c2.url = n2, c2.width = i2, c2.height = u2;
  533. else {
  534. u2 <= i2 ? (c2.width = Math.ceil(i2 * r2 / u2), c2.height = r2) : (c2.width = r2, c2.height = Math.ceil(u2 * r2 / i2));
  535. var l2 = n2 && n2.indexOf("?") > -1 ? "".concat(n2, "&") : "".concat(n2, "?");
  536. c2.url = "".concat(l2, 198 === r2 ? "imageView2/3/w/198/h/198" : "imageView2/3/w/720/h/720");
  537. }
  538. return at(n2) ? (c2.url, g(c2, Xe)) : c2;
  539. }
  540. function Ut(e2) {
  541. var t2 = e2[2];
  542. e2[2] = e2[1], e2[1] = t2;
  543. for (var n2 = 0; n2 < e2.length; n2++)
  544. e2[n2].setType(n2);
  545. }
  546. function Pt(e2) {
  547. var t2 = e2.servcmd;
  548. return t2.slice(t2.indexOf(".") + 1);
  549. }
  550. function bt(e2, t2) {
  551. return Math.round(Number(e2) * Math.pow(10, t2)) / Math.pow(10, t2);
  552. }
  553. function wt(e2, t2) {
  554. return e2.includes(t2);
  555. }
  556. function Ft(e2, t2) {
  557. return e2.includes(t2);
  558. }
  559. function qt(e2) {
  560. return e2.split(Je)[0];
  561. }
  562. var xt = function(e2, t2, n2) {
  563. if (at(t2))
  564. return "";
  565. switch (e2) {
  566. case S.MSG_TEXT:
  567. return t2.text;
  568. case S.MSG_IMAGE:
  569. return n2 ? "[Image]" : "[图片]";
  570. case S.MSG_LOCATION:
  571. return n2 ? "[Location]" : "[位置]";
  572. case S.MSG_AUDIO:
  573. return n2 ? "[Voice]" : "[语音]";
  574. case S.MSG_VIDEO:
  575. return n2 ? "[Video]" : "[视频]";
  576. case S.MSG_FILE:
  577. return n2 ? "[File]" : "[文件]";
  578. case S.MSG_CUSTOM:
  579. return n2 ? "[Custom Messages]" : "[自定义消息]";
  580. case S.MSG_GRP_TIP:
  581. return n2 ? "[Group Notification]" : "[群提示消息]";
  582. case S.MSG_GRP_SYS_NOTICE:
  583. return n2 ? "[Group System Message]" : "[群系统通知]";
  584. case S.MSG_FACE:
  585. return n2 ? "[Animated Sticker]" : "[动画表情]";
  586. case S.MSG_MERGER:
  587. return n2 ? "[Chat Record]" : "[聊天记录]";
  588. default:
  589. return "";
  590. }
  591. };
  592. function Vt(e2) {
  593. return e2 === S.MSG_TEXT || e2 === S.MSG_CUSTOM || e2 === S.MSG_LOCATION || e2 === S.MSG_FACE;
  594. }
  595. function Bt(e2) {
  596. var t2 = [];
  597. if (!et(e2))
  598. return t2;
  599. var n2 = e2.length;
  600. if (0 === n2)
  601. return t2;
  602. for (var o2 = n2 - 1; o2 >= 0; o2--)
  603. "1" === e2[o2] && t2.push(Math.pow(2, n2 - o2 - 1));
  604. return t2;
  605. }
  606. function Ht() {
  607. return !ye && !se;
  608. }
  609. function Kt(e2) {
  610. return "the length of userIDList cannot exceed ".concat(e2);
  611. }
  612. function Wt(e2, t2) {
  613. if (e2) {
  614. var n2 = e2;
  615. return t2 && (e2.startsWith("http://") ? n2 = e2.replace(/^http:\/\/[^/]+/, t2) : e2.startsWith("https://") && (n2 = e2.replace(/^https:\/\/[^/]+/, t2))), n2;
  616. }
  617. }
  618. var Yt = Object.prototype.hasOwnProperty;
  619. function jt(e2) {
  620. if (null == e2)
  621. return true;
  622. if ("boolean" == typeof e2)
  623. return false;
  624. if ("number" == typeof e2)
  625. return 0 === e2;
  626. if ("string" == typeof e2)
  627. return 0 === e2.length;
  628. if ("function" == typeof e2)
  629. return 0 === e2.length;
  630. if (Array.isArray(e2))
  631. return 0 === e2.length;
  632. if (e2 instanceof Error)
  633. return "" === e2.message;
  634. if (ot(e2)) {
  635. for (var t2 in e2)
  636. if (Yt.call(e2, t2))
  637. return false;
  638. return true;
  639. }
  640. return !(!Qe(e2) && (n2 = e2, "set" !== ct(n2)) && !Ze(e2)) && 0 === e2.size;
  641. var n2;
  642. }
  643. function zt(e2, t2, n2) {
  644. if (void 0 === t2)
  645. return true;
  646. var o2 = true;
  647. if (ot(t2))
  648. Object.keys(t2).forEach(function(s3) {
  649. var a2 = 1 === e2.length ? e2[0][s3] : void 0;
  650. o2 = !!Jt(a2, t2[s3], n2, s3) && o2;
  651. });
  652. else if (st(t2))
  653. for (var s2 = 0; s2 < t2.length; s2++)
  654. o2 = !!Jt(e2[s2], t2[s2], n2, t2[s2].name) && o2;
  655. if (o2)
  656. return o2;
  657. throw new Error("Params validate failed.");
  658. }
  659. function Jt(e2, t2, n2, o2) {
  660. if (void 0 === t2)
  661. return true;
  662. var s2 = true;
  663. if (t2.required && jt(e2) && (xe.e("[".concat(n2, '] Missing required params: "').concat(o2, '".')), s2 = false), !jt(e2)) {
  664. var a2 = ct(e2), r2 = t2.type.toLowerCase();
  665. a2 !== r2 && ("asyncfunction" === a2 && "function" === r2 || (xe.e("[".concat(n2, '] Invalid params: type check failed for "').concat(o2, '".Expected ').concat(t2.type, ".")), s2 = false));
  666. }
  667. return t2.validator && !t2.validator(e2) && (xe.e("[".concat(n2, "] Invalid params: custom validator check failed for params.")), s2 = false), s2;
  668. }
  669. var Xt, Qt = { UNSEND: "unSend", SUCCESS: "success", FAIL: "fail" }, Zt = { NOT_START: "notStart", PENDING: "pending", RESOLVED: "resolved", REJECTED: "rejected" }, $t = function(e2) {
  670. if (!e2)
  671. return false;
  672. if (Et(e2) || St(e2) || kt(e2))
  673. return true;
  674. var t2 = Sn("InvalidConversationID", e2);
  675. return t2 && xe.w(t2), false;
  676. }, en = function(e2) {
  677. "" !== e2.desc && "" !== Sn("API_REFER") && xe.w("[".concat(e2.api, "] | ").concat(e2.param, " | ").concat(e2.desc, ", ").concat(Sn("API_REFER")).concat(e2.api));
  678. }, tn = function() {
  679. return Sn("StringRequiredLog");
  680. }, nn = function(e2) {
  681. return Sn("NonEmptyStringRequiredLog", e2);
  682. }, on = function() {
  683. return Sn("NumberRequiredLog");
  684. }, sn = function() {
  685. return Sn("UndefinedNotAllowedLog");
  686. }, an = function() {
  687. return Sn("FileRequiredLog");
  688. }, rn = function() {
  689. return Sn("FunctionRequiredLog");
  690. }, un = function() {
  691. return Sn("ArrayRequiredLog");
  692. }, cn = function() {
  693. return Sn("NonEmptyArrayLog");
  694. }, ln = function() {
  695. return Sn("CallbackMissingLog");
  696. }, pn = function() {
  697. return Sn("PositiveIntegerRequiredLog");
  698. }, dn = function(e2, t2) {
  699. return Sn("StringNotLongerThanLog", e2, t2);
  700. }, gn = function(e2, t2) {
  701. return Sn("NumberLessThanLog", e2, t2);
  702. }, _n = function(e2) {
  703. return Sn("KeyValueStringRequiredLog", e2);
  704. }, hn = function() {
  705. return Sn("PlainObjectRequiredLog");
  706. }, fn = function() {
  707. return Sn("NonEmptyContentRequiredLog");
  708. }, vn = function() {
  709. return Sn("FileNotSelectedLog");
  710. }, mn = function() {
  711. return Sn("MessageInstanceRequiredLog");
  712. }, Mn = function() {
  713. return Sn("NonAnonymousFunctionLog");
  714. }, yn = function() {
  715. return Sn("MessageExtensionNotAvailableLog");
  716. }, In = { type: "String", required: true }, Cn = { type: "Array", required: true }, Tn = { type: "Object", required: true }, Dn = { type: "Boolean", required: true }, En = { type: "number", required: true }, Sn = null, kn = { hookGetAPITips: function(e2) {
  717. Sn = e2;
  718. }, login: { userID: In, userSig: In }, addToBlacklist: { userIDList: Cn }, removeFromBlacklist: { userIDList: Cn }, on: [{ name: "eventName", type: "String", validator: function(e2) {
  719. return "string" == typeof e2 && 0 !== e2.length || (en({ api: "on", param: "eventName", desc: nn("eventName") }), false);
  720. } }, { name: "handler", type: "Function", validator: function(e2) {
  721. return "function" != typeof e2 ? (en({ api: "on", param: "handler", desc: rn() }), false) : ("" === e2.name && en({ api: "on", param: "handler", desc: Mn() }), true);
  722. } }], once: [{ name: "eventName", type: "String", validator: function(e2) {
  723. return "string" == typeof e2 && 0 !== e2.length || (en({ api: "once", param: "eventName", desc: nn("eventName") }), false);
  724. } }, { name: "handler", type: "Function", validator: function(e2) {
  725. return "function" != typeof e2 ? (en({ api: "once", param: "handler", desc: rn() }), false) : ("" === e2.name && en({ api: "once", param: "handler", desc: Mn() }), true);
  726. } }], off: [{ name: "eventName", type: "String", validator: function(e2) {
  727. return "string" == typeof e2 && 0 !== e2.length || (en({ api: "off", param: "eventName", desc: nn("eventName") }), false);
  728. } }, { name: "handler", type: "Function", validator: function(e2) {
  729. return "function" != typeof e2 ? (en({ api: "off", param: "handler", desc: rn() }), false) : ("" === e2.name && en({ api: "off", param: "handler", desc: Mn() }), true);
  730. } }], sendMessage: [t({ name: "message" }, Tn)], setMessageExtensions: [t(t({ name: "message" }, Tn), {}, { validator: function(e2) {
  731. return e2.status === Qt.SUCCESS && true === e2.isSupportExtension || (en({ api: "setMessageExtensions", param: "message", desc: yn() }), false);
  732. } }), t({ name: "extensions" }, Cn)], getMessageExtensions: [t(t({ name: "message" }, Tn), {}, { validator: function(e2) {
  733. return e2.status === Qt.SUCCESS && true === e2.isSupportExtension || (en({ api: "getMessageExtensions", param: "message", desc: yn() }), false);
  734. } })], deleteMessageExtensions: [t(t({ name: "message" }, Tn), {}, { validator: function(e2) {
  735. return e2.status === Qt.SUCCESS && true === e2.isSupportExtension || (en({ api: "deleteMessageExtensions", param: "message", desc: yn() }), false);
  736. } })], getMessageList: { conversationID: t(t({}, In), {}, { validator: function(e2) {
  737. return $t(e2);
  738. } }), nextReqMessageID: { type: "String" }, count: { type: "Number", validator: function(e2) {
  739. return !(!at(e2) && !/^[1-9][0-9]*$/.test(e2)) || (en({ api: "getMessageList", param: "count", desc: pn() }), false);
  740. } } }, getMessageListHopping: { conversationID: t(t({}, In), {}, { validator: function(e2) {
  741. return $t(e2);
  742. } }), sequence: { type: "Number" }, time: { type: "Number" }, direction: { type: "Number", validator: function(e2) {
  743. return !(!at(e2) && 0 !== e2 && 1 !== e2) || (en({ api: "getMessageListHopping", param: "direction", desc: Sn("0Or1RequiredLog") }), false);
  744. } }, count: { type: "Number", validator: function(e2) {
  745. return !(!at(e2) && !/^[1-9][0-9]*$/.test(e2)) || (en({ api: "getMessageListHopping", param: "count", desc: pn }), false);
  746. } } }, setMessageRead: { conversationID: t(t({}, In), {}, { validator: function(e2) {
  747. return $t(e2);
  748. } }) }, setAllMessageRead: { scope: { type: "String", required: false, validator: function(e2) {
  749. return !e2 || -1 !== [S.READ_ALL_C2C_MSG, S.READ_ALL_GROUP_MSG, S.READ_ALL_MSG].indexOf(e2) || (en({ api: "setAllMessageRead", param: "scope", desc: "TIM.TYPES.READ_ALL_C2C_MSG or TIM.TYPES.READ_ALL_GROUP_MSG or TIM.TYPES.READ_ALL_MSG required" }), false);
  750. } } }, getConversationProfile: [t(t({ name: "conversationID" }, In), {}, { validator: function(e2) {
  751. return $t(e2);
  752. } })], clearHistoryMessage: [t(t({ name: "conversationID" }, In), {}, { validator: function(e2) {
  753. return $t(e2);
  754. } })], pinConversation: { conversationID: t(t({}, In), {}, { validator: function(e2) {
  755. return $t(e2);
  756. } }), isPinned: t({}, Dn) }, setConversationCustomData: { conversationIDList: t({}, Cn), customData: { type: "String", validator: function(e2) {
  757. return et(e2) ? !(e2.length > 256) || (en({ api: "setConversationCustomData", param: "customData", desc: dn("customData", 256) }), false) : (en({ api: "setConversationCustomData", param: "customData", desc: tn() }), false);
  758. } } }, markConversation: { conversationIDList: t({}, Cn), markType: { type: "number", validator: function(e2) {
  759. return $e(e2) ? e2 <= 0 ? (en({ api: "markConversation", param: "markType", desc: (t2 = "markType", n2 = 0, Sn("NumberGreaterThanLog", t2, n2)) }), false) : !(e2 >= Math.pow(2, 64)) || (en({ api: "markConversation", param: "markType", desc: gn("markType", "Math.pow(2,64)") }), false) : (en({ api: "markConversation", param: "markType", desc: on() }), false);
  760. var t2, n2;
  761. } }, enableMark: t({}, Dn) }, createConversationGroup: { conversationIDList: t({}, Cn), groupName: t(t({}, In), {}, { validator: function(e2) {
  762. return !!e2 && (!(e2.length > 32) || (en({ api: "createConversationGroup", param: "groupName", desc: dn("groupName", 32) }), false));
  763. } }) }, deleteConversationGroup: [t({ name: "groupName" }, In)], renameConversationGroup: { oldName: t({}, In), newName: t(t({}, In), {}, { validator: function(e2) {
  764. return !!e2 && (!(e2.length > 32) || (en({ api: "renameConversationGroup", param: "newName", desc: dn("newName", 32) }), false));
  765. } }) }, addConversationsToGroup: { conversationIDList: t({}, Cn), groupName: t({}, In) }, deleteConversationsFromGroup: { conversationIDList: t({}, Cn), groupName: t({}, In) }, getGroupList: { groupProfileFilter: { type: "Array" } }, getGroupProfile: { groupID: In, groupCustomFieldFilter: { type: "Array" }, memberCustomFieldFilter: { type: "Array" } }, getGroupProfileAdvance: { groupIDList: Cn }, createGroup: { name: In }, joinGroup: { groupID: In, type: { type: "String" }, applyMessage: { type: "String" } }, quitGroup: [t({ name: "groupID" }, In)], handleApplication: { message: Tn, handleAction: In, handleMessage: { type: "String" } }, changeGroupOwner: { groupID: In, newOwnerID: In }, updateGroupProfile: { groupID: In, muteAllMembers: { type: "Boolean" } }, dismissGroup: [t({ name: "groupID" }, In)], searchGroupByID: [t({ name: "groupID" }, In)], initGroupAttributes: { groupID: In, groupAttributes: t(t({}, Tn), {}, { validator: function(e2) {
  766. var t2 = true;
  767. return Object.keys(e2).forEach(function(n2) {
  768. if (!et(e2[n2]))
  769. return en({ api: "initGroupAttributes", param: "groupAttributes", desc: _n("value") }), t2 = false;
  770. }), t2;
  771. } }) }, setGroupAttributes: { groupID: In, groupAttributes: t(t({}, Tn), {}, { validator: function(e2) {
  772. var t2 = true;
  773. return Object.keys(e2).forEach(function(n2) {
  774. if (!et(e2[n2]))
  775. return en({ api: "setGroupAttributes", param: "groupAttributes", desc: _n("value") }), t2 = false;
  776. }), t2;
  777. } }) }, deleteGroupAttributes: { groupID: In, keyList: { type: "Array", validator: function(e2) {
  778. if (at(e2) || !st(e2))
  779. return en({ api: "deleteGroupAttributes", param: "keyList", desc: un() }), false;
  780. if (!jt(e2)) {
  781. var t2 = true;
  782. return e2.forEach(function(e3) {
  783. if (!et(e3))
  784. return en({ api: "deleteGroupAttributes", param: "keyList", desc: Sn("StringArrayRequiredLog") }), t2 = false;
  785. }), t2;
  786. }
  787. return true;
  788. } } }, getGroupAttributes: { groupID: In, keyList: { type: "Array", validator: function(e2) {
  789. if (at(e2) || !st(e2))
  790. return en({ api: "getGroupAttributes", param: "keyList", desc: un() }), false;
  791. if (!jt(e2)) {
  792. var t2 = true;
  793. return e2.forEach(function(e3) {
  794. if (!et(e3))
  795. return en({ api: "getGroupAttributes", param: "keyList", desc: _n("key") }), t2 = false;
  796. }), t2;
  797. }
  798. return true;
  799. } } }, setGroupCounters: { groupID: In, counters: Tn }, increaseGroupCounter: { groupID: In, key: In, value: En }, decreaseGroupCounter: { groupID: In, key: In, value: En }, getGroupCounters: { groupID: In }, getGroupMemberList: { groupID: In, count: { type: "Number" } }, getGroupMemberProfile: { groupID: In, userIDList: Cn, memberCustomFieldFilter: { type: "Array" } }, addGroupMember: { groupID: In, userIDList: Cn }, setGroupMemberRole: { groupID: In, userID: In, role: In }, setGroupMemberMuteTime: { groupID: In, userID: In, muteTime: { type: "Number", validator: function(e2) {
  800. return e2 >= 0;
  801. } } }, setGroupMemberNameCard: { groupID: In, userID: { type: "String" }, nameCard: { type: "String", validator: function(e2) {
  802. return et(e2) ? (e2.length, true) : (en({ api: "setGroupMemberNameCard", param: "nameCard", desc: tn() }), false);
  803. } } }, setGroupMemberCustomField: { groupID: In, userID: { type: "String" }, memberCustomField: Cn }, deleteGroupMember: { groupID: In }, markGroupMemberList: { groupID: In, markType: { type: "number", validator: function(e2) {
  804. return $e(e2) ? !(e2 < 1e3) || (en({ api: "markGroupMemberList", param: "markType", desc: (t2 = "markType", n2 = 1e3, Sn("NumberGreaterOrEqualLog", t2, n2)) }), false) : (en({ api: "markGroupMemberList", param: "markType", desc: on() }), false);
  805. var t2, n2;
  806. } }, userIDList: t({}, Cn), enableMark: t({}, Dn) }, createTextMessage: { to: In, conversationType: In, payload: t(t({}, Tn), {}, { validator: function(e2) {
  807. return ot(e2) ? et(e2.text) ? 0 !== e2.text.length || (en({ api: "createTextMessage", param: "payload.text", desc: fn() }), false) : (en({ api: "createTextMessage", param: "payload.text", desc: tn() }), false) : (en({ api: "createTextMessage", param: "payload", desc: hn() }), false);
  808. } }) }, createTextAtMessage: { to: In, conversationType: In, payload: t(t({}, Tn), {}, { validator: function(e2) {
  809. return ot(e2) ? et(e2.text) ? 0 === e2.text.length ? (en({ api: "createTextAtMessage", param: "payload.text", desc: fn() }), false) : !(e2.atUserList && !st(e2.atUserList)) || (en({ api: "createTextAtMessage", param: "payload.atUserList", desc: un() }), false) : (en({ api: "createTextAtMessage", param: "payload.text", desc: tn() }), false) : (en({ api: "createTextAtMessage", param: "payload", desc: hn() }), false);
  810. } }) }, createCustomMessage: { to: In, conversationType: In, payload: t(t({}, Tn), {}, { validator: function(e2) {
  811. return ot(e2) ? e2.data && !et(e2.data) ? (en({ api: "createCustomMessage", param: "payload.data", desc: tn() }), false) : e2.description && !et(e2.description) ? (en({ api: "createCustomMessage", param: "payload.description", desc: tn() }), false) : !(e2.extension && !et(e2.extension)) || (en({ api: "createCustomMessage", param: "payload.extension", desc: tn() }), false) : (en({ api: "createCustomMessage", param: "payload", desc: hn() }), false);
  812. } }) }, createImageMessage: { to: In, conversationType: In, payload: t(t({}, Tn), {}, { validator: function(e2) {
  813. if (!ot(e2))
  814. return en({ api: "createImageMessage", param: "payload", desc: hn() }), false;
  815. if (at(e2.file))
  816. return en({ api: "createImageMessage", param: "payload.file", desc: sn() }), false;
  817. if (ae) {
  818. if (!(e2.file instanceof HTMLInputElement || Ze(e2.file)))
  819. return ot(e2.file) && "undefined" != typeof uni ? 0 !== e2.file.tempFilePaths.length && 0 !== e2.file.tempFiles.length || (en({ api: "createImageMessage", param: "payload.file", desc: vn() }), false) : (en({ api: "createImageMessage", param: "payload.file", desc: an() }), false);
  820. if (e2.file instanceof HTMLInputElement && 0 === e2.file.files.length)
  821. return en({ api: "createImageMessage", param: "payload.file", desc: vn() }), false;
  822. }
  823. return true;
  824. }, onProgress: { type: "Function", required: false, validator: function(e2) {
  825. return at(e2) && en({ api: "createImageMessage", param: "onProgress", desc: ln() }), true;
  826. } } }) }, createAudioMessage: { to: In, conversationType: In, payload: t(t({}, Tn), {}, { validator: function(e2) {
  827. return !!ot(e2) || (en({ api: "createAudioMessage", param: "payload", desc: hn() }), false);
  828. } }), onProgress: { type: "Function", required: false, validator: function(e2) {
  829. return at(e2) && en({ api: "createAudioMessage", param: "onProgress", desc: ln() }), true;
  830. } } }, createVideoMessage: { to: In, conversationType: In, payload: t(t({}, Tn), {}, { validator: function(e2) {
  831. if (!ot(e2))
  832. return en({ api: "createVideoMessage", param: "payload", desc: hn() }), false;
  833. if (at(e2.file))
  834. return en({ api: "createVideoMessage", param: "payload.file", desc: sn() }), false;
  835. if (ae) {
  836. if (!(e2.file instanceof HTMLInputElement || Ze(e2.file)))
  837. return ot(e2.file) && "undefined" != typeof uni ? !!Ze(e2.file.tempFile) || (en({ api: "createVideoMessage", param: "payload.file", desc: vn() }), false) : (en({ api: "createVideoMessage", param: "payload.file", desc: an() }), false);
  838. if (e2.file instanceof HTMLInputElement && 0 === e2.file.files.length)
  839. return en({ api: "createVideoMessage", param: "payload.file", desc: vn() }), false;
  840. }
  841. return true;
  842. } }), onProgress: { type: "Function", required: false, validator: function(e2) {
  843. return at(e2) && en({ api: "createVideoMessage", param: "onProgress", desc: ln() }), true;
  844. } } }, createFaceMessage: { to: In, conversationType: In, payload: t(t({}, Tn), {}, { validator: function(e2) {
  845. return ot(e2) ? $e(e2.index) ? !!et(e2.data) || (en({ api: "createFaceMessage", param: "payload.data", desc: tn() }), false) : (en({ api: "createFaceMessage", param: "payload.index", desc: on() }), false) : (en({ api: "createFaceMessage", param: "payload", desc: hn() }), false);
  846. } }) }, createFileMessage: { to: In, conversationType: In, payload: t(t({}, Tn), {}, { validator: function(e2) {
  847. if (!ot(e2))
  848. return en({ api: "createFileMessage", param: "payload", desc: hn() }), false;
  849. if (at(e2.file))
  850. return en({ api: "createFileMessage", param: "payload.file", desc: sn() }), false;
  851. if (ae) {
  852. if (!(e2.file instanceof HTMLInputElement || Ze(e2.file)))
  853. return ot(e2.file) && "undefined" != typeof uni ? 0 !== e2.file.tempFilePaths.length && 0 !== e2.file.tempFiles.length || (en({ api: "createFileMessage", param: "payload.file", desc: vn() }), false) : (en({ api: "createFileMessage", param: "payload.file", desc: an() }), false);
  854. if (e2.file instanceof HTMLInputElement && 0 === e2.file.files.length)
  855. return en({ api: "createFileMessage", param: "payload.file", desc: vn() }), false;
  856. }
  857. return true;
  858. } }), onProgress: { type: "Function", required: false, validator: function(e2) {
  859. return at(e2) && en({ api: "createFileMessage", param: "onProgress", desc: ln() }), true;
  860. } } }, createLocationMessage: { to: In, conversationType: In, payload: t(t({}, Tn), {}, { validator: function(e2) {
  861. return ot(e2) ? et(e2.description) ? $e(e2.longitude) ? !!$e(e2.latitude) || (en({ api: "createLocationMessage", param: "payload.latitude", desc: on() }), false) : (en({ api: "createLocationMessage", param: "payload.longitude", desc: on() }), false) : (en({ api: "createLocationMessage", param: "payload.description", desc: tn() }), false) : (en({ api: "createLocationMessage", param: "payload", desc: hn() }), false);
  862. } }) }, createMergerMessage: { to: In, conversationType: In, payload: t(t({}, Tn), {}, { validator: function(e2) {
  863. if (jt(e2.messageList))
  864. return en({ api: "createMergerMessage", param: "payload.messageList", desc: cn() }), false;
  865. if (jt(e2.compatibleText))
  866. return en({ api: "createMergerMessage", param: "payload.compatibleText", desc: nn("compatibleText") }), false;
  867. var t2 = false;
  868. return e2.messageList.forEach(function(e3) {
  869. e3.status === Qt.FAIL && (t2 = true);
  870. }), !t2 || (en({ api: "createMergerMessage", param: "payload.messageList", desc: Sn("MergeFailedMessageLog") }), false);
  871. } }) }, revokeMessage: [t(t({ name: "message" }, Tn), {}, { validator: function(e2) {
  872. return jt(e2) ? (en({ api: "revokeMessage", param: "message", desc: mn() }), false) : e2.conversationType === S.CONV_SYSTEM ? (en({ api: "revokeMessage", param: "message", desc: Sn("MessageCanBeRevokedDesc") }), false) : true !== e2.isRevoked || (en({ api: "revokeMessage", param: "message", desc: Sn("MessageRevokedLog") }), false);
  873. } })], deleteMessage: [t(t({ name: "messageList" }, Cn), {}, { validator: function(e2) {
  874. return !jt(e2) || (en({ api: "deleteMessage", param: "messageList", desc: cn() }), false);
  875. } })], translateText: { sourceTextList: Cn, sourceLanguage: In, targetLanguage: In }, modifyMessage: [t(t({ name: "message" }, Tn), {}, { validator: function(e2) {
  876. return jt(e2) ? (en({ api: "modifyMessage", param: "message", desc: mn() }), false) : e2.conversationType === S.CONV_SYSTEM ? (en({ api: "modifyMessage", param: "message", desc: Sn("MessageCanBeModifiedLog") }), false) : true !== e2._onlineOnlyFlag || (en({ api: "modifyMessage", param: "message", desc: Sn("OnlineMessageNotSupportLog") }), false);
  877. } })], getUserProfile: { userIDList: { type: "Array", validator: function(e2) {
  878. return st(e2) ? (0 === e2.length && en({ api: "getUserProfile", param: "userIDList", desc: cn() }), true) : (en({ api: "getUserProfile", param: "userIDList", desc: un() }), false);
  879. } } }, updateMyProfile: { profileCustomField: { type: "Array", validator: function(e2) {
  880. return !!at(e2) || (!!st(e2) || (en({ api: "updateMyProfile", param: "profileCustomField", desc: un() }), false));
  881. } } }, setSelfStatus: { customStatus: { type: "String", validator: function(e2) {
  882. return !!et(e2) || (en({ api: "setSelfStatus", param: "customStatus", desc: tn() }), false);
  883. } } }, getUserStatus: { userIDList: { type: "Array", validator: function(e2) {
  884. return st(e2) ? 0 !== e2.length || (en({ api: "getUserStatus", param: "userIDList", desc: cn() }), false) : (en({ api: "getUserStatus", param: "userIDList", desc: un() }), false);
  885. } } }, subscribeUserStatus: { userIDList: { type: "Array", validator: function(e2) {
  886. return st(e2) ? 0 !== e2.length || (en({ api: "subscribeUserStatus", param: "userIDList", desc: cn() }), false) : (en({ api: "subscribeUserStatus", param: "userIDList", desc: un() }), false);
  887. } } }, unsubscribeUserStatus: { userIDList: { type: "Array", validator: function(e2) {
  888. return !e2 || (!!st(e2) || (en({ api: "subscribeUserStatus", param: "userIDList", desc: un() }), false));
  889. } } }, addFriend: { to: In, source: { type: "String", required: true, validator: function(e2) {
  890. return !!e2 && (e2.startsWith("AddSource_Type_") ? !(e2.replace("AddSource_Type_", "").length > 8) || (en({ api: "addFriend", param: "source", desc: dn("keyword", 8) }), false) : (en({ api: "addFriend", param: "source", desc: Sn("SourcePrefixLog") }), false));
  891. } }, remark: { type: "String", required: false, validator: function(e2) {
  892. return !(et(e2) && e2.length > 96) || (en({ api: "addFriend", param: "remark", desc: dn("remark", 96) }), false);
  893. } } }, deleteFriend: { userIDList: Cn }, checkFriend: { userIDList: Cn }, getFriendProfile: { userIDList: Cn }, updateFriend: { userID: In, remark: { type: "String", required: false, validator: function(e2) {
  894. return !(et(e2) && e2.length > 96) || (en({ api: "updateFriend", param: "remark", desc: dn("remark", 96) }), false);
  895. } }, friendCustomField: { type: "Array", required: false, validator: function(e2) {
  896. if (e2) {
  897. if (!st(e2))
  898. return en({ api: "updateFriend", param: "friendCustomField", desc: un() }), false;
  899. var t2 = true;
  900. return e2.forEach(function(e3) {
  901. return et(e3.key) && -1 !== e3.key.indexOf("Tag_SNS_Custom") ? et(e3.value) ? e3.key.replace("Tag_SNS_Custom_", "").length > 8 ? (en({ api: "updateFriend", param: "friendCustomField", desc: dn("keyword", 8) }), t2 = false) : void 0 : (en({ api: "updateFriend", param: "friendCustomField", desc: _n("value") }), t2 = false) : (en({ api: "updateFriend", param: "friendCustomField", desc: Sn("FriendCustomFieldPrefixLog") }), t2 = false);
  902. }), t2;
  903. }
  904. return true;
  905. } } }, acceptFriendApplication: { userID: In }, refuseFriendApplication: { userID: In }, deleteFriendApplication: { userID: In }, createFriendGroup: { name: In }, deleteFriendGroup: { name: In }, addToFriendGroup: { name: In, userIDList: Cn }, removeFromFriendGroup: { name: In, userIDList: Cn }, renameFriendGroup: { oldName: In, newName: In }, sendMessageReadReceipt: [{ name: "messageList", type: "Array", validator: function(e2) {
  906. return st(e2) ? 0 !== e2.length || (en({ api: "sendMessageReadReceipt", param: "messageList", desc: cn() }), false) : (en({ api: "sendMessageReadReceipt", param: "messageList", desc: un() }), false);
  907. } }], getMessageReadReceiptList: [{ name: "messageList", type: "Array", validator: function(e2) {
  908. return st(e2) ? 0 !== e2.length || (en({ api: "getMessageReadReceiptList", param: "messageList", desc: cn() }), false) : (en({ api: "getMessageReadReceiptList", param: "messageList", desc: un() }), false);
  909. } }], createTopicInCommunity: { groupID: In, topicName: In }, deleteTopicFromCommunity: { groupID: In, topicIDList: { type: "Array", validator: function(e2) {
  910. return !e2 || (!!st(e2) || (en({ api: "deleteTopicFromCommunity", param: "topicIDList", desc: un() }), false));
  911. } } }, updateTopicProfile: { groupID: In, topicID: In }, getTopicList: { groupID: In, topicIDList: { type: "Array", validator: function(e2) {
  912. return !e2 || (!!st(e2) || (en({ api: "getTopicList", param: "topicIDList", desc: un() }), false));
  913. } } } }, Ln = { login: 1, logout: 1, on: 1, once: 1, off: 1, setLogLevel: 1, registerPlugin: 1, destroy: 1, createTextMessage: 1, createTextAtMessage: 1, createImageMessage: 1, createAudioMessage: 1, createVideoMessage: 1, createCustomMessage: 1, createFaceMessage: 1, createFileMessage: 1, createLocationMessage: 1, createMergerMessage: 1, downloadMergerMessage: 1, createForwardMessage: 1, sendMessage: 1, resendMessage: 1, revokeMessage: 1, deleteMessage: 1, translateText: 1, modifyMessage: 1, sendMessageReadReceipt: 1, getGroupMessageReadMemberList: 1, getMessageReadReceiptList: 1, setMessageExtensions: 1, getMessageExtensions: 1, deleteMessageExtensions: 1, getMessageList: 1, findMessage: 1, getMessageListHopping: 1, setMessageRead: 1, setAllMessageRead: 1, getConversationList: 1, getConversationProfile: 1, deleteConversation: 1, pinConversation: 1, getTotalUnreadMessageCount: 1, setConversationCustomData: 1, markConversation: 1, createConversationGroup: 1, getConversationGroupList: 1, deleteConversationGroup: 1, renameConversationGroup: 1, addConversationsToGroup: 1, deleteConversationsFromGroup: 1, clearHistoryMessage: 1, getGroupList: 1, getGroupProfile: 1, createGroup: 1, joinGroup: 1, updateGroupProfile: 1, quitGroup: 1, dismissGroup: 1, changeGroupOwner: 1, searchGroupByID: 1, setMessageRemindType: 1, getGroupApplicationList: 1, handleGroupApplication: 1, initGroupAttributes: 1, setGroupAttributes: 1, deleteGroupAttributes: 1, getGroupAttributes: 1, setGroupCounters: 1, increaseGroupCounter: 1, decreaseGroupCounter: 1, getGroupCounters: 1, getJoinedCommunityList: 1, createTopicInCommunity: 1, deleteTopicFromCommunity: 1, updateTopicProfile: 1, getTopicList: 1, getGroupMemberProfile: 1, getGroupMemberList: 1, addGroupMember: 1, deleteGroupMember: 1, setGroupMemberNameCard: 1, setGroupMemberMuteTime: 1, setGroupMemberRole: 1, setGroupMemberCustomField: 1, getGroupOnlineMemberCount: 1, markGroupMemberList: 1, getMyProfile: 1, getUserProfile: 1, updateMyProfile: 1, setSelfStatus: 1, getUserStatus: 1, subscribeUserStatus: 1, unsubscribeUserStatus: 1, getBlacklist: 1, addToBlacklist: 1, removeFromBlacklist: 1, getFriendList: 1, addFriend: 1, deleteFriend: 1, checkFriend: 1, updateFriend: 1, getFriendProfile: 1, getFriendApplicationList: 1, refuseFriendApplication: 1, deleteFriendApplication: 1, acceptFriendApplication: 1, setFriendApplicationRead: 1, getFriendGroupList: 1, createFriendGroup: 1, renameFriendGroup: 1, deleteFriendGroup: 1, addToFriendGroup: 1, removeFromFriendGroup: 1, callExperimentalAPI: 1 }, An = 1, Rn = 2, Nn = 3, On = 4, Gn = 6, Un = 7, Pn = 8, bn = 9, wn = 10, Fn = 11, qn = 12, xn = 13, Vn = 14, Bn = 15, Hn = 16, Kn = 17, Wn = 18, Yn = 19, jn = 20, zn = 21, Jn = 22, Xn = 23, Qn = 24, Zn = 25, $n = 26, eo = 27, to = 28, no = 29, oo = 30, so = 31, ao = 32, ro = function() {
  914. function e2(t2) {
  915. o(this, e2), this._m = t2, this._n = "";
  916. }
  917. return a(e2, [{ key: "isLoggedIn", value: function() {
  918. return this._m.getModule(qn).isLoggedIn();
  919. } }, { key: "isOversea", value: function() {
  920. return this._m.getModule(qn).isOversea();
  921. } }, { key: "isPrivateNetWork", value: function() {
  922. return this._m.getModule(qn).isPrivateNetWork();
  923. } }, { key: "getFileDownloadProxy", value: function() {
  924. return this._m.getModule(qn).getFileDownloadProxy();
  925. } }, { key: "getMyUserID", value: function() {
  926. return this._m.getModule(qn).getUserID();
  927. } }, { key: "getMyTinyID", value: function() {
  928. return this._m.getModule(qn).getTinyID();
  929. } }, { key: "getSDKAppID", value: function() {
  930. return this._m.getModule(qn).getSDKAppID();
  931. } }, { key: "isIntl", value: function() {
  932. return this._m.getModule(qn).isIntl();
  933. } }, { key: "isDevMode", value: function() {
  934. return this._m.getModule(qn).isDevMode();
  935. } }, { key: "getModule", value: function(e3) {
  936. return this._m.getModule(e3);
  937. } }, { key: "getPlatform", value: function() {
  938. return de;
  939. } }, { key: "getNetworkType", value: function() {
  940. return this._m.getModule(Bn).getNetworkType();
  941. } }, { key: "probeNetwork", value: function(e3) {
  942. return this._m.getModule(Bn).probe(e3);
  943. } }, { key: "getCloudConfig", value: function(e3) {
  944. return this._m.getModule(Xn).getCloudConfig(e3);
  945. } }, { key: "emitOuterEvent", value: function(e3, t2) {
  946. this._m.getOuterEmitterInstance().emit(e3, t2);
  947. } }, { key: "emitInnerEvent", value: function(e3, t2) {
  948. this._m.getInnerEmitterInstance().emit(e3, t2);
  949. } }, { key: "getInnerEmitterInstance", value: function() {
  950. return this._m.getInnerEmitterInstance();
  951. } }, { key: "generateTjgID", value: function(e3) {
  952. return this._m.getModule(qn).getTinyID() + "-" + e3.random;
  953. } }, { key: "filterModifiedMessage", value: function(e3) {
  954. if (!jt(e3)) {
  955. var t2 = e3.filter(function(e4) {
  956. return true === e4.isModified;
  957. });
  958. t2.length > 0 && this.emitOuterEvent(E.MESSAGE_MODIFIED, t2);
  959. }
  960. } }, { key: "filterUnmodifiedMessage", value: function(e3) {
  961. return jt(e3) ? [] : e3.filter(function(e4) {
  962. return false === e4.isModified;
  963. });
  964. } }, { key: "request", value: function(e3) {
  965. return this._m.getModule(jn).request(e3);
  966. } }, { key: "canIUse", value: function(e3) {
  967. return this._m.getModule(eo).canIUse(e3);
  968. } }, { key: "getErrorMessage", value: function(e3, t2, n2) {
  969. return this._m.getErrorMessage(e3, t2, n2);
  970. } }, { key: "outputWarning", value: function(e3, t2, n2) {
  971. var o2 = this.getErrorMessage(e3, t2, n2);
  972. o2 && xe.w(o2);
  973. } }]), e2;
  974. }(), io = "wslogin", uo = "wslogout", co = "wshello", lo = "KickOther", po = "getmsg", go = "authkey", _o = "sendmsg", ho = "send_group_msg", fo = "portrait_get_all", vo = "portrait_set", mo = "black_list_get", Mo = "black_list_add", yo = "black_list_delete", Io = "msgwithdraw", Co = "msgreaded", To = "set_c2c_peer_mute_notifications", Do = "get_c2c_peer_mute_notifications", Eo = "getroammsg", So = "get_peer_read_time", ko = "delete_c2c_msg_ramble", Lo = "modify_c2c_msg", Ao = "set_key_values", Ro = "get_key_values", No = "page_get", Oo = "get", Go = "batch_delete", Uo = "clear_msg", Po = "top", bo = "deletemsg", wo = "set_conv_custom_data", Fo = "mark_contact", qo = "create_contact_group", xo = "del_contact_group", Vo = "update_contact_group", Bo = "add_conv_to_group", Ho = "del_conv_from_group", Ko = "get_contact_group", Wo = "get_joined_group_list", Yo = "get_group_self_member_info", jo = "create_group", zo = "destroy_group", Jo = "modify_group_base_info", Xo = "apply_join_group", Qo = "apply_join_group_noauth", Zo = "quit_group", $o = "get_group_public_info", es = "change_group_owner", ts = "handle_apply_join_group", ns = "handle_invite_join_permission_group", os = "handle_invite_join_group", ss = "group_msg_recall", as = "msg_read_report", rs = "read_all_unread_msg", is = "group_msg_get", us = "get_group_msg_receipt", cs = "group_msg_receipt", ls = "c2c_msg_read_receipt", ps = "get_group_msg_receipt_detail", ds = "get_pendency", gs = "deletemsg", _s = "get_msg", hs = "get_msg_noauth", fs = "get_online_member_num", vs = "delete_group_ramble_msg_by_seq", ms = "modify_group_msg", Ms = "set_group_attr", ys = "modify_group_attr", Is = "delete_group_attr", Cs = "clear_group_attr", Ts = "get_group_attr", Ds = "group_set_key_values", Es = "group_get_key_values", Ss = "get_group_notify", ks = "update_group_counter", Ls = "get_group_counter", As = "get_group_member_info", Rs = "get_members", Ns = "get_specified_group_member_info", Os = "add_group_member", Gs = "delete_group_member", Us = "ban_group_member", Ps = "modify_group_member_info", bs = "modify_user_info", ws = "cos", Fs = "pre_sig", qs = "video_cover", xs = "tim_web_report_v2", Vs = "alive", Bs = "msg_push", Hs = "multi_msg_push_ws", Ks = "ws_msg_push_ack", Ws = "stat_forceoffline", Ys = "save_relay_json_msg", js = "get_relay_json_msg", zs = "fetch_config", Js = "push_configv2", Xs = "fetch_imsdk_purchase_bitsv2", Qs = "push_imsdk_purchase_bitsv2", Zs = "notify2", $s = "create_topic", ea = "destroy_topic", ta = "modify_topic", na = "get_topic", oa = "ws_set_custom_status", sa = "ws_get_user_status", aa = "ws_status_subscribe", ra = "ws_status_unsubscribe", ia = "ws_stat_background", ua = "ws_stat_foreground", ca = "ws_stat_settoken", la = "get_local_words", pa = "ws_batch_trans_text", da = { NO_SDKAPPID: 2e3, NO_ACCOUNT_TYPE: 2001, NO_IDENTIFIER: 2002, NO_USERSIG: 2003, NO_TINYID: 2022, NO_A2KEY: 2023, USER_NOT_LOGGED_IN: 2024, REPEAT_LOGIN: 2025, COS_UNDETECTED: 2040, COS_GET_SIG_FAIL: 2041, MESSAGE_SEND_FAIL: 2100, MESSAGE_SEND_FAIL_NOT_IN_AVCHATROOM: 2101, MESSAGE_SEND_NEED_MESSAGE_INSTANCE: 2105, MESSAGE_SEND_INVALID_CONVERSATION_TYPE: 2106, MESSAGE_FILE_IS_EMPTY: 2108, MESSAGE_ONPROGRESS_FUNCTION_ERROR: 2109, MESSAGE_REVOKE_FAIL: 2110, MESSAGE_DELETE_FAIL: 2111, MESSAGE_UNREAD_ALL_FAIL: 2112, READ_RECEIPT_MESSAGE_LIST_EMPTY: 2114, MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL: 2115, CANNOT_DELETE_GROUP_SYSTEM_NOTICE: 2116, TRANSLATE_TEXT_FAIL: 2117, MESSAGE_IMAGE_SELECT_FILE_FIRST: 2251, MESSAGE_IMAGE_TYPES_LIMIT: 2252, MESSAGE_IMAGE_SIZE_LIMIT: 2253, MESSAGE_AUDIO_UPLOAD_FAIL: 2300, MESSAGE_AUDIO_SIZE_LIMIT: 2301, MESSAGE_VIDEO_UPLOAD_FAIL: 2350, MESSAGE_VIDEO_SIZE_LIMIT: 2351, MESSAGE_VIDEO_TYPES_LIMIT: 2352, MESSAGE_FILE_UPLOAD_FAIL: 2400, MESSAGE_FILE_SELECT_FILE_FIRST: 2401, MESSAGE_FILE_SIZE_LIMIT: 2402, MESSAGE_FILE_URL_IS_EMPTY: 2403, MESSAGE_MERGER_TYPE_INVALID: 2450, MESSAGE_MERGER_KEY_INVALID: 2451, MESSAGE_MERGER_DOWNLOAD_FAIL: 2452, MESSAGE_FORWARD_TYPE_INVALID: 2453, MESSAGE_MODIFY_CONFLICT: 2480, MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM: 2481, CONVERSATION_NOT_FOUND: 2500, USER_OR_GROUP_NOT_FOUND: 2501, CONVERSATION_UN_RECORDED_TYPE: 2502, INVALID_CONVERSATION_ID: 2503, ILLEGAL_GROUP_TYPE: 2600, CANNOT_JOIN_WORK: 2601, ILLEGAL_GROUP_ID: 2602, CANNOT_FIND_GROUP: 2603, CANNOT_CHANGE_OWNER_IN_AVCHATROOM: 2620, CANNOT_CHANGE_OWNER_TO_SELF: 2621, CANNOT_DISMISS_WORK: 2622, MEMBER_NOT_IN_GROUP: 2623, JOIN_GROUP_FAIL: 2660, CANNOT_ADD_MEMBER_IN_AVCHATROOM: 2661, CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN: 2662, NOT_OWNER: 2681, CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM: 2682, INVALID_MEMBER_ROLE: 2683, CANNOT_SET_SELF_MEMBER_ROLE: 2684, CANNOT_MUTE_SELF: 2685, BAN_DURATION_INVALID: 2686, NOT_MY_FRIEND: 2700, ALREADY_MY_FRIEND: 2701, FRIEND_GROUP_EXISTED: 2710, FRIEND_GROUP_NOT_EXIST: 2711, FRIEND_APPLICATION_NOT_EXIST: 2716, UPDATE_PROFILE_INVALID_PARAM: 2721, UPDATE_PROFILE_NO_KEY: 2722, CANNOT_ADD_SELF_TO_BLACKLIST: 2742, NETWORK_ERROR: 2800, NETWORK_TIMEOUT: 2801, NO_NETWORK: 2805, UNCAUGHT_ERROR: 2903, INVALID_OPERATION: 2905, INVALID_TRTC_CMD: 2995, OVER_FREQUENCY_LIMIT: 2996, CANNOT_FIND_PROTOCOL: 2997, CANNOT_FIND_MODULE: 2998, SDK_IS_NOT_READY: 2999, LOGGING_IN: 3e3, LOGIN_FAILED: 3001, KICKED_OUT_MULT_DEVICE: 3002, KICKED_OUT_MULT_ACCOUNT: 3003, KICKED_OUT_USERSIG_EXPIRED: 3004, LOGGED_OUT: 3005, KICKED_OUT_REST_API: 3006, ILLEGAL_TOPIC_ID: 3021, CANNOT_USE_COMMERCIAL_ABILITY: 3122, PROFANITY_FOUND: 3123, MESSAGE_A2KEY_EXPIRED: 20002, ACCOUNT_A2KEY_EXPIRED: 70001, HELLO_ANSWER_KICKED_OUT: 1002, OPEN_SERVICE_OVERLOAD_ERROR: 60022 }, ga = "networkRTT", _a = "messageE2EDelay", ha = "sendMessageC2C", fa = "sendMessageGroup", va = "sendMessageGroupAV", ma = "sendMessageRichMedia", Ma = "cosUpload", ya = "messageReceivedGroup", Ia = "messageReceivedGroupAVPush", Ca = "messageReceivedGroupAVPull", Ta = (r(Xt = {}, ga, 2), r(Xt, _a, 3), r(Xt, ha, 4), r(Xt, fa, 5), r(Xt, va, 6), r(Xt, ma, 7), r(Xt, ya, 8), r(Xt, Ia, 9), r(Xt, Ca, 10), r(Xt, Ma, 11), Xt), Da = { info: 4, warning: 5, error: 6 }, Ea = { wifi: 1, "2g": 2, "3g": 3, "4g": 4, "5g": 5, unknown: 6, none: 7, online: 8 }, Sa = { login: 4 }, ka = function() {
  975. function e2(t2) {
  976. o(this, e2), this._n = "SSOLogData", this.eventType = Sa[t2] || 0, this.timestamp = 0, this.networkType = 8, this.code = 0, this.message = "", this.moreMessage = "", this.extension = t2, this.costTime = 0, this.duplicate = false, this.level = 4, this.uiPlatform = void 0, this._sentFlag = false, this._startts = Ue();
  977. }
  978. return a(e2, [{ key: "updateTimeStamp", value: function() {
  979. this.timestamp = Ue();
  980. } }, { key: "start", value: function(e3) {
  981. return this._startts = e3, this;
  982. } }, { key: "end", value: function() {
  983. var e3 = this, t2 = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
  984. if (!this._sentFlag) {
  985. var n2 = Ue();
  986. 0 === this.costTime && (this.costTime = n2 - this._startts), this.setMoreMessage("startts:".concat(this._startts, " endts:").concat(n2)), t2 ? (this._sentFlag = true, this._eventStatModule && this._eventStatModule.pushIn(this)) : setTimeout(function() {
  987. e3._sentFlag = true, e3._eventStatModule && e3._eventStatModule.pushIn(e3);
  988. }, 0);
  989. }
  990. } }, { key: "setError", value: function(e3, t2, n2) {
  991. if (!(e3 instanceof Error))
  992. return xe.w("".concat(this._n, ".setError value not instanceof Error, please check!")), this;
  993. if (this._sentFlag)
  994. return this;
  995. if (this.setNetworkType(n2), t2)
  996. e3.code && this.setCode(e3.code), e3.message && this.setMoreMessage(e3.message);
  997. else {
  998. var o2 = da.NO_NETWORK;
  999. this.setCode(o2);
  1000. }
  1001. return this.setLevel("error"), this;
  1002. } }, { key: "setCode", value: function(e3) {
  1003. return at(e3) || this._sentFlag || ("ECONNABORTED" === e3 && (this.code = 103), $e(e3) ? this.code = e3 : xe.w("".concat(this._n, ".setCode value not a number, please check!"), e3, n(e3))), this;
  1004. } }, { key: "setMessage", value: function(e3) {
  1005. return at(e3) || this._sentFlag || ($e(e3) && (this.message = e3.toString()), et(e3) && (this.message = e3)), this;
  1006. } }, { key: "setCostTime", value: function(e3) {
  1007. return this.costTime = e3, this;
  1008. } }, { key: "setLevel", value: function(e3) {
  1009. return at(e3) || this._sentFlag || (this.level = Da[e3]), this;
  1010. } }, { key: "setMoreMessage", value: function(e3) {
  1011. return jt(this.moreMessage) ? this.moreMessage = "".concat(e3) : this.moreMessage += " ".concat(e3), this;
  1012. } }, { key: "setNetworkType", value: function(e3) {
  1013. if (at(e3))
  1014. xe.w("".concat(this._n, ".setNetworkType value is undefined, please check!"));
  1015. else {
  1016. var t2 = Ea[e3.toLowerCase()];
  1017. at(t2) || (this.networkType = t2);
  1018. }
  1019. return this;
  1020. } }, { key: "getStartTs", value: function() {
  1021. return this._startts;
  1022. } }, { key: "setUIPlatform", value: function(e3) {
  1023. this.uiPlatform = e3;
  1024. } }], [{ key: "bindEventStatModule", value: function(t2) {
  1025. e2.prototype._eventStatModule = t2;
  1026. } }]), e2;
  1027. }(), La = function() {
  1028. function e2(t2) {
  1029. o(this, e2), this.type = S.MSG_TEXT, this.content = { text: t2.text || "" };
  1030. }
  1031. return a(e2, [{ key: "setText", value: function(e3) {
  1032. this.content.text = e3;
  1033. } }, { key: "sendable", value: function() {
  1034. return 0 !== this.content.text.length;
  1035. } }]), e2;
  1036. }(), Aa = function() {
  1037. function e2(t2, n2) {
  1038. o(this, e2), this._imageMemoryURL = "", this._fileDownloadProxy = n2, se ? this.createImageDataASURLInWXMiniApp(t2.file) : this.createImageDataASURLInWeb(t2.file), this._initImageInfoModel(), this.type = S.MSG_IMAGE, this._percent = 0, this.content = { imageFormat: t2.imageFormat || Ve.UNKNOWN, uuid: t2.uuid, imageInfoArray: [] }, this.initImageInfoArray(t2.imageInfoArray), this._autoFixUrl();
  1039. }
  1040. return a(e2, [{ key: "_initImageInfoModel", value: function() {
  1041. var e3 = this;
  1042. this._ImageInfoModel = function(t2) {
  1043. this.instanceID = _t(9999999), this.sizeType = t2.type || 0, this.type = 0, this.size = t2.size || 0, this.width = t2.width || 0, this.height = t2.height || 0, this.imageUrl = t2.url || "", this.url = Wt(t2.url || e3._imageMemoryURL, e3._fileDownloadProxy);
  1044. }, this._ImageInfoModel.prototype = { setSizeType: function(e4) {
  1045. this.sizeType = e4;
  1046. }, setType: function(e4) {
  1047. this.type = e4;
  1048. }, setImageUrl: function(e4) {
  1049. e4 && (this.imageUrl = e4);
  1050. }, getImageUrl: function() {
  1051. return this.imageUrl;
  1052. } };
  1053. } }, { key: "initImageInfoArray", value: function(e3) {
  1054. for (var t2 = 0, n2 = null, o2 = null; t2 <= 2; )
  1055. o2 = at(e3) || at(e3[t2]) ? { type: 0, size: 0, width: 0, height: 0, url: "" } : e3[t2], (n2 = new this._ImageInfoModel(o2)).setSizeType(t2 + 1), n2.setType(t2), this.addImageInfo(n2), t2++;
  1056. this.updateAccessSideImageInfoArray();
  1057. } }, { key: "updateImageInfoArray", value: function(e3) {
  1058. for (var t2, n2 = this.content.imageInfoArray.length, o2 = 0; o2 < n2; o2++)
  1059. t2 = this.content.imageInfoArray[o2], e3[o2].size && (t2.size = e3[o2].size), e3[o2].url && t2.setImageUrl(e3[o2].url), e3[o2].width && (t2.width = e3[o2].width), e3[o2].height && (t2.height = e3[o2].height);
  1060. } }, { key: "_autoFixUrl", value: function() {
  1061. for (var e3 = this.content.imageInfoArray.length, t2 = "", n2 = "", o2 = ["http", "https"], s2 = null, a2 = 0; a2 < e3; a2++)
  1062. this.content.imageInfoArray[a2].url && "" !== (s2 = this.content.imageInfoArray[a2]).imageUrl && (n2 = s2.imageUrl.slice(0, s2.imageUrl.indexOf("://") + 1), t2 = s2.imageUrl.slice(s2.imageUrl.indexOf("://") + 1), o2.indexOf(n2) < 0 && (n2 = "https:"), this.content.imageInfoArray[a2].setImageUrl([n2, t2].join("")));
  1063. } }, { key: "updatePercent", value: function(e3) {
  1064. this._percent = e3, this._percent > 1 && (this._percent = 1);
  1065. } }, { key: "updateImageFormat", value: function(e3) {
  1066. this.content.imageFormat = Ve[e3.toUpperCase()] || Ve.UNKNOWN;
  1067. } }, { key: "createImageDataASURLInWeb", value: function(e3) {
  1068. void 0 !== e3 && e3.files.length > 0 && (this._imageMemoryURL = window.URL.createObjectURL(e3.files[0]));
  1069. } }, { key: "createImageDataASURLInWXMiniApp", value: function(e3) {
  1070. e3 && e3.url && (this._imageMemoryURL = e3.url);
  1071. } }, { key: "replaceImageInfo", value: function(e3, t2) {
  1072. this.content.imageInfoArray[t2] instanceof this._ImageInfoModel || (this.content.imageInfoArray[t2] = e3);
  1073. } }, { key: "addImageInfo", value: function(e3) {
  1074. this.content.imageInfoArray.length >= 3 || this.content.imageInfoArray.push(e3);
  1075. } }, { key: "updateAccessSideImageInfoArray", value: function() {
  1076. var e3 = this.content.imageInfoArray, t2 = e3[0], n2 = t2.width, o2 = void 0 === n2 ? 0 : n2, s2 = t2.height, a2 = void 0 === s2 ? 0 : s2;
  1077. 0 !== o2 && 0 !== a2 && (Ut(e3), Object.assign(e3[2], Gt({ originWidth: o2, originHeight: a2, min: 720 })));
  1078. } }, { key: "sendable", value: function() {
  1079. return 0 !== this.content.imageInfoArray.length && ("" !== this.content.imageInfoArray[0].imageUrl && 0 !== this.content.imageInfoArray[0].size);
  1080. } }]), e2;
  1081. }(), Ra = function() {
  1082. function e2(t2) {
  1083. o(this, e2), this.type = S.MSG_FACE, this.content = t2 || null;
  1084. }
  1085. return a(e2, [{ key: "sendable", value: function() {
  1086. return null !== this.content;
  1087. } }]), e2;
  1088. }(), Na = function() {
  1089. function e2(t2, n2) {
  1090. o(this, e2), this.type = S.MSG_AUDIO, this._percent = 0, this.content = { downloadFlag: 2, second: t2.second, size: t2.size, url: Wt(t2.url, n2), remoteAudioUrl: t2.url || "", uuid: t2.uuid };
  1091. }
  1092. return a(e2, [{ key: "updatePercent", value: function(e3) {
  1093. this._percent = e3, this._percent > 1 && (this._percent = 1);
  1094. } }, { key: "updateAudioUrl", value: function(e3) {
  1095. this.content.remoteAudioUrl = e3;
  1096. } }, { key: "sendable", value: function() {
  1097. return "" !== this.content.remoteAudioUrl;
  1098. } }]), e2;
  1099. }(), Oa = { from: true, groupID: true, groupName: true, to: true }, Ga = function() {
  1100. function e2(t2) {
  1101. o(this, e2), this.type = S.MSG_GRP_TIP, this.content = {}, this._initContent(t2);
  1102. }
  1103. return a(e2, [{ key: "_initContent", value: function(e3) {
  1104. var t2 = this;
  1105. Object.keys(e3).forEach(function(n2) {
  1106. switch (n2) {
  1107. case "remarkInfo":
  1108. break;
  1109. case "groupProfile":
  1110. t2.content.groupProfile = {}, t2._initGroupProfile(e3[n2]);
  1111. break;
  1112. case "operatorInfo":
  1113. break;
  1114. case "memberInfoList":
  1115. case "msgMemberInfo":
  1116. t2._updateMemberList(e3[n2]);
  1117. break;
  1118. case "memberExtraInfo":
  1119. case "onlineMemberInfo":
  1120. break;
  1121. case "memberNum":
  1122. t2.content[n2] = e3[n2], t2.content.memberCount = e3[n2];
  1123. break;
  1124. case "newGroupProfile":
  1125. t2.content.newGroupProfile = {}, t2._initNewGroupProfile(e3[n2]);
  1126. break;
  1127. default:
  1128. t2.content[n2] = e3[n2];
  1129. }
  1130. }), this.content.userIDList || (this.content.userIDList = [this.content.operatorID]);
  1131. } }, { key: "_initGroupProfile", value: function(e3) {
  1132. for (var t2 = Object.keys(e3), n2 = 0; n2 < t2.length; n2++) {
  1133. var o2 = t2[n2];
  1134. Oa[o2] && (this.content.groupProfile[o2] = e3[o2]);
  1135. }
  1136. } }, { key: "_updateMemberList", value: function(e3) {
  1137. jt(this.content.memberList) ? this.content.memberList = e3 : this.content.memberList.forEach(function(t2) {
  1138. e3.forEach(function(e4) {
  1139. t2.userID === e4.userID && Object.assign(t2, e4);
  1140. });
  1141. });
  1142. } }, { key: "_initNewGroupProfile", value: function(e3) {
  1143. for (var t2 = Object.keys(e3), n2 = 0; n2 < t2.length; n2++) {
  1144. var o2 = t2[n2];
  1145. "muteAllMembers" !== o2 ? this.content.newGroupProfile[o2] = e3[o2] : this.content.newGroupProfile[o2] = 1 === e3[o2];
  1146. }
  1147. } }]), e2;
  1148. }(), Ua = { from: true, groupID: true, groupName: true, to: true }, Pa = function() {
  1149. function e2(t2) {
  1150. o(this, e2), this.type = S.MSG_GRP_SYS_NOTICE, this.content = {}, this._initContent(t2);
  1151. }
  1152. return a(e2, [{ key: "_initContent", value: function(e3) {
  1153. var t2 = this;
  1154. Object.keys(e3).forEach(function(n2) {
  1155. switch (n2) {
  1156. case "memberInfoList":
  1157. break;
  1158. case "remarkInfo":
  1159. t2.content.handleMessage = e3[n2];
  1160. break;
  1161. case "groupProfile":
  1162. t2.content.groupProfile = {}, t2._initGroupProfile(e3[n2]);
  1163. break;
  1164. default:
  1165. t2.content[n2] = e3[n2];
  1166. }
  1167. });
  1168. } }, { key: "_initGroupProfile", value: function(e3) {
  1169. for (var t2 = Object.keys(e3), n2 = 0; n2 < t2.length; n2++) {
  1170. var o2 = t2[n2];
  1171. Ua[o2] && ("groupName" === o2 ? this.content.groupProfile.name = e3[o2] : this.content.groupProfile[o2] = e3[o2]);
  1172. }
  1173. } }]), e2;
  1174. }(), ba = function() {
  1175. function e2(t2, n2) {
  1176. o(this, e2), this.type = S.MSG_FILE, this._percent = 0;
  1177. var s2 = this._getFileInfo(t2);
  1178. this.content = { downloadFlag: 2, fileUrl: Wt(t2.url, n2) || "", uuid: t2.uuid, fileName: s2.name || "", fileSize: s2.size || 0 };
  1179. }
  1180. return a(e2, [{ key: "_getFileInfo", value: function(e3) {
  1181. if (!at(e3.fileName) && !at(e3.fileSize))
  1182. return { size: e3.fileSize, name: e3.fileName };
  1183. var t2 = e3.file.files[0];
  1184. if (ne) {
  1185. if (t2.path && -1 !== t2.path.indexOf(".")) {
  1186. var n2 = t2.path.slice(t2.path.lastIndexOf(".") + 1).toLowerCase();
  1187. t2.type = n2, t2.name || (t2.name = "".concat(_t(999999), ".").concat(n2));
  1188. }
  1189. t2.name || (t2.type = "", t2.name = t2.path.slice(t2.path.lastIndexOf("/") + 1).toLowerCase()), t2.suffix && (t2.type = t2.suffix), t2.url || (t2.url = t2.path);
  1190. }
  1191. return { size: t2.size, name: t2.name };
  1192. } }, { key: "updatePercent", value: function(e3) {
  1193. this._percent = e3, this._percent > 1 && (this._percent = 1);
  1194. } }, { key: "updateFileUrl", value: function(e3) {
  1195. this.content.fileUrl = e3;
  1196. } }, { key: "sendable", value: function() {
  1197. return "" !== this.content.fileUrl && ("" !== this.content.fileName && 0 !== this.content.fileSize);
  1198. } }]), e2;
  1199. }(), wa = function() {
  1200. function e2(t2) {
  1201. o(this, e2), this.type = S.MSG_CUSTOM, this.content = { data: t2.data || "", description: t2.description || "", extension: t2.extension || "" };
  1202. }
  1203. return a(e2, [{ key: "setData", value: function(e3) {
  1204. return this.content.data = e3, this;
  1205. } }, { key: "setDescription", value: function(e3) {
  1206. return this.content.description = e3, this;
  1207. } }, { key: "setExtension", value: function(e3) {
  1208. return this.content.extension = e3, this;
  1209. } }, { key: "sendable", value: function() {
  1210. return 0 !== this.content.data.length || 0 !== this.content.description.length || 0 !== this.content.extension.length;
  1211. } }]), e2;
  1212. }(), Fa = function() {
  1213. function e2(t2, n2) {
  1214. o(this, e2), this.type = S.MSG_VIDEO, this._percent = 0, this.content = { remoteVideoUrl: t2.remoteVideoUrl || t2.videoUrl || "", videoFormat: t2.videoFormat, videoSecond: parseInt(t2.videoSecond, 10), videoSize: t2.videoSize, videoUrl: Wt(t2.videoUrl, n2), videoDownloadFlag: 2, videoUUID: t2.videoUUID, thumbUUID: t2.thumbUUID, thumbFormat: t2.thumbFormat, thumbWidth: t2.thumbWidth, snapshotWidth: t2.thumbWidth, thumbHeight: t2.thumbHeight, snapshotHeight: t2.thumbHeight, thumbSize: t2.thumbSize, snapshotSize: t2.thumbSize, thumbDownloadFlag: 2, thumbUrl: Wt(t2.thumbUrl, n2), snapshotUrl: Wt(t2.thumbUrl, n2) };
  1215. }
  1216. return a(e2, [{ key: "updatePercent", value: function(e3) {
  1217. this._percent = e3, this._percent > 1 && (this._percent = 1);
  1218. } }, { key: "updateVideoUrl", value: function(e3) {
  1219. e3 && (this.content.remoteVideoUrl = e3);
  1220. } }, { key: "updateSnapshotInfo", value: function(e3) {
  1221. var t2 = e3.snapshotUrl, n2 = e3.snapshotWidth, o2 = e3.snapshotHeight;
  1222. jt(t2) || (this.content.thumbUrl = this.content.snapshotUrl = t2), jt(n2) || (this.content.thumbWidth = this.content.snapshotWidth = Number(n2)), jt(o2) || (this.content.thumbHeight = this.content.snapshotHeight = Number(o2));
  1223. } }, { key: "sendable", value: function() {
  1224. return "" !== this.content.remoteVideoUrl;
  1225. } }]), e2;
  1226. }(), qa = function() {
  1227. function e2(t2) {
  1228. o(this, e2), this.type = S.MSG_LOCATION;
  1229. var n2 = t2.description, s2 = t2.longitude, a2 = t2.latitude;
  1230. this.content = { description: n2, longitude: s2, latitude: a2 };
  1231. }
  1232. return a(e2, [{ key: "sendable", value: function() {
  1233. return true;
  1234. } }]), e2;
  1235. }(), xa = function() {
  1236. function e2(t2, n2) {
  1237. if (o(this, e2), this.from = t2.from, this.messageSender = t2.from, this.time = t2.time, this.messageSequence = t2.sequence, this.clientSequence = t2.clientSequence || t2.sequence, this.messageRandom = t2.random, this.cloudCustomData = t2.cloudCustomData || "", this.clientTime = t2.clientTime || void 0, t2.ID)
  1238. this.ID = t2.ID || "", this.nick = t2.nick || "", this.avatar = t2.avatar || "", this.messageBody = [{ type: t2.type, payload: t2.payload }], t2.conversationType.startsWith(S.CONV_C2C) ? this.receiverUserID = t2.to : t2.conversationType.startsWith(S.CONV_GROUP) && (this.receiverGroupID = t2.to), this.messageReceiver = t2.to;
  1239. else {
  1240. this.nick = t2.nick || "", this.avatar = t2.avatar || "", this.messageBody = [];
  1241. var s2 = t2.elements[0].type, a2 = t2.elements[0].content;
  1242. this._patchRichMediaPayload(s2, a2), this._updateRichMediaDownloadUrl(s2, a2, n2), s2 === S.MSG_MERGER ? this.messageBody.push({ type: s2, payload: new Va(a2).content }) : this.messageBody.push({ type: s2, payload: a2 }), t2.groupID && (this.receiverGroupID = t2.groupID, this.messageReceiver = t2.groupID), t2.to && (this.receiverUserID = t2.to, this.messageReceiver = t2.to), this.ID = "".concat(t2.tinyID, "-").concat(t2.clientTime, "-").concat(t2.random);
  1243. }
  1244. }
  1245. return a(e2, [{ key: "_patchRichMediaPayload", value: function(e3, t2) {
  1246. e3 === S.MSG_IMAGE ? t2.imageInfoArray.forEach(function(e4) {
  1247. !e4.imageUrl && e4.url && (e4.imageUrl = e4.url, e4.sizeType = e4.type, 1 === e4.type ? e4.type = 0 : 3 === e4.type && (e4.type = 1));
  1248. }) : e3 === S.MSG_VIDEO ? !t2.remoteVideoUrl && t2.videoUrl && (t2.remoteVideoUrl = t2.videoUrl) : e3 === S.MSG_AUDIO ? !t2.remoteAudioUrl && t2.url && (t2.remoteAudioUrl = t2.url) : e3 === S.MSG_FILE && !t2.fileUrl && t2.url && (t2.fileUrl = t2.url, t2.url = void 0);
  1249. } }, { key: "_updateRichMediaDownloadUrl", value: function(e3, t2, n2) {
  1250. n2 && (e3 === S.MSG_IMAGE ? t2.imageInfoArray.forEach(function(e4) {
  1251. e4.url = Wt(e4.url, n2);
  1252. }) : e3 === S.MSG_VIDEO ? (t2.videoUrl = Wt(t2.videoUrl, n2), t2.snapshotUrl = Wt(t2.thumbUrl, n2), t2.snapshotHeight = t2.thumbHeight, t2.snapshotWidth = t2.thumbWidth) : e3 === S.MSG_AUDIO ? t2.url = Wt(t2.url, n2) : e3 === S.MSG_FILE && (t2.fileUrl = Wt(t2.fileUrl, n2)));
  1253. } }]), e2;
  1254. }(), Va = function() {
  1255. function e2(t2, n2) {
  1256. if (o(this, e2), this.type = S.MSG_MERGER, this.content = { downloadKey: "", pbDownloadKey: "", messageList: [], title: "", abstractList: [], compatibleText: "", version: 0, layersOverLimit: false }, t2.downloadKey) {
  1257. var s2 = t2.downloadKey, a2 = t2.pbDownloadKey, r2 = t2.title, i2 = t2.abstractList, u2 = t2.compatibleText, c2 = t2.version;
  1258. this.content.downloadKey = s2, this.content.pbDownloadKey = a2, this.content.title = r2, this.content.abstractList = i2, this.content.compatibleText = u2, this.content.version = c2 || 0;
  1259. } else if (jt(t2.messageList))
  1260. 1 === t2.layersOverLimit && (this.content.layersOverLimit = true);
  1261. else {
  1262. var l2 = t2.messageList, p2 = t2.title, d2 = t2.abstractList, g2 = t2.compatibleText, _2 = t2.version, h2 = [];
  1263. l2.forEach(function(e3) {
  1264. if (!jt(e3)) {
  1265. var t3 = new xa(e3, n2);
  1266. h2.push(t3);
  1267. }
  1268. }), this.content.messageList = h2, this.content.title = p2, this.content.abstractList = d2, this.content.compatibleText = g2, this.content.version = _2 || 0;
  1269. }
  1270. }
  1271. return a(e2, [{ key: "sendable", value: function() {
  1272. return !jt(this.content.messageList) || !jt(this.content.downloadKey);
  1273. } }]), e2;
  1274. }(), Ba = { 1: S.MSG_PRIORITY_HIGH, 2: S.MSG_PRIORITY_NORMAL, 3: S.MSG_PRIORITY_LOW, 4: S.MSG_PRIORITY_LOWEST }, Ha = function() {
  1275. function e2(t2) {
  1276. o(this, e2), this.ID = "", this.conversationID = t2.conversationID || null, this.conversationType = t2.conversationType || S.CONV_C2C, this.conversationSubType = t2.conversationSubType, this.time = t2.time || Math.ceil(Date.now() / 1e3), this.sequence = t2.sequence || 0, this.clientSequence = t2.clientSequence || t2.sequence || 0, this.random = t2.random || 0 === t2.random ? t2.random : _t(), this.priority = this._computePriority(t2.priority), this.nick = t2.nick || "", this.avatar = t2.avatar || "", this.isPeerRead = false, this.nameCard = "", this._elements = [], this.isPlaceMessage = t2.isPlaceMessage || 0, this.isRevoked = 2 === t2.isPlaceMessage || 8 === t2.msgFlagBits, this.from = t2.from || null, this.to = t2.to || null, this.flow = "", this.isSystemMessage = t2.isSystemMessage || false, this.protocol = t2.protocol || "JSON", this.isResend = false, this.isRead = false, this.status = t2.status || Qt.SUCCESS, this._onlineOnlyFlag = false, this._groupAtInfoList = [], this._relayFlag = false, this.atUserList = [], this.cloudCustomData = t2.cloudCustomData || "", this.isDeleted = false, this.isModified = false, this._isExcludedFromUnreadCount = !(!t2.messageControlInfo || 1 !== t2.messageControlInfo.excludedFromUnreadCount), this._isExcludedFromLastMessage = !(!t2.messageControlInfo || 1 !== t2.messageControlInfo.excludedFromLastMessage), this.clientTime = t2.clientTime || be() || 0, this.senderTinyID = t2.senderTinyID || t2.tinyID || "", this.readReceiptInfo = t2.readReceiptInfo || { readCount: void 0, unreadCount: void 0, isPeerRead: void 0 }, this.needReadReceipt = true === t2.needReadReceipt || 1 === t2.needReadReceipt, this.version = t2.messageVersion || 0, this.isBroadcastMessage = t2.isBroadcastMessage || false, this._receiverList = t2.receiverList || void 0, this.isSupportExtension = true === t2.isSupportExtension || 1 === t2.isSupportExtension, this.revoker = t2.revokerInfo && t2.revokerInfo.revoker || null, this.reInitialize(t2.currentUser), this.extractGroupInfo(t2.groupProfile || null), this.handleGroupAtInfo(t2), this.initC2CReadReceiptInfo(t2.readReceiptSentByPeer);
  1277. }
  1278. return a(e2, [{ key: "elements", get: function() {
  1279. return this._elements;
  1280. } }, { key: "getElements", value: function() {
  1281. return this._elements;
  1282. } }, { key: "extractGroupInfo", value: function(e3) {
  1283. if (null !== e3) {
  1284. et(e3.nick) && (this.nick = e3.nick), et(e3.avatar) && (this.avatar = e3.avatar);
  1285. var t2 = e3.messageFromAccountExtraInformation;
  1286. ot(t2) && et(t2.nameCard) && (this.nameCard = t2.nameCard);
  1287. }
  1288. } }, { key: "handleGroupAtInfo", value: function(e3) {
  1289. var t2 = this;
  1290. e3.payload && e3.payload.atUserList && e3.payload.atUserList.forEach(function(e4) {
  1291. e4 !== S.MSG_AT_ALL ? (t2._groupAtInfoList.push({ groupAtAllFlag: 0, groupAtUserID: e4 }), t2.atUserList.push(e4)) : (t2._groupAtInfoList.push({ groupAtAllFlag: 1 }), t2.atUserList.push(S.MSG_AT_ALL));
  1292. }), st(e3.groupAtInfo) && e3.groupAtInfo.forEach(function(e4) {
  1293. 0 === e4.groupAtAllFlag ? t2.atUserList.push(e4.groupAtUserID) : 1 === e4.groupAtAllFlag && t2.atUserList.push(S.MSG_AT_ALL);
  1294. });
  1295. } }, { key: "getGroupAtInfoList", value: function() {
  1296. return this._groupAtInfoList;
  1297. } }, { key: "_initProxy", value: function() {
  1298. this._elements[0] && (this.payload = this._elements[0].content, this.type = this._elements[0].type);
  1299. } }, { key: "reInitialize", value: function(e3) {
  1300. e3 && (this.status = this.from ? Qt.SUCCESS : Qt.UNSEND, !this.from && (this.from = e3)), this._initFlow(e3), this._initSequence(e3), this._concatConversationID(e3), this.generateMessageID();
  1301. } }, { key: "isSendable", value: function() {
  1302. return 0 !== this._elements.length && ("function" == typeof this._elements[0].sendable && this._elements[0].sendable());
  1303. } }, { key: "_initTo", value: function(e3) {
  1304. this.conversationType === S.CONV_GROUP && (this.to = e3.groupID);
  1305. } }, { key: "_initSequence", value: function(e3) {
  1306. 0 === this.clientSequence && e3 && (this.clientSequence = function(e4) {
  1307. if (!e4)
  1308. return false;
  1309. if (void 0 === mt[e4]) {
  1310. var t2 = /* @__PURE__ */ new Date(), n2 = "3".concat(t2.getHours()).slice(-2), o2 = "0".concat(t2.getMinutes()).slice(-2), s2 = "0".concat(t2.getSeconds()).slice(-2);
  1311. mt[e4] = parseInt([n2, o2, s2, "0001"].join("")), n2 = null, o2 = null, s2 = null, xe.l("autoIncrementIndex start index:".concat(mt[e4]));
  1312. }
  1313. return mt[e4]++;
  1314. }(e3)), 0 === this.sequence && this.conversationType === S.CONV_C2C && (this.sequence = this.clientSequence);
  1315. } }, { key: "generateMessageID", value: function() {
  1316. this.from === S.CONV_SYSTEM && (this.senderTinyID = "144115198244471703"), this.ID = "".concat(this.senderTinyID, "-").concat(this.clientTime, "-").concat(this.random);
  1317. } }, { key: "_initFlow", value: function(e3) {
  1318. "" !== e3 && (e3 === this.from ? (this.flow = "out", this.isRead = true) : this.flow = "in");
  1319. } }, { key: "_concatConversationID", value: function(e3) {
  1320. var t2 = this.to, n2 = "", o2 = this.conversationType;
  1321. o2 !== S.CONV_SYSTEM ? (n2 = o2 === S.CONV_C2C ? e3 === this.from ? t2 : this.from : this.to, this.conversationID = n2 ? "".concat(o2).concat(n2) : null) : this.conversationID = S.CONV_SYSTEM;
  1322. } }, { key: "isElement", value: function(e3) {
  1323. return e3 instanceof La || e3 instanceof Aa || e3 instanceof Ra || e3 instanceof Na || e3 instanceof ba || e3 instanceof Fa || e3 instanceof Ga || e3 instanceof Pa || e3 instanceof wa || e3 instanceof qa || e3 instanceof Va;
  1324. } }, { key: "setElement", value: function(e3, t2) {
  1325. var n2 = this;
  1326. if (this.isElement(e3))
  1327. return this._elements = [e3], void this._initProxy();
  1328. var o2 = function(e4) {
  1329. if (e4.type && e4.content)
  1330. switch (e4.type) {
  1331. case S.MSG_TEXT:
  1332. n2.setTextElement(e4.content);
  1333. break;
  1334. case S.MSG_IMAGE:
  1335. n2.setImageElement(e4.content, t2);
  1336. break;
  1337. case S.MSG_AUDIO:
  1338. n2.setAudioElement(e4.content, t2);
  1339. break;
  1340. case S.MSG_FILE:
  1341. n2.setFileElement(e4.content, t2);
  1342. break;
  1343. case S.MSG_VIDEO:
  1344. n2.setVideoElement(e4.content, t2);
  1345. break;
  1346. case S.MSG_CUSTOM:
  1347. n2.setCustomElement(e4.content);
  1348. break;
  1349. case S.MSG_LOCATION:
  1350. n2.setLocationElement(e4.content);
  1351. break;
  1352. case S.MSG_GRP_TIP:
  1353. n2.setGroupTipElement(e4.content);
  1354. break;
  1355. case S.MSG_GRP_SYS_NOTICE:
  1356. n2.setGroupSystemNoticeElement(e4.content);
  1357. break;
  1358. case S.MSG_FACE:
  1359. n2.setFaceElement(e4.content);
  1360. break;
  1361. case S.MSG_MERGER:
  1362. n2.setMergerElement(e4.content, t2);
  1363. }
  1364. };
  1365. if (st(e3))
  1366. for (var s2 = 0; s2 < e3.length; s2++)
  1367. o2(e3[s2]);
  1368. else
  1369. o2(e3);
  1370. this._initProxy();
  1371. } }, { key: "clearElement", value: function() {
  1372. this._elements.length = 0;
  1373. } }, { key: "setTextElement", value: function(e3) {
  1374. var t2 = "string" == typeof e3 ? e3 : e3.text, n2 = new La({ text: t2 });
  1375. this._elements.push(n2);
  1376. } }, { key: "setImageElement", value: function(e3, t2) {
  1377. var n2 = new Aa(e3, t2);
  1378. this._elements.push(n2);
  1379. } }, { key: "setAudioElement", value: function(e3, t2) {
  1380. var n2 = new Na(e3, t2);
  1381. this._elements.push(n2);
  1382. } }, { key: "setFileElement", value: function(e3, t2) {
  1383. var n2 = new ba(e3, t2);
  1384. this._elements.push(n2);
  1385. } }, { key: "setVideoElement", value: function(e3, t2) {
  1386. var n2 = new Fa(e3, t2);
  1387. this._elements.push(n2);
  1388. } }, { key: "setLocationElement", value: function(e3) {
  1389. var t2 = new qa(e3);
  1390. this._elements.push(t2);
  1391. } }, { key: "setCustomElement", value: function(e3) {
  1392. var t2 = new wa(e3);
  1393. this._elements.push(t2);
  1394. } }, { key: "setGroupTipElement", value: function(e3) {
  1395. var t2 = {}, n2 = e3.operationType;
  1396. if (jt(e3.memberInfoList) ? e3.operatorInfo && (t2 = e3.operatorInfo) : n2 !== S.GRP_TIP_MBR_JOIN && n2 !== S.GRP_TIP_MBR_KICKED_OUT && n2 !== S.GRP_TIP_MBR_SET_ADMIN && n2 !== S.GRP_TIP_MBR_CANCELED_ADMIN || (t2 = e3.memberInfoList[0]), !jt(e3.memberExtraInfo)) {
  1397. var o2 = e3.memberExtraInfo.reason;
  1398. e3.msgMemberInfo.forEach(function(e4) {
  1399. e4.reason = o2;
  1400. });
  1401. }
  1402. var s2 = t2, a2 = s2.nick, r2 = s2.avatar;
  1403. et(a2) && (this.nick = a2), et(r2) && (this.avatar = r2);
  1404. var i2 = new Ga(e3);
  1405. this._elements.push(i2);
  1406. } }, { key: "setGroupSystemNoticeElement", value: function(e3) {
  1407. var t2 = new Pa(e3);
  1408. this._elements.push(t2);
  1409. } }, { key: "setFaceElement", value: function(e3) {
  1410. var t2 = new Ra(e3);
  1411. this._elements.push(t2);
  1412. } }, { key: "setMergerElement", value: function(e3, t2) {
  1413. var n2 = new Va(e3, t2);
  1414. this._elements.push(n2);
  1415. } }, { key: "setIsRead", value: function(e3) {
  1416. this.isRead = e3;
  1417. } }, { key: "setRelayFlag", value: function(e3) {
  1418. this._relayFlag = e3;
  1419. } }, { key: "getRelayFlag", value: function() {
  1420. return this._relayFlag;
  1421. } }, { key: "_computePriority", value: function(e3) {
  1422. if (at(e3))
  1423. return S.MSG_PRIORITY_NORMAL;
  1424. if (et(e3) && -1 !== Object.values(Ba).indexOf(e3))
  1425. return e3;
  1426. if ($e(e3)) {
  1427. var t2 = "" + e3;
  1428. if (-1 !== Object.keys(Ba).indexOf(t2))
  1429. return Ba[t2];
  1430. }
  1431. return S.MSG_PRIORITY_NORMAL;
  1432. } }, { key: "setNickAndAvatar", value: function(e3) {
  1433. var t2 = e3.nick, n2 = e3.avatar;
  1434. et(t2) && (this.nick = t2), et(n2) && (this.avatar = n2);
  1435. } }, { key: "setNameCard", value: function(e3) {
  1436. et(e3) && (this.nameCard = e3);
  1437. } }, { key: "initC2CReadReceiptInfo", value: function(e3) {
  1438. this.conversationType === S.CONV_C2C && true === this.needReadReceipt && (this.readReceiptInfo.isPeerRead = 1 === e3);
  1439. } }]), e2;
  1440. }(), Ka = function(e2) {
  1441. return { code: 0, data: e2 || {} };
  1442. }, Wa = function(e2) {
  1443. i(n2, e2);
  1444. var t2 = f(n2);
  1445. function n2(e3) {
  1446. var s2;
  1447. o(this, n2), s2 = t2.call(this);
  1448. var a2 = e3.code, r2 = e3.message, i2 = e3.data;
  1449. return s2.code = a2, s2.message = r2 || s2._getErrorMessage(s2.code), s2.data = i2 || {}, s2;
  1450. }
  1451. return a(n2);
  1452. }(d(Error)), Ya = null, ja = function(e2) {
  1453. Ya = e2;
  1454. }, za = function(e2) {
  1455. return Promise.resolve(Ka(e2));
  1456. }, Ja = function(e2) {
  1457. var t2 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
  1458. if (e2 instanceof Wa)
  1459. return t2 && null !== Ya && Ya.emit(E.ERROR, e2), Promise.reject(e2);
  1460. if (e2 instanceof Error) {
  1461. var n2 = new Wa({ code: da.UNCAUGHT_ERROR });
  1462. return t2 && null !== Ya && Ya.emit(E.ERROR, n2), Promise.reject(n2);
  1463. }
  1464. if (!at(e2) && !at(e2.code)) {
  1465. var o2 = new Wa(e2);
  1466. return t2 && null !== Ya && Ya.emit(E.ERROR, o2), Promise.reject(o2);
  1467. }
  1468. }, Xa = function(e2) {
  1469. i(s2, e2);
  1470. var n2 = f(s2);
  1471. function s2(e3) {
  1472. var t2;
  1473. return o(this, s2), (t2 = n2.call(this, e3))._n = "C2CModule", t2._messageFromUnreadDBMap = /* @__PURE__ */ new Map(), t2._signalingFromUnreadDBList = [], t2;
  1474. }
  1475. return a(s2, [{ key: "onNewC2CMessage", value: function(e3) {
  1476. var t2 = e3.dataList, n3 = e3.isInstantMessage, o2 = e3.C2CRemainingUnreadList, s3 = e3.C2CPairUnreadList;
  1477. xe.d("".concat(this._n, ".onNewC2CMessage count:").concat(t2.length, " isInstantMessage:").concat(n3));
  1478. var a2 = this._newC2CMessageStoredAndSummary({ dataList: t2, C2CRemainingUnreadList: o2, C2CPairUnreadList: s3, isInstantMessage: n3 }), r2 = a2.conversationOptionsList, i2 = a2.messageList, u2 = a2.isUnreadC2CMessage;
  1479. (this.filterModifiedMessage(i2), r2.length > 0) && this.getModule(Fn).onNewMessage({ conversationOptionsList: r2, isInstantMessage: n3, isUnreadC2CMessage: u2 });
  1480. var c2 = this.filterUnmodifiedMessage(i2);
  1481. n3 && c2.length > 0 && this.emitOuterEvent(E.MESSAGE_RECEIVED, c2), i2.length = 0;
  1482. } }, { key: "_newC2CMessageStoredAndSummary", value: function(e3) {
  1483. for (var t2 = e3.dataList, n3 = e3.C2CRemainingUnreadList, o2 = e3.C2CPairUnreadList, s3 = e3.isInstantMessage, a2 = null, r2 = [], i2 = [], u2 = {}, c2 = this.getModule(Hn), l2 = this.getModule($n), p2 = false, d2 = this.getModule(Fn), g2 = this.getFileDownloadProxy(), _2 = 0, h2 = t2.length; _2 < h2; _2++)
  1484. if (this._isSignaling(t2[_2]))
  1485. this._signalingFromUnreadDBList.push(t2[_2].eventArray[0].c2CNotifyMsgArray[0]);
  1486. else {
  1487. var f2 = t2[_2];
  1488. f2.currentUser = this.getMyUserID(), f2.conversationType = S.CONV_C2C, f2.isSystemMessage = !!f2.isSystemMessage, (at(f2.nick) || at(f2.avatar)) && (p2 = true, xe.d("".concat(this._n, "._newC2CMessageStoredAndSummary nick or avatar missing!"))), a2 = new Ha(f2), f2.elements = c2.parseElements(f2.elements, f2.from), a2.setElement(f2.elements, g2), a2.setNickAndAvatar({ nick: f2.nick, avatar: f2.avatar });
  1489. var v2 = a2.conversationID;
  1490. if (s3) {
  1491. if (1 === this._messageFromUnreadDBMap.get(a2.ID))
  1492. continue;
  1493. var m2 = false;
  1494. if (a2.from !== this.getMyUserID()) {
  1495. var M2 = d2.getLatestMessageSentByPeer(v2);
  1496. if (M2) {
  1497. var y2 = M2.nick, I2 = M2.avatar;
  1498. p2 ? a2.setNickAndAvatar({ nick: y2, avatar: I2 }) : y2 === a2.nick && I2 === a2.avatar || (m2 = true);
  1499. }
  1500. } else {
  1501. var C2 = d2.getLatestMessageSentByMe(v2);
  1502. if (C2) {
  1503. var T2 = C2.nick, D2 = C2.avatar;
  1504. T2 === a2.nick && D2 === a2.avatar || d2.modifyMessageSentByMe({ conversationID: v2, latestNick: a2.nick, latestAvatar: a2.avatar });
  1505. }
  1506. }
  1507. var E2 = 1 === t2[_2].isModified;
  1508. if (d2.isMessageSentByCurrentInstance(a2) ? a2.isModified = E2 : E2 = false, 0 === f2.msgLifeTime)
  1509. a2._onlineOnlyFlag = true, d2.isMessageSentByCurrentInstance(a2) || i2.push(a2);
  1510. else {
  1511. if (!d2.pushIntoMessageList(i2, a2, E2))
  1512. continue;
  1513. m2 && (d2.modifyMessageSentByPeer({ conversationID: v2, latestNick: a2.nick, latestAvatar: a2.avatar }), d2.updateUserProfileSpecifiedKey({ conversationID: v2, nick: a2.nick, avatar: a2.avatar }));
  1514. }
  1515. s3 && a2.clientTime > 0 && l2.addMessageDelay(a2.clientTime);
  1516. } else
  1517. this._messageFromUnreadDBMap.set(a2.ID, 1);
  1518. if (0 !== f2.msgLifeTime) {
  1519. if (false === a2._onlineOnlyFlag) {
  1520. var k2 = d2.getLastMessageTime(v2);
  1521. if ($e(k2) && a2.time < k2)
  1522. continue;
  1523. if (at(u2[v2])) {
  1524. var L2 = 0;
  1525. "in" === a2.flow && (a2._isExcludedFromUnreadCount || (L2 = 1)), u2[v2] = r2.push({ conversationID: v2, unreadCount: L2, type: a2.conversationType, subType: a2.conversationSubType, lastMessage: a2._isExcludedFromLastMessage ? "" : a2 }) - 1;
  1526. } else {
  1527. var A2 = u2[v2];
  1528. r2[A2].type = a2.conversationType, r2[A2].subType = a2.conversationSubType, r2[A2].lastMessage = a2._isExcludedFromLastMessage ? "" : a2, "in" === a2.flow && (a2._isExcludedFromUnreadCount || r2[A2].unreadCount++);
  1529. }
  1530. }
  1531. } else
  1532. a2._onlineOnlyFlag = true;
  1533. }
  1534. this._handleSignalingFromUnreadDB();
  1535. var R2 = false;
  1536. if (st(o2))
  1537. for (var N2 = function(e4, t3) {
  1538. if (o2[e4].unreadCount > 0) {
  1539. R2 = true;
  1540. var n4 = r2.find(function(t4) {
  1541. return t4.conversationID === "C2C".concat(o2[e4].from);
  1542. });
  1543. n4 ? n4.unreadCount = o2[e4].unreadCount : r2.push({ conversationID: "C2C".concat(o2[e4].from), unreadCount: o2[e4].unreadCount, type: S.CONV_C2C });
  1544. }
  1545. }, O2 = 0, G2 = o2.length; O2 < G2; O2++)
  1546. N2(O2);
  1547. if (st(n3))
  1548. for (var U2 = function(e4, t3) {
  1549. r2.find(function(t4) {
  1550. return t4.conversationID === "C2C".concat(n3[e4].from);
  1551. }) || r2.push({ conversationID: "C2C".concat(n3[e4].from), type: S.CONV_C2C, lastMsgTime: n3[e4].lastMsgTime });
  1552. }, P2 = 0, b2 = n3.length; P2 < b2; P2++)
  1553. U2(P2);
  1554. return { conversationOptionsList: r2, messageList: i2, isUnreadC2CMessage: R2 };
  1555. } }, { key: "_isSignaling", value: function(e3) {
  1556. var t2 = e3.eventArray;
  1557. return !(!st(t2) || 10 !== t2[0].event);
  1558. } }, { key: "_handleSignalingFromUnreadDB", value: function() {
  1559. var e3 = this._signalingFromUnreadDBList.length;
  1560. if (xe.l("".concat(this._n, "._handleSignalingFromUnreadDB signalingCount:").concat(e3)), 0 !== e3) {
  1561. var t2 = [];
  1562. this._signalingFromUnreadDBList.forEach(function(e4) {
  1563. e4.hasOwnProperty("c2cMessageRevokedNotify") && t2.push(e4);
  1564. }), this.onC2CMessageRevoked({ dataList: t2 }), this._signalingFromUnreadDBList.length = 0, t2.length = 0;
  1565. }
  1566. } }, { key: "onC2CMessageRevoked", value: function(e3) {
  1567. var t2 = this, n3 = this.getModule(Fn), o2 = [], s3 = null, a2 = true;
  1568. e3.dataList.forEach(function(e4) {
  1569. if (e4.c2cMessageRevokedNotify) {
  1570. var r2 = e4.c2cMessageRevokedNotify.revokedInfos;
  1571. at(r2) || r2.forEach(function(e5) {
  1572. var r3 = t2.getMyUserID() === e5.from ? "".concat(S.CONV_C2C).concat(e5.to) : "".concat(S.CONV_C2C).concat(e5.from);
  1573. s3 = n3.revoke(r3, e5.sequence, e5.random);
  1574. var i2 = e5.revokerInfo && e5.revokerInfo.revoker;
  1575. if (s3)
  1576. s3.revoker || (s3.revoker = i2, o2.push(s3));
  1577. else {
  1578. var u2 = { conversationID: r3, sequence: e5.sequence, time: e5.time, revoker: i2 };
  1579. n3.isLastMessageRevoked(u2) && (o2.push(u2), a2 = false);
  1580. }
  1581. });
  1582. }
  1583. }), 0 !== o2.length && (n3.onMessageRevoked(o2), true === a2 && (xe.l("".concat(this._n, ".onC2CMessageRevoked count:").concat(o2.length)), this.emitOuterEvent(E.MESSAGE_REVOKED, o2)));
  1584. } }, { key: "onC2CMessageReadReceipt", value: function(e3) {
  1585. var t2 = this;
  1586. e3.dataList.forEach(function(e4) {
  1587. if (!jt(e4.c2cMessageReadReceipt)) {
  1588. var n3 = e4.c2cMessageReadReceipt.to;
  1589. e4.c2cMessageReadReceipt.uinPairReadArray.forEach(function(e5) {
  1590. var o2 = e5.peerReadTime;
  1591. xe.d("".concat(t2._n, "._onC2CMessageReadReceipt to:").concat(n3, " peerReadTime:").concat(o2));
  1592. var s3 = "".concat(S.CONV_C2C).concat(n3), a2 = t2.getModule(Fn);
  1593. a2.recordPeerReadTime(s3, o2), a2.updateMessageIsPeerReadProperty(s3, o2);
  1594. });
  1595. }
  1596. });
  1597. } }, { key: "onC2CMessageReadNotice", value: function(e3) {
  1598. var t2 = this;
  1599. e3.dataList.forEach(function(e4) {
  1600. if (!jt(e4.c2cMessageReadNotice)) {
  1601. var n3 = t2.getModule(Fn);
  1602. e4.c2cMessageReadNotice.uinPairReadArray.forEach(function(e5) {
  1603. var o2 = e5.from, s3 = e5.peerReadTime;
  1604. xe.d("".concat(t2._n, ".onC2CMessageReadNotice from:").concat(o2, " lastReadTime:").concat(s3));
  1605. var a2 = "".concat(S.CONV_C2C).concat(o2);
  1606. n3.updateIsReadAfterReadReport({ conversationID: a2, lastMessageTime: s3 }), n3.updateUnreadCount(a2);
  1607. });
  1608. }
  1609. });
  1610. } }, { key: "onC2CMessageModified", value: function(e3) {
  1611. xe.d("".concat(this._n, ".onC2CMessageModified options:"), JSON.stringify(e3));
  1612. var n3 = this.getModule(Fn);
  1613. e3.dataList.forEach(function(e4) {
  1614. n3.onMessageModified(t(t({}, e4), {}, { conversationType: S.CONV_C2C }));
  1615. });
  1616. } }, { key: "onReadReceiptList", value: function(e3) {
  1617. xe.d("".concat(this._n, ".onReadReceiptList options:"), JSON.stringify(e3));
  1618. var t2 = e3.dataList, n3 = t2.userID, o2 = t2.readReceiptList;
  1619. this.getModule(Fn).updateReadReceiptInfo({ userID: n3, readReceiptList: o2 });
  1620. } }, { key: "sendMessage", value: function(e3, t2) {
  1621. var n3 = this._createC2CMessagePack(e3, t2);
  1622. return this.request(n3);
  1623. } }, { key: "_createC2CMessagePack", value: function(e3, t2) {
  1624. var n3 = null;
  1625. t2 && (t2.offlinePushInfo && (n3 = t2.offlinePushInfo), true === t2.onlineUserOnly && (n3 ? n3.disablePush = true : n3 = { disablePush: true }));
  1626. var o2 = "";
  1627. et(e3.cloudCustomData) && e3.cloudCustomData.length > 0 && (o2 = e3.cloudCustomData);
  1628. var s3 = [];
  1629. if (ot(t2) && ot(t2.messageControlInfo)) {
  1630. var a2 = t2.messageControlInfo, r2 = a2.excludedFromUnreadCount, i2 = a2.excludedFromLastMessage, u2 = a2.excludedFromContentModeration;
  1631. true === r2 && s3.push("NoUnread"), true === i2 && s3.push("NoLastMsg"), true === u2 && s3.push("NoMsgCheck");
  1632. }
  1633. var c2 = this.isOnlineMessage(e3, t2) ? 0 : void 0;
  1634. return { protocolName: _o, tjgID: this.generateTjgID(e3), requestData: { fromAccount: this.getMyUserID(), toAccount: e3.to, msgBody: e3.getElements(), cloudCustomData: o2, msgSeq: e3.sequence, msgRandom: e3.random, msgLifeTime: c2, nick: e3.nick, avatar: e3.avatar, offlinePushInfo: n3 ? { pushFlag: true === n3.disablePush ? 1 : 0, title: n3.title || "", desc: n3.description || "", ext: n3.extension || "", apnsInfo: { badgeMode: true === n3.ignoreIOSBadge ? 1 : 0, isVoipPush: this._isVoipPush(n3) }, androidInfo: { OPPOChannelID: n3.androidOPPOChannelID || "" } } : void 0, messageControlInfo: 0 !== c2 ? s3 : void 0, clientTime: e3.clientTime, needReadReceipt: true === e3.needReadReceipt ? 1 : 0, isSupportExtension: true === e3.isSupportExtension ? 1 : 0 } };
  1635. } }, { key: "_isVoipPush", value: function(e3) {
  1636. var t2 = void 0;
  1637. return at(e3.disableVoipPush) || (t2 = false === e3.disableVoipPush ? 1 : 0), t2;
  1638. } }, { key: "isOnlineMessage", value: function(e3, t2) {
  1639. return !(!t2 || true !== t2.onlineUserOnly);
  1640. } }, { key: "revokeMessage", value: function(e3) {
  1641. return this.request({ protocolName: Io, requestData: { msgInfo: { fromAccount: e3.from, toAccount: e3.to, msgSeq: e3.sequence, msgRandom: e3.random, msgTimeStamp: e3.time } } });
  1642. } }, { key: "deleteMessage", value: function(e3) {
  1643. var t2 = e3.to, n3 = e3.keyList;
  1644. return xe.l("".concat(this._n, ".deleteMessage toAccount:").concat(t2, " count:").concat(n3.length)), this.request({ protocolName: ko, requestData: { fromAccount: this.getMyUserID(), to: t2, keyList: n3 } });
  1645. } }, { key: "modifyRemoteMessage", value: function(e3) {
  1646. var t2 = e3.from, n3 = e3.to, o2 = e3.version, s3 = void 0 === o2 ? 0 : o2, a2 = e3.sequence, r2 = e3.random, i2 = e3.time, u2 = e3.payload, c2 = e3.type, l2 = e3.cloudCustomData, p2 = void 0;
  1647. return Vt(c2) && (p2 = []).push({ type: c2, content: u2 }), this.request({ protocolName: Lo, requestData: { from: t2, to: n3, version: s3, sequence: a2, random: r2, time: i2, elements: p2, cloudCustomData: l2 } });
  1648. } }, { key: "setMessageRead", value: function(e3) {
  1649. var t2 = this, n3 = e3.conversationID, o2 = e3.lastMessageTime, s3 = "".concat(this._n, ".setMessageRead");
  1650. xe.l("".concat(s3, " conversationID:").concat(n3, " lastMessageTime:").concat(o2)), $e(o2) || this.outputWarning("DoNotModifyLastTime");
  1651. var a2 = new ka("setC2CMessageRead");
  1652. return a2.setMessage("conversationID:".concat(n3, " lastMessageTime:").concat(o2)), this.request({ protocolName: Co, requestData: { C2CMsgReaded: { cookie: "", C2CMsgReadedItem: [{ toAccount: n3.replace("C2C", ""), lastMessageTime: o2, receipt: 1 }] } } }).then(function() {
  1653. a2.setNetworkType(t2.getNetworkType()).end(), xe.l("".concat(s3, " ok"));
  1654. var e4 = t2.getModule(Fn);
  1655. return e4.updateIsReadAfterReadReport({ conversationID: n3, lastMessageTime: o2 }), e4.updateUnreadCount(n3), Ka();
  1656. }).catch(function(e4) {
  1657. return t2.probeNetwork().then(function(t3) {
  1658. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  1659. a2.setError(e4, o3, s4).end();
  1660. }), xe.l("".concat(s3, " failed. error:"), e4), Ja(e4);
  1661. });
  1662. } }, { key: "getRoamingMessage", value: function(e3) {
  1663. var t2 = this, n3 = "".concat(this._n, ".getRoamingMessage"), o2 = e3.peerAccount, s3 = e3.conversationID, a2 = e3.count, r2 = e3.lastMessageTime, i2 = e3.messageKey, u2 = "peerAccount:".concat(o2, " count:").concat(a2 || 15, " lastMessageTime:").concat(r2 || 0, " messageKey:").concat(i2);
  1664. xe.l("".concat(n3, " ").concat(u2));
  1665. var c2 = new ka("getC2CRoamingMessages");
  1666. return this.request({ protocolName: Eo, requestData: { peerAccount: o2, count: a2 || 15, lastMessageTime: r2 || 0, messageKey: i2 } }).then(function(e4) {
  1667. var o3 = e4.data, a3 = o3.complete, r3 = o3.messageList, i3 = o3.messageKey, l2 = o3.lastMessageTime;
  1668. at(r3) ? xe.l("".concat(n3, " ok. complete:").concat(a3, " but messageList is undefined!")) : xe.l("".concat(n3, " ok. complete:").concat(a3, " count:").concat(r3.length)), c2.setNetworkType(t2.getNetworkType()).setMessage("".concat(u2, " complete:").concat(a3, " length:").concat(r3.length)).end();
  1669. var p2 = t2.getModule(Fn);
  1670. 1 === a3 && p2.setCompleted(s3);
  1671. var d2 = p2.onRoamingMessage(r3, s3);
  1672. p2.modifyMessageList(s3), p2.updateIsRead(s3), p2.updateRoamingMessageKeyAndTime(s3, i3, l2);
  1673. var g2 = p2.getPeerReadTime(s3);
  1674. if (xe.l("".concat(n3, " update isPeerRead property. conversationID:").concat(s3, " peerReadTime:").concat(g2)), g2)
  1675. p2.updateMessageIsPeerReadProperty(s3, g2);
  1676. else {
  1677. var _2 = s3.replace(S.CONV_C2C, "");
  1678. t2.getRemotePeerReadTime([_2]).then(function() {
  1679. p2.updateMessageIsPeerReadProperty(s3, p2.getPeerReadTime(s3));
  1680. });
  1681. }
  1682. var h2 = "";
  1683. if (d2.length > 0)
  1684. h2 = d2[0].ID;
  1685. else {
  1686. var f2 = p2.getLocalOldestMessage(s3);
  1687. f2 && (h2 = f2.ID);
  1688. }
  1689. return xe.l("".concat(n3, " nextReqID:").concat(h2, " stored message count:").concat(d2.length)), { nextReqID: h2, storedMessageList: d2 };
  1690. }).catch(function(e4) {
  1691. return t2.probeNetwork().then(function(t3) {
  1692. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  1693. c2.setMessage(u2).setError(e4, o3, s4).end();
  1694. }), xe.w("".concat(n3, " failed. error:"), e4), Ja(e4);
  1695. });
  1696. } }, { key: "getRoamingMessagesHopping", value: function(e3) {
  1697. var t2 = this, n3 = "".concat(this._n, ".getRoamingMessagesHopping"), o2 = e3.peerAccount, s3 = e3.time, a2 = void 0 === s3 ? 0 : s3, r2 = e3.count, i2 = e3.direction, u2 = "".concat(S.CONV_C2C).concat(o2), c2 = "peerAccount:".concat(o2, " count:").concat(r2, " time:").concat(a2, " direction:").concat(i2);
  1698. xe.l("".concat(n3, " ").concat(c2));
  1699. var l2 = new ka("getC2CRoamingMessagesHopping");
  1700. return this.request({ protocolName: Eo, requestData: { peerAccount: o2, count: r2 + 1, lastMessageTime: a2, direction: i2 } }).then(function(e4) {
  1701. var o3 = e4.data, s4 = o3.complete, a3 = o3.messageList, r3 = void 0 === a3 ? [] : a3, p2 = o3.lastMessageTime;
  1702. xe.l("".concat(n3, " ok. complete:").concat(s4, " count:").concat(r3.length)), l2.setNetworkType(t2.getNetworkType()).setMessage("".concat(c2, " complete:").concat(s4, " length:").concat(r3.length)).end(), 1 !== s4 && (1 === i2 ? r3.pop() : r3.shift());
  1703. var d2 = t2.getModule(Fn).onRoamingMessage(r3, u2, false);
  1704. t2._modifyMessageList(u2, d2);
  1705. var g2 = t2._computeResult({ complete: s4, lastMessageTime: p2, resultList: d2 });
  1706. return Ka(g2);
  1707. }).catch(function(e4) {
  1708. return t2.probeNetwork().then(function(t3) {
  1709. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  1710. l2.setMessage(c2).setError(e4, o3, s4).end();
  1711. }), xe.w("".concat(n3, " failed. error:"), e4), Ja(e4);
  1712. });
  1713. } }, { key: "_computeResult", value: function(e3) {
  1714. var t2 = e3.complete, n3 = void 0 === t2 ? 0 : t2, o2 = e3.lastMessageTime, s3 = e3.resultList, a2 = { messageList: m(void 0 === s3 ? [] : s3), isCompleted: false, nextMessageTime: "" };
  1715. return 1 === n3 ? (a2.isCompleted = true, a2) : (a2.nextMessageTime = o2, a2);
  1716. } }, { key: "_modifyMessageList", value: function(e3, t2) {
  1717. var n3 = this.getModule(Fn).getLocalConversation(e3);
  1718. if (n3)
  1719. for (var o2 = n3.userProfile.nick, s3 = n3.userProfile.avatar, a2 = this.getModule(On).getNickAndAvatarByUserID(this.getMyUserID()), r2 = a2.nick, i2 = a2.avatar, u2 = t2.length - 1; u2 >= 0; u2--) {
  1720. var c2 = t2[u2];
  1721. "in" === c2.flow && (c2.nick !== o2 && c2.setNickAndAvatar({ nick: o2 }), c2.avatar !== s3 && c2.setNickAndAvatar({ avatar: s3 })), "out" === c2.flow && (c2.nick !== r2 && c2.setNickAndAvatar({ nick: r2 }), c2.avatar !== i2 && c2.setNickAndAvatar({ avatar: i2 }));
  1722. }
  1723. } }, { key: "getRemotePeerReadTime", value: function(e3) {
  1724. var t2 = this, n3 = "".concat(this._n, ".getRemotePeerReadTime");
  1725. if (jt(e3))
  1726. return xe.w("".concat(n3, " userIDList is empty!")), Promise.resolve();
  1727. var o2 = new ka("getPeerReadTime");
  1728. return xe.l("".concat(n3, " userIDList:").concat(e3)), this.request({ protocolName: So, requestData: { userIDList: e3 } }).then(function(s3) {
  1729. var a2 = s3.data.peerReadTimeList;
  1730. xe.l("".concat(n3, " ok. peerReadTimeList:").concat(a2));
  1731. for (var r2 = "", i2 = t2.getModule(Fn), u2 = 0; u2 < e3.length; u2++)
  1732. r2 += "".concat(e3[u2], "-").concat(a2[u2], " "), a2[u2] > 0 && i2.recordPeerReadTime("C2C".concat(e3[u2]), a2[u2]);
  1733. o2.setNetworkType(t2.getNetworkType()).setMessage(r2).end();
  1734. }).catch(function(e4) {
  1735. t2.probeNetwork().then(function(t3) {
  1736. var n4 = v(t3, 2), s3 = n4[0], a2 = n4[1];
  1737. o2.setError(e4, s3, a2).end();
  1738. }), xe.w("".concat(n3, " failed. error:"), e4);
  1739. });
  1740. } }, { key: "sendReadReceipt", value: function(e3) {
  1741. var t2 = this, n3 = e3[0].conversationID.replace(S.CONV_C2C, ""), o2 = new ka("sendC2CReadReceipt");
  1742. o2.setMessage("peerAccount:".concat(n3));
  1743. var s3 = this.getMyUserID(), a2 = e3.filter(function(e4) {
  1744. return e4.from !== s3 && true === e4.needReadReceipt;
  1745. }).map(function(e4) {
  1746. return { fromAccount: e4.from, toAccount: e4.to, sequence: e4.sequence, random: e4.random, time: e4.time, clientTime: e4.clientTime };
  1747. });
  1748. if (0 === a2.length)
  1749. return Ja({ code: da.READ_RECEIPT_MESSAGE_LIST_EMPTY });
  1750. var r2 = "".concat(this._n, ".sendReadReceipt");
  1751. return xe.l("".concat(r2, ". peerAccount:").concat(n3, " messageInfoList length:").concat(a2.length)), this.request({ protocolName: ls, requestData: { peerAccount: n3, messageInfoList: a2 } }).then(function(e4) {
  1752. return o2.end(), xe.l("".concat(r2, " ok")), Ka();
  1753. }).catch(function(e4) {
  1754. return t2.probeNetwork().then(function(t3) {
  1755. var n4 = v(t3, 2), s4 = n4[0], a3 = n4[1];
  1756. o2.setError(e4, s4, a3).end();
  1757. }), xe.w("".concat(r2, " failed. error:"), e4), Ja(e4);
  1758. });
  1759. } }, { key: "getReadReceiptList", value: function(e3) {
  1760. var t2 = "".concat(this._n, ".getReadReceiptList"), n3 = this.getMyUserID(), o2 = e3.filter(function(e4) {
  1761. return e4.from === n3 && true === e4.needReadReceipt;
  1762. });
  1763. return xe.l("".concat(t2, " userID:").concat(n3, " messageList length:").concat(o2.length)), za({ messageList: o2 });
  1764. } }, { key: "getMessageExtensions", value: function(e3, t2) {
  1765. return xe.l("".concat(this._n, ".getMessageExtensions startSequence:").concat(t2)), this.request({ protocolName: Ro, requestData: { from: e3.from, to: e3.to, messageKey: this._getMessageKey(e3), startSequence: t2 } });
  1766. } }, { key: "modifyMessageExtensions", value: function(e3, t2) {
  1767. var n3 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1;
  1768. return xe.l("".concat(this._n, ".modifyMessageExtensions operateType:").concat(n3)), this.request({ protocolName: Ao, requestData: { from: e3.from, to: e3.to, messageKey: this._getMessageKey(e3), extensionList: t2, operateType: n3 } });
  1769. } }, { key: "_getMessageKey", value: function(e3) {
  1770. var t2 = e3.clientSequence, n3 = e3.random, o2 = e3.time;
  1771. return "".concat(t2, "_").concat(n3, "_").concat(o2);
  1772. } }, { key: "reset", value: function() {
  1773. xe.l("".concat(this._n, ".reset")), this._messageFromUnreadDBMap.clear(), this._signalingFromUnreadDBList.length = 0;
  1774. } }]), s2;
  1775. }(ro), Qa = function() {
  1776. function e2() {
  1777. o(this, e2), this.list = /* @__PURE__ */ new Map(), this._n = "MessageListHandler", this._latestMessageSentByPeerMap = /* @__PURE__ */ new Map(), this._latestMessageSentByMeMap = /* @__PURE__ */ new Map();
  1778. }
  1779. return a(e2, [{ key: "getLocalOldestMessageByConversationID", value: function(e3) {
  1780. if (!e3)
  1781. return null;
  1782. if (!this.list.has(e3))
  1783. return null;
  1784. var t2 = this.list.get(e3).values();
  1785. return t2 ? t2.next().value : null;
  1786. } }, { key: "pushIn", value: function(e3) {
  1787. var t2 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], n2 = e3.conversationID, o2 = true;
  1788. this.list.has(n2) || this.list.set(n2, /* @__PURE__ */ new Map());
  1789. var s2 = this._getUniqueIDOfMessage(e3), a2 = this.list.get(n2).has(s2);
  1790. if (a2) {
  1791. var r2 = this.list.get(n2).get(s2);
  1792. if (!t2 || true === r2.isModified)
  1793. return o2 = false;
  1794. }
  1795. return this.list.get(n2).set(s2, e3), this._setLatestMessageSentByPeer(n2, e3), this._setLatestMessageSentByMe(n2, e3), o2;
  1796. } }, { key: "unshift", value: function(e3, t2) {
  1797. var n2;
  1798. if (st(e3) ? e3.length > 0 && (n2 = e3[0].conversationID, this._unshiftMultipleMessages(e3, t2)) : (n2 = e3.conversationID, this._unshiftSingleMessage(e3, t2)), n2 && n2.startsWith(S.CONV_C2C)) {
  1799. var o2 = Array.from(this.list.get(n2).values()), s2 = o2.length;
  1800. if (0 === s2)
  1801. return;
  1802. for (var a2 = s2 - 1; a2 >= 0; a2--)
  1803. if ("out" === o2[a2].flow) {
  1804. this._setLatestMessageSentByMe(n2, o2[a2]);
  1805. break;
  1806. }
  1807. for (var r2 = s2 - 1; r2 >= 0; r2--)
  1808. if ("in" === o2[r2].flow) {
  1809. this._setLatestMessageSentByPeer(n2, o2[r2]);
  1810. break;
  1811. }
  1812. }
  1813. } }, { key: "_unshiftSingleMessage", value: function(e3, t2) {
  1814. var n2 = e3.conversationID, o2 = this._getUniqueIDOfMessage(e3);
  1815. if (!this.list.has(n2))
  1816. return this.list.set(n2, /* @__PURE__ */ new Map()), this.list.get(n2).set(o2, e3), void t2.push(e3);
  1817. var s2 = this.list.get(n2), a2 = Array.from(s2);
  1818. s2.has(o2) || (a2.unshift([o2, e3]), this.list.set(n2, new Map(a2)), t2.push(e3));
  1819. } }, { key: "_unshiftMultipleMessages", value: function(e3, t2) {
  1820. for (var n2 = e3.length, o2 = [], s2 = e3[0].conversationID, a2 = this.list.get(s2), r2 = this.list.has(s2) ? Array.from(a2) : [], i2 = 0; i2 < n2; i2++) {
  1821. var u2 = this._getUniqueIDOfMessage(e3[i2]);
  1822. a2 && a2.has(u2) || (o2.push([u2, e3[i2]]), t2.push(e3[i2]));
  1823. }
  1824. this.list.set(s2, new Map(o2.concat(r2)));
  1825. } }, { key: "remove", value: function(e3) {
  1826. var t2 = e3.conversationID, n2 = this._getUniqueIDOfMessage(e3);
  1827. this.list.has(t2) && this.list.get(t2).delete(n2);
  1828. } }, { key: "revoke", value: function(e3, t2, n2) {
  1829. if (xe.d("revoke message", e3, t2, n2), this.list.has(e3)) {
  1830. var o2, s2 = D(this.list.get(e3));
  1831. try {
  1832. for (s2.s(); !(o2 = s2.n()).done; ) {
  1833. var a2 = v(o2.value, 2)[1];
  1834. if (a2.sequence === t2 && (at(n2) || a2.random === n2))
  1835. return a2.isRevoked || (a2.isRevoked = true), a2;
  1836. }
  1837. } catch (r2) {
  1838. s2.e(r2);
  1839. } finally {
  1840. s2.f();
  1841. }
  1842. }
  1843. return null;
  1844. } }, { key: "removeByConversationID", value: function(e3) {
  1845. this.list.has(e3) && (this.list.delete(e3), this._latestMessageSentByPeerMap.delete(e3), this._latestMessageSentByMeMap.delete(e3));
  1846. } }, { key: "findMessage", value: function(e3) {
  1847. var t2, n2 = null, o2 = D(this.list);
  1848. try {
  1849. for (o2.s(); !(t2 = o2.n()).done; )
  1850. for (var s2 = m(v(t2.value, 2)[1].values()), a2 = s2.length, r2 = 0; r2 < a2; r2++)
  1851. if (s2[r2].ID === e3) {
  1852. n2 = s2[r2];
  1853. break;
  1854. }
  1855. } catch (i2) {
  1856. o2.e(i2);
  1857. } finally {
  1858. o2.f();
  1859. }
  1860. return n2;
  1861. } }, { key: "updateMessageIsPeerReadProperty", value: function(e3, t2) {
  1862. var n2 = [];
  1863. if (this.list.has(e3)) {
  1864. var o2, s2 = D(this.list.get(e3));
  1865. try {
  1866. for (s2.s(); !(o2 = s2.n()).done; ) {
  1867. var a2 = v(o2.value, 2)[1];
  1868. a2.time <= t2 && !a2.isPeerRead && "out" === a2.flow && (a2.isPeerRead = true, n2.push(a2));
  1869. }
  1870. } catch (r2) {
  1871. s2.e(r2);
  1872. } finally {
  1873. s2.f();
  1874. }
  1875. xe.l("".concat(this._n, ".updateMessageIsPeerReadProperty conversationID:").concat(e3, " peerReadTime:").concat(t2, " count:").concat(n2.length));
  1876. }
  1877. return n2;
  1878. } }, { key: "updateMessageIsModifiedProperty", value: function(e3) {
  1879. var t2 = e3.conversationID;
  1880. if (this.list.has(t2)) {
  1881. var n2 = this._getUniqueIDOfMessage(e3), o2 = this.list.get(t2).get(n2);
  1882. o2 && (o2.isModified = true);
  1883. }
  1884. } }, { key: "hasLocalMessageList", value: function(e3) {
  1885. return this.list.has(e3);
  1886. } }, { key: "getLocalMessageList", value: function(e3) {
  1887. return this.hasLocalMessageList(e3) ? m(this.list.get(e3).values()) : [];
  1888. } }, { key: "hasLocalMessage", value: function(e3, t2) {
  1889. for (var n2 = false, o2 = this.getLocalMessageList(e3), s2 = o2.length, a2 = 0; a2 < s2; a2++)
  1890. o2[a2].ID === t2 && (n2 = true);
  1891. return n2;
  1892. } }, { key: "getLocalMessage", value: function(e3, t2) {
  1893. for (var n2 = null, o2 = this.getLocalMessageList(e3), s2 = o2.length, a2 = 0; a2 < s2; a2++)
  1894. if (o2[a2].ID === t2) {
  1895. n2 = o2[a2];
  1896. break;
  1897. }
  1898. return n2;
  1899. } }, { key: "getLocalLastMessage", value: function(e3) {
  1900. var t2 = this.getLocalMessageList(e3);
  1901. return t2[t2.length - 1];
  1902. } }, { key: "getLocalOldestMessage", value: function(e3) {
  1903. return this.getLocalMessageList(e3)[0];
  1904. } }, { key: "_setLatestMessageSentByPeer", value: function(e3, t2) {
  1905. e3.startsWith(S.CONV_C2C) && "in" === t2.flow && this._latestMessageSentByPeerMap.set(e3, t2);
  1906. } }, { key: "_setLatestMessageSentByMe", value: function(e3, t2) {
  1907. e3.startsWith(S.CONV_C2C) && "out" === t2.flow && this._latestMessageSentByMeMap.set(e3, t2);
  1908. } }, { key: "getLatestMessageSentByPeer", value: function(e3) {
  1909. return this._latestMessageSentByPeerMap.get(e3);
  1910. } }, { key: "getLatestMessageSentByMe", value: function(e3) {
  1911. return this._latestMessageSentByMeMap.get(e3);
  1912. } }, { key: "modifyMessageSentByPeer", value: function(e3) {
  1913. var t2 = e3.conversationID, n2 = e3.latestNick, o2 = e3.latestAvatar, s2 = this.list.get(t2);
  1914. if (!jt(s2)) {
  1915. var a2 = Array.from(s2.values()), r2 = a2.length;
  1916. if (0 !== r2) {
  1917. for (var i2 = null, u2 = 0, c2 = false, l2 = r2 - 1; l2 >= 0; l2--)
  1918. "in" === a2[l2].flow && ((i2 = a2[l2]).nick !== n2 && (i2.setNickAndAvatar({ nick: n2 }), c2 = true), i2.avatar !== o2 && (i2.setNickAndAvatar({ avatar: o2 }), c2 = true), c2 && (u2 += 1));
  1919. xe.l("".concat(this._n, ".modifyMessageSentByPeer conversationID:").concat(t2, " count:").concat(u2));
  1920. }
  1921. }
  1922. } }, { key: "modifyMessageSentByMe", value: function(e3) {
  1923. var t2 = e3.conversationID, n2 = e3.latestNick, o2 = e3.latestAvatar, s2 = this.list.get(t2);
  1924. if (!jt(s2)) {
  1925. var a2 = Array.from(s2.values()), r2 = a2.length;
  1926. if (0 !== r2) {
  1927. for (var i2 = null, u2 = 0, c2 = false, l2 = r2 - 1; l2 >= 0; l2--)
  1928. "out" === a2[l2].flow && ((i2 = a2[l2]).nick !== n2 && (i2.setNickAndAvatar({ nick: n2 }), c2 = true), i2.avatar !== o2 && (i2.setNickAndAvatar({ avatar: o2 }), c2 = true), c2 && (u2 += 1));
  1929. xe.l("".concat(this._n, ".modifyMessageSentByMe conversationID:").concat(t2, " count:").concat(u2));
  1930. }
  1931. }
  1932. } }, { key: "getTopicConversationIDList", value: function(e3) {
  1933. return m(this.list.keys()).filter(function(t2) {
  1934. return t2.startsWith("".concat(S.CONV_GROUP).concat(e3));
  1935. });
  1936. } }, { key: "traversal", value: function() {
  1937. if (0 !== this.list.size && -1 === xe.getLevel()) {
  1938. console.group("conversationID-messageCount");
  1939. var e3, t2 = D(this.list);
  1940. try {
  1941. for (t2.s(); !(e3 = t2.n()).done; ) {
  1942. var n2 = v(e3.value, 2), o2 = n2[0], s2 = n2[1];
  1943. console.log("".concat(o2, "-").concat(s2.size));
  1944. }
  1945. } catch (a2) {
  1946. t2.e(a2);
  1947. } finally {
  1948. t2.f();
  1949. }
  1950. console.groupEnd();
  1951. }
  1952. } }, { key: "onMessageModified", value: function(e3, t2) {
  1953. if (!this.list.has(e3))
  1954. return { isUpdated: false, message: null };
  1955. var n2 = this._getUniqueIDOfMessage(t2), o2 = this.list.get(e3).has(n2);
  1956. if (xe.d("".concat(this._n, ".onMessageModified conversationID:").concat(e3, " uniqueID:").concat(n2, " has:").concat(o2)), o2) {
  1957. var s2 = this.list.get(e3).get(n2), a2 = t2.messageVersion, r2 = t2.elements, i2 = t2.cloudCustomData;
  1958. return s2.version < a2 ? (s2.version = a2, s2._elements = JSON.parse(JSON.stringify(r2)), s2.payload = JSON.parse(JSON.stringify(r2[0].content)), s2.type = r2[0].type, s2.cloudCustomData = i2, s2.isModified = true, { isUpdated: true, message: s2 }) : { isUpdated: false, message: s2 };
  1959. }
  1960. return { isUpdated: false, message: null };
  1961. } }, { key: "_getUniqueIDOfMessage", value: function(e3) {
  1962. var t2 = e3.from, n2 = e3.to, o2 = e3.random, s2 = e3.sequence, a2 = e3.time;
  1963. return "".concat(t2, "-").concat(n2, "-").concat(o2, "-").concat(s2, "-").concat(a2);
  1964. } }, { key: "reset", value: function() {
  1965. this.list.clear(), this._latestMessageSentByPeerMap.clear(), this._latestMessageSentByMeMap.clear();
  1966. } }]), e2;
  1967. }(), Za = "_a2KeyAndTinyIDUpdated", $a = "_cloudConfigUpdated", er = "_profileUpdated";
  1968. function tr(e2) {
  1969. this.mixin(e2);
  1970. }
  1971. tr.mixin = function(e2) {
  1972. var t2 = e2.prototype || e2;
  1973. t2._isReady = false, t2.ready = function(e3) {
  1974. var t3 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
  1975. if (e3)
  1976. return this._isReady ? void (t3 ? e3.call(this) : setTimeout(e3, 1)) : (this._readyQueue = this._readyQueue || [], void this._readyQueue.push(e3));
  1977. }, t2.triggerReady = function() {
  1978. var e3 = this;
  1979. this._isReady = true, setTimeout(function() {
  1980. var t3 = e3._readyQueue;
  1981. e3._readyQueue = [], t3 && t3.length > 0 && t3.forEach(function(e4) {
  1982. e4.call(this);
  1983. }, e3);
  1984. }, 1);
  1985. }, t2.resetReady = function() {
  1986. this._isReady = false, this._readyQueue = [];
  1987. }, t2.isReady = function() {
  1988. return this._isReady;
  1989. };
  1990. };
  1991. var nr = ["jpg", "jpeg", "gif", "png", "bmp", "image", "webp"], or = ["mp4", "quicktime", "mov"], sr = 1, ar = 2, rr = 3, ir = 255, ur = function() {
  1992. function e2(t2) {
  1993. var n2 = this;
  1994. o(this, e2), jt(t2) || (this.userID = t2.userID || "", this.nick = t2.nick || "", this.gender = t2.gender || "", this.birthday = t2.birthday || 0, this.location = t2.location || "", this.selfSignature = t2.selfSignature || "", this.allowType = t2.allowType || S.ALLOW_TYPE_ALLOW_ANY, this.language = t2.language || 0, this.avatar = t2.avatar || "", this.messageSettings = t2.messageSettings || 0, this.adminForbidType = t2.adminForbidType || S.FORBID_TYPE_NONE, this.level = t2.level || 0, this.role = t2.role || 0, this.lastUpdatedTime = 0, this.profileCustomField = [], jt(t2.profileCustomField) || t2.profileCustomField.forEach(function(e3) {
  1995. n2.profileCustomField.push({ key: e3.key, value: e3.value });
  1996. }));
  1997. }
  1998. return a(e2, [{ key: "validate", value: function(e3) {
  1999. var t2 = true, n2 = "";
  2000. if (jt(e3))
  2001. return { valid: false, tips: "empty options" };
  2002. if (e3.profileCustomField)
  2003. for (var o2 = e3.profileCustomField.length, s2 = null, a2 = 0; a2 < o2; a2++) {
  2004. if (s2 = e3.profileCustomField[a2], !et(s2.key) || -1 === s2.key.indexOf("Tag_Profile_Custom"))
  2005. return { valid: false, tips: "The prefix of keys of the custom profile key-value pairs (which is profileCustomField) must be Tag_Profile_Custom" };
  2006. if (!et(s2.value))
  2007. return { valid: false, tips: "The type of values of the custom profile key-value pairs (which is profileCustomField) must be String" };
  2008. }
  2009. for (var r2 in e3)
  2010. if (Object.prototype.hasOwnProperty.call(e3, r2)) {
  2011. if ("profileCustomField" === r2)
  2012. continue;
  2013. if (jt(e3[r2]) && !et(e3[r2]) && !$e(e3[r2])) {
  2014. n2 = "key:" + r2 + ", invalid value:" + e3[r2], t2 = false;
  2015. continue;
  2016. }
  2017. switch (r2) {
  2018. case "nick":
  2019. et(e3[r2]) || (n2 = "nick must be a string", t2 = false), gt(e3[r2]) > 500 && (n2 = "nick name limited: must less than or equal to ".concat(500, " bytes, current size: ").concat(gt(e3[r2]), " bytes"), t2 = false);
  2020. break;
  2021. case "gender":
  2022. vt(He, e3.gender) || (n2 = "key:gender, invalid value:" + e3.gender, t2 = false);
  2023. break;
  2024. case "birthday":
  2025. $e(e3.birthday) || (n2 = "birthday must be a number", t2 = false);
  2026. break;
  2027. case "location":
  2028. et(e3.location) || (n2 = "location must be a string", t2 = false);
  2029. break;
  2030. case "selfSignature":
  2031. et(e3.selfSignature) || (n2 = "selfSignature must be a string", t2 = false);
  2032. break;
  2033. case "allowType":
  2034. vt(We, e3.allowType) || (n2 = "key:allowType, invalid value:" + e3.allowType, t2 = false);
  2035. break;
  2036. case "language":
  2037. $e(e3.language) || (n2 = "language must be a number", t2 = false);
  2038. break;
  2039. case "avatar":
  2040. et(e3.avatar) || (n2 = "avatar must be a string", t2 = false);
  2041. break;
  2042. case "messageSettings":
  2043. 0 !== e3.messageSettings && 1 !== e3.messageSettings && (n2 = "messageSettings must be 0 or 1", t2 = false);
  2044. break;
  2045. case "adminForbidType":
  2046. vt(Ke, e3.adminForbidType) || (n2 = "key:adminForbidType, invalid value:" + e3.adminForbidType, t2 = false);
  2047. break;
  2048. case "level":
  2049. $e(e3.level) || (n2 = "level must be a number", t2 = false);
  2050. break;
  2051. case "role":
  2052. $e(e3.role) || (n2 = "role must be a number", t2 = false);
  2053. break;
  2054. default:
  2055. n2 = "unknown key:" + r2 + " " + e3[r2], t2 = false;
  2056. }
  2057. }
  2058. return { valid: t2, tips: n2 };
  2059. } }]), e2;
  2060. }(), cr = a(function e2(t2) {
  2061. o(this, e2), this.value = t2, this.next = null;
  2062. }), lr = function() {
  2063. function e2(t2) {
  2064. o(this, e2), this.MAX_LENGTH = t2, this.pTail = null, this.pNodeToDel = null, this.map = /* @__PURE__ */ new Map();
  2065. }
  2066. return a(e2, [{ key: "set", value: function(e3) {
  2067. var t2 = new cr(e3);
  2068. if (this.map.size < this.MAX_LENGTH)
  2069. null === this.pTail ? (this.pTail = t2, this.pNodeToDel = t2) : (this.pTail.next = t2, this.pTail = t2), this.map.set(e3, 1);
  2070. else {
  2071. var n2 = this.pNodeToDel;
  2072. this.pNodeToDel = this.pNodeToDel.next, this.map.delete(n2.value), n2.next = null, n2 = null, this.pTail.next = t2, this.pTail = t2, this.map.set(e3, 1);
  2073. }
  2074. } }, { key: "has", value: function(e3) {
  2075. return this.map.has(e3);
  2076. } }, { key: "delete", value: function(e3) {
  2077. this.has(e3) && this.map.delete(e3);
  2078. } }, { key: "tail", value: function() {
  2079. return this.pTail;
  2080. } }, { key: "size", value: function() {
  2081. return this.map.size;
  2082. } }, { key: "data", value: function() {
  2083. return Array.from(this.map.keys());
  2084. } }, { key: "reset", value: function() {
  2085. for (var e3; null !== this.pNodeToDel; )
  2086. e3 = this.pNodeToDel, this.pNodeToDel = this.pNodeToDel.next, e3.next = null, e3 = null;
  2087. this.pTail = null, this.map.clear();
  2088. } }]), e2;
  2089. }(), pr = ["groupID", "name", "avatar", "type", "introduction", "notification", "ownerID", "selfInfo", "createTime", "infoSequence", "lastInfoTime", "lastMessage", "nextMessageSeq", "memberNum", "maxMemberNum", "memberList", "joinOption", "groupCustomField", "muteAllMembers", "isSupportTopic", "inviteOption", "_lastRevokedTime"], dr = function() {
  2090. function e2(t2) {
  2091. o(this, e2), this.groupID = "", this.name = "", this.avatar = "", this.type = "", this.introduction = "", this.notification = "", this.ownerID = "", this.createTime = "", this.infoSequence = "", this.lastInfoTime = "", this.selfInfo = { messageRemindType: "", joinTime: "", nameCard: "", role: "", userID: "", memberCustomField: void 0, readedSequence: 0, excludedUnreadSequenceList: void 0 }, this.lastMessage = { lastTime: "", lastSequence: "", fromAccount: "", messageForShow: "" }, this.nextMessageSeq = "", this.memberNum = "", this.memberCount = "", this.maxMemberNum = "", this.maxMemberCount = "", this.joinOption = "", this.inviteOption = "", this.groupCustomField = [], this.muteAllMembers = false, this.isSupportTopic = false, this._lastRevokedTime = 0, this._initGroup(t2);
  2092. }
  2093. return a(e2, [{ key: "memberNum", get: function() {
  2094. return this.memberCount;
  2095. }, set: function(e3) {
  2096. } }, { key: "maxMemberNum", get: function() {
  2097. return this.maxMemberCount;
  2098. }, set: function(e3) {
  2099. } }, { key: "_initGroup", value: function(e3) {
  2100. for (var t2 in e3)
  2101. pr.indexOf(t2) < 0 || ("selfInfo" !== t2 ? ("memberNum" === t2 && (this.memberCount = e3[t2]), "maxMemberNum" === t2 && (this.maxMemberCount = e3[t2]), "isSupportTopic" !== t2 ? this[t2] = e3[t2] : this.isSupportTopic = 1 === e3[t2]) : this.updateSelfInfo(e3[t2]));
  2102. } }, { key: "updateGroup", value: function(e3) {
  2103. var t2 = this;
  2104. e3.appid = void 0, e3.grossTopicNextMsgSeq = void 0, e3.selfInfo && (e3.selfInfo.grossTopicReadSeq = void 0);
  2105. var n2 = JSON.parse(JSON.stringify(e3));
  2106. n2.lastMsgTime && (this.lastMessage.lastTime = n2.lastMsgTime), at(n2.muteAllMembers) || ("On" === n2.muteAllMembers ? n2.muteAllMembers = true : n2.muteAllMembers = false), n2.groupCustomField && It(this.groupCustomField, n2.groupCustomField), at(n2.memberNum) || (this.memberCount = n2.memberNum), at(n2.maxMemberNum) || (this.maxMemberCount = n2.maxMemberNum), at(n2.isSupportTopic) || (this.isSupportTopic = $e(n2.isSupportTopic) ? 1 === n2.isSupportTopic : n2.isSupportTopic), pt(this, n2, ["members", "errorCode", "lastMsgTime", "groupCustomField", "memberNum", "maxMemberNum", "isSupportTopic"]), st(n2.members) && n2.members.length > 0 && n2.members.forEach(function(e4) {
  2107. e4.userID === t2.selfInfo.userID && pt(t2.selfInfo, e4, ["sequence"]);
  2108. });
  2109. } }, { key: "updateSelfInfo", value: function(e3) {
  2110. var n2 = { nameCard: e3.nameCard, joinTime: e3.joinTime, role: e3.role, messageRemindType: e3.messageRemindType, readedSequence: e3.readedSequence, excludedUnreadSequenceList: e3.excludedUnreadSequenceList };
  2111. pt(this.selfInfo, t({}, n2), [], ["", null, void 0, 0, NaN]);
  2112. } }, { key: "setSelfNameCard", value: function(e3) {
  2113. this.selfInfo.nameCard = e3;
  2114. } }]), e2;
  2115. }(), gr = function(e2, n2) {
  2116. return at(e2) ? { lastTime: 0, lastSequence: 0, fromAccount: 0, messageForShow: "", payload: null, type: "", isRevoked: false, cloudCustomData: "", onlineOnlyFlag: false, nick: "", nameCard: "", version: 0, isPeerRead: false, revoker: null } : e2 instanceof Ha ? { lastTime: e2.time || 0, lastSequence: e2.sequence || 0, fromAccount: e2.from || "", messageForShow: xt(e2.type, e2.payload, n2), payload: e2.payload || null, type: e2.type || null, isRevoked: e2.isRevoked || false, cloudCustomData: e2.cloudCustomData || "", onlineOnlyFlag: e2._onlineOnlyFlag || false, nick: e2.nick || "", nameCard: e2.nameCard || "", version: e2.version || 0, isPeerRead: e2.isPeerRead || false, revoker: e2.revoker || null } : t(t({}, e2), {}, { messageForShow: xt(e2.type, e2.payload, n2) });
  2117. }, _r = function() {
  2118. function e2(t2, n2) {
  2119. o(this, e2), this.conversationID = t2.conversationID || "", this.unreadCount = t2.unreadCount || 0, this.type = t2.type || "", this.lastMessage = gr(t2.lastMessage, n2), t2.lastMsgTime && (this.lastMessage.lastTime = t2.lastMsgTime), this._isInfoCompleted = false, this.peerReadTime = t2.peerReadTime || 0, this.groupAtInfoList = [], this.remark = "", this.isPinned = t2.isPinned || false, this.messageRemindType = "", this.markList = t2.markList || [], this.customData = t2.customData || "", this.conversationGroupList = t2.conversationGroupList || [], this._initProfile(t2);
  2120. }
  2121. return a(e2, [{ key: "toAccount", get: function() {
  2122. return this.conversationID.startsWith(S.CONV_C2C) ? this.conversationID.replace(S.CONV_C2C, "") : this.conversationID.startsWith(S.CONV_GROUP) ? this.conversationID.replace(S.CONV_GROUP, "") : "";
  2123. } }, { key: "subType", get: function() {
  2124. return this.groupProfile ? this.groupProfile.type : "";
  2125. } }, { key: "_initProfile", value: function(e3) {
  2126. var t2 = this;
  2127. Object.keys(e3).forEach(function(n2) {
  2128. switch (n2) {
  2129. case "userProfile":
  2130. t2.userProfile = e3.userProfile;
  2131. break;
  2132. case "groupProfile":
  2133. t2.groupProfile = e3.groupProfile;
  2134. }
  2135. }), at(this.userProfile) && this.type === S.CONV_C2C ? this.userProfile = new ur({ userID: e3.conversationID.replace("C2C", "") }) : at(this.groupProfile) && this.type === S.CONV_GROUP && (this.groupProfile = new dr({ groupID: e3.conversationID.replace("GROUP", "") }));
  2136. } }, { key: "updateUnreadCount", value: function(e3) {
  2137. var t2 = e3.nextUnreadCount, n2 = e3.isFromGetConversations, o2 = e3.isUnreadC2CMessage;
  2138. at(t2) || (Ct(this.subType) ? this.unreadCount = 0 : n2 && this.type === S.CONV_GROUP || n2 && this.type === S.CONV_TOPIC || o2 && this.type === S.CONV_C2C ? this.unreadCount = t2 : this.unreadCount = this.unreadCount + t2);
  2139. } }, { key: "updateLastMessage", value: function(e3) {
  2140. this.lastMessage = gr(e3);
  2141. } }, { key: "updateGroupAtInfoList", value: function(e3) {
  2142. if (!this._isNeedMergeGroupAtInfo(e3)) {
  2143. var t2, n2 = (M(t2 = e3.groupAtType) || y(t2) || I(t2) || T()).slice(0);
  2144. -1 !== n2.indexOf(S.CONV_AT_ME) && -1 !== n2.indexOf(S.CONV_AT_ALL) && (n2 = [S.CONV_AT_ALL_AT_ME]);
  2145. var o2 = { from: e3.from, groupID: e3.groupID, topicID: e3.topicID, messageSequence: e3.sequence, atTypeArray: n2, __random: e3.__random, __sequence: e3.__sequence };
  2146. this.groupAtInfoList.push(o2);
  2147. }
  2148. } }, { key: "_isNeedMergeGroupAtInfo", value: function(e3) {
  2149. var t2 = e3.groupID, n2 = e3.sequence;
  2150. if (!Tt({ groupID: t2 }))
  2151. return false;
  2152. var o2 = false;
  2153. return this.groupAtInfoList.forEach(function(t3) {
  2154. t3.messageSequence === n2 && (t3.atTypeArray.indexOf(S.CONV_AT_ME) > -1 && e3.groupAtType.indexOf(S.CONV_AT_ALL) > -1 && (t3.atTypeArray = [S.CONV_AT_ALL_AT_ME]), t3.atTypeArray.indexOf(S.CONV_AT_ALL) > -1 && e3.groupAtType.indexOf(S.CONV_AT_ME) > -1 && (t3.atTypeArray = [S.CONV_AT_ALL_AT_ME], t3.__random = e3.__random, t3.__sequence = e3.__sequence), o2 = true);
  2155. }), o2;
  2156. } }, { key: "clearGroupAtInfoList", value: function() {
  2157. this.groupAtInfoList.length = 0;
  2158. } }, { key: "reduceUnreadCount", value: function() {
  2159. return this.unreadCount >= 1 && (this.unreadCount -= 1, true);
  2160. } }, { key: "isLastMessageRevoked", value: function(e3) {
  2161. var t2 = e3.sequence, n2 = e3.time;
  2162. return this.type === S.CONV_C2C && t2 === this.lastMessage.lastSequence && n2 === this.lastMessage.lastTime || this.type === S.CONV_GROUP && t2 === this.lastMessage.lastSequence;
  2163. } }, { key: "setLastMessageRevoked", value: function(e3) {
  2164. this.lastMessage.isRevoked = e3;
  2165. } }, { key: "setLastMessageRevoker", value: function(e3) {
  2166. this.lastMessage.revoker = e3;
  2167. } }]), e2;
  2168. }(), hr = function() {
  2169. function e2(t2) {
  2170. o(this, e2), this._conversationModule = t2, this._n = "MessageRemindHandler", this._updateSequence = 0;
  2171. }
  2172. return a(e2, [{ key: "getC2CMessageRemindType", value: function() {
  2173. var e3 = this, t2 = "".concat(this._n, ".getC2CMessageRemindType");
  2174. return this._conversationModule.request({ protocolName: Do, updateSequence: this._updateSequence }).then(function(n2) {
  2175. xe.l("".concat(t2, " ok"));
  2176. var o2 = n2.data, s2 = o2.updateSequence, a2 = o2.muteFlagList;
  2177. e3._updateSequence = s2, e3._patchC2CMessageRemindType(a2);
  2178. }).catch(function(e4) {
  2179. xe.e("".concat(t2, " failed. error:"), e4);
  2180. });
  2181. } }, { key: "_patchC2CMessageRemindType", value: function(e3) {
  2182. var t2 = this, n2 = 0, o2 = "";
  2183. st(e3) && e3.length > 0 && e3.forEach(function(e4) {
  2184. var s2 = e4.userID, a2 = e4.muteFlag;
  2185. 0 === a2 ? o2 = S.MSG_REMIND_ACPT_AND_NOTE : 1 === a2 ? o2 = S.MSG_REMIND_DISCARD : 2 === a2 && (o2 = S.MSG_REMIND_ACPT_NOT_NOTE), true === t2._conversationModule.patchMessageRemindType({ ID: s2, isC2CConversation: true, messageRemindType: o2 }) && (n2 += 1);
  2186. }), xe.l("".concat(this._n, "._patchC2CMessageRemindType count:").concat(n2));
  2187. } }, { key: "set", value: function(e3) {
  2188. return e3.groupID ? this._setGroupMessageRemindType(e3) : st(e3.userIDList) ? this._setC2CMessageRemindType(e3) : void 0;
  2189. } }, { key: "_setGroupMessageRemindType", value: function(e3) {
  2190. var t2 = this, n2 = "".concat(this._n, "._setGroupMessageRemindType"), o2 = e3.groupID, s2 = e3.messageRemindType, a2 = "groupID:".concat(o2, " messageRemindType:").concat(s2), r2 = new ka("setMessageRemindType");
  2191. return r2.setMessage(a2), this._getModule(bn).modifyGroupMemberInfo({ groupID: o2, messageRemindType: s2, userID: this._conversationModule.getMyUserID() }).then(function() {
  2192. r2.setNetworkType(t2._conversationModule.getNetworkType()).end(), xe.l("".concat(n2, " ok. ").concat(a2));
  2193. var o3 = t2.onGroupMessageRemindTypeUpdated(e3);
  2194. return t2._conversationModule.emitTotalUnreadMessageCountUpdate(), Ka(o3);
  2195. }).catch(function(e4) {
  2196. return t2._conversationModule.probeNetwork().then(function(t3) {
  2197. var n3 = v(t3, 2), o3 = n3[0], s3 = n3[1];
  2198. r2.setError(e4, o3, s3).end();
  2199. }), xe.e("".concat(n2, " failed. error:"), e4), Ja(e4);
  2200. });
  2201. } }, { key: "onGroupMessageRemindTypeUpdated", value: function(e3) {
  2202. var t2 = e3.groupID, n2 = e3.messageRemindType, o2 = this._getModule(Un).getLocalGroupProfile(t2);
  2203. if (o2 && (o2.selfInfo.messageRemindType = n2), Dt(t2)) {
  2204. var s2 = t2, a2 = qt(s2), r2 = this._getModule(wn).getLocalTopic(a2, s2);
  2205. return r2 && (r2.updateSelfInfo({ messageRemindType: n2 }), this._conversationModule.emitOuterEvent(E.TOPIC_UPDATED, { groupID: a2, topic: r2 })), { topic: r2 };
  2206. }
  2207. return this._conversationModule.patchMessageRemindType({ ID: t2, isC2CConversation: false, messageRemindType: n2 }) && this._emitConversationUpdate(), { group: o2 };
  2208. } }, { key: "_setC2CMessageRemindType", value: function(e3) {
  2209. var t2 = this, n2 = "".concat(this._n, "._setC2CMessageRemindType"), o2 = e3.userIDList, s2 = e3.messageRemindType, a2 = o2.slice(0, 30), r2 = 0;
  2210. s2 === S.MSG_REMIND_DISCARD ? r2 = 1 : s2 === S.MSG_REMIND_ACPT_NOT_NOTE && (r2 = 2);
  2211. var i2 = "userIDList:".concat(a2, " messageRemindType:").concat(s2), u2 = new ka("setMessageRemindType");
  2212. return u2.setMessage(i2), this._conversationModule.request({ protocolName: To, requestData: { userIDList: a2, muteFlag: r2 } }).then(function(e4) {
  2213. u2.setNetworkType(t2._conversationModule.getNetworkType()).end();
  2214. var o3 = e4.data, r3 = o3.updateSequence, i3 = o3.errorList;
  2215. t2._updateSequence = r3;
  2216. var c2 = [], l2 = [];
  2217. st(i3) && i3.forEach(function(e5) {
  2218. c2.push(e5.userID), l2.push({ userID: e5.userID, code: e5.errorCode });
  2219. });
  2220. var p2 = a2.filter(function(e5) {
  2221. return -1 === c2.indexOf(e5);
  2222. });
  2223. xe.l("".concat(n2, " ok. successUserIDList:").concat(p2, " failureUserIDList:").concat(JSON.stringify(l2)));
  2224. var d2 = 0;
  2225. return p2.forEach(function(e5) {
  2226. t2._conversationModule.patchMessageRemindType({ ID: e5, isC2CConversation: true, messageRemindType: s2 }) && (d2 += 1);
  2227. }), d2 >= 1 && t2._emitConversationUpdate(), a2.length = c2.length = 0, t2._conversationModule.emitTotalUnreadMessageCountUpdate(), za({ successUserIDList: p2.map(function(e5) {
  2228. return { userID: e5 };
  2229. }), failureUserIDList: l2 });
  2230. }).catch(function(e4) {
  2231. return t2._conversationModule.probeNetwork().then(function(t3) {
  2232. var n3 = v(t3, 2), o3 = n3[0], s3 = n3[1];
  2233. u2.setError(e4, o3, s3).end();
  2234. }), xe.e("".concat(n2, " failed. error:"), e4), Ja(e4);
  2235. });
  2236. } }, { key: "_getModule", value: function(e3) {
  2237. return this._conversationModule.getModule(e3);
  2238. } }, { key: "_emitConversationUpdate", value: function() {
  2239. this._conversationModule.emitConversationUpdate(true, false);
  2240. } }, { key: "setUpdateSequence", value: function(e3) {
  2241. this._updateSequence = e3;
  2242. } }, { key: "reset", value: function() {
  2243. xe.l("".concat(this._n, ".reset")), this._updateSequence = 0;
  2244. } }]), e2;
  2245. }(), fr = function() {
  2246. function e2(t2) {
  2247. o(this, e2), this._conversationModule = t2, this._n = "ConvGroupHandler", this._convGroupMap = /* @__PURE__ */ new Map(), this._startIndex = 0, this._pagingStatus = Zt.NOT_START;
  2248. }
  2249. return a(e2, [{ key: "setConvCustomData", value: function(e3) {
  2250. var t2 = this, n2 = "".concat(this._n, ".").concat("setConvCustomData"), o2 = e3.conversationIDList, s2 = e3.customData;
  2251. xe.l("".concat(n2, " options:"), e3);
  2252. var a2 = new ka("setConvCustomData");
  2253. a2.setMessage(JSON.stringify(e3));
  2254. var r2 = { fromAccount: this._getMyUserID(), itemList: [] }, i2 = [], u2 = [];
  2255. return o2.forEach(function(e4) {
  2256. if (!t2._hasLocalConversation(e4))
  2257. return t2._onConversationNotFound(u2, e4), true;
  2258. if (!Et(e4) && !St(e4))
  2259. return t2._onConversationIDInvalid(u2, e4), true;
  2260. var n3 = { operationType: 2, contactItem: void 0, customMark: s2 };
  2261. Et(e4) ? n3.contactItem = { type: 1, toAccount: e4.replace(S.CONV_C2C, "") } : St(e4) && (n3.contactItem = { type: 2, groupID: e4.replace(S.CONV_GROUP, "") }), r2.itemList.push(n3);
  2262. }), u2.length === o2.length ? za({ successConversationIDList: i2, failureConversationIDList: u2 }) : this._conversationModule.request({ protocolName: wo, requestData: r2 }).then(function(e4) {
  2263. a2.setNetworkType(t2._conversationModule.getNetworkType()).end(), xe.l("".concat(n2, " ok"));
  2264. var o3 = e4.data.resultItem;
  2265. if (st(o3)) {
  2266. var r3, c2, l2 = false;
  2267. o3.forEach(function(e5) {
  2268. r3 = t2._concatConversationID(e5.contactItem), 0 === e5.resultCode ? (i2.push(r3), (c2 = t2._getLocalConversation(r3)) && c2.customData !== s2 && (c2.customData = s2, l2 = true)) : u2.push({ conversationID: r3, code: e5.resultCode, message: e5.resultInfo });
  2269. }), true === l2 && t2._emitConversationUpdate();
  2270. }
  2271. return Ka({ successConversationIDList: i2, failureConversationIDList: u2 });
  2272. }).catch(function(e4) {
  2273. return t2._conversationModule.probeNetwork().then(function(t3) {
  2274. var n3 = v(t3, 2), o3 = n3[0], s3 = n3[1];
  2275. a2.setError(e4, o3, s3).end();
  2276. }), xe.e("".concat(n2, " failed. error:"), e4), Ja(e4);
  2277. });
  2278. } }, { key: "markConversation", value: function(e3) {
  2279. var t2 = this;
  2280. if (!this._conversationModule.canIUse(B.CONV_MARK))
  2281. return Ja({ code: da.CANNOT_USE_COMMERCIAL_ABILITY });
  2282. var n2 = "".concat(this._n, ".").concat("markConversation"), o2 = e3.conversationIDList, s2 = e3.markType, a2 = e3.enableMark;
  2283. xe.l("".concat(n2, " options:"), e3);
  2284. var r2 = new ka("markConversation");
  2285. r2.setMessage(JSON.stringify(e3));
  2286. var i2 = void 0, u2 = void 0, c2 = this._getFlagBit(s2);
  2287. true === a2 ? u2 = [c2] : i2 = [c2];
  2288. var l2 = { fromAccount: this._getMyUserID(), itemList: [] }, p2 = [], d2 = [];
  2289. return o2.forEach(function(e4) {
  2290. if (!t2._hasLocalConversation(e4))
  2291. return t2._onConversationNotFound(d2, e4), true;
  2292. if (!Et(e4) && !St(e4))
  2293. return t2._onConversationIDInvalid(d2, e4), true;
  2294. var n3 = { operationType: 1, contactItem: void 0, clearMark: i2, setMark: u2 };
  2295. Et(e4) ? n3.contactItem = { type: 1, toAccount: e4.replace(S.CONV_C2C, "") } : St(e4) && (n3.contactItem = { type: 2, groupID: e4.replace(S.CONV_GROUP, "") }), l2.itemList.push(n3);
  2296. }), d2.length === o2.length ? za({ successConversationIDList: p2, failureConversationIDList: d2 }) : this._conversationModule.request({ protocolName: Fo, requestData: l2 }).then(function(e4) {
  2297. r2.setNetworkType(t2._conversationModule.getNetworkType()).end(), xe.l("".concat(n2, " ok"));
  2298. var o3 = e4.data.resultItem;
  2299. if (st(o3)) {
  2300. var i3, u3, c3 = false;
  2301. o3.forEach(function(e5) {
  2302. if (i3 = t2._concatConversationID(e5.contactItem), 0 === e5.resultCode) {
  2303. if (p2.push(i3), u3 = t2._getLocalConversation(i3)) {
  2304. var n3 = u3.markList.indexOf(s2);
  2305. true === a2 ? -1 === n3 && (u3.markList.push(s2), c3 = true) : -1 !== n3 && (u3.markList.splice(n3, 1), c3 = true);
  2306. }
  2307. } else
  2308. d2.push({ conversationID: i3, code: e5.resultCode, message: e5.resultInfo });
  2309. }), true === c3 && t2._emitConversationUpdate();
  2310. }
  2311. return Ka({ successConversationIDList: p2, failureConversationIDList: d2 });
  2312. }).catch(function(e4) {
  2313. return t2._conversationModule.probeNetwork().then(function(t3) {
  2314. var n3 = v(t3, 2), o3 = n3[0], s3 = n3[1];
  2315. r2.setError(e4, o3, s3).end();
  2316. }), xe.e("".concat(n2, " failed. error:"), e4), Ja(e4);
  2317. });
  2318. } }, { key: "getLocalConvGroupList", value: function() {
  2319. var e3 = this;
  2320. return xe.l("".concat(this._n, ".getLocalConvGroupList pagingStatus:").concat(this._pagingStatus)), this._pagingStatus === Zt.REJECTED ? this.getRemoteConvGroupList().then(function() {
  2321. return Ka(m(e3._convGroupMap.values()));
  2322. }) : za(m(this._convGroupMap.values()));
  2323. } }, { key: "getRemoteConvGroupList", value: function() {
  2324. var e3 = this, t2 = "".concat(this._n, ".getRemoteConvGroupList");
  2325. return this._pagingStatus = Zt.PENDING, this._conversationModule.request({ protocolName: Ko, requestData: { fromAccount: this._getMyUserID(), startIndex: this._startIndex, startTime: be() } }).then(function(n2) {
  2326. var o2, s2, a2 = n2.data, r2 = a2.completeFlag, i2 = a2.contactItem, u2 = a2.nextStartIndex, c2 = void 0 === u2 ? 0 : u2, l2 = a2.groupItem;
  2327. (e3._startIndex = c2, xe.l("".concat(t2, " completeFlag:").concat(r2, " nextStartIndex:").concat(c2)), st(l2) && l2.forEach(function(t3) {
  2328. var n3 = t3.convGroupID, o3 = t3.groupName;
  2329. e3._convGroupMap.set(n3, o3);
  2330. }), st(i2)) && i2.forEach(function(t3) {
  2331. var n3 = t3.standardMark, a3 = t3.customData, r3 = t3.convGroupIDList;
  2332. if (o2 = e3._concatConversationID(t3), (s2 = e3._getLocalConversation(o2)) && (s2.markList = Bt(n3), s2.customData = a3 || "", st(r3))) {
  2333. var i3 = [];
  2334. r3.forEach(function(t4) {
  2335. e3._convGroupMap.has(t4) && i3.push(e3._convGroupMap.get(t4));
  2336. }), s2.conversationGroupList = [].concat(i3), i3.length = 0;
  2337. }
  2338. });
  2339. if (0 === r2)
  2340. return e3.getRemoteConvGroupList();
  2341. 1 === r2 && (e3._pagingStatus = Zt.RESOLVED, e3._emitConversationUpdate(), e3._emitConvGroupListUpdate());
  2342. }).catch(function(n2) {
  2343. e3._pagingStatus = Zt.REJECTED, xe.w("".concat(t2, " failed. error:"), n2);
  2344. });
  2345. } }, { key: "createConvGroup", value: function(e3) {
  2346. var t2 = this;
  2347. if (!this._conversationModule.canIUse(B.CONV_GROUP))
  2348. return Ja({ code: da.CANNOT_USE_COMMERCIAL_ABILITY });
  2349. var n2 = "".concat(this._n, ".").concat("createConvGroup");
  2350. xe.l("".concat(n2, " options:"), e3);
  2351. var o2 = new ka("createConvGroup");
  2352. o2.setMessage(JSON.stringify(e3));
  2353. var s2 = e3.groupName, a2 = e3.conversationIDList, r2 = { fromAccount: this._getMyUserID(), itemList: [{ groupName: s2, contactItem: [] }] }, i2 = [], u2 = [];
  2354. return a2.forEach(function(e4) {
  2355. return t2._hasLocalConversation(e4) ? Et(e4) || St(e4) ? void (Et(e4) ? r2.itemList[0].contactItem.push({ type: 1, toAccount: e4.replace(S.CONV_C2C, "") }) : St(e4) && r2.itemList[0].contactItem.push({ type: 2, groupID: e4.replace(S.CONV_GROUP, "") })) : (t2._onConversationIDInvalid(u2, e4), true) : (t2._onConversationNotFound(u2, e4), true);
  2356. }), u2.length === a2.length ? za({ successConversationIDList: i2, failureConversationIDList: u2 }) : this._conversationModule.request({ protocolName: qo, requestData: r2 }).then(function(e4) {
  2357. o2.setNetworkType(t2._conversationModule.getNetworkType()).end(), xe.l("".concat(n2, " ok"));
  2358. var a3 = e4.data.groupResultItem[0], r3 = a3.groupItem, c2 = a3.resultItem;
  2359. if (ot(r3) && (t2._convGroupMap.set(r3.convGroupID, r3.groupName), t2._emitConvGroupListUpdate()), st(c2)) {
  2360. var l2, p2, d2 = false;
  2361. c2.forEach(function(e5) {
  2362. l2 = t2._concatConversationID(e5.contactItem), 0 === e5.resultCode ? (i2.push(l2), (p2 = t2._getLocalConversation(l2)) && -1 === p2.conversationGroupList.indexOf(s2) && (p2.conversationGroupList.push(s2), d2 = true)) : u2.push({ conversationID: l2, code: e5.resultCode, message: e5.resultInfo });
  2363. }), true === d2 && (t2._emitConversationUpdate(), t2._emitConvGroupListUpdate());
  2364. }
  2365. return Ka({ successConversationIDList: i2, failureConversationIDList: u2 });
  2366. }).catch(function(e4) {
  2367. return t2._conversationModule.probeNetwork().then(function(t3) {
  2368. var n3 = v(t3, 2), s3 = n3[0], a3 = n3[1];
  2369. o2.setError(e4, s3, a3).end();
  2370. }), xe.e("".concat(n2, " failed. error:"), e4), Ja(e4);
  2371. });
  2372. } }, { key: "deleteConvGroup", value: function(e3) {
  2373. var t2 = this;
  2374. if (!this._conversationModule.canIUse(B.CONV_GROUP))
  2375. return Ja({ code: da.CANNOT_USE_COMMERCIAL_ABILITY });
  2376. var n2 = "".concat(this._n, ".").concat("deleteConvGroup");
  2377. xe.l("".concat(n2, " groupName:").concat(e3));
  2378. var o2 = new ka("deleteConvGroup");
  2379. return o2.setMessage(e3), this._conversationModule.request({ protocolName: xo, requestData: { fromAccount: this._getMyUserID(), groupName: [e3] } }).then(function(s2) {
  2380. o2.setNetworkType(t2._conversationModule.getNetworkType()).end(), xe.l("".concat(n2, " ok"));
  2381. var a2 = s2.data.groupItem;
  2382. if (st(a2)) {
  2383. var r2 = false;
  2384. a2.forEach(function(e4) {
  2385. t2._convGroupMap.has(e4.convGroupID) && (t2._convGroupMap.delete(e4.convGroupID), r2 = true);
  2386. }), true === r2 && t2._emitConvGroupListUpdate();
  2387. }
  2388. t2._eraseFromConversationGroupList([e3]);
  2389. }).catch(function(e4) {
  2390. return t2._conversationModule.probeNetwork().then(function(t3) {
  2391. var n3 = v(t3, 2), s2 = n3[0], a2 = n3[1];
  2392. o2.setError(e4, s2, a2).end();
  2393. }), xe.e("".concat(n2, " failed. error:"), e4), Ja(e4);
  2394. });
  2395. } }, { key: "renameConvGroup", value: function(e3) {
  2396. var t2 = this;
  2397. if (!this._conversationModule.canIUse(B.CONV_GROUP))
  2398. return Ja({ code: da.CANNOT_USE_COMMERCIAL_ABILITY });
  2399. var n2 = "".concat(this._n, ".").concat("renameConvGroup");
  2400. xe.l("".concat(n2, " options:"), e3);
  2401. var o2 = new ka("renameConvGroup");
  2402. o2.setMessage(JSON.stringify(e3));
  2403. var s2 = e3.oldName, a2 = e3.newName;
  2404. return this._conversationModule.request({ protocolName: Vo, requestData: { fromAccount: this._getMyUserID(), updateType: 1, updateGroup: { updateGroupType: 1, oldName: s2, newName: a2 } } }).then(function(e4) {
  2405. o2.setNetworkType(t2._conversationModule.getNetworkType()).end(), xe.l("".concat(n2, " ok"));
  2406. var r2 = e4.data.updateGroupResult.convGroupID;
  2407. t2._convGroupMap.set(r2, a2), t2._emitConvGroupListUpdate();
  2408. var i2, u2, c2 = t2._conversationModule.getLocalConversationList(), l2 = false;
  2409. c2.forEach(function(e5) {
  2410. i2 = e5.conversationGroupList, -1 !== (u2 = i2.indexOf(s2)) && (i2.splice(u2, 1, a2), l2 = true);
  2411. }), true === l2 && t2._emitConversationUpdate();
  2412. }).catch(function(e4) {
  2413. return t2._conversationModule.probeNetwork().then(function(t3) {
  2414. var n3 = v(t3, 2), s3 = n3[0], a3 = n3[1];
  2415. o2.setError(e4, s3, a3).end();
  2416. }), xe.e("".concat(n2, " failed. error:"), e4), Ja(e4);
  2417. });
  2418. } }, { key: "addConvsToGroup", value: function(e3) {
  2419. var t2 = this;
  2420. if (!this._conversationModule.canIUse(B.CONV_GROUP))
  2421. return Ja({ code: da.CANNOT_USE_COMMERCIAL_ABILITY });
  2422. var n2 = "".concat(this._n, ".").concat("addConvsToGroup");
  2423. xe.l("".concat(n2, " options:"), e3);
  2424. var o2 = new ka("addConvsToGroup");
  2425. o2.setMessage(JSON.stringify(e3));
  2426. var s2 = e3.conversationIDList, a2 = e3.groupName, r2 = { fromAccount: this._getMyUserID(), updateType: 1, updateGroup: { updateGroupType: 2, groupName: a2, updateItem: [] } }, i2 = [], u2 = [];
  2427. return s2.forEach(function(e4) {
  2428. return t2._hasLocalConversation(e4) ? Et(e4) || St(e4) ? void (Et(e4) ? r2.updateGroup.updateItem.push({ operationType: 1, contactItem: { type: 1, toAccount: e4.replace(S.CONV_C2C, "") } }) : St(e4) && r2.updateGroup.updateItem.push({ operationType: 1, contactItem: { type: 2, groupID: e4.replace(S.CONV_GROUP, "") } })) : (t2._onConversationIDInvalid(u2, e4), true) : (t2._onConversationNotFound(u2, e4), true);
  2429. }), u2.length === s2.length ? za({ successConversationIDList: i2, failureConversationIDList: u2 }) : this._conversationModule.request({ protocolName: Bo, requestData: r2 }).then(function(e4) {
  2430. o2.setNetworkType(t2._conversationModule.getNetworkType()).end(), xe.l("".concat(n2, " ok"));
  2431. var s3 = e4.data.updateGroupResult.contactResultItem;
  2432. if (st(s3)) {
  2433. var r3, c2, l2 = false;
  2434. s3.forEach(function(e5) {
  2435. r3 = t2._concatConversationID(e5.contactItem), 0 === e5.resultCode ? (c2 = t2._getLocalConversation(r3)) && -1 === c2.conversationGroupList.indexOf(a2) && (c2.conversationGroupList.push(a2), i2.push(r3), l2 = true) : u2.push({ conversationID: r3, code: e5.resultCode, message: e5.resultInfo });
  2436. }), true === l2 && (t2._emitConversationUpdate(), t2._emitConvInGroupUpdate(a2));
  2437. }
  2438. return Ka({ successConversationIDList: i2, failureConversationIDList: u2 });
  2439. }).catch(function(e4) {
  2440. return t2._conversationModule.probeNetwork().then(function(t3) {
  2441. var n3 = v(t3, 2), s3 = n3[0], a3 = n3[1];
  2442. o2.setError(e4, s3, a3).end();
  2443. }), xe.e("".concat(n2, " failed. error:"), e4), Ja(e4);
  2444. });
  2445. } }, { key: "deleteConvsFromGroup", value: function(e3) {
  2446. var t2 = this;
  2447. if (!this._conversationModule.canIUse(B.CONV_GROUP))
  2448. return Ja({ code: da.CANNOT_USE_COMMERCIAL_ABILITY });
  2449. var n2 = "".concat(this._n, ".").concat("deleteConvsFromGroup");
  2450. xe.l("".concat(n2, " options:"), e3);
  2451. var o2 = new ka("deleteConvsFromGroup");
  2452. o2.setMessage(JSON.stringify(e3));
  2453. var s2 = e3.conversationIDList, a2 = e3.groupName, r2 = { fromAccount: this._getMyUserID(), updateType: 1, updateGroup: { updateGroupType: 2, groupName: a2, updateItem: [] } }, i2 = [], u2 = [];
  2454. return s2.forEach(function(e4) {
  2455. return t2._hasLocalConversation(e4) ? Et(e4) || St(e4) ? void (Et(e4) ? r2.updateGroup.updateItem.push({ operationType: 2, contactItem: { type: 1, toAccount: e4.replace(S.CONV_C2C, "") } }) : St(e4) && r2.updateGroup.updateItem.push({ operationType: 2, contactItem: { type: 2, groupID: e4.replace(S.CONV_GROUP, "") } })) : (t2._onConversationIDInvalid(u2, e4), true) : (t2._onConversationNotFound(u2, e4), true);
  2456. }), u2.length === s2.length ? za({ successConversationIDList: i2, failureConversationIDList: u2 }) : this._conversationModule.request({ protocolName: Ho, requestData: r2 }).then(function(e4) {
  2457. o2.setNetworkType(t2._conversationModule.getNetworkType()).end(), xe.l("".concat(n2, " ok"));
  2458. var s3 = e4.data.updateGroupResult.contactResultItem;
  2459. if (st(s3)) {
  2460. var r3, c2, l2 = false;
  2461. s3.forEach(function(e5) {
  2462. if (r3 = t2._concatConversationID(e5.contactItem), 0 === e5.resultCode) {
  2463. if (c2 = t2._getLocalConversation(r3)) {
  2464. var n3 = c2.conversationGroupList.indexOf(a2);
  2465. -1 !== n3 && (c2.conversationGroupList.splice(n3, 1), i2.push(r3), l2 = true);
  2466. }
  2467. } else
  2468. u2.push({ conversationID: r3, code: e5.resultCode, message: e5.resultInfo });
  2469. }), true === l2 && (t2._emitConversationUpdate(), t2._emitConvInGroupUpdate(a2));
  2470. }
  2471. return Ka({ successConversationIDList: i2, failureConversationIDList: u2 });
  2472. }).catch(function(e4) {
  2473. return t2._conversationModule.probeNetwork().then(function(t3) {
  2474. var n3 = v(t3, 2), s3 = n3[0], a3 = n3[1];
  2475. o2.setError(e4, s3, a3).end();
  2476. }), xe.e("".concat(n2, " failed. error:"), e4), Ja(e4);
  2477. });
  2478. } }, { key: "onConvMarkUpdated", value: function(e3) {
  2479. var t2 = this;
  2480. if (!jt(e3)) {
  2481. var n2, o2;
  2482. xe.d("".concat(this._n, ".onConvMarkUpdated markItemList:"), e3);
  2483. var s2 = false;
  2484. e3.forEach(function(e4) {
  2485. var a2 = e4.recentContactItem, r2 = e4.optType, i2 = e4.standardMark, u2 = e4.customMark;
  2486. if (n2 = t2._concatConversationID(a2), o2 = t2._getLocalConversation(n2))
  2487. if (1 === r2) {
  2488. var c2 = Bt(i2);
  2489. true !== function(e5, t3) {
  2490. if (e5 === t3)
  2491. return true;
  2492. if (!e5 || !t3)
  2493. return false;
  2494. if (e5.length !== t3.length)
  2495. return false;
  2496. for (var n3 = 0, o3 = e5.length; n3 < o3; n3++)
  2497. if (e5[n3] !== t3[n3])
  2498. return false;
  2499. return true;
  2500. }(o2.markList, c2) && (o2.markList = c2, s2 = true);
  2501. } else
  2502. 2 === r2 && o2.customData !== u2 && void 0 !== u2 && (o2.customData = u2, s2 = true);
  2503. }), true === s2 && this._emitConversationUpdate();
  2504. }
  2505. } }, { key: "onConvGroupCreated", value: function(e3) {
  2506. var t2 = this;
  2507. xe.d("".concat(this._n, ".onConvGroupCreated resultList:"), e3);
  2508. var n2 = false, o2 = false;
  2509. st(e3) && (e3.forEach(function(e4) {
  2510. var s2 = e4.msgGroupItem, a2 = s2.groupID, r2 = s2.groupName;
  2511. t2._convGroupMap.get(a2) !== r2 && (t2._convGroupMap.set(a2, r2), o2 = true);
  2512. var i2, u2, c2 = e4.msgRecentContactItem;
  2513. st(c2) && c2.forEach(function(e5) {
  2514. i2 = t2._concatConversationID(e5), (u2 = t2._getLocalConversation(i2)) && -1 === u2.conversationGroupList.indexOf(r2) && (u2.conversationGroupList.push(r2), n2 = true);
  2515. });
  2516. }), true === n2 && this._emitConversationUpdate(), true === o2 && this._emitConvGroupListUpdate());
  2517. } }, { key: "onConvGroupDeleted", value: function(e3) {
  2518. var t2 = this;
  2519. xe.d("".concat(this._n, ".onConvGroupDeleted groupItemList:"), e3);
  2520. var n2 = [];
  2521. if (st(e3)) {
  2522. var o2 = false;
  2523. e3.forEach(function(e4) {
  2524. var s2 = e4.groupID, a2 = e4.groupName;
  2525. t2._convGroupMap.has(s2) && (t2._convGroupMap.delete(s2), o2 = true, n2.push(a2));
  2526. }), true === o2 && this._emitConvGroupListUpdate();
  2527. }
  2528. this._eraseFromConversationGroupList(n2);
  2529. } }, { key: "_eraseFromConversationGroupList", value: function(e3) {
  2530. jt(e3) || (this._conversationModule.getLocalConversationList().forEach(function(t2) {
  2531. t2.conversationGroupList = t2.conversationGroupList.filter(function(t3) {
  2532. return !e3.includes(t3);
  2533. });
  2534. }), this._emitConversationUpdate());
  2535. } }, { key: "onConvGroupNameUpdated", value: function(e3) {
  2536. xe.d("".concat(this._n, ".onConvGroupNameUpdated options:"), e3);
  2537. var t2 = e3.groupID, n2 = e3.groupName, o2 = e3.oldGroupName;
  2538. if (this._convGroupMap.get(t2) !== n2) {
  2539. this._convGroupMap.set(t2, n2), this._emitConvGroupListUpdate();
  2540. var s2, a2, r2 = this._conversationModule.getLocalConversationList(), i2 = false;
  2541. r2.forEach(function(e4) {
  2542. s2 = e4.conversationGroupList, -1 !== (a2 = s2.indexOf(o2)) && (s2.splice(a2, 1, n2), i2 = true);
  2543. }), true === i2 && this._emitConversationUpdate();
  2544. }
  2545. } }, { key: "onConvInGroupUpdated", value: function(e3) {
  2546. var t2 = this;
  2547. xe.d("".concat(this._n, ".onConvInGroupUpdated options:"), e3);
  2548. var n2 = e3.oldGroupName, o2 = e3.recentContactUpdateGroupItem;
  2549. if (st(o2)) {
  2550. var s2, a2, r2, i2 = false;
  2551. o2.forEach(function(e4) {
  2552. var o3 = e4.contactOptType, u2 = e4.recentContactItem;
  2553. s2 = t2._concatConversationID(u2), (a2 = t2._getLocalConversation(s2)) && (r2 = a2.conversationGroupList.indexOf(n2), 1 === o3 ? -1 === r2 && (a2.conversationGroupList.push(n2), i2 = true) : 2 === o3 && -1 !== r2 && (a2.conversationGroupList.splice(r2, 1), i2 = true));
  2554. }), true === i2 && (this._emitConversationUpdate(), this._emitConvInGroupUpdate(n2));
  2555. }
  2556. } }, { key: "onConvAddedToOrDeletedFromGroup", value: function(e3) {
  2557. var t2 = this;
  2558. xe.d("".concat(this._n, ".onConvAddedToOrDeletedFromGroup options:"), e3);
  2559. var n2 = e3.msgRecentContactItem, o2 = e3.msgRecentContactUpdateContactItem, s2 = this._concatConversationID(n2), a2 = this._getLocalConversation(s2);
  2560. if (a2 && st(o2)) {
  2561. var r2, i2 = false;
  2562. o2.forEach(function(e4) {
  2563. var n3 = e4.groupOptType, o3 = e4.recentContactGroupItem.groupName;
  2564. r2 = a2.conversationGroupList.indexOf(o3), 1 === n3 ? -1 === r2 && (a2.conversationGroupList.push(o3), i2 = true) : 2 === n3 && -1 !== r2 && (a2.conversationGroupList.splice(r2, 1), i2 = true), true === i2 && t2._emitConvInGroupUpdate(o3);
  2565. }), true === i2 && this._emitConversationUpdate();
  2566. }
  2567. } }, { key: "onConvGroupListSynced", value: function(e3) {
  2568. var t2 = this;
  2569. st(e3) && 0 !== e3.length && (xe.l("".concat(this._n, ".onConvGroupListSynced groupItemList:"), e3), e3.forEach(function(e4) {
  2570. t2._convGroupMap.set(e4.convGroupID, e4.groupName);
  2571. }));
  2572. } }, { key: "getConvGroupListByID", value: function(e3) {
  2573. var t2 = this;
  2574. if (!jt(e3)) {
  2575. var n2 = [];
  2576. return e3.forEach(function(e4) {
  2577. t2._convGroupMap.has(e4) && n2.push(t2._convGroupMap.get(e4));
  2578. }), n2;
  2579. }
  2580. } }, { key: "_onConversationNotFound", value: function(e3, t2) {
  2581. e3.push({ conversationID: t2, code: da.CONVERSATION_NOT_FOUND, message: this._conversationModule.getErrorMessage(da.CONVERSATION_NOT_FOUND) });
  2582. } }, { key: "_onConversationIDInvalid", value: function(e3, t2) {
  2583. e3.push({ conversationID: t2, code: da.INVALID_CONVERSATION_ID, message: this._conversationModule.getErrorMessage(da.INVALID_CONVERSATION_ID) });
  2584. } }, { key: "_getFlagBit", value: function(e3) {
  2585. for (var t2 = e3.toString(2), n2 = t2.length, o2 = n2 - 1; o2 >= 0; o2--)
  2586. if ("1" === t2[o2])
  2587. return n2 - o2 - 1;
  2588. } }, { key: "_concatConversationID", value: function(e3) {
  2589. var t2, n2 = e3.type, o2 = e3.to, s2 = e3.groupID, a2 = e3.userID;
  2590. return 1 === n2 ? at(a2) ? at(o2) || (t2 = "".concat(S.CONV_C2C).concat(o2)) : t2 = "".concat(S.CONV_C2C).concat(a2) : 2 === n2 && (t2 = "".concat(S.CONV_GROUP).concat(s2)), t2;
  2591. } }, { key: "_getMyUserID", value: function() {
  2592. return this._conversationModule.getMyUserID();
  2593. } }, { key: "_insertConversationGroup", value: function(e3, t2) {
  2594. var n2 = this._getLocalConversation(e3);
  2595. if (n2) {
  2596. var o2 = n2.conversationGroupList;
  2597. -1 === o2.indexOf(t2) && o2.push(t2);
  2598. }
  2599. } }, { key: "_getLocalConversation", value: function(e3) {
  2600. return this._conversationModule.getLocalConversation(e3);
  2601. } }, { key: "_hasLocalConversation", value: function(e3) {
  2602. return this._conversationModule.hasLocalConversation(e3);
  2603. } }, { key: "_emitConversationUpdate", value: function() {
  2604. this._conversationModule.emitConversationUpdate(true, false);
  2605. } }, { key: "_emitConvGroupListUpdate", value: function() {
  2606. this._conversationModule.emitOuterEvent(E.CONVERSATION_GROUP_LIST_UPDATED, m(this._convGroupMap.values()));
  2607. } }, { key: "_emitConvInGroupUpdate", value: function(e3) {
  2608. var t2 = { groupName: e3, conversationList: [] }, n2 = this._conversationModule.getLocalConversationList();
  2609. t2.conversationList = n2.filter(function(t3) {
  2610. return t3.conversationGroupList.includes(e3);
  2611. }), this._conversationModule.emitOuterEvent(E.CONVERSATION_IN_GROUP_UPDATED, t2);
  2612. } }, { key: "reset", value: function() {
  2613. xe.l("".concat(this._n, ".reset")), this._convGroupMap.clear(), this._startIndex = 0, this._pagingStatus = Zt.NOT_START;
  2614. } }]), e2;
  2615. }(), vr = function(e2) {
  2616. i(s2, e2);
  2617. var n2 = f(s2);
  2618. function s2(e3) {
  2619. var t2;
  2620. return o(this, s2), (t2 = n2.call(this, e3))._n = "ConversationModule", tr.mixin(_(t2)), t2._messageListHandler = new Qa(), t2._messageRemindHandler = new hr(_(t2)), t2._convGroupHandler = new fr(_(t2)), t2.singlyLinkedList = new lr(100), t2._pagingStatus = Zt.NOT_START, t2._pagingTimeStamp = 0, t2._pagingStartIndex = 0, t2._pagingPinnedTimeStamp = 0, t2._pagingPinnedStartIndex = 0, t2._pagingConvIDMap = /* @__PURE__ */ new Map(), t2._convIDFromUnreadDBMap = /* @__PURE__ */ new Map(), t2._conversationMap = /* @__PURE__ */ new Map(), t2._tmpGroupList = [], t2._tmpGroupAtTipsList = [], t2._peerReadTimeMap = /* @__PURE__ */ new Map(), t2._completedMap = /* @__PURE__ */ new Map(), t2._roamingMessageKeyAndTimeMap = /* @__PURE__ */ new Map(), t2._roamingMessageSequenceMap = /* @__PURE__ */ new Map(), t2._remoteGroupReadSequenceMap = /* @__PURE__ */ new Map(), t2._convTotalUnreadCount = 0, t2._pagingGetCostList = [], t2._initListeners(), t2;
  2621. }
  2622. return a(s2, [{ key: "_initListeners", value: function() {
  2623. var e3 = this.getInnerEmitterInstance();
  2624. e3.on(Za, this._initLocalConversationList, this), e3.on(er, this._onProfileUpdated, this);
  2625. } }, { key: "onCheckTimer", value: function(e3) {
  2626. e3 % 60 == 0 && this._messageListHandler.traversal();
  2627. } }, { key: "_initLocalConversationList", value: function() {
  2628. var e3 = this, t2 = new ka("_initLocalConversationList");
  2629. xe.l("".concat(this._n, ".").concat("_initLocalConversationList"));
  2630. var n3 = "", o2 = this._getStorageConversationList(), s3 = this.isIntl();
  2631. if (o2) {
  2632. for (var a2 = o2.length, r2 = 0; r2 < a2; r2++) {
  2633. var i2 = o2[r2];
  2634. if (i2) {
  2635. if (i2.conversationID === "".concat(S.CONV_C2C, "@TLS#ERROR") || i2.conversationID === "".concat(S.CONV_C2C, "@TLS#NOT_FOUND"))
  2636. continue;
  2637. if (i2.groupProfile) {
  2638. var u2 = i2.groupProfile.type;
  2639. if (Ct(u2))
  2640. continue;
  2641. }
  2642. }
  2643. this._conversationMap.set(o2[r2].conversationID, new _r(o2[r2], s3));
  2644. }
  2645. this.emitConversationUpdate(true, false), n3 = "count:".concat(a2);
  2646. } else
  2647. n3 = "count:0";
  2648. t2.setNetworkType(this.getNetworkType()).setMessage(n3).end(), this.getModule(Gn) || this.triggerReady(), this.ready(function() {
  2649. e3._tmpGroupList.length > 0 && (e3.updateConversationGroupProfile(e3._tmpGroupList), e3._tmpGroupList.length = 0);
  2650. }), this.syncConversationList();
  2651. } }, { key: "onMessageSent", value: function(e3) {
  2652. this._onSendOrReceiveMessage({ conversationOptionsList: e3.conversationOptionsList, isInstantMessage: true });
  2653. } }, { key: "onNewMessage", value: function(e3) {
  2654. this._onSendOrReceiveMessage(e3);
  2655. } }, { key: "_onSendOrReceiveMessage", value: function(e3) {
  2656. var t2 = this, n3 = e3.conversationOptionsList, o2 = e3.isInstantMessage, s3 = void 0 === o2 || o2, a2 = e3.isUnreadC2CMessage, r2 = void 0 !== a2 && a2, i2 = e3.updateUnreadCount, u2 = void 0 === i2 || i2;
  2657. this._isReady ? 0 !== n3.length && (this._getC2CPeerReadTime(n3), this._updateLocalConversationList({ conversationOptionsList: n3, isInstantMessage: s3, isUnreadC2CMessage: r2, isFromGetConversations: false, updateUnreadCount: u2 }), s3 || (this._convIDFromUnreadDBMap = new Map([].concat(m(this._convIDFromUnreadDBMap), m(n3.map(function(e4) {
  2658. return [e4.conversationID, 1];
  2659. })))), this._diffAndDeleteConversation()), this._setStorageConversationList(), n3.filter(function(e4) {
  2660. return e4.type === S.CONV_TOPIC;
  2661. }).length > 0 || this.emitConversationUpdate()) : this.ready(function() {
  2662. t2._onSendOrReceiveMessage(e3);
  2663. });
  2664. } }, { key: "updateConversationGroupProfile", value: function(e3) {
  2665. var t2 = this;
  2666. if (!st(e3) || 0 !== e3.length)
  2667. if (0 !== this._conversationMap.size) {
  2668. var n3 = false;
  2669. e3.forEach(function(e4) {
  2670. var o2 = "GROUP".concat(e4.groupID);
  2671. if (t2._conversationMap.has(o2)) {
  2672. n3 = true;
  2673. var s3 = t2._conversationMap.get(o2);
  2674. s3.groupProfile = JSON.parse(JSON.stringify(e4)), s3.lastMessage.lastSequence < e4.nextMessageSeq && (s3.lastMessage.lastSequence = e4.nextMessageSeq - 1), s3.subType || (s3.subType = e4.type);
  2675. }
  2676. }), n3 && this.emitConversationUpdate(true, false);
  2677. } else
  2678. this._tmpGroupList = e3;
  2679. } }, { key: "_updateConversationUserProfile", value: function(e3) {
  2680. var t2 = this;
  2681. e3.data.forEach(function(e4) {
  2682. var n3 = "C2C".concat(e4.userID);
  2683. t2._conversationMap.has(n3) && (t2._conversationMap.get(n3).userProfile = e4);
  2684. }), this.emitConversationUpdate(true, false);
  2685. } }, { key: "onMessageRevoked", value: function(e3) {
  2686. var t2 = this;
  2687. if (0 !== e3.length) {
  2688. var n3 = null, o2 = false, s3 = [];
  2689. e3.forEach(function(e4) {
  2690. (n3 = t2._conversationMap.get(e4.conversationID)) && (n3.type === S.CONV_TOPIC ? s3.push(e4) : (n3.reduceUnreadCount() && (o2 = true), n3.isLastMessageRevoked({ sequence: e4.sequence, time: e4.time }) && (n3.setLastMessageRevoked(true), n3.setLastMessageRevoker(e4.revoker), o2 = true)));
  2691. }), this.getModule(wn).onMessageRevoked(s3), o2 && (this.emitConversationUpdate(true, false), this.emitTotalUnreadMessageCountUpdate());
  2692. }
  2693. } }, { key: "isLastMessageRevoked", value: function(e3) {
  2694. var t2 = false, n3 = e3.conversationID, o2 = e3.sequence, s3 = e3.time, a2 = this._conversationMap.get(n3);
  2695. a2 && (t2 = a2.type === S.CONV_TOPIC ? this.getModule(wn).isLastMessageRevoked({ topicID: n3.replace(S.CONV_GROUP, ""), sequence: o2 }) : a2.isLastMessageRevoked({ sequence: o2, time: s3 }));
  2696. return xe.l("".concat(this._n, ".isLastMessageRevoked options:").concat(JSON.stringify(e3), " ret:").concat(t2)), t2;
  2697. } }, { key: "onMessageDeleted", value: function(e3) {
  2698. var t2 = this;
  2699. if (0 !== e3.length) {
  2700. var n3 = null;
  2701. e3.forEach(function(e4) {
  2702. (n3 = t2._messageListHandler.getLocalMessage(e4.conversationID, e4.ID)) && (n3.isDeleted = true), e4 !== n3 && (e4.isDeleted = true);
  2703. });
  2704. for (var o2 = e3[0].conversationID, s3 = this._messageListHandler.getLocalMessageList(o2), a2 = {}, r2 = s3.length - 1; r2 >= 0; r2--)
  2705. if (!s3[r2].isDeleted) {
  2706. a2 = s3[r2];
  2707. break;
  2708. }
  2709. var i2 = this._conversationMap.get(o2);
  2710. if (i2) {
  2711. var u2 = false;
  2712. i2.lastMessage.lastSequence === a2.sequence && i2.lastMessage.lastTime === a2.time || (jt(a2) && (a2 = void 0), i2.updateLastMessage(a2), i2.type !== S.CONV_TOPIC && (u2 = true), xe.l("".concat(this._n, ".onMessageDeleted. update conversationID:").concat(o2, " with lastMessage:"), i2.lastMessage)), o2.startsWith(S.CONV_C2C) && this.updateUnreadCount(o2), u2 && this.emitConversationUpdate(true, false);
  2713. }
  2714. }
  2715. } }, { key: "onMessageModified", value: function(e3) {
  2716. var t2 = e3.conversationType, n3 = e3.from, o2 = e3.to, s3 = e3.time, a2 = e3.sequence, r2 = e3.elements, i2 = e3.cloudCustomData, u2 = e3.messageVersion, c2 = this.getMyUserID(), l2 = "".concat(t2).concat(o2);
  2717. o2 === c2 && t2 === S.CONV_C2C && (l2 = "".concat(t2).concat(n3));
  2718. var p2 = this._messageListHandler.onMessageModified(l2, e3), d2 = p2.isUpdated, g2 = p2.message;
  2719. true === d2 && this.emitOuterEvent(E.MESSAGE_MODIFIED, [g2]);
  2720. var _2 = this._isTopicConversation(l2);
  2721. if (xe.l("".concat(this._n, ".onMessageModified isUpdated:").concat(d2, " isTopicMessage:").concat(_2, " from:").concat(n3, " to:").concat(o2)), _2) {
  2722. this.getModule(wn).onMessageModified(e3);
  2723. } else {
  2724. var h2 = this._conversationMap.get(l2);
  2725. if (h2) {
  2726. var f2 = h2.lastMessage;
  2727. xe.d("".concat(this._n.onMessageModified, " lastMessage:"), JSON.stringify(f2), "options:", JSON.stringify(e3)), f2 && f2.lastTime === s3 && f2.lastSequence === a2 && f2.version !== u2 && (f2.type = r2[0].type, f2.payload = r2[0].content, f2.messageForShow = xt(f2.type, f2.payload, this.isIntl()), f2.cloudCustomData = i2, f2.version = u2, this.emitConversationUpdate(true, false));
  2728. }
  2729. }
  2730. return g2;
  2731. } }, { key: "onNewGroupAtTips", value: function(e3) {
  2732. var n3 = this, o2 = e3.dataList, s3 = null;
  2733. o2.forEach(function(e4) {
  2734. e4.groupAtTips ? s3 = e4.groupAtTips : e4.elements ? s3 = t(t({}, e4.elements), {}, { sync: true }) : e4.groupAtType && (s3 = t(t({}, e4), {}, { sync: true })), s3.__random = e4.random, s3.__sequence = e4.clientSequence, n3._tmpGroupAtTipsList.push(s3);
  2735. }), xe.d("".concat(this._n, ".onNewGroupAtTips isReady:").concat(this._isReady), this._tmpGroupAtTipsList), this._isReady && this._handleGroupAtTipsList();
  2736. } }, { key: "_handleGroupAtTipsList", value: function() {
  2737. var e3 = this;
  2738. if (0 !== this._tmpGroupAtTipsList.length) {
  2739. var t2 = false;
  2740. this._tmpGroupAtTipsList.forEach(function(n3) {
  2741. var o2 = n3.groupID, s3 = n3.from, a2 = n3.topicID, r2 = void 0 === a2 ? void 0 : a2, i2 = n3.sync, u2 = void 0 !== i2 && i2;
  2742. if (s3 !== e3.getMyUserID())
  2743. if (at(r2)) {
  2744. var c2 = e3._conversationMap.get("".concat(S.CONV_GROUP).concat(o2));
  2745. c2 && (c2.updateGroupAtInfoList(n3), t2 = true);
  2746. } else {
  2747. var l2 = e3._conversationMap.get("".concat(S.CONV_GROUP).concat(r2));
  2748. if (l2) {
  2749. l2.updateGroupAtInfoList(n3);
  2750. var p2 = e3.getModule(wn), d2 = l2.groupAtInfoList;
  2751. p2.onConversationProxy({ topicID: r2, groupAtInfoList: d2 });
  2752. }
  2753. if (jt(l2) && u2)
  2754. e3.updateTopicConversation([{ conversationID: "".concat(S.CONV_GROUP).concat(r2), type: S.CONV_TOPIC }]), e3._conversationMap.get("".concat(S.CONV_GROUP).concat(r2)).updateGroupAtInfoList(n3);
  2755. }
  2756. }), t2 && this.emitConversationUpdate(true, false), this._tmpGroupAtTipsList.length = 0;
  2757. }
  2758. } }, { key: "_getC2CPeerReadTime", value: function(e3) {
  2759. var t2 = this, n3 = [];
  2760. if (e3.forEach(function(e4) {
  2761. t2._conversationMap.has(e4.conversationID) || e4.type !== S.CONV_C2C || n3.push(e4.conversationID.replace(S.CONV_C2C, ""));
  2762. }), n3.length > 0) {
  2763. xe.d("".concat(this._n, "._getC2CPeerReadTime userIDList:").concat(n3));
  2764. var o2 = this.getModule(Gn);
  2765. o2 && o2.getRemotePeerReadTime(n3);
  2766. }
  2767. } }, { key: "_getStorageConversationList", value: function() {
  2768. return this.getModule(xn).getItem("conversationMap");
  2769. } }, { key: "_setStorageConversationList", value: function() {
  2770. var e3 = this.getLocalConversationList().filter(function(e4) {
  2771. return e4.type === S.CONV_C2C || e4.type === S.CONV_GROUP && e4.lastMessage.type !== S.MSG_GRP_TIP;
  2772. }).slice(0, 20).map(function(e4) {
  2773. return { conversationID: e4.conversationID, type: e4.type, subType: e4.subType, lastMessage: e4.lastMessage, groupProfile: e4.groupProfile, userProfile: e4.userProfile };
  2774. });
  2775. this.getModule(xn).setItem("conversationMap", e3);
  2776. } }, { key: "emitConversationUpdate", value: function() {
  2777. var e3 = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0], t2 = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], n3 = this.getLocalConversationList();
  2778. if (t2) {
  2779. var o2 = this.getModule(Un);
  2780. o2 && o2.updateGroupLastMessage(n3);
  2781. }
  2782. e3 && this.emitOuterEvent(E.CONVERSATION_LIST_UPDATED);
  2783. } }, { key: "getLocalConversationList", value: function() {
  2784. return m(this._conversationMap.values()).filter(function(e3) {
  2785. return e3.type !== S.CONV_TOPIC;
  2786. });
  2787. } }, { key: "getLocalConversation", value: function(e3) {
  2788. return this._conversationMap.get(e3);
  2789. } }, { key: "hasLocalConversation", value: function(e3) {
  2790. return this._conversationMap.has(e3);
  2791. } }, { key: "getLocalOldestMessage", value: function(e3) {
  2792. return this._messageListHandler.getLocalOldestMessage(e3);
  2793. } }, { key: "syncConversationList", value: function() {
  2794. var e3 = this, t2 = new ka("syncConversationList");
  2795. return this._pagingStatus === Zt.NOT_START && this._conversationMap.clear(), this._pagingGetConversationList().then(function(n3) {
  2796. var o2 = function(e4) {
  2797. if (st(e4) && 0 !== e4.length) {
  2798. var t3 = 0;
  2799. return e4.forEach(function(e5) {
  2800. t3 += e5;
  2801. }), (t3 / e4.length).toFixed(0);
  2802. }
  2803. }(e3._pagingGetCostList);
  2804. return xe.l("".concat(e3._n, ".").concat("syncConversationList", ". sum ").concat(function(e4) {
  2805. if (st(e4) && 0 !== e4.length) {
  2806. var t3 = 0;
  2807. return e4.forEach(function(e5) {
  2808. t3 += e5;
  2809. }), t3.toFixed(0);
  2810. }
  2811. }(e3._pagingGetCostList), " ms, average ").concat(o2, " ms")), e3._pagingGetCostList.length = 0, e3._pagingStatus = Zt.RESOLVED, e3._diffAndDeleteConversation(), e3.emitConversationUpdate(true, false), e3._setStorageConversationList(), e3._handleC2CPeerReadTime(), e3._patchConversationProperties(), t2.setMessage(e3._conversationMap.size).setMoreMessage(o2).setNetworkType(e3.getNetworkType()).end(), n3;
  2812. }).catch(function(n3) {
  2813. return e3._pagingStatus = Zt.REJECTED, t2.setMessage(e3._pagingTimeStamp), e3.probeNetwork().then(function(e4) {
  2814. var o2 = v(e4, 2), s3 = o2[0], a2 = o2[1];
  2815. t2.setError(n3, s3, a2).end();
  2816. }), Ja(n3);
  2817. });
  2818. } }, { key: "_diffAndDeleteConversation", value: function() {
  2819. var e3 = this;
  2820. if (this._isSyncCompleted()) {
  2821. var t2 = [];
  2822. this._conversationMap.forEach(function(n3, o2) {
  2823. !e3._pagingConvIDMap.has(o2) && e3._convIDFromUnreadDBMap.has(o2) && (e3._conversationMap.delete(o2), t2.push(o2));
  2824. }), xe.l("".concat(this._n, "._diffAndDeleteConversation list:").concat(t2));
  2825. }
  2826. } }, { key: "_patchConversationProperties", value: function() {
  2827. var e3 = this, t2 = Date.now(), n3 = this.checkAndPatchRemark(), o2 = this._messageRemindHandler.getC2CMessageRemindType(), s3 = this.getModule(Un).getGroupList();
  2828. Promise.all([n3, o2, s3]).then(function() {
  2829. var n4 = Date.now() - t2;
  2830. xe.l("".concat(e3._n, "._patchConversationProperties ok. cost ").concat(n4, " ms")), e3.emitConversationUpdate(true, false), e3.emitTotalUnreadMessageCountUpdate();
  2831. });
  2832. } }, { key: "_pagingGetConversationList", value: function() {
  2833. var e3 = this, t2 = "".concat(this._n, "._pagingGetConversationList");
  2834. xe.l("".concat(t2, " timeStamp:").concat(this._pagingTimeStamp, " startIndex:").concat(this._pagingStartIndex) + " pinnedTimeStamp:".concat(this._pagingPinnedTimeStamp, " pinnedStartIndex:").concat(this._pagingPinnedStartIndex));
  2835. var n3 = Date.now();
  2836. return this._pagingStatus = Zt.PENDING, this.request({ protocolName: No, requestData: { fromAccount: this.getMyUserID(), timeStamp: this._pagingTimeStamp, startIndex: this._pagingStartIndex, pinnedTimeStamp: this._pagingPinnedTimeStamp, pinnedStartIndex: this._pagingPinnedStartIndex, orderType: 1 } }).then(function(o2) {
  2837. var s3 = o2.data, a2 = s3.completeFlag, r2 = s3.conversations, i2 = void 0 === r2 ? [] : r2, u2 = s3.timeStamp, c2 = s3.startIndex, l2 = s3.pinnedTimeStamp, p2 = s3.pinnedStartIndex, d2 = s3.groupItem, g2 = Date.now() - n3;
  2838. if (e3._pagingGetCostList.push(g2), xe.l("".concat(t2, " ok. completeFlag:").concat(a2, " count:").concat(i2.length, " cost ").concat(g2, " ms")), e3._convGroupHandler.onConvGroupListSynced(d2), i2.length > 0) {
  2839. var _2 = e3._getConversationOptions(i2);
  2840. e3._pagingConvIDMap = new Map([].concat(m(e3._pagingConvIDMap), m(_2.map(function(e4) {
  2841. return [e4.conversationID, 1];
  2842. })))), e3._updateLocalConversationList({ conversationOptionsList: _2, isFromGetConversations: true }), e3.isLoggedIn() && e3.emitConversationUpdate();
  2843. }
  2844. if (!e3._isReady) {
  2845. if (!e3.isLoggedIn())
  2846. return za();
  2847. e3.triggerReady();
  2848. }
  2849. return e3._pagingTimeStamp = u2, e3._pagingStartIndex = c2, e3._pagingPinnedTimeStamp = l2, e3._pagingPinnedStartIndex = p2, 1 !== a2 ? e3._pagingGetConversationList() : (e3._handleGroupAtTipsList(), e3._convGroupHandler.getRemoteConvGroupList(), za());
  2850. }).catch(function(n4) {
  2851. throw e3.isLoggedIn() && (e3._isReady || (xe.w("".concat(t2, " failed. error:"), n4), e3.triggerReady())), n4;
  2852. });
  2853. } }, { key: "_updateLocalConversationList", value: function(e3) {
  2854. var t2, n3 = e3.isFromGetConversations, o2 = e3.isInstantMessage, s3 = Date.now();
  2855. t2 = this._getTmpConversationListMapping(e3), this._conversationMap = new Map(this._sortConversationList([].concat(m(t2.toBeUpdatedConversationList), m(this._conversationMap)))), n3 || (this._updateUserOrGroupProfile(t2.newConversationList), o2 && this.emitTotalUnreadMessageCountUpdate()), xe.d("".concat(this._n, "._updateLocalConversationList cost ").concat(Date.now() - s3, " ms"));
  2856. } }, { key: "_getTmpConversationListMapping", value: function(e3) {
  2857. for (var t2 = e3.conversationOptionsList, n3 = e3.isFromGetConversations, o2 = e3.isInstantMessage, s3 = e3.isUnreadC2CMessage, a2 = void 0 !== s3 && s3, r2 = e3.updateUnreadCount, i2 = [], u2 = [], c2 = this.getModule(Un), l2 = this.getModule(Pn), p2 = this.isIntl(), d2 = 0, g2 = t2.length; d2 < g2; d2++) {
  2858. var _2 = new _r(t2[d2], p2), h2 = _2.conversationID;
  2859. if (h2 !== "".concat(S.CONV_C2C, "@TLS#ERROR") && h2 !== "".concat(S.CONV_C2C, "@TLS#NOT_FOUND"))
  2860. if (this._conversationMap.has(h2)) {
  2861. var f2 = this._conversationMap.get(h2), v2 = ["unreadCount", "allowType", "adminForbidType", "payload", "isPinned"];
  2862. false === o2 && v2.push("lastMessage");
  2863. var m2 = t2[d2].lastMessage, M2 = !at(m2);
  2864. M2 || t2[d2].type === S.CONV_TOPIC || this._onLastMessageNotExist(t2[d2]), at(o2) && M2 && null === f2.lastMessage.payload && (f2.lastMessage.payload = m2.payload), jt(f2.lastMessage.revoker) || (f2.lastMessage.revoker = null), pt(f2, _2, v2, [null, void 0, "", 0, NaN]), true === r2 && f2.updateUnreadCount({ nextUnreadCount: _2.unreadCount, isFromGetConversations: n3, isUnreadC2CMessage: a2 }), o2 && M2 && (m2.payload && (f2.lastMessage.payload = m2.payload), f2.type === S.CONV_GROUP && (f2.lastMessage.nameCard = m2.nameCard, f2.lastMessage.nick = m2.nick)), M2 && f2.lastMessage.cloudCustomData !== m2.cloudCustomData && (f2.lastMessage.cloudCustomData = m2.cloudCustomData || ""), this._conversationMap.delete(h2), i2.push([h2, f2]);
  2865. } else {
  2866. if (_2.type === S.CONV_GROUP && c2) {
  2867. var y2 = _2.groupProfile.groupID, I2 = c2.getLocalGroupProfile(y2);
  2868. I2 && (_2.groupProfile = I2, true === r2 && _2.updateUnreadCount({ nextUnreadCount: 0 }));
  2869. } else if (_2.type === S.CONV_C2C) {
  2870. var C2 = h2.replace(S.CONV_C2C, "");
  2871. l2 && l2.isMyFriend(C2) && (_2.remark = l2.getFriendRemark(C2));
  2872. }
  2873. u2.push(_2), i2.push([h2, _2]);
  2874. }
  2875. }
  2876. var T2 = this.getModule(wn);
  2877. return i2.forEach(function(e4) {
  2878. if (e4[1].type === S.CONV_TOPIC) {
  2879. var t3 = e4[1], n4 = t3.conversationID, o3 = t3.unreadCount, s4 = t3.groupAtInfoList;
  2880. T2.onConversationProxy({ topicID: n4.replace(S.CONV_GROUP, ""), unreadCount: o3, groupAtInfoList: jt(s4) ? void 0 : s4 });
  2881. }
  2882. }), { toBeUpdatedConversationList: i2, newConversationList: u2 };
  2883. } }, { key: "_onLastMessageNotExist", value: function(e3) {
  2884. new ka("lastMessageNotExist").setMessage("".concat(JSON.stringify(e3))).setNetworkType(this.getNetworkType()).end();
  2885. } }, { key: "_sortConversationList", value: function(e3) {
  2886. var t2 = [], n3 = [], o2 = [], s3 = [];
  2887. return e3.forEach(function(e4) {
  2888. true === e4[1].isPinned ? jt(e4[1].lastMessage.lastTime) ? n3.push(e4) : t2.push(e4) : jt(e4[1].lastMessage.lastTime) ? s3.push(e4) : o2.push(e4);
  2889. }), t2.sort(function(e4, t3) {
  2890. return t3[1].lastMessage.lastTime - e4[1].lastMessage.lastTime;
  2891. }).concat(n3).concat(o2.sort(function(e4, t3) {
  2892. return t3[1].lastMessage.lastTime - e4[1].lastMessage.lastTime;
  2893. })).concat(s3);
  2894. } }, { key: "_sortConversationListAndEmitEvent", value: function() {
  2895. this._conversationMap = new Map(this._sortConversationList(m(this._conversationMap))), this.emitConversationUpdate(true, false);
  2896. } }, { key: "_updateUserOrGroupProfile", value: function(e3) {
  2897. var t2 = this;
  2898. if (0 !== e3.length) {
  2899. var n3 = [], o2 = [], s3 = this.getModule(On), a2 = this.getModule(Un);
  2900. e3.forEach(function(e4) {
  2901. if (e4.type === S.CONV_C2C)
  2902. n3.push(e4.toAccount);
  2903. else if (e4.type === S.CONV_GROUP) {
  2904. var t3 = e4.toAccount;
  2905. a2.hasLocalGroup(t3) ? e4.groupProfile = a2.getLocalGroupProfile(t3) : o2.push(t3);
  2906. }
  2907. }), xe.l("".concat(this._n, "._updateUserOrGroupProfile c2cUserIDList:").concat(n3, " groupIDList:").concat(o2)), n3.length > 0 && s3.getUserProfile({ userIDList: n3 }).then(function(e4) {
  2908. var n4 = e4.data;
  2909. st(n4) ? n4.forEach(function(e5) {
  2910. t2._doUpdateUserProfile("C2C".concat(e5.userID), e5);
  2911. }) : t2._doUpdateUserProfile("C2C".concat(n4.userID), n4);
  2912. }), o2.length > 0 && a2.getGroupProfileAdvance({ groupIDList: o2, responseFilter: { groupBaseInfoFilter: ["Type", "Name", "FaceUrl"] } }).then(function(e4) {
  2913. e4.data.successGroupList.forEach(function(e5) {
  2914. var n4 = "GROUP".concat(e5.groupID);
  2915. if (t2._conversationMap.has(n4)) {
  2916. var o3 = t2._conversationMap.get(n4);
  2917. pt(o3.groupProfile, e5, [], [null, void 0, "", 0, NaN]), !o3.subType && e5.type && (o3.subType = e5.type);
  2918. }
  2919. });
  2920. });
  2921. }
  2922. } }, { key: "_doUpdateUserProfile", value: function(e3, t2) {
  2923. this.hasLocalConversation(e3) && (this.getLocalConversation(e3).userProfile = t2);
  2924. } }, { key: "_getConversationOptions", value: function(e3) {
  2925. var n3 = this, o2 = [], s3 = e3.filter(function(e4) {
  2926. var t2 = e4.type, n4 = e4.userID;
  2927. return 1 === t2 && "@TLS#NOT_FOUND" !== n4 && "@TLS#ERROR" !== n4 || 2 === t2;
  2928. }), a2 = this.getMyUserID(), r2 = s3.map(function(e4) {
  2929. if (at(e4.lastMsg) && (e4.lastMsg = { elements: [] }), 1 === e4.type) {
  2930. var s4 = { userID: e4.userID, nick: e4.peerNick, avatar: e4.peerAvatar };
  2931. return o2.push(s4), { conversationID: "C2C".concat(e4.userID), type: "C2C", lastMessage: { lastTime: e4.time, lastSequence: e4.sequence, fromAccount: e4.lastC2CMsgFromAccount, messageForShow: e4.messageShow, type: e4.lastMsg.elements[0] ? e4.lastMsg.elements[0].type : null, payload: e4.lastMsg.elements[0] ? n3._amendLayersOverLimitProperty(e4.lastMsg.elements[0].content) : null, cloudCustomData: e4.lastMsg.cloudCustomData || "", isRevoked: 8 === e4.lastMessageFlag, onlineOnlyFlag: false, nick: "", nameCard: "", version: 0, isPeerRead: e4.lastC2CMsgFromAccount === a2 && e4.time <= e4.c2cPeerReadTime, revoker: e4.lastMsg.revokerInfo ? e4.lastMsg.revokerInfo.revoker : null }, userProfile: new ur(s4), peerReadTime: e4.c2cPeerReadTime, isPinned: 1 === e4.isPinned, messageRemindType: "", customData: e4.customMark || "", markList: Bt(e4.standardMark), conversationGroupList: n3._convGroupHandler.getConvGroupListByID(e4.contactGroupId) };
  2932. }
  2933. return { conversationID: "GROUP".concat(e4.groupID), type: "GROUP", lastMessage: t(t({ lastTime: e4.time, lastSequence: e4.sequence, fromAccount: e4.msgGroupFromAccount, messageForShow: e4.messageShow }, n3._patchTypeAndPayload(e4)), {}, { cloudCustomData: e4.lastMsg.cloudCustomData || "", isRevoked: 2 === e4.lastMessageFlag, onlineOnlyFlag: false, nick: e4.senderNick || "", nameCard: e4.senderNameCard || "", revoker: e4.lastMsg.revokerInfo ? e4.lastMsg.revokerInfo.revoker : null }), groupProfile: new dr({ groupID: e4.groupID, name: e4.groupNick, avatar: e4.groupImage }), unreadCount: e4.unreadCount, peerReadTime: 0, isPinned: 1 === e4.isPinned, messageRemindType: "", version: 0, customData: e4.customMark || "", markList: Bt(e4.standardMark), conversationGroupList: n3._convGroupHandler.getConvGroupListByID(e4.contactGroupId) };
  2934. });
  2935. o2.length > 0 && this.getModule(On).onConversationsProfileUpdated(o2);
  2936. return r2;
  2937. } }, { key: "_patchTypeAndPayload", value: function(e3) {
  2938. var n3 = e3.lastMsg, o2 = n3.event, s3 = void 0 === o2 ? void 0 : o2, a2 = n3.elements, r2 = void 0 === a2 ? [] : a2, i2 = n3.groupTips, u2 = void 0 === i2 ? {} : i2;
  2939. if (!at(s3) && !jt(u2)) {
  2940. var c2 = new Ha(u2);
  2941. c2.setElement({ type: S.MSG_GRP_TIP, content: t(t({}, u2.elements), {}, { groupProfile: u2.groupProfile }) });
  2942. var l2 = JSON.parse(JSON.stringify(c2.payload));
  2943. return c2 = null, { type: S.MSG_GRP_TIP, payload: l2 };
  2944. }
  2945. return { type: r2[0] ? r2[0].type : null, payload: r2[0] ? this._amendLayersOverLimitProperty(r2[0].content) : null };
  2946. } }, { key: "_amendLayersOverLimitProperty", value: function(e3) {
  2947. var t2 = e3.layersOverLimit;
  2948. return 0 === t2 ? e3.layersOverLimit = false : 1 === t2 && (e3.layersOverLimit = true), e3;
  2949. } }, { key: "getLocalMessageList", value: function(e3) {
  2950. return this._messageListHandler.getLocalMessageList(e3);
  2951. } }, { key: "deleteLocalMessage", value: function(e3) {
  2952. e3 instanceof Ha && this._messageListHandler.remove(e3);
  2953. } }, { key: "onConversationDeleted", value: function(e3) {
  2954. if (st(e3)) {
  2955. var t2 = e3.map(function(e4) {
  2956. var t3 = e4.type, n3 = e4.userID, o2 = e4.groupID;
  2957. return 1 === t3 ? "".concat(S.CONV_C2C).concat(n3) : 2 === t3 ? "".concat(S.CONV_GROUP).concat(o2) : void 0;
  2958. });
  2959. xe.l("".concat(this._n, ".onConversationDeleted conversationIDList:").concat(t2)), this.deleteLocalConversationList(t2);
  2960. }
  2961. } }, { key: "onConversationPinned", value: function(e3) {
  2962. var t2 = this;
  2963. if (st(e3)) {
  2964. var n3 = false;
  2965. e3.forEach(function(e4) {
  2966. var o2, s3 = e4.type, a2 = e4.userID, r2 = e4.groupID;
  2967. 1 === s3 ? o2 = t2.getLocalConversation("".concat(S.CONV_C2C).concat(a2)) : 2 === s3 && (o2 = t2.getLocalConversation("".concat(S.CONV_GROUP).concat(r2))), o2 && (xe.l("".concat(t2._n, ".onConversationPinned conversationID:").concat(o2.conversationID, " isPinned:").concat(o2.isPinned)), o2.isPinned || (o2.isPinned = true, n3 = true));
  2968. }), n3 && this._sortConversationListAndEmitEvent();
  2969. }
  2970. } }, { key: "onConversationUnpinned", value: function(e3) {
  2971. var t2 = this;
  2972. if (st(e3)) {
  2973. var n3 = false;
  2974. e3.forEach(function(e4) {
  2975. var o2, s3 = e4.type, a2 = e4.userID, r2 = e4.groupID;
  2976. 1 === s3 ? o2 = t2.getLocalConversation("".concat(S.CONV_C2C).concat(a2)) : 2 === s3 && (o2 = t2.getLocalConversation("".concat(S.CONV_GROUP).concat(r2))), o2 && (xe.l("".concat(t2._n, ".onConversationUnpinned conversationID:").concat(o2.conversationID, " isPinned:").concat(o2.isPinned)), o2.isPinned && (o2.isPinned = false, n3 = true));
  2977. }), n3 && this._sortConversationListAndEmitEvent();
  2978. }
  2979. } }, { key: "getMessageList", value: function(e3) {
  2980. var t2 = this, n3 = e3.conversationID, o2 = e3.nextReqMessageID, s3 = e3.count, a2 = "".concat(this._n, ".getMessageList"), r2 = this.getLocalConversation(n3), i2 = "";
  2981. if (r2 && r2.groupProfile && (i2 = r2.groupProfile.type), Ct(i2))
  2982. return xe.l("".concat(a2, " not available in avchatroom. conversationID:").concat(n3)), za({ messageList: [], nextReqMessageID: "", isCompleted: true });
  2983. (at(s3) || s3 > 15) && (s3 = 15), !o2 && this._isNotInCommunity(n3) && (this._messageListHandler.removeByConversationID(n3), this._completedMap.delete(n3), this._roamingMessageSequenceMap.delete(n3));
  2984. var u2 = this._computeRemainingCount({ conversationID: n3, nextReqMessageID: o2 }), c2 = this._completedMap.has(n3);
  2985. if (xe.l("".concat(a2, " conversationID:").concat(n3, " nextReqMessageID:").concat(o2) + " remainingCount:".concat(u2, " count:").concat(s3, " isCompleted:").concat(c2)), this._needGetHistory({ conversationID: n3, remainingCount: u2, count: s3 }))
  2986. return this.getHistoryMessages({ conversationID: n3, nextReqMessageID: o2, count: 20 }).then(function(e4) {
  2987. var o3 = e4.nextReqID, s4 = e4.storedMessageList, r3 = t2._completedMap.has(n3), i3 = s4;
  2988. u2 > 0 && (i3 = t2._messageListHandler.getLocalMessageList(n3).slice(0, s4.length + u2));
  2989. var c3 = { nextReqMessageID: r3 ? "" : o3, messageList: i3, isCompleted: r3 };
  2990. return xe.l("".concat(a2, " ret.nextReqMessageID:").concat(c3.nextReqMessageID, " ret.isCompleted:").concat(c3.isCompleted, " ret.length:").concat(i3.length)), Ka(c3);
  2991. });
  2992. this.modifyMessageList(n3);
  2993. var l2 = this._getMessageListFromMemory({ conversationID: n3, nextReqMessageID: o2, count: s3 });
  2994. return za(l2);
  2995. } }, { key: "_getMessageListFromMemory", value: function(e3) {
  2996. var t2 = e3.conversationID, n3 = e3.nextReqMessageID, o2 = e3.count, s3 = "".concat(this._n, "._getMessageListFromMemory"), a2 = this._messageListHandler.getLocalMessageList(t2), r2 = a2.length, i2 = 0, u2 = { isCompleted: false, nextReqMessageID: "", messageList: [] };
  2997. return n3 ? (i2 = a2.findIndex(function(e4) {
  2998. return e4.ID === n3;
  2999. })) > o2 ? (u2.messageList = a2.slice(i2 - o2, i2), u2.nextReqMessageID = a2[i2 - o2].ID) : (u2.messageList = a2.slice(0, i2), u2.isCompleted = true) : r2 > o2 ? (i2 = r2 - o2, u2.messageList = a2.slice(i2, r2), u2.nextReqMessageID = a2[i2].ID) : (u2.messageList = a2.slice(0, r2), u2.isCompleted = true), xe.l("".concat(s3, " conversationID:").concat(t2) + " ret.nextReqMessageID:".concat(u2.nextReqMessageID, " ret.isCompleted:").concat(u2.isCompleted, " ret.length:").concat(u2.messageList.length)), u2;
  3000. } }, { key: "getMessageListHopping", value: function(e3) {
  3001. var t2 = e3.conversationID, n3 = e3.sequence, o2 = e3.time, s3 = e3.count, a2 = e3.direction, r2 = void 0 === a2 ? 0 : a2;
  3002. if ((at(s3) || s3 > 15) && (s3 = 15), t2.startsWith(S.CONV_C2C)) {
  3003. var i2 = this.getModule(Gn), u2 = t2.replace(S.CONV_C2C, "");
  3004. return i2.getRoamingMessagesHopping({ peerAccount: u2, time: o2, count: s3, direction: r2 });
  3005. }
  3006. if (t2.startsWith(S.CONV_GROUP)) {
  3007. var c2 = this.getModule(Un), l2 = t2.replace(S.CONV_GROUP, "");
  3008. return c2.getRoamingMessagesHopping({ groupID: l2, sequence: n3, count: s3, direction: r2 });
  3009. }
  3010. } }, { key: "_computeRemainingCount", value: function(e3) {
  3011. var t2 = e3.conversationID, n3 = e3.nextReqMessageID, o2 = this._messageListHandler.getLocalMessageList(t2), s3 = o2.length;
  3012. if (!n3)
  3013. return s3;
  3014. var a2 = 0;
  3015. return Et(t2) ? a2 = o2.findIndex(function(e4) {
  3016. return e4.ID === n3;
  3017. }) : St(t2) && (a2 = -1 !== n3.indexOf("-") ? o2.findIndex(function(e4) {
  3018. return e4.ID === n3;
  3019. }) : o2.findIndex(function(e4) {
  3020. return e4.sequence === n3;
  3021. })), -1 === a2 && (a2 = 0), a2;
  3022. } }, { key: "_getMessageListSize", value: function(e3) {
  3023. return this._messageListHandler.getLocalMessageList(e3).length;
  3024. } }, { key: "_needGetHistory", value: function(e3) {
  3025. var t2 = e3.conversationID, n3 = e3.remainingCount, o2 = e3.count, s3 = this.getLocalConversation(t2), a2 = "";
  3026. return s3 && s3.groupProfile && (a2 = s3.groupProfile.type), !kt(t2) && !Ct(a2) && (!(St(t2) && this._isPagingGetGroupListCompleted() && this._getLocalGroupCount() <= 4e3 && !this._hasLocalGroup(t2) && !this._isTopicConversation(t2)) && (n3 <= o2 && !this._completedMap.has(t2)));
  3027. } }, { key: "_isTopicConversation", value: function(e3) {
  3028. var t2 = e3.replace(S.CONV_GROUP, "");
  3029. return Dt(t2);
  3030. } }, { key: "getHistoryMessages", value: function(e3) {
  3031. var t2 = e3.conversationID, n3 = e3.count;
  3032. if (t2 === S.CONV_SYSTEM)
  3033. return za();
  3034. var o2 = 15;
  3035. n3 > 20 && (o2 = 20);
  3036. var s3 = null;
  3037. if (Et(t2)) {
  3038. var a2 = this._roamingMessageKeyAndTimeMap.has(t2);
  3039. return (s3 = this.getModule(Gn)) ? s3.getRoamingMessage({ conversationID: t2, peerAccount: t2.replace(S.CONV_C2C, ""), count: o2, lastMessageTime: a2 ? this._roamingMessageKeyAndTimeMap.get(t2).lastMessageTime : 0, messageKey: a2 ? this._roamingMessageKeyAndTimeMap.get(t2).messageKey : "" }) : Ja({ code: da.CANNOT_FIND_MODULE });
  3040. }
  3041. if (St(t2)) {
  3042. if (!(s3 = this.getModule(Un)))
  3043. return Ja({ code: da.CANNOT_FIND_MODULE });
  3044. var r2 = null;
  3045. this._conversationMap.has(t2) && (r2 = this._conversationMap.get(t2).lastMessage);
  3046. var i2 = 0;
  3047. r2 && (i2 = r2.lastSequence);
  3048. var u2 = this._roamingMessageSequenceMap.get(t2);
  3049. return s3.getRoamingMessage({ conversationID: t2, groupID: t2.replace(S.CONV_GROUP, ""), count: o2, sequence: u2 || i2 });
  3050. }
  3051. return za();
  3052. } }, { key: "patchConversationLastMessage", value: function(e3) {
  3053. var t2 = this.getLocalConversation(e3);
  3054. if (t2) {
  3055. var n3 = t2.lastMessage, o2 = n3.messageForShow, s3 = n3.payload;
  3056. if (jt(o2) || jt(s3)) {
  3057. var a2 = this._messageListHandler.getLocalMessageList(e3);
  3058. if (0 === a2.length)
  3059. return;
  3060. var r2 = a2[a2.length - 1];
  3061. xe.l("".concat(this._n, ".patchConversationLastMessage conversationID:").concat(e3, " payload:"), r2.payload), t2.updateLastMessage(r2);
  3062. }
  3063. }
  3064. } }, { key: "onRoamingMessage", value: function() {
  3065. var e3 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], n3 = arguments.length > 1 ? arguments[1] : void 0, o2 = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2], s3 = n3.startsWith(S.CONV_C2C) ? S.CONV_C2C : S.CONV_GROUP, a2 = null, r2 = [], i2 = [], u2 = 0, c2 = e3.length, l2 = null, p2 = s3 === S.CONV_GROUP, d2 = this.getModule(Hn), g2 = this.getFileDownloadProxy(), _2 = function() {
  3066. u2 = p2 ? e3.length - 1 : 0, c2 = p2 ? 0 : e3.length;
  3067. }, h2 = function() {
  3068. p2 ? --u2 : ++u2;
  3069. }, f2 = function() {
  3070. return p2 ? u2 >= c2 : u2 < c2;
  3071. };
  3072. for (_2(); f2(); h2())
  3073. if (p2 && 1 === e3[u2].sequence && o2 && this.setCompleted(n3), 1 !== e3[u2].isPlaceMessage)
  3074. if ((a2 = new Ha(e3[u2])).to = e3[u2].to, s3 !== S.CONV_GROUP || at(e3[u2].topicID) || (a2.to = e3[u2].topicID), a2.isSystemMessage = !!e3[u2].isSystemMessage, a2.conversationType = s3, 4 === e3[u2].event ? l2 = { type: S.MSG_GRP_TIP, content: t(t({}, e3[u2].elements), {}, { groupProfile: e3[u2].groupProfile }) } : (e3[u2].elements = d2.parseElements(e3[u2].elements, e3[u2].from), l2 = e3[u2].elements), p2 || a2.setNickAndAvatar({ nick: e3[u2].nick, avatar: e3[u2].avatar }), jt(l2)) {
  3075. var v2 = new ka("emptyMessageBody");
  3076. v2.setMessage("from:".concat(a2.from, " to:").concat(a2.to, " sequence:").concat(a2.sequence, " event:").concat(e3[u2].event)), v2.setNetworkType(this.getNetworkType()).setLevel("warning").end();
  3077. } else
  3078. a2.setElement(l2, g2), a2.reInitialize(this.getMyUserID()), r2.push(a2);
  3079. return _2 = h2 = f2 = null, o2 ? (this._messageListHandler.unshift(r2, i2), r2 = null, i2) : (i2 = null, r2);
  3080. } }, { key: "findMessage", value: function(e3) {
  3081. return this._messageListHandler.findMessage(e3);
  3082. } }, { key: "_isNotInCommunity", value: function(e3) {
  3083. var t2 = false;
  3084. if (e3.startsWith(S.CONV_GROUP) && this._isTopicConversation(e3)) {
  3085. var n3 = qt(e3.replace(S.CONV_GROUP, ""));
  3086. this.getModule(Un).hasLocalGroup(n3) || (t2 = true);
  3087. }
  3088. return t2;
  3089. } }, { key: "deleteTopicRoamingMessageInfo", value: function(e3) {
  3090. var t2 = this;
  3091. Tt({ groupID: e3 }) && this._messageListHandler.getTopicConversationIDList(e3).forEach(function(e4) {
  3092. t2._messageListHandler.removeByConversationID(e4), t2._completedMap.delete(e4), t2._roamingMessageSequenceMap.delete(e4);
  3093. });
  3094. } }, { key: "deleteGroupRomaingMessageInfo", value: function(e3) {
  3095. var t2 = "".concat(S.CONV_GROUP).concat(e3);
  3096. this._messageListHandler.removeByConversationID(t2), this._completedMap.delete(t2), this._roamingMessageSequenceMap.delete(t2);
  3097. } }, { key: "setMessageRead", value: function(e3) {
  3098. var t2 = e3.conversationID, n3 = this.getLocalConversation(t2);
  3099. if (xe.l("".concat(this._n, ".setMessageRead conversationID:").concat(t2, " unreadCount:").concat(n3 ? n3.unreadCount : 0)), !n3)
  3100. return za();
  3101. if (n3.type !== S.CONV_GROUP && n3.type !== S.CONV_TOPIC || jt(n3.groupAtInfoList) || this.deleteGroupAtTips(t2), 0 === n3.unreadCount)
  3102. return za();
  3103. if (n3.type === S.CONV_GROUP && !this._hasLocalGroup(t2))
  3104. return 0 !== n3.unreadCount && (n3.unreadCount = 0, this.emitConversationUpdate(true, false)), za();
  3105. var o2 = this._messageListHandler.getLocalLastMessage(t2), s3 = n3.lastMessage.lastTime;
  3106. o2 && s3 < o2.time && (s3 = o2.time);
  3107. var a2 = n3.lastMessage.lastSequence;
  3108. if (o2 && a2 < o2.sequence && (a2 = o2.sequence), n3.type === S.CONV_TOPIC && at(o2)) {
  3109. var r2 = this.getModule(wn), i2 = t2.replace(S.CONV_GROUP, ""), u2 = qt(i2), c2 = r2.getLocalTopic(u2, i2);
  3110. c2 && (a2 = c2.nextMessageSeq - 1);
  3111. }
  3112. var l2 = null;
  3113. switch (n3.type) {
  3114. case S.CONV_C2C:
  3115. return (l2 = this.getModule(Gn)) ? l2.setMessageRead({ conversationID: t2, lastMessageTime: s3 }) : Ja({ code: da.CANNOT_FIND_MODULE });
  3116. case S.CONV_GROUP:
  3117. case S.CONV_TOPIC:
  3118. return (l2 = this.getModule(Un)) ? l2.setMessageRead({ conversationID: t2, lastMessageSeq: a2 }) : Ja({ code: da.CANNOT_FIND_MODULE });
  3119. case S.CONV_SYSTEM:
  3120. return n3.unreadCount = 0, this.emitConversationUpdate(true, false), za();
  3121. default:
  3122. return za();
  3123. }
  3124. } }, { key: "setAllMessageRead", value: function() {
  3125. var e3 = this, t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, n3 = "setAllMessageRead", o2 = "".concat(this._n, ".").concat(n3);
  3126. t2.scope || (t2.scope = S.READ_ALL_MSG), xe.l("".concat(o2, " options:"), t2);
  3127. var s3 = this._createSetAllMessageReadPack(t2);
  3128. if (0 === s3.readAllC2CMessage && 0 === s3.groupMessageReadInfoList.length)
  3129. return za();
  3130. var a2 = new ka(n3);
  3131. return this.request({ protocolName: rs, requestData: s3 }).then(function(n4) {
  3132. var o3 = n4.data, s4 = e3._handleAllMessageRead(o3);
  3133. return a2.setMessage("scope:".concat(t2.scope, " failureGroups:").concat(JSON.stringify(s4))).setNetworkType(e3.getNetworkType()).end(), za();
  3134. }).catch(function(t3) {
  3135. return e3.probeNetwork().then(function(e4) {
  3136. var n4 = v(e4, 2), o3 = n4[0], s4 = n4[1];
  3137. a2.setError(t3, o3, s4).end();
  3138. }), xe.w("".concat(o2, " failed. error:"), t3), Ja({ code: t3 && t3.code ? t3.code : da.MESSAGE_UNREAD_ALL_FAIL, message: t3 && t3.message ? t3.message : void 0 });
  3139. });
  3140. } }, { key: "setConversationCustomData", value: function(e3) {
  3141. return this._convGroupHandler.setConvCustomData(e3);
  3142. } }, { key: "markConversation", value: function(e3) {
  3143. return this._convGroupHandler.markConversation(e3);
  3144. } }, { key: "getConversationGroupList", value: function() {
  3145. return this._convGroupHandler.getLocalConvGroupList();
  3146. } }, { key: "createConversationGroup", value: function(e3) {
  3147. return this._convGroupHandler.createConvGroup(e3);
  3148. } }, { key: "deleteConversationGroup", value: function(e3) {
  3149. return this._convGroupHandler.deleteConvGroup(e3);
  3150. } }, { key: "renameConversationGroup", value: function(e3) {
  3151. return this._convGroupHandler.renameConvGroup(e3);
  3152. } }, { key: "addConversationsToGroup", value: function(e3) {
  3153. return this._convGroupHandler.addConvsToGroup(e3);
  3154. } }, { key: "deleteConversationsFromGroup", value: function(e3) {
  3155. return this._convGroupHandler.deleteConvsFromGroup(e3);
  3156. } }, { key: "onConversationMarkUpdated", value: function(e3) {
  3157. this._convGroupHandler.onConvMarkUpdated(e3);
  3158. } }, { key: "onConversationGroupCreated", value: function(e3) {
  3159. this._convGroupHandler.onConvGroupCreated(e3);
  3160. } }, { key: "onConversationGroupDeleted", value: function(e3) {
  3161. this._convGroupHandler.onConvGroupDeleted(e3);
  3162. } }, { key: "onConversationGroupNameUpdated", value: function(e3) {
  3163. this._convGroupHandler.onConvGroupNameUpdated(e3);
  3164. } }, { key: "onConversationInGroupUpdated", value: function(e3) {
  3165. this._convGroupHandler.onConvInGroupUpdated(e3);
  3166. } }, { key: "onConversationAddedToOrDeletedFromGroup", value: function(e3) {
  3167. this._convGroupHandler.onConvAddedToOrDeletedFromGroup(e3);
  3168. } }, { key: "_getConversationLastMessageSequence", value: function(e3) {
  3169. var t2 = this._messageListHandler.getLocalLastMessage(e3.conversationID), n3 = e3.lastMessage.lastSequence;
  3170. return t2 && n3 < t2.sequence && (n3 = t2.sequence), n3;
  3171. } }, { key: "_getConversationLastMessageTime", value: function(e3) {
  3172. var t2 = this._messageListHandler.getLocalLastMessage(e3.conversationID), n3 = e3.lastMessage.lastTime;
  3173. return t2 && n3 < t2.time && (n3 = t2.time), n3;
  3174. } }, { key: "_createSetAllMessageReadPack", value: function(e3) {
  3175. var t2, n3 = { readAllC2CMessage: 0, groupMessageReadInfoList: [] }, o2 = e3.scope, s3 = D(this._conversationMap);
  3176. try {
  3177. for (s3.s(); !(t2 = s3.n()).done; ) {
  3178. var a2 = v(t2.value, 2)[1];
  3179. if (a2.unreadCount > 0) {
  3180. if (a2.type === S.CONV_C2C && 0 === n3.readAllC2CMessage) {
  3181. if (o2 === S.READ_ALL_MSG)
  3182. n3.readAllC2CMessage = 1;
  3183. else if (o2 === S.READ_ALL_C2C_MSG) {
  3184. n3.readAllC2CMessage = 1;
  3185. break;
  3186. }
  3187. } else if (a2.type === S.CONV_GROUP && (o2 === S.READ_ALL_GROUP_MSG || o2 === S.READ_ALL_MSG)) {
  3188. var r2 = this._getConversationLastMessageSequence(a2);
  3189. n3.groupMessageReadInfoList.push({ groupID: a2.groupProfile.groupID, messageSequence: r2 });
  3190. }
  3191. }
  3192. }
  3193. } catch (i2) {
  3194. s3.e(i2);
  3195. } finally {
  3196. s3.f();
  3197. }
  3198. return n3;
  3199. } }, { key: "onPushedAllMessageRead", value: function(e3) {
  3200. this._handleAllMessageRead(e3);
  3201. } }, { key: "_handleAllMessageRead", value: function(e3) {
  3202. var t2 = e3.groupMessageReadInfoList, n3 = e3.readAllC2CMessage, o2 = this._parseGroupReadInfo(t2);
  3203. return this._updateAllConversationUnreadCount({ readAllC2CMessage: n3 }) >= 1 && (this.emitConversationUpdate(true, false), this.emitTotalUnreadMessageCountUpdate()), o2;
  3204. } }, { key: "_parseGroupReadInfo", value: function(e3) {
  3205. var t2 = [];
  3206. if (e3 && e3.length)
  3207. for (var n3 = 0, o2 = e3.length; n3 < o2; n3++) {
  3208. var s3 = e3[n3], a2 = s3.groupID, r2 = s3.sequence, i2 = s3.retCode, u2 = s3.lastMessageSeq;
  3209. at(i2) ? this._remoteGroupReadSequenceMap.set(a2, u2) : (this._remoteGroupReadSequenceMap.set(a2, r2), 0 !== i2 && t2.push("".concat(a2, "-").concat(r2, "-").concat(i2)));
  3210. }
  3211. return t2;
  3212. } }, { key: "_updateAllConversationUnreadCount", value: function(e3) {
  3213. var t2, n3 = e3.readAllC2CMessage, o2 = 0, s3 = D(this._conversationMap);
  3214. try {
  3215. for (s3.s(); !(t2 = s3.n()).done; ) {
  3216. var a2 = v(t2.value, 2), r2 = a2[0], i2 = a2[1];
  3217. if (i2.unreadCount >= 1) {
  3218. if (1 === n3 && i2.type === S.CONV_C2C) {
  3219. var u2 = this._getConversationLastMessageTime(i2);
  3220. this.updateIsReadAfterReadReport({ conversationID: r2, lastMessageTime: u2 });
  3221. } else if (i2.type === S.CONV_GROUP) {
  3222. var c2 = r2.replace(S.CONV_GROUP, "");
  3223. if (this._remoteGroupReadSequenceMap.has(c2)) {
  3224. var l2 = this._remoteGroupReadSequenceMap.get(c2), p2 = this._getConversationLastMessageSequence(i2);
  3225. this.updateIsReadAfterReadReport({ conversationID: r2, remoteReadSequence: l2 }), p2 >= l2 && this._remoteGroupReadSequenceMap.delete(c2);
  3226. }
  3227. }
  3228. this.updateUnreadCount(r2, false) && (o2 += 1);
  3229. }
  3230. }
  3231. } catch (d2) {
  3232. s3.e(d2);
  3233. } finally {
  3234. s3.f();
  3235. }
  3236. return o2;
  3237. } }, { key: "isRemoteRead", value: function(e3) {
  3238. var t2 = e3.conversationID, n3 = e3.sequence, o2 = t2.replace(S.CONV_GROUP, ""), s3 = false;
  3239. if (this._remoteGroupReadSequenceMap.has(o2)) {
  3240. var a2 = this._remoteGroupReadSequenceMap.get(o2);
  3241. n3 <= a2 && (s3 = true, xe.l("".concat(this._n, ".isRemoteRead conversationID:").concat(t2, " messageSequence:").concat(n3, " remoteReadSequence:").concat(a2))), n3 >= a2 + 10 && this._remoteGroupReadSequenceMap.delete(o2);
  3242. }
  3243. return s3;
  3244. } }, { key: "updateIsReadAfterReadReport", value: function(e3) {
  3245. var t2 = e3.conversationID, n3 = e3.lastMessageSeq, o2 = e3.lastMessageTime, s3 = this._messageListHandler.getLocalMessageList(t2);
  3246. if (0 !== s3.length) {
  3247. for (var a2, r2 = s3.length - 1; r2 >= 0; r2--)
  3248. if (a2 = s3[r2], !(o2 && a2.time > o2 || n3 && a2.sequence > n3)) {
  3249. if ("in" === a2.flow && a2.isRead)
  3250. break;
  3251. a2.setIsRead(true);
  3252. }
  3253. }
  3254. } }, { key: "updateUnreadCount", value: function(e3) {
  3255. var t2 = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], n3 = false, o2 = this.getLocalConversation(e3), s3 = this._messageListHandler.getLocalMessageList(e3);
  3256. if (o2) {
  3257. var a2 = o2.unreadCount, r2 = s3.filter(function(e4) {
  3258. return !e4.isRead && !e4._onlineOnlyFlag && !e4.isDeleted;
  3259. }).length;
  3260. if (a2 !== r2 && (o2.unreadCount = r2, n3 = true, xe.l("".concat(this._n, ".updateUnreadCount from ").concat(a2, " to ").concat(r2, ", conversationID:").concat(e3)), true === t2 && (this.emitConversationUpdate(true, false), this.emitTotalUnreadMessageCountUpdate())), n3 && o2.type === S.CONV_TOPIC) {
  3261. var i2 = o2.unreadCount, u2 = this.getModule(wn), c2 = e3.replace(S.CONV_GROUP, "");
  3262. u2.onConversationProxy({ topicID: c2, unreadCount: i2 });
  3263. }
  3264. return n3;
  3265. }
  3266. } }, { key: "clearGroupAtInfoList", value: function(e3) {
  3267. var t2 = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], n3 = this.getLocalConversation(e3);
  3268. if (n3 && n3.groupAtInfoList.length > 0) {
  3269. if (n3.clearGroupAtInfoList(), xe.l("".concat(this._n, ".clearGroupAtInfoList conversationID:").concat(e3)), n3.type === S.CONV_TOPIC) {
  3270. var o2 = n3.groupAtInfoList, s3 = this.getModule(wn), a2 = e3.replace(S.CONV_GROUP, "");
  3271. s3.onConversationProxy({ topicID: a2, groupAtInfoList: o2 });
  3272. }
  3273. true === t2 && this.emitConversationUpdate(true, false);
  3274. }
  3275. } }, { key: "updateReadReceiptInfo", value: function(e3) {
  3276. var t2 = this, n3 = e3.userID, o2 = void 0 === n3 ? void 0 : n3, s3 = e3.groupID, a2 = void 0 === s3 ? void 0 : s3, r2 = e3.readReceiptList;
  3277. if (!jt(r2)) {
  3278. var i2 = [];
  3279. if (at(o2)) {
  3280. if (!at(a2)) {
  3281. var u2 = "".concat(S.CONV_GROUP).concat(a2);
  3282. r2.forEach(function(e4) {
  3283. var n4 = e4.tinyID, o3 = e4.clientTime, s4 = e4.random, r3 = e4.readCount, c3 = e4.unreadCount, l2 = "".concat(n4, "-").concat(o3, "-").concat(s4), p2 = t2._messageListHandler.getLocalMessage(u2, l2), d2 = { groupID: a2, messageID: l2, readCount: 0, unreadCount: 0 };
  3284. p2 && ($e(r3) && (p2.readReceiptInfo.readCount = r3, d2.readCount = r3), $e(c3) && (p2.readReceiptInfo.unreadCount = c3, d2.unreadCount = c3), i2.push(d2));
  3285. });
  3286. }
  3287. } else {
  3288. var c2 = "".concat(S.CONV_C2C).concat(o2);
  3289. r2.forEach(function(e4) {
  3290. var n4 = e4.tinyID, s4 = e4.clientTime, a3 = e4.random, r3 = "".concat(n4, "-").concat(s4, "-").concat(a3), u3 = t2._messageListHandler.getLocalMessage(c2, r3);
  3291. if (u3) {
  3292. u3.readReceiptInfo.isPeerRead = true;
  3293. var l2 = { userID: o2, messageID: r3, isPeerRead: true };
  3294. i2.push(l2);
  3295. }
  3296. });
  3297. }
  3298. i2.length > 0 && this.emitOuterEvent(E.MESSAGE_READ_RECEIPT_RECEIVED, i2);
  3299. }
  3300. } }, { key: "recomputeGroupUnreadCount", value: function(e3) {
  3301. var t2 = e3.conversationID, n3 = e3.count, o2 = this.getLocalConversation(t2);
  3302. if (o2) {
  3303. var s3 = o2.unreadCount, a2 = s3 - n3;
  3304. a2 < 0 && (a2 = 0), o2.unreadCount = a2, xe.l("".concat(this._n, ".recomputeGroupUnreadCount from ").concat(s3, " to ").concat(a2, ", conversationID:").concat(t2));
  3305. }
  3306. } }, { key: "updateIsRead", value: function(e3) {
  3307. var t2 = this.getLocalConversation(e3), n3 = this.getLocalMessageList(e3);
  3308. if (t2 && 0 !== n3.length && !kt(t2.type)) {
  3309. for (var o2 = [], s3 = 0, a2 = n3.length; s3 < a2; s3++)
  3310. "in" !== n3[s3].flow ? "out" !== n3[s3].flow || n3[s3].isRead || n3[s3].setIsRead(true) : o2.push(n3[s3]);
  3311. var r2 = 0;
  3312. if (t2.type === S.CONV_C2C) {
  3313. var i2 = o2.slice(-t2.unreadCount).filter(function(e4) {
  3314. return e4.isRevoked;
  3315. }).length;
  3316. r2 = o2.length - t2.unreadCount - i2;
  3317. } else
  3318. r2 = o2.length - t2.unreadCount;
  3319. for (var u2 = 0; u2 < r2 && !o2[u2].isRead; u2++)
  3320. o2[u2].setIsRead(true);
  3321. }
  3322. } }, { key: "deleteGroupAtTips", value: function(e3) {
  3323. var t2 = this, n3 = "".concat(this._n, ".deleteGroupAtTips");
  3324. xe.l("".concat(n3));
  3325. var o2 = this._conversationMap.get(e3);
  3326. if (!o2)
  3327. return Promise.resolve();
  3328. var s3 = o2.groupAtInfoList;
  3329. if (0 === s3.length)
  3330. return Promise.resolve();
  3331. var a2 = void 0;
  3332. e3.startsWith(S.CONV_GROUP) && (a2 = e3.replace(S.CONV_GROUP, ""));
  3333. var r2 = m(s3);
  3334. if ((Tt({ groupID: a2 }) || Dt(a2)) && 0 === (r2 = s3.filter(function(e4) {
  3335. return !e4.atTypeArray.includes(S.CONV_AT_ALL);
  3336. })).length)
  3337. return this.clearGroupAtInfoList(e3, false), Promise.resolve();
  3338. var i2 = this.getMyUserID();
  3339. return this.request({ protocolName: bo, requestData: { messageListToDelete: r2.map(function(e4) {
  3340. return { from: e4.from, to: i2, messageSeq: e4.__sequence, messageRandom: e4.__random, groupID: at(e4.topicID) ? e4.groupID : e4.topicID };
  3341. }) } }).then(function() {
  3342. return xe.l("".concat(n3, " ok. count:").concat(s3.length)), t2.clearGroupAtInfoList(e3, false), Promise.resolve();
  3343. }).catch(function(e4) {
  3344. return xe.e("".concat(n3, " failed. error:"), e4), Ja(e4);
  3345. });
  3346. } }, { key: "appendToMessageList", value: function(e3) {
  3347. this._messageListHandler.pushIn(e3);
  3348. } }, { key: "setMessageRandom", value: function(e3) {
  3349. this.singlyLinkedList.set(e3.random);
  3350. } }, { key: "deleteMessageRandom", value: function(e3) {
  3351. this.singlyLinkedList.delete(e3.random);
  3352. } }, { key: "pushIntoMessageList", value: function(e3, t2, n3) {
  3353. return !(!this._messageListHandler.pushIn(t2, n3) || this._isMessageFromCurrentInstance(t2) && !n3) && (e3.push(t2), true);
  3354. } }, { key: "_isMessageFromCurrentInstance", value: function(e3) {
  3355. return this.singlyLinkedList.has(e3.random);
  3356. } }, { key: "revoke", value: function(e3, t2, n3) {
  3357. return this._messageListHandler.revoke(e3, t2, n3);
  3358. } }, { key: "getPeerReadTime", value: function(e3) {
  3359. return this._peerReadTimeMap.get(e3);
  3360. } }, { key: "recordPeerReadTime", value: function(e3, t2) {
  3361. this._peerReadTimeMap.has(e3) ? this._peerReadTimeMap.get(e3) < t2 && this._peerReadTimeMap.set(e3, t2) : this._peerReadTimeMap.set(e3, t2);
  3362. } }, { key: "updateMessageIsPeerReadProperty", value: function(e3, t2) {
  3363. if (e3.startsWith(S.CONV_C2C) && t2 > 0) {
  3364. var n3 = this._messageListHandler.updateMessageIsPeerReadProperty(e3, t2);
  3365. if (n3.length > 0 && this.emitOuterEvent(E.MESSAGE_READ_BY_PEER, n3), this._conversationMap.has(e3)) {
  3366. var o2 = this._conversationMap.get(e3).lastMessage;
  3367. jt(o2) || o2.fromAccount === this.getMyUserID() && o2.lastTime <= t2 && !o2.isPeerRead && (o2.isPeerRead = true, this.emitConversationUpdate(true, false));
  3368. }
  3369. }
  3370. } }, { key: "updateMessageIsModifiedProperty", value: function(e3) {
  3371. this._messageListHandler.updateMessageIsModifiedProperty(e3);
  3372. } }, { key: "setCompleted", value: function(e3) {
  3373. xe.l("".concat(this._n, ".setCompleted. conversationID:").concat(e3)), this._completedMap.set(e3, true);
  3374. } }, { key: "updateRoamingMessageKeyAndTime", value: function(e3, t2, n3) {
  3375. this._roamingMessageKeyAndTimeMap.set(e3, { messageKey: t2, lastMessageTime: n3 });
  3376. } }, { key: "updateRoamingMessageSequence", value: function(e3, t2) {
  3377. this._roamingMessageSequenceMap.set(e3, t2);
  3378. } }, { key: "getConversationList", value: function(e3) {
  3379. var t2 = this, n3 = "getConversationList", o2 = "".concat(this._n, ".").concat(n3), s3 = "pagingStatus:".concat(this._pagingStatus, ", local conversation count:").concat(this._conversationMap.size, ", options:").concat(e3);
  3380. if (xe.l("".concat(o2, ". ").concat(s3)), this._pagingStatus === Zt.REJECTED) {
  3381. var a2 = new ka(n3);
  3382. return a2.setMessage(s3), this.syncConversationList().then(function() {
  3383. a2.setNetworkType(t2.getNetworkType()).end();
  3384. var n4 = t2._getConversationList(e3);
  3385. return Ka({ conversationList: n4, isSyncCompleted: t2._isSyncCompleted() });
  3386. }).catch(function(e4) {
  3387. return t2.probeNetwork().then(function(t3) {
  3388. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  3389. a2.setError(e4, o3, s4).end();
  3390. }), xe.e("".concat(o2, " failed. error:"), e4), Ja(e4);
  3391. });
  3392. }
  3393. if (0 === this._conversationMap.size) {
  3394. var r2 = new ka(n3);
  3395. return r2.setMessage(s3), this.syncConversationList().then(function() {
  3396. r2.setNetworkType(t2.getNetworkType()).end();
  3397. var n4 = t2._getConversationList(e3);
  3398. return Ka({ conversationList: n4, isSyncCompleted: t2._isSyncCompleted() });
  3399. }).catch(function(e4) {
  3400. return t2.probeNetwork().then(function(t3) {
  3401. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  3402. r2.setError(e4, o3, s4).end();
  3403. }), xe.e("".concat(o2, " failed. error:"), e4), Ja(e4);
  3404. });
  3405. }
  3406. var i2 = this._getConversationList(e3);
  3407. return xe.l("".concat(o2, ". returned conversation count:").concat(i2.length)), za({ conversationList: i2, isSyncCompleted: this._isSyncCompleted() });
  3408. } }, { key: "_getConversationList", value: function(e3) {
  3409. if (at(e3))
  3410. return this.getLocalConversationList();
  3411. if (st(e3))
  3412. return 0 === e3.length ? [] : this.getLocalConversationList().filter(function(t3) {
  3413. return e3.includes(t3.conversationID);
  3414. });
  3415. if (ot(e3)) {
  3416. var t2 = e3.type, n3 = e3.markType, o2 = e3.groupName;
  3417. return this.getLocalConversationList().filter(function(e4) {
  3418. return (t2 !== S.CONV_C2C && t2 !== S.CONV_GROUP || e4.type === t2) && (!et(o2) || e4.conversationGroupList.includes(o2)) && (!$e(n3) || e4.markList.includes(n3));
  3419. });
  3420. }
  3421. return [];
  3422. } }, { key: "_handleC2CPeerReadTime", value: function() {
  3423. var e3, t2 = D(this._conversationMap);
  3424. try {
  3425. for (t2.s(); !(e3 = t2.n()).done; ) {
  3426. var n3 = v(e3.value, 2), o2 = n3[0], s3 = n3[1];
  3427. s3.type === S.CONV_C2C && (xe.d("".concat(this._n, "._handleC2CPeerReadTime conversationID:").concat(o2, " peerReadTime:").concat(s3.peerReadTime)), this.recordPeerReadTime(o2, s3.peerReadTime));
  3428. }
  3429. } catch (a2) {
  3430. t2.e(a2);
  3431. } finally {
  3432. t2.f();
  3433. }
  3434. } }, { key: "_isPagingGetGroupListCompleted", value: function() {
  3435. return this.getModule(Un).isPagingGetCompleted();
  3436. } }, { key: "_getLocalGroupCount", value: function() {
  3437. return this.getModule(Un).getLocalGroupList().length;
  3438. } }, { key: "_hasLocalGroup", value: function(e3) {
  3439. return this.getModule(Un).hasLocalGroup(e3.replace(S.CONV_GROUP, ""));
  3440. } }, { key: "getConversationProfile", value: function(e3) {
  3441. var t2, n3 = this;
  3442. if ((t2 = this._conversationMap.has(e3) ? this._conversationMap.get(e3) : new _r({ conversationID: e3, type: e3.slice(0, 3) === S.CONV_C2C ? S.CONV_C2C : S.CONV_GROUP }, this.isIntl()))._isInfoCompleted || t2.type === S.CONV_SYSTEM)
  3443. return za({ conversation: t2 });
  3444. if (St(e3) && !this._hasLocalGroup(e3))
  3445. return za({ conversation: t2 });
  3446. var o2 = "".concat(this._n, ".").concat("getConversationProfile"), s3 = new ka("getConversationProfile");
  3447. return xe.l("".concat(o2, ". conversationID:").concat(e3, " remark:").concat(t2.remark, " lastMessage:"), t2.lastMessage), this._updateUserOrGroupProfileCompletely(t2).then(function(a2) {
  3448. s3.setNetworkType(n3.getNetworkType()).setMessage("conversationID:".concat(e3, " unreadCount:").concat(a2.data.conversation.unreadCount)).end();
  3449. var r2 = n3.getModule(Pn);
  3450. if (r2 && t2.type === S.CONV_C2C) {
  3451. var i2 = e3.replace(S.CONV_C2C, "");
  3452. if (r2.isMyFriend(i2)) {
  3453. var u2 = r2.getFriendRemark(i2);
  3454. t2.remark !== u2 && (t2.remark = u2, xe.l("".concat(o2, ". conversationID:").concat(e3, " patch remark:").concat(t2.remark)));
  3455. }
  3456. }
  3457. return xe.l("".concat(o2, " ok. conversationID:").concat(e3)), a2;
  3458. }).catch(function(t3) {
  3459. return n3.probeNetwork().then(function(n4) {
  3460. var o3 = v(n4, 2), a2 = o3[0], r2 = o3[1];
  3461. s3.setError(t3, a2, r2).setMessage("conversationID:".concat(e3)).end();
  3462. }), xe.e("".concat(o2, " failed. error:"), t3), Ja(t3);
  3463. });
  3464. } }, { key: "_updateUserOrGroupProfileCompletely", value: function(e3) {
  3465. var t2 = this;
  3466. return e3.type === S.CONV_C2C ? this.getModule(On).getUserProfile({ userIDList: [e3.toAccount] }).then(function(n3) {
  3467. var o2 = n3.data;
  3468. return 0 === o2.length ? Ja(new Wa({ code: da.USER_OR_GROUP_NOT_FOUND })) : (e3.userProfile = o2[0], e3._isInfoCompleted = true, t2._unshiftConversation(e3), za({ conversation: e3 }));
  3469. }) : this.getModule(Un).getGroupProfile({ groupID: e3.toAccount }).then(function(n3) {
  3470. return e3.groupProfile = n3.data.group, e3._isInfoCompleted = true, t2._unshiftConversation(e3), za({ conversation: e3 });
  3471. });
  3472. } }, { key: "_unshiftConversation", value: function(e3) {
  3473. e3 instanceof _r && !this._conversationMap.has(e3.conversationID) && (this._conversationMap = new Map([[e3.conversationID, e3]].concat(m(this._conversationMap))), this._setStorageConversationList(), this.emitConversationUpdate(true, false));
  3474. } }, { key: "_onProfileUpdated", value: function(e3) {
  3475. var t2 = this;
  3476. e3.data.forEach(function(e4) {
  3477. var n3 = e4.userID;
  3478. if (n3 === t2.getMyUserID())
  3479. t2._onMyProfileModified({ latestNick: e4.nick, latestAvatar: e4.avatar });
  3480. else {
  3481. var o2 = t2._conversationMap.get("".concat(S.CONV_C2C).concat(n3));
  3482. o2 && (o2.userProfile = e4);
  3483. }
  3484. });
  3485. } }, { key: "_isSyncCompleted", value: function() {
  3486. return this._pagingStatus === Zt.RESOLVED;
  3487. } }, { key: "_errorLog", value: function(e3, t2, n3, o2) {
  3488. var s3 = new Error("Params validate failed."), a2 = "".concat(this.getErrorMessage("API_REFER")).concat(e3);
  3489. throw xe.w("[".concat(e3, "] | ").concat(t2, " | ").concat(this.getErrorMessage(n3, o2), ", ").concat(a2)), xe.e("[".concat(e3, "] Invalid ").concat(t2, ": type check failed for ").concat(t2, ".")), s3;
  3490. } }, { key: "_isValidConversationID", value: function(e3) {
  3491. return Et(e3) || St(e3) || kt(e3);
  3492. } }, { key: "deleteConversation", value: function(e3) {
  3493. var t2 = this, n3 = "deleteConversation";
  3494. return et(e3) || nt(e3) || this._errorLog(n3, "options", "StringOrObjectRequiredLog"), et(e3) ? (this._isValidConversationID(e3) || this._errorLog(n3, "options", "InvalidConversationID", e3), xe.l("".concat(this._n, ".").concat(n3, " conversationID:").concat(e3)), this.deleteConversationList({ conversationIDList: [e3], flag: 1 })) : (st(e3.conversationIDList) || this._errorLog(n3, "conversationIDList", "ArrayRequiredLog"), 0 === e3.conversationIDList.length && this._errorLog(n3, "conversationIDList", "NonEmptyArrayLog"), e3.conversationIDList.forEach(function(e4) {
  3495. t2._isValidConversationID(e4) || t2._errorLog(n3, "conversationIDList", "InvalidConversationID", e4);
  3496. }), "clearHistoryMessage" in e3 && "boolean" != typeof e3.clearHistoryMessage && this._errorLog(n3, "clearHistoryMessage", "BooleanRequiredLog"), e3.conversationIDList.length > 100 && (e3.conversationIDList = e3.conversationIDList.slice(0, 100)), this.deleteConversationList(e3));
  3497. } }, { key: "deleteConversationList", value: function(e3) {
  3498. var t2 = this, n3 = e3.conversationIDList, o2 = void 0 === n3 ? [] : n3, s3 = e3.clearHistoryMessage, a2 = void 0 === s3 || s3, r2 = e3.flag, i2 = void 0 === r2 ? 0 : r2, u2 = "".concat(this._n, ".").concat("deleteConversationList");
  3499. xe.l("".concat(u2, " conversationIDList.length:").concat(o2.length, " clearHistoryMessage:").concat(a2));
  3500. var c2 = new ka("deleteConversationList");
  3501. return c2.setMessage("conversationIDList:".concat(o2)), Promise.all([this.rmLocalOnlyConversationList(o2), this.rmLocalAndRemoteConversationList(o2, a2)]).then(function(e4) {
  3502. c2.setNetworkType(t2.getNetworkType()).end();
  3503. var n4 = [].concat(m(e4[0]), m(e4[1]));
  3504. return 0 === n4.length ? Ja(new Wa({ code: da.CONVERSATION_NOT_FOUND })) : (xe.l("".concat(u2, " ok")), za(1 === i2 ? { conversationID: n4[0] } : { conversationIDList: n4 }));
  3505. }).catch(function(e4) {
  3506. return t2.probeNetwork().then(function(t3) {
  3507. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  3508. c2.setError(e4, o3, s4).end();
  3509. }), xe.e("".concat(u2, " failed. error:"), e4), Ja(e4);
  3510. });
  3511. } }, { key: "rmLocalOnlyConversationList", value: function(e3) {
  3512. var t2 = this;
  3513. return e3.filter(function(e4) {
  3514. if (!t2._conversationMap.has(e4))
  3515. return false;
  3516. var n3 = t2.getLocalConversation(e4).type;
  3517. return n3 !== S.CONV_GROUP || t2._hasLocalGroup(e4) ? n3 === S.CONV_SYSTEM && (t2.getModule(Un).deleteGroupSystemNotice({ messageList: t2._messageListHandler.getLocalMessageList(e4) }), t2.deleteLocalConversation(e4), true) : (t2.deleteLocalConversation(e4), true);
  3518. });
  3519. } }, { key: "rmLocalAndRemoteConversationList", value: function(e3, t2) {
  3520. var n3 = this, o2 = { fromAccount: this.getMyUserID(), conversationList: [], clearHistoryMessage: t2 ? 1 : 0 };
  3521. return e3.forEach(function(e4) {
  3522. if (n3._conversationMap.has(e4)) {
  3523. var t3 = n3.getLocalConversation(e4).type;
  3524. t3 === S.CONV_C2C ? o2.conversationList.push({ toAccount: e4.replace(t3, ""), type: 1 }) : t3 === S.CONV_GROUP && n3._hasLocalGroup(e4) && o2.conversationList.push({ toGroupID: e4.replace(t3, ""), type: 2 });
  3525. }
  3526. }), 0 === o2.conversationList.length ? [] : this.request({ protocolName: Go, requestData: o2 }).then(function(e4) {
  3527. var t3 = [];
  3528. return e4.data.resultList.length > 0 && e4.data.resultList.map(function(e5) {
  3529. if (0 === e5.code) {
  3530. var n4 = 1 === e5.type ? "".concat(S.CONV_C2C).concat(e5.to) : "".concat(S.CONV_GROUP).concat(e5.groupID);
  3531. t3.push(n4);
  3532. }
  3533. }), n3.deleteLocalConversationList(t3), t3;
  3534. });
  3535. } }, { key: "clearHistoryMessage", value: function(e3) {
  3536. var t2 = this, n3 = { fromAccount: this.getMyUserID(), toAccount: void 0, type: void 0, toGroupID: void 0 };
  3537. if (!this._conversationMap.has(e3))
  3538. return Ja({ code: da.CONVERSATION_NOT_FOUND });
  3539. var o2 = this._conversationMap.get(e3).type;
  3540. if (o2 === S.CONV_C2C)
  3541. n3.type = 1, n3.toAccount = e3.replace(S.CONV_C2C, "");
  3542. else {
  3543. if (o2 !== S.CONV_GROUP)
  3544. return o2 === S.CONV_SYSTEM ? (this.getModule(Un).deleteGroupSystemNotice({ messageList: this._messageListHandler.getLocalMessageList(e3) }), za({ conversationID: e3 })) : Ja({ code: da.CONVERSATION_UN_RECORDED_TYPE });
  3545. n3.type = 2, n3.toGroupID = e3.replace(S.CONV_GROUP, "");
  3546. }
  3547. var s3 = "".concat(this._n, ".").concat("clearHistoryMessage"), a2 = new ka("clearHistoryMessage");
  3548. return a2.setMessage("conversationID:".concat(e3)), xe.l("".concat(s3, ". conversationID:").concat(e3)), this.setMessageRead({ conversationID: e3 }).then(function() {
  3549. return t2.request({ protocolName: Uo, requestData: n3 });
  3550. }).then(function() {
  3551. a2.setNetworkType(t2.getNetworkType()).end(), xe.l("".concat(s3, " ok")), t2._messageListHandler.removeByConversationID(e3), t2.setCompleted(e3);
  3552. var n4 = t2.getLocalConversation(e3);
  3553. return n4 && (n4.updateLastMessage(), t2._sortConversationListAndEmitEvent()), za({ conversationID: e3 });
  3554. }).catch(function(e4) {
  3555. return t2.probeNetwork().then(function(t3) {
  3556. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  3557. a2.setError(e4, o3, s4).end();
  3558. }), xe.e("".concat(s3, " failed. error:"), e4), Ja(e4);
  3559. });
  3560. } }, { key: "pinConversation", value: function(e3) {
  3561. var t2 = this, n3 = e3.conversationID, o2 = e3.isPinned;
  3562. if (!this._conversationMap.has(n3))
  3563. return Ja({ code: da.CONVERSATION_NOT_FOUND });
  3564. var s3 = this.getLocalConversation(n3);
  3565. if (s3.isPinned === o2)
  3566. return za({ conversationID: n3 });
  3567. var a2 = "".concat(this._n, ".").concat("pinConversation"), r2 = new ka("pinConversation");
  3568. r2.setMessage("conversationID:".concat(n3, " isPinned:").concat(o2)), xe.l("".concat(a2, ". conversationID:").concat(n3, " isPinned:").concat(o2));
  3569. var i2 = null;
  3570. return Et(n3) ? i2 = { type: 1, toAccount: n3.replace(S.CONV_C2C, "") } : St(n3) && (i2 = { type: 2, groupID: n3.replace(S.CONV_GROUP, "") }), this.request({ protocolName: Po, requestData: { fromAccount: this.getMyUserID(), operationType: true === o2 ? 1 : 2, itemList: [i2] } }).then(function() {
  3571. return r2.setNetworkType(t2.getNetworkType()).end(), xe.l("".concat(a2, " ok")), s3.isPinned !== o2 && (s3.isPinned = o2, t2._sortConversationListAndEmitEvent()), Ka({ conversationID: n3 });
  3572. }).catch(function(e4) {
  3573. return t2.probeNetwork().then(function(t3) {
  3574. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  3575. r2.setError(e4, o3, s4).end();
  3576. }), xe.e("".concat(a2, " failed. error:"), e4), Ja(e4);
  3577. });
  3578. } }, { key: "setMessageRemindType", value: function(e3) {
  3579. return this._messageRemindHandler.set(e3);
  3580. } }, { key: "patchMessageRemindType", value: function(e3) {
  3581. var t2 = e3.ID, n3 = e3.isC2CConversation, o2 = e3.messageRemindType, s3 = false, a2 = this.getLocalConversation(n3 ? "".concat(S.CONV_C2C).concat(t2) : "".concat(S.CONV_GROUP).concat(t2));
  3582. return a2 && a2.messageRemindType !== o2 && (a2.messageRemindType = o2, s3 = true), xe.d("".concat(this._n, ".patchMessageRemindType options:"), e3, "ret:".concat(s3)), s3;
  3583. } }, { key: "onC2CMessageRemindTypeSynced", value: function(e3) {
  3584. var t2 = this, n3 = "".concat(this._n, ".onC2CMessageRemindTypeSynced");
  3585. xe.d(n3, e3), e3.dataList.forEach(function(e4) {
  3586. if (!jt(e4.muteNotificationsSync)) {
  3587. var o2, s3 = e4.muteNotificationsSync, a2 = s3.to, r2 = s3.updateSequence, i2 = s3.muteFlag;
  3588. t2._messageRemindHandler.setUpdateSequence(r2), 0 === i2 ? o2 = S.MSG_REMIND_ACPT_AND_NOTE : 1 === i2 ? o2 = S.MSG_REMIND_DISCARD : 2 === i2 && (o2 = S.MSG_REMIND_ACPT_NOT_NOTE);
  3589. var u2 = 0;
  3590. t2.patchMessageRemindType({ ID: a2, isC2CConversation: true, messageRemindType: o2 }) && (u2 += 1), xe.l("".concat(n3, " updateCount:").concat(u2)), u2 >= 1 && t2.emitConversationUpdate(true, false);
  3591. }
  3592. });
  3593. } }, { key: "onGroupMessageRemindTypeSynced", value: function(e3) {
  3594. xe.d("".concat(this._n, ".onGroupMessageRemindTypeSynced options:"), e3), this._messageRemindHandler.onGroupMessageRemindTypeUpdated(e3);
  3595. } }, { key: "deleteLocalConversation", value: function(e3) {
  3596. var t2 = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], n3 = this._conversationMap.has(e3);
  3597. if (xe.d("".concat(this._n, ".deleteLocalConversation conversationID:").concat(e3, " has:").concat(n3)), n3 && (this._conversationMap.delete(e3), this._roamingMessageKeyAndTimeMap.has(e3) && this._roamingMessageKeyAndTimeMap.delete(e3), this._roamingMessageSequenceMap.has(e3) && this._roamingMessageSequenceMap.delete(e3), this._setStorageConversationList(), this._messageListHandler.removeByConversationID(e3), this._completedMap.delete(e3), t2)) {
  3598. var o2 = !this._isTopicConversation(e3);
  3599. this.emitConversationUpdate(o2, false);
  3600. }
  3601. } }, { key: "deleteLocalConversationList", value: function(e3) {
  3602. var t2 = this, n3 = 0, o2 = false;
  3603. e3.forEach(function(e4) {
  3604. t2._conversationMap.has(e4) && (n3 += t2._conversationMap.get(e4).unreadCount || 0, t2.deleteLocalConversation(e4, false), o2 = true);
  3605. }), xe.l("".concat(this._n, ".deleteLocalConversationList conversationIDList.length:").concat(e3.length, " isConvIDExisted:").concat(o2)), o2 && (this.emitConversationUpdate(true, false), n3 > 0 && this.emitTotalUnreadMessageCountUpdate());
  3606. } }, { key: "isMessageSentByCurrentInstance", value: function(e3) {
  3607. return !(!this._messageListHandler.hasLocalMessage(e3.conversationID, e3.ID) && !this.singlyLinkedList.has(e3.random));
  3608. } }, { key: "modifyMessageList", value: function(e3) {
  3609. if (e3.startsWith(S.CONV_C2C) && this._conversationMap.has(e3)) {
  3610. var t2 = this._conversationMap.get(e3), n3 = Date.now();
  3611. this._messageListHandler.modifyMessageSentByPeer({ conversationID: e3, latestNick: t2.userProfile.nick, latestAvatar: t2.userProfile.avatar });
  3612. var o2 = this.getModule(On).getNickAndAvatarByUserID(this.getMyUserID());
  3613. this._messageListHandler.modifyMessageSentByMe({ conversationID: e3, latestNick: o2.nick, latestAvatar: o2.avatar }), xe.l("".concat(this._n, ".modifyMessageList conversationID:").concat(e3, " cost ").concat(Date.now() - n3, " ms"));
  3614. }
  3615. } }, { key: "updateUserProfileSpecifiedKey", value: function(e3) {
  3616. xe.l("".concat(this._n, ".updateUserProfileSpecifiedKey options:"), e3);
  3617. var t2 = e3.conversationID, n3 = e3.nick, o2 = e3.avatar;
  3618. if (this._conversationMap.has(t2)) {
  3619. var s3 = this._conversationMap.get(t2).userProfile;
  3620. et(n3) && s3.nick !== n3 && (s3.nick = n3), et(o2) && s3.avatar !== o2 && (s3.avatar = o2), this.emitConversationUpdate(true, false);
  3621. }
  3622. } }, { key: "_onMyProfileModified", value: function(e3) {
  3623. var n3 = this, o2 = this.getLocalConversationList(), s3 = Date.now();
  3624. o2.forEach(function(o3) {
  3625. n3.modifyMessageSentByMe(t({ conversationID: o3.conversationID }, e3));
  3626. }), xe.l("".concat(this._n, "._onMyProfileModified. modify all messages sent by me, cost ").concat(Date.now() - s3, " ms"));
  3627. } }, { key: "modifyMessageSentByMe", value: function(e3) {
  3628. this._messageListHandler.modifyMessageSentByMe(e3);
  3629. } }, { key: "getLatestMessageSentByMe", value: function(e3) {
  3630. return this._messageListHandler.getLatestMessageSentByMe(e3);
  3631. } }, { key: "modifyMessageSentByPeer", value: function(e3) {
  3632. this._messageListHandler.modifyMessageSentByPeer(e3);
  3633. } }, { key: "getLatestMessageSentByPeer", value: function(e3) {
  3634. return this._messageListHandler.getLatestMessageSentByPeer(e3);
  3635. } }, { key: "pushIntoNoticeResult", value: function(e3, t2) {
  3636. return !(!this._messageListHandler.pushIn(t2) || this.singlyLinkedList.has(t2.random)) && (e3.push(t2), true);
  3637. } }, { key: "getLocalLastMessage", value: function(e3) {
  3638. return this._messageListHandler.getLocalLastMessage(e3);
  3639. } }, { key: "checkAndPatchRemark", value: function() {
  3640. var e3 = Promise.resolve();
  3641. if (0 === this._conversationMap.size)
  3642. return e3;
  3643. var t2 = this.getModule(Pn);
  3644. if (!t2)
  3645. return e3;
  3646. var n3 = m(this._conversationMap.values()).filter(function(e4) {
  3647. return e4.type === S.CONV_C2C;
  3648. });
  3649. if (0 === n3.length)
  3650. return e3;
  3651. var o2 = 0;
  3652. return n3.forEach(function(e4) {
  3653. var n4 = e4.conversationID.replace(S.CONV_C2C, "");
  3654. if (t2.isMyFriend(n4)) {
  3655. var s3 = t2.getFriendRemark(n4);
  3656. e4.remark !== s3 && (e4.remark = s3, o2 += 1);
  3657. }
  3658. }), xe.l("".concat(this._n, ".checkAndPatchRemark. c2c conversation count:").concat(n3.length, ", patched count:").concat(o2)), e3;
  3659. } }, { key: "updateTopicConversation", value: function(e3) {
  3660. this._updateLocalConversationList({ conversationOptionsList: e3, isFromGetConversations: true });
  3661. } }, { key: "sendReadReceipt", value: function(e3) {
  3662. var t2 = e3[0], n3 = null;
  3663. return t2.conversationType === S.CONV_C2C ? n3 = this._m.getModule(Gn) : t2.conversationType === S.CONV_GROUP && (n3 = this._m.getModule(Un)), n3 ? n3.sendReadReceipt(e3) : Ja({ code: da.CANNOT_FIND_MODULE });
  3664. } }, { key: "getReadReceiptList", value: function(e3) {
  3665. var t2 = e3[0], n3 = null;
  3666. return t2.conversationType === S.CONV_C2C ? n3 = this._m.getModule(Gn) : t2.conversationType === S.CONV_GROUP && (n3 = this._m.getModule(Un)), n3 ? n3.getReadReceiptList(e3) : Ja({ code: da.CANNOT_FIND_MODULE });
  3667. } }, { key: "getLastMessageTime", value: function(e3) {
  3668. var t2 = this.getLocalConversation(e3);
  3669. return t2 ? t2.lastMessage.lastTime : 0;
  3670. } }, { key: "getTotalUnreadMessageCount", value: function() {
  3671. var e3 = this.getLocalConversationList(), t2 = 0;
  3672. return e3.forEach(function(e4) {
  3673. e4.type !== S.CONV_SYSTEM && ("" !== e4.messageRemindType && e4.messageRemindType !== S.MSG_REMIND_ACPT_AND_NOTE || (t2 += e4.unreadCount));
  3674. }), t2;
  3675. } }, { key: "emitTotalUnreadMessageCountUpdate", value: function() {
  3676. var e3 = this.getTotalUnreadMessageCount();
  3677. this._convTotalUnreadCount !== e3 && (xe.l("".concat(this._n, ".emitTotalUnreadMessageCountUpdate from ").concat(this._convTotalUnreadCount, " to ").concat(e3)), this._convTotalUnreadCount = e3, this.emitOuterEvent(E.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED));
  3678. } }, { key: "reset", value: function() {
  3679. xe.l("".concat(this._n, ".reset")), this._pagingStatus = Zt.NOT_START, this._messageListHandler.reset(), this._messageRemindHandler.reset(), this._roamingMessageKeyAndTimeMap.clear(), this._roamingMessageSequenceMap.clear(), this.singlyLinkedList.reset(), this._peerReadTimeMap.clear(), this._completedMap.clear(), this._conversationMap.clear(), this._pagingTimeStamp = 0, this._pagingStartIndex = 0, this._pagingPinnedTimeStamp = 0, this._pagingPinnedStartIndex = 0, this._remoteGroupReadSequenceMap.clear(), this._convTotalUnreadCount = 0, this._pagingGetCostList.length = 0, this.resetReady();
  3680. } }]), s2;
  3681. }(ro), mr = function() {
  3682. function e2(t2) {
  3683. o(this, e2), this._groupModule = t2, this._n = "GroupTipsHandler", this._cachedGroupTipsMap = /* @__PURE__ */ new Map(), this._checkCountMap = /* @__PURE__ */ new Map(), this.MAX_CHECK_COUNT = 4, this._getTopicPendingMap = /* @__PURE__ */ new Map();
  3684. }
  3685. return a(e2, [{ key: "onCheckTimer", value: function(e3) {
  3686. e3 % 1 == 0 && this._cachedGroupTipsMap.size > 0 && this._checkCachedGroupTips();
  3687. } }, { key: "_checkCachedGroupTips", value: function() {
  3688. var e3 = this;
  3689. this._cachedGroupTipsMap.forEach(function(t2, n2) {
  3690. var o2 = e3._checkCountMap.get(n2), s2 = e3._groupModule.hasLocalGroup(n2);
  3691. xe.l("".concat(e3._n, "._checkCachedGroupTips groupID:").concat(n2, " hasLocalGroup:").concat(s2, " checkCount:").concat(o2)), s2 ? (e3._notifyCachedGroupTips(n2), e3._checkCountMap.delete(n2), e3._groupModule.deleteUnjoinedAVChatRoom(n2)) : o2 >= e3.MAX_CHECK_COUNT ? (e3._deleteCachedGroupTips(n2), e3._checkCountMap.delete(n2)) : (o2++, e3._checkCountMap.set(n2, o2));
  3692. });
  3693. } }, { key: "onNewGroupTips", value: function(e3) {
  3694. xe.d("".concat(this._n, ".onReceiveGroupTips count:").concat(e3.dataList.length));
  3695. var t2 = this.newGroupTipsStoredAndSummary(e3), n2 = t2.eventDataList, o2 = t2.result, s2 = t2.AVChatRoomMessageList;
  3696. (s2.length > 0 && this._groupModule.onAVChatRoomMessage(s2), n2.length > 0) && (this._groupModule.updateNextMessageSeq(n2), this._groupModule.getModule(Fn).onNewMessage({ conversationOptionsList: n2, isInstantMessage: true }));
  3697. o2.length > 0 && (this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED, o2), this.handleMessageList(o2));
  3698. } }, { key: "newGroupTipsStoredAndSummary", value: function(e3) {
  3699. for (var n2 = this, o2 = e3.event, s2 = e3.dataList, a2 = null, r2 = [], i2 = [], u2 = {}, c2 = [], l2 = function(e4, l3) {
  3700. var p3 = yt(s2[e4]);
  3701. if (6 === o2) {
  3702. if (n2._groupModule.isGroupAttributesUpdatedNotice(p3))
  3703. return "continue";
  3704. if (n2._groupModule.isGroupCountersNotice(p3))
  3705. return "continue";
  3706. }
  3707. var d3 = p3.groupProfile, g2 = d3.groupID, _2 = d3.communityType, h2 = void 0 === _2 ? 0 : _2, f2 = d3.topicID, v2 = void 0 === f2 ? void 0 : f2, m2 = d3.invisible, M2 = void 0, y2 = n2._groupModule.isMessageFromTopic(h2, v2);
  3708. if (y2) {
  3709. M2 = S.CONV_TOPIC, p3.to = v2;
  3710. var I2 = n2._groupModule.getModule(wn);
  3711. I2.hasLocalTopic(g2, v2) || n2._getTopicPendingMap.has(v2) || (n2._getTopicPendingMap.set(v2, 1), I2.getTopicList({ groupID: g2, topicIDList: [v2] }).finally(function() {
  3712. n2._getTopicPendingMap.delete(v2);
  3713. }));
  3714. }
  3715. var C2 = n2._groupModule.hasLocalGroup(g2);
  3716. if (!C2 && n2._groupModule.isUnjoinedAVChatRoom(g2))
  3717. return "continue";
  3718. if (!C2 && !y2)
  3719. return n2._cacheGroupTipsAndProbe({ groupID: g2, event: o2, item: p3 }), "continue";
  3720. if (n2._groupModule.isMessageFromOrToAVChatroom(g2))
  3721. return p3.event = o2, c2.push(p3), "continue";
  3722. if (p3.currentUser = n2._groupModule.getMyUserID(), p3.conversationType = S.CONV_GROUP, (a2 = new Ha(p3)).setElement({ type: S.MSG_GRP_TIP, content: t(t({}, p3.elements), {}, { groupProfile: p3.groupProfile }) }), a2.isSystemMessage = false, 1 === m2)
  3723. return n2._qualityStat(a2), "continue";
  3724. var T2 = n2._groupModule.getModule(Fn), D2 = a2, E2 = D2.conversationID, k2 = D2.sequence;
  3725. if (6 === o2)
  3726. a2._onlineOnlyFlag = true, i2.push(a2);
  3727. else if (!T2.pushIntoNoticeResult(i2, a2))
  3728. return "continue";
  3729. if (n2._groupModule.isMessageFromCommunityOfTopic(h2, v2))
  3730. return "continue";
  3731. if (6 === o2 && T2.getLocalConversation(E2))
  3732. return "continue";
  3733. 6 !== o2 && n2._qualityStat(a2);
  3734. var L2 = T2.isRemoteRead({ conversationID: E2, sequence: k2 });
  3735. if (at(u2[E2])) {
  3736. var A2 = 0;
  3737. "in" === a2.flow && (a2._isExcludedFromUnreadCount || a2._onlineOnlyFlag || L2 || (A2 = 1)), u2[E2] = r2.push({ conversationID: E2, unreadCount: A2, type: at(M2) ? a2.conversationType : M2, subType: a2.conversationSubType, lastMessage: a2._isExcludedFromLastMessage ? "" : a2 }) - 1;
  3738. } else {
  3739. var R2 = u2[E2];
  3740. r2[R2].type = a2.conversationType, r2[R2].subType = a2.conversationSubType, r2[R2].lastMessage = a2._isExcludedFromLastMessage ? "" : a2, "in" === a2.flow && (a2._isExcludedFromUnreadCount || a2._onlineOnlyFlag || L2 || r2[R2].unreadCount++);
  3741. }
  3742. }, p2 = 0, d2 = s2.length; p2 < d2; p2++)
  3743. l2(p2);
  3744. return { eventDataList: r2, result: i2, AVChatRoomMessageList: c2 };
  3745. } }, { key: "_qualityStat", value: function(e3) {
  3746. this._groupModule.getModule($n).addMessageSequence({ key: ya, message: e3 });
  3747. } }, { key: "handleMessageList", value: function(e3) {
  3748. var t2 = this;
  3749. e3.forEach(function(e4) {
  3750. switch (e4.payload.operationType) {
  3751. case 1:
  3752. t2._onNewMemberComeIn(e4);
  3753. break;
  3754. case 2:
  3755. t2._onMemberQuit(e4);
  3756. break;
  3757. case 3:
  3758. t2._onMemberKickedOut(e4);
  3759. break;
  3760. case 4:
  3761. t2._onMemberSetAdmin(e4);
  3762. break;
  3763. case 5:
  3764. t2._onMemberCancelledAdmin(e4);
  3765. break;
  3766. case 6:
  3767. t2._onGroupProfileModified(e4);
  3768. break;
  3769. case 7:
  3770. t2._onMemberInfoModified(e4);
  3771. break;
  3772. case 8:
  3773. t2._onTopicProfileUpdated(e4);
  3774. break;
  3775. default:
  3776. xe.w("".concat(t2._n, ".handleMessageList unknown operationType:").concat(e4.payload.operationType));
  3777. }
  3778. });
  3779. } }, { key: "_onNewMemberComeIn", value: function(e3) {
  3780. var t2 = e3.payload, n2 = t2.memberNum, o2 = t2.groupProfile.groupID, s2 = this._groupModule.getLocalGroupProfile(o2);
  3781. s2 && $e(n2) && s2.memberCount !== n2 && (s2.memberCount = n2, this._updateConversationGroupProfile(s2));
  3782. } }, { key: "_onMemberQuit", value: function(e3) {
  3783. var t2 = e3.payload, n2 = t2.memberNum, o2 = t2.groupProfile.groupID, s2 = this._groupModule.getLocalGroupProfile(o2);
  3784. s2 && $e(n2) && s2.memberCount !== n2 && (s2.memberCount = n2, this._updateConversationGroupProfile(s2)), this._groupModule.getModule(bn).deleteLocalGroupMembers(o2, e3.payload.userIDList);
  3785. } }, { key: "_onMemberKickedOut", value: function(e3) {
  3786. var t2 = e3.payload, n2 = t2.memberNum, o2 = t2.groupProfile.groupID, s2 = this._groupModule.getLocalGroupProfile(o2);
  3787. s2 && $e(n2) && s2.memberCount !== n2 && (s2.memberCount = n2, this._updateConversationGroupProfile(s2)), this._groupModule.getModule(bn).deleteLocalGroupMembers(o2, e3.payload.userIDList);
  3788. } }, { key: "_updateConversationGroupProfile", value: function(e3) {
  3789. this._groupModule.getModule(Fn).updateConversationGroupProfile([e3]);
  3790. } }, { key: "_onMemberSetAdmin", value: function(e3) {
  3791. var t2 = e3.payload.groupProfile.groupID, n2 = e3.payload.userIDList, o2 = this._groupModule.getModule(bn);
  3792. n2.forEach(function(e4) {
  3793. var n3 = o2.getLocalGroupMemberInfo(t2, e4);
  3794. n3 && n3.updateRole(S.GRP_MBR_ROLE_ADMIN);
  3795. });
  3796. } }, { key: "_onMemberCancelledAdmin", value: function(e3) {
  3797. var t2 = e3.payload.groupProfile.groupID, n2 = e3.payload.userIDList, o2 = this._groupModule.getModule(bn);
  3798. n2.forEach(function(e4) {
  3799. var n3 = o2.getLocalGroupMemberInfo(t2, e4);
  3800. n3 && n3.updateRole(S.GRP_MBR_ROLE_MEMBER);
  3801. });
  3802. } }, { key: "_onGroupProfileModified", value: function(e3) {
  3803. var t2 = this, n2 = e3.payload, o2 = n2.newGroupProfile, s2 = n2.groupProfile.groupID, a2 = this._groupModule.getLocalGroupProfile(s2);
  3804. Object.keys(o2).forEach(function(e4) {
  3805. switch (e4) {
  3806. case "ownerID":
  3807. t2._ownerChanged(a2, o2);
  3808. break;
  3809. case "groupName":
  3810. a2.name = o2[e4];
  3811. break;
  3812. default:
  3813. a2[e4] = o2[e4];
  3814. }
  3815. });
  3816. var r2 = !a2.isSupportTopic;
  3817. this._groupModule.emitGroupListUpdate(true, r2);
  3818. } }, { key: "_ownerChanged", value: function(e3, t2) {
  3819. var n2 = e3.groupID, o2 = this._groupModule.getLocalGroupProfile(n2), s2 = this._groupModule.getMyUserID();
  3820. if (s2 === t2.ownerID) {
  3821. o2.updateGroup({ selfInfo: { role: S.GRP_MBR_ROLE_OWNER } });
  3822. var a2 = this._groupModule.getModule(bn), r2 = a2.getLocalGroupMemberInfo(n2, s2), i2 = this._groupModule.getLocalGroupProfile(n2).ownerID, u2 = a2.getLocalGroupMemberInfo(n2, i2);
  3823. r2 && r2.updateRole(S.GRP_MBR_ROLE_OWNER), u2 && u2.updateRole(S.GRP_MBR_ROLE_MEMBER);
  3824. }
  3825. } }, { key: "_onMemberInfoModified", value: function(e3) {
  3826. var t2 = e3.to, n2 = e3.payload, o2 = n2.groupProfile, s2 = n2.memberList, a2 = o2.groupID;
  3827. Dt(t2) && this._updateTopicMuteTime(e3);
  3828. var r2 = this._groupModule.getModule(bn);
  3829. s2.forEach(function(e4) {
  3830. var t3 = r2.getLocalGroupMemberInfo(a2, e4.userID);
  3831. t3 && $e(e4.muteTime) && t3.updateMuteUntil(e4.muteTime);
  3832. });
  3833. } }, { key: "_updateTopicMuteTime", value: function(e3) {
  3834. var t2 = e3.to, n2 = e3.payload, o2 = n2.groupProfile, s2 = n2.memberList, a2 = void 0 === s2 ? [] : s2, r2 = this._groupModule.getModule(wn), i2 = o2.groupID, u2 = r2.getLocalTopic(i2, t2);
  3835. if (u2) {
  3836. for (var c2 = false, l2 = 0; l2 < a2.length; l2++) {
  3837. var p2 = a2[l2];
  3838. if (p2.userID === this._groupModule.getMyUserID() && p2.muteTime >= 0) {
  3839. u2.updateSelfInfo({ muteTime: p2.muteTime }), c2 = true;
  3840. break;
  3841. }
  3842. }
  3843. c2 && this._groupModule.emitOuterEvent(E.TOPIC_UPDATED, { groupID: i2, topic: u2 });
  3844. }
  3845. } }, { key: "_onTopicProfileUpdated", value: function(e3) {
  3846. var n2 = e3.payload, o2 = n2.groupProfile.groupID, s2 = n2.newTopicInfo;
  3847. this._groupModule.getModule(wn).onTopicProfileUpdated(t({ groupID: o2, topicID: e3.to }, s2));
  3848. } }, { key: "_cacheGroupTips", value: function(e3, t2) {
  3849. this._cachedGroupTipsMap.has(e3) || this._cachedGroupTipsMap.set(e3, []), this._cachedGroupTipsMap.get(e3).push(t2);
  3850. } }, { key: "_deleteCachedGroupTips", value: function(e3) {
  3851. this._cachedGroupTipsMap.has(e3) && this._cachedGroupTipsMap.delete(e3);
  3852. } }, { key: "_notifyCachedGroupTips", value: function(e3) {
  3853. var t2 = this, n2 = this._cachedGroupTipsMap.get(e3) || [];
  3854. n2.forEach(function(e4) {
  3855. t2.onNewGroupTips(e4);
  3856. }), this._deleteCachedGroupTips(e3), xe.l("".concat(this._n, "._notifyCachedGroupTips groupID:").concat(e3, " count:").concat(n2.length));
  3857. } }, { key: "_cacheGroupTipsAndProbe", value: function(e3) {
  3858. var t2 = this, n2 = e3.groupID, o2 = e3.event, s2 = e3.item;
  3859. this._cacheGroupTips(n2, { event: o2, dataList: [s2] }), this._groupModule.getGroupSimplifiedInfo(n2).then(function(e4) {
  3860. e4.type === S.GRP_AVCHATROOM ? t2._groupModule.hasLocalGroup(n2) ? t2._notifyCachedGroupTips(n2) : t2._groupModule.setUnjoinedAVChatRoom(n2) : (t2._groupModule.updateGroupMap([e4]), t2._notifyCachedGroupTips(n2));
  3861. }), this._checkCountMap.has(n2) || this._checkCountMap.set(n2, 0), xe.l("".concat(this._n, "._cacheGroupTipsAndProbe groupID:").concat(n2));
  3862. } }, { key: "reset", value: function() {
  3863. this._cachedGroupTipsMap.clear(), this._checkCountMap.clear(), this._getTopicPendingMap.clear();
  3864. } }]), e2;
  3865. }(), Mr = function() {
  3866. function e2(t2) {
  3867. o(this, e2), this._groupModule = t2, this._n = "CommonGroupHandler", this.tempConversationList = null, this._cachedGroupMessageMap = /* @__PURE__ */ new Map(), this._checkCountMap = /* @__PURE__ */ new Map(), this.MAX_CHECK_COUNT = 4, this._getTopicPendingMap = /* @__PURE__ */ new Map(), this._isPagingGetCompleted = false, t2.getInnerEmitterInstance().once(Za, this._initGroupList, this);
  3868. }
  3869. return a(e2, [{ key: "onCheckTimer", value: function(e3) {
  3870. e3 % 1 == 0 && this._cachedGroupMessageMap.size > 0 && this._checkCachedGroupMessage();
  3871. } }, { key: "_checkCachedGroupMessage", value: function() {
  3872. var e3 = this;
  3873. this._cachedGroupMessageMap.forEach(function(t2, n2) {
  3874. var o2 = e3._checkCountMap.get(n2), s2 = e3._groupModule.hasLocalGroup(n2);
  3875. xe.l("".concat(e3._n, "._checkCachedGroupMessage groupID:").concat(n2, " hasLocalGroup:").concat(s2, " checkCount:").concat(o2)), s2 ? (e3._notifyCachedGroupMessage(n2), e3._checkCountMap.delete(n2), e3._groupModule.deleteUnjoinedAVChatRoom(n2)) : o2 >= e3.MAX_CHECK_COUNT ? (e3._deleteCachedGroupMessage(n2), e3._checkCountMap.delete(n2)) : (o2++, e3._checkCountMap.set(n2, o2));
  3876. });
  3877. } }, { key: "_initGroupList", value: function() {
  3878. var e3 = this;
  3879. xe.l("".concat(this._n, "._initGroupList"));
  3880. var t2 = new ka("getGroupListInStorage"), n2 = this._groupModule.getStorageGroupList();
  3881. if (st(n2) && n2.length > 0) {
  3882. n2.forEach(function(t3) {
  3883. e3._groupModule.initGroupMap(t3);
  3884. }), this._groupModule.emitGroupListUpdate(true, false);
  3885. var o2 = this._groupModule.getLocalGroupList().length;
  3886. t2.setNetworkType(this._groupModule.getNetworkType()).setMessage("group count:".concat(o2)).end();
  3887. } else
  3888. t2.setNetworkType(this._groupModule.getNetworkType()).setMessage("group count:0").end();
  3889. xe.l("".concat(this._n, "._initGroupList ok"));
  3890. } }, { key: "handleUpdateGroupLastMessage", value: function(e3) {
  3891. var n2 = "".concat(this._n, ".handleUpdateGroupLastMessage");
  3892. if (xe.l("".concat(n2, " conversation count:").concat(e3.length, ", local group count:").concat(this._groupModule.getLocalGroupList().length)), 0 !== this._groupModule.getGroupMap().size) {
  3893. for (var o2, s2, a2, r2 = false, i2 = 0, u2 = e3.length; i2 < u2; i2++)
  3894. (o2 = e3[i2]).type === S.CONV_GROUP && (s2 = o2.conversationID.split(/^GROUP/)[1], (a2 = this._groupModule.getLocalGroupProfile(s2)) && (a2.lastMessage = t({}, o2.lastMessage), r2 = true));
  3895. r2 && (this._groupModule.sortLocalGroupList(), this._groupModule.emitGroupListUpdate(true, false));
  3896. } else
  3897. this.tempConversationList = e3;
  3898. } }, { key: "onNewGroupMessage", value: function(e3) {
  3899. xe.d("".concat(this._n, ".onNewGroupMessage count:").concat(e3.dataList.length));
  3900. var t2 = this._newGroupMessageStoredAndSummary(e3), n2 = t2.conversationOptionsList, o2 = t2.messageList, s2 = t2.AVChatRoomMessageList;
  3901. (s2.length > 0 && this._groupModule.onAVChatRoomMessage(s2), this._groupModule.filterModifiedMessage(o2), n2.length > 0) && (this._groupModule.updateNextMessageSeq(n2), this._groupModule.getModule(Fn).onNewMessage({ conversationOptionsList: n2, isInstantMessage: e3.isInstantMessage || true, updateUnreadCount: e3.updateUnreadCount || true }));
  3902. var a2 = this._groupModule.filterUnmodifiedMessage(o2);
  3903. a2.length > 0 && this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED, a2), o2.length = 0;
  3904. } }, { key: "_newGroupMessageStoredAndSummary", value: function(e3) {
  3905. var t2 = this, n2 = e3.dataList, o2 = e3.event, s2 = e3.isInstantMessage, a2 = null, r2 = [], i2 = [], u2 = [], c2 = {}, l2 = this._groupModule.getModule(Hn), p2 = this._groupModule.getFileDownloadProxy(), d2 = n2.length;
  3906. d2 > 1 && n2.sort(function(e4, t3) {
  3907. return e4.sequence - t3.sequence;
  3908. });
  3909. for (var g2 = function(e4) {
  3910. var d3 = yt(n2[e4]), g3 = d3.groupProfile, _3 = g3.groupID, h2 = g3.communityType, f2 = void 0 === h2 ? 0 : h2, v2 = g3.topicID, m2 = void 0 === v2 ? void 0 : v2, M2 = g3.invisible, y2 = void 0, I2 = t2._groupModule.isMessageFromTopic(f2, m2);
  3911. if (I2) {
  3912. y2 = S.CONV_TOPIC, d3.to = m2;
  3913. var C2 = t2._groupModule.getModule(wn);
  3914. C2.hasLocalTopic(_3, m2) || t2._getTopicPendingMap.has(m2) || (t2._getTopicPendingMap.set(m2, 1), C2.getTopicList({ groupID: _3, topicIDList: [m2] }).finally(function() {
  3915. t2._getTopicPendingMap.delete(m2);
  3916. }));
  3917. }
  3918. var T2 = t2._groupModule.hasLocalGroup(_3);
  3919. if (!T2 && t2._groupModule.isUnjoinedAVChatRoom(_3))
  3920. return "continue";
  3921. if (!T2 && !I2)
  3922. return t2._cacheGroupMessageAndProbe({ groupID: _3, event: o2, item: d3 }), "continue";
  3923. if (t2._groupModule.isMessageFromOrToAVChatroom(_3))
  3924. return d3.event = o2, u2.push(d3), "continue";
  3925. if (d3.currentUser = t2._groupModule.getMyUserID(), d3.conversationType = S.CONV_GROUP, d3.isSystemMessage = !!d3.isSystemMessage, a2 = new Ha(d3), d3.elements = l2.parseElements(d3.elements, d3.from), a2.setElement(d3.elements, p2), 1 === M2)
  3926. return t2._qualityStat(s2, a2), "continue";
  3927. var D2 = 1 === n2[e4].isModified, E2 = t2._groupModule.getModule(Fn);
  3928. if (E2.isMessageSentByCurrentInstance(a2) ? a2.isModified = D2 : D2 = false, 1 === d3.onlineOnlyFlag)
  3929. a2._onlineOnlyFlag = true, E2.isMessageSentByCurrentInstance(a2) || i2.push(a2);
  3930. else {
  3931. if (t2._groupModule.isMessageFromCommunityOfTopic(f2, m2))
  3932. return i2.push(a2), "continue";
  3933. if (!E2.pushIntoMessageList(i2, a2, D2))
  3934. return "continue";
  3935. t2._qualityStat(s2, a2);
  3936. var k2 = a2, L2 = k2.conversationID, A2 = k2.sequence, R2 = E2.isRemoteRead({ conversationID: L2, sequence: A2 });
  3937. if (at(c2[L2])) {
  3938. var N2 = 0;
  3939. "in" === a2.flow && (a2._isExcludedFromUnreadCount || R2 || (N2 = 1)), c2[L2] = r2.push({ conversationID: L2, unreadCount: N2, type: at(y2) ? a2.conversationType : y2, subType: a2.conversationSubType, lastMessage: a2._isExcludedFromLastMessage ? "" : a2 }) - 1;
  3940. } else {
  3941. var O2 = c2[L2];
  3942. r2[O2].type = at(y2) ? a2.conversationType : y2, r2[O2].subType = a2.conversationSubType, r2[O2].lastMessage = a2._isExcludedFromLastMessage ? "" : a2, "in" === a2.flow && (a2._isExcludedFromUnreadCount || R2 || r2[O2].unreadCount++);
  3943. }
  3944. }
  3945. }, _2 = 0; _2 < d2; _2++)
  3946. g2(_2);
  3947. return { conversationOptionsList: r2, messageList: i2, AVChatRoomMessageList: u2 };
  3948. } }, { key: "_qualityStat", value: function(e3, t2) {
  3949. var n2 = this._groupModule.getModule($n);
  3950. n2.addMessageSequence({ key: ya, message: t2 }), e3 && t2.clientTime > 0 && n2.addMessageDelay(t2.clientTime);
  3951. } }, { key: "onGroupMessageRevoked", value: function(e3) {
  3952. var t2 = this._groupModule.getModule(Fn), n2 = [], o2 = null, s2 = true;
  3953. e3.dataList.forEach(function(e4) {
  3954. var a2 = e4.elements.revokedInfos;
  3955. at(a2) || a2.forEach(function(e5) {
  3956. var a3 = jt(e5.topicID) ? "GROUP".concat(e5.groupID) : "GROUP".concat(e5.topicID);
  3957. o2 = t2.revoke(a3, e5.sequence, e5.random);
  3958. var r2 = e5.revokerInfo && e5.revokerInfo.revoker;
  3959. if (o2)
  3960. o2.revoker = r2, n2.push(o2);
  3961. else {
  3962. var i2 = { conversationID: a3, to: e5.topicID || "", sequence: e5.sequence, time: e5.time, revoker: r2 };
  3963. t2.isLastMessageRevoked(i2) && (n2.push(i2), s2 = false);
  3964. }
  3965. });
  3966. }), 0 !== n2.length && (t2.onMessageRevoked(n2), true === s2 && (xe.l("".concat(this._n, ".onGroupMessageRevoked count:").concat(n2.length)), this._groupModule.emitOuterEvent(E.MESSAGE_REVOKED, n2)));
  3967. } }, { key: "_groupListTreeShaking", value: function(e3) {
  3968. for (var t2 = new Map(m(this._groupModule.getGroupMap())), n2 = 0, o2 = e3.length; n2 < o2; n2++)
  3969. t2.delete(e3[n2].groupID);
  3970. this._groupModule.hasJoinedAVChatRoom() && this._groupModule.getJoinedAVChatRoom().forEach(function(e4) {
  3971. t2.delete(e4);
  3972. });
  3973. this._groupModule.getGroupMap().forEach(function(e4, n3) {
  3974. e4.isSupportTopic && t2.delete(n3);
  3975. });
  3976. for (var s2 = m(t2.keys()), a2 = 0, r2 = s2.length; a2 < r2; a2++)
  3977. this._groupModule.deleteGroup(s2[a2]);
  3978. } }, { key: "getGroupList", value: function(e3) {
  3979. var t2 = this, n2 = "".concat(this._n, ".").concat("getGroupList"), o2 = new ka("getGroupList");
  3980. xe.l("".concat(n2));
  3981. var s2 = { introduction: "Introduction", notification: "Notification", createTime: "CreateTime", ownerID: "Owner_Account", lastInfoTime: "LastInfoTime", memberNum: "MemberNum", maxMemberNum: "MaxMemberNum", joinOption: "ApplyJoinOption", inviteOption: "InviteJoinOption", muteAllMembers: "ShutUpAllMember" }, a2 = ["Type", "Name", "FaceUrl", "NextMsgSeq", "LastMsgTime", "AtInfoList", "LastRecallTime"], r2 = [];
  3982. e3 && e3.groupProfileFilter && e3.groupProfileFilter.forEach(function(e4) {
  3983. s2[e4] && a2.push(s2[e4]);
  3984. });
  3985. var i2 = (e3 || {}).isGroupWithTopicOnly, u2 = void 0 !== i2 && i2;
  3986. return this._pagingGetGroupList({ limit: 50, offset: 0, groupBaseInfoFilter: a2, groupList: r2, isGroupWithTopicOnly: u2 }).then(function() {
  3987. xe.l("".concat(n2, " ok. count:").concat(r2.length, " isGroupWithTopicOnly:").concat(u2)), u2 || t2._groupListTreeShaking(r2), t2._groupModule.updateGroupMap(r2);
  3988. var e4 = t2._groupModule.getLocalGroupList().length;
  3989. o2.setNetworkType(t2._groupModule.getNetworkType()).setMessage("remote count:".concat(r2.length, ", after tree shaking, local count:").concat(e4, ", isGroupWithTopicOnly:").concat(u2)).end(), t2.tempConversationList && (t2.handleUpdateGroupLastMessage(t2.tempConversationList), t2.tempConversationList = null), t2._groupModule.patchGroupMessageRemindType(), t2._groupModule.recomputeUnreadCount(), t2._groupModule.emitGroupListUpdate(true, !u2);
  3990. var s3 = t2._groupModule.getLocalGroupList();
  3991. if (u2) {
  3992. var a3 = s3.filter(function(e5) {
  3993. return true === e5.isSupportTopic;
  3994. });
  3995. return Ka({ groupList: a3 });
  3996. }
  3997. return t2._isPagingGetCompleted = true, Ka({ groupList: s3 });
  3998. }).catch(function(e4) {
  3999. return t2._groupModule.probeNetwork().then(function(t3) {
  4000. var n3 = v(t3, 2), s3 = n3[0], a3 = n3[1];
  4001. o2.setError(e4, s3, a3).end();
  4002. }), xe.e("".concat(n2, " failed. error:"), e4), Ja(e4);
  4003. });
  4004. } }, { key: "isPagingGetCompleted", value: function() {
  4005. return this._isPagingGetCompleted;
  4006. } }, { key: "_pagingGetGroupList", value: function(e3) {
  4007. var t2 = this, n2 = "".concat(this._n, ".").concat("_pagingGetGroupList"), o2 = e3.isCommunityRelay, s2 = void 0 !== o2 && o2, a2 = e3.isGroupWithTopicOnly, r2 = void 0 !== a2 && a2, i2 = e3.limit, u2 = e3.offset, c2 = e3.groupBaseInfoFilter, l2 = e3.groupList;
  4008. if (r2)
  4009. return this._pagingGetGroupListWithTopic({ limit: i2, offset: u2, groupBaseInfoFilter: c2, groupList: l2 });
  4010. var p2 = new ka("_pagingGetGroupList");
  4011. return this._groupModule.request({ protocolName: Wo, requestData: { type: s2 ? S.GRP_COMMUNITY : void 0, memberAccount: this._groupModule.getMyUserID(), limit: i2, offset: u2, responseFilter: { groupBaseInfoFilter: c2, selfInfoFilter: ["Role", "JoinTime", "MsgFlag", "MsgSeq"] } } }).then(function(e4) {
  4012. var o3 = e4.data, a3 = o3.groups, r3 = void 0 === a3 ? [] : a3, d2 = o3.totalCount;
  4013. l2.push.apply(l2, m(r3)), t2._handleGroupAtInfoWithoutTopic(s2, r3);
  4014. var g2 = u2 + i2, _2 = !(d2 > g2), h2 = "offset:".concat(u2, " totalCount:").concat(d2, " isCompleted:").concat(_2, " ") + "currentCount:".concat(l2.length, " isCommunityRelay:").concat(s2);
  4015. return p2.setNetworkType(t2._groupModule.getNetworkType()).setMessage("".concat(h2)).end(), s2 || _2 ? !s2 && _2 ? (xe.l("".concat(n2, " start to get community list")), u2 = 0, t2._pagingGetGroupList({ limit: i2, offset: u2, groupBaseInfoFilter: c2, groupList: l2, isCommunityRelay: true })) : s2 && !_2 ? (u2 = g2, t2._pagingGetGroupList({ limit: i2, offset: u2, groupBaseInfoFilter: c2, groupList: l2, isCommunityRelay: true })) : (xe.l("".concat(n2, " ok. totalCount:").concat(l2.length)), Ka({ groupList: l2 })) : (u2 = g2, t2._pagingGetGroupList({ limit: i2, offset: u2, groupBaseInfoFilter: c2, groupList: l2 }));
  4016. }).catch(function(e4) {
  4017. return 11e3 !== e4.code && t2._groupModule.probeNetwork().then(function(t3) {
  4018. var n3 = v(t3, 2), o3 = n3[0], a3 = n3[1];
  4019. p2.setMessage("isCommunityRelay:".concat(s2)).setError(e4, o3, a3).end();
  4020. }), s2 ? (11e3 === e4.code && (p2 = null, xe.l("".concat(n2, " ok. community unavailable"))), za({ groupList: l2 })) : Ja(e4);
  4021. });
  4022. } }, { key: "_pagingGetGroupListWithTopic", value: function(e3) {
  4023. var t2 = this, n2 = "".concat(this._n, "._pagingGetGroupListWithTopic"), o2 = e3.limit, s2 = e3.offset, a2 = e3.groupBaseInfoFilter, r2 = e3.groupList, i2 = new ka("pagingGetGroupListWithTopic");
  4024. return this._groupModule.request({ protocolName: Wo, requestData: { type: S.GRP_COMMUNITY, memberAccount: this._groupModule.getMyUserID(), limit: o2, offset: s2, responseFilter: { groupBaseInfoFilter: a2, selfInfoFilter: ["Role", "JoinTime", "MsgFlag", "MsgSeq"] }, isSupportTopic: 1 } }).then(function(e4) {
  4025. var u2 = e4.data, c2 = u2.groups, l2 = void 0 === c2 ? [] : c2, p2 = u2.totalCount;
  4026. r2.push.apply(r2, m(l2));
  4027. var d2 = s2 + o2, g2 = !(p2 > d2), _2 = "offset:".concat(s2, " totalCount:").concat(p2, " isCompleted:").concat(g2, " ") + "currentCount:".concat(r2.length);
  4028. return i2.setNetworkType(t2._groupModule.getNetworkType()).setMessage("".concat(_2)).end(), g2 ? (xe.l("".concat(n2, " ok. totalCount:").concat(r2.length)), Ka({ groupList: r2 })) : (s2 = d2, t2._pagingGetGroupListWithTopic({ limit: o2, offset: s2, groupBaseInfoFilter: a2, groupList: r2 }));
  4029. }).catch(function(e4) {
  4030. return t2._groupModule.probeNetwork().then(function(t3) {
  4031. var n3 = v(t3, 2), o3 = n3[0], s3 = n3[1];
  4032. i2.setError(e4, o3, s3).end();
  4033. }), Ja(e4);
  4034. });
  4035. } }, { key: "_cacheGroupMessage", value: function(e3, t2) {
  4036. this._cachedGroupMessageMap.has(e3) || this._cachedGroupMessageMap.set(e3, []), this._cachedGroupMessageMap.get(e3).push(t2);
  4037. } }, { key: "_deleteCachedGroupMessage", value: function(e3) {
  4038. this._cachedGroupMessageMap.has(e3) && this._cachedGroupMessageMap.delete(e3);
  4039. } }, { key: "_notifyCachedGroupMessage", value: function(e3) {
  4040. var t2 = this, n2 = this._cachedGroupMessageMap.get(e3) || [];
  4041. n2.forEach(function(e4) {
  4042. t2.onNewGroupMessage(e4);
  4043. }), this._deleteCachedGroupMessage(e3), xe.l("".concat(this._n, "._notifyCachedGroupMessage groupID:").concat(e3, " count:").concat(n2.length));
  4044. } }, { key: "_cacheGroupMessageAndProbe", value: function(e3) {
  4045. var t2 = this, n2 = e3.groupID, o2 = e3.event, s2 = e3.item;
  4046. this._cacheGroupMessage(n2, { event: o2, dataList: [s2] }), this._groupModule.getGroupSimplifiedInfo(n2).then(function(e4) {
  4047. e4.type === S.GRP_AVCHATROOM ? t2._groupModule.hasLocalGroup(n2) ? t2._notifyCachedGroupMessage(n2) : t2._groupModule.setUnjoinedAVChatRoom(n2) : (t2._groupModule.updateGroupMap([e4]), t2._notifyCachedGroupMessage(n2));
  4048. }), this._checkCountMap.has(n2) || this._checkCountMap.set(n2, 0), xe.l("".concat(this._n, "._cacheGroupMessageAndProbe groupID:").concat(n2));
  4049. } }, { key: "_handleGroupAtInfoWithoutTopic", value: function(e3, n2) {
  4050. var o2 = this;
  4051. e3 && 0 !== n2.length && n2.forEach(function(e4) {
  4052. var n3 = e4.groupID, s2 = e4.groupAtInfoList, a2 = [];
  4053. at(s2) || (s2.forEach(function(e5) {
  4054. a2.push(t(t({}, e5), {}, { groupID: n3 }));
  4055. }), o2._groupModule.getModule(Fn).onNewGroupAtTips({ dataList: a2 }));
  4056. });
  4057. } }, { key: "reset", value: function() {
  4058. this._cachedGroupMessageMap.clear(), this._checkCountMap.clear(), this._getTopicPendingMap.clear(), this._isPagingGetCompleted = false, this._groupModule.getInnerEmitterInstance().once(Za, this._initGroupList, this);
  4059. } }]), e2;
  4060. }(), yr = 1, Ir = 2, Cr = 3, Tr = 4, Dr = 5, Er = function() {
  4061. function e2(t2) {
  4062. o(this, e2), this._groupModule = t2, this._n = "GroupAttributesHandler", this._groupAttributesMap = /* @__PURE__ */ new Map(), this._groupAttributesCopy = {}, this.CACHE_EXPIRE_TIME = 3e4, this._groupModule.getInnerEmitterInstance().on($a, this._onCloudConfigUpdated, this);
  4063. }
  4064. return a(e2, [{ key: "_onCloudConfigUpdated", value: function() {
  4065. var e3 = this._groupModule.getCloudConfig("grp_attr_cache_time");
  4066. at(e3) || (this.CACHE_EXPIRE_TIME = Number(e3));
  4067. } }, { key: "updateLocalMainSequenceOnReconnected", value: function() {
  4068. this._groupAttributesMap.forEach(function(e3) {
  4069. e3.localMainSequence = 0;
  4070. });
  4071. } }, { key: "isGroupAttributesUpdatedNotice", value: function(e3) {
  4072. var t2 = e3.to, n2 = e3.elements.newGroupProfile, o2 = !at(n2) && !jt(n2.groupAttributeOption);
  4073. return o2 && this._onGroupAttributesUpdated({ groupID: t2, groupAttributeOption: n2.groupAttributeOption }), o2;
  4074. } }, { key: "_onGroupAttributesUpdated", value: function(e3) {
  4075. var t2 = this, n2 = e3.groupID, o2 = e3.groupAttributeOption, s2 = o2.mainSequence, a2 = o2.isWithChangedAttributeInfo, r2 = o2.groupAttributeList, i2 = void 0 === r2 ? [] : r2, u2 = o2.operationType;
  4076. if (xe.l("".concat(this._n, ".onGroupAttributesUpdated. ") + "groupID:".concat(n2, " isWithChangedAttributeInfo:").concat(a2, " operationType:").concat(u2)), !at(u2)) {
  4077. this._groupAttributesCopy = this._getCachedAttributes({ groupID: n2 });
  4078. var c2 = this._getLocalGroupAttributes(n2).localMainSequence;
  4079. if (1 === a2 && s2 - c2 == 1)
  4080. return this._refreshCachedGroupAttributes({ groupID: n2, remoteMainSequence: s2, groupAttributeList: i2, operationType: u2 }), void this._emitGroupAttributesUpdated(n2);
  4081. if (this._hasLocalGroupAttributes(n2)) {
  4082. var l2 = this._getLocalGroupAttributes(n2).avChatRoomKey;
  4083. this._getGroupAttributes({ groupID: n2, avChatRoomKey: l2 }).then(function() {
  4084. t2._emitGroupAttributesUpdated(n2);
  4085. });
  4086. }
  4087. }
  4088. } }, { key: "initGroupAttributesCache", value: function(e3) {
  4089. var t2 = e3.groupID, n2 = e3.avChatRoomKey, o2 = void 0 === n2 ? void 0 : n2;
  4090. this._groupAttributesMap.set(t2, { lastUpdateTime: 0, localMainSequence: 0, remoteMainSequence: 0, attributes: /* @__PURE__ */ new Map(), avChatRoomKey: o2 }), xe.l("".concat(this._n, ".initGroupAttributesCache groupID:").concat(t2, " avChatRoomKey:").concat(o2));
  4091. } }, { key: "initGroupAttributes", value: function(e3) {
  4092. var t2 = this, n2 = e3.groupID, o2 = e3.groupAttributes, s2 = this._getLocalGroupAttributes(n2), a2 = s2.remoteMainSequence, r2 = s2.avChatRoomKey, i2 = new ka("initGroupAttributes");
  4093. return i2.setMessage("groupID:".concat(n2, " avChatRoomKey:").concat(r2, " mainSequence:").concat(a2)), this._groupModule.request({ protocolName: Ms, requestData: { groupID: n2, avChatRoomKey: r2, mainSequence: a2, groupAttributeList: this._transformGroupAttributes(o2) } }).then(function(e4) {
  4094. var s3 = e4.data, a3 = s3.mainSequence, r3 = m(s3.groupAttributeList);
  4095. return r3.forEach(function(e5) {
  4096. e5.value = o2[e5.key];
  4097. }), t2._refreshCachedGroupAttributes({ groupID: n2, remoteMainSequence: a3, groupAttributeList: r3, operationType: yr }), i2.setNetworkType(t2._groupModule.getNetworkType()).end(), xe.l("".concat(t2._n, ".").concat("initGroupAttributes", " ok. groupID:").concat(n2)), Ka({ groupAttributes: o2 });
  4098. }).catch(function(e4) {
  4099. return t2._groupModule.probeNetwork().then(function(t3) {
  4100. var n3 = v(t3, 2), o3 = n3[0], s3 = n3[1];
  4101. i2.setError(e4, o3, s3).end();
  4102. }), Ja(e4);
  4103. });
  4104. } }, { key: "setGroupAttributes", value: function(e3) {
  4105. var t2 = this, n2 = "".concat(this._n, ".").concat("setGroupAttributes"), o2 = e3.groupID, s2 = e3.groupAttributes, a2 = this._getLocalGroupAttributes(o2), r2 = a2.remoteMainSequence, i2 = a2.avChatRoomKey, u2 = a2.attributes, c2 = this._transformGroupAttributes(s2);
  4106. c2.forEach(function(e4) {
  4107. var t3 = e4.key;
  4108. e4.sequence = 0, u2.has(t3) && (e4.sequence = u2.get(t3).sequence);
  4109. });
  4110. var l2 = new ka("setGroupAttributes");
  4111. return l2.setMessage("groupID:".concat(o2, " groupAttributes:").concat(JSON.stringify(s2))), xe.l("".concat(n2, ". groupID:").concat(o2, " mainSequence:").concat(r2)), this._groupModule.request({ protocolName: ys, requestData: { groupID: o2, avChatRoomKey: i2, mainSequence: r2, groupAttributeList: c2 } }).then(function(e4) {
  4112. var a3 = e4.data, r3 = a3.mainSequence, i3 = m(a3.groupAttributeList);
  4113. return i3.forEach(function(e5) {
  4114. e5.value = s2[e5.key];
  4115. }), t2._refreshCachedGroupAttributes({ groupID: o2, remoteMainSequence: r3, groupAttributeList: i3, operationType: Ir }), l2.setNetworkType(t2._groupModule.getNetworkType()).end(), xe.l("".concat(n2, " ok.")), Ka({ groupAttributes: s2 });
  4116. }).catch(function(e4) {
  4117. return t2._groupModule.probeNetwork().then(function(t3) {
  4118. var n3 = v(t3, 2), o3 = n3[0], s3 = n3[1];
  4119. l2.setError(e4, o3, s3).end();
  4120. }), Ja(e4);
  4121. });
  4122. } }, { key: "deleteGroupAttributes", value: function(e3) {
  4123. var t2 = this, n2 = e3.groupID, o2 = e3.keyList, s2 = void 0 === o2 ? [] : o2, a2 = this._getLocalGroupAttributes(n2), r2 = a2.remoteMainSequence, i2 = a2.avChatRoomKey, u2 = a2.attributes, c2 = m(u2.keys()), l2 = Cs, p2 = Cr, d2 = { groupID: n2, avChatRoomKey: i2, mainSequence: r2 }, g2 = [];
  4124. s2.length > 0 && (c2 = [], l2 = Is, p2 = Tr, s2.forEach(function(e4) {
  4125. var t3 = 0;
  4126. u2.has(e4) && (t3 = u2.get(e4).sequence, c2.push(e4)), g2.push({ key: e4, sequence: t3 });
  4127. }), d2.groupAttributeList = g2);
  4128. var _2 = new ka("deleteGroupAttributes");
  4129. return _2.setMessage("groupID:".concat(n2, " mainSequence:").concat(r2, " keyList:").concat(s2, " protocolName:").concat(l2)), this._groupModule.request({ protocolName: l2, requestData: d2 }).then(function(e4) {
  4130. var o3 = e4.data.mainSequence;
  4131. return t2._refreshCachedGroupAttributes({ groupID: n2, remoteMainSequence: o3, groupAttributeList: g2, operationType: p2 }), _2.setNetworkType(t2._groupModule.getNetworkType()).end(), xe.l("".concat(t2._n, ".").concat("deleteGroupAttributes", " ok. groupID:").concat(n2)), Ka({ keyList: c2 });
  4132. }).catch(function(e4) {
  4133. return t2._groupModule.probeNetwork().then(function(t3) {
  4134. var n3 = v(t3, 2), o3 = n3[0], s3 = n3[1];
  4135. _2.setError(e4, o3, s3).end();
  4136. }), Ja(e4);
  4137. });
  4138. } }, { key: "getGroupAttributes", value: function(e3) {
  4139. var t2 = this, n2 = "".concat(this._n, ".").concat("getGroupAttributes"), o2 = e3.groupID, s2 = this._getLocalGroupAttributes(o2), a2 = s2.avChatRoomKey, r2 = s2.lastUpdateTime, i2 = s2.localMainSequence, u2 = s2.remoteMainSequence, c2 = new ka("getGroupAttributes");
  4140. if (c2.setMessage("groupID:".concat(o2, " localMainSequence:").concat(i2, " remoteMainSequence:").concat(u2, " keyList:").concat(e3.keyList)), Date.now() - r2 >= this.CACHE_EXPIRE_TIME || i2 < u2)
  4141. return this._getGroupAttributes({ groupID: o2, avChatRoomKey: a2 }).then(function(s3) {
  4142. c2.setMoreMessage("get attributes from remote. count:".concat(s3.length)).setNetworkType(t2._groupModule.getNetworkType()).end(), xe.l("".concat(n2, " from remote. groupID:").concat(o2));
  4143. var a3 = t2._getCachedAttributes(e3);
  4144. return Ka({ groupAttributes: a3 });
  4145. }).catch(function(e4) {
  4146. return t2._groupModule.probeNetwork().then(function(t3) {
  4147. var n3 = v(t3, 2), o3 = n3[0], s3 = n3[1];
  4148. c2.setError(e4, o3, s3).end();
  4149. }), Ja(e4);
  4150. });
  4151. c2.setMoreMessage("get attributes from cache").setNetworkType(this._groupModule.getNetworkType()).end(), xe.l("".concat(n2, " from cache. groupID:").concat(o2));
  4152. var l2 = this._getCachedAttributes(e3);
  4153. return za({ groupAttributes: l2 });
  4154. } }, { key: "_getGroupAttributes", value: function(e3) {
  4155. var n2 = this, o2 = 0;
  4156. return at(e3.avChatRoomKey) || (o2 = 1), this._groupModule.request({ protocolName: Ts, requestData: t(t({}, e3), {}, { groupType: o2 }) }).then(function(t2) {
  4157. var o3 = t2.data, s2 = o3.mainSequence, a2 = o3.groupAttributeList, r2 = m(a2);
  4158. return at(s2) || n2._refreshCachedGroupAttributes({ groupID: e3.groupID, remoteMainSequence: s2, groupAttributeList: r2, operationType: Dr }), xe.l("".concat(n2._n, "._getGroupAttributes ok. groupID:").concat(e3.groupID)), a2;
  4159. }).catch(function(e4) {
  4160. return Ja(e4);
  4161. });
  4162. } }, { key: "_refreshCachedGroupAttributes", value: function(e3) {
  4163. var t2 = e3.groupID, n2 = e3.remoteMainSequence, o2 = e3.groupAttributeList, s2 = e3.operationType;
  4164. if (this._hasLocalGroupAttributes(t2)) {
  4165. var a2 = this._getLocalGroupAttributes(t2), r2 = a2.localMainSequence;
  4166. if (s2 === Dr || n2 - r2 == 1)
  4167. a2.remoteMainSequence = n2, a2.localMainSequence = n2, a2.lastUpdateTime = Date.now(), this._updateCachedAttributes({ groupAttributes: a2, groupAttributeList: o2, operationType: s2 });
  4168. else {
  4169. if (r2 === n2)
  4170. return;
  4171. a2.remoteMainSequence = n2;
  4172. }
  4173. this._groupAttributesMap.set(t2, a2);
  4174. var i2 = "operationType:".concat(s2, " localMainSequence:").concat(r2, " remoteMainSequence:").concat(n2);
  4175. xe.l("".concat(this._n, "._refreshCachedGroupAttributes. ").concat(i2));
  4176. }
  4177. } }, { key: "_getCachedAttributes", value: function(e3) {
  4178. var t2 = e3.groupID, n2 = e3.keyList, o2 = void 0 === n2 ? [] : n2, s2 = {};
  4179. if (this._hasLocalGroupAttributes(t2)) {
  4180. var a2 = this._getLocalGroupAttributes(t2).attributes;
  4181. if (o2.length > 0)
  4182. o2.forEach(function(e4) {
  4183. a2.has(e4) && (s2[e4] = a2.get(e4).value);
  4184. });
  4185. else {
  4186. var r2, i2 = D(a2.keys());
  4187. try {
  4188. for (i2.s(); !(r2 = i2.n()).done; ) {
  4189. var u2 = r2.value;
  4190. s2[u2] = a2.get(u2).value;
  4191. }
  4192. } catch (c2) {
  4193. i2.e(c2);
  4194. } finally {
  4195. i2.f();
  4196. }
  4197. }
  4198. }
  4199. return s2;
  4200. } }, { key: "_updateCachedAttributes", value: function(e3) {
  4201. var t2 = e3.groupAttributes, n2 = e3.groupAttributeList, o2 = e3.operationType;
  4202. o2 !== Cr ? o2 !== Tr ? (o2 === yr && t2.attributes.clear(), n2.forEach(function(e4) {
  4203. var n3 = e4.key, o3 = e4.value, s2 = e4.sequence;
  4204. t2.attributes.set(n3, { value: o3, sequence: s2 });
  4205. })) : n2.forEach(function(e4) {
  4206. t2.attributes.delete(e4.key);
  4207. }) : t2.attributes.clear();
  4208. } }, { key: "_hasLocalGroupAttributes", value: function(e3) {
  4209. return this._groupAttributesMap.has(e3);
  4210. } }, { key: "_getLocalGroupAttributes", value: function(e3) {
  4211. return this._hasLocalGroupAttributes(e3) || this.initGroupAttributesCache({ groupID: e3 }), this._groupAttributesMap.get(e3);
  4212. } }, { key: "_transformGroupAttributes", value: function(e3) {
  4213. var t2 = [];
  4214. return Object.keys(e3).forEach(function(n2) {
  4215. t2.push({ key: n2, value: e3[n2] });
  4216. }), t2;
  4217. } }, { key: "_emitGroupAttributesUpdated", value: function(e3) {
  4218. var t2 = this._getCachedAttributes({ groupID: e3 }), n2 = this._computeAttrChangedInfo(t2), o2 = n2.updatedKeyList, s2 = n2.deletedKeyList;
  4219. this._groupModule.emitOuterEvent(E.GROUP_ATTRIBUTES_UPDATED, { groupID: e3, groupAttributes: t2, updatedKeyList: o2, deletedKeyList: s2 });
  4220. } }, { key: "_computeAttrChangedInfo", value: function(e3) {
  4221. var t2 = this, n2 = [], o2 = [];
  4222. return Object.keys(e3).forEach(function(o3) {
  4223. e3[o3] !== t2._groupAttributesCopy[o3] && n2.push(o3);
  4224. }), Object.keys(this._groupAttributesCopy).forEach(function(t3) {
  4225. at(e3[t3]) && o2.push(t3);
  4226. }), this._groupAttributesCopy = {}, xe.l("".concat(this._n, "._computeAttrChangedInfo update count:").concat(n2.length, ", delete count:").concat(o2.length)), { updatedKeyList: n2, deletedKeyList: o2 };
  4227. } }, { key: "deleteLocalGroupAttributes", value: function(e3) {
  4228. this._hasLocalGroupAttributes(e3) && this._groupAttributesMap.delete(e3);
  4229. } }, { key: "reset", value: function() {
  4230. this._groupAttributesMap.clear(), this._groupAttributesCopy = {}, this.CACHE_EXPIRE_TIME = 3e4;
  4231. } }]), e2;
  4232. }(), Sr = "Set", kr = "Increase", Lr = "Decrease", Ar = function() {
  4233. function e2(t2) {
  4234. o(this, e2), this._groupModule = t2, this._n = "GroupCountersHandler", this._groupCountersMap = /* @__PURE__ */ new Map(), this.EXPIRE_TIME = 3e4, this._groupModule.getInnerEmitterInstance().on($a, this._onCloudConfigUpdated, this);
  4235. }
  4236. return a(e2, [{ key: "_onCloudConfigUpdated", value: function() {
  4237. var e3 = this._groupModule.getCloudConfig("grp_counter_expire_time");
  4238. at(e3) || (this.EXPIRE_TIME = Number(e3));
  4239. } }, { key: "isGroupCountersNotice", value: function(e3) {
  4240. var t2 = e3.to, n2 = e3.elements.groupCounterInfo, o2 = false;
  4241. return jt(n2) || (this._onGroupCountersUpdated({ groupID: t2, groupCounterInfo: n2 }), o2 = true), o2;
  4242. } }, { key: "_onGroupCountersUpdated", value: function(e3) {
  4243. var t2 = this, n2 = e3.groupID;
  4244. e3.groupCounterInfo.forEach(function(e4) {
  4245. var o2 = e4.type, s2 = e4.groupCounterSeq, a2 = e4.counterList, r2 = void 0 === a2 ? [] : a2;
  4246. 0 !== o2 && 2 !== o2 || (t2._updateLocalGroupCounters({ groupID: n2, groupCounterSeq: s2, counterList: r2 }), r2.forEach(function(e5) {
  4247. t2._groupModule.emitOuterEvent(E.GROUP_COUNTER_UPDATED, { groupID: n2, key: e5.key, value: e5.value });
  4248. })), 1 === o2 && t2._deleteLocalGroupCounters({ groupID: n2, groupCounterSeq: s2, counterList: r2 });
  4249. }), xe.l("".concat(this._n, "._onGroupCountersUpdated groupID:").concat(n2));
  4250. } }, { key: "initGroupCountersCache", value: function(e3) {
  4251. var t2 = e3.groupID, n2 = e3.avChatRoomKey;
  4252. this._groupCountersMap.set(t2, { lastUpdateTime: 0, groupCounterSeq: 0, counters: /* @__PURE__ */ new Map(), avChatRoomKey: n2 }), xe.l("".concat(this._n, ".initGroupCountersCache groupID:").concat(t2, " avChatRoomKey:").concat(n2));
  4253. } }, { key: "setGroupCounters", value: function(e3) {
  4254. var t2 = this;
  4255. if (!this._groupModule.canIUse(B.GRP_COUNTER))
  4256. return Ja({ code: da.CANNOT_USE_COMMERCIAL_ABILITY });
  4257. var n2 = "".concat(this._n, ".setGroupCounters"), o2 = e3.groupID, s2 = e3.counters, a2 = this._convertObjectToList(s2), r2 = this._getLocalGroupCounters(o2).avChatRoomKey, i2 = "groupID:".concat(o2, " count:").concat(a2.length), u2 = new ka("setGroupCounters");
  4258. return u2.setMessage("".concat(i2)), xe.l("".concat(n2, ". ").concat(i2)), this._updateGroupCounters({ groupID: o2, counterList: a2, avChatRoomKey: r2, mode: Sr }).then(function(e4) {
  4259. return u2.end(), xe.l("".concat(n2, " ok.")), Ka({ counters: e4 });
  4260. }).catch(function(e4) {
  4261. return t2._groupModule.probeNetwork().then(function(t3) {
  4262. var n3 = v(t3, 2), o3 = n3[0], s3 = n3[1];
  4263. u2.setError(e4, o3, s3).end();
  4264. }), xe.e("".concat(n2, " failed. error:"), e4), Ja(e4);
  4265. });
  4266. } }, { key: "increaseGroupCounter", value: function(e3) {
  4267. var t2 = this;
  4268. if (!this._groupModule.canIUse(B.GRP_COUNTER))
  4269. return Ja({ code: da.CANNOT_USE_COMMERCIAL_ABILITY });
  4270. var n2 = "".concat(this._n, ".increaseGroupCounters"), o2 = e3.groupID, s2 = e3.key, a2 = e3.value, r2 = this._getLocalGroupCounters(o2).avChatRoomKey, i2 = "groupID:".concat(o2, " key:").concat(s2, " value:").concat(a2), u2 = new ka("increaseGroupCounter");
  4271. u2.setMessage("".concat(i2)), xe.l("".concat(n2, ". ").concat(i2));
  4272. var c2 = [{ key: s2, value: a2 }];
  4273. return this._updateGroupCounters({ groupID: o2, counterList: c2, avChatRoomKey: r2, mode: kr }).then(function(e4) {
  4274. return u2.end(), xe.l("".concat(n2, " ok.")), Ka({ counters: e4 });
  4275. }).catch(function(e4) {
  4276. return t2._groupModule.probeNetwork().then(function(t3) {
  4277. var n3 = v(t3, 2), o3 = n3[0], s3 = n3[1];
  4278. u2.setError(e4, o3, s3).end();
  4279. }), xe.e("".concat(n2, " failed. error:"), e4), Ja(e4);
  4280. });
  4281. } }, { key: "decreaseGroupCounter", value: function(e3) {
  4282. var t2 = this;
  4283. if (!this._groupModule.canIUse(B.GRP_COUNTER))
  4284. return Ja({ code: da.CANNOT_USE_COMMERCIAL_ABILITY });
  4285. var n2 = "".concat(this._n, ".decreaseGroupCounter"), o2 = e3.groupID, s2 = e3.key, a2 = e3.value, r2 = this._getLocalGroupCounters(o2).avChatRoomKey, i2 = "groupID:".concat(o2, " key:").concat(s2, " value:").concat(a2), u2 = new ka("decreaseGroupCounter");
  4286. u2.setMessage("".concat(i2)), xe.l("".concat(n2, ". ").concat(i2));
  4287. var c2 = [{ key: s2, value: a2 }];
  4288. return this._updateGroupCounters({ groupID: o2, counterList: c2, avChatRoomKey: r2, mode: Lr }).then(function(e4) {
  4289. return u2.end(), xe.l("".concat(n2, " ok.")), Ka({ counters: e4 });
  4290. }).catch(function(e4) {
  4291. return t2._groupModule.probeNetwork().then(function(t3) {
  4292. var n3 = v(t3, 2), o3 = n3[0], s3 = n3[1];
  4293. u2.setError(e4, o3, s3).end();
  4294. }), xe.e("".concat(n2, " failed. error:"), e4), Ja(e4);
  4295. });
  4296. } }, { key: "getGroupCounters", value: function(e3) {
  4297. var t2 = this;
  4298. if (!this._groupModule.canIUse(B.GRP_COUNTER))
  4299. return Ja({ code: da.CANNOT_USE_COMMERCIAL_ABILITY });
  4300. var n2 = "".concat(this._n, ".getGroupCounters"), o2 = e3.groupID, s2 = e3.keyList, a2 = void 0 === s2 ? [] : s2, r2 = this._getLocalGroupCounters(o2), i2 = r2.avChatRoomKey, u2 = r2.lastUpdateTime, c2 = new ka("getGroupCounters");
  4301. if (c2.setMessage("groupID:".concat(o2)), Date.now() - u2 >= this.EXPIRE_TIME)
  4302. return this._getRemoteGroupCounters({ groupID: o2, avChatRoomKey: i2 }).then(function(e4) {
  4303. c2.setMoreMessage("from remote. count:".concat(e4.length)).end(), xe.l("".concat(n2, " from remote. groupID:").concat(o2));
  4304. var s3 = t2._getLocalCounters(o2, a2);
  4305. return Ka({ counters: s3 });
  4306. }).catch(function(e4) {
  4307. return t2._groupModule.probeNetwork().then(function(t3) {
  4308. var n3 = v(t3, 2), o3 = n3[0], s3 = n3[1];
  4309. c2.setError(e4, o3, s3).end();
  4310. }), Ja(e4);
  4311. });
  4312. c2.setMoreMessage("from cache").end(), xe.l("".concat(n2, " from cache. groupID:").concat(o2));
  4313. var l2 = this._getLocalCounters(o2, a2);
  4314. return za({ counters: l2 });
  4315. } }, { key: "_getRemoteGroupCounters", value: function(e3) {
  4316. var n2 = this;
  4317. return this._groupModule.request({ protocolName: Ls, requestData: t({}, e3) }).then(function(t2) {
  4318. var o2 = t2.data, s2 = o2.counterList, a2 = void 0 === s2 ? [] : s2, r2 = o2.groupCounterSeq;
  4319. return n2._updateLocalGroupCounters({ groupID: e3.groupID, counterList: a2, groupCounterSeq: r2 }), xe.l("".concat(n2._n, "._getRemoteGroupCounters ok. groupID:").concat(e3.groupID)), a2;
  4320. }).catch(function(e4) {
  4321. return Ja(e4);
  4322. });
  4323. } }, { key: "_convertObjectToList", value: function(e3) {
  4324. var t2 = [];
  4325. return Object.keys(e3).forEach(function(n2) {
  4326. t2.push({ key: n2, value: e3[n2] });
  4327. }), t2;
  4328. } }, { key: "_updateGroupCounters", value: function(e3) {
  4329. var n2 = "".concat(this._n, "._updateGroupCounters"), o2 = e3.groupID, s2 = e3.avChatRoomKey, a2 = e3.mode;
  4330. return xe.l("".concat(n2, ". groupID:").concat(o2, " avChatRoomKey:").concat(s2, " mode:").concat(a2)), this._groupModule.request({ protocolName: ks, requestData: t({}, e3) }).then(function(e4) {
  4331. xe.l("".concat(n2, " ok."));
  4332. var t2 = e4.data.counterList, o3 = {};
  4333. return (void 0 === t2 ? [] : t2).forEach(function(e5) {
  4334. var t3 = e5.key, n3 = e5.value;
  4335. o3[t3] = n3;
  4336. }), o3;
  4337. }).catch(function(e4) {
  4338. return Ja(e4);
  4339. });
  4340. } }, { key: "_hasLocalGroupCounters", value: function(e3) {
  4341. return this._groupCountersMap.has(e3);
  4342. } }, { key: "_getLocalGroupCounters", value: function(e3) {
  4343. return this._hasLocalGroupCounters(e3) || this.initGroupCountersCache({ groupID: e3 }), this._groupCountersMap.get(e3);
  4344. } }, { key: "_updateLocalGroupCounters", value: function(e3) {
  4345. var t2 = e3.groupID, n2 = e3.counterList, o2 = void 0 === n2 ? [] : n2, s2 = e3.groupCounterSeq;
  4346. if (this._hasLocalGroupCounters(t2)) {
  4347. var a2 = this._getLocalGroupCounters(t2), r2 = a2.counters, i2 = a2.avChatRoomKey, u2 = a2.groupCounterSeq;
  4348. if (s2 > 0 && s2 < u2)
  4349. return;
  4350. o2.forEach(function(e4) {
  4351. var t3 = e4.key, n3 = e4.value;
  4352. r2.set(t3, n3);
  4353. }), this._groupCountersMap.set(t2, { lastUpdateTime: Date.now(), groupCounterSeq: s2, counters: r2, avChatRoomKey: i2 });
  4354. }
  4355. } }, { key: "_deleteLocalGroupCounters", value: function(e3) {
  4356. var t2 = e3.groupID, n2 = e3.counterList, o2 = void 0 === n2 ? [] : n2, s2 = e3.groupCounterSeq;
  4357. if (this._hasLocalGroupCounters(t2)) {
  4358. var a2 = this._getLocalGroupCounters(t2), r2 = a2.counters, i2 = a2.avChatRoomKey;
  4359. o2.forEach(function(e4) {
  4360. r2.delete(e4.key);
  4361. }), this._groupCountersMap.set(t2, { lastUpdateTime: Date.now(), groupCounterSeq: s2, counters: r2, avChatRoomKey: i2 });
  4362. }
  4363. } }, { key: "_getLocalCounters", value: function(e3, t2) {
  4364. var n2 = {};
  4365. if (!this._hasLocalGroupCounters(e3))
  4366. return n2;
  4367. var o2 = this._getLocalGroupCounters(e3).counters;
  4368. if (t2.length > 0)
  4369. t2.forEach(function(e4) {
  4370. o2.has(e4) && (n2[e4] = o2.get(e4));
  4371. });
  4372. else {
  4373. var s2, a2 = D(o2.keys());
  4374. try {
  4375. for (a2.s(); !(s2 = a2.n()).done; ) {
  4376. var r2 = s2.value;
  4377. n2[r2] = o2.get(r2);
  4378. }
  4379. } catch (i2) {
  4380. a2.e(i2);
  4381. } finally {
  4382. a2.f();
  4383. }
  4384. }
  4385. return n2;
  4386. } }, { key: "reset", value: function() {
  4387. this._groupCountersMap.clear(), this.EXPIRE_TIME = 3e4;
  4388. } }]), e2;
  4389. }(), Rr = function() {
  4390. function e2(t2) {
  4391. o(this, e2);
  4392. var n2 = t2.manager, s2 = t2.groupID, a2 = t2.onInit, r2 = t2.onSuccess, i2 = t2.onFail;
  4393. this._n = "Polling", this._manager = n2, this._groupModule = n2._groupModule, this._onInit = a2, this._onSuccess = r2, this._onFail = i2, this._groupID = s2, this._timeoutID = -1, this._isRunning = false, this._protocolName = _s;
  4394. }
  4395. return a(e2, [{ key: "start", value: function() {
  4396. var e3 = this._groupModule.isLoggedIn();
  4397. e3 || (this._protocolName = hs), xe.l("".concat(this._n, ".start pollingInterval:").concat(this._manager.getPollingInterval(), " isLoggedIn:").concat(e3)), this._isRunning = true, this._request();
  4398. } }, { key: "isRunning", value: function() {
  4399. return this._isRunning;
  4400. } }, { key: "_request", value: function() {
  4401. var e3 = this, t2 = this._onInit(this._groupID);
  4402. this._groupModule.request({ protocolName: this._protocolName, requestData: t2 }).then(function(t3) {
  4403. e3._onSuccess(e3._groupID, t3), e3.isRunning() && (clearTimeout(e3._timeoutID), e3._timeoutID = setTimeout(e3._request.bind(e3), e3._manager.getPollingInterval()));
  4404. }).catch(function(t3) {
  4405. e3._onFail(e3._groupID, t3), e3.isRunning() && (clearTimeout(e3._timeoutID), e3._timeoutID = setTimeout(e3._request.bind(e3), e3._manager.MAX_POLLING_INTERVAL));
  4406. });
  4407. } }, { key: "stop", value: function() {
  4408. xe.l("".concat(this._n, ".stop")), this._timeoutID > 0 && (clearTimeout(this._timeoutID), this._timeoutID = -1), this._isRunning = false;
  4409. } }, { key: "getPollingTimerID", value: function() {
  4410. return this._timeoutID;
  4411. } }]), e2;
  4412. }(), Nr = { 3: true, 4: true, 5: true, 6: true, 17: true }, Or = function() {
  4413. function e2(t2) {
  4414. o(this, e2), this._groupModule = t2, this._n = "AVChatRoomHandler", this._joinedGroupMap = /* @__PURE__ */ new Map(), this._pollingRequestInfoMap = /* @__PURE__ */ new Map(), this._pollingInstanceMap = /* @__PURE__ */ new Map(), this.sequencesLinkedList = new lr(200), this.messageIDLinkedList = new lr(100), this.receivedMessageCount = 0, this._reportMessageStackedCount = 0, this._onlineMemberCountMap = /* @__PURE__ */ new Map(), this.DEFAULT_EXPIRE_TIME = 60, this.DEFAULT_POLLING_INTERVAL = 300, this.MAX_POLLING_INTERVAL = 2e3, this._pollingInterval = this.DEFAULT_POLLING_INTERVAL, this.DEFAULT_POLLING_NO_MESSAGE_COUNT = 20, this.DEFAULT_POLLING_INTERVAL_PLUS = 2e3, this._pollingNoMessageCount = 0, this._startBroadcastSeq = 1, this._broadcastMessageIDMap = /* @__PURE__ */ new Map(), this.DEFAULT_POLLING_SIMPLIFIED_MSG = 0;
  4415. }
  4416. return a(e2, [{ key: "hasJoinedAVChatRoom", value: function() {
  4417. return this._joinedGroupMap.size > 0;
  4418. } }, { key: "checkJoinedAVChatRoomByID", value: function(e3) {
  4419. return this._joinedGroupMap.has(e3);
  4420. } }, { key: "getJoinedAVChatRoom", value: function() {
  4421. return this._joinedGroupMap.size > 0 ? m(this._joinedGroupMap.keys()) : null;
  4422. } }, { key: "_updateRequestData", value: function(e3) {
  4423. var n2 = this._pollingRequestInfoMap.get(e3);
  4424. return e3 === m(this._pollingInstanceMap.keys())[0] ? t(t({}, n2), {}, { startBroadcastSeq: this._startBroadcastSeq, simplifiedMessage: this.DEFAULT_POLLING_SIMPLIFIED_MSG }) : t(t({}, n2), {}, { simplifiedMessage: this.DEFAULT_POLLING_SIMPLIFIED_MSG });
  4425. } }, { key: "_handleSuccess", value: function(e3, t2) {
  4426. var n2 = t2.data, o2 = n2.key, s2 = n2.nextSeq, a2 = n2.rspMsgList, r2 = n2.errorCode, i2 = n2.nextBroadcastSeq, u2 = n2.broadcastMessageList;
  4427. if (0 !== r2) {
  4428. var c2 = this._pollingRequestInfoMap.get(e3), l2 = new ka("longPollingAVError"), p2 = c2 ? "".concat(c2.key, "-").concat(c2.startSeq) : "requestInfo is undefined";
  4429. l2.setMessage("".concat(e3, "-").concat(p2, "-").concat(t2.errorInfo)).setCode(t2.errorCode).setNetworkType(this._groupModule.getNetworkType()).end(true);
  4430. } else {
  4431. if (!this.checkJoinedAVChatRoomByID(e3))
  4432. return;
  4433. et(o2) && $e(s2) && this._pollingRequestInfoMap.set(e3, { key: o2, startSeq: s2 }), $e(i2) && i2 > this._startBroadcastSeq && (this._startBroadcastSeq = i2), st(a2) && a2.length > 0 ? (a2.forEach(function(e4) {
  4434. e4.to = e4.groupID;
  4435. }), this.onMessage(a2)) : (this._pollingNoMessageCount += 1, this._pollingNoMessageCount === this.DEFAULT_POLLING_NO_MESSAGE_COUNT && (this._pollingInterval = this.DEFAULT_POLLING_INTERVAL + this.DEFAULT_POLLING_INTERVAL_PLUS)), this._onBroadcastMessage(u2);
  4436. }
  4437. } }, { key: "_handleFailure", value: function(e3, t2) {
  4438. } }, { key: "onMessage", value: function(e3) {
  4439. if (st(e3) && 0 !== e3.length) {
  4440. 0 !== this._pollingNoMessageCount && (this._pollingNoMessageCount = 0, this._pollingInterval = this.DEFAULT_POLLING_INTERVAL);
  4441. var t2 = null, n2 = [], o2 = this._getModule(Fn), s2 = this._getModule($n), a2 = e3.length;
  4442. a2 > 1 && e3.sort(function(e4, t3) {
  4443. return e4.sequence - t3.sequence;
  4444. });
  4445. for (var r2 = this._getModule(qn), i2 = 0; i2 < a2; i2++) {
  4446. var u2 = this.restoreMessageFromSimplified(e3[i2]);
  4447. if (Nr[u2.event]) {
  4448. if (6 === u2.event) {
  4449. if (this._groupModule.isGroupAttributesUpdatedNotice(u2))
  4450. continue;
  4451. if (this._groupModule.isGroupCountersNotice(u2))
  4452. continue;
  4453. }
  4454. this.receivedMessageCount += 1, t2 = this.packMessage(u2, u2.event);
  4455. var c2 = 1 === u2.isModified, l2 = 1 === u2.isHistoryMessage;
  4456. if ((r2.isUnlimitedAVChatRoom() || !this.sequencesLinkedList.has(t2.sequence)) && !this.messageIDLinkedList.has(t2.ID)) {
  4457. var p2 = t2.conversationID;
  4458. if (this.receivedMessageCount % 50 == 0 ? this._getModule(Jn).detectFirstRound(p2, this.sequencesLinkedList.data()) : this.receivedMessageCount % 80 == 0 && this._getModule(Jn).detectSecondRound(p2, this.sequencesLinkedList.data()), null !== this.sequencesLinkedList.tail()) {
  4459. var d2 = this.sequencesLinkedList.tail().value, g2 = t2.sequence - d2;
  4460. g2 > 1 && g2 <= 20 ? this._getModule(Jn).onMessageMaybeLost(p2, d2 + 1, g2 - 1) : g2 < -1 && g2 >= -20 && this._getModule(Jn).onMessageMaybeLost(p2, t2.sequence + 1, Math.abs(g2) - 1);
  4461. }
  4462. this.sequencesLinkedList.set(t2.sequence), this.messageIDLinkedList.set(t2.ID);
  4463. var _2 = false;
  4464. if (this._isMessageSentByCurrentInstance(t2) ? c2 && (_2 = true, t2.isModified = c2, o2.updateMessageIsModifiedProperty(t2)) : _2 = true, _2) {
  4465. if (t2.conversationType === S.CONV_SYSTEM && 5 === t2.payload.operationType && this._onGroupDismissed(t2.payload.groupProfile.groupID), !l2 && t2.conversationType !== S.CONV_SYSTEM) {
  4466. var h2 = t2.conversationID.replace(S.CONV_GROUP, "");
  4467. this._pollingInstanceMap.has(h2) ? this._groupModule.isLoggedIn() && s2.addMessageSequence({ key: Ca, message: t2 }) : (t2.type !== S.MSG_GRP_TIP && t2.clientTime > 0 && s2.addMessageDelay(t2.clientTime), s2.addMessageSequence({ key: Ia, message: t2 }));
  4468. }
  4469. n2.push(t2);
  4470. }
  4471. }
  4472. } else
  4473. xe.w("".concat(this._n, ".onMessage unknown event:").concat(u2.event));
  4474. }
  4475. if (0 !== n2.length) {
  4476. this._groupModule.filterModifiedMessage(n2);
  4477. var f2 = this.packConversationOption(n2);
  4478. if (f2.length > 0)
  4479. this._getModule(Fn).onNewMessage({ conversationOptionsList: f2, isInstantMessage: true });
  4480. xe.d("".concat(this._n, ".onMessage count:").concat(n2.length)), this._checkMessageStacked(n2);
  4481. var v2 = this._groupModule.filterUnmodifiedMessage(n2);
  4482. v2.length > 0 && this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED, v2), n2.length = 0;
  4483. }
  4484. }
  4485. } }, { key: "isBroadcastOrNormal", value: function(e3) {
  4486. return 3 === e3 || 17 === e3;
  4487. } }, { key: "isGroupTip", value: function(e3) {
  4488. return 4 === e3 || 6 === e3;
  4489. } }, { key: "isGroupSystemNotice", value: function(e3) {
  4490. return 5 === e3;
  4491. } }, { key: "restoreGroupTipElements", value: function() {
  4492. var e3 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  4493. e3.groupJoinType || (e3.groupJoinType = 1);
  4494. var t2 = e3.operatorInfo, n2 = void 0 === t2 ? {} : t2, o2 = e3.operatorID, s2 = e3.userIDList, a2 = void 0 === s2 ? [] : s2, r2 = n2.userID, i2 = void 0 === r2 ? o2 : r2, u2 = n2.avatar, c2 = void 0 === u2 ? "" : u2, l2 = n2.nick, p2 = void 0 === l2 ? "" : l2;
  4495. e3.operatorInfo = { userID: i2, avatar: c2, nick: p2 };
  4496. var d2 = a2.map(function(e4) {
  4497. return { userID: e4 };
  4498. });
  4499. return e3.memberInfoList = e3.memberInfoList || d2, e3;
  4500. } }, { key: "restoreMessageFromSimplified", value: function(e3) {
  4501. var n2 = e3.event;
  4502. if (this.isBroadcastOrNormal(n2) && (e3.cloudCustomData = e3.cloudCustomData || "", e3.elements = e3.elements.map(function(e4) {
  4503. if (e4.type === S.MSG_CUSTOM) {
  4504. var n3 = e4.content, o3 = void 0 === n3 ? {} : n3;
  4505. e4.content = t({ data: "", description: "", extension: "" }, o3);
  4506. }
  4507. return e4;
  4508. })), (this.isGroupTip(n2) || this.isGroupSystemNotice(n2)) && (e3.from = e3.from || "@TIM#SYSTEM"), this.isGroupTip(n2)) {
  4509. e3.elements = this.restoreGroupTipElements(e3.elements);
  4510. var o2 = e3.elements, s2 = void 0 === o2 ? {} : o2, a2 = s2.operationType, i2 = s2.operatorInfo;
  4511. if (1 === a2) {
  4512. var u2 = [{ userID: (void 0 === i2 ? {} : i2).userID }];
  4513. s2.memberInfoList = s2.memberInfoList || u2;
  4514. }
  4515. }
  4516. if (this.isGroupSystemNotice(n2)) {
  4517. var c2 = e3.elements, l2 = c2.memberInfoList, p2 = c2.operatorInfo;
  4518. l2 || (l2 = void 0 === p2 ? {} : p2), e3.elements.memberInfoList = t({ userID: e3.elements.operatorID, avatar: "", nick: "" }, l2), e3.elements = t({ authentication: "", remarkInfo: "", messageKey: 1e3 * e3.time }, e3.elements);
  4519. var d2 = Object.keys(e3.elements).filter(function(e4) {
  4520. return "operatorInfo" !== e4;
  4521. }).reduce(function(n3, o3) {
  4522. return t(t({}, n3), {}, r({}, o3, e3.elements[o3]));
  4523. }, {});
  4524. e3.elements = d2;
  4525. }
  4526. return e3;
  4527. } }, { key: "_onGroupDismissed", value: function(e3) {
  4528. xe.l("".concat(this._n, "._onGroupDismissed groupID:").concat(e3)), this._groupModule.deleteLocalGroupAndConversation(e3), this.reset(e3);
  4529. } }, { key: "_checkMessageStacked", value: function(e3) {
  4530. var t2 = "MessageStacked", n2 = e3.length;
  4531. n2 >= 100 && (this._groupModule.outputWarning(t2), this._reportMessageStackedCount < 5 && (new ka(t2).setNetworkType(this._groupModule.getNetworkType()).setMessage("count:".concat(n2, " groupID:").concat(m(this._joinedGroupMap.keys()))).setLevel("warning").end(), this._reportMessageStackedCount += 1));
  4532. } }, { key: "_isMessageSentByCurrentInstance", value: function(e3) {
  4533. return !!this._getModule(Fn).isMessageSentByCurrentInstance(e3);
  4534. } }, { key: "packMessage", value: function(e3, t2) {
  4535. e3.currentUser = this._groupModule.getMyUserID(), e3.conversationType = 5 === t2 ? S.CONV_SYSTEM : S.CONV_GROUP, e3.isSystemMessage = !!e3.isSystemMessage;
  4536. var n2 = new Ha(e3), o2 = this.packElements(e3, t2);
  4537. return n2.setElement(o2, this._groupModule.getFileDownloadProxy()), n2;
  4538. } }, { key: "packElements", value: function(e3, n2) {
  4539. return 4 === n2 || 6 === n2 ? (this._updateMemberCountByGroupTips(e3), { type: S.MSG_GRP_TIP, content: t(t({}, e3.elements), {}, { groupProfile: e3.groupProfile }) }) : 5 === n2 ? { type: S.MSG_GRP_SYS_NOTICE, content: t(t({}, e3.elements), {}, { groupProfile: t(t({}, e3.groupProfile), {}, { groupID: e3.groupID }) }) } : this._getModule(Hn).parseElements(e3.elements, e3.from);
  4540. } }, { key: "packConversationOption", value: function(e3) {
  4541. for (var t2 = /* @__PURE__ */ new Map(), n2 = 0; n2 < e3.length; n2++) {
  4542. var o2 = e3[n2], s2 = o2.conversationID;
  4543. if (t2.has(s2)) {
  4544. var a2 = t2.get(s2);
  4545. a2.lastMessage = o2, "in" === o2.flow && a2.unreadCount++;
  4546. } else
  4547. t2.set(s2, { conversationID: o2.conversationID, unreadCount: "out" === o2.flow ? 0 : 1, type: o2.conversationType, subType: o2.conversationSubType, lastMessage: o2 });
  4548. }
  4549. return m(t2.values());
  4550. } }, { key: "_updateMemberCountByGroupTips", value: function(e3) {
  4551. var t2 = e3.groupProfile.groupID, n2 = e3.elements.onlineMemberInfo, o2 = void 0 === n2 ? void 0 : n2;
  4552. if (!jt(o2)) {
  4553. var s2 = o2.onlineMemberNum, a2 = void 0 === s2 ? 0 : s2, r2 = o2.expireTime, i2 = void 0 === r2 ? this.DEFAULT_EXPIRE_TIME : r2, u2 = this._onlineMemberCountMap.get(t2) || {}, c2 = Date.now();
  4554. jt(u2) ? Object.assign(u2, { lastReqTime: 0, lastSyncTime: 0, latestUpdateTime: c2, memberCount: a2, expireTime: i2 }) : (u2.latestUpdateTime = c2, u2.memberCount = a2), xe.d("".concat(this._n, "._updateMemberCountByGroupTips info:"), u2), this._onlineMemberCountMap.set(t2, u2);
  4555. }
  4556. } }, { key: "_onBroadcastMessage", value: function(e3) {
  4557. if (!jt(e3)) {
  4558. for (var t2 = [], n2 = e3.length, o2 = null, s2 = 0; s2 < n2; s2++) {
  4559. var a2 = this.restoreMessageFromSimplified(e3[s2]);
  4560. Nr[a2.event] ? ((o2 = this.packMessage(a2, a2.event)).isBroadcastMessage = true, this._broadcastMessageIDMap.has(o2.ID) || (t2.push(o2), this._broadcastMessageIDMap.set(o2.ID, 1))) : xe.w("".concat(this._n, "._onBroadcastMessage unknown event:").concat(a2.event));
  4561. }
  4562. t2.length > 0 && this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED, t2);
  4563. }
  4564. } }, { key: "start", value: function(e3) {
  4565. if (this._pollingInstanceMap.has(e3)) {
  4566. var t2 = this._pollingInstanceMap.get(e3);
  4567. t2.isRunning() || t2.start();
  4568. } else {
  4569. var n2 = new Rr({ manager: this, groupID: e3, onInit: this._updateRequestData.bind(this), onSuccess: this._handleSuccess.bind(this), onFail: this._handleFailure.bind(this) });
  4570. n2.start(), this._pollingInstanceMap.set(e3, n2), xe.l("".concat(this._n, ".start groupID:").concat(e3));
  4571. }
  4572. } }, { key: "handleJoinResult", value: function(e3) {
  4573. var t2 = this;
  4574. return this._preCheck().then(function() {
  4575. var n2 = e3.longPollingKey, o2 = e3.group, s2 = o2.groupID;
  4576. return t2._joinedGroupMap.set(s2, o2), t2._groupModule.updateGroupMap([o2]), t2._groupModule.deleteUnjoinedAVChatRoom(s2), t2._groupModule.emitGroupListUpdate(true, false), at(n2) ? za({ status: Ye, group: o2 }) : Promise.resolve();
  4577. });
  4578. } }, { key: "startRunLoop", value: function(e3) {
  4579. var t2 = this;
  4580. return this.handleJoinResult(e3).then(function() {
  4581. var n2 = e3.longPollingKey, o2 = e3.group, s2 = e3.startSeq, a2 = void 0 === s2 ? 0 : s2, r2 = o2.groupID;
  4582. return t2._pollingRequestInfoMap.set(r2, { key: n2, startSeq: a2 }), t2.start(r2), t2._groupModule.isLoggedIn() ? za({ status: Ye, group: o2 }) : za({ status: Ye });
  4583. });
  4584. } }, { key: "_preCheck", value: function() {
  4585. if (this._getModule(qn).isUnlimitedAVChatRoom())
  4586. return Promise.resolve();
  4587. if (!this.hasJoinedAVChatRoom())
  4588. return Promise.resolve();
  4589. var e3 = v(this._joinedGroupMap.entries().next().value, 2), t2 = e3[0], n2 = e3[1];
  4590. if (this._groupModule.isLoggedIn()) {
  4591. if (!(n2.selfInfo.role === S.GRP_MBR_ROLE_OWNER || n2.ownerID === this._groupModule.getMyUserID()))
  4592. return this._groupModule.quitGroup(t2);
  4593. this._groupModule.deleteLocalGroupAndConversation(t2);
  4594. } else
  4595. this._groupModule.deleteLocalGroupAndConversation(t2);
  4596. return this.reset(t2), Promise.resolve();
  4597. } }, { key: "joinWithoutAuth", value: function(e3) {
  4598. var t2 = this, n2 = e3.groupID, o2 = "".concat(this._n, ".").concat("joinWithoutAuth"), s2 = new ka("joinWithoutAuth");
  4599. return this._groupModule.request({ protocolName: Qo, requestData: e3 }).then(function(e4) {
  4600. var a2 = e4.data.longPollingKey;
  4601. if (t2._groupModule.probeNetwork().then(function(e5) {
  4602. var t3 = v(e5, 2);
  4603. t3[0];
  4604. var o3 = t3[1];
  4605. s2.setNetworkType(o3).setMessage("groupID:".concat(n2, " longPollingKey:").concat(a2)).end(true);
  4606. }), at(a2))
  4607. return Ja({ code: da.CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN });
  4608. xe.l("".concat(o2, " ok. groupID:").concat(n2)), t2._getModule(Fn).setCompleted("".concat(S.CONV_GROUP).concat(n2));
  4609. var r2 = new dr({ groupID: n2 });
  4610. return t2.startRunLoop({ group: r2, longPollingKey: a2 }), Ka({ status: Ye });
  4611. }).catch(function(e4) {
  4612. return xe.e("".concat(o2, " failed. groupID:").concat(n2, " error:"), e4), t2._groupModule.probeNetwork().then(function(t3) {
  4613. var o3 = v(t3, 2), a2 = o3[0], r2 = o3[1];
  4614. s2.setError(e4, a2, r2).setMessage("groupID:".concat(n2)).end(true);
  4615. }), Ja(e4);
  4616. }).finally(function() {
  4617. t2._groupModule.getModule(Vn).reportAtOnce();
  4618. });
  4619. } }, { key: "getGroupOnlineMemberCount", value: function(e3) {
  4620. var t2 = this._onlineMemberCountMap.get(e3) || {}, n2 = Date.now();
  4621. return jt(t2) || n2 - t2.lastSyncTime > 1e3 * t2.expireTime && n2 - t2.latestUpdateTime > 1e4 && n2 - t2.lastReqTime > 3e3 ? (t2.lastReqTime = n2, this._onlineMemberCountMap.set(e3, t2), this._getGroupOnlineMemberCount(e3).then(function(e4) {
  4622. return Ka({ memberCount: e4.memberCount });
  4623. }).catch(function(e4) {
  4624. return Ja(e4);
  4625. })) : za({ memberCount: t2.memberCount });
  4626. } }, { key: "_getGroupOnlineMemberCount", value: function(e3) {
  4627. var t2 = this, n2 = "".concat(this._n, ".").concat("_getGroupOnlineMemberCount");
  4628. return this._groupModule.request({ protocolName: fs, requestData: { groupID: e3 } }).then(function(o2) {
  4629. var s2 = t2._onlineMemberCountMap.get(e3) || {}, a2 = o2.data, r2 = a2.onlineMemberNum, i2 = void 0 === r2 ? 0 : r2, u2 = a2.expireTime, c2 = void 0 === u2 ? t2.DEFAULT_EXPIRE_TIME : u2;
  4630. xe.l("".concat(n2, " ok. groupID:").concat(e3, " memberCount:").concat(i2, " expireTime:").concat(c2));
  4631. var l2 = Date.now();
  4632. return jt(s2) && (s2.lastReqTime = l2), t2._onlineMemberCountMap.set(e3, Object.assign(s2, { lastSyncTime: l2, latestUpdateTime: l2, memberCount: i2, expireTime: c2 })), { memberCount: i2 };
  4633. }).catch(function(o2) {
  4634. return xe.w("".concat(n2, " failed. error:"), o2), new ka("_getGroupOnlineMemberCount").setCode(o2.code).setMessage("groupID:".concat(e3, " error:").concat(JSON.stringify(o2))).setNetworkType(t2._groupModule.getNetworkType()).end(), Promise.reject(o2);
  4635. });
  4636. } }, { key: "_getModule", value: function(e3) {
  4637. return this._groupModule.getModule(e3);
  4638. } }, { key: "setPollingInterval", value: function(e3) {
  4639. at(e3) || ($e(e3) ? this._pollingInterval = this.DEFAULT_POLLING_INTERVAL = e3 : this._pollingInterval = this.DEFAULT_POLLING_INTERVAL = parseInt(e3, 10));
  4640. } }, { key: "setPollingIntervalPlus", value: function(e3) {
  4641. at(e3) || ($e(e3) ? this.DEFAULT_POLLING_INTERVAL_PLUS = e3 : this.DEFAULT_POLLING_INTERVAL_PLUS = parseInt(e3, 10));
  4642. } }, { key: "setPollingNoMessageCount", value: function(e3) {
  4643. at(e3) || ($e(e3) ? this.DEFAULT_POLLING_NO_MESSAGE_COUNT = e3 : this.DEFAULT_POLLING_NO_MESSAGE_COUNT = parseInt(e3, 10));
  4644. } }, { key: "setPollingSimplifiedMessage", value: function(e3) {
  4645. at(e3) || "0" !== e3 && "1" !== e3 || (this.DEFAULT_POLLING_SIMPLIFIED_MSG = parseInt(e3, 10));
  4646. } }, { key: "getPollingInterval", value: function() {
  4647. return this._pollingInterval;
  4648. } }, { key: "onAVChatRoomMemberBanned", value: function(e3) {
  4649. var t2 = e3.payload.groupProfile.groupID;
  4650. xe.l("".concat(this._n, ".onAVChatRoomMemberBanned groupID:").concat(t2)), this._groupModule.deleteLocalGroupAndConversation(t2), this.reset(t2);
  4651. } }, { key: "restartPolling", value: function() {
  4652. xe.l("".concat(this._n, ".restartPolling count:").concat(this._pollingInstanceMap.size));
  4653. var e3, t2 = D(this._pollingInstanceMap.values());
  4654. try {
  4655. for (t2.s(); !(e3 = t2.n()).done; ) {
  4656. var n2 = e3.value;
  4657. n2.stop(), n2.start();
  4658. }
  4659. } catch (o2) {
  4660. t2.e(o2);
  4661. } finally {
  4662. t2.f();
  4663. }
  4664. } }, { key: "getPollingTimerID", value: function(e3) {
  4665. if (!this._pollingInstanceMap.has(e3))
  4666. return -1;
  4667. var t2 = this._pollingInstanceMap.get(e3).getPollingTimerID();
  4668. return xe.l("".concat(this._n, ".getPollingTimerID groupID:").concat(e3, " timerID:").concat(t2)), t2;
  4669. } }, { key: "reset", value: function(e3) {
  4670. if (e3) {
  4671. xe.l("".concat(this._n, ".reset groupID:").concat(e3));
  4672. var t2 = this._pollingInstanceMap.get(e3);
  4673. t2 && t2.stop(), this._pollingInstanceMap.delete(e3), this._joinedGroupMap.delete(e3), this._pollingRequestInfoMap.delete(e3), this._onlineMemberCountMap.delete(e3);
  4674. } else {
  4675. xe.l("".concat(this._n, ".reset all"));
  4676. var n2, o2 = D(this._pollingInstanceMap.values());
  4677. try {
  4678. for (o2.s(); !(n2 = o2.n()).done; ) {
  4679. n2.value.stop();
  4680. }
  4681. } catch (s2) {
  4682. o2.e(s2);
  4683. } finally {
  4684. o2.f();
  4685. }
  4686. this._pollingInstanceMap.clear(), this._joinedGroupMap.clear(), this._pollingRequestInfoMap.clear(), this._onlineMemberCountMap.clear(), this._broadcastMessageIDMap.clear();
  4687. }
  4688. this.sequencesLinkedList.reset(), this.messageIDLinkedList.reset(), this.receivedMessageCount = 0, this._reportMessageStackedCount = 0, this._pollingInterval = this.DEFAULT_POLLING_INTERVAL = 300, this.DEFAULT_POLLING_NO_MESSAGE_COUNT = 20, this.DEFAULT_POLLING_INTERVAL_PLUS = 2e3, this._pollingNoMessageCount = 0;
  4689. } }]), e2;
  4690. }(), Gr = 1, Ur = 15, Pr = function() {
  4691. function e2(t2) {
  4692. o(this, e2), this._groupModule = t2, this._n = "GroupSystemNoticeHandler", this.pendencyMap = /* @__PURE__ */ new Map();
  4693. }
  4694. return a(e2, [{ key: "onNewGroupSystemNotice", value: function(e3) {
  4695. var t2 = e3.dataList, n2 = e3.isSyncingEnded, o2 = e3.isInstantMessage;
  4696. xe.d("".concat(this._n, ".onReceiveSystemNotice count:").concat(t2.length));
  4697. var s2 = this.newSystemNoticeStoredAndSummary({ notifiesList: t2, isInstantMessage: o2 }), a2 = s2.eventDataList, r2 = s2.result;
  4698. a2.length > 0 && (this._groupModule.getModule(Fn).onNewMessage({ conversationOptionsList: a2, isInstantMessage: o2 }), this._onReceivedGroupSystemNotice({ result: r2, isInstantMessage: o2 }));
  4699. o2 ? r2.length > 0 && this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED, r2) : true === n2 && this._clearGroupSystemNotice();
  4700. } }, { key: "newSystemNoticeStoredAndSummary", value: function(e3) {
  4701. var n2 = e3.notifiesList, o2 = e3.isInstantMessage, s2 = null, a2 = n2.length, r2 = 0, i2 = [], u2 = { conversationID: S.CONV_SYSTEM, unreadCount: 0, type: S.CONV_SYSTEM, subType: null, lastMessage: null };
  4702. for (r2 = 0; r2 < a2; r2++) {
  4703. var c2 = n2[r2], l2 = c2.groupProfile, p2 = l2.communityType, d2 = void 0 === p2 ? 0 : p2, g2 = l2.topicID, _2 = void 0 === g2 ? void 0 : g2, h2 = c2.elements, f2 = h2.topicIDList, v2 = void 0 === f2 ? void 0 : f2, m2 = h2.operationType;
  4704. if (!(2 !== d2 || jt(_2) && jt(v2))) {
  4705. if ([17, 18, 20].includes(m2)) {
  4706. this._handleTopicSystemNotice(c2);
  4707. continue;
  4708. }
  4709. jt(_2) || (c2.to = _2);
  4710. }
  4711. if (c2.elements.operationType !== Ur)
  4712. c2.currentUser = this._groupModule.getMyUserID(), c2.conversationType = S.CONV_SYSTEM, c2.conversationID = S.CONV_SYSTEM, (s2 = new Ha(c2)).setElement({ type: S.MSG_GRP_SYS_NOTICE, content: t(t({}, c2.elements), {}, { groupProfile: t({}, c2.groupProfile) }) }), s2.isSystemMessage = true, (1 === s2.sequence && 1 === s2.random || 2 === s2.sequence && 2 === s2.random) && (s2.sequence = _t(), s2.random = _t(), s2.generateMessageID(), xe.l("".concat(this._n, ".newSystemNoticeStoredAndSummary sequence and random maybe duplicated, regenerate. ID:").concat(s2.ID))), this._groupModule.getModule(Fn).pushIntoNoticeResult(i2, s2) && (o2 ? u2.unreadCount++ : s2.setIsRead(true), u2.subType = s2.conversationSubType);
  4713. }
  4714. return u2.lastMessage = i2[i2.length - 1], { eventDataList: i2.length > 0 ? [u2] : [], result: i2 };
  4715. } }, { key: "_clearGroupSystemNotice", value: function() {
  4716. var e3 = this;
  4717. this._getPendencyList().then(function(t2) {
  4718. t2.forEach(function(t3) {
  4719. e3.pendencyMap.set("".concat(t3.from, "_").concat(t3.groupID, "_").concat(t3.to), t3);
  4720. });
  4721. var n2 = e3._groupModule.getModule(Fn).getLocalMessageList(S.CONV_SYSTEM), o2 = [];
  4722. n2.forEach(function(t3) {
  4723. var n3 = t3.payload, s2 = n3.operatorID, a2 = n3.operationType, r2 = n3.groupProfile;
  4724. if (a2 === Gr) {
  4725. var i2 = "".concat(s2, "_").concat(r2.groupID, "_").concat(r2.to), u2 = e3.pendencyMap.get(i2);
  4726. u2 && $e(u2.handled) && 0 !== u2.handled && o2.push(t3);
  4727. }
  4728. }), e3.deleteGroupSystemNotice({ messageList: o2 });
  4729. });
  4730. } }, { key: "deleteGroupSystemNotice", value: function(e3) {
  4731. var t2 = this, n2 = "".concat(this._n, ".deleteGroupSystemNotice");
  4732. return st(e3.messageList) && 0 !== e3.messageList.length ? (xe.l("".concat(n2, " ") + e3.messageList.map(function(e4) {
  4733. return e4.ID;
  4734. })), this._groupModule.request({ protocolName: gs, requestData: { messageListToDelete: e3.messageList.map(function(e4) {
  4735. return { from: S.CONV_SYSTEM, messageSeq: e4.clientSequence, messageRandom: e4.random };
  4736. }) } }).then(function() {
  4737. xe.l("".concat(n2, " ok"));
  4738. var o2 = t2._groupModule.getModule(Fn);
  4739. return e3.messageList.forEach(function(e4) {
  4740. o2.deleteLocalMessage(e4);
  4741. }), Ka();
  4742. }).catch(function(e4) {
  4743. return xe.e("".concat(n2, " error:"), e4), Ja(e4);
  4744. })) : za();
  4745. } }, { key: "_getPendencyList", value: function() {
  4746. var e3 = this, t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, n2 = t2.type, o2 = void 0 === n2 ? void 0 : n2, s2 = t2.startTime, a2 = void 0 === s2 ? 0 : s2, r2 = t2.limit, i2 = void 0 === r2 ? 20 : r2;
  4747. return this._groupModule.request({ protocolName: ds, requestData: { type: o2, startTime: a2, limit: i2, handleAccount: this._groupModule.getMyUserID() } }).then(function(t3) {
  4748. var n3 = t3.data.pendencyList;
  4749. return 0 !== t3.data.nextStartTime ? e3._getPendencyList({ startTime: t3.data.nextStartTime }).then(function(e4) {
  4750. return [].concat(m(n3), m(e4));
  4751. }) : n3;
  4752. });
  4753. } }, { key: "getGroupApplicationList", value: function() {
  4754. var e3 = this;
  4755. return this._getPendencyList().then(function(t2) {
  4756. return e3._getPendencyList({ type: S.GRP_COMMUNITY }).then(function(n2) {
  4757. return t2.push.apply(t2, m(n2)), e3._handlePendencyResult(t2);
  4758. }).catch(function(n2) {
  4759. return e3._handlePendencyResult(t2);
  4760. });
  4761. });
  4762. } }, { key: "_handlePendencyResult", value: function(e3) {
  4763. var t2 = this, n2 = [];
  4764. return e3.forEach(function(e4) {
  4765. t2.pendencyMap.set("".concat(e4.from, "_").concat(e4.groupID, "_").concat(e4.to), e4), 0 === e4.handled && n2.push({ applicant: e4.from, applicantNick: e4.fromUserNickName, groupName: e4.groupName, groupID: e4.groupID, authentication: e4.authentication, messageKey: e4.time, applicationType: e4.applicationType, userID: e4.userID });
  4766. }), za({ applicationList: n2 });
  4767. } }, { key: "_onReceivedGroupSystemNotice", value: function(e3) {
  4768. var t2 = this, n2 = e3.result;
  4769. e3.isInstantMessage && n2.forEach(function(e4) {
  4770. switch (e4.payload.operationType) {
  4771. case 1:
  4772. break;
  4773. case 2:
  4774. t2._onApplyGroupRequestAgreed(e4);
  4775. break;
  4776. case 3:
  4777. break;
  4778. case 4:
  4779. t2._onMemberKicked(e4);
  4780. break;
  4781. case 5:
  4782. t2._onGroupDismissed(e4);
  4783. break;
  4784. case 6:
  4785. break;
  4786. case 7:
  4787. t2._onInviteGroup(e4);
  4788. break;
  4789. case 8:
  4790. t2._onQuitGroup(e4);
  4791. break;
  4792. case 9:
  4793. t2._onSetManager(e4);
  4794. break;
  4795. case 10:
  4796. t2._onDeleteManager(e4);
  4797. break;
  4798. case 11:
  4799. case 12:
  4800. case 15:
  4801. break;
  4802. case 20:
  4803. t2._onMessageRemindTypeSynced(e4);
  4804. break;
  4805. case 21:
  4806. t2._groupModule.onAVChatRoomMemberBanned(e4);
  4807. }
  4808. });
  4809. } }, { key: "_onApplyGroupRequestAgreed", value: function(e3) {
  4810. var t2 = this, n2 = e3.payload.groupProfile.groupID;
  4811. this._groupModule.hasLocalGroup(n2) || this._groupModule.getGroupProfile({ groupID: n2 }).then(function(e4) {
  4812. var n3 = e4.data.group;
  4813. if (n3) {
  4814. t2._groupModule.updateGroupMap([n3]);
  4815. var o2 = !n3.isSupportTopic;
  4816. t2._groupModule.emitGroupListUpdate(true, o2);
  4817. }
  4818. });
  4819. } }, { key: "_onMemberKicked", value: function(e3) {
  4820. var t2 = e3.payload.groupProfile.groupID;
  4821. this._groupModule.hasLocalGroup(t2) && this._groupModule.deleteLocalGroupAndConversation(t2);
  4822. } }, { key: "_onGroupDismissed", value: function(e3) {
  4823. var t2 = e3.payload.groupProfile.groupID;
  4824. this._groupModule.hasLocalGroup(t2) && this._groupModule.deleteLocalGroupAndConversation(t2);
  4825. var n2 = this._groupModule._AVChatRoomHandler;
  4826. n2 && n2.checkJoinedAVChatRoomByID(t2) && n2.reset(t2);
  4827. } }, { key: "_onInviteGroup", value: function(e3) {
  4828. var t2 = this, n2 = e3.payload.groupProfile.groupID;
  4829. this._groupModule.hasLocalGroup(n2) || this._groupModule.getGroupProfile({ groupID: n2 }).then(function(e4) {
  4830. var n3 = e4.data.group;
  4831. n3 && (t2._groupModule.updateGroupMap([n3]), t2._groupModule.emitGroupListUpdate());
  4832. });
  4833. } }, { key: "_onQuitGroup", value: function(e3) {
  4834. var t2 = e3.payload.groupProfile.groupID;
  4835. this._groupModule.hasLocalGroup(t2) && this._groupModule.deleteLocalGroupAndConversation(t2);
  4836. } }, { key: "_onSetManager", value: function(e3) {
  4837. var t2 = e3.payload.groupProfile, n2 = t2.to, o2 = t2.groupID, s2 = this._groupModule.getModule(bn).getLocalGroupMemberInfo(o2, n2);
  4838. s2 && s2.updateRole(S.GRP_MBR_ROLE_ADMIN);
  4839. } }, { key: "_onDeleteManager", value: function(e3) {
  4840. var t2 = e3.payload.groupProfile, n2 = t2.to, o2 = t2.groupID, s2 = this._groupModule.getModule(bn).getLocalGroupMemberInfo(o2, n2);
  4841. s2 && s2.updateRole(S.GRP_MBR_ROLE_MEMBER);
  4842. } }, { key: "_onMessageRemindTypeSynced", value: function(e3) {
  4843. var t2 = e3.payload.groupProfile.groupID, n2 = e3.payload.messageRemindType;
  4844. this._groupModule.getModule(Fn).onGroupMessageRemindTypeSynced({ groupID: t2, messageRemindType: n2 });
  4845. } }, { key: "_handleTopicSystemNotice", value: function(e3) {
  4846. var t2 = e3.groupProfile, n2 = t2.groupID, o2 = t2.topicID, s2 = e3.elements, a2 = s2.operationType, r2 = s2.topicIDList, i2 = s2.messageRemindType, u2 = this._groupModule.getModule(wn);
  4847. 17 === a2 ? u2.onTopicCreated({ groupID: n2, topicID: o2 }) : 18 === a2 ? u2.onTopicDeleted({ groupID: n2, topicIDList: r2 }) : 20 === a2 && u2.onTopicMessageRemindTypeUpdated({ groupID: n2, topicID: o2, messageRemindType: i2 });
  4848. } }, { key: "reset", value: function() {
  4849. this.pendencyMap.clear();
  4850. } }]), e2;
  4851. }(), br = ["relayFlag"], wr = function(e2) {
  4852. i(s2, e2);
  4853. var n2 = f(s2);
  4854. function s2(e3) {
  4855. var t2;
  4856. return o(this, s2), (t2 = n2.call(this, e3))._n = "GroupModule", t2._commonGroupHandler = null, t2._AVChatRoomHandler = null, t2._groupSystemNoticeHandler = null, t2._commonGroupHandler = new Mr(_(t2)), t2._groupAttributesHandler = new Er(_(t2)), t2._groupCountersHandler = new Ar(_(t2)), t2._AVChatRoomHandler = new Or(_(t2)), t2._groupTipsHandler = new mr(_(t2)), t2._groupSystemNoticeHandler = new Pr(_(t2)), t2.groupMap = /* @__PURE__ */ new Map(), t2._unjoinedAVChatRoomList = /* @__PURE__ */ new Map(), t2._receiptDetailCompleteMap = /* @__PURE__ */ new Map(), t2.getInnerEmitterInstance().on($a, t2._onCloudConfigUpdated, _(t2)), t2;
  4857. }
  4858. return a(s2, [{ key: "_onCloudConfigUpdated", value: function() {
  4859. var e3 = this.getCloudConfig("polling_interval"), t2 = this.getCloudConfig("polling_interval_plus"), n3 = this.getCloudConfig("polling_no_msg_count"), o2 = this.getCloudConfig("polling_simplified_msg");
  4860. this._AVChatRoomHandler && (xe.l("".concat(this._n, "._onCloudConfigUpdated pollingInterval:").concat(e3) + " pollingIntervalPlus:".concat(t2, " pollingNoMessageCount:").concat(n3) + " pollingSimplifiedMessage:".concat(o2)), this._AVChatRoomHandler.setPollingInterval(e3), this._AVChatRoomHandler.setPollingIntervalPlus(t2), this._AVChatRoomHandler.setPollingNoMessageCount(n3), this._AVChatRoomHandler.setPollingSimplifiedMessage(o2));
  4861. } }, { key: "onCheckTimer", value: function(e3) {
  4862. this.isLoggedIn() && (this._commonGroupHandler.onCheckTimer(e3), this._groupTipsHandler.onCheckTimer(e3));
  4863. } }, { key: "guardForAVChatRoom", value: function(e3) {
  4864. var t2 = this;
  4865. if (e3.conversationType === S.CONV_GROUP) {
  4866. var n3 = Dt(e3.to) ? qt(e3.to) : e3.to;
  4867. return this.hasLocalGroup(n3) ? za() : this.getGroupProfile({ groupID: n3 }).then(function(o2) {
  4868. var s3 = o2.data.group.type;
  4869. if (xe.l("".concat(t2._n, ".guardForAVChatRoom. groupID:").concat(n3, " type:").concat(s3)), s3 === S.GRP_AVCHATROOM) {
  4870. var a2 = da.MESSAGE_SEND_FAIL_NOT_IN_AVCHATROOM;
  4871. return Ja(new Wa({ code: a2, message: t2.getErrorMessage(a2, e3.from, n3), data: { message: e3 } }));
  4872. }
  4873. return za();
  4874. });
  4875. }
  4876. return za();
  4877. } }, { key: "checkJoinedAVChatRoomByID", value: function(e3) {
  4878. return !!this._AVChatRoomHandler && this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e3);
  4879. } }, { key: "onNewGroupMessage", value: function(e3) {
  4880. this._commonGroupHandler && this._commonGroupHandler.onNewGroupMessage(e3);
  4881. } }, { key: "updateNextMessageSeq", value: function(e3) {
  4882. var t2 = this;
  4883. if (st(e3)) {
  4884. var n3 = this.getModule(wn);
  4885. e3.forEach(function(e4) {
  4886. var o2 = e4.conversationID.replace(S.CONV_GROUP, "");
  4887. Dt(o2) && n3.updateLastMessage(o2, e4.lastMessage), t2.groupMap.has(o2) && (t2.groupMap.get(o2).nextMessageSeq = e4.lastMessage.sequence + 1);
  4888. });
  4889. }
  4890. } }, { key: "onNewGroupTips", value: function(e3) {
  4891. this._groupTipsHandler && this._groupTipsHandler.onNewGroupTips(e3);
  4892. } }, { key: "onGroupMessageRevoked", value: function(e3) {
  4893. this._commonGroupHandler && this._commonGroupHandler.onGroupMessageRevoked(e3);
  4894. } }, { key: "onNewGroupSystemNotice", value: function(e3) {
  4895. this._groupSystemNoticeHandler && this._groupSystemNoticeHandler.onNewGroupSystemNotice(e3);
  4896. } }, { key: "onGroupMessageReadNotice", value: function(e3) {
  4897. var t2 = this;
  4898. e3.dataList.forEach(function(e4) {
  4899. var n3 = e4.elements.groupMessageReadNotice;
  4900. if (!at(n3)) {
  4901. var o2 = t2.getModule(Fn);
  4902. n3.forEach(function(e5) {
  4903. var n4 = e5.groupID, s3 = e5.topicID, a2 = void 0 === s3 ? void 0 : s3, r2 = e5.lastMessageSeq;
  4904. xe.d("".concat(t2._n, ".onGroupMessageReadNotice groupID:").concat(n4, " lastMessageSeq:").concat(r2));
  4905. var i2 = "".concat(S.CONV_GROUP).concat(n4), u2 = true;
  4906. jt(a2) || (i2 = "".concat(S.CONV_GROUP).concat(a2), u2 = false), o2.updateIsReadAfterReadReport({ conversationID: i2, lastMessageSeq: r2 }), o2.updateUnreadCount(i2, u2), o2.clearGroupAtInfoList(i2, u2);
  4907. });
  4908. }
  4909. });
  4910. } }, { key: "onReadReceiptList", value: function(e3) {
  4911. var t2 = this;
  4912. xe.d("".concat(this._n, ".onReadReceiptList options:"), JSON.stringify(e3)), e3.dataList.forEach(function(e4) {
  4913. var n3 = e4.groupProfile, o2 = e4.elements, s3 = n3.groupID, a2 = t2.getModule(Fn), r2 = o2.readReceiptList;
  4914. a2.updateReadReceiptInfo({ groupID: s3, readReceiptList: r2 });
  4915. });
  4916. } }, { key: "onGroupMessageModified", value: function(e3) {
  4917. xe.d("".concat(this._n, ".onGroupMessageModified options:"), JSON.stringify(e3));
  4918. var n3 = this.getModule(Fn);
  4919. e3.dataList.forEach(function(e4) {
  4920. n3.onMessageModified(t(t({}, e4), {}, { conversationType: S.CONV_GROUP, to: e4.topicID ? e4.topicID : e4.groupID }));
  4921. });
  4922. } }, { key: "deleteGroupSystemNotice", value: function(e3) {
  4923. this._groupSystemNoticeHandler && this._groupSystemNoticeHandler.deleteGroupSystemNotice(e3);
  4924. } }, { key: "initGroupMap", value: function(e3) {
  4925. this.groupMap.set(e3.groupID, new dr(e3));
  4926. } }, { key: "deleteGroup", value: function(e3) {
  4927. this.groupMap.delete(e3);
  4928. } }, { key: "updateGroupMap", value: function(e3) {
  4929. var t2, n3 = this, o2 = this.getModule(Fn);
  4930. e3.forEach(function(e4) {
  4931. t2 = e4.groupID, n3.groupMap.has(t2) ? n3.groupMap.get(t2).updateGroup(e4) : (n3.groupMap.set(t2, new dr(e4)), o2.deleteGroupRomaingMessageInfo(t2));
  4932. });
  4933. var s3, a2 = this.getMyUserID(), r2 = D(this.groupMap);
  4934. try {
  4935. for (r2.s(); !(s3 = r2.n()).done; ) {
  4936. var i2 = v(s3.value, 2)[1];
  4937. i2.selfInfo.userID = a2, "Owner" === i2.selfInfo.role && (i2.ownerID = a2);
  4938. }
  4939. } catch (u2) {
  4940. r2.e(u2);
  4941. } finally {
  4942. r2.f();
  4943. }
  4944. this._setStorageGroupList();
  4945. } }, { key: "getStorageGroupList", value: function() {
  4946. return this.getModule(xn).getItem("groupMap");
  4947. } }, { key: "_setStorageGroupList", value: function() {
  4948. var e3 = this.getLocalGroupList().filter(function(e4) {
  4949. var t2 = e4.type;
  4950. return !Ct(t2);
  4951. }).filter(function(e4) {
  4952. return !e4.isSupportTopic;
  4953. }).slice(0, 20).map(function(e4) {
  4954. return { groupID: e4.groupID, name: e4.name, avatar: e4.avatar, type: e4.type };
  4955. });
  4956. this.getModule(xn).setItem("groupMap", e3);
  4957. } }, { key: "getGroupMap", value: function() {
  4958. return this.groupMap;
  4959. } }, { key: "getLocalGroupList", value: function() {
  4960. return m(this.groupMap.values());
  4961. } }, { key: "getLocalGroupProfile", value: function(e3) {
  4962. return this.groupMap.get(e3);
  4963. } }, { key: "sortLocalGroupList", value: function() {
  4964. var e3 = m(this.groupMap).filter(function(e4) {
  4965. var t2 = v(e4, 2);
  4966. return t2[0], !jt(t2[1].lastMessage);
  4967. });
  4968. e3.sort(function(e4, t2) {
  4969. return t2[1].lastMessage.lastTime - e4[1].lastMessage.lastTime;
  4970. }), this.groupMap = new Map(m(e3));
  4971. } }, { key: "updateGroupLastMessage", value: function(e3) {
  4972. this._commonGroupHandler && this._commonGroupHandler.handleUpdateGroupLastMessage(e3);
  4973. } }, { key: "emitGroupListUpdate", value: function() {
  4974. var e3 = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0], t2 = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], n3 = this.getLocalGroupList();
  4975. if (e3 && this.emitOuterEvent(E.GROUP_LIST_UPDATED), t2) {
  4976. var o2 = JSON.parse(JSON.stringify(n3)), s3 = this.getModule(Fn);
  4977. s3.updateConversationGroupProfile(o2);
  4978. }
  4979. } }, { key: "patchGroupMessageRemindType", value: function() {
  4980. var e3 = this.getLocalGroupList(), t2 = this.getModule(Fn), n3 = 0;
  4981. e3.forEach(function(e4) {
  4982. true === t2.patchMessageRemindType({ ID: e4.groupID, isC2CConversation: false, messageRemindType: e4.selfInfo.messageRemindType }) && (n3 += 1);
  4983. }), xe.l("".concat(this._n, ".patchGroupMessageRemindType count:").concat(n3));
  4984. } }, { key: "recomputeUnreadCount", value: function() {
  4985. var e3 = this.getLocalGroupList(), t2 = this.getModule(Fn);
  4986. e3.forEach(function(e4) {
  4987. var n3 = e4.groupID, o2 = e4.selfInfo, s3 = o2.excludedUnreadSequenceList, a2 = o2.readedSequence;
  4988. if (st(s3)) {
  4989. var r2 = 0;
  4990. s3.forEach(function(t3) {
  4991. t3 >= a2 && t3 <= e4.nextMessageSeq - 1 && (r2 += 1);
  4992. }), r2 >= 1 && t2.recomputeGroupUnreadCount({ conversationID: "".concat(S.CONV_GROUP).concat(n3), count: r2 });
  4993. }
  4994. });
  4995. } }, { key: "getMyNameCardByGroupID", value: function(e3) {
  4996. var t2 = this.getLocalGroupProfile(e3);
  4997. return t2 ? t2.selfInfo.nameCard : "";
  4998. } }, { key: "isPagingGetCompleted", value: function() {
  4999. return !!this._commonGroupHandler && this._commonGroupHandler.isPagingGetCompleted();
  5000. } }, { key: "getGroupList", value: function(e3) {
  5001. return this._commonGroupHandler ? this._commonGroupHandler.getGroupList(e3) : za();
  5002. } }, { key: "getGroupProfile", value: function(e3) {
  5003. var t2 = this, n3 = "".concat(this._n, ".").concat("getGroupProfile"), o2 = new ka("getGroupProfile"), s3 = e3.groupID, a2 = e3.groupCustomFieldFilter;
  5004. xe.l("".concat(n3, " groupID:").concat(s3));
  5005. var r2 = { groupIDList: [s3], responseFilter: { groupBaseInfoFilter: ["Type", "Name", "Introduction", "Notification", "FaceUrl", "Owner_Account", "CreateTime", "InfoSeq", "LastInfoTime", "LastMsgTime", "MemberNum", "MaxMemberNum", "ApplyJoinOption", "NextMsgSeq", "ShutUpAllMember", "InviteJoinOption"], groupCustomFieldFilter: a2, memberInfoFilter: ["Role", "JoinTime", "MsgSeq", "MsgFlag", "NameCard"] } };
  5006. return this.getGroupProfileAdvance(r2).then(function(e4) {
  5007. var a3, r3 = e4.data, i2 = r3.successGroupList, u2 = r3.failureGroupList;
  5008. if (xe.l("".concat(n3, " ok")), u2.length > 0)
  5009. return Ja(u2[0]);
  5010. (Ct(i2[0].type) && !t2.hasLocalGroup(s3) ? a3 = new dr(i2[0]) : (t2.updateGroupMap(i2), a3 = t2.getLocalGroupProfile(s3)), a3.isSupportTopic) || t2.getModule(Fn).updateConversationGroupProfile([a3]);
  5011. return o2.setNetworkType(t2.getNetworkType()).setMessage("groupID:".concat(s3, " type:").concat(a3.type, " muteAllMembers:").concat(a3.muteAllMembers, " ownerID:").concat(a3.ownerID)).end(), Ka({ group: a3 });
  5012. }).catch(function(s4) {
  5013. return t2.probeNetwork().then(function(t3) {
  5014. var n4 = v(t3, 2), a3 = n4[0], r3 = n4[1];
  5015. o2.setError(s4, a3, r3).setMessage("groupID:".concat(e3.groupID)).end();
  5016. }), xe.e("".concat(n3, " failed. error:"), s4), Ja(s4);
  5017. });
  5018. } }, { key: "getGroupProfileAdvance", value: function(e3) {
  5019. var n3 = "".concat(this._n, ".getGroupProfileAdvance"), o2 = e3.groupIDList;
  5020. st(o2) && o2.length > 50 && (this.outputWarning("GetGroupProfileLimit"), o2.length = 50);
  5021. var s3 = [], a2 = [];
  5022. o2.forEach(function(e4) {
  5023. Tt({ groupID: e4 }) ? a2.push(e4) : s3.push(e4);
  5024. });
  5025. var r2 = [];
  5026. if (s3.length > 0) {
  5027. var i2 = this._getGroupProfileAdvance(t(t({}, e3), {}, { groupIDList: s3 }));
  5028. r2.push(i2);
  5029. }
  5030. if (a2.length > 0) {
  5031. var u2 = this._getGroupProfileAdvance(t(t({}, e3), {}, { groupIDList: a2, relayFlag: s3.length > 0 }));
  5032. r2.push(u2);
  5033. }
  5034. return Promise.all(r2).then(function(e4) {
  5035. var t2 = [], n4 = [];
  5036. return e4.forEach(function(e5) {
  5037. t2.push.apply(t2, m(e5.successGroupList)), n4.push.apply(n4, m(e5.failureGroupList));
  5038. }), Ka({ successGroupList: t2, failureGroupList: n4 });
  5039. }).catch(function(e4) {
  5040. return xe.e("".concat(n3, " failed. error:"), e4), Ja(e4);
  5041. });
  5042. } }, { key: "_getGroupProfileAdvance", value: function(e3) {
  5043. var t2 = this, n3 = e3.relayFlag, o2 = void 0 !== n3 && n3, s3 = g(e3, br);
  5044. return this.request({ protocolName: Yo, requestData: s3 }).then(function(e4) {
  5045. xe.l("".concat(t2._n, "._getGroupProfileAdvance ok."));
  5046. var n4 = e4.data.groups;
  5047. return { successGroupList: n4.filter(function(e5) {
  5048. return at(e5.errorCode) || 0 === e5.errorCode;
  5049. }), failureGroupList: n4.filter(function(e5) {
  5050. return e5.errorCode && 0 !== e5.errorCode;
  5051. }).map(function(e5) {
  5052. return new Wa({ code: e5.errorCode, message: e5.errorInfo, data: { groupID: e5.groupID } });
  5053. }) };
  5054. }).catch(function(t3) {
  5055. return o2 && Tt({ groupID: e3.groupIDList[0] }) ? { successGroupList: [], failureGroupList: [] } : Ja(t3);
  5056. });
  5057. } }, { key: "createGroup", value: function(e3) {
  5058. var n3 = this, o2 = "".concat(this._n, ".").concat("createGroup"), s3 = e3.type, a2 = e3.groupID;
  5059. if (e3.name && false === this._filterProfanity("name", e3))
  5060. return Ja({ code: da.PROFANITY_FOUND });
  5061. if (e3.introduction && false === this._filterProfanity("introduction", e3))
  5062. return Ja({ code: da.PROFANITY_FOUND });
  5063. if (e3.notification && false === this._filterProfanity("notification", e3))
  5064. return Ja({ code: da.PROFANITY_FOUND });
  5065. if (!["Public", "Private", "ChatRoom", "AVChatRoom", "Community"].includes(s3))
  5066. return Ja({ code: da.ILLEGAL_GROUP_TYPE });
  5067. if (!Tt({ type: s3 })) {
  5068. if (!jt(a2) && Tt({ groupID: a2 }))
  5069. return Ja({ code: da.ILLEGAL_GROUP_ID });
  5070. e3.isSupportTopic = void 0;
  5071. }
  5072. if (Ct(s3) && !at(e3.memberList) && e3.memberList.length > 0 && (e3.memberList = void 0), this._canIUseJoinOption(s3) || at(e3.joinOption) || (e3.joinOption = void 0), Tt({ type: s3 })) {
  5073. if (!jt(a2) && !Tt({ groupID: a2 }))
  5074. return Ja({ code: da.ILLEGAL_GROUP_ID });
  5075. e3.isSupportTopic = true === e3.isSupportTopic ? 1 : 0;
  5076. }
  5077. var r2 = new ka("createGroup");
  5078. xe.l("".concat(o2, " options:"), e3);
  5079. var i2 = null, u2 = [];
  5080. return this.request({ protocolName: jo, requestData: t(t({}, e3), {}, { ownerID: this.getMyUserID(), webPushFlag: 1 }) }).then(function(s4) {
  5081. var a3 = s4.data, c2 = a3.groupID, l2 = a3.overLimitUserIDList, p2 = void 0 === l2 ? [] : l2;
  5082. if (i2 = c2, u2 = p2, r2.setNetworkType(n3.getNetworkType()).setMessage("groupType:".concat(e3.type, " groupID:").concat(c2, " overLimitUserIDList=").concat(p2)).end(), xe.l("".concat(o2, " ok groupID:").concat(c2, " overLimitUserIDList:"), p2), e3.type === S.GRP_AVCHATROOM)
  5083. return n3.getGroupProfile({ groupID: c2 });
  5084. if (e3.type === S.GRP_COMMUNITY && 1 === e3.isSupportTopic)
  5085. return n3.getGroupProfile({ groupID: c2 });
  5086. jt(e3.memberList) || jt(p2) || (e3.memberList = e3.memberList.filter(function(e4) {
  5087. return -1 === p2.indexOf(e4.userID);
  5088. })), n3.updateGroupMap([t(t({}, e3), {}, { groupID: c2 })]);
  5089. var d2 = n3.getModule(Rn), g2 = d2.createCustomMessage({ to: c2, conversationType: S.CONV_GROUP, payload: { data: "group_create", extension: n3.isIntl() ? "".concat(n3.getMyUserID(), " created a group") : "".concat(n3.getMyUserID(), "创建群组") } });
  5090. return d2.sendMessageInstance(g2), n3.emitGroupListUpdate(), n3.getGroupProfile({ groupID: c2 });
  5091. }).then(function(e4) {
  5092. var t2 = e4.data.group, n4 = t2.selfInfo, o3 = n4.nameCard, s4 = n4.joinTime;
  5093. return t2.updateSelfInfo({ nameCard: o3, joinTime: s4, messageRemindType: S.MSG_REMIND_ACPT_AND_NOTE, role: S.GRP_MBR_ROLE_OWNER }), Ka({ group: t2, overLimitUserIDList: u2 });
  5094. }).catch(function(s4) {
  5095. if (r2.setMessage("groupType:".concat(e3.type)), n3.probeNetwork().then(function(e4) {
  5096. var t2 = v(e4, 2), n4 = t2[0], o3 = t2[1];
  5097. r2.setError(s4, n4, o3).end();
  5098. }), 10010 === s4.code || 10007 === s4.code) {
  5099. n3.updateGroupMap([t(t({}, e3), {}, { groupID: i2 })]);
  5100. var a3 = n3.getLocalGroupProfile(i2);
  5101. return xe.l("".concat(o2, " success, but failed to get group profile.")), Ka({ group: a3, overLimitUserIDList: u2 });
  5102. }
  5103. return xe.e("".concat(o2, " failed. error:"), s4), Ja(s4);
  5104. });
  5105. } }, { key: "dismissGroup", value: function(e3) {
  5106. var t2 = this, n3 = "".concat(this._n, ".").concat("dismissGroup");
  5107. if (this.hasLocalGroup(e3) && this.getLocalGroupProfile(e3).type === S.GRP_WORK)
  5108. return Ja(new Wa({ code: da.CANNOT_DISMISS_WORK }));
  5109. var o2 = new ka("dismissGroup");
  5110. return o2.setMessage("groupID:".concat(e3)), xe.l("".concat(n3, " groupID:").concat(e3)), this.request({ protocolName: zo, requestData: { groupID: e3 } }).then(function() {
  5111. return o2.setNetworkType(t2.getNetworkType()).end(), xe.l("".concat(n3, " ok")), t2.deleteLocalGroupAndConversation(e3), t2.checkJoinedAVChatRoomByID(e3) && t2._AVChatRoomHandler.reset(e3), t2._groupAttributesHandler.deleteLocalGroupAttributes(e3), Ka({ groupID: e3 });
  5112. }).catch(function(e4) {
  5113. return t2.probeNetwork().then(function(t3) {
  5114. var n4 = v(t3, 2), s3 = n4[0], a2 = n4[1];
  5115. o2.setError(e4, s3, a2).end();
  5116. }), xe.e("".concat(n3, " failed. error:"), e4), Ja(e4);
  5117. });
  5118. } }, { key: "updateGroupProfile", value: function(e3) {
  5119. var t2 = this, n3 = "".concat(this._n, ".").concat("updateGroupProfile");
  5120. if (this.hasLocalGroup(e3.groupID)) {
  5121. var o2 = this.getLocalGroupProfile(e3.groupID).type;
  5122. this._canIUseJoinOption(o2) || at(e3.joinOption) || (xe.w("".concat(n3, " joinOption is unavailable for Work/Meeting/AVChatRoom")), e3.joinOption = void 0);
  5123. }
  5124. if (at(e3.muteAllMembers) || (e3.muteAllMembers ? e3.muteAllMembers = "On" : e3.muteAllMembers = "Off"), e3.name && false === this._filterProfanity("name", e3))
  5125. return Ja({ code: da.PROFANITY_FOUND });
  5126. if (e3.introduction && false === this._filterProfanity("introduction", e3))
  5127. return Ja({ code: da.PROFANITY_FOUND });
  5128. if (e3.notification && false === this._filterProfanity("notification", e3))
  5129. return Ja({ code: da.PROFANITY_FOUND });
  5130. var s3 = new ka("updateGroupProfile");
  5131. return s3.setMessage(JSON.stringify(e3)), xe.l("".concat(n3, " groupID:").concat(e3.groupID)), this.request({ protocolName: Jo, requestData: e3 }).then(function() {
  5132. (s3.setNetworkType(t2.getNetworkType()).end(), xe.l("".concat(n3, " ok")), t2.hasLocalGroup(e3.groupID)) && (t2.groupMap.get(e3.groupID).updateGroup(e3), t2._setStorageGroupList());
  5133. return Ka({ group: t2.groupMap.get(e3.groupID) });
  5134. }).catch(function(e4) {
  5135. return t2.probeNetwork().then(function(t3) {
  5136. var n4 = v(t3, 2), o3 = n4[0], a2 = n4[1];
  5137. s3.setError(e4, o3, a2).end();
  5138. }), xe.l("".concat(n3, " failed. error:"), e4), Ja(e4);
  5139. });
  5140. } }, { key: "_filterProfanity", value: function(e3, t2) {
  5141. var n3 = this.getModule(no);
  5142. if (!n3)
  5143. return true;
  5144. var o2 = n3.filterText(t2[e3], z), s3 = o2.isAllowedToSend, a2 = o2.modifiedText;
  5145. return true === s3 && (t2[e3] = a2, true);
  5146. } }, { key: "joinGroup", value: function(e3) {
  5147. var t2 = this, n3 = e3.groupID, o2 = e3.type, s3 = "".concat(this._n, ".joinGroup");
  5148. if (o2 === S.GRP_WORK)
  5149. return Ja({ code: da.CANNOT_JOIN_WORK });
  5150. if (this.deleteUnjoinedAVChatRoom(n3), this.hasLocalGroup(n3)) {
  5151. if (!this.isLoggedIn())
  5152. return za({ status: S.JOIN_STATUS_ALREADY_IN_GROUP });
  5153. var a2 = new ka("applyJoinGroup");
  5154. return this.getGroupProfile({ groupID: n3 }).then(function() {
  5155. return a2.setNetworkType(t2.getNetworkType()).setMessage("groupID:".concat(n3, " joinedStatus:").concat(S.JOIN_STATUS_ALREADY_IN_GROUP)).end(), za({ status: S.JOIN_STATUS_ALREADY_IN_GROUP });
  5156. }).catch(function(o3) {
  5157. return a2.setNetworkType(t2.getNetworkType()).setMessage("groupID:".concat(n3, " unjoined")).end(), xe.w("".concat(s3, " ").concat(n3, " was unjoined, now join!")), t2.groupMap.delete(n3), t2.applyJoinGroup(e3);
  5158. });
  5159. }
  5160. return xe.l("".concat(s3, " groupID:").concat(n3)), this.isLoggedIn() ? this.applyJoinGroup(e3) : this._AVChatRoomHandler.joinWithoutAuth(e3);
  5161. } }, { key: "applyJoinGroup", value: function(e3) {
  5162. var n3 = this, o2 = "".concat(this._n, ".").concat("applyJoinGroup"), s3 = e3.groupID;
  5163. if (!jt(e3.applyMessage) && false === this._filterProfanity("applyMessage", e3))
  5164. return Ja({ code: da.PROFANITY_FOUND });
  5165. var a2 = new ka("applyJoinGroup"), r2 = t({}, e3), i2 = this.canIUse(B.AVCHATROOM_HISTORY_MSG);
  5166. return i2 && (r2.historyMessageFlag = 1), this.getModule(Fn).deleteTopicRoamingMessageInfo(s3), this.request({ protocolName: Xo, requestData: r2 }).then(function(e4) {
  5167. var t2 = e4.data, r3 = t2.joinedStatus, u2 = t2.longPollingKey, c2 = t2.startSeq, l2 = t2.avChatRoomFlag, p2 = t2.avChatRoomKey, d2 = t2.messageList, g2 = "groupID:".concat(s3, " joinedStatus:").concat(r3, " longPollingKey:").concat(u2, " startSeq:").concat(c2) + " avChatRoomFlag:".concat(l2, " canGetAVChatRoomHistoryMessage:").concat(i2, ",") + " history message count:".concat(jt(d2) ? 0 : d2.length);
  5168. switch (a2.setNetworkType(n3.getNetworkType()).setMessage("".concat(g2)).end(), xe.l("".concat(o2, " ok. ").concat(g2)), r3) {
  5169. case je:
  5170. return Ka({ status: je });
  5171. case Ye:
  5172. return n3.getGroupProfile({ groupID: s3 }).then(function(e5) {
  5173. var t3 = e5.data.group;
  5174. return n3._handleJoinResult({ group: t3, avChatRoomFlag: l2, longPollingKey: u2, startSeq: c2, avChatRoomKey: p2, messageList: d2 });
  5175. }).catch(function() {
  5176. var e5 = new dr({ groupID: s3 });
  5177. return n3._handleJoinResult({ group: e5, avChatRoomFlag: l2, longPollingKey: u2, startSeq: c2, avChatRoomKey: p2, messageList: d2 });
  5178. });
  5179. default:
  5180. var _2 = new Wa({ code: da.JOIN_GROUP_FAIL });
  5181. return xe.e("".concat(o2, " failed. error:"), _2), Ja(_2);
  5182. }
  5183. }).catch(function(e4) {
  5184. return a2.setMessage("groupID:".concat(s3)), n3.probeNetwork().then(function(t2) {
  5185. var n4 = v(t2, 2), o3 = n4[0], s4 = n4[1];
  5186. a2.setError(e4, o3, s4).end();
  5187. }), xe.e("".concat(o2, " failed. error:"), e4), Ja(e4);
  5188. });
  5189. } }, { key: "_handleJoinResult", value: function(e3) {
  5190. var t2, n3 = this, o2 = e3.group, s3 = e3.avChatRoomFlag, a2 = e3.longPollingKey, r2 = e3.startSeq, i2 = e3.avChatRoomKey, u2 = e3.messageList, c2 = o2.groupID;
  5191. return 1 === s3 ? (this.getModule(Fn).setCompleted("".concat(S.CONV_GROUP).concat(c2)), this._groupAttributesHandler.initGroupAttributesCache({ groupID: c2, avChatRoomKey: i2 }), this._groupCountersHandler.initGroupCountersCache({ groupID: c2, avChatRoomKey: i2 }), (t2 = at(a2) ? this._AVChatRoomHandler.handleJoinResult({ group: o2 }) : this._AVChatRoomHandler.startRunLoop({ group: o2, longPollingKey: a2, startSeq: r2 })).then(function() {
  5192. n3._onAVChatRoomHistoryMessage(u2);
  5193. }), t2) : (this.emitGroupListUpdate(true, false), Ka({ status: Ye, group: o2 }));
  5194. } }, { key: "quitGroup", value: function(e3) {
  5195. var t2 = this, n3 = "".concat(this._n, ".").concat("quitGroup");
  5196. xe.l("".concat(n3, " groupID:").concat(e3));
  5197. var o2 = this.checkJoinedAVChatRoomByID(e3);
  5198. if (!o2 && !this.hasLocalGroup(e3))
  5199. return Ja({ code: da.MEMBER_NOT_IN_GROUP });
  5200. if (o2 && !this.isLoggedIn())
  5201. return xe.l("".concat(n3, " anonymously ok. groupID:").concat(e3)), this.deleteLocalGroupAndConversation(e3), this._AVChatRoomHandler.reset(e3), za({ groupID: e3 });
  5202. var s3 = new ka("quitGroup");
  5203. return s3.setMessage("groupID:".concat(e3)), this.request({ protocolName: Zo, requestData: { groupID: e3 } }).then(function() {
  5204. return s3.setNetworkType(t2.getNetworkType()).end(), xe.l("".concat(n3, " ok")), t2.deleteLocalGroupAndConversation(e3), o2 && t2._AVChatRoomHandler.reset(e3), t2._groupAttributesHandler.deleteLocalGroupAttributes(e3), Ka({ groupID: e3 });
  5205. }).catch(function(e4) {
  5206. return t2.probeNetwork().then(function(t3) {
  5207. var n4 = v(t3, 2), o3 = n4[0], a2 = n4[1];
  5208. s3.setError(e4, o3, a2).end();
  5209. }), xe.e("".concat(n3, " failed. error:"), e4), Ja(e4);
  5210. });
  5211. } }, { key: "searchGroupByID", value: function(e3) {
  5212. var t2 = this, n3 = "".concat(this._n, ".").concat("searchGroupByID"), o2 = { groupIDList: [e3] }, s3 = new ka("searchGroupByID");
  5213. return s3.setMessage("groupID:".concat(e3)), xe.l("".concat(n3, " groupID:").concat(e3)), this.request({ protocolName: $o, requestData: o2 }).then(function(e4) {
  5214. var o3 = e4.data.groupProfile;
  5215. if (0 !== o3[0].errorCode)
  5216. throw new Wa({ code: o3[0].errorCode, message: o3[0].errorInfo });
  5217. return s3.setNetworkType(t2.getNetworkType()).end(), xe.l("".concat(n3, " ok")), Ka({ group: new dr(o3[0]) });
  5218. }).catch(function(e4) {
  5219. return t2.probeNetwork().then(function(t3) {
  5220. var n4 = v(t3, 2), o3 = n4[0], a2 = n4[1];
  5221. s3.setError(e4, o3, a2).end();
  5222. }), xe.w("".concat(n3, " failed. error:"), e4), Ja(e4);
  5223. });
  5224. } }, { key: "changeGroupOwner", value: function(e3) {
  5225. var t2 = this, n3 = "".concat(this._n, ".").concat("changeGroupOwner");
  5226. if (this.hasLocalGroup(e3.groupID) && this.getLocalGroupProfile(e3.groupID).type === S.GRP_AVCHATROOM)
  5227. return Ja({ code: da.CANNOT_CHANGE_OWNER_IN_AVCHATROOM });
  5228. if (e3.newOwnerID === this.getMyUserID())
  5229. return Ja({ code: da.CANNOT_CHANGE_OWNER_TO_SELF });
  5230. var o2 = new ka("changeGroupOwner");
  5231. return o2.setMessage("groupID:".concat(e3.groupID, " newOwnerID:").concat(e3.newOwnerID)), xe.l("".concat(n3, " groupID:").concat(e3.groupID)), this.request({ protocolName: es, requestData: e3 }).then(function() {
  5232. o2.setNetworkType(t2.getNetworkType()).end(), xe.l("".concat(n3, " ok"));
  5233. var s3 = e3.groupID, a2 = e3.newOwnerID;
  5234. t2.groupMap.get(s3).ownerID = a2;
  5235. var r2 = t2.getModule(bn).getLocalGroupMemberList(s3);
  5236. if (r2 instanceof Map) {
  5237. var i2 = r2.get(t2.getMyUserID());
  5238. at(i2) || (i2.updateRole("Member"), t2.groupMap.get(s3).selfInfo.role = "Member");
  5239. var u2 = r2.get(a2);
  5240. at(u2) || u2.updateRole("Owner");
  5241. }
  5242. return t2.emitGroupListUpdate(true, false), Ka({ group: t2.groupMap.get(s3) });
  5243. }).catch(function(e4) {
  5244. return t2.probeNetwork().then(function(t3) {
  5245. var n4 = v(t3, 2), s3 = n4[0], a2 = n4[1];
  5246. o2.setError(e4, s3, a2).end();
  5247. }), xe.e("".concat(n3, " failed. error:"), e4), Ja(e4);
  5248. });
  5249. } }, { key: "getGroupApplicationList", value: function() {
  5250. return this._groupSystemNoticeHandler.getGroupApplicationList();
  5251. } }, { key: "handleGroupApplication", value: function(e3) {
  5252. var t2, n3, o2, s3, a2, r2 = this, i2 = "".concat(this._n, ".").concat("handleGroupApplication"), u2 = e3.handleAction, c2 = e3.handleMessage, l2 = e3.message, p2 = e3.application;
  5253. l2 ? (t2 = l2.payload.operatorID, n3 = l2.payload.groupProfile.groupID, o2 = l2.payload.authentication, s3 = l2.payload.messageKey) : p2 && (t2 = p2.applicant, n3 = p2.groupID, o2 = p2.authentication, s3 = p2.messageKey);
  5254. var d2 = ts;
  5255. p2 && 2 === p2.applicationType && (d2 = ns, a2 = p2.userID);
  5256. var g2 = new ka("handleGroupApplication");
  5257. return g2.setMessage("groupID:".concat(n3)), xe.l("".concat(i2, " groupID:").concat(n3)), this.request({ protocolName: d2, requestData: { handleAction: u2, handleMessage: c2, applicant: t2, invitee: a2, groupID: n3, authentication: o2, messageKey: s3 } }).then(function() {
  5258. return g2.setNetworkType(r2.getNetworkType()).end(), xe.l("".concat(i2, " ok")), l2 && r2._groupSystemNoticeHandler.deleteGroupSystemNotice({ messageList: [e3.message] }), Ka({ group: r2.getLocalGroupProfile(n3) });
  5259. }).catch(function(e4) {
  5260. return r2.probeNetwork().then(function(t3) {
  5261. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  5262. g2.setError(e4, o3, s4).end();
  5263. }), xe.e("".concat(i2, " failed. error"), e4), Ja(e4);
  5264. });
  5265. } }, { key: "handleGroupInvitation", value: function(e3) {
  5266. var n3 = this, o2 = "".concat(this._n, ".").concat("handleGroupInvitation"), s3 = e3.message.payload, a2 = s3.groupProfile.groupID, r2 = s3.authentication, i2 = s3.messageKey, u2 = s3.operatorID, c2 = e3.handleAction, l2 = new ka("handleGroupInvitation");
  5267. return l2.setMessage("groupID:".concat(a2, " inviter:").concat(u2, " handleAction:").concat(c2)), xe.l("".concat(o2, " groupID:").concat(a2, " inviter:").concat(u2, " handleAction:").concat(c2)), this.request({ protocolName: os, requestData: t(t({}, e3), {}, { inviter: u2, groupID: a2, authentication: r2, messageKey: i2 }) }).then(function() {
  5268. return l2.setNetworkType(n3.getNetworkType()).end(), xe.l("".concat(o2, " ok")), n3._groupSystemNoticeHandler.deleteGroupSystemNotice({ messageList: [e3.message] }), Ka({ group: n3.getLocalGroupProfile(a2) });
  5269. }).catch(function(e4) {
  5270. return n3.probeNetwork().then(function(t2) {
  5271. var n4 = v(t2, 2), o3 = n4[0], s4 = n4[1];
  5272. l2.setError(e4, o3, s4).end();
  5273. }), xe.e("".concat(o2, " failed. error"), e4), Ja(e4);
  5274. });
  5275. } }, { key: "getGroupOnlineMemberCount", value: function(e3) {
  5276. return this._AVChatRoomHandler ? this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e3) ? this._AVChatRoomHandler.getGroupOnlineMemberCount(e3) : za({ memberCount: 0 }) : Ja({ code: da.CANNOT_FIND_MODULE });
  5277. } }, { key: "hasLocalGroup", value: function(e3) {
  5278. return this.groupMap.has(e3);
  5279. } }, { key: "deleteLocalGroupAndConversation", value: function(e3) {
  5280. var t2 = this.checkJoinedAVChatRoomByID(e3);
  5281. (xe.l("".concat(this._n, ".deleteLocalGroupAndConversation isJoinedAVChatRoom:").concat(t2)), t2) && this.getModule(Fn).deleteLocalConversation("".concat(S.CONV_GROUP).concat(e3));
  5282. if (Tt({ groupID: e3 })) {
  5283. var n3 = this.getLocalGroupProfile(e3);
  5284. if (n3 && true === n3.isSupportTopic)
  5285. this.getModule(wn).deleteTopicListInCommunity(e3);
  5286. }
  5287. this._deleteLocalGroup(e3), this.emitGroupListUpdate(true, false);
  5288. } }, { key: "_deleteLocalGroup", value: function(e3) {
  5289. this.groupMap.delete(e3), this.getModule(bn).deleteGroupMemberList(e3), this._setStorageGroupList();
  5290. } }, { key: "sendMessage", value: function(e3, t2) {
  5291. if (st(e3._receiverList) && e3._receiverList.length > 0 && !this.canIUse(B.MSG_TO_SPECIFIED_GRP_MBR))
  5292. return Ja({ code: da.CANNOT_USE_COMMERCIAL_ABILITY });
  5293. var n3 = this.createGroupMessagePack(e3, t2);
  5294. return this.request(n3);
  5295. } }, { key: "createGroupMessagePack", value: function(e3, t2) {
  5296. var n3 = null;
  5297. t2 && t2.offlinePushInfo && (n3 = t2.offlinePushInfo);
  5298. var o2 = "";
  5299. et(e3.cloudCustomData) && e3.cloudCustomData.length > 0 && (o2 = e3.cloudCustomData);
  5300. var s3 = [];
  5301. if (ot(t2) && ot(t2.messageControlInfo)) {
  5302. var a2 = t2.messageControlInfo, r2 = a2.excludedFromUnreadCount, i2 = a2.excludedFromLastMessage, u2 = a2.excludedFromContentModeration;
  5303. true === r2 && s3.push("NoUnread"), true === i2 && s3.push("NoLastMsg"), true === u2 && s3.push("NoMsgCheck");
  5304. }
  5305. var c2 = void 0;
  5306. st(e3._receiverList) && e3._receiverList.length > 0 && (c2 = e3._receiverList, e3._receiverList.length > 50 && (c2 = e3._receiverList.slice(0, 50), this.outputWarning("ReceiverListLimit")));
  5307. var l2 = this.isOnlineMessage(e3, t2) ? 1 : 0, p2 = e3.getGroupAtInfoList(), d2 = { fromAccount: this.getMyUserID(), groupID: e3.to, msgBody: e3.getElements(), cloudCustomData: o2, random: e3.random, priority: e3.priority, clientSequence: e3.clientSequence, groupAtInfo: e3.type !== S.MSG_TEXT || jt(p2) ? void 0 : p2, onlineOnlyFlag: l2, clientTime: e3.clientTime, offlinePushInfo: n3 ? { pushFlag: true === n3.disablePush ? 1 : 0, title: n3.title || "", desc: n3.description || "", ext: n3.extension || "", apnsInfo: { badgeMode: true === n3.ignoreIOSBadge ? 1 : 0, isVoipPush: this._isVoipPush(n3) }, androidInfo: { OPPOChannelID: n3.androidOPPOChannelID || "" } } : void 0, messageControlInfo: 0 === l2 ? s3 : void 0, needReadReceipt: true !== e3.needReadReceipt || this.isMessageFromOrToAVChatroom(e3.to) ? 0 : 1, receiverList: c2, isSupportExtension: true === e3.isSupportExtension ? 1 : 0 };
  5308. return Dt(e3.to) && (d2.groupID = qt(e3.to), d2.topicID = e3.to), { protocolName: ho, tjgID: this.generateTjgID(e3), requestData: d2 };
  5309. } }, { key: "_isVoipPush", value: function(e3) {
  5310. var t2 = void 0;
  5311. return at(e3.disableVoipPush) || (t2 = false === e3.disableVoipPush ? 1 : 0), t2;
  5312. } }, { key: "revokeMessage", value: function(e3) {
  5313. var t2 = { groupID: e3.to, msgSeqList: [{ msgSeq: e3.sequence }] };
  5314. return Dt(e3.to) && (t2.groupID = qt(e3.to), t2.topicID = e3.to), this.request({ protocolName: ss, requestData: t2 });
  5315. } }, { key: "deleteMessage", value: function(e3) {
  5316. var t2 = e3.to, n3 = e3.keyList;
  5317. xe.l("".concat(this._n, ".deleteMessage groupID:").concat(t2, " count:").concat(n3.length));
  5318. var o2 = { groupID: t2, deleter: this.getMyUserID(), keyList: n3 };
  5319. return Dt(t2) && (o2.groupID = qt(t2), o2.topicID = t2), this.request({ protocolName: vs, requestData: o2 });
  5320. } }, { key: "modifyRemoteMessage", value: function(e3) {
  5321. var t2 = e3.to, n3 = e3.sequence, o2 = e3.payload, s3 = e3.type, a2 = e3.version, r2 = void 0 === a2 ? 0 : a2, i2 = e3.cloudCustomData, u2 = t2, c2 = void 0;
  5322. Dt(t2) && (u2 = qt(t2), c2 = t2);
  5323. var l2 = void 0;
  5324. return Vt(s3) && (l2 = []).push({ type: s3, content: o2 }), this.request({ protocolName: ms, requestData: { groupID: u2, topicID: c2, sequence: n3, version: r2, elements: l2, cloudCustomData: i2 } });
  5325. } }, { key: "getRoamingMessage", value: function(e3) {
  5326. var t2 = this, n3 = "".concat(this._n, ".getRoamingMessage"), o2 = e3.conversationID, s3 = e3.groupID, a2 = e3.sequence, r2 = new ka("getGroupRoamingMessages"), i2 = 0, u2 = void 0;
  5327. return Dt(s3) && (s3 = qt(u2 = s3)), this._computeLastSequence({ groupID: s3, topicID: u2, sequence: a2 }).then(function(e4) {
  5328. return i2 = e4, xe.l("".concat(n3, " groupID:").concat(s3, " startSequence:").concat(i2)), t2.request({ protocolName: is, requestData: { groupID: s3, count: 21, sequence: i2, topicID: u2 } });
  5329. }).then(function(e4) {
  5330. var a3 = e4.data, c2 = a3.messageList, l2 = a3.complete, p2 = a3.invisibleSequenceList, d2 = void 0 === p2 ? [] : p2;
  5331. at(c2) ? xe.l("".concat(n3, " ok. complete:").concat(l2, " but messageList is undefined!")) : xe.l("".concat(n3, " ok. complete:").concat(l2, " count:").concat(c2.length));
  5332. var g2 = t2._getMinSequence(d2, c2) - 1;
  5333. r2.setNetworkType(t2.getNetworkType()).setMessage("groupID:".concat(s3, " topicID:").concat(u2, " startSequence:").concat(i2, " complete:").concat(l2, " nextSequence:").concat(g2)).end();
  5334. var _2 = t2.getModule(Fn), h2 = [];
  5335. return jt(c2) || (_2.updateRoamingMessageSequence(o2, g2), h2 = _2.onRoamingMessage(c2, o2), _2.updateIsRead(o2), _2.patchConversationLastMessage(o2)), (2 === l2 || g2 <= 1) && (_2.setCompleted(o2), g2 = ""), xe.l("".concat(n3, " nextReqID:").concat(g2, ", stored message count:").concat(h2.length, ", invisible sequence count:").concat(d2.length)), { nextReqID: g2 + "", storedMessageList: h2 };
  5336. }).catch(function(e4) {
  5337. return t2.probeNetwork().then(function(t3) {
  5338. var n4 = v(t3, 2), o3 = n4[0], a3 = n4[1];
  5339. r2.setError(e4, o3, a3).setMessage("groupID:".concat(s3, " topicID:").concat(u2, " startSequence:").concat(i2)).end();
  5340. }), xe.w("".concat(n3, " failed. error:"), e4), Ja(e4);
  5341. });
  5342. } }, { key: "_getGroupIDOfMessage", value: function(e3) {
  5343. return e3.conversationID.replace(S.CONV_GROUP, "");
  5344. } }, { key: "_getMinSequence", value: function(e3, t2) {
  5345. var n3 = 0;
  5346. jt(t2) || (n3 = t2[t2.length - 1].sequence);
  5347. var o2 = 0;
  5348. jt(e3) || (o2 = e3[e3.length - 1]);
  5349. return xe.l("".concat(this._n, "._getMinSequence minVisibleSequence:").concat(n3, " minInvisibleSequence:").concat(o2)), o2 > 0 && o2 < n3 ? o2 : n3;
  5350. } }, { key: "getReadReceiptList", value: function(e3) {
  5351. var t2 = this, n3 = "".concat(this._n, ".").concat("getReadReceiptList"), o2 = this._getGroupIDOfMessage(e3[0]), s3 = this.getMyUserID(), a2 = e3.filter(function(e4) {
  5352. return e4.from === s3 && true === e4.needReadReceipt;
  5353. }).map(function(e4) {
  5354. return { sequence: e4.sequence };
  5355. });
  5356. if (xe.l("".concat(n3, " groupID:").concat(o2, " sequenceList:").concat(JSON.stringify(a2))), 0 === a2.length)
  5357. return za({ messageList: e3 });
  5358. var r2 = new ka("getReadReceiptList");
  5359. return r2.setMessage("groupID:".concat(o2)), this.request({ protocolName: us, requestData: { groupID: o2, sequenceList: a2 } }).then(function(t3) {
  5360. r2.end(), xe.l("".concat(n3, " ok"));
  5361. var o3 = t3.data.readReceiptList;
  5362. return st(o3) && o3.forEach(function(t4) {
  5363. e3.forEach(function(e4) {
  5364. 0 === t4.code && t4.sequence === e4.sequence && (e4.readReceiptInfo.readCount = t4.readCount, e4.readReceiptInfo.unreadCount = t4.unreadCount);
  5365. });
  5366. }), Ka({ messageList: e3 });
  5367. }).catch(function(e4) {
  5368. return t2.probeNetwork().then(function(t3) {
  5369. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  5370. r2.setError(e4, o3, s4).end();
  5371. }), xe.w("".concat(n3, " failed. error:"), e4), Ja(e4);
  5372. });
  5373. } }, { key: "sendReadReceipt", value: function(e3) {
  5374. var t2 = this, n3 = "".concat(this._n, ".").concat("sendReadReceipt"), o2 = this._getGroupIDOfMessage(e3[0]), s3 = new ka("sendReadReceipt");
  5375. s3.setMessage("groupID:".concat(o2));
  5376. var a2 = this.getMyUserID(), r2 = e3.filter(function(e4) {
  5377. return e4.from !== a2 && true === e4.needReadReceipt;
  5378. }).map(function(e4) {
  5379. return { sequence: e4.sequence };
  5380. });
  5381. return 0 === r2.length ? Ja({ code: da.READ_RECEIPT_MESSAGE_LIST_EMPTY }) : (xe.l("".concat(n3, ". sequenceList:").concat(JSON.stringify(r2))), this.request({ protocolName: cs, requestData: { groupID: o2, sequenceList: r2 } }).then(function(e4) {
  5382. return s3.end(), xe.l("".concat(n3, " ok")), Ka();
  5383. }).catch(function(e4) {
  5384. return t2.probeNetwork().then(function(t3) {
  5385. var n4 = v(t3, 2), o3 = n4[0], a3 = n4[1];
  5386. s3.setError(e4, o3, a3).end();
  5387. }), xe.w("".concat(n3, " failed. error:"), e4), Ja(e4);
  5388. }));
  5389. } }, { key: "getReadReceiptDetail", value: function(e3) {
  5390. var t2 = this, n3 = e3.message, o2 = e3.filter, s3 = e3.cursor, a2 = e3.count, r2 = this._getGroupIDOfMessage(n3), i2 = n3.ID, u2 = n3.sequence, c2 = "".concat(this._n, ".").concat("getReadReceiptDetail"), l2 = this._receiptDetailCompleteMap.get(i2) || false, p2 = 0 !== o2 && 1 !== o2 ? 0 : o2, d2 = et(s3) ? s3 : "", g2 = !$e(a2) || a2 <= 0 || a2 >= 100 ? 100 : a2, _2 = "groupID:".concat(r2, " sequence:").concat(u2, " cursor:").concat(d2, " filter:").concat(p2, " completeFlag:").concat(l2);
  5391. xe.l("".concat(c2, " ").concat(_2));
  5392. var h2 = { cursor: "", isCompleted: false, messageID: i2, unreadUserIDList: [], readUserIDList: [] }, f2 = new ka("getReadReceiptDetail");
  5393. return f2.setMessage(_2), this.request({ protocolName: ps, requestData: { groupID: r2, sequence: u2, flag: p2, cursor: d2, count: g2 } }).then(function(e4) {
  5394. f2.end();
  5395. var n4 = e4.data, o3 = n4.cursor, s4 = n4.isCompleted, a3 = n4.unreadUserIDList, r3 = n4.readUserIDList;
  5396. return h2.cursor = o3, 1 === s4 && (h2.isCompleted = true, t2._receiptDetailCompleteMap.set(i2, true)), 0 === p2 ? h2.readUserIDList = r3.map(function(e5) {
  5397. return e5.userID;
  5398. }) : 1 === p2 && (h2.unreadUserIDList = a3.map(function(e5) {
  5399. return e5.userID;
  5400. })), xe.l("".concat(c2, " ok")), Ka(h2);
  5401. }).catch(function(e4) {
  5402. return t2.probeNetwork().then(function(t3) {
  5403. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  5404. f2.setError(e4, o3, s4).end();
  5405. }), xe.w("".concat(c2, " failed. error:"), e4), Ja(e4);
  5406. });
  5407. } }, { key: "getRoamingMessagesHopping", value: function(e3) {
  5408. var t2 = this, n3 = "".concat(this._n, ".getRoamingMessagesHopping"), o2 = new ka("getGroupRoamingMessagesHopping"), s3 = e3.groupID, a2 = e3.count, r2 = e3.sequence, i2 = e3.direction, u2 = r2;
  5409. 1 === i2 && (u2 = r2 + a2 - 1);
  5410. var c2 = void 0;
  5411. Dt(s3) && (s3 = qt(c2 = s3));
  5412. var l2 = "".concat(c2 ? "topicID:".concat(c2) : "groupID:".concat(s3), " sequence:").concat(r2, " direction:").concat(i2);
  5413. return xe.l("".concat(n3, " ").concat(l2)), this.request({ protocolName: is, requestData: { groupID: s3, topicID: c2, count: a2, sequence: u2 } }).then(function(s4) {
  5414. var a3 = s4.data, u3 = a3.messageList, c3 = a3.complete, p2 = "complete:".concat(c3, " count:").concat(u3 ? u3.length : 0);
  5415. if (xe.l("".concat(n3, " ok. ").concat(p2)), o2.setNetworkType(t2.getNetworkType()).setMessage("".concat(l2, " ").concat(p2)).end(), 2 === c3 || jt(u3)) {
  5416. var d2 = t2._computeResult();
  5417. return Ka(d2);
  5418. }
  5419. var g2 = "".concat(S.CONV_GROUP).concat(e3.groupID), _2 = t2.getModule(Fn).onRoamingMessage(u3, g2, false), h2 = t2._computeResult({ direction: i2, sequence: r2, remoteMessageList: u3, processedMessageList: _2 });
  5420. return Ka(h2);
  5421. }).catch(function(e4) {
  5422. return t2.probeNetwork().then(function(t3) {
  5423. var n4 = v(t3, 2), i3 = n4[0], u3 = n4[1];
  5424. o2.setError(e4, i3, u3).setMessage("groupID:".concat(s3, " sequence:").concat(r2, " count:").concat(a2)).end();
  5425. }), xe.w("".concat(n3, " failed. error:"), e4), Ja(e4);
  5426. });
  5427. } }, { key: "_computeResult", value: function(e3) {
  5428. var t2 = { messageList: [], isCompleted: false, nextMessageSeq: "" };
  5429. if (at(e3))
  5430. return t2.isCompleted = true, t2;
  5431. var n3 = e3.direction, o2 = e3.sequence, s3 = e3.remoteMessageList, a2 = void 0 === s3 ? [] : s3, r2 = e3.processedMessageList, i2 = void 0 === r2 ? [] : r2, u2 = a2.length;
  5432. return 1 === n3 ? (t2.nextMessageSeq = a2[0].sequence + 1, i2.forEach(function(e4) {
  5433. e4.sequence >= o2 && t2.messageList.push(e4);
  5434. }), 0 === t2.messageList.length && a2[0].sequence < o2 && (t2.isCompleted = true, t2.nextMessageSeq = ""), t2) : (t2.nextMessageSeq = a2[u2 - 1].sequence - 1, t2.messageList = m(i2), 0 === t2.nextMessageSeq && (t2.isCompleted = true, t2.nextMessageSeq = ""), t2);
  5435. } }, { key: "setMessageRead", value: function(e3) {
  5436. var t2 = this, n3 = e3.conversationID, o2 = e3.lastMessageSeq, s3 = "".concat(this._n, ".setMessageRead");
  5437. xe.l("".concat(s3, " conversationID:").concat(n3, " lastMessageSeq:").concat(o2)), $e(o2) || this.outputWarning("DoNotModifyLastSeq");
  5438. var a2 = new ka("setGroupMessageRead");
  5439. a2.setMessage("".concat(n3, "-").concat(o2));
  5440. var r2 = n3.replace(S.CONV_GROUP, ""), i2 = void 0;
  5441. return Dt(r2) && (r2 = qt(i2 = r2)), this.request({ protocolName: as, requestData: { groupID: r2, topicID: i2, messageReadSeq: o2 } }).then(function() {
  5442. a2.setNetworkType(t2.getNetworkType()).end(), xe.l("".concat(s3, " ok."));
  5443. var e4 = t2.getModule(Fn);
  5444. e4.updateIsReadAfterReadReport({ conversationID: n3, lastMessageSeq: o2 });
  5445. var u2 = true;
  5446. if (!at(i2)) {
  5447. u2 = false;
  5448. var c2 = t2.getModule(wn).getLocalTopic(r2, i2);
  5449. c2 && c2.updateSelfInfo({ readedSequence: o2 });
  5450. }
  5451. return e4.updateUnreadCount(n3, u2), Ka();
  5452. }).catch(function(e4) {
  5453. return t2.probeNetwork().then(function(t3) {
  5454. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  5455. a2.setError(e4, o3, s4).end();
  5456. }), xe.l("".concat(s3, " failed. error:"), e4), Ja(e4);
  5457. });
  5458. } }, { key: "_computeLastSequence", value: function(e3) {
  5459. var t2 = e3.groupID, n3 = e3.topicID, o2 = void 0 === n3 ? void 0 : n3, s3 = e3.sequence;
  5460. return s3 > 0 ? Promise.resolve(s3) : at(o2) || this.hasLocalGroup(t2) ? at(o2) ? this.getGroupLastSequence(t2) : this.getTopicLastSequence({ groupID: t2, topicID: o2 }) : Promise.resolve(0);
  5461. } }, { key: "getGroupLastSequence", value: function(e3) {
  5462. var t2 = this, n3 = "".concat(this._n, ".").concat("getGroupLastSequence"), o2 = new ka("getGroupLastSequence"), s3 = 0, a2 = "";
  5463. if (this.hasLocalGroup(e3)) {
  5464. var r2 = this.getLocalGroupProfile(e3), i2 = r2.lastMessage;
  5465. if (i2.lastSequence > 0 && false === i2.onlineOnlyFlag)
  5466. return s3 = i2.lastSequence, a2 = "got lastSequence:".concat(s3, " from local group profile[lastMessage.lastSequence]. groupID:").concat(e3), xe.l("".concat(n3, " ").concat(a2)), o2.setNetworkType(this.getNetworkType()).setMessage("".concat(a2)).end(), Promise.resolve(s3);
  5467. if (r2.nextMessageSeq > 1)
  5468. return s3 = r2.nextMessageSeq - 1, a2 = "got lastSequence:".concat(s3, " from local group profile[nextMessageSeq]. groupID:").concat(e3), xe.l("".concat(n3, " ").concat(a2)), o2.setNetworkType(this.getNetworkType()).setMessage("".concat(a2)).end(), Promise.resolve(s3);
  5469. }
  5470. var u2 = "GROUP".concat(e3), c2 = this.getModule(Fn).getLocalConversation(u2);
  5471. if (c2 && c2.lastMessage.lastSequence && false === c2.lastMessage.onlineOnlyFlag)
  5472. return s3 = c2.lastMessage.lastSequence, a2 = "got lastSequence:".concat(s3, " from local conversation profile[lastMessage.lastSequence]. groupID:").concat(e3), xe.l("".concat(n3, " ").concat(a2)), o2.setNetworkType(this.getNetworkType()).setMessage("".concat(a2)).end(), Promise.resolve(s3);
  5473. var l2 = { groupIDList: [e3], responseFilter: { groupBaseInfoFilter: ["NextMsgSeq"] } };
  5474. return this.getGroupProfileAdvance(l2).then(function(r3) {
  5475. var i3 = r3.data.successGroupList;
  5476. return jt(i3) ? xe.l("".concat(n3, " successGroupList is empty. groupID:").concat(e3)) : (s3 = i3[0].nextMessageSeq - 1, a2 = "got lastSequence:".concat(s3, " from getGroupProfileAdvance. groupID:").concat(e3), xe.l("".concat(n3, " ").concat(a2))), o2.setNetworkType(t2.getNetworkType()).setMessage("".concat(a2)).end(), s3;
  5477. }).catch(function(s4) {
  5478. return t2.probeNetwork().then(function(t3) {
  5479. var n4 = v(t3, 2), a3 = n4[0], r3 = n4[1];
  5480. o2.setError(s4, a3, r3).setMessage("get lastSequence failed from getGroupProfileAdvance. groupID:".concat(e3)).end();
  5481. }), xe.w("".concat(n3, " failed. error:"), s4), Ja(s4);
  5482. });
  5483. } }, { key: "getTopicLastSequence", value: function(e3) {
  5484. var t2 = this, n3 = e3.groupID, o2 = e3.topicID, s3 = "".concat(this._n, ".").concat("getTopicLastSequence"), a2 = new ka("getTopicLastSequence"), r2 = 0, i2 = "", u2 = this.getModule(wn);
  5485. return u2.hasLocalTopic(n3, o2) ? (r2 = u2.getLocalTopic(n3, o2).nextMessageSeq - 1, i2 = "get lastSequence:".concat(r2, " from local topic info[nextMessageSeq]. topicID:").concat(o2), xe.l("".concat(s3, " ").concat(i2)), a2.setNetworkType(this.getNetworkType()).setMessage("".concat(i2)).end(), Promise.resolve(r2)) : u2.getTopicList({ groupID: n3, topicIDList: [o2] }).then(function(e4) {
  5486. var n4 = e4.data.successTopicList;
  5487. return jt(n4) ? xe.l("".concat(s3, " successTopicList is empty. topicID:").concat(o2)) : (r2 = n4[0].nextMessageSeq - 1, i2 = "get lastSequence:".concat(r2, " from getTopicList. topicID:").concat(o2), xe.l("".concat(s3, " ").concat(i2))), a2.setNetworkType(t2.getNetworkType()).setMessage("".concat(i2)).end(), r2;
  5488. }).catch(function(e4) {
  5489. return t2.probeNetwork().then(function(t3) {
  5490. var n4 = v(t3, 2), s4 = n4[0], r3 = n4[1];
  5491. a2.setError(e4, s4, r3).setMessage("get lastSequence failed from getTopicList. topicID:".concat(o2)).end();
  5492. }), xe.w("".concat(s3, " failed. error:"), e4), Ja(e4);
  5493. });
  5494. } }, { key: "isMessageFromOrToAVChatroom", value: function(e3) {
  5495. return !!this._AVChatRoomHandler && this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e3);
  5496. } }, { key: "hasJoinedAVChatRoom", value: function() {
  5497. return this._AVChatRoomHandler ? this._AVChatRoomHandler.hasJoinedAVChatRoom() : 0;
  5498. } }, { key: "getJoinedAVChatRoom", value: function() {
  5499. return this._AVChatRoomHandler ? this._AVChatRoomHandler.getJoinedAVChatRoom() : [];
  5500. } }, { key: "isOnlineMessage", value: function(e3, t2) {
  5501. return !(!this._canIUseOnlineOnlyFlag(e3) || !t2 || true !== t2.onlineUserOnly);
  5502. } }, { key: "_canIUseOnlineOnlyFlag", value: function(e3) {
  5503. var t2 = this.getJoinedAVChatRoom();
  5504. return !t2 || !t2.includes(e3.to) || e3.conversationType !== S.CONV_GROUP;
  5505. } }, { key: "_onAVChatRoomHistoryMessage", value: function(e3) {
  5506. if (!jt(e3)) {
  5507. xe.l("".concat(this._n, "._onAVChatRoomHistoryMessage count:").concat(e3.length));
  5508. var n3 = [];
  5509. e3.forEach(function(e4) {
  5510. n3.push(t(t({}, e4), {}, { isHistoryMessage: 1 }));
  5511. }), this.onAVChatRoomMessage(n3);
  5512. }
  5513. } }, { key: "onAVChatRoomMessage", value: function(e3) {
  5514. this._AVChatRoomHandler && this._AVChatRoomHandler.onMessage(e3);
  5515. } }, { key: "onAVChatRoomMemberBanned", value: function(e3) {
  5516. this._AVChatRoomHandler && this._AVChatRoomHandler.onAVChatRoomMemberBanned(e3);
  5517. } }, { key: "getGroupSimplifiedInfo", value: function(e3) {
  5518. var t2 = this, n3 = new ka("getGroupSimplifiedInfo"), o2 = { groupIDList: [e3], responseFilter: { groupBaseInfoFilter: ["Type", "Name"] } };
  5519. return this.getGroupProfileAdvance(o2).then(function(o3) {
  5520. var s3 = o3.data.successGroupList;
  5521. return n3.setNetworkType(t2.getNetworkType()).setMessage("groupID:".concat(e3, " type:").concat(s3[0].type)).end(), s3[0];
  5522. }).catch(function(o3) {
  5523. t2.probeNetwork().then(function(t3) {
  5524. var s3 = v(t3, 2), a2 = s3[0], r2 = s3[1];
  5525. n3.setError(o3, a2, r2).setMessage("groupID:".concat(e3)).end();
  5526. });
  5527. });
  5528. } }, { key: "setUnjoinedAVChatRoom", value: function(e3) {
  5529. this._unjoinedAVChatRoomList.set(e3, 1);
  5530. } }, { key: "deleteUnjoinedAVChatRoom", value: function(e3) {
  5531. this._unjoinedAVChatRoomList.has(e3) && this._unjoinedAVChatRoomList.delete(e3);
  5532. } }, { key: "isUnjoinedAVChatRoom", value: function(e3) {
  5533. return this._unjoinedAVChatRoomList.has(e3);
  5534. } }, { key: "isGroupAttributesUpdatedNotice", value: function(e3) {
  5535. return this._groupAttributesHandler.isGroupAttributesUpdatedNotice(e3);
  5536. } }, { key: "updateLocalMainSequenceOnReconnected", value: function() {
  5537. this._groupAttributesHandler.updateLocalMainSequenceOnReconnected();
  5538. } }, { key: "initGroupAttributes", value: function(e3) {
  5539. return this._groupAttributesHandler.initGroupAttributes(e3);
  5540. } }, { key: "setGroupAttributes", value: function(e3) {
  5541. return this._groupAttributesHandler.setGroupAttributes(e3);
  5542. } }, { key: "deleteGroupAttributes", value: function(e3) {
  5543. return this._groupAttributesHandler.deleteGroupAttributes(e3);
  5544. } }, { key: "getGroupAttributes", value: function(e3) {
  5545. return this._groupAttributesHandler.getGroupAttributes(e3);
  5546. } }, { key: "isMessageFromTopic", value: function(e3, t2) {
  5547. return 2 === e3 && !jt(t2);
  5548. } }, { key: "isMessageFromCommunityOfTopic", value: function(e3, t2) {
  5549. return 2 === e3 && jt(t2);
  5550. } }, { key: "getMessageExtensions", value: function(e3, t2) {
  5551. return xe.l("".concat(this._n, ".getMessageExtensions startSequence:").concat(t2)), this.request({ protocolName: Es, requestData: { groupID: e3.to, messageSequence: e3.sequence, startSequence: t2 } });
  5552. } }, { key: "modifyMessageExtensions", value: function(e3, t2) {
  5553. var n3 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1;
  5554. return xe.l("".concat(this._n, ".modifyMessageExtensions operateType:").concat(n3)), this.request({ protocolName: Ds, requestData: { groupID: e3.to, messageSequence: e3.sequence, extensionList: t2, operateType: n3 } });
  5555. } }, { key: "getGroupNotify", value: function(e3) {
  5556. var n3 = this;
  5557. if (this.hasLocalGroup(e3)) {
  5558. var o2 = this.getLocalGroupProfile(e3), s3 = o2.type, a2 = o2.isSupportTopic;
  5559. if (!Ct(s3) && !a2) {
  5560. var r2 = "".concat(this._n, ".getGroupNotify"), i2 = this._getGroupLastRevokedTime(e3), u2 = 1e3 * Ue();
  5561. xe.l("".concat(r2, " groupID:").concat(e3, " type:").concat(s3, " beginTime:").concat(i2, " endTime:").concat(u2)), this.request({ protocolName: Ss, requestData: { type: Tt({ type: s3, groupID: e3 }) ? S.GRP_COMMUNITY : void 0, groupID: e3, beginTime: i2, endTime: u2 } }).then(function(o3) {
  5562. var s4 = o3.data, a3 = s4.nextRevokedTime, i3 = s4.notifyList;
  5563. xe.l("".concat(r2, " ok. groupID:").concat(e3, " nextRevokedTime:").concat(a3));
  5564. var u3 = { dataList: [{ elements: { revokedInfos: [] } }] };
  5565. st(i3) && i3.forEach(function(n4) {
  5566. u3.dataList[0].elements.revokedInfos.push({ groupID: e3, sequence: n4.sequence, random: n4.random, revokerInfo: t({}, n4.revokerInfo) });
  5567. }), n3.onGroupMessageRevoked(u3), 0 !== a3 ? (n3._setGroupLastRevokedTime(e3, a3), n3.getGroupNotify(e3)) : n3._setGroupLastRevokedTime(e3, 1e3 * Ue());
  5568. }).catch(function(e4) {
  5569. xe.e("".concat(r2, " failed. error:"), e4);
  5570. });
  5571. }
  5572. }
  5573. } }, { key: "_getGroupLastRevokedTime", value: function(e3) {
  5574. return this.hasLocalGroup(e3) ? this.getLocalGroupProfile(e3)._lastRevokedTime : 0;
  5575. } }, { key: "_setGroupLastRevokedTime", value: function(e3, t2) {
  5576. this.hasLocalGroup(e3) && (this.getLocalGroupProfile(e3)._lastRevokedTime = t2);
  5577. } }, { key: "isGroupCountersNotice", value: function(e3) {
  5578. return this._groupCountersHandler.isGroupCountersNotice(e3);
  5579. } }, { key: "setGroupCounters", value: function(e3) {
  5580. return this._groupCountersHandler.setGroupCounters(e3);
  5581. } }, { key: "increaseGroupCounter", value: function(e3) {
  5582. return this._groupCountersHandler.increaseGroupCounter(e3);
  5583. } }, { key: "decreaseGroupCounter", value: function(e3) {
  5584. return this._groupCountersHandler.decreaseGroupCounter(e3);
  5585. } }, { key: "getGroupCounters", value: function(e3) {
  5586. return this._groupCountersHandler.getGroupCounters(e3);
  5587. } }, { key: "restartPolling", value: function() {
  5588. this._AVChatRoomHandler && this._AVChatRoomHandler.restartPolling();
  5589. } }, { key: "getPollingTimerID", value: function(e3) {
  5590. if (!e3)
  5591. return -1;
  5592. var t2 = this.getLocalGroupProfile(e3);
  5593. return t2 && Ct(t2.type) ? this._AVChatRoomHandler.getPollingTimerID(e3) : -1;
  5594. } }, { key: "_canIUseJoinOption", value: function(e3) {
  5595. return function(e4) {
  5596. return e4 === S.GRP_PUBLIC;
  5597. }(e3) || Tt({ type: e3 });
  5598. } }, { key: "reset", value: function() {
  5599. this.groupMap.clear(), this._unjoinedAVChatRoomList.clear(), this._receiptDetailCompleteMap.clear(), this._commonGroupHandler.reset(), this._groupSystemNoticeHandler.reset(), this._groupTipsHandler.reset(), this._groupAttributesHandler.reset(), this._groupCountersHandler.reset(), this._AVChatRoomHandler && this._AVChatRoomHandler.reset();
  5600. } }]), s2;
  5601. }(ro), Fr = function() {
  5602. function e2(t2) {
  5603. o(this, e2), this.userID = "", this.avatar = "", this.nick = "", this.role = "", this.joinTime = "", this.lastSendMsgTime = "", this.nameCard = "", this.muteUntil = 0, this.memberCustomField = [], this._initMember(t2);
  5604. }
  5605. return a(e2, [{ key: "_initMember", value: function(e3) {
  5606. this.updateMember(e3);
  5607. } }, { key: "updateMember", value: function(e3) {
  5608. var t2 = [null, void 0, "", 0, NaN];
  5609. e3.memberCustomField && It(this.memberCustomField, e3.memberCustomField), pt(this, e3, ["memberCustomField", "marks"], t2);
  5610. } }, { key: "updateRole", value: function(e3) {
  5611. ["Owner", "Admin", "Member"].indexOf(e3) < 0 || (this.role = e3);
  5612. } }, { key: "updateMuteUntil", value: function(e3) {
  5613. at(e3) || (this.muteUntil = Math.floor((Date.now() + 1e3 * e3) / 1e3));
  5614. } }, { key: "updateNameCard", value: function(e3) {
  5615. at(e3) || (this.nameCard = e3);
  5616. } }, { key: "updateMemberCustomField", value: function(e3) {
  5617. e3 && It(this.memberCustomField, e3);
  5618. } }]), e2;
  5619. }(), qr = function(e2) {
  5620. i(s2, e2);
  5621. var n2 = f(s2);
  5622. function s2(e3) {
  5623. var t2;
  5624. return o(this, s2), (t2 = n2.call(this, e3))._n = "GroupMemberModule", t2.groupMemberListMap = /* @__PURE__ */ new Map(), t2.getInnerEmitterInstance().on(er, t2._onProfileUpdated, _(t2)), t2;
  5625. }
  5626. return a(s2, [{ key: "_onProfileUpdated", value: function(e3) {
  5627. for (var t2 = this, n3 = e3.data, o2 = function(e4) {
  5628. var o3 = n3[e4];
  5629. t2.groupMemberListMap.forEach(function(e5) {
  5630. e5.has(o3.userID) && e5.get(o3.userID).updateMember({ nick: o3.nick, avatar: o3.avatar });
  5631. });
  5632. }, s3 = 0; s3 < n3.length; s3++)
  5633. o2(s3);
  5634. } }, { key: "deleteGroupMemberList", value: function(e3) {
  5635. this.groupMemberListMap.delete(e3);
  5636. } }, { key: "getGroupMemberList", value: function(e3) {
  5637. var t2 = this, n3 = e3.groupID, o2 = e3.offset, s3 = void 0 === o2 ? 0 : o2, a2 = e3.count, r2 = void 0 === a2 ? 15 : a2, i2 = e3.filter, u2 = void 0 === i2 ? void 0 : i2, c2 = "".concat(this._n, ".").concat("getGroupMemberList"), l2 = this.getModule(Un), p2 = l2.hasLocalGroup(n3);
  5638. if (xe.l("".concat(c2, " groupID:").concat(n3, " offset:").concat(s3, " count:").concat(r2, " hasLocalGroup:").concat(p2)), !p2)
  5639. return za({ memberList: [], offset: 0 });
  5640. if (l2.getLocalGroupProfile(n3).type === S.GRP_AVCHATROOM) {
  5641. if (this.canIUse(B.AVCHATROOM_MBR_LIST))
  5642. return this._getAVChatRoomMemberList({ groupID: n3, offset: s3, filter: u2 });
  5643. this.outputWarning("LiveOnlineMember");
  5644. }
  5645. var d2 = new ka("getGroupMemberList"), g2 = 0, _2 = { groupID: n3, limit: r2 > 100 ? 100 : r2 };
  5646. Tt({ groupID: n3 }) ? _2.next = "".concat(s3) : (_2.offset = s3, g2 = s3 + r2);
  5647. var h2 = [];
  5648. return this.request({ protocolName: As, requestData: _2 }).then(function(e4) {
  5649. var o3 = e4.data, s4 = o3.members, a3 = o3.memberNum, r3 = o3.next, i3 = void 0 === r3 ? void 0 : r3;
  5650. if (at(i3) || (g2 = jt(i3) ? 0 : i3), !st(s4) || 0 === s4.length)
  5651. return g2 = 0, Promise.resolve([]);
  5652. var u3 = t2.getModule(Un);
  5653. return u3.hasLocalGroup(n3) && (u3.getLocalGroupProfile(n3).memberNum = a3), h2 = t2._updateLocalGroupMemberMap(n3, s4), t2.getModule(On).getUserProfile({ userIDList: s4.map(function(e5) {
  5654. return e5.userID;
  5655. }), tagList: [Be.NICK, Be.AVATAR] });
  5656. }).then(function(e4) {
  5657. var o3 = e4.data;
  5658. if (!st(o3) || 0 === o3.length)
  5659. return za({ memberList: [], offset: g2 });
  5660. var a3 = o3.map(function(e5) {
  5661. return { userID: e5.userID, nick: e5.nick, avatar: e5.avatar };
  5662. });
  5663. return t2._updateLocalGroupMemberMap(n3, a3), h2.length < r2 && (g2 = 0), d2.setNetworkType(t2.getNetworkType()).setMessage("groupID:".concat(n3, " offset:").concat(s3, " count:").concat(r2)).end(), xe.l("".concat(c2, " ok.")), Ka({ memberList: h2, offset: g2 });
  5664. }).catch(function(e4) {
  5665. return t2.probeNetwork().then(function(t3) {
  5666. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  5667. d2.setError(e4, o3, s4).end();
  5668. }), xe.e("".concat(c2, " failed. error:"), e4), Ja(e4);
  5669. });
  5670. } }, { key: "_getAVChatRoomMemberList", value: function(e3) {
  5671. var t2 = this, n3 = e3.groupID, o2 = e3.offset, s3 = e3.filter, a2 = "".concat(this._n, ".").concat("_getAVChatRoomMemberList"), r2 = new ka("_getAVChatRoomMemberList");
  5672. return r2.setMessage("groupID:".concat(n3, " offset:").concat(o2, " filter:").concat(s3)), this.request({ protocolName: Rs, requestData: { groupID: n3, offset: o2, filter: s3 } }).then(function(e4) {
  5673. var o3 = e4.data, s4 = o3.memberList, i2 = void 0 === s4 ? [] : s4, u2 = o3.offset, c2 = void 0 === u2 ? 0 : u2;
  5674. r2.setNetworkType(t2.getNetworkType()).end(), xe.l("".concat(a2, " ok. member count:").concat(i2.length, ", next request timestamp:").concat(c2));
  5675. var l2 = t2._updateLocalGroupMemberMap(n3, i2);
  5676. return Ka({ memberList: l2, offset: c2 });
  5677. }).catch(function(e4) {
  5678. return t2.probeNetwork().then(function(t3) {
  5679. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  5680. r2.setError(e4, o3, s4).end();
  5681. }), xe.e("".concat(a2, " failed. error:"), e4), Ja(e4);
  5682. });
  5683. } }, { key: "getGroupMemberProfile", value: function(e3) {
  5684. var n3 = this, o2 = "".concat(this._n, ".").concat("getGroupMemberProfile"), s3 = new ka("getGroupMemberProfile");
  5685. s3.setMessage(e3.userIDList.length > 5 ? "userIDList.length:".concat(e3.userIDList.length) : "userIDList:".concat(e3.userIDList)), xe.l("".concat(o2, " groupID:").concat(e3.groupID, " userIDList:").concat(e3.userIDList.join(","))), e3.userIDList.length > 50 && (e3.userIDList = e3.userIDList.slice(0, 50));
  5686. var a2 = e3.groupID, r2 = e3.userIDList;
  5687. return this._getGroupMemberProfileAdvance(t(t({}, e3), {}, { userIDList: r2 })).then(function(e4) {
  5688. var t2 = e4.data.members;
  5689. return st(t2) && 0 !== t2.length ? (n3._updateLocalGroupMemberMap(a2, t2), n3.getModule(On).getUserProfile({ userIDList: t2.map(function(e5) {
  5690. return e5.userID;
  5691. }), tagList: [Be.NICK, Be.AVATAR] })) : za([]);
  5692. }).then(function(e4) {
  5693. var t2 = e4.data.map(function(e5) {
  5694. return { userID: e5.userID, nick: e5.nick, avatar: e5.avatar };
  5695. });
  5696. n3._updateLocalGroupMemberMap(a2, t2);
  5697. var o3 = r2.filter(function(e5) {
  5698. return n3.hasLocalGroupMember(a2, e5);
  5699. }).map(function(e5) {
  5700. return n3.getLocalGroupMemberInfo(a2, e5);
  5701. });
  5702. return s3.setNetworkType(n3.getNetworkType()).end(), Ka({ memberList: o3 });
  5703. });
  5704. } }, { key: "addGroupMember", value: function(e3) {
  5705. var t2 = this, n3 = "".concat(this._n, ".").concat("addGroupMember"), o2 = e3.groupID, s3 = this.getModule(Un).getLocalGroupProfile(o2), a2 = s3.type, r2 = new ka("addGroupMember");
  5706. if (r2.setMessage("groupID:".concat(o2, " groupType:").concat(a2)), Ct(a2)) {
  5707. var i2 = new Wa({ code: da.CANNOT_ADD_MEMBER_IN_AVCHATROOM });
  5708. return r2.setError(i2, true, this.getNetworkType()).end(), Ja(i2);
  5709. }
  5710. return e3.userIDList = e3.userIDList.map(function(e4) {
  5711. return { userID: e4 };
  5712. }), xe.l("".concat(n3, " groupID:").concat(o2)), this.request({ protocolName: Os, requestData: e3 }).then(function(o3) {
  5713. var a3 = o3.data.members;
  5714. xe.l("".concat(n3, " ok"));
  5715. var i3 = a3.filter(function(e4) {
  5716. return 1 === e4.result;
  5717. }).map(function(e4) {
  5718. return e4.userID;
  5719. }), u2 = a3.filter(function(e4) {
  5720. return 0 === e4.result;
  5721. }).map(function(e4) {
  5722. return e4.userID;
  5723. }), c2 = a3.filter(function(e4) {
  5724. return 2 === e4.result;
  5725. }).map(function(e4) {
  5726. return e4.userID;
  5727. }), l2 = a3.filter(function(e4) {
  5728. return 4 === e4.result;
  5729. }).map(function(e4) {
  5730. return e4.userID;
  5731. }), p2 = "groupID:".concat(e3.groupID, ", ") + "successUserIDList:".concat(i3, ", ") + "failureUserIDList:".concat(u2, ", ") + "existedUserIDList:".concat(c2, ", ") + "overLimitUserIDList:".concat(l2);
  5732. return r2.setNetworkType(t2.getNetworkType()).setMoreMessage(p2).end(), 0 === i3.length ? Ka({ successUserIDList: i3, failureUserIDList: u2, existedUserIDList: c2, overLimitUserIDList: l2 }) : (s3.memberCount += i3.length, t2._updateConversationGroupProfile(s3), Ka({ successUserIDList: i3, failureUserIDList: u2, existedUserIDList: c2, overLimitUserIDList: l2, group: s3 }));
  5733. }).catch(function(e4) {
  5734. return t2.probeNetwork().then(function(t3) {
  5735. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  5736. r2.setError(e4, o3, s4).end();
  5737. }), xe.e("".concat(n3, " failed. error:"), e4), Ja(e4);
  5738. });
  5739. } }, { key: "deleteGroupMember", value: function(e3) {
  5740. var t2 = this, n3 = "".concat(this._n, ".").concat("deleteGroupMember"), o2 = e3.groupID, s3 = e3.userIDList, a2 = this.getModule(Un).getLocalGroupProfile(o2);
  5741. if (at(a2))
  5742. return Ja({ code: da.CANNOT_FIND_GROUP });
  5743. if (Ct(a2.type))
  5744. return this.canIUse(B.AVCHATROOM_BAN_MBR) ? this._banAVChatRoomMember(e3) : Ja({ code: da.CANNOT_USE_COMMERCIAL_ABILITY });
  5745. var r2 = new ka("deleteGroupMember"), i2 = "groupID:".concat(o2, " ").concat(s3.length > 5 ? "userIDList.length:".concat(s3.length) : "userIDList:".concat(s3));
  5746. return r2.setMessage(i2), xe.l("".concat(n3, " groupID:").concat(o2, " userIDList:"), s3), this.request({ protocolName: Gs, requestData: e3 }).then(function() {
  5747. return r2.setNetworkType(t2.getNetworkType()).end(), xe.l("".concat(n3, " ok")), a2.memberCount -= 1, t2._updateConversationGroupProfile(a2), t2.deleteLocalGroupMembers(o2, s3), Ka({ group: a2, userIDList: s3 });
  5748. }).catch(function(e4) {
  5749. return t2.probeNetwork().then(function(t3) {
  5750. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  5751. r2.setError(e4, o3, s4).end();
  5752. }), xe.e("".concat(n3, " failed. error:"), e4), Ja(e4);
  5753. });
  5754. } }, { key: "_updateConversationGroupProfile", value: function(e3) {
  5755. this.getModule(Fn).updateConversationGroupProfile([e3]);
  5756. } }, { key: "_banAVChatRoomMember", value: function(e3) {
  5757. var t2 = this, n3 = "".concat(this._n, ".").concat("deleteGroupMember"), o2 = e3.groupID, s3 = e3.userIDList, a2 = "groupID:".concat(o2, " ").concat(s3.length > 5 ? "userIDList.length:".concat(s3.length) : "userIDList:".concat(s3)), r2 = new ka("deleteGroupMember");
  5758. r2.setMessage(a2), xe.l("".concat(n3, " groupID:").concat(o2, " userIDList:"), s3);
  5759. var i2 = this.getModule(Un).getLocalGroupProfile(o2);
  5760. return at(e3.duration) || 0 === e3.duration ? Ja({ code: da.BAN_DURATION_INVALID }) : this.request({ protocolName: Us, requestData: e3 }).then(function() {
  5761. return r2.setNetworkType(t2.getNetworkType()).end(), xe.l("".concat(n3, " ok")), t2.deleteLocalGroupMembers(o2, s3), Ka({ group: i2, userIDList: s3 });
  5762. }).catch(function(e4) {
  5763. return t2.probeNetwork().then(function(t3) {
  5764. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  5765. r2.setError(e4, o3, s4).end();
  5766. }), xe.e("".concat(n3, " failed. error:"), e4), Ja(e4);
  5767. });
  5768. } }, { key: "setGroupMemberMuteTime", value: function(e3) {
  5769. var t2 = this, n3 = e3.groupID, o2 = e3.userID, s3 = e3.muteTime, a2 = "".concat(this._n, ".").concat("setGroupMemberMuteTime");
  5770. if (o2 === this.getMyUserID())
  5771. return Ja(new Wa({ code: da.CANNOT_MUTE_SELF }));
  5772. xe.l("".concat(a2, " groupID:").concat(n3, " userID:").concat(o2));
  5773. var r2 = new ka("setGroupMemberMuteTime");
  5774. return r2.setMessage("groupID:".concat(n3, " userID:").concat(o2, " muteTime:").concat(s3)), this.modifyGroupMemberInfo({ groupID: n3, userID: o2, muteTime: s3 }).then(function(e4) {
  5775. r2.setNetworkType(t2.getNetworkType()).end(), xe.l("".concat(a2, " ok"));
  5776. var o3 = t2.getModule(Un);
  5777. return Ka({ group: o3.getLocalGroupProfile(n3), member: e4 });
  5778. }).catch(function(e4) {
  5779. return t2.probeNetwork().then(function(t3) {
  5780. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  5781. r2.setError(e4, o3, s4).end();
  5782. }), xe.e("".concat(a2, " failed. error:"), e4), Ja(e4);
  5783. });
  5784. } }, { key: "setGroupMemberRole", value: function(e3) {
  5785. var t2 = this, n3 = "".concat(this._n, ".").concat("setGroupMemberRole"), o2 = e3.groupID, s3 = e3.userID, a2 = e3.role, r2 = this.getModule(Un).getLocalGroupProfile(o2);
  5786. if (r2.selfInfo.role !== S.GRP_MBR_ROLE_OWNER)
  5787. return Ja({ code: da.NOT_OWNER });
  5788. if ([S.GRP_WORK, S.GRP_AVCHATROOM].includes(r2.type))
  5789. return Ja({ code: da.CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM });
  5790. var i2 = [S.GRP_MBR_ROLE_ADMIN, S.GRP_MBR_ROLE_MEMBER];
  5791. if (Tt({ groupID: o2 }) && i2.push(S.GRP_MBR_ROLE_CUSTOM), i2.indexOf(a2) < 0)
  5792. return Ja({ code: da.INVALID_MEMBER_ROLE });
  5793. if (s3 === this.getMyUserID())
  5794. return Ja({ code: da.CANNOT_SET_SELF_MEMBER_ROLE });
  5795. var u2 = new ka("setGroupMemberRole");
  5796. return u2.setMessage("groupID:".concat(o2, " userID:").concat(s3, " role:").concat(a2)), xe.l("".concat(n3, " groupID:").concat(o2, " userID:").concat(s3)), this.modifyGroupMemberInfo({ groupID: o2, userID: s3, role: a2 }).then(function(e4) {
  5797. return u2.setNetworkType(t2.getNetworkType()).end(), xe.l("".concat(n3, " ok")), Ka({ group: r2, member: e4 });
  5798. }).catch(function(e4) {
  5799. return t2.probeNetwork().then(function(t3) {
  5800. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  5801. u2.setError(e4, o3, s4).end();
  5802. }), xe.e("".concat(n3, " failed. error:"), e4), Ja(e4);
  5803. });
  5804. } }, { key: "_filterProfanity", value: function(e3, t2) {
  5805. var n3 = this.getModule(no);
  5806. if (!n3)
  5807. return true;
  5808. var o2 = n3.filterText(t2[e3], J), s3 = o2.isAllowedToSend, a2 = o2.modifiedText;
  5809. return true === s3 && (t2[e3] = a2, true);
  5810. } }, { key: "setGroupMemberNameCard", value: function(e3) {
  5811. var t2 = this, n3 = "".concat(this._n, ".").concat("setGroupMemberNameCard");
  5812. if (e3.nameCard && false === this._filterProfanity("nameCard", e3))
  5813. return Ja({ code: da.PROFANITY_FOUND });
  5814. var o2 = e3.groupID, s3 = e3.userID, a2 = void 0 === s3 ? this.getMyUserID() : s3, r2 = e3.nameCard;
  5815. xe.l("".concat(n3, " groupID:").concat(o2, " userID:").concat(a2));
  5816. var i2 = new ka("setGroupMemberNameCard");
  5817. return i2.setMessage("groupID:".concat(o2, " userID:").concat(a2, " nameCard:").concat(r2)), this.modifyGroupMemberInfo({ groupID: o2, userID: a2, nameCard: r2 }).then(function(e4) {
  5818. xe.l("".concat(n3, " ok")), i2.setNetworkType(t2.getNetworkType()).end();
  5819. var s4 = t2.getModule(Un).getLocalGroupProfile(o2);
  5820. return a2 === t2.getMyUserID() && s4 && s4.setSelfNameCard(r2), Ka({ group: s4, member: e4 });
  5821. }).catch(function(e4) {
  5822. return t2.probeNetwork().then(function(t3) {
  5823. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  5824. i2.setError(e4, o3, s4).end();
  5825. }), xe.e("".concat(n3, " failed. error:"), e4), Ja(e4);
  5826. });
  5827. } }, { key: "setGroupMemberCustomField", value: function(e3) {
  5828. var t2 = this, n3 = "".concat(this._n, ".").concat("setGroupMemberCustomField"), o2 = e3.groupID, s3 = e3.userID, a2 = void 0 === s3 ? this.getMyUserID() : s3, r2 = e3.memberCustomField;
  5829. xe.l("".concat(n3, " groupID:").concat(o2, " userID:").concat(a2));
  5830. var i2 = new ka("setGroupMemberCustomField");
  5831. return i2.setMessage("groupID:".concat(o2, " userID:").concat(a2, " memberCustomField:").concat(JSON.stringify(r2))), this.modifyGroupMemberInfo({ groupID: o2, userID: a2, memberCustomField: r2 }).then(function(e4) {
  5832. i2.setNetworkType(t2.getNetworkType()).end(), xe.l("".concat(n3, " ok"));
  5833. var s4 = t2.getModule(Un).getLocalGroupProfile(o2);
  5834. return Ka({ group: s4, member: e4 });
  5835. }).catch(function(e4) {
  5836. return t2.probeNetwork().then(function(t3) {
  5837. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  5838. i2.setError(e4, o3, s4).end();
  5839. }), xe.e("".concat(n3, " failed. error:"), e4), Ja(e4);
  5840. });
  5841. } }, { key: "modifyGroupMemberInfo", value: function(e3) {
  5842. var n3 = this, o2 = e3.groupID, s3 = e3.userID, a2 = void 0;
  5843. return Dt(o2) && (o2 = qt(a2 = o2)), this.request({ protocolName: Ps, requestData: t(t({}, e3), {}, { groupID: o2, topicID: a2 }) }).then(function() {
  5844. if (n3.hasLocalGroupMember(o2, s3)) {
  5845. var t2 = n3.getLocalGroupMemberInfo(o2, s3);
  5846. return at(e3.muteTime) || t2.updateMuteUntil(e3.muteTime), at(e3.role) || t2.updateRole(e3.role), at(e3.nameCard) || t2.updateNameCard(e3.nameCard), at(e3.memberCustomField) || t2.updateMemberCustomField(e3.memberCustomField), t2;
  5847. }
  5848. return n3.getGroupMemberProfile({ groupID: o2, userIDList: [s3] }).then(function(e4) {
  5849. return v(e4.data.memberList, 1)[0];
  5850. });
  5851. });
  5852. } }, { key: "markGroupMemberList", value: function(e3) {
  5853. var t2 = this, n3 = "".concat(this._n, ".").concat("markGroupMemberList"), o2 = e3.groupID, s3 = e3.markType, a2 = e3.enableMark, r2 = e3.userIDList, i2 = void 0 === r2 ? [] : r2, u2 = "groupID:".concat(o2, " markType:").concat(s3, " enableMark:").concat(a2, " userIDList count: ").concat(i2.length);
  5854. xe.l("".concat(n3, " ").concat(u2));
  5855. var c2 = 2, l2 = [];
  5856. true === a2 && (c2 = 1);
  5857. var p2 = m(i2);
  5858. i2.length > 500 && (p2 = i2.slice(0, 500), xe.w("".concat(n3, " ").concat(Kt(500)))), p2.forEach(function(e4) {
  5859. l2.push({ userID: e4, markType: [s3] });
  5860. }), p2 = null;
  5861. var d2 = new ka("markGroupMemberList");
  5862. return d2.setMessage("".concat(u2)), this.request({ protocolName: bs, requestData: { groupID: o2, operationType: c2, memberList: l2 } }).then(function(e4) {
  5863. var o3 = e4.data.memberList, s4 = void 0 === o3 ? [] : o3, a3 = [], r3 = [];
  5864. s4.length === i2.length ? a3.push.apply(a3, m(i2)) : (s4.forEach(function(e5) {
  5865. a3.push(e5.userID);
  5866. }), i2.forEach(function(e5) {
  5867. a3.includes(e5) || r3.push(e5);
  5868. }));
  5869. var u3 = "success count:".concat(a3.length, " fail count:").concat(r3.length);
  5870. return d2.setNetworkType(t2.getNetworkType()).setMessage(u3).end(), xe.l("".concat(n3, " ok. ").concat(u3)), Ka({ successUserIDList: a3, failureUserIDList: r3 });
  5871. }).catch(function(e4) {
  5872. return t2.probeNetwork().then(function(t3) {
  5873. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  5874. d2.setError(e4, o3, s4).end();
  5875. }), xe.e("".concat(n3, " failed. error:"), e4), Ja(e4);
  5876. });
  5877. } }, { key: "_getGroupMemberProfileAdvance", value: function(e3) {
  5878. return this.request({ protocolName: Ns, requestData: t(t({}, e3), {}, { memberInfoFilter: e3.memberInfoFilter ? e3.memberInfoFilter : ["Role", "JoinTime", "NameCard", "ShutUpUntil"] }) });
  5879. } }, { key: "_updateLocalGroupMemberMap", value: function(e3, t2) {
  5880. var n3 = this;
  5881. return st(t2) && 0 !== t2.length ? t2.map(function(t3) {
  5882. return n3.hasLocalGroupMember(e3, t3.userID) ? n3.getLocalGroupMemberInfo(e3, t3.userID).updateMember(t3) : n3.setLocalGroupMember(e3, new Fr(t3)), n3.getLocalGroupMemberInfo(e3, t3.userID);
  5883. }) : [];
  5884. } }, { key: "deleteLocalGroupMembers", value: function(e3, t2) {
  5885. var n3 = this.groupMemberListMap.get(e3);
  5886. n3 && t2.forEach(function(e4) {
  5887. n3.delete(e4);
  5888. });
  5889. } }, { key: "getLocalGroupMemberInfo", value: function(e3, t2) {
  5890. return this.groupMemberListMap.has(e3) ? this.groupMemberListMap.get(e3).get(t2) : null;
  5891. } }, { key: "setLocalGroupMember", value: function(e3, t2) {
  5892. if (this.groupMemberListMap.has(e3))
  5893. this.groupMemberListMap.get(e3).set(t2.userID, t2);
  5894. else {
  5895. var n3 = (/* @__PURE__ */ new Map()).set(t2.userID, t2);
  5896. this.groupMemberListMap.set(e3, n3);
  5897. }
  5898. } }, { key: "getLocalGroupMemberList", value: function(e3) {
  5899. return this.groupMemberListMap.get(e3);
  5900. } }, { key: "hasLocalGroupMember", value: function(e3, t2) {
  5901. return this.groupMemberListMap.has(e3) && this.groupMemberListMap.get(e3).has(t2);
  5902. } }, { key: "hasLocalGroupMemberMap", value: function(e3) {
  5903. return this.groupMemberListMap.has(e3);
  5904. } }, { key: "reset", value: function() {
  5905. this.groupMemberListMap.clear();
  5906. } }]), s2;
  5907. }(ro), xr = ["topicID", "topicName", "avatar", "introduction", "notification", "unreadCount", "muteAllMembers", "customData", "groupAtInfoList", "nextMessageSeq", "selfInfo"], Vr = function(e2, t2) {
  5908. return jt(e2) ? { lastTime: 0, lastSequence: 0, fromAccount: "", payload: null, type: "", messageForShow: "", nick: "", version: 0, cloudCustomData: "", isRevoked: false, revoker: null } : { lastTime: e2.time || 0, lastSequence: e2.sequence || 0, fromAccount: e2.from || "", payload: e2.payload || null, type: e2.type || "", messageForShow: xt(e2.type, e2.payload, t2), nick: e2.nick || "", version: e2.version || 0, cloudCustomData: e2.cloudCustomData || "", isRevoked: e2.isRevoked || false, revoker: e2.revoker || null };
  5909. }, Br = function() {
  5910. function e2(t2, n2) {
  5911. o(this, e2), this.topicID = "", this.topicName = "", this.avatar = "", this.introduction = "", this.notification = "", this.unreadCount = 0, this.muteAllMembers = false, this.customData = "", this.groupAtInfoList = [], this.nextMessageSeq = 0, this.lastMessage = Vr(t2.lastMessage, n2), this.selfInfo = { muteTime: 0, readedSequence: 0, messageRemindType: "", excludedUnreadSequenceList: void 0 }, this._initTopic(t2);
  5912. }
  5913. return a(e2, [{ key: "_initTopic", value: function(e3) {
  5914. for (var t2 in e3)
  5915. xr.indexOf(t2) < 0 || ("selfInfo" === t2 ? this.updateSelfInfo(e3[t2]) : this[t2] = "muteAllMembers" === t2 ? 1 === e3[t2] : e3[t2]);
  5916. } }, { key: "updateUnreadCount", value: function() {
  5917. var e3 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0;
  5918. this.unreadCount = e3;
  5919. } }, { key: "updateNextMessageSeq", value: function(e3) {
  5920. this.nextMessageSeq = e3;
  5921. } }, { key: "updateLastMessage", value: function(e3) {
  5922. this.lastMessage = Vr(e3);
  5923. } }, { key: "updateGroupAtInfoList", value: function(e3) {
  5924. this.groupAtInfoList = JSON.parse(JSON.stringify(e3));
  5925. } }, { key: "updateTopic", value: function(e3) {
  5926. at(e3.selfInfo) || this.updateSelfInfo(e3.selfInfo), at(e3.muteAllMembers) || (this.muteAllMembers = 1 === e3.muteAllMembers), pt(this, e3, ["groupID", "lastMessageTime", "selfInfo", "muteAllMembers", "lastMsg"]);
  5927. } }, { key: "updateSelfInfo", value: function(e3) {
  5928. return 0 !== pt(this.selfInfo, e3, [], [""]);
  5929. } }, { key: "reduceUnreadCount", value: function() {
  5930. return this.unreadCount >= 1 && (this.unreadCount -= 1, true);
  5931. } }, { key: "isLastMessageRevoked", value: function(e3) {
  5932. return e3.sequence === this.lastMessage.lastSequence;
  5933. } }, { key: "setLastMessageRevoked", value: function(e3) {
  5934. this.lastMessage.isRevoked = e3;
  5935. } }, { key: "setLastMessageRevoker", value: function(e3) {
  5936. this.lastMessage.revoker = e3;
  5937. } }]), e2;
  5938. }(), Hr = function(e2) {
  5939. i(s2, e2);
  5940. var n2 = f(s2);
  5941. function s2(e3) {
  5942. var t2;
  5943. return o(this, s2), (t2 = n2.call(this, e3))._n = "TopicModule", t2._topicMap = /* @__PURE__ */ new Map(), t2._getTopicTimeMap = /* @__PURE__ */ new Map(), t2.TOPIC_CACHE_TIME = 300, t2.TOPIC_LAST_ACTIVE_TIME = 3600, t2.getInnerEmitterInstance().on($a, t2._onCloudConfigUpdated, _(t2)), t2;
  5944. }
  5945. return a(s2, [{ key: "_onCloudConfigUpdated", value: function() {
  5946. var e3 = this.getCloudConfig("topic_cache_time"), t2 = this.getCloudConfig("topic_last_active_time");
  5947. at(e3) || (this.TOPIC_CACHE_TIME = Number(e3)), at(t2) || (this.TOPIC_LAST_ACTIVE_TIME = Number(t2));
  5948. } }, { key: "onTopicCreated", value: function(e3) {
  5949. var t2 = e3.groupID;
  5950. this.resetGetTopicTime(t2), this.emitOuterEvent(E.TOPIC_CREATED, e3);
  5951. } }, { key: "onTopicDeleted", value: function(e3) {
  5952. var t2 = this, n3 = e3.groupID, o2 = e3.topicIDList;
  5953. (void 0 === o2 ? [] : o2).forEach(function(e4) {
  5954. t2._deleteLocalTopic(n3, e4);
  5955. }), this.emitOuterEvent(E.TOPIC_DELETED, e3);
  5956. } }, { key: "onTopicMessageRemindTypeUpdated", value: function(e3) {
  5957. var t2 = e3.groupID, n3 = e3.topicID, o2 = e3.messageRemindType, s3 = this.getLocalTopic(t2, n3);
  5958. if (s3) {
  5959. var a2 = s3.updateSelfInfo({ messageRemindType: o2 });
  5960. a2 && this.emitOuterEvent(E.TOPIC_UPDATED, { groupID: t2, topic: s3 }), xe.d("".concat(this._n, ".onTopicMessageRemindTypeUpdated topicID:").concat(n3) + " messageRemindType:".concat(o2, " isTopicUpdated:").concat(a2));
  5961. }
  5962. } }, { key: "onTopicProfileUpdated", value: function(e3) {
  5963. var t2 = e3.groupID, n3 = e3.topicID, o2 = this.getLocalTopic(t2, n3);
  5964. o2 && (o2.updateTopic(e3), this.emitOuterEvent(E.TOPIC_UPDATED, { groupID: t2, topic: o2 }));
  5965. } }, { key: "onConversationProxy", value: function(e3) {
  5966. var t2 = e3.topicID, n3 = e3.unreadCount, o2 = e3.groupAtInfoList, s3 = qt(t2), a2 = this.getLocalTopic(s3, t2), r2 = false;
  5967. a2 && (at(n3) || a2.unreadCount === n3 || (a2.updateUnreadCount(n3), r2 = true), at(o2) || (a2.updateGroupAtInfoList(o2), r2 = true)), r2 && this.emitOuterEvent(E.TOPIC_UPDATED, { groupID: s3, topic: a2 });
  5968. } }, { key: "onMessageSent", value: function(e3) {
  5969. var t2 = e3.groupID, n3 = e3.topicID, o2 = e3.lastMessage, s3 = this.getLocalTopic(t2, n3);
  5970. s3 && (s3.nextMessageSeq += 1, s3.updateLastMessage(o2), this.emitOuterEvent(E.TOPIC_UPDATED, { groupID: t2, topic: s3 }));
  5971. } }, { key: "onMessageModified", value: function(e3) {
  5972. var t2 = e3.to, n3 = e3.time, o2 = e3.sequence, s3 = e3.elements, a2 = e3.cloudCustomData, r2 = e3.messageVersion, i2 = qt(t2), u2 = this.getLocalTopic(i2, t2);
  5973. if (u2) {
  5974. var c2 = u2.lastMessage;
  5975. xe.d("".concat(this._n, ".onMessageModified topicID:").concat(t2, " lastMessage:"), JSON.stringify(c2), "options:", JSON.stringify(e3)), c2 && (null === c2.payload || c2.lastTime === n3 && c2.lastSequence === o2 && c2.version !== r2) && (c2.type = s3[0].type, c2.payload = s3[0].content, c2.messageForShow = xt(c2.type, c2.payload, this.isIntl()), c2.cloudCustomData = a2, c2.version = r2, c2.lastSequence = o2, c2.lastTime = n3, this.emitOuterEvent(E.TOPIC_UPDATED, { groupID: i2, topic: u2 }));
  5976. }
  5977. } }, { key: "onMessageRevoked", value: function(e3) {
  5978. var t2 = this;
  5979. if (0 !== e3.length) {
  5980. var n3 = null, o2 = null, s3 = false;
  5981. e3.forEach(function(e4) {
  5982. var a2 = e4.to;
  5983. o2 = qt(a2), (n3 = t2.getLocalTopic(o2, a2)) && (n3.reduceUnreadCount() && (s3 = true), n3.isLastMessageRevoked(e4) && (n3.setLastMessageRevoked(true), n3.setLastMessageRevoker(e4.revoker), s3 = true));
  5984. }), s3 && this.emitOuterEvent(E.TOPIC_UPDATED, { groupID: o2, topic: n3 });
  5985. }
  5986. } }, { key: "isLastMessageRevoked", value: function(e3) {
  5987. var t2 = e3.topicID, n3 = e3.sequence, o2 = qt(t2), s3 = this.getLocalTopic(o2, t2), a2 = false;
  5988. return s3 && (a2 = s3.isLastMessageRevoked({ sequence: n3 })), a2;
  5989. } }, { key: "getJoinedCommunityList", value: function() {
  5990. return this.getModule(Un).getGroupList({ isGroupWithTopicOnly: true }).then(function(e3) {
  5991. var t2 = e3.data.groupList;
  5992. return Ka({ groupList: void 0 === t2 ? [] : t2 });
  5993. }).catch(function(e3) {
  5994. return Ja(e3);
  5995. });
  5996. } }, { key: "createTopicInCommunity", value: function(e3) {
  5997. var n3 = this, o2 = "".concat(this._n, ".").concat("createTopicInCommunity"), s3 = e3.topicID;
  5998. if (!at(s3) && !Dt(s3))
  5999. return Ja({ code: da.ILLEGAL_TOPIC_ID });
  6000. if (e3.topicName && false === this._filterProfanity("topicName", e3))
  6001. return Ja({ code: da.PROFANITY_FOUND });
  6002. if (e3.introduction && false === this._filterProfanity("introduction", e3))
  6003. return Ja({ code: da.PROFANITY_FOUND });
  6004. if (e3.notification && false === this._filterProfanity("notification", e3))
  6005. return Ja({ code: da.PROFANITY_FOUND });
  6006. var a2 = new ka("createTopicInCommunity");
  6007. return this.request({ protocolName: $s, requestData: t({}, e3) }).then(function(s4) {
  6008. var r2 = s4.data.topicID;
  6009. return a2.setMessage("topicID:".concat(r2)).setNetworkType(n3.getNetworkType()).end(), xe.l("".concat(o2, " ok")), n3._updateTopicMap([t(t({}, e3), {}, { topicID: r2 })]), Ka({ topicID: r2 });
  6010. }).catch(function(e4) {
  6011. return n3.probeNetwork().then(function(t2) {
  6012. var n4 = v(t2, 2), o3 = n4[0], s4 = n4[1];
  6013. a2.setError(e4, o3, s4).end();
  6014. }), xe.e("".concat(o2, " failed. error:"), e4), Ja(e4);
  6015. });
  6016. } }, { key: "deleteTopicFromCommunity", value: function(e3) {
  6017. var t2 = this, n3 = "".concat(this._n, ".").concat("deleteTopicFromCommunity"), o2 = e3.groupID, s3 = e3.topicIDList, a2 = void 0 === s3 ? [] : s3, r2 = new ka("deleteTopicFromCommunity");
  6018. return r2.setMessage("groupID:".concat(o2, " topicIDList:").concat(a2)), this.request({ protocolName: ea, requestData: { groupID: o2, topicIDList: a2 } }).then(function(e4) {
  6019. var n4 = e4.data.resultList, s4 = [], a3 = [];
  6020. (void 0 === n4 ? [] : n4).forEach(function(e5) {
  6021. var t3 = e5.topicID, n5 = e5.errorCode, o3 = e5.errorInfo;
  6022. 0 === n5 ? s4.push({ topicID: t3 }) : a3.push({ topicID: t3, code: n5, message: o3 });
  6023. });
  6024. var i2 = "success count:".concat(s4.length, ", fail count:").concat(a3.length);
  6025. return r2.setMoreMessage("".concat(i2)).setNetworkType(t2.getNetworkType()).end(), xe.l("".concat(i2)), s4.forEach(function(e5) {
  6026. t2._deleteLocalTopic(o2, e5.topicID);
  6027. }), Ka({ successTopicList: s4, failureTopicList: a3 });
  6028. }).catch(function(e4) {
  6029. return t2.probeNetwork().then(function(t3) {
  6030. var n4 = v(t3, 2), o3 = n4[0], s4 = n4[1];
  6031. r2.setError(e4, o3, s4).end();
  6032. }), xe.e("".concat(n3, " failed. error:"), e4), Ja(e4);
  6033. });
  6034. } }, { key: "updateTopicProfile", value: function(e3) {
  6035. var n3 = this, o2 = "".concat(this._n, ".").concat("updateTopicProfile");
  6036. if (xe.l("".concat(o2, " options:"), e3), e3.topicName && false === this._filterProfanity("topicName", e3))
  6037. return Ja({ code: da.PROFANITY_FOUND });
  6038. if (e3.introduction && false === this._filterProfanity("introduction", e3))
  6039. return Ja({ code: da.PROFANITY_FOUND });
  6040. if (e3.notification && false === this._filterProfanity("notification", e3))
  6041. return Ja({ code: da.PROFANITY_FOUND });
  6042. var s3 = new ka("updateTopicProfile");
  6043. return s3.setMessage("groupID:".concat(e3.groupID, " topicID:").concat(e3.topicID)), at(e3.muteAllMembers) || (e3.muteAllMembers = true === e3.muteAllMembers ? "On" : "Off"), this.request({ protocolName: ta, requestData: t({}, e3) }).then(function() {
  6044. return s3.setNetworkType(n3.getNetworkType()).end(), xe.l("".concat(o2, " ok")), n3._updateTopicMap([e3]), Ka({ topic: n3.getLocalTopic(e3.groupID, e3.topicID) });
  6045. }).catch(function(e4) {
  6046. return n3.probeNetwork().then(function(t2) {
  6047. var n4 = v(t2, 2), o3 = n4[0], a2 = n4[1];
  6048. s3.setError(e4, o3, a2).end();
  6049. }), xe.e("".concat(o2, " failed. error:"), e4), Ja(e4);
  6050. });
  6051. } }, { key: "getTopicList", value: function(e3) {
  6052. var n3 = this, o2 = "".concat(this._n, ".").concat("getTopicList"), s3 = e3.groupID, a2 = e3.topicIDList, r2 = void 0 === a2 ? [] : a2, i2 = 0 === r2.length, u2 = new ka("getTopicList");
  6053. if (u2.setMessage("groupID:".concat(s3)), this._getTopicTimeMap.has(s3)) {
  6054. var c2 = this._getTopicTimeMap.get(s3), l2 = c2.isGetAll, p2 = c2.time;
  6055. if ((l2 || !l2 && !i2) && Date.now() - p2 < 1e3 * this.TOPIC_CACHE_TIME) {
  6056. var d2 = this._getLocalTopicList(s3, r2);
  6057. if (i2 || d2.length === r2.length)
  6058. return u2.setNetworkType(this.getNetworkType()).setMoreMessage("from cache, topic count:".concat(d2.length)).end(), xe.l("".concat(o2, " groupID:").concat(s3, " from cache, topic count:").concat(d2.length)), za({ successTopicList: d2, failureTopicList: [] });
  6059. }
  6060. }
  6061. return this.request({ protocolName: na, requestData: { groupID: s3, topicIDList: r2 } }).then(function(e4) {
  6062. var a3 = e4.data.topicInfoList, r3 = [], c3 = [], l3 = [];
  6063. (void 0 === a3 ? [] : a3).forEach(function(e5) {
  6064. var n4 = e5.topic, o3 = e5.selfInfo, s4 = e5.errorCode, a4 = e5.errorInfo, i3 = n4.topicID;
  6065. 0 === s4 ? (r3.push(t(t({}, n4), {}, { selfInfo: o3 })), c3.push(i3)) : l3.push({ topicID: i3, code: s4, message: a4 });
  6066. }), n3._updateTopicMap(r3), n3._handleTopicAtInfo(r3);
  6067. var p3 = "success count:".concat(c3.length, ", fail count:").concat(l3.length);
  6068. u2.setNetworkType(n3.getNetworkType()).setMoreMessage("".concat(p3)).end(), xe.l("".concat(o2, " groupID:").concat(s3, " from remote, ").concat(p3));
  6069. var d3 = [];
  6070. return jt(c3) || (n3._getTopicTimeMap.set(s3, { time: Date.now(), isGetAll: i2 }), d3 = n3._getLocalTopicList(s3, c3)), Ka({ successTopicList: d3, failureTopicList: l3 });
  6071. }).catch(function(e4) {
  6072. return n3.probeNetwork(e4).then(function(t2) {
  6073. var n4 = v(t2, 2), o3 = n4[0], s4 = n4[1];
  6074. u2.setError(e4, o3, s4).end();
  6075. }), xe.e("".concat(o2, " failed. error:"), e4), Ja(e4);
  6076. });
  6077. } }, { key: "hasLocalTopic", value: function(e3, t2) {
  6078. return !!this._topicMap.has(e3) && this._topicMap.get(e3).has(t2);
  6079. } }, { key: "getLocalTopic", value: function(e3, t2) {
  6080. var n3 = null;
  6081. return this._topicMap.has(e3) && (n3 = this._topicMap.get(e3).get(t2)), n3;
  6082. } }, { key: "_getLocalTopicList", value: function(e3) {
  6083. var t2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [], n3 = this._topicMap.get(e3), o2 = [];
  6084. return n3 && (o2 = m(n3.values())), 0 === t2.length ? o2 : o2.filter(function(e4) {
  6085. return t2.includes(e4.topicID);
  6086. });
  6087. } }, { key: "_deleteLocalTopic", value: function(e3, t2) {
  6088. this._topicMap.has(e3) && (this._topicMap.get(e3).delete(t2), xe.l("".concat(this._n, "._deleteLocalTopic groupID:").concat(e3, " topicID:").concat(t2)));
  6089. } }, { key: "_updateTopicMap", value: function(e3) {
  6090. var t2 = this, n3 = [];
  6091. (e3.forEach(function(e4) {
  6092. var o2 = e4.groupID, s3 = e4.topicID, a2 = null;
  6093. t2._topicMap.has(o2) || t2._topicMap.set(o2, /* @__PURE__ */ new Map()), t2._topicMap.get(o2).has(s3) ? (a2 = t2._topicMap.get(o2).get(s3)).updateTopic(e4) : (t2._getTopicLastMessage(e4), a2 = new Br(e4, t2.isIntl()), t2._topicMap.get(o2).set(s3, a2));
  6094. var r2 = t2._computeUnreadCount(a2);
  6095. a2.updateUnreadCount(r2), n3.push({ conversationID: "".concat(S.CONV_GROUP).concat(s3), type: S.CONV_TOPIC, unreadCount: r2 });
  6096. }), n3.length > 0) && this.getModule(Fn).updateTopicConversation(n3);
  6097. } }, { key: "resetGetTopicTime", value: function(e3) {
  6098. var t2 = this;
  6099. at(e3) ? m(this._getTopicTimeMap.keys()).forEach(function(e4) {
  6100. t2._getTopicTimeMap.set(e4, 0);
  6101. }) : this._getTopicTimeMap.set(e3, 0);
  6102. } }, { key: "getTopicListOnReconnected", value: function() {
  6103. var e3 = this, t2 = m(this._topicMap.keys()), n3 = [];
  6104. t2.forEach(function(t3) {
  6105. var o2 = [];
  6106. e3._getLocalTopicList(t3).forEach(function(t4) {
  6107. var n4 = t4.lastMessage.lastTime, s3 = void 0 === n4 ? 0 : n4;
  6108. Date.now() - 1e3 * s3 < 1e3 * e3.TOPIC_LAST_ACTIVE_TIME && o2.push(t4.topicID);
  6109. }), o2.length > 0 && n3.push({ groupID: t3, topicIDList: o2 });
  6110. }), xe.l("".concat(this._n, ".getTopicListOnReconnected. active community count:").concat(n3.length)), this._relayGetTopicList(n3);
  6111. } }, { key: "_relayGetTopicList", value: function(e3) {
  6112. var t2 = this;
  6113. if (0 !== e3.length) {
  6114. var n3 = e3.shift(), o2 = n3.topicIDList.length > 5 ? "topicIDList.length:".concat(n3.topicIDList.length) : "topicIDList:".concat(n3.topicIDList), s3 = new ka("relayGetTopicList");
  6115. s3.setMessage(o2), xe.l("".concat(this._n, "._relayGetTopicList. ").concat(o2)), this.getTopicList(n3).then(function() {
  6116. s3.setNetworkType(t2.getNetworkType()).end(), t2._relayGetTopicList(e3);
  6117. }).catch(function(n4) {
  6118. t2.probeNetwork().then(function(e4) {
  6119. var t3 = v(e4, 2), o3 = t3[0], a2 = t3[1];
  6120. s3.setError(n4, o3, a2).end();
  6121. }), t2._relayGetTopicList(e3);
  6122. });
  6123. }
  6124. } }, { key: "_handleTopicAtInfo", value: function(e3) {
  6125. var n3 = this;
  6126. 0 !== e3.length && e3.forEach(function(e4) {
  6127. var o2 = e4.groupID, s3 = e4.topicID, a2 = e4.groupAtInfoList, r2 = [];
  6128. at(a2) || (a2.forEach(function(e5) {
  6129. r2.push(t(t({}, e5), {}, { groupID: o2, topicID: s3 }));
  6130. }), n3.getModule(Fn).onNewGroupAtTips({ dataList: r2 }));
  6131. });
  6132. } }, { key: "_getTopicLastMessage", value: function(e3) {
  6133. if (!at(e3.lastMsg)) {
  6134. var t2 = { time: e3.lastMsg.time, sequence: e3.lastMsg.sequence, from: e3.lastMsg.from, payload: e3.lastMsg.elements[0] ? e3.lastMsg.elements[0].content : null, type: e3.lastMsg.elements[0] ? e3.lastMsg.elements[0].type : "", nick: e3.lastMsg.nick, version: e3.lastMsg.messageVersion, cloudCustomData: e3.lastMsg.cloudCustomData, isRevoked: 2 === e3.lastMsg.isPlaceMessage, revoker: jt(e3.lastMsg.revokerInfo) ? null : e3.lastMsg.revokerInfo.revoker };
  6135. e3.lastMessage = t2;
  6136. }
  6137. } }, { key: "deleteTopicListInCommunity", value: function(e3) {
  6138. var t2 = this, n3 = this._getLocalTopicList(e3), o2 = this.getModule(Fn);
  6139. n3.forEach(function(n4) {
  6140. var s3 = n4.topicID;
  6141. t2._deleteLocalTopic(e3, s3), t2._getTopicTimeMap.delete(e3), o2.deleteLocalConversation("".concat(S.CONV_GROUP).concat(s3));
  6142. });
  6143. } }, { key: "_computeUnreadCount", value: function(e3) {
  6144. var t2 = e3.selfInfo, n3 = t2.excludedUnreadSequenceList, o2 = t2.readedSequence, s3 = e3.nextMessageSeq - e3.selfInfo.readedSequence - 1;
  6145. if (st(n3)) {
  6146. var a2 = 0;
  6147. n3.forEach(function(t3) {
  6148. t3 >= o2 && t3 <= e3.nextMessageSeq - 1 && (a2 += 1);
  6149. }), a2 >= 1 && (s3 -= a2);
  6150. }
  6151. return s3 < 0 ? 0 : s3;
  6152. } }, { key: "_filterProfanity", value: function(e3, t2) {
  6153. var n3 = this.getModule(no);
  6154. if (!n3)
  6155. return true;
  6156. var o2 = n3.filterText(t2[e3], z), s3 = o2.isAllowedToSend, a2 = o2.modifiedText;
  6157. return true === s3 && (t2[e3] = a2, true);
  6158. } }, { key: "updateLastMessage", value: function(e3, t2) {
  6159. var n3 = qt(e3), o2 = this.getLocalTopic(n3, e3);
  6160. if (o2) {
  6161. var s3 = t2.sequence + 1;
  6162. o2.updateNextMessageSeq(s3), o2.updateLastMessage(t2), this.emitOuterEvent(E.TOPIC_UPDATED, { groupID: n3, topic: o2 });
  6163. }
  6164. } }, { key: "getMessageExtensions", value: function(e3, t2) {
  6165. xe.l("".concat(this._n, ".getMessageExtensions startSequence:").concat(t2));
  6166. var n3 = qt(e3.to);
  6167. return this.request({ protocolName: Es, requestData: { groupID: n3, topicID: e3.to, messageSequence: e3.sequence, startSequence: t2 } });
  6168. } }, { key: "modifyMessageExtensions", value: function(e3, t2) {
  6169. var n3 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1;
  6170. xe.l("".concat(this._n, ".modifyMessageExtensions operateType:").concat(n3));
  6171. var o2 = qt(e3.to);
  6172. return this.request({ protocolName: Ds, requestData: { groupID: o2, topicID: e3.to, messageSequence: e3.sequence, extensionList: t2, operateType: n3 } });
  6173. } }, { key: "reset", value: function() {
  6174. xe.l("".concat(this._n, ".reset")), this._topicMap.clear(), this._getTopicTimeMap.clear(), this.TOPIC_CACHE_TIME = 300, this.TOPIC_LAST_ACTIVE_TIME = 3600;
  6175. } }]), s2;
  6176. }(ro), Kr = function() {
  6177. function e2(t2) {
  6178. o(this, e2), this._userModule = t2, this._n = "ProfileHandler", this.TAG = "profile", this.accountProfileMap = /* @__PURE__ */ new Map(), this.expirationTime = 864e5;
  6179. }
  6180. return a(e2, [{ key: "setExpirationTime", value: function(e3) {
  6181. this.expirationTime = e3;
  6182. } }, { key: "getUserProfile", value: function(e3) {
  6183. var t2 = this, n2 = "".concat(this._n, ".").concat("getUserProfile"), o2 = e3.userIDList;
  6184. e3.fromAccount = this._userModule.getMyAccount(), o2.length > 100 && (xe.w("".concat(n2, " ").concat(Kt(100))), o2.length = 100);
  6185. for (var s2, a2 = [], r2 = [], i2 = 0, u2 = o2.length; i2 < u2; i2++)
  6186. s2 = o2[i2], this._userModule.isMyFriend(s2) && this._contains(s2) ? r2.push(this._getProfileFromMap(s2)) : a2.push(s2);
  6187. if (0 === a2.length)
  6188. return za(r2);
  6189. e3.toAccount = a2;
  6190. var c2 = e3.bFromGetMyProfile || false, l2 = [];
  6191. e3.toAccount.forEach(function(e4) {
  6192. l2.push({ toAccount: e4, standardSequence: 0, customSequence: 0 });
  6193. }), e3.userItem = l2;
  6194. var p2 = new ka("getUserProfile");
  6195. return p2.setMessage(o2.length > 5 ? "userIDList.length:".concat(o2.length) : "userIDList:".concat(o2)), this._userModule.request({ protocolName: fo, requestData: e3 }).then(function(e4) {
  6196. p2.setNetworkType(t2._userModule.getNetworkType()).end(), xe.i("".concat(n2, " ok"));
  6197. var o3 = t2._handleResponse(e4).concat(r2);
  6198. return Ka(c2 ? o3[0] : o3);
  6199. }).catch(function(e4) {
  6200. return t2._userModule.probeNetwork().then(function(t3) {
  6201. var n3 = v(t3, 2), o3 = n3[0], s3 = n3[1];
  6202. p2.setError(e4, o3, s3).end();
  6203. }), xe.e("".concat(n2, " failed. error:"), e4), Ja(e4);
  6204. });
  6205. } }, { key: "getMyProfile", value: function() {
  6206. var e3 = this._userModule.getMyAccount(), t2 = "".concat(this._n, ".getMyProfile");
  6207. if (xe.l("".concat(t2, " myAccount:").concat(e3)), this._fill(), this._contains(e3)) {
  6208. var n2 = this._getProfileFromMap(e3);
  6209. return xe.d("".concat(t2, " from cache, myProfile:").concat(JSON.stringify(n2))), za(n2);
  6210. }
  6211. return this.getUserProfile({ fromAccount: e3, userIDList: [e3], bFromGetMyProfile: true });
  6212. } }, { key: "_handleResponse", value: function(e3) {
  6213. var t2 = e3.data.userProfileItem;
  6214. if (!st(t2))
  6215. return [];
  6216. for (var n2 = [], o2 = Date.now(), s2 = 0, a2 = t2.length; s2 < a2; s2++) {
  6217. var r2 = t2[s2], i2 = r2.to, u2 = r2.profileItem;
  6218. if ("@TLS#NOT_FOUND" !== i2 && "" !== i2) {
  6219. var c2 = this._update(i2, this._getLatestProfileFromResponse(i2, u2)).latestProfile;
  6220. n2.push(c2);
  6221. }
  6222. }
  6223. return xe.l("".concat(this._n, "._handleResponse cost ").concat(Date.now() - o2, " ms")), n2;
  6224. } }, { key: "_getLatestProfileFromResponse", value: function(e3, t2) {
  6225. var n2 = { userID: e3, profileCustomField: [] };
  6226. if (!jt(t2))
  6227. for (var o2 = 0, s2 = t2.length; o2 < s2; o2++)
  6228. if (t2[o2].tag.indexOf("Tag_Profile_Custom") > -1)
  6229. n2.profileCustomField.push({ key: t2[o2].tag, value: t2[o2].value });
  6230. else
  6231. switch (t2[o2].tag) {
  6232. case Be.NICK:
  6233. n2.nick = t2[o2].value;
  6234. break;
  6235. case Be.GENDER:
  6236. n2.gender = t2[o2].value;
  6237. break;
  6238. case Be.BIRTHDAY:
  6239. n2.birthday = t2[o2].value;
  6240. break;
  6241. case Be.LOCATION:
  6242. n2.location = t2[o2].value;
  6243. break;
  6244. case Be.SELFSIGNATURE:
  6245. n2.selfSignature = t2[o2].value;
  6246. break;
  6247. case Be.ALLOWTYPE:
  6248. n2.allowType = t2[o2].value;
  6249. break;
  6250. case Be.LANGUAGE:
  6251. n2.language = t2[o2].value;
  6252. break;
  6253. case Be.AVATAR:
  6254. n2.avatar = t2[o2].value;
  6255. break;
  6256. case Be.MESSAGESETTINGS:
  6257. n2.messageSettings = t2[o2].value;
  6258. break;
  6259. case Be.ADMINFORBIDTYPE:
  6260. n2.adminForbidType = t2[o2].value;
  6261. break;
  6262. case Be.LEVEL:
  6263. n2.level = t2[o2].value;
  6264. break;
  6265. case Be.ROLE:
  6266. n2.role = t2[o2].value;
  6267. break;
  6268. default:
  6269. xe.w("".concat(this._n, "._getLatestProfileFromResponse unknown tag:"), t2[o2].tag, t2[o2].value);
  6270. }
  6271. return n2;
  6272. } }, { key: "updateMyProfile", value: function(e3) {
  6273. var t2 = this, n2 = "".concat(this._n, ".").concat("updateMyProfile");
  6274. if (e3.nick && false === this._userModule.filterProfanity("nick", e3))
  6275. return Ja({ code: da.PROFANITY_FOUND });
  6276. if (e3.selfSignature && false === this._userModule.filterProfanity("selfSignature", e3))
  6277. return Ja({ code: da.PROFANITY_FOUND });
  6278. var o2 = new ka("updateMyProfile");
  6279. o2.setMessage(JSON.stringify(e3));
  6280. var s2 = new ur().validate(e3);
  6281. if (!s2.valid)
  6282. return o2.setCode(da.UPDATE_PROFILE_INVALID_PARAM).setMoreMessage("info:".concat(s2.tips)).setNetworkType(this._userModule.getNetworkType()).end(), xe.e("".concat(n2, " info:").concat(s2.tips)), Ja({ code: da.UPDATE_PROFILE_INVALID_PARAM });
  6283. var a2 = [];
  6284. for (var r2 in e3)
  6285. Object.prototype.hasOwnProperty.call(e3, r2) && ("profileCustomField" === r2 ? e3.profileCustomField.forEach(function(e4) {
  6286. a2.push({ tag: e4.key, value: e4.value });
  6287. }) : a2.push({ tag: Be[r2.toUpperCase()], value: e3[r2] }));
  6288. if (0 === a2.length) {
  6289. var i2 = new Wa({ code: da.UPDATE_PROFILE_NO_KEY });
  6290. return o2.setError(i2, true, this._userModule.getNetworkType()).end(), xe.e("".concat(n2, " failed. error:"), i2), Ja(i2);
  6291. }
  6292. var u2 = this._userModule.getMyAccount();
  6293. return this._userModule.request({ protocolName: vo, requestData: { fromAccount: u2, profileItem: a2 } }).then(function(s3) {
  6294. o2.setNetworkType(t2._userModule.getNetworkType()).end(), xe.i("".concat(n2, " ok"));
  6295. var a3 = t2._update(u2, e3), r3 = a3.isProfileUpdated, i3 = a3.latestProfile;
  6296. return true === r3 && t2._userModule.emitOuterEvent(E.PROFILE_UPDATED, [i3]), za(i3);
  6297. }).catch(function(e4) {
  6298. return t2._userModule.probeNetwork().then(function(t3) {
  6299. var n3 = v(t3, 2), s3 = n3[0], a3 = n3[1];
  6300. o2.setError(e4, s3, a3).end();
  6301. }), xe.e("".concat(n2, " failed. error:"), e4), Ja(e4);
  6302. });
  6303. } }, { key: "onProfileModified", value: function(e3) {
  6304. var t2 = e3.dataList;
  6305. if (!jt(t2)) {
  6306. var n2, o2 = t2.length;
  6307. xe.d("".concat(this._n, ".onProfileModified count:").concat(o2, " dataList:"), e3.dataList);
  6308. for (var s2 = [], a2 = 0; a2 < o2; a2++) {
  6309. n2 = t2[a2].userID;
  6310. var r2 = this._update(n2, this._getLatestProfileFromResponse(n2, t2[a2].profileList)), i2 = r2.isProfileUpdated, u2 = r2.latestProfile;
  6311. true === i2 && s2.push(u2);
  6312. }
  6313. s2.length > 0 && (this._userModule.emitInnerEvent(er, s2), this._userModule.emitOuterEvent(E.PROFILE_UPDATED, s2));
  6314. }
  6315. } }, { key: "_fill", value: function() {
  6316. if (0 === this.accountProfileMap.size) {
  6317. for (var e3 = this._getCachedProfiles(), t2 = Date.now(), n2 = 0, o2 = e3.length; n2 < o2; n2++)
  6318. t2 - e3[n2].lastUpdatedTime < this.expirationTime && this.accountProfileMap.set(e3[n2].userID, e3[n2]);
  6319. xe.l("".concat(this._n, "._fill from cache, size:").concat(this.accountProfileMap.size));
  6320. }
  6321. } }, { key: "_update", value: function(e3, t2) {
  6322. var n2, o2 = false, s2 = Date.now();
  6323. this._contains(e3) ? (n2 = this._getProfileFromMap(e3), t2.profileCustomField && true === It(n2.profileCustomField, t2.profileCustomField) && (n2.lastUpdatedTime = s2, o2 = true), pt(n2, t2, ["profileCustomField"]) > 0 && (n2.lastUpdatedTime = s2, o2 = true)) : (n2 = new ur(t2), (this._userModule.isMyFriend(e3) || e3 === this._userModule.getMyAccount()) && (n2.lastUpdatedTime = s2, o2 = true, this.accountProfileMap.set(e3, n2)));
  6324. return this._flush(e3 === this._userModule.getMyAccount()), xe.l("".concat(this._n, "._update account:").concat(e3, " isProfileUpdated:").concat(o2)), { isProfileUpdated: o2, latestProfile: n2 };
  6325. } }, { key: "_flush", value: function(e3) {
  6326. var t2 = m(this.accountProfileMap.values()), n2 = this._userModule.getStorageModule();
  6327. xe.d("".concat(this._n, "._flush length:").concat(t2.length, " flushAtOnce:").concat(e3)), n2.setItem(this.TAG, t2, e3);
  6328. } }, { key: "_contains", value: function(e3) {
  6329. return this.accountProfileMap.has(e3);
  6330. } }, { key: "_getProfileFromMap", value: function(e3) {
  6331. return this.accountProfileMap.get(e3);
  6332. } }, { key: "_getCachedProfiles", value: function() {
  6333. var e3 = this._userModule.getStorageModule().getItem(this.TAG);
  6334. return jt(e3) ? [] : e3;
  6335. } }, { key: "onConversationsProfileUpdated", value: function(e3) {
  6336. for (var t2, n2, o2, s2 = [], a2 = 0, r2 = e3.length; a2 < r2; a2++)
  6337. n2 = (t2 = e3[a2]).userID, this._userModule.isMyFriend(n2) && (this._contains(n2) ? (o2 = this._getProfileFromMap(n2), pt(o2, t2) > 0 && s2.push(n2)) : s2.push(t2.userID));
  6338. 0 !== s2.length && (xe.i("".concat(this._n, ".onConversationsProfileUpdated toAccountList:").concat(s2)), this.getUserProfile({ userIDList: s2 }));
  6339. } }, { key: "getNickAndAvatarByUserID", value: function(e3) {
  6340. if (this._contains(e3)) {
  6341. var t2 = this._getProfileFromMap(e3);
  6342. return { nick: t2.nick, avatar: t2.avatar };
  6343. }
  6344. return { nick: "", avatar: "" };
  6345. } }, { key: "reset", value: function() {
  6346. this._flush(true), this.accountProfileMap.clear();
  6347. } }]), e2;
  6348. }(), Wr = a(function e2(t2) {
  6349. o(this, e2), jt || (this.userID = t2.userID || "", this.timeStamp = t2.timeStamp || 0);
  6350. }), Yr = function() {
  6351. function e2(t2) {
  6352. o(this, e2), this._userModule = t2, this._n = "BlacklistHandler", this._blacklistMap = /* @__PURE__ */ new Map(), this.startIndex = 0, this.maxLimited = 100, this.currentSequence = 0;
  6353. }
  6354. return a(e2, [{ key: "getLocalBlacklist", value: function() {
  6355. return m(this._blacklistMap.keys());
  6356. } }, { key: "getBlacklist", value: function() {
  6357. var e3 = this, t2 = "".concat(this._n, ".getBlacklist"), n2 = { fromAccount: this._userModule.getMyAccount(), maxLimited: this.maxLimited, startIndex: 0, lastSequence: this.currentSequence }, o2 = new ka("getBlacklist");
  6358. return this._userModule.request({ protocolName: mo, requestData: n2 }).then(function(n3) {
  6359. var s2 = n3.data, a2 = s2.blackListItem, r2 = s2.currentSequence, i2 = jt(a2) ? 0 : a2.length;
  6360. o2.setNetworkType(e3._userModule.getNetworkType()).setMessage("count:".concat(i2)).end(), xe.i("".concat(t2, " ok")), e3.currentSequence = r2, e3._handleResponse(a2, true), e3._userModule.emitOuterEvent(E.BLACKLIST_UPDATED, m(e3._blacklistMap.keys()));
  6361. }).catch(function(n3) {
  6362. return e3._userModule.probeNetwork().then(function(e4) {
  6363. var t3 = v(e4, 2), s2 = t3[0], a2 = t3[1];
  6364. o2.setError(n3, s2, a2).end();
  6365. }), xe.e("".concat(t2, " failed. error:"), n3), Ja(n3);
  6366. });
  6367. } }, { key: "addBlacklist", value: function(e3) {
  6368. var t2 = this, n2 = new ka("addToBlacklist"), o2 = "".concat(this._n, ".addBlacklist"), s2 = this._userModule.getMyAccount();
  6369. if (1 === e3.userIDList.length && e3.userIDList[0] === s2) {
  6370. var a2 = da.CANNOT_ADD_SELF_TO_BLACKLIST, r2 = this._userModule.getErrorMessage(a2);
  6371. n2.setCode(a2).setMessage(r2).setNetworkType(this._userModule.getNetworkType()).end();
  6372. var i2 = new Wa({ code: a2 });
  6373. return xe.e("".concat(o2, " failed. error:"), i2), Ja(i2);
  6374. }
  6375. return e3.userIDList.includes(s2) && (e3.userIDList = e3.userIDList.filter(function(e4) {
  6376. return e4 !== s2;
  6377. })), e3.fromAccount = this._userModule.getMyAccount(), e3.toAccount = e3.userIDList, this._userModule.request({ protocolName: Mo, requestData: e3 }).then(function(s3) {
  6378. return n2.setNetworkType(t2._userModule.getNetworkType()).setMessage(e3.userIDList.length > 5 ? "userIDList.length:".concat(e3.userIDList.length) : "userIDList:".concat(e3.userIDList)).end(), xe.i("".concat(o2, " ok")), t2._handleResponse(s3.resultItem, true), Ka(m(t2._blacklistMap.keys()));
  6379. }).catch(function(e4) {
  6380. return t2._userModule.probeNetwork().then(function(t3) {
  6381. var o3 = v(t3, 2), s3 = o3[0], a3 = o3[1];
  6382. n2.setError(e4, s3, a3).end();
  6383. }), xe.e("".concat(o2, " failed. error:"), e4), Ja(e4);
  6384. });
  6385. } }, { key: "_handleResponse", value: function(e3, t2) {
  6386. if (!jt(e3))
  6387. for (var n2, o2, s2, a2 = 0, r2 = e3.length; a2 < r2; a2++)
  6388. o2 = e3[a2].to, s2 = e3[a2].resultCode, (at(s2) || 0 === s2) && (t2 ? ((n2 = this._blacklistMap.has(o2) ? this._blacklistMap.get(o2) : new Wr()).userID = o2, !jt(e3[a2].addBlackTimeStamp) && (n2.timeStamp = e3[a2].addBlackTimeStamp), this._blacklistMap.set(o2, n2)) : this._blacklistMap.has(o2) && (n2 = this._blacklistMap.get(o2), this._blacklistMap.delete(o2)));
  6389. xe.l("".concat(this._n, "._handleResponse total:").concat(this._blacklistMap.size, " bAdd:").concat(t2));
  6390. } }, { key: "deleteBlacklist", value: function(e3) {
  6391. var t2 = this, n2 = "".concat(this._n, ".deleteBlacklist"), o2 = new ka("removeFromBlacklist");
  6392. return e3.fromAccount = this._userModule.getMyAccount(), e3.toAccount = e3.userIDList, this._userModule.request({ protocolName: yo, requestData: e3 }).then(function(s2) {
  6393. return o2.setNetworkType(t2._userModule.getNetworkType()).setMessage(e3.userIDList.length > 5 ? "userIDList.length:".concat(e3.userIDList.length) : "userIDList:".concat(e3.userIDList)).end(), xe.i("".concat(n2, " ok")), t2._handleResponse(s2.data.resultItem, false), Ka(m(t2._blacklistMap.keys()));
  6394. }).catch(function(e4) {
  6395. return t2._userModule.probeNetwork().then(function(t3) {
  6396. var n3 = v(t3, 2), s2 = n3[0], a2 = n3[1];
  6397. o2.setError(e4, s2, a2).end();
  6398. }), xe.e("".concat(n2, " failed. error:"), e4), Ja(e4);
  6399. });
  6400. } }, { key: "onAccountDeleted", value: function(e3) {
  6401. for (var t2, n2 = [], o2 = 0, s2 = e3.length; o2 < s2; o2++)
  6402. t2 = e3[o2], this._blacklistMap.has(t2) && (this._blacklistMap.delete(t2), n2.push(t2));
  6403. n2.length > 0 && (xe.l("".concat(this._n, ".onAccountDeleted count:").concat(n2.length, " userIDList:"), n2), this._userModule.emitOuterEvent(E.BLACKLIST_UPDATED, m(this._blacklistMap.keys())));
  6404. } }, { key: "onAccountAdded", value: function(e3) {
  6405. for (var t2, n2 = [], o2 = 0, s2 = e3.length; o2 < s2; o2++)
  6406. t2 = e3[o2], this._blacklistMap.has(t2) || (this._blacklistMap.set(t2, new Wr({ userID: t2 })), n2.push(t2));
  6407. n2.length > 0 && (xe.l("".concat(this._n, ".onAccountAdded count:").concat(n2.length, " userIDList:"), n2), this._userModule.emitOuterEvent(E.BLACKLIST_UPDATED, m(this._blacklistMap.keys())));
  6408. } }, { key: "reset", value: function() {
  6409. this._blacklistMap.clear(), this.startIndex = 0, this.maxLimited = 100, this.currentSequence = 0;
  6410. } }]), e2;
  6411. }(), jr = function(e2) {
  6412. var t2 = String(e2).replace(/[=]+$/, ""), n2 = "";
  6413. if (t2.length % 4 == 1)
  6414. return "";
  6415. for (var o2, s2, a2 = 0, r2 = 0; s2 = t2.charAt(r2++); ~s2 && (o2 = a2 % 4 ? 64 * o2 + s2 : s2, a2++ % 4) ? n2 += String.fromCharCode(255 & o2 >> (-2 * a2 & 6)) : 0)
  6416. s2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(s2);
  6417. try {
  6418. return decodeURIComponent(escape(n2));
  6419. } catch (i2) {
  6420. return "";
  6421. }
  6422. }, zr = function() {
  6423. function e2(t2) {
  6424. o(this, e2), this._userModule = t2, this._n = "UserStatusHandler", this.MAX_QUERY_USER_COUNT = 500, this.MAX_SUBSCRIBE_USER_COUNT = 100, this.MAX_UNSUBSCRIBE_USER_COUNT = 100, this._userModule.getInnerEmitterInstance().on($a, this._onCloudConfigUpdated, this);
  6425. }
  6426. return a(e2, [{ key: "_onCloudConfigUpdated", value: function() {
  6427. var e3 = this._userModule.getCloudConfig("status_query_count"), t2 = this._userModule.getCloudConfig("status_sub_count"), n2 = this._userModule.getCloudConfig("status_unsub_count");
  6428. xe.l("".concat(this._n, "._onCloudConfigUpdated statusQueryCount:").concat(e3, " statusSubscribeCount:").concat(t2) + " statusUnsubscribeCount:".concat(n2)), at(e3) || (this.MAX_QUERY_USER_COUNT = parseInt(e3, 10)), at(e3) || (this.MAX_SUBSCRIBE_USER_COUNT = parseInt(t2, 10)), at(e3) || (this.MAX_UNSUBSCRIBE_USER_COUNT = parseInt(n2, 10));
  6429. } }, { key: "onUserStatusUpdated", value: function(e3) {
  6430. var t2 = e3.dataList, n2 = this._userModule.getMyUserID(), o2 = this._userModule.getModule(qn), s2 = t2.map(function(e4) {
  6431. var t3 = e4.to, s3 = e4.statusType, a2 = e4.customStatus, r2 = jr(a2);
  6432. return t3 === n2 && o2.setCustomStatus(r2), { userID: t3, statusType: s3, customStatus: r2 };
  6433. });
  6434. this._userModule.emitOuterEvent(E.USER_STATUS_UPDATED, s2);
  6435. } }, { key: "setSelfStatus", value: function(e3) {
  6436. var t2 = this, n2 = "".concat(this._n, ".setSelfStatus");
  6437. if (false === this._userModule.filterProfanity("customStatus", e3))
  6438. return Ja({ code: da.PROFANITY_FOUND });
  6439. var o2 = new ka("setSelfStatus"), s2 = e3.customStatus;
  6440. return this._userModule.request({ protocolName: oa, requestData: { customStatus: s2 } }).then(function(e4) {
  6441. return o2.setNetworkType(t2._userModule.getNetworkType()).setMessage("customStatus:".concat(s2)).end(), xe.l("".concat(n2, " ok. customStatus:").concat(s2)), t2._userModule.getModule(qn).setCustomStatus(s2), Ka({ userID: t2._userModule.getMyUserID(), statusType: 1, customStatus: s2 });
  6442. }).catch(function(e4) {
  6443. return t2._userModule.probeNetwork().then(function(t3) {
  6444. var n3 = v(t3, 2), s3 = n3[0], a2 = n3[1];
  6445. o2.setError(e4, s3, a2).end();
  6446. }), xe.e("".concat(n2, " failed. error:"), e4), Ja(e4);
  6447. });
  6448. } }, { key: "getUserStatus", value: function(e3) {
  6449. var t2 = this, n2 = "".concat(this._n, ".getUserStatus"), o2 = e3.userIDList, s2 = void 0 === o2 ? [] : o2, a2 = this._userModule.getMyUserID(), r2 = m(s2), i2 = void 0, u2 = r2.indexOf(a2);
  6450. if (u2 > -1) {
  6451. r2.splice(u2, 1);
  6452. var c2 = this._userModule.getModule(qn).getCustomStatus();
  6453. i2 = { userID: a2, statusType: 1, customStatus: c2 };
  6454. }
  6455. if (0 === r2.length)
  6456. return za({ successUserList: [i2], failureUserList: [] });
  6457. if (!this._userModule.canIUse(B.USER_STATUS))
  6458. return Ja({ code: da.CANNOT_USE_COMMERCIAL_ABILITY });
  6459. r2.length > this.MAX_QUERY_USER_COUNT && (xe.w("".concat(n2, " ").concat(Kt(this.MAX_QUERY_USER_COUNT))), r2 = s2.slice(0, this.MAX_QUERY_USER_COUNT));
  6460. var l2 = new ka("getUserStatus");
  6461. return this._userModule.request({ protocolName: sa, requestData: { userIDList: r2 } }).then(function(e4) {
  6462. var o3 = e4.data, a3 = o3.successUserList, r3 = void 0 === a3 ? [] : a3, u3 = o3.failureUserList, c3 = void 0 === u3 ? [] : u3, p2 = r3.map(function(e5) {
  6463. var t3 = e5.userID, n3 = e5.statusType, o4 = e5.customStatus;
  6464. return { userID: t3, statusType: n3, customStatus: jr(o4) };
  6465. }), d2 = c3.map(function(e5) {
  6466. var t3 = e5.userID, n3 = e5.invalidUserID, o4 = e5.errorCode, s3 = e5.errorInfo;
  6467. return { userID: jt(n3) ? t3 : n3, code: o4, message: s3 };
  6468. });
  6469. at(i2) || p2.unshift(i2);
  6470. var g2 = "userID count:".concat(s2.length, ", success count:").concat(p2.length, ", fail count:").concat(d2.length);
  6471. return l2.setNetworkType(t2._userModule.getNetworkType()).setMessage("".concat(g2)).end(), xe.l("".concat(n2, " ok. ").concat(g2, ".")), Ka({ successUserList: p2, failureUserList: d2 });
  6472. }).catch(function(e4) {
  6473. return t2._userModule.probeNetwork().then(function(t3) {
  6474. var n3 = v(t3, 2), o3 = n3[0], a3 = n3[1];
  6475. l2.setMessage("userID count:".concat(s2.length)).setError(e4, o3, a3).end();
  6476. }), xe.e("".concat(n2, " failed. error:"), e4), Ja(e4);
  6477. });
  6478. } }, { key: "subscribeUserStatus", value: function(e3) {
  6479. var t2 = this;
  6480. if (!this._userModule.canIUse(B.USER_STATUS))
  6481. return Ja({ code: da.CANNOT_USE_COMMERCIAL_ABILITY });
  6482. var n2 = "".concat(this._n, ".subscribeUserStatus"), o2 = e3.userIDList, s2 = void 0 === o2 ? [] : o2, a2 = m(s2);
  6483. a2.length > this.MAX_SUBSCRIBE_USER_COUNT && (xe.w("".concat(n2, " ").concat(Kt(this.MAX_SUBSCRIBE_USER_COUNT))), a2 = s2.slice(0, this.MAX_SUBSCRIBE_USER_COUNT));
  6484. var r2 = new ka("subscribeUserStatus"), i2 = "userID count:".concat(s2.length);
  6485. return xe.l("".concat(n2, " ").concat(i2)), this._userModule.request({ protocolName: aa, requestData: { userIDList: a2 } }).then(function(e4) {
  6486. var o3 = e4.data.failureUserList, s3 = (void 0 === o3 ? [] : o3).map(function(e5) {
  6487. var t3 = e5.userID, n3 = e5.invalidUserID, o4 = e5.errorCode, s4 = e5.errorInfo;
  6488. return { userID: jt(n3) ? t3 : n3, code: o4, message: s4 };
  6489. });
  6490. return r2.setNetworkType(t2._userModule.getNetworkType()).setMessage("".concat(i2, " fail count:").concat(s3.length)).end(), xe.l("".concat(n2, " ok. fail count:").concat(s3.length, ".")), Ka({ failureUserList: s3 });
  6491. }).catch(function(e4) {
  6492. return t2._userModule.probeNetwork().then(function(t3) {
  6493. var n3 = v(t3, 2), o3 = n3[0], s3 = n3[1];
  6494. r2.setMessage("".concat(i2)).setError(e4, o3, s3).end();
  6495. }), xe.e("".concat(n2, " failed. error:"), e4), Ja(e4);
  6496. });
  6497. } }, { key: "unsubscribeUserStatus", value: function(e3) {
  6498. var t2 = this;
  6499. if (!this._userModule.canIUse(B.USER_STATUS))
  6500. return Ja({ code: da.CANNOT_USE_COMMERCIAL_ABILITY });
  6501. var n2 = "".concat(this._n, ".unsubscribeUserStatus"), o2 = (e3 || {}).userIDList, s2 = void 0 === o2 ? [] : o2, a2 = m(s2);
  6502. s2.length > this.MAX_UNSUBSCRIBE_USER_COUNT && (xe.w("".concat(n2, " ").concat(Kt(this.MAX_UNSUBSCRIBE_USER_COUNT))), a2 = s2.slice(0, this.MAX_UNSUBSCRIBE_USER_COUNT));
  6503. var r2 = new ka("unsubscribeUserStatus"), i2 = "userID count:".concat(s2.length);
  6504. xe.l("".concat(n2, " ").concat(i2));
  6505. var u2 = { userIDList: a2 };
  6506. return 0 === a2.length && (u2.userIDList = void 0, u2.unsubscribeAll = 1), this._userModule.request({ protocolName: ra, requestData: u2 }).then(function(e4) {
  6507. var o3 = e4.data.failureUserList, s3 = (void 0 === o3 ? [] : o3).map(function(e5) {
  6508. var t3 = e5.userID, n3 = e5.invalidUserID, o4 = e5.errorCode, s4 = e5.errorInfo;
  6509. return { userID: jt(n3) ? t3 : n3, code: o4, message: s4 };
  6510. });
  6511. return r2.setNetworkType(t2._userModule.getNetworkType()).setMessage("".concat(i2, " fail count:").concat(s3.length)).end(), xe.l("".concat(n2, " ok. fail count:").concat(s3.length, ".")), Ka({ failureUserList: s3 });
  6512. }).catch(function(e4) {
  6513. return t2._userModule.probeNetwork().then(function(t3) {
  6514. var n3 = v(t3, 2), o3 = n3[0], s3 = n3[1];
  6515. r2.setMessage("".concat(i2)).setError(e4, o3, s3).end();
  6516. }), xe.e("".concat(n2, " failed. error:"), e4), Ja(e4);
  6517. });
  6518. } }, { key: "reset", value: function() {
  6519. this.MAX_QUERY_USER_COUNT = 500, this.MAX_SUBSCRIBE_USER_COUNT = 100, this.MAX_UNSUBSCRIBE_USER_COUNT = 100;
  6520. } }]), e2;
  6521. }(), Jr = function(e2) {
  6522. i(n2, e2);
  6523. var t2 = f(n2);
  6524. function n2(e3) {
  6525. var s2;
  6526. return o(this, n2), (s2 = t2.call(this, e3))._n = "UserModule", s2._profileHandler = new Kr(_(s2)), s2._blacklistHandler = new Yr(_(s2)), s2._userStatusHandler = new zr(_(s2)), s2.getInnerEmitterInstance().on(Za, s2.onContextUpdated, _(s2)), s2;
  6527. }
  6528. return a(n2, [{ key: "onContextUpdated", value: function(e3) {
  6529. this._profileHandler.getMyProfile(), this._blacklistHandler.getBlacklist();
  6530. } }, { key: "onProfileModified", value: function(e3) {
  6531. this._profileHandler.onProfileModified(e3);
  6532. } }, { key: "onRelationChainModified", value: function(e3) {
  6533. var t3 = e3.dataList;
  6534. if (!jt(t3)) {
  6535. var n3 = [];
  6536. t3.forEach(function(e4) {
  6537. e4.blackListDelAccount && n3.push.apply(n3, m(e4.blackListDelAccount));
  6538. }), n3.length > 0 && this._blacklistHandler.onAccountDeleted(n3);
  6539. var o2 = [];
  6540. t3.forEach(function(e4) {
  6541. e4.blackListAddAccount && o2.push.apply(o2, m(e4.blackListAddAccount));
  6542. }), o2.length > 0 && this._blacklistHandler.onAccountAdded(o2);
  6543. }
  6544. } }, { key: "onConversationsProfileUpdated", value: function(e3) {
  6545. this._profileHandler.onConversationsProfileUpdated(e3);
  6546. } }, { key: "getMyAccount", value: function() {
  6547. return this.getMyUserID();
  6548. } }, { key: "getMyProfile", value: function() {
  6549. return this._profileHandler.getMyProfile();
  6550. } }, { key: "getStorageModule", value: function() {
  6551. return this.getModule(xn);
  6552. } }, { key: "filterProfanity", value: function(e3, t3) {
  6553. var n3 = this.getModule(no);
  6554. if (!n3)
  6555. return true;
  6556. var o2 = n3.filterText(t3[e3], j), s2 = o2.isAllowedToSend, a2 = o2.modifiedText;
  6557. return true === s2 && (t3[e3] = a2, true);
  6558. } }, { key: "isMyFriend", value: function(e3) {
  6559. var t3 = this.getModule(Pn);
  6560. return !!t3 && t3.isMyFriend(e3);
  6561. } }, { key: "getUserProfile", value: function(e3) {
  6562. return this._profileHandler.getUserProfile(e3);
  6563. } }, { key: "updateMyProfile", value: function(e3) {
  6564. return this._profileHandler.updateMyProfile(e3);
  6565. } }, { key: "getNickAndAvatarByUserID", value: function(e3) {
  6566. return this._profileHandler.getNickAndAvatarByUserID(e3);
  6567. } }, { key: "getLocalBlacklist", value: function() {
  6568. var e3 = this._blacklistHandler.getLocalBlacklist();
  6569. return za(e3);
  6570. } }, { key: "addBlacklist", value: function(e3) {
  6571. return this._blacklistHandler.addBlacklist(e3);
  6572. } }, { key: "deleteBlacklist", value: function(e3) {
  6573. return this._blacklistHandler.deleteBlacklist(e3);
  6574. } }, { key: "onUserStatusUpdated", value: function(e3) {
  6575. this._userStatusHandler.onUserStatusUpdated(e3);
  6576. } }, { key: "setSelfStatus", value: function(e3) {
  6577. return this._userStatusHandler.setSelfStatus(e3);
  6578. } }, { key: "getUserStatus", value: function(e3) {
  6579. return this._userStatusHandler.getUserStatus(e3);
  6580. } }, { key: "subscribeUserStatus", value: function(e3) {
  6581. return this._userStatusHandler.subscribeUserStatus(e3);
  6582. } }, { key: "unsubscribeUserStatus", value: function(e3) {
  6583. return this._userStatusHandler.unsubscribeUserStatus(e3);
  6584. } }, { key: "reset", value: function() {
  6585. xe.l("".concat(this._n, ".reset")), this._profileHandler.reset(), this._blacklistHandler.reset(), this._userStatusHandler.reset();
  6586. } }]), n2;
  6587. }(ro), Xr = function() {
  6588. function e2(t2, n2) {
  6589. o(this, e2), this._m = t2, this._isLoggedIn = false, this._SDKAppID = n2.SDKAppID, this._userID = n2.userID || "", this._userSig = n2.userSig || "", this._version = "2.27.3", this._a2Key = "", this._tinyID = "", this._customStatus = "", this._contentType = "json", this._unlimitedAVChatRoom = n2.unlimitedAVChatRoom, this._scene = n2.scene || "", this._oversea = n2.oversea, this._instanceID = n2.instanceID, this._statusInstanceID = 0, this._isDevMode = n2.devMode, this._proxyServer = n2.proxyServer, this._fileUploadProxy = n2.fileUploadProxy, this._fileDownloadProxy = n2.fileDownloadProxy;
  6590. }
  6591. return a(e2, [{ key: "isLoggedIn", value: function() {
  6592. return this._isLoggedIn;
  6593. } }, { key: "isOversea", value: function() {
  6594. return this._oversea;
  6595. } }, { key: "isPrivateNetWork", value: function() {
  6596. return this._proxyServer;
  6597. } }, { key: "isDevMode", value: function() {
  6598. return this._isDevMode;
  6599. } }, { key: "isSingaporeSite", value: function() {
  6600. return this._SDKAppID >= 2e7 && this._SDKAppID < 3e7 || this._SDKAppID >= 172e7 && this._SDKAppID < 173e7;
  6601. } }, { key: "isKoreaSite", value: function() {
  6602. return this._SDKAppID >= 3e7 && this._SDKAppID < 4e7 || this._SDKAppID >= 173e7 && this._SDKAppID < 174e7;
  6603. } }, { key: "isGermanySite", value: function() {
  6604. return this._SDKAppID >= 4e7 && this._SDKAppID < 5e7 || this._SDKAppID >= 174e7 && this._SDKAppID < 175e7;
  6605. } }, { key: "isIndiaSite", value: function() {
  6606. return this._SDKAppID >= 5e7 && this._SDKAppID < 6e7 || this._SDKAppID >= 175e7 && this._SDKAppID < 176e7;
  6607. } }, { key: "isJapanSite", value: function() {
  6608. return this._SDKAppID >= 6e7 && this._SDKAppID < 7e7 || this._SDKAppID >= 176e7 && this._SDKAppID < 177e7;
  6609. } }, { key: "isUSASite", value: function() {
  6610. return this._SDKAppID >= 7e7 && this._SDKAppID < 8e7 || this._SDKAppID >= 177e7 && this._SDKAppID < 178e7;
  6611. } }, { key: "isIntl", value: function() {
  6612. return 0 === (e3 = this._SDKAppID) || e3 >= 2e7 && e3 < 8e7 || e3 >= 172e7 && e3 < 178e7;
  6613. var e3;
  6614. } }, { key: "isUnlimitedAVChatRoom", value: function() {
  6615. return this._unlimitedAVChatRoom;
  6616. } }, { key: "setUserID", value: function(e3) {
  6617. this._userID = e3;
  6618. } }, { key: "getUserID", value: function() {
  6619. return this._userID;
  6620. } }, { key: "setUserSig", value: function(e3) {
  6621. this._userSig = e3;
  6622. } }, { key: "getUserSig", value: function() {
  6623. return this._userSig;
  6624. } }, { key: "getSDKAppID", value: function() {
  6625. return this._SDKAppID;
  6626. } }, { key: "setTinyID", value: function(e3) {
  6627. this._tinyID = e3, this._isLoggedIn = true;
  6628. } }, { key: "getTinyID", value: function() {
  6629. return this._tinyID;
  6630. } }, { key: "setCustomStatus", value: function(e3) {
  6631. this._customStatus = e3;
  6632. } }, { key: "getCustomStatus", value: function() {
  6633. return this._customStatus;
  6634. } }, { key: "getScene", value: function() {
  6635. return Le ? window.tencent_cloud_im_csig_flutter_for_web_25F_cy : this._isTUIKit() ? "tuikit" : this._scene;
  6636. } }, { key: "getInstanceID", value: function() {
  6637. return this._instanceID;
  6638. } }, { key: "getStatusInstanceID", value: function() {
  6639. return this._statusInstanceID;
  6640. } }, { key: "setStatusInstanceID", value: function(e3) {
  6641. this._statusInstanceID = e3;
  6642. } }, { key: "getVersion", value: function() {
  6643. return this._version;
  6644. } }, { key: "getA2Key", value: function() {
  6645. return this._a2Key;
  6646. } }, { key: "setA2Key", value: function(e3) {
  6647. this._a2Key = e3;
  6648. } }, { key: "getContentType", value: function() {
  6649. return this._contentType;
  6650. } }, { key: "getProxyServer", value: function() {
  6651. return this._proxyServer;
  6652. } }, { key: "getFileUploadProxy", value: function() {
  6653. return this._fileUploadProxy;
  6654. } }, { key: "getFileDownloadProxy", value: function() {
  6655. return this._fileDownloadProxy;
  6656. } }, { key: "_isTUIKit", value: function() {
  6657. var e3 = false, t2 = false, n2 = false, o2 = false, s2 = [];
  6658. se && (s2 = Object.keys(re)), ae && (s2 = oe ? Object.keys(uni) : Object.keys(window));
  6659. for (var a2 = 0, r2 = s2.length; a2 < r2; a2++)
  6660. if (s2[a2].toLowerCase().includes("uikit")) {
  6661. e3 = true;
  6662. break;
  6663. }
  6664. if (s2 = null, se && !it(re.createGamePortal) && it(getApp) && !at(getApp())) {
  6665. var i2 = getApp().globalData;
  6666. ot(i2) && true === i2.isTUIKit && (t2 = true);
  6667. }
  6668. true === this._m.getModule(xn).getStorageSync("TIM_".concat(this._SDKAppID, "_isTUIKit")) && (n2 = true);
  6669. var u2 = null;
  6670. if (X && !Z && "undefined" == typeof uni && __wxConfig && (u2 = __wxConfig.pages), Q && "undefined" == typeof uni && __qqConfig && (u2 = __qqConfig.pages), st(u2) && u2.length > 0) {
  6671. for (var c2 = 0, l2 = u2.length; c2 < l2; c2++)
  6672. if (u2[c2].toLowerCase().includes("tui")) {
  6673. o2 = true;
  6674. break;
  6675. }
  6676. u2 = null;
  6677. }
  6678. return e3 || t2 || n2 || o2;
  6679. } }, { key: "reset", value: function() {
  6680. this._isLoggedIn = false, this._userSig = "", this._a2Key = "", this._tinyID = "", this._customStatus = "", this._statusInstanceID = 0;
  6681. } }]), e2;
  6682. }(), Qr = function(e2) {
  6683. i(n2, e2);
  6684. var t2 = f(n2);
  6685. function n2(e3) {
  6686. var s2;
  6687. return o(this, n2), (s2 = t2.call(this, e3))._n = "SignModule", s2._helloInterval = 120, s2._lastLoginTs = 0, s2._lastWsHelloTs = 0, s2._isWebUniapp = 0, tr.mixin(_(s2)), s2;
  6688. }
  6689. return a(n2, [{ key: "onCheckTimer", value: function(e3) {
  6690. this.isLoggedIn() && e3 % this._helloInterval == 0 && this._hello();
  6691. } }, { key: "login", value: function(e3) {
  6692. var t3 = "";
  6693. if (this.isLoggedIn()) {
  6694. var n3 = this.getMyUserID();
  6695. return (t3 = this.getErrorMessage("RepeatLogin", n3)) && xe.w(t3), za({ actionStatus: "OK", errorCode: 0, errorInfo: t3, repeatLogin: true });
  6696. }
  6697. if (Date.now() - this._lastLoginTs <= 15e3)
  6698. return this.outputWarning("LoggingIn", e3.userID), Ja({ code: da.REPEAT_LOGIN });
  6699. xe.l("".concat(this._n, ".login userID:").concat(e3.userID));
  6700. var o2 = this._checkLoginInfo(e3);
  6701. if (0 !== o2.code)
  6702. return Ja(o2);
  6703. var s2 = this.getModule(qn), a2 = e3.userID, r2 = e3.userSig;
  6704. return s2.setUserID(a2), s2.setUserSig(r2), this.getModule(jn).updateProtocolConfig(), this._login();
  6705. } }, { key: "_login", value: function() {
  6706. var e3 = this, t3 = this.getModule(qn), n3 = t3.getScene(), o2 = 0, s2 = new ka("login");
  6707. s2.setMessage("".concat(n3)).setMoreMessage("identifier:".concat(this.getMyUserID())), oe ? "tuikit" === n3 ? s2.setUIPlatform(4) : s2.setUIPlatform(3) : se ? "tuikit" === n3 ? s2.setUIPlatform(12) : s2.setUIPlatform(11) : ae && (Le ? "flutter_web_uikit" === n3 ? s2.setUIPlatform(21) : s2.setUIPlatform(20) : this._isReactUIKit() ? ke ? s2.setUIPlatform(25) : s2.setUIPlatform(24) : ke ? "tuikit" === n3 ? s2.setUIPlatform(17) : s2.setUIPlatform(16) : "tuikit" === n3 ? s2.setUIPlatform(14) : s2.setUIPlatform(13));
  6708. var a2 = this.getModule(to);
  6709. if (a2.canIUseOfflinePush()) {
  6710. this._isWebUniapp = a2.getUniAppPlatform();
  6711. var r2 = this._getStatusInstanceID();
  6712. t3.setStatusInstanceID(r2), this.getModule(jn).updateProtocolConfig(), o2 = a2.getDeviceBrand();
  6713. }
  6714. var i2 = "".concat(this._n, "._login");
  6715. return this._lastLoginTs = Date.now(), this.request({ protocolName: io, requestData: { deviceBrand: o2, isWebUniapp: this._isWebUniapp } }).then(function(o3) {
  6716. e3._lastLoginTs = 0;
  6717. var a3 = Date.now(), r3 = null, u2 = o3.data, c2 = u2.a2Key, l2 = u2.tinyID, p2 = u2.helloInterval, d2 = u2.instanceID, g2 = u2.timeStamp, _2 = u2.customStatus, h2 = void 0 === _2 ? "" : _2;
  6718. xe.l("".concat(i2, " ok. scene:").concat(n3, " helloInterval:").concat(p2, " instanceID:").concat(d2, " timeStamp:").concat(g2));
  6719. var f2 = 1e3 * g2, v2 = a3 - s2.getStartTs(), m2 = f2 + parseInt(v2 / 2) - a3, M2 = s2.getStartTs() + m2;
  6720. if (s2.start(M2), function(e4, t4) {
  6721. Ge = t4;
  6722. var n4 = /* @__PURE__ */ new Date();
  6723. n4.setTime(e4), xe.i("baseTime from server:".concat(n4, " offset:").concat(Ge));
  6724. }(f2, m2), !l2)
  6725. throw r3 = new Wa({ code: da.NO_TINYID }), s2.setError(r3, true, e3.getNetworkType()).end(), r3;
  6726. if (!c2)
  6727. throw r3 = new Wa({ code: da.NO_A2KEY }), s2.setError(r3, true, e3.getNetworkType()).end(), r3;
  6728. var y2 = jr(h2);
  6729. s2.setNetworkType(e3.getNetworkType()).setMoreMessage("helloInterval:".concat(p2, " instanceID:").concat(d2, " offset:").concat(m2, " customStatus:").concat(y2)).end(), t3.setA2Key(c2), t3.setTinyID(l2), t3.setStatusInstanceID(d2), t3.setCustomStatus(y2), e3.getModule(jn).updateProtocolConfig(), e3.emitInnerEvent(Za), e3._helloInterval = p2, e3.triggerReady();
  6730. var I2 = e3.getModule(to);
  6731. return I2.canIUseOfflinePush() && (uni.setStorageSync("timUniAppInstanceID", d2), I2.init()), e3._fetchCloudControlConfig(), e3.getModule(no).init(), o3;
  6732. }).catch(function(t4) {
  6733. return e3.probeNetwork().then(function(e4) {
  6734. var n4 = v(e4, 2), o3 = n4[0], a3 = n4[1];
  6735. s2.setError(t4, o3, a3).end(true);
  6736. }), e3._m.setNotReadyReason(da.LOGIN_FAILED), xe.e("".concat(i2, " failed. error:"), t4), e3._lastLoginTs = 0, e3._m.onLoginFailed(), Ja(t4);
  6737. });
  6738. } }, { key: "logout", value: function() {
  6739. var e3 = this, t3 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0;
  6740. if (!this.isLoggedIn())
  6741. return Ja({ code: da.USER_NOT_LOGGED_IN });
  6742. var n3 = new ka("logout");
  6743. n3.setNetworkType(this.getNetworkType()).setMessage("identifier:".concat(this.getMyUserID())).end(true);
  6744. var o2 = "".concat(this._n, ".logout");
  6745. return xe.i("".concat(o2, " type:").concat(t3)), 0 === t3 && this._m.setNotReadyReason(da.LOGGED_OUT), this.request({ protocolName: uo, requestData: { type: t3 } }).then(function() {
  6746. return e3.resetReady(), za({});
  6747. }).catch(function(t4) {
  6748. return xe.e("".concat(o2, " error:"), t4), e3.resetReady(), za({});
  6749. });
  6750. } }, { key: "_fetchCloudControlConfig", value: function() {
  6751. this.getModule(Xn).fetchConfig();
  6752. } }, { key: "_getStatusInstanceID", value: function() {
  6753. return uni.getStorageSync("timUniAppInstanceID");
  6754. } }, { key: "_hello", value: function() {
  6755. var e3 = this;
  6756. this._lastWsHelloTs = Date.now(), this.request({ protocolName: co, requestData: { isWebUniapp: this._isWebUniapp } }).catch(function(t3) {
  6757. xe.w("".concat(e3._n, "._hello error:"), t3);
  6758. });
  6759. } }, { key: "getLastWsHelloTs", value: function() {
  6760. return this._lastWsHelloTs;
  6761. } }, { key: "_checkLoginInfo", value: function(e3) {
  6762. var t3 = 0;
  6763. return jt(this.getModule(qn).getSDKAppID()) ? t3 = da.NO_SDKAPPID : jt(e3.userID) ? t3 = da.NO_IDENTIFIER : jt(e3.userSig) && (t3 = da.NO_USERSIG), { code: t3 };
  6764. } }, { key: "_isReactUIKit", value: function() {
  6765. return ae && void 0 !== window.tencent_cloud_im_csig_react_uikit_23F_xa;
  6766. } }, { key: "onMultipleAccountKickedOut", value: function(e3) {
  6767. var t3 = this;
  6768. new ka("kickedOut").setNetworkType(this.getNetworkType()).setMessage("type:".concat(S.KICKED_OUT_MULT_ACCOUNT, " newInstanceInfo:").concat(JSON.stringify(e3))).end(true), xe.w("".concat(this._n, ".onMultipleAccountKickedOut userID:").concat(this.getMyUserID(), " newInstanceInfo:"), e3), this.logout(1).then(function() {
  6769. t3.emitOuterEvent(E.KICKED_OUT, { type: S.KICKED_OUT_MULT_ACCOUNT }), t3._m.setNotReadyReason(da.KICKED_OUT_MULT_ACCOUNT), t3._m.reset();
  6770. });
  6771. } }, { key: "onMultipleDeviceKickedOut", value: function(e3) {
  6772. var t3 = this;
  6773. new ka("kickedOut").setNetworkType(this.getNetworkType()).setMessage("type:".concat(S.KICKED_OUT_MULT_DEVICE, " newInstanceInfo:").concat(JSON.stringify(e3))).end(true), xe.w("".concat(this._n, ".onMultipleDeviceKickedOut userID:").concat(this.getMyUserID(), " newInstanceInfo:"), e3), this.logout(1).then(function() {
  6774. t3.emitOuterEvent(E.KICKED_OUT, { type: S.KICKED_OUT_MULT_DEVICE }), t3._m.setNotReadyReason(da.KICKED_OUT_MULT_DEVICE), t3._m.reset();
  6775. });
  6776. } }, { key: "onUserSigExpired", value: function() {
  6777. new ka("kickedOut").setNetworkType(this.getNetworkType()).setMessage(S.KICKED_OUT_USERSIG_EXPIRED).end(true), xe.w("".concat(this._n, ".onUserSigExpired: userSig expired")), 0 !== this.getModule(qn).getStatusInstanceID() && (this.emitOuterEvent(E.KICKED_OUT, { type: S.KICKED_OUT_USERSIG_EXPIRED }), this._m.setNotReadyReason(da.KICKED_OUT_USERSIG_EXPIRED), this._m.reset());
  6778. } }, { key: "onRestApiKickedOut", value: function(e3) {
  6779. (new ka("kickedOut").setNetworkType(this.getNetworkType()).setMessage("type:".concat(S.KICKED_OUT_REST_API, " newInstanceInfo:").concat(JSON.stringify(e3))).end(true), xe.w("".concat(this._n, ".onRestApiKickedOut userID:").concat(this.getMyUserID(), " newInstanceInfo:"), e3), 0 !== this.getModule(qn).getStatusInstanceID()) && (this.emitOuterEvent(E.KICKED_OUT, { type: S.KICKED_OUT_REST_API }), this._m.setNotReadyReason(da.KICKED_OUT_REST_API), this._m.reset(), this.getModule(zn).onRestApiKickedOut());
  6780. } }, { key: "reset", value: function() {
  6781. xe.l("".concat(this._n, ".reset")), this.resetReady(), this._helloInterval = 120, this._lastLoginTs = 0, this._lastWsHelloTs = 0, this._isWebUniapp = 0;
  6782. } }]), n2;
  6783. }(ro);
  6784. function Zr() {
  6785. return null;
  6786. }
  6787. var $r = function() {
  6788. function e2(t2) {
  6789. o(this, e2), this._m = t2, this._n = "StorageModule", this._storageQueue = /* @__PURE__ */ new Map(), this._errorTolerantHandle();
  6790. }
  6791. return a(e2, [{ key: "_errorTolerantHandle", value: function() {
  6792. se || !at(window) && this._canIUseCookies() || (this.getItem = Zr, this.setItem = Zr, this.removeItem = Zr, this.clear = Zr);
  6793. } }, { key: "onCheckTimer", value: function(e3) {
  6794. if (e3 % 20 == 0) {
  6795. if (0 === this._storageQueue.size)
  6796. return;
  6797. this._doFlush();
  6798. }
  6799. } }, { key: "_doFlush", value: function() {
  6800. try {
  6801. var e3, t2 = D(this._storageQueue);
  6802. try {
  6803. for (t2.s(); !(e3 = t2.n()).done; ) {
  6804. var n2 = v(e3.value, 2), o2 = n2[0], s2 = n2[1];
  6805. this._setStorageSync(this._getKey(o2), s2);
  6806. }
  6807. } catch (a2) {
  6808. t2.e(a2);
  6809. } finally {
  6810. t2.f();
  6811. }
  6812. this._storageQueue.clear();
  6813. } catch (r2) {
  6814. xe.w("".concat(this._n, "._doFlush error:"), r2);
  6815. }
  6816. } }, { key: "_getPrefix", value: function() {
  6817. var e3 = this._m.getModule(qn);
  6818. return "TIM_".concat(e3.getSDKAppID(), "_").concat(e3.getUserID(), "_");
  6819. } }, { key: "_getKey", value: function(e3) {
  6820. return "".concat(this._getPrefix()).concat(e3);
  6821. } }, { key: "getItem", value: function(e3) {
  6822. var t2 = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];
  6823. try {
  6824. var n2 = t2 ? this._getKey(e3) : e3;
  6825. return this.getStorageSync(n2);
  6826. } catch (o2) {
  6827. return xe.w("".concat(this._n, ".getItem error:"), o2), {};
  6828. }
  6829. } }, { key: "setItem", value: function(e3, t2) {
  6830. var n2 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], o2 = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3];
  6831. if (n2) {
  6832. var s2 = o2 ? this._getKey(e3) : e3;
  6833. this._setStorageSync(s2, t2);
  6834. } else
  6835. this._storageQueue.set(e3, t2);
  6836. } }, { key: "clear", value: function() {
  6837. try {
  6838. se ? re.clearStorageSync() : this._canIUseCookies() && localStorage.clear();
  6839. } catch (e3) {
  6840. xe.w("".concat(this._n, ".clear error:"), e3);
  6841. }
  6842. } }, { key: "removeItem", value: function(e3) {
  6843. var t2 = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];
  6844. try {
  6845. var n2 = t2 ? this._getKey(e3) : e3;
  6846. this._removeStorageSync(n2);
  6847. } catch (o2) {
  6848. xe.w("".concat(this._n, ".removeItem error:"), o2);
  6849. }
  6850. } }, { key: "getSize", value: function(e3) {
  6851. var t2 = this, n2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "b";
  6852. try {
  6853. var o2 = { size: 0, limitSize: 5242880, unit: n2 };
  6854. if (Object.defineProperty(o2, "leftSize", { enumerable: true, get: function() {
  6855. return o2.limitSize - o2.size;
  6856. } }), se && (o2.limitSize = 1024 * re.getStorageInfoSync().limitSize), e3)
  6857. o2.size = JSON.stringify(this.getItem(e3)).length + this._getKey(e3).length;
  6858. else if (se) {
  6859. var s2 = re.getStorageInfoSync(), a2 = s2.keys;
  6860. a2.forEach(function(e4) {
  6861. o2.size += JSON.stringify(t2.getStorageSync(e4)).length + t2._getKey(e4).length;
  6862. });
  6863. } else if (this._canIUseCookies())
  6864. for (var r2 in localStorage)
  6865. localStorage.hasOwnProperty(r2) && (o2.size += localStorage.getItem(r2).length + r2.length);
  6866. return this._convertUnit(o2);
  6867. } catch (i2) {
  6868. xe.w("".concat(this._n, " error:"), i2);
  6869. }
  6870. } }, { key: "_convertUnit", value: function(e3) {
  6871. var t2 = {}, n2 = e3.unit;
  6872. for (var o2 in t2.unit = n2, e3)
  6873. "number" == typeof e3[o2] && ("kb" === n2.toLowerCase() ? t2[o2] = Math.round(e3[o2] / 1024) : "mb" === n2.toLowerCase() ? t2[o2] = Math.round(e3[o2] / 1024 / 1024) : t2[o2] = e3[o2]);
  6874. return t2;
  6875. } }, { key: "_setStorageSync", value: function(e3, t2) {
  6876. se ? ee ? my.setStorageSync({ key: e3, data: t2 }) : re.setStorageSync(e3, t2) : this._canIUseCookies() && localStorage.setItem(e3, JSON.stringify(t2));
  6877. } }, { key: "getStorageSync", value: function(e3) {
  6878. return se ? ee ? my.getStorageSync({ key: e3 }).data : re.getStorageSync(e3) : this._canIUseCookies() ? JSON.parse(localStorage.getItem(e3)) : {};
  6879. } }, { key: "_removeStorageSync", value: function(e3) {
  6880. se ? ee ? my.removeStorageSync({ key: e3 }) : re.removeStorageSync(e3) : this._canIUseCookies() && localStorage.removeItem(e3);
  6881. } }, { key: "_canIUseCookies", value: function() {
  6882. return navigator && navigator.cookieEnabled && localStorage;
  6883. } }, { key: "reset", value: function() {
  6884. xe.l("".concat(this._n, ".reset")), this._doFlush();
  6885. } }]), e2;
  6886. }(), ei = function() {
  6887. function e2(t2) {
  6888. o(this, e2), this._n = "SSOLogBody", this._report = [];
  6889. }
  6890. return a(e2, [{ key: "pushIn", value: function(e3) {
  6891. xe.d("".concat(this._n, ".pushIn"), this._report.length, e3), this._report.push(e3);
  6892. } }, { key: "backfill", value: function(e3) {
  6893. var t2;
  6894. st(e3) && 0 !== e3.length && (xe.d("".concat(this._n, ".backfill"), this._report.length, e3.length), (t2 = this._report).unshift.apply(t2, m(e3)));
  6895. } }, { key: "getLogsNumInMemory", value: function() {
  6896. return this._report.length;
  6897. } }, { key: "isEmpty", value: function() {
  6898. return 0 === this._report.length;
  6899. } }, { key: "_reset", value: function() {
  6900. this._report.length = 0, this._report = [];
  6901. } }, { key: "getLogsInMemory", value: function() {
  6902. var e3 = this._report.slice();
  6903. return this._reset(), e3;
  6904. } }]), e2;
  6905. }(), ti = function(e2) {
  6906. var t2 = e2.getModule(qn);
  6907. return { SDKType: 10, SDKAppID: t2.getSDKAppID(), SDKVersion: t2.getVersion(), tinyID: Number(t2.getTinyID()), userID: t2.getUserID(), platform: e2.getPlatform(), instanceID: t2.getInstanceID(), traceID: Ue() };
  6908. }, ni = function(e2) {
  6909. i(s2, e2);
  6910. var n2 = f(s2);
  6911. function s2(e3) {
  6912. var t2;
  6913. o(this, s2), (t2 = n2.call(this, e3))._n = "EventStatModule", t2.TAG = "im-ssolog-event", t2._reportBody = new ei(), t2.MIN_THRESHOLD = 20, t2.MAX_THRESHOLD = 100, t2.WAITING_TIME = 6e4, t2.REPORT_LEVEL = [4, 5, 6], t2.REPORT_SDKAPPID_BLACKLIST = [], t2.REPORT_TINYID_WHITELIST = [], t2._lastReportTime = Date.now();
  6914. var a2 = t2.getInnerEmitterInstance();
  6915. return a2.on(Za, t2._onLoginSuccess, _(t2)), a2.on($a, t2._onCloudConfigUpdated, _(t2)), t2;
  6916. }
  6917. return a(s2, [{ key: "reportAtOnce", value: function() {
  6918. xe.d("".concat(this._n, ".reportAtOnce")), this._report();
  6919. } }, { key: "_onLoginSuccess", value: function() {
  6920. var e3 = this, t2 = this.getModule(xn), n3 = t2.getItem(this.TAG, false);
  6921. !jt(n3) && it(n3.forEach) && (xe.l("".concat(this._n, "._onLoginSuccess get ssolog in storage, count:").concat(n3.length)), n3.forEach(function(t3) {
  6922. e3._reportBody.pushIn(t3);
  6923. }), t2.removeItem(this.TAG, false));
  6924. } }, { key: "_onCloudConfigUpdated", value: function() {
  6925. var e3 = this.getCloudConfig("evt_rpt_threshold"), t2 = this.getCloudConfig("evt_rpt_waiting"), n3 = this.getCloudConfig("evt_rpt_level"), o2 = this.getCloudConfig("evt_rpt_sdkappid_bl"), s3 = this.getCloudConfig("evt_rpt_tinyid_wl");
  6926. at(e3) || (this.MIN_THRESHOLD = Number(e3)), at(t2) || (this.WAITING_TIME = Number(t2)), at(n3) || (this.REPORT_LEVEL = n3.split(",").map(function(e4) {
  6927. return Number(e4);
  6928. })), at(o2) || (this.REPORT_SDKAPPID_BLACKLIST = o2.split(",").map(function(e4) {
  6929. return Number(e4);
  6930. })), at(s3) || (this.REPORT_TINYID_WHITELIST = s3.split(","));
  6931. } }, { key: "pushIn", value: function(e3) {
  6932. e3 instanceof ka && (e3.updateTimeStamp(), this._reportBody.pushIn(e3), this._reportBody.getLogsNumInMemory() >= this.MIN_THRESHOLD && this._report());
  6933. } }, { key: "onCheckTimer", value: function() {
  6934. Date.now() < this._lastReportTime + this.WAITING_TIME || this._reportBody.isEmpty() || this._report();
  6935. } }, { key: "_filterLogs", value: function(e3) {
  6936. var t2 = this, n3 = this.getModule(qn), o2 = n3.getSDKAppID(), s3 = n3.getTinyID();
  6937. return wt(this.REPORT_SDKAPPID_BLACKLIST, o2) && !Ft(this.REPORT_TINYID_WHITELIST, s3) ? [] : e3.filter(function(e4) {
  6938. return t2.REPORT_LEVEL.includes(e4.level);
  6939. });
  6940. } }, { key: "_report", value: function() {
  6941. var e3 = this;
  6942. if (!this._reportBody.isEmpty()) {
  6943. var n3 = this._reportBody.getLogsInMemory(), o2 = this._filterLogs(n3);
  6944. if (0 !== o2.length) {
  6945. var s3 = { header: ti(this), event: o2 };
  6946. this.request({ protocolName: xs, requestData: t({}, s3) }).then(function() {
  6947. e3._lastReportTime = Date.now();
  6948. }).catch(function(t2) {
  6949. xe.w("".concat(e3._n, ".report failed. networkType:").concat(e3.getNetworkType(), " error:"), t2), e3._reportBody.backfill(n3), e3._reportBody.getLogsNumInMemory() > e3.MAX_THRESHOLD && e3._flushAtOnce();
  6950. });
  6951. } else
  6952. this._lastReportTime = Date.now();
  6953. }
  6954. } }, { key: "_flushAtOnce", value: function() {
  6955. var e3 = this.getModule(xn), t2 = e3.getItem(this.TAG, false), n3 = this._reportBody.getLogsInMemory(), o2 = "".concat(this._n, "._flushAtOnce");
  6956. if (jt(t2))
  6957. xe.l("".concat(o2, " count:").concat(n3.length)), e3.setItem(this.TAG, n3, true, false);
  6958. else {
  6959. var s3 = n3.concat(t2);
  6960. s3.length > this.MAX_THRESHOLD && (s3 = s3.slice(0, this.MAX_THRESHOLD)), xe.l("".concat(o2, " count:").concat(s3.length)), e3.setItem(this.TAG, s3, true, false);
  6961. }
  6962. } }, { key: "reset", value: function() {
  6963. xe.l("".concat(this._n, ".reset")), this._lastReportTime = 0, this._report(), this.REPORT_SDKAPPID_BLACKLIST = [], this.REPORT_TINYID_WHITELIST = [];
  6964. } }]), s2;
  6965. }(ro), oi = "none", si = "online", ai = [da.OVER_FREQUENCY_LIMIT, da.OPEN_SERVICE_OVERLOAD_ERROR], ri = function() {
  6966. function e2(t2) {
  6967. o(this, e2), this._m = t2, this._networkType = "", this._n = "NetMonitorModule", this.MAX_WAIT_TIME = 3e3, this._mpNetworkStatusCallback = null, this._webOnlineCallback = null, this._webOfflineCallback = null;
  6968. }
  6969. return a(e2, [{ key: "start", value: function() {
  6970. var e3 = this;
  6971. se ? (re.getNetworkType({ success: function(t2) {
  6972. e3._networkType = t2.networkType || t2.subtype || "", t2.networkType === oi ? xe.w("".concat(e3._n, ".start no network, please check!")) : xe.i("".concat(e3._n, ".start networkType:").concat(t2.networkType));
  6973. } }), this._mpNetworkStatusCallback = this._onNetworkStatusChange.bind(this), re.onNetworkStatusChange(this._mpNetworkStatusCallback)) : (this._networkType = si, this._webOnlineCallback = this._onWebOnline.bind(this), this._webOfflineCallback = this._onWebOffline.bind(this), window && (window.addEventListener("online", this._webOnlineCallback), window.addEventListener("offline", this._webOfflineCallback)));
  6974. } }, { key: "_onWebOnline", value: function() {
  6975. this._onNetworkStatusChange({ isConnected: true, networkType: si });
  6976. } }, { key: "_onWebOffline", value: function() {
  6977. this._onNetworkStatusChange({ isConnected: false, networkType: oi });
  6978. } }, { key: "_onNetworkStatusChange", value: function(e3) {
  6979. var t2 = e3.isConnected, n2 = e3.networkType, o2 = "".concat(this._n, "._onNetworkStatusChange"), s2 = false;
  6980. t2 ? (xe.i("".concat(o2, " previous:").concat(this._networkType, " current:").concat(n2)), this._networkType !== n2 && (s2 = true, this._m.getModule(zn).reConnect(true))) : this._networkType !== n2 && (s2 = true, xe.w("".concat(o2, " no network, please check!")), this._m.getModule(zn).offline());
  6981. s2 && (new ka("networkChange").setMessage("isConnected:".concat(t2, " previousNetworkType:").concat(this._networkType, " networkType:").concat(n2)).end(), this._networkType = n2);
  6982. } }, { key: "probe", value: function(e3) {
  6983. var t2 = this;
  6984. if (!at(e3) && ai.includes(e3.code))
  6985. return Promise.resolve([true, this._networkType]);
  6986. var n2 = "".concat(this._n, ".probe");
  6987. return new Promise(function(e4, o2) {
  6988. se ? re.getNetworkType({ success: function(o3) {
  6989. t2._networkType = o3.networkType, o3.networkType === oi ? (xe.w("".concat(n2, " no network, please check!")), e4([false, o3.networkType])) : (xe.i("".concat(n2, " networkType:").concat(o3.networkType)), e4([true, o3.networkType]));
  6990. } }) : t2._networkType === oi ? e4([false, oi]) : e4([true, si]);
  6991. });
  6992. } }, { key: "getNetworkType", value: function() {
  6993. return this._networkType;
  6994. } }, { key: "reset", value: function() {
  6995. xe.l("".concat(this._n, ".reset")), se ? null !== this._mpNetworkStatusCallback && (re.offNetworkStatusChange && (ne || Z ? re.offNetworkStatusChange(this._mpNetworkStatusCallback) : re.offNetworkStatusChange()), this._mpNetworkStatusCallback = null) : window && (null !== this._webOnlineCallback && (window.removeEventListener("online", this._webOnlineCallback), this._webOnlineCallback = null), null !== this._onWebOffline && (window.removeEventListener("offline", this._webOfflineCallback), this._webOfflineCallback = null));
  6996. } }]), e2;
  6997. }();
  6998. var ii = function(e2, t2) {
  6999. return e2(t2 = { exports: {} }, t2.exports), t2.exports;
  7000. }(function(e2) {
  7001. var t2 = Object.prototype.hasOwnProperty, n2 = "~";
  7002. function o2() {
  7003. }
  7004. function s2(e3, t3, n3) {
  7005. this.fn = e3, this.context = t3, this.once = n3 || false;
  7006. }
  7007. function a2(e3, t3, o3, a3, r3) {
  7008. if ("function" != typeof o3)
  7009. throw new TypeError("The listener must be a function");
  7010. var i3 = new s2(o3, a3 || e3, r3), u2 = n2 ? n2 + t3 : t3;
  7011. return e3._events[u2] ? e3._events[u2].fn ? e3._events[u2] = [e3._events[u2], i3] : e3._events[u2].push(i3) : (e3._events[u2] = i3, e3._eventsCount++), e3;
  7012. }
  7013. function r2(e3, t3) {
  7014. 0 == --e3._eventsCount ? e3._events = new o2() : delete e3._events[t3];
  7015. }
  7016. function i2() {
  7017. this._events = new o2(), this._eventsCount = 0;
  7018. }
  7019. Object.create && (o2.prototype = /* @__PURE__ */ Object.create(null), new o2().__proto__ || (n2 = false)), i2.prototype.eventNames = function() {
  7020. var e3, o3, s3 = [];
  7021. if (0 === this._eventsCount)
  7022. return s3;
  7023. for (o3 in e3 = this._events)
  7024. t2.call(e3, o3) && s3.push(n2 ? o3.slice(1) : o3);
  7025. return Object.getOwnPropertySymbols ? s3.concat(Object.getOwnPropertySymbols(e3)) : s3;
  7026. }, i2.prototype.listeners = function(e3) {
  7027. var t3 = n2 ? n2 + e3 : e3, o3 = this._events[t3];
  7028. if (!o3)
  7029. return [];
  7030. if (o3.fn)
  7031. return [o3.fn];
  7032. for (var s3 = 0, a3 = o3.length, r3 = new Array(a3); s3 < a3; s3++)
  7033. r3[s3] = o3[s3].fn;
  7034. return r3;
  7035. }, i2.prototype.listenerCount = function(e3) {
  7036. var t3 = n2 ? n2 + e3 : e3, o3 = this._events[t3];
  7037. return o3 ? o3.fn ? 1 : o3.length : 0;
  7038. }, i2.prototype.emit = function(e3, t3, o3, s3, a3, r3) {
  7039. var i3 = n2 ? n2 + e3 : e3;
  7040. if (!this._events[i3])
  7041. return false;
  7042. var u2, c2, l2 = this._events[i3], p2 = arguments.length;
  7043. if (l2.fn) {
  7044. switch (l2.once && this.removeListener(e3, l2.fn, void 0, true), p2) {
  7045. case 1:
  7046. return l2.fn.call(l2.context), true;
  7047. case 2:
  7048. return l2.fn.call(l2.context, t3), true;
  7049. case 3:
  7050. return l2.fn.call(l2.context, t3, o3), true;
  7051. case 4:
  7052. return l2.fn.call(l2.context, t3, o3, s3), true;
  7053. case 5:
  7054. return l2.fn.call(l2.context, t3, o3, s3, a3), true;
  7055. case 6:
  7056. return l2.fn.call(l2.context, t3, o3, s3, a3, r3), true;
  7057. }
  7058. for (c2 = 1, u2 = new Array(p2 - 1); c2 < p2; c2++)
  7059. u2[c2 - 1] = arguments[c2];
  7060. l2.fn.apply(l2.context, u2);
  7061. } else {
  7062. var d2, g2 = l2.length;
  7063. for (c2 = 0; c2 < g2; c2++)
  7064. switch (l2[c2].once && this.removeListener(e3, l2[c2].fn, void 0, true), p2) {
  7065. case 1:
  7066. l2[c2].fn.call(l2[c2].context);
  7067. break;
  7068. case 2:
  7069. l2[c2].fn.call(l2[c2].context, t3);
  7070. break;
  7071. case 3:
  7072. l2[c2].fn.call(l2[c2].context, t3, o3);
  7073. break;
  7074. case 4:
  7075. l2[c2].fn.call(l2[c2].context, t3, o3, s3);
  7076. break;
  7077. default:
  7078. if (!u2)
  7079. for (d2 = 1, u2 = new Array(p2 - 1); d2 < p2; d2++)
  7080. u2[d2 - 1] = arguments[d2];
  7081. l2[c2].fn.apply(l2[c2].context, u2);
  7082. }
  7083. }
  7084. return true;
  7085. }, i2.prototype.on = function(e3, t3, n3) {
  7086. return a2(this, e3, t3, n3, false);
  7087. }, i2.prototype.once = function(e3, t3, n3) {
  7088. return a2(this, e3, t3, n3, true);
  7089. }, i2.prototype.removeListener = function(e3, t3, o3, s3) {
  7090. var a3 = n2 ? n2 + e3 : e3;
  7091. if (!this._events[a3])
  7092. return this;
  7093. if (!t3)
  7094. return r2(this, a3), this;
  7095. var i3 = this._events[a3];
  7096. if (i3.fn)
  7097. i3.fn !== t3 || s3 && !i3.once || o3 && i3.context !== o3 || r2(this, a3);
  7098. else {
  7099. for (var u2 = 0, c2 = [], l2 = i3.length; u2 < l2; u2++)
  7100. (i3[u2].fn !== t3 || s3 && !i3[u2].once || o3 && i3[u2].context !== o3) && c2.push(i3[u2]);
  7101. c2.length ? this._events[a3] = 1 === c2.length ? c2[0] : c2 : r2(this, a3);
  7102. }
  7103. return this;
  7104. }, i2.prototype.removeAllListeners = function(e3) {
  7105. var t3;
  7106. return e3 ? (t3 = n2 ? n2 + e3 : e3, this._events[t3] && r2(this, t3)) : (this._events = new o2(), this._eventsCount = 0), this;
  7107. }, i2.prototype.off = i2.prototype.removeListener, i2.prototype.addListener = i2.prototype.on, i2.prefixed = n2, i2.EventEmitter = i2, e2.exports = i2;
  7108. }), ui = function(e2) {
  7109. i(n2, e2);
  7110. var t2 = f(n2);
  7111. function n2(e3) {
  7112. var s2;
  7113. return o(this, n2), (s2 = t2.call(this, e3))._n = "BigDataChannelModule", s2.FILETYPE = { SOUND: 2106, FILE: 2107, VIDEO: 2113 }, s2._bdh_download_server = "grouptalk.c2c.qq.com", s2._BDHBizID = 10001, s2._authKey = "", s2._expireTime = 0, s2.getInnerEmitterInstance().on(Za, s2._getAuthKey, _(s2)), s2;
  7114. }
  7115. return a(n2, [{ key: "_getAuthKey", value: function() {
  7116. var e3 = this;
  7117. this.isIntl() || this.request({ protocolName: go }).then(function(t3) {
  7118. t3.data.authKey && (e3._authKey = t3.data.authKey, e3._expireTime = parseInt(t3.data.expireTime));
  7119. });
  7120. } }, { key: "_isFromOlderVersion", value: function(e3) {
  7121. return !(!e3.content || 2 === e3.content.downloadFlag);
  7122. } }, { key: "parseElements", value: function(e3, t3) {
  7123. if (!st(e3) || !t3)
  7124. return [];
  7125. for (var n3 = [], o2 = null, s2 = 0; s2 < e3.length; s2++)
  7126. o2 = e3[s2], this._needParse(o2) ? n3.push(this._parseElement(o2, t3)) : n3.push(e3[s2]);
  7127. return n3;
  7128. } }, { key: "_needParse", value: function(e3) {
  7129. return !e3.cloudCustomData && !(!this._isFromOlderVersion(e3) || e3.type !== S.MSG_AUDIO && e3.type !== S.MSG_FILE && e3.type !== S.MSG_VIDEO);
  7130. } }, { key: "_parseElement", value: function(e3, t3) {
  7131. switch (e3.type) {
  7132. case S.MSG_AUDIO:
  7133. return this._parseAudioElement(e3, t3);
  7134. case S.MSG_FILE:
  7135. return this._parseFileElement(e3, t3);
  7136. case S.MSG_VIDEO:
  7137. return this._parseVideoElement(e3, t3);
  7138. }
  7139. } }, { key: "_parseAudioElement", value: function(e3, t3) {
  7140. return e3.content.url = this._genAudioUrl(e3.content.uuid, t3), e3;
  7141. } }, { key: "_parseFileElement", value: function(e3, t3) {
  7142. return e3.content.url = this._genFileUrl(e3.content.uuid, t3, e3.content.fileName), e3;
  7143. } }, { key: "_parseVideoElement", value: function(e3, t3) {
  7144. return e3.content.url = this._genVideoUrl(e3.content.uuid, t3), e3;
  7145. } }, { key: "_genAudioUrl", value: function(e3, t3) {
  7146. if ("" === this._authKey)
  7147. return "";
  7148. var n3 = this.getModule(qn).getSDKAppID();
  7149. return "https://".concat(this._bdh_download_server, "/asn.com/stddownload_common_file?authkey=").concat(this._authKey, "&bid=").concat(this._BDHBizID, "&subbid=").concat(n3, "&fileid=").concat(e3, "&filetype=").concat(this.FILETYPE.SOUND, "&openid=").concat(t3, "&ver=0");
  7150. } }, { key: "_genFileUrl", value: function(e3, t3, n3) {
  7151. if ("" === this._authKey)
  7152. return "";
  7153. n3 || (n3 = "".concat(Math.floor(1e5 * Math.random()), "-").concat(Date.now()));
  7154. var o2 = this.getModule(qn).getSDKAppID();
  7155. return "https://".concat(this._bdh_download_server, "/asn.com/stddownload_common_file?authkey=").concat(this._authKey, "&bid=").concat(this._BDHBizID, "&subbid=").concat(o2, "&fileid=").concat(e3, "&filetype=").concat(this.FILETYPE.FILE, "&openid=").concat(t3, "&ver=0&filename=").concat(encodeURIComponent(n3));
  7156. } }, { key: "_genVideoUrl", value: function(e3, t3) {
  7157. if ("" === this._authKey)
  7158. return "";
  7159. var n3 = this.getModule(qn).getSDKAppID();
  7160. return "https://".concat(this._bdh_download_server, "/asn.com/stddownload_common_file?authkey=").concat(this._authKey, "&bid=").concat(this._BDHBizID, "&subbid=").concat(n3, "&fileid=").concat(e3, "&filetype=").concat(this.FILETYPE.VIDEO, "&openid=").concat(t3, "&ver=0");
  7161. } }, { key: "reset", value: function() {
  7162. this._authKey = "", this.expireTime = 0;
  7163. } }]), n2;
  7164. }(ro), ci = ["requestSnapshotUrl"], li = function(e2) {
  7165. i(s2, e2);
  7166. var n2 = f(s2);
  7167. function s2(e3) {
  7168. var t2;
  7169. o(this, s2), (t2 = n2.call(this, e3))._n = "UploadModule", t2.TIMUploadPlugin = null, t2.timUploadPlugin = null, t2.COSSDK = null, t2._cosUploadMethod = null, t2.expiredTimeLimit = 600, t2.appid = 0, t2.bucketName = "", t2.ciUrl = "", t2.directory = "", t2.downloadUrl = "", t2.uploadUrl = "", t2.region = "ap-shanghai", t2.cos = null, t2.cosOptions = { secretId: "", secretKey: "", sessionToken: "", expiredTime: 0 }, t2.uploadFileType = "", t2.duration = 900, t2.tryCount = 0, t2.UPLOAD_SIZE_LIMIT = { AUDIO: 20971520, FILE: 104857600, IMAGE: 20971520, VIDEO: 104857600 };
  7170. var a2 = t2.getInnerEmitterInstance();
  7171. return a2.on(Za, t2._init, _(t2)), a2.on($a, t2._onCloudConfigUpdated, _(t2)), t2;
  7172. }
  7173. return a(s2, [{ key: "_init", value: function() {
  7174. var e3 = this.getModule(Wn);
  7175. if (this.TIMUploadPlugin = e3.getPlugin("tim-upload-plugin"), this.TIMUploadPlugin)
  7176. this._initUploaderMethod();
  7177. else {
  7178. var t2 = se ? "cos-wx-sdk" : "cos-js-sdk";
  7179. this.COSSDK = e3.getPlugin(t2), this.COSSDK ? (this._getAuthorizationKey(), this.outputWarning("CosReplacement", t2)) : this.outputWarning("PluginUndetected");
  7180. }
  7181. } }, { key: "_onCloudConfigUpdated", value: function() {
  7182. var e3 = "".concat(this._n, "._onCloudConfigUpdated"), t2 = this.getCloudConfig("upload_size_limit");
  7183. if (xe.l("".concat(e3, " uploadSizeLimit:").concat(t2)), !at(t2))
  7184. try {
  7185. var n3 = JSON.parse(t2);
  7186. this.UPLOAD_SIZE_LIMIT = { AUDIO: n3.a ? 1048576 * parseInt(n3.a) : this.UPLOAD_SIZE_LIMIT.AUDIO, FILE: n3.f ? 1048576 * parseInt(n3.f) : this.UPLOAD_SIZE_LIMIT.FILE, IMAGE: n3.i ? 1048576 * parseInt(n3.i) : this.UPLOAD_SIZE_LIMIT.IMAGE, VIDEO: n3.v ? 1048576 * parseInt(n3.v) : this.UPLOAD_SIZE_LIMIT.VIDEO };
  7187. } catch (o2) {
  7188. xe.e("".concat(e3, " JSON parse error. uploadSizeLimit:"), t2);
  7189. }
  7190. } }, { key: "_getAuthorizationKey", value: function() {
  7191. var e3 = this, t2 = "".concat(this._n, ".").concat("_getAuthorizationKey"), n3 = new ka("_getAuthorizationKey"), o2 = Math.ceil(Date.now() / 1e3);
  7192. this.request({ protocolName: ws, requestData: { duration: this.expiredTimeLimit } }).then(function(s3) {
  7193. var a2 = s3.data;
  7194. xe.l("".concat(t2, " ok. data:"), a2);
  7195. var r2 = a2.expiredTime - o2;
  7196. n3.setMessage("requestId:".concat(a2.requestId, " requestTime:").concat(o2, " expiredTime:").concat(a2.expiredTime, " diff:").concat(r2, "s")).setNetworkType(e3.getNetworkType()).end(), !se && a2.region && (e3.region = a2.region), e3.appid = a2.appid, e3.bucketName = a2.bucketName, e3.ciUrl = a2.ciUrl, e3.directory = a2.directory, e3.downloadUrl = a2.downloadUrl, e3.uploadUrl = a2.uploadUrl, e3.cosOptions = { secretId: a2.secretId, secretKey: a2.secretKey, sessionToken: a2.sessionToken, expiredTime: a2.expiredTime }, xe.l("".concat(t2, " ok. region:").concat(e3.region, " bucketName:").concat(e3.bucketName)), e3._initUploaderMethod();
  7197. }).catch(function(o3) {
  7198. e3.probeNetwork().then(function(e4) {
  7199. var t3 = v(e4, 2), s3 = t3[0], a2 = t3[1];
  7200. n3.setError(o3, s3, a2).end();
  7201. }), xe.w("".concat(t2, " failed. error:"), o3);
  7202. });
  7203. } }, { key: "_getCosPreSigUrl", value: function(e3) {
  7204. var t2 = this, n3 = "".concat(this._n, ".").concat("_getCosPreSigUrl"), o2 = Math.ceil(Date.now() / 1e3), s3 = new ka("_getCosPreSigUrl");
  7205. return this.request({ protocolName: Fs, requestData: { fileType: e3.fileType, fileName: e3.fileName, uploadMethod: e3.uploadMethod, duration: e3.duration } }).then(function(e4) {
  7206. t2.tryCount = 0;
  7207. var a2 = e4.data || {}, r2 = a2.expiredTime - o2;
  7208. return xe.l("".concat(n3, " ok. data:"), a2), s3.setMessage("requestId:".concat(a2.requestId, " expiredTime:").concat(a2.expiredTime, " diff:").concat(r2, "s")).setNetworkType(t2.getNetworkType()).end(), a2;
  7209. }).catch(function(o3) {
  7210. return -1 === o3.code && (o3.code = da.COS_GET_SIG_FAIL), t2.probeNetwork().then(function(e4) {
  7211. var t3 = v(e4, 2), n4 = t3[0], a2 = t3[1];
  7212. s3.setError(o3, n4, a2).end();
  7213. }), xe.w("".concat(n3, " failed. error:"), o3), t2.tryCount < 1 ? (t2.tryCount++, t2._getCosPreSigUrl(e3)) : (t2.tryCount = 0, Ja({ code: da.COS_GET_SIG_FAIL }));
  7214. });
  7215. } }, { key: "_initUploaderMethod", value: function() {
  7216. var e3 = this;
  7217. if (this.TIMUploadPlugin)
  7218. return this.timUploadPlugin = new this.TIMUploadPlugin(), void (this._cosUploadMethod = function(t2, n3) {
  7219. e3.timUploadPlugin.uploadFile(t2, n3);
  7220. });
  7221. this.appid && (this.cos = se ? new this.COSSDK({ ForcePathStyle: true, getAuthorization: this._getAuthorization.bind(this) }) : new this.COSSDK({ getAuthorization: this._getAuthorization.bind(this) }), this._cosUploadMethod = se ? function(t2, n3) {
  7222. e3.cos.postObject(t2, n3);
  7223. } : function(t2, n3) {
  7224. e3.cos.uploadFiles(t2, n3);
  7225. });
  7226. } }, { key: "onCheckTimer", value: function(e3) {
  7227. this.COSSDK && (this.TIMUploadPlugin || this.isLoggedIn() && e3 % 60 == 0 && Math.ceil(Date.now() / 1e3) >= this.cosOptions.expiredTime - 120 && this._getAuthorizationKey());
  7228. } }, { key: "_getAuthorization", value: function(e3, t2) {
  7229. t2({ TmpSecretId: this.cosOptions.secretId, TmpSecretKey: this.cosOptions.secretKey, XCosSecurityToken: this.cosOptions.sessionToken, ExpiredTime: this.cosOptions.expiredTime });
  7230. } }, { key: "upload", value: function(e3) {
  7231. if (true === e3.getRelayFlag())
  7232. return Promise.resolve();
  7233. var t2 = this.getModule($n);
  7234. switch (e3.type) {
  7235. case S.MSG_IMAGE:
  7236. return t2.addTotalCount(Ma), this._uploadImage(e3);
  7237. case S.MSG_FILE:
  7238. return t2.addTotalCount(Ma), this._uploadFile(e3);
  7239. case S.MSG_AUDIO:
  7240. return t2.addTotalCount(Ma), this._uploadAudio(e3);
  7241. case S.MSG_VIDEO:
  7242. return t2.addTotalCount(Ma), this._uploadVideo(e3);
  7243. default:
  7244. return Promise.resolve();
  7245. }
  7246. } }, { key: "_uploadImage", value: function(e3) {
  7247. var n3 = this, o2 = this.getModule(Rn), s3 = e3.getElements()[0], a2 = o2.getMessageOption(e3.clientSequence);
  7248. return this.doUploadImage({ file: a2.payload.file, to: a2.to, onProgress: function(e4) {
  7249. if (s3.updatePercent(e4), it(a2.onProgress))
  7250. try {
  7251. a2.onProgress(e4);
  7252. } catch (t2) {
  7253. return Ja({ code: da.MESSAGE_ONPROGRESS_FUNCTION_ERROR });
  7254. }
  7255. } }).then(function(o3) {
  7256. var a3, r2, i2 = o3.location, u2 = o3.fileType, c2 = o3.fileSize, l2 = o3.width, p2 = o3.height, d2 = o3.smallImageUrl, g2 = o3.smallImageWidth, _2 = o3.smallImageHeight, h2 = o3.largeImageUrl, f2 = o3.largeImageWidth, v2 = o3.largeImageHeight, m2 = n3.isPrivateNetWork() ? i2 : Mt(i2);
  7257. return s3.updateImageFormat(u2), d2 && h2 ? (a3 = { url: d2, width: g2, height: _2 }, r2 = { url: h2, width: f2, height: v2 }) : (a3 = Gt({ originUrl: m2, originWidth: l2, originHeight: p2, min: 198 }), r2 = Gt({ originUrl: m2, originWidth: l2, originHeight: p2, min: 720 })), s3.updateImageInfoArray([{ size: c2, url: m2, width: l2, height: p2 }, t({}, r2), t({}, a3)]), e3;
  7258. });
  7259. } }, { key: "_uploadFile", value: function(e3) {
  7260. var t2 = this, n3 = this.getModule(Rn), o2 = e3.getElements()[0], s3 = n3.getMessageOption(e3.clientSequence);
  7261. return this.doUploadFile({ file: s3.payload.file, to: s3.to, onProgress: function(e4) {
  7262. if (o2.updatePercent(e4), it(s3.onProgress))
  7263. try {
  7264. s3.onProgress(e4);
  7265. } catch (t3) {
  7266. return Ja({ code: da.MESSAGE_ONPROGRESS_FUNCTION_ERROR });
  7267. }
  7268. } }).then(function(n4) {
  7269. var s4 = n4.location, a2 = t2.isPrivateNetWork() ? s4 : Mt(s4);
  7270. return o2.updateFileUrl(a2), e3;
  7271. });
  7272. } }, { key: "_uploadAudio", value: function(e3) {
  7273. var t2 = this, n3 = this.getModule(Rn), o2 = e3.getElements()[0], s3 = n3.getMessageOption(e3.clientSequence);
  7274. return this.doUploadAudio({ file: s3.payload.file, to: s3.to, onProgress: function(e4) {
  7275. if (o2.updatePercent(e4), it(s3.onProgress))
  7276. try {
  7277. s3.onProgress(e4);
  7278. } catch (t3) {
  7279. return Ja({ code: da.MESSAGE_ONPROGRESS_FUNCTION_ERROR });
  7280. }
  7281. } }).then(function(n4) {
  7282. var s4 = n4.location, a2 = t2.isPrivateNetWork() ? s4 : Mt(s4);
  7283. return o2.updateAudioUrl(a2), e3;
  7284. });
  7285. } }, { key: "_uploadVideo", value: function(e3) {
  7286. var t2 = this, n3 = this.getModule(Rn), o2 = e3.getElements()[0], s3 = n3.getMessageOption(e3.clientSequence);
  7287. return this.doUploadVideo({ file: s3.payload.file, to: s3.to, onProgress: function(e4) {
  7288. if (o2.updatePercent(e4), it(s3.onProgress))
  7289. try {
  7290. s3.onProgress(e4);
  7291. } catch (t3) {
  7292. return Ja({ code: da.MESSAGE_ONPROGRESS_FUNCTION_ERROR });
  7293. }
  7294. } }).then(function(n4) {
  7295. var s4 = n4.location, a2 = n4.snapshotInfo, r2 = t2.isPrivateNetWork() ? s4 : Mt(s4);
  7296. return o2.updateVideoUrl(r2), jt(a2) || o2.updateSnapshotInfo(a2), e3;
  7297. });
  7298. } }, { key: "_checkSizeError", value: function(e3) {
  7299. return Ja({ code: da["MESSAGE_".concat(e3, "_SIZE_LIMIT")], message: this.getErrorMessage("UploadSizeLimit", e3.toLowerCase(), "".concat(this.UPLOAD_SIZE_LIMIT[e3] / 1048576, " MB")) });
  7300. } }, { key: "doUploadImage", value: function(e3) {
  7301. var t2 = this;
  7302. if (!e3.file)
  7303. return Ja({ code: da.MESSAGE_IMAGE_SELECT_FILE_FIRST });
  7304. var n3 = this._checkImageType(e3.file);
  7305. if (true !== n3)
  7306. return n3;
  7307. var o2 = this._checkImageSize(e3.file);
  7308. if (true !== o2)
  7309. return o2;
  7310. var s3 = null;
  7311. return this._setUploadFileType(sr), this.uploadByCOS(e3).then(function(e4) {
  7312. return s3 = e4, t2.isPrivateNetWork() ? At(e4.location) : At("https://".concat(e4.location));
  7313. }).then(function(e4) {
  7314. return s3.width = e4.width, s3.height = e4.height, Promise.resolve(s3);
  7315. });
  7316. } }, { key: "_checkImageType", value: function(e3) {
  7317. var t2 = "";
  7318. return t2 = se ? e3.url.slice(e3.url.lastIndexOf(".") + 1) : e3.files[0].name.slice(e3.files[0].name.lastIndexOf(".") + 1), nr.indexOf(t2.toLowerCase()) >= 0 || Ja({ code: da.MESSAGE_IMAGE_TYPES_LIMIT });
  7319. } }, { key: "_checkImageSize", value: function(e3) {
  7320. var t2 = 0;
  7321. return 0 === (t2 = se ? e3.size : e3.files[0].size) ? Ja({ code: da.MESSAGE_FILE_IS_EMPTY }) : t2 < this.UPLOAD_SIZE_LIMIT.IMAGE || this._checkSizeError("IMAGE");
  7322. } }, { key: "doUploadFile", value: function(e3) {
  7323. return e3.file ? e3.file.files[0].size > this.UPLOAD_SIZE_LIMIT.FILE ? this._checkSizeError("FILE") : 0 === e3.file.files[0].size ? Ja({ code: da.MESSAGE_FILE_IS_EMPTY }) : (this._setUploadFileType(ir), this.uploadByCOS(e3)) : Ja({ code: da.MESSAGE_FILE_SELECT_FILE_FIRST });
  7324. } }, { key: "doUploadVideo", value: function(e3) {
  7325. return e3.file.videoFile.size > this.UPLOAD_SIZE_LIMIT.VIDEO ? this._checkSizeError("VIDEO") : 0 === e3.file.videoFile.size ? Ja({ code: da.MESSAGE_FILE_IS_EMPTY }) : -1 === or.indexOf(e3.file.videoFile.type) ? Ja({ code: da.MESSAGE_VIDEO_TYPES_LIMIT }) : (this._setUploadFileType(ar), se ? this.handleVideoUpload({ file: e3.file.videoFile, onProgress: e3.onProgress }) : ae ? this.handleVideoUpload(e3) : void 0);
  7326. } }, { key: "handleVideoUpload", value: function(e3) {
  7327. var t2 = this;
  7328. return new Promise(function(n3, o2) {
  7329. t2.uploadByCOS(e3).then(function(e4) {
  7330. n3(e4);
  7331. }).catch(function() {
  7332. t2.uploadByCOS(e3).then(function(e4) {
  7333. n3(e4);
  7334. }).catch(function() {
  7335. o2(new Wa({ code: da.MESSAGE_VIDEO_UPLOAD_FAIL }));
  7336. });
  7337. });
  7338. });
  7339. } }, { key: "doUploadAudio", value: function(e3) {
  7340. return e3.file ? e3.file.size > this.UPLOAD_SIZE_LIMIT.AUDIO ? this._checkSizeError("AUDIO") : 0 === e3.file.size ? Ja({ code: da.MESSAGE_FILE_IS_EMPTY }) : (this._setUploadFileType(rr), this.uploadByCOS(e3)) : Ja({ code: da.MESSAGE_AUDIO_UPLOAD_FAIL });
  7341. } }, { key: "uploadByCOS", value: function(e3) {
  7342. var t2 = this;
  7343. if (!it(this._cosUploadMethod))
  7344. return this.outputWarning("PluginUndetected"), Ja({ code: da.COS_UNDETECTED });
  7345. if (this.timUploadPlugin)
  7346. return this._uploadWithPreSigUrl(e3);
  7347. var n3 = new ka("upload"), o2 = "".concat(this._n, ".uploadByCOS"), s3 = Date.now(), a2 = this._getFile(e3);
  7348. return new Promise(function(r2, i2) {
  7349. var u2 = se ? t2._createCosOptionsWXMiniApp(e3) : t2._createCosOptionsWeb(e3), c2 = t2;
  7350. t2._cosUploadMethod(u2, function(e4, u3) {
  7351. var l2 = /* @__PURE__ */ Object.create(null);
  7352. if (u3) {
  7353. if (e4 || st(u3.files) && u3.files[0].error) {
  7354. var p2 = new Wa({ code: da.MESSAGE_FILE_UPLOAD_FAIL });
  7355. return n3.setError(p2, true, t2.getNetworkType()).end(), xe.l("".concat(o2, " failed. error:"), u3.files[0].error), 403 === u3.files[0].error.statusCode && (xe.w("".concat(o2, " failed. cos AccessKeyId was invalid, regain auth key!")), t2._getAuthorizationKey()), void i2(p2);
  7356. }
  7357. l2.fileName = a2.name, l2.fileSize = a2.size, l2.fileType = a2.type.slice(a2.type.indexOf("/") + 1).toLowerCase(), l2.location = se ? u3.Location : u3.files[0].data.Location;
  7358. var d2 = Date.now() - s3, g2 = c2._formatFileSize(a2.size), _2 = c2._formatSpeed(1e3 * a2.size / d2), h2 = "size:".concat(g2, " time:").concat(d2, "ms speed:").concat(_2);
  7359. xe.l("".concat(o2, " success. name:").concat(a2.name, " ").concat(h2)), r2(l2);
  7360. var f2 = t2.getModule($n);
  7361. return f2.addCost(Ma, d2), f2.addFileSize(Ma, a2.size), void n3.setNetworkType(t2.getNetworkType()).setMessage(h2).end();
  7362. }
  7363. var v2 = new Wa({ code: da.MESSAGE_FILE_UPLOAD_FAIL });
  7364. n3.setError(v2, true, c2.getNetworkType()).end(), xe.w("".concat(o2, " failed. error:"), e4), 403 === e4.statusCode && (xe.w("".concat(o2, " failed. cos AccessKeyId was invalid, regain auth key!")), t2._getAuthorizationKey()), i2(v2);
  7365. });
  7366. });
  7367. } }, { key: "_uploadWithPreSigUrl", value: function(e3) {
  7368. var t2 = this, n3 = "".concat(this._n, "._uploadWithPreSigUrl"), o2 = this._getFile(e3);
  7369. return this._createCosOptionsPreSigUrl(e3).then(function(e4) {
  7370. return new Promise(function(s3, a2) {
  7371. var r2 = new ka("upload"), i2 = e4.requestSnapshotUrl, u2 = void 0 === i2 ? void 0 : i2, c2 = g(e4, ci), l2 = Date.now();
  7372. t2._cosUploadMethod(c2, function(e5, i3) {
  7373. if (e5 || 403 === i3.statusCode)
  7374. return r2.setError(new Wa(e5), true, t2.getNetworkType()).end(), xe.l("".concat(n3, " failed, error:"), e5), void a2(new Wa({ code: da.MESSAGE_FILE_UPLOAD_FAIL }));
  7375. var p2 = /* @__PURE__ */ Object.create(null), d2 = i3.data.location || "";
  7376. t2.isPrivateNetWork() || 0 !== d2.indexOf("https://") && 0 !== d2.indexOf("http://") || (d2 = d2.split("//")[1]), p2.fileName = o2.name, p2.fileSize = o2.size, p2.fileType = o2.type.slice(o2.type.indexOf("/") + 1).toLowerCase(), p2.location = d2;
  7377. var g2 = Date.now() - l2, _2 = t2._formatFileSize(o2.size), h2 = t2._formatSpeed(1e3 * o2.size / g2), f2 = "size:".concat(_2, ",time:").concat(g2, "ms,speed:").concat(h2, " res:").concat(JSON.stringify(i3.data));
  7378. xe.l("".concat(n3, " success name:").concat(o2.name, ",").concat(f2)), r2.setNetworkType(t2.getNetworkType()).setMessage(f2).end();
  7379. var v2 = t2.getModule($n);
  7380. v2.addCost(Ma, g2), v2.addFileSize(Ma, o2.size);
  7381. var m2 = [];
  7382. if (c2.thumbUrl && c2.largeUrl && (m2 = [t2._getSmallImageInfoByUrl(c2.thumbUrl, p2), t2._getLargeImageInfoByUrl(c2.largeUrl, p2)]), u2 && m2.push(t2._getSnapshotInfoByUrl(u2, p2)), m2.length > 0)
  7383. return Promise.all(m2).then(function() {
  7384. s3(p2);
  7385. });
  7386. s3(p2);
  7387. });
  7388. });
  7389. });
  7390. } }, { key: "_getRawOrUploadProxyUrl", value: function(e3) {
  7391. var t2 = this.getModule(qn).getFileUploadProxy(), n3 = e3;
  7392. return t2 && (n3 = e3.replace(/^https:\/\/[^/]+/, t2)), n3;
  7393. } }, { key: "_getFile", value: function(e3) {
  7394. var t2;
  7395. return st(e3.file.files) || (t2 = e3.file.files, "filelist" === ct(t2)) ? e3.file.files[0] : e3.file;
  7396. } }, { key: "_formatFileSize", value: function(e3) {
  7397. return e3 < 1024 ? e3 + "B" : e3 < 1048576 ? Math.floor(e3 / 1024) + "KB" : Math.floor(e3 / 1048576) + "MB";
  7398. } }, { key: "_formatSpeed", value: function(e3) {
  7399. return e3 <= 1048576 ? bt(e3 / 1024, 1) + "KB/s" : bt(e3 / 1048576, 1) + "MB/s";
  7400. } }, { key: "_createCosOptionsWeb", value: function(e3) {
  7401. var t2 = this._getFile(e3), n3 = t2.name, o2 = n3.slice(n3.lastIndexOf(".")), s3 = this._genFileName("".concat(_t(999999)).concat(o2));
  7402. return { files: [{ Bucket: "".concat(this.bucketName, "-").concat(this.appid), Region: this.region, Key: "".concat(this.directory, "/").concat(s3), Body: t2 }], SliceSize: 1048576, onProgress: function(t3) {
  7403. if ("function" == typeof e3.onProgress)
  7404. try {
  7405. e3.onProgress(t3.percent);
  7406. } catch (n4) {
  7407. xe.w("onProgress callback error:", n4);
  7408. }
  7409. }, onFileFinish: function(e4, t3, n4) {
  7410. } };
  7411. } }, { key: "_createCosOptionsWXMiniApp", value: function(e3) {
  7412. var t2 = this._getFile(e3), n3 = this._genFileName(t2.name), o2 = t2.url;
  7413. return { Bucket: "".concat(this.bucketName, "-").concat(this.appid), Region: this.region, Key: "".concat(this.directory, "/").concat(n3), FilePath: o2, onProgress: function(t3) {
  7414. if (xe.l(JSON.stringify(t3)), "function" == typeof e3.onProgress)
  7415. try {
  7416. e3.onProgress(t3.percent);
  7417. } catch (n4) {
  7418. xe.w("onProgress callback error:", n4);
  7419. }
  7420. } };
  7421. } }, { key: "_createCosOptionsPreSigUrl", value: function(e3) {
  7422. var t2 = this, n3 = "", o2 = "", s3 = 0, a2 = this._getFile(e3);
  7423. if (se)
  7424. n3 = this._genFileName(a2.name), o2 = a2.url, s3 = 1;
  7425. else {
  7426. var r2 = a2.name, i2 = r2.slice(r2.lastIndexOf("."));
  7427. n3 = this._genFileName("".concat(_t(999999)).concat(i2)), o2 = a2, s3 = 0;
  7428. }
  7429. return this._getCosPreSigUrl({ fileType: this.uploadFileType, fileName: n3, uploadMethod: s3, duration: this.duration }).then(function(s4) {
  7430. var a3 = s4.uploadUrl, r3 = s4.downloadUrl, i3 = s4.requestSnapshotUrl, u2 = void 0 === i3 ? void 0 : i3, c2 = s4.thumbUrl, l2 = s4.largeUrl;
  7431. return { url: t2._getRawOrUploadProxyUrl(a3), fileType: t2.uploadFileType, fileName: n3, resources: o2, downloadUrl: r3, requestSnapshotUrl: u2, thumbUrl: c2, largeUrl: l2, onProgress: function(t3) {
  7432. if ("function" == typeof e3.onProgress)
  7433. try {
  7434. e3.onProgress(t3.percent);
  7435. } catch (n4) {
  7436. xe.w("onProgress callback error:", n4), xe.e(n4);
  7437. }
  7438. } };
  7439. });
  7440. } }, { key: "_genFileName", value: function(e3) {
  7441. return "".concat(Rt(), "-").concat(e3);
  7442. } }, { key: "_setUploadFileType", value: function(e3) {
  7443. this.uploadFileType = e3;
  7444. } }, { key: "_getSnapshotInfoByUrl", value: function(e3, t2) {
  7445. var n3 = this, o2 = new ka("getSnapshotInfo");
  7446. return this.request({ protocolName: qs, requestData: { platform: this.getPlatform(), coverName: this._genFileName(_t(99999)), requestSnapshotUrl: e3 } }).then(function(e4) {
  7447. var n4 = (e4.data || {}).snapshotUrl;
  7448. return o2.setMessage("snapshotUrl:".concat(n4)).end(), jt(n4) ? {} : At(n4).then(function(e5) {
  7449. t2.snapshotInfo = { snapshotUrl: n4, snapshotWidth: e5.width, snapshotHeight: e5.height };
  7450. });
  7451. }).catch(function(e4) {
  7452. return xe.w("".concat(n3._n, "._getSnapshotInfoByUrl failed. error:"), e4), o2.setCode(e4.errorCode).setMessage(e4.errorInfo).end(), {};
  7453. });
  7454. } }, { key: "_getSmallImageInfoByUrl", value: function(e3, t2) {
  7455. return At(e3).then(function(n3) {
  7456. t2.smallImageUrl = e3, t2.smallImageWidth = n3.width, t2.smallImageHeight = n3.height;
  7457. });
  7458. } }, { key: "_getLargeImageInfoByUrl", value: function(e3, t2) {
  7459. return At(e3).then(function(n3) {
  7460. t2.largeImageUrl = e3, t2.largeImageWidth = n3.width, t2.largeImageHeight = n3.height;
  7461. });
  7462. } }, { key: "reset", value: function() {
  7463. xe.l("".concat(this._n, ".reset"));
  7464. } }]), s2;
  7465. }(ro), pi = ["downloadKey", "pbDownloadKey", "messageList"], di = function() {
  7466. function e2(t2) {
  7467. o(this, e2), this._n = "MergerMessageHandler", this._messageModule = t2;
  7468. }
  7469. return a(e2, [{ key: "uploadMergerMessage", value: function(e3, t2) {
  7470. var n2 = this, o2 = "".concat(this._n, ".").concat("uploadMergerMessage");
  7471. xe.d("".concat(o2, " message:"), e3, "messageBytes:".concat(t2));
  7472. var s2 = e3.payload.messageList, a2 = s2.length, r2 = new ka("uploadMergerMessage");
  7473. return this._messageModule.request({ protocolName: Ys, requestData: { messageList: s2 } }).then(function(e4) {
  7474. xe.d("".concat(o2, " ok. response:"), e4.data);
  7475. var s3 = e4.data, i2 = s3.pbDownloadKey, u2 = s3.downloadKey, c2 = { pbDownloadKey: i2, downloadKey: u2, messageNumber: a2 };
  7476. return r2.setNetworkType(n2._messageModule.getNetworkType()).setMessage("".concat(a2, "-").concat(t2, "-").concat(u2)).end(), c2;
  7477. }).catch(function(e4) {
  7478. throw xe.w("".concat(o2, " failed. error:"), e4), n2._messageModule.probeNetwork().then(function(t3) {
  7479. var n3 = v(t3, 2), o3 = n3[0], s3 = n3[1];
  7480. r2.setError(e4, o3, s3).end();
  7481. }), e4;
  7482. });
  7483. } }, { key: "downloadMergerMessage", value: function(e3) {
  7484. var n2 = this, o2 = "".concat(this._n, ".").concat("downloadMergerMessage");
  7485. xe.d("".concat(o2, " message:"), e3);
  7486. var s2 = e3.payload.downloadKey, a2 = this._messageModule.getFileDownloadProxy(), r2 = new ka("downloadMergerMessage");
  7487. return r2.setMessage("downloadKey:".concat(s2)), this._messageModule.request({ protocolName: js, requestData: { downloadKey: s2 } }).then(function(s3) {
  7488. if (xe.d("".concat(o2, " ok. response:"), s3.data), it(e3.clearElement)) {
  7489. var i2 = e3.payload;
  7490. i2.downloadKey, i2.pbDownloadKey, i2.messageList;
  7491. var u2 = g(i2, pi);
  7492. e3.clearElement(), e3.setElement({ type: e3.type, content: t({ messageList: s3.data.messageList }, u2) }, a2);
  7493. } else {
  7494. var c2 = [];
  7495. s3.data.messageList.forEach(function(e4) {
  7496. if (!jt(e4)) {
  7497. var t2 = new xa(e4, a2);
  7498. c2.push(t2);
  7499. }
  7500. }), e3.payload.messageList = c2, e3.payload.downloadKey = "", e3.payload.pbDownloadKey = "";
  7501. }
  7502. return r2.setNetworkType(n2._messageModule.getNetworkType()).end(), e3;
  7503. }).catch(function(e4) {
  7504. throw xe.w("".concat(o2, " failed. key:").concat(s2, " error:"), e4), n2._messageModule.probeNetwork().then(function(t2) {
  7505. var n3 = v(t2, 2), o3 = n3[0], s3 = n3[1];
  7506. r2.setError(e4, o3, s3).end();
  7507. }), e4;
  7508. });
  7509. } }, { key: "createMergerMessagePack", value: function(e3, t2, n2) {
  7510. return e3.conversationType === S.CONV_C2C ? this._createC2CMergerMessagePack(e3, t2, n2) : this._createGroupMergerMessagePack(e3, t2, n2);
  7511. } }, { key: "_createC2CMergerMessagePack", value: function(e3, t2, n2) {
  7512. var o2 = null;
  7513. t2 && (t2.offlinePushInfo && (o2 = t2.offlinePushInfo), true === t2.onlineUserOnly && (o2 ? o2.disablePush = true : o2 = { disablePush: true }));
  7514. var s2 = [];
  7515. if (ot(t2) && ot(t2.messageControlInfo)) {
  7516. var a2 = t2.messageControlInfo, r2 = a2.excludedFromUnreadCount, i2 = a2.excludedFromLastMessage, u2 = a2.excludedFromContentModeration;
  7517. true === r2 && s2.push("NoUnread"), true === i2 && s2.push("NoLastMsg"), true === u2 && s2.push("NoMsgCheck");
  7518. }
  7519. var c2 = "";
  7520. et(e3.cloudCustomData) && e3.cloudCustomData.length > 0 && (c2 = e3.cloudCustomData);
  7521. var l2 = n2.pbDownloadKey, p2 = n2.downloadKey, d2 = n2.messageNumber, g2 = e3.payload, _2 = g2.title, h2 = g2.abstractList, f2 = g2.compatibleText, v2 = this._messageModule.getModule(Gn), m2 = v2 && v2.isOnlineMessage(e3, t2) ? 0 : void 0;
  7522. return { protocolName: _o, tjgID: this._messageModule.generateTjgID(e3), requestData: { fromAccount: this._messageModule.getMyUserID(), toAccount: e3.to, msgBody: [{ msgType: e3.type, msgContent: { pbDownloadKey: l2, downloadKey: p2, title: _2, abstractList: h2, compatibleText: f2, messageNumber: d2 } }], cloudCustomData: c2, clientTime: e3.clientTime, msgSeq: e3.sequence, msgRandom: e3.random, msgLifeTime: m2, offlinePushInfo: o2 ? { pushFlag: true === o2.disablePush ? 1 : 0, title: o2.title || "", desc: o2.description || "", ext: o2.extension || "", apnsInfo: { badgeMode: true === o2.ignoreIOSBadge ? 1 : 0 }, androidInfo: { OPPOChannelID: o2.androidOPPOChannelID || "" } } : void 0, messageControlInfo: 0 !== m2 ? s2 : void 0, isSupportExtension: true === e3.isSupportExtension ? 1 : 0 } };
  7523. } }, { key: "_createGroupMergerMessagePack", value: function(e3, t2, n2) {
  7524. var o2 = null;
  7525. t2 && t2.offlinePushInfo && (o2 = t2.offlinePushInfo);
  7526. var s2 = [];
  7527. if (ot(t2) && ot(t2.messageControlInfo)) {
  7528. var a2 = t2.messageControlInfo, r2 = a2.excludedFromUnreadCount, i2 = a2.excludedFromLastMessage, u2 = a2.excludedFromContentModeration;
  7529. true === r2 && s2.push("NoUnread"), true === i2 && s2.push("NoLastMsg"), true === u2 && s2.push("NoMsgCheck");
  7530. }
  7531. var c2 = "";
  7532. et(e3.cloudCustomData) && e3.cloudCustomData.length > 0 && (c2 = e3.cloudCustomData);
  7533. var l2 = n2.pbDownloadKey, p2 = n2.downloadKey, d2 = n2.messageNumber, g2 = e3.payload, _2 = g2.title, h2 = g2.abstractList, f2 = g2.compatibleText, v2 = this._messageModule.getModule(Un), m2 = v2 && v2.isOnlineMessage(e3, t2) ? 1 : 0;
  7534. return { protocolName: ho, tjgID: this._messageModule.generateTjgID(e3), requestData: { fromAccount: this._messageModule.getMyUserID(), groupID: e3.to, msgBody: [{ msgType: e3.type, msgContent: { pbDownloadKey: l2, downloadKey: p2, title: _2, abstractList: h2, compatibleText: f2, messageNumber: d2 } }], random: e3.random, priority: e3.priority, clientSequence: e3.clientSequence, groupAtInfo: void 0, cloudCustomData: c2, onlineOnlyFlag: m2, offlinePushInfo: o2 ? { pushFlag: true === o2.disablePush ? 1 : 0, title: o2.title || "", desc: o2.description || "", ext: o2.extension || "", apnsInfo: { badgeMode: true === o2.ignoreIOSBadge ? 1 : 0 }, androidInfo: { OPPOChannelID: o2.androidOPPOChannelID || "" } } : void 0, clientTime: e3.clientTime, needReadReceipt: true !== e3.needReadReceipt || v2.isMessageFromOrToAVChatroom(e3.to) ? 0 : 1, messageControlInfo: 0 === m2 ? s2 : void 0, isSupportExtension: true === e3.isSupportExtension ? 1 : 0 } };
  7535. } }]), e2;
  7536. }(), gi = { ERR_SVR_COMM_SENSITIVE_TEXT: 80001, ERR_SVR_COMM_BODY_SIZE_LIMIT: 80002, OPEN_SERVICE_OVERLOAD_ERROR: 60022, ERR_SVR_MSG_PKG_PARSE_FAILED: 20001, ERR_SVR_MSG_INTERNAL_AUTH_FAILED: 20002, ERR_SVR_MSG_INVALID_ID: 20003, ERR_SVR_MSG_PUSH_DENY: 20006, ERR_SVR_MSG_IN_PEER_BLACKLIST: 20007, ERR_SVR_MSG_BOTH_NOT_FRIEND: 20009, ERR_SVR_MSG_NOT_PEER_FRIEND: 20010, ERR_SVR_MSG_NOT_SELF_FRIEND: 20011, ERR_SVR_MSG_SHUTUP_DENY: 20012, ERR_SVR_GROUP_INVALID_PARAMETERS: 10004, ERR_SVR_GROUP_PERMISSION_DENY: 10007, ERR_SVR_GROUP_NOT_FOUND: 10010, ERR_SVR_GROUP_INVALID_GROUPID: 10015, ERR_SVR_GROUP_REJECT_FROM_THIRDPARTY: 10016, ERR_SVR_GROUP_SHUTUP_DENY: 10017, MESSAGE_SEND_FAIL: 2100, OVER_FREQUENCY_LIMIT: 2996 }, _i = [da.MESSAGE_ONPROGRESS_FUNCTION_ERROR, da.MESSAGE_IMAGE_SELECT_FILE_FIRST, da.MESSAGE_IMAGE_TYPES_LIMIT, da.MESSAGE_FILE_IS_EMPTY, da.MESSAGE_IMAGE_SIZE_LIMIT, da.MESSAGE_FILE_SELECT_FILE_FIRST, da.MESSAGE_FILE_SIZE_LIMIT, da.MESSAGE_VIDEO_SIZE_LIMIT, da.MESSAGE_VIDEO_TYPES_LIMIT, da.MESSAGE_AUDIO_UPLOAD_FAIL, da.MESSAGE_AUDIO_SIZE_LIMIT, da.COS_UNDETECTED];
  7537. function hi(e2) {
  7538. var t2 = false;
  7539. return Object.values(gi).includes(e2) && (t2 = true), (e2 >= 120001 && e2 <= 13e4 || e2 >= 10100 && e2 <= 10200) && (t2 = true), t2;
  7540. }
  7541. var fi = function(e2) {
  7542. i(s2, e2);
  7543. var n2 = f(s2);
  7544. function s2(e3) {
  7545. var t2;
  7546. return o(this, s2), (t2 = n2.call(this, e3))._n = "MessageModule", t2._messageOptionsMap = /* @__PURE__ */ new Map(), t2._mergerMessageHandler = new di(_(t2)), t2;
  7547. }
  7548. return a(s2, [{ key: "createTextMessage", value: function(e3) {
  7549. var t2 = this.getMyUserID();
  7550. e3.currentUser = t2, e3.senderTinyID = this.getMyTinyID();
  7551. var n3 = new Ha(e3), o2 = "string" == typeof e3.payload ? e3.payload : e3.payload.text, s3 = new La({ text: o2 }), a2 = this._getNickAndAvatarByUserID(t2);
  7552. return n3.setElement(s3), n3.setNickAndAvatar(a2), n3.setNameCard(this._getNameCardByGroupID(n3)), n3;
  7553. } }, { key: "createImageMessage", value: function(e3) {
  7554. var t2 = this.getMyUserID();
  7555. e3.currentUser = t2, e3.senderTinyID = this.getMyTinyID();
  7556. var n3 = new Ha(e3);
  7557. if (se) {
  7558. var o2 = e3.payload.file;
  7559. if (Ze(o2))
  7560. return void this.outputWarning("FileUnsupportedInMP", "createImageMessage");
  7561. var s3 = o2.tempFiles[0].path || o2.tempFiles[0].tempFilePath, a2 = { url: s3, name: s3.slice(s3.lastIndexOf("/") + 1), size: o2.tempFiles && o2.tempFiles[0].size || 1, type: s3.slice(s3.lastIndexOf(".") + 1).toLowerCase() };
  7562. e3.payload.file = a2;
  7563. } else if (ae) {
  7564. if (Ze(e3.payload.file)) {
  7565. var r2 = e3.payload.file;
  7566. e3.payload.file = { files: [r2] };
  7567. } else if (ot(e3.payload.file) && "undefined" != typeof uni) {
  7568. var i2 = e3.payload.file.tempFiles[0];
  7569. e3.payload.file = { files: [i2] };
  7570. }
  7571. }
  7572. var u2 = new Aa({ imageFormat: Ve.UNKNOWN, uuid: this._generateUUID(e3.payload.file), file: e3.payload.file }), c2 = this._getNickAndAvatarByUserID(t2);
  7573. return n3.setElement(u2), n3.setNickAndAvatar(c2), n3.setNameCard(this._getNameCardByGroupID(n3)), this._messageOptionsMap.set(n3.clientSequence, e3), n3;
  7574. } }, { key: "createAudioMessage", value: function(e3) {
  7575. var t2 = e3.payload.file;
  7576. if (se) {
  7577. var n3 = { url: t2.tempFilePath, name: t2.tempFilePath.slice(t2.tempFilePath.lastIndexOf("/") + 1), size: t2.fileSize, second: parseInt(t2.duration) / 1e3, type: t2.tempFilePath.slice(t2.tempFilePath.lastIndexOf(".") + 1).toLowerCase() };
  7578. e3.payload.file = n3;
  7579. }
  7580. var o2 = this.getMyUserID();
  7581. e3.currentUser = o2, e3.senderTinyID = this.getMyTinyID();
  7582. var s3 = new Ha(e3), a2 = new Na({ second: Math.floor(t2.duration / 1e3), size: t2.fileSize || t2.size, url: t2.tempFilePath, uuid: this._generateUUID(e3.payload.file) }), r2 = this._getNickAndAvatarByUserID(o2);
  7583. return s3.setElement(a2), s3.setNickAndAvatar(r2), s3.setNameCard(this._getNameCardByGroupID(s3)), this._messageOptionsMap.set(s3.clientSequence, e3), s3;
  7584. } }, { key: "createVideoMessage", value: function(e3) {
  7585. var t2 = this.getMyUserID();
  7586. e3.currentUser = t2, e3.senderTinyID = this.getMyTinyID(), e3.payload.file.thumbUrl = "", e3.payload.file.thumbSize = 0;
  7587. var n3 = {};
  7588. if (se) {
  7589. if (ee)
  7590. return void this.outputWarning("VideoUnsupportedInAlipay");
  7591. if (Ze(e3.payload.file))
  7592. return void this.outputWarning("FileUnsupportedInMP", "createVideoMessage");
  7593. var o2 = e3.payload.file;
  7594. st(o2.tempFiles) && (o2 = o2.tempFiles[0]), n3.url = o2.tempFilePath, n3.name = o2.tempFilePath.slice(o2.tempFilePath.lastIndexOf("/") + 1), n3.size = o2.size || 1, n3.second = o2.duration || 0, n3.type = o2.tempFilePath.slice(o2.tempFilePath.lastIndexOf(".") + 1).toLowerCase();
  7595. } else if (ae) {
  7596. if (Ze(e3.payload.file)) {
  7597. var s3 = e3.payload.file;
  7598. e3.payload.file.files = [s3];
  7599. } else if (ot(e3.payload.file) && "undefined" != typeof uni) {
  7600. var a2 = e3.payload.file.tempFile;
  7601. e3.payload.file.files = [a2];
  7602. }
  7603. var r2 = e3.payload.file;
  7604. n3.url = window.URL.createObjectURL(r2.files[0]), n3.name = r2.files[0].name, n3.size = r2.files[0].size || 1, n3.second = r2.files[0].duration || 0, n3.type = r2.files[0].type.split("/")[1];
  7605. }
  7606. e3.payload.file.videoFile = n3;
  7607. var i2 = new Ha(e3), u2 = new Fa({ videoFormat: n3.type, videoSecond: bt(n3.second, 0), videoSize: n3.size, remoteVideoUrl: "", videoUrl: n3.url, videoUUID: this._generateUUID(e3.payload.file.videoFile), thumbUUID: this._generateUUID(e3.payload.file.videoFile), thumbWidth: e3.payload.file.width || 200, thumbHeight: e3.payload.file.height || 200, thumbUrl: e3.payload.file.thumbUrl, thumbSize: e3.payload.file.thumbSize, thumbFormat: e3.payload.file.thumbUrl.slice(e3.payload.file.thumbUrl.lastIndexOf(".") + 1).toLowerCase() }), c2 = this._getNickAndAvatarByUserID(t2);
  7608. return i2.setElement(u2), i2.setNickAndAvatar(c2), i2.setNameCard(this._getNameCardByGroupID(i2)), this._messageOptionsMap.set(i2.clientSequence, e3), i2;
  7609. } }, { key: "createCustomMessage", value: function(e3) {
  7610. var t2 = this.getMyUserID();
  7611. e3.currentUser = t2, e3.senderTinyID = this.getMyTinyID();
  7612. var n3 = new Ha(e3), o2 = new wa({ data: e3.payload.data, description: e3.payload.description, extension: e3.payload.extension }), s3 = this._getNickAndAvatarByUserID(t2);
  7613. return n3.setElement(o2), n3.setNickAndAvatar(s3), n3.setNameCard(this._getNameCardByGroupID(n3)), n3;
  7614. } }, { key: "createFaceMessage", value: function(e3) {
  7615. var t2 = this.getMyUserID();
  7616. e3.currentUser = t2, e3.senderTinyID = this.getMyTinyID();
  7617. var n3 = new Ha(e3), o2 = new Ra(e3.payload), s3 = this._getNickAndAvatarByUserID(t2);
  7618. return n3.setElement(o2), n3.setNickAndAvatar(s3), n3.setNameCard(this._getNameCardByGroupID(n3)), n3;
  7619. } }, { key: "createMergerMessage", value: function(e3) {
  7620. var t2 = this.getMyUserID();
  7621. e3.currentUser = t2, e3.senderTinyID = this.getMyTinyID();
  7622. var n3 = this._getNickAndAvatarByUserID(t2), o2 = new Ha(e3), s3 = new Va(e3.payload);
  7623. return o2.setElement(s3), o2.setNickAndAvatar(n3), o2.setNameCard(this._getNameCardByGroupID(o2)), o2.setRelayFlag(true), o2;
  7624. } }, { key: "createForwardMessage", value: function(e3) {
  7625. var t2 = e3.to, n3 = e3.conversationType, o2 = e3.priority, s3 = e3.payload, a2 = e3.needReadReceipt, r2 = e3.receiverList, i2 = this.getMyUserID(), u2 = this._getNickAndAvatarByUserID(i2);
  7626. if (s3.type === S.MSG_GRP_TIP)
  7627. return Ja({ code: da.MESSAGE_FORWARD_TYPE_INVALID });
  7628. var c2 = { to: t2, conversationType: n3, conversationID: "".concat(n3).concat(t2), priority: o2, isPlaceMessage: 0, status: Qt.UNSEND, currentUser: i2, senderTinyID: this.getMyTinyID(), cloudCustomData: e3.cloudCustomData || s3.cloudCustomData || "", needReadReceipt: a2, receiverList: r2, isSupportExtension: e3.isSupportExtension || false }, l2 = new Ha(c2);
  7629. return l2.setElement(s3.getElements()[0]), l2.setNickAndAvatar(u2), l2.setNameCard(this._getNameCardByGroupID(s3)), l2.setRelayFlag(true), l2;
  7630. } }, { key: "downloadMergerMessage", value: function(e3) {
  7631. return this._mergerMessageHandler.downloadMergerMessage(e3);
  7632. } }, { key: "createFileMessage", value: function(e3) {
  7633. if (se) {
  7634. if (!X && !Q && !ne)
  7635. return;
  7636. var n3 = re.getSystemInfoSync().SDKVersion;
  7637. if (X && Ot(n3, "2.5.0") < 0)
  7638. return void this.outputWarning("WXChooseMessageFile");
  7639. if (Q && Ot(n3, "1.18.0") < 0)
  7640. return void this.outputWarning("QQChooseMessageFile");
  7641. }
  7642. if (ae || ne) {
  7643. if (Ze(e3.payload.file)) {
  7644. var o2 = e3.payload.file;
  7645. e3.payload.file = { files: [o2] };
  7646. } else if (ot(e3.payload.file) && "undefined" != typeof uni) {
  7647. var s3 = e3.payload.file, a2 = s3.tempFiles, r2 = s3.files, i2 = null;
  7648. st(a2) ? i2 = a2[0] : st(r2) && (i2 = r2[0]), e3.payload.file = { files: [i2] };
  7649. }
  7650. } else if (X || Q) {
  7651. var u2 = e3.payload.file.tempFiles, c2 = t(t({}, u2[0]), {}, { url: u2[0].path });
  7652. e3.payload.file = { files: [c2] };
  7653. }
  7654. var l2 = this.getMyUserID();
  7655. e3.currentUser = l2, e3.senderTinyID = this.getMyTinyID();
  7656. var p2 = new Ha(e3), d2 = new ba({ uuid: this._generateUUID(e3.payload.file), file: e3.payload.file }), g2 = this._getNickAndAvatarByUserID(l2);
  7657. return p2.setElement(d2), p2.setNickAndAvatar(g2), p2.setNameCard(this._getNameCardByGroupID(p2)), this._messageOptionsMap.set(p2.clientSequence, e3), p2;
  7658. } }, { key: "createLocationMessage", value: function(e3) {
  7659. var t2 = this.getMyUserID();
  7660. e3.currentUser = t2, e3.senderTinyID = this.getMyTinyID();
  7661. var n3 = new Ha(e3), o2 = new qa(e3.payload), s3 = this._getNickAndAvatarByUserID(t2);
  7662. return n3.setElement(o2), n3.setNickAndAvatar(s3), n3.setNameCard(this._getNameCardByGroupID(n3)), n3;
  7663. } }, { key: "_onCannotFindModule", value: function() {
  7664. return Ja({ code: da.CANNOT_FIND_MODULE });
  7665. } }, { key: "sendMessageInstance", value: function(e3, t2) {
  7666. var n3 = this;
  7667. if (false === this.getModule(no).filterMessage(e3, t2))
  7668. return this._onSendMessageFailed(e3, new Wa({ code: da.PROFANITY_FOUND }));
  7669. var o2, s3 = null;
  7670. switch (e3.conversationType) {
  7671. case S.CONV_C2C:
  7672. if (!(s3 = this.getModule(Gn)))
  7673. return this._onCannotFindModule();
  7674. break;
  7675. case S.CONV_GROUP:
  7676. if (!(s3 = this.getModule(Un)))
  7677. return this._onCannotFindModule();
  7678. if (Tt({ groupID: e3.to })) {
  7679. var a2 = s3.getLocalGroupProfile(e3.to);
  7680. if (a2 && a2.isSupportTopic)
  7681. return Ja({ code: da.MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL });
  7682. }
  7683. break;
  7684. default:
  7685. return Ja({ code: da.MESSAGE_SEND_INVALID_CONVERSATION_TYPE });
  7686. }
  7687. var r2 = this.getModule(Kn), i2 = this.getModule(Un);
  7688. return r2.upload(e3).then(function() {
  7689. n3._getSendMessageSpecifiedKey(e3) === ma && n3.getModule($n).addSuccessCount(Ma);
  7690. return i2.guardForAVChatRoom(e3).then(function() {
  7691. if (!e3.isSendable())
  7692. return Ja({ code: da.MESSAGE_FILE_URL_IS_EMPTY });
  7693. n3._addSendMessageTotalCount(e3), o2 = Date.now();
  7694. var a3 = function(e4) {
  7695. var t3 = "utf-8";
  7696. ae && document && (t3 = document.charset.toLowerCase());
  7697. var n4, o3, s4 = 0;
  7698. if (o3 = e4.length, "utf-8" === t3 || "utf8" === t3)
  7699. for (var a4 = 0; a4 < o3; a4++)
  7700. (n4 = e4.codePointAt(a4)) <= 127 ? s4 += 1 : n4 <= 2047 ? s4 += 2 : n4 <= 65535 ? s4 += 3 : (s4 += 4, a4++);
  7701. else if ("utf-16" === t3 || "utf16" === t3)
  7702. for (var r3 = 0; r3 < o3; r3++)
  7703. (n4 = e4.codePointAt(r3)) <= 65535 ? s4 += 2 : (s4 += 4, r3++);
  7704. else
  7705. s4 = e4.replace(/[^\x00-\xff]/g, "aa").length;
  7706. return s4;
  7707. }(JSON.stringify(e3));
  7708. return e3.type === S.MSG_MERGER && a3 > 11264 ? n3._mergerMessageHandler.uploadMergerMessage(e3, a3).then(function(o3) {
  7709. var s4 = n3._mergerMessageHandler.createMergerMessagePack(e3, t2, o3);
  7710. return n3.request(s4);
  7711. }) : (n3.getModule(Fn).setMessageRandom(e3), e3.conversationType === S.CONV_C2C || e3.conversationType === S.CONV_GROUP ? s3.sendMessage(e3, t2) : void 0);
  7712. }).then(function(a3) {
  7713. var r3 = a3.data, i3 = r3.time, u2 = r3.sequence, c2 = r3.readReceiptCode;
  7714. $e(c2) && 0 !== c2 && (new ka("sendMessageWithReceipt").setMessage("from:".concat(e3.from, " to:").concat(e3.to, " sequence:").concat(u2, " readReceiptCode:").concat(c2)).end(), xe.w("".concat(n3._n, ".sendMessageInstance readReceiptCode:").concat(c2, " message:").concat(n3.getErrorMessage(c2))));
  7715. n3._addSendMessageSuccessCount(e3, o2), n3._messageOptionsMap.delete(e3.clientSequence);
  7716. var l2 = n3.getModule(Fn);
  7717. e3.status = Qt.SUCCESS, e3.time = i3;
  7718. var p2 = false;
  7719. if (e3.conversationType === S.CONV_GROUP)
  7720. e3.sequence = u2;
  7721. else if (e3.conversationType === S.CONV_C2C) {
  7722. var d2 = l2.getLatestMessageSentByMe(e3.conversationID);
  7723. if (d2) {
  7724. var g2 = d2.nick, _2 = d2.avatar;
  7725. g2 === e3.nick && _2 === e3.avatar || (p2 = true);
  7726. }
  7727. }
  7728. if (p2 && l2.modifyMessageSentByMe({ conversationID: e3.conversationID, latestNick: e3.nick, latestAvatar: e3.avatar }), s3.isOnlineMessage(e3, t2))
  7729. e3._onlineOnlyFlag = true;
  7730. else {
  7731. l2.appendToMessageList(e3);
  7732. var h2 = e3;
  7733. ot(t2) && ot(t2.messageControlInfo) && (true === t2.messageControlInfo.excludedFromLastMessage && (e3._isExcludedFromLastMessage = true, h2 = ""), true === t2.messageControlInfo.excludedFromUnreadCount && (e3._isExcludedFromUnreadCount = true));
  7734. var f2 = e3.conversationType;
  7735. if (Dt(e3.to))
  7736. f2 = S.CONV_TOPIC, n3.getModule(wn).onMessageSent({ groupID: qt(e3.to), topicID: e3.to, lastMessage: h2 });
  7737. l2.onMessageSent({ conversationOptionsList: [{ conversationID: e3.conversationID, unreadCount: 0, type: f2, subType: e3.conversationSubType, lastMessage: h2 }] });
  7738. }
  7739. return e3.getRelayFlag() || "TIMImageElem" !== e3.type || Ut(e3.payload.imageInfoArray), Ka({ message: e3 });
  7740. });
  7741. }).catch(function(t3) {
  7742. return n3._onSendMessageFailed(e3, t3);
  7743. });
  7744. } }, { key: "_onSendMessageFailed", value: function(e3, t2) {
  7745. e3.status = Qt.FAIL, this.getModule(Fn).deleteMessageRandom(e3), this._addSendMessageFailCountOnUser(e3, t2);
  7746. var n3 = new ka("sendMessage");
  7747. return n3.setMessage("tjg_id:".concat(this.generateTjgID(e3), " type:").concat(e3.type, " from:").concat(e3.from, " to:").concat(e3.to)), this.probeNetwork().then(function(e4) {
  7748. var o2 = v(e4, 2), s3 = o2[0], a2 = o2[1];
  7749. n3.setError(t2, s3, a2).end();
  7750. }), xe.e("".concat(this._n, "._onSendMessageFailed error:"), t2), Ja(new Wa({ code: t2 && t2.code ? t2.code : da.MESSAGE_SEND_FAIL, message: t2 && t2.message ? t2.message : void 0, data: { message: e3 } }));
  7751. } }, { key: "_getSendMessageSpecifiedKey", value: function(e3) {
  7752. if ([S.MSG_IMAGE, S.MSG_AUDIO, S.MSG_VIDEO, S.MSG_FILE].includes(e3.type))
  7753. return ma;
  7754. if (e3.conversationType === S.CONV_C2C)
  7755. return ha;
  7756. if (e3.conversationType === S.CONV_GROUP) {
  7757. var t2 = this.getModule(Un).getLocalGroupProfile(e3.to);
  7758. if (!t2)
  7759. return;
  7760. var n3 = t2.type;
  7761. return Ct(n3) ? va : fa;
  7762. }
  7763. } }, { key: "_addSendMessageTotalCount", value: function(e3) {
  7764. var t2 = this._getSendMessageSpecifiedKey(e3);
  7765. t2 && this.getModule($n).addTotalCount(t2);
  7766. } }, { key: "_addSendMessageSuccessCount", value: function(e3, t2) {
  7767. var n3 = Math.abs(Date.now() - t2), o2 = this._getSendMessageSpecifiedKey(e3);
  7768. if (o2) {
  7769. var s3 = this.getModule($n);
  7770. s3.addSuccessCount(o2), s3.addCost(o2, n3);
  7771. }
  7772. } }, { key: "_addSendMessageFailCountOnUser", value: function(e3, t2) {
  7773. var n3, o2, s3 = t2.code, a2 = void 0 === s3 ? -1 : s3, r2 = this.getModule($n), i2 = this._getSendMessageSpecifiedKey(e3);
  7774. i2 === ma && (n3 = a2, o2 = false, _i.includes(n3) && (o2 = true), o2) ? r2.addFailedCountOfUserSide(Ma) : hi(a2) && i2 && r2.addFailedCountOfUserSide(i2);
  7775. } }, { key: "resendMessage", value: function(e3) {
  7776. return e3.isResend = true, e3.status = Qt.UNSEND, this.sendMessageInstance(e3);
  7777. } }, { key: "revokeMessage", value: function(e3) {
  7778. var t2 = this, n3 = null;
  7779. if (e3.conversationType === S.CONV_C2C ? n3 = this.getModule(Gn) : e3.conversationType === S.CONV_GROUP && (n3 = this.getModule(Un)), !n3)
  7780. return this._onCannotFindModule();
  7781. var o2 = new ka("revokeMessage");
  7782. o2.setMessage("tjg_id:".concat(this.generateTjgID(e3), " type:").concat(e3.type, " from:").concat(e3.from, " to:").concat(e3.to));
  7783. var s3 = "".concat(this._n, ".").concat("revokeMessage");
  7784. return n3.revokeMessage(e3).then(function(n4) {
  7785. var a2 = n4.data.recallRetList;
  7786. if (!jt(a2) && 0 !== a2[0].retCode) {
  7787. var r2 = new Wa({ code: a2[0].retCode, data: { message: e3 } });
  7788. return o2.setCode(r2.code).setMoreMessage(r2.message).end(), Ja(r2);
  7789. }
  7790. return xe.i("".concat(s3, " ok. ID:").concat(e3.ID)), e3.isRevoked = true, o2.end(), t2.getModule(Fn).onMessageRevoked([e3]), Ka({ message: e3 });
  7791. }).catch(function(n4) {
  7792. t2.probeNetwork().then(function(e4) {
  7793. var t3 = v(e4, 2), s4 = t3[0], a3 = t3[1];
  7794. o2.setError(n4, s4, a3).end();
  7795. });
  7796. var a2 = new Wa({ code: n4 && n4.code ? n4.code : da.MESSAGE_REVOKE_FAIL, message: n4 && n4.message ? n4.message : void 0, data: { message: e3 } });
  7797. return xe.w("".concat(s3, " failed. error:"), n4), Ja(a2);
  7798. });
  7799. } }, { key: "deleteMessage", value: function(e3) {
  7800. var t2 = this, n3 = null, o2 = e3[0], s3 = o2.conversationID, a2 = "", r2 = [], i2 = [];
  7801. if (o2.conversationType === S.CONV_C2C)
  7802. n3 = this.getModule(Gn), a2 = s3.replace(S.CONV_C2C, ""), e3.forEach(function(e4) {
  7803. e4 && e4.status === Qt.SUCCESS && e4.conversationID === s3 && (e4._onlineOnlyFlag || r2.push("".concat(e4.sequence, "_").concat(e4.random, "_").concat(e4.time)), i2.push(e4));
  7804. });
  7805. else if (o2.conversationType === S.CONV_GROUP)
  7806. n3 = this.getModule(Un), a2 = s3.replace(S.CONV_GROUP, ""), e3.forEach(function(e4) {
  7807. e4 && e4.status === Qt.SUCCESS && e4.conversationID === s3 && (e4._onlineOnlyFlag || r2.push("".concat(e4.sequence)), i2.push(e4));
  7808. });
  7809. else if (o2.conversationType === S.CONV_SYSTEM)
  7810. return Ja({ code: da.CANNOT_DELETE_GROUP_SYSTEM_NOTICE });
  7811. if (!n3)
  7812. return this._onCannotFindModule();
  7813. if (0 === r2.length)
  7814. return this._onMessageDeleted(i2);
  7815. r2.length > 30 && (r2 = r2.slice(0, 30), i2 = i2.slice(0, 30));
  7816. var u2 = new ka("deleteMessage");
  7817. u2.setMessage("to:".concat(a2, " count:").concat(r2.length));
  7818. var c2 = "".concat(this._n, ".").concat("deleteMessage");
  7819. return n3.deleteMessage({ to: a2, keyList: r2 }).then(function(e4) {
  7820. return u2.end(), xe.i("".concat(c2, " ok")), t2._onMessageDeleted(i2);
  7821. }).catch(function(e4) {
  7822. t2.probeNetwork().then(function(t3) {
  7823. var n5 = v(t3, 2), o3 = n5[0], s4 = n5[1];
  7824. u2.setError(e4, o3, s4).end();
  7825. }), xe.w("".concat(c2, " failed. error:"), e4);
  7826. var n4 = new Wa({ code: e4 && e4.code ? e4.code : da.MESSAGE_DELETE_FAIL, message: e4 && e4.message ? e4.message : void 0 });
  7827. return Ja(n4);
  7828. });
  7829. } }, { key: "_onMessageDeleted", value: function(e3) {
  7830. return this.getModule(Fn).onMessageDeleted(e3), za({ messageList: e3 });
  7831. } }, { key: "translateText", value: function(e3) {
  7832. var n3 = "".concat(this._n, ".").concat("translateText"), o2 = e3.sourceTextList, s3 = e3.sourceLanguage, a2 = e3.targetLanguage, r2 = new ka("translateText");
  7833. return r2.setMessage("sourceLanguage:".concat(s3, " targetLanguage:").concat(a2)), this.request({ protocolName: pa, requestData: { sourceTextList: o2, source: s3 || "auto", target: a2, from: this.getMyTinyID(), SDKAppID: this.getSDKAppID() } }).then(function(e4) {
  7834. var o3 = e4.data, s4 = o3.error, a3 = o3.requestID, i2 = o3.translatedTextList;
  7835. if (0 === s4.code)
  7836. return r2.end(), xe.i("".concat(n3, " ok. requestID:").concat(a3)), Ka({ translatedTextList: i2 });
  7837. throw t(t({}, s4), {}, { requestID: a3 });
  7838. }).catch(function(e4) {
  7839. return r2.setCode(e4.code).setMoreMessage(e4.requestID).end(), xe.w("".concat(n3, " failed. error:"), e4), Ja({ code: da.TRANSLATE_TEXT_FAIL });
  7840. });
  7841. } }, { key: "modifyRemoteMessage", value: function(e3) {
  7842. var t2 = this, n3 = null, o2 = e3.conversationType, s3 = e3.to;
  7843. if (this.getModule(Un).isMessageFromOrToAVChatroom(s3))
  7844. return Ja({ code: da.MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM, data: { message: e3 } });
  7845. if (false === this.getModule(no).filterMessage(e3))
  7846. return Ja({ code: da.PROFANITY_FOUND, data: { message: e3 } });
  7847. o2 === S.CONV_C2C ? n3 = this.getModule(Gn) : o2 === S.CONV_GROUP && (n3 = this.getModule(Un));
  7848. var a2 = new ka("modifyMessage");
  7849. a2.setMessage("to:".concat(s3));
  7850. var r2 = "".concat(this._n, ".modifyRemoteMessage");
  7851. return n3.modifyRemoteMessage(e3).then(function(n4) {
  7852. a2.end(), xe.i("".concat(r2, " ok"));
  7853. var o3 = t2._onModifyRemoteMessageResp(e3, n4.data);
  7854. return Ka({ message: o3 });
  7855. }).catch(function(n4) {
  7856. if (a2.setCode(n4.code).setMoreMessage(n4.message).end(), xe.w("".concat(r2, " failed. error:"), n4), 20027 === n4.code) {
  7857. var o3 = t2._onModifyRemoteMessageResp(e3, n4.data);
  7858. return Ja({ code: da.MESSAGE_MODIFY_CONFLICT, data: { message: o3 } });
  7859. }
  7860. return Ja({ code: n4.code, message: n4.message, data: { message: e3 } });
  7861. });
  7862. } }, { key: "_onModifyRemoteMessageResp", value: function(e3, t2) {
  7863. xe.d("".concat(this._n, "._onModifyRemoteMessageResp options:"), t2);
  7864. var n3 = e3.conversationType, o2 = e3.from, s3 = e3.to, a2 = e3.random, r2 = e3.sequence, i2 = e3.time, u2 = t2.elements, c2 = t2.messageVersion, l2 = t2.cloudCustomData, p2 = void 0 === l2 ? "" : l2;
  7865. return this.getModule(Fn).onMessageModified({ conversationType: n3, from: o2, to: s3, time: i2, random: a2, sequence: r2, elements: u2, cloudCustomData: p2, messageVersion: c2 });
  7866. } }, { key: "_generateUUID", value: function(e3) {
  7867. var t2 = this.getModule(qn), n3 = "".concat(t2.getSDKAppID(), "-").concat(t2.getUserID(), "-").concat(function() {
  7868. for (var e4 = "", t3 = 32; t3 > 0; --t3)
  7869. e4 += ht[Math.floor(Math.random() * ft)];
  7870. return e4;
  7871. }()), o2 = e3.name || e3.value || e3.url || e3.tempFilePath, s3 = o2 && o2.slice(o2.lastIndexOf(".") + 1);
  7872. return s3 && (n3 = "".concat(n3, ".").concat(s3)), n3;
  7873. } }, { key: "getMessageOption", value: function(e3) {
  7874. return this._messageOptionsMap.get(e3);
  7875. } }, { key: "_getNickAndAvatarByUserID", value: function(e3) {
  7876. return this.getModule(On).getNickAndAvatarByUserID(e3);
  7877. } }, { key: "_getNameCardByGroupID", value: function(e3) {
  7878. if (e3.conversationType === S.CONV_GROUP) {
  7879. var t2 = this.getModule(Un);
  7880. if (t2)
  7881. return t2.getMyNameCardByGroupID(e3.to);
  7882. }
  7883. return "";
  7884. } }, { key: "reset", value: function() {
  7885. xe.l("".concat(this._n, ".reset")), this._messageOptionsMap.clear();
  7886. } }]), s2;
  7887. }(ro), vi = function(e2) {
  7888. i(n2, e2);
  7889. var t2 = f(n2);
  7890. function n2(e3) {
  7891. var s2;
  7892. return o(this, n2), (s2 = t2.call(this, e3))._n = "MessageExtensionModule", s2.messageExtensionMap = /* @__PURE__ */ new Map(), s2.globalSeqMap = /* @__PURE__ */ new Map(), s2.getMessageExtensionsMap = /* @__PURE__ */ new Map(), s2;
  7893. }
  7894. return a(n2, [{ key: "onMessageExtensionNotify", value: function(e3) {
  7895. var t3 = this, n3 = e3.dataList, o2 = n3.messageInfo, s2 = n3.operateType, a2 = n3.operateResultList, r2 = n3.tinyID, i2 = n3.globalSequence, u2 = o2.clientTime, c2 = o2.random, l2 = "".concat(r2, "-").concat(u2, "-").concat(c2), p2 = [], d2 = [];
  7896. xe.l("".concat(this._n, ".onMessageExtensionNotify messageID:").concat(l2, " operateType:").concat(s2, " globalSequence:").concat(i2)), this._updateGlobalSequence(l2, i2);
  7897. var g2 = false, _2 = false;
  7898. a2.forEach(function(e4) {
  7899. var n4 = e4.extensions, o3 = void 0 === n4 ? [] : n4, a3 = e4.clearSequence;
  7900. if (1 === s2)
  7901. g2 = true, o3.forEach(function(e5) {
  7902. p2.push({ key: e5.key, value: e5.value });
  7903. }), t3._updateLocalExtension(l2, o3);
  7904. else if (2 === s2)
  7905. _2 = true, o3.forEach(function(e5) {
  7906. d2.push(e5.key);
  7907. }), t3._updateLocalExtension(l2, o3);
  7908. else if (3 === s2) {
  7909. if (_2 = true, t3._hasLocalExtension(l2))
  7910. t3._getLocalExtension(l2).forEach(function(e5, t4) {
  7911. e5.seq <= a3 && !jt(e5.value) && d2.push(t4);
  7912. });
  7913. t3._clearLocalExtension(l2, a3);
  7914. }
  7915. }), g2 && this.emitOuterEvent(E.MESSAGE_EXTENSIONS_UPDATED, { messageID: l2, extensions: p2 }), _2 && this.emitOuterEvent(E.MESSAGE_EXTENSIONS_DELETED, { messageID: l2, keyList: d2 });
  7916. } }, { key: "setMessageExtensions", value: function(e3, t3) {
  7917. var n3 = this;
  7918. if (!this.canIUse(B.MSG_EXT))
  7919. return Ja({ code: da.CANNOT_USE_COMMERCIAL_ABILITY });
  7920. var o2 = "".concat(this._n, ".").concat("setMessageExtensions"), s2 = e3.ID, a2 = e3.conversationID, r2 = e3.sequence, i2 = e3.time, u2 = m(t3);
  7921. t3.length > 20 && (u2 = t3.slice(0, 20), xe.w("".concat(o2, ". the length of extensions cannot exceed 20.")));
  7922. var c2 = "conversationID:".concat(a2, " messageID:").concat(s2, " sequence:").concat(r2, " time:").concat(i2, " count:").concat(u2.length), l2 = new ka("setMessageExtensions");
  7923. return l2.setMessage(c2), xe.l("".concat(o2, " ").concat(c2)), this._modifyMessageExtensions(e3, u2).then(function(e4) {
  7924. var t4 = e4.resultList, n4 = e4.successCount, s3 = e4.failureCount, a3 = "success count:".concat(n4, " fail count:").concat(s3);
  7925. return l2.setMoreMessage(a3).end(), xe.l("".concat(o2, " ok. ").concat(a3)), Ka({ extensions: t4 });
  7926. }).catch(function(e4) {
  7927. return n3.probeNetwork().then(function(t4) {
  7928. var n4 = v(t4, 2), o3 = n4[0], s3 = n4[1];
  7929. l2.setError(e4, o3, s3).end();
  7930. }), xe.e("".concat(o2, " failed. error:"), e4), Ja(e4);
  7931. });
  7932. } }, { key: "getMessageExtensions", value: function(e3) {
  7933. var t3 = this;
  7934. if (!this.canIUse(B.MSG_EXT))
  7935. return Ja({ code: da.CANNOT_USE_COMMERCIAL_ABILITY });
  7936. var n3 = "".concat(this._n, ".").concat("getMessageExtensions"), o2 = e3.ID, s2 = e3.conversationID, a2 = e3.sequence, r2 = e3.time, i2 = "conversationID:".concat(s2, " messageID:").concat(o2, " sequence:").concat(a2, " time:").concat(r2), u2 = new ka("getMessageExtensions");
  7937. u2.setMessage(i2), xe.l("".concat(n3, " ").concat(i2));
  7938. var c2 = void 0;
  7939. return this.getMessageExtensionsMap.has(o2) && (c2 = this._getGlobalSequence(o2)), this._getMessageExtensions(e3, c2).then(function(e4) {
  7940. return u2.end(), xe.l("".concat(n3, " ok. total count:").concat(e4.length)), at(c2) && e4.length > 0 && t3.getMessageExtensionsMap.set(o2, 1), Ka({ extensions: e4 });
  7941. }).catch(function(e4) {
  7942. return t3.probeNetwork().then(function(t4) {
  7943. var n4 = v(t4, 2), o3 = n4[0], s3 = n4[1];
  7944. u2.setError(e4, o3, s3).end();
  7945. }), xe.e("".concat(n3, " failed. error:"), e4), Ja(e4);
  7946. });
  7947. } }, { key: "deleteMessageExtensions", value: function(e3, t3) {
  7948. var n3 = this;
  7949. if (!this.canIUse(B.MSG_EXT))
  7950. return Ja({ code: da.CANNOT_USE_COMMERCIAL_ABILITY });
  7951. var o2 = "".concat(this._n, ".").concat("deleteMessageExtensions"), s2 = [], a2 = 3;
  7952. jt(t3) || (a2 = 2, t3.forEach(function(e4) {
  7953. s2.push({ key: e4, value: "", seq: 0 });
  7954. }));
  7955. var r2 = e3.ID, i2 = e3.conversationID, u2 = e3.sequence, c2 = e3.time, l2 = "conversationID:".concat(i2, " messageID:").concat(r2, " sequence:").concat(u2, " time:").concat(c2, " operateType:").concat(a2), p2 = new ka("deleteMessageExtensions");
  7956. return p2.setMessage(l2), xe.l("".concat(o2, " ").concat(l2)), this._modifyMessageExtensions(e3, s2, a2).then(function(e4) {
  7957. var t4 = e4.resultList, n4 = e4.successCount, s3 = e4.failureCount, r3 = "";
  7958. return 2 === a2 && (r3 = "success count:".concat(n4, " fail count:").concat(s3)), p2.setMoreMessage("".concat(r3)).end(), xe.l("".concat(o2, " ok. ").concat(r3)), Ka({ extensions: t4 });
  7959. }).catch(function(e4) {
  7960. return n3.probeNetwork().then(function(t4) {
  7961. var n4 = v(t4, 2), o3 = n4[0], s3 = n4[1];
  7962. p2.setError(e4, o3, s3).end();
  7963. }), xe.e("".concat(o2, " failed. error:"), e4), Ja(e4);
  7964. });
  7965. } }, { key: "_modifyMessageExtensions", value: function(e3, t3) {
  7966. var n3 = this, o2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1, s2 = Dt(e3.to) ? S.CONV_TOPIC : e3.conversationType, a2 = void 0;
  7967. 3 !== o2 && (a2 = this._getRequestExtensions(e3, t3));
  7968. var r2 = null;
  7969. switch (s2) {
  7970. case S.CONV_C2C:
  7971. r2 = this.getModule(Gn);
  7972. break;
  7973. case S.CONV_GROUP:
  7974. r2 = this.getModule(Un);
  7975. break;
  7976. case S.CONV_TOPIC:
  7977. r2 = this.getModule(wn);
  7978. break;
  7979. default:
  7980. return Ja({ code: da.CANNOT_FIND_MODULE });
  7981. }
  7982. return r2.modifyMessageExtensions(e3, a2, o2).then(function(t4) {
  7983. var o3 = t4.data, s3 = o3.extensions, a3 = o3.seq, r3 = [], i2 = 0, u2 = 0, c2 = [];
  7984. return (s3 = jt(s3) ? [] : s3).forEach(function(e4) {
  7985. var t5 = e4.errorCode, n4 = e4.extension, o4 = n4.key, s4 = n4.value, a4 = n4.seq;
  7986. r3.push({ code: t5, key: o4, value: s4 }), 0 === t5 ? i2++ : u2++, c2.push({ key: o4, value: s4, seq: a4 });
  7987. }), n3._updateGlobalSequence(e3.ID, a3), c2.length > 0 && (n3._updateLocalExtension(e3.ID, c2), c2 = null), { resultList: r3, successCount: i2, failureCount: u2 };
  7988. }).catch(function(e4) {
  7989. return Ja(e4);
  7990. });
  7991. } }, { key: "_getRequestExtensions", value: function(e3, t3) {
  7992. var n3 = [];
  7993. if (this._hasLocalExtension(e3.ID)) {
  7994. var o2 = this._getLocalExtension(e3.ID);
  7995. return t3.forEach(function(e4) {
  7996. var t4 = e4.key, s2 = e4.value, a2 = 0;
  7997. o2.has(t4) && (a2 = o2.get(t4).seq), n3.push({ key: t4, value: s2, seq: a2 });
  7998. }), n3;
  7999. }
  8000. return t3.forEach(function(e4) {
  8001. var t4 = e4.key, o3 = e4.value;
  8002. n3.push({ key: t4, value: o3, seq: 0 });
  8003. }), n3;
  8004. } }, { key: "_getMessageExtensions", value: function(e3, t3) {
  8005. var n3 = this, o2 = "".concat(this._n, "._getMessageExtensions"), s2 = e3.ID, a2 = e3.to, r2 = null;
  8006. switch (Dt(a2) ? S.CONV_TOPIC : e3.conversationType) {
  8007. case S.CONV_C2C:
  8008. r2 = this.getModule(Gn);
  8009. break;
  8010. case S.CONV_GROUP:
  8011. r2 = this.getModule(Un);
  8012. break;
  8013. case S.CONV_TOPIC:
  8014. r2 = this.getModule(wn);
  8015. break;
  8016. default:
  8017. return Ja({ code: da.CANNOT_FIND_MODULE });
  8018. }
  8019. return r2.getMessageExtensions(e3, t3).then(function(t4) {
  8020. var a3 = t4.data, r3 = a3.extensions, i2 = a3.completeFlag, u2 = a3.globalSequence, c2 = a3.clearSequence;
  8021. if (r3 = jt(r3) ? [] : r3, xe.l("".concat(o2, " ok. completeFlag:").concat(i2, " globalSequence:").concat(u2, " clearSequence:").concat(c2, " count:").concat(r3.length)), n3._updateLocalExtension(s2, r3), n3._clearLocalExtension(s2, c2), n3._updateGlobalSequence(s2, u2), 1 !== i2) {
  8022. var l2 = r3.slice(-1)[0].seq + 1;
  8023. return n3._getMessageExtensions(e3, l2);
  8024. }
  8025. return n3._getLocalExtensions(s2);
  8026. }).catch(function(e4) {
  8027. return Ja(e4);
  8028. });
  8029. } }, { key: "_hasLocalExtension", value: function(e3) {
  8030. return this.messageExtensionMap.has(e3);
  8031. } }, { key: "_getLocalExtension", value: function(e3) {
  8032. return this.messageExtensionMap.get(e3);
  8033. } }, { key: "_updateLocalExtension", value: function(e3, t3) {
  8034. this._hasLocalExtension(e3) || this.messageExtensionMap.set(e3, /* @__PURE__ */ new Map());
  8035. var n3 = this._getLocalExtension(e3);
  8036. t3.forEach(function(e4) {
  8037. var t4 = e4.key, o2 = e4.value, s2 = void 0 === o2 ? "" : o2, a2 = e4.seq;
  8038. n3.set(t4, { value: s2, seq: a2 });
  8039. });
  8040. } }, { key: "_clearLocalExtension", value: function(e3, t3) {
  8041. if (!(t3 <= 0) && this._hasLocalExtension(e3)) {
  8042. var n3 = this._getLocalExtension(e3);
  8043. n3.forEach(function(e4, o2) {
  8044. e4.seq <= t3 && n3.delete(o2);
  8045. });
  8046. }
  8047. } }, { key: "_getLocalExtensions", value: function(e3) {
  8048. var t3 = [];
  8049. this._hasLocalExtension(e3) && this._getLocalExtension(e3).forEach(function(e4, n3) {
  8050. var o2 = e4.value;
  8051. jt(o2) || t3.push({ key: n3, value: o2 });
  8052. });
  8053. return t3;
  8054. } }, { key: "_getGlobalSequence", value: function(e3) {
  8055. return this.globalSeqMap.get(e3);
  8056. } }, { key: "_updateGlobalSequence", value: function(e3, t3) {
  8057. this.globalSeqMap.set(e3, t3);
  8058. } }, { key: "reset", value: function() {
  8059. xe.l("".concat(this._n, ".reset")), this.messageExtensionMap.clear(), this.globalSeqMap.clear(), this.getMessageExtensionsMap.clear();
  8060. } }]), n2;
  8061. }(ro), mi = function(e2) {
  8062. i(n2, e2);
  8063. var t2 = f(n2);
  8064. function n2(e3) {
  8065. var s2;
  8066. return o(this, n2), (s2 = t2.call(this, e3))._n = "ComboMessageModule", s2;
  8067. }
  8068. return a(n2, [{ key: "sendMessage", value: function(e3) {
  8069. var t3 = this, n3 = this._constructMessageInstance(e3);
  8070. if (null === n3)
  8071. return Ja({ code: da.MESSAGE_SEND_FAIL });
  8072. this._addSendMessageTotalCount(n3);
  8073. var o2 = Date.now();
  8074. return this.getModule(Fn).setMessageRandom(n3), this._sendComboMessage(n3, e3).then(function(e4) {
  8075. var s2 = e4.data, a2 = s2.time, r2 = s2.sequence, i2 = s2.readReceiptCode;
  8076. $e(i2) && 0 !== i2 && (new ka("sendMessageWithReceipt").setMessage("from:".concat(n3.from, " to:").concat(n3.to, " sequence:").concat(r2, " readReceiptCode:").concat(i2)).end(), xe.w("".concat(t3._n, ".sendMessage readReceiptCode:").concat(i2, " message:").concat(t3.getErrorMessage(i2))));
  8077. t3._addSendMessageSuccessCount(n3, o2);
  8078. var u2 = t3.getModule(Fn);
  8079. n3.status = Qt.SUCCESS, n3.time = a2, n3.conversationType === S.CONV_GROUP && (n3.sequence = r2), u2.appendToMessageList(n3);
  8080. var c2 = n3;
  8081. return true === n3._isExcludedFromLastMessage && (c2 = ""), u2.onMessageSent({ conversationOptionsList: [{ conversationID: n3.conversationID, unreadCount: 0, type: n3.conversationType, subType: n3.conversationSubType, lastMessage: c2 }] }), Ka({ message: n3 });
  8082. }).catch(function(e4) {
  8083. return t3._onSendMessageFailed(n3, e4);
  8084. });
  8085. } }, { key: "_sendComboMessage", value: function(e3, t3) {
  8086. var n3 = this._m.getModule(jn), o2 = "";
  8087. return e3.conversationType === S.CONV_C2C && (o2 = "".concat(V.NAME.OPEN_IM, ".").concat(V.CMD.SEND_MESSAGE)), e3.conversationType === S.CONV_GROUP && (o2 = "".concat(V.NAME.GROUP, ".").concat(V.CMD.SEND_GROUP_MESSAGE)), n3.sendComboMessage({ servcmd: o2, data: t3 });
  8088. } }, { key: "_constructMessageInstance", value: function(e3) {
  8089. var t3 = "".concat(this._n, "._constructMessageInstance"), n3 = null;
  8090. try {
  8091. var o2 = this.getMyUserID(), s2 = {};
  8092. if (s2.senderTinyID = this.getMyTinyID(), s2.currentUser = o2, s2.from = e3.From_Account || o2, e3.GroupId ? (s2.conversationID = "".concat(S.CONV_GROUP).concat(e3.GroupId), s2.conversationType = S.CONV_GROUP, s2.to = e3.GroupId) : e3.To_Account && (s2.conversationID = "".concat(S.CONV_C2C).concat(e3.To_Account), s2.conversationType = S.CONV_C2C, s2.to = e3.To_Account), s2.time = e3.MsgTimeStamp || 0, s2.random = e3.Random || e3.MsgRandom || 0, s2.priority = e3.MsgPriority, et(e3.CloudCustomData) && e3.CloudCustomData.length > 0 && (s2.cloudCustomData = e3.CloudCustomData), st(e3.SendMsgControl) && (s2.messageControlInfo = {}, e3.SendMsgControl.includes("NoUnread") && (s2.messageControlInfo.excludedFromUnreadCount = 1), e3.SendMsgControl.includes("NoLastMsg") && (s2.messageControlInfo.excludedFromLastMessage = 1)), s2.conversationType === S.CONV_GROUP && st(e3.To_Account) && e3.To_Account.length > 0) {
  8093. var a2 = e3.To_Account;
  8094. e3.To_Account.length > 50 && (a2 = e3.To_Account.slice(0, 50), xe.w("".concat(t3, " To_Account must be less than or equal to 50."))), s2.receiverList = m(a2), e3.To_Account = m(a2);
  8095. }
  8096. 1 !== e3.IsNeedReadReceipt && 1 !== e3.NeedReadReceipt || (s2.needReadReceipt = true), 1 === e3.SupportMessageExtension && (s2.isSupportExtension = true), (n3 = new Ha(s2)).status = Qt.UNSEND, e3.MsgClientTime = n3.clientTime, n3.conversationType === S.CONV_C2C && (e3.MsgSeq = n3.sequence);
  8097. for (var r2, i2 = e3.MsgBody.length, u2 = 0; u2 < i2; u2++)
  8098. "TIMTextElem" === (r2 = e3.MsgBody[u2]).MsgType ? n3.setTextElement(r2.MsgContent.Text) : "TIMCustomElem" === r2.MsgType ? n3.setCustomElement({ data: r2.MsgContent.Data || "", description: r2.MsgContent.Desc || "", extension: r2.MsgContent.Ext || "" }) : "TIMFaceElem" === r2.MsgType && n3.setFaceElement({ index: r2.MsgContent.Index, data: r2.MsgContent.Data });
  8099. var c2 = n3.getElements();
  8100. n3.payload = c2[0].content, n3.type = c2[0].type;
  8101. } catch (l2) {
  8102. n3 = null, xe.e("".concat(t3, " failed. error:"), l2);
  8103. }
  8104. return n3;
  8105. } }, { key: "_onSendMessageFailed", value: function(e3, t3) {
  8106. e3.status = Qt.FAIL, this.getModule(Fn).deleteMessageRandom(e3), this._addSendMessageFailCountOnUser(e3, t3);
  8107. var n3 = new ka("sendMessage");
  8108. return n3.setMessage("tjg_id:".concat(this.generateTjgID(e3), " type:").concat(e3.type, " from:").concat(e3.from, " to:").concat(e3.to)), this.probeNetwork().then(function(e4) {
  8109. var o2 = v(e4, 2), s2 = o2[0], a2 = o2[1];
  8110. n3.setError(t3, s2, a2).end();
  8111. }), xe.e("".concat(this._n, "._onSendMessageFailed error:"), t3), Ja(new Wa({ code: t3 && t3.code ? t3.code : da.MESSAGE_SEND_FAIL, message: t3 && t3.message ? t3.message : void 0, data: { message: e3 } }));
  8112. } }, { key: "_getSendMessageSpecifiedKey", value: function(e3) {
  8113. if (e3.conversationType === S.CONV_C2C)
  8114. return ha;
  8115. if (e3.conversationType === S.CONV_GROUP) {
  8116. var t3 = this.getModule(Un).getLocalGroupProfile(e3.to);
  8117. if (!t3)
  8118. return;
  8119. var n3 = t3.type;
  8120. return Ct(n3) ? va : fa;
  8121. }
  8122. } }, { key: "_addSendMessageTotalCount", value: function(e3) {
  8123. var t3 = this._getSendMessageSpecifiedKey(e3);
  8124. t3 && this.getModule($n).addTotalCount(t3);
  8125. } }, { key: "_addSendMessageSuccessCount", value: function(e3, t3) {
  8126. var n3 = Math.abs(Date.now() - t3), o2 = this._getSendMessageSpecifiedKey(e3);
  8127. if (o2) {
  8128. var s2 = this.getModule($n);
  8129. s2.addSuccessCount(o2), s2.addCost(o2, n3);
  8130. }
  8131. } }, { key: "_addSendMessageFailCountOnUser", value: function(e3, t3) {
  8132. var n3 = t3.code, o2 = void 0 === n3 ? -1 : n3, s2 = this.getModule($n), a2 = this._getSendMessageSpecifiedKey(e3);
  8133. hi(o2) && a2 && s2.addFailedCountOfUserSide(a2);
  8134. } }]), n2;
  8135. }(ro), Mi = function(e2) {
  8136. i(n2, e2);
  8137. var t2 = f(n2);
  8138. function n2(e3) {
  8139. var s2;
  8140. return o(this, n2), (s2 = t2.call(this, e3))._n = "PluginModule", s2.plugins = {}, s2;
  8141. }
  8142. return a(n2, [{ key: "registerPlugin", value: function(e3) {
  8143. var t3 = this;
  8144. Object.keys(e3).forEach(function(n3) {
  8145. t3.plugins[n3] = e3[n3];
  8146. }), new ka("registerPlugin").setMessage("".concat(Object.keys(e3))).end();
  8147. } }, { key: "getPlugin", value: function(e3) {
  8148. return this.plugins[e3];
  8149. } }, { key: "reset", value: function() {
  8150. } }]), n2;
  8151. }(ro), yi = function(e2) {
  8152. i(s2, e2);
  8153. var n2 = f(s2);
  8154. function s2(e3) {
  8155. var t2;
  8156. return o(this, s2), (t2 = n2.call(this, e3))._n = "SyncUnreadMessageModule", t2._cookie = "", t2._onlineSyncFlag = false, t2.getInnerEmitterInstance().on(Za, t2._onLoginSuccess, _(t2)), t2;
  8157. }
  8158. return a(s2, [{ key: "_onLoginSuccess", value: function(e3) {
  8159. this._startSync({ cookie: this._cookie, syncFlag: 0, isOnlineSync: 0 });
  8160. } }, { key: "_startSync", value: function(e3) {
  8161. var n3 = this, o2 = e3.cookie, s3 = e3.syncFlag, a2 = e3.isOnlineSync, r2 = "".concat(this._n, "._startSync");
  8162. xe.l("".concat(r2, " cookie:").concat(o2, " syncFlag:").concat(s3, " isOnlineSync:").concat(a2)), this.request({ protocolName: po, requestData: { cookie: o2, syncFlag: s3, isOnlineSync: a2 } }).then(function(e4) {
  8163. var o3 = e4.data, s4 = o3.cookie, a3 = o3.syncFlag;
  8164. n3._cookie = s4, jt(s4) || (0 === a3 || 1 === a3 ? (n3._dispatchUnreadMessage(t(t({}, e4.data), {}, { isSyncingEnded: false })), n3._startSync({ cookie: s4, syncFlag: a3, isOnlineSync: 0 })) : 2 === a3 && n3._dispatchUnreadMessage(t(t({}, e4.data), {}, { isSyncingEnded: true })));
  8165. }).catch(function(e4) {
  8166. xe.e("".concat(r2, " failed. error:"), e4);
  8167. });
  8168. } }, { key: "_dispatchUnreadMessage", value: function(e3) {
  8169. e3.eventArray && this.getModule(jn).onMessage({ head: {}, body: { eventArray: e3.eventArray, isInstantMessage: this._onlineSyncFlag, isSyncingEnded: e3.isSyncingEnded } });
  8170. this.getModule(Gn).onNewC2CMessage({ dataList: e3.messageList, isInstantMessage: !!e3.isSyncingEnded && this._onlineSyncFlag, C2CRemainingUnreadList: e3.C2CRemainingUnreadList, C2CPairUnreadList: e3.C2CPairUnreadList });
  8171. } }, { key: "startOnlineSync", value: function() {
  8172. xe.l("".concat(this._n, ".startOnlineSync")), this._onlineSyncFlag = true, this._startSync({ cookie: this._cookie, syncFlag: 0, isOnlineSync: 1 });
  8173. } }, { key: "startSyncOnReconnected", value: function() {
  8174. xe.l("".concat(this._n, ".startSyncOnReconnected.")), this._onlineSyncFlag = true, this._startSync({ cookie: this._cookie, syncFlag: 0, isOnlineSync: 0 });
  8175. } }, { key: "reset", value: function() {
  8176. xe.l("".concat(this._n, ".reset")), this._onlineSyncFlag = false, this._cookie = "";
  8177. } }]), s2;
  8178. }(ro), Ii = { request: { toAccount: "To_Account", fromAccount: "From_Account", to: "To_Account", from: "From_Account", groupID: "GroupId", groupAtUserID: "GroupAt_Account", extension: "Ext", data: "Data", description: "Desc", elements: "MsgBody", sizeType: "Type", downloadFlag: "Download_Flag", thumbUUID: "ThumbUUID", videoUUID: "VideoUUID", remoteAudioUrl: "Url", remoteVideoUrl: "VideoUrl", videoUrl: "", imageUrl: "URL", fileUrl: "Url", uuid: "UUID", priority: "MsgPriority", receiverUserID: "To_Account", receiverGroupID: "GroupId", messageSender: "SenderId", messageReceiver: "ReceiverId", nick: "From_AccountNick", avatar: "From_AccountHeadurl", messageNumber: "MsgNum", pbDownloadKey: "PbMsgKey", downloadKey: "JsonMsgKey", applicationType: "PendencyType", userIDList: "To_Account", groupNameList: "GroupName", userID: "To_Account", groupAttributeList: "GroupAttr", mainSequence: "AttrMainSeq", avChatRoomKey: "BytesKey", attributeControl: "AttrControl", sequence: "seq", messageControlInfo: "SendMsgControl", updateSequence: "UpdateSeq", clientTime: "MsgClientTime", sequenceList: "MsgSeqList", topicID: "TopicId", customData: "CustomString", isSupportTopic: "SupportTopic", isWebUniapp: "is_web_uniapp", isSupportExtension: "SupportMessageExtension", messageSequence: "MsgSeq", messageKey: "MsgKey", startSequence: "startSeq", simplifiedMessage: "DownsizeFlag" }, response: { MsgPriority: "priority", ThumbUUID: "thumbUUID", VideoUUID: "videoUUID", Download_Flag: "downloadFlag", GroupId: "groupID", Member_Account: "userID", MsgList: "messageList", SyncFlag: "syncFlag", To_Account: "to", From_Account: "from", MsgSeq: "sequence", MsgRandom: "random", MsgTime: "time", MsgTimeStamp: "time", MsgContent: "content", MsgBody: "elements", From_AccountNick: "nick", From_AccountHeadurl: "avatar", GroupWithdrawInfoArray: "revokedInfos", GroupReadInfoArray: "groupMessageReadNotice", LastReadMsgSeq: "lastMessageSeq", WithdrawC2cMsgNotify: "c2cMessageRevokedNotify", C2cWithdrawInfoArray: "revokedInfos", C2cReadedReceipt: "c2cMessageReadReceipt", ReadC2cMsgNotify: "c2cMessageReadNotice", LastReadTime: "peerReadTime", MsgRand: "random", MsgType: "type", MsgShow: "messageShow", NextMsgSeq: "nextMessageSeq", FaceUrl: "avatar", ProfileDataMod: "profileModify", Profile_Account: "userID", ValueBytes: "value", ValueNum: "value", NoticeSeq: "noticeSequence", NotifySeq: "notifySequence", MsgFrom_AccountExtraInfo: "messageFromAccountExtraInformation", Operator_Account: "operatorID", OpType: "operationType", ReportType: "operationType", UserId: "userID", User_Account: "userID", List_Account: "userIDList", MsgOperatorMemberExtraInfo: "operatorInfo", MsgMemberExtraInfo: "memberInfoList", ImageUrl: "avatar", NickName: "nick", MsgGroupNewInfo: "newGroupProfile", MsgAppDefinedData: "groupCustomField", Owner_Account: "ownerID", GroupFaceUrl: "avatar", GroupIntroduction: "introduction", GroupNotification: "notification", GroupApplyJoinOption: "joinOption", MsgKey: "messageKey", GroupInfo: "groupProfile", ShutupTime: "muteTime", Desc: "description", Ext: "extension", GroupAt_Account: "groupAtUserID", MsgNum: "messageNumber", PbMsgKey: "pbDownloadKey", JsonMsgKey: "downloadKey", MsgModifiedFlag: "isModified", PendencyItem: "applicationItem", PendencyType: "applicationType", AddTime: "time", AddSource: "source", AddWording: "wording", ProfileImImage: "avatar", PendencyAdd: "friendApplicationAdded", FrienPencydDel_Account: "friendApplicationDeletedUserIDList", Peer_Account: "userID", GroupAttr: "groupAttributeList", GroupAttrAry: "groupAttributeList", AttrMainSeq: "mainSequence", seq: "sequence", GroupAttrOption: "groupAttributeOption", BytesChangedKeys: "changedKeyList", GroupAttrInfo: "groupAttributeList", GroupAttrSeq: "mainSequence", PushChangedAttrValFlag: "isWithChangedAttributeInfo", SubKeySeq: "sequence", Val: "value", MsgGroupFromCardName: "senderNameCard", MsgGroupFromNickName: "senderNick", C2cNick: "peerNick", C2cImage: "peerAvatar", SendMsgControl: "messageControlInfo", NoLastMsg: "excludedFromLastMessage", NoUnread: "excludedFromUnreadCount", UpdateSeq: "updateSequence", MuteNotifications: "muteFlag", MsgClientTime: "clientTime", TinyId: "tinyID", GroupMsgReceiptList: "readReceiptList", ReadNum: "readCount", UnreadNum: "unreadCount", TopicId: "topicID", MillionGroupFlag: "communityType", SupportTopic: "isSupportTopic", MsgTopicNewInfo: "newTopicInfo", ShutupAll: "muteAllMembers", CustomString: "customData", TopicFaceUrl: "avatar", TopicIntroduction: "introduction", TopicNotification: "notification", TopicIdArray: "topicIDList", MsgVersion: "messageVersion", C2cMsgModNotifys: "c2cMessageModified", GroupMsgModNotifys: "groupMessageModified", ApplyJoinOption: "joinOption", MsgFlag: "messageRemindType", AtInfoList: "groupAtInfoList", AtFlagList: "groupAtType", AtMsgSeq: "sequence", BanDuration: "duration", BanDescription: "reason", NotVisible: "invisible", BytesTag: "tag", BytesValue: "value", RptBytesValue: "value", LatestSeq: "globalSequence", ClearSeq: "clearSequence", SupportMessageExtension: "isSupportExtension", ExtensionList: "extensions", GroupCounter: "counterList", Revoker_Account: "revoker", MsgExtensionNotify: "messageExtensionNotify", ExtensionC2cMsgInfo: "messageInfo", ExtensionGroupMsgInfo: "messageInfo", MsgOptType: "operateType", SetKVInfo: "operateResultList", DeleteKVInfo: "operateResultList", ClearKVInfo: "operateResultList", MsgKeyValue: "extensions", ClearMsgSeq: "clearSequence", MsgLastSeq: "globalSequence", InviteJoinOption: "inviteOption", MemberList_Account: "inviteeList", MsgMemberExtraInfoList: "inviteeInfoList", E: "event", GInf: "groupProfile", MCT: "clientTime", MR: "random", MP: "priority", MTS: "time", GId: "groupID", MS: "sequence", CCD: "cloudCustomData", F_Account: "from", F_Hd: "avatar", F_NN: "nick", GN: "groupName", GT: "groupType", IsSys: "isSystemMessage", OpInf: "operatorInfo", Img: "avatar", NN: "nick", OnlineInf: "onlineMemberInfo", ET: "expireTime", Num: "onlineMemberNum", Opt: "operationType", O_Account: "operatorID", RT: "operationType", UDF: "userDefinedField", L_Account: "userIDList" }, ignoreKeyWord: ["C2C", "ID", "USP"] };
  8179. function Ci(e2, t2) {
  8180. if ("string" != typeof e2 && !Array.isArray(e2))
  8181. throw new TypeError("Expected the input to be `string | string[]`");
  8182. t2 = Object.assign({ pascalCase: false }, t2);
  8183. var n2;
  8184. return 0 === (e2 = Array.isArray(e2) ? e2.map(function(e3) {
  8185. return e3.trim();
  8186. }).filter(function(e3) {
  8187. return e3.length;
  8188. }).join("-") : e2.trim()).length ? "" : 1 === e2.length ? t2.pascalCase ? e2.toUpperCase() : e2.toLowerCase() : (e2 !== e2.toLowerCase() && (e2 = Ti(e2)), e2 = e2.replace(/^[_.\- ]+/, "").toLowerCase().replace(/[_.\- ]+(\w|$)/g, function(e3, t3) {
  8189. return t3.toUpperCase();
  8190. }).replace(/\d+(\w|$)/g, function(e3) {
  8191. return e3.toUpperCase();
  8192. }), n2 = e2, t2.pascalCase ? n2.charAt(0).toUpperCase() + n2.slice(1) : n2);
  8193. }
  8194. var Ti = function(e2) {
  8195. for (var t2 = false, n2 = false, o2 = false, s2 = 0; s2 < e2.length; s2++) {
  8196. var a2 = e2[s2];
  8197. t2 && /[a-zA-Z]/.test(a2) && a2.toUpperCase() === a2 ? (e2 = e2.slice(0, s2) + "-" + e2.slice(s2), t2 = false, o2 = n2, n2 = true, s2++) : n2 && o2 && /[a-zA-Z]/.test(a2) && a2.toLowerCase() === a2 ? (e2 = e2.slice(0, s2 - 1) + "-" + e2.slice(s2 - 1), o2 = n2, n2 = false, t2 = true) : (t2 = a2.toLowerCase() === a2 && a2.toUpperCase() !== a2, o2 = n2, n2 = a2.toUpperCase() === a2 && a2.toLowerCase() !== a2);
  8198. }
  8199. return e2;
  8200. };
  8201. function Di(e2, t2) {
  8202. var n2 = 0;
  8203. return function e3(t3, o2) {
  8204. if (++n2 > 100)
  8205. return n2--, t3;
  8206. if (st(t3)) {
  8207. var s2 = t3.map(function(t4) {
  8208. return nt(t4) ? e3(t4, o2) : t4;
  8209. });
  8210. return n2--, s2;
  8211. }
  8212. if (nt(t3)) {
  8213. var a2 = (r2 = t3, i2 = function(e4, t4) {
  8214. if (!lt(t4))
  8215. return false;
  8216. if ((s3 = t4) !== Ci(s3))
  8217. for (var n3 = 0; n3 < Ii.ignoreKeyWord.length && !t4.includes(Ii.ignoreKeyWord[n3]); n3++)
  8218. ;
  8219. var s3;
  8220. return at(o2[t4]) ? function(e5) {
  8221. return "OPPOChannelID" === e5 ? e5 : e5[0].toUpperCase() + Ci(e5).slice(1);
  8222. }(t4) : o2[t4];
  8223. }, u2 = /* @__PURE__ */ Object.create(null), Object.keys(r2).forEach(function(e4) {
  8224. var t4 = i2(r2[e4], e4);
  8225. t4 && (u2[t4] = r2[e4]);
  8226. }), u2);
  8227. return a2 = Lt(a2, function(t4, n3) {
  8228. return st(t4) || nt(t4) ? e3(t4, o2) : t4;
  8229. }), n2--, a2;
  8230. }
  8231. var r2, i2, u2;
  8232. }(e2, t2);
  8233. }
  8234. function Ei(e2, t2) {
  8235. if (st(e2))
  8236. return e2.map(function(e3) {
  8237. return nt(e3) ? Ei(e3, t2) : e3;
  8238. });
  8239. if (nt(e2)) {
  8240. var n2 = (o2 = e2, s2 = function(e3, n3) {
  8241. return at(t2[n3]) ? Ci(n3) : t2[n3];
  8242. }, a2 = {}, Object.keys(o2).forEach(function(e3) {
  8243. a2[s2(o2[e3], e3)] = o2[e3];
  8244. }), a2);
  8245. return n2 = Lt(n2, function(e3) {
  8246. return st(e3) || nt(e3) ? Ei(e3, t2) : e3;
  8247. });
  8248. }
  8249. var o2, s2, a2;
  8250. }
  8251. var Si = String.fromCharCode, ki = function(e2) {
  8252. var t2 = 0 | e2.charCodeAt(0);
  8253. if (55296 <= t2)
  8254. if (t2 < 56320) {
  8255. var n2 = 0 | e2.charCodeAt(1);
  8256. if (56320 <= n2 && n2 <= 57343) {
  8257. if ((t2 = (t2 << 10) + n2 - 56613888 | 0) > 65535)
  8258. return Si(240 | t2 >>> 18, 128 | t2 >>> 12 & 63, 128 | t2 >>> 6 & 63, 128 | 63 & t2);
  8259. } else
  8260. t2 = 65533;
  8261. } else
  8262. t2 <= 57343 && (t2 = 65533);
  8263. return t2 <= 2047 ? Si(192 | t2 >>> 6, 128 | 63 & t2) : Si(224 | t2 >>> 12, 128 | t2 >>> 6 & 63, 128 | 63 & t2);
  8264. }, Li = function(e2) {
  8265. for (var t2 = void 0 === e2 ? "" : ("" + e2).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g, ki), n2 = 0 | t2.length, o2 = new Uint8Array(n2), s2 = 0; s2 < n2; s2 = s2 + 1 | 0)
  8266. o2[s2] = 0 | t2.charCodeAt(s2);
  8267. return o2;
  8268. }, Ai = function(e2) {
  8269. for (var t2 = new Uint8Array(e2), n2 = "", o2 = 0, s2 = t2.length; o2 < s2; ) {
  8270. var a2 = t2[o2], r2 = 0, i2 = 0;
  8271. if (a2 <= 127 ? (r2 = 0, i2 = 255 & a2) : a2 <= 223 ? (r2 = 1, i2 = 31 & a2) : a2 <= 239 ? (r2 = 2, i2 = 15 & a2) : a2 <= 244 && (r2 = 3, i2 = 7 & a2), s2 - o2 - r2 > 0)
  8272. for (var u2 = 0; u2 < r2; )
  8273. i2 = i2 << 6 | 63 & (a2 = t2[o2 + u2 + 1]), u2 += 1;
  8274. else
  8275. i2 = 65533, r2 = s2 - o2;
  8276. n2 += String.fromCodePoint(i2), o2 += r2 + 1;
  8277. }
  8278. return n2;
  8279. }, Ri = function() {
  8280. function e2(t2) {
  8281. o(this, e2), this._handler = t2;
  8282. var n2 = t2.getURL();
  8283. if (this._socket = null, this._workerSocket = null, this._id = _t(), this._handler.getIsWorkerEnabled()) {
  8284. var s2 = URL.createObjectURL(new Blob([';let _socket = null;onmessage = function(event) { if (event.data.cmd === "start") { const url = event.data.url; _socket = new WebSocket(url); _socket.binaryType = "arraybuffer"; _socket.onopen = function() { postMessage({ callback: "onOpen" }); }; _socket.onclose = function(e) { postMessage({ callback: "onOpen", e: { code: e.code, reason: e.reason } }); }; _socket.onmessage = function(e) { postMessage({ callback: "onMessage", data: e.data }); }; _socket.onerror = function(e) { postMessage({ callback: "onError", e: { isTrusted: "true" } }); }; } else if (event.data.cmd === "sendMessage") { if (_socket !== null) { _socket.send(event.data.data); } } else if (event.data.cmd === "stop") { if (_socket !== null) { _socket.close(event.data.code); _socket = null; } }};'], { type: "application/javascript; charset=utf-8" }));
  8285. this._workerSocket = new Worker(s2);
  8286. var a2 = this;
  8287. this._workerSocket.onmessage = function(e3) {
  8288. var t3 = e3.data, n3 = t3.callback, o2 = t3.e;
  8289. "onOpen" === n3 ? a2._onOpen() : "onClose" === n3 ? a2._onClose(o2) : "onError" === n3 ? a2._onError(o2) : "onMessage" === n3 && a2._onMessage(e3.data);
  8290. }, this._workerSocket.postMessage({ cmd: "start", id: this._id, url: n2 });
  8291. } else
  8292. se ? ee ? (re.connectSocket({ url: n2, header: { "content-type": "application/json" } }), re.onSocketClose(this._onClose.bind(this)), re.onSocketOpen(this._onOpen.bind(this)), re.onSocketMessage(this._onMessage.bind(this)), re.onSocketError(this._onError.bind(this))) : (this._socket = re.connectSocket({ url: n2, header: { "content-type": "application/json" }, complete: function() {
  8293. } }), this._socket.onClose(this._onClose.bind(this)), this._socket.onOpen(this._onOpen.bind(this)), this._socket.onMessage(this._onMessage.bind(this)), this._socket.onError(this._onError.bind(this))) : ae && (this._socket = new WebSocket(n2), this._socket.binaryType = "arraybuffer", this._socket.onopen = this._onOpen.bind(this), this._socket.onmessage = this._onMessage.bind(this), this._socket.onclose = this._onClose.bind(this), this._socket.onerror = this._onError.bind(this));
  8294. this._canIUseBinaryFrame = t2.canIUseBinaryFrame();
  8295. }
  8296. return a(e2, [{ key: "getID", value: function() {
  8297. return this._id;
  8298. } }, { key: "_onOpen", value: function() {
  8299. this._handler.onOpen({ id: this._id });
  8300. } }, { key: "_onClose", value: function(e3) {
  8301. this._handler.onClose({ id: this._id, e: e3 });
  8302. } }, { key: "_onMessage", value: function(e3) {
  8303. this._handler.onMessage({ data: this._canIUseBinaryFrame ? Ai(e3.data) : e3.data });
  8304. } }, { key: "_onError", value: function(e3) {
  8305. this._handler.onError({ id: this._id, e: e3 });
  8306. } }, { key: "setIsWorkerEnabled", value: function(e3) {
  8307. this._isWorkerEnabled = true;
  8308. } }, { key: "close", value: function(e3) {
  8309. if (this._workerSocket && (this._workerSocket.postMessage({ cmd: "stop", code: e3 }), this._workerSocket.terminate(), this._workerSocket = null), ee)
  8310. return re.offSocketClose(), re.offSocketMessage(), re.offSocketOpen(), re.offSocketError(), void re.closeSocket();
  8311. this._socket && (se ? (this._socket.onClose(function() {
  8312. }), this._socket.onOpen(function() {
  8313. }), this._socket.onMessage(function() {
  8314. }), this._socket.onError(function() {
  8315. })) : ae && (this._socket.onopen = null, this._socket.onmessage = null, this._socket.onclose = null, this._socket.onerror = null), $ ? this._socket.close({ code: e3 }) : this._socket.close(e3), this._socket = null);
  8316. } }, { key: "send", value: function(e3) {
  8317. if (this._workerSocket)
  8318. this._workerSocket.postMessage({ cmd: "sendMessage", data: this._canIUseBinaryFrame ? Li(e3.data).buffer : e3.data });
  8319. else {
  8320. if (ee)
  8321. return void re.sendSocketMessage({ data: e3.data, fail: function() {
  8322. e3.fail && e3.requestID && e3.fail(e3.requestID);
  8323. } });
  8324. this._socket && (se ? this._socket.send({ data: this._canIUseBinaryFrame ? Li(e3.data).buffer : e3.data, fail: function() {
  8325. e3.fail && e3.requestID && e3.fail(e3.requestID);
  8326. } }) : ae && this._socket.send(this._canIUseBinaryFrame ? Li(e3.data).buffer : e3.data));
  8327. }
  8328. } }]), e2;
  8329. }(), Ni = 4e3, Oi = 4001, Gi = ["keyMap"], Ui = ["keyMap"], Pi = "connected", bi = "connecting", wi = "disconnected", Fi = function() {
  8330. function e2(t2) {
  8331. o(this, e2), this._channelModule = t2, this._n = "SocketHandler", this._promiseMap = /* @__PURE__ */ new Map(), this._readyState = wi, this._simpleRequestMap = /* @__PURE__ */ new Map(), this.MAX_SIZE = 100, this._startSequence = _t(), this._startTs = 0, this._reConnectFlag = false, this._nextPingTs = 0, this._reConnectCount = 0, this.MAX_RECONNECT_COUNT = 3, this._socketID = -1, this._random = 0, this._socket = null, this._url = "", this._onOpenTs = 0, this._canIUseBinaryFrame = true, this._isWorkerEnabled = true, this._setWebsocketHost(), this._initConnection();
  8332. }
  8333. return a(e2, [{ key: "_setWebsocketHost", value: function() {
  8334. var e3 = this._channelModule.getModule(qn), t2 = G;
  8335. this._channelModule.isOversea() && (t2 = U), e3.isSingaporeSite() ? t2 = P : e3.isKoreaSite() ? t2 = b : e3.isGermanySite() ? t2 = w : e3.isIndiaSite() ? t2 = F : e3.isJapanSite() ? t2 = q : e3.isUSASite() && (t2 = x), V.HOST.setCurrent(t2);
  8336. } }, { key: "_initConnection", value: function() {
  8337. at(V.HOST.CURRENT.BACKUP) || "" === this._url ? this._url = V.HOST.CURRENT.DEFAULT : this._url === V.HOST.CURRENT.DEFAULT ? this._url = V.HOST.CURRENT.BACKUP : this._url === V.HOST.CURRENT.BACKUP ? this._url = this._canIUseAnyCast() ? V.HOST.CURRENT.ANYCAST : V.HOST.CURRENT.DEFAULT : this._url === V.HOST.CURRENT.ANYCAST && (V.HOST.CURRENT.ANYCAST = "", this._url = V.HOST.CURRENT.DEFAULT);
  8338. var e3 = this._channelModule.getModule(qn).getProxyServer();
  8339. jt(e3) || (this._url = e3), this._connect(), this._nextPingTs = 0;
  8340. } }, { key: "_canIUseAnyCast", value: function() {
  8341. return ae && V.HOST.CURRENT.ANYCAST;
  8342. } }, { key: "onCheckTimer", value: function(e3) {
  8343. e3 % 1 == 0 && this._checkPromiseMap();
  8344. } }, { key: "_checkPromiseMap", value: function() {
  8345. var e3 = this;
  8346. 0 !== this._promiseMap.size && this._promiseMap.forEach(function(t2, n2) {
  8347. var o2 = t2.reject, s2 = t2.timestamp, a2 = 15e3;
  8348. -1 !== n2.indexOf(io) && (a2 = 9e4), Date.now() - s2 >= a2 && (xe.l("".concat(e3._n, "._checkPromiseMap request timeout, delete requestID:").concat(n2)), e3._promiseMap.delete(n2), o2(new Wa({ code: da.NETWORK_TIMEOUT })), e3._channelModule.onRequestTimeout(n2));
  8349. });
  8350. } }, { key: "onOpen", value: function(e3) {
  8351. if ("" !== this._readyState) {
  8352. this._onOpenTs = Date.now();
  8353. var t2 = e3.id;
  8354. this._socketID = t2;
  8355. var n2 = Date.now() - this._startTs;
  8356. xe.l("".concat(this._n, "._onOpen cost ").concat(n2, " ms. socketID:").concat(t2)), new ka("wsOnOpen").setMessage(n2).setCostTime(n2).setMoreMessage("socketID:".concat(t2)).end(), e3.id === this._socketID && (this._readyState = Pi, this._reConnectCount = 0, this._resend(), true === this._reConnectFlag && (this._channelModule.onReconnected(), this._reConnectFlag = false), this._channelModule.onOpen());
  8357. }
  8358. } }, { key: "onClose", value: function(e3) {
  8359. var t2 = new ka("wsOnClose"), n2 = e3.id, o2 = e3.e, s2 = "sourceSocketID:".concat(n2, " currentSocketID:").concat(this._socketID, " code:").concat(o2.code, " reason:").concat(o2.reason), a2 = 0;
  8360. 0 !== this._onOpenTs && (a2 = Date.now() - this._onOpenTs), t2.setMessage(a2).setCostTime(a2).setMoreMessage(s2).setCode(o2.code).end(), xe.l("".concat(this._n, "._onClose ").concat(s2, " onlineTime:").concat(a2)), n2 === this._socketID && (this._readyState = wi, a2 < 1e3 ? this._channelModule.onReconnectFailed() : this._channelModule.onClose());
  8361. } }, { key: "onError", value: function(e3) {
  8362. var t2 = e3.id, n2 = e3.e, o2 = "sourceSocketID:".concat(t2, " currentSocketID:").concat(this._socketID);
  8363. new ka("wsOnError").setMessage(n2.errMsg || dt(n2)).setMoreMessage(o2).setLevel("error").end(), xe.w("".concat(this._n, "._onError"), n2, o2), t2 === this._socketID && (this._readyState = "", this._channelModule.onError());
  8364. } }, { key: "onMessage", value: function(e3) {
  8365. var t2;
  8366. try {
  8367. t2 = JSON.parse(e3.data);
  8368. } catch (c2) {
  8369. new ka("jsonParseError").setMessage(e3.data).end();
  8370. }
  8371. if (t2 && t2.head) {
  8372. var n2 = this._getRequestIDFromHead(t2.head), o2 = t2.body;
  8373. if (!this._isTRTCCommand(n2)) {
  8374. var s2 = Pt(t2.head);
  8375. o2 = Ei(t2.body, this._getResponseKeyMap(s2));
  8376. }
  8377. if (xe.d("".concat(this._n, ".onMessage ret:").concat(JSON.stringify(o2), " requestID:").concat(n2, " has:").concat(this._promiseMap.has(n2))), this._setNextPingTs(), this._promiseMap.has(n2)) {
  8378. var a2 = this._promiseMap.get(n2), r2 = a2.resolve, i2 = a2.reject, u2 = a2.timestamp;
  8379. return this._promiseMap.delete(n2), this._calcRTT(u2), void (o2.errorCode && 0 !== o2.errorCode ? (this._channelModule.onErrorCodeNotZero(o2), i2(new Wa({ code: o2.errorCode, message: o2.errorInfo || "", data: n2.includes(Lo) || n2.includes(ms) ? { elements: o2.elements, messageVersion: o2.messageVersion, cloudCustomData: o2.cloudCustomData } : void 0 }))) : r2(Ka(o2)));
  8380. }
  8381. this._channelModule.onMessage({ head: t2.head, body: o2 });
  8382. }
  8383. } }, { key: "_isTRTCCommand", value: function(e3) {
  8384. for (var t2 = this._channelModule.getModule(oo).getCommandList(), n2 = false, o2 = 0; o2 < t2.length; o2++)
  8385. if (e3.startsWith(t2[o2])) {
  8386. n2 = true;
  8387. break;
  8388. }
  8389. return n2;
  8390. } }, { key: "_calcRTT", value: function(e3) {
  8391. var t2 = Date.now() - e3;
  8392. this._channelModule.getModule($n).addRTT(t2);
  8393. } }, { key: "_connect", value: function() {
  8394. this._startTs = Date.now(), this._onOpenTs = 0, this._socket = new Ri(this), this._socketID = this._socket.getID(), this._readyState = bi, xe.l("".concat(this._n, "._connect isWorkerEnabled:").concat(this.getIsWorkerEnabled(), " socketID:").concat(this._socketID, " url:").concat(this.getURL())), new ka("wsConnect").setMessage("socketID:".concat(this._socketID, " url:").concat(this.getURL())).end();
  8395. } }, { key: "getURL", value: function() {
  8396. this._channelModule.isDevMode() && (this._canIUseBinaryFrame = false);
  8397. var e3 = Nt();
  8398. (ee || X && "windows" === e3 || ne) && (this._canIUseBinaryFrame = false);
  8399. var t2 = -1;
  8400. "ios" === e3 ? t2 = ve || -1 : "android" === e3 && (t2 = Me || -1);
  8401. var n2 = this._channelModule.getModule(qn), o2 = this._channelModule.getPlatform(), s2 = n2.getSDKAppID(), a2 = n2.getInstanceID(), r2 = "sdkappid=".concat(s2, "&instanceid=").concat(a2, "&random=").concat(this._getRandom(), "&platform=").concat(o2, "&host=").concat(e3, "&version=").concat(t2);
  8402. return this._canIUseBinaryFrame ? "".concat(this._url, "/binfo?").concat(r2) : "".concat(this._url, "/info?").concat(r2);
  8403. } }, { key: "_closeConnection", value: function(e3) {
  8404. xe.l("".concat(this._n, "._closeConnection socketID:").concat(this._socketID)), this._socket && (this._socket.close(e3), this._socketID = -1, this._socket = null, this._readyState = wi);
  8405. } }, { key: "_resend", value: function() {
  8406. var e3 = this;
  8407. if (xe.l("".concat(this._n, "._resend reConnectFlag:").concat(this._reConnectFlag), "promiseMap.size:".concat(this._promiseMap.size, " simpleRequestMap.size:").concat(this._simpleRequestMap.size)), this._promiseMap.size > 0 && this._promiseMap.forEach(function(t3, n3) {
  8408. var o3 = t3.uplinkData, s3 = t3.resolve, a3 = t3.reject;
  8409. e3._promiseMap.set(n3, { resolve: s3, reject: a3, timestamp: Date.now(), uplinkData: o3 }), e3._execute(n3, o3);
  8410. }), this._simpleRequestMap.size > 0) {
  8411. var t2, n2 = D(this._simpleRequestMap);
  8412. try {
  8413. for (n2.s(); !(t2 = n2.n()).done; ) {
  8414. var o2 = v(t2.value, 2), s2 = o2[0], a2 = o2[1];
  8415. this._execute(s2, a2);
  8416. }
  8417. } catch (r2) {
  8418. n2.e(r2);
  8419. } finally {
  8420. n2.f();
  8421. }
  8422. this._simpleRequestMap.clear();
  8423. }
  8424. } }, { key: "send", value: function(e3) {
  8425. var t2 = this;
  8426. e3.head.seq = this._getSequence(), e3.head.reqtime = Math.floor(Date.now() / 1e3), e3.keyMap;
  8427. var n2 = g(e3, Gi), o2 = this._getRequestIDFromHead(e3.head), s2 = JSON.stringify(n2);
  8428. return new Promise(function(e4, a2) {
  8429. (t2._promiseMap.set(o2, { resolve: e4, reject: a2, timestamp: Date.now(), uplinkData: s2 }), xe.d("".concat(t2._n, ".send uplinkData:").concat(JSON.stringify(n2), " requestID:").concat(o2, " readyState:").concat(t2._readyState)), t2._readyState !== Pi) ? t2._reConnect() : (t2._execute(o2, s2), t2._channelModule.getModule($n).addRequestCount());
  8430. });
  8431. } }, { key: "simplySend", value: function(e3) {
  8432. e3.head.seq = this._getSequence(), e3.head.reqtime = Math.floor(Date.now() / 1e3), e3.keyMap;
  8433. var t2 = g(e3, Ui), n2 = this._getRequestIDFromHead(e3.head), o2 = JSON.stringify(t2);
  8434. this._readyState !== Pi ? (this._simpleRequestMap.size < this.MAX_SIZE ? this._simpleRequestMap.set(n2, o2) : xe.l("".concat(this._n, ".simplySend. simpleRequestMap is full, drop request!")), this._reConnect()) : this._execute(n2, o2);
  8435. } }, { key: "_execute", value: function(e3, t2) {
  8436. this._socket.send({ data: t2, fail: se ? this._onSendFail.bind(this) : void 0, requestID: e3 });
  8437. } }, { key: "_onSendFail", value: function(e3) {
  8438. xe.l("".concat(this._n, "._onSendFail requestID:").concat(e3));
  8439. } }, { key: "_getSequence", value: function() {
  8440. var e3;
  8441. if (this._startSequence < 2415919103)
  8442. return e3 = this._startSequence, this._startSequence += 1, 2415919103 === this._startSequence && (this._startSequence = _t()), e3;
  8443. } }, { key: "_getRequestIDFromHead", value: function(e3) {
  8444. return e3.servcmd + e3.seq;
  8445. } }, { key: "_getResponseKeyMap", value: function(e3) {
  8446. var n2 = this._channelModule.getKeyMap(e3);
  8447. return t(t({}, Ii.response), n2.response);
  8448. } }, { key: "_reConnect", value: function() {
  8449. this._readyState !== Pi && this._readyState !== bi && this.forcedReconnect();
  8450. } }, { key: "forcedReconnect", value: function() {
  8451. var e3 = this, t2 = "".concat(this._n, ".forcedReconnect");
  8452. xe.l("".concat(t2, " count:").concat(this._reConnectCount, " readyState:").concat(this._readyState)), this._reConnectFlag = true, this._resetRandom(), this._reConnectCount < this.MAX_RECONNECT_COUNT ? (this._reConnectCount += 1, this._closeConnection(Oi), this._initConnection()) : (this._reConnectCount = 0, this._channelModule.probeNetwork().then(function(n2) {
  8453. var o2 = v(n2, 2), s2 = o2[0];
  8454. o2[1], s2 ? (xe.w("".concat(t2, " disconnected from wsserver but network is ok, continue...")), e3._closeConnection(Oi), e3._initConnection()) : e3._channelModule.onReconnectFailed();
  8455. }));
  8456. } }, { key: "getReconnectFlag", value: function() {
  8457. return this._reConnectFlag;
  8458. } }, { key: "_setNextPingTs", value: function() {
  8459. this._nextPingTs = Date.now() + 1e4;
  8460. } }, { key: "getNextPingTs", value: function() {
  8461. return this._nextPingTs;
  8462. } }, { key: "isConnected", value: function() {
  8463. return this._readyState === Pi;
  8464. } }, { key: "canIUseBinaryFrame", value: function() {
  8465. return this._canIUseBinaryFrame;
  8466. } }, { key: "setIsWorkerEnabled", value: function(e3) {
  8467. xe.l("".concat(this._n, ".setIsWorkerEnabled flag:").concat(e3)), this._isWorkerEnabled = e3;
  8468. } }, { key: "getIsWorkerEnabled", value: function() {
  8469. return this._isWorkerEnabled && Se;
  8470. } }, { key: "_getRandom", value: function() {
  8471. return 0 === this._random && (this._random = Math.random()), this._random;
  8472. } }, { key: "_resetRandom", value: function() {
  8473. this._random = 0;
  8474. } }, { key: "close", value: function() {
  8475. xe.l("".concat(this._n, ".close")), this._closeConnection(Ni), this._promiseMap.clear(), this._startSequence = _t(), this._readyState = wi, this._simpleRequestMap.clear(), this._reConnectFlag = false, this._reConnectCount = 0, this._onOpenTs = 0, this._url = "", this._random = 0, this._canIUseBinaryFrame = true, this._isWorkerEnabled = true;
  8476. } }]), e2;
  8477. }(), qi = function(e2) {
  8478. i(n2, e2);
  8479. var t2 = f(n2);
  8480. function n2(e3) {
  8481. var s2;
  8482. if (o(this, n2), (s2 = t2.call(this, e3))._n = "ChannelModule", s2._socketHandler = new Fi(_(s2)), s2._probing = false, s2._isAppShowing = true, s2._previousState = S.NET_STATE_CONNECTED, se && "function" == typeof re.onAppShow && "function" == typeof re.onAppHide) {
  8483. var a2 = s2._onAppHide.bind(_(s2)), r2 = s2._onAppShow.bind(_(s2));
  8484. "function" == typeof re.offAppHide && re.offAppHide(a2), "function" == typeof re.offAppShow && re.offAppShow(r2), re.onAppHide(a2), re.onAppShow(r2);
  8485. }
  8486. return s2._timerForNotLoggedIn = -1, s2._timerForNotLoggedIn = setInterval(s2.onCheckTimer.bind(_(s2)), 1e3), s2._fatalErrorFlag = false, s2;
  8487. }
  8488. return a(n2, [{ key: "onCheckTimer", value: function(e3) {
  8489. this._socketHandler && (this.isLoggedIn() ? (this._timerForNotLoggedIn > 0 && (clearInterval(this._timerForNotLoggedIn), this._timerForNotLoggedIn = -1), this._socketHandler.onCheckTimer(e3)) : this._socketHandler.onCheckTimer(1), this._checkNextPing());
  8490. } }, { key: "onErrorCodeNotZero", value: function(e3) {
  8491. this.getModule(jn).onErrorCodeNotZero(e3);
  8492. } }, { key: "onMessage", value: function(e3) {
  8493. this.getModule(jn).onMessage(e3);
  8494. } }, { key: "send", value: function(e3) {
  8495. return this._socketHandler ? this._previousState !== S.NET_STATE_CONNECTED && e3.head.servcmd.includes(xs) ? (this.reConnect(), this._sendLogViaHTTP(e3)) : this._socketHandler.send(e3) : Promise.reject();
  8496. } }, { key: "_sendLogViaHTTP", value: function(e3) {
  8497. var t3 = V.HOST.CURRENT.STAT;
  8498. return new Promise(function(n3, o2) {
  8499. var s2 = "".concat(t3, "/v4/imopenstat/tim_web_report_v2?sdkappid=").concat(e3.head.sdkappid, "&reqtime=").concat(Date.now()), a2 = JSON.stringify(e3.body), r2 = "application/x-www-form-urlencoded;charset=UTF-8";
  8500. if (se)
  8501. re.request({ url: s2, data: a2, method: "POST", timeout: 3e3, header: { "content-type": r2 }, success: function() {
  8502. n3();
  8503. }, fail: function() {
  8504. o2(new Wa({ code: da.NETWORK_ERROR }));
  8505. } });
  8506. else {
  8507. var i2 = new XMLHttpRequest(), u2 = setTimeout(function() {
  8508. i2.abort(), o2(new Wa({ code: da.NETWORK_TIMEOUT }));
  8509. }, 3e3);
  8510. i2.onreadystatechange = function() {
  8511. 4 === i2.readyState && (clearTimeout(u2), 200 === i2.status || 304 === i2.status ? n3() : o2(new Wa({ code: da.NETWORK_ERROR })));
  8512. }, i2.open("POST", s2, true), i2.setRequestHeader("Content-type", r2), i2.send(a2);
  8513. }
  8514. });
  8515. } }, { key: "simplySend", value: function(e3) {
  8516. return this._socketHandler ? this._socketHandler.simplySend(e3) : Promise.reject();
  8517. } }, { key: "onOpen", value: function() {
  8518. this._ping();
  8519. } }, { key: "onClose", value: function() {
  8520. this._socketHandler && (this._socketHandler.getReconnectFlag() && this._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED));
  8521. this.reConnect();
  8522. } }, { key: "onError", value: function() {
  8523. se && !ne && this.outputWarning("DomainNameInMP"), this._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED);
  8524. } }, { key: "getKeyMap", value: function(e3) {
  8525. return this.getModule(jn).getKeyMap(e3);
  8526. } }, { key: "_onAppHide", value: function() {
  8527. this._isAppShowing = false;
  8528. } }, { key: "_onAppShow", value: function() {
  8529. this._isAppShowing = true;
  8530. } }, { key: "onRequestTimeout", value: function(e3) {
  8531. } }, { key: "onReconnected", value: function() {
  8532. xe.l("".concat(this._n, ".onReconnected")), this._m.restartTimer(), this.getModule(jn).onReconnected(), this._emitNetStateChangeEvent(S.NET_STATE_CONNECTED);
  8533. } }, { key: "onReconnectFailed", value: function() {
  8534. xe.l("".concat(this._n, ".onReconnectFailed")), this._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED);
  8535. } }, { key: "setIsWorkerEnabled", value: function(e3) {
  8536. this._socketHandler && this._socketHandler.setIsWorkerEnabled(false);
  8537. } }, { key: "offline", value: function() {
  8538. this._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED);
  8539. } }, { key: "reConnect", value: function() {
  8540. var e3 = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], t3 = false;
  8541. this._socketHandler && (t3 = this._socketHandler.getReconnectFlag());
  8542. var n3 = "forcedFlag:".concat(e3, " fatalErrorFlag:").concat(this._fatalErrorFlag, " previousState:").concat(this._previousState, " reconnectFlag:").concat(t3);
  8543. if (xe.l("".concat(this._n, ".reConnect ").concat(n3)), !this._fatalErrorFlag && this._socketHandler) {
  8544. if (true === e3)
  8545. this._socketHandler.forcedReconnect();
  8546. else {
  8547. if (this._previousState === S.NET_STATE_CONNECTING && t3)
  8548. return;
  8549. this._socketHandler.forcedReconnect();
  8550. }
  8551. this._emitNetStateChangeEvent(S.NET_STATE_CONNECTING);
  8552. }
  8553. } }, { key: "_emitNetStateChangeEvent", value: function(e3) {
  8554. this._previousState !== e3 && (xe.l("".concat(this._n, "._emitNetStateChangeEvent from ").concat(this._previousState, " to ").concat(e3)), this._previousState = e3, this.emitOuterEvent(E.NET_STATE_CHANGE, { state: e3 }));
  8555. } }, { key: "_ping", value: function() {
  8556. var e3 = this;
  8557. if (true !== this._probing) {
  8558. this._probing = true;
  8559. var t3 = this.getModule(jn).getProtocolData({ protocolName: Vs });
  8560. this.send(t3).then(function() {
  8561. e3._probing = false;
  8562. }).catch(function(t4) {
  8563. if (xe.w("".concat(e3._n, "._ping failed. error:"), t4), e3._probing = false, t4 && 60002 === t4.code)
  8564. return new ka("error").setMessage("code:".concat(t4.code, " message:").concat(t4.message)).setNetworkType(e3.getModule(Bn).getNetworkType()).end(), e3._fatalErrorFlag = true, void e3._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED);
  8565. e3.probeNetwork().then(function(t5) {
  8566. var n3 = v(t5, 2), o2 = n3[0], s2 = n3[1];
  8567. xe.l("".concat(e3._n, "._ping failed. probe network, isAppShowing:").concat(e3._isAppShowing, " online:").concat(o2, " networkType:").concat(s2)), o2 ? e3.reConnect() : e3._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED);
  8568. });
  8569. });
  8570. }
  8571. } }, { key: "_checkNextPing", value: function() {
  8572. this._socketHandler && (this._socketHandler.isConnected() && Date.now() >= this._socketHandler.getNextPingTs() && this._ping());
  8573. } }, { key: "dealloc", value: function() {
  8574. this._socketHandler && (this._socketHandler.close(), this._socketHandler = null), this._timerForNotLoggedIn > -1 && clearInterval(this._timerForNotLoggedIn);
  8575. } }, { key: "onRestApiKickedOut", value: function() {
  8576. this._socketHandler && (this._socketHandler.close(), this.reConnect(true));
  8577. } }, { key: "reset", value: function() {
  8578. xe.l("".concat(this._n, ".reset")), this._previousState = S.NET_STATE_CONNECTED, this._probing = false, this._fatalErrorFlag = false, this._timerForNotLoggedIn = setInterval(this.onCheckTimer.bind(this), 1e3);
  8579. } }]), n2;
  8580. }(ro), xi = ["a2", "tinyid"], Vi = ["a2", "tinyid"], Bi = function() {
  8581. function e2(t2) {
  8582. o(this, e2), this._n = "ProtocolHandler", this._sessionModule = t2, this._configMap = /* @__PURE__ */ new Map(), this._fillConfigMap();
  8583. }
  8584. return a(e2, [{ key: "_fillConfigMap", value: function() {
  8585. this._configMap.clear();
  8586. var e3 = this._sessionModule.genCommonHead(), n2 = this._sessionModule.genCosSpecifiedHead(), o2 = this._sessionModule.genSSOReportHead(), s2 = this._sessionModule.isIntl();
  8587. this._configMap.set(io, function(e4) {
  8588. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_OPEN_STATUS, ".").concat(V.CMD.LOGIN) }), body: { state: "Online", isWebUniapp: 0, deviceBrand: 0 }, keyMap: { request: { deviceBrand: "InstType" }, response: { InstId: "instanceID", HelloInterval: "helloInterval" } } };
  8589. }(e3)), this._configMap.set(uo, function(e4) {
  8590. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_OPEN_STATUS, ".").concat(V.CMD.LOGOUT) }), body: { type: 0 }, keyMap: { request: { type: "wslogout_type" } } };
  8591. }(e3)), this._configMap.set(co, function(e4) {
  8592. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_OPEN_STATUS, ".").concat(V.CMD.HELLO) }), body: { isWebUniapp: 0 }, keyMap: { response: { NewInstInfo: "newInstanceInfo" } } };
  8593. }(e3)), this._configMap.set(lo, function(e4) {
  8594. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.STAT_SERVICE, ".").concat(V.CMD.KICK_OTHER) }), body: {} };
  8595. }(e3)), this._configMap.set(ws, function(e4) {
  8596. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_COS_SIGN, ".").concat(V.CMD.COS_SIGN) }), body: { cmd: "open_im_cos_svc", subCmd: "get_cos_token", duration: 300, version: 2 }, keyMap: { request: { userSig: "usersig", subCmd: "sub_cmd", cmd: "cmd", duration: "duration", version: "version" }, response: { expired_time: "expiredTime", bucket_name: "bucketName", session_token: "sessionToken", tmp_secret_id: "secretId", tmp_secret_key: "secretKey" } } };
  8597. }(n2)), this._configMap.set(Fs, function(e4) {
  8598. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.CUSTOM_UPLOAD, ".").concat(V.CMD.COS_PRE_SIG) }), body: { fileType: void 0, fileName: void 0, uploadMethod: 0, duration: 900 }, keyMap: { request: { userSig: "usersig", fileType: "file_type", fileName: "file_name", uploadMethod: "upload_method" }, response: { expired_time: "expiredTime", request_id: "requestId", head_url: "headUrl", upload_url: "uploadUrl", download_url: "downloadUrl", ci_url: "ciUrl", snapshot_url: "requestSnapshotUrl" } } };
  8599. }(n2)), this._configMap.set(qs, function(e4) {
  8600. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.CUSTOM_UPLOAD, ".").concat(V.CMD.VIDEO_COVER) }), body: { version: 1, platform: void 0, coverName: void 0, requestSnapshotUrl: void 0 }, keyMap: { request: { version: "version", platform: "platform", coverName: "cover_name", requestSnapshotUrl: "snapshot_url" }, response: { error_code: "errorCode", error_msg: "errorInfo", download_url: "snapshotUrl" } } };
  8601. }(n2)), this._configMap.set(Xs, function(e4) {
  8602. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_CONFIG_MANAGER, ".").concat(V.CMD.FETCH_COMMERCIAL_CONFIG) }), body: { SDKAppID: 0 }, keyMap: { request: { SDKAppID: "uint32_sdkappid" }, response: { int32_error_code: "errorCode", str_error_message: "errorMessage", str_purchase_bits: "purchaseBits", uint32_expired_time: "expiredTime" } } };
  8603. }(e3)), this._configMap.set(Qs, function(e4) {
  8604. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_CONFIG_MANAGER, ".").concat(V.CMD.PUSHED_COMMERCIAL_CONFIG) }), body: {}, keyMap: { response: { int32_error_code: "errorCode", str_error_message: "errorMessage", str_purchase_bits: "purchaseBits", uint32_expired_time: "expiredTime" } } };
  8605. }(e3)), this._configMap.set(zs, function(e4) {
  8606. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_CONFIG_MANAGER, ".").concat(V.CMD.FETCH_CLOUD_CONTROL_CONFIG) }), body: { SDKAppID: 0, version: 0 }, keyMap: { request: { SDKAppID: "uint32_sdkappid", version: "uint64_version" }, response: { int32_error_code: "errorCode", str_error_message: "errorMessage", str_json_config: "cloudControlConfig", uint32_expired_time: "expiredTime", uint32_sdkappid: "SDKAppID", uint64_version: "version" } } };
  8607. }(e3)), this._configMap.set(Js, function(e4) {
  8608. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_CONFIG_MANAGER, ".").concat(V.CMD.PUSHED_CLOUD_CONTROL_CONFIG) }), body: {}, keyMap: { response: { int32_error_code: "errorCode", str_error_message: "errorMessage", str_json_config: "cloudControlConfig", uint32_expired_time: "expiredTime", uint32_sdkappid: "SDKAppID", uint64_version: "version" } } };
  8609. }(e3)), this._configMap.set(Zs, function(e4) {
  8610. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OVERLOAD_PUSH, ".").concat(V.CMD.OVERLOAD_NOTIFY) }), body: {}, keyMap: { response: { OverLoadServCmd: "overloadCommand", DelaySecs: "waitingTime" } } };
  8611. }(e3)), this._configMap.set(po, function(e4) {
  8612. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM, ".").concat(V.CMD.GET_MESSAGES) }), body: { cookie: "", syncFlag: 0, needAbstract: 1, isOnlineSync: 0, needSignaling: 1 }, keyMap: { request: { fromAccount: "From_Account", toAccount: "To_Account", from: "From_Account", to: "To_Account", time: "MsgTimeStamp", sequence: "MsgSeq", random: "MsgRandom", elements: "MsgBody" }, response: { MsgList: "messageList", SyncFlag: "syncFlag", To_Account: "to", From_Account: "from", ClientSeq: "clientSequence", MsgSeq: "sequence", NoticeSeq: "noticeSequence", NotifySeq: "notifySequence", MsgRandom: "random", MsgTimeStamp: "time", MsgContent: "content", ToGroupId: "to", MsgKey: "messageKey", GroupTips: "groupTips", MsgBody: "elements", MsgType: "type", C2CRemainingUnreadCount: "C2CRemainingUnreadList", C2CPairUnreadCount: "C2CPairUnreadList" } } };
  8613. }(e3)), s2 || (this._configMap.set(go, function(e4) {
  8614. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM, ".").concat(V.CMD.BIG_DATA_HALLWAY_AUTH_KEY) }), body: {} };
  8615. }(e3)), this._configMap.set(la, function(e4) {
  8616. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_MSG_AUDIT_MGR, ".").concat(V.CMD.GET_RPOFANITY_LIST) }), body: { version: 0, deviceID: "", startIndex: void 0 }, keyMap: { request: { version: "uint64_version", deviceID: "str_device_id", startIndex: "uint64_start_index" }, response: { msg_cmd_error_code: "errorInfo", str_err_msg: "errorMessage", uint32_code: "errorCode", msg_scene_ctl_config: "filterConfig", uint64_c2c_custom_msg_flag: "c2c_custom_message", uint64_c2c_text_msg_flag: "c2c_text_message", uint64_group_custom_msg_flag: "group_custom_message", uint64_group_text_msg_flag: "group_text_message", uint64_group_info_flag: "group_profile", uint64_group_member_info_flag: "group_member_profile", uint64_relation_chain_flag: "sns", uint64_user_info_flag: "user_profile", rpt_msg_dirty_word: "lexicon", str_dirty_word: "profanity", str_replaced_content: "replacement", uint64_filter_type: "filterType", uint64_id: "id", uint64_word_type: "profanityType", uint64_complete_flag: "completeFlag", uint64_next_start_index: "nextStartIndex", uint64_version: "version", uint64_expired_time: "expiredTime" } } };
  8617. }(e3))), this._configMap.set(_o, function(e4) {
  8618. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM, ".").concat(V.CMD.SEND_MESSAGE) }), body: { fromAccount: "", toAccount: "", msgSeq: 0, msgRandom: 0, msgBody: [], cloudCustomData: void 0, nick: "", avatar: "", msgLifeTime: void 0, offlinePushInfo: { pushFlag: 0, title: "", desc: "", ext: "", apnsInfo: { badgeMode: 0, isVoipPush: void 0 }, androidInfo: { OPPOChannelID: "" } }, messageControlInfo: void 0, clientTime: void 0, needReadReceipt: 0, isSupportExtension: 0 }, keyMap: { request: { fromAccount: "From_Account", toAccount: "To_Account", msgTimeStamp: "MsgTimeStamp", msgSeq: "MsgSeq", msgRandom: "MsgRandom", msgBody: "MsgBody", count: "MaxCnt", lastMessageTime: "LastMsgTime", messageKey: "MsgKey", peerAccount: "Peer_Account", data: "Data", description: "Desc", extension: "Ext", type: "MsgType", content: "MsgContent", sizeType: "Type", uuid: "UUID", url: "", imageUrl: "URL", fileUrl: "Url", remoteAudioUrl: "Url", remoteVideoUrl: "VideoUrl", thumbUUID: "ThumbUUID", videoUUID: "VideoUUID", videoUrl: "", downloadFlag: "Download_Flag", nick: "From_AccountNick", avatar: "From_AccountHeadurl", from: "From_Account", time: "MsgTimeStamp", messageRandom: "MsgRandom", messageSequence: "MsgSeq", elements: "MsgBody", clientSequence: "ClientSeq", payload: "MsgContent", messageList: "MsgList", messageNumber: "MsgNum", abstractList: "AbstractList", messageBody: "MsgBody", needReadReceipt: "IsNeedReadReceipt" } } };
  8619. }(e3)), this._configMap.set(ho, function(e4) {
  8620. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.SEND_GROUP_MESSAGE) }), body: { fromAccount: "", groupID: "", random: 0, clientSequence: 0, priority: "", msgBody: [], cloudCustomData: void 0, onlineOnlyFlag: 0, offlinePushInfo: { pushFlag: 0, title: "", desc: "", ext: "", apnsInfo: { badgeMode: 0, isVoipPush: void 0 }, androidInfo: { OPPOChannelID: "" } }, groupAtInfo: [], messageControlInfo: void 0, clientTime: void 0, needReadReceipt: 0, topicID: void 0, receiverList: void 0, isSupportExtension: 0 }, keyMap: { request: { to: "GroupId", extension: "Ext", data: "Data", description: "Desc", random: "Random", sequence: "ReqMsgSeq", count: "ReqMsgNumber", type: "MsgType", priority: "MsgPriority", content: "MsgContent", elements: "MsgBody", sizeType: "Type", uuid: "UUID", url: "", imageUrl: "URL", fileUrl: "Url", remoteAudioUrl: "Url", remoteVideoUrl: "VideoUrl", thumbUUID: "ThumbUUID", videoUUID: "VideoUUID", videoUrl: "", downloadFlag: "Download_Flag", clientSequence: "ClientSeq", from: "From_Account", time: "MsgTimeStamp", messageRandom: "MsgRandom", messageSequence: "MsgSeq", payload: "MsgContent", messageList: "MsgList", messageNumber: "MsgNum", abstractList: "AbstractList", messageBody: "MsgBody", needReadReceipt: "NeedReadReceipt", receiverList: "To_Account" }, response: { MsgTime: "time", MsgSeq: "sequence" } } };
  8621. }(e3)), this._configMap.set(Io, function(e4) {
  8622. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM, ".").concat(V.CMD.REVOKE_C2C_MESSAGE) }), body: { msgInfo: { fromAccount: "", toAccount: "", msgTimeStamp: 0, msgSeq: 0, msgRandom: 0 } }, keyMap: { request: { msgInfo: "MsgInfo", msgTimeStamp: "MsgTimeStamp", msgSeq: "MsgSeq", msgRandom: "MsgRandom" } } };
  8623. }(e3)), this._configMap.set(ss, function(e4) {
  8624. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.REVOKE_GROUP_MESSAGE) }), body: { groupID: "", msgSeqList: void 0, topicID: "" }, keyMap: { request: { msgSeqList: "MsgSeqList", msgSeq: "MsgSeq" } } };
  8625. }(e3)), this._configMap.set(Eo, function(e4) {
  8626. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM, ".").concat(V.CMD.GET_C2C_ROAM_MESSAGES) }), body: { peerAccount: "", count: 15, lastMessageTime: 0, messageKey: "", withRecalledMessage: 1, direction: 0 }, keyMap: { request: { messageKey: "MsgKey", peerAccount: "Peer_Account", count: "MaxCnt", lastMessageTime: "LastMsgTime", withRecalledMessage: "WithRecalledMsg", direction: "GetDirection" }, response: { LastMsgTime: "lastMessageTime", IsNeedReadReceipt: "needReadReceipt", IsPeerRead: "readReceiptSentByPeer" } } };
  8627. }(e3)), this._configMap.set(Lo, function(e4) {
  8628. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM, ".").concat(V.CMD.MODIFY_C2C_MESSAGE) }), body: { from: "", to: "", sequence: 0, random: 0, time: 0, version: 0, elements: void 0, cloudCustomData: void 0 }, keyMap: { request: { sequence: "MsgSeq", random: "MsgRandom", time: "MsgTime", version: "MsgVersion", type: "MsgType", content: "MsgContent" } } };
  8629. }(e3)), this._configMap.set(is, function(e4) {
  8630. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.GET_GROUP_ROAM_MESSAGES) }), body: { withRecalledMsg: 1, groupID: "", count: 15, sequence: "", topicID: void 0 }, keyMap: { request: { sequence: "ReqMsgSeq", count: "ReqMsgNumber", withRecalledMessage: "WithRecalledMsg" }, response: { Random: "random", MsgTime: "time", MsgSeq: "sequence", ReqMsgSeq: "sequence", RspMsgList: "messageList", IsPlaceMsg: "isPlaceMessage", IsSystemMsg: "isSystemMessage", ToGroupId: "to", EnumFrom_AccountType: "fromAccountType", EnumTo_AccountType: "toAccountType", GroupCode: "groupCode", MsgPriority: "priority", MsgBody: "elements", MsgType: "type", MsgContent: "content", IsFinished: "complete", Download_Flag: "downloadFlag", ClientSeq: "clientSequence", ThumbUUID: "thumbUUID", VideoUUID: "videoUUID", ToTopicId: "topicID", InvisibleMsgSeq: "invisibleSequenceList" } } };
  8631. }(e3)), this._configMap.set(Co, function(e4) {
  8632. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM, ".").concat(V.CMD.SET_C2C_MESSAGE_READ) }), body: { C2CMsgReaded: void 0 }, keyMap: { request: { lastMessageTime: "LastedMsgTime" } } };
  8633. }(e3)), this._configMap.set(To, function(e4) {
  8634. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM, ".").concat(V.CMD.SET_C2C_PEER_MUTE_NOTIFICATIONS) }), body: { userIDList: void 0, muteFlag: 0 }, keyMap: { request: { userIDList: "Peer_Account", muteFlag: "Mute_Notifications" } } };
  8635. }(e3)), this._configMap.set(Do, function(e4) {
  8636. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM, ".").concat(V.CMD.GET_C2C_PEER_MUTE_NOTIFICATIONS) }), body: { updateSequence: 0 }, keyMap: { response: { MuteNotificationsList: "muteFlagList" } } };
  8637. }(e3)), this._configMap.set(as, function(e4) {
  8638. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.SET_GROUP_MESSAGE_READ) }), body: { groupID: void 0, messageReadSeq: void 0, topicID: void 0 }, keyMap: { request: { messageReadSeq: "MsgReadedSeq" } } };
  8639. }(e3)), this._configMap.set(rs, function(e4) {
  8640. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM, ".").concat(V.CMD.SET_ALL_MESSAGE_READ) }), body: { readAllC2CMessage: 0, groupMessageReadInfoList: [] }, keyMap: { request: { readAllC2CMessage: "C2CReadAllMsg", groupMessageReadInfoList: "GroupReadInfo", messageSequence: "MsgSeq" }, response: { C2CReadAllMsg: "readAllC2CMessage", GroupReadInfoArray: "groupMessageReadInfoList" } } };
  8641. }(e3)), this._configMap.set(ko, function(e4) {
  8642. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM, ".").concat(V.CMD.DELETE_C2C_MESSAGE) }), body: { fromAccount: "", to: "", keyList: void 0 }, keyMap: { request: { keyList: "MsgKeyList" } } };
  8643. }(e3)), this._configMap.set(vs, function(e4) {
  8644. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.DELETE_GROUP_MESSAGE) }), body: { groupID: "", deleter: "", keyList: void 0, topicID: void 0 }, keyMap: { request: { deleter: "Deleter_Account", keyList: "Seqs" } } };
  8645. }(e3)), this._configMap.set(pa, function(e4) {
  8646. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_OPEN_TRANSLATE, ".").concat(V.CMD.TRANSLATE_TEXT) }), body: { sourceTextList: void 0, SDKAppID: 0, from: 0, source: "", target: "" }, keyMap: { request: { sourceTextList: "SourceText", SDKAppID: "SdkAppId", from: "FromAccount" }, response: { TargetText: "translatedTextList", RequestId: "requestID", CmdErrorCode: "error", ErrorCode: "code", ErrorInfo: "message" } } };
  8647. }(e3)), this._configMap.set(ms, function(e4) {
  8648. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM, ".").concat(V.CMD.MODIFY_GROUP_MESSAGE) }), body: { groupID: "", topicID: void 0, sequence: 0, version: 0, elements: void 0, cloudCustomData: void 0 }, keyMap: { request: { sequence: "MsgSeq", version: "MsgVersion", type: "MsgType", content: "MsgContent" } } };
  8649. }(e3)), this._configMap.set(us, function(e4) {
  8650. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.GET_READ_RECEIPT) }), body: { groupID: "", sequenceList: void 0 }, keyMap: { request: { sequence: "MsgSeq" } } };
  8651. }(e3)), this._configMap.set(ls, function(e4) {
  8652. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM, ".").concat(V.CMD.SEND_C2C_READ_RECEIPT) }), body: { peerAccount: "", messageInfoList: void 0 }, keyMap: { request: { peerAccount: "Peer_Account", messageInfoList: "C2CMsgInfo", fromAccount: "From_Account", toAccount: "To_Account", sequence: "MsgSeq", random: "MsgRandom", time: "MsgTime", clientTime: "MsgClientTime" } } };
  8653. }(e3)), this._configMap.set(cs, function(e4) {
  8654. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.SEND_READ_RECEIPT) }), body: { groupID: "", sequenceList: void 0 }, keyMap: { request: { sequenceList: "MsgSeqList", sequence: "MsgSeq" } } };
  8655. }(e3)), this._configMap.set(ps, function(e4) {
  8656. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.GET_READ_RECEIPT_DETAIL) }), body: { groupID: "", sequence: void 0, flag: 0, cursor: 0, count: 0 }, keyMap: { request: { sequence: "MsgSeq", count: "Num" }, response: { ReadList: "readUserIDList", Read_Account: "userID", UnreadList: "unreadUserIDList", Unread_Account: "userID", IsFinish: "isCompleted" } } };
  8657. }(e3)), this._configMap.set(Ao, function(e4) {
  8658. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM_MSG_EXT, ".").concat(V.CMD.MODIFY_C2C_MESSAGE_EXTENSIONS) }), body: { from: void 0, to: void 0, messageKey: void 0, operateType: void 0, extensionList: void 0 } };
  8659. }(e3)), this._configMap.set(Ro, function(e4) {
  8660. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM_MSG_EXT, ".").concat(V.CMD.GET_C2C_MESSAGE_EXTENSIONS) }), body: { from: void 0, to: void 0, messageKey: void 0, startSequence: void 0 } };
  8661. }(e3)), this._configMap.set(Ds, function(e4) {
  8662. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM_MSG_EXT, ".").concat(V.CMD.MODIFY_GROUP_MESSAGE_EXTENSIONS) }), body: { groupID: void 0, topicID: void 0, messageSequence: void 0, operateType: void 0, extensionList: void 0 } };
  8663. }(e3)), this._configMap.set(Es, function(e4) {
  8664. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM_MSG_EXT, ".").concat(V.CMD.GET_GROUP_MESSAGE_EXTENSIONS) }), body: { groupID: void 0, topicID: void 0, messageSequence: void 0, startSequence: void 0 } };
  8665. }(e3)), this._configMap.set(So, function(e4) {
  8666. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM, ".").concat(V.CMD.GET_PEER_READ_TIME) }), body: { userIDList: void 0 }, keyMap: { request: { userIDList: "To_Account" }, response: { ReadTime: "peerReadTimeList" } } };
  8667. }(e3)), this._configMap.set(Oo, function(e4) {
  8668. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.RECENT_CONTACT, ".").concat(V.CMD.GET_CONVERSATION_LIST) }), body: { fromAccount: void 0, count: 0 }, keyMap: { request: {}, response: { SessionItem: "conversations", ToAccount: "groupID", To_Account: "userID", UnreadMsgCount: "unreadCount", MsgGroupReadedSeq: "messageReadSeq", C2cPeerReadTime: "c2cPeerReadTime" } } };
  8669. }(e3)), this._configMap.set(No, function(e4) {
  8670. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.RECENT_CONTACT, ".").concat(V.CMD.PAGING_GET_CONVERSATION_LIST) }), body: { fromAccount: void 0, timeStamp: void 0, startIndex: void 0, pinnedTimeStamp: void 0, pinnedStartIndex: void 0, orderType: void 0, messageAssistFlag: 4, assistFlag: 15 }, keyMap: { request: { messageAssistFlag: "MsgAssistFlags", assistFlag: "AssistFlags", pinnedTimeStamp: "TopTimeStamp", pinnedStartIndex: "TopStartIndex" }, response: { SessionItem: "conversations", ToAccount: "groupID", To_Account: "userID", UnreadMsgCount: "unreadCount", MsgGroupReadedSeq: "messageReadSeq", C2cPeerReadTime: "c2cPeerReadTime", LastMsgFlags: "lastMessageFlag", TopFlags: "isPinned", TopTimeStamp: "pinnedTimeStamp", TopStartIndex: "pinnedStartIndex", GroupId: "convGroupID" } } };
  8671. }(e3)), this._configMap.set(Go, function(e4) {
  8672. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.RECENT_CONTACT, ".").concat(V.CMD.DELETE_CONVERSATION) }), body: { fromAccount: "", conversationList: void 0, clearHistoryMessage: void 0 }, keyMap: { request: { toGroupID: "ToGroupid", clearHistoryMessage: "ClearRamble", conversationList: "ContactItem" }, response: { ResultItem: "resultList", ToGroupid: "groupID", ResultCode: "code", ResultInfo: "info" } } };
  8673. }(e3)), this._configMap.set(Uo, function(e4) {
  8674. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.RECENT_CONTACT, ".").concat(V.CMD.CLEAR_HISTORY_MESSAGE) }), body: { fromAccount: "", toAccount: void 0, type: 1, toGroupID: void 0 }, keyMap: { request: { toGroupID: "ToGroupid" } } };
  8675. }(e3)), this._configMap.set(Po, function(e4) {
  8676. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.RECENT_CONTACT, ".").concat(V.CMD.PIN_CONVERSATION) }), body: { fromAccount: "", operationType: 1, itemList: void 0 }, keyMap: { request: { itemList: "RecentContactItem" } } };
  8677. }(e3)), this._configMap.set(bo, function(e4) {
  8678. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM, ".").concat(V.CMD.DELETE_GROUP_AT_TIPS) }), body: { messageListToDelete: void 0 }, keyMap: { request: { messageListToDelete: "DelMsgList", messageSeq: "MsgSeq", messageRandom: "MsgRandom" } } };
  8679. }(e3)), this._configMap.set(wo, function(e4) {
  8680. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.RECENT_CONTACT, ".").concat(V.CMD.MARK_CONVERSATION) }), body: { fromAccount: "", itemList: void 0 }, keyMap: { request: { itemList: "MarkItem", operationType: "OptType", groupID: "ToGroupId" }, response: { ToGroupId: "groupID", OptType: "operationType" } } };
  8681. }(e3)), this._configMap.set(Fo, function(e4) {
  8682. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.RECENT_CONTACT, ".").concat(V.CMD.MARK_CONVERSATION) }), body: { fromAccount: "", itemList: void 0 }, keyMap: { request: { itemList: "MarkItem", operationType: "OptType", groupID: "ToGroupId" }, response: { ToGroupId: "groupID", OptType: "operationType" } } };
  8683. }(e3)), this._configMap.set(qo, function(e4) {
  8684. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.RECENT_CONTACT, ".").concat(V.CMD.CREATE_CONVERSATION_GROUP) }), body: { fromAccount: "", itemList: void 0 }, keyMap: { request: { itemList: "GroupContactItem", groupID: "ToGroupId" }, response: { GroupId: "convGroupID", ToGroupId: "groupID", OptType: "operationType" } } };
  8685. }(e3)), this._configMap.set(xo, function(e4) {
  8686. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.RECENT_CONTACT, ".").concat(V.CMD.DELETE_CONVERSATION_GROUP) }), body: { fromAccount: "", groupName: void 0 }, keyMap: { request: {}, response: { GroupId: "convGroupID" } } };
  8687. }(e3)), this._configMap.set(Vo, function(e4) {
  8688. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.RECENT_CONTACT, ".").concat(V.CMD.UPDATE_CONVERSATION_GROUP) }), body: { fromAccount: "", updateType: void 0, updateGroup: void 0 }, keyMap: { request: { oldName: "OldGroupName", newName: "NewGroupName", groupID: "ToGroupId", operationType: "ContactOptType", groupName: "OldGroupName", updateItem: "ContactUpdateItem" }, response: { ContactOptType: "operationType", ToGroupId: "groupID", GroupId: "convGroupID" } } };
  8689. }(e3)), this._configMap.set(Bo, function(e4) {
  8690. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.RECENT_CONTACT, ".").concat(V.CMD.UPDATE_CONVERSATION_GROUP) }), body: { fromAccount: "", updateType: void 0, updateGroup: { groupName: void 0, updateGroupType: void 0, updateItem: void 0 } }, keyMap: { request: {}, response: {} } };
  8691. }(e3)), this._configMap.set(Ho, function(e4) {
  8692. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.RECENT_CONTACT, ".").concat(V.CMD.UPDATE_CONVERSATION_GROUP) }), body: { fromAccount: "", updateType: void 0, updateGroup: void 0 }, keyMap: { request: {}, response: {} } };
  8693. }(e3)), this._configMap.set(Ko, function(e4) {
  8694. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.RECENT_CONTACT, ".").concat(V.CMD.GET_CONVERSATION_GROUP_LIST) }), body: { fromAccount: "", startTime: void 0, startIndex: void 0 }, keyMap: { request: {}, response: { GroupId: "convGroupID", ToGroupId: "groupID", OptType: "operationType", CustomMark: "customData", ContactGroupId: "convGroupIDList" } } };
  8695. }(e3)), this._configMap.set(fo, function(e4) {
  8696. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.PROFILE, ".").concat(V.CMD.PORTRAIT_GET) }), body: { fromAccount: "", userItem: [] }, keyMap: { request: { toAccount: "To_Account", standardSequence: "StandardSequence", customSequence: "CustomSequence" } } };
  8697. }(e3)), this._configMap.set(vo, function(e4) {
  8698. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.PROFILE, ".").concat(V.CMD.PORTRAIT_SET) }), body: { fromAccount: "", profileItem: [{ tag: Be.NICK, value: "" }, { tag: Be.GENDER, value: "" }, { tag: Be.ALLOWTYPE, value: "" }, { tag: Be.AVATAR, value: "" }] }, keyMap: { request: { toAccount: "To_Account", standardSequence: "StandardSequence", customSequence: "CustomSequence" } } };
  8699. }(e3)), this._configMap.set(mo, function(e4) {
  8700. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.FRIEND, ".").concat(V.CMD.GET_BLACKLIST) }), body: { fromAccount: "", startIndex: 0, maxLimited: 30, lastSequence: 0 }, keyMap: { response: { CurruentSequence: "currentSequence" } } };
  8701. }(e3)), this._configMap.set(Mo, function(e4) {
  8702. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.FRIEND, ".").concat(V.CMD.ADD_BLACKLIST) }), body: { fromAccount: "", toAccount: [] } };
  8703. }(e3)), this._configMap.set(yo, function(e4) {
  8704. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.FRIEND, ".").concat(V.CMD.DELETE_BLACKLIST) }), body: { fromAccount: "", toAccount: [] } };
  8705. }(e3)), this._configMap.set(oa, function(e4) {
  8706. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_OPEN_STATUS, ".").concat(V.CMD.SET_SELF_STATUS) }), body: { customStatus: "" }, keyMap: {} };
  8707. }(e3)), this._configMap.set(sa, function(e4) {
  8708. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_OPEN_STATUS, ".").concat(V.CMD.GET_USER_STATUS) }), body: { userIDList: void 0 }, keyMap: { response: { UserStatusList: "successUserList", ErrorList: "failureUserList", To_Account: "userID", Invalid_Account: "invalidUserID", Status: "statusType" } } };
  8709. }(e3)), this._configMap.set(aa, function(e4) {
  8710. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_OPEN_STATUS, ".").concat(V.CMD.SUBSCRIBE_USER_STATUS) }), body: { userIDList: void 0 }, keyMap: { response: { ErrorList: "failureUserList", To_Account: "userID", Invalid_Account: "invalidUserID" } } };
  8711. }(e3)), this._configMap.set(ra, function(e4) {
  8712. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_OPEN_STATUS, ".").concat(V.CMD.UNSUBSCRIBE_USER_STATUS) }), body: { userIDList: void 0, unsubscribeAll: void 0 }, keyMap: { response: { ErrorList: "failureUserList", To_Account: "userID", Invalid_Account: "invalidUserID" } } };
  8713. }(e3)), this._configMap.set(Wo, function(e4) {
  8714. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.GET_JOINED_GROUPS) }), body: { memberAccount: "", limit: void 0, offset: void 0, groupType: void 0, responseFilter: { groupBaseInfoFilter: void 0, selfInfoFilter: void 0 }, isSupportTopic: 0 }, keyMap: { request: { memberAccount: "Member_Account" }, response: { GroupIdList: "groups", NoUnreadSeqList: "excludedUnreadSequenceList", MsgSeq: "readedSequence", LastRecallTime: "_lastRevokedTime" } } };
  8715. }(e3)), this._configMap.set(Yo, function(e4) {
  8716. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.GET_GROUP_INFO) }), body: { groupIDList: void 0, responseFilter: { groupBaseInfoFilter: ["Type", "Name", "Introduction", "Notification", "FaceUrl", "Owner_Account", "CreateTime", "InfoSeq", "LastInfoTime", "LastMsgTime", "MemberNum", "MaxMemberNum", "ApplyJoinOption", "NextMsgSeq", "ShutUpAllMember"], groupCustomFieldFilter: void 0, memberInfoFilter: void 0, memberCustomFieldFilter: void 0 } }, keyMap: { request: { groupIDList: "GroupIdList", groupCustomField: "AppDefinedData", memberCustomField: "AppMemberDefinedData", groupCustomFieldFilter: "AppDefinedDataFilter_Group", memberCustomFieldFilter: "AppDefinedDataFilter_GroupMember" }, response: { GroupIdList: "groups", AppDefinedData: "groupCustomField", AppMemberDefinedData: "memberCustomField", AppDefinedDataFilter_Group: "groupCustomFieldFilter", AppDefinedDataFilter_GroupMember: "memberCustomFieldFilter", InfoSeq: "infoSequence", MemberList: "members", GroupInfo: "groups", ShutUpUntil: "muteUntil", ShutUpAllMember: "muteAllMembers" } } };
  8717. }(e3)), this._configMap.set(jo, function(e4) {
  8718. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.CREATE_GROUP) }), body: { type: void 0, name: void 0, groupID: void 0, ownerID: void 0, introduction: void 0, notification: void 0, maxMemberNum: void 0, joinOption: void 0, memberList: void 0, groupCustomField: void 0, memberCustomField: void 0, webPushFlag: 1, avatar: "", isSupportTopic: void 0, inviteOption: void 0 }, keyMap: { request: { ownerID: "Owner_Account", userID: "Member_Account", avatar: "FaceUrl", maxMemberNum: "MaxMemberCount", joinOption: "ApplyJoinOption", groupCustomField: "AppDefinedData", memberCustomField: "AppMemberDefinedData", inviteOption: "InviteJoinOption" }, response: { HugeGroupFlag: "avChatRoomFlag", OverJoinedGroupLimit_Account: "overLimitUserIDList" } } };
  8719. }(e3)), this._configMap.set(zo, function(e4) {
  8720. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.DESTROY_GROUP) }), body: { groupID: void 0 } };
  8721. }(e3)), this._configMap.set(Jo, function(e4) {
  8722. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.MODIFY_GROUP_INFO) }), body: { groupID: void 0, name: void 0, introduction: void 0, notification: void 0, avatar: void 0, joinOption: void 0, groupCustomField: void 0, muteAllMembers: void 0, inviteOption: void 0 }, keyMap: { request: { groupCustomField: "AppDefinedData", muteAllMembers: "ShutUpAllMember", joinOption: "ApplyJoinOption", avatar: "FaceUrl", inviteOption: "InviteJoinOption" }, response: { AppDefinedData: "groupCustomField", ShutUpAllMember: "muteAllMembers" } } };
  8723. }(e3)), this._configMap.set(Xo, function(e4) {
  8724. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.APPLY_JOIN_GROUP) }), body: { groupID: void 0, applyMessage: void 0, userDefinedField: void 0, webPushFlag: 1, historyMessageFlag: void 0 }, keyMap: { request: { applyMessage: "ApplyMsg", historyMessageFlag: "HugeGroupHistoryMsgFlag" }, response: { HugeGroupFlag: "avChatRoomFlag", AVChatRoomKey: "avChatRoomKey", RspMsgList: "messageList", ToGroupId: "to" } } };
  8725. }(e3)), this._configMap.set(Qo, function(e4) {
  8726. return e4.a2, e4.tinyid, { head: t(t({}, g(e4, xi)), {}, { servcmd: "".concat(V.NAME.BIG_GROUP_NO_AUTH, ".").concat(V.CMD.APPLY_JOIN_GROUP) }), body: { groupID: void 0, applyMessage: void 0, userDefinedField: void 0, webPushFlag: 1 }, keyMap: { request: { applyMessage: "ApplyMsg" }, response: { HugeGroupFlag: "avChatRoomFlag" } } };
  8727. }(e3)), this._configMap.set(Zo, function(e4) {
  8728. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.QUIT_GROUP) }), body: { groupID: void 0 } };
  8729. }(e3)), this._configMap.set($o, function(e4) {
  8730. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.SEARCH_GROUP_BY_ID) }), body: { groupIDList: void 0, responseFilter: { groupBasePublicInfoFilter: ["Type", "Name", "Introduction", "Notification", "FaceUrl", "CreateTime", "Owner_Account", "LastInfoTime", "LastMsgTime", "NextMsgSeq", "MemberNum", "MaxMemberNum", "ApplyJoinOption", "InviteJoinOption"] } }, keyMap: { response: {} } };
  8731. }(e3)), this._configMap.set(es, function(e4) {
  8732. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.CHANGE_GROUP_OWNER) }), body: { groupID: void 0, newOwnerID: void 0 }, keyMap: { request: { newOwnerID: "NewOwner_Account" } } };
  8733. }(e3)), this._configMap.set(ts, function(e4) {
  8734. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.HANDLE_APPLY_JOIN_GROUP) }), body: { groupID: void 0, applicant: void 0, handleAction: void 0, handleMessage: void 0, authentication: void 0, messageKey: void 0, userDefinedField: void 0 }, keyMap: { request: { applicant: "Applicant_Account", handleAction: "HandleMsg", handleMessage: "ApprovalMsg", messageKey: "MsgKey" } } };
  8735. }(e3)), this._configMap.set(ns, function(e4) {
  8736. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.HANDLE_INVITE_JOIN_GROUP) }), body: { groupID: void 0, applicant: void 0, invitee: void 0, handleAction: void 0, handleMessage: void 0, authentication: void 0, userDefinedField: void 0 }, keyMap: { request: { applicant: "Applicant_Account", invitee: "Invited_Account", handleAction: "HandleMsg", handleMessage: "ApprovalMsg" } } };
  8737. }(e3)), this._configMap.set(os, function(e4) {
  8738. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.HANDLE_GROUP_INVITATION) }), body: { groupID: void 0, inviter: void 0, handleAction: void 0, handleMessage: void 0, authentication: void 0, messageKey: void 0, userDefinedField: void 0 }, keyMap: { request: { inviter: "Inviter_Account", handleAction: "HandleMsg", handleMessage: "ApprovalMsg", messageKey: "MsgKey" } } };
  8739. }(e3)), this._configMap.set(ds, function(e4) {
  8740. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.GET_GROUP_APPLICATION) }), body: { startTime: void 0, limit: void 0, handleAccount: void 0 }, keyMap: { request: { handleAccount: "Handle_Account" }, response: { To_Account: "userID" } } };
  8741. }(e3)), this._configMap.set(gs, function(e4) {
  8742. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM, ".").concat(V.CMD.DELETE_GROUP_SYSTEM_MESSAGE) }), body: { messageListToDelete: void 0 }, keyMap: { request: { messageListToDelete: "DelMsgList", messageSeq: "MsgSeq", messageRandom: "MsgRandom" } } };
  8743. }(e3)), this._configMap.set(_s, function(e4) {
  8744. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.BIG_GROUP_LONG_POLLING, ".").concat(V.CMD.AVCHATROOM_LONG_POLL) }), body: { USP: 1, startSeq: 1, startBroadcastSeq: void 0, holdTime: 90, key: void 0, simplifiedMessage: void 0 }, keyMap: { request: { USP: "USP" }, response: { ToGroupId: "groupID", RspBroadcastMsgList: "broadcastMessageList", IsSystemMsg: "isSystemMessage" } } };
  8745. }(e3)), this._configMap.set(hs, function(e4) {
  8746. return e4.a2, e4.tinyid, { head: t(t({}, g(e4, Vi)), {}, { servcmd: "".concat(V.NAME.BIG_GROUP_LONG_POLLING_NO_AUTH, ".").concat(V.CMD.AVCHATROOM_LONG_POLL) }), body: { USP: 1, startSeq: 1, holdTime: 90, key: void 0, simplifiedMessage: void 0 }, keyMap: { request: { USP: "USP" }, response: { ToGroupId: "groupID", RspBroadcastMsgList: "broadcastMessageList", IsSystemMsg: "isSystemMessage" } } };
  8747. }(e3)), this._configMap.set(fs, function(e4) {
  8748. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.GET_ONLINE_MEMBER_NUM) }), body: { groupID: void 0 } };
  8749. }(e3)), this._configMap.set(Ms, function(e4) {
  8750. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.SET_GROUP_ATTRIBUTES) }), body: { groupID: void 0, groupAttributeList: void 0, mainSequence: void 0, avChatRoomKey: void 0, attributeControl: ["RaceConflict"] }, keyMap: { request: { key: "key", value: "value" } } };
  8751. }(e3)), this._configMap.set(ys, function(e4) {
  8752. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.MODIFY_GROUP_ATTRIBUTES) }), body: { groupID: void 0, groupAttributeList: void 0, mainSequence: void 0, avChatRoomKey: void 0, attributeControl: ["RaceConflict"] }, keyMap: { request: { key: "key", value: "value" } } };
  8753. }(e3)), this._configMap.set(Is, function(e4) {
  8754. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.DELETE_GROUP_ATTRIBUTES) }), body: { groupID: void 0, groupAttributeList: void 0, mainSequence: void 0, avChatRoomKey: void 0, attributeControl: ["RaceConflict"] }, keyMap: { request: { key: "key" } } };
  8755. }(e3)), this._configMap.set(Cs, function(e4) {
  8756. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.CLEAR_GROUP_ATTRIBUTES) }), body: { groupID: void 0, mainSequence: void 0, avChatRoomKey: void 0, attributeControl: ["RaceConflict"] } };
  8757. }(e3)), this._configMap.set(Ts, function(e4) {
  8758. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP_ATTR, ".").concat(V.CMD.GET_GROUP_ATTRIBUTES) }), body: { groupID: void 0, avChatRoomKey: void 0, groupType: 1 }, keyMap: { request: { avChatRoomKey: "Key", groupType: "GroupType" } } };
  8759. }(e3)), this._configMap.set(Ss, function(e4) {
  8760. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.GET_GROUP_NOTIFY) }), body: { notifyType: 1, groupID: "", beginTime: 0, endTime: 0, limit: 20 }, keyMap: { request: {}, response: { NextMsgTime: "nextRevokedTime", NotifyMsgList: "notifyList" } } };
  8761. }(e3)), this._configMap.set(ks, function(e4) {
  8762. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.UPDATE_GROUP_COUNTER) }), body: { groupID: void 0, counterList: void 0, avChatRoomKey: void 0, mode: void 0 }, keyMap: { request: { counterList: "GroupCounter" } } };
  8763. }(e3)), this._configMap.set(Ls, function(e4) {
  8764. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.GET_GROUP_COUNTER) }), body: { groupID: void 0, keyList: [], avChatRoomKey: void 0 }, keyMap: { request: { keyList: "GroupCounterKeys" } } };
  8765. }(e3)), this._configMap.set($s, function(e4) {
  8766. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP_COMMUNITY, ".").concat(V.CMD.CREATE_TOPIC) }), body: { groupID: void 0, topicName: void 0, avatar: void 0, customData: void 0, topicID: void 0, notification: void 0, introduction: void 0 }, keyMap: { request: { avatar: "FaceUrl" } } };
  8767. }(e3)), this._configMap.set(ea, function(e4) {
  8768. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP_COMMUNITY, ".").concat(V.CMD.DELETE_TOPIC) }), body: { groupID: void 0, topicIDList: void 0 }, keyMap: { request: { topicIDList: "TopicIdList" }, response: { DestroyResultItem: "resultList" } } };
  8769. }(e3)), this._configMap.set(ta, function(e4) {
  8770. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP_COMMUNITY, ".").concat(V.CMD.UPDATE_TOPIC_PROFILE) }), body: { groupID: void 0, topicID: void 0, avatar: void 0, customData: void 0, notification: void 0, introduction: void 0, muteAllMembers: void 0, topicName: void 0 }, keyMap: { request: { avatar: "FaceUrl", muteAllMembers: "ShutUpAllMember" } } };
  8771. }(e3)), this._configMap.set(na, function(e4) {
  8772. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP_COMMUNITY, ".").concat(V.CMD.GET_TOPIC_LIST) }), body: { groupID: void 0, topicIDList: void 0, MemberInfoFilter: ["NoUnreadSeqList"] }, keyMap: { request: { topicIDList: "TopicIdList" }, response: { TopicAndSelfInfo: "topicInfoList", TopicInfo: "topic", GroupID: "groupID", ShutUpTime: "muteTime", ShutUpAllFlag: "muteAllMembers", LastMsgTime: "lastMessageTime", MsgSeq: "readedSequence", LastMsgSeq: "sequence", NoUnreadSeqList: "excludedUnreadSequenceList" } } };
  8773. }(e3)), this._configMap.set(As, function(e4) {
  8774. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.GET_GROUP_MEMBER_LIST) }), body: { groupID: void 0, limit: 0, offset: void 0, next: void 0, memberRoleFilter: void 0, memberInfoFilter: ["Role", "NameCard", "ShutUpUntil", "JoinTime"], memberCustomFieldFilter: void 0 }, keyMap: { request: { memberCustomFieldFilter: "AppDefinedDataFilter_GroupMember" }, response: { AppMemberDefinedData: "memberCustomField", AppDefinedDataFilter_GroupMember: "memberCustomFieldFilter", MemberList: "members", ShutUpUntil: "muteUntil" } } };
  8775. }(e3)), this._configMap.set(Rs, function(e4) {
  8776. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP_AVCHATROOM, ".").concat(V.CMD.GET_AVCHATROOM_MEMBER_LIST) }), body: { groupID: void 0, offset: void 0, filter: void 0 }, keyMap: { request: { offset: "Timestamp", filter: "Mark" }, response: { NextTimestamp: "offset" } } };
  8777. }(e3)), this._configMap.set(Ns, function(e4) {
  8778. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.GET_GROUP_MEMBER_INFO) }), body: { groupID: void 0, userIDList: void 0, memberInfoFilter: void 0, memberCustomFieldFilter: void 0 }, keyMap: { request: { userIDList: "Member_List_Account", memberCustomFieldFilter: "AppDefinedDataFilter_GroupMember" }, response: { MemberList: "members", ShutUpUntil: "muteUntil", AppDefinedDataFilter_GroupMember: "memberCustomFieldFilter", AppMemberDefinedData: "memberCustomField" } } };
  8779. }(e3)), this._configMap.set(Os, function(e4) {
  8780. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.ADD_GROUP_MEMBER) }), body: { groupID: void 0, silence: void 0, userIDList: void 0 }, keyMap: { request: { userID: "Member_Account", userIDList: "MemberList" }, response: { MemberList: "members" } } };
  8781. }(e3)), this._configMap.set(Gs, function(e4) {
  8782. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.DELETE_GROUP_MEMBER) }), body: { groupID: void 0, userIDList: void 0, reason: void 0 }, keyMap: { request: { userIDList: "MemberToDel_Account" } } };
  8783. }(e3)), this._configMap.set(Us, function(e4) {
  8784. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.BAN_AVCHATROOM_MEMBER) }), body: { groupID: void 0, userIDList: void 0, duration: void 0, reason: "" }, keyMap: { request: { userIDList: "Members_Account", duration: "Duration", reason: "Description" } } };
  8785. }(e3)), this._configMap.set(Ps, function(e4) {
  8786. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP, ".").concat(V.CMD.MODIFY_GROUP_MEMBER_INFO) }), body: { groupID: void 0, topicID: void 0, userID: void 0, messageRemindType: void 0, nameCard: void 0, role: void 0, memberCustomField: void 0, muteTime: void 0 }, keyMap: { request: { userID: "Member_Account", memberCustomField: "AppMemberDefinedData", muteTime: "ShutUpTime", messageRemindType: "MsgFlag" } } };
  8787. }(e3)), this._configMap.set(bs, function(e4) {
  8788. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.GROUP_AVCHATROOM, ".").concat(V.CMD.MARK_AVCHATROOM_MEMBER_INFO) }), body: { groupID: void 0, operationType: 1, memberList: [] }, keyMap: { request: { operationType: "CommandType", memberList: "MemberList", markType: "Marks", userID: "Member_Account" }, response: { CommandType: "operationType", Marks: "markType", Member_Account: "userID" } } };
  8789. }(e3)), this._configMap.set(xs, function(e4) {
  8790. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_OPEN_STAT, ".").concat(V.CMD.TIM_WEB_REPORT_V2) }), body: { header: {}, event: [], quality: [] }, keyMap: { request: { SDKType: "sdk_type", SDKVersion: "sdk_version", deviceType: "device_type", platform: "platform", instanceID: "instance_id", traceID: "trace_id", SDKAppID: "sdk_app_id", userID: "user_id", tinyID: "tiny_id", extension: "extension", timestamp: "timestamp", networkType: "network_type", eventType: "event_type", code: "error_code", message: "error_message", moreMessage: "more_message", duplicate: "duplicate", costTime: "cost_time", level: "level", qualityType: "quality_type", reportIndex: "report_index", wholePeriod: "whole_period", totalCount: "total_count", rttCount: "success_count_business", successRateOfRequest: "percent_business", countLessThan1Second: "success_count_business", percentOfCountLessThan1Second: "percent_business", countLessThan3Second: "success_count_platform", percentOfCountLessThan3Second: "percent_platform", successCountOfBusiness: "success_count_business", successRateOfBusiness: "percent_business", successCountOfPlatform: "success_count_platform", successRateOfPlatform: "percent_platform", successCountOfMessageReceived: "success_count_business", successRateOfMessageReceived: "percent_business", avgRTT: "average_value", avgDelay: "average_value", avgValue: "average_value", uiPlatform: "ui_platform" } } };
  8791. }(o2)), this._configMap.set(Vs, function(e4) {
  8792. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.HEARTBEAT, ".").concat(V.CMD.ALIVE) }), body: {} };
  8793. }(e3)), this._configMap.set(Bs, function(e4) {
  8794. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_OPEN_PUSH, ".").concat(V.CMD.MESSAGE_PUSH) }), body: {}, keyMap: { response: { C2cMsgArray: "C2CMessageArray", GroupMsgArray: "groupMessageArray", GroupTips: "groupTips", C2cNotifyMsgArray: "C2CNotifyMessageArray", C2cMsgInfo: "C2CReadReceiptArray", ClientSeq: "clientSequence", MsgPriority: "priority", NoticeSeq: "noticeSequence", MsgContent: "content", MsgType: "type", MsgBody: "elements", ToGroupId: "to", Desc: "description", Ext: "extension", IsSyncMsg: "isSyncMessage", Flag: "needSync", NeedAck: "needAck", PendencyAdd_Account: "userID", ProfileImNick: "nick", PendencyType: "applicationType", C2CReadAllMsg: "readAllC2CMessage", IsNeedReadReceipt: "needReadReceipt", Status: "statusType" } } };
  8795. }(e3)), this._configMap.set(Hs, function(e4) {
  8796. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_OPEN_PUSH, ".").concat(V.CMD.MULTI_MESSAGE_PUSH) }), body: {}, keyMap: { response: { GroupMsgArray: "groupMessageArray", GroupTips: "groupTips", ClientSeq: "clientSequence", MsgPriority: "priority", NoticeSeq: "noticeSequence", MsgContent: "content", MsgType: "type", MsgBody: "elements", ToGroupId: "to", Desc: "description", Ext: "extension", IsSyncMsg: "isSyncMessage", Flag: "needSync", NeedAck: "needAck", PendencyType: "applicationType" } } };
  8797. }(e3)), this._configMap.set(Ks, function(e4) {
  8798. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.OPEN_IM, ".").concat(V.CMD.MESSAGE_PUSH_ACK) }), body: { sessionData: void 0 }, keyMap: { request: { sessionData: "SessionData" } } };
  8799. }(e3)), this._configMap.set(Ws, function(e4) {
  8800. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_OPEN_STATUS, ".").concat(V.CMD.STATUS_FORCE_OFFLINE) }), body: {}, keyMap: { response: { C2cNotifyMsgArray: "C2CNotifyMessageArray", NoticeSeq: "noticeSequence", KickoutMsgNotify: "kickoutMsgNotify", NewInstInfo: "newInstanceInfo" } } };
  8801. }(e3)), this._configMap.set(js, function(e4) {
  8802. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_LONG_MESSAGE, ".").concat(V.CMD.DOWNLOAD_MERGER_MESSAGE) }), body: { downloadKey: "" }, keyMap: { response: { Data: "data", Desc: "description", Ext: "extension", Download_Flag: "downloadFlag", ThumbUUID: "thumbUUID", VideoUUID: "videoUUID" } } };
  8803. }(e3)), this._configMap.set(Ys, function(e4) {
  8804. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_LONG_MESSAGE, ".").concat(V.CMD.UPLOAD_MERGER_MESSAGE) }), body: { messageList: [] }, keyMap: { request: { fromAccount: "From_Account", toAccount: "To_Account", msgTimeStamp: "MsgTimeStamp", msgSeq: "MsgSeq", msgRandom: "MsgRandom", msgBody: "MsgBody", type: "MsgType", content: "MsgContent", data: "Data", description: "Desc", extension: "Ext", sizeType: "Type", uuid: "UUID", url: "", imageUrl: "URL", fileUrl: "Url", remoteAudioUrl: "Url", remoteVideoUrl: "VideoUrl", thumbUUID: "ThumbUUID", videoUUID: "VideoUUID", videoUrl: "", downloadFlag: "Download_Flag", from: "From_Account", time: "MsgTimeStamp", messageRandom: "MsgRandom", messageSequence: "MsgSeq", elements: "MsgBody", clientSequence: "ClientSeq", payload: "MsgContent", messageList: "MsgList", messageNumber: "MsgNum", abstractList: "AbstractList", messageBody: "MsgBody" } } };
  8805. }(e3)), this._configMap.set(ca, function(e4) {
  8806. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_OPEN_STATUS, ".").concat(V.CMD.SET_TOKEN) }), body: { tokenID: "", pushMsg: 0, sdkAppID: 0, businessID: "", deviceBrand: "", deviceToken: "", isTpns: 0, isWebUniapp: 0 }, keyMap: { request: { tokenID: "TokenID", pushMsg: "PushMsg", sdkAppID: "EnterVersion", businessID: "BusiID", deviceBrand: "InstType", deviceToken: "VarToken", isTpns: "IsTpns" } } };
  8807. }(e3)), this._configMap.set(ua, function(e4) {
  8808. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_OPEN_STATUS, ".").concat(V.CMD.STAT_FOREGROUND) }), body: { isWebUniapp: 0 } };
  8809. }(e3)), this._configMap.set(ia, function(e4) {
  8810. return { head: t(t({}, e4), {}, { servcmd: "".concat(V.NAME.IM_OPEN_STATUS, ".").concat(V.CMD.STAT_BACKGROUND) }), body: { C2CUnread: 0, GroupUnread: 0, isWebUniapp: 0 }, keyMap: { request: { c2cUnreadCount: "C2cUnread", groupUnreadCount: "GrpUnread" } } };
  8811. }(e3));
  8812. } }, { key: "has", value: function(e3) {
  8813. return this._configMap.has(e3);
  8814. } }, { key: "get", value: function(e3) {
  8815. return this._configMap.get(e3);
  8816. } }, { key: "update", value: function() {
  8817. this._fillConfigMap();
  8818. } }, { key: "getKeyMap", value: function(e3) {
  8819. return this.has(e3) ? this.get(e3).keyMap || {} : (xe.w("".concat(this._n, ".getKeyMap unknown protocolName:").concat(e3)), {});
  8820. } }, { key: "getProtocolData", value: function(e3) {
  8821. var t2 = e3.protocolName, n2 = e3.requestData, o2 = this.get(t2), s2 = null;
  8822. if (n2) {
  8823. var a2 = this._simpleDeepCopy(o2), r2 = this._updateService(n2, a2), i2 = r2.body, u2 = /* @__PURE__ */ Object.create(null);
  8824. for (var c2 in i2)
  8825. if (Object.prototype.hasOwnProperty.call(i2, c2)) {
  8826. if (u2[c2] = i2[c2], void 0 === n2[c2])
  8827. continue;
  8828. u2[c2] = n2[c2];
  8829. }
  8830. r2.body = u2, s2 = this._getUplinkData(r2);
  8831. } else
  8832. s2 = this._getUplinkData(o2);
  8833. return s2;
  8834. } }, { key: "_getUplinkData", value: function(e3) {
  8835. var t2 = this._requestDataCleaner(e3), n2 = Pt(t2.head), o2 = Di(t2.body, this._getRequestKeyMap(n2));
  8836. return t2.body = o2, t2;
  8837. } }, { key: "_updateService", value: function(e3, t2) {
  8838. var n2 = Pt(t2.head);
  8839. if (this._isFromGroupRequest(t2)) {
  8840. var o2 = e3.type, s2 = e3.groupID, a2 = void 0 === s2 ? void 0 : s2, r2 = e3.groupIDList, i2 = void 0 === r2 ? [] : r2;
  8841. at(a2) && (a2 = i2[0] || ""), Tt({ type: o2, groupID: a2 }) && (t2.head.servcmd = "".concat(V.NAME.GROUP_COMMUNITY, ".").concat(n2));
  8842. }
  8843. return t2;
  8844. } }, { key: "_isFromGroupRequest", value: function(e3) {
  8845. return e3.head.servcmd.includes(V.NAME.GROUP) || e3.head.servcmd.includes(V.NAME.GROUP_ATTR);
  8846. } }, { key: "_getRequestKeyMap", value: function(e3) {
  8847. var n2 = this.getKeyMap(e3);
  8848. return t(t({}, Ii.request), n2.request);
  8849. } }, { key: "_requestDataCleaner", value: function(e3) {
  8850. var t2 = Array.isArray(e3) ? [] : /* @__PURE__ */ Object.create(null);
  8851. for (var o2 in e3)
  8852. Object.prototype.hasOwnProperty.call(e3, o2) && lt(o2) && null !== e3[o2] && void 0 !== e3[o2] && ("object" !== n(e3[o2]) ? t2[o2] = e3[o2] : t2[o2] = this._requestDataCleaner.bind(this)(e3[o2]));
  8853. return t2;
  8854. } }, { key: "_simpleDeepCopy", value: function(e3) {
  8855. for (var t2, n2 = Object.keys(e3), o2 = {}, s2 = 0, a2 = n2.length; s2 < a2; s2++)
  8856. t2 = n2[s2], st(e3[t2]) ? o2[t2] = Array.from(e3[t2]) : nt(e3[t2]) ? o2[t2] = this._simpleDeepCopy(e3[t2]) : o2[t2] = e3[t2];
  8857. return o2;
  8858. } }]), e2;
  8859. }(), Hi = [Ks], Ki = function() {
  8860. function e2(t2) {
  8861. o(this, e2), this._sessionModule = t2, this._n = "DownlinkHandler", this._eventHandlerMap = /* @__PURE__ */ new Map(), this._eventHandlerMap.set("C2CMessageArray", this._c2cMessageArrayHandler.bind(this)), this._eventHandlerMap.set("groupMessageArray", this._groupMessageArrayHandler.bind(this)), this._eventHandlerMap.set("groupTips", this._groupTipsHandler.bind(this)), this._eventHandlerMap.set("C2CNotifyMessageArray", this._C2CNotifyMessageArrayHandler.bind(this)), this._eventHandlerMap.set("C2CReadReceiptArray", this._C2CReadReceiptArrayHandler.bind(this)), this._eventHandlerMap.set("profileModify", this._profileHandler.bind(this)), this._eventHandlerMap.set("friendListMod", this._relationChainHandler.bind(this)), this._eventHandlerMap.set("recentContactMod", this._recentContactHandler.bind(this)), this._eventHandlerMap.set("readAllC2CMessage", this._allMessageReadHandler.bind(this)), this._eventHandlerMap.set("c2cMessageModified", this._c2cMessageModifiedHandler.bind(this)), this._eventHandlerMap.set("groupMessageModified", this._groupMessageModifiedHandler.bind(this)), this._eventHandlerMap.set("userStatusList", this._userStatusListHandler.bind(this)), this._eventHandlerMap.set("messageExtensionNotify", this._messageExtensionNotifyHandler.bind(this)), this._keys = m(this._eventHandlerMap.keys());
  8862. }
  8863. return a(e2, [{ key: "_c2cMessageArrayHandler", value: function(e3) {
  8864. var t2 = this._sessionModule.getModule(Gn);
  8865. if (t2) {
  8866. if (e3.dataList.forEach(function(e4) {
  8867. if (1 === e4.isSyncMessage) {
  8868. var t3 = e4.from;
  8869. e4.from = e4.to, e4.to = t3;
  8870. }
  8871. }), 1 === e3.needSync)
  8872. this._sessionModule.getModule(Yn).startOnlineSync();
  8873. t2.onNewC2CMessage({ dataList: e3.dataList, isInstantMessage: true });
  8874. }
  8875. } }, { key: "_c2cMessageModifiedHandler", value: function(e3) {
  8876. var t2 = this._sessionModule.getModule(Gn);
  8877. t2 && t2.onC2CMessageModified(e3);
  8878. } }, { key: "_groupMessageArrayHandler", value: function(e3) {
  8879. var t2 = this._sessionModule.getModule(Un);
  8880. t2 && t2.onNewGroupMessage({ event: e3.event, dataList: e3.dataList, isInstantMessage: true });
  8881. } }, { key: "_groupMessageModifiedHandler", value: function(e3) {
  8882. var t2 = this._sessionModule.getModule(Un);
  8883. t2 && t2.onGroupMessageModified(e3);
  8884. } }, { key: "_groupTipsHandler", value: function(e3) {
  8885. var t2 = this._sessionModule.getModule(Un);
  8886. if (t2) {
  8887. var n2 = e3.event, o2 = e3.dataList, s2 = e3.isInstantMessage, a2 = void 0 === s2 || s2, r2 = e3.isSyncingEnded;
  8888. switch (n2) {
  8889. case 4:
  8890. case 6:
  8891. t2.onNewGroupTips({ event: n2, dataList: o2 });
  8892. break;
  8893. case 5:
  8894. for (var i2 = 0; i2 < o2.length; i2++)
  8895. if (st(o2[i2].elements.revokedInfos))
  8896. t2.onGroupMessageRevoked({ dataList: o2 });
  8897. else if (st(o2[i2].elements.groupMessageReadNotice))
  8898. t2.onGroupMessageReadNotice({ dataList: o2 });
  8899. else {
  8900. if (!st(o2[i2].elements.readReceiptList)) {
  8901. t2.onNewGroupSystemNotice({ dataList: o2, isInstantMessage: a2, isSyncingEnded: r2 });
  8902. break;
  8903. }
  8904. t2.onReadReceiptList({ dataList: o2 });
  8905. }
  8906. break;
  8907. case 12:
  8908. this._sessionModule.getModule(Fn).onNewGroupAtTips({ dataList: o2 });
  8909. break;
  8910. default:
  8911. xe.l("".concat(this._n, "._groupTipsHandler unknown event:").concat(n2, " dataList:"), o2);
  8912. }
  8913. }
  8914. } }, { key: "_C2CNotifyMessageArrayHandler", value: function(e3) {
  8915. var t2 = this, n2 = e3.dataList;
  8916. if (st(n2)) {
  8917. var o2 = this._sessionModule.getModule(Gn);
  8918. n2.forEach(function(e4) {
  8919. if (ot(e4)) {
  8920. if (e4.hasOwnProperty("kickoutMsgNotify")) {
  8921. var s2 = e4.kickoutMsgNotify, a2 = s2.kickType, r2 = s2.newInstanceInfo, i2 = void 0 === r2 ? {} : r2;
  8922. 1 === a2 ? t2._sessionModule.onMultipleAccountKickedOut(i2) : 2 === a2 ? t2._sessionModule.onMultipleDeviceKickedOut(i2) : 3 === a2 && t2._sessionModule.onRestApiKickedOut(i2);
  8923. } else if (e4.hasOwnProperty("c2cMessageRevokedNotify"))
  8924. o2 && o2.onC2CMessageRevoked({ dataList: n2 });
  8925. else if (e4.hasOwnProperty("c2cMessageReadReceipt"))
  8926. o2 && o2.onC2CMessageReadReceipt({ dataList: n2 });
  8927. else if (e4.hasOwnProperty("c2cMessageReadNotice"))
  8928. o2 && o2.onC2CMessageReadNotice({ dataList: n2 });
  8929. else if (e4.hasOwnProperty("muteNotificationsSync")) {
  8930. t2._sessionModule.getModule(Fn).onC2CMessageRemindTypeSynced({ dataList: n2 });
  8931. }
  8932. }
  8933. });
  8934. }
  8935. } }, { key: "_C2CReadReceiptArrayHandler", value: function(e3) {
  8936. this._sessionModule.getModule(Gn).onReadReceiptList(e3);
  8937. } }, { key: "_profileHandler", value: function(e3) {
  8938. this._sessionModule.getModule(On).onProfileModified({ dataList: e3.dataList });
  8939. var t2 = this._sessionModule.getModule(Pn);
  8940. t2 && t2.onFriendProfileModified({ dataList: e3.dataList });
  8941. } }, { key: "_relationChainHandler", value: function(e3) {
  8942. this._sessionModule.getModule(On).onRelationChainModified({ dataList: e3.dataList });
  8943. var t2 = this._sessionModule.getModule(Pn);
  8944. t2 && t2.onRelationChainModified({ dataList: e3.dataList });
  8945. } }, { key: "_recentContactHandler", value: function(e3) {
  8946. var t2 = e3.dataList;
  8947. if (st(t2)) {
  8948. var n2 = this._sessionModule.getModule(Fn);
  8949. n2 && t2.forEach(function(e4) {
  8950. var t3 = e4.pushType;
  8951. if (1 === t3) {
  8952. var o2 = e4.recentContactDeleteItem;
  8953. n2.onConversationDeleted(o2.recentContactList);
  8954. } else if (2 === t3) {
  8955. var s2 = e4.recentContactTopItem;
  8956. n2.onConversationPinned(s2.recentContactList);
  8957. } else if (3 === t3) {
  8958. var a2 = e4.recentContactTopItem;
  8959. n2.onConversationUnpinned(a2.recentContactList);
  8960. } else if (4 === t3) {
  8961. var r2 = e4.recentContactMarkContact;
  8962. n2.onConversationMarkUpdated(r2.recentContactMarkContactItem);
  8963. } else if (5 === t3) {
  8964. var i2 = e4.recentContactCreateContactGroup;
  8965. n2.onConversationGroupCreated(i2.msgContactGroupContactItem);
  8966. } else if (6 === t3) {
  8967. var u2 = e4.recentContactDelContactGroup;
  8968. n2.onConversationGroupDeleted(u2.msgGroupItem);
  8969. } else if (7 === t3) {
  8970. var c2 = e4.recentContactUpdateContactGroup, l2 = c2.updateType, p2 = c2.msgUpdateGroup, d2 = c2.msgUpdateContact;
  8971. if (1 === l2) {
  8972. var g2 = p2.updateGroupType;
  8973. 1 === g2 ? n2.onConversationGroupNameUpdated(p2) : 2 === g2 && n2.onConversationInGroupUpdated(p2);
  8974. } else
  8975. 2 === l2 && n2.onConversationAddedToOrDeletedFromGroup(d2);
  8976. }
  8977. });
  8978. }
  8979. } }, { key: "_allMessageReadHandler", value: function(e3) {
  8980. var t2 = e3.dataList, n2 = this._sessionModule.getModule(Fn);
  8981. n2 && n2.onPushedAllMessageRead(t2);
  8982. } }, { key: "_userStatusListHandler", value: function(e3) {
  8983. this._sessionModule.getModule(On).onUserStatusUpdated(e3);
  8984. } }, { key: "_messageExtensionNotifyHandler", value: function(e3) {
  8985. this._sessionModule.getModule(Nn).onMessageExtensionNotify(e3);
  8986. } }, { key: "onMessage", value: function(e3) {
  8987. var t2 = this, n2 = e3.body;
  8988. if (this._filterMessageFromIMOpenPush(e3)) {
  8989. var o2 = n2.eventArray, s2 = n2.isInstantMessage, a2 = n2.isSyncingEnded, r2 = n2.needSync;
  8990. if (st(o2))
  8991. for (var i2 = null, u2 = null, c2 = 0, l2 = 0, p2 = o2.length; l2 < p2; l2++) {
  8992. c2 = (i2 = o2[l2]).event;
  8993. var d2 = Object.keys(i2).find(function(e4) {
  8994. return -1 !== t2._keys.indexOf(e4);
  8995. });
  8996. d2 ? (u2 = 14 === c2 ? { readAllC2CMessage: i2[d2], groupMessageReadInfoList: i2.groupMessageReadNotice || [] } : 16 === c2 ? { userID: i2.userID, readReceiptList: i2[d2] } : i2[d2], this._eventHandlerMap.get(d2)({ event: c2, dataList: u2, isInstantMessage: s2, isSyncingEnded: a2, needSync: r2 })) : xe.l("".concat(this._n, ".onMessage unknown eventItem:").concat(i2));
  8997. }
  8998. }
  8999. } }, { key: "_filterMessageFromIMOpenPush", value: function(e3) {
  9000. var t2 = e3.head, n2 = e3.body, o2 = t2.servcmd, s2 = false;
  9001. if (at(o2) || (s2 = o2.includes(V.NAME.IM_CONFIG_MANAGER) || o2.includes(V.NAME.OVERLOAD_PUSH) || o2.includes(V.NAME.STAT_SERVICE)), !s2)
  9002. return true;
  9003. if (o2.includes(V.CMD.PUSHED_CLOUD_CONTROL_CONFIG))
  9004. this._sessionModule.getModule(Xn).onPushedCloudControlConfig(n2);
  9005. else if (o2.includes(V.CMD.PUSHED_COMMERCIAL_CONFIG)) {
  9006. this._sessionModule.getModule(eo).onPushedConfig(n2);
  9007. } else if (o2.includes(V.CMD.OVERLOAD_NOTIFY))
  9008. this._sessionModule.onPushedServerOverload(n2);
  9009. else if (o2.includes(V.CMD.KICK_OTHER)) {
  9010. var a2 = Date.now();
  9011. this._sessionModule.reLoginOnKickOther();
  9012. var r2 = new ka("kickOther"), i2 = this._sessionModule.getModule(An).getLastWsHelloTs(), u2 = a2 - i2;
  9013. r2.setMessage("last wshello time:".concat(i2, " diff:").concat(u2, "ms")).setNetworkType(this._sessionModule.getNetworkType()).end();
  9014. }
  9015. return false;
  9016. } }]), e2;
  9017. }(), Wi = [{ cmd: V.CMD.GET_GROUP_INFO, interval: 1, count: 20 }, { cmd: V.CMD.GET_AVCHATROOM_MEMBER_LIST, interval: 3, count: 1 }, { cmd: V.CMD.GET_GROUP_APPLICATION, interval: 1, count: 15 }, { cmd: V.CMD.GET_TOPIC_LIST, interval: 1, count: 10 }, { cmd: V.CMD.SET_GROUP_ATTRIBUTES, interval: 5, count: 10 }, { cmd: V.CMD.MODIFY_GROUP_ATTRIBUTES, interval: 5, count: 10 }, { cmd: V.CMD.DELETE_GROUP_ATTRIBUTES, interval: 5, count: 10 }, { cmd: V.CMD.CLEAR_GROUP_ATTRIBUTES, interval: 5, count: 10 }, { cmd: V.CMD.GET_GROUP_ATTRIBUTES, interval: 5, count: 20 }, { cmd: V.CMD.UPDATE_GROUP_COUNTER, interval: 5, count: 20 }, { cmd: V.CMD.GET_GROUP_COUNTER, interval: 5, count: 20 }, { cmd: V.CMD.SET_ALL_MESSAGE_READ, interval: 1, count: 1 }, { cmd: V.CMD.GET_USER_STATUS, interval: 5, count: 20 }, { cmd: V.CMD.SUBSCRIBE_USER_STATUS, interval: 5, count: 20 }, { cmd: V.CMD.UNSUBSCRIBE_USER_STATUS, interval: 5, count: 20 }], Yi = function(e2) {
  9018. i(s2, e2);
  9019. var n2 = f(s2);
  9020. function s2(e3) {
  9021. var t2;
  9022. return o(this, s2), (t2 = n2.call(this, e3))._n = "SessionModule", t2._platform = t2.getPlatform(), t2._protocolHandler = new Bi(_(t2)), t2._messageDispatcher = new Ki(_(t2)), t2._commandFrequencyLimitMap = /* @__PURE__ */ new Map(), t2._commandRequestInfoMap = /* @__PURE__ */ new Map(), t2._serverOverloadInfoMap = /* @__PURE__ */ new Map(), t2._init(), t2.getInnerEmitterInstance().on($a, t2._onCloudConfigUpdated, _(t2)), t2;
  9023. }
  9024. return a(s2, [{ key: "_init", value: function() {
  9025. this._updateCommandFrequencyLimitMap(Wi);
  9026. } }, { key: "_onCloudConfigUpdated", value: function() {
  9027. var e3 = this.getCloudConfig("cmd_frequency_limit");
  9028. at(e3) || (e3 = JSON.parse(e3), this._updateCommandFrequencyLimitMap(e3));
  9029. } }, { key: "_updateCommandFrequencyLimitMap", value: function(e3) {
  9030. var t2 = this;
  9031. e3.forEach(function(e4) {
  9032. t2._commandFrequencyLimitMap.set(e4.cmd, { interval: e4.interval, count: e4.count });
  9033. });
  9034. } }, { key: "updateProtocolConfig", value: function() {
  9035. this._protocolHandler.update();
  9036. } }, { key: "request", value: function(e3) {
  9037. xe.d("".concat(this._n, ".request options:"), e3);
  9038. var t2 = e3.protocolName, n3 = e3.tjgID;
  9039. if (!this._protocolHandler.has(t2))
  9040. return xe.w("".concat(this._n, ".request unknown protocol:").concat(t2)), Ja({ code: da.CANNOT_FIND_PROTOCOL });
  9041. var o2 = this.getProtocolData(e3), s3 = o2.head.servcmd;
  9042. if (this._isFrequencyOverLimit(s3))
  9043. return Ja({ code: da.OVER_FREQUENCY_LIMIT });
  9044. if (this._isServerOverload(s3))
  9045. return Ja({ code: da.OPEN_SERVICE_OVERLOAD_ERROR });
  9046. jt(n3) || (o2.head.tjgID = n3);
  9047. var a2 = this.getModule(zn);
  9048. return Hi.includes(t2) ? a2.simplySend(o2) : a2.send(o2);
  9049. } }, { key: "getKeyMap", value: function(e3) {
  9050. return this._protocolHandler.getKeyMap(e3);
  9051. } }, { key: "genCommonHead", value: function() {
  9052. var e3 = this.getModule(qn);
  9053. return { ver: "v4", platform: this._platform, websdkappid: O, websdkversion: N, a2: e3.getA2Key() || void 0, tinyid: e3.getTinyID() || void 0, status_instid: e3.getStatusInstanceID(), sdkappid: e3.getSDKAppID(), contenttype: e3.getContentType(), reqtime: 0, identifier: e3.getA2Key() ? void 0 : e3.getUserID(), usersig: e3.getA2Key() ? void 0 : e3.getUserSig(), sdkability: 192371, tjgID: "" };
  9054. } }, { key: "genCosSpecifiedHead", value: function() {
  9055. var e3 = this.getModule(qn);
  9056. return { ver: "v4", platform: this._platform, websdkappid: O, websdkversion: N, sdkappid: e3.getSDKAppID(), contenttype: e3.getContentType(), reqtime: 0, identifier: e3.getUserID(), usersig: e3.getUserSig(), status_instid: e3.getStatusInstanceID(), sdkability: 192371 };
  9057. } }, { key: "genSSOReportHead", value: function() {
  9058. var e3 = this.getModule(qn);
  9059. return { ver: "v4", platform: this._platform, websdkappid: O, websdkversion: N, sdkappid: e3.getSDKAppID(), contenttype: "", reqtime: 0, identifier: "", usersig: "", status_instid: e3.getStatusInstanceID(), sdkability: 192371 };
  9060. } }, { key: "getProtocolData", value: function(e3) {
  9061. return this._protocolHandler.getProtocolData(e3);
  9062. } }, { key: "trans", value: function(e3) {
  9063. var n3 = e3.servcmd, o2 = e3.data, s3 = { head: t(t({}, this.genCommonHead()), {}, { servcmd: n3 }), body: o2 };
  9064. return this.getModule(zn).send(s3);
  9065. } }, { key: "sendComboMessage", value: function(e3) {
  9066. var n3 = e3.servcmd, o2 = e3.data, s3 = { head: t(t({}, this.genCommonHead()), {}, { servcmd: n3 }), body: o2 };
  9067. return this.getModule(zn).send(s3);
  9068. } }, { key: "onErrorCodeNotZero", value: function(e3) {
  9069. var t2 = e3.errorCode;
  9070. if (t2 === da.HELLO_ANSWER_KICKED_OUT) {
  9071. var n3 = e3.kickType, o2 = e3.newInstanceInfo, s3 = void 0 === o2 ? {} : o2;
  9072. 1 === n3 ? this.onMultipleAccountKickedOut(s3) : 2 === n3 ? this.onMultipleDeviceKickedOut(s3) : 3 === n3 && this.onRestApiKickedOut(s3);
  9073. }
  9074. t2 !== da.MESSAGE_A2KEY_EXPIRED && t2 !== da.ACCOUNT_A2KEY_EXPIRED || (this._onUserSigExpired(), this.getModule(zn).reConnect());
  9075. } }, { key: "onMessage", value: function(e3) {
  9076. var t2 = e3.body, n3 = t2.needAck, o2 = void 0 === n3 ? 0 : n3, s3 = t2.sessionData;
  9077. 1 === o2 && this._sendACK(s3), this._messageDispatcher.onMessage(e3);
  9078. } }, { key: "onReconnected", value: function() {
  9079. this._reLoginOnReconnected();
  9080. } }, { key: "reLoginOnKickOther", value: function() {
  9081. xe.l("".concat(this._n, ".reLoginOnKickOther")), this._reLogin();
  9082. } }, { key: "_reLoginOnReconnected", value: function() {
  9083. xe.l("".concat(this._n, "._reLoginOnReconnected")), this._reLogin();
  9084. } }, { key: "_reLogin", value: function() {
  9085. var e3 = this;
  9086. if (this.isLoggedIn()) {
  9087. var t2 = 0, n3 = this.getModule(to);
  9088. n3.canIUseOfflinePush() && (t2 = n3.getUniAppPlatform()), this.request({ protocolName: io, requestData: { isWebUniapp: t2 } }).then(function(t3) {
  9089. var n4 = t3.data.instanceID;
  9090. e3.getModule(qn).setStatusInstanceID(n4), xe.l("".concat(e3._n, "._reLogin ok.")), e3.getModule(Fn).syncConversationList().then(function() {
  9091. xe.l("".concat(e3._n, "._reLogin, sync conversation list ok.")), e3.getModule(Zn).start();
  9092. }), e3.getModule(Un).updateLocalMainSequenceOnReconnected();
  9093. var o2 = e3.getModule(wn);
  9094. o2.resetGetTopicTime(), o2.getTopicListOnReconnected();
  9095. });
  9096. }
  9097. } }, { key: "onMultipleAccountKickedOut", value: function(e3) {
  9098. this.getModule(An).onMultipleAccountKickedOut(e3);
  9099. } }, { key: "onMultipleDeviceKickedOut", value: function(e3) {
  9100. this.getModule(An).onMultipleDeviceKickedOut(e3);
  9101. } }, { key: "_onUserSigExpired", value: function() {
  9102. this.getModule(An).onUserSigExpired();
  9103. } }, { key: "onRestApiKickedOut", value: function(e3) {
  9104. this.getModule(An).onRestApiKickedOut(e3);
  9105. } }, { key: "_sendACK", value: function(e3) {
  9106. this.request({ protocolName: Ks, requestData: { sessionData: e3 } });
  9107. } }, { key: "_isFrequencyOverLimit", value: function(e3) {
  9108. var t2 = e3.split(".")[1];
  9109. if (!this._commandFrequencyLimitMap.has(t2))
  9110. return false;
  9111. if (!this._commandRequestInfoMap.has(t2))
  9112. return this._commandRequestInfoMap.set(t2, { startTime: Date.now(), requestCount: 1 }), false;
  9113. var n3 = this._commandFrequencyLimitMap.get(t2), o2 = n3.count, s3 = n3.interval, a2 = this._commandRequestInfoMap.get(t2), r2 = a2.startTime, i2 = a2.requestCount;
  9114. if (Date.now() - r2 > 1e3 * s3)
  9115. return this._commandRequestInfoMap.set(t2, { startTime: Date.now(), requestCount: 1 }), false;
  9116. i2 += 1, this._commandRequestInfoMap.set(t2, { startTime: r2, requestCount: i2 });
  9117. var u2 = false;
  9118. return i2 > o2 && (u2 = true), u2;
  9119. } }, { key: "_isServerOverload", value: function(e3) {
  9120. if (!this._serverOverloadInfoMap.has(e3))
  9121. return false;
  9122. var t2 = this._serverOverloadInfoMap.get(e3), n3 = t2.overloadTime, o2 = t2.waitingTime, s3 = false;
  9123. return Date.now() - n3 <= 1e3 * o2 ? s3 = true : (this._serverOverloadInfoMap.delete(e3), s3 = false), s3;
  9124. } }, { key: "onPushedServerOverload", value: function(e3) {
  9125. var t2 = e3.overloadCommand, n3 = e3.waitingTime;
  9126. this._serverOverloadInfoMap.set(t2, { overloadTime: Date.now(), waitingTime: n3 }), xe.w("".concat(this._n, ".onPushedServerOverload waitingTime:").concat(n3, "s"));
  9127. } }, { key: "reset", value: function() {
  9128. xe.l("".concat(this._n, ".reset")), this._updateCommandFrequencyLimitMap(Wi), this._commandRequestInfoMap.clear(), this._serverOverloadInfoMap.clear();
  9129. } }]), s2;
  9130. }(ro), ji = function(e2) {
  9131. i(n2, e2);
  9132. var t2 = f(n2);
  9133. function n2(e3) {
  9134. var s2;
  9135. return o(this, n2), (s2 = t2.call(this, e3))._n = "MessageLossDetectionModule", s2._maybeLostSequencesMap = /* @__PURE__ */ new Map(), s2._firstRoundRet = [], s2;
  9136. }
  9137. return a(n2, [{ key: "onMessageMaybeLost", value: function(e3, t3, n3) {
  9138. this._maybeLostSequencesMap.has(e3) || this._maybeLostSequencesMap.set(e3, []);
  9139. for (var o2 = this._maybeLostSequencesMap.get(e3), s2 = 0; s2 < n3; s2++)
  9140. -1 === o2.indexOf(t3 + s2) && o2.push(t3 + s2);
  9141. } }, { key: "detectFirstRound", value: function(e3, t3) {
  9142. var n3 = this._maybeLostSequencesMap.get(e3);
  9143. if (!jt(n3) && !jt(t3)) {
  9144. var o2 = n3.filter(function(e4) {
  9145. return -1 === t3.indexOf(e4);
  9146. });
  9147. 0 === o2.length ? xe.i("".concat(this._n, ".detectFirstRound no message loss. conversationID:").concat(e3)) : this._firstRoundRet = this._firstRoundRet.concat(o2), n3.length = 0;
  9148. }
  9149. } }, { key: "detectSecondRound", value: function(e3, t3) {
  9150. if (!jt(this._firstRoundRet) && !jt(t3)) {
  9151. var n3 = this._firstRoundRet.filter(function(e4) {
  9152. return -1 === t3.indexOf(e4);
  9153. });
  9154. this._firstRoundRet.length = 0;
  9155. var o2, s2 = n3.length;
  9156. if (0 !== s2)
  9157. s2 <= 5 ? o2 = e3 + "-" + n3.join("-") : (n3.sort(function(e4, t4) {
  9158. return e4 - t4;
  9159. }), o2 = e3 + " start:" + n3[0] + " end:" + n3[s2 - 1] + " count:" + s2), new ka("messageLoss").setMessage(o2).setNetworkType(this.getNetworkType()).setLevel("warning").end(), xe.i("".concat(this._n, ".detectSecondRound message loss detected. conversationID:").concat(e3, " lostSequences:").concat(n3));
  9160. }
  9161. } }, { key: "reset", value: function() {
  9162. xe.l("".concat(this._n, ".reset")), this._maybeLostSequencesMap.clear(), this._firstRoundRet.length = 0;
  9163. } }]), n2;
  9164. }(ro), zi = function(e2) {
  9165. i(n2, e2);
  9166. var t2 = f(n2);
  9167. function n2(e3) {
  9168. var s2;
  9169. return o(this, n2), (s2 = t2.call(this, e3))._n = "CloudControlModule", s2._cloudConfig = /* @__PURE__ */ new Map(), s2._expiredTime = 0, s2._version = 0, s2._isFetching = false, s2;
  9170. }
  9171. return a(n2, [{ key: "getCloudConfig", value: function(e3) {
  9172. return at(e3) ? this._cloudConfig : this._cloudConfig.has(e3) ? this._cloudConfig.get(e3) : void 0;
  9173. } }, { key: "_canFetchConfig", value: function() {
  9174. return this.isLoggedIn() && !this._isFetching && Date.now() >= this._expiredTime;
  9175. } }, { key: "fetchConfig", value: function() {
  9176. var e3 = this, t3 = this._canFetchConfig();
  9177. if (xe.l("".concat(this._n, ".fetchConfig canFetchConfig:").concat(t3)), t3) {
  9178. var n3 = new ka("fetchCloudControlConfig"), o2 = this.getModule(qn).getSDKAppID();
  9179. this._isFetching = true, this.request({ protocolName: zs, requestData: { SDKAppID: o2, version: this._version } }).then(function(t4) {
  9180. e3._isFetching = false, n3.setMessage("version:".concat(e3._version, " newVersion:").concat(t4.data.version, " config:").concat(t4.data.cloudControlConfig)).setNetworkType(e3.getNetworkType()).end(), xe.l("".concat(e3._n, ".fetchConfig ok")), e3._parseCloudControlConfig(t4.data);
  9181. }).catch(function(t4) {
  9182. e3._isFetching = false, e3.probeNetwork().then(function(e4) {
  9183. var o3 = v(e4, 2), s2 = o3[0], a2 = o3[1];
  9184. n3.setError(t4, s2, a2).end();
  9185. }), xe.l("".concat(e3._n, ".fetchConfig failed. error:"), t4), e3._setExpiredTimeOnResponseError(12e4);
  9186. });
  9187. }
  9188. } }, { key: "onPushedCloudControlConfig", value: function(e3) {
  9189. xe.l("".concat(this._n, ".onPushedCloudControlConfig")), new ka("pushedCloudControlConfig").setNetworkType(this.getNetworkType()).setMessage("newVersion:".concat(e3.version, " config:").concat(e3.cloudControlConfig)).end(), this._parseCloudControlConfig(e3);
  9190. } }, { key: "onCheckTimer", value: function(e3) {
  9191. this._canFetchConfig() && this.fetchConfig();
  9192. } }, { key: "_parseCloudControlConfig", value: function(e3) {
  9193. var t3 = this, n3 = "".concat(this._n, "._parseCloudControlConfig"), o2 = e3.errorCode, s2 = e3.errorMessage, a2 = e3.cloudControlConfig, r2 = e3.version, i2 = e3.expiredTime;
  9194. if (0 === o2) {
  9195. if (this._version !== r2) {
  9196. var u2 = null;
  9197. try {
  9198. u2 = JSON.parse(a2);
  9199. } catch (c2) {
  9200. this.isPrivateNetWork() || xe.e("".concat(n3, " JSON parse error. cloudControlConfig:"), a2);
  9201. }
  9202. u2 && (this._cloudConfig.clear(), Object.keys(u2).forEach(function(e4) {
  9203. t3._cloudConfig.set(e4, u2[e4]);
  9204. }), this._version = r2, this.emitInnerEvent($a));
  9205. }
  9206. this._expiredTime = Date.now() + 1e3 * i2;
  9207. } else
  9208. at(o2) ? (xe.l("".concat(n3, " failed. Invalid message format:"), e3), this._setExpiredTimeOnResponseError(36e5)) : (xe.e("".concat(n3, " errorCode:").concat(o2, " errorMessage:").concat(s2)), this._setExpiredTimeOnResponseError(12e4));
  9209. } }, { key: "_setExpiredTimeOnResponseError", value: function(e3) {
  9210. this._expiredTime = Date.now() + e3;
  9211. } }, { key: "reset", value: function() {
  9212. xe.l("".concat(this._n, ".reset")), this._cloudConfig.clear(), this._expiredTime = 0, this._version = 0, this._isFetching = false;
  9213. } }]), n2;
  9214. }(ro), Ji = function(e2) {
  9215. i(n2, e2);
  9216. var t2 = f(n2);
  9217. function n2(e3) {
  9218. var s2;
  9219. return o(this, n2), (s2 = t2.call(this, e3))._n = "RecoverMessageModule", s2.PULL_LIMIT_COUNT = 15, s2;
  9220. }
  9221. return a(n2, [{ key: "start", value: function() {
  9222. this._recoverGroupChat(), this._recoverC2CChat();
  9223. } }, { key: "_recoverGroupChat", value: function() {
  9224. var e3, t3, n3 = this, o2 = this._getLocalConversationList().filter(function(e4) {
  9225. return e4.type === S.CONV_GROUP && e4.groupProfile.type !== S.GRP_AVCHATROOM;
  9226. }), s2 = this.getModule(Fn), a2 = 0, r2 = 0, i2 = 0;
  9227. o2.forEach(function(o3) {
  9228. var u2 = o3.conversationID, c2 = o3.lastMessage;
  9229. t3 = u2.replace(S.CONV_GROUP, ""), e3 = s2.getLocalLastMessage(u2), c2 && 0 !== c2.lastSequence && e3 ? (r2 = c2.lastSequence, a2 = e3.sequence, i2 = r2 - a2, a2 > 0 && i2 >= 1 && i2 < 300 ? n3._recoverGroupMessage({ groupID: t3, localLastMessageSequence: a2, remoteLastMessageSequence: r2 }) : n3._getGroupNotify(t3)) : n3._getGroupNotify(t3);
  9230. });
  9231. } }, { key: "_recoverC2CChat", value: function() {
  9232. var e3, t3 = this, n3 = this._getLocalConversationList().filter(function(e4) {
  9233. return e4.type === S.CONV_C2C;
  9234. }), o2 = this.getModule(Fn), s2 = 0, a2 = 0, r2 = 0, i2 = [Promise.resolve()];
  9235. n3.forEach(function(n4) {
  9236. var u2 = n4.conversationID, c2 = n4.lastMessage;
  9237. e3 = o2.getLocalLastMessage(u2), c2 && 0 !== c2.lastTime && e3 && (a2 = c2.lastTime, s2 = e3.time, r2 = a2 - s2, s2 > 0 && r2 >= 1 && r2 <= 600 && i2.push(t3._recoverC2CMessage({ conversationID: u2, localLastMessageTime: s2, remoteLastMessageTime: a2 })));
  9238. }), Promise.all(i2).then(function() {
  9239. xe.l("".concat(t3._n, "._recoverC2CChat all promise fulfilled, start to sync unread messages")), t3.getModule(Yn).startSyncOnReconnected();
  9240. });
  9241. } }, { key: "_getLocalConversationList", value: function() {
  9242. return this.getModule(Fn).getLocalConversationList();
  9243. } }, { key: "_recoverGroupMessage", value: function(e3) {
  9244. var t3 = this, n3 = "".concat(this._n, "._recoverGroupMessage");
  9245. xe.l("".concat(n3, " options:"), e3);
  9246. var o2 = e3.groupID, s2 = e3.localLastMessageSequence, a2 = e3.remoteLastMessageSequence;
  9247. this._getGroupRomaingMessage({ groupID: o2, sequence: s2 }).then(function(e4) {
  9248. var s3 = e4.data, r2 = s3.complete, i2 = s3.messageList;
  9249. if (!at(i2)) {
  9250. var u2 = i2[0].sequence;
  9251. xe.l("".concat(n3, " pkgLastMessageSequence:").concat(u2, " complete:").concat(r2)), u2 < a2 && 2 !== r2 && t3._recoverGroupMessage({ groupID: o2, localLastMessageSequence: u2, remoteLastMessageSequence: a2 }), new ka("recoverMessage").setNetworkType(t3.getNetworkType()).setMessage("groupID:".concat(o2, " complete:").concat(r2, " messageList length:").concat(i2.length)).end();
  9252. var c2 = t3.getModule(Un);
  9253. i2.length > 1 && i2.sort(function(e5, t4) {
  9254. return e5.sequence - t4.sequence;
  9255. });
  9256. for (var l2 = 0; l2 < i2.length; l2++) {
  9257. var p2 = i2[l2];
  9258. p2.from !== S.CONV_SYSTEM ? c2.onNewGroupMessage({ dataList: [p2], isInstantMessage: false, updateUnreadCount: false }) : c2.onNewGroupTips({ event: p2.event, dataList: [p2] });
  9259. }
  9260. t3._getGroupNotify(o2);
  9261. }
  9262. });
  9263. } }, { key: "_getGroupNotify", value: function(e3) {
  9264. this.getModule(Un).getGroupNotify(e3);
  9265. } }, { key: "_getGroupRomaingMessage", value: function(e3) {
  9266. var t3 = e3.groupID, n3 = e3.sequence;
  9267. return this.request({ protocolName: is, requestData: { groupID: t3, count: this.PULL_LIMIT_COUNT, sequence: n3 + this.PULL_LIMIT_COUNT - 1 } });
  9268. } }, { key: "_recoverC2CMessage", value: function(e3) {
  9269. var t3 = this, n3 = "".concat(this._n, "._recoverC2CMessage");
  9270. xe.l("".concat(this._n, "._recoverC2CMessage options:"), e3);
  9271. var o2 = e3.conversationID, s2 = e3.localLastMessageTime, a2 = e3.remoteLastMessageTime;
  9272. return this._getC2CRoamingMessage({ conversationID: o2, time: s2 }).then(function(e4) {
  9273. var s3 = e4.data, r2 = s3.complete, i2 = s3.messageList;
  9274. if (!at(i2)) {
  9275. var u2 = i2.length;
  9276. new ka("recoverMessage").setNetworkType(t3.getNetworkType()).setMessage("".concat(o2, " complete:").concat(r2, " messageList length:").concat(u2)).end(), t3.getModule(Gn).onNewC2CMessage({ dataList: i2, isInstantMessage: true });
  9277. var c2 = i2[u2 - 1].time;
  9278. if (xe.l("".concat(n3, " pkgLastMessageTime:").concat(c2, " complete:").concat(r2)), c2 < a2 && 1 !== r2)
  9279. return t3._recoverC2CMessage({ conversationID: o2, localLastMessageTime: c2, remoteLastMessageTime: a2 });
  9280. }
  9281. });
  9282. } }, { key: "_getC2CRoamingMessage", value: function(e3) {
  9283. var t3 = e3.conversationID, n3 = e3.time;
  9284. return this.request({ protocolName: Eo, requestData: { peerAccount: t3.replace(S.CONV_C2C, ""), count: this.PULL_LIMIT_COUNT + 1, lastMessageTime: n3, direction: 1 } });
  9285. } }, { key: "reset", value: function() {
  9286. xe.l("".concat(this._n, ".reset"));
  9287. } }]), n2;
  9288. }(ro), Xi = function() {
  9289. function e2() {
  9290. o(this, e2), this._n = "AvgE2EDelay", this._e2eDelayArray = [];
  9291. }
  9292. return a(e2, [{ key: "addMessageDelay", value: function(e3) {
  9293. var t2 = be() - e3;
  9294. t2 >= 0 && this._e2eDelayArray.push(t2);
  9295. } }, { key: "_calcAvg", value: function(e3, t2) {
  9296. if (0 === t2)
  9297. return 0;
  9298. var n2 = 0;
  9299. return e3.forEach(function(e4) {
  9300. n2 += e4;
  9301. }), bt(n2 / t2, 1);
  9302. } }, { key: "_calcCountWithLimit", value: function(e3) {
  9303. var t2 = e3.e2eDelayArray, n2 = e3.min, o2 = e3.max;
  9304. return t2.filter(function(e4) {
  9305. return n2 <= e4 && e4 < o2;
  9306. }).length;
  9307. } }, { key: "_calcPercent", value: function(e3, t2) {
  9308. var n2 = bt(e3 / t2 * 100, 2);
  9309. return n2 > 100 && (n2 = 100), n2;
  9310. } }, { key: "_checkE2EDelayException", value: function(e3, t2) {
  9311. var n2 = e3.filter(function(e4) {
  9312. return e4 > t2;
  9313. });
  9314. if (n2.length > 0) {
  9315. var o2 = n2.length, s2 = Math.min.apply(Math, m(n2)), a2 = Math.max.apply(Math, m(n2)), r2 = this._calcAvg(n2, o2), i2 = bt(o2 / e3.length * 100, 2);
  9316. if (i2 > 50)
  9317. new ka("messageE2EDelayException").setMessage("count:".concat(o2, " min:").concat(s2, " max:").concat(a2, " avg:").concat(r2, " percent:").concat(i2)).setLevel("warning").end();
  9318. }
  9319. } }, { key: "getStatResult", value: function() {
  9320. var e3 = this._e2eDelayArray.length;
  9321. if (0 === e3)
  9322. return null;
  9323. var t2 = m(this._e2eDelayArray), n2 = this._calcCountWithLimit({ e2eDelayArray: t2, min: 0, max: 1 }), o2 = this._calcCountWithLimit({ e2eDelayArray: t2, min: 1, max: 3 }), s2 = this._calcPercent(n2, e3), a2 = this._calcPercent(o2, e3), r2 = this._calcAvg(t2, e3);
  9324. return this._checkE2EDelayException(t2, 3), t2.length = 0, this.reset(), { totalCount: e3, countLessThan1Second: n2, percentOfCountLessThan1Second: s2, countLessThan3Second: o2, percentOfCountLessThan3Second: a2, avgDelay: r2 };
  9325. } }, { key: "reset", value: function() {
  9326. this._e2eDelayArray.length = 0;
  9327. } }]), e2;
  9328. }(), Qi = function() {
  9329. function e2() {
  9330. o(this, e2), this._n = "AvgRTT", this._requestCount = 0, this._rttArray = [];
  9331. }
  9332. return a(e2, [{ key: "addRequestCount", value: function() {
  9333. this._requestCount += 1;
  9334. } }, { key: "addRTT", value: function(e3) {
  9335. this._rttArray.push(e3);
  9336. } }, { key: "_calcTotalCount", value: function() {
  9337. return this._requestCount;
  9338. } }, { key: "_calcRTTCount", value: function(e3) {
  9339. return e3.length;
  9340. } }, { key: "_calcSuccessRateOfRequest", value: function(e3, t2) {
  9341. if (0 === t2)
  9342. return 0;
  9343. var n2 = bt(e3 / t2 * 100, 2);
  9344. return n2 > 100 && (n2 = 100), n2;
  9345. } }, { key: "_calcAvg", value: function(e3, t2) {
  9346. if (0 === t2)
  9347. return 0;
  9348. var n2 = 0;
  9349. return e3.forEach(function(e4) {
  9350. n2 += e4;
  9351. }), parseInt(n2 / t2);
  9352. } }, { key: "_calcMax", value: function() {
  9353. return Math.max.apply(Math, m(this._rttArray));
  9354. } }, { key: "_calcMin", value: function() {
  9355. return Math.min.apply(Math, m(this._rttArray));
  9356. } }, { key: "getStatResult", value: function() {
  9357. var e3 = this._calcTotalCount(), t2 = m(this._rttArray);
  9358. if (0 === e3)
  9359. return null;
  9360. var n2 = this._calcRTTCount(t2), o2 = this._calcSuccessRateOfRequest(n2, e3), s2 = this._calcAvg(t2, n2);
  9361. return xe.l("".concat(this._n, ".getStatResult max:").concat(this._calcMax(), " min:").concat(this._calcMin(), " avg:").concat(s2)), this.reset(), { totalCount: e3, rttCount: n2, successRateOfRequest: o2, avgRTT: s2 };
  9362. } }, { key: "reset", value: function() {
  9363. this._requestCount = 0, this._rttArray.length = 0;
  9364. } }]), e2;
  9365. }(), Zi = function() {
  9366. function e2() {
  9367. o(this, e2), this._map = /* @__PURE__ */ new Map();
  9368. }
  9369. return a(e2, [{ key: "initMap", value: function(e3) {
  9370. var t2 = this;
  9371. e3.forEach(function(e4) {
  9372. t2._map.set(e4, { totalCount: 0, successCount: 0, failedCountOfUserSide: 0, costArray: [], fileSizeArray: [] });
  9373. });
  9374. } }, { key: "addTotalCount", value: function(e3) {
  9375. return !(at(e3) || !this._map.has(e3)) && (this._map.get(e3).totalCount += 1, true);
  9376. } }, { key: "addSuccessCount", value: function(e3) {
  9377. return !(at(e3) || !this._map.has(e3)) && (this._map.get(e3).successCount += 1, true);
  9378. } }, { key: "addFailedCountOfUserSide", value: function(e3) {
  9379. return !(at(e3) || !this._map.has(e3)) && (this._map.get(e3).failedCountOfUserSide += 1, true);
  9380. } }, { key: "addCost", value: function(e3, t2) {
  9381. return !(at(e3) || !this._map.has(e3)) && (this._map.get(e3).costArray.push(t2), true);
  9382. } }, { key: "addFileSize", value: function(e3, t2) {
  9383. return !(at(e3) || !this._map.has(e3)) && (this._map.get(e3).fileSizeArray.push(t2), true);
  9384. } }, { key: "_calcSuccessRateOfBusiness", value: function(e3) {
  9385. if (at(e3) || !this._map.has(e3))
  9386. return -1;
  9387. var t2 = this._map.get(e3), n2 = bt(t2.successCount / t2.totalCount * 100, 2);
  9388. return n2 > 100 && (n2 = 100), n2;
  9389. } }, { key: "_calcSuccessRateOfPlatform", value: function(e3) {
  9390. if (at(e3) || !this._map.has(e3))
  9391. return -1;
  9392. var t2 = this._map.get(e3), n2 = this._calcSuccessCountOfPlatform(e3) / t2.totalCount * 100;
  9393. return (n2 = bt(n2, 2)) > 100 && (n2 = 100), n2;
  9394. } }, { key: "_calcTotalCount", value: function(e3) {
  9395. return at(e3) || !this._map.has(e3) ? -1 : this._map.get(e3).totalCount;
  9396. } }, { key: "_calcSuccessCountOfBusiness", value: function(e3) {
  9397. return at(e3) || !this._map.has(e3) ? -1 : this._map.get(e3).successCount;
  9398. } }, { key: "_calcSuccessCountOfPlatform", value: function(e3) {
  9399. if (at(e3) || !this._map.has(e3))
  9400. return -1;
  9401. var t2 = this._map.get(e3);
  9402. return t2.successCount + t2.failedCountOfUserSide;
  9403. } }, { key: "_calcAvg", value: function(e3) {
  9404. return at(e3) || !this._map.has(e3) ? -1 : e3 === Ma ? this._calcAvgSpeed(e3) : this._calcAvgCost(e3);
  9405. } }, { key: "_calcAvgCost", value: function(e3) {
  9406. var t2 = this._map.get(e3).costArray.length;
  9407. if (0 === t2)
  9408. return 0;
  9409. var n2 = 0;
  9410. return this._map.get(e3).costArray.forEach(function(e4) {
  9411. n2 += e4;
  9412. }), parseInt(n2 / t2);
  9413. } }, { key: "_calcAvgSpeed", value: function(e3) {
  9414. var t2 = 0, n2 = 0;
  9415. return this._map.get(e3).costArray.forEach(function(e4) {
  9416. t2 += e4;
  9417. }), this._map.get(e3).fileSizeArray.forEach(function(e4) {
  9418. n2 += e4;
  9419. }), parseInt(1e3 * n2 / t2);
  9420. } }, { key: "getStatResult", value: function(e3) {
  9421. var t2 = this._calcTotalCount(e3);
  9422. if (0 === t2)
  9423. return null;
  9424. var n2 = this._calcSuccessCountOfBusiness(e3), o2 = this._calcSuccessRateOfBusiness(e3), s2 = this._calcSuccessCountOfPlatform(e3), a2 = this._calcSuccessRateOfPlatform(e3), r2 = this._calcAvg(e3);
  9425. return this.reset(e3), { totalCount: t2, successCountOfBusiness: n2, successRateOfBusiness: o2, successCountOfPlatform: s2, successRateOfPlatform: a2, avgValue: r2 };
  9426. } }, { key: "reset", value: function(e3) {
  9427. at(e3) ? this._map.clear() : this._map.set(e3, { totalCount: 0, successCount: 0, failedCountOfUserSide: 0, costArray: [], fileSizeArray: [] });
  9428. } }]), e2;
  9429. }(), $i = function() {
  9430. function e2() {
  9431. o(this, e2), this._lastMap = /* @__PURE__ */ new Map(), this._currentMap = /* @__PURE__ */ new Map();
  9432. }
  9433. return a(e2, [{ key: "initMap", value: function(e3) {
  9434. var t2 = this;
  9435. e3.forEach(function(e4) {
  9436. t2._lastMap.set(e4, /* @__PURE__ */ new Map()), t2._currentMap.set(e4, /* @__PURE__ */ new Map());
  9437. });
  9438. } }, { key: "addMessageSequence", value: function(e3) {
  9439. var t2 = e3.key, n2 = e3.message;
  9440. if (at(t2) || !this._lastMap.has(t2) || !this._currentMap.has(t2))
  9441. return false;
  9442. var o2 = n2.conversationID, s2 = n2.sequence, a2 = o2.replace(S.CONV_GROUP, "");
  9443. if (0 === this._lastMap.get(t2).size)
  9444. this._addCurrentMap(e3);
  9445. else if (this._lastMap.get(t2).has(a2)) {
  9446. var r2 = this._lastMap.get(t2).get(a2), i2 = r2.length - 1;
  9447. s2 > r2[0] && s2 < r2[i2] ? (r2.push(s2), r2.sort(), this._lastMap.get(t2).set(a2, r2)) : this._addCurrentMap(e3);
  9448. } else
  9449. this._addCurrentMap(e3);
  9450. return true;
  9451. } }, { key: "_addCurrentMap", value: function(e3) {
  9452. var t2 = e3.key, n2 = e3.message, o2 = n2.conversationID, s2 = n2.sequence, a2 = o2.replace(S.CONV_GROUP, "");
  9453. this._currentMap.get(t2).has(a2) || this._currentMap.get(t2).set(a2, []), this._currentMap.get(t2).get(a2).push(s2);
  9454. } }, { key: "_copyData", value: function(e3) {
  9455. if (!at(e3)) {
  9456. this._lastMap.set(e3, /* @__PURE__ */ new Map());
  9457. var t2, n2 = this._lastMap.get(e3), o2 = D(this._currentMap.get(e3));
  9458. try {
  9459. for (o2.s(); !(t2 = o2.n()).done; ) {
  9460. var s2 = v(t2.value, 2), a2 = s2[0], r2 = s2[1];
  9461. n2.set(a2, r2);
  9462. }
  9463. } catch (i2) {
  9464. o2.e(i2);
  9465. } finally {
  9466. o2.f();
  9467. }
  9468. n2 = null, this._currentMap.set(e3, /* @__PURE__ */ new Map());
  9469. }
  9470. } }, { key: "getStatResult", value: function(e3) {
  9471. if (at(this._currentMap.get(e3)) || at(this._lastMap.get(e3)))
  9472. return null;
  9473. if (0 === this._lastMap.get(e3).size)
  9474. return this._copyData(e3), null;
  9475. var t2 = 0, n2 = 0;
  9476. if (this._lastMap.get(e3).forEach(function(e4, o3) {
  9477. var s2 = m(e4.values()), a2 = s2.length, r2 = s2[a2 - 1] - s2[0] + 1;
  9478. t2 += r2, n2 += a2;
  9479. }), 0 === t2)
  9480. return null;
  9481. var o2 = bt(n2 / t2 * 100, 2);
  9482. return o2 > 100 && (o2 = 100), this._copyData(e3), { totalCount: t2, successCountOfMessageReceived: n2, successRateOfMessageReceived: o2 };
  9483. } }, { key: "reset", value: function() {
  9484. this._currentMap.clear(), this._lastMap.clear();
  9485. } }]), e2;
  9486. }(), eu = function(e2) {
  9487. i(s2, e2);
  9488. var n2 = f(s2);
  9489. function s2(e3) {
  9490. var t2;
  9491. o(this, s2), (t2 = n2.call(this, e3))._n = "QualityStatModule", t2.TAG = "im-ssolog-quality-stat", t2.reportIndex = 0, t2.wholePeriod = false, t2._qualityItems = [ga, _a, ha, fa, va, ma, Ma, ya, Ia, Ca], t2._messageSentItems = [ha, fa, va, ma, Ma], t2._messageReceivedItems = [ya, Ia, Ca], t2.REPORT_INTERVAL = 120, t2.REPORT_SDKAPPID_BLACKLIST = [], t2.REPORT_TINYID_WHITELIST = [], t2._statInfoArr = [], t2._avgRTT = new Qi(), t2._avgE2EDelay = new Xi(), t2._rateMessageSent = new Zi(), t2._rateMessageReceived = new $i();
  9492. var a2 = t2.getInnerEmitterInstance();
  9493. return a2.on(Za, t2._onLoginSuccess, _(t2)), a2.on($a, t2._onCloudConfigUpdated, _(t2)), t2;
  9494. }
  9495. return a(s2, [{ key: "_onLoginSuccess", value: function() {
  9496. var e3 = this;
  9497. this._rateMessageSent.initMap(this._messageSentItems), this._rateMessageReceived.initMap(this._messageReceivedItems);
  9498. var t2 = this.getModule(xn), n3 = t2.getItem(this.TAG, false);
  9499. !jt(n3) && it(n3.forEach) && (xe.l("".concat(this._n, "._onLoginSuccess get quality stat logs from local storage, count:").concat(n3.length)), n3.forEach(function(t3) {
  9500. e3._statInfoArr.push(t3);
  9501. }), t2.removeItem(this.TAG, false));
  9502. } }, { key: "_onCloudConfigUpdated", value: function() {
  9503. var e3 = this.getCloudConfig("q_rpt_interval"), t2 = this.getCloudConfig("q_rpt_sdkappid_bl"), n3 = this.getCloudConfig("q_rpt_tinyid_wl");
  9504. at(e3) || (this.REPORT_INTERVAL = Number(e3)), at(t2) || (this.REPORT_SDKAPPID_BLACKLIST = t2.split(",").map(function(e4) {
  9505. return Number(e4);
  9506. })), at(n3) || (this.REPORT_TINYID_WHITELIST = n3.split(","));
  9507. } }, { key: "onCheckTimer", value: function(e3) {
  9508. this.isLoggedIn() && e3 % this.REPORT_INTERVAL == 0 && (this.wholePeriod = true, this._report());
  9509. } }, { key: "addRequestCount", value: function() {
  9510. this._avgRTT.addRequestCount();
  9511. } }, { key: "addRTT", value: function(e3) {
  9512. this._avgRTT.addRTT(e3);
  9513. } }, { key: "addMessageDelay", value: function(e3) {
  9514. this._avgE2EDelay.addMessageDelay(e3);
  9515. } }, { key: "addTotalCount", value: function(e3) {
  9516. this._rateMessageSent.addTotalCount(e3) || xe.w("".concat(this._n, ".addTotalCount invalid key:"), e3);
  9517. } }, { key: "addSuccessCount", value: function(e3) {
  9518. this._rateMessageSent.addSuccessCount(e3) || xe.w("".concat(this._n, ".addSuccessCount invalid key:"), e3);
  9519. } }, { key: "addFailedCountOfUserSide", value: function(e3) {
  9520. this._rateMessageSent.addFailedCountOfUserSide(e3) || xe.w("".concat(this._n, ".addFailedCountOfUserSide invalid key:"), e3);
  9521. } }, { key: "addCost", value: function(e3, t2) {
  9522. this._rateMessageSent.addCost(e3, t2) || xe.w("".concat(this._n, ".addCost invalid key or cost:"), e3, t2);
  9523. } }, { key: "addFileSize", value: function(e3, t2) {
  9524. this._rateMessageSent.addFileSize(e3, t2) || xe.w("".concat(this._n, ".addFileSize invalid key or size:"), e3, t2);
  9525. } }, { key: "addMessageSequence", value: function(e3) {
  9526. this._rateMessageReceived.addMessageSequence(e3) || xe.w("".concat(this._n, ".addMessageSequence invalid key:"), e3.key);
  9527. } }, { key: "_getQualityItem", value: function(e3) {
  9528. var n3 = {}, o2 = Ea[this.getNetworkType()];
  9529. at(o2) && (o2 = 8);
  9530. var s3 = { qualityType: Ta[e3], timestamp: Ue(), networkType: o2, extension: "" };
  9531. switch (e3) {
  9532. case ga:
  9533. n3 = this._avgRTT.getStatResult();
  9534. break;
  9535. case _a:
  9536. n3 = this._avgE2EDelay.getStatResult();
  9537. break;
  9538. case ha:
  9539. case fa:
  9540. case va:
  9541. case ma:
  9542. case Ma:
  9543. n3 = this._rateMessageSent.getStatResult(e3);
  9544. break;
  9545. case ya:
  9546. case Ia:
  9547. case Ca:
  9548. n3 = this._rateMessageReceived.getStatResult(e3);
  9549. }
  9550. return null === n3 ? null : t(t({}, s3), n3);
  9551. } }, { key: "_report", value: function(e3) {
  9552. var t2 = this, n3 = [], o2 = null;
  9553. at(e3) ? this._qualityItems.forEach(function(e4) {
  9554. null !== (o2 = t2._getQualityItem(e4)) && (o2.reportIndex = t2.reportIndex, o2.wholePeriod = t2.wholePeriod, n3.push(o2));
  9555. }) : null !== (o2 = this._getQualityItem(e3)) && (o2.reportIndex = this.reportIndex, o2.wholePeriod = this.wholePeriod, n3.push(o2)), xe.d("".concat(this._n, "._report"), n3), this._statInfoArr.length > 0 && (n3 = n3.concat(this._statInfoArr), this._statInfoArr = []);
  9556. var s3 = this.getModule(qn), a2 = s3.getSDKAppID(), r2 = s3.getTinyID();
  9557. wt(this.REPORT_SDKAPPID_BLACKLIST, a2) && !Ft(this.REPORT_TINYID_WHITELIST, r2) && (n3 = []), n3.length > 0 && this._doReport(n3);
  9558. } }, { key: "_doReport", value: function(e3) {
  9559. var n3 = this, o2 = { header: ti(this), quality: e3 };
  9560. this.request({ protocolName: xs, requestData: t({}, o2) }).then(function() {
  9561. n3.reportIndex++, n3.wholePeriod = false;
  9562. }).catch(function(t2) {
  9563. xe.w("".concat(n3._n, "._doReport, online:").concat(n3.getNetworkType(), " error:"), t2), n3._statInfoArr = n3._statInfoArr.concat(e3), n3._flushAtOnce();
  9564. });
  9565. } }, { key: "_flushAtOnce", value: function() {
  9566. var e3 = this.getModule(xn), t2 = e3.getItem(this.TAG, false), n3 = this._statInfoArr, o2 = "".concat(this._n, "._flushAtOnce");
  9567. if (jt(t2))
  9568. xe.l("".concat(o2, " count:").concat(n3.length)), e3.setItem(this.TAG, n3, true, false);
  9569. else {
  9570. var s3 = n3.concat(t2);
  9571. s3.length > 10 && (s3 = s3.slice(0, 10)), xe.l("".concat(o2, " count:").concat(s3.length)), e3.setItem(this.TAG, s3, true, false);
  9572. }
  9573. this._statInfoArr = [];
  9574. } }, { key: "reset", value: function() {
  9575. xe.l("".concat(this._n, ".reset")), this._report(), this.reportIndex = 0, this.wholePeriod = false, this.REPORT_SDKAPPID_BLACKLIST = [], this.REPORT_TINYID_WHITELIST = [], this._avgRTT.reset(), this._avgE2EDelay.reset(), this._rateMessageSent.reset(), this._rateMessageReceived.reset();
  9576. } }]), s2;
  9577. }(ro), tu = function(e2) {
  9578. i(n2, e2);
  9579. var t2 = f(n2);
  9580. function n2(e3) {
  9581. var s2;
  9582. return o(this, n2), (s2 = t2.call(this, e3))._n = "WorkerTimerModule", s2._isWorkerEnabled = true, s2._workerTimer = null, s2._timerID = -1, s2._init(), s2.getInnerEmitterInstance().on($a, s2._onCloudConfigUpdated, _(s2)), s2;
  9583. }
  9584. return a(n2, [{ key: "isWorkerEnabled", value: function() {
  9585. return this._isWorkerEnabled && Se;
  9586. } }, { key: "startWorkerTimer", value: function() {
  9587. xe.l("".concat(this._n, ".startWorkerTimer")), this._workerTimer && this._workerTimer.postMessage("start");
  9588. } }, { key: "stopWorkerTimer", value: function() {
  9589. xe.l("".concat(this._n, ".stopWorkerTimer")), this._workerTimer && this._workerTimer.postMessage("stop");
  9590. } }, { key: "_init", value: function() {
  9591. if (Se) {
  9592. var e3 = URL.createObjectURL(new Blob(['let interval = -1;onmessage = function(event) { if (event.data === "start") { if (interval > 0) { clearInterval(interval); } interval = setInterval(() => { postMessage(""); }, 1000); postMessage(interval); } else if (event.data === "stop") { clearInterval(interval); interval = -1; }};'], { type: "application/javascript; charset=utf-8" }));
  9593. this._workerTimer = new Worker(e3);
  9594. var t3 = this;
  9595. this._workerTimer.onmessage = function(e4) {
  9596. e4.data ? (t3._timerID = e4.data, xe.l("".concat(t3._n, "._init seed:").concat(t3._timerID))) : t3._m.onCheckTimer();
  9597. };
  9598. }
  9599. } }, { key: "_onCloudConfigUpdated", value: function() {
  9600. var e3 = this.getCloudConfig("enable_worker");
  9601. xe.l("".concat(this._n, "._onCloudConfigUpdated enableWorker:").concat(e3)), at(e3) || "1" === e3 ? !this._isWorkerEnabled && Se && (this._isWorkerEnabled = true, this.startWorkerTimer(), this._m.onWorkerTimerEnabled()) : this._isWorkerEnabled && Se && (this._isWorkerEnabled = false, this.stopWorkerTimer(), this._m.onWorkerTimerDisabled());
  9602. } }, { key: "terminate", value: function() {
  9603. xe.l("".concat(this._n, ".terminate")), this._workerTimer && (this._workerTimer.terminate(), this._workerTimer = null, this._timerID = -1);
  9604. } }, { key: "getTimerID", value: function() {
  9605. return this._timerID;
  9606. } }, { key: "reset", value: function() {
  9607. xe.l("".concat(this._n, ".reset"));
  9608. } }]), n2;
  9609. }(ro), nu = function() {
  9610. function e2() {
  9611. o(this, e2), this._n = "PurchasedFeatureHandler", this._purchasedFeatureMap = /* @__PURE__ */ new Map();
  9612. }
  9613. return a(e2, [{ key: "isValidPurchaseBits", value: function(e3) {
  9614. return e3 && "string" == typeof e3 && e3.length >= 1 && e3.length <= 64 && /[01]{1,64}/.test(e3);
  9615. } }, { key: "parsePurchaseBits", value: function(e3) {
  9616. var t2 = "".concat(this._n, ".parsePurchaseBits");
  9617. if (this.isValidPurchaseBits(e3)) {
  9618. this._purchasedFeatureMap.clear();
  9619. for (var n2 = null, o2 = e3.length - 1, s2 = 0; o2 >= 0; o2--, s2++)
  9620. n2 = s2 < 32 ? new L(0, Math.pow(2, s2)).toString() : new L(Math.pow(2, s2 - 32), 0).toString(), "1" === e3[o2] ? this._purchasedFeatureMap.set(n2, true) : this._purchasedFeatureMap.set(n2, false);
  9621. } else
  9622. xe.w("".concat(t2, " invalid purchase bits:").concat(e3));
  9623. } }, { key: "hasPurchasedFeature", value: function(e3) {
  9624. return !!this._purchasedFeatureMap.get(e3);
  9625. } }, { key: "isFeatureEnabled", value: function(e3) {
  9626. for (var t2 = parseInt(e3).toString(2), n2 = void 0, o2 = true, s2 = t2.length - 1, a2 = 0; s2 >= 0; s2--, a2++)
  9627. if ("1" === t2.charAt(s2) && (n2 = a2 < 32 ? new L(0, Math.pow(2, a2)).toString() : new L(Math.pow(2, a2 - 32), 0).toString(), !this._purchasedFeatureMap.get(n2))) {
  9628. o2 = false;
  9629. break;
  9630. }
  9631. return xe.l("".concat(this._n, ".isFeatureEnabled decimalNumber:").concat(e3, " binaryString:").concat(t2, " ret:").concat(o2)), za({ enabled: o2 });
  9632. } }, { key: "clear", value: function() {
  9633. this._purchasedFeatureMap.clear();
  9634. } }]), e2;
  9635. }(), ou = function() {
  9636. function e2(t2) {
  9637. o(this, e2), this._m = t2, this._n = "CommercialConfigModule", this._expiredTime = 0, this._isFetching = false, this._purchasedFeatureHandler = new nu();
  9638. }
  9639. return a(e2, [{ key: "_canFetch", value: function() {
  9640. return this._getModule(qn).isLoggedIn() ? !this._isFetching && Date.now() >= this._expiredTime : (this._expiredTime = Date.now() + 2e3, false);
  9641. } }, { key: "onCheckTimer", value: function(e3) {
  9642. this._canFetch() && this.fetchConfig();
  9643. } }, { key: "fetchConfig", value: function() {
  9644. var e3 = this, t2 = this._canFetch(), n2 = "".concat(this._n, ".fetchConfig");
  9645. if (xe.l("".concat(n2, " canFetch:").concat(t2)), t2) {
  9646. var o2 = this._getModule(Bn), s2 = new ka("fetchCommercialConfig");
  9647. s2.setNetworkType(o2.getNetworkType());
  9648. var a2 = this._getModule(qn).getSDKAppID(), r2 = this._getModule(jn);
  9649. this._isFetching = true, r2.request({ protocolName: Xs, requestData: { SDKAppID: a2 } }).then(function(t3) {
  9650. s2.setMessage("purchaseBits:".concat(t3.data.purchaseBits)).end(), xe.l("".concat(n2, " ok.")), e3._parseConfig(t3.data), e3._isFetching = false;
  9651. }).catch(function(t3) {
  9652. o2.probe().then(function(e4) {
  9653. var n3 = v(e4, 2), o3 = n3[0], a3 = n3[1];
  9654. s2.setError(t3, o3, a3).end();
  9655. }), e3._isFetching = false;
  9656. });
  9657. }
  9658. } }, { key: "onPushedConfig", value: function(e3) {
  9659. var t2 = "".concat(this._n, ".onPushedConfig");
  9660. xe.l("".concat(t2)), new ka("pushedCommercialConfig").setNetworkType(this._getModule(Bn).getNetworkType()).setMessage("purchaseBits:".concat(e3.purchaseBits)).end(), this._parseConfig(e3);
  9661. } }, { key: "_parseConfig", value: function(e3) {
  9662. var t2 = "".concat(this._n, "._parseConfig"), n2 = e3.errorCode, o2 = e3.errorMessage, s2 = e3.purchaseBits, a2 = e3.expiredTime;
  9663. 0 === n2 ? (this._purchasedFeatureHandler.parsePurchaseBits(s2), this._expiredTime = Date.now() + 1e3 * a2) : at(n2) ? (xe.l("".concat(t2, " failed. Invalid message format:"), e3), this._setExpiredTimeOnResponseError(36e5)) : (xe.e("".concat(t2, " errorCode:").concat(n2, " errorMessage:").concat(o2)), this._setExpiredTimeOnResponseError(12e4));
  9664. } }, { key: "_setExpiredTimeOnResponseError", value: function(e3) {
  9665. this._expiredTime = Date.now() + e3;
  9666. } }, { key: "canIUse", value: function(e3) {
  9667. return this._purchasedFeatureHandler.hasPurchasedFeature(e3);
  9668. } }, { key: "isFeatureEnabled", value: function(e3) {
  9669. return this._purchasedFeatureHandler.isFeatureEnabled(e3);
  9670. } }, { key: "_getModule", value: function(e3) {
  9671. return this._m.getModule(e3);
  9672. } }, { key: "reset", value: function() {
  9673. xe.l("".concat(this._n, ".reset")), this._expiredTime = 0, this._isFetching = false, this._purchasedFeatureHandler.clear();
  9674. } }]), e2;
  9675. }(), su = function(e2) {
  9676. i(n2, e2);
  9677. var t2 = f(n2);
  9678. function n2(e3) {
  9679. var s2;
  9680. return o(this, n2), (s2 = t2.call(this, e3))._m = e3, s2._n = "OfflinePushModule", s2._offlinePushPlugin = void 0, s2._androidPushConfig = { huaweiPushBussinessId: "", xiaomiPushBussinessId: "", xiaomiPushAppId: "", xiaomiPushAppKey: "", meizuPushBussinessId: "", meizuPushAppId: "", meizuPushAppKey: "", vivoPushBussinessId: "", fcmPushBussinessId: "", oppoPushBussinessId: "", oppoPushAppKey: "", oppoPushAppSecret: "", honorPushBussinessId: "" }, s2._deviceToken = "", s2._businessID = 0, s2._iosBusinessID = 0, s2._c2cUnreadCount = 0, s2._groupUnreadCount = 0, s2._isWebUniapp = 0, s2;
  9681. }
  9682. return a(n2, [{ key: "registerPlugin", value: function(e3) {
  9683. if (ne) {
  9684. this._offlinePushPlugin = e3["tim-offline-push-plugin"];
  9685. var t3 = e3.offlinePushConfig || {}, n3 = t3.huaweiBusinessID, o2 = t3.xiaomiBusinessID, s2 = t3.xiaomiAppID, a2 = t3.xiaomiAppKey, r2 = t3.meizuBusinessID, i2 = t3.meizuAppID, u2 = t3.meizuAppKey, c2 = t3.vivoBusinessID, l2 = t3.oppoBusinessID, p2 = t3.oppoAppKey, d2 = t3.oppoAppSecret, g2 = t3.honorBusinessID, _2 = t3.iosBusinessID;
  9686. this._androidPushConfig.huaweiPushBussinessId = n3, this._androidPushConfig.xiaomiPushBussinessId = o2, this._androidPushConfig.xiaomiPushAppId = s2, this._androidPushConfig.xiaomiPushAppKey = a2, this._androidPushConfig.meizuPushBussinessId = r2, this._androidPushConfig.meizuPushAppId = i2, this._androidPushConfig.meizuPushAppKey = u2, this._androidPushConfig.vivoPushBussinessId = c2, this._androidPushConfig.oppoPushBussinessId = l2, this._androidPushConfig.oppoPushAppKey = p2, this._androidPushConfig.oppoPushAppSecret = d2, this._androidPushConfig.honorPushBussinessId = g2, new ka("registerPlugin").setMessage("tim-offline-push-plugin").setMoreMessage("isExist:".concat(!at(this._offlinePushPlugin))).end(true), xe.l("".concat(this._n, ".").concat("registerPlugin", " ok. offlinePushConfig:").concat(JSON.stringify(e3.offlinePushConfig))), this._iosBusinessID = _2, this._setAppShowListener();
  9687. } else
  9688. this.outputWarning("OfflinePushInUniapp");
  9689. } }, { key: "init", value: function() {
  9690. this._isWebUniapp = this.getUniAppPlatform(), this._getDeviceToken();
  9691. } }, { key: "_getDeviceToken", value: function() {
  9692. var e3 = this, t3 = "".concat(this._n, ".").concat("_getDeviceToken");
  9693. if (it(this._offlinePushPlugin.getDeviceToken)) {
  9694. var n3 = "androidPushConfig:".concat(JSON.stringify(this._androidPushConfig), ", iosBusinessID:").concat(this._iosBusinessID);
  9695. xe.l("".concat(t3, " start. ").concat(n3)), new ka("_getDeviceToken").setMessage("".concat(n3)).end(true), this._offlinePushPlugin.getDeviceToken(this._androidPushConfig, function(o2) {
  9696. var s2 = new ka("getDeviceTokenRes"), a2 = o2.code, r2 = o2.msg;
  9697. if (0 === a2) {
  9698. var i2 = o2.data, u2 = i2.deviceToken, c2 = i2.deviceBrand, l2 = i2.deviceType, p2 = i2.bussinessId;
  9699. e3._deviceToken = u2, e3._businessID = p2 || e3._iosBusinessID, n3 = "deviceToken:".concat(u2, ", deviceBrand:").concat(c2 || l2, ", businessID:").concat(e3._businessID), xe.l("".concat(t3, " ok. ").concat(n3)), s2.setMessage(n3).end(true), e3._setToken();
  9700. } else
  9701. s2.setMessage("code:".concat(a2, ", msg:").concat(r2)).end(true), xe.e("".concat(t3, " failed. error:"), o2);
  9702. });
  9703. } else
  9704. xe.e("".concat(t3, " getDeviceToken is not a function"));
  9705. } }, { key: "canIUseOfflinePush", value: function() {
  9706. return ne && !at(this._offlinePushPlugin);
  9707. } }, { key: "_setAppShowListener", value: function() {
  9708. var e3 = this, t3 = "".concat(this._n, ".").concat("_setAppShowListener");
  9709. at(this._offlinePushPlugin) ? xe.e("".concat(t3, " offlinePushPlugin is undefined")) : it(this._offlinePushPlugin.setAppShowListener) ? (new ka("_setAppShowListener").end(true), xe.l("".concat(t3, " start")), this._offlinePushPlugin.setAppShowListener(function(n3) {
  9710. var o2 = (n3 || {}).appShow;
  9711. new ka("setAppShowListenerRes").setMessage("appShow:".concat(o2)).end(true), xe.l("".concat(t3, " ok. appShow:").concat(o2)), e3._m.isReady() && (0 === o2 ? (e3._getConvUnreadCount(), e3._onBackground()) : 1 === o2 && e3._onForeground());
  9712. })) : xe.e("".concat(t3, " setAppShowListener is not a function"));
  9713. } }, { key: "getDeviceBrand", value: function() {
  9714. if (!at(this._offlinePushPlugin) && it(this._offlinePushPlugin.getDeviceType)) {
  9715. var e3 = (this._offlinePushPlugin.getDeviceType() || {}).deviceType;
  9716. return xe.l("".concat(this._n, ".getDeviceBrand ok. deviceType:").concat(e3)), e3;
  9717. }
  9718. } }, { key: "_setToken", value: function() {
  9719. var e3, t3 = this, n3 = "".concat(this._n, "._setToken"), o2 = this.getModule(qn), s2 = 1, a2 = "", r2 = "";
  9720. jt(this._deviceToken) && (s2 = 0);
  9721. var i2 = this.getUniAppPlatform(), u2 = this.getDeviceBrand();
  9722. i2 === R.IOS || i2 === R.IPAD || i2 === R.MAC ? r2 = this._deviceToken : i2 === R.ANDROID && (a2 = this._deviceToken);
  9723. var c2 = new ka("offlinePushSetToken");
  9724. return e3 = "deviceToken:".concat(r2 || a2, ", businessID:").concat(this._businessID, ", ") + "deviceBrand:".concat(u2, ", isWebUniapp:").concat(this._isWebUniapp, ", pushMsg:").concat(s2, ", platform:").concat(i2), c2.setMessage("".concat(e3)), xe.l("".concat(n3, " ").concat(e3)), this.request({ protocolName: ca, requestData: { tokenID: a2, pushMsg: s2, sdkAppID: o2.getSDKAppID(), businessID: parseInt(this._businessID), deviceBrand: u2, deviceToken: r2, isWebUniapp: this._isWebUniapp } }).then(function(e4) {
  9725. return c2.end(), xe.l("".concat(n3, " ok")), e4;
  9726. }).catch(function(e4) {
  9727. return t3.probeNetwork().then(function(t4) {
  9728. var n4 = v(t4, 2), o3 = n4[0], s3 = n4[1];
  9729. c2.setError(e4, o3, s3).end();
  9730. }), xe.e("".concat(n3, " failed. error:"), e4), Ja(e4);
  9731. });
  9732. } }, { key: "_getConvUnreadCount", value: function() {
  9733. var e3 = this;
  9734. this._c2cUnreadCount = 0, this._groupUnreadCount = 0, this.getModule(Fn).getLocalConversationList().forEach(function(t3) {
  9735. t3.type === S.CONV_C2C && (e3._c2cUnreadCount += t3.unreadCount), t3.type === S.CONV_GROUP && (e3._groupUnreadCount += t3.unreadCount);
  9736. });
  9737. } }, { key: "_onBackground", value: function() {
  9738. var e3 = this, t3 = "".concat(this._n, ".").concat("_onBackground"), n3 = new ka("_onBackground");
  9739. this.request({ protocolName: ia, requestData: { c2cUnreadCount: this._c2cUnreadCount, groupUnreadCount: this._groupUnreadCount, isWebUniapp: this._isWebUniapp } }).then(function(o2) {
  9740. return n3.setMessage("c2cUnreadCount: ".concat(e3._c2cUnreadCount, ", groupUnreadCount: ").concat(e3._groupUnreadCount)).end(), xe.l("".concat(t3, " ok")), o2;
  9741. }).catch(function(o2) {
  9742. e3.probeNetwork().then(function(e4) {
  9743. var t4 = v(e4, 2), s2 = t4[0], a2 = t4[1];
  9744. n3.setError(o2, s2, a2).end();
  9745. }), xe.e("".concat(t3, " failed. error:"), o2);
  9746. });
  9747. } }, { key: "_onForeground", value: function() {
  9748. var e3 = this, t3 = "".concat(this._n, ".").concat("_onForeground"), n3 = new ka("_onForeground");
  9749. this.request({ protocolName: ua, requestData: { isWebUniapp: this._isWebUniapp } }).then(function(e4) {
  9750. return n3.end(), xe.l("".concat(t3, " ok")), e4;
  9751. }).catch(function(o2) {
  9752. e3.probeNetwork().then(function(e4) {
  9753. var t4 = v(e4, 2), s2 = t4[0], a2 = t4[1];
  9754. n3.setError(o2, s2, a2).end();
  9755. }), xe.e("".concat(t3, " failed. error:"), o2);
  9756. });
  9757. } }, { key: "getUniAppPlatform", value: function() {
  9758. var e3 = uni.getSystemInfoSync().platform, t3 = this.getDeviceBrand();
  9759. return "ios" === e3 ? R.IOS : "android" === e3 ? R.ANDROID : 1002 === t3 ? R.IPAD : 1001 === t3 ? R.MAC : void 0;
  9760. } }, { key: "reset", value: function() {
  9761. this._deviceToken = "", this._businessID = 0, this._c2cUnreadCount = 0, this._groupUnreadCount = 0, this._isWebUniapp = 0, xe.l("".concat(this._n, ".reset"));
  9762. } }]), n2;
  9763. }(ro), au = function(e2) {
  9764. i(n2, e2);
  9765. var t2 = f(n2);
  9766. function n2(e3) {
  9767. var s2;
  9768. return o(this, n2), (s2 = t2.call(this, e3))._n = "ProfanityFilterModule", s2._plugin = null, s2._filterConfigMap = /* @__PURE__ */ new Map(), s2._startIndex = 0, s2._version = 0, s2._canIUseLexicon = false, s2._isFetching = false, s2._expiredTime = 0, s2;
  9769. }
  9770. return a(n2, [{ key: "init", value: function() {
  9771. var e3 = this.getModule(Wn).getPlugin("tim-profanity-filter-plugin");
  9772. e3 ? (this._plugin = new e3({ logger: xe, isArray: st, isMap: Qe, isDevMode: this.isDevMode() }), this._getLexicon()) : this.outputWarning("ProfanityPluginNotFound");
  9773. } }, { key: "onCheckTimer", value: function() {
  9774. this._plugin && this._canIUseLexicon && this.isLoggedIn() && !this._isFetching && Date.now() >= this._expiredTime && this._getLexicon();
  9775. } }, { key: "filterMessage", value: function(e3, t3) {
  9776. var n3 = true;
  9777. if (!this._plugin || !this._canIUseLexicon)
  9778. return n3;
  9779. if (t3 && t3.messageControlInfo && true === t3.messageControlInfo.excludedFromContentModeration)
  9780. return n3;
  9781. var o2 = e3.type, s2 = e3.conversationType;
  9782. if (o2 !== S.MSG_TEXT && o2 !== S.MSG_CUSTOM)
  9783. return n3;
  9784. var a2, r2 = "".concat(this._n, ".filterMessage");
  9785. if (xe.l("".concat(r2)), o2 === S.MSG_TEXT) {
  9786. if (s2 === S.CONV_C2C ? a2 = H : s2 === S.CONV_GROUP && (a2 = W), !this._isConfigOn(a2))
  9787. return n3;
  9788. var i2 = this._plugin.filter(e3.payload.text), u2 = i2.type, c2 = i2.modifiedText;
  9789. 1 === u2 ? n3 = false : 2 === u2 && (e3.payload.text = c2);
  9790. } else if (o2 === S.MSG_CUSTOM) {
  9791. if (s2 === S.CONV_C2C ? a2 = K : s2 === S.CONV_GROUP && (a2 = Y), !this._isConfigOn(a2))
  9792. return n3;
  9793. var l2 = this._plugin.filter(e3.payload.data), p2 = this._plugin.filter(e3.payload.description), d2 = this._plugin.filter(e3.payload.extension);
  9794. 1 === l2.type || 1 === p2.type || 1 === d2.type ? n3 = false : (2 === l2.type && (e3.payload.data = l2.modifiedText), 2 === p2.type && (e3.payload.description = p2.modifiedText), 2 === d2.type && (e3.payload.extension = d2.modifiedText));
  9795. }
  9796. return xe.l("".concat(r2, " done. isAllowedToSend:").concat(n3)), n3;
  9797. } }, { key: "filterText", value: function(e3, t3) {
  9798. var n3 = "".concat(this._n, ".filterText"), o2 = { isAllowedToSend: true, modifiedText: e3 };
  9799. if (!this._plugin || !this._canIUseLexicon)
  9800. return o2;
  9801. if (!this._isConfigOn(t3))
  9802. return o2;
  9803. xe.l("".concat(n3));
  9804. var s2 = this._plugin.filter(e3), a2 = s2.type, r2 = s2.modifiedText;
  9805. return 1 === a2 ? o2.isAllowedToSend = false : 2 === a2 && (o2.modifiedText = r2), xe.l("".concat(n3, " done. ret:"), o2), o2;
  9806. } }, { key: "_getLexicon", value: function() {
  9807. var e3 = this, t3 = new ka("profanityFilter"), n3 = "".concat(this._n, "._getLexicon");
  9808. this._isFetching = true, this.request({ protocolName: la, requestData: { startIndex: this._startIndex, version: this._version } }).then(function(o2) {
  9809. var s2 = o2.data, a2 = s2.errorInfo, r2 = s2.filterConfig, i2 = s2.lexicon, u2 = s2.strToken, c2 = s2.completeFlag, l2 = s2.nextStartIndex, p2 = s2.version, d2 = s2.expiredTime, g2 = a2.errorCode, _2 = a2.errorMessage;
  9810. return 0 !== g2 ? (e3._isFetching = false, xe.w("".concat(n3, " failed. error:"), a2), void t3.setCode(g2).setMessage(_2).end()) : (e3._onFilterConfig(r2), e3._getToken(u2), 1 === c2 ? (xe.l("".concat(n3, " done. version:").concat(p2, " expiredTime:").concat(d2)), e3._version = p2, e3._canIUseLexicon = true, e3._isFetching = false, e3._expiredTime = Date.now() + 1e3 * d2, void e3._plugin.onLexiconCompleted(i2)) : (e3._startIndex = l2, e3._plugin.onLexiconSliced(i2), void e3._getLexicon()));
  9811. }).catch(function(o2) {
  9812. e3.probeNetwork().then(function(e4) {
  9813. var n4 = v(e4, 2), s2 = n4[0], a2 = n4[1];
  9814. t3.setError(o2, s2, a2).end();
  9815. }), e3._isFetching = false, xe.l("".concat(n3, " failed. error:"), o2);
  9816. });
  9817. } }, { key: "_onFilterConfig", value: function(e3) {
  9818. var t3 = this;
  9819. jt(e3) || (this._filterConfigMap.clear(), Object.keys(e3).forEach(function(n3) {
  9820. t3._filterConfigMap.set(n3, e3[n3]);
  9821. }), xe.l("".concat(this._n, "._onFilterConfig. keys:").concat(Array.from(this._filterConfigMap.keys()), " values:").concat(Array.from(this._filterConfigMap.values()))));
  9822. } }, { key: "_isConfigOn", value: function(e3) {
  9823. return 1 === this._filterConfigMap.get(e3);
  9824. } }, { key: "_getToken", value: function(e3) {
  9825. if (et(e3)) {
  9826. var t3 = e3.length, n3 = "";
  9827. if (t3 % 2 == 0)
  9828. for (var o2 = 0; o2 <= t3 - 1; o2 += 2)
  9829. n3 += e3[o2 + 1], n3 += e3[o2];
  9830. else {
  9831. for (var s2 = 0; s2 < t3 - 1; s2 += 2)
  9832. n3 += e3[s2 + 1], n3 += e3[s2];
  9833. n3 += e3[t3 - 1];
  9834. }
  9835. this._plugin.onToken(n3);
  9836. }
  9837. } }, { key: "reset", value: function() {
  9838. xe.l("".concat(this._n, ".reset")), this._plugin && (this._plugin.reset(), this._plugin = null), this._filterConfigMap.clear(), this._startIndex = 0, this._version = 0, this._canIUseLexicon = false, this._isFetching = false, this._expiredTime = 0;
  9839. } }]), n2;
  9840. }(ro), ru = function() {
  9841. function e2(t2) {
  9842. o(this, e2), this._m = t2, this._n = "TransCmdModule", this._TRTCCommandList = ["tui_room_svr.*"], this._m.getInnerEmitterInstance().on($a, this._onCloudConfigUpdated, this);
  9843. }
  9844. return a(e2, [{ key: "_onCloudConfigUpdated", value: function() {
  9845. var e3 = this, t2 = this._m.getModule(Xn).getCloudConfig("rtc_cmd");
  9846. at(t2) || (t2 = JSON.parse(t2)).forEach(function(t3) {
  9847. e3._TRTCCommandList.includes(t3) || e3._TRTCCommandList.push(t3);
  9848. });
  9849. } }, { key: "sendTRTCCustomData", value: function(e3) {
  9850. var t2 = e3.serviceCommand, n2 = e3.data, o2 = "".concat(V.NAME.TUIROOM_SVR, ".*");
  9851. return at(t2) || (o2 = t2), this._TRTCCommandList.includes(o2) ? this._trans({ servcmd: o2, data: n2 }) : Ja({ code: da.INVALID_TRTC_CMD });
  9852. } }, { key: "_trans", value: function(e3) {
  9853. xe.d("".concat(this._n, "._trans. options:").concat(JSON.stringify(e3)));
  9854. var t2 = e3.servcmd, n2 = e3.data;
  9855. return this._m.getModule(jn).trans({ servcmd: t2, data: et(n2) ? JSON.parse(n2) : n2 });
  9856. } }, { key: "getCommandList", value: function() {
  9857. return this._TRTCCommandList;
  9858. } }, { key: "reset", value: function() {
  9859. xe.l("".concat(this._n, ".reset"));
  9860. } }]), e2;
  9861. }(), iu = function() {
  9862. function e2(t2) {
  9863. o(this, e2), this._m = t2, this._n = "ErrorMessageModule", this.TIM_ERROR_ASSISTANCE = "tim_error_assistance", this.STORAGE_EXPIRES_TIME = 6048e5, this._map = /* @__PURE__ */ new Map(), this._init();
  9864. }
  9865. return a(e2, [{ key: "_init", value: function() {
  9866. var e3 = this._getStorageModule().getItem(this.TIM_ERROR_ASSISTANCE, false);
  9867. if (e3) {
  9868. var t2 = JSON.parse(e3);
  9869. this._needToUpdate(t2) ? this._fetch() : this._fillMap(t2.message);
  9870. } else
  9871. this._fetch();
  9872. } }, { key: "_needToUpdate", value: function(e3) {
  9873. var t2 = e3.localSavedTime, n2 = e3.localSavedVersion, o2 = t2 && (/* @__PURE__ */ new Date()).getTime() - t2 >= this.STORAGE_EXPIRES_TIME, s2 = !n2 || "2.27.3" !== n2;
  9874. return xe.l("".concat(this._n, "._needToUpdate isTimeout:").concat(o2, " isDifferentVersion:").concat(s2)), o2 || s2;
  9875. } }, { key: "_fetch", value: function() {
  9876. if (!this._m.getModule(qn).isPrivateNetWork()) {
  9877. var e3 = "https://web.sdk.qcloud.com/im/download/error-message/0.0.1/tim-error-message.txt", t2 = "application/x-www-form-urlencoded;charset=UTF-8", n2 = "".concat(this._n, "._fetch ok in"), o2 = this;
  9878. if (se)
  9879. re.request({ url: e3, method: "GET", timeout: 3e3, header: { "content-type": t2 }, dataType: "text", success: function(e4) {
  9880. o2._fillAndSave(e4.data), xe.l("".concat(n2, " mini program"));
  9881. }, fail: function() {
  9882. } });
  9883. else {
  9884. var s2 = new XMLHttpRequest(), a2 = setTimeout(function() {
  9885. s2.abort();
  9886. }, 3e3);
  9887. s2.onreadystatechange = function() {
  9888. 4 === s2.readyState && (clearTimeout(a2), 200 !== s2.status && 304 !== s2.status || (xe.l("".concat(n2, " browser")), o2._fillAndSave(s2.responseText)));
  9889. }, s2.open("GET", e3, true), s2.setRequestHeader("Content-type", t2), s2.send();
  9890. }
  9891. }
  9892. } }, { key: "_fillAndSave", value: function(e3) {
  9893. this._fillMap(e3), this._getStorageModule().setItem(this.TIM_ERROR_ASSISTANCE, JSON.stringify({ message: e3, localSavedTime: (/* @__PURE__ */ new Date()).getTime(), localSavedVersion: "2.27.3" }), true, false);
  9894. } }, { key: "_getStorageModule", value: function() {
  9895. return this._m.getModule(xn);
  9896. } }, { key: "_fillMap", value: function(e3) {
  9897. this._map.clear();
  9898. for (var t2, n2, o2, s2 = e3.split(";\n"), a2 = s2.length, r2 = new RegExp(/'/g), i2 = 0; i2 < a2; i2++)
  9899. if (t2 = s2[i2].indexOf(":"), n2 = s2[i2].slice(0, t2), o2 = s2[i2].slice(t2 + 1, s2[i2].length), !n2.startsWith("//")) {
  9900. if (at(o2))
  9901. continue;
  9902. this._map.set(n2, o2.replace(r2, ""));
  9903. }
  9904. } }, { key: "get", value: function(e3) {
  9905. var t2 = e3.isIntl, n2 = e3.key, o2 = e3.replacement1, s2 = e3.replacement2, a2 = "".concat(n2, t2 ? "_en" : "_cn");
  9906. !this._map.has(a2) && this._map.has(n2) && (a2 = n2);
  9907. var r2 = "";
  9908. return this._map.has(a2) ? (r2 = this._map.get(a2), at(o2) || (r2 = r2.replace("$replacement1", o2)), at(s2) || (r2 = r2.replace("$replacement2", s2)), r2) : r2;
  9909. } }, { key: "reset", value: function() {
  9910. xe.l("".concat(this._n, ".reset"));
  9911. } }]), e2;
  9912. }(), uu = function() {
  9913. function e2(t2) {
  9914. o(this, e2);
  9915. var n2 = new ka("sdkConstruct");
  9916. this._n = "ModuleManager", this._isReady = false, this._reason = da.USER_NOT_LOGGED_IN, this._startLoginTs = 0, this._moduleMap = /* @__PURE__ */ new Map(), this._innerEmitter = null, this._outerEmitter = null, this._checkCount = 0, this._checkTimer = -1, this._moduleMap.set(qn, new Xr(this, t2)), this._moduleMap.set(eo, new ou(this)), this._moduleMap.set(Xn, new zi(this)), this._moduleMap.set(Qn, new tu(this)), this._moduleMap.set($n, new eu(this)), this._moduleMap.set(zn, new qi(this)), this._moduleMap.set(jn, new Yi(this)), this._moduleMap.set(An, new Qr(this)), this._moduleMap.set(Rn, new fi(this)), this._moduleMap.set(Nn, new vi(this)), this._moduleMap.set(so, new mi(this)), this._moduleMap.set(On, new Jr(this)), this._moduleMap.set(Gn, new Xa(this)), this._moduleMap.set(Fn, new vr(this)), this._moduleMap.set(Un, new wr(this)), this._moduleMap.set(bn, new qr(this)), this._moduleMap.set(wn, new Hr(this)), this._moduleMap.set(xn, new $r(this)), this._moduleMap.set(ao, new iu(this)), this._moduleMap.set(Vn, new ni(this)), this._moduleMap.set(Bn, new ri(this)), this._moduleMap.set(Hn, new ui(this)), this._moduleMap.set(Kn, new li(this)), this._moduleMap.set(Wn, new Mi(this)), this._moduleMap.set(Yn, new yi(this)), this._moduleMap.set(Jn, new ji(this)), this._moduleMap.set(Zn, new Ji(this)), this._moduleMap.set(to, new su(this)), this._moduleMap.set(no, new au(this)), this._moduleMap.set(oo, new ru(this)), this._eventThrottleMap = /* @__PURE__ */ new Map();
  9917. var s2 = t2.instanceID, a2 = t2.oversea, r2 = t2.SDKAppID, i2 = "instanceID:".concat(s2, " SDKAppID:").concat(r2, " host:").concat(Nt(), " oversea:").concat(a2, " inBrowser:").concat(ae, " inMiniApp:").concat(se) + " workerAvailable:".concat(Se, " UserAgent:").concat(ie);
  9918. ka.bindEventStatModule(this._moduleMap.get(Vn)), n2.setMessage("".concat(i2, " ").concat(function() {
  9919. var e3 = "";
  9920. if (se)
  9921. try {
  9922. var t3 = re.getSystemInfoSync(), n3 = t3.model, o2 = t3.version, s3 = t3.system, a3 = t3.platform, r3 = t3.SDKVersion;
  9923. e3 = "model:".concat(n3, " version:").concat(o2, " system:").concat(s3, " platform:").concat(a3, " SDKVersion:").concat(r3);
  9924. } catch (i3) {
  9925. e3 = "";
  9926. }
  9927. return e3;
  9928. }())).end(), xe.i("SDK ".concat(i2)), Wa.prototype._getErrorMessage = this.getErrorMessage.bind(this), this._readyList = void 0, this._ssoLogForReady = null, this._initReadyList();
  9929. }
  9930. return a(e2, [{ key: "_startTimer", value: function() {
  9931. var e3 = this._moduleMap.get(Qn), t2 = e3.isWorkerEnabled();
  9932. xe.l("".concat(this._n, ".startTimer isWorkerEnabled:").concat(t2, " seed:").concat(this._checkTimer)), t2 ? e3.startWorkerTimer() : this._startMainThreadTimer();
  9933. } }, { key: "_startMainThreadTimer", value: function() {
  9934. this._checkTimer < 0 && (this._checkTimer = setInterval(this.onCheckTimer.bind(this), 1e3)), xe.l("".concat(this._n, "._startMainThreadTimer seed:").concat(this._checkTimer));
  9935. } }, { key: "stopTimer", value: function() {
  9936. var e3 = this._moduleMap.get(Qn), t2 = e3.isWorkerEnabled();
  9937. xe.l("".concat(this._n, ".stopTimer isWorkerEnabled:").concat(t2, " seed:").concat(this._checkTimer)), t2 ? e3.stopWorkerTimer() : this._stopMainThreadTimer();
  9938. } }, { key: "_stopMainThreadTimer", value: function() {
  9939. xe.l("".concat(this._n, "._stopMainThreadTimer")), this._checkTimer > 0 && (clearInterval(this._checkTimer), this._checkTimer = -1, this._checkCount = 0);
  9940. } }, { key: "_stopMainThreadSocket", value: function() {
  9941. xe.l("".concat(this._n, "._stopMainThreadSocket"));
  9942. var e3 = this._moduleMap.get(zn);
  9943. e3.setIsWorkerEnabled(true), e3.reConnect();
  9944. } }, { key: "_startMainThreadSocket", value: function() {
  9945. xe.l("".concat(this._n, "._startMainThreadSocket"));
  9946. var e3 = this._moduleMap.get(zn);
  9947. e3.setIsWorkerEnabled(false), e3.reConnect();
  9948. } }, { key: "onWorkerTimerEnabled", value: function() {
  9949. xe.l("".concat(this._n, ".onWorkerTimerEnabled, disable main thread timer and socket")), this._stopMainThreadTimer(), this._stopMainThreadSocket();
  9950. } }, { key: "onWorkerTimerDisabled", value: function() {
  9951. xe.l("".concat(this._n, ".onWorkerTimerDisabled, enable main thread timer and socket")), this._startMainThreadTimer(), this._startMainThreadSocket();
  9952. } }, { key: "onCheckTimer", value: function() {
  9953. this._checkCount += 1;
  9954. var e3, t2 = D(this._moduleMap);
  9955. try {
  9956. for (t2.s(); !(e3 = t2.n()).done; ) {
  9957. var n2 = v(e3.value, 2)[1];
  9958. n2.onCheckTimer && n2.onCheckTimer(this._checkCount);
  9959. }
  9960. } catch (o2) {
  9961. t2.e(o2);
  9962. } finally {
  9963. t2.f();
  9964. }
  9965. } }, { key: "_initReadyList", value: function() {
  9966. var e3 = this;
  9967. this._readyList = [this._moduleMap.get(An), this._moduleMap.get(Fn)], this._readyList.forEach(function(t2) {
  9968. t2.ready(function() {
  9969. return e3._onModuleReady();
  9970. });
  9971. });
  9972. } }, { key: "_onModuleReady", value: function() {
  9973. var e3 = true;
  9974. if (this._readyList.forEach(function(t3) {
  9975. t3.isReady() || (e3 = false);
  9976. }), e3 && !this._isReady) {
  9977. this._isReady = true, this._outerEmitter.emit(E.SDK_READY);
  9978. var t2 = Date.now() - this._startLoginTs;
  9979. xe.w("SDK is ready. cost ".concat(t2, " ms")), this._startLoginTs = Date.now();
  9980. var n2 = this._moduleMap.get(Bn).getNetworkType(), o2 = this._ssoLogForReady.getStartTs() + Ge;
  9981. this._ssoLogForReady.setNetworkType(n2).setMessage(t2).start(o2).end();
  9982. }
  9983. } }, { key: "login", value: function() {
  9984. 0 === this._startLoginTs && (Pe(), this._startLoginTs = Date.now(), this._startTimer(), this._moduleMap.get(Bn).start(), this._ssoLogForReady = new ka("sdkReady"), this._reason = da.LOGGING_IN);
  9985. } }, { key: "onLoginFailed", value: function() {
  9986. this._startLoginTs = 0;
  9987. } }, { key: "getOuterEmitterInstance", value: function() {
  9988. return null === this._outerEmitter && (this._outerEmitter = new ii(), ja(this._outerEmitter), this._outerEmitter._emit = this._outerEmitter.emit, this._outerEmitter.emit = (function(e3, t2) {
  9989. var n2 = this;
  9990. if (e3 === E.CONVERSATION_LIST_UPDATED || e3 === E.FRIEND_LIST_UPDATED || e3 === E.GROUP_LIST_UPDATED || e3 === E.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED)
  9991. if (this._eventThrottleMap.has(e3)) {
  9992. var o2 = Date.now(), s2 = this._eventThrottleMap.get(e3);
  9993. o2 - s2.last <= 1e3 ? (s2.timeoutID && clearTimeout(s2.timeoutID), s2.timeoutID = setTimeout(function() {
  9994. s2.last = Date.now(), n2._outerEmitter._emit.apply(n2._outerEmitter, [e3, { name: e3, data: n2._getEventData(e3) }]);
  9995. }, 1e3)) : (s2.last = o2, this._outerEmitter._emit.apply(this._outerEmitter, [e3, { name: e3, data: this._getEventData(e3) }]));
  9996. } else
  9997. this._eventThrottleMap.set(e3, { last: Date.now(), timeoutID: -1 }), this._outerEmitter._emit.apply(this._outerEmitter, [e3, { name: e3, data: this._getEventData(e3) }]);
  9998. else
  9999. this._outerEmitter._emit.apply(this._outerEmitter, [e3, { name: e3, data: arguments[1] }]);
  10000. }).bind(this)), this._outerEmitter;
  10001. } }, { key: "_getEventData", value: function(e3) {
  10002. return e3 === E.CONVERSATION_LIST_UPDATED ? this._moduleMap.get(Fn).getLocalConversationList() : e3 === E.FRIEND_LIST_UPDATED ? this._moduleMap.get(Pn).getLocalFriendList(false) : e3 === E.GROUP_LIST_UPDATED ? this._moduleMap.get(Un).getLocalGroupList() : e3 === E.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED ? this._moduleMap.get(Fn).getTotalUnreadMessageCount() : void 0;
  10003. } }, { key: "getInnerEmitterInstance", value: function() {
  10004. return null === this._innerEmitter && (this._innerEmitter = new ii(), this._innerEmitter._emit = this._innerEmitter.emit, this._innerEmitter.emit = (function(e3, t2) {
  10005. var n2;
  10006. n2 = ot(arguments[1]) && arguments[1].data ? [e3, { name: arguments[0], data: arguments[1].data }] : [e3, { name: arguments[0], data: arguments[1] }], this._innerEmitter._emit.apply(this._innerEmitter, n2);
  10007. }).bind(this)), this._innerEmitter;
  10008. } }, { key: "hasModule", value: function(e3) {
  10009. return this._moduleMap.has(e3);
  10010. } }, { key: "getModule", value: function(e3) {
  10011. return this._moduleMap.get(e3);
  10012. } }, { key: "isReady", value: function() {
  10013. return this._isReady;
  10014. } }, { key: "isIntl", value: function() {
  10015. return this.getModule(qn).isIntl();
  10016. } }, { key: "getNotReadyReason", value: function() {
  10017. return this._reason;
  10018. } }, { key: "setNotReadyReason", value: function(e3) {
  10019. this._reason = e3;
  10020. } }, { key: "getErrorMessage", value: function(e3, t2, n2) {
  10021. return this._moduleMap.get(ao).get({ key: e3, replacement1: t2, replacement2: n2, isIntl: this.isIntl() });
  10022. } }, { key: "outputWarning", value: function(e3, t2, n2) {
  10023. var o2 = this.getErrorMessage(e3, t2, n2);
  10024. o2 && xe.w(o2);
  10025. } }, { key: "onError", value: function(e3) {
  10026. var t2 = "code:".concat(e3.code, " message:").concat(e3.message);
  10027. xe.w("Oops! ".concat(t2)), new ka("error").setMessage(t2).setNetworkType(this.getModule(Bn).getNetworkType()).setLevel("error").end(), this.getOuterEmitterInstance().emit(E.ERROR, e3);
  10028. } }, { key: "restartTimer", value: function() {
  10029. xe.l("".concat(this._n, ".restartTimer")), this.stopTimer(), this._startTimer(), this.getModule(Un).restartPolling();
  10030. } }, { key: "getTimerID", value: function() {
  10031. var e3 = this._moduleMap.get(Qn);
  10032. return e3.isWorkerEnabled() ? e3.getTimerID() : this._checkTimer;
  10033. } }, { key: "getPollingTimerID", value: function(e3) {
  10034. return this._moduleMap.get(Un).getPollingTimerID(e3);
  10035. } }, { key: "reset", value: function() {
  10036. xe.l("".concat(this._n, ".reset")), Pe();
  10037. var e3, t2 = D(this._moduleMap);
  10038. try {
  10039. for (t2.s(); !(e3 = t2.n()).done; ) {
  10040. var n2 = v(e3.value, 2)[1];
  10041. n2.reset && n2.reset();
  10042. }
  10043. } catch (r2) {
  10044. t2.e(r2);
  10045. } finally {
  10046. t2.f();
  10047. }
  10048. this._startLoginTs = 0, this._initReadyList(), this._isReady = false, this.stopTimer(), this._outerEmitter.emit(E.SDK_NOT_READY);
  10049. var o2, s2 = D(this._eventThrottleMap);
  10050. try {
  10051. for (s2.s(); !(o2 = s2.n()).done; ) {
  10052. var a2 = v(o2.value, 2)[1];
  10053. a2.timeoutID && clearTimeout(a2.timeoutID);
  10054. }
  10055. } catch (r2) {
  10056. s2.e(r2);
  10057. } finally {
  10058. s2.f();
  10059. }
  10060. this._eventThrottleMap.clear();
  10061. } }]), e2;
  10062. }(), cu = function() {
  10063. function e2(t2) {
  10064. o(this, e2), this._funcMap = /* @__PURE__ */ new Map(), this._m = t2;
  10065. }
  10066. return a(e2, [{ key: "defense", value: function(e3, t2) {
  10067. var n2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0;
  10068. if ("string" != typeof e3)
  10069. return null;
  10070. if (0 === e3.length)
  10071. return null;
  10072. if ("function" != typeof t2)
  10073. return null;
  10074. if (this._funcMap.has(e3) && this._funcMap.get(e3).has(t2))
  10075. return this._funcMap.get(e3).get(t2);
  10076. this._funcMap.has(e3) || this._funcMap.set(e3, /* @__PURE__ */ new Map());
  10077. var o2 = null;
  10078. return this._funcMap.get(e3).has(t2) ? o2 = this._funcMap.get(e3).get(t2) : (o2 = this._pack(e3, t2, n2), this._funcMap.get(e3).set(t2, o2)), o2;
  10079. } }, { key: "defenseOnce", value: function(e3, t2) {
  10080. var n2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0;
  10081. return "function" != typeof t2 ? null : this._pack(e3, t2, n2);
  10082. } }, { key: "find", value: function(e3, t2) {
  10083. return "string" != typeof e3 || 0 === e3.length || "function" != typeof t2 ? null : this._funcMap.has(e3) && this._funcMap.get(e3).has(t2) ? this._funcMap.get(e3).get(t2) : (this._m.outputWarning("ListenerFnNotFound", e3), null);
  10084. } }, { key: "delete", value: function(e3, t2) {
  10085. return "function" == typeof t2 && (!!this._funcMap.has(e3) && (!!this._funcMap.get(e3).has(t2) && (this._funcMap.get(e3).delete(t2), 0 === this._funcMap.get(e3).size && this._funcMap.delete(e3), true)));
  10086. } }, { key: "_pack", value: function(e3, t2, n2) {
  10087. var o2 = this;
  10088. return function() {
  10089. try {
  10090. t2.apply(n2, Array.from(arguments));
  10091. } catch (u2) {
  10092. var s2 = Object.values(E).indexOf(e3), a2 = "CallbackError";
  10093. if (-1 !== s2) {
  10094. var r2 = Object.keys(E)[s2];
  10095. o2._m.outputWarning(a2, r2, u2);
  10096. }
  10097. var i2 = new ka(a2);
  10098. i2.setMessage("eventName:".concat(e3)).setMoreMessage(u2.message).end();
  10099. }
  10100. };
  10101. } }]), e2;
  10102. }(), lu = function() {
  10103. function e2(t2) {
  10104. o(this, e2);
  10105. var n2 = { SDKAppID: t2.SDKAppID, unlimitedAVChatRoom: t2.unlimitedAVChatRoom || false, scene: t2.scene || "", oversea: t2.oversea || false, instanceID: Rt(), devMode: t2.devMode || false, proxyServer: t2.proxyServer || void 0, fileUploadProxy: t2.fileUploadProxy || void 0, fileDownloadProxy: t2.fileDownloadProxy || t2.fileUploadProxy || void 0 };
  10106. this._m = new uu(n2), this._safetyCallbackFactory = new cu(this._m);
  10107. }
  10108. return a(e2, [{ key: "onError", value: function(e3) {
  10109. this._m.onError(e3);
  10110. } }, { key: "login", value: function(e3) {
  10111. return this._m.login(), this._getModule(An).login(e3);
  10112. } }, { key: "logout", value: function() {
  10113. var e3 = this;
  10114. return this._getModule(An).logout().then(function(t2) {
  10115. return e3._m.reset(), t2;
  10116. });
  10117. } }, { key: "isReady", value: function() {
  10118. return this._m.isReady();
  10119. } }, { key: "isIntl", value: function() {
  10120. return this._m.isIntl();
  10121. } }, { key: "getNotReadyReason", value: function() {
  10122. return this._m.getNotReadyReason();
  10123. } }, { key: "getErrorMessage", value: function(e3, t2, n2) {
  10124. return this._m.getErrorMessage(e3, t2, n2);
  10125. } }, { key: "_getModule", value: function(e3) {
  10126. return this._m.getModule(e3);
  10127. } }, { key: "destroy", value: function() {
  10128. var e3 = this;
  10129. return this.logout().finally(function() {
  10130. e3._m.stopTimer(), e3._getModule(Qn).terminate(), e3._getModule(zn).dealloc();
  10131. var t2 = e3._m.getOuterEmitterInstance(), n2 = e3._getModule(qn);
  10132. t2.emit(E.SDK_DESTROY, { SDKAppID: n2.getSDKAppID() });
  10133. });
  10134. } }, { key: "on", value: function(e3, t2, n2) {
  10135. xe.d("on", "eventName:".concat(e3)), this._m.getOuterEmitterInstance().on(e3, this._safetyCallbackFactory.defense(e3, t2, n2), n2);
  10136. } }, { key: "once", value: function(e3, t2, n2) {
  10137. xe.d("once", "eventName:".concat(e3)), this._m.getOuterEmitterInstance().once(e3, this._safetyCallbackFactory.defenseOnce(e3, t2, n2), n2 || this);
  10138. } }, { key: "off", value: function(e3, t2, n2, o2) {
  10139. xe.d("off", "eventName:".concat(e3));
  10140. var s2 = this._safetyCallbackFactory.find(e3, t2);
  10141. null !== s2 && (this._m.getOuterEmitterInstance().off(e3, s2, n2, o2), this._safetyCallbackFactory.delete(e3, t2));
  10142. } }, { key: "registerPlugin", value: function(e3) {
  10143. at(e3["tim-offline-push-plugin"]) ? this._getModule(Wn).registerPlugin(e3) : this._getModule(to).registerPlugin(e3);
  10144. } }, { key: "setLogLevel", value: function(e3) {
  10145. if (e3 <= 0) {
  10146. var t2 = this.getErrorMessage("TIM_ASCII_ART");
  10147. t2 && console.log(t2);
  10148. var n2 = this.getErrorMessage("API_REFER");
  10149. if (n2) {
  10150. Ht() ? console.log("%c ".concat("IM SDK API ->", " %c"), "background:#ff9d00; padding:1px; border-radius:3px; color: #fff", "background:transparent", n2) : console.log("IM SDK API ->", n2);
  10151. }
  10152. var o2 = this.getErrorMessage("DOCS_GUIDE");
  10153. o2 && console.log(o2);
  10154. }
  10155. xe.setLevel(e3);
  10156. } }, { key: "createTextMessage", value: function(e3) {
  10157. return this._getModule(Rn).createTextMessage(e3);
  10158. } }, { key: "createTextAtMessage", value: function(e3) {
  10159. return this._getModule(Rn).createTextMessage(e3);
  10160. } }, { key: "createImageMessage", value: function(e3) {
  10161. return this._getModule(Rn).createImageMessage(e3);
  10162. } }, { key: "createAudioMessage", value: function(e3) {
  10163. return this._getModule(Rn).createAudioMessage(e3);
  10164. } }, { key: "createVideoMessage", value: function(e3) {
  10165. return this._getModule(Rn).createVideoMessage(e3);
  10166. } }, { key: "createCustomMessage", value: function(e3) {
  10167. return this._getModule(Rn).createCustomMessage(e3);
  10168. } }, { key: "createFaceMessage", value: function(e3) {
  10169. return this._getModule(Rn).createFaceMessage(e3);
  10170. } }, { key: "createFileMessage", value: function(e3) {
  10171. return this._getModule(Rn).createFileMessage(e3);
  10172. } }, { key: "createLocationMessage", value: function(e3) {
  10173. return this._getModule(Rn).createLocationMessage(e3);
  10174. } }, { key: "createMergerMessage", value: function(e3) {
  10175. return this._getModule(Rn).createMergerMessage(e3);
  10176. } }, { key: "downloadMergerMessage", value: function(e3) {
  10177. return e3.type !== S.MSG_MERGER ? Ja({ code: da.MESSAGE_MERGER_TYPE_INVALID }) : jt(e3.payload.downloadKey) ? Ja({ code: da.MESSAGE_MERGER_KEY_INVALID }) : this._getModule(Rn).downloadMergerMessage(e3).catch(function(e4) {
  10178. return Ja({ code: da.MESSAGE_MERGER_DOWNLOAD_FAIL });
  10179. });
  10180. } }, { key: "createForwardMessage", value: function(e3) {
  10181. return this._getModule(Rn).createForwardMessage(e3);
  10182. } }, { key: "sendMessage", value: function(e3, t2) {
  10183. return e3 instanceof Ha ? this._getModule(Rn).sendMessageInstance(e3, t2) : Ja({ code: da.MESSAGE_SEND_NEED_MESSAGE_INSTANCE });
  10184. } }, { key: "callExperimentalAPI", value: function(e3, t2) {
  10185. return "sendComboMessage" === e3 ? this._getModule(so).sendMessage(t2) : "handleGroupInvitation" === e3 ? this._getModule(Un).handleGroupInvitation(t2) : "isCommercialAbilityEnabled" === e3 ? this._getModule(eo).isFeatureEnabled(t2) : "isIntl" === e3 ? this.isIntl() : "sendTRTCCustomData" === e3 ? this._getModule(oo).sendTRTCCustomData(t2) : "getTimerID" === e3 ? this._m.getTimerID() : "getPollingTimerID" === e3 ? this._m.getPollingTimerID(t2) : Ja({ code: da.INVALID_OPERATION });
  10186. } }, { key: "revokeMessage", value: function(e3) {
  10187. return this._getModule(Rn).revokeMessage(e3);
  10188. } }, { key: "resendMessage", value: function(e3) {
  10189. return this._getModule(Rn).resendMessage(e3);
  10190. } }, { key: "deleteMessage", value: function(e3) {
  10191. return this._getModule(Rn).deleteMessage(e3);
  10192. } }, { key: "translateText", value: function(e3) {
  10193. return this._getModule(Rn).translateText(e3);
  10194. } }, { key: "setMessageExtensions", value: function(e3, t2) {
  10195. return this._getModule(Nn).setMessageExtensions(e3, t2);
  10196. } }, { key: "getMessageExtensions", value: function(e3) {
  10197. return this._getModule(Nn).getMessageExtensions(e3);
  10198. } }, { key: "deleteMessageExtensions", value: function(e3, t2) {
  10199. return this._getModule(Nn).deleteMessageExtensions(e3, t2);
  10200. } }, { key: "modifyMessage", value: function(e3) {
  10201. return this._getModule(Rn).modifyRemoteMessage(e3);
  10202. } }, { key: "getMessageList", value: function(e3) {
  10203. return this._getModule(Fn).getMessageList(e3);
  10204. } }, { key: "getMessageListHopping", value: function(e3) {
  10205. return this._getModule(Fn).getMessageListHopping(e3);
  10206. } }, { key: "sendMessageReadReceipt", value: function(e3) {
  10207. return this._getModule(Fn).sendReadReceipt(e3);
  10208. } }, { key: "getMessageReadReceiptList", value: function(e3) {
  10209. return this._getModule(Fn).getReadReceiptList(e3);
  10210. } }, { key: "getGroupMessageReadMemberList", value: function(e3) {
  10211. return this._getModule(Un).getReadReceiptDetail(e3);
  10212. } }, { key: "findMessage", value: function(e3) {
  10213. return this._getModule(Fn).findMessage(e3);
  10214. } }, { key: "setMessageRead", value: function(e3) {
  10215. return this._getModule(Fn).setMessageRead(e3);
  10216. } }, { key: "getConversationList", value: function(e3) {
  10217. return this._getModule(Fn).getConversationList(e3);
  10218. } }, { key: "getConversationProfile", value: function(e3) {
  10219. return this._getModule(Fn).getConversationProfile(e3);
  10220. } }, { key: "deleteConversation", value: function(e3) {
  10221. return this._getModule(Fn).deleteConversation(e3);
  10222. } }, { key: "clearHistoryMessage", value: function(e3) {
  10223. return this._getModule(Fn).clearHistoryMessage(e3);
  10224. } }, { key: "pinConversation", value: function(e3) {
  10225. return this._getModule(Fn).pinConversation(e3);
  10226. } }, { key: "setAllMessageRead", value: function(e3) {
  10227. return this._getModule(Fn).setAllMessageRead(e3);
  10228. } }, { key: "setMessageRemindType", value: function(e3) {
  10229. return this._getModule(Fn).setMessageRemindType(e3);
  10230. } }, { key: "getTotalUnreadMessageCount", value: function() {
  10231. return this._getModule(Fn).getTotalUnreadMessageCount();
  10232. } }, { key: "setConversationCustomData", value: function(e3) {
  10233. return this._getModule(Fn).setConversationCustomData(e3);
  10234. } }, { key: "markConversation", value: function(e3) {
  10235. return this._getModule(Fn).markConversation(e3);
  10236. } }, { key: "getConversationGroupList", value: function() {
  10237. return this._getModule(Fn).getConversationGroupList();
  10238. } }, { key: "createConversationGroup", value: function(e3) {
  10239. return this._getModule(Fn).createConversationGroup(e3);
  10240. } }, { key: "deleteConversationGroup", value: function(e3) {
  10241. return this._getModule(Fn).deleteConversationGroup(e3);
  10242. } }, { key: "renameConversationGroup", value: function(e3) {
  10243. return this._getModule(Fn).renameConversationGroup(e3);
  10244. } }, { key: "addConversationsToGroup", value: function(e3) {
  10245. return this._getModule(Fn).addConversationsToGroup(e3);
  10246. } }, { key: "deleteConversationsFromGroup", value: function(e3) {
  10247. return this._getModule(Fn).deleteConversationsFromGroup(e3);
  10248. } }, { key: "getMyProfile", value: function() {
  10249. return this._getModule(On).getMyProfile();
  10250. } }, { key: "getUserProfile", value: function(e3) {
  10251. return this._getModule(On).getUserProfile(e3);
  10252. } }, { key: "updateMyProfile", value: function(e3) {
  10253. return this._getModule(On).updateMyProfile(e3);
  10254. } }, { key: "getBlacklist", value: function() {
  10255. return this._getModule(On).getLocalBlacklist();
  10256. } }, { key: "addToBlacklist", value: function(e3) {
  10257. return this._getModule(On).addBlacklist(e3);
  10258. } }, { key: "removeFromBlacklist", value: function(e3) {
  10259. return this._getModule(On).deleteBlacklist(e3);
  10260. } }, { key: "setSelfStatus", value: function(e3) {
  10261. return this._getModule(On).setSelfStatus(e3);
  10262. } }, { key: "getUserStatus", value: function(e3) {
  10263. return this._getModule(On).getUserStatus(e3);
  10264. } }, { key: "subscribeUserStatus", value: function(e3) {
  10265. return this._getModule(On).subscribeUserStatus(e3);
  10266. } }, { key: "unsubscribeUserStatus", value: function(e3) {
  10267. return this._getModule(On).unsubscribeUserStatus(e3);
  10268. } }, { key: "getFriendList", value: function() {
  10269. var e3 = this._getModule(Pn);
  10270. return e3 ? e3.getLocalFriendList() : Ja({ code: da.CANNOT_FIND_MODULE });
  10271. } }, { key: "addFriend", value: function(e3) {
  10272. var t2 = this._getModule(Pn);
  10273. return t2 ? t2.addFriend(e3) : Ja({ code: da.CANNOT_FIND_MODULE });
  10274. } }, { key: "deleteFriend", value: function(e3) {
  10275. var t2 = this._getModule(Pn);
  10276. return t2 ? t2.deleteFriend(e3) : Ja({ code: da.CANNOT_FIND_MODULE });
  10277. } }, { key: "checkFriend", value: function(e3) {
  10278. var t2 = this._getModule(Pn);
  10279. return t2 ? t2.checkFriend(e3) : Ja({ code: da.CANNOT_FIND_MODULE });
  10280. } }, { key: "getFriendProfile", value: function(e3) {
  10281. var t2 = this._getModule(Pn);
  10282. return t2 ? t2.getFriendProfile(e3) : Ja({ code: da.CANNOT_FIND_MODULE });
  10283. } }, { key: "updateFriend", value: function(e3) {
  10284. var t2 = this._getModule(Pn);
  10285. return t2 ? t2.updateFriend(e3) : Ja({ code: da.CANNOT_FIND_MODULE });
  10286. } }, { key: "getFriendApplicationList", value: function() {
  10287. var e3 = this._getModule(Pn);
  10288. return e3 ? e3.getLocalFriendApplicationList() : Ja({ code: da.CANNOT_FIND_MODULE });
  10289. } }, { key: "acceptFriendApplication", value: function(e3) {
  10290. var t2 = this._getModule(Pn);
  10291. return t2 ? t2.acceptFriendApplication(e3) : Ja({ code: da.CANNOT_FIND_MODULE });
  10292. } }, { key: "refuseFriendApplication", value: function(e3) {
  10293. var t2 = this._getModule(Pn);
  10294. return t2 ? t2.refuseFriendApplication(e3) : Ja({ code: da.CANNOT_FIND_MODULE });
  10295. } }, { key: "deleteFriendApplication", value: function(e3) {
  10296. var t2 = this._getModule(Pn);
  10297. return t2 ? t2.deleteFriendApplication(e3) : Ja({ code: da.CANNOT_FIND_MODULE });
  10298. } }, { key: "setFriendApplicationRead", value: function() {
  10299. var e3 = this._getModule(Pn);
  10300. return e3 ? e3.setFriendApplicationRead() : Ja({ code: da.CANNOT_FIND_MODULE });
  10301. } }, { key: "getFriendGroupList", value: function() {
  10302. var e3 = this._getModule(Pn);
  10303. return e3 ? e3.getLocalFriendGroupList() : Ja({ code: da.CANNOT_FIND_MODULE });
  10304. } }, { key: "createFriendGroup", value: function(e3) {
  10305. var t2 = this._getModule(Pn);
  10306. return t2 ? t2.createFriendGroup(e3) : Ja({ code: da.CANNOT_FIND_MODULE });
  10307. } }, { key: "deleteFriendGroup", value: function(e3) {
  10308. var t2 = this._getModule(Pn);
  10309. return t2 ? t2.deleteFriendGroup(e3) : Ja({ code: da.CANNOT_FIND_MODULE });
  10310. } }, { key: "addToFriendGroup", value: function(e3) {
  10311. var t2 = this._getModule(Pn);
  10312. return t2 ? t2.addToFriendGroup(e3) : Ja({ code: da.CANNOT_FIND_MODULE });
  10313. } }, { key: "removeFromFriendGroup", value: function(e3) {
  10314. var t2 = this._getModule(Pn);
  10315. return t2 ? t2.removeFromFriendGroup(e3) : Ja({ code: da.CANNOT_FIND_MODULE });
  10316. } }, { key: "renameFriendGroup", value: function(e3) {
  10317. var t2 = this._getModule(Pn);
  10318. return t2 ? t2.renameFriendGroup(e3) : Ja({ code: da.CANNOT_FIND_MODULE });
  10319. } }, { key: "getGroupList", value: function(e3) {
  10320. return this._getModule(Un).getGroupList(e3);
  10321. } }, { key: "getGroupProfile", value: function(e3) {
  10322. return this._getModule(Un).getGroupProfile(e3);
  10323. } }, { key: "createGroup", value: function(e3) {
  10324. return this._getModule(Un).createGroup(e3);
  10325. } }, { key: "dismissGroup", value: function(e3) {
  10326. return this._getModule(Un).dismissGroup(e3);
  10327. } }, { key: "updateGroupProfile", value: function(e3) {
  10328. return this._getModule(Un).updateGroupProfile(e3);
  10329. } }, { key: "joinGroup", value: function(e3) {
  10330. return this._getModule(Un).joinGroup(e3);
  10331. } }, { key: "quitGroup", value: function(e3) {
  10332. return this._getModule(Un).quitGroup(e3);
  10333. } }, { key: "searchGroupByID", value: function(e3) {
  10334. return this._getModule(Un).searchGroupByID(e3);
  10335. } }, { key: "getGroupOnlineMemberCount", value: function(e3) {
  10336. return this._getModule(Un).getGroupOnlineMemberCount(e3);
  10337. } }, { key: "changeGroupOwner", value: function(e3) {
  10338. return this._getModule(Un).changeGroupOwner(e3);
  10339. } }, { key: "getGroupApplicationList", value: function() {
  10340. return this._getModule(Un).getGroupApplicationList();
  10341. } }, { key: "handleGroupApplication", value: function(e3) {
  10342. return this._getModule(Un).handleGroupApplication(e3);
  10343. } }, { key: "initGroupAttributes", value: function(e3) {
  10344. return this._getModule(Un).initGroupAttributes(e3);
  10345. } }, { key: "setGroupAttributes", value: function(e3) {
  10346. return this._getModule(Un).setGroupAttributes(e3);
  10347. } }, { key: "deleteGroupAttributes", value: function(e3) {
  10348. return this._getModule(Un).deleteGroupAttributes(e3);
  10349. } }, { key: "getGroupAttributes", value: function(e3) {
  10350. return this._getModule(Un).getGroupAttributes(e3);
  10351. } }, { key: "setGroupCounters", value: function(e3) {
  10352. return this._getModule(Un).setGroupCounters(e3);
  10353. } }, { key: "increaseGroupCounter", value: function(e3) {
  10354. return this._getModule(Un).increaseGroupCounter(e3);
  10355. } }, { key: "decreaseGroupCounter", value: function(e3) {
  10356. return this._getModule(Un).decreaseGroupCounter(e3);
  10357. } }, { key: "getGroupCounters", value: function(e3) {
  10358. return this._getModule(Un).getGroupCounters(e3);
  10359. } }, { key: "getGroupMemberList", value: function(e3) {
  10360. return this._getModule(bn).getGroupMemberList(e3);
  10361. } }, { key: "getGroupMemberProfile", value: function(e3) {
  10362. return this._getModule(bn).getGroupMemberProfile(e3);
  10363. } }, { key: "addGroupMember", value: function(e3) {
  10364. return this._getModule(bn).addGroupMember(e3);
  10365. } }, { key: "deleteGroupMember", value: function(e3) {
  10366. return this._getModule(bn).deleteGroupMember(e3);
  10367. } }, { key: "setGroupMemberMuteTime", value: function(e3) {
  10368. return this._getModule(bn).setGroupMemberMuteTime(e3);
  10369. } }, { key: "setGroupMemberRole", value: function(e3) {
  10370. return this._getModule(bn).setGroupMemberRole(e3);
  10371. } }, { key: "setGroupMemberNameCard", value: function(e3) {
  10372. return this._getModule(bn).setGroupMemberNameCard(e3);
  10373. } }, { key: "setGroupMemberCustomField", value: function(e3) {
  10374. return this._getModule(bn).setGroupMemberCustomField(e3);
  10375. } }, { key: "markGroupMemberList", value: function(e3) {
  10376. return this._getModule(bn).markGroupMemberList(e3);
  10377. } }, { key: "getJoinedCommunityList", value: function() {
  10378. return this._getModule(wn).getJoinedCommunityList();
  10379. } }, { key: "createTopicInCommunity", value: function(e3) {
  10380. return this._getModule(wn).createTopicInCommunity(e3);
  10381. } }, { key: "deleteTopicFromCommunity", value: function(e3) {
  10382. return this._getModule(wn).deleteTopicFromCommunity(e3);
  10383. } }, { key: "updateTopicProfile", value: function(e3) {
  10384. return this._getModule(wn).updateTopicProfile(e3);
  10385. } }, { key: "getTopicList", value: function(e3) {
  10386. return this._getModule(wn).getTopicList(e3);
  10387. } }]), e2;
  10388. }(), pu = { login: 1, logout: 1, destroy: 1, on: 1, off: 1, ready: 1, setLogLevel: 1, joinGroup: 1, quitGroup: 1, registerPlugin: 1, getGroupOnlineMemberCount: 1 };
  10389. function du(e2, t2) {
  10390. if (e2.isReady() || 1 === pu[t2])
  10391. return true;
  10392. var n2 = e2.getNotReadyReason(), o2 = { code: n2, message: "".concat(e2.getErrorMessage(n2), " | ").concat(t2, " | ").concat(e2.getErrorMessage(da.SDK_IS_NOT_READY)) };
  10393. return e2.onError(o2), o2;
  10394. }
  10395. var gu = {}, _u = {};
  10396. return _u.create = function(e2) {
  10397. var n2 = 0, o2 = e2.SDKAppID;
  10398. if ($e(o2))
  10399. n2 = o2;
  10400. else if (n2 = parseInt(o2), isNaN(o2))
  10401. return xe.e("".concat("TIM.create", " failed. Failed to parse the SDKAppID, please check the arguments")), null;
  10402. if (n2 && gu[n2])
  10403. return gu[n2];
  10404. xe.l("".concat("TIM.create"));
  10405. var s2 = new lu(t(t({}, e2), {}, { SDKAppID: n2 }));
  10406. s2.on(E.SDK_DESTROY, function(e3) {
  10407. gu[e3.data.SDKAppID] = null, delete gu[e3.data.SDKAppID];
  10408. });
  10409. var a2 = function(e3) {
  10410. var t2 = /* @__PURE__ */ Object.create(null);
  10411. return Object.keys(Ln).forEach(function(n3) {
  10412. if (e3[n3]) {
  10413. var o3 = new k();
  10414. t2[n3] = function() {
  10415. var t3 = Array.from(arguments);
  10416. return o3.use(function(t4, o4) {
  10417. var s3 = du(e3, n3);
  10418. return true === s3 ? o4() : Ja(s3);
  10419. }).use(function(e4, t4) {
  10420. if (true === zt(e4, kn[n3], n3))
  10421. return t4();
  10422. }).use(function(t4, o4) {
  10423. return e3[n3].apply(e3, t4);
  10424. }), o3.run(t3);
  10425. };
  10426. }
  10427. }), t2;
  10428. }(s2);
  10429. return gu[n2] = a2, kn.hookGetAPITips(s2.getErrorMessage.bind(s2)), xe.l("".concat("TIM.create", " ok")), a2;
  10430. }, _u.TYPES = S, _u.EVENT = E, _u.VERSION = "2.27.3", xe.l("TIM.VERSION:".concat(_u.VERSION)), _u;
  10431. });
  10432. }
  10433. });
  10434. export default require_tim_js();
  10435. //# sourceMappingURL=tim-js-sdk.js.map