mqtt.min.js 331 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313
  1. ! function (e) {
  2. if ("object" == typeof exports && "undefined" != typeof module) module.exports = e();
  3. else if ("function" == typeof define && define.amd) define([], e);
  4. else {
  5. ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).mqtt = e()
  6. }
  7. }(function () {
  8. return function () {
  9. return function e(t, r, n) {
  10. function i(s, a) {
  11. if (!r[s]) {
  12. if (!t[s]) { var l = "function" == typeof require && require; if (!a && l) return l(s, !0); if (o) return o(s, !0); var u = new Error("Cannot find module '" + s + "'"); throw u.code = "MODULE_NOT_FOUND", u }
  13. var c = r[s] = { exports: {} };
  14. t[s][0].call(c.exports, function (e) { return i(t[s][1][e] || e) }, c, c.exports, e, t, r, n)
  15. }
  16. return r[s].exports
  17. }
  18. for (var o = "function" == typeof require && require, s = 0; s < n.length; s++) i(n[s]);
  19. return i
  20. }
  21. }()({
  22. 1: [function (e, t, r) {
  23. (function (r, n) {
  24. (function () {
  25. "use strict";
  26. const i = e("events").EventEmitter,
  27. o = e("./store"),
  28. s = e("./topic-alias-recv"),
  29. a = e("./topic-alias-send"),
  30. l = e("mqtt-packet"),
  31. u = e("./default-message-id-provider"),
  32. c = e("readable-stream").Writable,
  33. h = e("inherits"),
  34. f = e("reinterval"),
  35. p = e("rfdc/default"),
  36. d = e("./validations"),
  37. g = e("xtend"),
  38. y = e("debug")("mqttjs:client"),
  39. b = r ? r.nextTick : function (e) { setTimeout(e, 0) },
  40. m = n.setImmediate || function (e) { b(e) },
  41. v = { keepalive: 60, reschedulePings: !0, protocolId: "MQTT", protocolVersion: 4, reconnectPeriod: 1e3, connectTimeout: 3e4, clean: !0, resubscribe: !0 },
  42. w = ["ECONNREFUSED", "EADDRINUSE", "ECONNRESET", "ENOTFOUND"],
  43. _ = { 0: "", 1: "Unacceptable protocol version", 2: "Identifier rejected", 3: "Server unavailable", 4: "Bad username or password", 5: "Not authorized", 16: "No matching subscribers", 17: "No subscription existed", 128: "Unspecified error", 129: "Malformed Packet", 130: "Protocol Error", 131: "Implementation specific error", 132: "Unsupported Protocol Version", 133: "Client Identifier not valid", 134: "Bad User Name or Password", 135: "Not authorized", 136: "Server unavailable", 137: "Server busy", 138: "Banned", 139: "Server shutting down", 140: "Bad authentication method", 141: "Keep Alive timeout", 142: "Session taken over", 143: "Topic Filter invalid", 144: "Topic Name invalid", 145: "Packet identifier in use", 146: "Packet Identifier not found", 147: "Receive Maximum exceeded", 148: "Topic Alias invalid", 149: "Packet too large", 150: "Message rate too high", 151: "Quota exceeded", 152: "Administrative action", 153: "Payload format invalid", 154: "Retain not supported", 155: "QoS not supported", 156: "Use another server", 157: "Server moved", 158: "Shared Subscriptions not supported", 159: "Connection rate exceeded", 160: "Maximum connect time", 161: "Subscription Identifiers not supported", 162: "Wildcard Subscriptions not supported" };
  44. function k(e, t) {
  45. let r;
  46. t.properties && (r = t.properties.topicAlias);
  47. let n = t.topic.toString();
  48. if (0 === n.length) {
  49. if (void 0 === r) return new Error("Unregistered Topic Alias");
  50. if (void 0 === (n = e.topicAliasSend.getTopicByAlias(r))) return new Error("Unregistered Topic Alias");
  51. t.topic = n
  52. }
  53. r && delete t.properties.topicAlias
  54. }
  55. function S(e, t, r) {
  56. y("sendPacket :: packet: %O", t), y("sendPacket :: emitting `packetsend`"), e.emit("packetsend", t), y("sendPacket :: writing to stream");
  57. const n = l.writeToStream(t, e.stream, e.options);
  58. y("sendPacket :: writeToStream result %s", n), !n && r && r !== C ? (y("sendPacket :: handle events on `drain` once through callback."), e.stream.once("drain", r)) : r && (y("sendPacket :: invoking cb"), r())
  59. }
  60. function E(e, t, r, n) {
  61. y("storeAndSend :: store packet with cmd %s to outgoingStore", t.cmd);
  62. let i, o = t;
  63. if ("publish" === o.cmd && (o = p(t), i = k(e, o))) return r && r(i);
  64. e.outgoingStore.put(o, function (i) {
  65. if (i) return r && r(i);
  66. n(), S(e, t, r)
  67. })
  68. }
  69. function C(e) { y("nop ::", e) }
  70. function T(e, t) {
  71. let r;
  72. const n = this;
  73. if (!(this instanceof T)) return new T(e, t);
  74. for (r in this.options = t || {}, v) void 0 === this.options[r] ? this.options[r] = v[r] : this.options[r] = t[r];
  75. y("MqttClient :: options.protocol", t.protocol), y("MqttClient :: options.protocolVersion", t.protocolVersion), y("MqttClient :: options.username", t.username), y("MqttClient :: options.keepalive", t.keepalive), y("MqttClient :: options.reconnectPeriod", t.reconnectPeriod), y("MqttClient :: options.rejectUnauthorized", t.rejectUnauthorized), y("MqttClient :: options.topicAliasMaximum", t.topicAliasMaximum), this.options.clientId = "string" == typeof t.clientId ? t.clientId : "mqttjs_" + Math.random().toString(16).substr(2, 8), y("MqttClient :: clientId", this.options.clientId), this.options.customHandleAcks = 5 === t.protocolVersion && t.customHandleAcks ? t.customHandleAcks : function () { arguments[3](0) }, this.streamBuilder = e, this.messageIdProvider = void 0 === this.options.messageIdProvider ? new u : this.options.messageIdProvider, this.outgoingStore = t.outgoingStore || new o, this.incomingStore = t.incomingStore || new o, this.queueQoSZero = void 0 === t.queueQoSZero || t.queueQoSZero, this._resubscribeTopics = {}, this.messageIdToTopic = {}, this.pingTimer = null, this.connected = !1, this.disconnecting = !1, this.queue = [], this.connackTimer = null, this.reconnectTimer = null, this._storeProcessing = !1, this._packetIdsDuringStoreProcessing = {}, this._storeProcessingQueue = [], this.outgoing = {}, this._firstConnection = !0, t.topicAliasMaximum > 0 && (t.topicAliasMaximum > 65535 ? y("MqttClient :: options.topicAliasMaximum is out of range") : this.topicAliasRecv = new s(t.topicAliasMaximum)), this.on("connect", function () {
  76. const e = this.queue;
  77. y("connect :: sending queued packets"),
  78. function t() {
  79. const r = e.shift();
  80. y("deliver :: entry %o", r);
  81. let i = null;
  82. if (!r) return void n._resubscribe();
  83. i = r.packet, y("deliver :: call _sendPacket for %o", i);
  84. let o = !0;
  85. i.messageId && 0 !== i.messageId && (n.messageIdProvider.register(i.messageId) || (o = !1)), o ? n._sendPacket(i, function (e) { r.cb && r.cb(e), t() }) : (y("messageId: %d has already used. The message is skipped and removed.", i.messageId), t())
  86. }()
  87. }), this.on("close", function () { y("close :: connected set to `false`"), this.connected = !1, y("close :: clearing connackTimer"), clearTimeout(this.connackTimer), y("close :: clearing ping timer"), null !== n.pingTimer && (n.pingTimer.clear(), n.pingTimer = null), this.topicAliasRecv && this.topicAliasRecv.clear(), y("close :: calling _setupReconnect"), this._setupReconnect() }), i.call(this), y("MqttClient :: setting up stream"), this._setupStream()
  88. }
  89. h(T, i), T.prototype._setupStream = function () {
  90. const e = this,
  91. t = new c,
  92. r = l.parser(this.options);
  93. let n = null;
  94. const i = [];
  95. function o() {
  96. if (i.length) b(s);
  97. else {
  98. const e = n;
  99. n = null, e()
  100. }
  101. }
  102. function s() {
  103. y("work :: getting next packet in queue");
  104. const t = i.shift();
  105. if (t) y("work :: packet pulled from queue"), e._handlePacket(t, o);
  106. else {
  107. y("work :: no packets in queue");
  108. const e = n;
  109. n = null, y("work :: done flag is %s", !!e), e && e()
  110. }
  111. }
  112. y("_setupStream :: calling method to clear reconnect"), this._clearReconnect(), y("_setupStream :: using streamBuilder provided to client to create stream"), this.stream = this.streamBuilder(this), r.on("packet", function (e) { y("parser :: on packet push to packets array."), i.push(e) }), t._write = function (e, t, i) { n = i, y("writable stream :: parsing buffer"), r.parse(e), s() }, y("_setupStream :: pipe stream to writable stream"), this.stream.pipe(t), this.stream.on("error", function (t) { y("streamErrorHandler :: error", t.message), w.includes(t.code) ? (y("streamErrorHandler :: emitting error"), e.emit("error", t)) : C(t) }), this.stream.on("close", function () {
  113. var t;
  114. y("(%s)stream :: on close", e.options.clientId), (t = e.outgoing) && (y("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"), Object.keys(t).forEach(function (e) { t[e].volatile && "function" == typeof t[e].cb && (t[e].cb(new Error("Connection closed")), delete t[e]) })), y("stream: emit close to MqttClient"), e.emit("close")
  115. }), y("_setupStream: sending packet `connect`");
  116. const a = Object.create(this.options);
  117. if (a.cmd = "connect", this.topicAliasRecv && (a.properties || (a.properties = {}), this.topicAliasRecv && (a.properties.topicAliasMaximum = this.topicAliasRecv.max)), S(this, a), r.on("error", this.emit.bind(this, "error")), this.options.properties) { if (!this.options.properties.authenticationMethod && this.options.properties.authenticationData) return e.end(() => this.emit("error", new Error("Packet has no Authentication Method"))), this; if (this.options.properties.authenticationMethod && this.options.authPacket && "object" == typeof this.options.authPacket) { S(this, g({ cmd: "auth", reasonCode: 0 }, this.options.authPacket)) } } this.stream.setMaxListeners(1e3), clearTimeout(this.connackTimer), this.connackTimer = setTimeout(function () { y("!!connectTimeout hit!! Calling _cleanUp with force `true`"), e._cleanUp(!0) }, this.options.connectTimeout)
  118. }, T.prototype._handlePacket = function (e, t) {
  119. const r = this.options;
  120. if (5 === r.protocolVersion && r.properties && r.properties.maximumPacketSize && r.properties.maximumPacketSize < e.length) return this.emit("error", new Error("exceeding packets size " + e.cmd)), this.end({ reasonCode: 149, properties: { reasonString: "Maximum packet size was exceeded" } }), this;
  121. switch (y("_handlePacket :: emitting packetreceive"), this.emit("packetreceive", e), e.cmd) {
  122. case "publish":
  123. this._handlePublish(e, t);
  124. break;
  125. case "puback":
  126. case "pubrec":
  127. case "pubcomp":
  128. case "suback":
  129. case "unsuback":
  130. this._handleAck(e), t();
  131. break;
  132. case "pubrel":
  133. this._handlePubrel(e, t);
  134. break;
  135. case "connack":
  136. this._handleConnack(e), t();
  137. break;
  138. case "auth":
  139. this._handleAuth(e), t();
  140. break;
  141. case "pingresp":
  142. this._handlePingresp(e), t();
  143. break;
  144. case "disconnect":
  145. this._handleDisconnect(e), t()
  146. }
  147. }, T.prototype._checkDisconnecting = function (e) { return this.disconnecting && (e && e !== C ? e(new Error("client disconnecting")) : this.emit("error", new Error("client disconnecting"))), this.disconnecting }, T.prototype.publish = function (e, t, r, n) {
  148. y("publish :: message `%s` to topic `%s`", t, e);
  149. const i = this.options;
  150. "function" == typeof r && (n = r, r = null);
  151. if (r = g({ qos: 0, retain: !1, dup: !1 }, r), this._checkDisconnecting(n)) return this;
  152. const o = this,
  153. s = function () {
  154. let s = 0;
  155. if ((1 === r.qos || 2 === r.qos) && null === (s = o._nextId())) return y("No messageId left"), !1;
  156. const a = { cmd: "publish", topic: e, payload: t, qos: r.qos, retain: r.retain, messageId: s, dup: r.dup };
  157. switch (5 === i.protocolVersion && (a.properties = r.properties), y("publish :: qos", r.qos), r.qos) {
  158. case 1:
  159. case 2:
  160. o.outgoing[a.messageId] = { volatile: !1, cb: n || C }, y("MqttClient:publish: packet cmd: %s", a.cmd), o._sendPacket(a, void 0, r.cbStorePut);
  161. break;
  162. default:
  163. y("MqttClient:publish: packet cmd: %s", a.cmd), o._sendPacket(a, n, r.cbStorePut)
  164. }
  165. return !0
  166. };
  167. return (this._storeProcessing || this._storeProcessingQueue.length > 0 || !s()) && this._storeProcessingQueue.push({ invoke: s, cbStorePut: r.cbStorePut, callback: n }), this
  168. }, T.prototype.subscribe = function () {
  169. const e = this,
  170. t = new Array(arguments.length);
  171. for (let e = 0; e < arguments.length; e++) t[e] = arguments[e];
  172. const r = [];
  173. let n = t.shift();
  174. const i = n.resubscribe;
  175. let o = t.pop() || C,
  176. s = t.pop();
  177. const a = this.options.protocolVersion;
  178. delete n.resubscribe, "string" == typeof n && (n = [n]), "function" != typeof o && (s = o, o = C);
  179. const l = d.validateTopics(n);
  180. if (null !== l) return m(o, new Error("Invalid topic " + l)), this;
  181. if (this._checkDisconnecting(o)) return y("subscribe: discconecting true"), this;
  182. const u = { qos: 0 };
  183. if (5 === a && (u.nl = !1, u.rap = !1, u.rh = 0), s = g(u, s), Array.isArray(n) ? n.forEach(function (t) {
  184. if (y("subscribe: array topic %s", t), !Object.prototype.hasOwnProperty.call(e._resubscribeTopics, t) || e._resubscribeTopics[t].qos < s.qos || i) {
  185. const e = { topic: t, qos: s.qos };
  186. 5 === a && (e.nl = s.nl, e.rap = s.rap, e.rh = s.rh, e.properties = s.properties), y("subscribe: pushing topic `%s` and qos `%s` to subs list", e.topic, e.qos), r.push(e)
  187. }
  188. }) : Object.keys(n).forEach(function (t) {
  189. if (y("subscribe: object topic %s", t), !Object.prototype.hasOwnProperty.call(e._resubscribeTopics, t) || e._resubscribeTopics[t].qos < n[t].qos || i) {
  190. const e = { topic: t, qos: n[t].qos };
  191. 5 === a && (e.nl = n[t].nl, e.rap = n[t].rap, e.rh = n[t].rh, e.properties = s.properties), y("subscribe: pushing `%s` to subs list", e), r.push(e)
  192. }
  193. }), !r.length) return o(null, []), this;
  194. const c = function () {
  195. const t = e._nextId();
  196. if (null === t) return y("No messageId left"), !1;
  197. const n = { cmd: "subscribe", subscriptions: r, qos: 1, retain: !1, dup: !1, messageId: t };
  198. if (s.properties && (n.properties = s.properties), e.options.resubscribe) {
  199. y("subscribe :: resubscribe true");
  200. const t = [];
  201. r.forEach(function (r) {
  202. if (e.options.reconnectPeriod > 0) {
  203. const n = { qos: r.qos };
  204. 5 === a && (n.nl = r.nl || !1, n.rap = r.rap || !1, n.rh = r.rh || 0, n.properties = r.properties), e._resubscribeTopics[r.topic] = n, t.push(r.topic)
  205. }
  206. }), e.messageIdToTopic[n.messageId] = t
  207. }
  208. return e.outgoing[n.messageId] = { volatile: !0, cb: function (e, t) { if (!e) { const e = t.granted; for (let t = 0; t < e.length; t += 1) r[t].qos = e[t] } o(e, r) } }, y("subscribe :: call _sendPacket"), e._sendPacket(n), !0
  209. };
  210. return (this._storeProcessing || this._storeProcessingQueue.length > 0 || !c()) && this._storeProcessingQueue.push({ invoke: c, callback: o }), this
  211. }, T.prototype.unsubscribe = function () {
  212. const e = this,
  213. t = new Array(arguments.length);
  214. for (let e = 0; e < arguments.length; e++) t[e] = arguments[e];
  215. let r = t.shift(),
  216. n = t.pop() || C,
  217. i = t.pop();
  218. "string" == typeof r && (r = [r]), "function" != typeof n && (i = n, n = C);
  219. const o = d.validateTopics(r);
  220. if (null !== o) return m(n, new Error("Invalid topic " + o)), this;
  221. if (e._checkDisconnecting(n)) return this;
  222. const s = function () { const t = e._nextId(); if (null === t) return y("No messageId left"), !1; const o = { cmd: "unsubscribe", qos: 1, messageId: t }; return "string" == typeof r ? o.unsubscriptions = [r] : Array.isArray(r) && (o.unsubscriptions = r), e.options.resubscribe && o.unsubscriptions.forEach(function (t) { delete e._resubscribeTopics[t] }), "object" == typeof i && i.properties && (o.properties = i.properties), e.outgoing[o.messageId] = { volatile: !0, cb: n }, y("unsubscribe: call _sendPacket"), e._sendPacket(o), !0 };
  223. return (this._storeProcessing || this._storeProcessingQueue.length > 0 || !s()) && this._storeProcessingQueue.push({ invoke: s, callback: n }), this
  224. }, T.prototype.end = function (e, t, r) {
  225. const n = this;
  226. function i() {
  227. y("end :: (%s) :: finish :: calling _cleanUp with force %s", n.options.clientId, e), n._cleanUp(e, () => {
  228. y("end :: finish :: calling process.nextTick on closeStores"), b(function () {
  229. y("end :: closeStores: closing incoming and outgoing stores"), n.disconnected = !0, n.incomingStore.close(function (e) {
  230. n.outgoingStore.close(function (t) {
  231. if (y("end :: closeStores: emitting end"), n.emit("end"), r) {
  232. const n = e || t;
  233. y("end :: closeStores: invoking callback with args"), r(n)
  234. }
  235. })
  236. }), n._deferredReconnect && n._deferredReconnect()
  237. }.bind(n))
  238. }, t)
  239. }
  240. return y("end :: (%s)", this.options.clientId), null != e && "boolean" == typeof e || (r = t || C, t = e, e = !1, "object" != typeof t && (r = t, t = null, "function" != typeof r && (r = C))), "object" != typeof t && (r = t, t = null), y("end :: cb? %s", !!r), r = r || C, this.disconnecting ? (r(), this) : (this._clearReconnect(), this.disconnecting = !0, !e && Object.keys(this.outgoing).length > 0 ? (y("end :: (%s) :: calling finish in 10ms once outgoing is empty", n.options.clientId), this.once("outgoingEmpty", setTimeout.bind(null, i, 10))) : (y("end :: (%s) :: immediately calling finish", n.options.clientId), i()), this)
  241. }, T.prototype.removeOutgoingMessage = function (e) { const t = this.outgoing[e] ? this.outgoing[e].cb : null; return delete this.outgoing[e], this.outgoingStore.del({ messageId: e }, function () { t(new Error("Message removed")) }), this }, T.prototype.reconnect = function (e) {
  242. y("client reconnect");
  243. const t = this,
  244. r = function () { e ? (t.options.incomingStore = e.incomingStore, t.options.outgoingStore = e.outgoingStore) : (t.options.incomingStore = null, t.options.outgoingStore = null), t.incomingStore = t.options.incomingStore || new o, t.outgoingStore = t.options.outgoingStore || new o, t.disconnecting = !1, t.disconnected = !1, t._deferredReconnect = null, t._reconnect() };
  245. return this.disconnecting && !this.disconnected ? this._deferredReconnect = r : r(), this
  246. }, T.prototype._reconnect = function () { y("_reconnect: emitting reconnect to client"), this.emit("reconnect"), this.connected ? (this.end(() => { this._setupStream() }), y("client already connected. disconnecting first.")) : (y("_reconnect: calling _setupStream"), this._setupStream()) }, T.prototype._setupReconnect = function () { const e = this;!e.disconnecting && !e.reconnectTimer && e.options.reconnectPeriod > 0 ? (this.reconnecting || (y("_setupReconnect :: emit `offline` state"), this.emit("offline"), y("_setupReconnect :: set `reconnecting` to `true`"), this.reconnecting = !0), y("_setupReconnect :: setting reconnectTimer for %d ms", e.options.reconnectPeriod), e.reconnectTimer = setInterval(function () { y("reconnectTimer :: reconnect triggered!"), e._reconnect() }, e.options.reconnectPeriod)) : y("_setupReconnect :: doing nothing...") }, T.prototype._clearReconnect = function () { y("_clearReconnect : clearing reconnect timer"), this.reconnectTimer && (clearInterval(this.reconnectTimer), this.reconnectTimer = null) }, T.prototype._cleanUp = function (e, t) {
  247. const r = arguments[2];
  248. if (t && (y("_cleanUp :: done callback provided for on stream close"), this.stream.on("close", t)), y("_cleanUp :: forced? %s", e), e) 0 === this.options.reconnectPeriod && this.options.clean && (n = this.outgoing) && (y("flush: queue exists? %b", !!n), Object.keys(n).forEach(function (e) { "function" == typeof n[e].cb && (n[e].cb(new Error("Connection closed")), delete n[e]) })), y("_cleanUp :: (%s) :: destroying stream", this.options.clientId), this.stream.destroy();
  249. else {
  250. const e = g({ cmd: "disconnect" }, r);
  251. y("_cleanUp :: (%s) :: call _sendPacket with disconnect packet", this.options.clientId), this._sendPacket(e, m.bind(null, this.stream.end.bind(this.stream)))
  252. }
  253. var n;
  254. this.disconnecting || (y("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."), this._clearReconnect(), this._setupReconnect()), null !== this.pingTimer && (y("_cleanUp :: clearing pingTimer"), this.pingTimer.clear(), this.pingTimer = null), t && !this.connected && (y("_cleanUp :: (%s) :: removing stream `done` callback `close` listener", this.options.clientId), this.stream.removeListener("close", t), t())
  255. }, T.prototype._sendPacket = function (e, t, r) {
  256. y("_sendPacket :: (%s) :: start", this.options.clientId), r = r || C, t = t || C;
  257. const n = function (e, t) {
  258. if (5 === e.options.protocolVersion && "publish" === t.cmd) {
  259. let r;
  260. t.properties && (r = t.properties.topicAlias);
  261. const n = t.topic.toString();
  262. if (e.topicAliasSend)
  263. if (r) { if (0 !== n.length && (y("applyTopicAlias :: register topic: %s - alias: %d", n, r), !e.topicAliasSend.put(n, r))) return y("applyTopicAlias :: error out of range. topic: %s - alias: %d", n, r), new Error("Sending Topic Alias out of range") } else 0 !== n.length && (e.options.autoAssignTopicAlias ? (r = e.topicAliasSend.getAliasByTopic(n)) ? (t.topic = "", t.properties = { ...t.properties, topicAlias: r }, y("applyTopicAlias :: auto assign(use) topic: %s - alias: %d", n, r)) : (r = e.topicAliasSend.getLruAlias(), e.topicAliasSend.put(n, r), t.properties = { ...t.properties, topicAlias: r }, y("applyTopicAlias :: auto assign topic: %s - alias: %d", n, r)) : e.options.autoUseTopicAlias && (r = e.topicAliasSend.getAliasByTopic(n)) && (t.topic = "", t.properties = { ...t.properties, topicAlias: r }, y("applyTopicAlias :: auto use topic: %s - alias: %d", n, r)));
  264. else if (r) return y("applyTopicAlias :: error out of range. topic: %s - alias: %d", n, r), new Error("Sending Topic Alias out of range")
  265. }
  266. }(this, e);
  267. if (n) t(n);
  268. else {
  269. if (!this.connected) return "auth" === e.cmd ? (this._shiftPingInterval(), void S(this, e, t)) : (y("_sendPacket :: client not connected. Storing packet offline."), void this._storePacket(e, t, r));
  270. switch (this._shiftPingInterval(), e.cmd) {
  271. case "publish":
  272. break;
  273. case "pubrel":
  274. return void E(this, e, t, r);
  275. default:
  276. return void S(this, e, t)
  277. }
  278. switch (e.qos) {
  279. case 2:
  280. case 1:
  281. E(this, e, t, r);
  282. break;
  283. case 0:
  284. default:
  285. S(this, e, t)
  286. }
  287. y("_sendPacket :: (%s) :: end", this.options.clientId)
  288. }
  289. }, T.prototype._storePacket = function (e, t, r) {
  290. y("_storePacket :: packet: %o", e), y("_storePacket :: cb? %s", !!t), r = r || C;
  291. let n = e;
  292. if ("publish" === n.cmd) { const r = k(this, n = p(e)); if (r) return t && t(r) } 0 === (n.qos || 0) && this.queueQoSZero || "publish" !== n.cmd ? this.queue.push({ packet: n, cb: t }) : n.qos > 0 ? (t = this.outgoing[n.messageId] ? this.outgoing[n.messageId].cb : null, this.outgoingStore.put(n, function (e) {
  293. if (e) return t && t(e);
  294. r()
  295. })) : t && t(new Error("No connection to broker"))
  296. }, T.prototype._setupPingTimer = function () { y("_setupPingTimer :: keepalive %d (seconds)", this.options.keepalive); const e = this;!this.pingTimer && this.options.keepalive && (this.pingResp = !0, this.pingTimer = f(function () { e._checkPing() }, 1e3 * this.options.keepalive)) }, T.prototype._shiftPingInterval = function () { this.pingTimer && this.options.keepalive && this.options.reschedulePings && this.pingTimer.reschedule(1e3 * this.options.keepalive) }, T.prototype._checkPing = function () { y("_checkPing :: checking ping..."), this.pingResp ? (y("_checkPing :: ping response received. Clearing flag and sending `pingreq`"), this.pingResp = !1, this._sendPacket({ cmd: "pingreq" })) : (y("_checkPing :: calling _cleanUp with force true"), this._cleanUp(!0)) }, T.prototype._handlePingresp = function () { this.pingResp = !0 }, T.prototype._handleConnack = function (e) {
  297. y("_handleConnack");
  298. const t = this.options,
  299. r = 5 === t.protocolVersion ? e.reasonCode : e.returnCode;
  300. if (clearTimeout(this.connackTimer), delete this.topicAliasSend, e.properties) {
  301. if (e.properties.topicAliasMaximum) {
  302. if (e.properties.topicAliasMaximum > 65535) return void this.emit("error", new Error("topicAliasMaximum from broker is out of range"));
  303. e.properties.topicAliasMaximum > 0 && (this.topicAliasSend = new a(e.properties.topicAliasMaximum))
  304. }
  305. e.properties.serverKeepAlive && t.keepalive && (t.keepalive = e.properties.serverKeepAlive, this._shiftPingInterval()), e.properties.maximumPacketSize && (t.properties || (t.properties = {}), t.properties.maximumPacketSize = e.properties.maximumPacketSize)
  306. }
  307. if (0 === r) this.reconnecting = !1, this._onConnect(e);
  308. else if (r > 0) {
  309. const e = new Error("Connection refused: " + _[r]);
  310. e.code = r, this.emit("error", e)
  311. }
  312. }, T.prototype._handleAuth = function (e) {
  313. const t = this.options.protocolVersion,
  314. r = 5 === t ? e.reasonCode : e.returnCode;
  315. if (5 !== t) { const e = new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:" + t); return e.code = r, void this.emit("error", e) }
  316. const n = this;
  317. this.handleAuth(e, function (e, t) {
  318. if (e) n.emit("error", e);
  319. else if (24 === r) n.reconnecting = !1, n._sendPacket(t);
  320. else {
  321. const t = new Error("Connection refused: " + _[r]);
  322. e.code = r, n.emit("error", t)
  323. }
  324. })
  325. }, T.prototype.handleAuth = function (e, t) { t() }, T.prototype._handlePublish = function (e, t) {
  326. y("_handlePublish: packet %o", e), t = void 0 !== t ? t : C;
  327. let r = e.topic.toString();
  328. const n = e.payload,
  329. i = e.qos,
  330. o = e.messageId,
  331. s = this,
  332. a = this.options,
  333. l = [0, 16, 128, 131, 135, 144, 145, 151, 153];
  334. if (5 === this.options.protocolVersion) {
  335. let t;
  336. if (e.properties && (t = e.properties.topicAlias), void 0 !== t)
  337. if (0 === r.length) {
  338. if (!(t > 0 && t <= 65535)) return y("_handlePublish :: topic alias out of range. alias: %d", t), void this.emit("error", new Error("Received Topic Alias is out of range")); {
  339. const e = this.topicAliasRecv.getTopicByAlias(t);
  340. if (!e) return y("_handlePublish :: unregistered topic alias. alias: %d", t), void this.emit("error", new Error("Received unregistered Topic Alias"));
  341. y("_handlePublish :: topic complemented by alias. topic: %s - alias: %d", r = e, t)
  342. }
  343. } else {
  344. if (!this.topicAliasRecv.put(r, t)) return y("_handlePublish :: topic alias out of range. alias: %d", t), void this.emit("error", new Error("Received Topic Alias is out of range"));
  345. y("_handlePublish :: registered topic: %s - alias: %d", r, t)
  346. }
  347. }
  348. switch (y("_handlePublish: qos %d", i), i) {
  349. case 2:
  350. a.customHandleAcks(r, n, e, function (r, n) { return r instanceof Error || (n = r, r = null), r ? s.emit("error", r) : -1 === l.indexOf(n) ? s.emit("error", new Error("Wrong reason code for pubrec")) : void(n ? s._sendPacket({ cmd: "pubrec", messageId: o, reasonCode: n }, t) : s.incomingStore.put(e, function () { s._sendPacket({ cmd: "pubrec", messageId: o }, t) })) });
  351. break;
  352. case 1:
  353. a.customHandleAcks(r, n, e, function (i, a) {
  354. return i instanceof Error || (a = i, i = null), i ? s.emit("error", i) : -1 === l.indexOf(a) ? s.emit("error", new Error("Wrong reason code for puback")) : (a || s.emit("message", r, n, e), void s.handleMessage(e, function (e) {
  355. if (e) return t && t(e);
  356. s._sendPacket({ cmd: "puback", messageId: o, reasonCode: a }, t)
  357. }))
  358. });
  359. break;
  360. case 0:
  361. this.emit("message", r, n, e), this.handleMessage(e, t);
  362. break;
  363. default:
  364. y("_handlePublish: unknown QoS. Doing nothing.")
  365. }
  366. }, T.prototype.handleMessage = function (e, t) { t() }, T.prototype._handleAck = function (e) {
  367. const t = e.messageId,
  368. r = e.cmd;
  369. let n = null;
  370. const i = this.outgoing[t] ? this.outgoing[t].cb : null,
  371. o = this;
  372. let s;
  373. if (i) {
  374. switch (y("_handleAck :: packet type", r), r) {
  375. case "pubcomp":
  376. case "puback": {
  377. const r = e.reasonCode;
  378. r && r > 0 && 16 !== r && ((s = new Error("Publish error: " + _[r])).code = r, i(s, e)), delete this.outgoing[t], this.outgoingStore.del(e, i), this.messageIdProvider.deallocate(t), this._invokeStoreProcessingQueue();
  379. break
  380. }
  381. case "pubrec": {
  382. n = { cmd: "pubrel", qos: 2, messageId: t };
  383. const r = e.reasonCode;
  384. r && r > 0 && 16 !== r ? ((s = new Error("Publish error: " + _[r])).code = r, i(s, e)) : this._sendPacket(n);
  385. break
  386. }
  387. case "suback":
  388. delete this.outgoing[t], this.messageIdProvider.deallocate(t);
  389. for (let r = 0; r < e.granted.length; r++)
  390. if (0 != (128 & e.granted[r])) {
  391. const e = this.messageIdToTopic[t];
  392. e && e.forEach(function (e) { delete o._resubscribeTopics[e] })
  393. } this._invokeStoreProcessingQueue(), i(null, e);
  394. break;
  395. case "unsuback":
  396. delete this.outgoing[t], this.messageIdProvider.deallocate(t), this._invokeStoreProcessingQueue(), i(null);
  397. break;
  398. default:
  399. o.emit("error", new Error("unrecognized packet type"))
  400. }
  401. this.disconnecting && 0 === Object.keys(this.outgoing).length && this.emit("outgoingEmpty")
  402. } else y("_handleAck :: Server sent an ack in error. Ignoring.")
  403. }, T.prototype._handlePubrel = function (e, t) {
  404. y("handling pubrel packet"), t = void 0 !== t ? t : C;
  405. const r = this,
  406. n = { cmd: "pubcomp", messageId: e.messageId };
  407. r.incomingStore.get(e, function (e, i) {
  408. e ? r._sendPacket(n, t) : (r.emit("message", i.topic, i.payload, i), r.handleMessage(i, function (e) {
  409. if (e) return t(e);
  410. r.incomingStore.del(i, C), r._sendPacket(n, t)
  411. }))
  412. })
  413. }, T.prototype._handleDisconnect = function (e) { this.emit("disconnect", e) }, T.prototype._nextId = function () { return this.messageIdProvider.allocate() }, T.prototype.getLastMessageId = function () { return this.messageIdProvider.getLastAllocated() }, T.prototype._resubscribe = function () {
  414. y("_resubscribe");
  415. const e = Object.keys(this._resubscribeTopics);
  416. if (!this._firstConnection && (this.options.clean || 5 === this.options.protocolVersion && !this.connackPacket.sessionPresent) && e.length > 0)
  417. if (this.options.resubscribe)
  418. if (5 === this.options.protocolVersion) {
  419. y("_resubscribe: protocolVersion 5");
  420. for (let t = 0; t < e.length; t++) {
  421. const r = {};
  422. r[e[t]] = this._resubscribeTopics[e[t]], r.resubscribe = !0, this.subscribe(r, { properties: r[e[t]].properties })
  423. }
  424. } else this._resubscribeTopics.resubscribe = !0, this.subscribe(this._resubscribeTopics);
  425. else this._resubscribeTopics = {};
  426. this._firstConnection = !1
  427. }, T.prototype._onConnect = function (e) {
  428. if (this.disconnected) return void this.emit("connect", e);
  429. const t = this;
  430. this.connackPacket = e, this.messageIdProvider.clear(), this._setupPingTimer(), this.connected = !0,
  431. function r() {
  432. let n = t.outgoingStore.createStream();
  433. function i() { t._storeProcessing = !1, t._packetIdsDuringStoreProcessing = {} }
  434. function o() { n.destroy(), n = null, t._flushStoreProcessingQueue(), i() } t.once("close", o), n.on("error", function (e) { i(), t._flushStoreProcessingQueue(), t.removeListener("close", o), t.emit("error", e) }), n.on("end", function () {
  435. let n = !0;
  436. for (const e in t._packetIdsDuringStoreProcessing)
  437. if (!t._packetIdsDuringStoreProcessing[e]) { n = !1; break } n ? (i(), t.removeListener("close", o), t._invokeAllStoreProcessingQueue(), t.emit("connect", e)) : r()
  438. }),
  439. function e() {
  440. if (!n) return;
  441. t._storeProcessing = !0;
  442. const r = n.read(1);
  443. let i;
  444. r ? t._packetIdsDuringStoreProcessing[r.messageId] ? e() : t.disconnecting || t.reconnectTimer ? n.destroy && n.destroy() : (i = t.outgoing[r.messageId] ? t.outgoing[r.messageId].cb : null, t.outgoing[r.messageId] = { volatile: !1, cb: function (t, r) { i && i(t, r), e() } }, t._packetIdsDuringStoreProcessing[r.messageId] = !0, t.messageIdProvider.register(r.messageId) ? t._sendPacket(r) : y("messageId: %d has already used.", r.messageId)) : n.once("readable", e)
  445. }()
  446. }()
  447. }, T.prototype._invokeStoreProcessingQueue = function () { if (this._storeProcessingQueue.length > 0) { const e = this._storeProcessingQueue[0]; if (e && e.invoke()) return this._storeProcessingQueue.shift(), !0 } return !1 }, T.prototype._invokeAllStoreProcessingQueue = function () { for (; this._invokeStoreProcessingQueue();); }, T.prototype._flushStoreProcessingQueue = function () {
  448. for (const e of this._storeProcessingQueue) e.cbStorePut && e.cbStorePut(new Error("Connection closed")), e.callback && e.callback(new Error("Connection closed"));
  449. this._storeProcessingQueue.splice(0)
  450. }, t.exports = T
  451. }).call(this)
  452. }).call(this, e("_process"), "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
  453. }, { "./default-message-id-provider": 7, "./store": 8, "./topic-alias-recv": 9, "./topic-alias-send": 10, "./validations": 11, _process: 50, debug: 18, events: 22, inherits: 24, "mqtt-packet": 40, "readable-stream": 69, reinterval: 70, "rfdc/default": 71, xtend: 81 }],
  454. 2: [function (e, t, r) {
  455. "use strict";
  456. const { Buffer: n } = e("buffer"), i = e("readable-stream").Transform, o = e("duplexify");
  457. let s, a, l, u = !1;
  458. t.exports = function (e, t) {
  459. if (t.hostname = t.hostname || t.host, !t.hostname) throw new Error("Could not determine host. Specify host manually.");
  460. const r = "MQIsdp" === t.protocolId && 3 === t.protocolVersion ? "mqttv3.1" : "mqtt";
  461. ! function (e) { e.hostname || (e.hostname = "localhost"), e.path || (e.path = "/"), e.wsOptions || (e.wsOptions = {}) }(t);
  462. const c = function (e, t) { const r = "alis" === e.protocol ? "wss" : "ws"; let n = r + "://" + e.hostname + e.path; return e.port && 80 !== e.port && 443 !== e.port && (n = r + "://" + e.hostname + ":" + e.port + e.path), "function" == typeof e.transformWsUrl && (n = e.transformWsUrl(n, e, t)), n }(t, e);
  463. return (s = t.my).connectSocket({ url: c, protocols: r }), a = function () { const e = new i; return e._write = function (e, t, r) { s.sendSocketMessage({ data: e.buffer, success: function () { r() }, fail: function () { r(new Error) } }) }, e._flush = function (e) { s.closeSocket({ success: function () { e() } }) }, e }(), l = o.obj(), u || (u = !0, s.onSocketOpen(function () { l.setReadable(a), l.setWritable(a), l.emit("connect") }), s.onSocketMessage(function (e) {
  464. if ("string" == typeof e.data) {
  465. const t = n.from(e.data, "base64");
  466. a.push(t)
  467. } else {
  468. const t = new FileReader;
  469. t.addEventListener("load", function () {
  470. let e = t.result;
  471. e = e instanceof ArrayBuffer ? n.from(e) : n.from(e, "utf8"), a.push(e)
  472. }), t.readAsArrayBuffer(e.data)
  473. }
  474. }), s.onSocketClose(function () { l.end(), l.destroy() }), s.onSocketError(function (e) { l.destroy(e) })), l
  475. }
  476. }, { buffer: 17, duplexify: 20, "readable-stream": 69 }],
  477. 3: [function (e, t, r) {
  478. "use strict";
  479. const n = e("net"),
  480. i = e("debug")("mqttjs:tcp");
  481. t.exports = function (e, t) {
  482. t.port = t.port || 1883, t.hostname = t.hostname || t.host || "localhost";
  483. const r = t.port,
  484. o = t.hostname;
  485. return i("port %d and host %s", r, o), n.createConnection(r, o)
  486. }
  487. }, { debug: 18, net: 16 }],
  488. 4: [function (e, t, r) {
  489. "use strict";
  490. const n = e("tls"),
  491. i = e("net"),
  492. o = e("debug")("mqttjs:tls");
  493. t.exports = function (e, t) {
  494. t.port = t.port || 8883, t.host = t.hostname || t.host || "localhost", 0 === i.isIP(t.host) && (t.servername = t.host), t.rejectUnauthorized = !1 !== t.rejectUnauthorized, delete t.path, o("port %d host %s rejectUnauthorized %b", t.port, t.host, t.rejectUnauthorized);
  495. const r = n.connect(t);
  496. function s(n) { t.rejectUnauthorized && e.emit("error", n), r.end() }
  497. return r.on("secureConnect", function () { t.rejectUnauthorized && !r.authorized ? r.emit("error", new Error("TLS not authorized")) : r.removeListener("error", s) }), r.on("error", s), r
  498. }
  499. }, { debug: 18, net: 16, tls: 16 }],
  500. 5: [function (e, t, r) {
  501. (function (r) {
  502. (function () {
  503. "use strict";
  504. const { Buffer: n } = e("buffer"), i = e("ws"), o = e("debug")("mqttjs:ws"), s = e("duplexify"), a = e("readable-stream").Transform, l = ["rejectUnauthorized", "ca", "cert", "key", "pfx", "passphrase"], u = void 0 !== r && "browser" === r.title || "function" == typeof __webpack_require__;
  505. function c(e, t) { let r = e.protocol + "://" + e.hostname + ":" + e.port + e.path; return "function" == typeof e.transformWsUrl && (r = e.transformWsUrl(r, e, t)), r }
  506. function h(e) { const t = e; return e.hostname || (t.hostname = "localhost"), e.port || ("wss" === e.protocol ? t.port = 443 : t.port = 80), e.path || (t.path = "/"), e.wsOptions || (t.wsOptions = {}), u || "wss" !== e.protocol || l.forEach(function (r) { Object.prototype.hasOwnProperty.call(e, r) && !Object.prototype.hasOwnProperty.call(e.wsOptions, r) && (t.wsOptions[r] = e[r]) }), t } t.exports = u ? function (e, t) {
  507. let r;
  508. o("browserStreamBuilder");
  509. const i = function (e) {
  510. const t = h(e);
  511. if (t.hostname || (t.hostname = t.host), !t.hostname) {
  512. if ("undefined" == typeof document) throw new Error("Could not determine host. Specify host manually.");
  513. const e = new URL(document.URL);
  514. t.hostname = e.hostname, t.port || (t.port = e.port)
  515. }
  516. return void 0 === t.objectMode && (t.objectMode = !(!0 === t.binary || void 0 === t.binary)), t
  517. }(t).browserBufferSize || 524288,
  518. l = t.browserBufferTimeout || 1e3,
  519. u = !t.objectMode,
  520. f = function (e, t) {
  521. const r = "MQIsdp" === t.protocolId && 3 === t.protocolVersion ? "mqttv3.1" : "mqtt",
  522. n = c(t, e),
  523. i = new WebSocket(n);
  524. return i.binaryType = "arraybuffer", i
  525. }(e, t),
  526. p = function (e, t, r) { const n = new a({ objectModeMode: e.objectMode }); return n._write = t, n._flush = r, n }(t, function e(t, r, o) { f.bufferedAmount > i && setTimeout(e, l, t, r, o), u && "string" == typeof t && (t = n.from(t, "utf8")); try { f.send(t) } catch (e) { return o(e) } o() }, function (e) { f.close(), e() });
  527. t.objectMode || (p._writev = v), p.on("close", () => { f.close() });
  528. const d = void 0 !== f.addEventListener;
  529. function g() { r.setReadable(p), r.setWritable(p), r.emit("connect") }
  530. function y() { r.end(), r.destroy() }
  531. function b(e) { r.destroy(e) }
  532. function m(e) {
  533. let t = e.data;
  534. t = t instanceof ArrayBuffer ? n.from(t) : n.from(t, "utf8"), p.push(t)
  535. }
  536. function v(e, t) {
  537. const r = new Array(e.length);
  538. for (let t = 0; t < e.length; t++) "string" == typeof e[t].chunk ? r[t] = n.from(e[t], "utf8") : r[t] = e[t].chunk;
  539. this._write(n.concat(r), "binary", t)
  540. }
  541. return f.readyState === f.OPEN ? r = p : (r = r = s(void 0, void 0, t), t.objectMode || (r._writev = v), d ? f.addEventListener("open", g) : f.onopen = g), r.socket = f, d ? (f.addEventListener("close", y), f.addEventListener("error", b), f.addEventListener("message", m)) : (f.onclose = y, f.onerror = b, f.onmessage = m), r
  542. } : function (e, t) {
  543. o("streamBuilder");
  544. const r = h(t),
  545. n = c(r, e),
  546. s = function (e, t, r) { o("createWebSocket"), o("protocol: " + r.protocolId + " " + r.protocolVersion); const n = "MQIsdp" === r.protocolId && 3 === r.protocolVersion ? "mqttv3.1" : "mqtt"; return o("creating new Websocket for url: " + t + " and protocol: " + n), new i(t, [n], r.wsOptions) }(0, n, r),
  547. a = i.createWebSocketStream(s, r.wsOptions);
  548. return a.url = n, s.on("close", () => { a.destroy() }), a
  549. }
  550. }).call(this)
  551. }).call(this, e("_process"))
  552. }, { _process: 50, buffer: 17, debug: 18, duplexify: 20, "readable-stream": 69, ws: 80 }],
  553. 6: [function (e, t, r) {
  554. "use strict";
  555. const { Buffer: n } = e("buffer"), i = e("readable-stream").Transform, o = e("duplexify");
  556. let s, a, l;
  557. t.exports = function (e, t) {
  558. if (t.hostname = t.hostname || t.host, !t.hostname) throw new Error("Could not determine host. Specify host manually.");
  559. const r = "MQIsdp" === t.protocolId && 3 === t.protocolVersion ? "mqttv3.1" : "mqtt";
  560. ! function (e) { e.hostname || (e.hostname = "localhost"), e.path || (e.path = "/"), e.wsOptions || (e.wsOptions = {}) }(t);
  561. const u = function (e, t) { const r = "wxs" === e.protocol ? "wss" : "ws"; let n = r + "://" + e.hostname + e.path; return e.port && 80 !== e.port && 443 !== e.port && (n = r + "://" + e.hostname + ":" + e.port + e.path), "function" == typeof e.transformWsUrl && (n = e.transformWsUrl(n, e, t)), n }(t, e);
  562. s = wx.connectSocket({ url: u, protocols: [r] }), a = function () { const e = new i; return e._write = function (e, t, r) { s.send({ data: e.buffer, success: function () { r() }, fail: function (e) { r(new Error(e)) } }) }, e._flush = function (e) { s.close({ success: function () { e() } }) }, e }(), (l = o.obj())._destroy = function (e, t) { s.close({ success: function () { t && t(e) } }) };
  563. const c = l.destroy;
  564. return l.destroy = function () {
  565. l.destroy = c;
  566. const e = this;
  567. setTimeout(function () { s.close({ fail: function () { e._destroy(new Error) } }) }, 0)
  568. }.bind(l), s.onOpen(function () { l.setReadable(a), l.setWritable(a), l.emit("connect") }), s.onMessage(function (e) {
  569. let t = e.data;
  570. t = t instanceof ArrayBuffer ? n.from(t) : n.from(t, "utf8"), a.push(t)
  571. }), s.onClose(function () { l.end(), l.destroy() }), s.onError(function (e) { l.destroy(new Error(e.errMsg)) }), l
  572. }
  573. }, { buffer: 17, duplexify: 20, "readable-stream": 69 }],
  574. 7: [function (e, t, r) {
  575. "use strict";
  576. function n() {
  577. if (!(this instanceof n)) return new n;
  578. this.nextId = Math.max(1, Math.floor(65535 * Math.random()))
  579. }
  580. n.prototype.allocate = function () { const e = this.nextId++; return 65536 === this.nextId && (this.nextId = 1), e }, n.prototype.getLastAllocated = function () { return 1 === this.nextId ? 65535 : this.nextId - 1 }, n.prototype.register = function (e) { return !0 }, n.prototype.deallocate = function (e) {}, n.prototype.clear = function () {}, t.exports = n
  581. }, {}],
  582. 8: [function (e, t, r) {
  583. "use strict";
  584. const n = e("xtend"),
  585. i = e("readable-stream").Readable,
  586. o = { objectMode: !0 },
  587. s = { clean: !0 };
  588. function a(e) {
  589. if (!(this instanceof a)) return new a(e);
  590. this.options = e || {}, this.options = n(s, e), this._inflights = new Map
  591. }
  592. a.prototype.put = function (e, t) { return this._inflights.set(e.messageId, e), t && t(), this }, a.prototype.createStream = function () {
  593. const e = new i(o),
  594. t = [];
  595. let r = !1,
  596. n = 0;
  597. return this._inflights.forEach(function (e, r) { t.push(e) }), e._read = function () {!r && n < t.length ? this.push(t[n++]) : this.push(null) }, e.destroy = function () {
  598. if (r) return;
  599. const e = this;
  600. r = !0, setTimeout(function () { e.emit("close") }, 0)
  601. }, e
  602. }, a.prototype.del = function (e, t) { return (e = this._inflights.get(e.messageId)) ? (this._inflights.delete(e.messageId), t(null, e)) : t && t(new Error("missing packet")), this }, a.prototype.get = function (e, t) { return (e = this._inflights.get(e.messageId)) ? t(null, e) : t && t(new Error("missing packet")), this }, a.prototype.close = function (e) { this.options.clean && (this._inflights = null), e && e() }, t.exports = a
  603. }, { "readable-stream": 69, xtend: 81 }],
  604. 9: [function (e, t, r) {
  605. "use strict";
  606. function n(e) {
  607. if (!(this instanceof n)) return new n(e);
  608. this.aliasToTopic = {}, this.max = e
  609. }
  610. n.prototype.put = function (e, t) { return !(0 === t || t > this.max) && (this.aliasToTopic[t] = e, this.length = Object.keys(this.aliasToTopic).length, !0) }, n.prototype.getTopicByAlias = function (e) { return this.aliasToTopic[e] }, n.prototype.clear = function () { this.aliasToTopic = {} }, t.exports = n
  611. }, {}],
  612. 10: [function (e, t, r) {
  613. "use strict";
  614. const n = e("lru-cache"),
  615. i = e("number-allocator").NumberAllocator;
  616. function o(e) {
  617. if (!(this instanceof o)) return new o(e);
  618. e > 0 && (this.aliasToTopic = new n({ max: e }), this.topicToAlias = {}, this.numberAllocator = new i(1, e), this.max = e, this.length = 0)
  619. }
  620. o.prototype.put = function (e, t) { if (0 === t || t > this.max) return !1; const r = this.aliasToTopic.get(t); return r && delete this.topicToAlias[r], this.aliasToTopic.set(t, e), this.topicToAlias[e] = t, this.numberAllocator.use(t), this.length = this.aliasToTopic.length, !0 }, o.prototype.getTopicByAlias = function (e) { return this.aliasToTopic.get(e) }, o.prototype.getAliasByTopic = function (e) { const t = this.topicToAlias[e]; return void 0 !== t && this.aliasToTopic.get(t), t }, o.prototype.clear = function () { this.aliasToTopic.reset(), this.topicToAlias = {}, this.numberAllocator.clear(), this.length = 0 }, o.prototype.getLruAlias = function () { const e = this.numberAllocator.firstVacant(); return e || this.aliasToTopic.keys()[this.aliasToTopic.length - 1] }, t.exports = o
  621. }, { "lru-cache": 37, "number-allocator": 46 }],
  622. 11: [function (e, t, r) {
  623. "use strict";
  624. function n(e) {
  625. const t = e.split("/");
  626. for (let e = 0; e < t.length; e++)
  627. if ("+" !== t[e]) { if ("#" === t[e]) return e === t.length - 1; if (-1 !== t[e].indexOf("+") || -1 !== t[e].indexOf("#")) return !1 } return !0
  628. }
  629. t.exports = {
  630. validateTopics: function (e) {
  631. if (0 === e.length) return "empty_topic_list";
  632. for (let t = 0; t < e.length; t++)
  633. if (!n(e[t])) return e[t];
  634. return null
  635. }
  636. }
  637. }, {}],
  638. 12: [function (e, t, r) {
  639. (function (r) {
  640. (function () {
  641. "use strict";
  642. const n = e("../client"),
  643. i = e("../store"),
  644. o = e("url"),
  645. s = e("xtend"),
  646. a = e("debug")("mqttjs"),
  647. l = {};
  648. function u(e, t) {
  649. if (a("connecting to an MQTT broker..."), "object" != typeof e || t || (t = e, e = null), t = t || {}, e) {
  650. const r = o.parse(e, !0);
  651. if (null != r.port && (r.port = Number(r.port)), null === (t = s(r, t)).protocol) throw new Error("Missing protocol");
  652. t.protocol = t.protocol.replace(/:$/, "")
  653. }
  654. if (function (e) {
  655. let t;
  656. e.auth && ((t = e.auth.match(/^(.+):(.+)$/)) ? (e.username = t[1], e.password = t[2]) : e.username = e.auth)
  657. }(t), t.query && "string" == typeof t.query.clientId && (t.clientId = t.query.clientId), t.cert && t.key) {
  658. if (!t.protocol) throw new Error("Missing secure protocol key");
  659. if (-1 === ["mqtts", "wss", "wxs", "alis"].indexOf(t.protocol)) switch (t.protocol) {
  660. case "mqtt":
  661. t.protocol = "mqtts";
  662. break;
  663. case "ws":
  664. t.protocol = "wss";
  665. break;
  666. case "wx":
  667. t.protocol = "wxs";
  668. break;
  669. case "ali":
  670. t.protocol = "alis";
  671. break;
  672. default:
  673. throw new Error('Unknown protocol for secure connection: "' + t.protocol + '"!')
  674. }
  675. }
  676. if (!l[t.protocol]) {
  677. const e = -1 !== ["mqtts", "wss"].indexOf(t.protocol);
  678. t.protocol = ["mqtt", "mqtts", "ws", "wss", "wx", "wxs", "ali", "alis"].filter(function (t, r) { return (!e || r % 2 != 0) && "function" == typeof l[t] })[0]
  679. }
  680. if (!1 === t.clean && !t.clientId) throw new Error("Missing clientId for unclean clients");
  681. t.protocol && (t.defaultProtocol = t.protocol);
  682. const r = new n(function (e) { return t.servers && (e._reconnectCount && e._reconnectCount !== t.servers.length || (e._reconnectCount = 0), t.host = t.servers[e._reconnectCount].host, t.port = t.servers[e._reconnectCount].port, t.protocol = t.servers[e._reconnectCount].protocol ? t.servers[e._reconnectCount].protocol : t.defaultProtocol, t.hostname = t.host, e._reconnectCount++), a("calling streambuilder for", t.protocol), l[t.protocol](e, t) }, t);
  683. return r.on("error", function () {}), r
  684. }
  685. void 0 !== r && "browser" !== r.title || "function" != typeof __webpack_require__ ? (l.mqtt = e("./tcp"), l.tcp = e("./tcp"), l.ssl = e("./tls"), l.tls = e("./tls"), l.mqtts = e("./tls")) : (l.wx = e("./wx"), l.wxs = e("./wx"), l.ali = e("./ali"), l.alis = e("./ali")), l.ws = e("./ws"), l.wss = e("./ws"), t.exports = u, t.exports.connect = u, t.exports.MqttClient = n, t.exports.Store = i
  686. }).call(this)
  687. }).call(this, e("_process"))
  688. }, { "../client": 1, "../store": 8, "./ali": 2, "./tcp": 3, "./tls": 4, "./ws": 5, "./wx": 6, _process: 50, debug: 18, url: 76, xtend: 81 }],
  689. 13: [function (e, t, r) {
  690. "use strict";
  691. r.byteLength = function (e) {
  692. var t = u(e),
  693. r = t[0],
  694. n = t[1];
  695. return 3 * (r + n) / 4 - n
  696. }, r.toByteArray = function (e) {
  697. var t, r, n = u(e),
  698. s = n[0],
  699. a = n[1],
  700. l = new o(function (e, t, r) { return 3 * (t + r) / 4 - r }(0, s, a)),
  701. c = 0,
  702. h = a > 0 ? s - 4 : s;
  703. for (r = 0; r < h; r += 4) t = i[e.charCodeAt(r)] << 18 | i[e.charCodeAt(r + 1)] << 12 | i[e.charCodeAt(r + 2)] << 6 | i[e.charCodeAt(r + 3)], l[c++] = t >> 16 & 255, l[c++] = t >> 8 & 255, l[c++] = 255 & t;
  704. 2 === a && (t = i[e.charCodeAt(r)] << 2 | i[e.charCodeAt(r + 1)] >> 4, l[c++] = 255 & t);
  705. 1 === a && (t = i[e.charCodeAt(r)] << 10 | i[e.charCodeAt(r + 1)] << 4 | i[e.charCodeAt(r + 2)] >> 2, l[c++] = t >> 8 & 255, l[c++] = 255 & t);
  706. return l
  707. }, r.fromByteArray = function (e) {
  708. for (var t, r = e.length, i = r % 3, o = [], s = 0, a = r - i; s < a; s += 16383) o.push(c(e, s, s + 16383 > a ? a : s + 16383));
  709. 1 === i ? (t = e[r - 1], o.push(n[t >> 2] + n[t << 4 & 63] + "==")) : 2 === i && (t = (e[r - 2] << 8) + e[r - 1], o.push(n[t >> 10] + n[t >> 4 & 63] + n[t << 2 & 63] + "="));
  710. return o.join("")
  711. };
  712. for (var n = [], i = [], o = "undefined" != typeof Uint8Array ? Uint8Array : Array, s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", a = 0, l = s.length; a < l; ++a) n[a] = s[a], i[s.charCodeAt(a)] = a;
  713. function u(e) { var t = e.length; if (t % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4"); var r = e.indexOf("="); return -1 === r && (r = t), [r, r === t ? 0 : 4 - r % 4] }
  714. function c(e, t, r) { for (var i, o, s = [], a = t; a < r; a += 3) i = (e[a] << 16 & 16711680) + (e[a + 1] << 8 & 65280) + (255 & e[a + 2]), s.push(n[(o = i) >> 18 & 63] + n[o >> 12 & 63] + n[o >> 6 & 63] + n[63 & o]); return s.join("") } i["-".charCodeAt(0)] = 62, i["_".charCodeAt(0)] = 63
  715. }, {}],
  716. 14: [function (e, t, r) {
  717. "use strict";
  718. const { Buffer: n } = e("buffer"), i = Symbol.for("BufferList");
  719. function o(e) {
  720. if (!(this instanceof o)) return new o(e);
  721. o._init.call(this, e)
  722. }
  723. o._init = function (e) { Object.defineProperty(this, i, { value: !0 }), this._bufs = [], this.length = 0, e && this.append(e) }, o.prototype._new = function (e) { return new o(e) }, o.prototype._offset = function (e) {
  724. if (0 === e) return [0, 0];
  725. let t = 0;
  726. for (let r = 0; r < this._bufs.length; r++) {
  727. const n = t + this._bufs[r].length;
  728. if (e < n || r === this._bufs.length - 1) return [r, e - t];
  729. t = n
  730. }
  731. }, o.prototype._reverseOffset = function (e) { const t = e[0]; let r = e[1]; for (let e = 0; e < t; e++) r += this._bufs[e].length; return r }, o.prototype.get = function (e) { if (e > this.length || e < 0) return; const t = this._offset(e); return this._bufs[t[0]][t[1]] }, o.prototype.slice = function (e, t) { return "number" == typeof e && e < 0 && (e += this.length), "number" == typeof t && t < 0 && (t += this.length), this.copy(null, 0, e, t) }, o.prototype.copy = function (e, t, r, i) {
  732. if (("number" != typeof r || r < 0) && (r = 0), ("number" != typeof i || i > this.length) && (i = this.length), r >= this.length) return e || n.alloc(0);
  733. if (i <= 0) return e || n.alloc(0);
  734. const o = !!e,
  735. s = this._offset(r),
  736. a = i - r;
  737. let l = a,
  738. u = o && t || 0,
  739. c = s[1];
  740. if (0 === r && i === this.length) { if (!o) return 1 === this._bufs.length ? this._bufs[0] : n.concat(this._bufs, this.length); for (let t = 0; t < this._bufs.length; t++) this._bufs[t].copy(e, u), u += this._bufs[t].length; return e }
  741. if (l <= this._bufs[s[0]].length - c) return o ? this._bufs[s[0]].copy(e, t, c, c + l) : this._bufs[s[0]].slice(c, c + l);
  742. o || (e = n.allocUnsafe(a));
  743. for (let t = s[0]; t < this._bufs.length; t++) { const r = this._bufs[t].length - c; if (!(l > r)) { this._bufs[t].copy(e, u, c, c + l), u += r; break } this._bufs[t].copy(e, u, c), u += r, l -= r, c && (c = 0) }
  744. return e.length > u ? e.slice(0, u) : e
  745. }, o.prototype.shallowSlice = function (e, t) {
  746. if (e = e || 0, t = "number" != typeof t ? this.length : t, e < 0 && (e += this.length), t < 0 && (t += this.length), e === t) return this._new();
  747. const r = this._offset(e),
  748. n = this._offset(t),
  749. i = this._bufs.slice(r[0], n[0] + 1);
  750. return 0 === n[1] ? i.pop() : i[i.length - 1] = i[i.length - 1].slice(0, n[1]), 0 !== r[1] && (i[0] = i[0].slice(r[1])), this._new(i)
  751. }, o.prototype.toString = function (e, t, r) { return this.slice(t, r).toString(e) }, o.prototype.consume = function (e) { if (e = Math.trunc(e), Number.isNaN(e) || e <= 0) return this; for (; this._bufs.length;) { if (!(e >= this._bufs[0].length)) { this._bufs[0] = this._bufs[0].slice(e), this.length -= e; break } e -= this._bufs[0].length, this.length -= this._bufs[0].length, this._bufs.shift() } return this }, o.prototype.duplicate = function () { const e = this._new(); for (let t = 0; t < this._bufs.length; t++) e.append(this._bufs[t]); return e }, o.prototype.append = function (e) {
  752. if (null == e) return this;
  753. if (e.buffer) this._appendBuffer(n.from(e.buffer, e.byteOffset, e.byteLength));
  754. else if (Array.isArray(e))
  755. for (let t = 0; t < e.length; t++) this.append(e[t]);
  756. else if (this._isBufferList(e))
  757. for (let t = 0; t < e._bufs.length; t++) this.append(e._bufs[t]);
  758. else "number" == typeof e && (e = e.toString()), this._appendBuffer(n.from(e));
  759. return this
  760. }, o.prototype._appendBuffer = function (e) { this._bufs.push(e), this.length += e.length }, o.prototype.indexOf = function (e, t, r) {
  761. if (void 0 === r && "string" == typeof t && (r = t, t = void 0), "function" == typeof e || Array.isArray(e)) throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');
  762. if ("number" == typeof e ? e = n.from([e]) : "string" == typeof e ? e = n.from(e, r) : this._isBufferList(e) ? e = e.slice() : Array.isArray(e.buffer) ? e = n.from(e.buffer, e.byteOffset, e.byteLength) : n.isBuffer(e) || (e = n.from(e)), t = Number(t || 0), isNaN(t) && (t = 0), t < 0 && (t = this.length + t), t < 0 && (t = 0), 0 === e.length) return t > this.length ? this.length : t;
  763. const i = this._offset(t);
  764. let o = i[0],
  765. s = i[1];
  766. for (; o < this._bufs.length; o++) {
  767. const t = this._bufs[o];
  768. for (; s < t.length;) {
  769. if (t.length - s >= e.length) {
  770. const r = t.indexOf(e, s);
  771. if (-1 !== r) return this._reverseOffset([o, r]);
  772. s = t.length - e.length + 1
  773. } else {
  774. const t = this._reverseOffset([o, s]);
  775. if (this._match(t, e)) return t;
  776. s++
  777. }
  778. }
  779. s = 0
  780. }
  781. return -1
  782. }, o.prototype._match = function (e, t) {
  783. if (this.length - e < t.length) return !1;
  784. for (let r = 0; r < t.length; r++)
  785. if (this.get(e + r) !== t[r]) return !1;
  786. return !0
  787. },
  788. function () { const e = { readDoubleBE: 8, readDoubleLE: 8, readFloatBE: 4, readFloatLE: 4, readInt32BE: 4, readInt32LE: 4, readUInt32BE: 4, readUInt32LE: 4, readInt16BE: 2, readInt16LE: 2, readUInt16BE: 2, readUInt16LE: 2, readInt8: 1, readUInt8: 1, readIntBE: null, readIntLE: null, readUIntBE: null, readUIntLE: null }; for (const t in e) ! function (t) { o.prototype[t] = null === e[t] ? function (e, r) { return this.slice(e, e + r)[t](0, r) } : function (r = 0) { return this.slice(r, r + e[t])[t](0) } }(t) }(), o.prototype._isBufferList = function (e) { return e instanceof o || o.isBufferList(e) }, o.isBufferList = function (e) { return null != e && e[i] }, t.exports = o
  789. }, { buffer: 17 }],
  790. 15: [function (e, t, r) {
  791. "use strict";
  792. const n = e("readable-stream").Duplex,
  793. i = e("inherits"),
  794. o = e("./BufferList");
  795. function s(e) {
  796. if (!(this instanceof s)) return new s(e);
  797. if ("function" == typeof e) {
  798. this._callback = e;
  799. const t = function (e) { this._callback && (this._callback(e), this._callback = null) }.bind(this);
  800. this.on("pipe", function (e) { e.on("error", t) }), this.on("unpipe", function (e) { e.removeListener("error", t) }), e = null
  801. }
  802. o._init.call(this, e), n.call(this)
  803. }
  804. i(s, n), Object.assign(s.prototype, o.prototype), s.prototype._new = function (e) { return new s(e) }, s.prototype._write = function (e, t, r) { this._appendBuffer(e), "function" == typeof r && r() }, s.prototype._read = function (e) {
  805. if (!this.length) return this.push(null);
  806. e = Math.min(e, this.length), this.push(this.slice(0, e)), this.consume(e)
  807. }, s.prototype.end = function (e) { n.prototype.end.call(this, e), this._callback && (this._callback(null, this.slice()), this._callback = null) }, s.prototype._destroy = function (e, t) { this._bufs.length = 0, this.length = 0, t(e) }, s.prototype._isBufferList = function (e) { return e instanceof s || e instanceof o || s.isBufferList(e) }, s.isBufferList = o.isBufferList, t.exports = s, t.exports.BufferListStream = s, t.exports.BufferList = o
  808. }, { "./BufferList": 14, inherits: 24, "readable-stream": 69 }],
  809. 16: [function (e, t, r) {}, {}],
  810. 17: [function (e, t, r) {
  811. (function (t) {
  812. (function () {
  813. "use strict";
  814. var t = e("base64-js"),
  815. n = e("ieee754");
  816. r.Buffer = s, r.SlowBuffer = function (e) {+e != e && (e = 0); return s.alloc(+e) }, r.INSPECT_MAX_BYTES = 50;
  817. var i = 2147483647;
  818. function o(e) { if (e > i) throw new RangeError('The value "' + e + '" is invalid for option "size"'); var t = new Uint8Array(e); return t.__proto__ = s.prototype, t }
  819. function s(e, t, r) { if ("number" == typeof e) { if ("string" == typeof t) throw new TypeError('The "string" argument must be of type string. Received type number'); return u(e) } return a(e, t, r) }
  820. function a(e, t, r) {
  821. if ("string" == typeof e) return function (e, t) {
  822. "string" == typeof t && "" !== t || (t = "utf8");
  823. if (!s.isEncoding(t)) throw new TypeError("Unknown encoding: " + t);
  824. var r = 0 | f(e, t),
  825. n = o(r),
  826. i = n.write(e, t);
  827. i !== r && (n = n.slice(0, i));
  828. return n
  829. }(e, t);
  830. if (ArrayBuffer.isView(e)) return c(e);
  831. if (null == e) throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e);
  832. if (q(e, ArrayBuffer) || e && q(e.buffer, ArrayBuffer)) return function (e, t, r) {
  833. if (t < 0 || e.byteLength < t) throw new RangeError('"offset" is outside of buffer bounds');
  834. if (e.byteLength < t + (r || 0)) throw new RangeError('"length" is outside of buffer bounds');
  835. var n;
  836. n = void 0 === t && void 0 === r ? new Uint8Array(e) : void 0 === r ? new Uint8Array(e, t) : new Uint8Array(e, t, r);
  837. return n.__proto__ = s.prototype, n
  838. }(e, t, r);
  839. if ("number" == typeof e) throw new TypeError('The "value" argument must not be of type number. Received type number');
  840. var n = e.valueOf && e.valueOf();
  841. if (null != n && n !== e) return s.from(n, t, r);
  842. var i = function (e) {
  843. if (s.isBuffer(e)) {
  844. var t = 0 | h(e.length),
  845. r = o(t);
  846. return 0 === r.length ? r : (e.copy(r, 0, 0, t), r)
  847. }
  848. if (void 0 !== e.length) return "number" != typeof e.length || D(e.length) ? o(0) : c(e);
  849. if ("Buffer" === e.type && Array.isArray(e.data)) return c(e.data)
  850. }(e);
  851. if (i) return i;
  852. if ("undefined" != typeof Symbol && null != Symbol.toPrimitive && "function" == typeof e[Symbol.toPrimitive]) return s.from(e[Symbol.toPrimitive]("string"), t, r);
  853. throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e)
  854. }
  855. function l(e) { if ("number" != typeof e) throw new TypeError('"size" argument must be of type number'); if (e < 0) throw new RangeError('The value "' + e + '" is invalid for option "size"') }
  856. function u(e) { return l(e), o(e < 0 ? 0 : 0 | h(e)) }
  857. function c(e) { for (var t = e.length < 0 ? 0 : 0 | h(e.length), r = o(t), n = 0; n < t; n += 1) r[n] = 255 & e[n]; return r }
  858. function h(e) { if (e >= i) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + i.toString(16) + " bytes"); return 0 | e }
  859. function f(e, t) {
  860. if (s.isBuffer(e)) return e.length;
  861. if (ArrayBuffer.isView(e) || q(e, ArrayBuffer)) return e.byteLength;
  862. if ("string" != typeof e) throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof e);
  863. var r = e.length,
  864. n = arguments.length > 2 && !0 === arguments[2];
  865. if (!n && 0 === r) return 0;
  866. for (var i = !1;;) switch (t) {
  867. case "ascii":
  868. case "latin1":
  869. case "binary":
  870. return r;
  871. case "utf8":
  872. case "utf-8":
  873. return L(e).length;
  874. case "ucs2":
  875. case "ucs-2":
  876. case "utf16le":
  877. case "utf-16le":
  878. return 2 * r;
  879. case "hex":
  880. return r >>> 1;
  881. case "base64":
  882. return j(e).length;
  883. default:
  884. if (i) return n ? -1 : L(e).length;
  885. t = ("" + t).toLowerCase(), i = !0
  886. }
  887. }
  888. function p(e, t, r) {
  889. var n = e[t];
  890. e[t] = e[r], e[r] = n
  891. }
  892. function d(e, t, r, n, i) {
  893. if (0 === e.length) return -1;
  894. if ("string" == typeof r ? (n = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), D(r = +r) && (r = i ? 0 : e.length - 1), r < 0 && (r = e.length + r), r >= e.length) {
  895. if (i) return -1;
  896. r = e.length - 1
  897. } else if (r < 0) {
  898. if (!i) return -1;
  899. r = 0
  900. }
  901. if ("string" == typeof t && (t = s.from(t, n)), s.isBuffer(t)) return 0 === t.length ? -1 : g(e, t, r, n, i);
  902. if ("number" == typeof t) return t &= 255, "function" == typeof Uint8Array.prototype.indexOf ? i ? Uint8Array.prototype.indexOf.call(e, t, r) : Uint8Array.prototype.lastIndexOf.call(e, t, r) : g(e, [t], r, n, i);
  903. throw new TypeError("val must be string, number or Buffer")
  904. }
  905. function g(e, t, r, n, i) {
  906. var o, s = 1,
  907. a = e.length,
  908. l = t.length;
  909. if (void 0 !== n && ("ucs2" === (n = String(n).toLowerCase()) || "ucs-2" === n || "utf16le" === n || "utf-16le" === n)) {
  910. if (e.length < 2 || t.length < 2) return -1;
  911. s = 2, a /= 2, l /= 2, r /= 2
  912. }
  913. function u(e, t) { return 1 === s ? e[t] : e.readUInt16BE(t * s) }
  914. if (i) {
  915. var c = -1;
  916. for (o = r; o < a; o++)
  917. if (u(e, o) === u(t, -1 === c ? 0 : o - c)) { if (-1 === c && (c = o), o - c + 1 === l) return c * s } else -1 !== c && (o -= o - c), c = -1
  918. } else
  919. for (r + l > a && (r = a - l), o = r; o >= 0; o--) {
  920. for (var h = !0, f = 0; f < l; f++)
  921. if (u(e, o + f) !== u(t, f)) { h = !1; break } if (h) return o
  922. }
  923. return -1
  924. }
  925. function y(e, t, r, n) {
  926. r = Number(r) || 0;
  927. var i = e.length - r;
  928. n ? (n = Number(n)) > i && (n = i) : n = i;
  929. var o = t.length;
  930. n > o / 2 && (n = o / 2);
  931. for (var s = 0; s < n; ++s) {
  932. var a = parseInt(t.substr(2 * s, 2), 16);
  933. if (D(a)) return s;
  934. e[r + s] = a
  935. }
  936. return s
  937. }
  938. function b(e, t, r, n) { return U(L(t, e.length - r), e, r, n) }
  939. function m(e, t, r, n) { return U(function (e) { for (var t = [], r = 0; r < e.length; ++r) t.push(255 & e.charCodeAt(r)); return t }(t), e, r, n) }
  940. function v(e, t, r, n) { return m(e, t, r, n) }
  941. function w(e, t, r, n) { return U(j(t), e, r, n) }
  942. function _(e, t, r, n) { return U(function (e, t) { for (var r, n, i, o = [], s = 0; s < e.length && !((t -= 2) < 0); ++s) r = e.charCodeAt(s), n = r >> 8, i = r % 256, o.push(i), o.push(n); return o }(t, e.length - r), e, r, n) }
  943. function k(e, r, n) { return 0 === r && n === e.length ? t.fromByteArray(e) : t.fromByteArray(e.slice(r, n)) }
  944. function S(e, t, r) {
  945. r = Math.min(e.length, r);
  946. for (var n = [], i = t; i < r;) {
  947. var o, s, a, l, u = e[i],
  948. c = null,
  949. h = u > 239 ? 4 : u > 223 ? 3 : u > 191 ? 2 : 1;
  950. if (i + h <= r) switch (h) {
  951. case 1:
  952. u < 128 && (c = u);
  953. break;
  954. case 2:
  955. 128 == (192 & (o = e[i + 1])) && (l = (31 & u) << 6 | 63 & o) > 127 && (c = l);
  956. break;
  957. case 3:
  958. o = e[i + 1], s = e[i + 2], 128 == (192 & o) && 128 == (192 & s) && (l = (15 & u) << 12 | (63 & o) << 6 | 63 & s) > 2047 && (l < 55296 || l > 57343) && (c = l);
  959. break;
  960. case 4:
  961. o = e[i + 1], s = e[i + 2], a = e[i + 3], 128 == (192 & o) && 128 == (192 & s) && 128 == (192 & a) && (l = (15 & u) << 18 | (63 & o) << 12 | (63 & s) << 6 | 63 & a) > 65535 && l < 1114112 && (c = l)
  962. }
  963. null === c ? (c = 65533, h = 1) : c > 65535 && (c -= 65536, n.push(c >>> 10 & 1023 | 55296), c = 56320 | 1023 & c), n.push(c), i += h
  964. }
  965. return function (e) {
  966. var t = e.length;
  967. if (t <= E) return String.fromCharCode.apply(String, e);
  968. var r = "",
  969. n = 0;
  970. for (; n < t;) r += String.fromCharCode.apply(String, e.slice(n, n += E));
  971. return r
  972. }(n)
  973. }
  974. r.kMaxLength = i, s.TYPED_ARRAY_SUPPORT = function () { try { var e = new Uint8Array(1); return e.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } }, 42 === e.foo() } catch (e) { return !1 } }(), s.TYPED_ARRAY_SUPPORT || "undefined" == typeof console || "function" != typeof console.error || console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."), Object.defineProperty(s.prototype, "parent", { enumerable: !0, get: function () { if (s.isBuffer(this)) return this.buffer } }), Object.defineProperty(s.prototype, "offset", { enumerable: !0, get: function () { if (s.isBuffer(this)) return this.byteOffset } }), "undefined" != typeof Symbol && null != Symbol.species && s[Symbol.species] === s && Object.defineProperty(s, Symbol.species, { value: null, configurable: !0, enumerable: !1, writable: !1 }), s.poolSize = 8192, s.from = function (e, t, r) { return a(e, t, r) }, s.prototype.__proto__ = Uint8Array.prototype, s.__proto__ = Uint8Array, s.alloc = function (e, t, r) { return function (e, t, r) { return l(e), e <= 0 ? o(e) : void 0 !== t ? "string" == typeof r ? o(e).fill(t, r) : o(e).fill(t) : o(e) }(e, t, r) }, s.allocUnsafe = function (e) { return u(e) }, s.allocUnsafeSlow = function (e) { return u(e) }, s.isBuffer = function (e) { return null != e && !0 === e._isBuffer && e !== s.prototype }, s.compare = function (e, t) {
  975. if (q(e, Uint8Array) && (e = s.from(e, e.offset, e.byteLength)), q(t, Uint8Array) && (t = s.from(t, t.offset, t.byteLength)), !s.isBuffer(e) || !s.isBuffer(t)) throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');
  976. if (e === t) return 0;
  977. for (var r = e.length, n = t.length, i = 0, o = Math.min(r, n); i < o; ++i)
  978. if (e[i] !== t[i]) { r = e[i], n = t[i]; break } return r < n ? -1 : n < r ? 1 : 0
  979. }, s.isEncoding = function (e) {
  980. switch (String(e).toLowerCase()) {
  981. case "hex":
  982. case "utf8":
  983. case "utf-8":
  984. case "ascii":
  985. case "latin1":
  986. case "binary":
  987. case "base64":
  988. case "ucs2":
  989. case "ucs-2":
  990. case "utf16le":
  991. case "utf-16le":
  992. return !0;
  993. default:
  994. return !1
  995. }
  996. }, s.concat = function (e, t) {
  997. if (!Array.isArray(e)) throw new TypeError('"list" argument must be an Array of Buffers');
  998. if (0 === e.length) return s.alloc(0);
  999. var r;
  1000. if (void 0 === t)
  1001. for (t = 0, r = 0; r < e.length; ++r) t += e[r].length;
  1002. var n = s.allocUnsafe(t),
  1003. i = 0;
  1004. for (r = 0; r < e.length; ++r) {
  1005. var o = e[r];
  1006. if (q(o, Uint8Array) && (o = s.from(o)), !s.isBuffer(o)) throw new TypeError('"list" argument must be an Array of Buffers');
  1007. o.copy(n, i), i += o.length
  1008. }
  1009. return n
  1010. }, s.byteLength = f, s.prototype._isBuffer = !0, s.prototype.swap16 = function () { var e = this.length; if (e % 2 != 0) throw new RangeError("Buffer size must be a multiple of 16-bits"); for (var t = 0; t < e; t += 2) p(this, t, t + 1); return this }, s.prototype.swap32 = function () { var e = this.length; if (e % 4 != 0) throw new RangeError("Buffer size must be a multiple of 32-bits"); for (var t = 0; t < e; t += 4) p(this, t, t + 3), p(this, t + 1, t + 2); return this }, s.prototype.swap64 = function () { var e = this.length; if (e % 8 != 0) throw new RangeError("Buffer size must be a multiple of 64-bits"); for (var t = 0; t < e; t += 8) p(this, t, t + 7), p(this, t + 1, t + 6), p(this, t + 2, t + 5), p(this, t + 3, t + 4); return this }, s.prototype.toString = function () {
  1011. var e = this.length;
  1012. return 0 === e ? "" : 0 === arguments.length ? S(this, 0, e) : function (e, t, r) {
  1013. var n = !1;
  1014. if ((void 0 === t || t < 0) && (t = 0), t > this.length) return "";
  1015. if ((void 0 === r || r > this.length) && (r = this.length), r <= 0) return "";
  1016. if ((r >>>= 0) <= (t >>>= 0)) return "";
  1017. for (e || (e = "utf8");;) switch (e) {
  1018. case "hex":
  1019. return x(this, t, r);
  1020. case "utf8":
  1021. case "utf-8":
  1022. return S(this, t, r);
  1023. case "ascii":
  1024. return C(this, t, r);
  1025. case "latin1":
  1026. case "binary":
  1027. return T(this, t, r);
  1028. case "base64":
  1029. return k(this, t, r);
  1030. case "ucs2":
  1031. case "ucs-2":
  1032. case "utf16le":
  1033. case "utf-16le":
  1034. return A(this, t, r);
  1035. default:
  1036. if (n) throw new TypeError("Unknown encoding: " + e);
  1037. e = (e + "").toLowerCase(), n = !0
  1038. }
  1039. }.apply(this, arguments)
  1040. }, s.prototype.toLocaleString = s.prototype.toString, s.prototype.equals = function (e) { if (!s.isBuffer(e)) throw new TypeError("Argument must be a Buffer"); return this === e || 0 === s.compare(this, e) }, s.prototype.inspect = function () {
  1041. var e = "",
  1042. t = r.INSPECT_MAX_BYTES;
  1043. return e = this.toString("hex", 0, t).replace(/(.{2})/g, "$1 ").trim(), this.length > t && (e += " ... "), "<Buffer " + e + ">"
  1044. }, s.prototype.compare = function (e, t, r, n, i) {
  1045. if (q(e, Uint8Array) && (e = s.from(e, e.offset, e.byteLength)), !s.isBuffer(e)) throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof e);
  1046. if (void 0 === t && (t = 0), void 0 === r && (r = e ? e.length : 0), void 0 === n && (n = 0), void 0 === i && (i = this.length), t < 0 || r > e.length || n < 0 || i > this.length) throw new RangeError("out of range index");
  1047. if (n >= i && t >= r) return 0;
  1048. if (n >= i) return -1;
  1049. if (t >= r) return 1;
  1050. if (t >>>= 0, r >>>= 0, n >>>= 0, i >>>= 0, this === e) return 0;
  1051. for (var o = i - n, a = r - t, l = Math.min(o, a), u = this.slice(n, i), c = e.slice(t, r), h = 0; h < l; ++h)
  1052. if (u[h] !== c[h]) { o = u[h], a = c[h]; break } return o < a ? -1 : a < o ? 1 : 0
  1053. }, s.prototype.includes = function (e, t, r) { return -1 !== this.indexOf(e, t, r) }, s.prototype.indexOf = function (e, t, r) { return d(this, e, t, r, !0) }, s.prototype.lastIndexOf = function (e, t, r) { return d(this, e, t, r, !1) }, s.prototype.write = function (e, t, r, n) {
  1054. if (void 0 === t) n = "utf8", r = this.length, t = 0;
  1055. else if (void 0 === r && "string" == typeof t) n = t, r = this.length, t = 0;
  1056. else {
  1057. if (!isFinite(t)) throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
  1058. t >>>= 0, isFinite(r) ? (r >>>= 0, void 0 === n && (n = "utf8")) : (n = r, r = void 0)
  1059. }
  1060. var i = this.length - t;
  1061. if ((void 0 === r || r > i) && (r = i), e.length > 0 && (r < 0 || t < 0) || t > this.length) throw new RangeError("Attempt to write outside buffer bounds");
  1062. n || (n = "utf8");
  1063. for (var o = !1;;) switch (n) {
  1064. case "hex":
  1065. return y(this, e, t, r);
  1066. case "utf8":
  1067. case "utf-8":
  1068. return b(this, e, t, r);
  1069. case "ascii":
  1070. return m(this, e, t, r);
  1071. case "latin1":
  1072. case "binary":
  1073. return v(this, e, t, r);
  1074. case "base64":
  1075. return w(this, e, t, r);
  1076. case "ucs2":
  1077. case "ucs-2":
  1078. case "utf16le":
  1079. case "utf-16le":
  1080. return _(this, e, t, r);
  1081. default:
  1082. if (o) throw new TypeError("Unknown encoding: " + n);
  1083. n = ("" + n).toLowerCase(), o = !0
  1084. }
  1085. }, s.prototype.toJSON = function () { return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0) } };
  1086. var E = 4096;
  1087. function C(e, t, r) {
  1088. var n = "";
  1089. r = Math.min(e.length, r);
  1090. for (var i = t; i < r; ++i) n += String.fromCharCode(127 & e[i]);
  1091. return n
  1092. }
  1093. function T(e, t, r) {
  1094. var n = "";
  1095. r = Math.min(e.length, r);
  1096. for (var i = t; i < r; ++i) n += String.fromCharCode(e[i]);
  1097. return n
  1098. }
  1099. function x(e, t, r) {
  1100. var n = e.length;
  1101. (!t || t < 0) && (t = 0), (!r || r < 0 || r > n) && (r = n);
  1102. for (var i = "", o = t; o < r; ++o) i += N(e[o]);
  1103. return i
  1104. }
  1105. function A(e, t, r) { for (var n = e.slice(t, r), i = "", o = 0; o < n.length; o += 2) i += String.fromCharCode(n[o] + 256 * n[o + 1]); return i }
  1106. function I(e, t, r) { if (e % 1 != 0 || e < 0) throw new RangeError("offset is not uint"); if (e + t > r) throw new RangeError("Trying to access beyond buffer length") }
  1107. function P(e, t, r, n, i, o) { if (!s.isBuffer(e)) throw new TypeError('"buffer" argument must be a Buffer instance'); if (t > i || t < o) throw new RangeError('"value" argument is out of bounds'); if (r + n > e.length) throw new RangeError("Index out of range") }
  1108. function O(e, t, r, n, i, o) { if (r + n > e.length) throw new RangeError("Index out of range"); if (r < 0) throw new RangeError("Index out of range") }
  1109. function B(e, t, r, i, o) { return t = +t, r >>>= 0, o || O(e, 0, r, 4), n.write(e, t, r, i, 23, 4), r + 4 }
  1110. function R(e, t, r, i, o) { return t = +t, r >>>= 0, o || O(e, 0, r, 8), n.write(e, t, r, i, 52, 8), r + 8 } s.prototype.slice = function (e, t) {
  1111. var r = this.length;
  1112. e = ~~e, t = void 0 === t ? r : ~~t, e < 0 ? (e += r) < 0 && (e = 0) : e > r && (e = r), t < 0 ? (t += r) < 0 && (t = 0) : t > r && (t = r), t < e && (t = e);
  1113. var n = this.subarray(e, t);
  1114. return n.__proto__ = s.prototype, n
  1115. }, s.prototype.readUIntLE = function (e, t, r) { e >>>= 0, t >>>= 0, r || I(e, t, this.length); for (var n = this[e], i = 1, o = 0; ++o < t && (i *= 256);) n += this[e + o] * i; return n }, s.prototype.readUIntBE = function (e, t, r) { e >>>= 0, t >>>= 0, r || I(e, t, this.length); for (var n = this[e + --t], i = 1; t > 0 && (i *= 256);) n += this[e + --t] * i; return n }, s.prototype.readUInt8 = function (e, t) { return e >>>= 0, t || I(e, 1, this.length), this[e] }, s.prototype.readUInt16LE = function (e, t) { return e >>>= 0, t || I(e, 2, this.length), this[e] | this[e + 1] << 8 }, s.prototype.readUInt16BE = function (e, t) { return e >>>= 0, t || I(e, 2, this.length), this[e] << 8 | this[e + 1] }, s.prototype.readUInt32LE = function (e, t) { return e >>>= 0, t || I(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + 16777216 * this[e + 3] }, s.prototype.readUInt32BE = function (e, t) { return e >>>= 0, t || I(e, 4, this.length), 16777216 * this[e] + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]) }, s.prototype.readIntLE = function (e, t, r) { e >>>= 0, t >>>= 0, r || I(e, t, this.length); for (var n = this[e], i = 1, o = 0; ++o < t && (i *= 256);) n += this[e + o] * i; return n >= (i *= 128) && (n -= Math.pow(2, 8 * t)), n }, s.prototype.readIntBE = function (e, t, r) { e >>>= 0, t >>>= 0, r || I(e, t, this.length); for (var n = t, i = 1, o = this[e + --n]; n > 0 && (i *= 256);) o += this[e + --n] * i; return o >= (i *= 128) && (o -= Math.pow(2, 8 * t)), o }, s.prototype.readInt8 = function (e, t) { return e >>>= 0, t || I(e, 1, this.length), 128 & this[e] ? -1 * (255 - this[e] + 1) : this[e] }, s.prototype.readInt16LE = function (e, t) { e >>>= 0, t || I(e, 2, this.length); var r = this[e] | this[e + 1] << 8; return 32768 & r ? 4294901760 | r : r }, s.prototype.readInt16BE = function (e, t) { e >>>= 0, t || I(e, 2, this.length); var r = this[e + 1] | this[e] << 8; return 32768 & r ? 4294901760 | r : r }, s.prototype.readInt32LE = function (e, t) { return e >>>= 0, t || I(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24 }, s.prototype.readInt32BE = function (e, t) { return e >>>= 0, t || I(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3] }, s.prototype.readFloatLE = function (e, t) { return e >>>= 0, t || I(e, 4, this.length), n.read(this, e, !0, 23, 4) }, s.prototype.readFloatBE = function (e, t) { return e >>>= 0, t || I(e, 4, this.length), n.read(this, e, !1, 23, 4) }, s.prototype.readDoubleLE = function (e, t) { return e >>>= 0, t || I(e, 8, this.length), n.read(this, e, !0, 52, 8) }, s.prototype.readDoubleBE = function (e, t) { return e >>>= 0, t || I(e, 8, this.length), n.read(this, e, !1, 52, 8) }, s.prototype.writeUIntLE = function (e, t, r, n) {
  1116. (e = +e, t >>>= 0, r >>>= 0, n) || P(this, e, t, r, Math.pow(2, 8 * r) - 1, 0);
  1117. var i = 1,
  1118. o = 0;
  1119. for (this[t] = 255 & e; ++o < r && (i *= 256);) this[t + o] = e / i & 255;
  1120. return t + r
  1121. }, s.prototype.writeUIntBE = function (e, t, r, n) {
  1122. (e = +e, t >>>= 0, r >>>= 0, n) || P(this, e, t, r, Math.pow(2, 8 * r) - 1, 0);
  1123. var i = r - 1,
  1124. o = 1;
  1125. for (this[t + i] = 255 & e; --i >= 0 && (o *= 256);) this[t + i] = e / o & 255;
  1126. return t + r
  1127. }, s.prototype.writeUInt8 = function (e, t, r) { return e = +e, t >>>= 0, r || P(this, e, t, 1, 255, 0), this[t] = 255 & e, t + 1 }, s.prototype.writeUInt16LE = function (e, t, r) { return e = +e, t >>>= 0, r || P(this, e, t, 2, 65535, 0), this[t] = 255 & e, this[t + 1] = e >>> 8, t + 2 }, s.prototype.writeUInt16BE = function (e, t, r) { return e = +e, t >>>= 0, r || P(this, e, t, 2, 65535, 0), this[t] = e >>> 8, this[t + 1] = 255 & e, t + 2 }, s.prototype.writeUInt32LE = function (e, t, r) { return e = +e, t >>>= 0, r || P(this, e, t, 4, 4294967295, 0), this[t + 3] = e >>> 24, this[t + 2] = e >>> 16, this[t + 1] = e >>> 8, this[t] = 255 & e, t + 4 }, s.prototype.writeUInt32BE = function (e, t, r) { return e = +e, t >>>= 0, r || P(this, e, t, 4, 4294967295, 0), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = 255 & e, t + 4 }, s.prototype.writeIntLE = function (e, t, r, n) {
  1128. if (e = +e, t >>>= 0, !n) {
  1129. var i = Math.pow(2, 8 * r - 1);
  1130. P(this, e, t, r, i - 1, -i)
  1131. }
  1132. var o = 0,
  1133. s = 1,
  1134. a = 0;
  1135. for (this[t] = 255 & e; ++o < r && (s *= 256);) e < 0 && 0 === a && 0 !== this[t + o - 1] && (a = 1), this[t + o] = (e / s >> 0) - a & 255;
  1136. return t + r
  1137. }, s.prototype.writeIntBE = function (e, t, r, n) {
  1138. if (e = +e, t >>>= 0, !n) {
  1139. var i = Math.pow(2, 8 * r - 1);
  1140. P(this, e, t, r, i - 1, -i)
  1141. }
  1142. var o = r - 1,
  1143. s = 1,
  1144. a = 0;
  1145. for (this[t + o] = 255 & e; --o >= 0 && (s *= 256);) e < 0 && 0 === a && 0 !== this[t + o + 1] && (a = 1), this[t + o] = (e / s >> 0) - a & 255;
  1146. return t + r
  1147. }, s.prototype.writeInt8 = function (e, t, r) { return e = +e, t >>>= 0, r || P(this, e, t, 1, 127, -128), e < 0 && (e = 255 + e + 1), this[t] = 255 & e, t + 1 }, s.prototype.writeInt16LE = function (e, t, r) { return e = +e, t >>>= 0, r || P(this, e, t, 2, 32767, -32768), this[t] = 255 & e, this[t + 1] = e >>> 8, t + 2 }, s.prototype.writeInt16BE = function (e, t, r) { return e = +e, t >>>= 0, r || P(this, e, t, 2, 32767, -32768), this[t] = e >>> 8, this[t + 1] = 255 & e, t + 2 }, s.prototype.writeInt32LE = function (e, t, r) { return e = +e, t >>>= 0, r || P(this, e, t, 4, 2147483647, -2147483648), this[t] = 255 & e, this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24, t + 4 }, s.prototype.writeInt32BE = function (e, t, r) { return e = +e, t >>>= 0, r || P(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = 255 & e, t + 4 }, s.prototype.writeFloatLE = function (e, t, r) { return B(this, e, t, !0, r) }, s.prototype.writeFloatBE = function (e, t, r) { return B(this, e, t, !1, r) }, s.prototype.writeDoubleLE = function (e, t, r) { return R(this, e, t, !0, r) }, s.prototype.writeDoubleBE = function (e, t, r) { return R(this, e, t, !1, r) }, s.prototype.copy = function (e, t, r, n) {
  1148. if (!s.isBuffer(e)) throw new TypeError("argument should be a Buffer");
  1149. if (r || (r = 0), n || 0 === n || (n = this.length), t >= e.length && (t = e.length), t || (t = 0), n > 0 && n < r && (n = r), n === r) return 0;
  1150. if (0 === e.length || 0 === this.length) return 0;
  1151. if (t < 0) throw new RangeError("targetStart out of bounds");
  1152. if (r < 0 || r >= this.length) throw new RangeError("Index out of range");
  1153. if (n < 0) throw new RangeError("sourceEnd out of bounds");
  1154. n > this.length && (n = this.length), e.length - t < n - r && (n = e.length - t + r);
  1155. var i = n - r;
  1156. if (this === e && "function" == typeof Uint8Array.prototype.copyWithin) this.copyWithin(t, r, n);
  1157. else if (this === e && r < t && t < n)
  1158. for (var o = i - 1; o >= 0; --o) e[o + t] = this[o + r];
  1159. else Uint8Array.prototype.set.call(e, this.subarray(r, n), t);
  1160. return i
  1161. }, s.prototype.fill = function (e, t, r, n) {
  1162. if ("string" == typeof e) {
  1163. if ("string" == typeof t ? (n = t, t = 0, r = this.length) : "string" == typeof r && (n = r, r = this.length), void 0 !== n && "string" != typeof n) throw new TypeError("encoding must be a string");
  1164. if ("string" == typeof n && !s.isEncoding(n)) throw new TypeError("Unknown encoding: " + n);
  1165. if (1 === e.length) {
  1166. var i = e.charCodeAt(0);
  1167. ("utf8" === n && i < 128 || "latin1" === n) && (e = i)
  1168. }
  1169. } else "number" == typeof e && (e &= 255);
  1170. if (t < 0 || this.length < t || this.length < r) throw new RangeError("Out of range index");
  1171. if (r <= t) return this;
  1172. var o;
  1173. if (t >>>= 0, r = void 0 === r ? this.length : r >>> 0, e || (e = 0), "number" == typeof e)
  1174. for (o = t; o < r; ++o) this[o] = e;
  1175. else {
  1176. var a = s.isBuffer(e) ? e : s.from(e, n),
  1177. l = a.length;
  1178. if (0 === l) throw new TypeError('The value "' + e + '" is invalid for argument "value"');
  1179. for (o = 0; o < r - t; ++o) this[o + t] = a[o % l]
  1180. }
  1181. return this
  1182. };
  1183. var M = /[^+/0-9A-Za-z-_]/g;
  1184. function N(e) { return e < 16 ? "0" + e.toString(16) : e.toString(16) }
  1185. function L(e, t) {
  1186. var r;
  1187. t = t || 1 / 0;
  1188. for (var n = e.length, i = null, o = [], s = 0; s < n; ++s) {
  1189. if ((r = e.charCodeAt(s)) > 55295 && r < 57344) {
  1190. if (!i) {
  1191. if (r > 56319) {
  1192. (t -= 3) > -1 && o.push(239, 191, 189);
  1193. continue
  1194. }
  1195. if (s + 1 === n) {
  1196. (t -= 3) > -1 && o.push(239, 191, 189);
  1197. continue
  1198. }
  1199. i = r;
  1200. continue
  1201. }
  1202. if (r < 56320) {
  1203. (t -= 3) > -1 && o.push(239, 191, 189), i = r;
  1204. continue
  1205. }
  1206. r = 65536 + (i - 55296 << 10 | r - 56320)
  1207. } else i && (t -= 3) > -1 && o.push(239, 191, 189);
  1208. if (i = null, r < 128) {
  1209. if ((t -= 1) < 0) break;
  1210. o.push(r)
  1211. } else if (r < 2048) {
  1212. if ((t -= 2) < 0) break;
  1213. o.push(r >> 6 | 192, 63 & r | 128)
  1214. } else if (r < 65536) {
  1215. if ((t -= 3) < 0) break;
  1216. o.push(r >> 12 | 224, r >> 6 & 63 | 128, 63 & r | 128)
  1217. } else {
  1218. if (!(r < 1114112)) throw new Error("Invalid code point");
  1219. if ((t -= 4) < 0) break;
  1220. o.push(r >> 18 | 240, r >> 12 & 63 | 128, r >> 6 & 63 | 128, 63 & r | 128)
  1221. }
  1222. }
  1223. return o
  1224. }
  1225. function j(e) { return t.toByteArray(function (e) { if ((e = (e = e.split("=")[0]).trim().replace(M, "")).length < 2) return ""; for (; e.length % 4 != 0;) e += "="; return e }(e)) }
  1226. function U(e, t, r, n) { for (var i = 0; i < n && !(i + r >= t.length || i >= e.length); ++i) t[i + r] = e[i]; return i }
  1227. function q(e, t) { return e instanceof t || null != e && null != e.constructor && null != e.constructor.name && e.constructor.name === t.name }
  1228. function D(e) { return e != e }
  1229. }).call(this)
  1230. }).call(this, e("buffer").Buffer)
  1231. }, { "base64-js": 13, buffer: 17, ieee754: 23 }],
  1232. 18: [function (e, t, r) {
  1233. (function (n) {
  1234. (function () {
  1235. r.formatArgs = function (e) {
  1236. if (e[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + e[0] + (this.useColors ? "%c " : " ") + "+" + t.exports.humanize(this.diff), !this.useColors) return;
  1237. const r = "color: " + this.color;
  1238. e.splice(1, 0, r, "color: inherit");
  1239. let n = 0,
  1240. i = 0;
  1241. e[0].replace(/%[a-zA-Z%]/g, e => { "%%" !== e && "%c" === e && (i = ++n) }), e.splice(i, 0, r)
  1242. }, r.save = function (e) { try { e ? r.storage.setItem("debug", e) : r.storage.removeItem("debug") } catch (e) {} }, r.load = function () { let e; try { e = r.storage.getItem("debug") } catch (e) {}!e && void 0 !== n && "env" in n && (e = n.env.DEBUG); return e }, r.useColors = function () { if ("undefined" != typeof window && window.process && ("renderer" === window.process.type || window.process.__nwjs)) return !0; if ("undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return !1; return "undefined" != typeof document && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || "undefined" != typeof window && window.console && (window.console.firebug || window.console.exception && window.console.table) || "undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || "undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/) }, r.storage = function () { try { return localStorage } catch (e) {} }(), r.destroy = (() => { let e = !1; return () => { e || (e = !0, console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")) } })(), r.colors = ["#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33"], r.log = console.debug || console.log || (() => {}), t.exports = e("./common")(r);
  1243. const { formatters: i } = t.exports;
  1244. i.j = function (e) { try { return JSON.stringify(e) } catch (e) { return "[UnexpectedJSONParseError]: " + e.message } }
  1245. }).call(this)
  1246. }).call(this, e("_process"))
  1247. }, { "./common": 19, _process: 50 }],
  1248. 19: [function (e, t, r) {
  1249. t.exports = function (t) {
  1250. function r(e) {
  1251. let t, i, o, s = null;
  1252. function a(...e) {
  1253. if (!a.enabled) return;
  1254. const n = a,
  1255. i = Number(new Date),
  1256. o = i - (t || i);
  1257. n.diff = o, n.prev = t, n.curr = i, t = i, e[0] = r.coerce(e[0]), "string" != typeof e[0] && e.unshift("%O");
  1258. let s = 0;
  1259. e[0] = e[0].replace(/%([a-zA-Z%])/g, (t, i) => {
  1260. if ("%%" === t) return "%";
  1261. s++;
  1262. const o = r.formatters[i];
  1263. if ("function" == typeof o) {
  1264. const r = e[s];
  1265. t = o.call(n, r), e.splice(s, 1), s--
  1266. }
  1267. return t
  1268. }), r.formatArgs.call(n, e), (n.log || r.log).apply(n, e)
  1269. }
  1270. return a.namespace = e, a.useColors = r.useColors(), a.color = r.selectColor(e), a.extend = n, a.destroy = r.destroy, Object.defineProperty(a, "enabled", { enumerable: !0, configurable: !1, get: () => null !== s ? s : (i !== r.namespaces && (i = r.namespaces, o = r.enabled(e)), o), set: e => { s = e } }), "function" == typeof r.init && r.init(a), a
  1271. }
  1272. function n(e, t) { const n = r(this.namespace + (void 0 === t ? ":" : t) + e); return n.log = this.log, n }
  1273. function i(e) { return e.toString().substring(2, e.toString().length - 2).replace(/\.\*\?$/, "*") }
  1274. return r.debug = r, r.default = r, r.coerce = function (e) { return e instanceof Error ? e.stack || e.message : e }, r.disable = function () { const e = [...r.names.map(i), ...r.skips.map(i).map(e => "-" + e)].join(","); return r.enable(""), e }, r.enable = function (e) {
  1275. let t;
  1276. r.save(e), r.namespaces = e, r.names = [], r.skips = [];
  1277. const n = ("string" == typeof e ? e : "").split(/[\s,]+/),
  1278. i = n.length;
  1279. for (t = 0; t < i; t++) n[t] && ("-" === (e = n[t].replace(/\*/g, ".*?"))[0] ? r.skips.push(new RegExp("^" + e.substr(1) + "$")) : r.names.push(new RegExp("^" + e + "$")))
  1280. }, r.enabled = function (e) {
  1281. if ("*" === e[e.length - 1]) return !0;
  1282. let t, n;
  1283. for (t = 0, n = r.skips.length; t < n; t++)
  1284. if (r.skips[t].test(e)) return !1;
  1285. for (t = 0, n = r.names.length; t < n; t++)
  1286. if (r.names[t].test(e)) return !0;
  1287. return !1
  1288. }, r.humanize = e("ms"), r.destroy = function () { console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.") }, Object.keys(t).forEach(e => { r[e] = t[e] }), r.names = [], r.skips = [], r.formatters = {}, r.selectColor = function (e) { let t = 0; for (let r = 0; r < e.length; r++) t = (t << 5) - t + e.charCodeAt(r), t |= 0; return r.colors[Math.abs(t) % r.colors.length] }, r.enable(r.load()), r
  1289. }
  1290. }, { ms: 45 }],
  1291. 20: [function (e, t, r) {
  1292. (function (r, n) {
  1293. (function () {
  1294. var i = e("readable-stream"),
  1295. o = e("end-of-stream"),
  1296. s = e("inherits"),
  1297. a = e("stream-shift"),
  1298. l = n.from && n.from !== Uint8Array.from ? n.from([0]) : new n([0]),
  1299. u = function (e, t) { e._corked ? e.once("uncork", t) : t() },
  1300. c = function (e, t) { return function (r) { r ? function (e, t) { e._autoDestroy && e.destroy(t) }(e, "premature close" === r.message ? null : r) : t && !e._ended && e.end() } },
  1301. h = function () {},
  1302. f = function (e, t, r) {
  1303. if (!(this instanceof f)) return new f(e, t, r);
  1304. i.Duplex.call(this, r), this._writable = null, this._readable = null, this._readable2 = null, this._autoDestroy = !r || !1 !== r.autoDestroy, this._forwardDestroy = !r || !1 !== r.destroy, this._forwardEnd = !r || !1 !== r.end, this._corked = 1, this._ondrain = null, this._drained = !1, this._forwarding = !1, this._unwrite = null, this._unread = null, this._ended = !1, this.destroyed = !1, e && this.setWritable(e), t && this.setReadable(t)
  1305. };
  1306. s(f, i.Duplex), f.obj = function (e, t, r) { return r || (r = {}), r.objectMode = !0, r.highWaterMark = 16, new f(e, t, r) }, f.prototype.cork = function () { 1 == ++this._corked && this.emit("cork") }, f.prototype.uncork = function () { this._corked && 0 == --this._corked && this.emit("uncork") }, f.prototype.setWritable = function (e) {
  1307. if (this._unwrite && this._unwrite(), this.destroyed) e && e.destroy && e.destroy();
  1308. else if (null !== e && !1 !== e) {
  1309. var t = this,
  1310. n = o(e, { writable: !0, readable: !1 }, c(this, this._forwardEnd)),
  1311. i = function () {
  1312. var e = t._ondrain;
  1313. t._ondrain = null, e && e()
  1314. };
  1315. this._unwrite && r.nextTick(i), this._writable = e, this._writable.on("drain", i), this._unwrite = function () { t._writable.removeListener("drain", i), n() }, this.uncork()
  1316. } else this.end()
  1317. }, f.prototype.setReadable = function (e) {
  1318. if (this._unread && this._unread(), this.destroyed) e && e.destroy && e.destroy();
  1319. else {
  1320. if (null === e || !1 === e) return this.push(null), void this.resume();
  1321. var t, r = this,
  1322. n = o(e, { writable: !1, readable: !0 }, c(this)),
  1323. s = function () { r._forward() },
  1324. a = function () { r.push(null) };
  1325. this._drained = !0, this._readable = e, this._readable2 = e._readableState ? e : (t = e, new i.Readable({ objectMode: !0, highWaterMark: 16 }).wrap(t)), this._readable2.on("readable", s), this._readable2.on("end", a), this._unread = function () { r._readable2.removeListener("readable", s), r._readable2.removeListener("end", a), n() }, this._forward()
  1326. }
  1327. }, f.prototype._read = function () { this._drained = !0, this._forward() }, f.prototype._forward = function () {
  1328. if (!this._forwarding && this._readable2 && this._drained) {
  1329. var e;
  1330. for (this._forwarding = !0; this._drained && null !== (e = a(this._readable2));) this.destroyed || (this._drained = this.push(e));
  1331. this._forwarding = !1
  1332. }
  1333. }, f.prototype.destroy = function (e, t) {
  1334. if (t || (t = h), this.destroyed) return t(null);
  1335. this.destroyed = !0;
  1336. var n = this;
  1337. r.nextTick(function () { n._destroy(e), t(null) })
  1338. }, f.prototype._destroy = function (e) {
  1339. if (e) {
  1340. var t = this._ondrain;
  1341. this._ondrain = null, t ? t(e) : this.emit("error", e)
  1342. }
  1343. this._forwardDestroy && (this._readable && this._readable.destroy && this._readable.destroy(), this._writable && this._writable.destroy && this._writable.destroy()), this.emit("close")
  1344. }, f.prototype._write = function (e, t, r) { if (!this.destroyed) return this._corked ? u(this, this._write.bind(this, e, t, r)) : e === l ? this._finish(r) : this._writable ? void(!1 === this._writable.write(e) ? this._ondrain = r : this.destroyed || r()) : r() }, f.prototype._finish = function (e) {
  1345. var t = this;
  1346. this.emit("preend"), u(this, function () {
  1347. var r, n;
  1348. r = t._forwardEnd && t._writable, n = function () {!1 === t._writableState.prefinished && (t._writableState.prefinished = !0), t.emit("prefinish"), u(t, e) }, r ? r._writableState && r._writableState.finished ? n() : r._writableState ? r.end(n) : (r.end(), n()) : n()
  1349. })
  1350. }, f.prototype.end = function (e, t, r) { return "function" == typeof e ? this.end(null, null, e) : "function" == typeof t ? this.end(e, null, t) : (this._ended = !0, e && this.write(e), this._writableState.ending || this._writableState.destroyed || this.write(l), i.Writable.prototype.end.call(this, r)) }, t.exports = f
  1351. }).call(this)
  1352. }).call(this, e("_process"), e("buffer").Buffer)
  1353. }, { _process: 50, buffer: 17, "end-of-stream": 21, inherits: 24, "readable-stream": 69, "stream-shift": 74 }],
  1354. 21: [function (e, t, r) {
  1355. (function (r) {
  1356. (function () {
  1357. var n = e("once"),
  1358. i = function () {},
  1359. o = function (e, t, s) {
  1360. if ("function" == typeof t) return o(e, null, t);
  1361. t || (t = {}), s = n(s || i);
  1362. var a = e._writableState,
  1363. l = e._readableState,
  1364. u = t.readable || !1 !== t.readable && e.readable,
  1365. c = t.writable || !1 !== t.writable && e.writable,
  1366. h = !1,
  1367. f = function () { e.writable || p() },
  1368. p = function () { c = !1, u || s.call(e) },
  1369. d = function () { u = !1, c || s.call(e) },
  1370. g = function (t) { s.call(e, t ? new Error("exited with error code: " + t) : null) },
  1371. y = function (t) { s.call(e, t) },
  1372. b = function () { r.nextTick(m) },
  1373. m = function () { if (!h) return (!u || l && l.ended && !l.destroyed) && (!c || a && a.ended && !a.destroyed) ? void 0 : s.call(e, new Error("premature close")) },
  1374. v = function () { e.req.on("finish", p) };
  1375. return ! function (e) { return e.setHeader && "function" == typeof e.abort }(e) ? c && !a && (e.on("end", f), e.on("close", f)) : (e.on("complete", p), e.on("abort", b), e.req ? v() : e.on("request", v)),
  1376. function (e) { return e.stdio && Array.isArray(e.stdio) && 3 === e.stdio.length }(e) && e.on("exit", g), e.on("end", d), e.on("finish", p), !1 !== t.error && e.on("error", y), e.on("close", b),
  1377. function () { h = !0, e.removeListener("complete", p), e.removeListener("abort", b), e.removeListener("request", v), e.req && e.req.removeListener("finish", p), e.removeListener("end", f), e.removeListener("close", f), e.removeListener("finish", p), e.removeListener("exit", g), e.removeListener("end", d), e.removeListener("error", y), e.removeListener("close", b) }
  1378. };
  1379. t.exports = o
  1380. }).call(this)
  1381. }).call(this, e("_process"))
  1382. }, { _process: 50, once: 48 }],
  1383. 22: [function (e, t, r) {
  1384. var n = Object.create || function (e) { var t = function () {}; return t.prototype = e, new t },
  1385. i = Object.keys || function (e) { var t = []; for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.push(r); return r },
  1386. o = Function.prototype.bind || function (e) { var t = this; return function () { return t.apply(e, arguments) } };
  1387. function s() { this._events && Object.prototype.hasOwnProperty.call(this, "_events") || (this._events = n(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0 } t.exports = s, s.EventEmitter = s, s.prototype._events = void 0, s.prototype._maxListeners = void 0;
  1388. var a, l = 10;
  1389. try {
  1390. var u = {};
  1391. Object.defineProperty && Object.defineProperty(u, "x", { value: 0 }), a = 0 === u.x
  1392. } catch (e) { a = !1 }
  1393. function c(e) { return void 0 === e._maxListeners ? s.defaultMaxListeners : e._maxListeners }
  1394. function h(e, t, r, i) {
  1395. var o, s, a;
  1396. if ("function" != typeof r) throw new TypeError('"listener" argument must be a function');
  1397. if ((s = e._events) ? (s.newListener && (e.emit("newListener", t, r.listener ? r.listener : r), s = e._events), a = s[t]) : (s = e._events = n(null), e._eventsCount = 0), a) {
  1398. if ("function" == typeof a ? a = s[t] = i ? [r, a] : [a, r] : i ? a.unshift(r) : a.push(r), !a.warned && (o = c(e)) && o > 0 && a.length > o) {
  1399. a.warned = !0;
  1400. var l = new Error("Possible EventEmitter memory leak detected. " + a.length + ' "' + String(t) + '" listeners added. Use emitter.setMaxListeners() to increase limit.');
  1401. l.name = "MaxListenersExceededWarning", l.emitter = e, l.type = t, l.count = a.length, "object" == typeof console && console.warn && console.warn("%s: %s", l.name, l.message)
  1402. }
  1403. } else a = s[t] = r, ++e._eventsCount;
  1404. return e
  1405. }
  1406. function f() {
  1407. if (!this.fired) switch (this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length) {
  1408. case 0:
  1409. return this.listener.call(this.target);
  1410. case 1:
  1411. return this.listener.call(this.target, arguments[0]);
  1412. case 2:
  1413. return this.listener.call(this.target, arguments[0], arguments[1]);
  1414. case 3:
  1415. return this.listener.call(this.target, arguments[0], arguments[1], arguments[2]);
  1416. default:
  1417. for (var e = new Array(arguments.length), t = 0; t < e.length; ++t) e[t] = arguments[t];
  1418. this.listener.apply(this.target, e)
  1419. }
  1420. }
  1421. function p(e, t, r) {
  1422. var n = { fired: !1, wrapFn: void 0, target: e, type: t, listener: r },
  1423. i = o.call(f, n);
  1424. return i.listener = r, n.wrapFn = i, i
  1425. }
  1426. function d(e, t, r) { var n = e._events; if (!n) return []; var i = n[t]; return i ? "function" == typeof i ? r ? [i.listener || i] : [i] : r ? function (e) { for (var t = new Array(e.length), r = 0; r < t.length; ++r) t[r] = e[r].listener || e[r]; return t }(i) : y(i, i.length) : [] }
  1427. function g(e) { var t = this._events; if (t) { var r = t[e]; if ("function" == typeof r) return 1; if (r) return r.length } return 0 }
  1428. function y(e, t) { for (var r = new Array(t), n = 0; n < t; ++n) r[n] = e[n]; return r } a ? Object.defineProperty(s, "defaultMaxListeners", {
  1429. enumerable: !0,
  1430. get: function () { return l },
  1431. set: function (e) {
  1432. if ("number" != typeof e || e < 0 || e != e) throw new TypeError('"defaultMaxListeners" must be a positive number');
  1433. l = e
  1434. }
  1435. }) : s.defaultMaxListeners = l, s.prototype.setMaxListeners = function (e) { if ("number" != typeof e || e < 0 || isNaN(e)) throw new TypeError('"n" argument must be a positive number'); return this._maxListeners = e, this }, s.prototype.getMaxListeners = function () { return c(this) }, s.prototype.emit = function (e) {
  1436. var t, r, n, i, o, s, a = "error" === e;
  1437. if (s = this._events) a = a && null == s.error;
  1438. else if (!a) return !1;
  1439. if (a) { if (arguments.length > 1 && (t = arguments[1]), t instanceof Error) throw t; var l = new Error('Unhandled "error" event. (' + t + ")"); throw l.context = t, l }
  1440. if (!(r = s[e])) return !1;
  1441. var u = "function" == typeof r;
  1442. switch (n = arguments.length) {
  1443. case 1:
  1444. ! function (e, t, r) {
  1445. if (t) e.call(r);
  1446. else
  1447. for (var n = e.length, i = y(e, n), o = 0; o < n; ++o) i[o].call(r)
  1448. }(r, u, this);
  1449. break;
  1450. case 2:
  1451. ! function (e, t, r, n) {
  1452. if (t) e.call(r, n);
  1453. else
  1454. for (var i = e.length, o = y(e, i), s = 0; s < i; ++s) o[s].call(r, n)
  1455. }(r, u, this, arguments[1]);
  1456. break;
  1457. case 3:
  1458. ! function (e, t, r, n, i) {
  1459. if (t) e.call(r, n, i);
  1460. else
  1461. for (var o = e.length, s = y(e, o), a = 0; a < o; ++a) s[a].call(r, n, i)
  1462. }(r, u, this, arguments[1], arguments[2]);
  1463. break;
  1464. case 4:
  1465. ! function (e, t, r, n, i, o) {
  1466. if (t) e.call(r, n, i, o);
  1467. else
  1468. for (var s = e.length, a = y(e, s), l = 0; l < s; ++l) a[l].call(r, n, i, o)
  1469. }(r, u, this, arguments[1], arguments[2], arguments[3]);
  1470. break;
  1471. default:
  1472. for (i = new Array(n - 1), o = 1; o < n; o++) i[o - 1] = arguments[o];
  1473. ! function (e, t, r, n) {
  1474. if (t) e.apply(r, n);
  1475. else
  1476. for (var i = e.length, o = y(e, i), s = 0; s < i; ++s) o[s].apply(r, n)
  1477. }(r, u, this, i)
  1478. }
  1479. return !0
  1480. }, s.prototype.addListener = function (e, t) { return h(this, e, t, !1) }, s.prototype.on = s.prototype.addListener, s.prototype.prependListener = function (e, t) { return h(this, e, t, !0) }, s.prototype.once = function (e, t) { if ("function" != typeof t) throw new TypeError('"listener" argument must be a function'); return this.on(e, p(this, e, t)), this }, s.prototype.prependOnceListener = function (e, t) { if ("function" != typeof t) throw new TypeError('"listener" argument must be a function'); return this.prependListener(e, p(this, e, t)), this }, s.prototype.removeListener = function (e, t) {
  1481. var r, i, o, s, a;
  1482. if ("function" != typeof t) throw new TypeError('"listener" argument must be a function');
  1483. if (!(i = this._events)) return this;
  1484. if (!(r = i[e])) return this;
  1485. if (r === t || r.listener === t) 0 == --this._eventsCount ? this._events = n(null) : (delete i[e], i.removeListener && this.emit("removeListener", e, r.listener || t));
  1486. else if ("function" != typeof r) {
  1487. for (o = -1, s = r.length - 1; s >= 0; s--)
  1488. if (r[s] === t || r[s].listener === t) { a = r[s].listener, o = s; break } if (o < 0) return this;
  1489. 0 === o ? r.shift() : function (e, t) {
  1490. for (var r = t, n = r + 1, i = e.length; n < i; r += 1, n += 1) e[r] = e[n];
  1491. e.pop()
  1492. }(r, o), 1 === r.length && (i[e] = r[0]), i.removeListener && this.emit("removeListener", e, a || t)
  1493. }
  1494. return this
  1495. }, s.prototype.removeAllListeners = function (e) {
  1496. var t, r, o;
  1497. if (!(r = this._events)) return this;
  1498. if (!r.removeListener) return 0 === arguments.length ? (this._events = n(null), this._eventsCount = 0) : r[e] && (0 == --this._eventsCount ? this._events = n(null) : delete r[e]), this;
  1499. if (0 === arguments.length) { var s, a = i(r); for (o = 0; o < a.length; ++o) "removeListener" !== (s = a[o]) && this.removeAllListeners(s); return this.removeAllListeners("removeListener"), this._events = n(null), this._eventsCount = 0, this }
  1500. if ("function" == typeof (t = r[e])) this.removeListener(e, t);
  1501. else if (t)
  1502. for (o = t.length - 1; o >= 0; o--) this.removeListener(e, t[o]);
  1503. return this
  1504. }, s.prototype.listeners = function (e) { return d(this, e, !0) }, s.prototype.rawListeners = function (e) { return d(this, e, !1) }, s.listenerCount = function (e, t) { return "function" == typeof e.listenerCount ? e.listenerCount(t) : g.call(e, t) }, s.prototype.listenerCount = g, s.prototype.eventNames = function () { return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [] }
  1505. }, {}],
  1506. 23: [function (e, t, r) {
  1507. r.read = function (e, t, r, n, i) {
  1508. var o, s, a = 8 * i - n - 1,
  1509. l = (1 << a) - 1,
  1510. u = l >> 1,
  1511. c = -7,
  1512. h = r ? i - 1 : 0,
  1513. f = r ? -1 : 1,
  1514. p = e[t + h];
  1515. for (h += f, o = p & (1 << -c) - 1, p >>= -c, c += a; c > 0; o = 256 * o + e[t + h], h += f, c -= 8);
  1516. for (s = o & (1 << -c) - 1, o >>= -c, c += n; c > 0; s = 256 * s + e[t + h], h += f, c -= 8);
  1517. if (0 === o) o = 1 - u;
  1518. else {
  1519. if (o === l) return s ? NaN : 1 / 0 * (p ? -1 : 1);
  1520. s += Math.pow(2, n), o -= u
  1521. }
  1522. return (p ? -1 : 1) * s * Math.pow(2, o - n)
  1523. }, r.write = function (e, t, r, n, i, o) {
  1524. var s, a, l, u = 8 * o - i - 1,
  1525. c = (1 << u) - 1,
  1526. h = c >> 1,
  1527. f = 23 === i ? Math.pow(2, -24) - Math.pow(2, -77) : 0,
  1528. p = n ? 0 : o - 1,
  1529. d = n ? 1 : -1,
  1530. g = t < 0 || 0 === t && 1 / t < 0 ? 1 : 0;
  1531. for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (a = isNaN(t) ? 1 : 0, s = c) : (s = Math.floor(Math.log(t) / Math.LN2), t * (l = Math.pow(2, -s)) < 1 && (s--, l *= 2), (t += s + h >= 1 ? f / l : f * Math.pow(2, 1 - h)) * l >= 2 && (s++, l /= 2), s + h >= c ? (a = 0, s = c) : s + h >= 1 ? (a = (t * l - 1) * Math.pow(2, i), s += h) : (a = t * Math.pow(2, h - 1) * Math.pow(2, i), s = 0)); i >= 8; e[r + p] = 255 & a, p += d, a /= 256, i -= 8);
  1532. for (s = s << i | a, u += i; u > 0; e[r + p] = 255 & s, p += d, s /= 256, u -= 8);
  1533. e[r + p - d] |= 128 * g
  1534. }
  1535. }, {}],
  1536. 24: [function (e, t, r) {
  1537. "function" == typeof Object.create ? t.exports = function (e, t) { t && (e.super_ = t, e.prototype = Object.create(t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } })) } : t.exports = function (e, t) {
  1538. if (t) {
  1539. e.super_ = t;
  1540. var r = function () {};
  1541. r.prototype = t.prototype, e.prototype = new r, e.prototype.constructor = e
  1542. }
  1543. }
  1544. }, {}],
  1545. 25: [function (e, t, r) {
  1546. "use strict";
  1547. Object.defineProperty(r, "__esModule", { value: !0 });
  1548. var n = function () {
  1549. function e(e, t) { this.color = !0, this.key = void 0, this.value = void 0, this.parent = void 0, this.brother = void 0, this.leftChild = void 0, this.rightChild = void 0, this.key = e, this.value = t }
  1550. return e.prototype.rotateLeft = function () {
  1551. var e = this.parent,
  1552. t = this.brother,
  1553. r = this.leftChild,
  1554. n = this.rightChild;
  1555. if (!n) throw new Error("unknown error");
  1556. var i = n.leftChild,
  1557. o = n.rightChild;
  1558. return e && (e.leftChild === this ? e.leftChild = n : e.rightChild === this && (e.rightChild = n)), n.parent = e, n.brother = t, n.leftChild = this, n.rightChild = o, t && (t.brother = n), this.parent = n, this.brother = o, this.leftChild = r, this.rightChild = i, o && (o.parent = n, o.brother = this), r && (r.parent = this, r.brother = i), i && (i.parent = this, i.brother = r), n
  1559. }, e.prototype.rotateRight = function () {
  1560. var e = this.parent,
  1561. t = this.brother,
  1562. r = this.leftChild;
  1563. if (!r) throw new Error("unknown error");
  1564. var n = this.rightChild,
  1565. i = r.leftChild,
  1566. o = r.rightChild;
  1567. return e && (e.leftChild === this ? e.leftChild = r : e.rightChild === this && (e.rightChild = r)), r.parent = e, r.brother = t, r.leftChild = i, r.rightChild = this, t && (t.brother = r), i && (i.parent = r, i.brother = this), this.parent = r, this.brother = i, this.leftChild = o, this.rightChild = n, o && (o.parent = this, o.brother = n), n && (n.parent = this, n.brother = o), r
  1568. }, e.prototype.remove = function () {
  1569. if (this.leftChild || this.rightChild) throw new Error("can only remove leaf node");
  1570. this.parent && (this === this.parent.leftChild ? this.parent.leftChild = void 0 : this === this.parent.rightChild && (this.parent.rightChild = void 0)), this.brother && (this.brother.brother = void 0), this.key = void 0, this.value = void 0, this.parent = void 0, this.brother = void 0
  1571. }, e.TreeNodeColorType = { red: !0, black: !1 }, e
  1572. }();
  1573. Object.freeze(n), r.default = n
  1574. }, {}],
  1575. 26: [function (e, t, r) {
  1576. "use strict";
  1577. var n = this && this.__generator || function (e, t) {
  1578. var r, n, i, o, s = { label: 0, sent: function () { if (1 & i[0]) throw i[1]; return i[1] }, trys: [], ops: [] };
  1579. return o = { next: a(0), throw: a(1), return: a(2) }, "function" == typeof Symbol && (o[Symbol.iterator] = function () { return this }), o;
  1580. function a(o) {
  1581. return function (a) {
  1582. return function (o) {
  1583. if (r) throw new TypeError("Generator is already executing.");
  1584. for (; s;) try {
  1585. if (r = 1, n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n), 0) : n.next) && !(i = i.call(n, o[1])).done) return i;
  1586. switch (n = 0, i && (o = [2 & o[0], i.value]), o[0]) {
  1587. case 0:
  1588. case 1:
  1589. i = o;
  1590. break;
  1591. case 4:
  1592. return s.label++, { value: o[1], done: !1 };
  1593. case 5:
  1594. s.label++, n = o[1], o = [0];
  1595. continue;
  1596. case 7:
  1597. o = s.ops.pop(), s.trys.pop();
  1598. continue;
  1599. default:
  1600. if (!(i = (i = s.trys).length > 0 && i[i.length - 1]) && (6 === o[0] || 2 === o[0])) { s = 0; continue }
  1601. if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) { s.label = o[1]; break }
  1602. if (6 === o[0] && s.label < i[1]) { s.label = i[1], i = o; break }
  1603. if (i && s.label < i[2]) { s.label = i[2], s.ops.push(o); break } i[2] && s.ops.pop(), s.trys.pop();
  1604. continue
  1605. }
  1606. o = t.call(e, s)
  1607. } catch (e) { o = [6, e], n = 0 } finally { r = i = 0 }
  1608. if (5 & o[0]) throw o[1];
  1609. return { value: o[0] ? o[1] : void 0, done: !0 }
  1610. }([o, a])
  1611. }
  1612. }
  1613. };
  1614. function i(e) {
  1615. var t = this;
  1616. void 0 === e && (e = []);
  1617. var r = [],
  1618. o = 0,
  1619. s = 0,
  1620. a = 0,
  1621. l = 0,
  1622. u = 0,
  1623. c = 0;
  1624. this.size = function () { return c }, this.empty = function () { return 0 === c }, this.clear = function () { o = a = s = l = u = c = 0, f.call(this, i.bucketSize), c = 0 }, this.front = function () { return r[o][s] }, this.back = function () { return r[a][l] }, this.forEach = function (e) {
  1625. if (!this.empty()) {
  1626. var t = 0;
  1627. if (o !== a) {
  1628. for (u = s; u < i.bucketSize; ++u) e(r[o][u], t++);
  1629. for (u = o + 1; u < a; ++u)
  1630. for (var n = 0; n < i.bucketSize; ++n) e(r[u][n], t++);
  1631. for (u = 0; u <= l; ++u) e(r[a][u], t++)
  1632. } else
  1633. for (var u = s; u <= l; ++u) e(r[o][u], t++)
  1634. }
  1635. };
  1636. var h = function (e) {
  1637. var t = o * i.bucketSize + s,
  1638. r = t + e,
  1639. n = a * i.bucketSize + l;
  1640. if (r < t || r > n) throw new Error("pos should more than 0 and less than queue's size");
  1641. return { curNodeBucketIndex: Math.floor(r / i.bucketSize), curNodePointerIndex: r % i.bucketSize }
  1642. };
  1643. this.getElementByPos = function (e) {
  1644. var t = h(e),
  1645. n = t.curNodeBucketIndex,
  1646. i = t.curNodePointerIndex;
  1647. return r[n][i]
  1648. }, this.eraseElementByPos = function (e) {
  1649. var t = this;
  1650. if (e < 0 || e > c) throw new Error("pos should more than 0 and less than queue's size");
  1651. if (0 === e) this.popFront();
  1652. else if (e === this.size()) this.popBack();
  1653. else {
  1654. for (var r = [], n = e + 1; n < c; ++n) r.push(this.getElementByPos(n));
  1655. this.cut(e), this.popBack(), r.forEach(function (e) { return t.pushBack(e) })
  1656. }
  1657. }, this.eraseElementByValue = function (e) {
  1658. if (!this.empty()) {
  1659. var t = [];
  1660. this.forEach(function (r) { r !== e && t.push(r) });
  1661. for (var r = t.length, n = 0; n < r; ++n) this.setElementByPos(n, t[n]);
  1662. this.cut(r - 1)
  1663. }
  1664. };
  1665. var f = function (e) {
  1666. for (var t = [], n = e * i.sigma, h = Math.max(Math.ceil(n / i.bucketSize), 2), f = 0; f < h; ++f) t.push(new Array(i.bucketSize));
  1667. var p = Math.ceil(e / i.bucketSize),
  1668. d = Math.floor(h / 2) - Math.floor(p / 2),
  1669. g = d,
  1670. y = 0;
  1671. if (this.size())
  1672. for (f = 0; f < p; ++f) {
  1673. for (var b = 0; b < i.bucketSize; ++b)
  1674. if (t[d + f][b] = this.front(), this.popFront(), this.empty()) { g = d + f, y = b; break } if (this.empty()) break
  1675. }
  1676. r = t, o = d, s = 0, a = g, l = y, u = h, c = e
  1677. };
  1678. this.pushBack = function (e) { this.empty() || (a === u - 1 && l === i.bucketSize - 1 && f.call(this, this.size()), l < i.bucketSize - 1 ? ++l : a < u - 1 && (++a, l = 0)), ++c, r[a][l] = e }, this.popBack = function () { this.empty() || (1 !== this.size() && (l > 0 ? --l : o < a && (--a, l = i.bucketSize - 1)), c > 0 && --c) }, this.setElementByPos = function (e, t) {
  1679. var n = h(e),
  1680. i = n.curNodeBucketIndex,
  1681. o = n.curNodePointerIndex;
  1682. r[i][o] = t
  1683. }, this.insert = function (e, t, r) {
  1684. var n = this;
  1685. if (void 0 === r && (r = 1), 0 === e)
  1686. for (; r--;) this.pushFront(t);
  1687. else if (e === this.size())
  1688. for (; r--;) this.pushBack(t);
  1689. else {
  1690. for (var i = [], o = e; o < c; ++o) i.push(this.getElementByPos(o));
  1691. this.cut(e - 1);
  1692. for (o = 0; o < r; ++o) this.pushBack(t);
  1693. i.forEach(function (e) { return n.pushBack(e) })
  1694. }
  1695. }, this.find = function (e) {
  1696. if (o === a) {
  1697. for (var t = s; t <= l; ++t)
  1698. if (r[o][t] === e) return !0;
  1699. return !1
  1700. }
  1701. for (t = s; t < i.bucketSize; ++t)
  1702. if (r[o][t] === e) return !0;
  1703. for (t = o + 1; t < a; ++t)
  1704. for (var n = 0; n < i.bucketSize; ++n)
  1705. if (r[t][n] === e) return !0;
  1706. for (t = 0; t <= l; ++t)
  1707. if (r[a][t] === e) return !0;
  1708. return !1
  1709. }, this.reverse = function () {
  1710. for (var e = 0, t = c - 1; e < t;) {
  1711. var r = this.getElementByPos(e);
  1712. this.setElementByPos(e, this.getElementByPos(t)), this.setElementByPos(t, r), ++e, --t
  1713. }
  1714. }, this.unique = function () {
  1715. if (!this.empty()) {
  1716. var e = [],
  1717. t = this.front();
  1718. this.forEach(function (r, n) { 0 !== n && r === t || (e.push(r), t = r) });
  1719. for (var r = 0; r < c; ++r) this.setElementByPos(r, e[r]);
  1720. this.cut(e.length - 1)
  1721. }
  1722. }, this.sort = function (e) {
  1723. var t = [];
  1724. this.forEach(function (e) { t.push(e) }), t.sort(e);
  1725. for (var r = 0; r < c; ++r) this.setElementByPos(r, t[r])
  1726. }, this.pushFront = function (e) { this.empty() || (0 === o && 0 === s && f.call(this, this.size()), s > 0 ? --s : o > 0 && (--o, s = i.bucketSize - 1)), ++c, r[o][s] = e }, this.popFront = function () { this.empty() || (1 !== this.size() && (s < i.bucketSize - 1 ? ++s : o < a && (++o, s = 0)), c > 0 && --c) }, this.shrinkToFit = function () {
  1727. var e = this,
  1728. t = [];
  1729. this.forEach(function (e) { t.push(e) });
  1730. var n = t.length;
  1731. r = [];
  1732. for (var o = Math.ceil(n / i.bucketSize), s = 0; s < o; ++s) r.push(new Array(i.bucketSize));
  1733. this.clear(), t.forEach(function (t) { return e.pushBack(t) })
  1734. }, this.cut = function (e) {
  1735. if (e < 0) this.clear();
  1736. else {
  1737. var t = h(e),
  1738. r = t.curNodeBucketIndex,
  1739. n = t.curNodePointerIndex;
  1740. a = r, l = n, c = e + 1
  1741. }
  1742. }, this[Symbol.iterator] = function () {
  1743. return function () {
  1744. var e, t;
  1745. return n(this, function (n) {
  1746. switch (n.label) {
  1747. case 0:
  1748. if (0 === c) return [2];
  1749. if (o !== a) return [3, 5];
  1750. t = s, n.label = 1;
  1751. case 1:
  1752. return t <= l ? [4, r[o][t]] : [3, 4];
  1753. case 2:
  1754. n.sent(), n.label = 3;
  1755. case 3:
  1756. return ++t, [3, 1];
  1757. case 4:
  1758. return [2];
  1759. case 5:
  1760. t = s, n.label = 6;
  1761. case 6:
  1762. return t < i.bucketSize ? [4, r[o][t]] : [3, 9];
  1763. case 7:
  1764. n.sent(), n.label = 8;
  1765. case 8:
  1766. return ++t, [3, 6];
  1767. case 9:
  1768. t = o + 1, n.label = 10;
  1769. case 10:
  1770. if (!(t < a)) return [3, 15];
  1771. e = 0, n.label = 11;
  1772. case 11:
  1773. return e < i.bucketSize ? [4, r[t][e]] : [3, 14];
  1774. case 12:
  1775. n.sent(), n.label = 13;
  1776. case 13:
  1777. return ++e, [3, 11];
  1778. case 14:
  1779. return ++t, [3, 10];
  1780. case 15:
  1781. t = 0, n.label = 16;
  1782. case 16:
  1783. return t <= l ? [4, r[a][t]] : [3, 19];
  1784. case 17:
  1785. n.sent(), n.label = 18;
  1786. case 18:
  1787. return ++t, [3, 16];
  1788. case 19:
  1789. return [2]
  1790. }
  1791. })
  1792. }()
  1793. },
  1794. function () {
  1795. var n = i.bucketSize;
  1796. e.size ? n = e.size() : e.length && (n = e.length);
  1797. var s = n * i.sigma;
  1798. u = Math.ceil(s / i.bucketSize), u = Math.max(u, 3);
  1799. for (var l = 0; l < u; ++l) r.push(new Array(i.bucketSize));
  1800. var c = Math.ceil(n / i.bucketSize);
  1801. o = Math.floor(u / 2) - Math.floor(c / 2), a = o, e.forEach(function (e) { return t.pushBack(e) })
  1802. }(), Object.freeze(this)
  1803. }
  1804. Object.defineProperty(r, "__esModule", { value: !0 }), i.sigma = 3, i.bucketSize = 5e3, Object.freeze(i), r.default = i
  1805. }, {}],
  1806. 27: [function (e, t, r) {
  1807. "use strict";
  1808. var n = this && this.__generator || function (e, t) {
  1809. var r, n, i, o, s = { label: 0, sent: function () { if (1 & i[0]) throw i[1]; return i[1] }, trys: [], ops: [] };
  1810. return o = { next: a(0), throw: a(1), return: a(2) }, "function" == typeof Symbol && (o[Symbol.iterator] = function () { return this }), o;
  1811. function a(o) {
  1812. return function (a) {
  1813. return function (o) {
  1814. if (r) throw new TypeError("Generator is already executing.");
  1815. for (; s;) try {
  1816. if (r = 1, n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n), 0) : n.next) && !(i = i.call(n, o[1])).done) return i;
  1817. switch (n = 0, i && (o = [2 & o[0], i.value]), o[0]) {
  1818. case 0:
  1819. case 1:
  1820. i = o;
  1821. break;
  1822. case 4:
  1823. return s.label++, { value: o[1], done: !1 };
  1824. case 5:
  1825. s.label++, n = o[1], o = [0];
  1826. continue;
  1827. case 7:
  1828. o = s.ops.pop(), s.trys.pop();
  1829. continue;
  1830. default:
  1831. if (!(i = (i = s.trys).length > 0 && i[i.length - 1]) && (6 === o[0] || 2 === o[0])) { s = 0; continue }
  1832. if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) { s.label = o[1]; break }
  1833. if (6 === o[0] && s.label < i[1]) { s.label = i[1], i = o; break }
  1834. if (i && s.label < i[2]) { s.label = i[2], s.ops.push(o); break } i[2] && s.ops.pop(), s.trys.pop();
  1835. continue
  1836. }
  1837. o = t.call(e, s)
  1838. } catch (e) { o = [6, e], n = 0 } finally { r = i = 0 }
  1839. if (5 & o[0]) throw o[1];
  1840. return { value: o[0] ? o[1] : void 0, done: !0 }
  1841. }([o, a])
  1842. }
  1843. }
  1844. },
  1845. i = this && this.__values || function (e) {
  1846. var t = "function" == typeof Symbol && Symbol.iterator,
  1847. r = t && e[t],
  1848. n = 0;
  1849. if (r) return r.call(e);
  1850. if (e && "number" == typeof e.length) return { next: function () { return e && n >= e.length && (e = void 0), { value: e && e[n++], done: !e } } };
  1851. throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.")
  1852. };
  1853. Object.defineProperty(r, "__esModule", { value: !0 });
  1854. var o = e("../LinkList/LinkList"),
  1855. s = e("../Map/Map");
  1856. function a(e, t, r) {
  1857. var l = this;
  1858. if (void 0 === e && (e = []), void 0 === t && (t = a.initSize), r = r || function (e) {
  1859. var t, r, n = 0,
  1860. o = "";
  1861. if ("number" == typeof e) n = ((n = Math.floor(e)) << 5) - n, n &= n;
  1862. else { o = "string" != typeof e ? JSON.stringify(e) : e; try { for (var s = i(o), a = s.next(); !a.done; a = s.next()) { n = (n << 5) - n + a.value.charCodeAt(0), n &= n } } catch (e) { t = { error: e } } finally { try { a && !a.done && (r = s.return) && r.call(s) } finally { if (t) throw t.error } } }
  1863. return n ^= n >>> 16
  1864. }, 0 != (t & t - 1)) throw new Error("initBucketNum must be 2 to the power of n");
  1865. var u = 0,
  1866. c = [],
  1867. h = Math.max(a.initSize, Math.min(a.maxSize, t));
  1868. this.size = function () { return u }, this.empty = function () { return 0 === u }, this.clear = function () { u = 0, h = t, c = [] }, this.forEach = function (e) {
  1869. var t = 0;
  1870. c.forEach(function (r) { r.forEach(function (r) { e(r, t++) }) })
  1871. };
  1872. this.setElement = function (e, t) {
  1873. var n, l;
  1874. if (null === e || void 0 === e) throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");
  1875. if (null !== t && void 0 !== t) {
  1876. var f = r(e) & h - 1;
  1877. if (c[f]) {
  1878. var p = c[f].size();
  1879. if (c[f] instanceof o.default) { try { for (var d = i(c[f]), g = d.next(); !g.done; g = d.next()) { var y = g.value; if (y.key === e) return void(y.value = t) } } catch (e) { n = { error: e } } finally { try { g && !g.done && (l = d.return) && l.call(d) } finally { if (n) throw n.error } } c[f].pushBack({ key: e, value: t }), c[f].size() >= a.treeifyThreshold && (c[f] = new s.default(c[f])) } else c[f].setElement(e, t);
  1880. var b = c[f].size();
  1881. u += b - p
  1882. } else ++u, c[f] = new o.default([{ key: e, value: t }]);
  1883. u > h * a.sigma && function (e) {
  1884. if (!(e >= a.maxSize)) {
  1885. h = 2 * e;
  1886. var t = [];
  1887. c.forEach(function (n, i) {
  1888. if (!n.empty()) {
  1889. if (n instanceof o.default && 1 === n.size()) {
  1890. var l = n.front(),
  1891. u = l.key,
  1892. f = l.value;
  1893. t[r(u) & h - 1] = new o.default([{ key: u, value: f }])
  1894. } else if (n instanceof s.default) {
  1895. var p = new o.default,
  1896. d = new o.default;
  1897. n.forEach(function (t) { 0 == (r(t.key) & e) ? p.pushBack(t) : d.pushBack(t) }), p.size() > a.untreeifyThreshold ? t[i] = new s.default(p) : p.size() && (t[i] = p), d.size() > a.untreeifyThreshold ? t[i + e] = new s.default(d) : d.size() && (t[i + e] = d)
  1898. } else {
  1899. var g = new o.default,
  1900. y = new o.default;
  1901. n.forEach(function (t) { 0 == (r(t.key) & e) ? g.pushBack(t) : y.pushBack(t) }), g.size() && (t[i] = g), y.size() && (t[i + e] = y)
  1902. }
  1903. c[i].clear()
  1904. }
  1905. }), c = t
  1906. }
  1907. }.call(this, h)
  1908. } else this.eraseElementByKey(e)
  1909. }, this.getElementByKey = function (e) { var t, n, o = r(e) & h - 1; if (c[o]) { if (c[o] instanceof s.default) return c[o].getElementByKey(e); try { for (var a = i(c[o]), l = a.next(); !l.done; l = a.next()) { var u = l.value; if (u.key === e) return u.value } } catch (e) { t = { error: e } } finally { try { l && !l.done && (n = a.return) && n.call(a) } finally { if (t) throw t.error } } } }, this.eraseElementByKey = function (e) {
  1910. var t, n, l = r(e) & h - 1;
  1911. if (c[l]) {
  1912. var f = c[l].size();
  1913. if (c[l] instanceof s.default) c[l].eraseElementByKey(e), c[l].size() <= a.untreeifyThreshold && (c[l] = new o.default(c[l]));
  1914. else { var p = -1; try { for (var d = i(c[l]), g = d.next(); !g.done; g = d.next()) { if (++p, g.value.key === e) { c[l].eraseElementByPos(p); break } } } catch (e) { t = { error: e } } finally { try { g && !g.done && (n = d.return) && n.call(d) } finally { if (t) throw t.error } } }
  1915. var y = c[l].size();
  1916. u += y - f
  1917. }
  1918. }, this.find = function (e) { var t, n, o = r(e) & h - 1; if (!c[o]) return !1; if (c[o] instanceof s.default) return c[o].find(e); try { for (var a = i(c[o]), l = a.next(); !l.done; l = a.next()) { if (l.value.key === e) return !0 } } catch (e) { t = { error: e } } finally { try { l && !l.done && (n = a.return) && n.call(a) } finally { if (t) throw t.error } } return !1 }, this[Symbol.iterator] = function () {
  1919. return function () {
  1920. var e, t, r, o, s, a;
  1921. return n(this, function (n) {
  1922. switch (n.label) {
  1923. case 0:
  1924. e = 0, n.label = 1;
  1925. case 1:
  1926. if (!(e < h)) return [3, 10];
  1927. for (; e < h && !c[e];) ++e;
  1928. if (e >= h) return [3, 10];
  1929. n.label = 2;
  1930. case 2:
  1931. n.trys.push([2, 7, 8, 9]), s = void 0, t = i(c[e]), r = t.next(), n.label = 3;
  1932. case 3:
  1933. return r.done ? [3, 6] : [4, r.value];
  1934. case 4:
  1935. n.sent(), n.label = 5;
  1936. case 5:
  1937. return r = t.next(), [3, 3];
  1938. case 6:
  1939. return [3, 9];
  1940. case 7:
  1941. return o = n.sent(), s = { error: o }, [3, 9];
  1942. case 8:
  1943. try { r && !r.done && (a = t.return) && a.call(t) } finally { if (s) throw s.error }
  1944. return [7];
  1945. case 9:
  1946. return ++e, [3, 1];
  1947. case 10:
  1948. return [2]
  1949. }
  1950. })
  1951. }()
  1952. }, e.forEach(function (e) {
  1953. var t = e.key,
  1954. r = e.value;
  1955. return l.setElement(t, r)
  1956. }), Object.freeze(this)
  1957. }
  1958. a.initSize = 16, a.maxSize = 1 << 30, a.sigma = .75, a.treeifyThreshold = 8, a.untreeifyThreshold = 6, a.minTreeifySize = 64, Object.freeze(a), r.default = a
  1959. }, { "../LinkList/LinkList": 29, "../Map/Map": 30 }],
  1960. 28: [function (e, t, r) {
  1961. "use strict";
  1962. var n = this && this.__generator || function (e, t) {
  1963. var r, n, i, o, s = { label: 0, sent: function () { if (1 & i[0]) throw i[1]; return i[1] }, trys: [], ops: [] };
  1964. return o = { next: a(0), throw: a(1), return: a(2) }, "function" == typeof Symbol && (o[Symbol.iterator] = function () { return this }), o;
  1965. function a(o) {
  1966. return function (a) {
  1967. return function (o) {
  1968. if (r) throw new TypeError("Generator is already executing.");
  1969. for (; s;) try {
  1970. if (r = 1, n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n), 0) : n.next) && !(i = i.call(n, o[1])).done) return i;
  1971. switch (n = 0, i && (o = [2 & o[0], i.value]), o[0]) {
  1972. case 0:
  1973. case 1:
  1974. i = o;
  1975. break;
  1976. case 4:
  1977. return s.label++, { value: o[1], done: !1 };
  1978. case 5:
  1979. s.label++, n = o[1], o = [0];
  1980. continue;
  1981. case 7:
  1982. o = s.ops.pop(), s.trys.pop();
  1983. continue;
  1984. default:
  1985. if (!(i = (i = s.trys).length > 0 && i[i.length - 1]) && (6 === o[0] || 2 === o[0])) { s = 0; continue }
  1986. if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) { s.label = o[1]; break }
  1987. if (6 === o[0] && s.label < i[1]) { s.label = i[1], i = o; break }
  1988. if (i && s.label < i[2]) { s.label = i[2], s.ops.push(o); break } i[2] && s.ops.pop(), s.trys.pop();
  1989. continue
  1990. }
  1991. o = t.call(e, s)
  1992. } catch (e) { o = [6, e], n = 0 } finally { r = i = 0 }
  1993. if (5 & o[0]) throw o[1];
  1994. return { value: o[0] ? o[1] : void 0, done: !0 }
  1995. }([o, a])
  1996. }
  1997. }
  1998. },
  1999. i = this && this.__values || function (e) {
  2000. var t = "function" == typeof Symbol && Symbol.iterator,
  2001. r = t && e[t],
  2002. n = 0;
  2003. if (r) return r.call(e);
  2004. if (e && "number" == typeof e.length) return { next: function () { return e && n >= e.length && (e = void 0), { value: e && e[n++], done: !e } } };
  2005. throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.")
  2006. };
  2007. Object.defineProperty(r, "__esModule", { value: !0 });
  2008. var o = e("../Set/Set"),
  2009. s = e("../LinkList/LinkList");
  2010. function a(e, t, r) {
  2011. var l = this;
  2012. if (void 0 === e && (e = []), void 0 === t && (t = a.initSize), r = r || function (e) {
  2013. var t = 0,
  2014. r = "";
  2015. if ("number" == typeof e) t = ((t = Math.floor(e)) << 5) - t, t &= t;
  2016. else { r = "string" != typeof e ? JSON.stringify(e) : e; for (var n = 0; n < r.length; n++) { t = (t << 5) - t + r.charCodeAt(n), t &= t } }
  2017. return t ^= t >>> 16
  2018. }, 0 != (t & t - 1)) throw new Error("initBucketNum must be 2 to the power of n");
  2019. var u = 0,
  2020. c = [],
  2021. h = Math.max(a.initSize, Math.min(a.maxSize, t));
  2022. this.size = function () { return u }, this.empty = function () { return 0 === u }, this.clear = function () { u = 0, h = t, c = [] }, this.forEach = function (e) {
  2023. var t = 0;
  2024. c.forEach(function (r) { r.forEach(function (r) { e(r, t++) }) })
  2025. };
  2026. this.insert = function (e) {
  2027. if (null === e || void 0 === e) throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");
  2028. var t = r(e) & h - 1;
  2029. if (c[t]) {
  2030. var n = c[t].size();
  2031. if (c[t] instanceof s.default) {
  2032. if (c[t].find(e)) return;
  2033. c[t].pushBack(e), c[t].size() >= a.treeifyThreshold && (c[t] = new o.default(c[t]))
  2034. } else c[t].insert(e);
  2035. var i = c[t].size();
  2036. u += i - n
  2037. } else c[t] = new s.default([e]), ++u;
  2038. u > h * a.sigma && function (e) {
  2039. if (!(e >= a.maxSize)) {
  2040. h = 2 * e;
  2041. var t = [];
  2042. c.forEach(function (n, i) {
  2043. if (!n.empty()) {
  2044. if (n instanceof s.default && 1 === n.size()) {
  2045. var l = n.front();
  2046. if (void 0 === l) throw new Error("unknown error");
  2047. t[r(l) & h - 1] = new s.default([l])
  2048. } else if (n instanceof o.default) {
  2049. var u = new s.default,
  2050. f = new s.default;
  2051. n.forEach(function (t) { 0 == (r(t) & e) ? u.pushBack(t) : f.pushBack(t) }), u.size() > a.untreeifyThreshold ? t[i] = new o.default(u) : u.size() && (t[i] = u), f.size() > a.untreeifyThreshold ? t[i + e] = new o.default(f) : f.size() && (t[i + e] = f)
  2052. } else {
  2053. var p = new s.default,
  2054. d = new s.default;
  2055. n.forEach(function (t) { 0 == (r(t) & e) ? p.pushBack(t) : d.pushBack(t) }), p.size() && (t[i] = p), d.size() && (t[i + e] = d)
  2056. }
  2057. c[i].clear()
  2058. }
  2059. }), c = t
  2060. }
  2061. }.call(this, h)
  2062. }, this.eraseElementByValue = function (e) {
  2063. var t = r(e) & h - 1;
  2064. if (c[t]) {
  2065. var n = c[t].size();
  2066. c[t].eraseElementByValue(e), c[t] instanceof o.default && c[t].size() <= a.untreeifyThreshold && (c[t] = new s.default(c[t]));
  2067. var i = c[t].size();
  2068. u += i - n
  2069. }
  2070. }, this.find = function (e) { var t = r(e) & h - 1; return !!c[t] && c[t].find(e) }, this[Symbol.iterator] = function () {
  2071. return function () {
  2072. var e, t, r, o, s, a;
  2073. return n(this, function (n) {
  2074. switch (n.label) {
  2075. case 0:
  2076. e = 0, n.label = 1;
  2077. case 1:
  2078. if (!(e < h)) return [3, 10];
  2079. for (; e < h && !c[e];) ++e;
  2080. if (e >= h) return [3, 10];
  2081. n.label = 2;
  2082. case 2:
  2083. n.trys.push([2, 7, 8, 9]), s = void 0, t = i(c[e]), r = t.next(), n.label = 3;
  2084. case 3:
  2085. return r.done ? [3, 6] : [4, r.value];
  2086. case 4:
  2087. n.sent(), n.label = 5;
  2088. case 5:
  2089. return r = t.next(), [3, 3];
  2090. case 6:
  2091. return [3, 9];
  2092. case 7:
  2093. return o = n.sent(), s = { error: o }, [3, 9];
  2094. case 8:
  2095. try { r && !r.done && (a = t.return) && a.call(t) } finally { if (s) throw s.error }
  2096. return [7];
  2097. case 9:
  2098. return ++e, [3, 1];
  2099. case 10:
  2100. return [2]
  2101. }
  2102. })
  2103. }()
  2104. }, e.forEach(function (e) { return l.insert(e) }), Object.freeze(this)
  2105. }
  2106. a.initSize = 16, a.maxSize = 1 << 30, a.sigma = .75, a.treeifyThreshold = 8, a.untreeifyThreshold = 6, a.minTreeifySize = 64, Object.freeze(a), r.default = a
  2107. }, { "../LinkList/LinkList": 29, "../Set/Set": 33 }],
  2108. 29: [function (e, t, r) {
  2109. "use strict";
  2110. var n = this && this.__generator || function (e, t) {
  2111. var r, n, i, o, s = { label: 0, sent: function () { if (1 & i[0]) throw i[1]; return i[1] }, trys: [], ops: [] };
  2112. return o = { next: a(0), throw: a(1), return: a(2) }, "function" == typeof Symbol && (o[Symbol.iterator] = function () { return this }), o;
  2113. function a(o) {
  2114. return function (a) {
  2115. return function (o) {
  2116. if (r) throw new TypeError("Generator is already executing.");
  2117. for (; s;) try {
  2118. if (r = 1, n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n), 0) : n.next) && !(i = i.call(n, o[1])).done) return i;
  2119. switch (n = 0, i && (o = [2 & o[0], i.value]), o[0]) {
  2120. case 0:
  2121. case 1:
  2122. i = o;
  2123. break;
  2124. case 4:
  2125. return s.label++, { value: o[1], done: !1 };
  2126. case 5:
  2127. s.label++, n = o[1], o = [0];
  2128. continue;
  2129. case 7:
  2130. o = s.ops.pop(), s.trys.pop();
  2131. continue;
  2132. default:
  2133. if (!(i = (i = s.trys).length > 0 && i[i.length - 1]) && (6 === o[0] || 2 === o[0])) { s = 0; continue }
  2134. if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) { s.label = o[1]; break }
  2135. if (6 === o[0] && s.label < i[1]) { s.label = i[1], i = o; break }
  2136. if (i && s.label < i[2]) { s.label = i[2], s.ops.push(o); break } i[2] && s.ops.pop(), s.trys.pop();
  2137. continue
  2138. }
  2139. o = t.call(e, s)
  2140. } catch (e) { o = [6, e], n = 0 } finally { r = i = 0 }
  2141. if (5 & o[0]) throw o[1];
  2142. return { value: o[0] ? o[1] : void 0, done: !0 }
  2143. }([o, a])
  2144. }
  2145. }
  2146. };
  2147. Object.defineProperty(r, "__esModule", { value: !0 });
  2148. var i = function () { return function (e) { this.value = void 0, this.pre = void 0, this.next = void 0, this.value = e } }();
  2149. function o(e) {
  2150. var t = this;
  2151. void 0 === e && (e = []);
  2152. var r = 0,
  2153. o = void 0,
  2154. s = void 0;
  2155. this.size = function () { return r }, this.empty = function () { return 0 === r }, this.clear = function () { o = s = void 0, r = 0 }, this.front = function () { return null === o || void 0 === o ? void 0 : o.value }, this.back = function () { return null === s || void 0 === s ? void 0 : s.value }, this.forEach = function (e) {
  2156. for (var t = o, r = 0; t;) {
  2157. if (void 0 === t.value) throw new Error("unknown error");
  2158. e(t.value, r++), t = t.next
  2159. }
  2160. }, this.getElementByPos = function (e) { if (e < 0 || e >= r) throw new Error("pos must more then 0 and less then the list length"); for (var t = o; e-- && t;) t = t.next; if (!t || void 0 === t.value) throw new Error("unknown error"); return t.value }, this.eraseElementByPos = function (e) {
  2161. if (e < 0 || e >= r) throw new Error("erase pos must more then 0 and less then the list length");
  2162. if (0 === e) this.popFront();
  2163. else if (e === r - 1) this.popBack();
  2164. else {
  2165. for (var t = o; e--;) {
  2166. if (!(null === t || void 0 === t ? void 0 : t.next)) throw new Error("unknown error");
  2167. t = t.next
  2168. }
  2169. if (!t || !t.pre || !t.next) throw new Error("unknown error");
  2170. var n = t.pre,
  2171. i = t.next;
  2172. i.pre = n, n.next = i, r > 0 && --r
  2173. }
  2174. }, this.eraseElementByValue = function (e) {
  2175. for (; o && o.value === e;) this.popFront();
  2176. for (; s && s.value === e;) this.popBack();
  2177. if (o)
  2178. for (var t = o; t;) {
  2179. if (t.value === e) {
  2180. var n = t.pre,
  2181. i = t.next;
  2182. i && (i.pre = n), n && (n.next = i), r > 0 && --r
  2183. }
  2184. t = t.next
  2185. }
  2186. }, this.pushBack = function (e) {
  2187. if (null === e || void 0 === e) throw new Error("you can't push null or undefined here");
  2188. ++r;
  2189. var t = new i(e);
  2190. s ? (s.next = t, t.pre = s, s = t) : o = s = t
  2191. }, this.popBack = function () { s && (r > 0 && --r, s && (o === s ? o = s = void 0 : (s = s.pre) && (s.next = void 0))) }, this.setElementByPos = function (e, t) {
  2192. if (null === t || void 0 === t) throw new Error("you can't set null or undefined here");
  2193. if (e < 0 || e >= r) throw new Error("pos must more then 0 and less then the list length");
  2194. for (var n = o; e--;) {
  2195. if (!n) throw new Error("unknown error");
  2196. n = n.next
  2197. }
  2198. n && (n.value = t)
  2199. }, this.insert = function (e, t, n) {
  2200. if (void 0 === n && (n = 1), null === t || void 0 === t) throw new Error("you can't insert null or undefined here");
  2201. if (e < 0 || e > r) throw new Error("insert pos must more then 0 and less then or equal to the list length");
  2202. if (n < 0) throw new Error("insert size must more than 0");
  2203. if (0 === e)
  2204. for (; n--;) this.pushFront(t);
  2205. else if (e === r)
  2206. for (; n--;) this.pushBack(t);
  2207. else {
  2208. for (var s = o, a = 1; a < e; ++a) {
  2209. if (!(null === s || void 0 === s ? void 0 : s.next)) throw new Error("unknown error");
  2210. s = null === s || void 0 === s ? void 0 : s.next
  2211. }
  2212. if (!s) throw new Error("unknown error");
  2213. var l = s.next;
  2214. for (r += n; n--;) s.next = new i(t), s.next.pre = s, s = s.next;
  2215. s.next = l, l && (l.pre = s)
  2216. }
  2217. }, this.find = function (e) {
  2218. for (var t = o; t;) {
  2219. if (t.value === e) return !0;
  2220. t = t.next
  2221. }
  2222. return !1
  2223. }, this.reverse = function () {
  2224. for (var e = o, t = s, n = 0; e && t && 2 * n < r;) {
  2225. var i = e.value;
  2226. e.value = t.value, t.value = i, e = e.next, t = t.pre, ++n
  2227. }
  2228. }, this.unique = function () {
  2229. for (var e = o; e;) {
  2230. for (var t = e; t && t.next && t.value === t.next.value;) t = t.next, r > 0 && --r;
  2231. e.next = t.next, e.next && (e.next.pre = e), e = e.next
  2232. }
  2233. }, this.sort = function (e) {
  2234. var t = [];
  2235. this.forEach(function (e) { t.push(e) }), t.sort(e);
  2236. var r = o;
  2237. t.forEach(function (e) { r && (r.value = e, r = r.next) })
  2238. }, this.pushFront = function (e) {
  2239. if (null === e || void 0 === e) throw new Error("you can't push null or undefined here");
  2240. ++r;
  2241. var t = new i(e);
  2242. o ? (t.next = o, o.pre = t, o = t) : o = s = t
  2243. }, this.popFront = function () { o && (r > 0 && --r, o && (o === s ? o = s = void 0 : (o = o.next) && (o.pre = void 0))) }, this.merge = function (e) {
  2244. var t = this,
  2245. n = o;
  2246. e.forEach(function (e) {
  2247. for (; n && void 0 !== n.value && n.value <= e;) n = n.next;
  2248. if (void 0 === n) t.pushBack(e), n = s;
  2249. else if (n === o) t.pushFront(e), n = o;
  2250. else {
  2251. ++r;
  2252. var a = n.pre;
  2253. a && (a.next = new i(e), a.next.pre = a, a.next.next = n, n && (n.pre = a.next))
  2254. }
  2255. })
  2256. }, this[Symbol.iterator] = function () {
  2257. return function () {
  2258. var e;
  2259. return n(this, function (t) {
  2260. switch (t.label) {
  2261. case 0:
  2262. e = o, t.label = 1;
  2263. case 1:
  2264. if (void 0 === e) return [3, 3];
  2265. if (!e.value) throw new Error("unknown error");
  2266. return [4, e.value];
  2267. case 2:
  2268. return t.sent(), e = e.next, [3, 1];
  2269. case 3:
  2270. return [2]
  2271. }
  2272. })
  2273. }()
  2274. }, e.forEach(function (e) { return t.pushBack(e) }), Object.freeze(this)
  2275. }
  2276. Object.freeze(o), r.default = o
  2277. }, {}],
  2278. 30: [function (e, t, r) {
  2279. "use strict";
  2280. var n = this && this.__generator || function (e, t) {
  2281. var r, n, i, o, s = { label: 0, sent: function () { if (1 & i[0]) throw i[1]; return i[1] }, trys: [], ops: [] };
  2282. return o = { next: a(0), throw: a(1), return: a(2) }, "function" == typeof Symbol && (o[Symbol.iterator] = function () { return this }), o;
  2283. function a(o) {
  2284. return function (a) {
  2285. return function (o) {
  2286. if (r) throw new TypeError("Generator is already executing.");
  2287. for (; s;) try {
  2288. if (r = 1, n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n), 0) : n.next) && !(i = i.call(n, o[1])).done) return i;
  2289. switch (n = 0, i && (o = [2 & o[0], i.value]), o[0]) {
  2290. case 0:
  2291. case 1:
  2292. i = o;
  2293. break;
  2294. case 4:
  2295. return s.label++, { value: o[1], done: !1 };
  2296. case 5:
  2297. s.label++, n = o[1], o = [0];
  2298. continue;
  2299. case 7:
  2300. o = s.ops.pop(), s.trys.pop();
  2301. continue;
  2302. default:
  2303. if (!(i = (i = s.trys).length > 0 && i[i.length - 1]) && (6 === o[0] || 2 === o[0])) { s = 0; continue }
  2304. if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) { s.label = o[1]; break }
  2305. if (6 === o[0] && s.label < i[1]) { s.label = i[1], i = o; break }
  2306. if (i && s.label < i[2]) { s.label = i[2], s.ops.push(o); break } i[2] && s.ops.pop(), s.trys.pop();
  2307. continue
  2308. }
  2309. o = t.call(e, s)
  2310. } catch (e) { o = [6, e], n = 0 } finally { r = i = 0 }
  2311. if (5 & o[0]) throw o[1];
  2312. return { value: o[0] ? o[1] : void 0, done: !0 }
  2313. }([o, a])
  2314. }
  2315. }
  2316. },
  2317. i = this && this.__values || function (e) {
  2318. var t = "function" == typeof Symbol && Symbol.iterator,
  2319. r = t && e[t],
  2320. n = 0;
  2321. if (r) return r.call(e);
  2322. if (e && "number" == typeof e.length) return { next: function () { return e && n >= e.length && (e = void 0), { value: e && e[n++], done: !e } } };
  2323. throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.")
  2324. };
  2325. Object.defineProperty(r, "__esModule", { value: !0 });
  2326. var o = e("../Base/TreeNode");
  2327. function s(e, t) {
  2328. var r = this;
  2329. void 0 === e && (e = []), t = t || function (e, t) { return e < t ? -1 : e > t ? 1 : 0 };
  2330. var s = 0,
  2331. a = new o.default;
  2332. a.color = o.default.TreeNodeColorType.black, this.size = function () { return s }, this.empty = function () { return 0 === s }, this.clear = function () { s = 0, a.key = a.value = void 0, a.leftChild = a.rightChild = a.brother = void 0 };
  2333. var l = function (e) { if (!e || void 0 === e.key) throw new Error("unknown error"); return e.leftChild ? l(e.leftChild) : e },
  2334. u = function (e) { if (!e || void 0 === e.key) throw new Error("unknown error"); return e.rightChild ? u(e.rightChild) : e };
  2335. this.front = function () { if (!this.empty()) { var e = l(a); if (void 0 === e.key || void 0 === e.value) throw new Error("unknown error"); return { key: e.key, value: e.value } } }, this.back = function () { if (!this.empty()) { var e = u(a); if (void 0 === e.key || void 0 === e.value) throw new Error("unknown error"); return { key: e.key, value: e.value } } }, this.forEach = function (e) { var t, r, n = 0; try { for (var o = i(this), s = o.next(); !s.done; s = o.next()) { e(s.value, n++) } } catch (e) { t = { error: e } } finally { try { s && !s.done && (r = o.return) && r.call(o) } finally { if (t) throw t.error } } }, this.getElementByPos = function (e) { var t, r; if (e < 0 || e >= this.size()) throw new Error("pos must more than 0 and less than set's size"); var n = 0; try { for (var o = i(this), s = o.next(); !s.done; s = o.next()) { var a = s.value; if (n === e) return a;++n } } catch (e) { t = { error: e } } finally { try { s && !s.done && (r = o.return) && r.call(o) } finally { if (t) throw t.error } } throw new Error("unknown Error") };
  2336. var c = function (e, r) { if (e && void 0 !== e.key && void 0 !== e.value) { var n = t(e.key, r); return 0 === n ? { key: e.key, value: e.value } : n < 0 ? c(e.rightChild, r) : c(e.leftChild, r) || { key: e.key, value: e.value } } };
  2337. this.lowerBound = function (e) { return c(a, e) };
  2338. var h = function (e, r) { if (e && void 0 !== e.key && void 0 !== e.value) return t(e.key, r) <= 0 ? h(e.rightChild, r) : h(e.leftChild, r) || { key: e.key, value: e.value } };
  2339. this.upperBound = function (e) { return h(a, e) };
  2340. var f = function (e, r) { if (e && void 0 !== e.key && void 0 !== e.value) { var n = t(e.key, r); return 0 === n ? { key: e.key, value: e.value } : n > 0 ? f(e.leftChild, r) : f(e.rightChild, r) || { key: e.key, value: e.value } } };
  2341. this.reverseLowerBound = function (e) { return f(a, e) };
  2342. var p = function (e, r) { if (e && void 0 !== e.key && void 0 !== e.value) return t(e.key, r) >= 0 ? p(e.leftChild, r) : p(e.rightChild, r) || { key: e.key, value: e.value } };
  2343. this.reverseUpperBound = function (e) { return p(a, e) };
  2344. var d = function (e) {
  2345. var t = e.parent;
  2346. if (!t) { if (e === a) return; throw new Error("unknown error") }
  2347. if (e.color !== o.default.TreeNodeColorType.red) {
  2348. var r = e.brother;
  2349. if (!r) throw new Error("unknown error");
  2350. if (e === t.leftChild) {
  2351. if (r.color === o.default.TreeNodeColorType.red) {
  2352. r.color = o.default.TreeNodeColorType.black, t.color = o.default.TreeNodeColorType.red;
  2353. var n = t.rotateLeft();
  2354. a === t && (a = n), d(e)
  2355. } else if (r.color === o.default.TreeNodeColorType.black)
  2356. if (r.rightChild && r.rightChild.color === o.default.TreeNodeColorType.red) {
  2357. r.color = t.color, t.color = o.default.TreeNodeColorType.black, r.rightChild && (r.rightChild.color = o.default.TreeNodeColorType.black);
  2358. n = t.rotateLeft();
  2359. a === t && (a = n), e.color = o.default.TreeNodeColorType.black
  2360. } else if (r.rightChild && r.rightChild.color !== o.default.TreeNodeColorType.black || !r.leftChild || r.leftChild.color !== o.default.TreeNodeColorType.red) r.leftChild && r.leftChild.color !== o.default.TreeNodeColorType.black || r.rightChild && r.rightChild.color !== o.default.TreeNodeColorType.black || (r.color = o.default.TreeNodeColorType.red, d(t));
  2361. else {
  2362. r.color = o.default.TreeNodeColorType.red, r.leftChild && (r.leftChild.color = o.default.TreeNodeColorType.black);
  2363. n = r.rotateRight();
  2364. a === r && (a = n), d(e)
  2365. }
  2366. } else if (e === t.rightChild)
  2367. if (r.color === o.default.TreeNodeColorType.red) {
  2368. r.color = o.default.TreeNodeColorType.black, t.color = o.default.TreeNodeColorType.red;
  2369. n = t.rotateRight();
  2370. a === t && (a = n), d(e)
  2371. } else if (r.color === o.default.TreeNodeColorType.black)
  2372. if (r.leftChild && r.leftChild.color === o.default.TreeNodeColorType.red) {
  2373. r.color = t.color, t.color = o.default.TreeNodeColorType.black, r.leftChild && (r.leftChild.color = o.default.TreeNodeColorType.black);
  2374. n = t.rotateRight();
  2375. a === t && (a = n), e.color = o.default.TreeNodeColorType.black
  2376. } else if (r.leftChild && r.leftChild.color !== o.default.TreeNodeColorType.black || !r.rightChild || r.rightChild.color !== o.default.TreeNodeColorType.red) r.leftChild && r.leftChild.color !== o.default.TreeNodeColorType.black || r.rightChild && r.rightChild.color !== o.default.TreeNodeColorType.black || (r.color = o.default.TreeNodeColorType.red, d(t));
  2377. else {
  2378. r.color = o.default.TreeNodeColorType.red, r.rightChild && (r.rightChild.color = o.default.TreeNodeColorType.black);
  2379. n = r.rotateLeft();
  2380. a === r && (a = n), d(e)
  2381. }
  2382. } else e.color = o.default.TreeNodeColorType.black
  2383. },
  2384. g = function (e) {
  2385. for (var t = e; t.leftChild || t.rightChild;) {
  2386. if (t.rightChild) {
  2387. t = l(t.rightChild);
  2388. var r = e.key;
  2389. e.key = t.key, t.key = r;
  2390. var n = e.value;
  2391. e.value = t.value, t.value = n, e = t
  2392. }
  2393. if (t.leftChild) {
  2394. t = u(t.leftChild);
  2395. r = e.key;
  2396. e.key = t.key, t.key = r;
  2397. n = e.value;
  2398. e.value = t.value, t.value = n, e = t
  2399. }
  2400. }
  2401. d(t), t && t.remove(), --s, a.color = o.default.TreeNodeColorType.black
  2402. },
  2403. y = function (e, t) { return !(!e || void 0 === e.key) && (!!y(e.leftChild, t) || (!!t(e) || y(e.rightChild, t))) };
  2404. this.eraseElementByPos = function (e) {
  2405. if (e < 0 || e >= s) throw new Error("pos must more than 0 and less than set's size");
  2406. var t = 0;
  2407. y(a, function (r) { return e === t ? (g(r), !0) : (++t, !1) })
  2408. }, this.eraseElementByKey = function (e) {
  2409. if (!this.empty()) {
  2410. var r = v(a, e);
  2411. void 0 !== r && void 0 !== r.key && 0 === t(r.key, e) && g(r)
  2412. }
  2413. };
  2414. var b = function (e, r) { if (!e || void 0 === e.key) throw new Error("unknown error"); var n = t(r, e.key); return n < 0 ? e.leftChild ? b(e.leftChild, r) : (e.leftChild = new o.default, e.leftChild.parent = e, e.leftChild.brother = e.rightChild, e.rightChild && (e.rightChild.brother = e.leftChild), e.leftChild) : n > 0 ? e.rightChild ? b(e.rightChild, r) : (e.rightChild = new o.default, e.rightChild.parent = e, e.rightChild.brother = e.leftChild, e.leftChild && (e.leftChild.brother = e.rightChild), e.rightChild) : e },
  2415. m = function (e) {
  2416. var t = e.parent;
  2417. if (!t) { if (e === a) return; throw new Error("unknown error") }
  2418. if (t.color !== o.default.TreeNodeColorType.black && t.color === o.default.TreeNodeColorType.red) {
  2419. var r = t.brother,
  2420. n = t.parent;
  2421. if (!n) throw new Error("unknown error");
  2422. if (r && r.color === o.default.TreeNodeColorType.red) r.color = t.color = o.default.TreeNodeColorType.black, n.color = o.default.TreeNodeColorType.red, m(n);
  2423. else if (!r || r.color === o.default.TreeNodeColorType.black)
  2424. if (t === n.leftChild) {
  2425. if (e === t.leftChild) {
  2426. t.color = o.default.TreeNodeColorType.black, n.color = o.default.TreeNodeColorType.red;
  2427. var i = n.rotateRight();
  2428. n === a && (a = i)
  2429. } else if (e === t.rightChild) {
  2430. i = t.rotateLeft();
  2431. n === a && (a = i), m(t)
  2432. }
  2433. } else if (t === n.rightChild)
  2434. if (e === t.leftChild) {
  2435. i = t.rotateRight();
  2436. n === a && (a = i), m(t)
  2437. } else if (e === t.rightChild) {
  2438. t.color = o.default.TreeNodeColorType.black, n.color = o.default.TreeNodeColorType.red;
  2439. i = n.rotateLeft();
  2440. n === a && (a = i)
  2441. }
  2442. }
  2443. };
  2444. this.setElement = function (e, r) {
  2445. if (null === e || void 0 === e) throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");
  2446. if (null !== r && void 0 !== r) {
  2447. if (this.empty()) return ++s, a.key = e, a.value = r, void(a.color = o.default.TreeNodeColorType.black);
  2448. var n = b(a, e);
  2449. void 0 === n.key || 0 !== t(n.key, e) ? (++s, n.key = e, n.value = r, m(n), a.color = o.default.TreeNodeColorType.black) : n.value = r
  2450. } else this.eraseElementByKey(e)
  2451. };
  2452. var v = function (e, r) { if (e && void 0 !== e.key) { var n = t(r, e.key); return n < 0 ? v(e.leftChild, r) : n > 0 ? v(e.rightChild, r) : e } };
  2453. this.find = function (e) { return !!v(a, e) }, this.getElementByKey = function (e) { var t = v(a, e); if (void 0 === (null === t || void 0 === t ? void 0 : t.key) || void 0 === (null === t || void 0 === t ? void 0 : t.value)) throw new Error("unknown error"); return t.value }, this.union = function (e) {
  2454. var t = this;
  2455. e.forEach(function (e) {
  2456. var r = e.key,
  2457. n = e.value;
  2458. return t.setElement(r, n)
  2459. })
  2460. }, this.getHeight = function () { if (this.empty()) return 0; var e = function (t) { return t ? Math.max(e(t.leftChild), e(t.rightChild)) + 1 : 1 }; return e(a) };
  2461. var w = function (e) {
  2462. return n(this, function (t) {
  2463. switch (t.label) {
  2464. case 0:
  2465. return e && void 0 !== e.key && void 0 !== e.value ? [5, i(w(e.leftChild))] : [2];
  2466. case 1:
  2467. return t.sent(), [4, { key: e.key, value: e.value }];
  2468. case 2:
  2469. return t.sent(), [5, i(w(e.rightChild))];
  2470. case 3:
  2471. return t.sent(), [2]
  2472. }
  2473. })
  2474. };
  2475. this[Symbol.iterator] = function () { return w(a) }, e.forEach(function (e) {
  2476. var t = e.key,
  2477. n = e.value;
  2478. return r.setElement(t, n)
  2479. }), Object.freeze(this)
  2480. }
  2481. Object.freeze(s), r.default = s
  2482. }, { "../Base/TreeNode": 25 }],
  2483. 31: [function (e, t, r) {
  2484. "use strict";
  2485. function n(e, t) {
  2486. void 0 === e && (e = []), t = t || function (e, t) { return e > t ? -1 : e < t ? 1 : 0 };
  2487. var r = [];
  2488. e.forEach(function (e) { return r.push(e) });
  2489. var n = r.length,
  2490. i = function (e, t) {
  2491. if (e < 0 || e >= n) throw new Error("unknown error");
  2492. if (t < 0 || t >= n) throw new Error("unknown error");
  2493. var i = r[e];
  2494. r[e] = r[t], r[t] = i
  2495. },
  2496. o = function (e) {
  2497. if (e < 0 || e >= n) throw new Error("unknown error");
  2498. var o = 2 * e + 1,
  2499. s = 2 * e + 2;
  2500. o < n && t(r[e], r[o]) > 0 && i(e, o), s < n && t(r[e], r[s]) > 0 && i(e, s)
  2501. };
  2502. ! function () {
  2503. for (var e = Math.floor((n - 1) / 2); e >= 0; --e)
  2504. for (var o = e, s = 2 * o + 1; s < n;) {
  2505. var a = s + 1,
  2506. l = s;
  2507. if (a < n && t(r[s], r[a]) > 0 && (l = a), t(r[o], r[l]) <= 0) break;
  2508. i(o, l), s = 2 * (o = l) + 1
  2509. }
  2510. }(), this.size = function () { return n }, this.empty = function () { return 0 === n }, this.clear = function () { n = 0, r.length = 0 }, this.push = function (e) {
  2511. if (r.push(e), 1 !== ++n)
  2512. for (var i = n - 1; i > 0;) {
  2513. var s = Math.floor((i - 1) / 2);
  2514. if (t(r[s], e) <= 0) break;
  2515. o(s), i = s
  2516. }
  2517. }, this.pop = function () {
  2518. if (!this.empty())
  2519. if (1 !== this.size()) {
  2520. var e = r[n - 1];
  2521. --n;
  2522. for (var i = 0; i < this.size();) {
  2523. var o = 2 * i + 1,
  2524. s = 2 * i + 2;
  2525. if (o >= this.size()) break;
  2526. var a = o;
  2527. if (s < this.size() && t(r[o], r[s]) > 0 && (a = s), t(r[a], e) >= 0) break;
  2528. r[i] = r[a], i = a
  2529. }
  2530. r[i] = e
  2531. } else --n
  2532. }, this.top = function () { return r[0] }, Object.freeze(this)
  2533. }
  2534. Object.defineProperty(r, "__esModule", { value: !0 }), Object.freeze(n), r.default = n
  2535. }, {}],
  2536. 32: [function (e, t, r) {
  2537. "use strict";
  2538. Object.defineProperty(r, "__esModule", { value: !0 });
  2539. var n = e("../LinkList/LinkList");
  2540. function i(e) {
  2541. void 0 === e && (e = []);
  2542. var t = new n.default(e);
  2543. this.size = function () { return t.size() }, this.empty = function () { return t.empty() }, this.clear = function () { t.clear() }, this.push = function (e) { t.pushBack(e) }, this.pop = function () { t.popFront() }, this.front = function () { return t.front() }, Object.freeze(this)
  2544. }
  2545. Object.freeze(i), r.default = i
  2546. }, { "../LinkList/LinkList": 29 }],
  2547. 33: [function (e, t, r) {
  2548. "use strict";
  2549. var n = this && this.__generator || function (e, t) {
  2550. var r, n, i, o, s = { label: 0, sent: function () { if (1 & i[0]) throw i[1]; return i[1] }, trys: [], ops: [] };
  2551. return o = { next: a(0), throw: a(1), return: a(2) }, "function" == typeof Symbol && (o[Symbol.iterator] = function () { return this }), o;
  2552. function a(o) {
  2553. return function (a) {
  2554. return function (o) {
  2555. if (r) throw new TypeError("Generator is already executing.");
  2556. for (; s;) try {
  2557. if (r = 1, n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n), 0) : n.next) && !(i = i.call(n, o[1])).done) return i;
  2558. switch (n = 0, i && (o = [2 & o[0], i.value]), o[0]) {
  2559. case 0:
  2560. case 1:
  2561. i = o;
  2562. break;
  2563. case 4:
  2564. return s.label++, { value: o[1], done: !1 };
  2565. case 5:
  2566. s.label++, n = o[1], o = [0];
  2567. continue;
  2568. case 7:
  2569. o = s.ops.pop(), s.trys.pop();
  2570. continue;
  2571. default:
  2572. if (!(i = (i = s.trys).length > 0 && i[i.length - 1]) && (6 === o[0] || 2 === o[0])) { s = 0; continue }
  2573. if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) { s.label = o[1]; break }
  2574. if (6 === o[0] && s.label < i[1]) { s.label = i[1], i = o; break }
  2575. if (i && s.label < i[2]) { s.label = i[2], s.ops.push(o); break } i[2] && s.ops.pop(), s.trys.pop();
  2576. continue
  2577. }
  2578. o = t.call(e, s)
  2579. } catch (e) { o = [6, e], n = 0 } finally { r = i = 0 }
  2580. if (5 & o[0]) throw o[1];
  2581. return { value: o[0] ? o[1] : void 0, done: !0 }
  2582. }([o, a])
  2583. }
  2584. }
  2585. },
  2586. i = this && this.__values || function (e) {
  2587. var t = "function" == typeof Symbol && Symbol.iterator,
  2588. r = t && e[t],
  2589. n = 0;
  2590. if (r) return r.call(e);
  2591. if (e && "number" == typeof e.length) return { next: function () { return e && n >= e.length && (e = void 0), { value: e && e[n++], done: !e } } };
  2592. throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.")
  2593. };
  2594. Object.defineProperty(r, "__esModule", { value: !0 });
  2595. var o = e("../Base/TreeNode");
  2596. function s(e, t) {
  2597. var r = this;
  2598. void 0 === e && (e = []), t = t || function (e, t) { return e < t ? -1 : e > t ? 1 : 0 };
  2599. var s = 0,
  2600. a = new o.default;
  2601. a.color = o.default.TreeNodeColorType.black, this.size = function () { return s }, this.empty = function () { return 0 === s }, this.clear = function () { s = 0, a.key = void 0, a.leftChild = a.rightChild = a.brother = a.parent = void 0, a.color = o.default.TreeNodeColorType.black };
  2602. var l = function (e) { if (!e || void 0 === e.key) throw new Error("unknown error"); return e.leftChild ? l(e.leftChild) : e },
  2603. u = function (e) { if (!e || void 0 === e.key) throw new Error("unknown error"); return e.rightChild ? u(e.rightChild) : e };
  2604. this.front = function () { if (!this.empty()) return l(a).key }, this.back = function () { if (!this.empty()) return u(a).key }, this.forEach = function (e) { var t, r, n = 0; try { for (var o = i(this), s = o.next(); !s.done; s = o.next()) { e(s.value, n++) } } catch (e) { t = { error: e } } finally { try { s && !s.done && (r = o.return) && r.call(o) } finally { if (t) throw t.error } } }, this.getElementByPos = function (e) { var t, r; if (e < 0 || e >= this.size()) throw new Error("pos must more than 0 and less than set's size"); var n = 0; try { for (var o = i(this), s = o.next(); !s.done; s = o.next()) { var a = s.value; if (n === e) return a;++n } } catch (e) { t = { error: e } } finally { try { s && !s.done && (r = o.return) && r.call(o) } finally { if (t) throw t.error } } throw new Error("unknown error") };
  2605. var c = function (e) {
  2606. var t = e.parent;
  2607. if (!t) { if (e === a) return; throw new Error("unknown error") }
  2608. if (e.color !== o.default.TreeNodeColorType.red) {
  2609. var r = e.brother;
  2610. if (!r) throw new Error("unknown error");
  2611. if (e === t.leftChild) {
  2612. if (r.color === o.default.TreeNodeColorType.red) {
  2613. r.color = o.default.TreeNodeColorType.black, t.color = o.default.TreeNodeColorType.red;
  2614. var n = t.rotateLeft();
  2615. a === t && (a = n), c(e)
  2616. } else if (r.color === o.default.TreeNodeColorType.black)
  2617. if (r.rightChild && r.rightChild.color === o.default.TreeNodeColorType.red) {
  2618. r.color = t.color, t.color = o.default.TreeNodeColorType.black, r.rightChild && (r.rightChild.color = o.default.TreeNodeColorType.black);
  2619. n = t.rotateLeft();
  2620. a === t && (a = n), e.color = o.default.TreeNodeColorType.black
  2621. } else if (r.rightChild && r.rightChild.color !== o.default.TreeNodeColorType.black || !r.leftChild || r.leftChild.color !== o.default.TreeNodeColorType.red) r.leftChild && r.leftChild.color !== o.default.TreeNodeColorType.black || r.rightChild && r.rightChild.color !== o.default.TreeNodeColorType.black || (r.color = o.default.TreeNodeColorType.red, c(t));
  2622. else {
  2623. r.color = o.default.TreeNodeColorType.red, r.leftChild && (r.leftChild.color = o.default.TreeNodeColorType.black);
  2624. n = r.rotateRight();
  2625. a === r && (a = n), c(e)
  2626. }
  2627. } else if (e === t.rightChild)
  2628. if (r.color === o.default.TreeNodeColorType.red) {
  2629. r.color = o.default.TreeNodeColorType.black, t.color = o.default.TreeNodeColorType.red;
  2630. n = t.rotateRight();
  2631. a === t && (a = n), c(e)
  2632. } else if (r.color === o.default.TreeNodeColorType.black)
  2633. if (r.leftChild && r.leftChild.color === o.default.TreeNodeColorType.red) {
  2634. r.color = t.color, t.color = o.default.TreeNodeColorType.black, r.leftChild && (r.leftChild.color = o.default.TreeNodeColorType.black);
  2635. n = t.rotateRight();
  2636. a === t && (a = n), e.color = o.default.TreeNodeColorType.black
  2637. } else if (r.leftChild && r.leftChild.color !== o.default.TreeNodeColorType.black || !r.rightChild || r.rightChild.color !== o.default.TreeNodeColorType.red) r.leftChild && r.leftChild.color !== o.default.TreeNodeColorType.black || r.rightChild && r.rightChild.color !== o.default.TreeNodeColorType.black || (r.color = o.default.TreeNodeColorType.red, c(t));
  2638. else {
  2639. r.color = o.default.TreeNodeColorType.red, r.rightChild && (r.rightChild.color = o.default.TreeNodeColorType.black);
  2640. n = r.rotateLeft();
  2641. a === r && (a = n), c(e)
  2642. }
  2643. } else e.color = o.default.TreeNodeColorType.black
  2644. },
  2645. h = function (e) {
  2646. for (var t = e; t.leftChild || t.rightChild;) {
  2647. if (t.rightChild) {
  2648. t = l(t.rightChild);
  2649. var r = e.key;
  2650. e.key = t.key, t.key = r, e = t
  2651. }
  2652. if (t.leftChild) {
  2653. t = u(t.leftChild);
  2654. r = e.key;
  2655. e.key = t.key, t.key = r, e = t
  2656. }
  2657. }
  2658. c(t), t && t.remove(), --s, a.color = o.default.TreeNodeColorType.black
  2659. },
  2660. f = function (e, t) { return !(!e || void 0 === e.key) && (!!f(e.leftChild, t) || (!!t(e) || f(e.rightChild, t))) };
  2661. this.eraseElementByPos = function (e) {
  2662. if (e < 0 || e >= s) throw new Error("pos must more than 0 and less than set's size");
  2663. var t = 0;
  2664. f(a, function (r) { return e === t ? (h(r), !0) : (++t, !1) })
  2665. }, this.eraseElementByValue = function (e) {
  2666. if (!this.empty()) {
  2667. var r = g(a, e);
  2668. void 0 !== r && void 0 !== r.key && 0 === t(r.key, e) && h(r)
  2669. }
  2670. };
  2671. var p = function (e, r) { if (!e || void 0 === e.key) throw new Error("unknown error"); var n = t(r, e.key); return n < 0 ? e.leftChild ? p(e.leftChild, r) : (e.leftChild = new o.default, e.leftChild.parent = e, e.leftChild.brother = e.rightChild, e.rightChild && (e.rightChild.brother = e.leftChild), e.leftChild) : n > 0 ? e.rightChild ? p(e.rightChild, r) : (e.rightChild = new o.default, e.rightChild.parent = e, e.rightChild.brother = e.leftChild, e.leftChild && (e.leftChild.brother = e.rightChild), e.rightChild) : e },
  2672. d = function (e) {
  2673. var t = e.parent;
  2674. if (!t) { if (e === a) return; throw new Error("unknown error") }
  2675. if (t.color !== o.default.TreeNodeColorType.black && t.color === o.default.TreeNodeColorType.red) {
  2676. var r = t.brother,
  2677. n = t.parent;
  2678. if (!n) throw new Error("unknown error");
  2679. if (r && r.color === o.default.TreeNodeColorType.red) r.color = t.color = o.default.TreeNodeColorType.black, n.color = o.default.TreeNodeColorType.red, d(n);
  2680. else if (!r || r.color === o.default.TreeNodeColorType.black)
  2681. if (t === n.leftChild) {
  2682. if (e === t.leftChild) {
  2683. t.color = o.default.TreeNodeColorType.black, n.color = o.default.TreeNodeColorType.red;
  2684. var i = n.rotateRight();
  2685. n === a && (a = i)
  2686. } else if (e === t.rightChild) {
  2687. i = t.rotateLeft();
  2688. n === a && (a = i), d(t)
  2689. }
  2690. } else if (t === n.rightChild)
  2691. if (e === t.leftChild) {
  2692. i = t.rotateRight();
  2693. n === a && (a = i), d(t)
  2694. } else if (e === t.rightChild) {
  2695. t.color = o.default.TreeNodeColorType.black, n.color = o.default.TreeNodeColorType.red;
  2696. i = n.rotateLeft();
  2697. n === a && (a = i)
  2698. }
  2699. }
  2700. };
  2701. this.insert = function (e) {
  2702. if (null === e || void 0 === e) throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");
  2703. if (this.empty()) return ++s, a.key = e, void(a.color = o.default.TreeNodeColorType.black);
  2704. var r = p(a, e);
  2705. void 0 !== r.key && 0 === t(r.key, e) || (++s, r.key = e, d(r), a.color = o.default.TreeNodeColorType.black)
  2706. };
  2707. var g = function (e, r) { if (e && void 0 !== e.key) { var n = t(r, e.key); return n < 0 ? g(e.leftChild, r) : n > 0 ? g(e.rightChild, r) : e } };
  2708. this.find = function (e) { var r = g(a, e); return void 0 !== r && void 0 !== r.key && 0 === t(r.key, e) };
  2709. var y = function (e, r) { if (e && void 0 !== e.key) { var n = t(e.key, r); if (0 === n) return e.key; if (n < 0) return y(e.rightChild, r); var i = y(e.leftChild, r); return void 0 !== i ? i : e.key } };
  2710. this.lowerBound = function (e) { return y(a, e) };
  2711. var b = function (e, r) { if (e && void 0 !== e.key) { if (t(e.key, r) <= 0) return b(e.rightChild, r); var n = b(e.leftChild, r); return void 0 !== n ? n : e.key } };
  2712. this.upperBound = function (e) { return b(a, e) };
  2713. var m = function (e, r) { if (e && void 0 !== e.key) { var n = t(e.key, r); if (0 === n) return e.key; if (n > 0) return m(e.leftChild, r); var i = m(e.rightChild, r); return void 0 !== i ? i : e.key } };
  2714. this.reverseLowerBound = function (e) { return m(a, e) };
  2715. var v = function (e, r) { if (e && void 0 !== e.key) { if (t(e.key, r) >= 0) return v(e.leftChild, r); var n = v(e.rightChild, r); return void 0 !== n ? n : e.key } };
  2716. this.reverseUpperBound = function (e) { return v(a, e) }, this.union = function (e) {
  2717. var t = this;
  2718. e.forEach(function (e) { return t.insert(e) })
  2719. }, this.getHeight = function () { if (this.empty()) return 0; var e = function (t) { return t ? Math.max(e(t.leftChild), e(t.rightChild)) + 1 : 1 }; return e(a) };
  2720. var w = function (e) {
  2721. return n(this, function (t) {
  2722. switch (t.label) {
  2723. case 0:
  2724. return e && void 0 !== e.key ? [5, i(w(e.leftChild))] : [2];
  2725. case 1:
  2726. return t.sent(), [4, e.key];
  2727. case 2:
  2728. return t.sent(), [5, i(w(e.rightChild))];
  2729. case 3:
  2730. return t.sent(), [2]
  2731. }
  2732. })
  2733. };
  2734. this[Symbol.iterator] = function () { return w(a) }, e.forEach(function (e) { return r.insert(e) }), Object.freeze(this)
  2735. }
  2736. Object.freeze(s), r.default = s
  2737. }, { "../Base/TreeNode": 25 }],
  2738. 34: [function (e, t, r) {
  2739. "use strict";
  2740. function n(e) {
  2741. var t = this;
  2742. void 0 === e && (e = []);
  2743. var r = 0,
  2744. n = [];
  2745. this.size = function () { return r }, this.empty = function () { return 0 === r }, this.clear = function () { r = 0, n.length = 0 }, this.push = function (e) { n.push(e), ++r }, this.pop = function () { n.pop(), r > 0 && --r }, this.top = function () { return n[r - 1] }, e.forEach(function (e) { return t.push(e) }), Object.freeze(this)
  2746. }
  2747. Object.defineProperty(r, "__esModule", { value: !0 }), Object.freeze(n), r.default = n
  2748. }, {}],
  2749. 35: [function (e, t, r) {
  2750. "use strict";
  2751. var n = this && this.__generator || function (e, t) {
  2752. var r, n, i, o, s = { label: 0, sent: function () { if (1 & i[0]) throw i[1]; return i[1] }, trys: [], ops: [] };
  2753. return o = { next: a(0), throw: a(1), return: a(2) }, "function" == typeof Symbol && (o[Symbol.iterator] = function () { return this }), o;
  2754. function a(o) {
  2755. return function (a) {
  2756. return function (o) {
  2757. if (r) throw new TypeError("Generator is already executing.");
  2758. for (; s;) try {
  2759. if (r = 1, n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n), 0) : n.next) && !(i = i.call(n, o[1])).done) return i;
  2760. switch (n = 0, i && (o = [2 & o[0], i.value]), o[0]) {
  2761. case 0:
  2762. case 1:
  2763. i = o;
  2764. break;
  2765. case 4:
  2766. return s.label++, { value: o[1], done: !1 };
  2767. case 5:
  2768. s.label++, n = o[1], o = [0];
  2769. continue;
  2770. case 7:
  2771. o = s.ops.pop(), s.trys.pop();
  2772. continue;
  2773. default:
  2774. if (!(i = (i = s.trys).length > 0 && i[i.length - 1]) && (6 === o[0] || 2 === o[0])) { s = 0; continue }
  2775. if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) { s.label = o[1]; break }
  2776. if (6 === o[0] && s.label < i[1]) { s.label = i[1], i = o; break }
  2777. if (i && s.label < i[2]) { s.label = i[2], s.ops.push(o); break } i[2] && s.ops.pop(), s.trys.pop();
  2778. continue
  2779. }
  2780. o = t.call(e, s)
  2781. } catch (e) { o = [6, e], n = 0 } finally { r = i = 0 }
  2782. if (5 & o[0]) throw o[1];
  2783. return { value: o[0] ? o[1] : void 0, done: !0 }
  2784. }([o, a])
  2785. }
  2786. }
  2787. },
  2788. i = this && this.__read || function (e, t) {
  2789. var r = "function" == typeof Symbol && e[Symbol.iterator];
  2790. if (!r) return e;
  2791. var n, i, o = r.call(e),
  2792. s = [];
  2793. try {
  2794. for (;
  2795. (void 0 === t || t-- > 0) && !(n = o.next()).done;) s.push(n.value)
  2796. } catch (e) { i = { error: e } } finally { try { n && !n.done && (r = o.return) && r.call(o) } finally { if (i) throw i.error } }
  2797. return s
  2798. },
  2799. o = this && this.__spreadArray || function (e, t, r) {
  2800. if (r || 2 === arguments.length)
  2801. for (var n, i = 0, o = t.length; i < o; i++) !n && i in t || (n || (n = Array.prototype.slice.call(t, 0, i)), n[i] = t[i]);
  2802. return e.concat(n || Array.prototype.slice.call(t))
  2803. },
  2804. s = this && this.__values || function (e) {
  2805. var t = "function" == typeof Symbol && Symbol.iterator,
  2806. r = t && e[t],
  2807. n = 0;
  2808. if (r) return r.call(e);
  2809. if (e && "number" == typeof e.length) return { next: function () { return e && n >= e.length && (e = void 0), { value: e && e[n++], done: !e } } };
  2810. throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.")
  2811. };
  2812. function a(e) {
  2813. var t = this;
  2814. void 0 === e && (e = []);
  2815. var r = 0,
  2816. a = [];
  2817. this.size = function () { return r }, this.empty = function () { return 0 === r }, this.clear = function () { r = 0, a.length = 0 }, this.front = function () { if (!this.empty()) return a[0] }, this.back = function () { if (!this.empty()) return a[r - 1] }, this.forEach = function (e) { a.forEach(e) }, this.getElementByPos = function (e) { if (e < 0 || e >= r) throw new Error("pos must more than 0 and less than vector's size"); return a[e] }, this.eraseElementByPos = function (e) {
  2818. if (e < 0 || e >= r) throw new Error("pos must more than 0 and less than vector's size");
  2819. for (var t = e; t < r - 1; ++t) a[t] = a[t + 1];
  2820. this.popBack()
  2821. }, this.eraseElementByValue = function (e) {
  2822. var t = [];
  2823. this.forEach(function (r) { r !== e && t.push(r) }), t.forEach(function (e, t) { a[t] = e });
  2824. for (var n = t.length; r > n;) this.popBack()
  2825. }, this.pushBack = function (e) { a.push(e), ++r }, this.popBack = function () { a.pop(), r > 0 && --r }, this.setElementByPos = function (e, t) {
  2826. if (e < 0 || e >= r) throw new Error("pos must more than 0 and less than vector's size");
  2827. a[e] = t
  2828. }, this.insert = function (e, t, n) {
  2829. if (void 0 === n && (n = 1), e < 0 || e > r) throw new Error("pos must more than 0 and less than or equal to vector's size");
  2830. a.splice.apply(a, o([e, 0], i(new Array(n).fill(t)), !1)), r += n
  2831. }, this.find = function (e) { return a.includes(e) }, this.reverse = function () { a.reverse() }, this.unique = function () {
  2832. var e, t = [];
  2833. this.forEach(function (r, n) { 0 !== n && r === e || (t.push(r), e = r) }), t.forEach(function (e, t) { a[t] = e });
  2834. for (var n = t.length; r > n;) this.popBack()
  2835. }, this.sort = function (e) { a.sort(e) }, this[Symbol.iterator] = function () {
  2836. return function () {
  2837. return n(this, function (e) {
  2838. switch (e.label) {
  2839. case 0:
  2840. return [5, s(a)];
  2841. case 1:
  2842. return [2, e.sent()]
  2843. }
  2844. })
  2845. }()
  2846. }, e.forEach(function (e) { return t.pushBack(e) }), Object.freeze(this)
  2847. }
  2848. Object.defineProperty(r, "__esModule", { value: !0 }), Object.freeze(a), r.default = a
  2849. }, {}],
  2850. 36: [function (e, t, r) {
  2851. "use strict";
  2852. Object.defineProperty(r, "__esModule", { value: !0 }), r.HashMap = r.HashSet = r.Map = r.Set = r.PriorityQueue = r.Deque = r.LinkList = r.Queue = r.Stack = r.Vector = void 0;
  2853. var n = e("./Vector/Vector");
  2854. r.Vector = n.default;
  2855. var i = e("./Stack/Stack");
  2856. r.Stack = i.default;
  2857. var o = e("./Queue/Queue");
  2858. r.Queue = o.default;
  2859. var s = e("./LinkList/LinkList");
  2860. r.LinkList = s.default;
  2861. var a = e("./Deque/Deque");
  2862. r.Deque = a.default;
  2863. var l = e("./PriorityQueue/PriorityQueue");
  2864. r.PriorityQueue = l.default;
  2865. var u = e("./Set/Set");
  2866. r.Set = u.default;
  2867. var c = e("./Map/Map");
  2868. r.Map = c.default;
  2869. var h = e("./HashSet/HashSet");
  2870. r.HashSet = h.default;
  2871. var f = e("./HashMap/HashMap");
  2872. r.HashMap = f.default
  2873. }, { "./Deque/Deque": 26, "./HashMap/HashMap": 27, "./HashSet/HashSet": 28, "./LinkList/LinkList": 29, "./Map/Map": 30, "./PriorityQueue/PriorityQueue": 31, "./Queue/Queue": 32, "./Set/Set": 33, "./Stack/Stack": 34, "./Vector/Vector": 35 }],
  2874. 37: [function (e, t, r) {
  2875. "use strict";
  2876. const n = e("yallist"),
  2877. i = Symbol("max"),
  2878. o = Symbol("length"),
  2879. s = Symbol("lengthCalculator"),
  2880. a = Symbol("allowStale"),
  2881. l = Symbol("maxAge"),
  2882. u = Symbol("dispose"),
  2883. c = Symbol("noDisposeOnSet"),
  2884. h = Symbol("lruList"),
  2885. f = Symbol("cache"),
  2886. p = Symbol("updateAgeOnGet"),
  2887. d = () => 1;
  2888. const g = (e, t, r) => { const n = e[f].get(t); if (n) { const t = n.value; if (y(e, t)) { if (m(e, n), !e[a]) return } else r && (e[p] && (n.value.now = Date.now()), e[h].unshiftNode(n)); return t.value } },
  2889. y = (e, t) => { if (!t || !t.maxAge && !e[l]) return !1; const r = Date.now() - t.now; return t.maxAge ? r > t.maxAge : e[l] && r > e[l] },
  2890. b = e => {
  2891. if (e[o] > e[i])
  2892. for (let t = e[h].tail; e[o] > e[i] && null !== t;) {
  2893. const r = t.prev;
  2894. m(e, t), t = r
  2895. }
  2896. },
  2897. m = (e, t) => {
  2898. if (t) {
  2899. const r = t.value;
  2900. e[u] && e[u](r.key, r.value), e[o] -= r.length, e[f].delete(r.key), e[h].removeNode(t)
  2901. }
  2902. };
  2903. class v { constructor(e, t, r, n, i) { this.key = e, this.value = t, this.length = r, this.now = n, this.maxAge = i || 0 } }
  2904. const w = (e, t, r, n) => {
  2905. let i = r.value;
  2906. y(e, i) && (m(e, r), e[a] || (i = void 0)), i && t.call(n, i.value, i.key, e)
  2907. };
  2908. t.exports = class {
  2909. constructor(e) {
  2910. if ("number" == typeof e && (e = { max: e }), e || (e = {}), e.max && ("number" != typeof e.max || e.max < 0)) throw new TypeError("max must be a non-negative number");
  2911. this[i] = e.max || 1 / 0;
  2912. const t = e.length || d;
  2913. if (this[s] = "function" != typeof t ? d : t, this[a] = e.stale || !1, e.maxAge && "number" != typeof e.maxAge) throw new TypeError("maxAge must be a number");
  2914. this[l] = e.maxAge || 0, this[u] = e.dispose, this[c] = e.noDisposeOnSet || !1, this[p] = e.updateAgeOnGet || !1, this.reset()
  2915. }
  2916. set max(e) {
  2917. if ("number" != typeof e || e < 0) throw new TypeError("max must be a non-negative number");
  2918. this[i] = e || 1 / 0, b(this)
  2919. }
  2920. get max() { return this[i] } set allowStale(e) { this[a] = !!e } get allowStale() { return this[a] } set maxAge(e) {
  2921. if ("number" != typeof e) throw new TypeError("maxAge must be a non-negative number");
  2922. this[l] = e, b(this)
  2923. }
  2924. get maxAge() { return this[l] } set lengthCalculator(e) { "function" != typeof e && (e = d), e !== this[s] && (this[s] = e, this[o] = 0, this[h].forEach(e => { e.length = this[s](e.value, e.key), this[o] += e.length })), b(this) } get lengthCalculator() { return this[s] } get length() { return this[o] } get itemCount() { return this[h].length } rforEach(e, t) {
  2925. t = t || this;
  2926. for (let r = this[h].tail; null !== r;) {
  2927. const n = r.prev;
  2928. w(this, e, r, t), r = n
  2929. }
  2930. }
  2931. forEach(e, t) {
  2932. t = t || this;
  2933. for (let r = this[h].head; null !== r;) {
  2934. const n = r.next;
  2935. w(this, e, r, t), r = n
  2936. }
  2937. }
  2938. keys() { return this[h].toArray().map(e => e.key) } values() { return this[h].toArray().map(e => e.value) } reset() { this[u] && this[h] && this[h].length && this[h].forEach(e => this[u](e.key, e.value)), this[f] = new Map, this[h] = new n, this[o] = 0 } dump() { return this[h].map(e => !y(this, e) && { k: e.key, v: e.value, e: e.now + (e.maxAge || 0) }).toArray().filter(e => e) } dumpLru() { return this[h] } set(e, t, r) {
  2939. if ((r = r || this[l]) && "number" != typeof r) throw new TypeError("maxAge must be a number");
  2940. const n = r ? Date.now() : 0,
  2941. a = this[s](t, e);
  2942. if (this[f].has(e)) { if (a > this[i]) return m(this, this[f].get(e)), !1; const s = this[f].get(e).value; return this[u] && (this[c] || this[u](e, s.value)), s.now = n, s.maxAge = r, s.value = t, this[o] += a - s.length, s.length = a, this.get(e), b(this), !0 }
  2943. const p = new v(e, t, a, n, r);
  2944. return p.length > this[i] ? (this[u] && this[u](e, t), !1) : (this[o] += p.length, this[h].unshift(p), this[f].set(e, this[h].head), b(this), !0)
  2945. }
  2946. has(e) { if (!this[f].has(e)) return !1; const t = this[f].get(e).value; return !y(this, t) } get(e) { return g(this, e, !0) } peek(e) { return g(this, e, !1) } pop() { const e = this[h].tail; return e ? (m(this, e), e.value) : null } del(e) { m(this, this[f].get(e)) } load(e) {
  2947. this.reset();
  2948. const t = Date.now();
  2949. for (let r = e.length - 1; r >= 0; r--) {
  2950. const n = e[r],
  2951. i = n.e || 0;
  2952. if (0 === i) this.set(n.k, n.v);
  2953. else {
  2954. const e = i - t;
  2955. e > 0 && this.set(n.k, n.v, e)
  2956. }
  2957. }
  2958. }
  2959. prune() { this[f].forEach((e, t) => g(this, t, !1)) }
  2960. }
  2961. }, { yallist: 83 }],
  2962. 38: [function (e, t, r) {
  2963. (function (e) {
  2964. (function () {
  2965. const r = t.exports;
  2966. r.types = { 0: "reserved", 1: "connect", 2: "connack", 3: "publish", 4: "puback", 5: "pubrec", 6: "pubrel", 7: "pubcomp", 8: "subscribe", 9: "suback", 10: "unsubscribe", 11: "unsuback", 12: "pingreq", 13: "pingresp", 14: "disconnect", 15: "auth" }, r.codes = {};
  2967. for (const e in r.types) {
  2968. const t = r.types[e];
  2969. r.codes[t] = e
  2970. }
  2971. r.CMD_SHIFT = 4, r.CMD_MASK = 240, r.DUP_MASK = 8, r.QOS_MASK = 3, r.QOS_SHIFT = 1, r.RETAIN_MASK = 1, r.VARBYTEINT_MASK = 127, r.VARBYTEINT_FIN_MASK = 128, r.VARBYTEINT_MAX = 268435455, r.SESSIONPRESENT_MASK = 1, r.SESSIONPRESENT_HEADER = e.from([r.SESSIONPRESENT_MASK]), r.CONNACK_HEADER = e.from([r.codes.connack << r.CMD_SHIFT]), r.USERNAME_MASK = 128, r.PASSWORD_MASK = 64, r.WILL_RETAIN_MASK = 32, r.WILL_QOS_MASK = 24, r.WILL_QOS_SHIFT = 3, r.WILL_FLAG_MASK = 4, r.CLEAN_SESSION_MASK = 2, r.CONNECT_HEADER = e.from([r.codes.connect << r.CMD_SHIFT]), r.properties = { sessionExpiryInterval: 17, willDelayInterval: 24, receiveMaximum: 33, maximumPacketSize: 39, topicAliasMaximum: 34, requestResponseInformation: 25, requestProblemInformation: 23, userProperties: 38, authenticationMethod: 21, authenticationData: 22, payloadFormatIndicator: 1, messageExpiryInterval: 2, contentType: 3, responseTopic: 8, correlationData: 9, maximumQoS: 36, retainAvailable: 37, assignedClientIdentifier: 18, reasonString: 31, wildcardSubscriptionAvailable: 40, subscriptionIdentifiersAvailable: 41, sharedSubscriptionAvailable: 42, serverKeepAlive: 19, responseInformation: 26, serverReference: 28, topicAlias: 35, subscriptionIdentifier: 11 }, r.propertiesCodes = {};
  2972. for (const e in r.properties) {
  2973. const t = r.properties[e];
  2974. r.propertiesCodes[t] = e
  2975. }
  2976. function n(t) { return [0, 1, 2].map(n => [0, 1].map(i => [0, 1].map(o => { const s = e.alloc(1); return s.writeUInt8(r.codes[t] << r.CMD_SHIFT | (i ? r.DUP_MASK : 0) | n << r.QOS_SHIFT | o, 0, !0), s }))) } r.propertiesTypes = { sessionExpiryInterval: "int32", willDelayInterval: "int32", receiveMaximum: "int16", maximumPacketSize: "int32", topicAliasMaximum: "int16", requestResponseInformation: "byte", requestProblemInformation: "byte", userProperties: "pair", authenticationMethod: "string", authenticationData: "binary", payloadFormatIndicator: "byte", messageExpiryInterval: "int32", contentType: "string", responseTopic: "string", correlationData: "binary", maximumQoS: "int8", retainAvailable: "byte", assignedClientIdentifier: "string", reasonString: "string", wildcardSubscriptionAvailable: "byte", subscriptionIdentifiersAvailable: "byte", sharedSubscriptionAvailable: "byte", serverKeepAlive: "int16", responseInformation: "string", serverReference: "string", topicAlias: "int16", subscriptionIdentifier: "var" }, r.PUBLISH_HEADER = n("publish"), r.SUBSCRIBE_HEADER = n("subscribe"), r.SUBSCRIBE_OPTIONS_QOS_MASK = 3, r.SUBSCRIBE_OPTIONS_NL_MASK = 1, r.SUBSCRIBE_OPTIONS_NL_SHIFT = 2, r.SUBSCRIBE_OPTIONS_RAP_MASK = 1, r.SUBSCRIBE_OPTIONS_RAP_SHIFT = 3, r.SUBSCRIBE_OPTIONS_RH_MASK = 3, r.SUBSCRIBE_OPTIONS_RH_SHIFT = 4, r.SUBSCRIBE_OPTIONS_RH = [0, 16, 32], r.SUBSCRIBE_OPTIONS_NL = 4, r.SUBSCRIBE_OPTIONS_RAP = 8, r.SUBSCRIBE_OPTIONS_QOS = [0, 1, 2], r.UNSUBSCRIBE_HEADER = n("unsubscribe"), r.ACKS = { unsuback: n("unsuback"), puback: n("puback"), pubcomp: n("pubcomp"), pubrel: n("pubrel"), pubrec: n("pubrec") }, r.SUBACK_HEADER = e.from([r.codes.suback << r.CMD_SHIFT]), r.VERSION3 = e.from([3]), r.VERSION4 = e.from([4]), r.VERSION5 = e.from([5]), r.VERSION131 = e.from([131]), r.VERSION132 = e.from([132]), r.QOS = [0, 1, 2].map(t => e.from([t])), r.EMPTY = { pingreq: e.from([r.codes.pingreq << 4, 0]), pingresp: e.from([r.codes.pingresp << 4, 0]), disconnect: e.from([r.codes.disconnect << 4, 0]) }
  2977. }).call(this)
  2978. }).call(this, e("buffer").Buffer)
  2979. }, { buffer: 17 }],
  2980. 39: [function (e, t, r) {
  2981. (function (r) {
  2982. (function () {
  2983. const n = e("./writeToStream"),
  2984. i = e("events");
  2985. class o extends i {
  2986. constructor() { super(), this._array = new Array(20), this._i = 0 } write(e) { return this._array[this._i++] = e, !0 } concat() {
  2987. let e = 0;
  2988. const t = new Array(this._array.length),
  2989. n = this._array;
  2990. let i, o = 0;
  2991. for (i = 0; i < n.length && void 0 !== n[i]; i++) "string" != typeof n[i] ? t[i] = n[i].length : t[i] = r.byteLength(n[i]), e += t[i];
  2992. const s = r.allocUnsafe(e);
  2993. for (i = 0; i < n.length && void 0 !== n[i]; i++) "string" != typeof n[i] ? (n[i].copy(s, o), o += t[i]) : (s.write(n[i], o), o += t[i]);
  2994. return s
  2995. }
  2996. }
  2997. t.exports = function (e, t) { const r = new o; return n(e, r, t), r.concat() }
  2998. }).call(this)
  2999. }).call(this, e("buffer").Buffer)
  3000. }, { "./writeToStream": 44, buffer: 17, events: 22 }],
  3001. 40: [function (e, t, r) { r.parser = e("./parser").parser, r.generate = e("./generate"), r.writeToStream = e("./writeToStream") }, { "./generate": 39, "./parser": 43, "./writeToStream": 44 }],
  3002. 41: [function (e, t, r) {
  3003. (function (e) {
  3004. (function () {
  3005. const r = 65536,
  3006. n = {},
  3007. i = e.isBuffer(e.from([1, 2]).subarray(0, 1));
  3008. function o(t) { const r = e.allocUnsafe(2); return r.writeUInt8(t >> 8, 0), r.writeUInt8(255 & t, 1), r } t.exports = {
  3009. cache: n,
  3010. generateCache: function () { for (let e = 0; e < r; e++) n[e] = o(e) },
  3011. generateNumber: o,
  3012. genBufVariableByteInt: function (t) {
  3013. let r = 0,
  3014. n = 0;
  3015. const o = e.allocUnsafe(4);
  3016. do { r = t % 128 | 0, (t = t / 128 | 0) > 0 && (r |= 128), o.writeUInt8(r, n++) } while (t > 0 && n < 4);
  3017. return t > 0 && (n = 0), i ? o.subarray(0, n) : o.slice(0, n)
  3018. },
  3019. generate4ByteBuffer: function (t) { const r = e.allocUnsafe(4); return r.writeUInt32BE(t, 0), r }
  3020. }
  3021. }).call(this)
  3022. }).call(this, e("buffer").Buffer)
  3023. }, { buffer: 17 }],
  3024. 42: [function (e, t, r) { t.exports = class { constructor() { this.cmd = null, this.retain = !1, this.qos = 0, this.dup = !1, this.length = -1, this.topic = null, this.payload = null } } }, {}],
  3025. 43: [function (e, t, r) {
  3026. const n = e("bl"),
  3027. i = e("events"),
  3028. o = e("./packet"),
  3029. s = e("./constants"),
  3030. a = e("debug")("mqtt-packet:parser");
  3031. class l extends i {
  3032. constructor() { super(), this.parser = this.constructor.parser } static parser(e) { return this instanceof l ? (this.settings = e || {}, this._states = ["_parseHeader", "_parseLength", "_parsePayload", "_newPacket"], this._resetState(), this) : (new l).parser(e) } _resetState() { a("_resetState: resetting packet, error, _list, and _stateCounter"), this.packet = new o, this.error = null, this._list = n(), this._stateCounter = 0 } parse(e) {
  3033. for (this.error && this._resetState(), this._list.append(e), a("parse: current state: %s", this._states[this._stateCounter]);
  3034. (-1 !== this.packet.length || this._list.length > 0) && this[this._states[this._stateCounter]]() && !this.error;) this._stateCounter++, a("parse: state complete. _stateCounter is now: %d", this._stateCounter), a("parse: packet.length: %d, buffer list length: %d", this.packet.length, this._list.length), this._stateCounter >= this._states.length && (this._stateCounter = 0);
  3035. return a("parse: exited while loop. packet: %d, buffer list length: %d", this.packet.length, this._list.length), this._list.length
  3036. }
  3037. _parseHeader() { const e = this._list.readUInt8(0); return this.packet.cmd = s.types[e >> s.CMD_SHIFT], this.packet.retain = 0 != (e & s.RETAIN_MASK), this.packet.qos = e >> s.QOS_SHIFT & s.QOS_MASK, this.packet.dup = 0 != (e & s.DUP_MASK), a("_parseHeader: packet: %o", this.packet), this._list.consume(1), !0 } _parseLength() { const e = this._parseVarByteNum(!0); return e && (this.packet.length = e.value, this._list.consume(e.bytes)), a("_parseLength %d", e.value), !!e } _parsePayload() {
  3038. a("_parsePayload: payload %O", this._list);
  3039. let e = !1;
  3040. if (0 === this.packet.length || this._list.length >= this.packet.length) {
  3041. switch (this._pos = 0, this.packet.cmd) {
  3042. case "connect":
  3043. this._parseConnect();
  3044. break;
  3045. case "connack":
  3046. this._parseConnack();
  3047. break;
  3048. case "publish":
  3049. this._parsePublish();
  3050. break;
  3051. case "puback":
  3052. case "pubrec":
  3053. case "pubrel":
  3054. case "pubcomp":
  3055. this._parseConfirmation();
  3056. break;
  3057. case "subscribe":
  3058. this._parseSubscribe();
  3059. break;
  3060. case "suback":
  3061. this._parseSuback();
  3062. break;
  3063. case "unsubscribe":
  3064. this._parseUnsubscribe();
  3065. break;
  3066. case "unsuback":
  3067. this._parseUnsuback();
  3068. break;
  3069. case "pingreq":
  3070. case "pingresp":
  3071. break;
  3072. case "disconnect":
  3073. this._parseDisconnect();
  3074. break;
  3075. case "auth":
  3076. this._parseAuth();
  3077. break;
  3078. default:
  3079. this._emitError(new Error("Not supported"))
  3080. }
  3081. e = !0
  3082. }
  3083. return a("_parsePayload complete result: %s", e), e
  3084. }
  3085. _parseConnect() {
  3086. let e, t, r, n;
  3087. a("_parseConnect");
  3088. const i = {},
  3089. o = this.packet,
  3090. l = this._parseString();
  3091. if (null === l) return this._emitError(new Error("Cannot parse protocolId"));
  3092. if ("MQTT" !== l && "MQIsdp" !== l) return this._emitError(new Error("Invalid protocolId"));
  3093. if (o.protocolId = l, this._pos >= this._list.length) return this._emitError(new Error("Packet too short"));
  3094. if (o.protocolVersion = this._list.readUInt8(this._pos), o.protocolVersion >= 128 && (o.bridgeMode = !0, o.protocolVersion = o.protocolVersion - 128), 3 !== o.protocolVersion && 4 !== o.protocolVersion && 5 !== o.protocolVersion) return this._emitError(new Error("Invalid protocol version"));
  3095. if (this._pos++, this._pos >= this._list.length) return this._emitError(new Error("Packet too short"));
  3096. if (i.username = this._list.readUInt8(this._pos) & s.USERNAME_MASK, i.password = this._list.readUInt8(this._pos) & s.PASSWORD_MASK, i.will = this._list.readUInt8(this._pos) & s.WILL_FLAG_MASK, i.will && (o.will = {}, o.will.retain = 0 != (this._list.readUInt8(this._pos) & s.WILL_RETAIN_MASK), o.will.qos = (this._list.readUInt8(this._pos) & s.WILL_QOS_MASK) >> s.WILL_QOS_SHIFT), o.clean = 0 != (this._list.readUInt8(this._pos) & s.CLEAN_SESSION_MASK), this._pos++, o.keepalive = this._parseNum(), -1 === o.keepalive) return this._emitError(new Error("Packet too short"));
  3097. if (5 === o.protocolVersion) {
  3098. const e = this._parseProperties();
  3099. Object.getOwnPropertyNames(e).length && (o.properties = e)
  3100. }
  3101. const u = this._parseString();
  3102. if (null === u) return this._emitError(new Error("Packet too short"));
  3103. if (o.clientId = u, a("_parseConnect: packet.clientId: %s", o.clientId), i.will) {
  3104. if (5 === o.protocolVersion) {
  3105. const e = this._parseProperties();
  3106. Object.getOwnPropertyNames(e).length && (o.will.properties = e)
  3107. }
  3108. if (null === (e = this._parseString())) return this._emitError(new Error("Cannot parse will topic"));
  3109. if (o.will.topic = e, a("_parseConnect: packet.will.topic: %s", o.will.topic), null === (t = this._parseBuffer())) return this._emitError(new Error("Cannot parse will payload"));
  3110. o.will.payload = t, a("_parseConnect: packet.will.paylaod: %s", o.will.payload)
  3111. }
  3112. if (i.username) {
  3113. if (null === (n = this._parseString())) return this._emitError(new Error("Cannot parse username"));
  3114. o.username = n, a("_parseConnect: packet.username: %s", o.username)
  3115. }
  3116. if (i.password) {
  3117. if (null === (r = this._parseBuffer())) return this._emitError(new Error("Cannot parse password"));
  3118. o.password = r
  3119. }
  3120. return this.settings = o, a("_parseConnect: complete"), o
  3121. }
  3122. _parseConnack() {
  3123. a("_parseConnack");
  3124. const e = this.packet;
  3125. if (this._list.length < 1) return null;
  3126. if (e.sessionPresent = !!(this._list.readUInt8(this._pos++) & s.SESSIONPRESENT_MASK), 5 === this.settings.protocolVersion) this._list.length >= 2 ? e.reasonCode = this._list.readUInt8(this._pos++) : e.reasonCode = 0;
  3127. else {
  3128. if (this._list.length < 2) return null;
  3129. e.returnCode = this._list.readUInt8(this._pos++)
  3130. }
  3131. if (-1 === e.returnCode || -1 === e.reasonCode) return this._emitError(new Error("Cannot parse return code"));
  3132. if (5 === this.settings.protocolVersion) {
  3133. const t = this._parseProperties();
  3134. Object.getOwnPropertyNames(t).length && (e.properties = t)
  3135. }
  3136. a("_parseConnack: complete")
  3137. }
  3138. _parsePublish() {
  3139. a("_parsePublish");
  3140. const e = this.packet;
  3141. if (e.topic = this._parseString(), null === e.topic) return this._emitError(new Error("Cannot parse topic"));
  3142. if (!(e.qos > 0) || this._parseMessageId()) {
  3143. if (5 === this.settings.protocolVersion) {
  3144. const t = this._parseProperties();
  3145. Object.getOwnPropertyNames(t).length && (e.properties = t)
  3146. }
  3147. e.payload = this._list.slice(this._pos, e.length), a("_parsePublish: payload from buffer list: %o", e.payload)
  3148. }
  3149. }
  3150. _parseSubscribe() {
  3151. a("_parseSubscribe");
  3152. const e = this.packet;
  3153. let t, r, n, i, o, l, u;
  3154. if (1 !== e.qos) return this._emitError(new Error("Wrong subscribe header"));
  3155. if (e.subscriptions = [], this._parseMessageId()) {
  3156. if (5 === this.settings.protocolVersion) {
  3157. const t = this._parseProperties();
  3158. Object.getOwnPropertyNames(t).length && (e.properties = t)
  3159. }
  3160. for (; this._pos < e.length;) {
  3161. if (null === (t = this._parseString())) return this._emitError(new Error("Cannot parse topic"));
  3162. if (this._pos >= e.length) return this._emitError(new Error("Malformed Subscribe Payload"));
  3163. n = (r = this._parseByte()) & s.SUBSCRIBE_OPTIONS_QOS_MASK, l = 0 != (r >> s.SUBSCRIBE_OPTIONS_NL_SHIFT & s.SUBSCRIBE_OPTIONS_NL_MASK), o = 0 != (r >> s.SUBSCRIBE_OPTIONS_RAP_SHIFT & s.SUBSCRIBE_OPTIONS_RAP_MASK), i = r >> s.SUBSCRIBE_OPTIONS_RH_SHIFT & s.SUBSCRIBE_OPTIONS_RH_MASK, u = { topic: t, qos: n }, 5 === this.settings.protocolVersion ? (u.nl = l, u.rap = o, u.rh = i) : this.settings.bridgeMode && (u.rh = 0, u.rap = !0, u.nl = !0), a("_parseSubscribe: push subscription `%s` to subscription", u), e.subscriptions.push(u)
  3164. }
  3165. }
  3166. }
  3167. _parseSuback() {
  3168. a("_parseSuback");
  3169. const e = this.packet;
  3170. if (this.packet.granted = [], this._parseMessageId()) {
  3171. if (5 === this.settings.protocolVersion) {
  3172. const t = this._parseProperties();
  3173. Object.getOwnPropertyNames(t).length && (e.properties = t)
  3174. }
  3175. for (; this._pos < this.packet.length;) this.packet.granted.push(this._list.readUInt8(this._pos++))
  3176. }
  3177. }
  3178. _parseUnsubscribe() {
  3179. a("_parseUnsubscribe");
  3180. const e = this.packet;
  3181. if (e.unsubscriptions = [], this._parseMessageId()) {
  3182. if (5 === this.settings.protocolVersion) {
  3183. const t = this._parseProperties();
  3184. Object.getOwnPropertyNames(t).length && (e.properties = t)
  3185. }
  3186. for (; this._pos < e.length;) {
  3187. const t = this._parseString();
  3188. if (null === t) return this._emitError(new Error("Cannot parse topic"));
  3189. a("_parseUnsubscribe: push topic `%s` to unsubscriptions", t), e.unsubscriptions.push(t)
  3190. }
  3191. }
  3192. }
  3193. _parseUnsuback() { a("_parseUnsuback"); const e = this.packet; if (!this._parseMessageId()) return this._emitError(new Error("Cannot parse messageId")); if (5 === this.settings.protocolVersion) { const t = this._parseProperties(); for (Object.getOwnPropertyNames(t).length && (e.properties = t), e.granted = []; this._pos < this.packet.length;) this.packet.granted.push(this._list.readUInt8(this._pos++)) } } _parseConfirmation() {
  3194. a("_parseConfirmation: packet.cmd: `%s`", this.packet.cmd);
  3195. const e = this.packet;
  3196. if (this._parseMessageId(), 5 === this.settings.protocolVersion && (e.length > 2 ? (e.reasonCode = this._parseByte(), a("_parseConfirmation: packet.reasonCode `%d`", e.reasonCode)) : e.reasonCode = 0, e.length > 3)) {
  3197. const t = this._parseProperties();
  3198. Object.getOwnPropertyNames(t).length && (e.properties = t)
  3199. }
  3200. return !0
  3201. }
  3202. _parseDisconnect() {
  3203. const e = this.packet;
  3204. if (a("_parseDisconnect"), 5 === this.settings.protocolVersion) {
  3205. this._list.length > 0 ? e.reasonCode = this._parseByte() : e.reasonCode = 0;
  3206. const t = this._parseProperties();
  3207. Object.getOwnPropertyNames(t).length && (e.properties = t)
  3208. }
  3209. return a("_parseDisconnect result: true"), !0
  3210. }
  3211. _parseAuth() {
  3212. a("_parseAuth");
  3213. const e = this.packet;
  3214. if (5 !== this.settings.protocolVersion) return this._emitError(new Error("Not supported auth packet for this version MQTT"));
  3215. e.reasonCode = this._parseByte();
  3216. const t = this._parseProperties();
  3217. return Object.getOwnPropertyNames(t).length && (e.properties = t), a("_parseAuth: result: true"), !0
  3218. }
  3219. _parseMessageId() { const e = this.packet; return e.messageId = this._parseNum(), null === e.messageId ? (this._emitError(new Error("Cannot parse messageId")), !1) : (a("_parseMessageId: packet.messageId %d", e.messageId), !0) } _parseString(e) {
  3220. const t = this._parseNum(),
  3221. r = t + this._pos;
  3222. if (-1 === t || r > this._list.length || r > this.packet.length) return null;
  3223. const n = this._list.toString("utf8", this._pos, r);
  3224. return this._pos += t, a("_parseString: result: %s", n), n
  3225. }
  3226. _parseStringPair() { return a("_parseStringPair"), { name: this._parseString(), value: this._parseString() } } _parseBuffer() {
  3227. const e = this._parseNum(),
  3228. t = e + this._pos;
  3229. if (-1 === e || t > this._list.length || t > this.packet.length) return null;
  3230. const r = this._list.slice(this._pos, t);
  3231. return this._pos += e, a("_parseBuffer: result: %o", r), r
  3232. }
  3233. _parseNum() { if (this._list.length - this._pos < 2) return -1; const e = this._list.readUInt16BE(this._pos); return this._pos += 2, a("_parseNum: result: %s", e), e } _parse4ByteNum() { if (this._list.length - this._pos < 4) return -1; const e = this._list.readUInt32BE(this._pos); return this._pos += 4, a("_parse4ByteNum: result: %s", e), e } _parseVarByteNum(e) {
  3234. a("_parseVarByteNum");
  3235. let t, r = 0,
  3236. n = 1,
  3237. i = 0,
  3238. o = !1;
  3239. const l = this._pos ? this._pos : 0;
  3240. for (; r < 4 && l + r < this._list.length;) { if (i += n * ((t = this._list.readUInt8(l + r++)) & s.VARBYTEINT_MASK), n *= 128, 0 == (t & s.VARBYTEINT_FIN_MASK)) { o = !0; break } if (this._list.length <= r) break }
  3241. return !o && 4 === r && this._list.length >= r && this._emitError(new Error("Invalid variable byte integer")), l && (this._pos += r), a("_parseVarByteNum: result: %o", o = !!o && (e ? { bytes: r, value: i } : i)), o
  3242. }
  3243. _parseByte() { let e; return this._pos < this._list.length && (e = this._list.readUInt8(this._pos), this._pos++), a("_parseByte: result: %o", e), e } _parseByType(e) {
  3244. switch (a("_parseByType: type: %s", e), e) {
  3245. case "byte":
  3246. return 0 !== this._parseByte();
  3247. case "int8":
  3248. return this._parseByte();
  3249. case "int16":
  3250. return this._parseNum();
  3251. case "int32":
  3252. return this._parse4ByteNum();
  3253. case "var":
  3254. return this._parseVarByteNum();
  3255. case "string":
  3256. return this._parseString();
  3257. case "pair":
  3258. return this._parseStringPair();
  3259. case "binary":
  3260. return this._parseBuffer()
  3261. }
  3262. }
  3263. _parseProperties() {
  3264. a("_parseProperties");
  3265. const e = this._parseVarByteNum(),
  3266. t = this._pos + e,
  3267. r = {};
  3268. for (; this._pos < t;) {
  3269. const e = this._parseByte();
  3270. if (!e) return this._emitError(new Error("Cannot parse property code type")), !1;
  3271. const t = s.propertiesCodes[e];
  3272. if (!t) return this._emitError(new Error("Unknown property")), !1;
  3273. if ("userProperties" !== t) r[t] ? Array.isArray(r[t]) ? r[t].push(this._parseByType(s.propertiesTypes[t])) : (r[t] = [r[t]], r[t].push(this._parseByType(s.propertiesTypes[t]))) : r[t] = this._parseByType(s.propertiesTypes[t]);
  3274. else {
  3275. r[t] || (r[t] = Object.create(null));
  3276. const e = this._parseByType(s.propertiesTypes[t]);
  3277. if (r[t][e.name])
  3278. if (Array.isArray(r[t][e.name])) r[t][e.name].push(e.value);
  3279. else {
  3280. const n = r[t][e.name];
  3281. r[t][e.name] = [n], r[t][e.name].push(e.value)
  3282. }
  3283. else r[t][e.name] = e.value
  3284. }
  3285. }
  3286. return r
  3287. }
  3288. _newPacket() { return a("_newPacket"), this.packet && (this._list.consume(this.packet.length), a("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d", this.packet.cmd, this.packet.payload, this.packet.length), this.emit("packet", this.packet)), a("_newPacket: new packet"), this.packet = new o, this._pos = 0, !0 } _emitError(e) { a("_emitError"), this.error = e, this.emit("error", e) }
  3289. }
  3290. t.exports = l
  3291. }, { "./constants": 38, "./packet": 42, bl: 15, debug: 18, events: 22 }],
  3292. 44: [function (e, t, r) {
  3293. (function (r) {
  3294. (function () {
  3295. const n = e("./constants"),
  3296. i = r.allocUnsafe(0),
  3297. o = r.from([0]),
  3298. s = e("./numbers"),
  3299. a = e("process-nextick-args").nextTick,
  3300. l = e("debug")("mqtt-packet:writeToStream"),
  3301. u = s.cache,
  3302. c = s.generateNumber,
  3303. h = s.generateCache,
  3304. f = s.genBufVariableByteInt,
  3305. p = s.generate4ByteBuffer;
  3306. let d = k,
  3307. g = !0;
  3308. function y(e, t, s) {
  3309. switch (l("generate called"), t.cork && (t.cork(), a(b, t)), g && (g = !1, h()), l("generate: packet.cmd: %s", e.cmd), e.cmd) {
  3310. case "connect":
  3311. return function (e, t, i) {
  3312. const o = e || {},
  3313. s = o.protocolId || "MQTT";
  3314. let a = o.protocolVersion || 4;
  3315. const l = o.will;
  3316. let u = o.clean;
  3317. const c = o.keepalive || 0,
  3318. h = o.clientId || "",
  3319. f = o.username,
  3320. p = o.password,
  3321. g = o.properties;
  3322. void 0 === u && (u = !0);
  3323. let y = 0;
  3324. if (!s || "string" != typeof s && !r.isBuffer(s)) return t.emit("error", new Error("Invalid protocolId")), !1;
  3325. y += s.length + 2;
  3326. if (3 !== a && 4 !== a && 5 !== a) return t.emit("error", new Error("Invalid protocol version")), !1;
  3327. y += 1;
  3328. if (("string" == typeof h || r.isBuffer(h)) && (h || a >= 4) && (h || u)) y += r.byteLength(h) + 2;
  3329. else { if (a < 4) return t.emit("error", new Error("clientId must be supplied before 3.1.1")), !1; if (1 * u == 0) return t.emit("error", new Error("clientId must be given if cleanSession set to 0")), !1 }
  3330. if ("number" != typeof c || c < 0 || c > 65535 || c % 1 != 0) return t.emit("error", new Error("Invalid keepalive")), !1;
  3331. y += 2;
  3332. if (y += 1, 5 === a) {
  3333. var b = C(t, g);
  3334. if (!b) return !1;
  3335. y += b.length
  3336. }
  3337. if (l) {
  3338. if ("object" != typeof l) return t.emit("error", new Error("Invalid will")), !1;
  3339. if (!l.topic || "string" != typeof l.topic) return t.emit("error", new Error("Invalid will topic")), !1;
  3340. if (y += r.byteLength(l.topic) + 2, y += 2, l.payload) { if (!(l.payload.length >= 0)) return t.emit("error", new Error("Invalid will payload")), !1; "string" == typeof l.payload ? y += r.byteLength(l.payload) : y += l.payload.length }
  3341. var m = {};
  3342. if (5 === a) {
  3343. if (!(m = C(t, l.properties))) return !1;
  3344. y += m.length
  3345. }
  3346. }
  3347. let _ = !1;
  3348. if (null != f) {
  3349. if (!P(f)) return t.emit("error", new Error("Invalid username")), !1;
  3350. _ = !0, y += r.byteLength(f) + 2
  3351. }
  3352. if (null != p) {
  3353. if (!_) return t.emit("error", new Error("Username is required to use password")), !1;
  3354. if (!P(p)) return t.emit("error", new Error("Invalid password")), !1;
  3355. y += I(p) + 2
  3356. }
  3357. t.write(n.CONNECT_HEADER), v(t, y), E(t, s), o.bridgeMode && (a += 128);
  3358. t.write(131 === a ? n.VERSION131 : 132 === a ? n.VERSION132 : 4 === a ? n.VERSION4 : 5 === a ? n.VERSION5 : n.VERSION3);
  3359. let k = 0;
  3360. k |= null != f ? n.USERNAME_MASK : 0, k |= null != p ? n.PASSWORD_MASK : 0, k |= l && l.retain ? n.WILL_RETAIN_MASK : 0, k |= l && l.qos ? l.qos << n.WILL_QOS_SHIFT : 0, k |= l ? n.WILL_FLAG_MASK : 0, k |= u ? n.CLEAN_SESSION_MASK : 0, t.write(r.from([k])), d(t, c), 5 === a && b.write();
  3361. E(t, h), l && (5 === a && m.write(), w(t, l.topic), E(t, l.payload));
  3362. null != f && E(t, f);
  3363. null != p && E(t, p);
  3364. return !0
  3365. }(e, t);
  3366. case "connack":
  3367. return function (e, t, i) {
  3368. const s = i ? i.protocolVersion : 4,
  3369. a = e || {},
  3370. l = 5 === s ? a.reasonCode : a.returnCode,
  3371. u = a.properties;
  3372. let c = 2;
  3373. if ("number" != typeof l) return t.emit("error", new Error("Invalid return code")), !1;
  3374. let h = null;
  3375. if (5 === s) {
  3376. if (!(h = C(t, u))) return !1;
  3377. c += h.length
  3378. }
  3379. t.write(n.CONNACK_HEADER), v(t, c), t.write(a.sessionPresent ? n.SESSIONPRESENT_HEADER : o), t.write(r.from([l])), null != h && h.write();
  3380. return !0
  3381. }(e, t, s);
  3382. case "publish":
  3383. return function (e, t, o) {
  3384. l("publish: packet: %o", e);
  3385. const s = o ? o.protocolVersion : 4,
  3386. a = e || {},
  3387. u = a.qos || 0,
  3388. c = a.retain ? n.RETAIN_MASK : 0,
  3389. h = a.topic,
  3390. f = a.payload || i,
  3391. p = a.messageId,
  3392. g = a.properties;
  3393. let y = 0;
  3394. if ("string" == typeof h) y += r.byteLength(h) + 2;
  3395. else {
  3396. if (!r.isBuffer(h)) return t.emit("error", new Error("Invalid topic")), !1;
  3397. y += h.length + 2
  3398. }
  3399. r.isBuffer(f) ? y += f.length : y += r.byteLength(f);
  3400. if (u && "number" != typeof p) return t.emit("error", new Error("Invalid messageId")), !1;
  3401. u && (y += 2);
  3402. let b = null;
  3403. if (5 === s) {
  3404. if (!(b = C(t, g))) return !1;
  3405. y += b.length
  3406. }
  3407. t.write(n.PUBLISH_HEADER[u][a.dup ? 1 : 0][c ? 1 : 0]), v(t, y), d(t, I(h)), t.write(h), u > 0 && d(t, p);
  3408. null != b && b.write();
  3409. return l("publish: payload: %o", f), t.write(f)
  3410. }(e, t, s);
  3411. case "puback":
  3412. case "pubrec":
  3413. case "pubrel":
  3414. case "pubcomp":
  3415. return function (e, t, i) {
  3416. const o = i ? i.protocolVersion : 4,
  3417. s = e || {},
  3418. a = s.cmd || "puback",
  3419. l = s.messageId,
  3420. u = s.dup && "pubrel" === a ? n.DUP_MASK : 0;
  3421. let c = 0;
  3422. const h = s.reasonCode,
  3423. f = s.properties;
  3424. let p = 5 === o ? 3 : 2;
  3425. "pubrel" === a && (c = 1);
  3426. if ("number" != typeof l) return t.emit("error", new Error("Invalid messageId")), !1;
  3427. let g = null;
  3428. if (5 === o && "object" == typeof f) {
  3429. if (!(g = T(t, f, i, p))) return !1;
  3430. p += g.length
  3431. }
  3432. t.write(n.ACKS[a][c][u][0]), v(t, p), d(t, l), 5 === o && t.write(r.from([h]));
  3433. null !== g && g.write();
  3434. return !0
  3435. }(e, t, s);
  3436. case "subscribe":
  3437. return function (e, t, i) {
  3438. l("subscribe: packet: ");
  3439. const o = i ? i.protocolVersion : 4,
  3440. s = e || {},
  3441. a = s.dup ? n.DUP_MASK : 0,
  3442. u = s.messageId,
  3443. c = s.subscriptions,
  3444. h = s.properties;
  3445. let f = 0;
  3446. if ("number" != typeof u) return t.emit("error", new Error("Invalid messageId")), !1;
  3447. f += 2;
  3448. let p = null;
  3449. if (5 === o) {
  3450. if (!(p = C(t, h))) return !1;
  3451. f += p.length
  3452. }
  3453. if ("object" != typeof c || !c.length) return t.emit("error", new Error("Invalid subscriptions")), !1;
  3454. for (let e = 0; e < c.length; e += 1) {
  3455. const n = c[e].topic,
  3456. i = c[e].qos;
  3457. if ("string" != typeof n) return t.emit("error", new Error("Invalid subscriptions - invalid topic")), !1;
  3458. if ("number" != typeof i) return t.emit("error", new Error("Invalid subscriptions - invalid qos")), !1;
  3459. if (5 === o) { const r = c[e].nl || !1; if ("boolean" != typeof r) return t.emit("error", new Error("Invalid subscriptions - invalid No Local")), !1; const n = c[e].rap || !1; if ("boolean" != typeof n) return t.emit("error", new Error("Invalid subscriptions - invalid Retain as Published")), !1; const i = c[e].rh || 0; if ("number" != typeof i || i > 2) return t.emit("error", new Error("Invalid subscriptions - invalid Retain Handling")), !1 } f += r.byteLength(n) + 2 + 1
  3460. }
  3461. l("subscribe: writing to stream: %o", n.SUBSCRIBE_HEADER), t.write(n.SUBSCRIBE_HEADER[1][a ? 1 : 0][0]), v(t, f), d(t, u), null !== p && p.write();
  3462. let g = !0;
  3463. for (const e of c) {
  3464. const i = e.topic,
  3465. s = e.qos,
  3466. a = +e.nl,
  3467. l = +e.rap,
  3468. u = e.rh;
  3469. let c;
  3470. w(t, i), c = n.SUBSCRIBE_OPTIONS_QOS[s], 5 === o && (c |= a ? n.SUBSCRIBE_OPTIONS_NL : 0, c |= l ? n.SUBSCRIBE_OPTIONS_RAP : 0, c |= u ? n.SUBSCRIBE_OPTIONS_RH[u] : 0), g = t.write(r.from([c]))
  3471. }
  3472. return g
  3473. }(e, t, s);
  3474. case "suback":
  3475. return function (e, t, i) {
  3476. const o = i ? i.protocolVersion : 4,
  3477. s = e || {},
  3478. a = s.messageId,
  3479. l = s.granted,
  3480. u = s.properties;
  3481. let c = 0;
  3482. if ("number" != typeof a) return t.emit("error", new Error("Invalid messageId")), !1;
  3483. c += 2;
  3484. if ("object" != typeof l || !l.length) return t.emit("error", new Error("Invalid qos vector")), !1;
  3485. for (let e = 0; e < l.length; e += 1) {
  3486. if ("number" != typeof l[e]) return t.emit("error", new Error("Invalid qos vector")), !1;
  3487. c += 1
  3488. }
  3489. let h = null;
  3490. if (5 === o) {
  3491. if (!(h = T(t, u, i, c))) return !1;
  3492. c += h.length
  3493. }
  3494. t.write(n.SUBACK_HEADER), v(t, c), d(t, a), null !== h && h.write();
  3495. return t.write(r.from(l))
  3496. }(e, t, s);
  3497. case "unsubscribe":
  3498. return function (e, t, i) {
  3499. const o = i ? i.protocolVersion : 4,
  3500. s = e || {},
  3501. a = s.messageId,
  3502. l = s.dup ? n.DUP_MASK : 0,
  3503. u = s.unsubscriptions,
  3504. c = s.properties;
  3505. let h = 0;
  3506. if ("number" != typeof a) return t.emit("error", new Error("Invalid messageId")), !1;
  3507. h += 2;
  3508. if ("object" != typeof u || !u.length) return t.emit("error", new Error("Invalid unsubscriptions")), !1;
  3509. for (let e = 0; e < u.length; e += 1) {
  3510. if ("string" != typeof u[e]) return t.emit("error", new Error("Invalid unsubscriptions")), !1;
  3511. h += r.byteLength(u[e]) + 2
  3512. }
  3513. let f = null;
  3514. if (5 === o) {
  3515. if (!(f = C(t, c))) return !1;
  3516. h += f.length
  3517. }
  3518. t.write(n.UNSUBSCRIBE_HEADER[1][l ? 1 : 0][0]), v(t, h), d(t, a), null !== f && f.write();
  3519. let p = !0;
  3520. for (let e = 0; e < u.length; e++) p = w(t, u[e]);
  3521. return p
  3522. }(e, t, s);
  3523. case "unsuback":
  3524. return function (e, t, i) {
  3525. const o = i ? i.protocolVersion : 4,
  3526. s = e || {},
  3527. a = s.messageId,
  3528. l = s.dup ? n.DUP_MASK : 0,
  3529. u = s.granted,
  3530. c = s.properties,
  3531. h = s.cmd;
  3532. let f = 2;
  3533. if ("number" != typeof a) return t.emit("error", new Error("Invalid messageId")), !1;
  3534. if (5 === o) {
  3535. if ("object" != typeof u || !u.length) return t.emit("error", new Error("Invalid qos vector")), !1;
  3536. for (let e = 0; e < u.length; e += 1) {
  3537. if ("number" != typeof u[e]) return t.emit("error", new Error("Invalid qos vector")), !1;
  3538. f += 1
  3539. }
  3540. }
  3541. let p = null;
  3542. if (5 === o) {
  3543. if (!(p = T(t, c, i, f))) return !1;
  3544. f += p.length
  3545. }
  3546. t.write(n.ACKS[h][0][l][0]), v(t, f), d(t, a), null !== p && p.write();
  3547. 5 === o && t.write(r.from(u));
  3548. return !0
  3549. }(e, t, s);
  3550. case "pingreq":
  3551. case "pingresp":
  3552. return function (e, t, r) { return t.write(n.EMPTY[e.cmd]) }(e, t);
  3553. case "disconnect":
  3554. return function (e, t, i) {
  3555. const o = i ? i.protocolVersion : 4,
  3556. s = e || {},
  3557. a = s.reasonCode,
  3558. l = s.properties;
  3559. let u = 5 === o ? 1 : 0,
  3560. c = null;
  3561. if (5 === o) {
  3562. if (!(c = T(t, l, i, u))) return !1;
  3563. u += c.length
  3564. }
  3565. t.write(r.from([n.codes.disconnect << 4])), v(t, u), 5 === o && t.write(r.from([a]));
  3566. null !== c && c.write();
  3567. return !0
  3568. }(e, t, s);
  3569. case "auth":
  3570. return function (e, t, i) {
  3571. const o = i ? i.protocolVersion : 4,
  3572. s = e || {},
  3573. a = s.reasonCode,
  3574. l = s.properties;
  3575. let u = 5 === o ? 1 : 0;
  3576. 5 !== o && t.emit("error", new Error("Invalid mqtt version for auth packet"));
  3577. const c = T(t, l, i, u);
  3578. if (!c) return !1;
  3579. u += c.length, t.write(r.from([n.codes.auth << 4])), v(t, u), t.write(r.from([a])), null !== c && c.write();
  3580. return !0
  3581. }(e, t, s);
  3582. default:
  3583. return t.emit("error", new Error("Unknown command")), !1
  3584. }
  3585. }
  3586. function b(e) { e.uncork() } Object.defineProperty(y, "cacheNumbers", { get: () => d === k, set(e) { e ? (u && 0 !== Object.keys(u).length || (g = !0), d = k) : (g = !1, d = S) } });
  3587. const m = {};
  3588. function v(e, t) { if (t > n.VARBYTEINT_MAX) return e.emit("error", new Error(`Invalid variable byte integer: ${t}`)), !1; let r = m[t]; return r || (r = f(t), t < 16384 && (m[t] = r)), l("writeVarByteInt: writing to stream: %o", r), e.write(r) }
  3589. function w(e, t) { const n = r.byteLength(t); return d(e, n), l("writeString: %s", t), e.write(t, "utf8") }
  3590. function _(e, t, r) { w(e, t), w(e, r) }
  3591. function k(e, t) { return l("writeNumberCached: number: %d", t), l("writeNumberCached: %o", u[t]), e.write(u[t]) }
  3592. function S(e, t) { const r = c(t); return l("writeNumberGenerated: %o", r), e.write(r) }
  3593. function E(e, t) { "string" == typeof t ? w(e, t) : t ? (d(e, t.length), e.write(t)) : d(e, 0) }
  3594. function C(e, t) {
  3595. if ("object" != typeof t || null != t.length) return { length: 1, write() { A(e, {}, 0) } };
  3596. let i = 0;
  3597. function o(t, i) {
  3598. let o = 0;
  3599. switch (n.propertiesTypes[t]) {
  3600. case "byte":
  3601. if ("boolean" != typeof i) return e.emit("error", new Error(`Invalid ${t}: ${i}`)), !1;
  3602. o += 2;
  3603. break;
  3604. case "int8":
  3605. if ("number" != typeof i || i < 0 || i > 255) return e.emit("error", new Error(`Invalid ${t}: ${i}`)), !1;
  3606. o += 2;
  3607. break;
  3608. case "binary":
  3609. if (i && null === i) return e.emit("error", new Error(`Invalid ${t}: ${i}`)), !1;
  3610. o += 1 + r.byteLength(i) + 2;
  3611. break;
  3612. case "int16":
  3613. if ("number" != typeof i || i < 0 || i > 65535) return e.emit("error", new Error(`Invalid ${t}: ${i}`)), !1;
  3614. o += 3;
  3615. break;
  3616. case "int32":
  3617. if ("number" != typeof i || i < 0 || i > 4294967295) return e.emit("error", new Error(`Invalid ${t}: ${i}`)), !1;
  3618. o += 5;
  3619. break;
  3620. case "var":
  3621. if ("number" != typeof i || i < 0 || i > 268435455) return e.emit("error", new Error(`Invalid ${t}: ${i}`)), !1;
  3622. o += 1 + r.byteLength(f(i));
  3623. break;
  3624. case "string":
  3625. if ("string" != typeof i) return e.emit("error", new Error(`Invalid ${t}: ${i}`)), !1;
  3626. o += 3 + r.byteLength(i.toString());
  3627. break;
  3628. case "pair":
  3629. if ("object" != typeof i) return e.emit("error", new Error(`Invalid ${t}: ${i}`)), !1;
  3630. o += Object.getOwnPropertyNames(i).reduce((e, t) => { const n = i[t]; return Array.isArray(n) ? e += n.reduce((e, n) => e += 3 + r.byteLength(t.toString()) + 2 + r.byteLength(n.toString()), 0) : e += 3 + r.byteLength(t.toString()) + 2 + r.byteLength(i[t].toString()), e }, 0);
  3631. break;
  3632. default:
  3633. return e.emit("error", new Error(`Invalid property ${t}: ${i}`)), !1
  3634. }
  3635. return o
  3636. }
  3637. if (t)
  3638. for (const e in t) {
  3639. let r = 0,
  3640. n = 0;
  3641. const s = t[e];
  3642. if (Array.isArray(s))
  3643. for (let t = 0; t < s.length; t++) {
  3644. if (!(n = o(e, s[t]))) return !1;
  3645. r += n
  3646. } else {
  3647. if (!(n = o(e, s))) return !1;
  3648. r = n
  3649. }
  3650. if (!r) return !1;
  3651. i += r
  3652. }
  3653. return { length: r.byteLength(f(i)) + i, write() { A(e, t, i) } }
  3654. }
  3655. function T(e, t, r, n) {
  3656. const i = ["reasonString", "userProperties"],
  3657. o = r && r.properties && r.properties.maximumPacketSize ? r.properties.maximumPacketSize : 0;
  3658. let s = C(e, t);
  3659. if (o)
  3660. for (; n + s.length > o;) {
  3661. const r = i.shift();
  3662. if (!r || !t[r]) return !1;
  3663. delete t[r], s = C(e, t)
  3664. }
  3665. return s
  3666. }
  3667. function x(e, t, i) {
  3668. switch (n.propertiesTypes[t]) {
  3669. case "byte":
  3670. e.write(r.from([n.properties[t]])), e.write(r.from([+i]));
  3671. break;
  3672. case "int8":
  3673. e.write(r.from([n.properties[t]])), e.write(r.from([i]));
  3674. break;
  3675. case "binary":
  3676. e.write(r.from([n.properties[t]])), E(e, i);
  3677. break;
  3678. case "int16":
  3679. e.write(r.from([n.properties[t]])), d(e, i);
  3680. break;
  3681. case "int32":
  3682. e.write(r.from([n.properties[t]])),
  3683. function (e, t) {
  3684. const r = p(t);
  3685. l("write4ByteNumber: %o", r), e.write(r)
  3686. }(e, i);
  3687. break;
  3688. case "var":
  3689. e.write(r.from([n.properties[t]])), v(e, i);
  3690. break;
  3691. case "string":
  3692. e.write(r.from([n.properties[t]])), w(e, i);
  3693. break;
  3694. case "pair":
  3695. Object.getOwnPropertyNames(i).forEach(o => {
  3696. const s = i[o];
  3697. Array.isArray(s) ? s.forEach(i => { e.write(r.from([n.properties[t]])), _(e, o.toString(), i.toString()) }) : (e.write(r.from([n.properties[t]])), _(e, o.toString(), s.toString()))
  3698. });
  3699. break;
  3700. default:
  3701. return e.emit("error", new Error(`Invalid property ${t} value: ${i}`)), !1
  3702. }
  3703. }
  3704. function A(e, t, r) {
  3705. v(e, r);
  3706. for (const r in t)
  3707. if (Object.prototype.hasOwnProperty.call(t, r) && null !== t[r]) {
  3708. const n = t[r];
  3709. if (Array.isArray(n))
  3710. for (let t = 0; t < n.length; t++) x(e, r, n[t]);
  3711. else x(e, r, n)
  3712. }
  3713. }
  3714. function I(e) { return e ? e instanceof r ? e.length : r.byteLength(e) : 0 }
  3715. function P(e) { return "string" == typeof e || e instanceof r } t.exports = y
  3716. }).call(this)
  3717. }).call(this, e("buffer").Buffer)
  3718. }, { "./constants": 38, "./numbers": 41, buffer: 17, debug: 18, "process-nextick-args": 49 }],
  3719. 45: [function (e, t, r) {
  3720. var n = 1e3,
  3721. i = 60 * n,
  3722. o = 60 * i,
  3723. s = 24 * o,
  3724. a = 7 * s,
  3725. l = 365.25 * s;
  3726. function u(e, t, r, n) { var i = t >= 1.5 * r; return Math.round(e / r) + " " + n + (i ? "s" : "") } t.exports = function (e, t) {
  3727. t = t || {};
  3728. var r = typeof e;
  3729. if ("string" === r && e.length > 0) return function (e) {
  3730. if ((e = String(e)).length > 100) return;
  3731. var t = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);
  3732. if (!t) return;
  3733. var r = parseFloat(t[1]);
  3734. switch ((t[2] || "ms").toLowerCase()) {
  3735. case "years":
  3736. case "year":
  3737. case "yrs":
  3738. case "yr":
  3739. case "y":
  3740. return r * l;
  3741. case "weeks":
  3742. case "week":
  3743. case "w":
  3744. return r * a;
  3745. case "days":
  3746. case "day":
  3747. case "d":
  3748. return r * s;
  3749. case "hours":
  3750. case "hour":
  3751. case "hrs":
  3752. case "hr":
  3753. case "h":
  3754. return r * o;
  3755. case "minutes":
  3756. case "minute":
  3757. case "mins":
  3758. case "min":
  3759. case "m":
  3760. return r * i;
  3761. case "seconds":
  3762. case "second":
  3763. case "secs":
  3764. case "sec":
  3765. case "s":
  3766. return r * n;
  3767. case "milliseconds":
  3768. case "millisecond":
  3769. case "msecs":
  3770. case "msec":
  3771. case "ms":
  3772. return r;
  3773. default:
  3774. return
  3775. }
  3776. }(e);
  3777. if ("number" === r && isFinite(e)) return t.long ? function (e) { var t = Math.abs(e); if (t >= s) return u(e, t, s, "day"); if (t >= o) return u(e, t, o, "hour"); if (t >= i) return u(e, t, i, "minute"); if (t >= n) return u(e, t, n, "second"); return e + " ms" }(e) : function (e) { var t = Math.abs(e); if (t >= s) return Math.round(e / s) + "d"; if (t >= o) return Math.round(e / o) + "h"; if (t >= i) return Math.round(e / i) + "m"; if (t >= n) return Math.round(e / n) + "s"; return e + "ms" }(e);
  3778. throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(e))
  3779. }
  3780. }, {}],
  3781. 46: [function (e, t, r) {
  3782. const n = e("./lib/number-allocator.js");
  3783. t.exports.NumberAllocator = n
  3784. }, { "./lib/number-allocator.js": 47 }],
  3785. 47: [function (e, t, r) {
  3786. "use strict";
  3787. const n = e("js-sdsl").Set,
  3788. i = e("debug")("number-allocator:trace"),
  3789. o = e("debug")("number-allocator:error");
  3790. function s(e, t) { this.low = e, this.high = t }
  3791. function a(e, t) {
  3792. if (!(this instanceof a)) return new a(e, t);
  3793. this.min = e, this.max = t, this.ss = new n([], (e, t) => e.compare(t)), i("Create"), this.clear()
  3794. }
  3795. s.prototype.equals = function (e) { return this.low === e.low && this.high === e.high }, s.prototype.compare = function (e) { return this.low < e.low && this.high < e.low ? -1 : e.low < this.low && e.high < this.low ? 1 : 0 }, a.prototype.firstVacant = function () { return 0 === this.ss.size() ? null : this.ss.front().low }, a.prototype.alloc = function () {
  3796. if (0 === this.ss.size()) return i("alloc():empty"), null;
  3797. const e = this.ss.front(),
  3798. t = e.low;
  3799. return t + 1 <= e.high ? ++e.low : this.ss.eraseElementByPos(0), i("alloc():" + t), t
  3800. }, a.prototype.use = function (e) {
  3801. const t = new s(e, e),
  3802. r = this.ss.lowerBound(t);
  3803. if (r) { if (r.equals(t)) return this.ss.eraseElementByValue(r), i("use():" + e), !0; if (r.low > e) return !1; if (r.low === e) return ++r.low, i("use():" + e), !0; if (r.high === e) return --r.high, i("use():" + e), !0; const n = r.low; return r.low = e + 1, this.ss.insert(new s(n, e - 1)), i("use():" + e), !0 }
  3804. return i("use():failed"), !1
  3805. }, a.prototype.free = function (e) {
  3806. if (e < this.min || e > this.max) return void o("free():" + e + " is out of range");
  3807. const t = new s(e, e),
  3808. r = this.ss.lowerBound(t);
  3809. if (r) {
  3810. if (r.low <= e && e <= r.high) return void o("free():" + e + " has already been vacant");
  3811. if (r === this.ss.front()) e + 1 === r.low ? --r.low : this.ss.insert(t);
  3812. else {
  3813. const n = this.ss.reverseLowerBound(t);
  3814. n.high + 1 === e ? e + 1 === r.low ? (this.ss.eraseElementByValue(n), r.low = n.low) : n.high = e : e + 1 === r.low ? r.low = e : this.ss.insert(t)
  3815. }
  3816. } else {
  3817. if (r === this.ss.front()) return void this.ss.insert(t);
  3818. const n = this.ss.reverseLowerBound(t);
  3819. n.high + 1 === e ? n.high = e : this.ss.insert(t)
  3820. }
  3821. i("free():" + e)
  3822. }, a.prototype.clear = function () { i("clear()"), this.ss.clear(), this.ss.insert(new s(this.min, this.max)) }, a.prototype.intervalCount = function () { return this.ss.size() }, a.prototype.dump = function () { console.log("length:" + this.ss.size()); for (const e of this.ss) console.log(e) }, t.exports = a
  3823. }, { debug: 18, "js-sdsl": 36 }],
  3824. 48: [function (e, t, r) {
  3825. var n = e("wrappy");
  3826. function i(e) { var t = function () { return t.called ? t.value : (t.called = !0, t.value = e.apply(this, arguments)) }; return t.called = !1, t }
  3827. function o(e) {
  3828. var t = function () { if (t.called) throw new Error(t.onceError); return t.called = !0, t.value = e.apply(this, arguments) },
  3829. r = e.name || "Function wrapped with `once`";
  3830. return t.onceError = r + " shouldn't be called more than once", t.called = !1, t
  3831. }
  3832. t.exports = n(i), t.exports.strict = n(o), i.proto = i(function () { Object.defineProperty(Function.prototype, "once", { value: function () { return i(this) }, configurable: !0 }), Object.defineProperty(Function.prototype, "onceStrict", { value: function () { return o(this) }, configurable: !0 }) })
  3833. }, { wrappy: 79 }],
  3834. 49: [function (e, t, r) {
  3835. (function (e) {
  3836. (function () {
  3837. "use strict";
  3838. void 0 === e || !e.version || 0 === e.version.indexOf("v0.") || 0 === e.version.indexOf("v1.") && 0 !== e.version.indexOf("v1.8.") ? t.exports = {
  3839. nextTick: function (t, r, n, i) {
  3840. if ("function" != typeof t) throw new TypeError('"callback" argument must be a function');
  3841. var o, s, a = arguments.length;
  3842. switch (a) {
  3843. case 0:
  3844. case 1:
  3845. return e.nextTick(t);
  3846. case 2:
  3847. return e.nextTick(function () { t.call(null, r) });
  3848. case 3:
  3849. return e.nextTick(function () { t.call(null, r, n) });
  3850. case 4:
  3851. return e.nextTick(function () { t.call(null, r, n, i) });
  3852. default:
  3853. for (o = new Array(a - 1), s = 0; s < o.length;) o[s++] = arguments[s];
  3854. return e.nextTick(function () { t.apply(null, o) })
  3855. }
  3856. }
  3857. } : t.exports = e
  3858. }).call(this)
  3859. }).call(this, e("_process"))
  3860. }, { _process: 50 }],
  3861. 50: [function (e, t, r) {
  3862. var n, i, o = t.exports = {};
  3863. function s() { throw new Error("setTimeout has not been defined") }
  3864. function a() { throw new Error("clearTimeout has not been defined") }
  3865. function l(e) { if (n === setTimeout) return setTimeout(e, 0); if ((n === s || !n) && setTimeout) return n = setTimeout, setTimeout(e, 0); try { return n(e, 0) } catch (t) { try { return n.call(null, e, 0) } catch (t) { return n.call(this, e, 0) } } }! function () { try { n = "function" == typeof setTimeout ? setTimeout : s } catch (e) { n = s } try { i = "function" == typeof clearTimeout ? clearTimeout : a } catch (e) { i = a } }();
  3866. var u, c = [],
  3867. h = !1,
  3868. f = -1;
  3869. function p() { h && u && (h = !1, u.length ? c = u.concat(c) : f = -1, c.length && d()) }
  3870. function d() {
  3871. if (!h) {
  3872. var e = l(p);
  3873. h = !0;
  3874. for (var t = c.length; t;) {
  3875. for (u = c, c = []; ++f < t;) u && u[f].run();
  3876. f = -1, t = c.length
  3877. }
  3878. u = null, h = !1,
  3879. function (e) { if (i === clearTimeout) return clearTimeout(e); if ((i === a || !i) && clearTimeout) return i = clearTimeout, clearTimeout(e); try { i(e) } catch (t) { try { return i.call(null, e) } catch (t) { return i.call(this, e) } } }(e)
  3880. }
  3881. }
  3882. function g(e, t) { this.fun = e, this.array = t }
  3883. function y() {} o.nextTick = function (e) {
  3884. var t = new Array(arguments.length - 1);
  3885. if (arguments.length > 1)
  3886. for (var r = 1; r < arguments.length; r++) t[r - 1] = arguments[r];
  3887. c.push(new g(e, t)), 1 !== c.length || h || l(d)
  3888. }, g.prototype.run = function () { this.fun.apply(null, this.array) }, o.title = "browser", o.browser = !0, o.env = {}, o.argv = [], o.version = "", o.versions = {}, o.on = y, o.addListener = y, o.once = y, o.off = y, o.removeListener = y, o.removeAllListeners = y, o.emit = y, o.prependListener = y, o.prependOnceListener = y, o.listeners = function (e) { return [] }, o.binding = function (e) { throw new Error("process.binding is not supported") }, o.cwd = function () { return "/" }, o.chdir = function (e) { throw new Error("process.chdir is not supported") }, o.umask = function () { return 0 }
  3889. }, {}],
  3890. 51: [function (e, t, r) {
  3891. (function (e) {
  3892. (function () {
  3893. ! function (n) {
  3894. var i = "object" == typeof r && r && !r.nodeType && r,
  3895. o = "object" == typeof t && t && !t.nodeType && t,
  3896. s = "object" == typeof e && e;
  3897. s.global !== s && s.window !== s && s.self !== s || (n = s);
  3898. var a, l, u = 2147483647,
  3899. c = 36,
  3900. h = 1,
  3901. f = 26,
  3902. p = 38,
  3903. d = 700,
  3904. g = 72,
  3905. y = 128,
  3906. b = "-",
  3907. m = /^xn--/,
  3908. v = /[^\x20-\x7E]/,
  3909. w = /[\x2E\u3002\uFF0E\uFF61]/g,
  3910. _ = { overflow: "Overflow: input needs wider integers to process", "not-basic": "Illegal input >= 0x80 (not a basic code point)", "invalid-input": "Invalid input" },
  3911. k = c - h,
  3912. S = Math.floor,
  3913. E = String.fromCharCode;
  3914. function C(e) { throw new RangeError(_[e]) }
  3915. function T(e, t) { for (var r = e.length, n = []; r--;) n[r] = t(e[r]); return n }
  3916. function x(e, t) {
  3917. var r = e.split("@"),
  3918. n = "";
  3919. return r.length > 1 && (n = r[0] + "@", e = r[1]), n + T((e = e.replace(w, ".")).split("."), t).join(".")
  3920. }
  3921. function A(e) { for (var t, r, n = [], i = 0, o = e.length; i < o;)(t = e.charCodeAt(i++)) >= 55296 && t <= 56319 && i < o ? 56320 == (64512 & (r = e.charCodeAt(i++))) ? n.push(((1023 & t) << 10) + (1023 & r) + 65536) : (n.push(t), i--) : n.push(t); return n }
  3922. function I(e) { return T(e, function (e) { var t = ""; return e > 65535 && (t += E((e -= 65536) >>> 10 & 1023 | 55296), e = 56320 | 1023 & e), t += E(e) }).join("") }
  3923. function P(e, t) { return e + 22 + 75 * (e < 26) - ((0 != t) << 5) }
  3924. function O(e, t, r) { var n = 0; for (e = r ? S(e / d) : e >> 1, e += S(e / t); e > k * f >> 1; n += c) e = S(e / k); return S(n + (k + 1) * e / (e + p)) }
  3925. function B(e) {
  3926. var t, r, n, i, o, s, a, l, p, d, m, v = [],
  3927. w = e.length,
  3928. _ = 0,
  3929. k = y,
  3930. E = g;
  3931. for ((r = e.lastIndexOf(b)) < 0 && (r = 0), n = 0; n < r; ++n) e.charCodeAt(n) >= 128 && C("not-basic"), v.push(e.charCodeAt(n));
  3932. for (i = r > 0 ? r + 1 : 0; i < w;) {
  3933. for (o = _, s = 1, a = c; i >= w && C("invalid-input"), ((l = (m = e.charCodeAt(i++)) - 48 < 10 ? m - 22 : m - 65 < 26 ? m - 65 : m - 97 < 26 ? m - 97 : c) >= c || l > S((u - _) / s)) && C("overflow"), _ += l * s, !(l < (p = a <= E ? h : a >= E + f ? f : a - E)); a += c) s > S(u / (d = c - p)) && C("overflow"), s *= d;
  3934. E = O(_ - o, t = v.length + 1, 0 == o), S(_ / t) > u - k && C("overflow"), k += S(_ / t), _ %= t, v.splice(_++, 0, k)
  3935. }
  3936. return I(v)
  3937. }
  3938. function R(e) {
  3939. var t, r, n, i, o, s, a, l, p, d, m, v, w, _, k, T = [];
  3940. for (v = (e = A(e)).length, t = y, r = 0, o = g, s = 0; s < v; ++s)(m = e[s]) < 128 && T.push(E(m));
  3941. for (n = i = T.length, i && T.push(b); n < v;) {
  3942. for (a = u, s = 0; s < v; ++s)(m = e[s]) >= t && m < a && (a = m);
  3943. for (a - t > S((u - r) / (w = n + 1)) && C("overflow"), r += (a - t) * w, t = a, s = 0; s < v; ++s)
  3944. if ((m = e[s]) < t && ++r > u && C("overflow"), m == t) {
  3945. for (l = r, p = c; !(l < (d = p <= o ? h : p >= o + f ? f : p - o)); p += c) k = l - d, _ = c - d, T.push(E(P(d + k % _, 0))), l = S(k / _);
  3946. T.push(E(P(l, 0))), o = O(r, w, n == i), r = 0, ++n
  3947. }++ r, ++t
  3948. }
  3949. return T.join("")
  3950. }
  3951. if (a = { version: "1.4.1", ucs2: { decode: A, encode: I }, decode: B, encode: R, toASCII: function (e) { return x(e, function (e) { return v.test(e) ? "xn--" + R(e) : e }) }, toUnicode: function (e) { return x(e, function (e) { return m.test(e) ? B(e.slice(4).toLowerCase()) : e }) } }, i && o)
  3952. if (t.exports == i) o.exports = a;
  3953. else
  3954. for (l in a) a.hasOwnProperty(l) && (i[l] = a[l]);
  3955. else n.punycode = a
  3956. }(this)
  3957. }).call(this)
  3958. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
  3959. }, {}],
  3960. 52: [function (e, t, r) {
  3961. "use strict";
  3962. function n(e, t) { return Object.prototype.hasOwnProperty.call(e, t) } t.exports = function (e, t, r, o) {
  3963. t = t || "&", r = r || "=";
  3964. var s = {};
  3965. if ("string" != typeof e || 0 === e.length) return s;
  3966. var a = /\+/g;
  3967. e = e.split(t);
  3968. var l = 1e3;
  3969. o && "number" == typeof o.maxKeys && (l = o.maxKeys);
  3970. var u = e.length;
  3971. l > 0 && u > l && (u = l);
  3972. for (var c = 0; c < u; ++c) {
  3973. var h, f, p, d, g = e[c].replace(a, "%20"),
  3974. y = g.indexOf(r);
  3975. y >= 0 ? (h = g.substr(0, y), f = g.substr(y + 1)) : (h = g, f = ""), p = decodeURIComponent(h), d = decodeURIComponent(f), n(s, p) ? i(s[p]) ? s[p].push(d) : s[p] = [s[p], d] : s[p] = d
  3976. }
  3977. return s
  3978. };
  3979. var i = Array.isArray || function (e) { return "[object Array]" === Object.prototype.toString.call(e) }
  3980. }, {}],
  3981. 53: [function (e, t, r) {
  3982. "use strict";
  3983. var n = function (e) {
  3984. switch (typeof e) {
  3985. case "string":
  3986. return e;
  3987. case "boolean":
  3988. return e ? "true" : "false";
  3989. case "number":
  3990. return isFinite(e) ? e : "";
  3991. default:
  3992. return ""
  3993. }
  3994. };
  3995. t.exports = function (e, t, r, a) { return t = t || "&", r = r || "=", null === e && (e = void 0), "object" == typeof e ? o(s(e), function (s) { var a = encodeURIComponent(n(s)) + r; return i(e[s]) ? o(e[s], function (e) { return a + encodeURIComponent(n(e)) }).join(t) : a + encodeURIComponent(n(e[s])) }).join(t) : a ? encodeURIComponent(n(a)) + r + encodeURIComponent(n(e)) : "" };
  3996. var i = Array.isArray || function (e) { return "[object Array]" === Object.prototype.toString.call(e) };
  3997. function o(e, t) { if (e.map) return e.map(t); for (var r = [], n = 0; n < e.length; n++) r.push(t(e[n], n)); return r }
  3998. var s = Object.keys || function (e) { var t = []; for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.push(r); return t }
  3999. }, {}],
  4000. 54: [function (e, t, r) {
  4001. "use strict";
  4002. r.decode = r.parse = e("./decode"), r.encode = r.stringify = e("./encode")
  4003. }, { "./decode": 52, "./encode": 53 }],
  4004. 55: [function (e, t, r) {
  4005. "use strict";
  4006. var n = {};
  4007. function i(e, t, r) {
  4008. r || (r = Error);
  4009. var i = function (e) {
  4010. var r, n;
  4011. function i(r, n, i) { return e.call(this, function (e, r, n) { return "string" == typeof t ? t : t(e, r, n) }(r, n, i)) || this }
  4012. return n = e, (r = i).prototype = Object.create(n.prototype), r.prototype.constructor = r, r.__proto__ = n, i
  4013. }(r);
  4014. i.prototype.name = r.name, i.prototype.code = e, n[e] = i
  4015. }
  4016. function o(e, t) { if (Array.isArray(e)) { var r = e.length; return e = e.map(function (e) { return String(e) }), r > 2 ? "one of ".concat(t, " ").concat(e.slice(0, r - 1).join(", "), ", or ") + e[r - 1] : 2 === r ? "one of ".concat(t, " ").concat(e[0], " or ").concat(e[1]) : "of ".concat(t, " ").concat(e[0]) } return "of ".concat(t, " ").concat(String(e)) } i("ERR_INVALID_OPT_VALUE", function (e, t) { return 'The value "' + t + '" is invalid for option "' + e + '"' }, TypeError), i("ERR_INVALID_ARG_TYPE", function (e, t, r) {
  4017. var n, i, s, a;
  4018. if ("string" == typeof t && (i = "not ", t.substr(!s || s < 0 ? 0 : +s, i.length) === i) ? (n = "must not be", t = t.replace(/^not /, "")) : n = "must be", function (e, t, r) { return (void 0 === r || r > e.length) && (r = e.length), e.substring(r - t.length, r) === t }(e, " argument")) a = "The ".concat(e, " ").concat(n, " ").concat(o(t, "type"));
  4019. else {
  4020. var l = function (e, t, r) { return "number" != typeof r && (r = 0), !(r + t.length > e.length) && -1 !== e.indexOf(t, r) }(e, ".") ? "property" : "argument";
  4021. a = 'The "'.concat(e, '" ').concat(l, " ").concat(n, " ").concat(o(t, "type"))
  4022. }
  4023. return a += ". Received type ".concat(typeof r)
  4024. }, TypeError), i("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF"), i("ERR_METHOD_NOT_IMPLEMENTED", function (e) { return "The " + e + " method is not implemented" }), i("ERR_STREAM_PREMATURE_CLOSE", "Premature close"), i("ERR_STREAM_DESTROYED", function (e) { return "Cannot call " + e + " after a stream was destroyed" }), i("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"), i("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable"), i("ERR_STREAM_WRITE_AFTER_END", "write after end"), i("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError), i("ERR_UNKNOWN_ENCODING", function (e) { return "Unknown encoding: " + e }, TypeError), i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event"), t.exports.codes = n
  4025. }, {}],
  4026. 56: [function (e, t, r) {
  4027. (function (r) {
  4028. (function () {
  4029. "use strict";
  4030. var n = Object.keys || function (e) { var t = []; for (var r in e) t.push(r); return t };
  4031. t.exports = u;
  4032. var i = e("./_stream_readable"),
  4033. o = e("./_stream_writable");
  4034. e("inherits")(u, i);
  4035. for (var s = n(o.prototype), a = 0; a < s.length; a++) {
  4036. var l = s[a];
  4037. u.prototype[l] || (u.prototype[l] = o.prototype[l])
  4038. }
  4039. function u(e) {
  4040. if (!(this instanceof u)) return new u(e);
  4041. i.call(this, e), o.call(this, e), this.allowHalfOpen = !0, e && (!1 === e.readable && (this.readable = !1), !1 === e.writable && (this.writable = !1), !1 === e.allowHalfOpen && (this.allowHalfOpen = !1, this.once("end", c)))
  4042. }
  4043. function c() { this._writableState.ended || r.nextTick(h, this) }
  4044. function h(e) { e.end() } Object.defineProperty(u.prototype, "writableHighWaterMark", { enumerable: !1, get: function () { return this._writableState.highWaterMark } }), Object.defineProperty(u.prototype, "writableBuffer", { enumerable: !1, get: function () { return this._writableState && this._writableState.getBuffer() } }), Object.defineProperty(u.prototype, "writableLength", { enumerable: !1, get: function () { return this._writableState.length } }), Object.defineProperty(u.prototype, "destroyed", { enumerable: !1, get: function () { return void 0 !== this._readableState && void 0 !== this._writableState && (this._readableState.destroyed && this._writableState.destroyed) }, set: function (e) { void 0 !== this._readableState && void 0 !== this._writableState && (this._readableState.destroyed = e, this._writableState.destroyed = e) } })
  4045. }).call(this)
  4046. }).call(this, e("_process"))
  4047. }, { "./_stream_readable": 58, "./_stream_writable": 60, _process: 50, inherits: 24 }],
  4048. 57: [function (e, t, r) {
  4049. "use strict";
  4050. t.exports = i;
  4051. var n = e("./_stream_transform");
  4052. function i(e) {
  4053. if (!(this instanceof i)) return new i(e);
  4054. n.call(this, e)
  4055. }
  4056. e("inherits")(i, n), i.prototype._transform = function (e, t, r) { r(null, e) }
  4057. }, { "./_stream_transform": 59, inherits: 24 }],
  4058. 58: [function (e, t, r) {
  4059. (function (r, n) {
  4060. (function () {
  4061. "use strict";
  4062. var i;
  4063. t.exports = C, C.ReadableState = E;
  4064. e("events").EventEmitter;
  4065. var o = function (e, t) { return e.listeners(t).length },
  4066. s = e("./internal/streams/stream"),
  4067. a = e("buffer").Buffer,
  4068. l = n.Uint8Array || function () {};
  4069. var u, c = e("util");
  4070. u = c && c.debuglog ? c.debuglog("stream") : function () {};
  4071. var h, f, p, d = e("./internal/streams/buffer_list"),
  4072. g = e("./internal/streams/destroy"),
  4073. y = e("./internal/streams/state").getHighWaterMark,
  4074. b = e("../errors").codes,
  4075. m = b.ERR_INVALID_ARG_TYPE,
  4076. v = b.ERR_STREAM_PUSH_AFTER_EOF,
  4077. w = b.ERR_METHOD_NOT_IMPLEMENTED,
  4078. _ = b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
  4079. e("inherits")(C, s);
  4080. var k = g.errorOrDestroy,
  4081. S = ["error", "close", "destroy", "pause", "resume"];
  4082. function E(t, r, n) { i = i || e("./_stream_duplex"), t = t || {}, "boolean" != typeof n && (n = r instanceof i), this.objectMode = !!t.objectMode, n && (this.objectMode = this.objectMode || !!t.readableObjectMode), this.highWaterMark = y(this, t, "readableHighWaterMark", n), this.buffer = new d, this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this.reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this.readableListening = !1, this.resumeScheduled = !1, this.paused = !0, this.emitClose = !1 !== t.emitClose, this.autoDestroy = !!t.autoDestroy, this.destroyed = !1, this.defaultEncoding = t.defaultEncoding || "utf8", this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this.encoding = null, t.encoding && (h || (h = e("string_decoder/").StringDecoder), this.decoder = new h(t.encoding), this.encoding = t.encoding) }
  4083. function C(t) {
  4084. if (i = i || e("./_stream_duplex"), !(this instanceof C)) return new C(t);
  4085. var r = this instanceof i;
  4086. this._readableState = new E(t, this, r), this.readable = !0, t && ("function" == typeof t.read && (this._read = t.read), "function" == typeof t.destroy && (this._destroy = t.destroy)), s.call(this)
  4087. }
  4088. function T(e, t, r, n, i) {
  4089. u("readableAddChunk", t);
  4090. var o, s = e._readableState;
  4091. if (null === t) s.reading = !1,
  4092. function (e, t) {
  4093. if (u("onEofChunk"), t.ended) return;
  4094. if (t.decoder) {
  4095. var r = t.decoder.end();
  4096. r && r.length && (t.buffer.push(r), t.length += t.objectMode ? 1 : r.length)
  4097. }
  4098. t.ended = !0, t.sync ? P(e) : (t.needReadable = !1, t.emittedReadable || (t.emittedReadable = !0, O(e)))
  4099. }(e, s);
  4100. else if (i || (o = function (e, t) {
  4101. var r;
  4102. n = t, a.isBuffer(n) || n instanceof l || "string" == typeof t || void 0 === t || e.objectMode || (r = new m("chunk", ["string", "Buffer", "Uint8Array"], t));
  4103. var n;
  4104. return r
  4105. }(s, t)), o) k(e, o);
  4106. else if (s.objectMode || t && t.length > 0)
  4107. if ("string" == typeof t || s.objectMode || Object.getPrototypeOf(t) === a.prototype || (t = function (e) { return a.from(e) }(t)), n) s.endEmitted ? k(e, new _) : x(e, s, t, !0);
  4108. else if (s.ended) k(e, new v);
  4109. else {
  4110. if (s.destroyed) return !1;
  4111. s.reading = !1, s.decoder && !r ? (t = s.decoder.write(t), s.objectMode || 0 !== t.length ? x(e, s, t, !1) : B(e, s)) : x(e, s, t, !1)
  4112. } else n || (s.reading = !1, B(e, s));
  4113. return !s.ended && (s.length < s.highWaterMark || 0 === s.length)
  4114. }
  4115. function x(e, t, r, n) { t.flowing && 0 === t.length && !t.sync ? (t.awaitDrain = 0, e.emit("data", r)) : (t.length += t.objectMode ? 1 : r.length, n ? t.buffer.unshift(r) : t.buffer.push(r), t.needReadable && P(e)), B(e, t) } Object.defineProperty(C.prototype, "destroyed", { enumerable: !1, get: function () { return void 0 !== this._readableState && this._readableState.destroyed }, set: function (e) { this._readableState && (this._readableState.destroyed = e) } }), C.prototype.destroy = g.destroy, C.prototype._undestroy = g.undestroy, C.prototype._destroy = function (e, t) { t(e) }, C.prototype.push = function (e, t) { var r, n = this._readableState; return n.objectMode ? r = !0 : "string" == typeof e && ((t = t || n.defaultEncoding) !== n.encoding && (e = a.from(e, t), t = ""), r = !0), T(this, e, t, !1, r) }, C.prototype.unshift = function (e) { return T(this, e, null, !0, !1) }, C.prototype.isPaused = function () { return !1 === this._readableState.flowing }, C.prototype.setEncoding = function (t) {
  4116. h || (h = e("string_decoder/").StringDecoder);
  4117. var r = new h(t);
  4118. this._readableState.decoder = r, this._readableState.encoding = this._readableState.decoder.encoding;
  4119. for (var n = this._readableState.buffer.head, i = ""; null !== n;) i += r.write(n.data), n = n.next;
  4120. return this._readableState.buffer.clear(), "" !== i && this._readableState.buffer.push(i), this._readableState.length = i.length, this
  4121. };
  4122. var A = 1073741824;
  4123. function I(e, t) { return e <= 0 || 0 === t.length && t.ended ? 0 : t.objectMode ? 1 : e != e ? t.flowing && t.length ? t.buffer.head.data.length : t.length : (e > t.highWaterMark && (t.highWaterMark = function (e) { return e >= A ? e = A : (e--, e |= e >>> 1, e |= e >>> 2, e |= e >>> 4, e |= e >>> 8, e |= e >>> 16, e++), e }(e)), e <= t.length ? e : t.ended ? t.length : (t.needReadable = !0, 0)) }
  4124. function P(e) {
  4125. var t = e._readableState;
  4126. u("emitReadable", t.needReadable, t.emittedReadable), t.needReadable = !1, t.emittedReadable || (u("emitReadable", t.flowing), t.emittedReadable = !0, r.nextTick(O, e))
  4127. }
  4128. function O(e) {
  4129. var t = e._readableState;
  4130. u("emitReadable_", t.destroyed, t.length, t.ended), t.destroyed || !t.length && !t.ended || (e.emit("readable"), t.emittedReadable = !1), t.needReadable = !t.flowing && !t.ended && t.length <= t.highWaterMark, j(e)
  4131. }
  4132. function B(e, t) { t.readingMore || (t.readingMore = !0, r.nextTick(R, e, t)) }
  4133. function R(e, t) { for (; !t.reading && !t.ended && (t.length < t.highWaterMark || t.flowing && 0 === t.length);) { var r = t.length; if (u("maybeReadMore read 0"), e.read(0), r === t.length) break } t.readingMore = !1 }
  4134. function M(e) {
  4135. var t = e._readableState;
  4136. t.readableListening = e.listenerCount("readable") > 0, t.resumeScheduled && !t.paused ? t.flowing = !0 : e.listenerCount("data") > 0 && e.resume()
  4137. }
  4138. function N(e) { u("readable nexttick read 0"), e.read(0) }
  4139. function L(e, t) { u("resume", t.reading), t.reading || e.read(0), t.resumeScheduled = !1, e.emit("resume"), j(e), t.flowing && !t.reading && e.read(0) }
  4140. function j(e) { var t = e._readableState; for (u("flow", t.flowing); t.flowing && null !== e.read();); }
  4141. function U(e, t) { return 0 === t.length ? null : (t.objectMode ? r = t.buffer.shift() : !e || e >= t.length ? (r = t.decoder ? t.buffer.join("") : 1 === t.buffer.length ? t.buffer.first() : t.buffer.concat(t.length), t.buffer.clear()) : r = t.buffer.consume(e, t.decoder), r); var r }
  4142. function q(e) {
  4143. var t = e._readableState;
  4144. u("endReadable", t.endEmitted), t.endEmitted || (t.ended = !0, r.nextTick(D, t, e))
  4145. }
  4146. function D(e, t) {
  4147. if (u("endReadableNT", e.endEmitted, e.length), !e.endEmitted && 0 === e.length && (e.endEmitted = !0, t.readable = !1, t.emit("end"), e.autoDestroy)) {
  4148. var r = t._writableState;
  4149. (!r || r.autoDestroy && r.finished) && t.destroy()
  4150. }
  4151. }
  4152. function z(e, t) {
  4153. for (var r = 0, n = e.length; r < n; r++)
  4154. if (e[r] === t) return r;
  4155. return -1
  4156. }
  4157. C.prototype.read = function (e) {
  4158. u("read", e), e = parseInt(e, 10);
  4159. var t = this._readableState,
  4160. r = e;
  4161. if (0 !== e && (t.emittedReadable = !1), 0 === e && t.needReadable && ((0 !== t.highWaterMark ? t.length >= t.highWaterMark : t.length > 0) || t.ended)) return u("read: emitReadable", t.length, t.ended), 0 === t.length && t.ended ? q(this) : P(this), null;
  4162. if (0 === (e = I(e, t)) && t.ended) return 0 === t.length && q(this), null;
  4163. var n, i = t.needReadable;
  4164. return u("need readable", i), (0 === t.length || t.length - e < t.highWaterMark) && u("length less than watermark", i = !0), t.ended || t.reading ? u("reading or ended", i = !1) : i && (u("do read"), t.reading = !0, t.sync = !0, 0 === t.length && (t.needReadable = !0), this._read(t.highWaterMark), t.sync = !1, t.reading || (e = I(r, t))), null === (n = e > 0 ? U(e, t) : null) ? (t.needReadable = t.length <= t.highWaterMark, e = 0) : (t.length -= e, t.awaitDrain = 0), 0 === t.length && (t.ended || (t.needReadable = !0), r !== e && t.ended && q(this)), null !== n && this.emit("data", n), n
  4165. }, C.prototype._read = function (e) { k(this, new w("_read()")) }, C.prototype.pipe = function (e, t) {
  4166. var n = this,
  4167. i = this._readableState;
  4168. switch (i.pipesCount) {
  4169. case 0:
  4170. i.pipes = e;
  4171. break;
  4172. case 1:
  4173. i.pipes = [i.pipes, e];
  4174. break;
  4175. default:
  4176. i.pipes.push(e)
  4177. }
  4178. i.pipesCount += 1, u("pipe count=%d opts=%j", i.pipesCount, t);
  4179. var s = (!t || !1 !== t.end) && e !== r.stdout && e !== r.stderr ? l : y;
  4180. function a(t, r) { u("onunpipe"), t === n && r && !1 === r.hasUnpiped && (r.hasUnpiped = !0, u("cleanup"), e.removeListener("close", d), e.removeListener("finish", g), e.removeListener("drain", c), e.removeListener("error", p), e.removeListener("unpipe", a), n.removeListener("end", l), n.removeListener("end", y), n.removeListener("data", f), h = !0, !i.awaitDrain || e._writableState && !e._writableState.needDrain || c()) }
  4181. function l() { u("onend"), e.end() } i.endEmitted ? r.nextTick(s) : n.once("end", s), e.on("unpipe", a);
  4182. var c = function (e) {
  4183. return function () {
  4184. var t = e._readableState;
  4185. u("pipeOnDrain", t.awaitDrain), t.awaitDrain && t.awaitDrain--, 0 === t.awaitDrain && o(e, "data") && (t.flowing = !0, j(e))
  4186. }
  4187. }(n);
  4188. e.on("drain", c);
  4189. var h = !1;
  4190. function f(t) {
  4191. u("ondata");
  4192. var r = e.write(t);
  4193. u("dest.write", r), !1 === r && ((1 === i.pipesCount && i.pipes === e || i.pipesCount > 1 && -1 !== z(i.pipes, e)) && !h && (u("false write response, pause", i.awaitDrain), i.awaitDrain++), n.pause())
  4194. }
  4195. function p(t) { u("onerror", t), y(), e.removeListener("error", p), 0 === o(e, "error") && k(e, t) }
  4196. function d() { e.removeListener("finish", g), y() }
  4197. function g() { u("onfinish"), e.removeListener("close", d), y() }
  4198. function y() { u("unpipe"), n.unpipe(e) }
  4199. return n.on("data", f),
  4200. function (e, t, r) {
  4201. if ("function" == typeof e.prependListener) return e.prependListener(t, r);
  4202. e._events && e._events[t] ? Array.isArray(e._events[t]) ? e._events[t].unshift(r) : e._events[t] = [r, e._events[t]] : e.on(t, r)
  4203. }(e, "error", p), e.once("close", d), e.once("finish", g), e.emit("pipe", n), i.flowing || (u("pipe resume"), n.resume()), e
  4204. }, C.prototype.unpipe = function (e) {
  4205. var t = this._readableState,
  4206. r = { hasUnpiped: !1 };
  4207. if (0 === t.pipesCount) return this;
  4208. if (1 === t.pipesCount) return e && e !== t.pipes ? this : (e || (e = t.pipes), t.pipes = null, t.pipesCount = 0, t.flowing = !1, e && e.emit("unpipe", this, r), this);
  4209. if (!e) {
  4210. var n = t.pipes,
  4211. i = t.pipesCount;
  4212. t.pipes = null, t.pipesCount = 0, t.flowing = !1;
  4213. for (var o = 0; o < i; o++) n[o].emit("unpipe", this, { hasUnpiped: !1 });
  4214. return this
  4215. }
  4216. var s = z(t.pipes, e);
  4217. return -1 === s ? this : (t.pipes.splice(s, 1), t.pipesCount -= 1, 1 === t.pipesCount && (t.pipes = t.pipes[0]), e.emit("unpipe", this, r), this)
  4218. }, C.prototype.on = function (e, t) {
  4219. var n = s.prototype.on.call(this, e, t),
  4220. i = this._readableState;
  4221. return "data" === e ? (i.readableListening = this.listenerCount("readable") > 0, !1 !== i.flowing && this.resume()) : "readable" === e && (i.endEmitted || i.readableListening || (i.readableListening = i.needReadable = !0, i.flowing = !1, i.emittedReadable = !1, u("on readable", i.length, i.reading), i.length ? P(this) : i.reading || r.nextTick(N, this))), n
  4222. }, C.prototype.addListener = C.prototype.on, C.prototype.removeListener = function (e, t) { var n = s.prototype.removeListener.call(this, e, t); return "readable" === e && r.nextTick(M, this), n }, C.prototype.removeAllListeners = function (e) { var t = s.prototype.removeAllListeners.apply(this, arguments); return "readable" !== e && void 0 !== e || r.nextTick(M, this), t }, C.prototype.resume = function () { var e = this._readableState; return e.flowing || (u("resume"), e.flowing = !e.readableListening, function (e, t) { t.resumeScheduled || (t.resumeScheduled = !0, r.nextTick(L, e, t)) }(this, e)), e.paused = !1, this }, C.prototype.pause = function () { return u("call pause flowing=%j", this._readableState.flowing), !1 !== this._readableState.flowing && (u("pause"), this._readableState.flowing = !1, this.emit("pause")), this._readableState.paused = !0, this }, C.prototype.wrap = function (e) {
  4223. var t = this,
  4224. r = this._readableState,
  4225. n = !1;
  4226. for (var i in e.on("end", function () {
  4227. if (u("wrapped end"), r.decoder && !r.ended) {
  4228. var e = r.decoder.end();
  4229. e && e.length && t.push(e)
  4230. }
  4231. t.push(null)
  4232. }), e.on("data", function (i) {
  4233. (u("wrapped data"), r.decoder && (i = r.decoder.write(i)), !r.objectMode || null !== i && void 0 !== i) && ((r.objectMode || i && i.length) && (t.push(i) || (n = !0, e.pause())))
  4234. }), e) void 0 === this[i] && "function" == typeof e[i] && (this[i] = function (t) { return function () { return e[t].apply(e, arguments) } }(i));
  4235. for (var o = 0; o < S.length; o++) e.on(S[o], this.emit.bind(this, S[o]));
  4236. return this._read = function (t) { u("wrapped _read", t), n && (n = !1, e.resume()) }, this
  4237. }, "function" == typeof Symbol && (C.prototype[Symbol.asyncIterator] = function () { return void 0 === f && (f = e("./internal/streams/async_iterator")), f(this) }), Object.defineProperty(C.prototype, "readableHighWaterMark", { enumerable: !1, get: function () { return this._readableState.highWaterMark } }), Object.defineProperty(C.prototype, "readableBuffer", { enumerable: !1, get: function () { return this._readableState && this._readableState.buffer } }), Object.defineProperty(C.prototype, "readableFlowing", { enumerable: !1, get: function () { return this._readableState.flowing }, set: function (e) { this._readableState && (this._readableState.flowing = e) } }), C._fromList = U, Object.defineProperty(C.prototype, "readableLength", { enumerable: !1, get: function () { return this._readableState.length } }), "function" == typeof Symbol && (C.from = function (t, r) { return void 0 === p && (p = e("./internal/streams/from")), p(C, t, r) })
  4238. }).call(this)
  4239. }).call(this, e("_process"), "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
  4240. }, { "../errors": 55, "./_stream_duplex": 56, "./internal/streams/async_iterator": 61, "./internal/streams/buffer_list": 62, "./internal/streams/destroy": 63, "./internal/streams/from": 65, "./internal/streams/state": 67, "./internal/streams/stream": 68, _process: 50, buffer: 17, events: 22, inherits: 24, "string_decoder/": 75, util: 16 }],
  4241. 59: [function (e, t, r) {
  4242. "use strict";
  4243. t.exports = u;
  4244. var n = e("../errors").codes,
  4245. i = n.ERR_METHOD_NOT_IMPLEMENTED,
  4246. o = n.ERR_MULTIPLE_CALLBACK,
  4247. s = n.ERR_TRANSFORM_ALREADY_TRANSFORMING,
  4248. a = n.ERR_TRANSFORM_WITH_LENGTH_0,
  4249. l = e("./_stream_duplex");
  4250. function u(e) {
  4251. if (!(this instanceof u)) return new u(e);
  4252. l.call(this, e), this._transformState = {
  4253. afterTransform: function (e, t) {
  4254. var r = this._transformState;
  4255. r.transforming = !1;
  4256. var n = r.writecb;
  4257. if (null === n) return this.emit("error", new o);
  4258. r.writechunk = null, r.writecb = null, null != t && this.push(t), n(e);
  4259. var i = this._readableState;
  4260. i.reading = !1, (i.needReadable || i.length < i.highWaterMark) && this._read(i.highWaterMark)
  4261. }.bind(this),
  4262. needTransform: !1,
  4263. transforming: !1,
  4264. writecb: null,
  4265. writechunk: null,
  4266. writeencoding: null
  4267. }, this._readableState.needReadable = !0, this._readableState.sync = !1, e && ("function" == typeof e.transform && (this._transform = e.transform), "function" == typeof e.flush && (this._flush = e.flush)), this.on("prefinish", c)
  4268. }
  4269. function c() { var e = this; "function" != typeof this._flush || this._readableState.destroyed ? h(this, null, null) : this._flush(function (t, r) { h(e, t, r) }) }
  4270. function h(e, t, r) { if (t) return e.emit("error", t); if (null != r && e.push(r), e._writableState.length) throw new a; if (e._transformState.transforming) throw new s; return e.push(null) } e("inherits")(u, l), u.prototype.push = function (e, t) { return this._transformState.needTransform = !1, l.prototype.push.call(this, e, t) }, u.prototype._transform = function (e, t, r) { r(new i("_transform()")) }, u.prototype._write = function (e, t, r) {
  4271. var n = this._transformState;
  4272. if (n.writecb = r, n.writechunk = e, n.writeencoding = t, !n.transforming) {
  4273. var i = this._readableState;
  4274. (n.needTransform || i.needReadable || i.length < i.highWaterMark) && this._read(i.highWaterMark)
  4275. }
  4276. }, u.prototype._read = function (e) {
  4277. var t = this._transformState;
  4278. null === t.writechunk || t.transforming ? t.needTransform = !0 : (t.transforming = !0, this._transform(t.writechunk, t.writeencoding, t.afterTransform))
  4279. }, u.prototype._destroy = function (e, t) { l.prototype._destroy.call(this, e, function (e) { t(e) }) }
  4280. }, { "../errors": 55, "./_stream_duplex": 56, inherits: 24 }],
  4281. 60: [function (e, t, r) {
  4282. (function (r, n) {
  4283. (function () {
  4284. "use strict";
  4285. function i(e) {
  4286. var t = this;
  4287. this.next = null, this.entry = null, this.finish = function () {
  4288. ! function (e, t, r) {
  4289. var n = e.entry;
  4290. e.entry = null;
  4291. for (; n;) {
  4292. var i = n.callback;
  4293. t.pendingcb--, i(r), n = n.next
  4294. }
  4295. t.corkedRequestsFree.next = e
  4296. }(t, e)
  4297. }
  4298. }
  4299. var o;
  4300. t.exports = C, C.WritableState = E;
  4301. var s = { deprecate: e("util-deprecate") },
  4302. a = e("./internal/streams/stream"),
  4303. l = e("buffer").Buffer,
  4304. u = n.Uint8Array || function () {};
  4305. var c, h = e("./internal/streams/destroy"),
  4306. f = e("./internal/streams/state").getHighWaterMark,
  4307. p = e("../errors").codes,
  4308. d = p.ERR_INVALID_ARG_TYPE,
  4309. g = p.ERR_METHOD_NOT_IMPLEMENTED,
  4310. y = p.ERR_MULTIPLE_CALLBACK,
  4311. b = p.ERR_STREAM_CANNOT_PIPE,
  4312. m = p.ERR_STREAM_DESTROYED,
  4313. v = p.ERR_STREAM_NULL_VALUES,
  4314. w = p.ERR_STREAM_WRITE_AFTER_END,
  4315. _ = p.ERR_UNKNOWN_ENCODING,
  4316. k = h.errorOrDestroy;
  4317. function S() {}
  4318. function E(t, n, s) {
  4319. o = o || e("./_stream_duplex"), t = t || {}, "boolean" != typeof s && (s = n instanceof o), this.objectMode = !!t.objectMode, s && (this.objectMode = this.objectMode || !!t.writableObjectMode), this.highWaterMark = f(this, t, "writableHighWaterMark", s), this.finalCalled = !1, this.needDrain = !1, this.ending = !1, this.ended = !1, this.finished = !1, this.destroyed = !1;
  4320. var a = !1 === t.decodeStrings;
  4321. this.decodeStrings = !a, this.defaultEncoding = t.defaultEncoding || "utf8", this.length = 0, this.writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = function (e) {
  4322. ! function (e, t) {
  4323. var n = e._writableState,
  4324. i = n.sync,
  4325. o = n.writecb;
  4326. if ("function" != typeof o) throw new y;
  4327. if (function (e) { e.writing = !1, e.writecb = null, e.length -= e.writelen, e.writelen = 0 }(n), t) ! function (e, t, n, i, o) {--t.pendingcb, n ? (r.nextTick(o, i), r.nextTick(O, e, t), e._writableState.errorEmitted = !0, k(e, i)) : (o(i), e._writableState.errorEmitted = !0, k(e, i), O(e, t)) }(e, n, i, t, o);
  4328. else {
  4329. var s = I(n) || e.destroyed;
  4330. s || n.corked || n.bufferProcessing || !n.bufferedRequest || A(e, n), i ? r.nextTick(x, e, n, s, o) : x(e, n, s, o)
  4331. }
  4332. }(n, e)
  4333. }, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest = null, this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.emitClose = !1 !== t.emitClose, this.autoDestroy = !!t.autoDestroy, this.bufferedRequestCount = 0, this.corkedRequestsFree = new i(this)
  4334. }
  4335. function C(t) {
  4336. var r = this instanceof(o = o || e("./_stream_duplex"));
  4337. if (!r && !c.call(C, this)) return new C(t);
  4338. this._writableState = new E(t, this, r), this.writable = !0, t && ("function" == typeof t.write && (this._write = t.write), "function" == typeof t.writev && (this._writev = t.writev), "function" == typeof t.destroy && (this._destroy = t.destroy), "function" == typeof t.final && (this._final = t.final)), a.call(this)
  4339. }
  4340. function T(e, t, r, n, i, o, s) { t.writelen = n, t.writecb = s, t.writing = !0, t.sync = !0, t.destroyed ? t.onwrite(new m("write")) : r ? e._writev(i, t.onwrite) : e._write(i, o, t.onwrite), t.sync = !1 }
  4341. function x(e, t, r, n) { r || function (e, t) { 0 === t.length && t.needDrain && (t.needDrain = !1, e.emit("drain")) }(e, t), t.pendingcb--, n(), O(e, t) }
  4342. function A(e, t) {
  4343. t.bufferProcessing = !0;
  4344. var r = t.bufferedRequest;
  4345. if (e._writev && r && r.next) {
  4346. var n = t.bufferedRequestCount,
  4347. o = new Array(n),
  4348. s = t.corkedRequestsFree;
  4349. s.entry = r;
  4350. for (var a = 0, l = !0; r;) o[a] = r, r.isBuf || (l = !1), r = r.next, a += 1;
  4351. o.allBuffers = l, T(e, t, !0, t.length, o, "", s.finish), t.pendingcb++, t.lastBufferedRequest = null, s.next ? (t.corkedRequestsFree = s.next, s.next = null) : t.corkedRequestsFree = new i(t), t.bufferedRequestCount = 0
  4352. } else {
  4353. for (; r;) {
  4354. var u = r.chunk,
  4355. c = r.encoding,
  4356. h = r.callback;
  4357. if (T(e, t, !1, t.objectMode ? 1 : u.length, u, c, h), r = r.next, t.bufferedRequestCount--, t.writing) break
  4358. }
  4359. null === r && (t.lastBufferedRequest = null)
  4360. }
  4361. t.bufferedRequest = r, t.bufferProcessing = !1
  4362. }
  4363. function I(e) { return e.ending && 0 === e.length && null === e.bufferedRequest && !e.finished && !e.writing }
  4364. function P(e, t) { e._final(function (r) { t.pendingcb--, r && k(e, r), t.prefinished = !0, e.emit("prefinish"), O(e, t) }) }
  4365. function O(e, t) {
  4366. var n = I(t);
  4367. if (n && (function (e, t) { t.prefinished || t.finalCalled || ("function" != typeof e._final || t.destroyed ? (t.prefinished = !0, e.emit("prefinish")) : (t.pendingcb++, t.finalCalled = !0, r.nextTick(P, e, t))) }(e, t), 0 === t.pendingcb && (t.finished = !0, e.emit("finish"), t.autoDestroy))) {
  4368. var i = e._readableState;
  4369. (!i || i.autoDestroy && i.endEmitted) && e.destroy()
  4370. }
  4371. return n
  4372. }
  4373. e("inherits")(C, a), E.prototype.getBuffer = function () { for (var e = this.bufferedRequest, t = []; e;) t.push(e), e = e.next; return t },
  4374. function () { try { Object.defineProperty(E.prototype, "buffer", { get: s.deprecate(function () { return this.getBuffer() }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003") }) } catch (e) {} }(), "function" == typeof Symbol && Symbol.hasInstance && "function" == typeof Function.prototype[Symbol.hasInstance] ? (c = Function.prototype[Symbol.hasInstance], Object.defineProperty(C, Symbol.hasInstance, { value: function (e) { return !!c.call(this, e) || this === C && (e && e._writableState instanceof E) } })) : c = function (e) { return e instanceof this }, C.prototype.pipe = function () { k(this, new b) }, C.prototype.write = function (e, t, n) {
  4375. var i, o = this._writableState,
  4376. s = !1,
  4377. a = !o.objectMode && (i = e, l.isBuffer(i) || i instanceof u);
  4378. return a && !l.isBuffer(e) && (e = function (e) { return l.from(e) }(e)), "function" == typeof t && (n = t, t = null), a ? t = "buffer" : t || (t = o.defaultEncoding), "function" != typeof n && (n = S), o.ending ? function (e, t) {
  4379. var n = new w;
  4380. k(e, n), r.nextTick(t, n)
  4381. }(this, n) : (a || function (e, t, n, i) { var o; return null === n ? o = new v : "string" == typeof n || t.objectMode || (o = new d("chunk", ["string", "Buffer"], n)), !o || (k(e, o), r.nextTick(i, o), !1) }(this, o, e, n)) && (o.pendingcb++, s = function (e, t, r, n, i, o) {
  4382. if (!r) {
  4383. var s = function (e, t, r) { e.objectMode || !1 === e.decodeStrings || "string" != typeof t || (t = l.from(t, r)); return t }(t, n, i);
  4384. n !== s && (r = !0, i = "buffer", n = s)
  4385. }
  4386. var a = t.objectMode ? 1 : n.length;
  4387. t.length += a;
  4388. var u = t.length < t.highWaterMark;
  4389. u || (t.needDrain = !0);
  4390. if (t.writing || t.corked) {
  4391. var c = t.lastBufferedRequest;
  4392. t.lastBufferedRequest = { chunk: n, encoding: i, isBuf: r, callback: o, next: null }, c ? c.next = t.lastBufferedRequest : t.bufferedRequest = t.lastBufferedRequest, t.bufferedRequestCount += 1
  4393. } else T(e, t, !1, a, n, i, o);
  4394. return u
  4395. }(this, o, a, e, t, n)), s
  4396. }, C.prototype.cork = function () { this._writableState.corked++ }, C.prototype.uncork = function () {
  4397. var e = this._writableState;
  4398. e.corked && (e.corked--, e.writing || e.corked || e.bufferProcessing || !e.bufferedRequest || A(this, e))
  4399. }, C.prototype.setDefaultEncoding = function (e) { if ("string" == typeof e && (e = e.toLowerCase()), !(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((e + "").toLowerCase()) > -1)) throw new _(e); return this._writableState.defaultEncoding = e, this }, Object.defineProperty(C.prototype, "writableBuffer", { enumerable: !1, get: function () { return this._writableState && this._writableState.getBuffer() } }), Object.defineProperty(C.prototype, "writableHighWaterMark", { enumerable: !1, get: function () { return this._writableState.highWaterMark } }), C.prototype._write = function (e, t, r) { r(new g("_write()")) }, C.prototype._writev = null, C.prototype.end = function (e, t, n) {
  4400. var i = this._writableState;
  4401. return "function" == typeof e ? (n = e, e = null, t = null) : "function" == typeof t && (n = t, t = null), null !== e && void 0 !== e && this.write(e, t), i.corked && (i.corked = 1, this.uncork()), i.ending || function (e, t, n) {
  4402. t.ending = !0, O(e, t), n && (t.finished ? r.nextTick(n) : e.once("finish", n));
  4403. t.ended = !0, e.writable = !1
  4404. }(this, i, n), this
  4405. }, Object.defineProperty(C.prototype, "writableLength", { enumerable: !1, get: function () { return this._writableState.length } }), Object.defineProperty(C.prototype, "destroyed", { enumerable: !1, get: function () { return void 0 !== this._writableState && this._writableState.destroyed }, set: function (e) { this._writableState && (this._writableState.destroyed = e) } }), C.prototype.destroy = h.destroy, C.prototype._undestroy = h.undestroy, C.prototype._destroy = function (e, t) { t(e) }
  4406. }).call(this)
  4407. }).call(this, e("_process"), "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
  4408. }, { "../errors": 55, "./_stream_duplex": 56, "./internal/streams/destroy": 63, "./internal/streams/state": 67, "./internal/streams/stream": 68, _process: 50, buffer: 17, inherits: 24, "util-deprecate": 78 }],
  4409. 61: [function (e, t, r) {
  4410. (function (r) {
  4411. (function () {
  4412. "use strict";
  4413. var n;
  4414. function i(e, t, r) { return t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e }
  4415. var o = e("./end-of-stream"),
  4416. s = Symbol("lastResolve"),
  4417. a = Symbol("lastReject"),
  4418. l = Symbol("error"),
  4419. u = Symbol("ended"),
  4420. c = Symbol("lastPromise"),
  4421. h = Symbol("handlePromise"),
  4422. f = Symbol("stream");
  4423. function p(e, t) { return { value: e, done: t } }
  4424. function d(e) {
  4425. var t = e[s];
  4426. if (null !== t) {
  4427. var r = e[f].read();
  4428. null !== r && (e[c] = null, e[s] = null, e[a] = null, t(p(r, !1)))
  4429. }
  4430. }
  4431. var g = Object.getPrototypeOf(function () {}),
  4432. y = Object.setPrototypeOf((i(n = {
  4433. get stream() { return this[f] },
  4434. next: function () {
  4435. var e = this,
  4436. t = this[l];
  4437. if (null !== t) return Promise.reject(t);
  4438. if (this[u]) return Promise.resolve(p(void 0, !0));
  4439. if (this[f].destroyed) return new Promise(function (t, n) { r.nextTick(function () { e[l] ? n(e[l]) : t(p(void 0, !0)) }) });
  4440. var n, i = this[c];
  4441. if (i) n = new Promise(function (e, t) { return function (r, n) { e.then(function () { t[u] ? r(p(void 0, !0)) : t[h](r, n) }, n) } }(i, this));
  4442. else {
  4443. var o = this[f].read();
  4444. if (null !== o) return Promise.resolve(p(o, !1));
  4445. n = new Promise(this[h])
  4446. }
  4447. return this[c] = n, n
  4448. }
  4449. }, Symbol.asyncIterator, function () { return this }), i(n, "return", function () { var e = this; return new Promise(function (t, r) { e[f].destroy(null, function (e) { e ? r(e) : t(p(void 0, !0)) }) }) }), n), g);
  4450. t.exports = function (e) {
  4451. var t, n = Object.create(y, (i(t = {}, f, { value: e, writable: !0 }), i(t, s, { value: null, writable: !0 }), i(t, a, { value: null, writable: !0 }), i(t, l, { value: null, writable: !0 }), i(t, u, { value: e._readableState.endEmitted, writable: !0 }), i(t, h, {
  4452. value: function (e, t) {
  4453. var r = n[f].read();
  4454. r ? (n[c] = null, n[s] = null, n[a] = null, e(p(r, !1))) : (n[s] = e, n[a] = t)
  4455. },
  4456. writable: !0
  4457. }), t));
  4458. return n[c] = null, o(e, function (e) {
  4459. if (e && "ERR_STREAM_PREMATURE_CLOSE" !== e.code) { var t = n[a]; return null !== t && (n[c] = null, n[s] = null, n[a] = null, t(e)), void(n[l] = e) }
  4460. var r = n[s];
  4461. null !== r && (n[c] = null, n[s] = null, n[a] = null, r(p(void 0, !0))), n[u] = !0
  4462. }), e.on("readable", function (e) { r.nextTick(d, e) }.bind(null, n)), n
  4463. }
  4464. }).call(this)
  4465. }).call(this, e("_process"))
  4466. }, { "./end-of-stream": 64, _process: 50 }],
  4467. 62: [function (e, t, r) {
  4468. "use strict";
  4469. function n(e, t) {
  4470. var r = Object.keys(e);
  4471. if (Object.getOwnPropertySymbols) {
  4472. var n = Object.getOwnPropertySymbols(e);
  4473. t && (n = n.filter(function (t) { return Object.getOwnPropertyDescriptor(e, t).enumerable })), r.push.apply(r, n)
  4474. }
  4475. return r
  4476. }
  4477. function i(e, t, r) { return t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e }
  4478. function o(e, t) {
  4479. for (var r = 0; r < t.length; r++) {
  4480. var n = t[r];
  4481. n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
  4482. }
  4483. }
  4484. var s = e("buffer").Buffer,
  4485. a = e("util").inspect,
  4486. l = a && a.custom || "inspect";
  4487. t.exports = function () {
  4488. function e() {! function (e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.head = null, this.tail = null, this.length = 0 }
  4489. var t, r, u;
  4490. return t = e, (r = [{
  4491. key: "push",
  4492. value: function (e) {
  4493. var t = { data: e, next: null };
  4494. this.length > 0 ? this.tail.next = t : this.head = t, this.tail = t, ++this.length
  4495. }
  4496. }, {
  4497. key: "unshift",
  4498. value: function (e) {
  4499. var t = { data: e, next: this.head };
  4500. 0 === this.length && (this.tail = t), this.head = t, ++this.length
  4501. }
  4502. }, { key: "shift", value: function () { if (0 !== this.length) { var e = this.head.data; return 1 === this.length ? this.head = this.tail = null : this.head = this.head.next, --this.length, e } } }, { key: "clear", value: function () { this.head = this.tail = null, this.length = 0 } }, { key: "join", value: function (e) { if (0 === this.length) return ""; for (var t = this.head, r = "" + t.data; t = t.next;) r += e + t.data; return r } }, { key: "concat", value: function (e) { if (0 === this.length) return s.alloc(0); for (var t, r, n, i = s.allocUnsafe(e >>> 0), o = this.head, a = 0; o;) t = o.data, r = i, n = a, s.prototype.copy.call(t, r, n), a += o.data.length, o = o.next; return i } }, { key: "consume", value: function (e, t) { var r; return e < this.head.data.length ? (r = this.head.data.slice(0, e), this.head.data = this.head.data.slice(e)) : r = e === this.head.data.length ? this.shift() : t ? this._getString(e) : this._getBuffer(e), r } }, { key: "first", value: function () { return this.head.data } }, {
  4503. key: "_getString",
  4504. value: function (e) {
  4505. var t = this.head,
  4506. r = 1,
  4507. n = t.data;
  4508. for (e -= n.length; t = t.next;) {
  4509. var i = t.data,
  4510. o = e > i.length ? i.length : e;
  4511. if (o === i.length ? n += i : n += i.slice(0, e), 0 === (e -= o)) { o === i.length ? (++r, t.next ? this.head = t.next : this.head = this.tail = null) : (this.head = t, t.data = i.slice(o)); break }++r
  4512. }
  4513. return this.length -= r, n
  4514. }
  4515. }, {
  4516. key: "_getBuffer",
  4517. value: function (e) {
  4518. var t = s.allocUnsafe(e),
  4519. r = this.head,
  4520. n = 1;
  4521. for (r.data.copy(t), e -= r.data.length; r = r.next;) {
  4522. var i = r.data,
  4523. o = e > i.length ? i.length : e;
  4524. if (i.copy(t, t.length - e, 0, o), 0 === (e -= o)) { o === i.length ? (++n, r.next ? this.head = r.next : this.head = this.tail = null) : (this.head = r, r.data = i.slice(o)); break }++n
  4525. }
  4526. return this.length -= n, t
  4527. }
  4528. }, {
  4529. key: l,
  4530. value: function (e, t) {
  4531. return a(this, function (e) {
  4532. for (var t = 1; t < arguments.length; t++) {
  4533. var r = null != arguments[t] ? arguments[t] : {};
  4534. t % 2 ? n(Object(r), !0).forEach(function (t) { i(e, t, r[t]) }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : n(Object(r)).forEach(function (t) { Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) })
  4535. }
  4536. return e
  4537. }({}, t, { depth: 0, customInspect: !1 }))
  4538. }
  4539. }]) && o(t.prototype, r), u && o(t, u), e
  4540. }()
  4541. }, { buffer: 17, util: 16 }],
  4542. 63: [function (e, t, r) {
  4543. (function (e) {
  4544. (function () {
  4545. "use strict";
  4546. function r(e, t) { i(e, t), n(e) }
  4547. function n(e) { e._writableState && !e._writableState.emitClose || e._readableState && !e._readableState.emitClose || e.emit("close") }
  4548. function i(e, t) { e.emit("error", t) } t.exports = {
  4549. destroy: function (t, o) {
  4550. var s = this,
  4551. a = this._readableState && this._readableState.destroyed,
  4552. l = this._writableState && this._writableState.destroyed;
  4553. return a || l ? (o ? o(t) : t && (this._writableState ? this._writableState.errorEmitted || (this._writableState.errorEmitted = !0, e.nextTick(i, this, t)) : e.nextTick(i, this, t)), this) : (this._readableState && (this._readableState.destroyed = !0), this._writableState && (this._writableState.destroyed = !0), this._destroy(t || null, function (t) {!o && t ? s._writableState ? s._writableState.errorEmitted ? e.nextTick(n, s) : (s._writableState.errorEmitted = !0, e.nextTick(r, s, t)) : e.nextTick(r, s, t) : o ? (e.nextTick(n, s), o(t)) : e.nextTick(n, s) }), this)
  4554. },
  4555. undestroy: function () { this._readableState && (this._readableState.destroyed = !1, this._readableState.reading = !1, this._readableState.ended = !1, this._readableState.endEmitted = !1), this._writableState && (this._writableState.destroyed = !1, this._writableState.ended = !1, this._writableState.ending = !1, this._writableState.finalCalled = !1, this._writableState.prefinished = !1, this._writableState.finished = !1, this._writableState.errorEmitted = !1) },
  4556. errorOrDestroy: function (e, t) {
  4557. var r = e._readableState,
  4558. n = e._writableState;
  4559. r && r.autoDestroy || n && n.autoDestroy ? e.destroy(t) : e.emit("error", t)
  4560. }
  4561. }
  4562. }).call(this)
  4563. }).call(this, e("_process"))
  4564. }, { _process: 50 }],
  4565. 64: [function (e, t, r) {
  4566. "use strict";
  4567. var n = e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;
  4568. function i() {} t.exports = function e(t, r, o) {
  4569. if ("function" == typeof r) return e(t, null, r);
  4570. r || (r = {}), o = function (e) {
  4571. var t = !1;
  4572. return function () {
  4573. if (!t) {
  4574. t = !0;
  4575. for (var r = arguments.length, n = new Array(r), i = 0; i < r; i++) n[i] = arguments[i];
  4576. e.apply(this, n)
  4577. }
  4578. }
  4579. }(o || i);
  4580. var s = r.readable || !1 !== r.readable && t.readable,
  4581. a = r.writable || !1 !== r.writable && t.writable,
  4582. l = function () { t.writable || c() },
  4583. u = t._writableState && t._writableState.finished,
  4584. c = function () { a = !1, u = !0, s || o.call(t) },
  4585. h = t._readableState && t._readableState.endEmitted,
  4586. f = function () { s = !1, h = !0, a || o.call(t) },
  4587. p = function (e) { o.call(t, e) },
  4588. d = function () { var e; return s && !h ? (t._readableState && t._readableState.ended || (e = new n), o.call(t, e)) : a && !u ? (t._writableState && t._writableState.ended || (e = new n), o.call(t, e)) : void 0 },
  4589. g = function () { t.req.on("finish", c) };
  4590. return function (e) { return e.setHeader && "function" == typeof e.abort }(t) ? (t.on("complete", c), t.on("abort", d), t.req ? g() : t.on("request", g)) : a && !t._writableState && (t.on("end", l), t.on("close", l)), t.on("end", f), t.on("finish", c), !1 !== r.error && t.on("error", p), t.on("close", d),
  4591. function () { t.removeListener("complete", c), t.removeListener("abort", d), t.removeListener("request", g), t.req && t.req.removeListener("finish", c), t.removeListener("end", l), t.removeListener("close", l), t.removeListener("finish", c), t.removeListener("end", f), t.removeListener("error", p), t.removeListener("close", d) }
  4592. }
  4593. }, { "../../../errors": 55 }],
  4594. 65: [function (e, t, r) { t.exports = function () { throw new Error("Readable.from is not available in the browser") } }, {}],
  4595. 66: [function (e, t, r) {
  4596. "use strict";
  4597. var n;
  4598. var i = e("../../../errors").codes,
  4599. o = i.ERR_MISSING_ARGS,
  4600. s = i.ERR_STREAM_DESTROYED;
  4601. function a(e) { if (e) throw e }
  4602. function l(e) { e() }
  4603. function u(e, t) { return e.pipe(t) } t.exports = function () {
  4604. for (var t = arguments.length, r = new Array(t), i = 0; i < t; i++) r[i] = arguments[i];
  4605. var c, h = function (e) { return e.length ? "function" != typeof e[e.length - 1] ? a : e.pop() : a }(r);
  4606. if (Array.isArray(r[0]) && (r = r[0]), r.length < 2) throw new o("streams");
  4607. var f = r.map(function (t, i) {
  4608. var o = i < r.length - 1;
  4609. return function (t, r, i, o) {
  4610. o = function (e) { var t = !1; return function () { t || (t = !0, e.apply(void 0, arguments)) } }(o);
  4611. var a = !1;
  4612. t.on("close", function () { a = !0 }), void 0 === n && (n = e("./end-of-stream")), n(t, { readable: r, writable: i }, function (e) {
  4613. if (e) return o(e);
  4614. a = !0, o()
  4615. });
  4616. var l = !1;
  4617. return function (e) {
  4618. if (!a && !l) return l = !0,
  4619. function (e) { return e.setHeader && "function" == typeof e.abort }(t) ? t.abort() : "function" == typeof t.destroy ? t.destroy() : void o(e || new s("pipe"))
  4620. }
  4621. }(t, o, i > 0, function (e) { c || (c = e), e && f.forEach(l), o || (f.forEach(l), h(c)) })
  4622. });
  4623. return r.reduce(u)
  4624. }
  4625. }, { "../../../errors": 55, "./end-of-stream": 64 }],
  4626. 67: [function (e, t, r) {
  4627. "use strict";
  4628. var n = e("../../../errors").codes.ERR_INVALID_OPT_VALUE;
  4629. t.exports = { getHighWaterMark: function (e, t, r, i) { var o = function (e, t, r) { return null != e.highWaterMark ? e.highWaterMark : t ? e[r] : null }(t, i, r); if (null != o) { if (!isFinite(o) || Math.floor(o) !== o || o < 0) throw new n(i ? r : "highWaterMark", o); return Math.floor(o) } return e.objectMode ? 16 : 16384 } }
  4630. }, { "../../../errors": 55 }],
  4631. 68: [function (e, t, r) { t.exports = e("events").EventEmitter }, { events: 22 }],
  4632. 69: [function (e, t, r) {
  4633. (r = t.exports = e("./lib/_stream_readable.js")).Stream = r, r.Readable = r, r.Writable = e("./lib/_stream_writable.js"), r.Duplex = e("./lib/_stream_duplex.js"), r.Transform = e("./lib/_stream_transform.js"), r.PassThrough = e("./lib/_stream_passthrough.js"), r.finished = e("./lib/internal/streams/end-of-stream.js"), r.pipeline = e("./lib/internal/streams/pipeline.js")
  4634. }, { "./lib/_stream_duplex.js": 56, "./lib/_stream_passthrough.js": 57, "./lib/_stream_readable.js": 58, "./lib/_stream_transform.js": 59, "./lib/_stream_writable.js": 60, "./lib/internal/streams/end-of-stream.js": 64, "./lib/internal/streams/pipeline.js": 66 }],
  4635. 70: [function (e, t, r) {
  4636. "use strict";
  4637. t.exports = function () {
  4638. if ("function" != typeof arguments[0]) throw new Error("callback needed");
  4639. if ("number" != typeof arguments[1]) throw new Error("interval needed");
  4640. var e;
  4641. if (arguments.length > 0) { e = new Array(arguments.length - 2); for (var t = 0; t < e.length; t++) e[t] = arguments[t + 2] }
  4642. return new function (e, t, r) {
  4643. var n = this;
  4644. this._callback = e, this._args = r, this._interval = setInterval(e, t, this._args), this.reschedule = function (e) { e || (e = n._interval), n._interval && clearInterval(n._interval), n._interval = setInterval(n._callback, e, n._args) }, this.clear = function () { n._interval && (clearInterval(n._interval), n._interval = void 0) }, this.destroy = function () { n._interval && clearInterval(n._interval), n._callback = void 0, n._interval = void 0, n._args = void 0 }
  4645. }(arguments[0], arguments[1], e)
  4646. }
  4647. }, {}],
  4648. 71: [function (e, t, r) {
  4649. "use strict";
  4650. t.exports = e("./index.js")()
  4651. }, { "./index.js": 72 }],
  4652. 72: [function (e, t, r) {
  4653. (function (e) {
  4654. (function () {
  4655. "use strict";
  4656. function r(t) { return t instanceof e ? e.from(t) : new t.constructor(t.buffer.slice(), t.byteOffset, t.length) } t.exports = function (e) {
  4657. return (e = e || {}).circles ? function (e) {
  4658. var t = [],
  4659. n = [];
  4660. return e.proto ? function e(o) {
  4661. if ("object" != typeof o || null === o) return o;
  4662. if (o instanceof Date) return new Date(o);
  4663. if (Array.isArray(o)) return i(o, e);
  4664. if (o instanceof Map) return new Map(i(Array.from(o), e));
  4665. if (o instanceof Set) return new Set(i(Array.from(o), e));
  4666. var s = {};
  4667. for (var a in t.push(o), n.push(s), o) {
  4668. var l = o[a];
  4669. if ("object" != typeof l || null === l) s[a] = l;
  4670. else if (l instanceof Date) s[a] = new Date(l);
  4671. else if (l instanceof Map) s[a] = new Map(i(Array.from(l), e));
  4672. else if (l instanceof Set) s[a] = new Set(i(Array.from(l), e));
  4673. else if (ArrayBuffer.isView(l)) s[a] = r(l);
  4674. else {
  4675. var u = t.indexOf(l);
  4676. s[a] = -1 !== u ? n[u] : e(l)
  4677. }
  4678. }
  4679. return t.pop(), n.pop(), s
  4680. } : function e(o) {
  4681. if ("object" != typeof o || null === o) return o;
  4682. if (o instanceof Date) return new Date(o);
  4683. if (Array.isArray(o)) return i(o, e);
  4684. if (o instanceof Map) return new Map(i(Array.from(o), e));
  4685. if (o instanceof Set) return new Set(i(Array.from(o), e));
  4686. var s = {};
  4687. for (var a in t.push(o), n.push(s), o)
  4688. if (!1 !== Object.hasOwnProperty.call(o, a)) {
  4689. var l = o[a];
  4690. if ("object" != typeof l || null === l) s[a] = l;
  4691. else if (l instanceof Date) s[a] = new Date(l);
  4692. else if (l instanceof Map) s[a] = new Map(i(Array.from(l), e));
  4693. else if (l instanceof Set) s[a] = new Set(i(Array.from(l), e));
  4694. else if (ArrayBuffer.isView(l)) s[a] = r(l);
  4695. else {
  4696. var u = t.indexOf(l);
  4697. s[a] = -1 !== u ? n[u] : e(l)
  4698. }
  4699. } return t.pop(), n.pop(), s
  4700. };
  4701. function i(e, i) {
  4702. for (var o = Object.keys(e), s = new Array(o.length), a = 0; a < o.length; a++) {
  4703. var l = o[a],
  4704. u = e[l];
  4705. if ("object" != typeof u || null === u) s[l] = u;
  4706. else if (u instanceof Date) s[l] = new Date(u);
  4707. else if (ArrayBuffer.isView(u)) s[l] = r(u);
  4708. else {
  4709. var c = t.indexOf(u);
  4710. s[l] = -1 !== c ? n[c] : i(u)
  4711. }
  4712. }
  4713. return s
  4714. }
  4715. }(e) : e.proto ? function e(n) { if ("object" != typeof n || null === n) return n; if (n instanceof Date) return new Date(n); if (Array.isArray(n)) return t(n, e); if (n instanceof Map) return new Map(t(Array.from(n), e)); if (n instanceof Set) return new Set(t(Array.from(n), e)); var i = {}; for (var o in n) { var s = n[o]; "object" != typeof s || null === s ? i[o] = s : s instanceof Date ? i[o] = new Date(s) : s instanceof Map ? i[o] = new Map(t(Array.from(s), e)) : s instanceof Set ? i[o] = new Set(t(Array.from(s), e)) : ArrayBuffer.isView(s) ? i[o] = r(s) : i[o] = e(s) } return i } : function e(n) {
  4716. if ("object" != typeof n || null === n) return n;
  4717. if (n instanceof Date) return new Date(n);
  4718. if (Array.isArray(n)) return t(n, e);
  4719. if (n instanceof Map) return new Map(t(Array.from(n), e));
  4720. if (n instanceof Set) return new Set(t(Array.from(n), e));
  4721. var i = {};
  4722. for (var o in n)
  4723. if (!1 !== Object.hasOwnProperty.call(n, o)) { var s = n[o]; "object" != typeof s || null === s ? i[o] = s : s instanceof Date ? i[o] = new Date(s) : s instanceof Map ? i[o] = new Map(t(Array.from(s), e)) : s instanceof Set ? i[o] = new Set(t(Array.from(s), e)) : ArrayBuffer.isView(s) ? i[o] = r(s) : i[o] = e(s) } return i
  4724. };
  4725. function t(e, t) {
  4726. for (var n = Object.keys(e), i = new Array(n.length), o = 0; o < n.length; o++) {
  4727. var s = n[o],
  4728. a = e[s];
  4729. "object" != typeof a || null === a ? i[s] = a : a instanceof Date ? i[s] = new Date(a) : ArrayBuffer.isView(a) ? i[s] = r(a) : i[s] = t(a)
  4730. }
  4731. return i
  4732. }
  4733. }
  4734. }).call(this)
  4735. }).call(this, e("buffer").Buffer)
  4736. }, { buffer: 17 }],
  4737. 73: [function (e, t, r) {
  4738. var n = e("buffer"),
  4739. i = n.Buffer;
  4740. function o(e, t) { for (var r in e) t[r] = e[r] }
  4741. function s(e, t, r) { return i(e, t, r) } i.from && i.alloc && i.allocUnsafe && i.allocUnsafeSlow ? t.exports = n : (o(n, r), r.Buffer = s), s.prototype = Object.create(i.prototype), o(i, s), s.from = function (e, t, r) { if ("number" == typeof e) throw new TypeError("Argument must not be a number"); return i(e, t, r) }, s.alloc = function (e, t, r) { if ("number" != typeof e) throw new TypeError("Argument must be a number"); var n = i(e); return void 0 !== t ? "string" == typeof r ? n.fill(t, r) : n.fill(t) : n.fill(0), n }, s.allocUnsafe = function (e) { if ("number" != typeof e) throw new TypeError("Argument must be a number"); return i(e) }, s.allocUnsafeSlow = function (e) { if ("number" != typeof e) throw new TypeError("Argument must be a number"); return n.SlowBuffer(e) }
  4742. }, { buffer: 17 }],
  4743. 74: [function (e, t, r) { t.exports = function (e) { var t = e._readableState; return t ? t.objectMode || "number" == typeof e._duplexState ? e.read() : e.read((r = t, r.buffer.length ? r.buffer.head ? r.buffer.head.data.length : r.buffer[0].length : r.length)) : null; var r } }, {}],
  4744. 75: [function (e, t, r) {
  4745. "use strict";
  4746. var n = e("safe-buffer").Buffer,
  4747. i = n.isEncoding || function (e) {
  4748. switch ((e = "" + e) && e.toLowerCase()) {
  4749. case "hex":
  4750. case "utf8":
  4751. case "utf-8":
  4752. case "ascii":
  4753. case "binary":
  4754. case "base64":
  4755. case "ucs2":
  4756. case "ucs-2":
  4757. case "utf16le":
  4758. case "utf-16le":
  4759. case "raw":
  4760. return !0;
  4761. default:
  4762. return !1
  4763. }
  4764. };
  4765. function o(e) {
  4766. var t;
  4767. switch (this.encoding = function (e) {
  4768. var t = function (e) {
  4769. if (!e) return "utf8";
  4770. for (var t;;) switch (e) {
  4771. case "utf8":
  4772. case "utf-8":
  4773. return "utf8";
  4774. case "ucs2":
  4775. case "ucs-2":
  4776. case "utf16le":
  4777. case "utf-16le":
  4778. return "utf16le";
  4779. case "latin1":
  4780. case "binary":
  4781. return "latin1";
  4782. case "base64":
  4783. case "ascii":
  4784. case "hex":
  4785. return e;
  4786. default:
  4787. if (t) return;
  4788. e = ("" + e).toLowerCase(), t = !0
  4789. }
  4790. }(e);
  4791. if ("string" != typeof t && (n.isEncoding === i || !i(e))) throw new Error("Unknown encoding: " + e);
  4792. return t || e
  4793. }(e), this.encoding) {
  4794. case "utf16le":
  4795. this.text = l, this.end = u, t = 4;
  4796. break;
  4797. case "utf8":
  4798. this.fillLast = a, t = 4;
  4799. break;
  4800. case "base64":
  4801. this.text = c, this.end = h, t = 3;
  4802. break;
  4803. default:
  4804. return this.write = f, void(this.end = p)
  4805. }
  4806. this.lastNeed = 0, this.lastTotal = 0, this.lastChar = n.allocUnsafe(t)
  4807. }
  4808. function s(e) { return e <= 127 ? 0 : e >> 5 == 6 ? 2 : e >> 4 == 14 ? 3 : e >> 3 == 30 ? 4 : e >> 6 == 2 ? -1 : -2 }
  4809. function a(e) {
  4810. var t = this.lastTotal - this.lastNeed,
  4811. r = function (e, t, r) { if (128 != (192 & t[0])) return e.lastNeed = 0, "�"; if (e.lastNeed > 1 && t.length > 1) { if (128 != (192 & t[1])) return e.lastNeed = 1, "�"; if (e.lastNeed > 2 && t.length > 2 && 128 != (192 & t[2])) return e.lastNeed = 2, "�" } }(this, e);
  4812. return void 0 !== r ? r : this.lastNeed <= e.length ? (e.copy(this.lastChar, t, 0, this.lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal)) : (e.copy(this.lastChar, t, 0, e.length), void(this.lastNeed -= e.length))
  4813. }
  4814. function l(e, t) { if ((e.length - t) % 2 == 0) { var r = e.toString("utf16le", t); if (r) { var n = r.charCodeAt(r.length - 1); if (n >= 55296 && n <= 56319) return this.lastNeed = 2, this.lastTotal = 4, this.lastChar[0] = e[e.length - 2], this.lastChar[1] = e[e.length - 1], r.slice(0, -1) } return r } return this.lastNeed = 1, this.lastTotal = 2, this.lastChar[0] = e[e.length - 1], e.toString("utf16le", t, e.length - 1) }
  4815. function u(e) { var t = e && e.length ? this.write(e) : ""; if (this.lastNeed) { var r = this.lastTotal - this.lastNeed; return t + this.lastChar.toString("utf16le", 0, r) } return t }
  4816. function c(e, t) { var r = (e.length - t) % 3; return 0 === r ? e.toString("base64", t) : (this.lastNeed = 3 - r, this.lastTotal = 3, 1 === r ? this.lastChar[0] = e[e.length - 1] : (this.lastChar[0] = e[e.length - 2], this.lastChar[1] = e[e.length - 1]), e.toString("base64", t, e.length - r)) }
  4817. function h(e) { var t = e && e.length ? this.write(e) : ""; return this.lastNeed ? t + this.lastChar.toString("base64", 0, 3 - this.lastNeed) : t }
  4818. function f(e) { return e.toString(this.encoding) }
  4819. function p(e) { return e && e.length ? this.write(e) : "" } r.StringDecoder = o, o.prototype.write = function (e) {
  4820. if (0 === e.length) return "";
  4821. var t, r;
  4822. if (this.lastNeed) {
  4823. if (void 0 === (t = this.fillLast(e))) return "";
  4824. r = this.lastNeed, this.lastNeed = 0
  4825. } else r = 0;
  4826. return r < e.length ? t ? t + this.text(e, r) : this.text(e, r) : t || ""
  4827. }, o.prototype.end = function (e) { var t = e && e.length ? this.write(e) : ""; return this.lastNeed ? t + "�" : t }, o.prototype.text = function (e, t) {
  4828. var r = function (e, t, r) { var n = t.length - 1; if (n < r) return 0; var i = s(t[n]); if (i >= 0) return i > 0 && (e.lastNeed = i - 1), i; if (--n < r || -2 === i) return 0; if ((i = s(t[n])) >= 0) return i > 0 && (e.lastNeed = i - 2), i; if (--n < r || -2 === i) return 0; if ((i = s(t[n])) >= 0) return i > 0 && (2 === i ? i = 0 : e.lastNeed = i - 3), i; return 0 }(this, e, t);
  4829. if (!this.lastNeed) return e.toString("utf8", t);
  4830. this.lastTotal = r;
  4831. var n = e.length - (r - this.lastNeed);
  4832. return e.copy(this.lastChar, 0, n), e.toString("utf8", t, n)
  4833. }, o.prototype.fillLast = function (e) {
  4834. if (this.lastNeed <= e.length) return e.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal);
  4835. e.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, e.length), this.lastNeed -= e.length
  4836. }
  4837. }, { "safe-buffer": 73 }],
  4838. 76: [function (e, t, r) {
  4839. "use strict";
  4840. var n = e("punycode"),
  4841. i = e("./util");
  4842. function o() { this.protocol = null, this.slashes = null, this.auth = null, this.host = null, this.port = null, this.hostname = null, this.hash = null, this.search = null, this.query = null, this.pathname = null, this.path = null, this.href = null } r.parse = v, r.resolve = function (e, t) { return v(e, !1, !0).resolve(t) }, r.resolveObject = function (e, t) { return e ? v(e, !1, !0).resolveObject(t) : t }, r.format = function (e) { i.isString(e) && (e = v(e)); return e instanceof o ? e.format() : o.prototype.format.call(e) }, r.Url = o;
  4843. var s = /^([a-z0-9.+-]+:)/i,
  4844. a = /:[0-9]*$/,
  4845. l = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
  4846. u = ["{", "}", "|", "\\", "^", "`"].concat(["<", ">", '"', "`", " ", "\r", "\n", "\t"]),
  4847. c = ["'"].concat(u),
  4848. h = ["%", "/", "?", ";", "#"].concat(c),
  4849. f = ["/", "?", "#"],
  4850. p = /^[+a-z0-9A-Z_-]{0,63}$/,
  4851. d = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
  4852. g = { javascript: !0, "javascript:": !0 },
  4853. y = { javascript: !0, "javascript:": !0 },
  4854. b = { http: !0, https: !0, ftp: !0, gopher: !0, file: !0, "http:": !0, "https:": !0, "ftp:": !0, "gopher:": !0, "file:": !0 },
  4855. m = e("querystring");
  4856. function v(e, t, r) { if (e && i.isObject(e) && e instanceof o) return e; var n = new o; return n.parse(e, t, r), n } o.prototype.parse = function (e, t, r) {
  4857. if (!i.isString(e)) throw new TypeError("Parameter 'url' must be a string, not " + typeof e);
  4858. var o = e.indexOf("?"),
  4859. a = -1 !== o && o < e.indexOf("#") ? "?" : "#",
  4860. u = e.split(a);
  4861. u[0] = u[0].replace(/\\/g, "/");
  4862. var v = e = u.join(a);
  4863. if (v = v.trim(), !r && 1 === e.split("#").length) { var w = l.exec(v); if (w) return this.path = v, this.href = v, this.pathname = w[1], w[2] ? (this.search = w[2], this.query = t ? m.parse(this.search.substr(1)) : this.search.substr(1)) : t && (this.search = "", this.query = {}), this }
  4864. var _ = s.exec(v);
  4865. if (_) {
  4866. var k = (_ = _[0]).toLowerCase();
  4867. this.protocol = k, v = v.substr(_.length)
  4868. }
  4869. if (r || _ || v.match(/^\/\/[^@\/]+@[^@\/]+/)) { var S = "//" === v.substr(0, 2);!S || _ && y[_] || (v = v.substr(2), this.slashes = !0) }
  4870. if (!y[_] && (S || _ && !b[_])) {
  4871. for (var E, C, T = -1, x = 0; x < f.length; x++) {-1 !== (A = v.indexOf(f[x])) && (-1 === T || A < T) && (T = A) } - 1 !== (C = -1 === T ? v.lastIndexOf("@") : v.lastIndexOf("@", T)) && (E = v.slice(0, C), v = v.slice(C + 1), this.auth = decodeURIComponent(E)), T = -1;
  4872. for (x = 0; x < h.length; x++) { var A; - 1 !== (A = v.indexOf(h[x])) && (-1 === T || A < T) && (T = A) } - 1 === T && (T = v.length), this.host = v.slice(0, T), v = v.slice(T), this.parseHost(), this.hostname = this.hostname || "";
  4873. var I = "[" === this.hostname[0] && "]" === this.hostname[this.hostname.length - 1];
  4874. if (!I)
  4875. for (var P = this.hostname.split(/\./), O = (x = 0, P.length); x < O; x++) {
  4876. var B = P[x];
  4877. if (B && !B.match(p)) {
  4878. for (var R = "", M = 0, N = B.length; M < N; M++) B.charCodeAt(M) > 127 ? R += "x" : R += B[M];
  4879. if (!R.match(p)) {
  4880. var L = P.slice(0, x),
  4881. j = P.slice(x + 1),
  4882. U = B.match(d);
  4883. U && (L.push(U[1]), j.unshift(U[2])), j.length && (v = "/" + j.join(".") + v), this.hostname = L.join(".");
  4884. break
  4885. }
  4886. }
  4887. }
  4888. this.hostname.length > 255 ? this.hostname = "" : this.hostname = this.hostname.toLowerCase(), I || (this.hostname = n.toASCII(this.hostname));
  4889. var q = this.port ? ":" + this.port : "",
  4890. D = this.hostname || "";
  4891. this.host = D + q, this.href += this.host, I && (this.hostname = this.hostname.substr(1, this.hostname.length - 2), "/" !== v[0] && (v = "/" + v))
  4892. }
  4893. if (!g[k])
  4894. for (x = 0, O = c.length; x < O; x++) {
  4895. var z = c[x];
  4896. if (-1 !== v.indexOf(z)) {
  4897. var F = encodeURIComponent(z);
  4898. F === z && (F = escape(z)), v = v.split(z).join(F)
  4899. }
  4900. }
  4901. var V = v.indexOf("#"); - 1 !== V && (this.hash = v.substr(V), v = v.slice(0, V));
  4902. var H = v.indexOf("?");
  4903. if (-1 !== H ? (this.search = v.substr(H), this.query = v.substr(H + 1), t && (this.query = m.parse(this.query)), v = v.slice(0, H)) : t && (this.search = "", this.query = {}), v && (this.pathname = v), b[k] && this.hostname && !this.pathname && (this.pathname = "/"), this.pathname || this.search) {
  4904. q = this.pathname || "";
  4905. var W = this.search || "";
  4906. this.path = q + W
  4907. }
  4908. return this.href = this.format(), this
  4909. }, o.prototype.format = function () {
  4910. var e = this.auth || "";
  4911. e && (e = (e = encodeURIComponent(e)).replace(/%3A/i, ":"), e += "@");
  4912. var t = this.protocol || "",
  4913. r = this.pathname || "",
  4914. n = this.hash || "",
  4915. o = !1,
  4916. s = "";
  4917. this.host ? o = e + this.host : this.hostname && (o = e + (-1 === this.hostname.indexOf(":") ? this.hostname : "[" + this.hostname + "]"), this.port && (o += ":" + this.port)), this.query && i.isObject(this.query) && Object.keys(this.query).length && (s = m.stringify(this.query));
  4918. var a = this.search || s && "?" + s || "";
  4919. return t && ":" !== t.substr(-1) && (t += ":"), this.slashes || (!t || b[t]) && !1 !== o ? (o = "//" + (o || ""), r && "/" !== r.charAt(0) && (r = "/" + r)) : o || (o = ""), n && "#" !== n.charAt(0) && (n = "#" + n), a && "?" !== a.charAt(0) && (a = "?" + a), t + o + (r = r.replace(/[?#]/g, function (e) { return encodeURIComponent(e) })) + (a = a.replace("#", "%23")) + n
  4920. }, o.prototype.resolve = function (e) { return this.resolveObject(v(e, !1, !0)).format() }, o.prototype.resolveObject = function (e) {
  4921. if (i.isString(e)) {
  4922. var t = new o;
  4923. t.parse(e, !1, !0), e = t
  4924. }
  4925. for (var r = new o, n = Object.keys(this), s = 0; s < n.length; s++) {
  4926. var a = n[s];
  4927. r[a] = this[a]
  4928. }
  4929. if (r.hash = e.hash, "" === e.href) return r.href = r.format(), r;
  4930. if (e.slashes && !e.protocol) { for (var l = Object.keys(e), u = 0; u < l.length; u++) { var c = l[u]; "protocol" !== c && (r[c] = e[c]) } return b[r.protocol] && r.hostname && !r.pathname && (r.path = r.pathname = "/"), r.href = r.format(), r }
  4931. if (e.protocol && e.protocol !== r.protocol) {
  4932. if (!b[e.protocol]) {
  4933. for (var h = Object.keys(e), f = 0; f < h.length; f++) {
  4934. var p = h[f];
  4935. r[p] = e[p]
  4936. }
  4937. return r.href = r.format(), r
  4938. }
  4939. if (r.protocol = e.protocol, e.host || y[e.protocol]) r.pathname = e.pathname;
  4940. else {
  4941. for (var d = (e.pathname || "").split("/"); d.length && !(e.host = d.shift()););
  4942. e.host || (e.host = ""), e.hostname || (e.hostname = ""), "" !== d[0] && d.unshift(""), d.length < 2 && d.unshift(""), r.pathname = d.join("/")
  4943. }
  4944. if (r.search = e.search, r.query = e.query, r.host = e.host || "", r.auth = e.auth, r.hostname = e.hostname || e.host, r.port = e.port, r.pathname || r.search) {
  4945. var g = r.pathname || "",
  4946. m = r.search || "";
  4947. r.path = g + m
  4948. }
  4949. return r.slashes = r.slashes || e.slashes, r.href = r.format(), r
  4950. }
  4951. var v = r.pathname && "/" === r.pathname.charAt(0),
  4952. w = e.host || e.pathname && "/" === e.pathname.charAt(0),
  4953. _ = w || v || r.host && e.pathname,
  4954. k = _,
  4955. S = r.pathname && r.pathname.split("/") || [],
  4956. E = (d = e.pathname && e.pathname.split("/") || [], r.protocol && !b[r.protocol]);
  4957. if (E && (r.hostname = "", r.port = null, r.host && ("" === S[0] ? S[0] = r.host : S.unshift(r.host)), r.host = "", e.protocol && (e.hostname = null, e.port = null, e.host && ("" === d[0] ? d[0] = e.host : d.unshift(e.host)), e.host = null), _ = _ && ("" === d[0] || "" === S[0])), w) r.host = e.host || "" === e.host ? e.host : r.host, r.hostname = e.hostname || "" === e.hostname ? e.hostname : r.hostname, r.search = e.search, r.query = e.query, S = d;
  4958. else if (d.length) S || (S = []), S.pop(), S = S.concat(d), r.search = e.search, r.query = e.query;
  4959. else if (!i.isNullOrUndefined(e.search)) { if (E) r.hostname = r.host = S.shift(), (I = !!(r.host && r.host.indexOf("@") > 0) && r.host.split("@")) && (r.auth = I.shift(), r.host = r.hostname = I.shift()); return r.search = e.search, r.query = e.query, i.isNull(r.pathname) && i.isNull(r.search) || (r.path = (r.pathname ? r.pathname : "") + (r.search ? r.search : "")), r.href = r.format(), r }
  4960. if (!S.length) return r.pathname = null, r.search ? r.path = "/" + r.search : r.path = null, r.href = r.format(), r;
  4961. for (var C = S.slice(-1)[0], T = (r.host || e.host || S.length > 1) && ("." === C || ".." === C) || "" === C, x = 0, A = S.length; A >= 0; A--) "." === (C = S[A]) ? S.splice(A, 1) : ".." === C ? (S.splice(A, 1), x++) : x && (S.splice(A, 1), x--);
  4962. if (!_ && !k)
  4963. for (; x--; x) S.unshift("..");
  4964. !_ || "" === S[0] || S[0] && "/" === S[0].charAt(0) || S.unshift(""), T && "/" !== S.join("/").substr(-1) && S.push("");
  4965. var I, P = "" === S[0] || S[0] && "/" === S[0].charAt(0);
  4966. E && (r.hostname = r.host = P ? "" : S.length ? S.shift() : "", (I = !!(r.host && r.host.indexOf("@") > 0) && r.host.split("@")) && (r.auth = I.shift(), r.host = r.hostname = I.shift()));
  4967. return (_ = _ || r.host && S.length) && !P && S.unshift(""), S.length ? r.pathname = S.join("/") : (r.pathname = null, r.path = null), i.isNull(r.pathname) && i.isNull(r.search) || (r.path = (r.pathname ? r.pathname : "") + (r.search ? r.search : "")), r.auth = e.auth || r.auth, r.slashes = r.slashes || e.slashes, r.href = r.format(), r
  4968. }, o.prototype.parseHost = function () {
  4969. var e = this.host,
  4970. t = a.exec(e);
  4971. t && (":" !== (t = t[0]) && (this.port = t.substr(1)), e = e.substr(0, e.length - t.length)), e && (this.hostname = e)
  4972. }
  4973. }, { "./util": 77, punycode: 51, querystring: 54 }],
  4974. 77: [function (e, t, r) {
  4975. "use strict";
  4976. t.exports = { isString: function (e) { return "string" == typeof e }, isObject: function (e) { return "object" == typeof e && null !== e }, isNull: function (e) { return null === e }, isNullOrUndefined: function (e) { return null == e } }
  4977. }, {}],
  4978. 78: [function (e, t, r) {
  4979. (function (e) {
  4980. (function () {
  4981. function r(t) { try { if (!e.localStorage) return !1 } catch (e) { return !1 } var r = e.localStorage[t]; return null != r && "true" === String(r).toLowerCase() } t.exports = function (e, t) {
  4982. if (r("noDeprecation")) return e;
  4983. var n = !1;
  4984. return function () {
  4985. if (!n) {
  4986. if (r("throwDeprecation")) throw new Error(t);
  4987. r("traceDeprecation") ? console.trace(t) : console.warn(t), n = !0
  4988. }
  4989. return e.apply(this, arguments)
  4990. }
  4991. }
  4992. }).call(this)
  4993. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
  4994. }, {}],
  4995. 79: [function (e, t, r) {
  4996. t.exports = function e(t, r) {
  4997. if (t && r) return e(t)(r);
  4998. if ("function" != typeof t) throw new TypeError("need wrapper function");
  4999. Object.keys(t).forEach(function (e) { n[e] = t[e] });
  5000. return n;
  5001. function n() {
  5002. for (var e = new Array(arguments.length), r = 0; r < e.length; r++) e[r] = arguments[r];
  5003. var n = t.apply(this, e),
  5004. i = e[e.length - 1];
  5005. return "function" == typeof n && n !== i && Object.keys(i).forEach(function (e) { n[e] = i[e] }), n
  5006. }
  5007. }
  5008. }, {}],
  5009. 80: [function (e, t, r) {
  5010. "use strict";
  5011. t.exports = function () { throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object") }
  5012. }, {}],
  5013. 81: [function (e, t, r) { t.exports = function () { for (var e = {}, t = 0; t < arguments.length; t++) { var r = arguments[t]; for (var i in r) n.call(r, i) && (e[i] = r[i]) } return e }; var n = Object.prototype.hasOwnProperty }, {}],
  5014. 82: [function (e, t, r) {
  5015. "use strict";
  5016. t.exports = function (e) { e.prototype[Symbol.iterator] = function* () { for (let e = this.head; e; e = e.next) yield e.value } }
  5017. }, {}],
  5018. 83: [function (e, t, r) {
  5019. "use strict";
  5020. function n(e) {
  5021. var t = this;
  5022. if (t instanceof n || (t = new n), t.tail = null, t.head = null, t.length = 0, e && "function" == typeof e.forEach) e.forEach(function (e) { t.push(e) });
  5023. else if (arguments.length > 0)
  5024. for (var r = 0, i = arguments.length; r < i; r++) t.push(arguments[r]);
  5025. return t
  5026. }
  5027. function i(e, t, r) { var n = t === e.head ? new a(r, null, t, e) : new a(r, t, t.next, e); return null === n.next && (e.tail = n), null === n.prev && (e.head = n), e.length++, n }
  5028. function o(e, t) { e.tail = new a(t, e.tail, null, e), e.head || (e.head = e.tail), e.length++ }
  5029. function s(e, t) { e.head = new a(t, null, e.head, e), e.tail || (e.tail = e.head), e.length++ }
  5030. function a(e, t, r, n) {
  5031. if (!(this instanceof a)) return new a(e, t, r, n);
  5032. this.list = n, this.value = e, t ? (t.next = this, this.prev = t) : this.prev = null, r ? (r.prev = this, this.next = r) : this.next = null
  5033. }
  5034. t.exports = n, n.Node = a, n.create = n, n.prototype.removeNode = function (e) {
  5035. if (e.list !== this) throw new Error("removing node which does not belong to this list");
  5036. var t = e.next,
  5037. r = e.prev;
  5038. return t && (t.prev = r), r && (r.next = t), e === this.head && (this.head = t), e === this.tail && (this.tail = r), e.list.length--, e.next = null, e.prev = null, e.list = null, t
  5039. }, n.prototype.unshiftNode = function (e) {
  5040. if (e !== this.head) {
  5041. e.list && e.list.removeNode(e);
  5042. var t = this.head;
  5043. e.list = this, e.next = t, t && (t.prev = e), this.head = e, this.tail || (this.tail = e), this.length++
  5044. }
  5045. }, n.prototype.pushNode = function (e) {
  5046. if (e !== this.tail) {
  5047. e.list && e.list.removeNode(e);
  5048. var t = this.tail;
  5049. e.list = this, e.prev = t, t && (t.next = e), this.tail = e, this.head || (this.head = e), this.length++
  5050. }
  5051. }, n.prototype.push = function () { for (var e = 0, t = arguments.length; e < t; e++) o(this, arguments[e]); return this.length }, n.prototype.unshift = function () { for (var e = 0, t = arguments.length; e < t; e++) s(this, arguments[e]); return this.length }, n.prototype.pop = function () { if (this.tail) { var e = this.tail.value; return this.tail = this.tail.prev, this.tail ? this.tail.next = null : this.head = null, this.length--, e } }, n.prototype.shift = function () { if (this.head) { var e = this.head.value; return this.head = this.head.next, this.head ? this.head.prev = null : this.tail = null, this.length--, e } }, n.prototype.forEach = function (e, t) { t = t || this; for (var r = this.head, n = 0; null !== r; n++) e.call(t, r.value, n, this), r = r.next }, n.prototype.forEachReverse = function (e, t) { t = t || this; for (var r = this.tail, n = this.length - 1; null !== r; n--) e.call(t, r.value, n, this), r = r.prev }, n.prototype.get = function (e) { for (var t = 0, r = this.head; null !== r && t < e; t++) r = r.next; if (t === e && null !== r) return r.value }, n.prototype.getReverse = function (e) { for (var t = 0, r = this.tail; null !== r && t < e; t++) r = r.prev; if (t === e && null !== r) return r.value }, n.prototype.map = function (e, t) { t = t || this; for (var r = new n, i = this.head; null !== i;) r.push(e.call(t, i.value, this)), i = i.next; return r }, n.prototype.mapReverse = function (e, t) { t = t || this; for (var r = new n, i = this.tail; null !== i;) r.push(e.call(t, i.value, this)), i = i.prev; return r }, n.prototype.reduce = function (e, t) {
  5052. var r, n = this.head;
  5053. if (arguments.length > 1) r = t;
  5054. else {
  5055. if (!this.head) throw new TypeError("Reduce of empty list with no initial value");
  5056. n = this.head.next, r = this.head.value
  5057. }
  5058. for (var i = 0; null !== n; i++) r = e(r, n.value, i), n = n.next;
  5059. return r
  5060. }, n.prototype.reduceReverse = function (e, t) {
  5061. var r, n = this.tail;
  5062. if (arguments.length > 1) r = t;
  5063. else {
  5064. if (!this.tail) throw new TypeError("Reduce of empty list with no initial value");
  5065. n = this.tail.prev, r = this.tail.value
  5066. }
  5067. for (var i = this.length - 1; null !== n; i--) r = e(r, n.value, i), n = n.prev;
  5068. return r
  5069. }, n.prototype.toArray = function () { for (var e = new Array(this.length), t = 0, r = this.head; null !== r; t++) e[t] = r.value, r = r.next; return e }, n.prototype.toArrayReverse = function () { for (var e = new Array(this.length), t = 0, r = this.tail; null !== r; t++) e[t] = r.value, r = r.prev; return e }, n.prototype.slice = function (e, t) {
  5070. (t = t || this.length) < 0 && (t += this.length), (e = e || 0) < 0 && (e += this.length);
  5071. var r = new n;
  5072. if (t < e || t < 0) return r;
  5073. e < 0 && (e = 0), t > this.length && (t = this.length);
  5074. for (var i = 0, o = this.head; null !== o && i < e; i++) o = o.next;
  5075. for (; null !== o && i < t; i++, o = o.next) r.push(o.value);
  5076. return r
  5077. }, n.prototype.sliceReverse = function (e, t) {
  5078. (t = t || this.length) < 0 && (t += this.length), (e = e || 0) < 0 && (e += this.length);
  5079. var r = new n;
  5080. if (t < e || t < 0) return r;
  5081. e < 0 && (e = 0), t > this.length && (t = this.length);
  5082. for (var i = this.length, o = this.tail; null !== o && i > t; i--) o = o.prev;
  5083. for (; null !== o && i > e; i--, o = o.prev) r.push(o.value);
  5084. return r
  5085. }, n.prototype.splice = function (e, t, ...r) {
  5086. e > this.length && (e = this.length - 1), e < 0 && (e = this.length + e);
  5087. for (var n = 0, o = this.head; null !== o && n < e; n++) o = o.next;
  5088. var s = [];
  5089. for (n = 0; o && n < t; n++) s.push(o.value), o = this.removeNode(o);
  5090. null === o && (o = this.tail), o !== this.head && o !== this.tail && (o = o.prev);
  5091. for (n = 0; n < r.length; n++) o = i(this, o, r[n]);
  5092. return s
  5093. }, n.prototype.reverse = function () {
  5094. for (var e = this.head, t = this.tail, r = e; null !== r; r = r.prev) {
  5095. var n = r.prev;
  5096. r.prev = r.next, r.next = n
  5097. }
  5098. return this.head = t, this.tail = e, this
  5099. };
  5100. try { e("./iterator.js")(n) } catch (e) {}
  5101. }, { "./iterator.js": 82 }]
  5102. }, {}, [12])(12)
  5103. });