vite.js 220 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806
  1. import { createRequire } from "node:module";
  2. import fs from "node:fs";
  3. import path, { dirname, resolve } from "node:path";
  4. import { fileURLToPath } from "node:url";
  5. import { createViteServerRpc } from "@vue/devtools-core";
  6. import { getViteRpcServer, setViteServerContext } from "@vue/devtools-kit";
  7. import sirv from "sirv";
  8. import { normalizePath } from "vite";
  9. import Inspect from "vite-plugin-inspect";
  10. import VueInspector from "vite-plugin-vue-inspector";
  11. import fsp from "node:fs/promises";
  12. //#region \0rolldown/runtime.js
  13. var __create = Object.create;
  14. var __defProp = Object.defineProperty;
  15. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  16. var __getOwnPropNames = Object.getOwnPropertyNames;
  17. var __getProtoOf = Object.getPrototypeOf;
  18. var __hasOwnProp = Object.prototype.hasOwnProperty;
  19. var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
  20. var __copyProps = (to, from, except, desc) => {
  21. if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
  22. key = keys[i];
  23. if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
  24. get: ((k) => from[k]).bind(null, key),
  25. enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
  26. });
  27. }
  28. return to;
  29. };
  30. var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
  31. value: mod,
  32. enumerable: true
  33. }) : target, mod));
  34. var __require = /* @__PURE__ */ createRequire(import.meta.url);
  35. //#endregion
  36. //#region ../../node_modules/.pnpm/kolorist@1.8.0/node_modules/kolorist/dist/esm/index.mjs
  37. let enabled = true;
  38. const globalVar = typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
  39. /**
  40. * Detect how much colors the current terminal supports
  41. */
  42. let supportLevel = 0;
  43. if (globalVar.process && globalVar.process.env && globalVar.process.stdout) {
  44. const { FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, COLORTERM } = globalVar.process.env;
  45. if (NODE_DISABLE_COLORS || NO_COLOR || FORCE_COLOR === "0") enabled = false;
  46. else if (FORCE_COLOR === "1" || FORCE_COLOR === "2" || FORCE_COLOR === "3") enabled = true;
  47. else if (TERM === "dumb") enabled = false;
  48. else if ("CI" in globalVar.process.env && [
  49. "TRAVIS",
  50. "CIRCLECI",
  51. "APPVEYOR",
  52. "GITLAB_CI",
  53. "GITHUB_ACTIONS",
  54. "BUILDKITE",
  55. "DRONE"
  56. ].some((vendor) => vendor in globalVar.process.env)) enabled = true;
  57. else enabled = process.stdout.isTTY;
  58. if (enabled) if (process.platform === "win32") supportLevel = 3;
  59. else if (COLORTERM && (COLORTERM === "truecolor" || COLORTERM === "24bit")) supportLevel = 3;
  60. else if (TERM && (TERM.endsWith("-256color") || TERM.endsWith("256"))) supportLevel = 2;
  61. else supportLevel = 1;
  62. }
  63. let options = {
  64. enabled,
  65. supportLevel
  66. };
  67. function kolorist(start, end, level = 1) {
  68. const open = `\x1b[${start}m`;
  69. const close = `\x1b[${end}m`;
  70. const regex = new RegExp(`\\x1b\\[${end}m`, "g");
  71. return (str) => {
  72. return options.enabled && options.supportLevel >= level ? open + ("" + str).replace(regex, open) + close : "" + str;
  73. };
  74. }
  75. kolorist(0, 0);
  76. const bold = kolorist(1, 22);
  77. const dim = kolorist(2, 22);
  78. kolorist(3, 23);
  79. kolorist(4, 24);
  80. kolorist(7, 27);
  81. kolorist(8, 28);
  82. kolorist(9, 29);
  83. kolorist(30, 39);
  84. kolorist(31, 39);
  85. const green = kolorist(32, 39);
  86. const yellow = kolorist(33, 39);
  87. kolorist(34, 39);
  88. kolorist(35, 39);
  89. const cyan = kolorist(36, 39);
  90. kolorist(97, 39);
  91. kolorist(90, 39);
  92. kolorist(37, 39);
  93. kolorist(91, 39);
  94. kolorist(92, 39);
  95. kolorist(93, 39);
  96. kolorist(94, 39);
  97. kolorist(95, 39);
  98. kolorist(96, 39);
  99. kolorist(40, 49);
  100. kolorist(41, 49);
  101. kolorist(42, 49);
  102. kolorist(43, 49);
  103. kolorist(44, 49);
  104. kolorist(45, 49);
  105. kolorist(46, 49);
  106. kolorist(107, 49);
  107. kolorist(100, 49);
  108. kolorist(101, 49);
  109. kolorist(102, 49);
  110. kolorist(103, 49);
  111. kolorist(104, 49);
  112. kolorist(105, 49);
  113. kolorist(106, 49);
  114. kolorist(47, 49);
  115. const DIR_CLIENT = resolve(typeof __dirname !== "undefined" ? __dirname : dirname(fileURLToPath(import.meta.url)), "../client");
  116. //#endregion
  117. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js
  118. var require_array = /* @__PURE__ */ __commonJSMin(((exports) => {
  119. Object.defineProperty(exports, "__esModule", { value: true });
  120. exports.splitWhen = exports.flatten = void 0;
  121. function flatten(items) {
  122. return items.reduce((collection, item) => [].concat(collection, item), []);
  123. }
  124. exports.flatten = flatten;
  125. function splitWhen(items, predicate) {
  126. const result = [[]];
  127. let groupIndex = 0;
  128. for (const item of items) if (predicate(item)) {
  129. groupIndex++;
  130. result[groupIndex] = [];
  131. } else result[groupIndex].push(item);
  132. return result;
  133. }
  134. exports.splitWhen = splitWhen;
  135. }));
  136. //#endregion
  137. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/errno.js
  138. var require_errno = /* @__PURE__ */ __commonJSMin(((exports) => {
  139. Object.defineProperty(exports, "__esModule", { value: true });
  140. exports.isEnoentCodeError = void 0;
  141. function isEnoentCodeError(error) {
  142. return error.code === "ENOENT";
  143. }
  144. exports.isEnoentCodeError = isEnoentCodeError;
  145. }));
  146. //#endregion
  147. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/fs.js
  148. var require_fs$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
  149. Object.defineProperty(exports, "__esModule", { value: true });
  150. exports.createDirentFromStats = void 0;
  151. var DirentFromStats = class {
  152. constructor(name, stats) {
  153. this.name = name;
  154. this.isBlockDevice = stats.isBlockDevice.bind(stats);
  155. this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
  156. this.isDirectory = stats.isDirectory.bind(stats);
  157. this.isFIFO = stats.isFIFO.bind(stats);
  158. this.isFile = stats.isFile.bind(stats);
  159. this.isSocket = stats.isSocket.bind(stats);
  160. this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
  161. }
  162. };
  163. function createDirentFromStats(name, stats) {
  164. return new DirentFromStats(name, stats);
  165. }
  166. exports.createDirentFromStats = createDirentFromStats;
  167. }));
  168. //#endregion
  169. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/path.js
  170. var require_path = /* @__PURE__ */ __commonJSMin(((exports) => {
  171. Object.defineProperty(exports, "__esModule", { value: true });
  172. exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
  173. const os$1 = __require("os");
  174. const path$9 = __require("path");
  175. const IS_WINDOWS_PLATFORM = os$1.platform() === "win32";
  176. const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
  177. /**
  178. * All non-escaped special characters.
  179. * Posix: ()*?[]{|}, !+@ before (, ! at the beginning, \\ before non-special characters.
  180. * Windows: (){}[], !+@ before (, ! at the beginning.
  181. */
  182. const POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
  183. const WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g;
  184. /**
  185. * The device path (\\.\ or \\?\).
  186. * https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats#dos-device-paths
  187. */
  188. const DOS_DEVICE_PATH_RE = /^\\\\([.?])/;
  189. /**
  190. * All backslashes except those escaping special characters.
  191. * Windows: !()+@{}
  192. * https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
  193. */
  194. const WINDOWS_BACKSLASHES_RE = /\\(?![!()+@[\]{}])/g;
  195. /**
  196. * Designed to work only with simple paths: `dir\\file`.
  197. */
  198. function unixify(filepath) {
  199. return filepath.replace(/\\/g, "/");
  200. }
  201. exports.unixify = unixify;
  202. function makeAbsolute(cwd, filepath) {
  203. return path$9.resolve(cwd, filepath);
  204. }
  205. exports.makeAbsolute = makeAbsolute;
  206. function removeLeadingDotSegment(entry) {
  207. if (entry.charAt(0) === ".") {
  208. const secondCharactery = entry.charAt(1);
  209. if (secondCharactery === "/" || secondCharactery === "\\") return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
  210. }
  211. return entry;
  212. }
  213. exports.removeLeadingDotSegment = removeLeadingDotSegment;
  214. exports.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath;
  215. function escapeWindowsPath(pattern) {
  216. return pattern.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, "\\$2");
  217. }
  218. exports.escapeWindowsPath = escapeWindowsPath;
  219. function escapePosixPath(pattern) {
  220. return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, "\\$2");
  221. }
  222. exports.escapePosixPath = escapePosixPath;
  223. exports.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern;
  224. function convertWindowsPathToPattern(filepath) {
  225. return escapeWindowsPath(filepath).replace(DOS_DEVICE_PATH_RE, "//$1").replace(WINDOWS_BACKSLASHES_RE, "/");
  226. }
  227. exports.convertWindowsPathToPattern = convertWindowsPathToPattern;
  228. function convertPosixPathToPattern(filepath) {
  229. return escapePosixPath(filepath);
  230. }
  231. exports.convertPosixPathToPattern = convertPosixPathToPattern;
  232. }));
  233. //#endregion
  234. //#region ../../node_modules/.pnpm/is-extglob@2.1.1/node_modules/is-extglob/index.js
  235. var require_is_extglob = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  236. /*!
  237. * is-extglob <https://github.com/jonschlinkert/is-extglob>
  238. *
  239. * Copyright (c) 2014-2016, Jon Schlinkert.
  240. * Licensed under the MIT License.
  241. */
  242. module.exports = function isExtglob(str) {
  243. if (typeof str !== "string" || str === "") return false;
  244. var match;
  245. while (match = /(\\).|([@?!+*]\(.*\))/g.exec(str)) {
  246. if (match[2]) return true;
  247. str = str.slice(match.index + match[0].length);
  248. }
  249. return false;
  250. };
  251. }));
  252. //#endregion
  253. //#region ../../node_modules/.pnpm/is-glob@4.0.3/node_modules/is-glob/index.js
  254. var require_is_glob = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  255. /*!
  256. * is-glob <https://github.com/jonschlinkert/is-glob>
  257. *
  258. * Copyright (c) 2014-2017, Jon Schlinkert.
  259. * Released under the MIT License.
  260. */
  261. var isExtglob = require_is_extglob();
  262. var chars = {
  263. "{": "}",
  264. "(": ")",
  265. "[": "]"
  266. };
  267. var strictCheck = function(str) {
  268. if (str[0] === "!") return true;
  269. var index = 0;
  270. var pipeIndex = -2;
  271. var closeSquareIndex = -2;
  272. var closeCurlyIndex = -2;
  273. var closeParenIndex = -2;
  274. var backSlashIndex = -2;
  275. while (index < str.length) {
  276. if (str[index] === "*") return true;
  277. if (str[index + 1] === "?" && /[\].+)]/.test(str[index])) return true;
  278. if (closeSquareIndex !== -1 && str[index] === "[" && str[index + 1] !== "]") {
  279. if (closeSquareIndex < index) closeSquareIndex = str.indexOf("]", index);
  280. if (closeSquareIndex > index) {
  281. if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) return true;
  282. backSlashIndex = str.indexOf("\\", index);
  283. if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) return true;
  284. }
  285. }
  286. if (closeCurlyIndex !== -1 && str[index] === "{" && str[index + 1] !== "}") {
  287. closeCurlyIndex = str.indexOf("}", index);
  288. if (closeCurlyIndex > index) {
  289. backSlashIndex = str.indexOf("\\", index);
  290. if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) return true;
  291. }
  292. }
  293. if (closeParenIndex !== -1 && str[index] === "(" && str[index + 1] === "?" && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ")") {
  294. closeParenIndex = str.indexOf(")", index);
  295. if (closeParenIndex > index) {
  296. backSlashIndex = str.indexOf("\\", index);
  297. if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) return true;
  298. }
  299. }
  300. if (pipeIndex !== -1 && str[index] === "(" && str[index + 1] !== "|") {
  301. if (pipeIndex < index) pipeIndex = str.indexOf("|", index);
  302. if (pipeIndex !== -1 && str[pipeIndex + 1] !== ")") {
  303. closeParenIndex = str.indexOf(")", pipeIndex);
  304. if (closeParenIndex > pipeIndex) {
  305. backSlashIndex = str.indexOf("\\", pipeIndex);
  306. if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) return true;
  307. }
  308. }
  309. }
  310. if (str[index] === "\\") {
  311. var open = str[index + 1];
  312. index += 2;
  313. var close = chars[open];
  314. if (close) {
  315. var n = str.indexOf(close, index);
  316. if (n !== -1) index = n + 1;
  317. }
  318. if (str[index] === "!") return true;
  319. } else index++;
  320. }
  321. return false;
  322. };
  323. var relaxedCheck = function(str) {
  324. if (str[0] === "!") return true;
  325. var index = 0;
  326. while (index < str.length) {
  327. if (/[*?{}()[\]]/.test(str[index])) return true;
  328. if (str[index] === "\\") {
  329. var open = str[index + 1];
  330. index += 2;
  331. var close = chars[open];
  332. if (close) {
  333. var n = str.indexOf(close, index);
  334. if (n !== -1) index = n + 1;
  335. }
  336. if (str[index] === "!") return true;
  337. } else index++;
  338. }
  339. return false;
  340. };
  341. module.exports = function isGlob(str, options) {
  342. if (typeof str !== "string" || str === "") return false;
  343. if (isExtglob(str)) return true;
  344. var check = strictCheck;
  345. if (options && options.strict === false) check = relaxedCheck;
  346. return check(str);
  347. };
  348. }));
  349. //#endregion
  350. //#region ../../node_modules/.pnpm/glob-parent@5.1.2/node_modules/glob-parent/index.js
  351. var require_glob_parent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  352. var isGlob = require_is_glob();
  353. var pathPosixDirname = __require("path").posix.dirname;
  354. var isWin32 = __require("os").platform() === "win32";
  355. var slash = "/";
  356. var backslash = /\\/g;
  357. var enclosure = /[\{\[].*[\}\]]$/;
  358. var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
  359. var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
  360. /**
  361. * @param {string} str
  362. * @param {Object} opts
  363. * @param {boolean} [opts.flipBackslashes=true]
  364. * @returns {string}
  365. */
  366. module.exports = function globParent(str, opts) {
  367. if (Object.assign({ flipBackslashes: true }, opts).flipBackslashes && isWin32 && str.indexOf(slash) < 0) str = str.replace(backslash, slash);
  368. if (enclosure.test(str)) str += slash;
  369. str += "a";
  370. do
  371. str = pathPosixDirname(str);
  372. while (isGlob(str) || globby.test(str));
  373. return str.replace(escaped, "$1");
  374. };
  375. }));
  376. //#endregion
  377. //#region ../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js
  378. var require_utils$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
  379. exports.isInteger = (num) => {
  380. if (typeof num === "number") return Number.isInteger(num);
  381. if (typeof num === "string" && num.trim() !== "") return Number.isInteger(Number(num));
  382. return false;
  383. };
  384. /**
  385. * Find a node of the given type
  386. */
  387. exports.find = (node, type) => node.nodes.find((node) => node.type === type);
  388. /**
  389. * Find a node of the given type
  390. */
  391. exports.exceedsLimit = (min, max, step = 1, limit) => {
  392. if (limit === false) return false;
  393. if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
  394. return (Number(max) - Number(min)) / Number(step) >= limit;
  395. };
  396. /**
  397. * Escape the given node with '\\' before node.value
  398. */
  399. exports.escapeNode = (block, n = 0, type) => {
  400. const node = block.nodes[n];
  401. if (!node) return;
  402. if (type && node.type === type || node.type === "open" || node.type === "close") {
  403. if (node.escaped !== true) {
  404. node.value = "\\" + node.value;
  405. node.escaped = true;
  406. }
  407. }
  408. };
  409. /**
  410. * Returns true if the given brace node should be enclosed in literal braces
  411. */
  412. exports.encloseBrace = (node) => {
  413. if (node.type !== "brace") return false;
  414. if (node.commas >> 0 + node.ranges >> 0 === 0) {
  415. node.invalid = true;
  416. return true;
  417. }
  418. return false;
  419. };
  420. /**
  421. * Returns true if a brace node is invalid.
  422. */
  423. exports.isInvalidBrace = (block) => {
  424. if (block.type !== "brace") return false;
  425. if (block.invalid === true || block.dollar) return true;
  426. if (block.commas >> 0 + block.ranges >> 0 === 0) {
  427. block.invalid = true;
  428. return true;
  429. }
  430. if (block.open !== true || block.close !== true) {
  431. block.invalid = true;
  432. return true;
  433. }
  434. return false;
  435. };
  436. /**
  437. * Returns true if a node is an open or close node
  438. */
  439. exports.isOpenOrClose = (node) => {
  440. if (node.type === "open" || node.type === "close") return true;
  441. return node.open === true || node.close === true;
  442. };
  443. /**
  444. * Reduce an array of text nodes.
  445. */
  446. exports.reduce = (nodes) => nodes.reduce((acc, node) => {
  447. if (node.type === "text") acc.push(node.value);
  448. if (node.type === "range") node.type = "text";
  449. return acc;
  450. }, []);
  451. /**
  452. * Flatten an array
  453. */
  454. exports.flatten = (...args) => {
  455. const result = [];
  456. const flat = (arr) => {
  457. for (let i = 0; i < arr.length; i++) {
  458. const ele = arr[i];
  459. if (Array.isArray(ele)) {
  460. flat(ele);
  461. continue;
  462. }
  463. if (ele !== void 0) result.push(ele);
  464. }
  465. return result;
  466. };
  467. flat(args);
  468. return result;
  469. };
  470. }));
  471. //#endregion
  472. //#region ../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js
  473. var require_stringify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  474. const utils = require_utils$3();
  475. module.exports = (ast, options = {}) => {
  476. const stringify = (node, parent = {}) => {
  477. const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
  478. const invalidNode = node.invalid === true && options.escapeInvalid === true;
  479. let output = "";
  480. if (node.value) {
  481. if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) return "\\" + node.value;
  482. return node.value;
  483. }
  484. if (node.value) return node.value;
  485. if (node.nodes) for (const child of node.nodes) output += stringify(child);
  486. return output;
  487. };
  488. return stringify(ast);
  489. };
  490. }));
  491. //#endregion
  492. //#region ../../node_modules/.pnpm/is-number@7.0.0/node_modules/is-number/index.js
  493. /*!
  494. * is-number <https://github.com/jonschlinkert/is-number>
  495. *
  496. * Copyright (c) 2014-present, Jon Schlinkert.
  497. * Released under the MIT License.
  498. */
  499. var require_is_number = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  500. module.exports = function(num) {
  501. if (typeof num === "number") return num - num === 0;
  502. if (typeof num === "string" && num.trim() !== "") return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
  503. return false;
  504. };
  505. }));
  506. //#endregion
  507. //#region ../../node_modules/.pnpm/to-regex-range@5.0.1/node_modules/to-regex-range/index.js
  508. /*!
  509. * to-regex-range <https://github.com/micromatch/to-regex-range>
  510. *
  511. * Copyright (c) 2015-present, Jon Schlinkert.
  512. * Released under the MIT License.
  513. */
  514. var require_to_regex_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  515. const isNumber = require_is_number();
  516. const toRegexRange = (min, max, options) => {
  517. if (isNumber(min) === false) throw new TypeError("toRegexRange: expected the first argument to be a number");
  518. if (max === void 0 || min === max) return String(min);
  519. if (isNumber(max) === false) throw new TypeError("toRegexRange: expected the second argument to be a number.");
  520. let opts = {
  521. relaxZeros: true,
  522. ...options
  523. };
  524. if (typeof opts.strictZeros === "boolean") opts.relaxZeros = opts.strictZeros === false;
  525. let relax = String(opts.relaxZeros);
  526. let shorthand = String(opts.shorthand);
  527. let capture = String(opts.capture);
  528. let wrap = String(opts.wrap);
  529. let cacheKey = min + ":" + max + "=" + relax + shorthand + capture + wrap;
  530. if (toRegexRange.cache.hasOwnProperty(cacheKey)) return toRegexRange.cache[cacheKey].result;
  531. let a = Math.min(min, max);
  532. let b = Math.max(min, max);
  533. if (Math.abs(a - b) === 1) {
  534. let result = min + "|" + max;
  535. if (opts.capture) return `(${result})`;
  536. if (opts.wrap === false) return result;
  537. return `(?:${result})`;
  538. }
  539. let isPadded = hasPadding(min) || hasPadding(max);
  540. let state = {
  541. min,
  542. max,
  543. a,
  544. b
  545. };
  546. let positives = [];
  547. let negatives = [];
  548. if (isPadded) {
  549. state.isPadded = isPadded;
  550. state.maxLen = String(state.max).length;
  551. }
  552. if (a < 0) {
  553. negatives = splitToPatterns(b < 0 ? Math.abs(b) : 1, Math.abs(a), state, opts);
  554. a = state.a = 0;
  555. }
  556. if (b >= 0) positives = splitToPatterns(a, b, state, opts);
  557. state.negatives = negatives;
  558. state.positives = positives;
  559. state.result = collatePatterns(negatives, positives, opts);
  560. if (opts.capture === true) state.result = `(${state.result})`;
  561. else if (opts.wrap !== false && positives.length + negatives.length > 1) state.result = `(?:${state.result})`;
  562. toRegexRange.cache[cacheKey] = state;
  563. return state.result;
  564. };
  565. function collatePatterns(neg, pos, options) {
  566. let onlyNegative = filterPatterns(neg, pos, "-", false, options) || [];
  567. let onlyPositive = filterPatterns(pos, neg, "", false, options) || [];
  568. let intersected = filterPatterns(neg, pos, "-?", true, options) || [];
  569. return onlyNegative.concat(intersected).concat(onlyPositive).join("|");
  570. }
  571. function splitToRanges(min, max) {
  572. let nines = 1;
  573. let zeros = 1;
  574. let stop = countNines(min, nines);
  575. let stops = new Set([max]);
  576. while (min <= stop && stop <= max) {
  577. stops.add(stop);
  578. nines += 1;
  579. stop = countNines(min, nines);
  580. }
  581. stop = countZeros(max + 1, zeros) - 1;
  582. while (min < stop && stop <= max) {
  583. stops.add(stop);
  584. zeros += 1;
  585. stop = countZeros(max + 1, zeros) - 1;
  586. }
  587. stops = [...stops];
  588. stops.sort(compare);
  589. return stops;
  590. }
  591. /**
  592. * Convert a range to a regex pattern
  593. * @param {Number} `start`
  594. * @param {Number} `stop`
  595. * @return {String}
  596. */
  597. function rangeToPattern(start, stop, options) {
  598. if (start === stop) return {
  599. pattern: start,
  600. count: [],
  601. digits: 0
  602. };
  603. let zipped = zip(start, stop);
  604. let digits = zipped.length;
  605. let pattern = "";
  606. let count = 0;
  607. for (let i = 0; i < digits; i++) {
  608. let [startDigit, stopDigit] = zipped[i];
  609. if (startDigit === stopDigit) pattern += startDigit;
  610. else if (startDigit !== "0" || stopDigit !== "9") pattern += toCharacterClass(startDigit, stopDigit, options);
  611. else count++;
  612. }
  613. if (count) pattern += options.shorthand === true ? "\\d" : "[0-9]";
  614. return {
  615. pattern,
  616. count: [count],
  617. digits
  618. };
  619. }
  620. function splitToPatterns(min, max, tok, options) {
  621. let ranges = splitToRanges(min, max);
  622. let tokens = [];
  623. let start = min;
  624. let prev;
  625. for (let i = 0; i < ranges.length; i++) {
  626. let max = ranges[i];
  627. let obj = rangeToPattern(String(start), String(max), options);
  628. let zeros = "";
  629. if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
  630. if (prev.count.length > 1) prev.count.pop();
  631. prev.count.push(obj.count[0]);
  632. prev.string = prev.pattern + toQuantifier(prev.count);
  633. start = max + 1;
  634. continue;
  635. }
  636. if (tok.isPadded) zeros = padZeros(max, tok, options);
  637. obj.string = zeros + obj.pattern + toQuantifier(obj.count);
  638. tokens.push(obj);
  639. start = max + 1;
  640. prev = obj;
  641. }
  642. return tokens;
  643. }
  644. function filterPatterns(arr, comparison, prefix, intersection, options) {
  645. let result = [];
  646. for (let ele of arr) {
  647. let { string } = ele;
  648. if (!intersection && !contains(comparison, "string", string)) result.push(prefix + string);
  649. if (intersection && contains(comparison, "string", string)) result.push(prefix + string);
  650. }
  651. return result;
  652. }
  653. /**
  654. * Zip strings
  655. */
  656. function zip(a, b) {
  657. let arr = [];
  658. for (let i = 0; i < a.length; i++) arr.push([a[i], b[i]]);
  659. return arr;
  660. }
  661. function compare(a, b) {
  662. return a > b ? 1 : b > a ? -1 : 0;
  663. }
  664. function contains(arr, key, val) {
  665. return arr.some((ele) => ele[key] === val);
  666. }
  667. function countNines(min, len) {
  668. return Number(String(min).slice(0, -len) + "9".repeat(len));
  669. }
  670. function countZeros(integer, zeros) {
  671. return integer - integer % Math.pow(10, zeros);
  672. }
  673. function toQuantifier(digits) {
  674. let [start = 0, stop = ""] = digits;
  675. if (stop || start > 1) return `{${start + (stop ? "," + stop : "")}}`;
  676. return "";
  677. }
  678. function toCharacterClass(a, b, options) {
  679. return `[${a}${b - a === 1 ? "" : "-"}${b}]`;
  680. }
  681. function hasPadding(str) {
  682. return /^-?(0+)\d/.test(str);
  683. }
  684. function padZeros(value, tok, options) {
  685. if (!tok.isPadded) return value;
  686. let diff = Math.abs(tok.maxLen - String(value).length);
  687. let relax = options.relaxZeros !== false;
  688. switch (diff) {
  689. case 0: return "";
  690. case 1: return relax ? "0?" : "0";
  691. case 2: return relax ? "0{0,2}" : "00";
  692. default: return relax ? `0{0,${diff}}` : `0{${diff}}`;
  693. }
  694. }
  695. /**
  696. * Cache
  697. */
  698. toRegexRange.cache = {};
  699. toRegexRange.clearCache = () => toRegexRange.cache = {};
  700. /**
  701. * Expose `toRegexRange`
  702. */
  703. module.exports = toRegexRange;
  704. }));
  705. //#endregion
  706. //#region ../../node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js
  707. /*!
  708. * fill-range <https://github.com/jonschlinkert/fill-range>
  709. *
  710. * Copyright (c) 2014-present, Jon Schlinkert.
  711. * Licensed under the MIT License.
  712. */
  713. var require_fill_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  714. const util$1 = __require("util");
  715. const toRegexRange = require_to_regex_range();
  716. const isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
  717. const transform = (toNumber) => {
  718. return (value) => toNumber === true ? Number(value) : String(value);
  719. };
  720. const isValidValue = (value) => {
  721. return typeof value === "number" || typeof value === "string" && value !== "";
  722. };
  723. const isNumber = (num) => Number.isInteger(+num);
  724. const zeros = (input) => {
  725. let value = `${input}`;
  726. let index = -1;
  727. if (value[0] === "-") value = value.slice(1);
  728. if (value === "0") return false;
  729. while (value[++index] === "0");
  730. return index > 0;
  731. };
  732. const stringify = (start, end, options) => {
  733. if (typeof start === "string" || typeof end === "string") return true;
  734. return options.stringify === true;
  735. };
  736. const pad = (input, maxLength, toNumber) => {
  737. if (maxLength > 0) {
  738. let dash = input[0] === "-" ? "-" : "";
  739. if (dash) input = input.slice(1);
  740. input = dash + input.padStart(dash ? maxLength - 1 : maxLength, "0");
  741. }
  742. if (toNumber === false) return String(input);
  743. return input;
  744. };
  745. const toMaxLen = (input, maxLength) => {
  746. let negative = input[0] === "-" ? "-" : "";
  747. if (negative) {
  748. input = input.slice(1);
  749. maxLength--;
  750. }
  751. while (input.length < maxLength) input = "0" + input;
  752. return negative ? "-" + input : input;
  753. };
  754. const toSequence = (parts, options, maxLen) => {
  755. parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
  756. parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
  757. let prefix = options.capture ? "" : "?:";
  758. let positives = "";
  759. let negatives = "";
  760. let result;
  761. if (parts.positives.length) positives = parts.positives.map((v) => toMaxLen(String(v), maxLen)).join("|");
  762. if (parts.negatives.length) negatives = `-(${prefix}${parts.negatives.map((v) => toMaxLen(String(v), maxLen)).join("|")})`;
  763. if (positives && negatives) result = `${positives}|${negatives}`;
  764. else result = positives || negatives;
  765. if (options.wrap) return `(${prefix}${result})`;
  766. return result;
  767. };
  768. const toRange = (a, b, isNumbers, options) => {
  769. if (isNumbers) return toRegexRange(a, b, {
  770. wrap: false,
  771. ...options
  772. });
  773. let start = String.fromCharCode(a);
  774. if (a === b) return start;
  775. return `[${start}-${String.fromCharCode(b)}]`;
  776. };
  777. const toRegex = (start, end, options) => {
  778. if (Array.isArray(start)) {
  779. let wrap = options.wrap === true;
  780. let prefix = options.capture ? "" : "?:";
  781. return wrap ? `(${prefix}${start.join("|")})` : start.join("|");
  782. }
  783. return toRegexRange(start, end, options);
  784. };
  785. const rangeError = (...args) => {
  786. return /* @__PURE__ */ new RangeError("Invalid range arguments: " + util$1.inspect(...args));
  787. };
  788. const invalidRange = (start, end, options) => {
  789. if (options.strictRanges === true) throw rangeError([start, end]);
  790. return [];
  791. };
  792. const invalidStep = (step, options) => {
  793. if (options.strictRanges === true) throw new TypeError(`Expected step "${step}" to be a number`);
  794. return [];
  795. };
  796. const fillNumbers = (start, end, step = 1, options = {}) => {
  797. let a = Number(start);
  798. let b = Number(end);
  799. if (!Number.isInteger(a) || !Number.isInteger(b)) {
  800. if (options.strictRanges === true) throw rangeError([start, end]);
  801. return [];
  802. }
  803. if (a === 0) a = 0;
  804. if (b === 0) b = 0;
  805. let descending = a > b;
  806. let startString = String(start);
  807. let endString = String(end);
  808. let stepString = String(step);
  809. step = Math.max(Math.abs(step), 1);
  810. let padded = zeros(startString) || zeros(endString) || zeros(stepString);
  811. let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
  812. let toNumber = padded === false && stringify(start, end, options) === false;
  813. let format = options.transform || transform(toNumber);
  814. if (options.toRegex && step === 1) return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
  815. let parts = {
  816. negatives: [],
  817. positives: []
  818. };
  819. let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
  820. let range = [];
  821. let index = 0;
  822. while (descending ? a >= b : a <= b) {
  823. if (options.toRegex === true && step > 1) push(a);
  824. else range.push(pad(format(a, index), maxLen, toNumber));
  825. a = descending ? a - step : a + step;
  826. index++;
  827. }
  828. if (options.toRegex === true) return step > 1 ? toSequence(parts, options, maxLen) : toRegex(range, null, {
  829. wrap: false,
  830. ...options
  831. });
  832. return range;
  833. };
  834. const fillLetters = (start, end, step = 1, options = {}) => {
  835. if (!isNumber(start) && start.length > 1 || !isNumber(end) && end.length > 1) return invalidRange(start, end, options);
  836. let format = options.transform || ((val) => String.fromCharCode(val));
  837. let a = `${start}`.charCodeAt(0);
  838. let b = `${end}`.charCodeAt(0);
  839. let descending = a > b;
  840. let min = Math.min(a, b);
  841. let max = Math.max(a, b);
  842. if (options.toRegex && step === 1) return toRange(min, max, false, options);
  843. let range = [];
  844. let index = 0;
  845. while (descending ? a >= b : a <= b) {
  846. range.push(format(a, index));
  847. a = descending ? a - step : a + step;
  848. index++;
  849. }
  850. if (options.toRegex === true) return toRegex(range, null, {
  851. wrap: false,
  852. options
  853. });
  854. return range;
  855. };
  856. const fill = (start, end, step, options = {}) => {
  857. if (end == null && isValidValue(start)) return [start];
  858. if (!isValidValue(start) || !isValidValue(end)) return invalidRange(start, end, options);
  859. if (typeof step === "function") return fill(start, end, 1, { transform: step });
  860. if (isObject(step)) return fill(start, end, 0, step);
  861. let opts = { ...options };
  862. if (opts.capture === true) opts.wrap = true;
  863. step = step || opts.step || 1;
  864. if (!isNumber(step)) {
  865. if (step != null && !isObject(step)) return invalidStep(step, opts);
  866. return fill(start, end, 1, step);
  867. }
  868. if (isNumber(start) && isNumber(end)) return fillNumbers(start, end, step, opts);
  869. return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
  870. };
  871. module.exports = fill;
  872. }));
  873. //#endregion
  874. //#region ../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/compile.js
  875. var require_compile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  876. const fill = require_fill_range();
  877. const utils = require_utils$3();
  878. const compile = (ast, options = {}) => {
  879. const walk = (node, parent = {}) => {
  880. const invalidBlock = utils.isInvalidBrace(parent);
  881. const invalidNode = node.invalid === true && options.escapeInvalid === true;
  882. const invalid = invalidBlock === true || invalidNode === true;
  883. const prefix = options.escapeInvalid === true ? "\\" : "";
  884. let output = "";
  885. if (node.isOpen === true) return prefix + node.value;
  886. if (node.isClose === true) {
  887. console.log("node.isClose", prefix, node.value);
  888. return prefix + node.value;
  889. }
  890. if (node.type === "open") return invalid ? prefix + node.value : "(";
  891. if (node.type === "close") return invalid ? prefix + node.value : ")";
  892. if (node.type === "comma") return node.prev.type === "comma" ? "" : invalid ? node.value : "|";
  893. if (node.value) return node.value;
  894. if (node.nodes && node.ranges > 0) {
  895. const args = utils.reduce(node.nodes);
  896. const range = fill(...args, {
  897. ...options,
  898. wrap: false,
  899. toRegex: true,
  900. strictZeros: true
  901. });
  902. if (range.length !== 0) return args.length > 1 && range.length > 1 ? `(${range})` : range;
  903. }
  904. if (node.nodes) for (const child of node.nodes) output += walk(child, node);
  905. return output;
  906. };
  907. return walk(ast);
  908. };
  909. module.exports = compile;
  910. }));
  911. //#endregion
  912. //#region ../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/expand.js
  913. var require_expand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  914. const fill = require_fill_range();
  915. const stringify = require_stringify();
  916. const utils = require_utils$3();
  917. const append = (queue = "", stash = "", enclose = false) => {
  918. const result = [];
  919. queue = [].concat(queue);
  920. stash = [].concat(stash);
  921. if (!stash.length) return queue;
  922. if (!queue.length) return enclose ? utils.flatten(stash).map((ele) => `{${ele}}`) : stash;
  923. for (const item of queue) if (Array.isArray(item)) for (const value of item) result.push(append(value, stash, enclose));
  924. else for (let ele of stash) {
  925. if (enclose === true && typeof ele === "string") ele = `{${ele}}`;
  926. result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
  927. }
  928. return utils.flatten(result);
  929. };
  930. const expand = (ast, options = {}) => {
  931. const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
  932. const walk = (node, parent = {}) => {
  933. node.queue = [];
  934. let p = parent;
  935. let q = parent.queue;
  936. while (p.type !== "brace" && p.type !== "root" && p.parent) {
  937. p = p.parent;
  938. q = p.queue;
  939. }
  940. if (node.invalid || node.dollar) {
  941. q.push(append(q.pop(), stringify(node, options)));
  942. return;
  943. }
  944. if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
  945. q.push(append(q.pop(), ["{}"]));
  946. return;
  947. }
  948. if (node.nodes && node.ranges > 0) {
  949. const args = utils.reduce(node.nodes);
  950. if (utils.exceedsLimit(...args, options.step, rangeLimit)) throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");
  951. let range = fill(...args, options);
  952. if (range.length === 0) range = stringify(node, options);
  953. q.push(append(q.pop(), range));
  954. node.nodes = [];
  955. return;
  956. }
  957. const enclose = utils.encloseBrace(node);
  958. let queue = node.queue;
  959. let block = node;
  960. while (block.type !== "brace" && block.type !== "root" && block.parent) {
  961. block = block.parent;
  962. queue = block.queue;
  963. }
  964. for (let i = 0; i < node.nodes.length; i++) {
  965. const child = node.nodes[i];
  966. if (child.type === "comma" && node.type === "brace") {
  967. if (i === 1) queue.push("");
  968. queue.push("");
  969. continue;
  970. }
  971. if (child.type === "close") {
  972. q.push(append(q.pop(), queue, enclose));
  973. continue;
  974. }
  975. if (child.value && child.type !== "open") {
  976. queue.push(append(queue.pop(), child.value));
  977. continue;
  978. }
  979. if (child.nodes) walk(child, node);
  980. }
  981. return queue;
  982. };
  983. return utils.flatten(walk(ast));
  984. };
  985. module.exports = expand;
  986. }));
  987. //#endregion
  988. //#region ../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/constants.js
  989. var require_constants$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  990. module.exports = {
  991. MAX_LENGTH: 1e4,
  992. CHAR_0: "0",
  993. CHAR_9: "9",
  994. CHAR_UPPERCASE_A: "A",
  995. CHAR_LOWERCASE_A: "a",
  996. CHAR_UPPERCASE_Z: "Z",
  997. CHAR_LOWERCASE_Z: "z",
  998. CHAR_LEFT_PARENTHESES: "(",
  999. CHAR_RIGHT_PARENTHESES: ")",
  1000. CHAR_ASTERISK: "*",
  1001. CHAR_AMPERSAND: "&",
  1002. CHAR_AT: "@",
  1003. CHAR_BACKSLASH: "\\",
  1004. CHAR_BACKTICK: "`",
  1005. CHAR_CARRIAGE_RETURN: "\r",
  1006. CHAR_CIRCUMFLEX_ACCENT: "^",
  1007. CHAR_COLON: ":",
  1008. CHAR_COMMA: ",",
  1009. CHAR_DOLLAR: "$",
  1010. CHAR_DOT: ".",
  1011. CHAR_DOUBLE_QUOTE: "\"",
  1012. CHAR_EQUAL: "=",
  1013. CHAR_EXCLAMATION_MARK: "!",
  1014. CHAR_FORM_FEED: "\f",
  1015. CHAR_FORWARD_SLASH: "/",
  1016. CHAR_HASH: "#",
  1017. CHAR_HYPHEN_MINUS: "-",
  1018. CHAR_LEFT_ANGLE_BRACKET: "<",
  1019. CHAR_LEFT_CURLY_BRACE: "{",
  1020. CHAR_LEFT_SQUARE_BRACKET: "[",
  1021. CHAR_LINE_FEED: "\n",
  1022. CHAR_NO_BREAK_SPACE: "\xA0",
  1023. CHAR_PERCENT: "%",
  1024. CHAR_PLUS: "+",
  1025. CHAR_QUESTION_MARK: "?",
  1026. CHAR_RIGHT_ANGLE_BRACKET: ">",
  1027. CHAR_RIGHT_CURLY_BRACE: "}",
  1028. CHAR_RIGHT_SQUARE_BRACKET: "]",
  1029. CHAR_SEMICOLON: ";",
  1030. CHAR_SINGLE_QUOTE: "'",
  1031. CHAR_SPACE: " ",
  1032. CHAR_TAB: " ",
  1033. CHAR_UNDERSCORE: "_",
  1034. CHAR_VERTICAL_LINE: "|",
  1035. CHAR_ZERO_WIDTH_NOBREAK_SPACE: ""
  1036. };
  1037. }));
  1038. //#endregion
  1039. //#region ../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js
  1040. var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  1041. const stringify = require_stringify();
  1042. /**
  1043. * Constants
  1044. */
  1045. const { MAX_LENGTH, CHAR_BACKSLASH, CHAR_BACKTICK, CHAR_COMMA, CHAR_DOT, CHAR_LEFT_PARENTHESES, CHAR_RIGHT_PARENTHESES, CHAR_LEFT_CURLY_BRACE, CHAR_RIGHT_CURLY_BRACE, CHAR_LEFT_SQUARE_BRACKET, CHAR_RIGHT_SQUARE_BRACKET, CHAR_DOUBLE_QUOTE, CHAR_SINGLE_QUOTE, CHAR_NO_BREAK_SPACE, CHAR_ZERO_WIDTH_NOBREAK_SPACE } = require_constants$2();
  1046. /**
  1047. * parse
  1048. */
  1049. const parse = (input, options = {}) => {
  1050. if (typeof input !== "string") throw new TypeError("Expected a string");
  1051. const opts = options || {};
  1052. const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
  1053. if (input.length > max) throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
  1054. const ast = {
  1055. type: "root",
  1056. input,
  1057. nodes: []
  1058. };
  1059. const stack = [ast];
  1060. let block = ast;
  1061. let prev = ast;
  1062. let brackets = 0;
  1063. const length = input.length;
  1064. let index = 0;
  1065. let depth = 0;
  1066. let value;
  1067. /**
  1068. * Helpers
  1069. */
  1070. const advance = () => input[index++];
  1071. const push = (node) => {
  1072. if (node.type === "text" && prev.type === "dot") prev.type = "text";
  1073. if (prev && prev.type === "text" && node.type === "text") {
  1074. prev.value += node.value;
  1075. return;
  1076. }
  1077. block.nodes.push(node);
  1078. node.parent = block;
  1079. node.prev = prev;
  1080. prev = node;
  1081. return node;
  1082. };
  1083. push({ type: "bos" });
  1084. while (index < length) {
  1085. block = stack[stack.length - 1];
  1086. value = advance();
  1087. /**
  1088. * Invalid chars
  1089. */
  1090. if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) continue;
  1091. /**
  1092. * Escaped chars
  1093. */
  1094. if (value === CHAR_BACKSLASH) {
  1095. push({
  1096. type: "text",
  1097. value: (options.keepEscaping ? value : "") + advance()
  1098. });
  1099. continue;
  1100. }
  1101. /**
  1102. * Right square bracket (literal): ']'
  1103. */
  1104. if (value === CHAR_RIGHT_SQUARE_BRACKET) {
  1105. push({
  1106. type: "text",
  1107. value: "\\" + value
  1108. });
  1109. continue;
  1110. }
  1111. /**
  1112. * Left square bracket: '['
  1113. */
  1114. if (value === CHAR_LEFT_SQUARE_BRACKET) {
  1115. brackets++;
  1116. let next;
  1117. while (index < length && (next = advance())) {
  1118. value += next;
  1119. if (next === CHAR_LEFT_SQUARE_BRACKET) {
  1120. brackets++;
  1121. continue;
  1122. }
  1123. if (next === CHAR_BACKSLASH) {
  1124. value += advance();
  1125. continue;
  1126. }
  1127. if (next === CHAR_RIGHT_SQUARE_BRACKET) {
  1128. brackets--;
  1129. if (brackets === 0) break;
  1130. }
  1131. }
  1132. push({
  1133. type: "text",
  1134. value
  1135. });
  1136. continue;
  1137. }
  1138. /**
  1139. * Parentheses
  1140. */
  1141. if (value === CHAR_LEFT_PARENTHESES) {
  1142. block = push({
  1143. type: "paren",
  1144. nodes: []
  1145. });
  1146. stack.push(block);
  1147. push({
  1148. type: "text",
  1149. value
  1150. });
  1151. continue;
  1152. }
  1153. if (value === CHAR_RIGHT_PARENTHESES) {
  1154. if (block.type !== "paren") {
  1155. push({
  1156. type: "text",
  1157. value
  1158. });
  1159. continue;
  1160. }
  1161. block = stack.pop();
  1162. push({
  1163. type: "text",
  1164. value
  1165. });
  1166. block = stack[stack.length - 1];
  1167. continue;
  1168. }
  1169. /**
  1170. * Quotes: '|"|`
  1171. */
  1172. if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
  1173. const open = value;
  1174. let next;
  1175. if (options.keepQuotes !== true) value = "";
  1176. while (index < length && (next = advance())) {
  1177. if (next === CHAR_BACKSLASH) {
  1178. value += next + advance();
  1179. continue;
  1180. }
  1181. if (next === open) {
  1182. if (options.keepQuotes === true) value += next;
  1183. break;
  1184. }
  1185. value += next;
  1186. }
  1187. push({
  1188. type: "text",
  1189. value
  1190. });
  1191. continue;
  1192. }
  1193. /**
  1194. * Left curly brace: '{'
  1195. */
  1196. if (value === CHAR_LEFT_CURLY_BRACE) {
  1197. depth++;
  1198. block = push({
  1199. type: "brace",
  1200. open: true,
  1201. close: false,
  1202. dollar: prev.value && prev.value.slice(-1) === "$" || block.dollar === true,
  1203. depth,
  1204. commas: 0,
  1205. ranges: 0,
  1206. nodes: []
  1207. });
  1208. stack.push(block);
  1209. push({
  1210. type: "open",
  1211. value
  1212. });
  1213. continue;
  1214. }
  1215. /**
  1216. * Right curly brace: '}'
  1217. */
  1218. if (value === CHAR_RIGHT_CURLY_BRACE) {
  1219. if (block.type !== "brace") {
  1220. push({
  1221. type: "text",
  1222. value
  1223. });
  1224. continue;
  1225. }
  1226. const type = "close";
  1227. block = stack.pop();
  1228. block.close = true;
  1229. push({
  1230. type,
  1231. value
  1232. });
  1233. depth--;
  1234. block = stack[stack.length - 1];
  1235. continue;
  1236. }
  1237. /**
  1238. * Comma: ','
  1239. */
  1240. if (value === CHAR_COMMA && depth > 0) {
  1241. if (block.ranges > 0) {
  1242. block.ranges = 0;
  1243. const open = block.nodes.shift();
  1244. block.nodes = [open, {
  1245. type: "text",
  1246. value: stringify(block)
  1247. }];
  1248. }
  1249. push({
  1250. type: "comma",
  1251. value
  1252. });
  1253. block.commas++;
  1254. continue;
  1255. }
  1256. /**
  1257. * Dot: '.'
  1258. */
  1259. if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
  1260. const siblings = block.nodes;
  1261. if (depth === 0 || siblings.length === 0) {
  1262. push({
  1263. type: "text",
  1264. value
  1265. });
  1266. continue;
  1267. }
  1268. if (prev.type === "dot") {
  1269. block.range = [];
  1270. prev.value += value;
  1271. prev.type = "range";
  1272. if (block.nodes.length !== 3 && block.nodes.length !== 5) {
  1273. block.invalid = true;
  1274. block.ranges = 0;
  1275. prev.type = "text";
  1276. continue;
  1277. }
  1278. block.ranges++;
  1279. block.args = [];
  1280. continue;
  1281. }
  1282. if (prev.type === "range") {
  1283. siblings.pop();
  1284. const before = siblings[siblings.length - 1];
  1285. before.value += prev.value + value;
  1286. prev = before;
  1287. block.ranges--;
  1288. continue;
  1289. }
  1290. push({
  1291. type: "dot",
  1292. value
  1293. });
  1294. continue;
  1295. }
  1296. /**
  1297. * Text
  1298. */
  1299. push({
  1300. type: "text",
  1301. value
  1302. });
  1303. }
  1304. do {
  1305. block = stack.pop();
  1306. if (block.type !== "root") {
  1307. block.nodes.forEach((node) => {
  1308. if (!node.nodes) {
  1309. if (node.type === "open") node.isOpen = true;
  1310. if (node.type === "close") node.isClose = true;
  1311. if (!node.nodes) node.type = "text";
  1312. node.invalid = true;
  1313. }
  1314. });
  1315. const parent = stack[stack.length - 1];
  1316. const index = parent.nodes.indexOf(block);
  1317. parent.nodes.splice(index, 1, ...block.nodes);
  1318. }
  1319. } while (stack.length > 0);
  1320. push({ type: "eos" });
  1321. return ast;
  1322. };
  1323. module.exports = parse;
  1324. }));
  1325. //#endregion
  1326. //#region ../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/index.js
  1327. var require_braces = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  1328. const stringify = require_stringify();
  1329. const compile = require_compile();
  1330. const expand = require_expand();
  1331. const parse = require_parse$1();
  1332. /**
  1333. * Expand the given pattern or create a regex-compatible string.
  1334. *
  1335. * ```js
  1336. * const braces = require('braces');
  1337. * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)']
  1338. * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c']
  1339. * ```
  1340. * @param {String} `str`
  1341. * @param {Object} `options`
  1342. * @return {String}
  1343. * @api public
  1344. */
  1345. const braces = (input, options = {}) => {
  1346. let output = [];
  1347. if (Array.isArray(input)) for (const pattern of input) {
  1348. const result = braces.create(pattern, options);
  1349. if (Array.isArray(result)) output.push(...result);
  1350. else output.push(result);
  1351. }
  1352. else output = [].concat(braces.create(input, options));
  1353. if (options && options.expand === true && options.nodupes === true) output = [...new Set(output)];
  1354. return output;
  1355. };
  1356. /**
  1357. * Parse the given `str` with the given `options`.
  1358. *
  1359. * ```js
  1360. * // braces.parse(pattern, [, options]);
  1361. * const ast = braces.parse('a/{b,c}/d');
  1362. * console.log(ast);
  1363. * ```
  1364. * @param {String} pattern Brace pattern to parse
  1365. * @param {Object} options
  1366. * @return {Object} Returns an AST
  1367. * @api public
  1368. */
  1369. braces.parse = (input, options = {}) => parse(input, options);
  1370. /**
  1371. * Creates a braces string from an AST, or an AST node.
  1372. *
  1373. * ```js
  1374. * const braces = require('braces');
  1375. * let ast = braces.parse('foo/{a,b}/bar');
  1376. * console.log(stringify(ast.nodes[2])); //=> '{a,b}'
  1377. * ```
  1378. * @param {String} `input` Brace pattern or AST.
  1379. * @param {Object} `options`
  1380. * @return {Array} Returns an array of expanded values.
  1381. * @api public
  1382. */
  1383. braces.stringify = (input, options = {}) => {
  1384. if (typeof input === "string") return stringify(braces.parse(input, options), options);
  1385. return stringify(input, options);
  1386. };
  1387. /**
  1388. * Compiles a brace pattern into a regex-compatible, optimized string.
  1389. * This method is called by the main [braces](#braces) function by default.
  1390. *
  1391. * ```js
  1392. * const braces = require('braces');
  1393. * console.log(braces.compile('a/{b,c}/d'));
  1394. * //=> ['a/(b|c)/d']
  1395. * ```
  1396. * @param {String} `input` Brace pattern or AST.
  1397. * @param {Object} `options`
  1398. * @return {Array} Returns an array of expanded values.
  1399. * @api public
  1400. */
  1401. braces.compile = (input, options = {}) => {
  1402. if (typeof input === "string") input = braces.parse(input, options);
  1403. return compile(input, options);
  1404. };
  1405. /**
  1406. * Expands a brace pattern into an array. This method is called by the
  1407. * main [braces](#braces) function when `options.expand` is true. Before
  1408. * using this method it's recommended that you read the [performance notes](#performance))
  1409. * and advantages of using [.compile](#compile) instead.
  1410. *
  1411. * ```js
  1412. * const braces = require('braces');
  1413. * console.log(braces.expand('a/{b,c}/d'));
  1414. * //=> ['a/b/d', 'a/c/d'];
  1415. * ```
  1416. * @param {String} `pattern` Brace pattern
  1417. * @param {Object} `options`
  1418. * @return {Array} Returns an array of expanded values.
  1419. * @api public
  1420. */
  1421. braces.expand = (input, options = {}) => {
  1422. if (typeof input === "string") input = braces.parse(input, options);
  1423. let result = expand(input, options);
  1424. if (options.noempty === true) result = result.filter(Boolean);
  1425. if (options.nodupes === true) result = [...new Set(result)];
  1426. return result;
  1427. };
  1428. /**
  1429. * Processes a brace pattern and returns either an expanded array
  1430. * (if `options.expand` is true), a highly optimized regex-compatible string.
  1431. * This method is called by the main [braces](#braces) function.
  1432. *
  1433. * ```js
  1434. * const braces = require('braces');
  1435. * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}'))
  1436. * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)'
  1437. * ```
  1438. * @param {String} `pattern` Brace pattern
  1439. * @param {Object} `options`
  1440. * @return {Array} Returns an array of expanded values.
  1441. * @api public
  1442. */
  1443. braces.create = (input, options = {}) => {
  1444. if (input === "" || input.length < 3) return [input];
  1445. return options.expand !== true ? braces.compile(input, options) : braces.expand(input, options);
  1446. };
  1447. /**
  1448. * Expose "braces"
  1449. */
  1450. module.exports = braces;
  1451. }));
  1452. //#endregion
  1453. //#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js
  1454. var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  1455. const path$8 = __require("path");
  1456. const WIN_SLASH = "\\\\/";
  1457. const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
  1458. /**
  1459. * Posix glob regex
  1460. */
  1461. const DOT_LITERAL = "\\.";
  1462. const PLUS_LITERAL = "\\+";
  1463. const QMARK_LITERAL = "\\?";
  1464. const SLASH_LITERAL = "\\/";
  1465. const ONE_CHAR = "(?=.)";
  1466. const QMARK = "[^/]";
  1467. const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
  1468. const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
  1469. const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
  1470. const POSIX_CHARS = {
  1471. DOT_LITERAL,
  1472. PLUS_LITERAL,
  1473. QMARK_LITERAL,
  1474. SLASH_LITERAL,
  1475. ONE_CHAR,
  1476. QMARK,
  1477. END_ANCHOR,
  1478. DOTS_SLASH,
  1479. NO_DOT: `(?!${DOT_LITERAL})`,
  1480. NO_DOTS: `(?!${START_ANCHOR}${DOTS_SLASH})`,
  1481. NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`,
  1482. NO_DOTS_SLASH: `(?!${DOTS_SLASH})`,
  1483. QMARK_NO_DOT: `[^.${SLASH_LITERAL}]`,
  1484. STAR: `${QMARK}*?`,
  1485. START_ANCHOR
  1486. };
  1487. /**
  1488. * Windows glob regex
  1489. */
  1490. const WINDOWS_CHARS = {
  1491. ...POSIX_CHARS,
  1492. SLASH_LITERAL: `[${WIN_SLASH}]`,
  1493. QMARK: WIN_NO_SLASH,
  1494. STAR: `${WIN_NO_SLASH}*?`,
  1495. DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
  1496. NO_DOT: `(?!${DOT_LITERAL})`,
  1497. NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
  1498. NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
  1499. NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
  1500. QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
  1501. START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
  1502. END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
  1503. };
  1504. module.exports = {
  1505. MAX_LENGTH: 1024 * 64,
  1506. POSIX_REGEX_SOURCE: {
  1507. alnum: "a-zA-Z0-9",
  1508. alpha: "a-zA-Z",
  1509. ascii: "\\x00-\\x7F",
  1510. blank: " \\t",
  1511. cntrl: "\\x00-\\x1F\\x7F",
  1512. digit: "0-9",
  1513. graph: "\\x21-\\x7E",
  1514. lower: "a-z",
  1515. print: "\\x20-\\x7E ",
  1516. punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
  1517. space: " \\t\\r\\n\\v\\f",
  1518. upper: "A-Z",
  1519. word: "A-Za-z0-9_",
  1520. xdigit: "A-Fa-f0-9"
  1521. },
  1522. REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
  1523. REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
  1524. REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
  1525. REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
  1526. REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
  1527. REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
  1528. REPLACEMENTS: {
  1529. "***": "*",
  1530. "**/**": "**",
  1531. "**/**/**": "**"
  1532. },
  1533. CHAR_0: 48,
  1534. CHAR_9: 57,
  1535. CHAR_UPPERCASE_A: 65,
  1536. CHAR_LOWERCASE_A: 97,
  1537. CHAR_UPPERCASE_Z: 90,
  1538. CHAR_LOWERCASE_Z: 122,
  1539. CHAR_LEFT_PARENTHESES: 40,
  1540. CHAR_RIGHT_PARENTHESES: 41,
  1541. CHAR_ASTERISK: 42,
  1542. CHAR_AMPERSAND: 38,
  1543. CHAR_AT: 64,
  1544. CHAR_BACKWARD_SLASH: 92,
  1545. CHAR_CARRIAGE_RETURN: 13,
  1546. CHAR_CIRCUMFLEX_ACCENT: 94,
  1547. CHAR_COLON: 58,
  1548. CHAR_COMMA: 44,
  1549. CHAR_DOT: 46,
  1550. CHAR_DOUBLE_QUOTE: 34,
  1551. CHAR_EQUAL: 61,
  1552. CHAR_EXCLAMATION_MARK: 33,
  1553. CHAR_FORM_FEED: 12,
  1554. CHAR_FORWARD_SLASH: 47,
  1555. CHAR_GRAVE_ACCENT: 96,
  1556. CHAR_HASH: 35,
  1557. CHAR_HYPHEN_MINUS: 45,
  1558. CHAR_LEFT_ANGLE_BRACKET: 60,
  1559. CHAR_LEFT_CURLY_BRACE: 123,
  1560. CHAR_LEFT_SQUARE_BRACKET: 91,
  1561. CHAR_LINE_FEED: 10,
  1562. CHAR_NO_BREAK_SPACE: 160,
  1563. CHAR_PERCENT: 37,
  1564. CHAR_PLUS: 43,
  1565. CHAR_QUESTION_MARK: 63,
  1566. CHAR_RIGHT_ANGLE_BRACKET: 62,
  1567. CHAR_RIGHT_CURLY_BRACE: 125,
  1568. CHAR_RIGHT_SQUARE_BRACKET: 93,
  1569. CHAR_SEMICOLON: 59,
  1570. CHAR_SINGLE_QUOTE: 39,
  1571. CHAR_SPACE: 32,
  1572. CHAR_TAB: 9,
  1573. CHAR_UNDERSCORE: 95,
  1574. CHAR_VERTICAL_LINE: 124,
  1575. CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
  1576. SEP: path$8.sep,
  1577. extglobChars(chars) {
  1578. return {
  1579. "!": {
  1580. type: "negate",
  1581. open: "(?:(?!(?:",
  1582. close: `))${chars.STAR})`
  1583. },
  1584. "?": {
  1585. type: "qmark",
  1586. open: "(?:",
  1587. close: ")?"
  1588. },
  1589. "+": {
  1590. type: "plus",
  1591. open: "(?:",
  1592. close: ")+"
  1593. },
  1594. "*": {
  1595. type: "star",
  1596. open: "(?:",
  1597. close: ")*"
  1598. },
  1599. "@": {
  1600. type: "at",
  1601. open: "(?:",
  1602. close: ")"
  1603. }
  1604. };
  1605. },
  1606. globChars(win32) {
  1607. return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
  1608. }
  1609. };
  1610. }));
  1611. //#endregion
  1612. //#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js
  1613. var require_utils$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
  1614. const path$7 = __require("path");
  1615. const win32 = process.platform === "win32";
  1616. const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants$1();
  1617. exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
  1618. exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
  1619. exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
  1620. exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
  1621. exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
  1622. exports.removeBackslashes = (str) => {
  1623. return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
  1624. return match === "\\" ? "" : match;
  1625. });
  1626. };
  1627. exports.supportsLookbehinds = () => {
  1628. const segs = process.version.slice(1).split(".").map(Number);
  1629. if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) return true;
  1630. return false;
  1631. };
  1632. exports.isWindows = (options) => {
  1633. if (options && typeof options.windows === "boolean") return options.windows;
  1634. return win32 === true || path$7.sep === "\\";
  1635. };
  1636. exports.escapeLast = (input, char, lastIdx) => {
  1637. const idx = input.lastIndexOf(char, lastIdx);
  1638. if (idx === -1) return input;
  1639. if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
  1640. return `${input.slice(0, idx)}\\${input.slice(idx)}`;
  1641. };
  1642. exports.removePrefix = (input, state = {}) => {
  1643. let output = input;
  1644. if (output.startsWith("./")) {
  1645. output = output.slice(2);
  1646. state.prefix = "./";
  1647. }
  1648. return output;
  1649. };
  1650. exports.wrapOutput = (input, state = {}, options = {}) => {
  1651. let output = `${options.contains ? "" : "^"}(?:${input})${options.contains ? "" : "$"}`;
  1652. if (state.negated === true) output = `(?:^(?!${output}).*$)`;
  1653. return output;
  1654. };
  1655. }));
  1656. //#endregion
  1657. //#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/scan.js
  1658. var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  1659. const utils = require_utils$2();
  1660. const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants$1();
  1661. const isPathSeparator = (code) => {
  1662. return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
  1663. };
  1664. const depth = (token) => {
  1665. if (token.isPrefix !== true) token.depth = token.isGlobstar ? Infinity : 1;
  1666. };
  1667. /**
  1668. * Quickly scans a glob pattern and returns an object with a handful of
  1669. * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
  1670. * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
  1671. * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
  1672. *
  1673. * ```js
  1674. * const pm = require('picomatch');
  1675. * console.log(pm.scan('foo/bar/*.js'));
  1676. * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
  1677. * ```
  1678. * @param {String} `str`
  1679. * @param {Object} `options`
  1680. * @return {Object} Returns an object with tokens and regex source string.
  1681. * @api public
  1682. */
  1683. const scan = (input, options) => {
  1684. const opts = options || {};
  1685. const length = input.length - 1;
  1686. const scanToEnd = opts.parts === true || opts.scanToEnd === true;
  1687. const slashes = [];
  1688. const tokens = [];
  1689. const parts = [];
  1690. let str = input;
  1691. let index = -1;
  1692. let start = 0;
  1693. let lastIndex = 0;
  1694. let isBrace = false;
  1695. let isBracket = false;
  1696. let isGlob = false;
  1697. let isExtglob = false;
  1698. let isGlobstar = false;
  1699. let braceEscaped = false;
  1700. let backslashes = false;
  1701. let negated = false;
  1702. let negatedExtglob = false;
  1703. let finished = false;
  1704. let braces = 0;
  1705. let prev;
  1706. let code;
  1707. let token = {
  1708. value: "",
  1709. depth: 0,
  1710. isGlob: false
  1711. };
  1712. const eos = () => index >= length;
  1713. const peek = () => str.charCodeAt(index + 1);
  1714. const advance = () => {
  1715. prev = code;
  1716. return str.charCodeAt(++index);
  1717. };
  1718. while (index < length) {
  1719. code = advance();
  1720. let next;
  1721. if (code === CHAR_BACKWARD_SLASH) {
  1722. backslashes = token.backslashes = true;
  1723. code = advance();
  1724. if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
  1725. continue;
  1726. }
  1727. if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
  1728. braces++;
  1729. while (eos() !== true && (code = advance())) {
  1730. if (code === CHAR_BACKWARD_SLASH) {
  1731. backslashes = token.backslashes = true;
  1732. advance();
  1733. continue;
  1734. }
  1735. if (code === CHAR_LEFT_CURLY_BRACE) {
  1736. braces++;
  1737. continue;
  1738. }
  1739. if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
  1740. isBrace = token.isBrace = true;
  1741. isGlob = token.isGlob = true;
  1742. finished = true;
  1743. if (scanToEnd === true) continue;
  1744. break;
  1745. }
  1746. if (braceEscaped !== true && code === CHAR_COMMA) {
  1747. isBrace = token.isBrace = true;
  1748. isGlob = token.isGlob = true;
  1749. finished = true;
  1750. if (scanToEnd === true) continue;
  1751. break;
  1752. }
  1753. if (code === CHAR_RIGHT_CURLY_BRACE) {
  1754. braces--;
  1755. if (braces === 0) {
  1756. braceEscaped = false;
  1757. isBrace = token.isBrace = true;
  1758. finished = true;
  1759. break;
  1760. }
  1761. }
  1762. }
  1763. if (scanToEnd === true) continue;
  1764. break;
  1765. }
  1766. if (code === CHAR_FORWARD_SLASH) {
  1767. slashes.push(index);
  1768. tokens.push(token);
  1769. token = {
  1770. value: "",
  1771. depth: 0,
  1772. isGlob: false
  1773. };
  1774. if (finished === true) continue;
  1775. if (prev === CHAR_DOT && index === start + 1) {
  1776. start += 2;
  1777. continue;
  1778. }
  1779. lastIndex = index + 1;
  1780. continue;
  1781. }
  1782. if (opts.noext !== true) {
  1783. if ((code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK) === true && peek() === CHAR_LEFT_PARENTHESES) {
  1784. isGlob = token.isGlob = true;
  1785. isExtglob = token.isExtglob = true;
  1786. finished = true;
  1787. if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
  1788. if (scanToEnd === true) {
  1789. while (eos() !== true && (code = advance())) {
  1790. if (code === CHAR_BACKWARD_SLASH) {
  1791. backslashes = token.backslashes = true;
  1792. code = advance();
  1793. continue;
  1794. }
  1795. if (code === CHAR_RIGHT_PARENTHESES) {
  1796. isGlob = token.isGlob = true;
  1797. finished = true;
  1798. break;
  1799. }
  1800. }
  1801. continue;
  1802. }
  1803. break;
  1804. }
  1805. }
  1806. if (code === CHAR_ASTERISK) {
  1807. if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
  1808. isGlob = token.isGlob = true;
  1809. finished = true;
  1810. if (scanToEnd === true) continue;
  1811. break;
  1812. }
  1813. if (code === CHAR_QUESTION_MARK) {
  1814. isGlob = token.isGlob = true;
  1815. finished = true;
  1816. if (scanToEnd === true) continue;
  1817. break;
  1818. }
  1819. if (code === CHAR_LEFT_SQUARE_BRACKET) {
  1820. while (eos() !== true && (next = advance())) {
  1821. if (next === CHAR_BACKWARD_SLASH) {
  1822. backslashes = token.backslashes = true;
  1823. advance();
  1824. continue;
  1825. }
  1826. if (next === CHAR_RIGHT_SQUARE_BRACKET) {
  1827. isBracket = token.isBracket = true;
  1828. isGlob = token.isGlob = true;
  1829. finished = true;
  1830. break;
  1831. }
  1832. }
  1833. if (scanToEnd === true) continue;
  1834. break;
  1835. }
  1836. if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
  1837. negated = token.negated = true;
  1838. start++;
  1839. continue;
  1840. }
  1841. if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
  1842. isGlob = token.isGlob = true;
  1843. if (scanToEnd === true) {
  1844. while (eos() !== true && (code = advance())) {
  1845. if (code === CHAR_LEFT_PARENTHESES) {
  1846. backslashes = token.backslashes = true;
  1847. code = advance();
  1848. continue;
  1849. }
  1850. if (code === CHAR_RIGHT_PARENTHESES) {
  1851. finished = true;
  1852. break;
  1853. }
  1854. }
  1855. continue;
  1856. }
  1857. break;
  1858. }
  1859. if (isGlob === true) {
  1860. finished = true;
  1861. if (scanToEnd === true) continue;
  1862. break;
  1863. }
  1864. }
  1865. if (opts.noext === true) {
  1866. isExtglob = false;
  1867. isGlob = false;
  1868. }
  1869. let base = str;
  1870. let prefix = "";
  1871. let glob = "";
  1872. if (start > 0) {
  1873. prefix = str.slice(0, start);
  1874. str = str.slice(start);
  1875. lastIndex -= start;
  1876. }
  1877. if (base && isGlob === true && lastIndex > 0) {
  1878. base = str.slice(0, lastIndex);
  1879. glob = str.slice(lastIndex);
  1880. } else if (isGlob === true) {
  1881. base = "";
  1882. glob = str;
  1883. } else base = str;
  1884. if (base && base !== "" && base !== "/" && base !== str) {
  1885. if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
  1886. }
  1887. if (opts.unescape === true) {
  1888. if (glob) glob = utils.removeBackslashes(glob);
  1889. if (base && backslashes === true) base = utils.removeBackslashes(base);
  1890. }
  1891. const state = {
  1892. prefix,
  1893. input,
  1894. start,
  1895. base,
  1896. glob,
  1897. isBrace,
  1898. isBracket,
  1899. isGlob,
  1900. isExtglob,
  1901. isGlobstar,
  1902. negated,
  1903. negatedExtglob
  1904. };
  1905. if (opts.tokens === true) {
  1906. state.maxDepth = 0;
  1907. if (!isPathSeparator(code)) tokens.push(token);
  1908. state.tokens = tokens;
  1909. }
  1910. if (opts.parts === true || opts.tokens === true) {
  1911. let prevIndex;
  1912. for (let idx = 0; idx < slashes.length; idx++) {
  1913. const n = prevIndex ? prevIndex + 1 : start;
  1914. const i = slashes[idx];
  1915. const value = input.slice(n, i);
  1916. if (opts.tokens) {
  1917. if (idx === 0 && start !== 0) {
  1918. tokens[idx].isPrefix = true;
  1919. tokens[idx].value = prefix;
  1920. } else tokens[idx].value = value;
  1921. depth(tokens[idx]);
  1922. state.maxDepth += tokens[idx].depth;
  1923. }
  1924. if (idx !== 0 || value !== "") parts.push(value);
  1925. prevIndex = i;
  1926. }
  1927. if (prevIndex && prevIndex + 1 < input.length) {
  1928. const value = input.slice(prevIndex + 1);
  1929. parts.push(value);
  1930. if (opts.tokens) {
  1931. tokens[tokens.length - 1].value = value;
  1932. depth(tokens[tokens.length - 1]);
  1933. state.maxDepth += tokens[tokens.length - 1].depth;
  1934. }
  1935. }
  1936. state.slashes = slashes;
  1937. state.parts = parts;
  1938. }
  1939. return state;
  1940. };
  1941. module.exports = scan;
  1942. }));
  1943. //#endregion
  1944. //#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/parse.js
  1945. var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  1946. const constants = require_constants$1();
  1947. const utils = require_utils$2();
  1948. /**
  1949. * Constants
  1950. */
  1951. const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants;
  1952. /**
  1953. * Helpers
  1954. */
  1955. const expandRange = (args, options) => {
  1956. if (typeof options.expandRange === "function") return options.expandRange(...args, options);
  1957. args.sort();
  1958. const value = `[${args.join("-")}]`;
  1959. try {
  1960. new RegExp(value);
  1961. } catch (ex) {
  1962. return args.map((v) => utils.escapeRegex(v)).join("..");
  1963. }
  1964. return value;
  1965. };
  1966. /**
  1967. * Create the message for a syntax error
  1968. */
  1969. const syntaxError = (type, char) => {
  1970. return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
  1971. };
  1972. /**
  1973. * Parse the given input string.
  1974. * @param {String} input
  1975. * @param {Object} options
  1976. * @return {Object}
  1977. */
  1978. const parse = (input, options) => {
  1979. if (typeof input !== "string") throw new TypeError("Expected a string");
  1980. input = REPLACEMENTS[input] || input;
  1981. const opts = { ...options };
  1982. const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
  1983. let len = input.length;
  1984. if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
  1985. const bos = {
  1986. type: "bos",
  1987. value: "",
  1988. output: opts.prepend || ""
  1989. };
  1990. const tokens = [bos];
  1991. const capture = opts.capture ? "" : "?:";
  1992. const win32 = utils.isWindows(options);
  1993. const PLATFORM_CHARS = constants.globChars(win32);
  1994. const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
  1995. const { DOT_LITERAL, PLUS_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK, QMARK_NO_DOT, STAR, START_ANCHOR } = PLATFORM_CHARS;
  1996. const globstar = (opts) => {
  1997. return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
  1998. };
  1999. const nodot = opts.dot ? "" : NO_DOT;
  2000. const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
  2001. let star = opts.bash === true ? globstar(opts) : STAR;
  2002. if (opts.capture) star = `(${star})`;
  2003. if (typeof opts.noext === "boolean") opts.noextglob = opts.noext;
  2004. const state = {
  2005. input,
  2006. index: -1,
  2007. start: 0,
  2008. dot: opts.dot === true,
  2009. consumed: "",
  2010. output: "",
  2011. prefix: "",
  2012. backtrack: false,
  2013. negated: false,
  2014. brackets: 0,
  2015. braces: 0,
  2016. parens: 0,
  2017. quotes: 0,
  2018. globstar: false,
  2019. tokens
  2020. };
  2021. input = utils.removePrefix(input, state);
  2022. len = input.length;
  2023. const extglobs = [];
  2024. const braces = [];
  2025. const stack = [];
  2026. let prev = bos;
  2027. let value;
  2028. /**
  2029. * Tokenizing helpers
  2030. */
  2031. const eos = () => state.index === len - 1;
  2032. const peek = state.peek = (n = 1) => input[state.index + n];
  2033. const advance = state.advance = () => input[++state.index] || "";
  2034. const remaining = () => input.slice(state.index + 1);
  2035. const consume = (value = "", num = 0) => {
  2036. state.consumed += value;
  2037. state.index += num;
  2038. };
  2039. const append = (token) => {
  2040. state.output += token.output != null ? token.output : token.value;
  2041. consume(token.value);
  2042. };
  2043. const negate = () => {
  2044. let count = 1;
  2045. while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
  2046. advance();
  2047. state.start++;
  2048. count++;
  2049. }
  2050. if (count % 2 === 0) return false;
  2051. state.negated = true;
  2052. state.start++;
  2053. return true;
  2054. };
  2055. const increment = (type) => {
  2056. state[type]++;
  2057. stack.push(type);
  2058. };
  2059. const decrement = (type) => {
  2060. state[type]--;
  2061. stack.pop();
  2062. };
  2063. /**
  2064. * Push tokens onto the tokens array. This helper speeds up
  2065. * tokenizing by 1) helping us avoid backtracking as much as possible,
  2066. * and 2) helping us avoid creating extra tokens when consecutive
  2067. * characters are plain text. This improves performance and simplifies
  2068. * lookbehinds.
  2069. */
  2070. const push = (tok) => {
  2071. if (prev.type === "globstar") {
  2072. const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
  2073. const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
  2074. if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
  2075. state.output = state.output.slice(0, -prev.output.length);
  2076. prev.type = "star";
  2077. prev.value = "*";
  2078. prev.output = star;
  2079. state.output += prev.output;
  2080. }
  2081. }
  2082. if (extglobs.length && tok.type !== "paren") extglobs[extglobs.length - 1].inner += tok.value;
  2083. if (tok.value || tok.output) append(tok);
  2084. if (prev && prev.type === "text" && tok.type === "text") {
  2085. prev.value += tok.value;
  2086. prev.output = (prev.output || "") + tok.value;
  2087. return;
  2088. }
  2089. tok.prev = prev;
  2090. tokens.push(tok);
  2091. prev = tok;
  2092. };
  2093. const extglobOpen = (type, value) => {
  2094. const token = {
  2095. ...EXTGLOB_CHARS[value],
  2096. conditions: 1,
  2097. inner: ""
  2098. };
  2099. token.prev = prev;
  2100. token.parens = state.parens;
  2101. token.output = state.output;
  2102. const output = (opts.capture ? "(" : "") + token.open;
  2103. increment("parens");
  2104. push({
  2105. type,
  2106. value,
  2107. output: state.output ? "" : ONE_CHAR
  2108. });
  2109. push({
  2110. type: "paren",
  2111. extglob: true,
  2112. value: advance(),
  2113. output
  2114. });
  2115. extglobs.push(token);
  2116. };
  2117. const extglobClose = (token) => {
  2118. let output = token.close + (opts.capture ? ")" : "");
  2119. let rest;
  2120. if (token.type === "negate") {
  2121. let extglobStar = star;
  2122. if (token.inner && token.inner.length > 1 && token.inner.includes("/")) extglobStar = globstar(opts);
  2123. if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
  2124. if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) output = token.close = `)${parse(rest, {
  2125. ...options,
  2126. fastpaths: false
  2127. }).output})${extglobStar})`;
  2128. if (token.prev.type === "bos") state.negatedExtglob = true;
  2129. }
  2130. push({
  2131. type: "paren",
  2132. extglob: true,
  2133. value,
  2134. output
  2135. });
  2136. decrement("parens");
  2137. };
  2138. /**
  2139. * Fast paths
  2140. */
  2141. if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
  2142. let backslashes = false;
  2143. let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
  2144. if (first === "\\") {
  2145. backslashes = true;
  2146. return m;
  2147. }
  2148. if (first === "?") {
  2149. if (esc) return esc + first + (rest ? QMARK.repeat(rest.length) : "");
  2150. if (index === 0) return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
  2151. return QMARK.repeat(chars.length);
  2152. }
  2153. if (first === ".") return DOT_LITERAL.repeat(chars.length);
  2154. if (first === "*") {
  2155. if (esc) return esc + first + (rest ? star : "");
  2156. return star;
  2157. }
  2158. return esc ? m : `\\${m}`;
  2159. });
  2160. if (backslashes === true) if (opts.unescape === true) output = output.replace(/\\/g, "");
  2161. else output = output.replace(/\\+/g, (m) => {
  2162. return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
  2163. });
  2164. if (output === input && opts.contains === true) {
  2165. state.output = input;
  2166. return state;
  2167. }
  2168. state.output = utils.wrapOutput(output, state, options);
  2169. return state;
  2170. }
  2171. /**
  2172. * Tokenize input until we reach end-of-string
  2173. */
  2174. while (!eos()) {
  2175. value = advance();
  2176. if (value === "\0") continue;
  2177. /**
  2178. * Escaped characters
  2179. */
  2180. if (value === "\\") {
  2181. const next = peek();
  2182. if (next === "/" && opts.bash !== true) continue;
  2183. if (next === "." || next === ";") continue;
  2184. if (!next) {
  2185. value += "\\";
  2186. push({
  2187. type: "text",
  2188. value
  2189. });
  2190. continue;
  2191. }
  2192. const match = /^\\+/.exec(remaining());
  2193. let slashes = 0;
  2194. if (match && match[0].length > 2) {
  2195. slashes = match[0].length;
  2196. state.index += slashes;
  2197. if (slashes % 2 !== 0) value += "\\";
  2198. }
  2199. if (opts.unescape === true) value = advance();
  2200. else value += advance();
  2201. if (state.brackets === 0) {
  2202. push({
  2203. type: "text",
  2204. value
  2205. });
  2206. continue;
  2207. }
  2208. }
  2209. /**
  2210. * If we're inside a regex character class, continue
  2211. * until we reach the closing bracket.
  2212. */
  2213. if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
  2214. if (opts.posix !== false && value === ":") {
  2215. const inner = prev.value.slice(1);
  2216. if (inner.includes("[")) {
  2217. prev.posix = true;
  2218. if (inner.includes(":")) {
  2219. const idx = prev.value.lastIndexOf("[");
  2220. const pre = prev.value.slice(0, idx);
  2221. const posix = POSIX_REGEX_SOURCE[prev.value.slice(idx + 2)];
  2222. if (posix) {
  2223. prev.value = pre + posix;
  2224. state.backtrack = true;
  2225. advance();
  2226. if (!bos.output && tokens.indexOf(prev) === 1) bos.output = ONE_CHAR;
  2227. continue;
  2228. }
  2229. }
  2230. }
  2231. }
  2232. if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") value = `\\${value}`;
  2233. if (value === "]" && (prev.value === "[" || prev.value === "[^")) value = `\\${value}`;
  2234. if (opts.posix === true && value === "!" && prev.value === "[") value = "^";
  2235. prev.value += value;
  2236. append({ value });
  2237. continue;
  2238. }
  2239. /**
  2240. * If we're inside a quoted string, continue
  2241. * until we reach the closing double quote.
  2242. */
  2243. if (state.quotes === 1 && value !== "\"") {
  2244. value = utils.escapeRegex(value);
  2245. prev.value += value;
  2246. append({ value });
  2247. continue;
  2248. }
  2249. /**
  2250. * Double quotes
  2251. */
  2252. if (value === "\"") {
  2253. state.quotes = state.quotes === 1 ? 0 : 1;
  2254. if (opts.keepQuotes === true) push({
  2255. type: "text",
  2256. value
  2257. });
  2258. continue;
  2259. }
  2260. /**
  2261. * Parentheses
  2262. */
  2263. if (value === "(") {
  2264. increment("parens");
  2265. push({
  2266. type: "paren",
  2267. value
  2268. });
  2269. continue;
  2270. }
  2271. if (value === ")") {
  2272. if (state.parens === 0 && opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "("));
  2273. const extglob = extglobs[extglobs.length - 1];
  2274. if (extglob && state.parens === extglob.parens + 1) {
  2275. extglobClose(extglobs.pop());
  2276. continue;
  2277. }
  2278. push({
  2279. type: "paren",
  2280. value,
  2281. output: state.parens ? ")" : "\\)"
  2282. });
  2283. decrement("parens");
  2284. continue;
  2285. }
  2286. /**
  2287. * Square brackets
  2288. */
  2289. if (value === "[") {
  2290. if (opts.nobracket === true || !remaining().includes("]")) {
  2291. if (opts.nobracket !== true && opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
  2292. value = `\\${value}`;
  2293. } else increment("brackets");
  2294. push({
  2295. type: "bracket",
  2296. value
  2297. });
  2298. continue;
  2299. }
  2300. if (value === "]") {
  2301. if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
  2302. push({
  2303. type: "text",
  2304. value,
  2305. output: `\\${value}`
  2306. });
  2307. continue;
  2308. }
  2309. if (state.brackets === 0) {
  2310. if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "["));
  2311. push({
  2312. type: "text",
  2313. value,
  2314. output: `\\${value}`
  2315. });
  2316. continue;
  2317. }
  2318. decrement("brackets");
  2319. const prevValue = prev.value.slice(1);
  2320. if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) value = `/${value}`;
  2321. prev.value += value;
  2322. append({ value });
  2323. if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) continue;
  2324. const escaped = utils.escapeRegex(prev.value);
  2325. state.output = state.output.slice(0, -prev.value.length);
  2326. if (opts.literalBrackets === true) {
  2327. state.output += escaped;
  2328. prev.value = escaped;
  2329. continue;
  2330. }
  2331. prev.value = `(${capture}${escaped}|${prev.value})`;
  2332. state.output += prev.value;
  2333. continue;
  2334. }
  2335. /**
  2336. * Braces
  2337. */
  2338. if (value === "{" && opts.nobrace !== true) {
  2339. increment("braces");
  2340. const open = {
  2341. type: "brace",
  2342. value,
  2343. output: "(",
  2344. outputIndex: state.output.length,
  2345. tokensIndex: state.tokens.length
  2346. };
  2347. braces.push(open);
  2348. push(open);
  2349. continue;
  2350. }
  2351. if (value === "}") {
  2352. const brace = braces[braces.length - 1];
  2353. if (opts.nobrace === true || !brace) {
  2354. push({
  2355. type: "text",
  2356. value,
  2357. output: value
  2358. });
  2359. continue;
  2360. }
  2361. let output = ")";
  2362. if (brace.dots === true) {
  2363. const arr = tokens.slice();
  2364. const range = [];
  2365. for (let i = arr.length - 1; i >= 0; i--) {
  2366. tokens.pop();
  2367. if (arr[i].type === "brace") break;
  2368. if (arr[i].type !== "dots") range.unshift(arr[i].value);
  2369. }
  2370. output = expandRange(range, opts);
  2371. state.backtrack = true;
  2372. }
  2373. if (brace.comma !== true && brace.dots !== true) {
  2374. const out = state.output.slice(0, brace.outputIndex);
  2375. const toks = state.tokens.slice(brace.tokensIndex);
  2376. brace.value = brace.output = "\\{";
  2377. value = output = "\\}";
  2378. state.output = out;
  2379. for (const t of toks) state.output += t.output || t.value;
  2380. }
  2381. push({
  2382. type: "brace",
  2383. value,
  2384. output
  2385. });
  2386. decrement("braces");
  2387. braces.pop();
  2388. continue;
  2389. }
  2390. /**
  2391. * Pipes
  2392. */
  2393. if (value === "|") {
  2394. if (extglobs.length > 0) extglobs[extglobs.length - 1].conditions++;
  2395. push({
  2396. type: "text",
  2397. value
  2398. });
  2399. continue;
  2400. }
  2401. /**
  2402. * Commas
  2403. */
  2404. if (value === ",") {
  2405. let output = value;
  2406. const brace = braces[braces.length - 1];
  2407. if (brace && stack[stack.length - 1] === "braces") {
  2408. brace.comma = true;
  2409. output = "|";
  2410. }
  2411. push({
  2412. type: "comma",
  2413. value,
  2414. output
  2415. });
  2416. continue;
  2417. }
  2418. /**
  2419. * Slashes
  2420. */
  2421. if (value === "/") {
  2422. if (prev.type === "dot" && state.index === state.start + 1) {
  2423. state.start = state.index + 1;
  2424. state.consumed = "";
  2425. state.output = "";
  2426. tokens.pop();
  2427. prev = bos;
  2428. continue;
  2429. }
  2430. push({
  2431. type: "slash",
  2432. value,
  2433. output: SLASH_LITERAL
  2434. });
  2435. continue;
  2436. }
  2437. /**
  2438. * Dots
  2439. */
  2440. if (value === ".") {
  2441. if (state.braces > 0 && prev.type === "dot") {
  2442. if (prev.value === ".") prev.output = DOT_LITERAL;
  2443. const brace = braces[braces.length - 1];
  2444. prev.type = "dots";
  2445. prev.output += value;
  2446. prev.value += value;
  2447. brace.dots = true;
  2448. continue;
  2449. }
  2450. if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
  2451. push({
  2452. type: "text",
  2453. value,
  2454. output: DOT_LITERAL
  2455. });
  2456. continue;
  2457. }
  2458. push({
  2459. type: "dot",
  2460. value,
  2461. output: DOT_LITERAL
  2462. });
  2463. continue;
  2464. }
  2465. /**
  2466. * Question marks
  2467. */
  2468. if (value === "?") {
  2469. if (!(prev && prev.value === "(") && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
  2470. extglobOpen("qmark", value);
  2471. continue;
  2472. }
  2473. if (prev && prev.type === "paren") {
  2474. const next = peek();
  2475. let output = value;
  2476. if (next === "<" && !utils.supportsLookbehinds()) throw new Error("Node.js v10 or higher is required for regex lookbehinds");
  2477. if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) output = `\\${value}`;
  2478. push({
  2479. type: "text",
  2480. value,
  2481. output
  2482. });
  2483. continue;
  2484. }
  2485. if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
  2486. push({
  2487. type: "qmark",
  2488. value,
  2489. output: QMARK_NO_DOT
  2490. });
  2491. continue;
  2492. }
  2493. push({
  2494. type: "qmark",
  2495. value,
  2496. output: QMARK
  2497. });
  2498. continue;
  2499. }
  2500. /**
  2501. * Exclamation
  2502. */
  2503. if (value === "!") {
  2504. if (opts.noextglob !== true && peek() === "(") {
  2505. if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
  2506. extglobOpen("negate", value);
  2507. continue;
  2508. }
  2509. }
  2510. if (opts.nonegate !== true && state.index === 0) {
  2511. negate();
  2512. continue;
  2513. }
  2514. }
  2515. /**
  2516. * Plus
  2517. */
  2518. if (value === "+") {
  2519. if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
  2520. extglobOpen("plus", value);
  2521. continue;
  2522. }
  2523. if (prev && prev.value === "(" || opts.regex === false) {
  2524. push({
  2525. type: "plus",
  2526. value,
  2527. output: PLUS_LITERAL
  2528. });
  2529. continue;
  2530. }
  2531. if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
  2532. push({
  2533. type: "plus",
  2534. value
  2535. });
  2536. continue;
  2537. }
  2538. push({
  2539. type: "plus",
  2540. value: PLUS_LITERAL
  2541. });
  2542. continue;
  2543. }
  2544. /**
  2545. * Plain text
  2546. */
  2547. if (value === "@") {
  2548. if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
  2549. push({
  2550. type: "at",
  2551. extglob: true,
  2552. value,
  2553. output: ""
  2554. });
  2555. continue;
  2556. }
  2557. push({
  2558. type: "text",
  2559. value
  2560. });
  2561. continue;
  2562. }
  2563. /**
  2564. * Plain text
  2565. */
  2566. if (value !== "*") {
  2567. if (value === "$" || value === "^") value = `\\${value}`;
  2568. const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
  2569. if (match) {
  2570. value += match[0];
  2571. state.index += match[0].length;
  2572. }
  2573. push({
  2574. type: "text",
  2575. value
  2576. });
  2577. continue;
  2578. }
  2579. /**
  2580. * Stars
  2581. */
  2582. if (prev && (prev.type === "globstar" || prev.star === true)) {
  2583. prev.type = "star";
  2584. prev.star = true;
  2585. prev.value += value;
  2586. prev.output = star;
  2587. state.backtrack = true;
  2588. state.globstar = true;
  2589. consume(value);
  2590. continue;
  2591. }
  2592. let rest = remaining();
  2593. if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
  2594. extglobOpen("star", value);
  2595. continue;
  2596. }
  2597. if (prev.type === "star") {
  2598. if (opts.noglobstar === true) {
  2599. consume(value);
  2600. continue;
  2601. }
  2602. const prior = prev.prev;
  2603. const before = prior.prev;
  2604. const isStart = prior.type === "slash" || prior.type === "bos";
  2605. const afterStar = before && (before.type === "star" || before.type === "globstar");
  2606. if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
  2607. push({
  2608. type: "star",
  2609. value,
  2610. output: ""
  2611. });
  2612. continue;
  2613. }
  2614. const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
  2615. const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
  2616. if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
  2617. push({
  2618. type: "star",
  2619. value,
  2620. output: ""
  2621. });
  2622. continue;
  2623. }
  2624. while (rest.slice(0, 3) === "/**") {
  2625. const after = input[state.index + 4];
  2626. if (after && after !== "/") break;
  2627. rest = rest.slice(3);
  2628. consume("/**", 3);
  2629. }
  2630. if (prior.type === "bos" && eos()) {
  2631. prev.type = "globstar";
  2632. prev.value += value;
  2633. prev.output = globstar(opts);
  2634. state.output = prev.output;
  2635. state.globstar = true;
  2636. consume(value);
  2637. continue;
  2638. }
  2639. if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
  2640. state.output = state.output.slice(0, -(prior.output + prev.output).length);
  2641. prior.output = `(?:${prior.output}`;
  2642. prev.type = "globstar";
  2643. prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
  2644. prev.value += value;
  2645. state.globstar = true;
  2646. state.output += prior.output + prev.output;
  2647. consume(value);
  2648. continue;
  2649. }
  2650. if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
  2651. const end = rest[1] !== void 0 ? "|$" : "";
  2652. state.output = state.output.slice(0, -(prior.output + prev.output).length);
  2653. prior.output = `(?:${prior.output}`;
  2654. prev.type = "globstar";
  2655. prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
  2656. prev.value += value;
  2657. state.output += prior.output + prev.output;
  2658. state.globstar = true;
  2659. consume(value + advance());
  2660. push({
  2661. type: "slash",
  2662. value: "/",
  2663. output: ""
  2664. });
  2665. continue;
  2666. }
  2667. if (prior.type === "bos" && rest[0] === "/") {
  2668. prev.type = "globstar";
  2669. prev.value += value;
  2670. prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
  2671. state.output = prev.output;
  2672. state.globstar = true;
  2673. consume(value + advance());
  2674. push({
  2675. type: "slash",
  2676. value: "/",
  2677. output: ""
  2678. });
  2679. continue;
  2680. }
  2681. state.output = state.output.slice(0, -prev.output.length);
  2682. prev.type = "globstar";
  2683. prev.output = globstar(opts);
  2684. prev.value += value;
  2685. state.output += prev.output;
  2686. state.globstar = true;
  2687. consume(value);
  2688. continue;
  2689. }
  2690. const token = {
  2691. type: "star",
  2692. value,
  2693. output: star
  2694. };
  2695. if (opts.bash === true) {
  2696. token.output = ".*?";
  2697. if (prev.type === "bos" || prev.type === "slash") token.output = nodot + token.output;
  2698. push(token);
  2699. continue;
  2700. }
  2701. if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
  2702. token.output = value;
  2703. push(token);
  2704. continue;
  2705. }
  2706. if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
  2707. if (prev.type === "dot") {
  2708. state.output += NO_DOT_SLASH;
  2709. prev.output += NO_DOT_SLASH;
  2710. } else if (opts.dot === true) {
  2711. state.output += NO_DOTS_SLASH;
  2712. prev.output += NO_DOTS_SLASH;
  2713. } else {
  2714. state.output += nodot;
  2715. prev.output += nodot;
  2716. }
  2717. if (peek() !== "*") {
  2718. state.output += ONE_CHAR;
  2719. prev.output += ONE_CHAR;
  2720. }
  2721. }
  2722. push(token);
  2723. }
  2724. while (state.brackets > 0) {
  2725. if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
  2726. state.output = utils.escapeLast(state.output, "[");
  2727. decrement("brackets");
  2728. }
  2729. while (state.parens > 0) {
  2730. if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
  2731. state.output = utils.escapeLast(state.output, "(");
  2732. decrement("parens");
  2733. }
  2734. while (state.braces > 0) {
  2735. if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
  2736. state.output = utils.escapeLast(state.output, "{");
  2737. decrement("braces");
  2738. }
  2739. if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) push({
  2740. type: "maybe_slash",
  2741. value: "",
  2742. output: `${SLASH_LITERAL}?`
  2743. });
  2744. if (state.backtrack === true) {
  2745. state.output = "";
  2746. for (const token of state.tokens) {
  2747. state.output += token.output != null ? token.output : token.value;
  2748. if (token.suffix) state.output += token.suffix;
  2749. }
  2750. }
  2751. return state;
  2752. };
  2753. /**
  2754. * Fast paths for creating regular expressions for common glob patterns.
  2755. * This can significantly speed up processing and has very little downside
  2756. * impact when none of the fast paths match.
  2757. */
  2758. parse.fastpaths = (input, options) => {
  2759. const opts = { ...options };
  2760. const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
  2761. const len = input.length;
  2762. if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
  2763. input = REPLACEMENTS[input] || input;
  2764. const win32 = utils.isWindows(options);
  2765. const { DOT_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR } = constants.globChars(win32);
  2766. const nodot = opts.dot ? NO_DOTS : NO_DOT;
  2767. const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
  2768. const capture = opts.capture ? "" : "?:";
  2769. const state = {
  2770. negated: false,
  2771. prefix: ""
  2772. };
  2773. let star = opts.bash === true ? ".*?" : STAR;
  2774. if (opts.capture) star = `(${star})`;
  2775. const globstar = (opts) => {
  2776. if (opts.noglobstar === true) return star;
  2777. return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
  2778. };
  2779. const create = (str) => {
  2780. switch (str) {
  2781. case "*": return `${nodot}${ONE_CHAR}${star}`;
  2782. case ".*": return `${DOT_LITERAL}${ONE_CHAR}${star}`;
  2783. case "*.*": return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
  2784. case "*/*": return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
  2785. case "**": return nodot + globstar(opts);
  2786. case "**/*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
  2787. case "**/*.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
  2788. case "**/.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
  2789. default: {
  2790. const match = /^(.*?)\.(\w+)$/.exec(str);
  2791. if (!match) return;
  2792. const source = create(match[1]);
  2793. if (!source) return;
  2794. return source + DOT_LITERAL + match[2];
  2795. }
  2796. }
  2797. };
  2798. let source = create(utils.removePrefix(input, state));
  2799. if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL}?`;
  2800. return source;
  2801. };
  2802. module.exports = parse;
  2803. }));
  2804. //#endregion
  2805. //#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js
  2806. var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  2807. const path$6 = __require("path");
  2808. const scan = require_scan();
  2809. const parse = require_parse();
  2810. const utils = require_utils$2();
  2811. const constants = require_constants$1();
  2812. const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
  2813. /**
  2814. * Creates a matcher function from one or more glob patterns. The
  2815. * returned function takes a string to match as its first argument,
  2816. * and returns true if the string is a match. The returned matcher
  2817. * function also takes a boolean as the second argument that, when true,
  2818. * returns an object with additional information.
  2819. *
  2820. * ```js
  2821. * const picomatch = require('picomatch');
  2822. * // picomatch(glob[, options]);
  2823. *
  2824. * const isMatch = picomatch('*.!(*a)');
  2825. * console.log(isMatch('a.a')); //=> false
  2826. * console.log(isMatch('a.b')); //=> true
  2827. * ```
  2828. * @name picomatch
  2829. * @param {String|Array} `globs` One or more glob patterns.
  2830. * @param {Object=} `options`
  2831. * @return {Function=} Returns a matcher function.
  2832. * @api public
  2833. */
  2834. const picomatch = (glob, options, returnState = false) => {
  2835. if (Array.isArray(glob)) {
  2836. const fns = glob.map((input) => picomatch(input, options, returnState));
  2837. const arrayMatcher = (str) => {
  2838. for (const isMatch of fns) {
  2839. const state = isMatch(str);
  2840. if (state) return state;
  2841. }
  2842. return false;
  2843. };
  2844. return arrayMatcher;
  2845. }
  2846. const isState = isObject(glob) && glob.tokens && glob.input;
  2847. if (glob === "" || typeof glob !== "string" && !isState) throw new TypeError("Expected pattern to be a non-empty string");
  2848. const opts = options || {};
  2849. const posix = utils.isWindows(options);
  2850. const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
  2851. const state = regex.state;
  2852. delete regex.state;
  2853. let isIgnored = () => false;
  2854. if (opts.ignore) {
  2855. const ignoreOpts = {
  2856. ...options,
  2857. ignore: null,
  2858. onMatch: null,
  2859. onResult: null
  2860. };
  2861. isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
  2862. }
  2863. const matcher = (input, returnObject = false) => {
  2864. const { isMatch, match, output } = picomatch.test(input, regex, options, {
  2865. glob,
  2866. posix
  2867. });
  2868. const result = {
  2869. glob,
  2870. state,
  2871. regex,
  2872. posix,
  2873. input,
  2874. output,
  2875. match,
  2876. isMatch
  2877. };
  2878. if (typeof opts.onResult === "function") opts.onResult(result);
  2879. if (isMatch === false) {
  2880. result.isMatch = false;
  2881. return returnObject ? result : false;
  2882. }
  2883. if (isIgnored(input)) {
  2884. if (typeof opts.onIgnore === "function") opts.onIgnore(result);
  2885. result.isMatch = false;
  2886. return returnObject ? result : false;
  2887. }
  2888. if (typeof opts.onMatch === "function") opts.onMatch(result);
  2889. return returnObject ? result : true;
  2890. };
  2891. if (returnState) matcher.state = state;
  2892. return matcher;
  2893. };
  2894. /**
  2895. * Test `input` with the given `regex`. This is used by the main
  2896. * `picomatch()` function to test the input string.
  2897. *
  2898. * ```js
  2899. * const picomatch = require('picomatch');
  2900. * // picomatch.test(input, regex[, options]);
  2901. *
  2902. * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
  2903. * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
  2904. * ```
  2905. * @param {String} `input` String to test.
  2906. * @param {RegExp} `regex`
  2907. * @return {Object} Returns an object with matching info.
  2908. * @api public
  2909. */
  2910. picomatch.test = (input, regex, options, { glob, posix } = {}) => {
  2911. if (typeof input !== "string") throw new TypeError("Expected input to be a string");
  2912. if (input === "") return {
  2913. isMatch: false,
  2914. output: ""
  2915. };
  2916. const opts = options || {};
  2917. const format = opts.format || (posix ? utils.toPosixSlashes : null);
  2918. let match = input === glob;
  2919. let output = match && format ? format(input) : input;
  2920. if (match === false) {
  2921. output = format ? format(input) : input;
  2922. match = output === glob;
  2923. }
  2924. if (match === false || opts.capture === true) if (opts.matchBase === true || opts.basename === true) match = picomatch.matchBase(input, regex, options, posix);
  2925. else match = regex.exec(output);
  2926. return {
  2927. isMatch: Boolean(match),
  2928. match,
  2929. output
  2930. };
  2931. };
  2932. /**
  2933. * Match the basename of a filepath.
  2934. *
  2935. * ```js
  2936. * const picomatch = require('picomatch');
  2937. * // picomatch.matchBase(input, glob[, options]);
  2938. * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
  2939. * ```
  2940. * @param {String} `input` String to test.
  2941. * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
  2942. * @return {Boolean}
  2943. * @api public
  2944. */
  2945. picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
  2946. return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(path$6.basename(input));
  2947. };
  2948. /**
  2949. * Returns true if **any** of the given glob `patterns` match the specified `string`.
  2950. *
  2951. * ```js
  2952. * const picomatch = require('picomatch');
  2953. * // picomatch.isMatch(string, patterns[, options]);
  2954. *
  2955. * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
  2956. * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
  2957. * ```
  2958. * @param {String|Array} str The string to test.
  2959. * @param {String|Array} patterns One or more glob patterns to use for matching.
  2960. * @param {Object} [options] See available [options](#options).
  2961. * @return {Boolean} Returns true if any patterns match `str`
  2962. * @api public
  2963. */
  2964. picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
  2965. /**
  2966. * Parse a glob pattern to create the source string for a regular
  2967. * expression.
  2968. *
  2969. * ```js
  2970. * const picomatch = require('picomatch');
  2971. * const result = picomatch.parse(pattern[, options]);
  2972. * ```
  2973. * @param {String} `pattern`
  2974. * @param {Object} `options`
  2975. * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
  2976. * @api public
  2977. */
  2978. picomatch.parse = (pattern, options) => {
  2979. if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
  2980. return parse(pattern, {
  2981. ...options,
  2982. fastpaths: false
  2983. });
  2984. };
  2985. /**
  2986. * Scan a glob pattern to separate the pattern into segments.
  2987. *
  2988. * ```js
  2989. * const picomatch = require('picomatch');
  2990. * // picomatch.scan(input[, options]);
  2991. *
  2992. * const result = picomatch.scan('!./foo/*.js');
  2993. * console.log(result);
  2994. * { prefix: '!./',
  2995. * input: '!./foo/*.js',
  2996. * start: 3,
  2997. * base: 'foo',
  2998. * glob: '*.js',
  2999. * isBrace: false,
  3000. * isBracket: false,
  3001. * isGlob: true,
  3002. * isExtglob: false,
  3003. * isGlobstar: false,
  3004. * negated: true }
  3005. * ```
  3006. * @param {String} `input` Glob pattern to scan.
  3007. * @param {Object} `options`
  3008. * @return {Object} Returns an object with
  3009. * @api public
  3010. */
  3011. picomatch.scan = (input, options) => scan(input, options);
  3012. /**
  3013. * Compile a regular expression from the `state` object returned by the
  3014. * [parse()](#parse) method.
  3015. *
  3016. * @param {Object} `state`
  3017. * @param {Object} `options`
  3018. * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
  3019. * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
  3020. * @return {RegExp}
  3021. * @api public
  3022. */
  3023. picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
  3024. if (returnOutput === true) return state.output;
  3025. const opts = options || {};
  3026. const prepend = opts.contains ? "" : "^";
  3027. const append = opts.contains ? "" : "$";
  3028. let source = `${prepend}(?:${state.output})${append}`;
  3029. if (state && state.negated === true) source = `^(?!${source}).*$`;
  3030. const regex = picomatch.toRegex(source, options);
  3031. if (returnState === true) regex.state = state;
  3032. return regex;
  3033. };
  3034. /**
  3035. * Create a regular expression from a parsed glob pattern.
  3036. *
  3037. * ```js
  3038. * const picomatch = require('picomatch');
  3039. * const state = picomatch.parse('*.js');
  3040. * // picomatch.compileRe(state[, options]);
  3041. *
  3042. * console.log(picomatch.compileRe(state));
  3043. * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
  3044. * ```
  3045. * @param {String} `state` The object returned from the `.parse` method.
  3046. * @param {Object} `options`
  3047. * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
  3048. * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
  3049. * @return {RegExp} Returns a regex created from the given pattern.
  3050. * @api public
  3051. */
  3052. picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
  3053. if (!input || typeof input !== "string") throw new TypeError("Expected a non-empty string");
  3054. let parsed = {
  3055. negated: false,
  3056. fastpaths: true
  3057. };
  3058. if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) parsed.output = parse.fastpaths(input, options);
  3059. if (!parsed.output) parsed = parse(input, options);
  3060. return picomatch.compileRe(parsed, options, returnOutput, returnState);
  3061. };
  3062. /**
  3063. * Create a regular expression from the given regex source string.
  3064. *
  3065. * ```js
  3066. * const picomatch = require('picomatch');
  3067. * // picomatch.toRegex(source[, options]);
  3068. *
  3069. * const { output } = picomatch.parse('*.js');
  3070. * console.log(picomatch.toRegex(output));
  3071. * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
  3072. * ```
  3073. * @param {String} `source` Regular expression source string.
  3074. * @param {Object} `options`
  3075. * @return {RegExp}
  3076. * @api public
  3077. */
  3078. picomatch.toRegex = (source, options) => {
  3079. try {
  3080. const opts = options || {};
  3081. return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
  3082. } catch (err) {
  3083. if (options && options.debug === true) throw err;
  3084. return /$^/;
  3085. }
  3086. };
  3087. /**
  3088. * Picomatch constants.
  3089. * @return {Object}
  3090. */
  3091. picomatch.constants = constants;
  3092. /**
  3093. * Expose "picomatch"
  3094. */
  3095. module.exports = picomatch;
  3096. }));
  3097. //#endregion
  3098. //#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/index.js
  3099. var require_picomatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  3100. module.exports = require_picomatch$1();
  3101. }));
  3102. //#endregion
  3103. //#region ../../node_modules/.pnpm/micromatch@4.0.8/node_modules/micromatch/index.js
  3104. var require_micromatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  3105. const util = __require("util");
  3106. const braces = require_braces();
  3107. const picomatch = require_picomatch();
  3108. const utils = require_utils$2();
  3109. const isEmptyString = (v) => v === "" || v === "./";
  3110. const hasBraces = (v) => {
  3111. const index = v.indexOf("{");
  3112. return index > -1 && v.indexOf("}", index) > -1;
  3113. };
  3114. /**
  3115. * Returns an array of strings that match one or more glob patterns.
  3116. *
  3117. * ```js
  3118. * const mm = require('micromatch');
  3119. * // mm(list, patterns[, options]);
  3120. *
  3121. * console.log(mm(['a.js', 'a.txt'], ['*.js']));
  3122. * //=> [ 'a.js' ]
  3123. * ```
  3124. * @param {String|Array<string>} `list` List of strings to match.
  3125. * @param {String|Array<string>} `patterns` One or more glob patterns to use for matching.
  3126. * @param {Object} `options` See available [options](#options)
  3127. * @return {Array} Returns an array of matches
  3128. * @summary false
  3129. * @api public
  3130. */
  3131. const micromatch = (list, patterns, options) => {
  3132. patterns = [].concat(patterns);
  3133. list = [].concat(list);
  3134. let omit = /* @__PURE__ */ new Set();
  3135. let keep = /* @__PURE__ */ new Set();
  3136. let items = /* @__PURE__ */ new Set();
  3137. let negatives = 0;
  3138. let onResult = (state) => {
  3139. items.add(state.output);
  3140. if (options && options.onResult) options.onResult(state);
  3141. };
  3142. for (let i = 0; i < patterns.length; i++) {
  3143. let isMatch = picomatch(String(patterns[i]), {
  3144. ...options,
  3145. onResult
  3146. }, true);
  3147. let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
  3148. if (negated) negatives++;
  3149. for (let item of list) {
  3150. let matched = isMatch(item, true);
  3151. if (!(negated ? !matched.isMatch : matched.isMatch)) continue;
  3152. if (negated) omit.add(matched.output);
  3153. else {
  3154. omit.delete(matched.output);
  3155. keep.add(matched.output);
  3156. }
  3157. }
  3158. }
  3159. let matches = (negatives === patterns.length ? [...items] : [...keep]).filter((item) => !omit.has(item));
  3160. if (options && matches.length === 0) {
  3161. if (options.failglob === true) throw new Error(`No matches found for "${patterns.join(", ")}"`);
  3162. if (options.nonull === true || options.nullglob === true) return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
  3163. }
  3164. return matches;
  3165. };
  3166. /**
  3167. * Backwards compatibility
  3168. */
  3169. micromatch.match = micromatch;
  3170. /**
  3171. * Returns a matcher function from the given glob `pattern` and `options`.
  3172. * The returned function takes a string to match as its only argument and returns
  3173. * true if the string is a match.
  3174. *
  3175. * ```js
  3176. * const mm = require('micromatch');
  3177. * // mm.matcher(pattern[, options]);
  3178. *
  3179. * const isMatch = mm.matcher('*.!(*a)');
  3180. * console.log(isMatch('a.a')); //=> false
  3181. * console.log(isMatch('a.b')); //=> true
  3182. * ```
  3183. * @param {String} `pattern` Glob pattern
  3184. * @param {Object} `options`
  3185. * @return {Function} Returns a matcher function.
  3186. * @api public
  3187. */
  3188. micromatch.matcher = (pattern, options) => picomatch(pattern, options);
  3189. /**
  3190. * Returns true if **any** of the given glob `patterns` match the specified `string`.
  3191. *
  3192. * ```js
  3193. * const mm = require('micromatch');
  3194. * // mm.isMatch(string, patterns[, options]);
  3195. *
  3196. * console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true
  3197. * console.log(mm.isMatch('a.a', 'b.*')); //=> false
  3198. * ```
  3199. * @param {String} `str` The string to test.
  3200. * @param {String|Array} `patterns` One or more glob patterns to use for matching.
  3201. * @param {Object} `[options]` See available [options](#options).
  3202. * @return {Boolean} Returns true if any patterns match `str`
  3203. * @api public
  3204. */
  3205. micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
  3206. /**
  3207. * Backwards compatibility
  3208. */
  3209. micromatch.any = micromatch.isMatch;
  3210. /**
  3211. * Returns a list of strings that _**do not match any**_ of the given `patterns`.
  3212. *
  3213. * ```js
  3214. * const mm = require('micromatch');
  3215. * // mm.not(list, patterns[, options]);
  3216. *
  3217. * console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a'));
  3218. * //=> ['b.b', 'c.c']
  3219. * ```
  3220. * @param {Array} `list` Array of strings to match.
  3221. * @param {String|Array} `patterns` One or more glob pattern to use for matching.
  3222. * @param {Object} `options` See available [options](#options) for changing how matches are performed
  3223. * @return {Array} Returns an array of strings that **do not match** the given patterns.
  3224. * @api public
  3225. */
  3226. micromatch.not = (list, patterns, options = {}) => {
  3227. patterns = [].concat(patterns).map(String);
  3228. let result = /* @__PURE__ */ new Set();
  3229. let items = [];
  3230. let onResult = (state) => {
  3231. if (options.onResult) options.onResult(state);
  3232. items.push(state.output);
  3233. };
  3234. let matches = new Set(micromatch(list, patterns, {
  3235. ...options,
  3236. onResult
  3237. }));
  3238. for (let item of items) if (!matches.has(item)) result.add(item);
  3239. return [...result];
  3240. };
  3241. /**
  3242. * Returns true if the given `string` contains the given pattern. Similar
  3243. * to [.isMatch](#isMatch) but the pattern can match any part of the string.
  3244. *
  3245. * ```js
  3246. * var mm = require('micromatch');
  3247. * // mm.contains(string, pattern[, options]);
  3248. *
  3249. * console.log(mm.contains('aa/bb/cc', '*b'));
  3250. * //=> true
  3251. * console.log(mm.contains('aa/bb/cc', '*d'));
  3252. * //=> false
  3253. * ```
  3254. * @param {String} `str` The string to match.
  3255. * @param {String|Array} `patterns` Glob pattern to use for matching.
  3256. * @param {Object} `options` See available [options](#options) for changing how matches are performed
  3257. * @return {Boolean} Returns true if any of the patterns matches any part of `str`.
  3258. * @api public
  3259. */
  3260. micromatch.contains = (str, pattern, options) => {
  3261. if (typeof str !== "string") throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
  3262. if (Array.isArray(pattern)) return pattern.some((p) => micromatch.contains(str, p, options));
  3263. if (typeof pattern === "string") {
  3264. if (isEmptyString(str) || isEmptyString(pattern)) return false;
  3265. if (str.includes(pattern) || str.startsWith("./") && str.slice(2).includes(pattern)) return true;
  3266. }
  3267. return micromatch.isMatch(str, pattern, {
  3268. ...options,
  3269. contains: true
  3270. });
  3271. };
  3272. /**
  3273. * Filter the keys of the given object with the given `glob` pattern
  3274. * and `options`. Does not attempt to match nested keys. If you need this feature,
  3275. * use [glob-object][] instead.
  3276. *
  3277. * ```js
  3278. * const mm = require('micromatch');
  3279. * // mm.matchKeys(object, patterns[, options]);
  3280. *
  3281. * const obj = { aa: 'a', ab: 'b', ac: 'c' };
  3282. * console.log(mm.matchKeys(obj, '*b'));
  3283. * //=> { ab: 'b' }
  3284. * ```
  3285. * @param {Object} `object` The object with keys to filter.
  3286. * @param {String|Array} `patterns` One or more glob patterns to use for matching.
  3287. * @param {Object} `options` See available [options](#options) for changing how matches are performed
  3288. * @return {Object} Returns an object with only keys that match the given patterns.
  3289. * @api public
  3290. */
  3291. micromatch.matchKeys = (obj, patterns, options) => {
  3292. if (!utils.isObject(obj)) throw new TypeError("Expected the first argument to be an object");
  3293. let keys = micromatch(Object.keys(obj), patterns, options);
  3294. let res = {};
  3295. for (let key of keys) res[key] = obj[key];
  3296. return res;
  3297. };
  3298. /**
  3299. * Returns true if some of the strings in the given `list` match any of the given glob `patterns`.
  3300. *
  3301. * ```js
  3302. * const mm = require('micromatch');
  3303. * // mm.some(list, patterns[, options]);
  3304. *
  3305. * console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
  3306. * // true
  3307. * console.log(mm.some(['foo.js'], ['*.js', '!foo.js']));
  3308. * // false
  3309. * ```
  3310. * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found.
  3311. * @param {String|Array} `patterns` One or more glob patterns to use for matching.
  3312. * @param {Object} `options` See available [options](#options) for changing how matches are performed
  3313. * @return {Boolean} Returns true if any `patterns` matches any of the strings in `list`
  3314. * @api public
  3315. */
  3316. micromatch.some = (list, patterns, options) => {
  3317. let items = [].concat(list);
  3318. for (let pattern of [].concat(patterns)) {
  3319. let isMatch = picomatch(String(pattern), options);
  3320. if (items.some((item) => isMatch(item))) return true;
  3321. }
  3322. return false;
  3323. };
  3324. /**
  3325. * Returns true if every string in the given `list` matches
  3326. * any of the given glob `patterns`.
  3327. *
  3328. * ```js
  3329. * const mm = require('micromatch');
  3330. * // mm.every(list, patterns[, options]);
  3331. *
  3332. * console.log(mm.every('foo.js', ['foo.js']));
  3333. * // true
  3334. * console.log(mm.every(['foo.js', 'bar.js'], ['*.js']));
  3335. * // true
  3336. * console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
  3337. * // false
  3338. * console.log(mm.every(['foo.js'], ['*.js', '!foo.js']));
  3339. * // false
  3340. * ```
  3341. * @param {String|Array} `list` The string or array of strings to test.
  3342. * @param {String|Array} `patterns` One or more glob patterns to use for matching.
  3343. * @param {Object} `options` See available [options](#options) for changing how matches are performed
  3344. * @return {Boolean} Returns true if all `patterns` matches all of the strings in `list`
  3345. * @api public
  3346. */
  3347. micromatch.every = (list, patterns, options) => {
  3348. let items = [].concat(list);
  3349. for (let pattern of [].concat(patterns)) {
  3350. let isMatch = picomatch(String(pattern), options);
  3351. if (!items.every((item) => isMatch(item))) return false;
  3352. }
  3353. return true;
  3354. };
  3355. /**
  3356. * Returns true if **all** of the given `patterns` match
  3357. * the specified string.
  3358. *
  3359. * ```js
  3360. * const mm = require('micromatch');
  3361. * // mm.all(string, patterns[, options]);
  3362. *
  3363. * console.log(mm.all('foo.js', ['foo.js']));
  3364. * // true
  3365. *
  3366. * console.log(mm.all('foo.js', ['*.js', '!foo.js']));
  3367. * // false
  3368. *
  3369. * console.log(mm.all('foo.js', ['*.js', 'foo.js']));
  3370. * // true
  3371. *
  3372. * console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js']));
  3373. * // true
  3374. * ```
  3375. * @param {String|Array} `str` The string to test.
  3376. * @param {String|Array} `patterns` One or more glob patterns to use for matching.
  3377. * @param {Object} `options` See available [options](#options) for changing how matches are performed
  3378. * @return {Boolean} Returns true if any patterns match `str`
  3379. * @api public
  3380. */
  3381. micromatch.all = (str, patterns, options) => {
  3382. if (typeof str !== "string") throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
  3383. return [].concat(patterns).every((p) => picomatch(p, options)(str));
  3384. };
  3385. /**
  3386. * Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match.
  3387. *
  3388. * ```js
  3389. * const mm = require('micromatch');
  3390. * // mm.capture(pattern, string[, options]);
  3391. *
  3392. * console.log(mm.capture('test/*.js', 'test/foo.js'));
  3393. * //=> ['foo']
  3394. * console.log(mm.capture('test/*.js', 'foo/bar.css'));
  3395. * //=> null
  3396. * ```
  3397. * @param {String} `glob` Glob pattern to use for matching.
  3398. * @param {String} `input` String to match
  3399. * @param {Object} `options` See available [options](#options) for changing how matches are performed
  3400. * @return {Array|null} Returns an array of captures if the input matches the glob pattern, otherwise `null`.
  3401. * @api public
  3402. */
  3403. micromatch.capture = (glob, input, options) => {
  3404. let posix = utils.isWindows(options);
  3405. let match = picomatch.makeRe(String(glob), {
  3406. ...options,
  3407. capture: true
  3408. }).exec(posix ? utils.toPosixSlashes(input) : input);
  3409. if (match) return match.slice(1).map((v) => v === void 0 ? "" : v);
  3410. };
  3411. /**
  3412. * Create a regular expression from the given glob `pattern`.
  3413. *
  3414. * ```js
  3415. * const mm = require('micromatch');
  3416. * // mm.makeRe(pattern[, options]);
  3417. *
  3418. * console.log(mm.makeRe('*.js'));
  3419. * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/
  3420. * ```
  3421. * @param {String} `pattern` A glob pattern to convert to regex.
  3422. * @param {Object} `options`
  3423. * @return {RegExp} Returns a regex created from the given pattern.
  3424. * @api public
  3425. */
  3426. micromatch.makeRe = (...args) => picomatch.makeRe(...args);
  3427. /**
  3428. * Scan a glob pattern to separate the pattern into segments. Used
  3429. * by the [split](#split) method.
  3430. *
  3431. * ```js
  3432. * const mm = require('micromatch');
  3433. * const state = mm.scan(pattern[, options]);
  3434. * ```
  3435. * @param {String} `pattern`
  3436. * @param {Object} `options`
  3437. * @return {Object} Returns an object with
  3438. * @api public
  3439. */
  3440. micromatch.scan = (...args) => picomatch.scan(...args);
  3441. /**
  3442. * Parse a glob pattern to create the source string for a regular
  3443. * expression.
  3444. *
  3445. * ```js
  3446. * const mm = require('micromatch');
  3447. * const state = mm.parse(pattern[, options]);
  3448. * ```
  3449. * @param {String} `glob`
  3450. * @param {Object} `options`
  3451. * @return {Object} Returns an object with useful properties and output to be used as regex source string.
  3452. * @api public
  3453. */
  3454. micromatch.parse = (patterns, options) => {
  3455. let res = [];
  3456. for (let pattern of [].concat(patterns || [])) for (let str of braces(String(pattern), options)) res.push(picomatch.parse(str, options));
  3457. return res;
  3458. };
  3459. /**
  3460. * Process the given brace `pattern`.
  3461. *
  3462. * ```js
  3463. * const { braces } = require('micromatch');
  3464. * console.log(braces('foo/{a,b,c}/bar'));
  3465. * //=> [ 'foo/(a|b|c)/bar' ]
  3466. *
  3467. * console.log(braces('foo/{a,b,c}/bar', { expand: true }));
  3468. * //=> [ 'foo/a/bar', 'foo/b/bar', 'foo/c/bar' ]
  3469. * ```
  3470. * @param {String} `pattern` String with brace pattern to process.
  3471. * @param {Object} `options` Any [options](#options) to change how expansion is performed. See the [braces][] library for all available options.
  3472. * @return {Array}
  3473. * @api public
  3474. */
  3475. micromatch.braces = (pattern, options) => {
  3476. if (typeof pattern !== "string") throw new TypeError("Expected a string");
  3477. if (options && options.nobrace === true || !hasBraces(pattern)) return [pattern];
  3478. return braces(pattern, options);
  3479. };
  3480. /**
  3481. * Expand braces
  3482. */
  3483. micromatch.braceExpand = (pattern, options) => {
  3484. if (typeof pattern !== "string") throw new TypeError("Expected a string");
  3485. return micromatch.braces(pattern, {
  3486. ...options,
  3487. expand: true
  3488. });
  3489. };
  3490. /**
  3491. * Expose micromatch
  3492. */
  3493. micromatch.hasBraces = hasBraces;
  3494. module.exports = micromatch;
  3495. }));
  3496. //#endregion
  3497. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/pattern.js
  3498. var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
  3499. Object.defineProperty(exports, "__esModule", { value: true });
  3500. exports.isAbsolute = exports.partitionAbsoluteAndRelative = exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0;
  3501. const path$5 = __require("path");
  3502. const globParent = require_glob_parent();
  3503. const micromatch = require_micromatch();
  3504. const GLOBSTAR = "**";
  3505. const ESCAPE_SYMBOL = "\\";
  3506. const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
  3507. const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
  3508. const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
  3509. const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
  3510. const BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./;
  3511. /**
  3512. * Matches a sequence of two or more consecutive slashes, excluding the first two slashes at the beginning of the string.
  3513. * The latter is due to the presence of the device path at the beginning of the UNC path.
  3514. */
  3515. const DOUBLE_SLASH_RE = /(?!^)\/{2,}/g;
  3516. function isStaticPattern(pattern, options = {}) {
  3517. return !isDynamicPattern(pattern, options);
  3518. }
  3519. exports.isStaticPattern = isStaticPattern;
  3520. function isDynamicPattern(pattern, options = {}) {
  3521. /**
  3522. * A special case with an empty string is necessary for matching patterns that start with a forward slash.
  3523. * An empty string cannot be a dynamic pattern.
  3524. * For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'.
  3525. */
  3526. if (pattern === "") return false;
  3527. /**
  3528. * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check
  3529. * filepath directly (without read directory).
  3530. */
  3531. if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) return true;
  3532. if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) return true;
  3533. if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) return true;
  3534. if (options.braceExpansion !== false && hasBraceExpansion(pattern)) return true;
  3535. return false;
  3536. }
  3537. exports.isDynamicPattern = isDynamicPattern;
  3538. function hasBraceExpansion(pattern) {
  3539. const openingBraceIndex = pattern.indexOf("{");
  3540. if (openingBraceIndex === -1) return false;
  3541. const closingBraceIndex = pattern.indexOf("}", openingBraceIndex + 1);
  3542. if (closingBraceIndex === -1) return false;
  3543. const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex);
  3544. return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent);
  3545. }
  3546. function convertToPositivePattern(pattern) {
  3547. return isNegativePattern(pattern) ? pattern.slice(1) : pattern;
  3548. }
  3549. exports.convertToPositivePattern = convertToPositivePattern;
  3550. function convertToNegativePattern(pattern) {
  3551. return "!" + pattern;
  3552. }
  3553. exports.convertToNegativePattern = convertToNegativePattern;
  3554. function isNegativePattern(pattern) {
  3555. return pattern.startsWith("!") && pattern[1] !== "(";
  3556. }
  3557. exports.isNegativePattern = isNegativePattern;
  3558. function isPositivePattern(pattern) {
  3559. return !isNegativePattern(pattern);
  3560. }
  3561. exports.isPositivePattern = isPositivePattern;
  3562. function getNegativePatterns(patterns) {
  3563. return patterns.filter(isNegativePattern);
  3564. }
  3565. exports.getNegativePatterns = getNegativePatterns;
  3566. function getPositivePatterns(patterns) {
  3567. return patterns.filter(isPositivePattern);
  3568. }
  3569. exports.getPositivePatterns = getPositivePatterns;
  3570. /**
  3571. * Returns patterns that can be applied inside the current directory.
  3572. *
  3573. * @example
  3574. * // ['./*', '*', 'a/*']
  3575. * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
  3576. */
  3577. function getPatternsInsideCurrentDirectory(patterns) {
  3578. return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern));
  3579. }
  3580. exports.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
  3581. /**
  3582. * Returns patterns to be expanded relative to (outside) the current directory.
  3583. *
  3584. * @example
  3585. * // ['../*', './../*']
  3586. * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
  3587. */
  3588. function getPatternsOutsideCurrentDirectory(patterns) {
  3589. return patterns.filter(isPatternRelatedToParentDirectory);
  3590. }
  3591. exports.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
  3592. function isPatternRelatedToParentDirectory(pattern) {
  3593. return pattern.startsWith("..") || pattern.startsWith("./..");
  3594. }
  3595. exports.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
  3596. function getBaseDirectory(pattern) {
  3597. return globParent(pattern, { flipBackslashes: false });
  3598. }
  3599. exports.getBaseDirectory = getBaseDirectory;
  3600. function hasGlobStar(pattern) {
  3601. return pattern.includes(GLOBSTAR);
  3602. }
  3603. exports.hasGlobStar = hasGlobStar;
  3604. function endsWithSlashGlobStar(pattern) {
  3605. return pattern.endsWith("/" + GLOBSTAR);
  3606. }
  3607. exports.endsWithSlashGlobStar = endsWithSlashGlobStar;
  3608. function isAffectDepthOfReadingPattern(pattern) {
  3609. const basename = path$5.basename(pattern);
  3610. return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
  3611. }
  3612. exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
  3613. function expandPatternsWithBraceExpansion(patterns) {
  3614. return patterns.reduce((collection, pattern) => {
  3615. return collection.concat(expandBraceExpansion(pattern));
  3616. }, []);
  3617. }
  3618. exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
  3619. function expandBraceExpansion(pattern) {
  3620. const patterns = micromatch.braces(pattern, {
  3621. expand: true,
  3622. nodupes: true,
  3623. keepEscaping: true
  3624. });
  3625. /**
  3626. * Sort the patterns by length so that the same depth patterns are processed side by side.
  3627. * `a/{b,}/{c,}/*` – `['a///*', 'a/b//*', 'a//c/*', 'a/b/c/*']`
  3628. */
  3629. patterns.sort((a, b) => a.length - b.length);
  3630. /**
  3631. * Micromatch can return an empty string in the case of patterns like `{a,}`.
  3632. */
  3633. return patterns.filter((pattern) => pattern !== "");
  3634. }
  3635. exports.expandBraceExpansion = expandBraceExpansion;
  3636. function getPatternParts(pattern, options) {
  3637. let { parts } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true }));
  3638. /**
  3639. * The scan method returns an empty array in some cases.
  3640. * See micromatch/picomatch#58 for more details.
  3641. */
  3642. if (parts.length === 0) parts = [pattern];
  3643. /**
  3644. * The scan method does not return an empty part for the pattern with a forward slash.
  3645. * This is another part of micromatch/picomatch#58.
  3646. */
  3647. if (parts[0].startsWith("/")) {
  3648. parts[0] = parts[0].slice(1);
  3649. parts.unshift("");
  3650. }
  3651. return parts;
  3652. }
  3653. exports.getPatternParts = getPatternParts;
  3654. function makeRe(pattern, options) {
  3655. return micromatch.makeRe(pattern, options);
  3656. }
  3657. exports.makeRe = makeRe;
  3658. function convertPatternsToRe(patterns, options) {
  3659. return patterns.map((pattern) => makeRe(pattern, options));
  3660. }
  3661. exports.convertPatternsToRe = convertPatternsToRe;
  3662. function matchAny(entry, patternsRe) {
  3663. return patternsRe.some((patternRe) => patternRe.test(entry));
  3664. }
  3665. exports.matchAny = matchAny;
  3666. /**
  3667. * This package only works with forward slashes as a path separator.
  3668. * Because of this, we cannot use the standard `path.normalize` method, because on Windows platform it will use of backslashes.
  3669. */
  3670. function removeDuplicateSlashes(pattern) {
  3671. return pattern.replace(DOUBLE_SLASH_RE, "/");
  3672. }
  3673. exports.removeDuplicateSlashes = removeDuplicateSlashes;
  3674. function partitionAbsoluteAndRelative(patterns) {
  3675. const absolute = [];
  3676. const relative = [];
  3677. for (const pattern of patterns) if (isAbsolute(pattern)) absolute.push(pattern);
  3678. else relative.push(pattern);
  3679. return [absolute, relative];
  3680. }
  3681. exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
  3682. function isAbsolute(pattern) {
  3683. return path$5.isAbsolute(pattern);
  3684. }
  3685. exports.isAbsolute = isAbsolute;
  3686. }));
  3687. //#endregion
  3688. //#region ../../node_modules/.pnpm/merge2@1.4.1/node_modules/merge2/index.js
  3689. var require_merge2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  3690. const PassThrough = __require("stream").PassThrough;
  3691. const slice = Array.prototype.slice;
  3692. module.exports = merge2;
  3693. function merge2() {
  3694. const streamsQueue = [];
  3695. const args = slice.call(arguments);
  3696. let merging = false;
  3697. let options = args[args.length - 1];
  3698. if (options && !Array.isArray(options) && options.pipe == null) args.pop();
  3699. else options = {};
  3700. const doEnd = options.end !== false;
  3701. const doPipeError = options.pipeError === true;
  3702. if (options.objectMode == null) options.objectMode = true;
  3703. if (options.highWaterMark == null) options.highWaterMark = 64 * 1024;
  3704. const mergedStream = PassThrough(options);
  3705. function addStream() {
  3706. for (let i = 0, len = arguments.length; i < len; i++) streamsQueue.push(pauseStreams(arguments[i], options));
  3707. mergeStream();
  3708. return this;
  3709. }
  3710. function mergeStream() {
  3711. if (merging) return;
  3712. merging = true;
  3713. let streams = streamsQueue.shift();
  3714. if (!streams) {
  3715. process.nextTick(endStream);
  3716. return;
  3717. }
  3718. if (!Array.isArray(streams)) streams = [streams];
  3719. let pipesCount = streams.length + 1;
  3720. function next() {
  3721. if (--pipesCount > 0) return;
  3722. merging = false;
  3723. mergeStream();
  3724. }
  3725. function pipe(stream) {
  3726. function onend() {
  3727. stream.removeListener("merge2UnpipeEnd", onend);
  3728. stream.removeListener("end", onend);
  3729. if (doPipeError) stream.removeListener("error", onerror);
  3730. next();
  3731. }
  3732. function onerror(err) {
  3733. mergedStream.emit("error", err);
  3734. }
  3735. if (stream._readableState.endEmitted) return next();
  3736. stream.on("merge2UnpipeEnd", onend);
  3737. stream.on("end", onend);
  3738. if (doPipeError) stream.on("error", onerror);
  3739. stream.pipe(mergedStream, { end: false });
  3740. stream.resume();
  3741. }
  3742. for (let i = 0; i < streams.length; i++) pipe(streams[i]);
  3743. next();
  3744. }
  3745. function endStream() {
  3746. merging = false;
  3747. mergedStream.emit("queueDrain");
  3748. if (doEnd) mergedStream.end();
  3749. }
  3750. mergedStream.setMaxListeners(0);
  3751. mergedStream.add = addStream;
  3752. mergedStream.on("unpipe", function(stream) {
  3753. stream.emit("merge2UnpipeEnd");
  3754. });
  3755. if (args.length) addStream.apply(null, args);
  3756. return mergedStream;
  3757. }
  3758. function pauseStreams(streams, options) {
  3759. if (!Array.isArray(streams)) {
  3760. if (!streams._readableState && streams.pipe) streams = streams.pipe(PassThrough(options));
  3761. if (!streams._readableState || !streams.pause || !streams.pipe) throw new Error("Only readable stream can be merged.");
  3762. streams.pause();
  3763. } else for (let i = 0, len = streams.length; i < len; i++) streams[i] = pauseStreams(streams[i], options);
  3764. return streams;
  3765. }
  3766. }));
  3767. //#endregion
  3768. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/stream.js
  3769. var require_stream$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
  3770. Object.defineProperty(exports, "__esModule", { value: true });
  3771. exports.merge = void 0;
  3772. const merge2 = require_merge2();
  3773. function merge(streams) {
  3774. const mergedStream = merge2(streams);
  3775. streams.forEach((stream) => {
  3776. stream.once("error", (error) => mergedStream.emit("error", error));
  3777. });
  3778. mergedStream.once("close", () => propagateCloseEventToSources(streams));
  3779. mergedStream.once("end", () => propagateCloseEventToSources(streams));
  3780. return mergedStream;
  3781. }
  3782. exports.merge = merge;
  3783. function propagateCloseEventToSources(streams) {
  3784. streams.forEach((stream) => stream.emit("close"));
  3785. }
  3786. }));
  3787. //#endregion
  3788. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/string.js
  3789. var require_string = /* @__PURE__ */ __commonJSMin(((exports) => {
  3790. Object.defineProperty(exports, "__esModule", { value: true });
  3791. exports.isEmpty = exports.isString = void 0;
  3792. function isString(input) {
  3793. return typeof input === "string";
  3794. }
  3795. exports.isString = isString;
  3796. function isEmpty(input) {
  3797. return input === "";
  3798. }
  3799. exports.isEmpty = isEmpty;
  3800. }));
  3801. //#endregion
  3802. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/index.js
  3803. var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
  3804. Object.defineProperty(exports, "__esModule", { value: true });
  3805. exports.string = exports.stream = exports.pattern = exports.path = exports.fs = exports.errno = exports.array = void 0;
  3806. exports.array = require_array();
  3807. exports.errno = require_errno();
  3808. exports.fs = require_fs$3();
  3809. exports.path = require_path();
  3810. exports.pattern = require_pattern();
  3811. exports.stream = require_stream$3();
  3812. exports.string = require_string();
  3813. }));
  3814. //#endregion
  3815. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/managers/tasks.js
  3816. var require_tasks = /* @__PURE__ */ __commonJSMin(((exports) => {
  3817. Object.defineProperty(exports, "__esModule", { value: true });
  3818. exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0;
  3819. const utils = require_utils$1();
  3820. function generate(input, settings) {
  3821. const patterns = processPatterns(input, settings);
  3822. const ignore = processPatterns(settings.ignore, settings);
  3823. const positivePatterns = getPositivePatterns(patterns);
  3824. const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
  3825. const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings));
  3826. const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings));
  3827. const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, false);
  3828. const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, true);
  3829. return staticTasks.concat(dynamicTasks);
  3830. }
  3831. exports.generate = generate;
  3832. function processPatterns(input, settings) {
  3833. let patterns = input;
  3834. /**
  3835. * The original pattern like `{,*,**,a/*}` can lead to problems checking the depth when matching entry
  3836. * and some problems with the micromatch package (see fast-glob issues: #365, #394).
  3837. *
  3838. * To solve this problem, we expand all patterns containing brace expansion. This can lead to a slight slowdown
  3839. * in matching in the case of a large set of patterns after expansion.
  3840. */
  3841. if (settings.braceExpansion) patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns);
  3842. /**
  3843. * If the `baseNameMatch` option is enabled, we must add globstar to patterns, so that they can be used
  3844. * at any nesting level.
  3845. *
  3846. * We do this here, because otherwise we have to complicate the filtering logic. For example, we need to change
  3847. * the pattern in the filter before creating a regular expression. There is no need to change the patterns
  3848. * in the application. Only on the input.
  3849. */
  3850. if (settings.baseNameMatch) patterns = patterns.map((pattern) => pattern.includes("/") ? pattern : `**/${pattern}`);
  3851. /**
  3852. * This method also removes duplicate slashes that may have been in the pattern or formed as a result of expansion.
  3853. */
  3854. return patterns.map((pattern) => utils.pattern.removeDuplicateSlashes(pattern));
  3855. }
  3856. /**
  3857. * Returns tasks grouped by basic pattern directories.
  3858. *
  3859. * Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
  3860. * This is necessary because directory traversal starts at the base directory and goes deeper.
  3861. */
  3862. function convertPatternsToTasks(positive, negative, dynamic) {
  3863. const tasks = [];
  3864. const patternsOutsideCurrentDirectory = utils.pattern.getPatternsOutsideCurrentDirectory(positive);
  3865. const patternsInsideCurrentDirectory = utils.pattern.getPatternsInsideCurrentDirectory(positive);
  3866. const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
  3867. const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
  3868. tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
  3869. if ("." in insideCurrentDirectoryGroup) tasks.push(convertPatternGroupToTask(".", patternsInsideCurrentDirectory, negative, dynamic));
  3870. else tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
  3871. return tasks;
  3872. }
  3873. exports.convertPatternsToTasks = convertPatternsToTasks;
  3874. function getPositivePatterns(patterns) {
  3875. return utils.pattern.getPositivePatterns(patterns);
  3876. }
  3877. exports.getPositivePatterns = getPositivePatterns;
  3878. function getNegativePatternsAsPositive(patterns, ignore) {
  3879. return utils.pattern.getNegativePatterns(patterns).concat(ignore).map(utils.pattern.convertToPositivePattern);
  3880. }
  3881. exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
  3882. function groupPatternsByBaseDirectory(patterns) {
  3883. return patterns.reduce((collection, pattern) => {
  3884. const base = utils.pattern.getBaseDirectory(pattern);
  3885. if (base in collection) collection[base].push(pattern);
  3886. else collection[base] = [pattern];
  3887. return collection;
  3888. }, {});
  3889. }
  3890. exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
  3891. function convertPatternGroupsToTasks(positive, negative, dynamic) {
  3892. return Object.keys(positive).map((base) => {
  3893. return convertPatternGroupToTask(base, positive[base], negative, dynamic);
  3894. });
  3895. }
  3896. exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
  3897. function convertPatternGroupToTask(base, positive, negative, dynamic) {
  3898. return {
  3899. dynamic,
  3900. positive,
  3901. negative,
  3902. base,
  3903. patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern))
  3904. };
  3905. }
  3906. exports.convertPatternGroupToTask = convertPatternGroupToTask;
  3907. }));
  3908. //#endregion
  3909. //#region ../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/async.js
  3910. var require_async$5 = /* @__PURE__ */ __commonJSMin(((exports) => {
  3911. Object.defineProperty(exports, "__esModule", { value: true });
  3912. exports.read = void 0;
  3913. function read(path, settings, callback) {
  3914. settings.fs.lstat(path, (lstatError, lstat) => {
  3915. if (lstatError !== null) {
  3916. callFailureCallback(callback, lstatError);
  3917. return;
  3918. }
  3919. if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
  3920. callSuccessCallback(callback, lstat);
  3921. return;
  3922. }
  3923. settings.fs.stat(path, (statError, stat) => {
  3924. if (statError !== null) {
  3925. if (settings.throwErrorOnBrokenSymbolicLink) {
  3926. callFailureCallback(callback, statError);
  3927. return;
  3928. }
  3929. callSuccessCallback(callback, lstat);
  3930. return;
  3931. }
  3932. if (settings.markSymbolicLink) stat.isSymbolicLink = () => true;
  3933. callSuccessCallback(callback, stat);
  3934. });
  3935. });
  3936. }
  3937. exports.read = read;
  3938. function callFailureCallback(callback, error) {
  3939. callback(error);
  3940. }
  3941. function callSuccessCallback(callback, result) {
  3942. callback(null, result);
  3943. }
  3944. }));
  3945. //#endregion
  3946. //#region ../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/sync.js
  3947. var require_sync$5 = /* @__PURE__ */ __commonJSMin(((exports) => {
  3948. Object.defineProperty(exports, "__esModule", { value: true });
  3949. exports.read = void 0;
  3950. function read(path, settings) {
  3951. const lstat = settings.fs.lstatSync(path);
  3952. if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) return lstat;
  3953. try {
  3954. const stat = settings.fs.statSync(path);
  3955. if (settings.markSymbolicLink) stat.isSymbolicLink = () => true;
  3956. return stat;
  3957. } catch (error) {
  3958. if (!settings.throwErrorOnBrokenSymbolicLink) return lstat;
  3959. throw error;
  3960. }
  3961. }
  3962. exports.read = read;
  3963. }));
  3964. //#endregion
  3965. //#region ../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/adapters/fs.js
  3966. var require_fs$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
  3967. Object.defineProperty(exports, "__esModule", { value: true });
  3968. exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
  3969. const fs$3 = __require("fs");
  3970. exports.FILE_SYSTEM_ADAPTER = {
  3971. lstat: fs$3.lstat,
  3972. stat: fs$3.stat,
  3973. lstatSync: fs$3.lstatSync,
  3974. statSync: fs$3.statSync
  3975. };
  3976. function createFileSystemAdapter(fsMethods) {
  3977. if (fsMethods === void 0) return exports.FILE_SYSTEM_ADAPTER;
  3978. return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
  3979. }
  3980. exports.createFileSystemAdapter = createFileSystemAdapter;
  3981. }));
  3982. //#endregion
  3983. //#region ../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js
  3984. var require_settings$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
  3985. Object.defineProperty(exports, "__esModule", { value: true });
  3986. const fs = require_fs$2();
  3987. var Settings = class {
  3988. constructor(_options = {}) {
  3989. this._options = _options;
  3990. this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
  3991. this.fs = fs.createFileSystemAdapter(this._options.fs);
  3992. this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
  3993. this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
  3994. }
  3995. _getValue(option, value) {
  3996. return option !== null && option !== void 0 ? option : value;
  3997. }
  3998. };
  3999. exports.default = Settings;
  4000. }));
  4001. //#endregion
  4002. //#region ../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/index.js
  4003. var require_out$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
  4004. Object.defineProperty(exports, "__esModule", { value: true });
  4005. exports.statSync = exports.stat = exports.Settings = void 0;
  4006. const async = require_async$5();
  4007. const sync = require_sync$5();
  4008. const settings_1 = require_settings$3();
  4009. exports.Settings = settings_1.default;
  4010. function stat(path, optionsOrSettingsOrCallback, callback) {
  4011. if (typeof optionsOrSettingsOrCallback === "function") {
  4012. async.read(path, getSettings(), optionsOrSettingsOrCallback);
  4013. return;
  4014. }
  4015. async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
  4016. }
  4017. exports.stat = stat;
  4018. function statSync(path, optionsOrSettings) {
  4019. const settings = getSettings(optionsOrSettings);
  4020. return sync.read(path, settings);
  4021. }
  4022. exports.statSync = statSync;
  4023. function getSettings(settingsOrOptions = {}) {
  4024. if (settingsOrOptions instanceof settings_1.default) return settingsOrOptions;
  4025. return new settings_1.default(settingsOrOptions);
  4026. }
  4027. }));
  4028. //#endregion
  4029. //#region ../../node_modules/.pnpm/queue-microtask@1.2.3/node_modules/queue-microtask/index.js
  4030. var require_queue_microtask = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  4031. /*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
  4032. let promise;
  4033. module.exports = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : global) : (cb) => (promise || (promise = Promise.resolve())).then(cb).catch((err) => setTimeout(() => {
  4034. throw err;
  4035. }, 0));
  4036. }));
  4037. //#endregion
  4038. //#region ../../node_modules/.pnpm/run-parallel@1.2.0/node_modules/run-parallel/index.js
  4039. var require_run_parallel = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  4040. /*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
  4041. module.exports = runParallel;
  4042. const queueMicrotask = require_queue_microtask();
  4043. function runParallel(tasks, cb) {
  4044. let results, pending, keys;
  4045. let isSync = true;
  4046. if (Array.isArray(tasks)) {
  4047. results = [];
  4048. pending = tasks.length;
  4049. } else {
  4050. keys = Object.keys(tasks);
  4051. results = {};
  4052. pending = keys.length;
  4053. }
  4054. function done(err) {
  4055. function end() {
  4056. if (cb) cb(err, results);
  4057. cb = null;
  4058. }
  4059. if (isSync) queueMicrotask(end);
  4060. else end();
  4061. }
  4062. function each(i, err, result) {
  4063. results[i] = result;
  4064. if (--pending === 0 || err) done(err);
  4065. }
  4066. if (!pending) done(null);
  4067. else if (keys) keys.forEach(function(key) {
  4068. tasks[key](function(err, result) {
  4069. each(key, err, result);
  4070. });
  4071. });
  4072. else tasks.forEach(function(task, i) {
  4073. task(function(err, result) {
  4074. each(i, err, result);
  4075. });
  4076. });
  4077. isSync = false;
  4078. }
  4079. }));
  4080. //#endregion
  4081. //#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/constants.js
  4082. var require_constants = /* @__PURE__ */ __commonJSMin(((exports) => {
  4083. Object.defineProperty(exports, "__esModule", { value: true });
  4084. exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
  4085. const NODE_PROCESS_VERSION_PARTS = process.versions.node.split(".");
  4086. if (NODE_PROCESS_VERSION_PARTS[0] === void 0 || NODE_PROCESS_VERSION_PARTS[1] === void 0) throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);
  4087. const MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
  4088. const MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10);
  4089. const SUPPORTED_MAJOR_VERSION = 10;
  4090. /**
  4091. * IS `true` for Node.js 10.10 and greater.
  4092. */
  4093. exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION || MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= 10;
  4094. }));
  4095. //#endregion
  4096. //#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/fs.js
  4097. var require_fs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
  4098. Object.defineProperty(exports, "__esModule", { value: true });
  4099. exports.createDirentFromStats = void 0;
  4100. var DirentFromStats = class {
  4101. constructor(name, stats) {
  4102. this.name = name;
  4103. this.isBlockDevice = stats.isBlockDevice.bind(stats);
  4104. this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
  4105. this.isDirectory = stats.isDirectory.bind(stats);
  4106. this.isFIFO = stats.isFIFO.bind(stats);
  4107. this.isFile = stats.isFile.bind(stats);
  4108. this.isSocket = stats.isSocket.bind(stats);
  4109. this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
  4110. }
  4111. };
  4112. function createDirentFromStats(name, stats) {
  4113. return new DirentFromStats(name, stats);
  4114. }
  4115. exports.createDirentFromStats = createDirentFromStats;
  4116. }));
  4117. //#endregion
  4118. //#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/index.js
  4119. var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
  4120. Object.defineProperty(exports, "__esModule", { value: true });
  4121. exports.fs = void 0;
  4122. exports.fs = require_fs$1();
  4123. }));
  4124. //#endregion
  4125. //#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/common.js
  4126. var require_common$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
  4127. Object.defineProperty(exports, "__esModule", { value: true });
  4128. exports.joinPathSegments = void 0;
  4129. function joinPathSegments(a, b, separator) {
  4130. /**
  4131. * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
  4132. */
  4133. if (a.endsWith(separator)) return a + b;
  4134. return a + separator + b;
  4135. }
  4136. exports.joinPathSegments = joinPathSegments;
  4137. }));
  4138. //#endregion
  4139. //#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/async.js
  4140. var require_async$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
  4141. Object.defineProperty(exports, "__esModule", { value: true });
  4142. exports.readdir = exports.readdirWithFileTypes = exports.read = void 0;
  4143. const fsStat = require_out$3();
  4144. const rpl = require_run_parallel();
  4145. const constants_1 = require_constants();
  4146. const utils = require_utils();
  4147. const common = require_common$1();
  4148. function read(directory, settings, callback) {
  4149. if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
  4150. readdirWithFileTypes(directory, settings, callback);
  4151. return;
  4152. }
  4153. readdir(directory, settings, callback);
  4154. }
  4155. exports.read = read;
  4156. function readdirWithFileTypes(directory, settings, callback) {
  4157. settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
  4158. if (readdirError !== null) {
  4159. callFailureCallback(callback, readdirError);
  4160. return;
  4161. }
  4162. const entries = dirents.map((dirent) => ({
  4163. dirent,
  4164. name: dirent.name,
  4165. path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
  4166. }));
  4167. if (!settings.followSymbolicLinks) {
  4168. callSuccessCallback(callback, entries);
  4169. return;
  4170. }
  4171. rpl(entries.map((entry) => makeRplTaskEntry(entry, settings)), (rplError, rplEntries) => {
  4172. if (rplError !== null) {
  4173. callFailureCallback(callback, rplError);
  4174. return;
  4175. }
  4176. callSuccessCallback(callback, rplEntries);
  4177. });
  4178. });
  4179. }
  4180. exports.readdirWithFileTypes = readdirWithFileTypes;
  4181. function makeRplTaskEntry(entry, settings) {
  4182. return (done) => {
  4183. if (!entry.dirent.isSymbolicLink()) {
  4184. done(null, entry);
  4185. return;
  4186. }
  4187. settings.fs.stat(entry.path, (statError, stats) => {
  4188. if (statError !== null) {
  4189. if (settings.throwErrorOnBrokenSymbolicLink) {
  4190. done(statError);
  4191. return;
  4192. }
  4193. done(null, entry);
  4194. return;
  4195. }
  4196. entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
  4197. done(null, entry);
  4198. });
  4199. };
  4200. }
  4201. function readdir(directory, settings, callback) {
  4202. settings.fs.readdir(directory, (readdirError, names) => {
  4203. if (readdirError !== null) {
  4204. callFailureCallback(callback, readdirError);
  4205. return;
  4206. }
  4207. rpl(names.map((name) => {
  4208. const path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
  4209. return (done) => {
  4210. fsStat.stat(path, settings.fsStatSettings, (error, stats) => {
  4211. if (error !== null) {
  4212. done(error);
  4213. return;
  4214. }
  4215. const entry = {
  4216. name,
  4217. path,
  4218. dirent: utils.fs.createDirentFromStats(name, stats)
  4219. };
  4220. if (settings.stats) entry.stats = stats;
  4221. done(null, entry);
  4222. });
  4223. };
  4224. }), (rplError, entries) => {
  4225. if (rplError !== null) {
  4226. callFailureCallback(callback, rplError);
  4227. return;
  4228. }
  4229. callSuccessCallback(callback, entries);
  4230. });
  4231. });
  4232. }
  4233. exports.readdir = readdir;
  4234. function callFailureCallback(callback, error) {
  4235. callback(error);
  4236. }
  4237. function callSuccessCallback(callback, result) {
  4238. callback(null, result);
  4239. }
  4240. }));
  4241. //#endregion
  4242. //#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/sync.js
  4243. var require_sync$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
  4244. Object.defineProperty(exports, "__esModule", { value: true });
  4245. exports.readdir = exports.readdirWithFileTypes = exports.read = void 0;
  4246. const fsStat = require_out$3();
  4247. const constants_1 = require_constants();
  4248. const utils = require_utils();
  4249. const common = require_common$1();
  4250. function read(directory, settings) {
  4251. if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) return readdirWithFileTypes(directory, settings);
  4252. return readdir(directory, settings);
  4253. }
  4254. exports.read = read;
  4255. function readdirWithFileTypes(directory, settings) {
  4256. return settings.fs.readdirSync(directory, { withFileTypes: true }).map((dirent) => {
  4257. const entry = {
  4258. dirent,
  4259. name: dirent.name,
  4260. path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
  4261. };
  4262. if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) try {
  4263. const stats = settings.fs.statSync(entry.path);
  4264. entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
  4265. } catch (error) {
  4266. if (settings.throwErrorOnBrokenSymbolicLink) throw error;
  4267. }
  4268. return entry;
  4269. });
  4270. }
  4271. exports.readdirWithFileTypes = readdirWithFileTypes;
  4272. function readdir(directory, settings) {
  4273. return settings.fs.readdirSync(directory).map((name) => {
  4274. const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
  4275. const stats = fsStat.statSync(entryPath, settings.fsStatSettings);
  4276. const entry = {
  4277. name,
  4278. path: entryPath,
  4279. dirent: utils.fs.createDirentFromStats(name, stats)
  4280. };
  4281. if (settings.stats) entry.stats = stats;
  4282. return entry;
  4283. });
  4284. }
  4285. exports.readdir = readdir;
  4286. }));
  4287. //#endregion
  4288. //#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/adapters/fs.js
  4289. var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
  4290. Object.defineProperty(exports, "__esModule", { value: true });
  4291. exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
  4292. const fs$2 = __require("fs");
  4293. exports.FILE_SYSTEM_ADAPTER = {
  4294. lstat: fs$2.lstat,
  4295. stat: fs$2.stat,
  4296. lstatSync: fs$2.lstatSync,
  4297. statSync: fs$2.statSync,
  4298. readdir: fs$2.readdir,
  4299. readdirSync: fs$2.readdirSync
  4300. };
  4301. function createFileSystemAdapter(fsMethods) {
  4302. if (fsMethods === void 0) return exports.FILE_SYSTEM_ADAPTER;
  4303. return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
  4304. }
  4305. exports.createFileSystemAdapter = createFileSystemAdapter;
  4306. }));
  4307. //#endregion
  4308. //#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/settings.js
  4309. var require_settings$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
  4310. Object.defineProperty(exports, "__esModule", { value: true });
  4311. const path$4 = __require("path");
  4312. const fsStat = require_out$3();
  4313. const fs = require_fs();
  4314. var Settings = class {
  4315. constructor(_options = {}) {
  4316. this._options = _options;
  4317. this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
  4318. this.fs = fs.createFileSystemAdapter(this._options.fs);
  4319. this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$4.sep);
  4320. this.stats = this._getValue(this._options.stats, false);
  4321. this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
  4322. this.fsStatSettings = new fsStat.Settings({
  4323. followSymbolicLink: this.followSymbolicLinks,
  4324. fs: this.fs,
  4325. throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
  4326. });
  4327. }
  4328. _getValue(option, value) {
  4329. return option !== null && option !== void 0 ? option : value;
  4330. }
  4331. };
  4332. exports.default = Settings;
  4333. }));
  4334. //#endregion
  4335. //#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/index.js
  4336. var require_out$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
  4337. Object.defineProperty(exports, "__esModule", { value: true });
  4338. exports.Settings = exports.scandirSync = exports.scandir = void 0;
  4339. const async = require_async$4();
  4340. const sync = require_sync$4();
  4341. const settings_1 = require_settings$2();
  4342. exports.Settings = settings_1.default;
  4343. function scandir(path, optionsOrSettingsOrCallback, callback) {
  4344. if (typeof optionsOrSettingsOrCallback === "function") {
  4345. async.read(path, getSettings(), optionsOrSettingsOrCallback);
  4346. return;
  4347. }
  4348. async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
  4349. }
  4350. exports.scandir = scandir;
  4351. function scandirSync(path, optionsOrSettings) {
  4352. const settings = getSettings(optionsOrSettings);
  4353. return sync.read(path, settings);
  4354. }
  4355. exports.scandirSync = scandirSync;
  4356. function getSettings(settingsOrOptions = {}) {
  4357. if (settingsOrOptions instanceof settings_1.default) return settingsOrOptions;
  4358. return new settings_1.default(settingsOrOptions);
  4359. }
  4360. }));
  4361. //#endregion
  4362. //#region ../../node_modules/.pnpm/reusify@1.1.0/node_modules/reusify/reusify.js
  4363. var require_reusify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  4364. function reusify(Constructor) {
  4365. var head = new Constructor();
  4366. var tail = head;
  4367. function get() {
  4368. var current = head;
  4369. if (current.next) head = current.next;
  4370. else {
  4371. head = new Constructor();
  4372. tail = head;
  4373. }
  4374. current.next = null;
  4375. return current;
  4376. }
  4377. function release(obj) {
  4378. tail.next = obj;
  4379. tail = obj;
  4380. }
  4381. return {
  4382. get,
  4383. release
  4384. };
  4385. }
  4386. module.exports = reusify;
  4387. }));
  4388. //#endregion
  4389. //#region ../../node_modules/.pnpm/fastq@1.19.1/node_modules/fastq/queue.js
  4390. var require_queue = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  4391. var reusify = require_reusify();
  4392. function fastqueue(context, worker, _concurrency) {
  4393. if (typeof context === "function") {
  4394. _concurrency = worker;
  4395. worker = context;
  4396. context = null;
  4397. }
  4398. if (!(_concurrency >= 1)) throw new Error("fastqueue concurrency must be equal to or greater than 1");
  4399. var cache = reusify(Task);
  4400. var queueHead = null;
  4401. var queueTail = null;
  4402. var _running = 0;
  4403. var errorHandler = null;
  4404. var self = {
  4405. push,
  4406. drain: noop,
  4407. saturated: noop,
  4408. pause,
  4409. paused: false,
  4410. get concurrency() {
  4411. return _concurrency;
  4412. },
  4413. set concurrency(value) {
  4414. if (!(value >= 1)) throw new Error("fastqueue concurrency must be equal to or greater than 1");
  4415. _concurrency = value;
  4416. if (self.paused) return;
  4417. for (; queueHead && _running < _concurrency;) {
  4418. _running++;
  4419. release();
  4420. }
  4421. },
  4422. running,
  4423. resume,
  4424. idle,
  4425. length,
  4426. getQueue,
  4427. unshift,
  4428. empty: noop,
  4429. kill,
  4430. killAndDrain,
  4431. error
  4432. };
  4433. return self;
  4434. function running() {
  4435. return _running;
  4436. }
  4437. function pause() {
  4438. self.paused = true;
  4439. }
  4440. function length() {
  4441. var current = queueHead;
  4442. var counter = 0;
  4443. while (current) {
  4444. current = current.next;
  4445. counter++;
  4446. }
  4447. return counter;
  4448. }
  4449. function getQueue() {
  4450. var current = queueHead;
  4451. var tasks = [];
  4452. while (current) {
  4453. tasks.push(current.value);
  4454. current = current.next;
  4455. }
  4456. return tasks;
  4457. }
  4458. function resume() {
  4459. if (!self.paused) return;
  4460. self.paused = false;
  4461. if (queueHead === null) {
  4462. _running++;
  4463. release();
  4464. return;
  4465. }
  4466. for (; queueHead && _running < _concurrency;) {
  4467. _running++;
  4468. release();
  4469. }
  4470. }
  4471. function idle() {
  4472. return _running === 0 && self.length() === 0;
  4473. }
  4474. function push(value, done) {
  4475. var current = cache.get();
  4476. current.context = context;
  4477. current.release = release;
  4478. current.value = value;
  4479. current.callback = done || noop;
  4480. current.errorHandler = errorHandler;
  4481. if (_running >= _concurrency || self.paused) if (queueTail) {
  4482. queueTail.next = current;
  4483. queueTail = current;
  4484. } else {
  4485. queueHead = current;
  4486. queueTail = current;
  4487. self.saturated();
  4488. }
  4489. else {
  4490. _running++;
  4491. worker.call(context, current.value, current.worked);
  4492. }
  4493. }
  4494. function unshift(value, done) {
  4495. var current = cache.get();
  4496. current.context = context;
  4497. current.release = release;
  4498. current.value = value;
  4499. current.callback = done || noop;
  4500. current.errorHandler = errorHandler;
  4501. if (_running >= _concurrency || self.paused) if (queueHead) {
  4502. current.next = queueHead;
  4503. queueHead = current;
  4504. } else {
  4505. queueHead = current;
  4506. queueTail = current;
  4507. self.saturated();
  4508. }
  4509. else {
  4510. _running++;
  4511. worker.call(context, current.value, current.worked);
  4512. }
  4513. }
  4514. function release(holder) {
  4515. if (holder) cache.release(holder);
  4516. var next = queueHead;
  4517. if (next && _running <= _concurrency) if (!self.paused) {
  4518. if (queueTail === queueHead) queueTail = null;
  4519. queueHead = next.next;
  4520. next.next = null;
  4521. worker.call(context, next.value, next.worked);
  4522. if (queueTail === null) self.empty();
  4523. } else _running--;
  4524. else if (--_running === 0) self.drain();
  4525. }
  4526. function kill() {
  4527. queueHead = null;
  4528. queueTail = null;
  4529. self.drain = noop;
  4530. }
  4531. function killAndDrain() {
  4532. queueHead = null;
  4533. queueTail = null;
  4534. self.drain();
  4535. self.drain = noop;
  4536. }
  4537. function error(handler) {
  4538. errorHandler = handler;
  4539. }
  4540. }
  4541. function noop() {}
  4542. function Task() {
  4543. this.value = null;
  4544. this.callback = noop;
  4545. this.next = null;
  4546. this.release = noop;
  4547. this.context = null;
  4548. this.errorHandler = null;
  4549. var self = this;
  4550. this.worked = function worked(err, result) {
  4551. var callback = self.callback;
  4552. var errorHandler = self.errorHandler;
  4553. var val = self.value;
  4554. self.value = null;
  4555. self.callback = noop;
  4556. if (self.errorHandler) errorHandler(err, val);
  4557. callback.call(self.context, err, result);
  4558. self.release(self);
  4559. };
  4560. }
  4561. function queueAsPromised(context, worker, _concurrency) {
  4562. if (typeof context === "function") {
  4563. _concurrency = worker;
  4564. worker = context;
  4565. context = null;
  4566. }
  4567. function asyncWrapper(arg, cb) {
  4568. worker.call(this, arg).then(function(res) {
  4569. cb(null, res);
  4570. }, cb);
  4571. }
  4572. var queue = fastqueue(context, asyncWrapper, _concurrency);
  4573. var pushCb = queue.push;
  4574. var unshiftCb = queue.unshift;
  4575. queue.push = push;
  4576. queue.unshift = unshift;
  4577. queue.drained = drained;
  4578. return queue;
  4579. function push(value) {
  4580. var p = new Promise(function(resolve, reject) {
  4581. pushCb(value, function(err, result) {
  4582. if (err) {
  4583. reject(err);
  4584. return;
  4585. }
  4586. resolve(result);
  4587. });
  4588. });
  4589. p.catch(noop);
  4590. return p;
  4591. }
  4592. function unshift(value) {
  4593. var p = new Promise(function(resolve, reject) {
  4594. unshiftCb(value, function(err, result) {
  4595. if (err) {
  4596. reject(err);
  4597. return;
  4598. }
  4599. resolve(result);
  4600. });
  4601. });
  4602. p.catch(noop);
  4603. return p;
  4604. }
  4605. function drained() {
  4606. return new Promise(function(resolve) {
  4607. process.nextTick(function() {
  4608. if (queue.idle()) resolve();
  4609. else {
  4610. var previousDrain = queue.drain;
  4611. queue.drain = function() {
  4612. if (typeof previousDrain === "function") previousDrain();
  4613. resolve();
  4614. queue.drain = previousDrain;
  4615. };
  4616. }
  4617. });
  4618. });
  4619. }
  4620. }
  4621. module.exports = fastqueue;
  4622. module.exports.promise = queueAsPromised;
  4623. }));
  4624. //#endregion
  4625. //#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/common.js
  4626. var require_common = /* @__PURE__ */ __commonJSMin(((exports) => {
  4627. Object.defineProperty(exports, "__esModule", { value: true });
  4628. exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0;
  4629. function isFatalError(settings, error) {
  4630. if (settings.errorFilter === null) return true;
  4631. return !settings.errorFilter(error);
  4632. }
  4633. exports.isFatalError = isFatalError;
  4634. function isAppliedFilter(filter, value) {
  4635. return filter === null || filter(value);
  4636. }
  4637. exports.isAppliedFilter = isAppliedFilter;
  4638. function replacePathSegmentSeparator(filepath, separator) {
  4639. return filepath.split(/[/\\]/).join(separator);
  4640. }
  4641. exports.replacePathSegmentSeparator = replacePathSegmentSeparator;
  4642. function joinPathSegments(a, b, separator) {
  4643. if (a === "") return b;
  4644. /**
  4645. * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
  4646. */
  4647. if (a.endsWith(separator)) return a + b;
  4648. return a + separator + b;
  4649. }
  4650. exports.joinPathSegments = joinPathSegments;
  4651. }));
  4652. //#endregion
  4653. //#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/reader.js
  4654. var require_reader$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
  4655. Object.defineProperty(exports, "__esModule", { value: true });
  4656. const common = require_common();
  4657. var Reader = class {
  4658. constructor(_root, _settings) {
  4659. this._root = _root;
  4660. this._settings = _settings;
  4661. this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
  4662. }
  4663. };
  4664. exports.default = Reader;
  4665. }));
  4666. //#endregion
  4667. //#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/async.js
  4668. var require_async$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
  4669. Object.defineProperty(exports, "__esModule", { value: true });
  4670. const events_1 = __require("events");
  4671. const fsScandir = require_out$2();
  4672. const fastq = require_queue();
  4673. const common = require_common();
  4674. const reader_1 = require_reader$1();
  4675. var AsyncReader = class extends reader_1.default {
  4676. constructor(_root, _settings) {
  4677. super(_root, _settings);
  4678. this._settings = _settings;
  4679. this._scandir = fsScandir.scandir;
  4680. this._emitter = new events_1.EventEmitter();
  4681. this._queue = fastq(this._worker.bind(this), this._settings.concurrency);
  4682. this._isFatalError = false;
  4683. this._isDestroyed = false;
  4684. this._queue.drain = () => {
  4685. if (!this._isFatalError) this._emitter.emit("end");
  4686. };
  4687. }
  4688. read() {
  4689. this._isFatalError = false;
  4690. this._isDestroyed = false;
  4691. setImmediate(() => {
  4692. this._pushToQueue(this._root, this._settings.basePath);
  4693. });
  4694. return this._emitter;
  4695. }
  4696. get isDestroyed() {
  4697. return this._isDestroyed;
  4698. }
  4699. destroy() {
  4700. if (this._isDestroyed) throw new Error("The reader is already destroyed");
  4701. this._isDestroyed = true;
  4702. this._queue.killAndDrain();
  4703. }
  4704. onEntry(callback) {
  4705. this._emitter.on("entry", callback);
  4706. }
  4707. onError(callback) {
  4708. this._emitter.once("error", callback);
  4709. }
  4710. onEnd(callback) {
  4711. this._emitter.once("end", callback);
  4712. }
  4713. _pushToQueue(directory, base) {
  4714. const queueItem = {
  4715. directory,
  4716. base
  4717. };
  4718. this._queue.push(queueItem, (error) => {
  4719. if (error !== null) this._handleError(error);
  4720. });
  4721. }
  4722. _worker(item, done) {
  4723. this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => {
  4724. if (error !== null) {
  4725. done(error, void 0);
  4726. return;
  4727. }
  4728. for (const entry of entries) this._handleEntry(entry, item.base);
  4729. done(null, void 0);
  4730. });
  4731. }
  4732. _handleError(error) {
  4733. if (this._isDestroyed || !common.isFatalError(this._settings, error)) return;
  4734. this._isFatalError = true;
  4735. this._isDestroyed = true;
  4736. this._emitter.emit("error", error);
  4737. }
  4738. _handleEntry(entry, base) {
  4739. if (this._isDestroyed || this._isFatalError) return;
  4740. const fullpath = entry.path;
  4741. if (base !== void 0) entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
  4742. if (common.isAppliedFilter(this._settings.entryFilter, entry)) this._emitEntry(entry);
  4743. if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) this._pushToQueue(fullpath, base === void 0 ? void 0 : entry.path);
  4744. }
  4745. _emitEntry(entry) {
  4746. this._emitter.emit("entry", entry);
  4747. }
  4748. };
  4749. exports.default = AsyncReader;
  4750. }));
  4751. //#endregion
  4752. //#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/async.js
  4753. var require_async$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
  4754. Object.defineProperty(exports, "__esModule", { value: true });
  4755. const async_1 = require_async$3();
  4756. var AsyncProvider = class {
  4757. constructor(_root, _settings) {
  4758. this._root = _root;
  4759. this._settings = _settings;
  4760. this._reader = new async_1.default(this._root, this._settings);
  4761. this._storage = [];
  4762. }
  4763. read(callback) {
  4764. this._reader.onError((error) => {
  4765. callFailureCallback(callback, error);
  4766. });
  4767. this._reader.onEntry((entry) => {
  4768. this._storage.push(entry);
  4769. });
  4770. this._reader.onEnd(() => {
  4771. callSuccessCallback(callback, this._storage);
  4772. });
  4773. this._reader.read();
  4774. }
  4775. };
  4776. exports.default = AsyncProvider;
  4777. function callFailureCallback(callback, error) {
  4778. callback(error);
  4779. }
  4780. function callSuccessCallback(callback, entries) {
  4781. callback(null, entries);
  4782. }
  4783. }));
  4784. //#endregion
  4785. //#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/stream.js
  4786. var require_stream$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
  4787. Object.defineProperty(exports, "__esModule", { value: true });
  4788. const stream_1$2 = __require("stream");
  4789. const async_1 = require_async$3();
  4790. var StreamProvider = class {
  4791. constructor(_root, _settings) {
  4792. this._root = _root;
  4793. this._settings = _settings;
  4794. this._reader = new async_1.default(this._root, this._settings);
  4795. this._stream = new stream_1$2.Readable({
  4796. objectMode: true,
  4797. read: () => {},
  4798. destroy: () => {
  4799. if (!this._reader.isDestroyed) this._reader.destroy();
  4800. }
  4801. });
  4802. }
  4803. read() {
  4804. this._reader.onError((error) => {
  4805. this._stream.emit("error", error);
  4806. });
  4807. this._reader.onEntry((entry) => {
  4808. this._stream.push(entry);
  4809. });
  4810. this._reader.onEnd(() => {
  4811. this._stream.push(null);
  4812. });
  4813. this._reader.read();
  4814. return this._stream;
  4815. }
  4816. };
  4817. exports.default = StreamProvider;
  4818. }));
  4819. //#endregion
  4820. //#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/sync.js
  4821. var require_sync$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
  4822. Object.defineProperty(exports, "__esModule", { value: true });
  4823. const fsScandir = require_out$2();
  4824. const common = require_common();
  4825. const reader_1 = require_reader$1();
  4826. var SyncReader = class extends reader_1.default {
  4827. constructor() {
  4828. super(...arguments);
  4829. this._scandir = fsScandir.scandirSync;
  4830. this._storage = [];
  4831. this._queue = /* @__PURE__ */ new Set();
  4832. }
  4833. read() {
  4834. this._pushToQueue(this._root, this._settings.basePath);
  4835. this._handleQueue();
  4836. return this._storage;
  4837. }
  4838. _pushToQueue(directory, base) {
  4839. this._queue.add({
  4840. directory,
  4841. base
  4842. });
  4843. }
  4844. _handleQueue() {
  4845. for (const item of this._queue.values()) this._handleDirectory(item.directory, item.base);
  4846. }
  4847. _handleDirectory(directory, base) {
  4848. try {
  4849. const entries = this._scandir(directory, this._settings.fsScandirSettings);
  4850. for (const entry of entries) this._handleEntry(entry, base);
  4851. } catch (error) {
  4852. this._handleError(error);
  4853. }
  4854. }
  4855. _handleError(error) {
  4856. if (!common.isFatalError(this._settings, error)) return;
  4857. throw error;
  4858. }
  4859. _handleEntry(entry, base) {
  4860. const fullpath = entry.path;
  4861. if (base !== void 0) entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
  4862. if (common.isAppliedFilter(this._settings.entryFilter, entry)) this._pushToStorage(entry);
  4863. if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) this._pushToQueue(fullpath, base === void 0 ? void 0 : entry.path);
  4864. }
  4865. _pushToStorage(entry) {
  4866. this._storage.push(entry);
  4867. }
  4868. };
  4869. exports.default = SyncReader;
  4870. }));
  4871. //#endregion
  4872. //#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/sync.js
  4873. var require_sync$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
  4874. Object.defineProperty(exports, "__esModule", { value: true });
  4875. const sync_1 = require_sync$3();
  4876. var SyncProvider = class {
  4877. constructor(_root, _settings) {
  4878. this._root = _root;
  4879. this._settings = _settings;
  4880. this._reader = new sync_1.default(this._root, this._settings);
  4881. }
  4882. read() {
  4883. return this._reader.read();
  4884. }
  4885. };
  4886. exports.default = SyncProvider;
  4887. }));
  4888. //#endregion
  4889. //#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/settings.js
  4890. var require_settings$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
  4891. Object.defineProperty(exports, "__esModule", { value: true });
  4892. const path$3 = __require("path");
  4893. const fsScandir = require_out$2();
  4894. var Settings = class {
  4895. constructor(_options = {}) {
  4896. this._options = _options;
  4897. this.basePath = this._getValue(this._options.basePath, void 0);
  4898. this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY);
  4899. this.deepFilter = this._getValue(this._options.deepFilter, null);
  4900. this.entryFilter = this._getValue(this._options.entryFilter, null);
  4901. this.errorFilter = this._getValue(this._options.errorFilter, null);
  4902. this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$3.sep);
  4903. this.fsScandirSettings = new fsScandir.Settings({
  4904. followSymbolicLinks: this._options.followSymbolicLinks,
  4905. fs: this._options.fs,
  4906. pathSegmentSeparator: this._options.pathSegmentSeparator,
  4907. stats: this._options.stats,
  4908. throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink
  4909. });
  4910. }
  4911. _getValue(option, value) {
  4912. return option !== null && option !== void 0 ? option : value;
  4913. }
  4914. };
  4915. exports.default = Settings;
  4916. }));
  4917. //#endregion
  4918. //#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/index.js
  4919. var require_out$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
  4920. Object.defineProperty(exports, "__esModule", { value: true });
  4921. exports.Settings = exports.walkStream = exports.walkSync = exports.walk = void 0;
  4922. const async_1 = require_async$2();
  4923. const stream_1 = require_stream$2();
  4924. const sync_1 = require_sync$2();
  4925. const settings_1 = require_settings$1();
  4926. exports.Settings = settings_1.default;
  4927. function walk(directory, optionsOrSettingsOrCallback, callback) {
  4928. if (typeof optionsOrSettingsOrCallback === "function") {
  4929. new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback);
  4930. return;
  4931. }
  4932. new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback);
  4933. }
  4934. exports.walk = walk;
  4935. function walkSync(directory, optionsOrSettings) {
  4936. const settings = getSettings(optionsOrSettings);
  4937. return new sync_1.default(directory, settings).read();
  4938. }
  4939. exports.walkSync = walkSync;
  4940. function walkStream(directory, optionsOrSettings) {
  4941. const settings = getSettings(optionsOrSettings);
  4942. return new stream_1.default(directory, settings).read();
  4943. }
  4944. exports.walkStream = walkStream;
  4945. function getSettings(settingsOrOptions = {}) {
  4946. if (settingsOrOptions instanceof settings_1.default) return settingsOrOptions;
  4947. return new settings_1.default(settingsOrOptions);
  4948. }
  4949. }));
  4950. //#endregion
  4951. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/reader.js
  4952. var require_reader = /* @__PURE__ */ __commonJSMin(((exports) => {
  4953. Object.defineProperty(exports, "__esModule", { value: true });
  4954. const path$2 = __require("path");
  4955. const fsStat = require_out$3();
  4956. const utils = require_utils$1();
  4957. var Reader = class {
  4958. constructor(_settings) {
  4959. this._settings = _settings;
  4960. this._fsStatSettings = new fsStat.Settings({
  4961. followSymbolicLink: this._settings.followSymbolicLinks,
  4962. fs: this._settings.fs,
  4963. throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
  4964. });
  4965. }
  4966. _getFullEntryPath(filepath) {
  4967. return path$2.resolve(this._settings.cwd, filepath);
  4968. }
  4969. _makeEntry(stats, pattern) {
  4970. const entry = {
  4971. name: pattern,
  4972. path: pattern,
  4973. dirent: utils.fs.createDirentFromStats(pattern, stats)
  4974. };
  4975. if (this._settings.stats) entry.stats = stats;
  4976. return entry;
  4977. }
  4978. _isFatalError(error) {
  4979. return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
  4980. }
  4981. };
  4982. exports.default = Reader;
  4983. }));
  4984. //#endregion
  4985. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/stream.js
  4986. var require_stream$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
  4987. Object.defineProperty(exports, "__esModule", { value: true });
  4988. const stream_1$1 = __require("stream");
  4989. const fsStat = require_out$3();
  4990. const fsWalk = require_out$1();
  4991. const reader_1 = require_reader();
  4992. var ReaderStream = class extends reader_1.default {
  4993. constructor() {
  4994. super(...arguments);
  4995. this._walkStream = fsWalk.walkStream;
  4996. this._stat = fsStat.stat;
  4997. }
  4998. dynamic(root, options) {
  4999. return this._walkStream(root, options);
  5000. }
  5001. static(patterns, options) {
  5002. const filepaths = patterns.map(this._getFullEntryPath, this);
  5003. const stream = new stream_1$1.PassThrough({ objectMode: true });
  5004. stream._write = (index, _enc, done) => {
  5005. return this._getEntry(filepaths[index], patterns[index], options).then((entry) => {
  5006. if (entry !== null && options.entryFilter(entry)) stream.push(entry);
  5007. if (index === filepaths.length - 1) stream.end();
  5008. done();
  5009. }).catch(done);
  5010. };
  5011. for (let i = 0; i < filepaths.length; i++) stream.write(i);
  5012. return stream;
  5013. }
  5014. _getEntry(filepath, pattern, options) {
  5015. return this._getStat(filepath).then((stats) => this._makeEntry(stats, pattern)).catch((error) => {
  5016. if (options.errorFilter(error)) return null;
  5017. throw error;
  5018. });
  5019. }
  5020. _getStat(filepath) {
  5021. return new Promise((resolve, reject) => {
  5022. this._stat(filepath, this._fsStatSettings, (error, stats) => {
  5023. return error === null ? resolve(stats) : reject(error);
  5024. });
  5025. });
  5026. }
  5027. };
  5028. exports.default = ReaderStream;
  5029. }));
  5030. //#endregion
  5031. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/async.js
  5032. var require_async$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
  5033. Object.defineProperty(exports, "__esModule", { value: true });
  5034. const fsWalk = require_out$1();
  5035. const reader_1 = require_reader();
  5036. const stream_1 = require_stream$1();
  5037. var ReaderAsync = class extends reader_1.default {
  5038. constructor() {
  5039. super(...arguments);
  5040. this._walkAsync = fsWalk.walk;
  5041. this._readerStream = new stream_1.default(this._settings);
  5042. }
  5043. dynamic(root, options) {
  5044. return new Promise((resolve, reject) => {
  5045. this._walkAsync(root, options, (error, entries) => {
  5046. if (error === null) resolve(entries);
  5047. else reject(error);
  5048. });
  5049. });
  5050. }
  5051. async static(patterns, options) {
  5052. const entries = [];
  5053. const stream = this._readerStream.static(patterns, options);
  5054. return new Promise((resolve, reject) => {
  5055. stream.once("error", reject);
  5056. stream.on("data", (entry) => entries.push(entry));
  5057. stream.once("end", () => resolve(entries));
  5058. });
  5059. }
  5060. };
  5061. exports.default = ReaderAsync;
  5062. }));
  5063. //#endregion
  5064. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/matchers/matcher.js
  5065. var require_matcher = /* @__PURE__ */ __commonJSMin(((exports) => {
  5066. Object.defineProperty(exports, "__esModule", { value: true });
  5067. const utils = require_utils$1();
  5068. var Matcher = class {
  5069. constructor(_patterns, _settings, _micromatchOptions) {
  5070. this._patterns = _patterns;
  5071. this._settings = _settings;
  5072. this._micromatchOptions = _micromatchOptions;
  5073. this._storage = [];
  5074. this._fillStorage();
  5075. }
  5076. _fillStorage() {
  5077. for (const pattern of this._patterns) {
  5078. const segments = this._getPatternSegments(pattern);
  5079. const sections = this._splitSegmentsIntoSections(segments);
  5080. this._storage.push({
  5081. complete: sections.length <= 1,
  5082. pattern,
  5083. segments,
  5084. sections
  5085. });
  5086. }
  5087. }
  5088. _getPatternSegments(pattern) {
  5089. return utils.pattern.getPatternParts(pattern, this._micromatchOptions).map((part) => {
  5090. if (!utils.pattern.isDynamicPattern(part, this._settings)) return {
  5091. dynamic: false,
  5092. pattern: part
  5093. };
  5094. return {
  5095. dynamic: true,
  5096. pattern: part,
  5097. patternRe: utils.pattern.makeRe(part, this._micromatchOptions)
  5098. };
  5099. });
  5100. }
  5101. _splitSegmentsIntoSections(segments) {
  5102. return utils.array.splitWhen(segments, (segment) => segment.dynamic && utils.pattern.hasGlobStar(segment.pattern));
  5103. }
  5104. };
  5105. exports.default = Matcher;
  5106. }));
  5107. //#endregion
  5108. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/matchers/partial.js
  5109. var require_partial = /* @__PURE__ */ __commonJSMin(((exports) => {
  5110. Object.defineProperty(exports, "__esModule", { value: true });
  5111. const matcher_1 = require_matcher();
  5112. var PartialMatcher = class extends matcher_1.default {
  5113. match(filepath) {
  5114. const parts = filepath.split("/");
  5115. const levels = parts.length;
  5116. const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels);
  5117. for (const pattern of patterns) {
  5118. const section = pattern.sections[0];
  5119. /**
  5120. * In this case, the pattern has a globstar and we must read all directories unconditionally,
  5121. * but only if the level has reached the end of the first group.
  5122. *
  5123. * fixtures/{a,b}/**
  5124. * ^ true/false ^ always true
  5125. */
  5126. if (!pattern.complete && levels > section.length) return true;
  5127. if (parts.every((part, index) => {
  5128. const segment = pattern.segments[index];
  5129. if (segment.dynamic && segment.patternRe.test(part)) return true;
  5130. if (!segment.dynamic && segment.pattern === part) return true;
  5131. return false;
  5132. })) return true;
  5133. }
  5134. return false;
  5135. }
  5136. };
  5137. exports.default = PartialMatcher;
  5138. }));
  5139. //#endregion
  5140. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/filters/deep.js
  5141. var require_deep = /* @__PURE__ */ __commonJSMin(((exports) => {
  5142. Object.defineProperty(exports, "__esModule", { value: true });
  5143. const utils = require_utils$1();
  5144. const partial_1 = require_partial();
  5145. var DeepFilter = class {
  5146. constructor(_settings, _micromatchOptions) {
  5147. this._settings = _settings;
  5148. this._micromatchOptions = _micromatchOptions;
  5149. }
  5150. getFilter(basePath, positive, negative) {
  5151. const matcher = this._getMatcher(positive);
  5152. const negativeRe = this._getNegativePatternsRe(negative);
  5153. return (entry) => this._filter(basePath, entry, matcher, negativeRe);
  5154. }
  5155. _getMatcher(patterns) {
  5156. return new partial_1.default(patterns, this._settings, this._micromatchOptions);
  5157. }
  5158. _getNegativePatternsRe(patterns) {
  5159. const affectDepthOfReadingPatterns = patterns.filter(utils.pattern.isAffectDepthOfReadingPattern);
  5160. return utils.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions);
  5161. }
  5162. _filter(basePath, entry, matcher, negativeRe) {
  5163. if (this._isSkippedByDeep(basePath, entry.path)) return false;
  5164. if (this._isSkippedSymbolicLink(entry)) return false;
  5165. const filepath = utils.path.removeLeadingDotSegment(entry.path);
  5166. if (this._isSkippedByPositivePatterns(filepath, matcher)) return false;
  5167. return this._isSkippedByNegativePatterns(filepath, negativeRe);
  5168. }
  5169. _isSkippedByDeep(basePath, entryPath) {
  5170. /**
  5171. * Avoid unnecessary depth calculations when it doesn't matter.
  5172. */
  5173. if (this._settings.deep === Infinity) return false;
  5174. return this._getEntryLevel(basePath, entryPath) >= this._settings.deep;
  5175. }
  5176. _getEntryLevel(basePath, entryPath) {
  5177. const entryPathDepth = entryPath.split("/").length;
  5178. if (basePath === "") return entryPathDepth;
  5179. return entryPathDepth - basePath.split("/").length;
  5180. }
  5181. _isSkippedSymbolicLink(entry) {
  5182. return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
  5183. }
  5184. _isSkippedByPositivePatterns(entryPath, matcher) {
  5185. return !this._settings.baseNameMatch && !matcher.match(entryPath);
  5186. }
  5187. _isSkippedByNegativePatterns(entryPath, patternsRe) {
  5188. return !utils.pattern.matchAny(entryPath, patternsRe);
  5189. }
  5190. };
  5191. exports.default = DeepFilter;
  5192. }));
  5193. //#endregion
  5194. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/filters/entry.js
  5195. var require_entry$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
  5196. Object.defineProperty(exports, "__esModule", { value: true });
  5197. const utils = require_utils$1();
  5198. var EntryFilter = class {
  5199. constructor(_settings, _micromatchOptions) {
  5200. this._settings = _settings;
  5201. this._micromatchOptions = _micromatchOptions;
  5202. this.index = /* @__PURE__ */ new Map();
  5203. }
  5204. getFilter(positive, negative) {
  5205. const [absoluteNegative, relativeNegative] = utils.pattern.partitionAbsoluteAndRelative(negative);
  5206. const patterns = {
  5207. positive: { all: utils.pattern.convertPatternsToRe(positive, this._micromatchOptions) },
  5208. negative: {
  5209. absolute: utils.pattern.convertPatternsToRe(absoluteNegative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true })),
  5210. relative: utils.pattern.convertPatternsToRe(relativeNegative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true }))
  5211. }
  5212. };
  5213. return (entry) => this._filter(entry, patterns);
  5214. }
  5215. _filter(entry, patterns) {
  5216. const filepath = utils.path.removeLeadingDotSegment(entry.path);
  5217. if (this._settings.unique && this._isDuplicateEntry(filepath)) return false;
  5218. if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) return false;
  5219. const isMatched = this._isMatchToPatternsSet(filepath, patterns, entry.dirent.isDirectory());
  5220. if (this._settings.unique && isMatched) this._createIndexRecord(filepath);
  5221. return isMatched;
  5222. }
  5223. _isDuplicateEntry(filepath) {
  5224. return this.index.has(filepath);
  5225. }
  5226. _createIndexRecord(filepath) {
  5227. this.index.set(filepath, void 0);
  5228. }
  5229. _onlyFileFilter(entry) {
  5230. return this._settings.onlyFiles && !entry.dirent.isFile();
  5231. }
  5232. _onlyDirectoryFilter(entry) {
  5233. return this._settings.onlyDirectories && !entry.dirent.isDirectory();
  5234. }
  5235. _isMatchToPatternsSet(filepath, patterns, isDirectory) {
  5236. if (!this._isMatchToPatterns(filepath, patterns.positive.all, isDirectory)) return false;
  5237. if (this._isMatchToPatterns(filepath, patterns.negative.relative, isDirectory)) return false;
  5238. if (this._isMatchToAbsoluteNegative(filepath, patterns.negative.absolute, isDirectory)) return false;
  5239. return true;
  5240. }
  5241. _isMatchToAbsoluteNegative(filepath, patternsRe, isDirectory) {
  5242. if (patternsRe.length === 0) return false;
  5243. const fullpath = utils.path.makeAbsolute(this._settings.cwd, filepath);
  5244. return this._isMatchToPatterns(fullpath, patternsRe, isDirectory);
  5245. }
  5246. _isMatchToPatterns(filepath, patternsRe, isDirectory) {
  5247. if (patternsRe.length === 0) return false;
  5248. const isMatched = utils.pattern.matchAny(filepath, patternsRe);
  5249. if (!isMatched && isDirectory) return utils.pattern.matchAny(filepath + "/", patternsRe);
  5250. return isMatched;
  5251. }
  5252. };
  5253. exports.default = EntryFilter;
  5254. }));
  5255. //#endregion
  5256. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/filters/error.js
  5257. var require_error = /* @__PURE__ */ __commonJSMin(((exports) => {
  5258. Object.defineProperty(exports, "__esModule", { value: true });
  5259. const utils = require_utils$1();
  5260. var ErrorFilter = class {
  5261. constructor(_settings) {
  5262. this._settings = _settings;
  5263. }
  5264. getFilter() {
  5265. return (error) => this._isNonFatalError(error);
  5266. }
  5267. _isNonFatalError(error) {
  5268. return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
  5269. }
  5270. };
  5271. exports.default = ErrorFilter;
  5272. }));
  5273. //#endregion
  5274. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/transformers/entry.js
  5275. var require_entry = /* @__PURE__ */ __commonJSMin(((exports) => {
  5276. Object.defineProperty(exports, "__esModule", { value: true });
  5277. const utils = require_utils$1();
  5278. var EntryTransformer = class {
  5279. constructor(_settings) {
  5280. this._settings = _settings;
  5281. }
  5282. getTransformer() {
  5283. return (entry) => this._transform(entry);
  5284. }
  5285. _transform(entry) {
  5286. let filepath = entry.path;
  5287. if (this._settings.absolute) {
  5288. filepath = utils.path.makeAbsolute(this._settings.cwd, filepath);
  5289. filepath = utils.path.unixify(filepath);
  5290. }
  5291. if (this._settings.markDirectories && entry.dirent.isDirectory()) filepath += "/";
  5292. if (!this._settings.objectMode) return filepath;
  5293. return Object.assign(Object.assign({}, entry), { path: filepath });
  5294. }
  5295. };
  5296. exports.default = EntryTransformer;
  5297. }));
  5298. //#endregion
  5299. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/provider.js
  5300. var require_provider = /* @__PURE__ */ __commonJSMin(((exports) => {
  5301. Object.defineProperty(exports, "__esModule", { value: true });
  5302. const path$1 = __require("path");
  5303. const deep_1 = require_deep();
  5304. const entry_1 = require_entry$1();
  5305. const error_1 = require_error();
  5306. const entry_2 = require_entry();
  5307. var Provider = class {
  5308. constructor(_settings) {
  5309. this._settings = _settings;
  5310. this.errorFilter = new error_1.default(this._settings);
  5311. this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions());
  5312. this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
  5313. this.entryTransformer = new entry_2.default(this._settings);
  5314. }
  5315. _getRootDirectory(task) {
  5316. return path$1.resolve(this._settings.cwd, task.base);
  5317. }
  5318. _getReaderOptions(task) {
  5319. const basePath = task.base === "." ? "" : task.base;
  5320. return {
  5321. basePath,
  5322. pathSegmentSeparator: "/",
  5323. concurrency: this._settings.concurrency,
  5324. deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
  5325. entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
  5326. errorFilter: this.errorFilter.getFilter(),
  5327. followSymbolicLinks: this._settings.followSymbolicLinks,
  5328. fs: this._settings.fs,
  5329. stats: this._settings.stats,
  5330. throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
  5331. transform: this.entryTransformer.getTransformer()
  5332. };
  5333. }
  5334. _getMicromatchOptions() {
  5335. return {
  5336. dot: this._settings.dot,
  5337. matchBase: this._settings.baseNameMatch,
  5338. nobrace: !this._settings.braceExpansion,
  5339. nocase: !this._settings.caseSensitiveMatch,
  5340. noext: !this._settings.extglob,
  5341. noglobstar: !this._settings.globstar,
  5342. posix: true,
  5343. strictSlashes: false
  5344. };
  5345. }
  5346. };
  5347. exports.default = Provider;
  5348. }));
  5349. //#endregion
  5350. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/async.js
  5351. var require_async = /* @__PURE__ */ __commonJSMin(((exports) => {
  5352. Object.defineProperty(exports, "__esModule", { value: true });
  5353. const async_1 = require_async$1();
  5354. const provider_1 = require_provider();
  5355. var ProviderAsync = class extends provider_1.default {
  5356. constructor() {
  5357. super(...arguments);
  5358. this._reader = new async_1.default(this._settings);
  5359. }
  5360. async read(task) {
  5361. const root = this._getRootDirectory(task);
  5362. const options = this._getReaderOptions(task);
  5363. return (await this.api(root, task, options)).map((entry) => options.transform(entry));
  5364. }
  5365. api(root, task, options) {
  5366. if (task.dynamic) return this._reader.dynamic(root, options);
  5367. return this._reader.static(task.patterns, options);
  5368. }
  5369. };
  5370. exports.default = ProviderAsync;
  5371. }));
  5372. //#endregion
  5373. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/stream.js
  5374. var require_stream = /* @__PURE__ */ __commonJSMin(((exports) => {
  5375. Object.defineProperty(exports, "__esModule", { value: true });
  5376. const stream_1 = __require("stream");
  5377. const stream_2 = require_stream$1();
  5378. const provider_1 = require_provider();
  5379. var ProviderStream = class extends provider_1.default {
  5380. constructor() {
  5381. super(...arguments);
  5382. this._reader = new stream_2.default(this._settings);
  5383. }
  5384. read(task) {
  5385. const root = this._getRootDirectory(task);
  5386. const options = this._getReaderOptions(task);
  5387. const source = this.api(root, task, options);
  5388. const destination = new stream_1.Readable({
  5389. objectMode: true,
  5390. read: () => {}
  5391. });
  5392. source.once("error", (error) => destination.emit("error", error)).on("data", (entry) => destination.emit("data", options.transform(entry))).once("end", () => destination.emit("end"));
  5393. destination.once("close", () => source.destroy());
  5394. return destination;
  5395. }
  5396. api(root, task, options) {
  5397. if (task.dynamic) return this._reader.dynamic(root, options);
  5398. return this._reader.static(task.patterns, options);
  5399. }
  5400. };
  5401. exports.default = ProviderStream;
  5402. }));
  5403. //#endregion
  5404. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/sync.js
  5405. var require_sync$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
  5406. Object.defineProperty(exports, "__esModule", { value: true });
  5407. const fsStat = require_out$3();
  5408. const fsWalk = require_out$1();
  5409. const reader_1 = require_reader();
  5410. var ReaderSync = class extends reader_1.default {
  5411. constructor() {
  5412. super(...arguments);
  5413. this._walkSync = fsWalk.walkSync;
  5414. this._statSync = fsStat.statSync;
  5415. }
  5416. dynamic(root, options) {
  5417. return this._walkSync(root, options);
  5418. }
  5419. static(patterns, options) {
  5420. const entries = [];
  5421. for (const pattern of patterns) {
  5422. const filepath = this._getFullEntryPath(pattern);
  5423. const entry = this._getEntry(filepath, pattern, options);
  5424. if (entry === null || !options.entryFilter(entry)) continue;
  5425. entries.push(entry);
  5426. }
  5427. return entries;
  5428. }
  5429. _getEntry(filepath, pattern, options) {
  5430. try {
  5431. const stats = this._getStat(filepath);
  5432. return this._makeEntry(stats, pattern);
  5433. } catch (error) {
  5434. if (options.errorFilter(error)) return null;
  5435. throw error;
  5436. }
  5437. }
  5438. _getStat(filepath) {
  5439. return this._statSync(filepath, this._fsStatSettings);
  5440. }
  5441. };
  5442. exports.default = ReaderSync;
  5443. }));
  5444. //#endregion
  5445. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/sync.js
  5446. var require_sync = /* @__PURE__ */ __commonJSMin(((exports) => {
  5447. Object.defineProperty(exports, "__esModule", { value: true });
  5448. const sync_1 = require_sync$1();
  5449. const provider_1 = require_provider();
  5450. var ProviderSync = class extends provider_1.default {
  5451. constructor() {
  5452. super(...arguments);
  5453. this._reader = new sync_1.default(this._settings);
  5454. }
  5455. read(task) {
  5456. const root = this._getRootDirectory(task);
  5457. const options = this._getReaderOptions(task);
  5458. return this.api(root, task, options).map(options.transform);
  5459. }
  5460. api(root, task, options) {
  5461. if (task.dynamic) return this._reader.dynamic(root, options);
  5462. return this._reader.static(task.patterns, options);
  5463. }
  5464. };
  5465. exports.default = ProviderSync;
  5466. }));
  5467. //#endregion
  5468. //#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/settings.js
  5469. var require_settings = /* @__PURE__ */ __commonJSMin(((exports) => {
  5470. Object.defineProperty(exports, "__esModule", { value: true });
  5471. exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
  5472. const fs$1 = __require("fs");
  5473. const os = __require("os");
  5474. /**
  5475. * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
  5476. * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
  5477. */
  5478. const CPU_COUNT = Math.max(os.cpus().length, 1);
  5479. exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
  5480. lstat: fs$1.lstat,
  5481. lstatSync: fs$1.lstatSync,
  5482. stat: fs$1.stat,
  5483. statSync: fs$1.statSync,
  5484. readdir: fs$1.readdir,
  5485. readdirSync: fs$1.readdirSync
  5486. };
  5487. var Settings = class {
  5488. constructor(_options = {}) {
  5489. this._options = _options;
  5490. this.absolute = this._getValue(this._options.absolute, false);
  5491. this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
  5492. this.braceExpansion = this._getValue(this._options.braceExpansion, true);
  5493. this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
  5494. this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
  5495. this.cwd = this._getValue(this._options.cwd, process.cwd());
  5496. this.deep = this._getValue(this._options.deep, Infinity);
  5497. this.dot = this._getValue(this._options.dot, false);
  5498. this.extglob = this._getValue(this._options.extglob, true);
  5499. this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
  5500. this.fs = this._getFileSystemMethods(this._options.fs);
  5501. this.globstar = this._getValue(this._options.globstar, true);
  5502. this.ignore = this._getValue(this._options.ignore, []);
  5503. this.markDirectories = this._getValue(this._options.markDirectories, false);
  5504. this.objectMode = this._getValue(this._options.objectMode, false);
  5505. this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
  5506. this.onlyFiles = this._getValue(this._options.onlyFiles, true);
  5507. this.stats = this._getValue(this._options.stats, false);
  5508. this.suppressErrors = this._getValue(this._options.suppressErrors, false);
  5509. this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
  5510. this.unique = this._getValue(this._options.unique, true);
  5511. if (this.onlyDirectories) this.onlyFiles = false;
  5512. if (this.stats) this.objectMode = true;
  5513. this.ignore = [].concat(this.ignore);
  5514. }
  5515. _getValue(option, value) {
  5516. return option === void 0 ? value : option;
  5517. }
  5518. _getFileSystemMethods(methods = {}) {
  5519. return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
  5520. }
  5521. };
  5522. exports.default = Settings;
  5523. }));
  5524. //#endregion
  5525. //#region ../../node_modules/.pnpm/image-meta@0.2.2/node_modules/image-meta/dist/index.mjs
  5526. var import_out = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
  5527. const taskManager = require_tasks();
  5528. const async_1 = require_async();
  5529. const stream_1 = require_stream();
  5530. const sync_1 = require_sync();
  5531. const settings_1 = require_settings();
  5532. const utils = require_utils$1();
  5533. async function FastGlob(source, options) {
  5534. assertPatternsInput(source);
  5535. const works = getWorks(source, async_1.default, options);
  5536. const result = await Promise.all(works);
  5537. return utils.array.flatten(result);
  5538. }
  5539. (function(FastGlob) {
  5540. FastGlob.glob = FastGlob;
  5541. FastGlob.globSync = sync;
  5542. FastGlob.globStream = stream;
  5543. FastGlob.async = FastGlob;
  5544. function sync(source, options) {
  5545. assertPatternsInput(source);
  5546. const works = getWorks(source, sync_1.default, options);
  5547. return utils.array.flatten(works);
  5548. }
  5549. FastGlob.sync = sync;
  5550. function stream(source, options) {
  5551. assertPatternsInput(source);
  5552. const works = getWorks(source, stream_1.default, options);
  5553. /**
  5554. * The stream returned by the provider cannot work with an asynchronous iterator.
  5555. * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams.
  5556. * This affects performance (+25%). I don't see best solution right now.
  5557. */
  5558. return utils.stream.merge(works);
  5559. }
  5560. FastGlob.stream = stream;
  5561. function generateTasks(source, options) {
  5562. assertPatternsInput(source);
  5563. const patterns = [].concat(source);
  5564. const settings = new settings_1.default(options);
  5565. return taskManager.generate(patterns, settings);
  5566. }
  5567. FastGlob.generateTasks = generateTasks;
  5568. function isDynamicPattern(source, options) {
  5569. assertPatternsInput(source);
  5570. const settings = new settings_1.default(options);
  5571. return utils.pattern.isDynamicPattern(source, settings);
  5572. }
  5573. FastGlob.isDynamicPattern = isDynamicPattern;
  5574. function escapePath(source) {
  5575. assertPatternsInput(source);
  5576. return utils.path.escape(source);
  5577. }
  5578. FastGlob.escapePath = escapePath;
  5579. function convertPathToPattern(source) {
  5580. assertPatternsInput(source);
  5581. return utils.path.convertPathToPattern(source);
  5582. }
  5583. FastGlob.convertPathToPattern = convertPathToPattern;
  5584. (function(posix) {
  5585. function escapePath(source) {
  5586. assertPatternsInput(source);
  5587. return utils.path.escapePosixPath(source);
  5588. }
  5589. posix.escapePath = escapePath;
  5590. function convertPathToPattern(source) {
  5591. assertPatternsInput(source);
  5592. return utils.path.convertPosixPathToPattern(source);
  5593. }
  5594. posix.convertPathToPattern = convertPathToPattern;
  5595. })(FastGlob.posix || (FastGlob.posix = {}));
  5596. (function(win32) {
  5597. function escapePath(source) {
  5598. assertPatternsInput(source);
  5599. return utils.path.escapeWindowsPath(source);
  5600. }
  5601. win32.escapePath = escapePath;
  5602. function convertPathToPattern(source) {
  5603. assertPatternsInput(source);
  5604. return utils.path.convertWindowsPathToPattern(source);
  5605. }
  5606. win32.convertPathToPattern = convertPathToPattern;
  5607. })(FastGlob.win32 || (FastGlob.win32 = {}));
  5608. })(FastGlob || (FastGlob = {}));
  5609. function getWorks(source, _Provider, options) {
  5610. const patterns = [].concat(source);
  5611. const settings = new settings_1.default(options);
  5612. const tasks = taskManager.generate(patterns, settings);
  5613. const provider = new _Provider(settings);
  5614. return tasks.map(provider.read, provider);
  5615. }
  5616. function assertPatternsInput(input) {
  5617. if (![].concat(input).every((item) => utils.string.isString(item) && !utils.string.isEmpty(item))) throw new TypeError("Patterns must be a string (non empty) or an array of strings");
  5618. }
  5619. module.exports = FastGlob;
  5620. })))(), 1);
  5621. const decoder = new TextDecoder();
  5622. const toUTF8String = (input, start = 0, end = input.length) => decoder.decode(input.slice(start, end));
  5623. const toHexString = (input, start = 0, end = input.length) => input.slice(start, end).reduce((memo, i) => memo + ("0" + i.toString(16)).slice(-2), "");
  5624. const readInt16LE = (input, offset = 0) => {
  5625. const val = input[offset] + input[offset + 1] * 2 ** 8;
  5626. return val | (val & 2 ** 15) * 131070;
  5627. };
  5628. const readUInt16BE = (input, offset = 0) => input[offset] * 2 ** 8 + input[offset + 1];
  5629. const readUInt16LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8;
  5630. const readUInt24LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16;
  5631. const readInt32LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16 + (input[offset + 3] << 24);
  5632. const readUInt32BE = (input, offset = 0) => input[offset] * 2 ** 24 + input[offset + 1] * 2 ** 16 + input[offset + 2] * 2 ** 8 + input[offset + 3];
  5633. const readUInt32LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16 + input[offset + 3] * 2 ** 24;
  5634. const methods = {
  5635. readUInt16BE,
  5636. readUInt16LE,
  5637. readUInt32BE,
  5638. readUInt32LE
  5639. };
  5640. function readUInt(input, bits, offset, isBigEndian) {
  5641. offset = offset || 0;
  5642. const endian = isBigEndian ? "BE" : "LE";
  5643. return methods["readUInt" + bits + endian](input, offset);
  5644. }
  5645. const BMP = {
  5646. validate: (input) => toUTF8String(input, 0, 2) === "BM",
  5647. calculate: (input) => ({
  5648. height: Math.abs(readInt32LE(input, 22)),
  5649. width: readUInt32LE(input, 18)
  5650. })
  5651. };
  5652. const TYPE_ICON = 1;
  5653. const SIZE_HEADER$1 = 6;
  5654. const SIZE_IMAGE_ENTRY = 16;
  5655. function getSizeFromOffset(input, offset) {
  5656. const value = input[offset];
  5657. return value === 0 ? 256 : value;
  5658. }
  5659. function getImageSize$1(input, imageIndex) {
  5660. const offset = SIZE_HEADER$1 + imageIndex * SIZE_IMAGE_ENTRY;
  5661. return {
  5662. height: getSizeFromOffset(input, offset + 1),
  5663. width: getSizeFromOffset(input, offset)
  5664. };
  5665. }
  5666. const ICO = {
  5667. validate(input) {
  5668. const reserved = readUInt16LE(input, 0);
  5669. const imageCount = readUInt16LE(input, 4);
  5670. if (reserved !== 0 || imageCount === 0) return false;
  5671. return readUInt16LE(input, 2) === TYPE_ICON;
  5672. },
  5673. calculate(input) {
  5674. const nbImages = readUInt16LE(input, 4);
  5675. const imageSize = getImageSize$1(input, 0);
  5676. if (nbImages === 1) return imageSize;
  5677. const imgs = [imageSize];
  5678. for (let imageIndex = 1; imageIndex < nbImages; imageIndex += 1) imgs.push(getImageSize$1(input, imageIndex));
  5679. return {
  5680. height: imageSize.height,
  5681. images: imgs,
  5682. width: imageSize.width
  5683. };
  5684. }
  5685. };
  5686. const TYPE_CURSOR = 2;
  5687. const CUR = {
  5688. validate(input) {
  5689. const reserved = readUInt16LE(input, 0);
  5690. const imageCount = readUInt16LE(input, 4);
  5691. if (reserved !== 0 || imageCount === 0) return false;
  5692. return readUInt16LE(input, 2) === TYPE_CURSOR;
  5693. },
  5694. calculate: (input) => ICO.calculate(input)
  5695. };
  5696. const DDS = {
  5697. validate: (input) => readUInt32LE(input, 0) === 542327876,
  5698. calculate: (input) => ({
  5699. height: readUInt32LE(input, 12),
  5700. width: readUInt32LE(input, 16)
  5701. })
  5702. };
  5703. const gifRegexp = /^GIF8[79]a/;
  5704. const GIF = {
  5705. validate: (input) => gifRegexp.test(toUTF8String(input, 0, 6)),
  5706. calculate: (input) => ({
  5707. height: readUInt16LE(input, 8),
  5708. width: readUInt16LE(input, 6)
  5709. })
  5710. };
  5711. const HEIC = {
  5712. validate: (input) => {
  5713. const ftypBox = findBox$1(input, "ftyp");
  5714. if (!ftypBox) return false;
  5715. const majorBrand = toUTF8String(input, ftypBox.offset + 8, ftypBox.offset + 12);
  5716. return [
  5717. "heic",
  5718. "heix",
  5719. "hevc",
  5720. "hevx",
  5721. "mif1",
  5722. "msf1"
  5723. ].includes(majorBrand);
  5724. },
  5725. calculate: (input) => {
  5726. const metaBox = findBox$1(input, "meta");
  5727. if (!metaBox) throw new TypeError("heic: meta box not found");
  5728. const iprpBox = findBox$1(input, "iprp", metaBox.offset + 12, metaBox.offset + metaBox.size);
  5729. if (!iprpBox) throw new TypeError("heic: iprp box not found");
  5730. const ipcoBox = findBox$1(input, "ipco", iprpBox.offset + 8, iprpBox.offset + iprpBox.size);
  5731. if (!ipcoBox) throw new TypeError("heic: ipco box not found");
  5732. const dimensions = findAllBoxes(input, "ispe", ipcoBox.offset + 8, ipcoBox.offset + ipcoBox.size).map((box) => ({
  5733. width: readUInt32BE(input, box.offset + 12),
  5734. height: readUInt32BE(input, box.offset + 16)
  5735. }));
  5736. if (dimensions.length === 0) throw new TypeError("heic: ispe box not found");
  5737. let largestDimension = dimensions[0];
  5738. for (let i = 1; i < dimensions.length; i++) {
  5739. const curr = dimensions[i];
  5740. if (curr.width * curr.height > largestDimension.width * largestDimension.height) largestDimension = curr;
  5741. }
  5742. return largestDimension;
  5743. }
  5744. };
  5745. function findBox$1(input, type, startOffset = 0, endOffset = input.length) {
  5746. let offset = startOffset;
  5747. while (offset < endOffset) {
  5748. const size = readUInt32BE(input, offset);
  5749. if (toUTF8String(input, offset + 4, offset + 8) === type) return {
  5750. offset,
  5751. size
  5752. };
  5753. if (size <= 0 || offset + size > endOffset) break;
  5754. offset += size;
  5755. }
  5756. }
  5757. function findAllBoxes(input, type, startOffset = 0, endOffset = input.length) {
  5758. let offset = startOffset;
  5759. const boxes = [];
  5760. while (offset < endOffset) {
  5761. const size = readUInt32BE(input, offset);
  5762. if (toUTF8String(input, offset + 4, offset + 8) === type) boxes.push({
  5763. offset,
  5764. size
  5765. });
  5766. if (size <= 0 || offset + size > endOffset) break;
  5767. offset += size;
  5768. }
  5769. return boxes;
  5770. }
  5771. const SIZE_HEADER = 8;
  5772. const FILE_LENGTH_OFFSET = 4;
  5773. const ENTRY_LENGTH_OFFSET = 4;
  5774. const ICON_TYPE_SIZE = {
  5775. ICON: 32,
  5776. "ICN#": 32,
  5777. "icm#": 16,
  5778. icm4: 16,
  5779. icm8: 16,
  5780. "ics#": 16,
  5781. ics4: 16,
  5782. ics8: 16,
  5783. is32: 16,
  5784. s8mk: 16,
  5785. icp4: 16,
  5786. icl4: 32,
  5787. icl8: 32,
  5788. il32: 32,
  5789. l8mk: 32,
  5790. icp5: 32,
  5791. ic11: 32,
  5792. ich4: 48,
  5793. ich8: 48,
  5794. ih32: 48,
  5795. h8mk: 48,
  5796. icp6: 64,
  5797. ic12: 32,
  5798. it32: 128,
  5799. t8mk: 128,
  5800. ic07: 128,
  5801. ic08: 256,
  5802. ic13: 256,
  5803. ic09: 512,
  5804. ic14: 512,
  5805. ic10: 1024
  5806. };
  5807. function readImageHeader(input, imageOffset) {
  5808. const imageLengthOffset = imageOffset + ENTRY_LENGTH_OFFSET;
  5809. return [toUTF8String(input, imageOffset, imageLengthOffset), readUInt32BE(input, imageLengthOffset)];
  5810. }
  5811. function getImageSize(type) {
  5812. const size = ICON_TYPE_SIZE[type];
  5813. return {
  5814. width: size,
  5815. height: size,
  5816. type
  5817. };
  5818. }
  5819. const ICNS = {
  5820. validate: (input) => toUTF8String(input, 0, 4) === "icns",
  5821. calculate(input) {
  5822. const inputLength = input.length;
  5823. const fileLength = readUInt32BE(input, FILE_LENGTH_OFFSET);
  5824. let imageOffset = SIZE_HEADER;
  5825. let imageHeader = readImageHeader(input, imageOffset);
  5826. let imageSize = getImageSize(imageHeader[0]);
  5827. imageOffset += imageHeader[1];
  5828. if (imageOffset === fileLength) return imageSize;
  5829. const result = {
  5830. height: imageSize.height,
  5831. images: [imageSize],
  5832. width: imageSize.width
  5833. };
  5834. while (imageOffset < fileLength && imageOffset < inputLength) {
  5835. imageHeader = readImageHeader(input, imageOffset);
  5836. imageSize = getImageSize(imageHeader[0]);
  5837. imageOffset += imageHeader[1];
  5838. result.images.push(imageSize);
  5839. }
  5840. return result;
  5841. }
  5842. };
  5843. const J2C = {
  5844. validate: (input) => toHexString(input, 0, 4) === "ff4fff51",
  5845. calculate: (input) => ({
  5846. height: readUInt32BE(input, 12),
  5847. width: readUInt32BE(input, 8)
  5848. })
  5849. };
  5850. const BoxTypes = {
  5851. ftyp: "66747970",
  5852. jp2h: "6a703268",
  5853. jp__: "6a502020",
  5854. rreq: "72726571"
  5855. };
  5856. const calculateRREQLength = (box) => {
  5857. const unit = box[0];
  5858. let offset = 1 + 2 * unit;
  5859. const flagsLength = readUInt16BE(box, offset) * (2 + unit);
  5860. offset = offset + 2 + flagsLength;
  5861. const featuresLength = readUInt16BE(box, offset) * (16 + unit);
  5862. return offset + 2 + featuresLength;
  5863. };
  5864. const parseIHDR = (box) => {
  5865. return {
  5866. height: readUInt32BE(box, 4),
  5867. width: readUInt32BE(box, 8)
  5868. };
  5869. };
  5870. const JP2 = {
  5871. validate(input) {
  5872. const signature = toHexString(input, 4, 8);
  5873. const signatureLength = readUInt32BE(input, 0);
  5874. if (signature !== BoxTypes.jp__ || signatureLength < 1) return false;
  5875. const ftypeBoxStart = signatureLength + 4;
  5876. const ftypBoxLength = readUInt32BE(input, signatureLength);
  5877. return toHexString(input.slice(ftypeBoxStart, ftypeBoxStart + ftypBoxLength), 0, 4) === BoxTypes.ftyp;
  5878. },
  5879. calculate(input) {
  5880. const signatureLength = readUInt32BE(input, 0);
  5881. const ftypBoxLength = readUInt16BE(input, signatureLength + 2);
  5882. let offset = signatureLength + 4 + ftypBoxLength;
  5883. switch (toHexString(input, offset, offset + 4)) {
  5884. case BoxTypes.rreq:
  5885. offset = offset + 4 + 4 + calculateRREQLength(input.slice(offset + 4));
  5886. return parseIHDR(input.slice(offset + 8, offset + 24));
  5887. case BoxTypes.jp2h: return parseIHDR(input.slice(offset + 8, offset + 24));
  5888. default: throw new TypeError("Unsupported header found: " + toUTF8String(input, offset, offset + 4));
  5889. }
  5890. }
  5891. };
  5892. const EXIF_MARKER = "45786966";
  5893. const APP1_DATA_SIZE_BYTES = 2;
  5894. const EXIF_HEADER_BYTES = 6;
  5895. const TIFF_BYTE_ALIGN_BYTES = 2;
  5896. const BIG_ENDIAN_BYTE_ALIGN = "4d4d";
  5897. const LITTLE_ENDIAN_BYTE_ALIGN = "4949";
  5898. const IDF_ENTRY_BYTES = 12;
  5899. const NUM_DIRECTORY_ENTRIES_BYTES = 2;
  5900. function isEXIF(input) {
  5901. return toHexString(input, 2, 6) === EXIF_MARKER;
  5902. }
  5903. function extractSize(input, index) {
  5904. return {
  5905. height: readUInt16BE(input, index),
  5906. width: readUInt16BE(input, index + 2)
  5907. };
  5908. }
  5909. function extractOrientation(exifBlock, isBigEndian) {
  5910. const offset = EXIF_HEADER_BYTES + 8;
  5911. const idfDirectoryEntries = readUInt(exifBlock, 16, offset, isBigEndian);
  5912. for (let directoryEntryNumber = 0; directoryEntryNumber < idfDirectoryEntries; directoryEntryNumber++) {
  5913. const start = offset + NUM_DIRECTORY_ENTRIES_BYTES + directoryEntryNumber * IDF_ENTRY_BYTES;
  5914. const end = start + IDF_ENTRY_BYTES;
  5915. if (start > exifBlock.length) return;
  5916. const block = exifBlock.slice(start, end);
  5917. if (readUInt(block, 16, 0, isBigEndian) === 274) {
  5918. if (readUInt(block, 16, 2, isBigEndian) !== 3) return;
  5919. if (readUInt(block, 32, 4, isBigEndian) !== 1) return;
  5920. return readUInt(block, 16, 8, isBigEndian);
  5921. }
  5922. }
  5923. }
  5924. function validateExifBlock(input, index) {
  5925. const exifBlock = input.slice(APP1_DATA_SIZE_BYTES, index);
  5926. const byteAlign = toHexString(exifBlock, EXIF_HEADER_BYTES, EXIF_HEADER_BYTES + TIFF_BYTE_ALIGN_BYTES);
  5927. const isBigEndian = byteAlign === BIG_ENDIAN_BYTE_ALIGN;
  5928. if (isBigEndian || byteAlign === LITTLE_ENDIAN_BYTE_ALIGN) return extractOrientation(exifBlock, isBigEndian);
  5929. }
  5930. function validateInput(input, index) {
  5931. if (index > input.length) throw new TypeError("Corrupt JPG, exceeded buffer limits");
  5932. if (input[index] !== 255) throw new TypeError("Invalid JPG, marker table corrupted");
  5933. }
  5934. const JPG = {
  5935. validate: (input) => toHexString(input, 0, 2) === "ffd8",
  5936. calculate(input) {
  5937. input = input.slice(4);
  5938. let orientation;
  5939. let next;
  5940. while (input.length > 0) {
  5941. const i = readUInt16BE(input, 0);
  5942. if (isEXIF(input)) orientation = validateExifBlock(input, i);
  5943. validateInput(input, i);
  5944. next = input[i + 1];
  5945. if (next === 192 || next === 193 || next === 194) {
  5946. const size = extractSize(input, i + 5);
  5947. if (!orientation) return size;
  5948. return {
  5949. height: size.height,
  5950. orientation,
  5951. width: size.width
  5952. };
  5953. }
  5954. input = input.slice(i + 2);
  5955. }
  5956. throw new TypeError("Invalid JPG, no size found");
  5957. }
  5958. };
  5959. const KTX = {
  5960. validate: (input) => toUTF8String(input, 1, 7) === "KTX 11",
  5961. calculate: (input) => ({
  5962. height: readUInt32LE(input, 40),
  5963. width: readUInt32LE(input, 36)
  5964. })
  5965. };
  5966. const pngSignature = "PNG\r\n\n";
  5967. const pngImageHeaderChunkName = "IHDR";
  5968. const pngFriedChunkName = "CgBI";
  5969. const PNG = {
  5970. validate(input) {
  5971. if (pngSignature === toUTF8String(input, 1, 8)) {
  5972. let chunkName = toUTF8String(input, 12, 16);
  5973. if (chunkName === pngFriedChunkName) chunkName = toUTF8String(input, 28, 32);
  5974. if (chunkName !== pngImageHeaderChunkName) throw new TypeError("Invalid PNG");
  5975. return true;
  5976. }
  5977. return false;
  5978. },
  5979. calculate(input) {
  5980. if (toUTF8String(input, 12, 16) === pngFriedChunkName) return {
  5981. height: readUInt32BE(input, 36),
  5982. width: readUInt32BE(input, 32)
  5983. };
  5984. return {
  5985. height: readUInt32BE(input, 20),
  5986. width: readUInt32BE(input, 16)
  5987. };
  5988. }
  5989. };
  5990. const PNMTypes = {
  5991. P1: "pbm/ascii",
  5992. P2: "pgm/ascii",
  5993. P3: "ppm/ascii",
  5994. P4: "pbm",
  5995. P5: "pgm",
  5996. P6: "ppm",
  5997. P7: "pam",
  5998. PF: "pfm"
  5999. };
  6000. const handlers = {
  6001. default: (lines) => {
  6002. let dimensions = [];
  6003. while (lines.length > 0) {
  6004. const line = lines.shift();
  6005. if (line[0] === "#") continue;
  6006. dimensions = line.split(" ");
  6007. break;
  6008. }
  6009. if (dimensions.length === 2) return {
  6010. height: Number.parseInt(dimensions[1], 10),
  6011. width: Number.parseInt(dimensions[0], 10)
  6012. };
  6013. else throw new TypeError("Invalid PNM");
  6014. },
  6015. pam: (lines) => {
  6016. const size = {};
  6017. while (lines.length > 0) {
  6018. const line = lines.shift();
  6019. if (line.length > 16 || (line.codePointAt(0) || 0) > 128) continue;
  6020. const [key, value] = line.split(" ");
  6021. if (key && value) size[key.toLowerCase()] = Number.parseInt(value, 10);
  6022. if (size.height && size.width) break;
  6023. }
  6024. if (size.height && size.width) return {
  6025. height: size.height,
  6026. width: size.width
  6027. };
  6028. else throw new TypeError("Invalid PAM");
  6029. }
  6030. };
  6031. const PNM = {
  6032. validate: (input) => toUTF8String(input, 0, 2) in PNMTypes,
  6033. calculate(input) {
  6034. const type = PNMTypes[toUTF8String(input, 0, 2)];
  6035. const lines = toUTF8String(input, 3).split(/[\n\r]+/);
  6036. return (handlers[type] || handlers.default)(lines);
  6037. }
  6038. };
  6039. const PSD = {
  6040. validate: (input) => toUTF8String(input, 0, 4) === "8BPS",
  6041. calculate: (input) => ({
  6042. height: readUInt32BE(input, 14),
  6043. width: readUInt32BE(input, 18)
  6044. })
  6045. };
  6046. const svgReg = /<svg\s([^"'>]|"[^"]*"|'[^']*')*>/;
  6047. const extractorRegExps = {
  6048. height: /\sheight=(["'])([^%]+?)\1/,
  6049. root: svgReg,
  6050. viewbox: /\sviewbox=(["'])(.+?)\1/i,
  6051. width: /\swidth=(["'])([^%]+?)\1/
  6052. };
  6053. const INCH_CM = 2.54;
  6054. const units = {
  6055. in: 96,
  6056. cm: 96 / INCH_CM,
  6057. em: 16,
  6058. ex: 8,
  6059. m: 96 / INCH_CM * 100,
  6060. mm: 96 / INCH_CM / 10,
  6061. pc: 96 / 72 / 12,
  6062. pt: 96 / 72,
  6063. px: 1
  6064. };
  6065. const unitsReg = new RegExp(`^([0-9.]+(?:e\\d+)?)(${Object.keys(units).join("|")})?$`);
  6066. function parseLength(len) {
  6067. const m = unitsReg.exec(len);
  6068. if (!m) return;
  6069. return Math.round(Number(m[1]) * (units[m[2]] || 1));
  6070. }
  6071. function parseViewbox(viewbox) {
  6072. const bounds = viewbox.split(" ");
  6073. return {
  6074. height: parseLength(bounds[3]),
  6075. width: parseLength(bounds[2])
  6076. };
  6077. }
  6078. function parseAttributes(root) {
  6079. const width = root.match(extractorRegExps.width);
  6080. const height = root.match(extractorRegExps.height);
  6081. const viewbox = root.match(extractorRegExps.viewbox);
  6082. return {
  6083. height: height && parseLength(height[2]),
  6084. viewbox: viewbox && parseViewbox(viewbox[2]),
  6085. width: width && parseLength(width[2])
  6086. };
  6087. }
  6088. function calculateByDimensions(attrs) {
  6089. return {
  6090. height: attrs.height,
  6091. width: attrs.width
  6092. };
  6093. }
  6094. function calculateByViewbox(attrs, viewbox) {
  6095. const ratio = viewbox.width / viewbox.height;
  6096. if (attrs.width) return {
  6097. height: Math.floor(attrs.width / ratio),
  6098. width: attrs.width
  6099. };
  6100. if (attrs.height) return {
  6101. height: attrs.height,
  6102. width: Math.floor(attrs.height * ratio)
  6103. };
  6104. return {
  6105. height: viewbox.height,
  6106. width: viewbox.width
  6107. };
  6108. }
  6109. const SVG = {
  6110. validate: (input) => svgReg.test(toUTF8String(input, 0, 1e3)),
  6111. calculate(input) {
  6112. const root = toUTF8String(input).match(extractorRegExps.root);
  6113. if (root) {
  6114. const attrs = parseAttributes(root[0]);
  6115. if (attrs.width && attrs.height) return calculateByDimensions(attrs);
  6116. if (attrs.viewbox) return calculateByViewbox(attrs, attrs.viewbox);
  6117. }
  6118. throw new TypeError("Invalid SVG");
  6119. }
  6120. };
  6121. const TGA = {
  6122. validate(input) {
  6123. return readUInt16LE(input, 0) === 0 && readUInt16LE(input, 4) === 0;
  6124. },
  6125. calculate(input) {
  6126. return {
  6127. height: readUInt16LE(input, 14),
  6128. width: readUInt16LE(input, 12)
  6129. };
  6130. }
  6131. };
  6132. function readIFD(buffer, isBigEndian) {
  6133. const ifdOffset = readUInt(buffer, 32, 4, isBigEndian);
  6134. let bufferSize = 1024;
  6135. const fileSize = buffer.length;
  6136. if (ifdOffset + bufferSize > fileSize) bufferSize = fileSize - ifdOffset - 10;
  6137. return buffer.slice(ifdOffset + 2, ifdOffset + 2 + bufferSize);
  6138. }
  6139. function readValue(buffer, isBigEndian) {
  6140. const low = readUInt(buffer, 16, 8, isBigEndian);
  6141. return (readUInt(buffer, 16, 10, isBigEndian) << 16) + low;
  6142. }
  6143. function nextTag(buffer) {
  6144. if (buffer.length > 24) return buffer.slice(12);
  6145. }
  6146. function extractTags(buffer, isBigEndian) {
  6147. const tags = {};
  6148. let temp = buffer;
  6149. while (temp && temp.length > 0) {
  6150. const code = readUInt(temp, 16, 0, isBigEndian);
  6151. const type = readUInt(temp, 16, 2, isBigEndian);
  6152. const length = readUInt(temp, 32, 4, isBigEndian);
  6153. if (code === 0) break;
  6154. else {
  6155. if (length === 1 && (type === 3 || type === 4)) tags[code] = readValue(temp, isBigEndian);
  6156. temp = nextTag(temp);
  6157. }
  6158. }
  6159. return tags;
  6160. }
  6161. function determineEndianness(input) {
  6162. const signature = toUTF8String(input, 0, 2);
  6163. if (signature === "II") return "LE";
  6164. else if (signature === "MM") return "BE";
  6165. }
  6166. const signatures = /* @__PURE__ */ new Set(["49492a00", "4d4d002a"]);
  6167. const TIFF = {
  6168. validate: (input) => signatures.has(toHexString(input, 0, 4)),
  6169. calculate(input) {
  6170. const isBigEndian = determineEndianness(input) === "BE";
  6171. const tags = extractTags(readIFD(input, isBigEndian), isBigEndian);
  6172. const width = tags[256];
  6173. const height = tags[257];
  6174. if (!width || !height) throw new TypeError("Invalid Tiff. Missing tags");
  6175. return {
  6176. height,
  6177. width
  6178. };
  6179. }
  6180. };
  6181. function calculateExtended(input) {
  6182. return {
  6183. height: 1 + readUInt24LE(input, 7),
  6184. width: 1 + readUInt24LE(input, 4)
  6185. };
  6186. }
  6187. function calculateLossless(input) {
  6188. return {
  6189. height: 1 + ((input[4] & 15) << 10 | input[3] << 2 | (input[2] & 192) >> 6),
  6190. width: 1 + ((input[2] & 63) << 8 | input[1])
  6191. };
  6192. }
  6193. function calculateLossy(input) {
  6194. return {
  6195. height: readInt16LE(input, 8) & 16383,
  6196. width: readInt16LE(input, 6) & 16383
  6197. };
  6198. }
  6199. const WEBP = {
  6200. validate(input) {
  6201. const riffHeader = toUTF8String(input, 0, 4) === "RIFF";
  6202. const webpHeader = toUTF8String(input, 8, 12) === "WEBP";
  6203. const vp8Header = toUTF8String(input, 12, 15) === "VP8";
  6204. return riffHeader && webpHeader && vp8Header;
  6205. },
  6206. calculate(input) {
  6207. const chunkHeader = toUTF8String(input, 12, 16);
  6208. input = input.slice(20, 30);
  6209. if (chunkHeader === "VP8X") {
  6210. const extendedHeader = input[0];
  6211. const validStart = (extendedHeader & 192) === 0;
  6212. const validEnd = (extendedHeader & 1) === 0;
  6213. if (validStart && validEnd) return calculateExtended(input);
  6214. else throw new TypeError("Invalid WebP");
  6215. }
  6216. if (chunkHeader === "VP8 " && input[0] !== 47) return calculateLossy(input);
  6217. const signature = toHexString(input, 3, 6);
  6218. if (chunkHeader === "VP8L" && signature !== "9d012a") return calculateLossless(input);
  6219. throw new TypeError("Invalid WebP");
  6220. }
  6221. };
  6222. const AVIF = {
  6223. validate: (input) => toUTF8String(input, 8, 12) === "avif",
  6224. calculate: (input) => {
  6225. const metaBox = findBox(input, "meta");
  6226. const iprpBox = findBox(input, "iprp", metaBox.offset + 12, metaBox.offset + metaBox.size);
  6227. const ipcoBox = findBox(input, "ipco", iprpBox.offset + 8, iprpBox.offset + iprpBox.size);
  6228. const ispeBox = findBox(input, "ispe", ipcoBox.offset + 8, ipcoBox.offset + ipcoBox.size);
  6229. return {
  6230. width: readUInt32BE(input, ispeBox.offset + 12),
  6231. height: readUInt32BE(input, ispeBox.offset + 16)
  6232. };
  6233. }
  6234. };
  6235. function findBox(input, type, startOffset = 0, endOffset = input.length) {
  6236. for (let offset = startOffset; offset < endOffset;) {
  6237. const size = readUInt32BE(input, offset);
  6238. if (toUTF8String(input, offset + 4, offset + 8) === type) return {
  6239. offset,
  6240. size
  6241. };
  6242. if (size <= 0 || offset + size > endOffset) break;
  6243. offset += size;
  6244. }
  6245. throw new Error(`${type} box not found`);
  6246. }
  6247. const typeHandlers = {
  6248. bmp: BMP,
  6249. cur: CUR,
  6250. dds: DDS,
  6251. gif: GIF,
  6252. heic: HEIC,
  6253. icns: ICNS,
  6254. ico: ICO,
  6255. j2c: J2C,
  6256. jp2: JP2,
  6257. jpg: JPG,
  6258. ktx: KTX,
  6259. png: PNG,
  6260. pnm: PNM,
  6261. psd: PSD,
  6262. svg: SVG,
  6263. tga: TGA,
  6264. tiff: TIFF,
  6265. webp: WEBP,
  6266. avif: AVIF
  6267. };
  6268. const keys = Object.keys(typeHandlers);
  6269. const firstBytes = {
  6270. 56: "psd",
  6271. 66: "bmp",
  6272. 68: "dds",
  6273. 71: "gif",
  6274. 73: "tiff",
  6275. 77: "tiff",
  6276. 82: "webp",
  6277. 105: "icns",
  6278. 137: "png",
  6279. 255: "jpg"
  6280. };
  6281. function detector(input) {
  6282. const byte = input[0];
  6283. if (byte in firstBytes) {
  6284. const type = firstBytes[byte];
  6285. if (type && typeHandlers[type].validate(input)) return type;
  6286. }
  6287. return keys.find((key) => typeHandlers[key].validate(input));
  6288. }
  6289. function imageMeta(input) {
  6290. if (!(input instanceof Uint8Array)) throw new TypeError("Input should be a Uint8Array");
  6291. const type = detector(input);
  6292. if (type !== void 0 && type in typeHandlers) {
  6293. const size = typeHandlers[type].calculate(input);
  6294. if (size !== void 0) {
  6295. size.type = type;
  6296. return size;
  6297. }
  6298. }
  6299. throw new TypeError(`Unsupported file type: ${type}`);
  6300. }
  6301. //#endregion
  6302. //#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
  6303. const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
  6304. function normalizeWindowsPath(input = "") {
  6305. if (!input) return input;
  6306. return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
  6307. }
  6308. const _UNC_REGEX = /^[/\\]{2}/;
  6309. const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
  6310. const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
  6311. const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
  6312. const normalize = function(path) {
  6313. if (path.length === 0) return ".";
  6314. path = normalizeWindowsPath(path);
  6315. const isUNCPath = path.match(_UNC_REGEX);
  6316. const isPathAbsolute = isAbsolute(path);
  6317. const trailingSeparator = path[path.length - 1] === "/";
  6318. path = normalizeString(path, !isPathAbsolute);
  6319. if (path.length === 0) {
  6320. if (isPathAbsolute) return "/";
  6321. return trailingSeparator ? "./" : ".";
  6322. }
  6323. if (trailingSeparator) path += "/";
  6324. if (_DRIVE_LETTER_RE.test(path)) path += "/";
  6325. if (isUNCPath) {
  6326. if (!isPathAbsolute) return `//./${path}`;
  6327. return `//${path}`;
  6328. }
  6329. return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
  6330. };
  6331. const join = function(...segments) {
  6332. let path = "";
  6333. for (const seg of segments) {
  6334. if (!seg) continue;
  6335. if (path.length > 0) {
  6336. const pathTrailing = path[path.length - 1] === "/";
  6337. const segLeading = seg[0] === "/";
  6338. if (pathTrailing && segLeading) path += seg.slice(1);
  6339. else path += pathTrailing || segLeading ? seg : `/${seg}`;
  6340. } else path += seg;
  6341. }
  6342. return normalize(path);
  6343. };
  6344. function cwd() {
  6345. if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
  6346. return "/";
  6347. }
  6348. const resolve$1 = function(...arguments_) {
  6349. arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
  6350. let resolvedPath = "";
  6351. let resolvedAbsolute = false;
  6352. for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
  6353. const path = index >= 0 ? arguments_[index] : cwd();
  6354. if (!path || path.length === 0) continue;
  6355. resolvedPath = `${path}/${resolvedPath}`;
  6356. resolvedAbsolute = isAbsolute(path);
  6357. }
  6358. resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
  6359. if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
  6360. return resolvedPath.length > 0 ? resolvedPath : ".";
  6361. };
  6362. function normalizeString(path, allowAboveRoot) {
  6363. let res = "";
  6364. let lastSegmentLength = 0;
  6365. let lastSlash = -1;
  6366. let dots = 0;
  6367. let char = null;
  6368. for (let index = 0; index <= path.length; ++index) {
  6369. if (index < path.length) char = path[index];
  6370. else if (char === "/") break;
  6371. else char = "/";
  6372. if (char === "/") {
  6373. if (lastSlash === index - 1 || dots === 1);
  6374. else if (dots === 2) {
  6375. if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
  6376. if (res.length > 2) {
  6377. const lastSlashIndex = res.lastIndexOf("/");
  6378. if (lastSlashIndex === -1) {
  6379. res = "";
  6380. lastSegmentLength = 0;
  6381. } else {
  6382. res = res.slice(0, lastSlashIndex);
  6383. lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
  6384. }
  6385. lastSlash = index;
  6386. dots = 0;
  6387. continue;
  6388. } else if (res.length > 0) {
  6389. res = "";
  6390. lastSegmentLength = 0;
  6391. lastSlash = index;
  6392. dots = 0;
  6393. continue;
  6394. }
  6395. }
  6396. if (allowAboveRoot) {
  6397. res += res.length > 0 ? "/.." : "..";
  6398. lastSegmentLength = 2;
  6399. }
  6400. } else {
  6401. if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
  6402. else res = path.slice(lastSlash + 1, index);
  6403. lastSegmentLength = index - lastSlash - 1;
  6404. }
  6405. lastSlash = index;
  6406. dots = 0;
  6407. } else if (char === "." && dots !== -1) ++dots;
  6408. else dots = -1;
  6409. }
  6410. return res;
  6411. }
  6412. const isAbsolute = function(p) {
  6413. return _IS_ABSOLUTE_RE.test(p);
  6414. };
  6415. const relative = function(from, to) {
  6416. const _from = resolve$1(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
  6417. const _to = resolve$1(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
  6418. if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) return _to.join("/");
  6419. const _fromCopy = [..._from];
  6420. for (const segment of _fromCopy) {
  6421. if (_to[0] !== segment) break;
  6422. _from.shift();
  6423. _to.shift();
  6424. }
  6425. return [..._from.map(() => ".."), ..._to].join("/");
  6426. };
  6427. //#endregion
  6428. //#region ../../node_modules/.pnpm/perfect-debounce@2.0.0/node_modules/perfect-debounce/dist/index.mjs
  6429. const DEBOUNCE_DEFAULTS = { trailing: true };
  6430. /**
  6431. Debounce functions
  6432. @param fn - Promise-returning/async function to debounce.
  6433. @param wait - Milliseconds to wait before calling `fn`. Default value is 25ms
  6434. @returns A function that delays calling `fn` until after `wait` milliseconds have elapsed since the last time it was called.
  6435. @example
  6436. ```
  6437. import { debounce } from 'perfect-debounce';
  6438. const expensiveCall = async input => input;
  6439. const debouncedFn = debounce(expensiveCall, 200);
  6440. for (const number of [1, 2, 3]) {
  6441. console.log(await debouncedFn(number));
  6442. }
  6443. //=> 1
  6444. //=> 2
  6445. //=> 3
  6446. ```
  6447. */
  6448. function debounce(fn, wait = 25, options = {}) {
  6449. options = {
  6450. ...DEBOUNCE_DEFAULTS,
  6451. ...options
  6452. };
  6453. if (!Number.isFinite(wait)) throw new TypeError("Expected `wait` to be a finite number");
  6454. let leadingValue;
  6455. let timeout;
  6456. let resolveList = [];
  6457. let currentPromise;
  6458. let trailingArgs;
  6459. const applyFn = (_this, args) => {
  6460. currentPromise = _applyPromised(fn, _this, args);
  6461. currentPromise.finally(() => {
  6462. currentPromise = null;
  6463. if (options.trailing && trailingArgs && !timeout) {
  6464. const promise = applyFn(_this, trailingArgs);
  6465. trailingArgs = null;
  6466. return promise;
  6467. }
  6468. });
  6469. return currentPromise;
  6470. };
  6471. const debounced = function(...args) {
  6472. if (options.trailing) trailingArgs = args;
  6473. if (currentPromise) return currentPromise;
  6474. return new Promise((resolve) => {
  6475. const shouldCallNow = !timeout && options.leading;
  6476. clearTimeout(timeout);
  6477. timeout = setTimeout(() => {
  6478. timeout = null;
  6479. const promise = options.leading ? leadingValue : applyFn(this, args);
  6480. trailingArgs = null;
  6481. for (const _resolve of resolveList) _resolve(promise);
  6482. resolveList = [];
  6483. }, wait);
  6484. if (shouldCallNow) {
  6485. leadingValue = applyFn(this, args);
  6486. resolve(leadingValue);
  6487. } else resolveList.push(resolve);
  6488. });
  6489. };
  6490. const _clearTimeout = (timer) => {
  6491. if (timer) {
  6492. clearTimeout(timer);
  6493. timeout = null;
  6494. }
  6495. };
  6496. debounced.isPending = () => !!timeout;
  6497. debounced.cancel = () => {
  6498. _clearTimeout(timeout);
  6499. resolveList = [];
  6500. trailingArgs = null;
  6501. };
  6502. debounced.flush = () => {
  6503. _clearTimeout(timeout);
  6504. if (!trailingArgs || currentPromise) return;
  6505. const args = trailingArgs;
  6506. trailingArgs = null;
  6507. return applyFn(this, args);
  6508. };
  6509. return debounced;
  6510. }
  6511. async function _applyPromised(fn, _this, args) {
  6512. return await fn.apply(_this, args);
  6513. }
  6514. //#endregion
  6515. //#region src/rpc/assets.ts
  6516. function guessType(path) {
  6517. if (/\.(?:png|jpe?g|jxl|gif|svg|webp|avif|ico|bmp|tiff?)$/i.test(path)) return "image";
  6518. if (/\.(?:mp4|webm|ogv|mov|avi|flv|wmv|mpg|mpeg|mkv|3gp|3g2|ts|mts|m2ts|vob|ogm|ogx|rm|rmvb|asf|amv|divx|m4v|svi|viv|f4v|f4p|f4a|f4b)$/i.test(path)) return "video";
  6519. if (/\.(?:mp3|wav|ogg|flac|aac|wma|alac|ape|ac3|dts|tta|opus|amr|aiff|au|mid|midi|ra|rm|wv|weba|dss|spx|vox|tak|dsf|dff|dsd|cda)$/i.test(path)) return "audio";
  6520. if (/\.(?:woff2?|eot|ttf|otf|ttc|pfa|pfb|pfm|afm)/i.test(path)) return "font";
  6521. if (/\.(?:json[5c]?|te?xt|[mc]?[jt]sx?|md[cx]?|markdown|ya?ml|toml)/i.test(path)) return "text";
  6522. if (/\.wasm/i.test(path)) return "wasm";
  6523. return "other";
  6524. }
  6525. function getAssetsFunctions(ctx) {
  6526. const { server, config } = ctx;
  6527. const _imageMetaCache = /* @__PURE__ */ new Map();
  6528. let cache = null;
  6529. async function scan() {
  6530. const dir = resolve$1(config.root);
  6531. const baseURL = config.base;
  6532. const publicDir = config.publicDir;
  6533. const relativePublicDir = publicDir === "" ? "" : `${relative(dir, publicDir)}/`;
  6534. const files = await (0, import_out.default)([
  6535. "**/*.(png|jpg|jpeg|gif|svg|webp|avif|ico|bmp|tiff)",
  6536. "**/*.(mp4|webm|ogv|mov|avi|flv|wmv|mpg|mpeg|mkv|3gp|3g2|m2ts|vob|ogm|ogx|rm|rmvb|asf|amv|divx|m4v|svi|viv|f4v|f4p|f4a|f4b)",
  6537. "**/*.(mp3|wav|ogg|flac|aac|wma|alac|ape|ac3|dts|tta|opus|amr|aiff|au|mid|midi|ra|rm|wv|weba|dss|spx|vox|tak|dsf|dff|dsd|cda)",
  6538. "**/*.(woff2?|eot|ttf|otf|ttc|pfa|pfb|pfm|afm)",
  6539. "**/*.(json|json5|jsonc|txt|text|tsx|jsx|md|mdx|mdc|markdown|yaml|yml|toml)",
  6540. "**/*.wasm"
  6541. ], {
  6542. cwd: dir,
  6543. onlyFiles: true,
  6544. caseSensitiveMatch: false,
  6545. ignore: [
  6546. "**/node_modules/**",
  6547. "**/dist/**",
  6548. "**/package-lock.*",
  6549. "**/pnpm-lock.*",
  6550. "**/pnpm-workspace.*"
  6551. ]
  6552. });
  6553. cache = await Promise.all(files.map(async (relativePath) => {
  6554. const filePath = resolve$1(dir, relativePath);
  6555. const stat = await fsp.lstat(filePath);
  6556. const path = relativePath.replace(relativePublicDir, "");
  6557. return {
  6558. path,
  6559. relativePath,
  6560. publicPath: join(baseURL, path),
  6561. filePath,
  6562. type: guessType(relativePath),
  6563. size: stat.size,
  6564. mtime: stat.mtimeMs
  6565. };
  6566. }));
  6567. return cache;
  6568. }
  6569. async function getAssetImporters(url) {
  6570. const importers = [];
  6571. const module = await server.moduleGraph.getModuleByUrl(url);
  6572. if (module) for (const importer of module.importers) importers.push({
  6573. url: importer.url,
  6574. id: importer.id
  6575. });
  6576. return importers;
  6577. }
  6578. const debouncedAssetsUpdated = debounce(() => {
  6579. var _ref;
  6580. getViteRpcServer === null || getViteRpcServer === void 0 || (_ref = getViteRpcServer()) === null || _ref === void 0 || (_ref = _ref.broadcast) === null || _ref === void 0 || _ref.emit("assetsUpdated");
  6581. }, 100);
  6582. server.watcher.on("all", (event) => {
  6583. if (event !== "change") debouncedAssetsUpdated();
  6584. });
  6585. return {
  6586. async getStaticAssets() {
  6587. return await scan();
  6588. },
  6589. async getAssetImporters(url) {
  6590. return await getAssetImporters(url);
  6591. },
  6592. async getImageMeta(filepath) {
  6593. if (_imageMetaCache.has(filepath)) return _imageMetaCache.get(filepath);
  6594. try {
  6595. const meta = imageMeta(await fsp.readFile(filepath));
  6596. _imageMetaCache.set(filepath, meta);
  6597. return meta;
  6598. } catch (e) {
  6599. _imageMetaCache.set(filepath, void 0);
  6600. console.error(e);
  6601. return;
  6602. }
  6603. },
  6604. async getTextAssetContent(filepath, limit = 300) {
  6605. try {
  6606. return (await fsp.readFile(filepath, "utf-8")).slice(0, limit);
  6607. } catch (e) {
  6608. console.error(e);
  6609. return;
  6610. }
  6611. }
  6612. };
  6613. }
  6614. //#endregion
  6615. //#region src/rpc/get-config.ts
  6616. function getConfigFunctions(ctx) {
  6617. return { getRoot() {
  6618. return ctx.config.root;
  6619. } };
  6620. }
  6621. //#endregion
  6622. //#region src/rpc/graph.ts
  6623. function getGraphFunctions(ctx) {
  6624. const { rpc, server } = ctx;
  6625. const debouncedModuleUpdated = debounce(() => {
  6626. var _ref;
  6627. getViteRpcServer === null || getViteRpcServer === void 0 || (_ref = getViteRpcServer()) === null || _ref === void 0 || (_ref = _ref.broadcast) === null || _ref === void 0 || _ref.emit("graphModuleUpdated");
  6628. }, 100);
  6629. server.middlewares.use((_, __, next) => {
  6630. debouncedModuleUpdated();
  6631. next();
  6632. });
  6633. return { async getGraphModules() {
  6634. const meta = await rpc.getMetadata();
  6635. const modules = (meta ? await rpc.getModulesList({
  6636. vite: meta === null || meta === void 0 ? void 0 : meta.instances[0].vite,
  6637. env: meta === null || meta === void 0 ? void 0 : meta.instances[0].environments[0]
  6638. }) : null) || [];
  6639. const filteredModules = modules.filter((m) => {
  6640. return m.id.match(/\.(vue|js|ts|jsx|tsx|html|json)($|\?v=)/);
  6641. });
  6642. return filteredModules.map((i) => {
  6643. function searchForVueDeps(id, seen = /* @__PURE__ */ new Set()) {
  6644. if (seen.has(id)) return [];
  6645. seen.add(id);
  6646. const module = modules.find((m) => m.id === id);
  6647. if (!module) return [];
  6648. return module.deps.flatMap((i) => {
  6649. if (filteredModules.find((m) => m.id === i)) return [i];
  6650. return searchForVueDeps(i, seen);
  6651. });
  6652. }
  6653. return {
  6654. id: i.id,
  6655. deps: searchForVueDeps(i.id)
  6656. };
  6657. });
  6658. } };
  6659. }
  6660. //#endregion
  6661. //#region src/rpc/index.ts
  6662. function getRpcFunctions(ctx) {
  6663. return {
  6664. heartbeat() {
  6665. return true;
  6666. },
  6667. ...getAssetsFunctions(ctx),
  6668. ...getConfigFunctions(ctx),
  6669. ...getGraphFunctions(ctx)
  6670. };
  6671. }
  6672. //#endregion
  6673. //#region src/utils.ts
  6674. function removeUrlQuery(url) {
  6675. return url.replace(/\?.*$/, "");
  6676. }
  6677. //#endregion
  6678. //#region src/vite.ts
  6679. function getVueDevtoolsPath() {
  6680. return normalizePath(path.dirname(fileURLToPath(import.meta.url))).replace(/\/dist$/, "//src");
  6681. }
  6682. const toggleComboKeysMap = {
  6683. option: process.platform === "darwin" ? "Option(⌥)" : "Alt(⌥)",
  6684. meta: "Command(⌘)",
  6685. shift: "Shift(⇧)"
  6686. };
  6687. function normalizeComboKeyPrint(toggleComboKey) {
  6688. return toggleComboKey.split("-").map((key) => toggleComboKeysMap[key] || key[0].toUpperCase() + key.slice(1)).join(dim("+"));
  6689. }
  6690. const devtoolsNextResourceSymbol = "?__vue-devtools-next-resource";
  6691. const defaultOptions = {
  6692. appendTo: "",
  6693. componentInspector: true,
  6694. launchEditor: process.env.LAUNCH_EDITOR ?? "code"
  6695. };
  6696. function mergeOptions(options) {
  6697. return Object.assign({}, defaultOptions, options);
  6698. }
  6699. function VitePluginVueDevTools(options) {
  6700. const vueDevtoolsPath = getVueDevtoolsPath();
  6701. const inspect = Inspect({ silent: true });
  6702. const pluginOptions = mergeOptions(options ?? {});
  6703. let config;
  6704. function configureServer(server) {
  6705. const base = server.config.base || "/";
  6706. server.middlewares.use(`${base}__devtools__`, sirv(DIR_CLIENT, {
  6707. single: true,
  6708. dev: true,
  6709. setHeaders(response) {
  6710. if (config.server.headers == null) return;
  6711. Object.entries(config.server.headers).forEach(([key, value]) => {
  6712. if (value == null) return;
  6713. response.setHeader(key, value);
  6714. });
  6715. }
  6716. }));
  6717. setViteServerContext(server);
  6718. createViteServerRpc(getRpcFunctions({
  6719. rpc: inspect.api.rpc,
  6720. server,
  6721. config
  6722. }));
  6723. const _printUrls = server.printUrls;
  6724. const colorUrl = (url) => cyan(url.replace(/:(\d+)\//, (_, port) => `:${bold(port)}/`));
  6725. server.printUrls = () => {
  6726. const urls = server.resolvedUrls;
  6727. const keys = normalizeComboKeyPrint("option-shift-d");
  6728. _printUrls();
  6729. for (const url of urls.local) {
  6730. const devtoolsUrl = url.endsWith("/") ? `${url}__devtools__/` : `${url}/__devtools__/`;
  6731. console.log(` ${green("➜")} ${bold("Vue DevTools")}: ${green(`Open ${colorUrl(`${devtoolsUrl}`)} as a separate window`)}`);
  6732. }
  6733. console.log(` ${green("➜")} ${bold("Vue DevTools")}: ${green(`Press ${yellow(keys)} in App to toggle the Vue DevTools`)}`);
  6734. };
  6735. }
  6736. const devtoolsOptionsImportee = "virtual:vue-devtools-options";
  6737. const resolvedDevtoolsOptions = `\0${devtoolsOptionsImportee}`;
  6738. const plugin = {
  6739. name: "vite-plugin-vue-devtools",
  6740. enforce: "pre",
  6741. apply: "serve",
  6742. configResolved(resolvedConfig) {
  6743. config = resolvedConfig;
  6744. },
  6745. configureServer(server) {
  6746. configureServer(server);
  6747. },
  6748. async resolveId(importee) {
  6749. if (importee === devtoolsOptionsImportee) return resolvedDevtoolsOptions;
  6750. else if (importee.startsWith("virtual:vue-devtools-path:")) return `${importee.replace("virtual:vue-devtools-path:", `${vueDevtoolsPath}/`)}${devtoolsNextResourceSymbol}`;
  6751. },
  6752. async load(id) {
  6753. if (id === resolvedDevtoolsOptions) return `export default ${JSON.stringify({
  6754. base: config.base,
  6755. componentInspector: pluginOptions.componentInspector
  6756. })}`;
  6757. else if (id.endsWith(devtoolsNextResourceSymbol)) {
  6758. const filename = removeUrlQuery(id);
  6759. return await fs.promises.readFile(filename, "utf-8");
  6760. }
  6761. },
  6762. transform(code, id, options) {
  6763. if (options === null || options === void 0 ? void 0 : options.ssr) return;
  6764. const { appendTo } = pluginOptions;
  6765. const [filename] = id.split("?", 2);
  6766. if (appendTo && (typeof appendTo === "string" && filename.endsWith(appendTo) || appendTo instanceof RegExp && appendTo.test(filename))) code = `import 'virtual:vue-devtools-path:overlay.js';\n${code}`;
  6767. return code;
  6768. },
  6769. transformIndexHtml(html) {
  6770. if (pluginOptions.appendTo) return;
  6771. return {
  6772. html,
  6773. tags: [{
  6774. tag: "script",
  6775. injectTo: "head-prepend",
  6776. attrs: {
  6777. type: "module",
  6778. src: `${config.base || "/"}@id/virtual:vue-devtools-path:overlay.js`
  6779. }
  6780. }, pluginOptions.componentInspector && {
  6781. tag: "script",
  6782. injectTo: "head-prepend",
  6783. launchEditor: pluginOptions.launchEditor,
  6784. attrs: {
  6785. type: "module",
  6786. src: `${config.base || "/"}@id/virtual:vue-inspector-path:load.js`
  6787. }
  6788. }].filter(Boolean)
  6789. };
  6790. },
  6791. async buildEnd() {}
  6792. };
  6793. return [
  6794. inspect,
  6795. pluginOptions.componentInspector && VueInspector({
  6796. toggleComboKey: "",
  6797. toggleButtonVisibility: "never",
  6798. launchEditor: pluginOptions.launchEditor,
  6799. ...typeof pluginOptions.componentInspector === "boolean" ? {} : pluginOptions.componentInspector,
  6800. appendTo: pluginOptions.appendTo || "manually"
  6801. }),
  6802. plugin
  6803. ].filter(Boolean);
  6804. }
  6805. //#endregion
  6806. export { VitePluginVueDevTools as default };