third-party.js 296 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978
  1. "use strict";
  2. // dist/_third-party.js.cjs.js
  3. var __getOwnPropNames = Object.getOwnPropertyNames;
  4. var __commonJS = (cb, mod) => function __require() {
  5. return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = {
  6. exports: {}
  7. }).exports, mod), mod.exports;
  8. };
  9. var require_resolve_from = __commonJS({
  10. "node_modules/import-fresh/node_modules/resolve-from/index.js"(exports2, module2) {
  11. "use strict";
  12. var path = require("path");
  13. var Module = require("module");
  14. var fs = require("fs");
  15. var resolveFrom = (fromDir, moduleId, silent) => {
  16. if (typeof fromDir !== "string") {
  17. throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDir}\``);
  18. }
  19. if (typeof moduleId !== "string") {
  20. throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``);
  21. }
  22. try {
  23. fromDir = fs.realpathSync(fromDir);
  24. } catch (err) {
  25. if (err.code === "ENOENT") {
  26. fromDir = path.resolve(fromDir);
  27. } else if (silent) {
  28. return null;
  29. } else {
  30. throw err;
  31. }
  32. }
  33. const fromFile = path.join(fromDir, "noop.js");
  34. const resolveFileName = () => Module._resolveFilename(moduleId, {
  35. id: fromFile,
  36. filename: fromFile,
  37. paths: Module._nodeModulePaths(fromDir)
  38. });
  39. if (silent) {
  40. try {
  41. return resolveFileName();
  42. } catch (err) {
  43. return null;
  44. }
  45. }
  46. return resolveFileName();
  47. };
  48. module2.exports = (fromDir, moduleId) => resolveFrom(fromDir, moduleId);
  49. module2.exports.silent = (fromDir, moduleId) => resolveFrom(fromDir, moduleId, true);
  50. }
  51. });
  52. var require_parent_module = __commonJS({
  53. "scripts/build/shims/parent-module.cjs"(exports2, module2) {
  54. "use strict";
  55. module2.exports = (file) => file;
  56. }
  57. });
  58. var require_import_fresh = __commonJS({
  59. "node_modules/import-fresh/index.js"(exports2, module2) {
  60. "use strict";
  61. var path = require("path");
  62. var resolveFrom = require_resolve_from();
  63. var parentModule = require_parent_module();
  64. module2.exports = (moduleId) => {
  65. if (typeof moduleId !== "string") {
  66. throw new TypeError("Expected a string");
  67. }
  68. const parentPath = parentModule(__filename);
  69. const cwd = parentPath ? path.dirname(parentPath) : __dirname;
  70. const filePath = resolveFrom(cwd, moduleId);
  71. const oldModule = require.cache[filePath];
  72. if (oldModule && oldModule.parent) {
  73. let i = oldModule.parent.children.length;
  74. while (i--) {
  75. if (oldModule.parent.children[i].id === filePath) {
  76. oldModule.parent.children.splice(i, 1);
  77. }
  78. }
  79. }
  80. delete require.cache[filePath];
  81. const parent = require.cache[parentPath];
  82. return parent === void 0 ? require(filePath) : parent.require(filePath);
  83. };
  84. }
  85. });
  86. var require_is_arrayish = __commonJS({
  87. "node_modules/is-arrayish/index.js"(exports2, module2) {
  88. "use strict";
  89. module2.exports = function isArrayish(obj) {
  90. if (!obj) {
  91. return false;
  92. }
  93. return obj instanceof Array || Array.isArray(obj) || obj.length >= 0 && obj.splice instanceof Function;
  94. };
  95. }
  96. });
  97. var require_error_ex = __commonJS({
  98. "node_modules/error-ex/index.js"(exports2, module2) {
  99. "use strict";
  100. var util = require("util");
  101. var isArrayish = require_is_arrayish();
  102. var errorEx = function errorEx2(name, properties) {
  103. if (!name || name.constructor !== String) {
  104. properties = name || {};
  105. name = Error.name;
  106. }
  107. var errorExError = function ErrorEXError(message) {
  108. if (!this) {
  109. return new ErrorEXError(message);
  110. }
  111. message = message instanceof Error ? message.message : message || this.message;
  112. Error.call(this, message);
  113. Error.captureStackTrace(this, errorExError);
  114. this.name = name;
  115. Object.defineProperty(this, "message", {
  116. configurable: true,
  117. enumerable: false,
  118. get: function() {
  119. var newMessage = message.split(/\r?\n/g);
  120. for (var key in properties) {
  121. if (!properties.hasOwnProperty(key)) {
  122. continue;
  123. }
  124. var modifier = properties[key];
  125. if ("message" in modifier) {
  126. newMessage = modifier.message(this[key], newMessage) || newMessage;
  127. if (!isArrayish(newMessage)) {
  128. newMessage = [newMessage];
  129. }
  130. }
  131. }
  132. return newMessage.join("\n");
  133. },
  134. set: function(v) {
  135. message = v;
  136. }
  137. });
  138. var overwrittenStack = null;
  139. var stackDescriptor = Object.getOwnPropertyDescriptor(this, "stack");
  140. var stackGetter = stackDescriptor.get;
  141. var stackValue = stackDescriptor.value;
  142. delete stackDescriptor.value;
  143. delete stackDescriptor.writable;
  144. stackDescriptor.set = function(newstack) {
  145. overwrittenStack = newstack;
  146. };
  147. stackDescriptor.get = function() {
  148. var stack = (overwrittenStack || (stackGetter ? stackGetter.call(this) : stackValue)).split(/\r?\n+/g);
  149. if (!overwrittenStack) {
  150. stack[0] = this.name + ": " + this.message;
  151. }
  152. var lineCount = 1;
  153. for (var key in properties) {
  154. if (!properties.hasOwnProperty(key)) {
  155. continue;
  156. }
  157. var modifier = properties[key];
  158. if ("line" in modifier) {
  159. var line = modifier.line(this[key]);
  160. if (line) {
  161. stack.splice(lineCount++, 0, " " + line);
  162. }
  163. }
  164. if ("stack" in modifier) {
  165. modifier.stack(this[key], stack);
  166. }
  167. }
  168. return stack.join("\n");
  169. };
  170. Object.defineProperty(this, "stack", stackDescriptor);
  171. };
  172. if (Object.setPrototypeOf) {
  173. Object.setPrototypeOf(errorExError.prototype, Error.prototype);
  174. Object.setPrototypeOf(errorExError, Error);
  175. } else {
  176. util.inherits(errorExError, Error);
  177. }
  178. return errorExError;
  179. };
  180. errorEx.append = function(str, def) {
  181. return {
  182. message: function(v, message) {
  183. v = v || def;
  184. if (v) {
  185. message[0] += " " + str.replace("%s", v.toString());
  186. }
  187. return message;
  188. }
  189. };
  190. };
  191. errorEx.line = function(str, def) {
  192. return {
  193. line: function(v) {
  194. v = v || def;
  195. if (v) {
  196. return str.replace("%s", v.toString());
  197. }
  198. return null;
  199. }
  200. };
  201. };
  202. module2.exports = errorEx;
  203. }
  204. });
  205. var require_json_parse_even_better_errors = __commonJS({
  206. "node_modules/json-parse-even-better-errors/index.js"(exports2, module2) {
  207. "use strict";
  208. var hexify = (char) => {
  209. const h = char.charCodeAt(0).toString(16).toUpperCase();
  210. return "0x" + (h.length % 2 ? "0" : "") + h;
  211. };
  212. var parseError = (e, txt, context) => {
  213. if (!txt) {
  214. return {
  215. message: e.message + " while parsing empty string",
  216. position: 0
  217. };
  218. }
  219. const badToken = e.message.match(/^Unexpected token (.) .*position\s+(\d+)/i);
  220. const errIdx = badToken ? +badToken[2] : e.message.match(/^Unexpected end of JSON.*/i) ? txt.length - 1 : null;
  221. const msg = badToken ? e.message.replace(/^Unexpected token ./, `Unexpected token ${JSON.stringify(badToken[1])} (${hexify(badToken[1])})`) : e.message;
  222. if (errIdx !== null && errIdx !== void 0) {
  223. const start = errIdx <= context ? 0 : errIdx - context;
  224. const end = errIdx + context >= txt.length ? txt.length : errIdx + context;
  225. const slice = (start === 0 ? "" : "...") + txt.slice(start, end) + (end === txt.length ? "" : "...");
  226. const near = txt === slice ? "" : "near ";
  227. return {
  228. message: msg + ` while parsing ${near}${JSON.stringify(slice)}`,
  229. position: errIdx
  230. };
  231. } else {
  232. return {
  233. message: msg + ` while parsing '${txt.slice(0, context * 2)}'`,
  234. position: 0
  235. };
  236. }
  237. };
  238. var JSONParseError = class extends SyntaxError {
  239. constructor(er, txt, context, caller) {
  240. context = context || 20;
  241. const metadata = parseError(er, txt, context);
  242. super(metadata.message);
  243. Object.assign(this, metadata);
  244. this.code = "EJSONPARSE";
  245. this.systemError = er;
  246. Error.captureStackTrace(this, caller || this.constructor);
  247. }
  248. get name() {
  249. return this.constructor.name;
  250. }
  251. set name(n) {
  252. }
  253. get [Symbol.toStringTag]() {
  254. return this.constructor.name;
  255. }
  256. };
  257. var kIndent = Symbol.for("indent");
  258. var kNewline = Symbol.for("newline");
  259. var formatRE = /^\s*[{\[]((?:\r?\n)+)([\s\t]*)/;
  260. var emptyRE = /^(?:\{\}|\[\])((?:\r?\n)+)?$/;
  261. var parseJson = (txt, reviver, context) => {
  262. const parseText = stripBOM(txt);
  263. context = context || 20;
  264. try {
  265. const [, newline = "\n", indent = " "] = parseText.match(emptyRE) || parseText.match(formatRE) || [, "", ""];
  266. const result = JSON.parse(parseText, reviver);
  267. if (result && typeof result === "object") {
  268. result[kNewline] = newline;
  269. result[kIndent] = indent;
  270. }
  271. return result;
  272. } catch (e) {
  273. if (typeof txt !== "string" && !Buffer.isBuffer(txt)) {
  274. const isEmptyArray = Array.isArray(txt) && txt.length === 0;
  275. throw Object.assign(new TypeError(`Cannot parse ${isEmptyArray ? "an empty array" : String(txt)}`), {
  276. code: "EJSONPARSE",
  277. systemError: e
  278. });
  279. }
  280. throw new JSONParseError(e, parseText, context, parseJson);
  281. }
  282. };
  283. var stripBOM = (txt) => String(txt).replace(/^\uFEFF/, "");
  284. module2.exports = parseJson;
  285. parseJson.JSONParseError = JSONParseError;
  286. parseJson.noExceptions = (txt, reviver) => {
  287. try {
  288. return JSON.parse(stripBOM(txt), reviver);
  289. } catch (e) {
  290. }
  291. };
  292. }
  293. });
  294. var require_build = __commonJS({
  295. "node_modules/parse-json/node_modules/lines-and-columns/build/index.js"(exports2) {
  296. "use strict";
  297. exports2.__esModule = true;
  298. exports2.LinesAndColumns = void 0;
  299. var LF = "\n";
  300. var CR = "\r";
  301. var LinesAndColumns = function() {
  302. function LinesAndColumns2(string) {
  303. this.string = string;
  304. var offsets = [0];
  305. for (var offset = 0; offset < string.length; ) {
  306. switch (string[offset]) {
  307. case LF:
  308. offset += LF.length;
  309. offsets.push(offset);
  310. break;
  311. case CR:
  312. offset += CR.length;
  313. if (string[offset] === LF) {
  314. offset += LF.length;
  315. }
  316. offsets.push(offset);
  317. break;
  318. default:
  319. offset++;
  320. break;
  321. }
  322. }
  323. this.offsets = offsets;
  324. }
  325. LinesAndColumns2.prototype.locationForIndex = function(index) {
  326. if (index < 0 || index > this.string.length) {
  327. return null;
  328. }
  329. var line = 0;
  330. var offsets = this.offsets;
  331. while (offsets[line + 1] <= index) {
  332. line++;
  333. }
  334. var column = index - offsets[line];
  335. return {
  336. line,
  337. column
  338. };
  339. };
  340. LinesAndColumns2.prototype.indexForLocation = function(location) {
  341. var line = location.line, column = location.column;
  342. if (line < 0 || line >= this.offsets.length) {
  343. return null;
  344. }
  345. if (column < 0 || column > this.lengthOfLine(line)) {
  346. return null;
  347. }
  348. return this.offsets[line] + column;
  349. };
  350. LinesAndColumns2.prototype.lengthOfLine = function(line) {
  351. var offset = this.offsets[line];
  352. var nextOffset = line === this.offsets.length - 1 ? this.string.length : this.offsets[line + 1];
  353. return nextOffset - offset;
  354. };
  355. return LinesAndColumns2;
  356. }();
  357. exports2.LinesAndColumns = LinesAndColumns;
  358. exports2["default"] = LinesAndColumns;
  359. }
  360. });
  361. var require_js_tokens = __commonJS({
  362. "node_modules/js-tokens/index.js"(exports2) {
  363. Object.defineProperty(exports2, "__esModule", {
  364. value: true
  365. });
  366. exports2.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;
  367. exports2.matchToToken = function(match) {
  368. var token = {
  369. type: "invalid",
  370. value: match[0],
  371. closed: void 0
  372. };
  373. if (match[1])
  374. token.type = "string", token.closed = !!(match[3] || match[4]);
  375. else if (match[5])
  376. token.type = "comment";
  377. else if (match[6])
  378. token.type = "comment", token.closed = !!match[7];
  379. else if (match[8])
  380. token.type = "regex";
  381. else if (match[9])
  382. token.type = "number";
  383. else if (match[10])
  384. token.type = "name";
  385. else if (match[11])
  386. token.type = "punctuator";
  387. else if (match[12])
  388. token.type = "whitespace";
  389. return token;
  390. };
  391. }
  392. });
  393. var require_identifier = __commonJS({
  394. "node_modules/@babel/helper-validator-identifier/lib/identifier.js"(exports2) {
  395. "use strict";
  396. Object.defineProperty(exports2, "__esModule", {
  397. value: true
  398. });
  399. exports2.isIdentifierChar = isIdentifierChar;
  400. exports2.isIdentifierName = isIdentifierName;
  401. exports2.isIdentifierStart = isIdentifierStart;
  402. var nonASCIIidentifierStartChars = "\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC";
  403. var nonASCIIidentifierChars = "\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F";
  404. var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
  405. var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
  406. nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
  407. var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1070, 4050, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 46, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 482, 44, 11, 6, 17, 0, 322, 29, 19, 43, 1269, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4152, 8, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938];
  408. var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 357, 0, 62, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
  409. function isInAstralSet(code, set) {
  410. let pos = 65536;
  411. for (let i = 0, length = set.length; i < length; i += 2) {
  412. pos += set[i];
  413. if (pos > code)
  414. return false;
  415. pos += set[i + 1];
  416. if (pos >= code)
  417. return true;
  418. }
  419. return false;
  420. }
  421. function isIdentifierStart(code) {
  422. if (code < 65)
  423. return code === 36;
  424. if (code <= 90)
  425. return true;
  426. if (code < 97)
  427. return code === 95;
  428. if (code <= 122)
  429. return true;
  430. if (code <= 65535) {
  431. return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code));
  432. }
  433. return isInAstralSet(code, astralIdentifierStartCodes);
  434. }
  435. function isIdentifierChar(code) {
  436. if (code < 48)
  437. return code === 36;
  438. if (code < 58)
  439. return true;
  440. if (code < 65)
  441. return false;
  442. if (code <= 90)
  443. return true;
  444. if (code < 97)
  445. return code === 95;
  446. if (code <= 122)
  447. return true;
  448. if (code <= 65535) {
  449. return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));
  450. }
  451. return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
  452. }
  453. function isIdentifierName(name) {
  454. let isFirst = true;
  455. for (let i = 0; i < name.length; i++) {
  456. let cp = name.charCodeAt(i);
  457. if ((cp & 64512) === 55296 && i + 1 < name.length) {
  458. const trail = name.charCodeAt(++i);
  459. if ((trail & 64512) === 56320) {
  460. cp = 65536 + ((cp & 1023) << 10) + (trail & 1023);
  461. }
  462. }
  463. if (isFirst) {
  464. isFirst = false;
  465. if (!isIdentifierStart(cp)) {
  466. return false;
  467. }
  468. } else if (!isIdentifierChar(cp)) {
  469. return false;
  470. }
  471. }
  472. return !isFirst;
  473. }
  474. }
  475. });
  476. var require_keyword = __commonJS({
  477. "node_modules/@babel/helper-validator-identifier/lib/keyword.js"(exports2) {
  478. "use strict";
  479. Object.defineProperty(exports2, "__esModule", {
  480. value: true
  481. });
  482. exports2.isKeyword = isKeyword;
  483. exports2.isReservedWord = isReservedWord;
  484. exports2.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
  485. exports2.isStrictBindReservedWord = isStrictBindReservedWord;
  486. exports2.isStrictReservedWord = isStrictReservedWord;
  487. var reservedWords = {
  488. keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
  489. strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
  490. strictBind: ["eval", "arguments"]
  491. };
  492. var keywords = new Set(reservedWords.keyword);
  493. var reservedWordsStrictSet = new Set(reservedWords.strict);
  494. var reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
  495. function isReservedWord(word, inModule) {
  496. return inModule && word === "await" || word === "enum";
  497. }
  498. function isStrictReservedWord(word, inModule) {
  499. return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
  500. }
  501. function isStrictBindOnlyReservedWord(word) {
  502. return reservedWordsStrictBindSet.has(word);
  503. }
  504. function isStrictBindReservedWord(word, inModule) {
  505. return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
  506. }
  507. function isKeyword(word) {
  508. return keywords.has(word);
  509. }
  510. }
  511. });
  512. var require_lib = __commonJS({
  513. "node_modules/@babel/helper-validator-identifier/lib/index.js"(exports2) {
  514. "use strict";
  515. Object.defineProperty(exports2, "__esModule", {
  516. value: true
  517. });
  518. Object.defineProperty(exports2, "isIdentifierChar", {
  519. enumerable: true,
  520. get: function() {
  521. return _identifier.isIdentifierChar;
  522. }
  523. });
  524. Object.defineProperty(exports2, "isIdentifierName", {
  525. enumerable: true,
  526. get: function() {
  527. return _identifier.isIdentifierName;
  528. }
  529. });
  530. Object.defineProperty(exports2, "isIdentifierStart", {
  531. enumerable: true,
  532. get: function() {
  533. return _identifier.isIdentifierStart;
  534. }
  535. });
  536. Object.defineProperty(exports2, "isKeyword", {
  537. enumerable: true,
  538. get: function() {
  539. return _keyword.isKeyword;
  540. }
  541. });
  542. Object.defineProperty(exports2, "isReservedWord", {
  543. enumerable: true,
  544. get: function() {
  545. return _keyword.isReservedWord;
  546. }
  547. });
  548. Object.defineProperty(exports2, "isStrictBindOnlyReservedWord", {
  549. enumerable: true,
  550. get: function() {
  551. return _keyword.isStrictBindOnlyReservedWord;
  552. }
  553. });
  554. Object.defineProperty(exports2, "isStrictBindReservedWord", {
  555. enumerable: true,
  556. get: function() {
  557. return _keyword.isStrictBindReservedWord;
  558. }
  559. });
  560. Object.defineProperty(exports2, "isStrictReservedWord", {
  561. enumerable: true,
  562. get: function() {
  563. return _keyword.isStrictReservedWord;
  564. }
  565. });
  566. var _identifier = require_identifier();
  567. var _keyword = require_keyword();
  568. }
  569. });
  570. var require_escape_string_regexp = __commonJS({
  571. "node_modules/@babel/highlight/node_modules/escape-string-regexp/index.js"(exports2, module2) {
  572. "use strict";
  573. var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
  574. module2.exports = function(str) {
  575. if (typeof str !== "string") {
  576. throw new TypeError("Expected a string");
  577. }
  578. return str.replace(matchOperatorsRe, "\\$&");
  579. };
  580. }
  581. });
  582. var require_color_name = __commonJS({
  583. "node_modules/color-name/index.js"(exports2, module2) {
  584. "use strict";
  585. module2.exports = {
  586. "aliceblue": [240, 248, 255],
  587. "antiquewhite": [250, 235, 215],
  588. "aqua": [0, 255, 255],
  589. "aquamarine": [127, 255, 212],
  590. "azure": [240, 255, 255],
  591. "beige": [245, 245, 220],
  592. "bisque": [255, 228, 196],
  593. "black": [0, 0, 0],
  594. "blanchedalmond": [255, 235, 205],
  595. "blue": [0, 0, 255],
  596. "blueviolet": [138, 43, 226],
  597. "brown": [165, 42, 42],
  598. "burlywood": [222, 184, 135],
  599. "cadetblue": [95, 158, 160],
  600. "chartreuse": [127, 255, 0],
  601. "chocolate": [210, 105, 30],
  602. "coral": [255, 127, 80],
  603. "cornflowerblue": [100, 149, 237],
  604. "cornsilk": [255, 248, 220],
  605. "crimson": [220, 20, 60],
  606. "cyan": [0, 255, 255],
  607. "darkblue": [0, 0, 139],
  608. "darkcyan": [0, 139, 139],
  609. "darkgoldenrod": [184, 134, 11],
  610. "darkgray": [169, 169, 169],
  611. "darkgreen": [0, 100, 0],
  612. "darkgrey": [169, 169, 169],
  613. "darkkhaki": [189, 183, 107],
  614. "darkmagenta": [139, 0, 139],
  615. "darkolivegreen": [85, 107, 47],
  616. "darkorange": [255, 140, 0],
  617. "darkorchid": [153, 50, 204],
  618. "darkred": [139, 0, 0],
  619. "darksalmon": [233, 150, 122],
  620. "darkseagreen": [143, 188, 143],
  621. "darkslateblue": [72, 61, 139],
  622. "darkslategray": [47, 79, 79],
  623. "darkslategrey": [47, 79, 79],
  624. "darkturquoise": [0, 206, 209],
  625. "darkviolet": [148, 0, 211],
  626. "deeppink": [255, 20, 147],
  627. "deepskyblue": [0, 191, 255],
  628. "dimgray": [105, 105, 105],
  629. "dimgrey": [105, 105, 105],
  630. "dodgerblue": [30, 144, 255],
  631. "firebrick": [178, 34, 34],
  632. "floralwhite": [255, 250, 240],
  633. "forestgreen": [34, 139, 34],
  634. "fuchsia": [255, 0, 255],
  635. "gainsboro": [220, 220, 220],
  636. "ghostwhite": [248, 248, 255],
  637. "gold": [255, 215, 0],
  638. "goldenrod": [218, 165, 32],
  639. "gray": [128, 128, 128],
  640. "green": [0, 128, 0],
  641. "greenyellow": [173, 255, 47],
  642. "grey": [128, 128, 128],
  643. "honeydew": [240, 255, 240],
  644. "hotpink": [255, 105, 180],
  645. "indianred": [205, 92, 92],
  646. "indigo": [75, 0, 130],
  647. "ivory": [255, 255, 240],
  648. "khaki": [240, 230, 140],
  649. "lavender": [230, 230, 250],
  650. "lavenderblush": [255, 240, 245],
  651. "lawngreen": [124, 252, 0],
  652. "lemonchiffon": [255, 250, 205],
  653. "lightblue": [173, 216, 230],
  654. "lightcoral": [240, 128, 128],
  655. "lightcyan": [224, 255, 255],
  656. "lightgoldenrodyellow": [250, 250, 210],
  657. "lightgray": [211, 211, 211],
  658. "lightgreen": [144, 238, 144],
  659. "lightgrey": [211, 211, 211],
  660. "lightpink": [255, 182, 193],
  661. "lightsalmon": [255, 160, 122],
  662. "lightseagreen": [32, 178, 170],
  663. "lightskyblue": [135, 206, 250],
  664. "lightslategray": [119, 136, 153],
  665. "lightslategrey": [119, 136, 153],
  666. "lightsteelblue": [176, 196, 222],
  667. "lightyellow": [255, 255, 224],
  668. "lime": [0, 255, 0],
  669. "limegreen": [50, 205, 50],
  670. "linen": [250, 240, 230],
  671. "magenta": [255, 0, 255],
  672. "maroon": [128, 0, 0],
  673. "mediumaquamarine": [102, 205, 170],
  674. "mediumblue": [0, 0, 205],
  675. "mediumorchid": [186, 85, 211],
  676. "mediumpurple": [147, 112, 219],
  677. "mediumseagreen": [60, 179, 113],
  678. "mediumslateblue": [123, 104, 238],
  679. "mediumspringgreen": [0, 250, 154],
  680. "mediumturquoise": [72, 209, 204],
  681. "mediumvioletred": [199, 21, 133],
  682. "midnightblue": [25, 25, 112],
  683. "mintcream": [245, 255, 250],
  684. "mistyrose": [255, 228, 225],
  685. "moccasin": [255, 228, 181],
  686. "navajowhite": [255, 222, 173],
  687. "navy": [0, 0, 128],
  688. "oldlace": [253, 245, 230],
  689. "olive": [128, 128, 0],
  690. "olivedrab": [107, 142, 35],
  691. "orange": [255, 165, 0],
  692. "orangered": [255, 69, 0],
  693. "orchid": [218, 112, 214],
  694. "palegoldenrod": [238, 232, 170],
  695. "palegreen": [152, 251, 152],
  696. "paleturquoise": [175, 238, 238],
  697. "palevioletred": [219, 112, 147],
  698. "papayawhip": [255, 239, 213],
  699. "peachpuff": [255, 218, 185],
  700. "peru": [205, 133, 63],
  701. "pink": [255, 192, 203],
  702. "plum": [221, 160, 221],
  703. "powderblue": [176, 224, 230],
  704. "purple": [128, 0, 128],
  705. "rebeccapurple": [102, 51, 153],
  706. "red": [255, 0, 0],
  707. "rosybrown": [188, 143, 143],
  708. "royalblue": [65, 105, 225],
  709. "saddlebrown": [139, 69, 19],
  710. "salmon": [250, 128, 114],
  711. "sandybrown": [244, 164, 96],
  712. "seagreen": [46, 139, 87],
  713. "seashell": [255, 245, 238],
  714. "sienna": [160, 82, 45],
  715. "silver": [192, 192, 192],
  716. "skyblue": [135, 206, 235],
  717. "slateblue": [106, 90, 205],
  718. "slategray": [112, 128, 144],
  719. "slategrey": [112, 128, 144],
  720. "snow": [255, 250, 250],
  721. "springgreen": [0, 255, 127],
  722. "steelblue": [70, 130, 180],
  723. "tan": [210, 180, 140],
  724. "teal": [0, 128, 128],
  725. "thistle": [216, 191, 216],
  726. "tomato": [255, 99, 71],
  727. "turquoise": [64, 224, 208],
  728. "violet": [238, 130, 238],
  729. "wheat": [245, 222, 179],
  730. "white": [255, 255, 255],
  731. "whitesmoke": [245, 245, 245],
  732. "yellow": [255, 255, 0],
  733. "yellowgreen": [154, 205, 50]
  734. };
  735. }
  736. });
  737. var require_conversions = __commonJS({
  738. "node_modules/color-convert/conversions.js"(exports2, module2) {
  739. var cssKeywords = require_color_name();
  740. var reverseKeywords = {};
  741. for (key in cssKeywords) {
  742. if (cssKeywords.hasOwnProperty(key)) {
  743. reverseKeywords[cssKeywords[key]] = key;
  744. }
  745. }
  746. var key;
  747. var convert = module2.exports = {
  748. rgb: {
  749. channels: 3,
  750. labels: "rgb"
  751. },
  752. hsl: {
  753. channels: 3,
  754. labels: "hsl"
  755. },
  756. hsv: {
  757. channels: 3,
  758. labels: "hsv"
  759. },
  760. hwb: {
  761. channels: 3,
  762. labels: "hwb"
  763. },
  764. cmyk: {
  765. channels: 4,
  766. labels: "cmyk"
  767. },
  768. xyz: {
  769. channels: 3,
  770. labels: "xyz"
  771. },
  772. lab: {
  773. channels: 3,
  774. labels: "lab"
  775. },
  776. lch: {
  777. channels: 3,
  778. labels: "lch"
  779. },
  780. hex: {
  781. channels: 1,
  782. labels: ["hex"]
  783. },
  784. keyword: {
  785. channels: 1,
  786. labels: ["keyword"]
  787. },
  788. ansi16: {
  789. channels: 1,
  790. labels: ["ansi16"]
  791. },
  792. ansi256: {
  793. channels: 1,
  794. labels: ["ansi256"]
  795. },
  796. hcg: {
  797. channels: 3,
  798. labels: ["h", "c", "g"]
  799. },
  800. apple: {
  801. channels: 3,
  802. labels: ["r16", "g16", "b16"]
  803. },
  804. gray: {
  805. channels: 1,
  806. labels: ["gray"]
  807. }
  808. };
  809. for (model in convert) {
  810. if (convert.hasOwnProperty(model)) {
  811. if (!("channels" in convert[model])) {
  812. throw new Error("missing channels property: " + model);
  813. }
  814. if (!("labels" in convert[model])) {
  815. throw new Error("missing channel labels property: " + model);
  816. }
  817. if (convert[model].labels.length !== convert[model].channels) {
  818. throw new Error("channel and label counts mismatch: " + model);
  819. }
  820. channels = convert[model].channels;
  821. labels = convert[model].labels;
  822. delete convert[model].channels;
  823. delete convert[model].labels;
  824. Object.defineProperty(convert[model], "channels", {
  825. value: channels
  826. });
  827. Object.defineProperty(convert[model], "labels", {
  828. value: labels
  829. });
  830. }
  831. }
  832. var channels;
  833. var labels;
  834. var model;
  835. convert.rgb.hsl = function(rgb) {
  836. var r = rgb[0] / 255;
  837. var g = rgb[1] / 255;
  838. var b = rgb[2] / 255;
  839. var min = Math.min(r, g, b);
  840. var max = Math.max(r, g, b);
  841. var delta = max - min;
  842. var h;
  843. var s;
  844. var l;
  845. if (max === min) {
  846. h = 0;
  847. } else if (r === max) {
  848. h = (g - b) / delta;
  849. } else if (g === max) {
  850. h = 2 + (b - r) / delta;
  851. } else if (b === max) {
  852. h = 4 + (r - g) / delta;
  853. }
  854. h = Math.min(h * 60, 360);
  855. if (h < 0) {
  856. h += 360;
  857. }
  858. l = (min + max) / 2;
  859. if (max === min) {
  860. s = 0;
  861. } else if (l <= 0.5) {
  862. s = delta / (max + min);
  863. } else {
  864. s = delta / (2 - max - min);
  865. }
  866. return [h, s * 100, l * 100];
  867. };
  868. convert.rgb.hsv = function(rgb) {
  869. var rdif;
  870. var gdif;
  871. var bdif;
  872. var h;
  873. var s;
  874. var r = rgb[0] / 255;
  875. var g = rgb[1] / 255;
  876. var b = rgb[2] / 255;
  877. var v = Math.max(r, g, b);
  878. var diff = v - Math.min(r, g, b);
  879. var diffc = function(c) {
  880. return (v - c) / 6 / diff + 1 / 2;
  881. };
  882. if (diff === 0) {
  883. h = s = 0;
  884. } else {
  885. s = diff / v;
  886. rdif = diffc(r);
  887. gdif = diffc(g);
  888. bdif = diffc(b);
  889. if (r === v) {
  890. h = bdif - gdif;
  891. } else if (g === v) {
  892. h = 1 / 3 + rdif - bdif;
  893. } else if (b === v) {
  894. h = 2 / 3 + gdif - rdif;
  895. }
  896. if (h < 0) {
  897. h += 1;
  898. } else if (h > 1) {
  899. h -= 1;
  900. }
  901. }
  902. return [h * 360, s * 100, v * 100];
  903. };
  904. convert.rgb.hwb = function(rgb) {
  905. var r = rgb[0];
  906. var g = rgb[1];
  907. var b = rgb[2];
  908. var h = convert.rgb.hsl(rgb)[0];
  909. var w = 1 / 255 * Math.min(r, Math.min(g, b));
  910. b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
  911. return [h, w * 100, b * 100];
  912. };
  913. convert.rgb.cmyk = function(rgb) {
  914. var r = rgb[0] / 255;
  915. var g = rgb[1] / 255;
  916. var b = rgb[2] / 255;
  917. var c;
  918. var m;
  919. var y;
  920. var k;
  921. k = Math.min(1 - r, 1 - g, 1 - b);
  922. c = (1 - r - k) / (1 - k) || 0;
  923. m = (1 - g - k) / (1 - k) || 0;
  924. y = (1 - b - k) / (1 - k) || 0;
  925. return [c * 100, m * 100, y * 100, k * 100];
  926. };
  927. function comparativeDistance(x, y) {
  928. return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
  929. }
  930. convert.rgb.keyword = function(rgb) {
  931. var reversed = reverseKeywords[rgb];
  932. if (reversed) {
  933. return reversed;
  934. }
  935. var currentClosestDistance = Infinity;
  936. var currentClosestKeyword;
  937. for (var keyword in cssKeywords) {
  938. if (cssKeywords.hasOwnProperty(keyword)) {
  939. var value = cssKeywords[keyword];
  940. var distance = comparativeDistance(rgb, value);
  941. if (distance < currentClosestDistance) {
  942. currentClosestDistance = distance;
  943. currentClosestKeyword = keyword;
  944. }
  945. }
  946. }
  947. return currentClosestKeyword;
  948. };
  949. convert.keyword.rgb = function(keyword) {
  950. return cssKeywords[keyword];
  951. };
  952. convert.rgb.xyz = function(rgb) {
  953. var r = rgb[0] / 255;
  954. var g = rgb[1] / 255;
  955. var b = rgb[2] / 255;
  956. r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
  957. g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
  958. b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
  959. var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
  960. var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
  961. var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
  962. return [x * 100, y * 100, z * 100];
  963. };
  964. convert.rgb.lab = function(rgb) {
  965. var xyz = convert.rgb.xyz(rgb);
  966. var x = xyz[0];
  967. var y = xyz[1];
  968. var z = xyz[2];
  969. var l;
  970. var a;
  971. var b;
  972. x /= 95.047;
  973. y /= 100;
  974. z /= 108.883;
  975. x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
  976. y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
  977. z = z > 8856e-6 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
  978. l = 116 * y - 16;
  979. a = 500 * (x - y);
  980. b = 200 * (y - z);
  981. return [l, a, b];
  982. };
  983. convert.hsl.rgb = function(hsl) {
  984. var h = hsl[0] / 360;
  985. var s = hsl[1] / 100;
  986. var l = hsl[2] / 100;
  987. var t1;
  988. var t2;
  989. var t3;
  990. var rgb;
  991. var val;
  992. if (s === 0) {
  993. val = l * 255;
  994. return [val, val, val];
  995. }
  996. if (l < 0.5) {
  997. t2 = l * (1 + s);
  998. } else {
  999. t2 = l + s - l * s;
  1000. }
  1001. t1 = 2 * l - t2;
  1002. rgb = [0, 0, 0];
  1003. for (var i = 0; i < 3; i++) {
  1004. t3 = h + 1 / 3 * -(i - 1);
  1005. if (t3 < 0) {
  1006. t3++;
  1007. }
  1008. if (t3 > 1) {
  1009. t3--;
  1010. }
  1011. if (6 * t3 < 1) {
  1012. val = t1 + (t2 - t1) * 6 * t3;
  1013. } else if (2 * t3 < 1) {
  1014. val = t2;
  1015. } else if (3 * t3 < 2) {
  1016. val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
  1017. } else {
  1018. val = t1;
  1019. }
  1020. rgb[i] = val * 255;
  1021. }
  1022. return rgb;
  1023. };
  1024. convert.hsl.hsv = function(hsl) {
  1025. var h = hsl[0];
  1026. var s = hsl[1] / 100;
  1027. var l = hsl[2] / 100;
  1028. var smin = s;
  1029. var lmin = Math.max(l, 0.01);
  1030. var sv;
  1031. var v;
  1032. l *= 2;
  1033. s *= l <= 1 ? l : 2 - l;
  1034. smin *= lmin <= 1 ? lmin : 2 - lmin;
  1035. v = (l + s) / 2;
  1036. sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
  1037. return [h, sv * 100, v * 100];
  1038. };
  1039. convert.hsv.rgb = function(hsv) {
  1040. var h = hsv[0] / 60;
  1041. var s = hsv[1] / 100;
  1042. var v = hsv[2] / 100;
  1043. var hi = Math.floor(h) % 6;
  1044. var f = h - Math.floor(h);
  1045. var p = 255 * v * (1 - s);
  1046. var q = 255 * v * (1 - s * f);
  1047. var t = 255 * v * (1 - s * (1 - f));
  1048. v *= 255;
  1049. switch (hi) {
  1050. case 0:
  1051. return [v, t, p];
  1052. case 1:
  1053. return [q, v, p];
  1054. case 2:
  1055. return [p, v, t];
  1056. case 3:
  1057. return [p, q, v];
  1058. case 4:
  1059. return [t, p, v];
  1060. case 5:
  1061. return [v, p, q];
  1062. }
  1063. };
  1064. convert.hsv.hsl = function(hsv) {
  1065. var h = hsv[0];
  1066. var s = hsv[1] / 100;
  1067. var v = hsv[2] / 100;
  1068. var vmin = Math.max(v, 0.01);
  1069. var lmin;
  1070. var sl;
  1071. var l;
  1072. l = (2 - s) * v;
  1073. lmin = (2 - s) * vmin;
  1074. sl = s * vmin;
  1075. sl /= lmin <= 1 ? lmin : 2 - lmin;
  1076. sl = sl || 0;
  1077. l /= 2;
  1078. return [h, sl * 100, l * 100];
  1079. };
  1080. convert.hwb.rgb = function(hwb) {
  1081. var h = hwb[0] / 360;
  1082. var wh = hwb[1] / 100;
  1083. var bl = hwb[2] / 100;
  1084. var ratio = wh + bl;
  1085. var i;
  1086. var v;
  1087. var f;
  1088. var n;
  1089. if (ratio > 1) {
  1090. wh /= ratio;
  1091. bl /= ratio;
  1092. }
  1093. i = Math.floor(6 * h);
  1094. v = 1 - bl;
  1095. f = 6 * h - i;
  1096. if ((i & 1) !== 0) {
  1097. f = 1 - f;
  1098. }
  1099. n = wh + f * (v - wh);
  1100. var r;
  1101. var g;
  1102. var b;
  1103. switch (i) {
  1104. default:
  1105. case 6:
  1106. case 0:
  1107. r = v;
  1108. g = n;
  1109. b = wh;
  1110. break;
  1111. case 1:
  1112. r = n;
  1113. g = v;
  1114. b = wh;
  1115. break;
  1116. case 2:
  1117. r = wh;
  1118. g = v;
  1119. b = n;
  1120. break;
  1121. case 3:
  1122. r = wh;
  1123. g = n;
  1124. b = v;
  1125. break;
  1126. case 4:
  1127. r = n;
  1128. g = wh;
  1129. b = v;
  1130. break;
  1131. case 5:
  1132. r = v;
  1133. g = wh;
  1134. b = n;
  1135. break;
  1136. }
  1137. return [r * 255, g * 255, b * 255];
  1138. };
  1139. convert.cmyk.rgb = function(cmyk) {
  1140. var c = cmyk[0] / 100;
  1141. var m = cmyk[1] / 100;
  1142. var y = cmyk[2] / 100;
  1143. var k = cmyk[3] / 100;
  1144. var r;
  1145. var g;
  1146. var b;
  1147. r = 1 - Math.min(1, c * (1 - k) + k);
  1148. g = 1 - Math.min(1, m * (1 - k) + k);
  1149. b = 1 - Math.min(1, y * (1 - k) + k);
  1150. return [r * 255, g * 255, b * 255];
  1151. };
  1152. convert.xyz.rgb = function(xyz) {
  1153. var x = xyz[0] / 100;
  1154. var y = xyz[1] / 100;
  1155. var z = xyz[2] / 100;
  1156. var r;
  1157. var g;
  1158. var b;
  1159. r = x * 3.2406 + y * -1.5372 + z * -0.4986;
  1160. g = x * -0.9689 + y * 1.8758 + z * 0.0415;
  1161. b = x * 0.0557 + y * -0.204 + z * 1.057;
  1162. r = r > 31308e-7 ? 1.055 * Math.pow(r, 1 / 2.4) - 0.055 : r * 12.92;
  1163. g = g > 31308e-7 ? 1.055 * Math.pow(g, 1 / 2.4) - 0.055 : g * 12.92;
  1164. b = b > 31308e-7 ? 1.055 * Math.pow(b, 1 / 2.4) - 0.055 : b * 12.92;
  1165. r = Math.min(Math.max(0, r), 1);
  1166. g = Math.min(Math.max(0, g), 1);
  1167. b = Math.min(Math.max(0, b), 1);
  1168. return [r * 255, g * 255, b * 255];
  1169. };
  1170. convert.xyz.lab = function(xyz) {
  1171. var x = xyz[0];
  1172. var y = xyz[1];
  1173. var z = xyz[2];
  1174. var l;
  1175. var a;
  1176. var b;
  1177. x /= 95.047;
  1178. y /= 100;
  1179. z /= 108.883;
  1180. x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
  1181. y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
  1182. z = z > 8856e-6 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
  1183. l = 116 * y - 16;
  1184. a = 500 * (x - y);
  1185. b = 200 * (y - z);
  1186. return [l, a, b];
  1187. };
  1188. convert.lab.xyz = function(lab) {
  1189. var l = lab[0];
  1190. var a = lab[1];
  1191. var b = lab[2];
  1192. var x;
  1193. var y;
  1194. var z;
  1195. y = (l + 16) / 116;
  1196. x = a / 500 + y;
  1197. z = y - b / 200;
  1198. var y2 = Math.pow(y, 3);
  1199. var x2 = Math.pow(x, 3);
  1200. var z2 = Math.pow(z, 3);
  1201. y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
  1202. x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
  1203. z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
  1204. x *= 95.047;
  1205. y *= 100;
  1206. z *= 108.883;
  1207. return [x, y, z];
  1208. };
  1209. convert.lab.lch = function(lab) {
  1210. var l = lab[0];
  1211. var a = lab[1];
  1212. var b = lab[2];
  1213. var hr;
  1214. var h;
  1215. var c;
  1216. hr = Math.atan2(b, a);
  1217. h = hr * 360 / 2 / Math.PI;
  1218. if (h < 0) {
  1219. h += 360;
  1220. }
  1221. c = Math.sqrt(a * a + b * b);
  1222. return [l, c, h];
  1223. };
  1224. convert.lch.lab = function(lch) {
  1225. var l = lch[0];
  1226. var c = lch[1];
  1227. var h = lch[2];
  1228. var a;
  1229. var b;
  1230. var hr;
  1231. hr = h / 360 * 2 * Math.PI;
  1232. a = c * Math.cos(hr);
  1233. b = c * Math.sin(hr);
  1234. return [l, a, b];
  1235. };
  1236. convert.rgb.ansi16 = function(args) {
  1237. var r = args[0];
  1238. var g = args[1];
  1239. var b = args[2];
  1240. var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2];
  1241. value = Math.round(value / 50);
  1242. if (value === 0) {
  1243. return 30;
  1244. }
  1245. var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
  1246. if (value === 2) {
  1247. ansi += 60;
  1248. }
  1249. return ansi;
  1250. };
  1251. convert.hsv.ansi16 = function(args) {
  1252. return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
  1253. };
  1254. convert.rgb.ansi256 = function(args) {
  1255. var r = args[0];
  1256. var g = args[1];
  1257. var b = args[2];
  1258. if (r === g && g === b) {
  1259. if (r < 8) {
  1260. return 16;
  1261. }
  1262. if (r > 248) {
  1263. return 231;
  1264. }
  1265. return Math.round((r - 8) / 247 * 24) + 232;
  1266. }
  1267. var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
  1268. return ansi;
  1269. };
  1270. convert.ansi16.rgb = function(args) {
  1271. var color = args % 10;
  1272. if (color === 0 || color === 7) {
  1273. if (args > 50) {
  1274. color += 3.5;
  1275. }
  1276. color = color / 10.5 * 255;
  1277. return [color, color, color];
  1278. }
  1279. var mult = (~~(args > 50) + 1) * 0.5;
  1280. var r = (color & 1) * mult * 255;
  1281. var g = (color >> 1 & 1) * mult * 255;
  1282. var b = (color >> 2 & 1) * mult * 255;
  1283. return [r, g, b];
  1284. };
  1285. convert.ansi256.rgb = function(args) {
  1286. if (args >= 232) {
  1287. var c = (args - 232) * 10 + 8;
  1288. return [c, c, c];
  1289. }
  1290. args -= 16;
  1291. var rem;
  1292. var r = Math.floor(args / 36) / 5 * 255;
  1293. var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
  1294. var b = rem % 6 / 5 * 255;
  1295. return [r, g, b];
  1296. };
  1297. convert.rgb.hex = function(args) {
  1298. var integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
  1299. var string = integer.toString(16).toUpperCase();
  1300. return "000000".substring(string.length) + string;
  1301. };
  1302. convert.hex.rgb = function(args) {
  1303. var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
  1304. if (!match) {
  1305. return [0, 0, 0];
  1306. }
  1307. var colorString = match[0];
  1308. if (match[0].length === 3) {
  1309. colorString = colorString.split("").map(function(char) {
  1310. return char + char;
  1311. }).join("");
  1312. }
  1313. var integer = parseInt(colorString, 16);
  1314. var r = integer >> 16 & 255;
  1315. var g = integer >> 8 & 255;
  1316. var b = integer & 255;
  1317. return [r, g, b];
  1318. };
  1319. convert.rgb.hcg = function(rgb) {
  1320. var r = rgb[0] / 255;
  1321. var g = rgb[1] / 255;
  1322. var b = rgb[2] / 255;
  1323. var max = Math.max(Math.max(r, g), b);
  1324. var min = Math.min(Math.min(r, g), b);
  1325. var chroma = max - min;
  1326. var grayscale;
  1327. var hue;
  1328. if (chroma < 1) {
  1329. grayscale = min / (1 - chroma);
  1330. } else {
  1331. grayscale = 0;
  1332. }
  1333. if (chroma <= 0) {
  1334. hue = 0;
  1335. } else if (max === r) {
  1336. hue = (g - b) / chroma % 6;
  1337. } else if (max === g) {
  1338. hue = 2 + (b - r) / chroma;
  1339. } else {
  1340. hue = 4 + (r - g) / chroma + 4;
  1341. }
  1342. hue /= 6;
  1343. hue %= 1;
  1344. return [hue * 360, chroma * 100, grayscale * 100];
  1345. };
  1346. convert.hsl.hcg = function(hsl) {
  1347. var s = hsl[1] / 100;
  1348. var l = hsl[2] / 100;
  1349. var c = 1;
  1350. var f = 0;
  1351. if (l < 0.5) {
  1352. c = 2 * s * l;
  1353. } else {
  1354. c = 2 * s * (1 - l);
  1355. }
  1356. if (c < 1) {
  1357. f = (l - 0.5 * c) / (1 - c);
  1358. }
  1359. return [hsl[0], c * 100, f * 100];
  1360. };
  1361. convert.hsv.hcg = function(hsv) {
  1362. var s = hsv[1] / 100;
  1363. var v = hsv[2] / 100;
  1364. var c = s * v;
  1365. var f = 0;
  1366. if (c < 1) {
  1367. f = (v - c) / (1 - c);
  1368. }
  1369. return [hsv[0], c * 100, f * 100];
  1370. };
  1371. convert.hcg.rgb = function(hcg) {
  1372. var h = hcg[0] / 360;
  1373. var c = hcg[1] / 100;
  1374. var g = hcg[2] / 100;
  1375. if (c === 0) {
  1376. return [g * 255, g * 255, g * 255];
  1377. }
  1378. var pure = [0, 0, 0];
  1379. var hi = h % 1 * 6;
  1380. var v = hi % 1;
  1381. var w = 1 - v;
  1382. var mg = 0;
  1383. switch (Math.floor(hi)) {
  1384. case 0:
  1385. pure[0] = 1;
  1386. pure[1] = v;
  1387. pure[2] = 0;
  1388. break;
  1389. case 1:
  1390. pure[0] = w;
  1391. pure[1] = 1;
  1392. pure[2] = 0;
  1393. break;
  1394. case 2:
  1395. pure[0] = 0;
  1396. pure[1] = 1;
  1397. pure[2] = v;
  1398. break;
  1399. case 3:
  1400. pure[0] = 0;
  1401. pure[1] = w;
  1402. pure[2] = 1;
  1403. break;
  1404. case 4:
  1405. pure[0] = v;
  1406. pure[1] = 0;
  1407. pure[2] = 1;
  1408. break;
  1409. default:
  1410. pure[0] = 1;
  1411. pure[1] = 0;
  1412. pure[2] = w;
  1413. }
  1414. mg = (1 - c) * g;
  1415. return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
  1416. };
  1417. convert.hcg.hsv = function(hcg) {
  1418. var c = hcg[1] / 100;
  1419. var g = hcg[2] / 100;
  1420. var v = c + g * (1 - c);
  1421. var f = 0;
  1422. if (v > 0) {
  1423. f = c / v;
  1424. }
  1425. return [hcg[0], f * 100, v * 100];
  1426. };
  1427. convert.hcg.hsl = function(hcg) {
  1428. var c = hcg[1] / 100;
  1429. var g = hcg[2] / 100;
  1430. var l = g * (1 - c) + 0.5 * c;
  1431. var s = 0;
  1432. if (l > 0 && l < 0.5) {
  1433. s = c / (2 * l);
  1434. } else if (l >= 0.5 && l < 1) {
  1435. s = c / (2 * (1 - l));
  1436. }
  1437. return [hcg[0], s * 100, l * 100];
  1438. };
  1439. convert.hcg.hwb = function(hcg) {
  1440. var c = hcg[1] / 100;
  1441. var g = hcg[2] / 100;
  1442. var v = c + g * (1 - c);
  1443. return [hcg[0], (v - c) * 100, (1 - v) * 100];
  1444. };
  1445. convert.hwb.hcg = function(hwb) {
  1446. var w = hwb[1] / 100;
  1447. var b = hwb[2] / 100;
  1448. var v = 1 - b;
  1449. var c = v - w;
  1450. var g = 0;
  1451. if (c < 1) {
  1452. g = (v - c) / (1 - c);
  1453. }
  1454. return [hwb[0], c * 100, g * 100];
  1455. };
  1456. convert.apple.rgb = function(apple) {
  1457. return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
  1458. };
  1459. convert.rgb.apple = function(rgb) {
  1460. return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
  1461. };
  1462. convert.gray.rgb = function(args) {
  1463. return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
  1464. };
  1465. convert.gray.hsl = convert.gray.hsv = function(args) {
  1466. return [0, 0, args[0]];
  1467. };
  1468. convert.gray.hwb = function(gray) {
  1469. return [0, 100, gray[0]];
  1470. };
  1471. convert.gray.cmyk = function(gray) {
  1472. return [0, 0, 0, gray[0]];
  1473. };
  1474. convert.gray.lab = function(gray) {
  1475. return [gray[0], 0, 0];
  1476. };
  1477. convert.gray.hex = function(gray) {
  1478. var val = Math.round(gray[0] / 100 * 255) & 255;
  1479. var integer = (val << 16) + (val << 8) + val;
  1480. var string = integer.toString(16).toUpperCase();
  1481. return "000000".substring(string.length) + string;
  1482. };
  1483. convert.rgb.gray = function(rgb) {
  1484. var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
  1485. return [val / 255 * 100];
  1486. };
  1487. }
  1488. });
  1489. var require_route = __commonJS({
  1490. "node_modules/color-convert/route.js"(exports2, module2) {
  1491. var conversions = require_conversions();
  1492. function buildGraph() {
  1493. var graph = {};
  1494. var models = Object.keys(conversions);
  1495. for (var len = models.length, i = 0; i < len; i++) {
  1496. graph[models[i]] = {
  1497. distance: -1,
  1498. parent: null
  1499. };
  1500. }
  1501. return graph;
  1502. }
  1503. function deriveBFS(fromModel) {
  1504. var graph = buildGraph();
  1505. var queue = [fromModel];
  1506. graph[fromModel].distance = 0;
  1507. while (queue.length) {
  1508. var current = queue.pop();
  1509. var adjacents = Object.keys(conversions[current]);
  1510. for (var len = adjacents.length, i = 0; i < len; i++) {
  1511. var adjacent = adjacents[i];
  1512. var node = graph[adjacent];
  1513. if (node.distance === -1) {
  1514. node.distance = graph[current].distance + 1;
  1515. node.parent = current;
  1516. queue.unshift(adjacent);
  1517. }
  1518. }
  1519. }
  1520. return graph;
  1521. }
  1522. function link(from, to) {
  1523. return function(args) {
  1524. return to(from(args));
  1525. };
  1526. }
  1527. function wrapConversion(toModel, graph) {
  1528. var path = [graph[toModel].parent, toModel];
  1529. var fn = conversions[graph[toModel].parent][toModel];
  1530. var cur = graph[toModel].parent;
  1531. while (graph[cur].parent) {
  1532. path.unshift(graph[cur].parent);
  1533. fn = link(conversions[graph[cur].parent][cur], fn);
  1534. cur = graph[cur].parent;
  1535. }
  1536. fn.conversion = path;
  1537. return fn;
  1538. }
  1539. module2.exports = function(fromModel) {
  1540. var graph = deriveBFS(fromModel);
  1541. var conversion = {};
  1542. var models = Object.keys(graph);
  1543. for (var len = models.length, i = 0; i < len; i++) {
  1544. var toModel = models[i];
  1545. var node = graph[toModel];
  1546. if (node.parent === null) {
  1547. continue;
  1548. }
  1549. conversion[toModel] = wrapConversion(toModel, graph);
  1550. }
  1551. return conversion;
  1552. };
  1553. }
  1554. });
  1555. var require_color_convert = __commonJS({
  1556. "node_modules/color-convert/index.js"(exports2, module2) {
  1557. var conversions = require_conversions();
  1558. var route = require_route();
  1559. var convert = {};
  1560. var models = Object.keys(conversions);
  1561. function wrapRaw(fn) {
  1562. var wrappedFn = function(args) {
  1563. if (args === void 0 || args === null) {
  1564. return args;
  1565. }
  1566. if (arguments.length > 1) {
  1567. args = Array.prototype.slice.call(arguments);
  1568. }
  1569. return fn(args);
  1570. };
  1571. if ("conversion" in fn) {
  1572. wrappedFn.conversion = fn.conversion;
  1573. }
  1574. return wrappedFn;
  1575. }
  1576. function wrapRounded(fn) {
  1577. var wrappedFn = function(args) {
  1578. if (args === void 0 || args === null) {
  1579. return args;
  1580. }
  1581. if (arguments.length > 1) {
  1582. args = Array.prototype.slice.call(arguments);
  1583. }
  1584. var result = fn(args);
  1585. if (typeof result === "object") {
  1586. for (var len = result.length, i = 0; i < len; i++) {
  1587. result[i] = Math.round(result[i]);
  1588. }
  1589. }
  1590. return result;
  1591. };
  1592. if ("conversion" in fn) {
  1593. wrappedFn.conversion = fn.conversion;
  1594. }
  1595. return wrappedFn;
  1596. }
  1597. models.forEach(function(fromModel) {
  1598. convert[fromModel] = {};
  1599. Object.defineProperty(convert[fromModel], "channels", {
  1600. value: conversions[fromModel].channels
  1601. });
  1602. Object.defineProperty(convert[fromModel], "labels", {
  1603. value: conversions[fromModel].labels
  1604. });
  1605. var routes = route(fromModel);
  1606. var routeModels = Object.keys(routes);
  1607. routeModels.forEach(function(toModel) {
  1608. var fn = routes[toModel];
  1609. convert[fromModel][toModel] = wrapRounded(fn);
  1610. convert[fromModel][toModel].raw = wrapRaw(fn);
  1611. });
  1612. });
  1613. module2.exports = convert;
  1614. }
  1615. });
  1616. var require_ansi_styles = __commonJS({
  1617. "node_modules/ansi-styles/index.js"(exports2, module2) {
  1618. "use strict";
  1619. var colorConvert = require_color_convert();
  1620. var wrapAnsi16 = (fn, offset) => function() {
  1621. const code = fn.apply(colorConvert, arguments);
  1622. return `\x1B[${code + offset}m`;
  1623. };
  1624. var wrapAnsi256 = (fn, offset) => function() {
  1625. const code = fn.apply(colorConvert, arguments);
  1626. return `\x1B[${38 + offset};5;${code}m`;
  1627. };
  1628. var wrapAnsi16m = (fn, offset) => function() {
  1629. const rgb = fn.apply(colorConvert, arguments);
  1630. return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
  1631. };
  1632. function assembleStyles() {
  1633. const codes = /* @__PURE__ */ new Map();
  1634. const styles = {
  1635. modifier: {
  1636. reset: [0, 0],
  1637. bold: [1, 22],
  1638. dim: [2, 22],
  1639. italic: [3, 23],
  1640. underline: [4, 24],
  1641. inverse: [7, 27],
  1642. hidden: [8, 28],
  1643. strikethrough: [9, 29]
  1644. },
  1645. color: {
  1646. black: [30, 39],
  1647. red: [31, 39],
  1648. green: [32, 39],
  1649. yellow: [33, 39],
  1650. blue: [34, 39],
  1651. magenta: [35, 39],
  1652. cyan: [36, 39],
  1653. white: [37, 39],
  1654. gray: [90, 39],
  1655. redBright: [91, 39],
  1656. greenBright: [92, 39],
  1657. yellowBright: [93, 39],
  1658. blueBright: [94, 39],
  1659. magentaBright: [95, 39],
  1660. cyanBright: [96, 39],
  1661. whiteBright: [97, 39]
  1662. },
  1663. bgColor: {
  1664. bgBlack: [40, 49],
  1665. bgRed: [41, 49],
  1666. bgGreen: [42, 49],
  1667. bgYellow: [43, 49],
  1668. bgBlue: [44, 49],
  1669. bgMagenta: [45, 49],
  1670. bgCyan: [46, 49],
  1671. bgWhite: [47, 49],
  1672. bgBlackBright: [100, 49],
  1673. bgRedBright: [101, 49],
  1674. bgGreenBright: [102, 49],
  1675. bgYellowBright: [103, 49],
  1676. bgBlueBright: [104, 49],
  1677. bgMagentaBright: [105, 49],
  1678. bgCyanBright: [106, 49],
  1679. bgWhiteBright: [107, 49]
  1680. }
  1681. };
  1682. styles.color.grey = styles.color.gray;
  1683. for (const groupName of Object.keys(styles)) {
  1684. const group = styles[groupName];
  1685. for (const styleName of Object.keys(group)) {
  1686. const style = group[styleName];
  1687. styles[styleName] = {
  1688. open: `\x1B[${style[0]}m`,
  1689. close: `\x1B[${style[1]}m`
  1690. };
  1691. group[styleName] = styles[styleName];
  1692. codes.set(style[0], style[1]);
  1693. }
  1694. Object.defineProperty(styles, groupName, {
  1695. value: group,
  1696. enumerable: false
  1697. });
  1698. Object.defineProperty(styles, "codes", {
  1699. value: codes,
  1700. enumerable: false
  1701. });
  1702. }
  1703. const ansi2ansi = (n) => n;
  1704. const rgb2rgb = (r, g, b) => [r, g, b];
  1705. styles.color.close = "\x1B[39m";
  1706. styles.bgColor.close = "\x1B[49m";
  1707. styles.color.ansi = {
  1708. ansi: wrapAnsi16(ansi2ansi, 0)
  1709. };
  1710. styles.color.ansi256 = {
  1711. ansi256: wrapAnsi256(ansi2ansi, 0)
  1712. };
  1713. styles.color.ansi16m = {
  1714. rgb: wrapAnsi16m(rgb2rgb, 0)
  1715. };
  1716. styles.bgColor.ansi = {
  1717. ansi: wrapAnsi16(ansi2ansi, 10)
  1718. };
  1719. styles.bgColor.ansi256 = {
  1720. ansi256: wrapAnsi256(ansi2ansi, 10)
  1721. };
  1722. styles.bgColor.ansi16m = {
  1723. rgb: wrapAnsi16m(rgb2rgb, 10)
  1724. };
  1725. for (let key of Object.keys(colorConvert)) {
  1726. if (typeof colorConvert[key] !== "object") {
  1727. continue;
  1728. }
  1729. const suite = colorConvert[key];
  1730. if (key === "ansi16") {
  1731. key = "ansi";
  1732. }
  1733. if ("ansi16" in suite) {
  1734. styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
  1735. styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
  1736. }
  1737. if ("ansi256" in suite) {
  1738. styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
  1739. styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
  1740. }
  1741. if ("rgb" in suite) {
  1742. styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
  1743. styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
  1744. }
  1745. }
  1746. return styles;
  1747. }
  1748. Object.defineProperty(module2, "exports", {
  1749. enumerable: true,
  1750. get: assembleStyles
  1751. });
  1752. }
  1753. });
  1754. var require_has_flag = __commonJS({
  1755. "node_modules/@babel/highlight/node_modules/has-flag/index.js"(exports2, module2) {
  1756. "use strict";
  1757. module2.exports = (flag, argv) => {
  1758. argv = argv || process.argv;
  1759. const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
  1760. const pos = argv.indexOf(prefix + flag);
  1761. const terminatorPos = argv.indexOf("--");
  1762. return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
  1763. };
  1764. }
  1765. });
  1766. var require_supports_color = __commonJS({
  1767. "node_modules/@babel/highlight/node_modules/supports-color/index.js"(exports2, module2) {
  1768. "use strict";
  1769. var os = require("os");
  1770. var hasFlag = require_has_flag();
  1771. var env = process.env;
  1772. var forceColor;
  1773. if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) {
  1774. forceColor = false;
  1775. } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
  1776. forceColor = true;
  1777. }
  1778. if ("FORCE_COLOR" in env) {
  1779. forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
  1780. }
  1781. function translateLevel(level) {
  1782. if (level === 0) {
  1783. return false;
  1784. }
  1785. return {
  1786. level,
  1787. hasBasic: true,
  1788. has256: level >= 2,
  1789. has16m: level >= 3
  1790. };
  1791. }
  1792. function supportsColor(stream) {
  1793. if (forceColor === false) {
  1794. return 0;
  1795. }
  1796. if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
  1797. return 3;
  1798. }
  1799. if (hasFlag("color=256")) {
  1800. return 2;
  1801. }
  1802. if (stream && !stream.isTTY && forceColor !== true) {
  1803. return 0;
  1804. }
  1805. const min = forceColor ? 1 : 0;
  1806. if (process.platform === "win32") {
  1807. const osRelease = os.release().split(".");
  1808. if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
  1809. return Number(osRelease[2]) >= 14931 ? 3 : 2;
  1810. }
  1811. return 1;
  1812. }
  1813. if ("CI" in env) {
  1814. if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
  1815. return 1;
  1816. }
  1817. return min;
  1818. }
  1819. if ("TEAMCITY_VERSION" in env) {
  1820. return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
  1821. }
  1822. if (env.COLORTERM === "truecolor") {
  1823. return 3;
  1824. }
  1825. if ("TERM_PROGRAM" in env) {
  1826. const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
  1827. switch (env.TERM_PROGRAM) {
  1828. case "iTerm.app":
  1829. return version >= 3 ? 3 : 2;
  1830. case "Apple_Terminal":
  1831. return 2;
  1832. }
  1833. }
  1834. if (/-256(color)?$/i.test(env.TERM)) {
  1835. return 2;
  1836. }
  1837. if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
  1838. return 1;
  1839. }
  1840. if ("COLORTERM" in env) {
  1841. return 1;
  1842. }
  1843. if (env.TERM === "dumb") {
  1844. return min;
  1845. }
  1846. return min;
  1847. }
  1848. function getSupportLevel(stream) {
  1849. const level = supportsColor(stream);
  1850. return translateLevel(level);
  1851. }
  1852. module2.exports = {
  1853. supportsColor: getSupportLevel,
  1854. stdout: getSupportLevel(process.stdout),
  1855. stderr: getSupportLevel(process.stderr)
  1856. };
  1857. }
  1858. });
  1859. var require_templates = __commonJS({
  1860. "node_modules/@babel/highlight/node_modules/chalk/templates.js"(exports2, module2) {
  1861. "use strict";
  1862. var TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
  1863. var STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
  1864. var STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
  1865. var ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
  1866. var ESCAPES = /* @__PURE__ */ new Map([["n", "\n"], ["r", "\r"], ["t", " "], ["b", "\b"], ["f", "\f"], ["v", "\v"], ["0", "\0"], ["\\", "\\"], ["e", "\x1B"], ["a", "\x07"]]);
  1867. function unescape(c) {
  1868. if (c[0] === "u" && c.length === 5 || c[0] === "x" && c.length === 3) {
  1869. return String.fromCharCode(parseInt(c.slice(1), 16));
  1870. }
  1871. return ESCAPES.get(c) || c;
  1872. }
  1873. function parseArguments(name, args) {
  1874. const results = [];
  1875. const chunks = args.trim().split(/\s*,\s*/g);
  1876. let matches;
  1877. for (const chunk of chunks) {
  1878. if (!isNaN(chunk)) {
  1879. results.push(Number(chunk));
  1880. } else if (matches = chunk.match(STRING_REGEX)) {
  1881. results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
  1882. } else {
  1883. throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
  1884. }
  1885. }
  1886. return results;
  1887. }
  1888. function parseStyle(style) {
  1889. STYLE_REGEX.lastIndex = 0;
  1890. const results = [];
  1891. let matches;
  1892. while ((matches = STYLE_REGEX.exec(style)) !== null) {
  1893. const name = matches[1];
  1894. if (matches[2]) {
  1895. const args = parseArguments(name, matches[2]);
  1896. results.push([name].concat(args));
  1897. } else {
  1898. results.push([name]);
  1899. }
  1900. }
  1901. return results;
  1902. }
  1903. function buildStyle(chalk, styles) {
  1904. const enabled = {};
  1905. for (const layer of styles) {
  1906. for (const style of layer.styles) {
  1907. enabled[style[0]] = layer.inverse ? null : style.slice(1);
  1908. }
  1909. }
  1910. let current = chalk;
  1911. for (const styleName of Object.keys(enabled)) {
  1912. if (Array.isArray(enabled[styleName])) {
  1913. if (!(styleName in current)) {
  1914. throw new Error(`Unknown Chalk style: ${styleName}`);
  1915. }
  1916. if (enabled[styleName].length > 0) {
  1917. current = current[styleName].apply(current, enabled[styleName]);
  1918. } else {
  1919. current = current[styleName];
  1920. }
  1921. }
  1922. }
  1923. return current;
  1924. }
  1925. module2.exports = (chalk, tmp) => {
  1926. const styles = [];
  1927. const chunks = [];
  1928. let chunk = [];
  1929. tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
  1930. if (escapeChar) {
  1931. chunk.push(unescape(escapeChar));
  1932. } else if (style) {
  1933. const str = chunk.join("");
  1934. chunk = [];
  1935. chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
  1936. styles.push({
  1937. inverse,
  1938. styles: parseStyle(style)
  1939. });
  1940. } else if (close) {
  1941. if (styles.length === 0) {
  1942. throw new Error("Found extraneous } in Chalk template literal");
  1943. }
  1944. chunks.push(buildStyle(chalk, styles)(chunk.join("")));
  1945. chunk = [];
  1946. styles.pop();
  1947. } else {
  1948. chunk.push(chr);
  1949. }
  1950. });
  1951. chunks.push(chunk.join(""));
  1952. if (styles.length > 0) {
  1953. const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? "" : "s"} (\`}\`)`;
  1954. throw new Error(errMsg);
  1955. }
  1956. return chunks.join("");
  1957. };
  1958. }
  1959. });
  1960. var require_chalk = __commonJS({
  1961. "node_modules/@babel/highlight/node_modules/chalk/index.js"(exports2, module2) {
  1962. "use strict";
  1963. var escapeStringRegexp = require_escape_string_regexp();
  1964. var ansiStyles = require_ansi_styles();
  1965. var stdoutColor = require_supports_color().stdout;
  1966. var template = require_templates();
  1967. var isSimpleWindowsTerm = process.platform === "win32" && !(process.env.TERM || "").toLowerCase().startsWith("xterm");
  1968. var levelMapping = ["ansi", "ansi", "ansi256", "ansi16m"];
  1969. var skipModels = /* @__PURE__ */ new Set(["gray"]);
  1970. var styles = /* @__PURE__ */ Object.create(null);
  1971. function applyOptions(obj, options) {
  1972. options = options || {};
  1973. const scLevel = stdoutColor ? stdoutColor.level : 0;
  1974. obj.level = options.level === void 0 ? scLevel : options.level;
  1975. obj.enabled = "enabled" in options ? options.enabled : obj.level > 0;
  1976. }
  1977. function Chalk(options) {
  1978. if (!this || !(this instanceof Chalk) || this.template) {
  1979. const chalk = {};
  1980. applyOptions(chalk, options);
  1981. chalk.template = function() {
  1982. const args = [].slice.call(arguments);
  1983. return chalkTag.apply(null, [chalk.template].concat(args));
  1984. };
  1985. Object.setPrototypeOf(chalk, Chalk.prototype);
  1986. Object.setPrototypeOf(chalk.template, chalk);
  1987. chalk.template.constructor = Chalk;
  1988. return chalk.template;
  1989. }
  1990. applyOptions(this, options);
  1991. }
  1992. if (isSimpleWindowsTerm) {
  1993. ansiStyles.blue.open = "\x1B[94m";
  1994. }
  1995. for (const key of Object.keys(ansiStyles)) {
  1996. ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), "g");
  1997. styles[key] = {
  1998. get() {
  1999. const codes = ansiStyles[key];
  2000. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
  2001. }
  2002. };
  2003. }
  2004. styles.visible = {
  2005. get() {
  2006. return build.call(this, this._styles || [], true, "visible");
  2007. }
  2008. };
  2009. ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), "g");
  2010. for (const model of Object.keys(ansiStyles.color.ansi)) {
  2011. if (skipModels.has(model)) {
  2012. continue;
  2013. }
  2014. styles[model] = {
  2015. get() {
  2016. const level = this.level;
  2017. return function() {
  2018. const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
  2019. const codes = {
  2020. open,
  2021. close: ansiStyles.color.close,
  2022. closeRe: ansiStyles.color.closeRe
  2023. };
  2024. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
  2025. };
  2026. }
  2027. };
  2028. }
  2029. ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), "g");
  2030. for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
  2031. if (skipModels.has(model)) {
  2032. continue;
  2033. }
  2034. const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
  2035. styles[bgModel] = {
  2036. get() {
  2037. const level = this.level;
  2038. return function() {
  2039. const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
  2040. const codes = {
  2041. open,
  2042. close: ansiStyles.bgColor.close,
  2043. closeRe: ansiStyles.bgColor.closeRe
  2044. };
  2045. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
  2046. };
  2047. }
  2048. };
  2049. }
  2050. var proto = Object.defineProperties(() => {
  2051. }, styles);
  2052. function build(_styles, _empty, key) {
  2053. const builder = function() {
  2054. return applyStyle.apply(builder, arguments);
  2055. };
  2056. builder._styles = _styles;
  2057. builder._empty = _empty;
  2058. const self = this;
  2059. Object.defineProperty(builder, "level", {
  2060. enumerable: true,
  2061. get() {
  2062. return self.level;
  2063. },
  2064. set(level) {
  2065. self.level = level;
  2066. }
  2067. });
  2068. Object.defineProperty(builder, "enabled", {
  2069. enumerable: true,
  2070. get() {
  2071. return self.enabled;
  2072. },
  2073. set(enabled) {
  2074. self.enabled = enabled;
  2075. }
  2076. });
  2077. builder.hasGrey = this.hasGrey || key === "gray" || key === "grey";
  2078. builder.__proto__ = proto;
  2079. return builder;
  2080. }
  2081. function applyStyle() {
  2082. const args = arguments;
  2083. const argsLen = args.length;
  2084. let str = String(arguments[0]);
  2085. if (argsLen === 0) {
  2086. return "";
  2087. }
  2088. if (argsLen > 1) {
  2089. for (let a = 1; a < argsLen; a++) {
  2090. str += " " + args[a];
  2091. }
  2092. }
  2093. if (!this.enabled || this.level <= 0 || !str) {
  2094. return this._empty ? "" : str;
  2095. }
  2096. const originalDim = ansiStyles.dim.open;
  2097. if (isSimpleWindowsTerm && this.hasGrey) {
  2098. ansiStyles.dim.open = "";
  2099. }
  2100. for (const code of this._styles.slice().reverse()) {
  2101. str = code.open + str.replace(code.closeRe, code.open) + code.close;
  2102. str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
  2103. }
  2104. ansiStyles.dim.open = originalDim;
  2105. return str;
  2106. }
  2107. function chalkTag(chalk, strings) {
  2108. if (!Array.isArray(strings)) {
  2109. return [].slice.call(arguments, 1).join(" ");
  2110. }
  2111. const args = [].slice.call(arguments, 2);
  2112. const parts = [strings.raw[0]];
  2113. for (let i = 1; i < strings.length; i++) {
  2114. parts.push(String(args[i - 1]).replace(/[{}\\]/g, "\\$&"));
  2115. parts.push(String(strings.raw[i]));
  2116. }
  2117. return template(chalk, parts.join(""));
  2118. }
  2119. Object.defineProperties(Chalk.prototype, styles);
  2120. module2.exports = Chalk();
  2121. module2.exports.supportsColor = stdoutColor;
  2122. module2.exports.default = module2.exports;
  2123. }
  2124. });
  2125. var require_lib2 = __commonJS({
  2126. "node_modules/@babel/highlight/lib/index.js"(exports2) {
  2127. "use strict";
  2128. Object.defineProperty(exports2, "__esModule", {
  2129. value: true
  2130. });
  2131. exports2.default = highlight;
  2132. exports2.getChalk = getChalk;
  2133. exports2.shouldHighlight = shouldHighlight;
  2134. var _jsTokens = require_js_tokens();
  2135. var _helperValidatorIdentifier = require_lib();
  2136. var _chalk = require_chalk();
  2137. var sometimesKeywords = /* @__PURE__ */ new Set(["as", "async", "from", "get", "of", "set"]);
  2138. function getDefs(chalk) {
  2139. return {
  2140. keyword: chalk.cyan,
  2141. capitalized: chalk.yellow,
  2142. jsxIdentifier: chalk.yellow,
  2143. punctuator: chalk.yellow,
  2144. number: chalk.magenta,
  2145. string: chalk.green,
  2146. regex: chalk.magenta,
  2147. comment: chalk.grey,
  2148. invalid: chalk.white.bgRed.bold
  2149. };
  2150. }
  2151. var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
  2152. var BRACKET = /^[()[\]{}]$/;
  2153. var tokenize;
  2154. {
  2155. const JSX_TAG = /^[a-z][\w-]*$/i;
  2156. const getTokenType = function(token, offset, text) {
  2157. if (token.type === "name") {
  2158. if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isStrictReservedWord)(token.value, true) || sometimesKeywords.has(token.value)) {
  2159. return "keyword";
  2160. }
  2161. if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
  2162. return "jsxIdentifier";
  2163. }
  2164. if (token.value[0] !== token.value[0].toLowerCase()) {
  2165. return "capitalized";
  2166. }
  2167. }
  2168. if (token.type === "punctuator" && BRACKET.test(token.value)) {
  2169. return "bracket";
  2170. }
  2171. if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
  2172. return "punctuator";
  2173. }
  2174. return token.type;
  2175. };
  2176. tokenize = function* (text) {
  2177. let match;
  2178. while (match = _jsTokens.default.exec(text)) {
  2179. const token = _jsTokens.matchToToken(match);
  2180. yield {
  2181. type: getTokenType(token, match.index, text),
  2182. value: token.value
  2183. };
  2184. }
  2185. };
  2186. }
  2187. function highlightTokens(defs, text) {
  2188. let highlighted = "";
  2189. for (const {
  2190. type,
  2191. value
  2192. } of tokenize(text)) {
  2193. const colorize = defs[type];
  2194. if (colorize) {
  2195. highlighted += value.split(NEWLINE).map((str) => colorize(str)).join("\n");
  2196. } else {
  2197. highlighted += value;
  2198. }
  2199. }
  2200. return highlighted;
  2201. }
  2202. function shouldHighlight(options) {
  2203. return !!_chalk.supportsColor || options.forceColor;
  2204. }
  2205. function getChalk(options) {
  2206. return options.forceColor ? new _chalk.constructor({
  2207. enabled: true,
  2208. level: 1
  2209. }) : _chalk;
  2210. }
  2211. function highlight(code, options = {}) {
  2212. if (code !== "" && shouldHighlight(options)) {
  2213. const chalk = getChalk(options);
  2214. const defs = getDefs(chalk);
  2215. return highlightTokens(defs, code);
  2216. } else {
  2217. return code;
  2218. }
  2219. }
  2220. }
  2221. });
  2222. var require_lib3 = __commonJS({
  2223. "node_modules/@babel/code-frame/lib/index.js"(exports2) {
  2224. "use strict";
  2225. Object.defineProperty(exports2, "__esModule", {
  2226. value: true
  2227. });
  2228. exports2.codeFrameColumns = codeFrameColumns;
  2229. exports2.default = _default;
  2230. var _highlight = require_lib2();
  2231. var deprecationWarningShown = false;
  2232. function getDefs(chalk) {
  2233. return {
  2234. gutter: chalk.grey,
  2235. marker: chalk.red.bold,
  2236. message: chalk.red.bold
  2237. };
  2238. }
  2239. var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
  2240. function getMarkerLines(loc, source, opts) {
  2241. const startLoc = Object.assign({
  2242. column: 0,
  2243. line: -1
  2244. }, loc.start);
  2245. const endLoc = Object.assign({}, startLoc, loc.end);
  2246. const {
  2247. linesAbove = 2,
  2248. linesBelow = 3
  2249. } = opts || {};
  2250. const startLine = startLoc.line;
  2251. const startColumn = startLoc.column;
  2252. const endLine = endLoc.line;
  2253. const endColumn = endLoc.column;
  2254. let start = Math.max(startLine - (linesAbove + 1), 0);
  2255. let end = Math.min(source.length, endLine + linesBelow);
  2256. if (startLine === -1) {
  2257. start = 0;
  2258. }
  2259. if (endLine === -1) {
  2260. end = source.length;
  2261. }
  2262. const lineDiff = endLine - startLine;
  2263. const markerLines = {};
  2264. if (lineDiff) {
  2265. for (let i = 0; i <= lineDiff; i++) {
  2266. const lineNumber = i + startLine;
  2267. if (!startColumn) {
  2268. markerLines[lineNumber] = true;
  2269. } else if (i === 0) {
  2270. const sourceLength = source[lineNumber - 1].length;
  2271. markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
  2272. } else if (i === lineDiff) {
  2273. markerLines[lineNumber] = [0, endColumn];
  2274. } else {
  2275. const sourceLength = source[lineNumber - i].length;
  2276. markerLines[lineNumber] = [0, sourceLength];
  2277. }
  2278. }
  2279. } else {
  2280. if (startColumn === endColumn) {
  2281. if (startColumn) {
  2282. markerLines[startLine] = [startColumn, 0];
  2283. } else {
  2284. markerLines[startLine] = true;
  2285. }
  2286. } else {
  2287. markerLines[startLine] = [startColumn, endColumn - startColumn];
  2288. }
  2289. }
  2290. return {
  2291. start,
  2292. end,
  2293. markerLines
  2294. };
  2295. }
  2296. function codeFrameColumns(rawLines, loc, opts = {}) {
  2297. const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
  2298. const chalk = (0, _highlight.getChalk)(opts);
  2299. const defs = getDefs(chalk);
  2300. const maybeHighlight = (chalkFn, string) => {
  2301. return highlighted ? chalkFn(string) : string;
  2302. };
  2303. const lines = rawLines.split(NEWLINE);
  2304. const {
  2305. start,
  2306. end,
  2307. markerLines
  2308. } = getMarkerLines(loc, lines, opts);
  2309. const hasColumns = loc.start && typeof loc.start.column === "number";
  2310. const numberMaxWidth = String(end).length;
  2311. const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
  2312. let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
  2313. const number = start + 1 + index;
  2314. const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
  2315. const gutter = ` ${paddedNumber} |`;
  2316. const hasMarker = markerLines[number];
  2317. const lastMarkerLine = !markerLines[number + 1];
  2318. if (hasMarker) {
  2319. let markerLine = "";
  2320. if (Array.isArray(hasMarker)) {
  2321. const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
  2322. const numberOfMarkers = hasMarker[1] || 1;
  2323. markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), " ", markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
  2324. if (lastMarkerLine && opts.message) {
  2325. markerLine += " " + maybeHighlight(defs.message, opts.message);
  2326. }
  2327. }
  2328. return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
  2329. } else {
  2330. return ` ${maybeHighlight(defs.gutter, gutter)}${line.length > 0 ? ` ${line}` : ""}`;
  2331. }
  2332. }).join("\n");
  2333. if (opts.message && !hasColumns) {
  2334. frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}
  2335. ${frame}`;
  2336. }
  2337. if (highlighted) {
  2338. return chalk.reset(frame);
  2339. } else {
  2340. return frame;
  2341. }
  2342. }
  2343. function _default(rawLines, lineNumber, colNumber, opts = {}) {
  2344. if (!deprecationWarningShown) {
  2345. deprecationWarningShown = true;
  2346. const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
  2347. if (process.emitWarning) {
  2348. process.emitWarning(message, "DeprecationWarning");
  2349. } else {
  2350. const deprecationError = new Error(message);
  2351. deprecationError.name = "DeprecationWarning";
  2352. console.warn(new Error(message));
  2353. }
  2354. }
  2355. colNumber = Math.max(colNumber, 0);
  2356. const location = {
  2357. start: {
  2358. column: colNumber,
  2359. line: lineNumber
  2360. }
  2361. };
  2362. return codeFrameColumns(rawLines, location, opts);
  2363. }
  2364. }
  2365. });
  2366. var require_parse_json = __commonJS({
  2367. "node_modules/parse-json/index.js"(exports2, module2) {
  2368. "use strict";
  2369. var errorEx = require_error_ex();
  2370. var fallback = require_json_parse_even_better_errors();
  2371. var {
  2372. default: LinesAndColumns
  2373. } = require_build();
  2374. var {
  2375. codeFrameColumns
  2376. } = require_lib3();
  2377. var JSONError = errorEx("JSONError", {
  2378. fileName: errorEx.append("in %s"),
  2379. codeFrame: errorEx.append("\n\n%s\n")
  2380. });
  2381. var parseJson = (string, reviver, filename) => {
  2382. if (typeof reviver === "string") {
  2383. filename = reviver;
  2384. reviver = null;
  2385. }
  2386. try {
  2387. try {
  2388. return JSON.parse(string, reviver);
  2389. } catch (error) {
  2390. fallback(string, reviver);
  2391. throw error;
  2392. }
  2393. } catch (error) {
  2394. error.message = error.message.replace(/\n/g, "");
  2395. const indexMatch = error.message.match(/in JSON at position (\d+) while parsing/);
  2396. const jsonError = new JSONError(error);
  2397. if (filename) {
  2398. jsonError.fileName = filename;
  2399. }
  2400. if (indexMatch && indexMatch.length > 0) {
  2401. const lines = new LinesAndColumns(string);
  2402. const index = Number(indexMatch[1]);
  2403. const location = lines.locationForIndex(index);
  2404. const codeFrame = codeFrameColumns(string, {
  2405. start: {
  2406. line: location.line + 1,
  2407. column: location.column + 1
  2408. }
  2409. }, {
  2410. highlightCode: true
  2411. });
  2412. jsonError.codeFrame = codeFrame;
  2413. }
  2414. throw jsonError;
  2415. }
  2416. };
  2417. parseJson.JSONError = JSONError;
  2418. module2.exports = parseJson;
  2419. }
  2420. });
  2421. var require_PlainValue_ec8e588e = __commonJS({
  2422. "node_modules/yaml/dist/PlainValue-ec8e588e.js"(exports2) {
  2423. "use strict";
  2424. var Char = {
  2425. ANCHOR: "&",
  2426. COMMENT: "#",
  2427. TAG: "!",
  2428. DIRECTIVES_END: "-",
  2429. DOCUMENT_END: "."
  2430. };
  2431. var Type = {
  2432. ALIAS: "ALIAS",
  2433. BLANK_LINE: "BLANK_LINE",
  2434. BLOCK_FOLDED: "BLOCK_FOLDED",
  2435. BLOCK_LITERAL: "BLOCK_LITERAL",
  2436. COMMENT: "COMMENT",
  2437. DIRECTIVE: "DIRECTIVE",
  2438. DOCUMENT: "DOCUMENT",
  2439. FLOW_MAP: "FLOW_MAP",
  2440. FLOW_SEQ: "FLOW_SEQ",
  2441. MAP: "MAP",
  2442. MAP_KEY: "MAP_KEY",
  2443. MAP_VALUE: "MAP_VALUE",
  2444. PLAIN: "PLAIN",
  2445. QUOTE_DOUBLE: "QUOTE_DOUBLE",
  2446. QUOTE_SINGLE: "QUOTE_SINGLE",
  2447. SEQ: "SEQ",
  2448. SEQ_ITEM: "SEQ_ITEM"
  2449. };
  2450. var defaultTagPrefix = "tag:yaml.org,2002:";
  2451. var defaultTags = {
  2452. MAP: "tag:yaml.org,2002:map",
  2453. SEQ: "tag:yaml.org,2002:seq",
  2454. STR: "tag:yaml.org,2002:str"
  2455. };
  2456. function findLineStarts(src) {
  2457. const ls = [0];
  2458. let offset = src.indexOf("\n");
  2459. while (offset !== -1) {
  2460. offset += 1;
  2461. ls.push(offset);
  2462. offset = src.indexOf("\n", offset);
  2463. }
  2464. return ls;
  2465. }
  2466. function getSrcInfo(cst) {
  2467. let lineStarts, src;
  2468. if (typeof cst === "string") {
  2469. lineStarts = findLineStarts(cst);
  2470. src = cst;
  2471. } else {
  2472. if (Array.isArray(cst))
  2473. cst = cst[0];
  2474. if (cst && cst.context) {
  2475. if (!cst.lineStarts)
  2476. cst.lineStarts = findLineStarts(cst.context.src);
  2477. lineStarts = cst.lineStarts;
  2478. src = cst.context.src;
  2479. }
  2480. }
  2481. return {
  2482. lineStarts,
  2483. src
  2484. };
  2485. }
  2486. function getLinePos(offset, cst) {
  2487. if (typeof offset !== "number" || offset < 0)
  2488. return null;
  2489. const {
  2490. lineStarts,
  2491. src
  2492. } = getSrcInfo(cst);
  2493. if (!lineStarts || !src || offset > src.length)
  2494. return null;
  2495. for (let i = 0; i < lineStarts.length; ++i) {
  2496. const start = lineStarts[i];
  2497. if (offset < start) {
  2498. return {
  2499. line: i,
  2500. col: offset - lineStarts[i - 1] + 1
  2501. };
  2502. }
  2503. if (offset === start)
  2504. return {
  2505. line: i + 1,
  2506. col: 1
  2507. };
  2508. }
  2509. const line = lineStarts.length;
  2510. return {
  2511. line,
  2512. col: offset - lineStarts[line - 1] + 1
  2513. };
  2514. }
  2515. function getLine(line, cst) {
  2516. const {
  2517. lineStarts,
  2518. src
  2519. } = getSrcInfo(cst);
  2520. if (!lineStarts || !(line >= 1) || line > lineStarts.length)
  2521. return null;
  2522. const start = lineStarts[line - 1];
  2523. let end = lineStarts[line];
  2524. while (end && end > start && src[end - 1] === "\n")
  2525. --end;
  2526. return src.slice(start, end);
  2527. }
  2528. function getPrettyContext({
  2529. start,
  2530. end
  2531. }, cst, maxWidth = 80) {
  2532. let src = getLine(start.line, cst);
  2533. if (!src)
  2534. return null;
  2535. let {
  2536. col
  2537. } = start;
  2538. if (src.length > maxWidth) {
  2539. if (col <= maxWidth - 10) {
  2540. src = src.substr(0, maxWidth - 1) + "\u2026";
  2541. } else {
  2542. const halfWidth = Math.round(maxWidth / 2);
  2543. if (src.length > col + halfWidth)
  2544. src = src.substr(0, col + halfWidth - 1) + "\u2026";
  2545. col -= src.length - maxWidth;
  2546. src = "\u2026" + src.substr(1 - maxWidth);
  2547. }
  2548. }
  2549. let errLen = 1;
  2550. let errEnd = "";
  2551. if (end) {
  2552. if (end.line === start.line && col + (end.col - start.col) <= maxWidth + 1) {
  2553. errLen = end.col - start.col;
  2554. } else {
  2555. errLen = Math.min(src.length + 1, maxWidth) - col;
  2556. errEnd = "\u2026";
  2557. }
  2558. }
  2559. const offset = col > 1 ? " ".repeat(col - 1) : "";
  2560. const err = "^".repeat(errLen);
  2561. return `${src}
  2562. ${offset}${err}${errEnd}`;
  2563. }
  2564. var Range = class {
  2565. static copy(orig) {
  2566. return new Range(orig.start, orig.end);
  2567. }
  2568. constructor(start, end) {
  2569. this.start = start;
  2570. this.end = end || start;
  2571. }
  2572. isEmpty() {
  2573. return typeof this.start !== "number" || !this.end || this.end <= this.start;
  2574. }
  2575. setOrigRange(cr, offset) {
  2576. const {
  2577. start,
  2578. end
  2579. } = this;
  2580. if (cr.length === 0 || end <= cr[0]) {
  2581. this.origStart = start;
  2582. this.origEnd = end;
  2583. return offset;
  2584. }
  2585. let i = offset;
  2586. while (i < cr.length) {
  2587. if (cr[i] > start)
  2588. break;
  2589. else
  2590. ++i;
  2591. }
  2592. this.origStart = start + i;
  2593. const nextOffset = i;
  2594. while (i < cr.length) {
  2595. if (cr[i] >= end)
  2596. break;
  2597. else
  2598. ++i;
  2599. }
  2600. this.origEnd = end + i;
  2601. return nextOffset;
  2602. }
  2603. };
  2604. var Node = class {
  2605. static addStringTerminator(src, offset, str) {
  2606. if (str[str.length - 1] === "\n")
  2607. return str;
  2608. const next = Node.endOfWhiteSpace(src, offset);
  2609. return next >= src.length || src[next] === "\n" ? str + "\n" : str;
  2610. }
  2611. static atDocumentBoundary(src, offset, sep) {
  2612. const ch0 = src[offset];
  2613. if (!ch0)
  2614. return true;
  2615. const prev = src[offset - 1];
  2616. if (prev && prev !== "\n")
  2617. return false;
  2618. if (sep) {
  2619. if (ch0 !== sep)
  2620. return false;
  2621. } else {
  2622. if (ch0 !== Char.DIRECTIVES_END && ch0 !== Char.DOCUMENT_END)
  2623. return false;
  2624. }
  2625. const ch1 = src[offset + 1];
  2626. const ch2 = src[offset + 2];
  2627. if (ch1 !== ch0 || ch2 !== ch0)
  2628. return false;
  2629. const ch3 = src[offset + 3];
  2630. return !ch3 || ch3 === "\n" || ch3 === " " || ch3 === " ";
  2631. }
  2632. static endOfIdentifier(src, offset) {
  2633. let ch = src[offset];
  2634. const isVerbatim = ch === "<";
  2635. const notOk = isVerbatim ? ["\n", " ", " ", ">"] : ["\n", " ", " ", "[", "]", "{", "}", ","];
  2636. while (ch && notOk.indexOf(ch) === -1)
  2637. ch = src[offset += 1];
  2638. if (isVerbatim && ch === ">")
  2639. offset += 1;
  2640. return offset;
  2641. }
  2642. static endOfIndent(src, offset) {
  2643. let ch = src[offset];
  2644. while (ch === " ")
  2645. ch = src[offset += 1];
  2646. return offset;
  2647. }
  2648. static endOfLine(src, offset) {
  2649. let ch = src[offset];
  2650. while (ch && ch !== "\n")
  2651. ch = src[offset += 1];
  2652. return offset;
  2653. }
  2654. static endOfWhiteSpace(src, offset) {
  2655. let ch = src[offset];
  2656. while (ch === " " || ch === " ")
  2657. ch = src[offset += 1];
  2658. return offset;
  2659. }
  2660. static startOfLine(src, offset) {
  2661. let ch = src[offset - 1];
  2662. if (ch === "\n")
  2663. return offset;
  2664. while (ch && ch !== "\n")
  2665. ch = src[offset -= 1];
  2666. return offset + 1;
  2667. }
  2668. static endOfBlockIndent(src, indent, lineStart) {
  2669. const inEnd = Node.endOfIndent(src, lineStart);
  2670. if (inEnd > lineStart + indent) {
  2671. return inEnd;
  2672. } else {
  2673. const wsEnd = Node.endOfWhiteSpace(src, inEnd);
  2674. const ch = src[wsEnd];
  2675. if (!ch || ch === "\n")
  2676. return wsEnd;
  2677. }
  2678. return null;
  2679. }
  2680. static atBlank(src, offset, endAsBlank) {
  2681. const ch = src[offset];
  2682. return ch === "\n" || ch === " " || ch === " " || endAsBlank && !ch;
  2683. }
  2684. static nextNodeIsIndented(ch, indentDiff, indicatorAsIndent) {
  2685. if (!ch || indentDiff < 0)
  2686. return false;
  2687. if (indentDiff > 0)
  2688. return true;
  2689. return indicatorAsIndent && ch === "-";
  2690. }
  2691. static normalizeOffset(src, offset) {
  2692. const ch = src[offset];
  2693. return !ch ? offset : ch !== "\n" && src[offset - 1] === "\n" ? offset - 1 : Node.endOfWhiteSpace(src, offset);
  2694. }
  2695. static foldNewline(src, offset, indent) {
  2696. let inCount = 0;
  2697. let error = false;
  2698. let fold = "";
  2699. let ch = src[offset + 1];
  2700. while (ch === " " || ch === " " || ch === "\n") {
  2701. switch (ch) {
  2702. case "\n":
  2703. inCount = 0;
  2704. offset += 1;
  2705. fold += "\n";
  2706. break;
  2707. case " ":
  2708. if (inCount <= indent)
  2709. error = true;
  2710. offset = Node.endOfWhiteSpace(src, offset + 2) - 1;
  2711. break;
  2712. case " ":
  2713. inCount += 1;
  2714. offset += 1;
  2715. break;
  2716. }
  2717. ch = src[offset + 1];
  2718. }
  2719. if (!fold)
  2720. fold = " ";
  2721. if (ch && inCount <= indent)
  2722. error = true;
  2723. return {
  2724. fold,
  2725. offset,
  2726. error
  2727. };
  2728. }
  2729. constructor(type, props, context) {
  2730. Object.defineProperty(this, "context", {
  2731. value: context || null,
  2732. writable: true
  2733. });
  2734. this.error = null;
  2735. this.range = null;
  2736. this.valueRange = null;
  2737. this.props = props || [];
  2738. this.type = type;
  2739. this.value = null;
  2740. }
  2741. getPropValue(idx, key, skipKey) {
  2742. if (!this.context)
  2743. return null;
  2744. const {
  2745. src
  2746. } = this.context;
  2747. const prop = this.props[idx];
  2748. return prop && src[prop.start] === key ? src.slice(prop.start + (skipKey ? 1 : 0), prop.end) : null;
  2749. }
  2750. get anchor() {
  2751. for (let i = 0; i < this.props.length; ++i) {
  2752. const anchor = this.getPropValue(i, Char.ANCHOR, true);
  2753. if (anchor != null)
  2754. return anchor;
  2755. }
  2756. return null;
  2757. }
  2758. get comment() {
  2759. const comments = [];
  2760. for (let i = 0; i < this.props.length; ++i) {
  2761. const comment = this.getPropValue(i, Char.COMMENT, true);
  2762. if (comment != null)
  2763. comments.push(comment);
  2764. }
  2765. return comments.length > 0 ? comments.join("\n") : null;
  2766. }
  2767. commentHasRequiredWhitespace(start) {
  2768. const {
  2769. src
  2770. } = this.context;
  2771. if (this.header && start === this.header.end)
  2772. return false;
  2773. if (!this.valueRange)
  2774. return false;
  2775. const {
  2776. end
  2777. } = this.valueRange;
  2778. return start !== end || Node.atBlank(src, end - 1);
  2779. }
  2780. get hasComment() {
  2781. if (this.context) {
  2782. const {
  2783. src
  2784. } = this.context;
  2785. for (let i = 0; i < this.props.length; ++i) {
  2786. if (src[this.props[i].start] === Char.COMMENT)
  2787. return true;
  2788. }
  2789. }
  2790. return false;
  2791. }
  2792. get hasProps() {
  2793. if (this.context) {
  2794. const {
  2795. src
  2796. } = this.context;
  2797. for (let i = 0; i < this.props.length; ++i) {
  2798. if (src[this.props[i].start] !== Char.COMMENT)
  2799. return true;
  2800. }
  2801. }
  2802. return false;
  2803. }
  2804. get includesTrailingLines() {
  2805. return false;
  2806. }
  2807. get jsonLike() {
  2808. const jsonLikeTypes = [Type.FLOW_MAP, Type.FLOW_SEQ, Type.QUOTE_DOUBLE, Type.QUOTE_SINGLE];
  2809. return jsonLikeTypes.indexOf(this.type) !== -1;
  2810. }
  2811. get rangeAsLinePos() {
  2812. if (!this.range || !this.context)
  2813. return void 0;
  2814. const start = getLinePos(this.range.start, this.context.root);
  2815. if (!start)
  2816. return void 0;
  2817. const end = getLinePos(this.range.end, this.context.root);
  2818. return {
  2819. start,
  2820. end
  2821. };
  2822. }
  2823. get rawValue() {
  2824. if (!this.valueRange || !this.context)
  2825. return null;
  2826. const {
  2827. start,
  2828. end
  2829. } = this.valueRange;
  2830. return this.context.src.slice(start, end);
  2831. }
  2832. get tag() {
  2833. for (let i = 0; i < this.props.length; ++i) {
  2834. const tag = this.getPropValue(i, Char.TAG, false);
  2835. if (tag != null) {
  2836. if (tag[1] === "<") {
  2837. return {
  2838. verbatim: tag.slice(2, -1)
  2839. };
  2840. } else {
  2841. const [_, handle, suffix] = tag.match(/^(.*!)([^!]*)$/);
  2842. return {
  2843. handle,
  2844. suffix
  2845. };
  2846. }
  2847. }
  2848. }
  2849. return null;
  2850. }
  2851. get valueRangeContainsNewline() {
  2852. if (!this.valueRange || !this.context)
  2853. return false;
  2854. const {
  2855. start,
  2856. end
  2857. } = this.valueRange;
  2858. const {
  2859. src
  2860. } = this.context;
  2861. for (let i = start; i < end; ++i) {
  2862. if (src[i] === "\n")
  2863. return true;
  2864. }
  2865. return false;
  2866. }
  2867. parseComment(start) {
  2868. const {
  2869. src
  2870. } = this.context;
  2871. if (src[start] === Char.COMMENT) {
  2872. const end = Node.endOfLine(src, start + 1);
  2873. const commentRange = new Range(start, end);
  2874. this.props.push(commentRange);
  2875. return end;
  2876. }
  2877. return start;
  2878. }
  2879. setOrigRanges(cr, offset) {
  2880. if (this.range)
  2881. offset = this.range.setOrigRange(cr, offset);
  2882. if (this.valueRange)
  2883. this.valueRange.setOrigRange(cr, offset);
  2884. this.props.forEach((prop) => prop.setOrigRange(cr, offset));
  2885. return offset;
  2886. }
  2887. toString() {
  2888. const {
  2889. context: {
  2890. src
  2891. },
  2892. range,
  2893. value
  2894. } = this;
  2895. if (value != null)
  2896. return value;
  2897. const str = src.slice(range.start, range.end);
  2898. return Node.addStringTerminator(src, range.end, str);
  2899. }
  2900. };
  2901. var YAMLError = class extends Error {
  2902. constructor(name, source, message) {
  2903. if (!message || !(source instanceof Node))
  2904. throw new Error(`Invalid arguments for new ${name}`);
  2905. super();
  2906. this.name = name;
  2907. this.message = message;
  2908. this.source = source;
  2909. }
  2910. makePretty() {
  2911. if (!this.source)
  2912. return;
  2913. this.nodeType = this.source.type;
  2914. const cst = this.source.context && this.source.context.root;
  2915. if (typeof this.offset === "number") {
  2916. this.range = new Range(this.offset, this.offset + 1);
  2917. const start = cst && getLinePos(this.offset, cst);
  2918. if (start) {
  2919. const end = {
  2920. line: start.line,
  2921. col: start.col + 1
  2922. };
  2923. this.linePos = {
  2924. start,
  2925. end
  2926. };
  2927. }
  2928. delete this.offset;
  2929. } else {
  2930. this.range = this.source.range;
  2931. this.linePos = this.source.rangeAsLinePos;
  2932. }
  2933. if (this.linePos) {
  2934. const {
  2935. line,
  2936. col
  2937. } = this.linePos.start;
  2938. this.message += ` at line ${line}, column ${col}`;
  2939. const ctx = cst && getPrettyContext(this.linePos, cst);
  2940. if (ctx)
  2941. this.message += `:
  2942. ${ctx}
  2943. `;
  2944. }
  2945. delete this.source;
  2946. }
  2947. };
  2948. var YAMLReferenceError = class extends YAMLError {
  2949. constructor(source, message) {
  2950. super("YAMLReferenceError", source, message);
  2951. }
  2952. };
  2953. var YAMLSemanticError = class extends YAMLError {
  2954. constructor(source, message) {
  2955. super("YAMLSemanticError", source, message);
  2956. }
  2957. };
  2958. var YAMLSyntaxError = class extends YAMLError {
  2959. constructor(source, message) {
  2960. super("YAMLSyntaxError", source, message);
  2961. }
  2962. };
  2963. var YAMLWarning = class extends YAMLError {
  2964. constructor(source, message) {
  2965. super("YAMLWarning", source, message);
  2966. }
  2967. };
  2968. function _defineProperty(obj, key, value) {
  2969. if (key in obj) {
  2970. Object.defineProperty(obj, key, {
  2971. value,
  2972. enumerable: true,
  2973. configurable: true,
  2974. writable: true
  2975. });
  2976. } else {
  2977. obj[key] = value;
  2978. }
  2979. return obj;
  2980. }
  2981. var PlainValue = class extends Node {
  2982. static endOfLine(src, start, inFlow) {
  2983. let ch = src[start];
  2984. let offset = start;
  2985. while (ch && ch !== "\n") {
  2986. if (inFlow && (ch === "[" || ch === "]" || ch === "{" || ch === "}" || ch === ","))
  2987. break;
  2988. const next = src[offset + 1];
  2989. if (ch === ":" && (!next || next === "\n" || next === " " || next === " " || inFlow && next === ","))
  2990. break;
  2991. if ((ch === " " || ch === " ") && next === "#")
  2992. break;
  2993. offset += 1;
  2994. ch = next;
  2995. }
  2996. return offset;
  2997. }
  2998. get strValue() {
  2999. if (!this.valueRange || !this.context)
  3000. return null;
  3001. let {
  3002. start,
  3003. end
  3004. } = this.valueRange;
  3005. const {
  3006. src
  3007. } = this.context;
  3008. let ch = src[end - 1];
  3009. while (start < end && (ch === "\n" || ch === " " || ch === " "))
  3010. ch = src[--end - 1];
  3011. let str = "";
  3012. for (let i = start; i < end; ++i) {
  3013. const ch2 = src[i];
  3014. if (ch2 === "\n") {
  3015. const {
  3016. fold,
  3017. offset
  3018. } = Node.foldNewline(src, i, -1);
  3019. str += fold;
  3020. i = offset;
  3021. } else if (ch2 === " " || ch2 === " ") {
  3022. const wsStart = i;
  3023. let next = src[i + 1];
  3024. while (i < end && (next === " " || next === " ")) {
  3025. i += 1;
  3026. next = src[i + 1];
  3027. }
  3028. if (next !== "\n")
  3029. str += i > wsStart ? src.slice(wsStart, i + 1) : ch2;
  3030. } else {
  3031. str += ch2;
  3032. }
  3033. }
  3034. const ch0 = src[start];
  3035. switch (ch0) {
  3036. case " ": {
  3037. const msg = "Plain value cannot start with a tab character";
  3038. const errors = [new YAMLSemanticError(this, msg)];
  3039. return {
  3040. errors,
  3041. str
  3042. };
  3043. }
  3044. case "@":
  3045. case "`": {
  3046. const msg = `Plain value cannot start with reserved character ${ch0}`;
  3047. const errors = [new YAMLSemanticError(this, msg)];
  3048. return {
  3049. errors,
  3050. str
  3051. };
  3052. }
  3053. default:
  3054. return str;
  3055. }
  3056. }
  3057. parseBlockValue(start) {
  3058. const {
  3059. indent,
  3060. inFlow,
  3061. src
  3062. } = this.context;
  3063. let offset = start;
  3064. let valueEnd = start;
  3065. for (let ch = src[offset]; ch === "\n"; ch = src[offset]) {
  3066. if (Node.atDocumentBoundary(src, offset + 1))
  3067. break;
  3068. const end = Node.endOfBlockIndent(src, indent, offset + 1);
  3069. if (end === null || src[end] === "#")
  3070. break;
  3071. if (src[end] === "\n") {
  3072. offset = end;
  3073. } else {
  3074. valueEnd = PlainValue.endOfLine(src, end, inFlow);
  3075. offset = valueEnd;
  3076. }
  3077. }
  3078. if (this.valueRange.isEmpty())
  3079. this.valueRange.start = start;
  3080. this.valueRange.end = valueEnd;
  3081. return valueEnd;
  3082. }
  3083. parse(context, start) {
  3084. this.context = context;
  3085. const {
  3086. inFlow,
  3087. src
  3088. } = context;
  3089. let offset = start;
  3090. const ch = src[offset];
  3091. if (ch && ch !== "#" && ch !== "\n") {
  3092. offset = PlainValue.endOfLine(src, start, inFlow);
  3093. }
  3094. this.valueRange = new Range(start, offset);
  3095. offset = Node.endOfWhiteSpace(src, offset);
  3096. offset = this.parseComment(offset);
  3097. if (!this.hasComment || this.valueRange.isEmpty()) {
  3098. offset = this.parseBlockValue(offset);
  3099. }
  3100. return offset;
  3101. }
  3102. };
  3103. exports2.Char = Char;
  3104. exports2.Node = Node;
  3105. exports2.PlainValue = PlainValue;
  3106. exports2.Range = Range;
  3107. exports2.Type = Type;
  3108. exports2.YAMLError = YAMLError;
  3109. exports2.YAMLReferenceError = YAMLReferenceError;
  3110. exports2.YAMLSemanticError = YAMLSemanticError;
  3111. exports2.YAMLSyntaxError = YAMLSyntaxError;
  3112. exports2.YAMLWarning = YAMLWarning;
  3113. exports2._defineProperty = _defineProperty;
  3114. exports2.defaultTagPrefix = defaultTagPrefix;
  3115. exports2.defaultTags = defaultTags;
  3116. }
  3117. });
  3118. var require_parse_cst = __commonJS({
  3119. "node_modules/yaml/dist/parse-cst.js"(exports2) {
  3120. "use strict";
  3121. var PlainValue = require_PlainValue_ec8e588e();
  3122. var BlankLine = class extends PlainValue.Node {
  3123. constructor() {
  3124. super(PlainValue.Type.BLANK_LINE);
  3125. }
  3126. get includesTrailingLines() {
  3127. return true;
  3128. }
  3129. parse(context, start) {
  3130. this.context = context;
  3131. this.range = new PlainValue.Range(start, start + 1);
  3132. return start + 1;
  3133. }
  3134. };
  3135. var CollectionItem = class extends PlainValue.Node {
  3136. constructor(type, props) {
  3137. super(type, props);
  3138. this.node = null;
  3139. }
  3140. get includesTrailingLines() {
  3141. return !!this.node && this.node.includesTrailingLines;
  3142. }
  3143. parse(context, start) {
  3144. this.context = context;
  3145. const {
  3146. parseNode,
  3147. src
  3148. } = context;
  3149. let {
  3150. atLineStart,
  3151. lineStart
  3152. } = context;
  3153. if (!atLineStart && this.type === PlainValue.Type.SEQ_ITEM)
  3154. this.error = new PlainValue.YAMLSemanticError(this, "Sequence items must not have preceding content on the same line");
  3155. const indent = atLineStart ? start - lineStart : context.indent;
  3156. let offset = PlainValue.Node.endOfWhiteSpace(src, start + 1);
  3157. let ch = src[offset];
  3158. const inlineComment = ch === "#";
  3159. const comments = [];
  3160. let blankLine = null;
  3161. while (ch === "\n" || ch === "#") {
  3162. if (ch === "#") {
  3163. const end2 = PlainValue.Node.endOfLine(src, offset + 1);
  3164. comments.push(new PlainValue.Range(offset, end2));
  3165. offset = end2;
  3166. } else {
  3167. atLineStart = true;
  3168. lineStart = offset + 1;
  3169. const wsEnd = PlainValue.Node.endOfWhiteSpace(src, lineStart);
  3170. if (src[wsEnd] === "\n" && comments.length === 0) {
  3171. blankLine = new BlankLine();
  3172. lineStart = blankLine.parse({
  3173. src
  3174. }, lineStart);
  3175. }
  3176. offset = PlainValue.Node.endOfIndent(src, lineStart);
  3177. }
  3178. ch = src[offset];
  3179. }
  3180. if (PlainValue.Node.nextNodeIsIndented(ch, offset - (lineStart + indent), this.type !== PlainValue.Type.SEQ_ITEM)) {
  3181. this.node = parseNode({
  3182. atLineStart,
  3183. inCollection: false,
  3184. indent,
  3185. lineStart,
  3186. parent: this
  3187. }, offset);
  3188. } else if (ch && lineStart > start + 1) {
  3189. offset = lineStart - 1;
  3190. }
  3191. if (this.node) {
  3192. if (blankLine) {
  3193. const items = context.parent.items || context.parent.contents;
  3194. if (items)
  3195. items.push(blankLine);
  3196. }
  3197. if (comments.length)
  3198. Array.prototype.push.apply(this.props, comments);
  3199. offset = this.node.range.end;
  3200. } else {
  3201. if (inlineComment) {
  3202. const c = comments[0];
  3203. this.props.push(c);
  3204. offset = c.end;
  3205. } else {
  3206. offset = PlainValue.Node.endOfLine(src, start + 1);
  3207. }
  3208. }
  3209. const end = this.node ? this.node.valueRange.end : offset;
  3210. this.valueRange = new PlainValue.Range(start, end);
  3211. return offset;
  3212. }
  3213. setOrigRanges(cr, offset) {
  3214. offset = super.setOrigRanges(cr, offset);
  3215. return this.node ? this.node.setOrigRanges(cr, offset) : offset;
  3216. }
  3217. toString() {
  3218. const {
  3219. context: {
  3220. src
  3221. },
  3222. node,
  3223. range,
  3224. value
  3225. } = this;
  3226. if (value != null)
  3227. return value;
  3228. const str = node ? src.slice(range.start, node.range.start) + String(node) : src.slice(range.start, range.end);
  3229. return PlainValue.Node.addStringTerminator(src, range.end, str);
  3230. }
  3231. };
  3232. var Comment = class extends PlainValue.Node {
  3233. constructor() {
  3234. super(PlainValue.Type.COMMENT);
  3235. }
  3236. parse(context, start) {
  3237. this.context = context;
  3238. const offset = this.parseComment(start);
  3239. this.range = new PlainValue.Range(start, offset);
  3240. return offset;
  3241. }
  3242. };
  3243. function grabCollectionEndComments(node) {
  3244. let cnode = node;
  3245. while (cnode instanceof CollectionItem)
  3246. cnode = cnode.node;
  3247. if (!(cnode instanceof Collection))
  3248. return null;
  3249. const len = cnode.items.length;
  3250. let ci = -1;
  3251. for (let i = len - 1; i >= 0; --i) {
  3252. const n = cnode.items[i];
  3253. if (n.type === PlainValue.Type.COMMENT) {
  3254. const {
  3255. indent,
  3256. lineStart
  3257. } = n.context;
  3258. if (indent > 0 && n.range.start >= lineStart + indent)
  3259. break;
  3260. ci = i;
  3261. } else if (n.type === PlainValue.Type.BLANK_LINE)
  3262. ci = i;
  3263. else
  3264. break;
  3265. }
  3266. if (ci === -1)
  3267. return null;
  3268. const ca = cnode.items.splice(ci, len - ci);
  3269. const prevEnd = ca[0].range.start;
  3270. while (true) {
  3271. cnode.range.end = prevEnd;
  3272. if (cnode.valueRange && cnode.valueRange.end > prevEnd)
  3273. cnode.valueRange.end = prevEnd;
  3274. if (cnode === node)
  3275. break;
  3276. cnode = cnode.context.parent;
  3277. }
  3278. return ca;
  3279. }
  3280. var Collection = class extends PlainValue.Node {
  3281. static nextContentHasIndent(src, offset, indent) {
  3282. const lineStart = PlainValue.Node.endOfLine(src, offset) + 1;
  3283. offset = PlainValue.Node.endOfWhiteSpace(src, lineStart);
  3284. const ch = src[offset];
  3285. if (!ch)
  3286. return false;
  3287. if (offset >= lineStart + indent)
  3288. return true;
  3289. if (ch !== "#" && ch !== "\n")
  3290. return false;
  3291. return Collection.nextContentHasIndent(src, offset, indent);
  3292. }
  3293. constructor(firstItem) {
  3294. super(firstItem.type === PlainValue.Type.SEQ_ITEM ? PlainValue.Type.SEQ : PlainValue.Type.MAP);
  3295. for (let i = firstItem.props.length - 1; i >= 0; --i) {
  3296. if (firstItem.props[i].start < firstItem.context.lineStart) {
  3297. this.props = firstItem.props.slice(0, i + 1);
  3298. firstItem.props = firstItem.props.slice(i + 1);
  3299. const itemRange = firstItem.props[0] || firstItem.valueRange;
  3300. firstItem.range.start = itemRange.start;
  3301. break;
  3302. }
  3303. }
  3304. this.items = [firstItem];
  3305. const ec = grabCollectionEndComments(firstItem);
  3306. if (ec)
  3307. Array.prototype.push.apply(this.items, ec);
  3308. }
  3309. get includesTrailingLines() {
  3310. return this.items.length > 0;
  3311. }
  3312. parse(context, start) {
  3313. this.context = context;
  3314. const {
  3315. parseNode,
  3316. src
  3317. } = context;
  3318. let lineStart = PlainValue.Node.startOfLine(src, start);
  3319. const firstItem = this.items[0];
  3320. firstItem.context.parent = this;
  3321. this.valueRange = PlainValue.Range.copy(firstItem.valueRange);
  3322. const indent = firstItem.range.start - firstItem.context.lineStart;
  3323. let offset = start;
  3324. offset = PlainValue.Node.normalizeOffset(src, offset);
  3325. let ch = src[offset];
  3326. let atLineStart = PlainValue.Node.endOfWhiteSpace(src, lineStart) === offset;
  3327. let prevIncludesTrailingLines = false;
  3328. while (ch) {
  3329. while (ch === "\n" || ch === "#") {
  3330. if (atLineStart && ch === "\n" && !prevIncludesTrailingLines) {
  3331. const blankLine = new BlankLine();
  3332. offset = blankLine.parse({
  3333. src
  3334. }, offset);
  3335. this.valueRange.end = offset;
  3336. if (offset >= src.length) {
  3337. ch = null;
  3338. break;
  3339. }
  3340. this.items.push(blankLine);
  3341. offset -= 1;
  3342. } else if (ch === "#") {
  3343. if (offset < lineStart + indent && !Collection.nextContentHasIndent(src, offset, indent)) {
  3344. return offset;
  3345. }
  3346. const comment = new Comment();
  3347. offset = comment.parse({
  3348. indent,
  3349. lineStart,
  3350. src
  3351. }, offset);
  3352. this.items.push(comment);
  3353. this.valueRange.end = offset;
  3354. if (offset >= src.length) {
  3355. ch = null;
  3356. break;
  3357. }
  3358. }
  3359. lineStart = offset + 1;
  3360. offset = PlainValue.Node.endOfIndent(src, lineStart);
  3361. if (PlainValue.Node.atBlank(src, offset)) {
  3362. const wsEnd = PlainValue.Node.endOfWhiteSpace(src, offset);
  3363. const next = src[wsEnd];
  3364. if (!next || next === "\n" || next === "#") {
  3365. offset = wsEnd;
  3366. }
  3367. }
  3368. ch = src[offset];
  3369. atLineStart = true;
  3370. }
  3371. if (!ch) {
  3372. break;
  3373. }
  3374. if (offset !== lineStart + indent && (atLineStart || ch !== ":")) {
  3375. if (offset < lineStart + indent) {
  3376. if (lineStart > start)
  3377. offset = lineStart;
  3378. break;
  3379. } else if (!this.error) {
  3380. const msg = "All collection items must start at the same column";
  3381. this.error = new PlainValue.YAMLSyntaxError(this, msg);
  3382. }
  3383. }
  3384. if (firstItem.type === PlainValue.Type.SEQ_ITEM) {
  3385. if (ch !== "-") {
  3386. if (lineStart > start)
  3387. offset = lineStart;
  3388. break;
  3389. }
  3390. } else if (ch === "-" && !this.error) {
  3391. const next = src[offset + 1];
  3392. if (!next || next === "\n" || next === " " || next === " ") {
  3393. const msg = "A collection cannot be both a mapping and a sequence";
  3394. this.error = new PlainValue.YAMLSyntaxError(this, msg);
  3395. }
  3396. }
  3397. const node = parseNode({
  3398. atLineStart,
  3399. inCollection: true,
  3400. indent,
  3401. lineStart,
  3402. parent: this
  3403. }, offset);
  3404. if (!node)
  3405. return offset;
  3406. this.items.push(node);
  3407. this.valueRange.end = node.valueRange.end;
  3408. offset = PlainValue.Node.normalizeOffset(src, node.range.end);
  3409. ch = src[offset];
  3410. atLineStart = false;
  3411. prevIncludesTrailingLines = node.includesTrailingLines;
  3412. if (ch) {
  3413. let ls = offset - 1;
  3414. let prev = src[ls];
  3415. while (prev === " " || prev === " ")
  3416. prev = src[--ls];
  3417. if (prev === "\n") {
  3418. lineStart = ls + 1;
  3419. atLineStart = true;
  3420. }
  3421. }
  3422. const ec = grabCollectionEndComments(node);
  3423. if (ec)
  3424. Array.prototype.push.apply(this.items, ec);
  3425. }
  3426. return offset;
  3427. }
  3428. setOrigRanges(cr, offset) {
  3429. offset = super.setOrigRanges(cr, offset);
  3430. this.items.forEach((node) => {
  3431. offset = node.setOrigRanges(cr, offset);
  3432. });
  3433. return offset;
  3434. }
  3435. toString() {
  3436. const {
  3437. context: {
  3438. src
  3439. },
  3440. items,
  3441. range,
  3442. value
  3443. } = this;
  3444. if (value != null)
  3445. return value;
  3446. let str = src.slice(range.start, items[0].range.start) + String(items[0]);
  3447. for (let i = 1; i < items.length; ++i) {
  3448. const item = items[i];
  3449. const {
  3450. atLineStart,
  3451. indent
  3452. } = item.context;
  3453. if (atLineStart)
  3454. for (let i2 = 0; i2 < indent; ++i2)
  3455. str += " ";
  3456. str += String(item);
  3457. }
  3458. return PlainValue.Node.addStringTerminator(src, range.end, str);
  3459. }
  3460. };
  3461. var Directive = class extends PlainValue.Node {
  3462. constructor() {
  3463. super(PlainValue.Type.DIRECTIVE);
  3464. this.name = null;
  3465. }
  3466. get parameters() {
  3467. const raw = this.rawValue;
  3468. return raw ? raw.trim().split(/[ \t]+/) : [];
  3469. }
  3470. parseName(start) {
  3471. const {
  3472. src
  3473. } = this.context;
  3474. let offset = start;
  3475. let ch = src[offset];
  3476. while (ch && ch !== "\n" && ch !== " " && ch !== " ")
  3477. ch = src[offset += 1];
  3478. this.name = src.slice(start, offset);
  3479. return offset;
  3480. }
  3481. parseParameters(start) {
  3482. const {
  3483. src
  3484. } = this.context;
  3485. let offset = start;
  3486. let ch = src[offset];
  3487. while (ch && ch !== "\n" && ch !== "#")
  3488. ch = src[offset += 1];
  3489. this.valueRange = new PlainValue.Range(start, offset);
  3490. return offset;
  3491. }
  3492. parse(context, start) {
  3493. this.context = context;
  3494. let offset = this.parseName(start + 1);
  3495. offset = this.parseParameters(offset);
  3496. offset = this.parseComment(offset);
  3497. this.range = new PlainValue.Range(start, offset);
  3498. return offset;
  3499. }
  3500. };
  3501. var Document = class extends PlainValue.Node {
  3502. static startCommentOrEndBlankLine(src, start) {
  3503. const offset = PlainValue.Node.endOfWhiteSpace(src, start);
  3504. const ch = src[offset];
  3505. return ch === "#" || ch === "\n" ? offset : start;
  3506. }
  3507. constructor() {
  3508. super(PlainValue.Type.DOCUMENT);
  3509. this.directives = null;
  3510. this.contents = null;
  3511. this.directivesEndMarker = null;
  3512. this.documentEndMarker = null;
  3513. }
  3514. parseDirectives(start) {
  3515. const {
  3516. src
  3517. } = this.context;
  3518. this.directives = [];
  3519. let atLineStart = true;
  3520. let hasDirectives = false;
  3521. let offset = start;
  3522. while (!PlainValue.Node.atDocumentBoundary(src, offset, PlainValue.Char.DIRECTIVES_END)) {
  3523. offset = Document.startCommentOrEndBlankLine(src, offset);
  3524. switch (src[offset]) {
  3525. case "\n":
  3526. if (atLineStart) {
  3527. const blankLine = new BlankLine();
  3528. offset = blankLine.parse({
  3529. src
  3530. }, offset);
  3531. if (offset < src.length) {
  3532. this.directives.push(blankLine);
  3533. }
  3534. } else {
  3535. offset += 1;
  3536. atLineStart = true;
  3537. }
  3538. break;
  3539. case "#":
  3540. {
  3541. const comment = new Comment();
  3542. offset = comment.parse({
  3543. src
  3544. }, offset);
  3545. this.directives.push(comment);
  3546. atLineStart = false;
  3547. }
  3548. break;
  3549. case "%":
  3550. {
  3551. const directive = new Directive();
  3552. offset = directive.parse({
  3553. parent: this,
  3554. src
  3555. }, offset);
  3556. this.directives.push(directive);
  3557. hasDirectives = true;
  3558. atLineStart = false;
  3559. }
  3560. break;
  3561. default:
  3562. if (hasDirectives) {
  3563. this.error = new PlainValue.YAMLSemanticError(this, "Missing directives-end indicator line");
  3564. } else if (this.directives.length > 0) {
  3565. this.contents = this.directives;
  3566. this.directives = [];
  3567. }
  3568. return offset;
  3569. }
  3570. }
  3571. if (src[offset]) {
  3572. this.directivesEndMarker = new PlainValue.Range(offset, offset + 3);
  3573. return offset + 3;
  3574. }
  3575. if (hasDirectives) {
  3576. this.error = new PlainValue.YAMLSemanticError(this, "Missing directives-end indicator line");
  3577. } else if (this.directives.length > 0) {
  3578. this.contents = this.directives;
  3579. this.directives = [];
  3580. }
  3581. return offset;
  3582. }
  3583. parseContents(start) {
  3584. const {
  3585. parseNode,
  3586. src
  3587. } = this.context;
  3588. if (!this.contents)
  3589. this.contents = [];
  3590. let lineStart = start;
  3591. while (src[lineStart - 1] === "-")
  3592. lineStart -= 1;
  3593. let offset = PlainValue.Node.endOfWhiteSpace(src, start);
  3594. let atLineStart = lineStart === start;
  3595. this.valueRange = new PlainValue.Range(offset);
  3596. while (!PlainValue.Node.atDocumentBoundary(src, offset, PlainValue.Char.DOCUMENT_END)) {
  3597. switch (src[offset]) {
  3598. case "\n":
  3599. if (atLineStart) {
  3600. const blankLine = new BlankLine();
  3601. offset = blankLine.parse({
  3602. src
  3603. }, offset);
  3604. if (offset < src.length) {
  3605. this.contents.push(blankLine);
  3606. }
  3607. } else {
  3608. offset += 1;
  3609. atLineStart = true;
  3610. }
  3611. lineStart = offset;
  3612. break;
  3613. case "#":
  3614. {
  3615. const comment = new Comment();
  3616. offset = comment.parse({
  3617. src
  3618. }, offset);
  3619. this.contents.push(comment);
  3620. atLineStart = false;
  3621. }
  3622. break;
  3623. default: {
  3624. const iEnd = PlainValue.Node.endOfIndent(src, offset);
  3625. const context = {
  3626. atLineStart,
  3627. indent: -1,
  3628. inFlow: false,
  3629. inCollection: false,
  3630. lineStart,
  3631. parent: this
  3632. };
  3633. const node = parseNode(context, iEnd);
  3634. if (!node)
  3635. return this.valueRange.end = iEnd;
  3636. this.contents.push(node);
  3637. offset = node.range.end;
  3638. atLineStart = false;
  3639. const ec = grabCollectionEndComments(node);
  3640. if (ec)
  3641. Array.prototype.push.apply(this.contents, ec);
  3642. }
  3643. }
  3644. offset = Document.startCommentOrEndBlankLine(src, offset);
  3645. }
  3646. this.valueRange.end = offset;
  3647. if (src[offset]) {
  3648. this.documentEndMarker = new PlainValue.Range(offset, offset + 3);
  3649. offset += 3;
  3650. if (src[offset]) {
  3651. offset = PlainValue.Node.endOfWhiteSpace(src, offset);
  3652. if (src[offset] === "#") {
  3653. const comment = new Comment();
  3654. offset = comment.parse({
  3655. src
  3656. }, offset);
  3657. this.contents.push(comment);
  3658. }
  3659. switch (src[offset]) {
  3660. case "\n":
  3661. offset += 1;
  3662. break;
  3663. case void 0:
  3664. break;
  3665. default:
  3666. this.error = new PlainValue.YAMLSyntaxError(this, "Document end marker line cannot have a non-comment suffix");
  3667. }
  3668. }
  3669. }
  3670. return offset;
  3671. }
  3672. parse(context, start) {
  3673. context.root = this;
  3674. this.context = context;
  3675. const {
  3676. src
  3677. } = context;
  3678. let offset = src.charCodeAt(start) === 65279 ? start + 1 : start;
  3679. offset = this.parseDirectives(offset);
  3680. offset = this.parseContents(offset);
  3681. return offset;
  3682. }
  3683. setOrigRanges(cr, offset) {
  3684. offset = super.setOrigRanges(cr, offset);
  3685. this.directives.forEach((node) => {
  3686. offset = node.setOrigRanges(cr, offset);
  3687. });
  3688. if (this.directivesEndMarker)
  3689. offset = this.directivesEndMarker.setOrigRange(cr, offset);
  3690. this.contents.forEach((node) => {
  3691. offset = node.setOrigRanges(cr, offset);
  3692. });
  3693. if (this.documentEndMarker)
  3694. offset = this.documentEndMarker.setOrigRange(cr, offset);
  3695. return offset;
  3696. }
  3697. toString() {
  3698. const {
  3699. contents,
  3700. directives,
  3701. value
  3702. } = this;
  3703. if (value != null)
  3704. return value;
  3705. let str = directives.join("");
  3706. if (contents.length > 0) {
  3707. if (directives.length > 0 || contents[0].type === PlainValue.Type.COMMENT)
  3708. str += "---\n";
  3709. str += contents.join("");
  3710. }
  3711. if (str[str.length - 1] !== "\n")
  3712. str += "\n";
  3713. return str;
  3714. }
  3715. };
  3716. var Alias = class extends PlainValue.Node {
  3717. parse(context, start) {
  3718. this.context = context;
  3719. const {
  3720. src
  3721. } = context;
  3722. let offset = PlainValue.Node.endOfIdentifier(src, start + 1);
  3723. this.valueRange = new PlainValue.Range(start + 1, offset);
  3724. offset = PlainValue.Node.endOfWhiteSpace(src, offset);
  3725. offset = this.parseComment(offset);
  3726. return offset;
  3727. }
  3728. };
  3729. var Chomp = {
  3730. CLIP: "CLIP",
  3731. KEEP: "KEEP",
  3732. STRIP: "STRIP"
  3733. };
  3734. var BlockValue = class extends PlainValue.Node {
  3735. constructor(type, props) {
  3736. super(type, props);
  3737. this.blockIndent = null;
  3738. this.chomping = Chomp.CLIP;
  3739. this.header = null;
  3740. }
  3741. get includesTrailingLines() {
  3742. return this.chomping === Chomp.KEEP;
  3743. }
  3744. get strValue() {
  3745. if (!this.valueRange || !this.context)
  3746. return null;
  3747. let {
  3748. start,
  3749. end
  3750. } = this.valueRange;
  3751. const {
  3752. indent,
  3753. src
  3754. } = this.context;
  3755. if (this.valueRange.isEmpty())
  3756. return "";
  3757. let lastNewLine = null;
  3758. let ch = src[end - 1];
  3759. while (ch === "\n" || ch === " " || ch === " ") {
  3760. end -= 1;
  3761. if (end <= start) {
  3762. if (this.chomping === Chomp.KEEP)
  3763. break;
  3764. else
  3765. return "";
  3766. }
  3767. if (ch === "\n")
  3768. lastNewLine = end;
  3769. ch = src[end - 1];
  3770. }
  3771. let keepStart = end + 1;
  3772. if (lastNewLine) {
  3773. if (this.chomping === Chomp.KEEP) {
  3774. keepStart = lastNewLine;
  3775. end = this.valueRange.end;
  3776. } else {
  3777. end = lastNewLine;
  3778. }
  3779. }
  3780. const bi = indent + this.blockIndent;
  3781. const folded = this.type === PlainValue.Type.BLOCK_FOLDED;
  3782. let atStart = true;
  3783. let str = "";
  3784. let sep = "";
  3785. let prevMoreIndented = false;
  3786. for (let i = start; i < end; ++i) {
  3787. for (let j = 0; j < bi; ++j) {
  3788. if (src[i] !== " ")
  3789. break;
  3790. i += 1;
  3791. }
  3792. const ch2 = src[i];
  3793. if (ch2 === "\n") {
  3794. if (sep === "\n")
  3795. str += "\n";
  3796. else
  3797. sep = "\n";
  3798. } else {
  3799. const lineEnd = PlainValue.Node.endOfLine(src, i);
  3800. const line = src.slice(i, lineEnd);
  3801. i = lineEnd;
  3802. if (folded && (ch2 === " " || ch2 === " ") && i < keepStart) {
  3803. if (sep === " ")
  3804. sep = "\n";
  3805. else if (!prevMoreIndented && !atStart && sep === "\n")
  3806. sep = "\n\n";
  3807. str += sep + line;
  3808. sep = lineEnd < end && src[lineEnd] || "";
  3809. prevMoreIndented = true;
  3810. } else {
  3811. str += sep + line;
  3812. sep = folded && i < keepStart ? " " : "\n";
  3813. prevMoreIndented = false;
  3814. }
  3815. if (atStart && line !== "")
  3816. atStart = false;
  3817. }
  3818. }
  3819. return this.chomping === Chomp.STRIP ? str : str + "\n";
  3820. }
  3821. parseBlockHeader(start) {
  3822. const {
  3823. src
  3824. } = this.context;
  3825. let offset = start + 1;
  3826. let bi = "";
  3827. while (true) {
  3828. const ch = src[offset];
  3829. switch (ch) {
  3830. case "-":
  3831. this.chomping = Chomp.STRIP;
  3832. break;
  3833. case "+":
  3834. this.chomping = Chomp.KEEP;
  3835. break;
  3836. case "0":
  3837. case "1":
  3838. case "2":
  3839. case "3":
  3840. case "4":
  3841. case "5":
  3842. case "6":
  3843. case "7":
  3844. case "8":
  3845. case "9":
  3846. bi += ch;
  3847. break;
  3848. default:
  3849. this.blockIndent = Number(bi) || null;
  3850. this.header = new PlainValue.Range(start, offset);
  3851. return offset;
  3852. }
  3853. offset += 1;
  3854. }
  3855. }
  3856. parseBlockValue(start) {
  3857. const {
  3858. indent,
  3859. src
  3860. } = this.context;
  3861. const explicit = !!this.blockIndent;
  3862. let offset = start;
  3863. let valueEnd = start;
  3864. let minBlockIndent = 1;
  3865. for (let ch = src[offset]; ch === "\n"; ch = src[offset]) {
  3866. offset += 1;
  3867. if (PlainValue.Node.atDocumentBoundary(src, offset))
  3868. break;
  3869. const end = PlainValue.Node.endOfBlockIndent(src, indent, offset);
  3870. if (end === null)
  3871. break;
  3872. const ch2 = src[end];
  3873. const lineIndent = end - (offset + indent);
  3874. if (!this.blockIndent) {
  3875. if (src[end] !== "\n") {
  3876. if (lineIndent < minBlockIndent) {
  3877. const msg = "Block scalars with more-indented leading empty lines must use an explicit indentation indicator";
  3878. this.error = new PlainValue.YAMLSemanticError(this, msg);
  3879. }
  3880. this.blockIndent = lineIndent;
  3881. } else if (lineIndent > minBlockIndent) {
  3882. minBlockIndent = lineIndent;
  3883. }
  3884. } else if (ch2 && ch2 !== "\n" && lineIndent < this.blockIndent) {
  3885. if (src[end] === "#")
  3886. break;
  3887. if (!this.error) {
  3888. const src2 = explicit ? "explicit indentation indicator" : "first line";
  3889. const msg = `Block scalars must not be less indented than their ${src2}`;
  3890. this.error = new PlainValue.YAMLSemanticError(this, msg);
  3891. }
  3892. }
  3893. if (src[end] === "\n") {
  3894. offset = end;
  3895. } else {
  3896. offset = valueEnd = PlainValue.Node.endOfLine(src, end);
  3897. }
  3898. }
  3899. if (this.chomping !== Chomp.KEEP) {
  3900. offset = src[valueEnd] ? valueEnd + 1 : valueEnd;
  3901. }
  3902. this.valueRange = new PlainValue.Range(start + 1, offset);
  3903. return offset;
  3904. }
  3905. parse(context, start) {
  3906. this.context = context;
  3907. const {
  3908. src
  3909. } = context;
  3910. let offset = this.parseBlockHeader(start);
  3911. offset = PlainValue.Node.endOfWhiteSpace(src, offset);
  3912. offset = this.parseComment(offset);
  3913. offset = this.parseBlockValue(offset);
  3914. return offset;
  3915. }
  3916. setOrigRanges(cr, offset) {
  3917. offset = super.setOrigRanges(cr, offset);
  3918. return this.header ? this.header.setOrigRange(cr, offset) : offset;
  3919. }
  3920. };
  3921. var FlowCollection = class extends PlainValue.Node {
  3922. constructor(type, props) {
  3923. super(type, props);
  3924. this.items = null;
  3925. }
  3926. prevNodeIsJsonLike(idx = this.items.length) {
  3927. const node = this.items[idx - 1];
  3928. return !!node && (node.jsonLike || node.type === PlainValue.Type.COMMENT && this.prevNodeIsJsonLike(idx - 1));
  3929. }
  3930. parse(context, start) {
  3931. this.context = context;
  3932. const {
  3933. parseNode,
  3934. src
  3935. } = context;
  3936. let {
  3937. indent,
  3938. lineStart
  3939. } = context;
  3940. let char = src[start];
  3941. this.items = [{
  3942. char,
  3943. offset: start
  3944. }];
  3945. let offset = PlainValue.Node.endOfWhiteSpace(src, start + 1);
  3946. char = src[offset];
  3947. while (char && char !== "]" && char !== "}") {
  3948. switch (char) {
  3949. case "\n":
  3950. {
  3951. lineStart = offset + 1;
  3952. const wsEnd = PlainValue.Node.endOfWhiteSpace(src, lineStart);
  3953. if (src[wsEnd] === "\n") {
  3954. const blankLine = new BlankLine();
  3955. lineStart = blankLine.parse({
  3956. src
  3957. }, lineStart);
  3958. this.items.push(blankLine);
  3959. }
  3960. offset = PlainValue.Node.endOfIndent(src, lineStart);
  3961. if (offset <= lineStart + indent) {
  3962. char = src[offset];
  3963. if (offset < lineStart + indent || char !== "]" && char !== "}") {
  3964. const msg = "Insufficient indentation in flow collection";
  3965. this.error = new PlainValue.YAMLSemanticError(this, msg);
  3966. }
  3967. }
  3968. }
  3969. break;
  3970. case ",":
  3971. {
  3972. this.items.push({
  3973. char,
  3974. offset
  3975. });
  3976. offset += 1;
  3977. }
  3978. break;
  3979. case "#":
  3980. {
  3981. const comment = new Comment();
  3982. offset = comment.parse({
  3983. src
  3984. }, offset);
  3985. this.items.push(comment);
  3986. }
  3987. break;
  3988. case "?":
  3989. case ":": {
  3990. const next = src[offset + 1];
  3991. if (next === "\n" || next === " " || next === " " || next === "," || char === ":" && this.prevNodeIsJsonLike()) {
  3992. this.items.push({
  3993. char,
  3994. offset
  3995. });
  3996. offset += 1;
  3997. break;
  3998. }
  3999. }
  4000. default: {
  4001. const node = parseNode({
  4002. atLineStart: false,
  4003. inCollection: false,
  4004. inFlow: true,
  4005. indent: -1,
  4006. lineStart,
  4007. parent: this
  4008. }, offset);
  4009. if (!node) {
  4010. this.valueRange = new PlainValue.Range(start, offset);
  4011. return offset;
  4012. }
  4013. this.items.push(node);
  4014. offset = PlainValue.Node.normalizeOffset(src, node.range.end);
  4015. }
  4016. }
  4017. offset = PlainValue.Node.endOfWhiteSpace(src, offset);
  4018. char = src[offset];
  4019. }
  4020. this.valueRange = new PlainValue.Range(start, offset + 1);
  4021. if (char) {
  4022. this.items.push({
  4023. char,
  4024. offset
  4025. });
  4026. offset = PlainValue.Node.endOfWhiteSpace(src, offset + 1);
  4027. offset = this.parseComment(offset);
  4028. }
  4029. return offset;
  4030. }
  4031. setOrigRanges(cr, offset) {
  4032. offset = super.setOrigRanges(cr, offset);
  4033. this.items.forEach((node) => {
  4034. if (node instanceof PlainValue.Node) {
  4035. offset = node.setOrigRanges(cr, offset);
  4036. } else if (cr.length === 0) {
  4037. node.origOffset = node.offset;
  4038. } else {
  4039. let i = offset;
  4040. while (i < cr.length) {
  4041. if (cr[i] > node.offset)
  4042. break;
  4043. else
  4044. ++i;
  4045. }
  4046. node.origOffset = node.offset + i;
  4047. offset = i;
  4048. }
  4049. });
  4050. return offset;
  4051. }
  4052. toString() {
  4053. const {
  4054. context: {
  4055. src
  4056. },
  4057. items,
  4058. range,
  4059. value
  4060. } = this;
  4061. if (value != null)
  4062. return value;
  4063. const nodes = items.filter((item) => item instanceof PlainValue.Node);
  4064. let str = "";
  4065. let prevEnd = range.start;
  4066. nodes.forEach((node) => {
  4067. const prefix = src.slice(prevEnd, node.range.start);
  4068. prevEnd = node.range.end;
  4069. str += prefix + String(node);
  4070. if (str[str.length - 1] === "\n" && src[prevEnd - 1] !== "\n" && src[prevEnd] === "\n") {
  4071. prevEnd += 1;
  4072. }
  4073. });
  4074. str += src.slice(prevEnd, range.end);
  4075. return PlainValue.Node.addStringTerminator(src, range.end, str);
  4076. }
  4077. };
  4078. var QuoteDouble = class extends PlainValue.Node {
  4079. static endOfQuote(src, offset) {
  4080. let ch = src[offset];
  4081. while (ch && ch !== '"') {
  4082. offset += ch === "\\" ? 2 : 1;
  4083. ch = src[offset];
  4084. }
  4085. return offset + 1;
  4086. }
  4087. get strValue() {
  4088. if (!this.valueRange || !this.context)
  4089. return null;
  4090. const errors = [];
  4091. const {
  4092. start,
  4093. end
  4094. } = this.valueRange;
  4095. const {
  4096. indent,
  4097. src
  4098. } = this.context;
  4099. if (src[end - 1] !== '"')
  4100. errors.push(new PlainValue.YAMLSyntaxError(this, 'Missing closing "quote'));
  4101. let str = "";
  4102. for (let i = start + 1; i < end - 1; ++i) {
  4103. const ch = src[i];
  4104. if (ch === "\n") {
  4105. if (PlainValue.Node.atDocumentBoundary(src, i + 1))
  4106. errors.push(new PlainValue.YAMLSemanticError(this, "Document boundary indicators are not allowed within string values"));
  4107. const {
  4108. fold,
  4109. offset,
  4110. error
  4111. } = PlainValue.Node.foldNewline(src, i, indent);
  4112. str += fold;
  4113. i = offset;
  4114. if (error)
  4115. errors.push(new PlainValue.YAMLSemanticError(this, "Multi-line double-quoted string needs to be sufficiently indented"));
  4116. } else if (ch === "\\") {
  4117. i += 1;
  4118. switch (src[i]) {
  4119. case "0":
  4120. str += "\0";
  4121. break;
  4122. case "a":
  4123. str += "\x07";
  4124. break;
  4125. case "b":
  4126. str += "\b";
  4127. break;
  4128. case "e":
  4129. str += "\x1B";
  4130. break;
  4131. case "f":
  4132. str += "\f";
  4133. break;
  4134. case "n":
  4135. str += "\n";
  4136. break;
  4137. case "r":
  4138. str += "\r";
  4139. break;
  4140. case "t":
  4141. str += " ";
  4142. break;
  4143. case "v":
  4144. str += "\v";
  4145. break;
  4146. case "N":
  4147. str += "\x85";
  4148. break;
  4149. case "_":
  4150. str += "\xA0";
  4151. break;
  4152. case "L":
  4153. str += "\u2028";
  4154. break;
  4155. case "P":
  4156. str += "\u2029";
  4157. break;
  4158. case " ":
  4159. str += " ";
  4160. break;
  4161. case '"':
  4162. str += '"';
  4163. break;
  4164. case "/":
  4165. str += "/";
  4166. break;
  4167. case "\\":
  4168. str += "\\";
  4169. break;
  4170. case " ":
  4171. str += " ";
  4172. break;
  4173. case "x":
  4174. str += this.parseCharCode(i + 1, 2, errors);
  4175. i += 2;
  4176. break;
  4177. case "u":
  4178. str += this.parseCharCode(i + 1, 4, errors);
  4179. i += 4;
  4180. break;
  4181. case "U":
  4182. str += this.parseCharCode(i + 1, 8, errors);
  4183. i += 8;
  4184. break;
  4185. case "\n":
  4186. while (src[i + 1] === " " || src[i + 1] === " ")
  4187. i += 1;
  4188. break;
  4189. default:
  4190. errors.push(new PlainValue.YAMLSyntaxError(this, `Invalid escape sequence ${src.substr(i - 1, 2)}`));
  4191. str += "\\" + src[i];
  4192. }
  4193. } else if (ch === " " || ch === " ") {
  4194. const wsStart = i;
  4195. let next = src[i + 1];
  4196. while (next === " " || next === " ") {
  4197. i += 1;
  4198. next = src[i + 1];
  4199. }
  4200. if (next !== "\n")
  4201. str += i > wsStart ? src.slice(wsStart, i + 1) : ch;
  4202. } else {
  4203. str += ch;
  4204. }
  4205. }
  4206. return errors.length > 0 ? {
  4207. errors,
  4208. str
  4209. } : str;
  4210. }
  4211. parseCharCode(offset, length, errors) {
  4212. const {
  4213. src
  4214. } = this.context;
  4215. const cc = src.substr(offset, length);
  4216. const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
  4217. const code = ok ? parseInt(cc, 16) : NaN;
  4218. if (isNaN(code)) {
  4219. errors.push(new PlainValue.YAMLSyntaxError(this, `Invalid escape sequence ${src.substr(offset - 2, length + 2)}`));
  4220. return src.substr(offset - 2, length + 2);
  4221. }
  4222. return String.fromCodePoint(code);
  4223. }
  4224. parse(context, start) {
  4225. this.context = context;
  4226. const {
  4227. src
  4228. } = context;
  4229. let offset = QuoteDouble.endOfQuote(src, start + 1);
  4230. this.valueRange = new PlainValue.Range(start, offset);
  4231. offset = PlainValue.Node.endOfWhiteSpace(src, offset);
  4232. offset = this.parseComment(offset);
  4233. return offset;
  4234. }
  4235. };
  4236. var QuoteSingle = class extends PlainValue.Node {
  4237. static endOfQuote(src, offset) {
  4238. let ch = src[offset];
  4239. while (ch) {
  4240. if (ch === "'") {
  4241. if (src[offset + 1] !== "'")
  4242. break;
  4243. ch = src[offset += 2];
  4244. } else {
  4245. ch = src[offset += 1];
  4246. }
  4247. }
  4248. return offset + 1;
  4249. }
  4250. get strValue() {
  4251. if (!this.valueRange || !this.context)
  4252. return null;
  4253. const errors = [];
  4254. const {
  4255. start,
  4256. end
  4257. } = this.valueRange;
  4258. const {
  4259. indent,
  4260. src
  4261. } = this.context;
  4262. if (src[end - 1] !== "'")
  4263. errors.push(new PlainValue.YAMLSyntaxError(this, "Missing closing 'quote"));
  4264. let str = "";
  4265. for (let i = start + 1; i < end - 1; ++i) {
  4266. const ch = src[i];
  4267. if (ch === "\n") {
  4268. if (PlainValue.Node.atDocumentBoundary(src, i + 1))
  4269. errors.push(new PlainValue.YAMLSemanticError(this, "Document boundary indicators are not allowed within string values"));
  4270. const {
  4271. fold,
  4272. offset,
  4273. error
  4274. } = PlainValue.Node.foldNewline(src, i, indent);
  4275. str += fold;
  4276. i = offset;
  4277. if (error)
  4278. errors.push(new PlainValue.YAMLSemanticError(this, "Multi-line single-quoted string needs to be sufficiently indented"));
  4279. } else if (ch === "'") {
  4280. str += ch;
  4281. i += 1;
  4282. if (src[i] !== "'")
  4283. errors.push(new PlainValue.YAMLSyntaxError(this, "Unescaped single quote? This should not happen."));
  4284. } else if (ch === " " || ch === " ") {
  4285. const wsStart = i;
  4286. let next = src[i + 1];
  4287. while (next === " " || next === " ") {
  4288. i += 1;
  4289. next = src[i + 1];
  4290. }
  4291. if (next !== "\n")
  4292. str += i > wsStart ? src.slice(wsStart, i + 1) : ch;
  4293. } else {
  4294. str += ch;
  4295. }
  4296. }
  4297. return errors.length > 0 ? {
  4298. errors,
  4299. str
  4300. } : str;
  4301. }
  4302. parse(context, start) {
  4303. this.context = context;
  4304. const {
  4305. src
  4306. } = context;
  4307. let offset = QuoteSingle.endOfQuote(src, start + 1);
  4308. this.valueRange = new PlainValue.Range(start, offset);
  4309. offset = PlainValue.Node.endOfWhiteSpace(src, offset);
  4310. offset = this.parseComment(offset);
  4311. return offset;
  4312. }
  4313. };
  4314. function createNewNode(type, props) {
  4315. switch (type) {
  4316. case PlainValue.Type.ALIAS:
  4317. return new Alias(type, props);
  4318. case PlainValue.Type.BLOCK_FOLDED:
  4319. case PlainValue.Type.BLOCK_LITERAL:
  4320. return new BlockValue(type, props);
  4321. case PlainValue.Type.FLOW_MAP:
  4322. case PlainValue.Type.FLOW_SEQ:
  4323. return new FlowCollection(type, props);
  4324. case PlainValue.Type.MAP_KEY:
  4325. case PlainValue.Type.MAP_VALUE:
  4326. case PlainValue.Type.SEQ_ITEM:
  4327. return new CollectionItem(type, props);
  4328. case PlainValue.Type.COMMENT:
  4329. case PlainValue.Type.PLAIN:
  4330. return new PlainValue.PlainValue(type, props);
  4331. case PlainValue.Type.QUOTE_DOUBLE:
  4332. return new QuoteDouble(type, props);
  4333. case PlainValue.Type.QUOTE_SINGLE:
  4334. return new QuoteSingle(type, props);
  4335. default:
  4336. return null;
  4337. }
  4338. }
  4339. var ParseContext = class {
  4340. static parseType(src, offset, inFlow) {
  4341. switch (src[offset]) {
  4342. case "*":
  4343. return PlainValue.Type.ALIAS;
  4344. case ">":
  4345. return PlainValue.Type.BLOCK_FOLDED;
  4346. case "|":
  4347. return PlainValue.Type.BLOCK_LITERAL;
  4348. case "{":
  4349. return PlainValue.Type.FLOW_MAP;
  4350. case "[":
  4351. return PlainValue.Type.FLOW_SEQ;
  4352. case "?":
  4353. return !inFlow && PlainValue.Node.atBlank(src, offset + 1, true) ? PlainValue.Type.MAP_KEY : PlainValue.Type.PLAIN;
  4354. case ":":
  4355. return !inFlow && PlainValue.Node.atBlank(src, offset + 1, true) ? PlainValue.Type.MAP_VALUE : PlainValue.Type.PLAIN;
  4356. case "-":
  4357. return !inFlow && PlainValue.Node.atBlank(src, offset + 1, true) ? PlainValue.Type.SEQ_ITEM : PlainValue.Type.PLAIN;
  4358. case '"':
  4359. return PlainValue.Type.QUOTE_DOUBLE;
  4360. case "'":
  4361. return PlainValue.Type.QUOTE_SINGLE;
  4362. default:
  4363. return PlainValue.Type.PLAIN;
  4364. }
  4365. }
  4366. constructor(orig = {}, {
  4367. atLineStart,
  4368. inCollection,
  4369. inFlow,
  4370. indent,
  4371. lineStart,
  4372. parent
  4373. } = {}) {
  4374. PlainValue._defineProperty(this, "parseNode", (overlay, start) => {
  4375. if (PlainValue.Node.atDocumentBoundary(this.src, start))
  4376. return null;
  4377. const context = new ParseContext(this, overlay);
  4378. const {
  4379. props,
  4380. type,
  4381. valueStart
  4382. } = context.parseProps(start);
  4383. const node = createNewNode(type, props);
  4384. let offset = node.parse(context, valueStart);
  4385. node.range = new PlainValue.Range(start, offset);
  4386. if (offset <= start) {
  4387. node.error = new Error(`Node#parse consumed no characters`);
  4388. node.error.parseEnd = offset;
  4389. node.error.source = node;
  4390. node.range.end = start + 1;
  4391. }
  4392. if (context.nodeStartsCollection(node)) {
  4393. if (!node.error && !context.atLineStart && context.parent.type === PlainValue.Type.DOCUMENT) {
  4394. node.error = new PlainValue.YAMLSyntaxError(node, "Block collection must not have preceding content here (e.g. directives-end indicator)");
  4395. }
  4396. const collection = new Collection(node);
  4397. offset = collection.parse(new ParseContext(context), offset);
  4398. collection.range = new PlainValue.Range(start, offset);
  4399. return collection;
  4400. }
  4401. return node;
  4402. });
  4403. this.atLineStart = atLineStart != null ? atLineStart : orig.atLineStart || false;
  4404. this.inCollection = inCollection != null ? inCollection : orig.inCollection || false;
  4405. this.inFlow = inFlow != null ? inFlow : orig.inFlow || false;
  4406. this.indent = indent != null ? indent : orig.indent;
  4407. this.lineStart = lineStart != null ? lineStart : orig.lineStart;
  4408. this.parent = parent != null ? parent : orig.parent || {};
  4409. this.root = orig.root;
  4410. this.src = orig.src;
  4411. }
  4412. nodeStartsCollection(node) {
  4413. const {
  4414. inCollection,
  4415. inFlow,
  4416. src
  4417. } = this;
  4418. if (inCollection || inFlow)
  4419. return false;
  4420. if (node instanceof CollectionItem)
  4421. return true;
  4422. let offset = node.range.end;
  4423. if (src[offset] === "\n" || src[offset - 1] === "\n")
  4424. return false;
  4425. offset = PlainValue.Node.endOfWhiteSpace(src, offset);
  4426. return src[offset] === ":";
  4427. }
  4428. parseProps(offset) {
  4429. const {
  4430. inFlow,
  4431. parent,
  4432. src
  4433. } = this;
  4434. const props = [];
  4435. let lineHasProps = false;
  4436. offset = this.atLineStart ? PlainValue.Node.endOfIndent(src, offset) : PlainValue.Node.endOfWhiteSpace(src, offset);
  4437. let ch = src[offset];
  4438. while (ch === PlainValue.Char.ANCHOR || ch === PlainValue.Char.COMMENT || ch === PlainValue.Char.TAG || ch === "\n") {
  4439. if (ch === "\n") {
  4440. let inEnd = offset;
  4441. let lineStart;
  4442. do {
  4443. lineStart = inEnd + 1;
  4444. inEnd = PlainValue.Node.endOfIndent(src, lineStart);
  4445. } while (src[inEnd] === "\n");
  4446. const indentDiff = inEnd - (lineStart + this.indent);
  4447. const noIndicatorAsIndent = parent.type === PlainValue.Type.SEQ_ITEM && parent.context.atLineStart;
  4448. if (src[inEnd] !== "#" && !PlainValue.Node.nextNodeIsIndented(src[inEnd], indentDiff, !noIndicatorAsIndent))
  4449. break;
  4450. this.atLineStart = true;
  4451. this.lineStart = lineStart;
  4452. lineHasProps = false;
  4453. offset = inEnd;
  4454. } else if (ch === PlainValue.Char.COMMENT) {
  4455. const end = PlainValue.Node.endOfLine(src, offset + 1);
  4456. props.push(new PlainValue.Range(offset, end));
  4457. offset = end;
  4458. } else {
  4459. let end = PlainValue.Node.endOfIdentifier(src, offset + 1);
  4460. if (ch === PlainValue.Char.TAG && src[end] === "," && /^[a-zA-Z0-9-]+\.[a-zA-Z0-9-]+,\d\d\d\d(-\d\d){0,2}\/\S/.test(src.slice(offset + 1, end + 13))) {
  4461. end = PlainValue.Node.endOfIdentifier(src, end + 5);
  4462. }
  4463. props.push(new PlainValue.Range(offset, end));
  4464. lineHasProps = true;
  4465. offset = PlainValue.Node.endOfWhiteSpace(src, end);
  4466. }
  4467. ch = src[offset];
  4468. }
  4469. if (lineHasProps && ch === ":" && PlainValue.Node.atBlank(src, offset + 1, true))
  4470. offset -= 1;
  4471. const type = ParseContext.parseType(src, offset, inFlow);
  4472. return {
  4473. props,
  4474. type,
  4475. valueStart: offset
  4476. };
  4477. }
  4478. };
  4479. function parse(src) {
  4480. const cr = [];
  4481. if (src.indexOf("\r") !== -1) {
  4482. src = src.replace(/\r\n?/g, (match, offset2) => {
  4483. if (match.length > 1)
  4484. cr.push(offset2);
  4485. return "\n";
  4486. });
  4487. }
  4488. const documents = [];
  4489. let offset = 0;
  4490. do {
  4491. const doc = new Document();
  4492. const context = new ParseContext({
  4493. src
  4494. });
  4495. offset = doc.parse(context, offset);
  4496. documents.push(doc);
  4497. } while (offset < src.length);
  4498. documents.setOrigRanges = () => {
  4499. if (cr.length === 0)
  4500. return false;
  4501. for (let i = 1; i < cr.length; ++i)
  4502. cr[i] -= i;
  4503. let crOffset = 0;
  4504. for (let i = 0; i < documents.length; ++i) {
  4505. crOffset = documents[i].setOrigRanges(cr, crOffset);
  4506. }
  4507. cr.splice(0, cr.length);
  4508. return true;
  4509. };
  4510. documents.toString = () => documents.join("...\n");
  4511. return documents;
  4512. }
  4513. exports2.parse = parse;
  4514. }
  4515. });
  4516. var require_resolveSeq_d03cb037 = __commonJS({
  4517. "node_modules/yaml/dist/resolveSeq-d03cb037.js"(exports2) {
  4518. "use strict";
  4519. var PlainValue = require_PlainValue_ec8e588e();
  4520. function addCommentBefore(str, indent, comment) {
  4521. if (!comment)
  4522. return str;
  4523. const cc = comment.replace(/[\s\S]^/gm, `$&${indent}#`);
  4524. return `#${cc}
  4525. ${indent}${str}`;
  4526. }
  4527. function addComment(str, indent, comment) {
  4528. return !comment ? str : comment.indexOf("\n") === -1 ? `${str} #${comment}` : `${str}
  4529. ` + comment.replace(/^/gm, `${indent || ""}#`);
  4530. }
  4531. var Node = class {
  4532. };
  4533. function toJSON(value, arg, ctx) {
  4534. if (Array.isArray(value))
  4535. return value.map((v, i) => toJSON(v, String(i), ctx));
  4536. if (value && typeof value.toJSON === "function") {
  4537. const anchor = ctx && ctx.anchors && ctx.anchors.get(value);
  4538. if (anchor)
  4539. ctx.onCreate = (res2) => {
  4540. anchor.res = res2;
  4541. delete ctx.onCreate;
  4542. };
  4543. const res = value.toJSON(arg, ctx);
  4544. if (anchor && ctx.onCreate)
  4545. ctx.onCreate(res);
  4546. return res;
  4547. }
  4548. if ((!ctx || !ctx.keep) && typeof value === "bigint")
  4549. return Number(value);
  4550. return value;
  4551. }
  4552. var Scalar = class extends Node {
  4553. constructor(value) {
  4554. super();
  4555. this.value = value;
  4556. }
  4557. toJSON(arg, ctx) {
  4558. return ctx && ctx.keep ? this.value : toJSON(this.value, arg, ctx);
  4559. }
  4560. toString() {
  4561. return String(this.value);
  4562. }
  4563. };
  4564. function collectionFromPath(schema, path, value) {
  4565. let v = value;
  4566. for (let i = path.length - 1; i >= 0; --i) {
  4567. const k = path[i];
  4568. if (Number.isInteger(k) && k >= 0) {
  4569. const a = [];
  4570. a[k] = v;
  4571. v = a;
  4572. } else {
  4573. const o = {};
  4574. Object.defineProperty(o, k, {
  4575. value: v,
  4576. writable: true,
  4577. enumerable: true,
  4578. configurable: true
  4579. });
  4580. v = o;
  4581. }
  4582. }
  4583. return schema.createNode(v, false);
  4584. }
  4585. var isEmptyPath = (path) => path == null || typeof path === "object" && path[Symbol.iterator]().next().done;
  4586. var Collection = class extends Node {
  4587. constructor(schema) {
  4588. super();
  4589. PlainValue._defineProperty(this, "items", []);
  4590. this.schema = schema;
  4591. }
  4592. addIn(path, value) {
  4593. if (isEmptyPath(path))
  4594. this.add(value);
  4595. else {
  4596. const [key, ...rest] = path;
  4597. const node = this.get(key, true);
  4598. if (node instanceof Collection)
  4599. node.addIn(rest, value);
  4600. else if (node === void 0 && this.schema)
  4601. this.set(key, collectionFromPath(this.schema, rest, value));
  4602. else
  4603. throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
  4604. }
  4605. }
  4606. deleteIn([key, ...rest]) {
  4607. if (rest.length === 0)
  4608. return this.delete(key);
  4609. const node = this.get(key, true);
  4610. if (node instanceof Collection)
  4611. return node.deleteIn(rest);
  4612. else
  4613. throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
  4614. }
  4615. getIn([key, ...rest], keepScalar) {
  4616. const node = this.get(key, true);
  4617. if (rest.length === 0)
  4618. return !keepScalar && node instanceof Scalar ? node.value : node;
  4619. else
  4620. return node instanceof Collection ? node.getIn(rest, keepScalar) : void 0;
  4621. }
  4622. hasAllNullValues() {
  4623. return this.items.every((node) => {
  4624. if (!node || node.type !== "PAIR")
  4625. return false;
  4626. const n = node.value;
  4627. return n == null || n instanceof Scalar && n.value == null && !n.commentBefore && !n.comment && !n.tag;
  4628. });
  4629. }
  4630. hasIn([key, ...rest]) {
  4631. if (rest.length === 0)
  4632. return this.has(key);
  4633. const node = this.get(key, true);
  4634. return node instanceof Collection ? node.hasIn(rest) : false;
  4635. }
  4636. setIn([key, ...rest], value) {
  4637. if (rest.length === 0) {
  4638. this.set(key, value);
  4639. } else {
  4640. const node = this.get(key, true);
  4641. if (node instanceof Collection)
  4642. node.setIn(rest, value);
  4643. else if (node === void 0 && this.schema)
  4644. this.set(key, collectionFromPath(this.schema, rest, value));
  4645. else
  4646. throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
  4647. }
  4648. }
  4649. toJSON() {
  4650. return null;
  4651. }
  4652. toString(ctx, {
  4653. blockItem,
  4654. flowChars,
  4655. isMap,
  4656. itemIndent
  4657. }, onComment, onChompKeep) {
  4658. const {
  4659. indent,
  4660. indentStep,
  4661. stringify
  4662. } = ctx;
  4663. const inFlow = this.type === PlainValue.Type.FLOW_MAP || this.type === PlainValue.Type.FLOW_SEQ || ctx.inFlow;
  4664. if (inFlow)
  4665. itemIndent += indentStep;
  4666. const allNullValues = isMap && this.hasAllNullValues();
  4667. ctx = Object.assign({}, ctx, {
  4668. allNullValues,
  4669. indent: itemIndent,
  4670. inFlow,
  4671. type: null
  4672. });
  4673. let chompKeep = false;
  4674. let hasItemWithNewLine = false;
  4675. const nodes = this.items.reduce((nodes2, item, i) => {
  4676. let comment;
  4677. if (item) {
  4678. if (!chompKeep && item.spaceBefore)
  4679. nodes2.push({
  4680. type: "comment",
  4681. str: ""
  4682. });
  4683. if (item.commentBefore)
  4684. item.commentBefore.match(/^.*$/gm).forEach((line) => {
  4685. nodes2.push({
  4686. type: "comment",
  4687. str: `#${line}`
  4688. });
  4689. });
  4690. if (item.comment)
  4691. comment = item.comment;
  4692. if (inFlow && (!chompKeep && item.spaceBefore || item.commentBefore || item.comment || item.key && (item.key.commentBefore || item.key.comment) || item.value && (item.value.commentBefore || item.value.comment)))
  4693. hasItemWithNewLine = true;
  4694. }
  4695. chompKeep = false;
  4696. let str2 = stringify(item, ctx, () => comment = null, () => chompKeep = true);
  4697. if (inFlow && !hasItemWithNewLine && str2.includes("\n"))
  4698. hasItemWithNewLine = true;
  4699. if (inFlow && i < this.items.length - 1)
  4700. str2 += ",";
  4701. str2 = addComment(str2, itemIndent, comment);
  4702. if (chompKeep && (comment || inFlow))
  4703. chompKeep = false;
  4704. nodes2.push({
  4705. type: "item",
  4706. str: str2
  4707. });
  4708. return nodes2;
  4709. }, []);
  4710. let str;
  4711. if (nodes.length === 0) {
  4712. str = flowChars.start + flowChars.end;
  4713. } else if (inFlow) {
  4714. const {
  4715. start,
  4716. end
  4717. } = flowChars;
  4718. const strings = nodes.map((n) => n.str);
  4719. if (hasItemWithNewLine || strings.reduce((sum, str2) => sum + str2.length + 2, 2) > Collection.maxFlowStringSingleLineLength) {
  4720. str = start;
  4721. for (const s of strings) {
  4722. str += s ? `
  4723. ${indentStep}${indent}${s}` : "\n";
  4724. }
  4725. str += `
  4726. ${indent}${end}`;
  4727. } else {
  4728. str = `${start} ${strings.join(" ")} ${end}`;
  4729. }
  4730. } else {
  4731. const strings = nodes.map(blockItem);
  4732. str = strings.shift();
  4733. for (const s of strings)
  4734. str += s ? `
  4735. ${indent}${s}` : "\n";
  4736. }
  4737. if (this.comment) {
  4738. str += "\n" + this.comment.replace(/^/gm, `${indent}#`);
  4739. if (onComment)
  4740. onComment();
  4741. } else if (chompKeep && onChompKeep)
  4742. onChompKeep();
  4743. return str;
  4744. }
  4745. };
  4746. PlainValue._defineProperty(Collection, "maxFlowStringSingleLineLength", 60);
  4747. function asItemIndex(key) {
  4748. let idx = key instanceof Scalar ? key.value : key;
  4749. if (idx && typeof idx === "string")
  4750. idx = Number(idx);
  4751. return Number.isInteger(idx) && idx >= 0 ? idx : null;
  4752. }
  4753. var YAMLSeq = class extends Collection {
  4754. add(value) {
  4755. this.items.push(value);
  4756. }
  4757. delete(key) {
  4758. const idx = asItemIndex(key);
  4759. if (typeof idx !== "number")
  4760. return false;
  4761. const del = this.items.splice(idx, 1);
  4762. return del.length > 0;
  4763. }
  4764. get(key, keepScalar) {
  4765. const idx = asItemIndex(key);
  4766. if (typeof idx !== "number")
  4767. return void 0;
  4768. const it = this.items[idx];
  4769. return !keepScalar && it instanceof Scalar ? it.value : it;
  4770. }
  4771. has(key) {
  4772. const idx = asItemIndex(key);
  4773. return typeof idx === "number" && idx < this.items.length;
  4774. }
  4775. set(key, value) {
  4776. const idx = asItemIndex(key);
  4777. if (typeof idx !== "number")
  4778. throw new Error(`Expected a valid index, not ${key}.`);
  4779. this.items[idx] = value;
  4780. }
  4781. toJSON(_, ctx) {
  4782. const seq = [];
  4783. if (ctx && ctx.onCreate)
  4784. ctx.onCreate(seq);
  4785. let i = 0;
  4786. for (const item of this.items)
  4787. seq.push(toJSON(item, String(i++), ctx));
  4788. return seq;
  4789. }
  4790. toString(ctx, onComment, onChompKeep) {
  4791. if (!ctx)
  4792. return JSON.stringify(this);
  4793. return super.toString(ctx, {
  4794. blockItem: (n) => n.type === "comment" ? n.str : `- ${n.str}`,
  4795. flowChars: {
  4796. start: "[",
  4797. end: "]"
  4798. },
  4799. isMap: false,
  4800. itemIndent: (ctx.indent || "") + " "
  4801. }, onComment, onChompKeep);
  4802. }
  4803. };
  4804. var stringifyKey = (key, jsKey, ctx) => {
  4805. if (jsKey === null)
  4806. return "";
  4807. if (typeof jsKey !== "object")
  4808. return String(jsKey);
  4809. if (key instanceof Node && ctx && ctx.doc)
  4810. return key.toString({
  4811. anchors: /* @__PURE__ */ Object.create(null),
  4812. doc: ctx.doc,
  4813. indent: "",
  4814. indentStep: ctx.indentStep,
  4815. inFlow: true,
  4816. inStringifyKey: true,
  4817. stringify: ctx.stringify
  4818. });
  4819. return JSON.stringify(jsKey);
  4820. };
  4821. var Pair = class extends Node {
  4822. constructor(key, value = null) {
  4823. super();
  4824. this.key = key;
  4825. this.value = value;
  4826. this.type = Pair.Type.PAIR;
  4827. }
  4828. get commentBefore() {
  4829. return this.key instanceof Node ? this.key.commentBefore : void 0;
  4830. }
  4831. set commentBefore(cb) {
  4832. if (this.key == null)
  4833. this.key = new Scalar(null);
  4834. if (this.key instanceof Node)
  4835. this.key.commentBefore = cb;
  4836. else {
  4837. const msg = "Pair.commentBefore is an alias for Pair.key.commentBefore. To set it, the key must be a Node.";
  4838. throw new Error(msg);
  4839. }
  4840. }
  4841. addToJSMap(ctx, map) {
  4842. const key = toJSON(this.key, "", ctx);
  4843. if (map instanceof Map) {
  4844. const value = toJSON(this.value, key, ctx);
  4845. map.set(key, value);
  4846. } else if (map instanceof Set) {
  4847. map.add(key);
  4848. } else {
  4849. const stringKey = stringifyKey(this.key, key, ctx);
  4850. const value = toJSON(this.value, stringKey, ctx);
  4851. if (stringKey in map)
  4852. Object.defineProperty(map, stringKey, {
  4853. value,
  4854. writable: true,
  4855. enumerable: true,
  4856. configurable: true
  4857. });
  4858. else
  4859. map[stringKey] = value;
  4860. }
  4861. return map;
  4862. }
  4863. toJSON(_, ctx) {
  4864. const pair = ctx && ctx.mapAsMap ? /* @__PURE__ */ new Map() : {};
  4865. return this.addToJSMap(ctx, pair);
  4866. }
  4867. toString(ctx, onComment, onChompKeep) {
  4868. if (!ctx || !ctx.doc)
  4869. return JSON.stringify(this);
  4870. const {
  4871. indent: indentSize,
  4872. indentSeq,
  4873. simpleKeys
  4874. } = ctx.doc.options;
  4875. let {
  4876. key,
  4877. value
  4878. } = this;
  4879. let keyComment = key instanceof Node && key.comment;
  4880. if (simpleKeys) {
  4881. if (keyComment) {
  4882. throw new Error("With simple keys, key nodes cannot have comments");
  4883. }
  4884. if (key instanceof Collection) {
  4885. const msg = "With simple keys, collection cannot be used as a key value";
  4886. throw new Error(msg);
  4887. }
  4888. }
  4889. let explicitKey = !simpleKeys && (!key || keyComment || (key instanceof Node ? key instanceof Collection || key.type === PlainValue.Type.BLOCK_FOLDED || key.type === PlainValue.Type.BLOCK_LITERAL : typeof key === "object"));
  4890. const {
  4891. doc,
  4892. indent,
  4893. indentStep,
  4894. stringify
  4895. } = ctx;
  4896. ctx = Object.assign({}, ctx, {
  4897. implicitKey: !explicitKey,
  4898. indent: indent + indentStep
  4899. });
  4900. let chompKeep = false;
  4901. let str = stringify(key, ctx, () => keyComment = null, () => chompKeep = true);
  4902. str = addComment(str, ctx.indent, keyComment);
  4903. if (!explicitKey && str.length > 1024) {
  4904. if (simpleKeys)
  4905. throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
  4906. explicitKey = true;
  4907. }
  4908. if (ctx.allNullValues && !simpleKeys) {
  4909. if (this.comment) {
  4910. str = addComment(str, ctx.indent, this.comment);
  4911. if (onComment)
  4912. onComment();
  4913. } else if (chompKeep && !keyComment && onChompKeep)
  4914. onChompKeep();
  4915. return ctx.inFlow && !explicitKey ? str : `? ${str}`;
  4916. }
  4917. str = explicitKey ? `? ${str}
  4918. ${indent}:` : `${str}:`;
  4919. if (this.comment) {
  4920. str = addComment(str, ctx.indent, this.comment);
  4921. if (onComment)
  4922. onComment();
  4923. }
  4924. let vcb = "";
  4925. let valueComment = null;
  4926. if (value instanceof Node) {
  4927. if (value.spaceBefore)
  4928. vcb = "\n";
  4929. if (value.commentBefore) {
  4930. const cs = value.commentBefore.replace(/^/gm, `${ctx.indent}#`);
  4931. vcb += `
  4932. ${cs}`;
  4933. }
  4934. valueComment = value.comment;
  4935. } else if (value && typeof value === "object") {
  4936. value = doc.schema.createNode(value, true);
  4937. }
  4938. ctx.implicitKey = false;
  4939. if (!explicitKey && !this.comment && value instanceof Scalar)
  4940. ctx.indentAtStart = str.length + 1;
  4941. chompKeep = false;
  4942. if (!indentSeq && indentSize >= 2 && !ctx.inFlow && !explicitKey && value instanceof YAMLSeq && value.type !== PlainValue.Type.FLOW_SEQ && !value.tag && !doc.anchors.getName(value)) {
  4943. ctx.indent = ctx.indent.substr(2);
  4944. }
  4945. const valueStr = stringify(value, ctx, () => valueComment = null, () => chompKeep = true);
  4946. let ws = " ";
  4947. if (vcb || this.comment) {
  4948. ws = `${vcb}
  4949. ${ctx.indent}`;
  4950. } else if (!explicitKey && value instanceof Collection) {
  4951. const flow = valueStr[0] === "[" || valueStr[0] === "{";
  4952. if (!flow || valueStr.includes("\n"))
  4953. ws = `
  4954. ${ctx.indent}`;
  4955. } else if (valueStr[0] === "\n")
  4956. ws = "";
  4957. if (chompKeep && !valueComment && onChompKeep)
  4958. onChompKeep();
  4959. return addComment(str + ws + valueStr, ctx.indent, valueComment);
  4960. }
  4961. };
  4962. PlainValue._defineProperty(Pair, "Type", {
  4963. PAIR: "PAIR",
  4964. MERGE_PAIR: "MERGE_PAIR"
  4965. });
  4966. var getAliasCount = (node, anchors) => {
  4967. if (node instanceof Alias) {
  4968. const anchor = anchors.get(node.source);
  4969. return anchor.count * anchor.aliasCount;
  4970. } else if (node instanceof Collection) {
  4971. let count = 0;
  4972. for (const item of node.items) {
  4973. const c = getAliasCount(item, anchors);
  4974. if (c > count)
  4975. count = c;
  4976. }
  4977. return count;
  4978. } else if (node instanceof Pair) {
  4979. const kc = getAliasCount(node.key, anchors);
  4980. const vc = getAliasCount(node.value, anchors);
  4981. return Math.max(kc, vc);
  4982. }
  4983. return 1;
  4984. };
  4985. var Alias = class extends Node {
  4986. static stringify({
  4987. range,
  4988. source
  4989. }, {
  4990. anchors,
  4991. doc,
  4992. implicitKey,
  4993. inStringifyKey
  4994. }) {
  4995. let anchor = Object.keys(anchors).find((a) => anchors[a] === source);
  4996. if (!anchor && inStringifyKey)
  4997. anchor = doc.anchors.getName(source) || doc.anchors.newName();
  4998. if (anchor)
  4999. return `*${anchor}${implicitKey ? " " : ""}`;
  5000. const msg = doc.anchors.getName(source) ? "Alias node must be after source node" : "Source node not found for alias node";
  5001. throw new Error(`${msg} [${range}]`);
  5002. }
  5003. constructor(source) {
  5004. super();
  5005. this.source = source;
  5006. this.type = PlainValue.Type.ALIAS;
  5007. }
  5008. set tag(t) {
  5009. throw new Error("Alias nodes cannot have tags");
  5010. }
  5011. toJSON(arg, ctx) {
  5012. if (!ctx)
  5013. return toJSON(this.source, arg, ctx);
  5014. const {
  5015. anchors,
  5016. maxAliasCount
  5017. } = ctx;
  5018. const anchor = anchors.get(this.source);
  5019. if (!anchor || anchor.res === void 0) {
  5020. const msg = "This should not happen: Alias anchor was not resolved?";
  5021. if (this.cstNode)
  5022. throw new PlainValue.YAMLReferenceError(this.cstNode, msg);
  5023. else
  5024. throw new ReferenceError(msg);
  5025. }
  5026. if (maxAliasCount >= 0) {
  5027. anchor.count += 1;
  5028. if (anchor.aliasCount === 0)
  5029. anchor.aliasCount = getAliasCount(this.source, anchors);
  5030. if (anchor.count * anchor.aliasCount > maxAliasCount) {
  5031. const msg = "Excessive alias count indicates a resource exhaustion attack";
  5032. if (this.cstNode)
  5033. throw new PlainValue.YAMLReferenceError(this.cstNode, msg);
  5034. else
  5035. throw new ReferenceError(msg);
  5036. }
  5037. }
  5038. return anchor.res;
  5039. }
  5040. toString(ctx) {
  5041. return Alias.stringify(this, ctx);
  5042. }
  5043. };
  5044. PlainValue._defineProperty(Alias, "default", true);
  5045. function findPair(items, key) {
  5046. const k = key instanceof Scalar ? key.value : key;
  5047. for (const it of items) {
  5048. if (it instanceof Pair) {
  5049. if (it.key === key || it.key === k)
  5050. return it;
  5051. if (it.key && it.key.value === k)
  5052. return it;
  5053. }
  5054. }
  5055. return void 0;
  5056. }
  5057. var YAMLMap = class extends Collection {
  5058. add(pair, overwrite) {
  5059. if (!pair)
  5060. pair = new Pair(pair);
  5061. else if (!(pair instanceof Pair))
  5062. pair = new Pair(pair.key || pair, pair.value);
  5063. const prev = findPair(this.items, pair.key);
  5064. const sortEntries = this.schema && this.schema.sortMapEntries;
  5065. if (prev) {
  5066. if (overwrite)
  5067. prev.value = pair.value;
  5068. else
  5069. throw new Error(`Key ${pair.key} already set`);
  5070. } else if (sortEntries) {
  5071. const i = this.items.findIndex((item) => sortEntries(pair, item) < 0);
  5072. if (i === -1)
  5073. this.items.push(pair);
  5074. else
  5075. this.items.splice(i, 0, pair);
  5076. } else {
  5077. this.items.push(pair);
  5078. }
  5079. }
  5080. delete(key) {
  5081. const it = findPair(this.items, key);
  5082. if (!it)
  5083. return false;
  5084. const del = this.items.splice(this.items.indexOf(it), 1);
  5085. return del.length > 0;
  5086. }
  5087. get(key, keepScalar) {
  5088. const it = findPair(this.items, key);
  5089. const node = it && it.value;
  5090. return !keepScalar && node instanceof Scalar ? node.value : node;
  5091. }
  5092. has(key) {
  5093. return !!findPair(this.items, key);
  5094. }
  5095. set(key, value) {
  5096. this.add(new Pair(key, value), true);
  5097. }
  5098. toJSON(_, ctx, Type) {
  5099. const map = Type ? new Type() : ctx && ctx.mapAsMap ? /* @__PURE__ */ new Map() : {};
  5100. if (ctx && ctx.onCreate)
  5101. ctx.onCreate(map);
  5102. for (const item of this.items)
  5103. item.addToJSMap(ctx, map);
  5104. return map;
  5105. }
  5106. toString(ctx, onComment, onChompKeep) {
  5107. if (!ctx)
  5108. return JSON.stringify(this);
  5109. for (const item of this.items) {
  5110. if (!(item instanceof Pair))
  5111. throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);
  5112. }
  5113. return super.toString(ctx, {
  5114. blockItem: (n) => n.str,
  5115. flowChars: {
  5116. start: "{",
  5117. end: "}"
  5118. },
  5119. isMap: true,
  5120. itemIndent: ctx.indent || ""
  5121. }, onComment, onChompKeep);
  5122. }
  5123. };
  5124. var MERGE_KEY = "<<";
  5125. var Merge = class extends Pair {
  5126. constructor(pair) {
  5127. if (pair instanceof Pair) {
  5128. let seq = pair.value;
  5129. if (!(seq instanceof YAMLSeq)) {
  5130. seq = new YAMLSeq();
  5131. seq.items.push(pair.value);
  5132. seq.range = pair.value.range;
  5133. }
  5134. super(pair.key, seq);
  5135. this.range = pair.range;
  5136. } else {
  5137. super(new Scalar(MERGE_KEY), new YAMLSeq());
  5138. }
  5139. this.type = Pair.Type.MERGE_PAIR;
  5140. }
  5141. addToJSMap(ctx, map) {
  5142. for (const {
  5143. source
  5144. } of this.value.items) {
  5145. if (!(source instanceof YAMLMap))
  5146. throw new Error("Merge sources must be maps");
  5147. const srcMap = source.toJSON(null, ctx, Map);
  5148. for (const [key, value] of srcMap) {
  5149. if (map instanceof Map) {
  5150. if (!map.has(key))
  5151. map.set(key, value);
  5152. } else if (map instanceof Set) {
  5153. map.add(key);
  5154. } else if (!Object.prototype.hasOwnProperty.call(map, key)) {
  5155. Object.defineProperty(map, key, {
  5156. value,
  5157. writable: true,
  5158. enumerable: true,
  5159. configurable: true
  5160. });
  5161. }
  5162. }
  5163. }
  5164. return map;
  5165. }
  5166. toString(ctx, onComment) {
  5167. const seq = this.value;
  5168. if (seq.items.length > 1)
  5169. return super.toString(ctx, onComment);
  5170. this.value = seq.items[0];
  5171. const str = super.toString(ctx, onComment);
  5172. this.value = seq;
  5173. return str;
  5174. }
  5175. };
  5176. var binaryOptions = {
  5177. defaultType: PlainValue.Type.BLOCK_LITERAL,
  5178. lineWidth: 76
  5179. };
  5180. var boolOptions = {
  5181. trueStr: "true",
  5182. falseStr: "false"
  5183. };
  5184. var intOptions = {
  5185. asBigInt: false
  5186. };
  5187. var nullOptions = {
  5188. nullStr: "null"
  5189. };
  5190. var strOptions = {
  5191. defaultType: PlainValue.Type.PLAIN,
  5192. doubleQuoted: {
  5193. jsonEncoding: false,
  5194. minMultiLineLength: 40
  5195. },
  5196. fold: {
  5197. lineWidth: 80,
  5198. minContentWidth: 20
  5199. }
  5200. };
  5201. function resolveScalar(str, tags, scalarFallback) {
  5202. for (const {
  5203. format,
  5204. test,
  5205. resolve
  5206. } of tags) {
  5207. if (test) {
  5208. const match = str.match(test);
  5209. if (match) {
  5210. let res = resolve.apply(null, match);
  5211. if (!(res instanceof Scalar))
  5212. res = new Scalar(res);
  5213. if (format)
  5214. res.format = format;
  5215. return res;
  5216. }
  5217. }
  5218. }
  5219. if (scalarFallback)
  5220. str = scalarFallback(str);
  5221. return new Scalar(str);
  5222. }
  5223. var FOLD_FLOW = "flow";
  5224. var FOLD_BLOCK = "block";
  5225. var FOLD_QUOTED = "quoted";
  5226. var consumeMoreIndentedLines = (text, i) => {
  5227. let ch = text[i + 1];
  5228. while (ch === " " || ch === " ") {
  5229. do {
  5230. ch = text[i += 1];
  5231. } while (ch && ch !== "\n");
  5232. ch = text[i + 1];
  5233. }
  5234. return i;
  5235. };
  5236. function foldFlowLines(text, indent, mode, {
  5237. indentAtStart,
  5238. lineWidth = 80,
  5239. minContentWidth = 20,
  5240. onFold,
  5241. onOverflow
  5242. }) {
  5243. if (!lineWidth || lineWidth < 0)
  5244. return text;
  5245. const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
  5246. if (text.length <= endStep)
  5247. return text;
  5248. const folds = [];
  5249. const escapedFolds = {};
  5250. let end = lineWidth - indent.length;
  5251. if (typeof indentAtStart === "number") {
  5252. if (indentAtStart > lineWidth - Math.max(2, minContentWidth))
  5253. folds.push(0);
  5254. else
  5255. end = lineWidth - indentAtStart;
  5256. }
  5257. let split = void 0;
  5258. let prev = void 0;
  5259. let overflow = false;
  5260. let i = -1;
  5261. let escStart = -1;
  5262. let escEnd = -1;
  5263. if (mode === FOLD_BLOCK) {
  5264. i = consumeMoreIndentedLines(text, i);
  5265. if (i !== -1)
  5266. end = i + endStep;
  5267. }
  5268. for (let ch; ch = text[i += 1]; ) {
  5269. if (mode === FOLD_QUOTED && ch === "\\") {
  5270. escStart = i;
  5271. switch (text[i + 1]) {
  5272. case "x":
  5273. i += 3;
  5274. break;
  5275. case "u":
  5276. i += 5;
  5277. break;
  5278. case "U":
  5279. i += 9;
  5280. break;
  5281. default:
  5282. i += 1;
  5283. }
  5284. escEnd = i;
  5285. }
  5286. if (ch === "\n") {
  5287. if (mode === FOLD_BLOCK)
  5288. i = consumeMoreIndentedLines(text, i);
  5289. end = i + endStep;
  5290. split = void 0;
  5291. } else {
  5292. if (ch === " " && prev && prev !== " " && prev !== "\n" && prev !== " ") {
  5293. const next = text[i + 1];
  5294. if (next && next !== " " && next !== "\n" && next !== " ")
  5295. split = i;
  5296. }
  5297. if (i >= end) {
  5298. if (split) {
  5299. folds.push(split);
  5300. end = split + endStep;
  5301. split = void 0;
  5302. } else if (mode === FOLD_QUOTED) {
  5303. while (prev === " " || prev === " ") {
  5304. prev = ch;
  5305. ch = text[i += 1];
  5306. overflow = true;
  5307. }
  5308. const j = i > escEnd + 1 ? i - 2 : escStart - 1;
  5309. if (escapedFolds[j])
  5310. return text;
  5311. folds.push(j);
  5312. escapedFolds[j] = true;
  5313. end = j + endStep;
  5314. split = void 0;
  5315. } else {
  5316. overflow = true;
  5317. }
  5318. }
  5319. }
  5320. prev = ch;
  5321. }
  5322. if (overflow && onOverflow)
  5323. onOverflow();
  5324. if (folds.length === 0)
  5325. return text;
  5326. if (onFold)
  5327. onFold();
  5328. let res = text.slice(0, folds[0]);
  5329. for (let i2 = 0; i2 < folds.length; ++i2) {
  5330. const fold = folds[i2];
  5331. const end2 = folds[i2 + 1] || text.length;
  5332. if (fold === 0)
  5333. res = `
  5334. ${indent}${text.slice(0, end2)}`;
  5335. else {
  5336. if (mode === FOLD_QUOTED && escapedFolds[fold])
  5337. res += `${text[fold]}\\`;
  5338. res += `
  5339. ${indent}${text.slice(fold + 1, end2)}`;
  5340. }
  5341. }
  5342. return res;
  5343. }
  5344. var getFoldOptions = ({
  5345. indentAtStart
  5346. }) => indentAtStart ? Object.assign({
  5347. indentAtStart
  5348. }, strOptions.fold) : strOptions.fold;
  5349. var containsDocumentMarker = (str) => /^(%|---|\.\.\.)/m.test(str);
  5350. function lineLengthOverLimit(str, lineWidth, indentLength) {
  5351. if (!lineWidth || lineWidth < 0)
  5352. return false;
  5353. const limit = lineWidth - indentLength;
  5354. const strLen = str.length;
  5355. if (strLen <= limit)
  5356. return false;
  5357. for (let i = 0, start = 0; i < strLen; ++i) {
  5358. if (str[i] === "\n") {
  5359. if (i - start > limit)
  5360. return true;
  5361. start = i + 1;
  5362. if (strLen - start <= limit)
  5363. return false;
  5364. }
  5365. }
  5366. return true;
  5367. }
  5368. function doubleQuotedString(value, ctx) {
  5369. const {
  5370. implicitKey
  5371. } = ctx;
  5372. const {
  5373. jsonEncoding,
  5374. minMultiLineLength
  5375. } = strOptions.doubleQuoted;
  5376. const json = JSON.stringify(value);
  5377. if (jsonEncoding)
  5378. return json;
  5379. const indent = ctx.indent || (containsDocumentMarker(value) ? " " : "");
  5380. let str = "";
  5381. let start = 0;
  5382. for (let i = 0, ch = json[i]; ch; ch = json[++i]) {
  5383. if (ch === " " && json[i + 1] === "\\" && json[i + 2] === "n") {
  5384. str += json.slice(start, i) + "\\ ";
  5385. i += 1;
  5386. start = i;
  5387. ch = "\\";
  5388. }
  5389. if (ch === "\\")
  5390. switch (json[i + 1]) {
  5391. case "u":
  5392. {
  5393. str += json.slice(start, i);
  5394. const code = json.substr(i + 2, 4);
  5395. switch (code) {
  5396. case "0000":
  5397. str += "\\0";
  5398. break;
  5399. case "0007":
  5400. str += "\\a";
  5401. break;
  5402. case "000b":
  5403. str += "\\v";
  5404. break;
  5405. case "001b":
  5406. str += "\\e";
  5407. break;
  5408. case "0085":
  5409. str += "\\N";
  5410. break;
  5411. case "00a0":
  5412. str += "\\_";
  5413. break;
  5414. case "2028":
  5415. str += "\\L";
  5416. break;
  5417. case "2029":
  5418. str += "\\P";
  5419. break;
  5420. default:
  5421. if (code.substr(0, 2) === "00")
  5422. str += "\\x" + code.substr(2);
  5423. else
  5424. str += json.substr(i, 6);
  5425. }
  5426. i += 5;
  5427. start = i + 1;
  5428. }
  5429. break;
  5430. case "n":
  5431. if (implicitKey || json[i + 2] === '"' || json.length < minMultiLineLength) {
  5432. i += 1;
  5433. } else {
  5434. str += json.slice(start, i) + "\n\n";
  5435. while (json[i + 2] === "\\" && json[i + 3] === "n" && json[i + 4] !== '"') {
  5436. str += "\n";
  5437. i += 2;
  5438. }
  5439. str += indent;
  5440. if (json[i + 2] === " ")
  5441. str += "\\";
  5442. i += 1;
  5443. start = i + 1;
  5444. }
  5445. break;
  5446. default:
  5447. i += 1;
  5448. }
  5449. }
  5450. str = start ? str + json.slice(start) : json;
  5451. return implicitKey ? str : foldFlowLines(str, indent, FOLD_QUOTED, getFoldOptions(ctx));
  5452. }
  5453. function singleQuotedString(value, ctx) {
  5454. if (ctx.implicitKey) {
  5455. if (/\n/.test(value))
  5456. return doubleQuotedString(value, ctx);
  5457. } else {
  5458. if (/[ \t]\n|\n[ \t]/.test(value))
  5459. return doubleQuotedString(value, ctx);
  5460. }
  5461. const indent = ctx.indent || (containsDocumentMarker(value) ? " " : "");
  5462. const res = "'" + value.replace(/'/g, "''").replace(/\n+/g, `$&
  5463. ${indent}`) + "'";
  5464. return ctx.implicitKey ? res : foldFlowLines(res, indent, FOLD_FLOW, getFoldOptions(ctx));
  5465. }
  5466. function blockString({
  5467. comment,
  5468. type,
  5469. value
  5470. }, ctx, onComment, onChompKeep) {
  5471. if (/\n[\t ]+$/.test(value) || /^\s*$/.test(value)) {
  5472. return doubleQuotedString(value, ctx);
  5473. }
  5474. const indent = ctx.indent || (ctx.forceBlockIndent || containsDocumentMarker(value) ? " " : "");
  5475. const indentSize = indent ? "2" : "1";
  5476. const literal = type === PlainValue.Type.BLOCK_FOLDED ? false : type === PlainValue.Type.BLOCK_LITERAL ? true : !lineLengthOverLimit(value, strOptions.fold.lineWidth, indent.length);
  5477. let header = literal ? "|" : ">";
  5478. if (!value)
  5479. return header + "\n";
  5480. let wsStart = "";
  5481. let wsEnd = "";
  5482. value = value.replace(/[\n\t ]*$/, (ws) => {
  5483. const n = ws.indexOf("\n");
  5484. if (n === -1) {
  5485. header += "-";
  5486. } else if (value === ws || n !== ws.length - 1) {
  5487. header += "+";
  5488. if (onChompKeep)
  5489. onChompKeep();
  5490. }
  5491. wsEnd = ws.replace(/\n$/, "");
  5492. return "";
  5493. }).replace(/^[\n ]*/, (ws) => {
  5494. if (ws.indexOf(" ") !== -1)
  5495. header += indentSize;
  5496. const m = ws.match(/ +$/);
  5497. if (m) {
  5498. wsStart = ws.slice(0, -m[0].length);
  5499. return m[0];
  5500. } else {
  5501. wsStart = ws;
  5502. return "";
  5503. }
  5504. });
  5505. if (wsEnd)
  5506. wsEnd = wsEnd.replace(/\n+(?!\n|$)/g, `$&${indent}`);
  5507. if (wsStart)
  5508. wsStart = wsStart.replace(/\n+/g, `$&${indent}`);
  5509. if (comment) {
  5510. header += " #" + comment.replace(/ ?[\r\n]+/g, " ");
  5511. if (onComment)
  5512. onComment();
  5513. }
  5514. if (!value)
  5515. return `${header}${indentSize}
  5516. ${indent}${wsEnd}`;
  5517. if (literal) {
  5518. value = value.replace(/\n+/g, `$&${indent}`);
  5519. return `${header}
  5520. ${indent}${wsStart}${value}${wsEnd}`;
  5521. }
  5522. value = value.replace(/\n+/g, "\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${indent}`);
  5523. const body = foldFlowLines(`${wsStart}${value}${wsEnd}`, indent, FOLD_BLOCK, strOptions.fold);
  5524. return `${header}
  5525. ${indent}${body}`;
  5526. }
  5527. function plainString(item, ctx, onComment, onChompKeep) {
  5528. const {
  5529. comment,
  5530. type,
  5531. value
  5532. } = item;
  5533. const {
  5534. actualString,
  5535. implicitKey,
  5536. indent,
  5537. inFlow
  5538. } = ctx;
  5539. if (implicitKey && /[\n[\]{},]/.test(value) || inFlow && /[[\]{},]/.test(value)) {
  5540. return doubleQuotedString(value, ctx);
  5541. }
  5542. if (!value || /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
  5543. return implicitKey || inFlow || value.indexOf("\n") === -1 ? value.indexOf('"') !== -1 && value.indexOf("'") === -1 ? singleQuotedString(value, ctx) : doubleQuotedString(value, ctx) : blockString(item, ctx, onComment, onChompKeep);
  5544. }
  5545. if (!implicitKey && !inFlow && type !== PlainValue.Type.PLAIN && value.indexOf("\n") !== -1) {
  5546. return blockString(item, ctx, onComment, onChompKeep);
  5547. }
  5548. if (indent === "" && containsDocumentMarker(value)) {
  5549. ctx.forceBlockIndent = true;
  5550. return blockString(item, ctx, onComment, onChompKeep);
  5551. }
  5552. const str = value.replace(/\n+/g, `$&
  5553. ${indent}`);
  5554. if (actualString) {
  5555. const {
  5556. tags
  5557. } = ctx.doc.schema;
  5558. const resolved = resolveScalar(str, tags, tags.scalarFallback).value;
  5559. if (typeof resolved !== "string")
  5560. return doubleQuotedString(value, ctx);
  5561. }
  5562. const body = implicitKey ? str : foldFlowLines(str, indent, FOLD_FLOW, getFoldOptions(ctx));
  5563. if (comment && !inFlow && (body.indexOf("\n") !== -1 || comment.indexOf("\n") !== -1)) {
  5564. if (onComment)
  5565. onComment();
  5566. return addCommentBefore(body, indent, comment);
  5567. }
  5568. return body;
  5569. }
  5570. function stringifyString(item, ctx, onComment, onChompKeep) {
  5571. const {
  5572. defaultType
  5573. } = strOptions;
  5574. const {
  5575. implicitKey,
  5576. inFlow
  5577. } = ctx;
  5578. let {
  5579. type,
  5580. value
  5581. } = item;
  5582. if (typeof value !== "string") {
  5583. value = String(value);
  5584. item = Object.assign({}, item, {
  5585. value
  5586. });
  5587. }
  5588. const _stringify = (_type) => {
  5589. switch (_type) {
  5590. case PlainValue.Type.BLOCK_FOLDED:
  5591. case PlainValue.Type.BLOCK_LITERAL:
  5592. return blockString(item, ctx, onComment, onChompKeep);
  5593. case PlainValue.Type.QUOTE_DOUBLE:
  5594. return doubleQuotedString(value, ctx);
  5595. case PlainValue.Type.QUOTE_SINGLE:
  5596. return singleQuotedString(value, ctx);
  5597. case PlainValue.Type.PLAIN:
  5598. return plainString(item, ctx, onComment, onChompKeep);
  5599. default:
  5600. return null;
  5601. }
  5602. };
  5603. if (type !== PlainValue.Type.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f]/.test(value)) {
  5604. type = PlainValue.Type.QUOTE_DOUBLE;
  5605. } else if ((implicitKey || inFlow) && (type === PlainValue.Type.BLOCK_FOLDED || type === PlainValue.Type.BLOCK_LITERAL)) {
  5606. type = PlainValue.Type.QUOTE_DOUBLE;
  5607. }
  5608. let res = _stringify(type);
  5609. if (res === null) {
  5610. res = _stringify(defaultType);
  5611. if (res === null)
  5612. throw new Error(`Unsupported default string type ${defaultType}`);
  5613. }
  5614. return res;
  5615. }
  5616. function stringifyNumber({
  5617. format,
  5618. minFractionDigits,
  5619. tag,
  5620. value
  5621. }) {
  5622. if (typeof value === "bigint")
  5623. return String(value);
  5624. if (!isFinite(value))
  5625. return isNaN(value) ? ".nan" : value < 0 ? "-.inf" : ".inf";
  5626. let n = JSON.stringify(value);
  5627. if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^\d/.test(n)) {
  5628. let i = n.indexOf(".");
  5629. if (i < 0) {
  5630. i = n.length;
  5631. n += ".";
  5632. }
  5633. let d = minFractionDigits - (n.length - i - 1);
  5634. while (d-- > 0)
  5635. n += "0";
  5636. }
  5637. return n;
  5638. }
  5639. function checkFlowCollectionEnd(errors, cst) {
  5640. let char, name;
  5641. switch (cst.type) {
  5642. case PlainValue.Type.FLOW_MAP:
  5643. char = "}";
  5644. name = "flow map";
  5645. break;
  5646. case PlainValue.Type.FLOW_SEQ:
  5647. char = "]";
  5648. name = "flow sequence";
  5649. break;
  5650. default:
  5651. errors.push(new PlainValue.YAMLSemanticError(cst, "Not a flow collection!?"));
  5652. return;
  5653. }
  5654. let lastItem;
  5655. for (let i = cst.items.length - 1; i >= 0; --i) {
  5656. const item = cst.items[i];
  5657. if (!item || item.type !== PlainValue.Type.COMMENT) {
  5658. lastItem = item;
  5659. break;
  5660. }
  5661. }
  5662. if (lastItem && lastItem.char !== char) {
  5663. const msg = `Expected ${name} to end with ${char}`;
  5664. let err;
  5665. if (typeof lastItem.offset === "number") {
  5666. err = new PlainValue.YAMLSemanticError(cst, msg);
  5667. err.offset = lastItem.offset + 1;
  5668. } else {
  5669. err = new PlainValue.YAMLSemanticError(lastItem, msg);
  5670. if (lastItem.range && lastItem.range.end)
  5671. err.offset = lastItem.range.end - lastItem.range.start;
  5672. }
  5673. errors.push(err);
  5674. }
  5675. }
  5676. function checkFlowCommentSpace(errors, comment) {
  5677. const prev = comment.context.src[comment.range.start - 1];
  5678. if (prev !== "\n" && prev !== " " && prev !== " ") {
  5679. const msg = "Comments must be separated from other tokens by white space characters";
  5680. errors.push(new PlainValue.YAMLSemanticError(comment, msg));
  5681. }
  5682. }
  5683. function getLongKeyError(source, key) {
  5684. const sk = String(key);
  5685. const k = sk.substr(0, 8) + "..." + sk.substr(-8);
  5686. return new PlainValue.YAMLSemanticError(source, `The "${k}" key is too long`);
  5687. }
  5688. function resolveComments(collection, comments) {
  5689. for (const {
  5690. afterKey,
  5691. before,
  5692. comment
  5693. } of comments) {
  5694. let item = collection.items[before];
  5695. if (!item) {
  5696. if (comment !== void 0) {
  5697. if (collection.comment)
  5698. collection.comment += "\n" + comment;
  5699. else
  5700. collection.comment = comment;
  5701. }
  5702. } else {
  5703. if (afterKey && item.value)
  5704. item = item.value;
  5705. if (comment === void 0) {
  5706. if (afterKey || !item.commentBefore)
  5707. item.spaceBefore = true;
  5708. } else {
  5709. if (item.commentBefore)
  5710. item.commentBefore += "\n" + comment;
  5711. else
  5712. item.commentBefore = comment;
  5713. }
  5714. }
  5715. }
  5716. }
  5717. function resolveString(doc, node) {
  5718. const res = node.strValue;
  5719. if (!res)
  5720. return "";
  5721. if (typeof res === "string")
  5722. return res;
  5723. res.errors.forEach((error) => {
  5724. if (!error.source)
  5725. error.source = node;
  5726. doc.errors.push(error);
  5727. });
  5728. return res.str;
  5729. }
  5730. function resolveTagHandle(doc, node) {
  5731. const {
  5732. handle,
  5733. suffix
  5734. } = node.tag;
  5735. let prefix = doc.tagPrefixes.find((p) => p.handle === handle);
  5736. if (!prefix) {
  5737. const dtp = doc.getDefaults().tagPrefixes;
  5738. if (dtp)
  5739. prefix = dtp.find((p) => p.handle === handle);
  5740. if (!prefix)
  5741. throw new PlainValue.YAMLSemanticError(node, `The ${handle} tag handle is non-default and was not declared.`);
  5742. }
  5743. if (!suffix)
  5744. throw new PlainValue.YAMLSemanticError(node, `The ${handle} tag has no suffix.`);
  5745. if (handle === "!" && (doc.version || doc.options.version) === "1.0") {
  5746. if (suffix[0] === "^") {
  5747. doc.warnings.push(new PlainValue.YAMLWarning(node, "YAML 1.0 ^ tag expansion is not supported"));
  5748. return suffix;
  5749. }
  5750. if (/[:/]/.test(suffix)) {
  5751. const vocab = suffix.match(/^([a-z0-9-]+)\/(.*)/i);
  5752. return vocab ? `tag:${vocab[1]}.yaml.org,2002:${vocab[2]}` : `tag:${suffix}`;
  5753. }
  5754. }
  5755. return prefix.prefix + decodeURIComponent(suffix);
  5756. }
  5757. function resolveTagName(doc, node) {
  5758. const {
  5759. tag,
  5760. type
  5761. } = node;
  5762. let nonSpecific = false;
  5763. if (tag) {
  5764. const {
  5765. handle,
  5766. suffix,
  5767. verbatim
  5768. } = tag;
  5769. if (verbatim) {
  5770. if (verbatim !== "!" && verbatim !== "!!")
  5771. return verbatim;
  5772. const msg = `Verbatim tags aren't resolved, so ${verbatim} is invalid.`;
  5773. doc.errors.push(new PlainValue.YAMLSemanticError(node, msg));
  5774. } else if (handle === "!" && !suffix) {
  5775. nonSpecific = true;
  5776. } else {
  5777. try {
  5778. return resolveTagHandle(doc, node);
  5779. } catch (error) {
  5780. doc.errors.push(error);
  5781. }
  5782. }
  5783. }
  5784. switch (type) {
  5785. case PlainValue.Type.BLOCK_FOLDED:
  5786. case PlainValue.Type.BLOCK_LITERAL:
  5787. case PlainValue.Type.QUOTE_DOUBLE:
  5788. case PlainValue.Type.QUOTE_SINGLE:
  5789. return PlainValue.defaultTags.STR;
  5790. case PlainValue.Type.FLOW_MAP:
  5791. case PlainValue.Type.MAP:
  5792. return PlainValue.defaultTags.MAP;
  5793. case PlainValue.Type.FLOW_SEQ:
  5794. case PlainValue.Type.SEQ:
  5795. return PlainValue.defaultTags.SEQ;
  5796. case PlainValue.Type.PLAIN:
  5797. return nonSpecific ? PlainValue.defaultTags.STR : null;
  5798. default:
  5799. return null;
  5800. }
  5801. }
  5802. function resolveByTagName(doc, node, tagName) {
  5803. const {
  5804. tags
  5805. } = doc.schema;
  5806. const matchWithTest = [];
  5807. for (const tag of tags) {
  5808. if (tag.tag === tagName) {
  5809. if (tag.test)
  5810. matchWithTest.push(tag);
  5811. else {
  5812. const res = tag.resolve(doc, node);
  5813. return res instanceof Collection ? res : new Scalar(res);
  5814. }
  5815. }
  5816. }
  5817. const str = resolveString(doc, node);
  5818. if (typeof str === "string" && matchWithTest.length > 0)
  5819. return resolveScalar(str, matchWithTest, tags.scalarFallback);
  5820. return null;
  5821. }
  5822. function getFallbackTagName({
  5823. type
  5824. }) {
  5825. switch (type) {
  5826. case PlainValue.Type.FLOW_MAP:
  5827. case PlainValue.Type.MAP:
  5828. return PlainValue.defaultTags.MAP;
  5829. case PlainValue.Type.FLOW_SEQ:
  5830. case PlainValue.Type.SEQ:
  5831. return PlainValue.defaultTags.SEQ;
  5832. default:
  5833. return PlainValue.defaultTags.STR;
  5834. }
  5835. }
  5836. function resolveTag(doc, node, tagName) {
  5837. try {
  5838. const res = resolveByTagName(doc, node, tagName);
  5839. if (res) {
  5840. if (tagName && node.tag)
  5841. res.tag = tagName;
  5842. return res;
  5843. }
  5844. } catch (error) {
  5845. if (!error.source)
  5846. error.source = node;
  5847. doc.errors.push(error);
  5848. return null;
  5849. }
  5850. try {
  5851. const fallback = getFallbackTagName(node);
  5852. if (!fallback)
  5853. throw new Error(`The tag ${tagName} is unavailable`);
  5854. const msg = `The tag ${tagName} is unavailable, falling back to ${fallback}`;
  5855. doc.warnings.push(new PlainValue.YAMLWarning(node, msg));
  5856. const res = resolveByTagName(doc, node, fallback);
  5857. res.tag = tagName;
  5858. return res;
  5859. } catch (error) {
  5860. const refError = new PlainValue.YAMLReferenceError(node, error.message);
  5861. refError.stack = error.stack;
  5862. doc.errors.push(refError);
  5863. return null;
  5864. }
  5865. }
  5866. var isCollectionItem = (node) => {
  5867. if (!node)
  5868. return false;
  5869. const {
  5870. type
  5871. } = node;
  5872. return type === PlainValue.Type.MAP_KEY || type === PlainValue.Type.MAP_VALUE || type === PlainValue.Type.SEQ_ITEM;
  5873. };
  5874. function resolveNodeProps(errors, node) {
  5875. const comments = {
  5876. before: [],
  5877. after: []
  5878. };
  5879. let hasAnchor = false;
  5880. let hasTag = false;
  5881. const props = isCollectionItem(node.context.parent) ? node.context.parent.props.concat(node.props) : node.props;
  5882. for (const {
  5883. start,
  5884. end
  5885. } of props) {
  5886. switch (node.context.src[start]) {
  5887. case PlainValue.Char.COMMENT: {
  5888. if (!node.commentHasRequiredWhitespace(start)) {
  5889. const msg = "Comments must be separated from other tokens by white space characters";
  5890. errors.push(new PlainValue.YAMLSemanticError(node, msg));
  5891. }
  5892. const {
  5893. header,
  5894. valueRange
  5895. } = node;
  5896. const cc = valueRange && (start > valueRange.start || header && start > header.start) ? comments.after : comments.before;
  5897. cc.push(node.context.src.slice(start + 1, end));
  5898. break;
  5899. }
  5900. case PlainValue.Char.ANCHOR:
  5901. if (hasAnchor) {
  5902. const msg = "A node can have at most one anchor";
  5903. errors.push(new PlainValue.YAMLSemanticError(node, msg));
  5904. }
  5905. hasAnchor = true;
  5906. break;
  5907. case PlainValue.Char.TAG:
  5908. if (hasTag) {
  5909. const msg = "A node can have at most one tag";
  5910. errors.push(new PlainValue.YAMLSemanticError(node, msg));
  5911. }
  5912. hasTag = true;
  5913. break;
  5914. }
  5915. }
  5916. return {
  5917. comments,
  5918. hasAnchor,
  5919. hasTag
  5920. };
  5921. }
  5922. function resolveNodeValue(doc, node) {
  5923. const {
  5924. anchors,
  5925. errors,
  5926. schema
  5927. } = doc;
  5928. if (node.type === PlainValue.Type.ALIAS) {
  5929. const name = node.rawValue;
  5930. const src = anchors.getNode(name);
  5931. if (!src) {
  5932. const msg = `Aliased anchor not found: ${name}`;
  5933. errors.push(new PlainValue.YAMLReferenceError(node, msg));
  5934. return null;
  5935. }
  5936. const res = new Alias(src);
  5937. anchors._cstAliases.push(res);
  5938. return res;
  5939. }
  5940. const tagName = resolveTagName(doc, node);
  5941. if (tagName)
  5942. return resolveTag(doc, node, tagName);
  5943. if (node.type !== PlainValue.Type.PLAIN) {
  5944. const msg = `Failed to resolve ${node.type} node here`;
  5945. errors.push(new PlainValue.YAMLSyntaxError(node, msg));
  5946. return null;
  5947. }
  5948. try {
  5949. const str = resolveString(doc, node);
  5950. return resolveScalar(str, schema.tags, schema.tags.scalarFallback);
  5951. } catch (error) {
  5952. if (!error.source)
  5953. error.source = node;
  5954. errors.push(error);
  5955. return null;
  5956. }
  5957. }
  5958. function resolveNode(doc, node) {
  5959. if (!node)
  5960. return null;
  5961. if (node.error)
  5962. doc.errors.push(node.error);
  5963. const {
  5964. comments,
  5965. hasAnchor,
  5966. hasTag
  5967. } = resolveNodeProps(doc.errors, node);
  5968. if (hasAnchor) {
  5969. const {
  5970. anchors
  5971. } = doc;
  5972. const name = node.anchor;
  5973. const prev = anchors.getNode(name);
  5974. if (prev)
  5975. anchors.map[anchors.newName(name)] = prev;
  5976. anchors.map[name] = node;
  5977. }
  5978. if (node.type === PlainValue.Type.ALIAS && (hasAnchor || hasTag)) {
  5979. const msg = "An alias node must not specify any properties";
  5980. doc.errors.push(new PlainValue.YAMLSemanticError(node, msg));
  5981. }
  5982. const res = resolveNodeValue(doc, node);
  5983. if (res) {
  5984. res.range = [node.range.start, node.range.end];
  5985. if (doc.options.keepCstNodes)
  5986. res.cstNode = node;
  5987. if (doc.options.keepNodeTypes)
  5988. res.type = node.type;
  5989. const cb = comments.before.join("\n");
  5990. if (cb) {
  5991. res.commentBefore = res.commentBefore ? `${res.commentBefore}
  5992. ${cb}` : cb;
  5993. }
  5994. const ca = comments.after.join("\n");
  5995. if (ca)
  5996. res.comment = res.comment ? `${res.comment}
  5997. ${ca}` : ca;
  5998. }
  5999. return node.resolved = res;
  6000. }
  6001. function resolveMap(doc, cst) {
  6002. if (cst.type !== PlainValue.Type.MAP && cst.type !== PlainValue.Type.FLOW_MAP) {
  6003. const msg = `A ${cst.type} node cannot be resolved as a mapping`;
  6004. doc.errors.push(new PlainValue.YAMLSyntaxError(cst, msg));
  6005. return null;
  6006. }
  6007. const {
  6008. comments,
  6009. items
  6010. } = cst.type === PlainValue.Type.FLOW_MAP ? resolveFlowMapItems(doc, cst) : resolveBlockMapItems(doc, cst);
  6011. const map = new YAMLMap();
  6012. map.items = items;
  6013. resolveComments(map, comments);
  6014. let hasCollectionKey = false;
  6015. for (let i = 0; i < items.length; ++i) {
  6016. const {
  6017. key: iKey
  6018. } = items[i];
  6019. if (iKey instanceof Collection)
  6020. hasCollectionKey = true;
  6021. if (doc.schema.merge && iKey && iKey.value === MERGE_KEY) {
  6022. items[i] = new Merge(items[i]);
  6023. const sources = items[i].value.items;
  6024. let error = null;
  6025. sources.some((node) => {
  6026. if (node instanceof Alias) {
  6027. const {
  6028. type
  6029. } = node.source;
  6030. if (type === PlainValue.Type.MAP || type === PlainValue.Type.FLOW_MAP)
  6031. return false;
  6032. return error = "Merge nodes aliases can only point to maps";
  6033. }
  6034. return error = "Merge nodes can only have Alias nodes as values";
  6035. });
  6036. if (error)
  6037. doc.errors.push(new PlainValue.YAMLSemanticError(cst, error));
  6038. } else {
  6039. for (let j = i + 1; j < items.length; ++j) {
  6040. const {
  6041. key: jKey
  6042. } = items[j];
  6043. if (iKey === jKey || iKey && jKey && Object.prototype.hasOwnProperty.call(iKey, "value") && iKey.value === jKey.value) {
  6044. const msg = `Map keys must be unique; "${iKey}" is repeated`;
  6045. doc.errors.push(new PlainValue.YAMLSemanticError(cst, msg));
  6046. break;
  6047. }
  6048. }
  6049. }
  6050. }
  6051. if (hasCollectionKey && !doc.options.mapAsMap) {
  6052. const warn = "Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.";
  6053. doc.warnings.push(new PlainValue.YAMLWarning(cst, warn));
  6054. }
  6055. cst.resolved = map;
  6056. return map;
  6057. }
  6058. var valueHasPairComment = ({
  6059. context: {
  6060. lineStart,
  6061. node,
  6062. src
  6063. },
  6064. props
  6065. }) => {
  6066. if (props.length === 0)
  6067. return false;
  6068. const {
  6069. start
  6070. } = props[0];
  6071. if (node && start > node.valueRange.start)
  6072. return false;
  6073. if (src[start] !== PlainValue.Char.COMMENT)
  6074. return false;
  6075. for (let i = lineStart; i < start; ++i)
  6076. if (src[i] === "\n")
  6077. return false;
  6078. return true;
  6079. };
  6080. function resolvePairComment(item, pair) {
  6081. if (!valueHasPairComment(item))
  6082. return;
  6083. const comment = item.getPropValue(0, PlainValue.Char.COMMENT, true);
  6084. let found = false;
  6085. const cb = pair.value.commentBefore;
  6086. if (cb && cb.startsWith(comment)) {
  6087. pair.value.commentBefore = cb.substr(comment.length + 1);
  6088. found = true;
  6089. } else {
  6090. const cc = pair.value.comment;
  6091. if (!item.node && cc && cc.startsWith(comment)) {
  6092. pair.value.comment = cc.substr(comment.length + 1);
  6093. found = true;
  6094. }
  6095. }
  6096. if (found)
  6097. pair.comment = comment;
  6098. }
  6099. function resolveBlockMapItems(doc, cst) {
  6100. const comments = [];
  6101. const items = [];
  6102. let key = void 0;
  6103. let keyStart = null;
  6104. for (let i = 0; i < cst.items.length; ++i) {
  6105. const item = cst.items[i];
  6106. switch (item.type) {
  6107. case PlainValue.Type.BLANK_LINE:
  6108. comments.push({
  6109. afterKey: !!key,
  6110. before: items.length
  6111. });
  6112. break;
  6113. case PlainValue.Type.COMMENT:
  6114. comments.push({
  6115. afterKey: !!key,
  6116. before: items.length,
  6117. comment: item.comment
  6118. });
  6119. break;
  6120. case PlainValue.Type.MAP_KEY:
  6121. if (key !== void 0)
  6122. items.push(new Pair(key));
  6123. if (item.error)
  6124. doc.errors.push(item.error);
  6125. key = resolveNode(doc, item.node);
  6126. keyStart = null;
  6127. break;
  6128. case PlainValue.Type.MAP_VALUE:
  6129. {
  6130. if (key === void 0)
  6131. key = null;
  6132. if (item.error)
  6133. doc.errors.push(item.error);
  6134. if (!item.context.atLineStart && item.node && item.node.type === PlainValue.Type.MAP && !item.node.context.atLineStart) {
  6135. const msg = "Nested mappings are not allowed in compact mappings";
  6136. doc.errors.push(new PlainValue.YAMLSemanticError(item.node, msg));
  6137. }
  6138. let valueNode = item.node;
  6139. if (!valueNode && item.props.length > 0) {
  6140. valueNode = new PlainValue.PlainValue(PlainValue.Type.PLAIN, []);
  6141. valueNode.context = {
  6142. parent: item,
  6143. src: item.context.src
  6144. };
  6145. const pos = item.range.start + 1;
  6146. valueNode.range = {
  6147. start: pos,
  6148. end: pos
  6149. };
  6150. valueNode.valueRange = {
  6151. start: pos,
  6152. end: pos
  6153. };
  6154. if (typeof item.range.origStart === "number") {
  6155. const origPos = item.range.origStart + 1;
  6156. valueNode.range.origStart = valueNode.range.origEnd = origPos;
  6157. valueNode.valueRange.origStart = valueNode.valueRange.origEnd = origPos;
  6158. }
  6159. }
  6160. const pair = new Pair(key, resolveNode(doc, valueNode));
  6161. resolvePairComment(item, pair);
  6162. items.push(pair);
  6163. if (key && typeof keyStart === "number") {
  6164. if (item.range.start > keyStart + 1024)
  6165. doc.errors.push(getLongKeyError(cst, key));
  6166. }
  6167. key = void 0;
  6168. keyStart = null;
  6169. }
  6170. break;
  6171. default:
  6172. if (key !== void 0)
  6173. items.push(new Pair(key));
  6174. key = resolveNode(doc, item);
  6175. keyStart = item.range.start;
  6176. if (item.error)
  6177. doc.errors.push(item.error);
  6178. next:
  6179. for (let j = i + 1; ; ++j) {
  6180. const nextItem = cst.items[j];
  6181. switch (nextItem && nextItem.type) {
  6182. case PlainValue.Type.BLANK_LINE:
  6183. case PlainValue.Type.COMMENT:
  6184. continue next;
  6185. case PlainValue.Type.MAP_VALUE:
  6186. break next;
  6187. default: {
  6188. const msg = "Implicit map keys need to be followed by map values";
  6189. doc.errors.push(new PlainValue.YAMLSemanticError(item, msg));
  6190. break next;
  6191. }
  6192. }
  6193. }
  6194. if (item.valueRangeContainsNewline) {
  6195. const msg = "Implicit map keys need to be on a single line";
  6196. doc.errors.push(new PlainValue.YAMLSemanticError(item, msg));
  6197. }
  6198. }
  6199. }
  6200. if (key !== void 0)
  6201. items.push(new Pair(key));
  6202. return {
  6203. comments,
  6204. items
  6205. };
  6206. }
  6207. function resolveFlowMapItems(doc, cst) {
  6208. const comments = [];
  6209. const items = [];
  6210. let key = void 0;
  6211. let explicitKey = false;
  6212. let next = "{";
  6213. for (let i = 0; i < cst.items.length; ++i) {
  6214. const item = cst.items[i];
  6215. if (typeof item.char === "string") {
  6216. const {
  6217. char,
  6218. offset
  6219. } = item;
  6220. if (char === "?" && key === void 0 && !explicitKey) {
  6221. explicitKey = true;
  6222. next = ":";
  6223. continue;
  6224. }
  6225. if (char === ":") {
  6226. if (key === void 0)
  6227. key = null;
  6228. if (next === ":") {
  6229. next = ",";
  6230. continue;
  6231. }
  6232. } else {
  6233. if (explicitKey) {
  6234. if (key === void 0 && char !== ",")
  6235. key = null;
  6236. explicitKey = false;
  6237. }
  6238. if (key !== void 0) {
  6239. items.push(new Pair(key));
  6240. key = void 0;
  6241. if (char === ",") {
  6242. next = ":";
  6243. continue;
  6244. }
  6245. }
  6246. }
  6247. if (char === "}") {
  6248. if (i === cst.items.length - 1)
  6249. continue;
  6250. } else if (char === next) {
  6251. next = ":";
  6252. continue;
  6253. }
  6254. const msg = `Flow map contains an unexpected ${char}`;
  6255. const err = new PlainValue.YAMLSyntaxError(cst, msg);
  6256. err.offset = offset;
  6257. doc.errors.push(err);
  6258. } else if (item.type === PlainValue.Type.BLANK_LINE) {
  6259. comments.push({
  6260. afterKey: !!key,
  6261. before: items.length
  6262. });
  6263. } else if (item.type === PlainValue.Type.COMMENT) {
  6264. checkFlowCommentSpace(doc.errors, item);
  6265. comments.push({
  6266. afterKey: !!key,
  6267. before: items.length,
  6268. comment: item.comment
  6269. });
  6270. } else if (key === void 0) {
  6271. if (next === ",")
  6272. doc.errors.push(new PlainValue.YAMLSemanticError(item, "Separator , missing in flow map"));
  6273. key = resolveNode(doc, item);
  6274. } else {
  6275. if (next !== ",")
  6276. doc.errors.push(new PlainValue.YAMLSemanticError(item, "Indicator : missing in flow map entry"));
  6277. items.push(new Pair(key, resolveNode(doc, item)));
  6278. key = void 0;
  6279. explicitKey = false;
  6280. }
  6281. }
  6282. checkFlowCollectionEnd(doc.errors, cst);
  6283. if (key !== void 0)
  6284. items.push(new Pair(key));
  6285. return {
  6286. comments,
  6287. items
  6288. };
  6289. }
  6290. function resolveSeq(doc, cst) {
  6291. if (cst.type !== PlainValue.Type.SEQ && cst.type !== PlainValue.Type.FLOW_SEQ) {
  6292. const msg = `A ${cst.type} node cannot be resolved as a sequence`;
  6293. doc.errors.push(new PlainValue.YAMLSyntaxError(cst, msg));
  6294. return null;
  6295. }
  6296. const {
  6297. comments,
  6298. items
  6299. } = cst.type === PlainValue.Type.FLOW_SEQ ? resolveFlowSeqItems(doc, cst) : resolveBlockSeqItems(doc, cst);
  6300. const seq = new YAMLSeq();
  6301. seq.items = items;
  6302. resolveComments(seq, comments);
  6303. if (!doc.options.mapAsMap && items.some((it) => it instanceof Pair && it.key instanceof Collection)) {
  6304. const warn = "Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.";
  6305. doc.warnings.push(new PlainValue.YAMLWarning(cst, warn));
  6306. }
  6307. cst.resolved = seq;
  6308. return seq;
  6309. }
  6310. function resolveBlockSeqItems(doc, cst) {
  6311. const comments = [];
  6312. const items = [];
  6313. for (let i = 0; i < cst.items.length; ++i) {
  6314. const item = cst.items[i];
  6315. switch (item.type) {
  6316. case PlainValue.Type.BLANK_LINE:
  6317. comments.push({
  6318. before: items.length
  6319. });
  6320. break;
  6321. case PlainValue.Type.COMMENT:
  6322. comments.push({
  6323. comment: item.comment,
  6324. before: items.length
  6325. });
  6326. break;
  6327. case PlainValue.Type.SEQ_ITEM:
  6328. if (item.error)
  6329. doc.errors.push(item.error);
  6330. items.push(resolveNode(doc, item.node));
  6331. if (item.hasProps) {
  6332. const msg = "Sequence items cannot have tags or anchors before the - indicator";
  6333. doc.errors.push(new PlainValue.YAMLSemanticError(item, msg));
  6334. }
  6335. break;
  6336. default:
  6337. if (item.error)
  6338. doc.errors.push(item.error);
  6339. doc.errors.push(new PlainValue.YAMLSyntaxError(item, `Unexpected ${item.type} node in sequence`));
  6340. }
  6341. }
  6342. return {
  6343. comments,
  6344. items
  6345. };
  6346. }
  6347. function resolveFlowSeqItems(doc, cst) {
  6348. const comments = [];
  6349. const items = [];
  6350. let explicitKey = false;
  6351. let key = void 0;
  6352. let keyStart = null;
  6353. let next = "[";
  6354. let prevItem = null;
  6355. for (let i = 0; i < cst.items.length; ++i) {
  6356. const item = cst.items[i];
  6357. if (typeof item.char === "string") {
  6358. const {
  6359. char,
  6360. offset
  6361. } = item;
  6362. if (char !== ":" && (explicitKey || key !== void 0)) {
  6363. if (explicitKey && key === void 0)
  6364. key = next ? items.pop() : null;
  6365. items.push(new Pair(key));
  6366. explicitKey = false;
  6367. key = void 0;
  6368. keyStart = null;
  6369. }
  6370. if (char === next) {
  6371. next = null;
  6372. } else if (!next && char === "?") {
  6373. explicitKey = true;
  6374. } else if (next !== "[" && char === ":" && key === void 0) {
  6375. if (next === ",") {
  6376. key = items.pop();
  6377. if (key instanceof Pair) {
  6378. const msg = "Chaining flow sequence pairs is invalid";
  6379. const err = new PlainValue.YAMLSemanticError(cst, msg);
  6380. err.offset = offset;
  6381. doc.errors.push(err);
  6382. }
  6383. if (!explicitKey && typeof keyStart === "number") {
  6384. const keyEnd = item.range ? item.range.start : item.offset;
  6385. if (keyEnd > keyStart + 1024)
  6386. doc.errors.push(getLongKeyError(cst, key));
  6387. const {
  6388. src
  6389. } = prevItem.context;
  6390. for (let i2 = keyStart; i2 < keyEnd; ++i2)
  6391. if (src[i2] === "\n") {
  6392. const msg = "Implicit keys of flow sequence pairs need to be on a single line";
  6393. doc.errors.push(new PlainValue.YAMLSemanticError(prevItem, msg));
  6394. break;
  6395. }
  6396. }
  6397. } else {
  6398. key = null;
  6399. }
  6400. keyStart = null;
  6401. explicitKey = false;
  6402. next = null;
  6403. } else if (next === "[" || char !== "]" || i < cst.items.length - 1) {
  6404. const msg = `Flow sequence contains an unexpected ${char}`;
  6405. const err = new PlainValue.YAMLSyntaxError(cst, msg);
  6406. err.offset = offset;
  6407. doc.errors.push(err);
  6408. }
  6409. } else if (item.type === PlainValue.Type.BLANK_LINE) {
  6410. comments.push({
  6411. before: items.length
  6412. });
  6413. } else if (item.type === PlainValue.Type.COMMENT) {
  6414. checkFlowCommentSpace(doc.errors, item);
  6415. comments.push({
  6416. comment: item.comment,
  6417. before: items.length
  6418. });
  6419. } else {
  6420. if (next) {
  6421. const msg = `Expected a ${next} in flow sequence`;
  6422. doc.errors.push(new PlainValue.YAMLSemanticError(item, msg));
  6423. }
  6424. const value = resolveNode(doc, item);
  6425. if (key === void 0) {
  6426. items.push(value);
  6427. prevItem = item;
  6428. } else {
  6429. items.push(new Pair(key, value));
  6430. key = void 0;
  6431. }
  6432. keyStart = item.range.start;
  6433. next = ",";
  6434. }
  6435. }
  6436. checkFlowCollectionEnd(doc.errors, cst);
  6437. if (key !== void 0)
  6438. items.push(new Pair(key));
  6439. return {
  6440. comments,
  6441. items
  6442. };
  6443. }
  6444. exports2.Alias = Alias;
  6445. exports2.Collection = Collection;
  6446. exports2.Merge = Merge;
  6447. exports2.Node = Node;
  6448. exports2.Pair = Pair;
  6449. exports2.Scalar = Scalar;
  6450. exports2.YAMLMap = YAMLMap;
  6451. exports2.YAMLSeq = YAMLSeq;
  6452. exports2.addComment = addComment;
  6453. exports2.binaryOptions = binaryOptions;
  6454. exports2.boolOptions = boolOptions;
  6455. exports2.findPair = findPair;
  6456. exports2.intOptions = intOptions;
  6457. exports2.isEmptyPath = isEmptyPath;
  6458. exports2.nullOptions = nullOptions;
  6459. exports2.resolveMap = resolveMap;
  6460. exports2.resolveNode = resolveNode;
  6461. exports2.resolveSeq = resolveSeq;
  6462. exports2.resolveString = resolveString;
  6463. exports2.strOptions = strOptions;
  6464. exports2.stringifyNumber = stringifyNumber;
  6465. exports2.stringifyString = stringifyString;
  6466. exports2.toJSON = toJSON;
  6467. }
  6468. });
  6469. var require_warnings_1000a372 = __commonJS({
  6470. "node_modules/yaml/dist/warnings-1000a372.js"(exports2) {
  6471. "use strict";
  6472. var PlainValue = require_PlainValue_ec8e588e();
  6473. var resolveSeq = require_resolveSeq_d03cb037();
  6474. var binary = {
  6475. identify: (value) => value instanceof Uint8Array,
  6476. default: false,
  6477. tag: "tag:yaml.org,2002:binary",
  6478. resolve: (doc, node) => {
  6479. const src = resolveSeq.resolveString(doc, node);
  6480. if (typeof Buffer === "function") {
  6481. return Buffer.from(src, "base64");
  6482. } else if (typeof atob === "function") {
  6483. const str = atob(src.replace(/[\n\r]/g, ""));
  6484. const buffer = new Uint8Array(str.length);
  6485. for (let i = 0; i < str.length; ++i)
  6486. buffer[i] = str.charCodeAt(i);
  6487. return buffer;
  6488. } else {
  6489. const msg = "This environment does not support reading binary tags; either Buffer or atob is required";
  6490. doc.errors.push(new PlainValue.YAMLReferenceError(node, msg));
  6491. return null;
  6492. }
  6493. },
  6494. options: resolveSeq.binaryOptions,
  6495. stringify: ({
  6496. comment,
  6497. type,
  6498. value
  6499. }, ctx, onComment, onChompKeep) => {
  6500. let src;
  6501. if (typeof Buffer === "function") {
  6502. src = value instanceof Buffer ? value.toString("base64") : Buffer.from(value.buffer).toString("base64");
  6503. } else if (typeof btoa === "function") {
  6504. let s = "";
  6505. for (let i = 0; i < value.length; ++i)
  6506. s += String.fromCharCode(value[i]);
  6507. src = btoa(s);
  6508. } else {
  6509. throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
  6510. }
  6511. if (!type)
  6512. type = resolveSeq.binaryOptions.defaultType;
  6513. if (type === PlainValue.Type.QUOTE_DOUBLE) {
  6514. value = src;
  6515. } else {
  6516. const {
  6517. lineWidth
  6518. } = resolveSeq.binaryOptions;
  6519. const n = Math.ceil(src.length / lineWidth);
  6520. const lines = new Array(n);
  6521. for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
  6522. lines[i] = src.substr(o, lineWidth);
  6523. }
  6524. value = lines.join(type === PlainValue.Type.BLOCK_LITERAL ? "\n" : " ");
  6525. }
  6526. return resolveSeq.stringifyString({
  6527. comment,
  6528. type,
  6529. value
  6530. }, ctx, onComment, onChompKeep);
  6531. }
  6532. };
  6533. function parsePairs(doc, cst) {
  6534. const seq = resolveSeq.resolveSeq(doc, cst);
  6535. for (let i = 0; i < seq.items.length; ++i) {
  6536. let item = seq.items[i];
  6537. if (item instanceof resolveSeq.Pair)
  6538. continue;
  6539. else if (item instanceof resolveSeq.YAMLMap) {
  6540. if (item.items.length > 1) {
  6541. const msg = "Each pair must have its own sequence indicator";
  6542. throw new PlainValue.YAMLSemanticError(cst, msg);
  6543. }
  6544. const pair = item.items[0] || new resolveSeq.Pair();
  6545. if (item.commentBefore)
  6546. pair.commentBefore = pair.commentBefore ? `${item.commentBefore}
  6547. ${pair.commentBefore}` : item.commentBefore;
  6548. if (item.comment)
  6549. pair.comment = pair.comment ? `${item.comment}
  6550. ${pair.comment}` : item.comment;
  6551. item = pair;
  6552. }
  6553. seq.items[i] = item instanceof resolveSeq.Pair ? item : new resolveSeq.Pair(item);
  6554. }
  6555. return seq;
  6556. }
  6557. function createPairs(schema, iterable, ctx) {
  6558. const pairs2 = new resolveSeq.YAMLSeq(schema);
  6559. pairs2.tag = "tag:yaml.org,2002:pairs";
  6560. for (const it of iterable) {
  6561. let key, value;
  6562. if (Array.isArray(it)) {
  6563. if (it.length === 2) {
  6564. key = it[0];
  6565. value = it[1];
  6566. } else
  6567. throw new TypeError(`Expected [key, value] tuple: ${it}`);
  6568. } else if (it && it instanceof Object) {
  6569. const keys = Object.keys(it);
  6570. if (keys.length === 1) {
  6571. key = keys[0];
  6572. value = it[key];
  6573. } else
  6574. throw new TypeError(`Expected { key: value } tuple: ${it}`);
  6575. } else {
  6576. key = it;
  6577. }
  6578. const pair = schema.createPair(key, value, ctx);
  6579. pairs2.items.push(pair);
  6580. }
  6581. return pairs2;
  6582. }
  6583. var pairs = {
  6584. default: false,
  6585. tag: "tag:yaml.org,2002:pairs",
  6586. resolve: parsePairs,
  6587. createNode: createPairs
  6588. };
  6589. var YAMLOMap = class extends resolveSeq.YAMLSeq {
  6590. constructor() {
  6591. super();
  6592. PlainValue._defineProperty(this, "add", resolveSeq.YAMLMap.prototype.add.bind(this));
  6593. PlainValue._defineProperty(this, "delete", resolveSeq.YAMLMap.prototype.delete.bind(this));
  6594. PlainValue._defineProperty(this, "get", resolveSeq.YAMLMap.prototype.get.bind(this));
  6595. PlainValue._defineProperty(this, "has", resolveSeq.YAMLMap.prototype.has.bind(this));
  6596. PlainValue._defineProperty(this, "set", resolveSeq.YAMLMap.prototype.set.bind(this));
  6597. this.tag = YAMLOMap.tag;
  6598. }
  6599. toJSON(_, ctx) {
  6600. const map = /* @__PURE__ */ new Map();
  6601. if (ctx && ctx.onCreate)
  6602. ctx.onCreate(map);
  6603. for (const pair of this.items) {
  6604. let key, value;
  6605. if (pair instanceof resolveSeq.Pair) {
  6606. key = resolveSeq.toJSON(pair.key, "", ctx);
  6607. value = resolveSeq.toJSON(pair.value, key, ctx);
  6608. } else {
  6609. key = resolveSeq.toJSON(pair, "", ctx);
  6610. }
  6611. if (map.has(key))
  6612. throw new Error("Ordered maps must not include duplicate keys");
  6613. map.set(key, value);
  6614. }
  6615. return map;
  6616. }
  6617. };
  6618. PlainValue._defineProperty(YAMLOMap, "tag", "tag:yaml.org,2002:omap");
  6619. function parseOMap(doc, cst) {
  6620. const pairs2 = parsePairs(doc, cst);
  6621. const seenKeys = [];
  6622. for (const {
  6623. key
  6624. } of pairs2.items) {
  6625. if (key instanceof resolveSeq.Scalar) {
  6626. if (seenKeys.includes(key.value)) {
  6627. const msg = "Ordered maps must not include duplicate keys";
  6628. throw new PlainValue.YAMLSemanticError(cst, msg);
  6629. } else {
  6630. seenKeys.push(key.value);
  6631. }
  6632. }
  6633. }
  6634. return Object.assign(new YAMLOMap(), pairs2);
  6635. }
  6636. function createOMap(schema, iterable, ctx) {
  6637. const pairs2 = createPairs(schema, iterable, ctx);
  6638. const omap2 = new YAMLOMap();
  6639. omap2.items = pairs2.items;
  6640. return omap2;
  6641. }
  6642. var omap = {
  6643. identify: (value) => value instanceof Map,
  6644. nodeClass: YAMLOMap,
  6645. default: false,
  6646. tag: "tag:yaml.org,2002:omap",
  6647. resolve: parseOMap,
  6648. createNode: createOMap
  6649. };
  6650. var YAMLSet = class extends resolveSeq.YAMLMap {
  6651. constructor() {
  6652. super();
  6653. this.tag = YAMLSet.tag;
  6654. }
  6655. add(key) {
  6656. const pair = key instanceof resolveSeq.Pair ? key : new resolveSeq.Pair(key);
  6657. const prev = resolveSeq.findPair(this.items, pair.key);
  6658. if (!prev)
  6659. this.items.push(pair);
  6660. }
  6661. get(key, keepPair) {
  6662. const pair = resolveSeq.findPair(this.items, key);
  6663. return !keepPair && pair instanceof resolveSeq.Pair ? pair.key instanceof resolveSeq.Scalar ? pair.key.value : pair.key : pair;
  6664. }
  6665. set(key, value) {
  6666. if (typeof value !== "boolean")
  6667. throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);
  6668. const prev = resolveSeq.findPair(this.items, key);
  6669. if (prev && !value) {
  6670. this.items.splice(this.items.indexOf(prev), 1);
  6671. } else if (!prev && value) {
  6672. this.items.push(new resolveSeq.Pair(key));
  6673. }
  6674. }
  6675. toJSON(_, ctx) {
  6676. return super.toJSON(_, ctx, Set);
  6677. }
  6678. toString(ctx, onComment, onChompKeep) {
  6679. if (!ctx)
  6680. return JSON.stringify(this);
  6681. if (this.hasAllNullValues())
  6682. return super.toString(ctx, onComment, onChompKeep);
  6683. else
  6684. throw new Error("Set items must all have null values");
  6685. }
  6686. };
  6687. PlainValue._defineProperty(YAMLSet, "tag", "tag:yaml.org,2002:set");
  6688. function parseSet(doc, cst) {
  6689. const map = resolveSeq.resolveMap(doc, cst);
  6690. if (!map.hasAllNullValues())
  6691. throw new PlainValue.YAMLSemanticError(cst, "Set items must all have null values");
  6692. return Object.assign(new YAMLSet(), map);
  6693. }
  6694. function createSet(schema, iterable, ctx) {
  6695. const set2 = new YAMLSet();
  6696. for (const value of iterable)
  6697. set2.items.push(schema.createPair(value, null, ctx));
  6698. return set2;
  6699. }
  6700. var set = {
  6701. identify: (value) => value instanceof Set,
  6702. nodeClass: YAMLSet,
  6703. default: false,
  6704. tag: "tag:yaml.org,2002:set",
  6705. resolve: parseSet,
  6706. createNode: createSet
  6707. };
  6708. var parseSexagesimal = (sign, parts) => {
  6709. const n = parts.split(":").reduce((n2, p) => n2 * 60 + Number(p), 0);
  6710. return sign === "-" ? -n : n;
  6711. };
  6712. var stringifySexagesimal = ({
  6713. value
  6714. }) => {
  6715. if (isNaN(value) || !isFinite(value))
  6716. return resolveSeq.stringifyNumber(value);
  6717. let sign = "";
  6718. if (value < 0) {
  6719. sign = "-";
  6720. value = Math.abs(value);
  6721. }
  6722. const parts = [value % 60];
  6723. if (value < 60) {
  6724. parts.unshift(0);
  6725. } else {
  6726. value = Math.round((value - parts[0]) / 60);
  6727. parts.unshift(value % 60);
  6728. if (value >= 60) {
  6729. value = Math.round((value - parts[0]) / 60);
  6730. parts.unshift(value);
  6731. }
  6732. }
  6733. return sign + parts.map((n) => n < 10 ? "0" + String(n) : String(n)).join(":").replace(/000000\d*$/, "");
  6734. };
  6735. var intTime = {
  6736. identify: (value) => typeof value === "number",
  6737. default: true,
  6738. tag: "tag:yaml.org,2002:int",
  6739. format: "TIME",
  6740. test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+)$/,
  6741. resolve: (str, sign, parts) => parseSexagesimal(sign, parts.replace(/_/g, "")),
  6742. stringify: stringifySexagesimal
  6743. };
  6744. var floatTime = {
  6745. identify: (value) => typeof value === "number",
  6746. default: true,
  6747. tag: "tag:yaml.org,2002:float",
  6748. format: "TIME",
  6749. test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*)$/,
  6750. resolve: (str, sign, parts) => parseSexagesimal(sign, parts.replace(/_/g, "")),
  6751. stringify: stringifySexagesimal
  6752. };
  6753. var timestamp = {
  6754. identify: (value) => value instanceof Date,
  6755. default: true,
  6756. tag: "tag:yaml.org,2002:timestamp",
  6757. test: RegExp("^(?:([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?)$"),
  6758. resolve: (str, year, month, day, hour, minute, second, millisec, tz) => {
  6759. if (millisec)
  6760. millisec = (millisec + "00").substr(1, 3);
  6761. let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec || 0);
  6762. if (tz && tz !== "Z") {
  6763. let d = parseSexagesimal(tz[0], tz.slice(1));
  6764. if (Math.abs(d) < 30)
  6765. d *= 60;
  6766. date -= 6e4 * d;
  6767. }
  6768. return new Date(date);
  6769. },
  6770. stringify: ({
  6771. value
  6772. }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, "")
  6773. };
  6774. function shouldWarn(deprecation) {
  6775. const env = typeof process !== "undefined" && process.env || {};
  6776. if (deprecation) {
  6777. if (typeof YAML_SILENCE_DEPRECATION_WARNINGS !== "undefined")
  6778. return !YAML_SILENCE_DEPRECATION_WARNINGS;
  6779. return !env.YAML_SILENCE_DEPRECATION_WARNINGS;
  6780. }
  6781. if (typeof YAML_SILENCE_WARNINGS !== "undefined")
  6782. return !YAML_SILENCE_WARNINGS;
  6783. return !env.YAML_SILENCE_WARNINGS;
  6784. }
  6785. function warn(warning, type) {
  6786. if (shouldWarn(false)) {
  6787. const emit = typeof process !== "undefined" && process.emitWarning;
  6788. if (emit)
  6789. emit(warning, type);
  6790. else {
  6791. console.warn(type ? `${type}: ${warning}` : warning);
  6792. }
  6793. }
  6794. }
  6795. function warnFileDeprecation(filename) {
  6796. if (shouldWarn(true)) {
  6797. const path = filename.replace(/.*yaml[/\\]/i, "").replace(/\.js$/, "").replace(/\\/g, "/");
  6798. warn(`The endpoint 'yaml/${path}' will be removed in a future release.`, "DeprecationWarning");
  6799. }
  6800. }
  6801. var warned = {};
  6802. function warnOptionDeprecation(name, alternative) {
  6803. if (!warned[name] && shouldWarn(true)) {
  6804. warned[name] = true;
  6805. let msg = `The option '${name}' will be removed in a future release`;
  6806. msg += alternative ? `, use '${alternative}' instead.` : ".";
  6807. warn(msg, "DeprecationWarning");
  6808. }
  6809. }
  6810. exports2.binary = binary;
  6811. exports2.floatTime = floatTime;
  6812. exports2.intTime = intTime;
  6813. exports2.omap = omap;
  6814. exports2.pairs = pairs;
  6815. exports2.set = set;
  6816. exports2.timestamp = timestamp;
  6817. exports2.warn = warn;
  6818. exports2.warnFileDeprecation = warnFileDeprecation;
  6819. exports2.warnOptionDeprecation = warnOptionDeprecation;
  6820. }
  6821. });
  6822. var require_Schema_88e323a7 = __commonJS({
  6823. "node_modules/yaml/dist/Schema-88e323a7.js"(exports2) {
  6824. "use strict";
  6825. var PlainValue = require_PlainValue_ec8e588e();
  6826. var resolveSeq = require_resolveSeq_d03cb037();
  6827. var warnings = require_warnings_1000a372();
  6828. function createMap(schema, obj, ctx) {
  6829. const map2 = new resolveSeq.YAMLMap(schema);
  6830. if (obj instanceof Map) {
  6831. for (const [key, value] of obj)
  6832. map2.items.push(schema.createPair(key, value, ctx));
  6833. } else if (obj && typeof obj === "object") {
  6834. for (const key of Object.keys(obj))
  6835. map2.items.push(schema.createPair(key, obj[key], ctx));
  6836. }
  6837. if (typeof schema.sortMapEntries === "function") {
  6838. map2.items.sort(schema.sortMapEntries);
  6839. }
  6840. return map2;
  6841. }
  6842. var map = {
  6843. createNode: createMap,
  6844. default: true,
  6845. nodeClass: resolveSeq.YAMLMap,
  6846. tag: "tag:yaml.org,2002:map",
  6847. resolve: resolveSeq.resolveMap
  6848. };
  6849. function createSeq(schema, obj, ctx) {
  6850. const seq2 = new resolveSeq.YAMLSeq(schema);
  6851. if (obj && obj[Symbol.iterator]) {
  6852. for (const it of obj) {
  6853. const v = schema.createNode(it, ctx.wrapScalars, null, ctx);
  6854. seq2.items.push(v);
  6855. }
  6856. }
  6857. return seq2;
  6858. }
  6859. var seq = {
  6860. createNode: createSeq,
  6861. default: true,
  6862. nodeClass: resolveSeq.YAMLSeq,
  6863. tag: "tag:yaml.org,2002:seq",
  6864. resolve: resolveSeq.resolveSeq
  6865. };
  6866. var string = {
  6867. identify: (value) => typeof value === "string",
  6868. default: true,
  6869. tag: "tag:yaml.org,2002:str",
  6870. resolve: resolveSeq.resolveString,
  6871. stringify(item, ctx, onComment, onChompKeep) {
  6872. ctx = Object.assign({
  6873. actualString: true
  6874. }, ctx);
  6875. return resolveSeq.stringifyString(item, ctx, onComment, onChompKeep);
  6876. },
  6877. options: resolveSeq.strOptions
  6878. };
  6879. var failsafe = [map, seq, string];
  6880. var intIdentify$2 = (value) => typeof value === "bigint" || Number.isInteger(value);
  6881. var intResolve$1 = (src, part, radix) => resolveSeq.intOptions.asBigInt ? BigInt(src) : parseInt(part, radix);
  6882. function intStringify$1(node, radix, prefix) {
  6883. const {
  6884. value
  6885. } = node;
  6886. if (intIdentify$2(value) && value >= 0)
  6887. return prefix + value.toString(radix);
  6888. return resolveSeq.stringifyNumber(node);
  6889. }
  6890. var nullObj = {
  6891. identify: (value) => value == null,
  6892. createNode: (schema, value, ctx) => ctx.wrapScalars ? new resolveSeq.Scalar(null) : null,
  6893. default: true,
  6894. tag: "tag:yaml.org,2002:null",
  6895. test: /^(?:~|[Nn]ull|NULL)?$/,
  6896. resolve: () => null,
  6897. options: resolveSeq.nullOptions,
  6898. stringify: () => resolveSeq.nullOptions.nullStr
  6899. };
  6900. var boolObj = {
  6901. identify: (value) => typeof value === "boolean",
  6902. default: true,
  6903. tag: "tag:yaml.org,2002:bool",
  6904. test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
  6905. resolve: (str) => str[0] === "t" || str[0] === "T",
  6906. options: resolveSeq.boolOptions,
  6907. stringify: ({
  6908. value
  6909. }) => value ? resolveSeq.boolOptions.trueStr : resolveSeq.boolOptions.falseStr
  6910. };
  6911. var octObj = {
  6912. identify: (value) => intIdentify$2(value) && value >= 0,
  6913. default: true,
  6914. tag: "tag:yaml.org,2002:int",
  6915. format: "OCT",
  6916. test: /^0o([0-7]+)$/,
  6917. resolve: (str, oct) => intResolve$1(str, oct, 8),
  6918. options: resolveSeq.intOptions,
  6919. stringify: (node) => intStringify$1(node, 8, "0o")
  6920. };
  6921. var intObj = {
  6922. identify: intIdentify$2,
  6923. default: true,
  6924. tag: "tag:yaml.org,2002:int",
  6925. test: /^[-+]?[0-9]+$/,
  6926. resolve: (str) => intResolve$1(str, str, 10),
  6927. options: resolveSeq.intOptions,
  6928. stringify: resolveSeq.stringifyNumber
  6929. };
  6930. var hexObj = {
  6931. identify: (value) => intIdentify$2(value) && value >= 0,
  6932. default: true,
  6933. tag: "tag:yaml.org,2002:int",
  6934. format: "HEX",
  6935. test: /^0x([0-9a-fA-F]+)$/,
  6936. resolve: (str, hex) => intResolve$1(str, hex, 16),
  6937. options: resolveSeq.intOptions,
  6938. stringify: (node) => intStringify$1(node, 16, "0x")
  6939. };
  6940. var nanObj = {
  6941. identify: (value) => typeof value === "number",
  6942. default: true,
  6943. tag: "tag:yaml.org,2002:float",
  6944. test: /^(?:[-+]?\.inf|(\.nan))$/i,
  6945. resolve: (str, nan) => nan ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
  6946. stringify: resolveSeq.stringifyNumber
  6947. };
  6948. var expObj = {
  6949. identify: (value) => typeof value === "number",
  6950. default: true,
  6951. tag: "tag:yaml.org,2002:float",
  6952. format: "EXP",
  6953. test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
  6954. resolve: (str) => parseFloat(str),
  6955. stringify: ({
  6956. value
  6957. }) => Number(value).toExponential()
  6958. };
  6959. var floatObj = {
  6960. identify: (value) => typeof value === "number",
  6961. default: true,
  6962. tag: "tag:yaml.org,2002:float",
  6963. test: /^[-+]?(?:\.([0-9]+)|[0-9]+\.([0-9]*))$/,
  6964. resolve(str, frac1, frac2) {
  6965. const frac = frac1 || frac2;
  6966. const node = new resolveSeq.Scalar(parseFloat(str));
  6967. if (frac && frac[frac.length - 1] === "0")
  6968. node.minFractionDigits = frac.length;
  6969. return node;
  6970. },
  6971. stringify: resolveSeq.stringifyNumber
  6972. };
  6973. var core = failsafe.concat([nullObj, boolObj, octObj, intObj, hexObj, nanObj, expObj, floatObj]);
  6974. var intIdentify$1 = (value) => typeof value === "bigint" || Number.isInteger(value);
  6975. var stringifyJSON = ({
  6976. value
  6977. }) => JSON.stringify(value);
  6978. var json = [map, seq, {
  6979. identify: (value) => typeof value === "string",
  6980. default: true,
  6981. tag: "tag:yaml.org,2002:str",
  6982. resolve: resolveSeq.resolveString,
  6983. stringify: stringifyJSON
  6984. }, {
  6985. identify: (value) => value == null,
  6986. createNode: (schema, value, ctx) => ctx.wrapScalars ? new resolveSeq.Scalar(null) : null,
  6987. default: true,
  6988. tag: "tag:yaml.org,2002:null",
  6989. test: /^null$/,
  6990. resolve: () => null,
  6991. stringify: stringifyJSON
  6992. }, {
  6993. identify: (value) => typeof value === "boolean",
  6994. default: true,
  6995. tag: "tag:yaml.org,2002:bool",
  6996. test: /^true|false$/,
  6997. resolve: (str) => str === "true",
  6998. stringify: stringifyJSON
  6999. }, {
  7000. identify: intIdentify$1,
  7001. default: true,
  7002. tag: "tag:yaml.org,2002:int",
  7003. test: /^-?(?:0|[1-9][0-9]*)$/,
  7004. resolve: (str) => resolveSeq.intOptions.asBigInt ? BigInt(str) : parseInt(str, 10),
  7005. stringify: ({
  7006. value
  7007. }) => intIdentify$1(value) ? value.toString() : JSON.stringify(value)
  7008. }, {
  7009. identify: (value) => typeof value === "number",
  7010. default: true,
  7011. tag: "tag:yaml.org,2002:float",
  7012. test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
  7013. resolve: (str) => parseFloat(str),
  7014. stringify: stringifyJSON
  7015. }];
  7016. json.scalarFallback = (str) => {
  7017. throw new SyntaxError(`Unresolved plain scalar ${JSON.stringify(str)}`);
  7018. };
  7019. var boolStringify = ({
  7020. value
  7021. }) => value ? resolveSeq.boolOptions.trueStr : resolveSeq.boolOptions.falseStr;
  7022. var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
  7023. function intResolve(sign, src, radix) {
  7024. let str = src.replace(/_/g, "");
  7025. if (resolveSeq.intOptions.asBigInt) {
  7026. switch (radix) {
  7027. case 2:
  7028. str = `0b${str}`;
  7029. break;
  7030. case 8:
  7031. str = `0o${str}`;
  7032. break;
  7033. case 16:
  7034. str = `0x${str}`;
  7035. break;
  7036. }
  7037. const n2 = BigInt(str);
  7038. return sign === "-" ? BigInt(-1) * n2 : n2;
  7039. }
  7040. const n = parseInt(str, radix);
  7041. return sign === "-" ? -1 * n : n;
  7042. }
  7043. function intStringify(node, radix, prefix) {
  7044. const {
  7045. value
  7046. } = node;
  7047. if (intIdentify(value)) {
  7048. const str = value.toString(radix);
  7049. return value < 0 ? "-" + prefix + str.substr(1) : prefix + str;
  7050. }
  7051. return resolveSeq.stringifyNumber(node);
  7052. }
  7053. var yaml11 = failsafe.concat([{
  7054. identify: (value) => value == null,
  7055. createNode: (schema, value, ctx) => ctx.wrapScalars ? new resolveSeq.Scalar(null) : null,
  7056. default: true,
  7057. tag: "tag:yaml.org,2002:null",
  7058. test: /^(?:~|[Nn]ull|NULL)?$/,
  7059. resolve: () => null,
  7060. options: resolveSeq.nullOptions,
  7061. stringify: () => resolveSeq.nullOptions.nullStr
  7062. }, {
  7063. identify: (value) => typeof value === "boolean",
  7064. default: true,
  7065. tag: "tag:yaml.org,2002:bool",
  7066. test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
  7067. resolve: () => true,
  7068. options: resolveSeq.boolOptions,
  7069. stringify: boolStringify
  7070. }, {
  7071. identify: (value) => typeof value === "boolean",
  7072. default: true,
  7073. tag: "tag:yaml.org,2002:bool",
  7074. test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,
  7075. resolve: () => false,
  7076. options: resolveSeq.boolOptions,
  7077. stringify: boolStringify
  7078. }, {
  7079. identify: intIdentify,
  7080. default: true,
  7081. tag: "tag:yaml.org,2002:int",
  7082. format: "BIN",
  7083. test: /^([-+]?)0b([0-1_]+)$/,
  7084. resolve: (str, sign, bin) => intResolve(sign, bin, 2),
  7085. stringify: (node) => intStringify(node, 2, "0b")
  7086. }, {
  7087. identify: intIdentify,
  7088. default: true,
  7089. tag: "tag:yaml.org,2002:int",
  7090. format: "OCT",
  7091. test: /^([-+]?)0([0-7_]+)$/,
  7092. resolve: (str, sign, oct) => intResolve(sign, oct, 8),
  7093. stringify: (node) => intStringify(node, 8, "0")
  7094. }, {
  7095. identify: intIdentify,
  7096. default: true,
  7097. tag: "tag:yaml.org,2002:int",
  7098. test: /^([-+]?)([0-9][0-9_]*)$/,
  7099. resolve: (str, sign, abs) => intResolve(sign, abs, 10),
  7100. stringify: resolveSeq.stringifyNumber
  7101. }, {
  7102. identify: intIdentify,
  7103. default: true,
  7104. tag: "tag:yaml.org,2002:int",
  7105. format: "HEX",
  7106. test: /^([-+]?)0x([0-9a-fA-F_]+)$/,
  7107. resolve: (str, sign, hex) => intResolve(sign, hex, 16),
  7108. stringify: (node) => intStringify(node, 16, "0x")
  7109. }, {
  7110. identify: (value) => typeof value === "number",
  7111. default: true,
  7112. tag: "tag:yaml.org,2002:float",
  7113. test: /^(?:[-+]?\.inf|(\.nan))$/i,
  7114. resolve: (str, nan) => nan ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
  7115. stringify: resolveSeq.stringifyNumber
  7116. }, {
  7117. identify: (value) => typeof value === "number",
  7118. default: true,
  7119. tag: "tag:yaml.org,2002:float",
  7120. format: "EXP",
  7121. test: /^[-+]?([0-9][0-9_]*)?(\.[0-9_]*)?[eE][-+]?[0-9]+$/,
  7122. resolve: (str) => parseFloat(str.replace(/_/g, "")),
  7123. stringify: ({
  7124. value
  7125. }) => Number(value).toExponential()
  7126. }, {
  7127. identify: (value) => typeof value === "number",
  7128. default: true,
  7129. tag: "tag:yaml.org,2002:float",
  7130. test: /^[-+]?(?:[0-9][0-9_]*)?\.([0-9_]*)$/,
  7131. resolve(str, frac) {
  7132. const node = new resolveSeq.Scalar(parseFloat(str.replace(/_/g, "")));
  7133. if (frac) {
  7134. const f = frac.replace(/_/g, "");
  7135. if (f[f.length - 1] === "0")
  7136. node.minFractionDigits = f.length;
  7137. }
  7138. return node;
  7139. },
  7140. stringify: resolveSeq.stringifyNumber
  7141. }], warnings.binary, warnings.omap, warnings.pairs, warnings.set, warnings.intTime, warnings.floatTime, warnings.timestamp);
  7142. var schemas = {
  7143. core,
  7144. failsafe,
  7145. json,
  7146. yaml11
  7147. };
  7148. var tags = {
  7149. binary: warnings.binary,
  7150. bool: boolObj,
  7151. float: floatObj,
  7152. floatExp: expObj,
  7153. floatNaN: nanObj,
  7154. floatTime: warnings.floatTime,
  7155. int: intObj,
  7156. intHex: hexObj,
  7157. intOct: octObj,
  7158. intTime: warnings.intTime,
  7159. map,
  7160. null: nullObj,
  7161. omap: warnings.omap,
  7162. pairs: warnings.pairs,
  7163. seq,
  7164. set: warnings.set,
  7165. timestamp: warnings.timestamp
  7166. };
  7167. function findTagObject(value, tagName, tags2) {
  7168. if (tagName) {
  7169. const match = tags2.filter((t) => t.tag === tagName);
  7170. const tagObj = match.find((t) => !t.format) || match[0];
  7171. if (!tagObj)
  7172. throw new Error(`Tag ${tagName} not found`);
  7173. return tagObj;
  7174. }
  7175. return tags2.find((t) => (t.identify && t.identify(value) || t.class && value instanceof t.class) && !t.format);
  7176. }
  7177. function createNode(value, tagName, ctx) {
  7178. if (value instanceof resolveSeq.Node)
  7179. return value;
  7180. const {
  7181. defaultPrefix,
  7182. onTagObj,
  7183. prevObjects,
  7184. schema,
  7185. wrapScalars
  7186. } = ctx;
  7187. if (tagName && tagName.startsWith("!!"))
  7188. tagName = defaultPrefix + tagName.slice(2);
  7189. let tagObj = findTagObject(value, tagName, schema.tags);
  7190. if (!tagObj) {
  7191. if (typeof value.toJSON === "function")
  7192. value = value.toJSON();
  7193. if (!value || typeof value !== "object")
  7194. return wrapScalars ? new resolveSeq.Scalar(value) : value;
  7195. tagObj = value instanceof Map ? map : value[Symbol.iterator] ? seq : map;
  7196. }
  7197. if (onTagObj) {
  7198. onTagObj(tagObj);
  7199. delete ctx.onTagObj;
  7200. }
  7201. const obj = {
  7202. value: void 0,
  7203. node: void 0
  7204. };
  7205. if (value && typeof value === "object" && prevObjects) {
  7206. const prev = prevObjects.get(value);
  7207. if (prev) {
  7208. const alias = new resolveSeq.Alias(prev);
  7209. ctx.aliasNodes.push(alias);
  7210. return alias;
  7211. }
  7212. obj.value = value;
  7213. prevObjects.set(value, obj);
  7214. }
  7215. obj.node = tagObj.createNode ? tagObj.createNode(ctx.schema, value, ctx) : wrapScalars ? new resolveSeq.Scalar(value) : value;
  7216. if (tagName && obj.node instanceof resolveSeq.Node)
  7217. obj.node.tag = tagName;
  7218. return obj.node;
  7219. }
  7220. function getSchemaTags(schemas2, knownTags, customTags, schemaId) {
  7221. let tags2 = schemas2[schemaId.replace(/\W/g, "")];
  7222. if (!tags2) {
  7223. const keys = Object.keys(schemas2).map((key) => JSON.stringify(key)).join(", ");
  7224. throw new Error(`Unknown schema "${schemaId}"; use one of ${keys}`);
  7225. }
  7226. if (Array.isArray(customTags)) {
  7227. for (const tag of customTags)
  7228. tags2 = tags2.concat(tag);
  7229. } else if (typeof customTags === "function") {
  7230. tags2 = customTags(tags2.slice());
  7231. }
  7232. for (let i = 0; i < tags2.length; ++i) {
  7233. const tag = tags2[i];
  7234. if (typeof tag === "string") {
  7235. const tagObj = knownTags[tag];
  7236. if (!tagObj) {
  7237. const keys = Object.keys(knownTags).map((key) => JSON.stringify(key)).join(", ");
  7238. throw new Error(`Unknown custom tag "${tag}"; use one of ${keys}`);
  7239. }
  7240. tags2[i] = tagObj;
  7241. }
  7242. }
  7243. return tags2;
  7244. }
  7245. var sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
  7246. var Schema = class {
  7247. constructor({
  7248. customTags,
  7249. merge,
  7250. schema,
  7251. sortMapEntries,
  7252. tags: deprecatedCustomTags
  7253. }) {
  7254. this.merge = !!merge;
  7255. this.name = schema;
  7256. this.sortMapEntries = sortMapEntries === true ? sortMapEntriesByKey : sortMapEntries || null;
  7257. if (!customTags && deprecatedCustomTags)
  7258. warnings.warnOptionDeprecation("tags", "customTags");
  7259. this.tags = getSchemaTags(schemas, tags, customTags || deprecatedCustomTags, schema);
  7260. }
  7261. createNode(value, wrapScalars, tagName, ctx) {
  7262. const baseCtx = {
  7263. defaultPrefix: Schema.defaultPrefix,
  7264. schema: this,
  7265. wrapScalars
  7266. };
  7267. const createCtx = ctx ? Object.assign(ctx, baseCtx) : baseCtx;
  7268. return createNode(value, tagName, createCtx);
  7269. }
  7270. createPair(key, value, ctx) {
  7271. if (!ctx)
  7272. ctx = {
  7273. wrapScalars: true
  7274. };
  7275. const k = this.createNode(key, ctx.wrapScalars, null, ctx);
  7276. const v = this.createNode(value, ctx.wrapScalars, null, ctx);
  7277. return new resolveSeq.Pair(k, v);
  7278. }
  7279. };
  7280. PlainValue._defineProperty(Schema, "defaultPrefix", PlainValue.defaultTagPrefix);
  7281. PlainValue._defineProperty(Schema, "defaultTags", PlainValue.defaultTags);
  7282. exports2.Schema = Schema;
  7283. }
  7284. });
  7285. var require_Document_9b4560a1 = __commonJS({
  7286. "node_modules/yaml/dist/Document-9b4560a1.js"(exports2) {
  7287. "use strict";
  7288. var PlainValue = require_PlainValue_ec8e588e();
  7289. var resolveSeq = require_resolveSeq_d03cb037();
  7290. var Schema = require_Schema_88e323a7();
  7291. var defaultOptions = {
  7292. anchorPrefix: "a",
  7293. customTags: null,
  7294. indent: 2,
  7295. indentSeq: true,
  7296. keepCstNodes: false,
  7297. keepNodeTypes: true,
  7298. keepBlobsInJSON: true,
  7299. mapAsMap: false,
  7300. maxAliasCount: 100,
  7301. prettyErrors: false,
  7302. simpleKeys: false,
  7303. version: "1.2"
  7304. };
  7305. var scalarOptions = {
  7306. get binary() {
  7307. return resolveSeq.binaryOptions;
  7308. },
  7309. set binary(opt) {
  7310. Object.assign(resolveSeq.binaryOptions, opt);
  7311. },
  7312. get bool() {
  7313. return resolveSeq.boolOptions;
  7314. },
  7315. set bool(opt) {
  7316. Object.assign(resolveSeq.boolOptions, opt);
  7317. },
  7318. get int() {
  7319. return resolveSeq.intOptions;
  7320. },
  7321. set int(opt) {
  7322. Object.assign(resolveSeq.intOptions, opt);
  7323. },
  7324. get null() {
  7325. return resolveSeq.nullOptions;
  7326. },
  7327. set null(opt) {
  7328. Object.assign(resolveSeq.nullOptions, opt);
  7329. },
  7330. get str() {
  7331. return resolveSeq.strOptions;
  7332. },
  7333. set str(opt) {
  7334. Object.assign(resolveSeq.strOptions, opt);
  7335. }
  7336. };
  7337. var documentOptions = {
  7338. "1.0": {
  7339. schema: "yaml-1.1",
  7340. merge: true,
  7341. tagPrefixes: [{
  7342. handle: "!",
  7343. prefix: PlainValue.defaultTagPrefix
  7344. }, {
  7345. handle: "!!",
  7346. prefix: "tag:private.yaml.org,2002:"
  7347. }]
  7348. },
  7349. 1.1: {
  7350. schema: "yaml-1.1",
  7351. merge: true,
  7352. tagPrefixes: [{
  7353. handle: "!",
  7354. prefix: "!"
  7355. }, {
  7356. handle: "!!",
  7357. prefix: PlainValue.defaultTagPrefix
  7358. }]
  7359. },
  7360. 1.2: {
  7361. schema: "core",
  7362. merge: false,
  7363. tagPrefixes: [{
  7364. handle: "!",
  7365. prefix: "!"
  7366. }, {
  7367. handle: "!!",
  7368. prefix: PlainValue.defaultTagPrefix
  7369. }]
  7370. }
  7371. };
  7372. function stringifyTag(doc, tag) {
  7373. if ((doc.version || doc.options.version) === "1.0") {
  7374. const priv = tag.match(/^tag:private\.yaml\.org,2002:([^:/]+)$/);
  7375. if (priv)
  7376. return "!" + priv[1];
  7377. const vocab = tag.match(/^tag:([a-zA-Z0-9-]+)\.yaml\.org,2002:(.*)/);
  7378. return vocab ? `!${vocab[1]}/${vocab[2]}` : `!${tag.replace(/^tag:/, "")}`;
  7379. }
  7380. let p = doc.tagPrefixes.find((p2) => tag.indexOf(p2.prefix) === 0);
  7381. if (!p) {
  7382. const dtp = doc.getDefaults().tagPrefixes;
  7383. p = dtp && dtp.find((p2) => tag.indexOf(p2.prefix) === 0);
  7384. }
  7385. if (!p)
  7386. return tag[0] === "!" ? tag : `!<${tag}>`;
  7387. const suffix = tag.substr(p.prefix.length).replace(/[!,[\]{}]/g, (ch) => ({
  7388. "!": "%21",
  7389. ",": "%2C",
  7390. "[": "%5B",
  7391. "]": "%5D",
  7392. "{": "%7B",
  7393. "}": "%7D"
  7394. })[ch]);
  7395. return p.handle + suffix;
  7396. }
  7397. function getTagObject(tags, item) {
  7398. if (item instanceof resolveSeq.Alias)
  7399. return resolveSeq.Alias;
  7400. if (item.tag) {
  7401. const match = tags.filter((t) => t.tag === item.tag);
  7402. if (match.length > 0)
  7403. return match.find((t) => t.format === item.format) || match[0];
  7404. }
  7405. let tagObj, obj;
  7406. if (item instanceof resolveSeq.Scalar) {
  7407. obj = item.value;
  7408. const match = tags.filter((t) => t.identify && t.identify(obj) || t.class && obj instanceof t.class);
  7409. tagObj = match.find((t) => t.format === item.format) || match.find((t) => !t.format);
  7410. } else {
  7411. obj = item;
  7412. tagObj = tags.find((t) => t.nodeClass && obj instanceof t.nodeClass);
  7413. }
  7414. if (!tagObj) {
  7415. const name = obj && obj.constructor ? obj.constructor.name : typeof obj;
  7416. throw new Error(`Tag not resolved for ${name} value`);
  7417. }
  7418. return tagObj;
  7419. }
  7420. function stringifyProps(node, tagObj, {
  7421. anchors,
  7422. doc
  7423. }) {
  7424. const props = [];
  7425. const anchor = doc.anchors.getName(node);
  7426. if (anchor) {
  7427. anchors[anchor] = node;
  7428. props.push(`&${anchor}`);
  7429. }
  7430. if (node.tag) {
  7431. props.push(stringifyTag(doc, node.tag));
  7432. } else if (!tagObj.default) {
  7433. props.push(stringifyTag(doc, tagObj.tag));
  7434. }
  7435. return props.join(" ");
  7436. }
  7437. function stringify(item, ctx, onComment, onChompKeep) {
  7438. const {
  7439. anchors,
  7440. schema
  7441. } = ctx.doc;
  7442. let tagObj;
  7443. if (!(item instanceof resolveSeq.Node)) {
  7444. const createCtx = {
  7445. aliasNodes: [],
  7446. onTagObj: (o) => tagObj = o,
  7447. prevObjects: /* @__PURE__ */ new Map()
  7448. };
  7449. item = schema.createNode(item, true, null, createCtx);
  7450. for (const alias of createCtx.aliasNodes) {
  7451. alias.source = alias.source.node;
  7452. let name = anchors.getName(alias.source);
  7453. if (!name) {
  7454. name = anchors.newName();
  7455. anchors.map[name] = alias.source;
  7456. }
  7457. }
  7458. }
  7459. if (item instanceof resolveSeq.Pair)
  7460. return item.toString(ctx, onComment, onChompKeep);
  7461. if (!tagObj)
  7462. tagObj = getTagObject(schema.tags, item);
  7463. const props = stringifyProps(item, tagObj, ctx);
  7464. if (props.length > 0)
  7465. ctx.indentAtStart = (ctx.indentAtStart || 0) + props.length + 1;
  7466. const str = typeof tagObj.stringify === "function" ? tagObj.stringify(item, ctx, onComment, onChompKeep) : item instanceof resolveSeq.Scalar ? resolveSeq.stringifyString(item, ctx, onComment, onChompKeep) : item.toString(ctx, onComment, onChompKeep);
  7467. if (!props)
  7468. return str;
  7469. return item instanceof resolveSeq.Scalar || str[0] === "{" || str[0] === "[" ? `${props} ${str}` : `${props}
  7470. ${ctx.indent}${str}`;
  7471. }
  7472. var Anchors = class {
  7473. static validAnchorNode(node) {
  7474. return node instanceof resolveSeq.Scalar || node instanceof resolveSeq.YAMLSeq || node instanceof resolveSeq.YAMLMap;
  7475. }
  7476. constructor(prefix) {
  7477. PlainValue._defineProperty(this, "map", /* @__PURE__ */ Object.create(null));
  7478. this.prefix = prefix;
  7479. }
  7480. createAlias(node, name) {
  7481. this.setAnchor(node, name);
  7482. return new resolveSeq.Alias(node);
  7483. }
  7484. createMergePair(...sources) {
  7485. const merge = new resolveSeq.Merge();
  7486. merge.value.items = sources.map((s) => {
  7487. if (s instanceof resolveSeq.Alias) {
  7488. if (s.source instanceof resolveSeq.YAMLMap)
  7489. return s;
  7490. } else if (s instanceof resolveSeq.YAMLMap) {
  7491. return this.createAlias(s);
  7492. }
  7493. throw new Error("Merge sources must be Map nodes or their Aliases");
  7494. });
  7495. return merge;
  7496. }
  7497. getName(node) {
  7498. const {
  7499. map
  7500. } = this;
  7501. return Object.keys(map).find((a) => map[a] === node);
  7502. }
  7503. getNames() {
  7504. return Object.keys(this.map);
  7505. }
  7506. getNode(name) {
  7507. return this.map[name];
  7508. }
  7509. newName(prefix) {
  7510. if (!prefix)
  7511. prefix = this.prefix;
  7512. const names = Object.keys(this.map);
  7513. for (let i = 1; true; ++i) {
  7514. const name = `${prefix}${i}`;
  7515. if (!names.includes(name))
  7516. return name;
  7517. }
  7518. }
  7519. resolveNodes() {
  7520. const {
  7521. map,
  7522. _cstAliases
  7523. } = this;
  7524. Object.keys(map).forEach((a) => {
  7525. map[a] = map[a].resolved;
  7526. });
  7527. _cstAliases.forEach((a) => {
  7528. a.source = a.source.resolved;
  7529. });
  7530. delete this._cstAliases;
  7531. }
  7532. setAnchor(node, name) {
  7533. if (node != null && !Anchors.validAnchorNode(node)) {
  7534. throw new Error("Anchors may only be set for Scalar, Seq and Map nodes");
  7535. }
  7536. if (name && /[\x00-\x19\s,[\]{}]/.test(name)) {
  7537. throw new Error("Anchor names must not contain whitespace or control characters");
  7538. }
  7539. const {
  7540. map
  7541. } = this;
  7542. const prev = node && Object.keys(map).find((a) => map[a] === node);
  7543. if (prev) {
  7544. if (!name) {
  7545. return prev;
  7546. } else if (prev !== name) {
  7547. delete map[prev];
  7548. map[name] = node;
  7549. }
  7550. } else {
  7551. if (!name) {
  7552. if (!node)
  7553. return null;
  7554. name = this.newName();
  7555. }
  7556. map[name] = node;
  7557. }
  7558. return name;
  7559. }
  7560. };
  7561. var visit = (node, tags) => {
  7562. if (node && typeof node === "object") {
  7563. const {
  7564. tag
  7565. } = node;
  7566. if (node instanceof resolveSeq.Collection) {
  7567. if (tag)
  7568. tags[tag] = true;
  7569. node.items.forEach((n) => visit(n, tags));
  7570. } else if (node instanceof resolveSeq.Pair) {
  7571. visit(node.key, tags);
  7572. visit(node.value, tags);
  7573. } else if (node instanceof resolveSeq.Scalar) {
  7574. if (tag)
  7575. tags[tag] = true;
  7576. }
  7577. }
  7578. return tags;
  7579. };
  7580. var listTagNames = (node) => Object.keys(visit(node, {}));
  7581. function parseContents(doc, contents) {
  7582. const comments = {
  7583. before: [],
  7584. after: []
  7585. };
  7586. let body = void 0;
  7587. let spaceBefore = false;
  7588. for (const node of contents) {
  7589. if (node.valueRange) {
  7590. if (body !== void 0) {
  7591. const msg = "Document contains trailing content not separated by a ... or --- line";
  7592. doc.errors.push(new PlainValue.YAMLSyntaxError(node, msg));
  7593. break;
  7594. }
  7595. const res = resolveSeq.resolveNode(doc, node);
  7596. if (spaceBefore) {
  7597. res.spaceBefore = true;
  7598. spaceBefore = false;
  7599. }
  7600. body = res;
  7601. } else if (node.comment !== null) {
  7602. const cc = body === void 0 ? comments.before : comments.after;
  7603. cc.push(node.comment);
  7604. } else if (node.type === PlainValue.Type.BLANK_LINE) {
  7605. spaceBefore = true;
  7606. if (body === void 0 && comments.before.length > 0 && !doc.commentBefore) {
  7607. doc.commentBefore = comments.before.join("\n");
  7608. comments.before = [];
  7609. }
  7610. }
  7611. }
  7612. doc.contents = body || null;
  7613. if (!body) {
  7614. doc.comment = comments.before.concat(comments.after).join("\n") || null;
  7615. } else {
  7616. const cb = comments.before.join("\n");
  7617. if (cb) {
  7618. const cbNode = body instanceof resolveSeq.Collection && body.items[0] ? body.items[0] : body;
  7619. cbNode.commentBefore = cbNode.commentBefore ? `${cb}
  7620. ${cbNode.commentBefore}` : cb;
  7621. }
  7622. doc.comment = comments.after.join("\n") || null;
  7623. }
  7624. }
  7625. function resolveTagDirective({
  7626. tagPrefixes
  7627. }, directive) {
  7628. const [handle, prefix] = directive.parameters;
  7629. if (!handle || !prefix) {
  7630. const msg = "Insufficient parameters given for %TAG directive";
  7631. throw new PlainValue.YAMLSemanticError(directive, msg);
  7632. }
  7633. if (tagPrefixes.some((p) => p.handle === handle)) {
  7634. const msg = "The %TAG directive must only be given at most once per handle in the same document.";
  7635. throw new PlainValue.YAMLSemanticError(directive, msg);
  7636. }
  7637. return {
  7638. handle,
  7639. prefix
  7640. };
  7641. }
  7642. function resolveYamlDirective(doc, directive) {
  7643. let [version] = directive.parameters;
  7644. if (directive.name === "YAML:1.0")
  7645. version = "1.0";
  7646. if (!version) {
  7647. const msg = "Insufficient parameters given for %YAML directive";
  7648. throw new PlainValue.YAMLSemanticError(directive, msg);
  7649. }
  7650. if (!documentOptions[version]) {
  7651. const v0 = doc.version || doc.options.version;
  7652. const msg = `Document will be parsed as YAML ${v0} rather than YAML ${version}`;
  7653. doc.warnings.push(new PlainValue.YAMLWarning(directive, msg));
  7654. }
  7655. return version;
  7656. }
  7657. function parseDirectives(doc, directives, prevDoc) {
  7658. const directiveComments = [];
  7659. let hasDirectives = false;
  7660. for (const directive of directives) {
  7661. const {
  7662. comment,
  7663. name
  7664. } = directive;
  7665. switch (name) {
  7666. case "TAG":
  7667. try {
  7668. doc.tagPrefixes.push(resolveTagDirective(doc, directive));
  7669. } catch (error) {
  7670. doc.errors.push(error);
  7671. }
  7672. hasDirectives = true;
  7673. break;
  7674. case "YAML":
  7675. case "YAML:1.0":
  7676. if (doc.version) {
  7677. const msg = "The %YAML directive must only be given at most once per document.";
  7678. doc.errors.push(new PlainValue.YAMLSemanticError(directive, msg));
  7679. }
  7680. try {
  7681. doc.version = resolveYamlDirective(doc, directive);
  7682. } catch (error) {
  7683. doc.errors.push(error);
  7684. }
  7685. hasDirectives = true;
  7686. break;
  7687. default:
  7688. if (name) {
  7689. const msg = `YAML only supports %TAG and %YAML directives, and not %${name}`;
  7690. doc.warnings.push(new PlainValue.YAMLWarning(directive, msg));
  7691. }
  7692. }
  7693. if (comment)
  7694. directiveComments.push(comment);
  7695. }
  7696. if (prevDoc && !hasDirectives && (doc.version || prevDoc.version || doc.options.version) === "1.1") {
  7697. const copyTagPrefix = ({
  7698. handle,
  7699. prefix
  7700. }) => ({
  7701. handle,
  7702. prefix
  7703. });
  7704. doc.tagPrefixes = prevDoc.tagPrefixes.map(copyTagPrefix);
  7705. doc.version = prevDoc.version;
  7706. }
  7707. doc.commentBefore = directiveComments.join("\n") || null;
  7708. }
  7709. function assertCollection(contents) {
  7710. if (contents instanceof resolveSeq.Collection)
  7711. return true;
  7712. throw new Error("Expected a YAML collection as document contents");
  7713. }
  7714. var Document = class {
  7715. constructor(options) {
  7716. this.anchors = new Anchors(options.anchorPrefix);
  7717. this.commentBefore = null;
  7718. this.comment = null;
  7719. this.contents = null;
  7720. this.directivesEndMarker = null;
  7721. this.errors = [];
  7722. this.options = options;
  7723. this.schema = null;
  7724. this.tagPrefixes = [];
  7725. this.version = null;
  7726. this.warnings = [];
  7727. }
  7728. add(value) {
  7729. assertCollection(this.contents);
  7730. return this.contents.add(value);
  7731. }
  7732. addIn(path, value) {
  7733. assertCollection(this.contents);
  7734. this.contents.addIn(path, value);
  7735. }
  7736. delete(key) {
  7737. assertCollection(this.contents);
  7738. return this.contents.delete(key);
  7739. }
  7740. deleteIn(path) {
  7741. if (resolveSeq.isEmptyPath(path)) {
  7742. if (this.contents == null)
  7743. return false;
  7744. this.contents = null;
  7745. return true;
  7746. }
  7747. assertCollection(this.contents);
  7748. return this.contents.deleteIn(path);
  7749. }
  7750. getDefaults() {
  7751. return Document.defaults[this.version] || Document.defaults[this.options.version] || {};
  7752. }
  7753. get(key, keepScalar) {
  7754. return this.contents instanceof resolveSeq.Collection ? this.contents.get(key, keepScalar) : void 0;
  7755. }
  7756. getIn(path, keepScalar) {
  7757. if (resolveSeq.isEmptyPath(path))
  7758. return !keepScalar && this.contents instanceof resolveSeq.Scalar ? this.contents.value : this.contents;
  7759. return this.contents instanceof resolveSeq.Collection ? this.contents.getIn(path, keepScalar) : void 0;
  7760. }
  7761. has(key) {
  7762. return this.contents instanceof resolveSeq.Collection ? this.contents.has(key) : false;
  7763. }
  7764. hasIn(path) {
  7765. if (resolveSeq.isEmptyPath(path))
  7766. return this.contents !== void 0;
  7767. return this.contents instanceof resolveSeq.Collection ? this.contents.hasIn(path) : false;
  7768. }
  7769. set(key, value) {
  7770. assertCollection(this.contents);
  7771. this.contents.set(key, value);
  7772. }
  7773. setIn(path, value) {
  7774. if (resolveSeq.isEmptyPath(path))
  7775. this.contents = value;
  7776. else {
  7777. assertCollection(this.contents);
  7778. this.contents.setIn(path, value);
  7779. }
  7780. }
  7781. setSchema(id, customTags) {
  7782. if (!id && !customTags && this.schema)
  7783. return;
  7784. if (typeof id === "number")
  7785. id = id.toFixed(1);
  7786. if (id === "1.0" || id === "1.1" || id === "1.2") {
  7787. if (this.version)
  7788. this.version = id;
  7789. else
  7790. this.options.version = id;
  7791. delete this.options.schema;
  7792. } else if (id && typeof id === "string") {
  7793. this.options.schema = id;
  7794. }
  7795. if (Array.isArray(customTags))
  7796. this.options.customTags = customTags;
  7797. const opt = Object.assign({}, this.getDefaults(), this.options);
  7798. this.schema = new Schema.Schema(opt);
  7799. }
  7800. parse(node, prevDoc) {
  7801. if (this.options.keepCstNodes)
  7802. this.cstNode = node;
  7803. if (this.options.keepNodeTypes)
  7804. this.type = "DOCUMENT";
  7805. const {
  7806. directives = [],
  7807. contents = [],
  7808. directivesEndMarker,
  7809. error,
  7810. valueRange
  7811. } = node;
  7812. if (error) {
  7813. if (!error.source)
  7814. error.source = this;
  7815. this.errors.push(error);
  7816. }
  7817. parseDirectives(this, directives, prevDoc);
  7818. if (directivesEndMarker)
  7819. this.directivesEndMarker = true;
  7820. this.range = valueRange ? [valueRange.start, valueRange.end] : null;
  7821. this.setSchema();
  7822. this.anchors._cstAliases = [];
  7823. parseContents(this, contents);
  7824. this.anchors.resolveNodes();
  7825. if (this.options.prettyErrors) {
  7826. for (const error2 of this.errors)
  7827. if (error2 instanceof PlainValue.YAMLError)
  7828. error2.makePretty();
  7829. for (const warn of this.warnings)
  7830. if (warn instanceof PlainValue.YAMLError)
  7831. warn.makePretty();
  7832. }
  7833. return this;
  7834. }
  7835. listNonDefaultTags() {
  7836. return listTagNames(this.contents).filter((t) => t.indexOf(Schema.Schema.defaultPrefix) !== 0);
  7837. }
  7838. setTagPrefix(handle, prefix) {
  7839. if (handle[0] !== "!" || handle[handle.length - 1] !== "!")
  7840. throw new Error("Handle must start and end with !");
  7841. if (prefix) {
  7842. const prev = this.tagPrefixes.find((p) => p.handle === handle);
  7843. if (prev)
  7844. prev.prefix = prefix;
  7845. else
  7846. this.tagPrefixes.push({
  7847. handle,
  7848. prefix
  7849. });
  7850. } else {
  7851. this.tagPrefixes = this.tagPrefixes.filter((p) => p.handle !== handle);
  7852. }
  7853. }
  7854. toJSON(arg, onAnchor) {
  7855. const {
  7856. keepBlobsInJSON,
  7857. mapAsMap,
  7858. maxAliasCount
  7859. } = this.options;
  7860. const keep = keepBlobsInJSON && (typeof arg !== "string" || !(this.contents instanceof resolveSeq.Scalar));
  7861. const ctx = {
  7862. doc: this,
  7863. indentStep: " ",
  7864. keep,
  7865. mapAsMap: keep && !!mapAsMap,
  7866. maxAliasCount,
  7867. stringify
  7868. };
  7869. const anchorNames = Object.keys(this.anchors.map);
  7870. if (anchorNames.length > 0)
  7871. ctx.anchors = new Map(anchorNames.map((name) => [this.anchors.map[name], {
  7872. alias: [],
  7873. aliasCount: 0,
  7874. count: 1
  7875. }]));
  7876. const res = resolveSeq.toJSON(this.contents, arg, ctx);
  7877. if (typeof onAnchor === "function" && ctx.anchors)
  7878. for (const {
  7879. count,
  7880. res: res2
  7881. } of ctx.anchors.values())
  7882. onAnchor(res2, count);
  7883. return res;
  7884. }
  7885. toString() {
  7886. if (this.errors.length > 0)
  7887. throw new Error("Document with errors cannot be stringified");
  7888. const indentSize = this.options.indent;
  7889. if (!Number.isInteger(indentSize) || indentSize <= 0) {
  7890. const s = JSON.stringify(indentSize);
  7891. throw new Error(`"indent" option must be a positive integer, not ${s}`);
  7892. }
  7893. this.setSchema();
  7894. const lines = [];
  7895. let hasDirectives = false;
  7896. if (this.version) {
  7897. let vd = "%YAML 1.2";
  7898. if (this.schema.name === "yaml-1.1") {
  7899. if (this.version === "1.0")
  7900. vd = "%YAML:1.0";
  7901. else if (this.version === "1.1")
  7902. vd = "%YAML 1.1";
  7903. }
  7904. lines.push(vd);
  7905. hasDirectives = true;
  7906. }
  7907. const tagNames = this.listNonDefaultTags();
  7908. this.tagPrefixes.forEach(({
  7909. handle,
  7910. prefix
  7911. }) => {
  7912. if (tagNames.some((t) => t.indexOf(prefix) === 0)) {
  7913. lines.push(`%TAG ${handle} ${prefix}`);
  7914. hasDirectives = true;
  7915. }
  7916. });
  7917. if (hasDirectives || this.directivesEndMarker)
  7918. lines.push("---");
  7919. if (this.commentBefore) {
  7920. if (hasDirectives || !this.directivesEndMarker)
  7921. lines.unshift("");
  7922. lines.unshift(this.commentBefore.replace(/^/gm, "#"));
  7923. }
  7924. const ctx = {
  7925. anchors: /* @__PURE__ */ Object.create(null),
  7926. doc: this,
  7927. indent: "",
  7928. indentStep: " ".repeat(indentSize),
  7929. stringify
  7930. };
  7931. let chompKeep = false;
  7932. let contentComment = null;
  7933. if (this.contents) {
  7934. if (this.contents instanceof resolveSeq.Node) {
  7935. if (this.contents.spaceBefore && (hasDirectives || this.directivesEndMarker))
  7936. lines.push("");
  7937. if (this.contents.commentBefore)
  7938. lines.push(this.contents.commentBefore.replace(/^/gm, "#"));
  7939. ctx.forceBlockIndent = !!this.comment;
  7940. contentComment = this.contents.comment;
  7941. }
  7942. const onChompKeep = contentComment ? null : () => chompKeep = true;
  7943. const body = stringify(this.contents, ctx, () => contentComment = null, onChompKeep);
  7944. lines.push(resolveSeq.addComment(body, "", contentComment));
  7945. } else if (this.contents !== void 0) {
  7946. lines.push(stringify(this.contents, ctx));
  7947. }
  7948. if (this.comment) {
  7949. if ((!chompKeep || contentComment) && lines[lines.length - 1] !== "")
  7950. lines.push("");
  7951. lines.push(this.comment.replace(/^/gm, "#"));
  7952. }
  7953. return lines.join("\n") + "\n";
  7954. }
  7955. };
  7956. PlainValue._defineProperty(Document, "defaults", documentOptions);
  7957. exports2.Document = Document;
  7958. exports2.defaultOptions = defaultOptions;
  7959. exports2.scalarOptions = scalarOptions;
  7960. }
  7961. });
  7962. var require_dist = __commonJS({
  7963. "node_modules/yaml/dist/index.js"(exports2) {
  7964. "use strict";
  7965. var parseCst = require_parse_cst();
  7966. var Document$1 = require_Document_9b4560a1();
  7967. var Schema = require_Schema_88e323a7();
  7968. var PlainValue = require_PlainValue_ec8e588e();
  7969. var warnings = require_warnings_1000a372();
  7970. require_resolveSeq_d03cb037();
  7971. function createNode(value, wrapScalars = true, tag) {
  7972. if (tag === void 0 && typeof wrapScalars === "string") {
  7973. tag = wrapScalars;
  7974. wrapScalars = true;
  7975. }
  7976. const options = Object.assign({}, Document$1.Document.defaults[Document$1.defaultOptions.version], Document$1.defaultOptions);
  7977. const schema = new Schema.Schema(options);
  7978. return schema.createNode(value, wrapScalars, tag);
  7979. }
  7980. var Document = class extends Document$1.Document {
  7981. constructor(options) {
  7982. super(Object.assign({}, Document$1.defaultOptions, options));
  7983. }
  7984. };
  7985. function parseAllDocuments(src, options) {
  7986. const stream = [];
  7987. let prev;
  7988. for (const cstDoc of parseCst.parse(src)) {
  7989. const doc = new Document(options);
  7990. doc.parse(cstDoc, prev);
  7991. stream.push(doc);
  7992. prev = doc;
  7993. }
  7994. return stream;
  7995. }
  7996. function parseDocument(src, options) {
  7997. const cst = parseCst.parse(src);
  7998. const doc = new Document(options).parse(cst[0]);
  7999. if (cst.length > 1) {
  8000. const errMsg = "Source contains multiple documents; please use YAML.parseAllDocuments()";
  8001. doc.errors.unshift(new PlainValue.YAMLSemanticError(cst[1], errMsg));
  8002. }
  8003. return doc;
  8004. }
  8005. function parse(src, options) {
  8006. const doc = parseDocument(src, options);
  8007. doc.warnings.forEach((warning) => warnings.warn(warning));
  8008. if (doc.errors.length > 0)
  8009. throw doc.errors[0];
  8010. return doc.toJSON();
  8011. }
  8012. function stringify(value, options) {
  8013. const doc = new Document(options);
  8014. doc.contents = value;
  8015. return String(doc);
  8016. }
  8017. var YAML = {
  8018. createNode,
  8019. defaultOptions: Document$1.defaultOptions,
  8020. Document,
  8021. parse,
  8022. parseAllDocuments,
  8023. parseCST: parseCst.parse,
  8024. parseDocument,
  8025. scalarOptions: Document$1.scalarOptions,
  8026. stringify
  8027. };
  8028. exports2.YAML = YAML;
  8029. }
  8030. });
  8031. var require_yaml = __commonJS({
  8032. "node_modules/yaml/index.js"(exports2, module2) {
  8033. module2.exports = require_dist().YAML;
  8034. }
  8035. });
  8036. var require_loaders = __commonJS({
  8037. "node_modules/cosmiconfig/dist/loaders.js"(exports2) {
  8038. "use strict";
  8039. Object.defineProperty(exports2, "__esModule", {
  8040. value: true
  8041. });
  8042. exports2.loaders = void 0;
  8043. var importFresh;
  8044. var loadJs = function loadJs2(filepath) {
  8045. if (importFresh === void 0) {
  8046. importFresh = require_import_fresh();
  8047. }
  8048. const result = importFresh(filepath);
  8049. return result;
  8050. };
  8051. var parseJson;
  8052. var loadJson = function loadJson2(filepath, content) {
  8053. if (parseJson === void 0) {
  8054. parseJson = require_parse_json();
  8055. }
  8056. try {
  8057. const result = parseJson(content);
  8058. return result;
  8059. } catch (error) {
  8060. error.message = `JSON Error in ${filepath}:
  8061. ${error.message}`;
  8062. throw error;
  8063. }
  8064. };
  8065. var yaml;
  8066. var loadYaml = function loadYaml2(filepath, content) {
  8067. if (yaml === void 0) {
  8068. yaml = require_yaml();
  8069. }
  8070. try {
  8071. const result = yaml.parse(content, {
  8072. prettyErrors: true
  8073. });
  8074. return result;
  8075. } catch (error) {
  8076. error.message = `YAML Error in ${filepath}:
  8077. ${error.message}`;
  8078. throw error;
  8079. }
  8080. };
  8081. var loaders = {
  8082. loadJs,
  8083. loadJson,
  8084. loadYaml
  8085. };
  8086. exports2.loaders = loaders;
  8087. }
  8088. });
  8089. var require_getPropertyByPath = __commonJS({
  8090. "node_modules/cosmiconfig/dist/getPropertyByPath.js"(exports2) {
  8091. "use strict";
  8092. Object.defineProperty(exports2, "__esModule", {
  8093. value: true
  8094. });
  8095. exports2.getPropertyByPath = getPropertyByPath;
  8096. function getPropertyByPath(source, path) {
  8097. if (typeof path === "string" && Object.prototype.hasOwnProperty.call(source, path)) {
  8098. return source[path];
  8099. }
  8100. const parsedPath = typeof path === "string" ? path.split(".") : path;
  8101. return parsedPath.reduce((previous, key) => {
  8102. if (previous === void 0) {
  8103. return previous;
  8104. }
  8105. return previous[key];
  8106. }, source);
  8107. }
  8108. }
  8109. });
  8110. var require_ExplorerBase = __commonJS({
  8111. "node_modules/cosmiconfig/dist/ExplorerBase.js"(exports2) {
  8112. "use strict";
  8113. Object.defineProperty(exports2, "__esModule", {
  8114. value: true
  8115. });
  8116. exports2.getExtensionDescription = getExtensionDescription;
  8117. exports2.ExplorerBase = void 0;
  8118. var _path = _interopRequireDefault(require("path"));
  8119. var _loaders = require_loaders();
  8120. var _getPropertyByPath = require_getPropertyByPath();
  8121. function _interopRequireDefault(obj) {
  8122. return obj && obj.__esModule ? obj : {
  8123. default: obj
  8124. };
  8125. }
  8126. var ExplorerBase = class {
  8127. constructor(options) {
  8128. if (options.cache === true) {
  8129. this.loadCache = /* @__PURE__ */ new Map();
  8130. this.searchCache = /* @__PURE__ */ new Map();
  8131. }
  8132. this.config = options;
  8133. this.validateConfig();
  8134. }
  8135. clearLoadCache() {
  8136. if (this.loadCache) {
  8137. this.loadCache.clear();
  8138. }
  8139. }
  8140. clearSearchCache() {
  8141. if (this.searchCache) {
  8142. this.searchCache.clear();
  8143. }
  8144. }
  8145. clearCaches() {
  8146. this.clearLoadCache();
  8147. this.clearSearchCache();
  8148. }
  8149. validateConfig() {
  8150. const config = this.config;
  8151. config.searchPlaces.forEach((place) => {
  8152. const loaderKey = _path.default.extname(place) || "noExt";
  8153. const loader = config.loaders[loaderKey];
  8154. if (!loader) {
  8155. throw new Error(`No loader specified for ${getExtensionDescription(place)}, so searchPlaces item "${place}" is invalid`);
  8156. }
  8157. if (typeof loader !== "function") {
  8158. throw new Error(`loader for ${getExtensionDescription(place)} is not a function (type provided: "${typeof loader}"), so searchPlaces item "${place}" is invalid`);
  8159. }
  8160. });
  8161. }
  8162. shouldSearchStopWithResult(result) {
  8163. if (result === null)
  8164. return false;
  8165. if (result.isEmpty && this.config.ignoreEmptySearchPlaces)
  8166. return false;
  8167. return true;
  8168. }
  8169. nextDirectoryToSearch(currentDir, currentResult) {
  8170. if (this.shouldSearchStopWithResult(currentResult)) {
  8171. return null;
  8172. }
  8173. const nextDir = nextDirUp(currentDir);
  8174. if (nextDir === currentDir || currentDir === this.config.stopDir) {
  8175. return null;
  8176. }
  8177. return nextDir;
  8178. }
  8179. loadPackageProp(filepath, content) {
  8180. const parsedContent = _loaders.loaders.loadJson(filepath, content);
  8181. const packagePropValue = (0, _getPropertyByPath.getPropertyByPath)(parsedContent, this.config.packageProp);
  8182. return packagePropValue || null;
  8183. }
  8184. getLoaderEntryForFile(filepath) {
  8185. if (_path.default.basename(filepath) === "package.json") {
  8186. const loader2 = this.loadPackageProp.bind(this);
  8187. return loader2;
  8188. }
  8189. const loaderKey = _path.default.extname(filepath) || "noExt";
  8190. const loader = this.config.loaders[loaderKey];
  8191. if (!loader) {
  8192. throw new Error(`No loader specified for ${getExtensionDescription(filepath)}`);
  8193. }
  8194. return loader;
  8195. }
  8196. loadedContentToCosmiconfigResult(filepath, loadedContent) {
  8197. if (loadedContent === null) {
  8198. return null;
  8199. }
  8200. if (loadedContent === void 0) {
  8201. return {
  8202. filepath,
  8203. config: void 0,
  8204. isEmpty: true
  8205. };
  8206. }
  8207. return {
  8208. config: loadedContent,
  8209. filepath
  8210. };
  8211. }
  8212. validateFilePath(filepath) {
  8213. if (!filepath) {
  8214. throw new Error("load must pass a non-empty string");
  8215. }
  8216. }
  8217. };
  8218. exports2.ExplorerBase = ExplorerBase;
  8219. function nextDirUp(dir) {
  8220. return _path.default.dirname(dir);
  8221. }
  8222. function getExtensionDescription(filepath) {
  8223. const ext = _path.default.extname(filepath);
  8224. return ext ? `extension "${ext}"` : "files without extensions";
  8225. }
  8226. }
  8227. });
  8228. var require_readFile = __commonJS({
  8229. "node_modules/cosmiconfig/dist/readFile.js"(exports2) {
  8230. "use strict";
  8231. Object.defineProperty(exports2, "__esModule", {
  8232. value: true
  8233. });
  8234. exports2.readFile = readFile;
  8235. exports2.readFileSync = readFileSync;
  8236. var _fs = _interopRequireDefault(require("fs"));
  8237. function _interopRequireDefault(obj) {
  8238. return obj && obj.__esModule ? obj : {
  8239. default: obj
  8240. };
  8241. }
  8242. async function fsReadFileAsync(pathname, encoding) {
  8243. return new Promise((resolve, reject) => {
  8244. _fs.default.readFile(pathname, encoding, (error, contents) => {
  8245. if (error) {
  8246. reject(error);
  8247. return;
  8248. }
  8249. resolve(contents);
  8250. });
  8251. });
  8252. }
  8253. async function readFile(filepath, options = {}) {
  8254. const throwNotFound = options.throwNotFound === true;
  8255. try {
  8256. const content = await fsReadFileAsync(filepath, "utf8");
  8257. return content;
  8258. } catch (error) {
  8259. if (throwNotFound === false && (error.code === "ENOENT" || error.code === "EISDIR")) {
  8260. return null;
  8261. }
  8262. throw error;
  8263. }
  8264. }
  8265. function readFileSync(filepath, options = {}) {
  8266. const throwNotFound = options.throwNotFound === true;
  8267. try {
  8268. const content = _fs.default.readFileSync(filepath, "utf8");
  8269. return content;
  8270. } catch (error) {
  8271. if (throwNotFound === false && (error.code === "ENOENT" || error.code === "EISDIR")) {
  8272. return null;
  8273. }
  8274. throw error;
  8275. }
  8276. }
  8277. }
  8278. });
  8279. var require_cacheWrapper = __commonJS({
  8280. "node_modules/cosmiconfig/dist/cacheWrapper.js"(exports2) {
  8281. "use strict";
  8282. Object.defineProperty(exports2, "__esModule", {
  8283. value: true
  8284. });
  8285. exports2.cacheWrapper = cacheWrapper;
  8286. exports2.cacheWrapperSync = cacheWrapperSync;
  8287. async function cacheWrapper(cache, key, fn) {
  8288. const cached = cache.get(key);
  8289. if (cached !== void 0) {
  8290. return cached;
  8291. }
  8292. const result = await fn();
  8293. cache.set(key, result);
  8294. return result;
  8295. }
  8296. function cacheWrapperSync(cache, key, fn) {
  8297. const cached = cache.get(key);
  8298. if (cached !== void 0) {
  8299. return cached;
  8300. }
  8301. const result = fn();
  8302. cache.set(key, result);
  8303. return result;
  8304. }
  8305. }
  8306. });
  8307. var require_path_type = __commonJS({
  8308. "node_modules/path-type/index.js"(exports2) {
  8309. "use strict";
  8310. var {
  8311. promisify
  8312. } = require("util");
  8313. var fs = require("fs");
  8314. async function isType(fsStatType, statsMethodName, filePath) {
  8315. if (typeof filePath !== "string") {
  8316. throw new TypeError(`Expected a string, got ${typeof filePath}`);
  8317. }
  8318. try {
  8319. const stats = await promisify(fs[fsStatType])(filePath);
  8320. return stats[statsMethodName]();
  8321. } catch (error) {
  8322. if (error.code === "ENOENT") {
  8323. return false;
  8324. }
  8325. throw error;
  8326. }
  8327. }
  8328. function isTypeSync(fsStatType, statsMethodName, filePath) {
  8329. if (typeof filePath !== "string") {
  8330. throw new TypeError(`Expected a string, got ${typeof filePath}`);
  8331. }
  8332. try {
  8333. return fs[fsStatType](filePath)[statsMethodName]();
  8334. } catch (error) {
  8335. if (error.code === "ENOENT") {
  8336. return false;
  8337. }
  8338. throw error;
  8339. }
  8340. }
  8341. exports2.isFile = isType.bind(null, "stat", "isFile");
  8342. exports2.isDirectory = isType.bind(null, "stat", "isDirectory");
  8343. exports2.isSymlink = isType.bind(null, "lstat", "isSymbolicLink");
  8344. exports2.isFileSync = isTypeSync.bind(null, "statSync", "isFile");
  8345. exports2.isDirectorySync = isTypeSync.bind(null, "statSync", "isDirectory");
  8346. exports2.isSymlinkSync = isTypeSync.bind(null, "lstatSync", "isSymbolicLink");
  8347. }
  8348. });
  8349. var require_getDirectory = __commonJS({
  8350. "node_modules/cosmiconfig/dist/getDirectory.js"(exports2) {
  8351. "use strict";
  8352. Object.defineProperty(exports2, "__esModule", {
  8353. value: true
  8354. });
  8355. exports2.getDirectory = getDirectory;
  8356. exports2.getDirectorySync = getDirectorySync;
  8357. var _path = _interopRequireDefault(require("path"));
  8358. var _pathType = require_path_type();
  8359. function _interopRequireDefault(obj) {
  8360. return obj && obj.__esModule ? obj : {
  8361. default: obj
  8362. };
  8363. }
  8364. async function getDirectory(filepath) {
  8365. const filePathIsDirectory = await (0, _pathType.isDirectory)(filepath);
  8366. if (filePathIsDirectory === true) {
  8367. return filepath;
  8368. }
  8369. const directory = _path.default.dirname(filepath);
  8370. return directory;
  8371. }
  8372. function getDirectorySync(filepath) {
  8373. const filePathIsDirectory = (0, _pathType.isDirectorySync)(filepath);
  8374. if (filePathIsDirectory === true) {
  8375. return filepath;
  8376. }
  8377. const directory = _path.default.dirname(filepath);
  8378. return directory;
  8379. }
  8380. }
  8381. });
  8382. var require_Explorer = __commonJS({
  8383. "node_modules/cosmiconfig/dist/Explorer.js"(exports2) {
  8384. "use strict";
  8385. Object.defineProperty(exports2, "__esModule", {
  8386. value: true
  8387. });
  8388. exports2.Explorer = void 0;
  8389. var _path = _interopRequireDefault(require("path"));
  8390. var _ExplorerBase = require_ExplorerBase();
  8391. var _readFile = require_readFile();
  8392. var _cacheWrapper = require_cacheWrapper();
  8393. var _getDirectory = require_getDirectory();
  8394. function _interopRequireDefault(obj) {
  8395. return obj && obj.__esModule ? obj : {
  8396. default: obj
  8397. };
  8398. }
  8399. var Explorer = class extends _ExplorerBase.ExplorerBase {
  8400. constructor(options) {
  8401. super(options);
  8402. }
  8403. async search(searchFrom = process.cwd()) {
  8404. const startDirectory = await (0, _getDirectory.getDirectory)(searchFrom);
  8405. const result = await this.searchFromDirectory(startDirectory);
  8406. return result;
  8407. }
  8408. async searchFromDirectory(dir) {
  8409. const absoluteDir = _path.default.resolve(process.cwd(), dir);
  8410. const run = async () => {
  8411. const result = await this.searchDirectory(absoluteDir);
  8412. const nextDir = this.nextDirectoryToSearch(absoluteDir, result);
  8413. if (nextDir) {
  8414. return this.searchFromDirectory(nextDir);
  8415. }
  8416. const transformResult = await this.config.transform(result);
  8417. return transformResult;
  8418. };
  8419. if (this.searchCache) {
  8420. return (0, _cacheWrapper.cacheWrapper)(this.searchCache, absoluteDir, run);
  8421. }
  8422. return run();
  8423. }
  8424. async searchDirectory(dir) {
  8425. for await (const place of this.config.searchPlaces) {
  8426. const placeResult = await this.loadSearchPlace(dir, place);
  8427. if (this.shouldSearchStopWithResult(placeResult) === true) {
  8428. return placeResult;
  8429. }
  8430. }
  8431. return null;
  8432. }
  8433. async loadSearchPlace(dir, place) {
  8434. const filepath = _path.default.join(dir, place);
  8435. const fileContents = await (0, _readFile.readFile)(filepath);
  8436. const result = await this.createCosmiconfigResult(filepath, fileContents);
  8437. return result;
  8438. }
  8439. async loadFileContent(filepath, content) {
  8440. if (content === null) {
  8441. return null;
  8442. }
  8443. if (content.trim() === "") {
  8444. return void 0;
  8445. }
  8446. const loader = this.getLoaderEntryForFile(filepath);
  8447. const loaderResult = await loader(filepath, content);
  8448. return loaderResult;
  8449. }
  8450. async createCosmiconfigResult(filepath, content) {
  8451. const fileContent = await this.loadFileContent(filepath, content);
  8452. const result = this.loadedContentToCosmiconfigResult(filepath, fileContent);
  8453. return result;
  8454. }
  8455. async load(filepath) {
  8456. this.validateFilePath(filepath);
  8457. const absoluteFilePath = _path.default.resolve(process.cwd(), filepath);
  8458. const runLoad = async () => {
  8459. const fileContents = await (0, _readFile.readFile)(absoluteFilePath, {
  8460. throwNotFound: true
  8461. });
  8462. const result = await this.createCosmiconfigResult(absoluteFilePath, fileContents);
  8463. const transformResult = await this.config.transform(result);
  8464. return transformResult;
  8465. };
  8466. if (this.loadCache) {
  8467. return (0, _cacheWrapper.cacheWrapper)(this.loadCache, absoluteFilePath, runLoad);
  8468. }
  8469. return runLoad();
  8470. }
  8471. };
  8472. exports2.Explorer = Explorer;
  8473. }
  8474. });
  8475. var require_ExplorerSync = __commonJS({
  8476. "node_modules/cosmiconfig/dist/ExplorerSync.js"(exports2) {
  8477. "use strict";
  8478. Object.defineProperty(exports2, "__esModule", {
  8479. value: true
  8480. });
  8481. exports2.ExplorerSync = void 0;
  8482. var _path = _interopRequireDefault(require("path"));
  8483. var _ExplorerBase = require_ExplorerBase();
  8484. var _readFile = require_readFile();
  8485. var _cacheWrapper = require_cacheWrapper();
  8486. var _getDirectory = require_getDirectory();
  8487. function _interopRequireDefault(obj) {
  8488. return obj && obj.__esModule ? obj : {
  8489. default: obj
  8490. };
  8491. }
  8492. var ExplorerSync = class extends _ExplorerBase.ExplorerBase {
  8493. constructor(options) {
  8494. super(options);
  8495. }
  8496. searchSync(searchFrom = process.cwd()) {
  8497. const startDirectory = (0, _getDirectory.getDirectorySync)(searchFrom);
  8498. const result = this.searchFromDirectorySync(startDirectory);
  8499. return result;
  8500. }
  8501. searchFromDirectorySync(dir) {
  8502. const absoluteDir = _path.default.resolve(process.cwd(), dir);
  8503. const run = () => {
  8504. const result = this.searchDirectorySync(absoluteDir);
  8505. const nextDir = this.nextDirectoryToSearch(absoluteDir, result);
  8506. if (nextDir) {
  8507. return this.searchFromDirectorySync(nextDir);
  8508. }
  8509. const transformResult = this.config.transform(result);
  8510. return transformResult;
  8511. };
  8512. if (this.searchCache) {
  8513. return (0, _cacheWrapper.cacheWrapperSync)(this.searchCache, absoluteDir, run);
  8514. }
  8515. return run();
  8516. }
  8517. searchDirectorySync(dir) {
  8518. for (const place of this.config.searchPlaces) {
  8519. const placeResult = this.loadSearchPlaceSync(dir, place);
  8520. if (this.shouldSearchStopWithResult(placeResult) === true) {
  8521. return placeResult;
  8522. }
  8523. }
  8524. return null;
  8525. }
  8526. loadSearchPlaceSync(dir, place) {
  8527. const filepath = _path.default.join(dir, place);
  8528. const content = (0, _readFile.readFileSync)(filepath);
  8529. const result = this.createCosmiconfigResultSync(filepath, content);
  8530. return result;
  8531. }
  8532. loadFileContentSync(filepath, content) {
  8533. if (content === null) {
  8534. return null;
  8535. }
  8536. if (content.trim() === "") {
  8537. return void 0;
  8538. }
  8539. const loader = this.getLoaderEntryForFile(filepath);
  8540. const loaderResult = loader(filepath, content);
  8541. return loaderResult;
  8542. }
  8543. createCosmiconfigResultSync(filepath, content) {
  8544. const fileContent = this.loadFileContentSync(filepath, content);
  8545. const result = this.loadedContentToCosmiconfigResult(filepath, fileContent);
  8546. return result;
  8547. }
  8548. loadSync(filepath) {
  8549. this.validateFilePath(filepath);
  8550. const absoluteFilePath = _path.default.resolve(process.cwd(), filepath);
  8551. const runLoadSync = () => {
  8552. const content = (0, _readFile.readFileSync)(absoluteFilePath, {
  8553. throwNotFound: true
  8554. });
  8555. const cosmiconfigResult = this.createCosmiconfigResultSync(absoluteFilePath, content);
  8556. const transformResult = this.config.transform(cosmiconfigResult);
  8557. return transformResult;
  8558. };
  8559. if (this.loadCache) {
  8560. return (0, _cacheWrapper.cacheWrapperSync)(this.loadCache, absoluteFilePath, runLoadSync);
  8561. }
  8562. return runLoadSync();
  8563. }
  8564. };
  8565. exports2.ExplorerSync = ExplorerSync;
  8566. }
  8567. });
  8568. var require_types = __commonJS({
  8569. "node_modules/cosmiconfig/dist/types.js"(exports2) {
  8570. "use strict";
  8571. Object.defineProperty(exports2, "__esModule", {
  8572. value: true
  8573. });
  8574. }
  8575. });
  8576. var require_dist2 = __commonJS({
  8577. "node_modules/cosmiconfig/dist/index.js"(exports2) {
  8578. "use strict";
  8579. Object.defineProperty(exports2, "__esModule", {
  8580. value: true
  8581. });
  8582. exports2.cosmiconfig = cosmiconfig;
  8583. exports2.cosmiconfigSync = cosmiconfigSync;
  8584. exports2.defaultLoaders = void 0;
  8585. var _os = _interopRequireDefault(require("os"));
  8586. var _Explorer = require_Explorer();
  8587. var _ExplorerSync = require_ExplorerSync();
  8588. var _loaders = require_loaders();
  8589. var _types = require_types();
  8590. function _interopRequireDefault(obj) {
  8591. return obj && obj.__esModule ? obj : {
  8592. default: obj
  8593. };
  8594. }
  8595. function cosmiconfig(moduleName, options = {}) {
  8596. const normalizedOptions = normalizeOptions(moduleName, options);
  8597. const explorer = new _Explorer.Explorer(normalizedOptions);
  8598. return {
  8599. search: explorer.search.bind(explorer),
  8600. load: explorer.load.bind(explorer),
  8601. clearLoadCache: explorer.clearLoadCache.bind(explorer),
  8602. clearSearchCache: explorer.clearSearchCache.bind(explorer),
  8603. clearCaches: explorer.clearCaches.bind(explorer)
  8604. };
  8605. }
  8606. function cosmiconfigSync(moduleName, options = {}) {
  8607. const normalizedOptions = normalizeOptions(moduleName, options);
  8608. const explorerSync = new _ExplorerSync.ExplorerSync(normalizedOptions);
  8609. return {
  8610. search: explorerSync.searchSync.bind(explorerSync),
  8611. load: explorerSync.loadSync.bind(explorerSync),
  8612. clearLoadCache: explorerSync.clearLoadCache.bind(explorerSync),
  8613. clearSearchCache: explorerSync.clearSearchCache.bind(explorerSync),
  8614. clearCaches: explorerSync.clearCaches.bind(explorerSync)
  8615. };
  8616. }
  8617. var defaultLoaders = Object.freeze({
  8618. ".cjs": _loaders.loaders.loadJs,
  8619. ".js": _loaders.loaders.loadJs,
  8620. ".json": _loaders.loaders.loadJson,
  8621. ".yaml": _loaders.loaders.loadYaml,
  8622. ".yml": _loaders.loaders.loadYaml,
  8623. noExt: _loaders.loaders.loadYaml
  8624. });
  8625. exports2.defaultLoaders = defaultLoaders;
  8626. var identity = function identity2(x) {
  8627. return x;
  8628. };
  8629. function normalizeOptions(moduleName, options) {
  8630. const defaults = {
  8631. packageProp: moduleName,
  8632. searchPlaces: ["package.json", `.${moduleName}rc`, `.${moduleName}rc.json`, `.${moduleName}rc.yaml`, `.${moduleName}rc.yml`, `.${moduleName}rc.js`, `.${moduleName}rc.cjs`, `${moduleName}.config.js`, `${moduleName}.config.cjs`],
  8633. ignoreEmptySearchPlaces: true,
  8634. stopDir: _os.default.homedir(),
  8635. cache: true,
  8636. transform: identity,
  8637. loaders: defaultLoaders
  8638. };
  8639. const normalizedOptions = Object.assign(Object.assign(Object.assign({}, defaults), options), {}, {
  8640. loaders: Object.assign(Object.assign({}, defaults.loaders), options.loaders)
  8641. });
  8642. return normalizedOptions;
  8643. }
  8644. }
  8645. });
  8646. var require_find_parent_dir = __commonJS({
  8647. "node_modules/find-parent-dir/index.js"(exports2, module2) {
  8648. "use strict";
  8649. var path = require("path");
  8650. var fs = require("fs");
  8651. var exists = fs.exists || path.exists;
  8652. var existsSync = fs.existsSync || path.existsSync;
  8653. function splitPath(path2) {
  8654. var parts = path2.split(/(\/|\\)/);
  8655. if (!parts.length)
  8656. return parts;
  8657. return !parts[0].length ? parts.slice(1) : parts;
  8658. }
  8659. exports2 = module2.exports = function(currentFullPath, clue, cb) {
  8660. function testDir(parts) {
  8661. if (parts.length === 0)
  8662. return cb(null, null);
  8663. var p = parts.join("");
  8664. exists(path.join(p, clue), function(itdoes) {
  8665. if (itdoes)
  8666. return cb(null, p);
  8667. testDir(parts.slice(0, -1));
  8668. });
  8669. }
  8670. testDir(splitPath(currentFullPath));
  8671. };
  8672. exports2.sync = function(currentFullPath, clue) {
  8673. function testDir(parts) {
  8674. if (parts.length === 0)
  8675. return null;
  8676. var p = parts.join("");
  8677. var itdoes = existsSync(path.join(p, clue));
  8678. return itdoes ? p : testDir(parts.slice(0, -1));
  8679. }
  8680. return testDir(splitPath(currentFullPath));
  8681. };
  8682. }
  8683. });
  8684. var require_get_stdin = __commonJS({
  8685. "node_modules/get-stdin/index.js"(exports2, module2) {
  8686. "use strict";
  8687. var {
  8688. stdin
  8689. } = process;
  8690. module2.exports = async () => {
  8691. let result = "";
  8692. if (stdin.isTTY) {
  8693. return result;
  8694. }
  8695. stdin.setEncoding("utf8");
  8696. for await (const chunk of stdin) {
  8697. result += chunk;
  8698. }
  8699. return result;
  8700. };
  8701. module2.exports.buffer = async () => {
  8702. const result = [];
  8703. let length = 0;
  8704. if (stdin.isTTY) {
  8705. return Buffer.concat([]);
  8706. }
  8707. for await (const chunk of stdin) {
  8708. result.push(chunk);
  8709. length += chunk.length;
  8710. }
  8711. return Buffer.concat(result, length);
  8712. };
  8713. }
  8714. });
  8715. var require_vendors = __commonJS({
  8716. "node_modules/ci-info/vendors.json"(exports2, module2) {
  8717. module2.exports = [{
  8718. name: "AppVeyor",
  8719. constant: "APPVEYOR",
  8720. env: "APPVEYOR",
  8721. pr: "APPVEYOR_PULL_REQUEST_NUMBER"
  8722. }, {
  8723. name: "Azure Pipelines",
  8724. constant: "AZURE_PIPELINES",
  8725. env: "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",
  8726. pr: "SYSTEM_PULLREQUEST_PULLREQUESTID"
  8727. }, {
  8728. name: "Appcircle",
  8729. constant: "APPCIRCLE",
  8730. env: "AC_APPCIRCLE"
  8731. }, {
  8732. name: "Bamboo",
  8733. constant: "BAMBOO",
  8734. env: "bamboo_planKey"
  8735. }, {
  8736. name: "Bitbucket Pipelines",
  8737. constant: "BITBUCKET",
  8738. env: "BITBUCKET_COMMIT",
  8739. pr: "BITBUCKET_PR_ID"
  8740. }, {
  8741. name: "Bitrise",
  8742. constant: "BITRISE",
  8743. env: "BITRISE_IO",
  8744. pr: "BITRISE_PULL_REQUEST"
  8745. }, {
  8746. name: "Buddy",
  8747. constant: "BUDDY",
  8748. env: "BUDDY_WORKSPACE_ID",
  8749. pr: "BUDDY_EXECUTION_PULL_REQUEST_ID"
  8750. }, {
  8751. name: "Buildkite",
  8752. constant: "BUILDKITE",
  8753. env: "BUILDKITE",
  8754. pr: {
  8755. env: "BUILDKITE_PULL_REQUEST",
  8756. ne: "false"
  8757. }
  8758. }, {
  8759. name: "CircleCI",
  8760. constant: "CIRCLE",
  8761. env: "CIRCLECI",
  8762. pr: "CIRCLE_PULL_REQUEST"
  8763. }, {
  8764. name: "Cirrus CI",
  8765. constant: "CIRRUS",
  8766. env: "CIRRUS_CI",
  8767. pr: "CIRRUS_PR"
  8768. }, {
  8769. name: "AWS CodeBuild",
  8770. constant: "CODEBUILD",
  8771. env: "CODEBUILD_BUILD_ARN"
  8772. }, {
  8773. name: "Codefresh",
  8774. constant: "CODEFRESH",
  8775. env: "CF_BUILD_ID",
  8776. pr: {
  8777. any: ["CF_PULL_REQUEST_NUMBER", "CF_PULL_REQUEST_ID"]
  8778. }
  8779. }, {
  8780. name: "Codeship",
  8781. constant: "CODESHIP",
  8782. env: {
  8783. CI_NAME: "codeship"
  8784. }
  8785. }, {
  8786. name: "Drone",
  8787. constant: "DRONE",
  8788. env: "DRONE",
  8789. pr: {
  8790. DRONE_BUILD_EVENT: "pull_request"
  8791. }
  8792. }, {
  8793. name: "dsari",
  8794. constant: "DSARI",
  8795. env: "DSARI"
  8796. }, {
  8797. name: "Expo Application Services",
  8798. constant: "EAS",
  8799. env: "EAS_BUILD"
  8800. }, {
  8801. name: "GitHub Actions",
  8802. constant: "GITHUB_ACTIONS",
  8803. env: "GITHUB_ACTIONS",
  8804. pr: {
  8805. GITHUB_EVENT_NAME: "pull_request"
  8806. }
  8807. }, {
  8808. name: "GitLab CI",
  8809. constant: "GITLAB",
  8810. env: "GITLAB_CI",
  8811. pr: "CI_MERGE_REQUEST_ID"
  8812. }, {
  8813. name: "GoCD",
  8814. constant: "GOCD",
  8815. env: "GO_PIPELINE_LABEL"
  8816. }, {
  8817. name: "LayerCI",
  8818. constant: "LAYERCI",
  8819. env: "LAYERCI",
  8820. pr: "LAYERCI_PULL_REQUEST"
  8821. }, {
  8822. name: "Hudson",
  8823. constant: "HUDSON",
  8824. env: "HUDSON_URL"
  8825. }, {
  8826. name: "Jenkins",
  8827. constant: "JENKINS",
  8828. env: ["JENKINS_URL", "BUILD_ID"],
  8829. pr: {
  8830. any: ["ghprbPullId", "CHANGE_ID"]
  8831. }
  8832. }, {
  8833. name: "Magnum CI",
  8834. constant: "MAGNUM",
  8835. env: "MAGNUM"
  8836. }, {
  8837. name: "Netlify CI",
  8838. constant: "NETLIFY",
  8839. env: "NETLIFY",
  8840. pr: {
  8841. env: "PULL_REQUEST",
  8842. ne: "false"
  8843. }
  8844. }, {
  8845. name: "Nevercode",
  8846. constant: "NEVERCODE",
  8847. env: "NEVERCODE",
  8848. pr: {
  8849. env: "NEVERCODE_PULL_REQUEST",
  8850. ne: "false"
  8851. }
  8852. }, {
  8853. name: "Render",
  8854. constant: "RENDER",
  8855. env: "RENDER",
  8856. pr: {
  8857. IS_PULL_REQUEST: "true"
  8858. }
  8859. }, {
  8860. name: "Sail CI",
  8861. constant: "SAIL",
  8862. env: "SAILCI",
  8863. pr: "SAIL_PULL_REQUEST_NUMBER"
  8864. }, {
  8865. name: "Semaphore",
  8866. constant: "SEMAPHORE",
  8867. env: "SEMAPHORE",
  8868. pr: "PULL_REQUEST_NUMBER"
  8869. }, {
  8870. name: "Screwdriver",
  8871. constant: "SCREWDRIVER",
  8872. env: "SCREWDRIVER",
  8873. pr: {
  8874. env: "SD_PULL_REQUEST",
  8875. ne: "false"
  8876. }
  8877. }, {
  8878. name: "Shippable",
  8879. constant: "SHIPPABLE",
  8880. env: "SHIPPABLE",
  8881. pr: {
  8882. IS_PULL_REQUEST: "true"
  8883. }
  8884. }, {
  8885. name: "Solano CI",
  8886. constant: "SOLANO",
  8887. env: "TDDIUM",
  8888. pr: "TDDIUM_PR_ID"
  8889. }, {
  8890. name: "Strider CD",
  8891. constant: "STRIDER",
  8892. env: "STRIDER"
  8893. }, {
  8894. name: "TaskCluster",
  8895. constant: "TASKCLUSTER",
  8896. env: ["TASK_ID", "RUN_ID"]
  8897. }, {
  8898. name: "TeamCity",
  8899. constant: "TEAMCITY",
  8900. env: "TEAMCITY_VERSION"
  8901. }, {
  8902. name: "Travis CI",
  8903. constant: "TRAVIS",
  8904. env: "TRAVIS",
  8905. pr: {
  8906. env: "TRAVIS_PULL_REQUEST",
  8907. ne: "false"
  8908. }
  8909. }, {
  8910. name: "Vercel",
  8911. constant: "VERCEL",
  8912. env: "NOW_BUILDER"
  8913. }, {
  8914. name: "Visual Studio App Center",
  8915. constant: "APPCENTER",
  8916. env: "APPCENTER_BUILD_ID"
  8917. }];
  8918. }
  8919. });
  8920. var require_ci_info = __commonJS({
  8921. "node_modules/ci-info/index.js"(exports2) {
  8922. "use strict";
  8923. var vendors = require_vendors();
  8924. var env = process.env;
  8925. Object.defineProperty(exports2, "_vendors", {
  8926. value: vendors.map(function(v) {
  8927. return v.constant;
  8928. })
  8929. });
  8930. exports2.name = null;
  8931. exports2.isPR = null;
  8932. vendors.forEach(function(vendor) {
  8933. const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
  8934. const isCI = envs.every(function(obj) {
  8935. return checkEnv(obj);
  8936. });
  8937. exports2[vendor.constant] = isCI;
  8938. if (isCI) {
  8939. exports2.name = vendor.name;
  8940. switch (typeof vendor.pr) {
  8941. case "string":
  8942. exports2.isPR = !!env[vendor.pr];
  8943. break;
  8944. case "object":
  8945. if ("env" in vendor.pr) {
  8946. exports2.isPR = vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne;
  8947. } else if ("any" in vendor.pr) {
  8948. exports2.isPR = vendor.pr.any.some(function(key) {
  8949. return !!env[key];
  8950. });
  8951. } else {
  8952. exports2.isPR = checkEnv(vendor.pr);
  8953. }
  8954. break;
  8955. default:
  8956. exports2.isPR = null;
  8957. }
  8958. }
  8959. });
  8960. exports2.isCI = !!(env.CI || env.CONTINUOUS_INTEGRATION || env.BUILD_NUMBER || env.RUN_ID || exports2.name || false);
  8961. function checkEnv(obj) {
  8962. if (typeof obj === "string")
  8963. return !!env[obj];
  8964. return Object.keys(obj).every(function(k) {
  8965. return env[k] === obj[k];
  8966. });
  8967. }
  8968. }
  8969. });
  8970. module.exports = {
  8971. cosmiconfig: require_dist2().cosmiconfig,
  8972. cosmiconfigSync: require_dist2().cosmiconfigSync,
  8973. findParentDir: require_find_parent_dir().sync,
  8974. getStdin: require_get_stdin(),
  8975. isCI: () => require_ci_info().isCI
  8976. };