index.js 1.3 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128
  1. import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";
  2. /******/ var __webpack_modules__ = ({
  3. /***/ 7351:
  4. /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
  5. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  6. if (k2 === undefined) k2 = k;
  7. Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  8. }) : (function(o, m, k, k2) {
  9. if (k2 === undefined) k2 = k;
  10. o[k2] = m[k];
  11. }));
  12. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  13. Object.defineProperty(o, "default", { enumerable: true, value: v });
  14. }) : function(o, v) {
  15. o["default"] = v;
  16. });
  17. var __importStar = (this && this.__importStar) || function (mod) {
  18. if (mod && mod.__esModule) return mod;
  19. var result = {};
  20. if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  21. __setModuleDefault(result, mod);
  22. return result;
  23. };
  24. Object.defineProperty(exports, "__esModule", ({ value: true }));
  25. exports.issue = exports.issueCommand = void 0;
  26. const os = __importStar(__nccwpck_require__(2037));
  27. const utils_1 = __nccwpck_require__(5278);
  28. /**
  29. * Commands
  30. *
  31. * Command Format:
  32. * ::name key=value,key=value::message
  33. *
  34. * Examples:
  35. * ::warning::This is the message
  36. * ::set-env name=MY_VAR::some value
  37. */
  38. function issueCommand(command, properties, message) {
  39. const cmd = new Command(command, properties, message);
  40. process.stdout.write(cmd.toString() + os.EOL);
  41. }
  42. exports.issueCommand = issueCommand;
  43. function issue(name, message = '') {
  44. issueCommand(name, {}, message);
  45. }
  46. exports.issue = issue;
  47. const CMD_STRING = '::';
  48. class Command {
  49. constructor(command, properties, message) {
  50. if (!command) {
  51. command = 'missing.command';
  52. }
  53. this.command = command;
  54. this.properties = properties;
  55. this.message = message;
  56. }
  57. toString() {
  58. let cmdStr = CMD_STRING + this.command;
  59. if (this.properties && Object.keys(this.properties).length > 0) {
  60. cmdStr += ' ';
  61. let first = true;
  62. for (const key in this.properties) {
  63. if (this.properties.hasOwnProperty(key)) {
  64. const val = this.properties[key];
  65. if (val) {
  66. if (first) {
  67. first = false;
  68. }
  69. else {
  70. cmdStr += ',';
  71. }
  72. cmdStr += `${key}=${escapeProperty(val)}`;
  73. }
  74. }
  75. }
  76. }
  77. cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
  78. return cmdStr;
  79. }
  80. }
  81. function escapeData(s) {
  82. return utils_1.toCommandValue(s)
  83. .replace(/%/g, '%25')
  84. .replace(/\r/g, '%0D')
  85. .replace(/\n/g, '%0A');
  86. }
  87. function escapeProperty(s) {
  88. return utils_1.toCommandValue(s)
  89. .replace(/%/g, '%25')
  90. .replace(/\r/g, '%0D')
  91. .replace(/\n/g, '%0A')
  92. .replace(/:/g, '%3A')
  93. .replace(/,/g, '%2C');
  94. }
  95. //# sourceMappingURL=command.js.map
  96. /***/ }),
  97. /***/ 2186:
  98. /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
  99. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  100. if (k2 === undefined) k2 = k;
  101. Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  102. }) : (function(o, m, k, k2) {
  103. if (k2 === undefined) k2 = k;
  104. o[k2] = m[k];
  105. }));
  106. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  107. Object.defineProperty(o, "default", { enumerable: true, value: v });
  108. }) : function(o, v) {
  109. o["default"] = v;
  110. });
  111. var __importStar = (this && this.__importStar) || function (mod) {
  112. if (mod && mod.__esModule) return mod;
  113. var result = {};
  114. if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  115. __setModuleDefault(result, mod);
  116. return result;
  117. };
  118. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  119. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  120. return new (P || (P = Promise))(function (resolve, reject) {
  121. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  122. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  123. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  124. step((generator = generator.apply(thisArg, _arguments || [])).next());
  125. });
  126. };
  127. Object.defineProperty(exports, "__esModule", ({ value: true }));
  128. exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
  129. const command_1 = __nccwpck_require__(7351);
  130. const file_command_1 = __nccwpck_require__(717);
  131. const utils_1 = __nccwpck_require__(5278);
  132. const os = __importStar(__nccwpck_require__(2037));
  133. const path = __importStar(__nccwpck_require__(1017));
  134. const oidc_utils_1 = __nccwpck_require__(8041);
  135. /**
  136. * The code to exit an action
  137. */
  138. var ExitCode;
  139. (function (ExitCode) {
  140. /**
  141. * A code indicating that the action was successful
  142. */
  143. ExitCode[ExitCode["Success"] = 0] = "Success";
  144. /**
  145. * A code indicating that the action was a failure
  146. */
  147. ExitCode[ExitCode["Failure"] = 1] = "Failure";
  148. })(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
  149. //-----------------------------------------------------------------------
  150. // Variables
  151. //-----------------------------------------------------------------------
  152. /**
  153. * Sets env variable for this action and future actions in the job
  154. * @param name the name of the variable to set
  155. * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
  156. */
  157. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  158. function exportVariable(name, val) {
  159. const convertedVal = utils_1.toCommandValue(val);
  160. process.env[name] = convertedVal;
  161. const filePath = process.env['GITHUB_ENV'] || '';
  162. if (filePath) {
  163. return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
  164. }
  165. command_1.issueCommand('set-env', { name }, convertedVal);
  166. }
  167. exports.exportVariable = exportVariable;
  168. /**
  169. * Registers a secret which will get masked from logs
  170. * @param secret value of the secret
  171. */
  172. function setSecret(secret) {
  173. command_1.issueCommand('add-mask', {}, secret);
  174. }
  175. exports.setSecret = setSecret;
  176. /**
  177. * Prepends inputPath to the PATH (for this action and future actions)
  178. * @param inputPath
  179. */
  180. function addPath(inputPath) {
  181. const filePath = process.env['GITHUB_PATH'] || '';
  182. if (filePath) {
  183. file_command_1.issueFileCommand('PATH', inputPath);
  184. }
  185. else {
  186. command_1.issueCommand('add-path', {}, inputPath);
  187. }
  188. process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
  189. }
  190. exports.addPath = addPath;
  191. /**
  192. * Gets the value of an input.
  193. * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
  194. * Returns an empty string if the value is not defined.
  195. *
  196. * @param name name of the input to get
  197. * @param options optional. See InputOptions.
  198. * @returns string
  199. */
  200. function getInput(name, options) {
  201. const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
  202. if (options && options.required && !val) {
  203. throw new Error(`Input required and not supplied: ${name}`);
  204. }
  205. if (options && options.trimWhitespace === false) {
  206. return val;
  207. }
  208. return val.trim();
  209. }
  210. exports.getInput = getInput;
  211. /**
  212. * Gets the values of an multiline input. Each value is also trimmed.
  213. *
  214. * @param name name of the input to get
  215. * @param options optional. See InputOptions.
  216. * @returns string[]
  217. *
  218. */
  219. function getMultilineInput(name, options) {
  220. const inputs = getInput(name, options)
  221. .split('\n')
  222. .filter(x => x !== '');
  223. if (options && options.trimWhitespace === false) {
  224. return inputs;
  225. }
  226. return inputs.map(input => input.trim());
  227. }
  228. exports.getMultilineInput = getMultilineInput;
  229. /**
  230. * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
  231. * Support boolean input list: `true | True | TRUE | false | False | FALSE` .
  232. * The return value is also in boolean type.
  233. * ref: https://yaml.org/spec/1.2/spec.html#id2804923
  234. *
  235. * @param name name of the input to get
  236. * @param options optional. See InputOptions.
  237. * @returns boolean
  238. */
  239. function getBooleanInput(name, options) {
  240. const trueValue = ['true', 'True', 'TRUE'];
  241. const falseValue = ['false', 'False', 'FALSE'];
  242. const val = getInput(name, options);
  243. if (trueValue.includes(val))
  244. return true;
  245. if (falseValue.includes(val))
  246. return false;
  247. throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
  248. `Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
  249. }
  250. exports.getBooleanInput = getBooleanInput;
  251. /**
  252. * Sets the value of an output.
  253. *
  254. * @param name name of the output to set
  255. * @param value value to store. Non-string values will be converted to a string via JSON.stringify
  256. */
  257. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  258. function setOutput(name, value) {
  259. const filePath = process.env['GITHUB_OUTPUT'] || '';
  260. if (filePath) {
  261. return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
  262. }
  263. process.stdout.write(os.EOL);
  264. command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
  265. }
  266. exports.setOutput = setOutput;
  267. /**
  268. * Enables or disables the echoing of commands into stdout for the rest of the step.
  269. * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
  270. *
  271. */
  272. function setCommandEcho(enabled) {
  273. command_1.issue('echo', enabled ? 'on' : 'off');
  274. }
  275. exports.setCommandEcho = setCommandEcho;
  276. //-----------------------------------------------------------------------
  277. // Results
  278. //-----------------------------------------------------------------------
  279. /**
  280. * Sets the action status to failed.
  281. * When the action exits it will be with an exit code of 1
  282. * @param message add error issue message
  283. */
  284. function setFailed(message) {
  285. process.exitCode = ExitCode.Failure;
  286. error(message);
  287. }
  288. exports.setFailed = setFailed;
  289. //-----------------------------------------------------------------------
  290. // Logging Commands
  291. //-----------------------------------------------------------------------
  292. /**
  293. * Gets whether Actions Step Debug is on or not
  294. */
  295. function isDebug() {
  296. return process.env['RUNNER_DEBUG'] === '1';
  297. }
  298. exports.isDebug = isDebug;
  299. /**
  300. * Writes debug message to user log
  301. * @param message debug message
  302. */
  303. function debug(message) {
  304. command_1.issueCommand('debug', {}, message);
  305. }
  306. exports.debug = debug;
  307. /**
  308. * Adds an error issue
  309. * @param message error issue message. Errors will be converted to string via toString()
  310. * @param properties optional properties to add to the annotation.
  311. */
  312. function error(message, properties = {}) {
  313. command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
  314. }
  315. exports.error = error;
  316. /**
  317. * Adds a warning issue
  318. * @param message warning issue message. Errors will be converted to string via toString()
  319. * @param properties optional properties to add to the annotation.
  320. */
  321. function warning(message, properties = {}) {
  322. command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
  323. }
  324. exports.warning = warning;
  325. /**
  326. * Adds a notice issue
  327. * @param message notice issue message. Errors will be converted to string via toString()
  328. * @param properties optional properties to add to the annotation.
  329. */
  330. function notice(message, properties = {}) {
  331. command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
  332. }
  333. exports.notice = notice;
  334. /**
  335. * Writes info to log with console.log.
  336. * @param message info message
  337. */
  338. function info(message) {
  339. process.stdout.write(message + os.EOL);
  340. }
  341. exports.info = info;
  342. /**
  343. * Begin an output group.
  344. *
  345. * Output until the next `groupEnd` will be foldable in this group
  346. *
  347. * @param name The name of the output group
  348. */
  349. function startGroup(name) {
  350. command_1.issue('group', name);
  351. }
  352. exports.startGroup = startGroup;
  353. /**
  354. * End an output group.
  355. */
  356. function endGroup() {
  357. command_1.issue('endgroup');
  358. }
  359. exports.endGroup = endGroup;
  360. /**
  361. * Wrap an asynchronous function call in a group.
  362. *
  363. * Returns the same type as the function itself.
  364. *
  365. * @param name The name of the group
  366. * @param fn The function to wrap in the group
  367. */
  368. function group(name, fn) {
  369. return __awaiter(this, void 0, void 0, function* () {
  370. startGroup(name);
  371. let result;
  372. try {
  373. result = yield fn();
  374. }
  375. finally {
  376. endGroup();
  377. }
  378. return result;
  379. });
  380. }
  381. exports.group = group;
  382. //-----------------------------------------------------------------------
  383. // Wrapper action state
  384. //-----------------------------------------------------------------------
  385. /**
  386. * Saves state for current action, the state can only be retrieved by this action's post job execution.
  387. *
  388. * @param name name of the state to store
  389. * @param value value to store. Non-string values will be converted to a string via JSON.stringify
  390. */
  391. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  392. function saveState(name, value) {
  393. const filePath = process.env['GITHUB_STATE'] || '';
  394. if (filePath) {
  395. return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
  396. }
  397. command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
  398. }
  399. exports.saveState = saveState;
  400. /**
  401. * Gets the value of an state set by this action's main execution.
  402. *
  403. * @param name name of the state to get
  404. * @returns string
  405. */
  406. function getState(name) {
  407. return process.env[`STATE_${name}`] || '';
  408. }
  409. exports.getState = getState;
  410. function getIDToken(aud) {
  411. return __awaiter(this, void 0, void 0, function* () {
  412. return yield oidc_utils_1.OidcClient.getIDToken(aud);
  413. });
  414. }
  415. exports.getIDToken = getIDToken;
  416. /**
  417. * Summary exports
  418. */
  419. var summary_1 = __nccwpck_require__(1327);
  420. Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } }));
  421. /**
  422. * @deprecated use core.summary
  423. */
  424. var summary_2 = __nccwpck_require__(1327);
  425. Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } }));
  426. /**
  427. * Path exports
  428. */
  429. var path_utils_1 = __nccwpck_require__(2981);
  430. Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } }));
  431. Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } }));
  432. Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } }));
  433. //# sourceMappingURL=core.js.map
  434. /***/ }),
  435. /***/ 717:
  436. /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
  437. // For internal use, subject to change.
  438. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  439. if (k2 === undefined) k2 = k;
  440. Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  441. }) : (function(o, m, k, k2) {
  442. if (k2 === undefined) k2 = k;
  443. o[k2] = m[k];
  444. }));
  445. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  446. Object.defineProperty(o, "default", { enumerable: true, value: v });
  447. }) : function(o, v) {
  448. o["default"] = v;
  449. });
  450. var __importStar = (this && this.__importStar) || function (mod) {
  451. if (mod && mod.__esModule) return mod;
  452. var result = {};
  453. if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  454. __setModuleDefault(result, mod);
  455. return result;
  456. };
  457. Object.defineProperty(exports, "__esModule", ({ value: true }));
  458. exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
  459. // We use any as a valid input type
  460. /* eslint-disable @typescript-eslint/no-explicit-any */
  461. const fs = __importStar(__nccwpck_require__(7147));
  462. const os = __importStar(__nccwpck_require__(2037));
  463. const uuid_1 = __nccwpck_require__(8974);
  464. const utils_1 = __nccwpck_require__(5278);
  465. function issueFileCommand(command, message) {
  466. const filePath = process.env[`GITHUB_${command}`];
  467. if (!filePath) {
  468. throw new Error(`Unable to find environment variable for file command ${command}`);
  469. }
  470. if (!fs.existsSync(filePath)) {
  471. throw new Error(`Missing file at path: ${filePath}`);
  472. }
  473. fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
  474. encoding: 'utf8'
  475. });
  476. }
  477. exports.issueFileCommand = issueFileCommand;
  478. function prepareKeyValueMessage(key, value) {
  479. const delimiter = `ghadelimiter_${uuid_1.v4()}`;
  480. const convertedValue = utils_1.toCommandValue(value);
  481. // These should realistically never happen, but just in case someone finds a
  482. // way to exploit uuid generation let's not allow keys or values that contain
  483. // the delimiter.
  484. if (key.includes(delimiter)) {
  485. throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
  486. }
  487. if (convertedValue.includes(delimiter)) {
  488. throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
  489. }
  490. return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
  491. }
  492. exports.prepareKeyValueMessage = prepareKeyValueMessage;
  493. //# sourceMappingURL=file-command.js.map
  494. /***/ }),
  495. /***/ 8041:
  496. /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
  497. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  498. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  499. return new (P || (P = Promise))(function (resolve, reject) {
  500. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  501. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  502. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  503. step((generator = generator.apply(thisArg, _arguments || [])).next());
  504. });
  505. };
  506. Object.defineProperty(exports, "__esModule", ({ value: true }));
  507. exports.OidcClient = void 0;
  508. const http_client_1 = __nccwpck_require__(6255);
  509. const auth_1 = __nccwpck_require__(5526);
  510. const core_1 = __nccwpck_require__(2186);
  511. class OidcClient {
  512. static createHttpClient(allowRetry = true, maxRetry = 10) {
  513. const requestOptions = {
  514. allowRetries: allowRetry,
  515. maxRetries: maxRetry
  516. };
  517. return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions);
  518. }
  519. static getRequestToken() {
  520. const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'];
  521. if (!token) {
  522. throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable');
  523. }
  524. return token;
  525. }
  526. static getIDTokenUrl() {
  527. const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL'];
  528. if (!runtimeUrl) {
  529. throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable');
  530. }
  531. return runtimeUrl;
  532. }
  533. static getCall(id_token_url) {
  534. var _a;
  535. return __awaiter(this, void 0, void 0, function* () {
  536. const httpclient = OidcClient.createHttpClient();
  537. const res = yield httpclient
  538. .getJson(id_token_url)
  539. .catch(error => {
  540. throw new Error(`Failed to get ID Token. \n
  541. Error Code : ${error.statusCode}\n
  542. Error Message: ${error.message}`);
  543. });
  544. const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
  545. if (!id_token) {
  546. throw new Error('Response json body do not have ID Token field');
  547. }
  548. return id_token;
  549. });
  550. }
  551. static getIDToken(audience) {
  552. return __awaiter(this, void 0, void 0, function* () {
  553. try {
  554. // New ID Token is requested from action service
  555. let id_token_url = OidcClient.getIDTokenUrl();
  556. if (audience) {
  557. const encodedAudience = encodeURIComponent(audience);
  558. id_token_url = `${id_token_url}&audience=${encodedAudience}`;
  559. }
  560. core_1.debug(`ID token url is ${id_token_url}`);
  561. const id_token = yield OidcClient.getCall(id_token_url);
  562. core_1.setSecret(id_token);
  563. return id_token;
  564. }
  565. catch (error) {
  566. throw new Error(`Error message: ${error.message}`);
  567. }
  568. });
  569. }
  570. }
  571. exports.OidcClient = OidcClient;
  572. //# sourceMappingURL=oidc-utils.js.map
  573. /***/ }),
  574. /***/ 2981:
  575. /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
  576. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  577. if (k2 === undefined) k2 = k;
  578. Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  579. }) : (function(o, m, k, k2) {
  580. if (k2 === undefined) k2 = k;
  581. o[k2] = m[k];
  582. }));
  583. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  584. Object.defineProperty(o, "default", { enumerable: true, value: v });
  585. }) : function(o, v) {
  586. o["default"] = v;
  587. });
  588. var __importStar = (this && this.__importStar) || function (mod) {
  589. if (mod && mod.__esModule) return mod;
  590. var result = {};
  591. if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  592. __setModuleDefault(result, mod);
  593. return result;
  594. };
  595. Object.defineProperty(exports, "__esModule", ({ value: true }));
  596. exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0;
  597. const path = __importStar(__nccwpck_require__(1017));
  598. /**
  599. * toPosixPath converts the given path to the posix form. On Windows, \\ will be
  600. * replaced with /.
  601. *
  602. * @param pth. Path to transform.
  603. * @return string Posix path.
  604. */
  605. function toPosixPath(pth) {
  606. return pth.replace(/[\\]/g, '/');
  607. }
  608. exports.toPosixPath = toPosixPath;
  609. /**
  610. * toWin32Path converts the given path to the win32 form. On Linux, / will be
  611. * replaced with \\.
  612. *
  613. * @param pth. Path to transform.
  614. * @return string Win32 path.
  615. */
  616. function toWin32Path(pth) {
  617. return pth.replace(/[/]/g, '\\');
  618. }
  619. exports.toWin32Path = toWin32Path;
  620. /**
  621. * toPlatformPath converts the given path to a platform-specific path. It does
  622. * this by replacing instances of / and \ with the platform-specific path
  623. * separator.
  624. *
  625. * @param pth The path to platformize.
  626. * @return string The platform-specific path.
  627. */
  628. function toPlatformPath(pth) {
  629. return pth.replace(/[/\\]/g, path.sep);
  630. }
  631. exports.toPlatformPath = toPlatformPath;
  632. //# sourceMappingURL=path-utils.js.map
  633. /***/ }),
  634. /***/ 1327:
  635. /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
  636. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  637. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  638. return new (P || (P = Promise))(function (resolve, reject) {
  639. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  640. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  641. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  642. step((generator = generator.apply(thisArg, _arguments || [])).next());
  643. });
  644. };
  645. Object.defineProperty(exports, "__esModule", ({ value: true }));
  646. exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0;
  647. const os_1 = __nccwpck_require__(2037);
  648. const fs_1 = __nccwpck_require__(7147);
  649. const { access, appendFile, writeFile } = fs_1.promises;
  650. exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY';
  651. exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary';
  652. class Summary {
  653. constructor() {
  654. this._buffer = '';
  655. }
  656. /**
  657. * Finds the summary file path from the environment, rejects if env var is not found or file does not exist
  658. * Also checks r/w permissions.
  659. *
  660. * @returns step summary file path
  661. */
  662. filePath() {
  663. return __awaiter(this, void 0, void 0, function* () {
  664. if (this._filePath) {
  665. return this._filePath;
  666. }
  667. const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR];
  668. if (!pathFromEnv) {
  669. throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);
  670. }
  671. try {
  672. yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK);
  673. }
  674. catch (_a) {
  675. throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`);
  676. }
  677. this._filePath = pathFromEnv;
  678. return this._filePath;
  679. });
  680. }
  681. /**
  682. * Wraps content in an HTML tag, adding any HTML attributes
  683. *
  684. * @param {string} tag HTML tag to wrap
  685. * @param {string | null} content content within the tag
  686. * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add
  687. *
  688. * @returns {string} content wrapped in HTML element
  689. */
  690. wrap(tag, content, attrs = {}) {
  691. const htmlAttrs = Object.entries(attrs)
  692. .map(([key, value]) => ` ${key}="${value}"`)
  693. .join('');
  694. if (!content) {
  695. return `<${tag}${htmlAttrs}>`;
  696. }
  697. return `<${tag}${htmlAttrs}>${content}</${tag}>`;
  698. }
  699. /**
  700. * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default.
  701. *
  702. * @param {SummaryWriteOptions} [options] (optional) options for write operation
  703. *
  704. * @returns {Promise<Summary>} summary instance
  705. */
  706. write(options) {
  707. return __awaiter(this, void 0, void 0, function* () {
  708. const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite);
  709. const filePath = yield this.filePath();
  710. const writeFunc = overwrite ? writeFile : appendFile;
  711. yield writeFunc(filePath, this._buffer, { encoding: 'utf8' });
  712. return this.emptyBuffer();
  713. });
  714. }
  715. /**
  716. * Clears the summary buffer and wipes the summary file
  717. *
  718. * @returns {Summary} summary instance
  719. */
  720. clear() {
  721. return __awaiter(this, void 0, void 0, function* () {
  722. return this.emptyBuffer().write({ overwrite: true });
  723. });
  724. }
  725. /**
  726. * Returns the current summary buffer as a string
  727. *
  728. * @returns {string} string of summary buffer
  729. */
  730. stringify() {
  731. return this._buffer;
  732. }
  733. /**
  734. * If the summary buffer is empty
  735. *
  736. * @returns {boolen} true if the buffer is empty
  737. */
  738. isEmptyBuffer() {
  739. return this._buffer.length === 0;
  740. }
  741. /**
  742. * Resets the summary buffer without writing to summary file
  743. *
  744. * @returns {Summary} summary instance
  745. */
  746. emptyBuffer() {
  747. this._buffer = '';
  748. return this;
  749. }
  750. /**
  751. * Adds raw text to the summary buffer
  752. *
  753. * @param {string} text content to add
  754. * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false)
  755. *
  756. * @returns {Summary} summary instance
  757. */
  758. addRaw(text, addEOL = false) {
  759. this._buffer += text;
  760. return addEOL ? this.addEOL() : this;
  761. }
  762. /**
  763. * Adds the operating system-specific end-of-line marker to the buffer
  764. *
  765. * @returns {Summary} summary instance
  766. */
  767. addEOL() {
  768. return this.addRaw(os_1.EOL);
  769. }
  770. /**
  771. * Adds an HTML codeblock to the summary buffer
  772. *
  773. * @param {string} code content to render within fenced code block
  774. * @param {string} lang (optional) language to syntax highlight code
  775. *
  776. * @returns {Summary} summary instance
  777. */
  778. addCodeBlock(code, lang) {
  779. const attrs = Object.assign({}, (lang && { lang }));
  780. const element = this.wrap('pre', this.wrap('code', code), attrs);
  781. return this.addRaw(element).addEOL();
  782. }
  783. /**
  784. * Adds an HTML list to the summary buffer
  785. *
  786. * @param {string[]} items list of items to render
  787. * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false)
  788. *
  789. * @returns {Summary} summary instance
  790. */
  791. addList(items, ordered = false) {
  792. const tag = ordered ? 'ol' : 'ul';
  793. const listItems = items.map(item => this.wrap('li', item)).join('');
  794. const element = this.wrap(tag, listItems);
  795. return this.addRaw(element).addEOL();
  796. }
  797. /**
  798. * Adds an HTML table to the summary buffer
  799. *
  800. * @param {SummaryTableCell[]} rows table rows
  801. *
  802. * @returns {Summary} summary instance
  803. */
  804. addTable(rows) {
  805. const tableBody = rows
  806. .map(row => {
  807. const cells = row
  808. .map(cell => {
  809. if (typeof cell === 'string') {
  810. return this.wrap('td', cell);
  811. }
  812. const { header, data, colspan, rowspan } = cell;
  813. const tag = header ? 'th' : 'td';
  814. const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan }));
  815. return this.wrap(tag, data, attrs);
  816. })
  817. .join('');
  818. return this.wrap('tr', cells);
  819. })
  820. .join('');
  821. const element = this.wrap('table', tableBody);
  822. return this.addRaw(element).addEOL();
  823. }
  824. /**
  825. * Adds a collapsable HTML details element to the summary buffer
  826. *
  827. * @param {string} label text for the closed state
  828. * @param {string} content collapsable content
  829. *
  830. * @returns {Summary} summary instance
  831. */
  832. addDetails(label, content) {
  833. const element = this.wrap('details', this.wrap('summary', label) + content);
  834. return this.addRaw(element).addEOL();
  835. }
  836. /**
  837. * Adds an HTML image tag to the summary buffer
  838. *
  839. * @param {string} src path to the image you to embed
  840. * @param {string} alt text description of the image
  841. * @param {SummaryImageOptions} options (optional) addition image attributes
  842. *
  843. * @returns {Summary} summary instance
  844. */
  845. addImage(src, alt, options) {
  846. const { width, height } = options || {};
  847. const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height }));
  848. const element = this.wrap('img', null, Object.assign({ src, alt }, attrs));
  849. return this.addRaw(element).addEOL();
  850. }
  851. /**
  852. * Adds an HTML section heading element
  853. *
  854. * @param {string} text heading text
  855. * @param {number | string} [level=1] (optional) the heading level, default: 1
  856. *
  857. * @returns {Summary} summary instance
  858. */
  859. addHeading(text, level) {
  860. const tag = `h${level}`;
  861. const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag)
  862. ? tag
  863. : 'h1';
  864. const element = this.wrap(allowedTag, text);
  865. return this.addRaw(element).addEOL();
  866. }
  867. /**
  868. * Adds an HTML thematic break (<hr>) to the summary buffer
  869. *
  870. * @returns {Summary} summary instance
  871. */
  872. addSeparator() {
  873. const element = this.wrap('hr', null);
  874. return this.addRaw(element).addEOL();
  875. }
  876. /**
  877. * Adds an HTML line break (<br>) to the summary buffer
  878. *
  879. * @returns {Summary} summary instance
  880. */
  881. addBreak() {
  882. const element = this.wrap('br', null);
  883. return this.addRaw(element).addEOL();
  884. }
  885. /**
  886. * Adds an HTML blockquote to the summary buffer
  887. *
  888. * @param {string} text quote text
  889. * @param {string} cite (optional) citation url
  890. *
  891. * @returns {Summary} summary instance
  892. */
  893. addQuote(text, cite) {
  894. const attrs = Object.assign({}, (cite && { cite }));
  895. const element = this.wrap('blockquote', text, attrs);
  896. return this.addRaw(element).addEOL();
  897. }
  898. /**
  899. * Adds an HTML anchor tag to the summary buffer
  900. *
  901. * @param {string} text link text/content
  902. * @param {string} href hyperlink
  903. *
  904. * @returns {Summary} summary instance
  905. */
  906. addLink(text, href) {
  907. const element = this.wrap('a', text, { href });
  908. return this.addRaw(element).addEOL();
  909. }
  910. }
  911. const _summary = new Summary();
  912. /**
  913. * @deprecated use `core.summary`
  914. */
  915. exports.markdownSummary = _summary;
  916. exports.summary = _summary;
  917. //# sourceMappingURL=summary.js.map
  918. /***/ }),
  919. /***/ 5278:
  920. /***/ ((__unused_webpack_module, exports) => {
  921. // We use any as a valid input type
  922. /* eslint-disable @typescript-eslint/no-explicit-any */
  923. Object.defineProperty(exports, "__esModule", ({ value: true }));
  924. exports.toCommandProperties = exports.toCommandValue = void 0;
  925. /**
  926. * Sanitizes an input into a string so it can be passed into issueCommand safely
  927. * @param input input to sanitize into a string
  928. */
  929. function toCommandValue(input) {
  930. if (input === null || input === undefined) {
  931. return '';
  932. }
  933. else if (typeof input === 'string' || input instanceof String) {
  934. return input;
  935. }
  936. return JSON.stringify(input);
  937. }
  938. exports.toCommandValue = toCommandValue;
  939. /**
  940. *
  941. * @param annotationProperties
  942. * @returns The command properties to send with the actual annotation command
  943. * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
  944. */
  945. function toCommandProperties(annotationProperties) {
  946. if (!Object.keys(annotationProperties).length) {
  947. return {};
  948. }
  949. return {
  950. title: annotationProperties.title,
  951. file: annotationProperties.file,
  952. line: annotationProperties.startLine,
  953. endLine: annotationProperties.endLine,
  954. col: annotationProperties.startColumn,
  955. endColumn: annotationProperties.endColumn
  956. };
  957. }
  958. exports.toCommandProperties = toCommandProperties;
  959. //# sourceMappingURL=utils.js.map
  960. /***/ }),
  961. /***/ 8974:
  962. /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
  963. Object.defineProperty(exports, "__esModule", ({
  964. value: true
  965. }));
  966. Object.defineProperty(exports, "v1", ({
  967. enumerable: true,
  968. get: function () {
  969. return _v.default;
  970. }
  971. }));
  972. Object.defineProperty(exports, "v3", ({
  973. enumerable: true,
  974. get: function () {
  975. return _v2.default;
  976. }
  977. }));
  978. Object.defineProperty(exports, "v4", ({
  979. enumerable: true,
  980. get: function () {
  981. return _v3.default;
  982. }
  983. }));
  984. Object.defineProperty(exports, "v5", ({
  985. enumerable: true,
  986. get: function () {
  987. return _v4.default;
  988. }
  989. }));
  990. Object.defineProperty(exports, "NIL", ({
  991. enumerable: true,
  992. get: function () {
  993. return _nil.default;
  994. }
  995. }));
  996. Object.defineProperty(exports, "version", ({
  997. enumerable: true,
  998. get: function () {
  999. return _version.default;
  1000. }
  1001. }));
  1002. Object.defineProperty(exports, "validate", ({
  1003. enumerable: true,
  1004. get: function () {
  1005. return _validate.default;
  1006. }
  1007. }));
  1008. Object.defineProperty(exports, "stringify", ({
  1009. enumerable: true,
  1010. get: function () {
  1011. return _stringify.default;
  1012. }
  1013. }));
  1014. Object.defineProperty(exports, "parse", ({
  1015. enumerable: true,
  1016. get: function () {
  1017. return _parse.default;
  1018. }
  1019. }));
  1020. var _v = _interopRequireDefault(__nccwpck_require__(1595));
  1021. var _v2 = _interopRequireDefault(__nccwpck_require__(6993));
  1022. var _v3 = _interopRequireDefault(__nccwpck_require__(1472));
  1023. var _v4 = _interopRequireDefault(__nccwpck_require__(6217));
  1024. var _nil = _interopRequireDefault(__nccwpck_require__(2381));
  1025. var _version = _interopRequireDefault(__nccwpck_require__(427));
  1026. var _validate = _interopRequireDefault(__nccwpck_require__(2609));
  1027. var _stringify = _interopRequireDefault(__nccwpck_require__(1458));
  1028. var _parse = _interopRequireDefault(__nccwpck_require__(6385));
  1029. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1030. /***/ }),
  1031. /***/ 5842:
  1032. /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
  1033. Object.defineProperty(exports, "__esModule", ({
  1034. value: true
  1035. }));
  1036. exports["default"] = void 0;
  1037. var _crypto = _interopRequireDefault(__nccwpck_require__(6113));
  1038. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1039. function md5(bytes) {
  1040. if (Array.isArray(bytes)) {
  1041. bytes = Buffer.from(bytes);
  1042. } else if (typeof bytes === 'string') {
  1043. bytes = Buffer.from(bytes, 'utf8');
  1044. }
  1045. return _crypto.default.createHash('md5').update(bytes).digest();
  1046. }
  1047. var _default = md5;
  1048. exports["default"] = _default;
  1049. /***/ }),
  1050. /***/ 2381:
  1051. /***/ ((__unused_webpack_module, exports) => {
  1052. Object.defineProperty(exports, "__esModule", ({
  1053. value: true
  1054. }));
  1055. exports["default"] = void 0;
  1056. var _default = '00000000-0000-0000-0000-000000000000';
  1057. exports["default"] = _default;
  1058. /***/ }),
  1059. /***/ 6385:
  1060. /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
  1061. Object.defineProperty(exports, "__esModule", ({
  1062. value: true
  1063. }));
  1064. exports["default"] = void 0;
  1065. var _validate = _interopRequireDefault(__nccwpck_require__(2609));
  1066. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1067. function parse(uuid) {
  1068. if (!(0, _validate.default)(uuid)) {
  1069. throw TypeError('Invalid UUID');
  1070. }
  1071. let v;
  1072. const arr = new Uint8Array(16); // Parse ########-....-....-....-............
  1073. arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
  1074. arr[1] = v >>> 16 & 0xff;
  1075. arr[2] = v >>> 8 & 0xff;
  1076. arr[3] = v & 0xff; // Parse ........-####-....-....-............
  1077. arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
  1078. arr[5] = v & 0xff; // Parse ........-....-####-....-............
  1079. arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
  1080. arr[7] = v & 0xff; // Parse ........-....-....-####-............
  1081. arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
  1082. arr[9] = v & 0xff; // Parse ........-....-....-....-############
  1083. // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
  1084. arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
  1085. arr[11] = v / 0x100000000 & 0xff;
  1086. arr[12] = v >>> 24 & 0xff;
  1087. arr[13] = v >>> 16 & 0xff;
  1088. arr[14] = v >>> 8 & 0xff;
  1089. arr[15] = v & 0xff;
  1090. return arr;
  1091. }
  1092. var _default = parse;
  1093. exports["default"] = _default;
  1094. /***/ }),
  1095. /***/ 6230:
  1096. /***/ ((__unused_webpack_module, exports) => {
  1097. Object.defineProperty(exports, "__esModule", ({
  1098. value: true
  1099. }));
  1100. exports["default"] = void 0;
  1101. var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
  1102. exports["default"] = _default;
  1103. /***/ }),
  1104. /***/ 9784:
  1105. /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
  1106. Object.defineProperty(exports, "__esModule", ({
  1107. value: true
  1108. }));
  1109. exports["default"] = rng;
  1110. var _crypto = _interopRequireDefault(__nccwpck_require__(6113));
  1111. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1112. const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate
  1113. let poolPtr = rnds8Pool.length;
  1114. function rng() {
  1115. if (poolPtr > rnds8Pool.length - 16) {
  1116. _crypto.default.randomFillSync(rnds8Pool);
  1117. poolPtr = 0;
  1118. }
  1119. return rnds8Pool.slice(poolPtr, poolPtr += 16);
  1120. }
  1121. /***/ }),
  1122. /***/ 8844:
  1123. /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
  1124. Object.defineProperty(exports, "__esModule", ({
  1125. value: true
  1126. }));
  1127. exports["default"] = void 0;
  1128. var _crypto = _interopRequireDefault(__nccwpck_require__(6113));
  1129. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1130. function sha1(bytes) {
  1131. if (Array.isArray(bytes)) {
  1132. bytes = Buffer.from(bytes);
  1133. } else if (typeof bytes === 'string') {
  1134. bytes = Buffer.from(bytes, 'utf8');
  1135. }
  1136. return _crypto.default.createHash('sha1').update(bytes).digest();
  1137. }
  1138. var _default = sha1;
  1139. exports["default"] = _default;
  1140. /***/ }),
  1141. /***/ 1458:
  1142. /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
  1143. Object.defineProperty(exports, "__esModule", ({
  1144. value: true
  1145. }));
  1146. exports["default"] = void 0;
  1147. var _validate = _interopRequireDefault(__nccwpck_require__(2609));
  1148. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1149. /**
  1150. * Convert array of 16 byte values to UUID string format of the form:
  1151. * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
  1152. */
  1153. const byteToHex = [];
  1154. for (let i = 0; i < 256; ++i) {
  1155. byteToHex.push((i + 0x100).toString(16).substr(1));
  1156. }
  1157. function stringify(arr, offset = 0) {
  1158. // Note: Be careful editing this code! It's been tuned for performance
  1159. // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
  1160. const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
  1161. // of the following:
  1162. // - One or more input array values don't map to a hex octet (leading to
  1163. // "undefined" in the uuid)
  1164. // - Invalid input values for the RFC `version` or `variant` fields
  1165. if (!(0, _validate.default)(uuid)) {
  1166. throw TypeError('Stringified UUID is invalid');
  1167. }
  1168. return uuid;
  1169. }
  1170. var _default = stringify;
  1171. exports["default"] = _default;
  1172. /***/ }),
  1173. /***/ 1595:
  1174. /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
  1175. Object.defineProperty(exports, "__esModule", ({
  1176. value: true
  1177. }));
  1178. exports["default"] = void 0;
  1179. var _rng = _interopRequireDefault(__nccwpck_require__(9784));
  1180. var _stringify = _interopRequireDefault(__nccwpck_require__(1458));
  1181. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1182. // **`v1()` - Generate time-based UUID**
  1183. //
  1184. // Inspired by https://github.com/LiosK/UUID.js
  1185. // and http://docs.python.org/library/uuid.html
  1186. let _nodeId;
  1187. let _clockseq; // Previous uuid creation time
  1188. let _lastMSecs = 0;
  1189. let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details
  1190. function v1(options, buf, offset) {
  1191. let i = buf && offset || 0;
  1192. const b = buf || new Array(16);
  1193. options = options || {};
  1194. let node = options.node || _nodeId;
  1195. let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not
  1196. // specified. We do this lazily to minimize issues related to insufficient
  1197. // system entropy. See #189
  1198. if (node == null || clockseq == null) {
  1199. const seedBytes = options.random || (options.rng || _rng.default)();
  1200. if (node == null) {
  1201. // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
  1202. node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
  1203. }
  1204. if (clockseq == null) {
  1205. // Per 4.2.2, randomize (14 bit) clockseq
  1206. clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
  1207. }
  1208. } // UUID timestamps are 100 nano-second units since the Gregorian epoch,
  1209. // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
  1210. // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
  1211. // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
  1212. let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock
  1213. // cycle to simulate higher resolution clock
  1214. let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)
  1215. const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression
  1216. if (dt < 0 && options.clockseq === undefined) {
  1217. clockseq = clockseq + 1 & 0x3fff;
  1218. } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
  1219. // time interval
  1220. if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
  1221. nsecs = 0;
  1222. } // Per 4.2.1.2 Throw error if too many uuids are requested
  1223. if (nsecs >= 10000) {
  1224. throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
  1225. }
  1226. _lastMSecs = msecs;
  1227. _lastNSecs = nsecs;
  1228. _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
  1229. msecs += 12219292800000; // `time_low`
  1230. const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
  1231. b[i++] = tl >>> 24 & 0xff;
  1232. b[i++] = tl >>> 16 & 0xff;
  1233. b[i++] = tl >>> 8 & 0xff;
  1234. b[i++] = tl & 0xff; // `time_mid`
  1235. const tmh = msecs / 0x100000000 * 10000 & 0xfffffff;
  1236. b[i++] = tmh >>> 8 & 0xff;
  1237. b[i++] = tmh & 0xff; // `time_high_and_version`
  1238. b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
  1239. b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
  1240. b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`
  1241. b[i++] = clockseq & 0xff; // `node`
  1242. for (let n = 0; n < 6; ++n) {
  1243. b[i + n] = node[n];
  1244. }
  1245. return buf || (0, _stringify.default)(b);
  1246. }
  1247. var _default = v1;
  1248. exports["default"] = _default;
  1249. /***/ }),
  1250. /***/ 6993:
  1251. /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
  1252. Object.defineProperty(exports, "__esModule", ({
  1253. value: true
  1254. }));
  1255. exports["default"] = void 0;
  1256. var _v = _interopRequireDefault(__nccwpck_require__(5920));
  1257. var _md = _interopRequireDefault(__nccwpck_require__(5842));
  1258. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1259. const v3 = (0, _v.default)('v3', 0x30, _md.default);
  1260. var _default = v3;
  1261. exports["default"] = _default;
  1262. /***/ }),
  1263. /***/ 5920:
  1264. /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
  1265. Object.defineProperty(exports, "__esModule", ({
  1266. value: true
  1267. }));
  1268. exports["default"] = _default;
  1269. exports.URL = exports.DNS = void 0;
  1270. var _stringify = _interopRequireDefault(__nccwpck_require__(1458));
  1271. var _parse = _interopRequireDefault(__nccwpck_require__(6385));
  1272. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1273. function stringToBytes(str) {
  1274. str = unescape(encodeURIComponent(str)); // UTF8 escape
  1275. const bytes = [];
  1276. for (let i = 0; i < str.length; ++i) {
  1277. bytes.push(str.charCodeAt(i));
  1278. }
  1279. return bytes;
  1280. }
  1281. const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
  1282. exports.DNS = DNS;
  1283. const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
  1284. exports.URL = URL;
  1285. function _default(name, version, hashfunc) {
  1286. function generateUUID(value, namespace, buf, offset) {
  1287. if (typeof value === 'string') {
  1288. value = stringToBytes(value);
  1289. }
  1290. if (typeof namespace === 'string') {
  1291. namespace = (0, _parse.default)(namespace);
  1292. }
  1293. if (namespace.length !== 16) {
  1294. throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
  1295. } // Compute hash of namespace and value, Per 4.3
  1296. // Future: Use spread syntax when supported on all platforms, e.g. `bytes =
  1297. // hashfunc([...namespace, ... value])`
  1298. let bytes = new Uint8Array(16 + value.length);
  1299. bytes.set(namespace);
  1300. bytes.set(value, namespace.length);
  1301. bytes = hashfunc(bytes);
  1302. bytes[6] = bytes[6] & 0x0f | version;
  1303. bytes[8] = bytes[8] & 0x3f | 0x80;
  1304. if (buf) {
  1305. offset = offset || 0;
  1306. for (let i = 0; i < 16; ++i) {
  1307. buf[offset + i] = bytes[i];
  1308. }
  1309. return buf;
  1310. }
  1311. return (0, _stringify.default)(bytes);
  1312. } // Function#name is not settable on some platforms (#270)
  1313. try {
  1314. generateUUID.name = name; // eslint-disable-next-line no-empty
  1315. } catch (err) {} // For CommonJS default export support
  1316. generateUUID.DNS = DNS;
  1317. generateUUID.URL = URL;
  1318. return generateUUID;
  1319. }
  1320. /***/ }),
  1321. /***/ 1472:
  1322. /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
  1323. Object.defineProperty(exports, "__esModule", ({
  1324. value: true
  1325. }));
  1326. exports["default"] = void 0;
  1327. var _rng = _interopRequireDefault(__nccwpck_require__(9784));
  1328. var _stringify = _interopRequireDefault(__nccwpck_require__(1458));
  1329. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1330. function v4(options, buf, offset) {
  1331. options = options || {};
  1332. const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
  1333. rnds[6] = rnds[6] & 0x0f | 0x40;
  1334. rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
  1335. if (buf) {
  1336. offset = offset || 0;
  1337. for (let i = 0; i < 16; ++i) {
  1338. buf[offset + i] = rnds[i];
  1339. }
  1340. return buf;
  1341. }
  1342. return (0, _stringify.default)(rnds);
  1343. }
  1344. var _default = v4;
  1345. exports["default"] = _default;
  1346. /***/ }),
  1347. /***/ 6217:
  1348. /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
  1349. Object.defineProperty(exports, "__esModule", ({
  1350. value: true
  1351. }));
  1352. exports["default"] = void 0;
  1353. var _v = _interopRequireDefault(__nccwpck_require__(5920));
  1354. var _sha = _interopRequireDefault(__nccwpck_require__(8844));
  1355. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1356. const v5 = (0, _v.default)('v5', 0x50, _sha.default);
  1357. var _default = v5;
  1358. exports["default"] = _default;
  1359. /***/ }),
  1360. /***/ 2609:
  1361. /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
  1362. Object.defineProperty(exports, "__esModule", ({
  1363. value: true
  1364. }));
  1365. exports["default"] = void 0;
  1366. var _regex = _interopRequireDefault(__nccwpck_require__(6230));
  1367. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1368. function validate(uuid) {
  1369. return typeof uuid === 'string' && _regex.default.test(uuid);
  1370. }
  1371. var _default = validate;
  1372. exports["default"] = _default;
  1373. /***/ }),
  1374. /***/ 427:
  1375. /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
  1376. Object.defineProperty(exports, "__esModule", ({
  1377. value: true
  1378. }));
  1379. exports["default"] = void 0;
  1380. var _validate = _interopRequireDefault(__nccwpck_require__(2609));
  1381. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1382. function version(uuid) {
  1383. if (!(0, _validate.default)(uuid)) {
  1384. throw TypeError('Invalid UUID');
  1385. }
  1386. return parseInt(uuid.substr(14, 1), 16);
  1387. }
  1388. var _default = version;
  1389. exports["default"] = _default;
  1390. /***/ }),
  1391. /***/ 1514:
  1392. /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
  1393. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  1394. if (k2 === undefined) k2 = k;
  1395. Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  1396. }) : (function(o, m, k, k2) {
  1397. if (k2 === undefined) k2 = k;
  1398. o[k2] = m[k];
  1399. }));
  1400. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  1401. Object.defineProperty(o, "default", { enumerable: true, value: v });
  1402. }) : function(o, v) {
  1403. o["default"] = v;
  1404. });
  1405. var __importStar = (this && this.__importStar) || function (mod) {
  1406. if (mod && mod.__esModule) return mod;
  1407. var result = {};
  1408. if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  1409. __setModuleDefault(result, mod);
  1410. return result;
  1411. };
  1412. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  1413. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  1414. return new (P || (P = Promise))(function (resolve, reject) {
  1415. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  1416. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  1417. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  1418. step((generator = generator.apply(thisArg, _arguments || [])).next());
  1419. });
  1420. };
  1421. Object.defineProperty(exports, "__esModule", ({ value: true }));
  1422. exports.getExecOutput = exports.exec = void 0;
  1423. const string_decoder_1 = __nccwpck_require__(1576);
  1424. const tr = __importStar(__nccwpck_require__(8159));
  1425. /**
  1426. * Exec a command.
  1427. * Output will be streamed to the live console.
  1428. * Returns promise with return code
  1429. *
  1430. * @param commandLine command to execute (can include additional args). Must be correctly escaped.
  1431. * @param args optional arguments for tool. Escaping is handled by the lib.
  1432. * @param options optional exec options. See ExecOptions
  1433. * @returns Promise<number> exit code
  1434. */
  1435. function exec(commandLine, args, options) {
  1436. return __awaiter(this, void 0, void 0, function* () {
  1437. const commandArgs = tr.argStringToArray(commandLine);
  1438. if (commandArgs.length === 0) {
  1439. throw new Error(`Parameter 'commandLine' cannot be null or empty.`);
  1440. }
  1441. // Path to tool to execute should be first arg
  1442. const toolPath = commandArgs[0];
  1443. args = commandArgs.slice(1).concat(args || []);
  1444. const runner = new tr.ToolRunner(toolPath, args, options);
  1445. return runner.exec();
  1446. });
  1447. }
  1448. exports.exec = exec;
  1449. /**
  1450. * Exec a command and get the output.
  1451. * Output will be streamed to the live console.
  1452. * Returns promise with the exit code and collected stdout and stderr
  1453. *
  1454. * @param commandLine command to execute (can include additional args). Must be correctly escaped.
  1455. * @param args optional arguments for tool. Escaping is handled by the lib.
  1456. * @param options optional exec options. See ExecOptions
  1457. * @returns Promise<ExecOutput> exit code, stdout, and stderr
  1458. */
  1459. function getExecOutput(commandLine, args, options) {
  1460. var _a, _b;
  1461. return __awaiter(this, void 0, void 0, function* () {
  1462. let stdout = '';
  1463. let stderr = '';
  1464. //Using string decoder covers the case where a mult-byte character is split
  1465. const stdoutDecoder = new string_decoder_1.StringDecoder('utf8');
  1466. const stderrDecoder = new string_decoder_1.StringDecoder('utf8');
  1467. const originalStdoutListener = (_a = options === null || options === void 0 ? void 0 : options.listeners) === null || _a === void 0 ? void 0 : _a.stdout;
  1468. const originalStdErrListener = (_b = options === null || options === void 0 ? void 0 : options.listeners) === null || _b === void 0 ? void 0 : _b.stderr;
  1469. const stdErrListener = (data) => {
  1470. stderr += stderrDecoder.write(data);
  1471. if (originalStdErrListener) {
  1472. originalStdErrListener(data);
  1473. }
  1474. };
  1475. const stdOutListener = (data) => {
  1476. stdout += stdoutDecoder.write(data);
  1477. if (originalStdoutListener) {
  1478. originalStdoutListener(data);
  1479. }
  1480. };
  1481. const listeners = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.listeners), { stdout: stdOutListener, stderr: stdErrListener });
  1482. const exitCode = yield exec(commandLine, args, Object.assign(Object.assign({}, options), { listeners }));
  1483. //flush any remaining characters
  1484. stdout += stdoutDecoder.end();
  1485. stderr += stderrDecoder.end();
  1486. return {
  1487. exitCode,
  1488. stdout,
  1489. stderr
  1490. };
  1491. });
  1492. }
  1493. exports.getExecOutput = getExecOutput;
  1494. //# sourceMappingURL=exec.js.map
  1495. /***/ }),
  1496. /***/ 8159:
  1497. /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
  1498. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  1499. if (k2 === undefined) k2 = k;
  1500. Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  1501. }) : (function(o, m, k, k2) {
  1502. if (k2 === undefined) k2 = k;
  1503. o[k2] = m[k];
  1504. }));
  1505. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  1506. Object.defineProperty(o, "default", { enumerable: true, value: v });
  1507. }) : function(o, v) {
  1508. o["default"] = v;
  1509. });
  1510. var __importStar = (this && this.__importStar) || function (mod) {
  1511. if (mod && mod.__esModule) return mod;
  1512. var result = {};
  1513. if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  1514. __setModuleDefault(result, mod);
  1515. return result;
  1516. };
  1517. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  1518. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  1519. return new (P || (P = Promise))(function (resolve, reject) {
  1520. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  1521. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  1522. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  1523. step((generator = generator.apply(thisArg, _arguments || [])).next());
  1524. });
  1525. };
  1526. Object.defineProperty(exports, "__esModule", ({ value: true }));
  1527. exports.argStringToArray = exports.ToolRunner = void 0;
  1528. const os = __importStar(__nccwpck_require__(2037));
  1529. const events = __importStar(__nccwpck_require__(2361));
  1530. const child = __importStar(__nccwpck_require__(2081));
  1531. const path = __importStar(__nccwpck_require__(1017));
  1532. const io = __importStar(__nccwpck_require__(7436));
  1533. const ioUtil = __importStar(__nccwpck_require__(1962));
  1534. const timers_1 = __nccwpck_require__(9512);
  1535. /* eslint-disable @typescript-eslint/unbound-method */
  1536. const IS_WINDOWS = process.platform === 'win32';
  1537. /*
  1538. * Class for running command line tools. Handles quoting and arg parsing in a platform agnostic way.
  1539. */
  1540. class ToolRunner extends events.EventEmitter {
  1541. constructor(toolPath, args, options) {
  1542. super();
  1543. if (!toolPath) {
  1544. throw new Error("Parameter 'toolPath' cannot be null or empty.");
  1545. }
  1546. this.toolPath = toolPath;
  1547. this.args = args || [];
  1548. this.options = options || {};
  1549. }
  1550. _debug(message) {
  1551. if (this.options.listeners && this.options.listeners.debug) {
  1552. this.options.listeners.debug(message);
  1553. }
  1554. }
  1555. _getCommandString(options, noPrefix) {
  1556. const toolPath = this._getSpawnFileName();
  1557. const args = this._getSpawnArgs(options);
  1558. let cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool
  1559. if (IS_WINDOWS) {
  1560. // Windows + cmd file
  1561. if (this._isCmdFile()) {
  1562. cmd += toolPath;
  1563. for (const a of args) {
  1564. cmd += ` ${a}`;
  1565. }
  1566. }
  1567. // Windows + verbatim
  1568. else if (options.windowsVerbatimArguments) {
  1569. cmd += `"${toolPath}"`;
  1570. for (const a of args) {
  1571. cmd += ` ${a}`;
  1572. }
  1573. }
  1574. // Windows (regular)
  1575. else {
  1576. cmd += this._windowsQuoteCmdArg(toolPath);
  1577. for (const a of args) {
  1578. cmd += ` ${this._windowsQuoteCmdArg(a)}`;
  1579. }
  1580. }
  1581. }
  1582. else {
  1583. // OSX/Linux - this can likely be improved with some form of quoting.
  1584. // creating processes on Unix is fundamentally different than Windows.
  1585. // on Unix, execvp() takes an arg array.
  1586. cmd += toolPath;
  1587. for (const a of args) {
  1588. cmd += ` ${a}`;
  1589. }
  1590. }
  1591. return cmd;
  1592. }
  1593. _processLineBuffer(data, strBuffer, onLine) {
  1594. try {
  1595. let s = strBuffer + data.toString();
  1596. let n = s.indexOf(os.EOL);
  1597. while (n > -1) {
  1598. const line = s.substring(0, n);
  1599. onLine(line);
  1600. // the rest of the string ...
  1601. s = s.substring(n + os.EOL.length);
  1602. n = s.indexOf(os.EOL);
  1603. }
  1604. return s;
  1605. }
  1606. catch (err) {
  1607. // streaming lines to console is best effort. Don't fail a build.
  1608. this._debug(`error processing line. Failed with error ${err}`);
  1609. return '';
  1610. }
  1611. }
  1612. _getSpawnFileName() {
  1613. if (IS_WINDOWS) {
  1614. if (this._isCmdFile()) {
  1615. return process.env['COMSPEC'] || 'cmd.exe';
  1616. }
  1617. }
  1618. return this.toolPath;
  1619. }
  1620. _getSpawnArgs(options) {
  1621. if (IS_WINDOWS) {
  1622. if (this._isCmdFile()) {
  1623. let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;
  1624. for (const a of this.args) {
  1625. argline += ' ';
  1626. argline += options.windowsVerbatimArguments
  1627. ? a
  1628. : this._windowsQuoteCmdArg(a);
  1629. }
  1630. argline += '"';
  1631. return [argline];
  1632. }
  1633. }
  1634. return this.args;
  1635. }
  1636. _endsWith(str, end) {
  1637. return str.endsWith(end);
  1638. }
  1639. _isCmdFile() {
  1640. const upperToolPath = this.toolPath.toUpperCase();
  1641. return (this._endsWith(upperToolPath, '.CMD') ||
  1642. this._endsWith(upperToolPath, '.BAT'));
  1643. }
  1644. _windowsQuoteCmdArg(arg) {
  1645. // for .exe, apply the normal quoting rules that libuv applies
  1646. if (!this._isCmdFile()) {
  1647. return this._uvQuoteCmdArg(arg);
  1648. }
  1649. // otherwise apply quoting rules specific to the cmd.exe command line parser.
  1650. // the libuv rules are generic and are not designed specifically for cmd.exe
  1651. // command line parser.
  1652. //
  1653. // for a detailed description of the cmd.exe command line parser, refer to
  1654. // http://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts/7970912#7970912
  1655. // need quotes for empty arg
  1656. if (!arg) {
  1657. return '""';
  1658. }
  1659. // determine whether the arg needs to be quoted
  1660. const cmdSpecialChars = [
  1661. ' ',
  1662. '\t',
  1663. '&',
  1664. '(',
  1665. ')',
  1666. '[',
  1667. ']',
  1668. '{',
  1669. '}',
  1670. '^',
  1671. '=',
  1672. ';',
  1673. '!',
  1674. "'",
  1675. '+',
  1676. ',',
  1677. '`',
  1678. '~',
  1679. '|',
  1680. '<',
  1681. '>',
  1682. '"'
  1683. ];
  1684. let needsQuotes = false;
  1685. for (const char of arg) {
  1686. if (cmdSpecialChars.some(x => x === char)) {
  1687. needsQuotes = true;
  1688. break;
  1689. }
  1690. }
  1691. // short-circuit if quotes not needed
  1692. if (!needsQuotes) {
  1693. return arg;
  1694. }
  1695. // the following quoting rules are very similar to the rules that by libuv applies.
  1696. //
  1697. // 1) wrap the string in quotes
  1698. //
  1699. // 2) double-up quotes - i.e. " => ""
  1700. //
  1701. // this is different from the libuv quoting rules. libuv replaces " with \", which unfortunately
  1702. // doesn't work well with a cmd.exe command line.
  1703. //
  1704. // note, replacing " with "" also works well if the arg is passed to a downstream .NET console app.
  1705. // for example, the command line:
  1706. // foo.exe "myarg:""my val"""
  1707. // is parsed by a .NET console app into an arg array:
  1708. // [ "myarg:\"my val\"" ]
  1709. // which is the same end result when applying libuv quoting rules. although the actual
  1710. // command line from libuv quoting rules would look like:
  1711. // foo.exe "myarg:\"my val\""
  1712. //
  1713. // 3) double-up slashes that precede a quote,
  1714. // e.g. hello \world => "hello \world"
  1715. // hello\"world => "hello\\""world"
  1716. // hello\\"world => "hello\\\\""world"
  1717. // hello world\ => "hello world\\"
  1718. //
  1719. // technically this is not required for a cmd.exe command line, or the batch argument parser.
  1720. // the reasons for including this as a .cmd quoting rule are:
  1721. //
  1722. // a) this is optimized for the scenario where the argument is passed from the .cmd file to an
  1723. // external program. many programs (e.g. .NET console apps) rely on the slash-doubling rule.
  1724. //
  1725. // b) it's what we've been doing previously (by deferring to node default behavior) and we
  1726. // haven't heard any complaints about that aspect.
  1727. //
  1728. // note, a weakness of the quoting rules chosen here, is that % is not escaped. in fact, % cannot be
  1729. // escaped when used on the command line directly - even though within a .cmd file % can be escaped
  1730. // by using %%.
  1731. //
  1732. // the saving grace is, on the command line, %var% is left as-is if var is not defined. this contrasts
  1733. // the line parsing rules within a .cmd file, where if var is not defined it is replaced with nothing.
  1734. //
  1735. // one option that was explored was replacing % with ^% - i.e. %var% => ^%var^%. this hack would
  1736. // often work, since it is unlikely that var^ would exist, and the ^ character is removed when the
  1737. // variable is used. the problem, however, is that ^ is not removed when %* is used to pass the args
  1738. // to an external program.
  1739. //
  1740. // an unexplored potential solution for the % escaping problem, is to create a wrapper .cmd file.
  1741. // % can be escaped within a .cmd file.
  1742. let reverse = '"';
  1743. let quoteHit = true;
  1744. for (let i = arg.length; i > 0; i--) {
  1745. // walk the string in reverse
  1746. reverse += arg[i - 1];
  1747. if (quoteHit && arg[i - 1] === '\\') {
  1748. reverse += '\\'; // double the slash
  1749. }
  1750. else if (arg[i - 1] === '"') {
  1751. quoteHit = true;
  1752. reverse += '"'; // double the quote
  1753. }
  1754. else {
  1755. quoteHit = false;
  1756. }
  1757. }
  1758. reverse += '"';
  1759. return reverse
  1760. .split('')
  1761. .reverse()
  1762. .join('');
  1763. }
  1764. _uvQuoteCmdArg(arg) {
  1765. // Tool runner wraps child_process.spawn() and needs to apply the same quoting as
  1766. // Node in certain cases where the undocumented spawn option windowsVerbatimArguments
  1767. // is used.
  1768. //
  1769. // Since this function is a port of quote_cmd_arg from Node 4.x (technically, lib UV,
  1770. // see https://github.com/nodejs/node/blob/v4.x/deps/uv/src/win/process.c for details),
  1771. // pasting copyright notice from Node within this function:
  1772. //
  1773. // Copyright Joyent, Inc. and other Node contributors. All rights reserved.
  1774. //
  1775. // Permission is hereby granted, free of charge, to any person obtaining a copy
  1776. // of this software and associated documentation files (the "Software"), to
  1777. // deal in the Software without restriction, including without limitation the
  1778. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  1779. // sell copies of the Software, and to permit persons to whom the Software is
  1780. // furnished to do so, subject to the following conditions:
  1781. //
  1782. // The above copyright notice and this permission notice shall be included in
  1783. // all copies or substantial portions of the Software.
  1784. //
  1785. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1786. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1787. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1788. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1789. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  1790. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  1791. // IN THE SOFTWARE.
  1792. if (!arg) {
  1793. // Need double quotation for empty argument
  1794. return '""';
  1795. }
  1796. if (!arg.includes(' ') && !arg.includes('\t') && !arg.includes('"')) {
  1797. // No quotation needed
  1798. return arg;
  1799. }
  1800. if (!arg.includes('"') && !arg.includes('\\')) {
  1801. // No embedded double quotes or backslashes, so I can just wrap
  1802. // quote marks around the whole thing.
  1803. return `"${arg}"`;
  1804. }
  1805. // Expected input/output:
  1806. // input : hello"world
  1807. // output: "hello\"world"
  1808. // input : hello""world
  1809. // output: "hello\"\"world"
  1810. // input : hello\world
  1811. // output: hello\world
  1812. // input : hello\\world
  1813. // output: hello\\world
  1814. // input : hello\"world
  1815. // output: "hello\\\"world"
  1816. // input : hello\\"world
  1817. // output: "hello\\\\\"world"
  1818. // input : hello world\
  1819. // output: "hello world\\" - note the comment in libuv actually reads "hello world\"
  1820. // but it appears the comment is wrong, it should be "hello world\\"
  1821. let reverse = '"';
  1822. let quoteHit = true;
  1823. for (let i = arg.length; i > 0; i--) {
  1824. // walk the string in reverse
  1825. reverse += arg[i - 1];
  1826. if (quoteHit && arg[i - 1] === '\\') {
  1827. reverse += '\\';
  1828. }
  1829. else if (arg[i - 1] === '"') {
  1830. quoteHit = true;
  1831. reverse += '\\';
  1832. }
  1833. else {
  1834. quoteHit = false;
  1835. }
  1836. }
  1837. reverse += '"';
  1838. return reverse
  1839. .split('')
  1840. .reverse()
  1841. .join('');
  1842. }
  1843. _cloneExecOptions(options) {
  1844. options = options || {};
  1845. const result = {
  1846. cwd: options.cwd || process.cwd(),
  1847. env: options.env || process.env,
  1848. silent: options.silent || false,
  1849. windowsVerbatimArguments: options.windowsVerbatimArguments || false,
  1850. failOnStdErr: options.failOnStdErr || false,
  1851. ignoreReturnCode: options.ignoreReturnCode || false,
  1852. delay: options.delay || 10000
  1853. };
  1854. result.outStream = options.outStream || process.stdout;
  1855. result.errStream = options.errStream || process.stderr;
  1856. return result;
  1857. }
  1858. _getSpawnOptions(options, toolPath) {
  1859. options = options || {};
  1860. const result = {};
  1861. result.cwd = options.cwd;
  1862. result.env = options.env;
  1863. result['windowsVerbatimArguments'] =
  1864. options.windowsVerbatimArguments || this._isCmdFile();
  1865. if (options.windowsVerbatimArguments) {
  1866. result.argv0 = `"${toolPath}"`;
  1867. }
  1868. return result;
  1869. }
  1870. /**
  1871. * Exec a tool.
  1872. * Output will be streamed to the live console.
  1873. * Returns promise with return code
  1874. *
  1875. * @param tool path to tool to exec
  1876. * @param options optional exec options. See ExecOptions
  1877. * @returns number
  1878. */
  1879. exec() {
  1880. return __awaiter(this, void 0, void 0, function* () {
  1881. // root the tool path if it is unrooted and contains relative pathing
  1882. if (!ioUtil.isRooted(this.toolPath) &&
  1883. (this.toolPath.includes('/') ||
  1884. (IS_WINDOWS && this.toolPath.includes('\\')))) {
  1885. // prefer options.cwd if it is specified, however options.cwd may also need to be rooted
  1886. this.toolPath = path.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath);
  1887. }
  1888. // if the tool is only a file name, then resolve it from the PATH
  1889. // otherwise verify it exists (add extension on Windows if necessary)
  1890. this.toolPath = yield io.which(this.toolPath, true);
  1891. return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
  1892. this._debug(`exec tool: ${this.toolPath}`);
  1893. this._debug('arguments:');
  1894. for (const arg of this.args) {
  1895. this._debug(` ${arg}`);
  1896. }
  1897. const optionsNonNull = this._cloneExecOptions(this.options);
  1898. if (!optionsNonNull.silent && optionsNonNull.outStream) {
  1899. optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL);
  1900. }
  1901. const state = new ExecState(optionsNonNull, this.toolPath);
  1902. state.on('debug', (message) => {
  1903. this._debug(message);
  1904. });
  1905. if (this.options.cwd && !(yield ioUtil.exists(this.options.cwd))) {
  1906. return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`));
  1907. }
  1908. const fileName = this._getSpawnFileName();
  1909. const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName));
  1910. let stdbuffer = '';
  1911. if (cp.stdout) {
  1912. cp.stdout.on('data', (data) => {
  1913. if (this.options.listeners && this.options.listeners.stdout) {
  1914. this.options.listeners.stdout(data);
  1915. }
  1916. if (!optionsNonNull.silent && optionsNonNull.outStream) {
  1917. optionsNonNull.outStream.write(data);
  1918. }
  1919. stdbuffer = this._processLineBuffer(data, stdbuffer, (line) => {
  1920. if (this.options.listeners && this.options.listeners.stdline) {
  1921. this.options.listeners.stdline(line);
  1922. }
  1923. });
  1924. });
  1925. }
  1926. let errbuffer = '';
  1927. if (cp.stderr) {
  1928. cp.stderr.on('data', (data) => {
  1929. state.processStderr = true;
  1930. if (this.options.listeners && this.options.listeners.stderr) {
  1931. this.options.listeners.stderr(data);
  1932. }
  1933. if (!optionsNonNull.silent &&
  1934. optionsNonNull.errStream &&
  1935. optionsNonNull.outStream) {
  1936. const s = optionsNonNull.failOnStdErr
  1937. ? optionsNonNull.errStream
  1938. : optionsNonNull.outStream;
  1939. s.write(data);
  1940. }
  1941. errbuffer = this._processLineBuffer(data, errbuffer, (line) => {
  1942. if (this.options.listeners && this.options.listeners.errline) {
  1943. this.options.listeners.errline(line);
  1944. }
  1945. });
  1946. });
  1947. }
  1948. cp.on('error', (err) => {
  1949. state.processError = err.message;
  1950. state.processExited = true;
  1951. state.processClosed = true;
  1952. state.CheckComplete();
  1953. });
  1954. cp.on('exit', (code) => {
  1955. state.processExitCode = code;
  1956. state.processExited = true;
  1957. this._debug(`Exit code ${code} received from tool '${this.toolPath}'`);
  1958. state.CheckComplete();
  1959. });
  1960. cp.on('close', (code) => {
  1961. state.processExitCode = code;
  1962. state.processExited = true;
  1963. state.processClosed = true;
  1964. this._debug(`STDIO streams have closed for tool '${this.toolPath}'`);
  1965. state.CheckComplete();
  1966. });
  1967. state.on('done', (error, exitCode) => {
  1968. if (stdbuffer.length > 0) {
  1969. this.emit('stdline', stdbuffer);
  1970. }
  1971. if (errbuffer.length > 0) {
  1972. this.emit('errline', errbuffer);
  1973. }
  1974. cp.removeAllListeners();
  1975. if (error) {
  1976. reject(error);
  1977. }
  1978. else {
  1979. resolve(exitCode);
  1980. }
  1981. });
  1982. if (this.options.input) {
  1983. if (!cp.stdin) {
  1984. throw new Error('child process missing stdin');
  1985. }
  1986. cp.stdin.end(this.options.input);
  1987. }
  1988. }));
  1989. });
  1990. }
  1991. }
  1992. exports.ToolRunner = ToolRunner;
  1993. /**
  1994. * Convert an arg string to an array of args. Handles escaping
  1995. *
  1996. * @param argString string of arguments
  1997. * @returns string[] array of arguments
  1998. */
  1999. function argStringToArray(argString) {
  2000. const args = [];
  2001. let inQuotes = false;
  2002. let escaped = false;
  2003. let arg = '';
  2004. function append(c) {
  2005. // we only escape double quotes.
  2006. if (escaped && c !== '"') {
  2007. arg += '\\';
  2008. }
  2009. arg += c;
  2010. escaped = false;
  2011. }
  2012. for (let i = 0; i < argString.length; i++) {
  2013. const c = argString.charAt(i);
  2014. if (c === '"') {
  2015. if (!escaped) {
  2016. inQuotes = !inQuotes;
  2017. }
  2018. else {
  2019. append(c);
  2020. }
  2021. continue;
  2022. }
  2023. if (c === '\\' && escaped) {
  2024. append(c);
  2025. continue;
  2026. }
  2027. if (c === '\\' && inQuotes) {
  2028. escaped = true;
  2029. continue;
  2030. }
  2031. if (c === ' ' && !inQuotes) {
  2032. if (arg.length > 0) {
  2033. args.push(arg);
  2034. arg = '';
  2035. }
  2036. continue;
  2037. }
  2038. append(c);
  2039. }
  2040. if (arg.length > 0) {
  2041. args.push(arg.trim());
  2042. }
  2043. return args;
  2044. }
  2045. exports.argStringToArray = argStringToArray;
  2046. class ExecState extends events.EventEmitter {
  2047. constructor(options, toolPath) {
  2048. super();
  2049. this.processClosed = false; // tracks whether the process has exited and stdio is closed
  2050. this.processError = '';
  2051. this.processExitCode = 0;
  2052. this.processExited = false; // tracks whether the process has exited
  2053. this.processStderr = false; // tracks whether stderr was written to
  2054. this.delay = 10000; // 10 seconds
  2055. this.done = false;
  2056. this.timeout = null;
  2057. if (!toolPath) {
  2058. throw new Error('toolPath must not be empty');
  2059. }
  2060. this.options = options;
  2061. this.toolPath = toolPath;
  2062. if (options.delay) {
  2063. this.delay = options.delay;
  2064. }
  2065. }
  2066. CheckComplete() {
  2067. if (this.done) {
  2068. return;
  2069. }
  2070. if (this.processClosed) {
  2071. this._setResult();
  2072. }
  2073. else if (this.processExited) {
  2074. this.timeout = timers_1.setTimeout(ExecState.HandleTimeout, this.delay, this);
  2075. }
  2076. }
  2077. _debug(message) {
  2078. this.emit('debug', message);
  2079. }
  2080. _setResult() {
  2081. // determine whether there is an error
  2082. let error;
  2083. if (this.processExited) {
  2084. if (this.processError) {
  2085. error = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`);
  2086. }
  2087. else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) {
  2088. error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);
  2089. }
  2090. else if (this.processStderr && this.options.failOnStdErr) {
  2091. error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`);
  2092. }
  2093. }
  2094. // clear the timeout
  2095. if (this.timeout) {
  2096. clearTimeout(this.timeout);
  2097. this.timeout = null;
  2098. }
  2099. this.done = true;
  2100. this.emit('done', error, this.processExitCode);
  2101. }
  2102. static HandleTimeout(state) {
  2103. if (state.done) {
  2104. return;
  2105. }
  2106. if (!state.processClosed && state.processExited) {
  2107. const message = `The STDIO streams did not close within ${state.delay /
  2108. 1000} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`;
  2109. state._debug(message);
  2110. }
  2111. state._setResult();
  2112. }
  2113. }
  2114. //# sourceMappingURL=toolrunner.js.map
  2115. /***/ }),
  2116. /***/ 4087:
  2117. /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
  2118. Object.defineProperty(exports, "__esModule", ({ value: true }));
  2119. exports.Context = void 0;
  2120. const fs_1 = __nccwpck_require__(7147);
  2121. const os_1 = __nccwpck_require__(2037);
  2122. class Context {
  2123. /**
  2124. * Hydrate the context from the environment
  2125. */
  2126. constructor() {
  2127. var _a, _b, _c;
  2128. this.payload = {};
  2129. if (process.env.GITHUB_EVENT_PATH) {
  2130. if ((0, fs_1.existsSync)(process.env.GITHUB_EVENT_PATH)) {
  2131. this.payload = JSON.parse((0, fs_1.readFileSync)(process.env.GITHUB_EVENT_PATH, { encoding: 'utf8' }));
  2132. }
  2133. else {
  2134. const path = process.env.GITHUB_EVENT_PATH;
  2135. process.stdout.write(`GITHUB_EVENT_PATH ${path} does not exist${os_1.EOL}`);
  2136. }
  2137. }
  2138. this.eventName = process.env.GITHUB_EVENT_NAME;
  2139. this.sha = process.env.GITHUB_SHA;
  2140. this.ref = process.env.GITHUB_REF;
  2141. this.workflow = process.env.GITHUB_WORKFLOW;
  2142. this.action = process.env.GITHUB_ACTION;
  2143. this.actor = process.env.GITHUB_ACTOR;
  2144. this.job = process.env.GITHUB_JOB;
  2145. this.runNumber = parseInt(process.env.GITHUB_RUN_NUMBER, 10);
  2146. this.runId = parseInt(process.env.GITHUB_RUN_ID, 10);
  2147. this.apiUrl = (_a = process.env.GITHUB_API_URL) !== null && _a !== void 0 ? _a : `https://api.github.com`;
  2148. this.serverUrl = (_b = process.env.GITHUB_SERVER_URL) !== null && _b !== void 0 ? _b : `https://github.com`;
  2149. this.graphqlUrl =
  2150. (_c = process.env.GITHUB_GRAPHQL_URL) !== null && _c !== void 0 ? _c : `https://api.github.com/graphql`;
  2151. }
  2152. get issue() {
  2153. const payload = this.payload;
  2154. return Object.assign(Object.assign({}, this.repo), { number: (payload.issue || payload.pull_request || payload).number });
  2155. }
  2156. get repo() {
  2157. if (process.env.GITHUB_REPOSITORY) {
  2158. const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
  2159. return { owner, repo };
  2160. }
  2161. if (this.payload.repository) {
  2162. return {
  2163. owner: this.payload.repository.owner.login,
  2164. repo: this.payload.repository.name
  2165. };
  2166. }
  2167. throw new Error("context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'");
  2168. }
  2169. }
  2170. exports.Context = Context;
  2171. //# sourceMappingURL=context.js.map
  2172. /***/ }),
  2173. /***/ 5438:
  2174. /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
  2175. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  2176. if (k2 === undefined) k2 = k;
  2177. var desc = Object.getOwnPropertyDescriptor(m, k);
  2178. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  2179. desc = { enumerable: true, get: function() { return m[k]; } };
  2180. }
  2181. Object.defineProperty(o, k2, desc);
  2182. }) : (function(o, m, k, k2) {
  2183. if (k2 === undefined) k2 = k;
  2184. o[k2] = m[k];
  2185. }));
  2186. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  2187. Object.defineProperty(o, "default", { enumerable: true, value: v });
  2188. }) : function(o, v) {
  2189. o["default"] = v;
  2190. });
  2191. var __importStar = (this && this.__importStar) || function (mod) {
  2192. if (mod && mod.__esModule) return mod;
  2193. var result = {};
  2194. if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  2195. __setModuleDefault(result, mod);
  2196. return result;
  2197. };
  2198. Object.defineProperty(exports, "__esModule", ({ value: true }));
  2199. exports.getOctokit = exports.context = void 0;
  2200. const Context = __importStar(__nccwpck_require__(4087));
  2201. const utils_1 = __nccwpck_require__(3030);
  2202. exports.context = new Context.Context();
  2203. /**
  2204. * Returns a hydrated octokit ready to use for GitHub Actions
  2205. *
  2206. * @param token the repo PAT or GITHUB_TOKEN
  2207. * @param options other options to set
  2208. */
  2209. function getOctokit(token, options, ...additionalPlugins) {
  2210. const GitHubWithPlugins = utils_1.GitHub.plugin(...additionalPlugins);
  2211. return new GitHubWithPlugins((0, utils_1.getOctokitOptions)(token, options));
  2212. }
  2213. exports.getOctokit = getOctokit;
  2214. //# sourceMappingURL=github.js.map
  2215. /***/ }),
  2216. /***/ 7914:
  2217. /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
  2218. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  2219. if (k2 === undefined) k2 = k;
  2220. var desc = Object.getOwnPropertyDescriptor(m, k);
  2221. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  2222. desc = { enumerable: true, get: function() { return m[k]; } };
  2223. }
  2224. Object.defineProperty(o, k2, desc);
  2225. }) : (function(o, m, k, k2) {
  2226. if (k2 === undefined) k2 = k;
  2227. o[k2] = m[k];
  2228. }));
  2229. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  2230. Object.defineProperty(o, "default", { enumerable: true, value: v });
  2231. }) : function(o, v) {
  2232. o["default"] = v;
  2233. });
  2234. var __importStar = (this && this.__importStar) || function (mod) {
  2235. if (mod && mod.__esModule) return mod;
  2236. var result = {};
  2237. if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  2238. __setModuleDefault(result, mod);
  2239. return result;
  2240. };
  2241. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  2242. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  2243. return new (P || (P = Promise))(function (resolve, reject) {
  2244. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  2245. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  2246. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  2247. step((generator = generator.apply(thisArg, _arguments || [])).next());
  2248. });
  2249. };
  2250. Object.defineProperty(exports, "__esModule", ({ value: true }));
  2251. exports.getApiBaseUrl = exports.getProxyFetch = exports.getProxyAgentDispatcher = exports.getProxyAgent = exports.getAuthString = void 0;
  2252. const httpClient = __importStar(__nccwpck_require__(6255));
  2253. const undici_1 = __nccwpck_require__(1773);
  2254. function getAuthString(token, options) {
  2255. if (!token && !options.auth) {
  2256. throw new Error('Parameter token or opts.auth is required');
  2257. }
  2258. else if (token && options.auth) {
  2259. throw new Error('Parameters token and opts.auth may not both be specified');
  2260. }
  2261. return typeof options.auth === 'string' ? options.auth : `token ${token}`;
  2262. }
  2263. exports.getAuthString = getAuthString;
  2264. function getProxyAgent(destinationUrl) {
  2265. const hc = new httpClient.HttpClient();
  2266. return hc.getAgent(destinationUrl);
  2267. }
  2268. exports.getProxyAgent = getProxyAgent;
  2269. function getProxyAgentDispatcher(destinationUrl) {
  2270. const hc = new httpClient.HttpClient();
  2271. return hc.getAgentDispatcher(destinationUrl);
  2272. }
  2273. exports.getProxyAgentDispatcher = getProxyAgentDispatcher;
  2274. function getProxyFetch(destinationUrl) {
  2275. const httpDispatcher = getProxyAgentDispatcher(destinationUrl);
  2276. const proxyFetch = (url, opts) => __awaiter(this, void 0, void 0, function* () {
  2277. return (0, undici_1.fetch)(url, Object.assign(Object.assign({}, opts), { dispatcher: httpDispatcher }));
  2278. });
  2279. return proxyFetch;
  2280. }
  2281. exports.getProxyFetch = getProxyFetch;
  2282. function getApiBaseUrl() {
  2283. return process.env['GITHUB_API_URL'] || 'https://api.github.com';
  2284. }
  2285. exports.getApiBaseUrl = getApiBaseUrl;
  2286. //# sourceMappingURL=utils.js.map
  2287. /***/ }),
  2288. /***/ 3030:
  2289. /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
  2290. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  2291. if (k2 === undefined) k2 = k;
  2292. var desc = Object.getOwnPropertyDescriptor(m, k);
  2293. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  2294. desc = { enumerable: true, get: function() { return m[k]; } };
  2295. }
  2296. Object.defineProperty(o, k2, desc);
  2297. }) : (function(o, m, k, k2) {
  2298. if (k2 === undefined) k2 = k;
  2299. o[k2] = m[k];
  2300. }));
  2301. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  2302. Object.defineProperty(o, "default", { enumerable: true, value: v });
  2303. }) : function(o, v) {
  2304. o["default"] = v;
  2305. });
  2306. var __importStar = (this && this.__importStar) || function (mod) {
  2307. if (mod && mod.__esModule) return mod;
  2308. var result = {};
  2309. if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  2310. __setModuleDefault(result, mod);
  2311. return result;
  2312. };
  2313. Object.defineProperty(exports, "__esModule", ({ value: true }));
  2314. exports.getOctokitOptions = exports.GitHub = exports.defaults = exports.context = void 0;
  2315. const Context = __importStar(__nccwpck_require__(4087));
  2316. const Utils = __importStar(__nccwpck_require__(7914));
  2317. // octokit + plugins
  2318. const core_1 = __nccwpck_require__(6762);
  2319. const plugin_rest_endpoint_methods_1 = __nccwpck_require__(3044);
  2320. const plugin_paginate_rest_1 = __nccwpck_require__(4193);
  2321. exports.context = new Context.Context();
  2322. const baseUrl = Utils.getApiBaseUrl();
  2323. exports.defaults = {
  2324. baseUrl,
  2325. request: {
  2326. agent: Utils.getProxyAgent(baseUrl),
  2327. fetch: Utils.getProxyFetch(baseUrl)
  2328. }
  2329. };
  2330. exports.GitHub = core_1.Octokit.plugin(plugin_rest_endpoint_methods_1.restEndpointMethods, plugin_paginate_rest_1.paginateRest).defaults(exports.defaults);
  2331. /**
  2332. * Convience function to correctly format Octokit Options to pass into the constructor.
  2333. *
  2334. * @param token the repo PAT or GITHUB_TOKEN
  2335. * @param options other options to set
  2336. */
  2337. function getOctokitOptions(token, options) {
  2338. const opts = Object.assign({}, options || {}); // Shallow clone - don't mutate the object provided by the caller
  2339. // Auth
  2340. const auth = Utils.getAuthString(token, opts);
  2341. if (auth) {
  2342. opts.auth = auth;
  2343. }
  2344. return opts;
  2345. }
  2346. exports.getOctokitOptions = getOctokitOptions;
  2347. //# sourceMappingURL=utils.js.map
  2348. /***/ }),
  2349. /***/ 5526:
  2350. /***/ (function(__unused_webpack_module, exports) {
  2351. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  2352. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  2353. return new (P || (P = Promise))(function (resolve, reject) {
  2354. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  2355. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  2356. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  2357. step((generator = generator.apply(thisArg, _arguments || [])).next());
  2358. });
  2359. };
  2360. Object.defineProperty(exports, "__esModule", ({ value: true }));
  2361. exports.PersonalAccessTokenCredentialHandler = exports.BearerCredentialHandler = exports.BasicCredentialHandler = void 0;
  2362. class BasicCredentialHandler {
  2363. constructor(username, password) {
  2364. this.username = username;
  2365. this.password = password;
  2366. }
  2367. prepareRequest(options) {
  2368. if (!options.headers) {
  2369. throw Error('The request has no headers');
  2370. }
  2371. options.headers['Authorization'] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString('base64')}`;
  2372. }
  2373. // This handler cannot handle 401
  2374. canHandleAuthentication() {
  2375. return false;
  2376. }
  2377. handleAuthentication() {
  2378. return __awaiter(this, void 0, void 0, function* () {
  2379. throw new Error('not implemented');
  2380. });
  2381. }
  2382. }
  2383. exports.BasicCredentialHandler = BasicCredentialHandler;
  2384. class BearerCredentialHandler {
  2385. constructor(token) {
  2386. this.token = token;
  2387. }
  2388. // currently implements pre-authorization
  2389. // TODO: support preAuth = false where it hooks on 401
  2390. prepareRequest(options) {
  2391. if (!options.headers) {
  2392. throw Error('The request has no headers');
  2393. }
  2394. options.headers['Authorization'] = `Bearer ${this.token}`;
  2395. }
  2396. // This handler cannot handle 401
  2397. canHandleAuthentication() {
  2398. return false;
  2399. }
  2400. handleAuthentication() {
  2401. return __awaiter(this, void 0, void 0, function* () {
  2402. throw new Error('not implemented');
  2403. });
  2404. }
  2405. }
  2406. exports.BearerCredentialHandler = BearerCredentialHandler;
  2407. class PersonalAccessTokenCredentialHandler {
  2408. constructor(token) {
  2409. this.token = token;
  2410. }
  2411. // currently implements pre-authorization
  2412. // TODO: support preAuth = false where it hooks on 401
  2413. prepareRequest(options) {
  2414. if (!options.headers) {
  2415. throw Error('The request has no headers');
  2416. }
  2417. options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`;
  2418. }
  2419. // This handler cannot handle 401
  2420. canHandleAuthentication() {
  2421. return false;
  2422. }
  2423. handleAuthentication() {
  2424. return __awaiter(this, void 0, void 0, function* () {
  2425. throw new Error('not implemented');
  2426. });
  2427. }
  2428. }
  2429. exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler;
  2430. //# sourceMappingURL=auth.js.map
  2431. /***/ }),
  2432. /***/ 6255:
  2433. /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
  2434. /* eslint-disable @typescript-eslint/no-explicit-any */
  2435. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  2436. if (k2 === undefined) k2 = k;
  2437. var desc = Object.getOwnPropertyDescriptor(m, k);
  2438. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  2439. desc = { enumerable: true, get: function() { return m[k]; } };
  2440. }
  2441. Object.defineProperty(o, k2, desc);
  2442. }) : (function(o, m, k, k2) {
  2443. if (k2 === undefined) k2 = k;
  2444. o[k2] = m[k];
  2445. }));
  2446. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  2447. Object.defineProperty(o, "default", { enumerable: true, value: v });
  2448. }) : function(o, v) {
  2449. o["default"] = v;
  2450. });
  2451. var __importStar = (this && this.__importStar) || function (mod) {
  2452. if (mod && mod.__esModule) return mod;
  2453. var result = {};
  2454. if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  2455. __setModuleDefault(result, mod);
  2456. return result;
  2457. };
  2458. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  2459. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  2460. return new (P || (P = Promise))(function (resolve, reject) {
  2461. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  2462. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  2463. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  2464. step((generator = generator.apply(thisArg, _arguments || [])).next());
  2465. });
  2466. };
  2467. Object.defineProperty(exports, "__esModule", ({ value: true }));
  2468. exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0;
  2469. const http = __importStar(__nccwpck_require__(3685));
  2470. const https = __importStar(__nccwpck_require__(5687));
  2471. const pm = __importStar(__nccwpck_require__(9835));
  2472. const tunnel = __importStar(__nccwpck_require__(4294));
  2473. const undici_1 = __nccwpck_require__(1773);
  2474. var HttpCodes;
  2475. (function (HttpCodes) {
  2476. HttpCodes[HttpCodes["OK"] = 200] = "OK";
  2477. HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices";
  2478. HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently";
  2479. HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved";
  2480. HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther";
  2481. HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified";
  2482. HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy";
  2483. HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy";
  2484. HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect";
  2485. HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect";
  2486. HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest";
  2487. HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized";
  2488. HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired";
  2489. HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden";
  2490. HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound";
  2491. HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed";
  2492. HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable";
  2493. HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
  2494. HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout";
  2495. HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict";
  2496. HttpCodes[HttpCodes["Gone"] = 410] = "Gone";
  2497. HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests";
  2498. HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError";
  2499. HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented";
  2500. HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway";
  2501. HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
  2502. HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
  2503. })(HttpCodes || (exports.HttpCodes = HttpCodes = {}));
  2504. var Headers;
  2505. (function (Headers) {
  2506. Headers["Accept"] = "accept";
  2507. Headers["ContentType"] = "content-type";
  2508. })(Headers || (exports.Headers = Headers = {}));
  2509. var MediaTypes;
  2510. (function (MediaTypes) {
  2511. MediaTypes["ApplicationJson"] = "application/json";
  2512. })(MediaTypes || (exports.MediaTypes = MediaTypes = {}));
  2513. /**
  2514. * Returns the proxy URL, depending upon the supplied url and proxy environment variables.
  2515. * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
  2516. */
  2517. function getProxyUrl(serverUrl) {
  2518. const proxyUrl = pm.getProxyUrl(new URL(serverUrl));
  2519. return proxyUrl ? proxyUrl.href : '';
  2520. }
  2521. exports.getProxyUrl = getProxyUrl;
  2522. const HttpRedirectCodes = [
  2523. HttpCodes.MovedPermanently,
  2524. HttpCodes.ResourceMoved,
  2525. HttpCodes.SeeOther,
  2526. HttpCodes.TemporaryRedirect,
  2527. HttpCodes.PermanentRedirect
  2528. ];
  2529. const HttpResponseRetryCodes = [
  2530. HttpCodes.BadGateway,
  2531. HttpCodes.ServiceUnavailable,
  2532. HttpCodes.GatewayTimeout
  2533. ];
  2534. const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];
  2535. const ExponentialBackoffCeiling = 10;
  2536. const ExponentialBackoffTimeSlice = 5;
  2537. class HttpClientError extends Error {
  2538. constructor(message, statusCode) {
  2539. super(message);
  2540. this.name = 'HttpClientError';
  2541. this.statusCode = statusCode;
  2542. Object.setPrototypeOf(this, HttpClientError.prototype);
  2543. }
  2544. }
  2545. exports.HttpClientError = HttpClientError;
  2546. class HttpClientResponse {
  2547. constructor(message) {
  2548. this.message = message;
  2549. }
  2550. readBody() {
  2551. return __awaiter(this, void 0, void 0, function* () {
  2552. return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
  2553. let output = Buffer.alloc(0);
  2554. this.message.on('data', (chunk) => {
  2555. output = Buffer.concat([output, chunk]);
  2556. });
  2557. this.message.on('end', () => {
  2558. resolve(output.toString());
  2559. });
  2560. }));
  2561. });
  2562. }
  2563. readBodyBuffer() {
  2564. return __awaiter(this, void 0, void 0, function* () {
  2565. return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
  2566. const chunks = [];
  2567. this.message.on('data', (chunk) => {
  2568. chunks.push(chunk);
  2569. });
  2570. this.message.on('end', () => {
  2571. resolve(Buffer.concat(chunks));
  2572. });
  2573. }));
  2574. });
  2575. }
  2576. }
  2577. exports.HttpClientResponse = HttpClientResponse;
  2578. function isHttps(requestUrl) {
  2579. const parsedUrl = new URL(requestUrl);
  2580. return parsedUrl.protocol === 'https:';
  2581. }
  2582. exports.isHttps = isHttps;
  2583. class HttpClient {
  2584. constructor(userAgent, handlers, requestOptions) {
  2585. this._ignoreSslError = false;
  2586. this._allowRedirects = true;
  2587. this._allowRedirectDowngrade = false;
  2588. this._maxRedirects = 50;
  2589. this._allowRetries = false;
  2590. this._maxRetries = 1;
  2591. this._keepAlive = false;
  2592. this._disposed = false;
  2593. this.userAgent = userAgent;
  2594. this.handlers = handlers || [];
  2595. this.requestOptions = requestOptions;
  2596. if (requestOptions) {
  2597. if (requestOptions.ignoreSslError != null) {
  2598. this._ignoreSslError = requestOptions.ignoreSslError;
  2599. }
  2600. this._socketTimeout = requestOptions.socketTimeout;
  2601. if (requestOptions.allowRedirects != null) {
  2602. this._allowRedirects = requestOptions.allowRedirects;
  2603. }
  2604. if (requestOptions.allowRedirectDowngrade != null) {
  2605. this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;
  2606. }
  2607. if (requestOptions.maxRedirects != null) {
  2608. this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);
  2609. }
  2610. if (requestOptions.keepAlive != null) {
  2611. this._keepAlive = requestOptions.keepAlive;
  2612. }
  2613. if (requestOptions.allowRetries != null) {
  2614. this._allowRetries = requestOptions.allowRetries;
  2615. }
  2616. if (requestOptions.maxRetries != null) {
  2617. this._maxRetries = requestOptions.maxRetries;
  2618. }
  2619. }
  2620. }
  2621. options(requestUrl, additionalHeaders) {
  2622. return __awaiter(this, void 0, void 0, function* () {
  2623. return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});
  2624. });
  2625. }
  2626. get(requestUrl, additionalHeaders) {
  2627. return __awaiter(this, void 0, void 0, function* () {
  2628. return this.request('GET', requestUrl, null, additionalHeaders || {});
  2629. });
  2630. }
  2631. del(requestUrl, additionalHeaders) {
  2632. return __awaiter(this, void 0, void 0, function* () {
  2633. return this.request('DELETE', requestUrl, null, additionalHeaders || {});
  2634. });
  2635. }
  2636. post(requestUrl, data, additionalHeaders) {
  2637. return __awaiter(this, void 0, void 0, function* () {
  2638. return this.request('POST', requestUrl, data, additionalHeaders || {});
  2639. });
  2640. }
  2641. patch(requestUrl, data, additionalHeaders) {
  2642. return __awaiter(this, void 0, void 0, function* () {
  2643. return this.request('PATCH', requestUrl, data, additionalHeaders || {});
  2644. });
  2645. }
  2646. put(requestUrl, data, additionalHeaders) {
  2647. return __awaiter(this, void 0, void 0, function* () {
  2648. return this.request('PUT', requestUrl, data, additionalHeaders || {});
  2649. });
  2650. }
  2651. head(requestUrl, additionalHeaders) {
  2652. return __awaiter(this, void 0, void 0, function* () {
  2653. return this.request('HEAD', requestUrl, null, additionalHeaders || {});
  2654. });
  2655. }
  2656. sendStream(verb, requestUrl, stream, additionalHeaders) {
  2657. return __awaiter(this, void 0, void 0, function* () {
  2658. return this.request(verb, requestUrl, stream, additionalHeaders);
  2659. });
  2660. }
  2661. /**
  2662. * Gets a typed object from an endpoint
  2663. * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
  2664. */
  2665. getJson(requestUrl, additionalHeaders = {}) {
  2666. return __awaiter(this, void 0, void 0, function* () {
  2667. additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
  2668. const res = yield this.get(requestUrl, additionalHeaders);
  2669. return this._processResponse(res, this.requestOptions);
  2670. });
  2671. }
  2672. postJson(requestUrl, obj, additionalHeaders = {}) {
  2673. return __awaiter(this, void 0, void 0, function* () {
  2674. const data = JSON.stringify(obj, null, 2);
  2675. additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
  2676. additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
  2677. const res = yield this.post(requestUrl, data, additionalHeaders);
  2678. return this._processResponse(res, this.requestOptions);
  2679. });
  2680. }
  2681. putJson(requestUrl, obj, additionalHeaders = {}) {
  2682. return __awaiter(this, void 0, void 0, function* () {
  2683. const data = JSON.stringify(obj, null, 2);
  2684. additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
  2685. additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
  2686. const res = yield this.put(requestUrl, data, additionalHeaders);
  2687. return this._processResponse(res, this.requestOptions);
  2688. });
  2689. }
  2690. patchJson(requestUrl, obj, additionalHeaders = {}) {
  2691. return __awaiter(this, void 0, void 0, function* () {
  2692. const data = JSON.stringify(obj, null, 2);
  2693. additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
  2694. additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
  2695. const res = yield this.patch(requestUrl, data, additionalHeaders);
  2696. return this._processResponse(res, this.requestOptions);
  2697. });
  2698. }
  2699. /**
  2700. * Makes a raw http request.
  2701. * All other methods such as get, post, patch, and request ultimately call this.
  2702. * Prefer get, del, post and patch
  2703. */
  2704. request(verb, requestUrl, data, headers) {
  2705. return __awaiter(this, void 0, void 0, function* () {
  2706. if (this._disposed) {
  2707. throw new Error('Client has already been disposed.');
  2708. }
  2709. const parsedUrl = new URL(requestUrl);
  2710. let info = this._prepareRequest(verb, parsedUrl, headers);
  2711. // Only perform retries on reads since writes may not be idempotent.
  2712. const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)
  2713. ? this._maxRetries + 1
  2714. : 1;
  2715. let numTries = 0;
  2716. let response;
  2717. do {
  2718. response = yield this.requestRaw(info, data);
  2719. // Check if it's an authentication challenge
  2720. if (response &&
  2721. response.message &&
  2722. response.message.statusCode === HttpCodes.Unauthorized) {
  2723. let authenticationHandler;
  2724. for (const handler of this.handlers) {
  2725. if (handler.canHandleAuthentication(response)) {
  2726. authenticationHandler = handler;
  2727. break;
  2728. }
  2729. }
  2730. if (authenticationHandler) {
  2731. return authenticationHandler.handleAuthentication(this, info, data);
  2732. }
  2733. else {
  2734. // We have received an unauthorized response but have no handlers to handle it.
  2735. // Let the response return to the caller.
  2736. return response;
  2737. }
  2738. }
  2739. let redirectsRemaining = this._maxRedirects;
  2740. while (response.message.statusCode &&
  2741. HttpRedirectCodes.includes(response.message.statusCode) &&
  2742. this._allowRedirects &&
  2743. redirectsRemaining > 0) {
  2744. const redirectUrl = response.message.headers['location'];
  2745. if (!redirectUrl) {
  2746. // if there's no location to redirect to, we won't
  2747. break;
  2748. }
  2749. const parsedRedirectUrl = new URL(redirectUrl);
  2750. if (parsedUrl.protocol === 'https:' &&
  2751. parsedUrl.protocol !== parsedRedirectUrl.protocol &&
  2752. !this._allowRedirectDowngrade) {
  2753. throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');
  2754. }
  2755. // we need to finish reading the response before reassigning response
  2756. // which will leak the open socket.
  2757. yield response.readBody();
  2758. // strip authorization header if redirected to a different hostname
  2759. if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
  2760. for (const header in headers) {
  2761. // header names are case insensitive
  2762. if (header.toLowerCase() === 'authorization') {
  2763. delete headers[header];
  2764. }
  2765. }
  2766. }
  2767. // let's make the request with the new redirectUrl
  2768. info = this._prepareRequest(verb, parsedRedirectUrl, headers);
  2769. response = yield this.requestRaw(info, data);
  2770. redirectsRemaining--;
  2771. }
  2772. if (!response.message.statusCode ||
  2773. !HttpResponseRetryCodes.includes(response.message.statusCode)) {
  2774. // If not a retry code, return immediately instead of retrying
  2775. return response;
  2776. }
  2777. numTries += 1;
  2778. if (numTries < maxTries) {
  2779. yield response.readBody();
  2780. yield this._performExponentialBackoff(numTries);
  2781. }
  2782. } while (numTries < maxTries);
  2783. return response;
  2784. });
  2785. }
  2786. /**
  2787. * Needs to be called if keepAlive is set to true in request options.
  2788. */
  2789. dispose() {
  2790. if (this._agent) {
  2791. this._agent.destroy();
  2792. }
  2793. this._disposed = true;
  2794. }
  2795. /**
  2796. * Raw request.
  2797. * @param info
  2798. * @param data
  2799. */
  2800. requestRaw(info, data) {
  2801. return __awaiter(this, void 0, void 0, function* () {
  2802. return new Promise((resolve, reject) => {
  2803. function callbackForResult(err, res) {
  2804. if (err) {
  2805. reject(err);
  2806. }
  2807. else if (!res) {
  2808. // If `err` is not passed, then `res` must be passed.
  2809. reject(new Error('Unknown error'));
  2810. }
  2811. else {
  2812. resolve(res);
  2813. }
  2814. }
  2815. this.requestRawWithCallback(info, data, callbackForResult);
  2816. });
  2817. });
  2818. }
  2819. /**
  2820. * Raw request with callback.
  2821. * @param info
  2822. * @param data
  2823. * @param onResult
  2824. */
  2825. requestRawWithCallback(info, data, onResult) {
  2826. if (typeof data === 'string') {
  2827. if (!info.options.headers) {
  2828. info.options.headers = {};
  2829. }
  2830. info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
  2831. }
  2832. let callbackCalled = false;
  2833. function handleResult(err, res) {
  2834. if (!callbackCalled) {
  2835. callbackCalled = true;
  2836. onResult(err, res);
  2837. }
  2838. }
  2839. const req = info.httpModule.request(info.options, (msg) => {
  2840. const res = new HttpClientResponse(msg);
  2841. handleResult(undefined, res);
  2842. });
  2843. let socket;
  2844. req.on('socket', sock => {
  2845. socket = sock;
  2846. });
  2847. // If we ever get disconnected, we want the socket to timeout eventually
  2848. req.setTimeout(this._socketTimeout || 3 * 60000, () => {
  2849. if (socket) {
  2850. socket.end();
  2851. }
  2852. handleResult(new Error(`Request timeout: ${info.options.path}`));
  2853. });
  2854. req.on('error', function (err) {
  2855. // err has statusCode property
  2856. // res should have headers
  2857. handleResult(err);
  2858. });
  2859. if (data && typeof data === 'string') {
  2860. req.write(data, 'utf8');
  2861. }
  2862. if (data && typeof data !== 'string') {
  2863. data.on('close', function () {
  2864. req.end();
  2865. });
  2866. data.pipe(req);
  2867. }
  2868. else {
  2869. req.end();
  2870. }
  2871. }
  2872. /**
  2873. * Gets an http agent. This function is useful when you need an http agent that handles
  2874. * routing through a proxy server - depending upon the url and proxy environment variables.
  2875. * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
  2876. */
  2877. getAgent(serverUrl) {
  2878. const parsedUrl = new URL(serverUrl);
  2879. return this._getAgent(parsedUrl);
  2880. }
  2881. getAgentDispatcher(serverUrl) {
  2882. const parsedUrl = new URL(serverUrl);
  2883. const proxyUrl = pm.getProxyUrl(parsedUrl);
  2884. const useProxy = proxyUrl && proxyUrl.hostname;
  2885. if (!useProxy) {
  2886. return;
  2887. }
  2888. return this._getProxyAgentDispatcher(parsedUrl, proxyUrl);
  2889. }
  2890. _prepareRequest(method, requestUrl, headers) {
  2891. const info = {};
  2892. info.parsedUrl = requestUrl;
  2893. const usingSsl = info.parsedUrl.protocol === 'https:';
  2894. info.httpModule = usingSsl ? https : http;
  2895. const defaultPort = usingSsl ? 443 : 80;
  2896. info.options = {};
  2897. info.options.host = info.parsedUrl.hostname;
  2898. info.options.port = info.parsedUrl.port
  2899. ? parseInt(info.parsedUrl.port)
  2900. : defaultPort;
  2901. info.options.path =
  2902. (info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');
  2903. info.options.method = method;
  2904. info.options.headers = this._mergeHeaders(headers);
  2905. if (this.userAgent != null) {
  2906. info.options.headers['user-agent'] = this.userAgent;
  2907. }
  2908. info.options.agent = this._getAgent(info.parsedUrl);
  2909. // gives handlers an opportunity to participate
  2910. if (this.handlers) {
  2911. for (const handler of this.handlers) {
  2912. handler.prepareRequest(info.options);
  2913. }
  2914. }
  2915. return info;
  2916. }
  2917. _mergeHeaders(headers) {
  2918. if (this.requestOptions && this.requestOptions.headers) {
  2919. return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {}));
  2920. }
  2921. return lowercaseKeys(headers || {});
  2922. }
  2923. _getExistingOrDefaultHeader(additionalHeaders, header, _default) {
  2924. let clientHeader;
  2925. if (this.requestOptions && this.requestOptions.headers) {
  2926. clientHeader = lowercaseKeys(this.requestOptions.headers)[header];
  2927. }
  2928. return additionalHeaders[header] || clientHeader || _default;
  2929. }
  2930. _getAgent(parsedUrl) {
  2931. let agent;
  2932. const proxyUrl = pm.getProxyUrl(parsedUrl);
  2933. const useProxy = proxyUrl && proxyUrl.hostname;
  2934. if (this._keepAlive && useProxy) {
  2935. agent = this._proxyAgent;
  2936. }
  2937. if (!useProxy) {
  2938. agent = this._agent;
  2939. }
  2940. // if agent is already assigned use that agent.
  2941. if (agent) {
  2942. return agent;
  2943. }
  2944. const usingSsl = parsedUrl.protocol === 'https:';
  2945. let maxSockets = 100;
  2946. if (this.requestOptions) {
  2947. maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;
  2948. }
  2949. // This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis.
  2950. if (proxyUrl && proxyUrl.hostname) {
  2951. const agentOptions = {
  2952. maxSockets,
  2953. keepAlive: this._keepAlive,
  2954. proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && {
  2955. proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`
  2956. })), { host: proxyUrl.hostname, port: proxyUrl.port })
  2957. };
  2958. let tunnelAgent;
  2959. const overHttps = proxyUrl.protocol === 'https:';
  2960. if (usingSsl) {
  2961. tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;
  2962. }
  2963. else {
  2964. tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;
  2965. }
  2966. agent = tunnelAgent(agentOptions);
  2967. this._proxyAgent = agent;
  2968. }
  2969. // if tunneling agent isn't assigned create a new agent
  2970. if (!agent) {
  2971. const options = { keepAlive: this._keepAlive, maxSockets };
  2972. agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
  2973. this._agent = agent;
  2974. }
  2975. if (usingSsl && this._ignoreSslError) {
  2976. // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
  2977. // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
  2978. // we have to cast it to any and change it directly
  2979. agent.options = Object.assign(agent.options || {}, {
  2980. rejectUnauthorized: false
  2981. });
  2982. }
  2983. return agent;
  2984. }
  2985. _getProxyAgentDispatcher(parsedUrl, proxyUrl) {
  2986. let proxyAgent;
  2987. if (this._keepAlive) {
  2988. proxyAgent = this._proxyAgentDispatcher;
  2989. }
  2990. // if agent is already assigned use that agent.
  2991. if (proxyAgent) {
  2992. return proxyAgent;
  2993. }
  2994. const usingSsl = parsedUrl.protocol === 'https:';
  2995. proxyAgent = new undici_1.ProxyAgent(Object.assign({ uri: proxyUrl.href, pipelining: !this._keepAlive ? 0 : 1 }, ((proxyUrl.username || proxyUrl.password) && {
  2996. token: `${proxyUrl.username}:${proxyUrl.password}`
  2997. })));
  2998. this._proxyAgentDispatcher = proxyAgent;
  2999. if (usingSsl && this._ignoreSslError) {
  3000. // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
  3001. // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
  3002. // we have to cast it to any and change it directly
  3003. proxyAgent.options = Object.assign(proxyAgent.options.requestTls || {}, {
  3004. rejectUnauthorized: false
  3005. });
  3006. }
  3007. return proxyAgent;
  3008. }
  3009. _performExponentialBackoff(retryNumber) {
  3010. return __awaiter(this, void 0, void 0, function* () {
  3011. retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);
  3012. const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);
  3013. return new Promise(resolve => setTimeout(() => resolve(), ms));
  3014. });
  3015. }
  3016. _processResponse(res, options) {
  3017. return __awaiter(this, void 0, void 0, function* () {
  3018. return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
  3019. const statusCode = res.message.statusCode || 0;
  3020. const response = {
  3021. statusCode,
  3022. result: null,
  3023. headers: {}
  3024. };
  3025. // not found leads to null obj returned
  3026. if (statusCode === HttpCodes.NotFound) {
  3027. resolve(response);
  3028. }
  3029. // get the result from the body
  3030. function dateTimeDeserializer(key, value) {
  3031. if (typeof value === 'string') {
  3032. const a = new Date(value);
  3033. if (!isNaN(a.valueOf())) {
  3034. return a;
  3035. }
  3036. }
  3037. return value;
  3038. }
  3039. let obj;
  3040. let contents;
  3041. try {
  3042. contents = yield res.readBody();
  3043. if (contents && contents.length > 0) {
  3044. if (options && options.deserializeDates) {
  3045. obj = JSON.parse(contents, dateTimeDeserializer);
  3046. }
  3047. else {
  3048. obj = JSON.parse(contents);
  3049. }
  3050. response.result = obj;
  3051. }
  3052. response.headers = res.message.headers;
  3053. }
  3054. catch (err) {
  3055. // Invalid resource (contents not json); leaving result obj null
  3056. }
  3057. // note that 3xx redirects are handled by the http layer.
  3058. if (statusCode > 299) {
  3059. let msg;
  3060. // if exception/error in body, attempt to get better error
  3061. if (obj && obj.message) {
  3062. msg = obj.message;
  3063. }
  3064. else if (contents && contents.length > 0) {
  3065. // it may be the case that the exception is in the body message as string
  3066. msg = contents;
  3067. }
  3068. else {
  3069. msg = `Failed request: (${statusCode})`;
  3070. }
  3071. const err = new HttpClientError(msg, statusCode);
  3072. err.result = response.result;
  3073. reject(err);
  3074. }
  3075. else {
  3076. resolve(response);
  3077. }
  3078. }));
  3079. });
  3080. }
  3081. }
  3082. exports.HttpClient = HttpClient;
  3083. const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
  3084. //# sourceMappingURL=index.js.map
  3085. /***/ }),
  3086. /***/ 9835:
  3087. /***/ ((__unused_webpack_module, exports) => {
  3088. Object.defineProperty(exports, "__esModule", ({ value: true }));
  3089. exports.checkBypass = exports.getProxyUrl = void 0;
  3090. function getProxyUrl(reqUrl) {
  3091. const usingSsl = reqUrl.protocol === 'https:';
  3092. if (checkBypass(reqUrl)) {
  3093. return undefined;
  3094. }
  3095. const proxyVar = (() => {
  3096. if (usingSsl) {
  3097. return process.env['https_proxy'] || process.env['HTTPS_PROXY'];
  3098. }
  3099. else {
  3100. return process.env['http_proxy'] || process.env['HTTP_PROXY'];
  3101. }
  3102. })();
  3103. if (proxyVar) {
  3104. try {
  3105. return new URL(proxyVar);
  3106. }
  3107. catch (_a) {
  3108. if (!proxyVar.startsWith('http://') && !proxyVar.startsWith('https://'))
  3109. return new URL(`http://${proxyVar}`);
  3110. }
  3111. }
  3112. else {
  3113. return undefined;
  3114. }
  3115. }
  3116. exports.getProxyUrl = getProxyUrl;
  3117. function checkBypass(reqUrl) {
  3118. if (!reqUrl.hostname) {
  3119. return false;
  3120. }
  3121. const reqHost = reqUrl.hostname;
  3122. if (isLoopbackAddress(reqHost)) {
  3123. return true;
  3124. }
  3125. const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
  3126. if (!noProxy) {
  3127. return false;
  3128. }
  3129. // Determine the request port
  3130. let reqPort;
  3131. if (reqUrl.port) {
  3132. reqPort = Number(reqUrl.port);
  3133. }
  3134. else if (reqUrl.protocol === 'http:') {
  3135. reqPort = 80;
  3136. }
  3137. else if (reqUrl.protocol === 'https:') {
  3138. reqPort = 443;
  3139. }
  3140. // Format the request hostname and hostname with port
  3141. const upperReqHosts = [reqUrl.hostname.toUpperCase()];
  3142. if (typeof reqPort === 'number') {
  3143. upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
  3144. }
  3145. // Compare request host against noproxy
  3146. for (const upperNoProxyItem of noProxy
  3147. .split(',')
  3148. .map(x => x.trim().toUpperCase())
  3149. .filter(x => x)) {
  3150. if (upperNoProxyItem === '*' ||
  3151. upperReqHosts.some(x => x === upperNoProxyItem ||
  3152. x.endsWith(`.${upperNoProxyItem}`) ||
  3153. (upperNoProxyItem.startsWith('.') &&
  3154. x.endsWith(`${upperNoProxyItem}`)))) {
  3155. return true;
  3156. }
  3157. }
  3158. return false;
  3159. }
  3160. exports.checkBypass = checkBypass;
  3161. function isLoopbackAddress(host) {
  3162. const hostLower = host.toLowerCase();
  3163. return (hostLower === 'localhost' ||
  3164. hostLower.startsWith('127.') ||
  3165. hostLower.startsWith('[::1]') ||
  3166. hostLower.startsWith('[0:0:0:0:0:0:0:1]'));
  3167. }
  3168. //# sourceMappingURL=proxy.js.map
  3169. /***/ }),
  3170. /***/ 1962:
  3171. /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
  3172. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  3173. if (k2 === undefined) k2 = k;
  3174. Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  3175. }) : (function(o, m, k, k2) {
  3176. if (k2 === undefined) k2 = k;
  3177. o[k2] = m[k];
  3178. }));
  3179. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  3180. Object.defineProperty(o, "default", { enumerable: true, value: v });
  3181. }) : function(o, v) {
  3182. o["default"] = v;
  3183. });
  3184. var __importStar = (this && this.__importStar) || function (mod) {
  3185. if (mod && mod.__esModule) return mod;
  3186. var result = {};
  3187. if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  3188. __setModuleDefault(result, mod);
  3189. return result;
  3190. };
  3191. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  3192. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  3193. return new (P || (P = Promise))(function (resolve, reject) {
  3194. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  3195. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  3196. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  3197. step((generator = generator.apply(thisArg, _arguments || [])).next());
  3198. });
  3199. };
  3200. var _a;
  3201. Object.defineProperty(exports, "__esModule", ({ value: true }));
  3202. exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.READONLY = exports.UV_FS_O_EXLOCK = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rm = exports.rename = exports.readlink = exports.readdir = exports.open = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
  3203. const fs = __importStar(__nccwpck_require__(7147));
  3204. const path = __importStar(__nccwpck_require__(1017));
  3205. _a = fs.promises
  3206. // export const {open} = 'fs'
  3207. , exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.open = _a.open, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rm = _a.rm, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
  3208. // export const {open} = 'fs'
  3209. exports.IS_WINDOWS = process.platform === 'win32';
  3210. // See https://github.com/nodejs/node/blob/d0153aee367422d0858105abec186da4dff0a0c5/deps/uv/include/uv/win.h#L691
  3211. exports.UV_FS_O_EXLOCK = 0x10000000;
  3212. exports.READONLY = fs.constants.O_RDONLY;
  3213. function exists(fsPath) {
  3214. return __awaiter(this, void 0, void 0, function* () {
  3215. try {
  3216. yield exports.stat(fsPath);
  3217. }
  3218. catch (err) {
  3219. if (err.code === 'ENOENT') {
  3220. return false;
  3221. }
  3222. throw err;
  3223. }
  3224. return true;
  3225. });
  3226. }
  3227. exports.exists = exists;
  3228. function isDirectory(fsPath, useStat = false) {
  3229. return __awaiter(this, void 0, void 0, function* () {
  3230. const stats = useStat ? yield exports.stat(fsPath) : yield exports.lstat(fsPath);
  3231. return stats.isDirectory();
  3232. });
  3233. }
  3234. exports.isDirectory = isDirectory;
  3235. /**
  3236. * On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:
  3237. * \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
  3238. */
  3239. function isRooted(p) {
  3240. p = normalizeSeparators(p);
  3241. if (!p) {
  3242. throw new Error('isRooted() parameter "p" cannot be empty');
  3243. }
  3244. if (exports.IS_WINDOWS) {
  3245. return (p.startsWith('\\') || /^[A-Z]:/i.test(p) // e.g. \ or \hello or \\hello
  3246. ); // e.g. C: or C:\hello
  3247. }
  3248. return p.startsWith('/');
  3249. }
  3250. exports.isRooted = isRooted;
  3251. /**
  3252. * Best effort attempt to determine whether a file exists and is executable.
  3253. * @param filePath file path to check
  3254. * @param extensions additional file extensions to try
  3255. * @return if file exists and is executable, returns the file path. otherwise empty string.
  3256. */
  3257. function tryGetExecutablePath(filePath, extensions) {
  3258. return __awaiter(this, void 0, void 0, function* () {
  3259. let stats = undefined;
  3260. try {
  3261. // test file exists
  3262. stats = yield exports.stat(filePath);
  3263. }
  3264. catch (err) {
  3265. if (err.code !== 'ENOENT') {
  3266. // eslint-disable-next-line no-console
  3267. console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
  3268. }
  3269. }
  3270. if (stats && stats.isFile()) {
  3271. if (exports.IS_WINDOWS) {
  3272. // on Windows, test for valid extension
  3273. const upperExt = path.extname(filePath).toUpperCase();
  3274. if (extensions.some(validExt => validExt.toUpperCase() === upperExt)) {
  3275. return filePath;
  3276. }
  3277. }
  3278. else {
  3279. if (isUnixExecutable(stats)) {
  3280. return filePath;
  3281. }
  3282. }
  3283. }
  3284. // try each extension
  3285. const originalFilePath = filePath;
  3286. for (const extension of extensions) {
  3287. filePath = originalFilePath + extension;
  3288. stats = undefined;
  3289. try {
  3290. stats = yield exports.stat(filePath);
  3291. }
  3292. catch (err) {
  3293. if (err.code !== 'ENOENT') {
  3294. // eslint-disable-next-line no-console
  3295. console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
  3296. }
  3297. }
  3298. if (stats && stats.isFile()) {
  3299. if (exports.IS_WINDOWS) {
  3300. // preserve the case of the actual file (since an extension was appended)
  3301. try {
  3302. const directory = path.dirname(filePath);
  3303. const upperName = path.basename(filePath).toUpperCase();
  3304. for (const actualName of yield exports.readdir(directory)) {
  3305. if (upperName === actualName.toUpperCase()) {
  3306. filePath = path.join(directory, actualName);
  3307. break;
  3308. }
  3309. }
  3310. }
  3311. catch (err) {
  3312. // eslint-disable-next-line no-console
  3313. console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`);
  3314. }
  3315. return filePath;
  3316. }
  3317. else {
  3318. if (isUnixExecutable(stats)) {
  3319. return filePath;
  3320. }
  3321. }
  3322. }
  3323. }
  3324. return '';
  3325. });
  3326. }
  3327. exports.tryGetExecutablePath = tryGetExecutablePath;
  3328. function normalizeSeparators(p) {
  3329. p = p || '';
  3330. if (exports.IS_WINDOWS) {
  3331. // convert slashes on Windows
  3332. p = p.replace(/\//g, '\\');
  3333. // remove redundant slashes
  3334. return p.replace(/\\\\+/g, '\\');
  3335. }
  3336. // remove redundant slashes
  3337. return p.replace(/\/\/+/g, '/');
  3338. }
  3339. // on Mac/Linux, test the execute bit
  3340. // R W X R W X R W X
  3341. // 256 128 64 32 16 8 4 2 1
  3342. function isUnixExecutable(stats) {
  3343. return ((stats.mode & 1) > 0 ||
  3344. ((stats.mode & 8) > 0 && stats.gid === process.getgid()) ||
  3345. ((stats.mode & 64) > 0 && stats.uid === process.getuid()));
  3346. }
  3347. // Get the path of cmd.exe in windows
  3348. function getCmdPath() {
  3349. var _a;
  3350. return (_a = process.env['COMSPEC']) !== null && _a !== void 0 ? _a : `cmd.exe`;
  3351. }
  3352. exports.getCmdPath = getCmdPath;
  3353. //# sourceMappingURL=io-util.js.map
  3354. /***/ }),
  3355. /***/ 7436:
  3356. /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
  3357. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  3358. if (k2 === undefined) k2 = k;
  3359. Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  3360. }) : (function(o, m, k, k2) {
  3361. if (k2 === undefined) k2 = k;
  3362. o[k2] = m[k];
  3363. }));
  3364. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  3365. Object.defineProperty(o, "default", { enumerable: true, value: v });
  3366. }) : function(o, v) {
  3367. o["default"] = v;
  3368. });
  3369. var __importStar = (this && this.__importStar) || function (mod) {
  3370. if (mod && mod.__esModule) return mod;
  3371. var result = {};
  3372. if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  3373. __setModuleDefault(result, mod);
  3374. return result;
  3375. };
  3376. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  3377. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  3378. return new (P || (P = Promise))(function (resolve, reject) {
  3379. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  3380. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  3381. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  3382. step((generator = generator.apply(thisArg, _arguments || [])).next());
  3383. });
  3384. };
  3385. Object.defineProperty(exports, "__esModule", ({ value: true }));
  3386. exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
  3387. const assert_1 = __nccwpck_require__(9491);
  3388. const path = __importStar(__nccwpck_require__(1017));
  3389. const ioUtil = __importStar(__nccwpck_require__(1962));
  3390. /**
  3391. * Copies a file or folder.
  3392. * Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
  3393. *
  3394. * @param source source path
  3395. * @param dest destination path
  3396. * @param options optional. See CopyOptions.
  3397. */
  3398. function cp(source, dest, options = {}) {
  3399. return __awaiter(this, void 0, void 0, function* () {
  3400. const { force, recursive, copySourceDirectory } = readCopyOptions(options);
  3401. const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null;
  3402. // Dest is an existing file, but not forcing
  3403. if (destStat && destStat.isFile() && !force) {
  3404. return;
  3405. }
  3406. // If dest is an existing directory, should copy inside.
  3407. const newDest = destStat && destStat.isDirectory() && copySourceDirectory
  3408. ? path.join(dest, path.basename(source))
  3409. : dest;
  3410. if (!(yield ioUtil.exists(source))) {
  3411. throw new Error(`no such file or directory: ${source}`);
  3412. }
  3413. const sourceStat = yield ioUtil.stat(source);
  3414. if (sourceStat.isDirectory()) {
  3415. if (!recursive) {
  3416. throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`);
  3417. }
  3418. else {
  3419. yield cpDirRecursive(source, newDest, 0, force);
  3420. }
  3421. }
  3422. else {
  3423. if (path.relative(source, newDest) === '') {
  3424. // a file cannot be copied to itself
  3425. throw new Error(`'${newDest}' and '${source}' are the same file`);
  3426. }
  3427. yield copyFile(source, newDest, force);
  3428. }
  3429. });
  3430. }
  3431. exports.cp = cp;
  3432. /**
  3433. * Moves a path.
  3434. *
  3435. * @param source source path
  3436. * @param dest destination path
  3437. * @param options optional. See MoveOptions.
  3438. */
  3439. function mv(source, dest, options = {}) {
  3440. return __awaiter(this, void 0, void 0, function* () {
  3441. if (yield ioUtil.exists(dest)) {
  3442. let destExists = true;
  3443. if (yield ioUtil.isDirectory(dest)) {
  3444. // If dest is directory copy src into dest
  3445. dest = path.join(dest, path.basename(source));
  3446. destExists = yield ioUtil.exists(dest);
  3447. }
  3448. if (destExists) {
  3449. if (options.force == null || options.force) {
  3450. yield rmRF(dest);
  3451. }
  3452. else {
  3453. throw new Error('Destination already exists');
  3454. }
  3455. }
  3456. }
  3457. yield mkdirP(path.dirname(dest));
  3458. yield ioUtil.rename(source, dest);
  3459. });
  3460. }
  3461. exports.mv = mv;
  3462. /**
  3463. * Remove a path recursively with force
  3464. *
  3465. * @param inputPath path to remove
  3466. */
  3467. function rmRF(inputPath) {
  3468. return __awaiter(this, void 0, void 0, function* () {
  3469. if (ioUtil.IS_WINDOWS) {
  3470. // Check for invalid characters
  3471. // https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
  3472. if (/[*"<>|]/.test(inputPath)) {
  3473. throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
  3474. }
  3475. }
  3476. try {
  3477. // note if path does not exist, error is silent
  3478. yield ioUtil.rm(inputPath, {
  3479. force: true,
  3480. maxRetries: 3,
  3481. recursive: true,
  3482. retryDelay: 300
  3483. });
  3484. }
  3485. catch (err) {
  3486. throw new Error(`File was unable to be removed ${err}`);
  3487. }
  3488. });
  3489. }
  3490. exports.rmRF = rmRF;
  3491. /**
  3492. * Make a directory. Creates the full path with folders in between
  3493. * Will throw if it fails
  3494. *
  3495. * @param fsPath path to create
  3496. * @returns Promise<void>
  3497. */
  3498. function mkdirP(fsPath) {
  3499. return __awaiter(this, void 0, void 0, function* () {
  3500. assert_1.ok(fsPath, 'a path argument must be provided');
  3501. yield ioUtil.mkdir(fsPath, { recursive: true });
  3502. });
  3503. }
  3504. exports.mkdirP = mkdirP;
  3505. /**
  3506. * Returns path of a tool had the tool actually been invoked. Resolves via paths.
  3507. * If you check and the tool does not exist, it will throw.
  3508. *
  3509. * @param tool name of the tool
  3510. * @param check whether to check if tool exists
  3511. * @returns Promise<string> path to tool
  3512. */
  3513. function which(tool, check) {
  3514. return __awaiter(this, void 0, void 0, function* () {
  3515. if (!tool) {
  3516. throw new Error("parameter 'tool' is required");
  3517. }
  3518. // recursive when check=true
  3519. if (check) {
  3520. const result = yield which(tool, false);
  3521. if (!result) {
  3522. if (ioUtil.IS_WINDOWS) {
  3523. throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`);
  3524. }
  3525. else {
  3526. throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);
  3527. }
  3528. }
  3529. return result;
  3530. }
  3531. const matches = yield findInPath(tool);
  3532. if (matches && matches.length > 0) {
  3533. return matches[0];
  3534. }
  3535. return '';
  3536. });
  3537. }
  3538. exports.which = which;
  3539. /**
  3540. * Returns a list of all occurrences of the given tool on the system path.
  3541. *
  3542. * @returns Promise<string[]> the paths of the tool
  3543. */
  3544. function findInPath(tool) {
  3545. return __awaiter(this, void 0, void 0, function* () {
  3546. if (!tool) {
  3547. throw new Error("parameter 'tool' is required");
  3548. }
  3549. // build the list of extensions to try
  3550. const extensions = [];
  3551. if (ioUtil.IS_WINDOWS && process.env['PATHEXT']) {
  3552. for (const extension of process.env['PATHEXT'].split(path.delimiter)) {
  3553. if (extension) {
  3554. extensions.push(extension);
  3555. }
  3556. }
  3557. }
  3558. // if it's rooted, return it if exists. otherwise return empty.
  3559. if (ioUtil.isRooted(tool)) {
  3560. const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions);
  3561. if (filePath) {
  3562. return [filePath];
  3563. }
  3564. return [];
  3565. }
  3566. // if any path separators, return empty
  3567. if (tool.includes(path.sep)) {
  3568. return [];
  3569. }
  3570. // build the list of directories
  3571. //
  3572. // Note, technically "where" checks the current directory on Windows. From a toolkit perspective,
  3573. // it feels like we should not do this. Checking the current directory seems like more of a use
  3574. // case of a shell, and the which() function exposed by the toolkit should strive for consistency
  3575. // across platforms.
  3576. const directories = [];
  3577. if (process.env.PATH) {
  3578. for (const p of process.env.PATH.split(path.delimiter)) {
  3579. if (p) {
  3580. directories.push(p);
  3581. }
  3582. }
  3583. }
  3584. // find all matches
  3585. const matches = [];
  3586. for (const directory of directories) {
  3587. const filePath = yield ioUtil.tryGetExecutablePath(path.join(directory, tool), extensions);
  3588. if (filePath) {
  3589. matches.push(filePath);
  3590. }
  3591. }
  3592. return matches;
  3593. });
  3594. }
  3595. exports.findInPath = findInPath;
  3596. function readCopyOptions(options) {
  3597. const force = options.force == null ? true : options.force;
  3598. const recursive = Boolean(options.recursive);
  3599. const copySourceDirectory = options.copySourceDirectory == null
  3600. ? true
  3601. : Boolean(options.copySourceDirectory);
  3602. return { force, recursive, copySourceDirectory };
  3603. }
  3604. function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
  3605. return __awaiter(this, void 0, void 0, function* () {
  3606. // Ensure there is not a run away recursive copy
  3607. if (currentDepth >= 255)
  3608. return;
  3609. currentDepth++;
  3610. yield mkdirP(destDir);
  3611. const files = yield ioUtil.readdir(sourceDir);
  3612. for (const fileName of files) {
  3613. const srcFile = `${sourceDir}/${fileName}`;
  3614. const destFile = `${destDir}/${fileName}`;
  3615. const srcFileStat = yield ioUtil.lstat(srcFile);
  3616. if (srcFileStat.isDirectory()) {
  3617. // Recurse
  3618. yield cpDirRecursive(srcFile, destFile, currentDepth, force);
  3619. }
  3620. else {
  3621. yield copyFile(srcFile, destFile, force);
  3622. }
  3623. }
  3624. // Change the mode for the newly created directory
  3625. yield ioUtil.chmod(destDir, (yield ioUtil.stat(sourceDir)).mode);
  3626. });
  3627. }
  3628. // Buffered file copy
  3629. function copyFile(srcFile, destFile, force) {
  3630. return __awaiter(this, void 0, void 0, function* () {
  3631. if ((yield ioUtil.lstat(srcFile)).isSymbolicLink()) {
  3632. // unlink/re-link it
  3633. try {
  3634. yield ioUtil.lstat(destFile);
  3635. yield ioUtil.unlink(destFile);
  3636. }
  3637. catch (e) {
  3638. // Try to override file permission
  3639. if (e.code === 'EPERM') {
  3640. yield ioUtil.chmod(destFile, '0666');
  3641. yield ioUtil.unlink(destFile);
  3642. }
  3643. // other errors = it doesn't exist, no work to do
  3644. }
  3645. // Copy over symlink
  3646. const symlinkFull = yield ioUtil.readlink(srcFile);
  3647. yield ioUtil.symlink(symlinkFull, destFile, ioUtil.IS_WINDOWS ? 'junction' : null);
  3648. }
  3649. else if (!(yield ioUtil.exists(destFile)) || force) {
  3650. yield ioUtil.copyFile(srcFile, destFile);
  3651. }
  3652. });
  3653. }
  3654. //# sourceMappingURL=io.js.map
  3655. /***/ }),
  3656. /***/ 2473:
  3657. /***/ (function(module, exports, __nccwpck_require__) {
  3658. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  3659. if (k2 === undefined) k2 = k;
  3660. Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  3661. }) : (function(o, m, k, k2) {
  3662. if (k2 === undefined) k2 = k;
  3663. o[k2] = m[k];
  3664. }));
  3665. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  3666. Object.defineProperty(o, "default", { enumerable: true, value: v });
  3667. }) : function(o, v) {
  3668. o["default"] = v;
  3669. });
  3670. var __importStar = (this && this.__importStar) || function (mod) {
  3671. if (mod && mod.__esModule) return mod;
  3672. var result = {};
  3673. if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  3674. __setModuleDefault(result, mod);
  3675. return result;
  3676. };
  3677. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  3678. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  3679. return new (P || (P = Promise))(function (resolve, reject) {
  3680. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  3681. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  3682. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  3683. step((generator = generator.apply(thisArg, _arguments || [])).next());
  3684. });
  3685. };
  3686. Object.defineProperty(exports, "__esModule", ({ value: true }));
  3687. exports._readLinuxVersionFile = exports._getOsVersion = exports._findMatch = void 0;
  3688. const semver = __importStar(__nccwpck_require__(5911));
  3689. const core_1 = __nccwpck_require__(2186);
  3690. // needs to be require for core node modules to be mocked
  3691. /* eslint @typescript-eslint/no-require-imports: 0 */
  3692. const os = __nccwpck_require__(2037);
  3693. const cp = __nccwpck_require__(2081);
  3694. const fs = __nccwpck_require__(7147);
  3695. function _findMatch(versionSpec, stable, candidates, archFilter) {
  3696. return __awaiter(this, void 0, void 0, function* () {
  3697. const platFilter = os.platform();
  3698. let result;
  3699. let match;
  3700. let file;
  3701. for (const candidate of candidates) {
  3702. const version = candidate.version;
  3703. core_1.debug(`check ${version} satisfies ${versionSpec}`);
  3704. if (semver.satisfies(version, versionSpec) &&
  3705. (!stable || candidate.stable === stable)) {
  3706. file = candidate.files.find(item => {
  3707. core_1.debug(`${item.arch}===${archFilter} && ${item.platform}===${platFilter}`);
  3708. let chk = item.arch === archFilter && item.platform === platFilter;
  3709. if (chk && item.platform_version) {
  3710. const osVersion = module.exports._getOsVersion();
  3711. if (osVersion === item.platform_version) {
  3712. chk = true;
  3713. }
  3714. else {
  3715. chk = semver.satisfies(osVersion, item.platform_version);
  3716. }
  3717. }
  3718. return chk;
  3719. });
  3720. if (file) {
  3721. core_1.debug(`matched ${candidate.version}`);
  3722. match = candidate;
  3723. break;
  3724. }
  3725. }
  3726. }
  3727. if (match && file) {
  3728. // clone since we're mutating the file list to be only the file that matches
  3729. result = Object.assign({}, match);
  3730. result.files = [file];
  3731. }
  3732. return result;
  3733. });
  3734. }
  3735. exports._findMatch = _findMatch;
  3736. function _getOsVersion() {
  3737. // TODO: add windows and other linux, arm variants
  3738. // right now filtering on version is only an ubuntu and macos scenario for tools we build for hosted (python)
  3739. const plat = os.platform();
  3740. let version = '';
  3741. if (plat === 'darwin') {
  3742. version = cp.execSync('sw_vers -productVersion').toString();
  3743. }
  3744. else if (plat === 'linux') {
  3745. // lsb_release process not in some containers, readfile
  3746. // Run cat /etc/lsb-release
  3747. // DISTRIB_ID=Ubuntu
  3748. // DISTRIB_RELEASE=18.04
  3749. // DISTRIB_CODENAME=bionic
  3750. // DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"
  3751. const lsbContents = module.exports._readLinuxVersionFile();
  3752. if (lsbContents) {
  3753. const lines = lsbContents.split('\n');
  3754. for (const line of lines) {
  3755. const parts = line.split('=');
  3756. if (parts.length === 2 &&
  3757. (parts[0].trim() === 'VERSION_ID' ||
  3758. parts[0].trim() === 'DISTRIB_RELEASE')) {
  3759. version = parts[1]
  3760. .trim()
  3761. .replace(/^"/, '')
  3762. .replace(/"$/, '');
  3763. break;
  3764. }
  3765. }
  3766. }
  3767. }
  3768. return version;
  3769. }
  3770. exports._getOsVersion = _getOsVersion;
  3771. function _readLinuxVersionFile() {
  3772. const lsbReleaseFile = '/etc/lsb-release';
  3773. const osReleaseFile = '/etc/os-release';
  3774. let contents = '';
  3775. if (fs.existsSync(lsbReleaseFile)) {
  3776. contents = fs.readFileSync(lsbReleaseFile).toString();
  3777. }
  3778. else if (fs.existsSync(osReleaseFile)) {
  3779. contents = fs.readFileSync(osReleaseFile).toString();
  3780. }
  3781. return contents;
  3782. }
  3783. exports._readLinuxVersionFile = _readLinuxVersionFile;
  3784. //# sourceMappingURL=manifest.js.map
  3785. /***/ }),
  3786. /***/ 8279:
  3787. /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
  3788. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  3789. if (k2 === undefined) k2 = k;
  3790. Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  3791. }) : (function(o, m, k, k2) {
  3792. if (k2 === undefined) k2 = k;
  3793. o[k2] = m[k];
  3794. }));
  3795. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  3796. Object.defineProperty(o, "default", { enumerable: true, value: v });
  3797. }) : function(o, v) {
  3798. o["default"] = v;
  3799. });
  3800. var __importStar = (this && this.__importStar) || function (mod) {
  3801. if (mod && mod.__esModule) return mod;
  3802. var result = {};
  3803. if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  3804. __setModuleDefault(result, mod);
  3805. return result;
  3806. };
  3807. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  3808. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  3809. return new (P || (P = Promise))(function (resolve, reject) {
  3810. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  3811. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  3812. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  3813. step((generator = generator.apply(thisArg, _arguments || [])).next());
  3814. });
  3815. };
  3816. Object.defineProperty(exports, "__esModule", ({ value: true }));
  3817. exports.RetryHelper = void 0;
  3818. const core = __importStar(__nccwpck_require__(2186));
  3819. /**
  3820. * Internal class for retries
  3821. */
  3822. class RetryHelper {
  3823. constructor(maxAttempts, minSeconds, maxSeconds) {
  3824. if (maxAttempts < 1) {
  3825. throw new Error('max attempts should be greater than or equal to 1');
  3826. }
  3827. this.maxAttempts = maxAttempts;
  3828. this.minSeconds = Math.floor(minSeconds);
  3829. this.maxSeconds = Math.floor(maxSeconds);
  3830. if (this.minSeconds > this.maxSeconds) {
  3831. throw new Error('min seconds should be less than or equal to max seconds');
  3832. }
  3833. }
  3834. execute(action, isRetryable) {
  3835. return __awaiter(this, void 0, void 0, function* () {
  3836. let attempt = 1;
  3837. while (attempt < this.maxAttempts) {
  3838. // Try
  3839. try {
  3840. return yield action();
  3841. }
  3842. catch (err) {
  3843. if (isRetryable && !isRetryable(err)) {
  3844. throw err;
  3845. }
  3846. core.info(err.message);
  3847. }
  3848. // Sleep
  3849. const seconds = this.getSleepAmount();
  3850. core.info(`Waiting ${seconds} seconds before trying again`);
  3851. yield this.sleep(seconds);
  3852. attempt++;
  3853. }
  3854. // Last attempt
  3855. return yield action();
  3856. });
  3857. }
  3858. getSleepAmount() {
  3859. return (Math.floor(Math.random() * (this.maxSeconds - this.minSeconds + 1)) +
  3860. this.minSeconds);
  3861. }
  3862. sleep(seconds) {
  3863. return __awaiter(this, void 0, void 0, function* () {
  3864. return new Promise(resolve => setTimeout(resolve, seconds * 1000));
  3865. });
  3866. }
  3867. }
  3868. exports.RetryHelper = RetryHelper;
  3869. //# sourceMappingURL=retry-helper.js.map
  3870. /***/ }),
  3871. /***/ 7784:
  3872. /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
  3873. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  3874. if (k2 === undefined) k2 = k;
  3875. Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  3876. }) : (function(o, m, k, k2) {
  3877. if (k2 === undefined) k2 = k;
  3878. o[k2] = m[k];
  3879. }));
  3880. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  3881. Object.defineProperty(o, "default", { enumerable: true, value: v });
  3882. }) : function(o, v) {
  3883. o["default"] = v;
  3884. });
  3885. var __importStar = (this && this.__importStar) || function (mod) {
  3886. if (mod && mod.__esModule) return mod;
  3887. var result = {};
  3888. if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  3889. __setModuleDefault(result, mod);
  3890. return result;
  3891. };
  3892. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  3893. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  3894. return new (P || (P = Promise))(function (resolve, reject) {
  3895. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  3896. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  3897. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  3898. step((generator = generator.apply(thisArg, _arguments || [])).next());
  3899. });
  3900. };
  3901. var __importDefault = (this && this.__importDefault) || function (mod) {
  3902. return (mod && mod.__esModule) ? mod : { "default": mod };
  3903. };
  3904. Object.defineProperty(exports, "__esModule", ({ value: true }));
  3905. exports.evaluateVersions = exports.isExplicitVersion = exports.findFromManifest = exports.getManifestFromRepo = exports.findAllVersions = exports.find = exports.cacheFile = exports.cacheDir = exports.extractZip = exports.extractXar = exports.extractTar = exports.extract7z = exports.downloadTool = exports.HTTPError = void 0;
  3906. const core = __importStar(__nccwpck_require__(2186));
  3907. const io = __importStar(__nccwpck_require__(7436));
  3908. const fs = __importStar(__nccwpck_require__(7147));
  3909. const mm = __importStar(__nccwpck_require__(2473));
  3910. const os = __importStar(__nccwpck_require__(2037));
  3911. const path = __importStar(__nccwpck_require__(1017));
  3912. const httpm = __importStar(__nccwpck_require__(6255));
  3913. const semver = __importStar(__nccwpck_require__(5911));
  3914. const stream = __importStar(__nccwpck_require__(2781));
  3915. const util = __importStar(__nccwpck_require__(3837));
  3916. const assert_1 = __nccwpck_require__(9491);
  3917. const v4_1 = __importDefault(__nccwpck_require__(7468));
  3918. const exec_1 = __nccwpck_require__(1514);
  3919. const retry_helper_1 = __nccwpck_require__(8279);
  3920. class HTTPError extends Error {
  3921. constructor(httpStatusCode) {
  3922. super(`Unexpected HTTP response: ${httpStatusCode}`);
  3923. this.httpStatusCode = httpStatusCode;
  3924. Object.setPrototypeOf(this, new.target.prototype);
  3925. }
  3926. }
  3927. exports.HTTPError = HTTPError;
  3928. const IS_WINDOWS = process.platform === 'win32';
  3929. const IS_MAC = process.platform === 'darwin';
  3930. const userAgent = 'actions/tool-cache';
  3931. /**
  3932. * Download a tool from an url and stream it into a file
  3933. *
  3934. * @param url url of tool to download
  3935. * @param dest path to download tool
  3936. * @param auth authorization header
  3937. * @param headers other headers
  3938. * @returns path to downloaded tool
  3939. */
  3940. function downloadTool(url, dest, auth, headers) {
  3941. return __awaiter(this, void 0, void 0, function* () {
  3942. dest = dest || path.join(_getTempDirectory(), v4_1.default());
  3943. yield io.mkdirP(path.dirname(dest));
  3944. core.debug(`Downloading ${url}`);
  3945. core.debug(`Destination ${dest}`);
  3946. const maxAttempts = 3;
  3947. const minSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS', 10);
  3948. const maxSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 20);
  3949. const retryHelper = new retry_helper_1.RetryHelper(maxAttempts, minSeconds, maxSeconds);
  3950. return yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () {
  3951. return yield downloadToolAttempt(url, dest || '', auth, headers);
  3952. }), (err) => {
  3953. if (err instanceof HTTPError && err.httpStatusCode) {
  3954. // Don't retry anything less than 500, except 408 Request Timeout and 429 Too Many Requests
  3955. if (err.httpStatusCode < 500 &&
  3956. err.httpStatusCode !== 408 &&
  3957. err.httpStatusCode !== 429) {
  3958. return false;
  3959. }
  3960. }
  3961. // Otherwise retry
  3962. return true;
  3963. });
  3964. });
  3965. }
  3966. exports.downloadTool = downloadTool;
  3967. function downloadToolAttempt(url, dest, auth, headers) {
  3968. return __awaiter(this, void 0, void 0, function* () {
  3969. if (fs.existsSync(dest)) {
  3970. throw new Error(`Destination file path ${dest} already exists`);
  3971. }
  3972. // Get the response headers
  3973. const http = new httpm.HttpClient(userAgent, [], {
  3974. allowRetries: false
  3975. });
  3976. if (auth) {
  3977. core.debug('set auth');
  3978. if (headers === undefined) {
  3979. headers = {};
  3980. }
  3981. headers.authorization = auth;
  3982. }
  3983. const response = yield http.get(url, headers);
  3984. if (response.message.statusCode !== 200) {
  3985. const err = new HTTPError(response.message.statusCode);
  3986. core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
  3987. throw err;
  3988. }
  3989. // Download the response body
  3990. const pipeline = util.promisify(stream.pipeline);
  3991. const responseMessageFactory = _getGlobal('TEST_DOWNLOAD_TOOL_RESPONSE_MESSAGE_FACTORY', () => response.message);
  3992. const readStream = responseMessageFactory();
  3993. let succeeded = false;
  3994. try {
  3995. yield pipeline(readStream, fs.createWriteStream(dest));
  3996. core.debug('download complete');
  3997. succeeded = true;
  3998. return dest;
  3999. }
  4000. finally {
  4001. // Error, delete dest before retry
  4002. if (!succeeded) {
  4003. core.debug('download failed');
  4004. try {
  4005. yield io.rmRF(dest);
  4006. }
  4007. catch (err) {
  4008. core.debug(`Failed to delete '${dest}'. ${err.message}`);
  4009. }
  4010. }
  4011. }
  4012. });
  4013. }
  4014. /**
  4015. * Extract a .7z file
  4016. *
  4017. * @param file path to the .7z file
  4018. * @param dest destination directory. Optional.
  4019. * @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this
  4020. * problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will
  4021. * gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is
  4022. * bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line
  4023. * interface, it is smaller than the full command line interface, and it does support long paths. At the
  4024. * time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website.
  4025. * Be sure to check the current license agreement. If 7zr.exe is bundled with your action, then the path
  4026. * to 7zr.exe can be pass to this function.
  4027. * @returns path to the destination directory
  4028. */
  4029. function extract7z(file, dest, _7zPath) {
  4030. return __awaiter(this, void 0, void 0, function* () {
  4031. assert_1.ok(IS_WINDOWS, 'extract7z() not supported on current OS');
  4032. assert_1.ok(file, 'parameter "file" is required');
  4033. dest = yield _createExtractFolder(dest);
  4034. const originalCwd = process.cwd();
  4035. process.chdir(dest);
  4036. if (_7zPath) {
  4037. try {
  4038. const logLevel = core.isDebug() ? '-bb1' : '-bb0';
  4039. const args = [
  4040. 'x',
  4041. logLevel,
  4042. '-bd',
  4043. '-sccUTF-8',
  4044. file
  4045. ];
  4046. const options = {
  4047. silent: true
  4048. };
  4049. yield exec_1.exec(`"${_7zPath}"`, args, options);
  4050. }
  4051. finally {
  4052. process.chdir(originalCwd);
  4053. }
  4054. }
  4055. else {
  4056. const escapedScript = path
  4057. .join(__dirname, '..', 'scripts', 'Invoke-7zdec.ps1')
  4058. .replace(/'/g, "''")
  4059. .replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
  4060. const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, '');
  4061. const escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
  4062. const command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}'`;
  4063. const args = [
  4064. '-NoLogo',
  4065. '-Sta',
  4066. '-NoProfile',
  4067. '-NonInteractive',
  4068. '-ExecutionPolicy',
  4069. 'Unrestricted',
  4070. '-Command',
  4071. command
  4072. ];
  4073. const options = {
  4074. silent: true
  4075. };
  4076. try {
  4077. const powershellPath = yield io.which('powershell', true);
  4078. yield exec_1.exec(`"${powershellPath}"`, args, options);
  4079. }
  4080. finally {
  4081. process.chdir(originalCwd);
  4082. }
  4083. }
  4084. return dest;
  4085. });
  4086. }
  4087. exports.extract7z = extract7z;
  4088. /**
  4089. * Extract a compressed tar archive
  4090. *
  4091. * @param file path to the tar
  4092. * @param dest destination directory. Optional.
  4093. * @param flags flags for the tar command to use for extraction. Defaults to 'xz' (extracting gzipped tars). Optional.
  4094. * @returns path to the destination directory
  4095. */
  4096. function extractTar(file, dest, flags = 'xz') {
  4097. return __awaiter(this, void 0, void 0, function* () {
  4098. if (!file) {
  4099. throw new Error("parameter 'file' is required");
  4100. }
  4101. // Create dest
  4102. dest = yield _createExtractFolder(dest);
  4103. // Determine whether GNU tar
  4104. core.debug('Checking tar --version');
  4105. let versionOutput = '';
  4106. yield exec_1.exec('tar --version', [], {
  4107. ignoreReturnCode: true,
  4108. silent: true,
  4109. listeners: {
  4110. stdout: (data) => (versionOutput += data.toString()),
  4111. stderr: (data) => (versionOutput += data.toString())
  4112. }
  4113. });
  4114. core.debug(versionOutput.trim());
  4115. const isGnuTar = versionOutput.toUpperCase().includes('GNU TAR');
  4116. // Initialize args
  4117. let args;
  4118. if (flags instanceof Array) {
  4119. args = flags;
  4120. }
  4121. else {
  4122. args = [flags];
  4123. }
  4124. if (core.isDebug() && !flags.includes('v')) {
  4125. args.push('-v');
  4126. }
  4127. let destArg = dest;
  4128. let fileArg = file;
  4129. if (IS_WINDOWS && isGnuTar) {
  4130. args.push('--force-local');
  4131. destArg = dest.replace(/\\/g, '/');
  4132. // Technically only the dest needs to have `/` but for aesthetic consistency
  4133. // convert slashes in the file arg too.
  4134. fileArg = file.replace(/\\/g, '/');
  4135. }
  4136. if (isGnuTar) {
  4137. // Suppress warnings when using GNU tar to extract archives created by BSD tar
  4138. args.push('--warning=no-unknown-keyword');
  4139. args.push('--overwrite');
  4140. }
  4141. args.push('-C', destArg, '-f', fileArg);
  4142. yield exec_1.exec(`tar`, args);
  4143. return dest;
  4144. });
  4145. }
  4146. exports.extractTar = extractTar;
  4147. /**
  4148. * Extract a xar compatible archive
  4149. *
  4150. * @param file path to the archive
  4151. * @param dest destination directory. Optional.
  4152. * @param flags flags for the xar. Optional.
  4153. * @returns path to the destination directory
  4154. */
  4155. function extractXar(file, dest, flags = []) {
  4156. return __awaiter(this, void 0, void 0, function* () {
  4157. assert_1.ok(IS_MAC, 'extractXar() not supported on current OS');
  4158. assert_1.ok(file, 'parameter "file" is required');
  4159. dest = yield _createExtractFolder(dest);
  4160. let args;
  4161. if (flags instanceof Array) {
  4162. args = flags;
  4163. }
  4164. else {
  4165. args = [flags];
  4166. }
  4167. args.push('-x', '-C', dest, '-f', file);
  4168. if (core.isDebug()) {
  4169. args.push('-v');
  4170. }
  4171. const xarPath = yield io.which('xar', true);
  4172. yield exec_1.exec(`"${xarPath}"`, _unique(args));
  4173. return dest;
  4174. });
  4175. }
  4176. exports.extractXar = extractXar;
  4177. /**
  4178. * Extract a zip
  4179. *
  4180. * @param file path to the zip
  4181. * @param dest destination directory. Optional.
  4182. * @returns path to the destination directory
  4183. */
  4184. function extractZip(file, dest) {
  4185. return __awaiter(this, void 0, void 0, function* () {
  4186. if (!file) {
  4187. throw new Error("parameter 'file' is required");
  4188. }
  4189. dest = yield _createExtractFolder(dest);
  4190. if (IS_WINDOWS) {
  4191. yield extractZipWin(file, dest);
  4192. }
  4193. else {
  4194. yield extractZipNix(file, dest);
  4195. }
  4196. return dest;
  4197. });
  4198. }
  4199. exports.extractZip = extractZip;
  4200. function extractZipWin(file, dest) {
  4201. return __awaiter(this, void 0, void 0, function* () {
  4202. // build the powershell command
  4203. const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
  4204. const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
  4205. const pwshPath = yield io.which('pwsh', false);
  4206. //To match the file overwrite behavior on nix systems, we use the overwrite = true flag for ExtractToDirectory
  4207. //and the -Force flag for Expand-Archive as a fallback
  4208. if (pwshPath) {
  4209. //attempt to use pwsh with ExtractToDirectory, if this fails attempt Expand-Archive
  4210. const pwshCommand = [
  4211. `$ErrorActionPreference = 'Stop' ;`,
  4212. `try { Add-Type -AssemblyName System.IO.Compression.ZipFile } catch { } ;`,
  4213. `try { [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }`,
  4214. `catch { if (($_.Exception.GetType().FullName -eq 'System.Management.Automation.MethodException') -or ($_.Exception.GetType().FullName -eq 'System.Management.Automation.RuntimeException') ){ Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force } else { throw $_ } } ;`
  4215. ].join(' ');
  4216. const args = [
  4217. '-NoLogo',
  4218. '-NoProfile',
  4219. '-NonInteractive',
  4220. '-ExecutionPolicy',
  4221. 'Unrestricted',
  4222. '-Command',
  4223. pwshCommand
  4224. ];
  4225. core.debug(`Using pwsh at path: ${pwshPath}`);
  4226. yield exec_1.exec(`"${pwshPath}"`, args);
  4227. }
  4228. else {
  4229. const powershellCommand = [
  4230. `$ErrorActionPreference = 'Stop' ;`,
  4231. `try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ;`,
  4232. `if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force }`,
  4233. `else {[System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }`
  4234. ].join(' ');
  4235. const args = [
  4236. '-NoLogo',
  4237. '-Sta',
  4238. '-NoProfile',
  4239. '-NonInteractive',
  4240. '-ExecutionPolicy',
  4241. 'Unrestricted',
  4242. '-Command',
  4243. powershellCommand
  4244. ];
  4245. const powershellPath = yield io.which('powershell', true);
  4246. core.debug(`Using powershell at path: ${powershellPath}`);
  4247. yield exec_1.exec(`"${powershellPath}"`, args);
  4248. }
  4249. });
  4250. }
  4251. function extractZipNix(file, dest) {
  4252. return __awaiter(this, void 0, void 0, function* () {
  4253. const unzipPath = yield io.which('unzip', true);
  4254. const args = [file];
  4255. if (!core.isDebug()) {
  4256. args.unshift('-q');
  4257. }
  4258. args.unshift('-o'); //overwrite with -o, otherwise a prompt is shown which freezes the run
  4259. yield exec_1.exec(`"${unzipPath}"`, args, { cwd: dest });
  4260. });
  4261. }
  4262. /**
  4263. * Caches a directory and installs it into the tool cacheDir
  4264. *
  4265. * @param sourceDir the directory to cache into tools
  4266. * @param tool tool name
  4267. * @param version version of the tool. semver format
  4268. * @param arch architecture of the tool. Optional. Defaults to machine architecture
  4269. */
  4270. function cacheDir(sourceDir, tool, version, arch) {
  4271. return __awaiter(this, void 0, void 0, function* () {
  4272. version = semver.clean(version) || version;
  4273. arch = arch || os.arch();
  4274. core.debug(`Caching tool ${tool} ${version} ${arch}`);
  4275. core.debug(`source dir: ${sourceDir}`);
  4276. if (!fs.statSync(sourceDir).isDirectory()) {
  4277. throw new Error('sourceDir is not a directory');
  4278. }
  4279. // Create the tool dir
  4280. const destPath = yield _createToolPath(tool, version, arch);
  4281. // copy each child item. do not move. move can fail on Windows
  4282. // due to anti-virus software having an open handle on a file.
  4283. for (const itemName of fs.readdirSync(sourceDir)) {
  4284. const s = path.join(sourceDir, itemName);
  4285. yield io.cp(s, destPath, { recursive: true });
  4286. }
  4287. // write .complete
  4288. _completeToolPath(tool, version, arch);
  4289. return destPath;
  4290. });
  4291. }
  4292. exports.cacheDir = cacheDir;
  4293. /**
  4294. * Caches a downloaded file (GUID) and installs it
  4295. * into the tool cache with a given targetName
  4296. *
  4297. * @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid.
  4298. * @param targetFile the name of the file name in the tools directory
  4299. * @param tool tool name
  4300. * @param version version of the tool. semver format
  4301. * @param arch architecture of the tool. Optional. Defaults to machine architecture
  4302. */
  4303. function cacheFile(sourceFile, targetFile, tool, version, arch) {
  4304. return __awaiter(this, void 0, void 0, function* () {
  4305. version = semver.clean(version) || version;
  4306. arch = arch || os.arch();
  4307. core.debug(`Caching tool ${tool} ${version} ${arch}`);
  4308. core.debug(`source file: ${sourceFile}`);
  4309. if (!fs.statSync(sourceFile).isFile()) {
  4310. throw new Error('sourceFile is not a file');
  4311. }
  4312. // create the tool dir
  4313. const destFolder = yield _createToolPath(tool, version, arch);
  4314. // copy instead of move. move can fail on Windows due to
  4315. // anti-virus software having an open handle on a file.
  4316. const destPath = path.join(destFolder, targetFile);
  4317. core.debug(`destination file ${destPath}`);
  4318. yield io.cp(sourceFile, destPath);
  4319. // write .complete
  4320. _completeToolPath(tool, version, arch);
  4321. return destFolder;
  4322. });
  4323. }
  4324. exports.cacheFile = cacheFile;
  4325. /**
  4326. * Finds the path to a tool version in the local installed tool cache
  4327. *
  4328. * @param toolName name of the tool
  4329. * @param versionSpec version of the tool
  4330. * @param arch optional arch. defaults to arch of computer
  4331. */
  4332. function find(toolName, versionSpec, arch) {
  4333. if (!toolName) {
  4334. throw new Error('toolName parameter is required');
  4335. }
  4336. if (!versionSpec) {
  4337. throw new Error('versionSpec parameter is required');
  4338. }
  4339. arch = arch || os.arch();
  4340. // attempt to resolve an explicit version
  4341. if (!isExplicitVersion(versionSpec)) {
  4342. const localVersions = findAllVersions(toolName, arch);
  4343. const match = evaluateVersions(localVersions, versionSpec);
  4344. versionSpec = match;
  4345. }
  4346. // check for the explicit version in the cache
  4347. let toolPath = '';
  4348. if (versionSpec) {
  4349. versionSpec = semver.clean(versionSpec) || '';
  4350. const cachePath = path.join(_getCacheDirectory(), toolName, versionSpec, arch);
  4351. core.debug(`checking cache: ${cachePath}`);
  4352. if (fs.existsSync(cachePath) && fs.existsSync(`${cachePath}.complete`)) {
  4353. core.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch}`);
  4354. toolPath = cachePath;
  4355. }
  4356. else {
  4357. core.debug('not found');
  4358. }
  4359. }
  4360. return toolPath;
  4361. }
  4362. exports.find = find;
  4363. /**
  4364. * Finds the paths to all versions of a tool that are installed in the local tool cache
  4365. *
  4366. * @param toolName name of the tool
  4367. * @param arch optional arch. defaults to arch of computer
  4368. */
  4369. function findAllVersions(toolName, arch) {
  4370. const versions = [];
  4371. arch = arch || os.arch();
  4372. const toolPath = path.join(_getCacheDirectory(), toolName);
  4373. if (fs.existsSync(toolPath)) {
  4374. const children = fs.readdirSync(toolPath);
  4375. for (const child of children) {
  4376. if (isExplicitVersion(child)) {
  4377. const fullPath = path.join(toolPath, child, arch || '');
  4378. if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
  4379. versions.push(child);
  4380. }
  4381. }
  4382. }
  4383. }
  4384. return versions;
  4385. }
  4386. exports.findAllVersions = findAllVersions;
  4387. function getManifestFromRepo(owner, repo, auth, branch = 'master') {
  4388. return __awaiter(this, void 0, void 0, function* () {
  4389. let releases = [];
  4390. const treeUrl = `https://api.github.com/repos/${owner}/${repo}/git/trees/${branch}`;
  4391. const http = new httpm.HttpClient('tool-cache');
  4392. const headers = {};
  4393. if (auth) {
  4394. core.debug('set auth');
  4395. headers.authorization = auth;
  4396. }
  4397. const response = yield http.getJson(treeUrl, headers);
  4398. if (!response.result) {
  4399. return releases;
  4400. }
  4401. let manifestUrl = '';
  4402. for (const item of response.result.tree) {
  4403. if (item.path === 'versions-manifest.json') {
  4404. manifestUrl = item.url;
  4405. break;
  4406. }
  4407. }
  4408. headers['accept'] = 'application/vnd.github.VERSION.raw';
  4409. let versionsRaw = yield (yield http.get(manifestUrl, headers)).readBody();
  4410. if (versionsRaw) {
  4411. // shouldn't be needed but protects against invalid json saved with BOM
  4412. versionsRaw = versionsRaw.replace(/^\uFEFF/, '');
  4413. try {
  4414. releases = JSON.parse(versionsRaw);
  4415. }
  4416. catch (_a) {
  4417. core.debug('Invalid json');
  4418. }
  4419. }
  4420. return releases;
  4421. });
  4422. }
  4423. exports.getManifestFromRepo = getManifestFromRepo;
  4424. function findFromManifest(versionSpec, stable, manifest, archFilter = os.arch()) {
  4425. return __awaiter(this, void 0, void 0, function* () {
  4426. // wrap the internal impl
  4427. const match = yield mm._findMatch(versionSpec, stable, manifest, archFilter);
  4428. return match;
  4429. });
  4430. }
  4431. exports.findFromManifest = findFromManifest;
  4432. function _createExtractFolder(dest) {
  4433. return __awaiter(this, void 0, void 0, function* () {
  4434. if (!dest) {
  4435. // create a temp dir
  4436. dest = path.join(_getTempDirectory(), v4_1.default());
  4437. }
  4438. yield io.mkdirP(dest);
  4439. return dest;
  4440. });
  4441. }
  4442. function _createToolPath(tool, version, arch) {
  4443. return __awaiter(this, void 0, void 0, function* () {
  4444. const folderPath = path.join(_getCacheDirectory(), tool, semver.clean(version) || version, arch || '');
  4445. core.debug(`destination ${folderPath}`);
  4446. const markerPath = `${folderPath}.complete`;
  4447. yield io.rmRF(folderPath);
  4448. yield io.rmRF(markerPath);
  4449. yield io.mkdirP(folderPath);
  4450. return folderPath;
  4451. });
  4452. }
  4453. function _completeToolPath(tool, version, arch) {
  4454. const folderPath = path.join(_getCacheDirectory(), tool, semver.clean(version) || version, arch || '');
  4455. const markerPath = `${folderPath}.complete`;
  4456. fs.writeFileSync(markerPath, '');
  4457. core.debug('finished caching tool');
  4458. }
  4459. /**
  4460. * Check if version string is explicit
  4461. *
  4462. * @param versionSpec version string to check
  4463. */
  4464. function isExplicitVersion(versionSpec) {
  4465. const c = semver.clean(versionSpec) || '';
  4466. core.debug(`isExplicit: ${c}`);
  4467. const valid = semver.valid(c) != null;
  4468. core.debug(`explicit? ${valid}`);
  4469. return valid;
  4470. }
  4471. exports.isExplicitVersion = isExplicitVersion;
  4472. /**
  4473. * Get the highest satisfiying semantic version in `versions` which satisfies `versionSpec`
  4474. *
  4475. * @param versions array of versions to evaluate
  4476. * @param versionSpec semantic version spec to satisfy
  4477. */
  4478. function evaluateVersions(versions, versionSpec) {
  4479. let version = '';
  4480. core.debug(`evaluating ${versions.length} versions`);
  4481. versions = versions.sort((a, b) => {
  4482. if (semver.gt(a, b)) {
  4483. return 1;
  4484. }
  4485. return -1;
  4486. });
  4487. for (let i = versions.length - 1; i >= 0; i--) {
  4488. const potential = versions[i];
  4489. const satisfied = semver.satisfies(potential, versionSpec);
  4490. if (satisfied) {
  4491. version = potential;
  4492. break;
  4493. }
  4494. }
  4495. if (version) {
  4496. core.debug(`matched: ${version}`);
  4497. }
  4498. else {
  4499. core.debug('match not found');
  4500. }
  4501. return version;
  4502. }
  4503. exports.evaluateVersions = evaluateVersions;
  4504. /**
  4505. * Gets RUNNER_TOOL_CACHE
  4506. */
  4507. function _getCacheDirectory() {
  4508. const cacheDirectory = process.env['RUNNER_TOOL_CACHE'] || '';
  4509. assert_1.ok(cacheDirectory, 'Expected RUNNER_TOOL_CACHE to be defined');
  4510. return cacheDirectory;
  4511. }
  4512. /**
  4513. * Gets RUNNER_TEMP
  4514. */
  4515. function _getTempDirectory() {
  4516. const tempDirectory = process.env['RUNNER_TEMP'] || '';
  4517. assert_1.ok(tempDirectory, 'Expected RUNNER_TEMP to be defined');
  4518. return tempDirectory;
  4519. }
  4520. /**
  4521. * Gets a global variable
  4522. */
  4523. function _getGlobal(key, defaultValue) {
  4524. /* eslint-disable @typescript-eslint/no-explicit-any */
  4525. const value = global[key];
  4526. /* eslint-enable @typescript-eslint/no-explicit-any */
  4527. return value !== undefined ? value : defaultValue;
  4528. }
  4529. /**
  4530. * Returns an array of unique values.
  4531. * @param values Values to make unique.
  4532. */
  4533. function _unique(values) {
  4534. return Array.from(new Set(values));
  4535. }
  4536. //# sourceMappingURL=tool-cache.js.map
  4537. /***/ }),
  4538. /***/ 7701:
  4539. /***/ ((module) => {
  4540. /**
  4541. * Convert array of 16 byte values to UUID string format of the form:
  4542. * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
  4543. */
  4544. var byteToHex = [];
  4545. for (var i = 0; i < 256; ++i) {
  4546. byteToHex[i] = (i + 0x100).toString(16).substr(1);
  4547. }
  4548. function bytesToUuid(buf, offset) {
  4549. var i = offset || 0;
  4550. var bth = byteToHex;
  4551. // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
  4552. return ([
  4553. bth[buf[i++]], bth[buf[i++]],
  4554. bth[buf[i++]], bth[buf[i++]], '-',
  4555. bth[buf[i++]], bth[buf[i++]], '-',
  4556. bth[buf[i++]], bth[buf[i++]], '-',
  4557. bth[buf[i++]], bth[buf[i++]], '-',
  4558. bth[buf[i++]], bth[buf[i++]],
  4559. bth[buf[i++]], bth[buf[i++]],
  4560. bth[buf[i++]], bth[buf[i++]]
  4561. ]).join('');
  4562. }
  4563. module.exports = bytesToUuid;
  4564. /***/ }),
  4565. /***/ 7269:
  4566. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  4567. // Unique ID creation requires a high quality random # generator. In node.js
  4568. // this is pretty straight-forward - we use the crypto API.
  4569. var crypto = __nccwpck_require__(6113);
  4570. module.exports = function nodeRNG() {
  4571. return crypto.randomBytes(16);
  4572. };
  4573. /***/ }),
  4574. /***/ 7468:
  4575. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  4576. var rng = __nccwpck_require__(7269);
  4577. var bytesToUuid = __nccwpck_require__(7701);
  4578. function v4(options, buf, offset) {
  4579. var i = buf && offset || 0;
  4580. if (typeof(options) == 'string') {
  4581. buf = options === 'binary' ? new Array(16) : null;
  4582. options = null;
  4583. }
  4584. options = options || {};
  4585. var rnds = options.random || (options.rng || rng)();
  4586. // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
  4587. rnds[6] = (rnds[6] & 0x0f) | 0x40;
  4588. rnds[8] = (rnds[8] & 0x3f) | 0x80;
  4589. // Copy bytes to buffer, if provided
  4590. if (buf) {
  4591. for (var ii = 0; ii < 16; ++ii) {
  4592. buf[i + ii] = rnds[ii];
  4593. }
  4594. }
  4595. return buf || bytesToUuid(rnds);
  4596. }
  4597. module.exports = v4;
  4598. /***/ }),
  4599. /***/ 334:
  4600. /***/ ((module) => {
  4601. var __defProp = Object.defineProperty;
  4602. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  4603. var __getOwnPropNames = Object.getOwnPropertyNames;
  4604. var __hasOwnProp = Object.prototype.hasOwnProperty;
  4605. var __export = (target, all) => {
  4606. for (var name in all)
  4607. __defProp(target, name, { get: all[name], enumerable: true });
  4608. };
  4609. var __copyProps = (to, from, except, desc) => {
  4610. if (from && typeof from === "object" || typeof from === "function") {
  4611. for (let key of __getOwnPropNames(from))
  4612. if (!__hasOwnProp.call(to, key) && key !== except)
  4613. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  4614. }
  4615. return to;
  4616. };
  4617. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  4618. // pkg/dist-src/index.js
  4619. var dist_src_exports = {};
  4620. __export(dist_src_exports, {
  4621. createTokenAuth: () => createTokenAuth
  4622. });
  4623. module.exports = __toCommonJS(dist_src_exports);
  4624. // pkg/dist-src/auth.js
  4625. var REGEX_IS_INSTALLATION_LEGACY = /^v1\./;
  4626. var REGEX_IS_INSTALLATION = /^ghs_/;
  4627. var REGEX_IS_USER_TO_SERVER = /^ghu_/;
  4628. async function auth(token) {
  4629. const isApp = token.split(/\./).length === 3;
  4630. const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) || REGEX_IS_INSTALLATION.test(token);
  4631. const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token);
  4632. const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth";
  4633. return {
  4634. type: "token",
  4635. token,
  4636. tokenType
  4637. };
  4638. }
  4639. // pkg/dist-src/with-authorization-prefix.js
  4640. function withAuthorizationPrefix(token) {
  4641. if (token.split(/\./).length === 3) {
  4642. return `bearer ${token}`;
  4643. }
  4644. return `token ${token}`;
  4645. }
  4646. // pkg/dist-src/hook.js
  4647. async function hook(token, request, route, parameters) {
  4648. const endpoint = request.endpoint.merge(
  4649. route,
  4650. parameters
  4651. );
  4652. endpoint.headers.authorization = withAuthorizationPrefix(token);
  4653. return request(endpoint);
  4654. }
  4655. // pkg/dist-src/index.js
  4656. var createTokenAuth = function createTokenAuth2(token) {
  4657. if (!token) {
  4658. throw new Error("[@octokit/auth-token] No token passed to createTokenAuth");
  4659. }
  4660. if (typeof token !== "string") {
  4661. throw new Error(
  4662. "[@octokit/auth-token] Token passed to createTokenAuth is not a string"
  4663. );
  4664. }
  4665. token = token.replace(/^(token|bearer) +/i, "");
  4666. return Object.assign(auth.bind(null, token), {
  4667. hook: hook.bind(null, token)
  4668. });
  4669. };
  4670. // Annotate the CommonJS export names for ESM import in node:
  4671. 0 && (0);
  4672. /***/ }),
  4673. /***/ 6762:
  4674. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  4675. var __defProp = Object.defineProperty;
  4676. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  4677. var __getOwnPropNames = Object.getOwnPropertyNames;
  4678. var __hasOwnProp = Object.prototype.hasOwnProperty;
  4679. var __export = (target, all) => {
  4680. for (var name in all)
  4681. __defProp(target, name, { get: all[name], enumerable: true });
  4682. };
  4683. var __copyProps = (to, from, except, desc) => {
  4684. if (from && typeof from === "object" || typeof from === "function") {
  4685. for (let key of __getOwnPropNames(from))
  4686. if (!__hasOwnProp.call(to, key) && key !== except)
  4687. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  4688. }
  4689. return to;
  4690. };
  4691. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  4692. // pkg/dist-src/index.js
  4693. var dist_src_exports = {};
  4694. __export(dist_src_exports, {
  4695. Octokit: () => Octokit
  4696. });
  4697. module.exports = __toCommonJS(dist_src_exports);
  4698. var import_universal_user_agent = __nccwpck_require__(5030);
  4699. var import_before_after_hook = __nccwpck_require__(3682);
  4700. var import_request = __nccwpck_require__(6234);
  4701. var import_graphql = __nccwpck_require__(8467);
  4702. var import_auth_token = __nccwpck_require__(334);
  4703. // pkg/dist-src/version.js
  4704. var VERSION = "5.2.0";
  4705. // pkg/dist-src/index.js
  4706. var noop = () => {
  4707. };
  4708. var consoleWarn = console.warn.bind(console);
  4709. var consoleError = console.error.bind(console);
  4710. var userAgentTrail = `octokit-core.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`;
  4711. var Octokit = class {
  4712. static {
  4713. this.VERSION = VERSION;
  4714. }
  4715. static defaults(defaults) {
  4716. const OctokitWithDefaults = class extends this {
  4717. constructor(...args) {
  4718. const options = args[0] || {};
  4719. if (typeof defaults === "function") {
  4720. super(defaults(options));
  4721. return;
  4722. }
  4723. super(
  4724. Object.assign(
  4725. {},
  4726. defaults,
  4727. options,
  4728. options.userAgent && defaults.userAgent ? {
  4729. userAgent: `${options.userAgent} ${defaults.userAgent}`
  4730. } : null
  4731. )
  4732. );
  4733. }
  4734. };
  4735. return OctokitWithDefaults;
  4736. }
  4737. static {
  4738. this.plugins = [];
  4739. }
  4740. /**
  4741. * Attach a plugin (or many) to your Octokit instance.
  4742. *
  4743. * @example
  4744. * const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
  4745. */
  4746. static plugin(...newPlugins) {
  4747. const currentPlugins = this.plugins;
  4748. const NewOctokit = class extends this {
  4749. static {
  4750. this.plugins = currentPlugins.concat(
  4751. newPlugins.filter((plugin) => !currentPlugins.includes(plugin))
  4752. );
  4753. }
  4754. };
  4755. return NewOctokit;
  4756. }
  4757. constructor(options = {}) {
  4758. const hook = new import_before_after_hook.Collection();
  4759. const requestDefaults = {
  4760. baseUrl: import_request.request.endpoint.DEFAULTS.baseUrl,
  4761. headers: {},
  4762. request: Object.assign({}, options.request, {
  4763. // @ts-ignore internal usage only, no need to type
  4764. hook: hook.bind(null, "request")
  4765. }),
  4766. mediaType: {
  4767. previews: [],
  4768. format: ""
  4769. }
  4770. };
  4771. requestDefaults.headers["user-agent"] = options.userAgent ? `${options.userAgent} ${userAgentTrail}` : userAgentTrail;
  4772. if (options.baseUrl) {
  4773. requestDefaults.baseUrl = options.baseUrl;
  4774. }
  4775. if (options.previews) {
  4776. requestDefaults.mediaType.previews = options.previews;
  4777. }
  4778. if (options.timeZone) {
  4779. requestDefaults.headers["time-zone"] = options.timeZone;
  4780. }
  4781. this.request = import_request.request.defaults(requestDefaults);
  4782. this.graphql = (0, import_graphql.withCustomRequest)(this.request).defaults(requestDefaults);
  4783. this.log = Object.assign(
  4784. {
  4785. debug: noop,
  4786. info: noop,
  4787. warn: consoleWarn,
  4788. error: consoleError
  4789. },
  4790. options.log
  4791. );
  4792. this.hook = hook;
  4793. if (!options.authStrategy) {
  4794. if (!options.auth) {
  4795. this.auth = async () => ({
  4796. type: "unauthenticated"
  4797. });
  4798. } else {
  4799. const auth = (0, import_auth_token.createTokenAuth)(options.auth);
  4800. hook.wrap("request", auth.hook);
  4801. this.auth = auth;
  4802. }
  4803. } else {
  4804. const { authStrategy, ...otherOptions } = options;
  4805. const auth = authStrategy(
  4806. Object.assign(
  4807. {
  4808. request: this.request,
  4809. log: this.log,
  4810. // we pass the current octokit instance as well as its constructor options
  4811. // to allow for authentication strategies that return a new octokit instance
  4812. // that shares the same internal state as the current one. The original
  4813. // requirement for this was the "event-octokit" authentication strategy
  4814. // of https://github.com/probot/octokit-auth-probot.
  4815. octokit: this,
  4816. octokitOptions: otherOptions
  4817. },
  4818. options.auth
  4819. )
  4820. );
  4821. hook.wrap("request", auth.hook);
  4822. this.auth = auth;
  4823. }
  4824. const classConstructor = this.constructor;
  4825. for (let i = 0; i < classConstructor.plugins.length; ++i) {
  4826. Object.assign(this, classConstructor.plugins[i](this, options));
  4827. }
  4828. }
  4829. };
  4830. // Annotate the CommonJS export names for ESM import in node:
  4831. 0 && (0);
  4832. /***/ }),
  4833. /***/ 9440:
  4834. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  4835. var __defProp = Object.defineProperty;
  4836. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  4837. var __getOwnPropNames = Object.getOwnPropertyNames;
  4838. var __hasOwnProp = Object.prototype.hasOwnProperty;
  4839. var __export = (target, all) => {
  4840. for (var name in all)
  4841. __defProp(target, name, { get: all[name], enumerable: true });
  4842. };
  4843. var __copyProps = (to, from, except, desc) => {
  4844. if (from && typeof from === "object" || typeof from === "function") {
  4845. for (let key of __getOwnPropNames(from))
  4846. if (!__hasOwnProp.call(to, key) && key !== except)
  4847. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  4848. }
  4849. return to;
  4850. };
  4851. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  4852. // pkg/dist-src/index.js
  4853. var dist_src_exports = {};
  4854. __export(dist_src_exports, {
  4855. endpoint: () => endpoint
  4856. });
  4857. module.exports = __toCommonJS(dist_src_exports);
  4858. // pkg/dist-src/defaults.js
  4859. var import_universal_user_agent = __nccwpck_require__(5030);
  4860. // pkg/dist-src/version.js
  4861. var VERSION = "9.0.6";
  4862. // pkg/dist-src/defaults.js
  4863. var userAgent = `octokit-endpoint.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`;
  4864. var DEFAULTS = {
  4865. method: "GET",
  4866. baseUrl: "https://api.github.com",
  4867. headers: {
  4868. accept: "application/vnd.github.v3+json",
  4869. "user-agent": userAgent
  4870. },
  4871. mediaType: {
  4872. format: ""
  4873. }
  4874. };
  4875. // pkg/dist-src/util/lowercase-keys.js
  4876. function lowercaseKeys(object) {
  4877. if (!object) {
  4878. return {};
  4879. }
  4880. return Object.keys(object).reduce((newObj, key) => {
  4881. newObj[key.toLowerCase()] = object[key];
  4882. return newObj;
  4883. }, {});
  4884. }
  4885. // pkg/dist-src/util/is-plain-object.js
  4886. function isPlainObject(value) {
  4887. if (typeof value !== "object" || value === null)
  4888. return false;
  4889. if (Object.prototype.toString.call(value) !== "[object Object]")
  4890. return false;
  4891. const proto = Object.getPrototypeOf(value);
  4892. if (proto === null)
  4893. return true;
  4894. const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
  4895. return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
  4896. }
  4897. // pkg/dist-src/util/merge-deep.js
  4898. function mergeDeep(defaults, options) {
  4899. const result = Object.assign({}, defaults);
  4900. Object.keys(options).forEach((key) => {
  4901. if (isPlainObject(options[key])) {
  4902. if (!(key in defaults))
  4903. Object.assign(result, { [key]: options[key] });
  4904. else
  4905. result[key] = mergeDeep(defaults[key], options[key]);
  4906. } else {
  4907. Object.assign(result, { [key]: options[key] });
  4908. }
  4909. });
  4910. return result;
  4911. }
  4912. // pkg/dist-src/util/remove-undefined-properties.js
  4913. function removeUndefinedProperties(obj) {
  4914. for (const key in obj) {
  4915. if (obj[key] === void 0) {
  4916. delete obj[key];
  4917. }
  4918. }
  4919. return obj;
  4920. }
  4921. // pkg/dist-src/merge.js
  4922. function merge(defaults, route, options) {
  4923. if (typeof route === "string") {
  4924. let [method, url] = route.split(" ");
  4925. options = Object.assign(url ? { method, url } : { url: method }, options);
  4926. } else {
  4927. options = Object.assign({}, route);
  4928. }
  4929. options.headers = lowercaseKeys(options.headers);
  4930. removeUndefinedProperties(options);
  4931. removeUndefinedProperties(options.headers);
  4932. const mergedOptions = mergeDeep(defaults || {}, options);
  4933. if (options.url === "/graphql") {
  4934. if (defaults && defaults.mediaType.previews?.length) {
  4935. mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(
  4936. (preview) => !mergedOptions.mediaType.previews.includes(preview)
  4937. ).concat(mergedOptions.mediaType.previews);
  4938. }
  4939. mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, ""));
  4940. }
  4941. return mergedOptions;
  4942. }
  4943. // pkg/dist-src/util/add-query-parameters.js
  4944. function addQueryParameters(url, parameters) {
  4945. const separator = /\?/.test(url) ? "&" : "?";
  4946. const names = Object.keys(parameters);
  4947. if (names.length === 0) {
  4948. return url;
  4949. }
  4950. return url + separator + names.map((name) => {
  4951. if (name === "q") {
  4952. return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+");
  4953. }
  4954. return `${name}=${encodeURIComponent(parameters[name])}`;
  4955. }).join("&");
  4956. }
  4957. // pkg/dist-src/util/extract-url-variable-names.js
  4958. var urlVariableRegex = /\{[^{}}]+\}/g;
  4959. function removeNonChars(variableName) {
  4960. return variableName.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g, "").split(/,/);
  4961. }
  4962. function extractUrlVariableNames(url) {
  4963. const matches = url.match(urlVariableRegex);
  4964. if (!matches) {
  4965. return [];
  4966. }
  4967. return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);
  4968. }
  4969. // pkg/dist-src/util/omit.js
  4970. function omit(object, keysToOmit) {
  4971. const result = { __proto__: null };
  4972. for (const key of Object.keys(object)) {
  4973. if (keysToOmit.indexOf(key) === -1) {
  4974. result[key] = object[key];
  4975. }
  4976. }
  4977. return result;
  4978. }
  4979. // pkg/dist-src/util/url-template.js
  4980. function encodeReserved(str) {
  4981. return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) {
  4982. if (!/%[0-9A-Fa-f]/.test(part)) {
  4983. part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]");
  4984. }
  4985. return part;
  4986. }).join("");
  4987. }
  4988. function encodeUnreserved(str) {
  4989. return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
  4990. return "%" + c.charCodeAt(0).toString(16).toUpperCase();
  4991. });
  4992. }
  4993. function encodeValue(operator, value, key) {
  4994. value = operator === "+" || operator === "#" ? encodeReserved(value) : encodeUnreserved(value);
  4995. if (key) {
  4996. return encodeUnreserved(key) + "=" + value;
  4997. } else {
  4998. return value;
  4999. }
  5000. }
  5001. function isDefined(value) {
  5002. return value !== void 0 && value !== null;
  5003. }
  5004. function isKeyOperator(operator) {
  5005. return operator === ";" || operator === "&" || operator === "?";
  5006. }
  5007. function getValues(context, operator, key, modifier) {
  5008. var value = context[key], result = [];
  5009. if (isDefined(value) && value !== "") {
  5010. if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
  5011. value = value.toString();
  5012. if (modifier && modifier !== "*") {
  5013. value = value.substring(0, parseInt(modifier, 10));
  5014. }
  5015. result.push(
  5016. encodeValue(operator, value, isKeyOperator(operator) ? key : "")
  5017. );
  5018. } else {
  5019. if (modifier === "*") {
  5020. if (Array.isArray(value)) {
  5021. value.filter(isDefined).forEach(function(value2) {
  5022. result.push(
  5023. encodeValue(operator, value2, isKeyOperator(operator) ? key : "")
  5024. );
  5025. });
  5026. } else {
  5027. Object.keys(value).forEach(function(k) {
  5028. if (isDefined(value[k])) {
  5029. result.push(encodeValue(operator, value[k], k));
  5030. }
  5031. });
  5032. }
  5033. } else {
  5034. const tmp = [];
  5035. if (Array.isArray(value)) {
  5036. value.filter(isDefined).forEach(function(value2) {
  5037. tmp.push(encodeValue(operator, value2));
  5038. });
  5039. } else {
  5040. Object.keys(value).forEach(function(k) {
  5041. if (isDefined(value[k])) {
  5042. tmp.push(encodeUnreserved(k));
  5043. tmp.push(encodeValue(operator, value[k].toString()));
  5044. }
  5045. });
  5046. }
  5047. if (isKeyOperator(operator)) {
  5048. result.push(encodeUnreserved(key) + "=" + tmp.join(","));
  5049. } else if (tmp.length !== 0) {
  5050. result.push(tmp.join(","));
  5051. }
  5052. }
  5053. }
  5054. } else {
  5055. if (operator === ";") {
  5056. if (isDefined(value)) {
  5057. result.push(encodeUnreserved(key));
  5058. }
  5059. } else if (value === "" && (operator === "&" || operator === "?")) {
  5060. result.push(encodeUnreserved(key) + "=");
  5061. } else if (value === "") {
  5062. result.push("");
  5063. }
  5064. }
  5065. return result;
  5066. }
  5067. function parseUrl(template) {
  5068. return {
  5069. expand: expand.bind(null, template)
  5070. };
  5071. }
  5072. function expand(template, context) {
  5073. var operators = ["+", "#", ".", "/", ";", "?", "&"];
  5074. template = template.replace(
  5075. /\{([^\{\}]+)\}|([^\{\}]+)/g,
  5076. function(_, expression, literal) {
  5077. if (expression) {
  5078. let operator = "";
  5079. const values = [];
  5080. if (operators.indexOf(expression.charAt(0)) !== -1) {
  5081. operator = expression.charAt(0);
  5082. expression = expression.substr(1);
  5083. }
  5084. expression.split(/,/g).forEach(function(variable) {
  5085. var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
  5086. values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
  5087. });
  5088. if (operator && operator !== "+") {
  5089. var separator = ",";
  5090. if (operator === "?") {
  5091. separator = "&";
  5092. } else if (operator !== "#") {
  5093. separator = operator;
  5094. }
  5095. return (values.length !== 0 ? operator : "") + values.join(separator);
  5096. } else {
  5097. return values.join(",");
  5098. }
  5099. } else {
  5100. return encodeReserved(literal);
  5101. }
  5102. }
  5103. );
  5104. if (template === "/") {
  5105. return template;
  5106. } else {
  5107. return template.replace(/\/$/, "");
  5108. }
  5109. }
  5110. // pkg/dist-src/parse.js
  5111. function parse(options) {
  5112. let method = options.method.toUpperCase();
  5113. let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}");
  5114. let headers = Object.assign({}, options.headers);
  5115. let body;
  5116. let parameters = omit(options, [
  5117. "method",
  5118. "baseUrl",
  5119. "url",
  5120. "headers",
  5121. "request",
  5122. "mediaType"
  5123. ]);
  5124. const urlVariableNames = extractUrlVariableNames(url);
  5125. url = parseUrl(url).expand(parameters);
  5126. if (!/^http/.test(url)) {
  5127. url = options.baseUrl + url;
  5128. }
  5129. const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl");
  5130. const remainingParameters = omit(parameters, omittedParameters);
  5131. const isBinaryRequest = /application\/octet-stream/i.test(headers.accept);
  5132. if (!isBinaryRequest) {
  5133. if (options.mediaType.format) {
  5134. headers.accept = headers.accept.split(/,/).map(
  5135. (format) => format.replace(
  5136. /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,
  5137. `application/vnd$1$2.${options.mediaType.format}`
  5138. )
  5139. ).join(",");
  5140. }
  5141. if (url.endsWith("/graphql")) {
  5142. if (options.mediaType.previews?.length) {
  5143. const previewsFromAcceptHeader = headers.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g) || [];
  5144. headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => {
  5145. const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json";
  5146. return `application/vnd.github.${preview}-preview${format}`;
  5147. }).join(",");
  5148. }
  5149. }
  5150. }
  5151. if (["GET", "HEAD"].includes(method)) {
  5152. url = addQueryParameters(url, remainingParameters);
  5153. } else {
  5154. if ("data" in remainingParameters) {
  5155. body = remainingParameters.data;
  5156. } else {
  5157. if (Object.keys(remainingParameters).length) {
  5158. body = remainingParameters;
  5159. }
  5160. }
  5161. }
  5162. if (!headers["content-type"] && typeof body !== "undefined") {
  5163. headers["content-type"] = "application/json; charset=utf-8";
  5164. }
  5165. if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") {
  5166. body = "";
  5167. }
  5168. return Object.assign(
  5169. { method, url, headers },
  5170. typeof body !== "undefined" ? { body } : null,
  5171. options.request ? { request: options.request } : null
  5172. );
  5173. }
  5174. // pkg/dist-src/endpoint-with-defaults.js
  5175. function endpointWithDefaults(defaults, route, options) {
  5176. return parse(merge(defaults, route, options));
  5177. }
  5178. // pkg/dist-src/with-defaults.js
  5179. function withDefaults(oldDefaults, newDefaults) {
  5180. const DEFAULTS2 = merge(oldDefaults, newDefaults);
  5181. const endpoint2 = endpointWithDefaults.bind(null, DEFAULTS2);
  5182. return Object.assign(endpoint2, {
  5183. DEFAULTS: DEFAULTS2,
  5184. defaults: withDefaults.bind(null, DEFAULTS2),
  5185. merge: merge.bind(null, DEFAULTS2),
  5186. parse
  5187. });
  5188. }
  5189. // pkg/dist-src/index.js
  5190. var endpoint = withDefaults(null, DEFAULTS);
  5191. // Annotate the CommonJS export names for ESM import in node:
  5192. 0 && (0);
  5193. /***/ }),
  5194. /***/ 8467:
  5195. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  5196. var __defProp = Object.defineProperty;
  5197. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  5198. var __getOwnPropNames = Object.getOwnPropertyNames;
  5199. var __hasOwnProp = Object.prototype.hasOwnProperty;
  5200. var __export = (target, all) => {
  5201. for (var name in all)
  5202. __defProp(target, name, { get: all[name], enumerable: true });
  5203. };
  5204. var __copyProps = (to, from, except, desc) => {
  5205. if (from && typeof from === "object" || typeof from === "function") {
  5206. for (let key of __getOwnPropNames(from))
  5207. if (!__hasOwnProp.call(to, key) && key !== except)
  5208. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  5209. }
  5210. return to;
  5211. };
  5212. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  5213. // pkg/dist-src/index.js
  5214. var dist_src_exports = {};
  5215. __export(dist_src_exports, {
  5216. GraphqlResponseError: () => GraphqlResponseError,
  5217. graphql: () => graphql2,
  5218. withCustomRequest: () => withCustomRequest
  5219. });
  5220. module.exports = __toCommonJS(dist_src_exports);
  5221. var import_request3 = __nccwpck_require__(6234);
  5222. var import_universal_user_agent = __nccwpck_require__(5030);
  5223. // pkg/dist-src/version.js
  5224. var VERSION = "7.1.0";
  5225. // pkg/dist-src/with-defaults.js
  5226. var import_request2 = __nccwpck_require__(6234);
  5227. // pkg/dist-src/graphql.js
  5228. var import_request = __nccwpck_require__(6234);
  5229. // pkg/dist-src/error.js
  5230. function _buildMessageForResponseErrors(data) {
  5231. return `Request failed due to following response errors:
  5232. ` + data.errors.map((e) => ` - ${e.message}`).join("\n");
  5233. }
  5234. var GraphqlResponseError = class extends Error {
  5235. constructor(request2, headers, response) {
  5236. super(_buildMessageForResponseErrors(response));
  5237. this.request = request2;
  5238. this.headers = headers;
  5239. this.response = response;
  5240. this.name = "GraphqlResponseError";
  5241. this.errors = response.errors;
  5242. this.data = response.data;
  5243. if (Error.captureStackTrace) {
  5244. Error.captureStackTrace(this, this.constructor);
  5245. }
  5246. }
  5247. };
  5248. // pkg/dist-src/graphql.js
  5249. var NON_VARIABLE_OPTIONS = [
  5250. "method",
  5251. "baseUrl",
  5252. "url",
  5253. "headers",
  5254. "request",
  5255. "query",
  5256. "mediaType"
  5257. ];
  5258. var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"];
  5259. var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
  5260. function graphql(request2, query, options) {
  5261. if (options) {
  5262. if (typeof query === "string" && "query" in options) {
  5263. return Promise.reject(
  5264. new Error(`[@octokit/graphql] "query" cannot be used as variable name`)
  5265. );
  5266. }
  5267. for (const key in options) {
  5268. if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key))
  5269. continue;
  5270. return Promise.reject(
  5271. new Error(
  5272. `[@octokit/graphql] "${key}" cannot be used as variable name`
  5273. )
  5274. );
  5275. }
  5276. }
  5277. const parsedOptions = typeof query === "string" ? Object.assign({ query }, options) : query;
  5278. const requestOptions = Object.keys(
  5279. parsedOptions
  5280. ).reduce((result, key) => {
  5281. if (NON_VARIABLE_OPTIONS.includes(key)) {
  5282. result[key] = parsedOptions[key];
  5283. return result;
  5284. }
  5285. if (!result.variables) {
  5286. result.variables = {};
  5287. }
  5288. result.variables[key] = parsedOptions[key];
  5289. return result;
  5290. }, {});
  5291. const baseUrl = parsedOptions.baseUrl || request2.endpoint.DEFAULTS.baseUrl;
  5292. if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) {
  5293. requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql");
  5294. }
  5295. return request2(requestOptions).then((response) => {
  5296. if (response.data.errors) {
  5297. const headers = {};
  5298. for (const key of Object.keys(response.headers)) {
  5299. headers[key] = response.headers[key];
  5300. }
  5301. throw new GraphqlResponseError(
  5302. requestOptions,
  5303. headers,
  5304. response.data
  5305. );
  5306. }
  5307. return response.data.data;
  5308. });
  5309. }
  5310. // pkg/dist-src/with-defaults.js
  5311. function withDefaults(request2, newDefaults) {
  5312. const newRequest = request2.defaults(newDefaults);
  5313. const newApi = (query, options) => {
  5314. return graphql(newRequest, query, options);
  5315. };
  5316. return Object.assign(newApi, {
  5317. defaults: withDefaults.bind(null, newRequest),
  5318. endpoint: newRequest.endpoint
  5319. });
  5320. }
  5321. // pkg/dist-src/index.js
  5322. var graphql2 = withDefaults(import_request3.request, {
  5323. headers: {
  5324. "user-agent": `octokit-graphql.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`
  5325. },
  5326. method: "POST",
  5327. url: "/graphql"
  5328. });
  5329. function withCustomRequest(customRequest) {
  5330. return withDefaults(customRequest, {
  5331. method: "POST",
  5332. url: "/graphql"
  5333. });
  5334. }
  5335. // Annotate the CommonJS export names for ESM import in node:
  5336. 0 && (0);
  5337. /***/ }),
  5338. /***/ 4193:
  5339. /***/ ((module) => {
  5340. var __defProp = Object.defineProperty;
  5341. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  5342. var __getOwnPropNames = Object.getOwnPropertyNames;
  5343. var __hasOwnProp = Object.prototype.hasOwnProperty;
  5344. var __export = (target, all) => {
  5345. for (var name in all)
  5346. __defProp(target, name, { get: all[name], enumerable: true });
  5347. };
  5348. var __copyProps = (to, from, except, desc) => {
  5349. if (from && typeof from === "object" || typeof from === "function") {
  5350. for (let key of __getOwnPropNames(from))
  5351. if (!__hasOwnProp.call(to, key) && key !== except)
  5352. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  5353. }
  5354. return to;
  5355. };
  5356. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  5357. // pkg/dist-src/index.js
  5358. var dist_src_exports = {};
  5359. __export(dist_src_exports, {
  5360. composePaginateRest: () => composePaginateRest,
  5361. isPaginatingEndpoint: () => isPaginatingEndpoint,
  5362. paginateRest: () => paginateRest,
  5363. paginatingEndpoints: () => paginatingEndpoints
  5364. });
  5365. module.exports = __toCommonJS(dist_src_exports);
  5366. // pkg/dist-src/version.js
  5367. var VERSION = "9.2.2";
  5368. // pkg/dist-src/normalize-paginated-list-response.js
  5369. function normalizePaginatedListResponse(response) {
  5370. if (!response.data) {
  5371. return {
  5372. ...response,
  5373. data: []
  5374. };
  5375. }
  5376. const responseNeedsNormalization = "total_count" in response.data && !("url" in response.data);
  5377. if (!responseNeedsNormalization)
  5378. return response;
  5379. const incompleteResults = response.data.incomplete_results;
  5380. const repositorySelection = response.data.repository_selection;
  5381. const totalCount = response.data.total_count;
  5382. delete response.data.incomplete_results;
  5383. delete response.data.repository_selection;
  5384. delete response.data.total_count;
  5385. const namespaceKey = Object.keys(response.data)[0];
  5386. const data = response.data[namespaceKey];
  5387. response.data = data;
  5388. if (typeof incompleteResults !== "undefined") {
  5389. response.data.incomplete_results = incompleteResults;
  5390. }
  5391. if (typeof repositorySelection !== "undefined") {
  5392. response.data.repository_selection = repositorySelection;
  5393. }
  5394. response.data.total_count = totalCount;
  5395. return response;
  5396. }
  5397. // pkg/dist-src/iterator.js
  5398. function iterator(octokit, route, parameters) {
  5399. const options = typeof route === "function" ? route.endpoint(parameters) : octokit.request.endpoint(route, parameters);
  5400. const requestMethod = typeof route === "function" ? route : octokit.request;
  5401. const method = options.method;
  5402. const headers = options.headers;
  5403. let url = options.url;
  5404. return {
  5405. [Symbol.asyncIterator]: () => ({
  5406. async next() {
  5407. if (!url)
  5408. return { done: true };
  5409. try {
  5410. const response = await requestMethod({ method, url, headers });
  5411. const normalizedResponse = normalizePaginatedListResponse(response);
  5412. url = ((normalizedResponse.headers.link || "").match(
  5413. /<([^<>]+)>;\s*rel="next"/
  5414. ) || [])[1];
  5415. return { value: normalizedResponse };
  5416. } catch (error) {
  5417. if (error.status !== 409)
  5418. throw error;
  5419. url = "";
  5420. return {
  5421. value: {
  5422. status: 200,
  5423. headers: {},
  5424. data: []
  5425. }
  5426. };
  5427. }
  5428. }
  5429. })
  5430. };
  5431. }
  5432. // pkg/dist-src/paginate.js
  5433. function paginate(octokit, route, parameters, mapFn) {
  5434. if (typeof parameters === "function") {
  5435. mapFn = parameters;
  5436. parameters = void 0;
  5437. }
  5438. return gather(
  5439. octokit,
  5440. [],
  5441. iterator(octokit, route, parameters)[Symbol.asyncIterator](),
  5442. mapFn
  5443. );
  5444. }
  5445. function gather(octokit, results, iterator2, mapFn) {
  5446. return iterator2.next().then((result) => {
  5447. if (result.done) {
  5448. return results;
  5449. }
  5450. let earlyExit = false;
  5451. function done() {
  5452. earlyExit = true;
  5453. }
  5454. results = results.concat(
  5455. mapFn ? mapFn(result.value, done) : result.value.data
  5456. );
  5457. if (earlyExit) {
  5458. return results;
  5459. }
  5460. return gather(octokit, results, iterator2, mapFn);
  5461. });
  5462. }
  5463. // pkg/dist-src/compose-paginate.js
  5464. var composePaginateRest = Object.assign(paginate, {
  5465. iterator
  5466. });
  5467. // pkg/dist-src/generated/paginating-endpoints.js
  5468. var paginatingEndpoints = [
  5469. "GET /advisories",
  5470. "GET /app/hook/deliveries",
  5471. "GET /app/installation-requests",
  5472. "GET /app/installations",
  5473. "GET /assignments/{assignment_id}/accepted_assignments",
  5474. "GET /classrooms",
  5475. "GET /classrooms/{classroom_id}/assignments",
  5476. "GET /enterprises/{enterprise}/dependabot/alerts",
  5477. "GET /enterprises/{enterprise}/secret-scanning/alerts",
  5478. "GET /events",
  5479. "GET /gists",
  5480. "GET /gists/public",
  5481. "GET /gists/starred",
  5482. "GET /gists/{gist_id}/comments",
  5483. "GET /gists/{gist_id}/commits",
  5484. "GET /gists/{gist_id}/forks",
  5485. "GET /installation/repositories",
  5486. "GET /issues",
  5487. "GET /licenses",
  5488. "GET /marketplace_listing/plans",
  5489. "GET /marketplace_listing/plans/{plan_id}/accounts",
  5490. "GET /marketplace_listing/stubbed/plans",
  5491. "GET /marketplace_listing/stubbed/plans/{plan_id}/accounts",
  5492. "GET /networks/{owner}/{repo}/events",
  5493. "GET /notifications",
  5494. "GET /organizations",
  5495. "GET /orgs/{org}/actions/cache/usage-by-repository",
  5496. "GET /orgs/{org}/actions/permissions/repositories",
  5497. "GET /orgs/{org}/actions/runners",
  5498. "GET /orgs/{org}/actions/secrets",
  5499. "GET /orgs/{org}/actions/secrets/{secret_name}/repositories",
  5500. "GET /orgs/{org}/actions/variables",
  5501. "GET /orgs/{org}/actions/variables/{name}/repositories",
  5502. "GET /orgs/{org}/blocks",
  5503. "GET /orgs/{org}/code-scanning/alerts",
  5504. "GET /orgs/{org}/codespaces",
  5505. "GET /orgs/{org}/codespaces/secrets",
  5506. "GET /orgs/{org}/codespaces/secrets/{secret_name}/repositories",
  5507. "GET /orgs/{org}/copilot/billing/seats",
  5508. "GET /orgs/{org}/dependabot/alerts",
  5509. "GET /orgs/{org}/dependabot/secrets",
  5510. "GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories",
  5511. "GET /orgs/{org}/events",
  5512. "GET /orgs/{org}/failed_invitations",
  5513. "GET /orgs/{org}/hooks",
  5514. "GET /orgs/{org}/hooks/{hook_id}/deliveries",
  5515. "GET /orgs/{org}/installations",
  5516. "GET /orgs/{org}/invitations",
  5517. "GET /orgs/{org}/invitations/{invitation_id}/teams",
  5518. "GET /orgs/{org}/issues",
  5519. "GET /orgs/{org}/members",
  5520. "GET /orgs/{org}/members/{username}/codespaces",
  5521. "GET /orgs/{org}/migrations",
  5522. "GET /orgs/{org}/migrations/{migration_id}/repositories",
  5523. "GET /orgs/{org}/organization-roles/{role_id}/teams",
  5524. "GET /orgs/{org}/organization-roles/{role_id}/users",
  5525. "GET /orgs/{org}/outside_collaborators",
  5526. "GET /orgs/{org}/packages",
  5527. "GET /orgs/{org}/packages/{package_type}/{package_name}/versions",
  5528. "GET /orgs/{org}/personal-access-token-requests",
  5529. "GET /orgs/{org}/personal-access-token-requests/{pat_request_id}/repositories",
  5530. "GET /orgs/{org}/personal-access-tokens",
  5531. "GET /orgs/{org}/personal-access-tokens/{pat_id}/repositories",
  5532. "GET /orgs/{org}/projects",
  5533. "GET /orgs/{org}/properties/values",
  5534. "GET /orgs/{org}/public_members",
  5535. "GET /orgs/{org}/repos",
  5536. "GET /orgs/{org}/rulesets",
  5537. "GET /orgs/{org}/rulesets/rule-suites",
  5538. "GET /orgs/{org}/secret-scanning/alerts",
  5539. "GET /orgs/{org}/security-advisories",
  5540. "GET /orgs/{org}/teams",
  5541. "GET /orgs/{org}/teams/{team_slug}/discussions",
  5542. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments",
  5543. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions",
  5544. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions",
  5545. "GET /orgs/{org}/teams/{team_slug}/invitations",
  5546. "GET /orgs/{org}/teams/{team_slug}/members",
  5547. "GET /orgs/{org}/teams/{team_slug}/projects",
  5548. "GET /orgs/{org}/teams/{team_slug}/repos",
  5549. "GET /orgs/{org}/teams/{team_slug}/teams",
  5550. "GET /projects/columns/{column_id}/cards",
  5551. "GET /projects/{project_id}/collaborators",
  5552. "GET /projects/{project_id}/columns",
  5553. "GET /repos/{owner}/{repo}/actions/artifacts",
  5554. "GET /repos/{owner}/{repo}/actions/caches",
  5555. "GET /repos/{owner}/{repo}/actions/organization-secrets",
  5556. "GET /repos/{owner}/{repo}/actions/organization-variables",
  5557. "GET /repos/{owner}/{repo}/actions/runners",
  5558. "GET /repos/{owner}/{repo}/actions/runs",
  5559. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts",
  5560. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs",
  5561. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs",
  5562. "GET /repos/{owner}/{repo}/actions/secrets",
  5563. "GET /repos/{owner}/{repo}/actions/variables",
  5564. "GET /repos/{owner}/{repo}/actions/workflows",
  5565. "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs",
  5566. "GET /repos/{owner}/{repo}/activity",
  5567. "GET /repos/{owner}/{repo}/assignees",
  5568. "GET /repos/{owner}/{repo}/branches",
  5569. "GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations",
  5570. "GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs",
  5571. "GET /repos/{owner}/{repo}/code-scanning/alerts",
  5572. "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances",
  5573. "GET /repos/{owner}/{repo}/code-scanning/analyses",
  5574. "GET /repos/{owner}/{repo}/codespaces",
  5575. "GET /repos/{owner}/{repo}/codespaces/devcontainers",
  5576. "GET /repos/{owner}/{repo}/codespaces/secrets",
  5577. "GET /repos/{owner}/{repo}/collaborators",
  5578. "GET /repos/{owner}/{repo}/comments",
  5579. "GET /repos/{owner}/{repo}/comments/{comment_id}/reactions",
  5580. "GET /repos/{owner}/{repo}/commits",
  5581. "GET /repos/{owner}/{repo}/commits/{commit_sha}/comments",
  5582. "GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls",
  5583. "GET /repos/{owner}/{repo}/commits/{ref}/check-runs",
  5584. "GET /repos/{owner}/{repo}/commits/{ref}/check-suites",
  5585. "GET /repos/{owner}/{repo}/commits/{ref}/status",
  5586. "GET /repos/{owner}/{repo}/commits/{ref}/statuses",
  5587. "GET /repos/{owner}/{repo}/contributors",
  5588. "GET /repos/{owner}/{repo}/dependabot/alerts",
  5589. "GET /repos/{owner}/{repo}/dependabot/secrets",
  5590. "GET /repos/{owner}/{repo}/deployments",
  5591. "GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses",
  5592. "GET /repos/{owner}/{repo}/environments",
  5593. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies",
  5594. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/apps",
  5595. "GET /repos/{owner}/{repo}/events",
  5596. "GET /repos/{owner}/{repo}/forks",
  5597. "GET /repos/{owner}/{repo}/hooks",
  5598. "GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries",
  5599. "GET /repos/{owner}/{repo}/invitations",
  5600. "GET /repos/{owner}/{repo}/issues",
  5601. "GET /repos/{owner}/{repo}/issues/comments",
  5602. "GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions",
  5603. "GET /repos/{owner}/{repo}/issues/events",
  5604. "GET /repos/{owner}/{repo}/issues/{issue_number}/comments",
  5605. "GET /repos/{owner}/{repo}/issues/{issue_number}/events",
  5606. "GET /repos/{owner}/{repo}/issues/{issue_number}/labels",
  5607. "GET /repos/{owner}/{repo}/issues/{issue_number}/reactions",
  5608. "GET /repos/{owner}/{repo}/issues/{issue_number}/timeline",
  5609. "GET /repos/{owner}/{repo}/keys",
  5610. "GET /repos/{owner}/{repo}/labels",
  5611. "GET /repos/{owner}/{repo}/milestones",
  5612. "GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels",
  5613. "GET /repos/{owner}/{repo}/notifications",
  5614. "GET /repos/{owner}/{repo}/pages/builds",
  5615. "GET /repos/{owner}/{repo}/projects",
  5616. "GET /repos/{owner}/{repo}/pulls",
  5617. "GET /repos/{owner}/{repo}/pulls/comments",
  5618. "GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions",
  5619. "GET /repos/{owner}/{repo}/pulls/{pull_number}/comments",
  5620. "GET /repos/{owner}/{repo}/pulls/{pull_number}/commits",
  5621. "GET /repos/{owner}/{repo}/pulls/{pull_number}/files",
  5622. "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews",
  5623. "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments",
  5624. "GET /repos/{owner}/{repo}/releases",
  5625. "GET /repos/{owner}/{repo}/releases/{release_id}/assets",
  5626. "GET /repos/{owner}/{repo}/releases/{release_id}/reactions",
  5627. "GET /repos/{owner}/{repo}/rules/branches/{branch}",
  5628. "GET /repos/{owner}/{repo}/rulesets",
  5629. "GET /repos/{owner}/{repo}/rulesets/rule-suites",
  5630. "GET /repos/{owner}/{repo}/secret-scanning/alerts",
  5631. "GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations",
  5632. "GET /repos/{owner}/{repo}/security-advisories",
  5633. "GET /repos/{owner}/{repo}/stargazers",
  5634. "GET /repos/{owner}/{repo}/subscribers",
  5635. "GET /repos/{owner}/{repo}/tags",
  5636. "GET /repos/{owner}/{repo}/teams",
  5637. "GET /repos/{owner}/{repo}/topics",
  5638. "GET /repositories",
  5639. "GET /repositories/{repository_id}/environments/{environment_name}/secrets",
  5640. "GET /repositories/{repository_id}/environments/{environment_name}/variables",
  5641. "GET /search/code",
  5642. "GET /search/commits",
  5643. "GET /search/issues",
  5644. "GET /search/labels",
  5645. "GET /search/repositories",
  5646. "GET /search/topics",
  5647. "GET /search/users",
  5648. "GET /teams/{team_id}/discussions",
  5649. "GET /teams/{team_id}/discussions/{discussion_number}/comments",
  5650. "GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions",
  5651. "GET /teams/{team_id}/discussions/{discussion_number}/reactions",
  5652. "GET /teams/{team_id}/invitations",
  5653. "GET /teams/{team_id}/members",
  5654. "GET /teams/{team_id}/projects",
  5655. "GET /teams/{team_id}/repos",
  5656. "GET /teams/{team_id}/teams",
  5657. "GET /user/blocks",
  5658. "GET /user/codespaces",
  5659. "GET /user/codespaces/secrets",
  5660. "GET /user/emails",
  5661. "GET /user/followers",
  5662. "GET /user/following",
  5663. "GET /user/gpg_keys",
  5664. "GET /user/installations",
  5665. "GET /user/installations/{installation_id}/repositories",
  5666. "GET /user/issues",
  5667. "GET /user/keys",
  5668. "GET /user/marketplace_purchases",
  5669. "GET /user/marketplace_purchases/stubbed",
  5670. "GET /user/memberships/orgs",
  5671. "GET /user/migrations",
  5672. "GET /user/migrations/{migration_id}/repositories",
  5673. "GET /user/orgs",
  5674. "GET /user/packages",
  5675. "GET /user/packages/{package_type}/{package_name}/versions",
  5676. "GET /user/public_emails",
  5677. "GET /user/repos",
  5678. "GET /user/repository_invitations",
  5679. "GET /user/social_accounts",
  5680. "GET /user/ssh_signing_keys",
  5681. "GET /user/starred",
  5682. "GET /user/subscriptions",
  5683. "GET /user/teams",
  5684. "GET /users",
  5685. "GET /users/{username}/events",
  5686. "GET /users/{username}/events/orgs/{org}",
  5687. "GET /users/{username}/events/public",
  5688. "GET /users/{username}/followers",
  5689. "GET /users/{username}/following",
  5690. "GET /users/{username}/gists",
  5691. "GET /users/{username}/gpg_keys",
  5692. "GET /users/{username}/keys",
  5693. "GET /users/{username}/orgs",
  5694. "GET /users/{username}/packages",
  5695. "GET /users/{username}/projects",
  5696. "GET /users/{username}/received_events",
  5697. "GET /users/{username}/received_events/public",
  5698. "GET /users/{username}/repos",
  5699. "GET /users/{username}/social_accounts",
  5700. "GET /users/{username}/ssh_signing_keys",
  5701. "GET /users/{username}/starred",
  5702. "GET /users/{username}/subscriptions"
  5703. ];
  5704. // pkg/dist-src/paginating-endpoints.js
  5705. function isPaginatingEndpoint(arg) {
  5706. if (typeof arg === "string") {
  5707. return paginatingEndpoints.includes(arg);
  5708. } else {
  5709. return false;
  5710. }
  5711. }
  5712. // pkg/dist-src/index.js
  5713. function paginateRest(octokit) {
  5714. return {
  5715. paginate: Object.assign(paginate.bind(null, octokit), {
  5716. iterator: iterator.bind(null, octokit)
  5717. })
  5718. };
  5719. }
  5720. paginateRest.VERSION = VERSION;
  5721. // Annotate the CommonJS export names for ESM import in node:
  5722. 0 && (0);
  5723. /***/ }),
  5724. /***/ 3044:
  5725. /***/ ((module) => {
  5726. var __defProp = Object.defineProperty;
  5727. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  5728. var __getOwnPropNames = Object.getOwnPropertyNames;
  5729. var __hasOwnProp = Object.prototype.hasOwnProperty;
  5730. var __export = (target, all) => {
  5731. for (var name in all)
  5732. __defProp(target, name, { get: all[name], enumerable: true });
  5733. };
  5734. var __copyProps = (to, from, except, desc) => {
  5735. if (from && typeof from === "object" || typeof from === "function") {
  5736. for (let key of __getOwnPropNames(from))
  5737. if (!__hasOwnProp.call(to, key) && key !== except)
  5738. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  5739. }
  5740. return to;
  5741. };
  5742. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  5743. // pkg/dist-src/index.js
  5744. var dist_src_exports = {};
  5745. __export(dist_src_exports, {
  5746. legacyRestEndpointMethods: () => legacyRestEndpointMethods,
  5747. restEndpointMethods: () => restEndpointMethods
  5748. });
  5749. module.exports = __toCommonJS(dist_src_exports);
  5750. // pkg/dist-src/version.js
  5751. var VERSION = "10.4.1";
  5752. // pkg/dist-src/generated/endpoints.js
  5753. var Endpoints = {
  5754. actions: {
  5755. addCustomLabelsToSelfHostedRunnerForOrg: [
  5756. "POST /orgs/{org}/actions/runners/{runner_id}/labels"
  5757. ],
  5758. addCustomLabelsToSelfHostedRunnerForRepo: [
  5759. "POST /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"
  5760. ],
  5761. addSelectedRepoToOrgSecret: [
  5762. "PUT /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}"
  5763. ],
  5764. addSelectedRepoToOrgVariable: [
  5765. "PUT /orgs/{org}/actions/variables/{name}/repositories/{repository_id}"
  5766. ],
  5767. approveWorkflowRun: [
  5768. "POST /repos/{owner}/{repo}/actions/runs/{run_id}/approve"
  5769. ],
  5770. cancelWorkflowRun: [
  5771. "POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel"
  5772. ],
  5773. createEnvironmentVariable: [
  5774. "POST /repositories/{repository_id}/environments/{environment_name}/variables"
  5775. ],
  5776. createOrUpdateEnvironmentSecret: [
  5777. "PUT /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}"
  5778. ],
  5779. createOrUpdateOrgSecret: ["PUT /orgs/{org}/actions/secrets/{secret_name}"],
  5780. createOrUpdateRepoSecret: [
  5781. "PUT /repos/{owner}/{repo}/actions/secrets/{secret_name}"
  5782. ],
  5783. createOrgVariable: ["POST /orgs/{org}/actions/variables"],
  5784. createRegistrationTokenForOrg: [
  5785. "POST /orgs/{org}/actions/runners/registration-token"
  5786. ],
  5787. createRegistrationTokenForRepo: [
  5788. "POST /repos/{owner}/{repo}/actions/runners/registration-token"
  5789. ],
  5790. createRemoveTokenForOrg: ["POST /orgs/{org}/actions/runners/remove-token"],
  5791. createRemoveTokenForRepo: [
  5792. "POST /repos/{owner}/{repo}/actions/runners/remove-token"
  5793. ],
  5794. createRepoVariable: ["POST /repos/{owner}/{repo}/actions/variables"],
  5795. createWorkflowDispatch: [
  5796. "POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches"
  5797. ],
  5798. deleteActionsCacheById: [
  5799. "DELETE /repos/{owner}/{repo}/actions/caches/{cache_id}"
  5800. ],
  5801. deleteActionsCacheByKey: [
  5802. "DELETE /repos/{owner}/{repo}/actions/caches{?key,ref}"
  5803. ],
  5804. deleteArtifact: [
  5805. "DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"
  5806. ],
  5807. deleteEnvironmentSecret: [
  5808. "DELETE /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}"
  5809. ],
  5810. deleteEnvironmentVariable: [
  5811. "DELETE /repositories/{repository_id}/environments/{environment_name}/variables/{name}"
  5812. ],
  5813. deleteOrgSecret: ["DELETE /orgs/{org}/actions/secrets/{secret_name}"],
  5814. deleteOrgVariable: ["DELETE /orgs/{org}/actions/variables/{name}"],
  5815. deleteRepoSecret: [
  5816. "DELETE /repos/{owner}/{repo}/actions/secrets/{secret_name}"
  5817. ],
  5818. deleteRepoVariable: [
  5819. "DELETE /repos/{owner}/{repo}/actions/variables/{name}"
  5820. ],
  5821. deleteSelfHostedRunnerFromOrg: [
  5822. "DELETE /orgs/{org}/actions/runners/{runner_id}"
  5823. ],
  5824. deleteSelfHostedRunnerFromRepo: [
  5825. "DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}"
  5826. ],
  5827. deleteWorkflowRun: ["DELETE /repos/{owner}/{repo}/actions/runs/{run_id}"],
  5828. deleteWorkflowRunLogs: [
  5829. "DELETE /repos/{owner}/{repo}/actions/runs/{run_id}/logs"
  5830. ],
  5831. disableSelectedRepositoryGithubActionsOrganization: [
  5832. "DELETE /orgs/{org}/actions/permissions/repositories/{repository_id}"
  5833. ],
  5834. disableWorkflow: [
  5835. "PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable"
  5836. ],
  5837. downloadArtifact: [
  5838. "GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}"
  5839. ],
  5840. downloadJobLogsForWorkflowRun: [
  5841. "GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs"
  5842. ],
  5843. downloadWorkflowRunAttemptLogs: [
  5844. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/logs"
  5845. ],
  5846. downloadWorkflowRunLogs: [
  5847. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs"
  5848. ],
  5849. enableSelectedRepositoryGithubActionsOrganization: [
  5850. "PUT /orgs/{org}/actions/permissions/repositories/{repository_id}"
  5851. ],
  5852. enableWorkflow: [
  5853. "PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable"
  5854. ],
  5855. forceCancelWorkflowRun: [
  5856. "POST /repos/{owner}/{repo}/actions/runs/{run_id}/force-cancel"
  5857. ],
  5858. generateRunnerJitconfigForOrg: [
  5859. "POST /orgs/{org}/actions/runners/generate-jitconfig"
  5860. ],
  5861. generateRunnerJitconfigForRepo: [
  5862. "POST /repos/{owner}/{repo}/actions/runners/generate-jitconfig"
  5863. ],
  5864. getActionsCacheList: ["GET /repos/{owner}/{repo}/actions/caches"],
  5865. getActionsCacheUsage: ["GET /repos/{owner}/{repo}/actions/cache/usage"],
  5866. getActionsCacheUsageByRepoForOrg: [
  5867. "GET /orgs/{org}/actions/cache/usage-by-repository"
  5868. ],
  5869. getActionsCacheUsageForOrg: ["GET /orgs/{org}/actions/cache/usage"],
  5870. getAllowedActionsOrganization: [
  5871. "GET /orgs/{org}/actions/permissions/selected-actions"
  5872. ],
  5873. getAllowedActionsRepository: [
  5874. "GET /repos/{owner}/{repo}/actions/permissions/selected-actions"
  5875. ],
  5876. getArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"],
  5877. getCustomOidcSubClaimForRepo: [
  5878. "GET /repos/{owner}/{repo}/actions/oidc/customization/sub"
  5879. ],
  5880. getEnvironmentPublicKey: [
  5881. "GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key"
  5882. ],
  5883. getEnvironmentSecret: [
  5884. "GET /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}"
  5885. ],
  5886. getEnvironmentVariable: [
  5887. "GET /repositories/{repository_id}/environments/{environment_name}/variables/{name}"
  5888. ],
  5889. getGithubActionsDefaultWorkflowPermissionsOrganization: [
  5890. "GET /orgs/{org}/actions/permissions/workflow"
  5891. ],
  5892. getGithubActionsDefaultWorkflowPermissionsRepository: [
  5893. "GET /repos/{owner}/{repo}/actions/permissions/workflow"
  5894. ],
  5895. getGithubActionsPermissionsOrganization: [
  5896. "GET /orgs/{org}/actions/permissions"
  5897. ],
  5898. getGithubActionsPermissionsRepository: [
  5899. "GET /repos/{owner}/{repo}/actions/permissions"
  5900. ],
  5901. getJobForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/jobs/{job_id}"],
  5902. getOrgPublicKey: ["GET /orgs/{org}/actions/secrets/public-key"],
  5903. getOrgSecret: ["GET /orgs/{org}/actions/secrets/{secret_name}"],
  5904. getOrgVariable: ["GET /orgs/{org}/actions/variables/{name}"],
  5905. getPendingDeploymentsForRun: [
  5906. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments"
  5907. ],
  5908. getRepoPermissions: [
  5909. "GET /repos/{owner}/{repo}/actions/permissions",
  5910. {},
  5911. { renamed: ["actions", "getGithubActionsPermissionsRepository"] }
  5912. ],
  5913. getRepoPublicKey: ["GET /repos/{owner}/{repo}/actions/secrets/public-key"],
  5914. getRepoSecret: ["GET /repos/{owner}/{repo}/actions/secrets/{secret_name}"],
  5915. getRepoVariable: ["GET /repos/{owner}/{repo}/actions/variables/{name}"],
  5916. getReviewsForRun: [
  5917. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/approvals"
  5918. ],
  5919. getSelfHostedRunnerForOrg: ["GET /orgs/{org}/actions/runners/{runner_id}"],
  5920. getSelfHostedRunnerForRepo: [
  5921. "GET /repos/{owner}/{repo}/actions/runners/{runner_id}"
  5922. ],
  5923. getWorkflow: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}"],
  5924. getWorkflowAccessToRepository: [
  5925. "GET /repos/{owner}/{repo}/actions/permissions/access"
  5926. ],
  5927. getWorkflowRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}"],
  5928. getWorkflowRunAttempt: [
  5929. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}"
  5930. ],
  5931. getWorkflowRunUsage: [
  5932. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/timing"
  5933. ],
  5934. getWorkflowUsage: [
  5935. "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing"
  5936. ],
  5937. listArtifactsForRepo: ["GET /repos/{owner}/{repo}/actions/artifacts"],
  5938. listEnvironmentSecrets: [
  5939. "GET /repositories/{repository_id}/environments/{environment_name}/secrets"
  5940. ],
  5941. listEnvironmentVariables: [
  5942. "GET /repositories/{repository_id}/environments/{environment_name}/variables"
  5943. ],
  5944. listJobsForWorkflowRun: [
  5945. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs"
  5946. ],
  5947. listJobsForWorkflowRunAttempt: [
  5948. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs"
  5949. ],
  5950. listLabelsForSelfHostedRunnerForOrg: [
  5951. "GET /orgs/{org}/actions/runners/{runner_id}/labels"
  5952. ],
  5953. listLabelsForSelfHostedRunnerForRepo: [
  5954. "GET /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"
  5955. ],
  5956. listOrgSecrets: ["GET /orgs/{org}/actions/secrets"],
  5957. listOrgVariables: ["GET /orgs/{org}/actions/variables"],
  5958. listRepoOrganizationSecrets: [
  5959. "GET /repos/{owner}/{repo}/actions/organization-secrets"
  5960. ],
  5961. listRepoOrganizationVariables: [
  5962. "GET /repos/{owner}/{repo}/actions/organization-variables"
  5963. ],
  5964. listRepoSecrets: ["GET /repos/{owner}/{repo}/actions/secrets"],
  5965. listRepoVariables: ["GET /repos/{owner}/{repo}/actions/variables"],
  5966. listRepoWorkflows: ["GET /repos/{owner}/{repo}/actions/workflows"],
  5967. listRunnerApplicationsForOrg: ["GET /orgs/{org}/actions/runners/downloads"],
  5968. listRunnerApplicationsForRepo: [
  5969. "GET /repos/{owner}/{repo}/actions/runners/downloads"
  5970. ],
  5971. listSelectedReposForOrgSecret: [
  5972. "GET /orgs/{org}/actions/secrets/{secret_name}/repositories"
  5973. ],
  5974. listSelectedReposForOrgVariable: [
  5975. "GET /orgs/{org}/actions/variables/{name}/repositories"
  5976. ],
  5977. listSelectedRepositoriesEnabledGithubActionsOrganization: [
  5978. "GET /orgs/{org}/actions/permissions/repositories"
  5979. ],
  5980. listSelfHostedRunnersForOrg: ["GET /orgs/{org}/actions/runners"],
  5981. listSelfHostedRunnersForRepo: ["GET /repos/{owner}/{repo}/actions/runners"],
  5982. listWorkflowRunArtifacts: [
  5983. "GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts"
  5984. ],
  5985. listWorkflowRuns: [
  5986. "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs"
  5987. ],
  5988. listWorkflowRunsForRepo: ["GET /repos/{owner}/{repo}/actions/runs"],
  5989. reRunJobForWorkflowRun: [
  5990. "POST /repos/{owner}/{repo}/actions/jobs/{job_id}/rerun"
  5991. ],
  5992. reRunWorkflow: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun"],
  5993. reRunWorkflowFailedJobs: [
  5994. "POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun-failed-jobs"
  5995. ],
  5996. removeAllCustomLabelsFromSelfHostedRunnerForOrg: [
  5997. "DELETE /orgs/{org}/actions/runners/{runner_id}/labels"
  5998. ],
  5999. removeAllCustomLabelsFromSelfHostedRunnerForRepo: [
  6000. "DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"
  6001. ],
  6002. removeCustomLabelFromSelfHostedRunnerForOrg: [
  6003. "DELETE /orgs/{org}/actions/runners/{runner_id}/labels/{name}"
  6004. ],
  6005. removeCustomLabelFromSelfHostedRunnerForRepo: [
  6006. "DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}/labels/{name}"
  6007. ],
  6008. removeSelectedRepoFromOrgSecret: [
  6009. "DELETE /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}"
  6010. ],
  6011. removeSelectedRepoFromOrgVariable: [
  6012. "DELETE /orgs/{org}/actions/variables/{name}/repositories/{repository_id}"
  6013. ],
  6014. reviewCustomGatesForRun: [
  6015. "POST /repos/{owner}/{repo}/actions/runs/{run_id}/deployment_protection_rule"
  6016. ],
  6017. reviewPendingDeploymentsForRun: [
  6018. "POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments"
  6019. ],
  6020. setAllowedActionsOrganization: [
  6021. "PUT /orgs/{org}/actions/permissions/selected-actions"
  6022. ],
  6023. setAllowedActionsRepository: [
  6024. "PUT /repos/{owner}/{repo}/actions/permissions/selected-actions"
  6025. ],
  6026. setCustomLabelsForSelfHostedRunnerForOrg: [
  6027. "PUT /orgs/{org}/actions/runners/{runner_id}/labels"
  6028. ],
  6029. setCustomLabelsForSelfHostedRunnerForRepo: [
  6030. "PUT /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"
  6031. ],
  6032. setCustomOidcSubClaimForRepo: [
  6033. "PUT /repos/{owner}/{repo}/actions/oidc/customization/sub"
  6034. ],
  6035. setGithubActionsDefaultWorkflowPermissionsOrganization: [
  6036. "PUT /orgs/{org}/actions/permissions/workflow"
  6037. ],
  6038. setGithubActionsDefaultWorkflowPermissionsRepository: [
  6039. "PUT /repos/{owner}/{repo}/actions/permissions/workflow"
  6040. ],
  6041. setGithubActionsPermissionsOrganization: [
  6042. "PUT /orgs/{org}/actions/permissions"
  6043. ],
  6044. setGithubActionsPermissionsRepository: [
  6045. "PUT /repos/{owner}/{repo}/actions/permissions"
  6046. ],
  6047. setSelectedReposForOrgSecret: [
  6048. "PUT /orgs/{org}/actions/secrets/{secret_name}/repositories"
  6049. ],
  6050. setSelectedReposForOrgVariable: [
  6051. "PUT /orgs/{org}/actions/variables/{name}/repositories"
  6052. ],
  6053. setSelectedRepositoriesEnabledGithubActionsOrganization: [
  6054. "PUT /orgs/{org}/actions/permissions/repositories"
  6055. ],
  6056. setWorkflowAccessToRepository: [
  6057. "PUT /repos/{owner}/{repo}/actions/permissions/access"
  6058. ],
  6059. updateEnvironmentVariable: [
  6060. "PATCH /repositories/{repository_id}/environments/{environment_name}/variables/{name}"
  6061. ],
  6062. updateOrgVariable: ["PATCH /orgs/{org}/actions/variables/{name}"],
  6063. updateRepoVariable: [
  6064. "PATCH /repos/{owner}/{repo}/actions/variables/{name}"
  6065. ]
  6066. },
  6067. activity: {
  6068. checkRepoIsStarredByAuthenticatedUser: ["GET /user/starred/{owner}/{repo}"],
  6069. deleteRepoSubscription: ["DELETE /repos/{owner}/{repo}/subscription"],
  6070. deleteThreadSubscription: [
  6071. "DELETE /notifications/threads/{thread_id}/subscription"
  6072. ],
  6073. getFeeds: ["GET /feeds"],
  6074. getRepoSubscription: ["GET /repos/{owner}/{repo}/subscription"],
  6075. getThread: ["GET /notifications/threads/{thread_id}"],
  6076. getThreadSubscriptionForAuthenticatedUser: [
  6077. "GET /notifications/threads/{thread_id}/subscription"
  6078. ],
  6079. listEventsForAuthenticatedUser: ["GET /users/{username}/events"],
  6080. listNotificationsForAuthenticatedUser: ["GET /notifications"],
  6081. listOrgEventsForAuthenticatedUser: [
  6082. "GET /users/{username}/events/orgs/{org}"
  6083. ],
  6084. listPublicEvents: ["GET /events"],
  6085. listPublicEventsForRepoNetwork: ["GET /networks/{owner}/{repo}/events"],
  6086. listPublicEventsForUser: ["GET /users/{username}/events/public"],
  6087. listPublicOrgEvents: ["GET /orgs/{org}/events"],
  6088. listReceivedEventsForUser: ["GET /users/{username}/received_events"],
  6089. listReceivedPublicEventsForUser: [
  6090. "GET /users/{username}/received_events/public"
  6091. ],
  6092. listRepoEvents: ["GET /repos/{owner}/{repo}/events"],
  6093. listRepoNotificationsForAuthenticatedUser: [
  6094. "GET /repos/{owner}/{repo}/notifications"
  6095. ],
  6096. listReposStarredByAuthenticatedUser: ["GET /user/starred"],
  6097. listReposStarredByUser: ["GET /users/{username}/starred"],
  6098. listReposWatchedByUser: ["GET /users/{username}/subscriptions"],
  6099. listStargazersForRepo: ["GET /repos/{owner}/{repo}/stargazers"],
  6100. listWatchedReposForAuthenticatedUser: ["GET /user/subscriptions"],
  6101. listWatchersForRepo: ["GET /repos/{owner}/{repo}/subscribers"],
  6102. markNotificationsAsRead: ["PUT /notifications"],
  6103. markRepoNotificationsAsRead: ["PUT /repos/{owner}/{repo}/notifications"],
  6104. markThreadAsDone: ["DELETE /notifications/threads/{thread_id}"],
  6105. markThreadAsRead: ["PATCH /notifications/threads/{thread_id}"],
  6106. setRepoSubscription: ["PUT /repos/{owner}/{repo}/subscription"],
  6107. setThreadSubscription: [
  6108. "PUT /notifications/threads/{thread_id}/subscription"
  6109. ],
  6110. starRepoForAuthenticatedUser: ["PUT /user/starred/{owner}/{repo}"],
  6111. unstarRepoForAuthenticatedUser: ["DELETE /user/starred/{owner}/{repo}"]
  6112. },
  6113. apps: {
  6114. addRepoToInstallation: [
  6115. "PUT /user/installations/{installation_id}/repositories/{repository_id}",
  6116. {},
  6117. { renamed: ["apps", "addRepoToInstallationForAuthenticatedUser"] }
  6118. ],
  6119. addRepoToInstallationForAuthenticatedUser: [
  6120. "PUT /user/installations/{installation_id}/repositories/{repository_id}"
  6121. ],
  6122. checkToken: ["POST /applications/{client_id}/token"],
  6123. createFromManifest: ["POST /app-manifests/{code}/conversions"],
  6124. createInstallationAccessToken: [
  6125. "POST /app/installations/{installation_id}/access_tokens"
  6126. ],
  6127. deleteAuthorization: ["DELETE /applications/{client_id}/grant"],
  6128. deleteInstallation: ["DELETE /app/installations/{installation_id}"],
  6129. deleteToken: ["DELETE /applications/{client_id}/token"],
  6130. getAuthenticated: ["GET /app"],
  6131. getBySlug: ["GET /apps/{app_slug}"],
  6132. getInstallation: ["GET /app/installations/{installation_id}"],
  6133. getOrgInstallation: ["GET /orgs/{org}/installation"],
  6134. getRepoInstallation: ["GET /repos/{owner}/{repo}/installation"],
  6135. getSubscriptionPlanForAccount: [
  6136. "GET /marketplace_listing/accounts/{account_id}"
  6137. ],
  6138. getSubscriptionPlanForAccountStubbed: [
  6139. "GET /marketplace_listing/stubbed/accounts/{account_id}"
  6140. ],
  6141. getUserInstallation: ["GET /users/{username}/installation"],
  6142. getWebhookConfigForApp: ["GET /app/hook/config"],
  6143. getWebhookDelivery: ["GET /app/hook/deliveries/{delivery_id}"],
  6144. listAccountsForPlan: ["GET /marketplace_listing/plans/{plan_id}/accounts"],
  6145. listAccountsForPlanStubbed: [
  6146. "GET /marketplace_listing/stubbed/plans/{plan_id}/accounts"
  6147. ],
  6148. listInstallationReposForAuthenticatedUser: [
  6149. "GET /user/installations/{installation_id}/repositories"
  6150. ],
  6151. listInstallationRequestsForAuthenticatedApp: [
  6152. "GET /app/installation-requests"
  6153. ],
  6154. listInstallations: ["GET /app/installations"],
  6155. listInstallationsForAuthenticatedUser: ["GET /user/installations"],
  6156. listPlans: ["GET /marketplace_listing/plans"],
  6157. listPlansStubbed: ["GET /marketplace_listing/stubbed/plans"],
  6158. listReposAccessibleToInstallation: ["GET /installation/repositories"],
  6159. listSubscriptionsForAuthenticatedUser: ["GET /user/marketplace_purchases"],
  6160. listSubscriptionsForAuthenticatedUserStubbed: [
  6161. "GET /user/marketplace_purchases/stubbed"
  6162. ],
  6163. listWebhookDeliveries: ["GET /app/hook/deliveries"],
  6164. redeliverWebhookDelivery: [
  6165. "POST /app/hook/deliveries/{delivery_id}/attempts"
  6166. ],
  6167. removeRepoFromInstallation: [
  6168. "DELETE /user/installations/{installation_id}/repositories/{repository_id}",
  6169. {},
  6170. { renamed: ["apps", "removeRepoFromInstallationForAuthenticatedUser"] }
  6171. ],
  6172. removeRepoFromInstallationForAuthenticatedUser: [
  6173. "DELETE /user/installations/{installation_id}/repositories/{repository_id}"
  6174. ],
  6175. resetToken: ["PATCH /applications/{client_id}/token"],
  6176. revokeInstallationAccessToken: ["DELETE /installation/token"],
  6177. scopeToken: ["POST /applications/{client_id}/token/scoped"],
  6178. suspendInstallation: ["PUT /app/installations/{installation_id}/suspended"],
  6179. unsuspendInstallation: [
  6180. "DELETE /app/installations/{installation_id}/suspended"
  6181. ],
  6182. updateWebhookConfigForApp: ["PATCH /app/hook/config"]
  6183. },
  6184. billing: {
  6185. getGithubActionsBillingOrg: ["GET /orgs/{org}/settings/billing/actions"],
  6186. getGithubActionsBillingUser: [
  6187. "GET /users/{username}/settings/billing/actions"
  6188. ],
  6189. getGithubPackagesBillingOrg: ["GET /orgs/{org}/settings/billing/packages"],
  6190. getGithubPackagesBillingUser: [
  6191. "GET /users/{username}/settings/billing/packages"
  6192. ],
  6193. getSharedStorageBillingOrg: [
  6194. "GET /orgs/{org}/settings/billing/shared-storage"
  6195. ],
  6196. getSharedStorageBillingUser: [
  6197. "GET /users/{username}/settings/billing/shared-storage"
  6198. ]
  6199. },
  6200. checks: {
  6201. create: ["POST /repos/{owner}/{repo}/check-runs"],
  6202. createSuite: ["POST /repos/{owner}/{repo}/check-suites"],
  6203. get: ["GET /repos/{owner}/{repo}/check-runs/{check_run_id}"],
  6204. getSuite: ["GET /repos/{owner}/{repo}/check-suites/{check_suite_id}"],
  6205. listAnnotations: [
  6206. "GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations"
  6207. ],
  6208. listForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/check-runs"],
  6209. listForSuite: [
  6210. "GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs"
  6211. ],
  6212. listSuitesForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/check-suites"],
  6213. rerequestRun: [
  6214. "POST /repos/{owner}/{repo}/check-runs/{check_run_id}/rerequest"
  6215. ],
  6216. rerequestSuite: [
  6217. "POST /repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest"
  6218. ],
  6219. setSuitesPreferences: [
  6220. "PATCH /repos/{owner}/{repo}/check-suites/preferences"
  6221. ],
  6222. update: ["PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}"]
  6223. },
  6224. codeScanning: {
  6225. deleteAnalysis: [
  6226. "DELETE /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id}{?confirm_delete}"
  6227. ],
  6228. getAlert: [
  6229. "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}",
  6230. {},
  6231. { renamedParameters: { alert_id: "alert_number" } }
  6232. ],
  6233. getAnalysis: [
  6234. "GET /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id}"
  6235. ],
  6236. getCodeqlDatabase: [
  6237. "GET /repos/{owner}/{repo}/code-scanning/codeql/databases/{language}"
  6238. ],
  6239. getDefaultSetup: ["GET /repos/{owner}/{repo}/code-scanning/default-setup"],
  6240. getSarif: ["GET /repos/{owner}/{repo}/code-scanning/sarifs/{sarif_id}"],
  6241. listAlertInstances: [
  6242. "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances"
  6243. ],
  6244. listAlertsForOrg: ["GET /orgs/{org}/code-scanning/alerts"],
  6245. listAlertsForRepo: ["GET /repos/{owner}/{repo}/code-scanning/alerts"],
  6246. listAlertsInstances: [
  6247. "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances",
  6248. {},
  6249. { renamed: ["codeScanning", "listAlertInstances"] }
  6250. ],
  6251. listCodeqlDatabases: [
  6252. "GET /repos/{owner}/{repo}/code-scanning/codeql/databases"
  6253. ],
  6254. listRecentAnalyses: ["GET /repos/{owner}/{repo}/code-scanning/analyses"],
  6255. updateAlert: [
  6256. "PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}"
  6257. ],
  6258. updateDefaultSetup: [
  6259. "PATCH /repos/{owner}/{repo}/code-scanning/default-setup"
  6260. ],
  6261. uploadSarif: ["POST /repos/{owner}/{repo}/code-scanning/sarifs"]
  6262. },
  6263. codesOfConduct: {
  6264. getAllCodesOfConduct: ["GET /codes_of_conduct"],
  6265. getConductCode: ["GET /codes_of_conduct/{key}"]
  6266. },
  6267. codespaces: {
  6268. addRepositoryForSecretForAuthenticatedUser: [
  6269. "PUT /user/codespaces/secrets/{secret_name}/repositories/{repository_id}"
  6270. ],
  6271. addSelectedRepoToOrgSecret: [
  6272. "PUT /orgs/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id}"
  6273. ],
  6274. checkPermissionsForDevcontainer: [
  6275. "GET /repos/{owner}/{repo}/codespaces/permissions_check"
  6276. ],
  6277. codespaceMachinesForAuthenticatedUser: [
  6278. "GET /user/codespaces/{codespace_name}/machines"
  6279. ],
  6280. createForAuthenticatedUser: ["POST /user/codespaces"],
  6281. createOrUpdateOrgSecret: [
  6282. "PUT /orgs/{org}/codespaces/secrets/{secret_name}"
  6283. ],
  6284. createOrUpdateRepoSecret: [
  6285. "PUT /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"
  6286. ],
  6287. createOrUpdateSecretForAuthenticatedUser: [
  6288. "PUT /user/codespaces/secrets/{secret_name}"
  6289. ],
  6290. createWithPrForAuthenticatedUser: [
  6291. "POST /repos/{owner}/{repo}/pulls/{pull_number}/codespaces"
  6292. ],
  6293. createWithRepoForAuthenticatedUser: [
  6294. "POST /repos/{owner}/{repo}/codespaces"
  6295. ],
  6296. deleteForAuthenticatedUser: ["DELETE /user/codespaces/{codespace_name}"],
  6297. deleteFromOrganization: [
  6298. "DELETE /orgs/{org}/members/{username}/codespaces/{codespace_name}"
  6299. ],
  6300. deleteOrgSecret: ["DELETE /orgs/{org}/codespaces/secrets/{secret_name}"],
  6301. deleteRepoSecret: [
  6302. "DELETE /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"
  6303. ],
  6304. deleteSecretForAuthenticatedUser: [
  6305. "DELETE /user/codespaces/secrets/{secret_name}"
  6306. ],
  6307. exportForAuthenticatedUser: [
  6308. "POST /user/codespaces/{codespace_name}/exports"
  6309. ],
  6310. getCodespacesForUserInOrg: [
  6311. "GET /orgs/{org}/members/{username}/codespaces"
  6312. ],
  6313. getExportDetailsForAuthenticatedUser: [
  6314. "GET /user/codespaces/{codespace_name}/exports/{export_id}"
  6315. ],
  6316. getForAuthenticatedUser: ["GET /user/codespaces/{codespace_name}"],
  6317. getOrgPublicKey: ["GET /orgs/{org}/codespaces/secrets/public-key"],
  6318. getOrgSecret: ["GET /orgs/{org}/codespaces/secrets/{secret_name}"],
  6319. getPublicKeyForAuthenticatedUser: [
  6320. "GET /user/codespaces/secrets/public-key"
  6321. ],
  6322. getRepoPublicKey: [
  6323. "GET /repos/{owner}/{repo}/codespaces/secrets/public-key"
  6324. ],
  6325. getRepoSecret: [
  6326. "GET /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"
  6327. ],
  6328. getSecretForAuthenticatedUser: [
  6329. "GET /user/codespaces/secrets/{secret_name}"
  6330. ],
  6331. listDevcontainersInRepositoryForAuthenticatedUser: [
  6332. "GET /repos/{owner}/{repo}/codespaces/devcontainers"
  6333. ],
  6334. listForAuthenticatedUser: ["GET /user/codespaces"],
  6335. listInOrganization: [
  6336. "GET /orgs/{org}/codespaces",
  6337. {},
  6338. { renamedParameters: { org_id: "org" } }
  6339. ],
  6340. listInRepositoryForAuthenticatedUser: [
  6341. "GET /repos/{owner}/{repo}/codespaces"
  6342. ],
  6343. listOrgSecrets: ["GET /orgs/{org}/codespaces/secrets"],
  6344. listRepoSecrets: ["GET /repos/{owner}/{repo}/codespaces/secrets"],
  6345. listRepositoriesForSecretForAuthenticatedUser: [
  6346. "GET /user/codespaces/secrets/{secret_name}/repositories"
  6347. ],
  6348. listSecretsForAuthenticatedUser: ["GET /user/codespaces/secrets"],
  6349. listSelectedReposForOrgSecret: [
  6350. "GET /orgs/{org}/codespaces/secrets/{secret_name}/repositories"
  6351. ],
  6352. preFlightWithRepoForAuthenticatedUser: [
  6353. "GET /repos/{owner}/{repo}/codespaces/new"
  6354. ],
  6355. publishForAuthenticatedUser: [
  6356. "POST /user/codespaces/{codespace_name}/publish"
  6357. ],
  6358. removeRepositoryForSecretForAuthenticatedUser: [
  6359. "DELETE /user/codespaces/secrets/{secret_name}/repositories/{repository_id}"
  6360. ],
  6361. removeSelectedRepoFromOrgSecret: [
  6362. "DELETE /orgs/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id}"
  6363. ],
  6364. repoMachinesForAuthenticatedUser: [
  6365. "GET /repos/{owner}/{repo}/codespaces/machines"
  6366. ],
  6367. setRepositoriesForSecretForAuthenticatedUser: [
  6368. "PUT /user/codespaces/secrets/{secret_name}/repositories"
  6369. ],
  6370. setSelectedReposForOrgSecret: [
  6371. "PUT /orgs/{org}/codespaces/secrets/{secret_name}/repositories"
  6372. ],
  6373. startForAuthenticatedUser: ["POST /user/codespaces/{codespace_name}/start"],
  6374. stopForAuthenticatedUser: ["POST /user/codespaces/{codespace_name}/stop"],
  6375. stopInOrganization: [
  6376. "POST /orgs/{org}/members/{username}/codespaces/{codespace_name}/stop"
  6377. ],
  6378. updateForAuthenticatedUser: ["PATCH /user/codespaces/{codespace_name}"]
  6379. },
  6380. copilot: {
  6381. addCopilotSeatsForTeams: [
  6382. "POST /orgs/{org}/copilot/billing/selected_teams"
  6383. ],
  6384. addCopilotSeatsForUsers: [
  6385. "POST /orgs/{org}/copilot/billing/selected_users"
  6386. ],
  6387. cancelCopilotSeatAssignmentForTeams: [
  6388. "DELETE /orgs/{org}/copilot/billing/selected_teams"
  6389. ],
  6390. cancelCopilotSeatAssignmentForUsers: [
  6391. "DELETE /orgs/{org}/copilot/billing/selected_users"
  6392. ],
  6393. getCopilotOrganizationDetails: ["GET /orgs/{org}/copilot/billing"],
  6394. getCopilotSeatDetailsForUser: [
  6395. "GET /orgs/{org}/members/{username}/copilot"
  6396. ],
  6397. listCopilotSeats: ["GET /orgs/{org}/copilot/billing/seats"]
  6398. },
  6399. dependabot: {
  6400. addSelectedRepoToOrgSecret: [
  6401. "PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id}"
  6402. ],
  6403. createOrUpdateOrgSecret: [
  6404. "PUT /orgs/{org}/dependabot/secrets/{secret_name}"
  6405. ],
  6406. createOrUpdateRepoSecret: [
  6407. "PUT /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"
  6408. ],
  6409. deleteOrgSecret: ["DELETE /orgs/{org}/dependabot/secrets/{secret_name}"],
  6410. deleteRepoSecret: [
  6411. "DELETE /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"
  6412. ],
  6413. getAlert: ["GET /repos/{owner}/{repo}/dependabot/alerts/{alert_number}"],
  6414. getOrgPublicKey: ["GET /orgs/{org}/dependabot/secrets/public-key"],
  6415. getOrgSecret: ["GET /orgs/{org}/dependabot/secrets/{secret_name}"],
  6416. getRepoPublicKey: [
  6417. "GET /repos/{owner}/{repo}/dependabot/secrets/public-key"
  6418. ],
  6419. getRepoSecret: [
  6420. "GET /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"
  6421. ],
  6422. listAlertsForEnterprise: [
  6423. "GET /enterprises/{enterprise}/dependabot/alerts"
  6424. ],
  6425. listAlertsForOrg: ["GET /orgs/{org}/dependabot/alerts"],
  6426. listAlertsForRepo: ["GET /repos/{owner}/{repo}/dependabot/alerts"],
  6427. listOrgSecrets: ["GET /orgs/{org}/dependabot/secrets"],
  6428. listRepoSecrets: ["GET /repos/{owner}/{repo}/dependabot/secrets"],
  6429. listSelectedReposForOrgSecret: [
  6430. "GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories"
  6431. ],
  6432. removeSelectedRepoFromOrgSecret: [
  6433. "DELETE /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id}"
  6434. ],
  6435. setSelectedReposForOrgSecret: [
  6436. "PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories"
  6437. ],
  6438. updateAlert: [
  6439. "PATCH /repos/{owner}/{repo}/dependabot/alerts/{alert_number}"
  6440. ]
  6441. },
  6442. dependencyGraph: {
  6443. createRepositorySnapshot: [
  6444. "POST /repos/{owner}/{repo}/dependency-graph/snapshots"
  6445. ],
  6446. diffRange: [
  6447. "GET /repos/{owner}/{repo}/dependency-graph/compare/{basehead}"
  6448. ],
  6449. exportSbom: ["GET /repos/{owner}/{repo}/dependency-graph/sbom"]
  6450. },
  6451. emojis: { get: ["GET /emojis"] },
  6452. gists: {
  6453. checkIsStarred: ["GET /gists/{gist_id}/star"],
  6454. create: ["POST /gists"],
  6455. createComment: ["POST /gists/{gist_id}/comments"],
  6456. delete: ["DELETE /gists/{gist_id}"],
  6457. deleteComment: ["DELETE /gists/{gist_id}/comments/{comment_id}"],
  6458. fork: ["POST /gists/{gist_id}/forks"],
  6459. get: ["GET /gists/{gist_id}"],
  6460. getComment: ["GET /gists/{gist_id}/comments/{comment_id}"],
  6461. getRevision: ["GET /gists/{gist_id}/{sha}"],
  6462. list: ["GET /gists"],
  6463. listComments: ["GET /gists/{gist_id}/comments"],
  6464. listCommits: ["GET /gists/{gist_id}/commits"],
  6465. listForUser: ["GET /users/{username}/gists"],
  6466. listForks: ["GET /gists/{gist_id}/forks"],
  6467. listPublic: ["GET /gists/public"],
  6468. listStarred: ["GET /gists/starred"],
  6469. star: ["PUT /gists/{gist_id}/star"],
  6470. unstar: ["DELETE /gists/{gist_id}/star"],
  6471. update: ["PATCH /gists/{gist_id}"],
  6472. updateComment: ["PATCH /gists/{gist_id}/comments/{comment_id}"]
  6473. },
  6474. git: {
  6475. createBlob: ["POST /repos/{owner}/{repo}/git/blobs"],
  6476. createCommit: ["POST /repos/{owner}/{repo}/git/commits"],
  6477. createRef: ["POST /repos/{owner}/{repo}/git/refs"],
  6478. createTag: ["POST /repos/{owner}/{repo}/git/tags"],
  6479. createTree: ["POST /repos/{owner}/{repo}/git/trees"],
  6480. deleteRef: ["DELETE /repos/{owner}/{repo}/git/refs/{ref}"],
  6481. getBlob: ["GET /repos/{owner}/{repo}/git/blobs/{file_sha}"],
  6482. getCommit: ["GET /repos/{owner}/{repo}/git/commits/{commit_sha}"],
  6483. getRef: ["GET /repos/{owner}/{repo}/git/ref/{ref}"],
  6484. getTag: ["GET /repos/{owner}/{repo}/git/tags/{tag_sha}"],
  6485. getTree: ["GET /repos/{owner}/{repo}/git/trees/{tree_sha}"],
  6486. listMatchingRefs: ["GET /repos/{owner}/{repo}/git/matching-refs/{ref}"],
  6487. updateRef: ["PATCH /repos/{owner}/{repo}/git/refs/{ref}"]
  6488. },
  6489. gitignore: {
  6490. getAllTemplates: ["GET /gitignore/templates"],
  6491. getTemplate: ["GET /gitignore/templates/{name}"]
  6492. },
  6493. interactions: {
  6494. getRestrictionsForAuthenticatedUser: ["GET /user/interaction-limits"],
  6495. getRestrictionsForOrg: ["GET /orgs/{org}/interaction-limits"],
  6496. getRestrictionsForRepo: ["GET /repos/{owner}/{repo}/interaction-limits"],
  6497. getRestrictionsForYourPublicRepos: [
  6498. "GET /user/interaction-limits",
  6499. {},
  6500. { renamed: ["interactions", "getRestrictionsForAuthenticatedUser"] }
  6501. ],
  6502. removeRestrictionsForAuthenticatedUser: ["DELETE /user/interaction-limits"],
  6503. removeRestrictionsForOrg: ["DELETE /orgs/{org}/interaction-limits"],
  6504. removeRestrictionsForRepo: [
  6505. "DELETE /repos/{owner}/{repo}/interaction-limits"
  6506. ],
  6507. removeRestrictionsForYourPublicRepos: [
  6508. "DELETE /user/interaction-limits",
  6509. {},
  6510. { renamed: ["interactions", "removeRestrictionsForAuthenticatedUser"] }
  6511. ],
  6512. setRestrictionsForAuthenticatedUser: ["PUT /user/interaction-limits"],
  6513. setRestrictionsForOrg: ["PUT /orgs/{org}/interaction-limits"],
  6514. setRestrictionsForRepo: ["PUT /repos/{owner}/{repo}/interaction-limits"],
  6515. setRestrictionsForYourPublicRepos: [
  6516. "PUT /user/interaction-limits",
  6517. {},
  6518. { renamed: ["interactions", "setRestrictionsForAuthenticatedUser"] }
  6519. ]
  6520. },
  6521. issues: {
  6522. addAssignees: [
  6523. "POST /repos/{owner}/{repo}/issues/{issue_number}/assignees"
  6524. ],
  6525. addLabels: ["POST /repos/{owner}/{repo}/issues/{issue_number}/labels"],
  6526. checkUserCanBeAssigned: ["GET /repos/{owner}/{repo}/assignees/{assignee}"],
  6527. checkUserCanBeAssignedToIssue: [
  6528. "GET /repos/{owner}/{repo}/issues/{issue_number}/assignees/{assignee}"
  6529. ],
  6530. create: ["POST /repos/{owner}/{repo}/issues"],
  6531. createComment: [
  6532. "POST /repos/{owner}/{repo}/issues/{issue_number}/comments"
  6533. ],
  6534. createLabel: ["POST /repos/{owner}/{repo}/labels"],
  6535. createMilestone: ["POST /repos/{owner}/{repo}/milestones"],
  6536. deleteComment: [
  6537. "DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}"
  6538. ],
  6539. deleteLabel: ["DELETE /repos/{owner}/{repo}/labels/{name}"],
  6540. deleteMilestone: [
  6541. "DELETE /repos/{owner}/{repo}/milestones/{milestone_number}"
  6542. ],
  6543. get: ["GET /repos/{owner}/{repo}/issues/{issue_number}"],
  6544. getComment: ["GET /repos/{owner}/{repo}/issues/comments/{comment_id}"],
  6545. getEvent: ["GET /repos/{owner}/{repo}/issues/events/{event_id}"],
  6546. getLabel: ["GET /repos/{owner}/{repo}/labels/{name}"],
  6547. getMilestone: ["GET /repos/{owner}/{repo}/milestones/{milestone_number}"],
  6548. list: ["GET /issues"],
  6549. listAssignees: ["GET /repos/{owner}/{repo}/assignees"],
  6550. listComments: ["GET /repos/{owner}/{repo}/issues/{issue_number}/comments"],
  6551. listCommentsForRepo: ["GET /repos/{owner}/{repo}/issues/comments"],
  6552. listEvents: ["GET /repos/{owner}/{repo}/issues/{issue_number}/events"],
  6553. listEventsForRepo: ["GET /repos/{owner}/{repo}/issues/events"],
  6554. listEventsForTimeline: [
  6555. "GET /repos/{owner}/{repo}/issues/{issue_number}/timeline"
  6556. ],
  6557. listForAuthenticatedUser: ["GET /user/issues"],
  6558. listForOrg: ["GET /orgs/{org}/issues"],
  6559. listForRepo: ["GET /repos/{owner}/{repo}/issues"],
  6560. listLabelsForMilestone: [
  6561. "GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels"
  6562. ],
  6563. listLabelsForRepo: ["GET /repos/{owner}/{repo}/labels"],
  6564. listLabelsOnIssue: [
  6565. "GET /repos/{owner}/{repo}/issues/{issue_number}/labels"
  6566. ],
  6567. listMilestones: ["GET /repos/{owner}/{repo}/milestones"],
  6568. lock: ["PUT /repos/{owner}/{repo}/issues/{issue_number}/lock"],
  6569. removeAllLabels: [
  6570. "DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels"
  6571. ],
  6572. removeAssignees: [
  6573. "DELETE /repos/{owner}/{repo}/issues/{issue_number}/assignees"
  6574. ],
  6575. removeLabel: [
  6576. "DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name}"
  6577. ],
  6578. setLabels: ["PUT /repos/{owner}/{repo}/issues/{issue_number}/labels"],
  6579. unlock: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock"],
  6580. update: ["PATCH /repos/{owner}/{repo}/issues/{issue_number}"],
  6581. updateComment: ["PATCH /repos/{owner}/{repo}/issues/comments/{comment_id}"],
  6582. updateLabel: ["PATCH /repos/{owner}/{repo}/labels/{name}"],
  6583. updateMilestone: [
  6584. "PATCH /repos/{owner}/{repo}/milestones/{milestone_number}"
  6585. ]
  6586. },
  6587. licenses: {
  6588. get: ["GET /licenses/{license}"],
  6589. getAllCommonlyUsed: ["GET /licenses"],
  6590. getForRepo: ["GET /repos/{owner}/{repo}/license"]
  6591. },
  6592. markdown: {
  6593. render: ["POST /markdown"],
  6594. renderRaw: [
  6595. "POST /markdown/raw",
  6596. { headers: { "content-type": "text/plain; charset=utf-8" } }
  6597. ]
  6598. },
  6599. meta: {
  6600. get: ["GET /meta"],
  6601. getAllVersions: ["GET /versions"],
  6602. getOctocat: ["GET /octocat"],
  6603. getZen: ["GET /zen"],
  6604. root: ["GET /"]
  6605. },
  6606. migrations: {
  6607. cancelImport: [
  6608. "DELETE /repos/{owner}/{repo}/import",
  6609. {},
  6610. {
  6611. deprecated: "octokit.rest.migrations.cancelImport() is deprecated, see https://docs.github.com/rest/migrations/source-imports#cancel-an-import"
  6612. }
  6613. ],
  6614. deleteArchiveForAuthenticatedUser: [
  6615. "DELETE /user/migrations/{migration_id}/archive"
  6616. ],
  6617. deleteArchiveForOrg: [
  6618. "DELETE /orgs/{org}/migrations/{migration_id}/archive"
  6619. ],
  6620. downloadArchiveForOrg: [
  6621. "GET /orgs/{org}/migrations/{migration_id}/archive"
  6622. ],
  6623. getArchiveForAuthenticatedUser: [
  6624. "GET /user/migrations/{migration_id}/archive"
  6625. ],
  6626. getCommitAuthors: [
  6627. "GET /repos/{owner}/{repo}/import/authors",
  6628. {},
  6629. {
  6630. deprecated: "octokit.rest.migrations.getCommitAuthors() is deprecated, see https://docs.github.com/rest/migrations/source-imports#get-commit-authors"
  6631. }
  6632. ],
  6633. getImportStatus: [
  6634. "GET /repos/{owner}/{repo}/import",
  6635. {},
  6636. {
  6637. deprecated: "octokit.rest.migrations.getImportStatus() is deprecated, see https://docs.github.com/rest/migrations/source-imports#get-an-import-status"
  6638. }
  6639. ],
  6640. getLargeFiles: [
  6641. "GET /repos/{owner}/{repo}/import/large_files",
  6642. {},
  6643. {
  6644. deprecated: "octokit.rest.migrations.getLargeFiles() is deprecated, see https://docs.github.com/rest/migrations/source-imports#get-large-files"
  6645. }
  6646. ],
  6647. getStatusForAuthenticatedUser: ["GET /user/migrations/{migration_id}"],
  6648. getStatusForOrg: ["GET /orgs/{org}/migrations/{migration_id}"],
  6649. listForAuthenticatedUser: ["GET /user/migrations"],
  6650. listForOrg: ["GET /orgs/{org}/migrations"],
  6651. listReposForAuthenticatedUser: [
  6652. "GET /user/migrations/{migration_id}/repositories"
  6653. ],
  6654. listReposForOrg: ["GET /orgs/{org}/migrations/{migration_id}/repositories"],
  6655. listReposForUser: [
  6656. "GET /user/migrations/{migration_id}/repositories",
  6657. {},
  6658. { renamed: ["migrations", "listReposForAuthenticatedUser"] }
  6659. ],
  6660. mapCommitAuthor: [
  6661. "PATCH /repos/{owner}/{repo}/import/authors/{author_id}",
  6662. {},
  6663. {
  6664. deprecated: "octokit.rest.migrations.mapCommitAuthor() is deprecated, see https://docs.github.com/rest/migrations/source-imports#map-a-commit-author"
  6665. }
  6666. ],
  6667. setLfsPreference: [
  6668. "PATCH /repos/{owner}/{repo}/import/lfs",
  6669. {},
  6670. {
  6671. deprecated: "octokit.rest.migrations.setLfsPreference() is deprecated, see https://docs.github.com/rest/migrations/source-imports#update-git-lfs-preference"
  6672. }
  6673. ],
  6674. startForAuthenticatedUser: ["POST /user/migrations"],
  6675. startForOrg: ["POST /orgs/{org}/migrations"],
  6676. startImport: [
  6677. "PUT /repos/{owner}/{repo}/import",
  6678. {},
  6679. {
  6680. deprecated: "octokit.rest.migrations.startImport() is deprecated, see https://docs.github.com/rest/migrations/source-imports#start-an-import"
  6681. }
  6682. ],
  6683. unlockRepoForAuthenticatedUser: [
  6684. "DELETE /user/migrations/{migration_id}/repos/{repo_name}/lock"
  6685. ],
  6686. unlockRepoForOrg: [
  6687. "DELETE /orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock"
  6688. ],
  6689. updateImport: [
  6690. "PATCH /repos/{owner}/{repo}/import",
  6691. {},
  6692. {
  6693. deprecated: "octokit.rest.migrations.updateImport() is deprecated, see https://docs.github.com/rest/migrations/source-imports#update-an-import"
  6694. }
  6695. ]
  6696. },
  6697. oidc: {
  6698. getOidcCustomSubTemplateForOrg: [
  6699. "GET /orgs/{org}/actions/oidc/customization/sub"
  6700. ],
  6701. updateOidcCustomSubTemplateForOrg: [
  6702. "PUT /orgs/{org}/actions/oidc/customization/sub"
  6703. ]
  6704. },
  6705. orgs: {
  6706. addSecurityManagerTeam: [
  6707. "PUT /orgs/{org}/security-managers/teams/{team_slug}"
  6708. ],
  6709. assignTeamToOrgRole: [
  6710. "PUT /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}"
  6711. ],
  6712. assignUserToOrgRole: [
  6713. "PUT /orgs/{org}/organization-roles/users/{username}/{role_id}"
  6714. ],
  6715. blockUser: ["PUT /orgs/{org}/blocks/{username}"],
  6716. cancelInvitation: ["DELETE /orgs/{org}/invitations/{invitation_id}"],
  6717. checkBlockedUser: ["GET /orgs/{org}/blocks/{username}"],
  6718. checkMembershipForUser: ["GET /orgs/{org}/members/{username}"],
  6719. checkPublicMembershipForUser: ["GET /orgs/{org}/public_members/{username}"],
  6720. convertMemberToOutsideCollaborator: [
  6721. "PUT /orgs/{org}/outside_collaborators/{username}"
  6722. ],
  6723. createCustomOrganizationRole: ["POST /orgs/{org}/organization-roles"],
  6724. createInvitation: ["POST /orgs/{org}/invitations"],
  6725. createOrUpdateCustomProperties: ["PATCH /orgs/{org}/properties/schema"],
  6726. createOrUpdateCustomPropertiesValuesForRepos: [
  6727. "PATCH /orgs/{org}/properties/values"
  6728. ],
  6729. createOrUpdateCustomProperty: [
  6730. "PUT /orgs/{org}/properties/schema/{custom_property_name}"
  6731. ],
  6732. createWebhook: ["POST /orgs/{org}/hooks"],
  6733. delete: ["DELETE /orgs/{org}"],
  6734. deleteCustomOrganizationRole: [
  6735. "DELETE /orgs/{org}/organization-roles/{role_id}"
  6736. ],
  6737. deleteWebhook: ["DELETE /orgs/{org}/hooks/{hook_id}"],
  6738. enableOrDisableSecurityProductOnAllOrgRepos: [
  6739. "POST /orgs/{org}/{security_product}/{enablement}"
  6740. ],
  6741. get: ["GET /orgs/{org}"],
  6742. getAllCustomProperties: ["GET /orgs/{org}/properties/schema"],
  6743. getCustomProperty: [
  6744. "GET /orgs/{org}/properties/schema/{custom_property_name}"
  6745. ],
  6746. getMembershipForAuthenticatedUser: ["GET /user/memberships/orgs/{org}"],
  6747. getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"],
  6748. getOrgRole: ["GET /orgs/{org}/organization-roles/{role_id}"],
  6749. getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"],
  6750. getWebhookConfigForOrg: ["GET /orgs/{org}/hooks/{hook_id}/config"],
  6751. getWebhookDelivery: [
  6752. "GET /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}"
  6753. ],
  6754. list: ["GET /organizations"],
  6755. listAppInstallations: ["GET /orgs/{org}/installations"],
  6756. listBlockedUsers: ["GET /orgs/{org}/blocks"],
  6757. listCustomPropertiesValuesForRepos: ["GET /orgs/{org}/properties/values"],
  6758. listFailedInvitations: ["GET /orgs/{org}/failed_invitations"],
  6759. listForAuthenticatedUser: ["GET /user/orgs"],
  6760. listForUser: ["GET /users/{username}/orgs"],
  6761. listInvitationTeams: ["GET /orgs/{org}/invitations/{invitation_id}/teams"],
  6762. listMembers: ["GET /orgs/{org}/members"],
  6763. listMembershipsForAuthenticatedUser: ["GET /user/memberships/orgs"],
  6764. listOrgRoleTeams: ["GET /orgs/{org}/organization-roles/{role_id}/teams"],
  6765. listOrgRoleUsers: ["GET /orgs/{org}/organization-roles/{role_id}/users"],
  6766. listOrgRoles: ["GET /orgs/{org}/organization-roles"],
  6767. listOrganizationFineGrainedPermissions: [
  6768. "GET /orgs/{org}/organization-fine-grained-permissions"
  6769. ],
  6770. listOutsideCollaborators: ["GET /orgs/{org}/outside_collaborators"],
  6771. listPatGrantRepositories: [
  6772. "GET /orgs/{org}/personal-access-tokens/{pat_id}/repositories"
  6773. ],
  6774. listPatGrantRequestRepositories: [
  6775. "GET /orgs/{org}/personal-access-token-requests/{pat_request_id}/repositories"
  6776. ],
  6777. listPatGrantRequests: ["GET /orgs/{org}/personal-access-token-requests"],
  6778. listPatGrants: ["GET /orgs/{org}/personal-access-tokens"],
  6779. listPendingInvitations: ["GET /orgs/{org}/invitations"],
  6780. listPublicMembers: ["GET /orgs/{org}/public_members"],
  6781. listSecurityManagerTeams: ["GET /orgs/{org}/security-managers"],
  6782. listWebhookDeliveries: ["GET /orgs/{org}/hooks/{hook_id}/deliveries"],
  6783. listWebhooks: ["GET /orgs/{org}/hooks"],
  6784. patchCustomOrganizationRole: [
  6785. "PATCH /orgs/{org}/organization-roles/{role_id}"
  6786. ],
  6787. pingWebhook: ["POST /orgs/{org}/hooks/{hook_id}/pings"],
  6788. redeliverWebhookDelivery: [
  6789. "POST /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}/attempts"
  6790. ],
  6791. removeCustomProperty: [
  6792. "DELETE /orgs/{org}/properties/schema/{custom_property_name}"
  6793. ],
  6794. removeMember: ["DELETE /orgs/{org}/members/{username}"],
  6795. removeMembershipForUser: ["DELETE /orgs/{org}/memberships/{username}"],
  6796. removeOutsideCollaborator: [
  6797. "DELETE /orgs/{org}/outside_collaborators/{username}"
  6798. ],
  6799. removePublicMembershipForAuthenticatedUser: [
  6800. "DELETE /orgs/{org}/public_members/{username}"
  6801. ],
  6802. removeSecurityManagerTeam: [
  6803. "DELETE /orgs/{org}/security-managers/teams/{team_slug}"
  6804. ],
  6805. reviewPatGrantRequest: [
  6806. "POST /orgs/{org}/personal-access-token-requests/{pat_request_id}"
  6807. ],
  6808. reviewPatGrantRequestsInBulk: [
  6809. "POST /orgs/{org}/personal-access-token-requests"
  6810. ],
  6811. revokeAllOrgRolesTeam: [
  6812. "DELETE /orgs/{org}/organization-roles/teams/{team_slug}"
  6813. ],
  6814. revokeAllOrgRolesUser: [
  6815. "DELETE /orgs/{org}/organization-roles/users/{username}"
  6816. ],
  6817. revokeOrgRoleTeam: [
  6818. "DELETE /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}"
  6819. ],
  6820. revokeOrgRoleUser: [
  6821. "DELETE /orgs/{org}/organization-roles/users/{username}/{role_id}"
  6822. ],
  6823. setMembershipForUser: ["PUT /orgs/{org}/memberships/{username}"],
  6824. setPublicMembershipForAuthenticatedUser: [
  6825. "PUT /orgs/{org}/public_members/{username}"
  6826. ],
  6827. unblockUser: ["DELETE /orgs/{org}/blocks/{username}"],
  6828. update: ["PATCH /orgs/{org}"],
  6829. updateMembershipForAuthenticatedUser: [
  6830. "PATCH /user/memberships/orgs/{org}"
  6831. ],
  6832. updatePatAccess: ["POST /orgs/{org}/personal-access-tokens/{pat_id}"],
  6833. updatePatAccesses: ["POST /orgs/{org}/personal-access-tokens"],
  6834. updateWebhook: ["PATCH /orgs/{org}/hooks/{hook_id}"],
  6835. updateWebhookConfigForOrg: ["PATCH /orgs/{org}/hooks/{hook_id}/config"]
  6836. },
  6837. packages: {
  6838. deletePackageForAuthenticatedUser: [
  6839. "DELETE /user/packages/{package_type}/{package_name}"
  6840. ],
  6841. deletePackageForOrg: [
  6842. "DELETE /orgs/{org}/packages/{package_type}/{package_name}"
  6843. ],
  6844. deletePackageForUser: [
  6845. "DELETE /users/{username}/packages/{package_type}/{package_name}"
  6846. ],
  6847. deletePackageVersionForAuthenticatedUser: [
  6848. "DELETE /user/packages/{package_type}/{package_name}/versions/{package_version_id}"
  6849. ],
  6850. deletePackageVersionForOrg: [
  6851. "DELETE /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}"
  6852. ],
  6853. deletePackageVersionForUser: [
  6854. "DELETE /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}"
  6855. ],
  6856. getAllPackageVersionsForAPackageOwnedByAnOrg: [
  6857. "GET /orgs/{org}/packages/{package_type}/{package_name}/versions",
  6858. {},
  6859. { renamed: ["packages", "getAllPackageVersionsForPackageOwnedByOrg"] }
  6860. ],
  6861. getAllPackageVersionsForAPackageOwnedByTheAuthenticatedUser: [
  6862. "GET /user/packages/{package_type}/{package_name}/versions",
  6863. {},
  6864. {
  6865. renamed: [
  6866. "packages",
  6867. "getAllPackageVersionsForPackageOwnedByAuthenticatedUser"
  6868. ]
  6869. }
  6870. ],
  6871. getAllPackageVersionsForPackageOwnedByAuthenticatedUser: [
  6872. "GET /user/packages/{package_type}/{package_name}/versions"
  6873. ],
  6874. getAllPackageVersionsForPackageOwnedByOrg: [
  6875. "GET /orgs/{org}/packages/{package_type}/{package_name}/versions"
  6876. ],
  6877. getAllPackageVersionsForPackageOwnedByUser: [
  6878. "GET /users/{username}/packages/{package_type}/{package_name}/versions"
  6879. ],
  6880. getPackageForAuthenticatedUser: [
  6881. "GET /user/packages/{package_type}/{package_name}"
  6882. ],
  6883. getPackageForOrganization: [
  6884. "GET /orgs/{org}/packages/{package_type}/{package_name}"
  6885. ],
  6886. getPackageForUser: [
  6887. "GET /users/{username}/packages/{package_type}/{package_name}"
  6888. ],
  6889. getPackageVersionForAuthenticatedUser: [
  6890. "GET /user/packages/{package_type}/{package_name}/versions/{package_version_id}"
  6891. ],
  6892. getPackageVersionForOrganization: [
  6893. "GET /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}"
  6894. ],
  6895. getPackageVersionForUser: [
  6896. "GET /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}"
  6897. ],
  6898. listDockerMigrationConflictingPackagesForAuthenticatedUser: [
  6899. "GET /user/docker/conflicts"
  6900. ],
  6901. listDockerMigrationConflictingPackagesForOrganization: [
  6902. "GET /orgs/{org}/docker/conflicts"
  6903. ],
  6904. listDockerMigrationConflictingPackagesForUser: [
  6905. "GET /users/{username}/docker/conflicts"
  6906. ],
  6907. listPackagesForAuthenticatedUser: ["GET /user/packages"],
  6908. listPackagesForOrganization: ["GET /orgs/{org}/packages"],
  6909. listPackagesForUser: ["GET /users/{username}/packages"],
  6910. restorePackageForAuthenticatedUser: [
  6911. "POST /user/packages/{package_type}/{package_name}/restore{?token}"
  6912. ],
  6913. restorePackageForOrg: [
  6914. "POST /orgs/{org}/packages/{package_type}/{package_name}/restore{?token}"
  6915. ],
  6916. restorePackageForUser: [
  6917. "POST /users/{username}/packages/{package_type}/{package_name}/restore{?token}"
  6918. ],
  6919. restorePackageVersionForAuthenticatedUser: [
  6920. "POST /user/packages/{package_type}/{package_name}/versions/{package_version_id}/restore"
  6921. ],
  6922. restorePackageVersionForOrg: [
  6923. "POST /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore"
  6924. ],
  6925. restorePackageVersionForUser: [
  6926. "POST /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore"
  6927. ]
  6928. },
  6929. projects: {
  6930. addCollaborator: ["PUT /projects/{project_id}/collaborators/{username}"],
  6931. createCard: ["POST /projects/columns/{column_id}/cards"],
  6932. createColumn: ["POST /projects/{project_id}/columns"],
  6933. createForAuthenticatedUser: ["POST /user/projects"],
  6934. createForOrg: ["POST /orgs/{org}/projects"],
  6935. createForRepo: ["POST /repos/{owner}/{repo}/projects"],
  6936. delete: ["DELETE /projects/{project_id}"],
  6937. deleteCard: ["DELETE /projects/columns/cards/{card_id}"],
  6938. deleteColumn: ["DELETE /projects/columns/{column_id}"],
  6939. get: ["GET /projects/{project_id}"],
  6940. getCard: ["GET /projects/columns/cards/{card_id}"],
  6941. getColumn: ["GET /projects/columns/{column_id}"],
  6942. getPermissionForUser: [
  6943. "GET /projects/{project_id}/collaborators/{username}/permission"
  6944. ],
  6945. listCards: ["GET /projects/columns/{column_id}/cards"],
  6946. listCollaborators: ["GET /projects/{project_id}/collaborators"],
  6947. listColumns: ["GET /projects/{project_id}/columns"],
  6948. listForOrg: ["GET /orgs/{org}/projects"],
  6949. listForRepo: ["GET /repos/{owner}/{repo}/projects"],
  6950. listForUser: ["GET /users/{username}/projects"],
  6951. moveCard: ["POST /projects/columns/cards/{card_id}/moves"],
  6952. moveColumn: ["POST /projects/columns/{column_id}/moves"],
  6953. removeCollaborator: [
  6954. "DELETE /projects/{project_id}/collaborators/{username}"
  6955. ],
  6956. update: ["PATCH /projects/{project_id}"],
  6957. updateCard: ["PATCH /projects/columns/cards/{card_id}"],
  6958. updateColumn: ["PATCH /projects/columns/{column_id}"]
  6959. },
  6960. pulls: {
  6961. checkIfMerged: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/merge"],
  6962. create: ["POST /repos/{owner}/{repo}/pulls"],
  6963. createReplyForReviewComment: [
  6964. "POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies"
  6965. ],
  6966. createReview: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews"],
  6967. createReviewComment: [
  6968. "POST /repos/{owner}/{repo}/pulls/{pull_number}/comments"
  6969. ],
  6970. deletePendingReview: [
  6971. "DELETE /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"
  6972. ],
  6973. deleteReviewComment: [
  6974. "DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}"
  6975. ],
  6976. dismissReview: [
  6977. "PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals"
  6978. ],
  6979. get: ["GET /repos/{owner}/{repo}/pulls/{pull_number}"],
  6980. getReview: [
  6981. "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"
  6982. ],
  6983. getReviewComment: ["GET /repos/{owner}/{repo}/pulls/comments/{comment_id}"],
  6984. list: ["GET /repos/{owner}/{repo}/pulls"],
  6985. listCommentsForReview: [
  6986. "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments"
  6987. ],
  6988. listCommits: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/commits"],
  6989. listFiles: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/files"],
  6990. listRequestedReviewers: [
  6991. "GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"
  6992. ],
  6993. listReviewComments: [
  6994. "GET /repos/{owner}/{repo}/pulls/{pull_number}/comments"
  6995. ],
  6996. listReviewCommentsForRepo: ["GET /repos/{owner}/{repo}/pulls/comments"],
  6997. listReviews: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews"],
  6998. merge: ["PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge"],
  6999. removeRequestedReviewers: [
  7000. "DELETE /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"
  7001. ],
  7002. requestReviewers: [
  7003. "POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"
  7004. ],
  7005. submitReview: [
  7006. "POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events"
  7007. ],
  7008. update: ["PATCH /repos/{owner}/{repo}/pulls/{pull_number}"],
  7009. updateBranch: [
  7010. "PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch"
  7011. ],
  7012. updateReview: [
  7013. "PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"
  7014. ],
  7015. updateReviewComment: [
  7016. "PATCH /repos/{owner}/{repo}/pulls/comments/{comment_id}"
  7017. ]
  7018. },
  7019. rateLimit: { get: ["GET /rate_limit"] },
  7020. reactions: {
  7021. createForCommitComment: [
  7022. "POST /repos/{owner}/{repo}/comments/{comment_id}/reactions"
  7023. ],
  7024. createForIssue: [
  7025. "POST /repos/{owner}/{repo}/issues/{issue_number}/reactions"
  7026. ],
  7027. createForIssueComment: [
  7028. "POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions"
  7029. ],
  7030. createForPullRequestReviewComment: [
  7031. "POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions"
  7032. ],
  7033. createForRelease: [
  7034. "POST /repos/{owner}/{repo}/releases/{release_id}/reactions"
  7035. ],
  7036. createForTeamDiscussionCommentInOrg: [
  7037. "POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions"
  7038. ],
  7039. createForTeamDiscussionInOrg: [
  7040. "POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions"
  7041. ],
  7042. deleteForCommitComment: [
  7043. "DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}"
  7044. ],
  7045. deleteForIssue: [
  7046. "DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}"
  7047. ],
  7048. deleteForIssueComment: [
  7049. "DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}"
  7050. ],
  7051. deleteForPullRequestComment: [
  7052. "DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}"
  7053. ],
  7054. deleteForRelease: [
  7055. "DELETE /repos/{owner}/{repo}/releases/{release_id}/reactions/{reaction_id}"
  7056. ],
  7057. deleteForTeamDiscussion: [
  7058. "DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}"
  7059. ],
  7060. deleteForTeamDiscussionComment: [
  7061. "DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}"
  7062. ],
  7063. listForCommitComment: [
  7064. "GET /repos/{owner}/{repo}/comments/{comment_id}/reactions"
  7065. ],
  7066. listForIssue: ["GET /repos/{owner}/{repo}/issues/{issue_number}/reactions"],
  7067. listForIssueComment: [
  7068. "GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions"
  7069. ],
  7070. listForPullRequestReviewComment: [
  7071. "GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions"
  7072. ],
  7073. listForRelease: [
  7074. "GET /repos/{owner}/{repo}/releases/{release_id}/reactions"
  7075. ],
  7076. listForTeamDiscussionCommentInOrg: [
  7077. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions"
  7078. ],
  7079. listForTeamDiscussionInOrg: [
  7080. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions"
  7081. ]
  7082. },
  7083. repos: {
  7084. acceptInvitation: [
  7085. "PATCH /user/repository_invitations/{invitation_id}",
  7086. {},
  7087. { renamed: ["repos", "acceptInvitationForAuthenticatedUser"] }
  7088. ],
  7089. acceptInvitationForAuthenticatedUser: [
  7090. "PATCH /user/repository_invitations/{invitation_id}"
  7091. ],
  7092. addAppAccessRestrictions: [
  7093. "POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps",
  7094. {},
  7095. { mapToData: "apps" }
  7096. ],
  7097. addCollaborator: ["PUT /repos/{owner}/{repo}/collaborators/{username}"],
  7098. addStatusCheckContexts: [
  7099. "POST /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts",
  7100. {},
  7101. { mapToData: "contexts" }
  7102. ],
  7103. addTeamAccessRestrictions: [
  7104. "POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams",
  7105. {},
  7106. { mapToData: "teams" }
  7107. ],
  7108. addUserAccessRestrictions: [
  7109. "POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users",
  7110. {},
  7111. { mapToData: "users" }
  7112. ],
  7113. cancelPagesDeployment: [
  7114. "POST /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}/cancel"
  7115. ],
  7116. checkAutomatedSecurityFixes: [
  7117. "GET /repos/{owner}/{repo}/automated-security-fixes"
  7118. ],
  7119. checkCollaborator: ["GET /repos/{owner}/{repo}/collaborators/{username}"],
  7120. checkVulnerabilityAlerts: [
  7121. "GET /repos/{owner}/{repo}/vulnerability-alerts"
  7122. ],
  7123. codeownersErrors: ["GET /repos/{owner}/{repo}/codeowners/errors"],
  7124. compareCommits: ["GET /repos/{owner}/{repo}/compare/{base}...{head}"],
  7125. compareCommitsWithBasehead: [
  7126. "GET /repos/{owner}/{repo}/compare/{basehead}"
  7127. ],
  7128. createAutolink: ["POST /repos/{owner}/{repo}/autolinks"],
  7129. createCommitComment: [
  7130. "POST /repos/{owner}/{repo}/commits/{commit_sha}/comments"
  7131. ],
  7132. createCommitSignatureProtection: [
  7133. "POST /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures"
  7134. ],
  7135. createCommitStatus: ["POST /repos/{owner}/{repo}/statuses/{sha}"],
  7136. createDeployKey: ["POST /repos/{owner}/{repo}/keys"],
  7137. createDeployment: ["POST /repos/{owner}/{repo}/deployments"],
  7138. createDeploymentBranchPolicy: [
  7139. "POST /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies"
  7140. ],
  7141. createDeploymentProtectionRule: [
  7142. "POST /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules"
  7143. ],
  7144. createDeploymentStatus: [
  7145. "POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses"
  7146. ],
  7147. createDispatchEvent: ["POST /repos/{owner}/{repo}/dispatches"],
  7148. createForAuthenticatedUser: ["POST /user/repos"],
  7149. createFork: ["POST /repos/{owner}/{repo}/forks"],
  7150. createInOrg: ["POST /orgs/{org}/repos"],
  7151. createOrUpdateCustomPropertiesValues: [
  7152. "PATCH /repos/{owner}/{repo}/properties/values"
  7153. ],
  7154. createOrUpdateEnvironment: [
  7155. "PUT /repos/{owner}/{repo}/environments/{environment_name}"
  7156. ],
  7157. createOrUpdateFileContents: ["PUT /repos/{owner}/{repo}/contents/{path}"],
  7158. createOrgRuleset: ["POST /orgs/{org}/rulesets"],
  7159. createPagesDeployment: ["POST /repos/{owner}/{repo}/pages/deployments"],
  7160. createPagesSite: ["POST /repos/{owner}/{repo}/pages"],
  7161. createRelease: ["POST /repos/{owner}/{repo}/releases"],
  7162. createRepoRuleset: ["POST /repos/{owner}/{repo}/rulesets"],
  7163. createTagProtection: ["POST /repos/{owner}/{repo}/tags/protection"],
  7164. createUsingTemplate: [
  7165. "POST /repos/{template_owner}/{template_repo}/generate"
  7166. ],
  7167. createWebhook: ["POST /repos/{owner}/{repo}/hooks"],
  7168. declineInvitation: [
  7169. "DELETE /user/repository_invitations/{invitation_id}",
  7170. {},
  7171. { renamed: ["repos", "declineInvitationForAuthenticatedUser"] }
  7172. ],
  7173. declineInvitationForAuthenticatedUser: [
  7174. "DELETE /user/repository_invitations/{invitation_id}"
  7175. ],
  7176. delete: ["DELETE /repos/{owner}/{repo}"],
  7177. deleteAccessRestrictions: [
  7178. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions"
  7179. ],
  7180. deleteAdminBranchProtection: [
  7181. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"
  7182. ],
  7183. deleteAnEnvironment: [
  7184. "DELETE /repos/{owner}/{repo}/environments/{environment_name}"
  7185. ],
  7186. deleteAutolink: ["DELETE /repos/{owner}/{repo}/autolinks/{autolink_id}"],
  7187. deleteBranchProtection: [
  7188. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection"
  7189. ],
  7190. deleteCommitComment: ["DELETE /repos/{owner}/{repo}/comments/{comment_id}"],
  7191. deleteCommitSignatureProtection: [
  7192. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures"
  7193. ],
  7194. deleteDeployKey: ["DELETE /repos/{owner}/{repo}/keys/{key_id}"],
  7195. deleteDeployment: [
  7196. "DELETE /repos/{owner}/{repo}/deployments/{deployment_id}"
  7197. ],
  7198. deleteDeploymentBranchPolicy: [
  7199. "DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}"
  7200. ],
  7201. deleteFile: ["DELETE /repos/{owner}/{repo}/contents/{path}"],
  7202. deleteInvitation: [
  7203. "DELETE /repos/{owner}/{repo}/invitations/{invitation_id}"
  7204. ],
  7205. deleteOrgRuleset: ["DELETE /orgs/{org}/rulesets/{ruleset_id}"],
  7206. deletePagesSite: ["DELETE /repos/{owner}/{repo}/pages"],
  7207. deletePullRequestReviewProtection: [
  7208. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"
  7209. ],
  7210. deleteRelease: ["DELETE /repos/{owner}/{repo}/releases/{release_id}"],
  7211. deleteReleaseAsset: [
  7212. "DELETE /repos/{owner}/{repo}/releases/assets/{asset_id}"
  7213. ],
  7214. deleteRepoRuleset: ["DELETE /repos/{owner}/{repo}/rulesets/{ruleset_id}"],
  7215. deleteTagProtection: [
  7216. "DELETE /repos/{owner}/{repo}/tags/protection/{tag_protection_id}"
  7217. ],
  7218. deleteWebhook: ["DELETE /repos/{owner}/{repo}/hooks/{hook_id}"],
  7219. disableAutomatedSecurityFixes: [
  7220. "DELETE /repos/{owner}/{repo}/automated-security-fixes"
  7221. ],
  7222. disableDeploymentProtectionRule: [
  7223. "DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id}"
  7224. ],
  7225. disablePrivateVulnerabilityReporting: [
  7226. "DELETE /repos/{owner}/{repo}/private-vulnerability-reporting"
  7227. ],
  7228. disableVulnerabilityAlerts: [
  7229. "DELETE /repos/{owner}/{repo}/vulnerability-alerts"
  7230. ],
  7231. downloadArchive: [
  7232. "GET /repos/{owner}/{repo}/zipball/{ref}",
  7233. {},
  7234. { renamed: ["repos", "downloadZipballArchive"] }
  7235. ],
  7236. downloadTarballArchive: ["GET /repos/{owner}/{repo}/tarball/{ref}"],
  7237. downloadZipballArchive: ["GET /repos/{owner}/{repo}/zipball/{ref}"],
  7238. enableAutomatedSecurityFixes: [
  7239. "PUT /repos/{owner}/{repo}/automated-security-fixes"
  7240. ],
  7241. enablePrivateVulnerabilityReporting: [
  7242. "PUT /repos/{owner}/{repo}/private-vulnerability-reporting"
  7243. ],
  7244. enableVulnerabilityAlerts: [
  7245. "PUT /repos/{owner}/{repo}/vulnerability-alerts"
  7246. ],
  7247. generateReleaseNotes: [
  7248. "POST /repos/{owner}/{repo}/releases/generate-notes"
  7249. ],
  7250. get: ["GET /repos/{owner}/{repo}"],
  7251. getAccessRestrictions: [
  7252. "GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions"
  7253. ],
  7254. getAdminBranchProtection: [
  7255. "GET /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"
  7256. ],
  7257. getAllDeploymentProtectionRules: [
  7258. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules"
  7259. ],
  7260. getAllEnvironments: ["GET /repos/{owner}/{repo}/environments"],
  7261. getAllStatusCheckContexts: [
  7262. "GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts"
  7263. ],
  7264. getAllTopics: ["GET /repos/{owner}/{repo}/topics"],
  7265. getAppsWithAccessToProtectedBranch: [
  7266. "GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps"
  7267. ],
  7268. getAutolink: ["GET /repos/{owner}/{repo}/autolinks/{autolink_id}"],
  7269. getBranch: ["GET /repos/{owner}/{repo}/branches/{branch}"],
  7270. getBranchProtection: [
  7271. "GET /repos/{owner}/{repo}/branches/{branch}/protection"
  7272. ],
  7273. getBranchRules: ["GET /repos/{owner}/{repo}/rules/branches/{branch}"],
  7274. getClones: ["GET /repos/{owner}/{repo}/traffic/clones"],
  7275. getCodeFrequencyStats: ["GET /repos/{owner}/{repo}/stats/code_frequency"],
  7276. getCollaboratorPermissionLevel: [
  7277. "GET /repos/{owner}/{repo}/collaborators/{username}/permission"
  7278. ],
  7279. getCombinedStatusForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/status"],
  7280. getCommit: ["GET /repos/{owner}/{repo}/commits/{ref}"],
  7281. getCommitActivityStats: ["GET /repos/{owner}/{repo}/stats/commit_activity"],
  7282. getCommitComment: ["GET /repos/{owner}/{repo}/comments/{comment_id}"],
  7283. getCommitSignatureProtection: [
  7284. "GET /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures"
  7285. ],
  7286. getCommunityProfileMetrics: ["GET /repos/{owner}/{repo}/community/profile"],
  7287. getContent: ["GET /repos/{owner}/{repo}/contents/{path}"],
  7288. getContributorsStats: ["GET /repos/{owner}/{repo}/stats/contributors"],
  7289. getCustomDeploymentProtectionRule: [
  7290. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id}"
  7291. ],
  7292. getCustomPropertiesValues: ["GET /repos/{owner}/{repo}/properties/values"],
  7293. getDeployKey: ["GET /repos/{owner}/{repo}/keys/{key_id}"],
  7294. getDeployment: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}"],
  7295. getDeploymentBranchPolicy: [
  7296. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}"
  7297. ],
  7298. getDeploymentStatus: [
  7299. "GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id}"
  7300. ],
  7301. getEnvironment: [
  7302. "GET /repos/{owner}/{repo}/environments/{environment_name}"
  7303. ],
  7304. getLatestPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/latest"],
  7305. getLatestRelease: ["GET /repos/{owner}/{repo}/releases/latest"],
  7306. getOrgRuleSuite: ["GET /orgs/{org}/rulesets/rule-suites/{rule_suite_id}"],
  7307. getOrgRuleSuites: ["GET /orgs/{org}/rulesets/rule-suites"],
  7308. getOrgRuleset: ["GET /orgs/{org}/rulesets/{ruleset_id}"],
  7309. getOrgRulesets: ["GET /orgs/{org}/rulesets"],
  7310. getPages: ["GET /repos/{owner}/{repo}/pages"],
  7311. getPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/{build_id}"],
  7312. getPagesDeployment: [
  7313. "GET /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}"
  7314. ],
  7315. getPagesHealthCheck: ["GET /repos/{owner}/{repo}/pages/health"],
  7316. getParticipationStats: ["GET /repos/{owner}/{repo}/stats/participation"],
  7317. getPullRequestReviewProtection: [
  7318. "GET /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"
  7319. ],
  7320. getPunchCardStats: ["GET /repos/{owner}/{repo}/stats/punch_card"],
  7321. getReadme: ["GET /repos/{owner}/{repo}/readme"],
  7322. getReadmeInDirectory: ["GET /repos/{owner}/{repo}/readme/{dir}"],
  7323. getRelease: ["GET /repos/{owner}/{repo}/releases/{release_id}"],
  7324. getReleaseAsset: ["GET /repos/{owner}/{repo}/releases/assets/{asset_id}"],
  7325. getReleaseByTag: ["GET /repos/{owner}/{repo}/releases/tags/{tag}"],
  7326. getRepoRuleSuite: [
  7327. "GET /repos/{owner}/{repo}/rulesets/rule-suites/{rule_suite_id}"
  7328. ],
  7329. getRepoRuleSuites: ["GET /repos/{owner}/{repo}/rulesets/rule-suites"],
  7330. getRepoRuleset: ["GET /repos/{owner}/{repo}/rulesets/{ruleset_id}"],
  7331. getRepoRulesets: ["GET /repos/{owner}/{repo}/rulesets"],
  7332. getStatusChecksProtection: [
  7333. "GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"
  7334. ],
  7335. getTeamsWithAccessToProtectedBranch: [
  7336. "GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams"
  7337. ],
  7338. getTopPaths: ["GET /repos/{owner}/{repo}/traffic/popular/paths"],
  7339. getTopReferrers: ["GET /repos/{owner}/{repo}/traffic/popular/referrers"],
  7340. getUsersWithAccessToProtectedBranch: [
  7341. "GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users"
  7342. ],
  7343. getViews: ["GET /repos/{owner}/{repo}/traffic/views"],
  7344. getWebhook: ["GET /repos/{owner}/{repo}/hooks/{hook_id}"],
  7345. getWebhookConfigForRepo: [
  7346. "GET /repos/{owner}/{repo}/hooks/{hook_id}/config"
  7347. ],
  7348. getWebhookDelivery: [
  7349. "GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}"
  7350. ],
  7351. listActivities: ["GET /repos/{owner}/{repo}/activity"],
  7352. listAutolinks: ["GET /repos/{owner}/{repo}/autolinks"],
  7353. listBranches: ["GET /repos/{owner}/{repo}/branches"],
  7354. listBranchesForHeadCommit: [
  7355. "GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head"
  7356. ],
  7357. listCollaborators: ["GET /repos/{owner}/{repo}/collaborators"],
  7358. listCommentsForCommit: [
  7359. "GET /repos/{owner}/{repo}/commits/{commit_sha}/comments"
  7360. ],
  7361. listCommitCommentsForRepo: ["GET /repos/{owner}/{repo}/comments"],
  7362. listCommitStatusesForRef: [
  7363. "GET /repos/{owner}/{repo}/commits/{ref}/statuses"
  7364. ],
  7365. listCommits: ["GET /repos/{owner}/{repo}/commits"],
  7366. listContributors: ["GET /repos/{owner}/{repo}/contributors"],
  7367. listCustomDeploymentRuleIntegrations: [
  7368. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/apps"
  7369. ],
  7370. listDeployKeys: ["GET /repos/{owner}/{repo}/keys"],
  7371. listDeploymentBranchPolicies: [
  7372. "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies"
  7373. ],
  7374. listDeploymentStatuses: [
  7375. "GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses"
  7376. ],
  7377. listDeployments: ["GET /repos/{owner}/{repo}/deployments"],
  7378. listForAuthenticatedUser: ["GET /user/repos"],
  7379. listForOrg: ["GET /orgs/{org}/repos"],
  7380. listForUser: ["GET /users/{username}/repos"],
  7381. listForks: ["GET /repos/{owner}/{repo}/forks"],
  7382. listInvitations: ["GET /repos/{owner}/{repo}/invitations"],
  7383. listInvitationsForAuthenticatedUser: ["GET /user/repository_invitations"],
  7384. listLanguages: ["GET /repos/{owner}/{repo}/languages"],
  7385. listPagesBuilds: ["GET /repos/{owner}/{repo}/pages/builds"],
  7386. listPublic: ["GET /repositories"],
  7387. listPullRequestsAssociatedWithCommit: [
  7388. "GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls"
  7389. ],
  7390. listReleaseAssets: [
  7391. "GET /repos/{owner}/{repo}/releases/{release_id}/assets"
  7392. ],
  7393. listReleases: ["GET /repos/{owner}/{repo}/releases"],
  7394. listTagProtection: ["GET /repos/{owner}/{repo}/tags/protection"],
  7395. listTags: ["GET /repos/{owner}/{repo}/tags"],
  7396. listTeams: ["GET /repos/{owner}/{repo}/teams"],
  7397. listWebhookDeliveries: [
  7398. "GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries"
  7399. ],
  7400. listWebhooks: ["GET /repos/{owner}/{repo}/hooks"],
  7401. merge: ["POST /repos/{owner}/{repo}/merges"],
  7402. mergeUpstream: ["POST /repos/{owner}/{repo}/merge-upstream"],
  7403. pingWebhook: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/pings"],
  7404. redeliverWebhookDelivery: [
  7405. "POST /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}/attempts"
  7406. ],
  7407. removeAppAccessRestrictions: [
  7408. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps",
  7409. {},
  7410. { mapToData: "apps" }
  7411. ],
  7412. removeCollaborator: [
  7413. "DELETE /repos/{owner}/{repo}/collaborators/{username}"
  7414. ],
  7415. removeStatusCheckContexts: [
  7416. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts",
  7417. {},
  7418. { mapToData: "contexts" }
  7419. ],
  7420. removeStatusCheckProtection: [
  7421. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"
  7422. ],
  7423. removeTeamAccessRestrictions: [
  7424. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams",
  7425. {},
  7426. { mapToData: "teams" }
  7427. ],
  7428. removeUserAccessRestrictions: [
  7429. "DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users",
  7430. {},
  7431. { mapToData: "users" }
  7432. ],
  7433. renameBranch: ["POST /repos/{owner}/{repo}/branches/{branch}/rename"],
  7434. replaceAllTopics: ["PUT /repos/{owner}/{repo}/topics"],
  7435. requestPagesBuild: ["POST /repos/{owner}/{repo}/pages/builds"],
  7436. setAdminBranchProtection: [
  7437. "POST /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"
  7438. ],
  7439. setAppAccessRestrictions: [
  7440. "PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps",
  7441. {},
  7442. { mapToData: "apps" }
  7443. ],
  7444. setStatusCheckContexts: [
  7445. "PUT /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts",
  7446. {},
  7447. { mapToData: "contexts" }
  7448. ],
  7449. setTeamAccessRestrictions: [
  7450. "PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams",
  7451. {},
  7452. { mapToData: "teams" }
  7453. ],
  7454. setUserAccessRestrictions: [
  7455. "PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users",
  7456. {},
  7457. { mapToData: "users" }
  7458. ],
  7459. testPushWebhook: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/tests"],
  7460. transfer: ["POST /repos/{owner}/{repo}/transfer"],
  7461. update: ["PATCH /repos/{owner}/{repo}"],
  7462. updateBranchProtection: [
  7463. "PUT /repos/{owner}/{repo}/branches/{branch}/protection"
  7464. ],
  7465. updateCommitComment: ["PATCH /repos/{owner}/{repo}/comments/{comment_id}"],
  7466. updateDeploymentBranchPolicy: [
  7467. "PUT /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}"
  7468. ],
  7469. updateInformationAboutPagesSite: ["PUT /repos/{owner}/{repo}/pages"],
  7470. updateInvitation: [
  7471. "PATCH /repos/{owner}/{repo}/invitations/{invitation_id}"
  7472. ],
  7473. updateOrgRuleset: ["PUT /orgs/{org}/rulesets/{ruleset_id}"],
  7474. updatePullRequestReviewProtection: [
  7475. "PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"
  7476. ],
  7477. updateRelease: ["PATCH /repos/{owner}/{repo}/releases/{release_id}"],
  7478. updateReleaseAsset: [
  7479. "PATCH /repos/{owner}/{repo}/releases/assets/{asset_id}"
  7480. ],
  7481. updateRepoRuleset: ["PUT /repos/{owner}/{repo}/rulesets/{ruleset_id}"],
  7482. updateStatusCheckPotection: [
  7483. "PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks",
  7484. {},
  7485. { renamed: ["repos", "updateStatusCheckProtection"] }
  7486. ],
  7487. updateStatusCheckProtection: [
  7488. "PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"
  7489. ],
  7490. updateWebhook: ["PATCH /repos/{owner}/{repo}/hooks/{hook_id}"],
  7491. updateWebhookConfigForRepo: [
  7492. "PATCH /repos/{owner}/{repo}/hooks/{hook_id}/config"
  7493. ],
  7494. uploadReleaseAsset: [
  7495. "POST /repos/{owner}/{repo}/releases/{release_id}/assets{?name,label}",
  7496. { baseUrl: "https://uploads.github.com" }
  7497. ]
  7498. },
  7499. search: {
  7500. code: ["GET /search/code"],
  7501. commits: ["GET /search/commits"],
  7502. issuesAndPullRequests: ["GET /search/issues"],
  7503. labels: ["GET /search/labels"],
  7504. repos: ["GET /search/repositories"],
  7505. topics: ["GET /search/topics"],
  7506. users: ["GET /search/users"]
  7507. },
  7508. secretScanning: {
  7509. getAlert: [
  7510. "GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}"
  7511. ],
  7512. listAlertsForEnterprise: [
  7513. "GET /enterprises/{enterprise}/secret-scanning/alerts"
  7514. ],
  7515. listAlertsForOrg: ["GET /orgs/{org}/secret-scanning/alerts"],
  7516. listAlertsForRepo: ["GET /repos/{owner}/{repo}/secret-scanning/alerts"],
  7517. listLocationsForAlert: [
  7518. "GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations"
  7519. ],
  7520. updateAlert: [
  7521. "PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}"
  7522. ]
  7523. },
  7524. securityAdvisories: {
  7525. createFork: [
  7526. "POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/forks"
  7527. ],
  7528. createPrivateVulnerabilityReport: [
  7529. "POST /repos/{owner}/{repo}/security-advisories/reports"
  7530. ],
  7531. createRepositoryAdvisory: [
  7532. "POST /repos/{owner}/{repo}/security-advisories"
  7533. ],
  7534. createRepositoryAdvisoryCveRequest: [
  7535. "POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/cve"
  7536. ],
  7537. getGlobalAdvisory: ["GET /advisories/{ghsa_id}"],
  7538. getRepositoryAdvisory: [
  7539. "GET /repos/{owner}/{repo}/security-advisories/{ghsa_id}"
  7540. ],
  7541. listGlobalAdvisories: ["GET /advisories"],
  7542. listOrgRepositoryAdvisories: ["GET /orgs/{org}/security-advisories"],
  7543. listRepositoryAdvisories: ["GET /repos/{owner}/{repo}/security-advisories"],
  7544. updateRepositoryAdvisory: [
  7545. "PATCH /repos/{owner}/{repo}/security-advisories/{ghsa_id}"
  7546. ]
  7547. },
  7548. teams: {
  7549. addOrUpdateMembershipForUserInOrg: [
  7550. "PUT /orgs/{org}/teams/{team_slug}/memberships/{username}"
  7551. ],
  7552. addOrUpdateProjectPermissionsInOrg: [
  7553. "PUT /orgs/{org}/teams/{team_slug}/projects/{project_id}"
  7554. ],
  7555. addOrUpdateRepoPermissionsInOrg: [
  7556. "PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"
  7557. ],
  7558. checkPermissionsForProjectInOrg: [
  7559. "GET /orgs/{org}/teams/{team_slug}/projects/{project_id}"
  7560. ],
  7561. checkPermissionsForRepoInOrg: [
  7562. "GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"
  7563. ],
  7564. create: ["POST /orgs/{org}/teams"],
  7565. createDiscussionCommentInOrg: [
  7566. "POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments"
  7567. ],
  7568. createDiscussionInOrg: ["POST /orgs/{org}/teams/{team_slug}/discussions"],
  7569. deleteDiscussionCommentInOrg: [
  7570. "DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"
  7571. ],
  7572. deleteDiscussionInOrg: [
  7573. "DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"
  7574. ],
  7575. deleteInOrg: ["DELETE /orgs/{org}/teams/{team_slug}"],
  7576. getByName: ["GET /orgs/{org}/teams/{team_slug}"],
  7577. getDiscussionCommentInOrg: [
  7578. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"
  7579. ],
  7580. getDiscussionInOrg: [
  7581. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"
  7582. ],
  7583. getMembershipForUserInOrg: [
  7584. "GET /orgs/{org}/teams/{team_slug}/memberships/{username}"
  7585. ],
  7586. list: ["GET /orgs/{org}/teams"],
  7587. listChildInOrg: ["GET /orgs/{org}/teams/{team_slug}/teams"],
  7588. listDiscussionCommentsInOrg: [
  7589. "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments"
  7590. ],
  7591. listDiscussionsInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions"],
  7592. listForAuthenticatedUser: ["GET /user/teams"],
  7593. listMembersInOrg: ["GET /orgs/{org}/teams/{team_slug}/members"],
  7594. listPendingInvitationsInOrg: [
  7595. "GET /orgs/{org}/teams/{team_slug}/invitations"
  7596. ],
  7597. listProjectsInOrg: ["GET /orgs/{org}/teams/{team_slug}/projects"],
  7598. listReposInOrg: ["GET /orgs/{org}/teams/{team_slug}/repos"],
  7599. removeMembershipForUserInOrg: [
  7600. "DELETE /orgs/{org}/teams/{team_slug}/memberships/{username}"
  7601. ],
  7602. removeProjectInOrg: [
  7603. "DELETE /orgs/{org}/teams/{team_slug}/projects/{project_id}"
  7604. ],
  7605. removeRepoInOrg: [
  7606. "DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"
  7607. ],
  7608. updateDiscussionCommentInOrg: [
  7609. "PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"
  7610. ],
  7611. updateDiscussionInOrg: [
  7612. "PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"
  7613. ],
  7614. updateInOrg: ["PATCH /orgs/{org}/teams/{team_slug}"]
  7615. },
  7616. users: {
  7617. addEmailForAuthenticated: [
  7618. "POST /user/emails",
  7619. {},
  7620. { renamed: ["users", "addEmailForAuthenticatedUser"] }
  7621. ],
  7622. addEmailForAuthenticatedUser: ["POST /user/emails"],
  7623. addSocialAccountForAuthenticatedUser: ["POST /user/social_accounts"],
  7624. block: ["PUT /user/blocks/{username}"],
  7625. checkBlocked: ["GET /user/blocks/{username}"],
  7626. checkFollowingForUser: ["GET /users/{username}/following/{target_user}"],
  7627. checkPersonIsFollowedByAuthenticated: ["GET /user/following/{username}"],
  7628. createGpgKeyForAuthenticated: [
  7629. "POST /user/gpg_keys",
  7630. {},
  7631. { renamed: ["users", "createGpgKeyForAuthenticatedUser"] }
  7632. ],
  7633. createGpgKeyForAuthenticatedUser: ["POST /user/gpg_keys"],
  7634. createPublicSshKeyForAuthenticated: [
  7635. "POST /user/keys",
  7636. {},
  7637. { renamed: ["users", "createPublicSshKeyForAuthenticatedUser"] }
  7638. ],
  7639. createPublicSshKeyForAuthenticatedUser: ["POST /user/keys"],
  7640. createSshSigningKeyForAuthenticatedUser: ["POST /user/ssh_signing_keys"],
  7641. deleteEmailForAuthenticated: [
  7642. "DELETE /user/emails",
  7643. {},
  7644. { renamed: ["users", "deleteEmailForAuthenticatedUser"] }
  7645. ],
  7646. deleteEmailForAuthenticatedUser: ["DELETE /user/emails"],
  7647. deleteGpgKeyForAuthenticated: [
  7648. "DELETE /user/gpg_keys/{gpg_key_id}",
  7649. {},
  7650. { renamed: ["users", "deleteGpgKeyForAuthenticatedUser"] }
  7651. ],
  7652. deleteGpgKeyForAuthenticatedUser: ["DELETE /user/gpg_keys/{gpg_key_id}"],
  7653. deletePublicSshKeyForAuthenticated: [
  7654. "DELETE /user/keys/{key_id}",
  7655. {},
  7656. { renamed: ["users", "deletePublicSshKeyForAuthenticatedUser"] }
  7657. ],
  7658. deletePublicSshKeyForAuthenticatedUser: ["DELETE /user/keys/{key_id}"],
  7659. deleteSocialAccountForAuthenticatedUser: ["DELETE /user/social_accounts"],
  7660. deleteSshSigningKeyForAuthenticatedUser: [
  7661. "DELETE /user/ssh_signing_keys/{ssh_signing_key_id}"
  7662. ],
  7663. follow: ["PUT /user/following/{username}"],
  7664. getAuthenticated: ["GET /user"],
  7665. getByUsername: ["GET /users/{username}"],
  7666. getContextForUser: ["GET /users/{username}/hovercard"],
  7667. getGpgKeyForAuthenticated: [
  7668. "GET /user/gpg_keys/{gpg_key_id}",
  7669. {},
  7670. { renamed: ["users", "getGpgKeyForAuthenticatedUser"] }
  7671. ],
  7672. getGpgKeyForAuthenticatedUser: ["GET /user/gpg_keys/{gpg_key_id}"],
  7673. getPublicSshKeyForAuthenticated: [
  7674. "GET /user/keys/{key_id}",
  7675. {},
  7676. { renamed: ["users", "getPublicSshKeyForAuthenticatedUser"] }
  7677. ],
  7678. getPublicSshKeyForAuthenticatedUser: ["GET /user/keys/{key_id}"],
  7679. getSshSigningKeyForAuthenticatedUser: [
  7680. "GET /user/ssh_signing_keys/{ssh_signing_key_id}"
  7681. ],
  7682. list: ["GET /users"],
  7683. listBlockedByAuthenticated: [
  7684. "GET /user/blocks",
  7685. {},
  7686. { renamed: ["users", "listBlockedByAuthenticatedUser"] }
  7687. ],
  7688. listBlockedByAuthenticatedUser: ["GET /user/blocks"],
  7689. listEmailsForAuthenticated: [
  7690. "GET /user/emails",
  7691. {},
  7692. { renamed: ["users", "listEmailsForAuthenticatedUser"] }
  7693. ],
  7694. listEmailsForAuthenticatedUser: ["GET /user/emails"],
  7695. listFollowedByAuthenticated: [
  7696. "GET /user/following",
  7697. {},
  7698. { renamed: ["users", "listFollowedByAuthenticatedUser"] }
  7699. ],
  7700. listFollowedByAuthenticatedUser: ["GET /user/following"],
  7701. listFollowersForAuthenticatedUser: ["GET /user/followers"],
  7702. listFollowersForUser: ["GET /users/{username}/followers"],
  7703. listFollowingForUser: ["GET /users/{username}/following"],
  7704. listGpgKeysForAuthenticated: [
  7705. "GET /user/gpg_keys",
  7706. {},
  7707. { renamed: ["users", "listGpgKeysForAuthenticatedUser"] }
  7708. ],
  7709. listGpgKeysForAuthenticatedUser: ["GET /user/gpg_keys"],
  7710. listGpgKeysForUser: ["GET /users/{username}/gpg_keys"],
  7711. listPublicEmailsForAuthenticated: [
  7712. "GET /user/public_emails",
  7713. {},
  7714. { renamed: ["users", "listPublicEmailsForAuthenticatedUser"] }
  7715. ],
  7716. listPublicEmailsForAuthenticatedUser: ["GET /user/public_emails"],
  7717. listPublicKeysForUser: ["GET /users/{username}/keys"],
  7718. listPublicSshKeysForAuthenticated: [
  7719. "GET /user/keys",
  7720. {},
  7721. { renamed: ["users", "listPublicSshKeysForAuthenticatedUser"] }
  7722. ],
  7723. listPublicSshKeysForAuthenticatedUser: ["GET /user/keys"],
  7724. listSocialAccountsForAuthenticatedUser: ["GET /user/social_accounts"],
  7725. listSocialAccountsForUser: ["GET /users/{username}/social_accounts"],
  7726. listSshSigningKeysForAuthenticatedUser: ["GET /user/ssh_signing_keys"],
  7727. listSshSigningKeysForUser: ["GET /users/{username}/ssh_signing_keys"],
  7728. setPrimaryEmailVisibilityForAuthenticated: [
  7729. "PATCH /user/email/visibility",
  7730. {},
  7731. { renamed: ["users", "setPrimaryEmailVisibilityForAuthenticatedUser"] }
  7732. ],
  7733. setPrimaryEmailVisibilityForAuthenticatedUser: [
  7734. "PATCH /user/email/visibility"
  7735. ],
  7736. unblock: ["DELETE /user/blocks/{username}"],
  7737. unfollow: ["DELETE /user/following/{username}"],
  7738. updateAuthenticated: ["PATCH /user"]
  7739. }
  7740. };
  7741. var endpoints_default = Endpoints;
  7742. // pkg/dist-src/endpoints-to-methods.js
  7743. var endpointMethodsMap = /* @__PURE__ */ new Map();
  7744. for (const [scope, endpoints] of Object.entries(endpoints_default)) {
  7745. for (const [methodName, endpoint] of Object.entries(endpoints)) {
  7746. const [route, defaults, decorations] = endpoint;
  7747. const [method, url] = route.split(/ /);
  7748. const endpointDefaults = Object.assign(
  7749. {
  7750. method,
  7751. url
  7752. },
  7753. defaults
  7754. );
  7755. if (!endpointMethodsMap.has(scope)) {
  7756. endpointMethodsMap.set(scope, /* @__PURE__ */ new Map());
  7757. }
  7758. endpointMethodsMap.get(scope).set(methodName, {
  7759. scope,
  7760. methodName,
  7761. endpointDefaults,
  7762. decorations
  7763. });
  7764. }
  7765. }
  7766. var handler = {
  7767. has({ scope }, methodName) {
  7768. return endpointMethodsMap.get(scope).has(methodName);
  7769. },
  7770. getOwnPropertyDescriptor(target, methodName) {
  7771. return {
  7772. value: this.get(target, methodName),
  7773. // ensures method is in the cache
  7774. configurable: true,
  7775. writable: true,
  7776. enumerable: true
  7777. };
  7778. },
  7779. defineProperty(target, methodName, descriptor) {
  7780. Object.defineProperty(target.cache, methodName, descriptor);
  7781. return true;
  7782. },
  7783. deleteProperty(target, methodName) {
  7784. delete target.cache[methodName];
  7785. return true;
  7786. },
  7787. ownKeys({ scope }) {
  7788. return [...endpointMethodsMap.get(scope).keys()];
  7789. },
  7790. set(target, methodName, value) {
  7791. return target.cache[methodName] = value;
  7792. },
  7793. get({ octokit, scope, cache }, methodName) {
  7794. if (cache[methodName]) {
  7795. return cache[methodName];
  7796. }
  7797. const method = endpointMethodsMap.get(scope).get(methodName);
  7798. if (!method) {
  7799. return void 0;
  7800. }
  7801. const { endpointDefaults, decorations } = method;
  7802. if (decorations) {
  7803. cache[methodName] = decorate(
  7804. octokit,
  7805. scope,
  7806. methodName,
  7807. endpointDefaults,
  7808. decorations
  7809. );
  7810. } else {
  7811. cache[methodName] = octokit.request.defaults(endpointDefaults);
  7812. }
  7813. return cache[methodName];
  7814. }
  7815. };
  7816. function endpointsToMethods(octokit) {
  7817. const newMethods = {};
  7818. for (const scope of endpointMethodsMap.keys()) {
  7819. newMethods[scope] = new Proxy({ octokit, scope, cache: {} }, handler);
  7820. }
  7821. return newMethods;
  7822. }
  7823. function decorate(octokit, scope, methodName, defaults, decorations) {
  7824. const requestWithDefaults = octokit.request.defaults(defaults);
  7825. function withDecorations(...args) {
  7826. let options = requestWithDefaults.endpoint.merge(...args);
  7827. if (decorations.mapToData) {
  7828. options = Object.assign({}, options, {
  7829. data: options[decorations.mapToData],
  7830. [decorations.mapToData]: void 0
  7831. });
  7832. return requestWithDefaults(options);
  7833. }
  7834. if (decorations.renamed) {
  7835. const [newScope, newMethodName] = decorations.renamed;
  7836. octokit.log.warn(
  7837. `octokit.${scope}.${methodName}() has been renamed to octokit.${newScope}.${newMethodName}()`
  7838. );
  7839. }
  7840. if (decorations.deprecated) {
  7841. octokit.log.warn(decorations.deprecated);
  7842. }
  7843. if (decorations.renamedParameters) {
  7844. const options2 = requestWithDefaults.endpoint.merge(...args);
  7845. for (const [name, alias] of Object.entries(
  7846. decorations.renamedParameters
  7847. )) {
  7848. if (name in options2) {
  7849. octokit.log.warn(
  7850. `"${name}" parameter is deprecated for "octokit.${scope}.${methodName}()". Use "${alias}" instead`
  7851. );
  7852. if (!(alias in options2)) {
  7853. options2[alias] = options2[name];
  7854. }
  7855. delete options2[name];
  7856. }
  7857. }
  7858. return requestWithDefaults(options2);
  7859. }
  7860. return requestWithDefaults(...args);
  7861. }
  7862. return Object.assign(withDecorations, requestWithDefaults);
  7863. }
  7864. // pkg/dist-src/index.js
  7865. function restEndpointMethods(octokit) {
  7866. const api = endpointsToMethods(octokit);
  7867. return {
  7868. rest: api
  7869. };
  7870. }
  7871. restEndpointMethods.VERSION = VERSION;
  7872. function legacyRestEndpointMethods(octokit) {
  7873. const api = endpointsToMethods(octokit);
  7874. return {
  7875. ...api,
  7876. rest: api
  7877. };
  7878. }
  7879. legacyRestEndpointMethods.VERSION = VERSION;
  7880. // Annotate the CommonJS export names for ESM import in node:
  7881. 0 && (0);
  7882. /***/ }),
  7883. /***/ 537:
  7884. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  7885. var __create = Object.create;
  7886. var __defProp = Object.defineProperty;
  7887. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  7888. var __getOwnPropNames = Object.getOwnPropertyNames;
  7889. var __getProtoOf = Object.getPrototypeOf;
  7890. var __hasOwnProp = Object.prototype.hasOwnProperty;
  7891. var __export = (target, all) => {
  7892. for (var name in all)
  7893. __defProp(target, name, { get: all[name], enumerable: true });
  7894. };
  7895. var __copyProps = (to, from, except, desc) => {
  7896. if (from && typeof from === "object" || typeof from === "function") {
  7897. for (let key of __getOwnPropNames(from))
  7898. if (!__hasOwnProp.call(to, key) && key !== except)
  7899. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  7900. }
  7901. return to;
  7902. };
  7903. var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  7904. // If the importer is in node compatibility mode or this is not an ESM
  7905. // file that has been converted to a CommonJS file using a Babel-
  7906. // compatible transform (i.e. "__esModule" has not been set), then set
  7907. // "default" to the CommonJS "module.exports" for node compatibility.
  7908. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  7909. mod
  7910. ));
  7911. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  7912. // pkg/dist-src/index.js
  7913. var dist_src_exports = {};
  7914. __export(dist_src_exports, {
  7915. RequestError: () => RequestError
  7916. });
  7917. module.exports = __toCommonJS(dist_src_exports);
  7918. var import_deprecation = __nccwpck_require__(8932);
  7919. var import_once = __toESM(__nccwpck_require__(1223));
  7920. var logOnceCode = (0, import_once.default)((deprecation) => console.warn(deprecation));
  7921. var logOnceHeaders = (0, import_once.default)((deprecation) => console.warn(deprecation));
  7922. var RequestError = class extends Error {
  7923. constructor(message, statusCode, options) {
  7924. super(message);
  7925. if (Error.captureStackTrace) {
  7926. Error.captureStackTrace(this, this.constructor);
  7927. }
  7928. this.name = "HttpError";
  7929. this.status = statusCode;
  7930. let headers;
  7931. if ("headers" in options && typeof options.headers !== "undefined") {
  7932. headers = options.headers;
  7933. }
  7934. if ("response" in options) {
  7935. this.response = options.response;
  7936. headers = options.response.headers;
  7937. }
  7938. const requestCopy = Object.assign({}, options.request);
  7939. if (options.request.headers.authorization) {
  7940. requestCopy.headers = Object.assign({}, options.request.headers, {
  7941. authorization: options.request.headers.authorization.replace(
  7942. /(?<! ) .*$/,
  7943. " [REDACTED]"
  7944. )
  7945. });
  7946. }
  7947. requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]");
  7948. this.request = requestCopy;
  7949. Object.defineProperty(this, "code", {
  7950. get() {
  7951. logOnceCode(
  7952. new import_deprecation.Deprecation(
  7953. "[@octokit/request-error] `error.code` is deprecated, use `error.status`."
  7954. )
  7955. );
  7956. return statusCode;
  7957. }
  7958. });
  7959. Object.defineProperty(this, "headers", {
  7960. get() {
  7961. logOnceHeaders(
  7962. new import_deprecation.Deprecation(
  7963. "[@octokit/request-error] `error.headers` is deprecated, use `error.response.headers`."
  7964. )
  7965. );
  7966. return headers || {};
  7967. }
  7968. });
  7969. }
  7970. };
  7971. // Annotate the CommonJS export names for ESM import in node:
  7972. 0 && (0);
  7973. /***/ }),
  7974. /***/ 6234:
  7975. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  7976. var __defProp = Object.defineProperty;
  7977. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  7978. var __getOwnPropNames = Object.getOwnPropertyNames;
  7979. var __hasOwnProp = Object.prototype.hasOwnProperty;
  7980. var __export = (target, all) => {
  7981. for (var name in all)
  7982. __defProp(target, name, { get: all[name], enumerable: true });
  7983. };
  7984. var __copyProps = (to, from, except, desc) => {
  7985. if (from && typeof from === "object" || typeof from === "function") {
  7986. for (let key of __getOwnPropNames(from))
  7987. if (!__hasOwnProp.call(to, key) && key !== except)
  7988. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  7989. }
  7990. return to;
  7991. };
  7992. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  7993. // pkg/dist-src/index.js
  7994. var dist_src_exports = {};
  7995. __export(dist_src_exports, {
  7996. request: () => request
  7997. });
  7998. module.exports = __toCommonJS(dist_src_exports);
  7999. var import_endpoint = __nccwpck_require__(9440);
  8000. var import_universal_user_agent = __nccwpck_require__(5030);
  8001. // pkg/dist-src/version.js
  8002. var VERSION = "8.4.1";
  8003. // pkg/dist-src/is-plain-object.js
  8004. function isPlainObject(value) {
  8005. if (typeof value !== "object" || value === null)
  8006. return false;
  8007. if (Object.prototype.toString.call(value) !== "[object Object]")
  8008. return false;
  8009. const proto = Object.getPrototypeOf(value);
  8010. if (proto === null)
  8011. return true;
  8012. const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
  8013. return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
  8014. }
  8015. // pkg/dist-src/fetch-wrapper.js
  8016. var import_request_error = __nccwpck_require__(537);
  8017. // pkg/dist-src/get-buffer-response.js
  8018. function getBufferResponse(response) {
  8019. return response.arrayBuffer();
  8020. }
  8021. // pkg/dist-src/fetch-wrapper.js
  8022. function fetchWrapper(requestOptions) {
  8023. var _a, _b, _c, _d;
  8024. const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console;
  8025. const parseSuccessResponseBody = ((_a = requestOptions.request) == null ? void 0 : _a.parseSuccessResponseBody) !== false;
  8026. if (isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) {
  8027. requestOptions.body = JSON.stringify(requestOptions.body);
  8028. }
  8029. let headers = {};
  8030. let status;
  8031. let url;
  8032. let { fetch } = globalThis;
  8033. if ((_b = requestOptions.request) == null ? void 0 : _b.fetch) {
  8034. fetch = requestOptions.request.fetch;
  8035. }
  8036. if (!fetch) {
  8037. throw new Error(
  8038. "fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing"
  8039. );
  8040. }
  8041. return fetch(requestOptions.url, {
  8042. method: requestOptions.method,
  8043. body: requestOptions.body,
  8044. redirect: (_c = requestOptions.request) == null ? void 0 : _c.redirect,
  8045. headers: requestOptions.headers,
  8046. signal: (_d = requestOptions.request) == null ? void 0 : _d.signal,
  8047. // duplex must be set if request.body is ReadableStream or Async Iterables.
  8048. // See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
  8049. ...requestOptions.body && { duplex: "half" }
  8050. }).then(async (response) => {
  8051. url = response.url;
  8052. status = response.status;
  8053. for (const keyAndValue of response.headers) {
  8054. headers[keyAndValue[0]] = keyAndValue[1];
  8055. }
  8056. if ("deprecation" in headers) {
  8057. const matches = headers.link && headers.link.match(/<([^<>]+)>; rel="deprecation"/);
  8058. const deprecationLink = matches && matches.pop();
  8059. log.warn(
  8060. `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${headers.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
  8061. );
  8062. }
  8063. if (status === 204 || status === 205) {
  8064. return;
  8065. }
  8066. if (requestOptions.method === "HEAD") {
  8067. if (status < 400) {
  8068. return;
  8069. }
  8070. throw new import_request_error.RequestError(response.statusText, status, {
  8071. response: {
  8072. url,
  8073. status,
  8074. headers,
  8075. data: void 0
  8076. },
  8077. request: requestOptions
  8078. });
  8079. }
  8080. if (status === 304) {
  8081. throw new import_request_error.RequestError("Not modified", status, {
  8082. response: {
  8083. url,
  8084. status,
  8085. headers,
  8086. data: await getResponseData(response)
  8087. },
  8088. request: requestOptions
  8089. });
  8090. }
  8091. if (status >= 400) {
  8092. const data = await getResponseData(response);
  8093. const error = new import_request_error.RequestError(toErrorMessage(data), status, {
  8094. response: {
  8095. url,
  8096. status,
  8097. headers,
  8098. data
  8099. },
  8100. request: requestOptions
  8101. });
  8102. throw error;
  8103. }
  8104. return parseSuccessResponseBody ? await getResponseData(response) : response.body;
  8105. }).then((data) => {
  8106. return {
  8107. status,
  8108. url,
  8109. headers,
  8110. data
  8111. };
  8112. }).catch((error) => {
  8113. if (error instanceof import_request_error.RequestError)
  8114. throw error;
  8115. else if (error.name === "AbortError")
  8116. throw error;
  8117. let message = error.message;
  8118. if (error.name === "TypeError" && "cause" in error) {
  8119. if (error.cause instanceof Error) {
  8120. message = error.cause.message;
  8121. } else if (typeof error.cause === "string") {
  8122. message = error.cause;
  8123. }
  8124. }
  8125. throw new import_request_error.RequestError(message, 500, {
  8126. request: requestOptions
  8127. });
  8128. });
  8129. }
  8130. async function getResponseData(response) {
  8131. const contentType = response.headers.get("content-type");
  8132. if (/application\/json/.test(contentType)) {
  8133. return response.json().catch(() => response.text()).catch(() => "");
  8134. }
  8135. if (!contentType || /^text\/|charset=utf-8$/.test(contentType)) {
  8136. return response.text();
  8137. }
  8138. return getBufferResponse(response);
  8139. }
  8140. function toErrorMessage(data) {
  8141. if (typeof data === "string")
  8142. return data;
  8143. let suffix;
  8144. if ("documentation_url" in data) {
  8145. suffix = ` - ${data.documentation_url}`;
  8146. } else {
  8147. suffix = "";
  8148. }
  8149. if ("message" in data) {
  8150. if (Array.isArray(data.errors)) {
  8151. return `${data.message}: ${data.errors.map(JSON.stringify).join(", ")}${suffix}`;
  8152. }
  8153. return `${data.message}${suffix}`;
  8154. }
  8155. return `Unknown error: ${JSON.stringify(data)}`;
  8156. }
  8157. // pkg/dist-src/with-defaults.js
  8158. function withDefaults(oldEndpoint, newDefaults) {
  8159. const endpoint2 = oldEndpoint.defaults(newDefaults);
  8160. const newApi = function(route, parameters) {
  8161. const endpointOptions = endpoint2.merge(route, parameters);
  8162. if (!endpointOptions.request || !endpointOptions.request.hook) {
  8163. return fetchWrapper(endpoint2.parse(endpointOptions));
  8164. }
  8165. const request2 = (route2, parameters2) => {
  8166. return fetchWrapper(
  8167. endpoint2.parse(endpoint2.merge(route2, parameters2))
  8168. );
  8169. };
  8170. Object.assign(request2, {
  8171. endpoint: endpoint2,
  8172. defaults: withDefaults.bind(null, endpoint2)
  8173. });
  8174. return endpointOptions.request.hook(request2, endpointOptions);
  8175. };
  8176. return Object.assign(newApi, {
  8177. endpoint: endpoint2,
  8178. defaults: withDefaults.bind(null, endpoint2)
  8179. });
  8180. }
  8181. // pkg/dist-src/index.js
  8182. var request = withDefaults(import_endpoint.endpoint, {
  8183. headers: {
  8184. "user-agent": `octokit-request.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`
  8185. }
  8186. });
  8187. // Annotate the CommonJS export names for ESM import in node:
  8188. 0 && (0);
  8189. /***/ }),
  8190. /***/ 3682:
  8191. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  8192. var register = __nccwpck_require__(4670);
  8193. var addHook = __nccwpck_require__(5549);
  8194. var removeHook = __nccwpck_require__(6819);
  8195. // bind with array of arguments: https://stackoverflow.com/a/21792913
  8196. var bind = Function.bind;
  8197. var bindable = bind.bind(bind);
  8198. function bindApi(hook, state, name) {
  8199. var removeHookRef = bindable(removeHook, null).apply(
  8200. null,
  8201. name ? [state, name] : [state]
  8202. );
  8203. hook.api = { remove: removeHookRef };
  8204. hook.remove = removeHookRef;
  8205. ["before", "error", "after", "wrap"].forEach(function (kind) {
  8206. var args = name ? [state, kind, name] : [state, kind];
  8207. hook[kind] = hook.api[kind] = bindable(addHook, null).apply(null, args);
  8208. });
  8209. }
  8210. function HookSingular() {
  8211. var singularHookName = "h";
  8212. var singularHookState = {
  8213. registry: {},
  8214. };
  8215. var singularHook = register.bind(null, singularHookState, singularHookName);
  8216. bindApi(singularHook, singularHookState, singularHookName);
  8217. return singularHook;
  8218. }
  8219. function HookCollection() {
  8220. var state = {
  8221. registry: {},
  8222. };
  8223. var hook = register.bind(null, state);
  8224. bindApi(hook, state);
  8225. return hook;
  8226. }
  8227. var collectionHookDeprecationMessageDisplayed = false;
  8228. function Hook() {
  8229. if (!collectionHookDeprecationMessageDisplayed) {
  8230. console.warn(
  8231. '[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4'
  8232. );
  8233. collectionHookDeprecationMessageDisplayed = true;
  8234. }
  8235. return HookCollection();
  8236. }
  8237. Hook.Singular = HookSingular.bind();
  8238. Hook.Collection = HookCollection.bind();
  8239. module.exports = Hook;
  8240. // expose constructors as a named property for TypeScript
  8241. module.exports.Hook = Hook;
  8242. module.exports.Singular = Hook.Singular;
  8243. module.exports.Collection = Hook.Collection;
  8244. /***/ }),
  8245. /***/ 5549:
  8246. /***/ ((module) => {
  8247. module.exports = addHook;
  8248. function addHook(state, kind, name, hook) {
  8249. var orig = hook;
  8250. if (!state.registry[name]) {
  8251. state.registry[name] = [];
  8252. }
  8253. if (kind === "before") {
  8254. hook = function (method, options) {
  8255. return Promise.resolve()
  8256. .then(orig.bind(null, options))
  8257. .then(method.bind(null, options));
  8258. };
  8259. }
  8260. if (kind === "after") {
  8261. hook = function (method, options) {
  8262. var result;
  8263. return Promise.resolve()
  8264. .then(method.bind(null, options))
  8265. .then(function (result_) {
  8266. result = result_;
  8267. return orig(result, options);
  8268. })
  8269. .then(function () {
  8270. return result;
  8271. });
  8272. };
  8273. }
  8274. if (kind === "error") {
  8275. hook = function (method, options) {
  8276. return Promise.resolve()
  8277. .then(method.bind(null, options))
  8278. .catch(function (error) {
  8279. return orig(error, options);
  8280. });
  8281. };
  8282. }
  8283. state.registry[name].push({
  8284. hook: hook,
  8285. orig: orig,
  8286. });
  8287. }
  8288. /***/ }),
  8289. /***/ 4670:
  8290. /***/ ((module) => {
  8291. module.exports = register;
  8292. function register(state, name, method, options) {
  8293. if (typeof method !== "function") {
  8294. throw new Error("method for before hook must be a function");
  8295. }
  8296. if (!options) {
  8297. options = {};
  8298. }
  8299. if (Array.isArray(name)) {
  8300. return name.reverse().reduce(function (callback, name) {
  8301. return register.bind(null, state, name, callback, options);
  8302. }, method)();
  8303. }
  8304. return Promise.resolve().then(function () {
  8305. if (!state.registry[name]) {
  8306. return method(options);
  8307. }
  8308. return state.registry[name].reduce(function (method, registered) {
  8309. return registered.hook.bind(null, method, options);
  8310. }, method)();
  8311. });
  8312. }
  8313. /***/ }),
  8314. /***/ 6819:
  8315. /***/ ((module) => {
  8316. module.exports = removeHook;
  8317. function removeHook(state, name, method) {
  8318. if (!state.registry[name]) {
  8319. return;
  8320. }
  8321. var index = state.registry[name]
  8322. .map(function (registered) {
  8323. return registered.orig;
  8324. })
  8325. .indexOf(method);
  8326. if (index === -1) {
  8327. return;
  8328. }
  8329. state.registry[name].splice(index, 1);
  8330. }
  8331. /***/ }),
  8332. /***/ 8932:
  8333. /***/ ((__unused_webpack_module, exports) => {
  8334. Object.defineProperty(exports, "__esModule", ({ value: true }));
  8335. class Deprecation extends Error {
  8336. constructor(message) {
  8337. super(message); // Maintains proper stack trace (only available on V8)
  8338. /* istanbul ignore next */
  8339. if (Error.captureStackTrace) {
  8340. Error.captureStackTrace(this, this.constructor);
  8341. }
  8342. this.name = 'Deprecation';
  8343. }
  8344. }
  8345. exports.Deprecation = Deprecation;
  8346. /***/ }),
  8347. /***/ 1223:
  8348. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  8349. var wrappy = __nccwpck_require__(2940)
  8350. module.exports = wrappy(once)
  8351. module.exports.strict = wrappy(onceStrict)
  8352. once.proto = once(function () {
  8353. Object.defineProperty(Function.prototype, 'once', {
  8354. value: function () {
  8355. return once(this)
  8356. },
  8357. configurable: true
  8358. })
  8359. Object.defineProperty(Function.prototype, 'onceStrict', {
  8360. value: function () {
  8361. return onceStrict(this)
  8362. },
  8363. configurable: true
  8364. })
  8365. })
  8366. function once (fn) {
  8367. var f = function () {
  8368. if (f.called) return f.value
  8369. f.called = true
  8370. return f.value = fn.apply(this, arguments)
  8371. }
  8372. f.called = false
  8373. return f
  8374. }
  8375. function onceStrict (fn) {
  8376. var f = function () {
  8377. if (f.called)
  8378. throw new Error(f.onceError)
  8379. f.called = true
  8380. return f.value = fn.apply(this, arguments)
  8381. }
  8382. var name = fn.name || 'Function wrapped with `once`'
  8383. f.onceError = name + " shouldn't be called more than once"
  8384. f.called = false
  8385. return f
  8386. }
  8387. /***/ }),
  8388. /***/ 5911:
  8389. /***/ ((module, exports) => {
  8390. exports = module.exports = SemVer
  8391. var debug
  8392. /* istanbul ignore next */
  8393. if (typeof process === 'object' &&
  8394. process.env &&
  8395. process.env.NODE_DEBUG &&
  8396. /\bsemver\b/i.test(process.env.NODE_DEBUG)) {
  8397. debug = function () {
  8398. var args = Array.prototype.slice.call(arguments, 0)
  8399. args.unshift('SEMVER')
  8400. console.log.apply(console, args)
  8401. }
  8402. } else {
  8403. debug = function () {}
  8404. }
  8405. // Note: this is the semver.org version of the spec that it implements
  8406. // Not necessarily the package version of this code.
  8407. exports.SEMVER_SPEC_VERSION = '2.0.0'
  8408. var MAX_LENGTH = 256
  8409. var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
  8410. /* istanbul ignore next */ 9007199254740991
  8411. // Max safe segment length for coercion.
  8412. var MAX_SAFE_COMPONENT_LENGTH = 16
  8413. var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6
  8414. // The actual regexps go on exports.re
  8415. var re = exports.re = []
  8416. var safeRe = exports.safeRe = []
  8417. var src = exports.src = []
  8418. var t = exports.tokens = {}
  8419. var R = 0
  8420. function tok (n) {
  8421. t[n] = R++
  8422. }
  8423. var LETTERDASHNUMBER = '[a-zA-Z0-9-]'
  8424. // Replace some greedy regex tokens to prevent regex dos issues. These regex are
  8425. // used internally via the safeRe object since all inputs in this library get
  8426. // normalized first to trim and collapse all extra whitespace. The original
  8427. // regexes are exported for userland consumption and lower level usage. A
  8428. // future breaking change could export the safer regex only with a note that
  8429. // all input should have extra whitespace removed.
  8430. var safeRegexReplacements = [
  8431. ['\\s', 1],
  8432. ['\\d', MAX_LENGTH],
  8433. [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
  8434. ]
  8435. function makeSafeRe (value) {
  8436. for (var i = 0; i < safeRegexReplacements.length; i++) {
  8437. var token = safeRegexReplacements[i][0]
  8438. var max = safeRegexReplacements[i][1]
  8439. value = value
  8440. .split(token + '*').join(token + '{0,' + max + '}')
  8441. .split(token + '+').join(token + '{1,' + max + '}')
  8442. }
  8443. return value
  8444. }
  8445. // The following Regular Expressions can be used for tokenizing,
  8446. // validating, and parsing SemVer version strings.
  8447. // ## Numeric Identifier
  8448. // A single `0`, or a non-zero digit followed by zero or more digits.
  8449. tok('NUMERICIDENTIFIER')
  8450. src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*'
  8451. tok('NUMERICIDENTIFIERLOOSE')
  8452. src[t.NUMERICIDENTIFIERLOOSE] = '\\d+'
  8453. // ## Non-numeric Identifier
  8454. // Zero or more digits, followed by a letter or hyphen, and then zero or
  8455. // more letters, digits, or hyphens.
  8456. tok('NONNUMERICIDENTIFIER')
  8457. src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*'
  8458. // ## Main Version
  8459. // Three dot-separated numeric identifiers.
  8460. tok('MAINVERSION')
  8461. src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' +
  8462. '(' + src[t.NUMERICIDENTIFIER] + ')\\.' +
  8463. '(' + src[t.NUMERICIDENTIFIER] + ')'
  8464. tok('MAINVERSIONLOOSE')
  8465. src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' +
  8466. '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' +
  8467. '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')'
  8468. // ## Pre-release Version Identifier
  8469. // A numeric identifier, or a non-numeric identifier.
  8470. tok('PRERELEASEIDENTIFIER')
  8471. src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] +
  8472. '|' + src[t.NONNUMERICIDENTIFIER] + ')'
  8473. tok('PRERELEASEIDENTIFIERLOOSE')
  8474. src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] +
  8475. '|' + src[t.NONNUMERICIDENTIFIER] + ')'
  8476. // ## Pre-release Version
  8477. // Hyphen, followed by one or more dot-separated pre-release version
  8478. // identifiers.
  8479. tok('PRERELEASE')
  8480. src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] +
  8481. '(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))'
  8482. tok('PRERELEASELOOSE')
  8483. src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] +
  8484. '(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))'
  8485. // ## Build Metadata Identifier
  8486. // Any combination of digits, letters, or hyphens.
  8487. tok('BUILDIDENTIFIER')
  8488. src[t.BUILDIDENTIFIER] = LETTERDASHNUMBER + '+'
  8489. // ## Build Metadata
  8490. // Plus sign, followed by one or more period-separated build metadata
  8491. // identifiers.
  8492. tok('BUILD')
  8493. src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] +
  8494. '(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))'
  8495. // ## Full Version String
  8496. // A main version, followed optionally by a pre-release version and
  8497. // build metadata.
  8498. // Note that the only major, minor, patch, and pre-release sections of
  8499. // the version string are capturing groups. The build metadata is not a
  8500. // capturing group, because it should not ever be used in version
  8501. // comparison.
  8502. tok('FULL')
  8503. tok('FULLPLAIN')
  8504. src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] +
  8505. src[t.PRERELEASE] + '?' +
  8506. src[t.BUILD] + '?'
  8507. src[t.FULL] = '^' + src[t.FULLPLAIN] + '$'
  8508. // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
  8509. // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
  8510. // common in the npm registry.
  8511. tok('LOOSEPLAIN')
  8512. src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] +
  8513. src[t.PRERELEASELOOSE] + '?' +
  8514. src[t.BUILD] + '?'
  8515. tok('LOOSE')
  8516. src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$'
  8517. tok('GTLT')
  8518. src[t.GTLT] = '((?:<|>)?=?)'
  8519. // Something like "2.*" or "1.2.x".
  8520. // Note that "x.x" is a valid xRange identifer, meaning "any version"
  8521. // Only the first item is strictly required.
  8522. tok('XRANGEIDENTIFIERLOOSE')
  8523. src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'
  8524. tok('XRANGEIDENTIFIER')
  8525. src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*'
  8526. tok('XRANGEPLAIN')
  8527. src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' +
  8528. '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' +
  8529. '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' +
  8530. '(?:' + src[t.PRERELEASE] + ')?' +
  8531. src[t.BUILD] + '?' +
  8532. ')?)?'
  8533. tok('XRANGEPLAINLOOSE')
  8534. src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
  8535. '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
  8536. '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
  8537. '(?:' + src[t.PRERELEASELOOSE] + ')?' +
  8538. src[t.BUILD] + '?' +
  8539. ')?)?'
  8540. tok('XRANGE')
  8541. src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$'
  8542. tok('XRANGELOOSE')
  8543. src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$'
  8544. // Coercion.
  8545. // Extract anything that could conceivably be a part of a valid semver
  8546. tok('COERCE')
  8547. src[t.COERCE] = '(^|[^\\d])' +
  8548. '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +
  8549. '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
  8550. '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
  8551. '(?:$|[^\\d])'
  8552. tok('COERCERTL')
  8553. re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g')
  8554. safeRe[t.COERCERTL] = new RegExp(makeSafeRe(src[t.COERCE]), 'g')
  8555. // Tilde ranges.
  8556. // Meaning is "reasonably at or greater than"
  8557. tok('LONETILDE')
  8558. src[t.LONETILDE] = '(?:~>?)'
  8559. tok('TILDETRIM')
  8560. src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+'
  8561. re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g')
  8562. safeRe[t.TILDETRIM] = new RegExp(makeSafeRe(src[t.TILDETRIM]), 'g')
  8563. var tildeTrimReplace = '$1~'
  8564. tok('TILDE')
  8565. src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$'
  8566. tok('TILDELOOSE')
  8567. src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$'
  8568. // Caret ranges.
  8569. // Meaning is "at least and backwards compatible with"
  8570. tok('LONECARET')
  8571. src[t.LONECARET] = '(?:\\^)'
  8572. tok('CARETTRIM')
  8573. src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+'
  8574. re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g')
  8575. safeRe[t.CARETTRIM] = new RegExp(makeSafeRe(src[t.CARETTRIM]), 'g')
  8576. var caretTrimReplace = '$1^'
  8577. tok('CARET')
  8578. src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$'
  8579. tok('CARETLOOSE')
  8580. src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$'
  8581. // A simple gt/lt/eq thing, or just "" to indicate "any version"
  8582. tok('COMPARATORLOOSE')
  8583. src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$'
  8584. tok('COMPARATOR')
  8585. src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$'
  8586. // An expression to strip any whitespace between the gtlt and the thing
  8587. // it modifies, so that `> 1.2.3` ==> `>1.2.3`
  8588. tok('COMPARATORTRIM')
  8589. src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] +
  8590. '\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')'
  8591. // this one has to use the /g flag
  8592. re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g')
  8593. safeRe[t.COMPARATORTRIM] = new RegExp(makeSafeRe(src[t.COMPARATORTRIM]), 'g')
  8594. var comparatorTrimReplace = '$1$2$3'
  8595. // Something like `1.2.3 - 1.2.4`
  8596. // Note that these all use the loose form, because they'll be
  8597. // checked against either the strict or loose comparator form
  8598. // later.
  8599. tok('HYPHENRANGE')
  8600. src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' +
  8601. '\\s+-\\s+' +
  8602. '(' + src[t.XRANGEPLAIN] + ')' +
  8603. '\\s*$'
  8604. tok('HYPHENRANGELOOSE')
  8605. src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' +
  8606. '\\s+-\\s+' +
  8607. '(' + src[t.XRANGEPLAINLOOSE] + ')' +
  8608. '\\s*$'
  8609. // Star ranges basically just allow anything at all.
  8610. tok('STAR')
  8611. src[t.STAR] = '(<|>)?=?\\s*\\*'
  8612. // Compile to actual regexp objects.
  8613. // All are flag-free, unless they were created above with a flag.
  8614. for (var i = 0; i < R; i++) {
  8615. debug(i, src[i])
  8616. if (!re[i]) {
  8617. re[i] = new RegExp(src[i])
  8618. // Replace all greedy whitespace to prevent regex dos issues. These regex are
  8619. // used internally via the safeRe object since all inputs in this library get
  8620. // normalized first to trim and collapse all extra whitespace. The original
  8621. // regexes are exported for userland consumption and lower level usage. A
  8622. // future breaking change could export the safer regex only with a note that
  8623. // all input should have extra whitespace removed.
  8624. safeRe[i] = new RegExp(makeSafeRe(src[i]))
  8625. }
  8626. }
  8627. exports.parse = parse
  8628. function parse (version, options) {
  8629. if (!options || typeof options !== 'object') {
  8630. options = {
  8631. loose: !!options,
  8632. includePrerelease: false
  8633. }
  8634. }
  8635. if (version instanceof SemVer) {
  8636. return version
  8637. }
  8638. if (typeof version !== 'string') {
  8639. return null
  8640. }
  8641. if (version.length > MAX_LENGTH) {
  8642. return null
  8643. }
  8644. var r = options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL]
  8645. if (!r.test(version)) {
  8646. return null
  8647. }
  8648. try {
  8649. return new SemVer(version, options)
  8650. } catch (er) {
  8651. return null
  8652. }
  8653. }
  8654. exports.valid = valid
  8655. function valid (version, options) {
  8656. var v = parse(version, options)
  8657. return v ? v.version : null
  8658. }
  8659. exports.clean = clean
  8660. function clean (version, options) {
  8661. var s = parse(version.trim().replace(/^[=v]+/, ''), options)
  8662. return s ? s.version : null
  8663. }
  8664. exports.SemVer = SemVer
  8665. function SemVer (version, options) {
  8666. if (!options || typeof options !== 'object') {
  8667. options = {
  8668. loose: !!options,
  8669. includePrerelease: false
  8670. }
  8671. }
  8672. if (version instanceof SemVer) {
  8673. if (version.loose === options.loose) {
  8674. return version
  8675. } else {
  8676. version = version.version
  8677. }
  8678. } else if (typeof version !== 'string') {
  8679. throw new TypeError('Invalid Version: ' + version)
  8680. }
  8681. if (version.length > MAX_LENGTH) {
  8682. throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters')
  8683. }
  8684. if (!(this instanceof SemVer)) {
  8685. return new SemVer(version, options)
  8686. }
  8687. debug('SemVer', version, options)
  8688. this.options = options
  8689. this.loose = !!options.loose
  8690. var m = version.trim().match(options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL])
  8691. if (!m) {
  8692. throw new TypeError('Invalid Version: ' + version)
  8693. }
  8694. this.raw = version
  8695. // these are actually numbers
  8696. this.major = +m[1]
  8697. this.minor = +m[2]
  8698. this.patch = +m[3]
  8699. if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
  8700. throw new TypeError('Invalid major version')
  8701. }
  8702. if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
  8703. throw new TypeError('Invalid minor version')
  8704. }
  8705. if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
  8706. throw new TypeError('Invalid patch version')
  8707. }
  8708. // numberify any prerelease numeric ids
  8709. if (!m[4]) {
  8710. this.prerelease = []
  8711. } else {
  8712. this.prerelease = m[4].split('.').map(function (id) {
  8713. if (/^[0-9]+$/.test(id)) {
  8714. var num = +id
  8715. if (num >= 0 && num < MAX_SAFE_INTEGER) {
  8716. return num
  8717. }
  8718. }
  8719. return id
  8720. })
  8721. }
  8722. this.build = m[5] ? m[5].split('.') : []
  8723. this.format()
  8724. }
  8725. SemVer.prototype.format = function () {
  8726. this.version = this.major + '.' + this.minor + '.' + this.patch
  8727. if (this.prerelease.length) {
  8728. this.version += '-' + this.prerelease.join('.')
  8729. }
  8730. return this.version
  8731. }
  8732. SemVer.prototype.toString = function () {
  8733. return this.version
  8734. }
  8735. SemVer.prototype.compare = function (other) {
  8736. debug('SemVer.compare', this.version, this.options, other)
  8737. if (!(other instanceof SemVer)) {
  8738. other = new SemVer(other, this.options)
  8739. }
  8740. return this.compareMain(other) || this.comparePre(other)
  8741. }
  8742. SemVer.prototype.compareMain = function (other) {
  8743. if (!(other instanceof SemVer)) {
  8744. other = new SemVer(other, this.options)
  8745. }
  8746. return compareIdentifiers(this.major, other.major) ||
  8747. compareIdentifiers(this.minor, other.minor) ||
  8748. compareIdentifiers(this.patch, other.patch)
  8749. }
  8750. SemVer.prototype.comparePre = function (other) {
  8751. if (!(other instanceof SemVer)) {
  8752. other = new SemVer(other, this.options)
  8753. }
  8754. // NOT having a prerelease is > having one
  8755. if (this.prerelease.length && !other.prerelease.length) {
  8756. return -1
  8757. } else if (!this.prerelease.length && other.prerelease.length) {
  8758. return 1
  8759. } else if (!this.prerelease.length && !other.prerelease.length) {
  8760. return 0
  8761. }
  8762. var i = 0
  8763. do {
  8764. var a = this.prerelease[i]
  8765. var b = other.prerelease[i]
  8766. debug('prerelease compare', i, a, b)
  8767. if (a === undefined && b === undefined) {
  8768. return 0
  8769. } else if (b === undefined) {
  8770. return 1
  8771. } else if (a === undefined) {
  8772. return -1
  8773. } else if (a === b) {
  8774. continue
  8775. } else {
  8776. return compareIdentifiers(a, b)
  8777. }
  8778. } while (++i)
  8779. }
  8780. SemVer.prototype.compareBuild = function (other) {
  8781. if (!(other instanceof SemVer)) {
  8782. other = new SemVer(other, this.options)
  8783. }
  8784. var i = 0
  8785. do {
  8786. var a = this.build[i]
  8787. var b = other.build[i]
  8788. debug('prerelease compare', i, a, b)
  8789. if (a === undefined && b === undefined) {
  8790. return 0
  8791. } else if (b === undefined) {
  8792. return 1
  8793. } else if (a === undefined) {
  8794. return -1
  8795. } else if (a === b) {
  8796. continue
  8797. } else {
  8798. return compareIdentifiers(a, b)
  8799. }
  8800. } while (++i)
  8801. }
  8802. // preminor will bump the version up to the next minor release, and immediately
  8803. // down to pre-release. premajor and prepatch work the same way.
  8804. SemVer.prototype.inc = function (release, identifier) {
  8805. switch (release) {
  8806. case 'premajor':
  8807. this.prerelease.length = 0
  8808. this.patch = 0
  8809. this.minor = 0
  8810. this.major++
  8811. this.inc('pre', identifier)
  8812. break
  8813. case 'preminor':
  8814. this.prerelease.length = 0
  8815. this.patch = 0
  8816. this.minor++
  8817. this.inc('pre', identifier)
  8818. break
  8819. case 'prepatch':
  8820. // If this is already a prerelease, it will bump to the next version
  8821. // drop any prereleases that might already exist, since they are not
  8822. // relevant at this point.
  8823. this.prerelease.length = 0
  8824. this.inc('patch', identifier)
  8825. this.inc('pre', identifier)
  8826. break
  8827. // If the input is a non-prerelease version, this acts the same as
  8828. // prepatch.
  8829. case 'prerelease':
  8830. if (this.prerelease.length === 0) {
  8831. this.inc('patch', identifier)
  8832. }
  8833. this.inc('pre', identifier)
  8834. break
  8835. case 'major':
  8836. // If this is a pre-major version, bump up to the same major version.
  8837. // Otherwise increment major.
  8838. // 1.0.0-5 bumps to 1.0.0
  8839. // 1.1.0 bumps to 2.0.0
  8840. if (this.minor !== 0 ||
  8841. this.patch !== 0 ||
  8842. this.prerelease.length === 0) {
  8843. this.major++
  8844. }
  8845. this.minor = 0
  8846. this.patch = 0
  8847. this.prerelease = []
  8848. break
  8849. case 'minor':
  8850. // If this is a pre-minor version, bump up to the same minor version.
  8851. // Otherwise increment minor.
  8852. // 1.2.0-5 bumps to 1.2.0
  8853. // 1.2.1 bumps to 1.3.0
  8854. if (this.patch !== 0 || this.prerelease.length === 0) {
  8855. this.minor++
  8856. }
  8857. this.patch = 0
  8858. this.prerelease = []
  8859. break
  8860. case 'patch':
  8861. // If this is not a pre-release version, it will increment the patch.
  8862. // If it is a pre-release it will bump up to the same patch version.
  8863. // 1.2.0-5 patches to 1.2.0
  8864. // 1.2.0 patches to 1.2.1
  8865. if (this.prerelease.length === 0) {
  8866. this.patch++
  8867. }
  8868. this.prerelease = []
  8869. break
  8870. // This probably shouldn't be used publicly.
  8871. // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
  8872. case 'pre':
  8873. if (this.prerelease.length === 0) {
  8874. this.prerelease = [0]
  8875. } else {
  8876. var i = this.prerelease.length
  8877. while (--i >= 0) {
  8878. if (typeof this.prerelease[i] === 'number') {
  8879. this.prerelease[i]++
  8880. i = -2
  8881. }
  8882. }
  8883. if (i === -1) {
  8884. // didn't increment anything
  8885. this.prerelease.push(0)
  8886. }
  8887. }
  8888. if (identifier) {
  8889. // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
  8890. // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
  8891. if (this.prerelease[0] === identifier) {
  8892. if (isNaN(this.prerelease[1])) {
  8893. this.prerelease = [identifier, 0]
  8894. }
  8895. } else {
  8896. this.prerelease = [identifier, 0]
  8897. }
  8898. }
  8899. break
  8900. default:
  8901. throw new Error('invalid increment argument: ' + release)
  8902. }
  8903. this.format()
  8904. this.raw = this.version
  8905. return this
  8906. }
  8907. exports.inc = inc
  8908. function inc (version, release, loose, identifier) {
  8909. if (typeof (loose) === 'string') {
  8910. identifier = loose
  8911. loose = undefined
  8912. }
  8913. try {
  8914. return new SemVer(version, loose).inc(release, identifier).version
  8915. } catch (er) {
  8916. return null
  8917. }
  8918. }
  8919. exports.diff = diff
  8920. function diff (version1, version2) {
  8921. if (eq(version1, version2)) {
  8922. return null
  8923. } else {
  8924. var v1 = parse(version1)
  8925. var v2 = parse(version2)
  8926. var prefix = ''
  8927. if (v1.prerelease.length || v2.prerelease.length) {
  8928. prefix = 'pre'
  8929. var defaultResult = 'prerelease'
  8930. }
  8931. for (var key in v1) {
  8932. if (key === 'major' || key === 'minor' || key === 'patch') {
  8933. if (v1[key] !== v2[key]) {
  8934. return prefix + key
  8935. }
  8936. }
  8937. }
  8938. return defaultResult // may be undefined
  8939. }
  8940. }
  8941. exports.compareIdentifiers = compareIdentifiers
  8942. var numeric = /^[0-9]+$/
  8943. function compareIdentifiers (a, b) {
  8944. var anum = numeric.test(a)
  8945. var bnum = numeric.test(b)
  8946. if (anum && bnum) {
  8947. a = +a
  8948. b = +b
  8949. }
  8950. return a === b ? 0
  8951. : (anum && !bnum) ? -1
  8952. : (bnum && !anum) ? 1
  8953. : a < b ? -1
  8954. : 1
  8955. }
  8956. exports.rcompareIdentifiers = rcompareIdentifiers
  8957. function rcompareIdentifiers (a, b) {
  8958. return compareIdentifiers(b, a)
  8959. }
  8960. exports.major = major
  8961. function major (a, loose) {
  8962. return new SemVer(a, loose).major
  8963. }
  8964. exports.minor = minor
  8965. function minor (a, loose) {
  8966. return new SemVer(a, loose).minor
  8967. }
  8968. exports.patch = patch
  8969. function patch (a, loose) {
  8970. return new SemVer(a, loose).patch
  8971. }
  8972. exports.compare = compare
  8973. function compare (a, b, loose) {
  8974. return new SemVer(a, loose).compare(new SemVer(b, loose))
  8975. }
  8976. exports.compareLoose = compareLoose
  8977. function compareLoose (a, b) {
  8978. return compare(a, b, true)
  8979. }
  8980. exports.compareBuild = compareBuild
  8981. function compareBuild (a, b, loose) {
  8982. var versionA = new SemVer(a, loose)
  8983. var versionB = new SemVer(b, loose)
  8984. return versionA.compare(versionB) || versionA.compareBuild(versionB)
  8985. }
  8986. exports.rcompare = rcompare
  8987. function rcompare (a, b, loose) {
  8988. return compare(b, a, loose)
  8989. }
  8990. exports.sort = sort
  8991. function sort (list, loose) {
  8992. return list.sort(function (a, b) {
  8993. return exports.compareBuild(a, b, loose)
  8994. })
  8995. }
  8996. exports.rsort = rsort
  8997. function rsort (list, loose) {
  8998. return list.sort(function (a, b) {
  8999. return exports.compareBuild(b, a, loose)
  9000. })
  9001. }
  9002. exports.gt = gt
  9003. function gt (a, b, loose) {
  9004. return compare(a, b, loose) > 0
  9005. }
  9006. exports.lt = lt
  9007. function lt (a, b, loose) {
  9008. return compare(a, b, loose) < 0
  9009. }
  9010. exports.eq = eq
  9011. function eq (a, b, loose) {
  9012. return compare(a, b, loose) === 0
  9013. }
  9014. exports.neq = neq
  9015. function neq (a, b, loose) {
  9016. return compare(a, b, loose) !== 0
  9017. }
  9018. exports.gte = gte
  9019. function gte (a, b, loose) {
  9020. return compare(a, b, loose) >= 0
  9021. }
  9022. exports.lte = lte
  9023. function lte (a, b, loose) {
  9024. return compare(a, b, loose) <= 0
  9025. }
  9026. exports.cmp = cmp
  9027. function cmp (a, op, b, loose) {
  9028. switch (op) {
  9029. case '===':
  9030. if (typeof a === 'object')
  9031. a = a.version
  9032. if (typeof b === 'object')
  9033. b = b.version
  9034. return a === b
  9035. case '!==':
  9036. if (typeof a === 'object')
  9037. a = a.version
  9038. if (typeof b === 'object')
  9039. b = b.version
  9040. return a !== b
  9041. case '':
  9042. case '=':
  9043. case '==':
  9044. return eq(a, b, loose)
  9045. case '!=':
  9046. return neq(a, b, loose)
  9047. case '>':
  9048. return gt(a, b, loose)
  9049. case '>=':
  9050. return gte(a, b, loose)
  9051. case '<':
  9052. return lt(a, b, loose)
  9053. case '<=':
  9054. return lte(a, b, loose)
  9055. default:
  9056. throw new TypeError('Invalid operator: ' + op)
  9057. }
  9058. }
  9059. exports.Comparator = Comparator
  9060. function Comparator (comp, options) {
  9061. if (!options || typeof options !== 'object') {
  9062. options = {
  9063. loose: !!options,
  9064. includePrerelease: false
  9065. }
  9066. }
  9067. if (comp instanceof Comparator) {
  9068. if (comp.loose === !!options.loose) {
  9069. return comp
  9070. } else {
  9071. comp = comp.value
  9072. }
  9073. }
  9074. if (!(this instanceof Comparator)) {
  9075. return new Comparator(comp, options)
  9076. }
  9077. comp = comp.trim().split(/\s+/).join(' ')
  9078. debug('comparator', comp, options)
  9079. this.options = options
  9080. this.loose = !!options.loose
  9081. this.parse(comp)
  9082. if (this.semver === ANY) {
  9083. this.value = ''
  9084. } else {
  9085. this.value = this.operator + this.semver.version
  9086. }
  9087. debug('comp', this)
  9088. }
  9089. var ANY = {}
  9090. Comparator.prototype.parse = function (comp) {
  9091. var r = this.options.loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR]
  9092. var m = comp.match(r)
  9093. if (!m) {
  9094. throw new TypeError('Invalid comparator: ' + comp)
  9095. }
  9096. this.operator = m[1] !== undefined ? m[1] : ''
  9097. if (this.operator === '=') {
  9098. this.operator = ''
  9099. }
  9100. // if it literally is just '>' or '' then allow anything.
  9101. if (!m[2]) {
  9102. this.semver = ANY
  9103. } else {
  9104. this.semver = new SemVer(m[2], this.options.loose)
  9105. }
  9106. }
  9107. Comparator.prototype.toString = function () {
  9108. return this.value
  9109. }
  9110. Comparator.prototype.test = function (version) {
  9111. debug('Comparator.test', version, this.options.loose)
  9112. if (this.semver === ANY || version === ANY) {
  9113. return true
  9114. }
  9115. if (typeof version === 'string') {
  9116. try {
  9117. version = new SemVer(version, this.options)
  9118. } catch (er) {
  9119. return false
  9120. }
  9121. }
  9122. return cmp(version, this.operator, this.semver, this.options)
  9123. }
  9124. Comparator.prototype.intersects = function (comp, options) {
  9125. if (!(comp instanceof Comparator)) {
  9126. throw new TypeError('a Comparator is required')
  9127. }
  9128. if (!options || typeof options !== 'object') {
  9129. options = {
  9130. loose: !!options,
  9131. includePrerelease: false
  9132. }
  9133. }
  9134. var rangeTmp
  9135. if (this.operator === '') {
  9136. if (this.value === '') {
  9137. return true
  9138. }
  9139. rangeTmp = new Range(comp.value, options)
  9140. return satisfies(this.value, rangeTmp, options)
  9141. } else if (comp.operator === '') {
  9142. if (comp.value === '') {
  9143. return true
  9144. }
  9145. rangeTmp = new Range(this.value, options)
  9146. return satisfies(comp.semver, rangeTmp, options)
  9147. }
  9148. var sameDirectionIncreasing =
  9149. (this.operator === '>=' || this.operator === '>') &&
  9150. (comp.operator === '>=' || comp.operator === '>')
  9151. var sameDirectionDecreasing =
  9152. (this.operator === '<=' || this.operator === '<') &&
  9153. (comp.operator === '<=' || comp.operator === '<')
  9154. var sameSemVer = this.semver.version === comp.semver.version
  9155. var differentDirectionsInclusive =
  9156. (this.operator === '>=' || this.operator === '<=') &&
  9157. (comp.operator === '>=' || comp.operator === '<=')
  9158. var oppositeDirectionsLessThan =
  9159. cmp(this.semver, '<', comp.semver, options) &&
  9160. ((this.operator === '>=' || this.operator === '>') &&
  9161. (comp.operator === '<=' || comp.operator === '<'))
  9162. var oppositeDirectionsGreaterThan =
  9163. cmp(this.semver, '>', comp.semver, options) &&
  9164. ((this.operator === '<=' || this.operator === '<') &&
  9165. (comp.operator === '>=' || comp.operator === '>'))
  9166. return sameDirectionIncreasing || sameDirectionDecreasing ||
  9167. (sameSemVer && differentDirectionsInclusive) ||
  9168. oppositeDirectionsLessThan || oppositeDirectionsGreaterThan
  9169. }
  9170. exports.Range = Range
  9171. function Range (range, options) {
  9172. if (!options || typeof options !== 'object') {
  9173. options = {
  9174. loose: !!options,
  9175. includePrerelease: false
  9176. }
  9177. }
  9178. if (range instanceof Range) {
  9179. if (range.loose === !!options.loose &&
  9180. range.includePrerelease === !!options.includePrerelease) {
  9181. return range
  9182. } else {
  9183. return new Range(range.raw, options)
  9184. }
  9185. }
  9186. if (range instanceof Comparator) {
  9187. return new Range(range.value, options)
  9188. }
  9189. if (!(this instanceof Range)) {
  9190. return new Range(range, options)
  9191. }
  9192. this.options = options
  9193. this.loose = !!options.loose
  9194. this.includePrerelease = !!options.includePrerelease
  9195. // First reduce all whitespace as much as possible so we do not have to rely
  9196. // on potentially slow regexes like \s*. This is then stored and used for
  9197. // future error messages as well.
  9198. this.raw = range
  9199. .trim()
  9200. .split(/\s+/)
  9201. .join(' ')
  9202. // First, split based on boolean or ||
  9203. this.set = this.raw.split('||').map(function (range) {
  9204. return this.parseRange(range.trim())
  9205. }, this).filter(function (c) {
  9206. // throw out any that are not relevant for whatever reason
  9207. return c.length
  9208. })
  9209. if (!this.set.length) {
  9210. throw new TypeError('Invalid SemVer Range: ' + this.raw)
  9211. }
  9212. this.format()
  9213. }
  9214. Range.prototype.format = function () {
  9215. this.range = this.set.map(function (comps) {
  9216. return comps.join(' ').trim()
  9217. }).join('||').trim()
  9218. return this.range
  9219. }
  9220. Range.prototype.toString = function () {
  9221. return this.range
  9222. }
  9223. Range.prototype.parseRange = function (range) {
  9224. var loose = this.options.loose
  9225. // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
  9226. var hr = loose ? safeRe[t.HYPHENRANGELOOSE] : safeRe[t.HYPHENRANGE]
  9227. range = range.replace(hr, hyphenReplace)
  9228. debug('hyphen replace', range)
  9229. // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
  9230. range = range.replace(safeRe[t.COMPARATORTRIM], comparatorTrimReplace)
  9231. debug('comparator trim', range, safeRe[t.COMPARATORTRIM])
  9232. // `~ 1.2.3` => `~1.2.3`
  9233. range = range.replace(safeRe[t.TILDETRIM], tildeTrimReplace)
  9234. // `^ 1.2.3` => `^1.2.3`
  9235. range = range.replace(safeRe[t.CARETTRIM], caretTrimReplace)
  9236. // normalize spaces
  9237. range = range.split(/\s+/).join(' ')
  9238. // At this point, the range is completely trimmed and
  9239. // ready to be split into comparators.
  9240. var compRe = loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR]
  9241. var set = range.split(' ').map(function (comp) {
  9242. return parseComparator(comp, this.options)
  9243. }, this).join(' ').split(/\s+/)
  9244. if (this.options.loose) {
  9245. // in loose mode, throw out any that are not valid comparators
  9246. set = set.filter(function (comp) {
  9247. return !!comp.match(compRe)
  9248. })
  9249. }
  9250. set = set.map(function (comp) {
  9251. return new Comparator(comp, this.options)
  9252. }, this)
  9253. return set
  9254. }
  9255. Range.prototype.intersects = function (range, options) {
  9256. if (!(range instanceof Range)) {
  9257. throw new TypeError('a Range is required')
  9258. }
  9259. return this.set.some(function (thisComparators) {
  9260. return (
  9261. isSatisfiable(thisComparators, options) &&
  9262. range.set.some(function (rangeComparators) {
  9263. return (
  9264. isSatisfiable(rangeComparators, options) &&
  9265. thisComparators.every(function (thisComparator) {
  9266. return rangeComparators.every(function (rangeComparator) {
  9267. return thisComparator.intersects(rangeComparator, options)
  9268. })
  9269. })
  9270. )
  9271. })
  9272. )
  9273. })
  9274. }
  9275. // take a set of comparators and determine whether there
  9276. // exists a version which can satisfy it
  9277. function isSatisfiable (comparators, options) {
  9278. var result = true
  9279. var remainingComparators = comparators.slice()
  9280. var testComparator = remainingComparators.pop()
  9281. while (result && remainingComparators.length) {
  9282. result = remainingComparators.every(function (otherComparator) {
  9283. return testComparator.intersects(otherComparator, options)
  9284. })
  9285. testComparator = remainingComparators.pop()
  9286. }
  9287. return result
  9288. }
  9289. // Mostly just for testing and legacy API reasons
  9290. exports.toComparators = toComparators
  9291. function toComparators (range, options) {
  9292. return new Range(range, options).set.map(function (comp) {
  9293. return comp.map(function (c) {
  9294. return c.value
  9295. }).join(' ').trim().split(' ')
  9296. })
  9297. }
  9298. // comprised of xranges, tildes, stars, and gtlt's at this point.
  9299. // already replaced the hyphen ranges
  9300. // turn into a set of JUST comparators.
  9301. function parseComparator (comp, options) {
  9302. debug('comp', comp, options)
  9303. comp = replaceCarets(comp, options)
  9304. debug('caret', comp)
  9305. comp = replaceTildes(comp, options)
  9306. debug('tildes', comp)
  9307. comp = replaceXRanges(comp, options)
  9308. debug('xrange', comp)
  9309. comp = replaceStars(comp, options)
  9310. debug('stars', comp)
  9311. return comp
  9312. }
  9313. function isX (id) {
  9314. return !id || id.toLowerCase() === 'x' || id === '*'
  9315. }
  9316. // ~, ~> --> * (any, kinda silly)
  9317. // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
  9318. // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
  9319. // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
  9320. // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
  9321. // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
  9322. function replaceTildes (comp, options) {
  9323. return comp.trim().split(/\s+/).map(function (comp) {
  9324. return replaceTilde(comp, options)
  9325. }).join(' ')
  9326. }
  9327. function replaceTilde (comp, options) {
  9328. var r = options.loose ? safeRe[t.TILDELOOSE] : safeRe[t.TILDE]
  9329. return comp.replace(r, function (_, M, m, p, pr) {
  9330. debug('tilde', comp, _, M, m, p, pr)
  9331. var ret
  9332. if (isX(M)) {
  9333. ret = ''
  9334. } else if (isX(m)) {
  9335. ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'
  9336. } else if (isX(p)) {
  9337. // ~1.2 == >=1.2.0 <1.3.0
  9338. ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'
  9339. } else if (pr) {
  9340. debug('replaceTilde pr', pr)
  9341. ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
  9342. ' <' + M + '.' + (+m + 1) + '.0'
  9343. } else {
  9344. // ~1.2.3 == >=1.2.3 <1.3.0
  9345. ret = '>=' + M + '.' + m + '.' + p +
  9346. ' <' + M + '.' + (+m + 1) + '.0'
  9347. }
  9348. debug('tilde return', ret)
  9349. return ret
  9350. })
  9351. }
  9352. // ^ --> * (any, kinda silly)
  9353. // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
  9354. // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
  9355. // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
  9356. // ^1.2.3 --> >=1.2.3 <2.0.0
  9357. // ^1.2.0 --> >=1.2.0 <2.0.0
  9358. function replaceCarets (comp, options) {
  9359. return comp.trim().split(/\s+/).map(function (comp) {
  9360. return replaceCaret(comp, options)
  9361. }).join(' ')
  9362. }
  9363. function replaceCaret (comp, options) {
  9364. debug('caret', comp, options)
  9365. var r = options.loose ? safeRe[t.CARETLOOSE] : safeRe[t.CARET]
  9366. return comp.replace(r, function (_, M, m, p, pr) {
  9367. debug('caret', comp, _, M, m, p, pr)
  9368. var ret
  9369. if (isX(M)) {
  9370. ret = ''
  9371. } else if (isX(m)) {
  9372. ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'
  9373. } else if (isX(p)) {
  9374. if (M === '0') {
  9375. ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'
  9376. } else {
  9377. ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'
  9378. }
  9379. } else if (pr) {
  9380. debug('replaceCaret pr', pr)
  9381. if (M === '0') {
  9382. if (m === '0') {
  9383. ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
  9384. ' <' + M + '.' + m + '.' + (+p + 1)
  9385. } else {
  9386. ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
  9387. ' <' + M + '.' + (+m + 1) + '.0'
  9388. }
  9389. } else {
  9390. ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
  9391. ' <' + (+M + 1) + '.0.0'
  9392. }
  9393. } else {
  9394. debug('no pr')
  9395. if (M === '0') {
  9396. if (m === '0') {
  9397. ret = '>=' + M + '.' + m + '.' + p +
  9398. ' <' + M + '.' + m + '.' + (+p + 1)
  9399. } else {
  9400. ret = '>=' + M + '.' + m + '.' + p +
  9401. ' <' + M + '.' + (+m + 1) + '.0'
  9402. }
  9403. } else {
  9404. ret = '>=' + M + '.' + m + '.' + p +
  9405. ' <' + (+M + 1) + '.0.0'
  9406. }
  9407. }
  9408. debug('caret return', ret)
  9409. return ret
  9410. })
  9411. }
  9412. function replaceXRanges (comp, options) {
  9413. debug('replaceXRanges', comp, options)
  9414. return comp.split(/\s+/).map(function (comp) {
  9415. return replaceXRange(comp, options)
  9416. }).join(' ')
  9417. }
  9418. function replaceXRange (comp, options) {
  9419. comp = comp.trim()
  9420. var r = options.loose ? safeRe[t.XRANGELOOSE] : safeRe[t.XRANGE]
  9421. return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
  9422. debug('xRange', comp, ret, gtlt, M, m, p, pr)
  9423. var xM = isX(M)
  9424. var xm = xM || isX(m)
  9425. var xp = xm || isX(p)
  9426. var anyX = xp
  9427. if (gtlt === '=' && anyX) {
  9428. gtlt = ''
  9429. }
  9430. // if we're including prereleases in the match, then we need
  9431. // to fix this to -0, the lowest possible prerelease value
  9432. pr = options.includePrerelease ? '-0' : ''
  9433. if (xM) {
  9434. if (gtlt === '>' || gtlt === '<') {
  9435. // nothing is allowed
  9436. ret = '<0.0.0-0'
  9437. } else {
  9438. // nothing is forbidden
  9439. ret = '*'
  9440. }
  9441. } else if (gtlt && anyX) {
  9442. // we know patch is an x, because we have any x at all.
  9443. // replace X with 0
  9444. if (xm) {
  9445. m = 0
  9446. }
  9447. p = 0
  9448. if (gtlt === '>') {
  9449. // >1 => >=2.0.0
  9450. // >1.2 => >=1.3.0
  9451. // >1.2.3 => >= 1.2.4
  9452. gtlt = '>='
  9453. if (xm) {
  9454. M = +M + 1
  9455. m = 0
  9456. p = 0
  9457. } else {
  9458. m = +m + 1
  9459. p = 0
  9460. }
  9461. } else if (gtlt === '<=') {
  9462. // <=0.7.x is actually <0.8.0, since any 0.7.x should
  9463. // pass. Similarly, <=7.x is actually <8.0.0, etc.
  9464. gtlt = '<'
  9465. if (xm) {
  9466. M = +M + 1
  9467. } else {
  9468. m = +m + 1
  9469. }
  9470. }
  9471. ret = gtlt + M + '.' + m + '.' + p + pr
  9472. } else if (xm) {
  9473. ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr
  9474. } else if (xp) {
  9475. ret = '>=' + M + '.' + m + '.0' + pr +
  9476. ' <' + M + '.' + (+m + 1) + '.0' + pr
  9477. }
  9478. debug('xRange return', ret)
  9479. return ret
  9480. })
  9481. }
  9482. // Because * is AND-ed with everything else in the comparator,
  9483. // and '' means "any version", just remove the *s entirely.
  9484. function replaceStars (comp, options) {
  9485. debug('replaceStars', comp, options)
  9486. // Looseness is ignored here. star is always as loose as it gets!
  9487. return comp.trim().replace(safeRe[t.STAR], '')
  9488. }
  9489. // This function is passed to string.replace(re[t.HYPHENRANGE])
  9490. // M, m, patch, prerelease, build
  9491. // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
  9492. // 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
  9493. // 1.2 - 3.4 => >=1.2.0 <3.5.0
  9494. function hyphenReplace ($0,
  9495. from, fM, fm, fp, fpr, fb,
  9496. to, tM, tm, tp, tpr, tb) {
  9497. if (isX(fM)) {
  9498. from = ''
  9499. } else if (isX(fm)) {
  9500. from = '>=' + fM + '.0.0'
  9501. } else if (isX(fp)) {
  9502. from = '>=' + fM + '.' + fm + '.0'
  9503. } else {
  9504. from = '>=' + from
  9505. }
  9506. if (isX(tM)) {
  9507. to = ''
  9508. } else if (isX(tm)) {
  9509. to = '<' + (+tM + 1) + '.0.0'
  9510. } else if (isX(tp)) {
  9511. to = '<' + tM + '.' + (+tm + 1) + '.0'
  9512. } else if (tpr) {
  9513. to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr
  9514. } else {
  9515. to = '<=' + to
  9516. }
  9517. return (from + ' ' + to).trim()
  9518. }
  9519. // if ANY of the sets match ALL of its comparators, then pass
  9520. Range.prototype.test = function (version) {
  9521. if (!version) {
  9522. return false
  9523. }
  9524. if (typeof version === 'string') {
  9525. try {
  9526. version = new SemVer(version, this.options)
  9527. } catch (er) {
  9528. return false
  9529. }
  9530. }
  9531. for (var i = 0; i < this.set.length; i++) {
  9532. if (testSet(this.set[i], version, this.options)) {
  9533. return true
  9534. }
  9535. }
  9536. return false
  9537. }
  9538. function testSet (set, version, options) {
  9539. for (var i = 0; i < set.length; i++) {
  9540. if (!set[i].test(version)) {
  9541. return false
  9542. }
  9543. }
  9544. if (version.prerelease.length && !options.includePrerelease) {
  9545. // Find the set of versions that are allowed to have prereleases
  9546. // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
  9547. // That should allow `1.2.3-pr.2` to pass.
  9548. // However, `1.2.4-alpha.notready` should NOT be allowed,
  9549. // even though it's within the range set by the comparators.
  9550. for (i = 0; i < set.length; i++) {
  9551. debug(set[i].semver)
  9552. if (set[i].semver === ANY) {
  9553. continue
  9554. }
  9555. if (set[i].semver.prerelease.length > 0) {
  9556. var allowed = set[i].semver
  9557. if (allowed.major === version.major &&
  9558. allowed.minor === version.minor &&
  9559. allowed.patch === version.patch) {
  9560. return true
  9561. }
  9562. }
  9563. }
  9564. // Version has a -pre, but it's not one of the ones we like.
  9565. return false
  9566. }
  9567. return true
  9568. }
  9569. exports.satisfies = satisfies
  9570. function satisfies (version, range, options) {
  9571. try {
  9572. range = new Range(range, options)
  9573. } catch (er) {
  9574. return false
  9575. }
  9576. return range.test(version)
  9577. }
  9578. exports.maxSatisfying = maxSatisfying
  9579. function maxSatisfying (versions, range, options) {
  9580. var max = null
  9581. var maxSV = null
  9582. try {
  9583. var rangeObj = new Range(range, options)
  9584. } catch (er) {
  9585. return null
  9586. }
  9587. versions.forEach(function (v) {
  9588. if (rangeObj.test(v)) {
  9589. // satisfies(v, range, options)
  9590. if (!max || maxSV.compare(v) === -1) {
  9591. // compare(max, v, true)
  9592. max = v
  9593. maxSV = new SemVer(max, options)
  9594. }
  9595. }
  9596. })
  9597. return max
  9598. }
  9599. exports.minSatisfying = minSatisfying
  9600. function minSatisfying (versions, range, options) {
  9601. var min = null
  9602. var minSV = null
  9603. try {
  9604. var rangeObj = new Range(range, options)
  9605. } catch (er) {
  9606. return null
  9607. }
  9608. versions.forEach(function (v) {
  9609. if (rangeObj.test(v)) {
  9610. // satisfies(v, range, options)
  9611. if (!min || minSV.compare(v) === 1) {
  9612. // compare(min, v, true)
  9613. min = v
  9614. minSV = new SemVer(min, options)
  9615. }
  9616. }
  9617. })
  9618. return min
  9619. }
  9620. exports.minVersion = minVersion
  9621. function minVersion (range, loose) {
  9622. range = new Range(range, loose)
  9623. var minver = new SemVer('0.0.0')
  9624. if (range.test(minver)) {
  9625. return minver
  9626. }
  9627. minver = new SemVer('0.0.0-0')
  9628. if (range.test(minver)) {
  9629. return minver
  9630. }
  9631. minver = null
  9632. for (var i = 0; i < range.set.length; ++i) {
  9633. var comparators = range.set[i]
  9634. comparators.forEach(function (comparator) {
  9635. // Clone to avoid manipulating the comparator's semver object.
  9636. var compver = new SemVer(comparator.semver.version)
  9637. switch (comparator.operator) {
  9638. case '>':
  9639. if (compver.prerelease.length === 0) {
  9640. compver.patch++
  9641. } else {
  9642. compver.prerelease.push(0)
  9643. }
  9644. compver.raw = compver.format()
  9645. /* fallthrough */
  9646. case '':
  9647. case '>=':
  9648. if (!minver || gt(minver, compver)) {
  9649. minver = compver
  9650. }
  9651. break
  9652. case '<':
  9653. case '<=':
  9654. /* Ignore maximum versions */
  9655. break
  9656. /* istanbul ignore next */
  9657. default:
  9658. throw new Error('Unexpected operation: ' + comparator.operator)
  9659. }
  9660. })
  9661. }
  9662. if (minver && range.test(minver)) {
  9663. return minver
  9664. }
  9665. return null
  9666. }
  9667. exports.validRange = validRange
  9668. function validRange (range, options) {
  9669. try {
  9670. // Return '*' instead of '' so that truthiness works.
  9671. // This will throw if it's invalid anyway
  9672. return new Range(range, options).range || '*'
  9673. } catch (er) {
  9674. return null
  9675. }
  9676. }
  9677. // Determine if version is less than all the versions possible in the range
  9678. exports.ltr = ltr
  9679. function ltr (version, range, options) {
  9680. return outside(version, range, '<', options)
  9681. }
  9682. // Determine if version is greater than all the versions possible in the range.
  9683. exports.gtr = gtr
  9684. function gtr (version, range, options) {
  9685. return outside(version, range, '>', options)
  9686. }
  9687. exports.outside = outside
  9688. function outside (version, range, hilo, options) {
  9689. version = new SemVer(version, options)
  9690. range = new Range(range, options)
  9691. var gtfn, ltefn, ltfn, comp, ecomp
  9692. switch (hilo) {
  9693. case '>':
  9694. gtfn = gt
  9695. ltefn = lte
  9696. ltfn = lt
  9697. comp = '>'
  9698. ecomp = '>='
  9699. break
  9700. case '<':
  9701. gtfn = lt
  9702. ltefn = gte
  9703. ltfn = gt
  9704. comp = '<'
  9705. ecomp = '<='
  9706. break
  9707. default:
  9708. throw new TypeError('Must provide a hilo val of "<" or ">"')
  9709. }
  9710. // If it satisifes the range it is not outside
  9711. if (satisfies(version, range, options)) {
  9712. return false
  9713. }
  9714. // From now on, variable terms are as if we're in "gtr" mode.
  9715. // but note that everything is flipped for the "ltr" function.
  9716. for (var i = 0; i < range.set.length; ++i) {
  9717. var comparators = range.set[i]
  9718. var high = null
  9719. var low = null
  9720. comparators.forEach(function (comparator) {
  9721. if (comparator.semver === ANY) {
  9722. comparator = new Comparator('>=0.0.0')
  9723. }
  9724. high = high || comparator
  9725. low = low || comparator
  9726. if (gtfn(comparator.semver, high.semver, options)) {
  9727. high = comparator
  9728. } else if (ltfn(comparator.semver, low.semver, options)) {
  9729. low = comparator
  9730. }
  9731. })
  9732. // If the edge version comparator has a operator then our version
  9733. // isn't outside it
  9734. if (high.operator === comp || high.operator === ecomp) {
  9735. return false
  9736. }
  9737. // If the lowest version comparator has an operator and our version
  9738. // is less than it then it isn't higher than the range
  9739. if ((!low.operator || low.operator === comp) &&
  9740. ltefn(version, low.semver)) {
  9741. return false
  9742. } else if (low.operator === ecomp && ltfn(version, low.semver)) {
  9743. return false
  9744. }
  9745. }
  9746. return true
  9747. }
  9748. exports.prerelease = prerelease
  9749. function prerelease (version, options) {
  9750. var parsed = parse(version, options)
  9751. return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
  9752. }
  9753. exports.intersects = intersects
  9754. function intersects (r1, r2, options) {
  9755. r1 = new Range(r1, options)
  9756. r2 = new Range(r2, options)
  9757. return r1.intersects(r2)
  9758. }
  9759. exports.coerce = coerce
  9760. function coerce (version, options) {
  9761. if (version instanceof SemVer) {
  9762. return version
  9763. }
  9764. if (typeof version === 'number') {
  9765. version = String(version)
  9766. }
  9767. if (typeof version !== 'string') {
  9768. return null
  9769. }
  9770. options = options || {}
  9771. var match = null
  9772. if (!options.rtl) {
  9773. match = version.match(safeRe[t.COERCE])
  9774. } else {
  9775. // Find the right-most coercible string that does not share
  9776. // a terminus with a more left-ward coercible string.
  9777. // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
  9778. //
  9779. // Walk through the string checking with a /g regexp
  9780. // Manually set the index so as to pick up overlapping matches.
  9781. // Stop when we get a match that ends at the string end, since no
  9782. // coercible string can be more right-ward without the same terminus.
  9783. var next
  9784. while ((next = safeRe[t.COERCERTL].exec(version)) &&
  9785. (!match || match.index + match[0].length !== version.length)
  9786. ) {
  9787. if (!match ||
  9788. next.index + next[0].length !== match.index + match[0].length) {
  9789. match = next
  9790. }
  9791. safeRe[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
  9792. }
  9793. // leave it in a clean state
  9794. safeRe[t.COERCERTL].lastIndex = -1
  9795. }
  9796. if (match === null) {
  9797. return null
  9798. }
  9799. return parse(match[2] +
  9800. '.' + (match[3] || '0') +
  9801. '.' + (match[4] || '0'), options)
  9802. }
  9803. /***/ }),
  9804. /***/ 4294:
  9805. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  9806. module.exports = __nccwpck_require__(4219);
  9807. /***/ }),
  9808. /***/ 4219:
  9809. /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
  9810. var net = __nccwpck_require__(1808);
  9811. var tls = __nccwpck_require__(4404);
  9812. var http = __nccwpck_require__(3685);
  9813. var https = __nccwpck_require__(5687);
  9814. var events = __nccwpck_require__(2361);
  9815. var assert = __nccwpck_require__(9491);
  9816. var util = __nccwpck_require__(3837);
  9817. exports.httpOverHttp = httpOverHttp;
  9818. exports.httpsOverHttp = httpsOverHttp;
  9819. exports.httpOverHttps = httpOverHttps;
  9820. exports.httpsOverHttps = httpsOverHttps;
  9821. function httpOverHttp(options) {
  9822. var agent = new TunnelingAgent(options);
  9823. agent.request = http.request;
  9824. return agent;
  9825. }
  9826. function httpsOverHttp(options) {
  9827. var agent = new TunnelingAgent(options);
  9828. agent.request = http.request;
  9829. agent.createSocket = createSecureSocket;
  9830. agent.defaultPort = 443;
  9831. return agent;
  9832. }
  9833. function httpOverHttps(options) {
  9834. var agent = new TunnelingAgent(options);
  9835. agent.request = https.request;
  9836. return agent;
  9837. }
  9838. function httpsOverHttps(options) {
  9839. var agent = new TunnelingAgent(options);
  9840. agent.request = https.request;
  9841. agent.createSocket = createSecureSocket;
  9842. agent.defaultPort = 443;
  9843. return agent;
  9844. }
  9845. function TunnelingAgent(options) {
  9846. var self = this;
  9847. self.options = options || {};
  9848. self.proxyOptions = self.options.proxy || {};
  9849. self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets;
  9850. self.requests = [];
  9851. self.sockets = [];
  9852. self.on('free', function onFree(socket, host, port, localAddress) {
  9853. var options = toOptions(host, port, localAddress);
  9854. for (var i = 0, len = self.requests.length; i < len; ++i) {
  9855. var pending = self.requests[i];
  9856. if (pending.host === options.host && pending.port === options.port) {
  9857. // Detect the request to connect same origin server,
  9858. // reuse the connection.
  9859. self.requests.splice(i, 1);
  9860. pending.request.onSocket(socket);
  9861. return;
  9862. }
  9863. }
  9864. socket.destroy();
  9865. self.removeSocket(socket);
  9866. });
  9867. }
  9868. util.inherits(TunnelingAgent, events.EventEmitter);
  9869. TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) {
  9870. var self = this;
  9871. var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress));
  9872. if (self.sockets.length >= this.maxSockets) {
  9873. // We are over limit so we'll add it to the queue.
  9874. self.requests.push(options);
  9875. return;
  9876. }
  9877. // If we are under maxSockets create a new one.
  9878. self.createSocket(options, function(socket) {
  9879. socket.on('free', onFree);
  9880. socket.on('close', onCloseOrRemove);
  9881. socket.on('agentRemove', onCloseOrRemove);
  9882. req.onSocket(socket);
  9883. function onFree() {
  9884. self.emit('free', socket, options);
  9885. }
  9886. function onCloseOrRemove(err) {
  9887. self.removeSocket(socket);
  9888. socket.removeListener('free', onFree);
  9889. socket.removeListener('close', onCloseOrRemove);
  9890. socket.removeListener('agentRemove', onCloseOrRemove);
  9891. }
  9892. });
  9893. };
  9894. TunnelingAgent.prototype.createSocket = function createSocket(options, cb) {
  9895. var self = this;
  9896. var placeholder = {};
  9897. self.sockets.push(placeholder);
  9898. var connectOptions = mergeOptions({}, self.proxyOptions, {
  9899. method: 'CONNECT',
  9900. path: options.host + ':' + options.port,
  9901. agent: false,
  9902. headers: {
  9903. host: options.host + ':' + options.port
  9904. }
  9905. });
  9906. if (options.localAddress) {
  9907. connectOptions.localAddress = options.localAddress;
  9908. }
  9909. if (connectOptions.proxyAuth) {
  9910. connectOptions.headers = connectOptions.headers || {};
  9911. connectOptions.headers['Proxy-Authorization'] = 'Basic ' +
  9912. new Buffer(connectOptions.proxyAuth).toString('base64');
  9913. }
  9914. debug('making CONNECT request');
  9915. var connectReq = self.request(connectOptions);
  9916. connectReq.useChunkedEncodingByDefault = false; // for v0.6
  9917. connectReq.once('response', onResponse); // for v0.6
  9918. connectReq.once('upgrade', onUpgrade); // for v0.6
  9919. connectReq.once('connect', onConnect); // for v0.7 or later
  9920. connectReq.once('error', onError);
  9921. connectReq.end();
  9922. function onResponse(res) {
  9923. // Very hacky. This is necessary to avoid http-parser leaks.
  9924. res.upgrade = true;
  9925. }
  9926. function onUpgrade(res, socket, head) {
  9927. // Hacky.
  9928. process.nextTick(function() {
  9929. onConnect(res, socket, head);
  9930. });
  9931. }
  9932. function onConnect(res, socket, head) {
  9933. connectReq.removeAllListeners();
  9934. socket.removeAllListeners();
  9935. if (res.statusCode !== 200) {
  9936. debug('tunneling socket could not be established, statusCode=%d',
  9937. res.statusCode);
  9938. socket.destroy();
  9939. var error = new Error('tunneling socket could not be established, ' +
  9940. 'statusCode=' + res.statusCode);
  9941. error.code = 'ECONNRESET';
  9942. options.request.emit('error', error);
  9943. self.removeSocket(placeholder);
  9944. return;
  9945. }
  9946. if (head.length > 0) {
  9947. debug('got illegal response body from proxy');
  9948. socket.destroy();
  9949. var error = new Error('got illegal response body from proxy');
  9950. error.code = 'ECONNRESET';
  9951. options.request.emit('error', error);
  9952. self.removeSocket(placeholder);
  9953. return;
  9954. }
  9955. debug('tunneling connection has established');
  9956. self.sockets[self.sockets.indexOf(placeholder)] = socket;
  9957. return cb(socket);
  9958. }
  9959. function onError(cause) {
  9960. connectReq.removeAllListeners();
  9961. debug('tunneling socket could not be established, cause=%s\n',
  9962. cause.message, cause.stack);
  9963. var error = new Error('tunneling socket could not be established, ' +
  9964. 'cause=' + cause.message);
  9965. error.code = 'ECONNRESET';
  9966. options.request.emit('error', error);
  9967. self.removeSocket(placeholder);
  9968. }
  9969. };
  9970. TunnelingAgent.prototype.removeSocket = function removeSocket(socket) {
  9971. var pos = this.sockets.indexOf(socket)
  9972. if (pos === -1) {
  9973. return;
  9974. }
  9975. this.sockets.splice(pos, 1);
  9976. var pending = this.requests.shift();
  9977. if (pending) {
  9978. // If we have pending requests and a socket gets closed a new one
  9979. // needs to be created to take over in the pool for the one that closed.
  9980. this.createSocket(pending, function(socket) {
  9981. pending.request.onSocket(socket);
  9982. });
  9983. }
  9984. };
  9985. function createSecureSocket(options, cb) {
  9986. var self = this;
  9987. TunnelingAgent.prototype.createSocket.call(self, options, function(socket) {
  9988. var hostHeader = options.request.getHeader('host');
  9989. var tlsOptions = mergeOptions({}, self.options, {
  9990. socket: socket,
  9991. servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host
  9992. });
  9993. // 0 is dummy port for v0.6
  9994. var secureSocket = tls.connect(0, tlsOptions);
  9995. self.sockets[self.sockets.indexOf(socket)] = secureSocket;
  9996. cb(secureSocket);
  9997. });
  9998. }
  9999. function toOptions(host, port, localAddress) {
  10000. if (typeof host === 'string') { // since v0.10
  10001. return {
  10002. host: host,
  10003. port: port,
  10004. localAddress: localAddress
  10005. };
  10006. }
  10007. return host; // for v0.11 or later
  10008. }
  10009. function mergeOptions(target) {
  10010. for (var i = 1, len = arguments.length; i < len; ++i) {
  10011. var overrides = arguments[i];
  10012. if (typeof overrides === 'object') {
  10013. var keys = Object.keys(overrides);
  10014. for (var j = 0, keyLen = keys.length; j < keyLen; ++j) {
  10015. var k = keys[j];
  10016. if (overrides[k] !== undefined) {
  10017. target[k] = overrides[k];
  10018. }
  10019. }
  10020. }
  10021. }
  10022. return target;
  10023. }
  10024. var debug;
  10025. if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
  10026. debug = function() {
  10027. var args = Array.prototype.slice.call(arguments);
  10028. if (typeof args[0] === 'string') {
  10029. args[0] = 'TUNNEL: ' + args[0];
  10030. } else {
  10031. args.unshift('TUNNEL:');
  10032. }
  10033. console.error.apply(console, args);
  10034. }
  10035. } else {
  10036. debug = function() {};
  10037. }
  10038. exports.debug = debug; // for test
  10039. /***/ }),
  10040. /***/ 1773:
  10041. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10042. const Client = __nccwpck_require__(3598)
  10043. const Dispatcher = __nccwpck_require__(412)
  10044. const errors = __nccwpck_require__(8045)
  10045. const Pool = __nccwpck_require__(4634)
  10046. const BalancedPool = __nccwpck_require__(7931)
  10047. const Agent = __nccwpck_require__(7890)
  10048. const util = __nccwpck_require__(3983)
  10049. const { InvalidArgumentError } = errors
  10050. const api = __nccwpck_require__(4059)
  10051. const buildConnector = __nccwpck_require__(2067)
  10052. const MockClient = __nccwpck_require__(8687)
  10053. const MockAgent = __nccwpck_require__(6771)
  10054. const MockPool = __nccwpck_require__(6193)
  10055. const mockErrors = __nccwpck_require__(888)
  10056. const ProxyAgent = __nccwpck_require__(7858)
  10057. const RetryHandler = __nccwpck_require__(2286)
  10058. const { getGlobalDispatcher, setGlobalDispatcher } = __nccwpck_require__(1892)
  10059. const DecoratorHandler = __nccwpck_require__(6930)
  10060. const RedirectHandler = __nccwpck_require__(2860)
  10061. const createRedirectInterceptor = __nccwpck_require__(8861)
  10062. let hasCrypto
  10063. try {
  10064. __nccwpck_require__(6113)
  10065. hasCrypto = true
  10066. } catch {
  10067. hasCrypto = false
  10068. }
  10069. Object.assign(Dispatcher.prototype, api)
  10070. module.exports.Dispatcher = Dispatcher
  10071. module.exports.Client = Client
  10072. module.exports.Pool = Pool
  10073. module.exports.BalancedPool = BalancedPool
  10074. module.exports.Agent = Agent
  10075. module.exports.ProxyAgent = ProxyAgent
  10076. module.exports.RetryHandler = RetryHandler
  10077. module.exports.DecoratorHandler = DecoratorHandler
  10078. module.exports.RedirectHandler = RedirectHandler
  10079. module.exports.createRedirectInterceptor = createRedirectInterceptor
  10080. module.exports.buildConnector = buildConnector
  10081. module.exports.errors = errors
  10082. function makeDispatcher (fn) {
  10083. return (url, opts, handler) => {
  10084. if (typeof opts === 'function') {
  10085. handler = opts
  10086. opts = null
  10087. }
  10088. if (!url || (typeof url !== 'string' && typeof url !== 'object' && !(url instanceof URL))) {
  10089. throw new InvalidArgumentError('invalid url')
  10090. }
  10091. if (opts != null && typeof opts !== 'object') {
  10092. throw new InvalidArgumentError('invalid opts')
  10093. }
  10094. if (opts && opts.path != null) {
  10095. if (typeof opts.path !== 'string') {
  10096. throw new InvalidArgumentError('invalid opts.path')
  10097. }
  10098. let path = opts.path
  10099. if (!opts.path.startsWith('/')) {
  10100. path = `/${path}`
  10101. }
  10102. url = new URL(util.parseOrigin(url).origin + path)
  10103. } else {
  10104. if (!opts) {
  10105. opts = typeof url === 'object' ? url : {}
  10106. }
  10107. url = util.parseURL(url)
  10108. }
  10109. const { agent, dispatcher = getGlobalDispatcher() } = opts
  10110. if (agent) {
  10111. throw new InvalidArgumentError('unsupported opts.agent. Did you mean opts.client?')
  10112. }
  10113. return fn.call(dispatcher, {
  10114. ...opts,
  10115. origin: url.origin,
  10116. path: url.search ? `${url.pathname}${url.search}` : url.pathname,
  10117. method: opts.method || (opts.body ? 'PUT' : 'GET')
  10118. }, handler)
  10119. }
  10120. }
  10121. module.exports.setGlobalDispatcher = setGlobalDispatcher
  10122. module.exports.getGlobalDispatcher = getGlobalDispatcher
  10123. if (util.nodeMajor > 16 || (util.nodeMajor === 16 && util.nodeMinor >= 8)) {
  10124. let fetchImpl = null
  10125. module.exports.fetch = async function fetch (resource) {
  10126. if (!fetchImpl) {
  10127. fetchImpl = (__nccwpck_require__(4881).fetch)
  10128. }
  10129. try {
  10130. return await fetchImpl(...arguments)
  10131. } catch (err) {
  10132. if (typeof err === 'object') {
  10133. Error.captureStackTrace(err, this)
  10134. }
  10135. throw err
  10136. }
  10137. }
  10138. module.exports.Headers = __nccwpck_require__(554).Headers
  10139. module.exports.Response = __nccwpck_require__(7823).Response
  10140. module.exports.Request = __nccwpck_require__(8359).Request
  10141. module.exports.FormData = __nccwpck_require__(2015).FormData
  10142. module.exports.File = __nccwpck_require__(8511).File
  10143. module.exports.FileReader = __nccwpck_require__(1446).FileReader
  10144. const { setGlobalOrigin, getGlobalOrigin } = __nccwpck_require__(1246)
  10145. module.exports.setGlobalOrigin = setGlobalOrigin
  10146. module.exports.getGlobalOrigin = getGlobalOrigin
  10147. const { CacheStorage } = __nccwpck_require__(7907)
  10148. const { kConstruct } = __nccwpck_require__(9174)
  10149. // Cache & CacheStorage are tightly coupled with fetch. Even if it may run
  10150. // in an older version of Node, it doesn't have any use without fetch.
  10151. module.exports.caches = new CacheStorage(kConstruct)
  10152. }
  10153. if (util.nodeMajor >= 16) {
  10154. const { deleteCookie, getCookies, getSetCookies, setCookie } = __nccwpck_require__(1724)
  10155. module.exports.deleteCookie = deleteCookie
  10156. module.exports.getCookies = getCookies
  10157. module.exports.getSetCookies = getSetCookies
  10158. module.exports.setCookie = setCookie
  10159. const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(685)
  10160. module.exports.parseMIMEType = parseMIMEType
  10161. module.exports.serializeAMimeType = serializeAMimeType
  10162. }
  10163. if (util.nodeMajor >= 18 && hasCrypto) {
  10164. const { WebSocket } = __nccwpck_require__(4284)
  10165. module.exports.WebSocket = WebSocket
  10166. }
  10167. module.exports.request = makeDispatcher(api.request)
  10168. module.exports.stream = makeDispatcher(api.stream)
  10169. module.exports.pipeline = makeDispatcher(api.pipeline)
  10170. module.exports.connect = makeDispatcher(api.connect)
  10171. module.exports.upgrade = makeDispatcher(api.upgrade)
  10172. module.exports.MockClient = MockClient
  10173. module.exports.MockPool = MockPool
  10174. module.exports.MockAgent = MockAgent
  10175. module.exports.mockErrors = mockErrors
  10176. /***/ }),
  10177. /***/ 7890:
  10178. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10179. const { InvalidArgumentError } = __nccwpck_require__(8045)
  10180. const { kClients, kRunning, kClose, kDestroy, kDispatch, kInterceptors } = __nccwpck_require__(2785)
  10181. const DispatcherBase = __nccwpck_require__(4839)
  10182. const Pool = __nccwpck_require__(4634)
  10183. const Client = __nccwpck_require__(3598)
  10184. const util = __nccwpck_require__(3983)
  10185. const createRedirectInterceptor = __nccwpck_require__(8861)
  10186. const { WeakRef, FinalizationRegistry } = __nccwpck_require__(6436)()
  10187. const kOnConnect = Symbol('onConnect')
  10188. const kOnDisconnect = Symbol('onDisconnect')
  10189. const kOnConnectionError = Symbol('onConnectionError')
  10190. const kMaxRedirections = Symbol('maxRedirections')
  10191. const kOnDrain = Symbol('onDrain')
  10192. const kFactory = Symbol('factory')
  10193. const kFinalizer = Symbol('finalizer')
  10194. const kOptions = Symbol('options')
  10195. function defaultFactory (origin, opts) {
  10196. return opts && opts.connections === 1
  10197. ? new Client(origin, opts)
  10198. : new Pool(origin, opts)
  10199. }
  10200. class Agent extends DispatcherBase {
  10201. constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
  10202. super()
  10203. if (typeof factory !== 'function') {
  10204. throw new InvalidArgumentError('factory must be a function.')
  10205. }
  10206. if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') {
  10207. throw new InvalidArgumentError('connect must be a function or an object')
  10208. }
  10209. if (!Number.isInteger(maxRedirections) || maxRedirections < 0) {
  10210. throw new InvalidArgumentError('maxRedirections must be a positive number')
  10211. }
  10212. if (connect && typeof connect !== 'function') {
  10213. connect = { ...connect }
  10214. }
  10215. this[kInterceptors] = options.interceptors && options.interceptors.Agent && Array.isArray(options.interceptors.Agent)
  10216. ? options.interceptors.Agent
  10217. : [createRedirectInterceptor({ maxRedirections })]
  10218. this[kOptions] = { ...util.deepClone(options), connect }
  10219. this[kOptions].interceptors = options.interceptors
  10220. ? { ...options.interceptors }
  10221. : undefined
  10222. this[kMaxRedirections] = maxRedirections
  10223. this[kFactory] = factory
  10224. this[kClients] = new Map()
  10225. this[kFinalizer] = new FinalizationRegistry(/* istanbul ignore next: gc is undeterministic */ key => {
  10226. const ref = this[kClients].get(key)
  10227. if (ref !== undefined && ref.deref() === undefined) {
  10228. this[kClients].delete(key)
  10229. }
  10230. })
  10231. const agent = this
  10232. this[kOnDrain] = (origin, targets) => {
  10233. agent.emit('drain', origin, [agent, ...targets])
  10234. }
  10235. this[kOnConnect] = (origin, targets) => {
  10236. agent.emit('connect', origin, [agent, ...targets])
  10237. }
  10238. this[kOnDisconnect] = (origin, targets, err) => {
  10239. agent.emit('disconnect', origin, [agent, ...targets], err)
  10240. }
  10241. this[kOnConnectionError] = (origin, targets, err) => {
  10242. agent.emit('connectionError', origin, [agent, ...targets], err)
  10243. }
  10244. }
  10245. get [kRunning] () {
  10246. let ret = 0
  10247. for (const ref of this[kClients].values()) {
  10248. const client = ref.deref()
  10249. /* istanbul ignore next: gc is undeterministic */
  10250. if (client) {
  10251. ret += client[kRunning]
  10252. }
  10253. }
  10254. return ret
  10255. }
  10256. [kDispatch] (opts, handler) {
  10257. let key
  10258. if (opts.origin && (typeof opts.origin === 'string' || opts.origin instanceof URL)) {
  10259. key = String(opts.origin)
  10260. } else {
  10261. throw new InvalidArgumentError('opts.origin must be a non-empty string or URL.')
  10262. }
  10263. const ref = this[kClients].get(key)
  10264. let dispatcher = ref ? ref.deref() : null
  10265. if (!dispatcher) {
  10266. dispatcher = this[kFactory](opts.origin, this[kOptions])
  10267. .on('drain', this[kOnDrain])
  10268. .on('connect', this[kOnConnect])
  10269. .on('disconnect', this[kOnDisconnect])
  10270. .on('connectionError', this[kOnConnectionError])
  10271. this[kClients].set(key, new WeakRef(dispatcher))
  10272. this[kFinalizer].register(dispatcher, key)
  10273. }
  10274. return dispatcher.dispatch(opts, handler)
  10275. }
  10276. async [kClose] () {
  10277. const closePromises = []
  10278. for (const ref of this[kClients].values()) {
  10279. const client = ref.deref()
  10280. /* istanbul ignore else: gc is undeterministic */
  10281. if (client) {
  10282. closePromises.push(client.close())
  10283. }
  10284. }
  10285. await Promise.all(closePromises)
  10286. }
  10287. async [kDestroy] (err) {
  10288. const destroyPromises = []
  10289. for (const ref of this[kClients].values()) {
  10290. const client = ref.deref()
  10291. /* istanbul ignore else: gc is undeterministic */
  10292. if (client) {
  10293. destroyPromises.push(client.destroy(err))
  10294. }
  10295. }
  10296. await Promise.all(destroyPromises)
  10297. }
  10298. }
  10299. module.exports = Agent
  10300. /***/ }),
  10301. /***/ 7032:
  10302. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10303. const { addAbortListener } = __nccwpck_require__(3983)
  10304. const { RequestAbortedError } = __nccwpck_require__(8045)
  10305. const kListener = Symbol('kListener')
  10306. const kSignal = Symbol('kSignal')
  10307. function abort (self) {
  10308. if (self.abort) {
  10309. self.abort()
  10310. } else {
  10311. self.onError(new RequestAbortedError())
  10312. }
  10313. }
  10314. function addSignal (self, signal) {
  10315. self[kSignal] = null
  10316. self[kListener] = null
  10317. if (!signal) {
  10318. return
  10319. }
  10320. if (signal.aborted) {
  10321. abort(self)
  10322. return
  10323. }
  10324. self[kSignal] = signal
  10325. self[kListener] = () => {
  10326. abort(self)
  10327. }
  10328. addAbortListener(self[kSignal], self[kListener])
  10329. }
  10330. function removeSignal (self) {
  10331. if (!self[kSignal]) {
  10332. return
  10333. }
  10334. if ('removeEventListener' in self[kSignal]) {
  10335. self[kSignal].removeEventListener('abort', self[kListener])
  10336. } else {
  10337. self[kSignal].removeListener('abort', self[kListener])
  10338. }
  10339. self[kSignal] = null
  10340. self[kListener] = null
  10341. }
  10342. module.exports = {
  10343. addSignal,
  10344. removeSignal
  10345. }
  10346. /***/ }),
  10347. /***/ 9744:
  10348. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10349. const { AsyncResource } = __nccwpck_require__(852)
  10350. const { InvalidArgumentError, RequestAbortedError, SocketError } = __nccwpck_require__(8045)
  10351. const util = __nccwpck_require__(3983)
  10352. const { addSignal, removeSignal } = __nccwpck_require__(7032)
  10353. class ConnectHandler extends AsyncResource {
  10354. constructor (opts, callback) {
  10355. if (!opts || typeof opts !== 'object') {
  10356. throw new InvalidArgumentError('invalid opts')
  10357. }
  10358. if (typeof callback !== 'function') {
  10359. throw new InvalidArgumentError('invalid callback')
  10360. }
  10361. const { signal, opaque, responseHeaders } = opts
  10362. if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') {
  10363. throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget')
  10364. }
  10365. super('UNDICI_CONNECT')
  10366. this.opaque = opaque || null
  10367. this.responseHeaders = responseHeaders || null
  10368. this.callback = callback
  10369. this.abort = null
  10370. addSignal(this, signal)
  10371. }
  10372. onConnect (abort, context) {
  10373. if (!this.callback) {
  10374. throw new RequestAbortedError()
  10375. }
  10376. this.abort = abort
  10377. this.context = context
  10378. }
  10379. onHeaders () {
  10380. throw new SocketError('bad connect', null)
  10381. }
  10382. onUpgrade (statusCode, rawHeaders, socket) {
  10383. const { callback, opaque, context } = this
  10384. removeSignal(this)
  10385. this.callback = null
  10386. let headers = rawHeaders
  10387. // Indicates is an HTTP2Session
  10388. if (headers != null) {
  10389. headers = this.responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders)
  10390. }
  10391. this.runInAsyncScope(callback, null, null, {
  10392. statusCode,
  10393. headers,
  10394. socket,
  10395. opaque,
  10396. context
  10397. })
  10398. }
  10399. onError (err) {
  10400. const { callback, opaque } = this
  10401. removeSignal(this)
  10402. if (callback) {
  10403. this.callback = null
  10404. queueMicrotask(() => {
  10405. this.runInAsyncScope(callback, null, err, { opaque })
  10406. })
  10407. }
  10408. }
  10409. }
  10410. function connect (opts, callback) {
  10411. if (callback === undefined) {
  10412. return new Promise((resolve, reject) => {
  10413. connect.call(this, opts, (err, data) => {
  10414. return err ? reject(err) : resolve(data)
  10415. })
  10416. })
  10417. }
  10418. try {
  10419. const connectHandler = new ConnectHandler(opts, callback)
  10420. this.dispatch({ ...opts, method: 'CONNECT' }, connectHandler)
  10421. } catch (err) {
  10422. if (typeof callback !== 'function') {
  10423. throw err
  10424. }
  10425. const opaque = opts && opts.opaque
  10426. queueMicrotask(() => callback(err, { opaque }))
  10427. }
  10428. }
  10429. module.exports = connect
  10430. /***/ }),
  10431. /***/ 8752:
  10432. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10433. const {
  10434. Readable,
  10435. Duplex,
  10436. PassThrough
  10437. } = __nccwpck_require__(2781)
  10438. const {
  10439. InvalidArgumentError,
  10440. InvalidReturnValueError,
  10441. RequestAbortedError
  10442. } = __nccwpck_require__(8045)
  10443. const util = __nccwpck_require__(3983)
  10444. const { AsyncResource } = __nccwpck_require__(852)
  10445. const { addSignal, removeSignal } = __nccwpck_require__(7032)
  10446. const assert = __nccwpck_require__(9491)
  10447. const kResume = Symbol('resume')
  10448. class PipelineRequest extends Readable {
  10449. constructor () {
  10450. super({ autoDestroy: true })
  10451. this[kResume] = null
  10452. }
  10453. _read () {
  10454. const { [kResume]: resume } = this
  10455. if (resume) {
  10456. this[kResume] = null
  10457. resume()
  10458. }
  10459. }
  10460. _destroy (err, callback) {
  10461. this._read()
  10462. callback(err)
  10463. }
  10464. }
  10465. class PipelineResponse extends Readable {
  10466. constructor (resume) {
  10467. super({ autoDestroy: true })
  10468. this[kResume] = resume
  10469. }
  10470. _read () {
  10471. this[kResume]()
  10472. }
  10473. _destroy (err, callback) {
  10474. if (!err && !this._readableState.endEmitted) {
  10475. err = new RequestAbortedError()
  10476. }
  10477. callback(err)
  10478. }
  10479. }
  10480. class PipelineHandler extends AsyncResource {
  10481. constructor (opts, handler) {
  10482. if (!opts || typeof opts !== 'object') {
  10483. throw new InvalidArgumentError('invalid opts')
  10484. }
  10485. if (typeof handler !== 'function') {
  10486. throw new InvalidArgumentError('invalid handler')
  10487. }
  10488. const { signal, method, opaque, onInfo, responseHeaders } = opts
  10489. if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') {
  10490. throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget')
  10491. }
  10492. if (method === 'CONNECT') {
  10493. throw new InvalidArgumentError('invalid method')
  10494. }
  10495. if (onInfo && typeof onInfo !== 'function') {
  10496. throw new InvalidArgumentError('invalid onInfo callback')
  10497. }
  10498. super('UNDICI_PIPELINE')
  10499. this.opaque = opaque || null
  10500. this.responseHeaders = responseHeaders || null
  10501. this.handler = handler
  10502. this.abort = null
  10503. this.context = null
  10504. this.onInfo = onInfo || null
  10505. this.req = new PipelineRequest().on('error', util.nop)
  10506. this.ret = new Duplex({
  10507. readableObjectMode: opts.objectMode,
  10508. autoDestroy: true,
  10509. read: () => {
  10510. const { body } = this
  10511. if (body && body.resume) {
  10512. body.resume()
  10513. }
  10514. },
  10515. write: (chunk, encoding, callback) => {
  10516. const { req } = this
  10517. if (req.push(chunk, encoding) || req._readableState.destroyed) {
  10518. callback()
  10519. } else {
  10520. req[kResume] = callback
  10521. }
  10522. },
  10523. destroy: (err, callback) => {
  10524. const { body, req, res, ret, abort } = this
  10525. if (!err && !ret._readableState.endEmitted) {
  10526. err = new RequestAbortedError()
  10527. }
  10528. if (abort && err) {
  10529. abort()
  10530. }
  10531. util.destroy(body, err)
  10532. util.destroy(req, err)
  10533. util.destroy(res, err)
  10534. removeSignal(this)
  10535. callback(err)
  10536. }
  10537. }).on('prefinish', () => {
  10538. const { req } = this
  10539. // Node < 15 does not call _final in same tick.
  10540. req.push(null)
  10541. })
  10542. this.res = null
  10543. addSignal(this, signal)
  10544. }
  10545. onConnect (abort, context) {
  10546. const { ret, res } = this
  10547. assert(!res, 'pipeline cannot be retried')
  10548. if (ret.destroyed) {
  10549. throw new RequestAbortedError()
  10550. }
  10551. this.abort = abort
  10552. this.context = context
  10553. }
  10554. onHeaders (statusCode, rawHeaders, resume) {
  10555. const { opaque, handler, context } = this
  10556. if (statusCode < 200) {
  10557. if (this.onInfo) {
  10558. const headers = this.responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders)
  10559. this.onInfo({ statusCode, headers })
  10560. }
  10561. return
  10562. }
  10563. this.res = new PipelineResponse(resume)
  10564. let body
  10565. try {
  10566. this.handler = null
  10567. const headers = this.responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders)
  10568. body = this.runInAsyncScope(handler, null, {
  10569. statusCode,
  10570. headers,
  10571. opaque,
  10572. body: this.res,
  10573. context
  10574. })
  10575. } catch (err) {
  10576. this.res.on('error', util.nop)
  10577. throw err
  10578. }
  10579. if (!body || typeof body.on !== 'function') {
  10580. throw new InvalidReturnValueError('expected Readable')
  10581. }
  10582. body
  10583. .on('data', (chunk) => {
  10584. const { ret, body } = this
  10585. if (!ret.push(chunk) && body.pause) {
  10586. body.pause()
  10587. }
  10588. })
  10589. .on('error', (err) => {
  10590. const { ret } = this
  10591. util.destroy(ret, err)
  10592. })
  10593. .on('end', () => {
  10594. const { ret } = this
  10595. ret.push(null)
  10596. })
  10597. .on('close', () => {
  10598. const { ret } = this
  10599. if (!ret._readableState.ended) {
  10600. util.destroy(ret, new RequestAbortedError())
  10601. }
  10602. })
  10603. this.body = body
  10604. }
  10605. onData (chunk) {
  10606. const { res } = this
  10607. return res.push(chunk)
  10608. }
  10609. onComplete (trailers) {
  10610. const { res } = this
  10611. res.push(null)
  10612. }
  10613. onError (err) {
  10614. const { ret } = this
  10615. this.handler = null
  10616. util.destroy(ret, err)
  10617. }
  10618. }
  10619. function pipeline (opts, handler) {
  10620. try {
  10621. const pipelineHandler = new PipelineHandler(opts, handler)
  10622. this.dispatch({ ...opts, body: pipelineHandler.req }, pipelineHandler)
  10623. return pipelineHandler.ret
  10624. } catch (err) {
  10625. return new PassThrough().destroy(err)
  10626. }
  10627. }
  10628. module.exports = pipeline
  10629. /***/ }),
  10630. /***/ 5448:
  10631. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10632. const Readable = __nccwpck_require__(3858)
  10633. const {
  10634. InvalidArgumentError,
  10635. RequestAbortedError
  10636. } = __nccwpck_require__(8045)
  10637. const util = __nccwpck_require__(3983)
  10638. const { getResolveErrorBodyCallback } = __nccwpck_require__(7474)
  10639. const { AsyncResource } = __nccwpck_require__(852)
  10640. const { addSignal, removeSignal } = __nccwpck_require__(7032)
  10641. class RequestHandler extends AsyncResource {
  10642. constructor (opts, callback) {
  10643. if (!opts || typeof opts !== 'object') {
  10644. throw new InvalidArgumentError('invalid opts')
  10645. }
  10646. const { signal, method, opaque, body, onInfo, responseHeaders, throwOnError, highWaterMark } = opts
  10647. try {
  10648. if (typeof callback !== 'function') {
  10649. throw new InvalidArgumentError('invalid callback')
  10650. }
  10651. if (highWaterMark && (typeof highWaterMark !== 'number' || highWaterMark < 0)) {
  10652. throw new InvalidArgumentError('invalid highWaterMark')
  10653. }
  10654. if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') {
  10655. throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget')
  10656. }
  10657. if (method === 'CONNECT') {
  10658. throw new InvalidArgumentError('invalid method')
  10659. }
  10660. if (onInfo && typeof onInfo !== 'function') {
  10661. throw new InvalidArgumentError('invalid onInfo callback')
  10662. }
  10663. super('UNDICI_REQUEST')
  10664. } catch (err) {
  10665. if (util.isStream(body)) {
  10666. util.destroy(body.on('error', util.nop), err)
  10667. }
  10668. throw err
  10669. }
  10670. this.responseHeaders = responseHeaders || null
  10671. this.opaque = opaque || null
  10672. this.callback = callback
  10673. this.res = null
  10674. this.abort = null
  10675. this.body = body
  10676. this.trailers = {}
  10677. this.context = null
  10678. this.onInfo = onInfo || null
  10679. this.throwOnError = throwOnError
  10680. this.highWaterMark = highWaterMark
  10681. if (util.isStream(body)) {
  10682. body.on('error', (err) => {
  10683. this.onError(err)
  10684. })
  10685. }
  10686. addSignal(this, signal)
  10687. }
  10688. onConnect (abort, context) {
  10689. if (!this.callback) {
  10690. throw new RequestAbortedError()
  10691. }
  10692. this.abort = abort
  10693. this.context = context
  10694. }
  10695. onHeaders (statusCode, rawHeaders, resume, statusMessage) {
  10696. const { callback, opaque, abort, context, responseHeaders, highWaterMark } = this
  10697. const headers = responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders)
  10698. if (statusCode < 200) {
  10699. if (this.onInfo) {
  10700. this.onInfo({ statusCode, headers })
  10701. }
  10702. return
  10703. }
  10704. const parsedHeaders = responseHeaders === 'raw' ? util.parseHeaders(rawHeaders) : headers
  10705. const contentType = parsedHeaders['content-type']
  10706. const body = new Readable({ resume, abort, contentType, highWaterMark })
  10707. this.callback = null
  10708. this.res = body
  10709. if (callback !== null) {
  10710. if (this.throwOnError && statusCode >= 400) {
  10711. this.runInAsyncScope(getResolveErrorBodyCallback, null,
  10712. { callback, body, contentType, statusCode, statusMessage, headers }
  10713. )
  10714. } else {
  10715. this.runInAsyncScope(callback, null, null, {
  10716. statusCode,
  10717. headers,
  10718. trailers: this.trailers,
  10719. opaque,
  10720. body,
  10721. context
  10722. })
  10723. }
  10724. }
  10725. }
  10726. onData (chunk) {
  10727. const { res } = this
  10728. return res.push(chunk)
  10729. }
  10730. onComplete (trailers) {
  10731. const { res } = this
  10732. removeSignal(this)
  10733. util.parseHeaders(trailers, this.trailers)
  10734. res.push(null)
  10735. }
  10736. onError (err) {
  10737. const { res, callback, body, opaque } = this
  10738. removeSignal(this)
  10739. if (callback) {
  10740. // TODO: Does this need queueMicrotask?
  10741. this.callback = null
  10742. queueMicrotask(() => {
  10743. this.runInAsyncScope(callback, null, err, { opaque })
  10744. })
  10745. }
  10746. if (res) {
  10747. this.res = null
  10748. // Ensure all queued handlers are invoked before destroying res.
  10749. queueMicrotask(() => {
  10750. util.destroy(res, err)
  10751. })
  10752. }
  10753. if (body) {
  10754. this.body = null
  10755. util.destroy(body, err)
  10756. }
  10757. }
  10758. }
  10759. function request (opts, callback) {
  10760. if (callback === undefined) {
  10761. return new Promise((resolve, reject) => {
  10762. request.call(this, opts, (err, data) => {
  10763. return err ? reject(err) : resolve(data)
  10764. })
  10765. })
  10766. }
  10767. try {
  10768. this.dispatch(opts, new RequestHandler(opts, callback))
  10769. } catch (err) {
  10770. if (typeof callback !== 'function') {
  10771. throw err
  10772. }
  10773. const opaque = opts && opts.opaque
  10774. queueMicrotask(() => callback(err, { opaque }))
  10775. }
  10776. }
  10777. module.exports = request
  10778. module.exports.RequestHandler = RequestHandler
  10779. /***/ }),
  10780. /***/ 5395:
  10781. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10782. const { finished, PassThrough } = __nccwpck_require__(2781)
  10783. const {
  10784. InvalidArgumentError,
  10785. InvalidReturnValueError,
  10786. RequestAbortedError
  10787. } = __nccwpck_require__(8045)
  10788. const util = __nccwpck_require__(3983)
  10789. const { getResolveErrorBodyCallback } = __nccwpck_require__(7474)
  10790. const { AsyncResource } = __nccwpck_require__(852)
  10791. const { addSignal, removeSignal } = __nccwpck_require__(7032)
  10792. class StreamHandler extends AsyncResource {
  10793. constructor (opts, factory, callback) {
  10794. if (!opts || typeof opts !== 'object') {
  10795. throw new InvalidArgumentError('invalid opts')
  10796. }
  10797. const { signal, method, opaque, body, onInfo, responseHeaders, throwOnError } = opts
  10798. try {
  10799. if (typeof callback !== 'function') {
  10800. throw new InvalidArgumentError('invalid callback')
  10801. }
  10802. if (typeof factory !== 'function') {
  10803. throw new InvalidArgumentError('invalid factory')
  10804. }
  10805. if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') {
  10806. throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget')
  10807. }
  10808. if (method === 'CONNECT') {
  10809. throw new InvalidArgumentError('invalid method')
  10810. }
  10811. if (onInfo && typeof onInfo !== 'function') {
  10812. throw new InvalidArgumentError('invalid onInfo callback')
  10813. }
  10814. super('UNDICI_STREAM')
  10815. } catch (err) {
  10816. if (util.isStream(body)) {
  10817. util.destroy(body.on('error', util.nop), err)
  10818. }
  10819. throw err
  10820. }
  10821. this.responseHeaders = responseHeaders || null
  10822. this.opaque = opaque || null
  10823. this.factory = factory
  10824. this.callback = callback
  10825. this.res = null
  10826. this.abort = null
  10827. this.context = null
  10828. this.trailers = null
  10829. this.body = body
  10830. this.onInfo = onInfo || null
  10831. this.throwOnError = throwOnError || false
  10832. if (util.isStream(body)) {
  10833. body.on('error', (err) => {
  10834. this.onError(err)
  10835. })
  10836. }
  10837. addSignal(this, signal)
  10838. }
  10839. onConnect (abort, context) {
  10840. if (!this.callback) {
  10841. throw new RequestAbortedError()
  10842. }
  10843. this.abort = abort
  10844. this.context = context
  10845. }
  10846. onHeaders (statusCode, rawHeaders, resume, statusMessage) {
  10847. const { factory, opaque, context, callback, responseHeaders } = this
  10848. const headers = responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders)
  10849. if (statusCode < 200) {
  10850. if (this.onInfo) {
  10851. this.onInfo({ statusCode, headers })
  10852. }
  10853. return
  10854. }
  10855. this.factory = null
  10856. let res
  10857. if (this.throwOnError && statusCode >= 400) {
  10858. const parsedHeaders = responseHeaders === 'raw' ? util.parseHeaders(rawHeaders) : headers
  10859. const contentType = parsedHeaders['content-type']
  10860. res = new PassThrough()
  10861. this.callback = null
  10862. this.runInAsyncScope(getResolveErrorBodyCallback, null,
  10863. { callback, body: res, contentType, statusCode, statusMessage, headers }
  10864. )
  10865. } else {
  10866. if (factory === null) {
  10867. return
  10868. }
  10869. res = this.runInAsyncScope(factory, null, {
  10870. statusCode,
  10871. headers,
  10872. opaque,
  10873. context
  10874. })
  10875. if (
  10876. !res ||
  10877. typeof res.write !== 'function' ||
  10878. typeof res.end !== 'function' ||
  10879. typeof res.on !== 'function'
  10880. ) {
  10881. throw new InvalidReturnValueError('expected Writable')
  10882. }
  10883. // TODO: Avoid finished. It registers an unnecessary amount of listeners.
  10884. finished(res, { readable: false }, (err) => {
  10885. const { callback, res, opaque, trailers, abort } = this
  10886. this.res = null
  10887. if (err || !res.readable) {
  10888. util.destroy(res, err)
  10889. }
  10890. this.callback = null
  10891. this.runInAsyncScope(callback, null, err || null, { opaque, trailers })
  10892. if (err) {
  10893. abort()
  10894. }
  10895. })
  10896. }
  10897. res.on('drain', resume)
  10898. this.res = res
  10899. const needDrain = res.writableNeedDrain !== undefined
  10900. ? res.writableNeedDrain
  10901. : res._writableState && res._writableState.needDrain
  10902. return needDrain !== true
  10903. }
  10904. onData (chunk) {
  10905. const { res } = this
  10906. return res ? res.write(chunk) : true
  10907. }
  10908. onComplete (trailers) {
  10909. const { res } = this
  10910. removeSignal(this)
  10911. if (!res) {
  10912. return
  10913. }
  10914. this.trailers = util.parseHeaders(trailers)
  10915. res.end()
  10916. }
  10917. onError (err) {
  10918. const { res, callback, opaque, body } = this
  10919. removeSignal(this)
  10920. this.factory = null
  10921. if (res) {
  10922. this.res = null
  10923. util.destroy(res, err)
  10924. } else if (callback) {
  10925. this.callback = null
  10926. queueMicrotask(() => {
  10927. this.runInAsyncScope(callback, null, err, { opaque })
  10928. })
  10929. }
  10930. if (body) {
  10931. this.body = null
  10932. util.destroy(body, err)
  10933. }
  10934. }
  10935. }
  10936. function stream (opts, factory, callback) {
  10937. if (callback === undefined) {
  10938. return new Promise((resolve, reject) => {
  10939. stream.call(this, opts, factory, (err, data) => {
  10940. return err ? reject(err) : resolve(data)
  10941. })
  10942. })
  10943. }
  10944. try {
  10945. this.dispatch(opts, new StreamHandler(opts, factory, callback))
  10946. } catch (err) {
  10947. if (typeof callback !== 'function') {
  10948. throw err
  10949. }
  10950. const opaque = opts && opts.opaque
  10951. queueMicrotask(() => callback(err, { opaque }))
  10952. }
  10953. }
  10954. module.exports = stream
  10955. /***/ }),
  10956. /***/ 6923:
  10957. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  10958. const { InvalidArgumentError, RequestAbortedError, SocketError } = __nccwpck_require__(8045)
  10959. const { AsyncResource } = __nccwpck_require__(852)
  10960. const util = __nccwpck_require__(3983)
  10961. const { addSignal, removeSignal } = __nccwpck_require__(7032)
  10962. const assert = __nccwpck_require__(9491)
  10963. class UpgradeHandler extends AsyncResource {
  10964. constructor (opts, callback) {
  10965. if (!opts || typeof opts !== 'object') {
  10966. throw new InvalidArgumentError('invalid opts')
  10967. }
  10968. if (typeof callback !== 'function') {
  10969. throw new InvalidArgumentError('invalid callback')
  10970. }
  10971. const { signal, opaque, responseHeaders } = opts
  10972. if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') {
  10973. throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget')
  10974. }
  10975. super('UNDICI_UPGRADE')
  10976. this.responseHeaders = responseHeaders || null
  10977. this.opaque = opaque || null
  10978. this.callback = callback
  10979. this.abort = null
  10980. this.context = null
  10981. addSignal(this, signal)
  10982. }
  10983. onConnect (abort, context) {
  10984. if (!this.callback) {
  10985. throw new RequestAbortedError()
  10986. }
  10987. this.abort = abort
  10988. this.context = null
  10989. }
  10990. onHeaders () {
  10991. throw new SocketError('bad upgrade', null)
  10992. }
  10993. onUpgrade (statusCode, rawHeaders, socket) {
  10994. const { callback, opaque, context } = this
  10995. assert.strictEqual(statusCode, 101)
  10996. removeSignal(this)
  10997. this.callback = null
  10998. const headers = this.responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders)
  10999. this.runInAsyncScope(callback, null, null, {
  11000. headers,
  11001. socket,
  11002. opaque,
  11003. context
  11004. })
  11005. }
  11006. onError (err) {
  11007. const { callback, opaque } = this
  11008. removeSignal(this)
  11009. if (callback) {
  11010. this.callback = null
  11011. queueMicrotask(() => {
  11012. this.runInAsyncScope(callback, null, err, { opaque })
  11013. })
  11014. }
  11015. }
  11016. }
  11017. function upgrade (opts, callback) {
  11018. if (callback === undefined) {
  11019. return new Promise((resolve, reject) => {
  11020. upgrade.call(this, opts, (err, data) => {
  11021. return err ? reject(err) : resolve(data)
  11022. })
  11023. })
  11024. }
  11025. try {
  11026. const upgradeHandler = new UpgradeHandler(opts, callback)
  11027. this.dispatch({
  11028. ...opts,
  11029. method: opts.method || 'GET',
  11030. upgrade: opts.protocol || 'Websocket'
  11031. }, upgradeHandler)
  11032. } catch (err) {
  11033. if (typeof callback !== 'function') {
  11034. throw err
  11035. }
  11036. const opaque = opts && opts.opaque
  11037. queueMicrotask(() => callback(err, { opaque }))
  11038. }
  11039. }
  11040. module.exports = upgrade
  11041. /***/ }),
  11042. /***/ 4059:
  11043. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11044. module.exports.request = __nccwpck_require__(5448)
  11045. module.exports.stream = __nccwpck_require__(5395)
  11046. module.exports.pipeline = __nccwpck_require__(8752)
  11047. module.exports.upgrade = __nccwpck_require__(6923)
  11048. module.exports.connect = __nccwpck_require__(9744)
  11049. /***/ }),
  11050. /***/ 3858:
  11051. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11052. // Ported from https://github.com/nodejs/undici/pull/907
  11053. const assert = __nccwpck_require__(9491)
  11054. const { Readable } = __nccwpck_require__(2781)
  11055. const { RequestAbortedError, NotSupportedError, InvalidArgumentError } = __nccwpck_require__(8045)
  11056. const util = __nccwpck_require__(3983)
  11057. const { ReadableStreamFrom, toUSVString } = __nccwpck_require__(3983)
  11058. let Blob
  11059. const kConsume = Symbol('kConsume')
  11060. const kReading = Symbol('kReading')
  11061. const kBody = Symbol('kBody')
  11062. const kAbort = Symbol('abort')
  11063. const kContentType = Symbol('kContentType')
  11064. const noop = () => {}
  11065. module.exports = class BodyReadable extends Readable {
  11066. constructor ({
  11067. resume,
  11068. abort,
  11069. contentType = '',
  11070. highWaterMark = 64 * 1024 // Same as nodejs fs streams.
  11071. }) {
  11072. super({
  11073. autoDestroy: true,
  11074. read: resume,
  11075. highWaterMark
  11076. })
  11077. this._readableState.dataEmitted = false
  11078. this[kAbort] = abort
  11079. this[kConsume] = null
  11080. this[kBody] = null
  11081. this[kContentType] = contentType
  11082. // Is stream being consumed through Readable API?
  11083. // This is an optimization so that we avoid checking
  11084. // for 'data' and 'readable' listeners in the hot path
  11085. // inside push().
  11086. this[kReading] = false
  11087. }
  11088. destroy (err) {
  11089. if (this.destroyed) {
  11090. // Node < 16
  11091. return this
  11092. }
  11093. if (!err && !this._readableState.endEmitted) {
  11094. err = new RequestAbortedError()
  11095. }
  11096. if (err) {
  11097. this[kAbort]()
  11098. }
  11099. return super.destroy(err)
  11100. }
  11101. emit (ev, ...args) {
  11102. if (ev === 'data') {
  11103. // Node < 16.7
  11104. this._readableState.dataEmitted = true
  11105. } else if (ev === 'error') {
  11106. // Node < 16
  11107. this._readableState.errorEmitted = true
  11108. }
  11109. return super.emit(ev, ...args)
  11110. }
  11111. on (ev, ...args) {
  11112. if (ev === 'data' || ev === 'readable') {
  11113. this[kReading] = true
  11114. }
  11115. return super.on(ev, ...args)
  11116. }
  11117. addListener (ev, ...args) {
  11118. return this.on(ev, ...args)
  11119. }
  11120. off (ev, ...args) {
  11121. const ret = super.off(ev, ...args)
  11122. if (ev === 'data' || ev === 'readable') {
  11123. this[kReading] = (
  11124. this.listenerCount('data') > 0 ||
  11125. this.listenerCount('readable') > 0
  11126. )
  11127. }
  11128. return ret
  11129. }
  11130. removeListener (ev, ...args) {
  11131. return this.off(ev, ...args)
  11132. }
  11133. push (chunk) {
  11134. if (this[kConsume] && chunk !== null && this.readableLength === 0) {
  11135. consumePush(this[kConsume], chunk)
  11136. return this[kReading] ? super.push(chunk) : true
  11137. }
  11138. return super.push(chunk)
  11139. }
  11140. // https://fetch.spec.whatwg.org/#dom-body-text
  11141. async text () {
  11142. return consume(this, 'text')
  11143. }
  11144. // https://fetch.spec.whatwg.org/#dom-body-json
  11145. async json () {
  11146. return consume(this, 'json')
  11147. }
  11148. // https://fetch.spec.whatwg.org/#dom-body-blob
  11149. async blob () {
  11150. return consume(this, 'blob')
  11151. }
  11152. // https://fetch.spec.whatwg.org/#dom-body-arraybuffer
  11153. async arrayBuffer () {
  11154. return consume(this, 'arrayBuffer')
  11155. }
  11156. // https://fetch.spec.whatwg.org/#dom-body-formdata
  11157. async formData () {
  11158. // TODO: Implement.
  11159. throw new NotSupportedError()
  11160. }
  11161. // https://fetch.spec.whatwg.org/#dom-body-bodyused
  11162. get bodyUsed () {
  11163. return util.isDisturbed(this)
  11164. }
  11165. // https://fetch.spec.whatwg.org/#dom-body-body
  11166. get body () {
  11167. if (!this[kBody]) {
  11168. this[kBody] = ReadableStreamFrom(this)
  11169. if (this[kConsume]) {
  11170. // TODO: Is this the best way to force a lock?
  11171. this[kBody].getReader() // Ensure stream is locked.
  11172. assert(this[kBody].locked)
  11173. }
  11174. }
  11175. return this[kBody]
  11176. }
  11177. dump (opts) {
  11178. let limit = opts && Number.isFinite(opts.limit) ? opts.limit : 262144
  11179. const signal = opts && opts.signal
  11180. if (signal) {
  11181. try {
  11182. if (typeof signal !== 'object' || !('aborted' in signal)) {
  11183. throw new InvalidArgumentError('signal must be an AbortSignal')
  11184. }
  11185. util.throwIfAborted(signal)
  11186. } catch (err) {
  11187. return Promise.reject(err)
  11188. }
  11189. }
  11190. if (this.closed) {
  11191. return Promise.resolve(null)
  11192. }
  11193. return new Promise((resolve, reject) => {
  11194. const signalListenerCleanup = signal
  11195. ? util.addAbortListener(signal, () => {
  11196. this.destroy()
  11197. })
  11198. : noop
  11199. this
  11200. .on('close', function () {
  11201. signalListenerCleanup()
  11202. if (signal && signal.aborted) {
  11203. reject(signal.reason || Object.assign(new Error('The operation was aborted'), { name: 'AbortError' }))
  11204. } else {
  11205. resolve(null)
  11206. }
  11207. })
  11208. .on('error', noop)
  11209. .on('data', function (chunk) {
  11210. limit -= chunk.length
  11211. if (limit <= 0) {
  11212. this.destroy()
  11213. }
  11214. })
  11215. .resume()
  11216. })
  11217. }
  11218. }
  11219. // https://streams.spec.whatwg.org/#readablestream-locked
  11220. function isLocked (self) {
  11221. // Consume is an implicit lock.
  11222. return (self[kBody] && self[kBody].locked === true) || self[kConsume]
  11223. }
  11224. // https://fetch.spec.whatwg.org/#body-unusable
  11225. function isUnusable (self) {
  11226. return util.isDisturbed(self) || isLocked(self)
  11227. }
  11228. async function consume (stream, type) {
  11229. if (isUnusable(stream)) {
  11230. throw new TypeError('unusable')
  11231. }
  11232. assert(!stream[kConsume])
  11233. return new Promise((resolve, reject) => {
  11234. stream[kConsume] = {
  11235. type,
  11236. stream,
  11237. resolve,
  11238. reject,
  11239. length: 0,
  11240. body: []
  11241. }
  11242. stream
  11243. .on('error', function (err) {
  11244. consumeFinish(this[kConsume], err)
  11245. })
  11246. .on('close', function () {
  11247. if (this[kConsume].body !== null) {
  11248. consumeFinish(this[kConsume], new RequestAbortedError())
  11249. }
  11250. })
  11251. process.nextTick(consumeStart, stream[kConsume])
  11252. })
  11253. }
  11254. function consumeStart (consume) {
  11255. if (consume.body === null) {
  11256. return
  11257. }
  11258. const { _readableState: state } = consume.stream
  11259. for (const chunk of state.buffer) {
  11260. consumePush(consume, chunk)
  11261. }
  11262. if (state.endEmitted) {
  11263. consumeEnd(this[kConsume])
  11264. } else {
  11265. consume.stream.on('end', function () {
  11266. consumeEnd(this[kConsume])
  11267. })
  11268. }
  11269. consume.stream.resume()
  11270. while (consume.stream.read() != null) {
  11271. // Loop
  11272. }
  11273. }
  11274. function consumeEnd (consume) {
  11275. const { type, body, resolve, stream, length } = consume
  11276. try {
  11277. if (type === 'text') {
  11278. resolve(toUSVString(Buffer.concat(body)))
  11279. } else if (type === 'json') {
  11280. resolve(JSON.parse(Buffer.concat(body)))
  11281. } else if (type === 'arrayBuffer') {
  11282. const dst = new Uint8Array(length)
  11283. let pos = 0
  11284. for (const buf of body) {
  11285. dst.set(buf, pos)
  11286. pos += buf.byteLength
  11287. }
  11288. resolve(dst.buffer)
  11289. } else if (type === 'blob') {
  11290. if (!Blob) {
  11291. Blob = (__nccwpck_require__(4300).Blob)
  11292. }
  11293. resolve(new Blob(body, { type: stream[kContentType] }))
  11294. }
  11295. consumeFinish(consume)
  11296. } catch (err) {
  11297. stream.destroy(err)
  11298. }
  11299. }
  11300. function consumePush (consume, chunk) {
  11301. consume.length += chunk.length
  11302. consume.body.push(chunk)
  11303. }
  11304. function consumeFinish (consume, err) {
  11305. if (consume.body === null) {
  11306. return
  11307. }
  11308. if (err) {
  11309. consume.reject(err)
  11310. } else {
  11311. consume.resolve()
  11312. }
  11313. consume.type = null
  11314. consume.stream = null
  11315. consume.resolve = null
  11316. consume.reject = null
  11317. consume.length = 0
  11318. consume.body = null
  11319. }
  11320. /***/ }),
  11321. /***/ 7474:
  11322. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11323. const assert = __nccwpck_require__(9491)
  11324. const {
  11325. ResponseStatusCodeError
  11326. } = __nccwpck_require__(8045)
  11327. const { toUSVString } = __nccwpck_require__(3983)
  11328. async function getResolveErrorBodyCallback ({ callback, body, contentType, statusCode, statusMessage, headers }) {
  11329. assert(body)
  11330. let chunks = []
  11331. let limit = 0
  11332. for await (const chunk of body) {
  11333. chunks.push(chunk)
  11334. limit += chunk.length
  11335. if (limit > 128 * 1024) {
  11336. chunks = null
  11337. break
  11338. }
  11339. }
  11340. if (statusCode === 204 || !contentType || !chunks) {
  11341. process.nextTick(callback, new ResponseStatusCodeError(`Response status code ${statusCode}${statusMessage ? `: ${statusMessage}` : ''}`, statusCode, headers))
  11342. return
  11343. }
  11344. try {
  11345. if (contentType.startsWith('application/json')) {
  11346. const payload = JSON.parse(toUSVString(Buffer.concat(chunks)))
  11347. process.nextTick(callback, new ResponseStatusCodeError(`Response status code ${statusCode}${statusMessage ? `: ${statusMessage}` : ''}`, statusCode, headers, payload))
  11348. return
  11349. }
  11350. if (contentType.startsWith('text/')) {
  11351. const payload = toUSVString(Buffer.concat(chunks))
  11352. process.nextTick(callback, new ResponseStatusCodeError(`Response status code ${statusCode}${statusMessage ? `: ${statusMessage}` : ''}`, statusCode, headers, payload))
  11353. return
  11354. }
  11355. } catch (err) {
  11356. // Process in a fallback if error
  11357. }
  11358. process.nextTick(callback, new ResponseStatusCodeError(`Response status code ${statusCode}${statusMessage ? `: ${statusMessage}` : ''}`, statusCode, headers))
  11359. }
  11360. module.exports = { getResolveErrorBodyCallback }
  11361. /***/ }),
  11362. /***/ 7931:
  11363. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11364. const {
  11365. BalancedPoolMissingUpstreamError,
  11366. InvalidArgumentError
  11367. } = __nccwpck_require__(8045)
  11368. const {
  11369. PoolBase,
  11370. kClients,
  11371. kNeedDrain,
  11372. kAddClient,
  11373. kRemoveClient,
  11374. kGetDispatcher
  11375. } = __nccwpck_require__(3198)
  11376. const Pool = __nccwpck_require__(4634)
  11377. const { kUrl, kInterceptors } = __nccwpck_require__(2785)
  11378. const { parseOrigin } = __nccwpck_require__(3983)
  11379. const kFactory = Symbol('factory')
  11380. const kOptions = Symbol('options')
  11381. const kGreatestCommonDivisor = Symbol('kGreatestCommonDivisor')
  11382. const kCurrentWeight = Symbol('kCurrentWeight')
  11383. const kIndex = Symbol('kIndex')
  11384. const kWeight = Symbol('kWeight')
  11385. const kMaxWeightPerServer = Symbol('kMaxWeightPerServer')
  11386. const kErrorPenalty = Symbol('kErrorPenalty')
  11387. function getGreatestCommonDivisor (a, b) {
  11388. if (b === 0) return a
  11389. return getGreatestCommonDivisor(b, a % b)
  11390. }
  11391. function defaultFactory (origin, opts) {
  11392. return new Pool(origin, opts)
  11393. }
  11394. class BalancedPool extends PoolBase {
  11395. constructor (upstreams = [], { factory = defaultFactory, ...opts } = {}) {
  11396. super()
  11397. this[kOptions] = opts
  11398. this[kIndex] = -1
  11399. this[kCurrentWeight] = 0
  11400. this[kMaxWeightPerServer] = this[kOptions].maxWeightPerServer || 100
  11401. this[kErrorPenalty] = this[kOptions].errorPenalty || 15
  11402. if (!Array.isArray(upstreams)) {
  11403. upstreams = [upstreams]
  11404. }
  11405. if (typeof factory !== 'function') {
  11406. throw new InvalidArgumentError('factory must be a function.')
  11407. }
  11408. this[kInterceptors] = opts.interceptors && opts.interceptors.BalancedPool && Array.isArray(opts.interceptors.BalancedPool)
  11409. ? opts.interceptors.BalancedPool
  11410. : []
  11411. this[kFactory] = factory
  11412. for (const upstream of upstreams) {
  11413. this.addUpstream(upstream)
  11414. }
  11415. this._updateBalancedPoolStats()
  11416. }
  11417. addUpstream (upstream) {
  11418. const upstreamOrigin = parseOrigin(upstream).origin
  11419. if (this[kClients].find((pool) => (
  11420. pool[kUrl].origin === upstreamOrigin &&
  11421. pool.closed !== true &&
  11422. pool.destroyed !== true
  11423. ))) {
  11424. return this
  11425. }
  11426. const pool = this[kFactory](upstreamOrigin, Object.assign({}, this[kOptions]))
  11427. this[kAddClient](pool)
  11428. pool.on('connect', () => {
  11429. pool[kWeight] = Math.min(this[kMaxWeightPerServer], pool[kWeight] + this[kErrorPenalty])
  11430. })
  11431. pool.on('connectionError', () => {
  11432. pool[kWeight] = Math.max(1, pool[kWeight] - this[kErrorPenalty])
  11433. this._updateBalancedPoolStats()
  11434. })
  11435. pool.on('disconnect', (...args) => {
  11436. const err = args[2]
  11437. if (err && err.code === 'UND_ERR_SOCKET') {
  11438. // decrease the weight of the pool.
  11439. pool[kWeight] = Math.max(1, pool[kWeight] - this[kErrorPenalty])
  11440. this._updateBalancedPoolStats()
  11441. }
  11442. })
  11443. for (const client of this[kClients]) {
  11444. client[kWeight] = this[kMaxWeightPerServer]
  11445. }
  11446. this._updateBalancedPoolStats()
  11447. return this
  11448. }
  11449. _updateBalancedPoolStats () {
  11450. this[kGreatestCommonDivisor] = this[kClients].map(p => p[kWeight]).reduce(getGreatestCommonDivisor, 0)
  11451. }
  11452. removeUpstream (upstream) {
  11453. const upstreamOrigin = parseOrigin(upstream).origin
  11454. const pool = this[kClients].find((pool) => (
  11455. pool[kUrl].origin === upstreamOrigin &&
  11456. pool.closed !== true &&
  11457. pool.destroyed !== true
  11458. ))
  11459. if (pool) {
  11460. this[kRemoveClient](pool)
  11461. }
  11462. return this
  11463. }
  11464. get upstreams () {
  11465. return this[kClients]
  11466. .filter(dispatcher => dispatcher.closed !== true && dispatcher.destroyed !== true)
  11467. .map((p) => p[kUrl].origin)
  11468. }
  11469. [kGetDispatcher] () {
  11470. // We validate that pools is greater than 0,
  11471. // otherwise we would have to wait until an upstream
  11472. // is added, which might never happen.
  11473. if (this[kClients].length === 0) {
  11474. throw new BalancedPoolMissingUpstreamError()
  11475. }
  11476. const dispatcher = this[kClients].find(dispatcher => (
  11477. !dispatcher[kNeedDrain] &&
  11478. dispatcher.closed !== true &&
  11479. dispatcher.destroyed !== true
  11480. ))
  11481. if (!dispatcher) {
  11482. return
  11483. }
  11484. const allClientsBusy = this[kClients].map(pool => pool[kNeedDrain]).reduce((a, b) => a && b, true)
  11485. if (allClientsBusy) {
  11486. return
  11487. }
  11488. let counter = 0
  11489. let maxWeightIndex = this[kClients].findIndex(pool => !pool[kNeedDrain])
  11490. while (counter++ < this[kClients].length) {
  11491. this[kIndex] = (this[kIndex] + 1) % this[kClients].length
  11492. const pool = this[kClients][this[kIndex]]
  11493. // find pool index with the largest weight
  11494. if (pool[kWeight] > this[kClients][maxWeightIndex][kWeight] && !pool[kNeedDrain]) {
  11495. maxWeightIndex = this[kIndex]
  11496. }
  11497. // decrease the current weight every `this[kClients].length`.
  11498. if (this[kIndex] === 0) {
  11499. // Set the current weight to the next lower weight.
  11500. this[kCurrentWeight] = this[kCurrentWeight] - this[kGreatestCommonDivisor]
  11501. if (this[kCurrentWeight] <= 0) {
  11502. this[kCurrentWeight] = this[kMaxWeightPerServer]
  11503. }
  11504. }
  11505. if (pool[kWeight] >= this[kCurrentWeight] && (!pool[kNeedDrain])) {
  11506. return pool
  11507. }
  11508. }
  11509. this[kCurrentWeight] = this[kClients][maxWeightIndex][kWeight]
  11510. this[kIndex] = maxWeightIndex
  11511. return this[kClients][maxWeightIndex]
  11512. }
  11513. }
  11514. module.exports = BalancedPool
  11515. /***/ }),
  11516. /***/ 6101:
  11517. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  11518. const { kConstruct } = __nccwpck_require__(9174)
  11519. const { urlEquals, fieldValues: getFieldValues } = __nccwpck_require__(2396)
  11520. const { kEnumerableProperty, isDisturbed } = __nccwpck_require__(3983)
  11521. const { kHeadersList } = __nccwpck_require__(2785)
  11522. const { webidl } = __nccwpck_require__(1744)
  11523. const { Response, cloneResponse } = __nccwpck_require__(7823)
  11524. const { Request } = __nccwpck_require__(8359)
  11525. const { kState, kHeaders, kGuard, kRealm } = __nccwpck_require__(5861)
  11526. const { fetching } = __nccwpck_require__(4881)
  11527. const { urlIsHttpHttpsScheme, createDeferredPromise, readAllBytes } = __nccwpck_require__(2538)
  11528. const assert = __nccwpck_require__(9491)
  11529. const { getGlobalDispatcher } = __nccwpck_require__(1892)
  11530. /**
  11531. * @see https://w3c.github.io/ServiceWorker/#dfn-cache-batch-operation
  11532. * @typedef {Object} CacheBatchOperation
  11533. * @property {'delete' | 'put'} type
  11534. * @property {any} request
  11535. * @property {any} response
  11536. * @property {import('../../types/cache').CacheQueryOptions} options
  11537. */
  11538. /**
  11539. * @see https://w3c.github.io/ServiceWorker/#dfn-request-response-list
  11540. * @typedef {[any, any][]} requestResponseList
  11541. */
  11542. class Cache {
  11543. /**
  11544. * @see https://w3c.github.io/ServiceWorker/#dfn-relevant-request-response-list
  11545. * @type {requestResponseList}
  11546. */
  11547. #relevantRequestResponseList
  11548. constructor () {
  11549. if (arguments[0] !== kConstruct) {
  11550. webidl.illegalConstructor()
  11551. }
  11552. this.#relevantRequestResponseList = arguments[1]
  11553. }
  11554. async match (request, options = {}) {
  11555. webidl.brandCheck(this, Cache)
  11556. webidl.argumentLengthCheck(arguments, 1, { header: 'Cache.match' })
  11557. request = webidl.converters.RequestInfo(request)
  11558. options = webidl.converters.CacheQueryOptions(options)
  11559. const p = await this.matchAll(request, options)
  11560. if (p.length === 0) {
  11561. return
  11562. }
  11563. return p[0]
  11564. }
  11565. async matchAll (request = undefined, options = {}) {
  11566. webidl.brandCheck(this, Cache)
  11567. if (request !== undefined) request = webidl.converters.RequestInfo(request)
  11568. options = webidl.converters.CacheQueryOptions(options)
  11569. // 1.
  11570. let r = null
  11571. // 2.
  11572. if (request !== undefined) {
  11573. if (request instanceof Request) {
  11574. // 2.1.1
  11575. r = request[kState]
  11576. // 2.1.2
  11577. if (r.method !== 'GET' && !options.ignoreMethod) {
  11578. return []
  11579. }
  11580. } else if (typeof request === 'string') {
  11581. // 2.2.1
  11582. r = new Request(request)[kState]
  11583. }
  11584. }
  11585. // 5.
  11586. // 5.1
  11587. const responses = []
  11588. // 5.2
  11589. if (request === undefined) {
  11590. // 5.2.1
  11591. for (const requestResponse of this.#relevantRequestResponseList) {
  11592. responses.push(requestResponse[1])
  11593. }
  11594. } else { // 5.3
  11595. // 5.3.1
  11596. const requestResponses = this.#queryCache(r, options)
  11597. // 5.3.2
  11598. for (const requestResponse of requestResponses) {
  11599. responses.push(requestResponse[1])
  11600. }
  11601. }
  11602. // 5.4
  11603. // We don't implement CORs so we don't need to loop over the responses, yay!
  11604. // 5.5.1
  11605. const responseList = []
  11606. // 5.5.2
  11607. for (const response of responses) {
  11608. // 5.5.2.1
  11609. const responseObject = new Response(response.body?.source ?? null)
  11610. const body = responseObject[kState].body
  11611. responseObject[kState] = response
  11612. responseObject[kState].body = body
  11613. responseObject[kHeaders][kHeadersList] = response.headersList
  11614. responseObject[kHeaders][kGuard] = 'immutable'
  11615. responseList.push(responseObject)
  11616. }
  11617. // 6.
  11618. return Object.freeze(responseList)
  11619. }
  11620. async add (request) {
  11621. webidl.brandCheck(this, Cache)
  11622. webidl.argumentLengthCheck(arguments, 1, { header: 'Cache.add' })
  11623. request = webidl.converters.RequestInfo(request)
  11624. // 1.
  11625. const requests = [request]
  11626. // 2.
  11627. const responseArrayPromise = this.addAll(requests)
  11628. // 3.
  11629. return await responseArrayPromise
  11630. }
  11631. async addAll (requests) {
  11632. webidl.brandCheck(this, Cache)
  11633. webidl.argumentLengthCheck(arguments, 1, { header: 'Cache.addAll' })
  11634. requests = webidl.converters['sequence<RequestInfo>'](requests)
  11635. // 1.
  11636. const responsePromises = []
  11637. // 2.
  11638. const requestList = []
  11639. // 3.
  11640. for (const request of requests) {
  11641. if (typeof request === 'string') {
  11642. continue
  11643. }
  11644. // 3.1
  11645. const r = request[kState]
  11646. // 3.2
  11647. if (!urlIsHttpHttpsScheme(r.url) || r.method !== 'GET') {
  11648. throw webidl.errors.exception({
  11649. header: 'Cache.addAll',
  11650. message: 'Expected http/s scheme when method is not GET.'
  11651. })
  11652. }
  11653. }
  11654. // 4.
  11655. /** @type {ReturnType<typeof fetching>[]} */
  11656. const fetchControllers = []
  11657. // 5.
  11658. for (const request of requests) {
  11659. // 5.1
  11660. const r = new Request(request)[kState]
  11661. // 5.2
  11662. if (!urlIsHttpHttpsScheme(r.url)) {
  11663. throw webidl.errors.exception({
  11664. header: 'Cache.addAll',
  11665. message: 'Expected http/s scheme.'
  11666. })
  11667. }
  11668. // 5.4
  11669. r.initiator = 'fetch'
  11670. r.destination = 'subresource'
  11671. // 5.5
  11672. requestList.push(r)
  11673. // 5.6
  11674. const responsePromise = createDeferredPromise()
  11675. // 5.7
  11676. fetchControllers.push(fetching({
  11677. request: r,
  11678. dispatcher: getGlobalDispatcher(),
  11679. processResponse (response) {
  11680. // 1.
  11681. if (response.type === 'error' || response.status === 206 || response.status < 200 || response.status > 299) {
  11682. responsePromise.reject(webidl.errors.exception({
  11683. header: 'Cache.addAll',
  11684. message: 'Received an invalid status code or the request failed.'
  11685. }))
  11686. } else if (response.headersList.contains('vary')) { // 2.
  11687. // 2.1
  11688. const fieldValues = getFieldValues(response.headersList.get('vary'))
  11689. // 2.2
  11690. for (const fieldValue of fieldValues) {
  11691. // 2.2.1
  11692. if (fieldValue === '*') {
  11693. responsePromise.reject(webidl.errors.exception({
  11694. header: 'Cache.addAll',
  11695. message: 'invalid vary field value'
  11696. }))
  11697. for (const controller of fetchControllers) {
  11698. controller.abort()
  11699. }
  11700. return
  11701. }
  11702. }
  11703. }
  11704. },
  11705. processResponseEndOfBody (response) {
  11706. // 1.
  11707. if (response.aborted) {
  11708. responsePromise.reject(new DOMException('aborted', 'AbortError'))
  11709. return
  11710. }
  11711. // 2.
  11712. responsePromise.resolve(response)
  11713. }
  11714. }))
  11715. // 5.8
  11716. responsePromises.push(responsePromise.promise)
  11717. }
  11718. // 6.
  11719. const p = Promise.all(responsePromises)
  11720. // 7.
  11721. const responses = await p
  11722. // 7.1
  11723. const operations = []
  11724. // 7.2
  11725. let index = 0
  11726. // 7.3
  11727. for (const response of responses) {
  11728. // 7.3.1
  11729. /** @type {CacheBatchOperation} */
  11730. const operation = {
  11731. type: 'put', // 7.3.2
  11732. request: requestList[index], // 7.3.3
  11733. response // 7.3.4
  11734. }
  11735. operations.push(operation) // 7.3.5
  11736. index++ // 7.3.6
  11737. }
  11738. // 7.5
  11739. const cacheJobPromise = createDeferredPromise()
  11740. // 7.6.1
  11741. let errorData = null
  11742. // 7.6.2
  11743. try {
  11744. this.#batchCacheOperations(operations)
  11745. } catch (e) {
  11746. errorData = e
  11747. }
  11748. // 7.6.3
  11749. queueMicrotask(() => {
  11750. // 7.6.3.1
  11751. if (errorData === null) {
  11752. cacheJobPromise.resolve(undefined)
  11753. } else {
  11754. // 7.6.3.2
  11755. cacheJobPromise.reject(errorData)
  11756. }
  11757. })
  11758. // 7.7
  11759. return cacheJobPromise.promise
  11760. }
  11761. async put (request, response) {
  11762. webidl.brandCheck(this, Cache)
  11763. webidl.argumentLengthCheck(arguments, 2, { header: 'Cache.put' })
  11764. request = webidl.converters.RequestInfo(request)
  11765. response = webidl.converters.Response(response)
  11766. // 1.
  11767. let innerRequest = null
  11768. // 2.
  11769. if (request instanceof Request) {
  11770. innerRequest = request[kState]
  11771. } else { // 3.
  11772. innerRequest = new Request(request)[kState]
  11773. }
  11774. // 4.
  11775. if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== 'GET') {
  11776. throw webidl.errors.exception({
  11777. header: 'Cache.put',
  11778. message: 'Expected an http/s scheme when method is not GET'
  11779. })
  11780. }
  11781. // 5.
  11782. const innerResponse = response[kState]
  11783. // 6.
  11784. if (innerResponse.status === 206) {
  11785. throw webidl.errors.exception({
  11786. header: 'Cache.put',
  11787. message: 'Got 206 status'
  11788. })
  11789. }
  11790. // 7.
  11791. if (innerResponse.headersList.contains('vary')) {
  11792. // 7.1.
  11793. const fieldValues = getFieldValues(innerResponse.headersList.get('vary'))
  11794. // 7.2.
  11795. for (const fieldValue of fieldValues) {
  11796. // 7.2.1
  11797. if (fieldValue === '*') {
  11798. throw webidl.errors.exception({
  11799. header: 'Cache.put',
  11800. message: 'Got * vary field value'
  11801. })
  11802. }
  11803. }
  11804. }
  11805. // 8.
  11806. if (innerResponse.body && (isDisturbed(innerResponse.body.stream) || innerResponse.body.stream.locked)) {
  11807. throw webidl.errors.exception({
  11808. header: 'Cache.put',
  11809. message: 'Response body is locked or disturbed'
  11810. })
  11811. }
  11812. // 9.
  11813. const clonedResponse = cloneResponse(innerResponse)
  11814. // 10.
  11815. const bodyReadPromise = createDeferredPromise()
  11816. // 11.
  11817. if (innerResponse.body != null) {
  11818. // 11.1
  11819. const stream = innerResponse.body.stream
  11820. // 11.2
  11821. const reader = stream.getReader()
  11822. // 11.3
  11823. readAllBytes(reader).then(bodyReadPromise.resolve, bodyReadPromise.reject)
  11824. } else {
  11825. bodyReadPromise.resolve(undefined)
  11826. }
  11827. // 12.
  11828. /** @type {CacheBatchOperation[]} */
  11829. const operations = []
  11830. // 13.
  11831. /** @type {CacheBatchOperation} */
  11832. const operation = {
  11833. type: 'put', // 14.
  11834. request: innerRequest, // 15.
  11835. response: clonedResponse // 16.
  11836. }
  11837. // 17.
  11838. operations.push(operation)
  11839. // 19.
  11840. const bytes = await bodyReadPromise.promise
  11841. if (clonedResponse.body != null) {
  11842. clonedResponse.body.source = bytes
  11843. }
  11844. // 19.1
  11845. const cacheJobPromise = createDeferredPromise()
  11846. // 19.2.1
  11847. let errorData = null
  11848. // 19.2.2
  11849. try {
  11850. this.#batchCacheOperations(operations)
  11851. } catch (e) {
  11852. errorData = e
  11853. }
  11854. // 19.2.3
  11855. queueMicrotask(() => {
  11856. // 19.2.3.1
  11857. if (errorData === null) {
  11858. cacheJobPromise.resolve()
  11859. } else { // 19.2.3.2
  11860. cacheJobPromise.reject(errorData)
  11861. }
  11862. })
  11863. return cacheJobPromise.promise
  11864. }
  11865. async delete (request, options = {}) {
  11866. webidl.brandCheck(this, Cache)
  11867. webidl.argumentLengthCheck(arguments, 1, { header: 'Cache.delete' })
  11868. request = webidl.converters.RequestInfo(request)
  11869. options = webidl.converters.CacheQueryOptions(options)
  11870. /**
  11871. * @type {Request}
  11872. */
  11873. let r = null
  11874. if (request instanceof Request) {
  11875. r = request[kState]
  11876. if (r.method !== 'GET' && !options.ignoreMethod) {
  11877. return false
  11878. }
  11879. } else {
  11880. assert(typeof request === 'string')
  11881. r = new Request(request)[kState]
  11882. }
  11883. /** @type {CacheBatchOperation[]} */
  11884. const operations = []
  11885. /** @type {CacheBatchOperation} */
  11886. const operation = {
  11887. type: 'delete',
  11888. request: r,
  11889. options
  11890. }
  11891. operations.push(operation)
  11892. const cacheJobPromise = createDeferredPromise()
  11893. let errorData = null
  11894. let requestResponses
  11895. try {
  11896. requestResponses = this.#batchCacheOperations(operations)
  11897. } catch (e) {
  11898. errorData = e
  11899. }
  11900. queueMicrotask(() => {
  11901. if (errorData === null) {
  11902. cacheJobPromise.resolve(!!requestResponses?.length)
  11903. } else {
  11904. cacheJobPromise.reject(errorData)
  11905. }
  11906. })
  11907. return cacheJobPromise.promise
  11908. }
  11909. /**
  11910. * @see https://w3c.github.io/ServiceWorker/#dom-cache-keys
  11911. * @param {any} request
  11912. * @param {import('../../types/cache').CacheQueryOptions} options
  11913. * @returns {readonly Request[]}
  11914. */
  11915. async keys (request = undefined, options = {}) {
  11916. webidl.brandCheck(this, Cache)
  11917. if (request !== undefined) request = webidl.converters.RequestInfo(request)
  11918. options = webidl.converters.CacheQueryOptions(options)
  11919. // 1.
  11920. let r = null
  11921. // 2.
  11922. if (request !== undefined) {
  11923. // 2.1
  11924. if (request instanceof Request) {
  11925. // 2.1.1
  11926. r = request[kState]
  11927. // 2.1.2
  11928. if (r.method !== 'GET' && !options.ignoreMethod) {
  11929. return []
  11930. }
  11931. } else if (typeof request === 'string') { // 2.2
  11932. r = new Request(request)[kState]
  11933. }
  11934. }
  11935. // 4.
  11936. const promise = createDeferredPromise()
  11937. // 5.
  11938. // 5.1
  11939. const requests = []
  11940. // 5.2
  11941. if (request === undefined) {
  11942. // 5.2.1
  11943. for (const requestResponse of this.#relevantRequestResponseList) {
  11944. // 5.2.1.1
  11945. requests.push(requestResponse[0])
  11946. }
  11947. } else { // 5.3
  11948. // 5.3.1
  11949. const requestResponses = this.#queryCache(r, options)
  11950. // 5.3.2
  11951. for (const requestResponse of requestResponses) {
  11952. // 5.3.2.1
  11953. requests.push(requestResponse[0])
  11954. }
  11955. }
  11956. // 5.4
  11957. queueMicrotask(() => {
  11958. // 5.4.1
  11959. const requestList = []
  11960. // 5.4.2
  11961. for (const request of requests) {
  11962. const requestObject = new Request('https://a')
  11963. requestObject[kState] = request
  11964. requestObject[kHeaders][kHeadersList] = request.headersList
  11965. requestObject[kHeaders][kGuard] = 'immutable'
  11966. requestObject[kRealm] = request.client
  11967. // 5.4.2.1
  11968. requestList.push(requestObject)
  11969. }
  11970. // 5.4.3
  11971. promise.resolve(Object.freeze(requestList))
  11972. })
  11973. return promise.promise
  11974. }
  11975. /**
  11976. * @see https://w3c.github.io/ServiceWorker/#batch-cache-operations-algorithm
  11977. * @param {CacheBatchOperation[]} operations
  11978. * @returns {requestResponseList}
  11979. */
  11980. #batchCacheOperations (operations) {
  11981. // 1.
  11982. const cache = this.#relevantRequestResponseList
  11983. // 2.
  11984. const backupCache = [...cache]
  11985. // 3.
  11986. const addedItems = []
  11987. // 4.1
  11988. const resultList = []
  11989. try {
  11990. // 4.2
  11991. for (const operation of operations) {
  11992. // 4.2.1
  11993. if (operation.type !== 'delete' && operation.type !== 'put') {
  11994. throw webidl.errors.exception({
  11995. header: 'Cache.#batchCacheOperations',
  11996. message: 'operation type does not match "delete" or "put"'
  11997. })
  11998. }
  11999. // 4.2.2
  12000. if (operation.type === 'delete' && operation.response != null) {
  12001. throw webidl.errors.exception({
  12002. header: 'Cache.#batchCacheOperations',
  12003. message: 'delete operation should not have an associated response'
  12004. })
  12005. }
  12006. // 4.2.3
  12007. if (this.#queryCache(operation.request, operation.options, addedItems).length) {
  12008. throw new DOMException('???', 'InvalidStateError')
  12009. }
  12010. // 4.2.4
  12011. let requestResponses
  12012. // 4.2.5
  12013. if (operation.type === 'delete') {
  12014. // 4.2.5.1
  12015. requestResponses = this.#queryCache(operation.request, operation.options)
  12016. // TODO: the spec is wrong, this is needed to pass WPTs
  12017. if (requestResponses.length === 0) {
  12018. return []
  12019. }
  12020. // 4.2.5.2
  12021. for (const requestResponse of requestResponses) {
  12022. const idx = cache.indexOf(requestResponse)
  12023. assert(idx !== -1)
  12024. // 4.2.5.2.1
  12025. cache.splice(idx, 1)
  12026. }
  12027. } else if (operation.type === 'put') { // 4.2.6
  12028. // 4.2.6.1
  12029. if (operation.response == null) {
  12030. throw webidl.errors.exception({
  12031. header: 'Cache.#batchCacheOperations',
  12032. message: 'put operation should have an associated response'
  12033. })
  12034. }
  12035. // 4.2.6.2
  12036. const r = operation.request
  12037. // 4.2.6.3
  12038. if (!urlIsHttpHttpsScheme(r.url)) {
  12039. throw webidl.errors.exception({
  12040. header: 'Cache.#batchCacheOperations',
  12041. message: 'expected http or https scheme'
  12042. })
  12043. }
  12044. // 4.2.6.4
  12045. if (r.method !== 'GET') {
  12046. throw webidl.errors.exception({
  12047. header: 'Cache.#batchCacheOperations',
  12048. message: 'not get method'
  12049. })
  12050. }
  12051. // 4.2.6.5
  12052. if (operation.options != null) {
  12053. throw webidl.errors.exception({
  12054. header: 'Cache.#batchCacheOperations',
  12055. message: 'options must not be defined'
  12056. })
  12057. }
  12058. // 4.2.6.6
  12059. requestResponses = this.#queryCache(operation.request)
  12060. // 4.2.6.7
  12061. for (const requestResponse of requestResponses) {
  12062. const idx = cache.indexOf(requestResponse)
  12063. assert(idx !== -1)
  12064. // 4.2.6.7.1
  12065. cache.splice(idx, 1)
  12066. }
  12067. // 4.2.6.8
  12068. cache.push([operation.request, operation.response])
  12069. // 4.2.6.10
  12070. addedItems.push([operation.request, operation.response])
  12071. }
  12072. // 4.2.7
  12073. resultList.push([operation.request, operation.response])
  12074. }
  12075. // 4.3
  12076. return resultList
  12077. } catch (e) { // 5.
  12078. // 5.1
  12079. this.#relevantRequestResponseList.length = 0
  12080. // 5.2
  12081. this.#relevantRequestResponseList = backupCache
  12082. // 5.3
  12083. throw e
  12084. }
  12085. }
  12086. /**
  12087. * @see https://w3c.github.io/ServiceWorker/#query-cache
  12088. * @param {any} requestQuery
  12089. * @param {import('../../types/cache').CacheQueryOptions} options
  12090. * @param {requestResponseList} targetStorage
  12091. * @returns {requestResponseList}
  12092. */
  12093. #queryCache (requestQuery, options, targetStorage) {
  12094. /** @type {requestResponseList} */
  12095. const resultList = []
  12096. const storage = targetStorage ?? this.#relevantRequestResponseList
  12097. for (const requestResponse of storage) {
  12098. const [cachedRequest, cachedResponse] = requestResponse
  12099. if (this.#requestMatchesCachedItem(requestQuery, cachedRequest, cachedResponse, options)) {
  12100. resultList.push(requestResponse)
  12101. }
  12102. }
  12103. return resultList
  12104. }
  12105. /**
  12106. * @see https://w3c.github.io/ServiceWorker/#request-matches-cached-item-algorithm
  12107. * @param {any} requestQuery
  12108. * @param {any} request
  12109. * @param {any | null} response
  12110. * @param {import('../../types/cache').CacheQueryOptions | undefined} options
  12111. * @returns {boolean}
  12112. */
  12113. #requestMatchesCachedItem (requestQuery, request, response = null, options) {
  12114. // if (options?.ignoreMethod === false && request.method === 'GET') {
  12115. // return false
  12116. // }
  12117. const queryURL = new URL(requestQuery.url)
  12118. const cachedURL = new URL(request.url)
  12119. if (options?.ignoreSearch) {
  12120. cachedURL.search = ''
  12121. queryURL.search = ''
  12122. }
  12123. if (!urlEquals(queryURL, cachedURL, true)) {
  12124. return false
  12125. }
  12126. if (
  12127. response == null ||
  12128. options?.ignoreVary ||
  12129. !response.headersList.contains('vary')
  12130. ) {
  12131. return true
  12132. }
  12133. const fieldValues = getFieldValues(response.headersList.get('vary'))
  12134. for (const fieldValue of fieldValues) {
  12135. if (fieldValue === '*') {
  12136. return false
  12137. }
  12138. const requestValue = request.headersList.get(fieldValue)
  12139. const queryValue = requestQuery.headersList.get(fieldValue)
  12140. // If one has the header and the other doesn't, or one has
  12141. // a different value than the other, return false
  12142. if (requestValue !== queryValue) {
  12143. return false
  12144. }
  12145. }
  12146. return true
  12147. }
  12148. }
  12149. Object.defineProperties(Cache.prototype, {
  12150. [Symbol.toStringTag]: {
  12151. value: 'Cache',
  12152. configurable: true
  12153. },
  12154. match: kEnumerableProperty,
  12155. matchAll: kEnumerableProperty,
  12156. add: kEnumerableProperty,
  12157. addAll: kEnumerableProperty,
  12158. put: kEnumerableProperty,
  12159. delete: kEnumerableProperty,
  12160. keys: kEnumerableProperty
  12161. })
  12162. const cacheQueryOptionConverters = [
  12163. {
  12164. key: 'ignoreSearch',
  12165. converter: webidl.converters.boolean,
  12166. defaultValue: false
  12167. },
  12168. {
  12169. key: 'ignoreMethod',
  12170. converter: webidl.converters.boolean,
  12171. defaultValue: false
  12172. },
  12173. {
  12174. key: 'ignoreVary',
  12175. converter: webidl.converters.boolean,
  12176. defaultValue: false
  12177. }
  12178. ]
  12179. webidl.converters.CacheQueryOptions = webidl.dictionaryConverter(cacheQueryOptionConverters)
  12180. webidl.converters.MultiCacheQueryOptions = webidl.dictionaryConverter([
  12181. ...cacheQueryOptionConverters,
  12182. {
  12183. key: 'cacheName',
  12184. converter: webidl.converters.DOMString
  12185. }
  12186. ])
  12187. webidl.converters.Response = webidl.interfaceConverter(Response)
  12188. webidl.converters['sequence<RequestInfo>'] = webidl.sequenceConverter(
  12189. webidl.converters.RequestInfo
  12190. )
  12191. module.exports = {
  12192. Cache
  12193. }
  12194. /***/ }),
  12195. /***/ 7907:
  12196. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  12197. const { kConstruct } = __nccwpck_require__(9174)
  12198. const { Cache } = __nccwpck_require__(6101)
  12199. const { webidl } = __nccwpck_require__(1744)
  12200. const { kEnumerableProperty } = __nccwpck_require__(3983)
  12201. class CacheStorage {
  12202. /**
  12203. * @see https://w3c.github.io/ServiceWorker/#dfn-relevant-name-to-cache-map
  12204. * @type {Map<string, import('./cache').requestResponseList}
  12205. */
  12206. #caches = new Map()
  12207. constructor () {
  12208. if (arguments[0] !== kConstruct) {
  12209. webidl.illegalConstructor()
  12210. }
  12211. }
  12212. async match (request, options = {}) {
  12213. webidl.brandCheck(this, CacheStorage)
  12214. webidl.argumentLengthCheck(arguments, 1, { header: 'CacheStorage.match' })
  12215. request = webidl.converters.RequestInfo(request)
  12216. options = webidl.converters.MultiCacheQueryOptions(options)
  12217. // 1.
  12218. if (options.cacheName != null) {
  12219. // 1.1.1.1
  12220. if (this.#caches.has(options.cacheName)) {
  12221. // 1.1.1.1.1
  12222. const cacheList = this.#caches.get(options.cacheName)
  12223. const cache = new Cache(kConstruct, cacheList)
  12224. return await cache.match(request, options)
  12225. }
  12226. } else { // 2.
  12227. // 2.2
  12228. for (const cacheList of this.#caches.values()) {
  12229. const cache = new Cache(kConstruct, cacheList)
  12230. // 2.2.1.2
  12231. const response = await cache.match(request, options)
  12232. if (response !== undefined) {
  12233. return response
  12234. }
  12235. }
  12236. }
  12237. }
  12238. /**
  12239. * @see https://w3c.github.io/ServiceWorker/#cache-storage-has
  12240. * @param {string} cacheName
  12241. * @returns {Promise<boolean>}
  12242. */
  12243. async has (cacheName) {
  12244. webidl.brandCheck(this, CacheStorage)
  12245. webidl.argumentLengthCheck(arguments, 1, { header: 'CacheStorage.has' })
  12246. cacheName = webidl.converters.DOMString(cacheName)
  12247. // 2.1.1
  12248. // 2.2
  12249. return this.#caches.has(cacheName)
  12250. }
  12251. /**
  12252. * @see https://w3c.github.io/ServiceWorker/#dom-cachestorage-open
  12253. * @param {string} cacheName
  12254. * @returns {Promise<Cache>}
  12255. */
  12256. async open (cacheName) {
  12257. webidl.brandCheck(this, CacheStorage)
  12258. webidl.argumentLengthCheck(arguments, 1, { header: 'CacheStorage.open' })
  12259. cacheName = webidl.converters.DOMString(cacheName)
  12260. // 2.1
  12261. if (this.#caches.has(cacheName)) {
  12262. // await caches.open('v1') !== await caches.open('v1')
  12263. // 2.1.1
  12264. const cache = this.#caches.get(cacheName)
  12265. // 2.1.1.1
  12266. return new Cache(kConstruct, cache)
  12267. }
  12268. // 2.2
  12269. const cache = []
  12270. // 2.3
  12271. this.#caches.set(cacheName, cache)
  12272. // 2.4
  12273. return new Cache(kConstruct, cache)
  12274. }
  12275. /**
  12276. * @see https://w3c.github.io/ServiceWorker/#cache-storage-delete
  12277. * @param {string} cacheName
  12278. * @returns {Promise<boolean>}
  12279. */
  12280. async delete (cacheName) {
  12281. webidl.brandCheck(this, CacheStorage)
  12282. webidl.argumentLengthCheck(arguments, 1, { header: 'CacheStorage.delete' })
  12283. cacheName = webidl.converters.DOMString(cacheName)
  12284. return this.#caches.delete(cacheName)
  12285. }
  12286. /**
  12287. * @see https://w3c.github.io/ServiceWorker/#cache-storage-keys
  12288. * @returns {string[]}
  12289. */
  12290. async keys () {
  12291. webidl.brandCheck(this, CacheStorage)
  12292. // 2.1
  12293. const keys = this.#caches.keys()
  12294. // 2.2
  12295. return [...keys]
  12296. }
  12297. }
  12298. Object.defineProperties(CacheStorage.prototype, {
  12299. [Symbol.toStringTag]: {
  12300. value: 'CacheStorage',
  12301. configurable: true
  12302. },
  12303. match: kEnumerableProperty,
  12304. has: kEnumerableProperty,
  12305. open: kEnumerableProperty,
  12306. delete: kEnumerableProperty,
  12307. keys: kEnumerableProperty
  12308. })
  12309. module.exports = {
  12310. CacheStorage
  12311. }
  12312. /***/ }),
  12313. /***/ 9174:
  12314. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  12315. module.exports = {
  12316. kConstruct: (__nccwpck_require__(2785).kConstruct)
  12317. }
  12318. /***/ }),
  12319. /***/ 2396:
  12320. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  12321. const assert = __nccwpck_require__(9491)
  12322. const { URLSerializer } = __nccwpck_require__(685)
  12323. const { isValidHeaderName } = __nccwpck_require__(2538)
  12324. /**
  12325. * @see https://url.spec.whatwg.org/#concept-url-equals
  12326. * @param {URL} A
  12327. * @param {URL} B
  12328. * @param {boolean | undefined} excludeFragment
  12329. * @returns {boolean}
  12330. */
  12331. function urlEquals (A, B, excludeFragment = false) {
  12332. const serializedA = URLSerializer(A, excludeFragment)
  12333. const serializedB = URLSerializer(B, excludeFragment)
  12334. return serializedA === serializedB
  12335. }
  12336. /**
  12337. * @see https://github.com/chromium/chromium/blob/694d20d134cb553d8d89e5500b9148012b1ba299/content/browser/cache_storage/cache_storage_cache.cc#L260-L262
  12338. * @param {string} header
  12339. */
  12340. function fieldValues (header) {
  12341. assert(header !== null)
  12342. const values = []
  12343. for (let value of header.split(',')) {
  12344. value = value.trim()
  12345. if (!value.length) {
  12346. continue
  12347. } else if (!isValidHeaderName(value)) {
  12348. continue
  12349. }
  12350. values.push(value)
  12351. }
  12352. return values
  12353. }
  12354. module.exports = {
  12355. urlEquals,
  12356. fieldValues
  12357. }
  12358. /***/ }),
  12359. /***/ 3598:
  12360. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  12361. // @ts-check
  12362. /* global WebAssembly */
  12363. const assert = __nccwpck_require__(9491)
  12364. const net = __nccwpck_require__(1808)
  12365. const http = __nccwpck_require__(3685)
  12366. const { pipeline } = __nccwpck_require__(2781)
  12367. const util = __nccwpck_require__(3983)
  12368. const timers = __nccwpck_require__(9459)
  12369. const Request = __nccwpck_require__(2905)
  12370. const DispatcherBase = __nccwpck_require__(4839)
  12371. const {
  12372. RequestContentLengthMismatchError,
  12373. ResponseContentLengthMismatchError,
  12374. InvalidArgumentError,
  12375. RequestAbortedError,
  12376. HeadersTimeoutError,
  12377. HeadersOverflowError,
  12378. SocketError,
  12379. InformationalError,
  12380. BodyTimeoutError,
  12381. HTTPParserError,
  12382. ResponseExceededMaxSizeError,
  12383. ClientDestroyedError
  12384. } = __nccwpck_require__(8045)
  12385. const buildConnector = __nccwpck_require__(2067)
  12386. const {
  12387. kUrl,
  12388. kReset,
  12389. kServerName,
  12390. kClient,
  12391. kBusy,
  12392. kParser,
  12393. kConnect,
  12394. kBlocking,
  12395. kResuming,
  12396. kRunning,
  12397. kPending,
  12398. kSize,
  12399. kWriting,
  12400. kQueue,
  12401. kConnected,
  12402. kConnecting,
  12403. kNeedDrain,
  12404. kNoRef,
  12405. kKeepAliveDefaultTimeout,
  12406. kHostHeader,
  12407. kPendingIdx,
  12408. kRunningIdx,
  12409. kError,
  12410. kPipelining,
  12411. kSocket,
  12412. kKeepAliveTimeoutValue,
  12413. kMaxHeadersSize,
  12414. kKeepAliveMaxTimeout,
  12415. kKeepAliveTimeoutThreshold,
  12416. kHeadersTimeout,
  12417. kBodyTimeout,
  12418. kStrictContentLength,
  12419. kConnector,
  12420. kMaxRedirections,
  12421. kMaxRequests,
  12422. kCounter,
  12423. kClose,
  12424. kDestroy,
  12425. kDispatch,
  12426. kInterceptors,
  12427. kLocalAddress,
  12428. kMaxResponseSize,
  12429. kHTTPConnVersion,
  12430. // HTTP2
  12431. kHost,
  12432. kHTTP2Session,
  12433. kHTTP2SessionState,
  12434. kHTTP2BuildRequest,
  12435. kHTTP2CopyHeaders,
  12436. kHTTP1BuildRequest
  12437. } = __nccwpck_require__(2785)
  12438. /** @type {import('http2')} */
  12439. let http2
  12440. try {
  12441. http2 = __nccwpck_require__(5158)
  12442. } catch {
  12443. // @ts-ignore
  12444. http2 = { constants: {} }
  12445. }
  12446. const {
  12447. constants: {
  12448. HTTP2_HEADER_AUTHORITY,
  12449. HTTP2_HEADER_METHOD,
  12450. HTTP2_HEADER_PATH,
  12451. HTTP2_HEADER_SCHEME,
  12452. HTTP2_HEADER_CONTENT_LENGTH,
  12453. HTTP2_HEADER_EXPECT,
  12454. HTTP2_HEADER_STATUS
  12455. }
  12456. } = http2
  12457. // Experimental
  12458. let h2ExperimentalWarned = false
  12459. const FastBuffer = Buffer[Symbol.species]
  12460. const kClosedResolve = Symbol('kClosedResolve')
  12461. const channels = {}
  12462. try {
  12463. const diagnosticsChannel = __nccwpck_require__(7643)
  12464. channels.sendHeaders = diagnosticsChannel.channel('undici:client:sendHeaders')
  12465. channels.beforeConnect = diagnosticsChannel.channel('undici:client:beforeConnect')
  12466. channels.connectError = diagnosticsChannel.channel('undici:client:connectError')
  12467. channels.connected = diagnosticsChannel.channel('undici:client:connected')
  12468. } catch {
  12469. channels.sendHeaders = { hasSubscribers: false }
  12470. channels.beforeConnect = { hasSubscribers: false }
  12471. channels.connectError = { hasSubscribers: false }
  12472. channels.connected = { hasSubscribers: false }
  12473. }
  12474. /**
  12475. * @type {import('../types/client').default}
  12476. */
  12477. class Client extends DispatcherBase {
  12478. /**
  12479. *
  12480. * @param {string|URL} url
  12481. * @param {import('../types/client').Client.Options} options
  12482. */
  12483. constructor (url, {
  12484. interceptors,
  12485. maxHeaderSize,
  12486. headersTimeout,
  12487. socketTimeout,
  12488. requestTimeout,
  12489. connectTimeout,
  12490. bodyTimeout,
  12491. idleTimeout,
  12492. keepAlive,
  12493. keepAliveTimeout,
  12494. maxKeepAliveTimeout,
  12495. keepAliveMaxTimeout,
  12496. keepAliveTimeoutThreshold,
  12497. socketPath,
  12498. pipelining,
  12499. tls,
  12500. strictContentLength,
  12501. maxCachedSessions,
  12502. maxRedirections,
  12503. connect,
  12504. maxRequestsPerClient,
  12505. localAddress,
  12506. maxResponseSize,
  12507. autoSelectFamily,
  12508. autoSelectFamilyAttemptTimeout,
  12509. // h2
  12510. allowH2,
  12511. maxConcurrentStreams
  12512. } = {}) {
  12513. super()
  12514. if (keepAlive !== undefined) {
  12515. throw new InvalidArgumentError('unsupported keepAlive, use pipelining=0 instead')
  12516. }
  12517. if (socketTimeout !== undefined) {
  12518. throw new InvalidArgumentError('unsupported socketTimeout, use headersTimeout & bodyTimeout instead')
  12519. }
  12520. if (requestTimeout !== undefined) {
  12521. throw new InvalidArgumentError('unsupported requestTimeout, use headersTimeout & bodyTimeout instead')
  12522. }
  12523. if (idleTimeout !== undefined) {
  12524. throw new InvalidArgumentError('unsupported idleTimeout, use keepAliveTimeout instead')
  12525. }
  12526. if (maxKeepAliveTimeout !== undefined) {
  12527. throw new InvalidArgumentError('unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead')
  12528. }
  12529. if (maxHeaderSize != null && !Number.isFinite(maxHeaderSize)) {
  12530. throw new InvalidArgumentError('invalid maxHeaderSize')
  12531. }
  12532. if (socketPath != null && typeof socketPath !== 'string') {
  12533. throw new InvalidArgumentError('invalid socketPath')
  12534. }
  12535. if (connectTimeout != null && (!Number.isFinite(connectTimeout) || connectTimeout < 0)) {
  12536. throw new InvalidArgumentError('invalid connectTimeout')
  12537. }
  12538. if (keepAliveTimeout != null && (!Number.isFinite(keepAliveTimeout) || keepAliveTimeout <= 0)) {
  12539. throw new InvalidArgumentError('invalid keepAliveTimeout')
  12540. }
  12541. if (keepAliveMaxTimeout != null && (!Number.isFinite(keepAliveMaxTimeout) || keepAliveMaxTimeout <= 0)) {
  12542. throw new InvalidArgumentError('invalid keepAliveMaxTimeout')
  12543. }
  12544. if (keepAliveTimeoutThreshold != null && !Number.isFinite(keepAliveTimeoutThreshold)) {
  12545. throw new InvalidArgumentError('invalid keepAliveTimeoutThreshold')
  12546. }
  12547. if (headersTimeout != null && (!Number.isInteger(headersTimeout) || headersTimeout < 0)) {
  12548. throw new InvalidArgumentError('headersTimeout must be a positive integer or zero')
  12549. }
  12550. if (bodyTimeout != null && (!Number.isInteger(bodyTimeout) || bodyTimeout < 0)) {
  12551. throw new InvalidArgumentError('bodyTimeout must be a positive integer or zero')
  12552. }
  12553. if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') {
  12554. throw new InvalidArgumentError('connect must be a function or an object')
  12555. }
  12556. if (maxRedirections != null && (!Number.isInteger(maxRedirections) || maxRedirections < 0)) {
  12557. throw new InvalidArgumentError('maxRedirections must be a positive number')
  12558. }
  12559. if (maxRequestsPerClient != null && (!Number.isInteger(maxRequestsPerClient) || maxRequestsPerClient < 0)) {
  12560. throw new InvalidArgumentError('maxRequestsPerClient must be a positive number')
  12561. }
  12562. if (localAddress != null && (typeof localAddress !== 'string' || net.isIP(localAddress) === 0)) {
  12563. throw new InvalidArgumentError('localAddress must be valid string IP address')
  12564. }
  12565. if (maxResponseSize != null && (!Number.isInteger(maxResponseSize) || maxResponseSize < -1)) {
  12566. throw new InvalidArgumentError('maxResponseSize must be a positive number')
  12567. }
  12568. if (
  12569. autoSelectFamilyAttemptTimeout != null &&
  12570. (!Number.isInteger(autoSelectFamilyAttemptTimeout) || autoSelectFamilyAttemptTimeout < -1)
  12571. ) {
  12572. throw new InvalidArgumentError('autoSelectFamilyAttemptTimeout must be a positive number')
  12573. }
  12574. // h2
  12575. if (allowH2 != null && typeof allowH2 !== 'boolean') {
  12576. throw new InvalidArgumentError('allowH2 must be a valid boolean value')
  12577. }
  12578. if (maxConcurrentStreams != null && (typeof maxConcurrentStreams !== 'number' || maxConcurrentStreams < 1)) {
  12579. throw new InvalidArgumentError('maxConcurrentStreams must be a possitive integer, greater than 0')
  12580. }
  12581. if (typeof connect !== 'function') {
  12582. connect = buildConnector({
  12583. ...tls,
  12584. maxCachedSessions,
  12585. allowH2,
  12586. socketPath,
  12587. timeout: connectTimeout,
  12588. ...(util.nodeHasAutoSelectFamily && autoSelectFamily ? { autoSelectFamily, autoSelectFamilyAttemptTimeout } : undefined),
  12589. ...connect
  12590. })
  12591. }
  12592. this[kInterceptors] = interceptors && interceptors.Client && Array.isArray(interceptors.Client)
  12593. ? interceptors.Client
  12594. : [createRedirectInterceptor({ maxRedirections })]
  12595. this[kUrl] = util.parseOrigin(url)
  12596. this[kConnector] = connect
  12597. this[kSocket] = null
  12598. this[kPipelining] = pipelining != null ? pipelining : 1
  12599. this[kMaxHeadersSize] = maxHeaderSize || http.maxHeaderSize
  12600. this[kKeepAliveDefaultTimeout] = keepAliveTimeout == null ? 4e3 : keepAliveTimeout
  12601. this[kKeepAliveMaxTimeout] = keepAliveMaxTimeout == null ? 600e3 : keepAliveMaxTimeout
  12602. this[kKeepAliveTimeoutThreshold] = keepAliveTimeoutThreshold == null ? 1e3 : keepAliveTimeoutThreshold
  12603. this[kKeepAliveTimeoutValue] = this[kKeepAliveDefaultTimeout]
  12604. this[kServerName] = null
  12605. this[kLocalAddress] = localAddress != null ? localAddress : null
  12606. this[kResuming] = 0 // 0, idle, 1, scheduled, 2 resuming
  12607. this[kNeedDrain] = 0 // 0, idle, 1, scheduled, 2 resuming
  12608. this[kHostHeader] = `host: ${this[kUrl].hostname}${this[kUrl].port ? `:${this[kUrl].port}` : ''}\r\n`
  12609. this[kBodyTimeout] = bodyTimeout != null ? bodyTimeout : 300e3
  12610. this[kHeadersTimeout] = headersTimeout != null ? headersTimeout : 300e3
  12611. this[kStrictContentLength] = strictContentLength == null ? true : strictContentLength
  12612. this[kMaxRedirections] = maxRedirections
  12613. this[kMaxRequests] = maxRequestsPerClient
  12614. this[kClosedResolve] = null
  12615. this[kMaxResponseSize] = maxResponseSize > -1 ? maxResponseSize : -1
  12616. this[kHTTPConnVersion] = 'h1'
  12617. // HTTP/2
  12618. this[kHTTP2Session] = null
  12619. this[kHTTP2SessionState] = !allowH2
  12620. ? null
  12621. : {
  12622. // streams: null, // Fixed queue of streams - For future support of `push`
  12623. openStreams: 0, // Keep track of them to decide wether or not unref the session
  12624. maxConcurrentStreams: maxConcurrentStreams != null ? maxConcurrentStreams : 100 // Max peerConcurrentStreams for a Node h2 server
  12625. }
  12626. this[kHost] = `${this[kUrl].hostname}${this[kUrl].port ? `:${this[kUrl].port}` : ''}`
  12627. // kQueue is built up of 3 sections separated by
  12628. // the kRunningIdx and kPendingIdx indices.
  12629. // | complete | running | pending |
  12630. // ^ kRunningIdx ^ kPendingIdx ^ kQueue.length
  12631. // kRunningIdx points to the first running element.
  12632. // kPendingIdx points to the first pending element.
  12633. // This implements a fast queue with an amortized
  12634. // time of O(1).
  12635. this[kQueue] = []
  12636. this[kRunningIdx] = 0
  12637. this[kPendingIdx] = 0
  12638. }
  12639. get pipelining () {
  12640. return this[kPipelining]
  12641. }
  12642. set pipelining (value) {
  12643. this[kPipelining] = value
  12644. resume(this, true)
  12645. }
  12646. get [kPending] () {
  12647. return this[kQueue].length - this[kPendingIdx]
  12648. }
  12649. get [kRunning] () {
  12650. return this[kPendingIdx] - this[kRunningIdx]
  12651. }
  12652. get [kSize] () {
  12653. return this[kQueue].length - this[kRunningIdx]
  12654. }
  12655. get [kConnected] () {
  12656. return !!this[kSocket] && !this[kConnecting] && !this[kSocket].destroyed
  12657. }
  12658. get [kBusy] () {
  12659. const socket = this[kSocket]
  12660. return (
  12661. (socket && (socket[kReset] || socket[kWriting] || socket[kBlocking])) ||
  12662. (this[kSize] >= (this[kPipelining] || 1)) ||
  12663. this[kPending] > 0
  12664. )
  12665. }
  12666. /* istanbul ignore: only used for test */
  12667. [kConnect] (cb) {
  12668. connect(this)
  12669. this.once('connect', cb)
  12670. }
  12671. [kDispatch] (opts, handler) {
  12672. const origin = opts.origin || this[kUrl].origin
  12673. const request = this[kHTTPConnVersion] === 'h2'
  12674. ? Request[kHTTP2BuildRequest](origin, opts, handler)
  12675. : Request[kHTTP1BuildRequest](origin, opts, handler)
  12676. this[kQueue].push(request)
  12677. if (this[kResuming]) {
  12678. // Do nothing.
  12679. } else if (util.bodyLength(request.body) == null && util.isIterable(request.body)) {
  12680. // Wait a tick in case stream/iterator is ended in the same tick.
  12681. this[kResuming] = 1
  12682. process.nextTick(resume, this)
  12683. } else {
  12684. resume(this, true)
  12685. }
  12686. if (this[kResuming] && this[kNeedDrain] !== 2 && this[kBusy]) {
  12687. this[kNeedDrain] = 2
  12688. }
  12689. return this[kNeedDrain] < 2
  12690. }
  12691. async [kClose] () {
  12692. // TODO: for H2 we need to gracefully flush the remaining enqueued
  12693. // request and close each stream.
  12694. return new Promise((resolve) => {
  12695. if (!this[kSize]) {
  12696. resolve(null)
  12697. } else {
  12698. this[kClosedResolve] = resolve
  12699. }
  12700. })
  12701. }
  12702. async [kDestroy] (err) {
  12703. return new Promise((resolve) => {
  12704. const requests = this[kQueue].splice(this[kPendingIdx])
  12705. for (let i = 0; i < requests.length; i++) {
  12706. const request = requests[i]
  12707. errorRequest(this, request, err)
  12708. }
  12709. const callback = () => {
  12710. if (this[kClosedResolve]) {
  12711. // TODO (fix): Should we error here with ClientDestroyedError?
  12712. this[kClosedResolve]()
  12713. this[kClosedResolve] = null
  12714. }
  12715. resolve()
  12716. }
  12717. if (this[kHTTP2Session] != null) {
  12718. util.destroy(this[kHTTP2Session], err)
  12719. this[kHTTP2Session] = null
  12720. this[kHTTP2SessionState] = null
  12721. }
  12722. if (!this[kSocket]) {
  12723. queueMicrotask(callback)
  12724. } else {
  12725. util.destroy(this[kSocket].on('close', callback), err)
  12726. }
  12727. resume(this)
  12728. })
  12729. }
  12730. }
  12731. function onHttp2SessionError (err) {
  12732. assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
  12733. this[kSocket][kError] = err
  12734. onError(this[kClient], err)
  12735. }
  12736. function onHttp2FrameError (type, code, id) {
  12737. const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`)
  12738. if (id === 0) {
  12739. this[kSocket][kError] = err
  12740. onError(this[kClient], err)
  12741. }
  12742. }
  12743. function onHttp2SessionEnd () {
  12744. util.destroy(this, new SocketError('other side closed'))
  12745. util.destroy(this[kSocket], new SocketError('other side closed'))
  12746. }
  12747. function onHTTP2GoAway (code) {
  12748. const client = this[kClient]
  12749. const err = new InformationalError(`HTTP/2: "GOAWAY" frame received with code ${code}`)
  12750. client[kSocket] = null
  12751. client[kHTTP2Session] = null
  12752. if (client.destroyed) {
  12753. assert(this[kPending] === 0)
  12754. // Fail entire queue.
  12755. const requests = client[kQueue].splice(client[kRunningIdx])
  12756. for (let i = 0; i < requests.length; i++) {
  12757. const request = requests[i]
  12758. errorRequest(this, request, err)
  12759. }
  12760. } else if (client[kRunning] > 0) {
  12761. // Fail head of pipeline.
  12762. const request = client[kQueue][client[kRunningIdx]]
  12763. client[kQueue][client[kRunningIdx]++] = null
  12764. errorRequest(client, request, err)
  12765. }
  12766. client[kPendingIdx] = client[kRunningIdx]
  12767. assert(client[kRunning] === 0)
  12768. client.emit('disconnect',
  12769. client[kUrl],
  12770. [client],
  12771. err
  12772. )
  12773. resume(client)
  12774. }
  12775. const constants = __nccwpck_require__(953)
  12776. const createRedirectInterceptor = __nccwpck_require__(8861)
  12777. const EMPTY_BUF = Buffer.alloc(0)
  12778. async function lazyllhttp () {
  12779. const llhttpWasmData = process.env.JEST_WORKER_ID ? __nccwpck_require__(1145) : undefined
  12780. let mod
  12781. try {
  12782. mod = await WebAssembly.compile(Buffer.from(__nccwpck_require__(5627), 'base64'))
  12783. } catch (e) {
  12784. /* istanbul ignore next */
  12785. // We could check if the error was caused by the simd option not
  12786. // being enabled, but the occurring of this other error
  12787. // * https://github.com/emscripten-core/emscripten/issues/11495
  12788. // got me to remove that check to avoid breaking Node 12.
  12789. mod = await WebAssembly.compile(Buffer.from(llhttpWasmData || __nccwpck_require__(1145), 'base64'))
  12790. }
  12791. return await WebAssembly.instantiate(mod, {
  12792. env: {
  12793. /* eslint-disable camelcase */
  12794. wasm_on_url: (p, at, len) => {
  12795. /* istanbul ignore next */
  12796. return 0
  12797. },
  12798. wasm_on_status: (p, at, len) => {
  12799. assert.strictEqual(currentParser.ptr, p)
  12800. const start = at - currentBufferPtr + currentBufferRef.byteOffset
  12801. return currentParser.onStatus(new FastBuffer(currentBufferRef.buffer, start, len)) || 0
  12802. },
  12803. wasm_on_message_begin: (p) => {
  12804. assert.strictEqual(currentParser.ptr, p)
  12805. return currentParser.onMessageBegin() || 0
  12806. },
  12807. wasm_on_header_field: (p, at, len) => {
  12808. assert.strictEqual(currentParser.ptr, p)
  12809. const start = at - currentBufferPtr + currentBufferRef.byteOffset
  12810. return currentParser.onHeaderField(new FastBuffer(currentBufferRef.buffer, start, len)) || 0
  12811. },
  12812. wasm_on_header_value: (p, at, len) => {
  12813. assert.strictEqual(currentParser.ptr, p)
  12814. const start = at - currentBufferPtr + currentBufferRef.byteOffset
  12815. return currentParser.onHeaderValue(new FastBuffer(currentBufferRef.buffer, start, len)) || 0
  12816. },
  12817. wasm_on_headers_complete: (p, statusCode, upgrade, shouldKeepAlive) => {
  12818. assert.strictEqual(currentParser.ptr, p)
  12819. return currentParser.onHeadersComplete(statusCode, Boolean(upgrade), Boolean(shouldKeepAlive)) || 0
  12820. },
  12821. wasm_on_body: (p, at, len) => {
  12822. assert.strictEqual(currentParser.ptr, p)
  12823. const start = at - currentBufferPtr + currentBufferRef.byteOffset
  12824. return currentParser.onBody(new FastBuffer(currentBufferRef.buffer, start, len)) || 0
  12825. },
  12826. wasm_on_message_complete: (p) => {
  12827. assert.strictEqual(currentParser.ptr, p)
  12828. return currentParser.onMessageComplete() || 0
  12829. }
  12830. /* eslint-enable camelcase */
  12831. }
  12832. })
  12833. }
  12834. let llhttpInstance = null
  12835. let llhttpPromise = lazyllhttp()
  12836. llhttpPromise.catch()
  12837. let currentParser = null
  12838. let currentBufferRef = null
  12839. let currentBufferSize = 0
  12840. let currentBufferPtr = null
  12841. const TIMEOUT_HEADERS = 1
  12842. const TIMEOUT_BODY = 2
  12843. const TIMEOUT_IDLE = 3
  12844. class Parser {
  12845. constructor (client, socket, { exports }) {
  12846. assert(Number.isFinite(client[kMaxHeadersSize]) && client[kMaxHeadersSize] > 0)
  12847. this.llhttp = exports
  12848. this.ptr = this.llhttp.llhttp_alloc(constants.TYPE.RESPONSE)
  12849. this.client = client
  12850. this.socket = socket
  12851. this.timeout = null
  12852. this.timeoutValue = null
  12853. this.timeoutType = null
  12854. this.statusCode = null
  12855. this.statusText = ''
  12856. this.upgrade = false
  12857. this.headers = []
  12858. this.headersSize = 0
  12859. this.headersMaxSize = client[kMaxHeadersSize]
  12860. this.shouldKeepAlive = false
  12861. this.paused = false
  12862. this.resume = this.resume.bind(this)
  12863. this.bytesRead = 0
  12864. this.keepAlive = ''
  12865. this.contentLength = ''
  12866. this.connection = ''
  12867. this.maxResponseSize = client[kMaxResponseSize]
  12868. }
  12869. setTimeout (value, type) {
  12870. this.timeoutType = type
  12871. if (value !== this.timeoutValue) {
  12872. timers.clearTimeout(this.timeout)
  12873. if (value) {
  12874. this.timeout = timers.setTimeout(onParserTimeout, value, this)
  12875. // istanbul ignore else: only for jest
  12876. if (this.timeout.unref) {
  12877. this.timeout.unref()
  12878. }
  12879. } else {
  12880. this.timeout = null
  12881. }
  12882. this.timeoutValue = value
  12883. } else if (this.timeout) {
  12884. // istanbul ignore else: only for jest
  12885. if (this.timeout.refresh) {
  12886. this.timeout.refresh()
  12887. }
  12888. }
  12889. }
  12890. resume () {
  12891. if (this.socket.destroyed || !this.paused) {
  12892. return
  12893. }
  12894. assert(this.ptr != null)
  12895. assert(currentParser == null)
  12896. this.llhttp.llhttp_resume(this.ptr)
  12897. assert(this.timeoutType === TIMEOUT_BODY)
  12898. if (this.timeout) {
  12899. // istanbul ignore else: only for jest
  12900. if (this.timeout.refresh) {
  12901. this.timeout.refresh()
  12902. }
  12903. }
  12904. this.paused = false
  12905. this.execute(this.socket.read() || EMPTY_BUF) // Flush parser.
  12906. this.readMore()
  12907. }
  12908. readMore () {
  12909. while (!this.paused && this.ptr) {
  12910. const chunk = this.socket.read()
  12911. if (chunk === null) {
  12912. break
  12913. }
  12914. this.execute(chunk)
  12915. }
  12916. }
  12917. execute (data) {
  12918. assert(this.ptr != null)
  12919. assert(currentParser == null)
  12920. assert(!this.paused)
  12921. const { socket, llhttp } = this
  12922. if (data.length > currentBufferSize) {
  12923. if (currentBufferPtr) {
  12924. llhttp.free(currentBufferPtr)
  12925. }
  12926. currentBufferSize = Math.ceil(data.length / 4096) * 4096
  12927. currentBufferPtr = llhttp.malloc(currentBufferSize)
  12928. }
  12929. new Uint8Array(llhttp.memory.buffer, currentBufferPtr, currentBufferSize).set(data)
  12930. // Call `execute` on the wasm parser.
  12931. // We pass the `llhttp_parser` pointer address, the pointer address of buffer view data,
  12932. // and finally the length of bytes to parse.
  12933. // The return value is an error code or `constants.ERROR.OK`.
  12934. try {
  12935. let ret
  12936. try {
  12937. currentBufferRef = data
  12938. currentParser = this
  12939. ret = llhttp.llhttp_execute(this.ptr, currentBufferPtr, data.length)
  12940. /* eslint-disable-next-line no-useless-catch */
  12941. } catch (err) {
  12942. /* istanbul ignore next: difficult to make a test case for */
  12943. throw err
  12944. } finally {
  12945. currentParser = null
  12946. currentBufferRef = null
  12947. }
  12948. const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr
  12949. if (ret === constants.ERROR.PAUSED_UPGRADE) {
  12950. this.onUpgrade(data.slice(offset))
  12951. } else if (ret === constants.ERROR.PAUSED) {
  12952. this.paused = true
  12953. socket.unshift(data.slice(offset))
  12954. } else if (ret !== constants.ERROR.OK) {
  12955. const ptr = llhttp.llhttp_get_error_reason(this.ptr)
  12956. let message = ''
  12957. /* istanbul ignore else: difficult to make a test case for */
  12958. if (ptr) {
  12959. const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0)
  12960. message =
  12961. 'Response does not match the HTTP/1.1 protocol (' +
  12962. Buffer.from(llhttp.memory.buffer, ptr, len).toString() +
  12963. ')'
  12964. }
  12965. throw new HTTPParserError(message, constants.ERROR[ret], data.slice(offset))
  12966. }
  12967. } catch (err) {
  12968. util.destroy(socket, err)
  12969. }
  12970. }
  12971. destroy () {
  12972. assert(this.ptr != null)
  12973. assert(currentParser == null)
  12974. this.llhttp.llhttp_free(this.ptr)
  12975. this.ptr = null
  12976. timers.clearTimeout(this.timeout)
  12977. this.timeout = null
  12978. this.timeoutValue = null
  12979. this.timeoutType = null
  12980. this.paused = false
  12981. }
  12982. onStatus (buf) {
  12983. this.statusText = buf.toString()
  12984. }
  12985. onMessageBegin () {
  12986. const { socket, client } = this
  12987. /* istanbul ignore next: difficult to make a test case for */
  12988. if (socket.destroyed) {
  12989. return -1
  12990. }
  12991. const request = client[kQueue][client[kRunningIdx]]
  12992. if (!request) {
  12993. return -1
  12994. }
  12995. }
  12996. onHeaderField (buf) {
  12997. const len = this.headers.length
  12998. if ((len & 1) === 0) {
  12999. this.headers.push(buf)
  13000. } else {
  13001. this.headers[len - 1] = Buffer.concat([this.headers[len - 1], buf])
  13002. }
  13003. this.trackHeader(buf.length)
  13004. }
  13005. onHeaderValue (buf) {
  13006. let len = this.headers.length
  13007. if ((len & 1) === 1) {
  13008. this.headers.push(buf)
  13009. len += 1
  13010. } else {
  13011. this.headers[len - 1] = Buffer.concat([this.headers[len - 1], buf])
  13012. }
  13013. const key = this.headers[len - 2]
  13014. if (key.length === 10 && key.toString().toLowerCase() === 'keep-alive') {
  13015. this.keepAlive += buf.toString()
  13016. } else if (key.length === 10 && key.toString().toLowerCase() === 'connection') {
  13017. this.connection += buf.toString()
  13018. } else if (key.length === 14 && key.toString().toLowerCase() === 'content-length') {
  13019. this.contentLength += buf.toString()
  13020. }
  13021. this.trackHeader(buf.length)
  13022. }
  13023. trackHeader (len) {
  13024. this.headersSize += len
  13025. if (this.headersSize >= this.headersMaxSize) {
  13026. util.destroy(this.socket, new HeadersOverflowError())
  13027. }
  13028. }
  13029. onUpgrade (head) {
  13030. const { upgrade, client, socket, headers, statusCode } = this
  13031. assert(upgrade)
  13032. const request = client[kQueue][client[kRunningIdx]]
  13033. assert(request)
  13034. assert(!socket.destroyed)
  13035. assert(socket === client[kSocket])
  13036. assert(!this.paused)
  13037. assert(request.upgrade || request.method === 'CONNECT')
  13038. this.statusCode = null
  13039. this.statusText = ''
  13040. this.shouldKeepAlive = null
  13041. assert(this.headers.length % 2 === 0)
  13042. this.headers = []
  13043. this.headersSize = 0
  13044. socket.unshift(head)
  13045. socket[kParser].destroy()
  13046. socket[kParser] = null
  13047. socket[kClient] = null
  13048. socket[kError] = null
  13049. socket
  13050. .removeListener('error', onSocketError)
  13051. .removeListener('readable', onSocketReadable)
  13052. .removeListener('end', onSocketEnd)
  13053. .removeListener('close', onSocketClose)
  13054. client[kSocket] = null
  13055. client[kQueue][client[kRunningIdx]++] = null
  13056. client.emit('disconnect', client[kUrl], [client], new InformationalError('upgrade'))
  13057. try {
  13058. request.onUpgrade(statusCode, headers, socket)
  13059. } catch (err) {
  13060. util.destroy(socket, err)
  13061. }
  13062. resume(client)
  13063. }
  13064. onHeadersComplete (statusCode, upgrade, shouldKeepAlive) {
  13065. const { client, socket, headers, statusText } = this
  13066. /* istanbul ignore next: difficult to make a test case for */
  13067. if (socket.destroyed) {
  13068. return -1
  13069. }
  13070. const request = client[kQueue][client[kRunningIdx]]
  13071. /* istanbul ignore next: difficult to make a test case for */
  13072. if (!request) {
  13073. return -1
  13074. }
  13075. assert(!this.upgrade)
  13076. assert(this.statusCode < 200)
  13077. if (statusCode === 100) {
  13078. util.destroy(socket, new SocketError('bad response', util.getSocketInfo(socket)))
  13079. return -1
  13080. }
  13081. /* this can only happen if server is misbehaving */
  13082. if (upgrade && !request.upgrade) {
  13083. util.destroy(socket, new SocketError('bad upgrade', util.getSocketInfo(socket)))
  13084. return -1
  13085. }
  13086. assert.strictEqual(this.timeoutType, TIMEOUT_HEADERS)
  13087. this.statusCode = statusCode
  13088. this.shouldKeepAlive = (
  13089. shouldKeepAlive ||
  13090. // Override llhttp value which does not allow keepAlive for HEAD.
  13091. (request.method === 'HEAD' && !socket[kReset] && this.connection.toLowerCase() === 'keep-alive')
  13092. )
  13093. if (this.statusCode >= 200) {
  13094. const bodyTimeout = request.bodyTimeout != null
  13095. ? request.bodyTimeout
  13096. : client[kBodyTimeout]
  13097. this.setTimeout(bodyTimeout, TIMEOUT_BODY)
  13098. } else if (this.timeout) {
  13099. // istanbul ignore else: only for jest
  13100. if (this.timeout.refresh) {
  13101. this.timeout.refresh()
  13102. }
  13103. }
  13104. if (request.method === 'CONNECT') {
  13105. assert(client[kRunning] === 1)
  13106. this.upgrade = true
  13107. return 2
  13108. }
  13109. if (upgrade) {
  13110. assert(client[kRunning] === 1)
  13111. this.upgrade = true
  13112. return 2
  13113. }
  13114. assert(this.headers.length % 2 === 0)
  13115. this.headers = []
  13116. this.headersSize = 0
  13117. if (this.shouldKeepAlive && client[kPipelining]) {
  13118. const keepAliveTimeout = this.keepAlive ? util.parseKeepAliveTimeout(this.keepAlive) : null
  13119. if (keepAliveTimeout != null) {
  13120. const timeout = Math.min(
  13121. keepAliveTimeout - client[kKeepAliveTimeoutThreshold],
  13122. client[kKeepAliveMaxTimeout]
  13123. )
  13124. if (timeout <= 0) {
  13125. socket[kReset] = true
  13126. } else {
  13127. client[kKeepAliveTimeoutValue] = timeout
  13128. }
  13129. } else {
  13130. client[kKeepAliveTimeoutValue] = client[kKeepAliveDefaultTimeout]
  13131. }
  13132. } else {
  13133. // Stop more requests from being dispatched.
  13134. socket[kReset] = true
  13135. }
  13136. const pause = request.onHeaders(statusCode, headers, this.resume, statusText) === false
  13137. if (request.aborted) {
  13138. return -1
  13139. }
  13140. if (request.method === 'HEAD') {
  13141. return 1
  13142. }
  13143. if (statusCode < 200) {
  13144. return 1
  13145. }
  13146. if (socket[kBlocking]) {
  13147. socket[kBlocking] = false
  13148. resume(client)
  13149. }
  13150. return pause ? constants.ERROR.PAUSED : 0
  13151. }
  13152. onBody (buf) {
  13153. const { client, socket, statusCode, maxResponseSize } = this
  13154. if (socket.destroyed) {
  13155. return -1
  13156. }
  13157. const request = client[kQueue][client[kRunningIdx]]
  13158. assert(request)
  13159. assert.strictEqual(this.timeoutType, TIMEOUT_BODY)
  13160. if (this.timeout) {
  13161. // istanbul ignore else: only for jest
  13162. if (this.timeout.refresh) {
  13163. this.timeout.refresh()
  13164. }
  13165. }
  13166. assert(statusCode >= 200)
  13167. if (maxResponseSize > -1 && this.bytesRead + buf.length > maxResponseSize) {
  13168. util.destroy(socket, new ResponseExceededMaxSizeError())
  13169. return -1
  13170. }
  13171. this.bytesRead += buf.length
  13172. if (request.onData(buf) === false) {
  13173. return constants.ERROR.PAUSED
  13174. }
  13175. }
  13176. onMessageComplete () {
  13177. const { client, socket, statusCode, upgrade, headers, contentLength, bytesRead, shouldKeepAlive } = this
  13178. if (socket.destroyed && (!statusCode || shouldKeepAlive)) {
  13179. return -1
  13180. }
  13181. if (upgrade) {
  13182. return
  13183. }
  13184. const request = client[kQueue][client[kRunningIdx]]
  13185. assert(request)
  13186. assert(statusCode >= 100)
  13187. this.statusCode = null
  13188. this.statusText = ''
  13189. this.bytesRead = 0
  13190. this.contentLength = ''
  13191. this.keepAlive = ''
  13192. this.connection = ''
  13193. assert(this.headers.length % 2 === 0)
  13194. this.headers = []
  13195. this.headersSize = 0
  13196. if (statusCode < 200) {
  13197. return
  13198. }
  13199. /* istanbul ignore next: should be handled by llhttp? */
  13200. if (request.method !== 'HEAD' && contentLength && bytesRead !== parseInt(contentLength, 10)) {
  13201. util.destroy(socket, new ResponseContentLengthMismatchError())
  13202. return -1
  13203. }
  13204. request.onComplete(headers)
  13205. client[kQueue][client[kRunningIdx]++] = null
  13206. if (socket[kWriting]) {
  13207. assert.strictEqual(client[kRunning], 0)
  13208. // Response completed before request.
  13209. util.destroy(socket, new InformationalError('reset'))
  13210. return constants.ERROR.PAUSED
  13211. } else if (!shouldKeepAlive) {
  13212. util.destroy(socket, new InformationalError('reset'))
  13213. return constants.ERROR.PAUSED
  13214. } else if (socket[kReset] && client[kRunning] === 0) {
  13215. // Destroy socket once all requests have completed.
  13216. // The request at the tail of the pipeline is the one
  13217. // that requested reset and no further requests should
  13218. // have been queued since then.
  13219. util.destroy(socket, new InformationalError('reset'))
  13220. return constants.ERROR.PAUSED
  13221. } else if (client[kPipelining] === 1) {
  13222. // We must wait a full event loop cycle to reuse this socket to make sure
  13223. // that non-spec compliant servers are not closing the connection even if they
  13224. // said they won't.
  13225. setImmediate(resume, client)
  13226. } else {
  13227. resume(client)
  13228. }
  13229. }
  13230. }
  13231. function onParserTimeout (parser) {
  13232. const { socket, timeoutType, client } = parser
  13233. /* istanbul ignore else */
  13234. if (timeoutType === TIMEOUT_HEADERS) {
  13235. if (!socket[kWriting] || socket.writableNeedDrain || client[kRunning] > 1) {
  13236. assert(!parser.paused, 'cannot be paused while waiting for headers')
  13237. util.destroy(socket, new HeadersTimeoutError())
  13238. }
  13239. } else if (timeoutType === TIMEOUT_BODY) {
  13240. if (!parser.paused) {
  13241. util.destroy(socket, new BodyTimeoutError())
  13242. }
  13243. } else if (timeoutType === TIMEOUT_IDLE) {
  13244. assert(client[kRunning] === 0 && client[kKeepAliveTimeoutValue])
  13245. util.destroy(socket, new InformationalError('socket idle timeout'))
  13246. }
  13247. }
  13248. function onSocketReadable () {
  13249. const { [kParser]: parser } = this
  13250. if (parser) {
  13251. parser.readMore()
  13252. }
  13253. }
  13254. function onSocketError (err) {
  13255. const { [kClient]: client, [kParser]: parser } = this
  13256. assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
  13257. if (client[kHTTPConnVersion] !== 'h2') {
  13258. // On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded
  13259. // to the user.
  13260. if (err.code === 'ECONNRESET' && parser.statusCode && !parser.shouldKeepAlive) {
  13261. // We treat all incoming data so for as a valid response.
  13262. parser.onMessageComplete()
  13263. return
  13264. }
  13265. }
  13266. this[kError] = err
  13267. onError(this[kClient], err)
  13268. }
  13269. function onError (client, err) {
  13270. if (
  13271. client[kRunning] === 0 &&
  13272. err.code !== 'UND_ERR_INFO' &&
  13273. err.code !== 'UND_ERR_SOCKET'
  13274. ) {
  13275. // Error is not caused by running request and not a recoverable
  13276. // socket error.
  13277. assert(client[kPendingIdx] === client[kRunningIdx])
  13278. const requests = client[kQueue].splice(client[kRunningIdx])
  13279. for (let i = 0; i < requests.length; i++) {
  13280. const request = requests[i]
  13281. errorRequest(client, request, err)
  13282. }
  13283. assert(client[kSize] === 0)
  13284. }
  13285. }
  13286. function onSocketEnd () {
  13287. const { [kParser]: parser, [kClient]: client } = this
  13288. if (client[kHTTPConnVersion] !== 'h2') {
  13289. if (parser.statusCode && !parser.shouldKeepAlive) {
  13290. // We treat all incoming data so far as a valid response.
  13291. parser.onMessageComplete()
  13292. return
  13293. }
  13294. }
  13295. util.destroy(this, new SocketError('other side closed', util.getSocketInfo(this)))
  13296. }
  13297. function onSocketClose () {
  13298. const { [kClient]: client, [kParser]: parser } = this
  13299. if (client[kHTTPConnVersion] === 'h1' && parser) {
  13300. if (!this[kError] && parser.statusCode && !parser.shouldKeepAlive) {
  13301. // We treat all incoming data so far as a valid response.
  13302. parser.onMessageComplete()
  13303. }
  13304. this[kParser].destroy()
  13305. this[kParser] = null
  13306. }
  13307. const err = this[kError] || new SocketError('closed', util.getSocketInfo(this))
  13308. client[kSocket] = null
  13309. if (client.destroyed) {
  13310. assert(client[kPending] === 0)
  13311. // Fail entire queue.
  13312. const requests = client[kQueue].splice(client[kRunningIdx])
  13313. for (let i = 0; i < requests.length; i++) {
  13314. const request = requests[i]
  13315. errorRequest(client, request, err)
  13316. }
  13317. } else if (client[kRunning] > 0 && err.code !== 'UND_ERR_INFO') {
  13318. // Fail head of pipeline.
  13319. const request = client[kQueue][client[kRunningIdx]]
  13320. client[kQueue][client[kRunningIdx]++] = null
  13321. errorRequest(client, request, err)
  13322. }
  13323. client[kPendingIdx] = client[kRunningIdx]
  13324. assert(client[kRunning] === 0)
  13325. client.emit('disconnect', client[kUrl], [client], err)
  13326. resume(client)
  13327. }
  13328. async function connect (client) {
  13329. assert(!client[kConnecting])
  13330. assert(!client[kSocket])
  13331. let { host, hostname, protocol, port } = client[kUrl]
  13332. // Resolve ipv6
  13333. if (hostname[0] === '[') {
  13334. const idx = hostname.indexOf(']')
  13335. assert(idx !== -1)
  13336. const ip = hostname.substring(1, idx)
  13337. assert(net.isIP(ip))
  13338. hostname = ip
  13339. }
  13340. client[kConnecting] = true
  13341. if (channels.beforeConnect.hasSubscribers) {
  13342. channels.beforeConnect.publish({
  13343. connectParams: {
  13344. host,
  13345. hostname,
  13346. protocol,
  13347. port,
  13348. servername: client[kServerName],
  13349. localAddress: client[kLocalAddress]
  13350. },
  13351. connector: client[kConnector]
  13352. })
  13353. }
  13354. try {
  13355. const socket = await new Promise((resolve, reject) => {
  13356. client[kConnector]({
  13357. host,
  13358. hostname,
  13359. protocol,
  13360. port,
  13361. servername: client[kServerName],
  13362. localAddress: client[kLocalAddress]
  13363. }, (err, socket) => {
  13364. if (err) {
  13365. reject(err)
  13366. } else {
  13367. resolve(socket)
  13368. }
  13369. })
  13370. })
  13371. if (client.destroyed) {
  13372. util.destroy(socket.on('error', () => {}), new ClientDestroyedError())
  13373. return
  13374. }
  13375. client[kConnecting] = false
  13376. assert(socket)
  13377. const isH2 = socket.alpnProtocol === 'h2'
  13378. if (isH2) {
  13379. if (!h2ExperimentalWarned) {
  13380. h2ExperimentalWarned = true
  13381. process.emitWarning('H2 support is experimental, expect them to change at any time.', {
  13382. code: 'UNDICI-H2'
  13383. })
  13384. }
  13385. const session = http2.connect(client[kUrl], {
  13386. createConnection: () => socket,
  13387. peerMaxConcurrentStreams: client[kHTTP2SessionState].maxConcurrentStreams
  13388. })
  13389. client[kHTTPConnVersion] = 'h2'
  13390. session[kClient] = client
  13391. session[kSocket] = socket
  13392. session.on('error', onHttp2SessionError)
  13393. session.on('frameError', onHttp2FrameError)
  13394. session.on('end', onHttp2SessionEnd)
  13395. session.on('goaway', onHTTP2GoAway)
  13396. session.on('close', onSocketClose)
  13397. session.unref()
  13398. client[kHTTP2Session] = session
  13399. socket[kHTTP2Session] = session
  13400. } else {
  13401. if (!llhttpInstance) {
  13402. llhttpInstance = await llhttpPromise
  13403. llhttpPromise = null
  13404. }
  13405. socket[kNoRef] = false
  13406. socket[kWriting] = false
  13407. socket[kReset] = false
  13408. socket[kBlocking] = false
  13409. socket[kParser] = new Parser(client, socket, llhttpInstance)
  13410. }
  13411. socket[kCounter] = 0
  13412. socket[kMaxRequests] = client[kMaxRequests]
  13413. socket[kClient] = client
  13414. socket[kError] = null
  13415. socket
  13416. .on('error', onSocketError)
  13417. .on('readable', onSocketReadable)
  13418. .on('end', onSocketEnd)
  13419. .on('close', onSocketClose)
  13420. client[kSocket] = socket
  13421. if (channels.connected.hasSubscribers) {
  13422. channels.connected.publish({
  13423. connectParams: {
  13424. host,
  13425. hostname,
  13426. protocol,
  13427. port,
  13428. servername: client[kServerName],
  13429. localAddress: client[kLocalAddress]
  13430. },
  13431. connector: client[kConnector],
  13432. socket
  13433. })
  13434. }
  13435. client.emit('connect', client[kUrl], [client])
  13436. } catch (err) {
  13437. if (client.destroyed) {
  13438. return
  13439. }
  13440. client[kConnecting] = false
  13441. if (channels.connectError.hasSubscribers) {
  13442. channels.connectError.publish({
  13443. connectParams: {
  13444. host,
  13445. hostname,
  13446. protocol,
  13447. port,
  13448. servername: client[kServerName],
  13449. localAddress: client[kLocalAddress]
  13450. },
  13451. connector: client[kConnector],
  13452. error: err
  13453. })
  13454. }
  13455. if (err.code === 'ERR_TLS_CERT_ALTNAME_INVALID') {
  13456. assert(client[kRunning] === 0)
  13457. while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) {
  13458. const request = client[kQueue][client[kPendingIdx]++]
  13459. errorRequest(client, request, err)
  13460. }
  13461. } else {
  13462. onError(client, err)
  13463. }
  13464. client.emit('connectionError', client[kUrl], [client], err)
  13465. }
  13466. resume(client)
  13467. }
  13468. function emitDrain (client) {
  13469. client[kNeedDrain] = 0
  13470. client.emit('drain', client[kUrl], [client])
  13471. }
  13472. function resume (client, sync) {
  13473. if (client[kResuming] === 2) {
  13474. return
  13475. }
  13476. client[kResuming] = 2
  13477. _resume(client, sync)
  13478. client[kResuming] = 0
  13479. if (client[kRunningIdx] > 256) {
  13480. client[kQueue].splice(0, client[kRunningIdx])
  13481. client[kPendingIdx] -= client[kRunningIdx]
  13482. client[kRunningIdx] = 0
  13483. }
  13484. }
  13485. function _resume (client, sync) {
  13486. while (true) {
  13487. if (client.destroyed) {
  13488. assert(client[kPending] === 0)
  13489. return
  13490. }
  13491. if (client[kClosedResolve] && !client[kSize]) {
  13492. client[kClosedResolve]()
  13493. client[kClosedResolve] = null
  13494. return
  13495. }
  13496. const socket = client[kSocket]
  13497. if (socket && !socket.destroyed && socket.alpnProtocol !== 'h2') {
  13498. if (client[kSize] === 0) {
  13499. if (!socket[kNoRef] && socket.unref) {
  13500. socket.unref()
  13501. socket[kNoRef] = true
  13502. }
  13503. } else if (socket[kNoRef] && socket.ref) {
  13504. socket.ref()
  13505. socket[kNoRef] = false
  13506. }
  13507. if (client[kSize] === 0) {
  13508. if (socket[kParser].timeoutType !== TIMEOUT_IDLE) {
  13509. socket[kParser].setTimeout(client[kKeepAliveTimeoutValue], TIMEOUT_IDLE)
  13510. }
  13511. } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) {
  13512. if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) {
  13513. const request = client[kQueue][client[kRunningIdx]]
  13514. const headersTimeout = request.headersTimeout != null
  13515. ? request.headersTimeout
  13516. : client[kHeadersTimeout]
  13517. socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS)
  13518. }
  13519. }
  13520. }
  13521. if (client[kBusy]) {
  13522. client[kNeedDrain] = 2
  13523. } else if (client[kNeedDrain] === 2) {
  13524. if (sync) {
  13525. client[kNeedDrain] = 1
  13526. process.nextTick(emitDrain, client)
  13527. } else {
  13528. emitDrain(client)
  13529. }
  13530. continue
  13531. }
  13532. if (client[kPending] === 0) {
  13533. return
  13534. }
  13535. if (client[kRunning] >= (client[kPipelining] || 1)) {
  13536. return
  13537. }
  13538. const request = client[kQueue][client[kPendingIdx]]
  13539. if (client[kUrl].protocol === 'https:' && client[kServerName] !== request.servername) {
  13540. if (client[kRunning] > 0) {
  13541. return
  13542. }
  13543. client[kServerName] = request.servername
  13544. if (socket && socket.servername !== request.servername) {
  13545. util.destroy(socket, new InformationalError('servername changed'))
  13546. return
  13547. }
  13548. }
  13549. if (client[kConnecting]) {
  13550. return
  13551. }
  13552. if (!socket && !client[kHTTP2Session]) {
  13553. connect(client)
  13554. return
  13555. }
  13556. if (socket.destroyed || socket[kWriting] || socket[kReset] || socket[kBlocking]) {
  13557. return
  13558. }
  13559. if (client[kRunning] > 0 && !request.idempotent) {
  13560. // Non-idempotent request cannot be retried.
  13561. // Ensure that no other requests are inflight and
  13562. // could cause failure.
  13563. return
  13564. }
  13565. if (client[kRunning] > 0 && (request.upgrade || request.method === 'CONNECT')) {
  13566. // Don't dispatch an upgrade until all preceding requests have completed.
  13567. // A misbehaving server might upgrade the connection before all pipelined
  13568. // request has completed.
  13569. return
  13570. }
  13571. if (client[kRunning] > 0 && util.bodyLength(request.body) !== 0 &&
  13572. (util.isStream(request.body) || util.isAsyncIterable(request.body))) {
  13573. // Request with stream or iterator body can error while other requests
  13574. // are inflight and indirectly error those as well.
  13575. // Ensure this doesn't happen by waiting for inflight
  13576. // to complete before dispatching.
  13577. // Request with stream or iterator body cannot be retried.
  13578. // Ensure that no other requests are inflight and
  13579. // could cause failure.
  13580. return
  13581. }
  13582. if (!request.aborted && write(client, request)) {
  13583. client[kPendingIdx]++
  13584. } else {
  13585. client[kQueue].splice(client[kPendingIdx], 1)
  13586. }
  13587. }
  13588. }
  13589. // https://www.rfc-editor.org/rfc/rfc7230#section-3.3.2
  13590. function shouldSendContentLength (method) {
  13591. return method !== 'GET' && method !== 'HEAD' && method !== 'OPTIONS' && method !== 'TRACE' && method !== 'CONNECT'
  13592. }
  13593. function write (client, request) {
  13594. if (client[kHTTPConnVersion] === 'h2') {
  13595. writeH2(client, client[kHTTP2Session], request)
  13596. return
  13597. }
  13598. const { body, method, path, host, upgrade, headers, blocking, reset } = request
  13599. // https://tools.ietf.org/html/rfc7231#section-4.3.1
  13600. // https://tools.ietf.org/html/rfc7231#section-4.3.2
  13601. // https://tools.ietf.org/html/rfc7231#section-4.3.5
  13602. // Sending a payload body on a request that does not
  13603. // expect it can cause undefined behavior on some
  13604. // servers and corrupt connection state. Do not
  13605. // re-use the connection for further requests.
  13606. const expectsPayload = (
  13607. method === 'PUT' ||
  13608. method === 'POST' ||
  13609. method === 'PATCH'
  13610. )
  13611. if (body && typeof body.read === 'function') {
  13612. // Try to read EOF in order to get length.
  13613. body.read(0)
  13614. }
  13615. const bodyLength = util.bodyLength(body)
  13616. let contentLength = bodyLength
  13617. if (contentLength === null) {
  13618. contentLength = request.contentLength
  13619. }
  13620. if (contentLength === 0 && !expectsPayload) {
  13621. // https://tools.ietf.org/html/rfc7230#section-3.3.2
  13622. // A user agent SHOULD NOT send a Content-Length header field when
  13623. // the request message does not contain a payload body and the method
  13624. // semantics do not anticipate such a body.
  13625. contentLength = null
  13626. }
  13627. // https://github.com/nodejs/undici/issues/2046
  13628. // A user agent may send a Content-Length header with 0 value, this should be allowed.
  13629. if (shouldSendContentLength(method) && contentLength > 0 && request.contentLength !== null && request.contentLength !== contentLength) {
  13630. if (client[kStrictContentLength]) {
  13631. errorRequest(client, request, new RequestContentLengthMismatchError())
  13632. return false
  13633. }
  13634. process.emitWarning(new RequestContentLengthMismatchError())
  13635. }
  13636. const socket = client[kSocket]
  13637. try {
  13638. request.onConnect((err) => {
  13639. if (request.aborted || request.completed) {
  13640. return
  13641. }
  13642. errorRequest(client, request, err || new RequestAbortedError())
  13643. util.destroy(socket, new InformationalError('aborted'))
  13644. })
  13645. } catch (err) {
  13646. errorRequest(client, request, err)
  13647. }
  13648. if (request.aborted) {
  13649. return false
  13650. }
  13651. if (method === 'HEAD') {
  13652. // https://github.com/mcollina/undici/issues/258
  13653. // Close after a HEAD request to interop with misbehaving servers
  13654. // that may send a body in the response.
  13655. socket[kReset] = true
  13656. }
  13657. if (upgrade || method === 'CONNECT') {
  13658. // On CONNECT or upgrade, block pipeline from dispatching further
  13659. // requests on this connection.
  13660. socket[kReset] = true
  13661. }
  13662. if (reset != null) {
  13663. socket[kReset] = reset
  13664. }
  13665. if (client[kMaxRequests] && socket[kCounter]++ >= client[kMaxRequests]) {
  13666. socket[kReset] = true
  13667. }
  13668. if (blocking) {
  13669. socket[kBlocking] = true
  13670. }
  13671. let header = `${method} ${path} HTTP/1.1\r\n`
  13672. if (typeof host === 'string') {
  13673. header += `host: ${host}\r\n`
  13674. } else {
  13675. header += client[kHostHeader]
  13676. }
  13677. if (upgrade) {
  13678. header += `connection: upgrade\r\nupgrade: ${upgrade}\r\n`
  13679. } else if (client[kPipelining] && !socket[kReset]) {
  13680. header += 'connection: keep-alive\r\n'
  13681. } else {
  13682. header += 'connection: close\r\n'
  13683. }
  13684. if (headers) {
  13685. header += headers
  13686. }
  13687. if (channels.sendHeaders.hasSubscribers) {
  13688. channels.sendHeaders.publish({ request, headers: header, socket })
  13689. }
  13690. /* istanbul ignore else: assertion */
  13691. if (!body || bodyLength === 0) {
  13692. if (contentLength === 0) {
  13693. socket.write(`${header}content-length: 0\r\n\r\n`, 'latin1')
  13694. } else {
  13695. assert(contentLength === null, 'no body must not have content length')
  13696. socket.write(`${header}\r\n`, 'latin1')
  13697. }
  13698. request.onRequestSent()
  13699. } else if (util.isBuffer(body)) {
  13700. assert(contentLength === body.byteLength, 'buffer body must have content length')
  13701. socket.cork()
  13702. socket.write(`${header}content-length: ${contentLength}\r\n\r\n`, 'latin1')
  13703. socket.write(body)
  13704. socket.uncork()
  13705. request.onBodySent(body)
  13706. request.onRequestSent()
  13707. if (!expectsPayload) {
  13708. socket[kReset] = true
  13709. }
  13710. } else if (util.isBlobLike(body)) {
  13711. if (typeof body.stream === 'function') {
  13712. writeIterable({ body: body.stream(), client, request, socket, contentLength, header, expectsPayload })
  13713. } else {
  13714. writeBlob({ body, client, request, socket, contentLength, header, expectsPayload })
  13715. }
  13716. } else if (util.isStream(body)) {
  13717. writeStream({ body, client, request, socket, contentLength, header, expectsPayload })
  13718. } else if (util.isIterable(body)) {
  13719. writeIterable({ body, client, request, socket, contentLength, header, expectsPayload })
  13720. } else {
  13721. assert(false)
  13722. }
  13723. return true
  13724. }
  13725. function writeH2 (client, session, request) {
  13726. const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request
  13727. let headers
  13728. if (typeof reqHeaders === 'string') headers = Request[kHTTP2CopyHeaders](reqHeaders.trim())
  13729. else headers = reqHeaders
  13730. if (upgrade) {
  13731. errorRequest(client, request, new Error('Upgrade not supported for H2'))
  13732. return false
  13733. }
  13734. try {
  13735. // TODO(HTTP/2): Should we call onConnect immediately or on stream ready event?
  13736. request.onConnect((err) => {
  13737. if (request.aborted || request.completed) {
  13738. return
  13739. }
  13740. errorRequest(client, request, err || new RequestAbortedError())
  13741. })
  13742. } catch (err) {
  13743. errorRequest(client, request, err)
  13744. }
  13745. if (request.aborted) {
  13746. return false
  13747. }
  13748. /** @type {import('node:http2').ClientHttp2Stream} */
  13749. let stream
  13750. const h2State = client[kHTTP2SessionState]
  13751. headers[HTTP2_HEADER_AUTHORITY] = host || client[kHost]
  13752. headers[HTTP2_HEADER_METHOD] = method
  13753. if (method === 'CONNECT') {
  13754. session.ref()
  13755. // we are already connected, streams are pending, first request
  13756. // will create a new stream. We trigger a request to create the stream and wait until
  13757. // `ready` event is triggered
  13758. // We disabled endStream to allow the user to write to the stream
  13759. stream = session.request(headers, { endStream: false, signal })
  13760. if (stream.id && !stream.pending) {
  13761. request.onUpgrade(null, null, stream)
  13762. ++h2State.openStreams
  13763. } else {
  13764. stream.once('ready', () => {
  13765. request.onUpgrade(null, null, stream)
  13766. ++h2State.openStreams
  13767. })
  13768. }
  13769. stream.once('close', () => {
  13770. h2State.openStreams -= 1
  13771. // TODO(HTTP/2): unref only if current streams count is 0
  13772. if (h2State.openStreams === 0) session.unref()
  13773. })
  13774. return true
  13775. }
  13776. // https://tools.ietf.org/html/rfc7540#section-8.3
  13777. // :path and :scheme headers must be omited when sending CONNECT
  13778. headers[HTTP2_HEADER_PATH] = path
  13779. headers[HTTP2_HEADER_SCHEME] = 'https'
  13780. // https://tools.ietf.org/html/rfc7231#section-4.3.1
  13781. // https://tools.ietf.org/html/rfc7231#section-4.3.2
  13782. // https://tools.ietf.org/html/rfc7231#section-4.3.5
  13783. // Sending a payload body on a request that does not
  13784. // expect it can cause undefined behavior on some
  13785. // servers and corrupt connection state. Do not
  13786. // re-use the connection for further requests.
  13787. const expectsPayload = (
  13788. method === 'PUT' ||
  13789. method === 'POST' ||
  13790. method === 'PATCH'
  13791. )
  13792. if (body && typeof body.read === 'function') {
  13793. // Try to read EOF in order to get length.
  13794. body.read(0)
  13795. }
  13796. let contentLength = util.bodyLength(body)
  13797. if (contentLength == null) {
  13798. contentLength = request.contentLength
  13799. }
  13800. if (contentLength === 0 || !expectsPayload) {
  13801. // https://tools.ietf.org/html/rfc7230#section-3.3.2
  13802. // A user agent SHOULD NOT send a Content-Length header field when
  13803. // the request message does not contain a payload body and the method
  13804. // semantics do not anticipate such a body.
  13805. contentLength = null
  13806. }
  13807. // https://github.com/nodejs/undici/issues/2046
  13808. // A user agent may send a Content-Length header with 0 value, this should be allowed.
  13809. if (shouldSendContentLength(method) && contentLength > 0 && request.contentLength != null && request.contentLength !== contentLength) {
  13810. if (client[kStrictContentLength]) {
  13811. errorRequest(client, request, new RequestContentLengthMismatchError())
  13812. return false
  13813. }
  13814. process.emitWarning(new RequestContentLengthMismatchError())
  13815. }
  13816. if (contentLength != null) {
  13817. assert(body, 'no body must not have content length')
  13818. headers[HTTP2_HEADER_CONTENT_LENGTH] = `${contentLength}`
  13819. }
  13820. session.ref()
  13821. const shouldEndStream = method === 'GET' || method === 'HEAD'
  13822. if (expectContinue) {
  13823. headers[HTTP2_HEADER_EXPECT] = '100-continue'
  13824. stream = session.request(headers, { endStream: shouldEndStream, signal })
  13825. stream.once('continue', writeBodyH2)
  13826. } else {
  13827. stream = session.request(headers, {
  13828. endStream: shouldEndStream,
  13829. signal
  13830. })
  13831. writeBodyH2()
  13832. }
  13833. // Increment counter as we have new several streams open
  13834. ++h2State.openStreams
  13835. stream.once('response', headers => {
  13836. const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers
  13837. if (request.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), '') === false) {
  13838. stream.pause()
  13839. }
  13840. })
  13841. stream.once('end', () => {
  13842. request.onComplete([])
  13843. })
  13844. stream.on('data', (chunk) => {
  13845. if (request.onData(chunk) === false) {
  13846. stream.pause()
  13847. }
  13848. })
  13849. stream.once('close', () => {
  13850. h2State.openStreams -= 1
  13851. // TODO(HTTP/2): unref only if current streams count is 0
  13852. if (h2State.openStreams === 0) {
  13853. session.unref()
  13854. }
  13855. })
  13856. stream.once('error', function (err) {
  13857. if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) {
  13858. h2State.streams -= 1
  13859. util.destroy(stream, err)
  13860. }
  13861. })
  13862. stream.once('frameError', (type, code) => {
  13863. const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`)
  13864. errorRequest(client, request, err)
  13865. if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) {
  13866. h2State.streams -= 1
  13867. util.destroy(stream, err)
  13868. }
  13869. })
  13870. // stream.on('aborted', () => {
  13871. // // TODO(HTTP/2): Support aborted
  13872. // })
  13873. // stream.on('timeout', () => {
  13874. // // TODO(HTTP/2): Support timeout
  13875. // })
  13876. // stream.on('push', headers => {
  13877. // // TODO(HTTP/2): Suppor push
  13878. // })
  13879. // stream.on('trailers', headers => {
  13880. // // TODO(HTTP/2): Support trailers
  13881. // })
  13882. return true
  13883. function writeBodyH2 () {
  13884. /* istanbul ignore else: assertion */
  13885. if (!body) {
  13886. request.onRequestSent()
  13887. } else if (util.isBuffer(body)) {
  13888. assert(contentLength === body.byteLength, 'buffer body must have content length')
  13889. stream.cork()
  13890. stream.write(body)
  13891. stream.uncork()
  13892. stream.end()
  13893. request.onBodySent(body)
  13894. request.onRequestSent()
  13895. } else if (util.isBlobLike(body)) {
  13896. if (typeof body.stream === 'function') {
  13897. writeIterable({
  13898. client,
  13899. request,
  13900. contentLength,
  13901. h2stream: stream,
  13902. expectsPayload,
  13903. body: body.stream(),
  13904. socket: client[kSocket],
  13905. header: ''
  13906. })
  13907. } else {
  13908. writeBlob({
  13909. body,
  13910. client,
  13911. request,
  13912. contentLength,
  13913. expectsPayload,
  13914. h2stream: stream,
  13915. header: '',
  13916. socket: client[kSocket]
  13917. })
  13918. }
  13919. } else if (util.isStream(body)) {
  13920. writeStream({
  13921. body,
  13922. client,
  13923. request,
  13924. contentLength,
  13925. expectsPayload,
  13926. socket: client[kSocket],
  13927. h2stream: stream,
  13928. header: ''
  13929. })
  13930. } else if (util.isIterable(body)) {
  13931. writeIterable({
  13932. body,
  13933. client,
  13934. request,
  13935. contentLength,
  13936. expectsPayload,
  13937. header: '',
  13938. h2stream: stream,
  13939. socket: client[kSocket]
  13940. })
  13941. } else {
  13942. assert(false)
  13943. }
  13944. }
  13945. }
  13946. function writeStream ({ h2stream, body, client, request, socket, contentLength, header, expectsPayload }) {
  13947. assert(contentLength !== 0 || client[kRunning] === 0, 'stream body cannot be pipelined')
  13948. if (client[kHTTPConnVersion] === 'h2') {
  13949. // For HTTP/2, is enough to pipe the stream
  13950. const pipe = pipeline(
  13951. body,
  13952. h2stream,
  13953. (err) => {
  13954. if (err) {
  13955. util.destroy(body, err)
  13956. util.destroy(h2stream, err)
  13957. } else {
  13958. request.onRequestSent()
  13959. }
  13960. }
  13961. )
  13962. pipe.on('data', onPipeData)
  13963. pipe.once('end', () => {
  13964. pipe.removeListener('data', onPipeData)
  13965. util.destroy(pipe)
  13966. })
  13967. function onPipeData (chunk) {
  13968. request.onBodySent(chunk)
  13969. }
  13970. return
  13971. }
  13972. let finished = false
  13973. const writer = new AsyncWriter({ socket, request, contentLength, client, expectsPayload, header })
  13974. const onData = function (chunk) {
  13975. if (finished) {
  13976. return
  13977. }
  13978. try {
  13979. if (!writer.write(chunk) && this.pause) {
  13980. this.pause()
  13981. }
  13982. } catch (err) {
  13983. util.destroy(this, err)
  13984. }
  13985. }
  13986. const onDrain = function () {
  13987. if (finished) {
  13988. return
  13989. }
  13990. if (body.resume) {
  13991. body.resume()
  13992. }
  13993. }
  13994. const onAbort = function () {
  13995. if (finished) {
  13996. return
  13997. }
  13998. const err = new RequestAbortedError()
  13999. queueMicrotask(() => onFinished(err))
  14000. }
  14001. const onFinished = function (err) {
  14002. if (finished) {
  14003. return
  14004. }
  14005. finished = true
  14006. assert(socket.destroyed || (socket[kWriting] && client[kRunning] <= 1))
  14007. socket
  14008. .off('drain', onDrain)
  14009. .off('error', onFinished)
  14010. body
  14011. .removeListener('data', onData)
  14012. .removeListener('end', onFinished)
  14013. .removeListener('error', onFinished)
  14014. .removeListener('close', onAbort)
  14015. if (!err) {
  14016. try {
  14017. writer.end()
  14018. } catch (er) {
  14019. err = er
  14020. }
  14021. }
  14022. writer.destroy(err)
  14023. if (err && (err.code !== 'UND_ERR_INFO' || err.message !== 'reset')) {
  14024. util.destroy(body, err)
  14025. } else {
  14026. util.destroy(body)
  14027. }
  14028. }
  14029. body
  14030. .on('data', onData)
  14031. .on('end', onFinished)
  14032. .on('error', onFinished)
  14033. .on('close', onAbort)
  14034. if (body.resume) {
  14035. body.resume()
  14036. }
  14037. socket
  14038. .on('drain', onDrain)
  14039. .on('error', onFinished)
  14040. }
  14041. async function writeBlob ({ h2stream, body, client, request, socket, contentLength, header, expectsPayload }) {
  14042. assert(contentLength === body.size, 'blob body must have content length')
  14043. const isH2 = client[kHTTPConnVersion] === 'h2'
  14044. try {
  14045. if (contentLength != null && contentLength !== body.size) {
  14046. throw new RequestContentLengthMismatchError()
  14047. }
  14048. const buffer = Buffer.from(await body.arrayBuffer())
  14049. if (isH2) {
  14050. h2stream.cork()
  14051. h2stream.write(buffer)
  14052. h2stream.uncork()
  14053. } else {
  14054. socket.cork()
  14055. socket.write(`${header}content-length: ${contentLength}\r\n\r\n`, 'latin1')
  14056. socket.write(buffer)
  14057. socket.uncork()
  14058. }
  14059. request.onBodySent(buffer)
  14060. request.onRequestSent()
  14061. if (!expectsPayload) {
  14062. socket[kReset] = true
  14063. }
  14064. resume(client)
  14065. } catch (err) {
  14066. util.destroy(isH2 ? h2stream : socket, err)
  14067. }
  14068. }
  14069. async function writeIterable ({ h2stream, body, client, request, socket, contentLength, header, expectsPayload }) {
  14070. assert(contentLength !== 0 || client[kRunning] === 0, 'iterator body cannot be pipelined')
  14071. let callback = null
  14072. function onDrain () {
  14073. if (callback) {
  14074. const cb = callback
  14075. callback = null
  14076. cb()
  14077. }
  14078. }
  14079. const waitForDrain = () => new Promise((resolve, reject) => {
  14080. assert(callback === null)
  14081. if (socket[kError]) {
  14082. reject(socket[kError])
  14083. } else {
  14084. callback = resolve
  14085. }
  14086. })
  14087. if (client[kHTTPConnVersion] === 'h2') {
  14088. h2stream
  14089. .on('close', onDrain)
  14090. .on('drain', onDrain)
  14091. try {
  14092. // It's up to the user to somehow abort the async iterable.
  14093. for await (const chunk of body) {
  14094. if (socket[kError]) {
  14095. throw socket[kError]
  14096. }
  14097. const res = h2stream.write(chunk)
  14098. request.onBodySent(chunk)
  14099. if (!res) {
  14100. await waitForDrain()
  14101. }
  14102. }
  14103. } catch (err) {
  14104. h2stream.destroy(err)
  14105. } finally {
  14106. request.onRequestSent()
  14107. h2stream.end()
  14108. h2stream
  14109. .off('close', onDrain)
  14110. .off('drain', onDrain)
  14111. }
  14112. return
  14113. }
  14114. socket
  14115. .on('close', onDrain)
  14116. .on('drain', onDrain)
  14117. const writer = new AsyncWriter({ socket, request, contentLength, client, expectsPayload, header })
  14118. try {
  14119. // It's up to the user to somehow abort the async iterable.
  14120. for await (const chunk of body) {
  14121. if (socket[kError]) {
  14122. throw socket[kError]
  14123. }
  14124. if (!writer.write(chunk)) {
  14125. await waitForDrain()
  14126. }
  14127. }
  14128. writer.end()
  14129. } catch (err) {
  14130. writer.destroy(err)
  14131. } finally {
  14132. socket
  14133. .off('close', onDrain)
  14134. .off('drain', onDrain)
  14135. }
  14136. }
  14137. class AsyncWriter {
  14138. constructor ({ socket, request, contentLength, client, expectsPayload, header }) {
  14139. this.socket = socket
  14140. this.request = request
  14141. this.contentLength = contentLength
  14142. this.client = client
  14143. this.bytesWritten = 0
  14144. this.expectsPayload = expectsPayload
  14145. this.header = header
  14146. socket[kWriting] = true
  14147. }
  14148. write (chunk) {
  14149. const { socket, request, contentLength, client, bytesWritten, expectsPayload, header } = this
  14150. if (socket[kError]) {
  14151. throw socket[kError]
  14152. }
  14153. if (socket.destroyed) {
  14154. return false
  14155. }
  14156. const len = Buffer.byteLength(chunk)
  14157. if (!len) {
  14158. return true
  14159. }
  14160. // We should defer writing chunks.
  14161. if (contentLength !== null && bytesWritten + len > contentLength) {
  14162. if (client[kStrictContentLength]) {
  14163. throw new RequestContentLengthMismatchError()
  14164. }
  14165. process.emitWarning(new RequestContentLengthMismatchError())
  14166. }
  14167. socket.cork()
  14168. if (bytesWritten === 0) {
  14169. if (!expectsPayload) {
  14170. socket[kReset] = true
  14171. }
  14172. if (contentLength === null) {
  14173. socket.write(`${header}transfer-encoding: chunked\r\n`, 'latin1')
  14174. } else {
  14175. socket.write(`${header}content-length: ${contentLength}\r\n\r\n`, 'latin1')
  14176. }
  14177. }
  14178. if (contentLength === null) {
  14179. socket.write(`\r\n${len.toString(16)}\r\n`, 'latin1')
  14180. }
  14181. this.bytesWritten += len
  14182. const ret = socket.write(chunk)
  14183. socket.uncork()
  14184. request.onBodySent(chunk)
  14185. if (!ret) {
  14186. if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) {
  14187. // istanbul ignore else: only for jest
  14188. if (socket[kParser].timeout.refresh) {
  14189. socket[kParser].timeout.refresh()
  14190. }
  14191. }
  14192. }
  14193. return ret
  14194. }
  14195. end () {
  14196. const { socket, contentLength, client, bytesWritten, expectsPayload, header, request } = this
  14197. request.onRequestSent()
  14198. socket[kWriting] = false
  14199. if (socket[kError]) {
  14200. throw socket[kError]
  14201. }
  14202. if (socket.destroyed) {
  14203. return
  14204. }
  14205. if (bytesWritten === 0) {
  14206. if (expectsPayload) {
  14207. // https://tools.ietf.org/html/rfc7230#section-3.3.2
  14208. // A user agent SHOULD send a Content-Length in a request message when
  14209. // no Transfer-Encoding is sent and the request method defines a meaning
  14210. // for an enclosed payload body.
  14211. socket.write(`${header}content-length: 0\r\n\r\n`, 'latin1')
  14212. } else {
  14213. socket.write(`${header}\r\n`, 'latin1')
  14214. }
  14215. } else if (contentLength === null) {
  14216. socket.write('\r\n0\r\n\r\n', 'latin1')
  14217. }
  14218. if (contentLength !== null && bytesWritten !== contentLength) {
  14219. if (client[kStrictContentLength]) {
  14220. throw new RequestContentLengthMismatchError()
  14221. } else {
  14222. process.emitWarning(new RequestContentLengthMismatchError())
  14223. }
  14224. }
  14225. if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) {
  14226. // istanbul ignore else: only for jest
  14227. if (socket[kParser].timeout.refresh) {
  14228. socket[kParser].timeout.refresh()
  14229. }
  14230. }
  14231. resume(client)
  14232. }
  14233. destroy (err) {
  14234. const { socket, client } = this
  14235. socket[kWriting] = false
  14236. if (err) {
  14237. assert(client[kRunning] <= 1, 'pipeline should only contain this request')
  14238. util.destroy(socket, err)
  14239. }
  14240. }
  14241. }
  14242. function errorRequest (client, request, err) {
  14243. try {
  14244. request.onError(err)
  14245. assert(request.aborted)
  14246. } catch (err) {
  14247. client.emit('error', err)
  14248. }
  14249. }
  14250. module.exports = Client
  14251. /***/ }),
  14252. /***/ 6436:
  14253. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  14254. /* istanbul ignore file: only for Node 12 */
  14255. const { kConnected, kSize } = __nccwpck_require__(2785)
  14256. class CompatWeakRef {
  14257. constructor (value) {
  14258. this.value = value
  14259. }
  14260. deref () {
  14261. return this.value[kConnected] === 0 && this.value[kSize] === 0
  14262. ? undefined
  14263. : this.value
  14264. }
  14265. }
  14266. class CompatFinalizer {
  14267. constructor (finalizer) {
  14268. this.finalizer = finalizer
  14269. }
  14270. register (dispatcher, key) {
  14271. if (dispatcher.on) {
  14272. dispatcher.on('disconnect', () => {
  14273. if (dispatcher[kConnected] === 0 && dispatcher[kSize] === 0) {
  14274. this.finalizer(key)
  14275. }
  14276. })
  14277. }
  14278. }
  14279. }
  14280. module.exports = function () {
  14281. // FIXME: remove workaround when the Node bug is fixed
  14282. // https://github.com/nodejs/node/issues/49344#issuecomment-1741776308
  14283. if (process.env.NODE_V8_COVERAGE) {
  14284. return {
  14285. WeakRef: CompatWeakRef,
  14286. FinalizationRegistry: CompatFinalizer
  14287. }
  14288. }
  14289. return {
  14290. WeakRef: global.WeakRef || CompatWeakRef,
  14291. FinalizationRegistry: global.FinalizationRegistry || CompatFinalizer
  14292. }
  14293. }
  14294. /***/ }),
  14295. /***/ 663:
  14296. /***/ ((module) => {
  14297. // https://wicg.github.io/cookie-store/#cookie-maximum-attribute-value-size
  14298. const maxAttributeValueSize = 1024
  14299. // https://wicg.github.io/cookie-store/#cookie-maximum-name-value-pair-size
  14300. const maxNameValuePairSize = 4096
  14301. module.exports = {
  14302. maxAttributeValueSize,
  14303. maxNameValuePairSize
  14304. }
  14305. /***/ }),
  14306. /***/ 1724:
  14307. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  14308. const { parseSetCookie } = __nccwpck_require__(4408)
  14309. const { stringify } = __nccwpck_require__(3121)
  14310. const { webidl } = __nccwpck_require__(1744)
  14311. const { Headers } = __nccwpck_require__(554)
  14312. /**
  14313. * @typedef {Object} Cookie
  14314. * @property {string} name
  14315. * @property {string} value
  14316. * @property {Date|number|undefined} expires
  14317. * @property {number|undefined} maxAge
  14318. * @property {string|undefined} domain
  14319. * @property {string|undefined} path
  14320. * @property {boolean|undefined} secure
  14321. * @property {boolean|undefined} httpOnly
  14322. * @property {'Strict'|'Lax'|'None'} sameSite
  14323. * @property {string[]} unparsed
  14324. */
  14325. /**
  14326. * @param {Headers} headers
  14327. * @returns {Record<string, string>}
  14328. */
  14329. function getCookies (headers) {
  14330. webidl.argumentLengthCheck(arguments, 1, { header: 'getCookies' })
  14331. webidl.brandCheck(headers, Headers, { strict: false })
  14332. const cookie = headers.get('cookie')
  14333. const out = {}
  14334. if (!cookie) {
  14335. return out
  14336. }
  14337. for (const piece of cookie.split(';')) {
  14338. const [name, ...value] = piece.split('=')
  14339. out[name.trim()] = value.join('=')
  14340. }
  14341. return out
  14342. }
  14343. /**
  14344. * @param {Headers} headers
  14345. * @param {string} name
  14346. * @param {{ path?: string, domain?: string }|undefined} attributes
  14347. * @returns {void}
  14348. */
  14349. function deleteCookie (headers, name, attributes) {
  14350. webidl.argumentLengthCheck(arguments, 2, { header: 'deleteCookie' })
  14351. webidl.brandCheck(headers, Headers, { strict: false })
  14352. name = webidl.converters.DOMString(name)
  14353. attributes = webidl.converters.DeleteCookieAttributes(attributes)
  14354. // Matches behavior of
  14355. // https://github.com/denoland/deno_std/blob/63827b16330b82489a04614027c33b7904e08be5/http/cookie.ts#L278
  14356. setCookie(headers, {
  14357. name,
  14358. value: '',
  14359. expires: new Date(0),
  14360. ...attributes
  14361. })
  14362. }
  14363. /**
  14364. * @param {Headers} headers
  14365. * @returns {Cookie[]}
  14366. */
  14367. function getSetCookies (headers) {
  14368. webidl.argumentLengthCheck(arguments, 1, { header: 'getSetCookies' })
  14369. webidl.brandCheck(headers, Headers, { strict: false })
  14370. const cookies = headers.getSetCookie()
  14371. if (!cookies) {
  14372. return []
  14373. }
  14374. return cookies.map((pair) => parseSetCookie(pair))
  14375. }
  14376. /**
  14377. * @param {Headers} headers
  14378. * @param {Cookie} cookie
  14379. * @returns {void}
  14380. */
  14381. function setCookie (headers, cookie) {
  14382. webidl.argumentLengthCheck(arguments, 2, { header: 'setCookie' })
  14383. webidl.brandCheck(headers, Headers, { strict: false })
  14384. cookie = webidl.converters.Cookie(cookie)
  14385. const str = stringify(cookie)
  14386. if (str) {
  14387. headers.append('Set-Cookie', stringify(cookie))
  14388. }
  14389. }
  14390. webidl.converters.DeleteCookieAttributes = webidl.dictionaryConverter([
  14391. {
  14392. converter: webidl.nullableConverter(webidl.converters.DOMString),
  14393. key: 'path',
  14394. defaultValue: null
  14395. },
  14396. {
  14397. converter: webidl.nullableConverter(webidl.converters.DOMString),
  14398. key: 'domain',
  14399. defaultValue: null
  14400. }
  14401. ])
  14402. webidl.converters.Cookie = webidl.dictionaryConverter([
  14403. {
  14404. converter: webidl.converters.DOMString,
  14405. key: 'name'
  14406. },
  14407. {
  14408. converter: webidl.converters.DOMString,
  14409. key: 'value'
  14410. },
  14411. {
  14412. converter: webidl.nullableConverter((value) => {
  14413. if (typeof value === 'number') {
  14414. return webidl.converters['unsigned long long'](value)
  14415. }
  14416. return new Date(value)
  14417. }),
  14418. key: 'expires',
  14419. defaultValue: null
  14420. },
  14421. {
  14422. converter: webidl.nullableConverter(webidl.converters['long long']),
  14423. key: 'maxAge',
  14424. defaultValue: null
  14425. },
  14426. {
  14427. converter: webidl.nullableConverter(webidl.converters.DOMString),
  14428. key: 'domain',
  14429. defaultValue: null
  14430. },
  14431. {
  14432. converter: webidl.nullableConverter(webidl.converters.DOMString),
  14433. key: 'path',
  14434. defaultValue: null
  14435. },
  14436. {
  14437. converter: webidl.nullableConverter(webidl.converters.boolean),
  14438. key: 'secure',
  14439. defaultValue: null
  14440. },
  14441. {
  14442. converter: webidl.nullableConverter(webidl.converters.boolean),
  14443. key: 'httpOnly',
  14444. defaultValue: null
  14445. },
  14446. {
  14447. converter: webidl.converters.USVString,
  14448. key: 'sameSite',
  14449. allowedValues: ['Strict', 'Lax', 'None']
  14450. },
  14451. {
  14452. converter: webidl.sequenceConverter(webidl.converters.DOMString),
  14453. key: 'unparsed',
  14454. defaultValue: []
  14455. }
  14456. ])
  14457. module.exports = {
  14458. getCookies,
  14459. deleteCookie,
  14460. getSetCookies,
  14461. setCookie
  14462. }
  14463. /***/ }),
  14464. /***/ 4408:
  14465. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  14466. const { maxNameValuePairSize, maxAttributeValueSize } = __nccwpck_require__(663)
  14467. const { isCTLExcludingHtab } = __nccwpck_require__(3121)
  14468. const { collectASequenceOfCodePointsFast } = __nccwpck_require__(685)
  14469. const assert = __nccwpck_require__(9491)
  14470. /**
  14471. * @description Parses the field-value attributes of a set-cookie header string.
  14472. * @see https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4
  14473. * @param {string} header
  14474. * @returns if the header is invalid, null will be returned
  14475. */
  14476. function parseSetCookie (header) {
  14477. // 1. If the set-cookie-string contains a %x00-08 / %x0A-1F / %x7F
  14478. // character (CTL characters excluding HTAB): Abort these steps and
  14479. // ignore the set-cookie-string entirely.
  14480. if (isCTLExcludingHtab(header)) {
  14481. return null
  14482. }
  14483. let nameValuePair = ''
  14484. let unparsedAttributes = ''
  14485. let name = ''
  14486. let value = ''
  14487. // 2. If the set-cookie-string contains a %x3B (";") character:
  14488. if (header.includes(';')) {
  14489. // 1. The name-value-pair string consists of the characters up to,
  14490. // but not including, the first %x3B (";"), and the unparsed-
  14491. // attributes consist of the remainder of the set-cookie-string
  14492. // (including the %x3B (";") in question).
  14493. const position = { position: 0 }
  14494. nameValuePair = collectASequenceOfCodePointsFast(';', header, position)
  14495. unparsedAttributes = header.slice(position.position)
  14496. } else {
  14497. // Otherwise:
  14498. // 1. The name-value-pair string consists of all the characters
  14499. // contained in the set-cookie-string, and the unparsed-
  14500. // attributes is the empty string.
  14501. nameValuePair = header
  14502. }
  14503. // 3. If the name-value-pair string lacks a %x3D ("=") character, then
  14504. // the name string is empty, and the value string is the value of
  14505. // name-value-pair.
  14506. if (!nameValuePair.includes('=')) {
  14507. value = nameValuePair
  14508. } else {
  14509. // Otherwise, the name string consists of the characters up to, but
  14510. // not including, the first %x3D ("=") character, and the (possibly
  14511. // empty) value string consists of the characters after the first
  14512. // %x3D ("=") character.
  14513. const position = { position: 0 }
  14514. name = collectASequenceOfCodePointsFast(
  14515. '=',
  14516. nameValuePair,
  14517. position
  14518. )
  14519. value = nameValuePair.slice(position.position + 1)
  14520. }
  14521. // 4. Remove any leading or trailing WSP characters from the name
  14522. // string and the value string.
  14523. name = name.trim()
  14524. value = value.trim()
  14525. // 5. If the sum of the lengths of the name string and the value string
  14526. // is more than 4096 octets, abort these steps and ignore the set-
  14527. // cookie-string entirely.
  14528. if (name.length + value.length > maxNameValuePairSize) {
  14529. return null
  14530. }
  14531. // 6. The cookie-name is the name string, and the cookie-value is the
  14532. // value string.
  14533. return {
  14534. name, value, ...parseUnparsedAttributes(unparsedAttributes)
  14535. }
  14536. }
  14537. /**
  14538. * Parses the remaining attributes of a set-cookie header
  14539. * @see https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4
  14540. * @param {string} unparsedAttributes
  14541. * @param {[Object.<string, unknown>]={}} cookieAttributeList
  14542. */
  14543. function parseUnparsedAttributes (unparsedAttributes, cookieAttributeList = {}) {
  14544. // 1. If the unparsed-attributes string is empty, skip the rest of
  14545. // these steps.
  14546. if (unparsedAttributes.length === 0) {
  14547. return cookieAttributeList
  14548. }
  14549. // 2. Discard the first character of the unparsed-attributes (which
  14550. // will be a %x3B (";") character).
  14551. assert(unparsedAttributes[0] === ';')
  14552. unparsedAttributes = unparsedAttributes.slice(1)
  14553. let cookieAv = ''
  14554. // 3. If the remaining unparsed-attributes contains a %x3B (";")
  14555. // character:
  14556. if (unparsedAttributes.includes(';')) {
  14557. // 1. Consume the characters of the unparsed-attributes up to, but
  14558. // not including, the first %x3B (";") character.
  14559. cookieAv = collectASequenceOfCodePointsFast(
  14560. ';',
  14561. unparsedAttributes,
  14562. { position: 0 }
  14563. )
  14564. unparsedAttributes = unparsedAttributes.slice(cookieAv.length)
  14565. } else {
  14566. // Otherwise:
  14567. // 1. Consume the remainder of the unparsed-attributes.
  14568. cookieAv = unparsedAttributes
  14569. unparsedAttributes = ''
  14570. }
  14571. // Let the cookie-av string be the characters consumed in this step.
  14572. let attributeName = ''
  14573. let attributeValue = ''
  14574. // 4. If the cookie-av string contains a %x3D ("=") character:
  14575. if (cookieAv.includes('=')) {
  14576. // 1. The (possibly empty) attribute-name string consists of the
  14577. // characters up to, but not including, the first %x3D ("=")
  14578. // character, and the (possibly empty) attribute-value string
  14579. // consists of the characters after the first %x3D ("=")
  14580. // character.
  14581. const position = { position: 0 }
  14582. attributeName = collectASequenceOfCodePointsFast(
  14583. '=',
  14584. cookieAv,
  14585. position
  14586. )
  14587. attributeValue = cookieAv.slice(position.position + 1)
  14588. } else {
  14589. // Otherwise:
  14590. // 1. The attribute-name string consists of the entire cookie-av
  14591. // string, and the attribute-value string is empty.
  14592. attributeName = cookieAv
  14593. }
  14594. // 5. Remove any leading or trailing WSP characters from the attribute-
  14595. // name string and the attribute-value string.
  14596. attributeName = attributeName.trim()
  14597. attributeValue = attributeValue.trim()
  14598. // 6. If the attribute-value is longer than 1024 octets, ignore the
  14599. // cookie-av string and return to Step 1 of this algorithm.
  14600. if (attributeValue.length > maxAttributeValueSize) {
  14601. return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList)
  14602. }
  14603. // 7. Process the attribute-name and attribute-value according to the
  14604. // requirements in the following subsections. (Notice that
  14605. // attributes with unrecognized attribute-names are ignored.)
  14606. const attributeNameLowercase = attributeName.toLowerCase()
  14607. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.1
  14608. // If the attribute-name case-insensitively matches the string
  14609. // "Expires", the user agent MUST process the cookie-av as follows.
  14610. if (attributeNameLowercase === 'expires') {
  14611. // 1. Let the expiry-time be the result of parsing the attribute-value
  14612. // as cookie-date (see Section 5.1.1).
  14613. const expiryTime = new Date(attributeValue)
  14614. // 2. If the attribute-value failed to parse as a cookie date, ignore
  14615. // the cookie-av.
  14616. cookieAttributeList.expires = expiryTime
  14617. } else if (attributeNameLowercase === 'max-age') {
  14618. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.2
  14619. // If the attribute-name case-insensitively matches the string "Max-
  14620. // Age", the user agent MUST process the cookie-av as follows.
  14621. // 1. If the first character of the attribute-value is not a DIGIT or a
  14622. // "-" character, ignore the cookie-av.
  14623. const charCode = attributeValue.charCodeAt(0)
  14624. if ((charCode < 48 || charCode > 57) && attributeValue[0] !== '-') {
  14625. return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList)
  14626. }
  14627. // 2. If the remainder of attribute-value contains a non-DIGIT
  14628. // character, ignore the cookie-av.
  14629. if (!/^\d+$/.test(attributeValue)) {
  14630. return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList)
  14631. }
  14632. // 3. Let delta-seconds be the attribute-value converted to an integer.
  14633. const deltaSeconds = Number(attributeValue)
  14634. // 4. Let cookie-age-limit be the maximum age of the cookie (which
  14635. // SHOULD be 400 days or less, see Section 4.1.2.2).
  14636. // 5. Set delta-seconds to the smaller of its present value and cookie-
  14637. // age-limit.
  14638. // deltaSeconds = Math.min(deltaSeconds * 1000, maxExpiresMs)
  14639. // 6. If delta-seconds is less than or equal to zero (0), let expiry-
  14640. // time be the earliest representable date and time. Otherwise, let
  14641. // the expiry-time be the current date and time plus delta-seconds
  14642. // seconds.
  14643. // const expiryTime = deltaSeconds <= 0 ? Date.now() : Date.now() + deltaSeconds
  14644. // 7. Append an attribute to the cookie-attribute-list with an
  14645. // attribute-name of Max-Age and an attribute-value of expiry-time.
  14646. cookieAttributeList.maxAge = deltaSeconds
  14647. } else if (attributeNameLowercase === 'domain') {
  14648. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.3
  14649. // If the attribute-name case-insensitively matches the string "Domain",
  14650. // the user agent MUST process the cookie-av as follows.
  14651. // 1. Let cookie-domain be the attribute-value.
  14652. let cookieDomain = attributeValue
  14653. // 2. If cookie-domain starts with %x2E ("."), let cookie-domain be
  14654. // cookie-domain without its leading %x2E (".").
  14655. if (cookieDomain[0] === '.') {
  14656. cookieDomain = cookieDomain.slice(1)
  14657. }
  14658. // 3. Convert the cookie-domain to lower case.
  14659. cookieDomain = cookieDomain.toLowerCase()
  14660. // 4. Append an attribute to the cookie-attribute-list with an
  14661. // attribute-name of Domain and an attribute-value of cookie-domain.
  14662. cookieAttributeList.domain = cookieDomain
  14663. } else if (attributeNameLowercase === 'path') {
  14664. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.4
  14665. // If the attribute-name case-insensitively matches the string "Path",
  14666. // the user agent MUST process the cookie-av as follows.
  14667. // 1. If the attribute-value is empty or if the first character of the
  14668. // attribute-value is not %x2F ("/"):
  14669. let cookiePath = ''
  14670. if (attributeValue.length === 0 || attributeValue[0] !== '/') {
  14671. // 1. Let cookie-path be the default-path.
  14672. cookiePath = '/'
  14673. } else {
  14674. // Otherwise:
  14675. // 1. Let cookie-path be the attribute-value.
  14676. cookiePath = attributeValue
  14677. }
  14678. // 2. Append an attribute to the cookie-attribute-list with an
  14679. // attribute-name of Path and an attribute-value of cookie-path.
  14680. cookieAttributeList.path = cookiePath
  14681. } else if (attributeNameLowercase === 'secure') {
  14682. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.5
  14683. // If the attribute-name case-insensitively matches the string "Secure",
  14684. // the user agent MUST append an attribute to the cookie-attribute-list
  14685. // with an attribute-name of Secure and an empty attribute-value.
  14686. cookieAttributeList.secure = true
  14687. } else if (attributeNameLowercase === 'httponly') {
  14688. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.6
  14689. // If the attribute-name case-insensitively matches the string
  14690. // "HttpOnly", the user agent MUST append an attribute to the cookie-
  14691. // attribute-list with an attribute-name of HttpOnly and an empty
  14692. // attribute-value.
  14693. cookieAttributeList.httpOnly = true
  14694. } else if (attributeNameLowercase === 'samesite') {
  14695. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.7
  14696. // If the attribute-name case-insensitively matches the string
  14697. // "SameSite", the user agent MUST process the cookie-av as follows:
  14698. // 1. Let enforcement be "Default".
  14699. let enforcement = 'Default'
  14700. const attributeValueLowercase = attributeValue.toLowerCase()
  14701. // 2. If cookie-av's attribute-value is a case-insensitive match for
  14702. // "None", set enforcement to "None".
  14703. if (attributeValueLowercase.includes('none')) {
  14704. enforcement = 'None'
  14705. }
  14706. // 3. If cookie-av's attribute-value is a case-insensitive match for
  14707. // "Strict", set enforcement to "Strict".
  14708. if (attributeValueLowercase.includes('strict')) {
  14709. enforcement = 'Strict'
  14710. }
  14711. // 4. If cookie-av's attribute-value is a case-insensitive match for
  14712. // "Lax", set enforcement to "Lax".
  14713. if (attributeValueLowercase.includes('lax')) {
  14714. enforcement = 'Lax'
  14715. }
  14716. // 5. Append an attribute to the cookie-attribute-list with an
  14717. // attribute-name of "SameSite" and an attribute-value of
  14718. // enforcement.
  14719. cookieAttributeList.sameSite = enforcement
  14720. } else {
  14721. cookieAttributeList.unparsed ??= []
  14722. cookieAttributeList.unparsed.push(`${attributeName}=${attributeValue}`)
  14723. }
  14724. // 8. Return to Step 1 of this algorithm.
  14725. return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList)
  14726. }
  14727. module.exports = {
  14728. parseSetCookie,
  14729. parseUnparsedAttributes
  14730. }
  14731. /***/ }),
  14732. /***/ 3121:
  14733. /***/ ((module) => {
  14734. /**
  14735. * @param {string} value
  14736. * @returns {boolean}
  14737. */
  14738. function isCTLExcludingHtab (value) {
  14739. if (value.length === 0) {
  14740. return false
  14741. }
  14742. for (const char of value) {
  14743. const code = char.charCodeAt(0)
  14744. if (
  14745. (code >= 0x00 || code <= 0x08) ||
  14746. (code >= 0x0A || code <= 0x1F) ||
  14747. code === 0x7F
  14748. ) {
  14749. return false
  14750. }
  14751. }
  14752. }
  14753. /**
  14754. CHAR = <any US-ASCII character (octets 0 - 127)>
  14755. token = 1*<any CHAR except CTLs or separators>
  14756. separators = "(" | ")" | "<" | ">" | "@"
  14757. | "," | ";" | ":" | "\" | <">
  14758. | "/" | "[" | "]" | "?" | "="
  14759. | "{" | "}" | SP | HT
  14760. * @param {string} name
  14761. */
  14762. function validateCookieName (name) {
  14763. for (const char of name) {
  14764. const code = char.charCodeAt(0)
  14765. if (
  14766. (code <= 0x20 || code > 0x7F) ||
  14767. char === '(' ||
  14768. char === ')' ||
  14769. char === '>' ||
  14770. char === '<' ||
  14771. char === '@' ||
  14772. char === ',' ||
  14773. char === ';' ||
  14774. char === ':' ||
  14775. char === '\\' ||
  14776. char === '"' ||
  14777. char === '/' ||
  14778. char === '[' ||
  14779. char === ']' ||
  14780. char === '?' ||
  14781. char === '=' ||
  14782. char === '{' ||
  14783. char === '}'
  14784. ) {
  14785. throw new Error('Invalid cookie name')
  14786. }
  14787. }
  14788. }
  14789. /**
  14790. cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
  14791. cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
  14792. ; US-ASCII characters excluding CTLs,
  14793. ; whitespace DQUOTE, comma, semicolon,
  14794. ; and backslash
  14795. * @param {string} value
  14796. */
  14797. function validateCookieValue (value) {
  14798. for (const char of value) {
  14799. const code = char.charCodeAt(0)
  14800. if (
  14801. code < 0x21 || // exclude CTLs (0-31)
  14802. code === 0x22 ||
  14803. code === 0x2C ||
  14804. code === 0x3B ||
  14805. code === 0x5C ||
  14806. code > 0x7E // non-ascii
  14807. ) {
  14808. throw new Error('Invalid header value')
  14809. }
  14810. }
  14811. }
  14812. /**
  14813. * path-value = <any CHAR except CTLs or ";">
  14814. * @param {string} path
  14815. */
  14816. function validateCookiePath (path) {
  14817. for (const char of path) {
  14818. const code = char.charCodeAt(0)
  14819. if (code < 0x21 || char === ';') {
  14820. throw new Error('Invalid cookie path')
  14821. }
  14822. }
  14823. }
  14824. /**
  14825. * I have no idea why these values aren't allowed to be honest,
  14826. * but Deno tests these. - Khafra
  14827. * @param {string} domain
  14828. */
  14829. function validateCookieDomain (domain) {
  14830. if (
  14831. domain.startsWith('-') ||
  14832. domain.endsWith('.') ||
  14833. domain.endsWith('-')
  14834. ) {
  14835. throw new Error('Invalid cookie domain')
  14836. }
  14837. }
  14838. /**
  14839. * @see https://www.rfc-editor.org/rfc/rfc7231#section-7.1.1.1
  14840. * @param {number|Date} date
  14841. IMF-fixdate = day-name "," SP date1 SP time-of-day SP GMT
  14842. ; fixed length/zone/capitalization subset of the format
  14843. ; see Section 3.3 of [RFC5322]
  14844. day-name = %x4D.6F.6E ; "Mon", case-sensitive
  14845. / %x54.75.65 ; "Tue", case-sensitive
  14846. / %x57.65.64 ; "Wed", case-sensitive
  14847. / %x54.68.75 ; "Thu", case-sensitive
  14848. / %x46.72.69 ; "Fri", case-sensitive
  14849. / %x53.61.74 ; "Sat", case-sensitive
  14850. / %x53.75.6E ; "Sun", case-sensitive
  14851. date1 = day SP month SP year
  14852. ; e.g., 02 Jun 1982
  14853. day = 2DIGIT
  14854. month = %x4A.61.6E ; "Jan", case-sensitive
  14855. / %x46.65.62 ; "Feb", case-sensitive
  14856. / %x4D.61.72 ; "Mar", case-sensitive
  14857. / %x41.70.72 ; "Apr", case-sensitive
  14858. / %x4D.61.79 ; "May", case-sensitive
  14859. / %x4A.75.6E ; "Jun", case-sensitive
  14860. / %x4A.75.6C ; "Jul", case-sensitive
  14861. / %x41.75.67 ; "Aug", case-sensitive
  14862. / %x53.65.70 ; "Sep", case-sensitive
  14863. / %x4F.63.74 ; "Oct", case-sensitive
  14864. / %x4E.6F.76 ; "Nov", case-sensitive
  14865. / %x44.65.63 ; "Dec", case-sensitive
  14866. year = 4DIGIT
  14867. GMT = %x47.4D.54 ; "GMT", case-sensitive
  14868. time-of-day = hour ":" minute ":" second
  14869. ; 00:00:00 - 23:59:60 (leap second)
  14870. hour = 2DIGIT
  14871. minute = 2DIGIT
  14872. second = 2DIGIT
  14873. */
  14874. function toIMFDate (date) {
  14875. if (typeof date === 'number') {
  14876. date = new Date(date)
  14877. }
  14878. const days = [
  14879. 'Sun', 'Mon', 'Tue', 'Wed',
  14880. 'Thu', 'Fri', 'Sat'
  14881. ]
  14882. const months = [
  14883. 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
  14884. 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
  14885. ]
  14886. const dayName = days[date.getUTCDay()]
  14887. const day = date.getUTCDate().toString().padStart(2, '0')
  14888. const month = months[date.getUTCMonth()]
  14889. const year = date.getUTCFullYear()
  14890. const hour = date.getUTCHours().toString().padStart(2, '0')
  14891. const minute = date.getUTCMinutes().toString().padStart(2, '0')
  14892. const second = date.getUTCSeconds().toString().padStart(2, '0')
  14893. return `${dayName}, ${day} ${month} ${year} ${hour}:${minute}:${second} GMT`
  14894. }
  14895. /**
  14896. max-age-av = "Max-Age=" non-zero-digit *DIGIT
  14897. ; In practice, both expires-av and max-age-av
  14898. ; are limited to dates representable by the
  14899. ; user agent.
  14900. * @param {number} maxAge
  14901. */
  14902. function validateCookieMaxAge (maxAge) {
  14903. if (maxAge < 0) {
  14904. throw new Error('Invalid cookie max-age')
  14905. }
  14906. }
  14907. /**
  14908. * @see https://www.rfc-editor.org/rfc/rfc6265#section-4.1.1
  14909. * @param {import('./index').Cookie} cookie
  14910. */
  14911. function stringify (cookie) {
  14912. if (cookie.name.length === 0) {
  14913. return null
  14914. }
  14915. validateCookieName(cookie.name)
  14916. validateCookieValue(cookie.value)
  14917. const out = [`${cookie.name}=${cookie.value}`]
  14918. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-cookie-prefixes-00#section-3.1
  14919. // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-cookie-prefixes-00#section-3.2
  14920. if (cookie.name.startsWith('__Secure-')) {
  14921. cookie.secure = true
  14922. }
  14923. if (cookie.name.startsWith('__Host-')) {
  14924. cookie.secure = true
  14925. cookie.domain = null
  14926. cookie.path = '/'
  14927. }
  14928. if (cookie.secure) {
  14929. out.push('Secure')
  14930. }
  14931. if (cookie.httpOnly) {
  14932. out.push('HttpOnly')
  14933. }
  14934. if (typeof cookie.maxAge === 'number') {
  14935. validateCookieMaxAge(cookie.maxAge)
  14936. out.push(`Max-Age=${cookie.maxAge}`)
  14937. }
  14938. if (cookie.domain) {
  14939. validateCookieDomain(cookie.domain)
  14940. out.push(`Domain=${cookie.domain}`)
  14941. }
  14942. if (cookie.path) {
  14943. validateCookiePath(cookie.path)
  14944. out.push(`Path=${cookie.path}`)
  14945. }
  14946. if (cookie.expires && cookie.expires.toString() !== 'Invalid Date') {
  14947. out.push(`Expires=${toIMFDate(cookie.expires)}`)
  14948. }
  14949. if (cookie.sameSite) {
  14950. out.push(`SameSite=${cookie.sameSite}`)
  14951. }
  14952. for (const part of cookie.unparsed) {
  14953. if (!part.includes('=')) {
  14954. throw new Error('Invalid unparsed')
  14955. }
  14956. const [key, ...value] = part.split('=')
  14957. out.push(`${key.trim()}=${value.join('=')}`)
  14958. }
  14959. return out.join('; ')
  14960. }
  14961. module.exports = {
  14962. isCTLExcludingHtab,
  14963. validateCookieName,
  14964. validateCookiePath,
  14965. validateCookieValue,
  14966. toIMFDate,
  14967. stringify
  14968. }
  14969. /***/ }),
  14970. /***/ 2067:
  14971. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  14972. const net = __nccwpck_require__(1808)
  14973. const assert = __nccwpck_require__(9491)
  14974. const util = __nccwpck_require__(3983)
  14975. const { InvalidArgumentError, ConnectTimeoutError } = __nccwpck_require__(8045)
  14976. let tls // include tls conditionally since it is not always available
  14977. // TODO: session re-use does not wait for the first
  14978. // connection to resolve the session and might therefore
  14979. // resolve the same servername multiple times even when
  14980. // re-use is enabled.
  14981. let SessionCache
  14982. // FIXME: remove workaround when the Node bug is fixed
  14983. // https://github.com/nodejs/node/issues/49344#issuecomment-1741776308
  14984. if (global.FinalizationRegistry && !process.env.NODE_V8_COVERAGE) {
  14985. SessionCache = class WeakSessionCache {
  14986. constructor (maxCachedSessions) {
  14987. this._maxCachedSessions = maxCachedSessions
  14988. this._sessionCache = new Map()
  14989. this._sessionRegistry = new global.FinalizationRegistry((key) => {
  14990. if (this._sessionCache.size < this._maxCachedSessions) {
  14991. return
  14992. }
  14993. const ref = this._sessionCache.get(key)
  14994. if (ref !== undefined && ref.deref() === undefined) {
  14995. this._sessionCache.delete(key)
  14996. }
  14997. })
  14998. }
  14999. get (sessionKey) {
  15000. const ref = this._sessionCache.get(sessionKey)
  15001. return ref ? ref.deref() : null
  15002. }
  15003. set (sessionKey, session) {
  15004. if (this._maxCachedSessions === 0) {
  15005. return
  15006. }
  15007. this._sessionCache.set(sessionKey, new WeakRef(session))
  15008. this._sessionRegistry.register(session, sessionKey)
  15009. }
  15010. }
  15011. } else {
  15012. SessionCache = class SimpleSessionCache {
  15013. constructor (maxCachedSessions) {
  15014. this._maxCachedSessions = maxCachedSessions
  15015. this._sessionCache = new Map()
  15016. }
  15017. get (sessionKey) {
  15018. return this._sessionCache.get(sessionKey)
  15019. }
  15020. set (sessionKey, session) {
  15021. if (this._maxCachedSessions === 0) {
  15022. return
  15023. }
  15024. if (this._sessionCache.size >= this._maxCachedSessions) {
  15025. // remove the oldest session
  15026. const { value: oldestKey } = this._sessionCache.keys().next()
  15027. this._sessionCache.delete(oldestKey)
  15028. }
  15029. this._sessionCache.set(sessionKey, session)
  15030. }
  15031. }
  15032. }
  15033. function buildConnector ({ allowH2, maxCachedSessions, socketPath, timeout, ...opts }) {
  15034. if (maxCachedSessions != null && (!Number.isInteger(maxCachedSessions) || maxCachedSessions < 0)) {
  15035. throw new InvalidArgumentError('maxCachedSessions must be a positive integer or zero')
  15036. }
  15037. const options = { path: socketPath, ...opts }
  15038. const sessionCache = new SessionCache(maxCachedSessions == null ? 100 : maxCachedSessions)
  15039. timeout = timeout == null ? 10e3 : timeout
  15040. allowH2 = allowH2 != null ? allowH2 : false
  15041. return function connect ({ hostname, host, protocol, port, servername, localAddress, httpSocket }, callback) {
  15042. let socket
  15043. if (protocol === 'https:') {
  15044. if (!tls) {
  15045. tls = __nccwpck_require__(4404)
  15046. }
  15047. servername = servername || options.servername || util.getServerName(host) || null
  15048. const sessionKey = servername || hostname
  15049. const session = sessionCache.get(sessionKey) || null
  15050. assert(sessionKey)
  15051. socket = tls.connect({
  15052. highWaterMark: 16384, // TLS in node can't have bigger HWM anyway...
  15053. ...options,
  15054. servername,
  15055. session,
  15056. localAddress,
  15057. // TODO(HTTP/2): Add support for h2c
  15058. ALPNProtocols: allowH2 ? ['http/1.1', 'h2'] : ['http/1.1'],
  15059. socket: httpSocket, // upgrade socket connection
  15060. port: port || 443,
  15061. host: hostname
  15062. })
  15063. socket
  15064. .on('session', function (session) {
  15065. // TODO (fix): Can a session become invalid once established? Don't think so?
  15066. sessionCache.set(sessionKey, session)
  15067. })
  15068. } else {
  15069. assert(!httpSocket, 'httpSocket can only be sent on TLS update')
  15070. socket = net.connect({
  15071. highWaterMark: 64 * 1024, // Same as nodejs fs streams.
  15072. ...options,
  15073. localAddress,
  15074. port: port || 80,
  15075. host: hostname
  15076. })
  15077. }
  15078. // Set TCP keep alive options on the socket here instead of in connect() for the case of assigning the socket
  15079. if (options.keepAlive == null || options.keepAlive) {
  15080. const keepAliveInitialDelay = options.keepAliveInitialDelay === undefined ? 60e3 : options.keepAliveInitialDelay
  15081. socket.setKeepAlive(true, keepAliveInitialDelay)
  15082. }
  15083. const cancelTimeout = setupTimeout(() => onConnectTimeout(socket), timeout)
  15084. socket
  15085. .setNoDelay(true)
  15086. .once(protocol === 'https:' ? 'secureConnect' : 'connect', function () {
  15087. cancelTimeout()
  15088. if (callback) {
  15089. const cb = callback
  15090. callback = null
  15091. cb(null, this)
  15092. }
  15093. })
  15094. .on('error', function (err) {
  15095. cancelTimeout()
  15096. if (callback) {
  15097. const cb = callback
  15098. callback = null
  15099. cb(err)
  15100. }
  15101. })
  15102. return socket
  15103. }
  15104. }
  15105. function setupTimeout (onConnectTimeout, timeout) {
  15106. if (!timeout) {
  15107. return () => {}
  15108. }
  15109. let s1 = null
  15110. let s2 = null
  15111. const timeoutId = setTimeout(() => {
  15112. // setImmediate is added to make sure that we priotorise socket error events over timeouts
  15113. s1 = setImmediate(() => {
  15114. if (process.platform === 'win32') {
  15115. // Windows needs an extra setImmediate probably due to implementation differences in the socket logic
  15116. s2 = setImmediate(() => onConnectTimeout())
  15117. } else {
  15118. onConnectTimeout()
  15119. }
  15120. })
  15121. }, timeout)
  15122. return () => {
  15123. clearTimeout(timeoutId)
  15124. clearImmediate(s1)
  15125. clearImmediate(s2)
  15126. }
  15127. }
  15128. function onConnectTimeout (socket) {
  15129. util.destroy(socket, new ConnectTimeoutError())
  15130. }
  15131. module.exports = buildConnector
  15132. /***/ }),
  15133. /***/ 4462:
  15134. /***/ ((module) => {
  15135. /** @type {Record<string, string | undefined>} */
  15136. const headerNameLowerCasedRecord = {}
  15137. // https://developer.mozilla.org/docs/Web/HTTP/Headers
  15138. const wellknownHeaderNames = [
  15139. 'Accept',
  15140. 'Accept-Encoding',
  15141. 'Accept-Language',
  15142. 'Accept-Ranges',
  15143. 'Access-Control-Allow-Credentials',
  15144. 'Access-Control-Allow-Headers',
  15145. 'Access-Control-Allow-Methods',
  15146. 'Access-Control-Allow-Origin',
  15147. 'Access-Control-Expose-Headers',
  15148. 'Access-Control-Max-Age',
  15149. 'Access-Control-Request-Headers',
  15150. 'Access-Control-Request-Method',
  15151. 'Age',
  15152. 'Allow',
  15153. 'Alt-Svc',
  15154. 'Alt-Used',
  15155. 'Authorization',
  15156. 'Cache-Control',
  15157. 'Clear-Site-Data',
  15158. 'Connection',
  15159. 'Content-Disposition',
  15160. 'Content-Encoding',
  15161. 'Content-Language',
  15162. 'Content-Length',
  15163. 'Content-Location',
  15164. 'Content-Range',
  15165. 'Content-Security-Policy',
  15166. 'Content-Security-Policy-Report-Only',
  15167. 'Content-Type',
  15168. 'Cookie',
  15169. 'Cross-Origin-Embedder-Policy',
  15170. 'Cross-Origin-Opener-Policy',
  15171. 'Cross-Origin-Resource-Policy',
  15172. 'Date',
  15173. 'Device-Memory',
  15174. 'Downlink',
  15175. 'ECT',
  15176. 'ETag',
  15177. 'Expect',
  15178. 'Expect-CT',
  15179. 'Expires',
  15180. 'Forwarded',
  15181. 'From',
  15182. 'Host',
  15183. 'If-Match',
  15184. 'If-Modified-Since',
  15185. 'If-None-Match',
  15186. 'If-Range',
  15187. 'If-Unmodified-Since',
  15188. 'Keep-Alive',
  15189. 'Last-Modified',
  15190. 'Link',
  15191. 'Location',
  15192. 'Max-Forwards',
  15193. 'Origin',
  15194. 'Permissions-Policy',
  15195. 'Pragma',
  15196. 'Proxy-Authenticate',
  15197. 'Proxy-Authorization',
  15198. 'RTT',
  15199. 'Range',
  15200. 'Referer',
  15201. 'Referrer-Policy',
  15202. 'Refresh',
  15203. 'Retry-After',
  15204. 'Sec-WebSocket-Accept',
  15205. 'Sec-WebSocket-Extensions',
  15206. 'Sec-WebSocket-Key',
  15207. 'Sec-WebSocket-Protocol',
  15208. 'Sec-WebSocket-Version',
  15209. 'Server',
  15210. 'Server-Timing',
  15211. 'Service-Worker-Allowed',
  15212. 'Service-Worker-Navigation-Preload',
  15213. 'Set-Cookie',
  15214. 'SourceMap',
  15215. 'Strict-Transport-Security',
  15216. 'Supports-Loading-Mode',
  15217. 'TE',
  15218. 'Timing-Allow-Origin',
  15219. 'Trailer',
  15220. 'Transfer-Encoding',
  15221. 'Upgrade',
  15222. 'Upgrade-Insecure-Requests',
  15223. 'User-Agent',
  15224. 'Vary',
  15225. 'Via',
  15226. 'WWW-Authenticate',
  15227. 'X-Content-Type-Options',
  15228. 'X-DNS-Prefetch-Control',
  15229. 'X-Frame-Options',
  15230. 'X-Permitted-Cross-Domain-Policies',
  15231. 'X-Powered-By',
  15232. 'X-Requested-With',
  15233. 'X-XSS-Protection'
  15234. ]
  15235. for (let i = 0; i < wellknownHeaderNames.length; ++i) {
  15236. const key = wellknownHeaderNames[i]
  15237. const lowerCasedKey = key.toLowerCase()
  15238. headerNameLowerCasedRecord[key] = headerNameLowerCasedRecord[lowerCasedKey] =
  15239. lowerCasedKey
  15240. }
  15241. // Note: object prototypes should not be able to be referenced. e.g. `Object#hasOwnProperty`.
  15242. Object.setPrototypeOf(headerNameLowerCasedRecord, null)
  15243. module.exports = {
  15244. wellknownHeaderNames,
  15245. headerNameLowerCasedRecord
  15246. }
  15247. /***/ }),
  15248. /***/ 8045:
  15249. /***/ ((module) => {
  15250. class UndiciError extends Error {
  15251. constructor (message) {
  15252. super(message)
  15253. this.name = 'UndiciError'
  15254. this.code = 'UND_ERR'
  15255. }
  15256. }
  15257. class ConnectTimeoutError extends UndiciError {
  15258. constructor (message) {
  15259. super(message)
  15260. Error.captureStackTrace(this, ConnectTimeoutError)
  15261. this.name = 'ConnectTimeoutError'
  15262. this.message = message || 'Connect Timeout Error'
  15263. this.code = 'UND_ERR_CONNECT_TIMEOUT'
  15264. }
  15265. }
  15266. class HeadersTimeoutError extends UndiciError {
  15267. constructor (message) {
  15268. super(message)
  15269. Error.captureStackTrace(this, HeadersTimeoutError)
  15270. this.name = 'HeadersTimeoutError'
  15271. this.message = message || 'Headers Timeout Error'
  15272. this.code = 'UND_ERR_HEADERS_TIMEOUT'
  15273. }
  15274. }
  15275. class HeadersOverflowError extends UndiciError {
  15276. constructor (message) {
  15277. super(message)
  15278. Error.captureStackTrace(this, HeadersOverflowError)
  15279. this.name = 'HeadersOverflowError'
  15280. this.message = message || 'Headers Overflow Error'
  15281. this.code = 'UND_ERR_HEADERS_OVERFLOW'
  15282. }
  15283. }
  15284. class BodyTimeoutError extends UndiciError {
  15285. constructor (message) {
  15286. super(message)
  15287. Error.captureStackTrace(this, BodyTimeoutError)
  15288. this.name = 'BodyTimeoutError'
  15289. this.message = message || 'Body Timeout Error'
  15290. this.code = 'UND_ERR_BODY_TIMEOUT'
  15291. }
  15292. }
  15293. class ResponseStatusCodeError extends UndiciError {
  15294. constructor (message, statusCode, headers, body) {
  15295. super(message)
  15296. Error.captureStackTrace(this, ResponseStatusCodeError)
  15297. this.name = 'ResponseStatusCodeError'
  15298. this.message = message || 'Response Status Code Error'
  15299. this.code = 'UND_ERR_RESPONSE_STATUS_CODE'
  15300. this.body = body
  15301. this.status = statusCode
  15302. this.statusCode = statusCode
  15303. this.headers = headers
  15304. }
  15305. }
  15306. class InvalidArgumentError extends UndiciError {
  15307. constructor (message) {
  15308. super(message)
  15309. Error.captureStackTrace(this, InvalidArgumentError)
  15310. this.name = 'InvalidArgumentError'
  15311. this.message = message || 'Invalid Argument Error'
  15312. this.code = 'UND_ERR_INVALID_ARG'
  15313. }
  15314. }
  15315. class InvalidReturnValueError extends UndiciError {
  15316. constructor (message) {
  15317. super(message)
  15318. Error.captureStackTrace(this, InvalidReturnValueError)
  15319. this.name = 'InvalidReturnValueError'
  15320. this.message = message || 'Invalid Return Value Error'
  15321. this.code = 'UND_ERR_INVALID_RETURN_VALUE'
  15322. }
  15323. }
  15324. class RequestAbortedError extends UndiciError {
  15325. constructor (message) {
  15326. super(message)
  15327. Error.captureStackTrace(this, RequestAbortedError)
  15328. this.name = 'AbortError'
  15329. this.message = message || 'Request aborted'
  15330. this.code = 'UND_ERR_ABORTED'
  15331. }
  15332. }
  15333. class InformationalError extends UndiciError {
  15334. constructor (message) {
  15335. super(message)
  15336. Error.captureStackTrace(this, InformationalError)
  15337. this.name = 'InformationalError'
  15338. this.message = message || 'Request information'
  15339. this.code = 'UND_ERR_INFO'
  15340. }
  15341. }
  15342. class RequestContentLengthMismatchError extends UndiciError {
  15343. constructor (message) {
  15344. super(message)
  15345. Error.captureStackTrace(this, RequestContentLengthMismatchError)
  15346. this.name = 'RequestContentLengthMismatchError'
  15347. this.message = message || 'Request body length does not match content-length header'
  15348. this.code = 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH'
  15349. }
  15350. }
  15351. class ResponseContentLengthMismatchError extends UndiciError {
  15352. constructor (message) {
  15353. super(message)
  15354. Error.captureStackTrace(this, ResponseContentLengthMismatchError)
  15355. this.name = 'ResponseContentLengthMismatchError'
  15356. this.message = message || 'Response body length does not match content-length header'
  15357. this.code = 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH'
  15358. }
  15359. }
  15360. class ClientDestroyedError extends UndiciError {
  15361. constructor (message) {
  15362. super(message)
  15363. Error.captureStackTrace(this, ClientDestroyedError)
  15364. this.name = 'ClientDestroyedError'
  15365. this.message = message || 'The client is destroyed'
  15366. this.code = 'UND_ERR_DESTROYED'
  15367. }
  15368. }
  15369. class ClientClosedError extends UndiciError {
  15370. constructor (message) {
  15371. super(message)
  15372. Error.captureStackTrace(this, ClientClosedError)
  15373. this.name = 'ClientClosedError'
  15374. this.message = message || 'The client is closed'
  15375. this.code = 'UND_ERR_CLOSED'
  15376. }
  15377. }
  15378. class SocketError extends UndiciError {
  15379. constructor (message, socket) {
  15380. super(message)
  15381. Error.captureStackTrace(this, SocketError)
  15382. this.name = 'SocketError'
  15383. this.message = message || 'Socket error'
  15384. this.code = 'UND_ERR_SOCKET'
  15385. this.socket = socket
  15386. }
  15387. }
  15388. class NotSupportedError extends UndiciError {
  15389. constructor (message) {
  15390. super(message)
  15391. Error.captureStackTrace(this, NotSupportedError)
  15392. this.name = 'NotSupportedError'
  15393. this.message = message || 'Not supported error'
  15394. this.code = 'UND_ERR_NOT_SUPPORTED'
  15395. }
  15396. }
  15397. class BalancedPoolMissingUpstreamError extends UndiciError {
  15398. constructor (message) {
  15399. super(message)
  15400. Error.captureStackTrace(this, NotSupportedError)
  15401. this.name = 'MissingUpstreamError'
  15402. this.message = message || 'No upstream has been added to the BalancedPool'
  15403. this.code = 'UND_ERR_BPL_MISSING_UPSTREAM'
  15404. }
  15405. }
  15406. class HTTPParserError extends Error {
  15407. constructor (message, code, data) {
  15408. super(message)
  15409. Error.captureStackTrace(this, HTTPParserError)
  15410. this.name = 'HTTPParserError'
  15411. this.code = code ? `HPE_${code}` : undefined
  15412. this.data = data ? data.toString() : undefined
  15413. }
  15414. }
  15415. class ResponseExceededMaxSizeError extends UndiciError {
  15416. constructor (message) {
  15417. super(message)
  15418. Error.captureStackTrace(this, ResponseExceededMaxSizeError)
  15419. this.name = 'ResponseExceededMaxSizeError'
  15420. this.message = message || 'Response content exceeded max size'
  15421. this.code = 'UND_ERR_RES_EXCEEDED_MAX_SIZE'
  15422. }
  15423. }
  15424. class RequestRetryError extends UndiciError {
  15425. constructor (message, code, { headers, data }) {
  15426. super(message)
  15427. Error.captureStackTrace(this, RequestRetryError)
  15428. this.name = 'RequestRetryError'
  15429. this.message = message || 'Request retry error'
  15430. this.code = 'UND_ERR_REQ_RETRY'
  15431. this.statusCode = code
  15432. this.data = data
  15433. this.headers = headers
  15434. }
  15435. }
  15436. module.exports = {
  15437. HTTPParserError,
  15438. UndiciError,
  15439. HeadersTimeoutError,
  15440. HeadersOverflowError,
  15441. BodyTimeoutError,
  15442. RequestContentLengthMismatchError,
  15443. ConnectTimeoutError,
  15444. ResponseStatusCodeError,
  15445. InvalidArgumentError,
  15446. InvalidReturnValueError,
  15447. RequestAbortedError,
  15448. ClientDestroyedError,
  15449. ClientClosedError,
  15450. InformationalError,
  15451. SocketError,
  15452. NotSupportedError,
  15453. ResponseContentLengthMismatchError,
  15454. BalancedPoolMissingUpstreamError,
  15455. ResponseExceededMaxSizeError,
  15456. RequestRetryError
  15457. }
  15458. /***/ }),
  15459. /***/ 2905:
  15460. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  15461. const {
  15462. InvalidArgumentError,
  15463. NotSupportedError
  15464. } = __nccwpck_require__(8045)
  15465. const assert = __nccwpck_require__(9491)
  15466. const { kHTTP2BuildRequest, kHTTP2CopyHeaders, kHTTP1BuildRequest } = __nccwpck_require__(2785)
  15467. const util = __nccwpck_require__(3983)
  15468. // tokenRegExp and headerCharRegex have been lifted from
  15469. // https://github.com/nodejs/node/blob/main/lib/_http_common.js
  15470. /**
  15471. * Verifies that the given val is a valid HTTP token
  15472. * per the rules defined in RFC 7230
  15473. * See https://tools.ietf.org/html/rfc7230#section-3.2.6
  15474. */
  15475. const tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/
  15476. /**
  15477. * Matches if val contains an invalid field-vchar
  15478. * field-value = *( field-content / obs-fold )
  15479. * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
  15480. * field-vchar = VCHAR / obs-text
  15481. */
  15482. const headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/
  15483. // Verifies that a given path is valid does not contain control chars \x00 to \x20
  15484. const invalidPathRegex = /[^\u0021-\u00ff]/
  15485. const kHandler = Symbol('handler')
  15486. const channels = {}
  15487. let extractBody
  15488. try {
  15489. const diagnosticsChannel = __nccwpck_require__(7643)
  15490. channels.create = diagnosticsChannel.channel('undici:request:create')
  15491. channels.bodySent = diagnosticsChannel.channel('undici:request:bodySent')
  15492. channels.headers = diagnosticsChannel.channel('undici:request:headers')
  15493. channels.trailers = diagnosticsChannel.channel('undici:request:trailers')
  15494. channels.error = diagnosticsChannel.channel('undici:request:error')
  15495. } catch {
  15496. channels.create = { hasSubscribers: false }
  15497. channels.bodySent = { hasSubscribers: false }
  15498. channels.headers = { hasSubscribers: false }
  15499. channels.trailers = { hasSubscribers: false }
  15500. channels.error = { hasSubscribers: false }
  15501. }
  15502. class Request {
  15503. constructor (origin, {
  15504. path,
  15505. method,
  15506. body,
  15507. headers,
  15508. query,
  15509. idempotent,
  15510. blocking,
  15511. upgrade,
  15512. headersTimeout,
  15513. bodyTimeout,
  15514. reset,
  15515. throwOnError,
  15516. expectContinue
  15517. }, handler) {
  15518. if (typeof path !== 'string') {
  15519. throw new InvalidArgumentError('path must be a string')
  15520. } else if (
  15521. path[0] !== '/' &&
  15522. !(path.startsWith('http://') || path.startsWith('https://')) &&
  15523. method !== 'CONNECT'
  15524. ) {
  15525. throw new InvalidArgumentError('path must be an absolute URL or start with a slash')
  15526. } else if (invalidPathRegex.exec(path) !== null) {
  15527. throw new InvalidArgumentError('invalid request path')
  15528. }
  15529. if (typeof method !== 'string') {
  15530. throw new InvalidArgumentError('method must be a string')
  15531. } else if (tokenRegExp.exec(method) === null) {
  15532. throw new InvalidArgumentError('invalid request method')
  15533. }
  15534. if (upgrade && typeof upgrade !== 'string') {
  15535. throw new InvalidArgumentError('upgrade must be a string')
  15536. }
  15537. if (headersTimeout != null && (!Number.isFinite(headersTimeout) || headersTimeout < 0)) {
  15538. throw new InvalidArgumentError('invalid headersTimeout')
  15539. }
  15540. if (bodyTimeout != null && (!Number.isFinite(bodyTimeout) || bodyTimeout < 0)) {
  15541. throw new InvalidArgumentError('invalid bodyTimeout')
  15542. }
  15543. if (reset != null && typeof reset !== 'boolean') {
  15544. throw new InvalidArgumentError('invalid reset')
  15545. }
  15546. if (expectContinue != null && typeof expectContinue !== 'boolean') {
  15547. throw new InvalidArgumentError('invalid expectContinue')
  15548. }
  15549. this.headersTimeout = headersTimeout
  15550. this.bodyTimeout = bodyTimeout
  15551. this.throwOnError = throwOnError === true
  15552. this.method = method
  15553. this.abort = null
  15554. if (body == null) {
  15555. this.body = null
  15556. } else if (util.isStream(body)) {
  15557. this.body = body
  15558. const rState = this.body._readableState
  15559. if (!rState || !rState.autoDestroy) {
  15560. this.endHandler = function autoDestroy () {
  15561. util.destroy(this)
  15562. }
  15563. this.body.on('end', this.endHandler)
  15564. }
  15565. this.errorHandler = err => {
  15566. if (this.abort) {
  15567. this.abort(err)
  15568. } else {
  15569. this.error = err
  15570. }
  15571. }
  15572. this.body.on('error', this.errorHandler)
  15573. } else if (util.isBuffer(body)) {
  15574. this.body = body.byteLength ? body : null
  15575. } else if (ArrayBuffer.isView(body)) {
  15576. this.body = body.buffer.byteLength ? Buffer.from(body.buffer, body.byteOffset, body.byteLength) : null
  15577. } else if (body instanceof ArrayBuffer) {
  15578. this.body = body.byteLength ? Buffer.from(body) : null
  15579. } else if (typeof body === 'string') {
  15580. this.body = body.length ? Buffer.from(body) : null
  15581. } else if (util.isFormDataLike(body) || util.isIterable(body) || util.isBlobLike(body)) {
  15582. this.body = body
  15583. } else {
  15584. throw new InvalidArgumentError('body must be a string, a Buffer, a Readable stream, an iterable, or an async iterable')
  15585. }
  15586. this.completed = false
  15587. this.aborted = false
  15588. this.upgrade = upgrade || null
  15589. this.path = query ? util.buildURL(path, query) : path
  15590. this.origin = origin
  15591. this.idempotent = idempotent == null
  15592. ? method === 'HEAD' || method === 'GET'
  15593. : idempotent
  15594. this.blocking = blocking == null ? false : blocking
  15595. this.reset = reset == null ? null : reset
  15596. this.host = null
  15597. this.contentLength = null
  15598. this.contentType = null
  15599. this.headers = ''
  15600. // Only for H2
  15601. this.expectContinue = expectContinue != null ? expectContinue : false
  15602. if (Array.isArray(headers)) {
  15603. if (headers.length % 2 !== 0) {
  15604. throw new InvalidArgumentError('headers array must be even')
  15605. }
  15606. for (let i = 0; i < headers.length; i += 2) {
  15607. processHeader(this, headers[i], headers[i + 1])
  15608. }
  15609. } else if (headers && typeof headers === 'object') {
  15610. const keys = Object.keys(headers)
  15611. for (let i = 0; i < keys.length; i++) {
  15612. const key = keys[i]
  15613. processHeader(this, key, headers[key])
  15614. }
  15615. } else if (headers != null) {
  15616. throw new InvalidArgumentError('headers must be an object or an array')
  15617. }
  15618. if (util.isFormDataLike(this.body)) {
  15619. if (util.nodeMajor < 16 || (util.nodeMajor === 16 && util.nodeMinor < 8)) {
  15620. throw new InvalidArgumentError('Form-Data bodies are only supported in node v16.8 and newer.')
  15621. }
  15622. if (!extractBody) {
  15623. extractBody = (__nccwpck_require__(9990).extractBody)
  15624. }
  15625. const [bodyStream, contentType] = extractBody(body)
  15626. if (this.contentType == null) {
  15627. this.contentType = contentType
  15628. this.headers += `content-type: ${contentType}\r\n`
  15629. }
  15630. this.body = bodyStream.stream
  15631. this.contentLength = bodyStream.length
  15632. } else if (util.isBlobLike(body) && this.contentType == null && body.type) {
  15633. this.contentType = body.type
  15634. this.headers += `content-type: ${body.type}\r\n`
  15635. }
  15636. util.validateHandler(handler, method, upgrade)
  15637. this.servername = util.getServerName(this.host)
  15638. this[kHandler] = handler
  15639. if (channels.create.hasSubscribers) {
  15640. channels.create.publish({ request: this })
  15641. }
  15642. }
  15643. onBodySent (chunk) {
  15644. if (this[kHandler].onBodySent) {
  15645. try {
  15646. return this[kHandler].onBodySent(chunk)
  15647. } catch (err) {
  15648. this.abort(err)
  15649. }
  15650. }
  15651. }
  15652. onRequestSent () {
  15653. if (channels.bodySent.hasSubscribers) {
  15654. channels.bodySent.publish({ request: this })
  15655. }
  15656. if (this[kHandler].onRequestSent) {
  15657. try {
  15658. return this[kHandler].onRequestSent()
  15659. } catch (err) {
  15660. this.abort(err)
  15661. }
  15662. }
  15663. }
  15664. onConnect (abort) {
  15665. assert(!this.aborted)
  15666. assert(!this.completed)
  15667. if (this.error) {
  15668. abort(this.error)
  15669. } else {
  15670. this.abort = abort
  15671. return this[kHandler].onConnect(abort)
  15672. }
  15673. }
  15674. onHeaders (statusCode, headers, resume, statusText) {
  15675. assert(!this.aborted)
  15676. assert(!this.completed)
  15677. if (channels.headers.hasSubscribers) {
  15678. channels.headers.publish({ request: this, response: { statusCode, headers, statusText } })
  15679. }
  15680. try {
  15681. return this[kHandler].onHeaders(statusCode, headers, resume, statusText)
  15682. } catch (err) {
  15683. this.abort(err)
  15684. }
  15685. }
  15686. onData (chunk) {
  15687. assert(!this.aborted)
  15688. assert(!this.completed)
  15689. try {
  15690. return this[kHandler].onData(chunk)
  15691. } catch (err) {
  15692. this.abort(err)
  15693. return false
  15694. }
  15695. }
  15696. onUpgrade (statusCode, headers, socket) {
  15697. assert(!this.aborted)
  15698. assert(!this.completed)
  15699. return this[kHandler].onUpgrade(statusCode, headers, socket)
  15700. }
  15701. onComplete (trailers) {
  15702. this.onFinally()
  15703. assert(!this.aborted)
  15704. this.completed = true
  15705. if (channels.trailers.hasSubscribers) {
  15706. channels.trailers.publish({ request: this, trailers })
  15707. }
  15708. try {
  15709. return this[kHandler].onComplete(trailers)
  15710. } catch (err) {
  15711. // TODO (fix): This might be a bad idea?
  15712. this.onError(err)
  15713. }
  15714. }
  15715. onError (error) {
  15716. this.onFinally()
  15717. if (channels.error.hasSubscribers) {
  15718. channels.error.publish({ request: this, error })
  15719. }
  15720. if (this.aborted) {
  15721. return
  15722. }
  15723. this.aborted = true
  15724. return this[kHandler].onError(error)
  15725. }
  15726. onFinally () {
  15727. if (this.errorHandler) {
  15728. this.body.off('error', this.errorHandler)
  15729. this.errorHandler = null
  15730. }
  15731. if (this.endHandler) {
  15732. this.body.off('end', this.endHandler)
  15733. this.endHandler = null
  15734. }
  15735. }
  15736. // TODO: adjust to support H2
  15737. addHeader (key, value) {
  15738. processHeader(this, key, value)
  15739. return this
  15740. }
  15741. static [kHTTP1BuildRequest] (origin, opts, handler) {
  15742. // TODO: Migrate header parsing here, to make Requests
  15743. // HTTP agnostic
  15744. return new Request(origin, opts, handler)
  15745. }
  15746. static [kHTTP2BuildRequest] (origin, opts, handler) {
  15747. const headers = opts.headers
  15748. opts = { ...opts, headers: null }
  15749. const request = new Request(origin, opts, handler)
  15750. request.headers = {}
  15751. if (Array.isArray(headers)) {
  15752. if (headers.length % 2 !== 0) {
  15753. throw new InvalidArgumentError('headers array must be even')
  15754. }
  15755. for (let i = 0; i < headers.length; i += 2) {
  15756. processHeader(request, headers[i], headers[i + 1], true)
  15757. }
  15758. } else if (headers && typeof headers === 'object') {
  15759. const keys = Object.keys(headers)
  15760. for (let i = 0; i < keys.length; i++) {
  15761. const key = keys[i]
  15762. processHeader(request, key, headers[key], true)
  15763. }
  15764. } else if (headers != null) {
  15765. throw new InvalidArgumentError('headers must be an object or an array')
  15766. }
  15767. return request
  15768. }
  15769. static [kHTTP2CopyHeaders] (raw) {
  15770. const rawHeaders = raw.split('\r\n')
  15771. const headers = {}
  15772. for (const header of rawHeaders) {
  15773. const [key, value] = header.split(': ')
  15774. if (value == null || value.length === 0) continue
  15775. if (headers[key]) headers[key] += `,${value}`
  15776. else headers[key] = value
  15777. }
  15778. return headers
  15779. }
  15780. }
  15781. function processHeaderValue (key, val, skipAppend) {
  15782. if (val && typeof val === 'object') {
  15783. throw new InvalidArgumentError(`invalid ${key} header`)
  15784. }
  15785. val = val != null ? `${val}` : ''
  15786. if (headerCharRegex.exec(val) !== null) {
  15787. throw new InvalidArgumentError(`invalid ${key} header`)
  15788. }
  15789. return skipAppend ? val : `${key}: ${val}\r\n`
  15790. }
  15791. function processHeader (request, key, val, skipAppend = false) {
  15792. if (val && (typeof val === 'object' && !Array.isArray(val))) {
  15793. throw new InvalidArgumentError(`invalid ${key} header`)
  15794. } else if (val === undefined) {
  15795. return
  15796. }
  15797. if (
  15798. request.host === null &&
  15799. key.length === 4 &&
  15800. key.toLowerCase() === 'host'
  15801. ) {
  15802. if (headerCharRegex.exec(val) !== null) {
  15803. throw new InvalidArgumentError(`invalid ${key} header`)
  15804. }
  15805. // Consumed by Client
  15806. request.host = val
  15807. } else if (
  15808. request.contentLength === null &&
  15809. key.length === 14 &&
  15810. key.toLowerCase() === 'content-length'
  15811. ) {
  15812. request.contentLength = parseInt(val, 10)
  15813. if (!Number.isFinite(request.contentLength)) {
  15814. throw new InvalidArgumentError('invalid content-length header')
  15815. }
  15816. } else if (
  15817. request.contentType === null &&
  15818. key.length === 12 &&
  15819. key.toLowerCase() === 'content-type'
  15820. ) {
  15821. request.contentType = val
  15822. if (skipAppend) request.headers[key] = processHeaderValue(key, val, skipAppend)
  15823. else request.headers += processHeaderValue(key, val)
  15824. } else if (
  15825. key.length === 17 &&
  15826. key.toLowerCase() === 'transfer-encoding'
  15827. ) {
  15828. throw new InvalidArgumentError('invalid transfer-encoding header')
  15829. } else if (
  15830. key.length === 10 &&
  15831. key.toLowerCase() === 'connection'
  15832. ) {
  15833. const value = typeof val === 'string' ? val.toLowerCase() : null
  15834. if (value !== 'close' && value !== 'keep-alive') {
  15835. throw new InvalidArgumentError('invalid connection header')
  15836. } else if (value === 'close') {
  15837. request.reset = true
  15838. }
  15839. } else if (
  15840. key.length === 10 &&
  15841. key.toLowerCase() === 'keep-alive'
  15842. ) {
  15843. throw new InvalidArgumentError('invalid keep-alive header')
  15844. } else if (
  15845. key.length === 7 &&
  15846. key.toLowerCase() === 'upgrade'
  15847. ) {
  15848. throw new InvalidArgumentError('invalid upgrade header')
  15849. } else if (
  15850. key.length === 6 &&
  15851. key.toLowerCase() === 'expect'
  15852. ) {
  15853. throw new NotSupportedError('expect header not supported')
  15854. } else if (tokenRegExp.exec(key) === null) {
  15855. throw new InvalidArgumentError('invalid header key')
  15856. } else {
  15857. if (Array.isArray(val)) {
  15858. for (let i = 0; i < val.length; i++) {
  15859. if (skipAppend) {
  15860. if (request.headers[key]) request.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}`
  15861. else request.headers[key] = processHeaderValue(key, val[i], skipAppend)
  15862. } else {
  15863. request.headers += processHeaderValue(key, val[i])
  15864. }
  15865. }
  15866. } else {
  15867. if (skipAppend) request.headers[key] = processHeaderValue(key, val, skipAppend)
  15868. else request.headers += processHeaderValue(key, val)
  15869. }
  15870. }
  15871. }
  15872. module.exports = Request
  15873. /***/ }),
  15874. /***/ 2785:
  15875. /***/ ((module) => {
  15876. module.exports = {
  15877. kClose: Symbol('close'),
  15878. kDestroy: Symbol('destroy'),
  15879. kDispatch: Symbol('dispatch'),
  15880. kUrl: Symbol('url'),
  15881. kWriting: Symbol('writing'),
  15882. kResuming: Symbol('resuming'),
  15883. kQueue: Symbol('queue'),
  15884. kConnect: Symbol('connect'),
  15885. kConnecting: Symbol('connecting'),
  15886. kHeadersList: Symbol('headers list'),
  15887. kKeepAliveDefaultTimeout: Symbol('default keep alive timeout'),
  15888. kKeepAliveMaxTimeout: Symbol('max keep alive timeout'),
  15889. kKeepAliveTimeoutThreshold: Symbol('keep alive timeout threshold'),
  15890. kKeepAliveTimeoutValue: Symbol('keep alive timeout'),
  15891. kKeepAlive: Symbol('keep alive'),
  15892. kHeadersTimeout: Symbol('headers timeout'),
  15893. kBodyTimeout: Symbol('body timeout'),
  15894. kServerName: Symbol('server name'),
  15895. kLocalAddress: Symbol('local address'),
  15896. kHost: Symbol('host'),
  15897. kNoRef: Symbol('no ref'),
  15898. kBodyUsed: Symbol('used'),
  15899. kRunning: Symbol('running'),
  15900. kBlocking: Symbol('blocking'),
  15901. kPending: Symbol('pending'),
  15902. kSize: Symbol('size'),
  15903. kBusy: Symbol('busy'),
  15904. kQueued: Symbol('queued'),
  15905. kFree: Symbol('free'),
  15906. kConnected: Symbol('connected'),
  15907. kClosed: Symbol('closed'),
  15908. kNeedDrain: Symbol('need drain'),
  15909. kReset: Symbol('reset'),
  15910. kDestroyed: Symbol.for('nodejs.stream.destroyed'),
  15911. kMaxHeadersSize: Symbol('max headers size'),
  15912. kRunningIdx: Symbol('running index'),
  15913. kPendingIdx: Symbol('pending index'),
  15914. kError: Symbol('error'),
  15915. kClients: Symbol('clients'),
  15916. kClient: Symbol('client'),
  15917. kParser: Symbol('parser'),
  15918. kOnDestroyed: Symbol('destroy callbacks'),
  15919. kPipelining: Symbol('pipelining'),
  15920. kSocket: Symbol('socket'),
  15921. kHostHeader: Symbol('host header'),
  15922. kConnector: Symbol('connector'),
  15923. kStrictContentLength: Symbol('strict content length'),
  15924. kMaxRedirections: Symbol('maxRedirections'),
  15925. kMaxRequests: Symbol('maxRequestsPerClient'),
  15926. kProxy: Symbol('proxy agent options'),
  15927. kCounter: Symbol('socket request counter'),
  15928. kInterceptors: Symbol('dispatch interceptors'),
  15929. kMaxResponseSize: Symbol('max response size'),
  15930. kHTTP2Session: Symbol('http2Session'),
  15931. kHTTP2SessionState: Symbol('http2Session state'),
  15932. kHTTP2BuildRequest: Symbol('http2 build request'),
  15933. kHTTP1BuildRequest: Symbol('http1 build request'),
  15934. kHTTP2CopyHeaders: Symbol('http2 copy headers'),
  15935. kHTTPConnVersion: Symbol('http connection version'),
  15936. kRetryHandlerDefaultRetry: Symbol('retry agent default retry'),
  15937. kConstruct: Symbol('constructable')
  15938. }
  15939. /***/ }),
  15940. /***/ 3983:
  15941. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  15942. const assert = __nccwpck_require__(9491)
  15943. const { kDestroyed, kBodyUsed } = __nccwpck_require__(2785)
  15944. const { IncomingMessage } = __nccwpck_require__(3685)
  15945. const stream = __nccwpck_require__(2781)
  15946. const net = __nccwpck_require__(1808)
  15947. const { InvalidArgumentError } = __nccwpck_require__(8045)
  15948. const { Blob } = __nccwpck_require__(4300)
  15949. const nodeUtil = __nccwpck_require__(3837)
  15950. const { stringify } = __nccwpck_require__(3477)
  15951. const { headerNameLowerCasedRecord } = __nccwpck_require__(4462)
  15952. const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v))
  15953. function nop () {}
  15954. function isStream (obj) {
  15955. return obj && typeof obj === 'object' && typeof obj.pipe === 'function' && typeof obj.on === 'function'
  15956. }
  15957. // based on https://github.com/node-fetch/fetch-blob/blob/8ab587d34080de94140b54f07168451e7d0b655e/index.js#L229-L241 (MIT License)
  15958. function isBlobLike (object) {
  15959. return (Blob && object instanceof Blob) || (
  15960. object &&
  15961. typeof object === 'object' &&
  15962. (typeof object.stream === 'function' ||
  15963. typeof object.arrayBuffer === 'function') &&
  15964. /^(Blob|File)$/.test(object[Symbol.toStringTag])
  15965. )
  15966. }
  15967. function buildURL (url, queryParams) {
  15968. if (url.includes('?') || url.includes('#')) {
  15969. throw new Error('Query params cannot be passed when url already contains "?" or "#".')
  15970. }
  15971. const stringified = stringify(queryParams)
  15972. if (stringified) {
  15973. url += '?' + stringified
  15974. }
  15975. return url
  15976. }
  15977. function parseURL (url) {
  15978. if (typeof url === 'string') {
  15979. url = new URL(url)
  15980. if (!/^https?:/.test(url.origin || url.protocol)) {
  15981. throw new InvalidArgumentError('Invalid URL protocol: the URL must start with `http:` or `https:`.')
  15982. }
  15983. return url
  15984. }
  15985. if (!url || typeof url !== 'object') {
  15986. throw new InvalidArgumentError('Invalid URL: The URL argument must be a non-null object.')
  15987. }
  15988. if (!/^https?:/.test(url.origin || url.protocol)) {
  15989. throw new InvalidArgumentError('Invalid URL protocol: the URL must start with `http:` or `https:`.')
  15990. }
  15991. if (!(url instanceof URL)) {
  15992. if (url.port != null && url.port !== '' && !Number.isFinite(parseInt(url.port))) {
  15993. throw new InvalidArgumentError('Invalid URL: port must be a valid integer or a string representation of an integer.')
  15994. }
  15995. if (url.path != null && typeof url.path !== 'string') {
  15996. throw new InvalidArgumentError('Invalid URL path: the path must be a string or null/undefined.')
  15997. }
  15998. if (url.pathname != null && typeof url.pathname !== 'string') {
  15999. throw new InvalidArgumentError('Invalid URL pathname: the pathname must be a string or null/undefined.')
  16000. }
  16001. if (url.hostname != null && typeof url.hostname !== 'string') {
  16002. throw new InvalidArgumentError('Invalid URL hostname: the hostname must be a string or null/undefined.')
  16003. }
  16004. if (url.origin != null && typeof url.origin !== 'string') {
  16005. throw new InvalidArgumentError('Invalid URL origin: the origin must be a string or null/undefined.')
  16006. }
  16007. const port = url.port != null
  16008. ? url.port
  16009. : (url.protocol === 'https:' ? 443 : 80)
  16010. let origin = url.origin != null
  16011. ? url.origin
  16012. : `${url.protocol}//${url.hostname}:${port}`
  16013. let path = url.path != null
  16014. ? url.path
  16015. : `${url.pathname || ''}${url.search || ''}`
  16016. if (origin.endsWith('/')) {
  16017. origin = origin.substring(0, origin.length - 1)
  16018. }
  16019. if (path && !path.startsWith('/')) {
  16020. path = `/${path}`
  16021. }
  16022. // new URL(path, origin) is unsafe when `path` contains an absolute URL
  16023. // From https://developer.mozilla.org/en-US/docs/Web/API/URL/URL:
  16024. // If first parameter is a relative URL, second param is required, and will be used as the base URL.
  16025. // If first parameter is an absolute URL, a given second param will be ignored.
  16026. url = new URL(origin + path)
  16027. }
  16028. return url
  16029. }
  16030. function parseOrigin (url) {
  16031. url = parseURL(url)
  16032. if (url.pathname !== '/' || url.search || url.hash) {
  16033. throw new InvalidArgumentError('invalid url')
  16034. }
  16035. return url
  16036. }
  16037. function getHostname (host) {
  16038. if (host[0] === '[') {
  16039. const idx = host.indexOf(']')
  16040. assert(idx !== -1)
  16041. return host.substring(1, idx)
  16042. }
  16043. const idx = host.indexOf(':')
  16044. if (idx === -1) return host
  16045. return host.substring(0, idx)
  16046. }
  16047. // IP addresses are not valid server names per RFC6066
  16048. // > Currently, the only server names supported are DNS hostnames
  16049. function getServerName (host) {
  16050. if (!host) {
  16051. return null
  16052. }
  16053. assert.strictEqual(typeof host, 'string')
  16054. const servername = getHostname(host)
  16055. if (net.isIP(servername)) {
  16056. return ''
  16057. }
  16058. return servername
  16059. }
  16060. function deepClone (obj) {
  16061. return JSON.parse(JSON.stringify(obj))
  16062. }
  16063. function isAsyncIterable (obj) {
  16064. return !!(obj != null && typeof obj[Symbol.asyncIterator] === 'function')
  16065. }
  16066. function isIterable (obj) {
  16067. return !!(obj != null && (typeof obj[Symbol.iterator] === 'function' || typeof obj[Symbol.asyncIterator] === 'function'))
  16068. }
  16069. function bodyLength (body) {
  16070. if (body == null) {
  16071. return 0
  16072. } else if (isStream(body)) {
  16073. const state = body._readableState
  16074. return state && state.objectMode === false && state.ended === true && Number.isFinite(state.length)
  16075. ? state.length
  16076. : null
  16077. } else if (isBlobLike(body)) {
  16078. return body.size != null ? body.size : null
  16079. } else if (isBuffer(body)) {
  16080. return body.byteLength
  16081. }
  16082. return null
  16083. }
  16084. function isDestroyed (stream) {
  16085. return !stream || !!(stream.destroyed || stream[kDestroyed])
  16086. }
  16087. function isReadableAborted (stream) {
  16088. const state = stream && stream._readableState
  16089. return isDestroyed(stream) && state && !state.endEmitted
  16090. }
  16091. function destroy (stream, err) {
  16092. if (stream == null || !isStream(stream) || isDestroyed(stream)) {
  16093. return
  16094. }
  16095. if (typeof stream.destroy === 'function') {
  16096. if (Object.getPrototypeOf(stream).constructor === IncomingMessage) {
  16097. // See: https://github.com/nodejs/node/pull/38505/files
  16098. stream.socket = null
  16099. }
  16100. stream.destroy(err)
  16101. } else if (err) {
  16102. process.nextTick((stream, err) => {
  16103. stream.emit('error', err)
  16104. }, stream, err)
  16105. }
  16106. if (stream.destroyed !== true) {
  16107. stream[kDestroyed] = true
  16108. }
  16109. }
  16110. const KEEPALIVE_TIMEOUT_EXPR = /timeout=(\d+)/
  16111. function parseKeepAliveTimeout (val) {
  16112. const m = val.toString().match(KEEPALIVE_TIMEOUT_EXPR)
  16113. return m ? parseInt(m[1], 10) * 1000 : null
  16114. }
  16115. /**
  16116. * Retrieves a header name and returns its lowercase value.
  16117. * @param {string | Buffer} value Header name
  16118. * @returns {string}
  16119. */
  16120. function headerNameToString (value) {
  16121. return headerNameLowerCasedRecord[value] || value.toLowerCase()
  16122. }
  16123. function parseHeaders (headers, obj = {}) {
  16124. // For H2 support
  16125. if (!Array.isArray(headers)) return headers
  16126. for (let i = 0; i < headers.length; i += 2) {
  16127. const key = headers[i].toString().toLowerCase()
  16128. let val = obj[key]
  16129. if (!val) {
  16130. if (Array.isArray(headers[i + 1])) {
  16131. obj[key] = headers[i + 1].map(x => x.toString('utf8'))
  16132. } else {
  16133. obj[key] = headers[i + 1].toString('utf8')
  16134. }
  16135. } else {
  16136. if (!Array.isArray(val)) {
  16137. val = [val]
  16138. obj[key] = val
  16139. }
  16140. val.push(headers[i + 1].toString('utf8'))
  16141. }
  16142. }
  16143. // See https://github.com/nodejs/node/pull/46528
  16144. if ('content-length' in obj && 'content-disposition' in obj) {
  16145. obj['content-disposition'] = Buffer.from(obj['content-disposition']).toString('latin1')
  16146. }
  16147. return obj
  16148. }
  16149. function parseRawHeaders (headers) {
  16150. const ret = []
  16151. let hasContentLength = false
  16152. let contentDispositionIdx = -1
  16153. for (let n = 0; n < headers.length; n += 2) {
  16154. const key = headers[n + 0].toString()
  16155. const val = headers[n + 1].toString('utf8')
  16156. if (key.length === 14 && (key === 'content-length' || key.toLowerCase() === 'content-length')) {
  16157. ret.push(key, val)
  16158. hasContentLength = true
  16159. } else if (key.length === 19 && (key === 'content-disposition' || key.toLowerCase() === 'content-disposition')) {
  16160. contentDispositionIdx = ret.push(key, val) - 1
  16161. } else {
  16162. ret.push(key, val)
  16163. }
  16164. }
  16165. // See https://github.com/nodejs/node/pull/46528
  16166. if (hasContentLength && contentDispositionIdx !== -1) {
  16167. ret[contentDispositionIdx] = Buffer.from(ret[contentDispositionIdx]).toString('latin1')
  16168. }
  16169. return ret
  16170. }
  16171. function isBuffer (buffer) {
  16172. // See, https://github.com/mcollina/undici/pull/319
  16173. return buffer instanceof Uint8Array || Buffer.isBuffer(buffer)
  16174. }
  16175. function validateHandler (handler, method, upgrade) {
  16176. if (!handler || typeof handler !== 'object') {
  16177. throw new InvalidArgumentError('handler must be an object')
  16178. }
  16179. if (typeof handler.onConnect !== 'function') {
  16180. throw new InvalidArgumentError('invalid onConnect method')
  16181. }
  16182. if (typeof handler.onError !== 'function') {
  16183. throw new InvalidArgumentError('invalid onError method')
  16184. }
  16185. if (typeof handler.onBodySent !== 'function' && handler.onBodySent !== undefined) {
  16186. throw new InvalidArgumentError('invalid onBodySent method')
  16187. }
  16188. if (upgrade || method === 'CONNECT') {
  16189. if (typeof handler.onUpgrade !== 'function') {
  16190. throw new InvalidArgumentError('invalid onUpgrade method')
  16191. }
  16192. } else {
  16193. if (typeof handler.onHeaders !== 'function') {
  16194. throw new InvalidArgumentError('invalid onHeaders method')
  16195. }
  16196. if (typeof handler.onData !== 'function') {
  16197. throw new InvalidArgumentError('invalid onData method')
  16198. }
  16199. if (typeof handler.onComplete !== 'function') {
  16200. throw new InvalidArgumentError('invalid onComplete method')
  16201. }
  16202. }
  16203. }
  16204. // A body is disturbed if it has been read from and it cannot
  16205. // be re-used without losing state or data.
  16206. function isDisturbed (body) {
  16207. return !!(body && (
  16208. stream.isDisturbed
  16209. ? stream.isDisturbed(body) || body[kBodyUsed] // TODO (fix): Why is body[kBodyUsed] needed?
  16210. : body[kBodyUsed] ||
  16211. body.readableDidRead ||
  16212. (body._readableState && body._readableState.dataEmitted) ||
  16213. isReadableAborted(body)
  16214. ))
  16215. }
  16216. function isErrored (body) {
  16217. return !!(body && (
  16218. stream.isErrored
  16219. ? stream.isErrored(body)
  16220. : /state: 'errored'/.test(nodeUtil.inspect(body)
  16221. )))
  16222. }
  16223. function isReadable (body) {
  16224. return !!(body && (
  16225. stream.isReadable
  16226. ? stream.isReadable(body)
  16227. : /state: 'readable'/.test(nodeUtil.inspect(body)
  16228. )))
  16229. }
  16230. function getSocketInfo (socket) {
  16231. return {
  16232. localAddress: socket.localAddress,
  16233. localPort: socket.localPort,
  16234. remoteAddress: socket.remoteAddress,
  16235. remotePort: socket.remotePort,
  16236. remoteFamily: socket.remoteFamily,
  16237. timeout: socket.timeout,
  16238. bytesWritten: socket.bytesWritten,
  16239. bytesRead: socket.bytesRead
  16240. }
  16241. }
  16242. async function * convertIterableToBuffer (iterable) {
  16243. for await (const chunk of iterable) {
  16244. yield Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)
  16245. }
  16246. }
  16247. let ReadableStream
  16248. function ReadableStreamFrom (iterable) {
  16249. if (!ReadableStream) {
  16250. ReadableStream = (__nccwpck_require__(5356).ReadableStream)
  16251. }
  16252. if (ReadableStream.from) {
  16253. return ReadableStream.from(convertIterableToBuffer(iterable))
  16254. }
  16255. let iterator
  16256. return new ReadableStream(
  16257. {
  16258. async start () {
  16259. iterator = iterable[Symbol.asyncIterator]()
  16260. },
  16261. async pull (controller) {
  16262. const { done, value } = await iterator.next()
  16263. if (done) {
  16264. queueMicrotask(() => {
  16265. controller.close()
  16266. })
  16267. } else {
  16268. const buf = Buffer.isBuffer(value) ? value : Buffer.from(value)
  16269. controller.enqueue(new Uint8Array(buf))
  16270. }
  16271. return controller.desiredSize > 0
  16272. },
  16273. async cancel (reason) {
  16274. await iterator.return()
  16275. }
  16276. },
  16277. 0
  16278. )
  16279. }
  16280. // The chunk should be a FormData instance and contains
  16281. // all the required methods.
  16282. function isFormDataLike (object) {
  16283. return (
  16284. object &&
  16285. typeof object === 'object' &&
  16286. typeof object.append === 'function' &&
  16287. typeof object.delete === 'function' &&
  16288. typeof object.get === 'function' &&
  16289. typeof object.getAll === 'function' &&
  16290. typeof object.has === 'function' &&
  16291. typeof object.set === 'function' &&
  16292. object[Symbol.toStringTag] === 'FormData'
  16293. )
  16294. }
  16295. function throwIfAborted (signal) {
  16296. if (!signal) { return }
  16297. if (typeof signal.throwIfAborted === 'function') {
  16298. signal.throwIfAborted()
  16299. } else {
  16300. if (signal.aborted) {
  16301. // DOMException not available < v17.0.0
  16302. const err = new Error('The operation was aborted')
  16303. err.name = 'AbortError'
  16304. throw err
  16305. }
  16306. }
  16307. }
  16308. function addAbortListener (signal, listener) {
  16309. if ('addEventListener' in signal) {
  16310. signal.addEventListener('abort', listener, { once: true })
  16311. return () => signal.removeEventListener('abort', listener)
  16312. }
  16313. signal.addListener('abort', listener)
  16314. return () => signal.removeListener('abort', listener)
  16315. }
  16316. const hasToWellFormed = !!String.prototype.toWellFormed
  16317. /**
  16318. * @param {string} val
  16319. */
  16320. function toUSVString (val) {
  16321. if (hasToWellFormed) {
  16322. return `${val}`.toWellFormed()
  16323. } else if (nodeUtil.toUSVString) {
  16324. return nodeUtil.toUSVString(val)
  16325. }
  16326. return `${val}`
  16327. }
  16328. // Parsed accordingly to RFC 9110
  16329. // https://www.rfc-editor.org/rfc/rfc9110#field.content-range
  16330. function parseRangeHeader (range) {
  16331. if (range == null || range === '') return { start: 0, end: null, size: null }
  16332. const m = range ? range.match(/^bytes (\d+)-(\d+)\/(\d+)?$/) : null
  16333. return m
  16334. ? {
  16335. start: parseInt(m[1]),
  16336. end: m[2] ? parseInt(m[2]) : null,
  16337. size: m[3] ? parseInt(m[3]) : null
  16338. }
  16339. : null
  16340. }
  16341. const kEnumerableProperty = Object.create(null)
  16342. kEnumerableProperty.enumerable = true
  16343. module.exports = {
  16344. kEnumerableProperty,
  16345. nop,
  16346. isDisturbed,
  16347. isErrored,
  16348. isReadable,
  16349. toUSVString,
  16350. isReadableAborted,
  16351. isBlobLike,
  16352. parseOrigin,
  16353. parseURL,
  16354. getServerName,
  16355. isStream,
  16356. isIterable,
  16357. isAsyncIterable,
  16358. isDestroyed,
  16359. headerNameToString,
  16360. parseRawHeaders,
  16361. parseHeaders,
  16362. parseKeepAliveTimeout,
  16363. destroy,
  16364. bodyLength,
  16365. deepClone,
  16366. ReadableStreamFrom,
  16367. isBuffer,
  16368. validateHandler,
  16369. getSocketInfo,
  16370. isFormDataLike,
  16371. buildURL,
  16372. throwIfAborted,
  16373. addAbortListener,
  16374. parseRangeHeader,
  16375. nodeMajor,
  16376. nodeMinor,
  16377. nodeHasAutoSelectFamily: nodeMajor > 18 || (nodeMajor === 18 && nodeMinor >= 13),
  16378. safeHTTPMethods: ['GET', 'HEAD', 'OPTIONS', 'TRACE']
  16379. }
  16380. /***/ }),
  16381. /***/ 4839:
  16382. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  16383. const Dispatcher = __nccwpck_require__(412)
  16384. const {
  16385. ClientDestroyedError,
  16386. ClientClosedError,
  16387. InvalidArgumentError
  16388. } = __nccwpck_require__(8045)
  16389. const { kDestroy, kClose, kDispatch, kInterceptors } = __nccwpck_require__(2785)
  16390. const kDestroyed = Symbol('destroyed')
  16391. const kClosed = Symbol('closed')
  16392. const kOnDestroyed = Symbol('onDestroyed')
  16393. const kOnClosed = Symbol('onClosed')
  16394. const kInterceptedDispatch = Symbol('Intercepted Dispatch')
  16395. class DispatcherBase extends Dispatcher {
  16396. constructor () {
  16397. super()
  16398. this[kDestroyed] = false
  16399. this[kOnDestroyed] = null
  16400. this[kClosed] = false
  16401. this[kOnClosed] = []
  16402. }
  16403. get destroyed () {
  16404. return this[kDestroyed]
  16405. }
  16406. get closed () {
  16407. return this[kClosed]
  16408. }
  16409. get interceptors () {
  16410. return this[kInterceptors]
  16411. }
  16412. set interceptors (newInterceptors) {
  16413. if (newInterceptors) {
  16414. for (let i = newInterceptors.length - 1; i >= 0; i--) {
  16415. const interceptor = this[kInterceptors][i]
  16416. if (typeof interceptor !== 'function') {
  16417. throw new InvalidArgumentError('interceptor must be an function')
  16418. }
  16419. }
  16420. }
  16421. this[kInterceptors] = newInterceptors
  16422. }
  16423. close (callback) {
  16424. if (callback === undefined) {
  16425. return new Promise((resolve, reject) => {
  16426. this.close((err, data) => {
  16427. return err ? reject(err) : resolve(data)
  16428. })
  16429. })
  16430. }
  16431. if (typeof callback !== 'function') {
  16432. throw new InvalidArgumentError('invalid callback')
  16433. }
  16434. if (this[kDestroyed]) {
  16435. queueMicrotask(() => callback(new ClientDestroyedError(), null))
  16436. return
  16437. }
  16438. if (this[kClosed]) {
  16439. if (this[kOnClosed]) {
  16440. this[kOnClosed].push(callback)
  16441. } else {
  16442. queueMicrotask(() => callback(null, null))
  16443. }
  16444. return
  16445. }
  16446. this[kClosed] = true
  16447. this[kOnClosed].push(callback)
  16448. const onClosed = () => {
  16449. const callbacks = this[kOnClosed]
  16450. this[kOnClosed] = null
  16451. for (let i = 0; i < callbacks.length; i++) {
  16452. callbacks[i](null, null)
  16453. }
  16454. }
  16455. // Should not error.
  16456. this[kClose]()
  16457. .then(() => this.destroy())
  16458. .then(() => {
  16459. queueMicrotask(onClosed)
  16460. })
  16461. }
  16462. destroy (err, callback) {
  16463. if (typeof err === 'function') {
  16464. callback = err
  16465. err = null
  16466. }
  16467. if (callback === undefined) {
  16468. return new Promise((resolve, reject) => {
  16469. this.destroy(err, (err, data) => {
  16470. return err ? /* istanbul ignore next: should never error */ reject(err) : resolve(data)
  16471. })
  16472. })
  16473. }
  16474. if (typeof callback !== 'function') {
  16475. throw new InvalidArgumentError('invalid callback')
  16476. }
  16477. if (this[kDestroyed]) {
  16478. if (this[kOnDestroyed]) {
  16479. this[kOnDestroyed].push(callback)
  16480. } else {
  16481. queueMicrotask(() => callback(null, null))
  16482. }
  16483. return
  16484. }
  16485. if (!err) {
  16486. err = new ClientDestroyedError()
  16487. }
  16488. this[kDestroyed] = true
  16489. this[kOnDestroyed] = this[kOnDestroyed] || []
  16490. this[kOnDestroyed].push(callback)
  16491. const onDestroyed = () => {
  16492. const callbacks = this[kOnDestroyed]
  16493. this[kOnDestroyed] = null
  16494. for (let i = 0; i < callbacks.length; i++) {
  16495. callbacks[i](null, null)
  16496. }
  16497. }
  16498. // Should not error.
  16499. this[kDestroy](err).then(() => {
  16500. queueMicrotask(onDestroyed)
  16501. })
  16502. }
  16503. [kInterceptedDispatch] (opts, handler) {
  16504. if (!this[kInterceptors] || this[kInterceptors].length === 0) {
  16505. this[kInterceptedDispatch] = this[kDispatch]
  16506. return this[kDispatch](opts, handler)
  16507. }
  16508. let dispatch = this[kDispatch].bind(this)
  16509. for (let i = this[kInterceptors].length - 1; i >= 0; i--) {
  16510. dispatch = this[kInterceptors][i](dispatch)
  16511. }
  16512. this[kInterceptedDispatch] = dispatch
  16513. return dispatch(opts, handler)
  16514. }
  16515. dispatch (opts, handler) {
  16516. if (!handler || typeof handler !== 'object') {
  16517. throw new InvalidArgumentError('handler must be an object')
  16518. }
  16519. try {
  16520. if (!opts || typeof opts !== 'object') {
  16521. throw new InvalidArgumentError('opts must be an object.')
  16522. }
  16523. if (this[kDestroyed] || this[kOnDestroyed]) {
  16524. throw new ClientDestroyedError()
  16525. }
  16526. if (this[kClosed]) {
  16527. throw new ClientClosedError()
  16528. }
  16529. return this[kInterceptedDispatch](opts, handler)
  16530. } catch (err) {
  16531. if (typeof handler.onError !== 'function') {
  16532. throw new InvalidArgumentError('invalid onError method')
  16533. }
  16534. handler.onError(err)
  16535. return false
  16536. }
  16537. }
  16538. }
  16539. module.exports = DispatcherBase
  16540. /***/ }),
  16541. /***/ 412:
  16542. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  16543. const EventEmitter = __nccwpck_require__(2361)
  16544. class Dispatcher extends EventEmitter {
  16545. dispatch () {
  16546. throw new Error('not implemented')
  16547. }
  16548. close () {
  16549. throw new Error('not implemented')
  16550. }
  16551. destroy () {
  16552. throw new Error('not implemented')
  16553. }
  16554. }
  16555. module.exports = Dispatcher
  16556. /***/ }),
  16557. /***/ 9990:
  16558. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  16559. const Busboy = __nccwpck_require__(727)
  16560. const util = __nccwpck_require__(3983)
  16561. const {
  16562. ReadableStreamFrom,
  16563. isBlobLike,
  16564. isReadableStreamLike,
  16565. readableStreamClose,
  16566. createDeferredPromise,
  16567. fullyReadBody
  16568. } = __nccwpck_require__(2538)
  16569. const { FormData } = __nccwpck_require__(2015)
  16570. const { kState } = __nccwpck_require__(5861)
  16571. const { webidl } = __nccwpck_require__(1744)
  16572. const { DOMException, structuredClone } = __nccwpck_require__(1037)
  16573. const { Blob, File: NativeFile } = __nccwpck_require__(4300)
  16574. const { kBodyUsed } = __nccwpck_require__(2785)
  16575. const assert = __nccwpck_require__(9491)
  16576. const { isErrored } = __nccwpck_require__(3983)
  16577. const { isUint8Array, isArrayBuffer } = __nccwpck_require__(9830)
  16578. const { File: UndiciFile } = __nccwpck_require__(8511)
  16579. const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(685)
  16580. let random
  16581. try {
  16582. const crypto = __nccwpck_require__(6005)
  16583. random = (max) => crypto.randomInt(0, max)
  16584. } catch {
  16585. random = (max) => Math.floor(Math.random(max))
  16586. }
  16587. let ReadableStream = globalThis.ReadableStream
  16588. /** @type {globalThis['File']} */
  16589. const File = NativeFile ?? UndiciFile
  16590. const textEncoder = new TextEncoder()
  16591. const textDecoder = new TextDecoder()
  16592. // https://fetch.spec.whatwg.org/#concept-bodyinit-extract
  16593. function extractBody (object, keepalive = false) {
  16594. if (!ReadableStream) {
  16595. ReadableStream = (__nccwpck_require__(5356).ReadableStream)
  16596. }
  16597. // 1. Let stream be null.
  16598. let stream = null
  16599. // 2. If object is a ReadableStream object, then set stream to object.
  16600. if (object instanceof ReadableStream) {
  16601. stream = object
  16602. } else if (isBlobLike(object)) {
  16603. // 3. Otherwise, if object is a Blob object, set stream to the
  16604. // result of running object’s get stream.
  16605. stream = object.stream()
  16606. } else {
  16607. // 4. Otherwise, set stream to a new ReadableStream object, and set
  16608. // up stream.
  16609. stream = new ReadableStream({
  16610. async pull (controller) {
  16611. controller.enqueue(
  16612. typeof source === 'string' ? textEncoder.encode(source) : source
  16613. )
  16614. queueMicrotask(() => readableStreamClose(controller))
  16615. },
  16616. start () {},
  16617. type: undefined
  16618. })
  16619. }
  16620. // 5. Assert: stream is a ReadableStream object.
  16621. assert(isReadableStreamLike(stream))
  16622. // 6. Let action be null.
  16623. let action = null
  16624. // 7. Let source be null.
  16625. let source = null
  16626. // 8. Let length be null.
  16627. let length = null
  16628. // 9. Let type be null.
  16629. let type = null
  16630. // 10. Switch on object:
  16631. if (typeof object === 'string') {
  16632. // Set source to the UTF-8 encoding of object.
  16633. // Note: setting source to a Uint8Array here breaks some mocking assumptions.
  16634. source = object
  16635. // Set type to `text/plain;charset=UTF-8`.
  16636. type = 'text/plain;charset=UTF-8'
  16637. } else if (object instanceof URLSearchParams) {
  16638. // URLSearchParams
  16639. // spec says to run application/x-www-form-urlencoded on body.list
  16640. // this is implemented in Node.js as apart of an URLSearchParams instance toString method
  16641. // See: https://github.com/nodejs/node/blob/e46c680bf2b211bbd52cf959ca17ee98c7f657f5/lib/internal/url.js#L490
  16642. // and https://github.com/nodejs/node/blob/e46c680bf2b211bbd52cf959ca17ee98c7f657f5/lib/internal/url.js#L1100
  16643. // Set source to the result of running the application/x-www-form-urlencoded serializer with object’s list.
  16644. source = object.toString()
  16645. // Set type to `application/x-www-form-urlencoded;charset=UTF-8`.
  16646. type = 'application/x-www-form-urlencoded;charset=UTF-8'
  16647. } else if (isArrayBuffer(object)) {
  16648. // BufferSource/ArrayBuffer
  16649. // Set source to a copy of the bytes held by object.
  16650. source = new Uint8Array(object.slice())
  16651. } else if (ArrayBuffer.isView(object)) {
  16652. // BufferSource/ArrayBufferView
  16653. // Set source to a copy of the bytes held by object.
  16654. source = new Uint8Array(object.buffer.slice(object.byteOffset, object.byteOffset + object.byteLength))
  16655. } else if (util.isFormDataLike(object)) {
  16656. const boundary = `----formdata-undici-0${`${random(1e11)}`.padStart(11, '0')}`
  16657. const prefix = `--${boundary}\r\nContent-Disposition: form-data`
  16658. /*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
  16659. const escape = (str) =>
  16660. str.replace(/\n/g, '%0A').replace(/\r/g, '%0D').replace(/"/g, '%22')
  16661. const normalizeLinefeeds = (value) => value.replace(/\r?\n|\r/g, '\r\n')
  16662. // Set action to this step: run the multipart/form-data
  16663. // encoding algorithm, with object’s entry list and UTF-8.
  16664. // - This ensures that the body is immutable and can't be changed afterwords
  16665. // - That the content-length is calculated in advance.
  16666. // - And that all parts are pre-encoded and ready to be sent.
  16667. const blobParts = []
  16668. const rn = new Uint8Array([13, 10]) // '\r\n'
  16669. length = 0
  16670. let hasUnknownSizeValue = false
  16671. for (const [name, value] of object) {
  16672. if (typeof value === 'string') {
  16673. const chunk = textEncoder.encode(prefix +
  16674. `; name="${escape(normalizeLinefeeds(name))}"` +
  16675. `\r\n\r\n${normalizeLinefeeds(value)}\r\n`)
  16676. blobParts.push(chunk)
  16677. length += chunk.byteLength
  16678. } else {
  16679. const chunk = textEncoder.encode(`${prefix}; name="${escape(normalizeLinefeeds(name))}"` +
  16680. (value.name ? `; filename="${escape(value.name)}"` : '') + '\r\n' +
  16681. `Content-Type: ${
  16682. value.type || 'application/octet-stream'
  16683. }\r\n\r\n`)
  16684. blobParts.push(chunk, value, rn)
  16685. if (typeof value.size === 'number') {
  16686. length += chunk.byteLength + value.size + rn.byteLength
  16687. } else {
  16688. hasUnknownSizeValue = true
  16689. }
  16690. }
  16691. }
  16692. const chunk = textEncoder.encode(`--${boundary}--`)
  16693. blobParts.push(chunk)
  16694. length += chunk.byteLength
  16695. if (hasUnknownSizeValue) {
  16696. length = null
  16697. }
  16698. // Set source to object.
  16699. source = object
  16700. action = async function * () {
  16701. for (const part of blobParts) {
  16702. if (part.stream) {
  16703. yield * part.stream()
  16704. } else {
  16705. yield part
  16706. }
  16707. }
  16708. }
  16709. // Set type to `multipart/form-data; boundary=`,
  16710. // followed by the multipart/form-data boundary string generated
  16711. // by the multipart/form-data encoding algorithm.
  16712. type = 'multipart/form-data; boundary=' + boundary
  16713. } else if (isBlobLike(object)) {
  16714. // Blob
  16715. // Set source to object.
  16716. source = object
  16717. // Set length to object’s size.
  16718. length = object.size
  16719. // If object’s type attribute is not the empty byte sequence, set
  16720. // type to its value.
  16721. if (object.type) {
  16722. type = object.type
  16723. }
  16724. } else if (typeof object[Symbol.asyncIterator] === 'function') {
  16725. // If keepalive is true, then throw a TypeError.
  16726. if (keepalive) {
  16727. throw new TypeError('keepalive')
  16728. }
  16729. // If object is disturbed or locked, then throw a TypeError.
  16730. if (util.isDisturbed(object) || object.locked) {
  16731. throw new TypeError(
  16732. 'Response body object should not be disturbed or locked'
  16733. )
  16734. }
  16735. stream =
  16736. object instanceof ReadableStream ? object : ReadableStreamFrom(object)
  16737. }
  16738. // 11. If source is a byte sequence, then set action to a
  16739. // step that returns source and length to source’s length.
  16740. if (typeof source === 'string' || util.isBuffer(source)) {
  16741. length = Buffer.byteLength(source)
  16742. }
  16743. // 12. If action is non-null, then run these steps in in parallel:
  16744. if (action != null) {
  16745. // Run action.
  16746. let iterator
  16747. stream = new ReadableStream({
  16748. async start () {
  16749. iterator = action(object)[Symbol.asyncIterator]()
  16750. },
  16751. async pull (controller) {
  16752. const { value, done } = await iterator.next()
  16753. if (done) {
  16754. // When running action is done, close stream.
  16755. queueMicrotask(() => {
  16756. controller.close()
  16757. })
  16758. } else {
  16759. // Whenever one or more bytes are available and stream is not errored,
  16760. // enqueue a Uint8Array wrapping an ArrayBuffer containing the available
  16761. // bytes into stream.
  16762. if (!isErrored(stream)) {
  16763. controller.enqueue(new Uint8Array(value))
  16764. }
  16765. }
  16766. return controller.desiredSize > 0
  16767. },
  16768. async cancel (reason) {
  16769. await iterator.return()
  16770. },
  16771. type: undefined
  16772. })
  16773. }
  16774. // 13. Let body be a body whose stream is stream, source is source,
  16775. // and length is length.
  16776. const body = { stream, source, length }
  16777. // 14. Return (body, type).
  16778. return [body, type]
  16779. }
  16780. // https://fetch.spec.whatwg.org/#bodyinit-safely-extract
  16781. function safelyExtractBody (object, keepalive = false) {
  16782. if (!ReadableStream) {
  16783. // istanbul ignore next
  16784. ReadableStream = (__nccwpck_require__(5356).ReadableStream)
  16785. }
  16786. // To safely extract a body and a `Content-Type` value from
  16787. // a byte sequence or BodyInit object object, run these steps:
  16788. // 1. If object is a ReadableStream object, then:
  16789. if (object instanceof ReadableStream) {
  16790. // Assert: object is neither disturbed nor locked.
  16791. // istanbul ignore next
  16792. assert(!util.isDisturbed(object), 'The body has already been consumed.')
  16793. // istanbul ignore next
  16794. assert(!object.locked, 'The stream is locked.')
  16795. }
  16796. // 2. Return the results of extracting object.
  16797. return extractBody(object, keepalive)
  16798. }
  16799. function cloneBody (body) {
  16800. // To clone a body body, run these steps:
  16801. // https://fetch.spec.whatwg.org/#concept-body-clone
  16802. // 1. Let « out1, out2 » be the result of teeing body’s stream.
  16803. const [out1, out2] = body.stream.tee()
  16804. const out2Clone = structuredClone(out2, { transfer: [out2] })
  16805. // This, for whatever reasons, unrefs out2Clone which allows
  16806. // the process to exit by itself.
  16807. const [, finalClone] = out2Clone.tee()
  16808. // 2. Set body’s stream to out1.
  16809. body.stream = out1
  16810. // 3. Return a body whose stream is out2 and other members are copied from body.
  16811. return {
  16812. stream: finalClone,
  16813. length: body.length,
  16814. source: body.source
  16815. }
  16816. }
  16817. async function * consumeBody (body) {
  16818. if (body) {
  16819. if (isUint8Array(body)) {
  16820. yield body
  16821. } else {
  16822. const stream = body.stream
  16823. if (util.isDisturbed(stream)) {
  16824. throw new TypeError('The body has already been consumed.')
  16825. }
  16826. if (stream.locked) {
  16827. throw new TypeError('The stream is locked.')
  16828. }
  16829. // Compat.
  16830. stream[kBodyUsed] = true
  16831. yield * stream
  16832. }
  16833. }
  16834. }
  16835. function throwIfAborted (state) {
  16836. if (state.aborted) {
  16837. throw new DOMException('The operation was aborted.', 'AbortError')
  16838. }
  16839. }
  16840. function bodyMixinMethods (instance) {
  16841. const methods = {
  16842. blob () {
  16843. // The blob() method steps are to return the result of
  16844. // running consume body with this and the following step
  16845. // given a byte sequence bytes: return a Blob whose
  16846. // contents are bytes and whose type attribute is this’s
  16847. // MIME type.
  16848. return specConsumeBody(this, (bytes) => {
  16849. let mimeType = bodyMimeType(this)
  16850. if (mimeType === 'failure') {
  16851. mimeType = ''
  16852. } else if (mimeType) {
  16853. mimeType = serializeAMimeType(mimeType)
  16854. }
  16855. // Return a Blob whose contents are bytes and type attribute
  16856. // is mimeType.
  16857. return new Blob([bytes], { type: mimeType })
  16858. }, instance)
  16859. },
  16860. arrayBuffer () {
  16861. // The arrayBuffer() method steps are to return the result
  16862. // of running consume body with this and the following step
  16863. // given a byte sequence bytes: return a new ArrayBuffer
  16864. // whose contents are bytes.
  16865. return specConsumeBody(this, (bytes) => {
  16866. return new Uint8Array(bytes).buffer
  16867. }, instance)
  16868. },
  16869. text () {
  16870. // The text() method steps are to return the result of running
  16871. // consume body with this and UTF-8 decode.
  16872. return specConsumeBody(this, utf8DecodeBytes, instance)
  16873. },
  16874. json () {
  16875. // The json() method steps are to return the result of running
  16876. // consume body with this and parse JSON from bytes.
  16877. return specConsumeBody(this, parseJSONFromBytes, instance)
  16878. },
  16879. async formData () {
  16880. webidl.brandCheck(this, instance)
  16881. throwIfAborted(this[kState])
  16882. const contentType = this.headers.get('Content-Type')
  16883. // If mimeType’s essence is "multipart/form-data", then:
  16884. if (/multipart\/form-data/.test(contentType)) {
  16885. const headers = {}
  16886. for (const [key, value] of this.headers) headers[key.toLowerCase()] = value
  16887. const responseFormData = new FormData()
  16888. let busboy
  16889. try {
  16890. busboy = new Busboy({
  16891. headers,
  16892. preservePath: true
  16893. })
  16894. } catch (err) {
  16895. throw new DOMException(`${err}`, 'AbortError')
  16896. }
  16897. busboy.on('field', (name, value) => {
  16898. responseFormData.append(name, value)
  16899. })
  16900. busboy.on('file', (name, value, filename, encoding, mimeType) => {
  16901. const chunks = []
  16902. if (encoding === 'base64' || encoding.toLowerCase() === 'base64') {
  16903. let base64chunk = ''
  16904. value.on('data', (chunk) => {
  16905. base64chunk += chunk.toString().replace(/[\r\n]/gm, '')
  16906. const end = base64chunk.length - base64chunk.length % 4
  16907. chunks.push(Buffer.from(base64chunk.slice(0, end), 'base64'))
  16908. base64chunk = base64chunk.slice(end)
  16909. })
  16910. value.on('end', () => {
  16911. chunks.push(Buffer.from(base64chunk, 'base64'))
  16912. responseFormData.append(name, new File(chunks, filename, { type: mimeType }))
  16913. })
  16914. } else {
  16915. value.on('data', (chunk) => {
  16916. chunks.push(chunk)
  16917. })
  16918. value.on('end', () => {
  16919. responseFormData.append(name, new File(chunks, filename, { type: mimeType }))
  16920. })
  16921. }
  16922. })
  16923. const busboyResolve = new Promise((resolve, reject) => {
  16924. busboy.on('finish', resolve)
  16925. busboy.on('error', (err) => reject(new TypeError(err)))
  16926. })
  16927. if (this.body !== null) for await (const chunk of consumeBody(this[kState].body)) busboy.write(chunk)
  16928. busboy.end()
  16929. await busboyResolve
  16930. return responseFormData
  16931. } else if (/application\/x-www-form-urlencoded/.test(contentType)) {
  16932. // Otherwise, if mimeType’s essence is "application/x-www-form-urlencoded", then:
  16933. // 1. Let entries be the result of parsing bytes.
  16934. let entries
  16935. try {
  16936. let text = ''
  16937. // application/x-www-form-urlencoded parser will keep the BOM.
  16938. // https://url.spec.whatwg.org/#concept-urlencoded-parser
  16939. // Note that streaming decoder is stateful and cannot be reused
  16940. const streamingDecoder = new TextDecoder('utf-8', { ignoreBOM: true })
  16941. for await (const chunk of consumeBody(this[kState].body)) {
  16942. if (!isUint8Array(chunk)) {
  16943. throw new TypeError('Expected Uint8Array chunk')
  16944. }
  16945. text += streamingDecoder.decode(chunk, { stream: true })
  16946. }
  16947. text += streamingDecoder.decode()
  16948. entries = new URLSearchParams(text)
  16949. } catch (err) {
  16950. // istanbul ignore next: Unclear when new URLSearchParams can fail on a string.
  16951. // 2. If entries is failure, then throw a TypeError.
  16952. throw Object.assign(new TypeError(), { cause: err })
  16953. }
  16954. // 3. Return a new FormData object whose entries are entries.
  16955. const formData = new FormData()
  16956. for (const [name, value] of entries) {
  16957. formData.append(name, value)
  16958. }
  16959. return formData
  16960. } else {
  16961. // Wait a tick before checking if the request has been aborted.
  16962. // Otherwise, a TypeError can be thrown when an AbortError should.
  16963. await Promise.resolve()
  16964. throwIfAborted(this[kState])
  16965. // Otherwise, throw a TypeError.
  16966. throw webidl.errors.exception({
  16967. header: `${instance.name}.formData`,
  16968. message: 'Could not parse content as FormData.'
  16969. })
  16970. }
  16971. }
  16972. }
  16973. return methods
  16974. }
  16975. function mixinBody (prototype) {
  16976. Object.assign(prototype.prototype, bodyMixinMethods(prototype))
  16977. }
  16978. /**
  16979. * @see https://fetch.spec.whatwg.org/#concept-body-consume-body
  16980. * @param {Response|Request} object
  16981. * @param {(value: unknown) => unknown} convertBytesToJSValue
  16982. * @param {Response|Request} instance
  16983. */
  16984. async function specConsumeBody (object, convertBytesToJSValue, instance) {
  16985. webidl.brandCheck(object, instance)
  16986. throwIfAborted(object[kState])
  16987. // 1. If object is unusable, then return a promise rejected
  16988. // with a TypeError.
  16989. if (bodyUnusable(object[kState].body)) {
  16990. throw new TypeError('Body is unusable')
  16991. }
  16992. // 2. Let promise be a new promise.
  16993. const promise = createDeferredPromise()
  16994. // 3. Let errorSteps given error be to reject promise with error.
  16995. const errorSteps = (error) => promise.reject(error)
  16996. // 4. Let successSteps given a byte sequence data be to resolve
  16997. // promise with the result of running convertBytesToJSValue
  16998. // with data. If that threw an exception, then run errorSteps
  16999. // with that exception.
  17000. const successSteps = (data) => {
  17001. try {
  17002. promise.resolve(convertBytesToJSValue(data))
  17003. } catch (e) {
  17004. errorSteps(e)
  17005. }
  17006. }
  17007. // 5. If object’s body is null, then run successSteps with an
  17008. // empty byte sequence.
  17009. if (object[kState].body == null) {
  17010. successSteps(new Uint8Array())
  17011. return promise.promise
  17012. }
  17013. // 6. Otherwise, fully read object’s body given successSteps,
  17014. // errorSteps, and object’s relevant global object.
  17015. await fullyReadBody(object[kState].body, successSteps, errorSteps)
  17016. // 7. Return promise.
  17017. return promise.promise
  17018. }
  17019. // https://fetch.spec.whatwg.org/#body-unusable
  17020. function bodyUnusable (body) {
  17021. // An object including the Body interface mixin is
  17022. // said to be unusable if its body is non-null and
  17023. // its body’s stream is disturbed or locked.
  17024. return body != null && (body.stream.locked || util.isDisturbed(body.stream))
  17025. }
  17026. /**
  17027. * @see https://encoding.spec.whatwg.org/#utf-8-decode
  17028. * @param {Buffer} buffer
  17029. */
  17030. function utf8DecodeBytes (buffer) {
  17031. if (buffer.length === 0) {
  17032. return ''
  17033. }
  17034. // 1. Let buffer be the result of peeking three bytes from
  17035. // ioQueue, converted to a byte sequence.
  17036. // 2. If buffer is 0xEF 0xBB 0xBF, then read three
  17037. // bytes from ioQueue. (Do nothing with those bytes.)
  17038. if (buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) {
  17039. buffer = buffer.subarray(3)
  17040. }
  17041. // 3. Process a queue with an instance of UTF-8’s
  17042. // decoder, ioQueue, output, and "replacement".
  17043. const output = textDecoder.decode(buffer)
  17044. // 4. Return output.
  17045. return output
  17046. }
  17047. /**
  17048. * @see https://infra.spec.whatwg.org/#parse-json-bytes-to-a-javascript-value
  17049. * @param {Uint8Array} bytes
  17050. */
  17051. function parseJSONFromBytes (bytes) {
  17052. return JSON.parse(utf8DecodeBytes(bytes))
  17053. }
  17054. /**
  17055. * @see https://fetch.spec.whatwg.org/#concept-body-mime-type
  17056. * @param {import('./response').Response|import('./request').Request} object
  17057. */
  17058. function bodyMimeType (object) {
  17059. const { headersList } = object[kState]
  17060. const contentType = headersList.get('content-type')
  17061. if (contentType === null) {
  17062. return 'failure'
  17063. }
  17064. return parseMIMEType(contentType)
  17065. }
  17066. module.exports = {
  17067. extractBody,
  17068. safelyExtractBody,
  17069. cloneBody,
  17070. mixinBody
  17071. }
  17072. /***/ }),
  17073. /***/ 1037:
  17074. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  17075. const { MessageChannel, receiveMessageOnPort } = __nccwpck_require__(1267)
  17076. const corsSafeListedMethods = ['GET', 'HEAD', 'POST']
  17077. const corsSafeListedMethodsSet = new Set(corsSafeListedMethods)
  17078. const nullBodyStatus = [101, 204, 205, 304]
  17079. const redirectStatus = [301, 302, 303, 307, 308]
  17080. const redirectStatusSet = new Set(redirectStatus)
  17081. // https://fetch.spec.whatwg.org/#block-bad-port
  17082. const badPorts = [
  17083. '1', '7', '9', '11', '13', '15', '17', '19', '20', '21', '22', '23', '25', '37', '42', '43', '53', '69', '77', '79',
  17084. '87', '95', '101', '102', '103', '104', '109', '110', '111', '113', '115', '117', '119', '123', '135', '137',
  17085. '139', '143', '161', '179', '389', '427', '465', '512', '513', '514', '515', '526', '530', '531', '532',
  17086. '540', '548', '554', '556', '563', '587', '601', '636', '989', '990', '993', '995', '1719', '1720', '1723',
  17087. '2049', '3659', '4045', '5060', '5061', '6000', '6566', '6665', '6666', '6667', '6668', '6669', '6697',
  17088. '10080'
  17089. ]
  17090. const badPortsSet = new Set(badPorts)
  17091. // https://w3c.github.io/webappsec-referrer-policy/#referrer-policies
  17092. const referrerPolicy = [
  17093. '',
  17094. 'no-referrer',
  17095. 'no-referrer-when-downgrade',
  17096. 'same-origin',
  17097. 'origin',
  17098. 'strict-origin',
  17099. 'origin-when-cross-origin',
  17100. 'strict-origin-when-cross-origin',
  17101. 'unsafe-url'
  17102. ]
  17103. const referrerPolicySet = new Set(referrerPolicy)
  17104. const requestRedirect = ['follow', 'manual', 'error']
  17105. const safeMethods = ['GET', 'HEAD', 'OPTIONS', 'TRACE']
  17106. const safeMethodsSet = new Set(safeMethods)
  17107. const requestMode = ['navigate', 'same-origin', 'no-cors', 'cors']
  17108. const requestCredentials = ['omit', 'same-origin', 'include']
  17109. const requestCache = [
  17110. 'default',
  17111. 'no-store',
  17112. 'reload',
  17113. 'no-cache',
  17114. 'force-cache',
  17115. 'only-if-cached'
  17116. ]
  17117. // https://fetch.spec.whatwg.org/#request-body-header-name
  17118. const requestBodyHeader = [
  17119. 'content-encoding',
  17120. 'content-language',
  17121. 'content-location',
  17122. 'content-type',
  17123. // See https://github.com/nodejs/undici/issues/2021
  17124. // 'Content-Length' is a forbidden header name, which is typically
  17125. // removed in the Headers implementation. However, undici doesn't
  17126. // filter out headers, so we add it here.
  17127. 'content-length'
  17128. ]
  17129. // https://fetch.spec.whatwg.org/#enumdef-requestduplex
  17130. const requestDuplex = [
  17131. 'half'
  17132. ]
  17133. // http://fetch.spec.whatwg.org/#forbidden-method
  17134. const forbiddenMethods = ['CONNECT', 'TRACE', 'TRACK']
  17135. const forbiddenMethodsSet = new Set(forbiddenMethods)
  17136. const subresource = [
  17137. 'audio',
  17138. 'audioworklet',
  17139. 'font',
  17140. 'image',
  17141. 'manifest',
  17142. 'paintworklet',
  17143. 'script',
  17144. 'style',
  17145. 'track',
  17146. 'video',
  17147. 'xslt',
  17148. ''
  17149. ]
  17150. const subresourceSet = new Set(subresource)
  17151. /** @type {globalThis['DOMException']} */
  17152. const DOMException = globalThis.DOMException ?? (() => {
  17153. // DOMException was only made a global in Node v17.0.0,
  17154. // but fetch supports >= v16.8.
  17155. try {
  17156. atob('~')
  17157. } catch (err) {
  17158. return Object.getPrototypeOf(err).constructor
  17159. }
  17160. })()
  17161. let channel
  17162. /** @type {globalThis['structuredClone']} */
  17163. const structuredClone =
  17164. globalThis.structuredClone ??
  17165. // https://github.com/nodejs/node/blob/b27ae24dcc4251bad726d9d84baf678d1f707fed/lib/internal/structured_clone.js
  17166. // structuredClone was added in v17.0.0, but fetch supports v16.8
  17167. function structuredClone (value, options = undefined) {
  17168. if (arguments.length === 0) {
  17169. throw new TypeError('missing argument')
  17170. }
  17171. if (!channel) {
  17172. channel = new MessageChannel()
  17173. }
  17174. channel.port1.unref()
  17175. channel.port2.unref()
  17176. channel.port1.postMessage(value, options?.transfer)
  17177. return receiveMessageOnPort(channel.port2).message
  17178. }
  17179. module.exports = {
  17180. DOMException,
  17181. structuredClone,
  17182. subresource,
  17183. forbiddenMethods,
  17184. requestBodyHeader,
  17185. referrerPolicy,
  17186. requestRedirect,
  17187. requestMode,
  17188. requestCredentials,
  17189. requestCache,
  17190. redirectStatus,
  17191. corsSafeListedMethods,
  17192. nullBodyStatus,
  17193. safeMethods,
  17194. badPorts,
  17195. requestDuplex,
  17196. subresourceSet,
  17197. badPortsSet,
  17198. redirectStatusSet,
  17199. corsSafeListedMethodsSet,
  17200. safeMethodsSet,
  17201. forbiddenMethodsSet,
  17202. referrerPolicySet
  17203. }
  17204. /***/ }),
  17205. /***/ 685:
  17206. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  17207. const assert = __nccwpck_require__(9491)
  17208. const { atob } = __nccwpck_require__(4300)
  17209. const { isomorphicDecode } = __nccwpck_require__(2538)
  17210. const encoder = new TextEncoder()
  17211. /**
  17212. * @see https://mimesniff.spec.whatwg.org/#http-token-code-point
  17213. */
  17214. const HTTP_TOKEN_CODEPOINTS = /^[!#$%&'*+-.^_|~A-Za-z0-9]+$/
  17215. const HTTP_WHITESPACE_REGEX = /(\u000A|\u000D|\u0009|\u0020)/ // eslint-disable-line
  17216. /**
  17217. * @see https://mimesniff.spec.whatwg.org/#http-quoted-string-token-code-point
  17218. */
  17219. const HTTP_QUOTED_STRING_TOKENS = /[\u0009|\u0020-\u007E|\u0080-\u00FF]/ // eslint-disable-line
  17220. // https://fetch.spec.whatwg.org/#data-url-processor
  17221. /** @param {URL} dataURL */
  17222. function dataURLProcessor (dataURL) {
  17223. // 1. Assert: dataURL’s scheme is "data".
  17224. assert(dataURL.protocol === 'data:')
  17225. // 2. Let input be the result of running the URL
  17226. // serializer on dataURL with exclude fragment
  17227. // set to true.
  17228. let input = URLSerializer(dataURL, true)
  17229. // 3. Remove the leading "data:" string from input.
  17230. input = input.slice(5)
  17231. // 4. Let position point at the start of input.
  17232. const position = { position: 0 }
  17233. // 5. Let mimeType be the result of collecting a
  17234. // sequence of code points that are not equal
  17235. // to U+002C (,), given position.
  17236. let mimeType = collectASequenceOfCodePointsFast(
  17237. ',',
  17238. input,
  17239. position
  17240. )
  17241. // 6. Strip leading and trailing ASCII whitespace
  17242. // from mimeType.
  17243. // Undici implementation note: we need to store the
  17244. // length because if the mimetype has spaces removed,
  17245. // the wrong amount will be sliced from the input in
  17246. // step #9
  17247. const mimeTypeLength = mimeType.length
  17248. mimeType = removeASCIIWhitespace(mimeType, true, true)
  17249. // 7. If position is past the end of input, then
  17250. // return failure
  17251. if (position.position >= input.length) {
  17252. return 'failure'
  17253. }
  17254. // 8. Advance position by 1.
  17255. position.position++
  17256. // 9. Let encodedBody be the remainder of input.
  17257. const encodedBody = input.slice(mimeTypeLength + 1)
  17258. // 10. Let body be the percent-decoding of encodedBody.
  17259. let body = stringPercentDecode(encodedBody)
  17260. // 11. If mimeType ends with U+003B (;), followed by
  17261. // zero or more U+0020 SPACE, followed by an ASCII
  17262. // case-insensitive match for "base64", then:
  17263. if (/;(\u0020){0,}base64$/i.test(mimeType)) {
  17264. // 1. Let stringBody be the isomorphic decode of body.
  17265. const stringBody = isomorphicDecode(body)
  17266. // 2. Set body to the forgiving-base64 decode of
  17267. // stringBody.
  17268. body = forgivingBase64(stringBody)
  17269. // 3. If body is failure, then return failure.
  17270. if (body === 'failure') {
  17271. return 'failure'
  17272. }
  17273. // 4. Remove the last 6 code points from mimeType.
  17274. mimeType = mimeType.slice(0, -6)
  17275. // 5. Remove trailing U+0020 SPACE code points from mimeType,
  17276. // if any.
  17277. mimeType = mimeType.replace(/(\u0020)+$/, '')
  17278. // 6. Remove the last U+003B (;) code point from mimeType.
  17279. mimeType = mimeType.slice(0, -1)
  17280. }
  17281. // 12. If mimeType starts with U+003B (;), then prepend
  17282. // "text/plain" to mimeType.
  17283. if (mimeType.startsWith(';')) {
  17284. mimeType = 'text/plain' + mimeType
  17285. }
  17286. // 13. Let mimeTypeRecord be the result of parsing
  17287. // mimeType.
  17288. let mimeTypeRecord = parseMIMEType(mimeType)
  17289. // 14. If mimeTypeRecord is failure, then set
  17290. // mimeTypeRecord to text/plain;charset=US-ASCII.
  17291. if (mimeTypeRecord === 'failure') {
  17292. mimeTypeRecord = parseMIMEType('text/plain;charset=US-ASCII')
  17293. }
  17294. // 15. Return a new data: URL struct whose MIME
  17295. // type is mimeTypeRecord and body is body.
  17296. // https://fetch.spec.whatwg.org/#data-url-struct
  17297. return { mimeType: mimeTypeRecord, body }
  17298. }
  17299. // https://url.spec.whatwg.org/#concept-url-serializer
  17300. /**
  17301. * @param {URL} url
  17302. * @param {boolean} excludeFragment
  17303. */
  17304. function URLSerializer (url, excludeFragment = false) {
  17305. if (!excludeFragment) {
  17306. return url.href
  17307. }
  17308. const href = url.href
  17309. const hashLength = url.hash.length
  17310. return hashLength === 0 ? href : href.substring(0, href.length - hashLength)
  17311. }
  17312. // https://infra.spec.whatwg.org/#collect-a-sequence-of-code-points
  17313. /**
  17314. * @param {(char: string) => boolean} condition
  17315. * @param {string} input
  17316. * @param {{ position: number }} position
  17317. */
  17318. function collectASequenceOfCodePoints (condition, input, position) {
  17319. // 1. Let result be the empty string.
  17320. let result = ''
  17321. // 2. While position doesn’t point past the end of input and the
  17322. // code point at position within input meets the condition condition:
  17323. while (position.position < input.length && condition(input[position.position])) {
  17324. // 1. Append that code point to the end of result.
  17325. result += input[position.position]
  17326. // 2. Advance position by 1.
  17327. position.position++
  17328. }
  17329. // 3. Return result.
  17330. return result
  17331. }
  17332. /**
  17333. * A faster collectASequenceOfCodePoints that only works when comparing a single character.
  17334. * @param {string} char
  17335. * @param {string} input
  17336. * @param {{ position: number }} position
  17337. */
  17338. function collectASequenceOfCodePointsFast (char, input, position) {
  17339. const idx = input.indexOf(char, position.position)
  17340. const start = position.position
  17341. if (idx === -1) {
  17342. position.position = input.length
  17343. return input.slice(start)
  17344. }
  17345. position.position = idx
  17346. return input.slice(start, position.position)
  17347. }
  17348. // https://url.spec.whatwg.org/#string-percent-decode
  17349. /** @param {string} input */
  17350. function stringPercentDecode (input) {
  17351. // 1. Let bytes be the UTF-8 encoding of input.
  17352. const bytes = encoder.encode(input)
  17353. // 2. Return the percent-decoding of bytes.
  17354. return percentDecode(bytes)
  17355. }
  17356. // https://url.spec.whatwg.org/#percent-decode
  17357. /** @param {Uint8Array} input */
  17358. function percentDecode (input) {
  17359. // 1. Let output be an empty byte sequence.
  17360. /** @type {number[]} */
  17361. const output = []
  17362. // 2. For each byte byte in input:
  17363. for (let i = 0; i < input.length; i++) {
  17364. const byte = input[i]
  17365. // 1. If byte is not 0x25 (%), then append byte to output.
  17366. if (byte !== 0x25) {
  17367. output.push(byte)
  17368. // 2. Otherwise, if byte is 0x25 (%) and the next two bytes
  17369. // after byte in input are not in the ranges
  17370. // 0x30 (0) to 0x39 (9), 0x41 (A) to 0x46 (F),
  17371. // and 0x61 (a) to 0x66 (f), all inclusive, append byte
  17372. // to output.
  17373. } else if (
  17374. byte === 0x25 &&
  17375. !/^[0-9A-Fa-f]{2}$/i.test(String.fromCharCode(input[i + 1], input[i + 2]))
  17376. ) {
  17377. output.push(0x25)
  17378. // 3. Otherwise:
  17379. } else {
  17380. // 1. Let bytePoint be the two bytes after byte in input,
  17381. // decoded, and then interpreted as hexadecimal number.
  17382. const nextTwoBytes = String.fromCharCode(input[i + 1], input[i + 2])
  17383. const bytePoint = Number.parseInt(nextTwoBytes, 16)
  17384. // 2. Append a byte whose value is bytePoint to output.
  17385. output.push(bytePoint)
  17386. // 3. Skip the next two bytes in input.
  17387. i += 2
  17388. }
  17389. }
  17390. // 3. Return output.
  17391. return Uint8Array.from(output)
  17392. }
  17393. // https://mimesniff.spec.whatwg.org/#parse-a-mime-type
  17394. /** @param {string} input */
  17395. function parseMIMEType (input) {
  17396. // 1. Remove any leading and trailing HTTP whitespace
  17397. // from input.
  17398. input = removeHTTPWhitespace(input, true, true)
  17399. // 2. Let position be a position variable for input,
  17400. // initially pointing at the start of input.
  17401. const position = { position: 0 }
  17402. // 3. Let type be the result of collecting a sequence
  17403. // of code points that are not U+002F (/) from
  17404. // input, given position.
  17405. const type = collectASequenceOfCodePointsFast(
  17406. '/',
  17407. input,
  17408. position
  17409. )
  17410. // 4. If type is the empty string or does not solely
  17411. // contain HTTP token code points, then return failure.
  17412. // https://mimesniff.spec.whatwg.org/#http-token-code-point
  17413. if (type.length === 0 || !HTTP_TOKEN_CODEPOINTS.test(type)) {
  17414. return 'failure'
  17415. }
  17416. // 5. If position is past the end of input, then return
  17417. // failure
  17418. if (position.position > input.length) {
  17419. return 'failure'
  17420. }
  17421. // 6. Advance position by 1. (This skips past U+002F (/).)
  17422. position.position++
  17423. // 7. Let subtype be the result of collecting a sequence of
  17424. // code points that are not U+003B (;) from input, given
  17425. // position.
  17426. let subtype = collectASequenceOfCodePointsFast(
  17427. ';',
  17428. input,
  17429. position
  17430. )
  17431. // 8. Remove any trailing HTTP whitespace from subtype.
  17432. subtype = removeHTTPWhitespace(subtype, false, true)
  17433. // 9. If subtype is the empty string or does not solely
  17434. // contain HTTP token code points, then return failure.
  17435. if (subtype.length === 0 || !HTTP_TOKEN_CODEPOINTS.test(subtype)) {
  17436. return 'failure'
  17437. }
  17438. const typeLowercase = type.toLowerCase()
  17439. const subtypeLowercase = subtype.toLowerCase()
  17440. // 10. Let mimeType be a new MIME type record whose type
  17441. // is type, in ASCII lowercase, and subtype is subtype,
  17442. // in ASCII lowercase.
  17443. // https://mimesniff.spec.whatwg.org/#mime-type
  17444. const mimeType = {
  17445. type: typeLowercase,
  17446. subtype: subtypeLowercase,
  17447. /** @type {Map<string, string>} */
  17448. parameters: new Map(),
  17449. // https://mimesniff.spec.whatwg.org/#mime-type-essence
  17450. essence: `${typeLowercase}/${subtypeLowercase}`
  17451. }
  17452. // 11. While position is not past the end of input:
  17453. while (position.position < input.length) {
  17454. // 1. Advance position by 1. (This skips past U+003B (;).)
  17455. position.position++
  17456. // 2. Collect a sequence of code points that are HTTP
  17457. // whitespace from input given position.
  17458. collectASequenceOfCodePoints(
  17459. // https://fetch.spec.whatwg.org/#http-whitespace
  17460. char => HTTP_WHITESPACE_REGEX.test(char),
  17461. input,
  17462. position
  17463. )
  17464. // 3. Let parameterName be the result of collecting a
  17465. // sequence of code points that are not U+003B (;)
  17466. // or U+003D (=) from input, given position.
  17467. let parameterName = collectASequenceOfCodePoints(
  17468. (char) => char !== ';' && char !== '=',
  17469. input,
  17470. position
  17471. )
  17472. // 4. Set parameterName to parameterName, in ASCII
  17473. // lowercase.
  17474. parameterName = parameterName.toLowerCase()
  17475. // 5. If position is not past the end of input, then:
  17476. if (position.position < input.length) {
  17477. // 1. If the code point at position within input is
  17478. // U+003B (;), then continue.
  17479. if (input[position.position] === ';') {
  17480. continue
  17481. }
  17482. // 2. Advance position by 1. (This skips past U+003D (=).)
  17483. position.position++
  17484. }
  17485. // 6. If position is past the end of input, then break.
  17486. if (position.position > input.length) {
  17487. break
  17488. }
  17489. // 7. Let parameterValue be null.
  17490. let parameterValue = null
  17491. // 8. If the code point at position within input is
  17492. // U+0022 ("), then:
  17493. if (input[position.position] === '"') {
  17494. // 1. Set parameterValue to the result of collecting
  17495. // an HTTP quoted string from input, given position
  17496. // and the extract-value flag.
  17497. parameterValue = collectAnHTTPQuotedString(input, position, true)
  17498. // 2. Collect a sequence of code points that are not
  17499. // U+003B (;) from input, given position.
  17500. collectASequenceOfCodePointsFast(
  17501. ';',
  17502. input,
  17503. position
  17504. )
  17505. // 9. Otherwise:
  17506. } else {
  17507. // 1. Set parameterValue to the result of collecting
  17508. // a sequence of code points that are not U+003B (;)
  17509. // from input, given position.
  17510. parameterValue = collectASequenceOfCodePointsFast(
  17511. ';',
  17512. input,
  17513. position
  17514. )
  17515. // 2. Remove any trailing HTTP whitespace from parameterValue.
  17516. parameterValue = removeHTTPWhitespace(parameterValue, false, true)
  17517. // 3. If parameterValue is the empty string, then continue.
  17518. if (parameterValue.length === 0) {
  17519. continue
  17520. }
  17521. }
  17522. // 10. If all of the following are true
  17523. // - parameterName is not the empty string
  17524. // - parameterName solely contains HTTP token code points
  17525. // - parameterValue solely contains HTTP quoted-string token code points
  17526. // - mimeType’s parameters[parameterName] does not exist
  17527. // then set mimeType’s parameters[parameterName] to parameterValue.
  17528. if (
  17529. parameterName.length !== 0 &&
  17530. HTTP_TOKEN_CODEPOINTS.test(parameterName) &&
  17531. (parameterValue.length === 0 || HTTP_QUOTED_STRING_TOKENS.test(parameterValue)) &&
  17532. !mimeType.parameters.has(parameterName)
  17533. ) {
  17534. mimeType.parameters.set(parameterName, parameterValue)
  17535. }
  17536. }
  17537. // 12. Return mimeType.
  17538. return mimeType
  17539. }
  17540. // https://infra.spec.whatwg.org/#forgiving-base64-decode
  17541. /** @param {string} data */
  17542. function forgivingBase64 (data) {
  17543. // 1. Remove all ASCII whitespace from data.
  17544. data = data.replace(/[\u0009\u000A\u000C\u000D\u0020]/g, '') // eslint-disable-line
  17545. // 2. If data’s code point length divides by 4 leaving
  17546. // no remainder, then:
  17547. if (data.length % 4 === 0) {
  17548. // 1. If data ends with one or two U+003D (=) code points,
  17549. // then remove them from data.
  17550. data = data.replace(/=?=$/, '')
  17551. }
  17552. // 3. If data’s code point length divides by 4 leaving
  17553. // a remainder of 1, then return failure.
  17554. if (data.length % 4 === 1) {
  17555. return 'failure'
  17556. }
  17557. // 4. If data contains a code point that is not one of
  17558. // U+002B (+)
  17559. // U+002F (/)
  17560. // ASCII alphanumeric
  17561. // then return failure.
  17562. if (/[^+/0-9A-Za-z]/.test(data)) {
  17563. return 'failure'
  17564. }
  17565. const binary = atob(data)
  17566. const bytes = new Uint8Array(binary.length)
  17567. for (let byte = 0; byte < binary.length; byte++) {
  17568. bytes[byte] = binary.charCodeAt(byte)
  17569. }
  17570. return bytes
  17571. }
  17572. // https://fetch.spec.whatwg.org/#collect-an-http-quoted-string
  17573. // tests: https://fetch.spec.whatwg.org/#example-http-quoted-string
  17574. /**
  17575. * @param {string} input
  17576. * @param {{ position: number }} position
  17577. * @param {boolean?} extractValue
  17578. */
  17579. function collectAnHTTPQuotedString (input, position, extractValue) {
  17580. // 1. Let positionStart be position.
  17581. const positionStart = position.position
  17582. // 2. Let value be the empty string.
  17583. let value = ''
  17584. // 3. Assert: the code point at position within input
  17585. // is U+0022 (").
  17586. assert(input[position.position] === '"')
  17587. // 4. Advance position by 1.
  17588. position.position++
  17589. // 5. While true:
  17590. while (true) {
  17591. // 1. Append the result of collecting a sequence of code points
  17592. // that are not U+0022 (") or U+005C (\) from input, given
  17593. // position, to value.
  17594. value += collectASequenceOfCodePoints(
  17595. (char) => char !== '"' && char !== '\\',
  17596. input,
  17597. position
  17598. )
  17599. // 2. If position is past the end of input, then break.
  17600. if (position.position >= input.length) {
  17601. break
  17602. }
  17603. // 3. Let quoteOrBackslash be the code point at position within
  17604. // input.
  17605. const quoteOrBackslash = input[position.position]
  17606. // 4. Advance position by 1.
  17607. position.position++
  17608. // 5. If quoteOrBackslash is U+005C (\), then:
  17609. if (quoteOrBackslash === '\\') {
  17610. // 1. If position is past the end of input, then append
  17611. // U+005C (\) to value and break.
  17612. if (position.position >= input.length) {
  17613. value += '\\'
  17614. break
  17615. }
  17616. // 2. Append the code point at position within input to value.
  17617. value += input[position.position]
  17618. // 3. Advance position by 1.
  17619. position.position++
  17620. // 6. Otherwise:
  17621. } else {
  17622. // 1. Assert: quoteOrBackslash is U+0022 (").
  17623. assert(quoteOrBackslash === '"')
  17624. // 2. Break.
  17625. break
  17626. }
  17627. }
  17628. // 6. If the extract-value flag is set, then return value.
  17629. if (extractValue) {
  17630. return value
  17631. }
  17632. // 7. Return the code points from positionStart to position,
  17633. // inclusive, within input.
  17634. return input.slice(positionStart, position.position)
  17635. }
  17636. /**
  17637. * @see https://mimesniff.spec.whatwg.org/#serialize-a-mime-type
  17638. */
  17639. function serializeAMimeType (mimeType) {
  17640. assert(mimeType !== 'failure')
  17641. const { parameters, essence } = mimeType
  17642. // 1. Let serialization be the concatenation of mimeType’s
  17643. // type, U+002F (/), and mimeType’s subtype.
  17644. let serialization = essence
  17645. // 2. For each name → value of mimeType’s parameters:
  17646. for (let [name, value] of parameters.entries()) {
  17647. // 1. Append U+003B (;) to serialization.
  17648. serialization += ';'
  17649. // 2. Append name to serialization.
  17650. serialization += name
  17651. // 3. Append U+003D (=) to serialization.
  17652. serialization += '='
  17653. // 4. If value does not solely contain HTTP token code
  17654. // points or value is the empty string, then:
  17655. if (!HTTP_TOKEN_CODEPOINTS.test(value)) {
  17656. // 1. Precede each occurence of U+0022 (") or
  17657. // U+005C (\) in value with U+005C (\).
  17658. value = value.replace(/(\\|")/g, '\\$1')
  17659. // 2. Prepend U+0022 (") to value.
  17660. value = '"' + value
  17661. // 3. Append U+0022 (") to value.
  17662. value += '"'
  17663. }
  17664. // 5. Append value to serialization.
  17665. serialization += value
  17666. }
  17667. // 3. Return serialization.
  17668. return serialization
  17669. }
  17670. /**
  17671. * @see https://fetch.spec.whatwg.org/#http-whitespace
  17672. * @param {string} char
  17673. */
  17674. function isHTTPWhiteSpace (char) {
  17675. return char === '\r' || char === '\n' || char === '\t' || char === ' '
  17676. }
  17677. /**
  17678. * @see https://fetch.spec.whatwg.org/#http-whitespace
  17679. * @param {string} str
  17680. */
  17681. function removeHTTPWhitespace (str, leading = true, trailing = true) {
  17682. let lead = 0
  17683. let trail = str.length - 1
  17684. if (leading) {
  17685. for (; lead < str.length && isHTTPWhiteSpace(str[lead]); lead++);
  17686. }
  17687. if (trailing) {
  17688. for (; trail > 0 && isHTTPWhiteSpace(str[trail]); trail--);
  17689. }
  17690. return str.slice(lead, trail + 1)
  17691. }
  17692. /**
  17693. * @see https://infra.spec.whatwg.org/#ascii-whitespace
  17694. * @param {string} char
  17695. */
  17696. function isASCIIWhitespace (char) {
  17697. return char === '\r' || char === '\n' || char === '\t' || char === '\f' || char === ' '
  17698. }
  17699. /**
  17700. * @see https://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace
  17701. */
  17702. function removeASCIIWhitespace (str, leading = true, trailing = true) {
  17703. let lead = 0
  17704. let trail = str.length - 1
  17705. if (leading) {
  17706. for (; lead < str.length && isASCIIWhitespace(str[lead]); lead++);
  17707. }
  17708. if (trailing) {
  17709. for (; trail > 0 && isASCIIWhitespace(str[trail]); trail--);
  17710. }
  17711. return str.slice(lead, trail + 1)
  17712. }
  17713. module.exports = {
  17714. dataURLProcessor,
  17715. URLSerializer,
  17716. collectASequenceOfCodePoints,
  17717. collectASequenceOfCodePointsFast,
  17718. stringPercentDecode,
  17719. parseMIMEType,
  17720. collectAnHTTPQuotedString,
  17721. serializeAMimeType
  17722. }
  17723. /***/ }),
  17724. /***/ 8511:
  17725. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  17726. const { Blob, File: NativeFile } = __nccwpck_require__(4300)
  17727. const { types } = __nccwpck_require__(3837)
  17728. const { kState } = __nccwpck_require__(5861)
  17729. const { isBlobLike } = __nccwpck_require__(2538)
  17730. const { webidl } = __nccwpck_require__(1744)
  17731. const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(685)
  17732. const { kEnumerableProperty } = __nccwpck_require__(3983)
  17733. const encoder = new TextEncoder()
  17734. class File extends Blob {
  17735. constructor (fileBits, fileName, options = {}) {
  17736. // The File constructor is invoked with two or three parameters, depending
  17737. // on whether the optional dictionary parameter is used. When the File()
  17738. // constructor is invoked, user agents must run the following steps:
  17739. webidl.argumentLengthCheck(arguments, 2, { header: 'File constructor' })
  17740. fileBits = webidl.converters['sequence<BlobPart>'](fileBits)
  17741. fileName = webidl.converters.USVString(fileName)
  17742. options = webidl.converters.FilePropertyBag(options)
  17743. // 1. Let bytes be the result of processing blob parts given fileBits and
  17744. // options.
  17745. // Note: Blob handles this for us
  17746. // 2. Let n be the fileName argument to the constructor.
  17747. const n = fileName
  17748. // 3. Process FilePropertyBag dictionary argument by running the following
  17749. // substeps:
  17750. // 1. If the type member is provided and is not the empty string, let t
  17751. // be set to the type dictionary member. If t contains any characters
  17752. // outside the range U+0020 to U+007E, then set t to the empty string
  17753. // and return from these substeps.
  17754. // 2. Convert every character in t to ASCII lowercase.
  17755. let t = options.type
  17756. let d
  17757. // eslint-disable-next-line no-labels
  17758. substep: {
  17759. if (t) {
  17760. t = parseMIMEType(t)
  17761. if (t === 'failure') {
  17762. t = ''
  17763. // eslint-disable-next-line no-labels
  17764. break substep
  17765. }
  17766. t = serializeAMimeType(t).toLowerCase()
  17767. }
  17768. // 3. If the lastModified member is provided, let d be set to the
  17769. // lastModified dictionary member. If it is not provided, set d to the
  17770. // current date and time represented as the number of milliseconds since
  17771. // the Unix Epoch (which is the equivalent of Date.now() [ECMA-262]).
  17772. d = options.lastModified
  17773. }
  17774. // 4. Return a new File object F such that:
  17775. // F refers to the bytes byte sequence.
  17776. // F.size is set to the number of total bytes in bytes.
  17777. // F.name is set to n.
  17778. // F.type is set to t.
  17779. // F.lastModified is set to d.
  17780. super(processBlobParts(fileBits, options), { type: t })
  17781. this[kState] = {
  17782. name: n,
  17783. lastModified: d,
  17784. type: t
  17785. }
  17786. }
  17787. get name () {
  17788. webidl.brandCheck(this, File)
  17789. return this[kState].name
  17790. }
  17791. get lastModified () {
  17792. webidl.brandCheck(this, File)
  17793. return this[kState].lastModified
  17794. }
  17795. get type () {
  17796. webidl.brandCheck(this, File)
  17797. return this[kState].type
  17798. }
  17799. }
  17800. class FileLike {
  17801. constructor (blobLike, fileName, options = {}) {
  17802. // TODO: argument idl type check
  17803. // The File constructor is invoked with two or three parameters, depending
  17804. // on whether the optional dictionary parameter is used. When the File()
  17805. // constructor is invoked, user agents must run the following steps:
  17806. // 1. Let bytes be the result of processing blob parts given fileBits and
  17807. // options.
  17808. // 2. Let n be the fileName argument to the constructor.
  17809. const n = fileName
  17810. // 3. Process FilePropertyBag dictionary argument by running the following
  17811. // substeps:
  17812. // 1. If the type member is provided and is not the empty string, let t
  17813. // be set to the type dictionary member. If t contains any characters
  17814. // outside the range U+0020 to U+007E, then set t to the empty string
  17815. // and return from these substeps.
  17816. // TODO
  17817. const t = options.type
  17818. // 2. Convert every character in t to ASCII lowercase.
  17819. // TODO
  17820. // 3. If the lastModified member is provided, let d be set to the
  17821. // lastModified dictionary member. If it is not provided, set d to the
  17822. // current date and time represented as the number of milliseconds since
  17823. // the Unix Epoch (which is the equivalent of Date.now() [ECMA-262]).
  17824. const d = options.lastModified ?? Date.now()
  17825. // 4. Return a new File object F such that:
  17826. // F refers to the bytes byte sequence.
  17827. // F.size is set to the number of total bytes in bytes.
  17828. // F.name is set to n.
  17829. // F.type is set to t.
  17830. // F.lastModified is set to d.
  17831. this[kState] = {
  17832. blobLike,
  17833. name: n,
  17834. type: t,
  17835. lastModified: d
  17836. }
  17837. }
  17838. stream (...args) {
  17839. webidl.brandCheck(this, FileLike)
  17840. return this[kState].blobLike.stream(...args)
  17841. }
  17842. arrayBuffer (...args) {
  17843. webidl.brandCheck(this, FileLike)
  17844. return this[kState].blobLike.arrayBuffer(...args)
  17845. }
  17846. slice (...args) {
  17847. webidl.brandCheck(this, FileLike)
  17848. return this[kState].blobLike.slice(...args)
  17849. }
  17850. text (...args) {
  17851. webidl.brandCheck(this, FileLike)
  17852. return this[kState].blobLike.text(...args)
  17853. }
  17854. get size () {
  17855. webidl.brandCheck(this, FileLike)
  17856. return this[kState].blobLike.size
  17857. }
  17858. get type () {
  17859. webidl.brandCheck(this, FileLike)
  17860. return this[kState].blobLike.type
  17861. }
  17862. get name () {
  17863. webidl.brandCheck(this, FileLike)
  17864. return this[kState].name
  17865. }
  17866. get lastModified () {
  17867. webidl.brandCheck(this, FileLike)
  17868. return this[kState].lastModified
  17869. }
  17870. get [Symbol.toStringTag] () {
  17871. return 'File'
  17872. }
  17873. }
  17874. Object.defineProperties(File.prototype, {
  17875. [Symbol.toStringTag]: {
  17876. value: 'File',
  17877. configurable: true
  17878. },
  17879. name: kEnumerableProperty,
  17880. lastModified: kEnumerableProperty
  17881. })
  17882. webidl.converters.Blob = webidl.interfaceConverter(Blob)
  17883. webidl.converters.BlobPart = function (V, opts) {
  17884. if (webidl.util.Type(V) === 'Object') {
  17885. if (isBlobLike(V)) {
  17886. return webidl.converters.Blob(V, { strict: false })
  17887. }
  17888. if (
  17889. ArrayBuffer.isView(V) ||
  17890. types.isAnyArrayBuffer(V)
  17891. ) {
  17892. return webidl.converters.BufferSource(V, opts)
  17893. }
  17894. }
  17895. return webidl.converters.USVString(V, opts)
  17896. }
  17897. webidl.converters['sequence<BlobPart>'] = webidl.sequenceConverter(
  17898. webidl.converters.BlobPart
  17899. )
  17900. // https://www.w3.org/TR/FileAPI/#dfn-FilePropertyBag
  17901. webidl.converters.FilePropertyBag = webidl.dictionaryConverter([
  17902. {
  17903. key: 'lastModified',
  17904. converter: webidl.converters['long long'],
  17905. get defaultValue () {
  17906. return Date.now()
  17907. }
  17908. },
  17909. {
  17910. key: 'type',
  17911. converter: webidl.converters.DOMString,
  17912. defaultValue: ''
  17913. },
  17914. {
  17915. key: 'endings',
  17916. converter: (value) => {
  17917. value = webidl.converters.DOMString(value)
  17918. value = value.toLowerCase()
  17919. if (value !== 'native') {
  17920. value = 'transparent'
  17921. }
  17922. return value
  17923. },
  17924. defaultValue: 'transparent'
  17925. }
  17926. ])
  17927. /**
  17928. * @see https://www.w3.org/TR/FileAPI/#process-blob-parts
  17929. * @param {(NodeJS.TypedArray|Blob|string)[]} parts
  17930. * @param {{ type: string, endings: string }} options
  17931. */
  17932. function processBlobParts (parts, options) {
  17933. // 1. Let bytes be an empty sequence of bytes.
  17934. /** @type {NodeJS.TypedArray[]} */
  17935. const bytes = []
  17936. // 2. For each element in parts:
  17937. for (const element of parts) {
  17938. // 1. If element is a USVString, run the following substeps:
  17939. if (typeof element === 'string') {
  17940. // 1. Let s be element.
  17941. let s = element
  17942. // 2. If the endings member of options is "native", set s
  17943. // to the result of converting line endings to native
  17944. // of element.
  17945. if (options.endings === 'native') {
  17946. s = convertLineEndingsNative(s)
  17947. }
  17948. // 3. Append the result of UTF-8 encoding s to bytes.
  17949. bytes.push(encoder.encode(s))
  17950. } else if (
  17951. types.isAnyArrayBuffer(element) ||
  17952. types.isTypedArray(element)
  17953. ) {
  17954. // 2. If element is a BufferSource, get a copy of the
  17955. // bytes held by the buffer source, and append those
  17956. // bytes to bytes.
  17957. if (!element.buffer) { // ArrayBuffer
  17958. bytes.push(new Uint8Array(element))
  17959. } else {
  17960. bytes.push(
  17961. new Uint8Array(element.buffer, element.byteOffset, element.byteLength)
  17962. )
  17963. }
  17964. } else if (isBlobLike(element)) {
  17965. // 3. If element is a Blob, append the bytes it represents
  17966. // to bytes.
  17967. bytes.push(element)
  17968. }
  17969. }
  17970. // 3. Return bytes.
  17971. return bytes
  17972. }
  17973. /**
  17974. * @see https://www.w3.org/TR/FileAPI/#convert-line-endings-to-native
  17975. * @param {string} s
  17976. */
  17977. function convertLineEndingsNative (s) {
  17978. // 1. Let native line ending be be the code point U+000A LF.
  17979. let nativeLineEnding = '\n'
  17980. // 2. If the underlying platform’s conventions are to
  17981. // represent newlines as a carriage return and line feed
  17982. // sequence, set native line ending to the code point
  17983. // U+000D CR followed by the code point U+000A LF.
  17984. if (process.platform === 'win32') {
  17985. nativeLineEnding = '\r\n'
  17986. }
  17987. return s.replace(/\r?\n/g, nativeLineEnding)
  17988. }
  17989. // If this function is moved to ./util.js, some tools (such as
  17990. // rollup) will warn about circular dependencies. See:
  17991. // https://github.com/nodejs/undici/issues/1629
  17992. function isFileLike (object) {
  17993. return (
  17994. (NativeFile && object instanceof NativeFile) ||
  17995. object instanceof File || (
  17996. object &&
  17997. (typeof object.stream === 'function' ||
  17998. typeof object.arrayBuffer === 'function') &&
  17999. object[Symbol.toStringTag] === 'File'
  18000. )
  18001. )
  18002. }
  18003. module.exports = { File, FileLike, isFileLike }
  18004. /***/ }),
  18005. /***/ 2015:
  18006. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  18007. const { isBlobLike, toUSVString, makeIterator } = __nccwpck_require__(2538)
  18008. const { kState } = __nccwpck_require__(5861)
  18009. const { File: UndiciFile, FileLike, isFileLike } = __nccwpck_require__(8511)
  18010. const { webidl } = __nccwpck_require__(1744)
  18011. const { Blob, File: NativeFile } = __nccwpck_require__(4300)
  18012. /** @type {globalThis['File']} */
  18013. const File = NativeFile ?? UndiciFile
  18014. // https://xhr.spec.whatwg.org/#formdata
  18015. class FormData {
  18016. constructor (form) {
  18017. if (form !== undefined) {
  18018. throw webidl.errors.conversionFailed({
  18019. prefix: 'FormData constructor',
  18020. argument: 'Argument 1',
  18021. types: ['undefined']
  18022. })
  18023. }
  18024. this[kState] = []
  18025. }
  18026. append (name, value, filename = undefined) {
  18027. webidl.brandCheck(this, FormData)
  18028. webidl.argumentLengthCheck(arguments, 2, { header: 'FormData.append' })
  18029. if (arguments.length === 3 && !isBlobLike(value)) {
  18030. throw new TypeError(
  18031. "Failed to execute 'append' on 'FormData': parameter 2 is not of type 'Blob'"
  18032. )
  18033. }
  18034. // 1. Let value be value if given; otherwise blobValue.
  18035. name = webidl.converters.USVString(name)
  18036. value = isBlobLike(value)
  18037. ? webidl.converters.Blob(value, { strict: false })
  18038. : webidl.converters.USVString(value)
  18039. filename = arguments.length === 3
  18040. ? webidl.converters.USVString(filename)
  18041. : undefined
  18042. // 2. Let entry be the result of creating an entry with
  18043. // name, value, and filename if given.
  18044. const entry = makeEntry(name, value, filename)
  18045. // 3. Append entry to this’s entry list.
  18046. this[kState].push(entry)
  18047. }
  18048. delete (name) {
  18049. webidl.brandCheck(this, FormData)
  18050. webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.delete' })
  18051. name = webidl.converters.USVString(name)
  18052. // The delete(name) method steps are to remove all entries whose name
  18053. // is name from this’s entry list.
  18054. this[kState] = this[kState].filter(entry => entry.name !== name)
  18055. }
  18056. get (name) {
  18057. webidl.brandCheck(this, FormData)
  18058. webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.get' })
  18059. name = webidl.converters.USVString(name)
  18060. // 1. If there is no entry whose name is name in this’s entry list,
  18061. // then return null.
  18062. const idx = this[kState].findIndex((entry) => entry.name === name)
  18063. if (idx === -1) {
  18064. return null
  18065. }
  18066. // 2. Return the value of the first entry whose name is name from
  18067. // this’s entry list.
  18068. return this[kState][idx].value
  18069. }
  18070. getAll (name) {
  18071. webidl.brandCheck(this, FormData)
  18072. webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.getAll' })
  18073. name = webidl.converters.USVString(name)
  18074. // 1. If there is no entry whose name is name in this’s entry list,
  18075. // then return the empty list.
  18076. // 2. Return the values of all entries whose name is name, in order,
  18077. // from this’s entry list.
  18078. return this[kState]
  18079. .filter((entry) => entry.name === name)
  18080. .map((entry) => entry.value)
  18081. }
  18082. has (name) {
  18083. webidl.brandCheck(this, FormData)
  18084. webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.has' })
  18085. name = webidl.converters.USVString(name)
  18086. // The has(name) method steps are to return true if there is an entry
  18087. // whose name is name in this’s entry list; otherwise false.
  18088. return this[kState].findIndex((entry) => entry.name === name) !== -1
  18089. }
  18090. set (name, value, filename = undefined) {
  18091. webidl.brandCheck(this, FormData)
  18092. webidl.argumentLengthCheck(arguments, 2, { header: 'FormData.set' })
  18093. if (arguments.length === 3 && !isBlobLike(value)) {
  18094. throw new TypeError(
  18095. "Failed to execute 'set' on 'FormData': parameter 2 is not of type 'Blob'"
  18096. )
  18097. }
  18098. // The set(name, value) and set(name, blobValue, filename) method steps
  18099. // are:
  18100. // 1. Let value be value if given; otherwise blobValue.
  18101. name = webidl.converters.USVString(name)
  18102. value = isBlobLike(value)
  18103. ? webidl.converters.Blob(value, { strict: false })
  18104. : webidl.converters.USVString(value)
  18105. filename = arguments.length === 3
  18106. ? toUSVString(filename)
  18107. : undefined
  18108. // 2. Let entry be the result of creating an entry with name, value, and
  18109. // filename if given.
  18110. const entry = makeEntry(name, value, filename)
  18111. // 3. If there are entries in this’s entry list whose name is name, then
  18112. // replace the first such entry with entry and remove the others.
  18113. const idx = this[kState].findIndex((entry) => entry.name === name)
  18114. if (idx !== -1) {
  18115. this[kState] = [
  18116. ...this[kState].slice(0, idx),
  18117. entry,
  18118. ...this[kState].slice(idx + 1).filter((entry) => entry.name !== name)
  18119. ]
  18120. } else {
  18121. // 4. Otherwise, append entry to this’s entry list.
  18122. this[kState].push(entry)
  18123. }
  18124. }
  18125. entries () {
  18126. webidl.brandCheck(this, FormData)
  18127. return makeIterator(
  18128. () => this[kState].map(pair => [pair.name, pair.value]),
  18129. 'FormData',
  18130. 'key+value'
  18131. )
  18132. }
  18133. keys () {
  18134. webidl.brandCheck(this, FormData)
  18135. return makeIterator(
  18136. () => this[kState].map(pair => [pair.name, pair.value]),
  18137. 'FormData',
  18138. 'key'
  18139. )
  18140. }
  18141. values () {
  18142. webidl.brandCheck(this, FormData)
  18143. return makeIterator(
  18144. () => this[kState].map(pair => [pair.name, pair.value]),
  18145. 'FormData',
  18146. 'value'
  18147. )
  18148. }
  18149. /**
  18150. * @param {(value: string, key: string, self: FormData) => void} callbackFn
  18151. * @param {unknown} thisArg
  18152. */
  18153. forEach (callbackFn, thisArg = globalThis) {
  18154. webidl.brandCheck(this, FormData)
  18155. webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.forEach' })
  18156. if (typeof callbackFn !== 'function') {
  18157. throw new TypeError(
  18158. "Failed to execute 'forEach' on 'FormData': parameter 1 is not of type 'Function'."
  18159. )
  18160. }
  18161. for (const [key, value] of this) {
  18162. callbackFn.apply(thisArg, [value, key, this])
  18163. }
  18164. }
  18165. }
  18166. FormData.prototype[Symbol.iterator] = FormData.prototype.entries
  18167. Object.defineProperties(FormData.prototype, {
  18168. [Symbol.toStringTag]: {
  18169. value: 'FormData',
  18170. configurable: true
  18171. }
  18172. })
  18173. /**
  18174. * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#create-an-entry
  18175. * @param {string} name
  18176. * @param {string|Blob} value
  18177. * @param {?string} filename
  18178. * @returns
  18179. */
  18180. function makeEntry (name, value, filename) {
  18181. // 1. Set name to the result of converting name into a scalar value string.
  18182. // "To convert a string into a scalar value string, replace any surrogates
  18183. // with U+FFFD."
  18184. // see: https://nodejs.org/dist/latest-v18.x/docs/api/buffer.html#buftostringencoding-start-end
  18185. name = Buffer.from(name).toString('utf8')
  18186. // 2. If value is a string, then set value to the result of converting
  18187. // value into a scalar value string.
  18188. if (typeof value === 'string') {
  18189. value = Buffer.from(value).toString('utf8')
  18190. } else {
  18191. // 3. Otherwise:
  18192. // 1. If value is not a File object, then set value to a new File object,
  18193. // representing the same bytes, whose name attribute value is "blob"
  18194. if (!isFileLike(value)) {
  18195. value = value instanceof Blob
  18196. ? new File([value], 'blob', { type: value.type })
  18197. : new FileLike(value, 'blob', { type: value.type })
  18198. }
  18199. // 2. If filename is given, then set value to a new File object,
  18200. // representing the same bytes, whose name attribute is filename.
  18201. if (filename !== undefined) {
  18202. /** @type {FilePropertyBag} */
  18203. const options = {
  18204. type: value.type,
  18205. lastModified: value.lastModified
  18206. }
  18207. value = (NativeFile && value instanceof NativeFile) || value instanceof UndiciFile
  18208. ? new File([value], filename, options)
  18209. : new FileLike(value, filename, options)
  18210. }
  18211. }
  18212. // 4. Return an entry whose name is name and whose value is value.
  18213. return { name, value }
  18214. }
  18215. module.exports = { FormData }
  18216. /***/ }),
  18217. /***/ 1246:
  18218. /***/ ((module) => {
  18219. // In case of breaking changes, increase the version
  18220. // number to avoid conflicts.
  18221. const globalOrigin = Symbol.for('undici.globalOrigin.1')
  18222. function getGlobalOrigin () {
  18223. return globalThis[globalOrigin]
  18224. }
  18225. function setGlobalOrigin (newOrigin) {
  18226. if (newOrigin === undefined) {
  18227. Object.defineProperty(globalThis, globalOrigin, {
  18228. value: undefined,
  18229. writable: true,
  18230. enumerable: false,
  18231. configurable: false
  18232. })
  18233. return
  18234. }
  18235. const parsedURL = new URL(newOrigin)
  18236. if (parsedURL.protocol !== 'http:' && parsedURL.protocol !== 'https:') {
  18237. throw new TypeError(`Only http & https urls are allowed, received ${parsedURL.protocol}`)
  18238. }
  18239. Object.defineProperty(globalThis, globalOrigin, {
  18240. value: parsedURL,
  18241. writable: true,
  18242. enumerable: false,
  18243. configurable: false
  18244. })
  18245. }
  18246. module.exports = {
  18247. getGlobalOrigin,
  18248. setGlobalOrigin
  18249. }
  18250. /***/ }),
  18251. /***/ 554:
  18252. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  18253. // https://github.com/Ethan-Arrowood/undici-fetch
  18254. const { kHeadersList, kConstruct } = __nccwpck_require__(2785)
  18255. const { kGuard } = __nccwpck_require__(5861)
  18256. const { kEnumerableProperty } = __nccwpck_require__(3983)
  18257. const {
  18258. makeIterator,
  18259. isValidHeaderName,
  18260. isValidHeaderValue
  18261. } = __nccwpck_require__(2538)
  18262. const util = __nccwpck_require__(3837)
  18263. const { webidl } = __nccwpck_require__(1744)
  18264. const assert = __nccwpck_require__(9491)
  18265. const kHeadersMap = Symbol('headers map')
  18266. const kHeadersSortedMap = Symbol('headers map sorted')
  18267. /**
  18268. * @param {number} code
  18269. */
  18270. function isHTTPWhiteSpaceCharCode (code) {
  18271. return code === 0x00a || code === 0x00d || code === 0x009 || code === 0x020
  18272. }
  18273. /**
  18274. * @see https://fetch.spec.whatwg.org/#concept-header-value-normalize
  18275. * @param {string} potentialValue
  18276. */
  18277. function headerValueNormalize (potentialValue) {
  18278. // To normalize a byte sequence potentialValue, remove
  18279. // any leading and trailing HTTP whitespace bytes from
  18280. // potentialValue.
  18281. let i = 0; let j = potentialValue.length
  18282. while (j > i && isHTTPWhiteSpaceCharCode(potentialValue.charCodeAt(j - 1))) --j
  18283. while (j > i && isHTTPWhiteSpaceCharCode(potentialValue.charCodeAt(i))) ++i
  18284. return i === 0 && j === potentialValue.length ? potentialValue : potentialValue.substring(i, j)
  18285. }
  18286. function fill (headers, object) {
  18287. // To fill a Headers object headers with a given object object, run these steps:
  18288. // 1. If object is a sequence, then for each header in object:
  18289. // Note: webidl conversion to array has already been done.
  18290. if (Array.isArray(object)) {
  18291. for (let i = 0; i < object.length; ++i) {
  18292. const header = object[i]
  18293. // 1. If header does not contain exactly two items, then throw a TypeError.
  18294. if (header.length !== 2) {
  18295. throw webidl.errors.exception({
  18296. header: 'Headers constructor',
  18297. message: `expected name/value pair to be length 2, found ${header.length}.`
  18298. })
  18299. }
  18300. // 2. Append (header’s first item, header’s second item) to headers.
  18301. appendHeader(headers, header[0], header[1])
  18302. }
  18303. } else if (typeof object === 'object' && object !== null) {
  18304. // Note: null should throw
  18305. // 2. Otherwise, object is a record, then for each key → value in object,
  18306. // append (key, value) to headers
  18307. const keys = Object.keys(object)
  18308. for (let i = 0; i < keys.length; ++i) {
  18309. appendHeader(headers, keys[i], object[keys[i]])
  18310. }
  18311. } else {
  18312. throw webidl.errors.conversionFailed({
  18313. prefix: 'Headers constructor',
  18314. argument: 'Argument 1',
  18315. types: ['sequence<sequence<ByteString>>', 'record<ByteString, ByteString>']
  18316. })
  18317. }
  18318. }
  18319. /**
  18320. * @see https://fetch.spec.whatwg.org/#concept-headers-append
  18321. */
  18322. function appendHeader (headers, name, value) {
  18323. // 1. Normalize value.
  18324. value = headerValueNormalize(value)
  18325. // 2. If name is not a header name or value is not a
  18326. // header value, then throw a TypeError.
  18327. if (!isValidHeaderName(name)) {
  18328. throw webidl.errors.invalidArgument({
  18329. prefix: 'Headers.append',
  18330. value: name,
  18331. type: 'header name'
  18332. })
  18333. } else if (!isValidHeaderValue(value)) {
  18334. throw webidl.errors.invalidArgument({
  18335. prefix: 'Headers.append',
  18336. value,
  18337. type: 'header value'
  18338. })
  18339. }
  18340. // 3. If headers’s guard is "immutable", then throw a TypeError.
  18341. // 4. Otherwise, if headers’s guard is "request" and name is a
  18342. // forbidden header name, return.
  18343. // Note: undici does not implement forbidden header names
  18344. if (headers[kGuard] === 'immutable') {
  18345. throw new TypeError('immutable')
  18346. } else if (headers[kGuard] === 'request-no-cors') {
  18347. // 5. Otherwise, if headers’s guard is "request-no-cors":
  18348. // TODO
  18349. }
  18350. // 6. Otherwise, if headers’s guard is "response" and name is a
  18351. // forbidden response-header name, return.
  18352. // 7. Append (name, value) to headers’s header list.
  18353. return headers[kHeadersList].append(name, value)
  18354. // 8. If headers’s guard is "request-no-cors", then remove
  18355. // privileged no-CORS request headers from headers
  18356. }
  18357. class HeadersList {
  18358. /** @type {[string, string][]|null} */
  18359. cookies = null
  18360. constructor (init) {
  18361. if (init instanceof HeadersList) {
  18362. this[kHeadersMap] = new Map(init[kHeadersMap])
  18363. this[kHeadersSortedMap] = init[kHeadersSortedMap]
  18364. this.cookies = init.cookies === null ? null : [...init.cookies]
  18365. } else {
  18366. this[kHeadersMap] = new Map(init)
  18367. this[kHeadersSortedMap] = null
  18368. }
  18369. }
  18370. // https://fetch.spec.whatwg.org/#header-list-contains
  18371. contains (name) {
  18372. // A header list list contains a header name name if list
  18373. // contains a header whose name is a byte-case-insensitive
  18374. // match for name.
  18375. name = name.toLowerCase()
  18376. return this[kHeadersMap].has(name)
  18377. }
  18378. clear () {
  18379. this[kHeadersMap].clear()
  18380. this[kHeadersSortedMap] = null
  18381. this.cookies = null
  18382. }
  18383. // https://fetch.spec.whatwg.org/#concept-header-list-append
  18384. append (name, value) {
  18385. this[kHeadersSortedMap] = null
  18386. // 1. If list contains name, then set name to the first such
  18387. // header’s name.
  18388. const lowercaseName = name.toLowerCase()
  18389. const exists = this[kHeadersMap].get(lowercaseName)
  18390. // 2. Append (name, value) to list.
  18391. if (exists) {
  18392. const delimiter = lowercaseName === 'cookie' ? '; ' : ', '
  18393. this[kHeadersMap].set(lowercaseName, {
  18394. name: exists.name,
  18395. value: `${exists.value}${delimiter}${value}`
  18396. })
  18397. } else {
  18398. this[kHeadersMap].set(lowercaseName, { name, value })
  18399. }
  18400. if (lowercaseName === 'set-cookie') {
  18401. this.cookies ??= []
  18402. this.cookies.push(value)
  18403. }
  18404. }
  18405. // https://fetch.spec.whatwg.org/#concept-header-list-set
  18406. set (name, value) {
  18407. this[kHeadersSortedMap] = null
  18408. const lowercaseName = name.toLowerCase()
  18409. if (lowercaseName === 'set-cookie') {
  18410. this.cookies = [value]
  18411. }
  18412. // 1. If list contains name, then set the value of
  18413. // the first such header to value and remove the
  18414. // others.
  18415. // 2. Otherwise, append header (name, value) to list.
  18416. this[kHeadersMap].set(lowercaseName, { name, value })
  18417. }
  18418. // https://fetch.spec.whatwg.org/#concept-header-list-delete
  18419. delete (name) {
  18420. this[kHeadersSortedMap] = null
  18421. name = name.toLowerCase()
  18422. if (name === 'set-cookie') {
  18423. this.cookies = null
  18424. }
  18425. this[kHeadersMap].delete(name)
  18426. }
  18427. // https://fetch.spec.whatwg.org/#concept-header-list-get
  18428. get (name) {
  18429. const value = this[kHeadersMap].get(name.toLowerCase())
  18430. // 1. If list does not contain name, then return null.
  18431. // 2. Return the values of all headers in list whose name
  18432. // is a byte-case-insensitive match for name,
  18433. // separated from each other by 0x2C 0x20, in order.
  18434. return value === undefined ? null : value.value
  18435. }
  18436. * [Symbol.iterator] () {
  18437. // use the lowercased name
  18438. for (const [name, { value }] of this[kHeadersMap]) {
  18439. yield [name, value]
  18440. }
  18441. }
  18442. get entries () {
  18443. const headers = {}
  18444. if (this[kHeadersMap].size) {
  18445. for (const { name, value } of this[kHeadersMap].values()) {
  18446. headers[name] = value
  18447. }
  18448. }
  18449. return headers
  18450. }
  18451. }
  18452. // https://fetch.spec.whatwg.org/#headers-class
  18453. class Headers {
  18454. constructor (init = undefined) {
  18455. if (init === kConstruct) {
  18456. return
  18457. }
  18458. this[kHeadersList] = new HeadersList()
  18459. // The new Headers(init) constructor steps are:
  18460. // 1. Set this’s guard to "none".
  18461. this[kGuard] = 'none'
  18462. // 2. If init is given, then fill this with init.
  18463. if (init !== undefined) {
  18464. init = webidl.converters.HeadersInit(init)
  18465. fill(this, init)
  18466. }
  18467. }
  18468. // https://fetch.spec.whatwg.org/#dom-headers-append
  18469. append (name, value) {
  18470. webidl.brandCheck(this, Headers)
  18471. webidl.argumentLengthCheck(arguments, 2, { header: 'Headers.append' })
  18472. name = webidl.converters.ByteString(name)
  18473. value = webidl.converters.ByteString(value)
  18474. return appendHeader(this, name, value)
  18475. }
  18476. // https://fetch.spec.whatwg.org/#dom-headers-delete
  18477. delete (name) {
  18478. webidl.brandCheck(this, Headers)
  18479. webidl.argumentLengthCheck(arguments, 1, { header: 'Headers.delete' })
  18480. name = webidl.converters.ByteString(name)
  18481. // 1. If name is not a header name, then throw a TypeError.
  18482. if (!isValidHeaderName(name)) {
  18483. throw webidl.errors.invalidArgument({
  18484. prefix: 'Headers.delete',
  18485. value: name,
  18486. type: 'header name'
  18487. })
  18488. }
  18489. // 2. If this’s guard is "immutable", then throw a TypeError.
  18490. // 3. Otherwise, if this’s guard is "request" and name is a
  18491. // forbidden header name, return.
  18492. // 4. Otherwise, if this’s guard is "request-no-cors", name
  18493. // is not a no-CORS-safelisted request-header name, and
  18494. // name is not a privileged no-CORS request-header name,
  18495. // return.
  18496. // 5. Otherwise, if this’s guard is "response" and name is
  18497. // a forbidden response-header name, return.
  18498. // Note: undici does not implement forbidden header names
  18499. if (this[kGuard] === 'immutable') {
  18500. throw new TypeError('immutable')
  18501. } else if (this[kGuard] === 'request-no-cors') {
  18502. // TODO
  18503. }
  18504. // 6. If this’s header list does not contain name, then
  18505. // return.
  18506. if (!this[kHeadersList].contains(name)) {
  18507. return
  18508. }
  18509. // 7. Delete name from this’s header list.
  18510. // 8. If this’s guard is "request-no-cors", then remove
  18511. // privileged no-CORS request headers from this.
  18512. this[kHeadersList].delete(name)
  18513. }
  18514. // https://fetch.spec.whatwg.org/#dom-headers-get
  18515. get (name) {
  18516. webidl.brandCheck(this, Headers)
  18517. webidl.argumentLengthCheck(arguments, 1, { header: 'Headers.get' })
  18518. name = webidl.converters.ByteString(name)
  18519. // 1. If name is not a header name, then throw a TypeError.
  18520. if (!isValidHeaderName(name)) {
  18521. throw webidl.errors.invalidArgument({
  18522. prefix: 'Headers.get',
  18523. value: name,
  18524. type: 'header name'
  18525. })
  18526. }
  18527. // 2. Return the result of getting name from this’s header
  18528. // list.
  18529. return this[kHeadersList].get(name)
  18530. }
  18531. // https://fetch.spec.whatwg.org/#dom-headers-has
  18532. has (name) {
  18533. webidl.brandCheck(this, Headers)
  18534. webidl.argumentLengthCheck(arguments, 1, { header: 'Headers.has' })
  18535. name = webidl.converters.ByteString(name)
  18536. // 1. If name is not a header name, then throw a TypeError.
  18537. if (!isValidHeaderName(name)) {
  18538. throw webidl.errors.invalidArgument({
  18539. prefix: 'Headers.has',
  18540. value: name,
  18541. type: 'header name'
  18542. })
  18543. }
  18544. // 2. Return true if this’s header list contains name;
  18545. // otherwise false.
  18546. return this[kHeadersList].contains(name)
  18547. }
  18548. // https://fetch.spec.whatwg.org/#dom-headers-set
  18549. set (name, value) {
  18550. webidl.brandCheck(this, Headers)
  18551. webidl.argumentLengthCheck(arguments, 2, { header: 'Headers.set' })
  18552. name = webidl.converters.ByteString(name)
  18553. value = webidl.converters.ByteString(value)
  18554. // 1. Normalize value.
  18555. value = headerValueNormalize(value)
  18556. // 2. If name is not a header name or value is not a
  18557. // header value, then throw a TypeError.
  18558. if (!isValidHeaderName(name)) {
  18559. throw webidl.errors.invalidArgument({
  18560. prefix: 'Headers.set',
  18561. value: name,
  18562. type: 'header name'
  18563. })
  18564. } else if (!isValidHeaderValue(value)) {
  18565. throw webidl.errors.invalidArgument({
  18566. prefix: 'Headers.set',
  18567. value,
  18568. type: 'header value'
  18569. })
  18570. }
  18571. // 3. If this’s guard is "immutable", then throw a TypeError.
  18572. // 4. Otherwise, if this’s guard is "request" and name is a
  18573. // forbidden header name, return.
  18574. // 5. Otherwise, if this’s guard is "request-no-cors" and
  18575. // name/value is not a no-CORS-safelisted request-header,
  18576. // return.
  18577. // 6. Otherwise, if this’s guard is "response" and name is a
  18578. // forbidden response-header name, return.
  18579. // Note: undici does not implement forbidden header names
  18580. if (this[kGuard] === 'immutable') {
  18581. throw new TypeError('immutable')
  18582. } else if (this[kGuard] === 'request-no-cors') {
  18583. // TODO
  18584. }
  18585. // 7. Set (name, value) in this’s header list.
  18586. // 8. If this’s guard is "request-no-cors", then remove
  18587. // privileged no-CORS request headers from this
  18588. this[kHeadersList].set(name, value)
  18589. }
  18590. // https://fetch.spec.whatwg.org/#dom-headers-getsetcookie
  18591. getSetCookie () {
  18592. webidl.brandCheck(this, Headers)
  18593. // 1. If this’s header list does not contain `Set-Cookie`, then return « ».
  18594. // 2. Return the values of all headers in this’s header list whose name is
  18595. // a byte-case-insensitive match for `Set-Cookie`, in order.
  18596. const list = this[kHeadersList].cookies
  18597. if (list) {
  18598. return [...list]
  18599. }
  18600. return []
  18601. }
  18602. // https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine
  18603. get [kHeadersSortedMap] () {
  18604. if (this[kHeadersList][kHeadersSortedMap]) {
  18605. return this[kHeadersList][kHeadersSortedMap]
  18606. }
  18607. // 1. Let headers be an empty list of headers with the key being the name
  18608. // and value the value.
  18609. const headers = []
  18610. // 2. Let names be the result of convert header names to a sorted-lowercase
  18611. // set with all the names of the headers in list.
  18612. const names = [...this[kHeadersList]].sort((a, b) => a[0] < b[0] ? -1 : 1)
  18613. const cookies = this[kHeadersList].cookies
  18614. // 3. For each name of names:
  18615. for (let i = 0; i < names.length; ++i) {
  18616. const [name, value] = names[i]
  18617. // 1. If name is `set-cookie`, then:
  18618. if (name === 'set-cookie') {
  18619. // 1. Let values be a list of all values of headers in list whose name
  18620. // is a byte-case-insensitive match for name, in order.
  18621. // 2. For each value of values:
  18622. // 1. Append (name, value) to headers.
  18623. for (let j = 0; j < cookies.length; ++j) {
  18624. headers.push([name, cookies[j]])
  18625. }
  18626. } else {
  18627. // 2. Otherwise:
  18628. // 1. Let value be the result of getting name from list.
  18629. // 2. Assert: value is non-null.
  18630. assert(value !== null)
  18631. // 3. Append (name, value) to headers.
  18632. headers.push([name, value])
  18633. }
  18634. }
  18635. this[kHeadersList][kHeadersSortedMap] = headers
  18636. // 4. Return headers.
  18637. return headers
  18638. }
  18639. keys () {
  18640. webidl.brandCheck(this, Headers)
  18641. if (this[kGuard] === 'immutable') {
  18642. const value = this[kHeadersSortedMap]
  18643. return makeIterator(() => value, 'Headers',
  18644. 'key')
  18645. }
  18646. return makeIterator(
  18647. () => [...this[kHeadersSortedMap].values()],
  18648. 'Headers',
  18649. 'key'
  18650. )
  18651. }
  18652. values () {
  18653. webidl.brandCheck(this, Headers)
  18654. if (this[kGuard] === 'immutable') {
  18655. const value = this[kHeadersSortedMap]
  18656. return makeIterator(() => value, 'Headers',
  18657. 'value')
  18658. }
  18659. return makeIterator(
  18660. () => [...this[kHeadersSortedMap].values()],
  18661. 'Headers',
  18662. 'value'
  18663. )
  18664. }
  18665. entries () {
  18666. webidl.brandCheck(this, Headers)
  18667. if (this[kGuard] === 'immutable') {
  18668. const value = this[kHeadersSortedMap]
  18669. return makeIterator(() => value, 'Headers',
  18670. 'key+value')
  18671. }
  18672. return makeIterator(
  18673. () => [...this[kHeadersSortedMap].values()],
  18674. 'Headers',
  18675. 'key+value'
  18676. )
  18677. }
  18678. /**
  18679. * @param {(value: string, key: string, self: Headers) => void} callbackFn
  18680. * @param {unknown} thisArg
  18681. */
  18682. forEach (callbackFn, thisArg = globalThis) {
  18683. webidl.brandCheck(this, Headers)
  18684. webidl.argumentLengthCheck(arguments, 1, { header: 'Headers.forEach' })
  18685. if (typeof callbackFn !== 'function') {
  18686. throw new TypeError(
  18687. "Failed to execute 'forEach' on 'Headers': parameter 1 is not of type 'Function'."
  18688. )
  18689. }
  18690. for (const [key, value] of this) {
  18691. callbackFn.apply(thisArg, [value, key, this])
  18692. }
  18693. }
  18694. [Symbol.for('nodejs.util.inspect.custom')] () {
  18695. webidl.brandCheck(this, Headers)
  18696. return this[kHeadersList]
  18697. }
  18698. }
  18699. Headers.prototype[Symbol.iterator] = Headers.prototype.entries
  18700. Object.defineProperties(Headers.prototype, {
  18701. append: kEnumerableProperty,
  18702. delete: kEnumerableProperty,
  18703. get: kEnumerableProperty,
  18704. has: kEnumerableProperty,
  18705. set: kEnumerableProperty,
  18706. getSetCookie: kEnumerableProperty,
  18707. keys: kEnumerableProperty,
  18708. values: kEnumerableProperty,
  18709. entries: kEnumerableProperty,
  18710. forEach: kEnumerableProperty,
  18711. [Symbol.iterator]: { enumerable: false },
  18712. [Symbol.toStringTag]: {
  18713. value: 'Headers',
  18714. configurable: true
  18715. },
  18716. [util.inspect.custom]: {
  18717. enumerable: false
  18718. }
  18719. })
  18720. webidl.converters.HeadersInit = function (V) {
  18721. if (webidl.util.Type(V) === 'Object') {
  18722. if (V[Symbol.iterator]) {
  18723. return webidl.converters['sequence<sequence<ByteString>>'](V)
  18724. }
  18725. return webidl.converters['record<ByteString, ByteString>'](V)
  18726. }
  18727. throw webidl.errors.conversionFailed({
  18728. prefix: 'Headers constructor',
  18729. argument: 'Argument 1',
  18730. types: ['sequence<sequence<ByteString>>', 'record<ByteString, ByteString>']
  18731. })
  18732. }
  18733. module.exports = {
  18734. fill,
  18735. Headers,
  18736. HeadersList
  18737. }
  18738. /***/ }),
  18739. /***/ 4881:
  18740. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  18741. // https://github.com/Ethan-Arrowood/undici-fetch
  18742. const {
  18743. Response,
  18744. makeNetworkError,
  18745. makeAppropriateNetworkError,
  18746. filterResponse,
  18747. makeResponse
  18748. } = __nccwpck_require__(7823)
  18749. const { Headers } = __nccwpck_require__(554)
  18750. const { Request, makeRequest } = __nccwpck_require__(8359)
  18751. const zlib = __nccwpck_require__(9796)
  18752. const {
  18753. bytesMatch,
  18754. makePolicyContainer,
  18755. clonePolicyContainer,
  18756. requestBadPort,
  18757. TAOCheck,
  18758. appendRequestOriginHeader,
  18759. responseLocationURL,
  18760. requestCurrentURL,
  18761. setRequestReferrerPolicyOnRedirect,
  18762. tryUpgradeRequestToAPotentiallyTrustworthyURL,
  18763. createOpaqueTimingInfo,
  18764. appendFetchMetadata,
  18765. corsCheck,
  18766. crossOriginResourcePolicyCheck,
  18767. determineRequestsReferrer,
  18768. coarsenedSharedCurrentTime,
  18769. createDeferredPromise,
  18770. isBlobLike,
  18771. sameOrigin,
  18772. isCancelled,
  18773. isAborted,
  18774. isErrorLike,
  18775. fullyReadBody,
  18776. readableStreamClose,
  18777. isomorphicEncode,
  18778. urlIsLocal,
  18779. urlIsHttpHttpsScheme,
  18780. urlHasHttpsScheme
  18781. } = __nccwpck_require__(2538)
  18782. const { kState, kHeaders, kGuard, kRealm } = __nccwpck_require__(5861)
  18783. const assert = __nccwpck_require__(9491)
  18784. const { safelyExtractBody } = __nccwpck_require__(9990)
  18785. const {
  18786. redirectStatusSet,
  18787. nullBodyStatus,
  18788. safeMethodsSet,
  18789. requestBodyHeader,
  18790. subresourceSet,
  18791. DOMException
  18792. } = __nccwpck_require__(1037)
  18793. const { kHeadersList } = __nccwpck_require__(2785)
  18794. const EE = __nccwpck_require__(2361)
  18795. const { Readable, pipeline } = __nccwpck_require__(2781)
  18796. const { addAbortListener, isErrored, isReadable, nodeMajor, nodeMinor } = __nccwpck_require__(3983)
  18797. const { dataURLProcessor, serializeAMimeType } = __nccwpck_require__(685)
  18798. const { TransformStream } = __nccwpck_require__(5356)
  18799. const { getGlobalDispatcher } = __nccwpck_require__(1892)
  18800. const { webidl } = __nccwpck_require__(1744)
  18801. const { STATUS_CODES } = __nccwpck_require__(3685)
  18802. const GET_OR_HEAD = ['GET', 'HEAD']
  18803. /** @type {import('buffer').resolveObjectURL} */
  18804. let resolveObjectURL
  18805. let ReadableStream = globalThis.ReadableStream
  18806. class Fetch extends EE {
  18807. constructor (dispatcher) {
  18808. super()
  18809. this.dispatcher = dispatcher
  18810. this.connection = null
  18811. this.dump = false
  18812. this.state = 'ongoing'
  18813. // 2 terminated listeners get added per request,
  18814. // but only 1 gets removed. If there are 20 redirects,
  18815. // 21 listeners will be added.
  18816. // See https://github.com/nodejs/undici/issues/1711
  18817. // TODO (fix): Find and fix root cause for leaked listener.
  18818. this.setMaxListeners(21)
  18819. }
  18820. terminate (reason) {
  18821. if (this.state !== 'ongoing') {
  18822. return
  18823. }
  18824. this.state = 'terminated'
  18825. this.connection?.destroy(reason)
  18826. this.emit('terminated', reason)
  18827. }
  18828. // https://fetch.spec.whatwg.org/#fetch-controller-abort
  18829. abort (error) {
  18830. if (this.state !== 'ongoing') {
  18831. return
  18832. }
  18833. // 1. Set controller’s state to "aborted".
  18834. this.state = 'aborted'
  18835. // 2. Let fallbackError be an "AbortError" DOMException.
  18836. // 3. Set error to fallbackError if it is not given.
  18837. if (!error) {
  18838. error = new DOMException('The operation was aborted.', 'AbortError')
  18839. }
  18840. // 4. Let serializedError be StructuredSerialize(error).
  18841. // If that threw an exception, catch it, and let
  18842. // serializedError be StructuredSerialize(fallbackError).
  18843. // 5. Set controller’s serialized abort reason to serializedError.
  18844. this.serializedAbortReason = error
  18845. this.connection?.destroy(error)
  18846. this.emit('terminated', error)
  18847. }
  18848. }
  18849. // https://fetch.spec.whatwg.org/#fetch-method
  18850. function fetch (input, init = {}) {
  18851. webidl.argumentLengthCheck(arguments, 1, { header: 'globalThis.fetch' })
  18852. // 1. Let p be a new promise.
  18853. const p = createDeferredPromise()
  18854. // 2. Let requestObject be the result of invoking the initial value of
  18855. // Request as constructor with input and init as arguments. If this throws
  18856. // an exception, reject p with it and return p.
  18857. let requestObject
  18858. try {
  18859. requestObject = new Request(input, init)
  18860. } catch (e) {
  18861. p.reject(e)
  18862. return p.promise
  18863. }
  18864. // 3. Let request be requestObject’s request.
  18865. const request = requestObject[kState]
  18866. // 4. If requestObject’s signal’s aborted flag is set, then:
  18867. if (requestObject.signal.aborted) {
  18868. // 1. Abort the fetch() call with p, request, null, and
  18869. // requestObject’s signal’s abort reason.
  18870. abortFetch(p, request, null, requestObject.signal.reason)
  18871. // 2. Return p.
  18872. return p.promise
  18873. }
  18874. // 5. Let globalObject be request’s client’s global object.
  18875. const globalObject = request.client.globalObject
  18876. // 6. If globalObject is a ServiceWorkerGlobalScope object, then set
  18877. // request’s service-workers mode to "none".
  18878. if (globalObject?.constructor?.name === 'ServiceWorkerGlobalScope') {
  18879. request.serviceWorkers = 'none'
  18880. }
  18881. // 7. Let responseObject be null.
  18882. let responseObject = null
  18883. // 8. Let relevantRealm be this’s relevant Realm.
  18884. const relevantRealm = null
  18885. // 9. Let locallyAborted be false.
  18886. let locallyAborted = false
  18887. // 10. Let controller be null.
  18888. let controller = null
  18889. // 11. Add the following abort steps to requestObject’s signal:
  18890. addAbortListener(
  18891. requestObject.signal,
  18892. () => {
  18893. // 1. Set locallyAborted to true.
  18894. locallyAborted = true
  18895. // 2. Assert: controller is non-null.
  18896. assert(controller != null)
  18897. // 3. Abort controller with requestObject’s signal’s abort reason.
  18898. controller.abort(requestObject.signal.reason)
  18899. // 4. Abort the fetch() call with p, request, responseObject,
  18900. // and requestObject’s signal’s abort reason.
  18901. abortFetch(p, request, responseObject, requestObject.signal.reason)
  18902. }
  18903. )
  18904. // 12. Let handleFetchDone given response response be to finalize and
  18905. // report timing with response, globalObject, and "fetch".
  18906. const handleFetchDone = (response) =>
  18907. finalizeAndReportTiming(response, 'fetch')
  18908. // 13. Set controller to the result of calling fetch given request,
  18909. // with processResponseEndOfBody set to handleFetchDone, and processResponse
  18910. // given response being these substeps:
  18911. const processResponse = (response) => {
  18912. // 1. If locallyAborted is true, terminate these substeps.
  18913. if (locallyAborted) {
  18914. return Promise.resolve()
  18915. }
  18916. // 2. If response’s aborted flag is set, then:
  18917. if (response.aborted) {
  18918. // 1. Let deserializedError be the result of deserialize a serialized
  18919. // abort reason given controller’s serialized abort reason and
  18920. // relevantRealm.
  18921. // 2. Abort the fetch() call with p, request, responseObject, and
  18922. // deserializedError.
  18923. abortFetch(p, request, responseObject, controller.serializedAbortReason)
  18924. return Promise.resolve()
  18925. }
  18926. // 3. If response is a network error, then reject p with a TypeError
  18927. // and terminate these substeps.
  18928. if (response.type === 'error') {
  18929. p.reject(
  18930. Object.assign(new TypeError('fetch failed'), { cause: response.error })
  18931. )
  18932. return Promise.resolve()
  18933. }
  18934. // 4. Set responseObject to the result of creating a Response object,
  18935. // given response, "immutable", and relevantRealm.
  18936. responseObject = new Response()
  18937. responseObject[kState] = response
  18938. responseObject[kRealm] = relevantRealm
  18939. responseObject[kHeaders][kHeadersList] = response.headersList
  18940. responseObject[kHeaders][kGuard] = 'immutable'
  18941. responseObject[kHeaders][kRealm] = relevantRealm
  18942. // 5. Resolve p with responseObject.
  18943. p.resolve(responseObject)
  18944. }
  18945. controller = fetching({
  18946. request,
  18947. processResponseEndOfBody: handleFetchDone,
  18948. processResponse,
  18949. dispatcher: init.dispatcher ?? getGlobalDispatcher() // undici
  18950. })
  18951. // 14. Return p.
  18952. return p.promise
  18953. }
  18954. // https://fetch.spec.whatwg.org/#finalize-and-report-timing
  18955. function finalizeAndReportTiming (response, initiatorType = 'other') {
  18956. // 1. If response is an aborted network error, then return.
  18957. if (response.type === 'error' && response.aborted) {
  18958. return
  18959. }
  18960. // 2. If response’s URL list is null or empty, then return.
  18961. if (!response.urlList?.length) {
  18962. return
  18963. }
  18964. // 3. Let originalURL be response’s URL list[0].
  18965. const originalURL = response.urlList[0]
  18966. // 4. Let timingInfo be response’s timing info.
  18967. let timingInfo = response.timingInfo
  18968. // 5. Let cacheState be response’s cache state.
  18969. let cacheState = response.cacheState
  18970. // 6. If originalURL’s scheme is not an HTTP(S) scheme, then return.
  18971. if (!urlIsHttpHttpsScheme(originalURL)) {
  18972. return
  18973. }
  18974. // 7. If timingInfo is null, then return.
  18975. if (timingInfo === null) {
  18976. return
  18977. }
  18978. // 8. If response’s timing allow passed flag is not set, then:
  18979. if (!response.timingAllowPassed) {
  18980. // 1. Set timingInfo to a the result of creating an opaque timing info for timingInfo.
  18981. timingInfo = createOpaqueTimingInfo({
  18982. startTime: timingInfo.startTime
  18983. })
  18984. // 2. Set cacheState to the empty string.
  18985. cacheState = ''
  18986. }
  18987. // 9. Set timingInfo’s end time to the coarsened shared current time
  18988. // given global’s relevant settings object’s cross-origin isolated
  18989. // capability.
  18990. // TODO: given global’s relevant settings object’s cross-origin isolated
  18991. // capability?
  18992. timingInfo.endTime = coarsenedSharedCurrentTime()
  18993. // 10. Set response’s timing info to timingInfo.
  18994. response.timingInfo = timingInfo
  18995. // 11. Mark resource timing for timingInfo, originalURL, initiatorType,
  18996. // global, and cacheState.
  18997. markResourceTiming(
  18998. timingInfo,
  18999. originalURL,
  19000. initiatorType,
  19001. globalThis,
  19002. cacheState
  19003. )
  19004. }
  19005. // https://w3c.github.io/resource-timing/#dfn-mark-resource-timing
  19006. function markResourceTiming (timingInfo, originalURL, initiatorType, globalThis, cacheState) {
  19007. if (nodeMajor > 18 || (nodeMajor === 18 && nodeMinor >= 2)) {
  19008. performance.markResourceTiming(timingInfo, originalURL.href, initiatorType, globalThis, cacheState)
  19009. }
  19010. }
  19011. // https://fetch.spec.whatwg.org/#abort-fetch
  19012. function abortFetch (p, request, responseObject, error) {
  19013. // Note: AbortSignal.reason was added in node v17.2.0
  19014. // which would give us an undefined error to reject with.
  19015. // Remove this once node v16 is no longer supported.
  19016. if (!error) {
  19017. error = new DOMException('The operation was aborted.', 'AbortError')
  19018. }
  19019. // 1. Reject promise with error.
  19020. p.reject(error)
  19021. // 2. If request’s body is not null and is readable, then cancel request’s
  19022. // body with error.
  19023. if (request.body != null && isReadable(request.body?.stream)) {
  19024. request.body.stream.cancel(error).catch((err) => {
  19025. if (err.code === 'ERR_INVALID_STATE') {
  19026. // Node bug?
  19027. return
  19028. }
  19029. throw err
  19030. })
  19031. }
  19032. // 3. If responseObject is null, then return.
  19033. if (responseObject == null) {
  19034. return
  19035. }
  19036. // 4. Let response be responseObject’s response.
  19037. const response = responseObject[kState]
  19038. // 5. If response’s body is not null and is readable, then error response’s
  19039. // body with error.
  19040. if (response.body != null && isReadable(response.body?.stream)) {
  19041. response.body.stream.cancel(error).catch((err) => {
  19042. if (err.code === 'ERR_INVALID_STATE') {
  19043. // Node bug?
  19044. return
  19045. }
  19046. throw err
  19047. })
  19048. }
  19049. }
  19050. // https://fetch.spec.whatwg.org/#fetching
  19051. function fetching ({
  19052. request,
  19053. processRequestBodyChunkLength,
  19054. processRequestEndOfBody,
  19055. processResponse,
  19056. processResponseEndOfBody,
  19057. processResponseConsumeBody,
  19058. useParallelQueue = false,
  19059. dispatcher // undici
  19060. }) {
  19061. // 1. Let taskDestination be null.
  19062. let taskDestination = null
  19063. // 2. Let crossOriginIsolatedCapability be false.
  19064. let crossOriginIsolatedCapability = false
  19065. // 3. If request’s client is non-null, then:
  19066. if (request.client != null) {
  19067. // 1. Set taskDestination to request’s client’s global object.
  19068. taskDestination = request.client.globalObject
  19069. // 2. Set crossOriginIsolatedCapability to request’s client’s cross-origin
  19070. // isolated capability.
  19071. crossOriginIsolatedCapability =
  19072. request.client.crossOriginIsolatedCapability
  19073. }
  19074. // 4. If useParallelQueue is true, then set taskDestination to the result of
  19075. // starting a new parallel queue.
  19076. // TODO
  19077. // 5. Let timingInfo be a new fetch timing info whose start time and
  19078. // post-redirect start time are the coarsened shared current time given
  19079. // crossOriginIsolatedCapability.
  19080. const currenTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability)
  19081. const timingInfo = createOpaqueTimingInfo({
  19082. startTime: currenTime
  19083. })
  19084. // 6. Let fetchParams be a new fetch params whose
  19085. // request is request,
  19086. // timing info is timingInfo,
  19087. // process request body chunk length is processRequestBodyChunkLength,
  19088. // process request end-of-body is processRequestEndOfBody,
  19089. // process response is processResponse,
  19090. // process response consume body is processResponseConsumeBody,
  19091. // process response end-of-body is processResponseEndOfBody,
  19092. // task destination is taskDestination,
  19093. // and cross-origin isolated capability is crossOriginIsolatedCapability.
  19094. const fetchParams = {
  19095. controller: new Fetch(dispatcher),
  19096. request,
  19097. timingInfo,
  19098. processRequestBodyChunkLength,
  19099. processRequestEndOfBody,
  19100. processResponse,
  19101. processResponseConsumeBody,
  19102. processResponseEndOfBody,
  19103. taskDestination,
  19104. crossOriginIsolatedCapability
  19105. }
  19106. // 7. If request’s body is a byte sequence, then set request’s body to
  19107. // request’s body as a body.
  19108. // NOTE: Since fetching is only called from fetch, body should already be
  19109. // extracted.
  19110. assert(!request.body || request.body.stream)
  19111. // 8. If request’s window is "client", then set request’s window to request’s
  19112. // client, if request’s client’s global object is a Window object; otherwise
  19113. // "no-window".
  19114. if (request.window === 'client') {
  19115. // TODO: What if request.client is null?
  19116. request.window =
  19117. request.client?.globalObject?.constructor?.name === 'Window'
  19118. ? request.client
  19119. : 'no-window'
  19120. }
  19121. // 9. If request’s origin is "client", then set request’s origin to request’s
  19122. // client’s origin.
  19123. if (request.origin === 'client') {
  19124. // TODO: What if request.client is null?
  19125. request.origin = request.client?.origin
  19126. }
  19127. // 10. If all of the following conditions are true:
  19128. // TODO
  19129. // 11. If request’s policy container is "client", then:
  19130. if (request.policyContainer === 'client') {
  19131. // 1. If request’s client is non-null, then set request’s policy
  19132. // container to a clone of request’s client’s policy container. [HTML]
  19133. if (request.client != null) {
  19134. request.policyContainer = clonePolicyContainer(
  19135. request.client.policyContainer
  19136. )
  19137. } else {
  19138. // 2. Otherwise, set request’s policy container to a new policy
  19139. // container.
  19140. request.policyContainer = makePolicyContainer()
  19141. }
  19142. }
  19143. // 12. If request’s header list does not contain `Accept`, then:
  19144. if (!request.headersList.contains('accept')) {
  19145. // 1. Let value be `*/*`.
  19146. const value = '*/*'
  19147. // 2. A user agent should set value to the first matching statement, if
  19148. // any, switching on request’s destination:
  19149. // "document"
  19150. // "frame"
  19151. // "iframe"
  19152. // `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8`
  19153. // "image"
  19154. // `image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5`
  19155. // "style"
  19156. // `text/css,*/*;q=0.1`
  19157. // TODO
  19158. // 3. Append `Accept`/value to request’s header list.
  19159. request.headersList.append('accept', value)
  19160. }
  19161. // 13. If request’s header list does not contain `Accept-Language`, then
  19162. // user agents should append `Accept-Language`/an appropriate value to
  19163. // request’s header list.
  19164. if (!request.headersList.contains('accept-language')) {
  19165. request.headersList.append('accept-language', '*')
  19166. }
  19167. // 14. If request’s priority is null, then use request’s initiator and
  19168. // destination appropriately in setting request’s priority to a
  19169. // user-agent-defined object.
  19170. if (request.priority === null) {
  19171. // TODO
  19172. }
  19173. // 15. If request is a subresource request, then:
  19174. if (subresourceSet.has(request.destination)) {
  19175. // TODO
  19176. }
  19177. // 16. Run main fetch given fetchParams.
  19178. mainFetch(fetchParams)
  19179. .catch(err => {
  19180. fetchParams.controller.terminate(err)
  19181. })
  19182. // 17. Return fetchParam's controller
  19183. return fetchParams.controller
  19184. }
  19185. // https://fetch.spec.whatwg.org/#concept-main-fetch
  19186. async function mainFetch (fetchParams, recursive = false) {
  19187. // 1. Let request be fetchParams’s request.
  19188. const request = fetchParams.request
  19189. // 2. Let response be null.
  19190. let response = null
  19191. // 3. If request’s local-URLs-only flag is set and request’s current URL is
  19192. // not local, then set response to a network error.
  19193. if (request.localURLsOnly && !urlIsLocal(requestCurrentURL(request))) {
  19194. response = makeNetworkError('local URLs only')
  19195. }
  19196. // 4. Run report Content Security Policy violations for request.
  19197. // TODO
  19198. // 5. Upgrade request to a potentially trustworthy URL, if appropriate.
  19199. tryUpgradeRequestToAPotentiallyTrustworthyURL(request)
  19200. // 6. If should request be blocked due to a bad port, should fetching request
  19201. // be blocked as mixed content, or should request be blocked by Content
  19202. // Security Policy returns blocked, then set response to a network error.
  19203. if (requestBadPort(request) === 'blocked') {
  19204. response = makeNetworkError('bad port')
  19205. }
  19206. // TODO: should fetching request be blocked as mixed content?
  19207. // TODO: should request be blocked by Content Security Policy?
  19208. // 7. If request’s referrer policy is the empty string, then set request’s
  19209. // referrer policy to request’s policy container’s referrer policy.
  19210. if (request.referrerPolicy === '') {
  19211. request.referrerPolicy = request.policyContainer.referrerPolicy
  19212. }
  19213. // 8. If request’s referrer is not "no-referrer", then set request’s
  19214. // referrer to the result of invoking determine request’s referrer.
  19215. if (request.referrer !== 'no-referrer') {
  19216. request.referrer = determineRequestsReferrer(request)
  19217. }
  19218. // 9. Set request’s current URL’s scheme to "https" if all of the following
  19219. // conditions are true:
  19220. // - request’s current URL’s scheme is "http"
  19221. // - request’s current URL’s host is a domain
  19222. // - Matching request’s current URL’s host per Known HSTS Host Domain Name
  19223. // Matching results in either a superdomain match with an asserted
  19224. // includeSubDomains directive or a congruent match (with or without an
  19225. // asserted includeSubDomains directive). [HSTS]
  19226. // TODO
  19227. // 10. If recursive is false, then run the remaining steps in parallel.
  19228. // TODO
  19229. // 11. If response is null, then set response to the result of running
  19230. // the steps corresponding to the first matching statement:
  19231. if (response === null) {
  19232. response = await (async () => {
  19233. const currentURL = requestCurrentURL(request)
  19234. if (
  19235. // - request’s current URL’s origin is same origin with request’s origin,
  19236. // and request’s response tainting is "basic"
  19237. (sameOrigin(currentURL, request.url) && request.responseTainting === 'basic') ||
  19238. // request’s current URL’s scheme is "data"
  19239. (currentURL.protocol === 'data:') ||
  19240. // - request’s mode is "navigate" or "websocket"
  19241. (request.mode === 'navigate' || request.mode === 'websocket')
  19242. ) {
  19243. // 1. Set request’s response tainting to "basic".
  19244. request.responseTainting = 'basic'
  19245. // 2. Return the result of running scheme fetch given fetchParams.
  19246. return await schemeFetch(fetchParams)
  19247. }
  19248. // request’s mode is "same-origin"
  19249. if (request.mode === 'same-origin') {
  19250. // 1. Return a network error.
  19251. return makeNetworkError('request mode cannot be "same-origin"')
  19252. }
  19253. // request’s mode is "no-cors"
  19254. if (request.mode === 'no-cors') {
  19255. // 1. If request’s redirect mode is not "follow", then return a network
  19256. // error.
  19257. if (request.redirect !== 'follow') {
  19258. return makeNetworkError(
  19259. 'redirect mode cannot be "follow" for "no-cors" request'
  19260. )
  19261. }
  19262. // 2. Set request’s response tainting to "opaque".
  19263. request.responseTainting = 'opaque'
  19264. // 3. Return the result of running scheme fetch given fetchParams.
  19265. return await schemeFetch(fetchParams)
  19266. }
  19267. // request’s current URL’s scheme is not an HTTP(S) scheme
  19268. if (!urlIsHttpHttpsScheme(requestCurrentURL(request))) {
  19269. // Return a network error.
  19270. return makeNetworkError('URL scheme must be a HTTP(S) scheme')
  19271. }
  19272. // - request’s use-CORS-preflight flag is set
  19273. // - request’s unsafe-request flag is set and either request’s method is
  19274. // not a CORS-safelisted method or CORS-unsafe request-header names with
  19275. // request’s header list is not empty
  19276. // 1. Set request’s response tainting to "cors".
  19277. // 2. Let corsWithPreflightResponse be the result of running HTTP fetch
  19278. // given fetchParams and true.
  19279. // 3. If corsWithPreflightResponse is a network error, then clear cache
  19280. // entries using request.
  19281. // 4. Return corsWithPreflightResponse.
  19282. // TODO
  19283. // Otherwise
  19284. // 1. Set request’s response tainting to "cors".
  19285. request.responseTainting = 'cors'
  19286. // 2. Return the result of running HTTP fetch given fetchParams.
  19287. return await httpFetch(fetchParams)
  19288. })()
  19289. }
  19290. // 12. If recursive is true, then return response.
  19291. if (recursive) {
  19292. return response
  19293. }
  19294. // 13. If response is not a network error and response is not a filtered
  19295. // response, then:
  19296. if (response.status !== 0 && !response.internalResponse) {
  19297. // If request’s response tainting is "cors", then:
  19298. if (request.responseTainting === 'cors') {
  19299. // 1. Let headerNames be the result of extracting header list values
  19300. // given `Access-Control-Expose-Headers` and response’s header list.
  19301. // TODO
  19302. // 2. If request’s credentials mode is not "include" and headerNames
  19303. // contains `*`, then set response’s CORS-exposed header-name list to
  19304. // all unique header names in response’s header list.
  19305. // TODO
  19306. // 3. Otherwise, if headerNames is not null or failure, then set
  19307. // response’s CORS-exposed header-name list to headerNames.
  19308. // TODO
  19309. }
  19310. // Set response to the following filtered response with response as its
  19311. // internal response, depending on request’s response tainting:
  19312. if (request.responseTainting === 'basic') {
  19313. response = filterResponse(response, 'basic')
  19314. } else if (request.responseTainting === 'cors') {
  19315. response = filterResponse(response, 'cors')
  19316. } else if (request.responseTainting === 'opaque') {
  19317. response = filterResponse(response, 'opaque')
  19318. } else {
  19319. assert(false)
  19320. }
  19321. }
  19322. // 14. Let internalResponse be response, if response is a network error,
  19323. // and response’s internal response otherwise.
  19324. let internalResponse =
  19325. response.status === 0 ? response : response.internalResponse
  19326. // 15. If internalResponse’s URL list is empty, then set it to a clone of
  19327. // request’s URL list.
  19328. if (internalResponse.urlList.length === 0) {
  19329. internalResponse.urlList.push(...request.urlList)
  19330. }
  19331. // 16. If request’s timing allow failed flag is unset, then set
  19332. // internalResponse’s timing allow passed flag.
  19333. if (!request.timingAllowFailed) {
  19334. response.timingAllowPassed = true
  19335. }
  19336. // 17. If response is not a network error and any of the following returns
  19337. // blocked
  19338. // - should internalResponse to request be blocked as mixed content
  19339. // - should internalResponse to request be blocked by Content Security Policy
  19340. // - should internalResponse to request be blocked due to its MIME type
  19341. // - should internalResponse to request be blocked due to nosniff
  19342. // TODO
  19343. // 18. If response’s type is "opaque", internalResponse’s status is 206,
  19344. // internalResponse’s range-requested flag is set, and request’s header
  19345. // list does not contain `Range`, then set response and internalResponse
  19346. // to a network error.
  19347. if (
  19348. response.type === 'opaque' &&
  19349. internalResponse.status === 206 &&
  19350. internalResponse.rangeRequested &&
  19351. !request.headers.contains('range')
  19352. ) {
  19353. response = internalResponse = makeNetworkError()
  19354. }
  19355. // 19. If response is not a network error and either request’s method is
  19356. // `HEAD` or `CONNECT`, or internalResponse’s status is a null body status,
  19357. // set internalResponse’s body to null and disregard any enqueuing toward
  19358. // it (if any).
  19359. if (
  19360. response.status !== 0 &&
  19361. (request.method === 'HEAD' ||
  19362. request.method === 'CONNECT' ||
  19363. nullBodyStatus.includes(internalResponse.status))
  19364. ) {
  19365. internalResponse.body = null
  19366. fetchParams.controller.dump = true
  19367. }
  19368. // 20. If request’s integrity metadata is not the empty string, then:
  19369. if (request.integrity) {
  19370. // 1. Let processBodyError be this step: run fetch finale given fetchParams
  19371. // and a network error.
  19372. const processBodyError = (reason) =>
  19373. fetchFinale(fetchParams, makeNetworkError(reason))
  19374. // 2. If request’s response tainting is "opaque", or response’s body is null,
  19375. // then run processBodyError and abort these steps.
  19376. if (request.responseTainting === 'opaque' || response.body == null) {
  19377. processBodyError(response.error)
  19378. return
  19379. }
  19380. // 3. Let processBody given bytes be these steps:
  19381. const processBody = (bytes) => {
  19382. // 1. If bytes do not match request’s integrity metadata,
  19383. // then run processBodyError and abort these steps. [SRI]
  19384. if (!bytesMatch(bytes, request.integrity)) {
  19385. processBodyError('integrity mismatch')
  19386. return
  19387. }
  19388. // 2. Set response’s body to bytes as a body.
  19389. response.body = safelyExtractBody(bytes)[0]
  19390. // 3. Run fetch finale given fetchParams and response.
  19391. fetchFinale(fetchParams, response)
  19392. }
  19393. // 4. Fully read response’s body given processBody and processBodyError.
  19394. await fullyReadBody(response.body, processBody, processBodyError)
  19395. } else {
  19396. // 21. Otherwise, run fetch finale given fetchParams and response.
  19397. fetchFinale(fetchParams, response)
  19398. }
  19399. }
  19400. // https://fetch.spec.whatwg.org/#concept-scheme-fetch
  19401. // given a fetch params fetchParams
  19402. function schemeFetch (fetchParams) {
  19403. // Note: since the connection is destroyed on redirect, which sets fetchParams to a
  19404. // cancelled state, we do not want this condition to trigger *unless* there have been
  19405. // no redirects. See https://github.com/nodejs/undici/issues/1776
  19406. // 1. If fetchParams is canceled, then return the appropriate network error for fetchParams.
  19407. if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) {
  19408. return Promise.resolve(makeAppropriateNetworkError(fetchParams))
  19409. }
  19410. // 2. Let request be fetchParams’s request.
  19411. const { request } = fetchParams
  19412. const { protocol: scheme } = requestCurrentURL(request)
  19413. // 3. Switch on request’s current URL’s scheme and run the associated steps:
  19414. switch (scheme) {
  19415. case 'about:': {
  19416. // If request’s current URL’s path is the string "blank", then return a new response
  19417. // whose status message is `OK`, header list is « (`Content-Type`, `text/html;charset=utf-8`) »,
  19418. // and body is the empty byte sequence as a body.
  19419. // Otherwise, return a network error.
  19420. return Promise.resolve(makeNetworkError('about scheme is not supported'))
  19421. }
  19422. case 'blob:': {
  19423. if (!resolveObjectURL) {
  19424. resolveObjectURL = (__nccwpck_require__(4300).resolveObjectURL)
  19425. }
  19426. // 1. Let blobURLEntry be request’s current URL’s blob URL entry.
  19427. const blobURLEntry = requestCurrentURL(request)
  19428. // https://github.com/web-platform-tests/wpt/blob/7b0ebaccc62b566a1965396e5be7bb2bc06f841f/FileAPI/url/resources/fetch-tests.js#L52-L56
  19429. // Buffer.resolveObjectURL does not ignore URL queries.
  19430. if (blobURLEntry.search.length !== 0) {
  19431. return Promise.resolve(makeNetworkError('NetworkError when attempting to fetch resource.'))
  19432. }
  19433. const blobURLEntryObject = resolveObjectURL(blobURLEntry.toString())
  19434. // 2. If request’s method is not `GET`, blobURLEntry is null, or blobURLEntry’s
  19435. // object is not a Blob object, then return a network error.
  19436. if (request.method !== 'GET' || !isBlobLike(blobURLEntryObject)) {
  19437. return Promise.resolve(makeNetworkError('invalid method'))
  19438. }
  19439. // 3. Let bodyWithType be the result of safely extracting blobURLEntry’s object.
  19440. const bodyWithType = safelyExtractBody(blobURLEntryObject)
  19441. // 4. Let body be bodyWithType’s body.
  19442. const body = bodyWithType[0]
  19443. // 5. Let length be body’s length, serialized and isomorphic encoded.
  19444. const length = isomorphicEncode(`${body.length}`)
  19445. // 6. Let type be bodyWithType’s type if it is non-null; otherwise the empty byte sequence.
  19446. const type = bodyWithType[1] ?? ''
  19447. // 7. Return a new response whose status message is `OK`, header list is
  19448. // « (`Content-Length`, length), (`Content-Type`, type) », and body is body.
  19449. const response = makeResponse({
  19450. statusText: 'OK',
  19451. headersList: [
  19452. ['content-length', { name: 'Content-Length', value: length }],
  19453. ['content-type', { name: 'Content-Type', value: type }]
  19454. ]
  19455. })
  19456. response.body = body
  19457. return Promise.resolve(response)
  19458. }
  19459. case 'data:': {
  19460. // 1. Let dataURLStruct be the result of running the
  19461. // data: URL processor on request’s current URL.
  19462. const currentURL = requestCurrentURL(request)
  19463. const dataURLStruct = dataURLProcessor(currentURL)
  19464. // 2. If dataURLStruct is failure, then return a
  19465. // network error.
  19466. if (dataURLStruct === 'failure') {
  19467. return Promise.resolve(makeNetworkError('failed to fetch the data URL'))
  19468. }
  19469. // 3. Let mimeType be dataURLStruct’s MIME type, serialized.
  19470. const mimeType = serializeAMimeType(dataURLStruct.mimeType)
  19471. // 4. Return a response whose status message is `OK`,
  19472. // header list is « (`Content-Type`, mimeType) »,
  19473. // and body is dataURLStruct’s body as a body.
  19474. return Promise.resolve(makeResponse({
  19475. statusText: 'OK',
  19476. headersList: [
  19477. ['content-type', { name: 'Content-Type', value: mimeType }]
  19478. ],
  19479. body: safelyExtractBody(dataURLStruct.body)[0]
  19480. }))
  19481. }
  19482. case 'file:': {
  19483. // For now, unfortunate as it is, file URLs are left as an exercise for the reader.
  19484. // When in doubt, return a network error.
  19485. return Promise.resolve(makeNetworkError('not implemented... yet...'))
  19486. }
  19487. case 'http:':
  19488. case 'https:': {
  19489. // Return the result of running HTTP fetch given fetchParams.
  19490. return httpFetch(fetchParams)
  19491. .catch((err) => makeNetworkError(err))
  19492. }
  19493. default: {
  19494. return Promise.resolve(makeNetworkError('unknown scheme'))
  19495. }
  19496. }
  19497. }
  19498. // https://fetch.spec.whatwg.org/#finalize-response
  19499. function finalizeResponse (fetchParams, response) {
  19500. // 1. Set fetchParams’s request’s done flag.
  19501. fetchParams.request.done = true
  19502. // 2, If fetchParams’s process response done is not null, then queue a fetch
  19503. // task to run fetchParams’s process response done given response, with
  19504. // fetchParams’s task destination.
  19505. if (fetchParams.processResponseDone != null) {
  19506. queueMicrotask(() => fetchParams.processResponseDone(response))
  19507. }
  19508. }
  19509. // https://fetch.spec.whatwg.org/#fetch-finale
  19510. function fetchFinale (fetchParams, response) {
  19511. // 1. If response is a network error, then:
  19512. if (response.type === 'error') {
  19513. // 1. Set response’s URL list to « fetchParams’s request’s URL list[0] ».
  19514. response.urlList = [fetchParams.request.urlList[0]]
  19515. // 2. Set response’s timing info to the result of creating an opaque timing
  19516. // info for fetchParams’s timing info.
  19517. response.timingInfo = createOpaqueTimingInfo({
  19518. startTime: fetchParams.timingInfo.startTime
  19519. })
  19520. }
  19521. // 2. Let processResponseEndOfBody be the following steps:
  19522. const processResponseEndOfBody = () => {
  19523. // 1. Set fetchParams’s request’s done flag.
  19524. fetchParams.request.done = true
  19525. // If fetchParams’s process response end-of-body is not null,
  19526. // then queue a fetch task to run fetchParams’s process response
  19527. // end-of-body given response with fetchParams’s task destination.
  19528. if (fetchParams.processResponseEndOfBody != null) {
  19529. queueMicrotask(() => fetchParams.processResponseEndOfBody(response))
  19530. }
  19531. }
  19532. // 3. If fetchParams’s process response is non-null, then queue a fetch task
  19533. // to run fetchParams’s process response given response, with fetchParams’s
  19534. // task destination.
  19535. if (fetchParams.processResponse != null) {
  19536. queueMicrotask(() => fetchParams.processResponse(response))
  19537. }
  19538. // 4. If response’s body is null, then run processResponseEndOfBody.
  19539. if (response.body == null) {
  19540. processResponseEndOfBody()
  19541. } else {
  19542. // 5. Otherwise:
  19543. // 1. Let transformStream be a new a TransformStream.
  19544. // 2. Let identityTransformAlgorithm be an algorithm which, given chunk,
  19545. // enqueues chunk in transformStream.
  19546. const identityTransformAlgorithm = (chunk, controller) => {
  19547. controller.enqueue(chunk)
  19548. }
  19549. // 3. Set up transformStream with transformAlgorithm set to identityTransformAlgorithm
  19550. // and flushAlgorithm set to processResponseEndOfBody.
  19551. const transformStream = new TransformStream({
  19552. start () {},
  19553. transform: identityTransformAlgorithm,
  19554. flush: processResponseEndOfBody
  19555. }, {
  19556. size () {
  19557. return 1
  19558. }
  19559. }, {
  19560. size () {
  19561. return 1
  19562. }
  19563. })
  19564. // 4. Set response’s body to the result of piping response’s body through transformStream.
  19565. response.body = { stream: response.body.stream.pipeThrough(transformStream) }
  19566. }
  19567. // 6. If fetchParams’s process response consume body is non-null, then:
  19568. if (fetchParams.processResponseConsumeBody != null) {
  19569. // 1. Let processBody given nullOrBytes be this step: run fetchParams’s
  19570. // process response consume body given response and nullOrBytes.
  19571. const processBody = (nullOrBytes) => fetchParams.processResponseConsumeBody(response, nullOrBytes)
  19572. // 2. Let processBodyError be this step: run fetchParams’s process
  19573. // response consume body given response and failure.
  19574. const processBodyError = (failure) => fetchParams.processResponseConsumeBody(response, failure)
  19575. // 3. If response’s body is null, then queue a fetch task to run processBody
  19576. // given null, with fetchParams’s task destination.
  19577. if (response.body == null) {
  19578. queueMicrotask(() => processBody(null))
  19579. } else {
  19580. // 4. Otherwise, fully read response’s body given processBody, processBodyError,
  19581. // and fetchParams’s task destination.
  19582. return fullyReadBody(response.body, processBody, processBodyError)
  19583. }
  19584. return Promise.resolve()
  19585. }
  19586. }
  19587. // https://fetch.spec.whatwg.org/#http-fetch
  19588. async function httpFetch (fetchParams) {
  19589. // 1. Let request be fetchParams’s request.
  19590. const request = fetchParams.request
  19591. // 2. Let response be null.
  19592. let response = null
  19593. // 3. Let actualResponse be null.
  19594. let actualResponse = null
  19595. // 4. Let timingInfo be fetchParams’s timing info.
  19596. const timingInfo = fetchParams.timingInfo
  19597. // 5. If request’s service-workers mode is "all", then:
  19598. if (request.serviceWorkers === 'all') {
  19599. // TODO
  19600. }
  19601. // 6. If response is null, then:
  19602. if (response === null) {
  19603. // 1. If makeCORSPreflight is true and one of these conditions is true:
  19604. // TODO
  19605. // 2. If request’s redirect mode is "follow", then set request’s
  19606. // service-workers mode to "none".
  19607. if (request.redirect === 'follow') {
  19608. request.serviceWorkers = 'none'
  19609. }
  19610. // 3. Set response and actualResponse to the result of running
  19611. // HTTP-network-or-cache fetch given fetchParams.
  19612. actualResponse = response = await httpNetworkOrCacheFetch(fetchParams)
  19613. // 4. If request’s response tainting is "cors" and a CORS check
  19614. // for request and response returns failure, then return a network error.
  19615. if (
  19616. request.responseTainting === 'cors' &&
  19617. corsCheck(request, response) === 'failure'
  19618. ) {
  19619. return makeNetworkError('cors failure')
  19620. }
  19621. // 5. If the TAO check for request and response returns failure, then set
  19622. // request’s timing allow failed flag.
  19623. if (TAOCheck(request, response) === 'failure') {
  19624. request.timingAllowFailed = true
  19625. }
  19626. }
  19627. // 7. If either request’s response tainting or response’s type
  19628. // is "opaque", and the cross-origin resource policy check with
  19629. // request’s origin, request’s client, request’s destination,
  19630. // and actualResponse returns blocked, then return a network error.
  19631. if (
  19632. (request.responseTainting === 'opaque' || response.type === 'opaque') &&
  19633. crossOriginResourcePolicyCheck(
  19634. request.origin,
  19635. request.client,
  19636. request.destination,
  19637. actualResponse
  19638. ) === 'blocked'
  19639. ) {
  19640. return makeNetworkError('blocked')
  19641. }
  19642. // 8. If actualResponse’s status is a redirect status, then:
  19643. if (redirectStatusSet.has(actualResponse.status)) {
  19644. // 1. If actualResponse’s status is not 303, request’s body is not null,
  19645. // and the connection uses HTTP/2, then user agents may, and are even
  19646. // encouraged to, transmit an RST_STREAM frame.
  19647. // See, https://github.com/whatwg/fetch/issues/1288
  19648. if (request.redirect !== 'manual') {
  19649. fetchParams.controller.connection.destroy()
  19650. }
  19651. // 2. Switch on request’s redirect mode:
  19652. if (request.redirect === 'error') {
  19653. // Set response to a network error.
  19654. response = makeNetworkError('unexpected redirect')
  19655. } else if (request.redirect === 'manual') {
  19656. // Set response to an opaque-redirect filtered response whose internal
  19657. // response is actualResponse.
  19658. // NOTE(spec): On the web this would return an `opaqueredirect` response,
  19659. // but that doesn't make sense server side.
  19660. // See https://github.com/nodejs/undici/issues/1193.
  19661. response = actualResponse
  19662. } else if (request.redirect === 'follow') {
  19663. // Set response to the result of running HTTP-redirect fetch given
  19664. // fetchParams and response.
  19665. response = await httpRedirectFetch(fetchParams, response)
  19666. } else {
  19667. assert(false)
  19668. }
  19669. }
  19670. // 9. Set response’s timing info to timingInfo.
  19671. response.timingInfo = timingInfo
  19672. // 10. Return response.
  19673. return response
  19674. }
  19675. // https://fetch.spec.whatwg.org/#http-redirect-fetch
  19676. function httpRedirectFetch (fetchParams, response) {
  19677. // 1. Let request be fetchParams’s request.
  19678. const request = fetchParams.request
  19679. // 2. Let actualResponse be response, if response is not a filtered response,
  19680. // and response’s internal response otherwise.
  19681. const actualResponse = response.internalResponse
  19682. ? response.internalResponse
  19683. : response
  19684. // 3. Let locationURL be actualResponse’s location URL given request’s current
  19685. // URL’s fragment.
  19686. let locationURL
  19687. try {
  19688. locationURL = responseLocationURL(
  19689. actualResponse,
  19690. requestCurrentURL(request).hash
  19691. )
  19692. // 4. If locationURL is null, then return response.
  19693. if (locationURL == null) {
  19694. return response
  19695. }
  19696. } catch (err) {
  19697. // 5. If locationURL is failure, then return a network error.
  19698. return Promise.resolve(makeNetworkError(err))
  19699. }
  19700. // 6. If locationURL’s scheme is not an HTTP(S) scheme, then return a network
  19701. // error.
  19702. if (!urlIsHttpHttpsScheme(locationURL)) {
  19703. return Promise.resolve(makeNetworkError('URL scheme must be a HTTP(S) scheme'))
  19704. }
  19705. // 7. If request’s redirect count is 20, then return a network error.
  19706. if (request.redirectCount === 20) {
  19707. return Promise.resolve(makeNetworkError('redirect count exceeded'))
  19708. }
  19709. // 8. Increase request’s redirect count by 1.
  19710. request.redirectCount += 1
  19711. // 9. If request’s mode is "cors", locationURL includes credentials, and
  19712. // request’s origin is not same origin with locationURL’s origin, then return
  19713. // a network error.
  19714. if (
  19715. request.mode === 'cors' &&
  19716. (locationURL.username || locationURL.password) &&
  19717. !sameOrigin(request, locationURL)
  19718. ) {
  19719. return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"'))
  19720. }
  19721. // 10. If request’s response tainting is "cors" and locationURL includes
  19722. // credentials, then return a network error.
  19723. if (
  19724. request.responseTainting === 'cors' &&
  19725. (locationURL.username || locationURL.password)
  19726. ) {
  19727. return Promise.resolve(makeNetworkError(
  19728. 'URL cannot contain credentials for request mode "cors"'
  19729. ))
  19730. }
  19731. // 11. If actualResponse’s status is not 303, request’s body is non-null,
  19732. // and request’s body’s source is null, then return a network error.
  19733. if (
  19734. actualResponse.status !== 303 &&
  19735. request.body != null &&
  19736. request.body.source == null
  19737. ) {
  19738. return Promise.resolve(makeNetworkError())
  19739. }
  19740. // 12. If one of the following is true
  19741. // - actualResponse’s status is 301 or 302 and request’s method is `POST`
  19742. // - actualResponse’s status is 303 and request’s method is not `GET` or `HEAD`
  19743. if (
  19744. ([301, 302].includes(actualResponse.status) && request.method === 'POST') ||
  19745. (actualResponse.status === 303 &&
  19746. !GET_OR_HEAD.includes(request.method))
  19747. ) {
  19748. // then:
  19749. // 1. Set request’s method to `GET` and request’s body to null.
  19750. request.method = 'GET'
  19751. request.body = null
  19752. // 2. For each headerName of request-body-header name, delete headerName from
  19753. // request’s header list.
  19754. for (const headerName of requestBodyHeader) {
  19755. request.headersList.delete(headerName)
  19756. }
  19757. }
  19758. // 13. If request’s current URL’s origin is not same origin with locationURL’s
  19759. // origin, then for each headerName of CORS non-wildcard request-header name,
  19760. // delete headerName from request’s header list.
  19761. if (!sameOrigin(requestCurrentURL(request), locationURL)) {
  19762. // https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name
  19763. request.headersList.delete('authorization')
  19764. // https://fetch.spec.whatwg.org/#authentication-entries
  19765. request.headersList.delete('proxy-authorization', true)
  19766. // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement.
  19767. request.headersList.delete('cookie')
  19768. request.headersList.delete('host')
  19769. }
  19770. // 14. If request’s body is non-null, then set request’s body to the first return
  19771. // value of safely extracting request’s body’s source.
  19772. if (request.body != null) {
  19773. assert(request.body.source != null)
  19774. request.body = safelyExtractBody(request.body.source)[0]
  19775. }
  19776. // 15. Let timingInfo be fetchParams’s timing info.
  19777. const timingInfo = fetchParams.timingInfo
  19778. // 16. Set timingInfo’s redirect end time and post-redirect start time to the
  19779. // coarsened shared current time given fetchParams’s cross-origin isolated
  19780. // capability.
  19781. timingInfo.redirectEndTime = timingInfo.postRedirectStartTime =
  19782. coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability)
  19783. // 17. If timingInfo’s redirect start time is 0, then set timingInfo’s
  19784. // redirect start time to timingInfo’s start time.
  19785. if (timingInfo.redirectStartTime === 0) {
  19786. timingInfo.redirectStartTime = timingInfo.startTime
  19787. }
  19788. // 18. Append locationURL to request’s URL list.
  19789. request.urlList.push(locationURL)
  19790. // 19. Invoke set request’s referrer policy on redirect on request and
  19791. // actualResponse.
  19792. setRequestReferrerPolicyOnRedirect(request, actualResponse)
  19793. // 20. Return the result of running main fetch given fetchParams and true.
  19794. return mainFetch(fetchParams, true)
  19795. }
  19796. // https://fetch.spec.whatwg.org/#http-network-or-cache-fetch
  19797. async function httpNetworkOrCacheFetch (
  19798. fetchParams,
  19799. isAuthenticationFetch = false,
  19800. isNewConnectionFetch = false
  19801. ) {
  19802. // 1. Let request be fetchParams’s request.
  19803. const request = fetchParams.request
  19804. // 2. Let httpFetchParams be null.
  19805. let httpFetchParams = null
  19806. // 3. Let httpRequest be null.
  19807. let httpRequest = null
  19808. // 4. Let response be null.
  19809. let response = null
  19810. // 5. Let storedResponse be null.
  19811. // TODO: cache
  19812. // 6. Let httpCache be null.
  19813. const httpCache = null
  19814. // 7. Let the revalidatingFlag be unset.
  19815. const revalidatingFlag = false
  19816. // 8. Run these steps, but abort when the ongoing fetch is terminated:
  19817. // 1. If request’s window is "no-window" and request’s redirect mode is
  19818. // "error", then set httpFetchParams to fetchParams and httpRequest to
  19819. // request.
  19820. if (request.window === 'no-window' && request.redirect === 'error') {
  19821. httpFetchParams = fetchParams
  19822. httpRequest = request
  19823. } else {
  19824. // Otherwise:
  19825. // 1. Set httpRequest to a clone of request.
  19826. httpRequest = makeRequest(request)
  19827. // 2. Set httpFetchParams to a copy of fetchParams.
  19828. httpFetchParams = { ...fetchParams }
  19829. // 3. Set httpFetchParams’s request to httpRequest.
  19830. httpFetchParams.request = httpRequest
  19831. }
  19832. // 3. Let includeCredentials be true if one of
  19833. const includeCredentials =
  19834. request.credentials === 'include' ||
  19835. (request.credentials === 'same-origin' &&
  19836. request.responseTainting === 'basic')
  19837. // 4. Let contentLength be httpRequest’s body’s length, if httpRequest’s
  19838. // body is non-null; otherwise null.
  19839. const contentLength = httpRequest.body ? httpRequest.body.length : null
  19840. // 5. Let contentLengthHeaderValue be null.
  19841. let contentLengthHeaderValue = null
  19842. // 6. If httpRequest’s body is null and httpRequest’s method is `POST` or
  19843. // `PUT`, then set contentLengthHeaderValue to `0`.
  19844. if (
  19845. httpRequest.body == null &&
  19846. ['POST', 'PUT'].includes(httpRequest.method)
  19847. ) {
  19848. contentLengthHeaderValue = '0'
  19849. }
  19850. // 7. If contentLength is non-null, then set contentLengthHeaderValue to
  19851. // contentLength, serialized and isomorphic encoded.
  19852. if (contentLength != null) {
  19853. contentLengthHeaderValue = isomorphicEncode(`${contentLength}`)
  19854. }
  19855. // 8. If contentLengthHeaderValue is non-null, then append
  19856. // `Content-Length`/contentLengthHeaderValue to httpRequest’s header
  19857. // list.
  19858. if (contentLengthHeaderValue != null) {
  19859. httpRequest.headersList.append('content-length', contentLengthHeaderValue)
  19860. }
  19861. // 9. If contentLengthHeaderValue is non-null, then append (`Content-Length`,
  19862. // contentLengthHeaderValue) to httpRequest’s header list.
  19863. // 10. If contentLength is non-null and httpRequest’s keepalive is true,
  19864. // then:
  19865. if (contentLength != null && httpRequest.keepalive) {
  19866. // NOTE: keepalive is a noop outside of browser context.
  19867. }
  19868. // 11. If httpRequest’s referrer is a URL, then append
  19869. // `Referer`/httpRequest’s referrer, serialized and isomorphic encoded,
  19870. // to httpRequest’s header list.
  19871. if (httpRequest.referrer instanceof URL) {
  19872. httpRequest.headersList.append('referer', isomorphicEncode(httpRequest.referrer.href))
  19873. }
  19874. // 12. Append a request `Origin` header for httpRequest.
  19875. appendRequestOriginHeader(httpRequest)
  19876. // 13. Append the Fetch metadata headers for httpRequest. [FETCH-METADATA]
  19877. appendFetchMetadata(httpRequest)
  19878. // 14. If httpRequest’s header list does not contain `User-Agent`, then
  19879. // user agents should append `User-Agent`/default `User-Agent` value to
  19880. // httpRequest’s header list.
  19881. if (!httpRequest.headersList.contains('user-agent')) {
  19882. httpRequest.headersList.append('user-agent', typeof esbuildDetection === 'undefined' ? 'undici' : 'node')
  19883. }
  19884. // 15. If httpRequest’s cache mode is "default" and httpRequest’s header
  19885. // list contains `If-Modified-Since`, `If-None-Match`,
  19886. // `If-Unmodified-Since`, `If-Match`, or `If-Range`, then set
  19887. // httpRequest’s cache mode to "no-store".
  19888. if (
  19889. httpRequest.cache === 'default' &&
  19890. (httpRequest.headersList.contains('if-modified-since') ||
  19891. httpRequest.headersList.contains('if-none-match') ||
  19892. httpRequest.headersList.contains('if-unmodified-since') ||
  19893. httpRequest.headersList.contains('if-match') ||
  19894. httpRequest.headersList.contains('if-range'))
  19895. ) {
  19896. httpRequest.cache = 'no-store'
  19897. }
  19898. // 16. If httpRequest’s cache mode is "no-cache", httpRequest’s prevent
  19899. // no-cache cache-control header modification flag is unset, and
  19900. // httpRequest’s header list does not contain `Cache-Control`, then append
  19901. // `Cache-Control`/`max-age=0` to httpRequest’s header list.
  19902. if (
  19903. httpRequest.cache === 'no-cache' &&
  19904. !httpRequest.preventNoCacheCacheControlHeaderModification &&
  19905. !httpRequest.headersList.contains('cache-control')
  19906. ) {
  19907. httpRequest.headersList.append('cache-control', 'max-age=0')
  19908. }
  19909. // 17. If httpRequest’s cache mode is "no-store" or "reload", then:
  19910. if (httpRequest.cache === 'no-store' || httpRequest.cache === 'reload') {
  19911. // 1. If httpRequest’s header list does not contain `Pragma`, then append
  19912. // `Pragma`/`no-cache` to httpRequest’s header list.
  19913. if (!httpRequest.headersList.contains('pragma')) {
  19914. httpRequest.headersList.append('pragma', 'no-cache')
  19915. }
  19916. // 2. If httpRequest’s header list does not contain `Cache-Control`,
  19917. // then append `Cache-Control`/`no-cache` to httpRequest’s header list.
  19918. if (!httpRequest.headersList.contains('cache-control')) {
  19919. httpRequest.headersList.append('cache-control', 'no-cache')
  19920. }
  19921. }
  19922. // 18. If httpRequest’s header list contains `Range`, then append
  19923. // `Accept-Encoding`/`identity` to httpRequest’s header list.
  19924. if (httpRequest.headersList.contains('range')) {
  19925. httpRequest.headersList.append('accept-encoding', 'identity')
  19926. }
  19927. // 19. Modify httpRequest’s header list per HTTP. Do not append a given
  19928. // header if httpRequest’s header list contains that header’s name.
  19929. // TODO: https://github.com/whatwg/fetch/issues/1285#issuecomment-896560129
  19930. if (!httpRequest.headersList.contains('accept-encoding')) {
  19931. if (urlHasHttpsScheme(requestCurrentURL(httpRequest))) {
  19932. httpRequest.headersList.append('accept-encoding', 'br, gzip, deflate')
  19933. } else {
  19934. httpRequest.headersList.append('accept-encoding', 'gzip, deflate')
  19935. }
  19936. }
  19937. httpRequest.headersList.delete('host')
  19938. // 20. If includeCredentials is true, then:
  19939. if (includeCredentials) {
  19940. // 1. If the user agent is not configured to block cookies for httpRequest
  19941. // (see section 7 of [COOKIES]), then:
  19942. // TODO: credentials
  19943. // 2. If httpRequest’s header list does not contain `Authorization`, then:
  19944. // TODO: credentials
  19945. }
  19946. // 21. If there’s a proxy-authentication entry, use it as appropriate.
  19947. // TODO: proxy-authentication
  19948. // 22. Set httpCache to the result of determining the HTTP cache
  19949. // partition, given httpRequest.
  19950. // TODO: cache
  19951. // 23. If httpCache is null, then set httpRequest’s cache mode to
  19952. // "no-store".
  19953. if (httpCache == null) {
  19954. httpRequest.cache = 'no-store'
  19955. }
  19956. // 24. If httpRequest’s cache mode is neither "no-store" nor "reload",
  19957. // then:
  19958. if (httpRequest.mode !== 'no-store' && httpRequest.mode !== 'reload') {
  19959. // TODO: cache
  19960. }
  19961. // 9. If aborted, then return the appropriate network error for fetchParams.
  19962. // TODO
  19963. // 10. If response is null, then:
  19964. if (response == null) {
  19965. // 1. If httpRequest’s cache mode is "only-if-cached", then return a
  19966. // network error.
  19967. if (httpRequest.mode === 'only-if-cached') {
  19968. return makeNetworkError('only if cached')
  19969. }
  19970. // 2. Let forwardResponse be the result of running HTTP-network fetch
  19971. // given httpFetchParams, includeCredentials, and isNewConnectionFetch.
  19972. const forwardResponse = await httpNetworkFetch(
  19973. httpFetchParams,
  19974. includeCredentials,
  19975. isNewConnectionFetch
  19976. )
  19977. // 3. If httpRequest’s method is unsafe and forwardResponse’s status is
  19978. // in the range 200 to 399, inclusive, invalidate appropriate stored
  19979. // responses in httpCache, as per the "Invalidation" chapter of HTTP
  19980. // Caching, and set storedResponse to null. [HTTP-CACHING]
  19981. if (
  19982. !safeMethodsSet.has(httpRequest.method) &&
  19983. forwardResponse.status >= 200 &&
  19984. forwardResponse.status <= 399
  19985. ) {
  19986. // TODO: cache
  19987. }
  19988. // 4. If the revalidatingFlag is set and forwardResponse’s status is 304,
  19989. // then:
  19990. if (revalidatingFlag && forwardResponse.status === 304) {
  19991. // TODO: cache
  19992. }
  19993. // 5. If response is null, then:
  19994. if (response == null) {
  19995. // 1. Set response to forwardResponse.
  19996. response = forwardResponse
  19997. // 2. Store httpRequest and forwardResponse in httpCache, as per the
  19998. // "Storing Responses in Caches" chapter of HTTP Caching. [HTTP-CACHING]
  19999. // TODO: cache
  20000. }
  20001. }
  20002. // 11. Set response’s URL list to a clone of httpRequest’s URL list.
  20003. response.urlList = [...httpRequest.urlList]
  20004. // 12. If httpRequest’s header list contains `Range`, then set response’s
  20005. // range-requested flag.
  20006. if (httpRequest.headersList.contains('range')) {
  20007. response.rangeRequested = true
  20008. }
  20009. // 13. Set response’s request-includes-credentials to includeCredentials.
  20010. response.requestIncludesCredentials = includeCredentials
  20011. // 14. If response’s status is 401, httpRequest’s response tainting is not
  20012. // "cors", includeCredentials is true, and request’s window is an environment
  20013. // settings object, then:
  20014. // TODO
  20015. // 15. If response’s status is 407, then:
  20016. if (response.status === 407) {
  20017. // 1. If request’s window is "no-window", then return a network error.
  20018. if (request.window === 'no-window') {
  20019. return makeNetworkError()
  20020. }
  20021. // 2. ???
  20022. // 3. If fetchParams is canceled, then return the appropriate network error for fetchParams.
  20023. if (isCancelled(fetchParams)) {
  20024. return makeAppropriateNetworkError(fetchParams)
  20025. }
  20026. // 4. Prompt the end user as appropriate in request’s window and store
  20027. // the result as a proxy-authentication entry. [HTTP-AUTH]
  20028. // TODO: Invoke some kind of callback?
  20029. // 5. Set response to the result of running HTTP-network-or-cache fetch given
  20030. // fetchParams.
  20031. // TODO
  20032. return makeNetworkError('proxy authentication required')
  20033. }
  20034. // 16. If all of the following are true
  20035. if (
  20036. // response’s status is 421
  20037. response.status === 421 &&
  20038. // isNewConnectionFetch is false
  20039. !isNewConnectionFetch &&
  20040. // request’s body is null, or request’s body is non-null and request’s body’s source is non-null
  20041. (request.body == null || request.body.source != null)
  20042. ) {
  20043. // then:
  20044. // 1. If fetchParams is canceled, then return the appropriate network error for fetchParams.
  20045. if (isCancelled(fetchParams)) {
  20046. return makeAppropriateNetworkError(fetchParams)
  20047. }
  20048. // 2. Set response to the result of running HTTP-network-or-cache
  20049. // fetch given fetchParams, isAuthenticationFetch, and true.
  20050. // TODO (spec): The spec doesn't specify this but we need to cancel
  20051. // the active response before we can start a new one.
  20052. // https://github.com/whatwg/fetch/issues/1293
  20053. fetchParams.controller.connection.destroy()
  20054. response = await httpNetworkOrCacheFetch(
  20055. fetchParams,
  20056. isAuthenticationFetch,
  20057. true
  20058. )
  20059. }
  20060. // 17. If isAuthenticationFetch is true, then create an authentication entry
  20061. if (isAuthenticationFetch) {
  20062. // TODO
  20063. }
  20064. // 18. Return response.
  20065. return response
  20066. }
  20067. // https://fetch.spec.whatwg.org/#http-network-fetch
  20068. async function httpNetworkFetch (
  20069. fetchParams,
  20070. includeCredentials = false,
  20071. forceNewConnection = false
  20072. ) {
  20073. assert(!fetchParams.controller.connection || fetchParams.controller.connection.destroyed)
  20074. fetchParams.controller.connection = {
  20075. abort: null,
  20076. destroyed: false,
  20077. destroy (err) {
  20078. if (!this.destroyed) {
  20079. this.destroyed = true
  20080. this.abort?.(err ?? new DOMException('The operation was aborted.', 'AbortError'))
  20081. }
  20082. }
  20083. }
  20084. // 1. Let request be fetchParams’s request.
  20085. const request = fetchParams.request
  20086. // 2. Let response be null.
  20087. let response = null
  20088. // 3. Let timingInfo be fetchParams’s timing info.
  20089. const timingInfo = fetchParams.timingInfo
  20090. // 4. Let httpCache be the result of determining the HTTP cache partition,
  20091. // given request.
  20092. // TODO: cache
  20093. const httpCache = null
  20094. // 5. If httpCache is null, then set request’s cache mode to "no-store".
  20095. if (httpCache == null) {
  20096. request.cache = 'no-store'
  20097. }
  20098. // 6. Let networkPartitionKey be the result of determining the network
  20099. // partition key given request.
  20100. // TODO
  20101. // 7. Let newConnection be "yes" if forceNewConnection is true; otherwise
  20102. // "no".
  20103. const newConnection = forceNewConnection ? 'yes' : 'no' // eslint-disable-line no-unused-vars
  20104. // 8. Switch on request’s mode:
  20105. if (request.mode === 'websocket') {
  20106. // Let connection be the result of obtaining a WebSocket connection,
  20107. // given request’s current URL.
  20108. // TODO
  20109. } else {
  20110. // Let connection be the result of obtaining a connection, given
  20111. // networkPartitionKey, request’s current URL’s origin,
  20112. // includeCredentials, and forceNewConnection.
  20113. // TODO
  20114. }
  20115. // 9. Run these steps, but abort when the ongoing fetch is terminated:
  20116. // 1. If connection is failure, then return a network error.
  20117. // 2. Set timingInfo’s final connection timing info to the result of
  20118. // calling clamp and coarsen connection timing info with connection’s
  20119. // timing info, timingInfo’s post-redirect start time, and fetchParams’s
  20120. // cross-origin isolated capability.
  20121. // 3. If connection is not an HTTP/2 connection, request’s body is non-null,
  20122. // and request’s body’s source is null, then append (`Transfer-Encoding`,
  20123. // `chunked`) to request’s header list.
  20124. // 4. Set timingInfo’s final network-request start time to the coarsened
  20125. // shared current time given fetchParams’s cross-origin isolated
  20126. // capability.
  20127. // 5. Set response to the result of making an HTTP request over connection
  20128. // using request with the following caveats:
  20129. // - Follow the relevant requirements from HTTP. [HTTP] [HTTP-SEMANTICS]
  20130. // [HTTP-COND] [HTTP-CACHING] [HTTP-AUTH]
  20131. // - If request’s body is non-null, and request’s body’s source is null,
  20132. // then the user agent may have a buffer of up to 64 kibibytes and store
  20133. // a part of request’s body in that buffer. If the user agent reads from
  20134. // request’s body beyond that buffer’s size and the user agent needs to
  20135. // resend request, then instead return a network error.
  20136. // - Set timingInfo’s final network-response start time to the coarsened
  20137. // shared current time given fetchParams’s cross-origin isolated capability,
  20138. // immediately after the user agent’s HTTP parser receives the first byte
  20139. // of the response (e.g., frame header bytes for HTTP/2 or response status
  20140. // line for HTTP/1.x).
  20141. // - Wait until all the headers are transmitted.
  20142. // - Any responses whose status is in the range 100 to 199, inclusive,
  20143. // and is not 101, are to be ignored, except for the purposes of setting
  20144. // timingInfo’s final network-response start time above.
  20145. // - If request’s header list contains `Transfer-Encoding`/`chunked` and
  20146. // response is transferred via HTTP/1.0 or older, then return a network
  20147. // error.
  20148. // - If the HTTP request results in a TLS client certificate dialog, then:
  20149. // 1. If request’s window is an environment settings object, make the
  20150. // dialog available in request’s window.
  20151. // 2. Otherwise, return a network error.
  20152. // To transmit request’s body body, run these steps:
  20153. let requestBody = null
  20154. // 1. If body is null and fetchParams’s process request end-of-body is
  20155. // non-null, then queue a fetch task given fetchParams’s process request
  20156. // end-of-body and fetchParams’s task destination.
  20157. if (request.body == null && fetchParams.processRequestEndOfBody) {
  20158. queueMicrotask(() => fetchParams.processRequestEndOfBody())
  20159. } else if (request.body != null) {
  20160. // 2. Otherwise, if body is non-null:
  20161. // 1. Let processBodyChunk given bytes be these steps:
  20162. const processBodyChunk = async function * (bytes) {
  20163. // 1. If the ongoing fetch is terminated, then abort these steps.
  20164. if (isCancelled(fetchParams)) {
  20165. return
  20166. }
  20167. // 2. Run this step in parallel: transmit bytes.
  20168. yield bytes
  20169. // 3. If fetchParams’s process request body is non-null, then run
  20170. // fetchParams’s process request body given bytes’s length.
  20171. fetchParams.processRequestBodyChunkLength?.(bytes.byteLength)
  20172. }
  20173. // 2. Let processEndOfBody be these steps:
  20174. const processEndOfBody = () => {
  20175. // 1. If fetchParams is canceled, then abort these steps.
  20176. if (isCancelled(fetchParams)) {
  20177. return
  20178. }
  20179. // 2. If fetchParams’s process request end-of-body is non-null,
  20180. // then run fetchParams’s process request end-of-body.
  20181. if (fetchParams.processRequestEndOfBody) {
  20182. fetchParams.processRequestEndOfBody()
  20183. }
  20184. }
  20185. // 3. Let processBodyError given e be these steps:
  20186. const processBodyError = (e) => {
  20187. // 1. If fetchParams is canceled, then abort these steps.
  20188. if (isCancelled(fetchParams)) {
  20189. return
  20190. }
  20191. // 2. If e is an "AbortError" DOMException, then abort fetchParams’s controller.
  20192. if (e.name === 'AbortError') {
  20193. fetchParams.controller.abort()
  20194. } else {
  20195. fetchParams.controller.terminate(e)
  20196. }
  20197. }
  20198. // 4. Incrementally read request’s body given processBodyChunk, processEndOfBody,
  20199. // processBodyError, and fetchParams’s task destination.
  20200. requestBody = (async function * () {
  20201. try {
  20202. for await (const bytes of request.body.stream) {
  20203. yield * processBodyChunk(bytes)
  20204. }
  20205. processEndOfBody()
  20206. } catch (err) {
  20207. processBodyError(err)
  20208. }
  20209. })()
  20210. }
  20211. try {
  20212. // socket is only provided for websockets
  20213. const { body, status, statusText, headersList, socket } = await dispatch({ body: requestBody })
  20214. if (socket) {
  20215. response = makeResponse({ status, statusText, headersList, socket })
  20216. } else {
  20217. const iterator = body[Symbol.asyncIterator]()
  20218. fetchParams.controller.next = () => iterator.next()
  20219. response = makeResponse({ status, statusText, headersList })
  20220. }
  20221. } catch (err) {
  20222. // 10. If aborted, then:
  20223. if (err.name === 'AbortError') {
  20224. // 1. If connection uses HTTP/2, then transmit an RST_STREAM frame.
  20225. fetchParams.controller.connection.destroy()
  20226. // 2. Return the appropriate network error for fetchParams.
  20227. return makeAppropriateNetworkError(fetchParams, err)
  20228. }
  20229. return makeNetworkError(err)
  20230. }
  20231. // 11. Let pullAlgorithm be an action that resumes the ongoing fetch
  20232. // if it is suspended.
  20233. const pullAlgorithm = () => {
  20234. fetchParams.controller.resume()
  20235. }
  20236. // 12. Let cancelAlgorithm be an algorithm that aborts fetchParams’s
  20237. // controller with reason, given reason.
  20238. const cancelAlgorithm = (reason) => {
  20239. fetchParams.controller.abort(reason)
  20240. }
  20241. // 13. Let highWaterMark be a non-negative, non-NaN number, chosen by
  20242. // the user agent.
  20243. // TODO
  20244. // 14. Let sizeAlgorithm be an algorithm that accepts a chunk object
  20245. // and returns a non-negative, non-NaN, non-infinite number, chosen by the user agent.
  20246. // TODO
  20247. // 15. Let stream be a new ReadableStream.
  20248. // 16. Set up stream with pullAlgorithm set to pullAlgorithm,
  20249. // cancelAlgorithm set to cancelAlgorithm, highWaterMark set to
  20250. // highWaterMark, and sizeAlgorithm set to sizeAlgorithm.
  20251. if (!ReadableStream) {
  20252. ReadableStream = (__nccwpck_require__(5356).ReadableStream)
  20253. }
  20254. const stream = new ReadableStream(
  20255. {
  20256. async start (controller) {
  20257. fetchParams.controller.controller = controller
  20258. },
  20259. async pull (controller) {
  20260. await pullAlgorithm(controller)
  20261. },
  20262. async cancel (reason) {
  20263. await cancelAlgorithm(reason)
  20264. }
  20265. },
  20266. {
  20267. highWaterMark: 0,
  20268. size () {
  20269. return 1
  20270. }
  20271. }
  20272. )
  20273. // 17. Run these steps, but abort when the ongoing fetch is terminated:
  20274. // 1. Set response’s body to a new body whose stream is stream.
  20275. response.body = { stream }
  20276. // 2. If response is not a network error and request’s cache mode is
  20277. // not "no-store", then update response in httpCache for request.
  20278. // TODO
  20279. // 3. If includeCredentials is true and the user agent is not configured
  20280. // to block cookies for request (see section 7 of [COOKIES]), then run the
  20281. // "set-cookie-string" parsing algorithm (see section 5.2 of [COOKIES]) on
  20282. // the value of each header whose name is a byte-case-insensitive match for
  20283. // `Set-Cookie` in response’s header list, if any, and request’s current URL.
  20284. // TODO
  20285. // 18. If aborted, then:
  20286. // TODO
  20287. // 19. Run these steps in parallel:
  20288. // 1. Run these steps, but abort when fetchParams is canceled:
  20289. fetchParams.controller.on('terminated', onAborted)
  20290. fetchParams.controller.resume = async () => {
  20291. // 1. While true
  20292. while (true) {
  20293. // 1-3. See onData...
  20294. // 4. Set bytes to the result of handling content codings given
  20295. // codings and bytes.
  20296. let bytes
  20297. let isFailure
  20298. try {
  20299. const { done, value } = await fetchParams.controller.next()
  20300. if (isAborted(fetchParams)) {
  20301. break
  20302. }
  20303. bytes = done ? undefined : value
  20304. } catch (err) {
  20305. if (fetchParams.controller.ended && !timingInfo.encodedBodySize) {
  20306. // zlib doesn't like empty streams.
  20307. bytes = undefined
  20308. } else {
  20309. bytes = err
  20310. // err may be propagated from the result of calling readablestream.cancel,
  20311. // which might not be an error. https://github.com/nodejs/undici/issues/2009
  20312. isFailure = true
  20313. }
  20314. }
  20315. if (bytes === undefined) {
  20316. // 2. Otherwise, if the bytes transmission for response’s message
  20317. // body is done normally and stream is readable, then close
  20318. // stream, finalize response for fetchParams and response, and
  20319. // abort these in-parallel steps.
  20320. readableStreamClose(fetchParams.controller.controller)
  20321. finalizeResponse(fetchParams, response)
  20322. return
  20323. }
  20324. // 5. Increase timingInfo’s decoded body size by bytes’s length.
  20325. timingInfo.decodedBodySize += bytes?.byteLength ?? 0
  20326. // 6. If bytes is failure, then terminate fetchParams’s controller.
  20327. if (isFailure) {
  20328. fetchParams.controller.terminate(bytes)
  20329. return
  20330. }
  20331. // 7. Enqueue a Uint8Array wrapping an ArrayBuffer containing bytes
  20332. // into stream.
  20333. fetchParams.controller.controller.enqueue(new Uint8Array(bytes))
  20334. // 8. If stream is errored, then terminate the ongoing fetch.
  20335. if (isErrored(stream)) {
  20336. fetchParams.controller.terminate()
  20337. return
  20338. }
  20339. // 9. If stream doesn’t need more data ask the user agent to suspend
  20340. // the ongoing fetch.
  20341. if (!fetchParams.controller.controller.desiredSize) {
  20342. return
  20343. }
  20344. }
  20345. }
  20346. // 2. If aborted, then:
  20347. function onAborted (reason) {
  20348. // 2. If fetchParams is aborted, then:
  20349. if (isAborted(fetchParams)) {
  20350. // 1. Set response’s aborted flag.
  20351. response.aborted = true
  20352. // 2. If stream is readable, then error stream with the result of
  20353. // deserialize a serialized abort reason given fetchParams’s
  20354. // controller’s serialized abort reason and an
  20355. // implementation-defined realm.
  20356. if (isReadable(stream)) {
  20357. fetchParams.controller.controller.error(
  20358. fetchParams.controller.serializedAbortReason
  20359. )
  20360. }
  20361. } else {
  20362. // 3. Otherwise, if stream is readable, error stream with a TypeError.
  20363. if (isReadable(stream)) {
  20364. fetchParams.controller.controller.error(new TypeError('terminated', {
  20365. cause: isErrorLike(reason) ? reason : undefined
  20366. }))
  20367. }
  20368. }
  20369. // 4. If connection uses HTTP/2, then transmit an RST_STREAM frame.
  20370. // 5. Otherwise, the user agent should close connection unless it would be bad for performance to do so.
  20371. fetchParams.controller.connection.destroy()
  20372. }
  20373. // 20. Return response.
  20374. return response
  20375. async function dispatch ({ body }) {
  20376. const url = requestCurrentURL(request)
  20377. /** @type {import('../..').Agent} */
  20378. const agent = fetchParams.controller.dispatcher
  20379. return new Promise((resolve, reject) => agent.dispatch(
  20380. {
  20381. path: url.pathname + url.search,
  20382. origin: url.origin,
  20383. method: request.method,
  20384. body: fetchParams.controller.dispatcher.isMockActive ? request.body && (request.body.source || request.body.stream) : body,
  20385. headers: request.headersList.entries,
  20386. maxRedirections: 0,
  20387. upgrade: request.mode === 'websocket' ? 'websocket' : undefined
  20388. },
  20389. {
  20390. body: null,
  20391. abort: null,
  20392. onConnect (abort) {
  20393. // TODO (fix): Do we need connection here?
  20394. const { connection } = fetchParams.controller
  20395. if (connection.destroyed) {
  20396. abort(new DOMException('The operation was aborted.', 'AbortError'))
  20397. } else {
  20398. fetchParams.controller.on('terminated', abort)
  20399. this.abort = connection.abort = abort
  20400. }
  20401. },
  20402. onHeaders (status, headersList, resume, statusText) {
  20403. if (status < 200) {
  20404. return
  20405. }
  20406. let codings = []
  20407. let location = ''
  20408. const headers = new Headers()
  20409. // For H2, the headers are a plain JS object
  20410. // We distinguish between them and iterate accordingly
  20411. if (Array.isArray(headersList)) {
  20412. for (let n = 0; n < headersList.length; n += 2) {
  20413. const key = headersList[n + 0].toString('latin1')
  20414. const val = headersList[n + 1].toString('latin1')
  20415. if (key.toLowerCase() === 'content-encoding') {
  20416. // https://www.rfc-editor.org/rfc/rfc7231#section-3.1.2.1
  20417. // "All content-coding values are case-insensitive..."
  20418. codings = val.toLowerCase().split(',').map((x) => x.trim())
  20419. } else if (key.toLowerCase() === 'location') {
  20420. location = val
  20421. }
  20422. headers[kHeadersList].append(key, val)
  20423. }
  20424. } else {
  20425. const keys = Object.keys(headersList)
  20426. for (const key of keys) {
  20427. const val = headersList[key]
  20428. if (key.toLowerCase() === 'content-encoding') {
  20429. // https://www.rfc-editor.org/rfc/rfc7231#section-3.1.2.1
  20430. // "All content-coding values are case-insensitive..."
  20431. codings = val.toLowerCase().split(',').map((x) => x.trim()).reverse()
  20432. } else if (key.toLowerCase() === 'location') {
  20433. location = val
  20434. }
  20435. headers[kHeadersList].append(key, val)
  20436. }
  20437. }
  20438. this.body = new Readable({ read: resume })
  20439. const decoders = []
  20440. const willFollow = request.redirect === 'follow' &&
  20441. location &&
  20442. redirectStatusSet.has(status)
  20443. // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
  20444. if (request.method !== 'HEAD' && request.method !== 'CONNECT' && !nullBodyStatus.includes(status) && !willFollow) {
  20445. for (const coding of codings) {
  20446. // https://www.rfc-editor.org/rfc/rfc9112.html#section-7.2
  20447. if (coding === 'x-gzip' || coding === 'gzip') {
  20448. decoders.push(zlib.createGunzip({
  20449. // Be less strict when decoding compressed responses, since sometimes
  20450. // servers send slightly invalid responses that are still accepted
  20451. // by common browsers.
  20452. // Always using Z_SYNC_FLUSH is what cURL does.
  20453. flush: zlib.constants.Z_SYNC_FLUSH,
  20454. finishFlush: zlib.constants.Z_SYNC_FLUSH
  20455. }))
  20456. } else if (coding === 'deflate') {
  20457. decoders.push(zlib.createInflate())
  20458. } else if (coding === 'br') {
  20459. decoders.push(zlib.createBrotliDecompress())
  20460. } else {
  20461. decoders.length = 0
  20462. break
  20463. }
  20464. }
  20465. }
  20466. resolve({
  20467. status,
  20468. statusText,
  20469. headersList: headers[kHeadersList],
  20470. body: decoders.length
  20471. ? pipeline(this.body, ...decoders, () => { })
  20472. : this.body.on('error', () => {})
  20473. })
  20474. return true
  20475. },
  20476. onData (chunk) {
  20477. if (fetchParams.controller.dump) {
  20478. return
  20479. }
  20480. // 1. If one or more bytes have been transmitted from response’s
  20481. // message body, then:
  20482. // 1. Let bytes be the transmitted bytes.
  20483. const bytes = chunk
  20484. // 2. Let codings be the result of extracting header list values
  20485. // given `Content-Encoding` and response’s header list.
  20486. // See pullAlgorithm.
  20487. // 3. Increase timingInfo’s encoded body size by bytes’s length.
  20488. timingInfo.encodedBodySize += bytes.byteLength
  20489. // 4. See pullAlgorithm...
  20490. return this.body.push(bytes)
  20491. },
  20492. onComplete () {
  20493. if (this.abort) {
  20494. fetchParams.controller.off('terminated', this.abort)
  20495. }
  20496. fetchParams.controller.ended = true
  20497. this.body.push(null)
  20498. },
  20499. onError (error) {
  20500. if (this.abort) {
  20501. fetchParams.controller.off('terminated', this.abort)
  20502. }
  20503. this.body?.destroy(error)
  20504. fetchParams.controller.terminate(error)
  20505. reject(error)
  20506. },
  20507. onUpgrade (status, headersList, socket) {
  20508. if (status !== 101) {
  20509. return
  20510. }
  20511. const headers = new Headers()
  20512. for (let n = 0; n < headersList.length; n += 2) {
  20513. const key = headersList[n + 0].toString('latin1')
  20514. const val = headersList[n + 1].toString('latin1')
  20515. headers[kHeadersList].append(key, val)
  20516. }
  20517. resolve({
  20518. status,
  20519. statusText: STATUS_CODES[status],
  20520. headersList: headers[kHeadersList],
  20521. socket
  20522. })
  20523. return true
  20524. }
  20525. }
  20526. ))
  20527. }
  20528. }
  20529. module.exports = {
  20530. fetch,
  20531. Fetch,
  20532. fetching,
  20533. finalizeAndReportTiming
  20534. }
  20535. /***/ }),
  20536. /***/ 8359:
  20537. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  20538. /* globals AbortController */
  20539. const { extractBody, mixinBody, cloneBody } = __nccwpck_require__(9990)
  20540. const { Headers, fill: fillHeaders, HeadersList } = __nccwpck_require__(554)
  20541. const { FinalizationRegistry } = __nccwpck_require__(6436)()
  20542. const util = __nccwpck_require__(3983)
  20543. const {
  20544. isValidHTTPToken,
  20545. sameOrigin,
  20546. normalizeMethod,
  20547. makePolicyContainer,
  20548. normalizeMethodRecord
  20549. } = __nccwpck_require__(2538)
  20550. const {
  20551. forbiddenMethodsSet,
  20552. corsSafeListedMethodsSet,
  20553. referrerPolicy,
  20554. requestRedirect,
  20555. requestMode,
  20556. requestCredentials,
  20557. requestCache,
  20558. requestDuplex
  20559. } = __nccwpck_require__(1037)
  20560. const { kEnumerableProperty } = util
  20561. const { kHeaders, kSignal, kState, kGuard, kRealm } = __nccwpck_require__(5861)
  20562. const { webidl } = __nccwpck_require__(1744)
  20563. const { getGlobalOrigin } = __nccwpck_require__(1246)
  20564. const { URLSerializer } = __nccwpck_require__(685)
  20565. const { kHeadersList, kConstruct } = __nccwpck_require__(2785)
  20566. const assert = __nccwpck_require__(9491)
  20567. const { getMaxListeners, setMaxListeners, getEventListeners, defaultMaxListeners } = __nccwpck_require__(2361)
  20568. let TransformStream = globalThis.TransformStream
  20569. const kAbortController = Symbol('abortController')
  20570. const requestFinalizer = new FinalizationRegistry(({ signal, abort }) => {
  20571. signal.removeEventListener('abort', abort)
  20572. })
  20573. // https://fetch.spec.whatwg.org/#request-class
  20574. class Request {
  20575. // https://fetch.spec.whatwg.org/#dom-request
  20576. constructor (input, init = {}) {
  20577. if (input === kConstruct) {
  20578. return
  20579. }
  20580. webidl.argumentLengthCheck(arguments, 1, { header: 'Request constructor' })
  20581. input = webidl.converters.RequestInfo(input)
  20582. init = webidl.converters.RequestInit(init)
  20583. // https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object
  20584. this[kRealm] = {
  20585. settingsObject: {
  20586. baseUrl: getGlobalOrigin(),
  20587. get origin () {
  20588. return this.baseUrl?.origin
  20589. },
  20590. policyContainer: makePolicyContainer()
  20591. }
  20592. }
  20593. // 1. Let request be null.
  20594. let request = null
  20595. // 2. Let fallbackMode be null.
  20596. let fallbackMode = null
  20597. // 3. Let baseURL be this’s relevant settings object’s API base URL.
  20598. const baseUrl = this[kRealm].settingsObject.baseUrl
  20599. // 4. Let signal be null.
  20600. let signal = null
  20601. // 5. If input is a string, then:
  20602. if (typeof input === 'string') {
  20603. // 1. Let parsedURL be the result of parsing input with baseURL.
  20604. // 2. If parsedURL is failure, then throw a TypeError.
  20605. let parsedURL
  20606. try {
  20607. parsedURL = new URL(input, baseUrl)
  20608. } catch (err) {
  20609. throw new TypeError('Failed to parse URL from ' + input, { cause: err })
  20610. }
  20611. // 3. If parsedURL includes credentials, then throw a TypeError.
  20612. if (parsedURL.username || parsedURL.password) {
  20613. throw new TypeError(
  20614. 'Request cannot be constructed from a URL that includes credentials: ' +
  20615. input
  20616. )
  20617. }
  20618. // 4. Set request to a new request whose URL is parsedURL.
  20619. request = makeRequest({ urlList: [parsedURL] })
  20620. // 5. Set fallbackMode to "cors".
  20621. fallbackMode = 'cors'
  20622. } else {
  20623. // 6. Otherwise:
  20624. // 7. Assert: input is a Request object.
  20625. assert(input instanceof Request)
  20626. // 8. Set request to input’s request.
  20627. request = input[kState]
  20628. // 9. Set signal to input’s signal.
  20629. signal = input[kSignal]
  20630. }
  20631. // 7. Let origin be this’s relevant settings object’s origin.
  20632. const origin = this[kRealm].settingsObject.origin
  20633. // 8. Let window be "client".
  20634. let window = 'client'
  20635. // 9. If request’s window is an environment settings object and its origin
  20636. // is same origin with origin, then set window to request’s window.
  20637. if (
  20638. request.window?.constructor?.name === 'EnvironmentSettingsObject' &&
  20639. sameOrigin(request.window, origin)
  20640. ) {
  20641. window = request.window
  20642. }
  20643. // 10. If init["window"] exists and is non-null, then throw a TypeError.
  20644. if (init.window != null) {
  20645. throw new TypeError(`'window' option '${window}' must be null`)
  20646. }
  20647. // 11. If init["window"] exists, then set window to "no-window".
  20648. if ('window' in init) {
  20649. window = 'no-window'
  20650. }
  20651. // 12. Set request to a new request with the following properties:
  20652. request = makeRequest({
  20653. // URL request’s URL.
  20654. // undici implementation note: this is set as the first item in request's urlList in makeRequest
  20655. // method request’s method.
  20656. method: request.method,
  20657. // header list A copy of request’s header list.
  20658. // undici implementation note: headersList is cloned in makeRequest
  20659. headersList: request.headersList,
  20660. // unsafe-request flag Set.
  20661. unsafeRequest: request.unsafeRequest,
  20662. // client This’s relevant settings object.
  20663. client: this[kRealm].settingsObject,
  20664. // window window.
  20665. window,
  20666. // priority request’s priority.
  20667. priority: request.priority,
  20668. // origin request’s origin. The propagation of the origin is only significant for navigation requests
  20669. // being handled by a service worker. In this scenario a request can have an origin that is different
  20670. // from the current client.
  20671. origin: request.origin,
  20672. // referrer request’s referrer.
  20673. referrer: request.referrer,
  20674. // referrer policy request’s referrer policy.
  20675. referrerPolicy: request.referrerPolicy,
  20676. // mode request’s mode.
  20677. mode: request.mode,
  20678. // credentials mode request’s credentials mode.
  20679. credentials: request.credentials,
  20680. // cache mode request’s cache mode.
  20681. cache: request.cache,
  20682. // redirect mode request’s redirect mode.
  20683. redirect: request.redirect,
  20684. // integrity metadata request’s integrity metadata.
  20685. integrity: request.integrity,
  20686. // keepalive request’s keepalive.
  20687. keepalive: request.keepalive,
  20688. // reload-navigation flag request’s reload-navigation flag.
  20689. reloadNavigation: request.reloadNavigation,
  20690. // history-navigation flag request’s history-navigation flag.
  20691. historyNavigation: request.historyNavigation,
  20692. // URL list A clone of request’s URL list.
  20693. urlList: [...request.urlList]
  20694. })
  20695. const initHasKey = Object.keys(init).length !== 0
  20696. // 13. If init is not empty, then:
  20697. if (initHasKey) {
  20698. // 1. If request’s mode is "navigate", then set it to "same-origin".
  20699. if (request.mode === 'navigate') {
  20700. request.mode = 'same-origin'
  20701. }
  20702. // 2. Unset request’s reload-navigation flag.
  20703. request.reloadNavigation = false
  20704. // 3. Unset request’s history-navigation flag.
  20705. request.historyNavigation = false
  20706. // 4. Set request’s origin to "client".
  20707. request.origin = 'client'
  20708. // 5. Set request’s referrer to "client"
  20709. request.referrer = 'client'
  20710. // 6. Set request’s referrer policy to the empty string.
  20711. request.referrerPolicy = ''
  20712. // 7. Set request’s URL to request’s current URL.
  20713. request.url = request.urlList[request.urlList.length - 1]
  20714. // 8. Set request’s URL list to « request’s URL ».
  20715. request.urlList = [request.url]
  20716. }
  20717. // 14. If init["referrer"] exists, then:
  20718. if (init.referrer !== undefined) {
  20719. // 1. Let referrer be init["referrer"].
  20720. const referrer = init.referrer
  20721. // 2. If referrer is the empty string, then set request’s referrer to "no-referrer".
  20722. if (referrer === '') {
  20723. request.referrer = 'no-referrer'
  20724. } else {
  20725. // 1. Let parsedReferrer be the result of parsing referrer with
  20726. // baseURL.
  20727. // 2. If parsedReferrer is failure, then throw a TypeError.
  20728. let parsedReferrer
  20729. try {
  20730. parsedReferrer = new URL(referrer, baseUrl)
  20731. } catch (err) {
  20732. throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err })
  20733. }
  20734. // 3. If one of the following is true
  20735. // - parsedReferrer’s scheme is "about" and path is the string "client"
  20736. // - parsedReferrer’s origin is not same origin with origin
  20737. // then set request’s referrer to "client".
  20738. if (
  20739. (parsedReferrer.protocol === 'about:' && parsedReferrer.hostname === 'client') ||
  20740. (origin && !sameOrigin(parsedReferrer, this[kRealm].settingsObject.baseUrl))
  20741. ) {
  20742. request.referrer = 'client'
  20743. } else {
  20744. // 4. Otherwise, set request’s referrer to parsedReferrer.
  20745. request.referrer = parsedReferrer
  20746. }
  20747. }
  20748. }
  20749. // 15. If init["referrerPolicy"] exists, then set request’s referrer policy
  20750. // to it.
  20751. if (init.referrerPolicy !== undefined) {
  20752. request.referrerPolicy = init.referrerPolicy
  20753. }
  20754. // 16. Let mode be init["mode"] if it exists, and fallbackMode otherwise.
  20755. let mode
  20756. if (init.mode !== undefined) {
  20757. mode = init.mode
  20758. } else {
  20759. mode = fallbackMode
  20760. }
  20761. // 17. If mode is "navigate", then throw a TypeError.
  20762. if (mode === 'navigate') {
  20763. throw webidl.errors.exception({
  20764. header: 'Request constructor',
  20765. message: 'invalid request mode navigate.'
  20766. })
  20767. }
  20768. // 18. If mode is non-null, set request’s mode to mode.
  20769. if (mode != null) {
  20770. request.mode = mode
  20771. }
  20772. // 19. If init["credentials"] exists, then set request’s credentials mode
  20773. // to it.
  20774. if (init.credentials !== undefined) {
  20775. request.credentials = init.credentials
  20776. }
  20777. // 18. If init["cache"] exists, then set request’s cache mode to it.
  20778. if (init.cache !== undefined) {
  20779. request.cache = init.cache
  20780. }
  20781. // 21. If request’s cache mode is "only-if-cached" and request’s mode is
  20782. // not "same-origin", then throw a TypeError.
  20783. if (request.cache === 'only-if-cached' && request.mode !== 'same-origin') {
  20784. throw new TypeError(
  20785. "'only-if-cached' can be set only with 'same-origin' mode"
  20786. )
  20787. }
  20788. // 22. If init["redirect"] exists, then set request’s redirect mode to it.
  20789. if (init.redirect !== undefined) {
  20790. request.redirect = init.redirect
  20791. }
  20792. // 23. If init["integrity"] exists, then set request’s integrity metadata to it.
  20793. if (init.integrity != null) {
  20794. request.integrity = String(init.integrity)
  20795. }
  20796. // 24. If init["keepalive"] exists, then set request’s keepalive to it.
  20797. if (init.keepalive !== undefined) {
  20798. request.keepalive = Boolean(init.keepalive)
  20799. }
  20800. // 25. If init["method"] exists, then:
  20801. if (init.method !== undefined) {
  20802. // 1. Let method be init["method"].
  20803. let method = init.method
  20804. // 2. If method is not a method or method is a forbidden method, then
  20805. // throw a TypeError.
  20806. if (!isValidHTTPToken(method)) {
  20807. throw new TypeError(`'${method}' is not a valid HTTP method.`)
  20808. }
  20809. if (forbiddenMethodsSet.has(method.toUpperCase())) {
  20810. throw new TypeError(`'${method}' HTTP method is unsupported.`)
  20811. }
  20812. // 3. Normalize method.
  20813. method = normalizeMethodRecord[method] ?? normalizeMethod(method)
  20814. // 4. Set request’s method to method.
  20815. request.method = method
  20816. }
  20817. // 26. If init["signal"] exists, then set signal to it.
  20818. if (init.signal !== undefined) {
  20819. signal = init.signal
  20820. }
  20821. // 27. Set this’s request to request.
  20822. this[kState] = request
  20823. // 28. Set this’s signal to a new AbortSignal object with this’s relevant
  20824. // Realm.
  20825. // TODO: could this be simplified with AbortSignal.any
  20826. // (https://dom.spec.whatwg.org/#dom-abortsignal-any)
  20827. const ac = new AbortController()
  20828. this[kSignal] = ac.signal
  20829. this[kSignal][kRealm] = this[kRealm]
  20830. // 29. If signal is not null, then make this’s signal follow signal.
  20831. if (signal != null) {
  20832. if (
  20833. !signal ||
  20834. typeof signal.aborted !== 'boolean' ||
  20835. typeof signal.addEventListener !== 'function'
  20836. ) {
  20837. throw new TypeError(
  20838. "Failed to construct 'Request': member signal is not of type AbortSignal."
  20839. )
  20840. }
  20841. if (signal.aborted) {
  20842. ac.abort(signal.reason)
  20843. } else {
  20844. // Keep a strong ref to ac while request object
  20845. // is alive. This is needed to prevent AbortController
  20846. // from being prematurely garbage collected.
  20847. // See, https://github.com/nodejs/undici/issues/1926.
  20848. this[kAbortController] = ac
  20849. const acRef = new WeakRef(ac)
  20850. const abort = function () {
  20851. const ac = acRef.deref()
  20852. if (ac !== undefined) {
  20853. ac.abort(this.reason)
  20854. }
  20855. }
  20856. // Third-party AbortControllers may not work with these.
  20857. // See, https://github.com/nodejs/undici/pull/1910#issuecomment-1464495619.
  20858. try {
  20859. // If the max amount of listeners is equal to the default, increase it
  20860. // This is only available in node >= v19.9.0
  20861. if (typeof getMaxListeners === 'function' && getMaxListeners(signal) === defaultMaxListeners) {
  20862. setMaxListeners(100, signal)
  20863. } else if (getEventListeners(signal, 'abort').length >= defaultMaxListeners) {
  20864. setMaxListeners(100, signal)
  20865. }
  20866. } catch {}
  20867. util.addAbortListener(signal, abort)
  20868. requestFinalizer.register(ac, { signal, abort })
  20869. }
  20870. }
  20871. // 30. Set this’s headers to a new Headers object with this’s relevant
  20872. // Realm, whose header list is request’s header list and guard is
  20873. // "request".
  20874. this[kHeaders] = new Headers(kConstruct)
  20875. this[kHeaders][kHeadersList] = request.headersList
  20876. this[kHeaders][kGuard] = 'request'
  20877. this[kHeaders][kRealm] = this[kRealm]
  20878. // 31. If this’s request’s mode is "no-cors", then:
  20879. if (mode === 'no-cors') {
  20880. // 1. If this’s request’s method is not a CORS-safelisted method,
  20881. // then throw a TypeError.
  20882. if (!corsSafeListedMethodsSet.has(request.method)) {
  20883. throw new TypeError(
  20884. `'${request.method} is unsupported in no-cors mode.`
  20885. )
  20886. }
  20887. // 2. Set this’s headers’s guard to "request-no-cors".
  20888. this[kHeaders][kGuard] = 'request-no-cors'
  20889. }
  20890. // 32. If init is not empty, then:
  20891. if (initHasKey) {
  20892. /** @type {HeadersList} */
  20893. const headersList = this[kHeaders][kHeadersList]
  20894. // 1. Let headers be a copy of this’s headers and its associated header
  20895. // list.
  20896. // 2. If init["headers"] exists, then set headers to init["headers"].
  20897. const headers = init.headers !== undefined ? init.headers : new HeadersList(headersList)
  20898. // 3. Empty this’s headers’s header list.
  20899. headersList.clear()
  20900. // 4. If headers is a Headers object, then for each header in its header
  20901. // list, append header’s name/header’s value to this’s headers.
  20902. if (headers instanceof HeadersList) {
  20903. for (const [key, val] of headers) {
  20904. headersList.append(key, val)
  20905. }
  20906. // Note: Copy the `set-cookie` meta-data.
  20907. headersList.cookies = headers.cookies
  20908. } else {
  20909. // 5. Otherwise, fill this’s headers with headers.
  20910. fillHeaders(this[kHeaders], headers)
  20911. }
  20912. }
  20913. // 33. Let inputBody be input’s request’s body if input is a Request
  20914. // object; otherwise null.
  20915. const inputBody = input instanceof Request ? input[kState].body : null
  20916. // 34. If either init["body"] exists and is non-null or inputBody is
  20917. // non-null, and request’s method is `GET` or `HEAD`, then throw a
  20918. // TypeError.
  20919. if (
  20920. (init.body != null || inputBody != null) &&
  20921. (request.method === 'GET' || request.method === 'HEAD')
  20922. ) {
  20923. throw new TypeError('Request with GET/HEAD method cannot have body.')
  20924. }
  20925. // 35. Let initBody be null.
  20926. let initBody = null
  20927. // 36. If init["body"] exists and is non-null, then:
  20928. if (init.body != null) {
  20929. // 1. Let Content-Type be null.
  20930. // 2. Set initBody and Content-Type to the result of extracting
  20931. // init["body"], with keepalive set to request’s keepalive.
  20932. const [extractedBody, contentType] = extractBody(
  20933. init.body,
  20934. request.keepalive
  20935. )
  20936. initBody = extractedBody
  20937. // 3, If Content-Type is non-null and this’s headers’s header list does
  20938. // not contain `Content-Type`, then append `Content-Type`/Content-Type to
  20939. // this’s headers.
  20940. if (contentType && !this[kHeaders][kHeadersList].contains('content-type')) {
  20941. this[kHeaders].append('content-type', contentType)
  20942. }
  20943. }
  20944. // 37. Let inputOrInitBody be initBody if it is non-null; otherwise
  20945. // inputBody.
  20946. const inputOrInitBody = initBody ?? inputBody
  20947. // 38. If inputOrInitBody is non-null and inputOrInitBody’s source is
  20948. // null, then:
  20949. if (inputOrInitBody != null && inputOrInitBody.source == null) {
  20950. // 1. If initBody is non-null and init["duplex"] does not exist,
  20951. // then throw a TypeError.
  20952. if (initBody != null && init.duplex == null) {
  20953. throw new TypeError('RequestInit: duplex option is required when sending a body.')
  20954. }
  20955. // 2. If this’s request’s mode is neither "same-origin" nor "cors",
  20956. // then throw a TypeError.
  20957. if (request.mode !== 'same-origin' && request.mode !== 'cors') {
  20958. throw new TypeError(
  20959. 'If request is made from ReadableStream, mode should be "same-origin" or "cors"'
  20960. )
  20961. }
  20962. // 3. Set this’s request’s use-CORS-preflight flag.
  20963. request.useCORSPreflightFlag = true
  20964. }
  20965. // 39. Let finalBody be inputOrInitBody.
  20966. let finalBody = inputOrInitBody
  20967. // 40. If initBody is null and inputBody is non-null, then:
  20968. if (initBody == null && inputBody != null) {
  20969. // 1. If input is unusable, then throw a TypeError.
  20970. if (util.isDisturbed(inputBody.stream) || inputBody.stream.locked) {
  20971. throw new TypeError(
  20972. 'Cannot construct a Request with a Request object that has already been used.'
  20973. )
  20974. }
  20975. // 2. Set finalBody to the result of creating a proxy for inputBody.
  20976. if (!TransformStream) {
  20977. TransformStream = (__nccwpck_require__(5356).TransformStream)
  20978. }
  20979. // https://streams.spec.whatwg.org/#readablestream-create-a-proxy
  20980. const identityTransform = new TransformStream()
  20981. inputBody.stream.pipeThrough(identityTransform)
  20982. finalBody = {
  20983. source: inputBody.source,
  20984. length: inputBody.length,
  20985. stream: identityTransform.readable
  20986. }
  20987. }
  20988. // 41. Set this’s request’s body to finalBody.
  20989. this[kState].body = finalBody
  20990. }
  20991. // Returns request’s HTTP method, which is "GET" by default.
  20992. get method () {
  20993. webidl.brandCheck(this, Request)
  20994. // The method getter steps are to return this’s request’s method.
  20995. return this[kState].method
  20996. }
  20997. // Returns the URL of request as a string.
  20998. get url () {
  20999. webidl.brandCheck(this, Request)
  21000. // The url getter steps are to return this’s request’s URL, serialized.
  21001. return URLSerializer(this[kState].url)
  21002. }
  21003. // Returns a Headers object consisting of the headers associated with request.
  21004. // Note that headers added in the network layer by the user agent will not
  21005. // be accounted for in this object, e.g., the "Host" header.
  21006. get headers () {
  21007. webidl.brandCheck(this, Request)
  21008. // The headers getter steps are to return this’s headers.
  21009. return this[kHeaders]
  21010. }
  21011. // Returns the kind of resource requested by request, e.g., "document"
  21012. // or "script".
  21013. get destination () {
  21014. webidl.brandCheck(this, Request)
  21015. // The destination getter are to return this’s request’s destination.
  21016. return this[kState].destination
  21017. }
  21018. // Returns the referrer of request. Its value can be a same-origin URL if
  21019. // explicitly set in init, the empty string to indicate no referrer, and
  21020. // "about:client" when defaulting to the global’s default. This is used
  21021. // during fetching to determine the value of the `Referer` header of the
  21022. // request being made.
  21023. get referrer () {
  21024. webidl.brandCheck(this, Request)
  21025. // 1. If this’s request’s referrer is "no-referrer", then return the
  21026. // empty string.
  21027. if (this[kState].referrer === 'no-referrer') {
  21028. return ''
  21029. }
  21030. // 2. If this’s request’s referrer is "client", then return
  21031. // "about:client".
  21032. if (this[kState].referrer === 'client') {
  21033. return 'about:client'
  21034. }
  21035. // Return this’s request’s referrer, serialized.
  21036. return this[kState].referrer.toString()
  21037. }
  21038. // Returns the referrer policy associated with request.
  21039. // This is used during fetching to compute the value of the request’s
  21040. // referrer.
  21041. get referrerPolicy () {
  21042. webidl.brandCheck(this, Request)
  21043. // The referrerPolicy getter steps are to return this’s request’s referrer policy.
  21044. return this[kState].referrerPolicy
  21045. }
  21046. // Returns the mode associated with request, which is a string indicating
  21047. // whether the request will use CORS, or will be restricted to same-origin
  21048. // URLs.
  21049. get mode () {
  21050. webidl.brandCheck(this, Request)
  21051. // The mode getter steps are to return this’s request’s mode.
  21052. return this[kState].mode
  21053. }
  21054. // Returns the credentials mode associated with request,
  21055. // which is a string indicating whether credentials will be sent with the
  21056. // request always, never, or only when sent to a same-origin URL.
  21057. get credentials () {
  21058. // The credentials getter steps are to return this’s request’s credentials mode.
  21059. return this[kState].credentials
  21060. }
  21061. // Returns the cache mode associated with request,
  21062. // which is a string indicating how the request will
  21063. // interact with the browser’s cache when fetching.
  21064. get cache () {
  21065. webidl.brandCheck(this, Request)
  21066. // The cache getter steps are to return this’s request’s cache mode.
  21067. return this[kState].cache
  21068. }
  21069. // Returns the redirect mode associated with request,
  21070. // which is a string indicating how redirects for the
  21071. // request will be handled during fetching. A request
  21072. // will follow redirects by default.
  21073. get redirect () {
  21074. webidl.brandCheck(this, Request)
  21075. // The redirect getter steps are to return this’s request’s redirect mode.
  21076. return this[kState].redirect
  21077. }
  21078. // Returns request’s subresource integrity metadata, which is a
  21079. // cryptographic hash of the resource being fetched. Its value
  21080. // consists of multiple hashes separated by whitespace. [SRI]
  21081. get integrity () {
  21082. webidl.brandCheck(this, Request)
  21083. // The integrity getter steps are to return this’s request’s integrity
  21084. // metadata.
  21085. return this[kState].integrity
  21086. }
  21087. // Returns a boolean indicating whether or not request can outlive the
  21088. // global in which it was created.
  21089. get keepalive () {
  21090. webidl.brandCheck(this, Request)
  21091. // The keepalive getter steps are to return this’s request’s keepalive.
  21092. return this[kState].keepalive
  21093. }
  21094. // Returns a boolean indicating whether or not request is for a reload
  21095. // navigation.
  21096. get isReloadNavigation () {
  21097. webidl.brandCheck(this, Request)
  21098. // The isReloadNavigation getter steps are to return true if this’s
  21099. // request’s reload-navigation flag is set; otherwise false.
  21100. return this[kState].reloadNavigation
  21101. }
  21102. // Returns a boolean indicating whether or not request is for a history
  21103. // navigation (a.k.a. back-foward navigation).
  21104. get isHistoryNavigation () {
  21105. webidl.brandCheck(this, Request)
  21106. // The isHistoryNavigation getter steps are to return true if this’s request’s
  21107. // history-navigation flag is set; otherwise false.
  21108. return this[kState].historyNavigation
  21109. }
  21110. // Returns the signal associated with request, which is an AbortSignal
  21111. // object indicating whether or not request has been aborted, and its
  21112. // abort event handler.
  21113. get signal () {
  21114. webidl.brandCheck(this, Request)
  21115. // The signal getter steps are to return this’s signal.
  21116. return this[kSignal]
  21117. }
  21118. get body () {
  21119. webidl.brandCheck(this, Request)
  21120. return this[kState].body ? this[kState].body.stream : null
  21121. }
  21122. get bodyUsed () {
  21123. webidl.brandCheck(this, Request)
  21124. return !!this[kState].body && util.isDisturbed(this[kState].body.stream)
  21125. }
  21126. get duplex () {
  21127. webidl.brandCheck(this, Request)
  21128. return 'half'
  21129. }
  21130. // Returns a clone of request.
  21131. clone () {
  21132. webidl.brandCheck(this, Request)
  21133. // 1. If this is unusable, then throw a TypeError.
  21134. if (this.bodyUsed || this.body?.locked) {
  21135. throw new TypeError('unusable')
  21136. }
  21137. // 2. Let clonedRequest be the result of cloning this’s request.
  21138. const clonedRequest = cloneRequest(this[kState])
  21139. // 3. Let clonedRequestObject be the result of creating a Request object,
  21140. // given clonedRequest, this’s headers’s guard, and this’s relevant Realm.
  21141. const clonedRequestObject = new Request(kConstruct)
  21142. clonedRequestObject[kState] = clonedRequest
  21143. clonedRequestObject[kRealm] = this[kRealm]
  21144. clonedRequestObject[kHeaders] = new Headers(kConstruct)
  21145. clonedRequestObject[kHeaders][kHeadersList] = clonedRequest.headersList
  21146. clonedRequestObject[kHeaders][kGuard] = this[kHeaders][kGuard]
  21147. clonedRequestObject[kHeaders][kRealm] = this[kHeaders][kRealm]
  21148. // 4. Make clonedRequestObject’s signal follow this’s signal.
  21149. const ac = new AbortController()
  21150. if (this.signal.aborted) {
  21151. ac.abort(this.signal.reason)
  21152. } else {
  21153. util.addAbortListener(
  21154. this.signal,
  21155. () => {
  21156. ac.abort(this.signal.reason)
  21157. }
  21158. )
  21159. }
  21160. clonedRequestObject[kSignal] = ac.signal
  21161. // 4. Return clonedRequestObject.
  21162. return clonedRequestObject
  21163. }
  21164. }
  21165. mixinBody(Request)
  21166. function makeRequest (init) {
  21167. // https://fetch.spec.whatwg.org/#requests
  21168. const request = {
  21169. method: 'GET',
  21170. localURLsOnly: false,
  21171. unsafeRequest: false,
  21172. body: null,
  21173. client: null,
  21174. reservedClient: null,
  21175. replacesClientId: '',
  21176. window: 'client',
  21177. keepalive: false,
  21178. serviceWorkers: 'all',
  21179. initiator: '',
  21180. destination: '',
  21181. priority: null,
  21182. origin: 'client',
  21183. policyContainer: 'client',
  21184. referrer: 'client',
  21185. referrerPolicy: '',
  21186. mode: 'no-cors',
  21187. useCORSPreflightFlag: false,
  21188. credentials: 'same-origin',
  21189. useCredentials: false,
  21190. cache: 'default',
  21191. redirect: 'follow',
  21192. integrity: '',
  21193. cryptoGraphicsNonceMetadata: '',
  21194. parserMetadata: '',
  21195. reloadNavigation: false,
  21196. historyNavigation: false,
  21197. userActivation: false,
  21198. taintedOrigin: false,
  21199. redirectCount: 0,
  21200. responseTainting: 'basic',
  21201. preventNoCacheCacheControlHeaderModification: false,
  21202. done: false,
  21203. timingAllowFailed: false,
  21204. ...init,
  21205. headersList: init.headersList
  21206. ? new HeadersList(init.headersList)
  21207. : new HeadersList()
  21208. }
  21209. request.url = request.urlList[0]
  21210. return request
  21211. }
  21212. // https://fetch.spec.whatwg.org/#concept-request-clone
  21213. function cloneRequest (request) {
  21214. // To clone a request request, run these steps:
  21215. // 1. Let newRequest be a copy of request, except for its body.
  21216. const newRequest = makeRequest({ ...request, body: null })
  21217. // 2. If request’s body is non-null, set newRequest’s body to the
  21218. // result of cloning request’s body.
  21219. if (request.body != null) {
  21220. newRequest.body = cloneBody(request.body)
  21221. }
  21222. // 3. Return newRequest.
  21223. return newRequest
  21224. }
  21225. Object.defineProperties(Request.prototype, {
  21226. method: kEnumerableProperty,
  21227. url: kEnumerableProperty,
  21228. headers: kEnumerableProperty,
  21229. redirect: kEnumerableProperty,
  21230. clone: kEnumerableProperty,
  21231. signal: kEnumerableProperty,
  21232. duplex: kEnumerableProperty,
  21233. destination: kEnumerableProperty,
  21234. body: kEnumerableProperty,
  21235. bodyUsed: kEnumerableProperty,
  21236. isHistoryNavigation: kEnumerableProperty,
  21237. isReloadNavigation: kEnumerableProperty,
  21238. keepalive: kEnumerableProperty,
  21239. integrity: kEnumerableProperty,
  21240. cache: kEnumerableProperty,
  21241. credentials: kEnumerableProperty,
  21242. attribute: kEnumerableProperty,
  21243. referrerPolicy: kEnumerableProperty,
  21244. referrer: kEnumerableProperty,
  21245. mode: kEnumerableProperty,
  21246. [Symbol.toStringTag]: {
  21247. value: 'Request',
  21248. configurable: true
  21249. }
  21250. })
  21251. webidl.converters.Request = webidl.interfaceConverter(
  21252. Request
  21253. )
  21254. // https://fetch.spec.whatwg.org/#requestinfo
  21255. webidl.converters.RequestInfo = function (V) {
  21256. if (typeof V === 'string') {
  21257. return webidl.converters.USVString(V)
  21258. }
  21259. if (V instanceof Request) {
  21260. return webidl.converters.Request(V)
  21261. }
  21262. return webidl.converters.USVString(V)
  21263. }
  21264. webidl.converters.AbortSignal = webidl.interfaceConverter(
  21265. AbortSignal
  21266. )
  21267. // https://fetch.spec.whatwg.org/#requestinit
  21268. webidl.converters.RequestInit = webidl.dictionaryConverter([
  21269. {
  21270. key: 'method',
  21271. converter: webidl.converters.ByteString
  21272. },
  21273. {
  21274. key: 'headers',
  21275. converter: webidl.converters.HeadersInit
  21276. },
  21277. {
  21278. key: 'body',
  21279. converter: webidl.nullableConverter(
  21280. webidl.converters.BodyInit
  21281. )
  21282. },
  21283. {
  21284. key: 'referrer',
  21285. converter: webidl.converters.USVString
  21286. },
  21287. {
  21288. key: 'referrerPolicy',
  21289. converter: webidl.converters.DOMString,
  21290. // https://w3c.github.io/webappsec-referrer-policy/#referrer-policy
  21291. allowedValues: referrerPolicy
  21292. },
  21293. {
  21294. key: 'mode',
  21295. converter: webidl.converters.DOMString,
  21296. // https://fetch.spec.whatwg.org/#concept-request-mode
  21297. allowedValues: requestMode
  21298. },
  21299. {
  21300. key: 'credentials',
  21301. converter: webidl.converters.DOMString,
  21302. // https://fetch.spec.whatwg.org/#requestcredentials
  21303. allowedValues: requestCredentials
  21304. },
  21305. {
  21306. key: 'cache',
  21307. converter: webidl.converters.DOMString,
  21308. // https://fetch.spec.whatwg.org/#requestcache
  21309. allowedValues: requestCache
  21310. },
  21311. {
  21312. key: 'redirect',
  21313. converter: webidl.converters.DOMString,
  21314. // https://fetch.spec.whatwg.org/#requestredirect
  21315. allowedValues: requestRedirect
  21316. },
  21317. {
  21318. key: 'integrity',
  21319. converter: webidl.converters.DOMString
  21320. },
  21321. {
  21322. key: 'keepalive',
  21323. converter: webidl.converters.boolean
  21324. },
  21325. {
  21326. key: 'signal',
  21327. converter: webidl.nullableConverter(
  21328. (signal) => webidl.converters.AbortSignal(
  21329. signal,
  21330. { strict: false }
  21331. )
  21332. )
  21333. },
  21334. {
  21335. key: 'window',
  21336. converter: webidl.converters.any
  21337. },
  21338. {
  21339. key: 'duplex',
  21340. converter: webidl.converters.DOMString,
  21341. allowedValues: requestDuplex
  21342. }
  21343. ])
  21344. module.exports = { Request, makeRequest }
  21345. /***/ }),
  21346. /***/ 7823:
  21347. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  21348. const { Headers, HeadersList, fill } = __nccwpck_require__(554)
  21349. const { extractBody, cloneBody, mixinBody } = __nccwpck_require__(9990)
  21350. const util = __nccwpck_require__(3983)
  21351. const { kEnumerableProperty } = util
  21352. const {
  21353. isValidReasonPhrase,
  21354. isCancelled,
  21355. isAborted,
  21356. isBlobLike,
  21357. serializeJavascriptValueToJSONString,
  21358. isErrorLike,
  21359. isomorphicEncode
  21360. } = __nccwpck_require__(2538)
  21361. const {
  21362. redirectStatusSet,
  21363. nullBodyStatus,
  21364. DOMException
  21365. } = __nccwpck_require__(1037)
  21366. const { kState, kHeaders, kGuard, kRealm } = __nccwpck_require__(5861)
  21367. const { webidl } = __nccwpck_require__(1744)
  21368. const { FormData } = __nccwpck_require__(2015)
  21369. const { getGlobalOrigin } = __nccwpck_require__(1246)
  21370. const { URLSerializer } = __nccwpck_require__(685)
  21371. const { kHeadersList, kConstruct } = __nccwpck_require__(2785)
  21372. const assert = __nccwpck_require__(9491)
  21373. const { types } = __nccwpck_require__(3837)
  21374. const ReadableStream = globalThis.ReadableStream || (__nccwpck_require__(5356).ReadableStream)
  21375. const textEncoder = new TextEncoder('utf-8')
  21376. // https://fetch.spec.whatwg.org/#response-class
  21377. class Response {
  21378. // Creates network error Response.
  21379. static error () {
  21380. // TODO
  21381. const relevantRealm = { settingsObject: {} }
  21382. // The static error() method steps are to return the result of creating a
  21383. // Response object, given a new network error, "immutable", and this’s
  21384. // relevant Realm.
  21385. const responseObject = new Response()
  21386. responseObject[kState] = makeNetworkError()
  21387. responseObject[kRealm] = relevantRealm
  21388. responseObject[kHeaders][kHeadersList] = responseObject[kState].headersList
  21389. responseObject[kHeaders][kGuard] = 'immutable'
  21390. responseObject[kHeaders][kRealm] = relevantRealm
  21391. return responseObject
  21392. }
  21393. // https://fetch.spec.whatwg.org/#dom-response-json
  21394. static json (data, init = {}) {
  21395. webidl.argumentLengthCheck(arguments, 1, { header: 'Response.json' })
  21396. if (init !== null) {
  21397. init = webidl.converters.ResponseInit(init)
  21398. }
  21399. // 1. Let bytes the result of running serialize a JavaScript value to JSON bytes on data.
  21400. const bytes = textEncoder.encode(
  21401. serializeJavascriptValueToJSONString(data)
  21402. )
  21403. // 2. Let body be the result of extracting bytes.
  21404. const body = extractBody(bytes)
  21405. // 3. Let responseObject be the result of creating a Response object, given a new response,
  21406. // "response", and this’s relevant Realm.
  21407. const relevantRealm = { settingsObject: {} }
  21408. const responseObject = new Response()
  21409. responseObject[kRealm] = relevantRealm
  21410. responseObject[kHeaders][kGuard] = 'response'
  21411. responseObject[kHeaders][kRealm] = relevantRealm
  21412. // 4. Perform initialize a response given responseObject, init, and (body, "application/json").
  21413. initializeResponse(responseObject, init, { body: body[0], type: 'application/json' })
  21414. // 5. Return responseObject.
  21415. return responseObject
  21416. }
  21417. // Creates a redirect Response that redirects to url with status status.
  21418. static redirect (url, status = 302) {
  21419. const relevantRealm = { settingsObject: {} }
  21420. webidl.argumentLengthCheck(arguments, 1, { header: 'Response.redirect' })
  21421. url = webidl.converters.USVString(url)
  21422. status = webidl.converters['unsigned short'](status)
  21423. // 1. Let parsedURL be the result of parsing url with current settings
  21424. // object’s API base URL.
  21425. // 2. If parsedURL is failure, then throw a TypeError.
  21426. // TODO: base-URL?
  21427. let parsedURL
  21428. try {
  21429. parsedURL = new URL(url, getGlobalOrigin())
  21430. } catch (err) {
  21431. throw Object.assign(new TypeError('Failed to parse URL from ' + url), {
  21432. cause: err
  21433. })
  21434. }
  21435. // 3. If status is not a redirect status, then throw a RangeError.
  21436. if (!redirectStatusSet.has(status)) {
  21437. throw new RangeError('Invalid status code ' + status)
  21438. }
  21439. // 4. Let responseObject be the result of creating a Response object,
  21440. // given a new response, "immutable", and this’s relevant Realm.
  21441. const responseObject = new Response()
  21442. responseObject[kRealm] = relevantRealm
  21443. responseObject[kHeaders][kGuard] = 'immutable'
  21444. responseObject[kHeaders][kRealm] = relevantRealm
  21445. // 5. Set responseObject’s response’s status to status.
  21446. responseObject[kState].status = status
  21447. // 6. Let value be parsedURL, serialized and isomorphic encoded.
  21448. const value = isomorphicEncode(URLSerializer(parsedURL))
  21449. // 7. Append `Location`/value to responseObject’s response’s header list.
  21450. responseObject[kState].headersList.append('location', value)
  21451. // 8. Return responseObject.
  21452. return responseObject
  21453. }
  21454. // https://fetch.spec.whatwg.org/#dom-response
  21455. constructor (body = null, init = {}) {
  21456. if (body !== null) {
  21457. body = webidl.converters.BodyInit(body)
  21458. }
  21459. init = webidl.converters.ResponseInit(init)
  21460. // TODO
  21461. this[kRealm] = { settingsObject: {} }
  21462. // 1. Set this’s response to a new response.
  21463. this[kState] = makeResponse({})
  21464. // 2. Set this’s headers to a new Headers object with this’s relevant
  21465. // Realm, whose header list is this’s response’s header list and guard
  21466. // is "response".
  21467. this[kHeaders] = new Headers(kConstruct)
  21468. this[kHeaders][kGuard] = 'response'
  21469. this[kHeaders][kHeadersList] = this[kState].headersList
  21470. this[kHeaders][kRealm] = this[kRealm]
  21471. // 3. Let bodyWithType be null.
  21472. let bodyWithType = null
  21473. // 4. If body is non-null, then set bodyWithType to the result of extracting body.
  21474. if (body != null) {
  21475. const [extractedBody, type] = extractBody(body)
  21476. bodyWithType = { body: extractedBody, type }
  21477. }
  21478. // 5. Perform initialize a response given this, init, and bodyWithType.
  21479. initializeResponse(this, init, bodyWithType)
  21480. }
  21481. // Returns response’s type, e.g., "cors".
  21482. get type () {
  21483. webidl.brandCheck(this, Response)
  21484. // The type getter steps are to return this’s response’s type.
  21485. return this[kState].type
  21486. }
  21487. // Returns response’s URL, if it has one; otherwise the empty string.
  21488. get url () {
  21489. webidl.brandCheck(this, Response)
  21490. const urlList = this[kState].urlList
  21491. // The url getter steps are to return the empty string if this’s
  21492. // response’s URL is null; otherwise this’s response’s URL,
  21493. // serialized with exclude fragment set to true.
  21494. const url = urlList[urlList.length - 1] ?? null
  21495. if (url === null) {
  21496. return ''
  21497. }
  21498. return URLSerializer(url, true)
  21499. }
  21500. // Returns whether response was obtained through a redirect.
  21501. get redirected () {
  21502. webidl.brandCheck(this, Response)
  21503. // The redirected getter steps are to return true if this’s response’s URL
  21504. // list has more than one item; otherwise false.
  21505. return this[kState].urlList.length > 1
  21506. }
  21507. // Returns response’s status.
  21508. get status () {
  21509. webidl.brandCheck(this, Response)
  21510. // The status getter steps are to return this’s response’s status.
  21511. return this[kState].status
  21512. }
  21513. // Returns whether response’s status is an ok status.
  21514. get ok () {
  21515. webidl.brandCheck(this, Response)
  21516. // The ok getter steps are to return true if this’s response’s status is an
  21517. // ok status; otherwise false.
  21518. return this[kState].status >= 200 && this[kState].status <= 299
  21519. }
  21520. // Returns response’s status message.
  21521. get statusText () {
  21522. webidl.brandCheck(this, Response)
  21523. // The statusText getter steps are to return this’s response’s status
  21524. // message.
  21525. return this[kState].statusText
  21526. }
  21527. // Returns response’s headers as Headers.
  21528. get headers () {
  21529. webidl.brandCheck(this, Response)
  21530. // The headers getter steps are to return this’s headers.
  21531. return this[kHeaders]
  21532. }
  21533. get body () {
  21534. webidl.brandCheck(this, Response)
  21535. return this[kState].body ? this[kState].body.stream : null
  21536. }
  21537. get bodyUsed () {
  21538. webidl.brandCheck(this, Response)
  21539. return !!this[kState].body && util.isDisturbed(this[kState].body.stream)
  21540. }
  21541. // Returns a clone of response.
  21542. clone () {
  21543. webidl.brandCheck(this, Response)
  21544. // 1. If this is unusable, then throw a TypeError.
  21545. if (this.bodyUsed || (this.body && this.body.locked)) {
  21546. throw webidl.errors.exception({
  21547. header: 'Response.clone',
  21548. message: 'Body has already been consumed.'
  21549. })
  21550. }
  21551. // 2. Let clonedResponse be the result of cloning this’s response.
  21552. const clonedResponse = cloneResponse(this[kState])
  21553. // 3. Return the result of creating a Response object, given
  21554. // clonedResponse, this’s headers’s guard, and this’s relevant Realm.
  21555. const clonedResponseObject = new Response()
  21556. clonedResponseObject[kState] = clonedResponse
  21557. clonedResponseObject[kRealm] = this[kRealm]
  21558. clonedResponseObject[kHeaders][kHeadersList] = clonedResponse.headersList
  21559. clonedResponseObject[kHeaders][kGuard] = this[kHeaders][kGuard]
  21560. clonedResponseObject[kHeaders][kRealm] = this[kHeaders][kRealm]
  21561. return clonedResponseObject
  21562. }
  21563. }
  21564. mixinBody(Response)
  21565. Object.defineProperties(Response.prototype, {
  21566. type: kEnumerableProperty,
  21567. url: kEnumerableProperty,
  21568. status: kEnumerableProperty,
  21569. ok: kEnumerableProperty,
  21570. redirected: kEnumerableProperty,
  21571. statusText: kEnumerableProperty,
  21572. headers: kEnumerableProperty,
  21573. clone: kEnumerableProperty,
  21574. body: kEnumerableProperty,
  21575. bodyUsed: kEnumerableProperty,
  21576. [Symbol.toStringTag]: {
  21577. value: 'Response',
  21578. configurable: true
  21579. }
  21580. })
  21581. Object.defineProperties(Response, {
  21582. json: kEnumerableProperty,
  21583. redirect: kEnumerableProperty,
  21584. error: kEnumerableProperty
  21585. })
  21586. // https://fetch.spec.whatwg.org/#concept-response-clone
  21587. function cloneResponse (response) {
  21588. // To clone a response response, run these steps:
  21589. // 1. If response is a filtered response, then return a new identical
  21590. // filtered response whose internal response is a clone of response’s
  21591. // internal response.
  21592. if (response.internalResponse) {
  21593. return filterResponse(
  21594. cloneResponse(response.internalResponse),
  21595. response.type
  21596. )
  21597. }
  21598. // 2. Let newResponse be a copy of response, except for its body.
  21599. const newResponse = makeResponse({ ...response, body: null })
  21600. // 3. If response’s body is non-null, then set newResponse’s body to the
  21601. // result of cloning response’s body.
  21602. if (response.body != null) {
  21603. newResponse.body = cloneBody(response.body)
  21604. }
  21605. // 4. Return newResponse.
  21606. return newResponse
  21607. }
  21608. function makeResponse (init) {
  21609. return {
  21610. aborted: false,
  21611. rangeRequested: false,
  21612. timingAllowPassed: false,
  21613. requestIncludesCredentials: false,
  21614. type: 'default',
  21615. status: 200,
  21616. timingInfo: null,
  21617. cacheState: '',
  21618. statusText: '',
  21619. ...init,
  21620. headersList: init.headersList
  21621. ? new HeadersList(init.headersList)
  21622. : new HeadersList(),
  21623. urlList: init.urlList ? [...init.urlList] : []
  21624. }
  21625. }
  21626. function makeNetworkError (reason) {
  21627. const isError = isErrorLike(reason)
  21628. return makeResponse({
  21629. type: 'error',
  21630. status: 0,
  21631. error: isError
  21632. ? reason
  21633. : new Error(reason ? String(reason) : reason),
  21634. aborted: reason && reason.name === 'AbortError'
  21635. })
  21636. }
  21637. function makeFilteredResponse (response, state) {
  21638. state = {
  21639. internalResponse: response,
  21640. ...state
  21641. }
  21642. return new Proxy(response, {
  21643. get (target, p) {
  21644. return p in state ? state[p] : target[p]
  21645. },
  21646. set (target, p, value) {
  21647. assert(!(p in state))
  21648. target[p] = value
  21649. return true
  21650. }
  21651. })
  21652. }
  21653. // https://fetch.spec.whatwg.org/#concept-filtered-response
  21654. function filterResponse (response, type) {
  21655. // Set response to the following filtered response with response as its
  21656. // internal response, depending on request’s response tainting:
  21657. if (type === 'basic') {
  21658. // A basic filtered response is a filtered response whose type is "basic"
  21659. // and header list excludes any headers in internal response’s header list
  21660. // whose name is a forbidden response-header name.
  21661. // Note: undici does not implement forbidden response-header names
  21662. return makeFilteredResponse(response, {
  21663. type: 'basic',
  21664. headersList: response.headersList
  21665. })
  21666. } else if (type === 'cors') {
  21667. // A CORS filtered response is a filtered response whose type is "cors"
  21668. // and header list excludes any headers in internal response’s header
  21669. // list whose name is not a CORS-safelisted response-header name, given
  21670. // internal response’s CORS-exposed header-name list.
  21671. // Note: undici does not implement CORS-safelisted response-header names
  21672. return makeFilteredResponse(response, {
  21673. type: 'cors',
  21674. headersList: response.headersList
  21675. })
  21676. } else if (type === 'opaque') {
  21677. // An opaque filtered response is a filtered response whose type is
  21678. // "opaque", URL list is the empty list, status is 0, status message
  21679. // is the empty byte sequence, header list is empty, and body is null.
  21680. return makeFilteredResponse(response, {
  21681. type: 'opaque',
  21682. urlList: Object.freeze([]),
  21683. status: 0,
  21684. statusText: '',
  21685. body: null
  21686. })
  21687. } else if (type === 'opaqueredirect') {
  21688. // An opaque-redirect filtered response is a filtered response whose type
  21689. // is "opaqueredirect", status is 0, status message is the empty byte
  21690. // sequence, header list is empty, and body is null.
  21691. return makeFilteredResponse(response, {
  21692. type: 'opaqueredirect',
  21693. status: 0,
  21694. statusText: '',
  21695. headersList: [],
  21696. body: null
  21697. })
  21698. } else {
  21699. assert(false)
  21700. }
  21701. }
  21702. // https://fetch.spec.whatwg.org/#appropriate-network-error
  21703. function makeAppropriateNetworkError (fetchParams, err = null) {
  21704. // 1. Assert: fetchParams is canceled.
  21705. assert(isCancelled(fetchParams))
  21706. // 2. Return an aborted network error if fetchParams is aborted;
  21707. // otherwise return a network error.
  21708. return isAborted(fetchParams)
  21709. ? makeNetworkError(Object.assign(new DOMException('The operation was aborted.', 'AbortError'), { cause: err }))
  21710. : makeNetworkError(Object.assign(new DOMException('Request was cancelled.'), { cause: err }))
  21711. }
  21712. // https://whatpr.org/fetch/1392.html#initialize-a-response
  21713. function initializeResponse (response, init, body) {
  21714. // 1. If init["status"] is not in the range 200 to 599, inclusive, then
  21715. // throw a RangeError.
  21716. if (init.status !== null && (init.status < 200 || init.status > 599)) {
  21717. throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.')
  21718. }
  21719. // 2. If init["statusText"] does not match the reason-phrase token production,
  21720. // then throw a TypeError.
  21721. if ('statusText' in init && init.statusText != null) {
  21722. // See, https://datatracker.ietf.org/doc/html/rfc7230#section-3.1.2:
  21723. // reason-phrase = *( HTAB / SP / VCHAR / obs-text )
  21724. if (!isValidReasonPhrase(String(init.statusText))) {
  21725. throw new TypeError('Invalid statusText')
  21726. }
  21727. }
  21728. // 3. Set response’s response’s status to init["status"].
  21729. if ('status' in init && init.status != null) {
  21730. response[kState].status = init.status
  21731. }
  21732. // 4. Set response’s response’s status message to init["statusText"].
  21733. if ('statusText' in init && init.statusText != null) {
  21734. response[kState].statusText = init.statusText
  21735. }
  21736. // 5. If init["headers"] exists, then fill response’s headers with init["headers"].
  21737. if ('headers' in init && init.headers != null) {
  21738. fill(response[kHeaders], init.headers)
  21739. }
  21740. // 6. If body was given, then:
  21741. if (body) {
  21742. // 1. If response's status is a null body status, then throw a TypeError.
  21743. if (nullBodyStatus.includes(response.status)) {
  21744. throw webidl.errors.exception({
  21745. header: 'Response constructor',
  21746. message: 'Invalid response status code ' + response.status
  21747. })
  21748. }
  21749. // 2. Set response's body to body's body.
  21750. response[kState].body = body.body
  21751. // 3. If body's type is non-null and response's header list does not contain
  21752. // `Content-Type`, then append (`Content-Type`, body's type) to response's header list.
  21753. if (body.type != null && !response[kState].headersList.contains('Content-Type')) {
  21754. response[kState].headersList.append('content-type', body.type)
  21755. }
  21756. }
  21757. }
  21758. webidl.converters.ReadableStream = webidl.interfaceConverter(
  21759. ReadableStream
  21760. )
  21761. webidl.converters.FormData = webidl.interfaceConverter(
  21762. FormData
  21763. )
  21764. webidl.converters.URLSearchParams = webidl.interfaceConverter(
  21765. URLSearchParams
  21766. )
  21767. // https://fetch.spec.whatwg.org/#typedefdef-xmlhttprequestbodyinit
  21768. webidl.converters.XMLHttpRequestBodyInit = function (V) {
  21769. if (typeof V === 'string') {
  21770. return webidl.converters.USVString(V)
  21771. }
  21772. if (isBlobLike(V)) {
  21773. return webidl.converters.Blob(V, { strict: false })
  21774. }
  21775. if (types.isArrayBuffer(V) || types.isTypedArray(V) || types.isDataView(V)) {
  21776. return webidl.converters.BufferSource(V)
  21777. }
  21778. if (util.isFormDataLike(V)) {
  21779. return webidl.converters.FormData(V, { strict: false })
  21780. }
  21781. if (V instanceof URLSearchParams) {
  21782. return webidl.converters.URLSearchParams(V)
  21783. }
  21784. return webidl.converters.DOMString(V)
  21785. }
  21786. // https://fetch.spec.whatwg.org/#bodyinit
  21787. webidl.converters.BodyInit = function (V) {
  21788. if (V instanceof ReadableStream) {
  21789. return webidl.converters.ReadableStream(V)
  21790. }
  21791. // Note: the spec doesn't include async iterables,
  21792. // this is an undici extension.
  21793. if (V?.[Symbol.asyncIterator]) {
  21794. return V
  21795. }
  21796. return webidl.converters.XMLHttpRequestBodyInit(V)
  21797. }
  21798. webidl.converters.ResponseInit = webidl.dictionaryConverter([
  21799. {
  21800. key: 'status',
  21801. converter: webidl.converters['unsigned short'],
  21802. defaultValue: 200
  21803. },
  21804. {
  21805. key: 'statusText',
  21806. converter: webidl.converters.ByteString,
  21807. defaultValue: ''
  21808. },
  21809. {
  21810. key: 'headers',
  21811. converter: webidl.converters.HeadersInit
  21812. }
  21813. ])
  21814. module.exports = {
  21815. makeNetworkError,
  21816. makeResponse,
  21817. makeAppropriateNetworkError,
  21818. filterResponse,
  21819. Response,
  21820. cloneResponse
  21821. }
  21822. /***/ }),
  21823. /***/ 5861:
  21824. /***/ ((module) => {
  21825. module.exports = {
  21826. kUrl: Symbol('url'),
  21827. kHeaders: Symbol('headers'),
  21828. kSignal: Symbol('signal'),
  21829. kState: Symbol('state'),
  21830. kGuard: Symbol('guard'),
  21831. kRealm: Symbol('realm')
  21832. }
  21833. /***/ }),
  21834. /***/ 2538:
  21835. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  21836. const { redirectStatusSet, referrerPolicySet: referrerPolicyTokens, badPortsSet } = __nccwpck_require__(1037)
  21837. const { getGlobalOrigin } = __nccwpck_require__(1246)
  21838. const { performance } = __nccwpck_require__(4074)
  21839. const { isBlobLike, toUSVString, ReadableStreamFrom } = __nccwpck_require__(3983)
  21840. const assert = __nccwpck_require__(9491)
  21841. const { isUint8Array } = __nccwpck_require__(9830)
  21842. let supportedHashes = []
  21843. // https://nodejs.org/api/crypto.html#determining-if-crypto-support-is-unavailable
  21844. /** @type {import('crypto')|undefined} */
  21845. let crypto
  21846. try {
  21847. crypto = __nccwpck_require__(6113)
  21848. const possibleRelevantHashes = ['sha256', 'sha384', 'sha512']
  21849. supportedHashes = crypto.getHashes().filter((hash) => possibleRelevantHashes.includes(hash))
  21850. /* c8 ignore next 3 */
  21851. } catch {
  21852. }
  21853. function responseURL (response) {
  21854. // https://fetch.spec.whatwg.org/#responses
  21855. // A response has an associated URL. It is a pointer to the last URL
  21856. // in response’s URL list and null if response’s URL list is empty.
  21857. const urlList = response.urlList
  21858. const length = urlList.length
  21859. return length === 0 ? null : urlList[length - 1].toString()
  21860. }
  21861. // https://fetch.spec.whatwg.org/#concept-response-location-url
  21862. function responseLocationURL (response, requestFragment) {
  21863. // 1. If response’s status is not a redirect status, then return null.
  21864. if (!redirectStatusSet.has(response.status)) {
  21865. return null
  21866. }
  21867. // 2. Let location be the result of extracting header list values given
  21868. // `Location` and response’s header list.
  21869. let location = response.headersList.get('location')
  21870. // 3. If location is a header value, then set location to the result of
  21871. // parsing location with response’s URL.
  21872. if (location !== null && isValidHeaderValue(location)) {
  21873. location = new URL(location, responseURL(response))
  21874. }
  21875. // 4. If location is a URL whose fragment is null, then set location’s
  21876. // fragment to requestFragment.
  21877. if (location && !location.hash) {
  21878. location.hash = requestFragment
  21879. }
  21880. // 5. Return location.
  21881. return location
  21882. }
  21883. /** @returns {URL} */
  21884. function requestCurrentURL (request) {
  21885. return request.urlList[request.urlList.length - 1]
  21886. }
  21887. function requestBadPort (request) {
  21888. // 1. Let url be request’s current URL.
  21889. const url = requestCurrentURL(request)
  21890. // 2. If url’s scheme is an HTTP(S) scheme and url’s port is a bad port,
  21891. // then return blocked.
  21892. if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) {
  21893. return 'blocked'
  21894. }
  21895. // 3. Return allowed.
  21896. return 'allowed'
  21897. }
  21898. function isErrorLike (object) {
  21899. return object instanceof Error || (
  21900. object?.constructor?.name === 'Error' ||
  21901. object?.constructor?.name === 'DOMException'
  21902. )
  21903. }
  21904. // Check whether |statusText| is a ByteString and
  21905. // matches the Reason-Phrase token production.
  21906. // RFC 2616: https://tools.ietf.org/html/rfc2616
  21907. // RFC 7230: https://tools.ietf.org/html/rfc7230
  21908. // "reason-phrase = *( HTAB / SP / VCHAR / obs-text )"
  21909. // https://github.com/chromium/chromium/blob/94.0.4604.1/third_party/blink/renderer/core/fetch/response.cc#L116
  21910. function isValidReasonPhrase (statusText) {
  21911. for (let i = 0; i < statusText.length; ++i) {
  21912. const c = statusText.charCodeAt(i)
  21913. if (
  21914. !(
  21915. (
  21916. c === 0x09 || // HTAB
  21917. (c >= 0x20 && c <= 0x7e) || // SP / VCHAR
  21918. (c >= 0x80 && c <= 0xff)
  21919. ) // obs-text
  21920. )
  21921. ) {
  21922. return false
  21923. }
  21924. }
  21925. return true
  21926. }
  21927. /**
  21928. * @see https://tools.ietf.org/html/rfc7230#section-3.2.6
  21929. * @param {number} c
  21930. */
  21931. function isTokenCharCode (c) {
  21932. switch (c) {
  21933. case 0x22:
  21934. case 0x28:
  21935. case 0x29:
  21936. case 0x2c:
  21937. case 0x2f:
  21938. case 0x3a:
  21939. case 0x3b:
  21940. case 0x3c:
  21941. case 0x3d:
  21942. case 0x3e:
  21943. case 0x3f:
  21944. case 0x40:
  21945. case 0x5b:
  21946. case 0x5c:
  21947. case 0x5d:
  21948. case 0x7b:
  21949. case 0x7d:
  21950. // DQUOTE and "(),/:;<=>?@[\]{}"
  21951. return false
  21952. default:
  21953. // VCHAR %x21-7E
  21954. return c >= 0x21 && c <= 0x7e
  21955. }
  21956. }
  21957. /**
  21958. * @param {string} characters
  21959. */
  21960. function isValidHTTPToken (characters) {
  21961. if (characters.length === 0) {
  21962. return false
  21963. }
  21964. for (let i = 0; i < characters.length; ++i) {
  21965. if (!isTokenCharCode(characters.charCodeAt(i))) {
  21966. return false
  21967. }
  21968. }
  21969. return true
  21970. }
  21971. /**
  21972. * @see https://fetch.spec.whatwg.org/#header-name
  21973. * @param {string} potentialValue
  21974. */
  21975. function isValidHeaderName (potentialValue) {
  21976. return isValidHTTPToken(potentialValue)
  21977. }
  21978. /**
  21979. * @see https://fetch.spec.whatwg.org/#header-value
  21980. * @param {string} potentialValue
  21981. */
  21982. function isValidHeaderValue (potentialValue) {
  21983. // - Has no leading or trailing HTTP tab or space bytes.
  21984. // - Contains no 0x00 (NUL) or HTTP newline bytes.
  21985. if (
  21986. potentialValue.startsWith('\t') ||
  21987. potentialValue.startsWith(' ') ||
  21988. potentialValue.endsWith('\t') ||
  21989. potentialValue.endsWith(' ')
  21990. ) {
  21991. return false
  21992. }
  21993. if (
  21994. potentialValue.includes('\0') ||
  21995. potentialValue.includes('\r') ||
  21996. potentialValue.includes('\n')
  21997. ) {
  21998. return false
  21999. }
  22000. return true
  22001. }
  22002. // https://w3c.github.io/webappsec-referrer-policy/#set-requests-referrer-policy-on-redirect
  22003. function setRequestReferrerPolicyOnRedirect (request, actualResponse) {
  22004. // Given a request request and a response actualResponse, this algorithm
  22005. // updates request’s referrer policy according to the Referrer-Policy
  22006. // header (if any) in actualResponse.
  22007. // 1. Let policy be the result of executing § 8.1 Parse a referrer policy
  22008. // from a Referrer-Policy header on actualResponse.
  22009. // 8.1 Parse a referrer policy from a Referrer-Policy header
  22010. // 1. Let policy-tokens be the result of extracting header list values given `Referrer-Policy` and response’s header list.
  22011. const { headersList } = actualResponse
  22012. // 2. Let policy be the empty string.
  22013. // 3. For each token in policy-tokens, if token is a referrer policy and token is not the empty string, then set policy to token.
  22014. // 4. Return policy.
  22015. const policyHeader = (headersList.get('referrer-policy') ?? '').split(',')
  22016. // Note: As the referrer-policy can contain multiple policies
  22017. // separated by comma, we need to loop through all of them
  22018. // and pick the first valid one.
  22019. // Ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy#specify_a_fallback_policy
  22020. let policy = ''
  22021. if (policyHeader.length > 0) {
  22022. // The right-most policy takes precedence.
  22023. // The left-most policy is the fallback.
  22024. for (let i = policyHeader.length; i !== 0; i--) {
  22025. const token = policyHeader[i - 1].trim()
  22026. if (referrerPolicyTokens.has(token)) {
  22027. policy = token
  22028. break
  22029. }
  22030. }
  22031. }
  22032. // 2. If policy is not the empty string, then set request’s referrer policy to policy.
  22033. if (policy !== '') {
  22034. request.referrerPolicy = policy
  22035. }
  22036. }
  22037. // https://fetch.spec.whatwg.org/#cross-origin-resource-policy-check
  22038. function crossOriginResourcePolicyCheck () {
  22039. // TODO
  22040. return 'allowed'
  22041. }
  22042. // https://fetch.spec.whatwg.org/#concept-cors-check
  22043. function corsCheck () {
  22044. // TODO
  22045. return 'success'
  22046. }
  22047. // https://fetch.spec.whatwg.org/#concept-tao-check
  22048. function TAOCheck () {
  22049. // TODO
  22050. return 'success'
  22051. }
  22052. function appendFetchMetadata (httpRequest) {
  22053. // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-dest-header
  22054. // TODO
  22055. // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-mode-header
  22056. // 1. Assert: r’s url is a potentially trustworthy URL.
  22057. // TODO
  22058. // 2. Let header be a Structured Header whose value is a token.
  22059. let header = null
  22060. // 3. Set header’s value to r’s mode.
  22061. header = httpRequest.mode
  22062. // 4. Set a structured field value `Sec-Fetch-Mode`/header in r’s header list.
  22063. httpRequest.headersList.set('sec-fetch-mode', header)
  22064. // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-site-header
  22065. // TODO
  22066. // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-user-header
  22067. // TODO
  22068. }
  22069. // https://fetch.spec.whatwg.org/#append-a-request-origin-header
  22070. function appendRequestOriginHeader (request) {
  22071. // 1. Let serializedOrigin be the result of byte-serializing a request origin with request.
  22072. let serializedOrigin = request.origin
  22073. // 2. If request’s response tainting is "cors" or request’s mode is "websocket", then append (`Origin`, serializedOrigin) to request’s header list.
  22074. if (request.responseTainting === 'cors' || request.mode === 'websocket') {
  22075. if (serializedOrigin) {
  22076. request.headersList.append('origin', serializedOrigin)
  22077. }
  22078. // 3. Otherwise, if request’s method is neither `GET` nor `HEAD`, then:
  22079. } else if (request.method !== 'GET' && request.method !== 'HEAD') {
  22080. // 1. Switch on request’s referrer policy:
  22081. switch (request.referrerPolicy) {
  22082. case 'no-referrer':
  22083. // Set serializedOrigin to `null`.
  22084. serializedOrigin = null
  22085. break
  22086. case 'no-referrer-when-downgrade':
  22087. case 'strict-origin':
  22088. case 'strict-origin-when-cross-origin':
  22089. // If request’s origin is a tuple origin, its scheme is "https", and request’s current URL’s scheme is not "https", then set serializedOrigin to `null`.
  22090. if (request.origin && urlHasHttpsScheme(request.origin) && !urlHasHttpsScheme(requestCurrentURL(request))) {
  22091. serializedOrigin = null
  22092. }
  22093. break
  22094. case 'same-origin':
  22095. // If request’s origin is not same origin with request’s current URL’s origin, then set serializedOrigin to `null`.
  22096. if (!sameOrigin(request, requestCurrentURL(request))) {
  22097. serializedOrigin = null
  22098. }
  22099. break
  22100. default:
  22101. // Do nothing.
  22102. }
  22103. if (serializedOrigin) {
  22104. // 2. Append (`Origin`, serializedOrigin) to request’s header list.
  22105. request.headersList.append('origin', serializedOrigin)
  22106. }
  22107. }
  22108. }
  22109. function coarsenedSharedCurrentTime (crossOriginIsolatedCapability) {
  22110. // TODO
  22111. return performance.now()
  22112. }
  22113. // https://fetch.spec.whatwg.org/#create-an-opaque-timing-info
  22114. function createOpaqueTimingInfo (timingInfo) {
  22115. return {
  22116. startTime: timingInfo.startTime ?? 0,
  22117. redirectStartTime: 0,
  22118. redirectEndTime: 0,
  22119. postRedirectStartTime: timingInfo.startTime ?? 0,
  22120. finalServiceWorkerStartTime: 0,
  22121. finalNetworkResponseStartTime: 0,
  22122. finalNetworkRequestStartTime: 0,
  22123. endTime: 0,
  22124. encodedBodySize: 0,
  22125. decodedBodySize: 0,
  22126. finalConnectionTimingInfo: null
  22127. }
  22128. }
  22129. // https://html.spec.whatwg.org/multipage/origin.html#policy-container
  22130. function makePolicyContainer () {
  22131. // Note: the fetch spec doesn't make use of embedder policy or CSP list
  22132. return {
  22133. referrerPolicy: 'strict-origin-when-cross-origin'
  22134. }
  22135. }
  22136. // https://html.spec.whatwg.org/multipage/origin.html#clone-a-policy-container
  22137. function clonePolicyContainer (policyContainer) {
  22138. return {
  22139. referrerPolicy: policyContainer.referrerPolicy
  22140. }
  22141. }
  22142. // https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer
  22143. function determineRequestsReferrer (request) {
  22144. // 1. Let policy be request's referrer policy.
  22145. const policy = request.referrerPolicy
  22146. // Note: policy cannot (shouldn't) be null or an empty string.
  22147. assert(policy)
  22148. // 2. Let environment be request’s client.
  22149. let referrerSource = null
  22150. // 3. Switch on request’s referrer:
  22151. if (request.referrer === 'client') {
  22152. // Note: node isn't a browser and doesn't implement document/iframes,
  22153. // so we bypass this step and replace it with our own.
  22154. const globalOrigin = getGlobalOrigin()
  22155. if (!globalOrigin || globalOrigin.origin === 'null') {
  22156. return 'no-referrer'
  22157. }
  22158. // note: we need to clone it as it's mutated
  22159. referrerSource = new URL(globalOrigin)
  22160. } else if (request.referrer instanceof URL) {
  22161. // Let referrerSource be request’s referrer.
  22162. referrerSource = request.referrer
  22163. }
  22164. // 4. Let request’s referrerURL be the result of stripping referrerSource for
  22165. // use as a referrer.
  22166. let referrerURL = stripURLForReferrer(referrerSource)
  22167. // 5. Let referrerOrigin be the result of stripping referrerSource for use as
  22168. // a referrer, with the origin-only flag set to true.
  22169. const referrerOrigin = stripURLForReferrer(referrerSource, true)
  22170. // 6. If the result of serializing referrerURL is a string whose length is
  22171. // greater than 4096, set referrerURL to referrerOrigin.
  22172. if (referrerURL.toString().length > 4096) {
  22173. referrerURL = referrerOrigin
  22174. }
  22175. const areSameOrigin = sameOrigin(request, referrerURL)
  22176. const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) &&
  22177. !isURLPotentiallyTrustworthy(request.url)
  22178. // 8. Execute the switch statements corresponding to the value of policy:
  22179. switch (policy) {
  22180. case 'origin': return referrerOrigin != null ? referrerOrigin : stripURLForReferrer(referrerSource, true)
  22181. case 'unsafe-url': return referrerURL
  22182. case 'same-origin':
  22183. return areSameOrigin ? referrerOrigin : 'no-referrer'
  22184. case 'origin-when-cross-origin':
  22185. return areSameOrigin ? referrerURL : referrerOrigin
  22186. case 'strict-origin-when-cross-origin': {
  22187. const currentURL = requestCurrentURL(request)
  22188. // 1. If the origin of referrerURL and the origin of request’s current
  22189. // URL are the same, then return referrerURL.
  22190. if (sameOrigin(referrerURL, currentURL)) {
  22191. return referrerURL
  22192. }
  22193. // 2. If referrerURL is a potentially trustworthy URL and request’s
  22194. // current URL is not a potentially trustworthy URL, then return no
  22195. // referrer.
  22196. if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) {
  22197. return 'no-referrer'
  22198. }
  22199. // 3. Return referrerOrigin.
  22200. return referrerOrigin
  22201. }
  22202. case 'strict-origin': // eslint-disable-line
  22203. /**
  22204. * 1. If referrerURL is a potentially trustworthy URL and
  22205. * request’s current URL is not a potentially trustworthy URL,
  22206. * then return no referrer.
  22207. * 2. Return referrerOrigin
  22208. */
  22209. case 'no-referrer-when-downgrade': // eslint-disable-line
  22210. /**
  22211. * 1. If referrerURL is a potentially trustworthy URL and
  22212. * request’s current URL is not a potentially trustworthy URL,
  22213. * then return no referrer.
  22214. * 2. Return referrerOrigin
  22215. */
  22216. default: // eslint-disable-line
  22217. return isNonPotentiallyTrustWorthy ? 'no-referrer' : referrerOrigin
  22218. }
  22219. }
  22220. /**
  22221. * @see https://w3c.github.io/webappsec-referrer-policy/#strip-url
  22222. * @param {URL} url
  22223. * @param {boolean|undefined} originOnly
  22224. */
  22225. function stripURLForReferrer (url, originOnly) {
  22226. // 1. Assert: url is a URL.
  22227. assert(url instanceof URL)
  22228. // 2. If url’s scheme is a local scheme, then return no referrer.
  22229. if (url.protocol === 'file:' || url.protocol === 'about:' || url.protocol === 'blank:') {
  22230. return 'no-referrer'
  22231. }
  22232. // 3. Set url’s username to the empty string.
  22233. url.username = ''
  22234. // 4. Set url’s password to the empty string.
  22235. url.password = ''
  22236. // 5. Set url’s fragment to null.
  22237. url.hash = ''
  22238. // 6. If the origin-only flag is true, then:
  22239. if (originOnly) {
  22240. // 1. Set url’s path to « the empty string ».
  22241. url.pathname = ''
  22242. // 2. Set url’s query to null.
  22243. url.search = ''
  22244. }
  22245. // 7. Return url.
  22246. return url
  22247. }
  22248. function isURLPotentiallyTrustworthy (url) {
  22249. if (!(url instanceof URL)) {
  22250. return false
  22251. }
  22252. // If child of about, return true
  22253. if (url.href === 'about:blank' || url.href === 'about:srcdoc') {
  22254. return true
  22255. }
  22256. // If scheme is data, return true
  22257. if (url.protocol === 'data:') return true
  22258. // If file, return true
  22259. if (url.protocol === 'file:') return true
  22260. return isOriginPotentiallyTrustworthy(url.origin)
  22261. function isOriginPotentiallyTrustworthy (origin) {
  22262. // If origin is explicitly null, return false
  22263. if (origin == null || origin === 'null') return false
  22264. const originAsURL = new URL(origin)
  22265. // If secure, return true
  22266. if (originAsURL.protocol === 'https:' || originAsURL.protocol === 'wss:') {
  22267. return true
  22268. }
  22269. // If localhost or variants, return true
  22270. if (/^127(?:\.[0-9]+){0,2}\.[0-9]+$|^\[(?:0*:)*?:?0*1\]$/.test(originAsURL.hostname) ||
  22271. (originAsURL.hostname === 'localhost' || originAsURL.hostname.includes('localhost.')) ||
  22272. (originAsURL.hostname.endsWith('.localhost'))) {
  22273. return true
  22274. }
  22275. // If any other, return false
  22276. return false
  22277. }
  22278. }
  22279. /**
  22280. * @see https://w3c.github.io/webappsec-subresource-integrity/#does-response-match-metadatalist
  22281. * @param {Uint8Array} bytes
  22282. * @param {string} metadataList
  22283. */
  22284. function bytesMatch (bytes, metadataList) {
  22285. // If node is not built with OpenSSL support, we cannot check
  22286. // a request's integrity, so allow it by default (the spec will
  22287. // allow requests if an invalid hash is given, as precedence).
  22288. /* istanbul ignore if: only if node is built with --without-ssl */
  22289. if (crypto === undefined) {
  22290. return true
  22291. }
  22292. // 1. Let parsedMetadata be the result of parsing metadataList.
  22293. const parsedMetadata = parseMetadata(metadataList)
  22294. // 2. If parsedMetadata is no metadata, return true.
  22295. if (parsedMetadata === 'no metadata') {
  22296. return true
  22297. }
  22298. // 3. If response is not eligible for integrity validation, return false.
  22299. // TODO
  22300. // 4. If parsedMetadata is the empty set, return true.
  22301. if (parsedMetadata.length === 0) {
  22302. return true
  22303. }
  22304. // 5. Let metadata be the result of getting the strongest
  22305. // metadata from parsedMetadata.
  22306. const strongest = getStrongestMetadata(parsedMetadata)
  22307. const metadata = filterMetadataListByAlgorithm(parsedMetadata, strongest)
  22308. // 6. For each item in metadata:
  22309. for (const item of metadata) {
  22310. // 1. Let algorithm be the alg component of item.
  22311. const algorithm = item.algo
  22312. // 2. Let expectedValue be the val component of item.
  22313. const expectedValue = item.hash
  22314. // See https://github.com/web-platform-tests/wpt/commit/e4c5cc7a5e48093220528dfdd1c4012dc3837a0e
  22315. // "be liberal with padding". This is annoying, and it's not even in the spec.
  22316. // 3. Let actualValue be the result of applying algorithm to bytes.
  22317. let actualValue = crypto.createHash(algorithm).update(bytes).digest('base64')
  22318. if (actualValue[actualValue.length - 1] === '=') {
  22319. if (actualValue[actualValue.length - 2] === '=') {
  22320. actualValue = actualValue.slice(0, -2)
  22321. } else {
  22322. actualValue = actualValue.slice(0, -1)
  22323. }
  22324. }
  22325. // 4. If actualValue is a case-sensitive match for expectedValue,
  22326. // return true.
  22327. if (compareBase64Mixed(actualValue, expectedValue)) {
  22328. return true
  22329. }
  22330. }
  22331. // 7. Return false.
  22332. return false
  22333. }
  22334. // https://w3c.github.io/webappsec-subresource-integrity/#grammardef-hash-with-options
  22335. // https://www.w3.org/TR/CSP2/#source-list-syntax
  22336. // https://www.rfc-editor.org/rfc/rfc5234#appendix-B.1
  22337. const parseHashWithOptions = /(?<algo>sha256|sha384|sha512)-((?<hash>[A-Za-z0-9+/]+|[A-Za-z0-9_-]+)={0,2}(?:\s|$)( +[!-~]*)?)?/i
  22338. /**
  22339. * @see https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata
  22340. * @param {string} metadata
  22341. */
  22342. function parseMetadata (metadata) {
  22343. // 1. Let result be the empty set.
  22344. /** @type {{ algo: string, hash: string }[]} */
  22345. const result = []
  22346. // 2. Let empty be equal to true.
  22347. let empty = true
  22348. // 3. For each token returned by splitting metadata on spaces:
  22349. for (const token of metadata.split(' ')) {
  22350. // 1. Set empty to false.
  22351. empty = false
  22352. // 2. Parse token as a hash-with-options.
  22353. const parsedToken = parseHashWithOptions.exec(token)
  22354. // 3. If token does not parse, continue to the next token.
  22355. if (
  22356. parsedToken === null ||
  22357. parsedToken.groups === undefined ||
  22358. parsedToken.groups.algo === undefined
  22359. ) {
  22360. // Note: Chromium blocks the request at this point, but Firefox
  22361. // gives a warning that an invalid integrity was given. The
  22362. // correct behavior is to ignore these, and subsequently not
  22363. // check the integrity of the resource.
  22364. continue
  22365. }
  22366. // 4. Let algorithm be the hash-algo component of token.
  22367. const algorithm = parsedToken.groups.algo.toLowerCase()
  22368. // 5. If algorithm is a hash function recognized by the user
  22369. // agent, add the parsed token to result.
  22370. if (supportedHashes.includes(algorithm)) {
  22371. result.push(parsedToken.groups)
  22372. }
  22373. }
  22374. // 4. Return no metadata if empty is true, otherwise return result.
  22375. if (empty === true) {
  22376. return 'no metadata'
  22377. }
  22378. return result
  22379. }
  22380. /**
  22381. * @param {{ algo: 'sha256' | 'sha384' | 'sha512' }[]} metadataList
  22382. */
  22383. function getStrongestMetadata (metadataList) {
  22384. // Let algorithm be the algo component of the first item in metadataList.
  22385. // Can be sha256
  22386. let algorithm = metadataList[0].algo
  22387. // If the algorithm is sha512, then it is the strongest
  22388. // and we can return immediately
  22389. if (algorithm[3] === '5') {
  22390. return algorithm
  22391. }
  22392. for (let i = 1; i < metadataList.length; ++i) {
  22393. const metadata = metadataList[i]
  22394. // If the algorithm is sha512, then it is the strongest
  22395. // and we can break the loop immediately
  22396. if (metadata.algo[3] === '5') {
  22397. algorithm = 'sha512'
  22398. break
  22399. // If the algorithm is sha384, then a potential sha256 or sha384 is ignored
  22400. } else if (algorithm[3] === '3') {
  22401. continue
  22402. // algorithm is sha256, check if algorithm is sha384 and if so, set it as
  22403. // the strongest
  22404. } else if (metadata.algo[3] === '3') {
  22405. algorithm = 'sha384'
  22406. }
  22407. }
  22408. return algorithm
  22409. }
  22410. function filterMetadataListByAlgorithm (metadataList, algorithm) {
  22411. if (metadataList.length === 1) {
  22412. return metadataList
  22413. }
  22414. let pos = 0
  22415. for (let i = 0; i < metadataList.length; ++i) {
  22416. if (metadataList[i].algo === algorithm) {
  22417. metadataList[pos++] = metadataList[i]
  22418. }
  22419. }
  22420. metadataList.length = pos
  22421. return metadataList
  22422. }
  22423. /**
  22424. * Compares two base64 strings, allowing for base64url
  22425. * in the second string.
  22426. *
  22427. * @param {string} actualValue always base64
  22428. * @param {string} expectedValue base64 or base64url
  22429. * @returns {boolean}
  22430. */
  22431. function compareBase64Mixed (actualValue, expectedValue) {
  22432. if (actualValue.length !== expectedValue.length) {
  22433. return false
  22434. }
  22435. for (let i = 0; i < actualValue.length; ++i) {
  22436. if (actualValue[i] !== expectedValue[i]) {
  22437. if (
  22438. (actualValue[i] === '+' && expectedValue[i] === '-') ||
  22439. (actualValue[i] === '/' && expectedValue[i] === '_')
  22440. ) {
  22441. continue
  22442. }
  22443. return false
  22444. }
  22445. }
  22446. return true
  22447. }
  22448. // https://w3c.github.io/webappsec-upgrade-insecure-requests/#upgrade-request
  22449. function tryUpgradeRequestToAPotentiallyTrustworthyURL (request) {
  22450. // TODO
  22451. }
  22452. /**
  22453. * @link {https://html.spec.whatwg.org/multipage/origin.html#same-origin}
  22454. * @param {URL} A
  22455. * @param {URL} B
  22456. */
  22457. function sameOrigin (A, B) {
  22458. // 1. If A and B are the same opaque origin, then return true.
  22459. if (A.origin === B.origin && A.origin === 'null') {
  22460. return true
  22461. }
  22462. // 2. If A and B are both tuple origins and their schemes,
  22463. // hosts, and port are identical, then return true.
  22464. if (A.protocol === B.protocol && A.hostname === B.hostname && A.port === B.port) {
  22465. return true
  22466. }
  22467. // 3. Return false.
  22468. return false
  22469. }
  22470. function createDeferredPromise () {
  22471. let res
  22472. let rej
  22473. const promise = new Promise((resolve, reject) => {
  22474. res = resolve
  22475. rej = reject
  22476. })
  22477. return { promise, resolve: res, reject: rej }
  22478. }
  22479. function isAborted (fetchParams) {
  22480. return fetchParams.controller.state === 'aborted'
  22481. }
  22482. function isCancelled (fetchParams) {
  22483. return fetchParams.controller.state === 'aborted' ||
  22484. fetchParams.controller.state === 'terminated'
  22485. }
  22486. const normalizeMethodRecord = {
  22487. delete: 'DELETE',
  22488. DELETE: 'DELETE',
  22489. get: 'GET',
  22490. GET: 'GET',
  22491. head: 'HEAD',
  22492. HEAD: 'HEAD',
  22493. options: 'OPTIONS',
  22494. OPTIONS: 'OPTIONS',
  22495. post: 'POST',
  22496. POST: 'POST',
  22497. put: 'PUT',
  22498. PUT: 'PUT'
  22499. }
  22500. // Note: object prototypes should not be able to be referenced. e.g. `Object#hasOwnProperty`.
  22501. Object.setPrototypeOf(normalizeMethodRecord, null)
  22502. /**
  22503. * @see https://fetch.spec.whatwg.org/#concept-method-normalize
  22504. * @param {string} method
  22505. */
  22506. function normalizeMethod (method) {
  22507. return normalizeMethodRecord[method.toLowerCase()] ?? method
  22508. }
  22509. // https://infra.spec.whatwg.org/#serialize-a-javascript-value-to-a-json-string
  22510. function serializeJavascriptValueToJSONString (value) {
  22511. // 1. Let result be ? Call(%JSON.stringify%, undefined, « value »).
  22512. const result = JSON.stringify(value)
  22513. // 2. If result is undefined, then throw a TypeError.
  22514. if (result === undefined) {
  22515. throw new TypeError('Value is not JSON serializable')
  22516. }
  22517. // 3. Assert: result is a string.
  22518. assert(typeof result === 'string')
  22519. // 4. Return result.
  22520. return result
  22521. }
  22522. // https://tc39.es/ecma262/#sec-%25iteratorprototype%25-object
  22523. const esIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))
  22524. /**
  22525. * @see https://webidl.spec.whatwg.org/#dfn-iterator-prototype-object
  22526. * @param {() => unknown[]} iterator
  22527. * @param {string} name name of the instance
  22528. * @param {'key'|'value'|'key+value'} kind
  22529. */
  22530. function makeIterator (iterator, name, kind) {
  22531. const object = {
  22532. index: 0,
  22533. kind,
  22534. target: iterator
  22535. }
  22536. const i = {
  22537. next () {
  22538. // 1. Let interface be the interface for which the iterator prototype object exists.
  22539. // 2. Let thisValue be the this value.
  22540. // 3. Let object be ? ToObject(thisValue).
  22541. // 4. If object is a platform object, then perform a security
  22542. // check, passing:
  22543. // 5. If object is not a default iterator object for interface,
  22544. // then throw a TypeError.
  22545. if (Object.getPrototypeOf(this) !== i) {
  22546. throw new TypeError(
  22547. `'next' called on an object that does not implement interface ${name} Iterator.`
  22548. )
  22549. }
  22550. // 6. Let index be object’s index.
  22551. // 7. Let kind be object’s kind.
  22552. // 8. Let values be object’s target's value pairs to iterate over.
  22553. const { index, kind, target } = object
  22554. const values = target()
  22555. // 9. Let len be the length of values.
  22556. const len = values.length
  22557. // 10. If index is greater than or equal to len, then return
  22558. // CreateIterResultObject(undefined, true).
  22559. if (index >= len) {
  22560. return { value: undefined, done: true }
  22561. }
  22562. // 11. Let pair be the entry in values at index index.
  22563. const pair = values[index]
  22564. // 12. Set object’s index to index + 1.
  22565. object.index = index + 1
  22566. // 13. Return the iterator result for pair and kind.
  22567. return iteratorResult(pair, kind)
  22568. },
  22569. // The class string of an iterator prototype object for a given interface is the
  22570. // result of concatenating the identifier of the interface and the string " Iterator".
  22571. [Symbol.toStringTag]: `${name} Iterator`
  22572. }
  22573. // The [[Prototype]] internal slot of an iterator prototype object must be %IteratorPrototype%.
  22574. Object.setPrototypeOf(i, esIteratorPrototype)
  22575. // esIteratorPrototype needs to be the prototype of i
  22576. // which is the prototype of an empty object. Yes, it's confusing.
  22577. return Object.setPrototypeOf({}, i)
  22578. }
  22579. // https://webidl.spec.whatwg.org/#iterator-result
  22580. function iteratorResult (pair, kind) {
  22581. let result
  22582. // 1. Let result be a value determined by the value of kind:
  22583. switch (kind) {
  22584. case 'key': {
  22585. // 1. Let idlKey be pair’s key.
  22586. // 2. Let key be the result of converting idlKey to an
  22587. // ECMAScript value.
  22588. // 3. result is key.
  22589. result = pair[0]
  22590. break
  22591. }
  22592. case 'value': {
  22593. // 1. Let idlValue be pair’s value.
  22594. // 2. Let value be the result of converting idlValue to
  22595. // an ECMAScript value.
  22596. // 3. result is value.
  22597. result = pair[1]
  22598. break
  22599. }
  22600. case 'key+value': {
  22601. // 1. Let idlKey be pair’s key.
  22602. // 2. Let idlValue be pair’s value.
  22603. // 3. Let key be the result of converting idlKey to an
  22604. // ECMAScript value.
  22605. // 4. Let value be the result of converting idlValue to
  22606. // an ECMAScript value.
  22607. // 5. Let array be ! ArrayCreate(2).
  22608. // 6. Call ! CreateDataProperty(array, "0", key).
  22609. // 7. Call ! CreateDataProperty(array, "1", value).
  22610. // 8. result is array.
  22611. result = pair
  22612. break
  22613. }
  22614. }
  22615. // 2. Return CreateIterResultObject(result, false).
  22616. return { value: result, done: false }
  22617. }
  22618. /**
  22619. * @see https://fetch.spec.whatwg.org/#body-fully-read
  22620. */
  22621. async function fullyReadBody (body, processBody, processBodyError) {
  22622. // 1. If taskDestination is null, then set taskDestination to
  22623. // the result of starting a new parallel queue.
  22624. // 2. Let successSteps given a byte sequence bytes be to queue a
  22625. // fetch task to run processBody given bytes, with taskDestination.
  22626. const successSteps = processBody
  22627. // 3. Let errorSteps be to queue a fetch task to run processBodyError,
  22628. // with taskDestination.
  22629. const errorSteps = processBodyError
  22630. // 4. Let reader be the result of getting a reader for body’s stream.
  22631. // If that threw an exception, then run errorSteps with that
  22632. // exception and return.
  22633. let reader
  22634. try {
  22635. reader = body.stream.getReader()
  22636. } catch (e) {
  22637. errorSteps(e)
  22638. return
  22639. }
  22640. // 5. Read all bytes from reader, given successSteps and errorSteps.
  22641. try {
  22642. const result = await readAllBytes(reader)
  22643. successSteps(result)
  22644. } catch (e) {
  22645. errorSteps(e)
  22646. }
  22647. }
  22648. /** @type {ReadableStream} */
  22649. let ReadableStream = globalThis.ReadableStream
  22650. function isReadableStreamLike (stream) {
  22651. if (!ReadableStream) {
  22652. ReadableStream = (__nccwpck_require__(5356).ReadableStream)
  22653. }
  22654. return stream instanceof ReadableStream || (
  22655. stream[Symbol.toStringTag] === 'ReadableStream' &&
  22656. typeof stream.tee === 'function'
  22657. )
  22658. }
  22659. const MAXIMUM_ARGUMENT_LENGTH = 65535
  22660. /**
  22661. * @see https://infra.spec.whatwg.org/#isomorphic-decode
  22662. * @param {number[]|Uint8Array} input
  22663. */
  22664. function isomorphicDecode (input) {
  22665. // 1. To isomorphic decode a byte sequence input, return a string whose code point
  22666. // length is equal to input’s length and whose code points have the same values
  22667. // as the values of input’s bytes, in the same order.
  22668. if (input.length < MAXIMUM_ARGUMENT_LENGTH) {
  22669. return String.fromCharCode(...input)
  22670. }
  22671. return input.reduce((previous, current) => previous + String.fromCharCode(current), '')
  22672. }
  22673. /**
  22674. * @param {ReadableStreamController<Uint8Array>} controller
  22675. */
  22676. function readableStreamClose (controller) {
  22677. try {
  22678. controller.close()
  22679. } catch (err) {
  22680. // TODO: add comment explaining why this error occurs.
  22681. if (!err.message.includes('Controller is already closed')) {
  22682. throw err
  22683. }
  22684. }
  22685. }
  22686. /**
  22687. * @see https://infra.spec.whatwg.org/#isomorphic-encode
  22688. * @param {string} input
  22689. */
  22690. function isomorphicEncode (input) {
  22691. // 1. Assert: input contains no code points greater than U+00FF.
  22692. for (let i = 0; i < input.length; i++) {
  22693. assert(input.charCodeAt(i) <= 0xFF)
  22694. }
  22695. // 2. Return a byte sequence whose length is equal to input’s code
  22696. // point length and whose bytes have the same values as the
  22697. // values of input’s code points, in the same order
  22698. return input
  22699. }
  22700. /**
  22701. * @see https://streams.spec.whatwg.org/#readablestreamdefaultreader-read-all-bytes
  22702. * @see https://streams.spec.whatwg.org/#read-loop
  22703. * @param {ReadableStreamDefaultReader} reader
  22704. */
  22705. async function readAllBytes (reader) {
  22706. const bytes = []
  22707. let byteLength = 0
  22708. while (true) {
  22709. const { done, value: chunk } = await reader.read()
  22710. if (done) {
  22711. // 1. Call successSteps with bytes.
  22712. return Buffer.concat(bytes, byteLength)
  22713. }
  22714. // 1. If chunk is not a Uint8Array object, call failureSteps
  22715. // with a TypeError and abort these steps.
  22716. if (!isUint8Array(chunk)) {
  22717. throw new TypeError('Received non-Uint8Array chunk')
  22718. }
  22719. // 2. Append the bytes represented by chunk to bytes.
  22720. bytes.push(chunk)
  22721. byteLength += chunk.length
  22722. // 3. Read-loop given reader, bytes, successSteps, and failureSteps.
  22723. }
  22724. }
  22725. /**
  22726. * @see https://fetch.spec.whatwg.org/#is-local
  22727. * @param {URL} url
  22728. */
  22729. function urlIsLocal (url) {
  22730. assert('protocol' in url) // ensure it's a url object
  22731. const protocol = url.protocol
  22732. return protocol === 'about:' || protocol === 'blob:' || protocol === 'data:'
  22733. }
  22734. /**
  22735. * @param {string|URL} url
  22736. */
  22737. function urlHasHttpsScheme (url) {
  22738. if (typeof url === 'string') {
  22739. return url.startsWith('https:')
  22740. }
  22741. return url.protocol === 'https:'
  22742. }
  22743. /**
  22744. * @see https://fetch.spec.whatwg.org/#http-scheme
  22745. * @param {URL} url
  22746. */
  22747. function urlIsHttpHttpsScheme (url) {
  22748. assert('protocol' in url) // ensure it's a url object
  22749. const protocol = url.protocol
  22750. return protocol === 'http:' || protocol === 'https:'
  22751. }
  22752. /**
  22753. * Fetch supports node >= 16.8.0, but Object.hasOwn was added in v16.9.0.
  22754. */
  22755. const hasOwn = Object.hasOwn || ((dict, key) => Object.prototype.hasOwnProperty.call(dict, key))
  22756. module.exports = {
  22757. isAborted,
  22758. isCancelled,
  22759. createDeferredPromise,
  22760. ReadableStreamFrom,
  22761. toUSVString,
  22762. tryUpgradeRequestToAPotentiallyTrustworthyURL,
  22763. coarsenedSharedCurrentTime,
  22764. determineRequestsReferrer,
  22765. makePolicyContainer,
  22766. clonePolicyContainer,
  22767. appendFetchMetadata,
  22768. appendRequestOriginHeader,
  22769. TAOCheck,
  22770. corsCheck,
  22771. crossOriginResourcePolicyCheck,
  22772. createOpaqueTimingInfo,
  22773. setRequestReferrerPolicyOnRedirect,
  22774. isValidHTTPToken,
  22775. requestBadPort,
  22776. requestCurrentURL,
  22777. responseURL,
  22778. responseLocationURL,
  22779. isBlobLike,
  22780. isURLPotentiallyTrustworthy,
  22781. isValidReasonPhrase,
  22782. sameOrigin,
  22783. normalizeMethod,
  22784. serializeJavascriptValueToJSONString,
  22785. makeIterator,
  22786. isValidHeaderName,
  22787. isValidHeaderValue,
  22788. hasOwn,
  22789. isErrorLike,
  22790. fullyReadBody,
  22791. bytesMatch,
  22792. isReadableStreamLike,
  22793. readableStreamClose,
  22794. isomorphicEncode,
  22795. isomorphicDecode,
  22796. urlIsLocal,
  22797. urlHasHttpsScheme,
  22798. urlIsHttpHttpsScheme,
  22799. readAllBytes,
  22800. normalizeMethodRecord,
  22801. parseMetadata
  22802. }
  22803. /***/ }),
  22804. /***/ 1744:
  22805. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  22806. const { types } = __nccwpck_require__(3837)
  22807. const { hasOwn, toUSVString } = __nccwpck_require__(2538)
  22808. /** @type {import('../../types/webidl').Webidl} */
  22809. const webidl = {}
  22810. webidl.converters = {}
  22811. webidl.util = {}
  22812. webidl.errors = {}
  22813. webidl.errors.exception = function (message) {
  22814. return new TypeError(`${message.header}: ${message.message}`)
  22815. }
  22816. webidl.errors.conversionFailed = function (context) {
  22817. const plural = context.types.length === 1 ? '' : ' one of'
  22818. const message =
  22819. `${context.argument} could not be converted to` +
  22820. `${plural}: ${context.types.join(', ')}.`
  22821. return webidl.errors.exception({
  22822. header: context.prefix,
  22823. message
  22824. })
  22825. }
  22826. webidl.errors.invalidArgument = function (context) {
  22827. return webidl.errors.exception({
  22828. header: context.prefix,
  22829. message: `"${context.value}" is an invalid ${context.type}.`
  22830. })
  22831. }
  22832. // https://webidl.spec.whatwg.org/#implements
  22833. webidl.brandCheck = function (V, I, opts = undefined) {
  22834. if (opts?.strict !== false && !(V instanceof I)) {
  22835. throw new TypeError('Illegal invocation')
  22836. } else {
  22837. return V?.[Symbol.toStringTag] === I.prototype[Symbol.toStringTag]
  22838. }
  22839. }
  22840. webidl.argumentLengthCheck = function ({ length }, min, ctx) {
  22841. if (length < min) {
  22842. throw webidl.errors.exception({
  22843. message: `${min} argument${min !== 1 ? 's' : ''} required, ` +
  22844. `but${length ? ' only' : ''} ${length} found.`,
  22845. ...ctx
  22846. })
  22847. }
  22848. }
  22849. webidl.illegalConstructor = function () {
  22850. throw webidl.errors.exception({
  22851. header: 'TypeError',
  22852. message: 'Illegal constructor'
  22853. })
  22854. }
  22855. // https://tc39.es/ecma262/#sec-ecmascript-data-types-and-values
  22856. webidl.util.Type = function (V) {
  22857. switch (typeof V) {
  22858. case 'undefined': return 'Undefined'
  22859. case 'boolean': return 'Boolean'
  22860. case 'string': return 'String'
  22861. case 'symbol': return 'Symbol'
  22862. case 'number': return 'Number'
  22863. case 'bigint': return 'BigInt'
  22864. case 'function':
  22865. case 'object': {
  22866. if (V === null) {
  22867. return 'Null'
  22868. }
  22869. return 'Object'
  22870. }
  22871. }
  22872. }
  22873. // https://webidl.spec.whatwg.org/#abstract-opdef-converttoint
  22874. webidl.util.ConvertToInt = function (V, bitLength, signedness, opts = {}) {
  22875. let upperBound
  22876. let lowerBound
  22877. // 1. If bitLength is 64, then:
  22878. if (bitLength === 64) {
  22879. // 1. Let upperBound be 2^53 − 1.
  22880. upperBound = Math.pow(2, 53) - 1
  22881. // 2. If signedness is "unsigned", then let lowerBound be 0.
  22882. if (signedness === 'unsigned') {
  22883. lowerBound = 0
  22884. } else {
  22885. // 3. Otherwise let lowerBound be −2^53 + 1.
  22886. lowerBound = Math.pow(-2, 53) + 1
  22887. }
  22888. } else if (signedness === 'unsigned') {
  22889. // 2. Otherwise, if signedness is "unsigned", then:
  22890. // 1. Let lowerBound be 0.
  22891. lowerBound = 0
  22892. // 2. Let upperBound be 2^bitLength − 1.
  22893. upperBound = Math.pow(2, bitLength) - 1
  22894. } else {
  22895. // 3. Otherwise:
  22896. // 1. Let lowerBound be -2^bitLength − 1.
  22897. lowerBound = Math.pow(-2, bitLength) - 1
  22898. // 2. Let upperBound be 2^bitLength − 1 − 1.
  22899. upperBound = Math.pow(2, bitLength - 1) - 1
  22900. }
  22901. // 4. Let x be ? ToNumber(V).
  22902. let x = Number(V)
  22903. // 5. If x is −0, then set x to +0.
  22904. if (x === 0) {
  22905. x = 0
  22906. }
  22907. // 6. If the conversion is to an IDL type associated
  22908. // with the [EnforceRange] extended attribute, then:
  22909. if (opts.enforceRange === true) {
  22910. // 1. If x is NaN, +∞, or −∞, then throw a TypeError.
  22911. if (
  22912. Number.isNaN(x) ||
  22913. x === Number.POSITIVE_INFINITY ||
  22914. x === Number.NEGATIVE_INFINITY
  22915. ) {
  22916. throw webidl.errors.exception({
  22917. header: 'Integer conversion',
  22918. message: `Could not convert ${V} to an integer.`
  22919. })
  22920. }
  22921. // 2. Set x to IntegerPart(x).
  22922. x = webidl.util.IntegerPart(x)
  22923. // 3. If x < lowerBound or x > upperBound, then
  22924. // throw a TypeError.
  22925. if (x < lowerBound || x > upperBound) {
  22926. throw webidl.errors.exception({
  22927. header: 'Integer conversion',
  22928. message: `Value must be between ${lowerBound}-${upperBound}, got ${x}.`
  22929. })
  22930. }
  22931. // 4. Return x.
  22932. return x
  22933. }
  22934. // 7. If x is not NaN and the conversion is to an IDL
  22935. // type associated with the [Clamp] extended
  22936. // attribute, then:
  22937. if (!Number.isNaN(x) && opts.clamp === true) {
  22938. // 1. Set x to min(max(x, lowerBound), upperBound).
  22939. x = Math.min(Math.max(x, lowerBound), upperBound)
  22940. // 2. Round x to the nearest integer, choosing the
  22941. // even integer if it lies halfway between two,
  22942. // and choosing +0 rather than −0.
  22943. if (Math.floor(x) % 2 === 0) {
  22944. x = Math.floor(x)
  22945. } else {
  22946. x = Math.ceil(x)
  22947. }
  22948. // 3. Return x.
  22949. return x
  22950. }
  22951. // 8. If x is NaN, +0, +∞, or −∞, then return +0.
  22952. if (
  22953. Number.isNaN(x) ||
  22954. (x === 0 && Object.is(0, x)) ||
  22955. x === Number.POSITIVE_INFINITY ||
  22956. x === Number.NEGATIVE_INFINITY
  22957. ) {
  22958. return 0
  22959. }
  22960. // 9. Set x to IntegerPart(x).
  22961. x = webidl.util.IntegerPart(x)
  22962. // 10. Set x to x modulo 2^bitLength.
  22963. x = x % Math.pow(2, bitLength)
  22964. // 11. If signedness is "signed" and x ≥ 2^bitLength − 1,
  22965. // then return x − 2^bitLength.
  22966. if (signedness === 'signed' && x >= Math.pow(2, bitLength) - 1) {
  22967. return x - Math.pow(2, bitLength)
  22968. }
  22969. // 12. Otherwise, return x.
  22970. return x
  22971. }
  22972. // https://webidl.spec.whatwg.org/#abstract-opdef-integerpart
  22973. webidl.util.IntegerPart = function (n) {
  22974. // 1. Let r be floor(abs(n)).
  22975. const r = Math.floor(Math.abs(n))
  22976. // 2. If n < 0, then return -1 × r.
  22977. if (n < 0) {
  22978. return -1 * r
  22979. }
  22980. // 3. Otherwise, return r.
  22981. return r
  22982. }
  22983. // https://webidl.spec.whatwg.org/#es-sequence
  22984. webidl.sequenceConverter = function (converter) {
  22985. return (V) => {
  22986. // 1. If Type(V) is not Object, throw a TypeError.
  22987. if (webidl.util.Type(V) !== 'Object') {
  22988. throw webidl.errors.exception({
  22989. header: 'Sequence',
  22990. message: `Value of type ${webidl.util.Type(V)} is not an Object.`
  22991. })
  22992. }
  22993. // 2. Let method be ? GetMethod(V, @@iterator).
  22994. /** @type {Generator} */
  22995. const method = V?.[Symbol.iterator]?.()
  22996. const seq = []
  22997. // 3. If method is undefined, throw a TypeError.
  22998. if (
  22999. method === undefined ||
  23000. typeof method.next !== 'function'
  23001. ) {
  23002. throw webidl.errors.exception({
  23003. header: 'Sequence',
  23004. message: 'Object is not an iterator.'
  23005. })
  23006. }
  23007. // https://webidl.spec.whatwg.org/#create-sequence-from-iterable
  23008. while (true) {
  23009. const { done, value } = method.next()
  23010. if (done) {
  23011. break
  23012. }
  23013. seq.push(converter(value))
  23014. }
  23015. return seq
  23016. }
  23017. }
  23018. // https://webidl.spec.whatwg.org/#es-to-record
  23019. webidl.recordConverter = function (keyConverter, valueConverter) {
  23020. return (O) => {
  23021. // 1. If Type(O) is not Object, throw a TypeError.
  23022. if (webidl.util.Type(O) !== 'Object') {
  23023. throw webidl.errors.exception({
  23024. header: 'Record',
  23025. message: `Value of type ${webidl.util.Type(O)} is not an Object.`
  23026. })
  23027. }
  23028. // 2. Let result be a new empty instance of record<K, V>.
  23029. const result = {}
  23030. if (!types.isProxy(O)) {
  23031. // Object.keys only returns enumerable properties
  23032. const keys = Object.keys(O)
  23033. for (const key of keys) {
  23034. // 1. Let typedKey be key converted to an IDL value of type K.
  23035. const typedKey = keyConverter(key)
  23036. // 2. Let value be ? Get(O, key).
  23037. // 3. Let typedValue be value converted to an IDL value of type V.
  23038. const typedValue = valueConverter(O[key])
  23039. // 4. Set result[typedKey] to typedValue.
  23040. result[typedKey] = typedValue
  23041. }
  23042. // 5. Return result.
  23043. return result
  23044. }
  23045. // 3. Let keys be ? O.[[OwnPropertyKeys]]().
  23046. const keys = Reflect.ownKeys(O)
  23047. // 4. For each key of keys.
  23048. for (const key of keys) {
  23049. // 1. Let desc be ? O.[[GetOwnProperty]](key).
  23050. const desc = Reflect.getOwnPropertyDescriptor(O, key)
  23051. // 2. If desc is not undefined and desc.[[Enumerable]] is true:
  23052. if (desc?.enumerable) {
  23053. // 1. Let typedKey be key converted to an IDL value of type K.
  23054. const typedKey = keyConverter(key)
  23055. // 2. Let value be ? Get(O, key).
  23056. // 3. Let typedValue be value converted to an IDL value of type V.
  23057. const typedValue = valueConverter(O[key])
  23058. // 4. Set result[typedKey] to typedValue.
  23059. result[typedKey] = typedValue
  23060. }
  23061. }
  23062. // 5. Return result.
  23063. return result
  23064. }
  23065. }
  23066. webidl.interfaceConverter = function (i) {
  23067. return (V, opts = {}) => {
  23068. if (opts.strict !== false && !(V instanceof i)) {
  23069. throw webidl.errors.exception({
  23070. header: i.name,
  23071. message: `Expected ${V} to be an instance of ${i.name}.`
  23072. })
  23073. }
  23074. return V
  23075. }
  23076. }
  23077. webidl.dictionaryConverter = function (converters) {
  23078. return (dictionary) => {
  23079. const type = webidl.util.Type(dictionary)
  23080. const dict = {}
  23081. if (type === 'Null' || type === 'Undefined') {
  23082. return dict
  23083. } else if (type !== 'Object') {
  23084. throw webidl.errors.exception({
  23085. header: 'Dictionary',
  23086. message: `Expected ${dictionary} to be one of: Null, Undefined, Object.`
  23087. })
  23088. }
  23089. for (const options of converters) {
  23090. const { key, defaultValue, required, converter } = options
  23091. if (required === true) {
  23092. if (!hasOwn(dictionary, key)) {
  23093. throw webidl.errors.exception({
  23094. header: 'Dictionary',
  23095. message: `Missing required key "${key}".`
  23096. })
  23097. }
  23098. }
  23099. let value = dictionary[key]
  23100. const hasDefault = hasOwn(options, 'defaultValue')
  23101. // Only use defaultValue if value is undefined and
  23102. // a defaultValue options was provided.
  23103. if (hasDefault && value !== null) {
  23104. value = value ?? defaultValue
  23105. }
  23106. // A key can be optional and have no default value.
  23107. // When this happens, do not perform a conversion,
  23108. // and do not assign the key a value.
  23109. if (required || hasDefault || value !== undefined) {
  23110. value = converter(value)
  23111. if (
  23112. options.allowedValues &&
  23113. !options.allowedValues.includes(value)
  23114. ) {
  23115. throw webidl.errors.exception({
  23116. header: 'Dictionary',
  23117. message: `${value} is not an accepted type. Expected one of ${options.allowedValues.join(', ')}.`
  23118. })
  23119. }
  23120. dict[key] = value
  23121. }
  23122. }
  23123. return dict
  23124. }
  23125. }
  23126. webidl.nullableConverter = function (converter) {
  23127. return (V) => {
  23128. if (V === null) {
  23129. return V
  23130. }
  23131. return converter(V)
  23132. }
  23133. }
  23134. // https://webidl.spec.whatwg.org/#es-DOMString
  23135. webidl.converters.DOMString = function (V, opts = {}) {
  23136. // 1. If V is null and the conversion is to an IDL type
  23137. // associated with the [LegacyNullToEmptyString]
  23138. // extended attribute, then return the DOMString value
  23139. // that represents the empty string.
  23140. if (V === null && opts.legacyNullToEmptyString) {
  23141. return ''
  23142. }
  23143. // 2. Let x be ? ToString(V).
  23144. if (typeof V === 'symbol') {
  23145. throw new TypeError('Could not convert argument of type symbol to string.')
  23146. }
  23147. // 3. Return the IDL DOMString value that represents the
  23148. // same sequence of code units as the one the
  23149. // ECMAScript String value x represents.
  23150. return String(V)
  23151. }
  23152. // https://webidl.spec.whatwg.org/#es-ByteString
  23153. webidl.converters.ByteString = function (V) {
  23154. // 1. Let x be ? ToString(V).
  23155. // Note: DOMString converter perform ? ToString(V)
  23156. const x = webidl.converters.DOMString(V)
  23157. // 2. If the value of any element of x is greater than
  23158. // 255, then throw a TypeError.
  23159. for (let index = 0; index < x.length; index++) {
  23160. if (x.charCodeAt(index) > 255) {
  23161. throw new TypeError(
  23162. 'Cannot convert argument to a ByteString because the character at ' +
  23163. `index ${index} has a value of ${x.charCodeAt(index)} which is greater than 255.`
  23164. )
  23165. }
  23166. }
  23167. // 3. Return an IDL ByteString value whose length is the
  23168. // length of x, and where the value of each element is
  23169. // the value of the corresponding element of x.
  23170. return x
  23171. }
  23172. // https://webidl.spec.whatwg.org/#es-USVString
  23173. webidl.converters.USVString = toUSVString
  23174. // https://webidl.spec.whatwg.org/#es-boolean
  23175. webidl.converters.boolean = function (V) {
  23176. // 1. Let x be the result of computing ToBoolean(V).
  23177. const x = Boolean(V)
  23178. // 2. Return the IDL boolean value that is the one that represents
  23179. // the same truth value as the ECMAScript Boolean value x.
  23180. return x
  23181. }
  23182. // https://webidl.spec.whatwg.org/#es-any
  23183. webidl.converters.any = function (V) {
  23184. return V
  23185. }
  23186. // https://webidl.spec.whatwg.org/#es-long-long
  23187. webidl.converters['long long'] = function (V) {
  23188. // 1. Let x be ? ConvertToInt(V, 64, "signed").
  23189. const x = webidl.util.ConvertToInt(V, 64, 'signed')
  23190. // 2. Return the IDL long long value that represents
  23191. // the same numeric value as x.
  23192. return x
  23193. }
  23194. // https://webidl.spec.whatwg.org/#es-unsigned-long-long
  23195. webidl.converters['unsigned long long'] = function (V) {
  23196. // 1. Let x be ? ConvertToInt(V, 64, "unsigned").
  23197. const x = webidl.util.ConvertToInt(V, 64, 'unsigned')
  23198. // 2. Return the IDL unsigned long long value that
  23199. // represents the same numeric value as x.
  23200. return x
  23201. }
  23202. // https://webidl.spec.whatwg.org/#es-unsigned-long
  23203. webidl.converters['unsigned long'] = function (V) {
  23204. // 1. Let x be ? ConvertToInt(V, 32, "unsigned").
  23205. const x = webidl.util.ConvertToInt(V, 32, 'unsigned')
  23206. // 2. Return the IDL unsigned long value that
  23207. // represents the same numeric value as x.
  23208. return x
  23209. }
  23210. // https://webidl.spec.whatwg.org/#es-unsigned-short
  23211. webidl.converters['unsigned short'] = function (V, opts) {
  23212. // 1. Let x be ? ConvertToInt(V, 16, "unsigned").
  23213. const x = webidl.util.ConvertToInt(V, 16, 'unsigned', opts)
  23214. // 2. Return the IDL unsigned short value that represents
  23215. // the same numeric value as x.
  23216. return x
  23217. }
  23218. // https://webidl.spec.whatwg.org/#idl-ArrayBuffer
  23219. webidl.converters.ArrayBuffer = function (V, opts = {}) {
  23220. // 1. If Type(V) is not Object, or V does not have an
  23221. // [[ArrayBufferData]] internal slot, then throw a
  23222. // TypeError.
  23223. // see: https://tc39.es/ecma262/#sec-properties-of-the-arraybuffer-instances
  23224. // see: https://tc39.es/ecma262/#sec-properties-of-the-sharedarraybuffer-instances
  23225. if (
  23226. webidl.util.Type(V) !== 'Object' ||
  23227. !types.isAnyArrayBuffer(V)
  23228. ) {
  23229. throw webidl.errors.conversionFailed({
  23230. prefix: `${V}`,
  23231. argument: `${V}`,
  23232. types: ['ArrayBuffer']
  23233. })
  23234. }
  23235. // 2. If the conversion is not to an IDL type associated
  23236. // with the [AllowShared] extended attribute, and
  23237. // IsSharedArrayBuffer(V) is true, then throw a
  23238. // TypeError.
  23239. if (opts.allowShared === false && types.isSharedArrayBuffer(V)) {
  23240. throw webidl.errors.exception({
  23241. header: 'ArrayBuffer',
  23242. message: 'SharedArrayBuffer is not allowed.'
  23243. })
  23244. }
  23245. // 3. If the conversion is not to an IDL type associated
  23246. // with the [AllowResizable] extended attribute, and
  23247. // IsResizableArrayBuffer(V) is true, then throw a
  23248. // TypeError.
  23249. // Note: resizable ArrayBuffers are currently a proposal.
  23250. // 4. Return the IDL ArrayBuffer value that is a
  23251. // reference to the same object as V.
  23252. return V
  23253. }
  23254. webidl.converters.TypedArray = function (V, T, opts = {}) {
  23255. // 1. Let T be the IDL type V is being converted to.
  23256. // 2. If Type(V) is not Object, or V does not have a
  23257. // [[TypedArrayName]] internal slot with a value
  23258. // equal to T’s name, then throw a TypeError.
  23259. if (
  23260. webidl.util.Type(V) !== 'Object' ||
  23261. !types.isTypedArray(V) ||
  23262. V.constructor.name !== T.name
  23263. ) {
  23264. throw webidl.errors.conversionFailed({
  23265. prefix: `${T.name}`,
  23266. argument: `${V}`,
  23267. types: [T.name]
  23268. })
  23269. }
  23270. // 3. If the conversion is not to an IDL type associated
  23271. // with the [AllowShared] extended attribute, and
  23272. // IsSharedArrayBuffer(V.[[ViewedArrayBuffer]]) is
  23273. // true, then throw a TypeError.
  23274. if (opts.allowShared === false && types.isSharedArrayBuffer(V.buffer)) {
  23275. throw webidl.errors.exception({
  23276. header: 'ArrayBuffer',
  23277. message: 'SharedArrayBuffer is not allowed.'
  23278. })
  23279. }
  23280. // 4. If the conversion is not to an IDL type associated
  23281. // with the [AllowResizable] extended attribute, and
  23282. // IsResizableArrayBuffer(V.[[ViewedArrayBuffer]]) is
  23283. // true, then throw a TypeError.
  23284. // Note: resizable array buffers are currently a proposal
  23285. // 5. Return the IDL value of type T that is a reference
  23286. // to the same object as V.
  23287. return V
  23288. }
  23289. webidl.converters.DataView = function (V, opts = {}) {
  23290. // 1. If Type(V) is not Object, or V does not have a
  23291. // [[DataView]] internal slot, then throw a TypeError.
  23292. if (webidl.util.Type(V) !== 'Object' || !types.isDataView(V)) {
  23293. throw webidl.errors.exception({
  23294. header: 'DataView',
  23295. message: 'Object is not a DataView.'
  23296. })
  23297. }
  23298. // 2. If the conversion is not to an IDL type associated
  23299. // with the [AllowShared] extended attribute, and
  23300. // IsSharedArrayBuffer(V.[[ViewedArrayBuffer]]) is true,
  23301. // then throw a TypeError.
  23302. if (opts.allowShared === false && types.isSharedArrayBuffer(V.buffer)) {
  23303. throw webidl.errors.exception({
  23304. header: 'ArrayBuffer',
  23305. message: 'SharedArrayBuffer is not allowed.'
  23306. })
  23307. }
  23308. // 3. If the conversion is not to an IDL type associated
  23309. // with the [AllowResizable] extended attribute, and
  23310. // IsResizableArrayBuffer(V.[[ViewedArrayBuffer]]) is
  23311. // true, then throw a TypeError.
  23312. // Note: resizable ArrayBuffers are currently a proposal
  23313. // 4. Return the IDL DataView value that is a reference
  23314. // to the same object as V.
  23315. return V
  23316. }
  23317. // https://webidl.spec.whatwg.org/#BufferSource
  23318. webidl.converters.BufferSource = function (V, opts = {}) {
  23319. if (types.isAnyArrayBuffer(V)) {
  23320. return webidl.converters.ArrayBuffer(V, opts)
  23321. }
  23322. if (types.isTypedArray(V)) {
  23323. return webidl.converters.TypedArray(V, V.constructor)
  23324. }
  23325. if (types.isDataView(V)) {
  23326. return webidl.converters.DataView(V, opts)
  23327. }
  23328. throw new TypeError(`Could not convert ${V} to a BufferSource.`)
  23329. }
  23330. webidl.converters['sequence<ByteString>'] = webidl.sequenceConverter(
  23331. webidl.converters.ByteString
  23332. )
  23333. webidl.converters['sequence<sequence<ByteString>>'] = webidl.sequenceConverter(
  23334. webidl.converters['sequence<ByteString>']
  23335. )
  23336. webidl.converters['record<ByteString, ByteString>'] = webidl.recordConverter(
  23337. webidl.converters.ByteString,
  23338. webidl.converters.ByteString
  23339. )
  23340. module.exports = {
  23341. webidl
  23342. }
  23343. /***/ }),
  23344. /***/ 4854:
  23345. /***/ ((module) => {
  23346. /**
  23347. * @see https://encoding.spec.whatwg.org/#concept-encoding-get
  23348. * @param {string|undefined} label
  23349. */
  23350. function getEncoding (label) {
  23351. if (!label) {
  23352. return 'failure'
  23353. }
  23354. // 1. Remove any leading and trailing ASCII whitespace from label.
  23355. // 2. If label is an ASCII case-insensitive match for any of the
  23356. // labels listed in the table below, then return the
  23357. // corresponding encoding; otherwise return failure.
  23358. switch (label.trim().toLowerCase()) {
  23359. case 'unicode-1-1-utf-8':
  23360. case 'unicode11utf8':
  23361. case 'unicode20utf8':
  23362. case 'utf-8':
  23363. case 'utf8':
  23364. case 'x-unicode20utf8':
  23365. return 'UTF-8'
  23366. case '866':
  23367. case 'cp866':
  23368. case 'csibm866':
  23369. case 'ibm866':
  23370. return 'IBM866'
  23371. case 'csisolatin2':
  23372. case 'iso-8859-2':
  23373. case 'iso-ir-101':
  23374. case 'iso8859-2':
  23375. case 'iso88592':
  23376. case 'iso_8859-2':
  23377. case 'iso_8859-2:1987':
  23378. case 'l2':
  23379. case 'latin2':
  23380. return 'ISO-8859-2'
  23381. case 'csisolatin3':
  23382. case 'iso-8859-3':
  23383. case 'iso-ir-109':
  23384. case 'iso8859-3':
  23385. case 'iso88593':
  23386. case 'iso_8859-3':
  23387. case 'iso_8859-3:1988':
  23388. case 'l3':
  23389. case 'latin3':
  23390. return 'ISO-8859-3'
  23391. case 'csisolatin4':
  23392. case 'iso-8859-4':
  23393. case 'iso-ir-110':
  23394. case 'iso8859-4':
  23395. case 'iso88594':
  23396. case 'iso_8859-4':
  23397. case 'iso_8859-4:1988':
  23398. case 'l4':
  23399. case 'latin4':
  23400. return 'ISO-8859-4'
  23401. case 'csisolatincyrillic':
  23402. case 'cyrillic':
  23403. case 'iso-8859-5':
  23404. case 'iso-ir-144':
  23405. case 'iso8859-5':
  23406. case 'iso88595':
  23407. case 'iso_8859-5':
  23408. case 'iso_8859-5:1988':
  23409. return 'ISO-8859-5'
  23410. case 'arabic':
  23411. case 'asmo-708':
  23412. case 'csiso88596e':
  23413. case 'csiso88596i':
  23414. case 'csisolatinarabic':
  23415. case 'ecma-114':
  23416. case 'iso-8859-6':
  23417. case 'iso-8859-6-e':
  23418. case 'iso-8859-6-i':
  23419. case 'iso-ir-127':
  23420. case 'iso8859-6':
  23421. case 'iso88596':
  23422. case 'iso_8859-6':
  23423. case 'iso_8859-6:1987':
  23424. return 'ISO-8859-6'
  23425. case 'csisolatingreek':
  23426. case 'ecma-118':
  23427. case 'elot_928':
  23428. case 'greek':
  23429. case 'greek8':
  23430. case 'iso-8859-7':
  23431. case 'iso-ir-126':
  23432. case 'iso8859-7':
  23433. case 'iso88597':
  23434. case 'iso_8859-7':
  23435. case 'iso_8859-7:1987':
  23436. case 'sun_eu_greek':
  23437. return 'ISO-8859-7'
  23438. case 'csiso88598e':
  23439. case 'csisolatinhebrew':
  23440. case 'hebrew':
  23441. case 'iso-8859-8':
  23442. case 'iso-8859-8-e':
  23443. case 'iso-ir-138':
  23444. case 'iso8859-8':
  23445. case 'iso88598':
  23446. case 'iso_8859-8':
  23447. case 'iso_8859-8:1988':
  23448. case 'visual':
  23449. return 'ISO-8859-8'
  23450. case 'csiso88598i':
  23451. case 'iso-8859-8-i':
  23452. case 'logical':
  23453. return 'ISO-8859-8-I'
  23454. case 'csisolatin6':
  23455. case 'iso-8859-10':
  23456. case 'iso-ir-157':
  23457. case 'iso8859-10':
  23458. case 'iso885910':
  23459. case 'l6':
  23460. case 'latin6':
  23461. return 'ISO-8859-10'
  23462. case 'iso-8859-13':
  23463. case 'iso8859-13':
  23464. case 'iso885913':
  23465. return 'ISO-8859-13'
  23466. case 'iso-8859-14':
  23467. case 'iso8859-14':
  23468. case 'iso885914':
  23469. return 'ISO-8859-14'
  23470. case 'csisolatin9':
  23471. case 'iso-8859-15':
  23472. case 'iso8859-15':
  23473. case 'iso885915':
  23474. case 'iso_8859-15':
  23475. case 'l9':
  23476. return 'ISO-8859-15'
  23477. case 'iso-8859-16':
  23478. return 'ISO-8859-16'
  23479. case 'cskoi8r':
  23480. case 'koi':
  23481. case 'koi8':
  23482. case 'koi8-r':
  23483. case 'koi8_r':
  23484. return 'KOI8-R'
  23485. case 'koi8-ru':
  23486. case 'koi8-u':
  23487. return 'KOI8-U'
  23488. case 'csmacintosh':
  23489. case 'mac':
  23490. case 'macintosh':
  23491. case 'x-mac-roman':
  23492. return 'macintosh'
  23493. case 'iso-8859-11':
  23494. case 'iso8859-11':
  23495. case 'iso885911':
  23496. case 'tis-620':
  23497. case 'windows-874':
  23498. return 'windows-874'
  23499. case 'cp1250':
  23500. case 'windows-1250':
  23501. case 'x-cp1250':
  23502. return 'windows-1250'
  23503. case 'cp1251':
  23504. case 'windows-1251':
  23505. case 'x-cp1251':
  23506. return 'windows-1251'
  23507. case 'ansi_x3.4-1968':
  23508. case 'ascii':
  23509. case 'cp1252':
  23510. case 'cp819':
  23511. case 'csisolatin1':
  23512. case 'ibm819':
  23513. case 'iso-8859-1':
  23514. case 'iso-ir-100':
  23515. case 'iso8859-1':
  23516. case 'iso88591':
  23517. case 'iso_8859-1':
  23518. case 'iso_8859-1:1987':
  23519. case 'l1':
  23520. case 'latin1':
  23521. case 'us-ascii':
  23522. case 'windows-1252':
  23523. case 'x-cp1252':
  23524. return 'windows-1252'
  23525. case 'cp1253':
  23526. case 'windows-1253':
  23527. case 'x-cp1253':
  23528. return 'windows-1253'
  23529. case 'cp1254':
  23530. case 'csisolatin5':
  23531. case 'iso-8859-9':
  23532. case 'iso-ir-148':
  23533. case 'iso8859-9':
  23534. case 'iso88599':
  23535. case 'iso_8859-9':
  23536. case 'iso_8859-9:1989':
  23537. case 'l5':
  23538. case 'latin5':
  23539. case 'windows-1254':
  23540. case 'x-cp1254':
  23541. return 'windows-1254'
  23542. case 'cp1255':
  23543. case 'windows-1255':
  23544. case 'x-cp1255':
  23545. return 'windows-1255'
  23546. case 'cp1256':
  23547. case 'windows-1256':
  23548. case 'x-cp1256':
  23549. return 'windows-1256'
  23550. case 'cp1257':
  23551. case 'windows-1257':
  23552. case 'x-cp1257':
  23553. return 'windows-1257'
  23554. case 'cp1258':
  23555. case 'windows-1258':
  23556. case 'x-cp1258':
  23557. return 'windows-1258'
  23558. case 'x-mac-cyrillic':
  23559. case 'x-mac-ukrainian':
  23560. return 'x-mac-cyrillic'
  23561. case 'chinese':
  23562. case 'csgb2312':
  23563. case 'csiso58gb231280':
  23564. case 'gb2312':
  23565. case 'gb_2312':
  23566. case 'gb_2312-80':
  23567. case 'gbk':
  23568. case 'iso-ir-58':
  23569. case 'x-gbk':
  23570. return 'GBK'
  23571. case 'gb18030':
  23572. return 'gb18030'
  23573. case 'big5':
  23574. case 'big5-hkscs':
  23575. case 'cn-big5':
  23576. case 'csbig5':
  23577. case 'x-x-big5':
  23578. return 'Big5'
  23579. case 'cseucpkdfmtjapanese':
  23580. case 'euc-jp':
  23581. case 'x-euc-jp':
  23582. return 'EUC-JP'
  23583. case 'csiso2022jp':
  23584. case 'iso-2022-jp':
  23585. return 'ISO-2022-JP'
  23586. case 'csshiftjis':
  23587. case 'ms932':
  23588. case 'ms_kanji':
  23589. case 'shift-jis':
  23590. case 'shift_jis':
  23591. case 'sjis':
  23592. case 'windows-31j':
  23593. case 'x-sjis':
  23594. return 'Shift_JIS'
  23595. case 'cseuckr':
  23596. case 'csksc56011987':
  23597. case 'euc-kr':
  23598. case 'iso-ir-149':
  23599. case 'korean':
  23600. case 'ks_c_5601-1987':
  23601. case 'ks_c_5601-1989':
  23602. case 'ksc5601':
  23603. case 'ksc_5601':
  23604. case 'windows-949':
  23605. return 'EUC-KR'
  23606. case 'csiso2022kr':
  23607. case 'hz-gb-2312':
  23608. case 'iso-2022-cn':
  23609. case 'iso-2022-cn-ext':
  23610. case 'iso-2022-kr':
  23611. case 'replacement':
  23612. return 'replacement'
  23613. case 'unicodefffe':
  23614. case 'utf-16be':
  23615. return 'UTF-16BE'
  23616. case 'csunicode':
  23617. case 'iso-10646-ucs-2':
  23618. case 'ucs-2':
  23619. case 'unicode':
  23620. case 'unicodefeff':
  23621. case 'utf-16':
  23622. case 'utf-16le':
  23623. return 'UTF-16LE'
  23624. case 'x-user-defined':
  23625. return 'x-user-defined'
  23626. default: return 'failure'
  23627. }
  23628. }
  23629. module.exports = {
  23630. getEncoding
  23631. }
  23632. /***/ }),
  23633. /***/ 1446:
  23634. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  23635. const {
  23636. staticPropertyDescriptors,
  23637. readOperation,
  23638. fireAProgressEvent
  23639. } = __nccwpck_require__(7530)
  23640. const {
  23641. kState,
  23642. kError,
  23643. kResult,
  23644. kEvents,
  23645. kAborted
  23646. } = __nccwpck_require__(9054)
  23647. const { webidl } = __nccwpck_require__(1744)
  23648. const { kEnumerableProperty } = __nccwpck_require__(3983)
  23649. class FileReader extends EventTarget {
  23650. constructor () {
  23651. super()
  23652. this[kState] = 'empty'
  23653. this[kResult] = null
  23654. this[kError] = null
  23655. this[kEvents] = {
  23656. loadend: null,
  23657. error: null,
  23658. abort: null,
  23659. load: null,
  23660. progress: null,
  23661. loadstart: null
  23662. }
  23663. }
  23664. /**
  23665. * @see https://w3c.github.io/FileAPI/#dfn-readAsArrayBuffer
  23666. * @param {import('buffer').Blob} blob
  23667. */
  23668. readAsArrayBuffer (blob) {
  23669. webidl.brandCheck(this, FileReader)
  23670. webidl.argumentLengthCheck(arguments, 1, { header: 'FileReader.readAsArrayBuffer' })
  23671. blob = webidl.converters.Blob(blob, { strict: false })
  23672. // The readAsArrayBuffer(blob) method, when invoked,
  23673. // must initiate a read operation for blob with ArrayBuffer.
  23674. readOperation(this, blob, 'ArrayBuffer')
  23675. }
  23676. /**
  23677. * @see https://w3c.github.io/FileAPI/#readAsBinaryString
  23678. * @param {import('buffer').Blob} blob
  23679. */
  23680. readAsBinaryString (blob) {
  23681. webidl.brandCheck(this, FileReader)
  23682. webidl.argumentLengthCheck(arguments, 1, { header: 'FileReader.readAsBinaryString' })
  23683. blob = webidl.converters.Blob(blob, { strict: false })
  23684. // The readAsBinaryString(blob) method, when invoked,
  23685. // must initiate a read operation for blob with BinaryString.
  23686. readOperation(this, blob, 'BinaryString')
  23687. }
  23688. /**
  23689. * @see https://w3c.github.io/FileAPI/#readAsDataText
  23690. * @param {import('buffer').Blob} blob
  23691. * @param {string?} encoding
  23692. */
  23693. readAsText (blob, encoding = undefined) {
  23694. webidl.brandCheck(this, FileReader)
  23695. webidl.argumentLengthCheck(arguments, 1, { header: 'FileReader.readAsText' })
  23696. blob = webidl.converters.Blob(blob, { strict: false })
  23697. if (encoding !== undefined) {
  23698. encoding = webidl.converters.DOMString(encoding)
  23699. }
  23700. // The readAsText(blob, encoding) method, when invoked,
  23701. // must initiate a read operation for blob with Text and encoding.
  23702. readOperation(this, blob, 'Text', encoding)
  23703. }
  23704. /**
  23705. * @see https://w3c.github.io/FileAPI/#dfn-readAsDataURL
  23706. * @param {import('buffer').Blob} blob
  23707. */
  23708. readAsDataURL (blob) {
  23709. webidl.brandCheck(this, FileReader)
  23710. webidl.argumentLengthCheck(arguments, 1, { header: 'FileReader.readAsDataURL' })
  23711. blob = webidl.converters.Blob(blob, { strict: false })
  23712. // The readAsDataURL(blob) method, when invoked, must
  23713. // initiate a read operation for blob with DataURL.
  23714. readOperation(this, blob, 'DataURL')
  23715. }
  23716. /**
  23717. * @see https://w3c.github.io/FileAPI/#dfn-abort
  23718. */
  23719. abort () {
  23720. // 1. If this's state is "empty" or if this's state is
  23721. // "done" set this's result to null and terminate
  23722. // this algorithm.
  23723. if (this[kState] === 'empty' || this[kState] === 'done') {
  23724. this[kResult] = null
  23725. return
  23726. }
  23727. // 2. If this's state is "loading" set this's state to
  23728. // "done" and set this's result to null.
  23729. if (this[kState] === 'loading') {
  23730. this[kState] = 'done'
  23731. this[kResult] = null
  23732. }
  23733. // 3. If there are any tasks from this on the file reading
  23734. // task source in an affiliated task queue, then remove
  23735. // those tasks from that task queue.
  23736. this[kAborted] = true
  23737. // 4. Terminate the algorithm for the read method being processed.
  23738. // TODO
  23739. // 5. Fire a progress event called abort at this.
  23740. fireAProgressEvent('abort', this)
  23741. // 6. If this's state is not "loading", fire a progress
  23742. // event called loadend at this.
  23743. if (this[kState] !== 'loading') {
  23744. fireAProgressEvent('loadend', this)
  23745. }
  23746. }
  23747. /**
  23748. * @see https://w3c.github.io/FileAPI/#dom-filereader-readystate
  23749. */
  23750. get readyState () {
  23751. webidl.brandCheck(this, FileReader)
  23752. switch (this[kState]) {
  23753. case 'empty': return this.EMPTY
  23754. case 'loading': return this.LOADING
  23755. case 'done': return this.DONE
  23756. }
  23757. }
  23758. /**
  23759. * @see https://w3c.github.io/FileAPI/#dom-filereader-result
  23760. */
  23761. get result () {
  23762. webidl.brandCheck(this, FileReader)
  23763. // The result attribute’s getter, when invoked, must return
  23764. // this's result.
  23765. return this[kResult]
  23766. }
  23767. /**
  23768. * @see https://w3c.github.io/FileAPI/#dom-filereader-error
  23769. */
  23770. get error () {
  23771. webidl.brandCheck(this, FileReader)
  23772. // The error attribute’s getter, when invoked, must return
  23773. // this's error.
  23774. return this[kError]
  23775. }
  23776. get onloadend () {
  23777. webidl.brandCheck(this, FileReader)
  23778. return this[kEvents].loadend
  23779. }
  23780. set onloadend (fn) {
  23781. webidl.brandCheck(this, FileReader)
  23782. if (this[kEvents].loadend) {
  23783. this.removeEventListener('loadend', this[kEvents].loadend)
  23784. }
  23785. if (typeof fn === 'function') {
  23786. this[kEvents].loadend = fn
  23787. this.addEventListener('loadend', fn)
  23788. } else {
  23789. this[kEvents].loadend = null
  23790. }
  23791. }
  23792. get onerror () {
  23793. webidl.brandCheck(this, FileReader)
  23794. return this[kEvents].error
  23795. }
  23796. set onerror (fn) {
  23797. webidl.brandCheck(this, FileReader)
  23798. if (this[kEvents].error) {
  23799. this.removeEventListener('error', this[kEvents].error)
  23800. }
  23801. if (typeof fn === 'function') {
  23802. this[kEvents].error = fn
  23803. this.addEventListener('error', fn)
  23804. } else {
  23805. this[kEvents].error = null
  23806. }
  23807. }
  23808. get onloadstart () {
  23809. webidl.brandCheck(this, FileReader)
  23810. return this[kEvents].loadstart
  23811. }
  23812. set onloadstart (fn) {
  23813. webidl.brandCheck(this, FileReader)
  23814. if (this[kEvents].loadstart) {
  23815. this.removeEventListener('loadstart', this[kEvents].loadstart)
  23816. }
  23817. if (typeof fn === 'function') {
  23818. this[kEvents].loadstart = fn
  23819. this.addEventListener('loadstart', fn)
  23820. } else {
  23821. this[kEvents].loadstart = null
  23822. }
  23823. }
  23824. get onprogress () {
  23825. webidl.brandCheck(this, FileReader)
  23826. return this[kEvents].progress
  23827. }
  23828. set onprogress (fn) {
  23829. webidl.brandCheck(this, FileReader)
  23830. if (this[kEvents].progress) {
  23831. this.removeEventListener('progress', this[kEvents].progress)
  23832. }
  23833. if (typeof fn === 'function') {
  23834. this[kEvents].progress = fn
  23835. this.addEventListener('progress', fn)
  23836. } else {
  23837. this[kEvents].progress = null
  23838. }
  23839. }
  23840. get onload () {
  23841. webidl.brandCheck(this, FileReader)
  23842. return this[kEvents].load
  23843. }
  23844. set onload (fn) {
  23845. webidl.brandCheck(this, FileReader)
  23846. if (this[kEvents].load) {
  23847. this.removeEventListener('load', this[kEvents].load)
  23848. }
  23849. if (typeof fn === 'function') {
  23850. this[kEvents].load = fn
  23851. this.addEventListener('load', fn)
  23852. } else {
  23853. this[kEvents].load = null
  23854. }
  23855. }
  23856. get onabort () {
  23857. webidl.brandCheck(this, FileReader)
  23858. return this[kEvents].abort
  23859. }
  23860. set onabort (fn) {
  23861. webidl.brandCheck(this, FileReader)
  23862. if (this[kEvents].abort) {
  23863. this.removeEventListener('abort', this[kEvents].abort)
  23864. }
  23865. if (typeof fn === 'function') {
  23866. this[kEvents].abort = fn
  23867. this.addEventListener('abort', fn)
  23868. } else {
  23869. this[kEvents].abort = null
  23870. }
  23871. }
  23872. }
  23873. // https://w3c.github.io/FileAPI/#dom-filereader-empty
  23874. FileReader.EMPTY = FileReader.prototype.EMPTY = 0
  23875. // https://w3c.github.io/FileAPI/#dom-filereader-loading
  23876. FileReader.LOADING = FileReader.prototype.LOADING = 1
  23877. // https://w3c.github.io/FileAPI/#dom-filereader-done
  23878. FileReader.DONE = FileReader.prototype.DONE = 2
  23879. Object.defineProperties(FileReader.prototype, {
  23880. EMPTY: staticPropertyDescriptors,
  23881. LOADING: staticPropertyDescriptors,
  23882. DONE: staticPropertyDescriptors,
  23883. readAsArrayBuffer: kEnumerableProperty,
  23884. readAsBinaryString: kEnumerableProperty,
  23885. readAsText: kEnumerableProperty,
  23886. readAsDataURL: kEnumerableProperty,
  23887. abort: kEnumerableProperty,
  23888. readyState: kEnumerableProperty,
  23889. result: kEnumerableProperty,
  23890. error: kEnumerableProperty,
  23891. onloadstart: kEnumerableProperty,
  23892. onprogress: kEnumerableProperty,
  23893. onload: kEnumerableProperty,
  23894. onabort: kEnumerableProperty,
  23895. onerror: kEnumerableProperty,
  23896. onloadend: kEnumerableProperty,
  23897. [Symbol.toStringTag]: {
  23898. value: 'FileReader',
  23899. writable: false,
  23900. enumerable: false,
  23901. configurable: true
  23902. }
  23903. })
  23904. Object.defineProperties(FileReader, {
  23905. EMPTY: staticPropertyDescriptors,
  23906. LOADING: staticPropertyDescriptors,
  23907. DONE: staticPropertyDescriptors
  23908. })
  23909. module.exports = {
  23910. FileReader
  23911. }
  23912. /***/ }),
  23913. /***/ 5504:
  23914. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  23915. const { webidl } = __nccwpck_require__(1744)
  23916. const kState = Symbol('ProgressEvent state')
  23917. /**
  23918. * @see https://xhr.spec.whatwg.org/#progressevent
  23919. */
  23920. class ProgressEvent extends Event {
  23921. constructor (type, eventInitDict = {}) {
  23922. type = webidl.converters.DOMString(type)
  23923. eventInitDict = webidl.converters.ProgressEventInit(eventInitDict ?? {})
  23924. super(type, eventInitDict)
  23925. this[kState] = {
  23926. lengthComputable: eventInitDict.lengthComputable,
  23927. loaded: eventInitDict.loaded,
  23928. total: eventInitDict.total
  23929. }
  23930. }
  23931. get lengthComputable () {
  23932. webidl.brandCheck(this, ProgressEvent)
  23933. return this[kState].lengthComputable
  23934. }
  23935. get loaded () {
  23936. webidl.brandCheck(this, ProgressEvent)
  23937. return this[kState].loaded
  23938. }
  23939. get total () {
  23940. webidl.brandCheck(this, ProgressEvent)
  23941. return this[kState].total
  23942. }
  23943. }
  23944. webidl.converters.ProgressEventInit = webidl.dictionaryConverter([
  23945. {
  23946. key: 'lengthComputable',
  23947. converter: webidl.converters.boolean,
  23948. defaultValue: false
  23949. },
  23950. {
  23951. key: 'loaded',
  23952. converter: webidl.converters['unsigned long long'],
  23953. defaultValue: 0
  23954. },
  23955. {
  23956. key: 'total',
  23957. converter: webidl.converters['unsigned long long'],
  23958. defaultValue: 0
  23959. },
  23960. {
  23961. key: 'bubbles',
  23962. converter: webidl.converters.boolean,
  23963. defaultValue: false
  23964. },
  23965. {
  23966. key: 'cancelable',
  23967. converter: webidl.converters.boolean,
  23968. defaultValue: false
  23969. },
  23970. {
  23971. key: 'composed',
  23972. converter: webidl.converters.boolean,
  23973. defaultValue: false
  23974. }
  23975. ])
  23976. module.exports = {
  23977. ProgressEvent
  23978. }
  23979. /***/ }),
  23980. /***/ 9054:
  23981. /***/ ((module) => {
  23982. module.exports = {
  23983. kState: Symbol('FileReader state'),
  23984. kResult: Symbol('FileReader result'),
  23985. kError: Symbol('FileReader error'),
  23986. kLastProgressEventFired: Symbol('FileReader last progress event fired timestamp'),
  23987. kEvents: Symbol('FileReader events'),
  23988. kAborted: Symbol('FileReader aborted')
  23989. }
  23990. /***/ }),
  23991. /***/ 7530:
  23992. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  23993. const {
  23994. kState,
  23995. kError,
  23996. kResult,
  23997. kAborted,
  23998. kLastProgressEventFired
  23999. } = __nccwpck_require__(9054)
  24000. const { ProgressEvent } = __nccwpck_require__(5504)
  24001. const { getEncoding } = __nccwpck_require__(4854)
  24002. const { DOMException } = __nccwpck_require__(1037)
  24003. const { serializeAMimeType, parseMIMEType } = __nccwpck_require__(685)
  24004. const { types } = __nccwpck_require__(3837)
  24005. const { StringDecoder } = __nccwpck_require__(1576)
  24006. const { btoa } = __nccwpck_require__(4300)
  24007. /** @type {PropertyDescriptor} */
  24008. const staticPropertyDescriptors = {
  24009. enumerable: true,
  24010. writable: false,
  24011. configurable: false
  24012. }
  24013. /**
  24014. * @see https://w3c.github.io/FileAPI/#readOperation
  24015. * @param {import('./filereader').FileReader} fr
  24016. * @param {import('buffer').Blob} blob
  24017. * @param {string} type
  24018. * @param {string?} encodingName
  24019. */
  24020. function readOperation (fr, blob, type, encodingName) {
  24021. // 1. If fr’s state is "loading", throw an InvalidStateError
  24022. // DOMException.
  24023. if (fr[kState] === 'loading') {
  24024. throw new DOMException('Invalid state', 'InvalidStateError')
  24025. }
  24026. // 2. Set fr’s state to "loading".
  24027. fr[kState] = 'loading'
  24028. // 3. Set fr’s result to null.
  24029. fr[kResult] = null
  24030. // 4. Set fr’s error to null.
  24031. fr[kError] = null
  24032. // 5. Let stream be the result of calling get stream on blob.
  24033. /** @type {import('stream/web').ReadableStream} */
  24034. const stream = blob.stream()
  24035. // 6. Let reader be the result of getting a reader from stream.
  24036. const reader = stream.getReader()
  24037. // 7. Let bytes be an empty byte sequence.
  24038. /** @type {Uint8Array[]} */
  24039. const bytes = []
  24040. // 8. Let chunkPromise be the result of reading a chunk from
  24041. // stream with reader.
  24042. let chunkPromise = reader.read()
  24043. // 9. Let isFirstChunk be true.
  24044. let isFirstChunk = true
  24045. // 10. In parallel, while true:
  24046. // Note: "In parallel" just means non-blocking
  24047. // Note 2: readOperation itself cannot be async as double
  24048. // reading the body would then reject the promise, instead
  24049. // of throwing an error.
  24050. ;(async () => {
  24051. while (!fr[kAborted]) {
  24052. // 1. Wait for chunkPromise to be fulfilled or rejected.
  24053. try {
  24054. const { done, value } = await chunkPromise
  24055. // 2. If chunkPromise is fulfilled, and isFirstChunk is
  24056. // true, queue a task to fire a progress event called
  24057. // loadstart at fr.
  24058. if (isFirstChunk && !fr[kAborted]) {
  24059. queueMicrotask(() => {
  24060. fireAProgressEvent('loadstart', fr)
  24061. })
  24062. }
  24063. // 3. Set isFirstChunk to false.
  24064. isFirstChunk = false
  24065. // 4. If chunkPromise is fulfilled with an object whose
  24066. // done property is false and whose value property is
  24067. // a Uint8Array object, run these steps:
  24068. if (!done && types.isUint8Array(value)) {
  24069. // 1. Let bs be the byte sequence represented by the
  24070. // Uint8Array object.
  24071. // 2. Append bs to bytes.
  24072. bytes.push(value)
  24073. // 3. If roughly 50ms have passed since these steps
  24074. // were last invoked, queue a task to fire a
  24075. // progress event called progress at fr.
  24076. if (
  24077. (
  24078. fr[kLastProgressEventFired] === undefined ||
  24079. Date.now() - fr[kLastProgressEventFired] >= 50
  24080. ) &&
  24081. !fr[kAborted]
  24082. ) {
  24083. fr[kLastProgressEventFired] = Date.now()
  24084. queueMicrotask(() => {
  24085. fireAProgressEvent('progress', fr)
  24086. })
  24087. }
  24088. // 4. Set chunkPromise to the result of reading a
  24089. // chunk from stream with reader.
  24090. chunkPromise = reader.read()
  24091. } else if (done) {
  24092. // 5. Otherwise, if chunkPromise is fulfilled with an
  24093. // object whose done property is true, queue a task
  24094. // to run the following steps and abort this algorithm:
  24095. queueMicrotask(() => {
  24096. // 1. Set fr’s state to "done".
  24097. fr[kState] = 'done'
  24098. // 2. Let result be the result of package data given
  24099. // bytes, type, blob’s type, and encodingName.
  24100. try {
  24101. const result = packageData(bytes, type, blob.type, encodingName)
  24102. // 4. Else:
  24103. if (fr[kAborted]) {
  24104. return
  24105. }
  24106. // 1. Set fr’s result to result.
  24107. fr[kResult] = result
  24108. // 2. Fire a progress event called load at the fr.
  24109. fireAProgressEvent('load', fr)
  24110. } catch (error) {
  24111. // 3. If package data threw an exception error:
  24112. // 1. Set fr’s error to error.
  24113. fr[kError] = error
  24114. // 2. Fire a progress event called error at fr.
  24115. fireAProgressEvent('error', fr)
  24116. }
  24117. // 5. If fr’s state is not "loading", fire a progress
  24118. // event called loadend at the fr.
  24119. if (fr[kState] !== 'loading') {
  24120. fireAProgressEvent('loadend', fr)
  24121. }
  24122. })
  24123. break
  24124. }
  24125. } catch (error) {
  24126. if (fr[kAborted]) {
  24127. return
  24128. }
  24129. // 6. Otherwise, if chunkPromise is rejected with an
  24130. // error error, queue a task to run the following
  24131. // steps and abort this algorithm:
  24132. queueMicrotask(() => {
  24133. // 1. Set fr’s state to "done".
  24134. fr[kState] = 'done'
  24135. // 2. Set fr’s error to error.
  24136. fr[kError] = error
  24137. // 3. Fire a progress event called error at fr.
  24138. fireAProgressEvent('error', fr)
  24139. // 4. If fr’s state is not "loading", fire a progress
  24140. // event called loadend at fr.
  24141. if (fr[kState] !== 'loading') {
  24142. fireAProgressEvent('loadend', fr)
  24143. }
  24144. })
  24145. break
  24146. }
  24147. }
  24148. })()
  24149. }
  24150. /**
  24151. * @see https://w3c.github.io/FileAPI/#fire-a-progress-event
  24152. * @see https://dom.spec.whatwg.org/#concept-event-fire
  24153. * @param {string} e The name of the event
  24154. * @param {import('./filereader').FileReader} reader
  24155. */
  24156. function fireAProgressEvent (e, reader) {
  24157. // The progress event e does not bubble. e.bubbles must be false
  24158. // The progress event e is NOT cancelable. e.cancelable must be false
  24159. const event = new ProgressEvent(e, {
  24160. bubbles: false,
  24161. cancelable: false
  24162. })
  24163. reader.dispatchEvent(event)
  24164. }
  24165. /**
  24166. * @see https://w3c.github.io/FileAPI/#blob-package-data
  24167. * @param {Uint8Array[]} bytes
  24168. * @param {string} type
  24169. * @param {string?} mimeType
  24170. * @param {string?} encodingName
  24171. */
  24172. function packageData (bytes, type, mimeType, encodingName) {
  24173. // 1. A Blob has an associated package data algorithm, given
  24174. // bytes, a type, a optional mimeType, and a optional
  24175. // encodingName, which switches on type and runs the
  24176. // associated steps:
  24177. switch (type) {
  24178. case 'DataURL': {
  24179. // 1. Return bytes as a DataURL [RFC2397] subject to
  24180. // the considerations below:
  24181. // * Use mimeType as part of the Data URL if it is
  24182. // available in keeping with the Data URL
  24183. // specification [RFC2397].
  24184. // * If mimeType is not available return a Data URL
  24185. // without a media-type. [RFC2397].
  24186. // https://datatracker.ietf.org/doc/html/rfc2397#section-3
  24187. // dataurl := "data:" [ mediatype ] [ ";base64" ] "," data
  24188. // mediatype := [ type "/" subtype ] *( ";" parameter )
  24189. // data := *urlchar
  24190. // parameter := attribute "=" value
  24191. let dataURL = 'data:'
  24192. const parsed = parseMIMEType(mimeType || 'application/octet-stream')
  24193. if (parsed !== 'failure') {
  24194. dataURL += serializeAMimeType(parsed)
  24195. }
  24196. dataURL += ';base64,'
  24197. const decoder = new StringDecoder('latin1')
  24198. for (const chunk of bytes) {
  24199. dataURL += btoa(decoder.write(chunk))
  24200. }
  24201. dataURL += btoa(decoder.end())
  24202. return dataURL
  24203. }
  24204. case 'Text': {
  24205. // 1. Let encoding be failure
  24206. let encoding = 'failure'
  24207. // 2. If the encodingName is present, set encoding to the
  24208. // result of getting an encoding from encodingName.
  24209. if (encodingName) {
  24210. encoding = getEncoding(encodingName)
  24211. }
  24212. // 3. If encoding is failure, and mimeType is present:
  24213. if (encoding === 'failure' && mimeType) {
  24214. // 1. Let type be the result of parse a MIME type
  24215. // given mimeType.
  24216. const type = parseMIMEType(mimeType)
  24217. // 2. If type is not failure, set encoding to the result
  24218. // of getting an encoding from type’s parameters["charset"].
  24219. if (type !== 'failure') {
  24220. encoding = getEncoding(type.parameters.get('charset'))
  24221. }
  24222. }
  24223. // 4. If encoding is failure, then set encoding to UTF-8.
  24224. if (encoding === 'failure') {
  24225. encoding = 'UTF-8'
  24226. }
  24227. // 5. Decode bytes using fallback encoding encoding, and
  24228. // return the result.
  24229. return decode(bytes, encoding)
  24230. }
  24231. case 'ArrayBuffer': {
  24232. // Return a new ArrayBuffer whose contents are bytes.
  24233. const sequence = combineByteSequences(bytes)
  24234. return sequence.buffer
  24235. }
  24236. case 'BinaryString': {
  24237. // Return bytes as a binary string, in which every byte
  24238. // is represented by a code unit of equal value [0..255].
  24239. let binaryString = ''
  24240. const decoder = new StringDecoder('latin1')
  24241. for (const chunk of bytes) {
  24242. binaryString += decoder.write(chunk)
  24243. }
  24244. binaryString += decoder.end()
  24245. return binaryString
  24246. }
  24247. }
  24248. }
  24249. /**
  24250. * @see https://encoding.spec.whatwg.org/#decode
  24251. * @param {Uint8Array[]} ioQueue
  24252. * @param {string} encoding
  24253. */
  24254. function decode (ioQueue, encoding) {
  24255. const bytes = combineByteSequences(ioQueue)
  24256. // 1. Let BOMEncoding be the result of BOM sniffing ioQueue.
  24257. const BOMEncoding = BOMSniffing(bytes)
  24258. let slice = 0
  24259. // 2. If BOMEncoding is non-null:
  24260. if (BOMEncoding !== null) {
  24261. // 1. Set encoding to BOMEncoding.
  24262. encoding = BOMEncoding
  24263. // 2. Read three bytes from ioQueue, if BOMEncoding is
  24264. // UTF-8; otherwise read two bytes.
  24265. // (Do nothing with those bytes.)
  24266. slice = BOMEncoding === 'UTF-8' ? 3 : 2
  24267. }
  24268. // 3. Process a queue with an instance of encoding’s
  24269. // decoder, ioQueue, output, and "replacement".
  24270. // 4. Return output.
  24271. const sliced = bytes.slice(slice)
  24272. return new TextDecoder(encoding).decode(sliced)
  24273. }
  24274. /**
  24275. * @see https://encoding.spec.whatwg.org/#bom-sniff
  24276. * @param {Uint8Array} ioQueue
  24277. */
  24278. function BOMSniffing (ioQueue) {
  24279. // 1. Let BOM be the result of peeking 3 bytes from ioQueue,
  24280. // converted to a byte sequence.
  24281. const [a, b, c] = ioQueue
  24282. // 2. For each of the rows in the table below, starting with
  24283. // the first one and going down, if BOM starts with the
  24284. // bytes given in the first column, then return the
  24285. // encoding given in the cell in the second column of that
  24286. // row. Otherwise, return null.
  24287. if (a === 0xEF && b === 0xBB && c === 0xBF) {
  24288. return 'UTF-8'
  24289. } else if (a === 0xFE && b === 0xFF) {
  24290. return 'UTF-16BE'
  24291. } else if (a === 0xFF && b === 0xFE) {
  24292. return 'UTF-16LE'
  24293. }
  24294. return null
  24295. }
  24296. /**
  24297. * @param {Uint8Array[]} sequences
  24298. */
  24299. function combineByteSequences (sequences) {
  24300. const size = sequences.reduce((a, b) => {
  24301. return a + b.byteLength
  24302. }, 0)
  24303. let offset = 0
  24304. return sequences.reduce((a, b) => {
  24305. a.set(b, offset)
  24306. offset += b.byteLength
  24307. return a
  24308. }, new Uint8Array(size))
  24309. }
  24310. module.exports = {
  24311. staticPropertyDescriptors,
  24312. readOperation,
  24313. fireAProgressEvent
  24314. }
  24315. /***/ }),
  24316. /***/ 1892:
  24317. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  24318. // We include a version number for the Dispatcher API. In case of breaking changes,
  24319. // this version number must be increased to avoid conflicts.
  24320. const globalDispatcher = Symbol.for('undici.globalDispatcher.1')
  24321. const { InvalidArgumentError } = __nccwpck_require__(8045)
  24322. const Agent = __nccwpck_require__(7890)
  24323. if (getGlobalDispatcher() === undefined) {
  24324. setGlobalDispatcher(new Agent())
  24325. }
  24326. function setGlobalDispatcher (agent) {
  24327. if (!agent || typeof agent.dispatch !== 'function') {
  24328. throw new InvalidArgumentError('Argument agent must implement Agent')
  24329. }
  24330. Object.defineProperty(globalThis, globalDispatcher, {
  24331. value: agent,
  24332. writable: true,
  24333. enumerable: false,
  24334. configurable: false
  24335. })
  24336. }
  24337. function getGlobalDispatcher () {
  24338. return globalThis[globalDispatcher]
  24339. }
  24340. module.exports = {
  24341. setGlobalDispatcher,
  24342. getGlobalDispatcher
  24343. }
  24344. /***/ }),
  24345. /***/ 6930:
  24346. /***/ ((module) => {
  24347. module.exports = class DecoratorHandler {
  24348. constructor (handler) {
  24349. this.handler = handler
  24350. }
  24351. onConnect (...args) {
  24352. return this.handler.onConnect(...args)
  24353. }
  24354. onError (...args) {
  24355. return this.handler.onError(...args)
  24356. }
  24357. onUpgrade (...args) {
  24358. return this.handler.onUpgrade(...args)
  24359. }
  24360. onHeaders (...args) {
  24361. return this.handler.onHeaders(...args)
  24362. }
  24363. onData (...args) {
  24364. return this.handler.onData(...args)
  24365. }
  24366. onComplete (...args) {
  24367. return this.handler.onComplete(...args)
  24368. }
  24369. onBodySent (...args) {
  24370. return this.handler.onBodySent(...args)
  24371. }
  24372. }
  24373. /***/ }),
  24374. /***/ 2860:
  24375. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  24376. const util = __nccwpck_require__(3983)
  24377. const { kBodyUsed } = __nccwpck_require__(2785)
  24378. const assert = __nccwpck_require__(9491)
  24379. const { InvalidArgumentError } = __nccwpck_require__(8045)
  24380. const EE = __nccwpck_require__(2361)
  24381. const redirectableStatusCodes = [300, 301, 302, 303, 307, 308]
  24382. const kBody = Symbol('body')
  24383. class BodyAsyncIterable {
  24384. constructor (body) {
  24385. this[kBody] = body
  24386. this[kBodyUsed] = false
  24387. }
  24388. async * [Symbol.asyncIterator] () {
  24389. assert(!this[kBodyUsed], 'disturbed')
  24390. this[kBodyUsed] = true
  24391. yield * this[kBody]
  24392. }
  24393. }
  24394. class RedirectHandler {
  24395. constructor (dispatch, maxRedirections, opts, handler) {
  24396. if (maxRedirections != null && (!Number.isInteger(maxRedirections) || maxRedirections < 0)) {
  24397. throw new InvalidArgumentError('maxRedirections must be a positive number')
  24398. }
  24399. util.validateHandler(handler, opts.method, opts.upgrade)
  24400. this.dispatch = dispatch
  24401. this.location = null
  24402. this.abort = null
  24403. this.opts = { ...opts, maxRedirections: 0 } // opts must be a copy
  24404. this.maxRedirections = maxRedirections
  24405. this.handler = handler
  24406. this.history = []
  24407. if (util.isStream(this.opts.body)) {
  24408. // TODO (fix): Provide some way for the user to cache the file to e.g. /tmp
  24409. // so that it can be dispatched again?
  24410. // TODO (fix): Do we need 100-expect support to provide a way to do this properly?
  24411. if (util.bodyLength(this.opts.body) === 0) {
  24412. this.opts.body
  24413. .on('data', function () {
  24414. assert(false)
  24415. })
  24416. }
  24417. if (typeof this.opts.body.readableDidRead !== 'boolean') {
  24418. this.opts.body[kBodyUsed] = false
  24419. EE.prototype.on.call(this.opts.body, 'data', function () {
  24420. this[kBodyUsed] = true
  24421. })
  24422. }
  24423. } else if (this.opts.body && typeof this.opts.body.pipeTo === 'function') {
  24424. // TODO (fix): We can't access ReadableStream internal state
  24425. // to determine whether or not it has been disturbed. This is just
  24426. // a workaround.
  24427. this.opts.body = new BodyAsyncIterable(this.opts.body)
  24428. } else if (
  24429. this.opts.body &&
  24430. typeof this.opts.body !== 'string' &&
  24431. !ArrayBuffer.isView(this.opts.body) &&
  24432. util.isIterable(this.opts.body)
  24433. ) {
  24434. // TODO: Should we allow re-using iterable if !this.opts.idempotent
  24435. // or through some other flag?
  24436. this.opts.body = new BodyAsyncIterable(this.opts.body)
  24437. }
  24438. }
  24439. onConnect (abort) {
  24440. this.abort = abort
  24441. this.handler.onConnect(abort, { history: this.history })
  24442. }
  24443. onUpgrade (statusCode, headers, socket) {
  24444. this.handler.onUpgrade(statusCode, headers, socket)
  24445. }
  24446. onError (error) {
  24447. this.handler.onError(error)
  24448. }
  24449. onHeaders (statusCode, headers, resume, statusText) {
  24450. this.location = this.history.length >= this.maxRedirections || util.isDisturbed(this.opts.body)
  24451. ? null
  24452. : parseLocation(statusCode, headers)
  24453. if (this.opts.origin) {
  24454. this.history.push(new URL(this.opts.path, this.opts.origin))
  24455. }
  24456. if (!this.location) {
  24457. return this.handler.onHeaders(statusCode, headers, resume, statusText)
  24458. }
  24459. const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)))
  24460. const path = search ? `${pathname}${search}` : pathname
  24461. // Remove headers referring to the original URL.
  24462. // By default it is Host only, unless it's a 303 (see below), which removes also all Content-* headers.
  24463. // https://tools.ietf.org/html/rfc7231#section-6.4
  24464. this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin)
  24465. this.opts.path = path
  24466. this.opts.origin = origin
  24467. this.opts.maxRedirections = 0
  24468. this.opts.query = null
  24469. // https://tools.ietf.org/html/rfc7231#section-6.4.4
  24470. // In case of HTTP 303, always replace method to be either HEAD or GET
  24471. if (statusCode === 303 && this.opts.method !== 'HEAD') {
  24472. this.opts.method = 'GET'
  24473. this.opts.body = null
  24474. }
  24475. }
  24476. onData (chunk) {
  24477. if (this.location) {
  24478. /*
  24479. https://tools.ietf.org/html/rfc7231#section-6.4
  24480. TLDR: undici always ignores 3xx response bodies.
  24481. Redirection is used to serve the requested resource from another URL, so it is assumes that
  24482. no body is generated (and thus can be ignored). Even though generating a body is not prohibited.
  24483. For status 301, 302, 303, 307 and 308 (the latter from RFC 7238), the specs mention that the body usually
  24484. (which means it's optional and not mandated) contain just an hyperlink to the value of
  24485. the Location response header, so the body can be ignored safely.
  24486. For status 300, which is "Multiple Choices", the spec mentions both generating a Location
  24487. response header AND a response body with the other possible location to follow.
  24488. Since the spec explicitily chooses not to specify a format for such body and leave it to
  24489. servers and browsers implementors, we ignore the body as there is no specified way to eventually parse it.
  24490. */
  24491. } else {
  24492. return this.handler.onData(chunk)
  24493. }
  24494. }
  24495. onComplete (trailers) {
  24496. if (this.location) {
  24497. /*
  24498. https://tools.ietf.org/html/rfc7231#section-6.4
  24499. TLDR: undici always ignores 3xx response trailers as they are not expected in case of redirections
  24500. and neither are useful if present.
  24501. See comment on onData method above for more detailed informations.
  24502. */
  24503. this.location = null
  24504. this.abort = null
  24505. this.dispatch(this.opts, this)
  24506. } else {
  24507. this.handler.onComplete(trailers)
  24508. }
  24509. }
  24510. onBodySent (chunk) {
  24511. if (this.handler.onBodySent) {
  24512. this.handler.onBodySent(chunk)
  24513. }
  24514. }
  24515. }
  24516. function parseLocation (statusCode, headers) {
  24517. if (redirectableStatusCodes.indexOf(statusCode) === -1) {
  24518. return null
  24519. }
  24520. for (let i = 0; i < headers.length; i += 2) {
  24521. if (headers[i].toString().toLowerCase() === 'location') {
  24522. return headers[i + 1]
  24523. }
  24524. }
  24525. }
  24526. // https://tools.ietf.org/html/rfc7231#section-6.4.4
  24527. function shouldRemoveHeader (header, removeContent, unknownOrigin) {
  24528. if (header.length === 4) {
  24529. return util.headerNameToString(header) === 'host'
  24530. }
  24531. if (removeContent && util.headerNameToString(header).startsWith('content-')) {
  24532. return true
  24533. }
  24534. if (unknownOrigin && (header.length === 13 || header.length === 6 || header.length === 19)) {
  24535. const name = util.headerNameToString(header)
  24536. return name === 'authorization' || name === 'cookie' || name === 'proxy-authorization'
  24537. }
  24538. return false
  24539. }
  24540. // https://tools.ietf.org/html/rfc7231#section-6.4
  24541. function cleanRequestHeaders (headers, removeContent, unknownOrigin) {
  24542. const ret = []
  24543. if (Array.isArray(headers)) {
  24544. for (let i = 0; i < headers.length; i += 2) {
  24545. if (!shouldRemoveHeader(headers[i], removeContent, unknownOrigin)) {
  24546. ret.push(headers[i], headers[i + 1])
  24547. }
  24548. }
  24549. } else if (headers && typeof headers === 'object') {
  24550. for (const key of Object.keys(headers)) {
  24551. if (!shouldRemoveHeader(key, removeContent, unknownOrigin)) {
  24552. ret.push(key, headers[key])
  24553. }
  24554. }
  24555. } else {
  24556. assert(headers == null, 'headers must be an object or an array')
  24557. }
  24558. return ret
  24559. }
  24560. module.exports = RedirectHandler
  24561. /***/ }),
  24562. /***/ 2286:
  24563. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  24564. const assert = __nccwpck_require__(9491)
  24565. const { kRetryHandlerDefaultRetry } = __nccwpck_require__(2785)
  24566. const { RequestRetryError } = __nccwpck_require__(8045)
  24567. const { isDisturbed, parseHeaders, parseRangeHeader } = __nccwpck_require__(3983)
  24568. function calculateRetryAfterHeader (retryAfter) {
  24569. const current = Date.now()
  24570. const diff = new Date(retryAfter).getTime() - current
  24571. return diff
  24572. }
  24573. class RetryHandler {
  24574. constructor (opts, handlers) {
  24575. const { retryOptions, ...dispatchOpts } = opts
  24576. const {
  24577. // Retry scoped
  24578. retry: retryFn,
  24579. maxRetries,
  24580. maxTimeout,
  24581. minTimeout,
  24582. timeoutFactor,
  24583. // Response scoped
  24584. methods,
  24585. errorCodes,
  24586. retryAfter,
  24587. statusCodes
  24588. } = retryOptions ?? {}
  24589. this.dispatch = handlers.dispatch
  24590. this.handler = handlers.handler
  24591. this.opts = dispatchOpts
  24592. this.abort = null
  24593. this.aborted = false
  24594. this.retryOpts = {
  24595. retry: retryFn ?? RetryHandler[kRetryHandlerDefaultRetry],
  24596. retryAfter: retryAfter ?? true,
  24597. maxTimeout: maxTimeout ?? 30 * 1000, // 30s,
  24598. timeout: minTimeout ?? 500, // .5s
  24599. timeoutFactor: timeoutFactor ?? 2,
  24600. maxRetries: maxRetries ?? 5,
  24601. // What errors we should retry
  24602. methods: methods ?? ['GET', 'HEAD', 'OPTIONS', 'PUT', 'DELETE', 'TRACE'],
  24603. // Indicates which errors to retry
  24604. statusCodes: statusCodes ?? [500, 502, 503, 504, 429],
  24605. // List of errors to retry
  24606. errorCodes: errorCodes ?? [
  24607. 'ECONNRESET',
  24608. 'ECONNREFUSED',
  24609. 'ENOTFOUND',
  24610. 'ENETDOWN',
  24611. 'ENETUNREACH',
  24612. 'EHOSTDOWN',
  24613. 'EHOSTUNREACH',
  24614. 'EPIPE'
  24615. ]
  24616. }
  24617. this.retryCount = 0
  24618. this.start = 0
  24619. this.end = null
  24620. this.etag = null
  24621. this.resume = null
  24622. // Handle possible onConnect duplication
  24623. this.handler.onConnect(reason => {
  24624. this.aborted = true
  24625. if (this.abort) {
  24626. this.abort(reason)
  24627. } else {
  24628. this.reason = reason
  24629. }
  24630. })
  24631. }
  24632. onRequestSent () {
  24633. if (this.handler.onRequestSent) {
  24634. this.handler.onRequestSent()
  24635. }
  24636. }
  24637. onUpgrade (statusCode, headers, socket) {
  24638. if (this.handler.onUpgrade) {
  24639. this.handler.onUpgrade(statusCode, headers, socket)
  24640. }
  24641. }
  24642. onConnect (abort) {
  24643. if (this.aborted) {
  24644. abort(this.reason)
  24645. } else {
  24646. this.abort = abort
  24647. }
  24648. }
  24649. onBodySent (chunk) {
  24650. if (this.handler.onBodySent) return this.handler.onBodySent(chunk)
  24651. }
  24652. static [kRetryHandlerDefaultRetry] (err, { state, opts }, cb) {
  24653. const { statusCode, code, headers } = err
  24654. const { method, retryOptions } = opts
  24655. const {
  24656. maxRetries,
  24657. timeout,
  24658. maxTimeout,
  24659. timeoutFactor,
  24660. statusCodes,
  24661. errorCodes,
  24662. methods
  24663. } = retryOptions
  24664. let { counter, currentTimeout } = state
  24665. currentTimeout =
  24666. currentTimeout != null && currentTimeout > 0 ? currentTimeout : timeout
  24667. // Any code that is not a Undici's originated and allowed to retry
  24668. if (
  24669. code &&
  24670. code !== 'UND_ERR_REQ_RETRY' &&
  24671. code !== 'UND_ERR_SOCKET' &&
  24672. !errorCodes.includes(code)
  24673. ) {
  24674. cb(err)
  24675. return
  24676. }
  24677. // If a set of method are provided and the current method is not in the list
  24678. if (Array.isArray(methods) && !methods.includes(method)) {
  24679. cb(err)
  24680. return
  24681. }
  24682. // If a set of status code are provided and the current status code is not in the list
  24683. if (
  24684. statusCode != null &&
  24685. Array.isArray(statusCodes) &&
  24686. !statusCodes.includes(statusCode)
  24687. ) {
  24688. cb(err)
  24689. return
  24690. }
  24691. // If we reached the max number of retries
  24692. if (counter > maxRetries) {
  24693. cb(err)
  24694. return
  24695. }
  24696. let retryAfterHeader = headers != null && headers['retry-after']
  24697. if (retryAfterHeader) {
  24698. retryAfterHeader = Number(retryAfterHeader)
  24699. retryAfterHeader = isNaN(retryAfterHeader)
  24700. ? calculateRetryAfterHeader(retryAfterHeader)
  24701. : retryAfterHeader * 1e3 // Retry-After is in seconds
  24702. }
  24703. const retryTimeout =
  24704. retryAfterHeader > 0
  24705. ? Math.min(retryAfterHeader, maxTimeout)
  24706. : Math.min(currentTimeout * timeoutFactor ** counter, maxTimeout)
  24707. state.currentTimeout = retryTimeout
  24708. setTimeout(() => cb(null), retryTimeout)
  24709. }
  24710. onHeaders (statusCode, rawHeaders, resume, statusMessage) {
  24711. const headers = parseHeaders(rawHeaders)
  24712. this.retryCount += 1
  24713. if (statusCode >= 300) {
  24714. this.abort(
  24715. new RequestRetryError('Request failed', statusCode, {
  24716. headers,
  24717. count: this.retryCount
  24718. })
  24719. )
  24720. return false
  24721. }
  24722. // Checkpoint for resume from where we left it
  24723. if (this.resume != null) {
  24724. this.resume = null
  24725. if (statusCode !== 206) {
  24726. return true
  24727. }
  24728. const contentRange = parseRangeHeader(headers['content-range'])
  24729. // If no content range
  24730. if (!contentRange) {
  24731. this.abort(
  24732. new RequestRetryError('Content-Range mismatch', statusCode, {
  24733. headers,
  24734. count: this.retryCount
  24735. })
  24736. )
  24737. return false
  24738. }
  24739. // Let's start with a weak etag check
  24740. if (this.etag != null && this.etag !== headers.etag) {
  24741. this.abort(
  24742. new RequestRetryError('ETag mismatch', statusCode, {
  24743. headers,
  24744. count: this.retryCount
  24745. })
  24746. )
  24747. return false
  24748. }
  24749. const { start, size, end = size } = contentRange
  24750. assert(this.start === start, 'content-range mismatch')
  24751. assert(this.end == null || this.end === end, 'content-range mismatch')
  24752. this.resume = resume
  24753. return true
  24754. }
  24755. if (this.end == null) {
  24756. if (statusCode === 206) {
  24757. // First time we receive 206
  24758. const range = parseRangeHeader(headers['content-range'])
  24759. if (range == null) {
  24760. return this.handler.onHeaders(
  24761. statusCode,
  24762. rawHeaders,
  24763. resume,
  24764. statusMessage
  24765. )
  24766. }
  24767. const { start, size, end = size } = range
  24768. assert(
  24769. start != null && Number.isFinite(start) && this.start !== start,
  24770. 'content-range mismatch'
  24771. )
  24772. assert(Number.isFinite(start))
  24773. assert(
  24774. end != null && Number.isFinite(end) && this.end !== end,
  24775. 'invalid content-length'
  24776. )
  24777. this.start = start
  24778. this.end = end
  24779. }
  24780. // We make our best to checkpoint the body for further range headers
  24781. if (this.end == null) {
  24782. const contentLength = headers['content-length']
  24783. this.end = contentLength != null ? Number(contentLength) : null
  24784. }
  24785. assert(Number.isFinite(this.start))
  24786. assert(
  24787. this.end == null || Number.isFinite(this.end),
  24788. 'invalid content-length'
  24789. )
  24790. this.resume = resume
  24791. this.etag = headers.etag != null ? headers.etag : null
  24792. return this.handler.onHeaders(
  24793. statusCode,
  24794. rawHeaders,
  24795. resume,
  24796. statusMessage
  24797. )
  24798. }
  24799. const err = new RequestRetryError('Request failed', statusCode, {
  24800. headers,
  24801. count: this.retryCount
  24802. })
  24803. this.abort(err)
  24804. return false
  24805. }
  24806. onData (chunk) {
  24807. this.start += chunk.length
  24808. return this.handler.onData(chunk)
  24809. }
  24810. onComplete (rawTrailers) {
  24811. this.retryCount = 0
  24812. return this.handler.onComplete(rawTrailers)
  24813. }
  24814. onError (err) {
  24815. if (this.aborted || isDisturbed(this.opts.body)) {
  24816. return this.handler.onError(err)
  24817. }
  24818. this.retryOpts.retry(
  24819. err,
  24820. {
  24821. state: { counter: this.retryCount++, currentTimeout: this.retryAfter },
  24822. opts: { retryOptions: this.retryOpts, ...this.opts }
  24823. },
  24824. onRetry.bind(this)
  24825. )
  24826. function onRetry (err) {
  24827. if (err != null || this.aborted || isDisturbed(this.opts.body)) {
  24828. return this.handler.onError(err)
  24829. }
  24830. if (this.start !== 0) {
  24831. this.opts = {
  24832. ...this.opts,
  24833. headers: {
  24834. ...this.opts.headers,
  24835. range: `bytes=${this.start}-${this.end ?? ''}`
  24836. }
  24837. }
  24838. }
  24839. try {
  24840. this.dispatch(this.opts, this)
  24841. } catch (err) {
  24842. this.handler.onError(err)
  24843. }
  24844. }
  24845. }
  24846. }
  24847. module.exports = RetryHandler
  24848. /***/ }),
  24849. /***/ 8861:
  24850. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  24851. const RedirectHandler = __nccwpck_require__(2860)
  24852. function createRedirectInterceptor ({ maxRedirections: defaultMaxRedirections }) {
  24853. return (dispatch) => {
  24854. return function Intercept (opts, handler) {
  24855. const { maxRedirections = defaultMaxRedirections } = opts
  24856. if (!maxRedirections) {
  24857. return dispatch(opts, handler)
  24858. }
  24859. const redirectHandler = new RedirectHandler(dispatch, maxRedirections, opts, handler)
  24860. opts = { ...opts, maxRedirections: 0 } // Stop sub dispatcher from also redirecting.
  24861. return dispatch(opts, redirectHandler)
  24862. }
  24863. }
  24864. }
  24865. module.exports = createRedirectInterceptor
  24866. /***/ }),
  24867. /***/ 953:
  24868. /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
  24869. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24870. exports.SPECIAL_HEADERS = exports.HEADER_STATE = exports.MINOR = exports.MAJOR = exports.CONNECTION_TOKEN_CHARS = exports.HEADER_CHARS = exports.TOKEN = exports.STRICT_TOKEN = exports.HEX = exports.URL_CHAR = exports.STRICT_URL_CHAR = exports.USERINFO_CHARS = exports.MARK = exports.ALPHANUM = exports.NUM = exports.HEX_MAP = exports.NUM_MAP = exports.ALPHA = exports.FINISH = exports.H_METHOD_MAP = exports.METHOD_MAP = exports.METHODS_RTSP = exports.METHODS_ICE = exports.METHODS_HTTP = exports.METHODS = exports.LENIENT_FLAGS = exports.FLAGS = exports.TYPE = exports.ERROR = void 0;
  24871. const utils_1 = __nccwpck_require__(1891);
  24872. // C headers
  24873. var ERROR;
  24874. (function (ERROR) {
  24875. ERROR[ERROR["OK"] = 0] = "OK";
  24876. ERROR[ERROR["INTERNAL"] = 1] = "INTERNAL";
  24877. ERROR[ERROR["STRICT"] = 2] = "STRICT";
  24878. ERROR[ERROR["LF_EXPECTED"] = 3] = "LF_EXPECTED";
  24879. ERROR[ERROR["UNEXPECTED_CONTENT_LENGTH"] = 4] = "UNEXPECTED_CONTENT_LENGTH";
  24880. ERROR[ERROR["CLOSED_CONNECTION"] = 5] = "CLOSED_CONNECTION";
  24881. ERROR[ERROR["INVALID_METHOD"] = 6] = "INVALID_METHOD";
  24882. ERROR[ERROR["INVALID_URL"] = 7] = "INVALID_URL";
  24883. ERROR[ERROR["INVALID_CONSTANT"] = 8] = "INVALID_CONSTANT";
  24884. ERROR[ERROR["INVALID_VERSION"] = 9] = "INVALID_VERSION";
  24885. ERROR[ERROR["INVALID_HEADER_TOKEN"] = 10] = "INVALID_HEADER_TOKEN";
  24886. ERROR[ERROR["INVALID_CONTENT_LENGTH"] = 11] = "INVALID_CONTENT_LENGTH";
  24887. ERROR[ERROR["INVALID_CHUNK_SIZE"] = 12] = "INVALID_CHUNK_SIZE";
  24888. ERROR[ERROR["INVALID_STATUS"] = 13] = "INVALID_STATUS";
  24889. ERROR[ERROR["INVALID_EOF_STATE"] = 14] = "INVALID_EOF_STATE";
  24890. ERROR[ERROR["INVALID_TRANSFER_ENCODING"] = 15] = "INVALID_TRANSFER_ENCODING";
  24891. ERROR[ERROR["CB_MESSAGE_BEGIN"] = 16] = "CB_MESSAGE_BEGIN";
  24892. ERROR[ERROR["CB_HEADERS_COMPLETE"] = 17] = "CB_HEADERS_COMPLETE";
  24893. ERROR[ERROR["CB_MESSAGE_COMPLETE"] = 18] = "CB_MESSAGE_COMPLETE";
  24894. ERROR[ERROR["CB_CHUNK_HEADER"] = 19] = "CB_CHUNK_HEADER";
  24895. ERROR[ERROR["CB_CHUNK_COMPLETE"] = 20] = "CB_CHUNK_COMPLETE";
  24896. ERROR[ERROR["PAUSED"] = 21] = "PAUSED";
  24897. ERROR[ERROR["PAUSED_UPGRADE"] = 22] = "PAUSED_UPGRADE";
  24898. ERROR[ERROR["PAUSED_H2_UPGRADE"] = 23] = "PAUSED_H2_UPGRADE";
  24899. ERROR[ERROR["USER"] = 24] = "USER";
  24900. })(ERROR = exports.ERROR || (exports.ERROR = {}));
  24901. var TYPE;
  24902. (function (TYPE) {
  24903. TYPE[TYPE["BOTH"] = 0] = "BOTH";
  24904. TYPE[TYPE["REQUEST"] = 1] = "REQUEST";
  24905. TYPE[TYPE["RESPONSE"] = 2] = "RESPONSE";
  24906. })(TYPE = exports.TYPE || (exports.TYPE = {}));
  24907. var FLAGS;
  24908. (function (FLAGS) {
  24909. FLAGS[FLAGS["CONNECTION_KEEP_ALIVE"] = 1] = "CONNECTION_KEEP_ALIVE";
  24910. FLAGS[FLAGS["CONNECTION_CLOSE"] = 2] = "CONNECTION_CLOSE";
  24911. FLAGS[FLAGS["CONNECTION_UPGRADE"] = 4] = "CONNECTION_UPGRADE";
  24912. FLAGS[FLAGS["CHUNKED"] = 8] = "CHUNKED";
  24913. FLAGS[FLAGS["UPGRADE"] = 16] = "UPGRADE";
  24914. FLAGS[FLAGS["CONTENT_LENGTH"] = 32] = "CONTENT_LENGTH";
  24915. FLAGS[FLAGS["SKIPBODY"] = 64] = "SKIPBODY";
  24916. FLAGS[FLAGS["TRAILING"] = 128] = "TRAILING";
  24917. // 1 << 8 is unused
  24918. FLAGS[FLAGS["TRANSFER_ENCODING"] = 512] = "TRANSFER_ENCODING";
  24919. })(FLAGS = exports.FLAGS || (exports.FLAGS = {}));
  24920. var LENIENT_FLAGS;
  24921. (function (LENIENT_FLAGS) {
  24922. LENIENT_FLAGS[LENIENT_FLAGS["HEADERS"] = 1] = "HEADERS";
  24923. LENIENT_FLAGS[LENIENT_FLAGS["CHUNKED_LENGTH"] = 2] = "CHUNKED_LENGTH";
  24924. LENIENT_FLAGS[LENIENT_FLAGS["KEEP_ALIVE"] = 4] = "KEEP_ALIVE";
  24925. })(LENIENT_FLAGS = exports.LENIENT_FLAGS || (exports.LENIENT_FLAGS = {}));
  24926. var METHODS;
  24927. (function (METHODS) {
  24928. METHODS[METHODS["DELETE"] = 0] = "DELETE";
  24929. METHODS[METHODS["GET"] = 1] = "GET";
  24930. METHODS[METHODS["HEAD"] = 2] = "HEAD";
  24931. METHODS[METHODS["POST"] = 3] = "POST";
  24932. METHODS[METHODS["PUT"] = 4] = "PUT";
  24933. /* pathological */
  24934. METHODS[METHODS["CONNECT"] = 5] = "CONNECT";
  24935. METHODS[METHODS["OPTIONS"] = 6] = "OPTIONS";
  24936. METHODS[METHODS["TRACE"] = 7] = "TRACE";
  24937. /* WebDAV */
  24938. METHODS[METHODS["COPY"] = 8] = "COPY";
  24939. METHODS[METHODS["LOCK"] = 9] = "LOCK";
  24940. METHODS[METHODS["MKCOL"] = 10] = "MKCOL";
  24941. METHODS[METHODS["MOVE"] = 11] = "MOVE";
  24942. METHODS[METHODS["PROPFIND"] = 12] = "PROPFIND";
  24943. METHODS[METHODS["PROPPATCH"] = 13] = "PROPPATCH";
  24944. METHODS[METHODS["SEARCH"] = 14] = "SEARCH";
  24945. METHODS[METHODS["UNLOCK"] = 15] = "UNLOCK";
  24946. METHODS[METHODS["BIND"] = 16] = "BIND";
  24947. METHODS[METHODS["REBIND"] = 17] = "REBIND";
  24948. METHODS[METHODS["UNBIND"] = 18] = "UNBIND";
  24949. METHODS[METHODS["ACL"] = 19] = "ACL";
  24950. /* subversion */
  24951. METHODS[METHODS["REPORT"] = 20] = "REPORT";
  24952. METHODS[METHODS["MKACTIVITY"] = 21] = "MKACTIVITY";
  24953. METHODS[METHODS["CHECKOUT"] = 22] = "CHECKOUT";
  24954. METHODS[METHODS["MERGE"] = 23] = "MERGE";
  24955. /* upnp */
  24956. METHODS[METHODS["M-SEARCH"] = 24] = "M-SEARCH";
  24957. METHODS[METHODS["NOTIFY"] = 25] = "NOTIFY";
  24958. METHODS[METHODS["SUBSCRIBE"] = 26] = "SUBSCRIBE";
  24959. METHODS[METHODS["UNSUBSCRIBE"] = 27] = "UNSUBSCRIBE";
  24960. /* RFC-5789 */
  24961. METHODS[METHODS["PATCH"] = 28] = "PATCH";
  24962. METHODS[METHODS["PURGE"] = 29] = "PURGE";
  24963. /* CalDAV */
  24964. METHODS[METHODS["MKCALENDAR"] = 30] = "MKCALENDAR";
  24965. /* RFC-2068, section 19.6.1.2 */
  24966. METHODS[METHODS["LINK"] = 31] = "LINK";
  24967. METHODS[METHODS["UNLINK"] = 32] = "UNLINK";
  24968. /* icecast */
  24969. METHODS[METHODS["SOURCE"] = 33] = "SOURCE";
  24970. /* RFC-7540, section 11.6 */
  24971. METHODS[METHODS["PRI"] = 34] = "PRI";
  24972. /* RFC-2326 RTSP */
  24973. METHODS[METHODS["DESCRIBE"] = 35] = "DESCRIBE";
  24974. METHODS[METHODS["ANNOUNCE"] = 36] = "ANNOUNCE";
  24975. METHODS[METHODS["SETUP"] = 37] = "SETUP";
  24976. METHODS[METHODS["PLAY"] = 38] = "PLAY";
  24977. METHODS[METHODS["PAUSE"] = 39] = "PAUSE";
  24978. METHODS[METHODS["TEARDOWN"] = 40] = "TEARDOWN";
  24979. METHODS[METHODS["GET_PARAMETER"] = 41] = "GET_PARAMETER";
  24980. METHODS[METHODS["SET_PARAMETER"] = 42] = "SET_PARAMETER";
  24981. METHODS[METHODS["REDIRECT"] = 43] = "REDIRECT";
  24982. METHODS[METHODS["RECORD"] = 44] = "RECORD";
  24983. /* RAOP */
  24984. METHODS[METHODS["FLUSH"] = 45] = "FLUSH";
  24985. })(METHODS = exports.METHODS || (exports.METHODS = {}));
  24986. exports.METHODS_HTTP = [
  24987. METHODS.DELETE,
  24988. METHODS.GET,
  24989. METHODS.HEAD,
  24990. METHODS.POST,
  24991. METHODS.PUT,
  24992. METHODS.CONNECT,
  24993. METHODS.OPTIONS,
  24994. METHODS.TRACE,
  24995. METHODS.COPY,
  24996. METHODS.LOCK,
  24997. METHODS.MKCOL,
  24998. METHODS.MOVE,
  24999. METHODS.PROPFIND,
  25000. METHODS.PROPPATCH,
  25001. METHODS.SEARCH,
  25002. METHODS.UNLOCK,
  25003. METHODS.BIND,
  25004. METHODS.REBIND,
  25005. METHODS.UNBIND,
  25006. METHODS.ACL,
  25007. METHODS.REPORT,
  25008. METHODS.MKACTIVITY,
  25009. METHODS.CHECKOUT,
  25010. METHODS.MERGE,
  25011. METHODS['M-SEARCH'],
  25012. METHODS.NOTIFY,
  25013. METHODS.SUBSCRIBE,
  25014. METHODS.UNSUBSCRIBE,
  25015. METHODS.PATCH,
  25016. METHODS.PURGE,
  25017. METHODS.MKCALENDAR,
  25018. METHODS.LINK,
  25019. METHODS.UNLINK,
  25020. METHODS.PRI,
  25021. // TODO(indutny): should we allow it with HTTP?
  25022. METHODS.SOURCE,
  25023. ];
  25024. exports.METHODS_ICE = [
  25025. METHODS.SOURCE,
  25026. ];
  25027. exports.METHODS_RTSP = [
  25028. METHODS.OPTIONS,
  25029. METHODS.DESCRIBE,
  25030. METHODS.ANNOUNCE,
  25031. METHODS.SETUP,
  25032. METHODS.PLAY,
  25033. METHODS.PAUSE,
  25034. METHODS.TEARDOWN,
  25035. METHODS.GET_PARAMETER,
  25036. METHODS.SET_PARAMETER,
  25037. METHODS.REDIRECT,
  25038. METHODS.RECORD,
  25039. METHODS.FLUSH,
  25040. // For AirPlay
  25041. METHODS.GET,
  25042. METHODS.POST,
  25043. ];
  25044. exports.METHOD_MAP = utils_1.enumToMap(METHODS);
  25045. exports.H_METHOD_MAP = {};
  25046. Object.keys(exports.METHOD_MAP).forEach((key) => {
  25047. if (/^H/.test(key)) {
  25048. exports.H_METHOD_MAP[key] = exports.METHOD_MAP[key];
  25049. }
  25050. });
  25051. var FINISH;
  25052. (function (FINISH) {
  25053. FINISH[FINISH["SAFE"] = 0] = "SAFE";
  25054. FINISH[FINISH["SAFE_WITH_CB"] = 1] = "SAFE_WITH_CB";
  25055. FINISH[FINISH["UNSAFE"] = 2] = "UNSAFE";
  25056. })(FINISH = exports.FINISH || (exports.FINISH = {}));
  25057. exports.ALPHA = [];
  25058. for (let i = 'A'.charCodeAt(0); i <= 'Z'.charCodeAt(0); i++) {
  25059. // Upper case
  25060. exports.ALPHA.push(String.fromCharCode(i));
  25061. // Lower case
  25062. exports.ALPHA.push(String.fromCharCode(i + 0x20));
  25063. }
  25064. exports.NUM_MAP = {
  25065. 0: 0, 1: 1, 2: 2, 3: 3, 4: 4,
  25066. 5: 5, 6: 6, 7: 7, 8: 8, 9: 9,
  25067. };
  25068. exports.HEX_MAP = {
  25069. 0: 0, 1: 1, 2: 2, 3: 3, 4: 4,
  25070. 5: 5, 6: 6, 7: 7, 8: 8, 9: 9,
  25071. A: 0XA, B: 0XB, C: 0XC, D: 0XD, E: 0XE, F: 0XF,
  25072. a: 0xa, b: 0xb, c: 0xc, d: 0xd, e: 0xe, f: 0xf,
  25073. };
  25074. exports.NUM = [
  25075. '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
  25076. ];
  25077. exports.ALPHANUM = exports.ALPHA.concat(exports.NUM);
  25078. exports.MARK = ['-', '_', '.', '!', '~', '*', '\'', '(', ')'];
  25079. exports.USERINFO_CHARS = exports.ALPHANUM
  25080. .concat(exports.MARK)
  25081. .concat(['%', ';', ':', '&', '=', '+', '$', ',']);
  25082. // TODO(indutny): use RFC
  25083. exports.STRICT_URL_CHAR = [
  25084. '!', '"', '$', '%', '&', '\'',
  25085. '(', ')', '*', '+', ',', '-', '.', '/',
  25086. ':', ';', '<', '=', '>',
  25087. '@', '[', '\\', ']', '^', '_',
  25088. '`',
  25089. '{', '|', '}', '~',
  25090. ].concat(exports.ALPHANUM);
  25091. exports.URL_CHAR = exports.STRICT_URL_CHAR
  25092. .concat(['\t', '\f']);
  25093. // All characters with 0x80 bit set to 1
  25094. for (let i = 0x80; i <= 0xff; i++) {
  25095. exports.URL_CHAR.push(i);
  25096. }
  25097. exports.HEX = exports.NUM.concat(['a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F']);
  25098. /* Tokens as defined by rfc 2616. Also lowercases them.
  25099. * token = 1*<any CHAR except CTLs or separators>
  25100. * separators = "(" | ")" | "<" | ">" | "@"
  25101. * | "," | ";" | ":" | "\" | <">
  25102. * | "/" | "[" | "]" | "?" | "="
  25103. * | "{" | "}" | SP | HT
  25104. */
  25105. exports.STRICT_TOKEN = [
  25106. '!', '#', '$', '%', '&', '\'',
  25107. '*', '+', '-', '.',
  25108. '^', '_', '`',
  25109. '|', '~',
  25110. ].concat(exports.ALPHANUM);
  25111. exports.TOKEN = exports.STRICT_TOKEN.concat([' ']);
  25112. /*
  25113. * Verify that a char is a valid visible (printable) US-ASCII
  25114. * character or %x80-FF
  25115. */
  25116. exports.HEADER_CHARS = ['\t'];
  25117. for (let i = 32; i <= 255; i++) {
  25118. if (i !== 127) {
  25119. exports.HEADER_CHARS.push(i);
  25120. }
  25121. }
  25122. // ',' = \x44
  25123. exports.CONNECTION_TOKEN_CHARS = exports.HEADER_CHARS.filter((c) => c !== 44);
  25124. exports.MAJOR = exports.NUM_MAP;
  25125. exports.MINOR = exports.MAJOR;
  25126. var HEADER_STATE;
  25127. (function (HEADER_STATE) {
  25128. HEADER_STATE[HEADER_STATE["GENERAL"] = 0] = "GENERAL";
  25129. HEADER_STATE[HEADER_STATE["CONNECTION"] = 1] = "CONNECTION";
  25130. HEADER_STATE[HEADER_STATE["CONTENT_LENGTH"] = 2] = "CONTENT_LENGTH";
  25131. HEADER_STATE[HEADER_STATE["TRANSFER_ENCODING"] = 3] = "TRANSFER_ENCODING";
  25132. HEADER_STATE[HEADER_STATE["UPGRADE"] = 4] = "UPGRADE";
  25133. HEADER_STATE[HEADER_STATE["CONNECTION_KEEP_ALIVE"] = 5] = "CONNECTION_KEEP_ALIVE";
  25134. HEADER_STATE[HEADER_STATE["CONNECTION_CLOSE"] = 6] = "CONNECTION_CLOSE";
  25135. HEADER_STATE[HEADER_STATE["CONNECTION_UPGRADE"] = 7] = "CONNECTION_UPGRADE";
  25136. HEADER_STATE[HEADER_STATE["TRANSFER_ENCODING_CHUNKED"] = 8] = "TRANSFER_ENCODING_CHUNKED";
  25137. })(HEADER_STATE = exports.HEADER_STATE || (exports.HEADER_STATE = {}));
  25138. exports.SPECIAL_HEADERS = {
  25139. 'connection': HEADER_STATE.CONNECTION,
  25140. 'content-length': HEADER_STATE.CONTENT_LENGTH,
  25141. 'proxy-connection': HEADER_STATE.CONNECTION,
  25142. 'transfer-encoding': HEADER_STATE.TRANSFER_ENCODING,
  25143. 'upgrade': HEADER_STATE.UPGRADE,
  25144. };
  25145. //# sourceMappingURL=constants.js.map
  25146. /***/ }),
  25147. /***/ 1145:
  25148. /***/ ((module) => {
  25149. module.exports = 'AGFzbQEAAAABMAhgAX8Bf2ADf39/AX9gBH9/f38Bf2AAAGADf39/AGABfwBgAn9/AGAGf39/f39/AALLAQgDZW52GHdhc21fb25faGVhZGVyc19jb21wbGV0ZQACA2VudhV3YXNtX29uX21lc3NhZ2VfYmVnaW4AAANlbnYLd2FzbV9vbl91cmwAAQNlbnYOd2FzbV9vbl9zdGF0dXMAAQNlbnYUd2FzbV9vbl9oZWFkZXJfZmllbGQAAQNlbnYUd2FzbV9vbl9oZWFkZXJfdmFsdWUAAQNlbnYMd2FzbV9vbl9ib2R5AAEDZW52GHdhc21fb25fbWVzc2FnZV9jb21wbGV0ZQAAA0ZFAwMEAAAFAAAAAAAABQEFAAUFBQAABgAAAAAGBgYGAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQABAAABAQcAAAUFAwABBAUBcAESEgUDAQACBggBfwFBgNQECwfRBSIGbWVtb3J5AgALX2luaXRpYWxpemUACRlfX2luZGlyZWN0X2Z1bmN0aW9uX3RhYmxlAQALbGxodHRwX2luaXQAChhsbGh0dHBfc2hvdWxkX2tlZXBfYWxpdmUAQQxsbGh0dHBfYWxsb2MADAZtYWxsb2MARgtsbGh0dHBfZnJlZQANBGZyZWUASA9sbGh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ANwMAIABBMGpCADcDACAAQShqQgA3AwAgAEEgakIANwMAIABBEGpCADcDACAAQQhqQgA3AwAgAEHdATYCHEEAC3sBAX8CQCAAKAIMIgMNAAJAIAAoAgRFDQAgACABNgIECwJAIAAgASACEMSAgIAAIgMNACAAKAIMDwsgACADNgIcQQAhAyAAKAIEIgFFDQAgACABIAIgACgCCBGBgICAAAAiAUUNACAAIAI2AhQgACABNgIMIAEhAwsgAwvk8wEDDn8DfgR/I4CAgIAAQRBrIgMkgICAgAAgASEEIAEhBSABIQYgASEHIAEhCCABIQkgASEKIAEhCyABIQwgASENIAEhDiABIQ8CQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgACgCHCIQQX9qDt0B2gEB2QECAwQFBgcICQoLDA0O2AEPENcBERLWARMUFRYXGBkaG+AB3wEcHR7VAR8gISIjJCXUASYnKCkqKyzTAdIBLS7RAdABLzAxMjM0NTY3ODk6Ozw9Pj9AQUJDREVG2wFHSElKzwHOAUvNAUzMAU1OT1BRUlNUVVZXWFlaW1xdX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MFwtBrgEhEAwWC0EBIRAMFQtBrwEhEAwUC0GwASEQDBMLQbEBIRAMEgtBswEhEAwRC0GyASEQDBALQbQBIRAMDwtBtQEhEAwOC0G2ASEQDA0LQbcBIRAMDAtBuAEhEAwLC0G5ASEQDAoLQboBIRAMCQtBuwEhEAwIC0HGASEQDAcLQbwBIRAMBgtBvQEhEAwFC0G+ASEQDAQLQb8BIRAMAwtBwAEhEAwCC0HCASEQDAELQcEBIRALA0ACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAC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gAEHlADYCHCAAIAE2AhQgACAQNgIMQQAhEAysAQsgAEEANgIcIAAgATYCFCAAQdyIgIAANgIQIABBBzYCDEEAIRAMqwELIBBBP0cNASABQQFqIQELQQUhEAyQAQtBACEQIABBADYCHCAAIAE2AhQgAEH9koCAADYCECAAQQc2AgwMqAELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDEILIABB0gA2AhwgACABNgIUIAAgEDYCDEEAIRAMpwELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDEILIABB0wA2AhwgACABNgIUIAAgEDYCDEEAIRAMpgELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDEYLIABB5QA2AhwgACABNgIUIAAgEDYCDEEAIRAMpQELIAAoAgQhASAAQQA2AgQCQCAAIAEgFBCngICAACIBDQAgFCEBDD8LIABB0gA2AhwgACAUNgIUIAAgATYCDEEAIRAMpAELIAAoAgQhASAAQQA2AgQCQCAAIAEgFBCngICAACIBDQAgFCEBDD8LIABB0wA2AhwgACAUNgIUIAAgATYCDEEAIRAMowELIAAoAgQhASAAQQA2AgQCQCAAIAEgFBCngICAACIBDQAgFCEBDEMLIABB5QA2AhwgACAUNgIUIAAgATYCDEEAIRAMogELIABBADYCHCAAIBQ2AhQgAEHDj4CAADYCECAAQQc2AgxBACEQDKEBCyAAQQA2AhwgACABNgIUIABBw4+AgAA2AhAgAEEHNgIMQQAhEAygAQtBACEQIABBADYCHCAAIBQ2AhQgAEGMnICAADYCECAAQQc2AgwMnwELIABBADYCHCAAIBQ2AhQgAEGMnICAADYCECAAQQc2AgxBACEQDJ4BCyAAQQA2AhwgACAUNgIUIABB/pGAgAA2AhAgAEEHNgIMQQAhEAydAQsgAEEANgIcIAAgATYCFCAAQY6bgIAANgIQIABBBjYCDEEAIRAMnAELIBBBFUYNVyAAQQA2AhwgACABNgIUIABBzI6AgAA2AhAgAEEgNgIMQQAhEAybAQsgAEEANgIAIBBBAWohAUE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AJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIBAOxwEAAQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGR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AEgASEBDPICCwJAIAEiASACRw0AQQshEAzpAwsgACABQQFqIgEgAhC2gICAACIQDeUBIAEhAQzyAgsgACABIgEgAhC4gICAACIQDeUBIAEhAQzyAgsgACABIgEgAhC4gICAACIQDeYBIAEhAQwNCyAAIAEiASACELqAgIAAIhAN5wEgASEBDPACCwJAIAEiASACRw0AQQ8hEAzlAwsgAS0AACIQQTtGDQggEEENRw3oASABQQFqIQEM7wILIAAgASIBIAIQuoCAgAAiEA3oASABIQEM8gILA0ACQCABLQAAQfC1gIAAai0AACIQQQFGDQAgEEECRw3rASAAKAIEIRAgAEEANgIEIAAgECABQQFqIgEQuYCAgAAiEA3qASABIQEM9AILIAFBAWoiASACRw0AC0ESIRAM4gMLIAAgASIBIAIQuoCAgAAiEA3pASABIQEMCgsgASIBIAJHDQZBGyEQDOADCwJAIAEiASACRw0AQRYhEAzgAwsgAEGKgICAADYCCCAAIAE2AgQgACABIAIQuICAgAAiEA3qASABIQFBICEQDMYDCwJAIAEiASACRg0AA0ACQCABLQAAQfC3gIAAai0AACIQQQJGDQACQCAQQX9qDgTlAewBAOsB7AELIAFBAWohAUEIIRAMyAMLIAFBAWoiASACRw0AC0EVIRAM3wMLQRUhEAzeAwsDQAJAIAEtAABB8LmAgABqLQAAIhBBAkYNACAQQX9qDgTeAewB4AHrAewBCyABQQFqIgEgAkcNAAtBGCEQDN0DCwJAIAEiASACRg0AIABBi4CAgAA2AgggACABNgIEIAEhAUEHIRAMxAMLQRkhEAzcAwsgAUEBaiEBDAILAkAgASIUIAJHDQBBGiEQDNsDCyAUIQECQCAULQAAQXNqDhTdAu4C7gLuAu4C7gLuAu4C7gLuAu4C7gLuAu4C7gLuAu4C7gLuAgDuAgtBACEQIABBADYCHCAAQa+LgIAANgIQIABBAjYCDCAAIBRBAWo2AhQM2gMLAkAgAS0AACIQQTtGDQAgEEENRw3oASABQQFqIQEM5QILIAFBAWohAQtBIiEQDL8DCwJAIAEiECACRw0AQRwhEAzYAwtCACERIBAhASAQL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ngICAACIQDQAgASEBDFQLIABB5QA2AhwgACABNgIUIAAgEDYCDEEAIRAMswELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDE0LIABB0gA2AhwgACABNgIUIAAgEDYCDEEAIRAMsgELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDE0LIABB0wA2AhwgACABNgIUIAAgEDYCDEEAIRAMsQELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDFELIABB5QA2AhwgACABNgIUIAAgEDYCDEEAIRAMsAELIABBADYCHCAAIAE2AhQgAEHGioCAADYCECAAQQc2AgxBACEQDK8BCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxJCyAAQdIANgIcIAAgATYCFCAAIBA2AgxBACEQDK4BCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxJCyAAQdMANgIcIAAgATYCFCAAIBA2AgxBACEQDK0BCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxNCyAAQeUANgIcIAAgATYCFCAAIBA2AgxBACEQDKwBCyAAQQA2AhwgACABNgIUIABB3IiAgAA2AhAgAEEHNgIMQQAhEAyrAQsgEEE/Rw0BIAFBAWohAQtBBSEQDJABC0EAIRAgAEEANgIcIAAgATYCFCAAQf2SgIAANgIQIABBBzYCDAyoAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMQgsgAEHSADYCHCAAIAE2AhQgACAQNgIMQQAhEAynAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMQgsgAEHTADYCHCAAIAE2AhQgACAQNgIMQQAhEAymAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMRgsgAEHlADYCHCAAIAE2AhQgACAQNgIMQQAhEAylAQsgACgCBCEBIABBADYCBAJAIAAgASAUEKeAgIAAIgENACAUIQEMPws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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAgAAAAACAAAAAAAAAAAAAAAAAAAAAAADAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwAAAAAAAAMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE5PVU5DRUVDS09VVE5FQ1RFVEVDUklCRUxVU0hFVEVBRFNFQVJDSFJHRUNUSVZJVFlMRU5EQVJWRU9USUZZUFRJT05TQ0hTRUFZU1RBVENIR0VPUkRJUkVDVE9SVFJDSFBBUkFNRVRFUlVSQ0VCU0NSSUJFQVJET1dOQUNFSU5ETktDS1VCU0NSSUJFSFRUUC9BRFRQLw=='
  25154. /***/ }),
  25155. /***/ 1891:
  25156. /***/ ((__unused_webpack_module, exports) => {
  25157. Object.defineProperty(exports, "__esModule", ({ value: true }));
  25158. exports.enumToMap = void 0;
  25159. function enumToMap(obj) {
  25160. const res = {};
  25161. Object.keys(obj).forEach((key) => {
  25162. const value = obj[key];
  25163. if (typeof value === 'number') {
  25164. res[key] = value;
  25165. }
  25166. });
  25167. return res;
  25168. }
  25169. exports.enumToMap = enumToMap;
  25170. //# sourceMappingURL=utils.js.map
  25171. /***/ }),
  25172. /***/ 6771:
  25173. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  25174. const { kClients } = __nccwpck_require__(2785)
  25175. const Agent = __nccwpck_require__(7890)
  25176. const {
  25177. kAgent,
  25178. kMockAgentSet,
  25179. kMockAgentGet,
  25180. kDispatches,
  25181. kIsMockActive,
  25182. kNetConnect,
  25183. kGetNetConnect,
  25184. kOptions,
  25185. kFactory
  25186. } = __nccwpck_require__(4347)
  25187. const MockClient = __nccwpck_require__(8687)
  25188. const MockPool = __nccwpck_require__(6193)
  25189. const { matchValue, buildMockOptions } = __nccwpck_require__(9323)
  25190. const { InvalidArgumentError, UndiciError } = __nccwpck_require__(8045)
  25191. const Dispatcher = __nccwpck_require__(412)
  25192. const Pluralizer = __nccwpck_require__(8891)
  25193. const PendingInterceptorsFormatter = __nccwpck_require__(6823)
  25194. class FakeWeakRef {
  25195. constructor (value) {
  25196. this.value = value
  25197. }
  25198. deref () {
  25199. return this.value
  25200. }
  25201. }
  25202. class MockAgent extends Dispatcher {
  25203. constructor (opts) {
  25204. super(opts)
  25205. this[kNetConnect] = true
  25206. this[kIsMockActive] = true
  25207. // Instantiate Agent and encapsulate
  25208. if ((opts && opts.agent && typeof opts.agent.dispatch !== 'function')) {
  25209. throw new InvalidArgumentError('Argument opts.agent must implement Agent')
  25210. }
  25211. const agent = opts && opts.agent ? opts.agent : new Agent(opts)
  25212. this[kAgent] = agent
  25213. this[kClients] = agent[kClients]
  25214. this[kOptions] = buildMockOptions(opts)
  25215. }
  25216. get (origin) {
  25217. let dispatcher = this[kMockAgentGet](origin)
  25218. if (!dispatcher) {
  25219. dispatcher = this[kFactory](origin)
  25220. this[kMockAgentSet](origin, dispatcher)
  25221. }
  25222. return dispatcher
  25223. }
  25224. dispatch (opts, handler) {
  25225. // Call MockAgent.get to perform additional setup before dispatching as normal
  25226. this.get(opts.origin)
  25227. return this[kAgent].dispatch(opts, handler)
  25228. }
  25229. async close () {
  25230. await this[kAgent].close()
  25231. this[kClients].clear()
  25232. }
  25233. deactivate () {
  25234. this[kIsMockActive] = false
  25235. }
  25236. activate () {
  25237. this[kIsMockActive] = true
  25238. }
  25239. enableNetConnect (matcher) {
  25240. if (typeof matcher === 'string' || typeof matcher === 'function' || matcher instanceof RegExp) {
  25241. if (Array.isArray(this[kNetConnect])) {
  25242. this[kNetConnect].push(matcher)
  25243. } else {
  25244. this[kNetConnect] = [matcher]
  25245. }
  25246. } else if (typeof matcher === 'undefined') {
  25247. this[kNetConnect] = true
  25248. } else {
  25249. throw new InvalidArgumentError('Unsupported matcher. Must be one of String|Function|RegExp.')
  25250. }
  25251. }
  25252. disableNetConnect () {
  25253. this[kNetConnect] = false
  25254. }
  25255. // This is required to bypass issues caused by using global symbols - see:
  25256. // https://github.com/nodejs/undici/issues/1447
  25257. get isMockActive () {
  25258. return this[kIsMockActive]
  25259. }
  25260. [kMockAgentSet] (origin, dispatcher) {
  25261. this[kClients].set(origin, new FakeWeakRef(dispatcher))
  25262. }
  25263. [kFactory] (origin) {
  25264. const mockOptions = Object.assign({ agent: this }, this[kOptions])
  25265. return this[kOptions] && this[kOptions].connections === 1
  25266. ? new MockClient(origin, mockOptions)
  25267. : new MockPool(origin, mockOptions)
  25268. }
  25269. [kMockAgentGet] (origin) {
  25270. // First check if we can immediately find it
  25271. const ref = this[kClients].get(origin)
  25272. if (ref) {
  25273. return ref.deref()
  25274. }
  25275. // If the origin is not a string create a dummy parent pool and return to user
  25276. if (typeof origin !== 'string') {
  25277. const dispatcher = this[kFactory]('http://localhost:9999')
  25278. this[kMockAgentSet](origin, dispatcher)
  25279. return dispatcher
  25280. }
  25281. // If we match, create a pool and assign the same dispatches
  25282. for (const [keyMatcher, nonExplicitRef] of Array.from(this[kClients])) {
  25283. const nonExplicitDispatcher = nonExplicitRef.deref()
  25284. if (nonExplicitDispatcher && typeof keyMatcher !== 'string' && matchValue(keyMatcher, origin)) {
  25285. const dispatcher = this[kFactory](origin)
  25286. this[kMockAgentSet](origin, dispatcher)
  25287. dispatcher[kDispatches] = nonExplicitDispatcher[kDispatches]
  25288. return dispatcher
  25289. }
  25290. }
  25291. }
  25292. [kGetNetConnect] () {
  25293. return this[kNetConnect]
  25294. }
  25295. pendingInterceptors () {
  25296. const mockAgentClients = this[kClients]
  25297. return Array.from(mockAgentClients.entries())
  25298. .flatMap(([origin, scope]) => scope.deref()[kDispatches].map(dispatch => ({ ...dispatch, origin })))
  25299. .filter(({ pending }) => pending)
  25300. }
  25301. assertNoPendingInterceptors ({ pendingInterceptorsFormatter = new PendingInterceptorsFormatter() } = {}) {
  25302. const pending = this.pendingInterceptors()
  25303. if (pending.length === 0) {
  25304. return
  25305. }
  25306. const pluralizer = new Pluralizer('interceptor', 'interceptors').pluralize(pending.length)
  25307. throw new UndiciError(`
  25308. ${pluralizer.count} ${pluralizer.noun} ${pluralizer.is} pending:
  25309. ${pendingInterceptorsFormatter.format(pending)}
  25310. `.trim())
  25311. }
  25312. }
  25313. module.exports = MockAgent
  25314. /***/ }),
  25315. /***/ 8687:
  25316. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  25317. const { promisify } = __nccwpck_require__(3837)
  25318. const Client = __nccwpck_require__(3598)
  25319. const { buildMockDispatch } = __nccwpck_require__(9323)
  25320. const {
  25321. kDispatches,
  25322. kMockAgent,
  25323. kClose,
  25324. kOriginalClose,
  25325. kOrigin,
  25326. kOriginalDispatch,
  25327. kConnected
  25328. } = __nccwpck_require__(4347)
  25329. const { MockInterceptor } = __nccwpck_require__(410)
  25330. const Symbols = __nccwpck_require__(2785)
  25331. const { InvalidArgumentError } = __nccwpck_require__(8045)
  25332. /**
  25333. * MockClient provides an API that extends the Client to influence the mockDispatches.
  25334. */
  25335. class MockClient extends Client {
  25336. constructor (origin, opts) {
  25337. super(origin, opts)
  25338. if (!opts || !opts.agent || typeof opts.agent.dispatch !== 'function') {
  25339. throw new InvalidArgumentError('Argument opts.agent must implement Agent')
  25340. }
  25341. this[kMockAgent] = opts.agent
  25342. this[kOrigin] = origin
  25343. this[kDispatches] = []
  25344. this[kConnected] = 1
  25345. this[kOriginalDispatch] = this.dispatch
  25346. this[kOriginalClose] = this.close.bind(this)
  25347. this.dispatch = buildMockDispatch.call(this)
  25348. this.close = this[kClose]
  25349. }
  25350. get [Symbols.kConnected] () {
  25351. return this[kConnected]
  25352. }
  25353. /**
  25354. * Sets up the base interceptor for mocking replies from undici.
  25355. */
  25356. intercept (opts) {
  25357. return new MockInterceptor(opts, this[kDispatches])
  25358. }
  25359. async [kClose] () {
  25360. await promisify(this[kOriginalClose])()
  25361. this[kConnected] = 0
  25362. this[kMockAgent][Symbols.kClients].delete(this[kOrigin])
  25363. }
  25364. }
  25365. module.exports = MockClient
  25366. /***/ }),
  25367. /***/ 888:
  25368. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  25369. const { UndiciError } = __nccwpck_require__(8045)
  25370. class MockNotMatchedError extends UndiciError {
  25371. constructor (message) {
  25372. super(message)
  25373. Error.captureStackTrace(this, MockNotMatchedError)
  25374. this.name = 'MockNotMatchedError'
  25375. this.message = message || 'The request does not match any registered mock dispatches'
  25376. this.code = 'UND_MOCK_ERR_MOCK_NOT_MATCHED'
  25377. }
  25378. }
  25379. module.exports = {
  25380. MockNotMatchedError
  25381. }
  25382. /***/ }),
  25383. /***/ 410:
  25384. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  25385. const { getResponseData, buildKey, addMockDispatch } = __nccwpck_require__(9323)
  25386. const {
  25387. kDispatches,
  25388. kDispatchKey,
  25389. kDefaultHeaders,
  25390. kDefaultTrailers,
  25391. kContentLength,
  25392. kMockDispatch
  25393. } = __nccwpck_require__(4347)
  25394. const { InvalidArgumentError } = __nccwpck_require__(8045)
  25395. const { buildURL } = __nccwpck_require__(3983)
  25396. /**
  25397. * Defines the scope API for an interceptor reply
  25398. */
  25399. class MockScope {
  25400. constructor (mockDispatch) {
  25401. this[kMockDispatch] = mockDispatch
  25402. }
  25403. /**
  25404. * Delay a reply by a set amount in ms.
  25405. */
  25406. delay (waitInMs) {
  25407. if (typeof waitInMs !== 'number' || !Number.isInteger(waitInMs) || waitInMs <= 0) {
  25408. throw new InvalidArgumentError('waitInMs must be a valid integer > 0')
  25409. }
  25410. this[kMockDispatch].delay = waitInMs
  25411. return this
  25412. }
  25413. /**
  25414. * For a defined reply, never mark as consumed.
  25415. */
  25416. persist () {
  25417. this[kMockDispatch].persist = true
  25418. return this
  25419. }
  25420. /**
  25421. * Allow one to define a reply for a set amount of matching requests.
  25422. */
  25423. times (repeatTimes) {
  25424. if (typeof repeatTimes !== 'number' || !Number.isInteger(repeatTimes) || repeatTimes <= 0) {
  25425. throw new InvalidArgumentError('repeatTimes must be a valid integer > 0')
  25426. }
  25427. this[kMockDispatch].times = repeatTimes
  25428. return this
  25429. }
  25430. }
  25431. /**
  25432. * Defines an interceptor for a Mock
  25433. */
  25434. class MockInterceptor {
  25435. constructor (opts, mockDispatches) {
  25436. if (typeof opts !== 'object') {
  25437. throw new InvalidArgumentError('opts must be an object')
  25438. }
  25439. if (typeof opts.path === 'undefined') {
  25440. throw new InvalidArgumentError('opts.path must be defined')
  25441. }
  25442. if (typeof opts.method === 'undefined') {
  25443. opts.method = 'GET'
  25444. }
  25445. // See https://github.com/nodejs/undici/issues/1245
  25446. // As per RFC 3986, clients are not supposed to send URI
  25447. // fragments to servers when they retrieve a document,
  25448. if (typeof opts.path === 'string') {
  25449. if (opts.query) {
  25450. opts.path = buildURL(opts.path, opts.query)
  25451. } else {
  25452. // Matches https://github.com/nodejs/undici/blob/main/lib/fetch/index.js#L1811
  25453. const parsedURL = new URL(opts.path, 'data://')
  25454. opts.path = parsedURL.pathname + parsedURL.search
  25455. }
  25456. }
  25457. if (typeof opts.method === 'string') {
  25458. opts.method = opts.method.toUpperCase()
  25459. }
  25460. this[kDispatchKey] = buildKey(opts)
  25461. this[kDispatches] = mockDispatches
  25462. this[kDefaultHeaders] = {}
  25463. this[kDefaultTrailers] = {}
  25464. this[kContentLength] = false
  25465. }
  25466. createMockScopeDispatchData (statusCode, data, responseOptions = {}) {
  25467. const responseData = getResponseData(data)
  25468. const contentLength = this[kContentLength] ? { 'content-length': responseData.length } : {}
  25469. const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }
  25470. const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }
  25471. return { statusCode, data, headers, trailers }
  25472. }
  25473. validateReplyParameters (statusCode, data, responseOptions) {
  25474. if (typeof statusCode === 'undefined') {
  25475. throw new InvalidArgumentError('statusCode must be defined')
  25476. }
  25477. if (typeof data === 'undefined') {
  25478. throw new InvalidArgumentError('data must be defined')
  25479. }
  25480. if (typeof responseOptions !== 'object') {
  25481. throw new InvalidArgumentError('responseOptions must be an object')
  25482. }
  25483. }
  25484. /**
  25485. * Mock an undici request with a defined reply.
  25486. */
  25487. reply (replyData) {
  25488. // Values of reply aren't available right now as they
  25489. // can only be available when the reply callback is invoked.
  25490. if (typeof replyData === 'function') {
  25491. // We'll first wrap the provided callback in another function,
  25492. // this function will properly resolve the data from the callback
  25493. // when invoked.
  25494. const wrappedDefaultsCallback = (opts) => {
  25495. // Our reply options callback contains the parameter for statusCode, data and options.
  25496. const resolvedData = replyData(opts)
  25497. // Check if it is in the right format
  25498. if (typeof resolvedData !== 'object') {
  25499. throw new InvalidArgumentError('reply options callback must return an object')
  25500. }
  25501. const { statusCode, data = '', responseOptions = {} } = resolvedData
  25502. this.validateReplyParameters(statusCode, data, responseOptions)
  25503. // Since the values can be obtained immediately we return them
  25504. // from this higher order function that will be resolved later.
  25505. return {
  25506. ...this.createMockScopeDispatchData(statusCode, data, responseOptions)
  25507. }
  25508. }
  25509. // Add usual dispatch data, but this time set the data parameter to function that will eventually provide data.
  25510. const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], wrappedDefaultsCallback)
  25511. return new MockScope(newMockDispatch)
  25512. }
  25513. // We can have either one or three parameters, if we get here,
  25514. // we should have 1-3 parameters. So we spread the arguments of
  25515. // this function to obtain the parameters, since replyData will always
  25516. // just be the statusCode.
  25517. const [statusCode, data = '', responseOptions = {}] = [...arguments]
  25518. this.validateReplyParameters(statusCode, data, responseOptions)
  25519. // Send in-already provided data like usual
  25520. const dispatchData = this.createMockScopeDispatchData(statusCode, data, responseOptions)
  25521. const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], dispatchData)
  25522. return new MockScope(newMockDispatch)
  25523. }
  25524. /**
  25525. * Mock an undici request with a defined error.
  25526. */
  25527. replyWithError (error) {
  25528. if (typeof error === 'undefined') {
  25529. throw new InvalidArgumentError('error must be defined')
  25530. }
  25531. const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], { error })
  25532. return new MockScope(newMockDispatch)
  25533. }
  25534. /**
  25535. * Set default reply headers on the interceptor for subsequent replies
  25536. */
  25537. defaultReplyHeaders (headers) {
  25538. if (typeof headers === 'undefined') {
  25539. throw new InvalidArgumentError('headers must be defined')
  25540. }
  25541. this[kDefaultHeaders] = headers
  25542. return this
  25543. }
  25544. /**
  25545. * Set default reply trailers on the interceptor for subsequent replies
  25546. */
  25547. defaultReplyTrailers (trailers) {
  25548. if (typeof trailers === 'undefined') {
  25549. throw new InvalidArgumentError('trailers must be defined')
  25550. }
  25551. this[kDefaultTrailers] = trailers
  25552. return this
  25553. }
  25554. /**
  25555. * Set reply content length header for replies on the interceptor
  25556. */
  25557. replyContentLength () {
  25558. this[kContentLength] = true
  25559. return this
  25560. }
  25561. }
  25562. module.exports.MockInterceptor = MockInterceptor
  25563. module.exports.MockScope = MockScope
  25564. /***/ }),
  25565. /***/ 6193:
  25566. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  25567. const { promisify } = __nccwpck_require__(3837)
  25568. const Pool = __nccwpck_require__(4634)
  25569. const { buildMockDispatch } = __nccwpck_require__(9323)
  25570. const {
  25571. kDispatches,
  25572. kMockAgent,
  25573. kClose,
  25574. kOriginalClose,
  25575. kOrigin,
  25576. kOriginalDispatch,
  25577. kConnected
  25578. } = __nccwpck_require__(4347)
  25579. const { MockInterceptor } = __nccwpck_require__(410)
  25580. const Symbols = __nccwpck_require__(2785)
  25581. const { InvalidArgumentError } = __nccwpck_require__(8045)
  25582. /**
  25583. * MockPool provides an API that extends the Pool to influence the mockDispatches.
  25584. */
  25585. class MockPool extends Pool {
  25586. constructor (origin, opts) {
  25587. super(origin, opts)
  25588. if (!opts || !opts.agent || typeof opts.agent.dispatch !== 'function') {
  25589. throw new InvalidArgumentError('Argument opts.agent must implement Agent')
  25590. }
  25591. this[kMockAgent] = opts.agent
  25592. this[kOrigin] = origin
  25593. this[kDispatches] = []
  25594. this[kConnected] = 1
  25595. this[kOriginalDispatch] = this.dispatch
  25596. this[kOriginalClose] = this.close.bind(this)
  25597. this.dispatch = buildMockDispatch.call(this)
  25598. this.close = this[kClose]
  25599. }
  25600. get [Symbols.kConnected] () {
  25601. return this[kConnected]
  25602. }
  25603. /**
  25604. * Sets up the base interceptor for mocking replies from undici.
  25605. */
  25606. intercept (opts) {
  25607. return new MockInterceptor(opts, this[kDispatches])
  25608. }
  25609. async [kClose] () {
  25610. await promisify(this[kOriginalClose])()
  25611. this[kConnected] = 0
  25612. this[kMockAgent][Symbols.kClients].delete(this[kOrigin])
  25613. }
  25614. }
  25615. module.exports = MockPool
  25616. /***/ }),
  25617. /***/ 4347:
  25618. /***/ ((module) => {
  25619. module.exports = {
  25620. kAgent: Symbol('agent'),
  25621. kOptions: Symbol('options'),
  25622. kFactory: Symbol('factory'),
  25623. kDispatches: Symbol('dispatches'),
  25624. kDispatchKey: Symbol('dispatch key'),
  25625. kDefaultHeaders: Symbol('default headers'),
  25626. kDefaultTrailers: Symbol('default trailers'),
  25627. kContentLength: Symbol('content length'),
  25628. kMockAgent: Symbol('mock agent'),
  25629. kMockAgentSet: Symbol('mock agent set'),
  25630. kMockAgentGet: Symbol('mock agent get'),
  25631. kMockDispatch: Symbol('mock dispatch'),
  25632. kClose: Symbol('close'),
  25633. kOriginalClose: Symbol('original agent close'),
  25634. kOrigin: Symbol('origin'),
  25635. kIsMockActive: Symbol('is mock active'),
  25636. kNetConnect: Symbol('net connect'),
  25637. kGetNetConnect: Symbol('get net connect'),
  25638. kConnected: Symbol('connected')
  25639. }
  25640. /***/ }),
  25641. /***/ 9323:
  25642. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  25643. const { MockNotMatchedError } = __nccwpck_require__(888)
  25644. const {
  25645. kDispatches,
  25646. kMockAgent,
  25647. kOriginalDispatch,
  25648. kOrigin,
  25649. kGetNetConnect
  25650. } = __nccwpck_require__(4347)
  25651. const { buildURL, nop } = __nccwpck_require__(3983)
  25652. const { STATUS_CODES } = __nccwpck_require__(3685)
  25653. const {
  25654. types: {
  25655. isPromise
  25656. }
  25657. } = __nccwpck_require__(3837)
  25658. function matchValue (match, value) {
  25659. if (typeof match === 'string') {
  25660. return match === value
  25661. }
  25662. if (match instanceof RegExp) {
  25663. return match.test(value)
  25664. }
  25665. if (typeof match === 'function') {
  25666. return match(value) === true
  25667. }
  25668. return false
  25669. }
  25670. function lowerCaseEntries (headers) {
  25671. return Object.fromEntries(
  25672. Object.entries(headers).map(([headerName, headerValue]) => {
  25673. return [headerName.toLocaleLowerCase(), headerValue]
  25674. })
  25675. )
  25676. }
  25677. /**
  25678. * @param {import('../../index').Headers|string[]|Record<string, string>} headers
  25679. * @param {string} key
  25680. */
  25681. function getHeaderByName (headers, key) {
  25682. if (Array.isArray(headers)) {
  25683. for (let i = 0; i < headers.length; i += 2) {
  25684. if (headers[i].toLocaleLowerCase() === key.toLocaleLowerCase()) {
  25685. return headers[i + 1]
  25686. }
  25687. }
  25688. return undefined
  25689. } else if (typeof headers.get === 'function') {
  25690. return headers.get(key)
  25691. } else {
  25692. return lowerCaseEntries(headers)[key.toLocaleLowerCase()]
  25693. }
  25694. }
  25695. /** @param {string[]} headers */
  25696. function buildHeadersFromArray (headers) { // fetch HeadersList
  25697. const clone = headers.slice()
  25698. const entries = []
  25699. for (let index = 0; index < clone.length; index += 2) {
  25700. entries.push([clone[index], clone[index + 1]])
  25701. }
  25702. return Object.fromEntries(entries)
  25703. }
  25704. function matchHeaders (mockDispatch, headers) {
  25705. if (typeof mockDispatch.headers === 'function') {
  25706. if (Array.isArray(headers)) { // fetch HeadersList
  25707. headers = buildHeadersFromArray(headers)
  25708. }
  25709. return mockDispatch.headers(headers ? lowerCaseEntries(headers) : {})
  25710. }
  25711. if (typeof mockDispatch.headers === 'undefined') {
  25712. return true
  25713. }
  25714. if (typeof headers !== 'object' || typeof mockDispatch.headers !== 'object') {
  25715. return false
  25716. }
  25717. for (const [matchHeaderName, matchHeaderValue] of Object.entries(mockDispatch.headers)) {
  25718. const headerValue = getHeaderByName(headers, matchHeaderName)
  25719. if (!matchValue(matchHeaderValue, headerValue)) {
  25720. return false
  25721. }
  25722. }
  25723. return true
  25724. }
  25725. function safeUrl (path) {
  25726. if (typeof path !== 'string') {
  25727. return path
  25728. }
  25729. const pathSegments = path.split('?')
  25730. if (pathSegments.length !== 2) {
  25731. return path
  25732. }
  25733. const qp = new URLSearchParams(pathSegments.pop())
  25734. qp.sort()
  25735. return [...pathSegments, qp.toString()].join('?')
  25736. }
  25737. function matchKey (mockDispatch, { path, method, body, headers }) {
  25738. const pathMatch = matchValue(mockDispatch.path, path)
  25739. const methodMatch = matchValue(mockDispatch.method, method)
  25740. const bodyMatch = typeof mockDispatch.body !== 'undefined' ? matchValue(mockDispatch.body, body) : true
  25741. const headersMatch = matchHeaders(mockDispatch, headers)
  25742. return pathMatch && methodMatch && bodyMatch && headersMatch
  25743. }
  25744. function getResponseData (data) {
  25745. if (Buffer.isBuffer(data)) {
  25746. return data
  25747. } else if (typeof data === 'object') {
  25748. return JSON.stringify(data)
  25749. } else {
  25750. return data.toString()
  25751. }
  25752. }
  25753. function getMockDispatch (mockDispatches, key) {
  25754. const basePath = key.query ? buildURL(key.path, key.query) : key.path
  25755. const resolvedPath = typeof basePath === 'string' ? safeUrl(basePath) : basePath
  25756. // Match path
  25757. let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path }) => matchValue(safeUrl(path), resolvedPath))
  25758. if (matchedMockDispatches.length === 0) {
  25759. throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`)
  25760. }
  25761. // Match method
  25762. matchedMockDispatches = matchedMockDispatches.filter(({ method }) => matchValue(method, key.method))
  25763. if (matchedMockDispatches.length === 0) {
  25764. throw new MockNotMatchedError(`Mock dispatch not matched for method '${key.method}'`)
  25765. }
  25766. // Match body
  25767. matchedMockDispatches = matchedMockDispatches.filter(({ body }) => typeof body !== 'undefined' ? matchValue(body, key.body) : true)
  25768. if (matchedMockDispatches.length === 0) {
  25769. throw new MockNotMatchedError(`Mock dispatch not matched for body '${key.body}'`)
  25770. }
  25771. // Match headers
  25772. matchedMockDispatches = matchedMockDispatches.filter((mockDispatch) => matchHeaders(mockDispatch, key.headers))
  25773. if (matchedMockDispatches.length === 0) {
  25774. throw new MockNotMatchedError(`Mock dispatch not matched for headers '${typeof key.headers === 'object' ? JSON.stringify(key.headers) : key.headers}'`)
  25775. }
  25776. return matchedMockDispatches[0]
  25777. }
  25778. function addMockDispatch (mockDispatches, key, data) {
  25779. const baseData = { timesInvoked: 0, times: 1, persist: false, consumed: false }
  25780. const replyData = typeof data === 'function' ? { callback: data } : { ...data }
  25781. const newMockDispatch = { ...baseData, ...key, pending: true, data: { error: null, ...replyData } }
  25782. mockDispatches.push(newMockDispatch)
  25783. return newMockDispatch
  25784. }
  25785. function deleteMockDispatch (mockDispatches, key) {
  25786. const index = mockDispatches.findIndex(dispatch => {
  25787. if (!dispatch.consumed) {
  25788. return false
  25789. }
  25790. return matchKey(dispatch, key)
  25791. })
  25792. if (index !== -1) {
  25793. mockDispatches.splice(index, 1)
  25794. }
  25795. }
  25796. function buildKey (opts) {
  25797. const { path, method, body, headers, query } = opts
  25798. return {
  25799. path,
  25800. method,
  25801. body,
  25802. headers,
  25803. query
  25804. }
  25805. }
  25806. function generateKeyValues (data) {
  25807. return Object.entries(data).reduce((keyValuePairs, [key, value]) => [
  25808. ...keyValuePairs,
  25809. Buffer.from(`${key}`),
  25810. Array.isArray(value) ? value.map(x => Buffer.from(`${x}`)) : Buffer.from(`${value}`)
  25811. ], [])
  25812. }
  25813. /**
  25814. * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
  25815. * @param {number} statusCode
  25816. */
  25817. function getStatusText (statusCode) {
  25818. return STATUS_CODES[statusCode] || 'unknown'
  25819. }
  25820. async function getResponse (body) {
  25821. const buffers = []
  25822. for await (const data of body) {
  25823. buffers.push(data)
  25824. }
  25825. return Buffer.concat(buffers).toString('utf8')
  25826. }
  25827. /**
  25828. * Mock dispatch function used to simulate undici dispatches
  25829. */
  25830. function mockDispatch (opts, handler) {
  25831. // Get mock dispatch from built key
  25832. const key = buildKey(opts)
  25833. const mockDispatch = getMockDispatch(this[kDispatches], key)
  25834. mockDispatch.timesInvoked++
  25835. // Here's where we resolve a callback if a callback is present for the dispatch data.
  25836. if (mockDispatch.data.callback) {
  25837. mockDispatch.data = { ...mockDispatch.data, ...mockDispatch.data.callback(opts) }
  25838. }
  25839. // Parse mockDispatch data
  25840. const { data: { statusCode, data, headers, trailers, error }, delay, persist } = mockDispatch
  25841. const { timesInvoked, times } = mockDispatch
  25842. // If it's used up and not persistent, mark as consumed
  25843. mockDispatch.consumed = !persist && timesInvoked >= times
  25844. mockDispatch.pending = timesInvoked < times
  25845. // If specified, trigger dispatch error
  25846. if (error !== null) {
  25847. deleteMockDispatch(this[kDispatches], key)
  25848. handler.onError(error)
  25849. return true
  25850. }
  25851. // Handle the request with a delay if necessary
  25852. if (typeof delay === 'number' && delay > 0) {
  25853. setTimeout(() => {
  25854. handleReply(this[kDispatches])
  25855. }, delay)
  25856. } else {
  25857. handleReply(this[kDispatches])
  25858. }
  25859. function handleReply (mockDispatches, _data = data) {
  25860. // fetch's HeadersList is a 1D string array
  25861. const optsHeaders = Array.isArray(opts.headers)
  25862. ? buildHeadersFromArray(opts.headers)
  25863. : opts.headers
  25864. const body = typeof _data === 'function'
  25865. ? _data({ ...opts, headers: optsHeaders })
  25866. : _data
  25867. // util.types.isPromise is likely needed for jest.
  25868. if (isPromise(body)) {
  25869. // If handleReply is asynchronous, throwing an error
  25870. // in the callback will reject the promise, rather than
  25871. // synchronously throw the error, which breaks some tests.
  25872. // Rather, we wait for the callback to resolve if it is a
  25873. // promise, and then re-run handleReply with the new body.
  25874. body.then((newData) => handleReply(mockDispatches, newData))
  25875. return
  25876. }
  25877. const responseData = getResponseData(body)
  25878. const responseHeaders = generateKeyValues(headers)
  25879. const responseTrailers = generateKeyValues(trailers)
  25880. handler.abort = nop
  25881. handler.onHeaders(statusCode, responseHeaders, resume, getStatusText(statusCode))
  25882. handler.onData(Buffer.from(responseData))
  25883. handler.onComplete(responseTrailers)
  25884. deleteMockDispatch(mockDispatches, key)
  25885. }
  25886. function resume () {}
  25887. return true
  25888. }
  25889. function buildMockDispatch () {
  25890. const agent = this[kMockAgent]
  25891. const origin = this[kOrigin]
  25892. const originalDispatch = this[kOriginalDispatch]
  25893. return function dispatch (opts, handler) {
  25894. if (agent.isMockActive) {
  25895. try {
  25896. mockDispatch.call(this, opts, handler)
  25897. } catch (error) {
  25898. if (error instanceof MockNotMatchedError) {
  25899. const netConnect = agent[kGetNetConnect]()
  25900. if (netConnect === false) {
  25901. throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin} was not allowed (net.connect disabled)`)
  25902. }
  25903. if (checkNetConnect(netConnect, origin)) {
  25904. originalDispatch.call(this, opts, handler)
  25905. } else {
  25906. throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin} was not allowed (net.connect is not enabled for this origin)`)
  25907. }
  25908. } else {
  25909. throw error
  25910. }
  25911. }
  25912. } else {
  25913. originalDispatch.call(this, opts, handler)
  25914. }
  25915. }
  25916. }
  25917. function checkNetConnect (netConnect, origin) {
  25918. const url = new URL(origin)
  25919. if (netConnect === true) {
  25920. return true
  25921. } else if (Array.isArray(netConnect) && netConnect.some((matcher) => matchValue(matcher, url.host))) {
  25922. return true
  25923. }
  25924. return false
  25925. }
  25926. function buildMockOptions (opts) {
  25927. if (opts) {
  25928. const { agent, ...mockOptions } = opts
  25929. return mockOptions
  25930. }
  25931. }
  25932. module.exports = {
  25933. getResponseData,
  25934. getMockDispatch,
  25935. addMockDispatch,
  25936. deleteMockDispatch,
  25937. buildKey,
  25938. generateKeyValues,
  25939. matchValue,
  25940. getResponse,
  25941. getStatusText,
  25942. mockDispatch,
  25943. buildMockDispatch,
  25944. checkNetConnect,
  25945. buildMockOptions,
  25946. getHeaderByName
  25947. }
  25948. /***/ }),
  25949. /***/ 6823:
  25950. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  25951. const { Transform } = __nccwpck_require__(2781)
  25952. const { Console } = __nccwpck_require__(6206)
  25953. /**
  25954. * Gets the output of `console.table(…)` as a string.
  25955. */
  25956. module.exports = class PendingInterceptorsFormatter {
  25957. constructor ({ disableColors } = {}) {
  25958. this.transform = new Transform({
  25959. transform (chunk, _enc, cb) {
  25960. cb(null, chunk)
  25961. }
  25962. })
  25963. this.logger = new Console({
  25964. stdout: this.transform,
  25965. inspectOptions: {
  25966. colors: !disableColors && !process.env.CI
  25967. }
  25968. })
  25969. }
  25970. format (pendingInterceptors) {
  25971. const withPrettyHeaders = pendingInterceptors.map(
  25972. ({ method, path, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
  25973. Method: method,
  25974. Origin: origin,
  25975. Path: path,
  25976. 'Status code': statusCode,
  25977. Persistent: persist ? '✅' : '❌',
  25978. Invocations: timesInvoked,
  25979. Remaining: persist ? Infinity : times - timesInvoked
  25980. }))
  25981. this.logger.table(withPrettyHeaders)
  25982. return this.transform.read().toString()
  25983. }
  25984. }
  25985. /***/ }),
  25986. /***/ 8891:
  25987. /***/ ((module) => {
  25988. const singulars = {
  25989. pronoun: 'it',
  25990. is: 'is',
  25991. was: 'was',
  25992. this: 'this'
  25993. }
  25994. const plurals = {
  25995. pronoun: 'they',
  25996. is: 'are',
  25997. was: 'were',
  25998. this: 'these'
  25999. }
  26000. module.exports = class Pluralizer {
  26001. constructor (singular, plural) {
  26002. this.singular = singular
  26003. this.plural = plural
  26004. }
  26005. pluralize (count) {
  26006. const one = count === 1
  26007. const keys = one ? singulars : plurals
  26008. const noun = one ? this.singular : this.plural
  26009. return { ...keys, count, noun }
  26010. }
  26011. }
  26012. /***/ }),
  26013. /***/ 8266:
  26014. /***/ ((module) => {
  26015. /* eslint-disable */
  26016. // Extracted from node/lib/internal/fixed_queue.js
  26017. // Currently optimal queue size, tested on V8 6.0 - 6.6. Must be power of two.
  26018. const kSize = 2048;
  26019. const kMask = kSize - 1;
  26020. // The FixedQueue is implemented as a singly-linked list of fixed-size
  26021. // circular buffers. It looks something like this:
  26022. //
  26023. // head tail
  26024. // | |
  26025. // v v
  26026. // +-----------+ <-----\ +-----------+ <------\ +-----------+
  26027. // | [null] | \----- | next | \------- | next |
  26028. // +-----------+ +-----------+ +-----------+
  26029. // | item | <-- bottom | item | <-- bottom | [empty] |
  26030. // | item | | item | | [empty] |
  26031. // | item | | item | | [empty] |
  26032. // | item | | item | | [empty] |
  26033. // | item | | item | bottom --> | item |
  26034. // | item | | item | | item |
  26035. // | ... | | ... | | ... |
  26036. // | item | | item | | item |
  26037. // | item | | item | | item |
  26038. // | [empty] | <-- top | item | | item |
  26039. // | [empty] | | item | | item |
  26040. // | [empty] | | [empty] | <-- top top --> | [empty] |
  26041. // +-----------+ +-----------+ +-----------+
  26042. //
  26043. // Or, if there is only one circular buffer, it looks something
  26044. // like either of these:
  26045. //
  26046. // head tail head tail
  26047. // | | | |
  26048. // v v v v
  26049. // +-----------+ +-----------+
  26050. // | [null] | | [null] |
  26051. // +-----------+ +-----------+
  26052. // | [empty] | | item |
  26053. // | [empty] | | item |
  26054. // | item | <-- bottom top --> | [empty] |
  26055. // | item | | [empty] |
  26056. // | [empty] | <-- top bottom --> | item |
  26057. // | [empty] | | item |
  26058. // +-----------+ +-----------+
  26059. //
  26060. // Adding a value means moving `top` forward by one, removing means
  26061. // moving `bottom` forward by one. After reaching the end, the queue
  26062. // wraps around.
  26063. //
  26064. // When `top === bottom` the current queue is empty and when
  26065. // `top + 1 === bottom` it's full. This wastes a single space of storage
  26066. // but allows much quicker checks.
  26067. class FixedCircularBuffer {
  26068. constructor() {
  26069. this.bottom = 0;
  26070. this.top = 0;
  26071. this.list = new Array(kSize);
  26072. this.next = null;
  26073. }
  26074. isEmpty() {
  26075. return this.top === this.bottom;
  26076. }
  26077. isFull() {
  26078. return ((this.top + 1) & kMask) === this.bottom;
  26079. }
  26080. push(data) {
  26081. this.list[this.top] = data;
  26082. this.top = (this.top + 1) & kMask;
  26083. }
  26084. shift() {
  26085. const nextItem = this.list[this.bottom];
  26086. if (nextItem === undefined)
  26087. return null;
  26088. this.list[this.bottom] = undefined;
  26089. this.bottom = (this.bottom + 1) & kMask;
  26090. return nextItem;
  26091. }
  26092. }
  26093. module.exports = class FixedQueue {
  26094. constructor() {
  26095. this.head = this.tail = new FixedCircularBuffer();
  26096. }
  26097. isEmpty() {
  26098. return this.head.isEmpty();
  26099. }
  26100. push(data) {
  26101. if (this.head.isFull()) {
  26102. // Head is full: Creates a new queue, sets the old queue's `.next` to it,
  26103. // and sets it as the new main queue.
  26104. this.head = this.head.next = new FixedCircularBuffer();
  26105. }
  26106. this.head.push(data);
  26107. }
  26108. shift() {
  26109. const tail = this.tail;
  26110. const next = tail.shift();
  26111. if (tail.isEmpty() && tail.next !== null) {
  26112. // If there is another queue, it forms the new tail.
  26113. this.tail = tail.next;
  26114. }
  26115. return next;
  26116. }
  26117. };
  26118. /***/ }),
  26119. /***/ 3198:
  26120. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  26121. const DispatcherBase = __nccwpck_require__(4839)
  26122. const FixedQueue = __nccwpck_require__(8266)
  26123. const { kConnected, kSize, kRunning, kPending, kQueued, kBusy, kFree, kUrl, kClose, kDestroy, kDispatch } = __nccwpck_require__(2785)
  26124. const PoolStats = __nccwpck_require__(9689)
  26125. const kClients = Symbol('clients')
  26126. const kNeedDrain = Symbol('needDrain')
  26127. const kQueue = Symbol('queue')
  26128. const kClosedResolve = Symbol('closed resolve')
  26129. const kOnDrain = Symbol('onDrain')
  26130. const kOnConnect = Symbol('onConnect')
  26131. const kOnDisconnect = Symbol('onDisconnect')
  26132. const kOnConnectionError = Symbol('onConnectionError')
  26133. const kGetDispatcher = Symbol('get dispatcher')
  26134. const kAddClient = Symbol('add client')
  26135. const kRemoveClient = Symbol('remove client')
  26136. const kStats = Symbol('stats')
  26137. class PoolBase extends DispatcherBase {
  26138. constructor () {
  26139. super()
  26140. this[kQueue] = new FixedQueue()
  26141. this[kClients] = []
  26142. this[kQueued] = 0
  26143. const pool = this
  26144. this[kOnDrain] = function onDrain (origin, targets) {
  26145. const queue = pool[kQueue]
  26146. let needDrain = false
  26147. while (!needDrain) {
  26148. const item = queue.shift()
  26149. if (!item) {
  26150. break
  26151. }
  26152. pool[kQueued]--
  26153. needDrain = !this.dispatch(item.opts, item.handler)
  26154. }
  26155. this[kNeedDrain] = needDrain
  26156. if (!this[kNeedDrain] && pool[kNeedDrain]) {
  26157. pool[kNeedDrain] = false
  26158. pool.emit('drain', origin, [pool, ...targets])
  26159. }
  26160. if (pool[kClosedResolve] && queue.isEmpty()) {
  26161. Promise
  26162. .all(pool[kClients].map(c => c.close()))
  26163. .then(pool[kClosedResolve])
  26164. }
  26165. }
  26166. this[kOnConnect] = (origin, targets) => {
  26167. pool.emit('connect', origin, [pool, ...targets])
  26168. }
  26169. this[kOnDisconnect] = (origin, targets, err) => {
  26170. pool.emit('disconnect', origin, [pool, ...targets], err)
  26171. }
  26172. this[kOnConnectionError] = (origin, targets, err) => {
  26173. pool.emit('connectionError', origin, [pool, ...targets], err)
  26174. }
  26175. this[kStats] = new PoolStats(this)
  26176. }
  26177. get [kBusy] () {
  26178. return this[kNeedDrain]
  26179. }
  26180. get [kConnected] () {
  26181. return this[kClients].filter(client => client[kConnected]).length
  26182. }
  26183. get [kFree] () {
  26184. return this[kClients].filter(client => client[kConnected] && !client[kNeedDrain]).length
  26185. }
  26186. get [kPending] () {
  26187. let ret = this[kQueued]
  26188. for (const { [kPending]: pending } of this[kClients]) {
  26189. ret += pending
  26190. }
  26191. return ret
  26192. }
  26193. get [kRunning] () {
  26194. let ret = 0
  26195. for (const { [kRunning]: running } of this[kClients]) {
  26196. ret += running
  26197. }
  26198. return ret
  26199. }
  26200. get [kSize] () {
  26201. let ret = this[kQueued]
  26202. for (const { [kSize]: size } of this[kClients]) {
  26203. ret += size
  26204. }
  26205. return ret
  26206. }
  26207. get stats () {
  26208. return this[kStats]
  26209. }
  26210. async [kClose] () {
  26211. if (this[kQueue].isEmpty()) {
  26212. return Promise.all(this[kClients].map(c => c.close()))
  26213. } else {
  26214. return new Promise((resolve) => {
  26215. this[kClosedResolve] = resolve
  26216. })
  26217. }
  26218. }
  26219. async [kDestroy] (err) {
  26220. while (true) {
  26221. const item = this[kQueue].shift()
  26222. if (!item) {
  26223. break
  26224. }
  26225. item.handler.onError(err)
  26226. }
  26227. return Promise.all(this[kClients].map(c => c.destroy(err)))
  26228. }
  26229. [kDispatch] (opts, handler) {
  26230. const dispatcher = this[kGetDispatcher]()
  26231. if (!dispatcher) {
  26232. this[kNeedDrain] = true
  26233. this[kQueue].push({ opts, handler })
  26234. this[kQueued]++
  26235. } else if (!dispatcher.dispatch(opts, handler)) {
  26236. dispatcher[kNeedDrain] = true
  26237. this[kNeedDrain] = !this[kGetDispatcher]()
  26238. }
  26239. return !this[kNeedDrain]
  26240. }
  26241. [kAddClient] (client) {
  26242. client
  26243. .on('drain', this[kOnDrain])
  26244. .on('connect', this[kOnConnect])
  26245. .on('disconnect', this[kOnDisconnect])
  26246. .on('connectionError', this[kOnConnectionError])
  26247. this[kClients].push(client)
  26248. if (this[kNeedDrain]) {
  26249. process.nextTick(() => {
  26250. if (this[kNeedDrain]) {
  26251. this[kOnDrain](client[kUrl], [this, client])
  26252. }
  26253. })
  26254. }
  26255. return this
  26256. }
  26257. [kRemoveClient] (client) {
  26258. client.close(() => {
  26259. const idx = this[kClients].indexOf(client)
  26260. if (idx !== -1) {
  26261. this[kClients].splice(idx, 1)
  26262. }
  26263. })
  26264. this[kNeedDrain] = this[kClients].some(dispatcher => (
  26265. !dispatcher[kNeedDrain] &&
  26266. dispatcher.closed !== true &&
  26267. dispatcher.destroyed !== true
  26268. ))
  26269. }
  26270. }
  26271. module.exports = {
  26272. PoolBase,
  26273. kClients,
  26274. kNeedDrain,
  26275. kAddClient,
  26276. kRemoveClient,
  26277. kGetDispatcher
  26278. }
  26279. /***/ }),
  26280. /***/ 9689:
  26281. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  26282. const { kFree, kConnected, kPending, kQueued, kRunning, kSize } = __nccwpck_require__(2785)
  26283. const kPool = Symbol('pool')
  26284. class PoolStats {
  26285. constructor (pool) {
  26286. this[kPool] = pool
  26287. }
  26288. get connected () {
  26289. return this[kPool][kConnected]
  26290. }
  26291. get free () {
  26292. return this[kPool][kFree]
  26293. }
  26294. get pending () {
  26295. return this[kPool][kPending]
  26296. }
  26297. get queued () {
  26298. return this[kPool][kQueued]
  26299. }
  26300. get running () {
  26301. return this[kPool][kRunning]
  26302. }
  26303. get size () {
  26304. return this[kPool][kSize]
  26305. }
  26306. }
  26307. module.exports = PoolStats
  26308. /***/ }),
  26309. /***/ 4634:
  26310. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  26311. const {
  26312. PoolBase,
  26313. kClients,
  26314. kNeedDrain,
  26315. kAddClient,
  26316. kGetDispatcher
  26317. } = __nccwpck_require__(3198)
  26318. const Client = __nccwpck_require__(3598)
  26319. const {
  26320. InvalidArgumentError
  26321. } = __nccwpck_require__(8045)
  26322. const util = __nccwpck_require__(3983)
  26323. const { kUrl, kInterceptors } = __nccwpck_require__(2785)
  26324. const buildConnector = __nccwpck_require__(2067)
  26325. const kOptions = Symbol('options')
  26326. const kConnections = Symbol('connections')
  26327. const kFactory = Symbol('factory')
  26328. function defaultFactory (origin, opts) {
  26329. return new Client(origin, opts)
  26330. }
  26331. class Pool extends PoolBase {
  26332. constructor (origin, {
  26333. connections,
  26334. factory = defaultFactory,
  26335. connect,
  26336. connectTimeout,
  26337. tls,
  26338. maxCachedSessions,
  26339. socketPath,
  26340. autoSelectFamily,
  26341. autoSelectFamilyAttemptTimeout,
  26342. allowH2,
  26343. ...options
  26344. } = {}) {
  26345. super()
  26346. if (connections != null && (!Number.isFinite(connections) || connections < 0)) {
  26347. throw new InvalidArgumentError('invalid connections')
  26348. }
  26349. if (typeof factory !== 'function') {
  26350. throw new InvalidArgumentError('factory must be a function.')
  26351. }
  26352. if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') {
  26353. throw new InvalidArgumentError('connect must be a function or an object')
  26354. }
  26355. if (typeof connect !== 'function') {
  26356. connect = buildConnector({
  26357. ...tls,
  26358. maxCachedSessions,
  26359. allowH2,
  26360. socketPath,
  26361. timeout: connectTimeout,
  26362. ...(util.nodeHasAutoSelectFamily && autoSelectFamily ? { autoSelectFamily, autoSelectFamilyAttemptTimeout } : undefined),
  26363. ...connect
  26364. })
  26365. }
  26366. this[kInterceptors] = options.interceptors && options.interceptors.Pool && Array.isArray(options.interceptors.Pool)
  26367. ? options.interceptors.Pool
  26368. : []
  26369. this[kConnections] = connections || null
  26370. this[kUrl] = util.parseOrigin(origin)
  26371. this[kOptions] = { ...util.deepClone(options), connect, allowH2 }
  26372. this[kOptions].interceptors = options.interceptors
  26373. ? { ...options.interceptors }
  26374. : undefined
  26375. this[kFactory] = factory
  26376. this.on('connectionError', (origin, targets, error) => {
  26377. // If a connection error occurs, we remove the client from the pool,
  26378. // and emit a connectionError event. They will not be re-used.
  26379. // Fixes https://github.com/nodejs/undici/issues/3895
  26380. for (const target of targets) {
  26381. // Do not use kRemoveClient here, as it will close the client,
  26382. // but the client cannot be closed in this state.
  26383. const idx = this[kClients].indexOf(target)
  26384. if (idx !== -1) {
  26385. this[kClients].splice(idx, 1)
  26386. }
  26387. }
  26388. })
  26389. }
  26390. [kGetDispatcher] () {
  26391. let dispatcher = this[kClients].find(dispatcher => !dispatcher[kNeedDrain])
  26392. if (dispatcher) {
  26393. return dispatcher
  26394. }
  26395. if (!this[kConnections] || this[kClients].length < this[kConnections]) {
  26396. dispatcher = this[kFactory](this[kUrl], this[kOptions])
  26397. this[kAddClient](dispatcher)
  26398. }
  26399. return dispatcher
  26400. }
  26401. }
  26402. module.exports = Pool
  26403. /***/ }),
  26404. /***/ 7858:
  26405. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  26406. const { kProxy, kClose, kDestroy, kInterceptors } = __nccwpck_require__(2785)
  26407. const { URL } = __nccwpck_require__(7310)
  26408. const Agent = __nccwpck_require__(7890)
  26409. const Pool = __nccwpck_require__(4634)
  26410. const DispatcherBase = __nccwpck_require__(4839)
  26411. const { InvalidArgumentError, RequestAbortedError } = __nccwpck_require__(8045)
  26412. const buildConnector = __nccwpck_require__(2067)
  26413. const kAgent = Symbol('proxy agent')
  26414. const kClient = Symbol('proxy client')
  26415. const kProxyHeaders = Symbol('proxy headers')
  26416. const kRequestTls = Symbol('request tls settings')
  26417. const kProxyTls = Symbol('proxy tls settings')
  26418. const kConnectEndpoint = Symbol('connect endpoint function')
  26419. function defaultProtocolPort (protocol) {
  26420. return protocol === 'https:' ? 443 : 80
  26421. }
  26422. function buildProxyOptions (opts) {
  26423. if (typeof opts === 'string') {
  26424. opts = { uri: opts }
  26425. }
  26426. if (!opts || !opts.uri) {
  26427. throw new InvalidArgumentError('Proxy opts.uri is mandatory')
  26428. }
  26429. return {
  26430. uri: opts.uri,
  26431. protocol: opts.protocol || 'https'
  26432. }
  26433. }
  26434. function defaultFactory (origin, opts) {
  26435. return new Pool(origin, opts)
  26436. }
  26437. class ProxyAgent extends DispatcherBase {
  26438. constructor (opts) {
  26439. super(opts)
  26440. this[kProxy] = buildProxyOptions(opts)
  26441. this[kAgent] = new Agent(opts)
  26442. this[kInterceptors] = opts.interceptors && opts.interceptors.ProxyAgent && Array.isArray(opts.interceptors.ProxyAgent)
  26443. ? opts.interceptors.ProxyAgent
  26444. : []
  26445. if (typeof opts === 'string') {
  26446. opts = { uri: opts }
  26447. }
  26448. if (!opts || !opts.uri) {
  26449. throw new InvalidArgumentError('Proxy opts.uri is mandatory')
  26450. }
  26451. const { clientFactory = defaultFactory } = opts
  26452. if (typeof clientFactory !== 'function') {
  26453. throw new InvalidArgumentError('Proxy opts.clientFactory must be a function.')
  26454. }
  26455. this[kRequestTls] = opts.requestTls
  26456. this[kProxyTls] = opts.proxyTls
  26457. this[kProxyHeaders] = opts.headers || {}
  26458. const resolvedUrl = new URL(opts.uri)
  26459. const { origin, port, host, username, password } = resolvedUrl
  26460. if (opts.auth && opts.token) {
  26461. throw new InvalidArgumentError('opts.auth cannot be used in combination with opts.token')
  26462. } else if (opts.auth) {
  26463. /* @deprecated in favour of opts.token */
  26464. this[kProxyHeaders]['proxy-authorization'] = `Basic ${opts.auth}`
  26465. } else if (opts.token) {
  26466. this[kProxyHeaders]['proxy-authorization'] = opts.token
  26467. } else if (username && password) {
  26468. this[kProxyHeaders]['proxy-authorization'] = `Basic ${Buffer.from(`${decodeURIComponent(username)}:${decodeURIComponent(password)}`).toString('base64')}`
  26469. }
  26470. const connect = buildConnector({ ...opts.proxyTls })
  26471. this[kConnectEndpoint] = buildConnector({ ...opts.requestTls })
  26472. this[kClient] = clientFactory(resolvedUrl, { connect })
  26473. this[kAgent] = new Agent({
  26474. ...opts,
  26475. connect: async (opts, callback) => {
  26476. let requestedHost = opts.host
  26477. if (!opts.port) {
  26478. requestedHost += `:${defaultProtocolPort(opts.protocol)}`
  26479. }
  26480. try {
  26481. const { socket, statusCode } = await this[kClient].connect({
  26482. origin,
  26483. port,
  26484. path: requestedHost,
  26485. signal: opts.signal,
  26486. headers: {
  26487. ...this[kProxyHeaders],
  26488. host
  26489. }
  26490. })
  26491. if (statusCode !== 200) {
  26492. socket.on('error', () => {}).destroy()
  26493. callback(new RequestAbortedError(`Proxy response (${statusCode}) !== 200 when HTTP Tunneling`))
  26494. }
  26495. if (opts.protocol !== 'https:') {
  26496. callback(null, socket)
  26497. return
  26498. }
  26499. let servername
  26500. if (this[kRequestTls]) {
  26501. servername = this[kRequestTls].servername
  26502. } else {
  26503. servername = opts.servername
  26504. }
  26505. this[kConnectEndpoint]({ ...opts, servername, httpSocket: socket }, callback)
  26506. } catch (err) {
  26507. callback(err)
  26508. }
  26509. }
  26510. })
  26511. }
  26512. dispatch (opts, handler) {
  26513. const { host } = new URL(opts.origin)
  26514. const headers = buildHeaders(opts.headers)
  26515. throwIfProxyAuthIsSent(headers)
  26516. return this[kAgent].dispatch(
  26517. {
  26518. ...opts,
  26519. headers: {
  26520. ...headers,
  26521. host
  26522. }
  26523. },
  26524. handler
  26525. )
  26526. }
  26527. async [kClose] () {
  26528. await this[kAgent].close()
  26529. await this[kClient].close()
  26530. }
  26531. async [kDestroy] () {
  26532. await this[kAgent].destroy()
  26533. await this[kClient].destroy()
  26534. }
  26535. }
  26536. /**
  26537. * @param {string[] | Record<string, string>} headers
  26538. * @returns {Record<string, string>}
  26539. */
  26540. function buildHeaders (headers) {
  26541. // When using undici.fetch, the headers list is stored
  26542. // as an array.
  26543. if (Array.isArray(headers)) {
  26544. /** @type {Record<string, string>} */
  26545. const headersPair = {}
  26546. for (let i = 0; i < headers.length; i += 2) {
  26547. headersPair[headers[i]] = headers[i + 1]
  26548. }
  26549. return headersPair
  26550. }
  26551. return headers
  26552. }
  26553. /**
  26554. * @param {Record<string, string>} headers
  26555. *
  26556. * Previous versions of ProxyAgent suggests the Proxy-Authorization in request headers
  26557. * Nevertheless, it was changed and to avoid a security vulnerability by end users
  26558. * this check was created.
  26559. * It should be removed in the next major version for performance reasons
  26560. */
  26561. function throwIfProxyAuthIsSent (headers) {
  26562. const existProxyAuth = headers && Object.keys(headers)
  26563. .find((key) => key.toLowerCase() === 'proxy-authorization')
  26564. if (existProxyAuth) {
  26565. throw new InvalidArgumentError('Proxy-Authorization should be sent in ProxyAgent constructor')
  26566. }
  26567. }
  26568. module.exports = ProxyAgent
  26569. /***/ }),
  26570. /***/ 9459:
  26571. /***/ ((module) => {
  26572. let fastNow = Date.now()
  26573. let fastNowTimeout
  26574. const fastTimers = []
  26575. function onTimeout () {
  26576. fastNow = Date.now()
  26577. let len = fastTimers.length
  26578. let idx = 0
  26579. while (idx < len) {
  26580. const timer = fastTimers[idx]
  26581. if (timer.state === 0) {
  26582. timer.state = fastNow + timer.delay
  26583. } else if (timer.state > 0 && fastNow >= timer.state) {
  26584. timer.state = -1
  26585. timer.callback(timer.opaque)
  26586. }
  26587. if (timer.state === -1) {
  26588. timer.state = -2
  26589. if (idx !== len - 1) {
  26590. fastTimers[idx] = fastTimers.pop()
  26591. } else {
  26592. fastTimers.pop()
  26593. }
  26594. len -= 1
  26595. } else {
  26596. idx += 1
  26597. }
  26598. }
  26599. if (fastTimers.length > 0) {
  26600. refreshTimeout()
  26601. }
  26602. }
  26603. function refreshTimeout () {
  26604. if (fastNowTimeout && fastNowTimeout.refresh) {
  26605. fastNowTimeout.refresh()
  26606. } else {
  26607. clearTimeout(fastNowTimeout)
  26608. fastNowTimeout = setTimeout(onTimeout, 1e3)
  26609. if (fastNowTimeout.unref) {
  26610. fastNowTimeout.unref()
  26611. }
  26612. }
  26613. }
  26614. class Timeout {
  26615. constructor (callback, delay, opaque) {
  26616. this.callback = callback
  26617. this.delay = delay
  26618. this.opaque = opaque
  26619. // -2 not in timer list
  26620. // -1 in timer list but inactive
  26621. // 0 in timer list waiting for time
  26622. // > 0 in timer list waiting for time to expire
  26623. this.state = -2
  26624. this.refresh()
  26625. }
  26626. refresh () {
  26627. if (this.state === -2) {
  26628. fastTimers.push(this)
  26629. if (!fastNowTimeout || fastTimers.length === 1) {
  26630. refreshTimeout()
  26631. }
  26632. }
  26633. this.state = 0
  26634. }
  26635. clear () {
  26636. this.state = -1
  26637. }
  26638. }
  26639. module.exports = {
  26640. setTimeout (callback, delay, opaque) {
  26641. return delay < 1e3
  26642. ? setTimeout(callback, delay, opaque)
  26643. : new Timeout(callback, delay, opaque)
  26644. },
  26645. clearTimeout (timeout) {
  26646. if (timeout instanceof Timeout) {
  26647. timeout.clear()
  26648. } else {
  26649. clearTimeout(timeout)
  26650. }
  26651. }
  26652. }
  26653. /***/ }),
  26654. /***/ 5354:
  26655. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  26656. const diagnosticsChannel = __nccwpck_require__(7643)
  26657. const { uid, states } = __nccwpck_require__(9188)
  26658. const {
  26659. kReadyState,
  26660. kSentClose,
  26661. kByteParser,
  26662. kReceivedClose
  26663. } = __nccwpck_require__(7578)
  26664. const { fireEvent, failWebsocketConnection } = __nccwpck_require__(5515)
  26665. const { CloseEvent } = __nccwpck_require__(2611)
  26666. const { makeRequest } = __nccwpck_require__(8359)
  26667. const { fetching } = __nccwpck_require__(4881)
  26668. const { Headers } = __nccwpck_require__(554)
  26669. const { getGlobalDispatcher } = __nccwpck_require__(1892)
  26670. const { kHeadersList } = __nccwpck_require__(2785)
  26671. const channels = {}
  26672. channels.open = diagnosticsChannel.channel('undici:websocket:open')
  26673. channels.close = diagnosticsChannel.channel('undici:websocket:close')
  26674. channels.socketError = diagnosticsChannel.channel('undici:websocket:socket_error')
  26675. /** @type {import('crypto')} */
  26676. let crypto
  26677. try {
  26678. crypto = __nccwpck_require__(6113)
  26679. } catch {
  26680. }
  26681. /**
  26682. * @see https://websockets.spec.whatwg.org/#concept-websocket-establish
  26683. * @param {URL} url
  26684. * @param {string|string[]} protocols
  26685. * @param {import('./websocket').WebSocket} ws
  26686. * @param {(response: any) => void} onEstablish
  26687. * @param {Partial<import('../../types/websocket').WebSocketInit>} options
  26688. */
  26689. function establishWebSocketConnection (url, protocols, ws, onEstablish, options) {
  26690. // 1. Let requestURL be a copy of url, with its scheme set to "http", if url’s
  26691. // scheme is "ws", and to "https" otherwise.
  26692. const requestURL = url
  26693. requestURL.protocol = url.protocol === 'ws:' ? 'http:' : 'https:'
  26694. // 2. Let request be a new request, whose URL is requestURL, client is client,
  26695. // service-workers mode is "none", referrer is "no-referrer", mode is
  26696. // "websocket", credentials mode is "include", cache mode is "no-store" ,
  26697. // and redirect mode is "error".
  26698. const request = makeRequest({
  26699. urlList: [requestURL],
  26700. serviceWorkers: 'none',
  26701. referrer: 'no-referrer',
  26702. mode: 'websocket',
  26703. credentials: 'include',
  26704. cache: 'no-store',
  26705. redirect: 'error'
  26706. })
  26707. // Note: undici extension, allow setting custom headers.
  26708. if (options.headers) {
  26709. const headersList = new Headers(options.headers)[kHeadersList]
  26710. request.headersList = headersList
  26711. }
  26712. // 3. Append (`Upgrade`, `websocket`) to request’s header list.
  26713. // 4. Append (`Connection`, `Upgrade`) to request’s header list.
  26714. // Note: both of these are handled by undici currently.
  26715. // https://github.com/nodejs/undici/blob/68c269c4144c446f3f1220951338daef4a6b5ec4/lib/client.js#L1397
  26716. // 5. Let keyValue be a nonce consisting of a randomly selected
  26717. // 16-byte value that has been forgiving-base64-encoded and
  26718. // isomorphic encoded.
  26719. const keyValue = crypto.randomBytes(16).toString('base64')
  26720. // 6. Append (`Sec-WebSocket-Key`, keyValue) to request’s
  26721. // header list.
  26722. request.headersList.append('sec-websocket-key', keyValue)
  26723. // 7. Append (`Sec-WebSocket-Version`, `13`) to request’s
  26724. // header list.
  26725. request.headersList.append('sec-websocket-version', '13')
  26726. // 8. For each protocol in protocols, combine
  26727. // (`Sec-WebSocket-Protocol`, protocol) in request’s header
  26728. // list.
  26729. for (const protocol of protocols) {
  26730. request.headersList.append('sec-websocket-protocol', protocol)
  26731. }
  26732. // 9. Let permessageDeflate be a user-agent defined
  26733. // "permessage-deflate" extension header value.
  26734. // https://github.com/mozilla/gecko-dev/blob/ce78234f5e653a5d3916813ff990f053510227bc/netwerk/protocol/websocket/WebSocketChannel.cpp#L2673
  26735. // TODO: enable once permessage-deflate is supported
  26736. const permessageDeflate = '' // 'permessage-deflate; 15'
  26737. // 10. Append (`Sec-WebSocket-Extensions`, permessageDeflate) to
  26738. // request’s header list.
  26739. // request.headersList.append('sec-websocket-extensions', permessageDeflate)
  26740. // 11. Fetch request with useParallelQueue set to true, and
  26741. // processResponse given response being these steps:
  26742. const controller = fetching({
  26743. request,
  26744. useParallelQueue: true,
  26745. dispatcher: options.dispatcher ?? getGlobalDispatcher(),
  26746. processResponse (response) {
  26747. // 1. If response is a network error or its status is not 101,
  26748. // fail the WebSocket connection.
  26749. if (response.type === 'error' || response.status !== 101) {
  26750. failWebsocketConnection(ws, 'Received network error or non-101 status code.')
  26751. return
  26752. }
  26753. // 2. If protocols is not the empty list and extracting header
  26754. // list values given `Sec-WebSocket-Protocol` and response’s
  26755. // header list results in null, failure, or the empty byte
  26756. // sequence, then fail the WebSocket connection.
  26757. if (protocols.length !== 0 && !response.headersList.get('Sec-WebSocket-Protocol')) {
  26758. failWebsocketConnection(ws, 'Server did not respond with sent protocols.')
  26759. return
  26760. }
  26761. // 3. Follow the requirements stated step 2 to step 6, inclusive,
  26762. // of the last set of steps in section 4.1 of The WebSocket
  26763. // Protocol to validate response. This either results in fail
  26764. // the WebSocket connection or the WebSocket connection is
  26765. // established.
  26766. // 2. If the response lacks an |Upgrade| header field or the |Upgrade|
  26767. // header field contains a value that is not an ASCII case-
  26768. // insensitive match for the value "websocket", the client MUST
  26769. // _Fail the WebSocket Connection_.
  26770. if (response.headersList.get('Upgrade')?.toLowerCase() !== 'websocket') {
  26771. failWebsocketConnection(ws, 'Server did not set Upgrade header to "websocket".')
  26772. return
  26773. }
  26774. // 3. If the response lacks a |Connection| header field or the
  26775. // |Connection| header field doesn't contain a token that is an
  26776. // ASCII case-insensitive match for the value "Upgrade", the client
  26777. // MUST _Fail the WebSocket Connection_.
  26778. if (response.headersList.get('Connection')?.toLowerCase() !== 'upgrade') {
  26779. failWebsocketConnection(ws, 'Server did not set Connection header to "upgrade".')
  26780. return
  26781. }
  26782. // 4. If the response lacks a |Sec-WebSocket-Accept| header field or
  26783. // the |Sec-WebSocket-Accept| contains a value other than the
  26784. // base64-encoded SHA-1 of the concatenation of the |Sec-WebSocket-
  26785. // Key| (as a string, not base64-decoded) with the string "258EAFA5-
  26786. // E914-47DA-95CA-C5AB0DC85B11" but ignoring any leading and
  26787. // trailing whitespace, the client MUST _Fail the WebSocket
  26788. // Connection_.
  26789. const secWSAccept = response.headersList.get('Sec-WebSocket-Accept')
  26790. const digest = crypto.createHash('sha1').update(keyValue + uid).digest('base64')
  26791. if (secWSAccept !== digest) {
  26792. failWebsocketConnection(ws, 'Incorrect hash received in Sec-WebSocket-Accept header.')
  26793. return
  26794. }
  26795. // 5. If the response includes a |Sec-WebSocket-Extensions| header
  26796. // field and this header field indicates the use of an extension
  26797. // that was not present in the client's handshake (the server has
  26798. // indicated an extension not requested by the client), the client
  26799. // MUST _Fail the WebSocket Connection_. (The parsing of this
  26800. // header field to determine which extensions are requested is
  26801. // discussed in Section 9.1.)
  26802. const secExtension = response.headersList.get('Sec-WebSocket-Extensions')
  26803. if (secExtension !== null && secExtension !== permessageDeflate) {
  26804. failWebsocketConnection(ws, 'Received different permessage-deflate than the one set.')
  26805. return
  26806. }
  26807. // 6. If the response includes a |Sec-WebSocket-Protocol| header field
  26808. // and this header field indicates the use of a subprotocol that was
  26809. // not present in the client's handshake (the server has indicated a
  26810. // subprotocol not requested by the client), the client MUST _Fail
  26811. // the WebSocket Connection_.
  26812. const secProtocol = response.headersList.get('Sec-WebSocket-Protocol')
  26813. if (secProtocol !== null && secProtocol !== request.headersList.get('Sec-WebSocket-Protocol')) {
  26814. failWebsocketConnection(ws, 'Protocol was not set in the opening handshake.')
  26815. return
  26816. }
  26817. response.socket.on('data', onSocketData)
  26818. response.socket.on('close', onSocketClose)
  26819. response.socket.on('error', onSocketError)
  26820. if (channels.open.hasSubscribers) {
  26821. channels.open.publish({
  26822. address: response.socket.address(),
  26823. protocol: secProtocol,
  26824. extensions: secExtension
  26825. })
  26826. }
  26827. onEstablish(response)
  26828. }
  26829. })
  26830. return controller
  26831. }
  26832. /**
  26833. * @param {Buffer} chunk
  26834. */
  26835. function onSocketData (chunk) {
  26836. if (!this.ws[kByteParser].write(chunk)) {
  26837. this.pause()
  26838. }
  26839. }
  26840. /**
  26841. * @see https://websockets.spec.whatwg.org/#feedback-from-the-protocol
  26842. * @see https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.4
  26843. */
  26844. function onSocketClose () {
  26845. const { ws } = this
  26846. // If the TCP connection was closed after the
  26847. // WebSocket closing handshake was completed, the WebSocket connection
  26848. // is said to have been closed _cleanly_.
  26849. const wasClean = ws[kSentClose] && ws[kReceivedClose]
  26850. let code = 1005
  26851. let reason = ''
  26852. const result = ws[kByteParser].closingInfo
  26853. if (result) {
  26854. code = result.code ?? 1005
  26855. reason = result.reason
  26856. } else if (!ws[kSentClose]) {
  26857. // If _The WebSocket
  26858. // Connection is Closed_ and no Close control frame was received by the
  26859. // endpoint (such as could occur if the underlying transport connection
  26860. // is lost), _The WebSocket Connection Close Code_ is considered to be
  26861. // 1006.
  26862. code = 1006
  26863. }
  26864. // 1. Change the ready state to CLOSED (3).
  26865. ws[kReadyState] = states.CLOSED
  26866. // 2. If the user agent was required to fail the WebSocket
  26867. // connection, or if the WebSocket connection was closed
  26868. // after being flagged as full, fire an event named error
  26869. // at the WebSocket object.
  26870. // TODO
  26871. // 3. Fire an event named close at the WebSocket object,
  26872. // using CloseEvent, with the wasClean attribute
  26873. // initialized to true if the connection closed cleanly
  26874. // and false otherwise, the code attribute initialized to
  26875. // the WebSocket connection close code, and the reason
  26876. // attribute initialized to the result of applying UTF-8
  26877. // decode without BOM to the WebSocket connection close
  26878. // reason.
  26879. fireEvent('close', ws, CloseEvent, {
  26880. wasClean, code, reason
  26881. })
  26882. if (channels.close.hasSubscribers) {
  26883. channels.close.publish({
  26884. websocket: ws,
  26885. code,
  26886. reason
  26887. })
  26888. }
  26889. }
  26890. function onSocketError (error) {
  26891. const { ws } = this
  26892. ws[kReadyState] = states.CLOSING
  26893. if (channels.socketError.hasSubscribers) {
  26894. channels.socketError.publish(error)
  26895. }
  26896. this.destroy()
  26897. }
  26898. module.exports = {
  26899. establishWebSocketConnection
  26900. }
  26901. /***/ }),
  26902. /***/ 9188:
  26903. /***/ ((module) => {
  26904. // This is a Globally Unique Identifier unique used
  26905. // to validate that the endpoint accepts websocket
  26906. // connections.
  26907. // See https://www.rfc-editor.org/rfc/rfc6455.html#section-1.3
  26908. const uid = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
  26909. /** @type {PropertyDescriptor} */
  26910. const staticPropertyDescriptors = {
  26911. enumerable: true,
  26912. writable: false,
  26913. configurable: false
  26914. }
  26915. const states = {
  26916. CONNECTING: 0,
  26917. OPEN: 1,
  26918. CLOSING: 2,
  26919. CLOSED: 3
  26920. }
  26921. const opcodes = {
  26922. CONTINUATION: 0x0,
  26923. TEXT: 0x1,
  26924. BINARY: 0x2,
  26925. CLOSE: 0x8,
  26926. PING: 0x9,
  26927. PONG: 0xA
  26928. }
  26929. const maxUnsigned16Bit = 2 ** 16 - 1 // 65535
  26930. const parserStates = {
  26931. INFO: 0,
  26932. PAYLOADLENGTH_16: 2,
  26933. PAYLOADLENGTH_64: 3,
  26934. READ_DATA: 4
  26935. }
  26936. const emptyBuffer = Buffer.allocUnsafe(0)
  26937. module.exports = {
  26938. uid,
  26939. staticPropertyDescriptors,
  26940. states,
  26941. opcodes,
  26942. maxUnsigned16Bit,
  26943. parserStates,
  26944. emptyBuffer
  26945. }
  26946. /***/ }),
  26947. /***/ 2611:
  26948. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  26949. const { webidl } = __nccwpck_require__(1744)
  26950. const { kEnumerableProperty } = __nccwpck_require__(3983)
  26951. const { MessagePort } = __nccwpck_require__(1267)
  26952. /**
  26953. * @see https://html.spec.whatwg.org/multipage/comms.html#messageevent
  26954. */
  26955. class MessageEvent extends Event {
  26956. #eventInit
  26957. constructor (type, eventInitDict = {}) {
  26958. webidl.argumentLengthCheck(arguments, 1, { header: 'MessageEvent constructor' })
  26959. type = webidl.converters.DOMString(type)
  26960. eventInitDict = webidl.converters.MessageEventInit(eventInitDict)
  26961. super(type, eventInitDict)
  26962. this.#eventInit = eventInitDict
  26963. }
  26964. get data () {
  26965. webidl.brandCheck(this, MessageEvent)
  26966. return this.#eventInit.data
  26967. }
  26968. get origin () {
  26969. webidl.brandCheck(this, MessageEvent)
  26970. return this.#eventInit.origin
  26971. }
  26972. get lastEventId () {
  26973. webidl.brandCheck(this, MessageEvent)
  26974. return this.#eventInit.lastEventId
  26975. }
  26976. get source () {
  26977. webidl.brandCheck(this, MessageEvent)
  26978. return this.#eventInit.source
  26979. }
  26980. get ports () {
  26981. webidl.brandCheck(this, MessageEvent)
  26982. if (!Object.isFrozen(this.#eventInit.ports)) {
  26983. Object.freeze(this.#eventInit.ports)
  26984. }
  26985. return this.#eventInit.ports
  26986. }
  26987. initMessageEvent (
  26988. type,
  26989. bubbles = false,
  26990. cancelable = false,
  26991. data = null,
  26992. origin = '',
  26993. lastEventId = '',
  26994. source = null,
  26995. ports = []
  26996. ) {
  26997. webidl.brandCheck(this, MessageEvent)
  26998. webidl.argumentLengthCheck(arguments, 1, { header: 'MessageEvent.initMessageEvent' })
  26999. return new MessageEvent(type, {
  27000. bubbles, cancelable, data, origin, lastEventId, source, ports
  27001. })
  27002. }
  27003. }
  27004. /**
  27005. * @see https://websockets.spec.whatwg.org/#the-closeevent-interface
  27006. */
  27007. class CloseEvent extends Event {
  27008. #eventInit
  27009. constructor (type, eventInitDict = {}) {
  27010. webidl.argumentLengthCheck(arguments, 1, { header: 'CloseEvent constructor' })
  27011. type = webidl.converters.DOMString(type)
  27012. eventInitDict = webidl.converters.CloseEventInit(eventInitDict)
  27013. super(type, eventInitDict)
  27014. this.#eventInit = eventInitDict
  27015. }
  27016. get wasClean () {
  27017. webidl.brandCheck(this, CloseEvent)
  27018. return this.#eventInit.wasClean
  27019. }
  27020. get code () {
  27021. webidl.brandCheck(this, CloseEvent)
  27022. return this.#eventInit.code
  27023. }
  27024. get reason () {
  27025. webidl.brandCheck(this, CloseEvent)
  27026. return this.#eventInit.reason
  27027. }
  27028. }
  27029. // https://html.spec.whatwg.org/multipage/webappapis.html#the-errorevent-interface
  27030. class ErrorEvent extends Event {
  27031. #eventInit
  27032. constructor (type, eventInitDict) {
  27033. webidl.argumentLengthCheck(arguments, 1, { header: 'ErrorEvent constructor' })
  27034. super(type, eventInitDict)
  27035. type = webidl.converters.DOMString(type)
  27036. eventInitDict = webidl.converters.ErrorEventInit(eventInitDict ?? {})
  27037. this.#eventInit = eventInitDict
  27038. }
  27039. get message () {
  27040. webidl.brandCheck(this, ErrorEvent)
  27041. return this.#eventInit.message
  27042. }
  27043. get filename () {
  27044. webidl.brandCheck(this, ErrorEvent)
  27045. return this.#eventInit.filename
  27046. }
  27047. get lineno () {
  27048. webidl.brandCheck(this, ErrorEvent)
  27049. return this.#eventInit.lineno
  27050. }
  27051. get colno () {
  27052. webidl.brandCheck(this, ErrorEvent)
  27053. return this.#eventInit.colno
  27054. }
  27055. get error () {
  27056. webidl.brandCheck(this, ErrorEvent)
  27057. return this.#eventInit.error
  27058. }
  27059. }
  27060. Object.defineProperties(MessageEvent.prototype, {
  27061. [Symbol.toStringTag]: {
  27062. value: 'MessageEvent',
  27063. configurable: true
  27064. },
  27065. data: kEnumerableProperty,
  27066. origin: kEnumerableProperty,
  27067. lastEventId: kEnumerableProperty,
  27068. source: kEnumerableProperty,
  27069. ports: kEnumerableProperty,
  27070. initMessageEvent: kEnumerableProperty
  27071. })
  27072. Object.defineProperties(CloseEvent.prototype, {
  27073. [Symbol.toStringTag]: {
  27074. value: 'CloseEvent',
  27075. configurable: true
  27076. },
  27077. reason: kEnumerableProperty,
  27078. code: kEnumerableProperty,
  27079. wasClean: kEnumerableProperty
  27080. })
  27081. Object.defineProperties(ErrorEvent.prototype, {
  27082. [Symbol.toStringTag]: {
  27083. value: 'ErrorEvent',
  27084. configurable: true
  27085. },
  27086. message: kEnumerableProperty,
  27087. filename: kEnumerableProperty,
  27088. lineno: kEnumerableProperty,
  27089. colno: kEnumerableProperty,
  27090. error: kEnumerableProperty
  27091. })
  27092. webidl.converters.MessagePort = webidl.interfaceConverter(MessagePort)
  27093. webidl.converters['sequence<MessagePort>'] = webidl.sequenceConverter(
  27094. webidl.converters.MessagePort
  27095. )
  27096. const eventInit = [
  27097. {
  27098. key: 'bubbles',
  27099. converter: webidl.converters.boolean,
  27100. defaultValue: false
  27101. },
  27102. {
  27103. key: 'cancelable',
  27104. converter: webidl.converters.boolean,
  27105. defaultValue: false
  27106. },
  27107. {
  27108. key: 'composed',
  27109. converter: webidl.converters.boolean,
  27110. defaultValue: false
  27111. }
  27112. ]
  27113. webidl.converters.MessageEventInit = webidl.dictionaryConverter([
  27114. ...eventInit,
  27115. {
  27116. key: 'data',
  27117. converter: webidl.converters.any,
  27118. defaultValue: null
  27119. },
  27120. {
  27121. key: 'origin',
  27122. converter: webidl.converters.USVString,
  27123. defaultValue: ''
  27124. },
  27125. {
  27126. key: 'lastEventId',
  27127. converter: webidl.converters.DOMString,
  27128. defaultValue: ''
  27129. },
  27130. {
  27131. key: 'source',
  27132. // Node doesn't implement WindowProxy or ServiceWorker, so the only
  27133. // valid value for source is a MessagePort.
  27134. converter: webidl.nullableConverter(webidl.converters.MessagePort),
  27135. defaultValue: null
  27136. },
  27137. {
  27138. key: 'ports',
  27139. converter: webidl.converters['sequence<MessagePort>'],
  27140. get defaultValue () {
  27141. return []
  27142. }
  27143. }
  27144. ])
  27145. webidl.converters.CloseEventInit = webidl.dictionaryConverter([
  27146. ...eventInit,
  27147. {
  27148. key: 'wasClean',
  27149. converter: webidl.converters.boolean,
  27150. defaultValue: false
  27151. },
  27152. {
  27153. key: 'code',
  27154. converter: webidl.converters['unsigned short'],
  27155. defaultValue: 0
  27156. },
  27157. {
  27158. key: 'reason',
  27159. converter: webidl.converters.USVString,
  27160. defaultValue: ''
  27161. }
  27162. ])
  27163. webidl.converters.ErrorEventInit = webidl.dictionaryConverter([
  27164. ...eventInit,
  27165. {
  27166. key: 'message',
  27167. converter: webidl.converters.DOMString,
  27168. defaultValue: ''
  27169. },
  27170. {
  27171. key: 'filename',
  27172. converter: webidl.converters.USVString,
  27173. defaultValue: ''
  27174. },
  27175. {
  27176. key: 'lineno',
  27177. converter: webidl.converters['unsigned long'],
  27178. defaultValue: 0
  27179. },
  27180. {
  27181. key: 'colno',
  27182. converter: webidl.converters['unsigned long'],
  27183. defaultValue: 0
  27184. },
  27185. {
  27186. key: 'error',
  27187. converter: webidl.converters.any
  27188. }
  27189. ])
  27190. module.exports = {
  27191. MessageEvent,
  27192. CloseEvent,
  27193. ErrorEvent
  27194. }
  27195. /***/ }),
  27196. /***/ 5444:
  27197. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  27198. const { maxUnsigned16Bit } = __nccwpck_require__(9188)
  27199. /** @type {import('crypto')} */
  27200. let crypto
  27201. try {
  27202. crypto = __nccwpck_require__(6113)
  27203. } catch {
  27204. }
  27205. class WebsocketFrameSend {
  27206. /**
  27207. * @param {Buffer|undefined} data
  27208. */
  27209. constructor (data) {
  27210. this.frameData = data
  27211. this.maskKey = crypto.randomBytes(4)
  27212. }
  27213. createFrame (opcode) {
  27214. const bodyLength = this.frameData?.byteLength ?? 0
  27215. /** @type {number} */
  27216. let payloadLength = bodyLength // 0-125
  27217. let offset = 6
  27218. if (bodyLength > maxUnsigned16Bit) {
  27219. offset += 8 // payload length is next 8 bytes
  27220. payloadLength = 127
  27221. } else if (bodyLength > 125) {
  27222. offset += 2 // payload length is next 2 bytes
  27223. payloadLength = 126
  27224. }
  27225. const buffer = Buffer.allocUnsafe(bodyLength + offset)
  27226. // Clear first 2 bytes, everything else is overwritten
  27227. buffer[0] = buffer[1] = 0
  27228. buffer[0] |= 0x80 // FIN
  27229. buffer[0] = (buffer[0] & 0xF0) + opcode // opcode
  27230. /*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */
  27231. buffer[offset - 4] = this.maskKey[0]
  27232. buffer[offset - 3] = this.maskKey[1]
  27233. buffer[offset - 2] = this.maskKey[2]
  27234. buffer[offset - 1] = this.maskKey[3]
  27235. buffer[1] = payloadLength
  27236. if (payloadLength === 126) {
  27237. buffer.writeUInt16BE(bodyLength, 2)
  27238. } else if (payloadLength === 127) {
  27239. // Clear extended payload length
  27240. buffer[2] = buffer[3] = 0
  27241. buffer.writeUIntBE(bodyLength, 4, 6)
  27242. }
  27243. buffer[1] |= 0x80 // MASK
  27244. // mask body
  27245. for (let i = 0; i < bodyLength; i++) {
  27246. buffer[offset + i] = this.frameData[i] ^ this.maskKey[i % 4]
  27247. }
  27248. return buffer
  27249. }
  27250. }
  27251. module.exports = {
  27252. WebsocketFrameSend
  27253. }
  27254. /***/ }),
  27255. /***/ 1688:
  27256. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  27257. const { Writable } = __nccwpck_require__(2781)
  27258. const diagnosticsChannel = __nccwpck_require__(7643)
  27259. const { parserStates, opcodes, states, emptyBuffer } = __nccwpck_require__(9188)
  27260. const { kReadyState, kSentClose, kResponse, kReceivedClose } = __nccwpck_require__(7578)
  27261. const { isValidStatusCode, failWebsocketConnection, websocketMessageReceived } = __nccwpck_require__(5515)
  27262. const { WebsocketFrameSend } = __nccwpck_require__(5444)
  27263. // This code was influenced by ws released under the MIT license.
  27264. // Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
  27265. // Copyright (c) 2013 Arnout Kazemier and contributors
  27266. // Copyright (c) 2016 Luigi Pinca and contributors
  27267. const channels = {}
  27268. channels.ping = diagnosticsChannel.channel('undici:websocket:ping')
  27269. channels.pong = diagnosticsChannel.channel('undici:websocket:pong')
  27270. class ByteParser extends Writable {
  27271. #buffers = []
  27272. #byteOffset = 0
  27273. #state = parserStates.INFO
  27274. #info = {}
  27275. #fragments = []
  27276. constructor (ws) {
  27277. super()
  27278. this.ws = ws
  27279. }
  27280. /**
  27281. * @param {Buffer} chunk
  27282. * @param {() => void} callback
  27283. */
  27284. _write (chunk, _, callback) {
  27285. this.#buffers.push(chunk)
  27286. this.#byteOffset += chunk.length
  27287. this.run(callback)
  27288. }
  27289. /**
  27290. * Runs whenever a new chunk is received.
  27291. * Callback is called whenever there are no more chunks buffering,
  27292. * or not enough bytes are buffered to parse.
  27293. */
  27294. run (callback) {
  27295. while (true) {
  27296. if (this.#state === parserStates.INFO) {
  27297. // If there aren't enough bytes to parse the payload length, etc.
  27298. if (this.#byteOffset < 2) {
  27299. return callback()
  27300. }
  27301. const buffer = this.consume(2)
  27302. this.#info.fin = (buffer[0] & 0x80) !== 0
  27303. this.#info.opcode = buffer[0] & 0x0F
  27304. // If we receive a fragmented message, we use the type of the first
  27305. // frame to parse the full message as binary/text, when it's terminated
  27306. this.#info.originalOpcode ??= this.#info.opcode
  27307. this.#info.fragmented = !this.#info.fin && this.#info.opcode !== opcodes.CONTINUATION
  27308. if (this.#info.fragmented && this.#info.opcode !== opcodes.BINARY && this.#info.opcode !== opcodes.TEXT) {
  27309. // Only text and binary frames can be fragmented
  27310. failWebsocketConnection(this.ws, 'Invalid frame type was fragmented.')
  27311. return
  27312. }
  27313. const payloadLength = buffer[1] & 0x7F
  27314. if (payloadLength <= 125) {
  27315. this.#info.payloadLength = payloadLength
  27316. this.#state = parserStates.READ_DATA
  27317. } else if (payloadLength === 126) {
  27318. this.#state = parserStates.PAYLOADLENGTH_16
  27319. } else if (payloadLength === 127) {
  27320. this.#state = parserStates.PAYLOADLENGTH_64
  27321. }
  27322. if (this.#info.fragmented && payloadLength > 125) {
  27323. // A fragmented frame can't be fragmented itself
  27324. failWebsocketConnection(this.ws, 'Fragmented frame exceeded 125 bytes.')
  27325. return
  27326. } else if (
  27327. (this.#info.opcode === opcodes.PING ||
  27328. this.#info.opcode === opcodes.PONG ||
  27329. this.#info.opcode === opcodes.CLOSE) &&
  27330. payloadLength > 125
  27331. ) {
  27332. // Control frames can have a payload length of 125 bytes MAX
  27333. failWebsocketConnection(this.ws, 'Payload length for control frame exceeded 125 bytes.')
  27334. return
  27335. } else if (this.#info.opcode === opcodes.CLOSE) {
  27336. if (payloadLength === 1) {
  27337. failWebsocketConnection(this.ws, 'Received close frame with a 1-byte body.')
  27338. return
  27339. }
  27340. const body = this.consume(payloadLength)
  27341. this.#info.closeInfo = this.parseCloseBody(false, body)
  27342. if (!this.ws[kSentClose]) {
  27343. // If an endpoint receives a Close frame and did not previously send a
  27344. // Close frame, the endpoint MUST send a Close frame in response. (When
  27345. // sending a Close frame in response, the endpoint typically echos the
  27346. // status code it received.)
  27347. const body = Buffer.allocUnsafe(2)
  27348. body.writeUInt16BE(this.#info.closeInfo.code, 0)
  27349. const closeFrame = new WebsocketFrameSend(body)
  27350. this.ws[kResponse].socket.write(
  27351. closeFrame.createFrame(opcodes.CLOSE),
  27352. (err) => {
  27353. if (!err) {
  27354. this.ws[kSentClose] = true
  27355. }
  27356. }
  27357. )
  27358. }
  27359. // Upon either sending or receiving a Close control frame, it is said
  27360. // that _The WebSocket Closing Handshake is Started_ and that the
  27361. // WebSocket connection is in the CLOSING state.
  27362. this.ws[kReadyState] = states.CLOSING
  27363. this.ws[kReceivedClose] = true
  27364. this.end()
  27365. return
  27366. } else if (this.#info.opcode === opcodes.PING) {
  27367. // Upon receipt of a Ping frame, an endpoint MUST send a Pong frame in
  27368. // response, unless it already received a Close frame.
  27369. // A Pong frame sent in response to a Ping frame must have identical
  27370. // "Application data"
  27371. const body = this.consume(payloadLength)
  27372. if (!this.ws[kReceivedClose]) {
  27373. const frame = new WebsocketFrameSend(body)
  27374. this.ws[kResponse].socket.write(frame.createFrame(opcodes.PONG))
  27375. if (channels.ping.hasSubscribers) {
  27376. channels.ping.publish({
  27377. payload: body
  27378. })
  27379. }
  27380. }
  27381. this.#state = parserStates.INFO
  27382. if (this.#byteOffset > 0) {
  27383. continue
  27384. } else {
  27385. callback()
  27386. return
  27387. }
  27388. } else if (this.#info.opcode === opcodes.PONG) {
  27389. // A Pong frame MAY be sent unsolicited. This serves as a
  27390. // unidirectional heartbeat. A response to an unsolicited Pong frame is
  27391. // not expected.
  27392. const body = this.consume(payloadLength)
  27393. if (channels.pong.hasSubscribers) {
  27394. channels.pong.publish({
  27395. payload: body
  27396. })
  27397. }
  27398. if (this.#byteOffset > 0) {
  27399. continue
  27400. } else {
  27401. callback()
  27402. return
  27403. }
  27404. }
  27405. } else if (this.#state === parserStates.PAYLOADLENGTH_16) {
  27406. if (this.#byteOffset < 2) {
  27407. return callback()
  27408. }
  27409. const buffer = this.consume(2)
  27410. this.#info.payloadLength = buffer.readUInt16BE(0)
  27411. this.#state = parserStates.READ_DATA
  27412. } else if (this.#state === parserStates.PAYLOADLENGTH_64) {
  27413. if (this.#byteOffset < 8) {
  27414. return callback()
  27415. }
  27416. const buffer = this.consume(8)
  27417. const upper = buffer.readUInt32BE(0)
  27418. // 2^31 is the maxinimum bytes an arraybuffer can contain
  27419. // on 32-bit systems. Although, on 64-bit systems, this is
  27420. // 2^53-1 bytes.
  27421. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Invalid_array_length
  27422. // https://source.chromium.org/chromium/chromium/src/+/main:v8/src/common/globals.h;drc=1946212ac0100668f14eb9e2843bdd846e510a1e;bpv=1;bpt=1;l=1275
  27423. // https://source.chromium.org/chromium/chromium/src/+/main:v8/src/objects/js-array-buffer.h;l=34;drc=1946212ac0100668f14eb9e2843bdd846e510a1e
  27424. if (upper > 2 ** 31 - 1) {
  27425. failWebsocketConnection(this.ws, 'Received payload length > 2^31 bytes.')
  27426. return
  27427. }
  27428. const lower = buffer.readUInt32BE(4)
  27429. this.#info.payloadLength = (upper << 8) + lower
  27430. this.#state = parserStates.READ_DATA
  27431. } else if (this.#state === parserStates.READ_DATA) {
  27432. if (this.#byteOffset < this.#info.payloadLength) {
  27433. // If there is still more data in this chunk that needs to be read
  27434. return callback()
  27435. } else if (this.#byteOffset >= this.#info.payloadLength) {
  27436. // If the server sent multiple frames in a single chunk
  27437. const body = this.consume(this.#info.payloadLength)
  27438. this.#fragments.push(body)
  27439. // If the frame is unfragmented, or a fragmented frame was terminated,
  27440. // a message was received
  27441. if (!this.#info.fragmented || (this.#info.fin && this.#info.opcode === opcodes.CONTINUATION)) {
  27442. const fullMessage = Buffer.concat(this.#fragments)
  27443. websocketMessageReceived(this.ws, this.#info.originalOpcode, fullMessage)
  27444. this.#info = {}
  27445. this.#fragments.length = 0
  27446. }
  27447. this.#state = parserStates.INFO
  27448. }
  27449. }
  27450. if (this.#byteOffset > 0) {
  27451. continue
  27452. } else {
  27453. callback()
  27454. break
  27455. }
  27456. }
  27457. }
  27458. /**
  27459. * Take n bytes from the buffered Buffers
  27460. * @param {number} n
  27461. * @returns {Buffer|null}
  27462. */
  27463. consume (n) {
  27464. if (n > this.#byteOffset) {
  27465. return null
  27466. } else if (n === 0) {
  27467. return emptyBuffer
  27468. }
  27469. if (this.#buffers[0].length === n) {
  27470. this.#byteOffset -= this.#buffers[0].length
  27471. return this.#buffers.shift()
  27472. }
  27473. const buffer = Buffer.allocUnsafe(n)
  27474. let offset = 0
  27475. while (offset !== n) {
  27476. const next = this.#buffers[0]
  27477. const { length } = next
  27478. if (length + offset === n) {
  27479. buffer.set(this.#buffers.shift(), offset)
  27480. break
  27481. } else if (length + offset > n) {
  27482. buffer.set(next.subarray(0, n - offset), offset)
  27483. this.#buffers[0] = next.subarray(n - offset)
  27484. break
  27485. } else {
  27486. buffer.set(this.#buffers.shift(), offset)
  27487. offset += next.length
  27488. }
  27489. }
  27490. this.#byteOffset -= n
  27491. return buffer
  27492. }
  27493. parseCloseBody (onlyCode, data) {
  27494. // https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.5
  27495. /** @type {number|undefined} */
  27496. let code
  27497. if (data.length >= 2) {
  27498. // _The WebSocket Connection Close Code_ is
  27499. // defined as the status code (Section 7.4) contained in the first Close
  27500. // control frame received by the application
  27501. code = data.readUInt16BE(0)
  27502. }
  27503. if (onlyCode) {
  27504. if (!isValidStatusCode(code)) {
  27505. return null
  27506. }
  27507. return { code }
  27508. }
  27509. // https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.6
  27510. /** @type {Buffer} */
  27511. let reason = data.subarray(2)
  27512. // Remove BOM
  27513. if (reason[0] === 0xEF && reason[1] === 0xBB && reason[2] === 0xBF) {
  27514. reason = reason.subarray(3)
  27515. }
  27516. if (code !== undefined && !isValidStatusCode(code)) {
  27517. return null
  27518. }
  27519. try {
  27520. // TODO: optimize this
  27521. reason = new TextDecoder('utf-8', { fatal: true }).decode(reason)
  27522. } catch {
  27523. return null
  27524. }
  27525. return { code, reason }
  27526. }
  27527. get closingInfo () {
  27528. return this.#info.closeInfo
  27529. }
  27530. }
  27531. module.exports = {
  27532. ByteParser
  27533. }
  27534. /***/ }),
  27535. /***/ 7578:
  27536. /***/ ((module) => {
  27537. module.exports = {
  27538. kWebSocketURL: Symbol('url'),
  27539. kReadyState: Symbol('ready state'),
  27540. kController: Symbol('controller'),
  27541. kResponse: Symbol('response'),
  27542. kBinaryType: Symbol('binary type'),
  27543. kSentClose: Symbol('sent close'),
  27544. kReceivedClose: Symbol('received close'),
  27545. kByteParser: Symbol('byte parser')
  27546. }
  27547. /***/ }),
  27548. /***/ 5515:
  27549. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  27550. const { kReadyState, kController, kResponse, kBinaryType, kWebSocketURL } = __nccwpck_require__(7578)
  27551. const { states, opcodes } = __nccwpck_require__(9188)
  27552. const { MessageEvent, ErrorEvent } = __nccwpck_require__(2611)
  27553. /* globals Blob */
  27554. /**
  27555. * @param {import('./websocket').WebSocket} ws
  27556. */
  27557. function isEstablished (ws) {
  27558. // If the server's response is validated as provided for above, it is
  27559. // said that _The WebSocket Connection is Established_ and that the
  27560. // WebSocket Connection is in the OPEN state.
  27561. return ws[kReadyState] === states.OPEN
  27562. }
  27563. /**
  27564. * @param {import('./websocket').WebSocket} ws
  27565. */
  27566. function isClosing (ws) {
  27567. // Upon either sending or receiving a Close control frame, it is said
  27568. // that _The WebSocket Closing Handshake is Started_ and that the
  27569. // WebSocket connection is in the CLOSING state.
  27570. return ws[kReadyState] === states.CLOSING
  27571. }
  27572. /**
  27573. * @param {import('./websocket').WebSocket} ws
  27574. */
  27575. function isClosed (ws) {
  27576. return ws[kReadyState] === states.CLOSED
  27577. }
  27578. /**
  27579. * @see https://dom.spec.whatwg.org/#concept-event-fire
  27580. * @param {string} e
  27581. * @param {EventTarget} target
  27582. * @param {EventInit | undefined} eventInitDict
  27583. */
  27584. function fireEvent (e, target, eventConstructor = Event, eventInitDict) {
  27585. // 1. If eventConstructor is not given, then let eventConstructor be Event.
  27586. // 2. Let event be the result of creating an event given eventConstructor,
  27587. // in the relevant realm of target.
  27588. // 3. Initialize event’s type attribute to e.
  27589. const event = new eventConstructor(e, eventInitDict) // eslint-disable-line new-cap
  27590. // 4. Initialize any other IDL attributes of event as described in the
  27591. // invocation of this algorithm.
  27592. // 5. Return the result of dispatching event at target, with legacy target
  27593. // override flag set if set.
  27594. target.dispatchEvent(event)
  27595. }
  27596. /**
  27597. * @see https://websockets.spec.whatwg.org/#feedback-from-the-protocol
  27598. * @param {import('./websocket').WebSocket} ws
  27599. * @param {number} type Opcode
  27600. * @param {Buffer} data application data
  27601. */
  27602. function websocketMessageReceived (ws, type, data) {
  27603. // 1. If ready state is not OPEN (1), then return.
  27604. if (ws[kReadyState] !== states.OPEN) {
  27605. return
  27606. }
  27607. // 2. Let dataForEvent be determined by switching on type and binary type:
  27608. let dataForEvent
  27609. if (type === opcodes.TEXT) {
  27610. // -> type indicates that the data is Text
  27611. // a new DOMString containing data
  27612. try {
  27613. dataForEvent = new TextDecoder('utf-8', { fatal: true }).decode(data)
  27614. } catch {
  27615. failWebsocketConnection(ws, 'Received invalid UTF-8 in text frame.')
  27616. return
  27617. }
  27618. } else if (type === opcodes.BINARY) {
  27619. if (ws[kBinaryType] === 'blob') {
  27620. // -> type indicates that the data is Binary and binary type is "blob"
  27621. // a new Blob object, created in the relevant Realm of the WebSocket
  27622. // object, that represents data as its raw data
  27623. dataForEvent = new Blob([data])
  27624. } else {
  27625. // -> type indicates that the data is Binary and binary type is "arraybuffer"
  27626. // a new ArrayBuffer object, created in the relevant Realm of the
  27627. // WebSocket object, whose contents are data
  27628. dataForEvent = new Uint8Array(data).buffer
  27629. }
  27630. }
  27631. // 3. Fire an event named message at the WebSocket object, using MessageEvent,
  27632. // with the origin attribute initialized to the serialization of the WebSocket
  27633. // object’s url's origin, and the data attribute initialized to dataForEvent.
  27634. fireEvent('message', ws, MessageEvent, {
  27635. origin: ws[kWebSocketURL].origin,
  27636. data: dataForEvent
  27637. })
  27638. }
  27639. /**
  27640. * @see https://datatracker.ietf.org/doc/html/rfc6455
  27641. * @see https://datatracker.ietf.org/doc/html/rfc2616
  27642. * @see https://bugs.chromium.org/p/chromium/issues/detail?id=398407
  27643. * @param {string} protocol
  27644. */
  27645. function isValidSubprotocol (protocol) {
  27646. // If present, this value indicates one
  27647. // or more comma-separated subprotocol the client wishes to speak,
  27648. // ordered by preference. The elements that comprise this value
  27649. // MUST be non-empty strings with characters in the range U+0021 to
  27650. // U+007E not including separator characters as defined in
  27651. // [RFC2616] and MUST all be unique strings.
  27652. if (protocol.length === 0) {
  27653. return false
  27654. }
  27655. for (const char of protocol) {
  27656. const code = char.charCodeAt(0)
  27657. if (
  27658. code < 0x21 ||
  27659. code > 0x7E ||
  27660. char === '(' ||
  27661. char === ')' ||
  27662. char === '<' ||
  27663. char === '>' ||
  27664. char === '@' ||
  27665. char === ',' ||
  27666. char === ';' ||
  27667. char === ':' ||
  27668. char === '\\' ||
  27669. char === '"' ||
  27670. char === '/' ||
  27671. char === '[' ||
  27672. char === ']' ||
  27673. char === '?' ||
  27674. char === '=' ||
  27675. char === '{' ||
  27676. char === '}' ||
  27677. code === 32 || // SP
  27678. code === 9 // HT
  27679. ) {
  27680. return false
  27681. }
  27682. }
  27683. return true
  27684. }
  27685. /**
  27686. * @see https://datatracker.ietf.org/doc/html/rfc6455#section-7-4
  27687. * @param {number} code
  27688. */
  27689. function isValidStatusCode (code) {
  27690. if (code >= 1000 && code < 1015) {
  27691. return (
  27692. code !== 1004 && // reserved
  27693. code !== 1005 && // "MUST NOT be set as a status code"
  27694. code !== 1006 // "MUST NOT be set as a status code"
  27695. )
  27696. }
  27697. return code >= 3000 && code <= 4999
  27698. }
  27699. /**
  27700. * @param {import('./websocket').WebSocket} ws
  27701. * @param {string|undefined} reason
  27702. */
  27703. function failWebsocketConnection (ws, reason) {
  27704. const { [kController]: controller, [kResponse]: response } = ws
  27705. controller.abort()
  27706. if (response?.socket && !response.socket.destroyed) {
  27707. response.socket.destroy()
  27708. }
  27709. if (reason) {
  27710. fireEvent('error', ws, ErrorEvent, {
  27711. error: new Error(reason)
  27712. })
  27713. }
  27714. }
  27715. module.exports = {
  27716. isEstablished,
  27717. isClosing,
  27718. isClosed,
  27719. fireEvent,
  27720. isValidSubprotocol,
  27721. isValidStatusCode,
  27722. failWebsocketConnection,
  27723. websocketMessageReceived
  27724. }
  27725. /***/ }),
  27726. /***/ 4284:
  27727. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  27728. const { webidl } = __nccwpck_require__(1744)
  27729. const { DOMException } = __nccwpck_require__(1037)
  27730. const { URLSerializer } = __nccwpck_require__(685)
  27731. const { getGlobalOrigin } = __nccwpck_require__(1246)
  27732. const { staticPropertyDescriptors, states, opcodes, emptyBuffer } = __nccwpck_require__(9188)
  27733. const {
  27734. kWebSocketURL,
  27735. kReadyState,
  27736. kController,
  27737. kBinaryType,
  27738. kResponse,
  27739. kSentClose,
  27740. kByteParser
  27741. } = __nccwpck_require__(7578)
  27742. const { isEstablished, isClosing, isValidSubprotocol, failWebsocketConnection, fireEvent } = __nccwpck_require__(5515)
  27743. const { establishWebSocketConnection } = __nccwpck_require__(5354)
  27744. const { WebsocketFrameSend } = __nccwpck_require__(5444)
  27745. const { ByteParser } = __nccwpck_require__(1688)
  27746. const { kEnumerableProperty, isBlobLike } = __nccwpck_require__(3983)
  27747. const { getGlobalDispatcher } = __nccwpck_require__(1892)
  27748. const { types } = __nccwpck_require__(3837)
  27749. let experimentalWarned = false
  27750. // https://websockets.spec.whatwg.org/#interface-definition
  27751. class WebSocket extends EventTarget {
  27752. #events = {
  27753. open: null,
  27754. error: null,
  27755. close: null,
  27756. message: null
  27757. }
  27758. #bufferedAmount = 0
  27759. #protocol = ''
  27760. #extensions = ''
  27761. /**
  27762. * @param {string} url
  27763. * @param {string|string[]} protocols
  27764. */
  27765. constructor (url, protocols = []) {
  27766. super()
  27767. webidl.argumentLengthCheck(arguments, 1, { header: 'WebSocket constructor' })
  27768. if (!experimentalWarned) {
  27769. experimentalWarned = true
  27770. process.emitWarning('WebSockets are experimental, expect them to change at any time.', {
  27771. code: 'UNDICI-WS'
  27772. })
  27773. }
  27774. const options = webidl.converters['DOMString or sequence<DOMString> or WebSocketInit'](protocols)
  27775. url = webidl.converters.USVString(url)
  27776. protocols = options.protocols
  27777. // 1. Let baseURL be this's relevant settings object's API base URL.
  27778. const baseURL = getGlobalOrigin()
  27779. // 1. Let urlRecord be the result of applying the URL parser to url with baseURL.
  27780. let urlRecord
  27781. try {
  27782. urlRecord = new URL(url, baseURL)
  27783. } catch (e) {
  27784. // 3. If urlRecord is failure, then throw a "SyntaxError" DOMException.
  27785. throw new DOMException(e, 'SyntaxError')
  27786. }
  27787. // 4. If urlRecord’s scheme is "http", then set urlRecord’s scheme to "ws".
  27788. if (urlRecord.protocol === 'http:') {
  27789. urlRecord.protocol = 'ws:'
  27790. } else if (urlRecord.protocol === 'https:') {
  27791. // 5. Otherwise, if urlRecord’s scheme is "https", set urlRecord’s scheme to "wss".
  27792. urlRecord.protocol = 'wss:'
  27793. }
  27794. // 6. If urlRecord’s scheme is not "ws" or "wss", then throw a "SyntaxError" DOMException.
  27795. if (urlRecord.protocol !== 'ws:' && urlRecord.protocol !== 'wss:') {
  27796. throw new DOMException(
  27797. `Expected a ws: or wss: protocol, got ${urlRecord.protocol}`,
  27798. 'SyntaxError'
  27799. )
  27800. }
  27801. // 7. If urlRecord’s fragment is non-null, then throw a "SyntaxError"
  27802. // DOMException.
  27803. if (urlRecord.hash || urlRecord.href.endsWith('#')) {
  27804. throw new DOMException('Got fragment', 'SyntaxError')
  27805. }
  27806. // 8. If protocols is a string, set protocols to a sequence consisting
  27807. // of just that string.
  27808. if (typeof protocols === 'string') {
  27809. protocols = [protocols]
  27810. }
  27811. // 9. If any of the values in protocols occur more than once or otherwise
  27812. // fail to match the requirements for elements that comprise the value
  27813. // of `Sec-WebSocket-Protocol` fields as defined by The WebSocket
  27814. // protocol, then throw a "SyntaxError" DOMException.
  27815. if (protocols.length !== new Set(protocols.map(p => p.toLowerCase())).size) {
  27816. throw new DOMException('Invalid Sec-WebSocket-Protocol value', 'SyntaxError')
  27817. }
  27818. if (protocols.length > 0 && !protocols.every(p => isValidSubprotocol(p))) {
  27819. throw new DOMException('Invalid Sec-WebSocket-Protocol value', 'SyntaxError')
  27820. }
  27821. // 10. Set this's url to urlRecord.
  27822. this[kWebSocketURL] = new URL(urlRecord.href)
  27823. // 11. Let client be this's relevant settings object.
  27824. // 12. Run this step in parallel:
  27825. // 1. Establish a WebSocket connection given urlRecord, protocols,
  27826. // and client.
  27827. this[kController] = establishWebSocketConnection(
  27828. urlRecord,
  27829. protocols,
  27830. this,
  27831. (response) => this.#onConnectionEstablished(response),
  27832. options
  27833. )
  27834. // Each WebSocket object has an associated ready state, which is a
  27835. // number representing the state of the connection. Initially it must
  27836. // be CONNECTING (0).
  27837. this[kReadyState] = WebSocket.CONNECTING
  27838. // The extensions attribute must initially return the empty string.
  27839. // The protocol attribute must initially return the empty string.
  27840. // Each WebSocket object has an associated binary type, which is a
  27841. // BinaryType. Initially it must be "blob".
  27842. this[kBinaryType] = 'blob'
  27843. }
  27844. /**
  27845. * @see https://websockets.spec.whatwg.org/#dom-websocket-close
  27846. * @param {number|undefined} code
  27847. * @param {string|undefined} reason
  27848. */
  27849. close (code = undefined, reason = undefined) {
  27850. webidl.brandCheck(this, WebSocket)
  27851. if (code !== undefined) {
  27852. code = webidl.converters['unsigned short'](code, { clamp: true })
  27853. }
  27854. if (reason !== undefined) {
  27855. reason = webidl.converters.USVString(reason)
  27856. }
  27857. // 1. If code is present, but is neither an integer equal to 1000 nor an
  27858. // integer in the range 3000 to 4999, inclusive, throw an
  27859. // "InvalidAccessError" DOMException.
  27860. if (code !== undefined) {
  27861. if (code !== 1000 && (code < 3000 || code > 4999)) {
  27862. throw new DOMException('invalid code', 'InvalidAccessError')
  27863. }
  27864. }
  27865. let reasonByteLength = 0
  27866. // 2. If reason is present, then run these substeps:
  27867. if (reason !== undefined) {
  27868. // 1. Let reasonBytes be the result of encoding reason.
  27869. // 2. If reasonBytes is longer than 123 bytes, then throw a
  27870. // "SyntaxError" DOMException.
  27871. reasonByteLength = Buffer.byteLength(reason)
  27872. if (reasonByteLength > 123) {
  27873. throw new DOMException(
  27874. `Reason must be less than 123 bytes; received ${reasonByteLength}`,
  27875. 'SyntaxError'
  27876. )
  27877. }
  27878. }
  27879. // 3. Run the first matching steps from the following list:
  27880. if (this[kReadyState] === WebSocket.CLOSING || this[kReadyState] === WebSocket.CLOSED) {
  27881. // If this's ready state is CLOSING (2) or CLOSED (3)
  27882. // Do nothing.
  27883. } else if (!isEstablished(this)) {
  27884. // If the WebSocket connection is not yet established
  27885. // Fail the WebSocket connection and set this's ready state
  27886. // to CLOSING (2).
  27887. failWebsocketConnection(this, 'Connection was closed before it was established.')
  27888. this[kReadyState] = WebSocket.CLOSING
  27889. } else if (!isClosing(this)) {
  27890. // If the WebSocket closing handshake has not yet been started
  27891. // Start the WebSocket closing handshake and set this's ready
  27892. // state to CLOSING (2).
  27893. // - If neither code nor reason is present, the WebSocket Close
  27894. // message must not have a body.
  27895. // - If code is present, then the status code to use in the
  27896. // WebSocket Close message must be the integer given by code.
  27897. // - If reason is also present, then reasonBytes must be
  27898. // provided in the Close message after the status code.
  27899. const frame = new WebsocketFrameSend()
  27900. // If neither code nor reason is present, the WebSocket Close
  27901. // message must not have a body.
  27902. // If code is present, then the status code to use in the
  27903. // WebSocket Close message must be the integer given by code.
  27904. if (code !== undefined && reason === undefined) {
  27905. frame.frameData = Buffer.allocUnsafe(2)
  27906. frame.frameData.writeUInt16BE(code, 0)
  27907. } else if (code !== undefined && reason !== undefined) {
  27908. // If reason is also present, then reasonBytes must be
  27909. // provided in the Close message after the status code.
  27910. frame.frameData = Buffer.allocUnsafe(2 + reasonByteLength)
  27911. frame.frameData.writeUInt16BE(code, 0)
  27912. // the body MAY contain UTF-8-encoded data with value /reason/
  27913. frame.frameData.write(reason, 2, 'utf-8')
  27914. } else {
  27915. frame.frameData = emptyBuffer
  27916. }
  27917. /** @type {import('stream').Duplex} */
  27918. const socket = this[kResponse].socket
  27919. socket.write(frame.createFrame(opcodes.CLOSE), (err) => {
  27920. if (!err) {
  27921. this[kSentClose] = true
  27922. }
  27923. })
  27924. // Upon either sending or receiving a Close control frame, it is said
  27925. // that _The WebSocket Closing Handshake is Started_ and that the
  27926. // WebSocket connection is in the CLOSING state.
  27927. this[kReadyState] = states.CLOSING
  27928. } else {
  27929. // Otherwise
  27930. // Set this's ready state to CLOSING (2).
  27931. this[kReadyState] = WebSocket.CLOSING
  27932. }
  27933. }
  27934. /**
  27935. * @see https://websockets.spec.whatwg.org/#dom-websocket-send
  27936. * @param {NodeJS.TypedArray|ArrayBuffer|Blob|string} data
  27937. */
  27938. send (data) {
  27939. webidl.brandCheck(this, WebSocket)
  27940. webidl.argumentLengthCheck(arguments, 1, { header: 'WebSocket.send' })
  27941. data = webidl.converters.WebSocketSendData(data)
  27942. // 1. If this's ready state is CONNECTING, then throw an
  27943. // "InvalidStateError" DOMException.
  27944. if (this[kReadyState] === WebSocket.CONNECTING) {
  27945. throw new DOMException('Sent before connected.', 'InvalidStateError')
  27946. }
  27947. // 2. Run the appropriate set of steps from the following list:
  27948. // https://datatracker.ietf.org/doc/html/rfc6455#section-6.1
  27949. // https://datatracker.ietf.org/doc/html/rfc6455#section-5.2
  27950. if (!isEstablished(this) || isClosing(this)) {
  27951. return
  27952. }
  27953. /** @type {import('stream').Duplex} */
  27954. const socket = this[kResponse].socket
  27955. // If data is a string
  27956. if (typeof data === 'string') {
  27957. // If the WebSocket connection is established and the WebSocket
  27958. // closing handshake has not yet started, then the user agent
  27959. // must send a WebSocket Message comprised of the data argument
  27960. // using a text frame opcode; if the data cannot be sent, e.g.
  27961. // because it would need to be buffered but the buffer is full,
  27962. // the user agent must flag the WebSocket as full and then close
  27963. // the WebSocket connection. Any invocation of this method with a
  27964. // string argument that does not throw an exception must increase
  27965. // the bufferedAmount attribute by the number of bytes needed to
  27966. // express the argument as UTF-8.
  27967. const value = Buffer.from(data)
  27968. const frame = new WebsocketFrameSend(value)
  27969. const buffer = frame.createFrame(opcodes.TEXT)
  27970. this.#bufferedAmount += value.byteLength
  27971. socket.write(buffer, () => {
  27972. this.#bufferedAmount -= value.byteLength
  27973. })
  27974. } else if (types.isArrayBuffer(data)) {
  27975. // If the WebSocket connection is established, and the WebSocket
  27976. // closing handshake has not yet started, then the user agent must
  27977. // send a WebSocket Message comprised of data using a binary frame
  27978. // opcode; if the data cannot be sent, e.g. because it would need
  27979. // to be buffered but the buffer is full, the user agent must flag
  27980. // the WebSocket as full and then close the WebSocket connection.
  27981. // The data to be sent is the data stored in the buffer described
  27982. // by the ArrayBuffer object. Any invocation of this method with an
  27983. // ArrayBuffer argument that does not throw an exception must
  27984. // increase the bufferedAmount attribute by the length of the
  27985. // ArrayBuffer in bytes.
  27986. const value = Buffer.from(data)
  27987. const frame = new WebsocketFrameSend(value)
  27988. const buffer = frame.createFrame(opcodes.BINARY)
  27989. this.#bufferedAmount += value.byteLength
  27990. socket.write(buffer, () => {
  27991. this.#bufferedAmount -= value.byteLength
  27992. })
  27993. } else if (ArrayBuffer.isView(data)) {
  27994. // If the WebSocket connection is established, and the WebSocket
  27995. // closing handshake has not yet started, then the user agent must
  27996. // send a WebSocket Message comprised of data using a binary frame
  27997. // opcode; if the data cannot be sent, e.g. because it would need to
  27998. // be buffered but the buffer is full, the user agent must flag the
  27999. // WebSocket as full and then close the WebSocket connection. The
  28000. // data to be sent is the data stored in the section of the buffer
  28001. // described by the ArrayBuffer object that data references. Any
  28002. // invocation of this method with this kind of argument that does
  28003. // not throw an exception must increase the bufferedAmount attribute
  28004. // by the length of data’s buffer in bytes.
  28005. const ab = Buffer.from(data, data.byteOffset, data.byteLength)
  28006. const frame = new WebsocketFrameSend(ab)
  28007. const buffer = frame.createFrame(opcodes.BINARY)
  28008. this.#bufferedAmount += ab.byteLength
  28009. socket.write(buffer, () => {
  28010. this.#bufferedAmount -= ab.byteLength
  28011. })
  28012. } else if (isBlobLike(data)) {
  28013. // If the WebSocket connection is established, and the WebSocket
  28014. // closing handshake has not yet started, then the user agent must
  28015. // send a WebSocket Message comprised of data using a binary frame
  28016. // opcode; if the data cannot be sent, e.g. because it would need to
  28017. // be buffered but the buffer is full, the user agent must flag the
  28018. // WebSocket as full and then close the WebSocket connection. The data
  28019. // to be sent is the raw data represented by the Blob object. Any
  28020. // invocation of this method with a Blob argument that does not throw
  28021. // an exception must increase the bufferedAmount attribute by the size
  28022. // of the Blob object’s raw data, in bytes.
  28023. const frame = new WebsocketFrameSend()
  28024. data.arrayBuffer().then((ab) => {
  28025. const value = Buffer.from(ab)
  28026. frame.frameData = value
  28027. const buffer = frame.createFrame(opcodes.BINARY)
  28028. this.#bufferedAmount += value.byteLength
  28029. socket.write(buffer, () => {
  28030. this.#bufferedAmount -= value.byteLength
  28031. })
  28032. })
  28033. }
  28034. }
  28035. get readyState () {
  28036. webidl.brandCheck(this, WebSocket)
  28037. // The readyState getter steps are to return this's ready state.
  28038. return this[kReadyState]
  28039. }
  28040. get bufferedAmount () {
  28041. webidl.brandCheck(this, WebSocket)
  28042. return this.#bufferedAmount
  28043. }
  28044. get url () {
  28045. webidl.brandCheck(this, WebSocket)
  28046. // The url getter steps are to return this's url, serialized.
  28047. return URLSerializer(this[kWebSocketURL])
  28048. }
  28049. get extensions () {
  28050. webidl.brandCheck(this, WebSocket)
  28051. return this.#extensions
  28052. }
  28053. get protocol () {
  28054. webidl.brandCheck(this, WebSocket)
  28055. return this.#protocol
  28056. }
  28057. get onopen () {
  28058. webidl.brandCheck(this, WebSocket)
  28059. return this.#events.open
  28060. }
  28061. set onopen (fn) {
  28062. webidl.brandCheck(this, WebSocket)
  28063. if (this.#events.open) {
  28064. this.removeEventListener('open', this.#events.open)
  28065. }
  28066. if (typeof fn === 'function') {
  28067. this.#events.open = fn
  28068. this.addEventListener('open', fn)
  28069. } else {
  28070. this.#events.open = null
  28071. }
  28072. }
  28073. get onerror () {
  28074. webidl.brandCheck(this, WebSocket)
  28075. return this.#events.error
  28076. }
  28077. set onerror (fn) {
  28078. webidl.brandCheck(this, WebSocket)
  28079. if (this.#events.error) {
  28080. this.removeEventListener('error', this.#events.error)
  28081. }
  28082. if (typeof fn === 'function') {
  28083. this.#events.error = fn
  28084. this.addEventListener('error', fn)
  28085. } else {
  28086. this.#events.error = null
  28087. }
  28088. }
  28089. get onclose () {
  28090. webidl.brandCheck(this, WebSocket)
  28091. return this.#events.close
  28092. }
  28093. set onclose (fn) {
  28094. webidl.brandCheck(this, WebSocket)
  28095. if (this.#events.close) {
  28096. this.removeEventListener('close', this.#events.close)
  28097. }
  28098. if (typeof fn === 'function') {
  28099. this.#events.close = fn
  28100. this.addEventListener('close', fn)
  28101. } else {
  28102. this.#events.close = null
  28103. }
  28104. }
  28105. get onmessage () {
  28106. webidl.brandCheck(this, WebSocket)
  28107. return this.#events.message
  28108. }
  28109. set onmessage (fn) {
  28110. webidl.brandCheck(this, WebSocket)
  28111. if (this.#events.message) {
  28112. this.removeEventListener('message', this.#events.message)
  28113. }
  28114. if (typeof fn === 'function') {
  28115. this.#events.message = fn
  28116. this.addEventListener('message', fn)
  28117. } else {
  28118. this.#events.message = null
  28119. }
  28120. }
  28121. get binaryType () {
  28122. webidl.brandCheck(this, WebSocket)
  28123. return this[kBinaryType]
  28124. }
  28125. set binaryType (type) {
  28126. webidl.brandCheck(this, WebSocket)
  28127. if (type !== 'blob' && type !== 'arraybuffer') {
  28128. this[kBinaryType] = 'blob'
  28129. } else {
  28130. this[kBinaryType] = type
  28131. }
  28132. }
  28133. /**
  28134. * @see https://websockets.spec.whatwg.org/#feedback-from-the-protocol
  28135. */
  28136. #onConnectionEstablished (response) {
  28137. // processResponse is called when the "response’s header list has been received and initialized."
  28138. // once this happens, the connection is open
  28139. this[kResponse] = response
  28140. const parser = new ByteParser(this)
  28141. parser.on('drain', function onParserDrain () {
  28142. this.ws[kResponse].socket.resume()
  28143. })
  28144. response.socket.ws = this
  28145. this[kByteParser] = parser
  28146. // 1. Change the ready state to OPEN (1).
  28147. this[kReadyState] = states.OPEN
  28148. // 2. Change the extensions attribute’s value to the extensions in use, if
  28149. // it is not the null value.
  28150. // https://datatracker.ietf.org/doc/html/rfc6455#section-9.1
  28151. const extensions = response.headersList.get('sec-websocket-extensions')
  28152. if (extensions !== null) {
  28153. this.#extensions = extensions
  28154. }
  28155. // 3. Change the protocol attribute’s value to the subprotocol in use, if
  28156. // it is not the null value.
  28157. // https://datatracker.ietf.org/doc/html/rfc6455#section-1.9
  28158. const protocol = response.headersList.get('sec-websocket-protocol')
  28159. if (protocol !== null) {
  28160. this.#protocol = protocol
  28161. }
  28162. // 4. Fire an event named open at the WebSocket object.
  28163. fireEvent('open', this)
  28164. }
  28165. }
  28166. // https://websockets.spec.whatwg.org/#dom-websocket-connecting
  28167. WebSocket.CONNECTING = WebSocket.prototype.CONNECTING = states.CONNECTING
  28168. // https://websockets.spec.whatwg.org/#dom-websocket-open
  28169. WebSocket.OPEN = WebSocket.prototype.OPEN = states.OPEN
  28170. // https://websockets.spec.whatwg.org/#dom-websocket-closing
  28171. WebSocket.CLOSING = WebSocket.prototype.CLOSING = states.CLOSING
  28172. // https://websockets.spec.whatwg.org/#dom-websocket-closed
  28173. WebSocket.CLOSED = WebSocket.prototype.CLOSED = states.CLOSED
  28174. Object.defineProperties(WebSocket.prototype, {
  28175. CONNECTING: staticPropertyDescriptors,
  28176. OPEN: staticPropertyDescriptors,
  28177. CLOSING: staticPropertyDescriptors,
  28178. CLOSED: staticPropertyDescriptors,
  28179. url: kEnumerableProperty,
  28180. readyState: kEnumerableProperty,
  28181. bufferedAmount: kEnumerableProperty,
  28182. onopen: kEnumerableProperty,
  28183. onerror: kEnumerableProperty,
  28184. onclose: kEnumerableProperty,
  28185. close: kEnumerableProperty,
  28186. onmessage: kEnumerableProperty,
  28187. binaryType: kEnumerableProperty,
  28188. send: kEnumerableProperty,
  28189. extensions: kEnumerableProperty,
  28190. protocol: kEnumerableProperty,
  28191. [Symbol.toStringTag]: {
  28192. value: 'WebSocket',
  28193. writable: false,
  28194. enumerable: false,
  28195. configurable: true
  28196. }
  28197. })
  28198. Object.defineProperties(WebSocket, {
  28199. CONNECTING: staticPropertyDescriptors,
  28200. OPEN: staticPropertyDescriptors,
  28201. CLOSING: staticPropertyDescriptors,
  28202. CLOSED: staticPropertyDescriptors
  28203. })
  28204. webidl.converters['sequence<DOMString>'] = webidl.sequenceConverter(
  28205. webidl.converters.DOMString
  28206. )
  28207. webidl.converters['DOMString or sequence<DOMString>'] = function (V) {
  28208. if (webidl.util.Type(V) === 'Object' && Symbol.iterator in V) {
  28209. return webidl.converters['sequence<DOMString>'](V)
  28210. }
  28211. return webidl.converters.DOMString(V)
  28212. }
  28213. // This implements the propsal made in https://github.com/whatwg/websockets/issues/42
  28214. webidl.converters.WebSocketInit = webidl.dictionaryConverter([
  28215. {
  28216. key: 'protocols',
  28217. converter: webidl.converters['DOMString or sequence<DOMString>'],
  28218. get defaultValue () {
  28219. return []
  28220. }
  28221. },
  28222. {
  28223. key: 'dispatcher',
  28224. converter: (V) => V,
  28225. get defaultValue () {
  28226. return getGlobalDispatcher()
  28227. }
  28228. },
  28229. {
  28230. key: 'headers',
  28231. converter: webidl.nullableConverter(webidl.converters.HeadersInit)
  28232. }
  28233. ])
  28234. webidl.converters['DOMString or sequence<DOMString> or WebSocketInit'] = function (V) {
  28235. if (webidl.util.Type(V) === 'Object' && !(Symbol.iterator in V)) {
  28236. return webidl.converters.WebSocketInit(V)
  28237. }
  28238. return { protocols: webidl.converters['DOMString or sequence<DOMString>'](V) }
  28239. }
  28240. webidl.converters.WebSocketSendData = function (V) {
  28241. if (webidl.util.Type(V) === 'Object') {
  28242. if (isBlobLike(V)) {
  28243. return webidl.converters.Blob(V, { strict: false })
  28244. }
  28245. if (ArrayBuffer.isView(V) || types.isAnyArrayBuffer(V)) {
  28246. return webidl.converters.BufferSource(V)
  28247. }
  28248. }
  28249. return webidl.converters.USVString(V)
  28250. }
  28251. module.exports = {
  28252. WebSocket
  28253. }
  28254. /***/ }),
  28255. /***/ 5030:
  28256. /***/ ((__unused_webpack_module, exports) => {
  28257. Object.defineProperty(exports, "__esModule", ({ value: true }));
  28258. function getUserAgent() {
  28259. if (typeof navigator === "object" && "userAgent" in navigator) {
  28260. return navigator.userAgent;
  28261. }
  28262. if (typeof process === "object" && process.version !== undefined) {
  28263. return `Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`;
  28264. }
  28265. return "<environment undetectable>";
  28266. }
  28267. exports.getUserAgent = getUserAgent;
  28268. //# sourceMappingURL=index.js.map
  28269. /***/ }),
  28270. /***/ 2940:
  28271. /***/ ((module) => {
  28272. // Returns a wrapper function that returns a wrapped callback
  28273. // The wrapper function should do some stuff, and return a
  28274. // presumably different callback function.
  28275. // This makes sure that own properties are retained, so that
  28276. // decorations and such are not lost along the way.
  28277. module.exports = wrappy
  28278. function wrappy (fn, cb) {
  28279. if (fn && cb) return wrappy(fn)(cb)
  28280. if (typeof fn !== 'function')
  28281. throw new TypeError('need wrapper function')
  28282. Object.keys(fn).forEach(function (k) {
  28283. wrapper[k] = fn[k]
  28284. })
  28285. return wrapper
  28286. function wrapper() {
  28287. var args = new Array(arguments.length)
  28288. for (var i = 0; i < args.length; i++) {
  28289. args[i] = arguments[i]
  28290. }
  28291. var ret = fn.apply(this, args)
  28292. var cb = args[args.length-1]
  28293. if (typeof ret === 'function' && ret !== cb) {
  28294. Object.keys(cb).forEach(function (k) {
  28295. ret[k] = cb[k]
  28296. })
  28297. }
  28298. return ret
  28299. }
  28300. }
  28301. /***/ }),
  28302. /***/ 9491:
  28303. /***/ ((module) => {
  28304. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("assert");
  28305. /***/ }),
  28306. /***/ 852:
  28307. /***/ ((module) => {
  28308. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("async_hooks");
  28309. /***/ }),
  28310. /***/ 4300:
  28311. /***/ ((module) => {
  28312. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("buffer");
  28313. /***/ }),
  28314. /***/ 2081:
  28315. /***/ ((module) => {
  28316. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("child_process");
  28317. /***/ }),
  28318. /***/ 6206:
  28319. /***/ ((module) => {
  28320. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("console");
  28321. /***/ }),
  28322. /***/ 6113:
  28323. /***/ ((module) => {
  28324. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("crypto");
  28325. /***/ }),
  28326. /***/ 7643:
  28327. /***/ ((module) => {
  28328. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("diagnostics_channel");
  28329. /***/ }),
  28330. /***/ 2361:
  28331. /***/ ((module) => {
  28332. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("events");
  28333. /***/ }),
  28334. /***/ 7147:
  28335. /***/ ((module) => {
  28336. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("fs");
  28337. /***/ }),
  28338. /***/ 3685:
  28339. /***/ ((module) => {
  28340. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("http");
  28341. /***/ }),
  28342. /***/ 5158:
  28343. /***/ ((module) => {
  28344. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("http2");
  28345. /***/ }),
  28346. /***/ 5687:
  28347. /***/ ((module) => {
  28348. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("https");
  28349. /***/ }),
  28350. /***/ 1808:
  28351. /***/ ((module) => {
  28352. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("net");
  28353. /***/ }),
  28354. /***/ 6005:
  28355. /***/ ((module) => {
  28356. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:crypto");
  28357. /***/ }),
  28358. /***/ 5673:
  28359. /***/ ((module) => {
  28360. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:events");
  28361. /***/ }),
  28362. /***/ 4492:
  28363. /***/ ((module) => {
  28364. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:stream");
  28365. /***/ }),
  28366. /***/ 7261:
  28367. /***/ ((module) => {
  28368. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:util");
  28369. /***/ }),
  28370. /***/ 2037:
  28371. /***/ ((module) => {
  28372. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("os");
  28373. /***/ }),
  28374. /***/ 1017:
  28375. /***/ ((module) => {
  28376. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("path");
  28377. /***/ }),
  28378. /***/ 4074:
  28379. /***/ ((module) => {
  28380. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("perf_hooks");
  28381. /***/ }),
  28382. /***/ 3477:
  28383. /***/ ((module) => {
  28384. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("querystring");
  28385. /***/ }),
  28386. /***/ 2781:
  28387. /***/ ((module) => {
  28388. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("stream");
  28389. /***/ }),
  28390. /***/ 5356:
  28391. /***/ ((module) => {
  28392. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("stream/web");
  28393. /***/ }),
  28394. /***/ 1576:
  28395. /***/ ((module) => {
  28396. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("string_decoder");
  28397. /***/ }),
  28398. /***/ 9512:
  28399. /***/ ((module) => {
  28400. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("timers");
  28401. /***/ }),
  28402. /***/ 4404:
  28403. /***/ ((module) => {
  28404. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("tls");
  28405. /***/ }),
  28406. /***/ 7310:
  28407. /***/ ((module) => {
  28408. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("url");
  28409. /***/ }),
  28410. /***/ 3837:
  28411. /***/ ((module) => {
  28412. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("util");
  28413. /***/ }),
  28414. /***/ 9830:
  28415. /***/ ((module) => {
  28416. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("util/types");
  28417. /***/ }),
  28418. /***/ 1267:
  28419. /***/ ((module) => {
  28420. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("worker_threads");
  28421. /***/ }),
  28422. /***/ 9796:
  28423. /***/ ((module) => {
  28424. module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("zlib");
  28425. /***/ }),
  28426. /***/ 2960:
  28427. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  28428. const WritableStream = (__nccwpck_require__(4492).Writable)
  28429. const inherits = (__nccwpck_require__(7261).inherits)
  28430. const StreamSearch = __nccwpck_require__(1142)
  28431. const PartStream = __nccwpck_require__(1620)
  28432. const HeaderParser = __nccwpck_require__(2032)
  28433. const DASH = 45
  28434. const B_ONEDASH = Buffer.from('-')
  28435. const B_CRLF = Buffer.from('\r\n')
  28436. const EMPTY_FN = function () {}
  28437. function Dicer (cfg) {
  28438. if (!(this instanceof Dicer)) { return new Dicer(cfg) }
  28439. WritableStream.call(this, cfg)
  28440. if (!cfg || (!cfg.headerFirst && typeof cfg.boundary !== 'string')) { throw new TypeError('Boundary required') }
  28441. if (typeof cfg.boundary === 'string') { this.setBoundary(cfg.boundary) } else { this._bparser = undefined }
  28442. this._headerFirst = cfg.headerFirst
  28443. this._dashes = 0
  28444. this._parts = 0
  28445. this._finished = false
  28446. this._realFinish = false
  28447. this._isPreamble = true
  28448. this._justMatched = false
  28449. this._firstWrite = true
  28450. this._inHeader = true
  28451. this._part = undefined
  28452. this._cb = undefined
  28453. this._ignoreData = false
  28454. this._partOpts = { highWaterMark: cfg.partHwm }
  28455. this._pause = false
  28456. const self = this
  28457. this._hparser = new HeaderParser(cfg)
  28458. this._hparser.on('header', function (header) {
  28459. self._inHeader = false
  28460. self._part.emit('header', header)
  28461. })
  28462. }
  28463. inherits(Dicer, WritableStream)
  28464. Dicer.prototype.emit = function (ev) {
  28465. if (ev === 'finish' && !this._realFinish) {
  28466. if (!this._finished) {
  28467. const self = this
  28468. process.nextTick(function () {
  28469. self.emit('error', new Error('Unexpected end of multipart data'))
  28470. if (self._part && !self._ignoreData) {
  28471. const type = (self._isPreamble ? 'Preamble' : 'Part')
  28472. self._part.emit('error', new Error(type + ' terminated early due to unexpected end of multipart data'))
  28473. self._part.push(null)
  28474. process.nextTick(function () {
  28475. self._realFinish = true
  28476. self.emit('finish')
  28477. self._realFinish = false
  28478. })
  28479. return
  28480. }
  28481. self._realFinish = true
  28482. self.emit('finish')
  28483. self._realFinish = false
  28484. })
  28485. }
  28486. } else { WritableStream.prototype.emit.apply(this, arguments) }
  28487. }
  28488. Dicer.prototype._write = function (data, encoding, cb) {
  28489. // ignore unexpected data (e.g. extra trailer data after finished)
  28490. if (!this._hparser && !this._bparser) { return cb() }
  28491. if (this._headerFirst && this._isPreamble) {
  28492. if (!this._part) {
  28493. this._part = new PartStream(this._partOpts)
  28494. if (this.listenerCount('preamble') !== 0) { this.emit('preamble', this._part) } else { this._ignore() }
  28495. }
  28496. const r = this._hparser.push(data)
  28497. if (!this._inHeader && r !== undefined && r < data.length) { data = data.slice(r) } else { return cb() }
  28498. }
  28499. // allows for "easier" testing
  28500. if (this._firstWrite) {
  28501. this._bparser.push(B_CRLF)
  28502. this._firstWrite = false
  28503. }
  28504. this._bparser.push(data)
  28505. if (this._pause) { this._cb = cb } else { cb() }
  28506. }
  28507. Dicer.prototype.reset = function () {
  28508. this._part = undefined
  28509. this._bparser = undefined
  28510. this._hparser = undefined
  28511. }
  28512. Dicer.prototype.setBoundary = function (boundary) {
  28513. const self = this
  28514. this._bparser = new StreamSearch('\r\n--' + boundary)
  28515. this._bparser.on('info', function (isMatch, data, start, end) {
  28516. self._oninfo(isMatch, data, start, end)
  28517. })
  28518. }
  28519. Dicer.prototype._ignore = function () {
  28520. if (this._part && !this._ignoreData) {
  28521. this._ignoreData = true
  28522. this._part.on('error', EMPTY_FN)
  28523. // we must perform some kind of read on the stream even though we are
  28524. // ignoring the data, otherwise node's Readable stream will not emit 'end'
  28525. // after pushing null to the stream
  28526. this._part.resume()
  28527. }
  28528. }
  28529. Dicer.prototype._oninfo = function (isMatch, data, start, end) {
  28530. let buf; const self = this; let i = 0; let r; let shouldWriteMore = true
  28531. if (!this._part && this._justMatched && data) {
  28532. while (this._dashes < 2 && (start + i) < end) {
  28533. if (data[start + i] === DASH) {
  28534. ++i
  28535. ++this._dashes
  28536. } else {
  28537. if (this._dashes) { buf = B_ONEDASH }
  28538. this._dashes = 0
  28539. break
  28540. }
  28541. }
  28542. if (this._dashes === 2) {
  28543. if ((start + i) < end && this.listenerCount('trailer') !== 0) { this.emit('trailer', data.slice(start + i, end)) }
  28544. this.reset()
  28545. this._finished = true
  28546. // no more parts will be added
  28547. if (self._parts === 0) {
  28548. self._realFinish = true
  28549. self.emit('finish')
  28550. self._realFinish = false
  28551. }
  28552. }
  28553. if (this._dashes) { return }
  28554. }
  28555. if (this._justMatched) { this._justMatched = false }
  28556. if (!this._part) {
  28557. this._part = new PartStream(this._partOpts)
  28558. this._part._read = function (n) {
  28559. self._unpause()
  28560. }
  28561. if (this._isPreamble && this.listenerCount('preamble') !== 0) {
  28562. this.emit('preamble', this._part)
  28563. } else if (this._isPreamble !== true && this.listenerCount('part') !== 0) {
  28564. this.emit('part', this._part)
  28565. } else {
  28566. this._ignore()
  28567. }
  28568. if (!this._isPreamble) { this._inHeader = true }
  28569. }
  28570. if (data && start < end && !this._ignoreData) {
  28571. if (this._isPreamble || !this._inHeader) {
  28572. if (buf) { shouldWriteMore = this._part.push(buf) }
  28573. shouldWriteMore = this._part.push(data.slice(start, end))
  28574. if (!shouldWriteMore) { this._pause = true }
  28575. } else if (!this._isPreamble && this._inHeader) {
  28576. if (buf) { this._hparser.push(buf) }
  28577. r = this._hparser.push(data.slice(start, end))
  28578. if (!this._inHeader && r !== undefined && r < end) { this._oninfo(false, data, start + r, end) }
  28579. }
  28580. }
  28581. if (isMatch) {
  28582. this._hparser.reset()
  28583. if (this._isPreamble) { this._isPreamble = false } else {
  28584. if (start !== end) {
  28585. ++this._parts
  28586. this._part.on('end', function () {
  28587. if (--self._parts === 0) {
  28588. if (self._finished) {
  28589. self._realFinish = true
  28590. self.emit('finish')
  28591. self._realFinish = false
  28592. } else {
  28593. self._unpause()
  28594. }
  28595. }
  28596. })
  28597. }
  28598. }
  28599. this._part.push(null)
  28600. this._part = undefined
  28601. this._ignoreData = false
  28602. this._justMatched = true
  28603. this._dashes = 0
  28604. }
  28605. }
  28606. Dicer.prototype._unpause = function () {
  28607. if (!this._pause) { return }
  28608. this._pause = false
  28609. if (this._cb) {
  28610. const cb = this._cb
  28611. this._cb = undefined
  28612. cb()
  28613. }
  28614. }
  28615. module.exports = Dicer
  28616. /***/ }),
  28617. /***/ 2032:
  28618. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  28619. const EventEmitter = (__nccwpck_require__(5673).EventEmitter)
  28620. const inherits = (__nccwpck_require__(7261).inherits)
  28621. const getLimit = __nccwpck_require__(1467)
  28622. const StreamSearch = __nccwpck_require__(1142)
  28623. const B_DCRLF = Buffer.from('\r\n\r\n')
  28624. const RE_CRLF = /\r\n/g
  28625. const RE_HDR = /^([^:]+):[ \t]?([\x00-\xFF]+)?$/ // eslint-disable-line no-control-regex
  28626. function HeaderParser (cfg) {
  28627. EventEmitter.call(this)
  28628. cfg = cfg || {}
  28629. const self = this
  28630. this.nread = 0
  28631. this.maxed = false
  28632. this.npairs = 0
  28633. this.maxHeaderPairs = getLimit(cfg, 'maxHeaderPairs', 2000)
  28634. this.maxHeaderSize = getLimit(cfg, 'maxHeaderSize', 80 * 1024)
  28635. this.buffer = ''
  28636. this.header = {}
  28637. this.finished = false
  28638. this.ss = new StreamSearch(B_DCRLF)
  28639. this.ss.on('info', function (isMatch, data, start, end) {
  28640. if (data && !self.maxed) {
  28641. if (self.nread + end - start >= self.maxHeaderSize) {
  28642. end = self.maxHeaderSize - self.nread + start
  28643. self.nread = self.maxHeaderSize
  28644. self.maxed = true
  28645. } else { self.nread += (end - start) }
  28646. self.buffer += data.toString('binary', start, end)
  28647. }
  28648. if (isMatch) { self._finish() }
  28649. })
  28650. }
  28651. inherits(HeaderParser, EventEmitter)
  28652. HeaderParser.prototype.push = function (data) {
  28653. const r = this.ss.push(data)
  28654. if (this.finished) { return r }
  28655. }
  28656. HeaderParser.prototype.reset = function () {
  28657. this.finished = false
  28658. this.buffer = ''
  28659. this.header = {}
  28660. this.ss.reset()
  28661. }
  28662. HeaderParser.prototype._finish = function () {
  28663. if (this.buffer) { this._parseHeader() }
  28664. this.ss.matches = this.ss.maxMatches
  28665. const header = this.header
  28666. this.header = {}
  28667. this.buffer = ''
  28668. this.finished = true
  28669. this.nread = this.npairs = 0
  28670. this.maxed = false
  28671. this.emit('header', header)
  28672. }
  28673. HeaderParser.prototype._parseHeader = function () {
  28674. if (this.npairs === this.maxHeaderPairs) { return }
  28675. const lines = this.buffer.split(RE_CRLF)
  28676. const len = lines.length
  28677. let m, h
  28678. for (var i = 0; i < len; ++i) { // eslint-disable-line no-var
  28679. if (lines[i].length === 0) { continue }
  28680. if (lines[i][0] === '\t' || lines[i][0] === ' ') {
  28681. // folded header content
  28682. // RFC2822 says to just remove the CRLF and not the whitespace following
  28683. // it, so we follow the RFC and include the leading whitespace ...
  28684. if (h) {
  28685. this.header[h][this.header[h].length - 1] += lines[i]
  28686. continue
  28687. }
  28688. }
  28689. const posColon = lines[i].indexOf(':')
  28690. if (
  28691. posColon === -1 ||
  28692. posColon === 0
  28693. ) {
  28694. return
  28695. }
  28696. m = RE_HDR.exec(lines[i])
  28697. h = m[1].toLowerCase()
  28698. this.header[h] = this.header[h] || []
  28699. this.header[h].push((m[2] || ''))
  28700. if (++this.npairs === this.maxHeaderPairs) { break }
  28701. }
  28702. }
  28703. module.exports = HeaderParser
  28704. /***/ }),
  28705. /***/ 1620:
  28706. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  28707. const inherits = (__nccwpck_require__(7261).inherits)
  28708. const ReadableStream = (__nccwpck_require__(4492).Readable)
  28709. function PartStream (opts) {
  28710. ReadableStream.call(this, opts)
  28711. }
  28712. inherits(PartStream, ReadableStream)
  28713. PartStream.prototype._read = function (n) {}
  28714. module.exports = PartStream
  28715. /***/ }),
  28716. /***/ 1142:
  28717. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  28718. /**
  28719. * Copyright Brian White. All rights reserved.
  28720. *
  28721. * @see https://github.com/mscdex/streamsearch
  28722. *
  28723. * Permission is hereby granted, free of charge, to any person obtaining a copy
  28724. * of this software and associated documentation files (the "Software"), to
  28725. * deal in the Software without restriction, including without limitation the
  28726. * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  28727. * sell copies of the Software, and to permit persons to whom the Software is
  28728. * furnished to do so, subject to the following conditions:
  28729. *
  28730. * The above copyright notice and this permission notice shall be included in
  28731. * all copies or substantial portions of the Software.
  28732. *
  28733. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  28734. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  28735. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  28736. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  28737. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  28738. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  28739. * IN THE SOFTWARE.
  28740. *
  28741. * Based heavily on the Streaming Boyer-Moore-Horspool C++ implementation
  28742. * by Hongli Lai at: https://github.com/FooBarWidget/boyer-moore-horspool
  28743. */
  28744. const EventEmitter = (__nccwpck_require__(5673).EventEmitter)
  28745. const inherits = (__nccwpck_require__(7261).inherits)
  28746. function SBMH (needle) {
  28747. if (typeof needle === 'string') {
  28748. needle = Buffer.from(needle)
  28749. }
  28750. if (!Buffer.isBuffer(needle)) {
  28751. throw new TypeError('The needle has to be a String or a Buffer.')
  28752. }
  28753. const needleLength = needle.length
  28754. if (needleLength === 0) {
  28755. throw new Error('The needle cannot be an empty String/Buffer.')
  28756. }
  28757. if (needleLength > 256) {
  28758. throw new Error('The needle cannot have a length bigger than 256.')
  28759. }
  28760. this.maxMatches = Infinity
  28761. this.matches = 0
  28762. this._occ = new Array(256)
  28763. .fill(needleLength) // Initialize occurrence table.
  28764. this._lookbehind_size = 0
  28765. this._needle = needle
  28766. this._bufpos = 0
  28767. this._lookbehind = Buffer.alloc(needleLength)
  28768. // Populate occurrence table with analysis of the needle,
  28769. // ignoring last letter.
  28770. for (var i = 0; i < needleLength - 1; ++i) { // eslint-disable-line no-var
  28771. this._occ[needle[i]] = needleLength - 1 - i
  28772. }
  28773. }
  28774. inherits(SBMH, EventEmitter)
  28775. SBMH.prototype.reset = function () {
  28776. this._lookbehind_size = 0
  28777. this.matches = 0
  28778. this._bufpos = 0
  28779. }
  28780. SBMH.prototype.push = function (chunk, pos) {
  28781. if (!Buffer.isBuffer(chunk)) {
  28782. chunk = Buffer.from(chunk, 'binary')
  28783. }
  28784. const chlen = chunk.length
  28785. this._bufpos = pos || 0
  28786. let r
  28787. while (r !== chlen && this.matches < this.maxMatches) { r = this._sbmh_feed(chunk) }
  28788. return r
  28789. }
  28790. SBMH.prototype._sbmh_feed = function (data) {
  28791. const len = data.length
  28792. const needle = this._needle
  28793. const needleLength = needle.length
  28794. const lastNeedleChar = needle[needleLength - 1]
  28795. // Positive: points to a position in `data`
  28796. // pos == 3 points to data[3]
  28797. // Negative: points to a position in the lookbehind buffer
  28798. // pos == -2 points to lookbehind[lookbehind_size - 2]
  28799. let pos = -this._lookbehind_size
  28800. let ch
  28801. if (pos < 0) {
  28802. // Lookbehind buffer is not empty. Perform Boyer-Moore-Horspool
  28803. // search with character lookup code that considers both the
  28804. // lookbehind buffer and the current round's haystack data.
  28805. //
  28806. // Loop until
  28807. // there is a match.
  28808. // or until
  28809. // we've moved past the position that requires the
  28810. // lookbehind buffer. In this case we switch to the
  28811. // optimized loop.
  28812. // or until
  28813. // the character to look at lies outside the haystack.
  28814. while (pos < 0 && pos <= len - needleLength) {
  28815. ch = this._sbmh_lookup_char(data, pos + needleLength - 1)
  28816. if (
  28817. ch === lastNeedleChar &&
  28818. this._sbmh_memcmp(data, pos, needleLength - 1)
  28819. ) {
  28820. this._lookbehind_size = 0
  28821. ++this.matches
  28822. this.emit('info', true)
  28823. return (this._bufpos = pos + needleLength)
  28824. }
  28825. pos += this._occ[ch]
  28826. }
  28827. // No match.
  28828. if (pos < 0) {
  28829. // There's too few data for Boyer-Moore-Horspool to run,
  28830. // so let's use a different algorithm to skip as much as
  28831. // we can.
  28832. // Forward pos until
  28833. // the trailing part of lookbehind + data
  28834. // looks like the beginning of the needle
  28835. // or until
  28836. // pos == 0
  28837. while (pos < 0 && !this._sbmh_memcmp(data, pos, len - pos)) { ++pos }
  28838. }
  28839. if (pos >= 0) {
  28840. // Discard lookbehind buffer.
  28841. this.emit('info', false, this._lookbehind, 0, this._lookbehind_size)
  28842. this._lookbehind_size = 0
  28843. } else {
  28844. // Cut off part of the lookbehind buffer that has
  28845. // been processed and append the entire haystack
  28846. // into it.
  28847. const bytesToCutOff = this._lookbehind_size + pos
  28848. if (bytesToCutOff > 0) {
  28849. // The cut off data is guaranteed not to contain the needle.
  28850. this.emit('info', false, this._lookbehind, 0, bytesToCutOff)
  28851. }
  28852. this._lookbehind.copy(this._lookbehind, 0, bytesToCutOff,
  28853. this._lookbehind_size - bytesToCutOff)
  28854. this._lookbehind_size -= bytesToCutOff
  28855. data.copy(this._lookbehind, this._lookbehind_size)
  28856. this._lookbehind_size += len
  28857. this._bufpos = len
  28858. return len
  28859. }
  28860. }
  28861. pos += (pos >= 0) * this._bufpos
  28862. // Lookbehind buffer is now empty. We only need to check if the
  28863. // needle is in the haystack.
  28864. if (data.indexOf(needle, pos) !== -1) {
  28865. pos = data.indexOf(needle, pos)
  28866. ++this.matches
  28867. if (pos > 0) { this.emit('info', true, data, this._bufpos, pos) } else { this.emit('info', true) }
  28868. return (this._bufpos = pos + needleLength)
  28869. } else {
  28870. pos = len - needleLength
  28871. }
  28872. // There was no match. If there's trailing haystack data that we cannot
  28873. // match yet using the Boyer-Moore-Horspool algorithm (because the trailing
  28874. // data is less than the needle size) then match using a modified
  28875. // algorithm that starts matching from the beginning instead of the end.
  28876. // Whatever trailing data is left after running this algorithm is added to
  28877. // the lookbehind buffer.
  28878. while (
  28879. pos < len &&
  28880. (
  28881. data[pos] !== needle[0] ||
  28882. (
  28883. (Buffer.compare(
  28884. data.subarray(pos, pos + len - pos),
  28885. needle.subarray(0, len - pos)
  28886. ) !== 0)
  28887. )
  28888. )
  28889. ) {
  28890. ++pos
  28891. }
  28892. if (pos < len) {
  28893. data.copy(this._lookbehind, 0, pos, pos + (len - pos))
  28894. this._lookbehind_size = len - pos
  28895. }
  28896. // Everything until pos is guaranteed not to contain needle data.
  28897. if (pos > 0) { this.emit('info', false, data, this._bufpos, pos < len ? pos : len) }
  28898. this._bufpos = len
  28899. return len
  28900. }
  28901. SBMH.prototype._sbmh_lookup_char = function (data, pos) {
  28902. return (pos < 0)
  28903. ? this._lookbehind[this._lookbehind_size + pos]
  28904. : data[pos]
  28905. }
  28906. SBMH.prototype._sbmh_memcmp = function (data, pos, len) {
  28907. for (var i = 0; i < len; ++i) { // eslint-disable-line no-var
  28908. if (this._sbmh_lookup_char(data, pos + i) !== this._needle[i]) { return false }
  28909. }
  28910. return true
  28911. }
  28912. module.exports = SBMH
  28913. /***/ }),
  28914. /***/ 727:
  28915. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  28916. const WritableStream = (__nccwpck_require__(4492).Writable)
  28917. const { inherits } = __nccwpck_require__(7261)
  28918. const Dicer = __nccwpck_require__(2960)
  28919. const MultipartParser = __nccwpck_require__(2183)
  28920. const UrlencodedParser = __nccwpck_require__(8306)
  28921. const parseParams = __nccwpck_require__(1854)
  28922. function Busboy (opts) {
  28923. if (!(this instanceof Busboy)) { return new Busboy(opts) }
  28924. if (typeof opts !== 'object') {
  28925. throw new TypeError('Busboy expected an options-Object.')
  28926. }
  28927. if (typeof opts.headers !== 'object') {
  28928. throw new TypeError('Busboy expected an options-Object with headers-attribute.')
  28929. }
  28930. if (typeof opts.headers['content-type'] !== 'string') {
  28931. throw new TypeError('Missing Content-Type-header.')
  28932. }
  28933. const {
  28934. headers,
  28935. ...streamOptions
  28936. } = opts
  28937. this.opts = {
  28938. autoDestroy: false,
  28939. ...streamOptions
  28940. }
  28941. WritableStream.call(this, this.opts)
  28942. this._done = false
  28943. this._parser = this.getParserByHeaders(headers)
  28944. this._finished = false
  28945. }
  28946. inherits(Busboy, WritableStream)
  28947. Busboy.prototype.emit = function (ev) {
  28948. if (ev === 'finish') {
  28949. if (!this._done) {
  28950. this._parser?.end()
  28951. return
  28952. } else if (this._finished) {
  28953. return
  28954. }
  28955. this._finished = true
  28956. }
  28957. WritableStream.prototype.emit.apply(this, arguments)
  28958. }
  28959. Busboy.prototype.getParserByHeaders = function (headers) {
  28960. const parsed = parseParams(headers['content-type'])
  28961. const cfg = {
  28962. defCharset: this.opts.defCharset,
  28963. fileHwm: this.opts.fileHwm,
  28964. headers,
  28965. highWaterMark: this.opts.highWaterMark,
  28966. isPartAFile: this.opts.isPartAFile,
  28967. limits: this.opts.limits,
  28968. parsedConType: parsed,
  28969. preservePath: this.opts.preservePath
  28970. }
  28971. if (MultipartParser.detect.test(parsed[0])) {
  28972. return new MultipartParser(this, cfg)
  28973. }
  28974. if (UrlencodedParser.detect.test(parsed[0])) {
  28975. return new UrlencodedParser(this, cfg)
  28976. }
  28977. throw new Error('Unsupported Content-Type.')
  28978. }
  28979. Busboy.prototype._write = function (chunk, encoding, cb) {
  28980. this._parser.write(chunk, cb)
  28981. }
  28982. module.exports = Busboy
  28983. module.exports["default"] = Busboy
  28984. module.exports.Busboy = Busboy
  28985. module.exports.Dicer = Dicer
  28986. /***/ }),
  28987. /***/ 2183:
  28988. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  28989. // TODO:
  28990. // * support 1 nested multipart level
  28991. // (see second multipart example here:
  28992. // http://www.w3.org/TR/html401/interact/forms.html#didx-multipartform-data)
  28993. // * support limits.fieldNameSize
  28994. // -- this will require modifications to utils.parseParams
  28995. const { Readable } = __nccwpck_require__(4492)
  28996. const { inherits } = __nccwpck_require__(7261)
  28997. const Dicer = __nccwpck_require__(2960)
  28998. const parseParams = __nccwpck_require__(1854)
  28999. const decodeText = __nccwpck_require__(4619)
  29000. const basename = __nccwpck_require__(8647)
  29001. const getLimit = __nccwpck_require__(1467)
  29002. const RE_BOUNDARY = /^boundary$/i
  29003. const RE_FIELD = /^form-data$/i
  29004. const RE_CHARSET = /^charset$/i
  29005. const RE_FILENAME = /^filename$/i
  29006. const RE_NAME = /^name$/i
  29007. Multipart.detect = /^multipart\/form-data/i
  29008. function Multipart (boy, cfg) {
  29009. let i
  29010. let len
  29011. const self = this
  29012. let boundary
  29013. const limits = cfg.limits
  29014. const isPartAFile = cfg.isPartAFile || ((fieldName, contentType, fileName) => (contentType === 'application/octet-stream' || fileName !== undefined))
  29015. const parsedConType = cfg.parsedConType || []
  29016. const defCharset = cfg.defCharset || 'utf8'
  29017. const preservePath = cfg.preservePath
  29018. const fileOpts = { highWaterMark: cfg.fileHwm }
  29019. for (i = 0, len = parsedConType.length; i < len; ++i) {
  29020. if (Array.isArray(parsedConType[i]) &&
  29021. RE_BOUNDARY.test(parsedConType[i][0])) {
  29022. boundary = parsedConType[i][1]
  29023. break
  29024. }
  29025. }
  29026. function checkFinished () {
  29027. if (nends === 0 && finished && !boy._done) {
  29028. finished = false
  29029. self.end()
  29030. }
  29031. }
  29032. if (typeof boundary !== 'string') { throw new Error('Multipart: Boundary not found') }
  29033. const fieldSizeLimit = getLimit(limits, 'fieldSize', 1 * 1024 * 1024)
  29034. const fileSizeLimit = getLimit(limits, 'fileSize', Infinity)
  29035. const filesLimit = getLimit(limits, 'files', Infinity)
  29036. const fieldsLimit = getLimit(limits, 'fields', Infinity)
  29037. const partsLimit = getLimit(limits, 'parts', Infinity)
  29038. const headerPairsLimit = getLimit(limits, 'headerPairs', 2000)
  29039. const headerSizeLimit = getLimit(limits, 'headerSize', 80 * 1024)
  29040. let nfiles = 0
  29041. let nfields = 0
  29042. let nends = 0
  29043. let curFile
  29044. let curField
  29045. let finished = false
  29046. this._needDrain = false
  29047. this._pause = false
  29048. this._cb = undefined
  29049. this._nparts = 0
  29050. this._boy = boy
  29051. const parserCfg = {
  29052. boundary,
  29053. maxHeaderPairs: headerPairsLimit,
  29054. maxHeaderSize: headerSizeLimit,
  29055. partHwm: fileOpts.highWaterMark,
  29056. highWaterMark: cfg.highWaterMark
  29057. }
  29058. this.parser = new Dicer(parserCfg)
  29059. this.parser.on('drain', function () {
  29060. self._needDrain = false
  29061. if (self._cb && !self._pause) {
  29062. const cb = self._cb
  29063. self._cb = undefined
  29064. cb()
  29065. }
  29066. }).on('part', function onPart (part) {
  29067. if (++self._nparts > partsLimit) {
  29068. self.parser.removeListener('part', onPart)
  29069. self.parser.on('part', skipPart)
  29070. boy.hitPartsLimit = true
  29071. boy.emit('partsLimit')
  29072. return skipPart(part)
  29073. }
  29074. // hack because streams2 _always_ doesn't emit 'end' until nextTick, so let
  29075. // us emit 'end' early since we know the part has ended if we are already
  29076. // seeing the next part
  29077. if (curField) {
  29078. const field = curField
  29079. field.emit('end')
  29080. field.removeAllListeners('end')
  29081. }
  29082. part.on('header', function (header) {
  29083. let contype
  29084. let fieldname
  29085. let parsed
  29086. let charset
  29087. let encoding
  29088. let filename
  29089. let nsize = 0
  29090. if (header['content-type']) {
  29091. parsed = parseParams(header['content-type'][0])
  29092. if (parsed[0]) {
  29093. contype = parsed[0].toLowerCase()
  29094. for (i = 0, len = parsed.length; i < len; ++i) {
  29095. if (RE_CHARSET.test(parsed[i][0])) {
  29096. charset = parsed[i][1].toLowerCase()
  29097. break
  29098. }
  29099. }
  29100. }
  29101. }
  29102. if (contype === undefined) { contype = 'text/plain' }
  29103. if (charset === undefined) { charset = defCharset }
  29104. if (header['content-disposition']) {
  29105. parsed = parseParams(header['content-disposition'][0])
  29106. if (!RE_FIELD.test(parsed[0])) { return skipPart(part) }
  29107. for (i = 0, len = parsed.length; i < len; ++i) {
  29108. if (RE_NAME.test(parsed[i][0])) {
  29109. fieldname = parsed[i][1]
  29110. } else if (RE_FILENAME.test(parsed[i][0])) {
  29111. filename = parsed[i][1]
  29112. if (!preservePath) { filename = basename(filename) }
  29113. }
  29114. }
  29115. } else { return skipPart(part) }
  29116. if (header['content-transfer-encoding']) { encoding = header['content-transfer-encoding'][0].toLowerCase() } else { encoding = '7bit' }
  29117. let onData,
  29118. onEnd
  29119. if (isPartAFile(fieldname, contype, filename)) {
  29120. // file/binary field
  29121. if (nfiles === filesLimit) {
  29122. if (!boy.hitFilesLimit) {
  29123. boy.hitFilesLimit = true
  29124. boy.emit('filesLimit')
  29125. }
  29126. return skipPart(part)
  29127. }
  29128. ++nfiles
  29129. if (boy.listenerCount('file') === 0) {
  29130. self.parser._ignore()
  29131. return
  29132. }
  29133. ++nends
  29134. const file = new FileStream(fileOpts)
  29135. curFile = file
  29136. file.on('end', function () {
  29137. --nends
  29138. self._pause = false
  29139. checkFinished()
  29140. if (self._cb && !self._needDrain) {
  29141. const cb = self._cb
  29142. self._cb = undefined
  29143. cb()
  29144. }
  29145. })
  29146. file._read = function (n) {
  29147. if (!self._pause) { return }
  29148. self._pause = false
  29149. if (self._cb && !self._needDrain) {
  29150. const cb = self._cb
  29151. self._cb = undefined
  29152. cb()
  29153. }
  29154. }
  29155. boy.emit('file', fieldname, file, filename, encoding, contype)
  29156. onData = function (data) {
  29157. if ((nsize += data.length) > fileSizeLimit) {
  29158. const extralen = fileSizeLimit - nsize + data.length
  29159. if (extralen > 0) { file.push(data.slice(0, extralen)) }
  29160. file.truncated = true
  29161. file.bytesRead = fileSizeLimit
  29162. part.removeAllListeners('data')
  29163. file.emit('limit')
  29164. return
  29165. } else if (!file.push(data)) { self._pause = true }
  29166. file.bytesRead = nsize
  29167. }
  29168. onEnd = function () {
  29169. curFile = undefined
  29170. file.push(null)
  29171. }
  29172. } else {
  29173. // non-file field
  29174. if (nfields === fieldsLimit) {
  29175. if (!boy.hitFieldsLimit) {
  29176. boy.hitFieldsLimit = true
  29177. boy.emit('fieldsLimit')
  29178. }
  29179. return skipPart(part)
  29180. }
  29181. ++nfields
  29182. ++nends
  29183. let buffer = ''
  29184. let truncated = false
  29185. curField = part
  29186. onData = function (data) {
  29187. if ((nsize += data.length) > fieldSizeLimit) {
  29188. const extralen = (fieldSizeLimit - (nsize - data.length))
  29189. buffer += data.toString('binary', 0, extralen)
  29190. truncated = true
  29191. part.removeAllListeners('data')
  29192. } else { buffer += data.toString('binary') }
  29193. }
  29194. onEnd = function () {
  29195. curField = undefined
  29196. if (buffer.length) { buffer = decodeText(buffer, 'binary', charset) }
  29197. boy.emit('field', fieldname, buffer, false, truncated, encoding, contype)
  29198. --nends
  29199. checkFinished()
  29200. }
  29201. }
  29202. /* As of node@2efe4ab761666 (v0.10.29+/v0.11.14+), busboy had become
  29203. broken. Streams2/streams3 is a huge black box of confusion, but
  29204. somehow overriding the sync state seems to fix things again (and still
  29205. seems to work for previous node versions).
  29206. */
  29207. part._readableState.sync = false
  29208. part.on('data', onData)
  29209. part.on('end', onEnd)
  29210. }).on('error', function (err) {
  29211. if (curFile) { curFile.emit('error', err) }
  29212. })
  29213. }).on('error', function (err) {
  29214. boy.emit('error', err)
  29215. }).on('finish', function () {
  29216. finished = true
  29217. checkFinished()
  29218. })
  29219. }
  29220. Multipart.prototype.write = function (chunk, cb) {
  29221. const r = this.parser.write(chunk)
  29222. if (r && !this._pause) {
  29223. cb()
  29224. } else {
  29225. this._needDrain = !r
  29226. this._cb = cb
  29227. }
  29228. }
  29229. Multipart.prototype.end = function () {
  29230. const self = this
  29231. if (self.parser.writable) {
  29232. self.parser.end()
  29233. } else if (!self._boy._done) {
  29234. process.nextTick(function () {
  29235. self._boy._done = true
  29236. self._boy.emit('finish')
  29237. })
  29238. }
  29239. }
  29240. function skipPart (part) {
  29241. part.resume()
  29242. }
  29243. function FileStream (opts) {
  29244. Readable.call(this, opts)
  29245. this.bytesRead = 0
  29246. this.truncated = false
  29247. }
  29248. inherits(FileStream, Readable)
  29249. FileStream.prototype._read = function (n) {}
  29250. module.exports = Multipart
  29251. /***/ }),
  29252. /***/ 8306:
  29253. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  29254. const Decoder = __nccwpck_require__(7100)
  29255. const decodeText = __nccwpck_require__(4619)
  29256. const getLimit = __nccwpck_require__(1467)
  29257. const RE_CHARSET = /^charset$/i
  29258. UrlEncoded.detect = /^application\/x-www-form-urlencoded/i
  29259. function UrlEncoded (boy, cfg) {
  29260. const limits = cfg.limits
  29261. const parsedConType = cfg.parsedConType
  29262. this.boy = boy
  29263. this.fieldSizeLimit = getLimit(limits, 'fieldSize', 1 * 1024 * 1024)
  29264. this.fieldNameSizeLimit = getLimit(limits, 'fieldNameSize', 100)
  29265. this.fieldsLimit = getLimit(limits, 'fields', Infinity)
  29266. let charset
  29267. for (var i = 0, len = parsedConType.length; i < len; ++i) { // eslint-disable-line no-var
  29268. if (Array.isArray(parsedConType[i]) &&
  29269. RE_CHARSET.test(parsedConType[i][0])) {
  29270. charset = parsedConType[i][1].toLowerCase()
  29271. break
  29272. }
  29273. }
  29274. if (charset === undefined) { charset = cfg.defCharset || 'utf8' }
  29275. this.decoder = new Decoder()
  29276. this.charset = charset
  29277. this._fields = 0
  29278. this._state = 'key'
  29279. this._checkingBytes = true
  29280. this._bytesKey = 0
  29281. this._bytesVal = 0
  29282. this._key = ''
  29283. this._val = ''
  29284. this._keyTrunc = false
  29285. this._valTrunc = false
  29286. this._hitLimit = false
  29287. }
  29288. UrlEncoded.prototype.write = function (data, cb) {
  29289. if (this._fields === this.fieldsLimit) {
  29290. if (!this.boy.hitFieldsLimit) {
  29291. this.boy.hitFieldsLimit = true
  29292. this.boy.emit('fieldsLimit')
  29293. }
  29294. return cb()
  29295. }
  29296. let idxeq; let idxamp; let i; let p = 0; const len = data.length
  29297. while (p < len) {
  29298. if (this._state === 'key') {
  29299. idxeq = idxamp = undefined
  29300. for (i = p; i < len; ++i) {
  29301. if (!this._checkingBytes) { ++p }
  29302. if (data[i] === 0x3D/* = */) {
  29303. idxeq = i
  29304. break
  29305. } else if (data[i] === 0x26/* & */) {
  29306. idxamp = i
  29307. break
  29308. }
  29309. if (this._checkingBytes && this._bytesKey === this.fieldNameSizeLimit) {
  29310. this._hitLimit = true
  29311. break
  29312. } else if (this._checkingBytes) { ++this._bytesKey }
  29313. }
  29314. if (idxeq !== undefined) {
  29315. // key with assignment
  29316. if (idxeq > p) { this._key += this.decoder.write(data.toString('binary', p, idxeq)) }
  29317. this._state = 'val'
  29318. this._hitLimit = false
  29319. this._checkingBytes = true
  29320. this._val = ''
  29321. this._bytesVal = 0
  29322. this._valTrunc = false
  29323. this.decoder.reset()
  29324. p = idxeq + 1
  29325. } else if (idxamp !== undefined) {
  29326. // key with no assignment
  29327. ++this._fields
  29328. let key; const keyTrunc = this._keyTrunc
  29329. if (idxamp > p) { key = (this._key += this.decoder.write(data.toString('binary', p, idxamp))) } else { key = this._key }
  29330. this._hitLimit = false
  29331. this._checkingBytes = true
  29332. this._key = ''
  29333. this._bytesKey = 0
  29334. this._keyTrunc = false
  29335. this.decoder.reset()
  29336. if (key.length) {
  29337. this.boy.emit('field', decodeText(key, 'binary', this.charset),
  29338. '',
  29339. keyTrunc,
  29340. false)
  29341. }
  29342. p = idxamp + 1
  29343. if (this._fields === this.fieldsLimit) { return cb() }
  29344. } else if (this._hitLimit) {
  29345. // we may not have hit the actual limit if there are encoded bytes...
  29346. if (i > p) { this._key += this.decoder.write(data.toString('binary', p, i)) }
  29347. p = i
  29348. if ((this._bytesKey = this._key.length) === this.fieldNameSizeLimit) {
  29349. // yep, we actually did hit the limit
  29350. this._checkingBytes = false
  29351. this._keyTrunc = true
  29352. }
  29353. } else {
  29354. if (p < len) { this._key += this.decoder.write(data.toString('binary', p)) }
  29355. p = len
  29356. }
  29357. } else {
  29358. idxamp = undefined
  29359. for (i = p; i < len; ++i) {
  29360. if (!this._checkingBytes) { ++p }
  29361. if (data[i] === 0x26/* & */) {
  29362. idxamp = i
  29363. break
  29364. }
  29365. if (this._checkingBytes && this._bytesVal === this.fieldSizeLimit) {
  29366. this._hitLimit = true
  29367. break
  29368. } else if (this._checkingBytes) { ++this._bytesVal }
  29369. }
  29370. if (idxamp !== undefined) {
  29371. ++this._fields
  29372. if (idxamp > p) { this._val += this.decoder.write(data.toString('binary', p, idxamp)) }
  29373. this.boy.emit('field', decodeText(this._key, 'binary', this.charset),
  29374. decodeText(this._val, 'binary', this.charset),
  29375. this._keyTrunc,
  29376. this._valTrunc)
  29377. this._state = 'key'
  29378. this._hitLimit = false
  29379. this._checkingBytes = true
  29380. this._key = ''
  29381. this._bytesKey = 0
  29382. this._keyTrunc = false
  29383. this.decoder.reset()
  29384. p = idxamp + 1
  29385. if (this._fields === this.fieldsLimit) { return cb() }
  29386. } else if (this._hitLimit) {
  29387. // we may not have hit the actual limit if there are encoded bytes...
  29388. if (i > p) { this._val += this.decoder.write(data.toString('binary', p, i)) }
  29389. p = i
  29390. if ((this._val === '' && this.fieldSizeLimit === 0) ||
  29391. (this._bytesVal = this._val.length) === this.fieldSizeLimit) {
  29392. // yep, we actually did hit the limit
  29393. this._checkingBytes = false
  29394. this._valTrunc = true
  29395. }
  29396. } else {
  29397. if (p < len) { this._val += this.decoder.write(data.toString('binary', p)) }
  29398. p = len
  29399. }
  29400. }
  29401. }
  29402. cb()
  29403. }
  29404. UrlEncoded.prototype.end = function () {
  29405. if (this.boy._done) { return }
  29406. if (this._state === 'key' && this._key.length > 0) {
  29407. this.boy.emit('field', decodeText(this._key, 'binary', this.charset),
  29408. '',
  29409. this._keyTrunc,
  29410. false)
  29411. } else if (this._state === 'val') {
  29412. this.boy.emit('field', decodeText(this._key, 'binary', this.charset),
  29413. decodeText(this._val, 'binary', this.charset),
  29414. this._keyTrunc,
  29415. this._valTrunc)
  29416. }
  29417. this.boy._done = true
  29418. this.boy.emit('finish')
  29419. }
  29420. module.exports = UrlEncoded
  29421. /***/ }),
  29422. /***/ 7100:
  29423. /***/ ((module) => {
  29424. const RE_PLUS = /\+/g
  29425. const HEX = [
  29426. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  29427. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  29428. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  29429. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
  29430. 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  29431. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  29432. 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  29433. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  29434. ]
  29435. function Decoder () {
  29436. this.buffer = undefined
  29437. }
  29438. Decoder.prototype.write = function (str) {
  29439. // Replace '+' with ' ' before decoding
  29440. str = str.replace(RE_PLUS, ' ')
  29441. let res = ''
  29442. let i = 0; let p = 0; const len = str.length
  29443. for (; i < len; ++i) {
  29444. if (this.buffer !== undefined) {
  29445. if (!HEX[str.charCodeAt(i)]) {
  29446. res += '%' + this.buffer
  29447. this.buffer = undefined
  29448. --i // retry character
  29449. } else {
  29450. this.buffer += str[i]
  29451. ++p
  29452. if (this.buffer.length === 2) {
  29453. res += String.fromCharCode(parseInt(this.buffer, 16))
  29454. this.buffer = undefined
  29455. }
  29456. }
  29457. } else if (str[i] === '%') {
  29458. if (i > p) {
  29459. res += str.substring(p, i)
  29460. p = i
  29461. }
  29462. this.buffer = ''
  29463. ++p
  29464. }
  29465. }
  29466. if (p < len && this.buffer === undefined) { res += str.substring(p) }
  29467. return res
  29468. }
  29469. Decoder.prototype.reset = function () {
  29470. this.buffer = undefined
  29471. }
  29472. module.exports = Decoder
  29473. /***/ }),
  29474. /***/ 8647:
  29475. /***/ ((module) => {
  29476. module.exports = function basename (path) {
  29477. if (typeof path !== 'string') { return '' }
  29478. for (var i = path.length - 1; i >= 0; --i) { // eslint-disable-line no-var
  29479. switch (path.charCodeAt(i)) {
  29480. case 0x2F: // '/'
  29481. case 0x5C: // '\'
  29482. path = path.slice(i + 1)
  29483. return (path === '..' || path === '.' ? '' : path)
  29484. }
  29485. }
  29486. return (path === '..' || path === '.' ? '' : path)
  29487. }
  29488. /***/ }),
  29489. /***/ 4619:
  29490. /***/ (function(module) {
  29491. // Node has always utf-8
  29492. const utf8Decoder = new TextDecoder('utf-8')
  29493. const textDecoders = new Map([
  29494. ['utf-8', utf8Decoder],
  29495. ['utf8', utf8Decoder]
  29496. ])
  29497. function getDecoder (charset) {
  29498. let lc
  29499. while (true) {
  29500. switch (charset) {
  29501. case 'utf-8':
  29502. case 'utf8':
  29503. return decoders.utf8
  29504. case 'latin1':
  29505. case 'ascii': // TODO: Make these a separate, strict decoder?
  29506. case 'us-ascii':
  29507. case 'iso-8859-1':
  29508. case 'iso8859-1':
  29509. case 'iso88591':
  29510. case 'iso_8859-1':
  29511. case 'windows-1252':
  29512. case 'iso_8859-1:1987':
  29513. case 'cp1252':
  29514. case 'x-cp1252':
  29515. return decoders.latin1
  29516. case 'utf16le':
  29517. case 'utf-16le':
  29518. case 'ucs2':
  29519. case 'ucs-2':
  29520. return decoders.utf16le
  29521. case 'base64':
  29522. return decoders.base64
  29523. default:
  29524. if (lc === undefined) {
  29525. lc = true
  29526. charset = charset.toLowerCase()
  29527. continue
  29528. }
  29529. return decoders.other.bind(charset)
  29530. }
  29531. }
  29532. }
  29533. const decoders = {
  29534. utf8: (data, sourceEncoding) => {
  29535. if (data.length === 0) {
  29536. return ''
  29537. }
  29538. if (typeof data === 'string') {
  29539. data = Buffer.from(data, sourceEncoding)
  29540. }
  29541. return data.utf8Slice(0, data.length)
  29542. },
  29543. latin1: (data, sourceEncoding) => {
  29544. if (data.length === 0) {
  29545. return ''
  29546. }
  29547. if (typeof data === 'string') {
  29548. return data
  29549. }
  29550. return data.latin1Slice(0, data.length)
  29551. },
  29552. utf16le: (data, sourceEncoding) => {
  29553. if (data.length === 0) {
  29554. return ''
  29555. }
  29556. if (typeof data === 'string') {
  29557. data = Buffer.from(data, sourceEncoding)
  29558. }
  29559. return data.ucs2Slice(0, data.length)
  29560. },
  29561. base64: (data, sourceEncoding) => {
  29562. if (data.length === 0) {
  29563. return ''
  29564. }
  29565. if (typeof data === 'string') {
  29566. data = Buffer.from(data, sourceEncoding)
  29567. }
  29568. return data.base64Slice(0, data.length)
  29569. },
  29570. other: (data, sourceEncoding) => {
  29571. if (data.length === 0) {
  29572. return ''
  29573. }
  29574. if (typeof data === 'string') {
  29575. data = Buffer.from(data, sourceEncoding)
  29576. }
  29577. if (textDecoders.has(this.toString())) {
  29578. try {
  29579. return textDecoders.get(this).decode(data)
  29580. } catch {}
  29581. }
  29582. return typeof data === 'string'
  29583. ? data
  29584. : data.toString()
  29585. }
  29586. }
  29587. function decodeText (text, sourceEncoding, destEncoding) {
  29588. if (text) {
  29589. return getDecoder(destEncoding)(text, sourceEncoding)
  29590. }
  29591. return text
  29592. }
  29593. module.exports = decodeText
  29594. /***/ }),
  29595. /***/ 1467:
  29596. /***/ ((module) => {
  29597. module.exports = function getLimit (limits, name, defaultLimit) {
  29598. if (
  29599. !limits ||
  29600. limits[name] === undefined ||
  29601. limits[name] === null
  29602. ) { return defaultLimit }
  29603. if (
  29604. typeof limits[name] !== 'number' ||
  29605. isNaN(limits[name])
  29606. ) { throw new TypeError('Limit ' + name + ' is not a valid number') }
  29607. return limits[name]
  29608. }
  29609. /***/ }),
  29610. /***/ 1854:
  29611. /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
  29612. /* eslint-disable object-property-newline */
  29613. const decodeText = __nccwpck_require__(4619)
  29614. const RE_ENCODED = /%[a-fA-F0-9][a-fA-F0-9]/g
  29615. const EncodedLookup = {
  29616. '%00': '\x00', '%01': '\x01', '%02': '\x02', '%03': '\x03', '%04': '\x04',
  29617. '%05': '\x05', '%06': '\x06', '%07': '\x07', '%08': '\x08', '%09': '\x09',
  29618. '%0a': '\x0a', '%0A': '\x0a', '%0b': '\x0b', '%0B': '\x0b', '%0c': '\x0c',
  29619. '%0C': '\x0c', '%0d': '\x0d', '%0D': '\x0d', '%0e': '\x0e', '%0E': '\x0e',
  29620. '%0f': '\x0f', '%0F': '\x0f', '%10': '\x10', '%11': '\x11', '%12': '\x12',
  29621. '%13': '\x13', '%14': '\x14', '%15': '\x15', '%16': '\x16', '%17': '\x17',
  29622. '%18': '\x18', '%19': '\x19', '%1a': '\x1a', '%1A': '\x1a', '%1b': '\x1b',
  29623. '%1B': '\x1b', '%1c': '\x1c', '%1C': '\x1c', '%1d': '\x1d', '%1D': '\x1d',
  29624. '%1e': '\x1e', '%1E': '\x1e', '%1f': '\x1f', '%1F': '\x1f', '%20': '\x20',
  29625. '%21': '\x21', '%22': '\x22', '%23': '\x23', '%24': '\x24', '%25': '\x25',
  29626. '%26': '\x26', '%27': '\x27', '%28': '\x28', '%29': '\x29', '%2a': '\x2a',
  29627. '%2A': '\x2a', '%2b': '\x2b', '%2B': '\x2b', '%2c': '\x2c', '%2C': '\x2c',
  29628. '%2d': '\x2d', '%2D': '\x2d', '%2e': '\x2e', '%2E': '\x2e', '%2f': '\x2f',
  29629. '%2F': '\x2f', '%30': '\x30', '%31': '\x31', '%32': '\x32', '%33': '\x33',
  29630. '%34': '\x34', '%35': '\x35', '%36': '\x36', '%37': '\x37', '%38': '\x38',
  29631. '%39': '\x39', '%3a': '\x3a', '%3A': '\x3a', '%3b': '\x3b', '%3B': '\x3b',
  29632. '%3c': '\x3c', '%3C': '\x3c', '%3d': '\x3d', '%3D': '\x3d', '%3e': '\x3e',
  29633. '%3E': '\x3e', '%3f': '\x3f', '%3F': '\x3f', '%40': '\x40', '%41': '\x41',
  29634. '%42': '\x42', '%43': '\x43', '%44': '\x44', '%45': '\x45', '%46': '\x46',
  29635. '%47': '\x47', '%48': '\x48', '%49': '\x49', '%4a': '\x4a', '%4A': '\x4a',
  29636. '%4b': '\x4b', '%4B': '\x4b', '%4c': '\x4c', '%4C': '\x4c', '%4d': '\x4d',
  29637. '%4D': '\x4d', '%4e': '\x4e', '%4E': '\x4e', '%4f': '\x4f', '%4F': '\x4f',
  29638. '%50': '\x50', '%51': '\x51', '%52': '\x52', '%53': '\x53', '%54': '\x54',
  29639. '%55': '\x55', '%56': '\x56', '%57': '\x57', '%58': '\x58', '%59': '\x59',
  29640. '%5a': '\x5a', '%5A': '\x5a', '%5b': '\x5b', '%5B': '\x5b', '%5c': '\x5c',
  29641. '%5C': '\x5c', '%5d': '\x5d', '%5D': '\x5d', '%5e': '\x5e', '%5E': '\x5e',
  29642. '%5f': '\x5f', '%5F': '\x5f', '%60': '\x60', '%61': '\x61', '%62': '\x62',
  29643. '%63': '\x63', '%64': '\x64', '%65': '\x65', '%66': '\x66', '%67': '\x67',
  29644. '%68': '\x68', '%69': '\x69', '%6a': '\x6a', '%6A': '\x6a', '%6b': '\x6b',
  29645. '%6B': '\x6b', '%6c': '\x6c', '%6C': '\x6c', '%6d': '\x6d', '%6D': '\x6d',
  29646. '%6e': '\x6e', '%6E': '\x6e', '%6f': '\x6f', '%6F': '\x6f', '%70': '\x70',
  29647. '%71': '\x71', '%72': '\x72', '%73': '\x73', '%74': '\x74', '%75': '\x75',
  29648. '%76': '\x76', '%77': '\x77', '%78': '\x78', '%79': '\x79', '%7a': '\x7a',
  29649. '%7A': '\x7a', '%7b': '\x7b', '%7B': '\x7b', '%7c': '\x7c', '%7C': '\x7c',
  29650. '%7d': '\x7d', '%7D': '\x7d', '%7e': '\x7e', '%7E': '\x7e', '%7f': '\x7f',
  29651. '%7F': '\x7f', '%80': '\x80', '%81': '\x81', '%82': '\x82', '%83': '\x83',
  29652. '%84': '\x84', '%85': '\x85', '%86': '\x86', '%87': '\x87', '%88': '\x88',
  29653. '%89': '\x89', '%8a': '\x8a', '%8A': '\x8a', '%8b': '\x8b', '%8B': '\x8b',
  29654. '%8c': '\x8c', '%8C': '\x8c', '%8d': '\x8d', '%8D': '\x8d', '%8e': '\x8e',
  29655. '%8E': '\x8e', '%8f': '\x8f', '%8F': '\x8f', '%90': '\x90', '%91': '\x91',
  29656. '%92': '\x92', '%93': '\x93', '%94': '\x94', '%95': '\x95', '%96': '\x96',
  29657. '%97': '\x97', '%98': '\x98', '%99': '\x99', '%9a': '\x9a', '%9A': '\x9a',
  29658. '%9b': '\x9b', '%9B': '\x9b', '%9c': '\x9c', '%9C': '\x9c', '%9d': '\x9d',
  29659. '%9D': '\x9d', '%9e': '\x9e', '%9E': '\x9e', '%9f': '\x9f', '%9F': '\x9f',
  29660. '%a0': '\xa0', '%A0': '\xa0', '%a1': '\xa1', '%A1': '\xa1', '%a2': '\xa2',
  29661. '%A2': '\xa2', '%a3': '\xa3', '%A3': '\xa3', '%a4': '\xa4', '%A4': '\xa4',
  29662. '%a5': '\xa5', '%A5': '\xa5', '%a6': '\xa6', '%A6': '\xa6', '%a7': '\xa7',
  29663. '%A7': '\xa7', '%a8': '\xa8', '%A8': '\xa8', '%a9': '\xa9', '%A9': '\xa9',
  29664. '%aa': '\xaa', '%Aa': '\xaa', '%aA': '\xaa', '%AA': '\xaa', '%ab': '\xab',
  29665. '%Ab': '\xab', '%aB': '\xab', '%AB': '\xab', '%ac': '\xac', '%Ac': '\xac',
  29666. '%aC': '\xac', '%AC': '\xac', '%ad': '\xad', '%Ad': '\xad', '%aD': '\xad',
  29667. '%AD': '\xad', '%ae': '\xae', '%Ae': '\xae', '%aE': '\xae', '%AE': '\xae',
  29668. '%af': '\xaf', '%Af': '\xaf', '%aF': '\xaf', '%AF': '\xaf', '%b0': '\xb0',
  29669. '%B0': '\xb0', '%b1': '\xb1', '%B1': '\xb1', '%b2': '\xb2', '%B2': '\xb2',
  29670. '%b3': '\xb3', '%B3': '\xb3', '%b4': '\xb4', '%B4': '\xb4', '%b5': '\xb5',
  29671. '%B5': '\xb5', '%b6': '\xb6', '%B6': '\xb6', '%b7': '\xb7', '%B7': '\xb7',
  29672. '%b8': '\xb8', '%B8': '\xb8', '%b9': '\xb9', '%B9': '\xb9', '%ba': '\xba',
  29673. '%Ba': '\xba', '%bA': '\xba', '%BA': '\xba', '%bb': '\xbb', '%Bb': '\xbb',
  29674. '%bB': '\xbb', '%BB': '\xbb', '%bc': '\xbc', '%Bc': '\xbc', '%bC': '\xbc',
  29675. '%BC': '\xbc', '%bd': '\xbd', '%Bd': '\xbd', '%bD': '\xbd', '%BD': '\xbd',
  29676. '%be': '\xbe', '%Be': '\xbe', '%bE': '\xbe', '%BE': '\xbe', '%bf': '\xbf',
  29677. '%Bf': '\xbf', '%bF': '\xbf', '%BF': '\xbf', '%c0': '\xc0', '%C0': '\xc0',
  29678. '%c1': '\xc1', '%C1': '\xc1', '%c2': '\xc2', '%C2': '\xc2', '%c3': '\xc3',
  29679. '%C3': '\xc3', '%c4': '\xc4', '%C4': '\xc4', '%c5': '\xc5', '%C5': '\xc5',
  29680. '%c6': '\xc6', '%C6': '\xc6', '%c7': '\xc7', '%C7': '\xc7', '%c8': '\xc8',
  29681. '%C8': '\xc8', '%c9': '\xc9', '%C9': '\xc9', '%ca': '\xca', '%Ca': '\xca',
  29682. '%cA': '\xca', '%CA': '\xca', '%cb': '\xcb', '%Cb': '\xcb', '%cB': '\xcb',
  29683. '%CB': '\xcb', '%cc': '\xcc', '%Cc': '\xcc', '%cC': '\xcc', '%CC': '\xcc',
  29684. '%cd': '\xcd', '%Cd': '\xcd', '%cD': '\xcd', '%CD': '\xcd', '%ce': '\xce',
  29685. '%Ce': '\xce', '%cE': '\xce', '%CE': '\xce', '%cf': '\xcf', '%Cf': '\xcf',
  29686. '%cF': '\xcf', '%CF': '\xcf', '%d0': '\xd0', '%D0': '\xd0', '%d1': '\xd1',
  29687. '%D1': '\xd1', '%d2': '\xd2', '%D2': '\xd2', '%d3': '\xd3', '%D3': '\xd3',
  29688. '%d4': '\xd4', '%D4': '\xd4', '%d5': '\xd5', '%D5': '\xd5', '%d6': '\xd6',
  29689. '%D6': '\xd6', '%d7': '\xd7', '%D7': '\xd7', '%d8': '\xd8', '%D8': '\xd8',
  29690. '%d9': '\xd9', '%D9': '\xd9', '%da': '\xda', '%Da': '\xda', '%dA': '\xda',
  29691. '%DA': '\xda', '%db': '\xdb', '%Db': '\xdb', '%dB': '\xdb', '%DB': '\xdb',
  29692. '%dc': '\xdc', '%Dc': '\xdc', '%dC': '\xdc', '%DC': '\xdc', '%dd': '\xdd',
  29693. '%Dd': '\xdd', '%dD': '\xdd', '%DD': '\xdd', '%de': '\xde', '%De': '\xde',
  29694. '%dE': '\xde', '%DE': '\xde', '%df': '\xdf', '%Df': '\xdf', '%dF': '\xdf',
  29695. '%DF': '\xdf', '%e0': '\xe0', '%E0': '\xe0', '%e1': '\xe1', '%E1': '\xe1',
  29696. '%e2': '\xe2', '%E2': '\xe2', '%e3': '\xe3', '%E3': '\xe3', '%e4': '\xe4',
  29697. '%E4': '\xe4', '%e5': '\xe5', '%E5': '\xe5', '%e6': '\xe6', '%E6': '\xe6',
  29698. '%e7': '\xe7', '%E7': '\xe7', '%e8': '\xe8', '%E8': '\xe8', '%e9': '\xe9',
  29699. '%E9': '\xe9', '%ea': '\xea', '%Ea': '\xea', '%eA': '\xea', '%EA': '\xea',
  29700. '%eb': '\xeb', '%Eb': '\xeb', '%eB': '\xeb', '%EB': '\xeb', '%ec': '\xec',
  29701. '%Ec': '\xec', '%eC': '\xec', '%EC': '\xec', '%ed': '\xed', '%Ed': '\xed',
  29702. '%eD': '\xed', '%ED': '\xed', '%ee': '\xee', '%Ee': '\xee', '%eE': '\xee',
  29703. '%EE': '\xee', '%ef': '\xef', '%Ef': '\xef', '%eF': '\xef', '%EF': '\xef',
  29704. '%f0': '\xf0', '%F0': '\xf0', '%f1': '\xf1', '%F1': '\xf1', '%f2': '\xf2',
  29705. '%F2': '\xf2', '%f3': '\xf3', '%F3': '\xf3', '%f4': '\xf4', '%F4': '\xf4',
  29706. '%f5': '\xf5', '%F5': '\xf5', '%f6': '\xf6', '%F6': '\xf6', '%f7': '\xf7',
  29707. '%F7': '\xf7', '%f8': '\xf8', '%F8': '\xf8', '%f9': '\xf9', '%F9': '\xf9',
  29708. '%fa': '\xfa', '%Fa': '\xfa', '%fA': '\xfa', '%FA': '\xfa', '%fb': '\xfb',
  29709. '%Fb': '\xfb', '%fB': '\xfb', '%FB': '\xfb', '%fc': '\xfc', '%Fc': '\xfc',
  29710. '%fC': '\xfc', '%FC': '\xfc', '%fd': '\xfd', '%Fd': '\xfd', '%fD': '\xfd',
  29711. '%FD': '\xfd', '%fe': '\xfe', '%Fe': '\xfe', '%fE': '\xfe', '%FE': '\xfe',
  29712. '%ff': '\xff', '%Ff': '\xff', '%fF': '\xff', '%FF': '\xff'
  29713. }
  29714. function encodedReplacer (match) {
  29715. return EncodedLookup[match]
  29716. }
  29717. const STATE_KEY = 0
  29718. const STATE_VALUE = 1
  29719. const STATE_CHARSET = 2
  29720. const STATE_LANG = 3
  29721. function parseParams (str) {
  29722. const res = []
  29723. let state = STATE_KEY
  29724. let charset = ''
  29725. let inquote = false
  29726. let escaping = false
  29727. let p = 0
  29728. let tmp = ''
  29729. const len = str.length
  29730. for (var i = 0; i < len; ++i) { // eslint-disable-line no-var
  29731. const char = str[i]
  29732. if (char === '\\' && inquote) {
  29733. if (escaping) { escaping = false } else {
  29734. escaping = true
  29735. continue
  29736. }
  29737. } else if (char === '"') {
  29738. if (!escaping) {
  29739. if (inquote) {
  29740. inquote = false
  29741. state = STATE_KEY
  29742. } else { inquote = true }
  29743. continue
  29744. } else { escaping = false }
  29745. } else {
  29746. if (escaping && inquote) { tmp += '\\' }
  29747. escaping = false
  29748. if ((state === STATE_CHARSET || state === STATE_LANG) && char === "'") {
  29749. if (state === STATE_CHARSET) {
  29750. state = STATE_LANG
  29751. charset = tmp.substring(1)
  29752. } else { state = STATE_VALUE }
  29753. tmp = ''
  29754. continue
  29755. } else if (state === STATE_KEY &&
  29756. (char === '*' || char === '=') &&
  29757. res.length) {
  29758. state = char === '*'
  29759. ? STATE_CHARSET
  29760. : STATE_VALUE
  29761. res[p] = [tmp, undefined]
  29762. tmp = ''
  29763. continue
  29764. } else if (!inquote && char === ';') {
  29765. state = STATE_KEY
  29766. if (charset) {
  29767. if (tmp.length) {
  29768. tmp = decodeText(tmp.replace(RE_ENCODED, encodedReplacer),
  29769. 'binary',
  29770. charset)
  29771. }
  29772. charset = ''
  29773. } else if (tmp.length) {
  29774. tmp = decodeText(tmp, 'binary', 'utf8')
  29775. }
  29776. if (res[p] === undefined) { res[p] = tmp } else { res[p][1] = tmp }
  29777. tmp = ''
  29778. ++p
  29779. continue
  29780. } else if (!inquote && (char === ' ' || char === '\t')) { continue }
  29781. }
  29782. tmp += char
  29783. }
  29784. if (charset && tmp.length) {
  29785. tmp = decodeText(tmp.replace(RE_ENCODED, encodedReplacer),
  29786. 'binary',
  29787. charset)
  29788. } else if (tmp) {
  29789. tmp = decodeText(tmp, 'binary', 'utf8')
  29790. }
  29791. if (res[p] === undefined) {
  29792. if (tmp) { res[p] = tmp }
  29793. } else { res[p][1] = tmp }
  29794. return res
  29795. }
  29796. module.exports = parseParams
  29797. /***/ })
  29798. /******/ });
  29799. /************************************************************************/
  29800. /******/ // The module cache
  29801. /******/ var __webpack_module_cache__ = {};
  29802. /******/
  29803. /******/ // The require function
  29804. /******/ function __nccwpck_require__(moduleId) {
  29805. /******/ // Check if module is in cache
  29806. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  29807. /******/ if (cachedModule !== undefined) {
  29808. /******/ return cachedModule.exports;
  29809. /******/ }
  29810. /******/ // Create a new module (and put it into the cache)
  29811. /******/ var module = __webpack_module_cache__[moduleId] = {
  29812. /******/ // no module.id needed
  29813. /******/ // no module.loaded needed
  29814. /******/ exports: {}
  29815. /******/ };
  29816. /******/
  29817. /******/ // Execute the module function
  29818. /******/ var threw = true;
  29819. /******/ try {
  29820. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__);
  29821. /******/ threw = false;
  29822. /******/ } finally {
  29823. /******/ if(threw) delete __webpack_module_cache__[moduleId];
  29824. /******/ }
  29825. /******/
  29826. /******/ // Return the exports of the module
  29827. /******/ return module.exports;
  29828. /******/ }
  29829. /******/
  29830. /************************************************************************/
  29831. /******/ /* webpack/runtime/compat */
  29832. /******/
  29833. /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = new URL('.', import.meta.url).pathname.slice(import.meta.url.match(/^file:\/\/\/\w:/) ? 1 : 0, -1) + "/";
  29834. /******/
  29835. /************************************************************************/
  29836. var __webpack_exports__ = {};
  29837. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  29838. (() => {
  29839. // EXTERNAL MODULE: ./node_modules/@actions/core/lib/core.js
  29840. var core = __nccwpck_require__(2186);
  29841. // EXTERNAL MODULE: external "fs"
  29842. var external_fs_ = __nccwpck_require__(7147);
  29843. ;// CONCATENATED MODULE: ./src/fs-helper.ts
  29844. function directoryExistsSync(path, required) {
  29845. if (!path) {
  29846. throw new Error("Arg 'path' must not be empty");
  29847. }
  29848. let stats;
  29849. try {
  29850. stats = external_fs_.statSync(path);
  29851. }
  29852. catch (error) {
  29853. if (error?.code === 'ENOENT') {
  29854. if (!required) {
  29855. return false;
  29856. }
  29857. throw new Error(`Directory '${path}' does not exist`);
  29858. }
  29859. throw new Error(`Encountered an error when checking whether path '${path}' exists: ${error?.message ?? error}`);
  29860. }
  29861. if (stats.isDirectory()) {
  29862. return true;
  29863. }
  29864. else if (!required) {
  29865. return false;
  29866. }
  29867. throw new Error(`Directory '${path}' does not exist`);
  29868. }
  29869. function existsSync(path) {
  29870. if (!path) {
  29871. throw new Error("Arg 'path' must not be empty");
  29872. }
  29873. try {
  29874. fs.statSync(path);
  29875. }
  29876. catch (error) {
  29877. if (error?.code === 'ENOENT') {
  29878. return false;
  29879. }
  29880. throw new Error(`Encountered an error when checking whether path '${path}' exists: ${error?.message ?? error}`);
  29881. }
  29882. return true;
  29883. }
  29884. function fileExistsSync(path) {
  29885. if (!path) {
  29886. throw new Error("Arg 'path' must not be empty");
  29887. }
  29888. let stats;
  29889. try {
  29890. stats = external_fs_.statSync(path);
  29891. }
  29892. catch (error) {
  29893. if (error?.code === 'ENOENT') {
  29894. return false;
  29895. }
  29896. throw new Error(`Encountered an error when checking whether path '${path}' exists: ${error?.message ?? error}`);
  29897. }
  29898. if (!stats.isDirectory()) {
  29899. return true;
  29900. }
  29901. return false;
  29902. }
  29903. // EXTERNAL MODULE: external "assert"
  29904. var external_assert_ = __nccwpck_require__(9491);
  29905. // EXTERNAL MODULE: ./node_modules/@actions/exec/lib/exec.js
  29906. var exec = __nccwpck_require__(1514);
  29907. // EXTERNAL MODULE: ./node_modules/@actions/io/lib/io.js
  29908. var io = __nccwpck_require__(7436);
  29909. // EXTERNAL MODULE: external "os"
  29910. var external_os_ = __nccwpck_require__(2037);
  29911. // EXTERNAL MODULE: external "path"
  29912. var external_path_ = __nccwpck_require__(1017);
  29913. ;// CONCATENATED MODULE: ./src/regexp-helper.ts
  29914. function regexp_helper_escape(value) {
  29915. return value.replace(/[^a-zA-Z0-9_]/g, x => {
  29916. return `\\${x}`;
  29917. });
  29918. }
  29919. ;// CONCATENATED MODULE: ./src/state-helper.ts
  29920. /**
  29921. * Indicates whether the POST action is running
  29922. */
  29923. const IsPost = !!core.getState('isPost');
  29924. /**
  29925. * The repository path for the POST action. The value is empty during the MAIN action.
  29926. */
  29927. const RepositoryPath = core.getState('repositoryPath');
  29928. /**
  29929. * The set-safe-directory for the POST action. The value is set if input: 'safe-directory' is set during the MAIN action.
  29930. */
  29931. const PostSetSafeDirectory = core.getState('setSafeDirectory') === 'true';
  29932. /**
  29933. * The SSH key path for the POST action. The value is empty during the MAIN action.
  29934. */
  29935. const SshKeyPath = core.getState('sshKeyPath');
  29936. /**
  29937. * The SSH known hosts path for the POST action. The value is empty during the MAIN action.
  29938. */
  29939. const SshKnownHostsPath = core.getState('sshKnownHostsPath');
  29940. /**
  29941. * Save the repository path so the POST action can retrieve the value.
  29942. */
  29943. function setRepositoryPath(repositoryPath) {
  29944. core.saveState('repositoryPath', repositoryPath);
  29945. }
  29946. /**
  29947. * Save the SSH key path so the POST action can retrieve the value.
  29948. */
  29949. function setSshKeyPath(sshKeyPath) {
  29950. core.saveState('sshKeyPath', sshKeyPath);
  29951. }
  29952. /**
  29953. * Save the SSH known hosts path so the POST action can retrieve the value.
  29954. */
  29955. function setSshKnownHostsPath(sshKnownHostsPath) {
  29956. core.saveState('sshKnownHostsPath', sshKnownHostsPath);
  29957. }
  29958. /**
  29959. * Save the set-safe-directory input so the POST action can retrieve the value.
  29960. */
  29961. function setSafeDirectory() {
  29962. core.saveState('setSafeDirectory', 'true');
  29963. }
  29964. // Publish a variable so that when the POST action runs, it can determine it should run the cleanup logic.
  29965. // This is necessary since we don't have a separate entry point.
  29966. if (!IsPost) {
  29967. core.saveState('isPost', 'true');
  29968. }
  29969. // EXTERNAL MODULE: external "url"
  29970. var external_url_ = __nccwpck_require__(7310);
  29971. ;// CONCATENATED MODULE: ./src/url-helper.ts
  29972. function getFetchUrl(settings) {
  29973. external_assert_.ok(settings.repositoryOwner, 'settings.repositoryOwner must be defined');
  29974. external_assert_.ok(settings.repositoryName, 'settings.repositoryName must be defined');
  29975. const serviceUrl = getServerUrl(settings.githubServerUrl);
  29976. const encodedOwner = encodeURIComponent(settings.repositoryOwner);
  29977. const encodedName = encodeURIComponent(settings.repositoryName);
  29978. if (settings.sshKey) {
  29979. const user = settings.sshUser.length > 0 ? settings.sshUser : 'git';
  29980. return `${user}@${serviceUrl.hostname}:${encodedOwner}/${encodedName}.git`;
  29981. }
  29982. // "origin" is SCHEME://HOSTNAME[:PORT]
  29983. return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`;
  29984. }
  29985. function getServerUrl(url) {
  29986. let resolvedUrl = process.env['GITHUB_SERVER_URL'] || 'https://github.com';
  29987. if (hasContent(url, WhitespaceMode.Trim)) {
  29988. resolvedUrl = url;
  29989. }
  29990. return new external_url_.URL(resolvedUrl);
  29991. }
  29992. function getServerApiUrl(url) {
  29993. if (hasContent(url, WhitespaceMode.Trim)) {
  29994. let serverUrl = getServerUrl(url);
  29995. if (isGhes(url)) {
  29996. serverUrl.pathname = 'api/v3';
  29997. }
  29998. else {
  29999. serverUrl.hostname = 'api.' + serverUrl.hostname;
  30000. }
  30001. return pruneSuffix(serverUrl.toString(), '/');
  30002. }
  30003. return process.env['GITHUB_API_URL'] || 'https://api.github.com';
  30004. }
  30005. function isGhes(url) {
  30006. const ghUrl = new external_url_.URL(url || process.env['GITHUB_SERVER_URL'] || 'https://github.com');
  30007. const hostname = ghUrl.hostname.trimEnd().toUpperCase();
  30008. const isGitHubHost = hostname === 'GITHUB.COM';
  30009. const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM');
  30010. const isLocalHost = hostname.endsWith('.LOCALHOST');
  30011. return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
  30012. }
  30013. function pruneSuffix(text, suffix) {
  30014. if (hasContent(suffix, WhitespaceMode.Preserve) && text?.endsWith(suffix)) {
  30015. return text.substring(0, text.length - suffix.length);
  30016. }
  30017. return text;
  30018. }
  30019. var WhitespaceMode;
  30020. (function (WhitespaceMode) {
  30021. WhitespaceMode[WhitespaceMode["Trim"] = 0] = "Trim";
  30022. WhitespaceMode[WhitespaceMode["Preserve"] = 1] = "Preserve";
  30023. })(WhitespaceMode || (WhitespaceMode = {}));
  30024. function hasContent(text, whitespaceMode) {
  30025. let refinedText = text ?? '';
  30026. if (whitespaceMode == WhitespaceMode.Trim) {
  30027. refinedText = refinedText.trim();
  30028. }
  30029. return refinedText.length > 0;
  30030. }
  30031. // EXTERNAL MODULE: external "crypto"
  30032. var external_crypto_ = __nccwpck_require__(6113);
  30033. ;// CONCATENATED MODULE: ./src/git-auth-helper.ts
  30034. const IS_WINDOWS = process.platform === 'win32';
  30035. const SSH_COMMAND_KEY = 'core.sshCommand';
  30036. function createAuthHelper(git, settings) {
  30037. return new GitAuthHelper(git, settings);
  30038. }
  30039. class GitAuthHelper {
  30040. git;
  30041. settings;
  30042. tokenConfigKey;
  30043. tokenConfigValue;
  30044. tokenPlaceholderConfigValue;
  30045. insteadOfKey;
  30046. insteadOfValues = [];
  30047. sshCommand = '';
  30048. sshKeyPath = '';
  30049. sshKnownHostsPath = '';
  30050. temporaryHomePath = '';
  30051. credentialsConfigPath = ''; // Path to separate credentials config file in RUNNER_TEMP
  30052. constructor(gitCommandManager, gitSourceSettings) {
  30053. this.git = gitCommandManager;
  30054. this.settings = gitSourceSettings || {};
  30055. // Token auth header
  30056. const serverUrl = getServerUrl(this.settings.githubServerUrl);
  30057. this.tokenConfigKey = `http.${serverUrl.origin}/.extraheader`; // "origin" is SCHEME://HOSTNAME[:PORT]
  30058. const basicCredential = Buffer.from(`x-access-token:${this.settings.authToken}`, 'utf8').toString('base64');
  30059. core.setSecret(basicCredential);
  30060. this.tokenPlaceholderConfigValue = `AUTHORIZATION: basic ***`;
  30061. this.tokenConfigValue = `AUTHORIZATION: basic ${basicCredential}`;
  30062. // Instead of SSH URL
  30063. this.insteadOfKey = `url.${serverUrl.origin}/.insteadOf`; // "origin" is SCHEME://HOSTNAME[:PORT]
  30064. this.insteadOfValues.push(`git@${serverUrl.hostname}:`);
  30065. if (this.settings.workflowOrganizationId) {
  30066. this.insteadOfValues.push(`org-${this.settings.workflowOrganizationId}@github.com:`);
  30067. }
  30068. }
  30069. async configureAuth() {
  30070. // Remove possible previous values
  30071. await this.removeAuth();
  30072. // Configure new values
  30073. await this.configureSsh();
  30074. await this.configureToken();
  30075. }
  30076. async configureTempGlobalConfig() {
  30077. // Already setup global config
  30078. if (this.temporaryHomePath?.length > 0) {
  30079. return external_path_.join(this.temporaryHomePath, '.gitconfig');
  30080. }
  30081. // Create a temp home directory
  30082. const runnerTemp = process.env['RUNNER_TEMP'] || '';
  30083. external_assert_.ok(runnerTemp, 'RUNNER_TEMP is not defined');
  30084. const uniqueId = (0,external_crypto_.randomUUID)();
  30085. this.temporaryHomePath = external_path_.join(runnerTemp, uniqueId);
  30086. await external_fs_.promises.mkdir(this.temporaryHomePath, { recursive: true });
  30087. // Copy the global git config
  30088. const gitConfigPath = external_path_.join(process.env['HOME'] || external_os_.homedir(), '.gitconfig');
  30089. const newGitConfigPath = external_path_.join(this.temporaryHomePath, '.gitconfig');
  30090. let configExists = false;
  30091. try {
  30092. await external_fs_.promises.stat(gitConfigPath);
  30093. configExists = true;
  30094. }
  30095. catch (err) {
  30096. if (err?.code !== 'ENOENT') {
  30097. throw err;
  30098. }
  30099. }
  30100. if (configExists) {
  30101. core.info(`Copying '${gitConfigPath}' to '${newGitConfigPath}'`);
  30102. await io.cp(gitConfigPath, newGitConfigPath);
  30103. }
  30104. else {
  30105. await external_fs_.promises.writeFile(newGitConfigPath, '');
  30106. }
  30107. // Override HOME
  30108. core.info(`Temporarily overriding HOME='${this.temporaryHomePath}' before making global git config changes`);
  30109. this.git.setEnvironmentVariable('HOME', this.temporaryHomePath);
  30110. return newGitConfigPath;
  30111. }
  30112. async configureGlobalAuth() {
  30113. // 'configureTempGlobalConfig' noops if already set, just returns the path
  30114. await this.configureTempGlobalConfig();
  30115. try {
  30116. // Configure the token
  30117. await this.configureToken(true);
  30118. // Configure HTTPS instead of SSH
  30119. await this.git.tryConfigUnset(this.insteadOfKey, true);
  30120. if (!this.settings.sshKey) {
  30121. for (const insteadOfValue of this.insteadOfValues) {
  30122. await this.git.config(this.insteadOfKey, insteadOfValue, true, // globalConfig?
  30123. true // add?
  30124. );
  30125. }
  30126. }
  30127. }
  30128. catch (err) {
  30129. // Unset in case somehow written to the real global config
  30130. core.info('Encountered an error when attempting to configure token. Attempting unconfigure.');
  30131. await this.git.tryConfigUnset(this.tokenConfigKey, true);
  30132. throw err;
  30133. }
  30134. }
  30135. async configureSubmoduleAuth() {
  30136. // Remove possible previous HTTPS instead of SSH
  30137. await this.removeSubmoduleGitConfig(this.insteadOfKey);
  30138. if (this.settings.persistCredentials) {
  30139. // Get the credentials config file path in RUNNER_TEMP
  30140. const credentialsConfigPath = this.getCredentialsConfigPath();
  30141. // Container credentials config path
  30142. const containerCredentialsPath = external_path_.posix.join('/github/runner_temp', external_path_.basename(credentialsConfigPath));
  30143. // Get submodule config file paths.
  30144. const configPaths = await this.git.getSubmoduleConfigPaths(this.settings.nestedSubmodules);
  30145. // For each submodule, configure includeIf entries pointing to the shared credentials file.
  30146. // Configure both host and container paths to support Docker container actions.
  30147. for (const configPath of configPaths) {
  30148. // Submodule Git directory
  30149. let submoduleGitDir = external_path_.dirname(configPath); // The config file is at .git/modules/submodule-name/config
  30150. submoduleGitDir = submoduleGitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
  30151. // Configure host includeIf
  30152. await this.git.config(`includeIf.gitdir:${submoduleGitDir}.path`, credentialsConfigPath, false, // globalConfig?
  30153. false, // add?
  30154. configPath);
  30155. // Container submodule git directory
  30156. const githubWorkspace = process.env['GITHUB_WORKSPACE'];
  30157. external_assert_.ok(githubWorkspace, 'GITHUB_WORKSPACE is not defined');
  30158. let relativeSubmoduleGitDir = external_path_.relative(githubWorkspace, submoduleGitDir);
  30159. relativeSubmoduleGitDir = relativeSubmoduleGitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
  30160. const containerSubmoduleGitDir = external_path_.posix.join('/github/workspace', relativeSubmoduleGitDir);
  30161. // Configure container includeIf
  30162. await this.git.config(`includeIf.gitdir:${containerSubmoduleGitDir}.path`, containerCredentialsPath, false, // globalConfig?
  30163. false, // add?
  30164. configPath);
  30165. }
  30166. if (this.settings.sshKey) {
  30167. // Configure core.sshCommand
  30168. await this.git.submoduleForeach(`git config --local '${SSH_COMMAND_KEY}' '${this.sshCommand}'`, this.settings.nestedSubmodules);
  30169. }
  30170. else {
  30171. // Configure HTTPS instead of SSH
  30172. for (const insteadOfValue of this.insteadOfValues) {
  30173. await this.git.submoduleForeach(`git config --local --add '${this.insteadOfKey}' '${insteadOfValue}'`, this.settings.nestedSubmodules);
  30174. }
  30175. }
  30176. }
  30177. }
  30178. async removeAuth() {
  30179. await this.removeSsh();
  30180. await this.removeToken();
  30181. }
  30182. async removeGlobalConfig() {
  30183. if (this.temporaryHomePath?.length > 0) {
  30184. core.debug(`Unsetting HOME override`);
  30185. this.git.removeEnvironmentVariable('HOME');
  30186. await io.rmRF(this.temporaryHomePath);
  30187. }
  30188. }
  30189. /**
  30190. * Configures SSH authentication by writing the SSH key and known hosts,
  30191. * and setting up the GIT_SSH_COMMAND environment variable.
  30192. */
  30193. async configureSsh() {
  30194. if (!this.settings.sshKey) {
  30195. return;
  30196. }
  30197. // Write key
  30198. const runnerTemp = process.env['RUNNER_TEMP'] || '';
  30199. external_assert_.ok(runnerTemp, 'RUNNER_TEMP is not defined');
  30200. const uniqueId = (0,external_crypto_.randomUUID)();
  30201. this.sshKeyPath = external_path_.join(runnerTemp, uniqueId);
  30202. setSshKeyPath(this.sshKeyPath);
  30203. await external_fs_.promises.mkdir(runnerTemp, { recursive: true });
  30204. await external_fs_.promises.writeFile(this.sshKeyPath, this.settings.sshKey.trim() + '\n', { mode: 0o600 });
  30205. // Remove inherited permissions on Windows
  30206. if (IS_WINDOWS) {
  30207. const icacls = await io.which('icacls.exe');
  30208. await exec.exec(`"${icacls}" "${this.sshKeyPath}" /grant:r "${process.env['USERDOMAIN']}\\${process.env['USERNAME']}:F"`);
  30209. await exec.exec(`"${icacls}" "${this.sshKeyPath}" /inheritance:r`);
  30210. }
  30211. // Write known hosts
  30212. const userKnownHostsPath = external_path_.join(external_os_.homedir(), '.ssh', 'known_hosts');
  30213. let userKnownHosts = '';
  30214. try {
  30215. userKnownHosts = (await external_fs_.promises.readFile(userKnownHostsPath)).toString();
  30216. }
  30217. catch (err) {
  30218. if (err?.code !== 'ENOENT') {
  30219. throw err;
  30220. }
  30221. }
  30222. let knownHosts = '';
  30223. if (userKnownHosts) {
  30224. knownHosts += `# Begin from ${userKnownHostsPath}\n${userKnownHosts}\n# End from ${userKnownHostsPath}\n`;
  30225. }
  30226. if (this.settings.sshKnownHosts) {
  30227. knownHosts += `# Begin from input known hosts\n${this.settings.sshKnownHosts}\n# end from input known hosts\n`;
  30228. }
  30229. knownHosts += `# Begin implicitly added github.com\ngithub.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=\n# End implicitly added github.com\n`;
  30230. this.sshKnownHostsPath = external_path_.join(runnerTemp, `${uniqueId}_known_hosts`);
  30231. setSshKnownHostsPath(this.sshKnownHostsPath);
  30232. await external_fs_.promises.writeFile(this.sshKnownHostsPath, knownHosts);
  30233. // Configure GIT_SSH_COMMAND
  30234. const sshPath = await io.which('ssh', true);
  30235. this.sshCommand = `"${sshPath}" -i "$RUNNER_TEMP/${external_path_.basename(this.sshKeyPath)}"`;
  30236. if (this.settings.sshStrict) {
  30237. this.sshCommand += ' -o StrictHostKeyChecking=yes -o CheckHostIP=no';
  30238. }
  30239. this.sshCommand += ` -o "UserKnownHostsFile=$RUNNER_TEMP/${external_path_.basename(this.sshKnownHostsPath)}"`;
  30240. core.info(`Temporarily overriding GIT_SSH_COMMAND=${this.sshCommand}`);
  30241. this.git.setEnvironmentVariable('GIT_SSH_COMMAND', this.sshCommand);
  30242. // Configure core.sshCommand
  30243. if (this.settings.persistCredentials) {
  30244. await this.git.config(SSH_COMMAND_KEY, this.sshCommand);
  30245. }
  30246. }
  30247. /**
  30248. * Configures token-based authentication by creating a credentials config file
  30249. * and setting up includeIf entries to reference it.
  30250. * @param globalConfig Whether to configure global config instead of local
  30251. */
  30252. async configureToken(globalConfig) {
  30253. // Get the credentials config file path in RUNNER_TEMP
  30254. const credentialsConfigPath = this.getCredentialsConfigPath();
  30255. // Write placeholder to the separate credentials config file using git config.
  30256. // This approach avoids the credential being captured by process creation audit events,
  30257. // which are commonly logged. For more information, refer to
  30258. // https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing
  30259. await this.git.config(this.tokenConfigKey, this.tokenPlaceholderConfigValue, false, // globalConfig?
  30260. false, // add?
  30261. credentialsConfigPath);
  30262. // Replace the placeholder in the credentials config file
  30263. let content = (await external_fs_.promises.readFile(credentialsConfigPath)).toString();
  30264. const placeholderIndex = content.indexOf(this.tokenPlaceholderConfigValue);
  30265. if (placeholderIndex < 0 ||
  30266. placeholderIndex != content.lastIndexOf(this.tokenPlaceholderConfigValue)) {
  30267. throw new Error(`Unable to replace auth placeholder in ${credentialsConfigPath}`);
  30268. }
  30269. external_assert_.ok(this.tokenConfigValue, 'tokenConfigValue is not defined');
  30270. content = content.replace(this.tokenPlaceholderConfigValue, this.tokenConfigValue);
  30271. await external_fs_.promises.writeFile(credentialsConfigPath, content);
  30272. // Add include or includeIf to reference the credentials config
  30273. if (globalConfig) {
  30274. // Global config file is temporary
  30275. await this.git.config('include.path', credentialsConfigPath, true // globalConfig?
  30276. );
  30277. }
  30278. else {
  30279. // Host git directory
  30280. let gitDir = external_path_.join(this.git.getWorkingDirectory(), '.git');
  30281. gitDir = gitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
  30282. // Configure host includeIf
  30283. const hostIncludeKey = `includeIf.gitdir:${gitDir}.path`;
  30284. await this.git.config(hostIncludeKey, credentialsConfigPath);
  30285. // Configure host includeIf for worktrees
  30286. const hostWorktreeIncludeKey = `includeIf.gitdir:${gitDir}/worktrees/*.path`;
  30287. await this.git.config(hostWorktreeIncludeKey, credentialsConfigPath);
  30288. // Container git directory
  30289. const workingDirectory = this.git.getWorkingDirectory();
  30290. const githubWorkspace = process.env['GITHUB_WORKSPACE'];
  30291. external_assert_.ok(githubWorkspace, 'GITHUB_WORKSPACE is not defined');
  30292. let relativePath = external_path_.relative(githubWorkspace, workingDirectory);
  30293. relativePath = relativePath.replace(/\\/g, '/'); // Use forward slashes, even on Windows
  30294. const containerGitDir = external_path_.posix.join('/github/workspace', relativePath, '.git');
  30295. // Container credentials config path
  30296. const containerCredentialsPath = external_path_.posix.join('/github/runner_temp', external_path_.basename(credentialsConfigPath));
  30297. // Configure container includeIf
  30298. const containerIncludeKey = `includeIf.gitdir:${containerGitDir}.path`;
  30299. await this.git.config(containerIncludeKey, containerCredentialsPath);
  30300. // Configure container includeIf for worktrees
  30301. const containerWorktreeIncludeKey = `includeIf.gitdir:${containerGitDir}/worktrees/*.path`;
  30302. await this.git.config(containerWorktreeIncludeKey, containerCredentialsPath);
  30303. }
  30304. }
  30305. /**
  30306. * Gets or creates the path to the credentials config file in RUNNER_TEMP.
  30307. * @returns The absolute path to the credentials config file
  30308. */
  30309. getCredentialsConfigPath() {
  30310. if (this.credentialsConfigPath) {
  30311. return this.credentialsConfigPath;
  30312. }
  30313. const runnerTemp = process.env['RUNNER_TEMP'] || '';
  30314. external_assert_.ok(runnerTemp, 'RUNNER_TEMP is not defined');
  30315. // Create a unique filename for this checkout instance
  30316. const configFileName = `git-credentials-${(0,external_crypto_.randomUUID)()}.config`;
  30317. this.credentialsConfigPath = external_path_.join(runnerTemp, configFileName);
  30318. core.debug(`Credentials config path: ${this.credentialsConfigPath}`);
  30319. return this.credentialsConfigPath;
  30320. }
  30321. /**
  30322. * Removes SSH authentication configuration by cleaning up SSH keys,
  30323. * known hosts files, and SSH command configurations.
  30324. */
  30325. async removeSsh() {
  30326. // SSH key
  30327. const keyPath = this.sshKeyPath || SshKeyPath;
  30328. if (keyPath) {
  30329. try {
  30330. core.info(`Removing SSH key '${keyPath}'`);
  30331. await io.rmRF(keyPath);
  30332. }
  30333. catch (err) {
  30334. core.debug(`${err?.message ?? err}`);
  30335. core.warning(`Failed to remove SSH key '${keyPath}'`);
  30336. }
  30337. }
  30338. // SSH known hosts
  30339. const knownHostsPath = this.sshKnownHostsPath || SshKnownHostsPath;
  30340. if (knownHostsPath) {
  30341. try {
  30342. core.info(`Removing SSH known hosts '${knownHostsPath}'`);
  30343. await io.rmRF(knownHostsPath);
  30344. }
  30345. catch (err) {
  30346. core.debug(`${err?.message ?? err}`);
  30347. core.warning(`Failed to remove SSH known hosts '${knownHostsPath}'`);
  30348. }
  30349. }
  30350. // SSH command
  30351. core.info('Removing SSH command configuration');
  30352. await this.removeGitConfig(SSH_COMMAND_KEY);
  30353. await this.removeSubmoduleGitConfig(SSH_COMMAND_KEY);
  30354. }
  30355. /**
  30356. * Removes token-based authentication by cleaning up HTTP headers,
  30357. * includeIf entries, and credentials config files.
  30358. */
  30359. async removeToken() {
  30360. // Remove HTTP extra header
  30361. core.info('Removing HTTP extra header');
  30362. await this.removeGitConfig(this.tokenConfigKey);
  30363. await this.removeSubmoduleGitConfig(this.tokenConfigKey);
  30364. // Collect credentials config paths that need to be removed
  30365. const credentialsPaths = new Set();
  30366. // Remove includeIf entries that point to git-credentials-*.config files
  30367. core.info('Removing includeIf entries pointing to credentials config files');
  30368. const mainCredentialsPaths = await this.removeIncludeIfCredentials();
  30369. mainCredentialsPaths.forEach(path => credentialsPaths.add(path));
  30370. // Remove submodule includeIf entries that point to git-credentials-*.config files
  30371. const submoduleConfigPaths = await this.git.getSubmoduleConfigPaths(true);
  30372. for (const configPath of submoduleConfigPaths) {
  30373. const submoduleCredentialsPaths = await this.removeIncludeIfCredentials(configPath);
  30374. submoduleCredentialsPaths.forEach(path => credentialsPaths.add(path));
  30375. }
  30376. // Remove credentials config files
  30377. for (const credentialsPath of credentialsPaths) {
  30378. // Only remove credentials config files if they are under RUNNER_TEMP
  30379. const runnerTemp = process.env['RUNNER_TEMP'];
  30380. external_assert_.ok(runnerTemp, 'RUNNER_TEMP is not defined');
  30381. if (credentialsPath.startsWith(runnerTemp)) {
  30382. try {
  30383. core.info(`Removing credentials config '${credentialsPath}'`);
  30384. await io.rmRF(credentialsPath);
  30385. }
  30386. catch (err) {
  30387. core.debug(`${err?.message ?? err}`);
  30388. core.warning(`Failed to remove credentials config '${credentialsPath}'`);
  30389. }
  30390. }
  30391. else {
  30392. core.debug(`Skipping removal of credentials config '${credentialsPath}' - not under RUNNER_TEMP`);
  30393. }
  30394. }
  30395. }
  30396. /**
  30397. * Removes a git config key from the local repository config.
  30398. * @param configKey The git config key to remove
  30399. */
  30400. async removeGitConfig(configKey) {
  30401. if ((await this.git.configExists(configKey)) &&
  30402. !(await this.git.tryConfigUnset(configKey))) {
  30403. // Load the config contents
  30404. core.warning(`Failed to remove '${configKey}' from the git config`);
  30405. }
  30406. }
  30407. /**
  30408. * Removes a git config key from all submodule configs.
  30409. * @param configKey The git config key to remove
  30410. */
  30411. async removeSubmoduleGitConfig(configKey) {
  30412. const pattern = regexp_helper_escape(configKey);
  30413. await this.git.submoduleForeach(
  30414. // Wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline.
  30415. `sh -c "git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :"`, true);
  30416. }
  30417. /**
  30418. * Removes includeIf entries that point to git-credentials-*.config files.
  30419. * @param configPath Optional path to a specific git config file to operate on
  30420. * @returns Array of unique credentials config file paths that were found and removed
  30421. */
  30422. async removeIncludeIfCredentials(configPath) {
  30423. const credentialsPaths = new Set();
  30424. try {
  30425. // Get all includeIf.gitdir keys
  30426. const keys = await this.git.tryGetConfigKeys('^includeIf\\.gitdir:', false, // globalConfig?
  30427. configPath);
  30428. for (const key of keys) {
  30429. // Get all values for this key
  30430. const values = await this.git.tryGetConfigValues(key, false, // globalConfig?
  30431. configPath);
  30432. if (values.length > 0) {
  30433. // Remove only values that match git-credentials-<uuid>.config pattern
  30434. for (const value of values) {
  30435. if (this.testCredentialsConfigPath(value)) {
  30436. credentialsPaths.add(value);
  30437. await this.git.tryConfigUnsetValue(key, value, false, configPath);
  30438. }
  30439. }
  30440. }
  30441. }
  30442. }
  30443. catch (err) {
  30444. // Ignore errors - this is cleanup code
  30445. if (configPath) {
  30446. core.debug(`Error during includeIf cleanup for ${configPath}: ${err}`);
  30447. }
  30448. else {
  30449. core.debug(`Error during includeIf cleanup: ${err}`);
  30450. }
  30451. }
  30452. return Array.from(credentialsPaths);
  30453. }
  30454. /**
  30455. * Tests if a path matches the git-credentials-*.config pattern.
  30456. * @param path The path to test
  30457. * @returns True if the path matches the credentials config pattern
  30458. */
  30459. testCredentialsConfigPath(path) {
  30460. return /git-credentials-[0-9a-f-]+\.config$/i.test(path);
  30461. }
  30462. }
  30463. ;// CONCATENATED MODULE: ./src/retry-helper.ts
  30464. const defaultMaxAttempts = 3;
  30465. const defaultMinSeconds = 10;
  30466. const defaultMaxSeconds = 20;
  30467. class RetryHelper {
  30468. maxAttempts;
  30469. minSeconds;
  30470. maxSeconds;
  30471. constructor(maxAttempts = defaultMaxAttempts, minSeconds = defaultMinSeconds, maxSeconds = defaultMaxSeconds) {
  30472. this.maxAttempts = maxAttempts;
  30473. this.minSeconds = Math.floor(minSeconds);
  30474. this.maxSeconds = Math.floor(maxSeconds);
  30475. if (this.minSeconds > this.maxSeconds) {
  30476. throw new Error('min seconds should be less than or equal to max seconds');
  30477. }
  30478. }
  30479. async execute(action) {
  30480. let attempt = 1;
  30481. while (attempt < this.maxAttempts) {
  30482. // Try
  30483. try {
  30484. return await action();
  30485. }
  30486. catch (err) {
  30487. core.info(err?.message);
  30488. }
  30489. // Sleep
  30490. const seconds = this.getSleepAmount();
  30491. core.info(`Waiting ${seconds} seconds before trying again`);
  30492. await this.sleep(seconds);
  30493. attempt++;
  30494. }
  30495. // Last attempt
  30496. return await action();
  30497. }
  30498. getSleepAmount() {
  30499. return (Math.floor(Math.random() * (this.maxSeconds - this.minSeconds + 1)) +
  30500. this.minSeconds);
  30501. }
  30502. async sleep(seconds) {
  30503. return new Promise(resolve => setTimeout(resolve, seconds * 1000));
  30504. }
  30505. }
  30506. async function execute(action) {
  30507. const retryHelper = new RetryHelper();
  30508. return await retryHelper.execute(action);
  30509. }
  30510. ;// CONCATENATED MODULE: ./src/git-version.ts
  30511. class GitVersion {
  30512. major = NaN;
  30513. minor = NaN;
  30514. patch = NaN;
  30515. /**
  30516. * Used for comparing the version of git and git-lfs against the minimum required version
  30517. * @param version the version string, e.g. 1.2 or 1.2.3
  30518. */
  30519. constructor(version) {
  30520. if (version) {
  30521. const match = version.match(/^(\d+)\.(\d+)(\.(\d+))?$/);
  30522. if (match) {
  30523. this.major = Number(match[1]);
  30524. this.minor = Number(match[2]);
  30525. if (match[4]) {
  30526. this.patch = Number(match[4]);
  30527. }
  30528. }
  30529. }
  30530. }
  30531. /**
  30532. * Compares the instance against a minimum required version
  30533. * @param minimum Minimum version
  30534. */
  30535. checkMinimum(minimum) {
  30536. if (!minimum.isValid()) {
  30537. throw new Error('Arg minimum is not a valid version');
  30538. }
  30539. // Major is insufficient
  30540. if (this.major < minimum.major) {
  30541. return false;
  30542. }
  30543. // Major is equal
  30544. if (this.major === minimum.major) {
  30545. // Minor is insufficient
  30546. if (this.minor < minimum.minor) {
  30547. return false;
  30548. }
  30549. // Minor is equal
  30550. if (this.minor === minimum.minor) {
  30551. // Patch is insufficient
  30552. if (this.patch && this.patch < (minimum.patch || 0)) {
  30553. return false;
  30554. }
  30555. }
  30556. }
  30557. return true;
  30558. }
  30559. /**
  30560. * Indicates whether the instance was constructed from a valid version string
  30561. */
  30562. isValid() {
  30563. return !isNaN(this.major);
  30564. }
  30565. /**
  30566. * Returns the version as a string, e.g. 1.2 or 1.2.3
  30567. */
  30568. toString() {
  30569. let result = '';
  30570. if (this.isValid()) {
  30571. result = `${this.major}.${this.minor}`;
  30572. if (!isNaN(this.patch)) {
  30573. result += `.${this.patch}`;
  30574. }
  30575. }
  30576. return result;
  30577. }
  30578. }
  30579. ;// CONCATENATED MODULE: ./src/git-command-manager.ts
  30580. // Auth header not supported before 2.9
  30581. // Wire protocol v2 not supported before 2.18
  30582. // sparse-checkout not [well-]supported before 2.28 (see https://github.com/actions/checkout/issues/1386)
  30583. const MinimumGitVersion = new GitVersion('2.18');
  30584. const MinimumGitSparseCheckoutVersion = new GitVersion('2.28');
  30585. async function createCommandManager(workingDirectory, lfs, doSparseCheckout) {
  30586. return await GitCommandManager.createCommandManager(workingDirectory, lfs, doSparseCheckout);
  30587. }
  30588. class GitCommandManager {
  30589. gitEnv = {
  30590. GIT_TERMINAL_PROMPT: '0', // Disable git prompt
  30591. GCM_INTERACTIVE: 'Never' // Disable prompting for git credential manager
  30592. };
  30593. gitPath = '';
  30594. lfs = false;
  30595. doSparseCheckout = false;
  30596. workingDirectory = '';
  30597. gitVersion = new GitVersion();
  30598. // Private constructor; use createCommandManager()
  30599. constructor() { }
  30600. async branchDelete(remote, branch) {
  30601. const args = ['branch', '--delete', '--force'];
  30602. if (remote) {
  30603. args.push('--remote');
  30604. }
  30605. args.push(branch);
  30606. await this.execGit(args);
  30607. }
  30608. async branchExists(remote, pattern) {
  30609. const args = ['branch', '--list'];
  30610. if (remote) {
  30611. args.push('--remote');
  30612. }
  30613. args.push(pattern);
  30614. const output = await this.execGit(args);
  30615. return !!output.stdout.trim();
  30616. }
  30617. async branchList(remote) {
  30618. const result = [];
  30619. // Note, this implementation uses "rev-parse --symbolic-full-name" because the output from
  30620. // "branch --list" is more difficult when in a detached HEAD state.
  30621. // TODO(https://github.com/actions/checkout/issues/786): this implementation uses
  30622. // "rev-parse --symbolic-full-name" because there is a bug
  30623. // in Git 2.18 that causes "rev-parse --symbolic" to output symbolic full names. When
  30624. // 2.18 is no longer supported, we can switch back to --symbolic.
  30625. const args = ['rev-parse', '--symbolic-full-name'];
  30626. if (remote) {
  30627. args.push('--remotes=origin');
  30628. }
  30629. else {
  30630. args.push('--branches');
  30631. }
  30632. const stderr = [];
  30633. const errline = [];
  30634. const stdout = [];
  30635. const stdline = [];
  30636. const listeners = {
  30637. stderr: (data) => {
  30638. stderr.push(data.toString());
  30639. },
  30640. errline: (data) => {
  30641. errline.push(data.toString());
  30642. },
  30643. stdout: (data) => {
  30644. stdout.push(data.toString());
  30645. },
  30646. stdline: (data) => {
  30647. stdline.push(data.toString());
  30648. }
  30649. };
  30650. // Suppress the output in order to avoid flooding annotations with innocuous errors.
  30651. await this.execGit(args, false, true, listeners);
  30652. core.debug(`stderr callback is: ${stderr}`);
  30653. core.debug(`errline callback is: ${errline}`);
  30654. core.debug(`stdout callback is: ${stdout}`);
  30655. core.debug(`stdline callback is: ${stdline}`);
  30656. for (let branch of stdline) {
  30657. branch = branch.trim();
  30658. if (!branch) {
  30659. continue;
  30660. }
  30661. if (branch.startsWith('refs/heads/')) {
  30662. branch = branch.substring('refs/heads/'.length);
  30663. }
  30664. else if (branch.startsWith('refs/remotes/')) {
  30665. branch = branch.substring('refs/remotes/'.length);
  30666. }
  30667. result.push(branch);
  30668. }
  30669. return result;
  30670. }
  30671. async disableSparseCheckout() {
  30672. await this.execGit(['sparse-checkout', 'disable']);
  30673. // Disabling 'sparse-checkout` leaves behind an undesirable side-effect in config (even in a pristine environment).
  30674. await this.tryConfigUnset('extensions.worktreeConfig', false);
  30675. }
  30676. async sparseCheckout(sparseCheckout) {
  30677. await this.execGit(['sparse-checkout', 'set', ...sparseCheckout]);
  30678. }
  30679. async sparseCheckoutNonConeMode(sparseCheckout) {
  30680. await this.execGit(['config', 'core.sparseCheckout', 'true']);
  30681. const output = await this.execGit([
  30682. 'rev-parse',
  30683. '--git-path',
  30684. 'info/sparse-checkout'
  30685. ]);
  30686. const sparseCheckoutPath = external_path_.join(this.workingDirectory, output.stdout.trimRight());
  30687. await external_fs_.promises.appendFile(sparseCheckoutPath, `\n${sparseCheckout.join('\n')}\n`);
  30688. }
  30689. async checkout(ref, startPoint) {
  30690. const args = ['checkout', '--progress', '--force'];
  30691. if (startPoint) {
  30692. args.push('-B', ref, startPoint);
  30693. }
  30694. else {
  30695. args.push(ref);
  30696. }
  30697. await this.execGit(args);
  30698. }
  30699. async checkoutDetach() {
  30700. const args = ['checkout', '--detach'];
  30701. await this.execGit(args);
  30702. }
  30703. async config(configKey, configValue, globalConfig, add, configFile) {
  30704. const args = ['config'];
  30705. if (configFile) {
  30706. args.push('--file', configFile);
  30707. }
  30708. else {
  30709. args.push(globalConfig ? '--global' : '--local');
  30710. }
  30711. if (add) {
  30712. args.push('--add');
  30713. }
  30714. args.push(...[configKey, configValue]);
  30715. await this.execGit(args);
  30716. }
  30717. async configExists(configKey, globalConfig) {
  30718. const pattern = regexp_helper_escape(configKey);
  30719. const output = await this.execGit([
  30720. 'config',
  30721. globalConfig ? '--global' : '--local',
  30722. '--name-only',
  30723. '--get-regexp',
  30724. pattern
  30725. ], true);
  30726. return output.exitCode === 0;
  30727. }
  30728. async fetch(refSpec, options) {
  30729. const args = ['-c', 'protocol.version=2', 'fetch'];
  30730. // Always use --no-tags for explicit control over tag fetching
  30731. // Tags are fetched explicitly via refspec when needed
  30732. args.push('--no-tags');
  30733. args.push('--prune', '--no-recurse-submodules');
  30734. if (options.showProgress) {
  30735. args.push('--progress');
  30736. }
  30737. if (options.filter) {
  30738. args.push(`--filter=${options.filter}`);
  30739. }
  30740. if (options.fetchDepth && options.fetchDepth > 0) {
  30741. args.push(`--depth=${options.fetchDepth}`);
  30742. }
  30743. else if (fileExistsSync(external_path_.join(this.workingDirectory, '.git', 'shallow'))) {
  30744. args.push('--unshallow');
  30745. }
  30746. args.push('origin');
  30747. for (const arg of refSpec) {
  30748. args.push(arg);
  30749. }
  30750. const that = this;
  30751. await execute(async () => {
  30752. await that.execGit(args);
  30753. });
  30754. }
  30755. async getDefaultBranch(repositoryUrl) {
  30756. let output;
  30757. await execute(async () => {
  30758. output = await this.execGit([
  30759. 'ls-remote',
  30760. '--quiet',
  30761. '--exit-code',
  30762. '--symref',
  30763. repositoryUrl,
  30764. 'HEAD'
  30765. ]);
  30766. });
  30767. if (output) {
  30768. // Satisfy compiler, will always be set
  30769. for (let line of output.stdout.trim().split('\n')) {
  30770. line = line.trim();
  30771. if (line.startsWith('ref:') || line.endsWith('HEAD')) {
  30772. return line
  30773. .substr('ref:'.length, line.length - 'ref:'.length - 'HEAD'.length)
  30774. .trim();
  30775. }
  30776. }
  30777. }
  30778. throw new Error('Unexpected output when retrieving default branch');
  30779. }
  30780. async getSubmoduleConfigPaths(recursive) {
  30781. // Get submodule config file paths.
  30782. // Use `--show-origin` to get the config file path for each submodule.
  30783. const output = await this.submoduleForeach(`git config --local --show-origin --name-only --get-regexp remote.origin.url`, recursive);
  30784. // Extract config file paths from the output (lines starting with "file:").
  30785. const configPaths = output.match(/(?<=(^|\n)file:)[^\t]+(?=\tremote\.origin\.url)/g) || [];
  30786. return configPaths;
  30787. }
  30788. getWorkingDirectory() {
  30789. return this.workingDirectory;
  30790. }
  30791. async init(objectFormat) {
  30792. const args = ['init'];
  30793. if (objectFormat === 'sha256') {
  30794. args.push('--object-format=sha256');
  30795. }
  30796. args.push(this.workingDirectory);
  30797. await this.execGit(args);
  30798. }
  30799. async isDetached() {
  30800. // Note, "branch --show-current" would be simpler but isn't available until Git 2.22
  30801. const output = await this.execGit(['rev-parse', '--symbolic-full-name', '--verify', '--quiet', 'HEAD'], true);
  30802. return !output.stdout.trim().startsWith('refs/heads/');
  30803. }
  30804. async lfsFetch(ref) {
  30805. const args = ['lfs', 'fetch', 'origin', ref];
  30806. const that = this;
  30807. await execute(async () => {
  30808. await that.execGit(args);
  30809. });
  30810. }
  30811. async lfsInstall() {
  30812. await this.execGit(['lfs', 'install', '--local']);
  30813. }
  30814. async log1(format) {
  30815. const args = format ? ['log', '-1', format] : ['log', '-1'];
  30816. const silent = format ? false : true;
  30817. const output = await this.execGit(args, false, silent);
  30818. return output.stdout;
  30819. }
  30820. async remoteAdd(remoteName, remoteUrl) {
  30821. await this.execGit(['remote', 'add', remoteName, remoteUrl]);
  30822. }
  30823. removeEnvironmentVariable(name) {
  30824. delete this.gitEnv[name];
  30825. }
  30826. /**
  30827. * Resolves a ref to a SHA. For a branch or lightweight tag, the commit SHA is returned.
  30828. * For an annotated tag, the tag SHA is returned.
  30829. * @param {string} ref For example: 'refs/heads/main' or '/refs/tags/v1'
  30830. * @returns {Promise<string>}
  30831. */
  30832. async revParse(ref) {
  30833. const output = await this.execGit(['rev-parse', ref]);
  30834. return output.stdout.trim();
  30835. }
  30836. setEnvironmentVariable(name, value) {
  30837. this.gitEnv[name] = value;
  30838. }
  30839. async shaExists(sha) {
  30840. const args = ['rev-parse', '--verify', '--quiet', `${sha}^{object}`];
  30841. const output = await this.execGit(args, true);
  30842. return output.exitCode === 0;
  30843. }
  30844. async submoduleForeach(command, recursive) {
  30845. const args = ['submodule', 'foreach'];
  30846. if (recursive) {
  30847. args.push('--recursive');
  30848. }
  30849. args.push(command);
  30850. const output = await this.execGit(args);
  30851. return output.stdout;
  30852. }
  30853. async submoduleSync(recursive) {
  30854. const args = ['submodule', 'sync'];
  30855. if (recursive) {
  30856. args.push('--recursive');
  30857. }
  30858. await this.execGit(args);
  30859. }
  30860. async submoduleUpdate(fetchDepth, recursive) {
  30861. const args = ['-c', 'protocol.version=2'];
  30862. args.push('submodule', 'update', '--init', '--force');
  30863. if (fetchDepth > 0) {
  30864. args.push(`--depth=${fetchDepth}`);
  30865. }
  30866. if (recursive) {
  30867. args.push('--recursive');
  30868. }
  30869. await this.execGit(args);
  30870. }
  30871. async submoduleStatus() {
  30872. const output = await this.execGit(['submodule', 'status'], true);
  30873. core.debug(output.stdout);
  30874. return output.exitCode === 0;
  30875. }
  30876. async tagExists(pattern) {
  30877. const output = await this.execGit(['tag', '--list', pattern]);
  30878. return !!output.stdout.trim();
  30879. }
  30880. async tryClean() {
  30881. const output = await this.execGit(['clean', '-ffdx'], true);
  30882. return output.exitCode === 0;
  30883. }
  30884. async tryConfigUnset(configKey, globalConfig) {
  30885. const output = await this.execGit([
  30886. 'config',
  30887. globalConfig ? '--global' : '--local',
  30888. '--unset-all',
  30889. configKey
  30890. ], true);
  30891. return output.exitCode === 0;
  30892. }
  30893. async tryConfigUnsetValue(configKey, configValue, globalConfig, configFile) {
  30894. const args = ['config'];
  30895. if (configFile) {
  30896. args.push('--file', configFile);
  30897. }
  30898. else {
  30899. args.push(globalConfig ? '--global' : '--local');
  30900. }
  30901. args.push('--unset', configKey, configValue);
  30902. const output = await this.execGit(args, true);
  30903. return output.exitCode === 0;
  30904. }
  30905. async tryDisableAutomaticGarbageCollection() {
  30906. const output = await this.execGit(['config', '--local', 'gc.auto', '0'], true);
  30907. return output.exitCode === 0;
  30908. }
  30909. async tryGetFetchUrl() {
  30910. const output = await this.execGit(['config', '--local', '--get', 'remote.origin.url'], true);
  30911. if (output.exitCode !== 0) {
  30912. return '';
  30913. }
  30914. const stdout = output.stdout.trim();
  30915. if (stdout.includes('\n')) {
  30916. return '';
  30917. }
  30918. return stdout;
  30919. }
  30920. async tryGetConfigValues(configKey, globalConfig, configFile) {
  30921. const args = ['config'];
  30922. if (configFile) {
  30923. args.push('--file', configFile);
  30924. }
  30925. else {
  30926. args.push(globalConfig ? '--global' : '--local');
  30927. }
  30928. args.push('--get-all', configKey);
  30929. const output = await this.execGit(args, true);
  30930. if (output.exitCode !== 0) {
  30931. return [];
  30932. }
  30933. return output.stdout
  30934. .trim()
  30935. .split('\n')
  30936. .filter(value => value.trim());
  30937. }
  30938. async tryGetConfigKeys(pattern, globalConfig, configFile) {
  30939. const args = ['config'];
  30940. if (configFile) {
  30941. args.push('--file', configFile);
  30942. }
  30943. else {
  30944. args.push(globalConfig ? '--global' : '--local');
  30945. }
  30946. args.push('--name-only', '--get-regexp', pattern);
  30947. const output = await this.execGit(args, true);
  30948. if (output.exitCode !== 0) {
  30949. return [];
  30950. }
  30951. return output.stdout
  30952. .trim()
  30953. .split('\n')
  30954. .filter(key => key.trim());
  30955. }
  30956. async tryReset() {
  30957. const output = await this.execGit(['reset', '--hard', 'HEAD'], true);
  30958. return output.exitCode === 0;
  30959. }
  30960. async version() {
  30961. return this.gitVersion;
  30962. }
  30963. static async createCommandManager(workingDirectory, lfs, doSparseCheckout) {
  30964. const result = new GitCommandManager();
  30965. await result.initializeCommandManager(workingDirectory, lfs, doSparseCheckout);
  30966. return result;
  30967. }
  30968. async execGit(args, allowAllExitCodes = false, silent = false, customListeners = {}) {
  30969. directoryExistsSync(this.workingDirectory, true);
  30970. const result = new GitOutput();
  30971. const env = {};
  30972. for (const key of Object.keys(process.env)) {
  30973. env[key] = process.env[key];
  30974. }
  30975. for (const key of Object.keys(this.gitEnv)) {
  30976. env[key] = this.gitEnv[key];
  30977. }
  30978. const defaultListener = {
  30979. stdout: (data) => {
  30980. stdout.push(data.toString());
  30981. }
  30982. };
  30983. const mergedListeners = { ...defaultListener, ...customListeners };
  30984. const stdout = [];
  30985. const options = {
  30986. cwd: this.workingDirectory,
  30987. env,
  30988. silent,
  30989. ignoreReturnCode: allowAllExitCodes,
  30990. listeners: mergedListeners
  30991. };
  30992. result.exitCode = await exec.exec(`"${this.gitPath}"`, args, options);
  30993. result.stdout = stdout.join('');
  30994. core.debug(result.exitCode.toString());
  30995. core.debug(result.stdout);
  30996. return result;
  30997. }
  30998. async initializeCommandManager(workingDirectory, lfs, doSparseCheckout) {
  30999. this.workingDirectory = workingDirectory;
  31000. // Git-lfs will try to pull down assets if any of the local/user/system setting exist.
  31001. // If the user didn't enable `LFS` in their pipeline definition, disable LFS fetch/checkout.
  31002. this.lfs = lfs;
  31003. if (!this.lfs) {
  31004. this.gitEnv['GIT_LFS_SKIP_SMUDGE'] = '1';
  31005. }
  31006. this.gitPath = await io.which('git', true);
  31007. // Git version
  31008. core.debug('Getting git version');
  31009. this.gitVersion = new GitVersion();
  31010. let gitOutput = await this.execGit(['version']);
  31011. let stdout = gitOutput.stdout.trim();
  31012. if (!stdout.includes('\n')) {
  31013. const match = stdout.match(/\d+\.\d+(\.\d+)?/);
  31014. if (match) {
  31015. this.gitVersion = new GitVersion(match[0]);
  31016. }
  31017. }
  31018. if (!this.gitVersion.isValid()) {
  31019. throw new Error('Unable to determine git version');
  31020. }
  31021. // Minimum git version
  31022. if (!this.gitVersion.checkMinimum(MinimumGitVersion)) {
  31023. throw new Error(`Minimum required git version is ${MinimumGitVersion}. Your git ('${this.gitPath}') is ${this.gitVersion}`);
  31024. }
  31025. if (this.lfs) {
  31026. // Git-lfs version
  31027. core.debug('Getting git-lfs version');
  31028. let gitLfsVersion = new GitVersion();
  31029. const gitLfsPath = await io.which('git-lfs', true);
  31030. gitOutput = await this.execGit(['lfs', 'version']);
  31031. stdout = gitOutput.stdout.trim();
  31032. if (!stdout.includes('\n')) {
  31033. const match = stdout.match(/\d+\.\d+(\.\d+)?/);
  31034. if (match) {
  31035. gitLfsVersion = new GitVersion(match[0]);
  31036. }
  31037. }
  31038. if (!gitLfsVersion.isValid()) {
  31039. throw new Error('Unable to determine git-lfs version');
  31040. }
  31041. // Minimum git-lfs version
  31042. // Note:
  31043. // - Auth header not supported before 2.1
  31044. const minimumGitLfsVersion = new GitVersion('2.1');
  31045. if (!gitLfsVersion.checkMinimum(minimumGitLfsVersion)) {
  31046. throw new Error(`Minimum required git-lfs version is ${minimumGitLfsVersion}. Your git-lfs ('${gitLfsPath}') is ${gitLfsVersion}`);
  31047. }
  31048. }
  31049. this.doSparseCheckout = doSparseCheckout;
  31050. if (this.doSparseCheckout) {
  31051. if (!this.gitVersion.checkMinimum(MinimumGitSparseCheckoutVersion)) {
  31052. throw new Error(`Minimum Git version required for sparse checkout is ${MinimumGitSparseCheckoutVersion}. Your git ('${this.gitPath}') is ${this.gitVersion}`);
  31053. }
  31054. }
  31055. // Set the user agent
  31056. let gitHttpUserAgent = `git/${this.gitVersion} (github-actions-checkout)`;
  31057. // Append orchestration ID if set
  31058. const orchId = process.env['ACTIONS_ORCHESTRATION_ID'];
  31059. if (orchId) {
  31060. // Sanitize the orchestration ID to ensure it contains only valid characters
  31061. // Valid characters: 0-9, a-z, _, -, .
  31062. const sanitizedId = orchId.replace(/[^a-z0-9_.-]/gi, '_');
  31063. if (sanitizedId) {
  31064. gitHttpUserAgent = `${gitHttpUserAgent} actions_orchestration_id/${sanitizedId}`;
  31065. }
  31066. }
  31067. core.debug(`Set git useragent to: ${gitHttpUserAgent}`);
  31068. this.gitEnv['GIT_HTTP_USER_AGENT'] = gitHttpUserAgent;
  31069. }
  31070. }
  31071. class GitOutput {
  31072. stdout = '';
  31073. exitCode = 0;
  31074. }
  31075. ;// CONCATENATED MODULE: ./src/git-directory-helper.ts
  31076. async function prepareExistingDirectory(git, repositoryPath, repositoryUrl, clean, ref) {
  31077. external_assert_.ok(repositoryPath, 'Expected repositoryPath to be defined');
  31078. external_assert_.ok(repositoryUrl, 'Expected repositoryUrl to be defined');
  31079. // Indicates whether to delete the directory contents
  31080. let remove = false;
  31081. // Check whether using git or REST API
  31082. if (!git) {
  31083. remove = true;
  31084. }
  31085. // Fetch URL does not match
  31086. else if (!directoryExistsSync(external_path_.join(repositoryPath, '.git')) ||
  31087. repositoryUrl !== (await git.tryGetFetchUrl())) {
  31088. remove = true;
  31089. }
  31090. else {
  31091. // Delete any index.lock and shallow.lock left by a previously canceled run or crashed git process
  31092. const lockPaths = [
  31093. external_path_.join(repositoryPath, '.git', 'index.lock'),
  31094. external_path_.join(repositoryPath, '.git', 'shallow.lock')
  31095. ];
  31096. for (const lockPath of lockPaths) {
  31097. try {
  31098. await io.rmRF(lockPath);
  31099. }
  31100. catch (error) {
  31101. core.debug(`Unable to delete '${lockPath}'. ${error?.message ?? error}`);
  31102. }
  31103. }
  31104. try {
  31105. core.startGroup('Removing previously created refs, to avoid conflicts');
  31106. // Checkout detached HEAD
  31107. if (!(await git.isDetached())) {
  31108. await git.checkoutDetach();
  31109. }
  31110. // Remove all refs/heads/*
  31111. let branches = await git.branchList(false);
  31112. for (const branch of branches) {
  31113. await git.branchDelete(false, branch);
  31114. }
  31115. // Remove any conflicting refs/remotes/origin/*
  31116. // Example 1: Consider ref is refs/heads/foo and previously fetched refs/remotes/origin/foo/bar
  31117. // Example 2: Consider ref is refs/heads/foo/bar and previously fetched refs/remotes/origin/foo
  31118. if (ref) {
  31119. ref = ref.startsWith('refs/') ? ref : `refs/heads/${ref}`;
  31120. if (ref.startsWith('refs/heads/')) {
  31121. const upperName1 = ref.toUpperCase().substr('REFS/HEADS/'.length);
  31122. const upperName1Slash = `${upperName1}/`;
  31123. branches = await git.branchList(true);
  31124. for (const branch of branches) {
  31125. const upperName2 = branch.substr('origin/'.length).toUpperCase();
  31126. const upperName2Slash = `${upperName2}/`;
  31127. if (upperName1.startsWith(upperName2Slash) ||
  31128. upperName2.startsWith(upperName1Slash)) {
  31129. await git.branchDelete(true, branch);
  31130. }
  31131. }
  31132. }
  31133. }
  31134. core.endGroup();
  31135. // Check for submodules and delete any existing files if submodules are present
  31136. if (!(await git.submoduleStatus())) {
  31137. remove = true;
  31138. core.info('Bad Submodules found, removing existing files');
  31139. }
  31140. // Clean
  31141. if (clean) {
  31142. core.startGroup('Cleaning the repository');
  31143. if (!(await git.tryClean())) {
  31144. core.debug(`The clean command failed. This might be caused by: 1) path too long, 2) permission issue, or 3) file in use. For further investigation, manually run 'git clean -ffdx' on the directory '${repositoryPath}'.`);
  31145. remove = true;
  31146. }
  31147. else if (!(await git.tryReset())) {
  31148. remove = true;
  31149. }
  31150. core.endGroup();
  31151. if (remove) {
  31152. core.warning(`Unable to clean or reset the repository. The repository will be recreated instead.`);
  31153. }
  31154. }
  31155. }
  31156. catch (error) {
  31157. core.warning(`Unable to prepare the existing repository. The repository will be recreated instead.`);
  31158. remove = true;
  31159. }
  31160. }
  31161. if (remove) {
  31162. // Delete the contents of the directory. Don't delete the directory itself
  31163. // since it might be the current working directory.
  31164. core.info(`Deleting the contents of '${repositoryPath}'`);
  31165. for (const file of await external_fs_.promises.readdir(repositoryPath)) {
  31166. await io.rmRF(external_path_.join(repositoryPath, file));
  31167. }
  31168. }
  31169. }
  31170. // EXTERNAL MODULE: ./node_modules/@actions/github/lib/github.js
  31171. var github = __nccwpck_require__(5438);
  31172. // EXTERNAL MODULE: ./node_modules/@actions/tool-cache/lib/tool-cache.js
  31173. var tool_cache = __nccwpck_require__(7784);
  31174. ;// CONCATENATED MODULE: ./src/github-api-helper.ts
  31175. const github_api_helper_IS_WINDOWS = process.platform === 'win32';
  31176. async function downloadRepository(authToken, owner, repo, ref, commit, repositoryPath, baseUrl) {
  31177. // Determine the default branch
  31178. if (!ref && !commit) {
  31179. core.info('Determining the default branch');
  31180. ref = await getDefaultBranch(authToken, owner, repo, baseUrl);
  31181. }
  31182. // Download the archive
  31183. let archiveData = await execute(async () => {
  31184. core.info('Downloading the archive');
  31185. return await downloadArchive(authToken, owner, repo, ref, commit, baseUrl);
  31186. });
  31187. // Write archive to disk
  31188. core.info('Writing archive to disk');
  31189. const uniqueId = (0,external_crypto_.randomUUID)();
  31190. const archivePath = github_api_helper_IS_WINDOWS
  31191. ? external_path_.join(repositoryPath, `${uniqueId}.zip`)
  31192. : external_path_.join(repositoryPath, `${uniqueId}.tar.gz`);
  31193. await external_fs_.promises.writeFile(archivePath, archiveData);
  31194. archiveData = Buffer.from(''); // Free memory
  31195. // Extract archive
  31196. core.info('Extracting the archive');
  31197. const extractPath = external_path_.join(repositoryPath, uniqueId);
  31198. await io.mkdirP(extractPath);
  31199. if (github_api_helper_IS_WINDOWS) {
  31200. await tool_cache.extractZip(archivePath, extractPath);
  31201. }
  31202. else {
  31203. await tool_cache.extractTar(archivePath, extractPath);
  31204. }
  31205. await io.rmRF(archivePath);
  31206. // Determine the path of the repository content. The archive contains
  31207. // a top-level folder and the repository content is inside.
  31208. const archiveFileNames = await external_fs_.promises.readdir(extractPath);
  31209. external_assert_.ok(archiveFileNames.length == 1, 'Expected exactly one directory inside archive');
  31210. const archiveVersion = archiveFileNames[0]; // The top-level folder name includes the short SHA
  31211. core.info(`Resolved version ${archiveVersion}`);
  31212. const tempRepositoryPath = external_path_.join(extractPath, archiveVersion);
  31213. // Move the files
  31214. for (const fileName of await external_fs_.promises.readdir(tempRepositoryPath)) {
  31215. const sourcePath = external_path_.join(tempRepositoryPath, fileName);
  31216. const targetPath = external_path_.join(repositoryPath, fileName);
  31217. if (github_api_helper_IS_WINDOWS) {
  31218. await io.cp(sourcePath, targetPath, { recursive: true }); // Copy on Windows (Windows Defender may have a lock)
  31219. }
  31220. else {
  31221. await io.mv(sourcePath, targetPath);
  31222. }
  31223. }
  31224. await io.rmRF(extractPath);
  31225. }
  31226. /**
  31227. * Looks up the default branch name
  31228. */
  31229. async function getDefaultBranch(authToken, owner, repo, baseUrl) {
  31230. return await execute(async () => {
  31231. core.info('Retrieving the default branch name');
  31232. const octokit = github.getOctokit(authToken, {
  31233. baseUrl: getServerApiUrl(baseUrl)
  31234. });
  31235. let result;
  31236. try {
  31237. // Get the default branch from the repo info
  31238. const response = await octokit.rest.repos.get({ owner, repo });
  31239. result = response.data.default_branch;
  31240. external_assert_.ok(result, 'default_branch cannot be empty');
  31241. }
  31242. catch (err) {
  31243. // Handle .wiki repo
  31244. if (err?.status === 404 &&
  31245. repo.toUpperCase().endsWith('.WIKI')) {
  31246. result = 'master';
  31247. }
  31248. // Otherwise error
  31249. else {
  31250. throw err;
  31251. }
  31252. }
  31253. // Print the default branch
  31254. core.info(`Default branch '${result}'`);
  31255. // Prefix with 'refs/heads'
  31256. if (!result.startsWith('refs/')) {
  31257. result = `refs/heads/${result}`;
  31258. }
  31259. return result;
  31260. });
  31261. }
  31262. async function tryGetRepositoryObjectFormat(authToken, owner, repo, baseUrl, commit) {
  31263. const commitFormat = getObjectFormat(commit);
  31264. if (commitFormat) {
  31265. return { format: commitFormat, succeeded: true };
  31266. }
  31267. try {
  31268. const octokit = github.getOctokit(authToken, {
  31269. baseUrl: getServerApiUrl(baseUrl)
  31270. });
  31271. const response = await octokit.request('GET /repos/{owner}/{repo}/hash-algorithm', { owner, repo });
  31272. const hashAlgorithm = response.data.hash_algorithm;
  31273. if (hashAlgorithm === 'sha256' || hashAlgorithm === 'sha1') {
  31274. return { format: hashAlgorithm, succeeded: true };
  31275. }
  31276. core.debug('Unable to determine repository object format from hash-algorithm endpoint');
  31277. return { format: '', succeeded: false };
  31278. }
  31279. catch (err) {
  31280. core.debug(`Unable to determine repository object format from hash-algorithm endpoint: ${err?.message ?? err}`);
  31281. return { format: '', succeeded: false };
  31282. }
  31283. }
  31284. function getObjectFormat(sha) {
  31285. if (/^[0-9a-fA-F]{64}$/.test(sha || '')) {
  31286. return 'sha256';
  31287. }
  31288. if (/^[0-9a-fA-F]{40}$/.test(sha || '')) {
  31289. return 'sha1';
  31290. }
  31291. return '';
  31292. }
  31293. async function downloadArchive(authToken, owner, repo, ref, commit, baseUrl) {
  31294. const octokit = github.getOctokit(authToken, {
  31295. baseUrl: getServerApiUrl(baseUrl)
  31296. });
  31297. const download = github_api_helper_IS_WINDOWS
  31298. ? octokit.rest.repos.downloadZipballArchive
  31299. : octokit.rest.repos.downloadTarballArchive;
  31300. const response = await download({
  31301. owner: owner,
  31302. repo: repo,
  31303. ref: commit || ref
  31304. });
  31305. return Buffer.from(response.data); // response.data is ArrayBuffer
  31306. }
  31307. ;// CONCATENATED MODULE: ./src/ref-helper.ts
  31308. const tagsRefSpec = '+refs/tags/*:refs/tags/*';
  31309. async function getCheckoutInfo(git, ref, commit) {
  31310. if (!git) {
  31311. throw new Error('Arg git cannot be empty');
  31312. }
  31313. if (!ref && !commit) {
  31314. throw new Error('Args ref and commit cannot both be empty');
  31315. }
  31316. const result = {};
  31317. const upperRef = (ref || '').toUpperCase();
  31318. // SHA only
  31319. if (!ref) {
  31320. result.ref = commit;
  31321. }
  31322. // refs/heads/
  31323. else if (upperRef.startsWith('REFS/HEADS/')) {
  31324. const branch = ref.substring('refs/heads/'.length);
  31325. result.ref = branch;
  31326. result.startPoint = `refs/remotes/origin/${branch}`;
  31327. }
  31328. // refs/pull/
  31329. else if (upperRef.startsWith('REFS/PULL/')) {
  31330. const branch = ref.substring('refs/pull/'.length);
  31331. result.ref = `refs/remotes/pull/${branch}`;
  31332. }
  31333. // refs/tags/
  31334. else if (upperRef.startsWith('REFS/TAGS/')) {
  31335. result.ref = ref;
  31336. }
  31337. // refs/
  31338. else if (upperRef.startsWith('REFS/')) {
  31339. result.ref = commit ? commit : ref;
  31340. }
  31341. // Unqualified ref, check for a matching branch or tag
  31342. else {
  31343. if (await git.branchExists(true, `origin/${ref}`)) {
  31344. result.ref = ref;
  31345. result.startPoint = `refs/remotes/origin/${ref}`;
  31346. }
  31347. else if (await git.tagExists(`${ref}`)) {
  31348. result.ref = `refs/tags/${ref}`;
  31349. }
  31350. else {
  31351. throw new Error(`A branch or tag with the name '${ref}' could not be found`);
  31352. }
  31353. }
  31354. return result;
  31355. }
  31356. function getRefSpecForAllHistory(ref, commit) {
  31357. const result = ['+refs/heads/*:refs/remotes/origin/*', tagsRefSpec];
  31358. if (ref && ref.toUpperCase().startsWith('REFS/PULL/')) {
  31359. const branch = ref.substring('refs/pull/'.length);
  31360. result.push(`+${commit || ref}:refs/remotes/pull/${branch}`);
  31361. }
  31362. return result;
  31363. }
  31364. function getRefSpec(ref, commit, fetchTags) {
  31365. if (!ref && !commit) {
  31366. throw new Error('Args ref and commit cannot both be empty');
  31367. }
  31368. const upperRef = (ref || '').toUpperCase();
  31369. const result = [];
  31370. // When fetchTags is true, always include the tags refspec
  31371. if (fetchTags) {
  31372. result.push(tagsRefSpec);
  31373. }
  31374. // SHA
  31375. if (commit) {
  31376. // refs/heads
  31377. if (upperRef.startsWith('REFS/HEADS/')) {
  31378. const branch = ref.substring('refs/heads/'.length);
  31379. result.push(`+${commit}:refs/remotes/origin/${branch}`);
  31380. }
  31381. // refs/pull/
  31382. else if (upperRef.startsWith('REFS/PULL/')) {
  31383. const branch = ref.substring('refs/pull/'.length);
  31384. result.push(`+${commit}:refs/remotes/pull/${branch}`);
  31385. }
  31386. // refs/tags/
  31387. else if (upperRef.startsWith('REFS/TAGS/')) {
  31388. if (!fetchTags) {
  31389. result.push(`+${ref}:${ref}`);
  31390. }
  31391. }
  31392. // Otherwise no destination ref
  31393. else {
  31394. result.push(commit);
  31395. }
  31396. }
  31397. // Unqualified ref, check for a matching branch or tag
  31398. else if (!upperRef.startsWith('REFS/')) {
  31399. result.push(`+refs/heads/${ref}*:refs/remotes/origin/${ref}*`);
  31400. if (!fetchTags) {
  31401. result.push(`+refs/tags/${ref}*:refs/tags/${ref}*`);
  31402. }
  31403. }
  31404. // refs/heads/
  31405. else if (upperRef.startsWith('REFS/HEADS/')) {
  31406. const branch = ref.substring('refs/heads/'.length);
  31407. result.push(`+${ref}:refs/remotes/origin/${branch}`);
  31408. }
  31409. // refs/pull/
  31410. else if (upperRef.startsWith('REFS/PULL/')) {
  31411. const branch = ref.substring('refs/pull/'.length);
  31412. result.push(`+${ref}:refs/remotes/pull/${branch}`);
  31413. }
  31414. // refs/tags/
  31415. else if (upperRef.startsWith('REFS/TAGS/')) {
  31416. if (!fetchTags) {
  31417. result.push(`+${ref}:${ref}`);
  31418. }
  31419. }
  31420. // Other refs
  31421. else {
  31422. result.push(`+${ref}:${ref}`);
  31423. }
  31424. return result;
  31425. }
  31426. /**
  31427. * Tests whether the initial fetch created the ref at the expected commit
  31428. */
  31429. async function testRef(git, ref, commit) {
  31430. if (!git) {
  31431. throw new Error('Arg git cannot be empty');
  31432. }
  31433. if (!ref && !commit) {
  31434. throw new Error('Args ref and commit cannot both be empty');
  31435. }
  31436. // No SHA? Nothing to test
  31437. if (!commit) {
  31438. return true;
  31439. }
  31440. // SHA only?
  31441. else if (!ref) {
  31442. return await git.shaExists(commit);
  31443. }
  31444. const upperRef = ref.toUpperCase();
  31445. // refs/heads/
  31446. if (upperRef.startsWith('REFS/HEADS/')) {
  31447. const branch = ref.substring('refs/heads/'.length);
  31448. return ((await git.branchExists(true, `origin/${branch}`)) &&
  31449. commit === (await git.revParse(`refs/remotes/origin/${branch}`)));
  31450. }
  31451. // refs/pull/
  31452. else if (upperRef.startsWith('REFS/PULL/')) {
  31453. // Assume matches because fetched using the commit
  31454. return true;
  31455. }
  31456. // refs/tags/
  31457. else if (upperRef.startsWith('REFS/TAGS/')) {
  31458. const tagName = ref.substring('refs/tags/'.length);
  31459. // Use ^{commit} to dereference annotated tags to their underlying commit
  31460. return ((await git.tagExists(tagName)) &&
  31461. commit === (await git.revParse(`${ref}^{commit}`)));
  31462. }
  31463. // Unexpected
  31464. else {
  31465. core.debug(`Unexpected ref format '${ref}' when testing ref info`);
  31466. return true;
  31467. }
  31468. }
  31469. async function checkCommitInfo(token, commitInfo, repositoryOwner, repositoryName, ref, commit, baseUrl) {
  31470. try {
  31471. // GHES?
  31472. if (isGhes(baseUrl)) {
  31473. return;
  31474. }
  31475. // Auth token?
  31476. if (!token) {
  31477. return;
  31478. }
  31479. // Public PR synchronize, for workflow repo?
  31480. if (fromPayload('repository.private') !== false ||
  31481. github.context.eventName !== 'pull_request' ||
  31482. fromPayload('action') !== 'synchronize' ||
  31483. repositoryOwner !== github.context.repo.owner ||
  31484. repositoryName !== github.context.repo.repo ||
  31485. ref !== github.context.ref ||
  31486. !ref.startsWith('refs/pull/') ||
  31487. commit !== github.context.sha) {
  31488. return;
  31489. }
  31490. // Head SHA
  31491. const expectedHeadSha = fromPayload('after');
  31492. if (!expectedHeadSha) {
  31493. core.debug('Unable to determine head sha');
  31494. return;
  31495. }
  31496. // Base SHA
  31497. const expectedBaseSha = fromPayload('pull_request.base.sha');
  31498. if (!expectedBaseSha) {
  31499. core.debug('Unable to determine base sha');
  31500. return;
  31501. }
  31502. // Expected message?
  31503. const expectedMessage = `Merge ${expectedHeadSha} into ${expectedBaseSha}`;
  31504. if (commitInfo.indexOf(expectedMessage) >= 0) {
  31505. return;
  31506. }
  31507. // Extract details from message
  31508. const match = commitInfo.match(/Merge ([0-9a-f]{40}|[0-9a-f]{64}) into ([0-9a-f]{40}|[0-9a-f]{64})/);
  31509. if (!match) {
  31510. core.debug('Unexpected message format');
  31511. return;
  31512. }
  31513. // Post telemetry
  31514. const actualHeadSha = match[1];
  31515. if (actualHeadSha !== expectedHeadSha) {
  31516. core.debug(`Expected head sha ${expectedHeadSha}; actual head sha ${actualHeadSha}`);
  31517. const octokit = github.getOctokit(token, {
  31518. baseUrl: getServerApiUrl(baseUrl),
  31519. userAgent: `actions-checkout-tracepoint/1.0 (code=STALE_MERGE;owner=${repositoryOwner};repo=${repositoryName};pr=${fromPayload('number')};run_id=${process.env['GITHUB_RUN_ID']};expected_head_sha=${expectedHeadSha};actual_head_sha=${actualHeadSha})`
  31520. });
  31521. await octokit.rest.repos.get({
  31522. owner: repositoryOwner,
  31523. repo: repositoryName
  31524. });
  31525. }
  31526. }
  31527. catch (err) {
  31528. core.debug(`Error when validating commit info: ${err?.stack ?? err}`);
  31529. }
  31530. }
  31531. function fromPayload(path) {
  31532. return ref_helper_select(github.context.payload, path);
  31533. }
  31534. function ref_helper_select(obj, path) {
  31535. if (!obj) {
  31536. return undefined;
  31537. }
  31538. const i = path.indexOf('.');
  31539. if (i < 0) {
  31540. return obj[path];
  31541. }
  31542. const key = path.substr(0, i);
  31543. return ref_helper_select(obj[key], path.substr(i + 1));
  31544. }
  31545. ;// CONCATENATED MODULE: ./src/git-source-provider.ts
  31546. async function getSource(settings) {
  31547. // Repository URL
  31548. core.info(`Syncing repository: ${settings.repositoryOwner}/${settings.repositoryName}`);
  31549. const repositoryUrl = getFetchUrl(settings);
  31550. // Remove conflicting file path
  31551. if (fileExistsSync(settings.repositoryPath)) {
  31552. await io.rmRF(settings.repositoryPath);
  31553. }
  31554. // Create directory
  31555. let isExisting = true;
  31556. if (!directoryExistsSync(settings.repositoryPath)) {
  31557. isExisting = false;
  31558. await io.mkdirP(settings.repositoryPath);
  31559. }
  31560. // Git command manager
  31561. core.startGroup('Getting Git version info');
  31562. const git = await getGitCommandManager(settings);
  31563. core.endGroup();
  31564. let authHelper = null;
  31565. try {
  31566. if (git) {
  31567. authHelper = createAuthHelper(git, settings);
  31568. if (settings.setSafeDirectory) {
  31569. // Setup the repository path as a safe directory, so if we pass this into a container job with a different user it doesn't fail
  31570. // Otherwise all git commands we run in a container fail
  31571. await authHelper.configureTempGlobalConfig();
  31572. core.info(`Adding repository directory to the temporary git global config as a safe directory`);
  31573. await git
  31574. .config('safe.directory', settings.repositoryPath, true, true)
  31575. .catch(error => {
  31576. core.info(`Failed to initialize safe directory with error: ${error}`);
  31577. });
  31578. setSafeDirectory();
  31579. }
  31580. }
  31581. // Prepare existing directory, otherwise recreate
  31582. if (isExisting) {
  31583. await prepareExistingDirectory(git, settings.repositoryPath, repositoryUrl, settings.clean, settings.ref);
  31584. }
  31585. if (!git) {
  31586. // Downloading using REST API
  31587. core.info(`The repository will be downloaded using the GitHub REST API`);
  31588. core.info(`To create a local Git repository instead, add Git ${MinimumGitVersion} or higher to the PATH`);
  31589. if (settings.submodules) {
  31590. throw new Error(`Input 'submodules' not supported when falling back to download using the GitHub REST API. To create a local Git repository instead, add Git ${MinimumGitVersion} or higher to the PATH.`);
  31591. }
  31592. else if (settings.sshKey) {
  31593. throw new Error(`Input 'ssh-key' not supported when falling back to download using the GitHub REST API. To create a local Git repository instead, add Git ${MinimumGitVersion} or higher to the PATH.`);
  31594. }
  31595. await downloadRepository(settings.authToken, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.commit, settings.repositoryPath, settings.githubServerUrl);
  31596. return;
  31597. }
  31598. // Save state for POST action
  31599. setRepositoryPath(settings.repositoryPath);
  31600. // Initialize the repository
  31601. if (!directoryExistsSync(external_path_.join(settings.repositoryPath, '.git'))) {
  31602. core.startGroup('Determining repository object format');
  31603. const objectFormatResult = await tryGetRepositoryObjectFormat(settings.authToken, settings.repositoryOwner, settings.repositoryName, settings.githubServerUrl, settings.commit);
  31604. const objectFormat = objectFormatResult.succeeded
  31605. ? objectFormatResult.format
  31606. : '';
  31607. if (objectFormat === 'sha256') {
  31608. core.info('Detected SHA-256 repository object format');
  31609. }
  31610. core.endGroup();
  31611. core.startGroup('Initializing the repository');
  31612. await git.init(objectFormat);
  31613. await git.remoteAdd('origin', repositoryUrl);
  31614. core.endGroup();
  31615. }
  31616. // Disable automatic garbage collection
  31617. core.startGroup('Disabling automatic garbage collection');
  31618. if (!(await git.tryDisableAutomaticGarbageCollection())) {
  31619. core.warning(`Unable to turn off git automatic garbage collection. The git fetch operation may trigger garbage collection and cause a delay.`);
  31620. }
  31621. core.endGroup();
  31622. // If we didn't initialize it above, do it now
  31623. if (!authHelper) {
  31624. authHelper = createAuthHelper(git, settings);
  31625. }
  31626. // Configure auth
  31627. core.startGroup('Setting up auth');
  31628. await authHelper.configureAuth();
  31629. core.endGroup();
  31630. // Determine the default branch
  31631. if (!settings.ref && !settings.commit) {
  31632. core.startGroup('Determining the default branch');
  31633. if (settings.sshKey) {
  31634. settings.ref = await git.getDefaultBranch(repositoryUrl);
  31635. }
  31636. else {
  31637. settings.ref = await getDefaultBranch(settings.authToken, settings.repositoryOwner, settings.repositoryName, settings.githubServerUrl);
  31638. }
  31639. core.endGroup();
  31640. }
  31641. // LFS install
  31642. if (settings.lfs) {
  31643. await git.lfsInstall();
  31644. }
  31645. // Fetch
  31646. core.startGroup('Fetching the repository');
  31647. const fetchOptions = {};
  31648. if (settings.filter) {
  31649. fetchOptions.filter = settings.filter;
  31650. }
  31651. else if (settings.sparseCheckout) {
  31652. fetchOptions.filter = 'blob:none';
  31653. }
  31654. if (settings.fetchDepth <= 0) {
  31655. // Fetch all branches and tags
  31656. let refSpec = getRefSpecForAllHistory(settings.ref, settings.commit);
  31657. await git.fetch(refSpec, fetchOptions);
  31658. // When all history is fetched, the ref we're interested in may have moved to a different
  31659. // commit (push or force push). If so, fetch again with a targeted refspec.
  31660. if (!(await testRef(git, settings.ref, settings.commit))) {
  31661. refSpec = getRefSpec(settings.ref, settings.commit);
  31662. await git.fetch(refSpec, fetchOptions);
  31663. // Verify the ref now matches. For branches, the targeted fetch above brings
  31664. // in the specific commit. For tags (fetched by ref), this will fail if
  31665. // the tag was moved after the workflow was triggered.
  31666. if (!(await testRef(git, settings.ref, settings.commit))) {
  31667. throw new Error(`The ref '${settings.ref}' does not point to the expected commit '${settings.commit}'. ` +
  31668. `The ref may have been updated after the workflow was triggered.`);
  31669. }
  31670. }
  31671. }
  31672. else {
  31673. fetchOptions.fetchDepth = settings.fetchDepth;
  31674. const refSpec = getRefSpec(settings.ref, settings.commit, settings.fetchTags);
  31675. await git.fetch(refSpec, fetchOptions);
  31676. // For tags, verify the ref still points to the expected commit.
  31677. // Tags are fetched by ref (not commit), so if a tag was moved after the
  31678. // workflow was triggered, we would silently check out the wrong commit.
  31679. if (!(await testRef(git, settings.ref, settings.commit))) {
  31680. throw new Error(`The ref '${settings.ref}' does not point to the expected commit '${settings.commit}'. ` +
  31681. `The ref may have been updated after the workflow was triggered.`);
  31682. }
  31683. }
  31684. core.endGroup();
  31685. // Checkout info
  31686. core.startGroup('Determining the checkout info');
  31687. const checkoutInfo = await getCheckoutInfo(git, settings.ref, settings.commit);
  31688. core.endGroup();
  31689. // LFS fetch
  31690. // Explicit lfs-fetch to avoid slow checkout (fetches one lfs object at a time).
  31691. // Explicit lfs fetch will fetch lfs objects in parallel.
  31692. // For sparse checkouts, let `checkout` fetch the needed objects lazily.
  31693. if (settings.lfs && !settings.sparseCheckout) {
  31694. core.startGroup('Fetching LFS objects');
  31695. await git.lfsFetch(checkoutInfo.startPoint || checkoutInfo.ref);
  31696. core.endGroup();
  31697. }
  31698. // Sparse checkout
  31699. if (!settings.sparseCheckout) {
  31700. let gitVersion = await git.version();
  31701. // no need to disable sparse-checkout if the installed git runtime doesn't even support it.
  31702. if (gitVersion.checkMinimum(MinimumGitSparseCheckoutVersion)) {
  31703. await git.disableSparseCheckout();
  31704. }
  31705. }
  31706. else {
  31707. core.startGroup('Setting up sparse checkout');
  31708. if (settings.sparseCheckoutConeMode) {
  31709. await git.sparseCheckout(settings.sparseCheckout);
  31710. }
  31711. else {
  31712. await git.sparseCheckoutNonConeMode(settings.sparseCheckout);
  31713. }
  31714. core.endGroup();
  31715. }
  31716. // Checkout
  31717. core.startGroup('Checking out the ref');
  31718. await git.checkout(checkoutInfo.ref, checkoutInfo.startPoint);
  31719. core.endGroup();
  31720. // Submodules
  31721. if (settings.submodules) {
  31722. // Temporarily override global config
  31723. core.startGroup('Setting up auth for fetching submodules');
  31724. await authHelper.configureGlobalAuth();
  31725. core.endGroup();
  31726. // Checkout submodules
  31727. core.startGroup('Fetching submodules');
  31728. await git.submoduleSync(settings.nestedSubmodules);
  31729. await git.submoduleUpdate(settings.fetchDepth, settings.nestedSubmodules);
  31730. await git.submoduleForeach('git config --local gc.auto 0', settings.nestedSubmodules);
  31731. core.endGroup();
  31732. // Persist credentials
  31733. if (settings.persistCredentials) {
  31734. core.startGroup('Persisting credentials for submodules');
  31735. await authHelper.configureSubmoduleAuth();
  31736. core.endGroup();
  31737. }
  31738. }
  31739. // Get commit information
  31740. const commitInfo = await git.log1();
  31741. // Log commit sha
  31742. const commitSHA = await git.log1('--format=%H');
  31743. core.setOutput('commit', commitSHA.trim());
  31744. // Check for incorrect pull request merge commit
  31745. await checkCommitInfo(settings.authToken, commitInfo, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.commit, settings.githubServerUrl);
  31746. }
  31747. finally {
  31748. // Remove auth
  31749. if (authHelper) {
  31750. if (!settings.persistCredentials) {
  31751. core.startGroup('Removing auth');
  31752. await authHelper.removeAuth();
  31753. core.endGroup();
  31754. }
  31755. authHelper.removeGlobalConfig();
  31756. }
  31757. }
  31758. }
  31759. async function cleanup(repositoryPath) {
  31760. // Repo exists?
  31761. if (!repositoryPath ||
  31762. !fileExistsSync(external_path_.join(repositoryPath, '.git', 'config'))) {
  31763. return;
  31764. }
  31765. let git;
  31766. try {
  31767. git = await createCommandManager(repositoryPath, false, false);
  31768. }
  31769. catch {
  31770. return;
  31771. }
  31772. // Remove auth
  31773. const authHelper = createAuthHelper(git);
  31774. try {
  31775. if (PostSetSafeDirectory) {
  31776. // Setup the repository path as a safe directory, so if we pass this into a container job with a different user it doesn't fail
  31777. // Otherwise all git commands we run in a container fail
  31778. await authHelper.configureTempGlobalConfig();
  31779. core.info(`Adding repository directory to the temporary git global config as a safe directory`);
  31780. await git
  31781. .config('safe.directory', repositoryPath, true, true)
  31782. .catch(error => {
  31783. core.info(`Failed to initialize safe directory with error: ${error}`);
  31784. });
  31785. }
  31786. await authHelper.removeAuth();
  31787. }
  31788. finally {
  31789. await authHelper.removeGlobalConfig();
  31790. }
  31791. }
  31792. async function getGitCommandManager(settings) {
  31793. core.info(`Working directory is '${settings.repositoryPath}'`);
  31794. try {
  31795. return await createCommandManager(settings.repositoryPath, settings.lfs, settings.sparseCheckout != null);
  31796. }
  31797. catch (err) {
  31798. // Git is required for LFS
  31799. if (settings.lfs) {
  31800. throw err;
  31801. }
  31802. // Otherwise fallback to REST API
  31803. return undefined;
  31804. }
  31805. }
  31806. ;// CONCATENATED MODULE: ./src/unsafe-pr-checkout-helper.ts
  31807. const PR_REF_PATTERN = /^refs\/pull\/[0-9]+\/(?:head|merge)$/;
  31808. function assertSafePrCheckout(input) {
  31809. if (input.allowUnsafePrCheckout) {
  31810. return;
  31811. }
  31812. const eventName = github.context.eventName;
  31813. if (eventName !== 'pull_request_target' && eventName !== 'workflow_run') {
  31814. return;
  31815. }
  31816. const baseRepoId = fromPayload('repository.id');
  31817. if (typeof baseRepoId !== 'number') {
  31818. return;
  31819. }
  31820. let prHeadRepoId;
  31821. let prHeadRepoFullName;
  31822. const prShas = [];
  31823. if (eventName === 'pull_request_target') {
  31824. prHeadRepoId = fromPayload('pull_request.head.repo.id');
  31825. prHeadRepoFullName = fromPayload('pull_request.head.repo.full_name');
  31826. pushIfSha(prShas, fromPayload('pull_request.head.sha'));
  31827. pushIfSha(prShas, fromPayload('pull_request.merge_commit_sha'));
  31828. }
  31829. else {
  31830. const wrEvent = fromPayload('workflow_run.event');
  31831. if (typeof wrEvent !== 'string' || !wrEvent.startsWith('pull_request')) {
  31832. return;
  31833. }
  31834. prHeadRepoId = fromPayload('workflow_run.head_repository.id');
  31835. prHeadRepoFullName = fromPayload('workflow_run.head_repository.full_name');
  31836. pushIfSha(prShas, fromPayload('workflow_run.head_commit.id'));
  31837. // For `pull_request_target`-triggered workflow_run, `head_sha` is the base
  31838. // default branch SHA (not the PR head)
  31839. if (wrEvent !== 'pull_request_target') {
  31840. pushIfSha(prShas, fromPayload('workflow_run.head_sha'));
  31841. }
  31842. }
  31843. // (A) Fork PR?
  31844. if (typeof prHeadRepoId !== 'number' || prHeadRepoId === baseRepoId) {
  31845. return;
  31846. }
  31847. // (B) We cannot check for all fork PR refs so check to see
  31848. // if the resolved input points to the fork PR sha we have in the payload
  31849. const repositoryMatchesPrHead = typeof prHeadRepoFullName === 'string' &&
  31850. input.qualifiedRepository.toLowerCase() === prHeadRepoFullName.toLowerCase();
  31851. const refMatchesPullPattern = PR_REF_PATTERN.test(input.ref);
  31852. const commitMatchesPrHeadSha = !!input.commit && prShas.includes(input.commit.toLowerCase());
  31853. if (!repositoryMatchesPrHead &&
  31854. !refMatchesPullPattern &&
  31855. !commitMatchesPrHeadSha) {
  31856. return;
  31857. }
  31858. throw new Error(`Refusing to check out fork pull request code from a '${eventName}' workflow. ` +
  31859. `This workflow runs with the base repository's GITHUB_TOKEN, secrets, default-branch ` +
  31860. `cache scope, and runner access. Fetching and executing a fork's code in that trusted ` +
  31861. `context commonly leads to "pwn request" vulnerabilities. To opt in, review the risks ` +
  31862. `at https://gh.io/securely-using-pull_request_target and set 'allow-unsafe-pr-checkout: true' ` +
  31863. `on the actions/checkout step.`);
  31864. }
  31865. function pushIfSha(target, value) {
  31866. if (typeof value === 'string' && value.length > 0) {
  31867. target.push(value.toLowerCase());
  31868. }
  31869. }
  31870. ;// CONCATENATED MODULE: ./src/workflow-context-helper.ts
  31871. /**
  31872. * Gets the organization ID of the running workflow or undefined if the value cannot be loaded from the GITHUB_EVENT_PATH
  31873. */
  31874. async function getOrganizationId() {
  31875. try {
  31876. const eventPath = process.env.GITHUB_EVENT_PATH;
  31877. if (!eventPath) {
  31878. core.debug(`GITHUB_EVENT_PATH is not defined`);
  31879. return;
  31880. }
  31881. const content = await external_fs_.promises.readFile(eventPath, { encoding: 'utf8' });
  31882. const event = JSON.parse(content);
  31883. const id = event?.repository?.owner?.id;
  31884. if (typeof id !== 'number') {
  31885. core.debug('Repository owner ID not found within GITHUB event info');
  31886. return;
  31887. }
  31888. return id;
  31889. }
  31890. catch (err) {
  31891. core.debug(`Unable to load organization ID from GITHUB_EVENT_PATH: ${err.message || err}`);
  31892. }
  31893. }
  31894. ;// CONCATENATED MODULE: ./src/input-helper.ts
  31895. async function getInputs() {
  31896. const result = {};
  31897. // GitHub workspace
  31898. let githubWorkspacePath = process.env['GITHUB_WORKSPACE'];
  31899. if (!githubWorkspacePath) {
  31900. throw new Error('GITHUB_WORKSPACE not defined');
  31901. }
  31902. githubWorkspacePath = external_path_.resolve(githubWorkspacePath);
  31903. core.debug(`GITHUB_WORKSPACE = '${githubWorkspacePath}'`);
  31904. directoryExistsSync(githubWorkspacePath, true);
  31905. // Qualified repository
  31906. const qualifiedRepository = core.getInput('repository') ||
  31907. `${github.context.repo.owner}/${github.context.repo.repo}`;
  31908. core.debug(`qualified repository = '${qualifiedRepository}'`);
  31909. const splitRepository = qualifiedRepository.split('/');
  31910. if (splitRepository.length !== 2 ||
  31911. !splitRepository[0] ||
  31912. !splitRepository[1]) {
  31913. throw new Error(`Invalid repository '${qualifiedRepository}'. Expected format {owner}/{repo}.`);
  31914. }
  31915. result.repositoryOwner = splitRepository[0];
  31916. result.repositoryName = splitRepository[1];
  31917. // Repository path
  31918. result.repositoryPath = core.getInput('path') || '.';
  31919. result.repositoryPath = external_path_.resolve(githubWorkspacePath, result.repositoryPath);
  31920. if (!(result.repositoryPath + external_path_.sep).startsWith(githubWorkspacePath + external_path_.sep)) {
  31921. throw new Error(`Repository path '${result.repositoryPath}' is not under '${githubWorkspacePath}'`);
  31922. }
  31923. // Workflow repository?
  31924. const isWorkflowRepository = qualifiedRepository.toUpperCase() ===
  31925. `${github.context.repo.owner}/${github.context.repo.repo}`.toUpperCase();
  31926. // Source branch, source version
  31927. result.ref = core.getInput('ref');
  31928. if (!result.ref) {
  31929. if (isWorkflowRepository) {
  31930. result.ref = github.context.ref;
  31931. result.commit = github.context.sha;
  31932. // Some events have an unqualifed ref. For example when a PR is merged (pull_request closed event),
  31933. // the ref is unqualifed like "main" instead of "refs/heads/main".
  31934. if (result.commit && result.ref && !result.ref.startsWith('refs/')) {
  31935. result.ref = `refs/heads/${result.ref}`;
  31936. }
  31937. }
  31938. }
  31939. // SHA?
  31940. else if (result.ref.match(/^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})$/)) {
  31941. result.commit = result.ref;
  31942. result.ref = '';
  31943. }
  31944. core.debug(`ref = '${result.ref}'`);
  31945. core.debug(`commit = '${result.commit}'`);
  31946. // Clean
  31947. result.clean = (core.getInput('clean') || 'true').toUpperCase() === 'TRUE';
  31948. core.debug(`clean = ${result.clean}`);
  31949. // Filter
  31950. const filter = core.getInput('filter');
  31951. if (filter) {
  31952. result.filter = filter;
  31953. }
  31954. core.debug(`filter = ${result.filter}`);
  31955. // Sparse checkout
  31956. const sparseCheckout = core.getMultilineInput('sparse-checkout');
  31957. if (sparseCheckout.length) {
  31958. result.sparseCheckout = sparseCheckout;
  31959. core.debug(`sparse checkout = ${result.sparseCheckout}`);
  31960. }
  31961. result.sparseCheckoutConeMode =
  31962. (core.getInput('sparse-checkout-cone-mode') || 'true').toUpperCase() ===
  31963. 'TRUE';
  31964. // Fetch depth
  31965. result.fetchDepth = Math.floor(Number(core.getInput('fetch-depth') || '1'));
  31966. if (isNaN(result.fetchDepth) || result.fetchDepth < 0) {
  31967. result.fetchDepth = 0;
  31968. }
  31969. core.debug(`fetch depth = ${result.fetchDepth}`);
  31970. // Fetch tags
  31971. result.fetchTags =
  31972. (core.getInput('fetch-tags') || 'false').toUpperCase() === 'TRUE';
  31973. core.debug(`fetch tags = ${result.fetchTags}`);
  31974. // Show fetch progress
  31975. result.showProgress =
  31976. (core.getInput('show-progress') || 'true').toUpperCase() === 'TRUE';
  31977. core.debug(`show progress = ${result.showProgress}`);
  31978. // LFS
  31979. result.lfs = (core.getInput('lfs') || 'false').toUpperCase() === 'TRUE';
  31980. core.debug(`lfs = ${result.lfs}`);
  31981. // Submodules
  31982. result.submodules = false;
  31983. result.nestedSubmodules = false;
  31984. const submodulesString = (core.getInput('submodules') || '').toUpperCase();
  31985. if (submodulesString == 'RECURSIVE') {
  31986. result.submodules = true;
  31987. result.nestedSubmodules = true;
  31988. }
  31989. else if (submodulesString == 'TRUE') {
  31990. result.submodules = true;
  31991. }
  31992. core.debug(`submodules = ${result.submodules}`);
  31993. core.debug(`recursive submodules = ${result.nestedSubmodules}`);
  31994. // Auth token
  31995. result.authToken = core.getInput('token', { required: true });
  31996. // SSH
  31997. result.sshKey = core.getInput('ssh-key');
  31998. result.sshKnownHosts = core.getInput('ssh-known-hosts');
  31999. result.sshStrict =
  32000. (core.getInput('ssh-strict') || 'true').toUpperCase() === 'TRUE';
  32001. result.sshUser = core.getInput('ssh-user');
  32002. // Persist credentials
  32003. result.persistCredentials =
  32004. (core.getInput('persist-credentials') || 'false').toUpperCase() === 'TRUE';
  32005. // Workflow organization ID
  32006. result.workflowOrganizationId =
  32007. await getOrganizationId();
  32008. // Set safe.directory in git global config.
  32009. result.setSafeDirectory =
  32010. (core.getInput('set-safe-directory') || 'true').toUpperCase() === 'TRUE';
  32011. // Determine the GitHub URL that the repository is being hosted from
  32012. result.githubServerUrl = core.getInput('github-server-url');
  32013. core.debug(`GitHub Host URL = ${result.githubServerUrl}`);
  32014. // Allow unsafe PR checkout (opt-in for pull_request_target / workflow_run fork PRs)
  32015. result.allowUnsafePrCheckout =
  32016. (core.getInput('allow-unsafe-pr-checkout') || 'false').toUpperCase() ===
  32017. 'TRUE';
  32018. core.debug(`allow unsafe PR checkout = ${result.allowUnsafePrCheckout}`);
  32019. assertSafePrCheckout({
  32020. qualifiedRepository,
  32021. ref: result.ref,
  32022. commit: result.commit,
  32023. allowUnsafePrCheckout: result.allowUnsafePrCheckout
  32024. });
  32025. return result;
  32026. }
  32027. ;// CONCATENATED MODULE: ./src/main.ts
  32028. const main_dirname = external_path_.dirname((0,external_url_.fileURLToPath)(import.meta.url));
  32029. async function run() {
  32030. try {
  32031. const sourceSettings = await getInputs();
  32032. try {
  32033. // Register problem matcher
  32034. core.info(`::add-matcher::${external_path_.join(main_dirname, 'problem-matcher.json')}`);
  32035. // Get sources
  32036. await getSource(sourceSettings);
  32037. core.setOutput('ref', sourceSettings.ref);
  32038. }
  32039. finally {
  32040. // Unregister problem matcher
  32041. core.info('::remove-matcher owner=checkout-git::');
  32042. }
  32043. }
  32044. catch (error) {
  32045. core.setFailed(`${error?.message ?? error}`);
  32046. }
  32047. }
  32048. async function main_cleanup() {
  32049. try {
  32050. await cleanup(RepositoryPath);
  32051. }
  32052. catch (error) {
  32053. core.warning(`${error?.message ?? error}`);
  32054. }
  32055. }
  32056. // Main
  32057. if (!IsPost) {
  32058. run();
  32059. }
  32060. // Post
  32061. else {
  32062. main_cleanup();
  32063. }
  32064. })();