compiler-sfc.cjs.js 505 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var CompilerDOM = require('@vue/compiler-dom');
  4. var sourceMap = require('source-map');
  5. var MagicString = require('magic-string');
  6. var parser$2 = require('@babel/parser');
  7. var shared = require('@vue/shared');
  8. var estreeWalker = require('estree-walker');
  9. var path = require('path');
  10. var compilerCore = require('@vue/compiler-core');
  11. var url = require('url');
  12. var CompilerSSR = require('@vue/compiler-ssr');
  13. var fs = require('fs');
  14. var util$2 = require('util');
  15. var reactivityTransform = require('@vue/reactivity-transform');
  16. var _postcss = require('postcss');
  17. function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
  18. function _interopNamespace(e) {
  19. if (e && e.__esModule) return e;
  20. var n = Object.create(null);
  21. if (e) {
  22. Object.keys(e).forEach(function (k) {
  23. n[k] = e[k];
  24. });
  25. }
  26. n['default'] = e;
  27. return Object.freeze(n);
  28. }
  29. var CompilerDOM__namespace = /*#__PURE__*/_interopNamespace(CompilerDOM);
  30. var sourceMap__default = /*#__PURE__*/_interopDefaultLegacy(sourceMap);
  31. var MagicString__default = /*#__PURE__*/_interopDefaultLegacy(MagicString);
  32. var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
  33. var CompilerSSR__namespace = /*#__PURE__*/_interopNamespace(CompilerSSR);
  34. var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
  35. var util__default = /*#__PURE__*/_interopDefaultLegacy(util$2);
  36. var _postcss__default = /*#__PURE__*/_interopDefaultLegacy(_postcss);
  37. function pad (hash, len) {
  38. while (hash.length < len) {
  39. hash = '0' + hash;
  40. }
  41. return hash;
  42. }
  43. function fold (hash, text) {
  44. var i;
  45. var chr;
  46. var len;
  47. if (text.length === 0) {
  48. return hash;
  49. }
  50. for (i = 0, len = text.length; i < len; i++) {
  51. chr = text.charCodeAt(i);
  52. hash = ((hash << 5) - hash) + chr;
  53. hash |= 0;
  54. }
  55. return hash < 0 ? hash * -2 : hash;
  56. }
  57. function foldObject (hash, o, seen) {
  58. return Object.keys(o).sort().reduce(foldKey, hash);
  59. function foldKey (hash, key) {
  60. return foldValue(hash, o[key], key, seen);
  61. }
  62. }
  63. function foldValue (input, value, key, seen) {
  64. var hash = fold(fold(fold(input, key), toString(value)), typeof value);
  65. if (value === null) {
  66. return fold(hash, 'null');
  67. }
  68. if (value === undefined) {
  69. return fold(hash, 'undefined');
  70. }
  71. if (typeof value === 'object' || typeof value === 'function') {
  72. if (seen.indexOf(value) !== -1) {
  73. return fold(hash, '[Circular]' + key);
  74. }
  75. seen.push(value);
  76. var objHash = foldObject(hash, value, seen);
  77. if (!('valueOf' in value) || typeof value.valueOf !== 'function') {
  78. return objHash;
  79. }
  80. try {
  81. return fold(objHash, String(value.valueOf()))
  82. } catch (err) {
  83. return fold(objHash, '[valueOf exception]' + (err.stack || err.message))
  84. }
  85. }
  86. return fold(hash, value.toString());
  87. }
  88. function toString (o) {
  89. return Object.prototype.toString.call(o);
  90. }
  91. function sum (o) {
  92. return pad(foldValue(0, o, '', []).toString(16), 8);
  93. }
  94. var hashSum = sum;
  95. const CSS_VARS_HELPER = `useCssVars`;
  96. function genCssVarsFromList(vars, id, isProd, isSSR = false) {
  97. return `{\n ${vars
  98. .map(key => `"${isSSR ? `--` : ``}${genVarName(id, key, isProd)}": (${key})`)
  99. .join(',\n ')}\n}`;
  100. }
  101. function genVarName(id, raw, isProd) {
  102. if (isProd) {
  103. return hashSum(id + raw);
  104. }
  105. else {
  106. // escape ASCII Punctuation & Symbols
  107. return `${id}-${raw.replace(/[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, s => `\\${s}`)}`;
  108. }
  109. }
  110. function normalizeExpression(exp) {
  111. exp = exp.trim();
  112. if ((exp[0] === `'` && exp[exp.length - 1] === `'`) ||
  113. (exp[0] === `"` && exp[exp.length - 1] === `"`)) {
  114. return exp.slice(1, -1);
  115. }
  116. return exp;
  117. }
  118. const vBindRE = /v-bind\s*\(/g;
  119. function parseCssVars(sfc) {
  120. const vars = [];
  121. sfc.styles.forEach(style => {
  122. let match;
  123. // ignore v-bind() in comments /* ... */
  124. const content = style.content.replace(/\/\*([\s\S]*?)\*\//g, '');
  125. while ((match = vBindRE.exec(content))) {
  126. const start = match.index + match[0].length;
  127. const end = lexBinding(content, start);
  128. if (end !== null) {
  129. const variable = normalizeExpression(content.slice(start, end));
  130. if (!vars.includes(variable)) {
  131. vars.push(variable);
  132. }
  133. }
  134. }
  135. });
  136. return vars;
  137. }
  138. function lexBinding(content, start) {
  139. let state = 0 /* LexerState.inParens */;
  140. let parenDepth = 0;
  141. for (let i = start; i < content.length; i++) {
  142. const char = content.charAt(i);
  143. switch (state) {
  144. case 0 /* LexerState.inParens */:
  145. if (char === `'`) {
  146. state = 1 /* LexerState.inSingleQuoteString */;
  147. }
  148. else if (char === `"`) {
  149. state = 2 /* LexerState.inDoubleQuoteString */;
  150. }
  151. else if (char === `(`) {
  152. parenDepth++;
  153. }
  154. else if (char === `)`) {
  155. if (parenDepth > 0) {
  156. parenDepth--;
  157. }
  158. else {
  159. return i;
  160. }
  161. }
  162. break;
  163. case 1 /* LexerState.inSingleQuoteString */:
  164. if (char === `'`) {
  165. state = 0 /* LexerState.inParens */;
  166. }
  167. break;
  168. case 2 /* LexerState.inDoubleQuoteString */:
  169. if (char === `"`) {
  170. state = 0 /* LexerState.inParens */;
  171. }
  172. break;
  173. }
  174. }
  175. return null;
  176. }
  177. const cssVarsPlugin = opts => {
  178. const { id, isProd } = opts;
  179. return {
  180. postcssPlugin: 'vue-sfc-vars',
  181. Declaration(decl) {
  182. // rewrite CSS variables
  183. const value = decl.value;
  184. if (vBindRE.test(value)) {
  185. vBindRE.lastIndex = 0;
  186. let transformed = '';
  187. let lastIndex = 0;
  188. let match;
  189. while ((match = vBindRE.exec(value))) {
  190. const start = match.index + match[0].length;
  191. const end = lexBinding(value, start);
  192. if (end !== null) {
  193. const variable = normalizeExpression(value.slice(start, end));
  194. transformed +=
  195. value.slice(lastIndex, match.index) +
  196. `var(--${genVarName(id, variable, isProd)})`;
  197. lastIndex = end + 1;
  198. }
  199. }
  200. decl.value = transformed + value.slice(lastIndex);
  201. }
  202. }
  203. };
  204. };
  205. cssVarsPlugin.postcss = true;
  206. function genCssVarsCode(vars, bindings, id, isProd) {
  207. const varsExp = genCssVarsFromList(vars, id, isProd);
  208. const exp = CompilerDOM.createSimpleExpression(varsExp, false);
  209. const context = CompilerDOM.createTransformContext(CompilerDOM.createRoot([]), {
  210. prefixIdentifiers: true,
  211. inline: true,
  212. bindingMetadata: bindings.__isScriptSetup === false ? undefined : bindings
  213. });
  214. const transformed = CompilerDOM.processExpression(exp, context);
  215. const transformedString = transformed.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */
  216. ? transformed.content
  217. : transformed.children
  218. .map(c => {
  219. return typeof c === 'string'
  220. ? c
  221. : c.content;
  222. })
  223. .join('');
  224. return `_${CSS_VARS_HELPER}(_ctx => (${transformedString}))`;
  225. }
  226. // <script setup> already gets the calls injected as part of the transform
  227. // this is only for single normal <script>
  228. function genNormalScriptCssVarsCode(cssVars, bindings, id, isProd) {
  229. return (`\nimport { ${CSS_VARS_HELPER} as _${CSS_VARS_HELPER} } from 'vue'\n` +
  230. `const __injectCSSVars__ = () => {\n${genCssVarsCode(cssVars, bindings, id, isProd)}}\n` +
  231. `const __setup__ = __default__.setup\n` +
  232. `__default__.setup = __setup__\n` +
  233. ` ? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) }\n` +
  234. ` : __injectCSSVars__\n`);
  235. }
  236. var iterator = function (Yallist) {
  237. Yallist.prototype[Symbol.iterator] = function* () {
  238. for (let walker = this.head; walker; walker = walker.next) {
  239. yield walker.value;
  240. }
  241. };
  242. };
  243. var yallist = Yallist;
  244. Yallist.Node = Node;
  245. Yallist.create = Yallist;
  246. function Yallist (list) {
  247. var self = this;
  248. if (!(self instanceof Yallist)) {
  249. self = new Yallist();
  250. }
  251. self.tail = null;
  252. self.head = null;
  253. self.length = 0;
  254. if (list && typeof list.forEach === 'function') {
  255. list.forEach(function (item) {
  256. self.push(item);
  257. });
  258. } else if (arguments.length > 0) {
  259. for (var i = 0, l = arguments.length; i < l; i++) {
  260. self.push(arguments[i]);
  261. }
  262. }
  263. return self
  264. }
  265. Yallist.prototype.removeNode = function (node) {
  266. if (node.list !== this) {
  267. throw new Error('removing node which does not belong to this list')
  268. }
  269. var next = node.next;
  270. var prev = node.prev;
  271. if (next) {
  272. next.prev = prev;
  273. }
  274. if (prev) {
  275. prev.next = next;
  276. }
  277. if (node === this.head) {
  278. this.head = next;
  279. }
  280. if (node === this.tail) {
  281. this.tail = prev;
  282. }
  283. node.list.length--;
  284. node.next = null;
  285. node.prev = null;
  286. node.list = null;
  287. return next
  288. };
  289. Yallist.prototype.unshiftNode = function (node) {
  290. if (node === this.head) {
  291. return
  292. }
  293. if (node.list) {
  294. node.list.removeNode(node);
  295. }
  296. var head = this.head;
  297. node.list = this;
  298. node.next = head;
  299. if (head) {
  300. head.prev = node;
  301. }
  302. this.head = node;
  303. if (!this.tail) {
  304. this.tail = node;
  305. }
  306. this.length++;
  307. };
  308. Yallist.prototype.pushNode = function (node) {
  309. if (node === this.tail) {
  310. return
  311. }
  312. if (node.list) {
  313. node.list.removeNode(node);
  314. }
  315. var tail = this.tail;
  316. node.list = this;
  317. node.prev = tail;
  318. if (tail) {
  319. tail.next = node;
  320. }
  321. this.tail = node;
  322. if (!this.head) {
  323. this.head = node;
  324. }
  325. this.length++;
  326. };
  327. Yallist.prototype.push = function () {
  328. for (var i = 0, l = arguments.length; i < l; i++) {
  329. push(this, arguments[i]);
  330. }
  331. return this.length
  332. };
  333. Yallist.prototype.unshift = function () {
  334. for (var i = 0, l = arguments.length; i < l; i++) {
  335. unshift(this, arguments[i]);
  336. }
  337. return this.length
  338. };
  339. Yallist.prototype.pop = function () {
  340. if (!this.tail) {
  341. return undefined
  342. }
  343. var res = this.tail.value;
  344. this.tail = this.tail.prev;
  345. if (this.tail) {
  346. this.tail.next = null;
  347. } else {
  348. this.head = null;
  349. }
  350. this.length--;
  351. return res
  352. };
  353. Yallist.prototype.shift = function () {
  354. if (!this.head) {
  355. return undefined
  356. }
  357. var res = this.head.value;
  358. this.head = this.head.next;
  359. if (this.head) {
  360. this.head.prev = null;
  361. } else {
  362. this.tail = null;
  363. }
  364. this.length--;
  365. return res
  366. };
  367. Yallist.prototype.forEach = function (fn, thisp) {
  368. thisp = thisp || this;
  369. for (var walker = this.head, i = 0; walker !== null; i++) {
  370. fn.call(thisp, walker.value, i, this);
  371. walker = walker.next;
  372. }
  373. };
  374. Yallist.prototype.forEachReverse = function (fn, thisp) {
  375. thisp = thisp || this;
  376. for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
  377. fn.call(thisp, walker.value, i, this);
  378. walker = walker.prev;
  379. }
  380. };
  381. Yallist.prototype.get = function (n) {
  382. for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
  383. // abort out of the list early if we hit a cycle
  384. walker = walker.next;
  385. }
  386. if (i === n && walker !== null) {
  387. return walker.value
  388. }
  389. };
  390. Yallist.prototype.getReverse = function (n) {
  391. for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
  392. // abort out of the list early if we hit a cycle
  393. walker = walker.prev;
  394. }
  395. if (i === n && walker !== null) {
  396. return walker.value
  397. }
  398. };
  399. Yallist.prototype.map = function (fn, thisp) {
  400. thisp = thisp || this;
  401. var res = new Yallist();
  402. for (var walker = this.head; walker !== null;) {
  403. res.push(fn.call(thisp, walker.value, this));
  404. walker = walker.next;
  405. }
  406. return res
  407. };
  408. Yallist.prototype.mapReverse = function (fn, thisp) {
  409. thisp = thisp || this;
  410. var res = new Yallist();
  411. for (var walker = this.tail; walker !== null;) {
  412. res.push(fn.call(thisp, walker.value, this));
  413. walker = walker.prev;
  414. }
  415. return res
  416. };
  417. Yallist.prototype.reduce = function (fn, initial) {
  418. var acc;
  419. var walker = this.head;
  420. if (arguments.length > 1) {
  421. acc = initial;
  422. } else if (this.head) {
  423. walker = this.head.next;
  424. acc = this.head.value;
  425. } else {
  426. throw new TypeError('Reduce of empty list with no initial value')
  427. }
  428. for (var i = 0; walker !== null; i++) {
  429. acc = fn(acc, walker.value, i);
  430. walker = walker.next;
  431. }
  432. return acc
  433. };
  434. Yallist.prototype.reduceReverse = function (fn, initial) {
  435. var acc;
  436. var walker = this.tail;
  437. if (arguments.length > 1) {
  438. acc = initial;
  439. } else if (this.tail) {
  440. walker = this.tail.prev;
  441. acc = this.tail.value;
  442. } else {
  443. throw new TypeError('Reduce of empty list with no initial value')
  444. }
  445. for (var i = this.length - 1; walker !== null; i--) {
  446. acc = fn(acc, walker.value, i);
  447. walker = walker.prev;
  448. }
  449. return acc
  450. };
  451. Yallist.prototype.toArray = function () {
  452. var arr = new Array(this.length);
  453. for (var i = 0, walker = this.head; walker !== null; i++) {
  454. arr[i] = walker.value;
  455. walker = walker.next;
  456. }
  457. return arr
  458. };
  459. Yallist.prototype.toArrayReverse = function () {
  460. var arr = new Array(this.length);
  461. for (var i = 0, walker = this.tail; walker !== null; i++) {
  462. arr[i] = walker.value;
  463. walker = walker.prev;
  464. }
  465. return arr
  466. };
  467. Yallist.prototype.slice = function (from, to) {
  468. to = to || this.length;
  469. if (to < 0) {
  470. to += this.length;
  471. }
  472. from = from || 0;
  473. if (from < 0) {
  474. from += this.length;
  475. }
  476. var ret = new Yallist();
  477. if (to < from || to < 0) {
  478. return ret
  479. }
  480. if (from < 0) {
  481. from = 0;
  482. }
  483. if (to > this.length) {
  484. to = this.length;
  485. }
  486. for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
  487. walker = walker.next;
  488. }
  489. for (; walker !== null && i < to; i++, walker = walker.next) {
  490. ret.push(walker.value);
  491. }
  492. return ret
  493. };
  494. Yallist.prototype.sliceReverse = function (from, to) {
  495. to = to || this.length;
  496. if (to < 0) {
  497. to += this.length;
  498. }
  499. from = from || 0;
  500. if (from < 0) {
  501. from += this.length;
  502. }
  503. var ret = new Yallist();
  504. if (to < from || to < 0) {
  505. return ret
  506. }
  507. if (from < 0) {
  508. from = 0;
  509. }
  510. if (to > this.length) {
  511. to = this.length;
  512. }
  513. for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
  514. walker = walker.prev;
  515. }
  516. for (; walker !== null && i > from; i--, walker = walker.prev) {
  517. ret.push(walker.value);
  518. }
  519. return ret
  520. };
  521. Yallist.prototype.splice = function (start, deleteCount /*, ...nodes */) {
  522. if (start > this.length) {
  523. start = this.length - 1;
  524. }
  525. if (start < 0) {
  526. start = this.length + start;
  527. }
  528. for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
  529. walker = walker.next;
  530. }
  531. var ret = [];
  532. for (var i = 0; walker && i < deleteCount; i++) {
  533. ret.push(walker.value);
  534. walker = this.removeNode(walker);
  535. }
  536. if (walker === null) {
  537. walker = this.tail;
  538. }
  539. if (walker !== this.head && walker !== this.tail) {
  540. walker = walker.prev;
  541. }
  542. for (var i = 2; i < arguments.length; i++) {
  543. walker = insert(this, walker, arguments[i]);
  544. }
  545. return ret;
  546. };
  547. Yallist.prototype.reverse = function () {
  548. var head = this.head;
  549. var tail = this.tail;
  550. for (var walker = head; walker !== null; walker = walker.prev) {
  551. var p = walker.prev;
  552. walker.prev = walker.next;
  553. walker.next = p;
  554. }
  555. this.head = tail;
  556. this.tail = head;
  557. return this
  558. };
  559. function insert (self, node, value) {
  560. var inserted = node === self.head ?
  561. new Node(value, null, node, self) :
  562. new Node(value, node, node.next, self);
  563. if (inserted.next === null) {
  564. self.tail = inserted;
  565. }
  566. if (inserted.prev === null) {
  567. self.head = inserted;
  568. }
  569. self.length++;
  570. return inserted
  571. }
  572. function push (self, item) {
  573. self.tail = new Node(item, self.tail, null, self);
  574. if (!self.head) {
  575. self.head = self.tail;
  576. }
  577. self.length++;
  578. }
  579. function unshift (self, item) {
  580. self.head = new Node(item, null, self.head, self);
  581. if (!self.tail) {
  582. self.tail = self.head;
  583. }
  584. self.length++;
  585. }
  586. function Node (value, prev, next, list) {
  587. if (!(this instanceof Node)) {
  588. return new Node(value, prev, next, list)
  589. }
  590. this.list = list;
  591. this.value = value;
  592. if (prev) {
  593. prev.next = this;
  594. this.prev = prev;
  595. } else {
  596. this.prev = null;
  597. }
  598. if (next) {
  599. next.prev = this;
  600. this.next = next;
  601. } else {
  602. this.next = null;
  603. }
  604. }
  605. try {
  606. // add if support for Symbol.iterator is present
  607. iterator(Yallist);
  608. } catch (er) {}
  609. // A linked list to keep track of recently-used-ness
  610. const MAX = Symbol('max');
  611. const LENGTH = Symbol('length');
  612. const LENGTH_CALCULATOR = Symbol('lengthCalculator');
  613. const ALLOW_STALE = Symbol('allowStale');
  614. const MAX_AGE = Symbol('maxAge');
  615. const DISPOSE = Symbol('dispose');
  616. const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet');
  617. const LRU_LIST = Symbol('lruList');
  618. const CACHE = Symbol('cache');
  619. const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet');
  620. const naiveLength = () => 1;
  621. // lruList is a yallist where the head is the youngest
  622. // item, and the tail is the oldest. the list contains the Hit
  623. // objects as the entries.
  624. // Each Hit object has a reference to its Yallist.Node. This
  625. // never changes.
  626. //
  627. // cache is a Map (or PseudoMap) that matches the keys to
  628. // the Yallist.Node object.
  629. class LRUCache {
  630. constructor (options) {
  631. if (typeof options === 'number')
  632. options = { max: options };
  633. if (!options)
  634. options = {};
  635. if (options.max && (typeof options.max !== 'number' || options.max < 0))
  636. throw new TypeError('max must be a non-negative number')
  637. // Kind of weird to have a default max of Infinity, but oh well.
  638. this[MAX] = options.max || Infinity;
  639. const lc = options.length || naiveLength;
  640. this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc;
  641. this[ALLOW_STALE] = options.stale || false;
  642. if (options.maxAge && typeof options.maxAge !== 'number')
  643. throw new TypeError('maxAge must be a number')
  644. this[MAX_AGE] = options.maxAge || 0;
  645. this[DISPOSE] = options.dispose;
  646. this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
  647. this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
  648. this.reset();
  649. }
  650. // resize the cache when the max changes.
  651. set max (mL) {
  652. if (typeof mL !== 'number' || mL < 0)
  653. throw new TypeError('max must be a non-negative number')
  654. this[MAX] = mL || Infinity;
  655. trim(this);
  656. }
  657. get max () {
  658. return this[MAX]
  659. }
  660. set allowStale (allowStale) {
  661. this[ALLOW_STALE] = !!allowStale;
  662. }
  663. get allowStale () {
  664. return this[ALLOW_STALE]
  665. }
  666. set maxAge (mA) {
  667. if (typeof mA !== 'number')
  668. throw new TypeError('maxAge must be a non-negative number')
  669. this[MAX_AGE] = mA;
  670. trim(this);
  671. }
  672. get maxAge () {
  673. return this[MAX_AGE]
  674. }
  675. // resize the cache when the lengthCalculator changes.
  676. set lengthCalculator (lC) {
  677. if (typeof lC !== 'function')
  678. lC = naiveLength;
  679. if (lC !== this[LENGTH_CALCULATOR]) {
  680. this[LENGTH_CALCULATOR] = lC;
  681. this[LENGTH] = 0;
  682. this[LRU_LIST].forEach(hit => {
  683. hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
  684. this[LENGTH] += hit.length;
  685. });
  686. }
  687. trim(this);
  688. }
  689. get lengthCalculator () { return this[LENGTH_CALCULATOR] }
  690. get length () { return this[LENGTH] }
  691. get itemCount () { return this[LRU_LIST].length }
  692. rforEach (fn, thisp) {
  693. thisp = thisp || this;
  694. for (let walker = this[LRU_LIST].tail; walker !== null;) {
  695. const prev = walker.prev;
  696. forEachStep(this, fn, walker, thisp);
  697. walker = prev;
  698. }
  699. }
  700. forEach (fn, thisp) {
  701. thisp = thisp || this;
  702. for (let walker = this[LRU_LIST].head; walker !== null;) {
  703. const next = walker.next;
  704. forEachStep(this, fn, walker, thisp);
  705. walker = next;
  706. }
  707. }
  708. keys () {
  709. return this[LRU_LIST].toArray().map(k => k.key)
  710. }
  711. values () {
  712. return this[LRU_LIST].toArray().map(k => k.value)
  713. }
  714. reset () {
  715. if (this[DISPOSE] &&
  716. this[LRU_LIST] &&
  717. this[LRU_LIST].length) {
  718. this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value));
  719. }
  720. this[CACHE] = new Map(); // hash of items by key
  721. this[LRU_LIST] = new yallist(); // list of items in order of use recency
  722. this[LENGTH] = 0; // length of items in the list
  723. }
  724. dump () {
  725. return this[LRU_LIST].map(hit =>
  726. isStale(this, hit) ? false : {
  727. k: hit.key,
  728. v: hit.value,
  729. e: hit.now + (hit.maxAge || 0)
  730. }).toArray().filter(h => h)
  731. }
  732. dumpLru () {
  733. return this[LRU_LIST]
  734. }
  735. set (key, value, maxAge) {
  736. maxAge = maxAge || this[MAX_AGE];
  737. if (maxAge && typeof maxAge !== 'number')
  738. throw new TypeError('maxAge must be a number')
  739. const now = maxAge ? Date.now() : 0;
  740. const len = this[LENGTH_CALCULATOR](value, key);
  741. if (this[CACHE].has(key)) {
  742. if (len > this[MAX]) {
  743. del(this, this[CACHE].get(key));
  744. return false
  745. }
  746. const node = this[CACHE].get(key);
  747. const item = node.value;
  748. // dispose of the old one before overwriting
  749. // split out into 2 ifs for better coverage tracking
  750. if (this[DISPOSE]) {
  751. if (!this[NO_DISPOSE_ON_SET])
  752. this[DISPOSE](key, item.value);
  753. }
  754. item.now = now;
  755. item.maxAge = maxAge;
  756. item.value = value;
  757. this[LENGTH] += len - item.length;
  758. item.length = len;
  759. this.get(key);
  760. trim(this);
  761. return true
  762. }
  763. const hit = new Entry(key, value, len, now, maxAge);
  764. // oversized objects fall out of cache automatically.
  765. if (hit.length > this[MAX]) {
  766. if (this[DISPOSE])
  767. this[DISPOSE](key, value);
  768. return false
  769. }
  770. this[LENGTH] += hit.length;
  771. this[LRU_LIST].unshift(hit);
  772. this[CACHE].set(key, this[LRU_LIST].head);
  773. trim(this);
  774. return true
  775. }
  776. has (key) {
  777. if (!this[CACHE].has(key)) return false
  778. const hit = this[CACHE].get(key).value;
  779. return !isStale(this, hit)
  780. }
  781. get (key) {
  782. return get(this, key, true)
  783. }
  784. peek (key) {
  785. return get(this, key, false)
  786. }
  787. pop () {
  788. const node = this[LRU_LIST].tail;
  789. if (!node)
  790. return null
  791. del(this, node);
  792. return node.value
  793. }
  794. del (key) {
  795. del(this, this[CACHE].get(key));
  796. }
  797. load (arr) {
  798. // reset the cache
  799. this.reset();
  800. const now = Date.now();
  801. // A previous serialized cache has the most recent items first
  802. for (let l = arr.length - 1; l >= 0; l--) {
  803. const hit = arr[l];
  804. const expiresAt = hit.e || 0;
  805. if (expiresAt === 0)
  806. // the item was created without expiration in a non aged cache
  807. this.set(hit.k, hit.v);
  808. else {
  809. const maxAge = expiresAt - now;
  810. // dont add already expired items
  811. if (maxAge > 0) {
  812. this.set(hit.k, hit.v, maxAge);
  813. }
  814. }
  815. }
  816. }
  817. prune () {
  818. this[CACHE].forEach((value, key) => get(this, key, false));
  819. }
  820. }
  821. const get = (self, key, doUse) => {
  822. const node = self[CACHE].get(key);
  823. if (node) {
  824. const hit = node.value;
  825. if (isStale(self, hit)) {
  826. del(self, node);
  827. if (!self[ALLOW_STALE])
  828. return undefined
  829. } else {
  830. if (doUse) {
  831. if (self[UPDATE_AGE_ON_GET])
  832. node.value.now = Date.now();
  833. self[LRU_LIST].unshiftNode(node);
  834. }
  835. }
  836. return hit.value
  837. }
  838. };
  839. const isStale = (self, hit) => {
  840. if (!hit || (!hit.maxAge && !self[MAX_AGE]))
  841. return false
  842. const diff = Date.now() - hit.now;
  843. return hit.maxAge ? diff > hit.maxAge
  844. : self[MAX_AGE] && (diff > self[MAX_AGE])
  845. };
  846. const trim = self => {
  847. if (self[LENGTH] > self[MAX]) {
  848. for (let walker = self[LRU_LIST].tail;
  849. self[LENGTH] > self[MAX] && walker !== null;) {
  850. // We know that we're about to delete this one, and also
  851. // what the next least recently used key will be, so just
  852. // go ahead and set it now.
  853. const prev = walker.prev;
  854. del(self, walker);
  855. walker = prev;
  856. }
  857. }
  858. };
  859. const del = (self, node) => {
  860. if (node) {
  861. const hit = node.value;
  862. if (self[DISPOSE])
  863. self[DISPOSE](hit.key, hit.value);
  864. self[LENGTH] -= hit.length;
  865. self[CACHE].delete(hit.key);
  866. self[LRU_LIST].removeNode(node);
  867. }
  868. };
  869. class Entry {
  870. constructor (key, value, length, now, maxAge) {
  871. this.key = key;
  872. this.value = value;
  873. this.length = length;
  874. this.now = now;
  875. this.maxAge = maxAge || 0;
  876. }
  877. }
  878. const forEachStep = (self, fn, node, thisp) => {
  879. let hit = node.value;
  880. if (isStale(self, hit)) {
  881. del(self, node);
  882. if (!self[ALLOW_STALE])
  883. hit = undefined;
  884. }
  885. if (hit)
  886. fn.call(thisp, hit.value, hit.key, self);
  887. };
  888. var lruCache = LRUCache;
  889. function createCache(size = 500) {
  890. return new lruCache(size);
  891. }
  892. function isRelativeUrl(url) {
  893. const firstChar = url.charAt(0);
  894. return firstChar === '.' || firstChar === '~' || firstChar === '@';
  895. }
  896. const externalRE = /^(https?:)?\/\//;
  897. function isExternalUrl(url) {
  898. return externalRE.test(url);
  899. }
  900. const dataUrlRE = /^\s*data:/i;
  901. function isDataUrl(url) {
  902. return dataUrlRE.test(url);
  903. }
  904. /**
  905. * Parses string url into URL object.
  906. */
  907. function parseUrl(url) {
  908. const firstChar = url.charAt(0);
  909. if (firstChar === '~') {
  910. const secondChar = url.charAt(1);
  911. url = url.slice(secondChar === '/' ? 2 : 1);
  912. }
  913. return parseUriParts(url);
  914. }
  915. /**
  916. * vuejs/component-compiler-utils#22 Support uri fragment in transformed require
  917. * @param urlString an url as a string
  918. */
  919. function parseUriParts(urlString) {
  920. // A TypeError is thrown if urlString is not a string
  921. // @see https://nodejs.org/api/url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost
  922. return url.parse(shared.isString(urlString) ? urlString : '', false, true);
  923. }
  924. const defaultAssetUrlOptions = {
  925. base: null,
  926. includeAbsolute: false,
  927. tags: {
  928. video: ['src', 'poster'],
  929. source: ['src'],
  930. img: ['src'],
  931. image: ['xlink:href', 'href'],
  932. use: ['xlink:href', 'href']
  933. }
  934. };
  935. const normalizeOptions = (options) => {
  936. if (Object.keys(options).some(key => shared.isArray(options[key]))) {
  937. // legacy option format which directly passes in tags config
  938. return {
  939. ...defaultAssetUrlOptions,
  940. tags: options
  941. };
  942. }
  943. return {
  944. ...defaultAssetUrlOptions,
  945. ...options
  946. };
  947. };
  948. const createAssetUrlTransformWithOptions = (options) => {
  949. return (node, context) => transformAssetUrl(node, context, options);
  950. };
  951. /**
  952. * A `@vue/compiler-core` plugin that transforms relative asset urls into
  953. * either imports or absolute urls.
  954. *
  955. * ``` js
  956. * // Before
  957. * createVNode('img', { src: './logo.png' })
  958. *
  959. * // After
  960. * import _imports_0 from './logo.png'
  961. * createVNode('img', { src: _imports_0 })
  962. * ```
  963. */
  964. const transformAssetUrl = (node, context, options = defaultAssetUrlOptions) => {
  965. if (node.type === 1 /* NodeTypes.ELEMENT */) {
  966. if (!node.props.length) {
  967. return;
  968. }
  969. const tags = options.tags || defaultAssetUrlOptions.tags;
  970. const attrs = tags[node.tag];
  971. const wildCardAttrs = tags['*'];
  972. if (!attrs && !wildCardAttrs) {
  973. return;
  974. }
  975. const assetAttrs = (attrs || []).concat(wildCardAttrs || []);
  976. node.props.forEach((attr, index) => {
  977. if (attr.type !== 6 /* NodeTypes.ATTRIBUTE */ ||
  978. !assetAttrs.includes(attr.name) ||
  979. !attr.value ||
  980. isExternalUrl(attr.value.content) ||
  981. isDataUrl(attr.value.content) ||
  982. attr.value.content[0] === '#' ||
  983. (!options.includeAbsolute && !isRelativeUrl(attr.value.content))) {
  984. return;
  985. }
  986. const url = parseUrl(attr.value.content);
  987. if (options.base && attr.value.content[0] === '.') {
  988. // explicit base - directly rewrite relative urls into absolute url
  989. // to avoid generating extra imports
  990. // Allow for full hostnames provided in options.base
  991. const base = parseUrl(options.base);
  992. const protocol = base.protocol || '';
  993. const host = base.host ? protocol + '//' + base.host : '';
  994. const basePath = base.path || '/';
  995. // when packaged in the browser, path will be using the posix-
  996. // only version provided by rollup-plugin-node-builtins.
  997. attr.value.content =
  998. host +
  999. (path__default.posix || path__default).join(basePath, url.path + (url.hash || ''));
  1000. return;
  1001. }
  1002. // otherwise, transform the url into an import.
  1003. // this assumes a bundler will resolve the import into the correct
  1004. // absolute url (e.g. webpack file-loader)
  1005. const exp = getImportsExpressionExp(url.path, url.hash, attr.loc, context);
  1006. node.props[index] = {
  1007. type: 7 /* NodeTypes.DIRECTIVE */,
  1008. name: 'bind',
  1009. arg: compilerCore.createSimpleExpression(attr.name, true, attr.loc),
  1010. exp,
  1011. modifiers: [],
  1012. loc: attr.loc
  1013. };
  1014. });
  1015. }
  1016. };
  1017. function getImportsExpressionExp(path, hash, loc, context) {
  1018. if (path) {
  1019. let name;
  1020. let exp;
  1021. const existingIndex = context.imports.findIndex(i => i.path === path);
  1022. if (existingIndex > -1) {
  1023. name = `_imports_${existingIndex}`;
  1024. exp = context.imports[existingIndex].exp;
  1025. }
  1026. else {
  1027. name = `_imports_${context.imports.length}`;
  1028. exp = compilerCore.createSimpleExpression(name, false, loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
  1029. context.imports.push({ exp, path });
  1030. }
  1031. if (!hash) {
  1032. return exp;
  1033. }
  1034. const hashExp = `${name} + '${hash}'`;
  1035. const finalExp = compilerCore.createSimpleExpression(hashExp, false, loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
  1036. if (!context.hoistStatic) {
  1037. return finalExp;
  1038. }
  1039. const existingHoistIndex = context.hoists.findIndex(h => {
  1040. return (h &&
  1041. h.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
  1042. !h.isStatic &&
  1043. h.content === hashExp);
  1044. });
  1045. if (existingHoistIndex > -1) {
  1046. return compilerCore.createSimpleExpression(`_hoisted_${existingHoistIndex + 1}`, false, loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
  1047. }
  1048. return context.hoist(finalExp);
  1049. }
  1050. else {
  1051. return compilerCore.createSimpleExpression(`''`, false, loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
  1052. }
  1053. }
  1054. const srcsetTags = ['img', 'source'];
  1055. // http://w3c.github.io/html/semantics-embedded-content.html#ref-for-image-candidate-string-5
  1056. const escapedSpaceCharacters = /( |\\t|\\n|\\f|\\r)+/g;
  1057. const createSrcsetTransformWithOptions = (options) => {
  1058. return (node, context) => transformSrcset(node, context, options);
  1059. };
  1060. const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
  1061. if (node.type === 1 /* NodeTypes.ELEMENT */) {
  1062. if (srcsetTags.includes(node.tag) && node.props.length) {
  1063. node.props.forEach((attr, index) => {
  1064. if (attr.name === 'srcset' && attr.type === 6 /* NodeTypes.ATTRIBUTE */) {
  1065. if (!attr.value)
  1066. return;
  1067. const value = attr.value.content;
  1068. if (!value)
  1069. return;
  1070. const imageCandidates = value.split(',').map(s => {
  1071. // The attribute value arrives here with all whitespace, except
  1072. // normal spaces, represented by escape sequences
  1073. const [url, descriptor] = s
  1074. .replace(escapedSpaceCharacters, ' ')
  1075. .trim()
  1076. .split(' ', 2);
  1077. return { url, descriptor };
  1078. });
  1079. // data urls contains comma after the encoding so we need to re-merge
  1080. // them
  1081. for (let i = 0; i < imageCandidates.length; i++) {
  1082. const { url } = imageCandidates[i];
  1083. if (isDataUrl(url)) {
  1084. imageCandidates[i + 1].url =
  1085. url + ',' + imageCandidates[i + 1].url;
  1086. imageCandidates.splice(i, 1);
  1087. }
  1088. }
  1089. const shouldProcessUrl = (url) => {
  1090. return (!isExternalUrl(url) &&
  1091. !isDataUrl(url) &&
  1092. (options.includeAbsolute || isRelativeUrl(url)));
  1093. };
  1094. // When srcset does not contain any qualified URLs, skip transforming
  1095. if (!imageCandidates.some(({ url }) => shouldProcessUrl(url))) {
  1096. return;
  1097. }
  1098. if (options.base) {
  1099. const base = options.base;
  1100. const set = [];
  1101. let needImportTransform = false;
  1102. imageCandidates.forEach(candidate => {
  1103. let { url, descriptor } = candidate;
  1104. descriptor = descriptor ? ` ${descriptor}` : ``;
  1105. if (url[0] === '.') {
  1106. candidate.url = (path__default.posix || path__default).join(base, url);
  1107. set.push(candidate.url + descriptor);
  1108. }
  1109. else if (shouldProcessUrl(url)) {
  1110. needImportTransform = true;
  1111. }
  1112. else {
  1113. set.push(url + descriptor);
  1114. }
  1115. });
  1116. if (!needImportTransform) {
  1117. attr.value.content = set.join(', ');
  1118. return;
  1119. }
  1120. }
  1121. const compoundExpression = compilerCore.createCompoundExpression([], attr.loc);
  1122. imageCandidates.forEach(({ url, descriptor }, index) => {
  1123. if (shouldProcessUrl(url)) {
  1124. const { path } = parseUrl(url);
  1125. let exp;
  1126. if (path) {
  1127. const existingImportsIndex = context.imports.findIndex(i => i.path === path);
  1128. if (existingImportsIndex > -1) {
  1129. exp = compilerCore.createSimpleExpression(`_imports_${existingImportsIndex}`, false, attr.loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
  1130. }
  1131. else {
  1132. exp = compilerCore.createSimpleExpression(`_imports_${context.imports.length}`, false, attr.loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
  1133. context.imports.push({ exp, path });
  1134. }
  1135. compoundExpression.children.push(exp);
  1136. }
  1137. }
  1138. else {
  1139. const exp = compilerCore.createSimpleExpression(`"${url}"`, false, attr.loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
  1140. compoundExpression.children.push(exp);
  1141. }
  1142. const isNotLast = imageCandidates.length - 1 > index;
  1143. if (descriptor && isNotLast) {
  1144. compoundExpression.children.push(` + ' ${descriptor}, ' + `);
  1145. }
  1146. else if (descriptor) {
  1147. compoundExpression.children.push(` + ' ${descriptor}'`);
  1148. }
  1149. else if (isNotLast) {
  1150. compoundExpression.children.push(` + ', ' + `);
  1151. }
  1152. });
  1153. let exp = compoundExpression;
  1154. if (context.hoistStatic) {
  1155. exp = context.hoist(compoundExpression);
  1156. exp.constType = 3 /* ConstantTypes.CAN_STRINGIFY */;
  1157. }
  1158. node.props[index] = {
  1159. type: 7 /* NodeTypes.DIRECTIVE */,
  1160. name: 'bind',
  1161. arg: compilerCore.createSimpleExpression('srcset', true, attr.loc),
  1162. exp,
  1163. modifiers: [],
  1164. loc: attr.loc
  1165. };
  1166. }
  1167. });
  1168. }
  1169. }
  1170. };
  1171. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  1172. function getDefaultExportFromCjs (x) {
  1173. return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
  1174. }
  1175. function getAugmentedNamespace(n) {
  1176. if (n.__esModule) return n;
  1177. var a = Object.defineProperty({}, '__esModule', {value: true});
  1178. Object.keys(n).forEach(function (k) {
  1179. var d = Object.getOwnPropertyDescriptor(n, k);
  1180. Object.defineProperty(a, k, d.get ? d : {
  1181. enumerable: true,
  1182. get: function () {
  1183. return n[k];
  1184. }
  1185. });
  1186. });
  1187. return a;
  1188. }
  1189. function createCommonjsModule(fn) {
  1190. var module = { exports: {} };
  1191. return fn(module, module.exports), module.exports;
  1192. }
  1193. function commonjsRequire (path) {
  1194. throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
  1195. }
  1196. var consolidate = createCommonjsModule(function (module, exports) {
  1197. /*
  1198. * Engines which do not support caching of their file contents
  1199. * should use the `read()` function defined in consolidate.js
  1200. * On top of this, when an engine compiles to a `Function`,
  1201. * these functions should either be cached within consolidate.js
  1202. * or the engine itself via `options.cache`. This will allow
  1203. * users and frameworks to pass `options.cache = true` for
  1204. * `NODE_ENV=production`, however edit the file(s) without
  1205. * re-loading the application in development.
  1206. */
  1207. /**
  1208. * Module dependencies.
  1209. */
  1210. var path = path__default;
  1211. var join = path.join;
  1212. var resolve = path.resolve;
  1213. var extname = path.extname;
  1214. var dirname = path.dirname;
  1215. var isAbsolute = path.isAbsolute;
  1216. var readCache = {};
  1217. /**
  1218. * Require cache.
  1219. */
  1220. var cacheStore = {};
  1221. /**
  1222. * Require cache.
  1223. */
  1224. var requires = {};
  1225. /**
  1226. * Clear the cache.
  1227. *
  1228. * @api public
  1229. */
  1230. exports.clearCache = function() {
  1231. readCache = {};
  1232. cacheStore = {};
  1233. };
  1234. /**
  1235. * Conditionally cache `compiled` template based
  1236. * on the `options` filename and `.cache` boolean.
  1237. *
  1238. * @param {Object} options
  1239. * @param {Function} compiled
  1240. * @return {Function}
  1241. * @api private
  1242. */
  1243. function cache(options, compiled) {
  1244. // cachable
  1245. if (compiled && options.filename && options.cache) {
  1246. delete readCache[options.filename];
  1247. cacheStore[options.filename] = compiled;
  1248. return compiled;
  1249. }
  1250. // check cache
  1251. if (options.filename && options.cache) {
  1252. return cacheStore[options.filename];
  1253. }
  1254. return compiled;
  1255. }
  1256. /**
  1257. * Read `path` with `options` with
  1258. * callback `(err, str)`. When `options.cache`
  1259. * is true the template string will be cached.
  1260. *
  1261. * @param {String} options
  1262. * @param {Function} cb
  1263. * @api private
  1264. */
  1265. function read(path, options, cb) {
  1266. var str = readCache[path];
  1267. var cached = options.cache && str && typeof str === 'string';
  1268. // cached (only if cached is a string and not a compiled template function)
  1269. if (cached) return cb(null, str);
  1270. // read
  1271. fs__default.readFile(path, 'utf8', function(err, str) {
  1272. if (err) return cb(err);
  1273. // remove extraneous utf8 BOM marker
  1274. str = str.replace(/^\uFEFF/, '');
  1275. if (options.cache) readCache[path] = str;
  1276. cb(null, str);
  1277. });
  1278. }
  1279. /**
  1280. * Read `path` with `options` with
  1281. * callback `(err, str)`. When `options.cache`
  1282. * is true the partial string will be cached.
  1283. *
  1284. * @param {String} options
  1285. * @param {Function} fn
  1286. * @api private
  1287. */
  1288. function readPartials(path, options, cb) {
  1289. if (!options.partials) return cb();
  1290. var keys = Object.keys(options.partials);
  1291. var partials = {};
  1292. function next(index) {
  1293. if (index === keys.length) return cb(null, partials);
  1294. var key = keys[index];
  1295. var partialPath = options.partials[key];
  1296. if (partialPath === undefined || partialPath === null || partialPath === false) {
  1297. return next(++index);
  1298. }
  1299. var file;
  1300. if (isAbsolute(partialPath)) {
  1301. if (extname(partialPath) !== '') {
  1302. file = partialPath;
  1303. } else {
  1304. file = join(partialPath + extname(path));
  1305. }
  1306. } else {
  1307. file = join(dirname(path), partialPath + extname(path));
  1308. }
  1309. read(file, options, function(err, str) {
  1310. if (err) return cb(err);
  1311. partials[key] = str;
  1312. next(++index);
  1313. });
  1314. }
  1315. next(0);
  1316. }
  1317. /**
  1318. * promisify
  1319. */
  1320. function promisify(cb, fn) {
  1321. return new Promise(function(resolve, reject) {
  1322. cb = cb || function(err, html) {
  1323. if (err) {
  1324. return reject(err);
  1325. }
  1326. resolve(html);
  1327. };
  1328. fn(cb);
  1329. });
  1330. }
  1331. /**
  1332. * fromStringRenderer
  1333. */
  1334. function fromStringRenderer(name) {
  1335. return function(path, options, cb) {
  1336. options.filename = path;
  1337. return promisify(cb, function(cb) {
  1338. readPartials(path, options, function(err, partials) {
  1339. var extend = (requires.extend || (requires.extend = util__default._extend));
  1340. var opts = extend({}, options);
  1341. opts.partials = partials;
  1342. if (err) return cb(err);
  1343. if (cache(opts)) {
  1344. exports[name].render('', opts, cb);
  1345. } else {
  1346. read(path, opts, function(err, str) {
  1347. if (err) return cb(err);
  1348. exports[name].render(str, opts, cb);
  1349. });
  1350. }
  1351. });
  1352. });
  1353. };
  1354. }
  1355. /**
  1356. * velocity support.
  1357. */
  1358. exports.velocityjs = fromStringRenderer('velocityjs');
  1359. /**
  1360. * velocity string support.
  1361. */
  1362. exports.velocityjs.render = function(str, options, cb) {
  1363. return promisify(cb, function(cb) {
  1364. var engine = requires.velocityjs || (requires.velocityjs = require('velocityjs'));
  1365. try {
  1366. options.locals = options;
  1367. cb(null, engine.render(str, options).trimLeft());
  1368. } catch (err) {
  1369. cb(err);
  1370. }
  1371. });
  1372. };
  1373. /**
  1374. * Liquid support.
  1375. */
  1376. exports.liquid = fromStringRenderer('liquid');
  1377. /**
  1378. * Liquid string support.
  1379. */
  1380. /**
  1381. * Note that in order to get filters and custom tags we've had to push
  1382. * all user-defined locals down into @locals. However, just to make things
  1383. * backwards-compatible, any property of `options` that is left after
  1384. * processing and removing `locals`, `meta`, `filters`, `customTags` and
  1385. * `includeDir` will also become a local.
  1386. */
  1387. function _renderTinyliquid(engine, str, options, cb) {
  1388. var context = engine.newContext();
  1389. var k;
  1390. /**
  1391. * Note that there's a bug in the library that doesn't allow us to pass
  1392. * the locals to newContext(), hence looping through the keys:
  1393. */
  1394. if (options.locals) {
  1395. for (k in options.locals) {
  1396. context.setLocals(k, options.locals[k]);
  1397. }
  1398. delete options.locals;
  1399. }
  1400. if (options.meta) {
  1401. context.setLocals('page', options.meta);
  1402. delete options.meta;
  1403. }
  1404. /**
  1405. * Add any defined filters:
  1406. */
  1407. if (options.filters) {
  1408. for (k in options.filters) {
  1409. context.setFilter(k, options.filters[k]);
  1410. }
  1411. delete options.filters;
  1412. }
  1413. /**
  1414. * Set up a callback for the include directory:
  1415. */
  1416. var includeDir = options.includeDir || process.cwd();
  1417. context.onInclude(function(name, callback) {
  1418. var extname = path.extname(name) ? '' : '.liquid';
  1419. var filename = path.resolve(includeDir, name + extname);
  1420. fs__default.readFile(filename, {encoding: 'utf8'}, function(err, data) {
  1421. if (err) return callback(err);
  1422. callback(null, engine.parse(data));
  1423. });
  1424. });
  1425. delete options.includeDir;
  1426. /**
  1427. * The custom tag functions need to have their results pushed back
  1428. * through the parser, so set up a shim before calling the provided
  1429. * callback:
  1430. */
  1431. var compileOptions = {
  1432. customTags: {}
  1433. };
  1434. if (options.customTags) {
  1435. var tagFunctions = options.customTags;
  1436. for (k in options.customTags) {
  1437. /*Tell jshint there's no problem with having this function in the loop */
  1438. /*jshint -W083 */
  1439. compileOptions.customTags[k] = function(context, name, body) {
  1440. var tpl = tagFunctions[name](body.trim());
  1441. context.astStack.push(engine.parse(tpl));
  1442. };
  1443. /*jshint +W083 */
  1444. }
  1445. delete options.customTags;
  1446. }
  1447. /**
  1448. * Now anything left in `options` becomes a local:
  1449. */
  1450. for (k in options) {
  1451. context.setLocals(k, options[k]);
  1452. }
  1453. /**
  1454. * Finally, execute the template:
  1455. */
  1456. var tmpl = cache(context) || cache(context, engine.compile(str, compileOptions));
  1457. tmpl(context, cb);
  1458. }
  1459. exports.liquid.render = function(str, options, cb) {
  1460. return promisify(cb, function(cb) {
  1461. var engine = requires.liquid;
  1462. var Liquid;
  1463. try {
  1464. // set up tinyliquid engine
  1465. engine = requires.liquid = require('tinyliquid');
  1466. // use tinyliquid engine
  1467. _renderTinyliquid(engine, str, options, cb);
  1468. return;
  1469. } catch (err) {
  1470. // set up liquid-node engine
  1471. try {
  1472. Liquid = requires.liquid = require('liquid-node');
  1473. engine = new Liquid.Engine();
  1474. } catch (err) {
  1475. throw err;
  1476. }
  1477. }
  1478. // use liquid-node engine
  1479. try {
  1480. var locals = options.locals || {};
  1481. if (options.meta) {
  1482. locals.pages = options.meta;
  1483. delete options.meta;
  1484. }
  1485. /**
  1486. * Add any defined filters:
  1487. */
  1488. if (options.filters) {
  1489. engine.registerFilters(options.filters);
  1490. delete options.filters;
  1491. }
  1492. /**
  1493. * Set up a callback for the include directory:
  1494. */
  1495. var includeDir = options.includeDir || process.cwd();
  1496. engine.fileSystem = new Liquid.LocalFileSystem(includeDir, 'liquid');
  1497. delete options.includeDir;
  1498. /**
  1499. * The custom tag functions need to have their results pushed back
  1500. * through the parser, so set up a shim before calling the provided
  1501. * callback:
  1502. */
  1503. if (options.customTags) {
  1504. var tagFunctions = options.customTags;
  1505. for (k in options.customTags) {
  1506. engine.registerTag(k, tagFunctions[k]);
  1507. }
  1508. delete options.customTags;
  1509. }
  1510. /**
  1511. * Now anything left in `options` becomes a local:
  1512. */
  1513. for (var k in options) {
  1514. locals[k] = options[k];
  1515. }
  1516. /**
  1517. * Finally, execute the template:
  1518. */
  1519. return engine
  1520. .parseAndRender(str, locals)
  1521. .nodeify(function(err, result) {
  1522. if (err) {
  1523. throw new Error(err);
  1524. } else {
  1525. return cb(null, result);
  1526. }
  1527. });
  1528. } catch (err) {
  1529. cb(err);
  1530. }
  1531. });
  1532. };
  1533. /**
  1534. * Jade support.
  1535. */
  1536. exports.jade = function(path, options, cb) {
  1537. return promisify(cb, function(cb) {
  1538. var engine = requires.jade;
  1539. if (!engine) {
  1540. try {
  1541. engine = requires.jade = require('jade');
  1542. } catch (err) {
  1543. try {
  1544. engine = requires.jade = require('then-jade');
  1545. } catch (otherError) {
  1546. throw err;
  1547. }
  1548. }
  1549. }
  1550. try {
  1551. var tmpl = cache(options) || cache(options, engine.compileFile(path, options));
  1552. cb(null, tmpl(options));
  1553. } catch (err) {
  1554. cb(err);
  1555. }
  1556. });
  1557. };
  1558. /**
  1559. * Jade string support.
  1560. */
  1561. exports.jade.render = function(str, options, cb) {
  1562. return promisify(cb, function(cb) {
  1563. var engine = requires.jade;
  1564. if (!engine) {
  1565. try {
  1566. engine = requires.jade = require('jade');
  1567. } catch (err) {
  1568. try {
  1569. engine = requires.jade = require('then-jade');
  1570. } catch (otherError) {
  1571. throw err;
  1572. }
  1573. }
  1574. }
  1575. try {
  1576. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1577. cb(null, tmpl(options));
  1578. } catch (err) {
  1579. cb(err);
  1580. }
  1581. });
  1582. };
  1583. /**
  1584. * Dust support.
  1585. */
  1586. exports.dust = fromStringRenderer('dust');
  1587. /**
  1588. * Dust string support.
  1589. */
  1590. exports.dust.render = function(str, options, cb) {
  1591. return promisify(cb, function(cb) {
  1592. var engine = requires.dust;
  1593. if (!engine) {
  1594. try {
  1595. engine = requires.dust = require('dust');
  1596. } catch (err) {
  1597. try {
  1598. engine = requires.dust = require('dustjs-helpers');
  1599. } catch (err) {
  1600. engine = requires.dust = require('dustjs-linkedin');
  1601. }
  1602. }
  1603. }
  1604. var ext = 'dust';
  1605. var views = '.';
  1606. if (options) {
  1607. if (options.ext) ext = options.ext;
  1608. if (options.views) views = options.views;
  1609. if (options.settings && options.settings.views) views = options.settings.views;
  1610. }
  1611. if (!options || (options && !options.cache)) engine.cache = {};
  1612. engine.onLoad = function(path, callback) {
  1613. if (extname(path) === '') path += '.' + ext;
  1614. if (path[0] !== '/') path = views + '/' + path;
  1615. read(path, options, callback);
  1616. };
  1617. try {
  1618. var templateName;
  1619. if (options.filename) {
  1620. templateName = options.filename.replace(new RegExp('^' + views + '/'), '').replace(new RegExp('\\.' + ext), '');
  1621. }
  1622. var tmpl = cache(options) || cache(options, engine.compileFn(str, templateName));
  1623. tmpl(options, cb);
  1624. } catch (err) {
  1625. cb(err);
  1626. }
  1627. });
  1628. };
  1629. /**
  1630. * Swig support.
  1631. */
  1632. exports.swig = fromStringRenderer('swig');
  1633. /**
  1634. * Swig string support.
  1635. */
  1636. exports.swig.render = function(str, options, cb) {
  1637. return promisify(cb, function(cb) {
  1638. var engine = requires.swig;
  1639. if (!engine) {
  1640. try {
  1641. engine = requires.swig = require('swig');
  1642. } catch (err) {
  1643. try {
  1644. engine = requires.swig = require('swig-templates');
  1645. } catch (otherError) {
  1646. throw err;
  1647. }
  1648. }
  1649. }
  1650. try {
  1651. if (options.cache === true) options.cache = 'memory';
  1652. engine.setDefaults({ cache: options.cache });
  1653. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1654. cb(null, tmpl(options));
  1655. } catch (err) {
  1656. cb(err);
  1657. }
  1658. });
  1659. };
  1660. /**
  1661. * Razor support.
  1662. */
  1663. exports.razor = function(path, options, cb) {
  1664. return promisify(cb, function(cb) {
  1665. var engine = requires.razor;
  1666. if (!engine) {
  1667. try {
  1668. engine = requires.razor = require('razor-tmpl');
  1669. } catch (err) {
  1670. throw err;
  1671. }
  1672. }
  1673. try {
  1674. var tmpl = cache(options) || cache(options, (locals) => {
  1675. console.log('Rendering razor file', path);
  1676. return engine.renderFileSync(path, locals);
  1677. });
  1678. cb(null, tmpl(options));
  1679. } catch (err) {
  1680. cb(err);
  1681. }
  1682. });
  1683. };
  1684. /**
  1685. * razor string support.
  1686. */
  1687. exports.razor.render = function(str, options, cb) {
  1688. return promisify(cb, function(cb) {
  1689. try {
  1690. var engine = requires.razor = require('razor-tmpl');
  1691. } catch (err) {
  1692. throw err;
  1693. }
  1694. try {
  1695. var tf = engine.compile(str);
  1696. var tmpl = cache(options) || cache(options, tf);
  1697. cb(null, tmpl(options));
  1698. } catch (err) {
  1699. cb(err);
  1700. }
  1701. });
  1702. };
  1703. /**
  1704. * Atpl support.
  1705. */
  1706. exports.atpl = fromStringRenderer('atpl');
  1707. /**
  1708. * Atpl string support.
  1709. */
  1710. exports.atpl.render = function(str, options, cb) {
  1711. return promisify(cb, function(cb) {
  1712. var engine = requires.atpl || (requires.atpl = require('atpl'));
  1713. try {
  1714. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1715. cb(null, tmpl(options));
  1716. } catch (err) {
  1717. cb(err);
  1718. }
  1719. });
  1720. };
  1721. /**
  1722. * Liquor support,
  1723. */
  1724. exports.liquor = fromStringRenderer('liquor');
  1725. /**
  1726. * Liquor string support.
  1727. */
  1728. exports.liquor.render = function(str, options, cb) {
  1729. return promisify(cb, function(cb) {
  1730. var engine = requires.liquor || (requires.liquor = require('liquor'));
  1731. try {
  1732. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1733. cb(null, tmpl(options));
  1734. } catch (err) {
  1735. cb(err);
  1736. }
  1737. });
  1738. };
  1739. /**
  1740. * Twig support.
  1741. */
  1742. exports.twig = fromStringRenderer('twig');
  1743. /**
  1744. * Twig string support.
  1745. */
  1746. exports.twig.render = function(str, options, cb) {
  1747. return promisify(cb, function(cb) {
  1748. var engine = requires.twig || (requires.twig = require('twig').twig);
  1749. var templateData = {
  1750. data: str,
  1751. allowInlineIncludes: options.allowInlineIncludes,
  1752. namespaces: options.namespaces,
  1753. path: options.path
  1754. };
  1755. try {
  1756. var tmpl = cache(templateData) || cache(templateData, engine(templateData));
  1757. cb(null, tmpl.render(options));
  1758. } catch (err) {
  1759. cb(err);
  1760. }
  1761. });
  1762. };
  1763. /**
  1764. * EJS support.
  1765. */
  1766. exports.ejs = fromStringRenderer('ejs');
  1767. /**
  1768. * EJS string support.
  1769. */
  1770. exports.ejs.render = function(str, options, cb) {
  1771. return promisify(cb, function(cb) {
  1772. var engine = requires.ejs || (requires.ejs = require('ejs'));
  1773. try {
  1774. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1775. cb(null, tmpl(options));
  1776. } catch (err) {
  1777. cb(err);
  1778. }
  1779. });
  1780. };
  1781. /**
  1782. * Eco support.
  1783. */
  1784. exports.eco = fromStringRenderer('eco');
  1785. /**
  1786. * Eco string support.
  1787. */
  1788. exports.eco.render = function(str, options, cb) {
  1789. return promisify(cb, function(cb) {
  1790. var engine = requires.eco || (requires.eco = require('eco'));
  1791. try {
  1792. cb(null, engine.render(str, options));
  1793. } catch (err) {
  1794. cb(err);
  1795. }
  1796. });
  1797. };
  1798. /**
  1799. * Jazz support.
  1800. */
  1801. exports.jazz = fromStringRenderer('jazz');
  1802. /**
  1803. * Jazz string support.
  1804. */
  1805. exports.jazz.render = function(str, options, cb) {
  1806. return promisify(cb, function(cb) {
  1807. var engine = requires.jazz || (requires.jazz = require('jazz'));
  1808. try {
  1809. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1810. tmpl.eval(options, function(str) {
  1811. cb(null, str);
  1812. });
  1813. } catch (err) {
  1814. cb(err);
  1815. }
  1816. });
  1817. };
  1818. /**
  1819. * JQTPL support.
  1820. */
  1821. exports.jqtpl = fromStringRenderer('jqtpl');
  1822. /**
  1823. * JQTPL string support.
  1824. */
  1825. exports.jqtpl.render = function(str, options, cb) {
  1826. return promisify(cb, function(cb) {
  1827. var engine = requires.jqtpl || (requires.jqtpl = require('jqtpl'));
  1828. try {
  1829. engine.template(str, str);
  1830. cb(null, engine.tmpl(str, options));
  1831. } catch (err) {
  1832. cb(err);
  1833. }
  1834. });
  1835. };
  1836. /**
  1837. * Haml support.
  1838. */
  1839. exports.haml = fromStringRenderer('haml');
  1840. /**
  1841. * Haml string support.
  1842. */
  1843. exports.haml.render = function(str, options, cb) {
  1844. return promisify(cb, function(cb) {
  1845. var engine = requires.haml || (requires.haml = require('hamljs'));
  1846. try {
  1847. options.locals = options;
  1848. cb(null, engine.render(str, options).trimLeft());
  1849. } catch (err) {
  1850. cb(err);
  1851. }
  1852. });
  1853. };
  1854. /**
  1855. * Hamlet support.
  1856. */
  1857. exports.hamlet = fromStringRenderer('hamlet');
  1858. /**
  1859. * Hamlet string support.
  1860. */
  1861. exports.hamlet.render = function(str, options, cb) {
  1862. return promisify(cb, function(cb) {
  1863. var engine = requires.hamlet || (requires.hamlet = require('hamlet'));
  1864. try {
  1865. options.locals = options;
  1866. cb(null, engine.render(str, options).trimLeft());
  1867. } catch (err) {
  1868. cb(err);
  1869. }
  1870. });
  1871. };
  1872. /**
  1873. * Whiskers support.
  1874. */
  1875. exports.whiskers = function(path, options, cb) {
  1876. return promisify(cb, function(cb) {
  1877. var engine = requires.whiskers || (requires.whiskers = require('whiskers'));
  1878. engine.__express(path, options, cb);
  1879. });
  1880. };
  1881. /**
  1882. * Whiskers string support.
  1883. */
  1884. exports.whiskers.render = function(str, options, cb) {
  1885. return promisify(cb, function(cb) {
  1886. var engine = requires.whiskers || (requires.whiskers = require('whiskers'));
  1887. try {
  1888. cb(null, engine.render(str, options));
  1889. } catch (err) {
  1890. cb(err);
  1891. }
  1892. });
  1893. };
  1894. /**
  1895. * Coffee-HAML support.
  1896. */
  1897. exports['haml-coffee'] = fromStringRenderer('haml-coffee');
  1898. /**
  1899. * Coffee-HAML string support.
  1900. */
  1901. exports['haml-coffee'].render = function(str, options, cb) {
  1902. return promisify(cb, function(cb) {
  1903. var engine = requires['haml-coffee'] || (requires['haml-coffee'] = require('haml-coffee'));
  1904. try {
  1905. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1906. cb(null, tmpl(options));
  1907. } catch (err) {
  1908. cb(err);
  1909. }
  1910. });
  1911. };
  1912. /**
  1913. * Hogan support.
  1914. */
  1915. exports.hogan = fromStringRenderer('hogan');
  1916. /**
  1917. * Hogan string support.
  1918. */
  1919. exports.hogan.render = function(str, options, cb) {
  1920. return promisify(cb, function(cb) {
  1921. var engine = requires.hogan || (requires.hogan = require('hogan.js'));
  1922. try {
  1923. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1924. cb(null, tmpl.render(options, options.partials));
  1925. } catch (err) {
  1926. cb(err);
  1927. }
  1928. });
  1929. };
  1930. /**
  1931. * templayed.js support.
  1932. */
  1933. exports.templayed = fromStringRenderer('templayed');
  1934. /**
  1935. * templayed.js string support.
  1936. */
  1937. exports.templayed.render = function(str, options, cb) {
  1938. return promisify(cb, function(cb) {
  1939. var engine = requires.templayed || (requires.templayed = require('templayed'));
  1940. try {
  1941. var tmpl = cache(options) || cache(options, engine(str));
  1942. cb(null, tmpl(options));
  1943. } catch (err) {
  1944. cb(err);
  1945. }
  1946. });
  1947. };
  1948. /**
  1949. * Handlebars support.
  1950. */
  1951. exports.handlebars = fromStringRenderer('handlebars');
  1952. /**
  1953. * Handlebars string support.
  1954. */
  1955. exports.handlebars.render = function(str, options, cb) {
  1956. return promisify(cb, function(cb) {
  1957. var engine = requires.handlebars || (requires.handlebars = require('handlebars'));
  1958. try {
  1959. for (var partial in options.partials) {
  1960. engine.registerPartial(partial, options.partials[partial]);
  1961. }
  1962. for (var helper in options.helpers) {
  1963. engine.registerHelper(helper, options.helpers[helper]);
  1964. }
  1965. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1966. cb(null, tmpl(options));
  1967. } catch (err) {
  1968. cb(err);
  1969. }
  1970. });
  1971. };
  1972. /**
  1973. * Underscore support.
  1974. */
  1975. exports.underscore = fromStringRenderer('underscore');
  1976. /**
  1977. * Underscore string support.
  1978. */
  1979. exports.underscore.render = function(str, options, cb) {
  1980. return promisify(cb, function(cb) {
  1981. var engine = requires.underscore || (requires.underscore = require('underscore'));
  1982. try {
  1983. const partials = {};
  1984. for (var partial in options.partials) {
  1985. partials[partial] = engine.template(options.partials[partial]);
  1986. }
  1987. options.partials = partials;
  1988. var tmpl = cache(options) || cache(options, engine.template(str, null, options));
  1989. cb(null, tmpl(options).replace(/\n$/, ''));
  1990. } catch (err) {
  1991. cb(err);
  1992. }
  1993. });
  1994. };
  1995. /**
  1996. * Lodash support.
  1997. */
  1998. exports.lodash = fromStringRenderer('lodash');
  1999. /**
  2000. * Lodash string support.
  2001. */
  2002. exports.lodash.render = function(str, options, cb) {
  2003. return promisify(cb, function(cb) {
  2004. var engine = requires.lodash || (requires.lodash = require('lodash'));
  2005. try {
  2006. var tmpl = cache(options) || cache(options, engine.template(str, options));
  2007. cb(null, tmpl(options).replace(/\n$/, ''));
  2008. } catch (err) {
  2009. cb(err);
  2010. }
  2011. });
  2012. };
  2013. /**
  2014. * Pug support. (formerly Jade)
  2015. */
  2016. exports.pug = function(path, options, cb) {
  2017. return promisify(cb, function(cb) {
  2018. var engine = requires.pug;
  2019. if (!engine) {
  2020. try {
  2021. engine = requires.pug = require('pug');
  2022. } catch (err) {
  2023. try {
  2024. engine = requires.pug = require('then-pug');
  2025. } catch (otherError) {
  2026. throw err;
  2027. }
  2028. }
  2029. }
  2030. try {
  2031. var tmpl = cache(options) || cache(options, engine.compileFile(path, options));
  2032. cb(null, tmpl(options));
  2033. } catch (err) {
  2034. cb(err);
  2035. }
  2036. });
  2037. };
  2038. /**
  2039. * Pug string support.
  2040. */
  2041. exports.pug.render = function(str, options, cb) {
  2042. return promisify(cb, function(cb) {
  2043. var engine = requires.pug;
  2044. if (!engine) {
  2045. try {
  2046. engine = requires.pug = require('pug');
  2047. } catch (err) {
  2048. try {
  2049. engine = requires.pug = require('then-pug');
  2050. } catch (otherError) {
  2051. throw err;
  2052. }
  2053. }
  2054. }
  2055. try {
  2056. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  2057. cb(null, tmpl(options));
  2058. } catch (err) {
  2059. cb(err);
  2060. }
  2061. });
  2062. };
  2063. /**
  2064. * QEJS support.
  2065. */
  2066. exports.qejs = fromStringRenderer('qejs');
  2067. /**
  2068. * QEJS string support.
  2069. */
  2070. exports.qejs.render = function(str, options, cb) {
  2071. return promisify(cb, function(cb) {
  2072. try {
  2073. var engine = requires.qejs || (requires.qejs = require('qejs'));
  2074. engine.render(str, options).then(function(result) {
  2075. cb(null, result);
  2076. }, function(err) {
  2077. cb(err);
  2078. }).done();
  2079. } catch (err) {
  2080. cb(err);
  2081. }
  2082. });
  2083. };
  2084. /**
  2085. * Walrus support.
  2086. */
  2087. exports.walrus = fromStringRenderer('walrus');
  2088. /**
  2089. * Walrus string support.
  2090. */
  2091. exports.walrus.render = function(str, options, cb) {
  2092. return promisify(cb, function(cb) {
  2093. var engine = requires.walrus || (requires.walrus = require('walrus'));
  2094. try {
  2095. var tmpl = cache(options) || cache(options, engine.parse(str));
  2096. cb(null, tmpl.compile(options));
  2097. } catch (err) {
  2098. cb(err);
  2099. }
  2100. });
  2101. };
  2102. /**
  2103. * Mustache support.
  2104. */
  2105. exports.mustache = fromStringRenderer('mustache');
  2106. /**
  2107. * Mustache string support.
  2108. */
  2109. exports.mustache.render = function(str, options, cb) {
  2110. return promisify(cb, function(cb) {
  2111. var engine = requires.mustache || (requires.mustache = require('mustache'));
  2112. try {
  2113. cb(null, engine.render(str, options, options.partials));
  2114. } catch (err) {
  2115. cb(err);
  2116. }
  2117. });
  2118. };
  2119. /**
  2120. * Just support.
  2121. */
  2122. exports.just = function(path, options, cb) {
  2123. return promisify(cb, function(cb) {
  2124. var engine = requires.just;
  2125. if (!engine) {
  2126. var JUST = require('just');
  2127. engine = requires.just = new JUST();
  2128. }
  2129. engine.configure({ useCache: options.cache });
  2130. engine.render(path, options, cb);
  2131. });
  2132. };
  2133. /**
  2134. * Just string support.
  2135. */
  2136. exports.just.render = function(str, options, cb) {
  2137. return promisify(cb, function(cb) {
  2138. var JUST = require('just');
  2139. var engine = new JUST({ root: { page: str }});
  2140. engine.render('page', options, cb);
  2141. });
  2142. };
  2143. /**
  2144. * ECT support.
  2145. */
  2146. exports.ect = function(path, options, cb) {
  2147. return promisify(cb, function(cb) {
  2148. var engine = requires.ect;
  2149. if (!engine) {
  2150. var ECT = require('ect');
  2151. engine = requires.ect = new ECT(options);
  2152. }
  2153. engine.configure({ cache: options.cache });
  2154. engine.render(path, options, cb);
  2155. });
  2156. };
  2157. /**
  2158. * ECT string support.
  2159. */
  2160. exports.ect.render = function(str, options, cb) {
  2161. return promisify(cb, function(cb) {
  2162. var ECT = require('ect');
  2163. var engine = new ECT({ root: { page: str }});
  2164. engine.render('page', options, cb);
  2165. });
  2166. };
  2167. /**
  2168. * mote support.
  2169. */
  2170. exports.mote = fromStringRenderer('mote');
  2171. /**
  2172. * mote string support.
  2173. */
  2174. exports.mote.render = function(str, options, cb) {
  2175. return promisify(cb, function(cb) {
  2176. var engine = requires.mote || (requires.mote = require('mote'));
  2177. try {
  2178. var tmpl = cache(options) || cache(options, engine.compile(str));
  2179. cb(null, tmpl(options));
  2180. } catch (err) {
  2181. cb(err);
  2182. }
  2183. });
  2184. };
  2185. /**
  2186. * Toffee support.
  2187. */
  2188. exports.toffee = function(path, options, cb) {
  2189. return promisify(cb, function(cb) {
  2190. var toffee = requires.toffee || (requires.toffee = require('toffee'));
  2191. toffee.__consolidate_engine_render(path, options, cb);
  2192. });
  2193. };
  2194. /**
  2195. * Toffee string support.
  2196. */
  2197. exports.toffee.render = function(str, options, cb) {
  2198. return promisify(cb, function(cb) {
  2199. var engine = requires.toffee || (requires.toffee = require('toffee'));
  2200. try {
  2201. engine.str_render(str, options, cb);
  2202. } catch (err) {
  2203. cb(err);
  2204. }
  2205. });
  2206. };
  2207. /**
  2208. * doT support.
  2209. */
  2210. exports.dot = fromStringRenderer('dot');
  2211. /**
  2212. * doT string support.
  2213. */
  2214. exports.dot.render = function(str, options, cb) {
  2215. return promisify(cb, function(cb) {
  2216. var engine = requires.dot || (requires.dot = require('dot'));
  2217. var extend = (requires.extend || (requires.extend = util__default._extend));
  2218. try {
  2219. var settings = {};
  2220. settings = extend(settings, engine.templateSettings);
  2221. settings = extend(settings, options ? options.dot : {});
  2222. var tmpl = cache(options) || cache(options, engine.template(str, settings, options));
  2223. cb(null, tmpl(options));
  2224. } catch (err) {
  2225. cb(err);
  2226. }
  2227. });
  2228. };
  2229. /**
  2230. * bracket support.
  2231. */
  2232. exports.bracket = fromStringRenderer('bracket');
  2233. /**
  2234. * bracket string support.
  2235. */
  2236. exports.bracket.render = function(str, options, cb) {
  2237. return promisify(cb, function(cb) {
  2238. var engine = requires.bracket || (requires.bracket = require('bracket-template'));
  2239. try {
  2240. var tmpl = cache(options) || cache(options, engine.default.compile(str, options));
  2241. cb(null, tmpl(options));
  2242. } catch (err) {
  2243. cb(err);
  2244. }
  2245. });
  2246. };
  2247. /**
  2248. * Ractive support.
  2249. */
  2250. exports.ractive = fromStringRenderer('ractive');
  2251. /**
  2252. * Ractive string support.
  2253. */
  2254. exports.ractive.render = function(str, options, cb) {
  2255. return promisify(cb, function(cb) {
  2256. var Engine = requires.ractive || (requires.ractive = require('ractive'));
  2257. var template = cache(options) || cache(options, Engine.parse(str));
  2258. options.template = template;
  2259. if (options.data === null || options.data === undefined) {
  2260. var extend = (requires.extend || (requires.extend = util__default._extend));
  2261. // Shallow clone the options object
  2262. options.data = extend({}, options);
  2263. // Remove consolidate-specific properties from the clone
  2264. var i;
  2265. var length;
  2266. var properties = ['template', 'filename', 'cache', 'partials'];
  2267. for (i = 0, length = properties.length; i < length; i++) {
  2268. var property = properties[i];
  2269. delete options.data[property];
  2270. }
  2271. }
  2272. try {
  2273. cb(null, new Engine(options).toHTML());
  2274. } catch (err) {
  2275. cb(err);
  2276. }
  2277. });
  2278. };
  2279. /**
  2280. * Nunjucks support.
  2281. */
  2282. exports.nunjucks = fromStringRenderer('nunjucks');
  2283. /**
  2284. * Nunjucks string support.
  2285. */
  2286. exports.nunjucks.render = function(str, options, cb) {
  2287. return promisify(cb, function(cb) {
  2288. try {
  2289. var engine = options.nunjucksEnv || requires.nunjucks || (requires.nunjucks = require('nunjucks'));
  2290. var env = engine;
  2291. // deprecated fallback support for express
  2292. // <https://github.com/tj/consolidate.js/pull/152>
  2293. // <https://github.com/tj/consolidate.js/pull/224>
  2294. if (options.settings && options.settings.views) {
  2295. env = engine.configure(options.settings.views);
  2296. } else if (options.nunjucks && options.nunjucks.configure) {
  2297. env = engine.configure.apply(engine, options.nunjucks.configure);
  2298. }
  2299. //
  2300. // because `renderString` does not initiate loaders
  2301. // we must manually create a loader for it based off
  2302. // either `options.settings.views` or `options.nunjucks` or `options.nunjucks.root`
  2303. //
  2304. // <https://github.com/mozilla/nunjucks/issues/730>
  2305. // <https://github.com/crocodilejs/node-email-templates/issues/182>
  2306. //
  2307. // so instead we simply check if we passed a custom loader
  2308. // otherwise we create a simple file based loader
  2309. if (options.loader) {
  2310. env = new engine.Environment(options.loader);
  2311. } else if (options.settings && options.settings.views) {
  2312. env = new engine.Environment(
  2313. new engine.FileSystemLoader(options.settings.views)
  2314. );
  2315. } else if (options.nunjucks && options.nunjucks.loader) {
  2316. if (typeof options.nunjucks.loader === 'string') {
  2317. env = new engine.Environment(new engine.FileSystemLoader(options.nunjucks.loader));
  2318. } else {
  2319. env = new engine.Environment(
  2320. new engine.FileSystemLoader(
  2321. options.nunjucks.loader[0],
  2322. options.nunjucks.loader[1]
  2323. )
  2324. );
  2325. }
  2326. }
  2327. env.renderString(str, options, cb);
  2328. } catch (err) {
  2329. throw cb(err);
  2330. }
  2331. });
  2332. };
  2333. /**
  2334. * HTMLing support.
  2335. */
  2336. exports.htmling = fromStringRenderer('htmling');
  2337. /**
  2338. * HTMLing string support.
  2339. */
  2340. exports.htmling.render = function(str, options, cb) {
  2341. return promisify(cb, function(cb) {
  2342. var engine = requires.htmling || (requires.htmling = require('htmling'));
  2343. try {
  2344. var tmpl = cache(options) || cache(options, engine.string(str));
  2345. cb(null, tmpl.render(options));
  2346. } catch (err) {
  2347. cb(err);
  2348. }
  2349. });
  2350. };
  2351. /**
  2352. * Rendering function
  2353. */
  2354. function requireReact(module, filename) {
  2355. var babel = requires.babel || (requires.babel = require('babel-core'));
  2356. var compiled = babel.transformFileSync(filename, { presets: [ 'react' ] }).code;
  2357. return module._compile(compiled, filename);
  2358. }
  2359. exports.requireReact = requireReact;
  2360. /**
  2361. * Converting a string into a node module.
  2362. */
  2363. function requireReactString(src, filename) {
  2364. var babel = requires.babel || (requires.babel = require('babel-core'));
  2365. if (!filename) filename = '';
  2366. var m = new module.constructor();
  2367. filename = filename || '';
  2368. // Compile Using React
  2369. var compiled = babel.transform(src, { presets: [ 'react' ] }).code;
  2370. // Compile as a module
  2371. m.paths = module.paths;
  2372. m._compile(compiled, filename);
  2373. return m.exports;
  2374. }
  2375. /**
  2376. * A naive helper to replace {{tags}} with options.tags content
  2377. */
  2378. function reactBaseTmpl(data, options) {
  2379. var exp;
  2380. var regex;
  2381. // Iterates through the keys in file object
  2382. // and interpolate / replace {{key}} with it's value
  2383. for (var k in options) {
  2384. if (options.hasOwnProperty(k)) {
  2385. exp = '{{' + k + '}}';
  2386. regex = new RegExp(exp, 'g');
  2387. if (data.match(regex)) {
  2388. data = data.replace(regex, options[k]);
  2389. }
  2390. }
  2391. }
  2392. return data;
  2393. }
  2394. /**
  2395. * Plates Support.
  2396. */
  2397. exports.plates = fromStringRenderer('plates');
  2398. /**
  2399. * Plates string support.
  2400. */
  2401. exports.plates.render = function(str, options, cb) {
  2402. return promisify(cb, function(cb) {
  2403. var engine = requires.plates || (requires.plates = require('plates'));
  2404. var map = options.map || undefined;
  2405. try {
  2406. var tmpl = engine.bind(str, options, map);
  2407. cb(null, tmpl);
  2408. } catch (err) {
  2409. cb(err);
  2410. }
  2411. });
  2412. };
  2413. /**
  2414. * The main render parser for React bsaed templates
  2415. */
  2416. function reactRenderer(type) {
  2417. if (commonjsRequire.extensions) {
  2418. // Ensure JSX is transformed on require
  2419. if (!commonjsRequire.extensions['.jsx']) {
  2420. commonjsRequire.extensions['.jsx'] = requireReact;
  2421. }
  2422. // Supporting .react extension as well as test cases
  2423. // Using .react extension is not recommended.
  2424. if (!commonjsRequire.extensions['.react']) {
  2425. commonjsRequire.extensions['.react'] = requireReact;
  2426. }
  2427. }
  2428. // Return rendering fx
  2429. return function(str, options, cb) {
  2430. return promisify(cb, function(cb) {
  2431. // React Import
  2432. var ReactDOM = requires.ReactDOM || (requires.ReactDOM = require('react-dom/server'));
  2433. var react = requires.react || (requires.react = require('react'));
  2434. // Assign HTML Base
  2435. var base = options.base;
  2436. delete options.base;
  2437. var enableCache = options.cache;
  2438. delete options.cache;
  2439. var isNonStatic = options.isNonStatic;
  2440. delete options.isNonStatic;
  2441. // Start Conversion
  2442. try {
  2443. var Code;
  2444. var Factory;
  2445. var baseStr;
  2446. var content;
  2447. var parsed;
  2448. if (!cache(options)) {
  2449. // Parsing
  2450. if (type === 'path') {
  2451. var path = resolve(str);
  2452. delete require.cache[path];
  2453. Code = commonjsRequire(path);
  2454. } else {
  2455. Code = requireReactString(str);
  2456. }
  2457. Factory = cache(options, react.createFactory(Code));
  2458. } else {
  2459. Factory = cache(options);
  2460. }
  2461. parsed = new Factory(options);
  2462. content = (isNonStatic) ? ReactDOM.renderToString(parsed) : ReactDOM.renderToStaticMarkup(parsed);
  2463. if (base) {
  2464. baseStr = readCache[str] || fs__default.readFileSync(resolve(base), 'utf8');
  2465. if (enableCache) {
  2466. readCache[str] = baseStr;
  2467. }
  2468. options.content = content;
  2469. content = reactBaseTmpl(baseStr, options);
  2470. }
  2471. cb(null, content);
  2472. } catch (err) {
  2473. cb(err);
  2474. }
  2475. });
  2476. };
  2477. }
  2478. /**
  2479. * React JS Support
  2480. */
  2481. exports.react = reactRenderer('path');
  2482. /**
  2483. * React JS string support.
  2484. */
  2485. exports.react.render = reactRenderer('string');
  2486. /**
  2487. * ARC-templates support.
  2488. */
  2489. exports['arc-templates'] = fromStringRenderer('arc-templates');
  2490. /**
  2491. * ARC-templates string support.
  2492. */
  2493. exports['arc-templates'].render = function(str, options, cb) {
  2494. var readFileWithOptions = util__default.promisify(read);
  2495. var consolidateFileSystem = {};
  2496. consolidateFileSystem.readFile = function(path) {
  2497. return readFileWithOptions(path, options);
  2498. };
  2499. return promisify(cb, function(cb) {
  2500. try {
  2501. var engine = requires['arc-templates'];
  2502. if (!engine) {
  2503. var Engine = require('arc-templates/dist/es5');
  2504. engine = requires['arc-templates'] = new Engine({ filesystem: consolidateFileSystem });
  2505. }
  2506. var compiler = cache(options) || cache(options, engine.compileString(str, options.filename));
  2507. compiler.then(function(func) { return func(options); })
  2508. .then(function(result) { cb(null, result.content); })
  2509. .catch(cb);
  2510. } catch (err) {
  2511. cb(err);
  2512. }
  2513. });
  2514. };
  2515. /**
  2516. * Vash support
  2517. */
  2518. exports.vash = fromStringRenderer('vash');
  2519. /**
  2520. * Vash string support
  2521. */
  2522. exports.vash.render = function(str, options, cb) {
  2523. return promisify(cb, function(cb) {
  2524. var engine = requires.vash || (requires.vash = require('vash'));
  2525. try {
  2526. // helper system : https://github.com/kirbysayshi/vash#helper-system
  2527. if (options.helpers) {
  2528. for (var key in options.helpers) {
  2529. if (!options.helpers.hasOwnProperty(key) || typeof options.helpers[key] !== 'function') {
  2530. continue;
  2531. }
  2532. engine.helpers[key] = options.helpers[key];
  2533. }
  2534. }
  2535. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  2536. tmpl(options, function sealLayout(err, ctx) {
  2537. if (err) cb(err);
  2538. ctx.finishLayout();
  2539. cb(null, ctx.toString().replace(/\n$/, ''));
  2540. });
  2541. } catch (err) {
  2542. cb(err);
  2543. }
  2544. });
  2545. };
  2546. /**
  2547. * Slm support.
  2548. */
  2549. exports.slm = fromStringRenderer('slm');
  2550. /**
  2551. * Slm string support.
  2552. */
  2553. exports.slm.render = function(str, options, cb) {
  2554. return promisify(cb, function(cb) {
  2555. var engine = requires.slm || (requires.slm = require('slm'));
  2556. try {
  2557. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  2558. cb(null, tmpl(options));
  2559. } catch (err) {
  2560. cb(err);
  2561. }
  2562. });
  2563. };
  2564. /**
  2565. * Marko support.
  2566. */
  2567. exports.marko = function(path, options, cb) {
  2568. return promisify(cb, function(cb) {
  2569. var engine = requires.marko || (requires.marko = require('marko'));
  2570. options.writeToDisk = !!options.cache;
  2571. try {
  2572. var tmpl = cache(options) || cache(options, engine.load(path, options));
  2573. tmpl.renderToString(options, cb);
  2574. } catch (err) {
  2575. cb(err);
  2576. }
  2577. });
  2578. };
  2579. /**
  2580. * Marko string support.
  2581. */
  2582. exports.marko.render = function(str, options, cb) {
  2583. return promisify(cb, function(cb) {
  2584. var engine = requires.marko || (requires.marko = require('marko'));
  2585. options.writeToDisk = !!options.cache;
  2586. options.filename = options.filename || 'string.marko';
  2587. try {
  2588. var tmpl = cache(options) || cache(options, engine.load(options.filename, str, options));
  2589. tmpl.renderToString(options, cb);
  2590. } catch (err) {
  2591. cb(err);
  2592. }
  2593. });
  2594. };
  2595. /**
  2596. * Teacup support.
  2597. */
  2598. exports.teacup = function(path, options, cb) {
  2599. return promisify(cb, function(cb) {
  2600. var engine = requires.teacup || (requires.teacup = require('teacup/lib/express'));
  2601. commonjsRequire.extensions['.teacup'] = commonjsRequire.extensions['.coffee'];
  2602. if (path[0] !== '/') {
  2603. path = join(process.cwd(), path);
  2604. }
  2605. if (!options.cache) {
  2606. var callback = cb;
  2607. cb = function() {
  2608. delete require.cache[path];
  2609. callback.apply(this, arguments);
  2610. };
  2611. }
  2612. engine.renderFile(path, options, cb);
  2613. });
  2614. };
  2615. /**
  2616. * Teacup string support.
  2617. */
  2618. exports.teacup.render = function(str, options, cb) {
  2619. var coffee = require('coffee-script');
  2620. var vm = require('vm');
  2621. var sandbox = {
  2622. module: {exports: {}},
  2623. require: commonjsRequire
  2624. };
  2625. return promisify(cb, function(cb) {
  2626. vm.runInNewContext(coffee.compile(str), sandbox);
  2627. var tmpl = sandbox.module.exports;
  2628. cb(null, tmpl(options));
  2629. });
  2630. };
  2631. /**
  2632. * Squirrelly support.
  2633. */
  2634. exports.squirrelly = fromStringRenderer('squirrelly');
  2635. /**
  2636. * Squirrelly string support.
  2637. */
  2638. exports.squirrelly.render = function(str, options, cb) {
  2639. return promisify(cb, function(cb) {
  2640. var engine = requires.squirrelly || (requires.squirrelly = require('squirrelly'));
  2641. try {
  2642. for (var partial in options.partials) {
  2643. engine.definePartial(partial, options.partials[partial]);
  2644. }
  2645. for (var helper in options.helpers) {
  2646. engine.defineHelper(helper, options.helpers[helper]);
  2647. }
  2648. var tmpl = cache(options) || cache(options, engine.Compile(str, options));
  2649. cb(null, tmpl(options, engine));
  2650. } catch (err) {
  2651. cb(err);
  2652. }
  2653. });
  2654. };
  2655. /**
  2656. * Twing support.
  2657. */
  2658. exports.twing = fromStringRenderer('twing');
  2659. /**
  2660. * Twing string support.
  2661. */
  2662. exports.twing.render = function(str, options, cb) {
  2663. return promisify(cb, function(cb) {
  2664. var engine = requires.twing || (requires.twing = require('twing'));
  2665. try {
  2666. new engine.TwingEnvironment(new engine.TwingLoaderNull()).createTemplate(str).then((twingTemplate) => {
  2667. twingTemplate.render(options).then((rendTmpl) => {
  2668. var tmpl = cache(options) || cache(options, rendTmpl);
  2669. cb(null, tmpl);
  2670. });
  2671. });
  2672. } catch (err) {
  2673. cb(err);
  2674. }
  2675. });
  2676. };
  2677. /**
  2678. * expose the instance of the engine
  2679. */
  2680. exports.requires = requires;
  2681. });
  2682. var consolidate$1 = consolidate;
  2683. const hasWarned = {};
  2684. function warnOnce(msg) {
  2685. const isNodeProd = typeof process !== 'undefined' && process.env.NODE_ENV === 'production';
  2686. if (!isNodeProd && !false && !hasWarned[msg]) {
  2687. hasWarned[msg] = true;
  2688. warn(msg);
  2689. }
  2690. }
  2691. function warn(msg) {
  2692. console.warn(`\x1b[1m\x1b[33m[@vue/compiler-sfc]\x1b[0m\x1b[33m ${msg}\x1b[0m\n`);
  2693. }
  2694. function preprocess({ source, filename, preprocessOptions }, preprocessor) {
  2695. // Consolidate exposes a callback based API, but the callback is in fact
  2696. // called synchronously for most templating engines. In our case, we have to
  2697. // expose a synchronous API so that it is usable in Jest transforms (which
  2698. // have to be sync because they are applied via Node.js require hooks)
  2699. let res = '';
  2700. let err = null;
  2701. preprocessor.render(source, { filename, ...preprocessOptions }, (_err, _res) => {
  2702. if (_err)
  2703. err = _err;
  2704. res = _res;
  2705. });
  2706. if (err)
  2707. throw err;
  2708. return res;
  2709. }
  2710. function compileTemplate(options) {
  2711. const { preprocessLang, preprocessCustomRequire } = options;
  2712. const preprocessor = preprocessLang
  2713. ? preprocessCustomRequire
  2714. ? preprocessCustomRequire(preprocessLang)
  2715. : consolidate$1[preprocessLang]
  2716. : false;
  2717. if (preprocessor) {
  2718. try {
  2719. return doCompileTemplate({
  2720. ...options,
  2721. source: preprocess(options, preprocessor)
  2722. });
  2723. }
  2724. catch (e) {
  2725. return {
  2726. code: `export default function render() {}`,
  2727. source: options.source,
  2728. tips: [],
  2729. errors: [e]
  2730. };
  2731. }
  2732. }
  2733. else if (preprocessLang) {
  2734. return {
  2735. code: `export default function render() {}`,
  2736. source: options.source,
  2737. tips: [
  2738. `Component ${options.filename} uses lang ${preprocessLang} for template. Please install the language preprocessor.`
  2739. ],
  2740. errors: [
  2741. `Component ${options.filename} uses lang ${preprocessLang} for template, however it is not installed.`
  2742. ]
  2743. };
  2744. }
  2745. else {
  2746. return doCompileTemplate(options);
  2747. }
  2748. }
  2749. function doCompileTemplate({ filename, id, scoped, slotted, inMap, source, ssr = false, ssrCssVars, isProd = false, compiler = ssr ? CompilerSSR__namespace : CompilerDOM__namespace, compilerOptions = {}, transformAssetUrls }) {
  2750. const errors = [];
  2751. const warnings = [];
  2752. let nodeTransforms = [];
  2753. if (shared.isObject(transformAssetUrls)) {
  2754. const assetOptions = normalizeOptions(transformAssetUrls);
  2755. nodeTransforms = [
  2756. createAssetUrlTransformWithOptions(assetOptions),
  2757. createSrcsetTransformWithOptions(assetOptions)
  2758. ];
  2759. }
  2760. else if (transformAssetUrls !== false) {
  2761. nodeTransforms = [transformAssetUrl, transformSrcset];
  2762. }
  2763. if (ssr && !ssrCssVars) {
  2764. warnOnce(`compileTemplate is called with \`ssr: true\` but no ` +
  2765. `corresponding \`cssVars\` option.\`.`);
  2766. }
  2767. if (!id) {
  2768. warnOnce(`compileTemplate now requires the \`id\` option.\`.`);
  2769. id = '';
  2770. }
  2771. const shortId = id.replace(/^data-v-/, '');
  2772. const longId = `data-v-${shortId}`;
  2773. let { code, ast, preamble, map } = compiler.compile(source, {
  2774. mode: 'module',
  2775. prefixIdentifiers: true,
  2776. hoistStatic: true,
  2777. cacheHandlers: true,
  2778. ssrCssVars: ssr && ssrCssVars && ssrCssVars.length
  2779. ? genCssVarsFromList(ssrCssVars, shortId, isProd, true)
  2780. : '',
  2781. scopeId: scoped ? longId : undefined,
  2782. slotted,
  2783. sourceMap: true,
  2784. ...compilerOptions,
  2785. nodeTransforms: nodeTransforms.concat(compilerOptions.nodeTransforms || []),
  2786. filename,
  2787. onError: e => errors.push(e),
  2788. onWarn: w => warnings.push(w)
  2789. });
  2790. // inMap should be the map produced by ./parse.ts which is a simple line-only
  2791. // mapping. If it is present, we need to adjust the final map and errors to
  2792. // reflect the original line numbers.
  2793. if (inMap) {
  2794. if (map) {
  2795. map = mapLines(inMap, map);
  2796. }
  2797. if (errors.length) {
  2798. patchErrors(errors, source, inMap);
  2799. }
  2800. }
  2801. const tips = warnings.map(w => {
  2802. let msg = w.message;
  2803. if (w.loc) {
  2804. msg += `\n${shared.generateCodeFrame(source, w.loc.start.offset, w.loc.end.offset)}`;
  2805. }
  2806. return msg;
  2807. });
  2808. return { code, ast, preamble, source, errors, tips, map };
  2809. }
  2810. function mapLines(oldMap, newMap) {
  2811. if (!oldMap)
  2812. return newMap;
  2813. if (!newMap)
  2814. return oldMap;
  2815. const oldMapConsumer = new sourceMap.SourceMapConsumer(oldMap);
  2816. const newMapConsumer = new sourceMap.SourceMapConsumer(newMap);
  2817. const mergedMapGenerator = new sourceMap.SourceMapGenerator();
  2818. newMapConsumer.eachMapping(m => {
  2819. if (m.originalLine == null) {
  2820. return;
  2821. }
  2822. const origPosInOldMap = oldMapConsumer.originalPositionFor({
  2823. line: m.originalLine,
  2824. column: m.originalColumn
  2825. });
  2826. if (origPosInOldMap.source == null) {
  2827. return;
  2828. }
  2829. mergedMapGenerator.addMapping({
  2830. generated: {
  2831. line: m.generatedLine,
  2832. column: m.generatedColumn
  2833. },
  2834. original: {
  2835. line: origPosInOldMap.line,
  2836. // use current column, since the oldMap produced by @vue/compiler-sfc
  2837. // does not
  2838. column: m.originalColumn
  2839. },
  2840. source: origPosInOldMap.source,
  2841. name: origPosInOldMap.name
  2842. });
  2843. });
  2844. // source-map's type definition is incomplete
  2845. const generator = mergedMapGenerator;
  2846. oldMapConsumer.sources.forEach((sourceFile) => {
  2847. generator._sources.add(sourceFile);
  2848. const sourceContent = oldMapConsumer.sourceContentFor(sourceFile);
  2849. if (sourceContent != null) {
  2850. mergedMapGenerator.setSourceContent(sourceFile, sourceContent);
  2851. }
  2852. });
  2853. generator._sourceRoot = oldMap.sourceRoot;
  2854. generator._file = oldMap.file;
  2855. return generator.toJSON();
  2856. }
  2857. function patchErrors(errors, source, inMap) {
  2858. const originalSource = inMap.sourcesContent[0];
  2859. const offset = originalSource.indexOf(source);
  2860. const lineOffset = originalSource.slice(0, offset).split(/\r?\n/).length - 1;
  2861. errors.forEach(err => {
  2862. if (err.loc) {
  2863. err.loc.start.line += lineOffset;
  2864. err.loc.start.offset += offset;
  2865. if (err.loc.end !== err.loc.start) {
  2866. err.loc.end.line += lineOffset;
  2867. err.loc.end.offset += offset;
  2868. }
  2869. }
  2870. });
  2871. }
  2872. const defaultExportRE = /((?:^|\n|;)\s*)export(\s*)default/;
  2873. const namedDefaultExportRE = /((?:^|\n|;)\s*)export(.+)(?:as)?(\s*)default/s;
  2874. const exportDefaultClassRE = /((?:^|\n|;)\s*)export\s+default\s+class\s+([\w$]+)/;
  2875. /**
  2876. * Utility for rewriting `export default` in a script block into a variable
  2877. * declaration so that we can inject things into it
  2878. */
  2879. function rewriteDefault(input, as, parserPlugins) {
  2880. if (!hasDefaultExport(input)) {
  2881. return input + `\nconst ${as} = {}`;
  2882. }
  2883. let replaced;
  2884. const classMatch = input.match(exportDefaultClassRE);
  2885. if (classMatch) {
  2886. replaced =
  2887. input.replace(exportDefaultClassRE, '$1class $2') +
  2888. `\nconst ${as} = ${classMatch[2]}`;
  2889. }
  2890. else {
  2891. replaced = input.replace(defaultExportRE, `$1const ${as} =`);
  2892. }
  2893. if (!hasDefaultExport(replaced)) {
  2894. return replaced;
  2895. }
  2896. // if the script somehow still contains `default export`, it probably has
  2897. // multi-line comments or template strings. fallback to a full parse.
  2898. const s = new MagicString__default(input);
  2899. const ast = parser$2.parse(input, {
  2900. sourceType: 'module',
  2901. plugins: parserPlugins
  2902. }).program.body;
  2903. ast.forEach(node => {
  2904. if (node.type === 'ExportDefaultDeclaration') {
  2905. if (node.declaration.type === 'ClassDeclaration') {
  2906. s.overwrite(node.start, node.declaration.id.start, `class `);
  2907. s.append(`\nconst ${as} = ${node.declaration.id.name}`);
  2908. }
  2909. else {
  2910. s.overwrite(node.start, node.declaration.start, `const ${as} = `);
  2911. }
  2912. }
  2913. if (node.type === 'ExportNamedDeclaration') {
  2914. for (const specifier of node.specifiers) {
  2915. if (specifier.type === 'ExportSpecifier' &&
  2916. specifier.exported.type === 'Identifier' &&
  2917. specifier.exported.name === 'default') {
  2918. if (node.source) {
  2919. if (specifier.local.name === 'default') {
  2920. const end = specifierEnd(input, specifier.local.end, node.end);
  2921. s.prepend(`import { default as __VUE_DEFAULT__ } from '${node.source.value}'\n`);
  2922. s.overwrite(specifier.start, end, ``);
  2923. s.append(`\nconst ${as} = __VUE_DEFAULT__`);
  2924. continue;
  2925. }
  2926. else {
  2927. const end = specifierEnd(input, specifier.exported.end, node.end);
  2928. s.prepend(`import { ${input.slice(specifier.local.start, specifier.local.end)} } from '${node.source.value}'\n`);
  2929. s.overwrite(specifier.start, end, ``);
  2930. s.append(`\nconst ${as} = ${specifier.local.name}`);
  2931. continue;
  2932. }
  2933. }
  2934. const end = specifierEnd(input, specifier.end, node.end);
  2935. s.overwrite(specifier.start, end, ``);
  2936. s.append(`\nconst ${as} = ${specifier.local.name}`);
  2937. }
  2938. }
  2939. }
  2940. });
  2941. return s.toString();
  2942. }
  2943. function hasDefaultExport(input) {
  2944. return defaultExportRE.test(input) || namedDefaultExportRE.test(input);
  2945. }
  2946. function specifierEnd(input, end, nodeEnd) {
  2947. // export { default , foo } ...
  2948. let hasCommas = false;
  2949. let oldEnd = end;
  2950. while (end < nodeEnd) {
  2951. if (/\s/.test(input.charAt(end))) {
  2952. end++;
  2953. }
  2954. else if (input.charAt(end) === ',') {
  2955. end++;
  2956. hasCommas = true;
  2957. break;
  2958. }
  2959. else if (input.charAt(end) === '}') {
  2960. break;
  2961. }
  2962. }
  2963. return hasCommas ? end : oldEnd;
  2964. }
  2965. // Special compiler macros
  2966. const DEFINE_PROPS = 'defineProps';
  2967. const DEFINE_EMITS = 'defineEmits';
  2968. const DEFINE_EXPOSE = 'defineExpose';
  2969. const WITH_DEFAULTS = 'withDefaults';
  2970. // constants
  2971. const DEFAULT_VAR = `__default__`;
  2972. const isBuiltInDir = shared.makeMap(`once,memo,if,for,else,else-if,slot,text,html,on,bind,model,show,cloak,is`);
  2973. /**
  2974. * Compile `<script setup>`
  2975. * It requires the whole SFC descriptor because we need to handle and merge
  2976. * normal `<script>` + `<script setup>` if both are present.
  2977. */
  2978. function compileScript(sfc, options) {
  2979. var _a;
  2980. let { script, scriptSetup, source, filename } = sfc;
  2981. // feature flags
  2982. // TODO remove support for deprecated options when out of experimental
  2983. const enableReactivityTransform = !!options.reactivityTransform ||
  2984. !!options.refSugar ||
  2985. !!options.refTransform;
  2986. const enablePropsTransform = !!options.reactivityTransform || !!options.propsDestructureTransform;
  2987. const isProd = !!options.isProd;
  2988. const genSourceMap = options.sourceMap !== false;
  2989. let refBindings;
  2990. if (!options.id) {
  2991. warnOnce(`compileScript now requires passing the \`id\` option.\n` +
  2992. `Upgrade your vite or vue-loader version for compatibility with ` +
  2993. `the latest experimental proposals.`);
  2994. }
  2995. const scopeId = options.id ? options.id.replace(/^data-v-/, '') : '';
  2996. const cssVars = sfc.cssVars;
  2997. const scriptLang = script && script.lang;
  2998. const scriptSetupLang = scriptSetup && scriptSetup.lang;
  2999. const isTS = scriptLang === 'ts' ||
  3000. scriptLang === 'tsx' ||
  3001. scriptSetupLang === 'ts' ||
  3002. scriptSetupLang === 'tsx';
  3003. // resolve parser plugins
  3004. const plugins = [];
  3005. if (!isTS || scriptLang === 'tsx' || scriptSetupLang === 'tsx') {
  3006. plugins.push('jsx');
  3007. }
  3008. else {
  3009. // If don't match the case of adding jsx, should remove the jsx from the babelParserPlugins
  3010. if (options.babelParserPlugins)
  3011. options.babelParserPlugins = options.babelParserPlugins.filter(n => n !== 'jsx');
  3012. }
  3013. if (options.babelParserPlugins)
  3014. plugins.push(...options.babelParserPlugins);
  3015. if (isTS) {
  3016. plugins.push('typescript');
  3017. if (!plugins.includes('decorators')) {
  3018. plugins.push('decorators-legacy');
  3019. }
  3020. }
  3021. if (!scriptSetup) {
  3022. if (!script) {
  3023. throw new Error(`[@vue/compiler-sfc] SFC contains no <script> tags.`);
  3024. }
  3025. if (scriptLang && !isTS && scriptLang !== 'jsx') {
  3026. // do not process non js/ts script blocks
  3027. return script;
  3028. }
  3029. try {
  3030. let content = script.content;
  3031. let map = script.map;
  3032. const scriptAst = parser$2.parse(content, {
  3033. plugins,
  3034. sourceType: 'module'
  3035. }).program;
  3036. const bindings = analyzeScriptBindings(scriptAst.body);
  3037. if (enableReactivityTransform && reactivityTransform.shouldTransform(content)) {
  3038. const s = new MagicString__default(source);
  3039. const startOffset = script.loc.start.offset;
  3040. const endOffset = script.loc.end.offset;
  3041. const { importedHelpers } = reactivityTransform.transformAST(scriptAst, s, startOffset);
  3042. if (importedHelpers.length) {
  3043. s.prepend(`import { ${importedHelpers
  3044. .map(h => `${h} as _${h}`)
  3045. .join(', ')} } from 'vue'\n`);
  3046. }
  3047. s.remove(0, startOffset);
  3048. s.remove(endOffset, source.length);
  3049. content = s.toString();
  3050. if (genSourceMap) {
  3051. map = s.generateMap({
  3052. source: filename,
  3053. hires: true,
  3054. includeContent: true
  3055. });
  3056. }
  3057. }
  3058. if (cssVars.length) {
  3059. content = rewriteDefault(content, DEFAULT_VAR, plugins);
  3060. content += genNormalScriptCssVarsCode(cssVars, bindings, scopeId, isProd);
  3061. content += `\nexport default ${DEFAULT_VAR}`;
  3062. }
  3063. return {
  3064. ...script,
  3065. content,
  3066. map,
  3067. bindings,
  3068. scriptAst: scriptAst.body
  3069. };
  3070. }
  3071. catch (e) {
  3072. // silently fallback if parse fails since user may be using custom
  3073. // babel syntax
  3074. return script;
  3075. }
  3076. }
  3077. if (script && scriptLang !== scriptSetupLang) {
  3078. throw new Error(`[@vue/compiler-sfc] <script> and <script setup> must have the same ` +
  3079. `language type.`);
  3080. }
  3081. if (scriptSetupLang && !isTS && scriptSetupLang !== 'jsx') {
  3082. // do not process non js/ts script blocks
  3083. return scriptSetup;
  3084. }
  3085. // metadata that needs to be returned
  3086. const bindingMetadata = {};
  3087. const helperImports = new Set();
  3088. const userImports = Object.create(null);
  3089. const scriptBindings = Object.create(null);
  3090. const setupBindings = Object.create(null);
  3091. let defaultExport;
  3092. let hasDefinePropsCall = false;
  3093. let hasDefineEmitCall = false;
  3094. let hasDefineExposeCall = false;
  3095. let hasDefaultExportName = false;
  3096. let hasDefaultExportRender = false;
  3097. let propsRuntimeDecl;
  3098. let propsRuntimeDefaults;
  3099. let propsDestructureDecl;
  3100. let propsDestructureRestId;
  3101. let propsTypeDecl;
  3102. let propsTypeDeclRaw;
  3103. let propsIdentifier;
  3104. let emitsRuntimeDecl;
  3105. let emitsTypeDecl;
  3106. let emitsTypeDeclRaw;
  3107. let emitIdentifier;
  3108. let hasAwait = false;
  3109. let hasInlinedSsrRenderFn = false;
  3110. // props/emits declared via types
  3111. const typeDeclaredProps = {};
  3112. const typeDeclaredEmits = new Set();
  3113. // record declared types for runtime props type generation
  3114. const declaredTypes = {};
  3115. // props destructure data
  3116. const propsDestructuredBindings = Object.create(null);
  3117. // magic-string state
  3118. const s = new MagicString__default(source);
  3119. const startOffset = scriptSetup.loc.start.offset;
  3120. const endOffset = scriptSetup.loc.end.offset;
  3121. const scriptStartOffset = script && script.loc.start.offset;
  3122. const scriptEndOffset = script && script.loc.end.offset;
  3123. function helper(key) {
  3124. helperImports.add(key);
  3125. return `_${key}`;
  3126. }
  3127. function parse(input, options, offset) {
  3128. try {
  3129. return parser$2.parse(input, options).program;
  3130. }
  3131. catch (e) {
  3132. e.message = `[@vue/compiler-sfc] ${e.message}\n\n${sfc.filename}\n${shared.generateCodeFrame(source, e.pos + offset, e.pos + offset + 1)}`;
  3133. throw e;
  3134. }
  3135. }
  3136. function error(msg, node, end = node.end + startOffset) {
  3137. throw new Error(`[@vue/compiler-sfc] ${msg}\n\n${sfc.filename}\n${shared.generateCodeFrame(source, node.start + startOffset, end)}`);
  3138. }
  3139. function hoistNode(node) {
  3140. const start = node.start + startOffset;
  3141. let end = node.end + startOffset;
  3142. // locate comment
  3143. if (node.trailingComments && node.trailingComments.length > 0) {
  3144. const lastCommentNode = node.trailingComments[node.trailingComments.length - 1];
  3145. end = lastCommentNode.end + startOffset;
  3146. }
  3147. // locate the end of whitespace between this statement and the next
  3148. while (end <= source.length) {
  3149. if (!/\s/.test(source.charAt(end))) {
  3150. break;
  3151. }
  3152. end++;
  3153. }
  3154. s.move(start, end, 0);
  3155. }
  3156. function registerUserImport(source, local, imported, isType, isFromSetup, needTemplateUsageCheck) {
  3157. // template usage check is only needed in non-inline mode, so we can skip
  3158. // the work if inlineTemplate is true.
  3159. let isUsedInTemplate = needTemplateUsageCheck;
  3160. if (needTemplateUsageCheck &&
  3161. isTS &&
  3162. sfc.template &&
  3163. !sfc.template.src &&
  3164. !sfc.template.lang) {
  3165. isUsedInTemplate = isImportUsed(local, sfc);
  3166. }
  3167. userImports[local] = {
  3168. isType,
  3169. imported: imported || 'default',
  3170. local,
  3171. source,
  3172. isFromSetup,
  3173. isUsedInTemplate
  3174. };
  3175. }
  3176. function processDefineProps(node, declId) {
  3177. if (!isCallOf(node, DEFINE_PROPS)) {
  3178. return false;
  3179. }
  3180. if (hasDefinePropsCall) {
  3181. error(`duplicate ${DEFINE_PROPS}() call`, node);
  3182. }
  3183. hasDefinePropsCall = true;
  3184. propsRuntimeDecl = node.arguments[0];
  3185. // call has type parameters - infer runtime types from it
  3186. if (node.typeParameters) {
  3187. if (propsRuntimeDecl) {
  3188. error(`${DEFINE_PROPS}() cannot accept both type and non-type arguments ` +
  3189. `at the same time. Use one or the other.`, node);
  3190. }
  3191. propsTypeDeclRaw = node.typeParameters.params[0];
  3192. propsTypeDecl = resolveQualifiedType(propsTypeDeclRaw, node => node.type === 'TSTypeLiteral');
  3193. if (!propsTypeDecl) {
  3194. error(`type argument passed to ${DEFINE_PROPS}() must be a literal type, ` +
  3195. `or a reference to an interface or literal type.`, propsTypeDeclRaw);
  3196. }
  3197. }
  3198. if (declId) {
  3199. if (enablePropsTransform && declId.type === 'ObjectPattern') {
  3200. propsDestructureDecl = declId;
  3201. // props destructure - handle compilation sugar
  3202. for (const prop of declId.properties) {
  3203. if (prop.type === 'ObjectProperty') {
  3204. const propKey = resolveObjectKey(prop.key, prop.computed);
  3205. if (!propKey) {
  3206. error(`${DEFINE_PROPS}() destructure cannot use computed key.`, prop.key);
  3207. }
  3208. if (prop.value.type === 'AssignmentPattern') {
  3209. // default value { foo = 123 }
  3210. const { left, right } = prop.value;
  3211. if (left.type !== 'Identifier') {
  3212. error(`${DEFINE_PROPS}() destructure does not support nested patterns.`, left);
  3213. }
  3214. // store default value
  3215. propsDestructuredBindings[propKey] = {
  3216. local: left.name,
  3217. default: right
  3218. };
  3219. }
  3220. else if (prop.value.type === 'Identifier') {
  3221. // simple destructure
  3222. propsDestructuredBindings[propKey] = {
  3223. local: prop.value.name
  3224. };
  3225. }
  3226. else {
  3227. error(`${DEFINE_PROPS}() destructure does not support nested patterns.`, prop.value);
  3228. }
  3229. }
  3230. else {
  3231. // rest spread
  3232. propsDestructureRestId = prop.argument.name;
  3233. }
  3234. }
  3235. }
  3236. else {
  3237. propsIdentifier = scriptSetup.content.slice(declId.start, declId.end);
  3238. }
  3239. }
  3240. return true;
  3241. }
  3242. function processWithDefaults(node, declId) {
  3243. if (!isCallOf(node, WITH_DEFAULTS)) {
  3244. return false;
  3245. }
  3246. if (processDefineProps(node.arguments[0], declId)) {
  3247. if (propsRuntimeDecl) {
  3248. error(`${WITH_DEFAULTS} can only be used with type-based ` +
  3249. `${DEFINE_PROPS} declaration.`, node);
  3250. }
  3251. if (propsDestructureDecl) {
  3252. error(`${WITH_DEFAULTS}() is unnecessary when using destructure with ${DEFINE_PROPS}().\n` +
  3253. `Prefer using destructure default values, e.g. const { foo = 1 } = defineProps(...).`, node.callee);
  3254. }
  3255. propsRuntimeDefaults = node.arguments[1];
  3256. if (!propsRuntimeDefaults ||
  3257. propsRuntimeDefaults.type !== 'ObjectExpression') {
  3258. error(`The 2nd argument of ${WITH_DEFAULTS} must be an object literal.`, propsRuntimeDefaults || node);
  3259. }
  3260. }
  3261. else {
  3262. error(`${WITH_DEFAULTS}' first argument must be a ${DEFINE_PROPS} call.`, node.arguments[0] || node);
  3263. }
  3264. return true;
  3265. }
  3266. function processDefineEmits(node, declId) {
  3267. if (!isCallOf(node, DEFINE_EMITS)) {
  3268. return false;
  3269. }
  3270. if (hasDefineEmitCall) {
  3271. error(`duplicate ${DEFINE_EMITS}() call`, node);
  3272. }
  3273. hasDefineEmitCall = true;
  3274. emitsRuntimeDecl = node.arguments[0];
  3275. if (node.typeParameters) {
  3276. if (emitsRuntimeDecl) {
  3277. error(`${DEFINE_EMITS}() cannot accept both type and non-type arguments ` +
  3278. `at the same time. Use one or the other.`, node);
  3279. }
  3280. emitsTypeDeclRaw = node.typeParameters.params[0];
  3281. emitsTypeDecl = resolveQualifiedType(emitsTypeDeclRaw, node => node.type === 'TSFunctionType' || node.type === 'TSTypeLiteral');
  3282. if (!emitsTypeDecl) {
  3283. error(`type argument passed to ${DEFINE_EMITS}() must be a function type, ` +
  3284. `a literal type with call signatures, or a reference to the above types.`, emitsTypeDeclRaw);
  3285. }
  3286. }
  3287. if (declId) {
  3288. emitIdentifier =
  3289. declId.type === 'Identifier'
  3290. ? declId.name
  3291. : scriptSetup.content.slice(declId.start, declId.end);
  3292. }
  3293. return true;
  3294. }
  3295. function getAstBody() {
  3296. return scriptAst
  3297. ? [...scriptSetupAst.body, ...scriptAst.body]
  3298. : scriptSetupAst.body;
  3299. }
  3300. function resolveExtendsType(node, qualifier, cache = []) {
  3301. if (node.type === 'TSInterfaceDeclaration' && node.extends) {
  3302. node.extends.forEach(extend => {
  3303. if (extend.type === 'TSExpressionWithTypeArguments' &&
  3304. extend.expression.type === 'Identifier') {
  3305. const body = getAstBody();
  3306. for (const node of body) {
  3307. const qualified = isQualifiedType(node, qualifier, extend.expression.name);
  3308. if (qualified) {
  3309. cache.push(qualified);
  3310. resolveExtendsType(node, qualifier, cache);
  3311. return cache;
  3312. }
  3313. }
  3314. }
  3315. });
  3316. }
  3317. return cache;
  3318. }
  3319. function isQualifiedType(node, qualifier, refName) {
  3320. if (node.type === 'TSInterfaceDeclaration' && node.id.name === refName) {
  3321. return node.body;
  3322. }
  3323. else if (node.type === 'TSTypeAliasDeclaration' &&
  3324. node.id.name === refName &&
  3325. qualifier(node.typeAnnotation)) {
  3326. return node.typeAnnotation;
  3327. }
  3328. else if (node.type === 'ExportNamedDeclaration' && node.declaration) {
  3329. return isQualifiedType(node.declaration, qualifier, refName);
  3330. }
  3331. }
  3332. // filter all extends types to keep the override declaration
  3333. function filterExtendsType(extendsTypes, bodies) {
  3334. extendsTypes.forEach(extend => {
  3335. const body = extend.body;
  3336. body.forEach(newBody => {
  3337. if (newBody.type === 'TSPropertySignature' &&
  3338. newBody.key.type === 'Identifier') {
  3339. const name = newBody.key.name;
  3340. const hasOverride = bodies.some(seenBody => seenBody.type === 'TSPropertySignature' &&
  3341. seenBody.key.type === 'Identifier' &&
  3342. seenBody.key.name === name);
  3343. if (!hasOverride)
  3344. bodies.push(newBody);
  3345. }
  3346. });
  3347. });
  3348. }
  3349. function resolveQualifiedType(node, qualifier) {
  3350. if (qualifier(node)) {
  3351. return node;
  3352. }
  3353. if (node.type === 'TSTypeReference' &&
  3354. node.typeName.type === 'Identifier') {
  3355. const refName = node.typeName.name;
  3356. const body = getAstBody();
  3357. for (const node of body) {
  3358. let qualified = isQualifiedType(node, qualifier, refName);
  3359. if (qualified) {
  3360. const extendsTypes = resolveExtendsType(node, qualifier);
  3361. if (extendsTypes.length) {
  3362. const bodies = [...qualified.body];
  3363. filterExtendsType(extendsTypes, bodies);
  3364. qualified.body = bodies;
  3365. }
  3366. return qualified;
  3367. }
  3368. }
  3369. }
  3370. }
  3371. function processDefineExpose(node) {
  3372. if (isCallOf(node, DEFINE_EXPOSE)) {
  3373. if (hasDefineExposeCall) {
  3374. error(`duplicate ${DEFINE_EXPOSE}() call`, node);
  3375. }
  3376. hasDefineExposeCall = true;
  3377. return true;
  3378. }
  3379. return false;
  3380. }
  3381. function checkInvalidScopeReference(node, method) {
  3382. if (!node)
  3383. return;
  3384. CompilerDOM.walkIdentifiers(node, id => {
  3385. if (setupBindings[id.name]) {
  3386. error(`\`${method}()\` in <script setup> cannot reference locally ` +
  3387. `declared variables because it will be hoisted outside of the ` +
  3388. `setup() function. If your component options require initialization ` +
  3389. `in the module scope, use a separate normal <script> to export ` +
  3390. `the options instead.`, id);
  3391. }
  3392. });
  3393. }
  3394. /**
  3395. * await foo()
  3396. * -->
  3397. * ;(
  3398. * ([__temp,__restore] = withAsyncContext(() => foo())),
  3399. * await __temp,
  3400. * __restore()
  3401. * )
  3402. *
  3403. * const a = await foo()
  3404. * -->
  3405. * const a = (
  3406. * ([__temp, __restore] = withAsyncContext(() => foo())),
  3407. * __temp = await __temp,
  3408. * __restore(),
  3409. * __temp
  3410. * )
  3411. */
  3412. function processAwait(node, needSemi, isStatement) {
  3413. const argumentStart = node.argument.extra && node.argument.extra.parenthesized
  3414. ? node.argument.extra.parenStart
  3415. : node.argument.start;
  3416. const argumentStr = source.slice(argumentStart + startOffset, node.argument.end + startOffset);
  3417. const containsNestedAwait = /\bawait\b/.test(argumentStr);
  3418. s.overwrite(node.start + startOffset, argumentStart + startOffset, `${needSemi ? `;` : ``}(\n ([__temp,__restore] = ${helper(`withAsyncContext`)}(${containsNestedAwait ? `async ` : ``}() => `);
  3419. s.appendLeft(node.end + startOffset, `)),\n ${isStatement ? `` : `__temp = `}await __temp,\n __restore()${isStatement ? `` : `,\n __temp`}\n)`);
  3420. }
  3421. /**
  3422. * check defaults. If the default object is an object literal with only
  3423. * static properties, we can directly generate more optimized default
  3424. * declarations. Otherwise we will have to fallback to runtime merging.
  3425. */
  3426. function hasStaticWithDefaults() {
  3427. return (propsRuntimeDefaults &&
  3428. propsRuntimeDefaults.type === 'ObjectExpression' &&
  3429. propsRuntimeDefaults.properties.every(node => (node.type === 'ObjectProperty' &&
  3430. (!node.computed || node.key.type.endsWith('Literal'))) ||
  3431. node.type === 'ObjectMethod'));
  3432. }
  3433. function genRuntimeProps(props) {
  3434. const keys = Object.keys(props);
  3435. if (!keys.length) {
  3436. return ``;
  3437. }
  3438. const hasStaticDefaults = hasStaticWithDefaults();
  3439. const scriptSetupSource = scriptSetup.content;
  3440. let propsDecls = `{
  3441. ${keys
  3442. .map(key => {
  3443. let defaultString;
  3444. const destructured = genDestructuredDefaultValue(key);
  3445. if (destructured) {
  3446. defaultString = `default: ${destructured}`;
  3447. }
  3448. else if (hasStaticDefaults) {
  3449. const prop = propsRuntimeDefaults.properties.find(node => {
  3450. if (node.type === 'SpreadElement')
  3451. return false;
  3452. return resolveObjectKey(node.key, node.computed) === key;
  3453. });
  3454. if (prop) {
  3455. if (prop.type === 'ObjectProperty') {
  3456. // prop has corresponding static default value
  3457. defaultString = `default: ${scriptSetupSource.slice(prop.value.start, prop.value.end)}`;
  3458. }
  3459. else {
  3460. defaultString = `${prop.async ? 'async ' : ''}${prop.kind !== 'method' ? `${prop.kind} ` : ''}default() ${scriptSetupSource.slice(prop.body.start, prop.body.end)}`;
  3461. }
  3462. }
  3463. }
  3464. const { type, required } = props[key];
  3465. if (!isProd) {
  3466. return `${key}: { type: ${toRuntimeTypeString(type)}, required: ${required}${defaultString ? `, ${defaultString}` : ``} }`;
  3467. }
  3468. else if (type.some(el => el === 'Boolean' || (defaultString && el === 'Function'))) {
  3469. // #4783 production: if boolean or defaultString and function exists, should keep the type.
  3470. return `${key}: { type: ${toRuntimeTypeString(type)}${defaultString ? `, ${defaultString}` : ``} }`;
  3471. }
  3472. else {
  3473. // production: checks are useless
  3474. return `${key}: ${defaultString ? `{ ${defaultString} }` : 'null'}`;
  3475. }
  3476. })
  3477. .join(',\n ')}\n }`;
  3478. if (propsRuntimeDefaults && !hasStaticDefaults) {
  3479. propsDecls = `${helper('mergeDefaults')}(${propsDecls}, ${source.slice(propsRuntimeDefaults.start + startOffset, propsRuntimeDefaults.end + startOffset)})`;
  3480. }
  3481. return `\n props: ${propsDecls},`;
  3482. }
  3483. function genDestructuredDefaultValue(key) {
  3484. const destructured = propsDestructuredBindings[key];
  3485. if (destructured && destructured.default) {
  3486. const value = scriptSetup.content.slice(destructured.default.start, destructured.default.end);
  3487. const isLiteral = destructured.default.type.endsWith('Literal');
  3488. return isLiteral ? value : `() => (${value})`;
  3489. }
  3490. }
  3491. function genSetupPropsType(node) {
  3492. const scriptSetupSource = scriptSetup.content;
  3493. if (hasStaticWithDefaults()) {
  3494. // if withDefaults() is used, we need to remove the optional flags
  3495. // on props that have default values
  3496. let res = `{ `;
  3497. const members = node.type === 'TSTypeLiteral' ? node.members : node.body;
  3498. for (const m of members) {
  3499. if ((m.type === 'TSPropertySignature' ||
  3500. m.type === 'TSMethodSignature') &&
  3501. m.typeAnnotation &&
  3502. m.key.type === 'Identifier') {
  3503. if (propsRuntimeDefaults.properties.some(p => {
  3504. if (p.type === 'SpreadElement')
  3505. return false;
  3506. return (resolveObjectKey(p.key, p.computed) ===
  3507. m.key.name);
  3508. })) {
  3509. res +=
  3510. m.key.name +
  3511. (m.type === 'TSMethodSignature' ? '()' : '') +
  3512. scriptSetupSource.slice(m.typeAnnotation.start, m.typeAnnotation.end) +
  3513. ', ';
  3514. }
  3515. else {
  3516. res +=
  3517. scriptSetupSource.slice(m.start, m.typeAnnotation.end) + `, `;
  3518. }
  3519. }
  3520. }
  3521. return (res.length ? res.slice(0, -2) : res) + ` }`;
  3522. }
  3523. else {
  3524. return scriptSetupSource.slice(node.start, node.end);
  3525. }
  3526. }
  3527. // 0. parse both <script> and <script setup> blocks
  3528. const scriptAst = script &&
  3529. parse(script.content, {
  3530. plugins,
  3531. sourceType: 'module'
  3532. }, scriptStartOffset);
  3533. const scriptSetupAst = parse(scriptSetup.content, {
  3534. plugins: [
  3535. ...plugins,
  3536. // allow top level await but only inside <script setup>
  3537. 'topLevelAwait'
  3538. ],
  3539. sourceType: 'module'
  3540. }, startOffset);
  3541. // 1.1 walk import delcarations of <script>
  3542. if (scriptAst) {
  3543. for (const node of scriptAst.body) {
  3544. if (node.type === 'ImportDeclaration') {
  3545. // record imports for dedupe
  3546. for (const specifier of node.specifiers) {
  3547. const imported = specifier.type === 'ImportSpecifier' &&
  3548. specifier.imported.type === 'Identifier' &&
  3549. specifier.imported.name;
  3550. registerUserImport(node.source.value, specifier.local.name, imported, node.importKind === 'type' ||
  3551. (specifier.type === 'ImportSpecifier' &&
  3552. specifier.importKind === 'type'), false, !options.inlineTemplate);
  3553. }
  3554. }
  3555. }
  3556. }
  3557. // 1.2 walk import declarations of <script setup>
  3558. for (const node of scriptSetupAst.body) {
  3559. if (node.type === 'ImportDeclaration') {
  3560. // import declarations are moved to top
  3561. hoistNode(node);
  3562. // dedupe imports
  3563. let removed = 0;
  3564. const removeSpecifier = (i) => {
  3565. const removeLeft = i > removed;
  3566. removed++;
  3567. const current = node.specifiers[i];
  3568. const next = node.specifiers[i + 1];
  3569. s.remove(removeLeft
  3570. ? node.specifiers[i - 1].end + startOffset
  3571. : current.start + startOffset, next && !removeLeft
  3572. ? next.start + startOffset
  3573. : current.end + startOffset);
  3574. };
  3575. for (let i = 0; i < node.specifiers.length; i++) {
  3576. const specifier = node.specifiers[i];
  3577. const local = specifier.local.name;
  3578. let imported = specifier.type === 'ImportSpecifier' &&
  3579. specifier.imported.type === 'Identifier' &&
  3580. specifier.imported.name;
  3581. if (specifier.type === 'ImportNamespaceSpecifier') {
  3582. imported = '*';
  3583. }
  3584. const source = node.source.value;
  3585. const existing = userImports[local];
  3586. if (source === 'vue' &&
  3587. (imported === DEFINE_PROPS ||
  3588. imported === DEFINE_EMITS ||
  3589. imported === DEFINE_EXPOSE)) {
  3590. warnOnce(`\`${imported}\` is a compiler macro and no longer needs to be imported.`);
  3591. removeSpecifier(i);
  3592. }
  3593. else if (existing) {
  3594. if (existing.source === source && existing.imported === imported) {
  3595. // already imported in <script setup>, dedupe
  3596. removeSpecifier(i);
  3597. }
  3598. else {
  3599. error(`different imports aliased to same local name.`, specifier);
  3600. }
  3601. }
  3602. else {
  3603. registerUserImport(source, local, imported, node.importKind === 'type' ||
  3604. (specifier.type === 'ImportSpecifier' &&
  3605. specifier.importKind === 'type'), true, !options.inlineTemplate);
  3606. }
  3607. }
  3608. if (node.specifiers.length && removed === node.specifiers.length) {
  3609. s.remove(node.start + startOffset, node.end + startOffset);
  3610. }
  3611. }
  3612. }
  3613. // 1.3 resolve possible user import alias of `ref` and `reactive`
  3614. const vueImportAliases = {};
  3615. for (const key in userImports) {
  3616. const { source, imported, local } = userImports[key];
  3617. if (source === 'vue')
  3618. vueImportAliases[imported] = local;
  3619. }
  3620. // 2.1 process normal <script> body
  3621. if (script && scriptAst) {
  3622. for (const node of scriptAst.body) {
  3623. if (node.type === 'ExportDefaultDeclaration') {
  3624. // export default
  3625. defaultExport = node;
  3626. // check if user has manually specified `name` or 'render` option in
  3627. // export default
  3628. // if has name, skip name inference
  3629. // if has render and no template, generate return object instead of
  3630. // empty render function (#4980)
  3631. let optionProperties;
  3632. if (defaultExport.declaration.type === 'ObjectExpression') {
  3633. optionProperties = defaultExport.declaration.properties;
  3634. }
  3635. else if (defaultExport.declaration.type === 'CallExpression' &&
  3636. defaultExport.declaration.arguments[0].type === 'ObjectExpression') {
  3637. optionProperties = defaultExport.declaration.arguments[0].properties;
  3638. }
  3639. if (optionProperties) {
  3640. for (const s of optionProperties) {
  3641. if (s.type === 'ObjectProperty' &&
  3642. s.key.type === 'Identifier' &&
  3643. s.key.name === 'name') {
  3644. hasDefaultExportName = true;
  3645. }
  3646. if ((s.type === 'ObjectMethod' || s.type === 'ObjectProperty') &&
  3647. s.key.type === 'Identifier' &&
  3648. s.key.name === 'render') {
  3649. // TODO warn when we provide a better way to do it?
  3650. hasDefaultExportRender = true;
  3651. }
  3652. }
  3653. }
  3654. // export default { ... } --> const __default__ = { ... }
  3655. const start = node.start + scriptStartOffset;
  3656. const end = node.declaration.start + scriptStartOffset;
  3657. s.overwrite(start, end, `const ${DEFAULT_VAR} = `);
  3658. }
  3659. else if (node.type === 'ExportNamedDeclaration') {
  3660. const defaultSpecifier = node.specifiers.find(s => s.exported.type === 'Identifier' && s.exported.name === 'default');
  3661. if (defaultSpecifier) {
  3662. defaultExport = node;
  3663. // 1. remove specifier
  3664. if (node.specifiers.length > 1) {
  3665. s.remove(defaultSpecifier.start + scriptStartOffset, defaultSpecifier.end + scriptStartOffset);
  3666. }
  3667. else {
  3668. s.remove(node.start + scriptStartOffset, node.end + scriptStartOffset);
  3669. }
  3670. if (node.source) {
  3671. // export { x as default } from './x'
  3672. // rewrite to `import { x as __default__ } from './x'` and
  3673. // add to top
  3674. s.prepend(`import { ${defaultSpecifier.local.name} as ${DEFAULT_VAR} } from '${node.source.value}'\n`);
  3675. }
  3676. else {
  3677. // export { x as default }
  3678. // rewrite to `const __default__ = x` and move to end
  3679. s.appendLeft(scriptEndOffset, `\nconst ${DEFAULT_VAR} = ${defaultSpecifier.local.name}\n`);
  3680. }
  3681. }
  3682. if (node.declaration) {
  3683. walkDeclaration(node.declaration, scriptBindings, vueImportAliases);
  3684. }
  3685. }
  3686. else if ((node.type === 'VariableDeclaration' ||
  3687. node.type === 'FunctionDeclaration' ||
  3688. node.type === 'ClassDeclaration' ||
  3689. node.type === 'TSEnumDeclaration') &&
  3690. !node.declare) {
  3691. walkDeclaration(node, scriptBindings, vueImportAliases);
  3692. }
  3693. }
  3694. // apply reactivity transform
  3695. if (enableReactivityTransform && reactivityTransform.shouldTransform(script.content)) {
  3696. const { rootRefs, importedHelpers } = reactivityTransform.transformAST(scriptAst, s, scriptStartOffset);
  3697. refBindings = rootRefs;
  3698. for (const h of importedHelpers) {
  3699. helperImports.add(h);
  3700. }
  3701. }
  3702. // <script> after <script setup>
  3703. // we need to move the block up so that `const __default__` is
  3704. // declared before being used in the actual component definition
  3705. if (scriptStartOffset > startOffset) {
  3706. // if content doesn't end with newline, add one
  3707. if (!/\n$/.test(script.content.trim())) {
  3708. s.appendLeft(scriptEndOffset, `\n`);
  3709. }
  3710. s.move(scriptStartOffset, scriptEndOffset, 0);
  3711. }
  3712. }
  3713. // 2.2 process <script setup> body
  3714. for (const node of scriptSetupAst.body) {
  3715. // (Dropped) `ref: x` bindings
  3716. // TODO remove when out of experimental
  3717. if (node.type === 'LabeledStatement' &&
  3718. node.label.name === 'ref' &&
  3719. node.body.type === 'ExpressionStatement') {
  3720. error(`ref sugar using the label syntax was an experimental proposal and ` +
  3721. `has been dropped based on community feedback. Please check out ` +
  3722. `the new proposal at https://github.com/vuejs/rfcs/discussions/369`, node);
  3723. }
  3724. if (node.type === 'ExpressionStatement') {
  3725. // process `defineProps` and `defineEmit(s)` calls
  3726. if (processDefineProps(node.expression) ||
  3727. processDefineEmits(node.expression) ||
  3728. processWithDefaults(node.expression)) {
  3729. s.remove(node.start + startOffset, node.end + startOffset);
  3730. }
  3731. else if (processDefineExpose(node.expression)) {
  3732. // defineExpose({}) -> expose({})
  3733. const callee = node.expression.callee;
  3734. s.overwrite(callee.start + startOffset, callee.end + startOffset, 'expose');
  3735. }
  3736. }
  3737. if (node.type === 'VariableDeclaration' && !node.declare) {
  3738. const total = node.declarations.length;
  3739. let left = total;
  3740. for (let i = 0; i < total; i++) {
  3741. const decl = node.declarations[i];
  3742. if (decl.init) {
  3743. // defineProps / defineEmits
  3744. const isDefineProps = processDefineProps(decl.init, decl.id) ||
  3745. processWithDefaults(decl.init, decl.id);
  3746. const isDefineEmits = processDefineEmits(decl.init, decl.id);
  3747. if (isDefineProps || isDefineEmits) {
  3748. if (left === 1) {
  3749. s.remove(node.start + startOffset, node.end + startOffset);
  3750. }
  3751. else {
  3752. let start = decl.start + startOffset;
  3753. let end = decl.end + startOffset;
  3754. if (i === 0) {
  3755. // first one, locate the start of the next
  3756. end = node.declarations[i + 1].start + startOffset;
  3757. }
  3758. else {
  3759. // not first one, locate the end of the prev
  3760. start = node.declarations[i - 1].end + startOffset;
  3761. }
  3762. s.remove(start, end);
  3763. left--;
  3764. }
  3765. }
  3766. }
  3767. }
  3768. }
  3769. // walk declarations to record declared bindings
  3770. if ((node.type === 'VariableDeclaration' ||
  3771. node.type === 'FunctionDeclaration' ||
  3772. node.type === 'ClassDeclaration') &&
  3773. !node.declare) {
  3774. walkDeclaration(node, setupBindings, vueImportAliases);
  3775. }
  3776. // walk statements & named exports / variable declarations for top level
  3777. // await
  3778. if ((node.type === 'VariableDeclaration' && !node.declare) ||
  3779. node.type.endsWith('Statement')) {
  3780. const scope = [scriptSetupAst.body];
  3781. estreeWalker.walk(node, {
  3782. enter(child, parent) {
  3783. if (CompilerDOM.isFunctionType(child)) {
  3784. this.skip();
  3785. }
  3786. if (child.type === 'BlockStatement') {
  3787. scope.push(child.body);
  3788. }
  3789. if (child.type === 'AwaitExpression') {
  3790. hasAwait = true;
  3791. // if the await expression is an expression statement and
  3792. // - is in the root scope
  3793. // - or is not the first statement in a nested block scope
  3794. // then it needs a semicolon before the generated code.
  3795. const currentScope = scope[scope.length - 1];
  3796. const needsSemi = currentScope.some((n, i) => {
  3797. return ((scope.length === 1 || i > 0) &&
  3798. n.type === 'ExpressionStatement' &&
  3799. n.start === child.start);
  3800. });
  3801. processAwait(child, needsSemi, parent.type === 'ExpressionStatement');
  3802. }
  3803. },
  3804. exit(node) {
  3805. if (node.type === 'BlockStatement')
  3806. scope.pop();
  3807. }
  3808. });
  3809. }
  3810. if ((node.type === 'ExportNamedDeclaration' && node.exportKind !== 'type') ||
  3811. node.type === 'ExportAllDeclaration' ||
  3812. node.type === 'ExportDefaultDeclaration') {
  3813. error(`<script setup> cannot contain ES module exports. ` +
  3814. `If you are using a previous version of <script setup>, please ` +
  3815. `consult the updated RFC at https://github.com/vuejs/rfcs/pull/227.`, node);
  3816. }
  3817. if (isTS) {
  3818. // runtime enum
  3819. if (node.type === 'TSEnumDeclaration') {
  3820. registerBinding(setupBindings, node.id, "setup-const" /* BindingTypes.SETUP_CONST */);
  3821. }
  3822. // move all Type declarations to outer scope
  3823. if (node.type.startsWith('TS') ||
  3824. (node.type === 'ExportNamedDeclaration' &&
  3825. node.exportKind === 'type') ||
  3826. (node.type === 'VariableDeclaration' && node.declare)) {
  3827. recordType(node, declaredTypes);
  3828. hoistNode(node);
  3829. }
  3830. }
  3831. }
  3832. // 3. Apply reactivity transform
  3833. if ((enableReactivityTransform &&
  3834. // normal <script> had ref bindings that maybe used in <script setup>
  3835. (refBindings || reactivityTransform.shouldTransform(scriptSetup.content))) ||
  3836. propsDestructureDecl) {
  3837. const { rootRefs, importedHelpers } = reactivityTransform.transformAST(scriptSetupAst, s, startOffset, refBindings, propsDestructuredBindings);
  3838. refBindings = refBindings ? [...refBindings, ...rootRefs] : rootRefs;
  3839. for (const h of importedHelpers) {
  3840. helperImports.add(h);
  3841. }
  3842. }
  3843. // 4. extract runtime props/emits code from setup context type
  3844. if (propsTypeDecl) {
  3845. extractRuntimeProps(propsTypeDecl, typeDeclaredProps, declaredTypes);
  3846. }
  3847. if (emitsTypeDecl) {
  3848. extractRuntimeEmits(emitsTypeDecl, typeDeclaredEmits);
  3849. }
  3850. // 5. check useOptions args to make sure it doesn't reference setup scope
  3851. // variables
  3852. checkInvalidScopeReference(propsRuntimeDecl, DEFINE_PROPS);
  3853. checkInvalidScopeReference(propsRuntimeDefaults, DEFINE_PROPS);
  3854. checkInvalidScopeReference(propsDestructureDecl, DEFINE_PROPS);
  3855. checkInvalidScopeReference(emitsRuntimeDecl, DEFINE_EMITS);
  3856. // 6. remove non-script content
  3857. if (script) {
  3858. if (startOffset < scriptStartOffset) {
  3859. // <script setup> before <script>
  3860. s.remove(0, startOffset);
  3861. s.remove(endOffset, scriptStartOffset);
  3862. s.remove(scriptEndOffset, source.length);
  3863. }
  3864. else {
  3865. // <script> before <script setup>
  3866. s.remove(0, scriptStartOffset);
  3867. s.remove(scriptEndOffset, startOffset);
  3868. s.remove(endOffset, source.length);
  3869. }
  3870. }
  3871. else {
  3872. // only <script setup>
  3873. s.remove(0, startOffset);
  3874. s.remove(endOffset, source.length);
  3875. }
  3876. // 7. analyze binding metadata
  3877. if (scriptAst) {
  3878. Object.assign(bindingMetadata, analyzeScriptBindings(scriptAst.body));
  3879. }
  3880. if (propsRuntimeDecl) {
  3881. for (const key of getObjectOrArrayExpressionKeys(propsRuntimeDecl)) {
  3882. bindingMetadata[key] = "props" /* BindingTypes.PROPS */;
  3883. }
  3884. }
  3885. for (const key in typeDeclaredProps) {
  3886. bindingMetadata[key] = "props" /* BindingTypes.PROPS */;
  3887. }
  3888. // props aliases
  3889. if (propsDestructureDecl) {
  3890. if (propsDestructureRestId) {
  3891. bindingMetadata[propsDestructureRestId] =
  3892. "setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */;
  3893. }
  3894. for (const key in propsDestructuredBindings) {
  3895. const { local } = propsDestructuredBindings[key];
  3896. if (local !== key) {
  3897. bindingMetadata[local] = "props-aliased" /* BindingTypes.PROPS_ALIASED */;
  3898. (bindingMetadata.__propsAliases ||
  3899. (bindingMetadata.__propsAliases = {}))[local] = key;
  3900. }
  3901. }
  3902. }
  3903. for (const [key, { isType, imported, source }] of Object.entries(userImports)) {
  3904. if (isType)
  3905. continue;
  3906. bindingMetadata[key] =
  3907. imported === '*' ||
  3908. (imported === 'default' && source.endsWith('.vue')) ||
  3909. source === 'vue'
  3910. ? "setup-const" /* BindingTypes.SETUP_CONST */
  3911. : "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */;
  3912. }
  3913. for (const key in scriptBindings) {
  3914. bindingMetadata[key] = scriptBindings[key];
  3915. }
  3916. for (const key in setupBindings) {
  3917. bindingMetadata[key] = setupBindings[key];
  3918. }
  3919. // known ref bindings
  3920. if (refBindings) {
  3921. for (const key of refBindings) {
  3922. bindingMetadata[key] = "setup-ref" /* BindingTypes.SETUP_REF */;
  3923. }
  3924. }
  3925. // 8. inject `useCssVars` calls
  3926. if (cssVars.length &&
  3927. // no need to do this when targeting SSR
  3928. !(options.inlineTemplate && ((_a = options.templateOptions) === null || _a === void 0 ? void 0 : _a.ssr))) {
  3929. helperImports.add(CSS_VARS_HELPER);
  3930. helperImports.add('unref');
  3931. s.prependRight(startOffset, `\n${genCssVarsCode(cssVars, bindingMetadata, scopeId, isProd)}\n`);
  3932. }
  3933. // 9. finalize setup() argument signature
  3934. let args = `__props`;
  3935. if (propsTypeDecl) {
  3936. // mark as any and only cast on assignment
  3937. // since the user defined complex types may be incompatible with the
  3938. // inferred type from generated runtime declarations
  3939. args += `: any`;
  3940. }
  3941. // inject user assignment of props
  3942. // we use a default __props so that template expressions referencing props
  3943. // can use it directly
  3944. if (propsIdentifier) {
  3945. s.prependLeft(startOffset, `\nconst ${propsIdentifier} = __props${propsTypeDecl ? ` as ${genSetupPropsType(propsTypeDecl)}` : ``};\n`);
  3946. }
  3947. if (propsDestructureRestId) {
  3948. s.prependLeft(startOffset, `\nconst ${propsDestructureRestId} = ${helper(`createPropsRestProxy`)}(__props, ${JSON.stringify(Object.keys(propsDestructuredBindings))});\n`);
  3949. }
  3950. // inject temp variables for async context preservation
  3951. if (hasAwait) {
  3952. const any = isTS ? `: any` : ``;
  3953. s.prependLeft(startOffset, `\nlet __temp${any}, __restore${any}\n`);
  3954. }
  3955. const destructureElements = hasDefineExposeCall || !options.inlineTemplate ? [`expose`] : [];
  3956. if (emitIdentifier) {
  3957. destructureElements.push(emitIdentifier === `emit` ? `emit` : `emit: ${emitIdentifier}`);
  3958. }
  3959. if (destructureElements.length) {
  3960. args += `, { ${destructureElements.join(', ')} }`;
  3961. if (emitsTypeDecl) {
  3962. args += `: { emit: (${scriptSetup.content.slice(emitsTypeDecl.start, emitsTypeDecl.end)}), expose: any, slots: any, attrs: any }`;
  3963. }
  3964. }
  3965. // 10. generate return statement
  3966. let returned;
  3967. if (!options.inlineTemplate || (!sfc.template && hasDefaultExportRender)) {
  3968. // non-inline mode, or has manual render in normal <script>
  3969. // return bindings from script and script setup
  3970. const allBindings = {
  3971. ...scriptBindings,
  3972. ...setupBindings
  3973. };
  3974. for (const key in userImports) {
  3975. if (!userImports[key].isType && userImports[key].isUsedInTemplate) {
  3976. allBindings[key] = true;
  3977. }
  3978. }
  3979. returned = `{ `;
  3980. for (const key in allBindings) {
  3981. if (allBindings[key] === true &&
  3982. userImports[key].source !== 'vue' &&
  3983. !userImports[key].source.endsWith('.vue')) {
  3984. // generate getter for import bindings
  3985. // skip vue imports since we know they will never change
  3986. returned += `get ${key}() { return ${key} }, `;
  3987. }
  3988. else if (bindingMetadata[key] === "setup-let" /* BindingTypes.SETUP_LET */) {
  3989. // local let binding, also add setter
  3990. const setArg = key === 'v' ? `_v` : `v`;
  3991. returned +=
  3992. `get ${key}() { return ${key} }, ` +
  3993. `set ${key}(${setArg}) { ${key} = ${setArg} }, `;
  3994. }
  3995. else {
  3996. returned += `${key}, `;
  3997. }
  3998. }
  3999. returned = returned.replace(/, $/, '') + ` }`;
  4000. }
  4001. else {
  4002. // inline mode
  4003. if (sfc.template && !sfc.template.src) {
  4004. if (options.templateOptions && options.templateOptions.ssr) {
  4005. hasInlinedSsrRenderFn = true;
  4006. }
  4007. // inline render function mode - we are going to compile the template and
  4008. // inline it right here
  4009. const { code, ast, preamble, tips, errors } = compileTemplate({
  4010. filename,
  4011. source: sfc.template.content,
  4012. inMap: sfc.template.map,
  4013. ...options.templateOptions,
  4014. id: scopeId,
  4015. scoped: sfc.styles.some(s => s.scoped),
  4016. isProd: options.isProd,
  4017. ssrCssVars: sfc.cssVars,
  4018. compilerOptions: {
  4019. ...(options.templateOptions &&
  4020. options.templateOptions.compilerOptions),
  4021. inline: true,
  4022. isTS,
  4023. bindingMetadata
  4024. }
  4025. });
  4026. if (tips.length) {
  4027. tips.forEach(warnOnce);
  4028. }
  4029. const err = errors[0];
  4030. if (typeof err === 'string') {
  4031. throw new Error(err);
  4032. }
  4033. else if (err) {
  4034. if (err.loc) {
  4035. err.message +=
  4036. `\n\n` +
  4037. sfc.filename +
  4038. '\n' +
  4039. shared.generateCodeFrame(source, err.loc.start.offset, err.loc.end.offset) +
  4040. `\n`;
  4041. }
  4042. throw err;
  4043. }
  4044. if (preamble) {
  4045. s.prepend(preamble);
  4046. }
  4047. // avoid duplicated unref import
  4048. // as this may get injected by the render function preamble OR the
  4049. // css vars codegen
  4050. if (ast && ast.helpers.includes(CompilerDOM.UNREF)) {
  4051. helperImports.delete('unref');
  4052. }
  4053. returned = code;
  4054. }
  4055. else {
  4056. returned = `() => {}`;
  4057. }
  4058. }
  4059. if (!options.inlineTemplate && !false) {
  4060. // in non-inline mode, the `__isScriptSetup: true` flag is used by
  4061. // componentPublicInstance proxy to allow properties that start with $ or _
  4062. s.appendRight(endOffset, `\nconst __returned__ = ${returned}\n` +
  4063. `Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true })\n` +
  4064. `return __returned__` +
  4065. `\n}\n\n`);
  4066. }
  4067. else {
  4068. s.appendRight(endOffset, `\nreturn ${returned}\n}\n\n`);
  4069. }
  4070. // 11. finalize default export
  4071. let runtimeOptions = ``;
  4072. if (!hasDefaultExportName && filename && filename !== DEFAULT_FILENAME) {
  4073. const match = filename.match(/([^/\\]+)\.\w+$/);
  4074. if (match) {
  4075. runtimeOptions += `\n __name: '${match[1]}',`;
  4076. }
  4077. }
  4078. if (hasInlinedSsrRenderFn) {
  4079. runtimeOptions += `\n __ssrInlineRender: true,`;
  4080. }
  4081. if (propsRuntimeDecl) {
  4082. let declCode = scriptSetup.content
  4083. .slice(propsRuntimeDecl.start, propsRuntimeDecl.end)
  4084. .trim();
  4085. if (propsDestructureDecl) {
  4086. const defaults = [];
  4087. for (const key in propsDestructuredBindings) {
  4088. const d = genDestructuredDefaultValue(key);
  4089. if (d)
  4090. defaults.push(`${key}: ${d}`);
  4091. }
  4092. if (defaults.length) {
  4093. declCode = `${helper(`mergeDefaults`)}(${declCode}, {\n ${defaults.join(',\n ')}\n})`;
  4094. }
  4095. }
  4096. runtimeOptions += `\n props: ${declCode},`;
  4097. }
  4098. else if (propsTypeDecl) {
  4099. runtimeOptions += genRuntimeProps(typeDeclaredProps);
  4100. }
  4101. if (emitsRuntimeDecl) {
  4102. runtimeOptions += `\n emits: ${scriptSetup.content
  4103. .slice(emitsRuntimeDecl.start, emitsRuntimeDecl.end)
  4104. .trim()},`;
  4105. }
  4106. else if (emitsTypeDecl) {
  4107. runtimeOptions += genRuntimeEmits(typeDeclaredEmits);
  4108. }
  4109. // <script setup> components are closed by default. If the user did not
  4110. // explicitly call `defineExpose`, call expose() with no args.
  4111. const exposeCall = hasDefineExposeCall || options.inlineTemplate ? `` : ` expose();\n`;
  4112. // wrap setup code with function.
  4113. if (isTS) {
  4114. // for TS, make sure the exported type is still valid type with
  4115. // correct props information
  4116. // we have to use object spread for types to be merged properly
  4117. // user's TS setting should compile it down to proper targets
  4118. // export default defineComponent({ ...__default__, ... })
  4119. const def = defaultExport ? `\n ...${DEFAULT_VAR},` : ``;
  4120. s.prependLeft(startOffset, `\nexport default /*#__PURE__*/${helper(`defineComponent`)}({${def}${runtimeOptions}\n ${hasAwait ? `async ` : ``}setup(${args}) {\n${exposeCall}`);
  4121. s.appendRight(endOffset, `})`);
  4122. }
  4123. else {
  4124. if (defaultExport) {
  4125. // without TS, can't rely on rest spread, so we use Object.assign
  4126. // export default Object.assign(__default__, { ... })
  4127. s.prependLeft(startOffset, `\nexport default /*#__PURE__*/Object.assign(${DEFAULT_VAR}, {${runtimeOptions}\n ` +
  4128. `${hasAwait ? `async ` : ``}setup(${args}) {\n${exposeCall}`);
  4129. s.appendRight(endOffset, `})`);
  4130. }
  4131. else {
  4132. s.prependLeft(startOffset, `\nexport default {${runtimeOptions}\n ` +
  4133. `${hasAwait ? `async ` : ``}setup(${args}) {\n${exposeCall}`);
  4134. s.appendRight(endOffset, `}`);
  4135. }
  4136. }
  4137. // 12. finalize Vue helper imports
  4138. if (helperImports.size > 0) {
  4139. s.prepend(`import { ${[...helperImports]
  4140. .map(h => `${h} as _${h}`)
  4141. .join(', ')} } from 'vue'\n`);
  4142. }
  4143. s.trim();
  4144. return {
  4145. ...scriptSetup,
  4146. bindings: bindingMetadata,
  4147. imports: userImports,
  4148. content: s.toString(),
  4149. map: genSourceMap
  4150. ? s.generateMap({
  4151. source: filename,
  4152. hires: true,
  4153. includeContent: true
  4154. })
  4155. : undefined,
  4156. scriptAst: scriptAst === null || scriptAst === void 0 ? void 0 : scriptAst.body,
  4157. scriptSetupAst: scriptSetupAst === null || scriptSetupAst === void 0 ? void 0 : scriptSetupAst.body
  4158. };
  4159. }
  4160. function registerBinding(bindings, node, type) {
  4161. bindings[node.name] = type;
  4162. }
  4163. function walkDeclaration(node, bindings, userImportAliases) {
  4164. if (node.type === 'VariableDeclaration') {
  4165. const isConst = node.kind === 'const';
  4166. // export const foo = ...
  4167. for (const { id, init } of node.declarations) {
  4168. const isDefineCall = !!(isConst &&
  4169. isCallOf(init, c => c === DEFINE_PROPS || c === DEFINE_EMITS || c === WITH_DEFAULTS));
  4170. if (id.type === 'Identifier') {
  4171. let bindingType;
  4172. const userReactiveBinding = userImportAliases['reactive'];
  4173. if (isCallOf(init, userReactiveBinding)) {
  4174. // treat reactive() calls as let since it's meant to be mutable
  4175. bindingType = isConst
  4176. ? "setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */
  4177. : "setup-let" /* BindingTypes.SETUP_LET */;
  4178. }
  4179. else if (
  4180. // if a declaration is a const literal, we can mark it so that
  4181. // the generated render fn code doesn't need to unref() it
  4182. isDefineCall ||
  4183. (isConst && canNeverBeRef(init, userReactiveBinding))) {
  4184. bindingType = isCallOf(init, DEFINE_PROPS)
  4185. ? "setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */
  4186. : "setup-const" /* BindingTypes.SETUP_CONST */;
  4187. }
  4188. else if (isConst) {
  4189. if (isCallOf(init, userImportAliases['ref'])) {
  4190. bindingType = "setup-ref" /* BindingTypes.SETUP_REF */;
  4191. }
  4192. else {
  4193. bindingType = "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */;
  4194. }
  4195. }
  4196. else {
  4197. bindingType = "setup-let" /* BindingTypes.SETUP_LET */;
  4198. }
  4199. registerBinding(bindings, id, bindingType);
  4200. }
  4201. else {
  4202. if (isCallOf(init, DEFINE_PROPS)) {
  4203. // skip walking props destructure
  4204. return;
  4205. }
  4206. if (id.type === 'ObjectPattern') {
  4207. walkObjectPattern(id, bindings, isConst, isDefineCall);
  4208. }
  4209. else if (id.type === 'ArrayPattern') {
  4210. walkArrayPattern(id, bindings, isConst, isDefineCall);
  4211. }
  4212. }
  4213. }
  4214. }
  4215. else if (node.type === 'TSEnumDeclaration' ||
  4216. node.type === 'FunctionDeclaration' ||
  4217. node.type === 'ClassDeclaration') {
  4218. // export function foo() {} / export class Foo {}
  4219. // export declarations must be named.
  4220. bindings[node.id.name] = "setup-const" /* BindingTypes.SETUP_CONST */;
  4221. }
  4222. }
  4223. function walkObjectPattern(node, bindings, isConst, isDefineCall = false) {
  4224. for (const p of node.properties) {
  4225. if (p.type === 'ObjectProperty') {
  4226. if (p.key.type === 'Identifier' && p.key === p.value) {
  4227. // shorthand: const { x } = ...
  4228. const type = isDefineCall
  4229. ? "setup-const" /* BindingTypes.SETUP_CONST */
  4230. : isConst
  4231. ? "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */
  4232. : "setup-let" /* BindingTypes.SETUP_LET */;
  4233. registerBinding(bindings, p.key, type);
  4234. }
  4235. else {
  4236. walkPattern(p.value, bindings, isConst, isDefineCall);
  4237. }
  4238. }
  4239. else {
  4240. // ...rest
  4241. // argument can only be identifier when destructuring
  4242. const type = isConst ? "setup-const" /* BindingTypes.SETUP_CONST */ : "setup-let" /* BindingTypes.SETUP_LET */;
  4243. registerBinding(bindings, p.argument, type);
  4244. }
  4245. }
  4246. }
  4247. function walkArrayPattern(node, bindings, isConst, isDefineCall = false) {
  4248. for (const e of node.elements) {
  4249. e && walkPattern(e, bindings, isConst, isDefineCall);
  4250. }
  4251. }
  4252. function walkPattern(node, bindings, isConst, isDefineCall = false) {
  4253. if (node.type === 'Identifier') {
  4254. const type = isDefineCall
  4255. ? "setup-const" /* BindingTypes.SETUP_CONST */
  4256. : isConst
  4257. ? "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */
  4258. : "setup-let" /* BindingTypes.SETUP_LET */;
  4259. registerBinding(bindings, node, type);
  4260. }
  4261. else if (node.type === 'RestElement') {
  4262. // argument can only be identifier when destructuring
  4263. const type = isConst ? "setup-const" /* BindingTypes.SETUP_CONST */ : "setup-let" /* BindingTypes.SETUP_LET */;
  4264. registerBinding(bindings, node.argument, type);
  4265. }
  4266. else if (node.type === 'ObjectPattern') {
  4267. walkObjectPattern(node, bindings, isConst);
  4268. }
  4269. else if (node.type === 'ArrayPattern') {
  4270. walkArrayPattern(node, bindings, isConst);
  4271. }
  4272. else if (node.type === 'AssignmentPattern') {
  4273. if (node.left.type === 'Identifier') {
  4274. const type = isDefineCall
  4275. ? "setup-const" /* BindingTypes.SETUP_CONST */
  4276. : isConst
  4277. ? "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */
  4278. : "setup-let" /* BindingTypes.SETUP_LET */;
  4279. registerBinding(bindings, node.left, type);
  4280. }
  4281. else {
  4282. walkPattern(node.left, bindings, isConst);
  4283. }
  4284. }
  4285. }
  4286. function recordType(node, declaredTypes) {
  4287. if (node.type === 'TSInterfaceDeclaration') {
  4288. declaredTypes[node.id.name] = [`Object`];
  4289. }
  4290. else if (node.type === 'TSTypeAliasDeclaration') {
  4291. declaredTypes[node.id.name] = inferRuntimeType(node.typeAnnotation, declaredTypes);
  4292. }
  4293. else if (node.type === 'ExportNamedDeclaration' && node.declaration) {
  4294. recordType(node.declaration, declaredTypes);
  4295. }
  4296. }
  4297. function extractRuntimeProps(node, props, declaredTypes, isProd) {
  4298. const members = node.type === 'TSTypeLiteral' ? node.members : node.body;
  4299. for (const m of members) {
  4300. if ((m.type === 'TSPropertySignature' || m.type === 'TSMethodSignature') &&
  4301. m.key.type === 'Identifier') {
  4302. let type;
  4303. if (m.type === 'TSMethodSignature') {
  4304. type = ['Function'];
  4305. }
  4306. else if (m.typeAnnotation) {
  4307. type = inferRuntimeType(m.typeAnnotation.typeAnnotation, declaredTypes);
  4308. }
  4309. props[m.key.name] = {
  4310. key: m.key.name,
  4311. required: !m.optional,
  4312. type: type || [`null`]
  4313. };
  4314. }
  4315. }
  4316. }
  4317. function inferRuntimeType(node, declaredTypes) {
  4318. switch (node.type) {
  4319. case 'TSStringKeyword':
  4320. return ['String'];
  4321. case 'TSNumberKeyword':
  4322. return ['Number'];
  4323. case 'TSBooleanKeyword':
  4324. return ['Boolean'];
  4325. case 'TSObjectKeyword':
  4326. return ['Object'];
  4327. case 'TSTypeLiteral':
  4328. // TODO (nice to have) generate runtime property validation
  4329. return ['Object'];
  4330. case 'TSFunctionType':
  4331. return ['Function'];
  4332. case 'TSArrayType':
  4333. case 'TSTupleType':
  4334. // TODO (nice to have) generate runtime element type/length checks
  4335. return ['Array'];
  4336. case 'TSLiteralType':
  4337. switch (node.literal.type) {
  4338. case 'StringLiteral':
  4339. return ['String'];
  4340. case 'BooleanLiteral':
  4341. return ['Boolean'];
  4342. case 'NumericLiteral':
  4343. case 'BigIntLiteral':
  4344. return ['Number'];
  4345. default:
  4346. return [`null`];
  4347. }
  4348. case 'TSTypeReference':
  4349. if (node.typeName.type === 'Identifier') {
  4350. if (declaredTypes[node.typeName.name]) {
  4351. return declaredTypes[node.typeName.name];
  4352. }
  4353. switch (node.typeName.name) {
  4354. case 'Array':
  4355. case 'Function':
  4356. case 'Object':
  4357. case 'Set':
  4358. case 'Map':
  4359. case 'WeakSet':
  4360. case 'WeakMap':
  4361. case 'Date':
  4362. case 'Promise':
  4363. return [node.typeName.name];
  4364. case 'Record':
  4365. case 'Partial':
  4366. case 'Readonly':
  4367. case 'Pick':
  4368. case 'Omit':
  4369. case 'Exclude':
  4370. case 'Extract':
  4371. case 'Required':
  4372. case 'InstanceType':
  4373. return ['Object'];
  4374. }
  4375. }
  4376. return [`null`];
  4377. case 'TSParenthesizedType':
  4378. return inferRuntimeType(node.typeAnnotation, declaredTypes);
  4379. case 'TSUnionType':
  4380. return [
  4381. ...new Set([].concat(...node.types.map(t => inferRuntimeType(t, declaredTypes))))
  4382. ];
  4383. case 'TSIntersectionType':
  4384. return ['Object'];
  4385. case 'TSSymbolKeyword':
  4386. return ['Symbol'];
  4387. default:
  4388. return [`null`]; // no runtime check
  4389. }
  4390. }
  4391. function toRuntimeTypeString(types) {
  4392. return types.length > 1 ? `[${types.join(', ')}]` : types[0];
  4393. }
  4394. function extractRuntimeEmits(node, emits) {
  4395. if (node.type === 'TSTypeLiteral' || node.type === 'TSInterfaceBody') {
  4396. const members = node.type === 'TSTypeLiteral' ? node.members : node.body;
  4397. for (let t of members) {
  4398. if (t.type === 'TSCallSignatureDeclaration') {
  4399. extractEventNames(t.parameters[0], emits);
  4400. }
  4401. }
  4402. return;
  4403. }
  4404. else {
  4405. extractEventNames(node.parameters[0], emits);
  4406. }
  4407. }
  4408. function extractEventNames(eventName, emits) {
  4409. if (eventName.type === 'Identifier' &&
  4410. eventName.typeAnnotation &&
  4411. eventName.typeAnnotation.type === 'TSTypeAnnotation') {
  4412. const typeNode = eventName.typeAnnotation.typeAnnotation;
  4413. if (typeNode.type === 'TSLiteralType') {
  4414. if (typeNode.literal.type !== 'UnaryExpression') {
  4415. emits.add(String(typeNode.literal.value));
  4416. }
  4417. }
  4418. else if (typeNode.type === 'TSUnionType') {
  4419. for (const t of typeNode.types) {
  4420. if (t.type === 'TSLiteralType' &&
  4421. t.literal.type !== 'UnaryExpression') {
  4422. emits.add(String(t.literal.value));
  4423. }
  4424. }
  4425. }
  4426. }
  4427. }
  4428. function genRuntimeEmits(emits) {
  4429. return emits.size
  4430. ? `\n emits: [${Array.from(emits)
  4431. .map(p => JSON.stringify(p))
  4432. .join(', ')}],`
  4433. : ``;
  4434. }
  4435. function isCallOf(node, test) {
  4436. return !!(node &&
  4437. test &&
  4438. node.type === 'CallExpression' &&
  4439. node.callee.type === 'Identifier' &&
  4440. (typeof test === 'string'
  4441. ? node.callee.name === test
  4442. : test(node.callee.name)));
  4443. }
  4444. function canNeverBeRef(node, userReactiveImport) {
  4445. if (isCallOf(node, userReactiveImport)) {
  4446. return true;
  4447. }
  4448. switch (node.type) {
  4449. case 'UnaryExpression':
  4450. case 'BinaryExpression':
  4451. case 'ArrayExpression':
  4452. case 'ObjectExpression':
  4453. case 'FunctionExpression':
  4454. case 'ArrowFunctionExpression':
  4455. case 'UpdateExpression':
  4456. case 'ClassExpression':
  4457. case 'TaggedTemplateExpression':
  4458. return true;
  4459. case 'SequenceExpression':
  4460. return canNeverBeRef(node.expressions[node.expressions.length - 1], userReactiveImport);
  4461. default:
  4462. if (node.type.endsWith('Literal')) {
  4463. return true;
  4464. }
  4465. return false;
  4466. }
  4467. }
  4468. /**
  4469. * Analyze bindings in normal `<script>`
  4470. * Note that `compileScriptSetup` already analyzes bindings as part of its
  4471. * compilation process so this should only be used on single `<script>` SFCs.
  4472. */
  4473. function analyzeScriptBindings(ast) {
  4474. for (const node of ast) {
  4475. if (node.type === 'ExportDefaultDeclaration' &&
  4476. node.declaration.type === 'ObjectExpression') {
  4477. return analyzeBindingsFromOptions(node.declaration);
  4478. }
  4479. }
  4480. return {};
  4481. }
  4482. function analyzeBindingsFromOptions(node) {
  4483. const bindings = {};
  4484. // #3270, #3275
  4485. // mark non-script-setup so we don't resolve components/directives from these
  4486. Object.defineProperty(bindings, '__isScriptSetup', {
  4487. enumerable: false,
  4488. value: false
  4489. });
  4490. for (const property of node.properties) {
  4491. if (property.type === 'ObjectProperty' &&
  4492. !property.computed &&
  4493. property.key.type === 'Identifier') {
  4494. // props
  4495. if (property.key.name === 'props') {
  4496. // props: ['foo']
  4497. // props: { foo: ... }
  4498. for (const key of getObjectOrArrayExpressionKeys(property.value)) {
  4499. bindings[key] = "props" /* BindingTypes.PROPS */;
  4500. }
  4501. }
  4502. // inject
  4503. else if (property.key.name === 'inject') {
  4504. // inject: ['foo']
  4505. // inject: { foo: {} }
  4506. for (const key of getObjectOrArrayExpressionKeys(property.value)) {
  4507. bindings[key] = "options" /* BindingTypes.OPTIONS */;
  4508. }
  4509. }
  4510. // computed & methods
  4511. else if (property.value.type === 'ObjectExpression' &&
  4512. (property.key.name === 'computed' || property.key.name === 'methods')) {
  4513. // methods: { foo() {} }
  4514. // computed: { foo() {} }
  4515. for (const key of getObjectExpressionKeys(property.value)) {
  4516. bindings[key] = "options" /* BindingTypes.OPTIONS */;
  4517. }
  4518. }
  4519. }
  4520. // setup & data
  4521. else if (property.type === 'ObjectMethod' &&
  4522. property.key.type === 'Identifier' &&
  4523. (property.key.name === 'setup' || property.key.name === 'data')) {
  4524. for (const bodyItem of property.body.body) {
  4525. // setup() {
  4526. // return {
  4527. // foo: null
  4528. // }
  4529. // }
  4530. if (bodyItem.type === 'ReturnStatement' &&
  4531. bodyItem.argument &&
  4532. bodyItem.argument.type === 'ObjectExpression') {
  4533. for (const key of getObjectExpressionKeys(bodyItem.argument)) {
  4534. bindings[key] =
  4535. property.key.name === 'setup'
  4536. ? "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */
  4537. : "data" /* BindingTypes.DATA */;
  4538. }
  4539. }
  4540. }
  4541. }
  4542. }
  4543. return bindings;
  4544. }
  4545. function getObjectExpressionKeys(node) {
  4546. const keys = [];
  4547. for (const prop of node.properties) {
  4548. if (prop.type === 'SpreadElement')
  4549. continue;
  4550. const key = resolveObjectKey(prop.key, prop.computed);
  4551. if (key)
  4552. keys.push(String(key));
  4553. }
  4554. return keys;
  4555. }
  4556. function getArrayExpressionKeys(node) {
  4557. const keys = [];
  4558. for (const element of node.elements) {
  4559. if (element && element.type === 'StringLiteral') {
  4560. keys.push(element.value);
  4561. }
  4562. }
  4563. return keys;
  4564. }
  4565. function getObjectOrArrayExpressionKeys(value) {
  4566. if (value.type === 'ArrayExpression') {
  4567. return getArrayExpressionKeys(value);
  4568. }
  4569. if (value.type === 'ObjectExpression') {
  4570. return getObjectExpressionKeys(value);
  4571. }
  4572. return [];
  4573. }
  4574. const templateUsageCheckCache = createCache();
  4575. function resolveTemplateUsageCheckString(sfc) {
  4576. const { content, ast } = sfc.template;
  4577. const cached = templateUsageCheckCache.get(content);
  4578. if (cached) {
  4579. return cached;
  4580. }
  4581. let code = '';
  4582. CompilerDOM.transform(CompilerDOM.createRoot([ast]), {
  4583. nodeTransforms: [
  4584. node => {
  4585. if (node.type === 1 /* NodeTypes.ELEMENT */) {
  4586. if (!CompilerDOM.parserOptions.isNativeTag(node.tag) &&
  4587. !CompilerDOM.parserOptions.isBuiltInComponent(node.tag)) {
  4588. code += `,${shared.camelize(node.tag)},${shared.capitalize(shared.camelize(node.tag))}`;
  4589. }
  4590. for (let i = 0; i < node.props.length; i++) {
  4591. const prop = node.props[i];
  4592. if (prop.type === 7 /* NodeTypes.DIRECTIVE */) {
  4593. if (!isBuiltInDir(prop.name)) {
  4594. code += `,v${shared.capitalize(shared.camelize(prop.name))}`;
  4595. }
  4596. if (prop.exp) {
  4597. code += `,${processExp(prop.exp.content, prop.name)}`;
  4598. }
  4599. }
  4600. }
  4601. }
  4602. else if (node.type === 5 /* NodeTypes.INTERPOLATION */) {
  4603. code += `,${processExp(node.content.content)}`;
  4604. }
  4605. }
  4606. ]
  4607. });
  4608. code += ';';
  4609. templateUsageCheckCache.set(content, code);
  4610. return code;
  4611. }
  4612. const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  4613. function processExp(exp, dir) {
  4614. if (/ as\s+\w|<.*>|:/.test(exp)) {
  4615. if (dir === 'slot') {
  4616. exp = `(${exp})=>{}`;
  4617. }
  4618. else if (dir === 'on') {
  4619. exp = `()=>{return ${exp}}`;
  4620. }
  4621. else if (dir === 'for') {
  4622. const inMatch = exp.match(forAliasRE);
  4623. if (inMatch) {
  4624. const [, LHS, RHS] = inMatch;
  4625. return processExp(`(${LHS})=>{}`) + processExp(RHS);
  4626. }
  4627. }
  4628. let ret = '';
  4629. // has potential type cast or generic arguments that uses types
  4630. const ast = parser$2.parseExpression(exp, { plugins: ['typescript'] });
  4631. CompilerDOM.walkIdentifiers(ast, node => {
  4632. ret += `,` + node.name;
  4633. });
  4634. return ret;
  4635. }
  4636. return stripStrings(exp);
  4637. }
  4638. function stripStrings(exp) {
  4639. return exp
  4640. .replace(/'[^']*'|"[^"]*"/g, '')
  4641. .replace(/`[^`]+`/g, stripTemplateString);
  4642. }
  4643. function stripTemplateString(str) {
  4644. const interpMatch = str.match(/\${[^}]+}/g);
  4645. if (interpMatch) {
  4646. return interpMatch.map(m => m.slice(2, -1)).join(',');
  4647. }
  4648. return '';
  4649. }
  4650. function isImportUsed(local, sfc) {
  4651. return new RegExp(
  4652. // #4274 escape $ since it's a special char in regex
  4653. // (and is the only regex special char that is valid in identifiers)
  4654. `[^\\w$_]${local.replace(/\$/g, '\\$')}[^\\w$_]`).test(resolveTemplateUsageCheckString(sfc));
  4655. }
  4656. /**
  4657. * Note: this comparison assumes the prev/next script are already identical,
  4658. * and only checks the special case where <script setup lang="ts"> unused import
  4659. * pruning result changes due to template changes.
  4660. */
  4661. function hmrShouldReload(prevImports, next) {
  4662. if (!next.scriptSetup ||
  4663. (next.scriptSetup.lang !== 'ts' && next.scriptSetup.lang !== 'tsx')) {
  4664. return false;
  4665. }
  4666. // for each previous import, check if its used status remain the same based on
  4667. // the next descriptor's template
  4668. for (const key in prevImports) {
  4669. // if an import was previous unused, but now is used, we need to force
  4670. // reload so that the script now includes that import.
  4671. if (!prevImports[key].isUsedInTemplate && isImportUsed(key, next)) {
  4672. return true;
  4673. }
  4674. }
  4675. return false;
  4676. }
  4677. function resolveObjectKey(node, computed) {
  4678. switch (node.type) {
  4679. case 'StringLiteral':
  4680. case 'NumericLiteral':
  4681. return node.value;
  4682. case 'Identifier':
  4683. if (!computed)
  4684. return node.name;
  4685. }
  4686. return undefined;
  4687. }
  4688. const DEFAULT_FILENAME = 'anonymous.vue';
  4689. const sourceToSFC = createCache();
  4690. function parse(source, { sourceMap = true, filename = DEFAULT_FILENAME, sourceRoot = '', pad = false, ignoreEmpty = true, compiler = CompilerDOM__namespace } = {}) {
  4691. const sourceKey = source + sourceMap + filename + sourceRoot + pad + compiler.parse;
  4692. const cache = sourceToSFC.get(sourceKey);
  4693. if (cache) {
  4694. return cache;
  4695. }
  4696. const descriptor = {
  4697. filename,
  4698. source,
  4699. template: null,
  4700. script: null,
  4701. scriptSetup: null,
  4702. styles: [],
  4703. customBlocks: [],
  4704. cssVars: [],
  4705. slotted: false,
  4706. shouldForceReload: prevImports => hmrShouldReload(prevImports, descriptor)
  4707. };
  4708. const errors = [];
  4709. const ast = compiler.parse(source, {
  4710. // there are no components at SFC parsing level
  4711. isNativeTag: () => true,
  4712. // preserve all whitespaces
  4713. isPreTag: () => true,
  4714. getTextMode: ({ tag, props }, parent) => {
  4715. // all top level elements except <template> are parsed as raw text
  4716. // containers
  4717. if ((!parent && tag !== 'template') ||
  4718. // <template lang="xxx"> should also be treated as raw text
  4719. (tag === 'template' &&
  4720. props.some(p => p.type === 6 /* NodeTypes.ATTRIBUTE */ &&
  4721. p.name === 'lang' &&
  4722. p.value &&
  4723. p.value.content &&
  4724. p.value.content !== 'html'))) {
  4725. return 2 /* TextModes.RAWTEXT */;
  4726. }
  4727. else {
  4728. return 0 /* TextModes.DATA */;
  4729. }
  4730. },
  4731. onError: e => {
  4732. errors.push(e);
  4733. }
  4734. });
  4735. ast.children.forEach(node => {
  4736. if (node.type !== 1 /* NodeTypes.ELEMENT */) {
  4737. return;
  4738. }
  4739. // we only want to keep the nodes that are not empty (when the tag is not a template)
  4740. if (ignoreEmpty &&
  4741. node.tag !== 'template' &&
  4742. isEmpty(node) &&
  4743. !hasSrc(node)) {
  4744. return;
  4745. }
  4746. switch (node.tag) {
  4747. case 'template':
  4748. if (!descriptor.template) {
  4749. const templateBlock = (descriptor.template = createBlock(node, source, false));
  4750. templateBlock.ast = node;
  4751. // warn against 2.x <template functional>
  4752. if (templateBlock.attrs.functional) {
  4753. const err = new SyntaxError(`<template functional> is no longer supported in Vue 3, since ` +
  4754. `functional components no longer have significant performance ` +
  4755. `difference from stateful ones. Just use a normal <template> ` +
  4756. `instead.`);
  4757. err.loc = node.props.find(p => p.name === 'functional').loc;
  4758. errors.push(err);
  4759. }
  4760. }
  4761. else {
  4762. errors.push(createDuplicateBlockError(node));
  4763. }
  4764. break;
  4765. case 'script':
  4766. const scriptBlock = createBlock(node, source, pad);
  4767. const isSetup = !!scriptBlock.attrs.setup;
  4768. if (isSetup && !descriptor.scriptSetup) {
  4769. descriptor.scriptSetup = scriptBlock;
  4770. break;
  4771. }
  4772. if (!isSetup && !descriptor.script) {
  4773. descriptor.script = scriptBlock;
  4774. break;
  4775. }
  4776. errors.push(createDuplicateBlockError(node, isSetup));
  4777. break;
  4778. case 'style':
  4779. const styleBlock = createBlock(node, source, pad);
  4780. if (styleBlock.attrs.vars) {
  4781. errors.push(new SyntaxError(`<style vars> has been replaced by a new proposal: ` +
  4782. `https://github.com/vuejs/rfcs/pull/231`));
  4783. }
  4784. descriptor.styles.push(styleBlock);
  4785. break;
  4786. default:
  4787. descriptor.customBlocks.push(createBlock(node, source, pad));
  4788. break;
  4789. }
  4790. });
  4791. if (!descriptor.template && !descriptor.script && !descriptor.scriptSetup) {
  4792. errors.push(new SyntaxError(`At least one <template> or <script> is required in a single file component.`));
  4793. }
  4794. if (descriptor.scriptSetup) {
  4795. if (descriptor.scriptSetup.src) {
  4796. errors.push(new SyntaxError(`<script setup> cannot use the "src" attribute because ` +
  4797. `its syntax will be ambiguous outside of the component.`));
  4798. descriptor.scriptSetup = null;
  4799. }
  4800. if (descriptor.script && descriptor.script.src) {
  4801. errors.push(new SyntaxError(`<script> cannot use the "src" attribute when <script setup> is ` +
  4802. `also present because they must be processed together.`));
  4803. descriptor.script = null;
  4804. }
  4805. }
  4806. if (sourceMap) {
  4807. const genMap = (block) => {
  4808. if (block && !block.src) {
  4809. block.map = generateSourceMap(filename, source, block.content, sourceRoot, !pad || block.type === 'template' ? block.loc.start.line - 1 : 0);
  4810. }
  4811. };
  4812. genMap(descriptor.template);
  4813. genMap(descriptor.script);
  4814. descriptor.styles.forEach(genMap);
  4815. descriptor.customBlocks.forEach(genMap);
  4816. }
  4817. // parse CSS vars
  4818. descriptor.cssVars = parseCssVars(descriptor);
  4819. // check if the SFC uses :slotted
  4820. const slottedRE = /(?:::v-|:)slotted\(/;
  4821. descriptor.slotted = descriptor.styles.some(s => s.scoped && slottedRE.test(s.content));
  4822. const result = {
  4823. descriptor,
  4824. errors
  4825. };
  4826. sourceToSFC.set(sourceKey, result);
  4827. return result;
  4828. }
  4829. function createDuplicateBlockError(node, isScriptSetup = false) {
  4830. const err = new SyntaxError(`Single file component can contain only one <${node.tag}${isScriptSetup ? ` setup` : ``}> element`);
  4831. err.loc = node.loc;
  4832. return err;
  4833. }
  4834. function createBlock(node, source, pad) {
  4835. const type = node.tag;
  4836. let { start, end } = node.loc;
  4837. let content = '';
  4838. if (node.children.length) {
  4839. start = node.children[0].loc.start;
  4840. end = node.children[node.children.length - 1].loc.end;
  4841. content = source.slice(start.offset, end.offset);
  4842. }
  4843. else {
  4844. const offset = node.loc.source.indexOf(`</`);
  4845. if (offset > -1) {
  4846. start = {
  4847. line: start.line,
  4848. column: start.column + offset,
  4849. offset: start.offset + offset
  4850. };
  4851. }
  4852. end = { ...start };
  4853. }
  4854. const loc = {
  4855. source: content,
  4856. start,
  4857. end
  4858. };
  4859. const attrs = {};
  4860. const block = {
  4861. type,
  4862. content,
  4863. loc,
  4864. attrs
  4865. };
  4866. if (pad) {
  4867. block.content = padContent(source, block, pad) + block.content;
  4868. }
  4869. node.props.forEach(p => {
  4870. if (p.type === 6 /* NodeTypes.ATTRIBUTE */) {
  4871. attrs[p.name] = p.value ? p.value.content || true : true;
  4872. if (p.name === 'lang') {
  4873. block.lang = p.value && p.value.content;
  4874. }
  4875. else if (p.name === 'src') {
  4876. block.src = p.value && p.value.content;
  4877. }
  4878. else if (type === 'style') {
  4879. if (p.name === 'scoped') {
  4880. block.scoped = true;
  4881. }
  4882. else if (p.name === 'module') {
  4883. block.module = attrs[p.name];
  4884. }
  4885. }
  4886. else if (type === 'script' && p.name === 'setup') {
  4887. block.setup = attrs.setup;
  4888. }
  4889. }
  4890. });
  4891. return block;
  4892. }
  4893. const splitRE = /\r?\n/g;
  4894. const emptyRE = /^(?:\/\/)?\s*$/;
  4895. const replaceRE = /./g;
  4896. function generateSourceMap(filename, source, generated, sourceRoot, lineOffset) {
  4897. const map = new sourceMap.SourceMapGenerator({
  4898. file: filename.replace(/\\/g, '/'),
  4899. sourceRoot: sourceRoot.replace(/\\/g, '/')
  4900. });
  4901. map.setSourceContent(filename, source);
  4902. generated.split(splitRE).forEach((line, index) => {
  4903. if (!emptyRE.test(line)) {
  4904. const originalLine = index + 1 + lineOffset;
  4905. const generatedLine = index + 1;
  4906. for (let i = 0; i < line.length; i++) {
  4907. if (!/\s/.test(line[i])) {
  4908. map.addMapping({
  4909. source: filename,
  4910. original: {
  4911. line: originalLine,
  4912. column: i
  4913. },
  4914. generated: {
  4915. line: generatedLine,
  4916. column: i
  4917. }
  4918. });
  4919. }
  4920. }
  4921. }
  4922. });
  4923. return JSON.parse(map.toString());
  4924. }
  4925. function padContent(content, block, pad) {
  4926. content = content.slice(0, block.loc.start.offset);
  4927. if (pad === 'space') {
  4928. return content.replace(replaceRE, ' ');
  4929. }
  4930. else {
  4931. const offset = content.split(splitRE).length;
  4932. const padChar = block.type === 'script' && !block.lang ? '//\n' : '\n';
  4933. return Array(offset).join(padChar);
  4934. }
  4935. }
  4936. function hasSrc(node) {
  4937. return node.props.some(p => {
  4938. if (p.type !== 6 /* NodeTypes.ATTRIBUTE */) {
  4939. return false;
  4940. }
  4941. return p.name === 'src';
  4942. });
  4943. }
  4944. /**
  4945. * Returns true if the node has no children
  4946. * once the empty text nodes (trimmed content) have been filtered out.
  4947. */
  4948. function isEmpty(node) {
  4949. for (let i = 0; i < node.children.length; i++) {
  4950. const child = node.children[i];
  4951. if (child.type !== 2 /* NodeTypes.TEXT */ || child.content.trim() !== '') {
  4952. return false;
  4953. }
  4954. }
  4955. return true;
  4956. }
  4957. const trimPlugin = () => {
  4958. return {
  4959. postcssPlugin: 'vue-sfc-trim',
  4960. Once(root) {
  4961. root.walk(({ type, raws }) => {
  4962. if (type === 'rule' || type === 'atrule') {
  4963. if (raws.before)
  4964. raws.before = '\n';
  4965. if ('after' in raws && raws.after)
  4966. raws.after = '\n';
  4967. }
  4968. });
  4969. }
  4970. };
  4971. };
  4972. trimPlugin.postcss = true;
  4973. var unesc_1 = createCommonjsModule(function (module, exports) {
  4974. exports.__esModule = true;
  4975. exports["default"] = unesc;
  4976. // Many thanks for this post which made this migration much easier.
  4977. // https://mathiasbynens.be/notes/css-escapes
  4978. /**
  4979. *
  4980. * @param {string} str
  4981. * @returns {[string, number]|undefined}
  4982. */
  4983. function gobbleHex(str) {
  4984. var lower = str.toLowerCase();
  4985. var hex = '';
  4986. var spaceTerminated = false;
  4987. for (var i = 0; i < 6 && lower[i] !== undefined; i++) {
  4988. var code = lower.charCodeAt(i); // check to see if we are dealing with a valid hex char [a-f|0-9]
  4989. var valid = code >= 97 && code <= 102 || code >= 48 && code <= 57; // https://drafts.csswg.org/css-syntax/#consume-escaped-code-point
  4990. spaceTerminated = code === 32;
  4991. if (!valid) {
  4992. break;
  4993. }
  4994. hex += lower[i];
  4995. }
  4996. if (hex.length === 0) {
  4997. return undefined;
  4998. }
  4999. var codePoint = parseInt(hex, 16);
  5000. var isSurrogate = codePoint >= 0xD800 && codePoint <= 0xDFFF; // Add special case for
  5001. // "If this number is zero, or is for a surrogate, or is greater than the maximum allowed code point"
  5002. // https://drafts.csswg.org/css-syntax/#maximum-allowed-code-point
  5003. if (isSurrogate || codePoint === 0x0000 || codePoint > 0x10FFFF) {
  5004. return ["\uFFFD", hex.length + (spaceTerminated ? 1 : 0)];
  5005. }
  5006. return [String.fromCodePoint(codePoint), hex.length + (spaceTerminated ? 1 : 0)];
  5007. }
  5008. var CONTAINS_ESCAPE = /\\/;
  5009. function unesc(str) {
  5010. var needToProcess = CONTAINS_ESCAPE.test(str);
  5011. if (!needToProcess) {
  5012. return str;
  5013. }
  5014. var ret = "";
  5015. for (var i = 0; i < str.length; i++) {
  5016. if (str[i] === "\\") {
  5017. var gobbled = gobbleHex(str.slice(i + 1, i + 7));
  5018. if (gobbled !== undefined) {
  5019. ret += gobbled[0];
  5020. i += gobbled[1];
  5021. continue;
  5022. } // Retain a pair of \\ if double escaped `\\\\`
  5023. // https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e
  5024. if (str[i + 1] === "\\") {
  5025. ret += "\\";
  5026. i++;
  5027. continue;
  5028. } // if \\ is at the end of the string retain it
  5029. // https://github.com/postcss/postcss-selector-parser/commit/01a6b346e3612ce1ab20219acc26abdc259ccefb
  5030. if (str.length === i + 1) {
  5031. ret += str[i];
  5032. }
  5033. continue;
  5034. }
  5035. ret += str[i];
  5036. }
  5037. return ret;
  5038. }
  5039. module.exports = exports.default;
  5040. });
  5041. var getProp_1 = createCommonjsModule(function (module, exports) {
  5042. exports.__esModule = true;
  5043. exports["default"] = getProp;
  5044. function getProp(obj) {
  5045. for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  5046. props[_key - 1] = arguments[_key];
  5047. }
  5048. while (props.length > 0) {
  5049. var prop = props.shift();
  5050. if (!obj[prop]) {
  5051. return undefined;
  5052. }
  5053. obj = obj[prop];
  5054. }
  5055. return obj;
  5056. }
  5057. module.exports = exports.default;
  5058. });
  5059. var ensureObject_1 = createCommonjsModule(function (module, exports) {
  5060. exports.__esModule = true;
  5061. exports["default"] = ensureObject;
  5062. function ensureObject(obj) {
  5063. for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  5064. props[_key - 1] = arguments[_key];
  5065. }
  5066. while (props.length > 0) {
  5067. var prop = props.shift();
  5068. if (!obj[prop]) {
  5069. obj[prop] = {};
  5070. }
  5071. obj = obj[prop];
  5072. }
  5073. }
  5074. module.exports = exports.default;
  5075. });
  5076. var stripComments_1 = createCommonjsModule(function (module, exports) {
  5077. exports.__esModule = true;
  5078. exports["default"] = stripComments;
  5079. function stripComments(str) {
  5080. var s = "";
  5081. var commentStart = str.indexOf("/*");
  5082. var lastEnd = 0;
  5083. while (commentStart >= 0) {
  5084. s = s + str.slice(lastEnd, commentStart);
  5085. var commentEnd = str.indexOf("*/", commentStart + 2);
  5086. if (commentEnd < 0) {
  5087. return s;
  5088. }
  5089. lastEnd = commentEnd + 2;
  5090. commentStart = str.indexOf("/*", lastEnd);
  5091. }
  5092. s = s + str.slice(lastEnd);
  5093. return s;
  5094. }
  5095. module.exports = exports.default;
  5096. });
  5097. var util = createCommonjsModule(function (module, exports) {
  5098. exports.__esModule = true;
  5099. exports.stripComments = exports.ensureObject = exports.getProp = exports.unesc = void 0;
  5100. var _unesc = _interopRequireDefault(unesc_1);
  5101. exports.unesc = _unesc["default"];
  5102. var _getProp = _interopRequireDefault(getProp_1);
  5103. exports.getProp = _getProp["default"];
  5104. var _ensureObject = _interopRequireDefault(ensureObject_1);
  5105. exports.ensureObject = _ensureObject["default"];
  5106. var _stripComments = _interopRequireDefault(stripComments_1);
  5107. exports.stripComments = _stripComments["default"];
  5108. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5109. });
  5110. var node = createCommonjsModule(function (module, exports) {
  5111. exports.__esModule = true;
  5112. exports["default"] = void 0;
  5113. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  5114. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5115. var cloneNode = function cloneNode(obj, parent) {
  5116. if (typeof obj !== 'object' || obj === null) {
  5117. return obj;
  5118. }
  5119. var cloned = new obj.constructor();
  5120. for (var i in obj) {
  5121. if (!obj.hasOwnProperty(i)) {
  5122. continue;
  5123. }
  5124. var value = obj[i];
  5125. var type = typeof value;
  5126. if (i === 'parent' && type === 'object') {
  5127. if (parent) {
  5128. cloned[i] = parent;
  5129. }
  5130. } else if (value instanceof Array) {
  5131. cloned[i] = value.map(function (j) {
  5132. return cloneNode(j, cloned);
  5133. });
  5134. } else {
  5135. cloned[i] = cloneNode(value, cloned);
  5136. }
  5137. }
  5138. return cloned;
  5139. };
  5140. var Node = /*#__PURE__*/function () {
  5141. function Node(opts) {
  5142. if (opts === void 0) {
  5143. opts = {};
  5144. }
  5145. Object.assign(this, opts);
  5146. this.spaces = this.spaces || {};
  5147. this.spaces.before = this.spaces.before || '';
  5148. this.spaces.after = this.spaces.after || '';
  5149. }
  5150. var _proto = Node.prototype;
  5151. _proto.remove = function remove() {
  5152. if (this.parent) {
  5153. this.parent.removeChild(this);
  5154. }
  5155. this.parent = undefined;
  5156. return this;
  5157. };
  5158. _proto.replaceWith = function replaceWith() {
  5159. if (this.parent) {
  5160. for (var index in arguments) {
  5161. this.parent.insertBefore(this, arguments[index]);
  5162. }
  5163. this.remove();
  5164. }
  5165. return this;
  5166. };
  5167. _proto.next = function next() {
  5168. return this.parent.at(this.parent.index(this) + 1);
  5169. };
  5170. _proto.prev = function prev() {
  5171. return this.parent.at(this.parent.index(this) - 1);
  5172. };
  5173. _proto.clone = function clone(overrides) {
  5174. if (overrides === void 0) {
  5175. overrides = {};
  5176. }
  5177. var cloned = cloneNode(this);
  5178. for (var name in overrides) {
  5179. cloned[name] = overrides[name];
  5180. }
  5181. return cloned;
  5182. }
  5183. /**
  5184. * Some non-standard syntax doesn't follow normal escaping rules for css.
  5185. * This allows non standard syntax to be appended to an existing property
  5186. * by specifying the escaped value. By specifying the escaped value,
  5187. * illegal characters are allowed to be directly inserted into css output.
  5188. * @param {string} name the property to set
  5189. * @param {any} value the unescaped value of the property
  5190. * @param {string} valueEscaped optional. the escaped value of the property.
  5191. */
  5192. ;
  5193. _proto.appendToPropertyAndEscape = function appendToPropertyAndEscape(name, value, valueEscaped) {
  5194. if (!this.raws) {
  5195. this.raws = {};
  5196. }
  5197. var originalValue = this[name];
  5198. var originalEscaped = this.raws[name];
  5199. this[name] = originalValue + value; // this may trigger a setter that updates raws, so it has to be set first.
  5200. if (originalEscaped || valueEscaped !== value) {
  5201. this.raws[name] = (originalEscaped || originalValue) + valueEscaped;
  5202. } else {
  5203. delete this.raws[name]; // delete any escaped value that was created by the setter.
  5204. }
  5205. }
  5206. /**
  5207. * Some non-standard syntax doesn't follow normal escaping rules for css.
  5208. * This allows the escaped value to be specified directly, allowing illegal
  5209. * characters to be directly inserted into css output.
  5210. * @param {string} name the property to set
  5211. * @param {any} value the unescaped value of the property
  5212. * @param {string} valueEscaped the escaped value of the property.
  5213. */
  5214. ;
  5215. _proto.setPropertyAndEscape = function setPropertyAndEscape(name, value, valueEscaped) {
  5216. if (!this.raws) {
  5217. this.raws = {};
  5218. }
  5219. this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
  5220. this.raws[name] = valueEscaped;
  5221. }
  5222. /**
  5223. * When you want a value to passed through to CSS directly. This method
  5224. * deletes the corresponding raw value causing the stringifier to fallback
  5225. * to the unescaped value.
  5226. * @param {string} name the property to set.
  5227. * @param {any} value The value that is both escaped and unescaped.
  5228. */
  5229. ;
  5230. _proto.setPropertyWithoutEscape = function setPropertyWithoutEscape(name, value) {
  5231. this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
  5232. if (this.raws) {
  5233. delete this.raws[name];
  5234. }
  5235. }
  5236. /**
  5237. *
  5238. * @param {number} line The number (starting with 1)
  5239. * @param {number} column The column number (starting with 1)
  5240. */
  5241. ;
  5242. _proto.isAtPosition = function isAtPosition(line, column) {
  5243. if (this.source && this.source.start && this.source.end) {
  5244. if (this.source.start.line > line) {
  5245. return false;
  5246. }
  5247. if (this.source.end.line < line) {
  5248. return false;
  5249. }
  5250. if (this.source.start.line === line && this.source.start.column > column) {
  5251. return false;
  5252. }
  5253. if (this.source.end.line === line && this.source.end.column < column) {
  5254. return false;
  5255. }
  5256. return true;
  5257. }
  5258. return undefined;
  5259. };
  5260. _proto.stringifyProperty = function stringifyProperty(name) {
  5261. return this.raws && this.raws[name] || this[name];
  5262. };
  5263. _proto.valueToString = function valueToString() {
  5264. return String(this.stringifyProperty("value"));
  5265. };
  5266. _proto.toString = function toString() {
  5267. return [this.rawSpaceBefore, this.valueToString(), this.rawSpaceAfter].join('');
  5268. };
  5269. _createClass(Node, [{
  5270. key: "rawSpaceBefore",
  5271. get: function get() {
  5272. var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.before;
  5273. if (rawSpace === undefined) {
  5274. rawSpace = this.spaces && this.spaces.before;
  5275. }
  5276. return rawSpace || "";
  5277. },
  5278. set: function set(raw) {
  5279. (0, util.ensureObject)(this, "raws", "spaces");
  5280. this.raws.spaces.before = raw;
  5281. }
  5282. }, {
  5283. key: "rawSpaceAfter",
  5284. get: function get() {
  5285. var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.after;
  5286. if (rawSpace === undefined) {
  5287. rawSpace = this.spaces.after;
  5288. }
  5289. return rawSpace || "";
  5290. },
  5291. set: function set(raw) {
  5292. (0, util.ensureObject)(this, "raws", "spaces");
  5293. this.raws.spaces.after = raw;
  5294. }
  5295. }]);
  5296. return Node;
  5297. }();
  5298. exports["default"] = Node;
  5299. module.exports = exports.default;
  5300. });
  5301. var types = createCommonjsModule(function (module, exports) {
  5302. exports.__esModule = true;
  5303. exports.UNIVERSAL = exports.ATTRIBUTE = exports.CLASS = exports.COMBINATOR = exports.COMMENT = exports.ID = exports.NESTING = exports.PSEUDO = exports.ROOT = exports.SELECTOR = exports.STRING = exports.TAG = void 0;
  5304. var TAG = 'tag';
  5305. exports.TAG = TAG;
  5306. var STRING = 'string';
  5307. exports.STRING = STRING;
  5308. var SELECTOR = 'selector';
  5309. exports.SELECTOR = SELECTOR;
  5310. var ROOT = 'root';
  5311. exports.ROOT = ROOT;
  5312. var PSEUDO = 'pseudo';
  5313. exports.PSEUDO = PSEUDO;
  5314. var NESTING = 'nesting';
  5315. exports.NESTING = NESTING;
  5316. var ID = 'id';
  5317. exports.ID = ID;
  5318. var COMMENT = 'comment';
  5319. exports.COMMENT = COMMENT;
  5320. var COMBINATOR = 'combinator';
  5321. exports.COMBINATOR = COMBINATOR;
  5322. var CLASS = 'class';
  5323. exports.CLASS = CLASS;
  5324. var ATTRIBUTE = 'attribute';
  5325. exports.ATTRIBUTE = ATTRIBUTE;
  5326. var UNIVERSAL = 'universal';
  5327. exports.UNIVERSAL = UNIVERSAL;
  5328. });
  5329. var container = createCommonjsModule(function (module, exports) {
  5330. exports.__esModule = true;
  5331. exports["default"] = void 0;
  5332. var _node = _interopRequireDefault(node);
  5333. var types$1 = _interopRequireWildcard(types);
  5334. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
  5335. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
  5336. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5337. function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } it = o[Symbol.iterator](); return it.next.bind(it); }
  5338. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  5339. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  5340. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  5341. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5342. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5343. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5344. var Container = /*#__PURE__*/function (_Node) {
  5345. _inheritsLoose(Container, _Node);
  5346. function Container(opts) {
  5347. var _this;
  5348. _this = _Node.call(this, opts) || this;
  5349. if (!_this.nodes) {
  5350. _this.nodes = [];
  5351. }
  5352. return _this;
  5353. }
  5354. var _proto = Container.prototype;
  5355. _proto.append = function append(selector) {
  5356. selector.parent = this;
  5357. this.nodes.push(selector);
  5358. return this;
  5359. };
  5360. _proto.prepend = function prepend(selector) {
  5361. selector.parent = this;
  5362. this.nodes.unshift(selector);
  5363. return this;
  5364. };
  5365. _proto.at = function at(index) {
  5366. return this.nodes[index];
  5367. };
  5368. _proto.index = function index(child) {
  5369. if (typeof child === 'number') {
  5370. return child;
  5371. }
  5372. return this.nodes.indexOf(child);
  5373. };
  5374. _proto.removeChild = function removeChild(child) {
  5375. child = this.index(child);
  5376. this.at(child).parent = undefined;
  5377. this.nodes.splice(child, 1);
  5378. var index;
  5379. for (var id in this.indexes) {
  5380. index = this.indexes[id];
  5381. if (index >= child) {
  5382. this.indexes[id] = index - 1;
  5383. }
  5384. }
  5385. return this;
  5386. };
  5387. _proto.removeAll = function removeAll() {
  5388. for (var _iterator = _createForOfIteratorHelperLoose(this.nodes), _step; !(_step = _iterator()).done;) {
  5389. var node = _step.value;
  5390. node.parent = undefined;
  5391. }
  5392. this.nodes = [];
  5393. return this;
  5394. };
  5395. _proto.empty = function empty() {
  5396. return this.removeAll();
  5397. };
  5398. _proto.insertAfter = function insertAfter(oldNode, newNode) {
  5399. newNode.parent = this;
  5400. var oldIndex = this.index(oldNode);
  5401. this.nodes.splice(oldIndex + 1, 0, newNode);
  5402. newNode.parent = this;
  5403. var index;
  5404. for (var id in this.indexes) {
  5405. index = this.indexes[id];
  5406. if (oldIndex <= index) {
  5407. this.indexes[id] = index + 1;
  5408. }
  5409. }
  5410. return this;
  5411. };
  5412. _proto.insertBefore = function insertBefore(oldNode, newNode) {
  5413. newNode.parent = this;
  5414. var oldIndex = this.index(oldNode);
  5415. this.nodes.splice(oldIndex, 0, newNode);
  5416. newNode.parent = this;
  5417. var index;
  5418. for (var id in this.indexes) {
  5419. index = this.indexes[id];
  5420. if (index <= oldIndex) {
  5421. this.indexes[id] = index + 1;
  5422. }
  5423. }
  5424. return this;
  5425. };
  5426. _proto._findChildAtPosition = function _findChildAtPosition(line, col) {
  5427. var found = undefined;
  5428. this.each(function (node) {
  5429. if (node.atPosition) {
  5430. var foundChild = node.atPosition(line, col);
  5431. if (foundChild) {
  5432. found = foundChild;
  5433. return false;
  5434. }
  5435. } else if (node.isAtPosition(line, col)) {
  5436. found = node;
  5437. return false;
  5438. }
  5439. });
  5440. return found;
  5441. }
  5442. /**
  5443. * Return the most specific node at the line and column number given.
  5444. * The source location is based on the original parsed location, locations aren't
  5445. * updated as selector nodes are mutated.
  5446. *
  5447. * Note that this location is relative to the location of the first character
  5448. * of the selector, and not the location of the selector in the overall document
  5449. * when used in conjunction with postcss.
  5450. *
  5451. * If not found, returns undefined.
  5452. * @param {number} line The line number of the node to find. (1-based index)
  5453. * @param {number} col The column number of the node to find. (1-based index)
  5454. */
  5455. ;
  5456. _proto.atPosition = function atPosition(line, col) {
  5457. if (this.isAtPosition(line, col)) {
  5458. return this._findChildAtPosition(line, col) || this;
  5459. } else {
  5460. return undefined;
  5461. }
  5462. };
  5463. _proto._inferEndPosition = function _inferEndPosition() {
  5464. if (this.last && this.last.source && this.last.source.end) {
  5465. this.source = this.source || {};
  5466. this.source.end = this.source.end || {};
  5467. Object.assign(this.source.end, this.last.source.end);
  5468. }
  5469. };
  5470. _proto.each = function each(callback) {
  5471. if (!this.lastEach) {
  5472. this.lastEach = 0;
  5473. }
  5474. if (!this.indexes) {
  5475. this.indexes = {};
  5476. }
  5477. this.lastEach++;
  5478. var id = this.lastEach;
  5479. this.indexes[id] = 0;
  5480. if (!this.length) {
  5481. return undefined;
  5482. }
  5483. var index, result;
  5484. while (this.indexes[id] < this.length) {
  5485. index = this.indexes[id];
  5486. result = callback(this.at(index), index);
  5487. if (result === false) {
  5488. break;
  5489. }
  5490. this.indexes[id] += 1;
  5491. }
  5492. delete this.indexes[id];
  5493. if (result === false) {
  5494. return false;
  5495. }
  5496. };
  5497. _proto.walk = function walk(callback) {
  5498. return this.each(function (node, i) {
  5499. var result = callback(node, i);
  5500. if (result !== false && node.length) {
  5501. result = node.walk(callback);
  5502. }
  5503. if (result === false) {
  5504. return false;
  5505. }
  5506. });
  5507. };
  5508. _proto.walkAttributes = function walkAttributes(callback) {
  5509. var _this2 = this;
  5510. return this.walk(function (selector) {
  5511. if (selector.type === types$1.ATTRIBUTE) {
  5512. return callback.call(_this2, selector);
  5513. }
  5514. });
  5515. };
  5516. _proto.walkClasses = function walkClasses(callback) {
  5517. var _this3 = this;
  5518. return this.walk(function (selector) {
  5519. if (selector.type === types$1.CLASS) {
  5520. return callback.call(_this3, selector);
  5521. }
  5522. });
  5523. };
  5524. _proto.walkCombinators = function walkCombinators(callback) {
  5525. var _this4 = this;
  5526. return this.walk(function (selector) {
  5527. if (selector.type === types$1.COMBINATOR) {
  5528. return callback.call(_this4, selector);
  5529. }
  5530. });
  5531. };
  5532. _proto.walkComments = function walkComments(callback) {
  5533. var _this5 = this;
  5534. return this.walk(function (selector) {
  5535. if (selector.type === types$1.COMMENT) {
  5536. return callback.call(_this5, selector);
  5537. }
  5538. });
  5539. };
  5540. _proto.walkIds = function walkIds(callback) {
  5541. var _this6 = this;
  5542. return this.walk(function (selector) {
  5543. if (selector.type === types$1.ID) {
  5544. return callback.call(_this6, selector);
  5545. }
  5546. });
  5547. };
  5548. _proto.walkNesting = function walkNesting(callback) {
  5549. var _this7 = this;
  5550. return this.walk(function (selector) {
  5551. if (selector.type === types$1.NESTING) {
  5552. return callback.call(_this7, selector);
  5553. }
  5554. });
  5555. };
  5556. _proto.walkPseudos = function walkPseudos(callback) {
  5557. var _this8 = this;
  5558. return this.walk(function (selector) {
  5559. if (selector.type === types$1.PSEUDO) {
  5560. return callback.call(_this8, selector);
  5561. }
  5562. });
  5563. };
  5564. _proto.walkTags = function walkTags(callback) {
  5565. var _this9 = this;
  5566. return this.walk(function (selector) {
  5567. if (selector.type === types$1.TAG) {
  5568. return callback.call(_this9, selector);
  5569. }
  5570. });
  5571. };
  5572. _proto.walkUniversals = function walkUniversals(callback) {
  5573. var _this10 = this;
  5574. return this.walk(function (selector) {
  5575. if (selector.type === types$1.UNIVERSAL) {
  5576. return callback.call(_this10, selector);
  5577. }
  5578. });
  5579. };
  5580. _proto.split = function split(callback) {
  5581. var _this11 = this;
  5582. var current = [];
  5583. return this.reduce(function (memo, node, index) {
  5584. var split = callback.call(_this11, node);
  5585. current.push(node);
  5586. if (split) {
  5587. memo.push(current);
  5588. current = [];
  5589. } else if (index === _this11.length - 1) {
  5590. memo.push(current);
  5591. }
  5592. return memo;
  5593. }, []);
  5594. };
  5595. _proto.map = function map(callback) {
  5596. return this.nodes.map(callback);
  5597. };
  5598. _proto.reduce = function reduce(callback, memo) {
  5599. return this.nodes.reduce(callback, memo);
  5600. };
  5601. _proto.every = function every(callback) {
  5602. return this.nodes.every(callback);
  5603. };
  5604. _proto.some = function some(callback) {
  5605. return this.nodes.some(callback);
  5606. };
  5607. _proto.filter = function filter(callback) {
  5608. return this.nodes.filter(callback);
  5609. };
  5610. _proto.sort = function sort(callback) {
  5611. return this.nodes.sort(callback);
  5612. };
  5613. _proto.toString = function toString() {
  5614. return this.map(String).join('');
  5615. };
  5616. _createClass(Container, [{
  5617. key: "first",
  5618. get: function get() {
  5619. return this.at(0);
  5620. }
  5621. }, {
  5622. key: "last",
  5623. get: function get() {
  5624. return this.at(this.length - 1);
  5625. }
  5626. }, {
  5627. key: "length",
  5628. get: function get() {
  5629. return this.nodes.length;
  5630. }
  5631. }]);
  5632. return Container;
  5633. }(_node["default"]);
  5634. exports["default"] = Container;
  5635. module.exports = exports.default;
  5636. });
  5637. var root = createCommonjsModule(function (module, exports) {
  5638. exports.__esModule = true;
  5639. exports["default"] = void 0;
  5640. var _container = _interopRequireDefault(container);
  5641. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5642. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  5643. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5644. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5645. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5646. var Root = /*#__PURE__*/function (_Container) {
  5647. _inheritsLoose(Root, _Container);
  5648. function Root(opts) {
  5649. var _this;
  5650. _this = _Container.call(this, opts) || this;
  5651. _this.type = types.ROOT;
  5652. return _this;
  5653. }
  5654. var _proto = Root.prototype;
  5655. _proto.toString = function toString() {
  5656. var str = this.reduce(function (memo, selector) {
  5657. memo.push(String(selector));
  5658. return memo;
  5659. }, []).join(',');
  5660. return this.trailingComma ? str + ',' : str;
  5661. };
  5662. _proto.error = function error(message, options) {
  5663. if (this._error) {
  5664. return this._error(message, options);
  5665. } else {
  5666. return new Error(message);
  5667. }
  5668. };
  5669. _createClass(Root, [{
  5670. key: "errorGenerator",
  5671. set: function set(handler) {
  5672. this._error = handler;
  5673. }
  5674. }]);
  5675. return Root;
  5676. }(_container["default"]);
  5677. exports["default"] = Root;
  5678. module.exports = exports.default;
  5679. });
  5680. var selector = createCommonjsModule(function (module, exports) {
  5681. exports.__esModule = true;
  5682. exports["default"] = void 0;
  5683. var _container = _interopRequireDefault(container);
  5684. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5685. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5686. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5687. var Selector = /*#__PURE__*/function (_Container) {
  5688. _inheritsLoose(Selector, _Container);
  5689. function Selector(opts) {
  5690. var _this;
  5691. _this = _Container.call(this, opts) || this;
  5692. _this.type = types.SELECTOR;
  5693. return _this;
  5694. }
  5695. return Selector;
  5696. }(_container["default"]);
  5697. exports["default"] = Selector;
  5698. module.exports = exports.default;
  5699. });
  5700. /*! https://mths.be/cssesc v3.0.0 by @mathias */
  5701. var object = {};
  5702. var hasOwnProperty = object.hasOwnProperty;
  5703. var merge = function merge(options, defaults) {
  5704. if (!options) {
  5705. return defaults;
  5706. }
  5707. var result = {};
  5708. for (var key in defaults) {
  5709. // `if (defaults.hasOwnProperty(key) { … }` is not needed here, since
  5710. // only recognized option names are used.
  5711. result[key] = hasOwnProperty.call(options, key) ? options[key] : defaults[key];
  5712. }
  5713. return result;
  5714. };
  5715. var regexAnySingleEscape = /[ -,\.\/:-@\[-\^`\{-~]/;
  5716. var regexSingleEscape = /[ -,\.\/:-@\[\]\^`\{-~]/;
  5717. var regexExcessiveSpaces = /(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g;
  5718. // https://mathiasbynens.be/notes/css-escapes#css
  5719. var cssesc = function cssesc(string, options) {
  5720. options = merge(options, cssesc.options);
  5721. if (options.quotes != 'single' && options.quotes != 'double') {
  5722. options.quotes = 'single';
  5723. }
  5724. var quote = options.quotes == 'double' ? '"' : '\'';
  5725. var isIdentifier = options.isIdentifier;
  5726. var firstChar = string.charAt(0);
  5727. var output = '';
  5728. var counter = 0;
  5729. var length = string.length;
  5730. while (counter < length) {
  5731. var character = string.charAt(counter++);
  5732. var codePoint = character.charCodeAt();
  5733. var value = void 0;
  5734. // If it’s not a printable ASCII character…
  5735. if (codePoint < 0x20 || codePoint > 0x7E) {
  5736. if (codePoint >= 0xD800 && codePoint <= 0xDBFF && counter < length) {
  5737. // It’s a high surrogate, and there is a next character.
  5738. var extra = string.charCodeAt(counter++);
  5739. if ((extra & 0xFC00) == 0xDC00) {
  5740. // next character is low surrogate
  5741. codePoint = ((codePoint & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000;
  5742. } else {
  5743. // It’s an unmatched surrogate; only append this code unit, in case
  5744. // the next code unit is the high surrogate of a surrogate pair.
  5745. counter--;
  5746. }
  5747. }
  5748. value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
  5749. } else {
  5750. if (options.escapeEverything) {
  5751. if (regexAnySingleEscape.test(character)) {
  5752. value = '\\' + character;
  5753. } else {
  5754. value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
  5755. }
  5756. } else if (/[\t\n\f\r\x0B]/.test(character)) {
  5757. value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
  5758. } else if (character == '\\' || !isIdentifier && (character == '"' && quote == character || character == '\'' && quote == character) || isIdentifier && regexSingleEscape.test(character)) {
  5759. value = '\\' + character;
  5760. } else {
  5761. value = character;
  5762. }
  5763. }
  5764. output += value;
  5765. }
  5766. if (isIdentifier) {
  5767. if (/^-[-\d]/.test(output)) {
  5768. output = '\\-' + output.slice(1);
  5769. } else if (/\d/.test(firstChar)) {
  5770. output = '\\3' + firstChar + ' ' + output.slice(1);
  5771. }
  5772. }
  5773. // Remove spaces after `\HEX` escapes that are not followed by a hex digit,
  5774. // since they’re redundant. Note that this is only possible if the escape
  5775. // sequence isn’t preceded by an odd number of backslashes.
  5776. output = output.replace(regexExcessiveSpaces, function ($0, $1, $2) {
  5777. if ($1 && $1.length % 2) {
  5778. // It’s not safe to remove the space, so don’t.
  5779. return $0;
  5780. }
  5781. // Strip the space.
  5782. return ($1 || '') + $2;
  5783. });
  5784. if (!isIdentifier && options.wrap) {
  5785. return quote + output + quote;
  5786. }
  5787. return output;
  5788. };
  5789. // Expose default options (so they can be overridden globally).
  5790. cssesc.options = {
  5791. 'escapeEverything': false,
  5792. 'isIdentifier': false,
  5793. 'quotes': 'single',
  5794. 'wrap': false
  5795. };
  5796. cssesc.version = '3.0.0';
  5797. var cssesc_1 = cssesc;
  5798. var className = createCommonjsModule(function (module, exports) {
  5799. exports.__esModule = true;
  5800. exports["default"] = void 0;
  5801. var _cssesc = _interopRequireDefault(cssesc_1);
  5802. var _node = _interopRequireDefault(node);
  5803. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5804. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  5805. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5806. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5807. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5808. var ClassName = /*#__PURE__*/function (_Node) {
  5809. _inheritsLoose(ClassName, _Node);
  5810. function ClassName(opts) {
  5811. var _this;
  5812. _this = _Node.call(this, opts) || this;
  5813. _this.type = types.CLASS;
  5814. _this._constructed = true;
  5815. return _this;
  5816. }
  5817. var _proto = ClassName.prototype;
  5818. _proto.valueToString = function valueToString() {
  5819. return '.' + _Node.prototype.valueToString.call(this);
  5820. };
  5821. _createClass(ClassName, [{
  5822. key: "value",
  5823. get: function get() {
  5824. return this._value;
  5825. },
  5826. set: function set(v) {
  5827. if (this._constructed) {
  5828. var escaped = (0, _cssesc["default"])(v, {
  5829. isIdentifier: true
  5830. });
  5831. if (escaped !== v) {
  5832. (0, util.ensureObject)(this, "raws");
  5833. this.raws.value = escaped;
  5834. } else if (this.raws) {
  5835. delete this.raws.value;
  5836. }
  5837. }
  5838. this._value = v;
  5839. }
  5840. }]);
  5841. return ClassName;
  5842. }(_node["default"]);
  5843. exports["default"] = ClassName;
  5844. module.exports = exports.default;
  5845. });
  5846. var comment = createCommonjsModule(function (module, exports) {
  5847. exports.__esModule = true;
  5848. exports["default"] = void 0;
  5849. var _node = _interopRequireDefault(node);
  5850. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5851. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5852. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5853. var Comment = /*#__PURE__*/function (_Node) {
  5854. _inheritsLoose(Comment, _Node);
  5855. function Comment(opts) {
  5856. var _this;
  5857. _this = _Node.call(this, opts) || this;
  5858. _this.type = types.COMMENT;
  5859. return _this;
  5860. }
  5861. return Comment;
  5862. }(_node["default"]);
  5863. exports["default"] = Comment;
  5864. module.exports = exports.default;
  5865. });
  5866. var id = createCommonjsModule(function (module, exports) {
  5867. exports.__esModule = true;
  5868. exports["default"] = void 0;
  5869. var _node = _interopRequireDefault(node);
  5870. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5871. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5872. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5873. var ID = /*#__PURE__*/function (_Node) {
  5874. _inheritsLoose(ID, _Node);
  5875. function ID(opts) {
  5876. var _this;
  5877. _this = _Node.call(this, opts) || this;
  5878. _this.type = types.ID;
  5879. return _this;
  5880. }
  5881. var _proto = ID.prototype;
  5882. _proto.valueToString = function valueToString() {
  5883. return '#' + _Node.prototype.valueToString.call(this);
  5884. };
  5885. return ID;
  5886. }(_node["default"]);
  5887. exports["default"] = ID;
  5888. module.exports = exports.default;
  5889. });
  5890. var namespace = createCommonjsModule(function (module, exports) {
  5891. exports.__esModule = true;
  5892. exports["default"] = void 0;
  5893. var _cssesc = _interopRequireDefault(cssesc_1);
  5894. var _node = _interopRequireDefault(node);
  5895. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5896. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  5897. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5898. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5899. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5900. var Namespace = /*#__PURE__*/function (_Node) {
  5901. _inheritsLoose(Namespace, _Node);
  5902. function Namespace() {
  5903. return _Node.apply(this, arguments) || this;
  5904. }
  5905. var _proto = Namespace.prototype;
  5906. _proto.qualifiedName = function qualifiedName(value) {
  5907. if (this.namespace) {
  5908. return this.namespaceString + "|" + value;
  5909. } else {
  5910. return value;
  5911. }
  5912. };
  5913. _proto.valueToString = function valueToString() {
  5914. return this.qualifiedName(_Node.prototype.valueToString.call(this));
  5915. };
  5916. _createClass(Namespace, [{
  5917. key: "namespace",
  5918. get: function get() {
  5919. return this._namespace;
  5920. },
  5921. set: function set(namespace) {
  5922. if (namespace === true || namespace === "*" || namespace === "&") {
  5923. this._namespace = namespace;
  5924. if (this.raws) {
  5925. delete this.raws.namespace;
  5926. }
  5927. return;
  5928. }
  5929. var escaped = (0, _cssesc["default"])(namespace, {
  5930. isIdentifier: true
  5931. });
  5932. this._namespace = namespace;
  5933. if (escaped !== namespace) {
  5934. (0, util.ensureObject)(this, "raws");
  5935. this.raws.namespace = escaped;
  5936. } else if (this.raws) {
  5937. delete this.raws.namespace;
  5938. }
  5939. }
  5940. }, {
  5941. key: "ns",
  5942. get: function get() {
  5943. return this._namespace;
  5944. },
  5945. set: function set(namespace) {
  5946. this.namespace = namespace;
  5947. }
  5948. }, {
  5949. key: "namespaceString",
  5950. get: function get() {
  5951. if (this.namespace) {
  5952. var ns = this.stringifyProperty("namespace");
  5953. if (ns === true) {
  5954. return '';
  5955. } else {
  5956. return ns;
  5957. }
  5958. } else {
  5959. return '';
  5960. }
  5961. }
  5962. }]);
  5963. return Namespace;
  5964. }(_node["default"]);
  5965. exports["default"] = Namespace;
  5966. module.exports = exports.default;
  5967. });
  5968. var tag = createCommonjsModule(function (module, exports) {
  5969. exports.__esModule = true;
  5970. exports["default"] = void 0;
  5971. var _namespace = _interopRequireDefault(namespace);
  5972. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5973. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5974. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5975. var Tag = /*#__PURE__*/function (_Namespace) {
  5976. _inheritsLoose(Tag, _Namespace);
  5977. function Tag(opts) {
  5978. var _this;
  5979. _this = _Namespace.call(this, opts) || this;
  5980. _this.type = types.TAG;
  5981. return _this;
  5982. }
  5983. return Tag;
  5984. }(_namespace["default"]);
  5985. exports["default"] = Tag;
  5986. module.exports = exports.default;
  5987. });
  5988. var string = createCommonjsModule(function (module, exports) {
  5989. exports.__esModule = true;
  5990. exports["default"] = void 0;
  5991. var _node = _interopRequireDefault(node);
  5992. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5993. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5994. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5995. var String = /*#__PURE__*/function (_Node) {
  5996. _inheritsLoose(String, _Node);
  5997. function String(opts) {
  5998. var _this;
  5999. _this = _Node.call(this, opts) || this;
  6000. _this.type = types.STRING;
  6001. return _this;
  6002. }
  6003. return String;
  6004. }(_node["default"]);
  6005. exports["default"] = String;
  6006. module.exports = exports.default;
  6007. });
  6008. var pseudo = createCommonjsModule(function (module, exports) {
  6009. exports.__esModule = true;
  6010. exports["default"] = void 0;
  6011. var _container = _interopRequireDefault(container);
  6012. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6013. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  6014. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  6015. var Pseudo = /*#__PURE__*/function (_Container) {
  6016. _inheritsLoose(Pseudo, _Container);
  6017. function Pseudo(opts) {
  6018. var _this;
  6019. _this = _Container.call(this, opts) || this;
  6020. _this.type = types.PSEUDO;
  6021. return _this;
  6022. }
  6023. var _proto = Pseudo.prototype;
  6024. _proto.toString = function toString() {
  6025. var params = this.length ? '(' + this.map(String).join(',') + ')' : '';
  6026. return [this.rawSpaceBefore, this.stringifyProperty("value"), params, this.rawSpaceAfter].join('');
  6027. };
  6028. return Pseudo;
  6029. }(_container["default"]);
  6030. exports["default"] = Pseudo;
  6031. module.exports = exports.default;
  6032. });
  6033. /**
  6034. * For Node.js, simply re-export the core `util.deprecate` function.
  6035. */
  6036. var node$1 = util__default.deprecate;
  6037. var attribute = createCommonjsModule(function (module, exports) {
  6038. exports.__esModule = true;
  6039. exports.unescapeValue = unescapeValue;
  6040. exports["default"] = void 0;
  6041. var _cssesc = _interopRequireDefault(cssesc_1);
  6042. var _unesc = _interopRequireDefault(unesc_1);
  6043. var _namespace = _interopRequireDefault(namespace);
  6044. var _CSSESC_QUOTE_OPTIONS;
  6045. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6046. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  6047. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6048. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  6049. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  6050. var WRAPPED_IN_QUOTES = /^('|")([^]*)\1$/;
  6051. var warnOfDeprecatedValueAssignment = node$1(function () {}, "Assigning an attribute a value containing characters that might need to be escaped is deprecated. " + "Call attribute.setValue() instead.");
  6052. var warnOfDeprecatedQuotedAssignment = node$1(function () {}, "Assigning attr.quoted is deprecated and has no effect. Assign to attr.quoteMark instead.");
  6053. var warnOfDeprecatedConstructor = node$1(function () {}, "Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now.");
  6054. function unescapeValue(value) {
  6055. var deprecatedUsage = false;
  6056. var quoteMark = null;
  6057. var unescaped = value;
  6058. var m = unescaped.match(WRAPPED_IN_QUOTES);
  6059. if (m) {
  6060. quoteMark = m[1];
  6061. unescaped = m[2];
  6062. }
  6063. unescaped = (0, _unesc["default"])(unescaped);
  6064. if (unescaped !== value) {
  6065. deprecatedUsage = true;
  6066. }
  6067. return {
  6068. deprecatedUsage: deprecatedUsage,
  6069. unescaped: unescaped,
  6070. quoteMark: quoteMark
  6071. };
  6072. }
  6073. function handleDeprecatedContructorOpts(opts) {
  6074. if (opts.quoteMark !== undefined) {
  6075. return opts;
  6076. }
  6077. if (opts.value === undefined) {
  6078. return opts;
  6079. }
  6080. warnOfDeprecatedConstructor();
  6081. var _unescapeValue = unescapeValue(opts.value),
  6082. quoteMark = _unescapeValue.quoteMark,
  6083. unescaped = _unescapeValue.unescaped;
  6084. if (!opts.raws) {
  6085. opts.raws = {};
  6086. }
  6087. if (opts.raws.value === undefined) {
  6088. opts.raws.value = opts.value;
  6089. }
  6090. opts.value = unescaped;
  6091. opts.quoteMark = quoteMark;
  6092. return opts;
  6093. }
  6094. var Attribute = /*#__PURE__*/function (_Namespace) {
  6095. _inheritsLoose(Attribute, _Namespace);
  6096. function Attribute(opts) {
  6097. var _this;
  6098. if (opts === void 0) {
  6099. opts = {};
  6100. }
  6101. _this = _Namespace.call(this, handleDeprecatedContructorOpts(opts)) || this;
  6102. _this.type = types.ATTRIBUTE;
  6103. _this.raws = _this.raws || {};
  6104. Object.defineProperty(_this.raws, 'unquoted', {
  6105. get: node$1(function () {
  6106. return _this.value;
  6107. }, "attr.raws.unquoted is deprecated. Call attr.value instead."),
  6108. set: node$1(function () {
  6109. return _this.value;
  6110. }, "Setting attr.raws.unquoted is deprecated and has no effect. attr.value is unescaped by default now.")
  6111. });
  6112. _this._constructed = true;
  6113. return _this;
  6114. }
  6115. /**
  6116. * Returns the Attribute's value quoted such that it would be legal to use
  6117. * in the value of a css file. The original value's quotation setting
  6118. * used for stringification is left unchanged. See `setValue(value, options)`
  6119. * if you want to control the quote settings of a new value for the attribute.
  6120. *
  6121. * You can also change the quotation used for the current value by setting quoteMark.
  6122. *
  6123. * Options:
  6124. * * quoteMark {'"' | "'" | null} - Use this value to quote the value. If this
  6125. * option is not set, the original value for quoteMark will be used. If
  6126. * indeterminate, a double quote is used. The legal values are:
  6127. * * `null` - the value will be unquoted and characters will be escaped as necessary.
  6128. * * `'` - the value will be quoted with a single quote and single quotes are escaped.
  6129. * * `"` - the value will be quoted with a double quote and double quotes are escaped.
  6130. * * preferCurrentQuoteMark {boolean} - if true, prefer the source quote mark
  6131. * over the quoteMark option value.
  6132. * * smart {boolean} - if true, will select a quote mark based on the value
  6133. * and the other options specified here. See the `smartQuoteMark()`
  6134. * method.
  6135. **/
  6136. var _proto = Attribute.prototype;
  6137. _proto.getQuotedValue = function getQuotedValue(options) {
  6138. if (options === void 0) {
  6139. options = {};
  6140. }
  6141. var quoteMark = this._determineQuoteMark(options);
  6142. var cssescopts = CSSESC_QUOTE_OPTIONS[quoteMark];
  6143. var escaped = (0, _cssesc["default"])(this._value, cssescopts);
  6144. return escaped;
  6145. };
  6146. _proto._determineQuoteMark = function _determineQuoteMark(options) {
  6147. return options.smart ? this.smartQuoteMark(options) : this.preferredQuoteMark(options);
  6148. }
  6149. /**
  6150. * Set the unescaped value with the specified quotation options. The value
  6151. * provided must not include any wrapping quote marks -- those quotes will
  6152. * be interpreted as part of the value and escaped accordingly.
  6153. */
  6154. ;
  6155. _proto.setValue = function setValue(value, options) {
  6156. if (options === void 0) {
  6157. options = {};
  6158. }
  6159. this._value = value;
  6160. this._quoteMark = this._determineQuoteMark(options);
  6161. this._syncRawValue();
  6162. }
  6163. /**
  6164. * Intelligently select a quoteMark value based on the value's contents. If
  6165. * the value is a legal CSS ident, it will not be quoted. Otherwise a quote
  6166. * mark will be picked that minimizes the number of escapes.
  6167. *
  6168. * If there's no clear winner, the quote mark from these options is used,
  6169. * then the source quote mark (this is inverted if `preferCurrentQuoteMark` is
  6170. * true). If the quoteMark is unspecified, a double quote is used.
  6171. *
  6172. * @param options This takes the quoteMark and preferCurrentQuoteMark options
  6173. * from the quoteValue method.
  6174. */
  6175. ;
  6176. _proto.smartQuoteMark = function smartQuoteMark(options) {
  6177. var v = this.value;
  6178. var numSingleQuotes = v.replace(/[^']/g, '').length;
  6179. var numDoubleQuotes = v.replace(/[^"]/g, '').length;
  6180. if (numSingleQuotes + numDoubleQuotes === 0) {
  6181. var escaped = (0, _cssesc["default"])(v, {
  6182. isIdentifier: true
  6183. });
  6184. if (escaped === v) {
  6185. return Attribute.NO_QUOTE;
  6186. } else {
  6187. var pref = this.preferredQuoteMark(options);
  6188. if (pref === Attribute.NO_QUOTE) {
  6189. // pick a quote mark that isn't none and see if it's smaller
  6190. var quote = this.quoteMark || options.quoteMark || Attribute.DOUBLE_QUOTE;
  6191. var opts = CSSESC_QUOTE_OPTIONS[quote];
  6192. var quoteValue = (0, _cssesc["default"])(v, opts);
  6193. if (quoteValue.length < escaped.length) {
  6194. return quote;
  6195. }
  6196. }
  6197. return pref;
  6198. }
  6199. } else if (numDoubleQuotes === numSingleQuotes) {
  6200. return this.preferredQuoteMark(options);
  6201. } else if (numDoubleQuotes < numSingleQuotes) {
  6202. return Attribute.DOUBLE_QUOTE;
  6203. } else {
  6204. return Attribute.SINGLE_QUOTE;
  6205. }
  6206. }
  6207. /**
  6208. * Selects the preferred quote mark based on the options and the current quote mark value.
  6209. * If you want the quote mark to depend on the attribute value, call `smartQuoteMark(opts)`
  6210. * instead.
  6211. */
  6212. ;
  6213. _proto.preferredQuoteMark = function preferredQuoteMark(options) {
  6214. var quoteMark = options.preferCurrentQuoteMark ? this.quoteMark : options.quoteMark;
  6215. if (quoteMark === undefined) {
  6216. quoteMark = options.preferCurrentQuoteMark ? options.quoteMark : this.quoteMark;
  6217. }
  6218. if (quoteMark === undefined) {
  6219. quoteMark = Attribute.DOUBLE_QUOTE;
  6220. }
  6221. return quoteMark;
  6222. };
  6223. _proto._syncRawValue = function _syncRawValue() {
  6224. var rawValue = (0, _cssesc["default"])(this._value, CSSESC_QUOTE_OPTIONS[this.quoteMark]);
  6225. if (rawValue === this._value) {
  6226. if (this.raws) {
  6227. delete this.raws.value;
  6228. }
  6229. } else {
  6230. this.raws.value = rawValue;
  6231. }
  6232. };
  6233. _proto._handleEscapes = function _handleEscapes(prop, value) {
  6234. if (this._constructed) {
  6235. var escaped = (0, _cssesc["default"])(value, {
  6236. isIdentifier: true
  6237. });
  6238. if (escaped !== value) {
  6239. this.raws[prop] = escaped;
  6240. } else {
  6241. delete this.raws[prop];
  6242. }
  6243. }
  6244. };
  6245. _proto._spacesFor = function _spacesFor(name) {
  6246. var attrSpaces = {
  6247. before: '',
  6248. after: ''
  6249. };
  6250. var spaces = this.spaces[name] || {};
  6251. var rawSpaces = this.raws.spaces && this.raws.spaces[name] || {};
  6252. return Object.assign(attrSpaces, spaces, rawSpaces);
  6253. };
  6254. _proto._stringFor = function _stringFor(name, spaceName, concat) {
  6255. if (spaceName === void 0) {
  6256. spaceName = name;
  6257. }
  6258. if (concat === void 0) {
  6259. concat = defaultAttrConcat;
  6260. }
  6261. var attrSpaces = this._spacesFor(spaceName);
  6262. return concat(this.stringifyProperty(name), attrSpaces);
  6263. }
  6264. /**
  6265. * returns the offset of the attribute part specified relative to the
  6266. * start of the node of the output string.
  6267. *
  6268. * * "ns" - alias for "namespace"
  6269. * * "namespace" - the namespace if it exists.
  6270. * * "attribute" - the attribute name
  6271. * * "attributeNS" - the start of the attribute or its namespace
  6272. * * "operator" - the match operator of the attribute
  6273. * * "value" - The value (string or identifier)
  6274. * * "insensitive" - the case insensitivity flag;
  6275. * @param part One of the possible values inside an attribute.
  6276. * @returns -1 if the name is invalid or the value doesn't exist in this attribute.
  6277. */
  6278. ;
  6279. _proto.offsetOf = function offsetOf(name) {
  6280. var count = 1;
  6281. var attributeSpaces = this._spacesFor("attribute");
  6282. count += attributeSpaces.before.length;
  6283. if (name === "namespace" || name === "ns") {
  6284. return this.namespace ? count : -1;
  6285. }
  6286. if (name === "attributeNS") {
  6287. return count;
  6288. }
  6289. count += this.namespaceString.length;
  6290. if (this.namespace) {
  6291. count += 1;
  6292. }
  6293. if (name === "attribute") {
  6294. return count;
  6295. }
  6296. count += this.stringifyProperty("attribute").length;
  6297. count += attributeSpaces.after.length;
  6298. var operatorSpaces = this._spacesFor("operator");
  6299. count += operatorSpaces.before.length;
  6300. var operator = this.stringifyProperty("operator");
  6301. if (name === "operator") {
  6302. return operator ? count : -1;
  6303. }
  6304. count += operator.length;
  6305. count += operatorSpaces.after.length;
  6306. var valueSpaces = this._spacesFor("value");
  6307. count += valueSpaces.before.length;
  6308. var value = this.stringifyProperty("value");
  6309. if (name === "value") {
  6310. return value ? count : -1;
  6311. }
  6312. count += value.length;
  6313. count += valueSpaces.after.length;
  6314. var insensitiveSpaces = this._spacesFor("insensitive");
  6315. count += insensitiveSpaces.before.length;
  6316. if (name === "insensitive") {
  6317. return this.insensitive ? count : -1;
  6318. }
  6319. return -1;
  6320. };
  6321. _proto.toString = function toString() {
  6322. var _this2 = this;
  6323. var selector = [this.rawSpaceBefore, '['];
  6324. selector.push(this._stringFor('qualifiedAttribute', 'attribute'));
  6325. if (this.operator && (this.value || this.value === '')) {
  6326. selector.push(this._stringFor('operator'));
  6327. selector.push(this._stringFor('value'));
  6328. selector.push(this._stringFor('insensitiveFlag', 'insensitive', function (attrValue, attrSpaces) {
  6329. if (attrValue.length > 0 && !_this2.quoted && attrSpaces.before.length === 0 && !(_this2.spaces.value && _this2.spaces.value.after)) {
  6330. attrSpaces.before = " ";
  6331. }
  6332. return defaultAttrConcat(attrValue, attrSpaces);
  6333. }));
  6334. }
  6335. selector.push(']');
  6336. selector.push(this.rawSpaceAfter);
  6337. return selector.join('');
  6338. };
  6339. _createClass(Attribute, [{
  6340. key: "quoted",
  6341. get: function get() {
  6342. var qm = this.quoteMark;
  6343. return qm === "'" || qm === '"';
  6344. },
  6345. set: function set(value) {
  6346. warnOfDeprecatedQuotedAssignment();
  6347. }
  6348. /**
  6349. * returns a single (`'`) or double (`"`) quote character if the value is quoted.
  6350. * returns `null` if the value is not quoted.
  6351. * returns `undefined` if the quotation state is unknown (this can happen when
  6352. * the attribute is constructed without specifying a quote mark.)
  6353. */
  6354. }, {
  6355. key: "quoteMark",
  6356. get: function get() {
  6357. return this._quoteMark;
  6358. }
  6359. /**
  6360. * Set the quote mark to be used by this attribute's value.
  6361. * If the quote mark changes, the raw (escaped) value at `attr.raws.value` of the attribute
  6362. * value is updated accordingly.
  6363. *
  6364. * @param {"'" | '"' | null} quoteMark The quote mark or `null` if the value should be unquoted.
  6365. */
  6366. ,
  6367. set: function set(quoteMark) {
  6368. if (!this._constructed) {
  6369. this._quoteMark = quoteMark;
  6370. return;
  6371. }
  6372. if (this._quoteMark !== quoteMark) {
  6373. this._quoteMark = quoteMark;
  6374. this._syncRawValue();
  6375. }
  6376. }
  6377. }, {
  6378. key: "qualifiedAttribute",
  6379. get: function get() {
  6380. return this.qualifiedName(this.raws.attribute || this.attribute);
  6381. }
  6382. }, {
  6383. key: "insensitiveFlag",
  6384. get: function get() {
  6385. return this.insensitive ? 'i' : '';
  6386. }
  6387. }, {
  6388. key: "value",
  6389. get: function get() {
  6390. return this._value;
  6391. }
  6392. /**
  6393. * Before 3.0, the value had to be set to an escaped value including any wrapped
  6394. * quote marks. In 3.0, the semantics of `Attribute.value` changed so that the value
  6395. * is unescaped during parsing and any quote marks are removed.
  6396. *
  6397. * Because the ambiguity of this semantic change, if you set `attr.value = newValue`,
  6398. * a deprecation warning is raised when the new value contains any characters that would
  6399. * require escaping (including if it contains wrapped quotes).
  6400. *
  6401. * Instead, you should call `attr.setValue(newValue, opts)` and pass options that describe
  6402. * how the new value is quoted.
  6403. */
  6404. ,
  6405. set: function set(v) {
  6406. if (this._constructed) {
  6407. var _unescapeValue2 = unescapeValue(v),
  6408. deprecatedUsage = _unescapeValue2.deprecatedUsage,
  6409. unescaped = _unescapeValue2.unescaped,
  6410. quoteMark = _unescapeValue2.quoteMark;
  6411. if (deprecatedUsage) {
  6412. warnOfDeprecatedValueAssignment();
  6413. }
  6414. if (unescaped === this._value && quoteMark === this._quoteMark) {
  6415. return;
  6416. }
  6417. this._value = unescaped;
  6418. this._quoteMark = quoteMark;
  6419. this._syncRawValue();
  6420. } else {
  6421. this._value = v;
  6422. }
  6423. }
  6424. }, {
  6425. key: "attribute",
  6426. get: function get() {
  6427. return this._attribute;
  6428. },
  6429. set: function set(name) {
  6430. this._handleEscapes("attribute", name);
  6431. this._attribute = name;
  6432. }
  6433. }]);
  6434. return Attribute;
  6435. }(_namespace["default"]);
  6436. exports["default"] = Attribute;
  6437. Attribute.NO_QUOTE = null;
  6438. Attribute.SINGLE_QUOTE = "'";
  6439. Attribute.DOUBLE_QUOTE = '"';
  6440. var CSSESC_QUOTE_OPTIONS = (_CSSESC_QUOTE_OPTIONS = {
  6441. "'": {
  6442. quotes: 'single',
  6443. wrap: true
  6444. },
  6445. '"': {
  6446. quotes: 'double',
  6447. wrap: true
  6448. }
  6449. }, _CSSESC_QUOTE_OPTIONS[null] = {
  6450. isIdentifier: true
  6451. }, _CSSESC_QUOTE_OPTIONS);
  6452. function defaultAttrConcat(attrValue, attrSpaces) {
  6453. return "" + attrSpaces.before + attrValue + attrSpaces.after;
  6454. }
  6455. });
  6456. var universal = createCommonjsModule(function (module, exports) {
  6457. exports.__esModule = true;
  6458. exports["default"] = void 0;
  6459. var _namespace = _interopRequireDefault(namespace);
  6460. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6461. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  6462. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  6463. var Universal = /*#__PURE__*/function (_Namespace) {
  6464. _inheritsLoose(Universal, _Namespace);
  6465. function Universal(opts) {
  6466. var _this;
  6467. _this = _Namespace.call(this, opts) || this;
  6468. _this.type = types.UNIVERSAL;
  6469. _this.value = '*';
  6470. return _this;
  6471. }
  6472. return Universal;
  6473. }(_namespace["default"]);
  6474. exports["default"] = Universal;
  6475. module.exports = exports.default;
  6476. });
  6477. var combinator = createCommonjsModule(function (module, exports) {
  6478. exports.__esModule = true;
  6479. exports["default"] = void 0;
  6480. var _node = _interopRequireDefault(node);
  6481. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6482. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  6483. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  6484. var Combinator = /*#__PURE__*/function (_Node) {
  6485. _inheritsLoose(Combinator, _Node);
  6486. function Combinator(opts) {
  6487. var _this;
  6488. _this = _Node.call(this, opts) || this;
  6489. _this.type = types.COMBINATOR;
  6490. return _this;
  6491. }
  6492. return Combinator;
  6493. }(_node["default"]);
  6494. exports["default"] = Combinator;
  6495. module.exports = exports.default;
  6496. });
  6497. var nesting = createCommonjsModule(function (module, exports) {
  6498. exports.__esModule = true;
  6499. exports["default"] = void 0;
  6500. var _node = _interopRequireDefault(node);
  6501. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6502. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  6503. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  6504. var Nesting = /*#__PURE__*/function (_Node) {
  6505. _inheritsLoose(Nesting, _Node);
  6506. function Nesting(opts) {
  6507. var _this;
  6508. _this = _Node.call(this, opts) || this;
  6509. _this.type = types.NESTING;
  6510. _this.value = '&';
  6511. return _this;
  6512. }
  6513. return Nesting;
  6514. }(_node["default"]);
  6515. exports["default"] = Nesting;
  6516. module.exports = exports.default;
  6517. });
  6518. var sortAscending_1 = createCommonjsModule(function (module, exports) {
  6519. exports.__esModule = true;
  6520. exports["default"] = sortAscending;
  6521. function sortAscending(list) {
  6522. return list.sort(function (a, b) {
  6523. return a - b;
  6524. });
  6525. }
  6526. module.exports = exports.default;
  6527. });
  6528. var tokenTypes = createCommonjsModule(function (module, exports) {
  6529. exports.__esModule = true;
  6530. exports.combinator = exports.word = exports.comment = exports.str = exports.tab = exports.newline = exports.feed = exports.cr = exports.backslash = exports.bang = exports.slash = exports.doubleQuote = exports.singleQuote = exports.space = exports.greaterThan = exports.pipe = exports.equals = exports.plus = exports.caret = exports.tilde = exports.dollar = exports.closeSquare = exports.openSquare = exports.closeParenthesis = exports.openParenthesis = exports.semicolon = exports.colon = exports.comma = exports.at = exports.asterisk = exports.ampersand = void 0;
  6531. var ampersand = 38; // `&`.charCodeAt(0);
  6532. exports.ampersand = ampersand;
  6533. var asterisk = 42; // `*`.charCodeAt(0);
  6534. exports.asterisk = asterisk;
  6535. var at = 64; // `@`.charCodeAt(0);
  6536. exports.at = at;
  6537. var comma = 44; // `,`.charCodeAt(0);
  6538. exports.comma = comma;
  6539. var colon = 58; // `:`.charCodeAt(0);
  6540. exports.colon = colon;
  6541. var semicolon = 59; // `;`.charCodeAt(0);
  6542. exports.semicolon = semicolon;
  6543. var openParenthesis = 40; // `(`.charCodeAt(0);
  6544. exports.openParenthesis = openParenthesis;
  6545. var closeParenthesis = 41; // `)`.charCodeAt(0);
  6546. exports.closeParenthesis = closeParenthesis;
  6547. var openSquare = 91; // `[`.charCodeAt(0);
  6548. exports.openSquare = openSquare;
  6549. var closeSquare = 93; // `]`.charCodeAt(0);
  6550. exports.closeSquare = closeSquare;
  6551. var dollar = 36; // `$`.charCodeAt(0);
  6552. exports.dollar = dollar;
  6553. var tilde = 126; // `~`.charCodeAt(0);
  6554. exports.tilde = tilde;
  6555. var caret = 94; // `^`.charCodeAt(0);
  6556. exports.caret = caret;
  6557. var plus = 43; // `+`.charCodeAt(0);
  6558. exports.plus = plus;
  6559. var equals = 61; // `=`.charCodeAt(0);
  6560. exports.equals = equals;
  6561. var pipe = 124; // `|`.charCodeAt(0);
  6562. exports.pipe = pipe;
  6563. var greaterThan = 62; // `>`.charCodeAt(0);
  6564. exports.greaterThan = greaterThan;
  6565. var space = 32; // ` `.charCodeAt(0);
  6566. exports.space = space;
  6567. var singleQuote = 39; // `'`.charCodeAt(0);
  6568. exports.singleQuote = singleQuote;
  6569. var doubleQuote = 34; // `"`.charCodeAt(0);
  6570. exports.doubleQuote = doubleQuote;
  6571. var slash = 47; // `/`.charCodeAt(0);
  6572. exports.slash = slash;
  6573. var bang = 33; // `!`.charCodeAt(0);
  6574. exports.bang = bang;
  6575. var backslash = 92; // '\\'.charCodeAt(0);
  6576. exports.backslash = backslash;
  6577. var cr = 13; // '\r'.charCodeAt(0);
  6578. exports.cr = cr;
  6579. var feed = 12; // '\f'.charCodeAt(0);
  6580. exports.feed = feed;
  6581. var newline = 10; // '\n'.charCodeAt(0);
  6582. exports.newline = newline;
  6583. var tab = 9; // '\t'.charCodeAt(0);
  6584. // Expose aliases primarily for readability.
  6585. exports.tab = tab;
  6586. var str = singleQuote; // No good single character representation!
  6587. exports.str = str;
  6588. var comment = -1;
  6589. exports.comment = comment;
  6590. var word = -2;
  6591. exports.word = word;
  6592. var combinator = -3;
  6593. exports.combinator = combinator;
  6594. });
  6595. var tokenize_1 = createCommonjsModule(function (module, exports) {
  6596. exports.__esModule = true;
  6597. exports["default"] = tokenize;
  6598. exports.FIELDS = void 0;
  6599. var t = _interopRequireWildcard(tokenTypes);
  6600. var _unescapable, _wordDelimiters;
  6601. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
  6602. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
  6603. var unescapable = (_unescapable = {}, _unescapable[t.tab] = true, _unescapable[t.newline] = true, _unescapable[t.cr] = true, _unescapable[t.feed] = true, _unescapable);
  6604. var wordDelimiters = (_wordDelimiters = {}, _wordDelimiters[t.space] = true, _wordDelimiters[t.tab] = true, _wordDelimiters[t.newline] = true, _wordDelimiters[t.cr] = true, _wordDelimiters[t.feed] = true, _wordDelimiters[t.ampersand] = true, _wordDelimiters[t.asterisk] = true, _wordDelimiters[t.bang] = true, _wordDelimiters[t.comma] = true, _wordDelimiters[t.colon] = true, _wordDelimiters[t.semicolon] = true, _wordDelimiters[t.openParenthesis] = true, _wordDelimiters[t.closeParenthesis] = true, _wordDelimiters[t.openSquare] = true, _wordDelimiters[t.closeSquare] = true, _wordDelimiters[t.singleQuote] = true, _wordDelimiters[t.doubleQuote] = true, _wordDelimiters[t.plus] = true, _wordDelimiters[t.pipe] = true, _wordDelimiters[t.tilde] = true, _wordDelimiters[t.greaterThan] = true, _wordDelimiters[t.equals] = true, _wordDelimiters[t.dollar] = true, _wordDelimiters[t.caret] = true, _wordDelimiters[t.slash] = true, _wordDelimiters);
  6605. var hex = {};
  6606. var hexChars = "0123456789abcdefABCDEF";
  6607. for (var i = 0; i < hexChars.length; i++) {
  6608. hex[hexChars.charCodeAt(i)] = true;
  6609. }
  6610. /**
  6611. * Returns the last index of the bar css word
  6612. * @param {string} css The string in which the word begins
  6613. * @param {number} start The index into the string where word's first letter occurs
  6614. */
  6615. function consumeWord(css, start) {
  6616. var next = start;
  6617. var code;
  6618. do {
  6619. code = css.charCodeAt(next);
  6620. if (wordDelimiters[code]) {
  6621. return next - 1;
  6622. } else if (code === t.backslash) {
  6623. next = consumeEscape(css, next) + 1;
  6624. } else {
  6625. // All other characters are part of the word
  6626. next++;
  6627. }
  6628. } while (next < css.length);
  6629. return next - 1;
  6630. }
  6631. /**
  6632. * Returns the last index of the escape sequence
  6633. * @param {string} css The string in which the sequence begins
  6634. * @param {number} start The index into the string where escape character (`\`) occurs.
  6635. */
  6636. function consumeEscape(css, start) {
  6637. var next = start;
  6638. var code = css.charCodeAt(next + 1);
  6639. if (unescapable[code]) ; else if (hex[code]) {
  6640. var hexDigits = 0; // consume up to 6 hex chars
  6641. do {
  6642. next++;
  6643. hexDigits++;
  6644. code = css.charCodeAt(next + 1);
  6645. } while (hex[code] && hexDigits < 6); // if fewer than 6 hex chars, a trailing space ends the escape
  6646. if (hexDigits < 6 && code === t.space) {
  6647. next++;
  6648. }
  6649. } else {
  6650. // the next char is part of the current word
  6651. next++;
  6652. }
  6653. return next;
  6654. }
  6655. var FIELDS = {
  6656. TYPE: 0,
  6657. START_LINE: 1,
  6658. START_COL: 2,
  6659. END_LINE: 3,
  6660. END_COL: 4,
  6661. START_POS: 5,
  6662. END_POS: 6
  6663. };
  6664. exports.FIELDS = FIELDS;
  6665. function tokenize(input) {
  6666. var tokens = [];
  6667. var css = input.css.valueOf();
  6668. var _css = css,
  6669. length = _css.length;
  6670. var offset = -1;
  6671. var line = 1;
  6672. var start = 0;
  6673. var end = 0;
  6674. var code, content, endColumn, endLine, escaped, escapePos, last, lines, next, nextLine, nextOffset, quote, tokenType;
  6675. function unclosed(what, fix) {
  6676. if (input.safe) {
  6677. // fyi: this is never set to true.
  6678. css += fix;
  6679. next = css.length - 1;
  6680. } else {
  6681. throw input.error('Unclosed ' + what, line, start - offset, start);
  6682. }
  6683. }
  6684. while (start < length) {
  6685. code = css.charCodeAt(start);
  6686. if (code === t.newline) {
  6687. offset = start;
  6688. line += 1;
  6689. }
  6690. switch (code) {
  6691. case t.space:
  6692. case t.tab:
  6693. case t.newline:
  6694. case t.cr:
  6695. case t.feed:
  6696. next = start;
  6697. do {
  6698. next += 1;
  6699. code = css.charCodeAt(next);
  6700. if (code === t.newline) {
  6701. offset = next;
  6702. line += 1;
  6703. }
  6704. } while (code === t.space || code === t.newline || code === t.tab || code === t.cr || code === t.feed);
  6705. tokenType = t.space;
  6706. endLine = line;
  6707. endColumn = next - offset - 1;
  6708. end = next;
  6709. break;
  6710. case t.plus:
  6711. case t.greaterThan:
  6712. case t.tilde:
  6713. case t.pipe:
  6714. next = start;
  6715. do {
  6716. next += 1;
  6717. code = css.charCodeAt(next);
  6718. } while (code === t.plus || code === t.greaterThan || code === t.tilde || code === t.pipe);
  6719. tokenType = t.combinator;
  6720. endLine = line;
  6721. endColumn = start - offset;
  6722. end = next;
  6723. break;
  6724. // Consume these characters as single tokens.
  6725. case t.asterisk:
  6726. case t.ampersand:
  6727. case t.bang:
  6728. case t.comma:
  6729. case t.equals:
  6730. case t.dollar:
  6731. case t.caret:
  6732. case t.openSquare:
  6733. case t.closeSquare:
  6734. case t.colon:
  6735. case t.semicolon:
  6736. case t.openParenthesis:
  6737. case t.closeParenthesis:
  6738. next = start;
  6739. tokenType = code;
  6740. endLine = line;
  6741. endColumn = start - offset;
  6742. end = next + 1;
  6743. break;
  6744. case t.singleQuote:
  6745. case t.doubleQuote:
  6746. quote = code === t.singleQuote ? "'" : '"';
  6747. next = start;
  6748. do {
  6749. escaped = false;
  6750. next = css.indexOf(quote, next + 1);
  6751. if (next === -1) {
  6752. unclosed('quote', quote);
  6753. }
  6754. escapePos = next;
  6755. while (css.charCodeAt(escapePos - 1) === t.backslash) {
  6756. escapePos -= 1;
  6757. escaped = !escaped;
  6758. }
  6759. } while (escaped);
  6760. tokenType = t.str;
  6761. endLine = line;
  6762. endColumn = start - offset;
  6763. end = next + 1;
  6764. break;
  6765. default:
  6766. if (code === t.slash && css.charCodeAt(start + 1) === t.asterisk) {
  6767. next = css.indexOf('*/', start + 2) + 1;
  6768. if (next === 0) {
  6769. unclosed('comment', '*/');
  6770. }
  6771. content = css.slice(start, next + 1);
  6772. lines = content.split('\n');
  6773. last = lines.length - 1;
  6774. if (last > 0) {
  6775. nextLine = line + last;
  6776. nextOffset = next - lines[last].length;
  6777. } else {
  6778. nextLine = line;
  6779. nextOffset = offset;
  6780. }
  6781. tokenType = t.comment;
  6782. line = nextLine;
  6783. endLine = nextLine;
  6784. endColumn = next - nextOffset;
  6785. } else if (code === t.slash) {
  6786. next = start;
  6787. tokenType = code;
  6788. endLine = line;
  6789. endColumn = start - offset;
  6790. end = next + 1;
  6791. } else {
  6792. next = consumeWord(css, start);
  6793. tokenType = t.word;
  6794. endLine = line;
  6795. endColumn = next - offset;
  6796. }
  6797. end = next + 1;
  6798. break;
  6799. } // Ensure that the token structure remains consistent
  6800. tokens.push([tokenType, // [0] Token type
  6801. line, // [1] Starting line
  6802. start - offset, // [2] Starting column
  6803. endLine, // [3] Ending line
  6804. endColumn, // [4] Ending column
  6805. start, // [5] Start position / Source index
  6806. end // [6] End position
  6807. ]); // Reset offset for the next token
  6808. if (nextOffset) {
  6809. offset = nextOffset;
  6810. nextOffset = null;
  6811. }
  6812. start = end;
  6813. }
  6814. return tokens;
  6815. }
  6816. });
  6817. var parser = createCommonjsModule(function (module, exports) {
  6818. exports.__esModule = true;
  6819. exports["default"] = void 0;
  6820. var _root = _interopRequireDefault(root);
  6821. var _selector = _interopRequireDefault(selector);
  6822. var _className = _interopRequireDefault(className);
  6823. var _comment = _interopRequireDefault(comment);
  6824. var _id = _interopRequireDefault(id);
  6825. var _tag = _interopRequireDefault(tag);
  6826. var _string = _interopRequireDefault(string);
  6827. var _pseudo = _interopRequireDefault(pseudo);
  6828. var _attribute = _interopRequireWildcard(attribute);
  6829. var _universal = _interopRequireDefault(universal);
  6830. var _combinator = _interopRequireDefault(combinator);
  6831. var _nesting = _interopRequireDefault(nesting);
  6832. var _sortAscending = _interopRequireDefault(sortAscending_1);
  6833. var _tokenize = _interopRequireWildcard(tokenize_1);
  6834. var tokens = _interopRequireWildcard(tokenTypes);
  6835. var types$1 = _interopRequireWildcard(types);
  6836. var _WHITESPACE_TOKENS, _Object$assign;
  6837. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
  6838. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
  6839. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6840. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  6841. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6842. var WHITESPACE_TOKENS = (_WHITESPACE_TOKENS = {}, _WHITESPACE_TOKENS[tokens.space] = true, _WHITESPACE_TOKENS[tokens.cr] = true, _WHITESPACE_TOKENS[tokens.feed] = true, _WHITESPACE_TOKENS[tokens.newline] = true, _WHITESPACE_TOKENS[tokens.tab] = true, _WHITESPACE_TOKENS);
  6843. var WHITESPACE_EQUIV_TOKENS = Object.assign({}, WHITESPACE_TOKENS, (_Object$assign = {}, _Object$assign[tokens.comment] = true, _Object$assign));
  6844. function tokenStart(token) {
  6845. return {
  6846. line: token[_tokenize.FIELDS.START_LINE],
  6847. column: token[_tokenize.FIELDS.START_COL]
  6848. };
  6849. }
  6850. function tokenEnd(token) {
  6851. return {
  6852. line: token[_tokenize.FIELDS.END_LINE],
  6853. column: token[_tokenize.FIELDS.END_COL]
  6854. };
  6855. }
  6856. function getSource(startLine, startColumn, endLine, endColumn) {
  6857. return {
  6858. start: {
  6859. line: startLine,
  6860. column: startColumn
  6861. },
  6862. end: {
  6863. line: endLine,
  6864. column: endColumn
  6865. }
  6866. };
  6867. }
  6868. function getTokenSource(token) {
  6869. return getSource(token[_tokenize.FIELDS.START_LINE], token[_tokenize.FIELDS.START_COL], token[_tokenize.FIELDS.END_LINE], token[_tokenize.FIELDS.END_COL]);
  6870. }
  6871. function getTokenSourceSpan(startToken, endToken) {
  6872. if (!startToken) {
  6873. return undefined;
  6874. }
  6875. return getSource(startToken[_tokenize.FIELDS.START_LINE], startToken[_tokenize.FIELDS.START_COL], endToken[_tokenize.FIELDS.END_LINE], endToken[_tokenize.FIELDS.END_COL]);
  6876. }
  6877. function unescapeProp(node, prop) {
  6878. var value = node[prop];
  6879. if (typeof value !== "string") {
  6880. return;
  6881. }
  6882. if (value.indexOf("\\") !== -1) {
  6883. (0, util.ensureObject)(node, 'raws');
  6884. node[prop] = (0, util.unesc)(value);
  6885. if (node.raws[prop] === undefined) {
  6886. node.raws[prop] = value;
  6887. }
  6888. }
  6889. return node;
  6890. }
  6891. function indexesOf(array, item) {
  6892. var i = -1;
  6893. var indexes = [];
  6894. while ((i = array.indexOf(item, i + 1)) !== -1) {
  6895. indexes.push(i);
  6896. }
  6897. return indexes;
  6898. }
  6899. function uniqs() {
  6900. var list = Array.prototype.concat.apply([], arguments);
  6901. return list.filter(function (item, i) {
  6902. return i === list.indexOf(item);
  6903. });
  6904. }
  6905. var Parser = /*#__PURE__*/function () {
  6906. function Parser(rule, options) {
  6907. if (options === void 0) {
  6908. options = {};
  6909. }
  6910. this.rule = rule;
  6911. this.options = Object.assign({
  6912. lossy: false,
  6913. safe: false
  6914. }, options);
  6915. this.position = 0;
  6916. this.css = typeof this.rule === 'string' ? this.rule : this.rule.selector;
  6917. this.tokens = (0, _tokenize["default"])({
  6918. css: this.css,
  6919. error: this._errorGenerator(),
  6920. safe: this.options.safe
  6921. });
  6922. var rootSource = getTokenSourceSpan(this.tokens[0], this.tokens[this.tokens.length - 1]);
  6923. this.root = new _root["default"]({
  6924. source: rootSource
  6925. });
  6926. this.root.errorGenerator = this._errorGenerator();
  6927. var selector = new _selector["default"]({
  6928. source: {
  6929. start: {
  6930. line: 1,
  6931. column: 1
  6932. }
  6933. }
  6934. });
  6935. this.root.append(selector);
  6936. this.current = selector;
  6937. this.loop();
  6938. }
  6939. var _proto = Parser.prototype;
  6940. _proto._errorGenerator = function _errorGenerator() {
  6941. var _this = this;
  6942. return function (message, errorOptions) {
  6943. if (typeof _this.rule === 'string') {
  6944. return new Error(message);
  6945. }
  6946. return _this.rule.error(message, errorOptions);
  6947. };
  6948. };
  6949. _proto.attribute = function attribute() {
  6950. var attr = [];
  6951. var startingToken = this.currToken;
  6952. this.position++;
  6953. while (this.position < this.tokens.length && this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
  6954. attr.push(this.currToken);
  6955. this.position++;
  6956. }
  6957. if (this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
  6958. return this.expected('closing square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
  6959. }
  6960. var len = attr.length;
  6961. var node = {
  6962. source: getSource(startingToken[1], startingToken[2], this.currToken[3], this.currToken[4]),
  6963. sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
  6964. };
  6965. if (len === 1 && !~[tokens.word].indexOf(attr[0][_tokenize.FIELDS.TYPE])) {
  6966. return this.expected('attribute', attr[0][_tokenize.FIELDS.START_POS]);
  6967. }
  6968. var pos = 0;
  6969. var spaceBefore = '';
  6970. var commentBefore = '';
  6971. var lastAdded = null;
  6972. var spaceAfterMeaningfulToken = false;
  6973. while (pos < len) {
  6974. var token = attr[pos];
  6975. var content = this.content(token);
  6976. var next = attr[pos + 1];
  6977. switch (token[_tokenize.FIELDS.TYPE]) {
  6978. case tokens.space:
  6979. // if (
  6980. // len === 1 ||
  6981. // pos === 0 && this.content(next) === '|'
  6982. // ) {
  6983. // return this.expected('attribute', token[TOKEN.START_POS], content);
  6984. // }
  6985. spaceAfterMeaningfulToken = true;
  6986. if (this.options.lossy) {
  6987. break;
  6988. }
  6989. if (lastAdded) {
  6990. (0, util.ensureObject)(node, 'spaces', lastAdded);
  6991. var prevContent = node.spaces[lastAdded].after || '';
  6992. node.spaces[lastAdded].after = prevContent + content;
  6993. var existingComment = (0, util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || null;
  6994. if (existingComment) {
  6995. node.raws.spaces[lastAdded].after = existingComment + content;
  6996. }
  6997. } else {
  6998. spaceBefore = spaceBefore + content;
  6999. commentBefore = commentBefore + content;
  7000. }
  7001. break;
  7002. case tokens.asterisk:
  7003. if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
  7004. node.operator = content;
  7005. lastAdded = 'operator';
  7006. } else if ((!node.namespace || lastAdded === "namespace" && !spaceAfterMeaningfulToken) && next) {
  7007. if (spaceBefore) {
  7008. (0, util.ensureObject)(node, 'spaces', 'attribute');
  7009. node.spaces.attribute.before = spaceBefore;
  7010. spaceBefore = '';
  7011. }
  7012. if (commentBefore) {
  7013. (0, util.ensureObject)(node, 'raws', 'spaces', 'attribute');
  7014. node.raws.spaces.attribute.before = spaceBefore;
  7015. commentBefore = '';
  7016. }
  7017. node.namespace = (node.namespace || "") + content;
  7018. var rawValue = (0, util.getProp)(node, 'raws', 'namespace') || null;
  7019. if (rawValue) {
  7020. node.raws.namespace += content;
  7021. }
  7022. lastAdded = 'namespace';
  7023. }
  7024. spaceAfterMeaningfulToken = false;
  7025. break;
  7026. case tokens.dollar:
  7027. if (lastAdded === "value") {
  7028. var oldRawValue = (0, util.getProp)(node, 'raws', 'value');
  7029. node.value += "$";
  7030. if (oldRawValue) {
  7031. node.raws.value = oldRawValue + "$";
  7032. }
  7033. break;
  7034. }
  7035. // Falls through
  7036. case tokens.caret:
  7037. if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
  7038. node.operator = content;
  7039. lastAdded = 'operator';
  7040. }
  7041. spaceAfterMeaningfulToken = false;
  7042. break;
  7043. case tokens.combinator:
  7044. if (content === '~' && next[_tokenize.FIELDS.TYPE] === tokens.equals) {
  7045. node.operator = content;
  7046. lastAdded = 'operator';
  7047. }
  7048. if (content !== '|') {
  7049. spaceAfterMeaningfulToken = false;
  7050. break;
  7051. }
  7052. if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
  7053. node.operator = content;
  7054. lastAdded = 'operator';
  7055. } else if (!node.namespace && !node.attribute) {
  7056. node.namespace = true;
  7057. }
  7058. spaceAfterMeaningfulToken = false;
  7059. break;
  7060. case tokens.word:
  7061. if (next && this.content(next) === '|' && attr[pos + 2] && attr[pos + 2][_tokenize.FIELDS.TYPE] !== tokens.equals && // this look-ahead probably fails with comment nodes involved.
  7062. !node.operator && !node.namespace) {
  7063. node.namespace = content;
  7064. lastAdded = 'namespace';
  7065. } else if (!node.attribute || lastAdded === "attribute" && !spaceAfterMeaningfulToken) {
  7066. if (spaceBefore) {
  7067. (0, util.ensureObject)(node, 'spaces', 'attribute');
  7068. node.spaces.attribute.before = spaceBefore;
  7069. spaceBefore = '';
  7070. }
  7071. if (commentBefore) {
  7072. (0, util.ensureObject)(node, 'raws', 'spaces', 'attribute');
  7073. node.raws.spaces.attribute.before = commentBefore;
  7074. commentBefore = '';
  7075. }
  7076. node.attribute = (node.attribute || "") + content;
  7077. var _rawValue = (0, util.getProp)(node, 'raws', 'attribute') || null;
  7078. if (_rawValue) {
  7079. node.raws.attribute += content;
  7080. }
  7081. lastAdded = 'attribute';
  7082. } else if (!node.value && node.value !== "" || lastAdded === "value" && !spaceAfterMeaningfulToken) {
  7083. var _unescaped = (0, util.unesc)(content);
  7084. var _oldRawValue = (0, util.getProp)(node, 'raws', 'value') || '';
  7085. var oldValue = node.value || '';
  7086. node.value = oldValue + _unescaped;
  7087. node.quoteMark = null;
  7088. if (_unescaped !== content || _oldRawValue) {
  7089. (0, util.ensureObject)(node, 'raws');
  7090. node.raws.value = (_oldRawValue || oldValue) + content;
  7091. }
  7092. lastAdded = 'value';
  7093. } else {
  7094. var insensitive = content === 'i' || content === "I";
  7095. if ((node.value || node.value === '') && (node.quoteMark || spaceAfterMeaningfulToken)) {
  7096. node.insensitive = insensitive;
  7097. if (!insensitive || content === "I") {
  7098. (0, util.ensureObject)(node, 'raws');
  7099. node.raws.insensitiveFlag = content;
  7100. }
  7101. lastAdded = 'insensitive';
  7102. if (spaceBefore) {
  7103. (0, util.ensureObject)(node, 'spaces', 'insensitive');
  7104. node.spaces.insensitive.before = spaceBefore;
  7105. spaceBefore = '';
  7106. }
  7107. if (commentBefore) {
  7108. (0, util.ensureObject)(node, 'raws', 'spaces', 'insensitive');
  7109. node.raws.spaces.insensitive.before = commentBefore;
  7110. commentBefore = '';
  7111. }
  7112. } else if (node.value || node.value === '') {
  7113. lastAdded = 'value';
  7114. node.value += content;
  7115. if (node.raws.value) {
  7116. node.raws.value += content;
  7117. }
  7118. }
  7119. }
  7120. spaceAfterMeaningfulToken = false;
  7121. break;
  7122. case tokens.str:
  7123. if (!node.attribute || !node.operator) {
  7124. return this.error("Expected an attribute followed by an operator preceding the string.", {
  7125. index: token[_tokenize.FIELDS.START_POS]
  7126. });
  7127. }
  7128. var _unescapeValue = (0, _attribute.unescapeValue)(content),
  7129. unescaped = _unescapeValue.unescaped,
  7130. quoteMark = _unescapeValue.quoteMark;
  7131. node.value = unescaped;
  7132. node.quoteMark = quoteMark;
  7133. lastAdded = 'value';
  7134. (0, util.ensureObject)(node, 'raws');
  7135. node.raws.value = content;
  7136. spaceAfterMeaningfulToken = false;
  7137. break;
  7138. case tokens.equals:
  7139. if (!node.attribute) {
  7140. return this.expected('attribute', token[_tokenize.FIELDS.START_POS], content);
  7141. }
  7142. if (node.value) {
  7143. return this.error('Unexpected "=" found; an operator was already defined.', {
  7144. index: token[_tokenize.FIELDS.START_POS]
  7145. });
  7146. }
  7147. node.operator = node.operator ? node.operator + content : content;
  7148. lastAdded = 'operator';
  7149. spaceAfterMeaningfulToken = false;
  7150. break;
  7151. case tokens.comment:
  7152. if (lastAdded) {
  7153. if (spaceAfterMeaningfulToken || next && next[_tokenize.FIELDS.TYPE] === tokens.space || lastAdded === 'insensitive') {
  7154. var lastComment = (0, util.getProp)(node, 'spaces', lastAdded, 'after') || '';
  7155. var rawLastComment = (0, util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || lastComment;
  7156. (0, util.ensureObject)(node, 'raws', 'spaces', lastAdded);
  7157. node.raws.spaces[lastAdded].after = rawLastComment + content;
  7158. } else {
  7159. var lastValue = node[lastAdded] || '';
  7160. var rawLastValue = (0, util.getProp)(node, 'raws', lastAdded) || lastValue;
  7161. (0, util.ensureObject)(node, 'raws');
  7162. node.raws[lastAdded] = rawLastValue + content;
  7163. }
  7164. } else {
  7165. commentBefore = commentBefore + content;
  7166. }
  7167. break;
  7168. default:
  7169. return this.error("Unexpected \"" + content + "\" found.", {
  7170. index: token[_tokenize.FIELDS.START_POS]
  7171. });
  7172. }
  7173. pos++;
  7174. }
  7175. unescapeProp(node, "attribute");
  7176. unescapeProp(node, "namespace");
  7177. this.newNode(new _attribute["default"](node));
  7178. this.position++;
  7179. }
  7180. /**
  7181. * return a node containing meaningless garbage up to (but not including) the specified token position.
  7182. * if the token position is negative, all remaining tokens are consumed.
  7183. *
  7184. * This returns an array containing a single string node if all whitespace,
  7185. * otherwise an array of comment nodes with space before and after.
  7186. *
  7187. * These tokens are not added to the current selector, the caller can add them or use them to amend
  7188. * a previous node's space metadata.
  7189. *
  7190. * In lossy mode, this returns only comments.
  7191. */
  7192. ;
  7193. _proto.parseWhitespaceEquivalentTokens = function parseWhitespaceEquivalentTokens(stopPosition) {
  7194. if (stopPosition < 0) {
  7195. stopPosition = this.tokens.length;
  7196. }
  7197. var startPosition = this.position;
  7198. var nodes = [];
  7199. var space = "";
  7200. var lastComment = undefined;
  7201. do {
  7202. if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) {
  7203. if (!this.options.lossy) {
  7204. space += this.content();
  7205. }
  7206. } else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.comment) {
  7207. var spaces = {};
  7208. if (space) {
  7209. spaces.before = space;
  7210. space = "";
  7211. }
  7212. lastComment = new _comment["default"]({
  7213. value: this.content(),
  7214. source: getTokenSource(this.currToken),
  7215. sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],
  7216. spaces: spaces
  7217. });
  7218. nodes.push(lastComment);
  7219. }
  7220. } while (++this.position < stopPosition);
  7221. if (space) {
  7222. if (lastComment) {
  7223. lastComment.spaces.after = space;
  7224. } else if (!this.options.lossy) {
  7225. var firstToken = this.tokens[startPosition];
  7226. var lastToken = this.tokens[this.position - 1];
  7227. nodes.push(new _string["default"]({
  7228. value: '',
  7229. source: getSource(firstToken[_tokenize.FIELDS.START_LINE], firstToken[_tokenize.FIELDS.START_COL], lastToken[_tokenize.FIELDS.END_LINE], lastToken[_tokenize.FIELDS.END_COL]),
  7230. sourceIndex: firstToken[_tokenize.FIELDS.START_POS],
  7231. spaces: {
  7232. before: space,
  7233. after: ''
  7234. }
  7235. }));
  7236. }
  7237. }
  7238. return nodes;
  7239. }
  7240. /**
  7241. *
  7242. * @param {*} nodes
  7243. */
  7244. ;
  7245. _proto.convertWhitespaceNodesToSpace = function convertWhitespaceNodesToSpace(nodes, requiredSpace) {
  7246. var _this2 = this;
  7247. if (requiredSpace === void 0) {
  7248. requiredSpace = false;
  7249. }
  7250. var space = "";
  7251. var rawSpace = "";
  7252. nodes.forEach(function (n) {
  7253. var spaceBefore = _this2.lossySpace(n.spaces.before, requiredSpace);
  7254. var rawSpaceBefore = _this2.lossySpace(n.rawSpaceBefore, requiredSpace);
  7255. space += spaceBefore + _this2.lossySpace(n.spaces.after, requiredSpace && spaceBefore.length === 0);
  7256. rawSpace += spaceBefore + n.value + _this2.lossySpace(n.rawSpaceAfter, requiredSpace && rawSpaceBefore.length === 0);
  7257. });
  7258. if (rawSpace === space) {
  7259. rawSpace = undefined;
  7260. }
  7261. var result = {
  7262. space: space,
  7263. rawSpace: rawSpace
  7264. };
  7265. return result;
  7266. };
  7267. _proto.isNamedCombinator = function isNamedCombinator(position) {
  7268. if (position === void 0) {
  7269. position = this.position;
  7270. }
  7271. return this.tokens[position + 0] && this.tokens[position + 0][_tokenize.FIELDS.TYPE] === tokens.slash && this.tokens[position + 1] && this.tokens[position + 1][_tokenize.FIELDS.TYPE] === tokens.word && this.tokens[position + 2] && this.tokens[position + 2][_tokenize.FIELDS.TYPE] === tokens.slash;
  7272. };
  7273. _proto.namedCombinator = function namedCombinator() {
  7274. if (this.isNamedCombinator()) {
  7275. var nameRaw = this.content(this.tokens[this.position + 1]);
  7276. var name = (0, util.unesc)(nameRaw).toLowerCase();
  7277. var raws = {};
  7278. if (name !== nameRaw) {
  7279. raws.value = "/" + nameRaw + "/";
  7280. }
  7281. var node = new _combinator["default"]({
  7282. value: "/" + name + "/",
  7283. source: getSource(this.currToken[_tokenize.FIELDS.START_LINE], this.currToken[_tokenize.FIELDS.START_COL], this.tokens[this.position + 2][_tokenize.FIELDS.END_LINE], this.tokens[this.position + 2][_tokenize.FIELDS.END_COL]),
  7284. sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],
  7285. raws: raws
  7286. });
  7287. this.position = this.position + 3;
  7288. return node;
  7289. } else {
  7290. this.unexpected();
  7291. }
  7292. };
  7293. _proto.combinator = function combinator() {
  7294. var _this3 = this;
  7295. if (this.content() === '|') {
  7296. return this.namespace();
  7297. } // We need to decide between a space that's a descendant combinator and meaningless whitespace at the end of a selector.
  7298. var nextSigTokenPos = this.locateNextMeaningfulToken(this.position);
  7299. if (nextSigTokenPos < 0 || this.tokens[nextSigTokenPos][_tokenize.FIELDS.TYPE] === tokens.comma) {
  7300. var nodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
  7301. if (nodes.length > 0) {
  7302. var last = this.current.last;
  7303. if (last) {
  7304. var _this$convertWhitespa = this.convertWhitespaceNodesToSpace(nodes),
  7305. space = _this$convertWhitespa.space,
  7306. rawSpace = _this$convertWhitespa.rawSpace;
  7307. if (rawSpace !== undefined) {
  7308. last.rawSpaceAfter += rawSpace;
  7309. }
  7310. last.spaces.after += space;
  7311. } else {
  7312. nodes.forEach(function (n) {
  7313. return _this3.newNode(n);
  7314. });
  7315. }
  7316. }
  7317. return;
  7318. }
  7319. var firstToken = this.currToken;
  7320. var spaceOrDescendantSelectorNodes = undefined;
  7321. if (nextSigTokenPos > this.position) {
  7322. spaceOrDescendantSelectorNodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
  7323. }
  7324. var node;
  7325. if (this.isNamedCombinator()) {
  7326. node = this.namedCombinator();
  7327. } else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.combinator) {
  7328. node = new _combinator["default"]({
  7329. value: this.content(),
  7330. source: getTokenSource(this.currToken),
  7331. sourceIndex: this.currToken[_tokenize.FIELDS.START_POS]
  7332. });
  7333. this.position++;
  7334. } else if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) ; else if (!spaceOrDescendantSelectorNodes) {
  7335. this.unexpected();
  7336. }
  7337. if (node) {
  7338. if (spaceOrDescendantSelectorNodes) {
  7339. var _this$convertWhitespa2 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes),
  7340. _space = _this$convertWhitespa2.space,
  7341. _rawSpace = _this$convertWhitespa2.rawSpace;
  7342. node.spaces.before = _space;
  7343. node.rawSpaceBefore = _rawSpace;
  7344. }
  7345. } else {
  7346. // descendant combinator
  7347. var _this$convertWhitespa3 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes, true),
  7348. _space2 = _this$convertWhitespa3.space,
  7349. _rawSpace2 = _this$convertWhitespa3.rawSpace;
  7350. if (!_rawSpace2) {
  7351. _rawSpace2 = _space2;
  7352. }
  7353. var spaces = {};
  7354. var raws = {
  7355. spaces: {}
  7356. };
  7357. if (_space2.endsWith(' ') && _rawSpace2.endsWith(' ')) {
  7358. spaces.before = _space2.slice(0, _space2.length - 1);
  7359. raws.spaces.before = _rawSpace2.slice(0, _rawSpace2.length - 1);
  7360. } else if (_space2.startsWith(' ') && _rawSpace2.startsWith(' ')) {
  7361. spaces.after = _space2.slice(1);
  7362. raws.spaces.after = _rawSpace2.slice(1);
  7363. } else {
  7364. raws.value = _rawSpace2;
  7365. }
  7366. node = new _combinator["default"]({
  7367. value: ' ',
  7368. source: getTokenSourceSpan(firstToken, this.tokens[this.position - 1]),
  7369. sourceIndex: firstToken[_tokenize.FIELDS.START_POS],
  7370. spaces: spaces,
  7371. raws: raws
  7372. });
  7373. }
  7374. if (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.space) {
  7375. node.spaces.after = this.optionalSpace(this.content());
  7376. this.position++;
  7377. }
  7378. return this.newNode(node);
  7379. };
  7380. _proto.comma = function comma() {
  7381. if (this.position === this.tokens.length - 1) {
  7382. this.root.trailingComma = true;
  7383. this.position++;
  7384. return;
  7385. }
  7386. this.current._inferEndPosition();
  7387. var selector = new _selector["default"]({
  7388. source: {
  7389. start: tokenStart(this.tokens[this.position + 1])
  7390. }
  7391. });
  7392. this.current.parent.append(selector);
  7393. this.current = selector;
  7394. this.position++;
  7395. };
  7396. _proto.comment = function comment() {
  7397. var current = this.currToken;
  7398. this.newNode(new _comment["default"]({
  7399. value: this.content(),
  7400. source: getTokenSource(current),
  7401. sourceIndex: current[_tokenize.FIELDS.START_POS]
  7402. }));
  7403. this.position++;
  7404. };
  7405. _proto.error = function error(message, opts) {
  7406. throw this.root.error(message, opts);
  7407. };
  7408. _proto.missingBackslash = function missingBackslash() {
  7409. return this.error('Expected a backslash preceding the semicolon.', {
  7410. index: this.currToken[_tokenize.FIELDS.START_POS]
  7411. });
  7412. };
  7413. _proto.missingParenthesis = function missingParenthesis() {
  7414. return this.expected('opening parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
  7415. };
  7416. _proto.missingSquareBracket = function missingSquareBracket() {
  7417. return this.expected('opening square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
  7418. };
  7419. _proto.unexpected = function unexpected() {
  7420. return this.error("Unexpected '" + this.content() + "'. Escaping special characters with \\ may help.", this.currToken[_tokenize.FIELDS.START_POS]);
  7421. };
  7422. _proto.namespace = function namespace() {
  7423. var before = this.prevToken && this.content(this.prevToken) || true;
  7424. if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.word) {
  7425. this.position++;
  7426. return this.word(before);
  7427. } else if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.asterisk) {
  7428. this.position++;
  7429. return this.universal(before);
  7430. }
  7431. };
  7432. _proto.nesting = function nesting() {
  7433. if (this.nextToken) {
  7434. var nextContent = this.content(this.nextToken);
  7435. if (nextContent === "|") {
  7436. this.position++;
  7437. return;
  7438. }
  7439. }
  7440. var current = this.currToken;
  7441. this.newNode(new _nesting["default"]({
  7442. value: this.content(),
  7443. source: getTokenSource(current),
  7444. sourceIndex: current[_tokenize.FIELDS.START_POS]
  7445. }));
  7446. this.position++;
  7447. };
  7448. _proto.parentheses = function parentheses() {
  7449. var last = this.current.last;
  7450. var unbalanced = 1;
  7451. this.position++;
  7452. if (last && last.type === types$1.PSEUDO) {
  7453. var selector = new _selector["default"]({
  7454. source: {
  7455. start: tokenStart(this.tokens[this.position - 1])
  7456. }
  7457. });
  7458. var cache = this.current;
  7459. last.append(selector);
  7460. this.current = selector;
  7461. while (this.position < this.tokens.length && unbalanced) {
  7462. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
  7463. unbalanced++;
  7464. }
  7465. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
  7466. unbalanced--;
  7467. }
  7468. if (unbalanced) {
  7469. this.parse();
  7470. } else {
  7471. this.current.source.end = tokenEnd(this.currToken);
  7472. this.current.parent.source.end = tokenEnd(this.currToken);
  7473. this.position++;
  7474. }
  7475. }
  7476. this.current = cache;
  7477. } else {
  7478. // I think this case should be an error. It's used to implement a basic parse of media queries
  7479. // but I don't think it's a good idea.
  7480. var parenStart = this.currToken;
  7481. var parenValue = "(";
  7482. var parenEnd;
  7483. while (this.position < this.tokens.length && unbalanced) {
  7484. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
  7485. unbalanced++;
  7486. }
  7487. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
  7488. unbalanced--;
  7489. }
  7490. parenEnd = this.currToken;
  7491. parenValue += this.parseParenthesisToken(this.currToken);
  7492. this.position++;
  7493. }
  7494. if (last) {
  7495. last.appendToPropertyAndEscape("value", parenValue, parenValue);
  7496. } else {
  7497. this.newNode(new _string["default"]({
  7498. value: parenValue,
  7499. source: getSource(parenStart[_tokenize.FIELDS.START_LINE], parenStart[_tokenize.FIELDS.START_COL], parenEnd[_tokenize.FIELDS.END_LINE], parenEnd[_tokenize.FIELDS.END_COL]),
  7500. sourceIndex: parenStart[_tokenize.FIELDS.START_POS]
  7501. }));
  7502. }
  7503. }
  7504. if (unbalanced) {
  7505. return this.expected('closing parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
  7506. }
  7507. };
  7508. _proto.pseudo = function pseudo() {
  7509. var _this4 = this;
  7510. var pseudoStr = '';
  7511. var startingToken = this.currToken;
  7512. while (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.colon) {
  7513. pseudoStr += this.content();
  7514. this.position++;
  7515. }
  7516. if (!this.currToken) {
  7517. return this.expected(['pseudo-class', 'pseudo-element'], this.position - 1);
  7518. }
  7519. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.word) {
  7520. this.splitWord(false, function (first, length) {
  7521. pseudoStr += first;
  7522. _this4.newNode(new _pseudo["default"]({
  7523. value: pseudoStr,
  7524. source: getTokenSourceSpan(startingToken, _this4.currToken),
  7525. sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
  7526. }));
  7527. if (length > 1 && _this4.nextToken && _this4.nextToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
  7528. _this4.error('Misplaced parenthesis.', {
  7529. index: _this4.nextToken[_tokenize.FIELDS.START_POS]
  7530. });
  7531. }
  7532. });
  7533. } else {
  7534. return this.expected(['pseudo-class', 'pseudo-element'], this.currToken[_tokenize.FIELDS.START_POS]);
  7535. }
  7536. };
  7537. _proto.space = function space() {
  7538. var content = this.content(); // Handle space before and after the selector
  7539. if (this.position === 0 || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis || this.current.nodes.every(function (node) {
  7540. return node.type === 'comment';
  7541. })) {
  7542. this.spaces = this.optionalSpace(content);
  7543. this.position++;
  7544. } else if (this.position === this.tokens.length - 1 || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
  7545. this.current.last.spaces.after = this.optionalSpace(content);
  7546. this.position++;
  7547. } else {
  7548. this.combinator();
  7549. }
  7550. };
  7551. _proto.string = function string() {
  7552. var current = this.currToken;
  7553. this.newNode(new _string["default"]({
  7554. value: this.content(),
  7555. source: getTokenSource(current),
  7556. sourceIndex: current[_tokenize.FIELDS.START_POS]
  7557. }));
  7558. this.position++;
  7559. };
  7560. _proto.universal = function universal(namespace) {
  7561. var nextToken = this.nextToken;
  7562. if (nextToken && this.content(nextToken) === '|') {
  7563. this.position++;
  7564. return this.namespace();
  7565. }
  7566. var current = this.currToken;
  7567. this.newNode(new _universal["default"]({
  7568. value: this.content(),
  7569. source: getTokenSource(current),
  7570. sourceIndex: current[_tokenize.FIELDS.START_POS]
  7571. }), namespace);
  7572. this.position++;
  7573. };
  7574. _proto.splitWord = function splitWord(namespace, firstCallback) {
  7575. var _this5 = this;
  7576. var nextToken = this.nextToken;
  7577. var word = this.content();
  7578. while (nextToken && ~[tokens.dollar, tokens.caret, tokens.equals, tokens.word].indexOf(nextToken[_tokenize.FIELDS.TYPE])) {
  7579. this.position++;
  7580. var current = this.content();
  7581. word += current;
  7582. if (current.lastIndexOf('\\') === current.length - 1) {
  7583. var next = this.nextToken;
  7584. if (next && next[_tokenize.FIELDS.TYPE] === tokens.space) {
  7585. word += this.requiredSpace(this.content(next));
  7586. this.position++;
  7587. }
  7588. }
  7589. nextToken = this.nextToken;
  7590. }
  7591. var hasClass = indexesOf(word, '.').filter(function (i) {
  7592. // Allow escaped dot within class name
  7593. var escapedDot = word[i - 1] === '\\'; // Allow decimal numbers percent in @keyframes
  7594. var isKeyframesPercent = /^\d+\.\d+%$/.test(word);
  7595. return !escapedDot && !isKeyframesPercent;
  7596. });
  7597. var hasId = indexesOf(word, '#').filter(function (i) {
  7598. return word[i - 1] !== '\\';
  7599. }); // Eliminate Sass interpolations from the list of id indexes
  7600. var interpolations = indexesOf(word, '#{');
  7601. if (interpolations.length) {
  7602. hasId = hasId.filter(function (hashIndex) {
  7603. return !~interpolations.indexOf(hashIndex);
  7604. });
  7605. }
  7606. var indices = (0, _sortAscending["default"])(uniqs([0].concat(hasClass, hasId)));
  7607. indices.forEach(function (ind, i) {
  7608. var index = indices[i + 1] || word.length;
  7609. var value = word.slice(ind, index);
  7610. if (i === 0 && firstCallback) {
  7611. return firstCallback.call(_this5, value, indices.length);
  7612. }
  7613. var node;
  7614. var current = _this5.currToken;
  7615. var sourceIndex = current[_tokenize.FIELDS.START_POS] + indices[i];
  7616. var source = getSource(current[1], current[2] + ind, current[3], current[2] + (index - 1));
  7617. if (~hasClass.indexOf(ind)) {
  7618. var classNameOpts = {
  7619. value: value.slice(1),
  7620. source: source,
  7621. sourceIndex: sourceIndex
  7622. };
  7623. node = new _className["default"](unescapeProp(classNameOpts, "value"));
  7624. } else if (~hasId.indexOf(ind)) {
  7625. var idOpts = {
  7626. value: value.slice(1),
  7627. source: source,
  7628. sourceIndex: sourceIndex
  7629. };
  7630. node = new _id["default"](unescapeProp(idOpts, "value"));
  7631. } else {
  7632. var tagOpts = {
  7633. value: value,
  7634. source: source,
  7635. sourceIndex: sourceIndex
  7636. };
  7637. unescapeProp(tagOpts, "value");
  7638. node = new _tag["default"](tagOpts);
  7639. }
  7640. _this5.newNode(node, namespace); // Ensure that the namespace is used only once
  7641. namespace = null;
  7642. });
  7643. this.position++;
  7644. };
  7645. _proto.word = function word(namespace) {
  7646. var nextToken = this.nextToken;
  7647. if (nextToken && this.content(nextToken) === '|') {
  7648. this.position++;
  7649. return this.namespace();
  7650. }
  7651. return this.splitWord(namespace);
  7652. };
  7653. _proto.loop = function loop() {
  7654. while (this.position < this.tokens.length) {
  7655. this.parse(true);
  7656. }
  7657. this.current._inferEndPosition();
  7658. return this.root;
  7659. };
  7660. _proto.parse = function parse(throwOnParenthesis) {
  7661. switch (this.currToken[_tokenize.FIELDS.TYPE]) {
  7662. case tokens.space:
  7663. this.space();
  7664. break;
  7665. case tokens.comment:
  7666. this.comment();
  7667. break;
  7668. case tokens.openParenthesis:
  7669. this.parentheses();
  7670. break;
  7671. case tokens.closeParenthesis:
  7672. if (throwOnParenthesis) {
  7673. this.missingParenthesis();
  7674. }
  7675. break;
  7676. case tokens.openSquare:
  7677. this.attribute();
  7678. break;
  7679. case tokens.dollar:
  7680. case tokens.caret:
  7681. case tokens.equals:
  7682. case tokens.word:
  7683. this.word();
  7684. break;
  7685. case tokens.colon:
  7686. this.pseudo();
  7687. break;
  7688. case tokens.comma:
  7689. this.comma();
  7690. break;
  7691. case tokens.asterisk:
  7692. this.universal();
  7693. break;
  7694. case tokens.ampersand:
  7695. this.nesting();
  7696. break;
  7697. case tokens.slash:
  7698. case tokens.combinator:
  7699. this.combinator();
  7700. break;
  7701. case tokens.str:
  7702. this.string();
  7703. break;
  7704. // These cases throw; no break needed.
  7705. case tokens.closeSquare:
  7706. this.missingSquareBracket();
  7707. case tokens.semicolon:
  7708. this.missingBackslash();
  7709. default:
  7710. this.unexpected();
  7711. }
  7712. }
  7713. /**
  7714. * Helpers
  7715. */
  7716. ;
  7717. _proto.expected = function expected(description, index, found) {
  7718. if (Array.isArray(description)) {
  7719. var last = description.pop();
  7720. description = description.join(', ') + " or " + last;
  7721. }
  7722. var an = /^[aeiou]/.test(description[0]) ? 'an' : 'a';
  7723. if (!found) {
  7724. return this.error("Expected " + an + " " + description + ".", {
  7725. index: index
  7726. });
  7727. }
  7728. return this.error("Expected " + an + " " + description + ", found \"" + found + "\" instead.", {
  7729. index: index
  7730. });
  7731. };
  7732. _proto.requiredSpace = function requiredSpace(space) {
  7733. return this.options.lossy ? ' ' : space;
  7734. };
  7735. _proto.optionalSpace = function optionalSpace(space) {
  7736. return this.options.lossy ? '' : space;
  7737. };
  7738. _proto.lossySpace = function lossySpace(space, required) {
  7739. if (this.options.lossy) {
  7740. return required ? ' ' : '';
  7741. } else {
  7742. return space;
  7743. }
  7744. };
  7745. _proto.parseParenthesisToken = function parseParenthesisToken(token) {
  7746. var content = this.content(token);
  7747. if (token[_tokenize.FIELDS.TYPE] === tokens.space) {
  7748. return this.requiredSpace(content);
  7749. } else {
  7750. return content;
  7751. }
  7752. };
  7753. _proto.newNode = function newNode(node, namespace) {
  7754. if (namespace) {
  7755. if (/^ +$/.test(namespace)) {
  7756. if (!this.options.lossy) {
  7757. this.spaces = (this.spaces || '') + namespace;
  7758. }
  7759. namespace = true;
  7760. }
  7761. node.namespace = namespace;
  7762. unescapeProp(node, "namespace");
  7763. }
  7764. if (this.spaces) {
  7765. node.spaces.before = this.spaces;
  7766. this.spaces = '';
  7767. }
  7768. return this.current.append(node);
  7769. };
  7770. _proto.content = function content(token) {
  7771. if (token === void 0) {
  7772. token = this.currToken;
  7773. }
  7774. return this.css.slice(token[_tokenize.FIELDS.START_POS], token[_tokenize.FIELDS.END_POS]);
  7775. };
  7776. /**
  7777. * returns the index of the next non-whitespace, non-comment token.
  7778. * returns -1 if no meaningful token is found.
  7779. */
  7780. _proto.locateNextMeaningfulToken = function locateNextMeaningfulToken(startPosition) {
  7781. if (startPosition === void 0) {
  7782. startPosition = this.position + 1;
  7783. }
  7784. var searchPosition = startPosition;
  7785. while (searchPosition < this.tokens.length) {
  7786. if (WHITESPACE_EQUIV_TOKENS[this.tokens[searchPosition][_tokenize.FIELDS.TYPE]]) {
  7787. searchPosition++;
  7788. continue;
  7789. } else {
  7790. return searchPosition;
  7791. }
  7792. }
  7793. return -1;
  7794. };
  7795. _createClass(Parser, [{
  7796. key: "currToken",
  7797. get: function get() {
  7798. return this.tokens[this.position];
  7799. }
  7800. }, {
  7801. key: "nextToken",
  7802. get: function get() {
  7803. return this.tokens[this.position + 1];
  7804. }
  7805. }, {
  7806. key: "prevToken",
  7807. get: function get() {
  7808. return this.tokens[this.position - 1];
  7809. }
  7810. }]);
  7811. return Parser;
  7812. }();
  7813. exports["default"] = Parser;
  7814. module.exports = exports.default;
  7815. });
  7816. var processor = createCommonjsModule(function (module, exports) {
  7817. exports.__esModule = true;
  7818. exports["default"] = void 0;
  7819. var _parser = _interopRequireDefault(parser);
  7820. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  7821. var Processor = /*#__PURE__*/function () {
  7822. function Processor(func, options) {
  7823. this.func = func || function noop() {};
  7824. this.funcRes = null;
  7825. this.options = options;
  7826. }
  7827. var _proto = Processor.prototype;
  7828. _proto._shouldUpdateSelector = function _shouldUpdateSelector(rule, options) {
  7829. if (options === void 0) {
  7830. options = {};
  7831. }
  7832. var merged = Object.assign({}, this.options, options);
  7833. if (merged.updateSelector === false) {
  7834. return false;
  7835. } else {
  7836. return typeof rule !== "string";
  7837. }
  7838. };
  7839. _proto._isLossy = function _isLossy(options) {
  7840. if (options === void 0) {
  7841. options = {};
  7842. }
  7843. var merged = Object.assign({}, this.options, options);
  7844. if (merged.lossless === false) {
  7845. return true;
  7846. } else {
  7847. return false;
  7848. }
  7849. };
  7850. _proto._root = function _root(rule, options) {
  7851. if (options === void 0) {
  7852. options = {};
  7853. }
  7854. var parser = new _parser["default"](rule, this._parseOptions(options));
  7855. return parser.root;
  7856. };
  7857. _proto._parseOptions = function _parseOptions(options) {
  7858. return {
  7859. lossy: this._isLossy(options)
  7860. };
  7861. };
  7862. _proto._run = function _run(rule, options) {
  7863. var _this = this;
  7864. if (options === void 0) {
  7865. options = {};
  7866. }
  7867. return new Promise(function (resolve, reject) {
  7868. try {
  7869. var root = _this._root(rule, options);
  7870. Promise.resolve(_this.func(root)).then(function (transform) {
  7871. var string = undefined;
  7872. if (_this._shouldUpdateSelector(rule, options)) {
  7873. string = root.toString();
  7874. rule.selector = string;
  7875. }
  7876. return {
  7877. transform: transform,
  7878. root: root,
  7879. string: string
  7880. };
  7881. }).then(resolve, reject);
  7882. } catch (e) {
  7883. reject(e);
  7884. return;
  7885. }
  7886. });
  7887. };
  7888. _proto._runSync = function _runSync(rule, options) {
  7889. if (options === void 0) {
  7890. options = {};
  7891. }
  7892. var root = this._root(rule, options);
  7893. var transform = this.func(root);
  7894. if (transform && typeof transform.then === "function") {
  7895. throw new Error("Selector processor returned a promise to a synchronous call.");
  7896. }
  7897. var string = undefined;
  7898. if (options.updateSelector && typeof rule !== "string") {
  7899. string = root.toString();
  7900. rule.selector = string;
  7901. }
  7902. return {
  7903. transform: transform,
  7904. root: root,
  7905. string: string
  7906. };
  7907. }
  7908. /**
  7909. * Process rule into a selector AST.
  7910. *
  7911. * @param rule {postcss.Rule | string} The css selector to be processed
  7912. * @param options The options for processing
  7913. * @returns {Promise<parser.Root>} The AST of the selector after processing it.
  7914. */
  7915. ;
  7916. _proto.ast = function ast(rule, options) {
  7917. return this._run(rule, options).then(function (result) {
  7918. return result.root;
  7919. });
  7920. }
  7921. /**
  7922. * Process rule into a selector AST synchronously.
  7923. *
  7924. * @param rule {postcss.Rule | string} The css selector to be processed
  7925. * @param options The options for processing
  7926. * @returns {parser.Root} The AST of the selector after processing it.
  7927. */
  7928. ;
  7929. _proto.astSync = function astSync(rule, options) {
  7930. return this._runSync(rule, options).root;
  7931. }
  7932. /**
  7933. * Process a selector into a transformed value asynchronously
  7934. *
  7935. * @param rule {postcss.Rule | string} The css selector to be processed
  7936. * @param options The options for processing
  7937. * @returns {Promise<any>} The value returned by the processor.
  7938. */
  7939. ;
  7940. _proto.transform = function transform(rule, options) {
  7941. return this._run(rule, options).then(function (result) {
  7942. return result.transform;
  7943. });
  7944. }
  7945. /**
  7946. * Process a selector into a transformed value synchronously.
  7947. *
  7948. * @param rule {postcss.Rule | string} The css selector to be processed
  7949. * @param options The options for processing
  7950. * @returns {any} The value returned by the processor.
  7951. */
  7952. ;
  7953. _proto.transformSync = function transformSync(rule, options) {
  7954. return this._runSync(rule, options).transform;
  7955. }
  7956. /**
  7957. * Process a selector into a new selector string asynchronously.
  7958. *
  7959. * @param rule {postcss.Rule | string} The css selector to be processed
  7960. * @param options The options for processing
  7961. * @returns {string} the selector after processing.
  7962. */
  7963. ;
  7964. _proto.process = function process(rule, options) {
  7965. return this._run(rule, options).then(function (result) {
  7966. return result.string || result.root.toString();
  7967. });
  7968. }
  7969. /**
  7970. * Process a selector into a new selector string synchronously.
  7971. *
  7972. * @param rule {postcss.Rule | string} The css selector to be processed
  7973. * @param options The options for processing
  7974. * @returns {string} the selector after processing.
  7975. */
  7976. ;
  7977. _proto.processSync = function processSync(rule, options) {
  7978. var result = this._runSync(rule, options);
  7979. return result.string || result.root.toString();
  7980. };
  7981. return Processor;
  7982. }();
  7983. exports["default"] = Processor;
  7984. module.exports = exports.default;
  7985. });
  7986. var constructors = createCommonjsModule(function (module, exports) {
  7987. exports.__esModule = true;
  7988. exports.universal = exports.tag = exports.string = exports.selector = exports.root = exports.pseudo = exports.nesting = exports.id = exports.comment = exports.combinator = exports.className = exports.attribute = void 0;
  7989. var _attribute = _interopRequireDefault(attribute);
  7990. var _className = _interopRequireDefault(className);
  7991. var _combinator = _interopRequireDefault(combinator);
  7992. var _comment = _interopRequireDefault(comment);
  7993. var _id = _interopRequireDefault(id);
  7994. var _nesting = _interopRequireDefault(nesting);
  7995. var _pseudo = _interopRequireDefault(pseudo);
  7996. var _root = _interopRequireDefault(root);
  7997. var _selector = _interopRequireDefault(selector);
  7998. var _string = _interopRequireDefault(string);
  7999. var _tag = _interopRequireDefault(tag);
  8000. var _universal = _interopRequireDefault(universal);
  8001. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  8002. var attribute$1 = function attribute(opts) {
  8003. return new _attribute["default"](opts);
  8004. };
  8005. exports.attribute = attribute$1;
  8006. var className$1 = function className(opts) {
  8007. return new _className["default"](opts);
  8008. };
  8009. exports.className = className$1;
  8010. var combinator$1 = function combinator(opts) {
  8011. return new _combinator["default"](opts);
  8012. };
  8013. exports.combinator = combinator$1;
  8014. var comment$1 = function comment(opts) {
  8015. return new _comment["default"](opts);
  8016. };
  8017. exports.comment = comment$1;
  8018. var id$1 = function id(opts) {
  8019. return new _id["default"](opts);
  8020. };
  8021. exports.id = id$1;
  8022. var nesting$1 = function nesting(opts) {
  8023. return new _nesting["default"](opts);
  8024. };
  8025. exports.nesting = nesting$1;
  8026. var pseudo$1 = function pseudo(opts) {
  8027. return new _pseudo["default"](opts);
  8028. };
  8029. exports.pseudo = pseudo$1;
  8030. var root$1 = function root(opts) {
  8031. return new _root["default"](opts);
  8032. };
  8033. exports.root = root$1;
  8034. var selector$1 = function selector(opts) {
  8035. return new _selector["default"](opts);
  8036. };
  8037. exports.selector = selector$1;
  8038. var string$1 = function string(opts) {
  8039. return new _string["default"](opts);
  8040. };
  8041. exports.string = string$1;
  8042. var tag$1 = function tag(opts) {
  8043. return new _tag["default"](opts);
  8044. };
  8045. exports.tag = tag$1;
  8046. var universal$1 = function universal(opts) {
  8047. return new _universal["default"](opts);
  8048. };
  8049. exports.universal = universal$1;
  8050. });
  8051. var guards = createCommonjsModule(function (module, exports) {
  8052. exports.__esModule = true;
  8053. exports.isNode = isNode;
  8054. exports.isPseudoElement = isPseudoElement;
  8055. exports.isPseudoClass = isPseudoClass;
  8056. exports.isContainer = isContainer;
  8057. exports.isNamespace = isNamespace;
  8058. exports.isUniversal = exports.isTag = exports.isString = exports.isSelector = exports.isRoot = exports.isPseudo = exports.isNesting = exports.isIdentifier = exports.isComment = exports.isCombinator = exports.isClassName = exports.isAttribute = void 0;
  8059. var _IS_TYPE;
  8060. var IS_TYPE = (_IS_TYPE = {}, _IS_TYPE[types.ATTRIBUTE] = true, _IS_TYPE[types.CLASS] = true, _IS_TYPE[types.COMBINATOR] = true, _IS_TYPE[types.COMMENT] = true, _IS_TYPE[types.ID] = true, _IS_TYPE[types.NESTING] = true, _IS_TYPE[types.PSEUDO] = true, _IS_TYPE[types.ROOT] = true, _IS_TYPE[types.SELECTOR] = true, _IS_TYPE[types.STRING] = true, _IS_TYPE[types.TAG] = true, _IS_TYPE[types.UNIVERSAL] = true, _IS_TYPE);
  8061. function isNode(node) {
  8062. return typeof node === "object" && IS_TYPE[node.type];
  8063. }
  8064. function isNodeType(type, node) {
  8065. return isNode(node) && node.type === type;
  8066. }
  8067. var isAttribute = isNodeType.bind(null, types.ATTRIBUTE);
  8068. exports.isAttribute = isAttribute;
  8069. var isClassName = isNodeType.bind(null, types.CLASS);
  8070. exports.isClassName = isClassName;
  8071. var isCombinator = isNodeType.bind(null, types.COMBINATOR);
  8072. exports.isCombinator = isCombinator;
  8073. var isComment = isNodeType.bind(null, types.COMMENT);
  8074. exports.isComment = isComment;
  8075. var isIdentifier = isNodeType.bind(null, types.ID);
  8076. exports.isIdentifier = isIdentifier;
  8077. var isNesting = isNodeType.bind(null, types.NESTING);
  8078. exports.isNesting = isNesting;
  8079. var isPseudo = isNodeType.bind(null, types.PSEUDO);
  8080. exports.isPseudo = isPseudo;
  8081. var isRoot = isNodeType.bind(null, types.ROOT);
  8082. exports.isRoot = isRoot;
  8083. var isSelector = isNodeType.bind(null, types.SELECTOR);
  8084. exports.isSelector = isSelector;
  8085. var isString = isNodeType.bind(null, types.STRING);
  8086. exports.isString = isString;
  8087. var isTag = isNodeType.bind(null, types.TAG);
  8088. exports.isTag = isTag;
  8089. var isUniversal = isNodeType.bind(null, types.UNIVERSAL);
  8090. exports.isUniversal = isUniversal;
  8091. function isPseudoElement(node) {
  8092. return isPseudo(node) && node.value && (node.value.startsWith("::") || node.value.toLowerCase() === ":before" || node.value.toLowerCase() === ":after");
  8093. }
  8094. function isPseudoClass(node) {
  8095. return isPseudo(node) && !isPseudoElement(node);
  8096. }
  8097. function isContainer(node) {
  8098. return !!(isNode(node) && node.walk);
  8099. }
  8100. function isNamespace(node) {
  8101. return isAttribute(node) || isTag(node);
  8102. }
  8103. });
  8104. var selectors = createCommonjsModule(function (module, exports) {
  8105. exports.__esModule = true;
  8106. Object.keys(types).forEach(function (key) {
  8107. if (key === "default" || key === "__esModule") return;
  8108. if (key in exports && exports[key] === types[key]) return;
  8109. exports[key] = types[key];
  8110. });
  8111. Object.keys(constructors).forEach(function (key) {
  8112. if (key === "default" || key === "__esModule") return;
  8113. if (key in exports && exports[key] === constructors[key]) return;
  8114. exports[key] = constructors[key];
  8115. });
  8116. Object.keys(guards).forEach(function (key) {
  8117. if (key === "default" || key === "__esModule") return;
  8118. if (key in exports && exports[key] === guards[key]) return;
  8119. exports[key] = guards[key];
  8120. });
  8121. });
  8122. var dist = createCommonjsModule(function (module, exports) {
  8123. exports.__esModule = true;
  8124. exports["default"] = void 0;
  8125. var _processor = _interopRequireDefault(processor);
  8126. var selectors$1 = _interopRequireWildcard(selectors);
  8127. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
  8128. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
  8129. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  8130. var parser = function parser(processor) {
  8131. return new _processor["default"](processor);
  8132. };
  8133. Object.assign(parser, selectors$1);
  8134. delete parser.__esModule;
  8135. var _default = parser;
  8136. exports["default"] = _default;
  8137. module.exports = exports.default;
  8138. });
  8139. var selectorParser = /*@__PURE__*/getDefaultExportFromCjs(dist);
  8140. const animationNameRE = /^(-\w+-)?animation-name$/;
  8141. const animationRE = /^(-\w+-)?animation$/;
  8142. const scopedPlugin = (id = '') => {
  8143. const keyframes = Object.create(null);
  8144. const shortId = id.replace(/^data-v-/, '');
  8145. return {
  8146. postcssPlugin: 'vue-sfc-scoped',
  8147. Rule(rule) {
  8148. processRule(id, rule);
  8149. },
  8150. AtRule(node) {
  8151. if (/-?keyframes$/.test(node.name) &&
  8152. !node.params.endsWith(`-${shortId}`)) {
  8153. // register keyframes
  8154. keyframes[node.params] = node.params = node.params + '-' + shortId;
  8155. }
  8156. },
  8157. OnceExit(root) {
  8158. if (Object.keys(keyframes).length) {
  8159. // If keyframes are found in this <style>, find and rewrite animation names
  8160. // in declarations.
  8161. // Caveat: this only works for keyframes and animation rules in the same
  8162. // <style> element.
  8163. // individual animation-name declaration
  8164. root.walkDecls(decl => {
  8165. if (animationNameRE.test(decl.prop)) {
  8166. decl.value = decl.value
  8167. .split(',')
  8168. .map(v => keyframes[v.trim()] || v.trim())
  8169. .join(',');
  8170. }
  8171. // shorthand
  8172. if (animationRE.test(decl.prop)) {
  8173. decl.value = decl.value
  8174. .split(',')
  8175. .map(v => {
  8176. const vals = v.trim().split(/\s+/);
  8177. const i = vals.findIndex(val => keyframes[val]);
  8178. if (i !== -1) {
  8179. vals.splice(i, 1, keyframes[vals[i]]);
  8180. return vals.join(' ');
  8181. }
  8182. else {
  8183. return v;
  8184. }
  8185. })
  8186. .join(',');
  8187. }
  8188. });
  8189. }
  8190. }
  8191. };
  8192. };
  8193. const processedRules = new WeakSet();
  8194. function processRule(id, rule) {
  8195. if (processedRules.has(rule) ||
  8196. (rule.parent &&
  8197. rule.parent.type === 'atrule' &&
  8198. /-?keyframes$/.test(rule.parent.name))) {
  8199. return;
  8200. }
  8201. processedRules.add(rule);
  8202. rule.selector = selectorParser(selectorRoot => {
  8203. selectorRoot.each(selector => {
  8204. rewriteSelector(id, selector, selectorRoot);
  8205. });
  8206. }).processSync(rule.selector);
  8207. }
  8208. function rewriteSelector(id, selector, selectorRoot, slotted = false) {
  8209. let node = null;
  8210. let shouldInject = true;
  8211. // find the last child node to insert attribute selector
  8212. selector.each(n => {
  8213. // DEPRECATED ">>>" and "/deep/" combinator
  8214. if (n.type === 'combinator' &&
  8215. (n.value === '>>>' || n.value === '/deep/')) {
  8216. n.value = ' ';
  8217. n.spaces.before = n.spaces.after = '';
  8218. warn(`the >>> and /deep/ combinators have been deprecated. ` +
  8219. `Use :deep() instead.`);
  8220. return false;
  8221. }
  8222. if (n.type === 'pseudo') {
  8223. const { value } = n;
  8224. // deep: inject [id] attribute at the node before the ::v-deep
  8225. // combinator.
  8226. if (value === ':deep' || value === '::v-deep') {
  8227. if (n.nodes.length) {
  8228. // .foo ::v-deep(.bar) -> .foo[xxxxxxx] .bar
  8229. // replace the current node with ::v-deep's inner selector
  8230. let last = n;
  8231. n.nodes[0].each(ss => {
  8232. selector.insertAfter(last, ss);
  8233. last = ss;
  8234. });
  8235. // insert a space combinator before if it doesn't already have one
  8236. const prev = selector.at(selector.index(n) - 1);
  8237. if (!prev || !isSpaceCombinator(prev)) {
  8238. selector.insertAfter(n, selectorParser.combinator({
  8239. value: ' '
  8240. }));
  8241. }
  8242. selector.removeChild(n);
  8243. }
  8244. else {
  8245. // DEPRECATED usage
  8246. // .foo ::v-deep .bar -> .foo[xxxxxxx] .bar
  8247. warn(`::v-deep usage as a combinator has ` +
  8248. `been deprecated. Use :deep(<inner-selector>) instead.`);
  8249. const prev = selector.at(selector.index(n) - 1);
  8250. if (prev && isSpaceCombinator(prev)) {
  8251. selector.removeChild(prev);
  8252. }
  8253. selector.removeChild(n);
  8254. }
  8255. return false;
  8256. }
  8257. // slot: use selector inside `::v-slotted` and inject [id + '-s']
  8258. // instead.
  8259. // ::v-slotted(.foo) -> .foo[xxxxxxx-s]
  8260. if (value === ':slotted' || value === '::v-slotted') {
  8261. rewriteSelector(id, n.nodes[0], selectorRoot, true /* slotted */);
  8262. let last = n;
  8263. n.nodes[0].each(ss => {
  8264. selector.insertAfter(last, ss);
  8265. last = ss;
  8266. });
  8267. // selector.insertAfter(n, n.nodes[0])
  8268. selector.removeChild(n);
  8269. // since slotted attribute already scopes the selector there's no
  8270. // need for the non-slot attribute.
  8271. shouldInject = false;
  8272. return false;
  8273. }
  8274. // global: replace with inner selector and do not inject [id].
  8275. // ::v-global(.foo) -> .foo
  8276. if (value === ':global' || value === '::v-global') {
  8277. selectorRoot.insertAfter(selector, n.nodes[0]);
  8278. selectorRoot.removeChild(selector);
  8279. return false;
  8280. }
  8281. }
  8282. if (n.type !== 'pseudo' && n.type !== 'combinator') {
  8283. node = n;
  8284. }
  8285. });
  8286. if (node) {
  8287. node.spaces.after = '';
  8288. }
  8289. else {
  8290. // For deep selectors & standalone pseudo selectors,
  8291. // the attribute selectors are prepended rather than appended.
  8292. // So all leading spaces must be eliminated to avoid problems.
  8293. selector.first.spaces.before = '';
  8294. }
  8295. if (shouldInject) {
  8296. const idToAdd = slotted ? id + '-s' : id;
  8297. selector.insertAfter(
  8298. // If node is null it means we need to inject [id] at the start
  8299. // insertAfter can handle `null` here
  8300. node, selectorParser.attribute({
  8301. attribute: idToAdd,
  8302. value: idToAdd,
  8303. raws: {},
  8304. quoteMark: `"`
  8305. }));
  8306. }
  8307. }
  8308. function isSpaceCombinator(node) {
  8309. return node.type === 'combinator' && /^\s+$/.test(node.value);
  8310. }
  8311. scopedPlugin.postcss = true;
  8312. var SourceMapConsumer = sourceMap__default.SourceMapConsumer;
  8313. var SourceMapGenerator = sourceMap__default.SourceMapGenerator;
  8314. var mergeSourceMap = merge$1;
  8315. /**
  8316. * Merge old source map and new source map and return merged.
  8317. * If old or new source map value is falsy, return another one as it is.
  8318. *
  8319. * @param {object|string} [oldMap] old source map object
  8320. * @param {object|string} [newmap] new source map object
  8321. * @return {object|undefined} merged source map object, or undefined when both old and new source map are undefined
  8322. */
  8323. function merge$1(oldMap, newMap) {
  8324. if (!oldMap) return newMap
  8325. if (!newMap) return oldMap
  8326. var oldMapConsumer = new SourceMapConsumer(oldMap);
  8327. var newMapConsumer = new SourceMapConsumer(newMap);
  8328. var mergedMapGenerator = new SourceMapGenerator();
  8329. // iterate on new map and overwrite original position of new map with one of old map
  8330. newMapConsumer.eachMapping(function(m) {
  8331. // pass when `originalLine` is null.
  8332. // It occurs in case that the node does not have origin in original code.
  8333. if (m.originalLine == null) return
  8334. var origPosInOldMap = oldMapConsumer.originalPositionFor({
  8335. line: m.originalLine,
  8336. column: m.originalColumn
  8337. });
  8338. if (origPosInOldMap.source == null) return
  8339. mergedMapGenerator.addMapping({
  8340. original: {
  8341. line: origPosInOldMap.line,
  8342. column: origPosInOldMap.column
  8343. },
  8344. generated: {
  8345. line: m.generatedLine,
  8346. column: m.generatedColumn
  8347. },
  8348. source: origPosInOldMap.source,
  8349. name: origPosInOldMap.name
  8350. });
  8351. });
  8352. var consumers = [oldMapConsumer, newMapConsumer];
  8353. consumers.forEach(function(consumer) {
  8354. consumer.sources.forEach(function(sourceFile) {
  8355. mergedMapGenerator._sources.add(sourceFile);
  8356. var sourceContent = consumer.sourceContentFor(sourceFile);
  8357. if (sourceContent != null) {
  8358. mergedMapGenerator.setSourceContent(sourceFile, sourceContent);
  8359. }
  8360. });
  8361. });
  8362. mergedMapGenerator._sourceRoot = oldMap.sourceRoot;
  8363. mergedMapGenerator._file = oldMap.file;
  8364. return JSON.parse(mergedMapGenerator.toString())
  8365. }
  8366. // .scss/.sass processor
  8367. const scss = (source, map, options, load = require) => {
  8368. const nodeSass = load('sass');
  8369. const finalOptions = {
  8370. ...options,
  8371. data: getSource(source, options.filename, options.additionalData),
  8372. file: options.filename,
  8373. outFile: options.filename,
  8374. sourceMap: !!map
  8375. };
  8376. try {
  8377. const result = nodeSass.renderSync(finalOptions);
  8378. const dependencies = result.stats.includedFiles;
  8379. if (map) {
  8380. return {
  8381. code: result.css.toString(),
  8382. map: mergeSourceMap(map, JSON.parse(result.map.toString())),
  8383. errors: [],
  8384. dependencies
  8385. };
  8386. }
  8387. return { code: result.css.toString(), errors: [], dependencies };
  8388. }
  8389. catch (e) {
  8390. return { code: '', errors: [e], dependencies: [] };
  8391. }
  8392. };
  8393. const sass = (source, map, options, load) => scss(source, map, {
  8394. ...options,
  8395. indentedSyntax: true
  8396. }, load);
  8397. // .less
  8398. const less = (source, map, options, load = require) => {
  8399. const nodeLess = load('less');
  8400. let result;
  8401. let error = null;
  8402. nodeLess.render(getSource(source, options.filename, options.additionalData), { ...options, syncImport: true }, (err, output) => {
  8403. error = err;
  8404. result = output;
  8405. });
  8406. if (error)
  8407. return { code: '', errors: [error], dependencies: [] };
  8408. const dependencies = result.imports;
  8409. if (map) {
  8410. return {
  8411. code: result.css.toString(),
  8412. map: mergeSourceMap(map, result.map),
  8413. errors: [],
  8414. dependencies: dependencies
  8415. };
  8416. }
  8417. return {
  8418. code: result.css.toString(),
  8419. errors: [],
  8420. dependencies: dependencies
  8421. };
  8422. };
  8423. // .styl
  8424. const styl = (source, map, options, load = require) => {
  8425. const nodeStylus = load('stylus');
  8426. try {
  8427. const ref = nodeStylus(source);
  8428. Object.keys(options).forEach(key => ref.set(key, options[key]));
  8429. if (map)
  8430. ref.set('sourcemap', { inline: false, comment: false });
  8431. const result = ref.render();
  8432. const dependencies = ref.deps();
  8433. if (map) {
  8434. return {
  8435. code: result,
  8436. map: mergeSourceMap(map, ref.sourcemap),
  8437. errors: [],
  8438. dependencies
  8439. };
  8440. }
  8441. return { code: result, errors: [], dependencies };
  8442. }
  8443. catch (e) {
  8444. return { code: '', errors: [e], dependencies: [] };
  8445. }
  8446. };
  8447. function getSource(source, filename, additionalData) {
  8448. if (!additionalData)
  8449. return source;
  8450. if (shared.isFunction(additionalData)) {
  8451. return additionalData(source, filename);
  8452. }
  8453. return additionalData + source;
  8454. }
  8455. const processors = {
  8456. less,
  8457. sass,
  8458. scss,
  8459. styl,
  8460. stylus: styl
  8461. };
  8462. /**
  8463. * lodash (Custom Build) <https://lodash.com/>
  8464. * Build: `lodash modularize exports="npm" -o ./`
  8465. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  8466. * Released under MIT license <https://lodash.com/license>
  8467. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  8468. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  8469. */
  8470. /** Used as references for various `Number` constants. */
  8471. var INFINITY = 1 / 0;
  8472. /** `Object#toString` result references. */
  8473. var symbolTag = '[object Symbol]';
  8474. /** Used to match words composed of alphanumeric characters. */
  8475. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  8476. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  8477. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  8478. /** Used to compose unicode character classes. */
  8479. var rsAstralRange = '\\ud800-\\udfff',
  8480. rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
  8481. rsComboSymbolsRange = '\\u20d0-\\u20f0',
  8482. rsDingbatRange = '\\u2700-\\u27bf',
  8483. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  8484. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  8485. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  8486. rsPunctuationRange = '\\u2000-\\u206f',
  8487. rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
  8488. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  8489. rsVarRange = '\\ufe0e\\ufe0f',
  8490. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  8491. /** Used to compose unicode capture groups. */
  8492. var rsApos = "['\u2019]",
  8493. rsAstral = '[' + rsAstralRange + ']',
  8494. rsBreak = '[' + rsBreakRange + ']',
  8495. rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
  8496. rsDigits = '\\d+',
  8497. rsDingbat = '[' + rsDingbatRange + ']',
  8498. rsLower = '[' + rsLowerRange + ']',
  8499. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  8500. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  8501. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  8502. rsNonAstral = '[^' + rsAstralRange + ']',
  8503. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  8504. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  8505. rsUpper = '[' + rsUpperRange + ']',
  8506. rsZWJ = '\\u200d';
  8507. /** Used to compose unicode regexes. */
  8508. var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
  8509. rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
  8510. rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  8511. rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  8512. reOptMod = rsModifier + '?',
  8513. rsOptVar = '[' + rsVarRange + ']?',
  8514. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  8515. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  8516. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  8517. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  8518. /** Used to match apostrophes. */
  8519. var reApos = RegExp(rsApos, 'g');
  8520. /**
  8521. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  8522. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  8523. */
  8524. var reComboMark = RegExp(rsCombo, 'g');
  8525. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  8526. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  8527. /** Used to match complex or compound words. */
  8528. var reUnicodeWord = RegExp([
  8529. rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  8530. rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
  8531. rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
  8532. rsUpper + '+' + rsOptUpperContr,
  8533. rsDigits,
  8534. rsEmoji
  8535. ].join('|'), 'g');
  8536. /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
  8537. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
  8538. /** Used to detect strings that need a more robust regexp to match words. */
  8539. var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
  8540. /** Used to map Latin Unicode letters to basic Latin letters. */
  8541. var deburredLetters = {
  8542. // Latin-1 Supplement block.
  8543. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  8544. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  8545. '\xc7': 'C', '\xe7': 'c',
  8546. '\xd0': 'D', '\xf0': 'd',
  8547. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  8548. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  8549. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  8550. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  8551. '\xd1': 'N', '\xf1': 'n',
  8552. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  8553. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  8554. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  8555. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  8556. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  8557. '\xc6': 'Ae', '\xe6': 'ae',
  8558. '\xde': 'Th', '\xfe': 'th',
  8559. '\xdf': 'ss',
  8560. // Latin Extended-A block.
  8561. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  8562. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  8563. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  8564. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  8565. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  8566. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  8567. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  8568. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  8569. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  8570. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  8571. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  8572. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  8573. '\u0134': 'J', '\u0135': 'j',
  8574. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  8575. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  8576. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  8577. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  8578. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  8579. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  8580. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  8581. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  8582. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  8583. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  8584. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  8585. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  8586. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  8587. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  8588. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  8589. '\u0174': 'W', '\u0175': 'w',
  8590. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  8591. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  8592. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  8593. '\u0132': 'IJ', '\u0133': 'ij',
  8594. '\u0152': 'Oe', '\u0153': 'oe',
  8595. '\u0149': "'n", '\u017f': 'ss'
  8596. };
  8597. /** Detect free variable `global` from Node.js. */
  8598. var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
  8599. /** Detect free variable `self`. */
  8600. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  8601. /** Used as a reference to the global object. */
  8602. var root$1 = freeGlobal || freeSelf || Function('return this')();
  8603. /**
  8604. * A specialized version of `_.reduce` for arrays without support for
  8605. * iteratee shorthands.
  8606. *
  8607. * @private
  8608. * @param {Array} [array] The array to iterate over.
  8609. * @param {Function} iteratee The function invoked per iteration.
  8610. * @param {*} [accumulator] The initial value.
  8611. * @param {boolean} [initAccum] Specify using the first element of `array` as
  8612. * the initial value.
  8613. * @returns {*} Returns the accumulated value.
  8614. */
  8615. function arrayReduce(array, iteratee, accumulator, initAccum) {
  8616. var index = -1,
  8617. length = array ? array.length : 0;
  8618. if (initAccum && length) {
  8619. accumulator = array[++index];
  8620. }
  8621. while (++index < length) {
  8622. accumulator = iteratee(accumulator, array[index], index, array);
  8623. }
  8624. return accumulator;
  8625. }
  8626. /**
  8627. * Converts an ASCII `string` to an array.
  8628. *
  8629. * @private
  8630. * @param {string} string The string to convert.
  8631. * @returns {Array} Returns the converted array.
  8632. */
  8633. function asciiToArray(string) {
  8634. return string.split('');
  8635. }
  8636. /**
  8637. * Splits an ASCII `string` into an array of its words.
  8638. *
  8639. * @private
  8640. * @param {string} The string to inspect.
  8641. * @returns {Array} Returns the words of `string`.
  8642. */
  8643. function asciiWords(string) {
  8644. return string.match(reAsciiWord) || [];
  8645. }
  8646. /**
  8647. * The base implementation of `_.propertyOf` without support for deep paths.
  8648. *
  8649. * @private
  8650. * @param {Object} object The object to query.
  8651. * @returns {Function} Returns the new accessor function.
  8652. */
  8653. function basePropertyOf(object) {
  8654. return function(key) {
  8655. return object == null ? undefined : object[key];
  8656. };
  8657. }
  8658. /**
  8659. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  8660. * letters to basic Latin letters.
  8661. *
  8662. * @private
  8663. * @param {string} letter The matched letter to deburr.
  8664. * @returns {string} Returns the deburred letter.
  8665. */
  8666. var deburrLetter = basePropertyOf(deburredLetters);
  8667. /**
  8668. * Checks if `string` contains Unicode symbols.
  8669. *
  8670. * @private
  8671. * @param {string} string The string to inspect.
  8672. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  8673. */
  8674. function hasUnicode(string) {
  8675. return reHasUnicode.test(string);
  8676. }
  8677. /**
  8678. * Checks if `string` contains a word composed of Unicode symbols.
  8679. *
  8680. * @private
  8681. * @param {string} string The string to inspect.
  8682. * @returns {boolean} Returns `true` if a word is found, else `false`.
  8683. */
  8684. function hasUnicodeWord(string) {
  8685. return reHasUnicodeWord.test(string);
  8686. }
  8687. /**
  8688. * Converts `string` to an array.
  8689. *
  8690. * @private
  8691. * @param {string} string The string to convert.
  8692. * @returns {Array} Returns the converted array.
  8693. */
  8694. function stringToArray(string) {
  8695. return hasUnicode(string)
  8696. ? unicodeToArray(string)
  8697. : asciiToArray(string);
  8698. }
  8699. /**
  8700. * Converts a Unicode `string` to an array.
  8701. *
  8702. * @private
  8703. * @param {string} string The string to convert.
  8704. * @returns {Array} Returns the converted array.
  8705. */
  8706. function unicodeToArray(string) {
  8707. return string.match(reUnicode) || [];
  8708. }
  8709. /**
  8710. * Splits a Unicode `string` into an array of its words.
  8711. *
  8712. * @private
  8713. * @param {string} The string to inspect.
  8714. * @returns {Array} Returns the words of `string`.
  8715. */
  8716. function unicodeWords(string) {
  8717. return string.match(reUnicodeWord) || [];
  8718. }
  8719. /** Used for built-in method references. */
  8720. var objectProto = Object.prototype;
  8721. /**
  8722. * Used to resolve the
  8723. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  8724. * of values.
  8725. */
  8726. var objectToString = objectProto.toString;
  8727. /** Built-in value references. */
  8728. var Symbol$1 = root$1.Symbol;
  8729. /** Used to convert symbols to primitives and strings. */
  8730. var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
  8731. symbolToString = symbolProto ? symbolProto.toString : undefined;
  8732. /**
  8733. * The base implementation of `_.slice` without an iteratee call guard.
  8734. *
  8735. * @private
  8736. * @param {Array} array The array to slice.
  8737. * @param {number} [start=0] The start position.
  8738. * @param {number} [end=array.length] The end position.
  8739. * @returns {Array} Returns the slice of `array`.
  8740. */
  8741. function baseSlice(array, start, end) {
  8742. var index = -1,
  8743. length = array.length;
  8744. if (start < 0) {
  8745. start = -start > length ? 0 : (length + start);
  8746. }
  8747. end = end > length ? length : end;
  8748. if (end < 0) {
  8749. end += length;
  8750. }
  8751. length = start > end ? 0 : ((end - start) >>> 0);
  8752. start >>>= 0;
  8753. var result = Array(length);
  8754. while (++index < length) {
  8755. result[index] = array[index + start];
  8756. }
  8757. return result;
  8758. }
  8759. /**
  8760. * The base implementation of `_.toString` which doesn't convert nullish
  8761. * values to empty strings.
  8762. *
  8763. * @private
  8764. * @param {*} value The value to process.
  8765. * @returns {string} Returns the string.
  8766. */
  8767. function baseToString(value) {
  8768. // Exit early for strings to avoid a performance hit in some environments.
  8769. if (typeof value == 'string') {
  8770. return value;
  8771. }
  8772. if (isSymbol(value)) {
  8773. return symbolToString ? symbolToString.call(value) : '';
  8774. }
  8775. var result = (value + '');
  8776. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  8777. }
  8778. /**
  8779. * Casts `array` to a slice if it's needed.
  8780. *
  8781. * @private
  8782. * @param {Array} array The array to inspect.
  8783. * @param {number} start The start position.
  8784. * @param {number} [end=array.length] The end position.
  8785. * @returns {Array} Returns the cast slice.
  8786. */
  8787. function castSlice(array, start, end) {
  8788. var length = array.length;
  8789. end = end === undefined ? length : end;
  8790. return (!start && end >= length) ? array : baseSlice(array, start, end);
  8791. }
  8792. /**
  8793. * Creates a function like `_.lowerFirst`.
  8794. *
  8795. * @private
  8796. * @param {string} methodName The name of the `String` case method to use.
  8797. * @returns {Function} Returns the new case function.
  8798. */
  8799. function createCaseFirst(methodName) {
  8800. return function(string) {
  8801. string = toString$1(string);
  8802. var strSymbols = hasUnicode(string)
  8803. ? stringToArray(string)
  8804. : undefined;
  8805. var chr = strSymbols
  8806. ? strSymbols[0]
  8807. : string.charAt(0);
  8808. var trailing = strSymbols
  8809. ? castSlice(strSymbols, 1).join('')
  8810. : string.slice(1);
  8811. return chr[methodName]() + trailing;
  8812. };
  8813. }
  8814. /**
  8815. * Creates a function like `_.camelCase`.
  8816. *
  8817. * @private
  8818. * @param {Function} callback The function to combine each word.
  8819. * @returns {Function} Returns the new compounder function.
  8820. */
  8821. function createCompounder(callback) {
  8822. return function(string) {
  8823. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  8824. };
  8825. }
  8826. /**
  8827. * Checks if `value` is object-like. A value is object-like if it's not `null`
  8828. * and has a `typeof` result of "object".
  8829. *
  8830. * @static
  8831. * @memberOf _
  8832. * @since 4.0.0
  8833. * @category Lang
  8834. * @param {*} value The value to check.
  8835. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  8836. * @example
  8837. *
  8838. * _.isObjectLike({});
  8839. * // => true
  8840. *
  8841. * _.isObjectLike([1, 2, 3]);
  8842. * // => true
  8843. *
  8844. * _.isObjectLike(_.noop);
  8845. * // => false
  8846. *
  8847. * _.isObjectLike(null);
  8848. * // => false
  8849. */
  8850. function isObjectLike(value) {
  8851. return !!value && typeof value == 'object';
  8852. }
  8853. /**
  8854. * Checks if `value` is classified as a `Symbol` primitive or object.
  8855. *
  8856. * @static
  8857. * @memberOf _
  8858. * @since 4.0.0
  8859. * @category Lang
  8860. * @param {*} value The value to check.
  8861. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  8862. * @example
  8863. *
  8864. * _.isSymbol(Symbol.iterator);
  8865. * // => true
  8866. *
  8867. * _.isSymbol('abc');
  8868. * // => false
  8869. */
  8870. function isSymbol(value) {
  8871. return typeof value == 'symbol' ||
  8872. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  8873. }
  8874. /**
  8875. * Converts `value` to a string. An empty string is returned for `null`
  8876. * and `undefined` values. The sign of `-0` is preserved.
  8877. *
  8878. * @static
  8879. * @memberOf _
  8880. * @since 4.0.0
  8881. * @category Lang
  8882. * @param {*} value The value to process.
  8883. * @returns {string} Returns the string.
  8884. * @example
  8885. *
  8886. * _.toString(null);
  8887. * // => ''
  8888. *
  8889. * _.toString(-0);
  8890. * // => '-0'
  8891. *
  8892. * _.toString([1, 2, 3]);
  8893. * // => '1,2,3'
  8894. */
  8895. function toString$1(value) {
  8896. return value == null ? '' : baseToString(value);
  8897. }
  8898. /**
  8899. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  8900. *
  8901. * @static
  8902. * @memberOf _
  8903. * @since 3.0.0
  8904. * @category String
  8905. * @param {string} [string=''] The string to convert.
  8906. * @returns {string} Returns the camel cased string.
  8907. * @example
  8908. *
  8909. * _.camelCase('Foo Bar');
  8910. * // => 'fooBar'
  8911. *
  8912. * _.camelCase('--foo-bar--');
  8913. * // => 'fooBar'
  8914. *
  8915. * _.camelCase('__FOO_BAR__');
  8916. * // => 'fooBar'
  8917. */
  8918. var camelCase = createCompounder(function(result, word, index) {
  8919. word = word.toLowerCase();
  8920. return result + (index ? capitalize(word) : word);
  8921. });
  8922. /**
  8923. * Converts the first character of `string` to upper case and the remaining
  8924. * to lower case.
  8925. *
  8926. * @static
  8927. * @memberOf _
  8928. * @since 3.0.0
  8929. * @category String
  8930. * @param {string} [string=''] The string to capitalize.
  8931. * @returns {string} Returns the capitalized string.
  8932. * @example
  8933. *
  8934. * _.capitalize('FRED');
  8935. * // => 'Fred'
  8936. */
  8937. function capitalize(string) {
  8938. return upperFirst(toString$1(string).toLowerCase());
  8939. }
  8940. /**
  8941. * Deburrs `string` by converting
  8942. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  8943. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  8944. * letters to basic Latin letters and removing
  8945. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  8946. *
  8947. * @static
  8948. * @memberOf _
  8949. * @since 3.0.0
  8950. * @category String
  8951. * @param {string} [string=''] The string to deburr.
  8952. * @returns {string} Returns the deburred string.
  8953. * @example
  8954. *
  8955. * _.deburr('déjà vu');
  8956. * // => 'deja vu'
  8957. */
  8958. function deburr(string) {
  8959. string = toString$1(string);
  8960. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  8961. }
  8962. /**
  8963. * Converts the first character of `string` to upper case.
  8964. *
  8965. * @static
  8966. * @memberOf _
  8967. * @since 4.0.0
  8968. * @category String
  8969. * @param {string} [string=''] The string to convert.
  8970. * @returns {string} Returns the converted string.
  8971. * @example
  8972. *
  8973. * _.upperFirst('fred');
  8974. * // => 'Fred'
  8975. *
  8976. * _.upperFirst('FRED');
  8977. * // => 'FRED'
  8978. */
  8979. var upperFirst = createCaseFirst('toUpperCase');
  8980. /**
  8981. * Splits `string` into an array of its words.
  8982. *
  8983. * @static
  8984. * @memberOf _
  8985. * @since 3.0.0
  8986. * @category String
  8987. * @param {string} [string=''] The string to inspect.
  8988. * @param {RegExp|string} [pattern] The pattern to match words.
  8989. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8990. * @returns {Array} Returns the words of `string`.
  8991. * @example
  8992. *
  8993. * _.words('fred, barney, & pebbles');
  8994. * // => ['fred', 'barney', 'pebbles']
  8995. *
  8996. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  8997. * // => ['fred', 'barney', '&', 'pebbles']
  8998. */
  8999. function words(string, pattern, guard) {
  9000. string = toString$1(string);
  9001. pattern = guard ? undefined : pattern;
  9002. if (pattern === undefined) {
  9003. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  9004. }
  9005. return string.match(pattern) || [];
  9006. }
  9007. var lodash_camelcase = camelCase;
  9008. var unicode = createCommonjsModule(function (module, exports) {
  9009. Object.defineProperty(exports,"__esModule",{value:true});exports.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/;exports.ID_Start=/[\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\u0561-\u0587\u05D0-\u05EA\u05F0-\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\u08A0-\u08B4\u08B6-\u08BD\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\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\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\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\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\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-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\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\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\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\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\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-\uAB65\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]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/;exports.ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\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\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\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\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
  9010. });
  9011. var isSpaceSeparator_1=isSpaceSeparator;var isIdStartChar_1=isIdStartChar;var isIdContinueChar_1=isIdContinueChar;var isDigit_1=isDigit;var isHexDigit_1=isHexDigit;var unicode$1=_interopRequireWildcard(unicode);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else {var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj}}function isSpaceSeparator(c){return unicode$1.Space_Separator.test(c)}function isIdStartChar(c){return c>='a'&&c<='z'||c>='A'&&c<='Z'||c==='$'||c==='_'||unicode$1.ID_Start.test(c)}function isIdContinueChar(c){return c>='a'&&c<='z'||c>='A'&&c<='Z'||c>='0'&&c<='9'||c==='$'||c==='_'||c==='\u200C'||c==='\u200D'||unicode$1.ID_Continue.test(c)}function isDigit(c){return /[0-9]/.test(c)}function isHexDigit(c){return /[0-9A-Fa-f]/.test(c)}
  9012. var util$1 = /*#__PURE__*/Object.defineProperty({
  9013. isSpaceSeparator: isSpaceSeparator_1,
  9014. isIdStartChar: isIdStartChar_1,
  9015. isIdContinueChar: isIdContinueChar_1,
  9016. isDigit: isDigit_1,
  9017. isHexDigit: isHexDigit_1
  9018. }, '__esModule', {value: true});
  9019. var parse_1 = createCommonjsModule(function (module, exports) {
  9020. Object.defineProperty(exports,'__esModule',{value:true});var _typeof=typeof Symbol==='function'&&typeof Symbol.iterator==='symbol'?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==='function'&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj};exports.default=parse;var util=_interopRequireWildcard(util$1);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else {var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj}}var source=void 0;var parseState=void 0;var stack=void 0;var pos=void 0;var line=void 0;var column=void 0;var token=void 0;var key=void 0;var root=void 0;function parse(text,reviver){source=String(text);parseState='start';stack=[];pos=0;line=1;column=0;token=undefined;key=undefined;root=undefined;do{token=lex();parseStates[parseState]();}while(token.type!=='eof');if(typeof reviver==='function'){return internalize({'':root},'',reviver)}return root}function internalize(holder,name,reviver){var value=holder[name];if(value!=null&&(typeof value==='undefined'?'undefined':_typeof(value))==='object'){for(var _key in value){var replacement=internalize(value,_key,reviver);if(replacement===undefined){delete value[_key];}else {value[_key]=replacement;}}}return reviver.call(holder,name,value)}var lexState=void 0;var buffer=void 0;var doubleQuote=void 0;var _sign=void 0;var c=void 0;function lex(){lexState='default';buffer='';doubleQuote=false;_sign=1;for(;;){c=peek();var _token=lexStates[lexState]();if(_token){return _token}}}function peek(){if(source[pos]){return String.fromCodePoint(source.codePointAt(pos))}}function read(){var c=peek();if(c==='\n'){line++;column=0;}else if(c){column+=c.length;}else {column++;}if(c){pos+=c.length;}return c}var lexStates={default:function _default(){switch(c){case'\t':case'\x0B':case'\f':case' ':case'\xA0':case'\uFEFF':case'\n':case'\r':case'\u2028':case'\u2029':read();return;case'/':read();lexState='comment';return;case undefined:read();return newToken('eof');}if(util.isSpaceSeparator(c)){read();return}return lexStates[parseState]()},comment:function comment(){switch(c){case'*':read();lexState='multiLineComment';return;case'/':read();lexState='singleLineComment';return;}throw invalidChar(read())},multiLineComment:function multiLineComment(){switch(c){case'*':read();lexState='multiLineCommentAsterisk';return;case undefined:throw invalidChar(read());}read();},multiLineCommentAsterisk:function multiLineCommentAsterisk(){switch(c){case'*':read();return;case'/':read();lexState='default';return;case undefined:throw invalidChar(read());}read();lexState='multiLineComment';},singleLineComment:function singleLineComment(){switch(c){case'\n':case'\r':case'\u2028':case'\u2029':read();lexState='default';return;case undefined:read();return newToken('eof');}read();},value:function value(){switch(c){case'{':case'[':return newToken('punctuator',read());case'n':read();literal('ull');return newToken('null',null);case't':read();literal('rue');return newToken('boolean',true);case'f':read();literal('alse');return newToken('boolean',false);case'-':case'+':if(read()==='-'){_sign=-1;}lexState='sign';return;case'.':buffer=read();lexState='decimalPointLeading';return;case'0':buffer=read();lexState='zero';return;case'1':case'2':case'3':case'4':case'5':case'6':case'7':case'8':case'9':buffer=read();lexState='decimalInteger';return;case'I':read();literal('nfinity');return newToken('numeric',Infinity);case'N':read();literal('aN');return newToken('numeric',NaN);case'"':case'\'':doubleQuote=read()==='"';buffer='';lexState='string';return;}throw invalidChar(read())},identifierNameStartEscape:function identifierNameStartEscape(){if(c!=='u'){throw invalidChar(read())}read();var u=unicodeEscape();switch(u){case'$':case'_':break;default:if(!util.isIdStartChar(u)){throw invalidIdentifier()}break;}buffer+=u;lexState='identifierName';},identifierName:function identifierName(){switch(c){case'$':case'_':case'\u200C':case'\u200D':buffer+=read();return;case'\\':read();lexState='identifierNameEscape';return;}if(util.isIdContinueChar(c)){buffer+=read();return}return newToken('identifier',buffer)},identifierNameEscape:function identifierNameEscape(){if(c!=='u'){throw invalidChar(read())}read();var u=unicodeEscape();switch(u){case'$':case'_':case'\u200C':case'\u200D':break;default:if(!util.isIdContinueChar(u)){throw invalidIdentifier()}break;}buffer+=u;lexState='identifierName';},sign:function sign(){switch(c){case'.':buffer=read();lexState='decimalPointLeading';return;case'0':buffer=read();lexState='zero';return;case'1':case'2':case'3':case'4':case'5':case'6':case'7':case'8':case'9':buffer=read();lexState='decimalInteger';return;case'I':read();literal('nfinity');return newToken('numeric',_sign*Infinity);case'N':read();literal('aN');return newToken('numeric',NaN);}throw invalidChar(read())},zero:function zero(){switch(c){case'.':buffer+=read();lexState='decimalPoint';return;case'e':case'E':buffer+=read();lexState='decimalExponent';return;case'x':case'X':buffer+=read();lexState='hexadecimal';return;}return newToken('numeric',_sign*0)},decimalInteger:function decimalInteger(){switch(c){case'.':buffer+=read();lexState='decimalPoint';return;case'e':case'E':buffer+=read();lexState='decimalExponent';return;}if(util.isDigit(c)){buffer+=read();return}return newToken('numeric',_sign*Number(buffer))},decimalPointLeading:function decimalPointLeading(){if(util.isDigit(c)){buffer+=read();lexState='decimalFraction';return}throw invalidChar(read())},decimalPoint:function decimalPoint(){switch(c){case'e':case'E':buffer+=read();lexState='decimalExponent';return;}if(util.isDigit(c)){buffer+=read();lexState='decimalFraction';return}return newToken('numeric',_sign*Number(buffer))},decimalFraction:function decimalFraction(){switch(c){case'e':case'E':buffer+=read();lexState='decimalExponent';return;}if(util.isDigit(c)){buffer+=read();return}return newToken('numeric',_sign*Number(buffer))},decimalExponent:function decimalExponent(){switch(c){case'+':case'-':buffer+=read();lexState='decimalExponentSign';return;}if(util.isDigit(c)){buffer+=read();lexState='decimalExponentInteger';return}throw invalidChar(read())},decimalExponentSign:function decimalExponentSign(){if(util.isDigit(c)){buffer+=read();lexState='decimalExponentInteger';return}throw invalidChar(read())},decimalExponentInteger:function decimalExponentInteger(){if(util.isDigit(c)){buffer+=read();return}return newToken('numeric',_sign*Number(buffer))},hexadecimal:function hexadecimal(){if(util.isHexDigit(c)){buffer+=read();lexState='hexadecimalInteger';return}throw invalidChar(read())},hexadecimalInteger:function hexadecimalInteger(){if(util.isHexDigit(c)){buffer+=read();return}return newToken('numeric',_sign*Number(buffer))},string:function string(){switch(c){case'\\':read();buffer+=escape();return;case'"':if(doubleQuote){read();return newToken('string',buffer)}buffer+=read();return;case'\'':if(!doubleQuote){read();return newToken('string',buffer)}buffer+=read();return;case'\n':case'\r':throw invalidChar(read());case'\u2028':case'\u2029':separatorChar(c);break;case undefined:throw invalidChar(read());}buffer+=read();},start:function start(){switch(c){case'{':case'[':return newToken('punctuator',read());}lexState='value';},beforePropertyName:function beforePropertyName(){switch(c){case'$':case'_':buffer=read();lexState='identifierName';return;case'\\':read();lexState='identifierNameStartEscape';return;case'}':return newToken('punctuator',read());case'"':case'\'':doubleQuote=read()==='"';lexState='string';return;}if(util.isIdStartChar(c)){buffer+=read();lexState='identifierName';return}throw invalidChar(read())},afterPropertyName:function afterPropertyName(){if(c===':'){return newToken('punctuator',read())}throw invalidChar(read())},beforePropertyValue:function beforePropertyValue(){lexState='value';},afterPropertyValue:function afterPropertyValue(){switch(c){case',':case'}':return newToken('punctuator',read());}throw invalidChar(read())},beforeArrayValue:function beforeArrayValue(){if(c===']'){return newToken('punctuator',read())}lexState='value';},afterArrayValue:function afterArrayValue(){switch(c){case',':case']':return newToken('punctuator',read());}throw invalidChar(read())},end:function end(){throw invalidChar(read())}};function newToken(type,value){return {type:type,value:value,line:line,column:column}}function literal(s){var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=s[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _c=_step.value;var p=peek();if(p!==_c){throw invalidChar(read())}read();}}catch(err){_didIteratorError=true;_iteratorError=err;}finally{try{if(!_iteratorNormalCompletion&&_iterator.return){_iterator.return();}}finally{if(_didIteratorError){throw _iteratorError}}}}function escape(){var c=peek();switch(c){case'b':read();return '\b';case'f':read();return '\f';case'n':read();return '\n';case'r':read();return '\r';case't':read();return '\t';case'v':read();return '\x0B';case'0':read();if(util.isDigit(peek())){throw invalidChar(read())}return '\0';case'x':read();return hexEscape();case'u':read();return unicodeEscape();case'\n':case'\u2028':case'\u2029':read();return '';case'\r':read();if(peek()==='\n'){read();}return '';case'1':case'2':case'3':case'4':case'5':case'6':case'7':case'8':case'9':throw invalidChar(read());case undefined:throw invalidChar(read());}return read()}function hexEscape(){var buffer='';var c=peek();if(!util.isHexDigit(c)){throw invalidChar(read())}buffer+=read();c=peek();if(!util.isHexDigit(c)){throw invalidChar(read())}buffer+=read();return String.fromCodePoint(parseInt(buffer,16))}function unicodeEscape(){var buffer='';var count=4;while(count-->0){var _c2=peek();if(!util.isHexDigit(_c2)){throw invalidChar(read())}buffer+=read();}return String.fromCodePoint(parseInt(buffer,16))}var parseStates={start:function start(){if(token.type==='eof'){throw invalidEOF()}push();},beforePropertyName:function beforePropertyName(){switch(token.type){case'identifier':case'string':key=token.value;parseState='afterPropertyName';return;case'punctuator':pop();return;case'eof':throw invalidEOF();}},afterPropertyName:function afterPropertyName(){if(token.type==='eof'){throw invalidEOF()}parseState='beforePropertyValue';},beforePropertyValue:function beforePropertyValue(){if(token.type==='eof'){throw invalidEOF()}push();},beforeArrayValue:function beforeArrayValue(){if(token.type==='eof'){throw invalidEOF()}if(token.type==='punctuator'&&token.value===']'){pop();return}push();},afterPropertyValue:function afterPropertyValue(){if(token.type==='eof'){throw invalidEOF()}switch(token.value){case',':parseState='beforePropertyName';return;case'}':pop();}},afterArrayValue:function afterArrayValue(){if(token.type==='eof'){throw invalidEOF()}switch(token.value){case',':parseState='beforeArrayValue';return;case']':pop();}},end:function end(){}};function push(){var value=void 0;switch(token.type){case'punctuator':switch(token.value){case'{':value={};break;case'[':value=[];break;}break;case'null':case'boolean':case'numeric':case'string':value=token.value;break;}if(root===undefined){root=value;}else {var parent=stack[stack.length-1];if(Array.isArray(parent)){parent.push(value);}else {parent[key]=value;}}if(value!==null&&(typeof value==='undefined'?'undefined':_typeof(value))==='object'){stack.push(value);if(Array.isArray(value)){parseState='beforeArrayValue';}else {parseState='beforePropertyName';}}else {var current=stack[stack.length-1];if(current==null){parseState='end';}else if(Array.isArray(current)){parseState='afterArrayValue';}else {parseState='afterPropertyValue';}}}function pop(){stack.pop();var current=stack[stack.length-1];if(current==null){parseState='end';}else if(Array.isArray(current)){parseState='afterArrayValue';}else {parseState='afterPropertyValue';}}function invalidChar(c){if(c===undefined){return syntaxError('JSON5: invalid end of input at '+line+':'+column)}return syntaxError('JSON5: invalid character \''+formatChar(c)+'\' at '+line+':'+column)}function invalidEOF(){return syntaxError('JSON5: invalid end of input at '+line+':'+column)}function invalidIdentifier(){column-=5;return syntaxError('JSON5: invalid identifier character at '+line+':'+column)}function separatorChar(c){console.warn('JSON5: \''+c+'\' is not valid ECMAScript; consider escaping');}function formatChar(c){var replacements={'\'':'\\\'','"':'\\"','\\':'\\\\','\b':'\\b','\f':'\\f','\n':'\\n','\r':'\\r','\t':'\\t','\x0B':'\\v','\0':'\\0','\u2028':'\\u2028','\u2029':'\\u2029'};if(replacements[c]){return replacements[c]}if(c<' '){var hexString=c.charCodeAt(0).toString(16);return '\\x'+('00'+hexString).substring(hexString.length)}return c}function syntaxError(message){var err=new SyntaxError(message);err.lineNumber=line;err.columnNumber=column;return err}module.exports=exports['default'];
  9021. });
  9022. var stringify_1 = createCommonjsModule(function (module, exports) {
  9023. Object.defineProperty(exports,'__esModule',{value:true});var _typeof=typeof Symbol==='function'&&typeof Symbol.iterator==='symbol'?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==='function'&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj};exports.default=stringify;var util=_interopRequireWildcard(util$1);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else {var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj}}function stringify(value,replacer,space){var stack=[];var indent='';var propertyList=void 0;var replacerFunc=void 0;var gap='';var quote=void 0;if(replacer!=null&&(typeof replacer==='undefined'?'undefined':_typeof(replacer))==='object'&&!Array.isArray(replacer)){space=replacer.space;quote=replacer.quote;replacer=replacer.replacer;}if(typeof replacer==='function'){replacerFunc=replacer;}else if(Array.isArray(replacer)){propertyList=[];var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=replacer[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var v=_step.value;var item=void 0;if(typeof v==='string'){item=v;}else if(typeof v==='number'||v instanceof String||v instanceof Number){item=String(v);}if(item!==undefined&&propertyList.indexOf(item)<0){propertyList.push(item);}}}catch(err){_didIteratorError=true;_iteratorError=err;}finally{try{if(!_iteratorNormalCompletion&&_iterator.return){_iterator.return();}}finally{if(_didIteratorError){throw _iteratorError}}}}if(space instanceof Number){space=Number(space);}else if(space instanceof String){space=String(space);}if(typeof space==='number'){if(space>0){space=Math.min(10,Math.floor(space));gap=' '.substr(0,space);}}else if(typeof space==='string'){gap=space.substr(0,10);}return serializeProperty('',{'':value});function serializeProperty(key,holder){var value=holder[key];if(value!=null){if(typeof value.toJSON5==='function'){value=value.toJSON5(key);}else if(typeof value.toJSON==='function'){value=value.toJSON(key);}}if(replacerFunc){value=replacerFunc.call(holder,key,value);}if(value instanceof Number){value=Number(value);}else if(value instanceof String){value=String(value);}else if(value instanceof Boolean){value=value.valueOf();}switch(value){case null:return 'null';case true:return 'true';case false:return 'false';}if(typeof value==='string'){return quoteString(value)}if(typeof value==='number'){return String(value)}if((typeof value==='undefined'?'undefined':_typeof(value))==='object'){return Array.isArray(value)?serializeArray(value):serializeObject(value)}return undefined}function quoteString(value){var quotes={'\'':0.1,'"':0.2};var replacements={'\'':'\\\'','"':'\\"','\\':'\\\\','\b':'\\b','\f':'\\f','\n':'\\n','\r':'\\r','\t':'\\t','\x0B':'\\v','\0':'\\0','\u2028':'\\u2028','\u2029':'\\u2029'};var product='';var _iteratorNormalCompletion2=true;var _didIteratorError2=false;var _iteratorError2=undefined;try{for(var _iterator2=value[Symbol.iterator](),_step2;!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=true){var c=_step2.value;switch(c){case'\'':case'"':quotes[c]++;product+=c;continue;}if(replacements[c]){product+=replacements[c];continue}if(c<' '){var hexString=c.charCodeAt(0).toString(16);product+='\\x'+('00'+hexString).substring(hexString.length);continue}product+=c;}}catch(err){_didIteratorError2=true;_iteratorError2=err;}finally{try{if(!_iteratorNormalCompletion2&&_iterator2.return){_iterator2.return();}}finally{if(_didIteratorError2){throw _iteratorError2}}}var quoteChar=quote||Object.keys(quotes).reduce(function(a,b){return quotes[a]<quotes[b]?a:b});product=product.replace(new RegExp(quoteChar,'g'),replacements[quoteChar]);return quoteChar+product+quoteChar}function serializeObject(value){if(stack.indexOf(value)>=0){throw TypeError('Converting circular structure to JSON5')}stack.push(value);var stepback=indent;indent=indent+gap;var keys=propertyList||Object.keys(value);var partial=[];var _iteratorNormalCompletion3=true;var _didIteratorError3=false;var _iteratorError3=undefined;try{for(var _iterator3=keys[Symbol.iterator](),_step3;!(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done);_iteratorNormalCompletion3=true){var key=_step3.value;var propertyString=serializeProperty(key,value);if(propertyString!==undefined){var member=serializeKey(key)+':';if(gap!==''){member+=' ';}member+=propertyString;partial.push(member);}}}catch(err){_didIteratorError3=true;_iteratorError3=err;}finally{try{if(!_iteratorNormalCompletion3&&_iterator3.return){_iterator3.return();}}finally{if(_didIteratorError3){throw _iteratorError3}}}var final=void 0;if(partial.length===0){final='{}';}else {var properties=void 0;if(gap===''){properties=partial.join(',');final='{'+properties+'}';}else {var separator=',\n'+indent;properties=partial.join(separator);final='{\n'+indent+properties+',\n'+stepback+'}';}}stack.pop();indent=stepback;return final}function serializeKey(key){if(key.length===0){return quoteString(key)}var firstChar=String.fromCodePoint(key.codePointAt(0));if(!util.isIdStartChar(firstChar)){return quoteString(key)}for(var i=firstChar.length;i<key.length;i++){if(!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))){return quoteString(key)}}return key}function serializeArray(value){if(stack.indexOf(value)>=0){throw TypeError('Converting circular structure to JSON5')}stack.push(value);var stepback=indent;indent=indent+gap;var partial=[];for(var i=0;i<value.length;i++){var propertyString=serializeProperty(String(i),value);partial.push(propertyString!==undefined?propertyString:'null');}var final=void 0;if(partial.length===0){final='[]';}else {if(gap===''){var properties=partial.join(',');final='['+properties+']';}else {var separator=',\n'+indent;var _properties=partial.join(separator);final='[\n'+indent+_properties+',\n'+stepback+']';}}stack.pop();indent=stepback;return final}}module.exports=exports['default'];
  9024. });
  9025. var lib = createCommonjsModule(function (module, exports) {
  9026. Object.defineProperty(exports,'__esModule',{value:true});var _parse2=_interopRequireDefault(parse_1);var _stringify2=_interopRequireDefault(stringify_1);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={parse:_parse2.default,stringify:_stringify2.default};module.exports=exports['default'];
  9027. });
  9028. const specialValues = {
  9029. null: null,
  9030. true: true,
  9031. false: false,
  9032. };
  9033. function parseQuery(query) {
  9034. if (query.substr(0, 1) !== '?') {
  9035. throw new Error(
  9036. "A valid query string passed to parseQuery should begin with '?'"
  9037. );
  9038. }
  9039. query = query.substr(1);
  9040. if (!query) {
  9041. return {};
  9042. }
  9043. if (query.substr(0, 1) === '{' && query.substr(-1) === '}') {
  9044. return lib.parse(query);
  9045. }
  9046. const queryArgs = query.split(/[,&]/g);
  9047. const result = {};
  9048. queryArgs.forEach((arg) => {
  9049. const idx = arg.indexOf('=');
  9050. if (idx >= 0) {
  9051. let name = arg.substr(0, idx);
  9052. let value = decodeURIComponent(arg.substr(idx + 1));
  9053. if (specialValues.hasOwnProperty(value)) {
  9054. value = specialValues[value];
  9055. }
  9056. if (name.substr(-2) === '[]') {
  9057. name = decodeURIComponent(name.substr(0, name.length - 2));
  9058. if (!Array.isArray(result[name])) {
  9059. result[name] = [];
  9060. }
  9061. result[name].push(value);
  9062. } else {
  9063. name = decodeURIComponent(name);
  9064. result[name] = value;
  9065. }
  9066. } else {
  9067. if (arg.substr(0, 1) === '-') {
  9068. result[decodeURIComponent(arg.substr(1))] = false;
  9069. } else if (arg.substr(0, 1) === '+') {
  9070. result[decodeURIComponent(arg.substr(1))] = true;
  9071. } else {
  9072. result[decodeURIComponent(arg)] = true;
  9073. }
  9074. }
  9075. });
  9076. return result;
  9077. }
  9078. var parseQuery_1 = parseQuery;
  9079. function getOptions(loaderContext) {
  9080. const query = loaderContext.query;
  9081. if (typeof query === 'string' && query !== '') {
  9082. return parseQuery_1(loaderContext.query);
  9083. }
  9084. if (!query || typeof query !== 'object') {
  9085. // Not object-like queries are not supported.
  9086. return null;
  9087. }
  9088. return query;
  9089. }
  9090. var getOptions_1 = getOptions;
  9091. const matchRelativePath = /^\.\.?[/\\]/;
  9092. function isAbsolutePath(str) {
  9093. return path__default.posix.isAbsolute(str) || path__default.win32.isAbsolute(str);
  9094. }
  9095. function isRelativePath(str) {
  9096. return matchRelativePath.test(str);
  9097. }
  9098. function stringifyRequest(loaderContext, request) {
  9099. const splitted = request.split('!');
  9100. const context =
  9101. loaderContext.context ||
  9102. (loaderContext.options && loaderContext.options.context);
  9103. return JSON.stringify(
  9104. splitted
  9105. .map((part) => {
  9106. // First, separate singlePath from query, because the query might contain paths again
  9107. const splittedPart = part.match(/^(.*?)(\?.*)/);
  9108. const query = splittedPart ? splittedPart[2] : '';
  9109. let singlePath = splittedPart ? splittedPart[1] : part;
  9110. if (isAbsolutePath(singlePath) && context) {
  9111. singlePath = path__default.relative(context, singlePath);
  9112. if (isAbsolutePath(singlePath)) {
  9113. // If singlePath still matches an absolute path, singlePath was on a different drive than context.
  9114. // In this case, we leave the path platform-specific without replacing any separators.
  9115. // @see https://github.com/webpack/loader-utils/pull/14
  9116. return singlePath + query;
  9117. }
  9118. if (isRelativePath(singlePath) === false) {
  9119. // Ensure that the relative path starts at least with ./ otherwise it would be a request into the modules directory (like node_modules).
  9120. singlePath = './' + singlePath;
  9121. }
  9122. }
  9123. return singlePath.replace(/\\/g, '/') + query;
  9124. })
  9125. .join('!')
  9126. );
  9127. }
  9128. var stringifyRequest_1 = stringifyRequest;
  9129. function getRemainingRequest(loaderContext) {
  9130. if (loaderContext.remainingRequest) {
  9131. return loaderContext.remainingRequest;
  9132. }
  9133. const request = loaderContext.loaders
  9134. .slice(loaderContext.loaderIndex + 1)
  9135. .map((obj) => obj.request)
  9136. .concat([loaderContext.resource]);
  9137. return request.join('!');
  9138. }
  9139. var getRemainingRequest_1 = getRemainingRequest;
  9140. function getCurrentRequest(loaderContext) {
  9141. if (loaderContext.currentRequest) {
  9142. return loaderContext.currentRequest;
  9143. }
  9144. const request = loaderContext.loaders
  9145. .slice(loaderContext.loaderIndex)
  9146. .map((obj) => obj.request)
  9147. .concat([loaderContext.resource]);
  9148. return request.join('!');
  9149. }
  9150. var getCurrentRequest_1 = getCurrentRequest;
  9151. function isUrlRequest(url, root) {
  9152. // An URL is not an request if
  9153. // 1. It's an absolute url and it is not `windows` path like `C:\dir\file`
  9154. if (/^[a-z][a-z0-9+.-]*:/i.test(url) && !path__default.win32.isAbsolute(url)) {
  9155. return false;
  9156. }
  9157. // 2. It's a protocol-relative
  9158. if (/^\/\//.test(url)) {
  9159. return false;
  9160. }
  9161. // 3. It's some kind of url for a template
  9162. if (/^[{}[\]#*;,'§$%&(=?`´^°<>]/.test(url)) {
  9163. return false;
  9164. }
  9165. // 4. It's also not an request if root isn't set and it's a root-relative url
  9166. if ((root === undefined || root === false) && /^\//.test(url)) {
  9167. return false;
  9168. }
  9169. return true;
  9170. }
  9171. var isUrlRequest_1 = isUrlRequest;
  9172. // we can't use path.win32.isAbsolute because it also matches paths starting with a forward slash
  9173. const matchNativeWin32Path = /^[A-Z]:[/\\]|^\\\\/i;
  9174. function urlToRequest(url, root) {
  9175. // Do not rewrite an empty url
  9176. if (url === '') {
  9177. return '';
  9178. }
  9179. const moduleRequestRegex = /^[^?]*~/;
  9180. let request;
  9181. if (matchNativeWin32Path.test(url)) {
  9182. // absolute windows path, keep it
  9183. request = url;
  9184. } else if (root !== undefined && root !== false && /^\//.test(url)) {
  9185. // if root is set and the url is root-relative
  9186. switch (typeof root) {
  9187. // 1. root is a string: root is prefixed to the url
  9188. case 'string':
  9189. // special case: `~` roots convert to module request
  9190. if (moduleRequestRegex.test(root)) {
  9191. request = root.replace(/([^~/])$/, '$1/') + url.slice(1);
  9192. } else {
  9193. request = root + url;
  9194. }
  9195. break;
  9196. // 2. root is `true`: absolute paths are allowed
  9197. // *nix only, windows-style absolute paths are always allowed as they doesn't start with a `/`
  9198. case 'boolean':
  9199. request = url;
  9200. break;
  9201. default:
  9202. throw new Error(
  9203. "Unexpected parameters to loader-utils 'urlToRequest': url = " +
  9204. url +
  9205. ', root = ' +
  9206. root +
  9207. '.'
  9208. );
  9209. }
  9210. } else if (/^\.\.?\//.test(url)) {
  9211. // A relative url stays
  9212. request = url;
  9213. } else {
  9214. // every other url is threaded like a relative url
  9215. request = './' + url;
  9216. }
  9217. // A `~` makes the url an module
  9218. if (moduleRequestRegex.test(request)) {
  9219. request = request.replace(moduleRequestRegex, '');
  9220. }
  9221. return request;
  9222. }
  9223. var urlToRequest_1 = urlToRequest;
  9224. function parseString(str) {
  9225. try {
  9226. if (str[0] === '"') {
  9227. return JSON.parse(str);
  9228. }
  9229. if (str[0] === "'" && str.substr(str.length - 1) === "'") {
  9230. return parseString(
  9231. str
  9232. .replace(/\\.|"/g, (x) => (x === '"' ? '\\"' : x))
  9233. .replace(/^'|'$/g, '"')
  9234. );
  9235. }
  9236. return JSON.parse('"' + str + '"');
  9237. } catch (e) {
  9238. return str;
  9239. }
  9240. }
  9241. var parseString_1 = parseString;
  9242. /*
  9243. * big.js v5.2.2
  9244. * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
  9245. * Copyright (c) 2018 Michael Mclaughlin <M8ch88l@gmail.com>
  9246. * https://github.com/MikeMcl/big.js/LICENCE
  9247. */
  9248. /************************************** EDITABLE DEFAULTS *****************************************/
  9249. // The default values below must be integers within the stated ranges.
  9250. /*
  9251. * The maximum number of decimal places (DP) of the results of operations involving division:
  9252. * div and sqrt, and pow with negative exponents.
  9253. */
  9254. var DP = 20, // 0 to MAX_DP
  9255. /*
  9256. * The rounding mode (RM) used when rounding to the above decimal places.
  9257. *
  9258. * 0 Towards zero (i.e. truncate, no rounding). (ROUND_DOWN)
  9259. * 1 To nearest neighbour. If equidistant, round up. (ROUND_HALF_UP)
  9260. * 2 To nearest neighbour. If equidistant, to even. (ROUND_HALF_EVEN)
  9261. * 3 Away from zero. (ROUND_UP)
  9262. */
  9263. RM = 1, // 0, 1, 2 or 3
  9264. // The maximum value of DP and Big.DP.
  9265. MAX_DP = 1E6, // 0 to 1000000
  9266. // The maximum magnitude of the exponent argument to the pow method.
  9267. MAX_POWER = 1E6, // 1 to 1000000
  9268. /*
  9269. * The negative exponent (NE) at and beneath which toString returns exponential notation.
  9270. * (JavaScript numbers: -7)
  9271. * -1000000 is the minimum recommended exponent value of a Big.
  9272. */
  9273. NE = -7, // 0 to -1000000
  9274. /*
  9275. * The positive exponent (PE) at and above which toString returns exponential notation.
  9276. * (JavaScript numbers: 21)
  9277. * 1000000 is the maximum recommended exponent value of a Big.
  9278. * (This limit is not enforced or checked.)
  9279. */
  9280. PE = 21, // 0 to 1000000
  9281. /**************************************************************************************************/
  9282. // Error messages.
  9283. NAME = '[big.js] ',
  9284. INVALID = NAME + 'Invalid ',
  9285. INVALID_DP = INVALID + 'decimal places',
  9286. INVALID_RM = INVALID + 'rounding mode',
  9287. DIV_BY_ZERO = NAME + 'Division by zero',
  9288. // The shared prototype object.
  9289. P = {},
  9290. UNDEFINED = void 0,
  9291. NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
  9292. /*
  9293. * Create and return a Big constructor.
  9294. *
  9295. */
  9296. function _Big_() {
  9297. /*
  9298. * The Big constructor and exported function.
  9299. * Create and return a new instance of a Big number object.
  9300. *
  9301. * n {number|string|Big} A numeric value.
  9302. */
  9303. function Big(n) {
  9304. var x = this;
  9305. // Enable constructor usage without new.
  9306. if (!(x instanceof Big)) return n === UNDEFINED ? _Big_() : new Big(n);
  9307. // Duplicate.
  9308. if (n instanceof Big) {
  9309. x.s = n.s;
  9310. x.e = n.e;
  9311. x.c = n.c.slice();
  9312. } else {
  9313. parse$1(x, n);
  9314. }
  9315. /*
  9316. * Retain a reference to this Big constructor, and shadow Big.prototype.constructor which
  9317. * points to Object.
  9318. */
  9319. x.constructor = Big;
  9320. }
  9321. Big.prototype = P;
  9322. Big.DP = DP;
  9323. Big.RM = RM;
  9324. Big.NE = NE;
  9325. Big.PE = PE;
  9326. Big.version = '5.2.2';
  9327. return Big;
  9328. }
  9329. /*
  9330. * Parse the number or string value passed to a Big constructor.
  9331. *
  9332. * x {Big} A Big number instance.
  9333. * n {number|string} A numeric value.
  9334. */
  9335. function parse$1(x, n) {
  9336. var e, i, nl;
  9337. // Minus zero?
  9338. if (n === 0 && 1 / n < 0) n = '-0';
  9339. else if (!NUMERIC.test(n += '')) throw Error(INVALID + 'number');
  9340. // Determine sign.
  9341. x.s = n.charAt(0) == '-' ? (n = n.slice(1), -1) : 1;
  9342. // Decimal point?
  9343. if ((e = n.indexOf('.')) > -1) n = n.replace('.', '');
  9344. // Exponential form?
  9345. if ((i = n.search(/e/i)) > 0) {
  9346. // Determine exponent.
  9347. if (e < 0) e = i;
  9348. e += +n.slice(i + 1);
  9349. n = n.substring(0, i);
  9350. } else if (e < 0) {
  9351. // Integer.
  9352. e = n.length;
  9353. }
  9354. nl = n.length;
  9355. // Determine leading zeros.
  9356. for (i = 0; i < nl && n.charAt(i) == '0';) ++i;
  9357. if (i == nl) {
  9358. // Zero.
  9359. x.c = [x.e = 0];
  9360. } else {
  9361. // Determine trailing zeros.
  9362. for (; nl > 0 && n.charAt(--nl) == '0';);
  9363. x.e = e - i - 1;
  9364. x.c = [];
  9365. // Convert string to array of digits without leading/trailing zeros.
  9366. for (e = 0; i <= nl;) x.c[e++] = +n.charAt(i++);
  9367. }
  9368. return x;
  9369. }
  9370. /*
  9371. * Round Big x to a maximum of dp decimal places using rounding mode rm.
  9372. * Called by stringify, P.div, P.round and P.sqrt.
  9373. *
  9374. * x {Big} The Big to round.
  9375. * dp {number} Integer, 0 to MAX_DP inclusive.
  9376. * rm {number} 0, 1, 2 or 3 (DOWN, HALF_UP, HALF_EVEN, UP)
  9377. * [more] {boolean} Whether the result of division was truncated.
  9378. */
  9379. function round(x, dp, rm, more) {
  9380. var xc = x.c,
  9381. i = x.e + dp + 1;
  9382. if (i < xc.length) {
  9383. if (rm === 1) {
  9384. // xc[i] is the digit after the digit that may be rounded up.
  9385. more = xc[i] >= 5;
  9386. } else if (rm === 2) {
  9387. more = xc[i] > 5 || xc[i] == 5 &&
  9388. (more || i < 0 || xc[i + 1] !== UNDEFINED || xc[i - 1] & 1);
  9389. } else if (rm === 3) {
  9390. more = more || !!xc[0];
  9391. } else {
  9392. more = false;
  9393. if (rm !== 0) throw Error(INVALID_RM);
  9394. }
  9395. if (i < 1) {
  9396. xc.length = 1;
  9397. if (more) {
  9398. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  9399. x.e = -dp;
  9400. xc[0] = 1;
  9401. } else {
  9402. // Zero.
  9403. xc[0] = x.e = 0;
  9404. }
  9405. } else {
  9406. // Remove any digits after the required decimal places.
  9407. xc.length = i--;
  9408. // Round up?
  9409. if (more) {
  9410. // Rounding up may mean the previous digit has to be rounded up.
  9411. for (; ++xc[i] > 9;) {
  9412. xc[i] = 0;
  9413. if (!i--) {
  9414. ++x.e;
  9415. xc.unshift(1);
  9416. }
  9417. }
  9418. }
  9419. // Remove trailing zeros.
  9420. for (i = xc.length; !xc[--i];) xc.pop();
  9421. }
  9422. } else if (rm < 0 || rm > 3 || rm !== ~~rm) {
  9423. throw Error(INVALID_RM);
  9424. }
  9425. return x;
  9426. }
  9427. /*
  9428. * Return a string representing the value of Big x in normal or exponential notation.
  9429. * Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf.
  9430. *
  9431. * x {Big}
  9432. * id? {number} Caller id.
  9433. * 1 toExponential
  9434. * 2 toFixed
  9435. * 3 toPrecision
  9436. * 4 valueOf
  9437. * n? {number|undefined} Caller's argument.
  9438. * k? {number|undefined}
  9439. */
  9440. function stringify(x, id, n, k) {
  9441. var e, s,
  9442. Big = x.constructor,
  9443. z = !x.c[0];
  9444. if (n !== UNDEFINED) {
  9445. if (n !== ~~n || n < (id == 3) || n > MAX_DP) {
  9446. throw Error(id == 3 ? INVALID + 'precision' : INVALID_DP);
  9447. }
  9448. x = new Big(x);
  9449. // The index of the digit that may be rounded up.
  9450. n = k - x.e;
  9451. // Round?
  9452. if (x.c.length > ++k) round(x, n, Big.RM);
  9453. // toFixed: recalculate k as x.e may have changed if value rounded up.
  9454. if (id == 2) k = x.e + n + 1;
  9455. // Append zeros?
  9456. for (; x.c.length < k;) x.c.push(0);
  9457. }
  9458. e = x.e;
  9459. s = x.c.join('');
  9460. n = s.length;
  9461. // Exponential notation?
  9462. if (id != 2 && (id == 1 || id == 3 && k <= e || e <= Big.NE || e >= Big.PE)) {
  9463. s = s.charAt(0) + (n > 1 ? '.' + s.slice(1) : '') + (e < 0 ? 'e' : 'e+') + e;
  9464. // Normal notation.
  9465. } else if (e < 0) {
  9466. for (; ++e;) s = '0' + s;
  9467. s = '0.' + s;
  9468. } else if (e > 0) {
  9469. if (++e > n) for (e -= n; e--;) s += '0';
  9470. else if (e < n) s = s.slice(0, e) + '.' + s.slice(e);
  9471. } else if (n > 1) {
  9472. s = s.charAt(0) + '.' + s.slice(1);
  9473. }
  9474. return x.s < 0 && (!z || id == 4) ? '-' + s : s;
  9475. }
  9476. // Prototype/instance methods
  9477. /*
  9478. * Return a new Big whose value is the absolute value of this Big.
  9479. */
  9480. P.abs = function () {
  9481. var x = new this.constructor(this);
  9482. x.s = 1;
  9483. return x;
  9484. };
  9485. /*
  9486. * Return 1 if the value of this Big is greater than the value of Big y,
  9487. * -1 if the value of this Big is less than the value of Big y, or
  9488. * 0 if they have the same value.
  9489. */
  9490. P.cmp = function (y) {
  9491. var isneg,
  9492. x = this,
  9493. xc = x.c,
  9494. yc = (y = new x.constructor(y)).c,
  9495. i = x.s,
  9496. j = y.s,
  9497. k = x.e,
  9498. l = y.e;
  9499. // Either zero?
  9500. if (!xc[0] || !yc[0]) return !xc[0] ? !yc[0] ? 0 : -j : i;
  9501. // Signs differ?
  9502. if (i != j) return i;
  9503. isneg = i < 0;
  9504. // Compare exponents.
  9505. if (k != l) return k > l ^ isneg ? 1 : -1;
  9506. j = (k = xc.length) < (l = yc.length) ? k : l;
  9507. // Compare digit by digit.
  9508. for (i = -1; ++i < j;) {
  9509. if (xc[i] != yc[i]) return xc[i] > yc[i] ^ isneg ? 1 : -1;
  9510. }
  9511. // Compare lengths.
  9512. return k == l ? 0 : k > l ^ isneg ? 1 : -1;
  9513. };
  9514. /*
  9515. * Return a new Big whose value is the value of this Big divided by the value of Big y, rounded,
  9516. * if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
  9517. */
  9518. P.div = function (y) {
  9519. var x = this,
  9520. Big = x.constructor,
  9521. a = x.c, // dividend
  9522. b = (y = new Big(y)).c, // divisor
  9523. k = x.s == y.s ? 1 : -1,
  9524. dp = Big.DP;
  9525. if (dp !== ~~dp || dp < 0 || dp > MAX_DP) throw Error(INVALID_DP);
  9526. // Divisor is zero?
  9527. if (!b[0]) throw Error(DIV_BY_ZERO);
  9528. // Dividend is 0? Return +-0.
  9529. if (!a[0]) return new Big(k * 0);
  9530. var bl, bt, n, cmp, ri,
  9531. bz = b.slice(),
  9532. ai = bl = b.length,
  9533. al = a.length,
  9534. r = a.slice(0, bl), // remainder
  9535. rl = r.length,
  9536. q = y, // quotient
  9537. qc = q.c = [],
  9538. qi = 0,
  9539. d = dp + (q.e = x.e - y.e) + 1; // number of digits of the result
  9540. q.s = k;
  9541. k = d < 0 ? 0 : d;
  9542. // Create version of divisor with leading zero.
  9543. bz.unshift(0);
  9544. // Add zeros to make remainder as long as divisor.
  9545. for (; rl++ < bl;) r.push(0);
  9546. do {
  9547. // n is how many times the divisor goes into current remainder.
  9548. for (n = 0; n < 10; n++) {
  9549. // Compare divisor and remainder.
  9550. if (bl != (rl = r.length)) {
  9551. cmp = bl > rl ? 1 : -1;
  9552. } else {
  9553. for (ri = -1, cmp = 0; ++ri < bl;) {
  9554. if (b[ri] != r[ri]) {
  9555. cmp = b[ri] > r[ri] ? 1 : -1;
  9556. break;
  9557. }
  9558. }
  9559. }
  9560. // If divisor < remainder, subtract divisor from remainder.
  9561. if (cmp < 0) {
  9562. // Remainder can't be more than 1 digit longer than divisor.
  9563. // Equalise lengths using divisor with extra leading zero?
  9564. for (bt = rl == bl ? b : bz; rl;) {
  9565. if (r[--rl] < bt[rl]) {
  9566. ri = rl;
  9567. for (; ri && !r[--ri];) r[ri] = 9;
  9568. --r[ri];
  9569. r[rl] += 10;
  9570. }
  9571. r[rl] -= bt[rl];
  9572. }
  9573. for (; !r[0];) r.shift();
  9574. } else {
  9575. break;
  9576. }
  9577. }
  9578. // Add the digit n to the result array.
  9579. qc[qi++] = cmp ? n : ++n;
  9580. // Update the remainder.
  9581. if (r[0] && cmp) r[rl] = a[ai] || 0;
  9582. else r = [a[ai]];
  9583. } while ((ai++ < al || r[0] !== UNDEFINED) && k--);
  9584. // Leading zero? Do not remove if result is simply zero (qi == 1).
  9585. if (!qc[0] && qi != 1) {
  9586. // There can't be more than one zero.
  9587. qc.shift();
  9588. q.e--;
  9589. }
  9590. // Round?
  9591. if (qi > d) round(q, dp, Big.RM, r[0] !== UNDEFINED);
  9592. return q;
  9593. };
  9594. /*
  9595. * Return true if the value of this Big is equal to the value of Big y, otherwise return false.
  9596. */
  9597. P.eq = function (y) {
  9598. return !this.cmp(y);
  9599. };
  9600. /*
  9601. * Return true if the value of this Big is greater than the value of Big y, otherwise return
  9602. * false.
  9603. */
  9604. P.gt = function (y) {
  9605. return this.cmp(y) > 0;
  9606. };
  9607. /*
  9608. * Return true if the value of this Big is greater than or equal to the value of Big y, otherwise
  9609. * return false.
  9610. */
  9611. P.gte = function (y) {
  9612. return this.cmp(y) > -1;
  9613. };
  9614. /*
  9615. * Return true if the value of this Big is less than the value of Big y, otherwise return false.
  9616. */
  9617. P.lt = function (y) {
  9618. return this.cmp(y) < 0;
  9619. };
  9620. /*
  9621. * Return true if the value of this Big is less than or equal to the value of Big y, otherwise
  9622. * return false.
  9623. */
  9624. P.lte = function (y) {
  9625. return this.cmp(y) < 1;
  9626. };
  9627. /*
  9628. * Return a new Big whose value is the value of this Big minus the value of Big y.
  9629. */
  9630. P.minus = P.sub = function (y) {
  9631. var i, j, t, xlty,
  9632. x = this,
  9633. Big = x.constructor,
  9634. a = x.s,
  9635. b = (y = new Big(y)).s;
  9636. // Signs differ?
  9637. if (a != b) {
  9638. y.s = -b;
  9639. return x.plus(y);
  9640. }
  9641. var xc = x.c.slice(),
  9642. xe = x.e,
  9643. yc = y.c,
  9644. ye = y.e;
  9645. // Either zero?
  9646. if (!xc[0] || !yc[0]) {
  9647. // y is non-zero? x is non-zero? Or both are zero.
  9648. return yc[0] ? (y.s = -b, y) : new Big(xc[0] ? x : 0);
  9649. }
  9650. // Determine which is the bigger number. Prepend zeros to equalise exponents.
  9651. if (a = xe - ye) {
  9652. if (xlty = a < 0) {
  9653. a = -a;
  9654. t = xc;
  9655. } else {
  9656. ye = xe;
  9657. t = yc;
  9658. }
  9659. t.reverse();
  9660. for (b = a; b--;) t.push(0);
  9661. t.reverse();
  9662. } else {
  9663. // Exponents equal. Check digit by digit.
  9664. j = ((xlty = xc.length < yc.length) ? xc : yc).length;
  9665. for (a = b = 0; b < j; b++) {
  9666. if (xc[b] != yc[b]) {
  9667. xlty = xc[b] < yc[b];
  9668. break;
  9669. }
  9670. }
  9671. }
  9672. // x < y? Point xc to the array of the bigger number.
  9673. if (xlty) {
  9674. t = xc;
  9675. xc = yc;
  9676. yc = t;
  9677. y.s = -y.s;
  9678. }
  9679. /*
  9680. * Append zeros to xc if shorter. No need to add zeros to yc if shorter as subtraction only
  9681. * needs to start at yc.length.
  9682. */
  9683. if ((b = (j = yc.length) - (i = xc.length)) > 0) for (; b--;) xc[i++] = 0;
  9684. // Subtract yc from xc.
  9685. for (b = i; j > a;) {
  9686. if (xc[--j] < yc[j]) {
  9687. for (i = j; i && !xc[--i];) xc[i] = 9;
  9688. --xc[i];
  9689. xc[j] += 10;
  9690. }
  9691. xc[j] -= yc[j];
  9692. }
  9693. // Remove trailing zeros.
  9694. for (; xc[--b] === 0;) xc.pop();
  9695. // Remove leading zeros and adjust exponent accordingly.
  9696. for (; xc[0] === 0;) {
  9697. xc.shift();
  9698. --ye;
  9699. }
  9700. if (!xc[0]) {
  9701. // n - n = +0
  9702. y.s = 1;
  9703. // Result must be zero.
  9704. xc = [ye = 0];
  9705. }
  9706. y.c = xc;
  9707. y.e = ye;
  9708. return y;
  9709. };
  9710. /*
  9711. * Return a new Big whose value is the value of this Big modulo the value of Big y.
  9712. */
  9713. P.mod = function (y) {
  9714. var ygtx,
  9715. x = this,
  9716. Big = x.constructor,
  9717. a = x.s,
  9718. b = (y = new Big(y)).s;
  9719. if (!y.c[0]) throw Error(DIV_BY_ZERO);
  9720. x.s = y.s = 1;
  9721. ygtx = y.cmp(x) == 1;
  9722. x.s = a;
  9723. y.s = b;
  9724. if (ygtx) return new Big(x);
  9725. a = Big.DP;
  9726. b = Big.RM;
  9727. Big.DP = Big.RM = 0;
  9728. x = x.div(y);
  9729. Big.DP = a;
  9730. Big.RM = b;
  9731. return this.minus(x.times(y));
  9732. };
  9733. /*
  9734. * Return a new Big whose value is the value of this Big plus the value of Big y.
  9735. */
  9736. P.plus = P.add = function (y) {
  9737. var t,
  9738. x = this,
  9739. Big = x.constructor,
  9740. a = x.s,
  9741. b = (y = new Big(y)).s;
  9742. // Signs differ?
  9743. if (a != b) {
  9744. y.s = -b;
  9745. return x.minus(y);
  9746. }
  9747. var xe = x.e,
  9748. xc = x.c,
  9749. ye = y.e,
  9750. yc = y.c;
  9751. // Either zero? y is non-zero? x is non-zero? Or both are zero.
  9752. if (!xc[0] || !yc[0]) return yc[0] ? y : new Big(xc[0] ? x : a * 0);
  9753. xc = xc.slice();
  9754. // Prepend zeros to equalise exponents.
  9755. // Note: reverse faster than unshifts.
  9756. if (a = xe - ye) {
  9757. if (a > 0) {
  9758. ye = xe;
  9759. t = yc;
  9760. } else {
  9761. a = -a;
  9762. t = xc;
  9763. }
  9764. t.reverse();
  9765. for (; a--;) t.push(0);
  9766. t.reverse();
  9767. }
  9768. // Point xc to the longer array.
  9769. if (xc.length - yc.length < 0) {
  9770. t = yc;
  9771. yc = xc;
  9772. xc = t;
  9773. }
  9774. a = yc.length;
  9775. // Only start adding at yc.length - 1 as the further digits of xc can be left as they are.
  9776. for (b = 0; a; xc[a] %= 10) b = (xc[--a] = xc[a] + yc[a] + b) / 10 | 0;
  9777. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  9778. if (b) {
  9779. xc.unshift(b);
  9780. ++ye;
  9781. }
  9782. // Remove trailing zeros.
  9783. for (a = xc.length; xc[--a] === 0;) xc.pop();
  9784. y.c = xc;
  9785. y.e = ye;
  9786. return y;
  9787. };
  9788. /*
  9789. * Return a Big whose value is the value of this Big raised to the power n.
  9790. * If n is negative, round to a maximum of Big.DP decimal places using rounding
  9791. * mode Big.RM.
  9792. *
  9793. * n {number} Integer, -MAX_POWER to MAX_POWER inclusive.
  9794. */
  9795. P.pow = function (n) {
  9796. var x = this,
  9797. one = new x.constructor(1),
  9798. y = one,
  9799. isneg = n < 0;
  9800. if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) throw Error(INVALID + 'exponent');
  9801. if (isneg) n = -n;
  9802. for (;;) {
  9803. if (n & 1) y = y.times(x);
  9804. n >>= 1;
  9805. if (!n) break;
  9806. x = x.times(x);
  9807. }
  9808. return isneg ? one.div(y) : y;
  9809. };
  9810. /*
  9811. * Return a new Big whose value is the value of this Big rounded using rounding mode rm
  9812. * to a maximum of dp decimal places, or, if dp is negative, to an integer which is a
  9813. * multiple of 10**-dp.
  9814. * If dp is not specified, round to 0 decimal places.
  9815. * If rm is not specified, use Big.RM.
  9816. *
  9817. * dp? {number} Integer, -MAX_DP to MAX_DP inclusive.
  9818. * rm? 0, 1, 2 or 3 (ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_UP)
  9819. */
  9820. P.round = function (dp, rm) {
  9821. var Big = this.constructor;
  9822. if (dp === UNDEFINED) dp = 0;
  9823. else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) throw Error(INVALID_DP);
  9824. return round(new Big(this), dp, rm === UNDEFINED ? Big.RM : rm);
  9825. };
  9826. /*
  9827. * Return a new Big whose value is the square root of the value of this Big, rounded, if
  9828. * necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
  9829. */
  9830. P.sqrt = function () {
  9831. var r, c, t,
  9832. x = this,
  9833. Big = x.constructor,
  9834. s = x.s,
  9835. e = x.e,
  9836. half = new Big(0.5);
  9837. // Zero?
  9838. if (!x.c[0]) return new Big(x);
  9839. // Negative?
  9840. if (s < 0) throw Error(NAME + 'No square root');
  9841. // Estimate.
  9842. s = Math.sqrt(x + '');
  9843. // Math.sqrt underflow/overflow?
  9844. // Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent.
  9845. if (s === 0 || s === 1 / 0) {
  9846. c = x.c.join('');
  9847. if (!(c.length + e & 1)) c += '0';
  9848. s = Math.sqrt(c);
  9849. e = ((e + 1) / 2 | 0) - (e < 0 || e & 1);
  9850. r = new Big((s == 1 / 0 ? '1e' : (s = s.toExponential()).slice(0, s.indexOf('e') + 1)) + e);
  9851. } else {
  9852. r = new Big(s);
  9853. }
  9854. e = r.e + (Big.DP += 4);
  9855. // Newton-Raphson iteration.
  9856. do {
  9857. t = r;
  9858. r = half.times(t.plus(x.div(t)));
  9859. } while (t.c.slice(0, e).join('') !== r.c.slice(0, e).join(''));
  9860. return round(r, Big.DP -= 4, Big.RM);
  9861. };
  9862. /*
  9863. * Return a new Big whose value is the value of this Big times the value of Big y.
  9864. */
  9865. P.times = P.mul = function (y) {
  9866. var c,
  9867. x = this,
  9868. Big = x.constructor,
  9869. xc = x.c,
  9870. yc = (y = new Big(y)).c,
  9871. a = xc.length,
  9872. b = yc.length,
  9873. i = x.e,
  9874. j = y.e;
  9875. // Determine sign of result.
  9876. y.s = x.s == y.s ? 1 : -1;
  9877. // Return signed 0 if either 0.
  9878. if (!xc[0] || !yc[0]) return new Big(y.s * 0);
  9879. // Initialise exponent of result as x.e + y.e.
  9880. y.e = i + j;
  9881. // If array xc has fewer digits than yc, swap xc and yc, and lengths.
  9882. if (a < b) {
  9883. c = xc;
  9884. xc = yc;
  9885. yc = c;
  9886. j = a;
  9887. a = b;
  9888. b = j;
  9889. }
  9890. // Initialise coefficient array of result with zeros.
  9891. for (c = new Array(j = a + b); j--;) c[j] = 0;
  9892. // Multiply.
  9893. // i is initially xc.length.
  9894. for (i = b; i--;) {
  9895. b = 0;
  9896. // a is yc.length.
  9897. for (j = a + i; j > i;) {
  9898. // Current sum of products at this digit position, plus carry.
  9899. b = c[j] + yc[i] * xc[j - i - 1] + b;
  9900. c[j--] = b % 10;
  9901. // carry
  9902. b = b / 10 | 0;
  9903. }
  9904. c[j] = (c[j] + b) % 10;
  9905. }
  9906. // Increment result exponent if there is a final carry, otherwise remove leading zero.
  9907. if (b) ++y.e;
  9908. else c.shift();
  9909. // Remove trailing zeros.
  9910. for (i = c.length; !c[--i];) c.pop();
  9911. y.c = c;
  9912. return y;
  9913. };
  9914. /*
  9915. * Return a string representing the value of this Big in exponential notation to dp fixed decimal
  9916. * places and rounded using Big.RM.
  9917. *
  9918. * dp? {number} Integer, 0 to MAX_DP inclusive.
  9919. */
  9920. P.toExponential = function (dp) {
  9921. return stringify(this, 1, dp, dp);
  9922. };
  9923. /*
  9924. * Return a string representing the value of this Big in normal notation to dp fixed decimal
  9925. * places and rounded using Big.RM.
  9926. *
  9927. * dp? {number} Integer, 0 to MAX_DP inclusive.
  9928. *
  9929. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  9930. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  9931. */
  9932. P.toFixed = function (dp) {
  9933. return stringify(this, 2, dp, this.e + dp);
  9934. };
  9935. /*
  9936. * Return a string representing the value of this Big rounded to sd significant digits using
  9937. * Big.RM. Use exponential notation if sd is less than the number of digits necessary to represent
  9938. * the integer part of the value in normal notation.
  9939. *
  9940. * sd {number} Integer, 1 to MAX_DP inclusive.
  9941. */
  9942. P.toPrecision = function (sd) {
  9943. return stringify(this, 3, sd, sd - 1);
  9944. };
  9945. /*
  9946. * Return a string representing the value of this Big.
  9947. * Return exponential notation if this Big has a positive exponent equal to or greater than
  9948. * Big.PE, or a negative exponent equal to or less than Big.NE.
  9949. * Omit the sign for negative zero.
  9950. */
  9951. P.toString = function () {
  9952. return stringify(this);
  9953. };
  9954. /*
  9955. * Return a string representing the value of this Big.
  9956. * Return exponential notation if this Big has a positive exponent equal to or greater than
  9957. * Big.PE, or a negative exponent equal to or less than Big.NE.
  9958. * Include the sign for negative zero.
  9959. */
  9960. P.valueOf = P.toJSON = function () {
  9961. return stringify(this, 4);
  9962. };
  9963. // Export
  9964. var Big = _Big_();
  9965. var big = /*#__PURE__*/Object.freeze({
  9966. __proto__: null,
  9967. Big: Big,
  9968. 'default': Big
  9969. });
  9970. var require$$0 = /*@__PURE__*/getAugmentedNamespace(big);
  9971. const baseEncodeTables = {
  9972. 26: 'abcdefghijklmnopqrstuvwxyz',
  9973. 32: '123456789abcdefghjkmnpqrstuvwxyz', // no 0lio
  9974. 36: '0123456789abcdefghijklmnopqrstuvwxyz',
  9975. 49: 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', // no lIO
  9976. 52: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
  9977. 58: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', // no 0lIO
  9978. 62: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
  9979. 64: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_',
  9980. };
  9981. function encodeBufferToBase(buffer, base) {
  9982. const encodeTable = baseEncodeTables[base];
  9983. if (!encodeTable) {
  9984. throw new Error('Unknown encoding base' + base);
  9985. }
  9986. const readLength = buffer.length;
  9987. const Big = require$$0;
  9988. Big.RM = Big.DP = 0;
  9989. let b = new Big(0);
  9990. for (let i = readLength - 1; i >= 0; i--) {
  9991. b = b.times(256).plus(buffer[i]);
  9992. }
  9993. let output = '';
  9994. while (b.gt(0)) {
  9995. output = encodeTable[b.mod(base)] + output;
  9996. b = b.div(base);
  9997. }
  9998. Big.DP = 20;
  9999. Big.RM = 1;
  10000. return output;
  10001. }
  10002. function getHashDigest(buffer, hashType, digestType, maxLength) {
  10003. hashType = hashType || 'md5';
  10004. maxLength = maxLength || 9999;
  10005. const hash = require('crypto').createHash(hashType);
  10006. hash.update(buffer);
  10007. if (
  10008. digestType === 'base26' ||
  10009. digestType === 'base32' ||
  10010. digestType === 'base36' ||
  10011. digestType === 'base49' ||
  10012. digestType === 'base52' ||
  10013. digestType === 'base58' ||
  10014. digestType === 'base62' ||
  10015. digestType === 'base64'
  10016. ) {
  10017. return encodeBufferToBase(hash.digest(), digestType.substr(4)).substr(
  10018. 0,
  10019. maxLength
  10020. );
  10021. } else {
  10022. return hash.digest(digestType || 'hex').substr(0, maxLength);
  10023. }
  10024. }
  10025. var getHashDigest_1 = getHashDigest;
  10026. var emojisList = [
  10027. "🀄️",
  10028. "🃏",
  10029. "🅰️",
  10030. "🅱️",
  10031. "🅾️",
  10032. "🅿️",
  10033. "🆎",
  10034. "🆑",
  10035. "🆒",
  10036. "🆓",
  10037. "🆔",
  10038. "🆕",
  10039. "🆖",
  10040. "🆗",
  10041. "🆘",
  10042. "🆙",
  10043. "🆚",
  10044. "🇦🇨",
  10045. "🇦🇩",
  10046. "🇦🇪",
  10047. "🇦🇫",
  10048. "🇦🇬",
  10049. "🇦🇮",
  10050. "🇦🇱",
  10051. "🇦🇲",
  10052. "🇦🇴",
  10053. "🇦🇶",
  10054. "🇦🇷",
  10055. "🇦🇸",
  10056. "🇦🇹",
  10057. "🇦🇺",
  10058. "🇦🇼",
  10059. "🇦🇽",
  10060. "🇦🇿",
  10061. "🇦",
  10062. "🇧🇦",
  10063. "🇧🇧",
  10064. "🇧🇩",
  10065. "🇧🇪",
  10066. "🇧🇫",
  10067. "🇧🇬",
  10068. "🇧🇭",
  10069. "🇧🇮",
  10070. "🇧🇯",
  10071. "🇧🇱",
  10072. "🇧🇲",
  10073. "🇧🇳",
  10074. "🇧🇴",
  10075. "🇧🇶",
  10076. "🇧🇷",
  10077. "🇧🇸",
  10078. "🇧🇹",
  10079. "🇧🇻",
  10080. "🇧🇼",
  10081. "🇧🇾",
  10082. "🇧🇿",
  10083. "🇧",
  10084. "🇨🇦",
  10085. "🇨🇨",
  10086. "🇨🇩",
  10087. "🇨🇫",
  10088. "🇨🇬",
  10089. "🇨🇭",
  10090. "🇨🇮",
  10091. "🇨🇰",
  10092. "🇨🇱",
  10093. "🇨🇲",
  10094. "🇨🇳",
  10095. "🇨🇴",
  10096. "🇨🇵",
  10097. "🇨🇷",
  10098. "🇨🇺",
  10099. "🇨🇻",
  10100. "🇨🇼",
  10101. "🇨🇽",
  10102. "🇨🇾",
  10103. "🇨🇿",
  10104. "🇨",
  10105. "🇩🇪",
  10106. "🇩🇬",
  10107. "🇩🇯",
  10108. "🇩🇰",
  10109. "🇩🇲",
  10110. "🇩🇴",
  10111. "🇩🇿",
  10112. "🇩",
  10113. "🇪🇦",
  10114. "🇪🇨",
  10115. "🇪🇪",
  10116. "🇪🇬",
  10117. "🇪🇭",
  10118. "🇪🇷",
  10119. "🇪🇸",
  10120. "🇪🇹",
  10121. "🇪🇺",
  10122. "🇪",
  10123. "🇫🇮",
  10124. "🇫🇯",
  10125. "🇫🇰",
  10126. "🇫🇲",
  10127. "🇫🇴",
  10128. "🇫🇷",
  10129. "🇫",
  10130. "🇬🇦",
  10131. "🇬🇧",
  10132. "🇬🇩",
  10133. "🇬🇪",
  10134. "🇬🇫",
  10135. "🇬🇬",
  10136. "🇬🇭",
  10137. "🇬🇮",
  10138. "🇬🇱",
  10139. "🇬🇲",
  10140. "🇬🇳",
  10141. "🇬🇵",
  10142. "🇬🇶",
  10143. "🇬🇷",
  10144. "🇬🇸",
  10145. "🇬🇹",
  10146. "🇬🇺",
  10147. "🇬🇼",
  10148. "🇬🇾",
  10149. "🇬",
  10150. "🇭🇰",
  10151. "🇭🇲",
  10152. "🇭🇳",
  10153. "🇭🇷",
  10154. "🇭🇹",
  10155. "🇭🇺",
  10156. "🇭",
  10157. "🇮🇨",
  10158. "🇮🇩",
  10159. "🇮🇪",
  10160. "🇮🇱",
  10161. "🇮🇲",
  10162. "🇮🇳",
  10163. "🇮🇴",
  10164. "🇮🇶",
  10165. "🇮🇷",
  10166. "🇮🇸",
  10167. "🇮🇹",
  10168. "🇮",
  10169. "🇯🇪",
  10170. "🇯🇲",
  10171. "🇯🇴",
  10172. "🇯🇵",
  10173. "🇯",
  10174. "🇰🇪",
  10175. "🇰🇬",
  10176. "🇰🇭",
  10177. "🇰🇮",
  10178. "🇰🇲",
  10179. "🇰🇳",
  10180. "🇰🇵",
  10181. "🇰🇷",
  10182. "🇰🇼",
  10183. "🇰🇾",
  10184. "🇰🇿",
  10185. "🇰",
  10186. "🇱🇦",
  10187. "🇱🇧",
  10188. "🇱🇨",
  10189. "🇱🇮",
  10190. "🇱🇰",
  10191. "🇱🇷",
  10192. "🇱🇸",
  10193. "🇱🇹",
  10194. "🇱🇺",
  10195. "🇱🇻",
  10196. "🇱🇾",
  10197. "🇱",
  10198. "🇲🇦",
  10199. "🇲🇨",
  10200. "🇲🇩",
  10201. "🇲🇪",
  10202. "🇲🇫",
  10203. "🇲🇬",
  10204. "🇲🇭",
  10205. "🇲🇰",
  10206. "🇲🇱",
  10207. "🇲🇲",
  10208. "🇲🇳",
  10209. "🇲🇴",
  10210. "🇲🇵",
  10211. "🇲🇶",
  10212. "🇲🇷",
  10213. "🇲🇸",
  10214. "🇲🇹",
  10215. "🇲🇺",
  10216. "🇲🇻",
  10217. "🇲🇼",
  10218. "🇲🇽",
  10219. "🇲🇾",
  10220. "🇲🇿",
  10221. "🇲",
  10222. "🇳🇦",
  10223. "🇳🇨",
  10224. "🇳🇪",
  10225. "🇳🇫",
  10226. "🇳🇬",
  10227. "🇳🇮",
  10228. "🇳🇱",
  10229. "🇳🇴",
  10230. "🇳🇵",
  10231. "🇳🇷",
  10232. "🇳🇺",
  10233. "🇳🇿",
  10234. "🇳",
  10235. "🇴🇲",
  10236. "🇴",
  10237. "🇵🇦",
  10238. "🇵🇪",
  10239. "🇵🇫",
  10240. "🇵🇬",
  10241. "🇵🇭",
  10242. "🇵🇰",
  10243. "🇵🇱",
  10244. "🇵🇲",
  10245. "🇵🇳",
  10246. "🇵🇷",
  10247. "🇵🇸",
  10248. "🇵🇹",
  10249. "🇵🇼",
  10250. "🇵🇾",
  10251. "🇵",
  10252. "🇶🇦",
  10253. "🇶",
  10254. "🇷🇪",
  10255. "🇷🇴",
  10256. "🇷🇸",
  10257. "🇷🇺",
  10258. "🇷🇼",
  10259. "🇷",
  10260. "🇸🇦",
  10261. "🇸🇧",
  10262. "🇸🇨",
  10263. "🇸🇩",
  10264. "🇸🇪",
  10265. "🇸🇬",
  10266. "🇸🇭",
  10267. "🇸🇮",
  10268. "🇸🇯",
  10269. "🇸🇰",
  10270. "🇸🇱",
  10271. "🇸🇲",
  10272. "🇸🇳",
  10273. "🇸🇴",
  10274. "🇸🇷",
  10275. "🇸🇸",
  10276. "🇸🇹",
  10277. "🇸🇻",
  10278. "🇸🇽",
  10279. "🇸🇾",
  10280. "🇸🇿",
  10281. "🇸",
  10282. "🇹🇦",
  10283. "🇹🇨",
  10284. "🇹🇩",
  10285. "🇹🇫",
  10286. "🇹🇬",
  10287. "🇹🇭",
  10288. "🇹🇯",
  10289. "🇹🇰",
  10290. "🇹🇱",
  10291. "🇹🇲",
  10292. "🇹🇳",
  10293. "🇹🇴",
  10294. "🇹🇷",
  10295. "🇹🇹",
  10296. "🇹🇻",
  10297. "🇹🇼",
  10298. "🇹🇿",
  10299. "🇹",
  10300. "🇺🇦",
  10301. "🇺🇬",
  10302. "🇺🇲",
  10303. "🇺🇳",
  10304. "🇺🇸",
  10305. "🇺🇾",
  10306. "🇺🇿",
  10307. "🇺",
  10308. "🇻🇦",
  10309. "🇻🇨",
  10310. "🇻🇪",
  10311. "🇻🇬",
  10312. "🇻🇮",
  10313. "🇻🇳",
  10314. "🇻🇺",
  10315. "🇻",
  10316. "🇼🇫",
  10317. "🇼🇸",
  10318. "🇼",
  10319. "🇽🇰",
  10320. "🇽",
  10321. "🇾🇪",
  10322. "🇾🇹",
  10323. "🇾",
  10324. "🇿🇦",
  10325. "🇿🇲",
  10326. "🇿🇼",
  10327. "🇿",
  10328. "🈁",
  10329. "🈂️",
  10330. "🈚️",
  10331. "🈯️",
  10332. "🈲",
  10333. "🈳",
  10334. "🈴",
  10335. "🈵",
  10336. "🈶",
  10337. "🈷️",
  10338. "🈸",
  10339. "🈹",
  10340. "🈺",
  10341. "🉐",
  10342. "🉑",
  10343. "🌀",
  10344. "🌁",
  10345. "🌂",
  10346. "🌃",
  10347. "🌄",
  10348. "🌅",
  10349. "🌆",
  10350. "🌇",
  10351. "🌈",
  10352. "🌉",
  10353. "🌊",
  10354. "🌋",
  10355. "🌌",
  10356. "🌍",
  10357. "🌎",
  10358. "🌏",
  10359. "🌐",
  10360. "🌑",
  10361. "🌒",
  10362. "🌓",
  10363. "🌔",
  10364. "🌕",
  10365. "🌖",
  10366. "🌗",
  10367. "🌘",
  10368. "🌙",
  10369. "🌚",
  10370. "🌛",
  10371. "🌜",
  10372. "🌝",
  10373. "🌞",
  10374. "🌟",
  10375. "🌠",
  10376. "🌡️",
  10377. "🌤️",
  10378. "🌥️",
  10379. "🌦️",
  10380. "🌧️",
  10381. "🌨️",
  10382. "🌩️",
  10383. "🌪️",
  10384. "🌫️",
  10385. "🌬️",
  10386. "🌭",
  10387. "🌮",
  10388. "🌯",
  10389. "🌰",
  10390. "🌱",
  10391. "🌲",
  10392. "🌳",
  10393. "🌴",
  10394. "🌵",
  10395. "🌶️",
  10396. "🌷",
  10397. "🌸",
  10398. "🌹",
  10399. "🌺",
  10400. "🌻",
  10401. "🌼",
  10402. "🌽",
  10403. "🌾",
  10404. "🌿",
  10405. "🍀",
  10406. "🍁",
  10407. "🍂",
  10408. "🍃",
  10409. "🍄",
  10410. "🍅",
  10411. "🍆",
  10412. "🍇",
  10413. "🍈",
  10414. "🍉",
  10415. "🍊",
  10416. "🍋",
  10417. "🍌",
  10418. "🍍",
  10419. "🍎",
  10420. "🍏",
  10421. "🍐",
  10422. "🍑",
  10423. "🍒",
  10424. "🍓",
  10425. "🍔",
  10426. "🍕",
  10427. "🍖",
  10428. "🍗",
  10429. "🍘",
  10430. "🍙",
  10431. "🍚",
  10432. "🍛",
  10433. "🍜",
  10434. "🍝",
  10435. "🍞",
  10436. "🍟",
  10437. "🍠",
  10438. "🍡",
  10439. "🍢",
  10440. "🍣",
  10441. "🍤",
  10442. "🍥",
  10443. "🍦",
  10444. "🍧",
  10445. "🍨",
  10446. "🍩",
  10447. "🍪",
  10448. "🍫",
  10449. "🍬",
  10450. "🍭",
  10451. "🍮",
  10452. "🍯",
  10453. "🍰",
  10454. "🍱",
  10455. "🍲",
  10456. "🍳",
  10457. "🍴",
  10458. "🍵",
  10459. "🍶",
  10460. "🍷",
  10461. "🍸",
  10462. "🍹",
  10463. "🍺",
  10464. "🍻",
  10465. "🍼",
  10466. "🍽️",
  10467. "🍾",
  10468. "🍿",
  10469. "🎀",
  10470. "🎁",
  10471. "🎂",
  10472. "🎃",
  10473. "🎄",
  10474. "🎅🏻",
  10475. "🎅🏼",
  10476. "🎅🏽",
  10477. "🎅🏾",
  10478. "🎅🏿",
  10479. "🎅",
  10480. "🎆",
  10481. "🎇",
  10482. "🎈",
  10483. "🎉",
  10484. "🎊",
  10485. "🎋",
  10486. "🎌",
  10487. "🎍",
  10488. "🎎",
  10489. "🎏",
  10490. "🎐",
  10491. "🎑",
  10492. "🎒",
  10493. "🎓",
  10494. "🎖️",
  10495. "🎗️",
  10496. "🎙️",
  10497. "🎚️",
  10498. "🎛️",
  10499. "🎞️",
  10500. "🎟️",
  10501. "🎠",
  10502. "🎡",
  10503. "🎢",
  10504. "🎣",
  10505. "🎤",
  10506. "🎥",
  10507. "🎦",
  10508. "🎧",
  10509. "🎨",
  10510. "🎩",
  10511. "🎪",
  10512. "🎫",
  10513. "🎬",
  10514. "🎭",
  10515. "🎮",
  10516. "🎯",
  10517. "🎰",
  10518. "🎱",
  10519. "🎲",
  10520. "🎳",
  10521. "🎴",
  10522. "🎵",
  10523. "🎶",
  10524. "🎷",
  10525. "🎸",
  10526. "🎹",
  10527. "🎺",
  10528. "🎻",
  10529. "🎼",
  10530. "🎽",
  10531. "🎾",
  10532. "🎿",
  10533. "🏀",
  10534. "🏁",
  10535. "🏂🏻",
  10536. "🏂🏼",
  10537. "🏂🏽",
  10538. "🏂🏾",
  10539. "🏂🏿",
  10540. "🏂",
  10541. "🏃🏻‍♀️",
  10542. "🏃🏻‍♂️",
  10543. "🏃🏻",
  10544. "🏃🏼‍♀️",
  10545. "🏃🏼‍♂️",
  10546. "🏃🏼",
  10547. "🏃🏽‍♀️",
  10548. "🏃🏽‍♂️",
  10549. "🏃🏽",
  10550. "🏃🏾‍♀️",
  10551. "🏃🏾‍♂️",
  10552. "🏃🏾",
  10553. "🏃🏿‍♀️",
  10554. "🏃🏿‍♂️",
  10555. "🏃🏿",
  10556. "🏃‍♀️",
  10557. "🏃‍♂️",
  10558. "🏃",
  10559. "🏄🏻‍♀️",
  10560. "🏄🏻‍♂️",
  10561. "🏄🏻",
  10562. "🏄🏼‍♀️",
  10563. "🏄🏼‍♂️",
  10564. "🏄🏼",
  10565. "🏄🏽‍♀️",
  10566. "🏄🏽‍♂️",
  10567. "🏄🏽",
  10568. "🏄🏾‍♀️",
  10569. "🏄🏾‍♂️",
  10570. "🏄🏾",
  10571. "🏄🏿‍♀️",
  10572. "🏄🏿‍♂️",
  10573. "🏄🏿",
  10574. "🏄‍♀️",
  10575. "🏄‍♂️",
  10576. "🏄",
  10577. "🏅",
  10578. "🏆",
  10579. "🏇🏻",
  10580. "🏇🏼",
  10581. "🏇🏽",
  10582. "🏇🏾",
  10583. "🏇🏿",
  10584. "🏇",
  10585. "🏈",
  10586. "🏉",
  10587. "🏊🏻‍♀️",
  10588. "🏊🏻‍♂️",
  10589. "🏊🏻",
  10590. "🏊🏼‍♀️",
  10591. "🏊🏼‍♂️",
  10592. "🏊🏼",
  10593. "🏊🏽‍♀️",
  10594. "🏊🏽‍♂️",
  10595. "🏊🏽",
  10596. "🏊🏾‍♀️",
  10597. "🏊🏾‍♂️",
  10598. "🏊🏾",
  10599. "🏊🏿‍♀️",
  10600. "🏊🏿‍♂️",
  10601. "🏊🏿",
  10602. "🏊‍♀️",
  10603. "🏊‍♂️",
  10604. "🏊",
  10605. "🏋🏻‍♀️",
  10606. "🏋🏻‍♂️",
  10607. "🏋🏻",
  10608. "🏋🏼‍♀️",
  10609. "🏋🏼‍♂️",
  10610. "🏋🏼",
  10611. "🏋🏽‍♀️",
  10612. "🏋🏽‍♂️",
  10613. "🏋🏽",
  10614. "🏋🏾‍♀️",
  10615. "🏋🏾‍♂️",
  10616. "🏋🏾",
  10617. "🏋🏿‍♀️",
  10618. "🏋🏿‍♂️",
  10619. "🏋🏿",
  10620. "🏋️‍♀️",
  10621. "🏋️‍♂️",
  10622. "🏋️",
  10623. "🏌🏻‍♀️",
  10624. "🏌🏻‍♂️",
  10625. "🏌🏻",
  10626. "🏌🏼‍♀️",
  10627. "🏌🏼‍♂️",
  10628. "🏌🏼",
  10629. "🏌🏽‍♀️",
  10630. "🏌🏽‍♂️",
  10631. "🏌🏽",
  10632. "🏌🏾‍♀️",
  10633. "🏌🏾‍♂️",
  10634. "🏌🏾",
  10635. "🏌🏿‍♀️",
  10636. "🏌🏿‍♂️",
  10637. "🏌🏿",
  10638. "🏌️‍♀️",
  10639. "🏌️‍♂️",
  10640. "🏌️",
  10641. "🏍️",
  10642. "🏎️",
  10643. "🏏",
  10644. "🏐",
  10645. "🏑",
  10646. "🏒",
  10647. "🏓",
  10648. "🏔️",
  10649. "🏕️",
  10650. "🏖️",
  10651. "🏗️",
  10652. "🏘️",
  10653. "🏙️",
  10654. "🏚️",
  10655. "🏛️",
  10656. "🏜️",
  10657. "🏝️",
  10658. "🏞️",
  10659. "🏟️",
  10660. "🏠",
  10661. "🏡",
  10662. "🏢",
  10663. "🏣",
  10664. "🏤",
  10665. "🏥",
  10666. "🏦",
  10667. "🏧",
  10668. "🏨",
  10669. "🏩",
  10670. "🏪",
  10671. "🏫",
  10672. "🏬",
  10673. "🏭",
  10674. "🏮",
  10675. "🏯",
  10676. "🏰",
  10677. "🏳️‍🌈",
  10678. "🏳️",
  10679. "🏴‍☠️",
  10680. "🏴󠁧󠁢󠁥󠁮󠁧󠁿",
  10681. "🏴󠁧󠁢󠁳󠁣󠁴󠁿",
  10682. "🏴󠁧󠁢󠁷󠁬󠁳󠁿",
  10683. "🏴",
  10684. "🏵️",
  10685. "🏷️",
  10686. "🏸",
  10687. "🏹",
  10688. "🏺",
  10689. "🏻",
  10690. "🏼",
  10691. "🏽",
  10692. "🏾",
  10693. "🏿",
  10694. "🐀",
  10695. "🐁",
  10696. "🐂",
  10697. "🐃",
  10698. "🐄",
  10699. "🐅",
  10700. "🐆",
  10701. "🐇",
  10702. "🐈",
  10703. "🐉",
  10704. "🐊",
  10705. "🐋",
  10706. "🐌",
  10707. "🐍",
  10708. "🐎",
  10709. "🐏",
  10710. "🐐",
  10711. "🐑",
  10712. "🐒",
  10713. "🐓",
  10714. "🐔",
  10715. "🐕‍🦺",
  10716. "🐕",
  10717. "🐖",
  10718. "🐗",
  10719. "🐘",
  10720. "🐙",
  10721. "🐚",
  10722. "🐛",
  10723. "🐜",
  10724. "🐝",
  10725. "🐞",
  10726. "🐟",
  10727. "🐠",
  10728. "🐡",
  10729. "🐢",
  10730. "🐣",
  10731. "🐤",
  10732. "🐥",
  10733. "🐦",
  10734. "🐧",
  10735. "🐨",
  10736. "🐩",
  10737. "🐪",
  10738. "🐫",
  10739. "🐬",
  10740. "🐭",
  10741. "🐮",
  10742. "🐯",
  10743. "🐰",
  10744. "🐱",
  10745. "🐲",
  10746. "🐳",
  10747. "🐴",
  10748. "🐵",
  10749. "🐶",
  10750. "🐷",
  10751. "🐸",
  10752. "🐹",
  10753. "🐺",
  10754. "🐻",
  10755. "🐼",
  10756. "🐽",
  10757. "🐾",
  10758. "🐿️",
  10759. "👀",
  10760. "👁‍🗨",
  10761. "👁️",
  10762. "👂🏻",
  10763. "👂🏼",
  10764. "👂🏽",
  10765. "👂🏾",
  10766. "👂🏿",
  10767. "👂",
  10768. "👃🏻",
  10769. "👃🏼",
  10770. "👃🏽",
  10771. "👃🏾",
  10772. "👃🏿",
  10773. "👃",
  10774. "👄",
  10775. "👅",
  10776. "👆🏻",
  10777. "👆🏼",
  10778. "👆🏽",
  10779. "👆🏾",
  10780. "👆🏿",
  10781. "👆",
  10782. "👇🏻",
  10783. "👇🏼",
  10784. "👇🏽",
  10785. "👇🏾",
  10786. "👇🏿",
  10787. "👇",
  10788. "👈🏻",
  10789. "👈🏼",
  10790. "👈🏽",
  10791. "👈🏾",
  10792. "👈🏿",
  10793. "👈",
  10794. "👉🏻",
  10795. "👉🏼",
  10796. "👉🏽",
  10797. "👉🏾",
  10798. "👉🏿",
  10799. "👉",
  10800. "👊🏻",
  10801. "👊🏼",
  10802. "👊🏽",
  10803. "👊🏾",
  10804. "👊🏿",
  10805. "👊",
  10806. "👋🏻",
  10807. "👋🏼",
  10808. "👋🏽",
  10809. "👋🏾",
  10810. "👋🏿",
  10811. "👋",
  10812. "👌🏻",
  10813. "👌🏼",
  10814. "👌🏽",
  10815. "👌🏾",
  10816. "👌🏿",
  10817. "👌",
  10818. "👍🏻",
  10819. "👍🏼",
  10820. "👍🏽",
  10821. "👍🏾",
  10822. "👍🏿",
  10823. "👍",
  10824. "👎🏻",
  10825. "👎🏼",
  10826. "👎🏽",
  10827. "👎🏾",
  10828. "👎🏿",
  10829. "👎",
  10830. "👏🏻",
  10831. "👏🏼",
  10832. "👏🏽",
  10833. "👏🏾",
  10834. "👏🏿",
  10835. "👏",
  10836. "👐🏻",
  10837. "👐🏼",
  10838. "👐🏽",
  10839. "👐🏾",
  10840. "👐🏿",
  10841. "👐",
  10842. "👑",
  10843. "👒",
  10844. "👓",
  10845. "👔",
  10846. "👕",
  10847. "👖",
  10848. "👗",
  10849. "👘",
  10850. "👙",
  10851. "👚",
  10852. "👛",
  10853. "👜",
  10854. "👝",
  10855. "👞",
  10856. "👟",
  10857. "👠",
  10858. "👡",
  10859. "👢",
  10860. "👣",
  10861. "👤",
  10862. "👥",
  10863. "👦🏻",
  10864. "👦🏼",
  10865. "👦🏽",
  10866. "👦🏾",
  10867. "👦🏿",
  10868. "👦",
  10869. "👧🏻",
  10870. "👧🏼",
  10871. "👧🏽",
  10872. "👧🏾",
  10873. "👧🏿",
  10874. "👧",
  10875. "👨🏻‍🌾",
  10876. "👨🏻‍🍳",
  10877. "👨🏻‍🎓",
  10878. "👨🏻‍🎤",
  10879. "👨🏻‍🎨",
  10880. "👨🏻‍🏫",
  10881. "👨🏻‍🏭",
  10882. "👨🏻‍💻",
  10883. "👨🏻‍💼",
  10884. "👨🏻‍🔧",
  10885. "👨🏻‍🔬",
  10886. "👨🏻‍🚀",
  10887. "👨🏻‍🚒",
  10888. "👨🏻‍🦯",
  10889. "👨🏻‍🦰",
  10890. "👨🏻‍🦱",
  10891. "👨🏻‍🦲",
  10892. "👨🏻‍🦳",
  10893. "👨🏻‍🦼",
  10894. "👨🏻‍🦽",
  10895. "👨🏻‍⚕️",
  10896. "👨🏻‍⚖️",
  10897. "👨🏻‍✈️",
  10898. "👨🏻",
  10899. "👨🏼‍🌾",
  10900. "👨🏼‍🍳",
  10901. "👨🏼‍🎓",
  10902. "👨🏼‍🎤",
  10903. "👨🏼‍🎨",
  10904. "👨🏼‍🏫",
  10905. "👨🏼‍🏭",
  10906. "👨🏼‍💻",
  10907. "👨🏼‍💼",
  10908. "👨🏼‍🔧",
  10909. "👨🏼‍🔬",
  10910. "👨🏼‍🚀",
  10911. "👨🏼‍🚒",
  10912. "👨🏼‍🤝‍👨🏻",
  10913. "👨🏼‍🦯",
  10914. "👨🏼‍🦰",
  10915. "👨🏼‍🦱",
  10916. "👨🏼‍🦲",
  10917. "👨🏼‍🦳",
  10918. "👨🏼‍🦼",
  10919. "👨🏼‍🦽",
  10920. "👨🏼‍⚕️",
  10921. "👨🏼‍⚖️",
  10922. "👨🏼‍✈️",
  10923. "👨🏼",
  10924. "👨🏽‍🌾",
  10925. "👨🏽‍🍳",
  10926. "👨🏽‍🎓",
  10927. "👨🏽‍🎤",
  10928. "👨🏽‍🎨",
  10929. "👨🏽‍🏫",
  10930. "👨🏽‍🏭",
  10931. "👨🏽‍💻",
  10932. "👨🏽‍💼",
  10933. "👨🏽‍🔧",
  10934. "👨🏽‍🔬",
  10935. "👨🏽‍🚀",
  10936. "👨🏽‍🚒",
  10937. "👨🏽‍🤝‍👨🏻",
  10938. "👨🏽‍🤝‍👨🏼",
  10939. "👨🏽‍🦯",
  10940. "👨🏽‍🦰",
  10941. "👨🏽‍🦱",
  10942. "👨🏽‍🦲",
  10943. "👨🏽‍🦳",
  10944. "👨🏽‍🦼",
  10945. "👨🏽‍🦽",
  10946. "👨🏽‍⚕️",
  10947. "👨🏽‍⚖️",
  10948. "👨🏽‍✈️",
  10949. "👨🏽",
  10950. "👨🏾‍🌾",
  10951. "👨🏾‍🍳",
  10952. "👨🏾‍🎓",
  10953. "👨🏾‍🎤",
  10954. "👨🏾‍🎨",
  10955. "👨🏾‍🏫",
  10956. "👨🏾‍🏭",
  10957. "👨🏾‍💻",
  10958. "👨🏾‍💼",
  10959. "👨🏾‍🔧",
  10960. "👨🏾‍🔬",
  10961. "👨🏾‍🚀",
  10962. "👨🏾‍🚒",
  10963. "👨🏾‍🤝‍👨🏻",
  10964. "👨🏾‍🤝‍👨🏼",
  10965. "👨🏾‍🤝‍👨🏽",
  10966. "👨🏾‍🦯",
  10967. "👨🏾‍🦰",
  10968. "👨🏾‍🦱",
  10969. "👨🏾‍🦲",
  10970. "👨🏾‍🦳",
  10971. "👨🏾‍🦼",
  10972. "👨🏾‍🦽",
  10973. "👨🏾‍⚕️",
  10974. "👨🏾‍⚖️",
  10975. "👨🏾‍✈️",
  10976. "👨🏾",
  10977. "👨🏿‍🌾",
  10978. "👨🏿‍🍳",
  10979. "👨🏿‍🎓",
  10980. "👨🏿‍🎤",
  10981. "👨🏿‍🎨",
  10982. "👨🏿‍🏫",
  10983. "👨🏿‍🏭",
  10984. "👨🏿‍💻",
  10985. "👨🏿‍💼",
  10986. "👨🏿‍🔧",
  10987. "👨🏿‍🔬",
  10988. "👨🏿‍🚀",
  10989. "👨🏿‍🚒",
  10990. "👨🏿‍🤝‍👨🏻",
  10991. "👨🏿‍🤝‍👨🏼",
  10992. "👨🏿‍🤝‍👨🏽",
  10993. "👨🏿‍🤝‍👨🏾",
  10994. "👨🏿‍🦯",
  10995. "👨🏿‍🦰",
  10996. "👨🏿‍🦱",
  10997. "👨🏿‍🦲",
  10998. "👨🏿‍🦳",
  10999. "👨🏿‍🦼",
  11000. "👨🏿‍🦽",
  11001. "👨🏿‍⚕️",
  11002. "👨🏿‍⚖️",
  11003. "👨🏿‍✈️",
  11004. "👨🏿",
  11005. "👨‍🌾",
  11006. "👨‍🍳",
  11007. "👨‍🎓",
  11008. "👨‍🎤",
  11009. "👨‍🎨",
  11010. "👨‍🏫",
  11011. "👨‍🏭",
  11012. "👨‍👦‍👦",
  11013. "👨‍👦",
  11014. "👨‍👧‍👦",
  11015. "👨‍👧‍👧",
  11016. "👨‍👧",
  11017. "👨‍👨‍👦‍👦",
  11018. "👨‍👨‍👦",
  11019. "👨‍👨‍👧‍👦",
  11020. "👨‍👨‍👧‍👧",
  11021. "👨‍👨‍👧",
  11022. "👨‍👩‍👦‍👦",
  11023. "👨‍👩‍👦",
  11024. "👨‍👩‍👧‍👦",
  11025. "👨‍👩‍👧‍👧",
  11026. "👨‍👩‍👧",
  11027. "👨‍💻",
  11028. "👨‍💼",
  11029. "👨‍🔧",
  11030. "👨‍🔬",
  11031. "👨‍🚀",
  11032. "👨‍🚒",
  11033. "👨‍🦯",
  11034. "👨‍🦰",
  11035. "👨‍🦱",
  11036. "👨‍🦲",
  11037. "👨‍🦳",
  11038. "👨‍🦼",
  11039. "👨‍🦽",
  11040. "👨‍⚕️",
  11041. "👨‍⚖️",
  11042. "👨‍✈️",
  11043. "👨‍❤️‍👨",
  11044. "👨‍❤️‍💋‍👨",
  11045. "👨",
  11046. "👩🏻‍🌾",
  11047. "👩🏻‍🍳",
  11048. "👩🏻‍🎓",
  11049. "👩🏻‍🎤",
  11050. "👩🏻‍🎨",
  11051. "👩🏻‍🏫",
  11052. "👩🏻‍🏭",
  11053. "👩🏻‍💻",
  11054. "👩🏻‍💼",
  11055. "👩🏻‍🔧",
  11056. "👩🏻‍🔬",
  11057. "👩🏻‍🚀",
  11058. "👩🏻‍🚒",
  11059. "👩🏻‍🤝‍👨🏼",
  11060. "👩🏻‍🤝‍👨🏽",
  11061. "👩🏻‍🤝‍👨🏾",
  11062. "👩🏻‍🤝‍👨🏿",
  11063. "👩🏻‍🦯",
  11064. "👩🏻‍🦰",
  11065. "👩🏻‍🦱",
  11066. "👩🏻‍🦲",
  11067. "👩🏻‍🦳",
  11068. "👩🏻‍🦼",
  11069. "👩🏻‍🦽",
  11070. "👩🏻‍⚕️",
  11071. "👩🏻‍⚖️",
  11072. "👩🏻‍✈️",
  11073. "👩🏻",
  11074. "👩🏼‍🌾",
  11075. "👩🏼‍🍳",
  11076. "👩🏼‍🎓",
  11077. "👩🏼‍🎤",
  11078. "👩🏼‍🎨",
  11079. "👩🏼‍🏫",
  11080. "👩🏼‍🏭",
  11081. "👩🏼‍💻",
  11082. "👩🏼‍💼",
  11083. "👩🏼‍🔧",
  11084. "👩🏼‍🔬",
  11085. "👩🏼‍🚀",
  11086. "👩🏼‍🚒",
  11087. "👩🏼‍🤝‍👨🏻",
  11088. "👩🏼‍🤝‍👨🏽",
  11089. "👩🏼‍🤝‍👨🏾",
  11090. "👩🏼‍🤝‍👨🏿",
  11091. "👩🏼‍🤝‍👩🏻",
  11092. "👩🏼‍🦯",
  11093. "👩🏼‍🦰",
  11094. "👩🏼‍🦱",
  11095. "👩🏼‍🦲",
  11096. "👩🏼‍🦳",
  11097. "👩🏼‍🦼",
  11098. "👩🏼‍🦽",
  11099. "👩🏼‍⚕️",
  11100. "👩🏼‍⚖️",
  11101. "👩🏼‍✈️",
  11102. "👩🏼",
  11103. "👩🏽‍🌾",
  11104. "👩🏽‍🍳",
  11105. "👩🏽‍🎓",
  11106. "👩🏽‍🎤",
  11107. "👩🏽‍🎨",
  11108. "👩🏽‍🏫",
  11109. "👩🏽‍🏭",
  11110. "👩🏽‍💻",
  11111. "👩🏽‍💼",
  11112. "👩🏽‍🔧",
  11113. "👩🏽‍🔬",
  11114. "👩🏽‍🚀",
  11115. "👩🏽‍🚒",
  11116. "👩🏽‍🤝‍👨🏻",
  11117. "👩🏽‍🤝‍👨🏼",
  11118. "👩🏽‍🤝‍👨🏾",
  11119. "👩🏽‍🤝‍👨🏿",
  11120. "👩🏽‍🤝‍👩🏻",
  11121. "👩🏽‍🤝‍👩🏼",
  11122. "👩🏽‍🦯",
  11123. "👩🏽‍🦰",
  11124. "👩🏽‍🦱",
  11125. "👩🏽‍🦲",
  11126. "👩🏽‍🦳",
  11127. "👩🏽‍🦼",
  11128. "👩🏽‍🦽",
  11129. "👩🏽‍⚕️",
  11130. "👩🏽‍⚖️",
  11131. "👩🏽‍✈️",
  11132. "👩🏽",
  11133. "👩🏾‍🌾",
  11134. "👩🏾‍🍳",
  11135. "👩🏾‍🎓",
  11136. "👩🏾‍🎤",
  11137. "👩🏾‍🎨",
  11138. "👩🏾‍🏫",
  11139. "👩🏾‍🏭",
  11140. "👩🏾‍💻",
  11141. "👩🏾‍💼",
  11142. "👩🏾‍🔧",
  11143. "👩🏾‍🔬",
  11144. "👩🏾‍🚀",
  11145. "👩🏾‍🚒",
  11146. "👩🏾‍🤝‍👨🏻",
  11147. "👩🏾‍🤝‍👨🏼",
  11148. "👩🏾‍🤝‍👨🏽",
  11149. "👩🏾‍🤝‍👨🏿",
  11150. "👩🏾‍🤝‍👩🏻",
  11151. "👩🏾‍🤝‍👩🏼",
  11152. "👩🏾‍🤝‍👩🏽",
  11153. "👩🏾‍🦯",
  11154. "👩🏾‍🦰",
  11155. "👩🏾‍🦱",
  11156. "👩🏾‍🦲",
  11157. "👩🏾‍🦳",
  11158. "👩🏾‍🦼",
  11159. "👩🏾‍🦽",
  11160. "👩🏾‍⚕️",
  11161. "👩🏾‍⚖️",
  11162. "👩🏾‍✈️",
  11163. "👩🏾",
  11164. "👩🏿‍🌾",
  11165. "👩🏿‍🍳",
  11166. "👩🏿‍🎓",
  11167. "👩🏿‍🎤",
  11168. "👩🏿‍🎨",
  11169. "👩🏿‍🏫",
  11170. "👩🏿‍🏭",
  11171. "👩🏿‍💻",
  11172. "👩🏿‍💼",
  11173. "👩🏿‍🔧",
  11174. "👩🏿‍🔬",
  11175. "👩🏿‍🚀",
  11176. "👩🏿‍🚒",
  11177. "👩🏿‍🤝‍👨🏻",
  11178. "👩🏿‍🤝‍👨🏼",
  11179. "👩🏿‍🤝‍👨🏽",
  11180. "👩🏿‍🤝‍👨🏾",
  11181. "👩🏿‍🤝‍👩🏻",
  11182. "👩🏿‍🤝‍👩🏼",
  11183. "👩🏿‍🤝‍👩🏽",
  11184. "👩🏿‍🤝‍👩🏾",
  11185. "👩🏿‍🦯",
  11186. "👩🏿‍🦰",
  11187. "👩🏿‍🦱",
  11188. "👩🏿‍🦲",
  11189. "👩🏿‍🦳",
  11190. "👩🏿‍🦼",
  11191. "👩🏿‍🦽",
  11192. "👩🏿‍⚕️",
  11193. "👩🏿‍⚖️",
  11194. "👩🏿‍✈️",
  11195. "👩🏿",
  11196. "👩‍🌾",
  11197. "👩‍🍳",
  11198. "👩‍🎓",
  11199. "👩‍🎤",
  11200. "👩‍🎨",
  11201. "👩‍🏫",
  11202. "👩‍🏭",
  11203. "👩‍👦‍👦",
  11204. "👩‍👦",
  11205. "👩‍👧‍👦",
  11206. "👩‍👧‍👧",
  11207. "👩‍👧",
  11208. "👩‍👩‍👦‍👦",
  11209. "👩‍👩‍👦",
  11210. "👩‍👩‍👧‍👦",
  11211. "👩‍👩‍👧‍👧",
  11212. "👩‍👩‍👧",
  11213. "👩‍💻",
  11214. "👩‍💼",
  11215. "👩‍🔧",
  11216. "👩‍🔬",
  11217. "👩‍🚀",
  11218. "👩‍🚒",
  11219. "👩‍🦯",
  11220. "👩‍🦰",
  11221. "👩‍🦱",
  11222. "👩‍🦲",
  11223. "👩‍🦳",
  11224. "👩‍🦼",
  11225. "👩‍🦽",
  11226. "👩‍⚕️",
  11227. "👩‍⚖️",
  11228. "👩‍✈️",
  11229. "👩‍❤️‍👨",
  11230. "👩‍❤️‍👩",
  11231. "👩‍❤️‍💋‍👨",
  11232. "👩‍❤️‍💋‍👩",
  11233. "👩",
  11234. "👪",
  11235. "👫🏻",
  11236. "👫🏼",
  11237. "👫🏽",
  11238. "👫🏾",
  11239. "👫🏿",
  11240. "👫",
  11241. "👬🏻",
  11242. "👬🏼",
  11243. "👬🏽",
  11244. "👬🏾",
  11245. "👬🏿",
  11246. "👬",
  11247. "👭🏻",
  11248. "👭🏼",
  11249. "👭🏽",
  11250. "👭🏾",
  11251. "👭🏿",
  11252. "👭",
  11253. "👮🏻‍♀️",
  11254. "👮🏻‍♂️",
  11255. "👮🏻",
  11256. "👮🏼‍♀️",
  11257. "👮🏼‍♂️",
  11258. "👮🏼",
  11259. "👮🏽‍♀️",
  11260. "👮🏽‍♂️",
  11261. "👮🏽",
  11262. "👮🏾‍♀️",
  11263. "👮🏾‍♂️",
  11264. "👮🏾",
  11265. "👮🏿‍♀️",
  11266. "👮🏿‍♂️",
  11267. "👮🏿",
  11268. "👮‍♀️",
  11269. "👮‍♂️",
  11270. "👮",
  11271. "👯‍♀️",
  11272. "👯‍♂️",
  11273. "👯",
  11274. "👰🏻",
  11275. "👰🏼",
  11276. "👰🏽",
  11277. "👰🏾",
  11278. "👰🏿",
  11279. "👰",
  11280. "👱🏻‍♀️",
  11281. "👱🏻‍♂️",
  11282. "👱🏻",
  11283. "👱🏼‍♀️",
  11284. "👱🏼‍♂️",
  11285. "👱🏼",
  11286. "👱🏽‍♀️",
  11287. "👱🏽‍♂️",
  11288. "👱🏽",
  11289. "👱🏾‍♀️",
  11290. "👱🏾‍♂️",
  11291. "👱🏾",
  11292. "👱🏿‍♀️",
  11293. "👱🏿‍♂️",
  11294. "👱🏿",
  11295. "👱‍♀️",
  11296. "👱‍♂️",
  11297. "👱",
  11298. "👲🏻",
  11299. "👲🏼",
  11300. "👲🏽",
  11301. "👲🏾",
  11302. "👲🏿",
  11303. "👲",
  11304. "👳🏻‍♀️",
  11305. "👳🏻‍♂️",
  11306. "👳🏻",
  11307. "👳🏼‍♀️",
  11308. "👳🏼‍♂️",
  11309. "👳🏼",
  11310. "👳🏽‍♀️",
  11311. "👳🏽‍♂️",
  11312. "👳🏽",
  11313. "👳🏾‍♀️",
  11314. "👳🏾‍♂️",
  11315. "👳🏾",
  11316. "👳🏿‍♀️",
  11317. "👳🏿‍♂️",
  11318. "👳🏿",
  11319. "👳‍♀️",
  11320. "👳‍♂️",
  11321. "👳",
  11322. "👴🏻",
  11323. "👴🏼",
  11324. "👴🏽",
  11325. "👴🏾",
  11326. "👴🏿",
  11327. "👴",
  11328. "👵🏻",
  11329. "👵🏼",
  11330. "👵🏽",
  11331. "👵🏾",
  11332. "👵🏿",
  11333. "👵",
  11334. "👶🏻",
  11335. "👶🏼",
  11336. "👶🏽",
  11337. "👶🏾",
  11338. "👶🏿",
  11339. "👶",
  11340. "👷🏻‍♀️",
  11341. "👷🏻‍♂️",
  11342. "👷🏻",
  11343. "👷🏼‍♀️",
  11344. "👷🏼‍♂️",
  11345. "👷🏼",
  11346. "👷🏽‍♀️",
  11347. "👷🏽‍♂️",
  11348. "👷🏽",
  11349. "👷🏾‍♀️",
  11350. "👷🏾‍♂️",
  11351. "👷🏾",
  11352. "👷🏿‍♀️",
  11353. "👷🏿‍♂️",
  11354. "👷🏿",
  11355. "👷‍♀️",
  11356. "👷‍♂️",
  11357. "👷",
  11358. "👸🏻",
  11359. "👸🏼",
  11360. "👸🏽",
  11361. "👸🏾",
  11362. "👸🏿",
  11363. "👸",
  11364. "👹",
  11365. "👺",
  11366. "👻",
  11367. "👼🏻",
  11368. "👼🏼",
  11369. "👼🏽",
  11370. "👼🏾",
  11371. "👼🏿",
  11372. "👼",
  11373. "👽",
  11374. "👾",
  11375. "👿",
  11376. "💀",
  11377. "💁🏻‍♀️",
  11378. "💁🏻‍♂️",
  11379. "💁🏻",
  11380. "💁🏼‍♀️",
  11381. "💁🏼‍♂️",
  11382. "💁🏼",
  11383. "💁🏽‍♀️",
  11384. "💁🏽‍♂️",
  11385. "💁🏽",
  11386. "💁🏾‍♀️",
  11387. "💁🏾‍♂️",
  11388. "💁🏾",
  11389. "💁🏿‍♀️",
  11390. "💁🏿‍♂️",
  11391. "💁🏿",
  11392. "💁‍♀️",
  11393. "💁‍♂️",
  11394. "💁",
  11395. "💂🏻‍♀️",
  11396. "💂🏻‍♂️",
  11397. "💂🏻",
  11398. "💂🏼‍♀️",
  11399. "💂🏼‍♂️",
  11400. "💂🏼",
  11401. "💂🏽‍♀️",
  11402. "💂🏽‍♂️",
  11403. "💂🏽",
  11404. "💂🏾‍♀️",
  11405. "💂🏾‍♂️",
  11406. "💂🏾",
  11407. "💂🏿‍♀️",
  11408. "💂🏿‍♂️",
  11409. "💂🏿",
  11410. "💂‍♀️",
  11411. "💂‍♂️",
  11412. "💂",
  11413. "💃🏻",
  11414. "💃🏼",
  11415. "💃🏽",
  11416. "💃🏾",
  11417. "💃🏿",
  11418. "💃",
  11419. "💄",
  11420. "💅🏻",
  11421. "💅🏼",
  11422. "💅🏽",
  11423. "💅🏾",
  11424. "💅🏿",
  11425. "💅",
  11426. "💆🏻‍♀️",
  11427. "💆🏻‍♂️",
  11428. "💆🏻",
  11429. "💆🏼‍♀️",
  11430. "💆🏼‍♂️",
  11431. "💆🏼",
  11432. "💆🏽‍♀️",
  11433. "💆🏽‍♂️",
  11434. "💆🏽",
  11435. "💆🏾‍♀️",
  11436. "💆🏾‍♂️",
  11437. "💆🏾",
  11438. "💆🏿‍♀️",
  11439. "💆🏿‍♂️",
  11440. "💆🏿",
  11441. "💆‍♀️",
  11442. "💆‍♂️",
  11443. "💆",
  11444. "💇🏻‍♀️",
  11445. "💇🏻‍♂️",
  11446. "💇🏻",
  11447. "💇🏼‍♀️",
  11448. "💇🏼‍♂️",
  11449. "💇🏼",
  11450. "💇🏽‍♀️",
  11451. "💇🏽‍♂️",
  11452. "💇🏽",
  11453. "💇🏾‍♀️",
  11454. "💇🏾‍♂️",
  11455. "💇🏾",
  11456. "💇🏿‍♀️",
  11457. "💇🏿‍♂️",
  11458. "💇🏿",
  11459. "💇‍♀️",
  11460. "💇‍♂️",
  11461. "💇",
  11462. "💈",
  11463. "💉",
  11464. "💊",
  11465. "💋",
  11466. "💌",
  11467. "💍",
  11468. "💎",
  11469. "💏",
  11470. "💐",
  11471. "💑",
  11472. "💒",
  11473. "💓",
  11474. "💔",
  11475. "💕",
  11476. "💖",
  11477. "💗",
  11478. "💘",
  11479. "💙",
  11480. "💚",
  11481. "💛",
  11482. "💜",
  11483. "💝",
  11484. "💞",
  11485. "💟",
  11486. "💠",
  11487. "💡",
  11488. "💢",
  11489. "💣",
  11490. "💤",
  11491. "💥",
  11492. "💦",
  11493. "💧",
  11494. "💨",
  11495. "💩",
  11496. "💪🏻",
  11497. "💪🏼",
  11498. "💪🏽",
  11499. "💪🏾",
  11500. "💪🏿",
  11501. "💪",
  11502. "💫",
  11503. "💬",
  11504. "💭",
  11505. "💮",
  11506. "💯",
  11507. "💰",
  11508. "💱",
  11509. "💲",
  11510. "💳",
  11511. "💴",
  11512. "💵",
  11513. "💶",
  11514. "💷",
  11515. "💸",
  11516. "💹",
  11517. "💺",
  11518. "💻",
  11519. "💼",
  11520. "💽",
  11521. "💾",
  11522. "💿",
  11523. "📀",
  11524. "📁",
  11525. "📂",
  11526. "📃",
  11527. "📄",
  11528. "📅",
  11529. "📆",
  11530. "📇",
  11531. "📈",
  11532. "📉",
  11533. "📊",
  11534. "📋",
  11535. "📌",
  11536. "📍",
  11537. "📎",
  11538. "📏",
  11539. "📐",
  11540. "📑",
  11541. "📒",
  11542. "📓",
  11543. "📔",
  11544. "📕",
  11545. "📖",
  11546. "📗",
  11547. "📘",
  11548. "📙",
  11549. "📚",
  11550. "📛",
  11551. "📜",
  11552. "📝",
  11553. "📞",
  11554. "📟",
  11555. "📠",
  11556. "📡",
  11557. "📢",
  11558. "📣",
  11559. "📤",
  11560. "📥",
  11561. "📦",
  11562. "📧",
  11563. "📨",
  11564. "📩",
  11565. "📪",
  11566. "📫",
  11567. "📬",
  11568. "📭",
  11569. "📮",
  11570. "📯",
  11571. "📰",
  11572. "📱",
  11573. "📲",
  11574. "📳",
  11575. "📴",
  11576. "📵",
  11577. "📶",
  11578. "📷",
  11579. "📸",
  11580. "📹",
  11581. "📺",
  11582. "📻",
  11583. "📼",
  11584. "📽️",
  11585. "📿",
  11586. "🔀",
  11587. "🔁",
  11588. "🔂",
  11589. "🔃",
  11590. "🔄",
  11591. "🔅",
  11592. "🔆",
  11593. "🔇",
  11594. "🔈",
  11595. "🔉",
  11596. "🔊",
  11597. "🔋",
  11598. "🔌",
  11599. "🔍",
  11600. "🔎",
  11601. "🔏",
  11602. "🔐",
  11603. "🔑",
  11604. "🔒",
  11605. "🔓",
  11606. "🔔",
  11607. "🔕",
  11608. "🔖",
  11609. "🔗",
  11610. "🔘",
  11611. "🔙",
  11612. "🔚",
  11613. "🔛",
  11614. "🔜",
  11615. "🔝",
  11616. "🔞",
  11617. "🔟",
  11618. "🔠",
  11619. "🔡",
  11620. "🔢",
  11621. "🔣",
  11622. "🔤",
  11623. "🔥",
  11624. "🔦",
  11625. "🔧",
  11626. "🔨",
  11627. "🔩",
  11628. "🔪",
  11629. "🔫",
  11630. "🔬",
  11631. "🔭",
  11632. "🔮",
  11633. "🔯",
  11634. "🔰",
  11635. "🔱",
  11636. "🔲",
  11637. "🔳",
  11638. "🔴",
  11639. "🔵",
  11640. "🔶",
  11641. "🔷",
  11642. "🔸",
  11643. "🔹",
  11644. "🔺",
  11645. "🔻",
  11646. "🔼",
  11647. "🔽",
  11648. "🕉️",
  11649. "🕊️",
  11650. "🕋",
  11651. "🕌",
  11652. "🕍",
  11653. "🕎",
  11654. "🕐",
  11655. "🕑",
  11656. "🕒",
  11657. "🕓",
  11658. "🕔",
  11659. "🕕",
  11660. "🕖",
  11661. "🕗",
  11662. "🕘",
  11663. "🕙",
  11664. "🕚",
  11665. "🕛",
  11666. "🕜",
  11667. "🕝",
  11668. "🕞",
  11669. "🕟",
  11670. "🕠",
  11671. "🕡",
  11672. "🕢",
  11673. "🕣",
  11674. "🕤",
  11675. "🕥",
  11676. "🕦",
  11677. "🕧",
  11678. "🕯️",
  11679. "🕰️",
  11680. "🕳️",
  11681. "🕴🏻‍♀️",
  11682. "🕴🏻‍♂️",
  11683. "🕴🏻",
  11684. "🕴🏼‍♀️",
  11685. "🕴🏼‍♂️",
  11686. "🕴🏼",
  11687. "🕴🏽‍♀️",
  11688. "🕴🏽‍♂️",
  11689. "🕴🏽",
  11690. "🕴🏾‍♀️",
  11691. "🕴🏾‍♂️",
  11692. "🕴🏾",
  11693. "🕴🏿‍♀️",
  11694. "🕴🏿‍♂️",
  11695. "🕴🏿",
  11696. "🕴️‍♀️",
  11697. "🕴️‍♂️",
  11698. "🕴️",
  11699. "🕵🏻‍♀️",
  11700. "🕵🏻‍♂️",
  11701. "🕵🏻",
  11702. "🕵🏼‍♀️",
  11703. "🕵🏼‍♂️",
  11704. "🕵🏼",
  11705. "🕵🏽‍♀️",
  11706. "🕵🏽‍♂️",
  11707. "🕵🏽",
  11708. "🕵🏾‍♀️",
  11709. "🕵🏾‍♂️",
  11710. "🕵🏾",
  11711. "🕵🏿‍♀️",
  11712. "🕵🏿‍♂️",
  11713. "🕵🏿",
  11714. "🕵️‍♀️",
  11715. "🕵️‍♂️",
  11716. "🕵️",
  11717. "🕶️",
  11718. "🕷️",
  11719. "🕸️",
  11720. "🕹️",
  11721. "🕺🏻",
  11722. "🕺🏼",
  11723. "🕺🏽",
  11724. "🕺🏾",
  11725. "🕺🏿",
  11726. "🕺",
  11727. "🖇️",
  11728. "🖊️",
  11729. "🖋️",
  11730. "🖌️",
  11731. "🖍️",
  11732. "🖐🏻",
  11733. "🖐🏼",
  11734. "🖐🏽",
  11735. "🖐🏾",
  11736. "🖐🏿",
  11737. "🖐️",
  11738. "🖕🏻",
  11739. "🖕🏼",
  11740. "🖕🏽",
  11741. "🖕🏾",
  11742. "🖕🏿",
  11743. "🖕",
  11744. "🖖🏻",
  11745. "🖖🏼",
  11746. "🖖🏽",
  11747. "🖖🏾",
  11748. "🖖🏿",
  11749. "🖖",
  11750. "🖤",
  11751. "🖥️",
  11752. "🖨️",
  11753. "🖱️",
  11754. "🖲️",
  11755. "🖼️",
  11756. "🗂️",
  11757. "🗃️",
  11758. "🗄️",
  11759. "🗑️",
  11760. "🗒️",
  11761. "🗓️",
  11762. "🗜️",
  11763. "🗝️",
  11764. "🗞️",
  11765. "🗡️",
  11766. "🗣️",
  11767. "🗨️",
  11768. "🗯️",
  11769. "🗳️",
  11770. "🗺️",
  11771. "🗻",
  11772. "🗼",
  11773. "🗽",
  11774. "🗾",
  11775. "🗿",
  11776. "😀",
  11777. "😁",
  11778. "😂",
  11779. "😃",
  11780. "😄",
  11781. "😅",
  11782. "😆",
  11783. "😇",
  11784. "😈",
  11785. "😉",
  11786. "😊",
  11787. "😋",
  11788. "😌",
  11789. "😍",
  11790. "😎",
  11791. "😏",
  11792. "😐",
  11793. "😑",
  11794. "😒",
  11795. "😓",
  11796. "😔",
  11797. "😕",
  11798. "😖",
  11799. "😗",
  11800. "😘",
  11801. "😙",
  11802. "😚",
  11803. "😛",
  11804. "😜",
  11805. "😝",
  11806. "😞",
  11807. "😟",
  11808. "😠",
  11809. "😡",
  11810. "😢",
  11811. "😣",
  11812. "😤",
  11813. "😥",
  11814. "😦",
  11815. "😧",
  11816. "😨",
  11817. "😩",
  11818. "😪",
  11819. "😫",
  11820. "😬",
  11821. "😭",
  11822. "😮",
  11823. "😯",
  11824. "😰",
  11825. "😱",
  11826. "😲",
  11827. "😳",
  11828. "😴",
  11829. "😵",
  11830. "😶",
  11831. "😷",
  11832. "😸",
  11833. "😹",
  11834. "😺",
  11835. "😻",
  11836. "😼",
  11837. "😽",
  11838. "😾",
  11839. "😿",
  11840. "🙀",
  11841. "🙁",
  11842. "🙂",
  11843. "🙃",
  11844. "🙄",
  11845. "🙅🏻‍♀️",
  11846. "🙅🏻‍♂️",
  11847. "🙅🏻",
  11848. "🙅🏼‍♀️",
  11849. "🙅🏼‍♂️",
  11850. "🙅🏼",
  11851. "🙅🏽‍♀️",
  11852. "🙅🏽‍♂️",
  11853. "🙅🏽",
  11854. "🙅🏾‍♀️",
  11855. "🙅🏾‍♂️",
  11856. "🙅🏾",
  11857. "🙅🏿‍♀️",
  11858. "🙅🏿‍♂️",
  11859. "🙅🏿",
  11860. "🙅‍♀️",
  11861. "🙅‍♂️",
  11862. "🙅",
  11863. "🙆🏻‍♀️",
  11864. "🙆🏻‍♂️",
  11865. "🙆🏻",
  11866. "🙆🏼‍♀️",
  11867. "🙆🏼‍♂️",
  11868. "🙆🏼",
  11869. "🙆🏽‍♀️",
  11870. "🙆🏽‍♂️",
  11871. "🙆🏽",
  11872. "🙆🏾‍♀️",
  11873. "🙆🏾‍♂️",
  11874. "🙆🏾",
  11875. "🙆🏿‍♀️",
  11876. "🙆🏿‍♂️",
  11877. "🙆🏿",
  11878. "🙆‍♀️",
  11879. "🙆‍♂️",
  11880. "🙆",
  11881. "🙇🏻‍♀️",
  11882. "🙇🏻‍♂️",
  11883. "🙇🏻",
  11884. "🙇🏼‍♀️",
  11885. "🙇🏼‍♂️",
  11886. "🙇🏼",
  11887. "🙇🏽‍♀️",
  11888. "🙇🏽‍♂️",
  11889. "🙇🏽",
  11890. "🙇🏾‍♀️",
  11891. "🙇🏾‍♂️",
  11892. "🙇🏾",
  11893. "🙇🏿‍♀️",
  11894. "🙇🏿‍♂️",
  11895. "🙇🏿",
  11896. "🙇‍♀️",
  11897. "🙇‍♂️",
  11898. "🙇",
  11899. "🙈",
  11900. "🙉",
  11901. "🙊",
  11902. "🙋🏻‍♀️",
  11903. "🙋🏻‍♂️",
  11904. "🙋🏻",
  11905. "🙋🏼‍♀️",
  11906. "🙋🏼‍♂️",
  11907. "🙋🏼",
  11908. "🙋🏽‍♀️",
  11909. "🙋🏽‍♂️",
  11910. "🙋🏽",
  11911. "🙋🏾‍♀️",
  11912. "🙋🏾‍♂️",
  11913. "🙋🏾",
  11914. "🙋🏿‍♀️",
  11915. "🙋🏿‍♂️",
  11916. "🙋🏿",
  11917. "🙋‍♀️",
  11918. "🙋‍♂️",
  11919. "🙋",
  11920. "🙌🏻",
  11921. "🙌🏼",
  11922. "🙌🏽",
  11923. "🙌🏾",
  11924. "🙌🏿",
  11925. "🙌",
  11926. "🙍🏻‍♀️",
  11927. "🙍🏻‍♂️",
  11928. "🙍🏻",
  11929. "🙍🏼‍♀️",
  11930. "🙍🏼‍♂️",
  11931. "🙍🏼",
  11932. "🙍🏽‍♀️",
  11933. "🙍🏽‍♂️",
  11934. "🙍🏽",
  11935. "🙍🏾‍♀️",
  11936. "🙍🏾‍♂️",
  11937. "🙍🏾",
  11938. "🙍🏿‍♀️",
  11939. "🙍🏿‍♂️",
  11940. "🙍🏿",
  11941. "🙍‍♀️",
  11942. "🙍‍♂️",
  11943. "🙍",
  11944. "🙎🏻‍♀️",
  11945. "🙎🏻‍♂️",
  11946. "🙎🏻",
  11947. "🙎🏼‍♀️",
  11948. "🙎🏼‍♂️",
  11949. "🙎🏼",
  11950. "🙎🏽‍♀️",
  11951. "🙎🏽‍♂️",
  11952. "🙎🏽",
  11953. "🙎🏾‍♀️",
  11954. "🙎🏾‍♂️",
  11955. "🙎🏾",
  11956. "🙎🏿‍♀️",
  11957. "🙎🏿‍♂️",
  11958. "🙎🏿",
  11959. "🙎‍♀️",
  11960. "🙎‍♂️",
  11961. "🙎",
  11962. "🙏🏻",
  11963. "🙏🏼",
  11964. "🙏🏽",
  11965. "🙏🏾",
  11966. "🙏🏿",
  11967. "🙏",
  11968. "🚀",
  11969. "🚁",
  11970. "🚂",
  11971. "🚃",
  11972. "🚄",
  11973. "🚅",
  11974. "🚆",
  11975. "🚇",
  11976. "🚈",
  11977. "🚉",
  11978. "🚊",
  11979. "🚋",
  11980. "🚌",
  11981. "🚍",
  11982. "🚎",
  11983. "🚏",
  11984. "🚐",
  11985. "🚑",
  11986. "🚒",
  11987. "🚓",
  11988. "🚔",
  11989. "🚕",
  11990. "🚖",
  11991. "🚗",
  11992. "🚘",
  11993. "🚙",
  11994. "🚚",
  11995. "🚛",
  11996. "🚜",
  11997. "🚝",
  11998. "🚞",
  11999. "🚟",
  12000. "🚠",
  12001. "🚡",
  12002. "🚢",
  12003. "🚣🏻‍♀️",
  12004. "🚣🏻‍♂️",
  12005. "🚣🏻",
  12006. "🚣🏼‍♀️",
  12007. "🚣🏼‍♂️",
  12008. "🚣🏼",
  12009. "🚣🏽‍♀️",
  12010. "🚣🏽‍♂️",
  12011. "🚣🏽",
  12012. "🚣🏾‍♀️",
  12013. "🚣🏾‍♂️",
  12014. "🚣🏾",
  12015. "🚣🏿‍♀️",
  12016. "🚣🏿‍♂️",
  12017. "🚣🏿",
  12018. "🚣‍♀️",
  12019. "🚣‍♂️",
  12020. "🚣",
  12021. "🚤",
  12022. "🚥",
  12023. "🚦",
  12024. "🚧",
  12025. "🚨",
  12026. "🚩",
  12027. "🚪",
  12028. "🚫",
  12029. "🚬",
  12030. "🚭",
  12031. "🚮",
  12032. "🚯",
  12033. "🚰",
  12034. "🚱",
  12035. "🚲",
  12036. "🚳",
  12037. "🚴🏻‍♀️",
  12038. "🚴🏻‍♂️",
  12039. "🚴🏻",
  12040. "🚴🏼‍♀️",
  12041. "🚴🏼‍♂️",
  12042. "🚴🏼",
  12043. "🚴🏽‍♀️",
  12044. "🚴🏽‍♂️",
  12045. "🚴🏽",
  12046. "🚴🏾‍♀️",
  12047. "🚴🏾‍♂️",
  12048. "🚴🏾",
  12049. "🚴🏿‍♀️",
  12050. "🚴🏿‍♂️",
  12051. "🚴🏿",
  12052. "🚴‍♀️",
  12053. "🚴‍♂️",
  12054. "🚴",
  12055. "🚵🏻‍♀️",
  12056. "🚵🏻‍♂️",
  12057. "🚵🏻",
  12058. "🚵🏼‍♀️",
  12059. "🚵🏼‍♂️",
  12060. "🚵🏼",
  12061. "🚵🏽‍♀️",
  12062. "🚵🏽‍♂️",
  12063. "🚵🏽",
  12064. "🚵🏾‍♀️",
  12065. "🚵🏾‍♂️",
  12066. "🚵🏾",
  12067. "🚵🏿‍♀️",
  12068. "🚵🏿‍♂️",
  12069. "🚵🏿",
  12070. "🚵‍♀️",
  12071. "🚵‍♂️",
  12072. "🚵",
  12073. "🚶🏻‍♀️",
  12074. "🚶🏻‍♂️",
  12075. "🚶🏻",
  12076. "🚶🏼‍♀️",
  12077. "🚶🏼‍♂️",
  12078. "🚶🏼",
  12079. "🚶🏽‍♀️",
  12080. "🚶🏽‍♂️",
  12081. "🚶🏽",
  12082. "🚶🏾‍♀️",
  12083. "🚶🏾‍♂️",
  12084. "🚶🏾",
  12085. "🚶🏿‍♀️",
  12086. "🚶🏿‍♂️",
  12087. "🚶🏿",
  12088. "🚶‍♀️",
  12089. "🚶‍♂️",
  12090. "🚶",
  12091. "🚷",
  12092. "🚸",
  12093. "🚹",
  12094. "🚺",
  12095. "🚻",
  12096. "🚼",
  12097. "🚽",
  12098. "🚾",
  12099. "🚿",
  12100. "🛀🏻",
  12101. "🛀🏼",
  12102. "🛀🏽",
  12103. "🛀🏾",
  12104. "🛀🏿",
  12105. "🛀",
  12106. "🛁",
  12107. "🛂",
  12108. "🛃",
  12109. "🛄",
  12110. "🛅",
  12111. "🛋️",
  12112. "🛌🏻",
  12113. "🛌🏼",
  12114. "🛌🏽",
  12115. "🛌🏾",
  12116. "🛌🏿",
  12117. "🛌",
  12118. "🛍️",
  12119. "🛎️",
  12120. "🛏️",
  12121. "🛐",
  12122. "🛑",
  12123. "🛒",
  12124. "🛕",
  12125. "🛠️",
  12126. "🛡️",
  12127. "🛢️",
  12128. "🛣️",
  12129. "🛤️",
  12130. "🛥️",
  12131. "🛩️",
  12132. "🛫",
  12133. "🛬",
  12134. "🛰️",
  12135. "🛳️",
  12136. "🛴",
  12137. "🛵",
  12138. "🛶",
  12139. "🛷",
  12140. "🛸",
  12141. "🛹",
  12142. "🛺",
  12143. "🟠",
  12144. "🟡",
  12145. "🟢",
  12146. "🟣",
  12147. "🟤",
  12148. "🟥",
  12149. "🟦",
  12150. "🟧",
  12151. "🟨",
  12152. "🟩",
  12153. "🟪",
  12154. "🟫",
  12155. "🤍",
  12156. "🤎",
  12157. "🤏🏻",
  12158. "🤏🏼",
  12159. "🤏🏽",
  12160. "🤏🏾",
  12161. "🤏🏿",
  12162. "🤏",
  12163. "🤐",
  12164. "🤑",
  12165. "🤒",
  12166. "🤓",
  12167. "🤔",
  12168. "🤕",
  12169. "🤖",
  12170. "🤗",
  12171. "🤘🏻",
  12172. "🤘🏼",
  12173. "🤘🏽",
  12174. "🤘🏾",
  12175. "🤘🏿",
  12176. "🤘",
  12177. "🤙🏻",
  12178. "🤙🏼",
  12179. "🤙🏽",
  12180. "🤙🏾",
  12181. "🤙🏿",
  12182. "🤙",
  12183. "🤚🏻",
  12184. "🤚🏼",
  12185. "🤚🏽",
  12186. "🤚🏾",
  12187. "🤚🏿",
  12188. "🤚",
  12189. "🤛🏻",
  12190. "🤛🏼",
  12191. "🤛🏽",
  12192. "🤛🏾",
  12193. "🤛🏿",
  12194. "🤛",
  12195. "🤜🏻",
  12196. "🤜🏼",
  12197. "🤜🏽",
  12198. "🤜🏾",
  12199. "🤜🏿",
  12200. "🤜",
  12201. "🤝",
  12202. "🤞🏻",
  12203. "🤞🏼",
  12204. "🤞🏽",
  12205. "🤞🏾",
  12206. "🤞🏿",
  12207. "🤞",
  12208. "🤟🏻",
  12209. "🤟🏼",
  12210. "🤟🏽",
  12211. "🤟🏾",
  12212. "🤟🏿",
  12213. "🤟",
  12214. "🤠",
  12215. "🤡",
  12216. "🤢",
  12217. "🤣",
  12218. "🤤",
  12219. "🤥",
  12220. "🤦🏻‍♀️",
  12221. "🤦🏻‍♂️",
  12222. "🤦🏻",
  12223. "🤦🏼‍♀️",
  12224. "🤦🏼‍♂️",
  12225. "🤦🏼",
  12226. "🤦🏽‍♀️",
  12227. "🤦🏽‍♂️",
  12228. "🤦🏽",
  12229. "🤦🏾‍♀️",
  12230. "🤦🏾‍♂️",
  12231. "🤦🏾",
  12232. "🤦🏿‍♀️",
  12233. "🤦🏿‍♂️",
  12234. "🤦🏿",
  12235. "🤦‍♀️",
  12236. "🤦‍♂️",
  12237. "🤦",
  12238. "🤧",
  12239. "🤨",
  12240. "🤩",
  12241. "🤪",
  12242. "🤫",
  12243. "🤬",
  12244. "🤭",
  12245. "🤮",
  12246. "🤯",
  12247. "🤰🏻",
  12248. "🤰🏼",
  12249. "🤰🏽",
  12250. "🤰🏾",
  12251. "🤰🏿",
  12252. "🤰",
  12253. "🤱🏻",
  12254. "🤱🏼",
  12255. "🤱🏽",
  12256. "🤱🏾",
  12257. "🤱🏿",
  12258. "🤱",
  12259. "🤲🏻",
  12260. "🤲🏼",
  12261. "🤲🏽",
  12262. "🤲🏾",
  12263. "🤲🏿",
  12264. "🤲",
  12265. "🤳🏻",
  12266. "🤳🏼",
  12267. "🤳🏽",
  12268. "🤳🏾",
  12269. "🤳🏿",
  12270. "🤳",
  12271. "🤴🏻",
  12272. "🤴🏼",
  12273. "🤴🏽",
  12274. "🤴🏾",
  12275. "🤴🏿",
  12276. "🤴",
  12277. "🤵🏻‍♀️",
  12278. "🤵🏻‍♂️",
  12279. "🤵🏻",
  12280. "🤵🏼‍♀️",
  12281. "🤵🏼‍♂️",
  12282. "🤵🏼",
  12283. "🤵🏽‍♀️",
  12284. "🤵🏽‍♂️",
  12285. "🤵🏽",
  12286. "🤵🏾‍♀️",
  12287. "🤵🏾‍♂️",
  12288. "🤵🏾",
  12289. "🤵🏿‍♀️",
  12290. "🤵🏿‍♂️",
  12291. "🤵🏿",
  12292. "🤵‍♀️",
  12293. "🤵‍♂️",
  12294. "🤵",
  12295. "🤶🏻",
  12296. "🤶🏼",
  12297. "🤶🏽",
  12298. "🤶🏾",
  12299. "🤶🏿",
  12300. "🤶",
  12301. "🤷🏻‍♀️",
  12302. "🤷🏻‍♂️",
  12303. "🤷🏻",
  12304. "🤷🏼‍♀️",
  12305. "🤷🏼‍♂️",
  12306. "🤷🏼",
  12307. "🤷🏽‍♀️",
  12308. "🤷🏽‍♂️",
  12309. "🤷🏽",
  12310. "🤷🏾‍♀️",
  12311. "🤷🏾‍♂️",
  12312. "🤷🏾",
  12313. "🤷🏿‍♀️",
  12314. "🤷🏿‍♂️",
  12315. "🤷🏿",
  12316. "🤷‍♀️",
  12317. "🤷‍♂️",
  12318. "🤷",
  12319. "🤸🏻‍♀️",
  12320. "🤸🏻‍♂️",
  12321. "🤸🏻",
  12322. "🤸🏼‍♀️",
  12323. "🤸🏼‍♂️",
  12324. "🤸🏼",
  12325. "🤸🏽‍♀️",
  12326. "🤸🏽‍♂️",
  12327. "🤸🏽",
  12328. "🤸🏾‍♀️",
  12329. "🤸🏾‍♂️",
  12330. "🤸🏾",
  12331. "🤸🏿‍♀️",
  12332. "🤸🏿‍♂️",
  12333. "🤸🏿",
  12334. "🤸‍♀️",
  12335. "🤸‍♂️",
  12336. "🤸",
  12337. "🤹🏻‍♀️",
  12338. "🤹🏻‍♂️",
  12339. "🤹🏻",
  12340. "🤹🏼‍♀️",
  12341. "🤹🏼‍♂️",
  12342. "🤹🏼",
  12343. "🤹🏽‍♀️",
  12344. "🤹🏽‍♂️",
  12345. "🤹🏽",
  12346. "🤹🏾‍♀️",
  12347. "🤹🏾‍♂️",
  12348. "🤹🏾",
  12349. "🤹🏿‍♀️",
  12350. "🤹🏿‍♂️",
  12351. "🤹🏿",
  12352. "🤹‍♀️",
  12353. "🤹‍♂️",
  12354. "🤹",
  12355. "🤺",
  12356. "🤼‍♀️",
  12357. "🤼‍♂️",
  12358. "🤼",
  12359. "🤽🏻‍♀️",
  12360. "🤽🏻‍♂️",
  12361. "🤽🏻",
  12362. "🤽🏼‍♀️",
  12363. "🤽🏼‍♂️",
  12364. "🤽🏼",
  12365. "🤽🏽‍♀️",
  12366. "🤽🏽‍♂️",
  12367. "🤽🏽",
  12368. "🤽🏾‍♀️",
  12369. "🤽🏾‍♂️",
  12370. "🤽🏾",
  12371. "🤽🏿‍♀️",
  12372. "🤽🏿‍♂️",
  12373. "🤽🏿",
  12374. "🤽‍♀️",
  12375. "🤽‍♂️",
  12376. "🤽",
  12377. "🤾🏻‍♀️",
  12378. "🤾🏻‍♂️",
  12379. "🤾🏻",
  12380. "🤾🏼‍♀️",
  12381. "🤾🏼‍♂️",
  12382. "🤾🏼",
  12383. "🤾🏽‍♀️",
  12384. "🤾🏽‍♂️",
  12385. "🤾🏽",
  12386. "🤾🏾‍♀️",
  12387. "🤾🏾‍♂️",
  12388. "🤾🏾",
  12389. "🤾🏿‍♀️",
  12390. "🤾🏿‍♂️",
  12391. "🤾🏿",
  12392. "🤾‍♀️",
  12393. "🤾‍♂️",
  12394. "🤾",
  12395. "🤿",
  12396. "🥀",
  12397. "🥁",
  12398. "🥂",
  12399. "🥃",
  12400. "🥄",
  12401. "🥅",
  12402. "🥇",
  12403. "🥈",
  12404. "🥉",
  12405. "🥊",
  12406. "🥋",
  12407. "🥌",
  12408. "🥍",
  12409. "🥎",
  12410. "🥏",
  12411. "🥐",
  12412. "🥑",
  12413. "🥒",
  12414. "🥓",
  12415. "🥔",
  12416. "🥕",
  12417. "🥖",
  12418. "🥗",
  12419. "🥘",
  12420. "🥙",
  12421. "🥚",
  12422. "🥛",
  12423. "🥜",
  12424. "🥝",
  12425. "🥞",
  12426. "🥟",
  12427. "🥠",
  12428. "🥡",
  12429. "🥢",
  12430. "🥣",
  12431. "🥤",
  12432. "🥥",
  12433. "🥦",
  12434. "🥧",
  12435. "🥨",
  12436. "🥩",
  12437. "🥪",
  12438. "🥫",
  12439. "🥬",
  12440. "🥭",
  12441. "🥮",
  12442. "🥯",
  12443. "🥰",
  12444. "🥱",
  12445. "🥳",
  12446. "🥴",
  12447. "🥵",
  12448. "🥶",
  12449. "🥺",
  12450. "🥻",
  12451. "🥼",
  12452. "🥽",
  12453. "🥾",
  12454. "🥿",
  12455. "🦀",
  12456. "🦁",
  12457. "🦂",
  12458. "🦃",
  12459. "🦄",
  12460. "🦅",
  12461. "🦆",
  12462. "🦇",
  12463. "🦈",
  12464. "🦉",
  12465. "🦊",
  12466. "🦋",
  12467. "🦌",
  12468. "🦍",
  12469. "🦎",
  12470. "🦏",
  12471. "🦐",
  12472. "🦑",
  12473. "🦒",
  12474. "🦓",
  12475. "🦔",
  12476. "🦕",
  12477. "🦖",
  12478. "🦗",
  12479. "🦘",
  12480. "🦙",
  12481. "🦚",
  12482. "🦛",
  12483. "🦜",
  12484. "🦝",
  12485. "🦞",
  12486. "🦟",
  12487. "🦠",
  12488. "🦡",
  12489. "🦢",
  12490. "🦥",
  12491. "🦦",
  12492. "🦧",
  12493. "🦨",
  12494. "🦩",
  12495. "🦪",
  12496. "🦮",
  12497. "🦯",
  12498. "🦰",
  12499. "🦱",
  12500. "🦲",
  12501. "🦳",
  12502. "🦴",
  12503. "🦵🏻",
  12504. "🦵🏼",
  12505. "🦵🏽",
  12506. "🦵🏾",
  12507. "🦵🏿",
  12508. "🦵",
  12509. "🦶🏻",
  12510. "🦶🏼",
  12511. "🦶🏽",
  12512. "🦶🏾",
  12513. "🦶🏿",
  12514. "🦶",
  12515. "🦷",
  12516. "🦸🏻‍♀️",
  12517. "🦸🏻‍♂️",
  12518. "🦸🏻",
  12519. "🦸🏼‍♀️",
  12520. "🦸🏼‍♂️",
  12521. "🦸🏼",
  12522. "🦸🏽‍♀️",
  12523. "🦸🏽‍♂️",
  12524. "🦸🏽",
  12525. "🦸🏾‍♀️",
  12526. "🦸🏾‍♂️",
  12527. "🦸🏾",
  12528. "🦸🏿‍♀️",
  12529. "🦸🏿‍♂️",
  12530. "🦸🏿",
  12531. "🦸‍♀️",
  12532. "🦸‍♂️",
  12533. "🦸",
  12534. "🦹🏻‍♀️",
  12535. "🦹🏻‍♂️",
  12536. "🦹🏻",
  12537. "🦹🏼‍♀️",
  12538. "🦹🏼‍♂️",
  12539. "🦹🏼",
  12540. "🦹🏽‍♀️",
  12541. "🦹🏽‍♂️",
  12542. "🦹🏽",
  12543. "🦹🏾‍♀️",
  12544. "🦹🏾‍♂️",
  12545. "🦹🏾",
  12546. "🦹🏿‍♀️",
  12547. "🦹🏿‍♂️",
  12548. "🦹🏿",
  12549. "🦹‍♀️",
  12550. "🦹‍♂️",
  12551. "🦹",
  12552. "🦺",
  12553. "🦻🏻",
  12554. "🦻🏼",
  12555. "🦻🏽",
  12556. "🦻🏾",
  12557. "🦻🏿",
  12558. "🦻",
  12559. "🦼",
  12560. "🦽",
  12561. "🦾",
  12562. "🦿",
  12563. "🧀",
  12564. "🧁",
  12565. "🧂",
  12566. "🧃",
  12567. "🧄",
  12568. "🧅",
  12569. "🧆",
  12570. "🧇",
  12571. "🧈",
  12572. "🧉",
  12573. "🧊",
  12574. "🧍🏻‍♀️",
  12575. "🧍🏻‍♂️",
  12576. "🧍🏻",
  12577. "🧍🏼‍♀️",
  12578. "🧍🏼‍♂️",
  12579. "🧍🏼",
  12580. "🧍🏽‍♀️",
  12581. "🧍🏽‍♂️",
  12582. "🧍🏽",
  12583. "🧍🏾‍♀️",
  12584. "🧍🏾‍♂️",
  12585. "🧍🏾",
  12586. "🧍🏿‍♀️",
  12587. "🧍🏿‍♂️",
  12588. "🧍🏿",
  12589. "🧍‍♀️",
  12590. "🧍‍♂️",
  12591. "🧍",
  12592. "🧎🏻‍♀️",
  12593. "🧎🏻‍♂️",
  12594. "🧎🏻",
  12595. "🧎🏼‍♀️",
  12596. "🧎🏼‍♂️",
  12597. "🧎🏼",
  12598. "🧎🏽‍♀️",
  12599. "🧎🏽‍♂️",
  12600. "🧎🏽",
  12601. "🧎🏾‍♀️",
  12602. "🧎🏾‍♂️",
  12603. "🧎🏾",
  12604. "🧎🏿‍♀️",
  12605. "🧎🏿‍♂️",
  12606. "🧎🏿",
  12607. "🧎‍♀️",
  12608. "🧎‍♂️",
  12609. "🧎",
  12610. "🧏🏻‍♀️",
  12611. "🧏🏻‍♂️",
  12612. "🧏🏻",
  12613. "🧏🏼‍♀️",
  12614. "🧏🏼‍♂️",
  12615. "🧏🏼",
  12616. "🧏🏽‍♀️",
  12617. "🧏🏽‍♂️",
  12618. "🧏🏽",
  12619. "🧏🏾‍♀️",
  12620. "🧏🏾‍♂️",
  12621. "🧏🏾",
  12622. "🧏🏿‍♀️",
  12623. "🧏🏿‍♂️",
  12624. "🧏🏿",
  12625. "🧏‍♀️",
  12626. "🧏‍♂️",
  12627. "🧏",
  12628. "🧐",
  12629. "🧑🏻‍🤝‍🧑🏻",
  12630. "🧑🏻",
  12631. "🧑🏼‍🤝‍🧑🏻",
  12632. "🧑🏼‍🤝‍🧑🏼",
  12633. "🧑🏼",
  12634. "🧑🏽‍🤝‍🧑🏻",
  12635. "🧑🏽‍🤝‍🧑🏼",
  12636. "🧑🏽‍🤝‍🧑🏽",
  12637. "🧑🏽",
  12638. "🧑🏾‍🤝‍🧑🏻",
  12639. "🧑🏾‍🤝‍🧑🏼",
  12640. "🧑🏾‍🤝‍🧑🏽",
  12641. "🧑🏾‍🤝‍🧑🏾",
  12642. "🧑🏾",
  12643. "🧑🏿‍🤝‍🧑🏻",
  12644. "🧑🏿‍🤝‍🧑🏼",
  12645. "🧑🏿‍🤝‍🧑🏽",
  12646. "🧑🏿‍🤝‍🧑🏾",
  12647. "🧑🏿‍🤝‍🧑🏿",
  12648. "🧑🏿",
  12649. "🧑‍🤝‍🧑",
  12650. "🧑",
  12651. "🧒🏻",
  12652. "🧒🏼",
  12653. "🧒🏽",
  12654. "🧒🏾",
  12655. "🧒🏿",
  12656. "🧒",
  12657. "🧓🏻",
  12658. "🧓🏼",
  12659. "🧓🏽",
  12660. "🧓🏾",
  12661. "🧓🏿",
  12662. "🧓",
  12663. "🧔🏻",
  12664. "🧔🏼",
  12665. "🧔🏽",
  12666. "🧔🏾",
  12667. "🧔🏿",
  12668. "🧔",
  12669. "🧕🏻",
  12670. "🧕🏼",
  12671. "🧕🏽",
  12672. "🧕🏾",
  12673. "🧕🏿",
  12674. "🧕",
  12675. "🧖🏻‍♀️",
  12676. "🧖🏻‍♂️",
  12677. "🧖🏻",
  12678. "🧖🏼‍♀️",
  12679. "🧖🏼‍♂️",
  12680. "🧖🏼",
  12681. "🧖🏽‍♀️",
  12682. "🧖🏽‍♂️",
  12683. "🧖🏽",
  12684. "🧖🏾‍♀️",
  12685. "🧖🏾‍♂️",
  12686. "🧖🏾",
  12687. "🧖🏿‍♀️",
  12688. "🧖🏿‍♂️",
  12689. "🧖🏿",
  12690. "🧖‍♀️",
  12691. "🧖‍♂️",
  12692. "🧖",
  12693. "🧗🏻‍♀️",
  12694. "🧗🏻‍♂️",
  12695. "🧗🏻",
  12696. "🧗🏼‍♀️",
  12697. "🧗🏼‍♂️",
  12698. "🧗🏼",
  12699. "🧗🏽‍♀️",
  12700. "🧗🏽‍♂️",
  12701. "🧗🏽",
  12702. "🧗🏾‍♀️",
  12703. "🧗🏾‍♂️",
  12704. "🧗🏾",
  12705. "🧗🏿‍♀️",
  12706. "🧗🏿‍♂️",
  12707. "🧗🏿",
  12708. "🧗‍♀️",
  12709. "🧗‍♂️",
  12710. "🧗",
  12711. "🧘🏻‍♀️",
  12712. "🧘🏻‍♂️",
  12713. "🧘🏻",
  12714. "🧘🏼‍♀️",
  12715. "🧘🏼‍♂️",
  12716. "🧘🏼",
  12717. "🧘🏽‍♀️",
  12718. "🧘🏽‍♂️",
  12719. "🧘🏽",
  12720. "🧘🏾‍♀️",
  12721. "🧘🏾‍♂️",
  12722. "🧘🏾",
  12723. "🧘🏿‍♀️",
  12724. "🧘🏿‍♂️",
  12725. "🧘🏿",
  12726. "🧘‍♀️",
  12727. "🧘‍♂️",
  12728. "🧘",
  12729. "🧙🏻‍♀️",
  12730. "🧙🏻‍♂️",
  12731. "🧙🏻",
  12732. "🧙🏼‍♀️",
  12733. "🧙🏼‍♂️",
  12734. "🧙🏼",
  12735. "🧙🏽‍♀️",
  12736. "🧙🏽‍♂️",
  12737. "🧙🏽",
  12738. "🧙🏾‍♀️",
  12739. "🧙🏾‍♂️",
  12740. "🧙🏾",
  12741. "🧙🏿‍♀️",
  12742. "🧙🏿‍♂️",
  12743. "🧙🏿",
  12744. "🧙‍♀️",
  12745. "🧙‍♂️",
  12746. "🧙",
  12747. "🧚🏻‍♀️",
  12748. "🧚🏻‍♂️",
  12749. "🧚🏻",
  12750. "🧚🏼‍♀️",
  12751. "🧚🏼‍♂️",
  12752. "🧚🏼",
  12753. "🧚🏽‍♀️",
  12754. "🧚🏽‍♂️",
  12755. "🧚🏽",
  12756. "🧚🏾‍♀️",
  12757. "🧚🏾‍♂️",
  12758. "🧚🏾",
  12759. "🧚🏿‍♀️",
  12760. "🧚🏿‍♂️",
  12761. "🧚🏿",
  12762. "🧚‍♀️",
  12763. "🧚‍♂️",
  12764. "🧚",
  12765. "🧛🏻‍♀️",
  12766. "🧛🏻‍♂️",
  12767. "🧛🏻",
  12768. "🧛🏼‍♀️",
  12769. "🧛🏼‍♂️",
  12770. "🧛🏼",
  12771. "🧛🏽‍♀️",
  12772. "🧛🏽‍♂️",
  12773. "🧛🏽",
  12774. "🧛🏾‍♀️",
  12775. "🧛🏾‍♂️",
  12776. "🧛🏾",
  12777. "🧛🏿‍♀️",
  12778. "🧛🏿‍♂️",
  12779. "🧛🏿",
  12780. "🧛‍♀️",
  12781. "🧛‍♂️",
  12782. "🧛",
  12783. "🧜🏻‍♀️",
  12784. "🧜🏻‍♂️",
  12785. "🧜🏻",
  12786. "🧜🏼‍♀️",
  12787. "🧜🏼‍♂️",
  12788. "🧜🏼",
  12789. "🧜🏽‍♀️",
  12790. "🧜🏽‍♂️",
  12791. "🧜🏽",
  12792. "🧜🏾‍♀️",
  12793. "🧜🏾‍♂️",
  12794. "🧜🏾",
  12795. "🧜🏿‍♀️",
  12796. "🧜🏿‍♂️",
  12797. "🧜🏿",
  12798. "🧜‍♀️",
  12799. "🧜‍♂️",
  12800. "🧜",
  12801. "🧝🏻‍♀️",
  12802. "🧝🏻‍♂️",
  12803. "🧝🏻",
  12804. "🧝🏼‍♀️",
  12805. "🧝🏼‍♂️",
  12806. "🧝🏼",
  12807. "🧝🏽‍♀️",
  12808. "🧝🏽‍♂️",
  12809. "🧝🏽",
  12810. "🧝🏾‍♀️",
  12811. "🧝🏾‍♂️",
  12812. "🧝🏾",
  12813. "🧝🏿‍♀️",
  12814. "🧝🏿‍♂️",
  12815. "🧝🏿",
  12816. "🧝‍♀️",
  12817. "🧝‍♂️",
  12818. "🧝",
  12819. "🧞‍♀️",
  12820. "🧞‍♂️",
  12821. "🧞",
  12822. "🧟‍♀️",
  12823. "🧟‍♂️",
  12824. "🧟",
  12825. "🧠",
  12826. "🧡",
  12827. "🧢",
  12828. "🧣",
  12829. "🧤",
  12830. "🧥",
  12831. "🧦",
  12832. "🧧",
  12833. "🧨",
  12834. "🧩",
  12835. "🧪",
  12836. "🧫",
  12837. "🧬",
  12838. "🧭",
  12839. "🧮",
  12840. "🧯",
  12841. "🧰",
  12842. "🧱",
  12843. "🧲",
  12844. "🧳",
  12845. "🧴",
  12846. "🧵",
  12847. "🧶",
  12848. "🧷",
  12849. "🧸",
  12850. "🧹",
  12851. "🧺",
  12852. "🧻",
  12853. "🧼",
  12854. "🧽",
  12855. "🧾",
  12856. "🧿",
  12857. "🩰",
  12858. "🩱",
  12859. "🩲",
  12860. "🩳",
  12861. "🩸",
  12862. "🩹",
  12863. "🩺",
  12864. "🪀",
  12865. "🪁",
  12866. "🪂",
  12867. "🪐",
  12868. "🪑",
  12869. "🪒",
  12870. "🪓",
  12871. "🪔",
  12872. "🪕",
  12873. "‼️",
  12874. "⁉️",
  12875. "™️",
  12876. "ℹ️",
  12877. "↔️",
  12878. "↕️",
  12879. "↖️",
  12880. "↗️",
  12881. "↘️",
  12882. "↙️",
  12883. "↩️",
  12884. "↪️",
  12885. "#⃣",
  12886. "⌚️",
  12887. "⌛️",
  12888. "⌨️",
  12889. "⏏️",
  12890. "⏩",
  12891. "⏪",
  12892. "⏫",
  12893. "⏬",
  12894. "⏭️",
  12895. "⏮️",
  12896. "⏯️",
  12897. "⏰",
  12898. "⏱️",
  12899. "⏲️",
  12900. "⏳",
  12901. "⏸️",
  12902. "⏹️",
  12903. "⏺️",
  12904. "Ⓜ️",
  12905. "▪️",
  12906. "▫️",
  12907. "▶️",
  12908. "◀️",
  12909. "◻️",
  12910. "◼️",
  12911. "◽️",
  12912. "◾️",
  12913. "☀️",
  12914. "☁️",
  12915. "☂️",
  12916. "☃️",
  12917. "☄️",
  12918. "☎️",
  12919. "☑️",
  12920. "☔️",
  12921. "☕️",
  12922. "☘️",
  12923. "☝🏻",
  12924. "☝🏼",
  12925. "☝🏽",
  12926. "☝🏾",
  12927. "☝🏿",
  12928. "☝️",
  12929. "☠️",
  12930. "☢️",
  12931. "☣️",
  12932. "☦️",
  12933. "☪️",
  12934. "☮️",
  12935. "☯️",
  12936. "☸️",
  12937. "☹️",
  12938. "☺️",
  12939. "♀️",
  12940. "♂️",
  12941. "♈️",
  12942. "♉️",
  12943. "♊️",
  12944. "♋️",
  12945. "♌️",
  12946. "♍️",
  12947. "♎️",
  12948. "♏️",
  12949. "♐️",
  12950. "♑️",
  12951. "♒️",
  12952. "♓️",
  12953. "♟️",
  12954. "♠️",
  12955. "♣️",
  12956. "♥️",
  12957. "♦️",
  12958. "♨️",
  12959. "♻️",
  12960. "♾",
  12961. "♿️",
  12962. "⚒️",
  12963. "⚓️",
  12964. "⚔️",
  12965. "⚕️",
  12966. "⚖️",
  12967. "⚗️",
  12968. "⚙️",
  12969. "⚛️",
  12970. "⚜️",
  12971. "⚠️",
  12972. "⚡️",
  12973. "⚪️",
  12974. "⚫️",
  12975. "⚰️",
  12976. "⚱️",
  12977. "⚽️",
  12978. "⚾️",
  12979. "⛄️",
  12980. "⛅️",
  12981. "⛈️",
  12982. "⛎",
  12983. "⛏️",
  12984. "⛑️",
  12985. "⛓️",
  12986. "⛔️",
  12987. "⛩️",
  12988. "⛪️",
  12989. "⛰️",
  12990. "⛱️",
  12991. "⛲️",
  12992. "⛳️",
  12993. "⛴️",
  12994. "⛵️",
  12995. "⛷🏻",
  12996. "⛷🏼",
  12997. "⛷🏽",
  12998. "⛷🏾",
  12999. "⛷🏿",
  13000. "⛷️",
  13001. "⛸️",
  13002. "⛹🏻‍♀️",
  13003. "⛹🏻‍♂️",
  13004. "⛹🏻",
  13005. "⛹🏼‍♀️",
  13006. "⛹🏼‍♂️",
  13007. "⛹🏼",
  13008. "⛹🏽‍♀️",
  13009. "⛹🏽‍♂️",
  13010. "⛹🏽",
  13011. "⛹🏾‍♀️",
  13012. "⛹🏾‍♂️",
  13013. "⛹🏾",
  13014. "⛹🏿‍♀️",
  13015. "⛹🏿‍♂️",
  13016. "⛹🏿",
  13017. "⛹️‍♀️",
  13018. "⛹️‍♂️",
  13019. "⛹️",
  13020. "⛺️",
  13021. "⛽️",
  13022. "✂️",
  13023. "✅",
  13024. "✈️",
  13025. "✉️",
  13026. "✊🏻",
  13027. "✊🏼",
  13028. "✊🏽",
  13029. "✊🏾",
  13030. "✊🏿",
  13031. "✊",
  13032. "✋🏻",
  13033. "✋🏼",
  13034. "✋🏽",
  13035. "✋🏾",
  13036. "✋🏿",
  13037. "✋",
  13038. "✌🏻",
  13039. "✌🏼",
  13040. "✌🏽",
  13041. "✌🏾",
  13042. "✌🏿",
  13043. "✌️",
  13044. "✍🏻",
  13045. "✍🏼",
  13046. "✍🏽",
  13047. "✍🏾",
  13048. "✍🏿",
  13049. "✍️",
  13050. "✏️",
  13051. "✒️",
  13052. "✔️",
  13053. "✖️",
  13054. "✝️",
  13055. "✡️",
  13056. "✨",
  13057. "✳️",
  13058. "✴️",
  13059. "❄️",
  13060. "❇️",
  13061. "❌",
  13062. "❎",
  13063. "❓",
  13064. "❔",
  13065. "❕",
  13066. "❗️",
  13067. "❣️",
  13068. "❤️",
  13069. "➕",
  13070. "➖",
  13071. "➗",
  13072. "➡️",
  13073. "➰",
  13074. "➿",
  13075. "⤴️",
  13076. "⤵️",
  13077. "*⃣",
  13078. "⬅️",
  13079. "⬆️",
  13080. "⬇️",
  13081. "⬛️",
  13082. "⬜️",
  13083. "⭐️",
  13084. "⭕️",
  13085. "0⃣",
  13086. "〰️",
  13087. "〽️",
  13088. "1⃣",
  13089. "2⃣",
  13090. "㊗️",
  13091. "㊙️",
  13092. "3⃣",
  13093. "4⃣",
  13094. "5⃣",
  13095. "6⃣",
  13096. "7⃣",
  13097. "8⃣",
  13098. "9⃣",
  13099. "©️",
  13100. "®️",
  13101. ""
  13102. ];
  13103. const emojiRegex = /[\uD800-\uDFFF]./;
  13104. const emojiList = emojisList.filter((emoji) => emojiRegex.test(emoji));
  13105. const emojiCache = {};
  13106. function encodeStringToEmoji(content, length) {
  13107. if (emojiCache[content]) {
  13108. return emojiCache[content];
  13109. }
  13110. length = length || 1;
  13111. const emojis = [];
  13112. do {
  13113. if (!emojiList.length) {
  13114. throw new Error('Ran out of emoji');
  13115. }
  13116. const index = Math.floor(Math.random() * emojiList.length);
  13117. emojis.push(emojiList[index]);
  13118. emojiList.splice(index, 1);
  13119. } while (--length > 0);
  13120. const emojiEncoding = emojis.join('');
  13121. emojiCache[content] = emojiEncoding;
  13122. return emojiEncoding;
  13123. }
  13124. function interpolateName(loaderContext, name, options) {
  13125. let filename;
  13126. const hasQuery =
  13127. loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1;
  13128. if (typeof name === 'function') {
  13129. filename = name(
  13130. loaderContext.resourcePath,
  13131. hasQuery ? loaderContext.resourceQuery : undefined
  13132. );
  13133. } else {
  13134. filename = name || '[hash].[ext]';
  13135. }
  13136. const context = options.context;
  13137. const content = options.content;
  13138. const regExp = options.regExp;
  13139. let ext = 'bin';
  13140. let basename = 'file';
  13141. let directory = '';
  13142. let folder = '';
  13143. let query = '';
  13144. if (loaderContext.resourcePath) {
  13145. const parsed = path__default.parse(loaderContext.resourcePath);
  13146. let resourcePath = loaderContext.resourcePath;
  13147. if (parsed.ext) {
  13148. ext = parsed.ext.substr(1);
  13149. }
  13150. if (parsed.dir) {
  13151. basename = parsed.name;
  13152. resourcePath = parsed.dir + path__default.sep;
  13153. }
  13154. if (typeof context !== 'undefined') {
  13155. directory = path__default
  13156. .relative(context, resourcePath + '_')
  13157. .replace(/\\/g, '/')
  13158. .replace(/\.\.(\/)?/g, '_$1');
  13159. directory = directory.substr(0, directory.length - 1);
  13160. } else {
  13161. directory = resourcePath.replace(/\\/g, '/').replace(/\.\.(\/)?/g, '_$1');
  13162. }
  13163. if (directory.length === 1) {
  13164. directory = '';
  13165. } else if (directory.length > 1) {
  13166. folder = path__default.basename(directory);
  13167. }
  13168. }
  13169. if (loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1) {
  13170. query = loaderContext.resourceQuery;
  13171. const hashIdx = query.indexOf('#');
  13172. if (hashIdx >= 0) {
  13173. query = query.substr(0, hashIdx);
  13174. }
  13175. }
  13176. let url = filename;
  13177. if (content) {
  13178. // Match hash template
  13179. url = url
  13180. // `hash` and `contenthash` are same in `loader-utils` context
  13181. // let's keep `hash` for backward compatibility
  13182. .replace(
  13183. /\[(?:([^:\]]+):)?(?:hash|contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi,
  13184. (all, hashType, digestType, maxLength) =>
  13185. getHashDigest_1(content, hashType, digestType, parseInt(maxLength, 10))
  13186. )
  13187. .replace(/\[emoji(?::(\d+))?\]/gi, (all, length) =>
  13188. encodeStringToEmoji(content, parseInt(length, 10))
  13189. );
  13190. }
  13191. url = url
  13192. .replace(/\[ext\]/gi, () => ext)
  13193. .replace(/\[name\]/gi, () => basename)
  13194. .replace(/\[path\]/gi, () => directory)
  13195. .replace(/\[folder\]/gi, () => folder)
  13196. .replace(/\[query\]/gi, () => query);
  13197. if (regExp && loaderContext.resourcePath) {
  13198. const match = loaderContext.resourcePath.match(new RegExp(regExp));
  13199. match &&
  13200. match.forEach((matched, i) => {
  13201. url = url.replace(new RegExp('\\[' + i + '\\]', 'ig'), matched);
  13202. });
  13203. }
  13204. if (
  13205. typeof loaderContext.options === 'object' &&
  13206. typeof loaderContext.options.customInterpolateName === 'function'
  13207. ) {
  13208. url = loaderContext.options.customInterpolateName.call(
  13209. loaderContext,
  13210. url,
  13211. name,
  13212. options
  13213. );
  13214. }
  13215. return url;
  13216. }
  13217. var interpolateName_1 = interpolateName;
  13218. var getOptions_1$1 = getOptions_1;
  13219. var parseQuery_1$1 = parseQuery_1;
  13220. var stringifyRequest_1$1 = stringifyRequest_1;
  13221. var getRemainingRequest_1$1 = getRemainingRequest_1;
  13222. var getCurrentRequest_1$1 = getCurrentRequest_1;
  13223. var isUrlRequest_1$1 = isUrlRequest_1;
  13224. var urlToRequest_1$1 = urlToRequest_1;
  13225. var parseString_1$1 = parseString_1;
  13226. var getHashDigest_1$1 = getHashDigest_1;
  13227. var interpolateName_1$1 = interpolateName_1;
  13228. var lib$1 = {
  13229. getOptions: getOptions_1$1,
  13230. parseQuery: parseQuery_1$1,
  13231. stringifyRequest: stringifyRequest_1$1,
  13232. getRemainingRequest: getRemainingRequest_1$1,
  13233. getCurrentRequest: getCurrentRequest_1$1,
  13234. isUrlRequest: isUrlRequest_1$1,
  13235. urlToRequest: urlToRequest_1$1,
  13236. parseString: parseString_1$1,
  13237. getHashDigest: getHashDigest_1$1,
  13238. interpolateName: interpolateName_1$1
  13239. };
  13240. var interpolateName$1 = lib$1.interpolateName;
  13241. /**
  13242. * @param {string} pattern
  13243. * @param {object} options
  13244. * @param {string} options.context
  13245. * @param {string} options.hashPrefix
  13246. * @return {function}
  13247. */
  13248. var genericNames = function createGenerator(pattern, options) {
  13249. options = options || {};
  13250. var context =
  13251. options && typeof options.context === "string"
  13252. ? options.context
  13253. : process.cwd();
  13254. var hashPrefix =
  13255. options && typeof options.hashPrefix === "string" ? options.hashPrefix : "";
  13256. /**
  13257. * @param {string} localName Usually a class name
  13258. * @param {string} filepath Absolute path
  13259. * @return {string}
  13260. */
  13261. return function generate(localName, filepath) {
  13262. var name = pattern.replace(/\[local\]/gi, localName);
  13263. var loaderContext = {
  13264. resourcePath: filepath
  13265. };
  13266. var loaderOptions = {
  13267. content:
  13268. hashPrefix +
  13269. path__default.relative(context, filepath).replace(/\\/g, "/") +
  13270. "+" +
  13271. localName,
  13272. context: context
  13273. };
  13274. var genericName = interpolateName$1(loaderContext, name, loaderOptions);
  13275. return genericName
  13276. .replace(new RegExp("[^a-zA-Z0-9\\-_\u00A0-\uFFFF]", "g"), "-")
  13277. .replace(/^((-?[0-9])|--)/, "_$1");
  13278. };
  13279. };
  13280. var _default = unquote;
  13281. // copied from https://github.com/lakenen/node-unquote
  13282. var reg = /['"]/;
  13283. function unquote(str) {
  13284. if (!str) {
  13285. return "";
  13286. }
  13287. if (reg.test(str.charAt(0))) {
  13288. str = str.substr(1);
  13289. }
  13290. if (reg.test(str.charAt(str.length - 1))) {
  13291. str = str.substr(0, str.length - 1);
  13292. }
  13293. return str;
  13294. }
  13295. var unquote_1 = /*#__PURE__*/Object.defineProperty({
  13296. default: _default
  13297. }, '__esModule', {value: true});
  13298. var replaceAll_1 = replaceAll;
  13299. var matchConstName = /[$#]?[\w-\.]+/g;
  13300. function replaceAll(replacements, text) {
  13301. var matches = void 0;
  13302. while (matches = matchConstName.exec(text)) {
  13303. var replacement = replacements[matches[0]];
  13304. if (replacement) {
  13305. text = text.slice(0, matches.index) + replacement + text.slice(matchConstName.lastIndex);
  13306. matchConstName.lastIndex -= matches[0].length - replacement.length;
  13307. }
  13308. }
  13309. return text;
  13310. }
  13311. var _default$1 = function (css, translations) {
  13312. css.walkDecls(function (decl) {
  13313. return decl.value = replaceAll(translations, decl.value);
  13314. });
  13315. css.walkAtRules('media', function (atRule) {
  13316. return atRule.params = replaceAll(translations, atRule.params);
  13317. });
  13318. };
  13319. var lib$2 = /*#__PURE__*/Object.defineProperty({
  13320. replaceAll: replaceAll_1,
  13321. default: _default$1
  13322. }, '__esModule', {value: true});
  13323. var _icssReplaceSymbols2 = _interopRequireDefault(lib$2);
  13324. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13325. // Copied from https://github.com/css-modules/css-modules-loader-core
  13326. const importRegexp = /^:import\((.+)\)$/;
  13327. class Parser {
  13328. constructor(pathFetcher, trace) {
  13329. this.pathFetcher = pathFetcher;
  13330. this.plugin = this.plugin.bind(this);
  13331. this.exportTokens = {};
  13332. this.translations = {};
  13333. this.trace = trace;
  13334. }
  13335. plugin() {
  13336. const parser = this;
  13337. return {
  13338. postcssPlugin: "css-modules-parser",
  13339. OnceExit(css) {
  13340. return Promise.all(parser.fetchAllImports(css)).then(() => parser.linkImportedSymbols(css)).then(() => parser.extractExports(css));
  13341. }
  13342. };
  13343. }
  13344. fetchAllImports(css) {
  13345. let imports = [];
  13346. css.each(node => {
  13347. if (node.type == "rule" && node.selector.match(importRegexp)) {
  13348. imports.push(this.fetchImport(node, css.source.input.from, imports.length));
  13349. }
  13350. });
  13351. return imports;
  13352. }
  13353. linkImportedSymbols(css) {
  13354. (0, _icssReplaceSymbols2.default)(css, this.translations);
  13355. }
  13356. extractExports(css) {
  13357. css.each(node => {
  13358. if (node.type == "rule" && node.selector == ":export") this.handleExport(node);
  13359. });
  13360. }
  13361. handleExport(exportNode) {
  13362. exportNode.each(decl => {
  13363. if (decl.type == "decl") {
  13364. Object.keys(this.translations).forEach(translation => {
  13365. decl.value = decl.value.replace(translation, this.translations[translation]);
  13366. });
  13367. this.exportTokens[decl.prop] = decl.value;
  13368. }
  13369. });
  13370. exportNode.remove();
  13371. }
  13372. fetchImport(importNode, relativeTo, depNr) {
  13373. let file = importNode.selector.match(importRegexp)[1],
  13374. depTrace = this.trace + String.fromCharCode(depNr);
  13375. return this.pathFetcher(file, relativeTo, depTrace).then(exports => {
  13376. importNode.each(decl => {
  13377. if (decl.type == "decl") {
  13378. this.translations[decl.prop] = exports[decl.value];
  13379. }
  13380. });
  13381. importNode.remove();
  13382. }, err => console.log(err));
  13383. }
  13384. }
  13385. var _default$2 = Parser;
  13386. var parser$1 = /*#__PURE__*/Object.defineProperty({
  13387. default: _default$2
  13388. }, '__esModule', {value: true});
  13389. var _postcss2 = _interopRequireDefault$1(_postcss__default);
  13390. var _fs2 = _interopRequireDefault$1(fs__default);
  13391. var _path2 = _interopRequireDefault$1(path__default);
  13392. var _parser2 = _interopRequireDefault$1(parser$1);
  13393. function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13394. // Copied from https://github.com/css-modules/css-modules-loader-core
  13395. class Core {
  13396. constructor(plugins) {
  13397. this.plugins = plugins || Core.defaultPlugins;
  13398. }
  13399. load(sourceString, sourcePath, trace, pathFetcher) {
  13400. let parser = new _parser2.default(pathFetcher, trace);
  13401. return (0, _postcss2.default)(this.plugins.concat([parser.plugin()])).process(sourceString, { from: "/" + sourcePath }).then(result => {
  13402. return {
  13403. injectableSource: result.css,
  13404. exportTokens: parser.exportTokens
  13405. };
  13406. });
  13407. }
  13408. }
  13409. // Sorts dependencies in the following way:
  13410. // AAA comes before AA and A
  13411. // AB comes after AA and before A
  13412. // All Bs come after all As
  13413. // This ensures that the files are always returned in the following order:
  13414. // - In the order they were required, except
  13415. // - After all their dependencies
  13416. const traceKeySorter = (a, b) => {
  13417. if (a.length < b.length) {
  13418. return a < b.substring(0, a.length) ? -1 : 1;
  13419. } else if (a.length > b.length) {
  13420. return a.substring(0, b.length) <= b ? -1 : 1;
  13421. } else {
  13422. return a < b ? -1 : 1;
  13423. }
  13424. };
  13425. class FileSystemLoader {
  13426. constructor(root, plugins) {
  13427. this.root = root;
  13428. this.sources = {};
  13429. this.traces = {};
  13430. this.importNr = 0;
  13431. this.core = new Core(plugins);
  13432. this.tokensByFile = {};
  13433. }
  13434. fetch(_newPath, relativeTo, _trace) {
  13435. let newPath = _newPath.replace(/^["']|["']$/g, ""),
  13436. trace = _trace || String.fromCharCode(this.importNr++);
  13437. return new Promise((resolve, reject) => {
  13438. let relativeDir = _path2.default.dirname(relativeTo),
  13439. rootRelativePath = _path2.default.resolve(relativeDir, newPath),
  13440. fileRelativePath = _path2.default.resolve(_path2.default.join(this.root, relativeDir), newPath);
  13441. // if the path is not relative or absolute, try to resolve it in node_modules
  13442. if (newPath[0] !== "." && newPath[0] !== "/") {
  13443. try {
  13444. fileRelativePath = require.resolve(newPath);
  13445. } catch (e) {
  13446. // noop
  13447. }
  13448. }
  13449. const tokens = this.tokensByFile[fileRelativePath];
  13450. if (tokens) {
  13451. return resolve(tokens);
  13452. }
  13453. _fs2.default.readFile(fileRelativePath, "utf-8", (err, source) => {
  13454. if (err) reject(err);
  13455. this.core.load(source, rootRelativePath, trace, this.fetch.bind(this)).then(({ injectableSource, exportTokens }) => {
  13456. this.sources[fileRelativePath] = injectableSource;
  13457. this.traces[trace] = fileRelativePath;
  13458. this.tokensByFile[fileRelativePath] = exportTokens;
  13459. resolve(exportTokens);
  13460. }, reject);
  13461. });
  13462. });
  13463. }
  13464. get finalSource() {
  13465. const traces = this.traces;
  13466. const sources = this.sources;
  13467. let written = new Set();
  13468. return Object.keys(traces).sort(traceKeySorter).map(key => {
  13469. const filename = traces[key];
  13470. if (written.has(filename)) {
  13471. return null;
  13472. }
  13473. written.add(filename);
  13474. return sources[filename];
  13475. }).join("");
  13476. }
  13477. }
  13478. var _default$3 = FileSystemLoader;
  13479. var loader = /*#__PURE__*/Object.defineProperty({
  13480. default: _default$3
  13481. }, '__esModule', {value: true});
  13482. function hash(str) {
  13483. var hash = 5381,
  13484. i = str.length;
  13485. while(i) {
  13486. hash = (hash * 33) ^ str.charCodeAt(--i);
  13487. }
  13488. /* JavaScript does bitwise operations (like XOR, above) on 32-bit signed
  13489. * integers. Since we want the results to be always positive, convert the
  13490. * signed int to an unsigned by doing an unsigned bitshift. */
  13491. return hash >>> 0;
  13492. }
  13493. var stringHash = hash;
  13494. var _default$4 = generateScopedName;
  13495. var _stringHash2 = _interopRequireDefault$2(stringHash);
  13496. function _interopRequireDefault$2(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13497. function generateScopedName(name, filename, css) {
  13498. const i = css.indexOf(`.${name}`);
  13499. const lineNumber = css.substr(0, i).split(/[\r\n]/).length;
  13500. const hash = (0, _stringHash2.default)(css).toString(36).substr(0, 5);
  13501. return `_${name}_${hash}_${lineNumber}`;
  13502. }
  13503. var generateScopedName_1 = /*#__PURE__*/Object.defineProperty({
  13504. default: _default$4
  13505. }, '__esModule', {value: true});
  13506. var _default$5 = saveJSON;
  13507. function saveJSON(cssFile, json) {
  13508. return new Promise((resolve, reject) => {
  13509. (0, fs__default.writeFile)(`${cssFile}.json`, JSON.stringify(json), e => e ? reject(e) : resolve(json));
  13510. });
  13511. }
  13512. var saveJSON_1 = /*#__PURE__*/Object.defineProperty({
  13513. default: _default$5
  13514. }, '__esModule', {value: true});
  13515. var openParentheses = "(".charCodeAt(0);
  13516. var closeParentheses = ")".charCodeAt(0);
  13517. var singleQuote = "'".charCodeAt(0);
  13518. var doubleQuote = '"'.charCodeAt(0);
  13519. var backslash = "\\".charCodeAt(0);
  13520. var slash = "/".charCodeAt(0);
  13521. var comma = ",".charCodeAt(0);
  13522. var colon = ":".charCodeAt(0);
  13523. var star = "*".charCodeAt(0);
  13524. var uLower = "u".charCodeAt(0);
  13525. var uUpper = "U".charCodeAt(0);
  13526. var plus = "+".charCodeAt(0);
  13527. var isUnicodeRange = /^[a-f0-9?-]+$/i;
  13528. var parse$2 = function(input) {
  13529. var tokens = [];
  13530. var value = input;
  13531. var next,
  13532. quote,
  13533. prev,
  13534. token,
  13535. escape,
  13536. escapePos,
  13537. whitespacePos,
  13538. parenthesesOpenPos;
  13539. var pos = 0;
  13540. var code = value.charCodeAt(pos);
  13541. var max = value.length;
  13542. var stack = [{ nodes: tokens }];
  13543. var balanced = 0;
  13544. var parent;
  13545. var name = "";
  13546. var before = "";
  13547. var after = "";
  13548. while (pos < max) {
  13549. // Whitespaces
  13550. if (code <= 32) {
  13551. next = pos;
  13552. do {
  13553. next += 1;
  13554. code = value.charCodeAt(next);
  13555. } while (code <= 32);
  13556. token = value.slice(pos, next);
  13557. prev = tokens[tokens.length - 1];
  13558. if (code === closeParentheses && balanced) {
  13559. after = token;
  13560. } else if (prev && prev.type === "div") {
  13561. prev.after = token;
  13562. prev.sourceEndIndex += token.length;
  13563. } else if (
  13564. code === comma ||
  13565. code === colon ||
  13566. (code === slash &&
  13567. value.charCodeAt(next + 1) !== star &&
  13568. (!parent ||
  13569. (parent && parent.type === "function" && parent.value !== "calc")))
  13570. ) {
  13571. before = token;
  13572. } else {
  13573. tokens.push({
  13574. type: "space",
  13575. sourceIndex: pos,
  13576. sourceEndIndex: next,
  13577. value: token
  13578. });
  13579. }
  13580. pos = next;
  13581. // Quotes
  13582. } else if (code === singleQuote || code === doubleQuote) {
  13583. next = pos;
  13584. quote = code === singleQuote ? "'" : '"';
  13585. token = {
  13586. type: "string",
  13587. sourceIndex: pos,
  13588. quote: quote
  13589. };
  13590. do {
  13591. escape = false;
  13592. next = value.indexOf(quote, next + 1);
  13593. if (~next) {
  13594. escapePos = next;
  13595. while (value.charCodeAt(escapePos - 1) === backslash) {
  13596. escapePos -= 1;
  13597. escape = !escape;
  13598. }
  13599. } else {
  13600. value += quote;
  13601. next = value.length - 1;
  13602. token.unclosed = true;
  13603. }
  13604. } while (escape);
  13605. token.value = value.slice(pos + 1, next);
  13606. token.sourceEndIndex = token.unclosed ? next : next + 1;
  13607. tokens.push(token);
  13608. pos = next + 1;
  13609. code = value.charCodeAt(pos);
  13610. // Comments
  13611. } else if (code === slash && value.charCodeAt(pos + 1) === star) {
  13612. next = value.indexOf("*/", pos);
  13613. token = {
  13614. type: "comment",
  13615. sourceIndex: pos,
  13616. sourceEndIndex: next + 2
  13617. };
  13618. if (next === -1) {
  13619. token.unclosed = true;
  13620. next = value.length;
  13621. token.sourceEndIndex = next;
  13622. }
  13623. token.value = value.slice(pos + 2, next);
  13624. tokens.push(token);
  13625. pos = next + 2;
  13626. code = value.charCodeAt(pos);
  13627. // Operation within calc
  13628. } else if (
  13629. (code === slash || code === star) &&
  13630. parent &&
  13631. parent.type === "function" &&
  13632. parent.value === "calc"
  13633. ) {
  13634. token = value[pos];
  13635. tokens.push({
  13636. type: "word",
  13637. sourceIndex: pos - before.length,
  13638. sourceEndIndex: pos + token.length,
  13639. value: token
  13640. });
  13641. pos += 1;
  13642. code = value.charCodeAt(pos);
  13643. // Dividers
  13644. } else if (code === slash || code === comma || code === colon) {
  13645. token = value[pos];
  13646. tokens.push({
  13647. type: "div",
  13648. sourceIndex: pos - before.length,
  13649. sourceEndIndex: pos + token.length,
  13650. value: token,
  13651. before: before,
  13652. after: ""
  13653. });
  13654. before = "";
  13655. pos += 1;
  13656. code = value.charCodeAt(pos);
  13657. // Open parentheses
  13658. } else if (openParentheses === code) {
  13659. // Whitespaces after open parentheses
  13660. next = pos;
  13661. do {
  13662. next += 1;
  13663. code = value.charCodeAt(next);
  13664. } while (code <= 32);
  13665. parenthesesOpenPos = pos;
  13666. token = {
  13667. type: "function",
  13668. sourceIndex: pos - name.length,
  13669. value: name,
  13670. before: value.slice(parenthesesOpenPos + 1, next)
  13671. };
  13672. pos = next;
  13673. if (name === "url" && code !== singleQuote && code !== doubleQuote) {
  13674. next -= 1;
  13675. do {
  13676. escape = false;
  13677. next = value.indexOf(")", next + 1);
  13678. if (~next) {
  13679. escapePos = next;
  13680. while (value.charCodeAt(escapePos - 1) === backslash) {
  13681. escapePos -= 1;
  13682. escape = !escape;
  13683. }
  13684. } else {
  13685. value += ")";
  13686. next = value.length - 1;
  13687. token.unclosed = true;
  13688. }
  13689. } while (escape);
  13690. // Whitespaces before closed
  13691. whitespacePos = next;
  13692. do {
  13693. whitespacePos -= 1;
  13694. code = value.charCodeAt(whitespacePos);
  13695. } while (code <= 32);
  13696. if (parenthesesOpenPos < whitespacePos) {
  13697. if (pos !== whitespacePos + 1) {
  13698. token.nodes = [
  13699. {
  13700. type: "word",
  13701. sourceIndex: pos,
  13702. sourceEndIndex: whitespacePos + 1,
  13703. value: value.slice(pos, whitespacePos + 1)
  13704. }
  13705. ];
  13706. } else {
  13707. token.nodes = [];
  13708. }
  13709. if (token.unclosed && whitespacePos + 1 !== next) {
  13710. token.after = "";
  13711. token.nodes.push({
  13712. type: "space",
  13713. sourceIndex: whitespacePos + 1,
  13714. sourceEndIndex: next,
  13715. value: value.slice(whitespacePos + 1, next)
  13716. });
  13717. } else {
  13718. token.after = value.slice(whitespacePos + 1, next);
  13719. token.sourceEndIndex = next;
  13720. }
  13721. } else {
  13722. token.after = "";
  13723. token.nodes = [];
  13724. }
  13725. pos = next + 1;
  13726. token.sourceEndIndex = token.unclosed ? next : pos;
  13727. code = value.charCodeAt(pos);
  13728. tokens.push(token);
  13729. } else {
  13730. balanced += 1;
  13731. token.after = "";
  13732. token.sourceEndIndex = pos + 1;
  13733. tokens.push(token);
  13734. stack.push(token);
  13735. tokens = token.nodes = [];
  13736. parent = token;
  13737. }
  13738. name = "";
  13739. // Close parentheses
  13740. } else if (closeParentheses === code && balanced) {
  13741. pos += 1;
  13742. code = value.charCodeAt(pos);
  13743. parent.after = after;
  13744. parent.sourceEndIndex += after.length;
  13745. after = "";
  13746. balanced -= 1;
  13747. stack[stack.length - 1].sourceEndIndex = pos;
  13748. stack.pop();
  13749. parent = stack[balanced];
  13750. tokens = parent.nodes;
  13751. // Words
  13752. } else {
  13753. next = pos;
  13754. do {
  13755. if (code === backslash) {
  13756. next += 1;
  13757. }
  13758. next += 1;
  13759. code = value.charCodeAt(next);
  13760. } while (
  13761. next < max &&
  13762. !(
  13763. code <= 32 ||
  13764. code === singleQuote ||
  13765. code === doubleQuote ||
  13766. code === comma ||
  13767. code === colon ||
  13768. code === slash ||
  13769. code === openParentheses ||
  13770. (code === star &&
  13771. parent &&
  13772. parent.type === "function" &&
  13773. parent.value === "calc") ||
  13774. (code === slash &&
  13775. parent.type === "function" &&
  13776. parent.value === "calc") ||
  13777. (code === closeParentheses && balanced)
  13778. )
  13779. );
  13780. token = value.slice(pos, next);
  13781. if (openParentheses === code) {
  13782. name = token;
  13783. } else if (
  13784. (uLower === token.charCodeAt(0) || uUpper === token.charCodeAt(0)) &&
  13785. plus === token.charCodeAt(1) &&
  13786. isUnicodeRange.test(token.slice(2))
  13787. ) {
  13788. tokens.push({
  13789. type: "unicode-range",
  13790. sourceIndex: pos,
  13791. sourceEndIndex: next,
  13792. value: token
  13793. });
  13794. } else {
  13795. tokens.push({
  13796. type: "word",
  13797. sourceIndex: pos,
  13798. sourceEndIndex: next,
  13799. value: token
  13800. });
  13801. }
  13802. pos = next;
  13803. }
  13804. }
  13805. for (pos = stack.length - 1; pos; pos -= 1) {
  13806. stack[pos].unclosed = true;
  13807. stack[pos].sourceEndIndex = value.length;
  13808. }
  13809. return stack[0].nodes;
  13810. };
  13811. var walk = function walk(nodes, cb, bubble) {
  13812. var i, max, node, result;
  13813. for (i = 0, max = nodes.length; i < max; i += 1) {
  13814. node = nodes[i];
  13815. if (!bubble) {
  13816. result = cb(node, i, nodes);
  13817. }
  13818. if (
  13819. result !== false &&
  13820. node.type === "function" &&
  13821. Array.isArray(node.nodes)
  13822. ) {
  13823. walk(node.nodes, cb, bubble);
  13824. }
  13825. if (bubble) {
  13826. cb(node, i, nodes);
  13827. }
  13828. }
  13829. };
  13830. function stringifyNode(node, custom) {
  13831. var type = node.type;
  13832. var value = node.value;
  13833. var buf;
  13834. var customResult;
  13835. if (custom && (customResult = custom(node)) !== undefined) {
  13836. return customResult;
  13837. } else if (type === "word" || type === "space") {
  13838. return value;
  13839. } else if (type === "string") {
  13840. buf = node.quote || "";
  13841. return buf + value + (node.unclosed ? "" : buf);
  13842. } else if (type === "comment") {
  13843. return "/*" + value + (node.unclosed ? "" : "*/");
  13844. } else if (type === "div") {
  13845. return (node.before || "") + value + (node.after || "");
  13846. } else if (Array.isArray(node.nodes)) {
  13847. buf = stringify$1(node.nodes, custom);
  13848. if (type !== "function") {
  13849. return buf;
  13850. }
  13851. return (
  13852. value +
  13853. "(" +
  13854. (node.before || "") +
  13855. buf +
  13856. (node.after || "") +
  13857. (node.unclosed ? "" : ")")
  13858. );
  13859. }
  13860. return value;
  13861. }
  13862. function stringify$1(nodes, custom) {
  13863. var result, i;
  13864. if (Array.isArray(nodes)) {
  13865. result = "";
  13866. for (i = nodes.length - 1; ~i; i -= 1) {
  13867. result = stringifyNode(nodes[i], custom) + result;
  13868. }
  13869. return result;
  13870. }
  13871. return stringifyNode(nodes, custom);
  13872. }
  13873. var stringify_1$1 = stringify$1;
  13874. var minus = "-".charCodeAt(0);
  13875. var plus$1 = "+".charCodeAt(0);
  13876. var dot = ".".charCodeAt(0);
  13877. var exp = "e".charCodeAt(0);
  13878. var EXP = "E".charCodeAt(0);
  13879. // Check if three code points would start a number
  13880. // https://www.w3.org/TR/css-syntax-3/#starts-with-a-number
  13881. function likeNumber(value) {
  13882. var code = value.charCodeAt(0);
  13883. var nextCode;
  13884. if (code === plus$1 || code === minus) {
  13885. nextCode = value.charCodeAt(1);
  13886. if (nextCode >= 48 && nextCode <= 57) {
  13887. return true;
  13888. }
  13889. var nextNextCode = value.charCodeAt(2);
  13890. if (nextCode === dot && nextNextCode >= 48 && nextNextCode <= 57) {
  13891. return true;
  13892. }
  13893. return false;
  13894. }
  13895. if (code === dot) {
  13896. nextCode = value.charCodeAt(1);
  13897. if (nextCode >= 48 && nextCode <= 57) {
  13898. return true;
  13899. }
  13900. return false;
  13901. }
  13902. if (code >= 48 && code <= 57) {
  13903. return true;
  13904. }
  13905. return false;
  13906. }
  13907. // Consume a number
  13908. // https://www.w3.org/TR/css-syntax-3/#consume-number
  13909. var unit = function(value) {
  13910. var pos = 0;
  13911. var length = value.length;
  13912. var code;
  13913. var nextCode;
  13914. var nextNextCode;
  13915. if (length === 0 || !likeNumber(value)) {
  13916. return false;
  13917. }
  13918. code = value.charCodeAt(pos);
  13919. if (code === plus$1 || code === minus) {
  13920. pos++;
  13921. }
  13922. while (pos < length) {
  13923. code = value.charCodeAt(pos);
  13924. if (code < 48 || code > 57) {
  13925. break;
  13926. }
  13927. pos += 1;
  13928. }
  13929. code = value.charCodeAt(pos);
  13930. nextCode = value.charCodeAt(pos + 1);
  13931. if (code === dot && nextCode >= 48 && nextCode <= 57) {
  13932. pos += 2;
  13933. while (pos < length) {
  13934. code = value.charCodeAt(pos);
  13935. if (code < 48 || code > 57) {
  13936. break;
  13937. }
  13938. pos += 1;
  13939. }
  13940. }
  13941. code = value.charCodeAt(pos);
  13942. nextCode = value.charCodeAt(pos + 1);
  13943. nextNextCode = value.charCodeAt(pos + 2);
  13944. if (
  13945. (code === exp || code === EXP) &&
  13946. ((nextCode >= 48 && nextCode <= 57) ||
  13947. ((nextCode === plus$1 || nextCode === minus) &&
  13948. nextNextCode >= 48 &&
  13949. nextNextCode <= 57))
  13950. ) {
  13951. pos += nextCode === plus$1 || nextCode === minus ? 3 : 2;
  13952. while (pos < length) {
  13953. code = value.charCodeAt(pos);
  13954. if (code < 48 || code > 57) {
  13955. break;
  13956. }
  13957. pos += 1;
  13958. }
  13959. }
  13960. return {
  13961. number: value.slice(0, pos),
  13962. unit: value.slice(pos)
  13963. };
  13964. };
  13965. function ValueParser(value) {
  13966. if (this instanceof ValueParser) {
  13967. this.nodes = parse$2(value);
  13968. return this;
  13969. }
  13970. return new ValueParser(value);
  13971. }
  13972. ValueParser.prototype.toString = function() {
  13973. return Array.isArray(this.nodes) ? stringify_1$1(this.nodes) : "";
  13974. };
  13975. ValueParser.prototype.walk = function(cb, bubble) {
  13976. walk(this.nodes, cb, bubble);
  13977. return this;
  13978. };
  13979. ValueParser.unit = unit;
  13980. ValueParser.walk = walk;
  13981. ValueParser.stringify = stringify_1$1;
  13982. var lib$3 = ValueParser;
  13983. const matchValueName = /[$]?[\w-]+/g;
  13984. const replaceValueSymbols = (value, replacements) => {
  13985. let matches;
  13986. while ((matches = matchValueName.exec(value))) {
  13987. const replacement = replacements[matches[0]];
  13988. if (replacement) {
  13989. value =
  13990. value.slice(0, matches.index) +
  13991. replacement +
  13992. value.slice(matchValueName.lastIndex);
  13993. matchValueName.lastIndex -= matches[0].length - replacement.length;
  13994. }
  13995. }
  13996. return value;
  13997. };
  13998. var replaceValueSymbols_1 = replaceValueSymbols;
  13999. const replaceSymbols = (css, replacements) => {
  14000. css.walk((node) => {
  14001. if (node.type === "decl" && node.value) {
  14002. node.value = replaceValueSymbols_1(node.value.toString(), replacements);
  14003. } else if (node.type === "rule" && node.selector) {
  14004. node.selector = replaceValueSymbols_1(
  14005. node.selector.toString(),
  14006. replacements
  14007. );
  14008. } else if (node.type === "atrule" && node.params) {
  14009. node.params = replaceValueSymbols_1(node.params.toString(), replacements);
  14010. }
  14011. });
  14012. };
  14013. var replaceSymbols_1 = replaceSymbols;
  14014. const importPattern = /^:import\(("[^"]*"|'[^']*'|[^"']+)\)$/;
  14015. const balancedQuotes = /^("[^"]*"|'[^']*'|[^"']+)$/;
  14016. const getDeclsObject = (rule) => {
  14017. const object = {};
  14018. rule.walkDecls((decl) => {
  14019. const before = decl.raws.before ? decl.raws.before.trim() : "";
  14020. object[before + decl.prop] = decl.value;
  14021. });
  14022. return object;
  14023. };
  14024. /**
  14025. *
  14026. * @param {string} css
  14027. * @param {boolean} removeRules
  14028. * @param {'auto' | 'rule' | 'at-rule'} mode
  14029. */
  14030. const extractICSS = (css, removeRules = true, mode = "auto") => {
  14031. const icssImports = {};
  14032. const icssExports = {};
  14033. function addImports(node, path) {
  14034. const unquoted = path.replace(/'|"/g, "");
  14035. icssImports[unquoted] = Object.assign(
  14036. icssImports[unquoted] || {},
  14037. getDeclsObject(node)
  14038. );
  14039. if (removeRules) {
  14040. node.remove();
  14041. }
  14042. }
  14043. function addExports(node) {
  14044. Object.assign(icssExports, getDeclsObject(node));
  14045. if (removeRules) {
  14046. node.remove();
  14047. }
  14048. }
  14049. css.each((node) => {
  14050. if (node.type === "rule" && mode !== "at-rule") {
  14051. if (node.selector.slice(0, 7) === ":import") {
  14052. const matches = importPattern.exec(node.selector);
  14053. if (matches) {
  14054. addImports(node, matches[1]);
  14055. }
  14056. }
  14057. if (node.selector === ":export") {
  14058. addExports(node);
  14059. }
  14060. }
  14061. if (node.type === "atrule" && mode !== "rule") {
  14062. if (node.name === "icss-import") {
  14063. const matches = balancedQuotes.exec(node.params);
  14064. if (matches) {
  14065. addImports(node, matches[1]);
  14066. }
  14067. }
  14068. if (node.name === "icss-export") {
  14069. addExports(node);
  14070. }
  14071. }
  14072. });
  14073. return { icssImports, icssExports };
  14074. };
  14075. var extractICSS_1 = extractICSS;
  14076. const createImports = (imports, postcss, mode = "rule") => {
  14077. return Object.keys(imports).map((path) => {
  14078. const aliases = imports[path];
  14079. const declarations = Object.keys(aliases).map((key) =>
  14080. postcss.decl({
  14081. prop: key,
  14082. value: aliases[key],
  14083. raws: { before: "\n " },
  14084. })
  14085. );
  14086. const hasDeclarations = declarations.length > 0;
  14087. const rule =
  14088. mode === "rule"
  14089. ? postcss.rule({
  14090. selector: `:import('${path}')`,
  14091. raws: { after: hasDeclarations ? "\n" : "" },
  14092. })
  14093. : postcss.atRule({
  14094. name: "icss-import",
  14095. params: `'${path}'`,
  14096. raws: { after: hasDeclarations ? "\n" : "" },
  14097. });
  14098. if (hasDeclarations) {
  14099. rule.append(declarations);
  14100. }
  14101. return rule;
  14102. });
  14103. };
  14104. const createExports = (exports, postcss, mode = "rule") => {
  14105. const declarations = Object.keys(exports).map((key) =>
  14106. postcss.decl({
  14107. prop: key,
  14108. value: exports[key],
  14109. raws: { before: "\n " },
  14110. })
  14111. );
  14112. if (declarations.length === 0) {
  14113. return [];
  14114. }
  14115. const rule =
  14116. mode === "rule"
  14117. ? postcss.rule({
  14118. selector: `:export`,
  14119. raws: { after: "\n" },
  14120. })
  14121. : postcss.atRule({
  14122. name: "icss-export",
  14123. raws: { after: "\n" },
  14124. });
  14125. rule.append(declarations);
  14126. return [rule];
  14127. };
  14128. const createICSSRules = (imports, exports, postcss, mode) => [
  14129. ...createImports(imports, postcss, mode),
  14130. ...createExports(exports, postcss, mode),
  14131. ];
  14132. var createICSSRules_1 = createICSSRules;
  14133. var src = {
  14134. replaceValueSymbols: replaceValueSymbols_1,
  14135. replaceSymbols: replaceSymbols_1,
  14136. extractICSS: extractICSS_1,
  14137. createICSSRules: createICSSRules_1,
  14138. };
  14139. const { extractICSS: extractICSS$1 } = src;
  14140. const isSpacing = (node) => node.type === "combinator" && node.value === " ";
  14141. function normalizeNodeArray(nodes) {
  14142. const array = [];
  14143. nodes.forEach((x) => {
  14144. if (Array.isArray(x)) {
  14145. normalizeNodeArray(x).forEach((item) => {
  14146. array.push(item);
  14147. });
  14148. } else if (x) {
  14149. array.push(x);
  14150. }
  14151. });
  14152. if (array.length > 0 && isSpacing(array[array.length - 1])) {
  14153. array.pop();
  14154. }
  14155. return array;
  14156. }
  14157. function localizeNode(rule, mode, localAliasMap) {
  14158. const transform = (node, context) => {
  14159. if (context.ignoreNextSpacing && !isSpacing(node)) {
  14160. throw new Error("Missing whitespace after " + context.ignoreNextSpacing);
  14161. }
  14162. if (context.enforceNoSpacing && isSpacing(node)) {
  14163. throw new Error("Missing whitespace before " + context.enforceNoSpacing);
  14164. }
  14165. let newNodes;
  14166. switch (node.type) {
  14167. case "root": {
  14168. let resultingGlobal;
  14169. context.hasPureGlobals = false;
  14170. newNodes = node.nodes.map((n) => {
  14171. const nContext = {
  14172. global: context.global,
  14173. lastWasSpacing: true,
  14174. hasLocals: false,
  14175. explicit: false,
  14176. };
  14177. n = transform(n, nContext);
  14178. if (typeof resultingGlobal === "undefined") {
  14179. resultingGlobal = nContext.global;
  14180. } else if (resultingGlobal !== nContext.global) {
  14181. throw new Error(
  14182. 'Inconsistent rule global/local result in rule "' +
  14183. node +
  14184. '" (multiple selectors must result in the same mode for the rule)'
  14185. );
  14186. }
  14187. if (!nContext.hasLocals) {
  14188. context.hasPureGlobals = true;
  14189. }
  14190. return n;
  14191. });
  14192. context.global = resultingGlobal;
  14193. node.nodes = normalizeNodeArray(newNodes);
  14194. break;
  14195. }
  14196. case "selector": {
  14197. newNodes = node.map((childNode) => transform(childNode, context));
  14198. node = node.clone();
  14199. node.nodes = normalizeNodeArray(newNodes);
  14200. break;
  14201. }
  14202. case "combinator": {
  14203. if (isSpacing(node)) {
  14204. if (context.ignoreNextSpacing) {
  14205. context.ignoreNextSpacing = false;
  14206. context.lastWasSpacing = false;
  14207. context.enforceNoSpacing = false;
  14208. return null;
  14209. }
  14210. context.lastWasSpacing = true;
  14211. return node;
  14212. }
  14213. break;
  14214. }
  14215. case "pseudo": {
  14216. let childContext;
  14217. const isNested = !!node.length;
  14218. const isScoped = node.value === ":local" || node.value === ":global";
  14219. const isImportExport =
  14220. node.value === ":import" || node.value === ":export";
  14221. if (isImportExport) {
  14222. context.hasLocals = true;
  14223. // :local(.foo)
  14224. } else if (isNested) {
  14225. if (isScoped) {
  14226. if (node.nodes.length === 0) {
  14227. throw new Error(`${node.value}() can't be empty`);
  14228. }
  14229. if (context.inside) {
  14230. throw new Error(
  14231. `A ${node.value} is not allowed inside of a ${context.inside}(...)`
  14232. );
  14233. }
  14234. childContext = {
  14235. global: node.value === ":global",
  14236. inside: node.value,
  14237. hasLocals: false,
  14238. explicit: true,
  14239. };
  14240. newNodes = node
  14241. .map((childNode) => transform(childNode, childContext))
  14242. .reduce((acc, next) => acc.concat(next.nodes), []);
  14243. if (newNodes.length) {
  14244. const { before, after } = node.spaces;
  14245. const first = newNodes[0];
  14246. const last = newNodes[newNodes.length - 1];
  14247. first.spaces = { before, after: first.spaces.after };
  14248. last.spaces = { before: last.spaces.before, after };
  14249. }
  14250. node = newNodes;
  14251. break;
  14252. } else {
  14253. childContext = {
  14254. global: context.global,
  14255. inside: context.inside,
  14256. lastWasSpacing: true,
  14257. hasLocals: false,
  14258. explicit: context.explicit,
  14259. };
  14260. newNodes = node.map((childNode) =>
  14261. transform(childNode, childContext)
  14262. );
  14263. node = node.clone();
  14264. node.nodes = normalizeNodeArray(newNodes);
  14265. if (childContext.hasLocals) {
  14266. context.hasLocals = true;
  14267. }
  14268. }
  14269. break;
  14270. //:local .foo .bar
  14271. } else if (isScoped) {
  14272. if (context.inside) {
  14273. throw new Error(
  14274. `A ${node.value} is not allowed inside of a ${context.inside}(...)`
  14275. );
  14276. }
  14277. const addBackSpacing = !!node.spaces.before;
  14278. context.ignoreNextSpacing = context.lastWasSpacing
  14279. ? node.value
  14280. : false;
  14281. context.enforceNoSpacing = context.lastWasSpacing
  14282. ? false
  14283. : node.value;
  14284. context.global = node.value === ":global";
  14285. context.explicit = true;
  14286. // because this node has spacing that is lost when we remove it
  14287. // we make up for it by adding an extra combinator in since adding
  14288. // spacing on the parent selector doesn't work
  14289. return addBackSpacing
  14290. ? dist.combinator({ value: " " })
  14291. : null;
  14292. }
  14293. break;
  14294. }
  14295. case "id":
  14296. case "class": {
  14297. if (!node.value) {
  14298. throw new Error("Invalid class or id selector syntax");
  14299. }
  14300. if (context.global) {
  14301. break;
  14302. }
  14303. const isImportedValue = localAliasMap.has(node.value);
  14304. const isImportedWithExplicitScope = isImportedValue && context.explicit;
  14305. if (!isImportedValue || isImportedWithExplicitScope) {
  14306. const innerNode = node.clone();
  14307. innerNode.spaces = { before: "", after: "" };
  14308. node = dist.pseudo({
  14309. value: ":local",
  14310. nodes: [innerNode],
  14311. spaces: node.spaces,
  14312. });
  14313. context.hasLocals = true;
  14314. }
  14315. break;
  14316. }
  14317. }
  14318. context.lastWasSpacing = false;
  14319. context.ignoreNextSpacing = false;
  14320. context.enforceNoSpacing = false;
  14321. return node;
  14322. };
  14323. const rootContext = {
  14324. global: mode === "global",
  14325. hasPureGlobals: false,
  14326. };
  14327. rootContext.selector = dist((root) => {
  14328. transform(root, rootContext);
  14329. }).processSync(rule, { updateSelector: false, lossless: true });
  14330. return rootContext;
  14331. }
  14332. function localizeDeclNode(node, context) {
  14333. switch (node.type) {
  14334. case "word":
  14335. if (context.localizeNextItem) {
  14336. if (!context.localAliasMap.has(node.value)) {
  14337. node.value = ":local(" + node.value + ")";
  14338. context.localizeNextItem = false;
  14339. }
  14340. }
  14341. break;
  14342. case "function":
  14343. if (
  14344. context.options &&
  14345. context.options.rewriteUrl &&
  14346. node.value.toLowerCase() === "url"
  14347. ) {
  14348. node.nodes.map((nestedNode) => {
  14349. if (nestedNode.type !== "string" && nestedNode.type !== "word") {
  14350. return;
  14351. }
  14352. let newUrl = context.options.rewriteUrl(
  14353. context.global,
  14354. nestedNode.value
  14355. );
  14356. switch (nestedNode.type) {
  14357. case "string":
  14358. if (nestedNode.quote === "'") {
  14359. newUrl = newUrl.replace(/(\\)/g, "\\$1").replace(/'/g, "\\'");
  14360. }
  14361. if (nestedNode.quote === '"') {
  14362. newUrl = newUrl.replace(/(\\)/g, "\\$1").replace(/"/g, '\\"');
  14363. }
  14364. break;
  14365. case "word":
  14366. newUrl = newUrl.replace(/("|'|\)|\\)/g, "\\$1");
  14367. break;
  14368. }
  14369. nestedNode.value = newUrl;
  14370. });
  14371. }
  14372. break;
  14373. }
  14374. return node;
  14375. }
  14376. function isWordAFunctionArgument(wordNode, functionNode) {
  14377. return functionNode
  14378. ? functionNode.nodes.some(
  14379. (functionNodeChild) =>
  14380. functionNodeChild.sourceIndex === wordNode.sourceIndex
  14381. )
  14382. : false;
  14383. }
  14384. function localizeDeclarationValues(localize, declaration, context) {
  14385. const valueNodes = lib$3(declaration.value);
  14386. valueNodes.walk((node, index, nodes) => {
  14387. const subContext = {
  14388. options: context.options,
  14389. global: context.global,
  14390. localizeNextItem: localize && !context.global,
  14391. localAliasMap: context.localAliasMap,
  14392. };
  14393. nodes[index] = localizeDeclNode(node, subContext);
  14394. });
  14395. declaration.value = valueNodes.toString();
  14396. }
  14397. function localizeDeclaration(declaration, context) {
  14398. const isAnimation = /animation$/i.test(declaration.prop);
  14399. if (isAnimation) {
  14400. const validIdent = /^-?[_a-z][_a-z0-9-]*$/i;
  14401. /*
  14402. The spec defines some keywords that you can use to describe properties such as the timing
  14403. function. These are still valid animation names, so as long as there is a property that accepts
  14404. a keyword, it is given priority. Only when all the properties that can take a keyword are
  14405. exhausted can the animation name be set to the keyword. I.e.
  14406. animation: infinite infinite;
  14407. The animation will repeat an infinite number of times from the first argument, and will have an
  14408. animation name of infinite from the second.
  14409. */
  14410. const animationKeywords = {
  14411. $alternate: 1,
  14412. "$alternate-reverse": 1,
  14413. $backwards: 1,
  14414. $both: 1,
  14415. $ease: 1,
  14416. "$ease-in": 1,
  14417. "$ease-in-out": 1,
  14418. "$ease-out": 1,
  14419. $forwards: 1,
  14420. $infinite: 1,
  14421. $linear: 1,
  14422. $none: Infinity, // No matter how many times you write none, it will never be an animation name
  14423. $normal: 1,
  14424. $paused: 1,
  14425. $reverse: 1,
  14426. $running: 1,
  14427. "$step-end": 1,
  14428. "$step-start": 1,
  14429. $initial: Infinity,
  14430. $inherit: Infinity,
  14431. $unset: Infinity,
  14432. };
  14433. let parsedAnimationKeywords = {};
  14434. let stepsFunctionNode = null;
  14435. const valueNodes = lib$3(declaration.value).walk((node) => {
  14436. /* If div-token appeared (represents as comma ','), a possibility of an animation-keywords should be reflesh. */
  14437. if (node.type === "div") {
  14438. parsedAnimationKeywords = {};
  14439. }
  14440. if (node.type === "function" && node.value.toLowerCase() === "steps") {
  14441. stepsFunctionNode = node;
  14442. }
  14443. const value =
  14444. node.type === "word" &&
  14445. !isWordAFunctionArgument(node, stepsFunctionNode)
  14446. ? node.value.toLowerCase()
  14447. : null;
  14448. let shouldParseAnimationName = false;
  14449. if (value && validIdent.test(value)) {
  14450. if ("$" + value in animationKeywords) {
  14451. parsedAnimationKeywords["$" + value] =
  14452. "$" + value in parsedAnimationKeywords
  14453. ? parsedAnimationKeywords["$" + value] + 1
  14454. : 0;
  14455. shouldParseAnimationName =
  14456. parsedAnimationKeywords["$" + value] >=
  14457. animationKeywords["$" + value];
  14458. } else {
  14459. shouldParseAnimationName = true;
  14460. }
  14461. }
  14462. const subContext = {
  14463. options: context.options,
  14464. global: context.global,
  14465. localizeNextItem: shouldParseAnimationName && !context.global,
  14466. localAliasMap: context.localAliasMap,
  14467. };
  14468. return localizeDeclNode(node, subContext);
  14469. });
  14470. declaration.value = valueNodes.toString();
  14471. return;
  14472. }
  14473. const isAnimationName = /animation(-name)?$/i.test(declaration.prop);
  14474. if (isAnimationName) {
  14475. return localizeDeclarationValues(true, declaration, context);
  14476. }
  14477. const hasUrl = /url\(/i.test(declaration.value);
  14478. if (hasUrl) {
  14479. return localizeDeclarationValues(false, declaration, context);
  14480. }
  14481. }
  14482. var src$1 = (options = {}) => {
  14483. if (
  14484. options &&
  14485. options.mode &&
  14486. options.mode !== "global" &&
  14487. options.mode !== "local" &&
  14488. options.mode !== "pure"
  14489. ) {
  14490. throw new Error(
  14491. 'options.mode must be either "global", "local" or "pure" (default "local")'
  14492. );
  14493. }
  14494. const pureMode = options && options.mode === "pure";
  14495. const globalMode = options && options.mode === "global";
  14496. return {
  14497. postcssPlugin: "postcss-modules-local-by-default",
  14498. prepare() {
  14499. const localAliasMap = new Map();
  14500. return {
  14501. Once(root) {
  14502. const { icssImports } = extractICSS$1(root, false);
  14503. Object.keys(icssImports).forEach((key) => {
  14504. Object.keys(icssImports[key]).forEach((prop) => {
  14505. localAliasMap.set(prop, icssImports[key][prop]);
  14506. });
  14507. });
  14508. root.walkAtRules((atRule) => {
  14509. if (/keyframes$/i.test(atRule.name)) {
  14510. const globalMatch = /^\s*:global\s*\((.+)\)\s*$/.exec(
  14511. atRule.params
  14512. );
  14513. const localMatch = /^\s*:local\s*\((.+)\)\s*$/.exec(
  14514. atRule.params
  14515. );
  14516. let globalKeyframes = globalMode;
  14517. if (globalMatch) {
  14518. if (pureMode) {
  14519. throw atRule.error(
  14520. "@keyframes :global(...) is not allowed in pure mode"
  14521. );
  14522. }
  14523. atRule.params = globalMatch[1];
  14524. globalKeyframes = true;
  14525. } else if (localMatch) {
  14526. atRule.params = localMatch[0];
  14527. globalKeyframes = false;
  14528. } else if (!globalMode) {
  14529. if (atRule.params && !localAliasMap.has(atRule.params)) {
  14530. atRule.params = ":local(" + atRule.params + ")";
  14531. }
  14532. }
  14533. atRule.walkDecls((declaration) => {
  14534. localizeDeclaration(declaration, {
  14535. localAliasMap,
  14536. options: options,
  14537. global: globalKeyframes,
  14538. });
  14539. });
  14540. } else if (atRule.nodes) {
  14541. atRule.nodes.forEach((declaration) => {
  14542. if (declaration.type === "decl") {
  14543. localizeDeclaration(declaration, {
  14544. localAliasMap,
  14545. options: options,
  14546. global: globalMode,
  14547. });
  14548. }
  14549. });
  14550. }
  14551. });
  14552. root.walkRules((rule) => {
  14553. if (
  14554. rule.parent &&
  14555. rule.parent.type === "atrule" &&
  14556. /keyframes$/i.test(rule.parent.name)
  14557. ) {
  14558. // ignore keyframe rules
  14559. return;
  14560. }
  14561. const context = localizeNode(rule, options.mode, localAliasMap);
  14562. context.options = options;
  14563. context.localAliasMap = localAliasMap;
  14564. if (pureMode && context.hasPureGlobals) {
  14565. throw rule.error(
  14566. 'Selector "' +
  14567. rule.selector +
  14568. '" is not pure ' +
  14569. "(pure selectors must contain at least one local class or id)"
  14570. );
  14571. }
  14572. rule.selector = context.selector;
  14573. // Less-syntax mixins parse as rules with no nodes
  14574. if (rule.nodes) {
  14575. rule.nodes.forEach((declaration) =>
  14576. localizeDeclaration(declaration, context)
  14577. );
  14578. }
  14579. });
  14580. },
  14581. };
  14582. },
  14583. };
  14584. };
  14585. var postcss = true;
  14586. src$1.postcss = postcss;
  14587. const PERMANENT_MARKER = 2;
  14588. const TEMPORARY_MARKER = 1;
  14589. function createError(node, graph) {
  14590. const er = new Error("Nondeterministic import's order");
  14591. const related = graph[node];
  14592. const relatedNode = related.find(
  14593. (relatedNode) => graph[relatedNode].indexOf(node) > -1
  14594. );
  14595. er.nodes = [node, relatedNode];
  14596. return er;
  14597. }
  14598. function walkGraph(node, graph, state, result, strict) {
  14599. if (state[node] === PERMANENT_MARKER) {
  14600. return;
  14601. }
  14602. if (state[node] === TEMPORARY_MARKER) {
  14603. if (strict) {
  14604. return createError(node, graph);
  14605. }
  14606. return;
  14607. }
  14608. state[node] = TEMPORARY_MARKER;
  14609. const children = graph[node];
  14610. const length = children.length;
  14611. for (let i = 0; i < length; ++i) {
  14612. const error = walkGraph(children[i], graph, state, result, strict);
  14613. if (error instanceof Error) {
  14614. return error;
  14615. }
  14616. }
  14617. state[node] = PERMANENT_MARKER;
  14618. result.push(node);
  14619. }
  14620. function topologicalSort(graph, strict) {
  14621. const result = [];
  14622. const state = {};
  14623. const nodes = Object.keys(graph);
  14624. const length = nodes.length;
  14625. for (let i = 0; i < length; ++i) {
  14626. const er = walkGraph(nodes[i], graph, state, result, strict);
  14627. if (er instanceof Error) {
  14628. return er;
  14629. }
  14630. }
  14631. return result;
  14632. }
  14633. var topologicalSort_1 = topologicalSort;
  14634. const matchImports = /^(.+?)\s+from\s+(?:"([^"]+)"|'([^']+)'|(global))$/;
  14635. const icssImport = /^:import\((?:"([^"]+)"|'([^']+)')\)/;
  14636. const VISITED_MARKER = 1;
  14637. /**
  14638. * :import('G') {}
  14639. *
  14640. * Rule
  14641. * composes: ... from 'A'
  14642. * composes: ... from 'B'
  14643. * Rule
  14644. * composes: ... from 'A'
  14645. * composes: ... from 'A'
  14646. * composes: ... from 'C'
  14647. *
  14648. * Results in:
  14649. *
  14650. * graph: {
  14651. * G: [],
  14652. * A: [],
  14653. * B: ['A'],
  14654. * C: ['A'],
  14655. * }
  14656. */
  14657. function addImportToGraph(importId, parentId, graph, visited) {
  14658. const siblingsId = parentId + "_" + "siblings";
  14659. const visitedId = parentId + "_" + importId;
  14660. if (visited[visitedId] !== VISITED_MARKER) {
  14661. if (!Array.isArray(visited[siblingsId])) {
  14662. visited[siblingsId] = [];
  14663. }
  14664. const siblings = visited[siblingsId];
  14665. if (Array.isArray(graph[importId])) {
  14666. graph[importId] = graph[importId].concat(siblings);
  14667. } else {
  14668. graph[importId] = siblings.slice();
  14669. }
  14670. visited[visitedId] = VISITED_MARKER;
  14671. siblings.push(importId);
  14672. }
  14673. }
  14674. var src$2 = (options = {}) => {
  14675. let importIndex = 0;
  14676. const createImportedName =
  14677. typeof options.createImportedName !== "function"
  14678. ? (importName /*, path*/) =>
  14679. `i__imported_${importName.replace(/\W/g, "_")}_${importIndex++}`
  14680. : options.createImportedName;
  14681. const failOnWrongOrder = options.failOnWrongOrder;
  14682. return {
  14683. postcssPlugin: "postcss-modules-extract-imports",
  14684. prepare() {
  14685. const graph = {};
  14686. const visited = {};
  14687. const existingImports = {};
  14688. const importDecls = {};
  14689. const imports = {};
  14690. return {
  14691. Once(root, postcss) {
  14692. // Check the existing imports order and save refs
  14693. root.walkRules((rule) => {
  14694. const matches = icssImport.exec(rule.selector);
  14695. if (matches) {
  14696. const [, /*match*/ doubleQuotePath, singleQuotePath] = matches;
  14697. const importPath = doubleQuotePath || singleQuotePath;
  14698. addImportToGraph(importPath, "root", graph, visited);
  14699. existingImports[importPath] = rule;
  14700. }
  14701. });
  14702. root.walkDecls(/^composes$/, (declaration) => {
  14703. const matches = declaration.value.match(matchImports);
  14704. if (!matches) {
  14705. return;
  14706. }
  14707. let tmpSymbols;
  14708. let [
  14709. ,
  14710. /*match*/ symbols,
  14711. doubleQuotePath,
  14712. singleQuotePath,
  14713. global,
  14714. ] = matches;
  14715. if (global) {
  14716. // Composing globals simply means changing these classes to wrap them in global(name)
  14717. tmpSymbols = symbols.split(/\s+/).map((s) => `global(${s})`);
  14718. } else {
  14719. const importPath = doubleQuotePath || singleQuotePath;
  14720. let parent = declaration.parent;
  14721. let parentIndexes = "";
  14722. while (parent.type !== "root") {
  14723. parentIndexes =
  14724. parent.parent.index(parent) + "_" + parentIndexes;
  14725. parent = parent.parent;
  14726. }
  14727. const { selector } = declaration.parent;
  14728. const parentRule = `_${parentIndexes}${selector}`;
  14729. addImportToGraph(importPath, parentRule, graph, visited);
  14730. importDecls[importPath] = declaration;
  14731. imports[importPath] = imports[importPath] || {};
  14732. tmpSymbols = symbols.split(/\s+/).map((s) => {
  14733. if (!imports[importPath][s]) {
  14734. imports[importPath][s] = createImportedName(s, importPath);
  14735. }
  14736. return imports[importPath][s];
  14737. });
  14738. }
  14739. declaration.value = tmpSymbols.join(" ");
  14740. });
  14741. const importsOrder = topologicalSort_1(graph, failOnWrongOrder);
  14742. if (importsOrder instanceof Error) {
  14743. const importPath = importsOrder.nodes.find((importPath) =>
  14744. // eslint-disable-next-line no-prototype-builtins
  14745. importDecls.hasOwnProperty(importPath)
  14746. );
  14747. const decl = importDecls[importPath];
  14748. throw decl.error(
  14749. "Failed to resolve order of composed modules " +
  14750. importsOrder.nodes
  14751. .map((importPath) => "`" + importPath + "`")
  14752. .join(", ") +
  14753. ".",
  14754. {
  14755. plugin: "postcss-modules-extract-imports",
  14756. word: "composes",
  14757. }
  14758. );
  14759. }
  14760. let lastImportRule;
  14761. importsOrder.forEach((path) => {
  14762. const importedSymbols = imports[path];
  14763. let rule = existingImports[path];
  14764. if (!rule && importedSymbols) {
  14765. rule = postcss.rule({
  14766. selector: `:import("${path}")`,
  14767. raws: { after: "\n" },
  14768. });
  14769. if (lastImportRule) {
  14770. root.insertAfter(lastImportRule, rule);
  14771. } else {
  14772. root.prepend(rule);
  14773. }
  14774. }
  14775. lastImportRule = rule;
  14776. if (!importedSymbols) {
  14777. return;
  14778. }
  14779. Object.keys(importedSymbols).forEach((importedSymbol) => {
  14780. rule.append(
  14781. postcss.decl({
  14782. value: importedSymbol,
  14783. prop: importedSymbols[importedSymbol],
  14784. raws: { before: "\n " },
  14785. })
  14786. );
  14787. });
  14788. });
  14789. },
  14790. };
  14791. },
  14792. };
  14793. };
  14794. var postcss$1 = true;
  14795. src$2.postcss = postcss$1;
  14796. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  14797. function getSingleLocalNamesForComposes(root) {
  14798. return root.nodes.map((node) => {
  14799. if (node.type !== "selector" || node.nodes.length !== 1) {
  14800. throw new Error(
  14801. `composition is only allowed when selector is single :local class name not in "${root}"`
  14802. );
  14803. }
  14804. node = node.nodes[0];
  14805. if (
  14806. node.type !== "pseudo" ||
  14807. node.value !== ":local" ||
  14808. node.nodes.length !== 1
  14809. ) {
  14810. throw new Error(
  14811. 'composition is only allowed when selector is single :local class name not in "' +
  14812. root +
  14813. '", "' +
  14814. node +
  14815. '" is weird'
  14816. );
  14817. }
  14818. node = node.first;
  14819. if (node.type !== "selector" || node.length !== 1) {
  14820. throw new Error(
  14821. 'composition is only allowed when selector is single :local class name not in "' +
  14822. root +
  14823. '", "' +
  14824. node +
  14825. '" is weird'
  14826. );
  14827. }
  14828. node = node.first;
  14829. if (node.type !== "class") {
  14830. // 'id' is not possible, because you can't compose ids
  14831. throw new Error(
  14832. 'composition is only allowed when selector is single :local class name not in "' +
  14833. root +
  14834. '", "' +
  14835. node +
  14836. '" is weird'
  14837. );
  14838. }
  14839. return node.value;
  14840. });
  14841. }
  14842. const whitespace = "[\\x20\\t\\r\\n\\f]";
  14843. const unescapeRegExp = new RegExp(
  14844. "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)",
  14845. "ig"
  14846. );
  14847. function unescape(str) {
  14848. return str.replace(unescapeRegExp, (_, escaped, escapedWhitespace) => {
  14849. const high = "0x" + escaped - 0x10000;
  14850. // NaN means non-codepoint
  14851. // Workaround erroneous numeric interpretation of +"0x"
  14852. return high !== high || escapedWhitespace
  14853. ? escaped
  14854. : high < 0
  14855. ? // BMP codepoint
  14856. String.fromCharCode(high + 0x10000)
  14857. : // Supplemental Plane codepoint (surrogate pair)
  14858. String.fromCharCode((high >> 10) | 0xd800, (high & 0x3ff) | 0xdc00);
  14859. });
  14860. }
  14861. const plugin = (options = {}) => {
  14862. const generateScopedName =
  14863. (options && options.generateScopedName) || plugin.generateScopedName;
  14864. const generateExportEntry =
  14865. (options && options.generateExportEntry) || plugin.generateExportEntry;
  14866. const exportGlobals = options && options.exportGlobals;
  14867. return {
  14868. postcssPlugin: "postcss-modules-scope",
  14869. Once(root, { rule }) {
  14870. const exports = Object.create(null);
  14871. function exportScopedName(name, rawName) {
  14872. const scopedName = generateScopedName(
  14873. rawName ? rawName : name,
  14874. root.source.input.from,
  14875. root.source.input.css
  14876. );
  14877. const exportEntry = generateExportEntry(
  14878. rawName ? rawName : name,
  14879. scopedName,
  14880. root.source.input.from,
  14881. root.source.input.css
  14882. );
  14883. const { key, value } = exportEntry;
  14884. exports[key] = exports[key] || [];
  14885. if (exports[key].indexOf(value) < 0) {
  14886. exports[key].push(value);
  14887. }
  14888. return scopedName;
  14889. }
  14890. function localizeNode(node) {
  14891. switch (node.type) {
  14892. case "selector":
  14893. node.nodes = node.map(localizeNode);
  14894. return node;
  14895. case "class":
  14896. return dist.className({
  14897. value: exportScopedName(
  14898. node.value,
  14899. node.raws && node.raws.value ? node.raws.value : null
  14900. ),
  14901. });
  14902. case "id": {
  14903. return dist.id({
  14904. value: exportScopedName(
  14905. node.value,
  14906. node.raws && node.raws.value ? node.raws.value : null
  14907. ),
  14908. });
  14909. }
  14910. }
  14911. throw new Error(
  14912. `${node.type} ("${node}") is not allowed in a :local block`
  14913. );
  14914. }
  14915. function traverseNode(node) {
  14916. switch (node.type) {
  14917. case "pseudo":
  14918. if (node.value === ":local") {
  14919. if (node.nodes.length !== 1) {
  14920. throw new Error('Unexpected comma (",") in :local block');
  14921. }
  14922. const selector = localizeNode(node.first, node.spaces);
  14923. // move the spaces that were around the psuedo selector to the first
  14924. // non-container node
  14925. selector.first.spaces = node.spaces;
  14926. const nextNode = node.next();
  14927. if (
  14928. nextNode &&
  14929. nextNode.type === "combinator" &&
  14930. nextNode.value === " " &&
  14931. /\\[A-F0-9]{1,6}$/.test(selector.last.value)
  14932. ) {
  14933. selector.last.spaces.after = " ";
  14934. }
  14935. node.replaceWith(selector);
  14936. return;
  14937. }
  14938. /* falls through */
  14939. case "root":
  14940. case "selector": {
  14941. node.each(traverseNode);
  14942. break;
  14943. }
  14944. case "id":
  14945. case "class":
  14946. if (exportGlobals) {
  14947. exports[node.value] = [node.value];
  14948. }
  14949. break;
  14950. }
  14951. return node;
  14952. }
  14953. // Find any :import and remember imported names
  14954. const importedNames = {};
  14955. root.walkRules(/^:import\(.+\)$/, (rule) => {
  14956. rule.walkDecls((decl) => {
  14957. importedNames[decl.prop] = true;
  14958. });
  14959. });
  14960. // Find any :local selectors
  14961. root.walkRules((rule) => {
  14962. let parsedSelector = dist().astSync(rule);
  14963. rule.selector = traverseNode(parsedSelector.clone()).toString();
  14964. rule.walkDecls(/composes|compose-with/i, (decl) => {
  14965. const localNames = getSingleLocalNamesForComposes(parsedSelector);
  14966. const classes = decl.value.split(/\s+/);
  14967. classes.forEach((className) => {
  14968. const global = /^global\(([^)]+)\)$/.exec(className);
  14969. if (global) {
  14970. localNames.forEach((exportedName) => {
  14971. exports[exportedName].push(global[1]);
  14972. });
  14973. } else if (hasOwnProperty$1.call(importedNames, className)) {
  14974. localNames.forEach((exportedName) => {
  14975. exports[exportedName].push(className);
  14976. });
  14977. } else if (hasOwnProperty$1.call(exports, className)) {
  14978. localNames.forEach((exportedName) => {
  14979. exports[className].forEach((item) => {
  14980. exports[exportedName].push(item);
  14981. });
  14982. });
  14983. } else {
  14984. throw decl.error(
  14985. `referenced class name "${className}" in ${decl.prop} not found`
  14986. );
  14987. }
  14988. });
  14989. decl.remove();
  14990. });
  14991. // Find any :local values
  14992. rule.walkDecls((decl) => {
  14993. if (!/:local\s*\((.+?)\)/.test(decl.value)) {
  14994. return;
  14995. }
  14996. let tokens = decl.value.split(/(,|'[^']*'|"[^"]*")/);
  14997. tokens = tokens.map((token, idx) => {
  14998. if (idx === 0 || tokens[idx - 1] === ",") {
  14999. let result = token;
  15000. const localMatch = /:local\s*\((.+?)\)/.exec(token);
  15001. if (localMatch) {
  15002. const input = localMatch.input;
  15003. const matchPattern = localMatch[0];
  15004. const matchVal = localMatch[1];
  15005. const newVal = exportScopedName(matchVal);
  15006. result = input.replace(matchPattern, newVal);
  15007. } else {
  15008. return token;
  15009. }
  15010. return result;
  15011. } else {
  15012. return token;
  15013. }
  15014. });
  15015. decl.value = tokens.join("");
  15016. });
  15017. });
  15018. // Find any :local keyframes
  15019. root.walkAtRules(/keyframes$/i, (atRule) => {
  15020. const localMatch = /^\s*:local\s*\((.+?)\)\s*$/.exec(atRule.params);
  15021. if (!localMatch) {
  15022. return;
  15023. }
  15024. atRule.params = exportScopedName(localMatch[1]);
  15025. });
  15026. // If we found any :locals, insert an :export rule
  15027. const exportedNames = Object.keys(exports);
  15028. if (exportedNames.length > 0) {
  15029. const exportRule = rule({ selector: ":export" });
  15030. exportedNames.forEach((exportedName) =>
  15031. exportRule.append({
  15032. prop: exportedName,
  15033. value: exports[exportedName].join(" "),
  15034. raws: { before: "\n " },
  15035. })
  15036. );
  15037. root.append(exportRule);
  15038. }
  15039. },
  15040. };
  15041. };
  15042. plugin.postcss = true;
  15043. plugin.generateScopedName = function (name, path) {
  15044. const sanitisedPath = path
  15045. .replace(/\.[^./\\]+$/, "")
  15046. .replace(/[\W_]+/g, "_")
  15047. .replace(/^_|_$/g, "");
  15048. return `_${sanitisedPath}__${name}`.trim();
  15049. };
  15050. plugin.generateExportEntry = function (name, scopedName) {
  15051. return {
  15052. key: unescape(name),
  15053. value: unescape(scopedName),
  15054. };
  15055. };
  15056. var src$3 = plugin;
  15057. const matchImports$1 = /^(.+?|\([\s\S]+?\))\s+from\s+("[^"]*"|'[^']*'|[\w-]+)$/;
  15058. const matchValueDefinition = /(?:\s+|^)([\w-]+):?(.*?)$/;
  15059. const matchImport = /^([\w-]+)(?:\s+as\s+([\w-]+))?/;
  15060. var src$4 = (options) => {
  15061. let importIndex = 0;
  15062. const createImportedName =
  15063. (options && options.createImportedName) ||
  15064. ((importName /*, path*/) =>
  15065. `i__const_${importName.replace(/\W/g, "_")}_${importIndex++}`);
  15066. return {
  15067. postcssPlugin: "postcss-modules-values",
  15068. prepare(result) {
  15069. const importAliases = [];
  15070. const definitions = {};
  15071. return {
  15072. Once(root, postcss) {
  15073. root.walkAtRules(/value/i, (atRule) => {
  15074. const matches = atRule.params.match(matchImports$1);
  15075. if (matches) {
  15076. let [, /*match*/ aliases, path] = matches;
  15077. // We can use constants for path names
  15078. if (definitions[path]) {
  15079. path = definitions[path];
  15080. }
  15081. const imports = aliases
  15082. .replace(/^\(\s*([\s\S]+)\s*\)$/, "$1")
  15083. .split(/\s*,\s*/)
  15084. .map((alias) => {
  15085. const tokens = matchImport.exec(alias);
  15086. if (tokens) {
  15087. const [, /*match*/ theirName, myName = theirName] = tokens;
  15088. const importedName = createImportedName(myName);
  15089. definitions[myName] = importedName;
  15090. return { theirName, importedName };
  15091. } else {
  15092. throw new Error(`@import statement "${alias}" is invalid!`);
  15093. }
  15094. });
  15095. importAliases.push({ path, imports });
  15096. atRule.remove();
  15097. return;
  15098. }
  15099. if (atRule.params.indexOf("@value") !== -1) {
  15100. result.warn("Invalid value definition: " + atRule.params);
  15101. }
  15102. let [, key, value] = `${atRule.params}${atRule.raws.between}`.match(
  15103. matchValueDefinition
  15104. );
  15105. const normalizedValue = value.replace(/\/\*((?!\*\/).*?)\*\//g, "");
  15106. if (normalizedValue.length === 0) {
  15107. result.warn("Invalid value definition: " + atRule.params);
  15108. atRule.remove();
  15109. return;
  15110. }
  15111. let isOnlySpace = /^\s+$/.test(normalizedValue);
  15112. if (!isOnlySpace) {
  15113. value = value.trim();
  15114. }
  15115. // Add to the definitions, knowing that values can refer to each other
  15116. definitions[key] = src.replaceValueSymbols(
  15117. value,
  15118. definitions
  15119. );
  15120. atRule.remove();
  15121. });
  15122. /* If we have no definitions, don't continue */
  15123. if (!Object.keys(definitions).length) {
  15124. return;
  15125. }
  15126. /* Perform replacements */
  15127. src.replaceSymbols(root, definitions);
  15128. /* We want to export anything defined by now, but don't add it to the CSS yet or it well get picked up by the replacement stuff */
  15129. const exportDeclarations = Object.keys(definitions).map((key) =>
  15130. postcss.decl({
  15131. value: definitions[key],
  15132. prop: key,
  15133. raws: { before: "\n " },
  15134. })
  15135. );
  15136. /* Add export rules if any */
  15137. if (exportDeclarations.length > 0) {
  15138. const exportRule = postcss.rule({
  15139. selector: ":export",
  15140. raws: { after: "\n" },
  15141. });
  15142. exportRule.append(exportDeclarations);
  15143. root.prepend(exportRule);
  15144. }
  15145. /* Add import rules */
  15146. importAliases.reverse().forEach(({ path, imports }) => {
  15147. const importRule = postcss.rule({
  15148. selector: `:import(${path})`,
  15149. raws: { after: "\n" },
  15150. });
  15151. imports.forEach(({ theirName, importedName }) => {
  15152. importRule.append({
  15153. value: theirName,
  15154. prop: importedName,
  15155. raws: { before: "\n " },
  15156. });
  15157. });
  15158. root.prepend(importRule);
  15159. });
  15160. },
  15161. };
  15162. },
  15163. };
  15164. };
  15165. var postcss$2 = true;
  15166. src$4.postcss = postcss$2;
  15167. var behaviours_1 = createCommonjsModule(function (module, exports) {
  15168. Object.defineProperty(exports, "__esModule", {
  15169. value: true
  15170. });
  15171. exports.behaviours = undefined;
  15172. exports.getDefaultPlugins = getDefaultPlugins;
  15173. exports.isValidBehaviour = isValidBehaviour;
  15174. var _postcssModulesLocalByDefault2 = _interopRequireDefault(src$1);
  15175. var _postcssModulesExtractImports2 = _interopRequireDefault(src$2);
  15176. var _postcssModulesScope2 = _interopRequireDefault(src$3);
  15177. var _postcssModulesValues2 = _interopRequireDefault(src$4);
  15178. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15179. const behaviours = exports.behaviours = {
  15180. LOCAL: "local",
  15181. GLOBAL: "global"
  15182. };
  15183. function getDefaultPlugins({
  15184. behaviour,
  15185. generateScopedName,
  15186. exportGlobals
  15187. }) {
  15188. const scope = (0, _postcssModulesScope2.default)({ generateScopedName, exportGlobals });
  15189. const plugins = {
  15190. [behaviours.LOCAL]: [_postcssModulesValues2.default, _postcssModulesLocalByDefault2.default, _postcssModulesExtractImports2.default, scope],
  15191. [behaviours.GLOBAL]: [_postcssModulesValues2.default, _postcssModulesExtractImports2.default, scope]
  15192. };
  15193. return plugins[behaviour];
  15194. }
  15195. function isValidBehaviour(behaviour) {
  15196. return Object.keys(behaviours).map(key => behaviours[key]).indexOf(behaviour) > -1;
  15197. }
  15198. });
  15199. var _postcss2$1 = _interopRequireDefault$3(_postcss__default);
  15200. var _lodash2 = _interopRequireDefault$3(lodash_camelcase);
  15201. var _genericNames2 = _interopRequireDefault$3(genericNames);
  15202. var _unquote2 = _interopRequireDefault$3(unquote_1);
  15203. var _parser2$1 = _interopRequireDefault$3(parser$1);
  15204. var _loader2 = _interopRequireDefault$3(loader);
  15205. var _generateScopedName2 = _interopRequireDefault$3(generateScopedName_1);
  15206. var _saveJSON2 = _interopRequireDefault$3(saveJSON_1);
  15207. function _interopRequireDefault$3(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15208. function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
  15209. const PLUGIN_NAME = "postcss-modules";
  15210. function getDefaultScopeBehaviour(opts) {
  15211. if (opts.scopeBehaviour && (0, behaviours_1.isValidBehaviour)(opts.scopeBehaviour)) {
  15212. return opts.scopeBehaviour;
  15213. }
  15214. return behaviours_1.behaviours.LOCAL;
  15215. }
  15216. function getScopedNameGenerator(opts) {
  15217. const scopedNameGenerator = opts.generateScopedName || _generateScopedName2.default;
  15218. if (typeof scopedNameGenerator === "function") return scopedNameGenerator;
  15219. return (0, _genericNames2.default)(scopedNameGenerator, {
  15220. context: process.cwd(),
  15221. hashPrefix: opts.hashPrefix
  15222. });
  15223. }
  15224. function getLoader(opts, plugins) {
  15225. const root = typeof opts.root === "undefined" ? "/" : opts.root;
  15226. return typeof opts.Loader === "function" ? new opts.Loader(root, plugins) : new _loader2.default(root, plugins);
  15227. }
  15228. function isGlobalModule(globalModules, inputFile) {
  15229. return globalModules.some(regex => inputFile.match(regex));
  15230. }
  15231. function getDefaultPluginsList(opts, inputFile) {
  15232. const globalModulesList = opts.globalModulePaths || null;
  15233. const exportGlobals = opts.exportGlobals || false;
  15234. const defaultBehaviour = getDefaultScopeBehaviour(opts);
  15235. const generateScopedName = getScopedNameGenerator(opts);
  15236. if (globalModulesList && isGlobalModule(globalModulesList, inputFile)) {
  15237. return (0, behaviours_1.getDefaultPlugins)({
  15238. behaviour: behaviours_1.behaviours.GLOBAL,
  15239. generateScopedName,
  15240. exportGlobals
  15241. });
  15242. }
  15243. return (0, behaviours_1.getDefaultPlugins)({
  15244. behaviour: defaultBehaviour,
  15245. generateScopedName,
  15246. exportGlobals
  15247. });
  15248. }
  15249. function isOurPlugin(plugin) {
  15250. return plugin.postcssPlugin === PLUGIN_NAME;
  15251. }
  15252. function dashesCamelCase(string) {
  15253. return string.replace(/-+(\w)/g, (_, firstLetter) => firstLetter.toUpperCase());
  15254. }
  15255. var build = (opts = {}) => {
  15256. return {
  15257. postcssPlugin: PLUGIN_NAME,
  15258. OnceExit(css, { result }) {
  15259. return _asyncToGenerator(function* () {
  15260. const getJSON = opts.getJSON || _saveJSON2.default;
  15261. const inputFile = css.source.input.file;
  15262. const pluginList = getDefaultPluginsList(opts, inputFile);
  15263. const resultPluginIndex = result.processor.plugins.findIndex(function (plugin) {
  15264. return isOurPlugin(plugin);
  15265. });
  15266. if (resultPluginIndex === -1) {
  15267. throw new Error('Plugin missing from options.');
  15268. }
  15269. const earlierPlugins = result.processor.plugins.slice(0, resultPluginIndex);
  15270. const loaderPlugins = [...earlierPlugins, ...pluginList];
  15271. const loader = getLoader(opts, loaderPlugins);
  15272. const fetcher = function fetcher(file, relativeTo, depTrace) {
  15273. const unquoteFile = (0, _unquote2.default)(file);
  15274. const resolvedResult = typeof opts.resolve === 'function' && opts.resolve(unquoteFile);
  15275. const resolvedFile = resolvedResult instanceof Promise ? resolvedResult : Promise.resolve(resolvedResult);
  15276. return resolvedFile.then(function (f) {
  15277. return loader.fetch.call(loader, `"${f || unquoteFile}"`, relativeTo, depTrace);
  15278. });
  15279. };
  15280. const parser = new _parser2$1.default(fetcher);
  15281. yield (0, _postcss2$1.default)([...pluginList, parser.plugin()]).process(css, {
  15282. from: inputFile
  15283. });
  15284. const out = loader.finalSource;
  15285. if (out) css.prepend(out);
  15286. if (opts.localsConvention) {
  15287. const isFunc = typeof opts.localsConvention === "function";
  15288. parser.exportTokens = Object.entries(parser.exportTokens).reduce(function (tokens, [className, value]) {
  15289. if (isFunc) {
  15290. tokens[opts.localsConvention(className, value, inputFile)] = value;
  15291. return tokens;
  15292. }
  15293. switch (opts.localsConvention) {
  15294. case "camelCase":
  15295. tokens[className] = value;
  15296. tokens[(0, _lodash2.default)(className)] = value;
  15297. break;
  15298. case "camelCaseOnly":
  15299. tokens[(0, _lodash2.default)(className)] = value;
  15300. break;
  15301. case "dashes":
  15302. tokens[className] = value;
  15303. tokens[dashesCamelCase(className)] = value;
  15304. break;
  15305. case "dashesOnly":
  15306. tokens[dashesCamelCase(className)] = value;
  15307. break;
  15308. }
  15309. return tokens;
  15310. }, {});
  15311. }
  15312. result.messages.push({
  15313. type: "export",
  15314. plugin: "postcss-modules",
  15315. exportTokens: parser.exportTokens
  15316. });
  15317. // getJSON may return a promise
  15318. return getJSON(css.source.input.file, parser.exportTokens, result.opts.to);
  15319. })();
  15320. }
  15321. };
  15322. };
  15323. var postcss$3 = true;
  15324. build.postcss = postcss$3;
  15325. function compileStyle(options) {
  15326. return doCompileStyle({
  15327. ...options,
  15328. isAsync: false
  15329. });
  15330. }
  15331. function compileStyleAsync(options) {
  15332. return doCompileStyle({
  15333. ...options,
  15334. isAsync: true
  15335. });
  15336. }
  15337. function doCompileStyle(options) {
  15338. const { filename, id, scoped = false, trim = true, isProd = false, modules = false, modulesOptions = {}, preprocessLang, postcssOptions, postcssPlugins } = options;
  15339. const preprocessor = preprocessLang && processors[preprocessLang];
  15340. const preProcessedSource = preprocessor && preprocess$1(options, preprocessor);
  15341. const map = preProcessedSource
  15342. ? preProcessedSource.map
  15343. : options.inMap || options.map;
  15344. const source = preProcessedSource ? preProcessedSource.code : options.source;
  15345. const shortId = id.replace(/^data-v-/, '');
  15346. const longId = `data-v-${shortId}`;
  15347. const plugins = (postcssPlugins || []).slice();
  15348. plugins.unshift(cssVarsPlugin({ id: shortId, isProd }));
  15349. if (trim) {
  15350. plugins.push(trimPlugin());
  15351. }
  15352. if (scoped) {
  15353. plugins.push(scopedPlugin(longId));
  15354. }
  15355. let cssModules;
  15356. if (modules) {
  15357. if (!options.isAsync) {
  15358. throw new Error('[@vue/compiler-sfc] `modules` option can only be used with compileStyleAsync().');
  15359. }
  15360. plugins.push(build({
  15361. ...modulesOptions,
  15362. getJSON: (_cssFileName, json) => {
  15363. cssModules = json;
  15364. }
  15365. }));
  15366. }
  15367. const postCSSOptions = {
  15368. ...postcssOptions,
  15369. to: filename,
  15370. from: filename
  15371. };
  15372. if (map) {
  15373. postCSSOptions.map = {
  15374. inline: false,
  15375. annotation: false,
  15376. prev: map
  15377. };
  15378. }
  15379. let result;
  15380. let code;
  15381. let outMap;
  15382. // stylus output include plain css. so need remove the repeat item
  15383. const dependencies = new Set(preProcessedSource ? preProcessedSource.dependencies : []);
  15384. // sass has filename self when provided filename option
  15385. dependencies.delete(filename);
  15386. const errors = [];
  15387. if (preProcessedSource && preProcessedSource.errors.length) {
  15388. errors.push(...preProcessedSource.errors);
  15389. }
  15390. const recordPlainCssDependencies = (messages) => {
  15391. messages.forEach(msg => {
  15392. if (msg.type === 'dependency') {
  15393. // postcss output path is absolute position path
  15394. dependencies.add(msg.file);
  15395. }
  15396. });
  15397. return dependencies;
  15398. };
  15399. try {
  15400. result = _postcss__default(plugins).process(source, postCSSOptions);
  15401. // In async mode, return a promise.
  15402. if (options.isAsync) {
  15403. return result
  15404. .then(result => ({
  15405. code: result.css || '',
  15406. map: result.map && result.map.toJSON(),
  15407. errors,
  15408. modules: cssModules,
  15409. rawResult: result,
  15410. dependencies: recordPlainCssDependencies(result.messages)
  15411. }))
  15412. .catch(error => ({
  15413. code: '',
  15414. map: undefined,
  15415. errors: [...errors, error],
  15416. rawResult: undefined,
  15417. dependencies
  15418. }));
  15419. }
  15420. recordPlainCssDependencies(result.messages);
  15421. // force synchronous transform (we know we only have sync plugins)
  15422. code = result.css;
  15423. outMap = result.map;
  15424. }
  15425. catch (e) {
  15426. errors.push(e);
  15427. }
  15428. return {
  15429. code: code || ``,
  15430. map: outMap && outMap.toJSON(),
  15431. errors,
  15432. rawResult: result,
  15433. dependencies
  15434. };
  15435. }
  15436. function preprocess$1(options, preprocessor) {
  15437. return preprocessor(options.source, options.inMap || options.map, {
  15438. filename: options.filename,
  15439. ...options.preprocessOptions
  15440. }, options.preprocessCustomRequire);
  15441. }
  15442. // API
  15443. const walk$1 = estreeWalker.walk;
  15444. exports.MagicString = MagicString__default;
  15445. exports.babelParse = parser$2.parse;
  15446. exports.extractIdentifiers = compilerCore.extractIdentifiers;
  15447. exports.generateCodeFrame = compilerCore.generateCodeFrame;
  15448. exports.isInDestructureAssignment = compilerCore.isInDestructureAssignment;
  15449. exports.isStaticProperty = compilerCore.isStaticProperty;
  15450. exports.walkIdentifiers = compilerCore.walkIdentifiers;
  15451. exports.shouldTransformRef = reactivityTransform.shouldTransform;
  15452. exports.transformRef = reactivityTransform.transform;
  15453. exports.transformRefAST = reactivityTransform.transformAST;
  15454. exports.compileScript = compileScript;
  15455. exports.compileStyle = compileStyle;
  15456. exports.compileStyleAsync = compileStyleAsync;
  15457. exports.compileTemplate = compileTemplate;
  15458. exports.parse = parse;
  15459. exports.rewriteDefault = rewriteDefault;
  15460. exports.walk = walk$1;