905.index.js 222 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030
  1. exports.id = 905;
  2. exports.ids = [905];
  3. exports.modules = {
  4. /***/ 55285:
  5. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  6. const Utils = __webpack_require__(85173);
  7. const pth = __webpack_require__(85622);
  8. const ZipEntry = __webpack_require__(47396);
  9. const ZipFile = __webpack_require__(56333);
  10. const get_Bool = (val, def) => (typeof val === "boolean" ? val : def);
  11. const get_Str = (val, def) => (typeof val === "string" ? val : def);
  12. const defaultOptions = {
  13. // option "noSort" : if true it disables files sorting
  14. noSort: false,
  15. // read entries during load (initial loading may be slower)
  16. readEntries: false,
  17. // default method is none
  18. method: Utils.Constants.NONE,
  19. // file system
  20. fs: null
  21. };
  22. module.exports = function (/**String*/ input, /** object */ options) {
  23. let inBuffer = null;
  24. // create object based default options, allowing them to be overwritten
  25. const opts = Object.assign(Object.create(null), defaultOptions);
  26. // test input variable
  27. if (input && "object" === typeof input) {
  28. // if value is not buffer we accept it to be object with options
  29. if (!(input instanceof Uint8Array)) {
  30. Object.assign(opts, input);
  31. input = opts.input ? opts.input : undefined;
  32. if (opts.input) delete opts.input;
  33. }
  34. // if input is buffer
  35. if (Buffer.isBuffer(input)) {
  36. inBuffer = input;
  37. opts.method = Utils.Constants.BUFFER;
  38. input = undefined;
  39. }
  40. }
  41. // assign options
  42. Object.assign(opts, options);
  43. // instanciate utils filesystem
  44. const filetools = new Utils(opts);
  45. // if input is file name we retrieve its content
  46. if (input && "string" === typeof input) {
  47. // load zip file
  48. if (filetools.fs.existsSync(input)) {
  49. opts.method = Utils.Constants.FILE;
  50. opts.filename = input;
  51. inBuffer = filetools.fs.readFileSync(input);
  52. } else {
  53. throw new Error(Utils.Errors.INVALID_FILENAME);
  54. }
  55. }
  56. // create variable
  57. const _zip = new ZipFile(inBuffer, opts);
  58. const { canonical, sanitize } = Utils;
  59. function getEntry(/**Object*/ entry) {
  60. if (entry && _zip) {
  61. var item;
  62. // If entry was given as a file name
  63. if (typeof entry === "string") item = _zip.getEntry(entry);
  64. // if entry was given as a ZipEntry object
  65. if (typeof entry === "object" && typeof entry.entryName !== "undefined" && typeof entry.header !== "undefined") item = _zip.getEntry(entry.entryName);
  66. if (item) {
  67. return item;
  68. }
  69. }
  70. return null;
  71. }
  72. function fixPath(zipPath) {
  73. const { join, normalize, sep } = pth.posix;
  74. // convert windows file separators and normalize
  75. return join(".", normalize(sep + zipPath.split("\\").join(sep) + sep));
  76. }
  77. return {
  78. /**
  79. * Extracts the given entry from the archive and returns the content as a Buffer object
  80. * @param entry ZipEntry object or String with the full path of the entry
  81. *
  82. * @return Buffer or Null in case of error
  83. */
  84. readFile: function (/**Object*/ entry, /*String, Buffer*/ pass) {
  85. var item = getEntry(entry);
  86. return (item && item.getData(pass)) || null;
  87. },
  88. /**
  89. * Asynchronous readFile
  90. * @param entry ZipEntry object or String with the full path of the entry
  91. * @param callback
  92. *
  93. * @return Buffer or Null in case of error
  94. */
  95. readFileAsync: function (/**Object*/ entry, /**Function*/ callback) {
  96. var item = getEntry(entry);
  97. if (item) {
  98. item.getDataAsync(callback);
  99. } else {
  100. callback(null, "getEntry failed for:" + entry);
  101. }
  102. },
  103. /**
  104. * Extracts the given entry from the archive and returns the content as plain text in the given encoding
  105. * @param entry ZipEntry object or String with the full path of the entry
  106. * @param encoding Optional. If no encoding is specified utf8 is used
  107. *
  108. * @return String
  109. */
  110. readAsText: function (/**Object*/ entry, /**String=*/ encoding) {
  111. var item = getEntry(entry);
  112. if (item) {
  113. var data = item.getData();
  114. if (data && data.length) {
  115. return data.toString(encoding || "utf8");
  116. }
  117. }
  118. return "";
  119. },
  120. /**
  121. * Asynchronous readAsText
  122. * @param entry ZipEntry object or String with the full path of the entry
  123. * @param callback
  124. * @param encoding Optional. If no encoding is specified utf8 is used
  125. *
  126. * @return String
  127. */
  128. readAsTextAsync: function (/**Object*/ entry, /**Function*/ callback, /**String=*/ encoding) {
  129. var item = getEntry(entry);
  130. if (item) {
  131. item.getDataAsync(function (data, err) {
  132. if (err) {
  133. callback(data, err);
  134. return;
  135. }
  136. if (data && data.length) {
  137. callback(data.toString(encoding || "utf8"));
  138. } else {
  139. callback("");
  140. }
  141. });
  142. } else {
  143. callback("");
  144. }
  145. },
  146. /**
  147. * Remove the entry from the file or the entry and all it's nested directories and files if the given entry is a directory
  148. *
  149. * @param entry
  150. */
  151. deleteFile: function (/**Object*/ entry) {
  152. // @TODO: test deleteFile
  153. var item = getEntry(entry);
  154. if (item) {
  155. _zip.deleteEntry(item.entryName);
  156. }
  157. },
  158. /**
  159. * Adds a comment to the zip. The zip must be rewritten after adding the comment.
  160. *
  161. * @param comment
  162. */
  163. addZipComment: function (/**String*/ comment) {
  164. // @TODO: test addZipComment
  165. _zip.comment = comment;
  166. },
  167. /**
  168. * Returns the zip comment
  169. *
  170. * @return String
  171. */
  172. getZipComment: function () {
  173. return _zip.comment || "";
  174. },
  175. /**
  176. * Adds a comment to a specified zipEntry. The zip must be rewritten after adding the comment
  177. * The comment cannot exceed 65535 characters in length
  178. *
  179. * @param entry
  180. * @param comment
  181. */
  182. addZipEntryComment: function (/**Object*/ entry, /**String*/ comment) {
  183. var item = getEntry(entry);
  184. if (item) {
  185. item.comment = comment;
  186. }
  187. },
  188. /**
  189. * Returns the comment of the specified entry
  190. *
  191. * @param entry
  192. * @return String
  193. */
  194. getZipEntryComment: function (/**Object*/ entry) {
  195. var item = getEntry(entry);
  196. if (item) {
  197. return item.comment || "";
  198. }
  199. return "";
  200. },
  201. /**
  202. * Updates the content of an existing entry inside the archive. The zip must be rewritten after updating the content
  203. *
  204. * @param entry
  205. * @param content
  206. */
  207. updateFile: function (/**Object*/ entry, /**Buffer*/ content) {
  208. var item = getEntry(entry);
  209. if (item) {
  210. item.setData(content);
  211. }
  212. },
  213. /**
  214. * Adds a file from the disk to the archive
  215. *
  216. * @param localPath File to add to zip
  217. * @param zipPath Optional path inside the zip
  218. * @param zipName Optional name for the file
  219. */
  220. addLocalFile: function (/**String*/ localPath, /**String=*/ zipPath, /**String=*/ zipName, /**String*/ comment) {
  221. if (filetools.fs.existsSync(localPath)) {
  222. // fix ZipPath
  223. zipPath = zipPath ? fixPath(zipPath) : "";
  224. // p - local file name
  225. var p = localPath.split("\\").join("/").split("/").pop();
  226. // add file name into zippath
  227. zipPath += zipName ? zipName : p;
  228. // read file attributes
  229. const _attr = filetools.fs.statSync(localPath);
  230. // add file into zip file
  231. this.addFile(zipPath, filetools.fs.readFileSync(localPath), comment, _attr);
  232. } else {
  233. throw new Error(Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath));
  234. }
  235. },
  236. /**
  237. * Adds a local directory and all its nested files and directories to the archive
  238. *
  239. * @param localPath
  240. * @param zipPath optional path inside zip
  241. * @param filter optional RegExp or Function if files match will
  242. * be included.
  243. */
  244. addLocalFolder: function (/**String*/ localPath, /**String=*/ zipPath, /**=RegExp|Function*/ filter) {
  245. // Prepare filter
  246. if (filter instanceof RegExp) {
  247. // if filter is RegExp wrap it
  248. filter = (function (rx) {
  249. return function (filename) {
  250. return rx.test(filename);
  251. };
  252. })(filter);
  253. } else if ("function" !== typeof filter) {
  254. // if filter is not function we will replace it
  255. filter = function () {
  256. return true;
  257. };
  258. }
  259. // fix ZipPath
  260. zipPath = zipPath ? fixPath(zipPath) : "";
  261. // normalize the path first
  262. localPath = pth.normalize(localPath);
  263. if (filetools.fs.existsSync(localPath)) {
  264. const items = filetools.findFiles(localPath);
  265. const self = this;
  266. if (items.length) {
  267. items.forEach(function (filepath) {
  268. var p = pth.relative(localPath, filepath).split("\\").join("/"); //windows fix
  269. if (filter(p)) {
  270. var stats = filetools.fs.statSync(filepath);
  271. if (stats.isFile()) {
  272. self.addFile(zipPath + p, filetools.fs.readFileSync(filepath), "", stats);
  273. } else {
  274. self.addFile(zipPath + p + "/", Buffer.alloc(0), "", stats);
  275. }
  276. }
  277. });
  278. }
  279. } else {
  280. throw new Error(Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath));
  281. }
  282. },
  283. /**
  284. * Asynchronous addLocalFile
  285. * @param localPath
  286. * @param callback
  287. * @param zipPath optional path inside zip
  288. * @param filter optional RegExp or Function if files match will
  289. * be included.
  290. */
  291. addLocalFolderAsync: function (/*String*/ localPath, /*Function*/ callback, /*String*/ zipPath, /*RegExp|Function*/ filter) {
  292. if (filter instanceof RegExp) {
  293. filter = (function (rx) {
  294. return function (filename) {
  295. return rx.test(filename);
  296. };
  297. })(filter);
  298. } else if ("function" !== typeof filter) {
  299. filter = function () {
  300. return true;
  301. };
  302. }
  303. // fix ZipPath
  304. zipPath = zipPath ? fixPath(zipPath) : "";
  305. // normalize the path first
  306. localPath = pth.normalize(localPath);
  307. var self = this;
  308. filetools.fs.open(localPath, "r", function (err) {
  309. if (err && err.code === "ENOENT") {
  310. callback(undefined, Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath));
  311. } else if (err) {
  312. callback(undefined, err);
  313. } else {
  314. var items = filetools.findFiles(localPath);
  315. var i = -1;
  316. var next = function () {
  317. i += 1;
  318. if (i < items.length) {
  319. var filepath = items[i];
  320. var p = pth.relative(localPath, filepath).split("\\").join("/"); //windows fix
  321. p = p
  322. .normalize("NFD")
  323. .replace(/[\u0300-\u036f]/g, "")
  324. .replace(/[^\x20-\x7E]/g, ""); // accent fix
  325. if (filter(p)) {
  326. filetools.fs.stat(filepath, function (er0, stats) {
  327. if (er0) callback(undefined, er0);
  328. if (stats.isFile()) {
  329. filetools.fs.readFile(filepath, function (er1, data) {
  330. if (er1) {
  331. callback(undefined, er1);
  332. } else {
  333. self.addFile(zipPath + p, data, "", stats);
  334. next();
  335. }
  336. });
  337. } else {
  338. self.addFile(zipPath + p + "/", Buffer.alloc(0), "", stats);
  339. next();
  340. }
  341. });
  342. } else {
  343. next();
  344. }
  345. } else {
  346. callback(true, undefined);
  347. }
  348. };
  349. next();
  350. }
  351. });
  352. },
  353. /**
  354. *
  355. * @param {string} localPath - path where files will be extracted
  356. * @param {object} props - optional properties
  357. * @param {string} props.zipPath - optional path inside zip
  358. * @param {regexp, function} props.filter - RegExp or Function if files match will be included.
  359. */
  360. addLocalFolderPromise: function (/*String*/ localPath, /* object */ props) {
  361. return new Promise((resolve, reject) => {
  362. const { filter, zipPath } = Object.assign({}, props);
  363. this.addLocalFolderAsync(
  364. localPath,
  365. (done, err) => {
  366. if (err) reject(err);
  367. if (done) resolve(this);
  368. },
  369. zipPath,
  370. filter
  371. );
  372. });
  373. },
  374. /**
  375. * Allows you to create a entry (file or directory) in the zip file.
  376. * If you want to create a directory the entryName must end in / and a null buffer should be provided.
  377. * Comment and attributes are optional
  378. *
  379. * @param {string} entryName
  380. * @param {Buffer | string} content - file content as buffer or utf8 coded string
  381. * @param {string} comment - file comment
  382. * @param {number | object} attr - number as unix file permissions, object as filesystem Stats object
  383. */
  384. addFile: function (/**String*/ entryName, /**Buffer*/ content, /**String*/ comment, /**Number*/ attr) {
  385. let entry = getEntry(entryName);
  386. const update = entry != null;
  387. // prepare new entry
  388. if (!update) {
  389. entry = new ZipEntry();
  390. entry.entryName = entryName;
  391. }
  392. entry.comment = comment || "";
  393. const isStat = "object" === typeof attr && attr instanceof filetools.fs.Stats;
  394. // last modification time from file stats
  395. if (isStat) {
  396. entry.header.time = attr.mtime;
  397. }
  398. // Set file attribute
  399. var fileattr = entry.isDirectory ? 0x10 : 0; // (MS-DOS directory flag)
  400. // extended attributes field for Unix
  401. if (!Utils.isWin) {
  402. // set file type either S_IFDIR / S_IFREG
  403. let unix = entry.isDirectory ? 0x4000 : 0x8000;
  404. if (isStat) {
  405. // File attributes from file stats
  406. unix |= 0xfff & attr.mode;
  407. } else if ("number" === typeof attr) {
  408. // attr from given attr values
  409. unix |= 0xfff & attr;
  410. } else {
  411. // Default values:
  412. unix |= entry.isDirectory ? 0o755 : 0o644; // permissions (drwxr-xr-x) or (-r-wr--r--)
  413. }
  414. fileattr = (fileattr | (unix << 16)) >>> 0; // add attributes
  415. }
  416. entry.attr = fileattr;
  417. entry.setData(content);
  418. if (!update) _zip.setEntry(entry);
  419. },
  420. /**
  421. * Returns an array of ZipEntry objects representing the files and folders inside the archive
  422. *
  423. * @return Array
  424. */
  425. getEntries: function () {
  426. return _zip ? _zip.entries : [];
  427. },
  428. /**
  429. * Returns a ZipEntry object representing the file or folder specified by ``name``.
  430. *
  431. * @param name
  432. * @return ZipEntry
  433. */
  434. getEntry: function (/**String*/ name) {
  435. return getEntry(name);
  436. },
  437. getEntryCount: function () {
  438. return _zip.getEntryCount();
  439. },
  440. forEach: function (callback) {
  441. return _zip.forEach(callback);
  442. },
  443. /**
  444. * Extracts the given entry to the given targetPath
  445. * If the entry is a directory inside the archive, the entire directory and it's subdirectories will be extracted
  446. *
  447. * @param entry ZipEntry object or String with the full path of the entry
  448. * @param targetPath Target folder where to write the file
  449. * @param maintainEntryPath If maintainEntryPath is true and the entry is inside a folder, the entry folder
  450. * will be created in targetPath as well. Default is TRUE
  451. * @param overwrite If the file already exists at the target path, the file will be overwriten if this is true.
  452. * Default is FALSE
  453. * @param keepOriginalPermission The file will be set as the permission from the entry if this is true.
  454. * Default is FALSE
  455. * @param outFileName String If set will override the filename of the extracted file (Only works if the entry is a file)
  456. *
  457. * @return Boolean
  458. */
  459. extractEntryTo: function (
  460. /**Object*/ entry,
  461. /**String*/ targetPath,
  462. /**Boolean*/ maintainEntryPath,
  463. /**Boolean*/ overwrite,
  464. /**Boolean*/ keepOriginalPermission,
  465. /**String**/ outFileName
  466. ) {
  467. overwrite = get_Bool(overwrite, false);
  468. keepOriginalPermission = get_Bool(keepOriginalPermission, false);
  469. maintainEntryPath = get_Bool(maintainEntryPath, true);
  470. outFileName = get_Str(outFileName, get_Str(keepOriginalPermission, undefined));
  471. var item = getEntry(entry);
  472. if (!item) {
  473. throw new Error(Utils.Errors.NO_ENTRY);
  474. }
  475. var entryName = canonical(item.entryName);
  476. var target = sanitize(targetPath, outFileName && !item.isDirectory ? outFileName : maintainEntryPath ? entryName : pth.basename(entryName));
  477. if (item.isDirectory) {
  478. var children = _zip.getEntryChildren(item);
  479. children.forEach(function (child) {
  480. if (child.isDirectory) return;
  481. var content = child.getData();
  482. if (!content) {
  483. throw new Error(Utils.Errors.CANT_EXTRACT_FILE);
  484. }
  485. var name = canonical(child.entryName);
  486. var childName = sanitize(targetPath, maintainEntryPath ? name : pth.basename(name));
  487. // The reverse operation for attr depend on method addFile()
  488. const fileAttr = keepOriginalPermission ? child.header.fileAttr : undefined;
  489. filetools.writeFileTo(childName, content, overwrite, fileAttr);
  490. });
  491. return true;
  492. }
  493. var content = item.getData();
  494. if (!content) throw new Error(Utils.Errors.CANT_EXTRACT_FILE);
  495. if (filetools.fs.existsSync(target) && !overwrite) {
  496. throw new Error(Utils.Errors.CANT_OVERRIDE);
  497. }
  498. // The reverse operation for attr depend on method addFile()
  499. const fileAttr = keepOriginalPermission ? entry.header.fileAttr : undefined;
  500. filetools.writeFileTo(target, content, overwrite, fileAttr);
  501. return true;
  502. },
  503. /**
  504. * Test the archive
  505. *
  506. */
  507. test: function (pass) {
  508. if (!_zip) {
  509. return false;
  510. }
  511. for (var entry in _zip.entries) {
  512. try {
  513. if (entry.isDirectory) {
  514. continue;
  515. }
  516. var content = _zip.entries[entry].getData(pass);
  517. if (!content) {
  518. return false;
  519. }
  520. } catch (err) {
  521. return false;
  522. }
  523. }
  524. return true;
  525. },
  526. /**
  527. * Extracts the entire archive to the given location
  528. *
  529. * @param targetPath Target location
  530. * @param overwrite If the file already exists at the target path, the file will be overwriten if this is true.
  531. * Default is FALSE
  532. * @param keepOriginalPermission The file will be set as the permission from the entry if this is true.
  533. * Default is FALSE
  534. */
  535. extractAllTo: function (/**String*/ targetPath, /**Boolean*/ overwrite, /**Boolean*/ keepOriginalPermission, /*String, Buffer*/ pass) {
  536. overwrite = get_Bool(overwrite, false);
  537. pass = get_Str(keepOriginalPermission, pass);
  538. keepOriginalPermission = get_Bool(keepOriginalPermission, false);
  539. if (!_zip) {
  540. throw new Error(Utils.Errors.NO_ZIP);
  541. }
  542. _zip.entries.forEach(function (entry) {
  543. var entryName = sanitize(targetPath, canonical(entry.entryName.toString()));
  544. if (entry.isDirectory) {
  545. filetools.makeDir(entryName);
  546. return;
  547. }
  548. var content = entry.getData(pass);
  549. if (!content) {
  550. throw new Error(Utils.Errors.CANT_EXTRACT_FILE);
  551. }
  552. // The reverse operation for attr depend on method addFile()
  553. const fileAttr = keepOriginalPermission ? entry.header.fileAttr : undefined;
  554. filetools.writeFileTo(entryName, content, overwrite, fileAttr);
  555. try {
  556. filetools.fs.utimesSync(entryName, entry.header.time, entry.header.time);
  557. } catch (err) {
  558. throw new Error(Utils.Errors.CANT_EXTRACT_FILE);
  559. }
  560. });
  561. },
  562. /**
  563. * Asynchronous extractAllTo
  564. *
  565. * @param targetPath Target location
  566. * @param overwrite If the file already exists at the target path, the file will be overwriten if this is true.
  567. * Default is FALSE
  568. * @param keepOriginalPermission The file will be set as the permission from the entry if this is true.
  569. * Default is FALSE
  570. * @param callback The callback will be executed when all entries are extracted successfully or any error is thrown.
  571. */
  572. extractAllToAsync: function (/**String*/ targetPath, /**Boolean*/ overwrite, /**Boolean*/ keepOriginalPermission, /**Function*/ callback) {
  573. if (!callback) {
  574. callback = function () {};
  575. }
  576. overwrite = get_Bool(overwrite, false);
  577. if (typeof keepOriginalPermission === "function" && !callback) callback = keepOriginalPermission;
  578. keepOriginalPermission = get_Bool(keepOriginalPermission, false);
  579. if (!_zip) {
  580. callback(new Error(Utils.Errors.NO_ZIP));
  581. return;
  582. }
  583. targetPath = pth.resolve(targetPath);
  584. // convert entryName to
  585. const getPath = (entry) => sanitize(targetPath, pth.normalize(canonical(entry.entryName.toString())));
  586. const getError = (msg, file) => new Error(msg + ': "' + file + '"');
  587. // separate directories from files
  588. const dirEntries = [];
  589. const fileEntries = new Set();
  590. _zip.entries.forEach((e) => {
  591. if (e.isDirectory) {
  592. dirEntries.push(e);
  593. } else {
  594. fileEntries.add(e);
  595. }
  596. });
  597. // Create directory entries first synchronously
  598. // this prevents race condition and assures folders are there before writing files
  599. for (const entry of dirEntries) {
  600. const dirPath = getPath(entry);
  601. // The reverse operation for attr depend on method addFile()
  602. const dirAttr = keepOriginalPermission ? entry.header.fileAttr : undefined;
  603. try {
  604. filetools.makeDir(dirPath);
  605. if (dirAttr) filetools.fs.chmodSync(dirPath, dirAttr);
  606. // in unix timestamp will change if files are later added to folder, but still
  607. filetools.fs.utimesSync(dirPath, entry.header.time, entry.header.time);
  608. } catch (er) {
  609. callback(getError("Unable to create folder", dirPath));
  610. }
  611. }
  612. // callback wrapper, for some house keeping
  613. const done = () => {
  614. if (fileEntries.size === 0) {
  615. callback();
  616. }
  617. };
  618. // Extract file entries asynchronously
  619. for (const entry of fileEntries.values()) {
  620. const entryName = pth.normalize(canonical(entry.entryName.toString()));
  621. const filePath = sanitize(targetPath, entryName);
  622. entry.getDataAsync(function (content, err_1) {
  623. if (err_1) {
  624. callback(new Error(err_1));
  625. return;
  626. }
  627. if (!content) {
  628. callback(new Error(Utils.Errors.CANT_EXTRACT_FILE));
  629. } else {
  630. // The reverse operation for attr depend on method addFile()
  631. const fileAttr = keepOriginalPermission ? entry.header.fileAttr : undefined;
  632. filetools.writeFileToAsync(filePath, content, overwrite, fileAttr, function (succ) {
  633. if (!succ) {
  634. callback(getError("Unable to write file", filePath));
  635. return;
  636. }
  637. filetools.fs.utimes(filePath, entry.header.time, entry.header.time, function (err_2) {
  638. if (err_2) {
  639. callback(getError("Unable to set times", filePath));
  640. return;
  641. }
  642. fileEntries.delete(entry);
  643. // call the callback if it was last entry
  644. done();
  645. });
  646. });
  647. }
  648. });
  649. }
  650. // call the callback if fileEntries was empty
  651. done();
  652. },
  653. /**
  654. * Writes the newly created zip file to disk at the specified location or if a zip was opened and no ``targetFileName`` is provided, it will overwrite the opened zip
  655. *
  656. * @param targetFileName
  657. * @param callback
  658. */
  659. writeZip: function (/**String*/ targetFileName, /**Function*/ callback) {
  660. if (arguments.length === 1) {
  661. if (typeof targetFileName === "function") {
  662. callback = targetFileName;
  663. targetFileName = "";
  664. }
  665. }
  666. if (!targetFileName && opts.filename) {
  667. targetFileName = opts.filename;
  668. }
  669. if (!targetFileName) return;
  670. var zipData = _zip.compressToBuffer();
  671. if (zipData) {
  672. var ok = filetools.writeFileTo(targetFileName, zipData, true);
  673. if (typeof callback === "function") callback(!ok ? new Error("failed") : null, "");
  674. }
  675. },
  676. writeZipPromise: function (/**String*/ targetFileName, /* object */ props) {
  677. const { overwrite, perm } = Object.assign({ overwrite: true }, props);
  678. return new Promise((resolve, reject) => {
  679. // find file name
  680. if (!targetFileName && opts.filename) targetFileName = opts.filename;
  681. if (!targetFileName) reject("ADM-ZIP: ZIP File Name Missing");
  682. this.toBufferPromise().then((zipData) => {
  683. const ret = (done) => (done ? resolve(done) : reject("ADM-ZIP: Wasn't able to write zip file"));
  684. filetools.writeFileToAsync(targetFileName, zipData, overwrite, perm, ret);
  685. }, reject);
  686. });
  687. },
  688. toBufferPromise: function () {
  689. return new Promise((resolve, reject) => {
  690. _zip.toAsyncBuffer(resolve, reject);
  691. });
  692. },
  693. /**
  694. * Returns the content of the entire zip file as a Buffer object
  695. *
  696. * @return Buffer
  697. */
  698. toBuffer: function (/**Function=*/ onSuccess, /**Function=*/ onFail, /**Function=*/ onItemStart, /**Function=*/ onItemEnd) {
  699. this.valueOf = 2;
  700. if (typeof onSuccess === "function") {
  701. _zip.toAsyncBuffer(onSuccess, onFail, onItemStart, onItemEnd);
  702. return null;
  703. }
  704. return _zip.compressToBuffer();
  705. }
  706. };
  707. };
  708. /***/ }),
  709. /***/ 42907:
  710. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  711. var Utils = __webpack_require__(85173),
  712. Constants = Utils.Constants;
  713. /* The central directory file header */
  714. module.exports = function () {
  715. var _verMade = 20, // v2.0
  716. _version = 10, // v1.0
  717. _flags = 0,
  718. _method = 0,
  719. _time = 0,
  720. _crc = 0,
  721. _compressedSize = 0,
  722. _size = 0,
  723. _fnameLen = 0,
  724. _extraLen = 0,
  725. _comLen = 0,
  726. _diskStart = 0,
  727. _inattr = 0,
  728. _attr = 0,
  729. _offset = 0;
  730. _verMade |= Utils.isWin ? 0x0a00 : 0x0300;
  731. // Set EFS flag since filename and comment fields are all by default encoded using UTF-8.
  732. // Without it file names may be corrupted for other apps when file names use unicode chars
  733. _flags |= Constants.FLG_EFS;
  734. var _dataHeader = {};
  735. function setTime(val) {
  736. val = new Date(val);
  737. _time =
  738. (((val.getFullYear() - 1980) & 0x7f) << 25) | // b09-16 years from 1980
  739. ((val.getMonth() + 1) << 21) | // b05-08 month
  740. (val.getDate() << 16) | // b00-04 hour
  741. // 2 bytes time
  742. (val.getHours() << 11) | // b11-15 hour
  743. (val.getMinutes() << 5) | // b05-10 minute
  744. (val.getSeconds() >> 1); // b00-04 seconds divided by 2
  745. }
  746. setTime(+new Date());
  747. return {
  748. get made() {
  749. return _verMade;
  750. },
  751. set made(val) {
  752. _verMade = val;
  753. },
  754. get version() {
  755. return _version;
  756. },
  757. set version(val) {
  758. _version = val;
  759. },
  760. get flags() {
  761. return _flags;
  762. },
  763. set flags(val) {
  764. _flags = val;
  765. },
  766. get method() {
  767. return _method;
  768. },
  769. set method(val) {
  770. switch (val) {
  771. case Constants.STORED:
  772. this.version = 10;
  773. case Constants.DEFLATED:
  774. default:
  775. this.version = 20;
  776. }
  777. _method = val;
  778. },
  779. get time() {
  780. return new Date(((_time >> 25) & 0x7f) + 1980, ((_time >> 21) & 0x0f) - 1, (_time >> 16) & 0x1f, (_time >> 11) & 0x1f, (_time >> 5) & 0x3f, (_time & 0x1f) << 1);
  781. },
  782. set time(val) {
  783. setTime(val);
  784. },
  785. get crc() {
  786. return _crc;
  787. },
  788. set crc(val) {
  789. _crc = Math.max(0, val) >>> 0;
  790. },
  791. get compressedSize() {
  792. return _compressedSize;
  793. },
  794. set compressedSize(val) {
  795. _compressedSize = Math.max(0, val) >>> 0;
  796. },
  797. get size() {
  798. return _size;
  799. },
  800. set size(val) {
  801. _size = Math.max(0, val) >>> 0;
  802. },
  803. get fileNameLength() {
  804. return _fnameLen;
  805. },
  806. set fileNameLength(val) {
  807. _fnameLen = val;
  808. },
  809. get extraLength() {
  810. return _extraLen;
  811. },
  812. set extraLength(val) {
  813. _extraLen = val;
  814. },
  815. get commentLength() {
  816. return _comLen;
  817. },
  818. set commentLength(val) {
  819. _comLen = val;
  820. },
  821. get diskNumStart() {
  822. return _diskStart;
  823. },
  824. set diskNumStart(val) {
  825. _diskStart = Math.max(0, val) >>> 0;
  826. },
  827. get inAttr() {
  828. return _inattr;
  829. },
  830. set inAttr(val) {
  831. _inattr = Math.max(0, val) >>> 0;
  832. },
  833. get attr() {
  834. return _attr;
  835. },
  836. set attr(val) {
  837. _attr = Math.max(0, val) >>> 0;
  838. },
  839. // get Unix file permissions
  840. get fileAttr() {
  841. return _attr ? (((_attr >>> 0) | 0) >> 16) & 0xfff : 0;
  842. },
  843. get offset() {
  844. return _offset;
  845. },
  846. set offset(val) {
  847. _offset = Math.max(0, val) >>> 0;
  848. },
  849. get encripted() {
  850. return (_flags & 1) === 1;
  851. },
  852. get entryHeaderSize() {
  853. return Constants.CENHDR + _fnameLen + _extraLen + _comLen;
  854. },
  855. get realDataOffset() {
  856. return _offset + Constants.LOCHDR + _dataHeader.fnameLen + _dataHeader.extraLen;
  857. },
  858. get dataHeader() {
  859. return _dataHeader;
  860. },
  861. loadDataHeaderFromBinary: function (/*Buffer*/ input) {
  862. var data = input.slice(_offset, _offset + Constants.LOCHDR);
  863. // 30 bytes and should start with "PK\003\004"
  864. if (data.readUInt32LE(0) !== Constants.LOCSIG) {
  865. throw new Error(Utils.Errors.INVALID_LOC);
  866. }
  867. _dataHeader = {
  868. // version needed to extract
  869. version: data.readUInt16LE(Constants.LOCVER),
  870. // general purpose bit flag
  871. flags: data.readUInt16LE(Constants.LOCFLG),
  872. // compression method
  873. method: data.readUInt16LE(Constants.LOCHOW),
  874. // modification time (2 bytes time, 2 bytes date)
  875. time: data.readUInt32LE(Constants.LOCTIM),
  876. // uncompressed file crc-32 value
  877. crc: data.readUInt32LE(Constants.LOCCRC),
  878. // compressed size
  879. compressedSize: data.readUInt32LE(Constants.LOCSIZ),
  880. // uncompressed size
  881. size: data.readUInt32LE(Constants.LOCLEN),
  882. // filename length
  883. fnameLen: data.readUInt16LE(Constants.LOCNAM),
  884. // extra field length
  885. extraLen: data.readUInt16LE(Constants.LOCEXT)
  886. };
  887. },
  888. loadFromBinary: function (/*Buffer*/ data) {
  889. // data should be 46 bytes and start with "PK 01 02"
  890. if (data.length !== Constants.CENHDR || data.readUInt32LE(0) !== Constants.CENSIG) {
  891. throw new Error(Utils.Errors.INVALID_CEN);
  892. }
  893. // version made by
  894. _verMade = data.readUInt16LE(Constants.CENVEM);
  895. // version needed to extract
  896. _version = data.readUInt16LE(Constants.CENVER);
  897. // encrypt, decrypt flags
  898. _flags = data.readUInt16LE(Constants.CENFLG);
  899. // compression method
  900. _method = data.readUInt16LE(Constants.CENHOW);
  901. // modification time (2 bytes time, 2 bytes date)
  902. _time = data.readUInt32LE(Constants.CENTIM);
  903. // uncompressed file crc-32 value
  904. _crc = data.readUInt32LE(Constants.CENCRC);
  905. // compressed size
  906. _compressedSize = data.readUInt32LE(Constants.CENSIZ);
  907. // uncompressed size
  908. _size = data.readUInt32LE(Constants.CENLEN);
  909. // filename length
  910. _fnameLen = data.readUInt16LE(Constants.CENNAM);
  911. // extra field length
  912. _extraLen = data.readUInt16LE(Constants.CENEXT);
  913. // file comment length
  914. _comLen = data.readUInt16LE(Constants.CENCOM);
  915. // volume number start
  916. _diskStart = data.readUInt16LE(Constants.CENDSK);
  917. // internal file attributes
  918. _inattr = data.readUInt16LE(Constants.CENATT);
  919. // external file attributes
  920. _attr = data.readUInt32LE(Constants.CENATX);
  921. // LOC header offset
  922. _offset = data.readUInt32LE(Constants.CENOFF);
  923. },
  924. dataHeaderToBinary: function () {
  925. // LOC header size (30 bytes)
  926. var data = Buffer.alloc(Constants.LOCHDR);
  927. // "PK\003\004"
  928. data.writeUInt32LE(Constants.LOCSIG, 0);
  929. // version needed to extract
  930. data.writeUInt16LE(_version, Constants.LOCVER);
  931. // general purpose bit flag
  932. data.writeUInt16LE(_flags, Constants.LOCFLG);
  933. // compression method
  934. data.writeUInt16LE(_method, Constants.LOCHOW);
  935. // modification time (2 bytes time, 2 bytes date)
  936. data.writeUInt32LE(_time, Constants.LOCTIM);
  937. // uncompressed file crc-32 value
  938. data.writeUInt32LE(_crc, Constants.LOCCRC);
  939. // compressed size
  940. data.writeUInt32LE(_compressedSize, Constants.LOCSIZ);
  941. // uncompressed size
  942. data.writeUInt32LE(_size, Constants.LOCLEN);
  943. // filename length
  944. data.writeUInt16LE(_fnameLen, Constants.LOCNAM);
  945. // extra field length
  946. data.writeUInt16LE(_extraLen, Constants.LOCEXT);
  947. return data;
  948. },
  949. entryHeaderToBinary: function () {
  950. // CEN header size (46 bytes)
  951. var data = Buffer.alloc(Constants.CENHDR + _fnameLen + _extraLen + _comLen);
  952. // "PK\001\002"
  953. data.writeUInt32LE(Constants.CENSIG, 0);
  954. // version made by
  955. data.writeUInt16LE(_verMade, Constants.CENVEM);
  956. // version needed to extract
  957. data.writeUInt16LE(_version, Constants.CENVER);
  958. // encrypt, decrypt flags
  959. data.writeUInt16LE(_flags, Constants.CENFLG);
  960. // compression method
  961. data.writeUInt16LE(_method, Constants.CENHOW);
  962. // modification time (2 bytes time, 2 bytes date)
  963. data.writeUInt32LE(_time, Constants.CENTIM);
  964. // uncompressed file crc-32 value
  965. data.writeUInt32LE(_crc, Constants.CENCRC);
  966. // compressed size
  967. data.writeUInt32LE(_compressedSize, Constants.CENSIZ);
  968. // uncompressed size
  969. data.writeUInt32LE(_size, Constants.CENLEN);
  970. // filename length
  971. data.writeUInt16LE(_fnameLen, Constants.CENNAM);
  972. // extra field length
  973. data.writeUInt16LE(_extraLen, Constants.CENEXT);
  974. // file comment length
  975. data.writeUInt16LE(_comLen, Constants.CENCOM);
  976. // volume number start
  977. data.writeUInt16LE(_diskStart, Constants.CENDSK);
  978. // internal file attributes
  979. data.writeUInt16LE(_inattr, Constants.CENATT);
  980. // external file attributes
  981. data.writeUInt32LE(_attr, Constants.CENATX);
  982. // LOC header offset
  983. data.writeUInt32LE(_offset, Constants.CENOFF);
  984. // fill all with
  985. data.fill(0x00, Constants.CENHDR);
  986. return data;
  987. },
  988. toJSON: function () {
  989. const bytes = function (nr) {
  990. return nr + " bytes";
  991. };
  992. return {
  993. made: _verMade,
  994. version: _version,
  995. flags: _flags,
  996. method: Utils.methodToString(_method),
  997. time: this.time,
  998. crc: "0x" + _crc.toString(16).toUpperCase(),
  999. compressedSize: bytes(_compressedSize),
  1000. size: bytes(_size),
  1001. fileNameLength: bytes(_fnameLen),
  1002. extraLength: bytes(_extraLen),
  1003. commentLength: bytes(_comLen),
  1004. diskNumStart: _diskStart,
  1005. inAttr: _inattr,
  1006. attr: _attr,
  1007. offset: _offset,
  1008. entryHeaderSize: bytes(Constants.CENHDR + _fnameLen + _extraLen + _comLen)
  1009. };
  1010. },
  1011. toString: function () {
  1012. return JSON.stringify(this.toJSON(), null, "\t");
  1013. }
  1014. };
  1015. };
  1016. /***/ }),
  1017. /***/ 53854:
  1018. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  1019. exports.EntryHeader = __webpack_require__(42907);
  1020. exports.MainHeader = __webpack_require__(83519);
  1021. /***/ }),
  1022. /***/ 83519:
  1023. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1024. var Utils = __webpack_require__(85173),
  1025. Constants = Utils.Constants;
  1026. /* The entries in the end of central directory */
  1027. module.exports = function () {
  1028. var _volumeEntries = 0,
  1029. _totalEntries = 0,
  1030. _size = 0,
  1031. _offset = 0,
  1032. _commentLength = 0;
  1033. return {
  1034. get diskEntries() {
  1035. return _volumeEntries;
  1036. },
  1037. set diskEntries(/*Number*/ val) {
  1038. _volumeEntries = _totalEntries = val;
  1039. },
  1040. get totalEntries() {
  1041. return _totalEntries;
  1042. },
  1043. set totalEntries(/*Number*/ val) {
  1044. _totalEntries = _volumeEntries = val;
  1045. },
  1046. get size() {
  1047. return _size;
  1048. },
  1049. set size(/*Number*/ val) {
  1050. _size = val;
  1051. },
  1052. get offset() {
  1053. return _offset;
  1054. },
  1055. set offset(/*Number*/ val) {
  1056. _offset = val;
  1057. },
  1058. get commentLength() {
  1059. return _commentLength;
  1060. },
  1061. set commentLength(/*Number*/ val) {
  1062. _commentLength = val;
  1063. },
  1064. get mainHeaderSize() {
  1065. return Constants.ENDHDR + _commentLength;
  1066. },
  1067. loadFromBinary: function (/*Buffer*/ data) {
  1068. // data should be 22 bytes and start with "PK 05 06"
  1069. // or be 56+ bytes and start with "PK 06 06" for Zip64
  1070. if (
  1071. (data.length !== Constants.ENDHDR || data.readUInt32LE(0) !== Constants.ENDSIG) &&
  1072. (data.length < Constants.ZIP64HDR || data.readUInt32LE(0) !== Constants.ZIP64SIG)
  1073. ) {
  1074. throw new Error(Utils.Errors.INVALID_END);
  1075. }
  1076. if (data.readUInt32LE(0) === Constants.ENDSIG) {
  1077. // number of entries on this volume
  1078. _volumeEntries = data.readUInt16LE(Constants.ENDSUB);
  1079. // total number of entries
  1080. _totalEntries = data.readUInt16LE(Constants.ENDTOT);
  1081. // central directory size in bytes
  1082. _size = data.readUInt32LE(Constants.ENDSIZ);
  1083. // offset of first CEN header
  1084. _offset = data.readUInt32LE(Constants.ENDOFF);
  1085. // zip file comment length
  1086. _commentLength = data.readUInt16LE(Constants.ENDCOM);
  1087. } else {
  1088. // number of entries on this volume
  1089. _volumeEntries = Utils.readBigUInt64LE(data, Constants.ZIP64SUB);
  1090. // total number of entries
  1091. _totalEntries = Utils.readBigUInt64LE(data, Constants.ZIP64TOT);
  1092. // central directory size in bytes
  1093. _size = Utils.readBigUInt64LE(data, Constants.ZIP64SIZ);
  1094. // offset of first CEN header
  1095. _offset = Utils.readBigUInt64LE(data, Constants.ZIP64OFF);
  1096. _commentLength = 0;
  1097. }
  1098. },
  1099. toBinary: function () {
  1100. var b = Buffer.alloc(Constants.ENDHDR + _commentLength);
  1101. // "PK 05 06" signature
  1102. b.writeUInt32LE(Constants.ENDSIG, 0);
  1103. b.writeUInt32LE(0, 4);
  1104. // number of entries on this volume
  1105. b.writeUInt16LE(_volumeEntries, Constants.ENDSUB);
  1106. // total number of entries
  1107. b.writeUInt16LE(_totalEntries, Constants.ENDTOT);
  1108. // central directory size in bytes
  1109. b.writeUInt32LE(_size, Constants.ENDSIZ);
  1110. // offset of first CEN header
  1111. b.writeUInt32LE(_offset, Constants.ENDOFF);
  1112. // zip file comment length
  1113. b.writeUInt16LE(_commentLength, Constants.ENDCOM);
  1114. // fill comment memory with spaces so no garbage is left there
  1115. b.fill(" ", Constants.ENDHDR);
  1116. return b;
  1117. },
  1118. toJSON: function () {
  1119. // creates 0x0000 style output
  1120. const offset = function (nr, len) {
  1121. let offs = nr.toString(16).toUpperCase();
  1122. while (offs.length < len) offs = "0" + offs;
  1123. return "0x" + offs;
  1124. };
  1125. return {
  1126. diskEntries: _volumeEntries,
  1127. totalEntries: _totalEntries,
  1128. size: _size + " bytes",
  1129. offset: offset(_offset, 4),
  1130. commentLength: _commentLength
  1131. };
  1132. },
  1133. toString: function () {
  1134. return JSON.stringify(this.toJSON(), null, "\t");
  1135. }
  1136. };
  1137. };
  1138. /***/ }),
  1139. /***/ 10278:
  1140. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1141. module.exports = function (/*Buffer*/ inbuf) {
  1142. var zlib = __webpack_require__(78761);
  1143. var opts = { chunkSize: (parseInt(inbuf.length / 1024) + 1) * 1024 };
  1144. return {
  1145. deflate: function () {
  1146. return zlib.deflateRawSync(inbuf, opts);
  1147. },
  1148. deflateAsync: function (/*Function*/ callback) {
  1149. var tmp = zlib.createDeflateRaw(opts),
  1150. parts = [],
  1151. total = 0;
  1152. tmp.on("data", function (data) {
  1153. parts.push(data);
  1154. total += data.length;
  1155. });
  1156. tmp.on("end", function () {
  1157. var buf = Buffer.alloc(total),
  1158. written = 0;
  1159. buf.fill(0);
  1160. for (var i = 0; i < parts.length; i++) {
  1161. var part = parts[i];
  1162. part.copy(buf, written);
  1163. written += part.length;
  1164. }
  1165. callback && callback(buf);
  1166. });
  1167. tmp.end(inbuf);
  1168. }
  1169. };
  1170. };
  1171. /***/ }),
  1172. /***/ 81004:
  1173. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  1174. exports.Deflater = __webpack_require__(10278);
  1175. exports.Inflater = __webpack_require__(61269);
  1176. exports.ZipCrypto = __webpack_require__(94729);
  1177. /***/ }),
  1178. /***/ 61269:
  1179. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1180. module.exports = function (/*Buffer*/ inbuf) {
  1181. var zlib = __webpack_require__(78761);
  1182. return {
  1183. inflate: function () {
  1184. return zlib.inflateRawSync(inbuf);
  1185. },
  1186. inflateAsync: function (/*Function*/ callback) {
  1187. var tmp = zlib.createInflateRaw(),
  1188. parts = [],
  1189. total = 0;
  1190. tmp.on("data", function (data) {
  1191. parts.push(data);
  1192. total += data.length;
  1193. });
  1194. tmp.on("end", function () {
  1195. var buf = Buffer.alloc(total),
  1196. written = 0;
  1197. buf.fill(0);
  1198. for (var i = 0; i < parts.length; i++) {
  1199. var part = parts[i];
  1200. part.copy(buf, written);
  1201. written += part.length;
  1202. }
  1203. callback && callback(buf);
  1204. });
  1205. tmp.end(inbuf);
  1206. }
  1207. };
  1208. };
  1209. /***/ }),
  1210. /***/ 94729:
  1211. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1212. "use strict";
  1213. // node crypt, we use it for generate salt
  1214. // eslint-disable-next-line node/no-unsupported-features/node-builtins
  1215. const { randomFillSync } = __webpack_require__(76417);
  1216. // generate CRC32 lookup table
  1217. const crctable = new Uint32Array(256).map((t, crc) => {
  1218. for (let j = 0; j < 8; j++) {
  1219. if (0 !== (crc & 1)) {
  1220. crc = (crc >>> 1) ^ 0xedb88320;
  1221. } else {
  1222. crc >>>= 1;
  1223. }
  1224. }
  1225. return crc >>> 0;
  1226. });
  1227. // C-style uInt32 Multiply (discards higher bits, when JS multiply discards lower bits)
  1228. const uMul = (a, b) => Math.imul(a, b) >>> 0;
  1229. // crc32 byte single update (actually same function is part of utils.crc32 function :) )
  1230. const crc32update = (pCrc32, bval) => {
  1231. return crctable[(pCrc32 ^ bval) & 0xff] ^ (pCrc32 >>> 8);
  1232. };
  1233. // function for generating salt for encrytion header
  1234. const genSalt = () => {
  1235. if ("function" === typeof randomFillSync) {
  1236. return randomFillSync(Buffer.alloc(12));
  1237. } else {
  1238. // fallback if function is not defined
  1239. return genSalt.node();
  1240. }
  1241. };
  1242. // salt generation with node random function (mainly as fallback)
  1243. genSalt.node = () => {
  1244. const salt = Buffer.alloc(12);
  1245. const len = salt.length;
  1246. for (let i = 0; i < len; i++) salt[i] = (Math.random() * 256) & 0xff;
  1247. return salt;
  1248. };
  1249. // general config
  1250. const config = {
  1251. genSalt
  1252. };
  1253. // Class Initkeys handles same basic ops with keys
  1254. function Initkeys(pw) {
  1255. const pass = Buffer.isBuffer(pw) ? pw : Buffer.from(pw);
  1256. this.keys = new Uint32Array([0x12345678, 0x23456789, 0x34567890]);
  1257. for (let i = 0; i < pass.length; i++) {
  1258. this.updateKeys(pass[i]);
  1259. }
  1260. }
  1261. Initkeys.prototype.updateKeys = function (byteValue) {
  1262. const keys = this.keys;
  1263. keys[0] = crc32update(keys[0], byteValue);
  1264. keys[1] += keys[0] & 0xff;
  1265. keys[1] = uMul(keys[1], 134775813) + 1;
  1266. keys[2] = crc32update(keys[2], keys[1] >>> 24);
  1267. return byteValue;
  1268. };
  1269. Initkeys.prototype.next = function () {
  1270. const k = (this.keys[2] | 2) >>> 0; // key
  1271. return (uMul(k, k ^ 1) >> 8) & 0xff; // decode
  1272. };
  1273. function make_decrypter(/*Buffer*/ pwd) {
  1274. // 1. Stage initialize key
  1275. const keys = new Initkeys(pwd);
  1276. // return decrypter function
  1277. return function (/*Buffer*/ data) {
  1278. // result - we create new Buffer for results
  1279. const result = Buffer.alloc(data.length);
  1280. let pos = 0;
  1281. // process input data
  1282. for (let c of data) {
  1283. //c ^= keys.next();
  1284. //result[pos++] = c; // decode & Save Value
  1285. result[pos++] = keys.updateKeys(c ^ keys.next()); // update keys with decoded byte
  1286. }
  1287. return result;
  1288. };
  1289. }
  1290. function make_encrypter(/*Buffer*/ pwd) {
  1291. // 1. Stage initialize key
  1292. const keys = new Initkeys(pwd);
  1293. // return encrypting function, result and pos is here so we dont have to merge buffers later
  1294. return function (/*Buffer*/ data, /*Buffer*/ result, /* Number */ pos = 0) {
  1295. // result - we create new Buffer for results
  1296. if (!result) result = Buffer.alloc(data.length);
  1297. // process input data
  1298. for (let c of data) {
  1299. const k = keys.next(); // save key byte
  1300. result[pos++] = c ^ k; // save val
  1301. keys.updateKeys(c); // update keys with decoded byte
  1302. }
  1303. return result;
  1304. };
  1305. }
  1306. function decrypt(/*Buffer*/ data, /*Object*/ header, /*String, Buffer*/ pwd) {
  1307. if (!data || !Buffer.isBuffer(data) || data.length < 12) {
  1308. return Buffer.alloc(0);
  1309. }
  1310. // 1. We Initialize and generate decrypting function
  1311. const decrypter = make_decrypter(pwd);
  1312. // 2. decrypt salt what is always 12 bytes and is a part of file content
  1313. const salt = decrypter(data.slice(0, 12));
  1314. // 3. does password meet expectations
  1315. if (salt[11] !== header.crc >>> 24) {
  1316. throw "ADM-ZIP: Wrong Password";
  1317. }
  1318. // 4. decode content
  1319. return decrypter(data.slice(12));
  1320. }
  1321. // lets add way to populate salt, NOT RECOMMENDED for production but maybe useful for testing general functionality
  1322. function _salter(data) {
  1323. if (Buffer.isBuffer(data) && data.length >= 12) {
  1324. // be aware - currently salting buffer data is modified
  1325. config.genSalt = function () {
  1326. return data.slice(0, 12);
  1327. };
  1328. } else if (data === "node") {
  1329. // test salt generation with node random function
  1330. config.genSalt = genSalt.node;
  1331. } else {
  1332. // if value is not acceptable config gets reset.
  1333. config.genSalt = genSalt;
  1334. }
  1335. }
  1336. function encrypt(/*Buffer*/ data, /*Object*/ header, /*String, Buffer*/ pwd, /*Boolean*/ oldlike = false) {
  1337. // 1. test data if data is not Buffer we make buffer from it
  1338. if (data == null) data = Buffer.alloc(0);
  1339. // if data is not buffer be make buffer from it
  1340. if (!Buffer.isBuffer(data)) data = Buffer.from(data.toString());
  1341. // 2. We Initialize and generate encrypting function
  1342. const encrypter = make_encrypter(pwd);
  1343. // 3. generate salt (12-bytes of random data)
  1344. const salt = config.genSalt();
  1345. salt[11] = (header.crc >>> 24) & 0xff;
  1346. // old implementations (before PKZip 2.04g) used two byte check
  1347. if (oldlike) salt[10] = (header.crc >>> 16) & 0xff;
  1348. // 4. create output
  1349. const result = Buffer.alloc(data.length + 12);
  1350. encrypter(salt, result);
  1351. // finally encode content
  1352. return encrypter(data, result, 12);
  1353. }
  1354. module.exports = { decrypt, encrypt, _salter };
  1355. /***/ }),
  1356. /***/ 55991:
  1357. /***/ ((module) => {
  1358. module.exports = {
  1359. /* The local file header */
  1360. LOCHDR : 30, // LOC header size
  1361. LOCSIG : 0x04034b50, // "PK\003\004"
  1362. LOCVER : 4, // version needed to extract
  1363. LOCFLG : 6, // general purpose bit flag
  1364. LOCHOW : 8, // compression method
  1365. LOCTIM : 10, // modification time (2 bytes time, 2 bytes date)
  1366. LOCCRC : 14, // uncompressed file crc-32 value
  1367. LOCSIZ : 18, // compressed size
  1368. LOCLEN : 22, // uncompressed size
  1369. LOCNAM : 26, // filename length
  1370. LOCEXT : 28, // extra field length
  1371. /* The Data descriptor */
  1372. EXTSIG : 0x08074b50, // "PK\007\008"
  1373. EXTHDR : 16, // EXT header size
  1374. EXTCRC : 4, // uncompressed file crc-32 value
  1375. EXTSIZ : 8, // compressed size
  1376. EXTLEN : 12, // uncompressed size
  1377. /* The central directory file header */
  1378. CENHDR : 46, // CEN header size
  1379. CENSIG : 0x02014b50, // "PK\001\002"
  1380. CENVEM : 4, // version made by
  1381. CENVER : 6, // version needed to extract
  1382. CENFLG : 8, // encrypt, decrypt flags
  1383. CENHOW : 10, // compression method
  1384. CENTIM : 12, // modification time (2 bytes time, 2 bytes date)
  1385. CENCRC : 16, // uncompressed file crc-32 value
  1386. CENSIZ : 20, // compressed size
  1387. CENLEN : 24, // uncompressed size
  1388. CENNAM : 28, // filename length
  1389. CENEXT : 30, // extra field length
  1390. CENCOM : 32, // file comment length
  1391. CENDSK : 34, // volume number start
  1392. CENATT : 36, // internal file attributes
  1393. CENATX : 38, // external file attributes (host system dependent)
  1394. CENOFF : 42, // LOC header offset
  1395. /* The entries in the end of central directory */
  1396. ENDHDR : 22, // END header size
  1397. ENDSIG : 0x06054b50, // "PK\005\006"
  1398. ENDSUB : 8, // number of entries on this disk
  1399. ENDTOT : 10, // total number of entries
  1400. ENDSIZ : 12, // central directory size in bytes
  1401. ENDOFF : 16, // offset of first CEN header
  1402. ENDCOM : 20, // zip file comment length
  1403. END64HDR : 20, // zip64 END header size
  1404. END64SIG : 0x07064b50, // zip64 Locator signature, "PK\006\007"
  1405. END64START : 4, // number of the disk with the start of the zip64
  1406. END64OFF : 8, // relative offset of the zip64 end of central directory
  1407. END64NUMDISKS : 16, // total number of disks
  1408. ZIP64SIG : 0x06064b50, // zip64 signature, "PK\006\006"
  1409. ZIP64HDR : 56, // zip64 record minimum size
  1410. ZIP64LEAD : 12, // leading bytes at the start of the record, not counted by the value stored in ZIP64SIZE
  1411. ZIP64SIZE : 4, // zip64 size of the central directory record
  1412. ZIP64VEM : 12, // zip64 version made by
  1413. ZIP64VER : 14, // zip64 version needed to extract
  1414. ZIP64DSK : 16, // zip64 number of this disk
  1415. ZIP64DSKDIR : 20, // number of the disk with the start of the record directory
  1416. ZIP64SUB : 24, // number of entries on this disk
  1417. ZIP64TOT : 32, // total number of entries
  1418. ZIP64SIZB : 40, // zip64 central directory size in bytes
  1419. ZIP64OFF : 48, // offset of start of central directory with respect to the starting disk number
  1420. ZIP64EXTRA : 56, // extensible data sector
  1421. /* Compression methods */
  1422. STORED : 0, // no compression
  1423. SHRUNK : 1, // shrunk
  1424. REDUCED1 : 2, // reduced with compression factor 1
  1425. REDUCED2 : 3, // reduced with compression factor 2
  1426. REDUCED3 : 4, // reduced with compression factor 3
  1427. REDUCED4 : 5, // reduced with compression factor 4
  1428. IMPLODED : 6, // imploded
  1429. // 7 reserved for Tokenizing compression algorithm
  1430. DEFLATED : 8, // deflated
  1431. ENHANCED_DEFLATED: 9, // enhanced deflated
  1432. PKWARE : 10,// PKWare DCL imploded
  1433. // 11 reserved by PKWARE
  1434. BZIP2 : 12, // compressed using BZIP2
  1435. // 13 reserved by PKWARE
  1436. LZMA : 14, // LZMA
  1437. // 15-17 reserved by PKWARE
  1438. IBM_TERSE : 18, // compressed using IBM TERSE
  1439. IBM_LZ77 : 19, // IBM LZ77 z
  1440. AES_ENCRYPT : 99, // WinZIP AES encryption method
  1441. /* General purpose bit flag */
  1442. // values can obtained with expression 2**bitnr
  1443. FLG_ENC : 1, // Bit 0: encrypted file
  1444. FLG_COMP1 : 2, // Bit 1, compression option
  1445. FLG_COMP2 : 4, // Bit 2, compression option
  1446. FLG_DESC : 8, // Bit 3, data descriptor
  1447. FLG_ENH : 16, // Bit 4, enhanced deflating
  1448. FLG_PATCH : 32, // Bit 5, indicates that the file is compressed patched data.
  1449. FLG_STR : 64, // Bit 6, strong encryption (patented)
  1450. // Bits 7-10: Currently unused.
  1451. FLG_EFS : 2048, // Bit 11: Language encoding flag (EFS)
  1452. // Bit 12: Reserved by PKWARE for enhanced compression.
  1453. // Bit 13: encrypted the Central Directory (patented).
  1454. // Bits 14-15: Reserved by PKWARE.
  1455. FLG_MSK : 4096, // mask header values
  1456. /* Load type */
  1457. FILE : 2,
  1458. BUFFER : 1,
  1459. NONE : 0,
  1460. /* 4.5 Extensible data fields */
  1461. EF_ID : 0,
  1462. EF_SIZE : 2,
  1463. /* Header IDs */
  1464. ID_ZIP64 : 0x0001,
  1465. ID_AVINFO : 0x0007,
  1466. ID_PFS : 0x0008,
  1467. ID_OS2 : 0x0009,
  1468. ID_NTFS : 0x000a,
  1469. ID_OPENVMS : 0x000c,
  1470. ID_UNIX : 0x000d,
  1471. ID_FORK : 0x000e,
  1472. ID_PATCH : 0x000f,
  1473. ID_X509_PKCS7 : 0x0014,
  1474. ID_X509_CERTID_F : 0x0015,
  1475. ID_X509_CERTID_C : 0x0016,
  1476. ID_STRONGENC : 0x0017,
  1477. ID_RECORD_MGT : 0x0018,
  1478. ID_X509_PKCS7_RL : 0x0019,
  1479. ID_IBM1 : 0x0065,
  1480. ID_IBM2 : 0x0066,
  1481. ID_POSZIP : 0x4690,
  1482. EF_ZIP64_OR_32 : 0xffffffff,
  1483. EF_ZIP64_OR_16 : 0xffff,
  1484. EF_ZIP64_SUNCOMP : 0,
  1485. EF_ZIP64_SCOMP : 8,
  1486. EF_ZIP64_RHO : 16,
  1487. EF_ZIP64_DSN : 24
  1488. };
  1489. /***/ }),
  1490. /***/ 12190:
  1491. /***/ ((module) => {
  1492. module.exports = {
  1493. /* Header error messages */
  1494. INVALID_LOC: "Invalid LOC header (bad signature)",
  1495. INVALID_CEN: "Invalid CEN header (bad signature)",
  1496. INVALID_END: "Invalid END header (bad signature)",
  1497. /* ZipEntry error messages*/
  1498. NO_DATA: "Nothing to decompress",
  1499. BAD_CRC: "CRC32 checksum failed",
  1500. FILE_IN_THE_WAY: "There is a file in the way: %s",
  1501. UNKNOWN_METHOD: "Invalid/unsupported compression method",
  1502. /* Inflater error messages */
  1503. AVAIL_DATA: "inflate::Available inflate data did not terminate",
  1504. INVALID_DISTANCE: "inflate::Invalid literal/length or distance code in fixed or dynamic block",
  1505. TO_MANY_CODES: "inflate::Dynamic block code description: too many length or distance codes",
  1506. INVALID_REPEAT_LEN: "inflate::Dynamic block code description: repeat more than specified lengths",
  1507. INVALID_REPEAT_FIRST: "inflate::Dynamic block code description: repeat lengths with no first length",
  1508. INCOMPLETE_CODES: "inflate::Dynamic block code description: code lengths codes incomplete",
  1509. INVALID_DYN_DISTANCE: "inflate::Dynamic block code description: invalid distance code lengths",
  1510. INVALID_CODES_LEN: "inflate::Dynamic block code description: invalid literal/length code lengths",
  1511. INVALID_STORE_BLOCK: "inflate::Stored block length did not match one's complement",
  1512. INVALID_BLOCK_TYPE: "inflate::Invalid block type (type == 3)",
  1513. /* ADM-ZIP error messages */
  1514. CANT_EXTRACT_FILE: "Could not extract the file",
  1515. CANT_OVERRIDE: "Target file already exists",
  1516. NO_ZIP: "No zip file was loaded",
  1517. NO_ENTRY: "Entry doesn't exist",
  1518. DIRECTORY_CONTENT_ERROR: "A directory cannot have content",
  1519. FILE_NOT_FOUND: "File not found: %s",
  1520. NOT_IMPLEMENTED: "Not implemented",
  1521. INVALID_FILENAME: "Invalid filename",
  1522. INVALID_FORMAT: "Invalid or unsupported zip format. No END header found"
  1523. };
  1524. /***/ }),
  1525. /***/ 13455:
  1526. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1527. const fs = __webpack_require__(65147).require();
  1528. const pth = __webpack_require__(85622);
  1529. fs.existsSync = fs.existsSync || pth.existsSync;
  1530. module.exports = function (/*String*/ path) {
  1531. var _path = path || "",
  1532. _obj = newAttr(),
  1533. _stat = null;
  1534. function newAttr() {
  1535. return {
  1536. directory: false,
  1537. readonly: false,
  1538. hidden: false,
  1539. executable: false,
  1540. mtime: 0,
  1541. atime: 0
  1542. };
  1543. }
  1544. if (_path && fs.existsSync(_path)) {
  1545. _stat = fs.statSync(_path);
  1546. _obj.directory = _stat.isDirectory();
  1547. _obj.mtime = _stat.mtime;
  1548. _obj.atime = _stat.atime;
  1549. _obj.executable = (0o111 & _stat.mode) !== 0; // file is executable who ever har right not just owner
  1550. _obj.readonly = (0o200 & _stat.mode) === 0; // readonly if owner has no write right
  1551. _obj.hidden = pth.basename(_path)[0] === ".";
  1552. } else {
  1553. console.warn("Invalid path: " + _path);
  1554. }
  1555. return {
  1556. get directory() {
  1557. return _obj.directory;
  1558. },
  1559. get readOnly() {
  1560. return _obj.readonly;
  1561. },
  1562. get hidden() {
  1563. return _obj.hidden;
  1564. },
  1565. get mtime() {
  1566. return _obj.mtime;
  1567. },
  1568. get atime() {
  1569. return _obj.atime;
  1570. },
  1571. get executable() {
  1572. return _obj.executable;
  1573. },
  1574. decodeAttributes: function () {},
  1575. encodeAttributes: function () {},
  1576. toJSON: function () {
  1577. return {
  1578. path: _path,
  1579. isDirectory: _obj.directory,
  1580. isReadOnly: _obj.readonly,
  1581. isHidden: _obj.hidden,
  1582. isExecutable: _obj.executable,
  1583. mTime: _obj.mtime,
  1584. aTime: _obj.atime
  1585. };
  1586. },
  1587. toString: function () {
  1588. return JSON.stringify(this.toJSON(), null, "\t");
  1589. }
  1590. };
  1591. };
  1592. /***/ }),
  1593. /***/ 65147:
  1594. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  1595. exports.require = function () {
  1596. if (typeof process === "object" && process.versions && process.versions["electron"]) {
  1597. try {
  1598. const originalFs = __webpack_require__(Object(function webpackMissingModule() { var e = new Error("Cannot find module 'original-fs'"); e.code = 'MODULE_NOT_FOUND'; throw e; }()));
  1599. if (Object.keys(originalFs).length > 0) {
  1600. return originalFs;
  1601. }
  1602. } catch (e) {}
  1603. }
  1604. return __webpack_require__(35747);
  1605. };
  1606. /***/ }),
  1607. /***/ 85173:
  1608. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1609. module.exports = __webpack_require__(7646);
  1610. module.exports.Constants = __webpack_require__(55991);
  1611. module.exports.Errors = __webpack_require__(12190);
  1612. module.exports.FileAttr = __webpack_require__(13455);
  1613. /***/ }),
  1614. /***/ 7646:
  1615. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1616. const fsystem = __webpack_require__(65147).require();
  1617. const pth = __webpack_require__(85622);
  1618. const Constants = __webpack_require__(55991);
  1619. const isWin = typeof process === "object" && "win32" === process.platform;
  1620. const is_Obj = (obj) => obj && typeof obj === "object";
  1621. // generate CRC32 lookup table
  1622. const crcTable = new Uint32Array(256).map((t, c) => {
  1623. for (let k = 0; k < 8; k++) {
  1624. if ((c & 1) !== 0) {
  1625. c = 0xedb88320 ^ (c >>> 1);
  1626. } else {
  1627. c >>>= 1;
  1628. }
  1629. }
  1630. return c >>> 0;
  1631. });
  1632. // UTILS functions
  1633. function Utils(opts) {
  1634. this.sep = pth.sep;
  1635. this.fs = fsystem;
  1636. if (is_Obj(opts)) {
  1637. // custom filesystem
  1638. if (is_Obj(opts.fs) && typeof opts.fs.statSync === "function") {
  1639. this.fs = opts.fs;
  1640. }
  1641. }
  1642. }
  1643. module.exports = Utils;
  1644. // INSTANCED functions
  1645. Utils.prototype.makeDir = function (/*String*/ folder) {
  1646. const self = this;
  1647. // Sync - make directories tree
  1648. function mkdirSync(/*String*/ fpath) {
  1649. let resolvedPath = fpath.split(self.sep)[0];
  1650. fpath.split(self.sep).forEach(function (name) {
  1651. if (!name || name.substr(-1, 1) === ":") return;
  1652. resolvedPath += self.sep + name;
  1653. var stat;
  1654. try {
  1655. stat = self.fs.statSync(resolvedPath);
  1656. } catch (e) {
  1657. self.fs.mkdirSync(resolvedPath);
  1658. }
  1659. if (stat && stat.isFile()) throw Errors.FILE_IN_THE_WAY.replace("%s", resolvedPath);
  1660. });
  1661. }
  1662. mkdirSync(folder);
  1663. };
  1664. Utils.prototype.writeFileTo = function (/*String*/ path, /*Buffer*/ content, /*Boolean*/ overwrite, /*Number*/ attr) {
  1665. const self = this;
  1666. if (self.fs.existsSync(path)) {
  1667. if (!overwrite) return false; // cannot overwrite
  1668. var stat = self.fs.statSync(path);
  1669. if (stat.isDirectory()) {
  1670. return false;
  1671. }
  1672. }
  1673. var folder = pth.dirname(path);
  1674. if (!self.fs.existsSync(folder)) {
  1675. self.makeDir(folder);
  1676. }
  1677. var fd;
  1678. try {
  1679. fd = self.fs.openSync(path, "w", 438); // 0666
  1680. } catch (e) {
  1681. self.fs.chmodSync(path, 438);
  1682. fd = self.fs.openSync(path, "w", 438);
  1683. }
  1684. if (fd) {
  1685. try {
  1686. self.fs.writeSync(fd, content, 0, content.length, 0);
  1687. } finally {
  1688. self.fs.closeSync(fd);
  1689. }
  1690. }
  1691. self.fs.chmodSync(path, attr || 438);
  1692. return true;
  1693. };
  1694. Utils.prototype.writeFileToAsync = function (/*String*/ path, /*Buffer*/ content, /*Boolean*/ overwrite, /*Number*/ attr, /*Function*/ callback) {
  1695. if (typeof attr === "function") {
  1696. callback = attr;
  1697. attr = undefined;
  1698. }
  1699. const self = this;
  1700. self.fs.exists(path, function (exist) {
  1701. if (exist && !overwrite) return callback(false);
  1702. self.fs.stat(path, function (err, stat) {
  1703. if (exist && stat.isDirectory()) {
  1704. return callback(false);
  1705. }
  1706. var folder = pth.dirname(path);
  1707. self.fs.exists(folder, function (exists) {
  1708. if (!exists) self.makeDir(folder);
  1709. self.fs.open(path, "w", 438, function (err, fd) {
  1710. if (err) {
  1711. self.fs.chmod(path, 438, function () {
  1712. self.fs.open(path, "w", 438, function (err, fd) {
  1713. self.fs.write(fd, content, 0, content.length, 0, function () {
  1714. self.fs.close(fd, function () {
  1715. self.fs.chmod(path, attr || 438, function () {
  1716. callback(true);
  1717. });
  1718. });
  1719. });
  1720. });
  1721. });
  1722. } else if (fd) {
  1723. self.fs.write(fd, content, 0, content.length, 0, function () {
  1724. self.fs.close(fd, function () {
  1725. self.fs.chmod(path, attr || 438, function () {
  1726. callback(true);
  1727. });
  1728. });
  1729. });
  1730. } else {
  1731. self.fs.chmod(path, attr || 438, function () {
  1732. callback(true);
  1733. });
  1734. }
  1735. });
  1736. });
  1737. });
  1738. });
  1739. };
  1740. Utils.prototype.findFiles = function (/*String*/ path) {
  1741. const self = this;
  1742. function findSync(/*String*/ dir, /*RegExp*/ pattern, /*Boolean*/ recursive) {
  1743. if (typeof pattern === "boolean") {
  1744. recursive = pattern;
  1745. pattern = undefined;
  1746. }
  1747. let files = [];
  1748. self.fs.readdirSync(dir).forEach(function (file) {
  1749. var path = pth.join(dir, file);
  1750. if (self.fs.statSync(path).isDirectory() && recursive) files = files.concat(findSync(path, pattern, recursive));
  1751. if (!pattern || pattern.test(path)) {
  1752. files.push(pth.normalize(path) + (self.fs.statSync(path).isDirectory() ? self.sep : ""));
  1753. }
  1754. });
  1755. return files;
  1756. }
  1757. return findSync(path, undefined, true);
  1758. };
  1759. Utils.prototype.getAttributes = function () {};
  1760. Utils.prototype.setAttributes = function () {};
  1761. // STATIC functions
  1762. // crc32 single update (it is part of crc32)
  1763. Utils.crc32update = function (crc, byte) {
  1764. return crcTable[(crc ^ byte) & 0xff] ^ (crc >>> 8);
  1765. };
  1766. Utils.crc32 = function (buf) {
  1767. if (typeof buf === "string") {
  1768. buf = Buffer.from(buf, "utf8");
  1769. }
  1770. // Generate crcTable
  1771. if (!crcTable.length) genCRCTable();
  1772. let len = buf.length;
  1773. let crc = ~0;
  1774. for (let off = 0; off < len; ) crc = Utils.crc32update(crc, buf[off++]);
  1775. // xor and cast as uint32 number
  1776. return ~crc >>> 0;
  1777. };
  1778. Utils.methodToString = function (/*Number*/ method) {
  1779. switch (method) {
  1780. case Constants.STORED:
  1781. return "STORED (" + method + ")";
  1782. case Constants.DEFLATED:
  1783. return "DEFLATED (" + method + ")";
  1784. default:
  1785. return "UNSUPPORTED (" + method + ")";
  1786. }
  1787. };
  1788. // removes ".." style path elements
  1789. Utils.canonical = function (/*string*/ path) {
  1790. if (!path) return "";
  1791. // trick normalize think path is absolute
  1792. var safeSuffix = pth.posix.normalize("/" + path.split("\\").join("/"));
  1793. return pth.join(".", safeSuffix);
  1794. };
  1795. // make abolute paths taking prefix as root folder
  1796. Utils.sanitize = function (/*string*/ prefix, /*string*/ name) {
  1797. prefix = pth.resolve(pth.normalize(prefix));
  1798. var parts = name.split("/");
  1799. for (var i = 0, l = parts.length; i < l; i++) {
  1800. var path = pth.normalize(pth.join(prefix, parts.slice(i, l).join(pth.sep)));
  1801. if (path.indexOf(prefix) === 0) {
  1802. return path;
  1803. }
  1804. }
  1805. return pth.normalize(pth.join(prefix, pth.basename(name)));
  1806. };
  1807. // converts buffer, Uint8Array, string types to buffer
  1808. Utils.toBuffer = function toBuffer(/*buffer, Uint8Array, string*/ input) {
  1809. if (Buffer.isBuffer(input)) {
  1810. return input;
  1811. } else if (input instanceof Uint8Array) {
  1812. return Buffer.from(input);
  1813. } else {
  1814. // expect string all other values are invalid and return empty buffer
  1815. return typeof input === "string" ? Buffer.from(input, "utf8") : Buffer.alloc(0);
  1816. }
  1817. };
  1818. Utils.readBigUInt64LE = function (/*Buffer*/ buffer, /*int*/ index) {
  1819. var slice = Buffer.from(buffer.slice(index, index + 8));
  1820. slice.swap64();
  1821. return parseInt(`0x${slice.toString("hex")}`);
  1822. };
  1823. Utils.isWin = isWin; // Do we have windows system
  1824. Utils.crcTable = crcTable;
  1825. /***/ }),
  1826. /***/ 47396:
  1827. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1828. var Utils = __webpack_require__(85173),
  1829. Headers = __webpack_require__(53854),
  1830. Constants = Utils.Constants,
  1831. Methods = __webpack_require__(81004);
  1832. module.exports = function (/*Buffer*/ input) {
  1833. var _entryHeader = new Headers.EntryHeader(),
  1834. _entryName = Buffer.alloc(0),
  1835. _comment = Buffer.alloc(0),
  1836. _isDirectory = false,
  1837. uncompressedData = null,
  1838. _extra = Buffer.alloc(0);
  1839. function getCompressedDataFromZip() {
  1840. if (!input || !Buffer.isBuffer(input)) {
  1841. return Buffer.alloc(0);
  1842. }
  1843. _entryHeader.loadDataHeaderFromBinary(input);
  1844. return input.slice(_entryHeader.realDataOffset, _entryHeader.realDataOffset + _entryHeader.compressedSize);
  1845. }
  1846. function crc32OK(data) {
  1847. // if bit 3 (0x08) of the general-purpose flags field is set, then the CRC-32 and file sizes are not known when the header is written
  1848. if ((_entryHeader.flags & 0x8) !== 0x8) {
  1849. if (Utils.crc32(data) !== _entryHeader.dataHeader.crc) {
  1850. return false;
  1851. }
  1852. } else {
  1853. // @TODO: load and check data descriptor header
  1854. // The fields in the local header are filled with zero, and the CRC-32 and size are appended in a 12-byte structure
  1855. // (optionally preceded by a 4-byte signature) immediately after the compressed data:
  1856. }
  1857. return true;
  1858. }
  1859. function decompress(/*Boolean*/ async, /*Function*/ callback, /*String, Buffer*/ pass) {
  1860. if (typeof callback === "undefined" && typeof async === "string") {
  1861. pass = async;
  1862. async = void 0;
  1863. }
  1864. if (_isDirectory) {
  1865. if (async && callback) {
  1866. callback(Buffer.alloc(0), Utils.Errors.DIRECTORY_CONTENT_ERROR); //si added error.
  1867. }
  1868. return Buffer.alloc(0);
  1869. }
  1870. var compressedData = getCompressedDataFromZip();
  1871. if (compressedData.length === 0) {
  1872. // File is empty, nothing to decompress.
  1873. if (async && callback) callback(compressedData);
  1874. return compressedData;
  1875. }
  1876. if (_entryHeader.encripted) {
  1877. if ("string" !== typeof pass && !Buffer.isBuffer(pass)) {
  1878. throw new Error("ADM-ZIP: Incompatible password parameter");
  1879. }
  1880. compressedData = Methods.ZipCrypto.decrypt(compressedData, _entryHeader, pass);
  1881. }
  1882. var data = Buffer.alloc(_entryHeader.size);
  1883. switch (_entryHeader.method) {
  1884. case Utils.Constants.STORED:
  1885. compressedData.copy(data);
  1886. if (!crc32OK(data)) {
  1887. if (async && callback) callback(data, Utils.Errors.BAD_CRC); //si added error
  1888. throw new Error(Utils.Errors.BAD_CRC);
  1889. } else {
  1890. //si added otherwise did not seem to return data.
  1891. if (async && callback) callback(data);
  1892. return data;
  1893. }
  1894. case Utils.Constants.DEFLATED:
  1895. var inflater = new Methods.Inflater(compressedData);
  1896. if (!async) {
  1897. const result = inflater.inflate(data);
  1898. result.copy(data, 0);
  1899. if (!crc32OK(data)) {
  1900. throw new Error(Utils.Errors.BAD_CRC + " " + _entryName.toString());
  1901. }
  1902. return data;
  1903. } else {
  1904. inflater.inflateAsync(function (result) {
  1905. result.copy(result, 0);
  1906. if (callback) {
  1907. if (!crc32OK(result)) {
  1908. callback(result, Utils.Errors.BAD_CRC); //si added error
  1909. } else {
  1910. callback(result);
  1911. }
  1912. }
  1913. });
  1914. }
  1915. break;
  1916. default:
  1917. if (async && callback) callback(Buffer.alloc(0), Utils.Errors.UNKNOWN_METHOD);
  1918. throw new Error(Utils.Errors.UNKNOWN_METHOD);
  1919. }
  1920. }
  1921. function compress(/*Boolean*/ async, /*Function*/ callback) {
  1922. if ((!uncompressedData || !uncompressedData.length) && Buffer.isBuffer(input)) {
  1923. // no data set or the data wasn't changed to require recompression
  1924. if (async && callback) callback(getCompressedDataFromZip());
  1925. return getCompressedDataFromZip();
  1926. }
  1927. if (uncompressedData.length && !_isDirectory) {
  1928. var compressedData;
  1929. // Local file header
  1930. switch (_entryHeader.method) {
  1931. case Utils.Constants.STORED:
  1932. _entryHeader.compressedSize = _entryHeader.size;
  1933. compressedData = Buffer.alloc(uncompressedData.length);
  1934. uncompressedData.copy(compressedData);
  1935. if (async && callback) callback(compressedData);
  1936. return compressedData;
  1937. default:
  1938. case Utils.Constants.DEFLATED:
  1939. var deflater = new Methods.Deflater(uncompressedData);
  1940. if (!async) {
  1941. var deflated = deflater.deflate();
  1942. _entryHeader.compressedSize = deflated.length;
  1943. return deflated;
  1944. } else {
  1945. deflater.deflateAsync(function (data) {
  1946. compressedData = Buffer.alloc(data.length);
  1947. _entryHeader.compressedSize = data.length;
  1948. data.copy(compressedData);
  1949. callback && callback(compressedData);
  1950. });
  1951. }
  1952. deflater = null;
  1953. break;
  1954. }
  1955. } else if (async && callback) {
  1956. callback(Buffer.alloc(0));
  1957. } else {
  1958. return Buffer.alloc(0);
  1959. }
  1960. }
  1961. function readUInt64LE(buffer, offset) {
  1962. return (buffer.readUInt32LE(offset + 4) << 4) + buffer.readUInt32LE(offset);
  1963. }
  1964. function parseExtra(data) {
  1965. var offset = 0;
  1966. var signature, size, part;
  1967. while (offset < data.length) {
  1968. signature = data.readUInt16LE(offset);
  1969. offset += 2;
  1970. size = data.readUInt16LE(offset);
  1971. offset += 2;
  1972. part = data.slice(offset, offset + size);
  1973. offset += size;
  1974. if (Constants.ID_ZIP64 === signature) {
  1975. parseZip64ExtendedInformation(part);
  1976. }
  1977. }
  1978. }
  1979. //Override header field values with values from the ZIP64 extra field
  1980. function parseZip64ExtendedInformation(data) {
  1981. var size, compressedSize, offset, diskNumStart;
  1982. if (data.length >= Constants.EF_ZIP64_SCOMP) {
  1983. size = readUInt64LE(data, Constants.EF_ZIP64_SUNCOMP);
  1984. if (_entryHeader.size === Constants.EF_ZIP64_OR_32) {
  1985. _entryHeader.size = size;
  1986. }
  1987. }
  1988. if (data.length >= Constants.EF_ZIP64_RHO) {
  1989. compressedSize = readUInt64LE(data, Constants.EF_ZIP64_SCOMP);
  1990. if (_entryHeader.compressedSize === Constants.EF_ZIP64_OR_32) {
  1991. _entryHeader.compressedSize = compressedSize;
  1992. }
  1993. }
  1994. if (data.length >= Constants.EF_ZIP64_DSN) {
  1995. offset = readUInt64LE(data, Constants.EF_ZIP64_RHO);
  1996. if (_entryHeader.offset === Constants.EF_ZIP64_OR_32) {
  1997. _entryHeader.offset = offset;
  1998. }
  1999. }
  2000. if (data.length >= Constants.EF_ZIP64_DSN + 4) {
  2001. diskNumStart = data.readUInt32LE(Constants.EF_ZIP64_DSN);
  2002. if (_entryHeader.diskNumStart === Constants.EF_ZIP64_OR_16) {
  2003. _entryHeader.diskNumStart = diskNumStart;
  2004. }
  2005. }
  2006. }
  2007. return {
  2008. get entryName() {
  2009. return _entryName.toString();
  2010. },
  2011. get rawEntryName() {
  2012. return _entryName;
  2013. },
  2014. set entryName(val) {
  2015. _entryName = Utils.toBuffer(val);
  2016. var lastChar = _entryName[_entryName.length - 1];
  2017. _isDirectory = lastChar === 47 || lastChar === 92;
  2018. _entryHeader.fileNameLength = _entryName.length;
  2019. },
  2020. get extra() {
  2021. return _extra;
  2022. },
  2023. set extra(val) {
  2024. _extra = val;
  2025. _entryHeader.extraLength = val.length;
  2026. parseExtra(val);
  2027. },
  2028. get comment() {
  2029. return _comment.toString();
  2030. },
  2031. set comment(val) {
  2032. _comment = Utils.toBuffer(val);
  2033. _entryHeader.commentLength = _comment.length;
  2034. },
  2035. get name() {
  2036. var n = _entryName.toString();
  2037. return _isDirectory
  2038. ? n
  2039. .substr(n.length - 1)
  2040. .split("/")
  2041. .pop()
  2042. : n.split("/").pop();
  2043. },
  2044. get isDirectory() {
  2045. return _isDirectory;
  2046. },
  2047. getCompressedData: function () {
  2048. return compress(false, null);
  2049. },
  2050. getCompressedDataAsync: function (/*Function*/ callback) {
  2051. compress(true, callback);
  2052. },
  2053. setData: function (value) {
  2054. uncompressedData = Utils.toBuffer(value);
  2055. if (!_isDirectory && uncompressedData.length) {
  2056. _entryHeader.size = uncompressedData.length;
  2057. _entryHeader.method = Utils.Constants.DEFLATED;
  2058. _entryHeader.crc = Utils.crc32(value);
  2059. _entryHeader.changed = true;
  2060. } else {
  2061. // folders and blank files should be stored
  2062. _entryHeader.method = Utils.Constants.STORED;
  2063. }
  2064. },
  2065. getData: function (pass) {
  2066. if (_entryHeader.changed) {
  2067. return uncompressedData;
  2068. } else {
  2069. return decompress(false, null, pass);
  2070. }
  2071. },
  2072. getDataAsync: function (/*Function*/ callback, pass) {
  2073. if (_entryHeader.changed) {
  2074. callback(uncompressedData);
  2075. } else {
  2076. decompress(true, callback, pass);
  2077. }
  2078. },
  2079. set attr(attr) {
  2080. _entryHeader.attr = attr;
  2081. },
  2082. get attr() {
  2083. return _entryHeader.attr;
  2084. },
  2085. set header(/*Buffer*/ data) {
  2086. _entryHeader.loadFromBinary(data);
  2087. },
  2088. get header() {
  2089. return _entryHeader;
  2090. },
  2091. packHeader: function () {
  2092. // 1. create header (buffer)
  2093. var header = _entryHeader.entryHeaderToBinary();
  2094. var addpos = Utils.Constants.CENHDR;
  2095. // 2. add file name
  2096. _entryName.copy(header, addpos);
  2097. addpos += _entryName.length;
  2098. // 3. add extra data
  2099. if (_entryHeader.extraLength) {
  2100. _extra.copy(header, addpos);
  2101. addpos += _entryHeader.extraLength;
  2102. }
  2103. // 4. add file comment
  2104. if (_entryHeader.commentLength) {
  2105. _comment.copy(header, addpos);
  2106. }
  2107. return header;
  2108. },
  2109. toJSON: function () {
  2110. const bytes = function (nr) {
  2111. return "<" + ((nr && nr.length + " bytes buffer") || "null") + ">";
  2112. };
  2113. return {
  2114. entryName: this.entryName,
  2115. name: this.name,
  2116. comment: this.comment,
  2117. isDirectory: this.isDirectory,
  2118. header: _entryHeader.toJSON(),
  2119. compressedData: bytes(input),
  2120. data: bytes(uncompressedData)
  2121. };
  2122. },
  2123. toString: function () {
  2124. return JSON.stringify(this.toJSON(), null, "\t");
  2125. }
  2126. };
  2127. };
  2128. /***/ }),
  2129. /***/ 56333:
  2130. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  2131. const ZipEntry = __webpack_require__(47396);
  2132. const Headers = __webpack_require__(53854);
  2133. const Utils = __webpack_require__(85173);
  2134. module.exports = function (/*Buffer|null*/ inBuffer, /** object */ options) {
  2135. var entryList = [],
  2136. entryTable = {},
  2137. _comment = Buffer.alloc(0),
  2138. mainHeader = new Headers.MainHeader(),
  2139. loadedEntries = false;
  2140. // assign options
  2141. const opts = Object.assign(Object.create(null), options);
  2142. const { noSort } = opts;
  2143. if (inBuffer) {
  2144. // is a memory buffer
  2145. readMainHeader(opts.readEntries);
  2146. } else {
  2147. // none. is a new file
  2148. loadedEntries = true;
  2149. }
  2150. function iterateEntries(callback) {
  2151. const totalEntries = mainHeader.diskEntries; // total number of entries
  2152. let index = mainHeader.offset; // offset of first CEN header
  2153. for (let i = 0; i < totalEntries; i++) {
  2154. let tmp = index;
  2155. const entry = new ZipEntry(inBuffer);
  2156. entry.header = inBuffer.slice(tmp, (tmp += Utils.Constants.CENHDR));
  2157. entry.entryName = inBuffer.slice(tmp, (tmp += entry.header.fileNameLength));
  2158. index += entry.header.entryHeaderSize;
  2159. callback(entry);
  2160. }
  2161. }
  2162. function readEntries() {
  2163. loadedEntries = true;
  2164. entryTable = {};
  2165. entryList = new Array(mainHeader.diskEntries); // total number of entries
  2166. var index = mainHeader.offset; // offset of first CEN header
  2167. for (var i = 0; i < entryList.length; i++) {
  2168. var tmp = index,
  2169. entry = new ZipEntry(inBuffer);
  2170. entry.header = inBuffer.slice(tmp, (tmp += Utils.Constants.CENHDR));
  2171. entry.entryName = inBuffer.slice(tmp, (tmp += entry.header.fileNameLength));
  2172. if (entry.header.extraLength) {
  2173. entry.extra = inBuffer.slice(tmp, (tmp += entry.header.extraLength));
  2174. }
  2175. if (entry.header.commentLength) entry.comment = inBuffer.slice(tmp, tmp + entry.header.commentLength);
  2176. index += entry.header.entryHeaderSize;
  2177. entryList[i] = entry;
  2178. entryTable[entry.entryName] = entry;
  2179. }
  2180. }
  2181. function readMainHeader(/*Boolean*/ readNow) {
  2182. var i = inBuffer.length - Utils.Constants.ENDHDR, // END header size
  2183. max = Math.max(0, i - 0xffff), // 0xFFFF is the max zip file comment length
  2184. n = max,
  2185. endStart = inBuffer.length,
  2186. endOffset = -1, // Start offset of the END header
  2187. commentEnd = 0;
  2188. for (i; i >= n; i--) {
  2189. if (inBuffer[i] !== 0x50) continue; // quick check that the byte is 'P'
  2190. if (inBuffer.readUInt32LE(i) === Utils.Constants.ENDSIG) {
  2191. // "PK\005\006"
  2192. endOffset = i;
  2193. commentEnd = i;
  2194. endStart = i + Utils.Constants.ENDHDR;
  2195. // We already found a regular signature, let's look just a bit further to check if there's any zip64 signature
  2196. n = i - Utils.Constants.END64HDR;
  2197. continue;
  2198. }
  2199. if (inBuffer.readUInt32LE(i) === Utils.Constants.END64SIG) {
  2200. // Found a zip64 signature, let's continue reading the whole zip64 record
  2201. n = max;
  2202. continue;
  2203. }
  2204. if (inBuffer.readUInt32LE(i) === Utils.Constants.ZIP64SIG) {
  2205. // Found the zip64 record, let's determine it's size
  2206. endOffset = i;
  2207. endStart = i + Utils.readBigUInt64LE(inBuffer, i + Utils.Constants.ZIP64SIZE) + Utils.Constants.ZIP64LEAD;
  2208. break;
  2209. }
  2210. }
  2211. if (!~endOffset) throw new Error(Utils.Errors.INVALID_FORMAT);
  2212. mainHeader.loadFromBinary(inBuffer.slice(endOffset, endStart));
  2213. if (mainHeader.commentLength) {
  2214. _comment = inBuffer.slice(commentEnd + Utils.Constants.ENDHDR);
  2215. }
  2216. if (readNow) readEntries();
  2217. }
  2218. function sortEntries() {
  2219. if (entryList.length > 1 && !noSort) {
  2220. entryList.sort((a, b) => a.entryName.toLowerCase().localeCompare(b.entryName.toLowerCase()));
  2221. }
  2222. }
  2223. return {
  2224. /**
  2225. * Returns an array of ZipEntry objects existent in the current opened archive
  2226. * @return Array
  2227. */
  2228. get entries() {
  2229. if (!loadedEntries) {
  2230. readEntries();
  2231. }
  2232. return entryList;
  2233. },
  2234. /**
  2235. * Archive comment
  2236. * @return {String}
  2237. */
  2238. get comment() {
  2239. return _comment.toString();
  2240. },
  2241. set comment(val) {
  2242. _comment = Utils.toBuffer(val);
  2243. mainHeader.commentLength = _comment.length;
  2244. },
  2245. getEntryCount: function () {
  2246. if (!loadedEntries) {
  2247. return mainHeader.diskEntries;
  2248. }
  2249. return entryList.length;
  2250. },
  2251. forEach: function (callback) {
  2252. if (!loadedEntries) {
  2253. iterateEntries(callback);
  2254. return;
  2255. }
  2256. entryList.forEach(callback);
  2257. },
  2258. /**
  2259. * Returns a reference to the entry with the given name or null if entry is inexistent
  2260. *
  2261. * @param entryName
  2262. * @return ZipEntry
  2263. */
  2264. getEntry: function (/*String*/ entryName) {
  2265. if (!loadedEntries) {
  2266. readEntries();
  2267. }
  2268. return entryTable[entryName] || null;
  2269. },
  2270. /**
  2271. * Adds the given entry to the entry list
  2272. *
  2273. * @param entry
  2274. */
  2275. setEntry: function (/*ZipEntry*/ entry) {
  2276. if (!loadedEntries) {
  2277. readEntries();
  2278. }
  2279. entryList.push(entry);
  2280. entryTable[entry.entryName] = entry;
  2281. mainHeader.totalEntries = entryList.length;
  2282. },
  2283. /**
  2284. * Removes the entry with the given name from the entry list.
  2285. *
  2286. * If the entry is a directory, then all nested files and directories will be removed
  2287. * @param entryName
  2288. */
  2289. deleteEntry: function (/*String*/ entryName) {
  2290. if (!loadedEntries) {
  2291. readEntries();
  2292. }
  2293. var entry = entryTable[entryName];
  2294. if (entry && entry.isDirectory) {
  2295. var _self = this;
  2296. this.getEntryChildren(entry).forEach(function (child) {
  2297. if (child.entryName !== entryName) {
  2298. _self.deleteEntry(child.entryName);
  2299. }
  2300. });
  2301. }
  2302. entryList.splice(entryList.indexOf(entry), 1);
  2303. delete entryTable[entryName];
  2304. mainHeader.totalEntries = entryList.length;
  2305. },
  2306. /**
  2307. * Iterates and returns all nested files and directories of the given entry
  2308. *
  2309. * @param entry
  2310. * @return Array
  2311. */
  2312. getEntryChildren: function (/*ZipEntry*/ entry) {
  2313. if (!loadedEntries) {
  2314. readEntries();
  2315. }
  2316. if (entry && entry.isDirectory) {
  2317. const list = [];
  2318. const name = entry.entryName;
  2319. const len = name.length;
  2320. entryList.forEach(function (zipEntry) {
  2321. if (zipEntry.entryName.substr(0, len) === name) {
  2322. list.push(zipEntry);
  2323. }
  2324. });
  2325. return list;
  2326. }
  2327. return [];
  2328. },
  2329. /**
  2330. * Returns the zip file
  2331. *
  2332. * @return Buffer
  2333. */
  2334. compressToBuffer: function () {
  2335. if (!loadedEntries) {
  2336. readEntries();
  2337. }
  2338. sortEntries();
  2339. const dataBlock = [];
  2340. const entryHeaders = [];
  2341. let totalSize = 0;
  2342. let dindex = 0;
  2343. mainHeader.size = 0;
  2344. mainHeader.offset = 0;
  2345. for (const entry of entryList) {
  2346. // compress data and set local and entry header accordingly. Reason why is called first
  2347. const compressedData = entry.getCompressedData();
  2348. // 1. construct data header
  2349. entry.header.offset = dindex;
  2350. const dataHeader = entry.header.dataHeaderToBinary();
  2351. const entryNameLen = entry.rawEntryName.length;
  2352. // 1.2. postheader - data after data header
  2353. const postHeader = Buffer.alloc(entryNameLen + entry.extra.length);
  2354. entry.rawEntryName.copy(postHeader, 0);
  2355. postHeader.copy(entry.extra, entryNameLen);
  2356. // 2. offsets
  2357. const dataLength = dataHeader.length + postHeader.length + compressedData.length;
  2358. dindex += dataLength;
  2359. // 3. store values in sequence
  2360. dataBlock.push(dataHeader);
  2361. dataBlock.push(postHeader);
  2362. dataBlock.push(compressedData);
  2363. // 4. construct entry header
  2364. const entryHeader = entry.packHeader();
  2365. entryHeaders.push(entryHeader);
  2366. // 5. update main header
  2367. mainHeader.size += entryHeader.length;
  2368. totalSize += dataLength + entryHeader.length;
  2369. }
  2370. totalSize += mainHeader.mainHeaderSize; // also includes zip file comment length
  2371. // point to end of data and beginning of central directory first record
  2372. mainHeader.offset = dindex;
  2373. dindex = 0;
  2374. const outBuffer = Buffer.alloc(totalSize);
  2375. // write data blocks
  2376. for (const content of dataBlock) {
  2377. content.copy(outBuffer, dindex);
  2378. dindex += content.length;
  2379. }
  2380. // write central directory entries
  2381. for (const content of entryHeaders) {
  2382. content.copy(outBuffer, dindex);
  2383. dindex += content.length;
  2384. }
  2385. // write main header
  2386. const mh = mainHeader.toBinary();
  2387. if (_comment) {
  2388. _comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment
  2389. }
  2390. mh.copy(outBuffer, dindex);
  2391. return outBuffer;
  2392. },
  2393. toAsyncBuffer: function (/*Function*/ onSuccess, /*Function*/ onFail, /*Function*/ onItemStart, /*Function*/ onItemEnd) {
  2394. try {
  2395. if (!loadedEntries) {
  2396. readEntries();
  2397. }
  2398. sortEntries();
  2399. const dataBlock = [];
  2400. const entryHeaders = [];
  2401. let totalSize = 0;
  2402. let dindex = 0;
  2403. mainHeader.size = 0;
  2404. mainHeader.offset = 0;
  2405. const compress2Buffer = function (entryLists) {
  2406. if (entryLists.length) {
  2407. const entry = entryLists.pop();
  2408. const name = entry.entryName + entry.extra.toString();
  2409. if (onItemStart) onItemStart(name);
  2410. entry.getCompressedDataAsync(function (compressedData) {
  2411. if (onItemEnd) onItemEnd(name);
  2412. entry.header.offset = dindex;
  2413. // data header
  2414. const dataHeader = entry.header.dataHeaderToBinary();
  2415. const postHeader = Buffer.alloc(name.length, name);
  2416. const dataLength = dataHeader.length + postHeader.length + compressedData.length;
  2417. dindex += dataLength;
  2418. dataBlock.push(dataHeader);
  2419. dataBlock.push(postHeader);
  2420. dataBlock.push(compressedData);
  2421. const entryHeader = entry.packHeader();
  2422. entryHeaders.push(entryHeader);
  2423. mainHeader.size += entryHeader.length;
  2424. totalSize += dataLength + entryHeader.length;
  2425. compress2Buffer(entryLists);
  2426. });
  2427. } else {
  2428. totalSize += mainHeader.mainHeaderSize; // also includes zip file comment length
  2429. // point to end of data and beginning of central directory first record
  2430. mainHeader.offset = dindex;
  2431. dindex = 0;
  2432. const outBuffer = Buffer.alloc(totalSize);
  2433. dataBlock.forEach(function (content) {
  2434. content.copy(outBuffer, dindex); // write data blocks
  2435. dindex += content.length;
  2436. });
  2437. entryHeaders.forEach(function (content) {
  2438. content.copy(outBuffer, dindex); // write central directory entries
  2439. dindex += content.length;
  2440. });
  2441. const mh = mainHeader.toBinary();
  2442. if (_comment) {
  2443. _comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment
  2444. }
  2445. mh.copy(outBuffer, dindex); // write main header
  2446. onSuccess(outBuffer);
  2447. }
  2448. };
  2449. compress2Buffer(entryList);
  2450. } catch (e) {
  2451. onFail(e);
  2452. }
  2453. }
  2454. };
  2455. };
  2456. /***/ }),
  2457. /***/ 9668:
  2458. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  2459. "use strict";
  2460. const { Buffer } = __webpack_require__(64293)
  2461. const symbol = Symbol.for('BufferList')
  2462. function BufferList (buf) {
  2463. if (!(this instanceof BufferList)) {
  2464. return new BufferList(buf)
  2465. }
  2466. BufferList._init.call(this, buf)
  2467. }
  2468. BufferList._init = function _init (buf) {
  2469. Object.defineProperty(this, symbol, { value: true })
  2470. this._bufs = []
  2471. this.length = 0
  2472. if (buf) {
  2473. this.append(buf)
  2474. }
  2475. }
  2476. BufferList.prototype._new = function _new (buf) {
  2477. return new BufferList(buf)
  2478. }
  2479. BufferList.prototype._offset = function _offset (offset) {
  2480. if (offset === 0) {
  2481. return [0, 0]
  2482. }
  2483. let tot = 0
  2484. for (let i = 0; i < this._bufs.length; i++) {
  2485. const _t = tot + this._bufs[i].length
  2486. if (offset < _t || i === this._bufs.length - 1) {
  2487. return [i, offset - tot]
  2488. }
  2489. tot = _t
  2490. }
  2491. }
  2492. BufferList.prototype._reverseOffset = function (blOffset) {
  2493. const bufferId = blOffset[0]
  2494. let offset = blOffset[1]
  2495. for (let i = 0; i < bufferId; i++) {
  2496. offset += this._bufs[i].length
  2497. }
  2498. return offset
  2499. }
  2500. BufferList.prototype.get = function get (index) {
  2501. if (index > this.length || index < 0) {
  2502. return undefined
  2503. }
  2504. const offset = this._offset(index)
  2505. return this._bufs[offset[0]][offset[1]]
  2506. }
  2507. BufferList.prototype.slice = function slice (start, end) {
  2508. if (typeof start === 'number' && start < 0) {
  2509. start += this.length
  2510. }
  2511. if (typeof end === 'number' && end < 0) {
  2512. end += this.length
  2513. }
  2514. return this.copy(null, 0, start, end)
  2515. }
  2516. BufferList.prototype.copy = function copy (dst, dstStart, srcStart, srcEnd) {
  2517. if (typeof srcStart !== 'number' || srcStart < 0) {
  2518. srcStart = 0
  2519. }
  2520. if (typeof srcEnd !== 'number' || srcEnd > this.length) {
  2521. srcEnd = this.length
  2522. }
  2523. if (srcStart >= this.length) {
  2524. return dst || Buffer.alloc(0)
  2525. }
  2526. if (srcEnd <= 0) {
  2527. return dst || Buffer.alloc(0)
  2528. }
  2529. const copy = !!dst
  2530. const off = this._offset(srcStart)
  2531. const len = srcEnd - srcStart
  2532. let bytes = len
  2533. let bufoff = (copy && dstStart) || 0
  2534. let start = off[1]
  2535. // copy/slice everything
  2536. if (srcStart === 0 && srcEnd === this.length) {
  2537. if (!copy) {
  2538. // slice, but full concat if multiple buffers
  2539. return this._bufs.length === 1
  2540. ? this._bufs[0]
  2541. : Buffer.concat(this._bufs, this.length)
  2542. }
  2543. // copy, need to copy individual buffers
  2544. for (let i = 0; i < this._bufs.length; i++) {
  2545. this._bufs[i].copy(dst, bufoff)
  2546. bufoff += this._bufs[i].length
  2547. }
  2548. return dst
  2549. }
  2550. // easy, cheap case where it's a subset of one of the buffers
  2551. if (bytes <= this._bufs[off[0]].length - start) {
  2552. return copy
  2553. ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes)
  2554. : this._bufs[off[0]].slice(start, start + bytes)
  2555. }
  2556. if (!copy) {
  2557. // a slice, we need something to copy in to
  2558. dst = Buffer.allocUnsafe(len)
  2559. }
  2560. for (let i = off[0]; i < this._bufs.length; i++) {
  2561. const l = this._bufs[i].length - start
  2562. if (bytes > l) {
  2563. this._bufs[i].copy(dst, bufoff, start)
  2564. bufoff += l
  2565. } else {
  2566. this._bufs[i].copy(dst, bufoff, start, start + bytes)
  2567. bufoff += l
  2568. break
  2569. }
  2570. bytes -= l
  2571. if (start) {
  2572. start = 0
  2573. }
  2574. }
  2575. // safeguard so that we don't return uninitialized memory
  2576. if (dst.length > bufoff) return dst.slice(0, bufoff)
  2577. return dst
  2578. }
  2579. BufferList.prototype.shallowSlice = function shallowSlice (start, end) {
  2580. start = start || 0
  2581. end = typeof end !== 'number' ? this.length : end
  2582. if (start < 0) {
  2583. start += this.length
  2584. }
  2585. if (end < 0) {
  2586. end += this.length
  2587. }
  2588. if (start === end) {
  2589. return this._new()
  2590. }
  2591. const startOffset = this._offset(start)
  2592. const endOffset = this._offset(end)
  2593. const buffers = this._bufs.slice(startOffset[0], endOffset[0] + 1)
  2594. if (endOffset[1] === 0) {
  2595. buffers.pop()
  2596. } else {
  2597. buffers[buffers.length - 1] = buffers[buffers.length - 1].slice(0, endOffset[1])
  2598. }
  2599. if (startOffset[1] !== 0) {
  2600. buffers[0] = buffers[0].slice(startOffset[1])
  2601. }
  2602. return this._new(buffers)
  2603. }
  2604. BufferList.prototype.toString = function toString (encoding, start, end) {
  2605. return this.slice(start, end).toString(encoding)
  2606. }
  2607. BufferList.prototype.consume = function consume (bytes) {
  2608. // first, normalize the argument, in accordance with how Buffer does it
  2609. bytes = Math.trunc(bytes)
  2610. // do nothing if not a positive number
  2611. if (Number.isNaN(bytes) || bytes <= 0) return this
  2612. while (this._bufs.length) {
  2613. if (bytes >= this._bufs[0].length) {
  2614. bytes -= this._bufs[0].length
  2615. this.length -= this._bufs[0].length
  2616. this._bufs.shift()
  2617. } else {
  2618. this._bufs[0] = this._bufs[0].slice(bytes)
  2619. this.length -= bytes
  2620. break
  2621. }
  2622. }
  2623. return this
  2624. }
  2625. BufferList.prototype.duplicate = function duplicate () {
  2626. const copy = this._new()
  2627. for (let i = 0; i < this._bufs.length; i++) {
  2628. copy.append(this._bufs[i])
  2629. }
  2630. return copy
  2631. }
  2632. BufferList.prototype.append = function append (buf) {
  2633. if (buf == null) {
  2634. return this
  2635. }
  2636. if (buf.buffer) {
  2637. // append a view of the underlying ArrayBuffer
  2638. this._appendBuffer(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength))
  2639. } else if (Array.isArray(buf)) {
  2640. for (let i = 0; i < buf.length; i++) {
  2641. this.append(buf[i])
  2642. }
  2643. } else if (this._isBufferList(buf)) {
  2644. // unwrap argument into individual BufferLists
  2645. for (let i = 0; i < buf._bufs.length; i++) {
  2646. this.append(buf._bufs[i])
  2647. }
  2648. } else {
  2649. // coerce number arguments to strings, since Buffer(number) does
  2650. // uninitialized memory allocation
  2651. if (typeof buf === 'number') {
  2652. buf = buf.toString()
  2653. }
  2654. this._appendBuffer(Buffer.from(buf))
  2655. }
  2656. return this
  2657. }
  2658. BufferList.prototype._appendBuffer = function appendBuffer (buf) {
  2659. this._bufs.push(buf)
  2660. this.length += buf.length
  2661. }
  2662. BufferList.prototype.indexOf = function (search, offset, encoding) {
  2663. if (encoding === undefined && typeof offset === 'string') {
  2664. encoding = offset
  2665. offset = undefined
  2666. }
  2667. if (typeof search === 'function' || Array.isArray(search)) {
  2668. throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.')
  2669. } else if (typeof search === 'number') {
  2670. search = Buffer.from([search])
  2671. } else if (typeof search === 'string') {
  2672. search = Buffer.from(search, encoding)
  2673. } else if (this._isBufferList(search)) {
  2674. search = search.slice()
  2675. } else if (Array.isArray(search.buffer)) {
  2676. search = Buffer.from(search.buffer, search.byteOffset, search.byteLength)
  2677. } else if (!Buffer.isBuffer(search)) {
  2678. search = Buffer.from(search)
  2679. }
  2680. offset = Number(offset || 0)
  2681. if (isNaN(offset)) {
  2682. offset = 0
  2683. }
  2684. if (offset < 0) {
  2685. offset = this.length + offset
  2686. }
  2687. if (offset < 0) {
  2688. offset = 0
  2689. }
  2690. if (search.length === 0) {
  2691. return offset > this.length ? this.length : offset
  2692. }
  2693. const blOffset = this._offset(offset)
  2694. let blIndex = blOffset[0] // index of which internal buffer we're working on
  2695. let buffOffset = blOffset[1] // offset of the internal buffer we're working on
  2696. // scan over each buffer
  2697. for (; blIndex < this._bufs.length; blIndex++) {
  2698. const buff = this._bufs[blIndex]
  2699. while (buffOffset < buff.length) {
  2700. const availableWindow = buff.length - buffOffset
  2701. if (availableWindow >= search.length) {
  2702. const nativeSearchResult = buff.indexOf(search, buffOffset)
  2703. if (nativeSearchResult !== -1) {
  2704. return this._reverseOffset([blIndex, nativeSearchResult])
  2705. }
  2706. buffOffset = buff.length - search.length + 1 // end of native search window
  2707. } else {
  2708. const revOffset = this._reverseOffset([blIndex, buffOffset])
  2709. if (this._match(revOffset, search)) {
  2710. return revOffset
  2711. }
  2712. buffOffset++
  2713. }
  2714. }
  2715. buffOffset = 0
  2716. }
  2717. return -1
  2718. }
  2719. BufferList.prototype._match = function (offset, search) {
  2720. if (this.length - offset < search.length) {
  2721. return false
  2722. }
  2723. for (let searchOffset = 0; searchOffset < search.length; searchOffset++) {
  2724. if (this.get(offset + searchOffset) !== search[searchOffset]) {
  2725. return false
  2726. }
  2727. }
  2728. return true
  2729. }
  2730. ;(function () {
  2731. const methods = {
  2732. readDoubleBE: 8,
  2733. readDoubleLE: 8,
  2734. readFloatBE: 4,
  2735. readFloatLE: 4,
  2736. readInt32BE: 4,
  2737. readInt32LE: 4,
  2738. readUInt32BE: 4,
  2739. readUInt32LE: 4,
  2740. readInt16BE: 2,
  2741. readInt16LE: 2,
  2742. readUInt16BE: 2,
  2743. readUInt16LE: 2,
  2744. readInt8: 1,
  2745. readUInt8: 1,
  2746. readIntBE: null,
  2747. readIntLE: null,
  2748. readUIntBE: null,
  2749. readUIntLE: null
  2750. }
  2751. for (const m in methods) {
  2752. (function (m) {
  2753. if (methods[m] === null) {
  2754. BufferList.prototype[m] = function (offset, byteLength) {
  2755. return this.slice(offset, offset + byteLength)[m](0, byteLength)
  2756. }
  2757. } else {
  2758. BufferList.prototype[m] = function (offset = 0) {
  2759. return this.slice(offset, offset + methods[m])[m](0)
  2760. }
  2761. }
  2762. }(m))
  2763. }
  2764. }())
  2765. // Used internally by the class and also as an indicator of this object being
  2766. // a `BufferList`. It's not possible to use `instanceof BufferList` in a browser
  2767. // environment because there could be multiple different copies of the
  2768. // BufferList class and some `BufferList`s might be `BufferList`s.
  2769. BufferList.prototype._isBufferList = function _isBufferList (b) {
  2770. return b instanceof BufferList || BufferList.isBufferList(b)
  2771. }
  2772. BufferList.isBufferList = function isBufferList (b) {
  2773. return b != null && b[symbol]
  2774. }
  2775. module.exports = BufferList
  2776. /***/ }),
  2777. /***/ 10022:
  2778. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  2779. "use strict";
  2780. const DuplexStream = __webpack_require__(11451).Duplex
  2781. const inherits = __webpack_require__(94378)
  2782. const BufferList = __webpack_require__(9668)
  2783. function BufferListStream (callback) {
  2784. if (!(this instanceof BufferListStream)) {
  2785. return new BufferListStream(callback)
  2786. }
  2787. if (typeof callback === 'function') {
  2788. this._callback = callback
  2789. const piper = function piper (err) {
  2790. if (this._callback) {
  2791. this._callback(err)
  2792. this._callback = null
  2793. }
  2794. }.bind(this)
  2795. this.on('pipe', function onPipe (src) {
  2796. src.on('error', piper)
  2797. })
  2798. this.on('unpipe', function onUnpipe (src) {
  2799. src.removeListener('error', piper)
  2800. })
  2801. callback = null
  2802. }
  2803. BufferList._init.call(this, callback)
  2804. DuplexStream.call(this)
  2805. }
  2806. inherits(BufferListStream, DuplexStream)
  2807. Object.assign(BufferListStream.prototype, BufferList.prototype)
  2808. BufferListStream.prototype._new = function _new (callback) {
  2809. return new BufferListStream(callback)
  2810. }
  2811. BufferListStream.prototype._write = function _write (buf, encoding, callback) {
  2812. this._appendBuffer(buf)
  2813. if (typeof callback === 'function') {
  2814. callback()
  2815. }
  2816. }
  2817. BufferListStream.prototype._read = function _read (size) {
  2818. if (!this.length) {
  2819. return this.push(null)
  2820. }
  2821. size = Math.min(size, this.length)
  2822. this.push(this.slice(0, size))
  2823. this.consume(size)
  2824. }
  2825. BufferListStream.prototype.end = function end (chunk) {
  2826. DuplexStream.prototype.end.call(this, chunk)
  2827. if (this._callback) {
  2828. this._callback(null, this.slice())
  2829. this._callback = null
  2830. }
  2831. }
  2832. BufferListStream.prototype._destroy = function _destroy (err, cb) {
  2833. this._bufs.length = 0
  2834. this.length = 0
  2835. cb(err)
  2836. }
  2837. BufferListStream.prototype._isBufferList = function _isBufferList (b) {
  2838. return b instanceof BufferListStream || b instanceof BufferList || BufferListStream.isBufferList(b)
  2839. }
  2840. BufferListStream.isBufferList = BufferList.isBufferList
  2841. module.exports = BufferListStream
  2842. module.exports.BufferListStream = BufferListStream
  2843. module.exports.BufferList = BufferList
  2844. /***/ }),
  2845. /***/ 94378:
  2846. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  2847. try {
  2848. var util = __webpack_require__(31669);
  2849. /* istanbul ignore next */
  2850. if (typeof util.inherits !== 'function') throw '';
  2851. module.exports = util.inherits;
  2852. } catch (e) {
  2853. /* istanbul ignore next */
  2854. module.exports = __webpack_require__(35717);
  2855. }
  2856. /***/ }),
  2857. /***/ 35717:
  2858. /***/ ((module) => {
  2859. if (typeof Object.create === 'function') {
  2860. // implementation from standard node.js 'util' module
  2861. module.exports = function inherits(ctor, superCtor) {
  2862. if (superCtor) {
  2863. ctor.super_ = superCtor
  2864. ctor.prototype = Object.create(superCtor.prototype, {
  2865. constructor: {
  2866. value: ctor,
  2867. enumerable: false,
  2868. writable: true,
  2869. configurable: true
  2870. }
  2871. })
  2872. }
  2873. };
  2874. } else {
  2875. // old school shim for old browsers
  2876. module.exports = function inherits(ctor, superCtor) {
  2877. if (superCtor) {
  2878. ctor.super_ = superCtor
  2879. var TempCtor = function () {}
  2880. TempCtor.prototype = superCtor.prototype
  2881. ctor.prototype = new TempCtor()
  2882. ctor.prototype.constructor = ctor
  2883. }
  2884. }
  2885. }
  2886. /***/ }),
  2887. /***/ 4012:
  2888. /***/ ((module) => {
  2889. "use strict";
  2890. const codes = {};
  2891. function createErrorType(code, message, Base) {
  2892. if (!Base) {
  2893. Base = Error
  2894. }
  2895. function getMessage (arg1, arg2, arg3) {
  2896. if (typeof message === 'string') {
  2897. return message
  2898. } else {
  2899. return message(arg1, arg2, arg3)
  2900. }
  2901. }
  2902. class NodeError extends Base {
  2903. constructor (arg1, arg2, arg3) {
  2904. super(getMessage(arg1, arg2, arg3));
  2905. }
  2906. }
  2907. NodeError.prototype.name = Base.name;
  2908. NodeError.prototype.code = code;
  2909. codes[code] = NodeError;
  2910. }
  2911. // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
  2912. function oneOf(expected, thing) {
  2913. if (Array.isArray(expected)) {
  2914. const len = expected.length;
  2915. expected = expected.map((i) => String(i));
  2916. if (len > 2) {
  2917. return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` +
  2918. expected[len - 1];
  2919. } else if (len === 2) {
  2920. return `one of ${thing} ${expected[0]} or ${expected[1]}`;
  2921. } else {
  2922. return `of ${thing} ${expected[0]}`;
  2923. }
  2924. } else {
  2925. return `of ${thing} ${String(expected)}`;
  2926. }
  2927. }
  2928. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
  2929. function startsWith(str, search, pos) {
  2930. return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
  2931. }
  2932. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
  2933. function endsWith(str, search, this_len) {
  2934. if (this_len === undefined || this_len > str.length) {
  2935. this_len = str.length;
  2936. }
  2937. return str.substring(this_len - search.length, this_len) === search;
  2938. }
  2939. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
  2940. function includes(str, search, start) {
  2941. if (typeof start !== 'number') {
  2942. start = 0;
  2943. }
  2944. if (start + search.length > str.length) {
  2945. return false;
  2946. } else {
  2947. return str.indexOf(search, start) !== -1;
  2948. }
  2949. }
  2950. createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {
  2951. return 'The value "' + value + '" is invalid for option "' + name + '"'
  2952. }, TypeError);
  2953. createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
  2954. // determiner: 'must be' or 'must not be'
  2955. let determiner;
  2956. if (typeof expected === 'string' && startsWith(expected, 'not ')) {
  2957. determiner = 'must not be';
  2958. expected = expected.replace(/^not /, '');
  2959. } else {
  2960. determiner = 'must be';
  2961. }
  2962. let msg;
  2963. if (endsWith(name, ' argument')) {
  2964. // For cases like 'first argument'
  2965. msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`;
  2966. } else {
  2967. const type = includes(name, '.') ? 'property' : 'argument';
  2968. msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`;
  2969. }
  2970. msg += `. Received type ${typeof actual}`;
  2971. return msg;
  2972. }, TypeError);
  2973. createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');
  2974. createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {
  2975. return 'The ' + name + ' method is not implemented'
  2976. });
  2977. createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');
  2978. createErrorType('ERR_STREAM_DESTROYED', function (name) {
  2979. return 'Cannot call ' + name + ' after a stream was destroyed';
  2980. });
  2981. createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');
  2982. createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');
  2983. createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');
  2984. createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);
  2985. createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
  2986. return 'Unknown encoding: ' + arg
  2987. }, TypeError);
  2988. createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
  2989. module.exports.q = codes;
  2990. /***/ }),
  2991. /***/ 56753:
  2992. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  2993. "use strict";
  2994. // Copyright Joyent, Inc. and other Node contributors.
  2995. //
  2996. // Permission is hereby granted, free of charge, to any person obtaining a
  2997. // copy of this software and associated documentation files (the
  2998. // "Software"), to deal in the Software without restriction, including
  2999. // without limitation the rights to use, copy, modify, merge, publish,
  3000. // distribute, sublicense, and/or sell copies of the Software, and to permit
  3001. // persons to whom the Software is furnished to do so, subject to the
  3002. // following conditions:
  3003. //
  3004. // The above copyright notice and this permission notice shall be included
  3005. // in all copies or substantial portions of the Software.
  3006. //
  3007. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  3008. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  3009. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  3010. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  3011. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  3012. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  3013. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  3014. // a duplex stream is just a stream that is both readable and writable.
  3015. // Since JS doesn't have multiple prototypal inheritance, this class
  3016. // prototypally inherits from Readable, and then parasitically from
  3017. // Writable.
  3018. /*<replacement>*/
  3019. var objectKeys = Object.keys || function (obj) {
  3020. var keys = [];
  3021. for (var key in obj) {
  3022. keys.push(key);
  3023. }
  3024. return keys;
  3025. };
  3026. /*</replacement>*/
  3027. module.exports = Duplex;
  3028. var Readable = __webpack_require__(79481);
  3029. var Writable = __webpack_require__(64229);
  3030. __webpack_require__(94378)(Duplex, Readable);
  3031. {
  3032. // Allow the keys array to be GC'ed.
  3033. var keys = objectKeys(Writable.prototype);
  3034. for (var v = 0; v < keys.length; v++) {
  3035. var method = keys[v];
  3036. if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
  3037. }
  3038. }
  3039. function Duplex(options) {
  3040. if (!(this instanceof Duplex)) return new Duplex(options);
  3041. Readable.call(this, options);
  3042. Writable.call(this, options);
  3043. this.allowHalfOpen = true;
  3044. if (options) {
  3045. if (options.readable === false) this.readable = false;
  3046. if (options.writable === false) this.writable = false;
  3047. if (options.allowHalfOpen === false) {
  3048. this.allowHalfOpen = false;
  3049. this.once('end', onend);
  3050. }
  3051. }
  3052. }
  3053. Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
  3054. // making it explicit this property is not enumerable
  3055. // because otherwise some prototype manipulation in
  3056. // userland will fail
  3057. enumerable: false,
  3058. get: function get() {
  3059. return this._writableState.highWaterMark;
  3060. }
  3061. });
  3062. Object.defineProperty(Duplex.prototype, 'writableBuffer', {
  3063. // making it explicit this property is not enumerable
  3064. // because otherwise some prototype manipulation in
  3065. // userland will fail
  3066. enumerable: false,
  3067. get: function get() {
  3068. return this._writableState && this._writableState.getBuffer();
  3069. }
  3070. });
  3071. Object.defineProperty(Duplex.prototype, 'writableLength', {
  3072. // making it explicit this property is not enumerable
  3073. // because otherwise some prototype manipulation in
  3074. // userland will fail
  3075. enumerable: false,
  3076. get: function get() {
  3077. return this._writableState.length;
  3078. }
  3079. }); // the no-half-open enforcer
  3080. function onend() {
  3081. // If the writable side ended, then we're ok.
  3082. if (this._writableState.ended) return; // no more data can be written.
  3083. // But allow more writes to happen in this tick.
  3084. process.nextTick(onEndNT, this);
  3085. }
  3086. function onEndNT(self) {
  3087. self.end();
  3088. }
  3089. Object.defineProperty(Duplex.prototype, 'destroyed', {
  3090. // making it explicit this property is not enumerable
  3091. // because otherwise some prototype manipulation in
  3092. // userland will fail
  3093. enumerable: false,
  3094. get: function get() {
  3095. if (this._readableState === undefined || this._writableState === undefined) {
  3096. return false;
  3097. }
  3098. return this._readableState.destroyed && this._writableState.destroyed;
  3099. },
  3100. set: function set(value) {
  3101. // we ignore the value if the stream
  3102. // has not been initialized yet
  3103. if (this._readableState === undefined || this._writableState === undefined) {
  3104. return;
  3105. } // backward compatibility, the user is explicitly
  3106. // managing destroyed
  3107. this._readableState.destroyed = value;
  3108. this._writableState.destroyed = value;
  3109. }
  3110. });
  3111. /***/ }),
  3112. /***/ 82725:
  3113. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  3114. "use strict";
  3115. // Copyright Joyent, Inc. and other Node contributors.
  3116. //
  3117. // Permission is hereby granted, free of charge, to any person obtaining a
  3118. // copy of this software and associated documentation files (the
  3119. // "Software"), to deal in the Software without restriction, including
  3120. // without limitation the rights to use, copy, modify, merge, publish,
  3121. // distribute, sublicense, and/or sell copies of the Software, and to permit
  3122. // persons to whom the Software is furnished to do so, subject to the
  3123. // following conditions:
  3124. //
  3125. // The above copyright notice and this permission notice shall be included
  3126. // in all copies or substantial portions of the Software.
  3127. //
  3128. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  3129. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  3130. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  3131. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  3132. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  3133. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  3134. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  3135. // a passthrough stream.
  3136. // basically just the most minimal sort of Transform stream.
  3137. // Every written chunk gets output as-is.
  3138. module.exports = PassThrough;
  3139. var Transform = __webpack_require__(74605);
  3140. __webpack_require__(94378)(PassThrough, Transform);
  3141. function PassThrough(options) {
  3142. if (!(this instanceof PassThrough)) return new PassThrough(options);
  3143. Transform.call(this, options);
  3144. }
  3145. PassThrough.prototype._transform = function (chunk, encoding, cb) {
  3146. cb(null, chunk);
  3147. };
  3148. /***/ }),
  3149. /***/ 79481:
  3150. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  3151. "use strict";
  3152. // Copyright Joyent, Inc. and other Node contributors.
  3153. //
  3154. // Permission is hereby granted, free of charge, to any person obtaining a
  3155. // copy of this software and associated documentation files (the
  3156. // "Software"), to deal in the Software without restriction, including
  3157. // without limitation the rights to use, copy, modify, merge, publish,
  3158. // distribute, sublicense, and/or sell copies of the Software, and to permit
  3159. // persons to whom the Software is furnished to do so, subject to the
  3160. // following conditions:
  3161. //
  3162. // The above copyright notice and this permission notice shall be included
  3163. // in all copies or substantial portions of the Software.
  3164. //
  3165. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  3166. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  3167. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  3168. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  3169. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  3170. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  3171. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  3172. module.exports = Readable;
  3173. /*<replacement>*/
  3174. var Duplex;
  3175. /*</replacement>*/
  3176. Readable.ReadableState = ReadableState;
  3177. /*<replacement>*/
  3178. var EE = __webpack_require__(28614).EventEmitter;
  3179. var EElistenerCount = function EElistenerCount(emitter, type) {
  3180. return emitter.listeners(type).length;
  3181. };
  3182. /*</replacement>*/
  3183. /*<replacement>*/
  3184. var Stream = __webpack_require__(79740);
  3185. /*</replacement>*/
  3186. var Buffer = __webpack_require__(64293).Buffer;
  3187. var OurUint8Array = global.Uint8Array || function () {};
  3188. function _uint8ArrayToBuffer(chunk) {
  3189. return Buffer.from(chunk);
  3190. }
  3191. function _isUint8Array(obj) {
  3192. return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
  3193. }
  3194. /*<replacement>*/
  3195. var debugUtil = __webpack_require__(31669);
  3196. var debug;
  3197. if (debugUtil && debugUtil.debuglog) {
  3198. debug = debugUtil.debuglog('stream');
  3199. } else {
  3200. debug = function debug() {};
  3201. }
  3202. /*</replacement>*/
  3203. var BufferList = __webpack_require__(57327);
  3204. var destroyImpl = __webpack_require__(61195);
  3205. var _require = __webpack_require__(82457),
  3206. getHighWaterMark = _require.getHighWaterMark;
  3207. var _require$codes = __webpack_require__(4012)/* .codes */ .q,
  3208. ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
  3209. ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,
  3210. ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
  3211. ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance.
  3212. var StringDecoder;
  3213. var createReadableStreamAsyncIterator;
  3214. var from;
  3215. __webpack_require__(94378)(Readable, Stream);
  3216. var errorOrDestroy = destroyImpl.errorOrDestroy;
  3217. var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
  3218. function prependListener(emitter, event, fn) {
  3219. // Sadly this is not cacheable as some libraries bundle their own
  3220. // event emitter implementation with them.
  3221. if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any
  3222. // userland ones. NEVER DO THIS. This is here only because this code needs
  3223. // to continue to work with older versions of Node.js that do not include
  3224. // the prependListener() method. The goal is to eventually remove this hack.
  3225. if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
  3226. }
  3227. function ReadableState(options, stream, isDuplex) {
  3228. Duplex = Duplex || __webpack_require__(56753);
  3229. options = options || {}; // Duplex streams are both readable and writable, but share
  3230. // the same options object.
  3231. // However, some cases require setting options to different
  3232. // values for the readable and the writable sides of the duplex stream.
  3233. // These options can be provided separately as readableXXX and writableXXX.
  3234. if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to
  3235. // make all the buffer merging and length checks go away
  3236. this.objectMode = !!options.objectMode;
  3237. if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer
  3238. // Note: 0 is a valid value, means "don't call _read preemptively ever"
  3239. this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the
  3240. // linked list can remove elements from the beginning faster than
  3241. // array.shift()
  3242. this.buffer = new BufferList();
  3243. this.length = 0;
  3244. this.pipes = null;
  3245. this.pipesCount = 0;
  3246. this.flowing = null;
  3247. this.ended = false;
  3248. this.endEmitted = false;
  3249. this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted
  3250. // immediately, or on a later tick. We set this to true at first, because
  3251. // any actions that shouldn't happen until "later" should generally also
  3252. // not happen before the first read call.
  3253. this.sync = true; // whenever we return null, then we set a flag to say
  3254. // that we're awaiting a 'readable' event emission.
  3255. this.needReadable = false;
  3256. this.emittedReadable = false;
  3257. this.readableListening = false;
  3258. this.resumeScheduled = false;
  3259. this.paused = true; // Should close be emitted on destroy. Defaults to true.
  3260. this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish')
  3261. this.autoDestroy = !!options.autoDestroy; // has it been destroyed
  3262. this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string
  3263. // encoding is 'binary' so we have to make this configurable.
  3264. // Everything else in the universe uses 'utf8', though.
  3265. this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s
  3266. this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled
  3267. this.readingMore = false;
  3268. this.decoder = null;
  3269. this.encoding = null;
  3270. if (options.encoding) {
  3271. if (!StringDecoder) StringDecoder = __webpack_require__(32553)/* .StringDecoder */ .s;
  3272. this.decoder = new StringDecoder(options.encoding);
  3273. this.encoding = options.encoding;
  3274. }
  3275. }
  3276. function Readable(options) {
  3277. Duplex = Duplex || __webpack_require__(56753);
  3278. if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside
  3279. // the ReadableState constructor, at least with V8 6.5
  3280. var isDuplex = this instanceof Duplex;
  3281. this._readableState = new ReadableState(options, this, isDuplex); // legacy
  3282. this.readable = true;
  3283. if (options) {
  3284. if (typeof options.read === 'function') this._read = options.read;
  3285. if (typeof options.destroy === 'function') this._destroy = options.destroy;
  3286. }
  3287. Stream.call(this);
  3288. }
  3289. Object.defineProperty(Readable.prototype, 'destroyed', {
  3290. // making it explicit this property is not enumerable
  3291. // because otherwise some prototype manipulation in
  3292. // userland will fail
  3293. enumerable: false,
  3294. get: function get() {
  3295. if (this._readableState === undefined) {
  3296. return false;
  3297. }
  3298. return this._readableState.destroyed;
  3299. },
  3300. set: function set(value) {
  3301. // we ignore the value if the stream
  3302. // has not been initialized yet
  3303. if (!this._readableState) {
  3304. return;
  3305. } // backward compatibility, the user is explicitly
  3306. // managing destroyed
  3307. this._readableState.destroyed = value;
  3308. }
  3309. });
  3310. Readable.prototype.destroy = destroyImpl.destroy;
  3311. Readable.prototype._undestroy = destroyImpl.undestroy;
  3312. Readable.prototype._destroy = function (err, cb) {
  3313. cb(err);
  3314. }; // Manually shove something into the read() buffer.
  3315. // This returns true if the highWaterMark has not been hit yet,
  3316. // similar to how Writable.write() returns true if you should
  3317. // write() some more.
  3318. Readable.prototype.push = function (chunk, encoding) {
  3319. var state = this._readableState;
  3320. var skipChunkCheck;
  3321. if (!state.objectMode) {
  3322. if (typeof chunk === 'string') {
  3323. encoding = encoding || state.defaultEncoding;
  3324. if (encoding !== state.encoding) {
  3325. chunk = Buffer.from(chunk, encoding);
  3326. encoding = '';
  3327. }
  3328. skipChunkCheck = true;
  3329. }
  3330. } else {
  3331. skipChunkCheck = true;
  3332. }
  3333. return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
  3334. }; // Unshift should *always* be something directly out of read()
  3335. Readable.prototype.unshift = function (chunk) {
  3336. return readableAddChunk(this, chunk, null, true, false);
  3337. };
  3338. function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
  3339. debug('readableAddChunk', chunk);
  3340. var state = stream._readableState;
  3341. if (chunk === null) {
  3342. state.reading = false;
  3343. onEofChunk(stream, state);
  3344. } else {
  3345. var er;
  3346. if (!skipChunkCheck) er = chunkInvalid(state, chunk);
  3347. if (er) {
  3348. errorOrDestroy(stream, er);
  3349. } else if (state.objectMode || chunk && chunk.length > 0) {
  3350. if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
  3351. chunk = _uint8ArrayToBuffer(chunk);
  3352. }
  3353. if (addToFront) {
  3354. if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);
  3355. } else if (state.ended) {
  3356. errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());
  3357. } else if (state.destroyed) {
  3358. return false;
  3359. } else {
  3360. state.reading = false;
  3361. if (state.decoder && !encoding) {
  3362. chunk = state.decoder.write(chunk);
  3363. if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
  3364. } else {
  3365. addChunk(stream, state, chunk, false);
  3366. }
  3367. }
  3368. } else if (!addToFront) {
  3369. state.reading = false;
  3370. maybeReadMore(stream, state);
  3371. }
  3372. } // We can push more data if we are below the highWaterMark.
  3373. // Also, if we have no data yet, we can stand some more bytes.
  3374. // This is to work around cases where hwm=0, such as the repl.
  3375. return !state.ended && (state.length < state.highWaterMark || state.length === 0);
  3376. }
  3377. function addChunk(stream, state, chunk, addToFront) {
  3378. if (state.flowing && state.length === 0 && !state.sync) {
  3379. state.awaitDrain = 0;
  3380. stream.emit('data', chunk);
  3381. } else {
  3382. // update the buffer info.
  3383. state.length += state.objectMode ? 1 : chunk.length;
  3384. if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
  3385. if (state.needReadable) emitReadable(stream);
  3386. }
  3387. maybeReadMore(stream, state);
  3388. }
  3389. function chunkInvalid(state, chunk) {
  3390. var er;
  3391. if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
  3392. er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);
  3393. }
  3394. return er;
  3395. }
  3396. Readable.prototype.isPaused = function () {
  3397. return this._readableState.flowing === false;
  3398. }; // backwards compatibility.
  3399. Readable.prototype.setEncoding = function (enc) {
  3400. if (!StringDecoder) StringDecoder = __webpack_require__(32553)/* .StringDecoder */ .s;
  3401. var decoder = new StringDecoder(enc);
  3402. this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8
  3403. this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers:
  3404. var p = this._readableState.buffer.head;
  3405. var content = '';
  3406. while (p !== null) {
  3407. content += decoder.write(p.data);
  3408. p = p.next;
  3409. }
  3410. this._readableState.buffer.clear();
  3411. if (content !== '') this._readableState.buffer.push(content);
  3412. this._readableState.length = content.length;
  3413. return this;
  3414. }; // Don't raise the hwm > 1GB
  3415. var MAX_HWM = 0x40000000;
  3416. function computeNewHighWaterMark(n) {
  3417. if (n >= MAX_HWM) {
  3418. // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.
  3419. n = MAX_HWM;
  3420. } else {
  3421. // Get the next highest power of 2 to prevent increasing hwm excessively in
  3422. // tiny amounts
  3423. n--;
  3424. n |= n >>> 1;
  3425. n |= n >>> 2;
  3426. n |= n >>> 4;
  3427. n |= n >>> 8;
  3428. n |= n >>> 16;
  3429. n++;
  3430. }
  3431. return n;
  3432. } // This function is designed to be inlinable, so please take care when making
  3433. // changes to the function body.
  3434. function howMuchToRead(n, state) {
  3435. if (n <= 0 || state.length === 0 && state.ended) return 0;
  3436. if (state.objectMode) return 1;
  3437. if (n !== n) {
  3438. // Only flow one buffer at a time
  3439. if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
  3440. } // If we're asking for more than the current hwm, then raise the hwm.
  3441. if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
  3442. if (n <= state.length) return n; // Don't have enough
  3443. if (!state.ended) {
  3444. state.needReadable = true;
  3445. return 0;
  3446. }
  3447. return state.length;
  3448. } // you can override either this method, or the async _read(n) below.
  3449. Readable.prototype.read = function (n) {
  3450. debug('read', n);
  3451. n = parseInt(n, 10);
  3452. var state = this._readableState;
  3453. var nOrig = n;
  3454. if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we
  3455. // already have a bunch of data in the buffer, then just trigger
  3456. // the 'readable' event and move on.
  3457. if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {
  3458. debug('read: emitReadable', state.length, state.ended);
  3459. if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
  3460. return null;
  3461. }
  3462. n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up.
  3463. if (n === 0 && state.ended) {
  3464. if (state.length === 0) endReadable(this);
  3465. return null;
  3466. } // All the actual chunk generation logic needs to be
  3467. // *below* the call to _read. The reason is that in certain
  3468. // synthetic stream cases, such as passthrough streams, _read
  3469. // may be a completely synchronous operation which may change
  3470. // the state of the read buffer, providing enough data when
  3471. // before there was *not* enough.
  3472. //
  3473. // So, the steps are:
  3474. // 1. Figure out what the state of things will be after we do
  3475. // a read from the buffer.
  3476. //
  3477. // 2. If that resulting state will trigger a _read, then call _read.
  3478. // Note that this may be asynchronous, or synchronous. Yes, it is
  3479. // deeply ugly to write APIs this way, but that still doesn't mean
  3480. // that the Readable class should behave improperly, as streams are
  3481. // designed to be sync/async agnostic.
  3482. // Take note if the _read call is sync or async (ie, if the read call
  3483. // has returned yet), so that we know whether or not it's safe to emit
  3484. // 'readable' etc.
  3485. //
  3486. // 3. Actually pull the requested chunks out of the buffer and return.
  3487. // if we need a readable event, then we need to do some reading.
  3488. var doRead = state.needReadable;
  3489. debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some
  3490. if (state.length === 0 || state.length - n < state.highWaterMark) {
  3491. doRead = true;
  3492. debug('length less than watermark', doRead);
  3493. } // however, if we've ended, then there's no point, and if we're already
  3494. // reading, then it's unnecessary.
  3495. if (state.ended || state.reading) {
  3496. doRead = false;
  3497. debug('reading or ended', doRead);
  3498. } else if (doRead) {
  3499. debug('do read');
  3500. state.reading = true;
  3501. state.sync = true; // if the length is currently zero, then we *need* a readable event.
  3502. if (state.length === 0) state.needReadable = true; // call internal read method
  3503. this._read(state.highWaterMark);
  3504. state.sync = false; // If _read pushed data synchronously, then `reading` will be false,
  3505. // and we need to re-evaluate how much data we can return to the user.
  3506. if (!state.reading) n = howMuchToRead(nOrig, state);
  3507. }
  3508. var ret;
  3509. if (n > 0) ret = fromList(n, state);else ret = null;
  3510. if (ret === null) {
  3511. state.needReadable = state.length <= state.highWaterMark;
  3512. n = 0;
  3513. } else {
  3514. state.length -= n;
  3515. state.awaitDrain = 0;
  3516. }
  3517. if (state.length === 0) {
  3518. // If we have nothing in the buffer, then we want to know
  3519. // as soon as we *do* get something into the buffer.
  3520. if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick.
  3521. if (nOrig !== n && state.ended) endReadable(this);
  3522. }
  3523. if (ret !== null) this.emit('data', ret);
  3524. return ret;
  3525. };
  3526. function onEofChunk(stream, state) {
  3527. debug('onEofChunk');
  3528. if (state.ended) return;
  3529. if (state.decoder) {
  3530. var chunk = state.decoder.end();
  3531. if (chunk && chunk.length) {
  3532. state.buffer.push(chunk);
  3533. state.length += state.objectMode ? 1 : chunk.length;
  3534. }
  3535. }
  3536. state.ended = true;
  3537. if (state.sync) {
  3538. // if we are sync, wait until next tick to emit the data.
  3539. // Otherwise we risk emitting data in the flow()
  3540. // the readable code triggers during a read() call
  3541. emitReadable(stream);
  3542. } else {
  3543. // emit 'readable' now to make sure it gets picked up.
  3544. state.needReadable = false;
  3545. if (!state.emittedReadable) {
  3546. state.emittedReadable = true;
  3547. emitReadable_(stream);
  3548. }
  3549. }
  3550. } // Don't emit readable right away in sync mode, because this can trigger
  3551. // another read() call => stack overflow. This way, it might trigger
  3552. // a nextTick recursion warning, but that's not so bad.
  3553. function emitReadable(stream) {
  3554. var state = stream._readableState;
  3555. debug('emitReadable', state.needReadable, state.emittedReadable);
  3556. state.needReadable = false;
  3557. if (!state.emittedReadable) {
  3558. debug('emitReadable', state.flowing);
  3559. state.emittedReadable = true;
  3560. process.nextTick(emitReadable_, stream);
  3561. }
  3562. }
  3563. function emitReadable_(stream) {
  3564. var state = stream._readableState;
  3565. debug('emitReadable_', state.destroyed, state.length, state.ended);
  3566. if (!state.destroyed && (state.length || state.ended)) {
  3567. stream.emit('readable');
  3568. state.emittedReadable = false;
  3569. } // The stream needs another readable event if
  3570. // 1. It is not flowing, as the flow mechanism will take
  3571. // care of it.
  3572. // 2. It is not ended.
  3573. // 3. It is below the highWaterMark, so we can schedule
  3574. // another readable later.
  3575. state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;
  3576. flow(stream);
  3577. } // at this point, the user has presumably seen the 'readable' event,
  3578. // and called read() to consume some data. that may have triggered
  3579. // in turn another _read(n) call, in which case reading = true if
  3580. // it's in progress.
  3581. // However, if we're not ended, or reading, and the length < hwm,
  3582. // then go ahead and try to read some more preemptively.
  3583. function maybeReadMore(stream, state) {
  3584. if (!state.readingMore) {
  3585. state.readingMore = true;
  3586. process.nextTick(maybeReadMore_, stream, state);
  3587. }
  3588. }
  3589. function maybeReadMore_(stream, state) {
  3590. // Attempt to read more data if we should.
  3591. //
  3592. // The conditions for reading more data are (one of):
  3593. // - Not enough data buffered (state.length < state.highWaterMark). The loop
  3594. // is responsible for filling the buffer with enough data if such data
  3595. // is available. If highWaterMark is 0 and we are not in the flowing mode
  3596. // we should _not_ attempt to buffer any extra data. We'll get more data
  3597. // when the stream consumer calls read() instead.
  3598. // - No data in the buffer, and the stream is in flowing mode. In this mode
  3599. // the loop below is responsible for ensuring read() is called. Failing to
  3600. // call read here would abort the flow and there's no other mechanism for
  3601. // continuing the flow if the stream consumer has just subscribed to the
  3602. // 'data' event.
  3603. //
  3604. // In addition to the above conditions to keep reading data, the following
  3605. // conditions prevent the data from being read:
  3606. // - The stream has ended (state.ended).
  3607. // - There is already a pending 'read' operation (state.reading). This is a
  3608. // case where the the stream has called the implementation defined _read()
  3609. // method, but they are processing the call asynchronously and have _not_
  3610. // called push() with new data. In this case we skip performing more
  3611. // read()s. The execution ends in this method again after the _read() ends
  3612. // up calling push() with more data.
  3613. while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {
  3614. var len = state.length;
  3615. debug('maybeReadMore read 0');
  3616. stream.read(0);
  3617. if (len === state.length) // didn't get any data, stop spinning.
  3618. break;
  3619. }
  3620. state.readingMore = false;
  3621. } // abstract method. to be overridden in specific implementation classes.
  3622. // call cb(er, data) where data is <= n in length.
  3623. // for virtual (non-string, non-buffer) streams, "length" is somewhat
  3624. // arbitrary, and perhaps not very meaningful.
  3625. Readable.prototype._read = function (n) {
  3626. errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));
  3627. };
  3628. Readable.prototype.pipe = function (dest, pipeOpts) {
  3629. var src = this;
  3630. var state = this._readableState;
  3631. switch (state.pipesCount) {
  3632. case 0:
  3633. state.pipes = dest;
  3634. break;
  3635. case 1:
  3636. state.pipes = [state.pipes, dest];
  3637. break;
  3638. default:
  3639. state.pipes.push(dest);
  3640. break;
  3641. }
  3642. state.pipesCount += 1;
  3643. debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
  3644. var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
  3645. var endFn = doEnd ? onend : unpipe;
  3646. if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);
  3647. dest.on('unpipe', onunpipe);
  3648. function onunpipe(readable, unpipeInfo) {
  3649. debug('onunpipe');
  3650. if (readable === src) {
  3651. if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
  3652. unpipeInfo.hasUnpiped = true;
  3653. cleanup();
  3654. }
  3655. }
  3656. }
  3657. function onend() {
  3658. debug('onend');
  3659. dest.end();
  3660. } // when the dest drains, it reduces the awaitDrain counter
  3661. // on the source. This would be more elegant with a .once()
  3662. // handler in flow(), but adding and removing repeatedly is
  3663. // too slow.
  3664. var ondrain = pipeOnDrain(src);
  3665. dest.on('drain', ondrain);
  3666. var cleanedUp = false;
  3667. function cleanup() {
  3668. debug('cleanup'); // cleanup event handlers once the pipe is broken
  3669. dest.removeListener('close', onclose);
  3670. dest.removeListener('finish', onfinish);
  3671. dest.removeListener('drain', ondrain);
  3672. dest.removeListener('error', onerror);
  3673. dest.removeListener('unpipe', onunpipe);
  3674. src.removeListener('end', onend);
  3675. src.removeListener('end', unpipe);
  3676. src.removeListener('data', ondata);
  3677. cleanedUp = true; // if the reader is waiting for a drain event from this
  3678. // specific writer, then it would cause it to never start
  3679. // flowing again.
  3680. // So, if this is awaiting a drain, then we just call it now.
  3681. // If we don't know, then assume that we are waiting for one.
  3682. if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
  3683. }
  3684. src.on('data', ondata);
  3685. function ondata(chunk) {
  3686. debug('ondata');
  3687. var ret = dest.write(chunk);
  3688. debug('dest.write', ret);
  3689. if (ret === false) {
  3690. // If the user unpiped during `dest.write()`, it is possible
  3691. // to get stuck in a permanently paused state if that write
  3692. // also returned false.
  3693. // => Check whether `dest` is still a piping destination.
  3694. if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
  3695. debug('false write response, pause', state.awaitDrain);
  3696. state.awaitDrain++;
  3697. }
  3698. src.pause();
  3699. }
  3700. } // if the dest has an error, then stop piping into it.
  3701. // however, don't suppress the throwing behavior for this.
  3702. function onerror(er) {
  3703. debug('onerror', er);
  3704. unpipe();
  3705. dest.removeListener('error', onerror);
  3706. if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);
  3707. } // Make sure our error handler is attached before userland ones.
  3708. prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once.
  3709. function onclose() {
  3710. dest.removeListener('finish', onfinish);
  3711. unpipe();
  3712. }
  3713. dest.once('close', onclose);
  3714. function onfinish() {
  3715. debug('onfinish');
  3716. dest.removeListener('close', onclose);
  3717. unpipe();
  3718. }
  3719. dest.once('finish', onfinish);
  3720. function unpipe() {
  3721. debug('unpipe');
  3722. src.unpipe(dest);
  3723. } // tell the dest that it's being piped to
  3724. dest.emit('pipe', src); // start the flow if it hasn't been started already.
  3725. if (!state.flowing) {
  3726. debug('pipe resume');
  3727. src.resume();
  3728. }
  3729. return dest;
  3730. };
  3731. function pipeOnDrain(src) {
  3732. return function pipeOnDrainFunctionResult() {
  3733. var state = src._readableState;
  3734. debug('pipeOnDrain', state.awaitDrain);
  3735. if (state.awaitDrain) state.awaitDrain--;
  3736. if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
  3737. state.flowing = true;
  3738. flow(src);
  3739. }
  3740. };
  3741. }
  3742. Readable.prototype.unpipe = function (dest) {
  3743. var state = this._readableState;
  3744. var unpipeInfo = {
  3745. hasUnpiped: false
  3746. }; // if we're not piping anywhere, then do nothing.
  3747. if (state.pipesCount === 0) return this; // just one destination. most common case.
  3748. if (state.pipesCount === 1) {
  3749. // passed in one, but it's not the right one.
  3750. if (dest && dest !== state.pipes) return this;
  3751. if (!dest) dest = state.pipes; // got a match.
  3752. state.pipes = null;
  3753. state.pipesCount = 0;
  3754. state.flowing = false;
  3755. if (dest) dest.emit('unpipe', this, unpipeInfo);
  3756. return this;
  3757. } // slow case. multiple pipe destinations.
  3758. if (!dest) {
  3759. // remove all.
  3760. var dests = state.pipes;
  3761. var len = state.pipesCount;
  3762. state.pipes = null;
  3763. state.pipesCount = 0;
  3764. state.flowing = false;
  3765. for (var i = 0; i < len; i++) {
  3766. dests[i].emit('unpipe', this, {
  3767. hasUnpiped: false
  3768. });
  3769. }
  3770. return this;
  3771. } // try to find the right one.
  3772. var index = indexOf(state.pipes, dest);
  3773. if (index === -1) return this;
  3774. state.pipes.splice(index, 1);
  3775. state.pipesCount -= 1;
  3776. if (state.pipesCount === 1) state.pipes = state.pipes[0];
  3777. dest.emit('unpipe', this, unpipeInfo);
  3778. return this;
  3779. }; // set up data events if they are asked for
  3780. // Ensure readable listeners eventually get something
  3781. Readable.prototype.on = function (ev, fn) {
  3782. var res = Stream.prototype.on.call(this, ev, fn);
  3783. var state = this._readableState;
  3784. if (ev === 'data') {
  3785. // update readableListening so that resume() may be a no-op
  3786. // a few lines down. This is needed to support once('readable').
  3787. state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused
  3788. if (state.flowing !== false) this.resume();
  3789. } else if (ev === 'readable') {
  3790. if (!state.endEmitted && !state.readableListening) {
  3791. state.readableListening = state.needReadable = true;
  3792. state.flowing = false;
  3793. state.emittedReadable = false;
  3794. debug('on readable', state.length, state.reading);
  3795. if (state.length) {
  3796. emitReadable(this);
  3797. } else if (!state.reading) {
  3798. process.nextTick(nReadingNextTick, this);
  3799. }
  3800. }
  3801. }
  3802. return res;
  3803. };
  3804. Readable.prototype.addListener = Readable.prototype.on;
  3805. Readable.prototype.removeListener = function (ev, fn) {
  3806. var res = Stream.prototype.removeListener.call(this, ev, fn);
  3807. if (ev === 'readable') {
  3808. // We need to check if there is someone still listening to
  3809. // readable and reset the state. However this needs to happen
  3810. // after readable has been emitted but before I/O (nextTick) to
  3811. // support once('readable', fn) cycles. This means that calling
  3812. // resume within the same tick will have no
  3813. // effect.
  3814. process.nextTick(updateReadableListening, this);
  3815. }
  3816. return res;
  3817. };
  3818. Readable.prototype.removeAllListeners = function (ev) {
  3819. var res = Stream.prototype.removeAllListeners.apply(this, arguments);
  3820. if (ev === 'readable' || ev === undefined) {
  3821. // We need to check if there is someone still listening to
  3822. // readable and reset the state. However this needs to happen
  3823. // after readable has been emitted but before I/O (nextTick) to
  3824. // support once('readable', fn) cycles. This means that calling
  3825. // resume within the same tick will have no
  3826. // effect.
  3827. process.nextTick(updateReadableListening, this);
  3828. }
  3829. return res;
  3830. };
  3831. function updateReadableListening(self) {
  3832. var state = self._readableState;
  3833. state.readableListening = self.listenerCount('readable') > 0;
  3834. if (state.resumeScheduled && !state.paused) {
  3835. // flowing needs to be set to true now, otherwise
  3836. // the upcoming resume will not flow.
  3837. state.flowing = true; // crude way to check if we should resume
  3838. } else if (self.listenerCount('data') > 0) {
  3839. self.resume();
  3840. }
  3841. }
  3842. function nReadingNextTick(self) {
  3843. debug('readable nexttick read 0');
  3844. self.read(0);
  3845. } // pause() and resume() are remnants of the legacy readable stream API
  3846. // If the user uses them, then switch into old mode.
  3847. Readable.prototype.resume = function () {
  3848. var state = this._readableState;
  3849. if (!state.flowing) {
  3850. debug('resume'); // we flow only if there is no one listening
  3851. // for readable, but we still have to call
  3852. // resume()
  3853. state.flowing = !state.readableListening;
  3854. resume(this, state);
  3855. }
  3856. state.paused = false;
  3857. return this;
  3858. };
  3859. function resume(stream, state) {
  3860. if (!state.resumeScheduled) {
  3861. state.resumeScheduled = true;
  3862. process.nextTick(resume_, stream, state);
  3863. }
  3864. }
  3865. function resume_(stream, state) {
  3866. debug('resume', state.reading);
  3867. if (!state.reading) {
  3868. stream.read(0);
  3869. }
  3870. state.resumeScheduled = false;
  3871. stream.emit('resume');
  3872. flow(stream);
  3873. if (state.flowing && !state.reading) stream.read(0);
  3874. }
  3875. Readable.prototype.pause = function () {
  3876. debug('call pause flowing=%j', this._readableState.flowing);
  3877. if (this._readableState.flowing !== false) {
  3878. debug('pause');
  3879. this._readableState.flowing = false;
  3880. this.emit('pause');
  3881. }
  3882. this._readableState.paused = true;
  3883. return this;
  3884. };
  3885. function flow(stream) {
  3886. var state = stream._readableState;
  3887. debug('flow', state.flowing);
  3888. while (state.flowing && stream.read() !== null) {
  3889. ;
  3890. }
  3891. } // wrap an old-style stream as the async data source.
  3892. // This is *not* part of the readable stream interface.
  3893. // It is an ugly unfortunate mess of history.
  3894. Readable.prototype.wrap = function (stream) {
  3895. var _this = this;
  3896. var state = this._readableState;
  3897. var paused = false;
  3898. stream.on('end', function () {
  3899. debug('wrapped end');
  3900. if (state.decoder && !state.ended) {
  3901. var chunk = state.decoder.end();
  3902. if (chunk && chunk.length) _this.push(chunk);
  3903. }
  3904. _this.push(null);
  3905. });
  3906. stream.on('data', function (chunk) {
  3907. debug('wrapped data');
  3908. if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode
  3909. if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
  3910. var ret = _this.push(chunk);
  3911. if (!ret) {
  3912. paused = true;
  3913. stream.pause();
  3914. }
  3915. }); // proxy all the other methods.
  3916. // important when wrapping filters and duplexes.
  3917. for (var i in stream) {
  3918. if (this[i] === undefined && typeof stream[i] === 'function') {
  3919. this[i] = function methodWrap(method) {
  3920. return function methodWrapReturnFunction() {
  3921. return stream[method].apply(stream, arguments);
  3922. };
  3923. }(i);
  3924. }
  3925. } // proxy certain important events.
  3926. for (var n = 0; n < kProxyEvents.length; n++) {
  3927. stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
  3928. } // when we try to consume some more bytes, simply unpause the
  3929. // underlying stream.
  3930. this._read = function (n) {
  3931. debug('wrapped _read', n);
  3932. if (paused) {
  3933. paused = false;
  3934. stream.resume();
  3935. }
  3936. };
  3937. return this;
  3938. };
  3939. if (typeof Symbol === 'function') {
  3940. Readable.prototype[Symbol.asyncIterator] = function () {
  3941. if (createReadableStreamAsyncIterator === undefined) {
  3942. createReadableStreamAsyncIterator = __webpack_require__(45850);
  3943. }
  3944. return createReadableStreamAsyncIterator(this);
  3945. };
  3946. }
  3947. Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
  3948. // making it explicit this property is not enumerable
  3949. // because otherwise some prototype manipulation in
  3950. // userland will fail
  3951. enumerable: false,
  3952. get: function get() {
  3953. return this._readableState.highWaterMark;
  3954. }
  3955. });
  3956. Object.defineProperty(Readable.prototype, 'readableBuffer', {
  3957. // making it explicit this property is not enumerable
  3958. // because otherwise some prototype manipulation in
  3959. // userland will fail
  3960. enumerable: false,
  3961. get: function get() {
  3962. return this._readableState && this._readableState.buffer;
  3963. }
  3964. });
  3965. Object.defineProperty(Readable.prototype, 'readableFlowing', {
  3966. // making it explicit this property is not enumerable
  3967. // because otherwise some prototype manipulation in
  3968. // userland will fail
  3969. enumerable: false,
  3970. get: function get() {
  3971. return this._readableState.flowing;
  3972. },
  3973. set: function set(state) {
  3974. if (this._readableState) {
  3975. this._readableState.flowing = state;
  3976. }
  3977. }
  3978. }); // exposed for testing purposes only.
  3979. Readable._fromList = fromList;
  3980. Object.defineProperty(Readable.prototype, 'readableLength', {
  3981. // making it explicit this property is not enumerable
  3982. // because otherwise some prototype manipulation in
  3983. // userland will fail
  3984. enumerable: false,
  3985. get: function get() {
  3986. return this._readableState.length;
  3987. }
  3988. }); // Pluck off n bytes from an array of buffers.
  3989. // Length is the combined lengths of all the buffers in the list.
  3990. // This function is designed to be inlinable, so please take care when making
  3991. // changes to the function body.
  3992. function fromList(n, state) {
  3993. // nothing buffered
  3994. if (state.length === 0) return null;
  3995. var ret;
  3996. if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
  3997. // read it all, truncate the list
  3998. if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length);
  3999. state.buffer.clear();
  4000. } else {
  4001. // read part of list
  4002. ret = state.buffer.consume(n, state.decoder);
  4003. }
  4004. return ret;
  4005. }
  4006. function endReadable(stream) {
  4007. var state = stream._readableState;
  4008. debug('endReadable', state.endEmitted);
  4009. if (!state.endEmitted) {
  4010. state.ended = true;
  4011. process.nextTick(endReadableNT, state, stream);
  4012. }
  4013. }
  4014. function endReadableNT(state, stream) {
  4015. debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift.
  4016. if (!state.endEmitted && state.length === 0) {
  4017. state.endEmitted = true;
  4018. stream.readable = false;
  4019. stream.emit('end');
  4020. if (state.autoDestroy) {
  4021. // In case of duplex streams we need a way to detect
  4022. // if the writable side is ready for autoDestroy as well
  4023. var wState = stream._writableState;
  4024. if (!wState || wState.autoDestroy && wState.finished) {
  4025. stream.destroy();
  4026. }
  4027. }
  4028. }
  4029. }
  4030. if (typeof Symbol === 'function') {
  4031. Readable.from = function (iterable, opts) {
  4032. if (from === undefined) {
  4033. from = __webpack_require__(96307);
  4034. }
  4035. return from(Readable, iterable, opts);
  4036. };
  4037. }
  4038. function indexOf(xs, x) {
  4039. for (var i = 0, l = xs.length; i < l; i++) {
  4040. if (xs[i] === x) return i;
  4041. }
  4042. return -1;
  4043. }
  4044. /***/ }),
  4045. /***/ 74605:
  4046. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  4047. "use strict";
  4048. // Copyright Joyent, Inc. and other Node contributors.
  4049. //
  4050. // Permission is hereby granted, free of charge, to any person obtaining a
  4051. // copy of this software and associated documentation files (the
  4052. // "Software"), to deal in the Software without restriction, including
  4053. // without limitation the rights to use, copy, modify, merge, publish,
  4054. // distribute, sublicense, and/or sell copies of the Software, and to permit
  4055. // persons to whom the Software is furnished to do so, subject to the
  4056. // following conditions:
  4057. //
  4058. // The above copyright notice and this permission notice shall be included
  4059. // in all copies or substantial portions of the Software.
  4060. //
  4061. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  4062. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  4063. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  4064. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  4065. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  4066. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  4067. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  4068. // a transform stream is a readable/writable stream where you do
  4069. // something with the data. Sometimes it's called a "filter",
  4070. // but that's not a great name for it, since that implies a thing where
  4071. // some bits pass through, and others are simply ignored. (That would
  4072. // be a valid example of a transform, of course.)
  4073. //
  4074. // While the output is causally related to the input, it's not a
  4075. // necessarily symmetric or synchronous transformation. For example,
  4076. // a zlib stream might take multiple plain-text writes(), and then
  4077. // emit a single compressed chunk some time in the future.
  4078. //
  4079. // Here's how this works:
  4080. //
  4081. // The Transform stream has all the aspects of the readable and writable
  4082. // stream classes. When you write(chunk), that calls _write(chunk,cb)
  4083. // internally, and returns false if there's a lot of pending writes
  4084. // buffered up. When you call read(), that calls _read(n) until
  4085. // there's enough pending readable data buffered up.
  4086. //
  4087. // In a transform stream, the written data is placed in a buffer. When
  4088. // _read(n) is called, it transforms the queued up data, calling the
  4089. // buffered _write cb's as it consumes chunks. If consuming a single
  4090. // written chunk would result in multiple output chunks, then the first
  4091. // outputted bit calls the readcb, and subsequent chunks just go into
  4092. // the read buffer, and will cause it to emit 'readable' if necessary.
  4093. //
  4094. // This way, back-pressure is actually determined by the reading side,
  4095. // since _read has to be called to start processing a new chunk. However,
  4096. // a pathological inflate type of transform can cause excessive buffering
  4097. // here. For example, imagine a stream where every byte of input is
  4098. // interpreted as an integer from 0-255, and then results in that many
  4099. // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
  4100. // 1kb of data being output. In this case, you could write a very small
  4101. // amount of input, and end up with a very large amount of output. In
  4102. // such a pathological inflating mechanism, there'd be no way to tell
  4103. // the system to stop doing the transform. A single 4MB write could
  4104. // cause the system to run out of memory.
  4105. //
  4106. // However, even in such a pathological case, only a single written chunk
  4107. // would be consumed, and then the rest would wait (un-transformed) until
  4108. // the results of the previous transformed chunk were consumed.
  4109. module.exports = Transform;
  4110. var _require$codes = __webpack_require__(4012)/* .codes */ .q,
  4111. ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
  4112. ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
  4113. ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,
  4114. ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
  4115. var Duplex = __webpack_require__(56753);
  4116. __webpack_require__(94378)(Transform, Duplex);
  4117. function afterTransform(er, data) {
  4118. var ts = this._transformState;
  4119. ts.transforming = false;
  4120. var cb = ts.writecb;
  4121. if (cb === null) {
  4122. return this.emit('error', new ERR_MULTIPLE_CALLBACK());
  4123. }
  4124. ts.writechunk = null;
  4125. ts.writecb = null;
  4126. if (data != null) // single equals check for both `null` and `undefined`
  4127. this.push(data);
  4128. cb(er);
  4129. var rs = this._readableState;
  4130. rs.reading = false;
  4131. if (rs.needReadable || rs.length < rs.highWaterMark) {
  4132. this._read(rs.highWaterMark);
  4133. }
  4134. }
  4135. function Transform(options) {
  4136. if (!(this instanceof Transform)) return new Transform(options);
  4137. Duplex.call(this, options);
  4138. this._transformState = {
  4139. afterTransform: afterTransform.bind(this),
  4140. needTransform: false,
  4141. transforming: false,
  4142. writecb: null,
  4143. writechunk: null,
  4144. writeencoding: null
  4145. }; // start out asking for a readable event once data is transformed.
  4146. this._readableState.needReadable = true; // we have implemented the _read method, and done the other things
  4147. // that Readable wants before the first _read call, so unset the
  4148. // sync guard flag.
  4149. this._readableState.sync = false;
  4150. if (options) {
  4151. if (typeof options.transform === 'function') this._transform = options.transform;
  4152. if (typeof options.flush === 'function') this._flush = options.flush;
  4153. } // When the writable side finishes, then flush out anything remaining.
  4154. this.on('prefinish', prefinish);
  4155. }
  4156. function prefinish() {
  4157. var _this = this;
  4158. if (typeof this._flush === 'function' && !this._readableState.destroyed) {
  4159. this._flush(function (er, data) {
  4160. done(_this, er, data);
  4161. });
  4162. } else {
  4163. done(this, null, null);
  4164. }
  4165. }
  4166. Transform.prototype.push = function (chunk, encoding) {
  4167. this._transformState.needTransform = false;
  4168. return Duplex.prototype.push.call(this, chunk, encoding);
  4169. }; // This is the part where you do stuff!
  4170. // override this function in implementation classes.
  4171. // 'chunk' is an input chunk.
  4172. //
  4173. // Call `push(newChunk)` to pass along transformed output
  4174. // to the readable side. You may call 'push' zero or more times.
  4175. //
  4176. // Call `cb(err)` when you are done with this chunk. If you pass
  4177. // an error, then that'll put the hurt on the whole operation. If you
  4178. // never call cb(), then you'll never get another chunk.
  4179. Transform.prototype._transform = function (chunk, encoding, cb) {
  4180. cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));
  4181. };
  4182. Transform.prototype._write = function (chunk, encoding, cb) {
  4183. var ts = this._transformState;
  4184. ts.writecb = cb;
  4185. ts.writechunk = chunk;
  4186. ts.writeencoding = encoding;
  4187. if (!ts.transforming) {
  4188. var rs = this._readableState;
  4189. if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
  4190. }
  4191. }; // Doesn't matter what the args are here.
  4192. // _transform does all the work.
  4193. // That we got here means that the readable side wants more data.
  4194. Transform.prototype._read = function (n) {
  4195. var ts = this._transformState;
  4196. if (ts.writechunk !== null && !ts.transforming) {
  4197. ts.transforming = true;
  4198. this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
  4199. } else {
  4200. // mark that we need a transform, so that any data that comes in
  4201. // will get processed, now that we've asked for it.
  4202. ts.needTransform = true;
  4203. }
  4204. };
  4205. Transform.prototype._destroy = function (err, cb) {
  4206. Duplex.prototype._destroy.call(this, err, function (err2) {
  4207. cb(err2);
  4208. });
  4209. };
  4210. function done(stream, er, data) {
  4211. if (er) return stream.emit('error', er);
  4212. if (data != null) // single equals check for both `null` and `undefined`
  4213. stream.push(data); // TODO(BridgeAR): Write a test for these two error cases
  4214. // if there's nothing in the write buffer, then that means
  4215. // that nothing more will ever be provided
  4216. if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();
  4217. if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
  4218. return stream.push(null);
  4219. }
  4220. /***/ }),
  4221. /***/ 64229:
  4222. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  4223. "use strict";
  4224. // Copyright Joyent, Inc. and other Node contributors.
  4225. //
  4226. // Permission is hereby granted, free of charge, to any person obtaining a
  4227. // copy of this software and associated documentation files (the
  4228. // "Software"), to deal in the Software without restriction, including
  4229. // without limitation the rights to use, copy, modify, merge, publish,
  4230. // distribute, sublicense, and/or sell copies of the Software, and to permit
  4231. // persons to whom the Software is furnished to do so, subject to the
  4232. // following conditions:
  4233. //
  4234. // The above copyright notice and this permission notice shall be included
  4235. // in all copies or substantial portions of the Software.
  4236. //
  4237. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  4238. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  4239. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  4240. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  4241. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  4242. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  4243. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  4244. // A bit simpler than readable streams.
  4245. // Implement an async ._write(chunk, encoding, cb), and it'll handle all
  4246. // the drain event emission and buffering.
  4247. module.exports = Writable;
  4248. /* <replacement> */
  4249. function WriteReq(chunk, encoding, cb) {
  4250. this.chunk = chunk;
  4251. this.encoding = encoding;
  4252. this.callback = cb;
  4253. this.next = null;
  4254. } // It seems a linked list but it is not
  4255. // there will be only 2 of these for each stream
  4256. function CorkedRequest(state) {
  4257. var _this = this;
  4258. this.next = null;
  4259. this.entry = null;
  4260. this.finish = function () {
  4261. onCorkedFinish(_this, state);
  4262. };
  4263. }
  4264. /* </replacement> */
  4265. /*<replacement>*/
  4266. var Duplex;
  4267. /*</replacement>*/
  4268. Writable.WritableState = WritableState;
  4269. /*<replacement>*/
  4270. var internalUtil = {
  4271. deprecate: __webpack_require__(41159)
  4272. };
  4273. /*</replacement>*/
  4274. /*<replacement>*/
  4275. var Stream = __webpack_require__(79740);
  4276. /*</replacement>*/
  4277. var Buffer = __webpack_require__(64293).Buffer;
  4278. var OurUint8Array = global.Uint8Array || function () {};
  4279. function _uint8ArrayToBuffer(chunk) {
  4280. return Buffer.from(chunk);
  4281. }
  4282. function _isUint8Array(obj) {
  4283. return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
  4284. }
  4285. var destroyImpl = __webpack_require__(61195);
  4286. var _require = __webpack_require__(82457),
  4287. getHighWaterMark = _require.getHighWaterMark;
  4288. var _require$codes = __webpack_require__(4012)/* .codes */ .q,
  4289. ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
  4290. ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
  4291. ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
  4292. ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,
  4293. ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,
  4294. ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,
  4295. ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,
  4296. ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
  4297. var errorOrDestroy = destroyImpl.errorOrDestroy;
  4298. __webpack_require__(94378)(Writable, Stream);
  4299. function nop() {}
  4300. function WritableState(options, stream, isDuplex) {
  4301. Duplex = Duplex || __webpack_require__(56753);
  4302. options = options || {}; // Duplex streams are both readable and writable, but share
  4303. // the same options object.
  4304. // However, some cases require setting options to different
  4305. // values for the readable and the writable sides of the duplex stream,
  4306. // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.
  4307. if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream
  4308. // contains buffers or objects.
  4309. this.objectMode = !!options.objectMode;
  4310. if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false
  4311. // Note: 0 is a valid value, means that we always return false if
  4312. // the entire buffer is not flushed immediately on write()
  4313. this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called
  4314. this.finalCalled = false; // drain event flag.
  4315. this.needDrain = false; // at the start of calling end()
  4316. this.ending = false; // when end() has been called, and returned
  4317. this.ended = false; // when 'finish' is emitted
  4318. this.finished = false; // has it been destroyed
  4319. this.destroyed = false; // should we decode strings into buffers before passing to _write?
  4320. // this is here so that some node-core streams can optimize string
  4321. // handling at a lower level.
  4322. var noDecode = options.decodeStrings === false;
  4323. this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string
  4324. // encoding is 'binary' so we have to make this configurable.
  4325. // Everything else in the universe uses 'utf8', though.
  4326. this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement
  4327. // of how much we're waiting to get pushed to some underlying
  4328. // socket or file.
  4329. this.length = 0; // a flag to see when we're in the middle of a write.
  4330. this.writing = false; // when true all writes will be buffered until .uncork() call
  4331. this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately,
  4332. // or on a later tick. We set this to true at first, because any
  4333. // actions that shouldn't happen until "later" should generally also
  4334. // not happen before the first write call.
  4335. this.sync = true; // a flag to know if we're processing previously buffered items, which
  4336. // may call the _write() callback in the same tick, so that we don't
  4337. // end up in an overlapped onwrite situation.
  4338. this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb)
  4339. this.onwrite = function (er) {
  4340. onwrite(stream, er);
  4341. }; // the callback that the user supplies to write(chunk,encoding,cb)
  4342. this.writecb = null; // the amount that is being written when _write is called.
  4343. this.writelen = 0;
  4344. this.bufferedRequest = null;
  4345. this.lastBufferedRequest = null; // number of pending user-supplied write callbacks
  4346. // this must be 0 before 'finish' can be emitted
  4347. this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs
  4348. // This is relevant for synchronous Transform streams
  4349. this.prefinished = false; // True if the error was already emitted and should not be thrown again
  4350. this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true.
  4351. this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end')
  4352. this.autoDestroy = !!options.autoDestroy; // count buffered requests
  4353. this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always
  4354. // one allocated and free to use, and we maintain at most two
  4355. this.corkedRequestsFree = new CorkedRequest(this);
  4356. }
  4357. WritableState.prototype.getBuffer = function getBuffer() {
  4358. var current = this.bufferedRequest;
  4359. var out = [];
  4360. while (current) {
  4361. out.push(current);
  4362. current = current.next;
  4363. }
  4364. return out;
  4365. };
  4366. (function () {
  4367. try {
  4368. Object.defineProperty(WritableState.prototype, 'buffer', {
  4369. get: internalUtil.deprecate(function writableStateBufferGetter() {
  4370. return this.getBuffer();
  4371. }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
  4372. });
  4373. } catch (_) {}
  4374. })(); // Test _writableState for inheritance to account for Duplex streams,
  4375. // whose prototype chain only points to Readable.
  4376. var realHasInstance;
  4377. if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
  4378. realHasInstance = Function.prototype[Symbol.hasInstance];
  4379. Object.defineProperty(Writable, Symbol.hasInstance, {
  4380. value: function value(object) {
  4381. if (realHasInstance.call(this, object)) return true;
  4382. if (this !== Writable) return false;
  4383. return object && object._writableState instanceof WritableState;
  4384. }
  4385. });
  4386. } else {
  4387. realHasInstance = function realHasInstance(object) {
  4388. return object instanceof this;
  4389. };
  4390. }
  4391. function Writable(options) {
  4392. Duplex = Duplex || __webpack_require__(56753); // Writable ctor is applied to Duplexes, too.
  4393. // `realHasInstance` is necessary because using plain `instanceof`
  4394. // would return false, as no `_writableState` property is attached.
  4395. // Trying to use the custom `instanceof` for Writable here will also break the
  4396. // Node.js LazyTransform implementation, which has a non-trivial getter for
  4397. // `_writableState` that would lead to infinite recursion.
  4398. // Checking for a Stream.Duplex instance is faster here instead of inside
  4399. // the WritableState constructor, at least with V8 6.5
  4400. var isDuplex = this instanceof Duplex;
  4401. if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);
  4402. this._writableState = new WritableState(options, this, isDuplex); // legacy.
  4403. this.writable = true;
  4404. if (options) {
  4405. if (typeof options.write === 'function') this._write = options.write;
  4406. if (typeof options.writev === 'function') this._writev = options.writev;
  4407. if (typeof options.destroy === 'function') this._destroy = options.destroy;
  4408. if (typeof options.final === 'function') this._final = options.final;
  4409. }
  4410. Stream.call(this);
  4411. } // Otherwise people can pipe Writable streams, which is just wrong.
  4412. Writable.prototype.pipe = function () {
  4413. errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
  4414. };
  4415. function writeAfterEnd(stream, cb) {
  4416. var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb
  4417. errorOrDestroy(stream, er);
  4418. process.nextTick(cb, er);
  4419. } // Checks that a user-supplied chunk is valid, especially for the particular
  4420. // mode the stream is in. Currently this means that `null` is never accepted
  4421. // and undefined/non-string values are only allowed in object mode.
  4422. function validChunk(stream, state, chunk, cb) {
  4423. var er;
  4424. if (chunk === null) {
  4425. er = new ERR_STREAM_NULL_VALUES();
  4426. } else if (typeof chunk !== 'string' && !state.objectMode) {
  4427. er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);
  4428. }
  4429. if (er) {
  4430. errorOrDestroy(stream, er);
  4431. process.nextTick(cb, er);
  4432. return false;
  4433. }
  4434. return true;
  4435. }
  4436. Writable.prototype.write = function (chunk, encoding, cb) {
  4437. var state = this._writableState;
  4438. var ret = false;
  4439. var isBuf = !state.objectMode && _isUint8Array(chunk);
  4440. if (isBuf && !Buffer.isBuffer(chunk)) {
  4441. chunk = _uint8ArrayToBuffer(chunk);
  4442. }
  4443. if (typeof encoding === 'function') {
  4444. cb = encoding;
  4445. encoding = null;
  4446. }
  4447. if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
  4448. if (typeof cb !== 'function') cb = nop;
  4449. if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
  4450. state.pendingcb++;
  4451. ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
  4452. }
  4453. return ret;
  4454. };
  4455. Writable.prototype.cork = function () {
  4456. this._writableState.corked++;
  4457. };
  4458. Writable.prototype.uncork = function () {
  4459. var state = this._writableState;
  4460. if (state.corked) {
  4461. state.corked--;
  4462. if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
  4463. }
  4464. };
  4465. Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
  4466. // node::ParseEncoding() requires lower case.
  4467. if (typeof encoding === 'string') encoding = encoding.toLowerCase();
  4468. if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);
  4469. this._writableState.defaultEncoding = encoding;
  4470. return this;
  4471. };
  4472. Object.defineProperty(Writable.prototype, 'writableBuffer', {
  4473. // making it explicit this property is not enumerable
  4474. // because otherwise some prototype manipulation in
  4475. // userland will fail
  4476. enumerable: false,
  4477. get: function get() {
  4478. return this._writableState && this._writableState.getBuffer();
  4479. }
  4480. });
  4481. function decodeChunk(state, chunk, encoding) {
  4482. if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
  4483. chunk = Buffer.from(chunk, encoding);
  4484. }
  4485. return chunk;
  4486. }
  4487. Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
  4488. // making it explicit this property is not enumerable
  4489. // because otherwise some prototype manipulation in
  4490. // userland will fail
  4491. enumerable: false,
  4492. get: function get() {
  4493. return this._writableState.highWaterMark;
  4494. }
  4495. }); // if we're already writing something, then just put this
  4496. // in the queue, and wait our turn. Otherwise, call _write
  4497. // If we return false, then we need a drain event, so set that flag.
  4498. function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
  4499. if (!isBuf) {
  4500. var newChunk = decodeChunk(state, chunk, encoding);
  4501. if (chunk !== newChunk) {
  4502. isBuf = true;
  4503. encoding = 'buffer';
  4504. chunk = newChunk;
  4505. }
  4506. }
  4507. var len = state.objectMode ? 1 : chunk.length;
  4508. state.length += len;
  4509. var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false.
  4510. if (!ret) state.needDrain = true;
  4511. if (state.writing || state.corked) {
  4512. var last = state.lastBufferedRequest;
  4513. state.lastBufferedRequest = {
  4514. chunk: chunk,
  4515. encoding: encoding,
  4516. isBuf: isBuf,
  4517. callback: cb,
  4518. next: null
  4519. };
  4520. if (last) {
  4521. last.next = state.lastBufferedRequest;
  4522. } else {
  4523. state.bufferedRequest = state.lastBufferedRequest;
  4524. }
  4525. state.bufferedRequestCount += 1;
  4526. } else {
  4527. doWrite(stream, state, false, len, chunk, encoding, cb);
  4528. }
  4529. return ret;
  4530. }
  4531. function doWrite(stream, state, writev, len, chunk, encoding, cb) {
  4532. state.writelen = len;
  4533. state.writecb = cb;
  4534. state.writing = true;
  4535. state.sync = true;
  4536. if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
  4537. state.sync = false;
  4538. }
  4539. function onwriteError(stream, state, sync, er, cb) {
  4540. --state.pendingcb;
  4541. if (sync) {
  4542. // defer the callback if we are being called synchronously
  4543. // to avoid piling up things on the stack
  4544. process.nextTick(cb, er); // this can emit finish, and it will always happen
  4545. // after error
  4546. process.nextTick(finishMaybe, stream, state);
  4547. stream._writableState.errorEmitted = true;
  4548. errorOrDestroy(stream, er);
  4549. } else {
  4550. // the caller expect this to happen before if
  4551. // it is async
  4552. cb(er);
  4553. stream._writableState.errorEmitted = true;
  4554. errorOrDestroy(stream, er); // this can emit finish, but finish must
  4555. // always follow error
  4556. finishMaybe(stream, state);
  4557. }
  4558. }
  4559. function onwriteStateUpdate(state) {
  4560. state.writing = false;
  4561. state.writecb = null;
  4562. state.length -= state.writelen;
  4563. state.writelen = 0;
  4564. }
  4565. function onwrite(stream, er) {
  4566. var state = stream._writableState;
  4567. var sync = state.sync;
  4568. var cb = state.writecb;
  4569. if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();
  4570. onwriteStateUpdate(state);
  4571. if (er) onwriteError(stream, state, sync, er, cb);else {
  4572. // Check if we're actually ready to finish, but don't emit yet
  4573. var finished = needFinish(state) || stream.destroyed;
  4574. if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
  4575. clearBuffer(stream, state);
  4576. }
  4577. if (sync) {
  4578. process.nextTick(afterWrite, stream, state, finished, cb);
  4579. } else {
  4580. afterWrite(stream, state, finished, cb);
  4581. }
  4582. }
  4583. }
  4584. function afterWrite(stream, state, finished, cb) {
  4585. if (!finished) onwriteDrain(stream, state);
  4586. state.pendingcb--;
  4587. cb();
  4588. finishMaybe(stream, state);
  4589. } // Must force callback to be called on nextTick, so that we don't
  4590. // emit 'drain' before the write() consumer gets the 'false' return
  4591. // value, and has a chance to attach a 'drain' listener.
  4592. function onwriteDrain(stream, state) {
  4593. if (state.length === 0 && state.needDrain) {
  4594. state.needDrain = false;
  4595. stream.emit('drain');
  4596. }
  4597. } // if there's something in the buffer waiting, then process it
  4598. function clearBuffer(stream, state) {
  4599. state.bufferProcessing = true;
  4600. var entry = state.bufferedRequest;
  4601. if (stream._writev && entry && entry.next) {
  4602. // Fast case, write everything using _writev()
  4603. var l = state.bufferedRequestCount;
  4604. var buffer = new Array(l);
  4605. var holder = state.corkedRequestsFree;
  4606. holder.entry = entry;
  4607. var count = 0;
  4608. var allBuffers = true;
  4609. while (entry) {
  4610. buffer[count] = entry;
  4611. if (!entry.isBuf) allBuffers = false;
  4612. entry = entry.next;
  4613. count += 1;
  4614. }
  4615. buffer.allBuffers = allBuffers;
  4616. doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time
  4617. // as the hot path ends with doWrite
  4618. state.pendingcb++;
  4619. state.lastBufferedRequest = null;
  4620. if (holder.next) {
  4621. state.corkedRequestsFree = holder.next;
  4622. holder.next = null;
  4623. } else {
  4624. state.corkedRequestsFree = new CorkedRequest(state);
  4625. }
  4626. state.bufferedRequestCount = 0;
  4627. } else {
  4628. // Slow case, write chunks one-by-one
  4629. while (entry) {
  4630. var chunk = entry.chunk;
  4631. var encoding = entry.encoding;
  4632. var cb = entry.callback;
  4633. var len = state.objectMode ? 1 : chunk.length;
  4634. doWrite(stream, state, false, len, chunk, encoding, cb);
  4635. entry = entry.next;
  4636. state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then
  4637. // it means that we need to wait until it does.
  4638. // also, that means that the chunk and cb are currently
  4639. // being processed, so move the buffer counter past them.
  4640. if (state.writing) {
  4641. break;
  4642. }
  4643. }
  4644. if (entry === null) state.lastBufferedRequest = null;
  4645. }
  4646. state.bufferedRequest = entry;
  4647. state.bufferProcessing = false;
  4648. }
  4649. Writable.prototype._write = function (chunk, encoding, cb) {
  4650. cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));
  4651. };
  4652. Writable.prototype._writev = null;
  4653. Writable.prototype.end = function (chunk, encoding, cb) {
  4654. var state = this._writableState;
  4655. if (typeof chunk === 'function') {
  4656. cb = chunk;
  4657. chunk = null;
  4658. encoding = null;
  4659. } else if (typeof encoding === 'function') {
  4660. cb = encoding;
  4661. encoding = null;
  4662. }
  4663. if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks
  4664. if (state.corked) {
  4665. state.corked = 1;
  4666. this.uncork();
  4667. } // ignore unnecessary end() calls.
  4668. if (!state.ending) endWritable(this, state, cb);
  4669. return this;
  4670. };
  4671. Object.defineProperty(Writable.prototype, 'writableLength', {
  4672. // making it explicit this property is not enumerable
  4673. // because otherwise some prototype manipulation in
  4674. // userland will fail
  4675. enumerable: false,
  4676. get: function get() {
  4677. return this._writableState.length;
  4678. }
  4679. });
  4680. function needFinish(state) {
  4681. return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
  4682. }
  4683. function callFinal(stream, state) {
  4684. stream._final(function (err) {
  4685. state.pendingcb--;
  4686. if (err) {
  4687. errorOrDestroy(stream, err);
  4688. }
  4689. state.prefinished = true;
  4690. stream.emit('prefinish');
  4691. finishMaybe(stream, state);
  4692. });
  4693. }
  4694. function prefinish(stream, state) {
  4695. if (!state.prefinished && !state.finalCalled) {
  4696. if (typeof stream._final === 'function' && !state.destroyed) {
  4697. state.pendingcb++;
  4698. state.finalCalled = true;
  4699. process.nextTick(callFinal, stream, state);
  4700. } else {
  4701. state.prefinished = true;
  4702. stream.emit('prefinish');
  4703. }
  4704. }
  4705. }
  4706. function finishMaybe(stream, state) {
  4707. var need = needFinish(state);
  4708. if (need) {
  4709. prefinish(stream, state);
  4710. if (state.pendingcb === 0) {
  4711. state.finished = true;
  4712. stream.emit('finish');
  4713. if (state.autoDestroy) {
  4714. // In case of duplex streams we need a way to detect
  4715. // if the readable side is ready for autoDestroy as well
  4716. var rState = stream._readableState;
  4717. if (!rState || rState.autoDestroy && rState.endEmitted) {
  4718. stream.destroy();
  4719. }
  4720. }
  4721. }
  4722. }
  4723. return need;
  4724. }
  4725. function endWritable(stream, state, cb) {
  4726. state.ending = true;
  4727. finishMaybe(stream, state);
  4728. if (cb) {
  4729. if (state.finished) process.nextTick(cb);else stream.once('finish', cb);
  4730. }
  4731. state.ended = true;
  4732. stream.writable = false;
  4733. }
  4734. function onCorkedFinish(corkReq, state, err) {
  4735. var entry = corkReq.entry;
  4736. corkReq.entry = null;
  4737. while (entry) {
  4738. var cb = entry.callback;
  4739. state.pendingcb--;
  4740. cb(err);
  4741. entry = entry.next;
  4742. } // reuse the free corkReq.
  4743. state.corkedRequestsFree.next = corkReq;
  4744. }
  4745. Object.defineProperty(Writable.prototype, 'destroyed', {
  4746. // making it explicit this property is not enumerable
  4747. // because otherwise some prototype manipulation in
  4748. // userland will fail
  4749. enumerable: false,
  4750. get: function get() {
  4751. if (this._writableState === undefined) {
  4752. return false;
  4753. }
  4754. return this._writableState.destroyed;
  4755. },
  4756. set: function set(value) {
  4757. // we ignore the value if the stream
  4758. // has not been initialized yet
  4759. if (!this._writableState) {
  4760. return;
  4761. } // backward compatibility, the user is explicitly
  4762. // managing destroyed
  4763. this._writableState.destroyed = value;
  4764. }
  4765. });
  4766. Writable.prototype.destroy = destroyImpl.destroy;
  4767. Writable.prototype._undestroy = destroyImpl.undestroy;
  4768. Writable.prototype._destroy = function (err, cb) {
  4769. cb(err);
  4770. };
  4771. /***/ }),
  4772. /***/ 45850:
  4773. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  4774. "use strict";
  4775. var _Object$setPrototypeO;
  4776. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  4777. var finished = __webpack_require__(8610);
  4778. var kLastResolve = Symbol('lastResolve');
  4779. var kLastReject = Symbol('lastReject');
  4780. var kError = Symbol('error');
  4781. var kEnded = Symbol('ended');
  4782. var kLastPromise = Symbol('lastPromise');
  4783. var kHandlePromise = Symbol('handlePromise');
  4784. var kStream = Symbol('stream');
  4785. function createIterResult(value, done) {
  4786. return {
  4787. value: value,
  4788. done: done
  4789. };
  4790. }
  4791. function readAndResolve(iter) {
  4792. var resolve = iter[kLastResolve];
  4793. if (resolve !== null) {
  4794. var data = iter[kStream].read(); // we defer if data is null
  4795. // we can be expecting either 'end' or
  4796. // 'error'
  4797. if (data !== null) {
  4798. iter[kLastPromise] = null;
  4799. iter[kLastResolve] = null;
  4800. iter[kLastReject] = null;
  4801. resolve(createIterResult(data, false));
  4802. }
  4803. }
  4804. }
  4805. function onReadable(iter) {
  4806. // we wait for the next tick, because it might
  4807. // emit an error with process.nextTick
  4808. process.nextTick(readAndResolve, iter);
  4809. }
  4810. function wrapForNext(lastPromise, iter) {
  4811. return function (resolve, reject) {
  4812. lastPromise.then(function () {
  4813. if (iter[kEnded]) {
  4814. resolve(createIterResult(undefined, true));
  4815. return;
  4816. }
  4817. iter[kHandlePromise](resolve, reject);
  4818. }, reject);
  4819. };
  4820. }
  4821. var AsyncIteratorPrototype = Object.getPrototypeOf(function () {});
  4822. var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {
  4823. get stream() {
  4824. return this[kStream];
  4825. },
  4826. next: function next() {
  4827. var _this = this;
  4828. // if we have detected an error in the meanwhile
  4829. // reject straight away
  4830. var error = this[kError];
  4831. if (error !== null) {
  4832. return Promise.reject(error);
  4833. }
  4834. if (this[kEnded]) {
  4835. return Promise.resolve(createIterResult(undefined, true));
  4836. }
  4837. if (this[kStream].destroyed) {
  4838. // We need to defer via nextTick because if .destroy(err) is
  4839. // called, the error will be emitted via nextTick, and
  4840. // we cannot guarantee that there is no error lingering around
  4841. // waiting to be emitted.
  4842. return new Promise(function (resolve, reject) {
  4843. process.nextTick(function () {
  4844. if (_this[kError]) {
  4845. reject(_this[kError]);
  4846. } else {
  4847. resolve(createIterResult(undefined, true));
  4848. }
  4849. });
  4850. });
  4851. } // if we have multiple next() calls
  4852. // we will wait for the previous Promise to finish
  4853. // this logic is optimized to support for await loops,
  4854. // where next() is only called once at a time
  4855. var lastPromise = this[kLastPromise];
  4856. var promise;
  4857. if (lastPromise) {
  4858. promise = new Promise(wrapForNext(lastPromise, this));
  4859. } else {
  4860. // fast path needed to support multiple this.push()
  4861. // without triggering the next() queue
  4862. var data = this[kStream].read();
  4863. if (data !== null) {
  4864. return Promise.resolve(createIterResult(data, false));
  4865. }
  4866. promise = new Promise(this[kHandlePromise]);
  4867. }
  4868. this[kLastPromise] = promise;
  4869. return promise;
  4870. }
  4871. }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () {
  4872. return this;
  4873. }), _defineProperty(_Object$setPrototypeO, "return", function _return() {
  4874. var _this2 = this;
  4875. // destroy(err, cb) is a private API
  4876. // we can guarantee we have that here, because we control the
  4877. // Readable class this is attached to
  4878. return new Promise(function (resolve, reject) {
  4879. _this2[kStream].destroy(null, function (err) {
  4880. if (err) {
  4881. reject(err);
  4882. return;
  4883. }
  4884. resolve(createIterResult(undefined, true));
  4885. });
  4886. });
  4887. }), _Object$setPrototypeO), AsyncIteratorPrototype);
  4888. var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {
  4889. var _Object$create;
  4890. var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {
  4891. value: stream,
  4892. writable: true
  4893. }), _defineProperty(_Object$create, kLastResolve, {
  4894. value: null,
  4895. writable: true
  4896. }), _defineProperty(_Object$create, kLastReject, {
  4897. value: null,
  4898. writable: true
  4899. }), _defineProperty(_Object$create, kError, {
  4900. value: null,
  4901. writable: true
  4902. }), _defineProperty(_Object$create, kEnded, {
  4903. value: stream._readableState.endEmitted,
  4904. writable: true
  4905. }), _defineProperty(_Object$create, kHandlePromise, {
  4906. value: function value(resolve, reject) {
  4907. var data = iterator[kStream].read();
  4908. if (data) {
  4909. iterator[kLastPromise] = null;
  4910. iterator[kLastResolve] = null;
  4911. iterator[kLastReject] = null;
  4912. resolve(createIterResult(data, false));
  4913. } else {
  4914. iterator[kLastResolve] = resolve;
  4915. iterator[kLastReject] = reject;
  4916. }
  4917. },
  4918. writable: true
  4919. }), _Object$create));
  4920. iterator[kLastPromise] = null;
  4921. finished(stream, function (err) {
  4922. if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {
  4923. var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise
  4924. // returned by next() and store the error
  4925. if (reject !== null) {
  4926. iterator[kLastPromise] = null;
  4927. iterator[kLastResolve] = null;
  4928. iterator[kLastReject] = null;
  4929. reject(err);
  4930. }
  4931. iterator[kError] = err;
  4932. return;
  4933. }
  4934. var resolve = iterator[kLastResolve];
  4935. if (resolve !== null) {
  4936. iterator[kLastPromise] = null;
  4937. iterator[kLastResolve] = null;
  4938. iterator[kLastReject] = null;
  4939. resolve(createIterResult(undefined, true));
  4940. }
  4941. iterator[kEnded] = true;
  4942. });
  4943. stream.on('readable', onReadable.bind(null, iterator));
  4944. return iterator;
  4945. };
  4946. module.exports = createReadableStreamAsyncIterator;
  4947. /***/ }),
  4948. /***/ 57327:
  4949. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  4950. "use strict";
  4951. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
  4952. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  4953. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  4954. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4955. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4956. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4957. var _require = __webpack_require__(64293),
  4958. Buffer = _require.Buffer;
  4959. var _require2 = __webpack_require__(31669),
  4960. inspect = _require2.inspect;
  4961. var custom = inspect && inspect.custom || 'inspect';
  4962. function copyBuffer(src, target, offset) {
  4963. Buffer.prototype.copy.call(src, target, offset);
  4964. }
  4965. module.exports =
  4966. /*#__PURE__*/
  4967. function () {
  4968. function BufferList() {
  4969. _classCallCheck(this, BufferList);
  4970. this.head = null;
  4971. this.tail = null;
  4972. this.length = 0;
  4973. }
  4974. _createClass(BufferList, [{
  4975. key: "push",
  4976. value: function push(v) {
  4977. var entry = {
  4978. data: v,
  4979. next: null
  4980. };
  4981. if (this.length > 0) this.tail.next = entry;else this.head = entry;
  4982. this.tail = entry;
  4983. ++this.length;
  4984. }
  4985. }, {
  4986. key: "unshift",
  4987. value: function unshift(v) {
  4988. var entry = {
  4989. data: v,
  4990. next: this.head
  4991. };
  4992. if (this.length === 0) this.tail = entry;
  4993. this.head = entry;
  4994. ++this.length;
  4995. }
  4996. }, {
  4997. key: "shift",
  4998. value: function shift() {
  4999. if (this.length === 0) return;
  5000. var ret = this.head.data;
  5001. if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
  5002. --this.length;
  5003. return ret;
  5004. }
  5005. }, {
  5006. key: "clear",
  5007. value: function clear() {
  5008. this.head = this.tail = null;
  5009. this.length = 0;
  5010. }
  5011. }, {
  5012. key: "join",
  5013. value: function join(s) {
  5014. if (this.length === 0) return '';
  5015. var p = this.head;
  5016. var ret = '' + p.data;
  5017. while (p = p.next) {
  5018. ret += s + p.data;
  5019. }
  5020. return ret;
  5021. }
  5022. }, {
  5023. key: "concat",
  5024. value: function concat(n) {
  5025. if (this.length === 0) return Buffer.alloc(0);
  5026. var ret = Buffer.allocUnsafe(n >>> 0);
  5027. var p = this.head;
  5028. var i = 0;
  5029. while (p) {
  5030. copyBuffer(p.data, ret, i);
  5031. i += p.data.length;
  5032. p = p.next;
  5033. }
  5034. return ret;
  5035. } // Consumes a specified amount of bytes or characters from the buffered data.
  5036. }, {
  5037. key: "consume",
  5038. value: function consume(n, hasStrings) {
  5039. var ret;
  5040. if (n < this.head.data.length) {
  5041. // `slice` is the same for buffers and strings.
  5042. ret = this.head.data.slice(0, n);
  5043. this.head.data = this.head.data.slice(n);
  5044. } else if (n === this.head.data.length) {
  5045. // First chunk is a perfect match.
  5046. ret = this.shift();
  5047. } else {
  5048. // Result spans more than one buffer.
  5049. ret = hasStrings ? this._getString(n) : this._getBuffer(n);
  5050. }
  5051. return ret;
  5052. }
  5053. }, {
  5054. key: "first",
  5055. value: function first() {
  5056. return this.head.data;
  5057. } // Consumes a specified amount of characters from the buffered data.
  5058. }, {
  5059. key: "_getString",
  5060. value: function _getString(n) {
  5061. var p = this.head;
  5062. var c = 1;
  5063. var ret = p.data;
  5064. n -= ret.length;
  5065. while (p = p.next) {
  5066. var str = p.data;
  5067. var nb = n > str.length ? str.length : n;
  5068. if (nb === str.length) ret += str;else ret += str.slice(0, n);
  5069. n -= nb;
  5070. if (n === 0) {
  5071. if (nb === str.length) {
  5072. ++c;
  5073. if (p.next) this.head = p.next;else this.head = this.tail = null;
  5074. } else {
  5075. this.head = p;
  5076. p.data = str.slice(nb);
  5077. }
  5078. break;
  5079. }
  5080. ++c;
  5081. }
  5082. this.length -= c;
  5083. return ret;
  5084. } // Consumes a specified amount of bytes from the buffered data.
  5085. }, {
  5086. key: "_getBuffer",
  5087. value: function _getBuffer(n) {
  5088. var ret = Buffer.allocUnsafe(n);
  5089. var p = this.head;
  5090. var c = 1;
  5091. p.data.copy(ret);
  5092. n -= p.data.length;
  5093. while (p = p.next) {
  5094. var buf = p.data;
  5095. var nb = n > buf.length ? buf.length : n;
  5096. buf.copy(ret, ret.length - n, 0, nb);
  5097. n -= nb;
  5098. if (n === 0) {
  5099. if (nb === buf.length) {
  5100. ++c;
  5101. if (p.next) this.head = p.next;else this.head = this.tail = null;
  5102. } else {
  5103. this.head = p;
  5104. p.data = buf.slice(nb);
  5105. }
  5106. break;
  5107. }
  5108. ++c;
  5109. }
  5110. this.length -= c;
  5111. return ret;
  5112. } // Make sure the linked list only shows the minimal necessary information.
  5113. }, {
  5114. key: custom,
  5115. value: function value(_, options) {
  5116. return inspect(this, _objectSpread({}, options, {
  5117. // Only inspect one level.
  5118. depth: 0,
  5119. // It should not recurse.
  5120. customInspect: false
  5121. }));
  5122. }
  5123. }]);
  5124. return BufferList;
  5125. }();
  5126. /***/ }),
  5127. /***/ 61195:
  5128. /***/ ((module) => {
  5129. "use strict";
  5130. // undocumented cb() API, needed for core, not for public API
  5131. function destroy(err, cb) {
  5132. var _this = this;
  5133. var readableDestroyed = this._readableState && this._readableState.destroyed;
  5134. var writableDestroyed = this._writableState && this._writableState.destroyed;
  5135. if (readableDestroyed || writableDestroyed) {
  5136. if (cb) {
  5137. cb(err);
  5138. } else if (err) {
  5139. if (!this._writableState) {
  5140. process.nextTick(emitErrorNT, this, err);
  5141. } else if (!this._writableState.errorEmitted) {
  5142. this._writableState.errorEmitted = true;
  5143. process.nextTick(emitErrorNT, this, err);
  5144. }
  5145. }
  5146. return this;
  5147. } // we set destroyed to true before firing error callbacks in order
  5148. // to make it re-entrance safe in case destroy() is called within callbacks
  5149. if (this._readableState) {
  5150. this._readableState.destroyed = true;
  5151. } // if this is a duplex stream mark the writable part as destroyed as well
  5152. if (this._writableState) {
  5153. this._writableState.destroyed = true;
  5154. }
  5155. this._destroy(err || null, function (err) {
  5156. if (!cb && err) {
  5157. if (!_this._writableState) {
  5158. process.nextTick(emitErrorAndCloseNT, _this, err);
  5159. } else if (!_this._writableState.errorEmitted) {
  5160. _this._writableState.errorEmitted = true;
  5161. process.nextTick(emitErrorAndCloseNT, _this, err);
  5162. } else {
  5163. process.nextTick(emitCloseNT, _this);
  5164. }
  5165. } else if (cb) {
  5166. process.nextTick(emitCloseNT, _this);
  5167. cb(err);
  5168. } else {
  5169. process.nextTick(emitCloseNT, _this);
  5170. }
  5171. });
  5172. return this;
  5173. }
  5174. function emitErrorAndCloseNT(self, err) {
  5175. emitErrorNT(self, err);
  5176. emitCloseNT(self);
  5177. }
  5178. function emitCloseNT(self) {
  5179. if (self._writableState && !self._writableState.emitClose) return;
  5180. if (self._readableState && !self._readableState.emitClose) return;
  5181. self.emit('close');
  5182. }
  5183. function undestroy() {
  5184. if (this._readableState) {
  5185. this._readableState.destroyed = false;
  5186. this._readableState.reading = false;
  5187. this._readableState.ended = false;
  5188. this._readableState.endEmitted = false;
  5189. }
  5190. if (this._writableState) {
  5191. this._writableState.destroyed = false;
  5192. this._writableState.ended = false;
  5193. this._writableState.ending = false;
  5194. this._writableState.finalCalled = false;
  5195. this._writableState.prefinished = false;
  5196. this._writableState.finished = false;
  5197. this._writableState.errorEmitted = false;
  5198. }
  5199. }
  5200. function emitErrorNT(self, err) {
  5201. self.emit('error', err);
  5202. }
  5203. function errorOrDestroy(stream, err) {
  5204. // We have tests that rely on errors being emitted
  5205. // in the same tick, so changing this is semver major.
  5206. // For now when you opt-in to autoDestroy we allow
  5207. // the error to be emitted nextTick. In a future
  5208. // semver major update we should change the default to this.
  5209. var rState = stream._readableState;
  5210. var wState = stream._writableState;
  5211. if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
  5212. }
  5213. module.exports = {
  5214. destroy: destroy,
  5215. undestroy: undestroy,
  5216. errorOrDestroy: errorOrDestroy
  5217. };
  5218. /***/ }),
  5219. /***/ 8610:
  5220. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  5221. "use strict";
  5222. // Ported from https://github.com/mafintosh/end-of-stream with
  5223. // permission from the author, Mathias Buus (@mafintosh).
  5224. var ERR_STREAM_PREMATURE_CLOSE = __webpack_require__(4012)/* .codes.ERR_STREAM_PREMATURE_CLOSE */ .q.ERR_STREAM_PREMATURE_CLOSE;
  5225. function once(callback) {
  5226. var called = false;
  5227. return function () {
  5228. if (called) return;
  5229. called = true;
  5230. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  5231. args[_key] = arguments[_key];
  5232. }
  5233. callback.apply(this, args);
  5234. };
  5235. }
  5236. function noop() {}
  5237. function isRequest(stream) {
  5238. return stream.setHeader && typeof stream.abort === 'function';
  5239. }
  5240. function eos(stream, opts, callback) {
  5241. if (typeof opts === 'function') return eos(stream, null, opts);
  5242. if (!opts) opts = {};
  5243. callback = once(callback || noop);
  5244. var readable = opts.readable || opts.readable !== false && stream.readable;
  5245. var writable = opts.writable || opts.writable !== false && stream.writable;
  5246. var onlegacyfinish = function onlegacyfinish() {
  5247. if (!stream.writable) onfinish();
  5248. };
  5249. var writableEnded = stream._writableState && stream._writableState.finished;
  5250. var onfinish = function onfinish() {
  5251. writable = false;
  5252. writableEnded = true;
  5253. if (!readable) callback.call(stream);
  5254. };
  5255. var readableEnded = stream._readableState && stream._readableState.endEmitted;
  5256. var onend = function onend() {
  5257. readable = false;
  5258. readableEnded = true;
  5259. if (!writable) callback.call(stream);
  5260. };
  5261. var onerror = function onerror(err) {
  5262. callback.call(stream, err);
  5263. };
  5264. var onclose = function onclose() {
  5265. var err;
  5266. if (readable && !readableEnded) {
  5267. if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
  5268. return callback.call(stream, err);
  5269. }
  5270. if (writable && !writableEnded) {
  5271. if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
  5272. return callback.call(stream, err);
  5273. }
  5274. };
  5275. var onrequest = function onrequest() {
  5276. stream.req.on('finish', onfinish);
  5277. };
  5278. if (isRequest(stream)) {
  5279. stream.on('complete', onfinish);
  5280. stream.on('abort', onclose);
  5281. if (stream.req) onrequest();else stream.on('request', onrequest);
  5282. } else if (writable && !stream._writableState) {
  5283. // legacy streams
  5284. stream.on('end', onlegacyfinish);
  5285. stream.on('close', onlegacyfinish);
  5286. }
  5287. stream.on('end', onend);
  5288. stream.on('finish', onfinish);
  5289. if (opts.error !== false) stream.on('error', onerror);
  5290. stream.on('close', onclose);
  5291. return function () {
  5292. stream.removeListener('complete', onfinish);
  5293. stream.removeListener('abort', onclose);
  5294. stream.removeListener('request', onrequest);
  5295. if (stream.req) stream.req.removeListener('finish', onfinish);
  5296. stream.removeListener('end', onlegacyfinish);
  5297. stream.removeListener('close', onlegacyfinish);
  5298. stream.removeListener('finish', onfinish);
  5299. stream.removeListener('end', onend);
  5300. stream.removeListener('error', onerror);
  5301. stream.removeListener('close', onclose);
  5302. };
  5303. }
  5304. module.exports = eos;
  5305. /***/ }),
  5306. /***/ 96307:
  5307. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  5308. "use strict";
  5309. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  5310. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  5311. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
  5312. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  5313. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  5314. var ERR_INVALID_ARG_TYPE = __webpack_require__(4012)/* .codes.ERR_INVALID_ARG_TYPE */ .q.ERR_INVALID_ARG_TYPE;
  5315. function from(Readable, iterable, opts) {
  5316. var iterator;
  5317. if (iterable && typeof iterable.next === 'function') {
  5318. iterator = iterable;
  5319. } else if (iterable && iterable[Symbol.asyncIterator]) iterator = iterable[Symbol.asyncIterator]();else if (iterable && iterable[Symbol.iterator]) iterator = iterable[Symbol.iterator]();else throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable);
  5320. var readable = new Readable(_objectSpread({
  5321. objectMode: true
  5322. }, opts)); // Reading boolean to protect against _read
  5323. // being called before last iteration completion.
  5324. var reading = false;
  5325. readable._read = function () {
  5326. if (!reading) {
  5327. reading = true;
  5328. next();
  5329. }
  5330. };
  5331. function next() {
  5332. return _next2.apply(this, arguments);
  5333. }
  5334. function _next2() {
  5335. _next2 = _asyncToGenerator(function* () {
  5336. try {
  5337. var _ref = yield iterator.next(),
  5338. value = _ref.value,
  5339. done = _ref.done;
  5340. if (done) {
  5341. readable.push(null);
  5342. } else if (readable.push((yield value))) {
  5343. next();
  5344. } else {
  5345. reading = false;
  5346. }
  5347. } catch (err) {
  5348. readable.destroy(err);
  5349. }
  5350. });
  5351. return _next2.apply(this, arguments);
  5352. }
  5353. return readable;
  5354. }
  5355. module.exports = from;
  5356. /***/ }),
  5357. /***/ 59946:
  5358. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  5359. "use strict";
  5360. // Ported from https://github.com/mafintosh/pump with
  5361. // permission from the author, Mathias Buus (@mafintosh).
  5362. var eos;
  5363. function once(callback) {
  5364. var called = false;
  5365. return function () {
  5366. if (called) return;
  5367. called = true;
  5368. callback.apply(void 0, arguments);
  5369. };
  5370. }
  5371. var _require$codes = __webpack_require__(4012)/* .codes */ .q,
  5372. ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,
  5373. ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
  5374. function noop(err) {
  5375. // Rethrow the error if it exists to avoid swallowing it
  5376. if (err) throw err;
  5377. }
  5378. function isRequest(stream) {
  5379. return stream.setHeader && typeof stream.abort === 'function';
  5380. }
  5381. function destroyer(stream, reading, writing, callback) {
  5382. callback = once(callback);
  5383. var closed = false;
  5384. stream.on('close', function () {
  5385. closed = true;
  5386. });
  5387. if (eos === undefined) eos = __webpack_require__(8610);
  5388. eos(stream, {
  5389. readable: reading,
  5390. writable: writing
  5391. }, function (err) {
  5392. if (err) return callback(err);
  5393. closed = true;
  5394. callback();
  5395. });
  5396. var destroyed = false;
  5397. return function (err) {
  5398. if (closed) return;
  5399. if (destroyed) return;
  5400. destroyed = true; // request.destroy just do .end - .abort is what we want
  5401. if (isRequest(stream)) return stream.abort();
  5402. if (typeof stream.destroy === 'function') return stream.destroy();
  5403. callback(err || new ERR_STREAM_DESTROYED('pipe'));
  5404. };
  5405. }
  5406. function call(fn) {
  5407. fn();
  5408. }
  5409. function pipe(from, to) {
  5410. return from.pipe(to);
  5411. }
  5412. function popCallback(streams) {
  5413. if (!streams.length) return noop;
  5414. if (typeof streams[streams.length - 1] !== 'function') return noop;
  5415. return streams.pop();
  5416. }
  5417. function pipeline() {
  5418. for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
  5419. streams[_key] = arguments[_key];
  5420. }
  5421. var callback = popCallback(streams);
  5422. if (Array.isArray(streams[0])) streams = streams[0];
  5423. if (streams.length < 2) {
  5424. throw new ERR_MISSING_ARGS('streams');
  5425. }
  5426. var error;
  5427. var destroys = streams.map(function (stream, i) {
  5428. var reading = i < streams.length - 1;
  5429. var writing = i > 0;
  5430. return destroyer(stream, reading, writing, function (err) {
  5431. if (!error) error = err;
  5432. if (err) destroys.forEach(call);
  5433. if (reading) return;
  5434. destroys.forEach(call);
  5435. callback(error);
  5436. });
  5437. });
  5438. return streams.reduce(pipe);
  5439. }
  5440. module.exports = pipeline;
  5441. /***/ }),
  5442. /***/ 82457:
  5443. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  5444. "use strict";
  5445. var ERR_INVALID_OPT_VALUE = __webpack_require__(4012)/* .codes.ERR_INVALID_OPT_VALUE */ .q.ERR_INVALID_OPT_VALUE;
  5446. function highWaterMarkFrom(options, isDuplex, duplexKey) {
  5447. return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
  5448. }
  5449. function getHighWaterMark(state, options, duplexKey, isDuplex) {
  5450. var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
  5451. if (hwm != null) {
  5452. if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
  5453. var name = isDuplex ? duplexKey : 'highWaterMark';
  5454. throw new ERR_INVALID_OPT_VALUE(name, hwm);
  5455. }
  5456. return Math.floor(hwm);
  5457. } // Default value
  5458. return state.objectMode ? 16 : 16 * 1024;
  5459. }
  5460. module.exports = {
  5461. getHighWaterMark: getHighWaterMark
  5462. };
  5463. /***/ }),
  5464. /***/ 79740:
  5465. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  5466. module.exports = __webpack_require__(92413);
  5467. /***/ }),
  5468. /***/ 11451:
  5469. /***/ ((module, exports, __webpack_require__) => {
  5470. var Stream = __webpack_require__(92413);
  5471. if (process.env.READABLE_STREAM === 'disable' && Stream) {
  5472. module.exports = Stream.Readable;
  5473. Object.assign(module.exports, Stream);
  5474. module.exports.Stream = Stream;
  5475. } else {
  5476. exports = module.exports = __webpack_require__(79481);
  5477. exports.Stream = Stream || exports;
  5478. exports.Readable = exports;
  5479. exports.Writable = __webpack_require__(64229);
  5480. exports.Duplex = __webpack_require__(56753);
  5481. exports.Transform = __webpack_require__(74605);
  5482. exports.PassThrough = __webpack_require__(82725);
  5483. exports.finished = __webpack_require__(8610);
  5484. exports.pipeline = __webpack_require__(59946);
  5485. }
  5486. /***/ }),
  5487. /***/ 32553:
  5488. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  5489. "use strict";
  5490. // Copyright Joyent, Inc. and other Node contributors.
  5491. //
  5492. // Permission is hereby granted, free of charge, to any person obtaining a
  5493. // copy of this software and associated documentation files (the
  5494. // "Software"), to deal in the Software without restriction, including
  5495. // without limitation the rights to use, copy, modify, merge, publish,
  5496. // distribute, sublicense, and/or sell copies of the Software, and to permit
  5497. // persons to whom the Software is furnished to do so, subject to the
  5498. // following conditions:
  5499. //
  5500. // The above copyright notice and this permission notice shall be included
  5501. // in all copies or substantial portions of the Software.
  5502. //
  5503. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  5504. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  5505. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  5506. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  5507. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  5508. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  5509. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  5510. /*<replacement>*/
  5511. var Buffer = __webpack_require__(40396).Buffer;
  5512. /*</replacement>*/
  5513. var isEncoding = Buffer.isEncoding || function (encoding) {
  5514. encoding = '' + encoding;
  5515. switch (encoding && encoding.toLowerCase()) {
  5516. case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
  5517. return true;
  5518. default:
  5519. return false;
  5520. }
  5521. };
  5522. function _normalizeEncoding(enc) {
  5523. if (!enc) return 'utf8';
  5524. var retried;
  5525. while (true) {
  5526. switch (enc) {
  5527. case 'utf8':
  5528. case 'utf-8':
  5529. return 'utf8';
  5530. case 'ucs2':
  5531. case 'ucs-2':
  5532. case 'utf16le':
  5533. case 'utf-16le':
  5534. return 'utf16le';
  5535. case 'latin1':
  5536. case 'binary':
  5537. return 'latin1';
  5538. case 'base64':
  5539. case 'ascii':
  5540. case 'hex':
  5541. return enc;
  5542. default:
  5543. if (retried) return; // undefined
  5544. enc = ('' + enc).toLowerCase();
  5545. retried = true;
  5546. }
  5547. }
  5548. };
  5549. // Do not cache `Buffer.isEncoding` when checking encoding names as some
  5550. // modules monkey-patch it to support additional encodings
  5551. function normalizeEncoding(enc) {
  5552. var nenc = _normalizeEncoding(enc);
  5553. if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
  5554. return nenc || enc;
  5555. }
  5556. // StringDecoder provides an interface for efficiently splitting a series of
  5557. // buffers into a series of JS strings without breaking apart multi-byte
  5558. // characters.
  5559. exports.s = StringDecoder;
  5560. function StringDecoder(encoding) {
  5561. this.encoding = normalizeEncoding(encoding);
  5562. var nb;
  5563. switch (this.encoding) {
  5564. case 'utf16le':
  5565. this.text = utf16Text;
  5566. this.end = utf16End;
  5567. nb = 4;
  5568. break;
  5569. case 'utf8':
  5570. this.fillLast = utf8FillLast;
  5571. nb = 4;
  5572. break;
  5573. case 'base64':
  5574. this.text = base64Text;
  5575. this.end = base64End;
  5576. nb = 3;
  5577. break;
  5578. default:
  5579. this.write = simpleWrite;
  5580. this.end = simpleEnd;
  5581. return;
  5582. }
  5583. this.lastNeed = 0;
  5584. this.lastTotal = 0;
  5585. this.lastChar = Buffer.allocUnsafe(nb);
  5586. }
  5587. StringDecoder.prototype.write = function (buf) {
  5588. if (buf.length === 0) return '';
  5589. var r;
  5590. var i;
  5591. if (this.lastNeed) {
  5592. r = this.fillLast(buf);
  5593. if (r === undefined) return '';
  5594. i = this.lastNeed;
  5595. this.lastNeed = 0;
  5596. } else {
  5597. i = 0;
  5598. }
  5599. if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
  5600. return r || '';
  5601. };
  5602. StringDecoder.prototype.end = utf8End;
  5603. // Returns only complete characters in a Buffer
  5604. StringDecoder.prototype.text = utf8Text;
  5605. // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
  5606. StringDecoder.prototype.fillLast = function (buf) {
  5607. if (this.lastNeed <= buf.length) {
  5608. buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
  5609. return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  5610. }
  5611. buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
  5612. this.lastNeed -= buf.length;
  5613. };
  5614. // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
  5615. // continuation byte. If an invalid byte is detected, -2 is returned.
  5616. function utf8CheckByte(byte) {
  5617. if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
  5618. return byte >> 6 === 0x02 ? -1 : -2;
  5619. }
  5620. // Checks at most 3 bytes at the end of a Buffer in order to detect an
  5621. // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
  5622. // needed to complete the UTF-8 character (if applicable) are returned.
  5623. function utf8CheckIncomplete(self, buf, i) {
  5624. var j = buf.length - 1;
  5625. if (j < i) return 0;
  5626. var nb = utf8CheckByte(buf[j]);
  5627. if (nb >= 0) {
  5628. if (nb > 0) self.lastNeed = nb - 1;
  5629. return nb;
  5630. }
  5631. if (--j < i || nb === -2) return 0;
  5632. nb = utf8CheckByte(buf[j]);
  5633. if (nb >= 0) {
  5634. if (nb > 0) self.lastNeed = nb - 2;
  5635. return nb;
  5636. }
  5637. if (--j < i || nb === -2) return 0;
  5638. nb = utf8CheckByte(buf[j]);
  5639. if (nb >= 0) {
  5640. if (nb > 0) {
  5641. if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
  5642. }
  5643. return nb;
  5644. }
  5645. return 0;
  5646. }
  5647. // Validates as many continuation bytes for a multi-byte UTF-8 character as
  5648. // needed or are available. If we see a non-continuation byte where we expect
  5649. // one, we "replace" the validated continuation bytes we've seen so far with
  5650. // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
  5651. // behavior. The continuation byte check is included three times in the case
  5652. // where all of the continuation bytes for a character exist in the same buffer.
  5653. // It is also done this way as a slight performance increase instead of using a
  5654. // loop.
  5655. function utf8CheckExtraBytes(self, buf, p) {
  5656. if ((buf[0] & 0xC0) !== 0x80) {
  5657. self.lastNeed = 0;
  5658. return '\ufffd';
  5659. }
  5660. if (self.lastNeed > 1 && buf.length > 1) {
  5661. if ((buf[1] & 0xC0) !== 0x80) {
  5662. self.lastNeed = 1;
  5663. return '\ufffd';
  5664. }
  5665. if (self.lastNeed > 2 && buf.length > 2) {
  5666. if ((buf[2] & 0xC0) !== 0x80) {
  5667. self.lastNeed = 2;
  5668. return '\ufffd';
  5669. }
  5670. }
  5671. }
  5672. }
  5673. // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
  5674. function utf8FillLast(buf) {
  5675. var p = this.lastTotal - this.lastNeed;
  5676. var r = utf8CheckExtraBytes(this, buf, p);
  5677. if (r !== undefined) return r;
  5678. if (this.lastNeed <= buf.length) {
  5679. buf.copy(this.lastChar, p, 0, this.lastNeed);
  5680. return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  5681. }
  5682. buf.copy(this.lastChar, p, 0, buf.length);
  5683. this.lastNeed -= buf.length;
  5684. }
  5685. // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
  5686. // partial character, the character's bytes are buffered until the required
  5687. // number of bytes are available.
  5688. function utf8Text(buf, i) {
  5689. var total = utf8CheckIncomplete(this, buf, i);
  5690. if (!this.lastNeed) return buf.toString('utf8', i);
  5691. this.lastTotal = total;
  5692. var end = buf.length - (total - this.lastNeed);
  5693. buf.copy(this.lastChar, 0, end);
  5694. return buf.toString('utf8', i, end);
  5695. }
  5696. // For UTF-8, a replacement character is added when ending on a partial
  5697. // character.
  5698. function utf8End(buf) {
  5699. var r = buf && buf.length ? this.write(buf) : '';
  5700. if (this.lastNeed) return r + '\ufffd';
  5701. return r;
  5702. }
  5703. // UTF-16LE typically needs two bytes per character, but even if we have an even
  5704. // number of bytes available, we need to check if we end on a leading/high
  5705. // surrogate. In that case, we need to wait for the next two bytes in order to
  5706. // decode the last character properly.
  5707. function utf16Text(buf, i) {
  5708. if ((buf.length - i) % 2 === 0) {
  5709. var r = buf.toString('utf16le', i);
  5710. if (r) {
  5711. var c = r.charCodeAt(r.length - 1);
  5712. if (c >= 0xD800 && c <= 0xDBFF) {
  5713. this.lastNeed = 2;
  5714. this.lastTotal = 4;
  5715. this.lastChar[0] = buf[buf.length - 2];
  5716. this.lastChar[1] = buf[buf.length - 1];
  5717. return r.slice(0, -1);
  5718. }
  5719. }
  5720. return r;
  5721. }
  5722. this.lastNeed = 1;
  5723. this.lastTotal = 2;
  5724. this.lastChar[0] = buf[buf.length - 1];
  5725. return buf.toString('utf16le', i, buf.length - 1);
  5726. }
  5727. // For UTF-16LE we do not explicitly append special replacement characters if we
  5728. // end on a partial character, we simply let v8 handle that.
  5729. function utf16End(buf) {
  5730. var r = buf && buf.length ? this.write(buf) : '';
  5731. if (this.lastNeed) {
  5732. var end = this.lastTotal - this.lastNeed;
  5733. return r + this.lastChar.toString('utf16le', 0, end);
  5734. }
  5735. return r;
  5736. }
  5737. function base64Text(buf, i) {
  5738. var n = (buf.length - i) % 3;
  5739. if (n === 0) return buf.toString('base64', i);
  5740. this.lastNeed = 3 - n;
  5741. this.lastTotal = 3;
  5742. if (n === 1) {
  5743. this.lastChar[0] = buf[buf.length - 1];
  5744. } else {
  5745. this.lastChar[0] = buf[buf.length - 2];
  5746. this.lastChar[1] = buf[buf.length - 1];
  5747. }
  5748. return buf.toString('base64', i, buf.length - n);
  5749. }
  5750. function base64End(buf) {
  5751. var r = buf && buf.length ? this.write(buf) : '';
  5752. if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
  5753. return r;
  5754. }
  5755. // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
  5756. function simpleWrite(buf) {
  5757. return buf.toString(this.encoding);
  5758. }
  5759. function simpleEnd(buf) {
  5760. return buf && buf.length ? this.write(buf) : '';
  5761. }
  5762. /***/ }),
  5763. /***/ 40396:
  5764. /***/ ((module, exports, __webpack_require__) => {
  5765. /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
  5766. /* eslint-disable node/no-deprecated-api */
  5767. var buffer = __webpack_require__(64293)
  5768. var Buffer = buffer.Buffer
  5769. // alternative to using Object.keys for old browsers
  5770. function copyProps (src, dst) {
  5771. for (var key in src) {
  5772. dst[key] = src[key]
  5773. }
  5774. }
  5775. if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
  5776. module.exports = buffer
  5777. } else {
  5778. // Copy properties from require('buffer')
  5779. copyProps(buffer, exports)
  5780. exports.Buffer = SafeBuffer
  5781. }
  5782. function SafeBuffer (arg, encodingOrOffset, length) {
  5783. return Buffer(arg, encodingOrOffset, length)
  5784. }
  5785. SafeBuffer.prototype = Object.create(Buffer.prototype)
  5786. // Copy static methods from Buffer
  5787. copyProps(Buffer, SafeBuffer)
  5788. SafeBuffer.from = function (arg, encodingOrOffset, length) {
  5789. if (typeof arg === 'number') {
  5790. throw new TypeError('Argument must not be a number')
  5791. }
  5792. return Buffer(arg, encodingOrOffset, length)
  5793. }
  5794. SafeBuffer.alloc = function (size, fill, encoding) {
  5795. if (typeof size !== 'number') {
  5796. throw new TypeError('Argument must be a number')
  5797. }
  5798. var buf = Buffer(size)
  5799. if (fill !== undefined) {
  5800. if (typeof encoding === 'string') {
  5801. buf.fill(fill, encoding)
  5802. } else {
  5803. buf.fill(fill)
  5804. }
  5805. } else {
  5806. buf.fill(0)
  5807. }
  5808. return buf
  5809. }
  5810. SafeBuffer.allocUnsafe = function (size) {
  5811. if (typeof size !== 'number') {
  5812. throw new TypeError('Argument must be a number')
  5813. }
  5814. return Buffer(size)
  5815. }
  5816. SafeBuffer.allocUnsafeSlow = function (size) {
  5817. if (typeof size !== 'number') {
  5818. throw new TypeError('Argument must be a number')
  5819. }
  5820. return buffer.SlowBuffer(size)
  5821. }
  5822. /***/ }),
  5823. /***/ 41159:
  5824. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  5825. /**
  5826. * For Node.js, simply re-export the core `util.deprecate` function.
  5827. */
  5828. module.exports = __webpack_require__(31669).deprecate;
  5829. /***/ })
  5830. };
  5831. ;
  5832. //# sourceMappingURL=905.index.js.map