vite.cjs 221 KB

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