compiler-sfc.js 643 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var require$$0 = require('source-map');
  4. var parser$1 = require('@babel/parser');
  5. var url = require('url');
  6. var path = require('path');
  7. var require$$0$1 = require('fs');
  8. var require$$2 = require('util');
  9. function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
  10. var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0);
  11. var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
  12. var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
  13. var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
  14. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  15. function getDefaultExportFromCjs (x) {
  16. return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
  17. }
  18. var splitRE$2 = /\r?\n/g;
  19. var emptyRE$1 = /^\s*$/;
  20. var needFixRE = /^(\r?\n)*[\t\s]/;
  21. var deIndent = function deindent (str) {
  22. if (!needFixRE.test(str)) {
  23. return str
  24. }
  25. var lines = str.split(splitRE$2);
  26. var min = Infinity;
  27. var type, cur, c;
  28. for (var i = 0; i < lines.length; i++) {
  29. var line = lines[i];
  30. if (!emptyRE$1.test(line)) {
  31. if (!type) {
  32. c = line.charAt(0);
  33. if (c === ' ' || c === '\t') {
  34. type = c;
  35. cur = count(line, type);
  36. if (cur < min) {
  37. min = cur;
  38. }
  39. } else {
  40. return str
  41. }
  42. } else {
  43. cur = count(line, type);
  44. if (cur < min) {
  45. min = cur;
  46. }
  47. }
  48. }
  49. }
  50. return lines.map(function (line) {
  51. return line.slice(min)
  52. }).join('\n')
  53. };
  54. function count (line, type) {
  55. var i = 0;
  56. while (line.charAt(i) === type) {
  57. i++;
  58. }
  59. return i
  60. }
  61. const emptyObject = Object.freeze({});
  62. const isArray = Array.isArray;
  63. // These helpers produce better VM code in JS engines due to their
  64. // explicitness and function inlining.
  65. function isUndef(v) {
  66. return v === undefined || v === null;
  67. }
  68. function isDef(v) {
  69. return v !== undefined && v !== null;
  70. }
  71. function isTrue(v) {
  72. return v === true;
  73. }
  74. function isFalse(v) {
  75. return v === false;
  76. }
  77. /**
  78. * Check if value is primitive.
  79. */
  80. function isPrimitive(value) {
  81. return (typeof value === 'string' ||
  82. typeof value === 'number' ||
  83. // $flow-disable-line
  84. typeof value === 'symbol' ||
  85. typeof value === 'boolean');
  86. }
  87. function isFunction(value) {
  88. return typeof value === 'function';
  89. }
  90. /**
  91. * Quick object check - this is primarily used to tell
  92. * objects from primitive values when we know the value
  93. * is a JSON-compliant type.
  94. */
  95. function isObject$1(obj) {
  96. return obj !== null && typeof obj === 'object';
  97. }
  98. /**
  99. * Get the raw type string of a value, e.g., [object Object].
  100. */
  101. const _toString = Object.prototype.toString;
  102. function toRawType(value) {
  103. return _toString.call(value).slice(8, -1);
  104. }
  105. /**
  106. * Strict object type check. Only returns true
  107. * for plain JavaScript objects.
  108. */
  109. function isPlainObject(obj) {
  110. return _toString.call(obj) === '[object Object]';
  111. }
  112. /**
  113. * Check if val is a valid array index.
  114. */
  115. function isValidArrayIndex(val) {
  116. const n = parseFloat(String(val));
  117. return n >= 0 && Math.floor(n) === n && isFinite(val);
  118. }
  119. function isPromise(val) {
  120. return (isDef(val) &&
  121. typeof val.then === 'function' &&
  122. typeof val.catch === 'function');
  123. }
  124. /**
  125. * Convert a value to a string that is actually rendered.
  126. */
  127. function toString$2(val) {
  128. return val == null
  129. ? ''
  130. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  131. ? JSON.stringify(val, null, 2)
  132. : String(val);
  133. }
  134. /**
  135. * Convert an input value to a number for persistence.
  136. * If the conversion fails, return original string.
  137. */
  138. function toNumber(val) {
  139. const n = parseFloat(val);
  140. return isNaN(n) ? val : n;
  141. }
  142. /**
  143. * Make a map and return a function for checking if a key
  144. * is in that map.
  145. */
  146. function makeMap(str, expectsLowerCase) {
  147. const map = Object.create(null);
  148. const list = str.split(',');
  149. for (let i = 0; i < list.length; i++) {
  150. map[list[i]] = true;
  151. }
  152. return expectsLowerCase ? val => map[val.toLowerCase()] : val => map[val];
  153. }
  154. /**
  155. * Check if a tag is a built-in tag.
  156. */
  157. const isBuiltInTag = makeMap('slot,component', true);
  158. /**
  159. * Check if an attribute is a reserved attribute.
  160. */
  161. const isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  162. /**
  163. * Check whether an object has the property.
  164. */
  165. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  166. function hasOwn(obj, key) {
  167. return hasOwnProperty$1.call(obj, key);
  168. }
  169. /**
  170. * Create a cached version of a pure function.
  171. */
  172. function cached(fn) {
  173. const cache = Object.create(null);
  174. return function cachedFn(str) {
  175. const hit = cache[str];
  176. return hit || (cache[str] = fn(str));
  177. };
  178. }
  179. /**
  180. * Camelize a hyphen-delimited string.
  181. */
  182. const camelizeRE = /-(\w)/g;
  183. const camelize = cached((str) => {
  184. return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));
  185. });
  186. /**
  187. * Capitalize a string.
  188. */
  189. const capitalize = cached((str) => {
  190. return str.charAt(0).toUpperCase() + str.slice(1);
  191. });
  192. /**
  193. * Hyphenate a camelCase string.
  194. */
  195. const hyphenateRE = /\B([A-Z])/g;
  196. const hyphenate = cached((str) => {
  197. return str.replace(hyphenateRE, '-$1').toLowerCase();
  198. });
  199. /**
  200. * Mix properties into target object.
  201. */
  202. function extend(to, _from) {
  203. for (const key in _from) {
  204. to[key] = _from[key];
  205. }
  206. return to;
  207. }
  208. /**
  209. * Merge an Array of Objects into a single Object.
  210. */
  211. function toObject(arr) {
  212. const res = {};
  213. for (let i = 0; i < arr.length; i++) {
  214. if (arr[i]) {
  215. extend(res, arr[i]);
  216. }
  217. }
  218. return res;
  219. }
  220. /* eslint-disable no-unused-vars */
  221. /**
  222. * Perform no operation.
  223. * Stubbing args to make Flow happy without leaving useless transpiled code
  224. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  225. */
  226. function noop(a, b, c) { }
  227. /**
  228. * Always return false.
  229. */
  230. const no = (a, b, c) => false;
  231. /* eslint-enable no-unused-vars */
  232. /**
  233. * Return the same value.
  234. */
  235. const identity = (_) => _;
  236. /**
  237. * Generate a string containing static keys from compiler modules.
  238. */
  239. function genStaticKeys$1(modules) {
  240. return modules
  241. .reduce((keys, m) => {
  242. return keys.concat(m.staticKeys || []);
  243. }, [])
  244. .join(',');
  245. }
  246. /**
  247. * Check if two values are loosely equal - that is,
  248. * if they are plain objects, do they have the same shape?
  249. */
  250. function looseEqual(a, b) {
  251. if (a === b)
  252. return true;
  253. const isObjectA = isObject$1(a);
  254. const isObjectB = isObject$1(b);
  255. if (isObjectA && isObjectB) {
  256. try {
  257. const isArrayA = Array.isArray(a);
  258. const isArrayB = Array.isArray(b);
  259. if (isArrayA && isArrayB) {
  260. return (a.length === b.length &&
  261. a.every((e, i) => {
  262. return looseEqual(e, b[i]);
  263. }));
  264. }
  265. else if (a instanceof Date && b instanceof Date) {
  266. return a.getTime() === b.getTime();
  267. }
  268. else if (!isArrayA && !isArrayB) {
  269. const keysA = Object.keys(a);
  270. const keysB = Object.keys(b);
  271. return (keysA.length === keysB.length &&
  272. keysA.every(key => {
  273. return looseEqual(a[key], b[key]);
  274. }));
  275. }
  276. else {
  277. /* istanbul ignore next */
  278. return false;
  279. }
  280. }
  281. catch (e) {
  282. /* istanbul ignore next */
  283. return false;
  284. }
  285. }
  286. else if (!isObjectA && !isObjectB) {
  287. return String(a) === String(b);
  288. }
  289. else {
  290. return false;
  291. }
  292. }
  293. /**
  294. * Return the first index at which a loosely equal value can be
  295. * found in the array (if value is a plain object, the array must
  296. * contain an object of the same shape), or -1 if it is not present.
  297. */
  298. function looseIndexOf(arr, val) {
  299. for (let i = 0; i < arr.length; i++) {
  300. if (looseEqual(arr[i], val))
  301. return i;
  302. }
  303. return -1;
  304. }
  305. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is#polyfill
  306. function hasChanged(x, y) {
  307. if (x === y) {
  308. return x === 0 && 1 / x !== 1 / y;
  309. }
  310. else {
  311. return x === x || y === y;
  312. }
  313. }
  314. const isUnaryTag = makeMap('area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  315. 'link,meta,param,source,track,wbr');
  316. // Elements that you can, intentionally, leave open
  317. // (and which close themselves)
  318. const canBeLeftOpenTag = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source');
  319. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  320. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  321. const isNonPhrasingTag = makeMap('address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  322. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  323. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  324. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  325. 'title,tr,track');
  326. /**
  327. * unicode letters used for parsing html tags, component names and property paths.
  328. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  329. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  330. */
  331. const unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  332. /**
  333. * Define a property.
  334. */
  335. function def(obj, key, val, enumerable) {
  336. Object.defineProperty(obj, key, {
  337. value: val,
  338. enumerable: !!enumerable,
  339. writable: true,
  340. configurable: true
  341. });
  342. }
  343. /**
  344. * Not type-checking this file because it's mostly vendor code.
  345. */
  346. // Regular Expressions for parsing tags and attributes
  347. const attribute$2 = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  348. const dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  349. const ncname = `[a-zA-Z_][\\-\\.0-9_a-zA-Z${unicodeRegExp.source}]*`;
  350. const qnameCapture = `((?:${ncname}\\:)?${ncname})`;
  351. const startTagOpen = new RegExp(`^<${qnameCapture}`);
  352. const startTagClose = /^\s*(\/?)>/;
  353. const endTag = new RegExp(`^<\\/${qnameCapture}[^>]*>`);
  354. const doctype = /^<!DOCTYPE [^>]+>/i;
  355. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  356. const comment$3 = /^<!\--/;
  357. const conditionalComment = /^<!\[/;
  358. // Special Elements (can contain anything)
  359. const isPlainTextElement = makeMap('script,style,textarea', true);
  360. const reCache = {};
  361. const decodingMap = {
  362. '&lt;': '<',
  363. '&gt;': '>',
  364. '&quot;': '"',
  365. '&amp;': '&',
  366. '&#10;': '\n',
  367. '&#9;': '\t',
  368. '&#39;': "'"
  369. };
  370. const encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  371. const encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  372. // #5992
  373. const isIgnoreNewlineTag = makeMap('pre,textarea', true);
  374. const shouldIgnoreFirstNewline = (tag, html) => tag && isIgnoreNewlineTag(tag) && html[0] === '\n';
  375. function decodeAttr(value, shouldDecodeNewlines) {
  376. const re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  377. return value.replace(re, match => decodingMap[match]);
  378. }
  379. function parseHTML(html, options) {
  380. const stack = [];
  381. const expectHTML = options.expectHTML;
  382. const isUnaryTag = options.isUnaryTag || no;
  383. const canBeLeftOpenTag = options.canBeLeftOpenTag || no;
  384. let index = 0;
  385. let last, lastTag;
  386. while (html) {
  387. last = html;
  388. // Make sure we're not in a plaintext content element like script/style
  389. if (!lastTag || !isPlainTextElement(lastTag)) {
  390. let textEnd = html.indexOf('<');
  391. if (textEnd === 0) {
  392. // Comment:
  393. if (comment$3.test(html)) {
  394. const commentEnd = html.indexOf('-->');
  395. if (commentEnd >= 0) {
  396. if (options.shouldKeepComment && options.comment) {
  397. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  398. }
  399. advance(commentEnd + 3);
  400. continue;
  401. }
  402. }
  403. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  404. if (conditionalComment.test(html)) {
  405. const conditionalEnd = html.indexOf(']>');
  406. if (conditionalEnd >= 0) {
  407. advance(conditionalEnd + 2);
  408. continue;
  409. }
  410. }
  411. // Doctype:
  412. const doctypeMatch = html.match(doctype);
  413. if (doctypeMatch) {
  414. advance(doctypeMatch[0].length);
  415. continue;
  416. }
  417. // End tag:
  418. const endTagMatch = html.match(endTag);
  419. if (endTagMatch) {
  420. const curIndex = index;
  421. advance(endTagMatch[0].length);
  422. parseEndTag(endTagMatch[1], curIndex, index);
  423. continue;
  424. }
  425. // Start tag:
  426. const startTagMatch = parseStartTag();
  427. if (startTagMatch) {
  428. handleStartTag(startTagMatch);
  429. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  430. advance(1);
  431. }
  432. continue;
  433. }
  434. }
  435. let text, rest, next;
  436. if (textEnd >= 0) {
  437. rest = html.slice(textEnd);
  438. while (!endTag.test(rest) &&
  439. !startTagOpen.test(rest) &&
  440. !comment$3.test(rest) &&
  441. !conditionalComment.test(rest)) {
  442. // < in plain text, be forgiving and treat it as text
  443. next = rest.indexOf('<', 1);
  444. if (next < 0)
  445. break;
  446. textEnd += next;
  447. rest = html.slice(textEnd);
  448. }
  449. text = html.substring(0, textEnd);
  450. }
  451. if (textEnd < 0) {
  452. text = html;
  453. }
  454. if (text) {
  455. advance(text.length);
  456. }
  457. if (options.chars && text) {
  458. options.chars(text, index - text.length, index);
  459. }
  460. }
  461. else {
  462. let endTagLength = 0;
  463. const stackedTag = lastTag.toLowerCase();
  464. const reStackedTag = reCache[stackedTag] ||
  465. (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  466. const rest = html.replace(reStackedTag, function (all, text, endTag) {
  467. endTagLength = endTag.length;
  468. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  469. text = text
  470. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  471. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  472. }
  473. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  474. text = text.slice(1);
  475. }
  476. if (options.chars) {
  477. options.chars(text);
  478. }
  479. return '';
  480. });
  481. index += html.length - rest.length;
  482. html = rest;
  483. parseEndTag(stackedTag, index - endTagLength, index);
  484. }
  485. if (html === last) {
  486. options.chars && options.chars(html);
  487. if (process.env.NODE_ENV !== 'production' && !stack.length && options.warn) {
  488. options.warn(`Mal-formatted tag at end of template: "${html}"`, {
  489. start: index + html.length
  490. });
  491. }
  492. break;
  493. }
  494. }
  495. // Clean up any remaining tags
  496. parseEndTag();
  497. function advance(n) {
  498. index += n;
  499. html = html.substring(n);
  500. }
  501. function parseStartTag() {
  502. const start = html.match(startTagOpen);
  503. if (start) {
  504. const match = {
  505. tagName: start[1],
  506. attrs: [],
  507. start: index
  508. };
  509. advance(start[0].length);
  510. let end, attr;
  511. while (!(end = html.match(startTagClose)) &&
  512. (attr = html.match(dynamicArgAttribute) || html.match(attribute$2))) {
  513. attr.start = index;
  514. advance(attr[0].length);
  515. attr.end = index;
  516. match.attrs.push(attr);
  517. }
  518. if (end) {
  519. match.unarySlash = end[1];
  520. advance(end[0].length);
  521. match.end = index;
  522. return match;
  523. }
  524. }
  525. }
  526. function handleStartTag(match) {
  527. const tagName = match.tagName;
  528. const unarySlash = match.unarySlash;
  529. if (expectHTML) {
  530. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  531. parseEndTag(lastTag);
  532. }
  533. if (canBeLeftOpenTag(tagName) && lastTag === tagName) {
  534. parseEndTag(tagName);
  535. }
  536. }
  537. const unary = isUnaryTag(tagName) || !!unarySlash;
  538. const l = match.attrs.length;
  539. const attrs = new Array(l);
  540. for (let i = 0; i < l; i++) {
  541. const args = match.attrs[i];
  542. const value = args[3] || args[4] || args[5] || '';
  543. const shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  544. ? options.shouldDecodeNewlinesForHref
  545. : options.shouldDecodeNewlines;
  546. attrs[i] = {
  547. name: args[1],
  548. value: decodeAttr(value, shouldDecodeNewlines)
  549. };
  550. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  551. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  552. attrs[i].end = args.end;
  553. }
  554. }
  555. if (!unary) {
  556. stack.push({
  557. tag: tagName,
  558. lowerCasedTag: tagName.toLowerCase(),
  559. attrs: attrs,
  560. start: match.start,
  561. end: match.end
  562. });
  563. lastTag = tagName;
  564. }
  565. if (options.start) {
  566. options.start(tagName, attrs, unary, match.start, match.end);
  567. }
  568. }
  569. function parseEndTag(tagName, start, end) {
  570. let pos, lowerCasedTagName;
  571. if (start == null)
  572. start = index;
  573. if (end == null)
  574. end = index;
  575. // Find the closest opened tag of the same type
  576. if (tagName) {
  577. lowerCasedTagName = tagName.toLowerCase();
  578. for (pos = stack.length - 1; pos >= 0; pos--) {
  579. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  580. break;
  581. }
  582. }
  583. }
  584. else {
  585. // If no tag name is provided, clean shop
  586. pos = 0;
  587. }
  588. if (pos >= 0) {
  589. // Close all the open elements, up the stack
  590. for (let i = stack.length - 1; i >= pos; i--) {
  591. if (process.env.NODE_ENV !== 'production' && (i > pos || !tagName) && options.warn) {
  592. options.warn(`tag <${stack[i].tag}> has no matching end tag.`, {
  593. start: stack[i].start,
  594. end: stack[i].end
  595. });
  596. }
  597. if (options.end) {
  598. options.end(stack[i].tag, start, end);
  599. }
  600. }
  601. // Remove the open elements from the stack
  602. stack.length = pos;
  603. lastTag = pos && stack[pos - 1].tag;
  604. }
  605. else if (lowerCasedTagName === 'br') {
  606. if (options.start) {
  607. options.start(tagName, [], true, start, end);
  608. }
  609. }
  610. else if (lowerCasedTagName === 'p') {
  611. if (options.start) {
  612. options.start(tagName, [], false, start, end);
  613. }
  614. if (options.end) {
  615. options.end(tagName, start, end);
  616. }
  617. }
  618. }
  619. }
  620. const DEFAULT_FILENAME = 'anonymous.vue';
  621. const splitRE$1 = /\r?\n/g;
  622. const replaceRE = /./g;
  623. const isSpecialTag = makeMap('script,style,template', true);
  624. /**
  625. * Parse a single-file component (*.vue) file into an SFC Descriptor Object.
  626. */
  627. function parseComponent(source, options = {}) {
  628. const sfc = {
  629. source,
  630. filename: DEFAULT_FILENAME,
  631. template: null,
  632. script: null,
  633. scriptSetup: null,
  634. styles: [],
  635. customBlocks: [],
  636. cssVars: [],
  637. errors: [],
  638. shouldForceReload: null // attached in parse() by compiler-sfc
  639. };
  640. let depth = 0;
  641. let currentBlock = null;
  642. let warn = msg => {
  643. sfc.errors.push(msg);
  644. };
  645. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  646. warn = (msg, range) => {
  647. const data = { msg };
  648. if (range.start != null) {
  649. data.start = range.start;
  650. }
  651. if (range.end != null) {
  652. data.end = range.end;
  653. }
  654. sfc.errors.push(data);
  655. };
  656. }
  657. function start(tag, attrs, unary, start, end) {
  658. if (depth === 0) {
  659. currentBlock = {
  660. type: tag,
  661. content: '',
  662. start: end,
  663. end: 0,
  664. attrs: attrs.reduce((cumulated, { name, value }) => {
  665. cumulated[name] = value || true;
  666. return cumulated;
  667. }, {})
  668. };
  669. if (typeof currentBlock.attrs.src === 'string') {
  670. currentBlock.src = currentBlock.attrs.src;
  671. }
  672. if (isSpecialTag(tag)) {
  673. checkAttrs(currentBlock, attrs);
  674. if (tag === 'script') {
  675. const block = currentBlock;
  676. if (block.attrs.setup) {
  677. block.setup = currentBlock.attrs.setup;
  678. sfc.scriptSetup = block;
  679. }
  680. else {
  681. sfc.script = block;
  682. }
  683. }
  684. else if (tag === 'style') {
  685. sfc.styles.push(currentBlock);
  686. }
  687. else {
  688. sfc[tag] = currentBlock;
  689. }
  690. }
  691. else {
  692. // custom blocks
  693. sfc.customBlocks.push(currentBlock);
  694. }
  695. }
  696. if (!unary) {
  697. depth++;
  698. }
  699. }
  700. function checkAttrs(block, attrs) {
  701. for (let i = 0; i < attrs.length; i++) {
  702. const attr = attrs[i];
  703. if (attr.name === 'lang') {
  704. block.lang = attr.value;
  705. }
  706. if (attr.name === 'scoped') {
  707. block.scoped = true;
  708. }
  709. if (attr.name === 'module') {
  710. block.module = attr.value || true;
  711. }
  712. }
  713. }
  714. function end(tag, start) {
  715. if (depth === 1 && currentBlock) {
  716. currentBlock.end = start;
  717. let text = source.slice(currentBlock.start, currentBlock.end);
  718. if (options.deindent === true ||
  719. // by default, deindent unless it's script with default lang or (j/t)sx?
  720. (options.deindent !== false &&
  721. !(currentBlock.type === 'script' &&
  722. (!currentBlock.lang || /^(j|t)sx?$/.test(currentBlock.lang))))) {
  723. text = deIndent(text);
  724. }
  725. // pad content so that linters and pre-processors can output correct
  726. // line numbers in errors and warnings
  727. if (currentBlock.type !== 'template' && options.pad) {
  728. text = padContent(currentBlock, options.pad) + text;
  729. }
  730. currentBlock.content = text;
  731. currentBlock = null;
  732. }
  733. depth--;
  734. }
  735. function padContent(block, pad) {
  736. if (pad === 'space') {
  737. return source.slice(0, block.start).replace(replaceRE, ' ');
  738. }
  739. else {
  740. const offset = source.slice(0, block.start).split(splitRE$1).length;
  741. const padChar = block.type === 'script' && !block.lang ? '//\n' : '\n';
  742. return Array(offset).join(padChar);
  743. }
  744. }
  745. parseHTML(source, {
  746. warn,
  747. start,
  748. end,
  749. outputSourceRange: options.outputSourceRange
  750. });
  751. return sfc;
  752. }
  753. function pad (hash, len) {
  754. while (hash.length < len) {
  755. hash = '0' + hash;
  756. }
  757. return hash;
  758. }
  759. function fold (hash, text) {
  760. var i;
  761. var chr;
  762. var len;
  763. if (text.length === 0) {
  764. return hash;
  765. }
  766. for (i = 0, len = text.length; i < len; i++) {
  767. chr = text.charCodeAt(i);
  768. hash = ((hash << 5) - hash) + chr;
  769. hash |= 0;
  770. }
  771. return hash < 0 ? hash * -2 : hash;
  772. }
  773. function foldObject (hash, o, seen) {
  774. return Object.keys(o).sort().reduce(foldKey, hash);
  775. function foldKey (hash, key) {
  776. return foldValue(hash, o[key], key, seen);
  777. }
  778. }
  779. function foldValue (input, value, key, seen) {
  780. var hash = fold(fold(fold(input, key), toString$1(value)), typeof value);
  781. if (value === null) {
  782. return fold(hash, 'null');
  783. }
  784. if (value === undefined) {
  785. return fold(hash, 'undefined');
  786. }
  787. if (typeof value === 'object' || typeof value === 'function') {
  788. if (seen.indexOf(value) !== -1) {
  789. return fold(hash, '[Circular]' + key);
  790. }
  791. seen.push(value);
  792. var objHash = foldObject(hash, value, seen);
  793. if (!('valueOf' in value) || typeof value.valueOf !== 'function') {
  794. return objHash;
  795. }
  796. try {
  797. return fold(objHash, String(value.valueOf()))
  798. } catch (err) {
  799. return fold(objHash, '[valueOf exception]' + (err.stack || err.message))
  800. }
  801. }
  802. return fold(hash, value.toString());
  803. }
  804. function toString$1 (o) {
  805. return Object.prototype.toString.call(o);
  806. }
  807. function sum (o) {
  808. return pad(foldValue(0, o, '', []).toString(16), 8);
  809. }
  810. var hashSum = sum;
  811. var iterator;
  812. var hasRequiredIterator;
  813. function requireIterator () {
  814. if (hasRequiredIterator) return iterator;
  815. hasRequiredIterator = 1;
  816. iterator = function (Yallist) {
  817. Yallist.prototype[Symbol.iterator] = function* () {
  818. for (let walker = this.head; walker; walker = walker.next) {
  819. yield walker.value;
  820. }
  821. };
  822. };
  823. return iterator;
  824. }
  825. var yallist = Yallist$1;
  826. Yallist$1.Node = Node;
  827. Yallist$1.create = Yallist$1;
  828. function Yallist$1 (list) {
  829. var self = this;
  830. if (!(self instanceof Yallist$1)) {
  831. self = new Yallist$1();
  832. }
  833. self.tail = null;
  834. self.head = null;
  835. self.length = 0;
  836. if (list && typeof list.forEach === 'function') {
  837. list.forEach(function (item) {
  838. self.push(item);
  839. });
  840. } else if (arguments.length > 0) {
  841. for (var i = 0, l = arguments.length; i < l; i++) {
  842. self.push(arguments[i]);
  843. }
  844. }
  845. return self
  846. }
  847. Yallist$1.prototype.removeNode = function (node) {
  848. if (node.list !== this) {
  849. throw new Error('removing node which does not belong to this list')
  850. }
  851. var next = node.next;
  852. var prev = node.prev;
  853. if (next) {
  854. next.prev = prev;
  855. }
  856. if (prev) {
  857. prev.next = next;
  858. }
  859. if (node === this.head) {
  860. this.head = next;
  861. }
  862. if (node === this.tail) {
  863. this.tail = prev;
  864. }
  865. node.list.length--;
  866. node.next = null;
  867. node.prev = null;
  868. node.list = null;
  869. return next
  870. };
  871. Yallist$1.prototype.unshiftNode = function (node) {
  872. if (node === this.head) {
  873. return
  874. }
  875. if (node.list) {
  876. node.list.removeNode(node);
  877. }
  878. var head = this.head;
  879. node.list = this;
  880. node.next = head;
  881. if (head) {
  882. head.prev = node;
  883. }
  884. this.head = node;
  885. if (!this.tail) {
  886. this.tail = node;
  887. }
  888. this.length++;
  889. };
  890. Yallist$1.prototype.pushNode = function (node) {
  891. if (node === this.tail) {
  892. return
  893. }
  894. if (node.list) {
  895. node.list.removeNode(node);
  896. }
  897. var tail = this.tail;
  898. node.list = this;
  899. node.prev = tail;
  900. if (tail) {
  901. tail.next = node;
  902. }
  903. this.tail = node;
  904. if (!this.head) {
  905. this.head = node;
  906. }
  907. this.length++;
  908. };
  909. Yallist$1.prototype.push = function () {
  910. for (var i = 0, l = arguments.length; i < l; i++) {
  911. push(this, arguments[i]);
  912. }
  913. return this.length
  914. };
  915. Yallist$1.prototype.unshift = function () {
  916. for (var i = 0, l = arguments.length; i < l; i++) {
  917. unshift(this, arguments[i]);
  918. }
  919. return this.length
  920. };
  921. Yallist$1.prototype.pop = function () {
  922. if (!this.tail) {
  923. return undefined
  924. }
  925. var res = this.tail.value;
  926. this.tail = this.tail.prev;
  927. if (this.tail) {
  928. this.tail.next = null;
  929. } else {
  930. this.head = null;
  931. }
  932. this.length--;
  933. return res
  934. };
  935. Yallist$1.prototype.shift = function () {
  936. if (!this.head) {
  937. return undefined
  938. }
  939. var res = this.head.value;
  940. this.head = this.head.next;
  941. if (this.head) {
  942. this.head.prev = null;
  943. } else {
  944. this.tail = null;
  945. }
  946. this.length--;
  947. return res
  948. };
  949. Yallist$1.prototype.forEach = function (fn, thisp) {
  950. thisp = thisp || this;
  951. for (var walker = this.head, i = 0; walker !== null; i++) {
  952. fn.call(thisp, walker.value, i, this);
  953. walker = walker.next;
  954. }
  955. };
  956. Yallist$1.prototype.forEachReverse = function (fn, thisp) {
  957. thisp = thisp || this;
  958. for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
  959. fn.call(thisp, walker.value, i, this);
  960. walker = walker.prev;
  961. }
  962. };
  963. Yallist$1.prototype.get = function (n) {
  964. for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
  965. // abort out of the list early if we hit a cycle
  966. walker = walker.next;
  967. }
  968. if (i === n && walker !== null) {
  969. return walker.value
  970. }
  971. };
  972. Yallist$1.prototype.getReverse = function (n) {
  973. for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
  974. // abort out of the list early if we hit a cycle
  975. walker = walker.prev;
  976. }
  977. if (i === n && walker !== null) {
  978. return walker.value
  979. }
  980. };
  981. Yallist$1.prototype.map = function (fn, thisp) {
  982. thisp = thisp || this;
  983. var res = new Yallist$1();
  984. for (var walker = this.head; walker !== null;) {
  985. res.push(fn.call(thisp, walker.value, this));
  986. walker = walker.next;
  987. }
  988. return res
  989. };
  990. Yallist$1.prototype.mapReverse = function (fn, thisp) {
  991. thisp = thisp || this;
  992. var res = new Yallist$1();
  993. for (var walker = this.tail; walker !== null;) {
  994. res.push(fn.call(thisp, walker.value, this));
  995. walker = walker.prev;
  996. }
  997. return res
  998. };
  999. Yallist$1.prototype.reduce = function (fn, initial) {
  1000. var acc;
  1001. var walker = this.head;
  1002. if (arguments.length > 1) {
  1003. acc = initial;
  1004. } else if (this.head) {
  1005. walker = this.head.next;
  1006. acc = this.head.value;
  1007. } else {
  1008. throw new TypeError('Reduce of empty list with no initial value')
  1009. }
  1010. for (var i = 0; walker !== null; i++) {
  1011. acc = fn(acc, walker.value, i);
  1012. walker = walker.next;
  1013. }
  1014. return acc
  1015. };
  1016. Yallist$1.prototype.reduceReverse = function (fn, initial) {
  1017. var acc;
  1018. var walker = this.tail;
  1019. if (arguments.length > 1) {
  1020. acc = initial;
  1021. } else if (this.tail) {
  1022. walker = this.tail.prev;
  1023. acc = this.tail.value;
  1024. } else {
  1025. throw new TypeError('Reduce of empty list with no initial value')
  1026. }
  1027. for (var i = this.length - 1; walker !== null; i--) {
  1028. acc = fn(acc, walker.value, i);
  1029. walker = walker.prev;
  1030. }
  1031. return acc
  1032. };
  1033. Yallist$1.prototype.toArray = function () {
  1034. var arr = new Array(this.length);
  1035. for (var i = 0, walker = this.head; walker !== null; i++) {
  1036. arr[i] = walker.value;
  1037. walker = walker.next;
  1038. }
  1039. return arr
  1040. };
  1041. Yallist$1.prototype.toArrayReverse = function () {
  1042. var arr = new Array(this.length);
  1043. for (var i = 0, walker = this.tail; walker !== null; i++) {
  1044. arr[i] = walker.value;
  1045. walker = walker.prev;
  1046. }
  1047. return arr
  1048. };
  1049. Yallist$1.prototype.slice = function (from, to) {
  1050. to = to || this.length;
  1051. if (to < 0) {
  1052. to += this.length;
  1053. }
  1054. from = from || 0;
  1055. if (from < 0) {
  1056. from += this.length;
  1057. }
  1058. var ret = new Yallist$1();
  1059. if (to < from || to < 0) {
  1060. return ret
  1061. }
  1062. if (from < 0) {
  1063. from = 0;
  1064. }
  1065. if (to > this.length) {
  1066. to = this.length;
  1067. }
  1068. for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
  1069. walker = walker.next;
  1070. }
  1071. for (; walker !== null && i < to; i++, walker = walker.next) {
  1072. ret.push(walker.value);
  1073. }
  1074. return ret
  1075. };
  1076. Yallist$1.prototype.sliceReverse = function (from, to) {
  1077. to = to || this.length;
  1078. if (to < 0) {
  1079. to += this.length;
  1080. }
  1081. from = from || 0;
  1082. if (from < 0) {
  1083. from += this.length;
  1084. }
  1085. var ret = new Yallist$1();
  1086. if (to < from || to < 0) {
  1087. return ret
  1088. }
  1089. if (from < 0) {
  1090. from = 0;
  1091. }
  1092. if (to > this.length) {
  1093. to = this.length;
  1094. }
  1095. for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
  1096. walker = walker.prev;
  1097. }
  1098. for (; walker !== null && i > from; i--, walker = walker.prev) {
  1099. ret.push(walker.value);
  1100. }
  1101. return ret
  1102. };
  1103. Yallist$1.prototype.splice = function (start, deleteCount /*, ...nodes */) {
  1104. if (start > this.length) {
  1105. start = this.length - 1;
  1106. }
  1107. if (start < 0) {
  1108. start = this.length + start;
  1109. }
  1110. for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
  1111. walker = walker.next;
  1112. }
  1113. var ret = [];
  1114. for (var i = 0; walker && i < deleteCount; i++) {
  1115. ret.push(walker.value);
  1116. walker = this.removeNode(walker);
  1117. }
  1118. if (walker === null) {
  1119. walker = this.tail;
  1120. }
  1121. if (walker !== this.head && walker !== this.tail) {
  1122. walker = walker.prev;
  1123. }
  1124. for (var i = 2; i < arguments.length; i++) {
  1125. walker = insert(this, walker, arguments[i]);
  1126. }
  1127. return ret;
  1128. };
  1129. Yallist$1.prototype.reverse = function () {
  1130. var head = this.head;
  1131. var tail = this.tail;
  1132. for (var walker = head; walker !== null; walker = walker.prev) {
  1133. var p = walker.prev;
  1134. walker.prev = walker.next;
  1135. walker.next = p;
  1136. }
  1137. this.head = tail;
  1138. this.tail = head;
  1139. return this
  1140. };
  1141. function insert (self, node, value) {
  1142. var inserted = node === self.head ?
  1143. new Node(value, null, node, self) :
  1144. new Node(value, node, node.next, self);
  1145. if (inserted.next === null) {
  1146. self.tail = inserted;
  1147. }
  1148. if (inserted.prev === null) {
  1149. self.head = inserted;
  1150. }
  1151. self.length++;
  1152. return inserted
  1153. }
  1154. function push (self, item) {
  1155. self.tail = new Node(item, self.tail, null, self);
  1156. if (!self.head) {
  1157. self.head = self.tail;
  1158. }
  1159. self.length++;
  1160. }
  1161. function unshift (self, item) {
  1162. self.head = new Node(item, null, self.head, self);
  1163. if (!self.tail) {
  1164. self.tail = self.head;
  1165. }
  1166. self.length++;
  1167. }
  1168. function Node (value, prev, next, list) {
  1169. if (!(this instanceof Node)) {
  1170. return new Node(value, prev, next, list)
  1171. }
  1172. this.list = list;
  1173. this.value = value;
  1174. if (prev) {
  1175. prev.next = this;
  1176. this.prev = prev;
  1177. } else {
  1178. this.prev = null;
  1179. }
  1180. if (next) {
  1181. next.prev = this;
  1182. this.next = next;
  1183. } else {
  1184. this.next = null;
  1185. }
  1186. }
  1187. try {
  1188. // add if support for Symbol.iterator is present
  1189. requireIterator()(Yallist$1);
  1190. } catch (er) {}
  1191. // A linked list to keep track of recently-used-ness
  1192. const Yallist = yallist;
  1193. const MAX = Symbol('max');
  1194. const LENGTH = Symbol('length');
  1195. const LENGTH_CALCULATOR = Symbol('lengthCalculator');
  1196. const ALLOW_STALE = Symbol('allowStale');
  1197. const MAX_AGE = Symbol('maxAge');
  1198. const DISPOSE = Symbol('dispose');
  1199. const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet');
  1200. const LRU_LIST = Symbol('lruList');
  1201. const CACHE = Symbol('cache');
  1202. const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet');
  1203. const naiveLength = () => 1;
  1204. // lruList is a yallist where the head is the youngest
  1205. // item, and the tail is the oldest. the list contains the Hit
  1206. // objects as the entries.
  1207. // Each Hit object has a reference to its Yallist.Node. This
  1208. // never changes.
  1209. //
  1210. // cache is a Map (or PseudoMap) that matches the keys to
  1211. // the Yallist.Node object.
  1212. class LRUCache {
  1213. constructor (options) {
  1214. if (typeof options === 'number')
  1215. options = { max: options };
  1216. if (!options)
  1217. options = {};
  1218. if (options.max && (typeof options.max !== 'number' || options.max < 0))
  1219. throw new TypeError('max must be a non-negative number')
  1220. // Kind of weird to have a default max of Infinity, but oh well.
  1221. this[MAX] = options.max || Infinity;
  1222. const lc = options.length || naiveLength;
  1223. this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc;
  1224. this[ALLOW_STALE] = options.stale || false;
  1225. if (options.maxAge && typeof options.maxAge !== 'number')
  1226. throw new TypeError('maxAge must be a number')
  1227. this[MAX_AGE] = options.maxAge || 0;
  1228. this[DISPOSE] = options.dispose;
  1229. this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
  1230. this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
  1231. this.reset();
  1232. }
  1233. // resize the cache when the max changes.
  1234. set max (mL) {
  1235. if (typeof mL !== 'number' || mL < 0)
  1236. throw new TypeError('max must be a non-negative number')
  1237. this[MAX] = mL || Infinity;
  1238. trim(this);
  1239. }
  1240. get max () {
  1241. return this[MAX]
  1242. }
  1243. set allowStale (allowStale) {
  1244. this[ALLOW_STALE] = !!allowStale;
  1245. }
  1246. get allowStale () {
  1247. return this[ALLOW_STALE]
  1248. }
  1249. set maxAge (mA) {
  1250. if (typeof mA !== 'number')
  1251. throw new TypeError('maxAge must be a non-negative number')
  1252. this[MAX_AGE] = mA;
  1253. trim(this);
  1254. }
  1255. get maxAge () {
  1256. return this[MAX_AGE]
  1257. }
  1258. // resize the cache when the lengthCalculator changes.
  1259. set lengthCalculator (lC) {
  1260. if (typeof lC !== 'function')
  1261. lC = naiveLength;
  1262. if (lC !== this[LENGTH_CALCULATOR]) {
  1263. this[LENGTH_CALCULATOR] = lC;
  1264. this[LENGTH] = 0;
  1265. this[LRU_LIST].forEach(hit => {
  1266. hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
  1267. this[LENGTH] += hit.length;
  1268. });
  1269. }
  1270. trim(this);
  1271. }
  1272. get lengthCalculator () { return this[LENGTH_CALCULATOR] }
  1273. get length () { return this[LENGTH] }
  1274. get itemCount () { return this[LRU_LIST].length }
  1275. rforEach (fn, thisp) {
  1276. thisp = thisp || this;
  1277. for (let walker = this[LRU_LIST].tail; walker !== null;) {
  1278. const prev = walker.prev;
  1279. forEachStep(this, fn, walker, thisp);
  1280. walker = prev;
  1281. }
  1282. }
  1283. forEach (fn, thisp) {
  1284. thisp = thisp || this;
  1285. for (let walker = this[LRU_LIST].head; walker !== null;) {
  1286. const next = walker.next;
  1287. forEachStep(this, fn, walker, thisp);
  1288. walker = next;
  1289. }
  1290. }
  1291. keys () {
  1292. return this[LRU_LIST].toArray().map(k => k.key)
  1293. }
  1294. values () {
  1295. return this[LRU_LIST].toArray().map(k => k.value)
  1296. }
  1297. reset () {
  1298. if (this[DISPOSE] &&
  1299. this[LRU_LIST] &&
  1300. this[LRU_LIST].length) {
  1301. this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value));
  1302. }
  1303. this[CACHE] = new Map(); // hash of items by key
  1304. this[LRU_LIST] = new Yallist(); // list of items in order of use recency
  1305. this[LENGTH] = 0; // length of items in the list
  1306. }
  1307. dump () {
  1308. return this[LRU_LIST].map(hit =>
  1309. isStale(this, hit) ? false : {
  1310. k: hit.key,
  1311. v: hit.value,
  1312. e: hit.now + (hit.maxAge || 0)
  1313. }).toArray().filter(h => h)
  1314. }
  1315. dumpLru () {
  1316. return this[LRU_LIST]
  1317. }
  1318. set (key, value, maxAge) {
  1319. maxAge = maxAge || this[MAX_AGE];
  1320. if (maxAge && typeof maxAge !== 'number')
  1321. throw new TypeError('maxAge must be a number')
  1322. const now = maxAge ? Date.now() : 0;
  1323. const len = this[LENGTH_CALCULATOR](value, key);
  1324. if (this[CACHE].has(key)) {
  1325. if (len > this[MAX]) {
  1326. del(this, this[CACHE].get(key));
  1327. return false
  1328. }
  1329. const node = this[CACHE].get(key);
  1330. const item = node.value;
  1331. // dispose of the old one before overwriting
  1332. // split out into 2 ifs for better coverage tracking
  1333. if (this[DISPOSE]) {
  1334. if (!this[NO_DISPOSE_ON_SET])
  1335. this[DISPOSE](key, item.value);
  1336. }
  1337. item.now = now;
  1338. item.maxAge = maxAge;
  1339. item.value = value;
  1340. this[LENGTH] += len - item.length;
  1341. item.length = len;
  1342. this.get(key);
  1343. trim(this);
  1344. return true
  1345. }
  1346. const hit = new Entry(key, value, len, now, maxAge);
  1347. // oversized objects fall out of cache automatically.
  1348. if (hit.length > this[MAX]) {
  1349. if (this[DISPOSE])
  1350. this[DISPOSE](key, value);
  1351. return false
  1352. }
  1353. this[LENGTH] += hit.length;
  1354. this[LRU_LIST].unshift(hit);
  1355. this[CACHE].set(key, this[LRU_LIST].head);
  1356. trim(this);
  1357. return true
  1358. }
  1359. has (key) {
  1360. if (!this[CACHE].has(key)) return false
  1361. const hit = this[CACHE].get(key).value;
  1362. return !isStale(this, hit)
  1363. }
  1364. get (key) {
  1365. return get(this, key, true)
  1366. }
  1367. peek (key) {
  1368. return get(this, key, false)
  1369. }
  1370. pop () {
  1371. const node = this[LRU_LIST].tail;
  1372. if (!node)
  1373. return null
  1374. del(this, node);
  1375. return node.value
  1376. }
  1377. del (key) {
  1378. del(this, this[CACHE].get(key));
  1379. }
  1380. load (arr) {
  1381. // reset the cache
  1382. this.reset();
  1383. const now = Date.now();
  1384. // A previous serialized cache has the most recent items first
  1385. for (let l = arr.length - 1; l >= 0; l--) {
  1386. const hit = arr[l];
  1387. const expiresAt = hit.e || 0;
  1388. if (expiresAt === 0)
  1389. // the item was created without expiration in a non aged cache
  1390. this.set(hit.k, hit.v);
  1391. else {
  1392. const maxAge = expiresAt - now;
  1393. // dont add already expired items
  1394. if (maxAge > 0) {
  1395. this.set(hit.k, hit.v, maxAge);
  1396. }
  1397. }
  1398. }
  1399. }
  1400. prune () {
  1401. this[CACHE].forEach((value, key) => get(this, key, false));
  1402. }
  1403. }
  1404. const get = (self, key, doUse) => {
  1405. const node = self[CACHE].get(key);
  1406. if (node) {
  1407. const hit = node.value;
  1408. if (isStale(self, hit)) {
  1409. del(self, node);
  1410. if (!self[ALLOW_STALE])
  1411. return undefined
  1412. } else {
  1413. if (doUse) {
  1414. if (self[UPDATE_AGE_ON_GET])
  1415. node.value.now = Date.now();
  1416. self[LRU_LIST].unshiftNode(node);
  1417. }
  1418. }
  1419. return hit.value
  1420. }
  1421. };
  1422. const isStale = (self, hit) => {
  1423. if (!hit || (!hit.maxAge && !self[MAX_AGE]))
  1424. return false
  1425. const diff = Date.now() - hit.now;
  1426. return hit.maxAge ? diff > hit.maxAge
  1427. : self[MAX_AGE] && (diff > self[MAX_AGE])
  1428. };
  1429. const trim = self => {
  1430. if (self[LENGTH] > self[MAX]) {
  1431. for (let walker = self[LRU_LIST].tail;
  1432. self[LENGTH] > self[MAX] && walker !== null;) {
  1433. // We know that we're about to delete this one, and also
  1434. // what the next least recently used key will be, so just
  1435. // go ahead and set it now.
  1436. const prev = walker.prev;
  1437. del(self, walker);
  1438. walker = prev;
  1439. }
  1440. }
  1441. };
  1442. const del = (self, node) => {
  1443. if (node) {
  1444. const hit = node.value;
  1445. if (self[DISPOSE])
  1446. self[DISPOSE](hit.key, hit.value);
  1447. self[LENGTH] -= hit.length;
  1448. self[CACHE].delete(hit.key);
  1449. self[LRU_LIST].removeNode(node);
  1450. }
  1451. };
  1452. class Entry {
  1453. constructor (key, value, length, now, maxAge) {
  1454. this.key = key;
  1455. this.value = value;
  1456. this.length = length;
  1457. this.now = now;
  1458. this.maxAge = maxAge || 0;
  1459. }
  1460. }
  1461. const forEachStep = (self, fn, node, thisp) => {
  1462. let hit = node.value;
  1463. if (isStale(self, hit)) {
  1464. del(self, node);
  1465. if (!self[ALLOW_STALE])
  1466. hit = undefined;
  1467. }
  1468. if (hit)
  1469. fn.call(thisp, hit.value, hit.key, self);
  1470. };
  1471. var lruCache = LRUCache;
  1472. var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  1473. function encode(decoded) {
  1474. var sourceFileIndex = 0; // second field
  1475. var sourceCodeLine = 0; // third field
  1476. var sourceCodeColumn = 0; // fourth field
  1477. var nameIndex = 0; // fifth field
  1478. var mappings = '';
  1479. for (var i = 0; i < decoded.length; i++) {
  1480. var line = decoded[i];
  1481. if (i > 0)
  1482. mappings += ';';
  1483. if (line.length === 0)
  1484. continue;
  1485. var generatedCodeColumn = 0; // first field
  1486. var lineMappings = [];
  1487. for (var _i = 0, line_1 = line; _i < line_1.length; _i++) {
  1488. var segment = line_1[_i];
  1489. var segmentMappings = encodeInteger(segment[0] - generatedCodeColumn);
  1490. generatedCodeColumn = segment[0];
  1491. if (segment.length > 1) {
  1492. segmentMappings +=
  1493. encodeInteger(segment[1] - sourceFileIndex) +
  1494. encodeInteger(segment[2] - sourceCodeLine) +
  1495. encodeInteger(segment[3] - sourceCodeColumn);
  1496. sourceFileIndex = segment[1];
  1497. sourceCodeLine = segment[2];
  1498. sourceCodeColumn = segment[3];
  1499. }
  1500. if (segment.length === 5) {
  1501. segmentMappings += encodeInteger(segment[4] - nameIndex);
  1502. nameIndex = segment[4];
  1503. }
  1504. lineMappings.push(segmentMappings);
  1505. }
  1506. mappings += lineMappings.join(',');
  1507. }
  1508. return mappings;
  1509. }
  1510. function encodeInteger(num) {
  1511. var result = '';
  1512. num = num < 0 ? (-num << 1) | 1 : num << 1;
  1513. do {
  1514. var clamped = num & 31;
  1515. num >>>= 5;
  1516. if (num > 0) {
  1517. clamped |= 32;
  1518. }
  1519. result += chars[clamped];
  1520. } while (num > 0);
  1521. return result;
  1522. }
  1523. var BitSet = function BitSet(arg) {
  1524. this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
  1525. };
  1526. BitSet.prototype.add = function add (n) {
  1527. this.bits[n >> 5] |= 1 << (n & 31);
  1528. };
  1529. BitSet.prototype.has = function has (n) {
  1530. return !!(this.bits[n >> 5] & (1 << (n & 31)));
  1531. };
  1532. var Chunk = function Chunk(start, end, content) {
  1533. this.start = start;
  1534. this.end = end;
  1535. this.original = content;
  1536. this.intro = '';
  1537. this.outro = '';
  1538. this.content = content;
  1539. this.storeName = false;
  1540. this.edited = false;
  1541. // we make these non-enumerable, for sanity while debugging
  1542. Object.defineProperties(this, {
  1543. previous: { writable: true, value: null },
  1544. next: { writable: true, value: null },
  1545. });
  1546. };
  1547. Chunk.prototype.appendLeft = function appendLeft (content) {
  1548. this.outro += content;
  1549. };
  1550. Chunk.prototype.appendRight = function appendRight (content) {
  1551. this.intro = this.intro + content;
  1552. };
  1553. Chunk.prototype.clone = function clone () {
  1554. var chunk = new Chunk(this.start, this.end, this.original);
  1555. chunk.intro = this.intro;
  1556. chunk.outro = this.outro;
  1557. chunk.content = this.content;
  1558. chunk.storeName = this.storeName;
  1559. chunk.edited = this.edited;
  1560. return chunk;
  1561. };
  1562. Chunk.prototype.contains = function contains (index) {
  1563. return this.start < index && index < this.end;
  1564. };
  1565. Chunk.prototype.eachNext = function eachNext (fn) {
  1566. var chunk = this;
  1567. while (chunk) {
  1568. fn(chunk);
  1569. chunk = chunk.next;
  1570. }
  1571. };
  1572. Chunk.prototype.eachPrevious = function eachPrevious (fn) {
  1573. var chunk = this;
  1574. while (chunk) {
  1575. fn(chunk);
  1576. chunk = chunk.previous;
  1577. }
  1578. };
  1579. Chunk.prototype.edit = function edit (content, storeName, contentOnly) {
  1580. this.content = content;
  1581. if (!contentOnly) {
  1582. this.intro = '';
  1583. this.outro = '';
  1584. }
  1585. this.storeName = storeName;
  1586. this.edited = true;
  1587. return this;
  1588. };
  1589. Chunk.prototype.prependLeft = function prependLeft (content) {
  1590. this.outro = content + this.outro;
  1591. };
  1592. Chunk.prototype.prependRight = function prependRight (content) {
  1593. this.intro = content + this.intro;
  1594. };
  1595. Chunk.prototype.split = function split (index) {
  1596. var sliceIndex = index - this.start;
  1597. var originalBefore = this.original.slice(0, sliceIndex);
  1598. var originalAfter = this.original.slice(sliceIndex);
  1599. this.original = originalBefore;
  1600. var newChunk = new Chunk(index, this.end, originalAfter);
  1601. newChunk.outro = this.outro;
  1602. this.outro = '';
  1603. this.end = index;
  1604. if (this.edited) {
  1605. // TODO is this block necessary?...
  1606. newChunk.edit('', false);
  1607. this.content = '';
  1608. } else {
  1609. this.content = originalBefore;
  1610. }
  1611. newChunk.next = this.next;
  1612. if (newChunk.next) { newChunk.next.previous = newChunk; }
  1613. newChunk.previous = this;
  1614. this.next = newChunk;
  1615. return newChunk;
  1616. };
  1617. Chunk.prototype.toString = function toString () {
  1618. return this.intro + this.content + this.outro;
  1619. };
  1620. Chunk.prototype.trimEnd = function trimEnd (rx) {
  1621. this.outro = this.outro.replace(rx, '');
  1622. if (this.outro.length) { return true; }
  1623. var trimmed = this.content.replace(rx, '');
  1624. if (trimmed.length) {
  1625. if (trimmed !== this.content) {
  1626. this.split(this.start + trimmed.length).edit('', undefined, true);
  1627. }
  1628. return true;
  1629. } else {
  1630. this.edit('', undefined, true);
  1631. this.intro = this.intro.replace(rx, '');
  1632. if (this.intro.length) { return true; }
  1633. }
  1634. };
  1635. Chunk.prototype.trimStart = function trimStart (rx) {
  1636. this.intro = this.intro.replace(rx, '');
  1637. if (this.intro.length) { return true; }
  1638. var trimmed = this.content.replace(rx, '');
  1639. if (trimmed.length) {
  1640. if (trimmed !== this.content) {
  1641. this.split(this.end - trimmed.length);
  1642. this.edit('', undefined, true);
  1643. }
  1644. return true;
  1645. } else {
  1646. this.edit('', undefined, true);
  1647. this.outro = this.outro.replace(rx, '');
  1648. if (this.outro.length) { return true; }
  1649. }
  1650. };
  1651. var btoa = function () {
  1652. throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');
  1653. };
  1654. if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
  1655. btoa = function (str) { return window.btoa(unescape(encodeURIComponent(str))); };
  1656. } else if (typeof Buffer === 'function') {
  1657. btoa = function (str) { return Buffer.from(str, 'utf-8').toString('base64'); };
  1658. }
  1659. var SourceMap = function SourceMap(properties) {
  1660. this.version = 3;
  1661. this.file = properties.file;
  1662. this.sources = properties.sources;
  1663. this.sourcesContent = properties.sourcesContent;
  1664. this.names = properties.names;
  1665. this.mappings = encode(properties.mappings);
  1666. };
  1667. SourceMap.prototype.toString = function toString () {
  1668. return JSON.stringify(this);
  1669. };
  1670. SourceMap.prototype.toUrl = function toUrl () {
  1671. return 'data:application/json;charset=utf-8;base64,' + btoa(this.toString());
  1672. };
  1673. function guessIndent(code) {
  1674. var lines = code.split('\n');
  1675. var tabbed = lines.filter(function (line) { return /^\t+/.test(line); });
  1676. var spaced = lines.filter(function (line) { return /^ {2,}/.test(line); });
  1677. if (tabbed.length === 0 && spaced.length === 0) {
  1678. return null;
  1679. }
  1680. // More lines tabbed than spaced? Assume tabs, and
  1681. // default to tabs in the case of a tie (or nothing
  1682. // to go on)
  1683. if (tabbed.length >= spaced.length) {
  1684. return '\t';
  1685. }
  1686. // Otherwise, we need to guess the multiple
  1687. var min = spaced.reduce(function (previous, current) {
  1688. var numSpaces = /^ +/.exec(current)[0].length;
  1689. return Math.min(numSpaces, previous);
  1690. }, Infinity);
  1691. return new Array(min + 1).join(' ');
  1692. }
  1693. function getRelativePath(from, to) {
  1694. var fromParts = from.split(/[/\\]/);
  1695. var toParts = to.split(/[/\\]/);
  1696. fromParts.pop(); // get dirname
  1697. while (fromParts[0] === toParts[0]) {
  1698. fromParts.shift();
  1699. toParts.shift();
  1700. }
  1701. if (fromParts.length) {
  1702. var i = fromParts.length;
  1703. while (i--) { fromParts[i] = '..'; }
  1704. }
  1705. return fromParts.concat(toParts).join('/');
  1706. }
  1707. var toString = Object.prototype.toString;
  1708. function isObject(thing) {
  1709. return toString.call(thing) === '[object Object]';
  1710. }
  1711. function getLocator(source) {
  1712. var originalLines = source.split('\n');
  1713. var lineOffsets = [];
  1714. for (var i = 0, pos = 0; i < originalLines.length; i++) {
  1715. lineOffsets.push(pos);
  1716. pos += originalLines[i].length + 1;
  1717. }
  1718. return function locate(index) {
  1719. var i = 0;
  1720. var j = lineOffsets.length;
  1721. while (i < j) {
  1722. var m = (i + j) >> 1;
  1723. if (index < lineOffsets[m]) {
  1724. j = m;
  1725. } else {
  1726. i = m + 1;
  1727. }
  1728. }
  1729. var line = i - 1;
  1730. var column = index - lineOffsets[line];
  1731. return { line: line, column: column };
  1732. };
  1733. }
  1734. var Mappings = function Mappings(hires) {
  1735. this.hires = hires;
  1736. this.generatedCodeLine = 0;
  1737. this.generatedCodeColumn = 0;
  1738. this.raw = [];
  1739. this.rawSegments = this.raw[this.generatedCodeLine] = [];
  1740. this.pending = null;
  1741. };
  1742. Mappings.prototype.addEdit = function addEdit (sourceIndex, content, loc, nameIndex) {
  1743. if (content.length) {
  1744. var segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
  1745. if (nameIndex >= 0) {
  1746. segment.push(nameIndex);
  1747. }
  1748. this.rawSegments.push(segment);
  1749. } else if (this.pending) {
  1750. this.rawSegments.push(this.pending);
  1751. }
  1752. this.advance(content);
  1753. this.pending = null;
  1754. };
  1755. Mappings.prototype.addUneditedChunk = function addUneditedChunk (sourceIndex, chunk, original, loc, sourcemapLocations) {
  1756. var originalCharIndex = chunk.start;
  1757. var first = true;
  1758. while (originalCharIndex < chunk.end) {
  1759. if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
  1760. this.rawSegments.push([this.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
  1761. }
  1762. if (original[originalCharIndex] === '\n') {
  1763. loc.line += 1;
  1764. loc.column = 0;
  1765. this.generatedCodeLine += 1;
  1766. this.raw[this.generatedCodeLine] = this.rawSegments = [];
  1767. this.generatedCodeColumn = 0;
  1768. first = true;
  1769. } else {
  1770. loc.column += 1;
  1771. this.generatedCodeColumn += 1;
  1772. first = false;
  1773. }
  1774. originalCharIndex += 1;
  1775. }
  1776. this.pending = null;
  1777. };
  1778. Mappings.prototype.advance = function advance (str) {
  1779. if (!str) { return; }
  1780. var lines = str.split('\n');
  1781. if (lines.length > 1) {
  1782. for (var i = 0; i < lines.length - 1; i++) {
  1783. this.generatedCodeLine++;
  1784. this.raw[this.generatedCodeLine] = this.rawSegments = [];
  1785. }
  1786. this.generatedCodeColumn = 0;
  1787. }
  1788. this.generatedCodeColumn += lines[lines.length - 1].length;
  1789. };
  1790. var n = '\n';
  1791. var warned = {
  1792. insertLeft: false,
  1793. insertRight: false,
  1794. storeName: false,
  1795. };
  1796. var MagicString = function MagicString(string, options) {
  1797. if ( options === void 0 ) options = {};
  1798. var chunk = new Chunk(0, string.length, string);
  1799. Object.defineProperties(this, {
  1800. original: { writable: true, value: string },
  1801. outro: { writable: true, value: '' },
  1802. intro: { writable: true, value: '' },
  1803. firstChunk: { writable: true, value: chunk },
  1804. lastChunk: { writable: true, value: chunk },
  1805. lastSearchedChunk: { writable: true, value: chunk },
  1806. byStart: { writable: true, value: {} },
  1807. byEnd: { writable: true, value: {} },
  1808. filename: { writable: true, value: options.filename },
  1809. indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
  1810. sourcemapLocations: { writable: true, value: new BitSet() },
  1811. storedNames: { writable: true, value: {} },
  1812. indentStr: { writable: true, value: guessIndent(string) },
  1813. });
  1814. this.byStart[0] = chunk;
  1815. this.byEnd[string.length] = chunk;
  1816. };
  1817. MagicString.prototype.addSourcemapLocation = function addSourcemapLocation (char) {
  1818. this.sourcemapLocations.add(char);
  1819. };
  1820. MagicString.prototype.append = function append (content) {
  1821. if (typeof content !== 'string') { throw new TypeError('outro content must be a string'); }
  1822. this.outro += content;
  1823. return this;
  1824. };
  1825. MagicString.prototype.appendLeft = function appendLeft (index, content) {
  1826. if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
  1827. this._split(index);
  1828. var chunk = this.byEnd[index];
  1829. if (chunk) {
  1830. chunk.appendLeft(content);
  1831. } else {
  1832. this.intro += content;
  1833. }
  1834. return this;
  1835. };
  1836. MagicString.prototype.appendRight = function appendRight (index, content) {
  1837. if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
  1838. this._split(index);
  1839. var chunk = this.byStart[index];
  1840. if (chunk) {
  1841. chunk.appendRight(content);
  1842. } else {
  1843. this.outro += content;
  1844. }
  1845. return this;
  1846. };
  1847. MagicString.prototype.clone = function clone () {
  1848. var cloned = new MagicString(this.original, { filename: this.filename });
  1849. var originalChunk = this.firstChunk;
  1850. var clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());
  1851. while (originalChunk) {
  1852. cloned.byStart[clonedChunk.start] = clonedChunk;
  1853. cloned.byEnd[clonedChunk.end] = clonedChunk;
  1854. var nextOriginalChunk = originalChunk.next;
  1855. var nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
  1856. if (nextClonedChunk) {
  1857. clonedChunk.next = nextClonedChunk;
  1858. nextClonedChunk.previous = clonedChunk;
  1859. clonedChunk = nextClonedChunk;
  1860. }
  1861. originalChunk = nextOriginalChunk;
  1862. }
  1863. cloned.lastChunk = clonedChunk;
  1864. if (this.indentExclusionRanges) {
  1865. cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
  1866. }
  1867. cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);
  1868. cloned.intro = this.intro;
  1869. cloned.outro = this.outro;
  1870. return cloned;
  1871. };
  1872. MagicString.prototype.generateDecodedMap = function generateDecodedMap (options) {
  1873. var this$1$1 = this;
  1874. options = options || {};
  1875. var sourceIndex = 0;
  1876. var names = Object.keys(this.storedNames);
  1877. var mappings = new Mappings(options.hires);
  1878. var locate = getLocator(this.original);
  1879. if (this.intro) {
  1880. mappings.advance(this.intro);
  1881. }
  1882. this.firstChunk.eachNext(function (chunk) {
  1883. var loc = locate(chunk.start);
  1884. if (chunk.intro.length) { mappings.advance(chunk.intro); }
  1885. if (chunk.edited) {
  1886. mappings.addEdit(
  1887. sourceIndex,
  1888. chunk.content,
  1889. loc,
  1890. chunk.storeName ? names.indexOf(chunk.original) : -1
  1891. );
  1892. } else {
  1893. mappings.addUneditedChunk(sourceIndex, chunk, this$1$1.original, loc, this$1$1.sourcemapLocations);
  1894. }
  1895. if (chunk.outro.length) { mappings.advance(chunk.outro); }
  1896. });
  1897. return {
  1898. file: options.file ? options.file.split(/[/\\]/).pop() : null,
  1899. sources: [options.source ? getRelativePath(options.file || '', options.source) : null],
  1900. sourcesContent: options.includeContent ? [this.original] : [null],
  1901. names: names,
  1902. mappings: mappings.raw,
  1903. };
  1904. };
  1905. MagicString.prototype.generateMap = function generateMap (options) {
  1906. return new SourceMap(this.generateDecodedMap(options));
  1907. };
  1908. MagicString.prototype.getIndentString = function getIndentString () {
  1909. return this.indentStr === null ? '\t' : this.indentStr;
  1910. };
  1911. MagicString.prototype.indent = function indent (indentStr, options) {
  1912. var pattern = /^[^\r\n]/gm;
  1913. if (isObject(indentStr)) {
  1914. options = indentStr;
  1915. indentStr = undefined;
  1916. }
  1917. indentStr = indentStr !== undefined ? indentStr : this.indentStr || '\t';
  1918. if (indentStr === '') { return this; } // noop
  1919. options = options || {};
  1920. // Process exclusion ranges
  1921. var isExcluded = {};
  1922. if (options.exclude) {
  1923. var exclusions =
  1924. typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude;
  1925. exclusions.forEach(function (exclusion) {
  1926. for (var i = exclusion[0]; i < exclusion[1]; i += 1) {
  1927. isExcluded[i] = true;
  1928. }
  1929. });
  1930. }
  1931. var shouldIndentNextCharacter = options.indentStart !== false;
  1932. var replacer = function (match) {
  1933. if (shouldIndentNextCharacter) { return ("" + indentStr + match); }
  1934. shouldIndentNextCharacter = true;
  1935. return match;
  1936. };
  1937. this.intro = this.intro.replace(pattern, replacer);
  1938. var charIndex = 0;
  1939. var chunk = this.firstChunk;
  1940. while (chunk) {
  1941. var end = chunk.end;
  1942. if (chunk.edited) {
  1943. if (!isExcluded[charIndex]) {
  1944. chunk.content = chunk.content.replace(pattern, replacer);
  1945. if (chunk.content.length) {
  1946. shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\n';
  1947. }
  1948. }
  1949. } else {
  1950. charIndex = chunk.start;
  1951. while (charIndex < end) {
  1952. if (!isExcluded[charIndex]) {
  1953. var char = this.original[charIndex];
  1954. if (char === '\n') {
  1955. shouldIndentNextCharacter = true;
  1956. } else if (char !== '\r' && shouldIndentNextCharacter) {
  1957. shouldIndentNextCharacter = false;
  1958. if (charIndex === chunk.start) {
  1959. chunk.prependRight(indentStr);
  1960. } else {
  1961. this._splitChunk(chunk, charIndex);
  1962. chunk = chunk.next;
  1963. chunk.prependRight(indentStr);
  1964. }
  1965. }
  1966. }
  1967. charIndex += 1;
  1968. }
  1969. }
  1970. charIndex = chunk.end;
  1971. chunk = chunk.next;
  1972. }
  1973. this.outro = this.outro.replace(pattern, replacer);
  1974. return this;
  1975. };
  1976. MagicString.prototype.insert = function insert () {
  1977. throw new Error(
  1978. 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)'
  1979. );
  1980. };
  1981. MagicString.prototype.insertLeft = function insertLeft (index, content) {
  1982. if (!warned.insertLeft) {
  1983. console.warn(
  1984. 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead'
  1985. ); // eslint-disable-line no-console
  1986. warned.insertLeft = true;
  1987. }
  1988. return this.appendLeft(index, content);
  1989. };
  1990. MagicString.prototype.insertRight = function insertRight (index, content) {
  1991. if (!warned.insertRight) {
  1992. console.warn(
  1993. 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead'
  1994. ); // eslint-disable-line no-console
  1995. warned.insertRight = true;
  1996. }
  1997. return this.prependRight(index, content);
  1998. };
  1999. MagicString.prototype.move = function move (start, end, index) {
  2000. if (index >= start && index <= end) { throw new Error('Cannot move a selection inside itself'); }
  2001. this._split(start);
  2002. this._split(end);
  2003. this._split(index);
  2004. var first = this.byStart[start];
  2005. var last = this.byEnd[end];
  2006. var oldLeft = first.previous;
  2007. var oldRight = last.next;
  2008. var newRight = this.byStart[index];
  2009. if (!newRight && last === this.lastChunk) { return this; }
  2010. var newLeft = newRight ? newRight.previous : this.lastChunk;
  2011. if (oldLeft) { oldLeft.next = oldRight; }
  2012. if (oldRight) { oldRight.previous = oldLeft; }
  2013. if (newLeft) { newLeft.next = first; }
  2014. if (newRight) { newRight.previous = last; }
  2015. if (!first.previous) { this.firstChunk = last.next; }
  2016. if (!last.next) {
  2017. this.lastChunk = first.previous;
  2018. this.lastChunk.next = null;
  2019. }
  2020. first.previous = newLeft;
  2021. last.next = newRight || null;
  2022. if (!newLeft) { this.firstChunk = first; }
  2023. if (!newRight) { this.lastChunk = last; }
  2024. return this;
  2025. };
  2026. MagicString.prototype.overwrite = function overwrite (start, end, content, options) {
  2027. if (typeof content !== 'string') { throw new TypeError('replacement content must be a string'); }
  2028. while (start < 0) { start += this.original.length; }
  2029. while (end < 0) { end += this.original.length; }
  2030. if (end > this.original.length) { throw new Error('end is out of bounds'); }
  2031. if (start === end)
  2032. { throw new Error(
  2033. 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead'
  2034. ); }
  2035. this._split(start);
  2036. this._split(end);
  2037. if (options === true) {
  2038. if (!warned.storeName) {
  2039. console.warn(
  2040. 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string'
  2041. ); // eslint-disable-line no-console
  2042. warned.storeName = true;
  2043. }
  2044. options = { storeName: true };
  2045. }
  2046. var storeName = options !== undefined ? options.storeName : false;
  2047. var contentOnly = options !== undefined ? options.contentOnly : false;
  2048. if (storeName) {
  2049. var original = this.original.slice(start, end);
  2050. Object.defineProperty(this.storedNames, original, { writable: true, value: true, enumerable: true });
  2051. }
  2052. var first = this.byStart[start];
  2053. var last = this.byEnd[end];
  2054. if (first) {
  2055. var chunk = first;
  2056. while (chunk !== last) {
  2057. if (chunk.next !== this.byStart[chunk.end]) {
  2058. throw new Error('Cannot overwrite across a split point');
  2059. }
  2060. chunk = chunk.next;
  2061. chunk.edit('', false);
  2062. }
  2063. first.edit(content, storeName, contentOnly);
  2064. } else {
  2065. // must be inserting at the end
  2066. var newChunk = new Chunk(start, end, '').edit(content, storeName);
  2067. // TODO last chunk in the array may not be the last chunk, if it's moved...
  2068. last.next = newChunk;
  2069. newChunk.previous = last;
  2070. }
  2071. return this;
  2072. };
  2073. MagicString.prototype.prepend = function prepend (content) {
  2074. if (typeof content !== 'string') { throw new TypeError('outro content must be a string'); }
  2075. this.intro = content + this.intro;
  2076. return this;
  2077. };
  2078. MagicString.prototype.prependLeft = function prependLeft (index, content) {
  2079. if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
  2080. this._split(index);
  2081. var chunk = this.byEnd[index];
  2082. if (chunk) {
  2083. chunk.prependLeft(content);
  2084. } else {
  2085. this.intro = content + this.intro;
  2086. }
  2087. return this;
  2088. };
  2089. MagicString.prototype.prependRight = function prependRight (index, content) {
  2090. if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
  2091. this._split(index);
  2092. var chunk = this.byStart[index];
  2093. if (chunk) {
  2094. chunk.prependRight(content);
  2095. } else {
  2096. this.outro = content + this.outro;
  2097. }
  2098. return this;
  2099. };
  2100. MagicString.prototype.remove = function remove (start, end) {
  2101. while (start < 0) { start += this.original.length; }
  2102. while (end < 0) { end += this.original.length; }
  2103. if (start === end) { return this; }
  2104. if (start < 0 || end > this.original.length) { throw new Error('Character is out of bounds'); }
  2105. if (start > end) { throw new Error('end must be greater than start'); }
  2106. this._split(start);
  2107. this._split(end);
  2108. var chunk = this.byStart[start];
  2109. while (chunk) {
  2110. chunk.intro = '';
  2111. chunk.outro = '';
  2112. chunk.edit('');
  2113. chunk = end > chunk.end ? this.byStart[chunk.end] : null;
  2114. }
  2115. return this;
  2116. };
  2117. MagicString.prototype.lastChar = function lastChar () {
  2118. if (this.outro.length) { return this.outro[this.outro.length - 1]; }
  2119. var chunk = this.lastChunk;
  2120. do {
  2121. if (chunk.outro.length) { return chunk.outro[chunk.outro.length - 1]; }
  2122. if (chunk.content.length) { return chunk.content[chunk.content.length - 1]; }
  2123. if (chunk.intro.length) { return chunk.intro[chunk.intro.length - 1]; }
  2124. } while ((chunk = chunk.previous));
  2125. if (this.intro.length) { return this.intro[this.intro.length - 1]; }
  2126. return '';
  2127. };
  2128. MagicString.prototype.lastLine = function lastLine () {
  2129. var lineIndex = this.outro.lastIndexOf(n);
  2130. if (lineIndex !== -1) { return this.outro.substr(lineIndex + 1); }
  2131. var lineStr = this.outro;
  2132. var chunk = this.lastChunk;
  2133. do {
  2134. if (chunk.outro.length > 0) {
  2135. lineIndex = chunk.outro.lastIndexOf(n);
  2136. if (lineIndex !== -1) { return chunk.outro.substr(lineIndex + 1) + lineStr; }
  2137. lineStr = chunk.outro + lineStr;
  2138. }
  2139. if (chunk.content.length > 0) {
  2140. lineIndex = chunk.content.lastIndexOf(n);
  2141. if (lineIndex !== -1) { return chunk.content.substr(lineIndex + 1) + lineStr; }
  2142. lineStr = chunk.content + lineStr;
  2143. }
  2144. if (chunk.intro.length > 0) {
  2145. lineIndex = chunk.intro.lastIndexOf(n);
  2146. if (lineIndex !== -1) { return chunk.intro.substr(lineIndex + 1) + lineStr; }
  2147. lineStr = chunk.intro + lineStr;
  2148. }
  2149. } while ((chunk = chunk.previous));
  2150. lineIndex = this.intro.lastIndexOf(n);
  2151. if (lineIndex !== -1) { return this.intro.substr(lineIndex + 1) + lineStr; }
  2152. return this.intro + lineStr;
  2153. };
  2154. MagicString.prototype.slice = function slice (start, end) {
  2155. if ( start === void 0 ) start = 0;
  2156. if ( end === void 0 ) end = this.original.length;
  2157. while (start < 0) { start += this.original.length; }
  2158. while (end < 0) { end += this.original.length; }
  2159. var result = '';
  2160. // find start chunk
  2161. var chunk = this.firstChunk;
  2162. while (chunk && (chunk.start > start || chunk.end <= start)) {
  2163. // found end chunk before start
  2164. if (chunk.start < end && chunk.end >= end) {
  2165. return result;
  2166. }
  2167. chunk = chunk.next;
  2168. }
  2169. if (chunk && chunk.edited && chunk.start !== start)
  2170. { throw new Error(("Cannot use replaced character " + start + " as slice start anchor.")); }
  2171. var startChunk = chunk;
  2172. while (chunk) {
  2173. if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
  2174. result += chunk.intro;
  2175. }
  2176. var containsEnd = chunk.start < end && chunk.end >= end;
  2177. if (containsEnd && chunk.edited && chunk.end !== end)
  2178. { throw new Error(("Cannot use replaced character " + end + " as slice end anchor.")); }
  2179. var sliceStart = startChunk === chunk ? start - chunk.start : 0;
  2180. var sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
  2181. result += chunk.content.slice(sliceStart, sliceEnd);
  2182. if (chunk.outro && (!containsEnd || chunk.end === end)) {
  2183. result += chunk.outro;
  2184. }
  2185. if (containsEnd) {
  2186. break;
  2187. }
  2188. chunk = chunk.next;
  2189. }
  2190. return result;
  2191. };
  2192. // TODO deprecate this? not really very useful
  2193. MagicString.prototype.snip = function snip (start, end) {
  2194. var clone = this.clone();
  2195. clone.remove(0, start);
  2196. clone.remove(end, clone.original.length);
  2197. return clone;
  2198. };
  2199. MagicString.prototype._split = function _split (index) {
  2200. if (this.byStart[index] || this.byEnd[index]) { return; }
  2201. var chunk = this.lastSearchedChunk;
  2202. var searchForward = index > chunk.end;
  2203. while (chunk) {
  2204. if (chunk.contains(index)) { return this._splitChunk(chunk, index); }
  2205. chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
  2206. }
  2207. };
  2208. MagicString.prototype._splitChunk = function _splitChunk (chunk, index) {
  2209. if (chunk.edited && chunk.content.length) {
  2210. // zero-length edited chunks are a special case (overlapping replacements)
  2211. var loc = getLocator(this.original)(index);
  2212. throw new Error(
  2213. ("Cannot split a chunk that has already been edited (" + (loc.line) + ":" + (loc.column) + " – \"" + (chunk.original) + "\")")
  2214. );
  2215. }
  2216. var newChunk = chunk.split(index);
  2217. this.byEnd[index] = chunk;
  2218. this.byStart[index] = newChunk;
  2219. this.byEnd[newChunk.end] = newChunk;
  2220. if (chunk === this.lastChunk) { this.lastChunk = newChunk; }
  2221. this.lastSearchedChunk = chunk;
  2222. return true;
  2223. };
  2224. MagicString.prototype.toString = function toString () {
  2225. var str = this.intro;
  2226. var chunk = this.firstChunk;
  2227. while (chunk) {
  2228. str += chunk.toString();
  2229. chunk = chunk.next;
  2230. }
  2231. return str + this.outro;
  2232. };
  2233. MagicString.prototype.isEmpty = function isEmpty () {
  2234. var chunk = this.firstChunk;
  2235. do {
  2236. if (
  2237. (chunk.intro.length && chunk.intro.trim()) ||
  2238. (chunk.content.length && chunk.content.trim()) ||
  2239. (chunk.outro.length && chunk.outro.trim())
  2240. )
  2241. { return false; }
  2242. } while ((chunk = chunk.next));
  2243. return true;
  2244. };
  2245. MagicString.prototype.length = function length () {
  2246. var chunk = this.firstChunk;
  2247. var length = 0;
  2248. do {
  2249. length += chunk.intro.length + chunk.content.length + chunk.outro.length;
  2250. } while ((chunk = chunk.next));
  2251. return length;
  2252. };
  2253. MagicString.prototype.trimLines = function trimLines () {
  2254. return this.trim('[\\r\\n]');
  2255. };
  2256. MagicString.prototype.trim = function trim (charType) {
  2257. return this.trimStart(charType).trimEnd(charType);
  2258. };
  2259. MagicString.prototype.trimEndAborted = function trimEndAborted (charType) {
  2260. var rx = new RegExp((charType || '\\s') + '+$');
  2261. this.outro = this.outro.replace(rx, '');
  2262. if (this.outro.length) { return true; }
  2263. var chunk = this.lastChunk;
  2264. do {
  2265. var end = chunk.end;
  2266. var aborted = chunk.trimEnd(rx);
  2267. // if chunk was trimmed, we have a new lastChunk
  2268. if (chunk.end !== end) {
  2269. if (this.lastChunk === chunk) {
  2270. this.lastChunk = chunk.next;
  2271. }
  2272. this.byEnd[chunk.end] = chunk;
  2273. this.byStart[chunk.next.start] = chunk.next;
  2274. this.byEnd[chunk.next.end] = chunk.next;
  2275. }
  2276. if (aborted) { return true; }
  2277. chunk = chunk.previous;
  2278. } while (chunk);
  2279. return false;
  2280. };
  2281. MagicString.prototype.trimEnd = function trimEnd (charType) {
  2282. this.trimEndAborted(charType);
  2283. return this;
  2284. };
  2285. MagicString.prototype.trimStartAborted = function trimStartAborted (charType) {
  2286. var rx = new RegExp('^' + (charType || '\\s') + '+');
  2287. this.intro = this.intro.replace(rx, '');
  2288. if (this.intro.length) { return true; }
  2289. var chunk = this.firstChunk;
  2290. do {
  2291. var end = chunk.end;
  2292. var aborted = chunk.trimStart(rx);
  2293. if (chunk.end !== end) {
  2294. // special case...
  2295. if (chunk === this.lastChunk) { this.lastChunk = chunk.next; }
  2296. this.byEnd[chunk.end] = chunk;
  2297. this.byStart[chunk.next.start] = chunk.next;
  2298. this.byEnd[chunk.next.end] = chunk.next;
  2299. }
  2300. if (aborted) { return true; }
  2301. chunk = chunk.next;
  2302. } while (chunk);
  2303. return false;
  2304. };
  2305. MagicString.prototype.trimStart = function trimStart (charType) {
  2306. this.trimStartAborted(charType);
  2307. return this;
  2308. };
  2309. // @ts-check
  2310. /** @typedef { import('estree').BaseNode} BaseNode */
  2311. /** @typedef {{
  2312. skip: () => void;
  2313. remove: () => void;
  2314. replace: (node: BaseNode) => void;
  2315. }} WalkerContext */
  2316. class WalkerBase {
  2317. constructor() {
  2318. /** @type {boolean} */
  2319. this.should_skip = false;
  2320. /** @type {boolean} */
  2321. this.should_remove = false;
  2322. /** @type {BaseNode | null} */
  2323. this.replacement = null;
  2324. /** @type {WalkerContext} */
  2325. this.context = {
  2326. skip: () => (this.should_skip = true),
  2327. remove: () => (this.should_remove = true),
  2328. replace: (node) => (this.replacement = node)
  2329. };
  2330. }
  2331. /**
  2332. *
  2333. * @param {any} parent
  2334. * @param {string} prop
  2335. * @param {number} index
  2336. * @param {BaseNode} node
  2337. */
  2338. replace(parent, prop, index, node) {
  2339. if (parent) {
  2340. if (index !== null) {
  2341. parent[prop][index] = node;
  2342. } else {
  2343. parent[prop] = node;
  2344. }
  2345. }
  2346. }
  2347. /**
  2348. *
  2349. * @param {any} parent
  2350. * @param {string} prop
  2351. * @param {number} index
  2352. */
  2353. remove(parent, prop, index) {
  2354. if (parent) {
  2355. if (index !== null) {
  2356. parent[prop].splice(index, 1);
  2357. } else {
  2358. delete parent[prop];
  2359. }
  2360. }
  2361. }
  2362. }
  2363. // @ts-check
  2364. /** @typedef { import('estree').BaseNode} BaseNode */
  2365. /** @typedef { import('./walker.js').WalkerContext} WalkerContext */
  2366. /** @typedef {(
  2367. * this: WalkerContext,
  2368. * node: BaseNode,
  2369. * parent: BaseNode,
  2370. * key: string,
  2371. * index: number
  2372. * ) => void} SyncHandler */
  2373. class SyncWalker extends WalkerBase {
  2374. /**
  2375. *
  2376. * @param {SyncHandler} enter
  2377. * @param {SyncHandler} leave
  2378. */
  2379. constructor(enter, leave) {
  2380. super();
  2381. /** @type {SyncHandler} */
  2382. this.enter = enter;
  2383. /** @type {SyncHandler} */
  2384. this.leave = leave;
  2385. }
  2386. /**
  2387. *
  2388. * @param {BaseNode} node
  2389. * @param {BaseNode} parent
  2390. * @param {string} [prop]
  2391. * @param {number} [index]
  2392. * @returns {BaseNode}
  2393. */
  2394. visit(node, parent, prop, index) {
  2395. if (node) {
  2396. if (this.enter) {
  2397. const _should_skip = this.should_skip;
  2398. const _should_remove = this.should_remove;
  2399. const _replacement = this.replacement;
  2400. this.should_skip = false;
  2401. this.should_remove = false;
  2402. this.replacement = null;
  2403. this.enter.call(this.context, node, parent, prop, index);
  2404. if (this.replacement) {
  2405. node = this.replacement;
  2406. this.replace(parent, prop, index, node);
  2407. }
  2408. if (this.should_remove) {
  2409. this.remove(parent, prop, index);
  2410. }
  2411. const skipped = this.should_skip;
  2412. const removed = this.should_remove;
  2413. this.should_skip = _should_skip;
  2414. this.should_remove = _should_remove;
  2415. this.replacement = _replacement;
  2416. if (skipped) return node;
  2417. if (removed) return null;
  2418. }
  2419. for (const key in node) {
  2420. const value = node[key];
  2421. if (typeof value !== "object") {
  2422. continue;
  2423. } else if (Array.isArray(value)) {
  2424. for (let i = 0; i < value.length; i += 1) {
  2425. if (value[i] !== null && typeof value[i].type === 'string') {
  2426. if (!this.visit(value[i], node, key, i)) {
  2427. // removed
  2428. i--;
  2429. }
  2430. }
  2431. }
  2432. } else if (value !== null && typeof value.type === "string") {
  2433. this.visit(value, node, key, null);
  2434. }
  2435. }
  2436. if (this.leave) {
  2437. const _replacement = this.replacement;
  2438. const _should_remove = this.should_remove;
  2439. this.replacement = null;
  2440. this.should_remove = false;
  2441. this.leave.call(this.context, node, parent, prop, index);
  2442. if (this.replacement) {
  2443. node = this.replacement;
  2444. this.replace(parent, prop, index, node);
  2445. }
  2446. if (this.should_remove) {
  2447. this.remove(parent, prop, index);
  2448. }
  2449. const removed = this.should_remove;
  2450. this.replacement = _replacement;
  2451. this.should_remove = _should_remove;
  2452. if (removed) return null;
  2453. }
  2454. }
  2455. return node;
  2456. }
  2457. }
  2458. // @ts-check
  2459. /** @typedef { import('estree').BaseNode} BaseNode */
  2460. /** @typedef { import('./sync.js').SyncHandler} SyncHandler */
  2461. /** @typedef { import('./async.js').AsyncHandler} AsyncHandler */
  2462. /**
  2463. *
  2464. * @param {BaseNode} ast
  2465. * @param {{
  2466. * enter?: SyncHandler
  2467. * leave?: SyncHandler
  2468. * }} walker
  2469. * @returns {BaseNode}
  2470. */
  2471. function walk$1(ast, { enter, leave }) {
  2472. const instance = new SyncWalker(enter, leave);
  2473. return instance.visit(ast, null);
  2474. }
  2475. // https://github.com/vuejs/core/blob/main/packages/compiler-core/src/babelUtils.ts
  2476. function walkIdentifiers(root, onIdentifier, onNode) {
  2477. const parentStack = [];
  2478. const knownIds = Object.create(null);
  2479. const rootExp = root.type === 'Program' &&
  2480. root.body[0].type === 'ExpressionStatement' &&
  2481. root.body[0].expression;
  2482. walk$1(root, {
  2483. enter(node, parent) {
  2484. parent && parentStack.push(parent);
  2485. if (parent &&
  2486. parent.type.startsWith('TS') &&
  2487. parent.type !== 'TSAsExpression' &&
  2488. parent.type !== 'TSNonNullExpression' &&
  2489. parent.type !== 'TSTypeAssertion') {
  2490. return this.skip();
  2491. }
  2492. if (onNode)
  2493. onNode(node);
  2494. if (node.type === 'Identifier') {
  2495. const isLocal = !!knownIds[node.name];
  2496. const isRefed = isReferencedIdentifier(node, parent, parentStack);
  2497. if ((isRefed && !isLocal)) {
  2498. onIdentifier(node, parent, parentStack, isRefed, isLocal);
  2499. }
  2500. }
  2501. else if (node.type === 'ObjectProperty' &&
  2502. parent.type === 'ObjectPattern') {
  2503. node.inPattern = true;
  2504. }
  2505. else if (isFunctionType(node)) {
  2506. // walk function expressions and add its arguments to known identifiers
  2507. // so that we don't prefix them
  2508. walkFunctionParams(node, id => markScopeIdentifier(node, id, knownIds));
  2509. }
  2510. else if (node.type === 'BlockStatement') {
  2511. // #3445 record block-level local variables
  2512. walkBlockDeclarations(node, id => markScopeIdentifier(node, id, knownIds));
  2513. }
  2514. },
  2515. leave(node, parent) {
  2516. parent && parentStack.pop();
  2517. if (node !== rootExp && node.scopeIds) {
  2518. for (const id of node.scopeIds) {
  2519. knownIds[id]--;
  2520. if (knownIds[id] === 0) {
  2521. delete knownIds[id];
  2522. }
  2523. }
  2524. }
  2525. }
  2526. });
  2527. }
  2528. function isReferencedIdentifier(id, parent, parentStack) {
  2529. if (!parent) {
  2530. return true;
  2531. }
  2532. // is a special keyword but parsed as identifier
  2533. if (id.name === 'arguments') {
  2534. return false;
  2535. }
  2536. if (isReferenced(id, parent)) {
  2537. return true;
  2538. }
  2539. // babel's isReferenced check returns false for ids being assigned to, so we
  2540. // need to cover those cases here
  2541. switch (parent.type) {
  2542. case 'AssignmentExpression':
  2543. case 'AssignmentPattern':
  2544. return true;
  2545. case 'ObjectPattern':
  2546. case 'ArrayPattern':
  2547. return isInDestructureAssignment(parent, parentStack);
  2548. }
  2549. return false;
  2550. }
  2551. function isInDestructureAssignment(parent, parentStack) {
  2552. if (parent &&
  2553. (parent.type === 'ObjectProperty' || parent.type === 'ArrayPattern')) {
  2554. let i = parentStack.length;
  2555. while (i--) {
  2556. const p = parentStack[i];
  2557. if (p.type === 'AssignmentExpression') {
  2558. return true;
  2559. }
  2560. else if (p.type !== 'ObjectProperty' && !p.type.endsWith('Pattern')) {
  2561. break;
  2562. }
  2563. }
  2564. }
  2565. return false;
  2566. }
  2567. function walkFunctionParams(node, onIdent) {
  2568. for (const p of node.params) {
  2569. for (const id of extractIdentifiers(p)) {
  2570. onIdent(id);
  2571. }
  2572. }
  2573. }
  2574. function walkBlockDeclarations(block, onIdent) {
  2575. for (const stmt of block.body) {
  2576. if (stmt.type === 'VariableDeclaration') {
  2577. if (stmt.declare)
  2578. continue;
  2579. for (const decl of stmt.declarations) {
  2580. for (const id of extractIdentifiers(decl.id)) {
  2581. onIdent(id);
  2582. }
  2583. }
  2584. }
  2585. else if (stmt.type === 'FunctionDeclaration' ||
  2586. stmt.type === 'ClassDeclaration') {
  2587. if (stmt.declare || !stmt.id)
  2588. continue;
  2589. onIdent(stmt.id);
  2590. }
  2591. }
  2592. }
  2593. function extractIdentifiers(param, nodes = []) {
  2594. switch (param.type) {
  2595. case 'Identifier':
  2596. nodes.push(param);
  2597. break;
  2598. case 'MemberExpression':
  2599. let object = param;
  2600. while (object.type === 'MemberExpression') {
  2601. object = object.object;
  2602. }
  2603. nodes.push(object);
  2604. break;
  2605. case 'ObjectPattern':
  2606. for (const prop of param.properties) {
  2607. if (prop.type === 'RestElement') {
  2608. extractIdentifiers(prop.argument, nodes);
  2609. }
  2610. else {
  2611. extractIdentifiers(prop.value, nodes);
  2612. }
  2613. }
  2614. break;
  2615. case 'ArrayPattern':
  2616. param.elements.forEach(element => {
  2617. if (element)
  2618. extractIdentifiers(element, nodes);
  2619. });
  2620. break;
  2621. case 'RestElement':
  2622. extractIdentifiers(param.argument, nodes);
  2623. break;
  2624. case 'AssignmentPattern':
  2625. extractIdentifiers(param.left, nodes);
  2626. break;
  2627. }
  2628. return nodes;
  2629. }
  2630. function markScopeIdentifier(node, child, knownIds) {
  2631. const { name } = child;
  2632. if (node.scopeIds && node.scopeIds.has(name)) {
  2633. return;
  2634. }
  2635. if (name in knownIds) {
  2636. knownIds[name]++;
  2637. }
  2638. else {
  2639. knownIds[name] = 1;
  2640. }
  2641. (node.scopeIds || (node.scopeIds = new Set())).add(name);
  2642. }
  2643. const isFunctionType = (node) => {
  2644. return /Function(?:Expression|Declaration)$|Method$/.test(node.type);
  2645. };
  2646. const isStaticProperty = (node) => node &&
  2647. (node.type === 'ObjectProperty' || node.type === 'ObjectMethod') &&
  2648. !node.computed;
  2649. /**
  2650. * Copied from https://github.com/babel/babel/blob/main/packages/babel-types/src/validators/isReferenced.ts
  2651. * To avoid runtime dependency on @babel/types (which includes process references)
  2652. * This file should not change very often in babel but we may need to keep it
  2653. * up-to-date from time to time.
  2654. *
  2655. * https://github.com/babel/babel/blob/main/LICENSE
  2656. *
  2657. */
  2658. function isReferenced(node, parent, grandparent) {
  2659. switch (parent.type) {
  2660. // yes: PARENT[NODE]
  2661. // yes: NODE.child
  2662. // no: parent.NODE
  2663. case 'MemberExpression':
  2664. case 'OptionalMemberExpression':
  2665. if (parent.property === node) {
  2666. return !!parent.computed;
  2667. }
  2668. return parent.object === node;
  2669. case 'JSXMemberExpression':
  2670. return parent.object === node;
  2671. // no: let NODE = init;
  2672. // yes: let id = NODE;
  2673. case 'VariableDeclarator':
  2674. return parent.init === node;
  2675. // yes: () => NODE
  2676. // no: (NODE) => {}
  2677. case 'ArrowFunctionExpression':
  2678. return parent.body === node;
  2679. // no: class { #NODE; }
  2680. // no: class { get #NODE() {} }
  2681. // no: class { #NODE() {} }
  2682. // no: class { fn() { return this.#NODE; } }
  2683. case 'PrivateName':
  2684. return false;
  2685. // no: class { NODE() {} }
  2686. // yes: class { [NODE]() {} }
  2687. // no: class { foo(NODE) {} }
  2688. case 'ClassMethod':
  2689. case 'ClassPrivateMethod':
  2690. case 'ObjectMethod':
  2691. if (parent.key === node) {
  2692. return !!parent.computed;
  2693. }
  2694. return false;
  2695. // yes: { [NODE]: "" }
  2696. // no: { NODE: "" }
  2697. // depends: { NODE }
  2698. // depends: { key: NODE }
  2699. case 'ObjectProperty':
  2700. if (parent.key === node) {
  2701. return !!parent.computed;
  2702. }
  2703. // parent.value === node
  2704. return !grandparent || grandparent.type !== 'ObjectPattern';
  2705. // no: class { NODE = value; }
  2706. // yes: class { [NODE] = value; }
  2707. // yes: class { key = NODE; }
  2708. case 'ClassProperty':
  2709. if (parent.key === node) {
  2710. return !!parent.computed;
  2711. }
  2712. return true;
  2713. case 'ClassPrivateProperty':
  2714. return parent.key !== node;
  2715. // no: class NODE {}
  2716. // yes: class Foo extends NODE {}
  2717. case 'ClassDeclaration':
  2718. case 'ClassExpression':
  2719. return parent.superClass === node;
  2720. // yes: left = NODE;
  2721. // no: NODE = right;
  2722. case 'AssignmentExpression':
  2723. return parent.right === node;
  2724. // no: [NODE = foo] = [];
  2725. // yes: [foo = NODE] = [];
  2726. case 'AssignmentPattern':
  2727. return parent.right === node;
  2728. // no: NODE: for (;;) {}
  2729. case 'LabeledStatement':
  2730. return false;
  2731. // no: try {} catch (NODE) {}
  2732. case 'CatchClause':
  2733. return false;
  2734. // no: function foo(...NODE) {}
  2735. case 'RestElement':
  2736. return false;
  2737. case 'BreakStatement':
  2738. case 'ContinueStatement':
  2739. return false;
  2740. // no: function NODE() {}
  2741. // no: function foo(NODE) {}
  2742. case 'FunctionDeclaration':
  2743. case 'FunctionExpression':
  2744. return false;
  2745. // no: export NODE from "foo";
  2746. // no: export * as NODE from "foo";
  2747. case 'ExportNamespaceSpecifier':
  2748. case 'ExportDefaultSpecifier':
  2749. return false;
  2750. // no: export { foo as NODE };
  2751. // yes: export { NODE as foo };
  2752. // no: export { NODE as foo } from "foo";
  2753. case 'ExportSpecifier':
  2754. // @ts-expect-error
  2755. if (grandparent === null || grandparent === void 0 ? void 0 : grandparent.source) {
  2756. return false;
  2757. }
  2758. return parent.local === node;
  2759. // no: import NODE from "foo";
  2760. // no: import * as NODE from "foo";
  2761. // no: import { NODE as foo } from "foo";
  2762. // no: import { foo as NODE } from "foo";
  2763. // no: import NODE from "bar";
  2764. case 'ImportDefaultSpecifier':
  2765. case 'ImportNamespaceSpecifier':
  2766. case 'ImportSpecifier':
  2767. return false;
  2768. // no: import "foo" assert { NODE: "json" }
  2769. case 'ImportAttribute':
  2770. return false;
  2771. // no: <div NODE="foo" />
  2772. case 'JSXAttribute':
  2773. return false;
  2774. // no: [NODE] = [];
  2775. // no: ({ NODE }) = [];
  2776. case 'ObjectPattern':
  2777. case 'ArrayPattern':
  2778. return false;
  2779. // no: new.NODE
  2780. // no: NODE.target
  2781. case 'MetaProperty':
  2782. return false;
  2783. // yes: type X = { someProperty: NODE }
  2784. // no: type X = { NODE: OtherType }
  2785. case 'ObjectTypeProperty':
  2786. return parent.key !== node;
  2787. // yes: enum X { Foo = NODE }
  2788. // no: enum X { NODE }
  2789. case 'TSEnumMember':
  2790. return parent.id !== node;
  2791. // yes: { [NODE]: value }
  2792. // no: { NODE: value }
  2793. case 'TSPropertySignature':
  2794. if (parent.key === node) {
  2795. return !!parent.computed;
  2796. }
  2797. return true;
  2798. }
  2799. return true;
  2800. }
  2801. const range = 2;
  2802. function generateCodeFrame(source, start = 0, end = source.length) {
  2803. const lines = source.split(/\r?\n/);
  2804. let count = 0;
  2805. const res = [];
  2806. for (let i = 0; i < lines.length; i++) {
  2807. count += lines[i].length + 1;
  2808. if (count >= start) {
  2809. for (let j = i - range; j <= i + range || end > count; j++) {
  2810. if (j < 0 || j >= lines.length)
  2811. continue;
  2812. res.push(`${j + 1}${repeat(` `, 3 - String(j + 1).length)}| ${lines[j]}`);
  2813. const lineLength = lines[j].length;
  2814. if (j === i) {
  2815. // push underline
  2816. const pad = start - (count - lineLength) + 1;
  2817. const length = end > count ? lineLength - pad : end - start;
  2818. res.push(` | ` + repeat(` `, pad) + repeat(`^`, length));
  2819. }
  2820. else if (j > i) {
  2821. if (end > count) {
  2822. const length = Math.min(end - count, lineLength);
  2823. res.push(` | ` + repeat(`^`, length));
  2824. }
  2825. count += lineLength + 1;
  2826. }
  2827. }
  2828. break;
  2829. }
  2830. }
  2831. return res.join('\n');
  2832. }
  2833. function repeat(str, n) {
  2834. let result = '';
  2835. if (n > 0) {
  2836. // eslint-disable-next-line no-constant-condition
  2837. while (true) {
  2838. // eslint-disable-line
  2839. if (n & 1)
  2840. result += str;
  2841. n >>>= 1;
  2842. if (n <= 0)
  2843. break;
  2844. str += str;
  2845. }
  2846. }
  2847. return result;
  2848. }
  2849. // can we use __proto__?
  2850. const hasProto = '__proto__' in {};
  2851. // Browser environment sniffing
  2852. const inBrowser = typeof window !== 'undefined';
  2853. const UA = inBrowser && window.navigator.userAgent.toLowerCase();
  2854. const isIE = UA && /msie|trident/.test(UA);
  2855. UA && UA.indexOf('msie 9.0') > 0;
  2856. const isEdge = UA && UA.indexOf('edge/') > 0;
  2857. UA && UA.indexOf('android') > 0;
  2858. UA && /iphone|ipad|ipod|ios/.test(UA);
  2859. UA && /chrome\/\d+/.test(UA) && !isEdge;
  2860. UA && /phantomjs/.test(UA);
  2861. UA && UA.match(/firefox\/(\d+)/);
  2862. // Firefox has a "watch" function on Object.prototype...
  2863. // @ts-expect-error firebox support
  2864. const nativeWatch = {}.watch;
  2865. let supportsPassive = false;
  2866. if (inBrowser) {
  2867. try {
  2868. const opts = {};
  2869. Object.defineProperty(opts, 'passive', {
  2870. get() {
  2871. /* istanbul ignore next */
  2872. supportsPassive = true;
  2873. }
  2874. }); // https://github.com/facebook/flow/issues/285
  2875. window.addEventListener('test-passive', null, opts);
  2876. }
  2877. catch (e) { }
  2878. }
  2879. // this needs to be lazy-evaled because vue may be required before
  2880. // vue-server-renderer can set VUE_ENV
  2881. let _isServer;
  2882. const isServerRendering = () => {
  2883. if (_isServer === undefined) {
  2884. /* istanbul ignore if */
  2885. if (!inBrowser && typeof global !== 'undefined') {
  2886. // detect presence of vue-server-renderer and avoid
  2887. // Webpack shimming the process
  2888. _isServer =
  2889. global['process'] && global['process'].env.VUE_ENV === 'server';
  2890. }
  2891. else {
  2892. _isServer = false;
  2893. }
  2894. }
  2895. return _isServer;
  2896. };
  2897. /* istanbul ignore next */
  2898. function isNative(Ctor) {
  2899. return typeof Ctor === 'function' && /native code/.test(Ctor.toString());
  2900. }
  2901. const hasSymbol = typeof Symbol !== 'undefined' &&
  2902. isNative(Symbol) &&
  2903. typeof Reflect !== 'undefined' &&
  2904. isNative(Reflect.ownKeys);
  2905. let _Set; // $flow-disable-line
  2906. /* istanbul ignore if */ if (typeof Set !== 'undefined' && isNative(Set)) {
  2907. // use native Set when available.
  2908. _Set = Set;
  2909. }
  2910. else {
  2911. // a non-standard Set polyfill that only works with primitive keys.
  2912. _Set = class Set {
  2913. constructor() {
  2914. this.set = Object.create(null);
  2915. }
  2916. has(key) {
  2917. return this.set[key] === true;
  2918. }
  2919. add(key) {
  2920. this.set[key] = true;
  2921. }
  2922. clear() {
  2923. this.set = Object.create(null);
  2924. }
  2925. };
  2926. }
  2927. const ASSET_TYPES = ['component', 'directive', 'filter'];
  2928. const LIFECYCLE_HOOKS = [
  2929. 'beforeCreate',
  2930. 'created',
  2931. 'beforeMount',
  2932. 'mounted',
  2933. 'beforeUpdate',
  2934. 'updated',
  2935. 'beforeDestroy',
  2936. 'destroyed',
  2937. 'activated',
  2938. 'deactivated',
  2939. 'errorCaptured',
  2940. 'serverPrefetch',
  2941. 'renderTracked',
  2942. 'renderTriggered'
  2943. ];
  2944. var config = {
  2945. /**
  2946. * Option merge strategies (used in core/util/options)
  2947. */
  2948. // $flow-disable-line
  2949. optionMergeStrategies: Object.create(null),
  2950. /**
  2951. * Whether to suppress warnings.
  2952. */
  2953. silent: false,
  2954. /**
  2955. * Show production mode tip message on boot?
  2956. */
  2957. productionTip: process.env.NODE_ENV !== 'production',
  2958. /**
  2959. * Whether to enable devtools
  2960. */
  2961. devtools: process.env.NODE_ENV !== 'production',
  2962. /**
  2963. * Whether to record perf
  2964. */
  2965. performance: false,
  2966. /**
  2967. * Error handler for watcher errors
  2968. */
  2969. errorHandler: null,
  2970. /**
  2971. * Warn handler for watcher warns
  2972. */
  2973. warnHandler: null,
  2974. /**
  2975. * Ignore certain custom elements
  2976. */
  2977. ignoredElements: [],
  2978. /**
  2979. * Custom user key aliases for v-on
  2980. */
  2981. // $flow-disable-line
  2982. keyCodes: Object.create(null),
  2983. /**
  2984. * Check if a tag is reserved so that it cannot be registered as a
  2985. * component. This is platform-dependent and may be overwritten.
  2986. */
  2987. isReservedTag: no,
  2988. /**
  2989. * Check if an attribute is reserved so that it cannot be used as a component
  2990. * prop. This is platform-dependent and may be overwritten.
  2991. */
  2992. isReservedAttr: no,
  2993. /**
  2994. * Check if a tag is an unknown element.
  2995. * Platform-dependent.
  2996. */
  2997. isUnknownElement: no,
  2998. /**
  2999. * Get the namespace of an element
  3000. */
  3001. getTagNamespace: noop,
  3002. /**
  3003. * Parse the real tag name for the specific platform.
  3004. */
  3005. parsePlatformTagName: identity,
  3006. /**
  3007. * Check if an attribute must be bound using property, e.g. value
  3008. * Platform-dependent.
  3009. */
  3010. mustUseProp: no,
  3011. /**
  3012. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  3013. * This will significantly reduce performance if set to false.
  3014. */
  3015. async: true,
  3016. /**
  3017. * Exposed for legacy reasons
  3018. */
  3019. _lifecycleHooks: LIFECYCLE_HOOKS
  3020. };
  3021. let currentInstance = null;
  3022. /**
  3023. * @internal
  3024. */
  3025. function setCurrentInstance(vm = null) {
  3026. if (!vm)
  3027. currentInstance && currentInstance._scope.off();
  3028. currentInstance = vm;
  3029. vm && vm._scope.on();
  3030. }
  3031. /**
  3032. * @internal
  3033. */
  3034. class VNode {
  3035. constructor(tag, data, children, text, elm, context, componentOptions, asyncFactory) {
  3036. this.tag = tag;
  3037. this.data = data;
  3038. this.children = children;
  3039. this.text = text;
  3040. this.elm = elm;
  3041. this.ns = undefined;
  3042. this.context = context;
  3043. this.fnContext = undefined;
  3044. this.fnOptions = undefined;
  3045. this.fnScopeId = undefined;
  3046. this.key = data && data.key;
  3047. this.componentOptions = componentOptions;
  3048. this.componentInstance = undefined;
  3049. this.parent = undefined;
  3050. this.raw = false;
  3051. this.isStatic = false;
  3052. this.isRootInsert = true;
  3053. this.isComment = false;
  3054. this.isCloned = false;
  3055. this.isOnce = false;
  3056. this.asyncFactory = asyncFactory;
  3057. this.asyncMeta = undefined;
  3058. this.isAsyncPlaceholder = false;
  3059. }
  3060. // DEPRECATED: alias for componentInstance for backwards compat.
  3061. /* istanbul ignore next */
  3062. get child() {
  3063. return this.componentInstance;
  3064. }
  3065. }
  3066. const createEmptyVNode = (text = '') => {
  3067. const node = new VNode();
  3068. node.text = text;
  3069. node.isComment = true;
  3070. return node;
  3071. };
  3072. function createTextVNode(val) {
  3073. return new VNode(undefined, undefined, undefined, String(val));
  3074. }
  3075. // optimized shallow clone
  3076. // used for static nodes and slot nodes because they may be reused across
  3077. // multiple renders, cloning them avoids errors when DOM manipulations rely
  3078. // on their elm reference.
  3079. function cloneVNode(vnode) {
  3080. const cloned = new VNode(vnode.tag, vnode.data,
  3081. // #7975
  3082. // clone children array to avoid mutating original in case of cloning
  3083. // a child.
  3084. vnode.children && vnode.children.slice(), vnode.text, vnode.elm, vnode.context, vnode.componentOptions, vnode.asyncFactory);
  3085. cloned.ns = vnode.ns;
  3086. cloned.isStatic = vnode.isStatic;
  3087. cloned.key = vnode.key;
  3088. cloned.isComment = vnode.isComment;
  3089. cloned.fnContext = vnode.fnContext;
  3090. cloned.fnOptions = vnode.fnOptions;
  3091. cloned.fnScopeId = vnode.fnScopeId;
  3092. cloned.asyncMeta = vnode.asyncMeta;
  3093. cloned.isCloned = true;
  3094. return cloned;
  3095. }
  3096. /* not type checking this file because flow doesn't play well with Proxy */
  3097. if (process.env.NODE_ENV !== 'production') {
  3098. makeMap('Infinity,undefined,NaN,isFinite,isNaN,' +
  3099. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  3100. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
  3101. 'require' // for Webpack/Browserify
  3102. );
  3103. const hasProxy = typeof Proxy !== 'undefined' && isNative(Proxy);
  3104. if (hasProxy) {
  3105. const isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  3106. config.keyCodes = new Proxy(config.keyCodes, {
  3107. set(target, key, value) {
  3108. if (isBuiltInModifier(key)) {
  3109. warn$3(`Avoid overwriting built-in modifier in config.keyCodes: .${key}`);
  3110. return false;
  3111. }
  3112. else {
  3113. target[key] = value;
  3114. return true;
  3115. }
  3116. }
  3117. });
  3118. }
  3119. }
  3120. let uid = 0;
  3121. /**
  3122. * A dep is an observable that can have multiple
  3123. * directives subscribing to it.
  3124. * @internal
  3125. */
  3126. class Dep {
  3127. constructor() {
  3128. // pending subs cleanup
  3129. this._pending = false;
  3130. this.id = uid++;
  3131. this.subs = [];
  3132. }
  3133. addSub(sub) {
  3134. this.subs.push(sub);
  3135. }
  3136. removeSub(sub) {
  3137. // #12696 deps with massive amount of subscribers are extremely slow to
  3138. // clean up in Chromium
  3139. // to workaround this, we unset the sub for now, and clear them on
  3140. // next scheduler flush.
  3141. this.subs[this.subs.indexOf(sub)] = null;
  3142. if (!this._pending) {
  3143. this._pending = true;
  3144. }
  3145. }
  3146. depend(info) {
  3147. if (Dep.target) {
  3148. Dep.target.addDep(this);
  3149. if (process.env.NODE_ENV !== 'production' && info && Dep.target.onTrack) {
  3150. Dep.target.onTrack(Object.assign({ effect: Dep.target }, info));
  3151. }
  3152. }
  3153. }
  3154. notify(info) {
  3155. // stabilize the subscriber list first
  3156. const subs = this.subs.filter(s => s);
  3157. if (process.env.NODE_ENV !== 'production' && !config.async) {
  3158. // subs aren't sorted in scheduler if not running async
  3159. // we need to sort them now to make sure they fire in correct
  3160. // order
  3161. subs.sort((a, b) => a.id - b.id);
  3162. }
  3163. for (let i = 0, l = subs.length; i < l; i++) {
  3164. const sub = subs[i];
  3165. if (process.env.NODE_ENV !== 'production' && info) {
  3166. sub.onTrigger &&
  3167. sub.onTrigger(Object.assign({ effect: subs[i] }, info));
  3168. }
  3169. sub.update();
  3170. }
  3171. }
  3172. }
  3173. // The current target watcher being evaluated.
  3174. // This is globally unique because only one watcher
  3175. // can be evaluated at a time.
  3176. Dep.target = null;
  3177. const targetStack = [];
  3178. function pushTarget(target) {
  3179. targetStack.push(target);
  3180. Dep.target = target;
  3181. }
  3182. function popTarget() {
  3183. targetStack.pop();
  3184. Dep.target = targetStack[targetStack.length - 1];
  3185. }
  3186. /*
  3187. * not type checking this file because flow doesn't play well with
  3188. * dynamically accessing methods on Array prototype
  3189. */
  3190. const arrayProto = Array.prototype;
  3191. const arrayMethods = Object.create(arrayProto);
  3192. const methodsToPatch = [
  3193. 'push',
  3194. 'pop',
  3195. 'shift',
  3196. 'unshift',
  3197. 'splice',
  3198. 'sort',
  3199. 'reverse'
  3200. ];
  3201. /**
  3202. * Intercept mutating methods and emit events
  3203. */
  3204. methodsToPatch.forEach(function (method) {
  3205. // cache original method
  3206. const original = arrayProto[method];
  3207. def(arrayMethods, method, function mutator(...args) {
  3208. const result = original.apply(this, args);
  3209. const ob = this.__ob__;
  3210. let inserted;
  3211. switch (method) {
  3212. case 'push':
  3213. case 'unshift':
  3214. inserted = args;
  3215. break;
  3216. case 'splice':
  3217. inserted = args.slice(2);
  3218. break;
  3219. }
  3220. if (inserted)
  3221. ob.observeArray(inserted);
  3222. // notify change
  3223. if (process.env.NODE_ENV !== 'production') {
  3224. ob.dep.notify({
  3225. type: "array mutation" /* TriggerOpTypes.ARRAY_MUTATION */,
  3226. target: this,
  3227. key: method
  3228. });
  3229. }
  3230. else {
  3231. ob.dep.notify();
  3232. }
  3233. return result;
  3234. });
  3235. });
  3236. const arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  3237. const NO_INIITIAL_VALUE = {};
  3238. /**
  3239. * In some cases we may want to disable observation inside a component's
  3240. * update computation.
  3241. */
  3242. let shouldObserve = true;
  3243. function toggleObserving(value) {
  3244. shouldObserve = value;
  3245. }
  3246. // ssr mock dep
  3247. const mockDep = {
  3248. notify: noop,
  3249. depend: noop,
  3250. addSub: noop,
  3251. removeSub: noop
  3252. };
  3253. /**
  3254. * Observer class that is attached to each observed
  3255. * object. Once attached, the observer converts the target
  3256. * object's property keys into getter/setters that
  3257. * collect dependencies and dispatch updates.
  3258. */
  3259. class Observer {
  3260. constructor(value, shallow = false, mock = false) {
  3261. this.value = value;
  3262. this.shallow = shallow;
  3263. this.mock = mock;
  3264. // this.value = value
  3265. this.dep = mock ? mockDep : new Dep();
  3266. this.vmCount = 0;
  3267. def(value, '__ob__', this);
  3268. if (isArray(value)) {
  3269. if (!mock) {
  3270. if (hasProto) {
  3271. value.__proto__ = arrayMethods;
  3272. /* eslint-enable no-proto */
  3273. }
  3274. else {
  3275. for (let i = 0, l = arrayKeys.length; i < l; i++) {
  3276. const key = arrayKeys[i];
  3277. def(value, key, arrayMethods[key]);
  3278. }
  3279. }
  3280. }
  3281. if (!shallow) {
  3282. this.observeArray(value);
  3283. }
  3284. }
  3285. else {
  3286. /**
  3287. * Walk through all properties and convert them into
  3288. * getter/setters. This method should only be called when
  3289. * value type is Object.
  3290. */
  3291. const keys = Object.keys(value);
  3292. for (let i = 0; i < keys.length; i++) {
  3293. const key = keys[i];
  3294. defineReactive(value, key, NO_INIITIAL_VALUE, undefined, shallow, mock);
  3295. }
  3296. }
  3297. }
  3298. /**
  3299. * Observe a list of Array items.
  3300. */
  3301. observeArray(value) {
  3302. for (let i = 0, l = value.length; i < l; i++) {
  3303. observe(value[i], false, this.mock);
  3304. }
  3305. }
  3306. }
  3307. // helpers
  3308. /**
  3309. * Attempt to create an observer instance for a value,
  3310. * returns the new observer if successfully observed,
  3311. * or the existing observer if the value already has one.
  3312. */
  3313. function observe(value, shallow, ssrMockReactivity) {
  3314. if (value && hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  3315. return value.__ob__;
  3316. }
  3317. if (shouldObserve &&
  3318. (ssrMockReactivity || !isServerRendering()) &&
  3319. (isArray(value) || isPlainObject(value)) &&
  3320. Object.isExtensible(value) &&
  3321. !value.__v_skip /* ReactiveFlags.SKIP */ &&
  3322. !isRef(value) &&
  3323. !(value instanceof VNode)) {
  3324. return new Observer(value, shallow, ssrMockReactivity);
  3325. }
  3326. }
  3327. /**
  3328. * Define a reactive property on an Object.
  3329. */
  3330. function defineReactive(obj, key, val, customSetter, shallow, mock) {
  3331. const dep = new Dep();
  3332. const property = Object.getOwnPropertyDescriptor(obj, key);
  3333. if (property && property.configurable === false) {
  3334. return;
  3335. }
  3336. // cater for pre-defined getter/setters
  3337. const getter = property && property.get;
  3338. const setter = property && property.set;
  3339. if ((!getter || setter) &&
  3340. (val === NO_INIITIAL_VALUE || arguments.length === 2)) {
  3341. val = obj[key];
  3342. }
  3343. let childOb = !shallow && observe(val, false, mock);
  3344. Object.defineProperty(obj, key, {
  3345. enumerable: true,
  3346. configurable: true,
  3347. get: function reactiveGetter() {
  3348. const value = getter ? getter.call(obj) : val;
  3349. if (Dep.target) {
  3350. if (process.env.NODE_ENV !== 'production') {
  3351. dep.depend({
  3352. target: obj,
  3353. type: "get" /* TrackOpTypes.GET */,
  3354. key
  3355. });
  3356. }
  3357. else {
  3358. dep.depend();
  3359. }
  3360. if (childOb) {
  3361. childOb.dep.depend();
  3362. if (isArray(value)) {
  3363. dependArray(value);
  3364. }
  3365. }
  3366. }
  3367. return isRef(value) && !shallow ? value.value : value;
  3368. },
  3369. set: function reactiveSetter(newVal) {
  3370. const value = getter ? getter.call(obj) : val;
  3371. if (!hasChanged(value, newVal)) {
  3372. return;
  3373. }
  3374. if (process.env.NODE_ENV !== 'production' && customSetter) {
  3375. customSetter();
  3376. }
  3377. if (setter) {
  3378. setter.call(obj, newVal);
  3379. }
  3380. else if (getter) {
  3381. // #7981: for accessor properties without setter
  3382. return;
  3383. }
  3384. else if (!shallow && isRef(value) && !isRef(newVal)) {
  3385. value.value = newVal;
  3386. return;
  3387. }
  3388. else {
  3389. val = newVal;
  3390. }
  3391. childOb = !shallow && observe(newVal, false, mock);
  3392. if (process.env.NODE_ENV !== 'production') {
  3393. dep.notify({
  3394. type: "set" /* TriggerOpTypes.SET */,
  3395. target: obj,
  3396. key,
  3397. newValue: newVal,
  3398. oldValue: value
  3399. });
  3400. }
  3401. else {
  3402. dep.notify();
  3403. }
  3404. }
  3405. });
  3406. return dep;
  3407. }
  3408. function set(target, key, val) {
  3409. if (process.env.NODE_ENV !== 'production' && (isUndef(target) || isPrimitive(target))) {
  3410. warn$3(`Cannot set reactive property on undefined, null, or primitive value: ${target}`);
  3411. }
  3412. if (isReadonly(target)) {
  3413. process.env.NODE_ENV !== 'production' && warn$3(`Set operation on key "${key}" failed: target is readonly.`);
  3414. return;
  3415. }
  3416. const ob = target.__ob__;
  3417. if (isArray(target) && isValidArrayIndex(key)) {
  3418. target.length = Math.max(target.length, key);
  3419. target.splice(key, 1, val);
  3420. // when mocking for SSR, array methods are not hijacked
  3421. if (ob && !ob.shallow && ob.mock) {
  3422. observe(val, false, true);
  3423. }
  3424. return val;
  3425. }
  3426. if (key in target && !(key in Object.prototype)) {
  3427. target[key] = val;
  3428. return val;
  3429. }
  3430. if (target._isVue || (ob && ob.vmCount)) {
  3431. process.env.NODE_ENV !== 'production' &&
  3432. warn$3('Avoid adding reactive properties to a Vue instance or its root $data ' +
  3433. 'at runtime - declare it upfront in the data option.');
  3434. return val;
  3435. }
  3436. if (!ob) {
  3437. target[key] = val;
  3438. return val;
  3439. }
  3440. defineReactive(ob.value, key, val, undefined, ob.shallow, ob.mock);
  3441. if (process.env.NODE_ENV !== 'production') {
  3442. ob.dep.notify({
  3443. type: "add" /* TriggerOpTypes.ADD */,
  3444. target: target,
  3445. key,
  3446. newValue: val,
  3447. oldValue: undefined
  3448. });
  3449. }
  3450. else {
  3451. ob.dep.notify();
  3452. }
  3453. return val;
  3454. }
  3455. /**
  3456. * Collect dependencies on array elements when the array is touched, since
  3457. * we cannot intercept array element access like property getters.
  3458. */
  3459. function dependArray(value) {
  3460. for (let e, i = 0, l = value.length; i < l; i++) {
  3461. e = value[i];
  3462. if (e && e.__ob__) {
  3463. e.__ob__.dep.depend();
  3464. }
  3465. if (isArray(e)) {
  3466. dependArray(e);
  3467. }
  3468. }
  3469. }
  3470. function isReadonly(value) {
  3471. return !!(value && value.__v_isReadonly);
  3472. }
  3473. function isRef(r) {
  3474. return !!(r && r.__v_isRef === true);
  3475. }
  3476. if (process.env.NODE_ENV !== 'production') ;
  3477. const normalizeEvent = cached((name) => {
  3478. const passive = name.charAt(0) === '&';
  3479. name = passive ? name.slice(1) : name;
  3480. const once = name.charAt(0) === '~'; // Prefixed last, checked first
  3481. name = once ? name.slice(1) : name;
  3482. const capture = name.charAt(0) === '!';
  3483. name = capture ? name.slice(1) : name;
  3484. return {
  3485. name,
  3486. once,
  3487. capture,
  3488. passive
  3489. };
  3490. });
  3491. function createFnInvoker(fns, vm) {
  3492. function invoker() {
  3493. const fns = invoker.fns;
  3494. if (isArray(fns)) {
  3495. const cloned = fns.slice();
  3496. for (let i = 0; i < cloned.length; i++) {
  3497. invokeWithErrorHandling(cloned[i], null, arguments, vm, `v-on handler`);
  3498. }
  3499. }
  3500. else {
  3501. // return handler return value for single handlers
  3502. return invokeWithErrorHandling(fns, null, arguments, vm, `v-on handler`);
  3503. }
  3504. }
  3505. invoker.fns = fns;
  3506. return invoker;
  3507. }
  3508. function updateListeners(on, oldOn, add, remove, createOnceHandler, vm) {
  3509. let name, cur, old, event;
  3510. for (name in on) {
  3511. cur = on[name];
  3512. old = oldOn[name];
  3513. event = normalizeEvent(name);
  3514. if (isUndef(cur)) {
  3515. process.env.NODE_ENV !== 'production' &&
  3516. warn$3(`Invalid handler for event "${event.name}": got ` + String(cur), vm);
  3517. }
  3518. else if (isUndef(old)) {
  3519. if (isUndef(cur.fns)) {
  3520. cur = on[name] = createFnInvoker(cur, vm);
  3521. }
  3522. if (isTrue(event.once)) {
  3523. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  3524. }
  3525. add(event.name, cur, event.capture, event.passive, event.params);
  3526. }
  3527. else if (cur !== old) {
  3528. old.fns = cur;
  3529. on[name] = old;
  3530. }
  3531. }
  3532. for (name in oldOn) {
  3533. if (isUndef(on[name])) {
  3534. event = normalizeEvent(name);
  3535. remove(event.name, oldOn[name], event.capture);
  3536. }
  3537. }
  3538. }
  3539. function extractPropsFromVNodeData(data, Ctor, tag) {
  3540. // we are only extracting raw values here.
  3541. // validation and default values are handled in the child
  3542. // component itself.
  3543. const propOptions = Ctor.options.props;
  3544. if (isUndef(propOptions)) {
  3545. return;
  3546. }
  3547. const res = {};
  3548. const { attrs, props } = data;
  3549. if (isDef(attrs) || isDef(props)) {
  3550. for (const key in propOptions) {
  3551. const altKey = hyphenate(key);
  3552. if (process.env.NODE_ENV !== 'production') {
  3553. const keyInLowerCase = key.toLowerCase();
  3554. if (key !== keyInLowerCase && attrs && hasOwn(attrs, keyInLowerCase)) {
  3555. tip(`Prop "${keyInLowerCase}" is passed to component ` +
  3556. `${formatComponentName(
  3557. // @ts-expect-error tag is string
  3558. tag || Ctor)}, but the declared prop name is` +
  3559. ` "${key}". ` +
  3560. `Note that HTML attributes are case-insensitive and camelCased ` +
  3561. `props need to use their kebab-case equivalents when using in-DOM ` +
  3562. `templates. You should probably use "${altKey}" instead of "${key}".`);
  3563. }
  3564. }
  3565. checkProp(res, props, key, altKey, true) ||
  3566. checkProp(res, attrs, key, altKey, false);
  3567. }
  3568. }
  3569. return res;
  3570. }
  3571. function checkProp(res, hash, key, altKey, preserve) {
  3572. if (isDef(hash)) {
  3573. if (hasOwn(hash, key)) {
  3574. res[key] = hash[key];
  3575. if (!preserve) {
  3576. delete hash[key];
  3577. }
  3578. return true;
  3579. }
  3580. else if (hasOwn(hash, altKey)) {
  3581. res[key] = hash[altKey];
  3582. if (!preserve) {
  3583. delete hash[altKey];
  3584. }
  3585. return true;
  3586. }
  3587. }
  3588. return false;
  3589. }
  3590. // The template compiler attempts to minimize the need for normalization by
  3591. // statically analyzing the template at compile time.
  3592. //
  3593. // For plain HTML markup, normalization can be completely skipped because the
  3594. // generated render function is guaranteed to return Array<VNode>. There are
  3595. // two cases where extra normalization is needed:
  3596. // 1. When the children contains components - because a functional component
  3597. // may return an Array instead of a single root. In this case, just a simple
  3598. // normalization is needed - if any child is an Array, we flatten the whole
  3599. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  3600. // because functional components already normalize their own children.
  3601. function simpleNormalizeChildren(children) {
  3602. for (let i = 0; i < children.length; i++) {
  3603. if (isArray(children[i])) {
  3604. return Array.prototype.concat.apply([], children);
  3605. }
  3606. }
  3607. return children;
  3608. }
  3609. // 2. When the children contains constructs that always generated nested Arrays,
  3610. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  3611. // with hand-written render functions / JSX. In such cases a full normalization
  3612. // is needed to cater to all possible types of children values.
  3613. function normalizeChildren(children) {
  3614. return isPrimitive(children)
  3615. ? [createTextVNode(children)]
  3616. : isArray(children)
  3617. ? normalizeArrayChildren(children)
  3618. : undefined;
  3619. }
  3620. function isTextNode(node) {
  3621. return isDef(node) && isDef(node.text) && isFalse(node.isComment);
  3622. }
  3623. function normalizeArrayChildren(children, nestedIndex) {
  3624. const res = [];
  3625. let i, c, lastIndex, last;
  3626. for (i = 0; i < children.length; i++) {
  3627. c = children[i];
  3628. if (isUndef(c) || typeof c === 'boolean')
  3629. continue;
  3630. lastIndex = res.length - 1;
  3631. last = res[lastIndex];
  3632. // nested
  3633. if (isArray(c)) {
  3634. if (c.length > 0) {
  3635. c = normalizeArrayChildren(c, `${nestedIndex || ''}_${i}`);
  3636. // merge adjacent text nodes
  3637. if (isTextNode(c[0]) && isTextNode(last)) {
  3638. res[lastIndex] = createTextVNode(last.text + c[0].text);
  3639. c.shift();
  3640. }
  3641. res.push.apply(res, c);
  3642. }
  3643. }
  3644. else if (isPrimitive(c)) {
  3645. if (isTextNode(last)) {
  3646. // merge adjacent text nodes
  3647. // this is necessary for SSR hydration because text nodes are
  3648. // essentially merged when rendered to HTML strings
  3649. res[lastIndex] = createTextVNode(last.text + c);
  3650. }
  3651. else if (c !== '') {
  3652. // convert primitive to vnode
  3653. res.push(createTextVNode(c));
  3654. }
  3655. }
  3656. else {
  3657. if (isTextNode(c) && isTextNode(last)) {
  3658. // merge adjacent text nodes
  3659. res[lastIndex] = createTextVNode(last.text + c.text);
  3660. }
  3661. else {
  3662. // default key for nested array children (likely generated by v-for)
  3663. if (isTrue(children._isVList) &&
  3664. isDef(c.tag) &&
  3665. isUndef(c.key) &&
  3666. isDef(nestedIndex)) {
  3667. c.key = `__vlist${nestedIndex}_${i}__`;
  3668. }
  3669. res.push(c);
  3670. }
  3671. }
  3672. }
  3673. return res;
  3674. }
  3675. const SIMPLE_NORMALIZE = 1;
  3676. const ALWAYS_NORMALIZE = 2;
  3677. // wrapper function for providing a more flexible interface
  3678. // without getting yelled at by flow
  3679. function createElement(context, tag, data, children, normalizationType, alwaysNormalize) {
  3680. if (isArray(data) || isPrimitive(data)) {
  3681. normalizationType = children;
  3682. children = data;
  3683. data = undefined;
  3684. }
  3685. if (isTrue(alwaysNormalize)) {
  3686. normalizationType = ALWAYS_NORMALIZE;
  3687. }
  3688. return _createElement(context, tag, data, children, normalizationType);
  3689. }
  3690. function _createElement(context, tag, data, children, normalizationType) {
  3691. if (isDef(data) && isDef(data.__ob__)) {
  3692. process.env.NODE_ENV !== 'production' &&
  3693. warn$3(`Avoid using observed data object as vnode data: ${JSON.stringify(data)}\n` + 'Always create fresh vnode data objects in each render!', context);
  3694. return createEmptyVNode();
  3695. }
  3696. // object syntax in v-bind
  3697. if (isDef(data) && isDef(data.is)) {
  3698. tag = data.is;
  3699. }
  3700. if (!tag) {
  3701. // in case of component :is set to falsy value
  3702. return createEmptyVNode();
  3703. }
  3704. // warn against non-primitive key
  3705. if (process.env.NODE_ENV !== 'production' && isDef(data) && isDef(data.key) && !isPrimitive(data.key)) {
  3706. warn$3('Avoid using non-primitive value as key, ' +
  3707. 'use string/number value instead.', context);
  3708. }
  3709. // support single function children as default scoped slot
  3710. if (isArray(children) && isFunction(children[0])) {
  3711. data = data || {};
  3712. data.scopedSlots = { default: children[0] };
  3713. children.length = 0;
  3714. }
  3715. if (normalizationType === ALWAYS_NORMALIZE) {
  3716. children = normalizeChildren(children);
  3717. }
  3718. else if (normalizationType === SIMPLE_NORMALIZE) {
  3719. children = simpleNormalizeChildren(children);
  3720. }
  3721. let vnode, ns;
  3722. if (typeof tag === 'string') {
  3723. let Ctor;
  3724. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  3725. if ((!data || !data.pre) &&
  3726. isDef((Ctor = resolveAsset(context.$options, 'components', tag)))) {
  3727. // component
  3728. vnode = createComponent(Ctor, data, context, children, tag);
  3729. }
  3730. else {
  3731. // unknown or unlisted namespaced elements
  3732. // check at runtime because it may get assigned a namespace when its
  3733. // parent normalizes children
  3734. vnode = new VNode(tag, data, children, undefined, undefined, context);
  3735. }
  3736. }
  3737. else {
  3738. // direct component options / constructor
  3739. vnode = createComponent(tag, data, context, children);
  3740. }
  3741. if (isArray(vnode)) {
  3742. return vnode;
  3743. }
  3744. else if (isDef(vnode)) {
  3745. if (isDef(ns))
  3746. applyNS(vnode, ns);
  3747. if (isDef(data))
  3748. registerDeepBindings(data);
  3749. return vnode;
  3750. }
  3751. else {
  3752. return createEmptyVNode();
  3753. }
  3754. }
  3755. function applyNS(vnode, ns, force) {
  3756. vnode.ns = ns;
  3757. if (vnode.tag === 'foreignObject') {
  3758. // use default namespace inside foreignObject
  3759. ns = undefined;
  3760. force = true;
  3761. }
  3762. if (isDef(vnode.children)) {
  3763. for (let i = 0, l = vnode.children.length; i < l; i++) {
  3764. const child = vnode.children[i];
  3765. if (isDef(child.tag) &&
  3766. (isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  3767. applyNS(child, ns, force);
  3768. }
  3769. }
  3770. }
  3771. }
  3772. // ref #5318
  3773. // necessary to ensure parent re-render when deep bindings like :style and
  3774. // :class are used on slot nodes
  3775. function registerDeepBindings(data) {
  3776. if (isObject$1(data.style)) {
  3777. traverse(data.style);
  3778. }
  3779. if (isObject$1(data.class)) {
  3780. traverse(data.class);
  3781. }
  3782. }
  3783. /**
  3784. * Runtime helper for rendering v-for lists.
  3785. */
  3786. function renderList(val, render) {
  3787. let ret = null, i, l, keys, key;
  3788. if (isArray(val) || typeof val === 'string') {
  3789. ret = new Array(val.length);
  3790. for (i = 0, l = val.length; i < l; i++) {
  3791. ret[i] = render(val[i], i);
  3792. }
  3793. }
  3794. else if (typeof val === 'number') {
  3795. ret = new Array(val);
  3796. for (i = 0; i < val; i++) {
  3797. ret[i] = render(i + 1, i);
  3798. }
  3799. }
  3800. else if (isObject$1(val)) {
  3801. if (hasSymbol && val[Symbol.iterator]) {
  3802. ret = [];
  3803. const iterator = val[Symbol.iterator]();
  3804. let result = iterator.next();
  3805. while (!result.done) {
  3806. ret.push(render(result.value, ret.length));
  3807. result = iterator.next();
  3808. }
  3809. }
  3810. else {
  3811. keys = Object.keys(val);
  3812. ret = new Array(keys.length);
  3813. for (i = 0, l = keys.length; i < l; i++) {
  3814. key = keys[i];
  3815. ret[i] = render(val[key], key, i);
  3816. }
  3817. }
  3818. }
  3819. if (!isDef(ret)) {
  3820. ret = [];
  3821. }
  3822. ret._isVList = true;
  3823. return ret;
  3824. }
  3825. /**
  3826. * Runtime helper for rendering <slot>
  3827. */
  3828. function renderSlot(name, fallbackRender, props, bindObject) {
  3829. const scopedSlotFn = this.$scopedSlots[name];
  3830. let nodes;
  3831. if (scopedSlotFn) {
  3832. // scoped slot
  3833. props = props || {};
  3834. if (bindObject) {
  3835. if (process.env.NODE_ENV !== 'production' && !isObject$1(bindObject)) {
  3836. warn$3('slot v-bind without argument expects an Object', this);
  3837. }
  3838. props = extend(extend({}, bindObject), props);
  3839. }
  3840. nodes =
  3841. scopedSlotFn(props) ||
  3842. (isFunction(fallbackRender) ? fallbackRender() : fallbackRender);
  3843. }
  3844. else {
  3845. nodes =
  3846. this.$slots[name] ||
  3847. (isFunction(fallbackRender) ? fallbackRender() : fallbackRender);
  3848. }
  3849. const target = props && props.slot;
  3850. if (target) {
  3851. return this.$createElement('template', { slot: target }, nodes);
  3852. }
  3853. else {
  3854. return nodes;
  3855. }
  3856. }
  3857. /**
  3858. * Runtime helper for resolving filters
  3859. */
  3860. function resolveFilter(id) {
  3861. return resolveAsset(this.$options, 'filters', id, true) || identity;
  3862. }
  3863. function isKeyNotMatch(expect, actual) {
  3864. if (isArray(expect)) {
  3865. return expect.indexOf(actual) === -1;
  3866. }
  3867. else {
  3868. return expect !== actual;
  3869. }
  3870. }
  3871. /**
  3872. * Runtime helper for checking keyCodes from config.
  3873. * exposed as Vue.prototype._k
  3874. * passing in eventKeyName as last argument separately for backwards compat
  3875. */
  3876. function checkKeyCodes(eventKeyCode, key, builtInKeyCode, eventKeyName, builtInKeyName) {
  3877. const mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  3878. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  3879. return isKeyNotMatch(builtInKeyName, eventKeyName);
  3880. }
  3881. else if (mappedKeyCode) {
  3882. return isKeyNotMatch(mappedKeyCode, eventKeyCode);
  3883. }
  3884. else if (eventKeyName) {
  3885. return hyphenate(eventKeyName) !== key;
  3886. }
  3887. return eventKeyCode === undefined;
  3888. }
  3889. /**
  3890. * Runtime helper for merging v-bind="object" into a VNode's data.
  3891. */
  3892. function bindObjectProps(data, tag, value, asProp, isSync) {
  3893. if (value) {
  3894. if (!isObject$1(value)) {
  3895. process.env.NODE_ENV !== 'production' &&
  3896. warn$3('v-bind without argument expects an Object or Array value', this);
  3897. }
  3898. else {
  3899. if (isArray(value)) {
  3900. value = toObject(value);
  3901. }
  3902. let hash;
  3903. for (const key in value) {
  3904. if (key === 'class' || key === 'style' || isReservedAttribute(key)) {
  3905. hash = data;
  3906. }
  3907. else {
  3908. const type = data.attrs && data.attrs.type;
  3909. hash =
  3910. asProp || config.mustUseProp(tag, type, key)
  3911. ? data.domProps || (data.domProps = {})
  3912. : data.attrs || (data.attrs = {});
  3913. }
  3914. const camelizedKey = camelize(key);
  3915. const hyphenatedKey = hyphenate(key);
  3916. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  3917. hash[key] = value[key];
  3918. if (isSync) {
  3919. const on = data.on || (data.on = {});
  3920. on[`update:${key}`] = function ($event) {
  3921. value[key] = $event;
  3922. };
  3923. }
  3924. }
  3925. }
  3926. }
  3927. }
  3928. return data;
  3929. }
  3930. /**
  3931. * Runtime helper for rendering static trees.
  3932. */
  3933. function renderStatic(index, isInFor) {
  3934. const cached = this._staticTrees || (this._staticTrees = []);
  3935. let tree = cached[index];
  3936. // if has already-rendered static tree and not inside v-for,
  3937. // we can reuse the same tree.
  3938. if (tree && !isInFor) {
  3939. return tree;
  3940. }
  3941. // otherwise, render a fresh tree.
  3942. tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, this._c, this // for render fns generated for functional component templates
  3943. );
  3944. markStatic$1(tree, `__static__${index}`, false);
  3945. return tree;
  3946. }
  3947. /**
  3948. * Runtime helper for v-once.
  3949. * Effectively it means marking the node as static with a unique key.
  3950. */
  3951. function markOnce(tree, index, key) {
  3952. markStatic$1(tree, `__once__${index}${key ? `_${key}` : ``}`, true);
  3953. return tree;
  3954. }
  3955. function markStatic$1(tree, key, isOnce) {
  3956. if (isArray(tree)) {
  3957. for (let i = 0; i < tree.length; i++) {
  3958. if (tree[i] && typeof tree[i] !== 'string') {
  3959. markStaticNode(tree[i], `${key}_${i}`, isOnce);
  3960. }
  3961. }
  3962. }
  3963. else {
  3964. markStaticNode(tree, key, isOnce);
  3965. }
  3966. }
  3967. function markStaticNode(node, key, isOnce) {
  3968. node.isStatic = true;
  3969. node.key = key;
  3970. node.isOnce = isOnce;
  3971. }
  3972. function bindObjectListeners(data, value) {
  3973. if (value) {
  3974. if (!isPlainObject(value)) {
  3975. process.env.NODE_ENV !== 'production' && warn$3('v-on without argument expects an Object value', this);
  3976. }
  3977. else {
  3978. const on = (data.on = data.on ? extend({}, data.on) : {});
  3979. for (const key in value) {
  3980. const existing = on[key];
  3981. const ours = value[key];
  3982. on[key] = existing ? [].concat(existing, ours) : ours;
  3983. }
  3984. }
  3985. }
  3986. return data;
  3987. }
  3988. function resolveScopedSlots(fns, res,
  3989. // the following are added in 2.6
  3990. hasDynamicKeys, contentHashKey) {
  3991. res = res || { $stable: !hasDynamicKeys };
  3992. for (let i = 0; i < fns.length; i++) {
  3993. const slot = fns[i];
  3994. if (isArray(slot)) {
  3995. resolveScopedSlots(slot, res, hasDynamicKeys);
  3996. }
  3997. else if (slot) {
  3998. // marker for reverse proxying v-slot without scope on this.$slots
  3999. // @ts-expect-error
  4000. if (slot.proxy) {
  4001. // @ts-expect-error
  4002. slot.fn.proxy = true;
  4003. }
  4004. res[slot.key] = slot.fn;
  4005. }
  4006. }
  4007. if (contentHashKey) {
  4008. res.$key = contentHashKey;
  4009. }
  4010. return res;
  4011. }
  4012. // helper to process dynamic keys for dynamic arguments in v-bind and v-on.
  4013. function bindDynamicKeys(baseObj, values) {
  4014. for (let i = 0; i < values.length; i += 2) {
  4015. const key = values[i];
  4016. if (typeof key === 'string' && key) {
  4017. baseObj[values[i]] = values[i + 1];
  4018. }
  4019. else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) {
  4020. // null is a special value for explicitly removing a binding
  4021. warn$3(`Invalid value for dynamic directive argument (expected string or null): ${key}`, this);
  4022. }
  4023. }
  4024. return baseObj;
  4025. }
  4026. // helper to dynamically append modifier runtime markers to event names.
  4027. // ensure only append when value is already string, otherwise it will be cast
  4028. // to string and cause the type check to miss.
  4029. function prependModifier(value, symbol) {
  4030. return typeof value === 'string' ? symbol + value : value;
  4031. }
  4032. function installRenderHelpers(target) {
  4033. target._o = markOnce;
  4034. target._n = toNumber;
  4035. target._s = toString$2;
  4036. target._l = renderList;
  4037. target._t = renderSlot;
  4038. target._q = looseEqual;
  4039. target._i = looseIndexOf;
  4040. target._m = renderStatic;
  4041. target._f = resolveFilter;
  4042. target._k = checkKeyCodes;
  4043. target._b = bindObjectProps;
  4044. target._v = createTextVNode;
  4045. target._e = createEmptyVNode;
  4046. target._u = resolveScopedSlots;
  4047. target._g = bindObjectListeners;
  4048. target._d = bindDynamicKeys;
  4049. target._p = prependModifier;
  4050. }
  4051. /**
  4052. * Runtime helper for resolving raw children VNodes into a slot object.
  4053. */
  4054. function resolveSlots(children, context) {
  4055. if (!children || !children.length) {
  4056. return {};
  4057. }
  4058. const slots = {};
  4059. for (let i = 0, l = children.length; i < l; i++) {
  4060. const child = children[i];
  4061. const data = child.data;
  4062. // remove slot attribute if the node is resolved as a Vue slot node
  4063. if (data && data.attrs && data.attrs.slot) {
  4064. delete data.attrs.slot;
  4065. }
  4066. // named slots should only be respected if the vnode was rendered in the
  4067. // same context.
  4068. if ((child.context === context || child.fnContext === context) &&
  4069. data &&
  4070. data.slot != null) {
  4071. const name = data.slot;
  4072. const slot = slots[name] || (slots[name] = []);
  4073. if (child.tag === 'template') {
  4074. slot.push.apply(slot, child.children || []);
  4075. }
  4076. else {
  4077. slot.push(child);
  4078. }
  4079. }
  4080. else {
  4081. (slots.default || (slots.default = [])).push(child);
  4082. }
  4083. }
  4084. // ignore slots that contains only whitespace
  4085. for (const name in slots) {
  4086. if (slots[name].every(isWhitespace)) {
  4087. delete slots[name];
  4088. }
  4089. }
  4090. return slots;
  4091. }
  4092. function isWhitespace(node) {
  4093. return (node.isComment && !node.asyncFactory) || node.text === ' ';
  4094. }
  4095. function isAsyncPlaceholder(node) {
  4096. // @ts-expect-error not really boolean type
  4097. return node.isComment && node.asyncFactory;
  4098. }
  4099. function normalizeScopedSlots(ownerVm, scopedSlots, normalSlots, prevScopedSlots) {
  4100. let res;
  4101. const hasNormalSlots = Object.keys(normalSlots).length > 0;
  4102. const isStable = scopedSlots ? !!scopedSlots.$stable : !hasNormalSlots;
  4103. const key = scopedSlots && scopedSlots.$key;
  4104. if (!scopedSlots) {
  4105. res = {};
  4106. }
  4107. else if (scopedSlots._normalized) {
  4108. // fast path 1: child component re-render only, parent did not change
  4109. return scopedSlots._normalized;
  4110. }
  4111. else if (isStable &&
  4112. prevScopedSlots &&
  4113. prevScopedSlots !== emptyObject &&
  4114. key === prevScopedSlots.$key &&
  4115. !hasNormalSlots &&
  4116. !prevScopedSlots.$hasNormal) {
  4117. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  4118. // only need to normalize once
  4119. return prevScopedSlots;
  4120. }
  4121. else {
  4122. res = {};
  4123. for (const key in scopedSlots) {
  4124. if (scopedSlots[key] && key[0] !== '$') {
  4125. res[key] = normalizeScopedSlot(ownerVm, normalSlots, key, scopedSlots[key]);
  4126. }
  4127. }
  4128. }
  4129. // expose normal slots on scopedSlots
  4130. for (const key in normalSlots) {
  4131. if (!(key in res)) {
  4132. res[key] = proxyNormalSlot(normalSlots, key);
  4133. }
  4134. }
  4135. // avoriaz seems to mock a non-extensible $scopedSlots object
  4136. // and when that is passed down this would cause an error
  4137. if (scopedSlots && Object.isExtensible(scopedSlots)) {
  4138. scopedSlots._normalized = res;
  4139. }
  4140. def(res, '$stable', isStable);
  4141. def(res, '$key', key);
  4142. def(res, '$hasNormal', hasNormalSlots);
  4143. return res;
  4144. }
  4145. function normalizeScopedSlot(vm, normalSlots, key, fn) {
  4146. const normalized = function () {
  4147. const cur = currentInstance;
  4148. setCurrentInstance(vm);
  4149. let res = arguments.length ? fn.apply(null, arguments) : fn({});
  4150. res =
  4151. res && typeof res === 'object' && !isArray(res)
  4152. ? [res] // single vnode
  4153. : normalizeChildren(res);
  4154. const vnode = res && res[0];
  4155. setCurrentInstance(cur);
  4156. return res &&
  4157. (!vnode ||
  4158. (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode))) // #9658, #10391
  4159. ? undefined
  4160. : res;
  4161. };
  4162. // this is a slot using the new v-slot syntax without scope. although it is
  4163. // compiled as a scoped slot, render fn users would expect it to be present
  4164. // on this.$slots because the usage is semantically a normal slot.
  4165. if (fn.proxy) {
  4166. Object.defineProperty(normalSlots, key, {
  4167. get: normalized,
  4168. enumerable: true,
  4169. configurable: true
  4170. });
  4171. }
  4172. return normalized;
  4173. }
  4174. function proxyNormalSlot(slots, key) {
  4175. return () => slots[key];
  4176. }
  4177. function syncSetupProxy(to, from, prev, instance, type) {
  4178. let changed = false;
  4179. for (const key in from) {
  4180. if (!(key in to)) {
  4181. changed = true;
  4182. defineProxyAttr(to, key, instance, type);
  4183. }
  4184. else if (from[key] !== prev[key]) {
  4185. changed = true;
  4186. }
  4187. }
  4188. for (const key in to) {
  4189. if (!(key in from)) {
  4190. changed = true;
  4191. delete to[key];
  4192. }
  4193. }
  4194. return changed;
  4195. }
  4196. function defineProxyAttr(proxy, key, instance, type) {
  4197. Object.defineProperty(proxy, key, {
  4198. enumerable: true,
  4199. configurable: true,
  4200. get() {
  4201. return instance[type][key];
  4202. }
  4203. });
  4204. }
  4205. function createAsyncPlaceholder(factory, data, context, children, tag) {
  4206. const node = createEmptyVNode();
  4207. node.asyncFactory = factory;
  4208. node.asyncMeta = { data, context, children, tag };
  4209. return node;
  4210. }
  4211. function resolveAsyncComponent(factory, baseCtor) {
  4212. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  4213. return factory.errorComp;
  4214. }
  4215. if (isDef(factory.resolved)) {
  4216. return factory.resolved;
  4217. }
  4218. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  4219. return factory.loadingComp;
  4220. }
  4221. }
  4222. let target;
  4223. function add(event, fn) {
  4224. target.$on(event, fn);
  4225. }
  4226. function remove(event, fn) {
  4227. target.$off(event, fn);
  4228. }
  4229. function createOnceHandler(event, fn) {
  4230. const _target = target;
  4231. return function onceHandler() {
  4232. const res = fn.apply(null, arguments);
  4233. if (res !== null) {
  4234. _target.$off(event, onceHandler);
  4235. }
  4236. };
  4237. }
  4238. function updateComponentListeners(vm, listeners, oldListeners) {
  4239. target = vm;
  4240. updateListeners(listeners, oldListeners || {}, add, remove, createOnceHandler, vm);
  4241. target = undefined;
  4242. }
  4243. let activeInstance = null;
  4244. function updateChildComponent(vm, propsData, listeners, parentVnode, renderChildren) {
  4245. if (process.env.NODE_ENV !== 'production') ;
  4246. // determine whether component has slot children
  4247. // we need to do this before overwriting $options._renderChildren.
  4248. // check if there are dynamic scopedSlots (hand-written or compiled but with
  4249. // dynamic slot names). Static scoped slots compiled from template has the
  4250. // "$stable" marker.
  4251. const newScopedSlots = parentVnode.data.scopedSlots;
  4252. const oldScopedSlots = vm.$scopedSlots;
  4253. const hasDynamicScopedSlot = !!((newScopedSlots && !newScopedSlots.$stable) ||
  4254. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  4255. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
  4256. (!newScopedSlots && vm.$scopedSlots.$key));
  4257. // Any static slot children from the parent may have changed during parent's
  4258. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  4259. // update is necessary to ensure correctness.
  4260. let needsForceUpdate = !!(renderChildren || // has new static slots
  4261. vm.$options._renderChildren || // has old static slots
  4262. hasDynamicScopedSlot);
  4263. const prevVNode = vm.$vnode;
  4264. vm.$options._parentVnode = parentVnode;
  4265. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  4266. if (vm._vnode) {
  4267. // update child tree's parent
  4268. vm._vnode.parent = parentVnode;
  4269. }
  4270. vm.$options._renderChildren = renderChildren;
  4271. // update $attrs and $listeners hash
  4272. // these are also reactive so they may trigger child update if the child
  4273. // used them during render
  4274. const attrs = parentVnode.data.attrs || emptyObject;
  4275. if (vm._attrsProxy) {
  4276. // force update if attrs are accessed and has changed since it may be
  4277. // passed to a child component.
  4278. if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
  4279. needsForceUpdate = true;
  4280. }
  4281. }
  4282. vm.$attrs = attrs;
  4283. // update listeners
  4284. listeners = listeners || emptyObject;
  4285. const prevListeners = vm.$options._parentListeners;
  4286. if (vm._listenersProxy) {
  4287. syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
  4288. }
  4289. vm.$listeners = vm.$options._parentListeners = listeners;
  4290. updateComponentListeners(vm, listeners, prevListeners);
  4291. // update props
  4292. if (propsData && vm.$options.props) {
  4293. toggleObserving(false);
  4294. const props = vm._props;
  4295. const propKeys = vm.$options._propKeys || [];
  4296. for (let i = 0; i < propKeys.length; i++) {
  4297. const key = propKeys[i];
  4298. const propOptions = vm.$options.props; // wtf flow?
  4299. props[key] = validateProp(key, propOptions, propsData, vm);
  4300. }
  4301. toggleObserving(true);
  4302. // keep a copy of raw propsData
  4303. vm.$options.propsData = propsData;
  4304. }
  4305. // resolve slots + force update if has children
  4306. if (needsForceUpdate) {
  4307. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  4308. vm.$forceUpdate();
  4309. }
  4310. if (process.env.NODE_ENV !== 'production') ;
  4311. }
  4312. function isInInactiveTree(vm) {
  4313. while (vm && (vm = vm.$parent)) {
  4314. if (vm._inactive)
  4315. return true;
  4316. }
  4317. return false;
  4318. }
  4319. function activateChildComponent(vm, direct) {
  4320. if (direct) {
  4321. vm._directInactive = false;
  4322. if (isInInactiveTree(vm)) {
  4323. return;
  4324. }
  4325. }
  4326. else if (vm._directInactive) {
  4327. return;
  4328. }
  4329. if (vm._inactive || vm._inactive === null) {
  4330. vm._inactive = false;
  4331. for (let i = 0; i < vm.$children.length; i++) {
  4332. activateChildComponent(vm.$children[i]);
  4333. }
  4334. callHook(vm, 'activated');
  4335. }
  4336. }
  4337. function deactivateChildComponent(vm, direct) {
  4338. if (direct) {
  4339. vm._directInactive = true;
  4340. if (isInInactiveTree(vm)) {
  4341. return;
  4342. }
  4343. }
  4344. if (!vm._inactive) {
  4345. vm._inactive = true;
  4346. for (let i = 0; i < vm.$children.length; i++) {
  4347. deactivateChildComponent(vm.$children[i]);
  4348. }
  4349. callHook(vm, 'deactivated');
  4350. }
  4351. }
  4352. function callHook(vm, hook, args, setContext = true) {
  4353. // #7573 disable dep collection when invoking lifecycle hooks
  4354. pushTarget();
  4355. const prev = currentInstance;
  4356. setContext && setCurrentInstance(vm);
  4357. const handlers = vm.$options[hook];
  4358. const info = `${hook} hook`;
  4359. if (handlers) {
  4360. for (let i = 0, j = handlers.length; i < j; i++) {
  4361. invokeWithErrorHandling(handlers[i], vm, args || null, vm, info);
  4362. }
  4363. }
  4364. if (vm._hasHookEvent) {
  4365. vm.$emit('hook:' + hook);
  4366. }
  4367. setContext && setCurrentInstance(prev);
  4368. popTarget();
  4369. }
  4370. // Async edge case fix requires storing an event listener's attach timestamp.
  4371. let getNow = Date.now;
  4372. // Determine what event timestamp the browser is using. Annoyingly, the
  4373. // timestamp can either be hi-res (relative to page load) or low-res
  4374. // (relative to UNIX epoch), so in order to compare time we have to use the
  4375. // same timestamp type when saving the flush timestamp.
  4376. // All IE versions use low-res event timestamps, and have problematic clock
  4377. // implementations (#9632)
  4378. if (inBrowser && !isIE) {
  4379. const performance = window.performance;
  4380. if (performance &&
  4381. typeof performance.now === 'function' &&
  4382. getNow() > document.createEvent('Event').timeStamp) {
  4383. // if the event timestamp, although evaluated AFTER the Date.now(), is
  4384. // smaller than it, it means the event is using a hi-res timestamp,
  4385. // and we need to use the hi-res version for event listener timestamps as
  4386. // well.
  4387. getNow = () => performance.now();
  4388. }
  4389. }
  4390. /**
  4391. * Queue a kept-alive component that was activated during patch.
  4392. * The queue will be processed after the entire tree has been patched.
  4393. */
  4394. function queueActivatedComponent(vm) {
  4395. // setting _inactive to false here so that a render function can
  4396. // rely on checking whether it's in an inactive tree (e.g. router-view)
  4397. vm._inactive = false;
  4398. }
  4399. function handleError(err, vm, info) {
  4400. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  4401. // See: https://github.com/vuejs/vuex/issues/1505
  4402. pushTarget();
  4403. try {
  4404. if (vm) {
  4405. let cur = vm;
  4406. while ((cur = cur.$parent)) {
  4407. const hooks = cur.$options.errorCaptured;
  4408. if (hooks) {
  4409. for (let i = 0; i < hooks.length; i++) {
  4410. try {
  4411. const capture = hooks[i].call(cur, err, vm, info) === false;
  4412. if (capture)
  4413. return;
  4414. }
  4415. catch (e) {
  4416. globalHandleError(e, cur, 'errorCaptured hook');
  4417. }
  4418. }
  4419. }
  4420. }
  4421. }
  4422. globalHandleError(err, vm, info);
  4423. }
  4424. finally {
  4425. popTarget();
  4426. }
  4427. }
  4428. function invokeWithErrorHandling(handler, context, args, vm, info) {
  4429. let res;
  4430. try {
  4431. res = args ? handler.apply(context, args) : handler.call(context);
  4432. if (res && !res._isVue && isPromise(res) && !res._handled) {
  4433. res.catch(e => handleError(e, vm, info + ` (Promise/async)`));
  4434. res._handled = true;
  4435. }
  4436. }
  4437. catch (e) {
  4438. handleError(e, vm, info);
  4439. }
  4440. return res;
  4441. }
  4442. function globalHandleError(err, vm, info) {
  4443. logError(err, vm, info);
  4444. }
  4445. function logError(err, vm, info) {
  4446. if (process.env.NODE_ENV !== 'production') {
  4447. warn$3(`Error in ${info}: "${err.toString()}"`, vm);
  4448. }
  4449. /* istanbul ignore else */
  4450. if (inBrowser && typeof console !== 'undefined') {
  4451. console.error(err);
  4452. }
  4453. else {
  4454. throw err;
  4455. }
  4456. }
  4457. /* globals MutationObserver */
  4458. const callbacks = [];
  4459. function flushCallbacks() {
  4460. const copies = callbacks.slice(0);
  4461. callbacks.length = 0;
  4462. for (let i = 0; i < copies.length; i++) {
  4463. copies[i]();
  4464. }
  4465. }
  4466. // The nextTick behavior leverages the microtask queue, which can be accessed
  4467. // via either native Promise.then or MutationObserver.
  4468. // MutationObserver has wider support, however it is seriously bugged in
  4469. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  4470. // completely stops working after triggering a few times... so, if native
  4471. // Promise is available, we will use it:
  4472. /* istanbul ignore next, $flow-disable-line */
  4473. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  4474. Promise.resolve();
  4475. }
  4476. else if (!isIE &&
  4477. typeof MutationObserver !== 'undefined' &&
  4478. (isNative(MutationObserver) ||
  4479. // PhantomJS and iOS 7.x
  4480. MutationObserver.toString() === '[object MutationObserverConstructor]')) {
  4481. // Use MutationObserver where native Promise is not available,
  4482. // e.g. PhantomJS, iOS7, Android 4.4
  4483. // (#6466 MutationObserver is unreliable in IE11)
  4484. let counter = 1;
  4485. const observer = new MutationObserver(flushCallbacks);
  4486. const textNode = document.createTextNode(String(counter));
  4487. observer.observe(textNode, {
  4488. characterData: true
  4489. });
  4490. }
  4491. else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) ;
  4492. else ;
  4493. const seenObjects = new _Set();
  4494. /**
  4495. * Recursively traverse an object to evoke all converted
  4496. * getters, so that every nested property inside the object
  4497. * is collected as a "deep" dependency.
  4498. */
  4499. function traverse(val) {
  4500. _traverse(val, seenObjects);
  4501. seenObjects.clear();
  4502. return val;
  4503. }
  4504. function _traverse(val, seen) {
  4505. let i, keys;
  4506. const isA = isArray(val);
  4507. if ((!isA && !isObject$1(val)) ||
  4508. val.__v_skip /* ReactiveFlags.SKIP */ ||
  4509. Object.isFrozen(val) ||
  4510. val instanceof VNode) {
  4511. return;
  4512. }
  4513. if (val.__ob__) {
  4514. const depId = val.__ob__.dep.id;
  4515. if (seen.has(depId)) {
  4516. return;
  4517. }
  4518. seen.add(depId);
  4519. }
  4520. if (isA) {
  4521. i = val.length;
  4522. while (i--)
  4523. _traverse(val[i], seen);
  4524. }
  4525. else if (isRef(val)) {
  4526. _traverse(val.value, seen);
  4527. }
  4528. else {
  4529. keys = Object.keys(val);
  4530. i = keys.length;
  4531. while (i--)
  4532. _traverse(val[keys[i]], seen);
  4533. }
  4534. }
  4535. function resolveInject(inject, vm) {
  4536. if (inject) {
  4537. // inject is :any because flow is not smart enough to figure out cached
  4538. const result = Object.create(null);
  4539. const keys = hasSymbol ? Reflect.ownKeys(inject) : Object.keys(inject);
  4540. for (let i = 0; i < keys.length; i++) {
  4541. const key = keys[i];
  4542. // #6574 in case the inject object is observed...
  4543. if (key === '__ob__')
  4544. continue;
  4545. const provideKey = inject[key].from;
  4546. if (provideKey in vm._provided) {
  4547. result[key] = vm._provided[provideKey];
  4548. }
  4549. else if ('default' in inject[key]) {
  4550. const provideDefault = inject[key].default;
  4551. result[key] = isFunction(provideDefault)
  4552. ? provideDefault.call(vm)
  4553. : provideDefault;
  4554. }
  4555. else if (process.env.NODE_ENV !== 'production') {
  4556. warn$3(`Injection "${key}" not found`, vm);
  4557. }
  4558. }
  4559. return result;
  4560. }
  4561. }
  4562. function resolveConstructorOptions(Ctor) {
  4563. let options = Ctor.options;
  4564. if (Ctor.super) {
  4565. const superOptions = resolveConstructorOptions(Ctor.super);
  4566. const cachedSuperOptions = Ctor.superOptions;
  4567. if (superOptions !== cachedSuperOptions) {
  4568. // super option changed,
  4569. // need to resolve new options.
  4570. Ctor.superOptions = superOptions;
  4571. // check if there are any late-modified/attached options (#4976)
  4572. const modifiedOptions = resolveModifiedOptions(Ctor);
  4573. // update base extend options
  4574. if (modifiedOptions) {
  4575. extend(Ctor.extendOptions, modifiedOptions);
  4576. }
  4577. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4578. if (options.name) {
  4579. options.components[options.name] = Ctor;
  4580. }
  4581. }
  4582. }
  4583. return options;
  4584. }
  4585. function resolveModifiedOptions(Ctor) {
  4586. let modified;
  4587. const latest = Ctor.options;
  4588. const sealed = Ctor.sealedOptions;
  4589. for (const key in latest) {
  4590. if (latest[key] !== sealed[key]) {
  4591. if (!modified)
  4592. modified = {};
  4593. modified[key] = latest[key];
  4594. }
  4595. }
  4596. return modified;
  4597. }
  4598. function FunctionalRenderContext(data, props, children, parent, Ctor) {
  4599. const options = Ctor.options;
  4600. // ensure the createElement function in functional components
  4601. // gets a unique context - this is necessary for correct named slot check
  4602. let contextVm;
  4603. if (hasOwn(parent, '_uid')) {
  4604. contextVm = Object.create(parent);
  4605. contextVm._original = parent;
  4606. }
  4607. else {
  4608. // the context vm passed in is a functional context as well.
  4609. // in this case we want to make sure we are able to get a hold to the
  4610. // real context instance.
  4611. contextVm = parent;
  4612. // @ts-ignore
  4613. parent = parent._original;
  4614. }
  4615. const isCompiled = isTrue(options._compiled);
  4616. const needNormalization = !isCompiled;
  4617. this.data = data;
  4618. this.props = props;
  4619. this.children = children;
  4620. this.parent = parent;
  4621. this.listeners = data.on || emptyObject;
  4622. this.injections = resolveInject(options.inject, parent);
  4623. this.slots = () => {
  4624. if (!this.$slots) {
  4625. normalizeScopedSlots(parent, data.scopedSlots, (this.$slots = resolveSlots(children, parent)));
  4626. }
  4627. return this.$slots;
  4628. };
  4629. Object.defineProperty(this, 'scopedSlots', {
  4630. enumerable: true,
  4631. get() {
  4632. return normalizeScopedSlots(parent, data.scopedSlots, this.slots());
  4633. }
  4634. });
  4635. // support for compiled functional template
  4636. if (isCompiled) {
  4637. // exposing $options for renderStatic()
  4638. this.$options = options;
  4639. // pre-resolve slots for renderSlot()
  4640. this.$slots = this.slots();
  4641. this.$scopedSlots = normalizeScopedSlots(parent, data.scopedSlots, this.$slots);
  4642. }
  4643. if (options._scopeId) {
  4644. this._c = (a, b, c, d) => {
  4645. const vnode = createElement(contextVm, a, b, c, d, needNormalization);
  4646. if (vnode && !isArray(vnode)) {
  4647. vnode.fnScopeId = options._scopeId;
  4648. vnode.fnContext = parent;
  4649. }
  4650. return vnode;
  4651. };
  4652. }
  4653. else {
  4654. this._c = (a, b, c, d) => createElement(contextVm, a, b, c, d, needNormalization);
  4655. }
  4656. }
  4657. installRenderHelpers(FunctionalRenderContext.prototype);
  4658. function createFunctionalComponent(Ctor, propsData, data, contextVm, children) {
  4659. const options = Ctor.options;
  4660. const props = {};
  4661. const propOptions = options.props;
  4662. if (isDef(propOptions)) {
  4663. for (const key in propOptions) {
  4664. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  4665. }
  4666. }
  4667. else {
  4668. if (isDef(data.attrs))
  4669. mergeProps(props, data.attrs);
  4670. if (isDef(data.props))
  4671. mergeProps(props, data.props);
  4672. }
  4673. const renderContext = new FunctionalRenderContext(data, props, children, contextVm, Ctor);
  4674. const vnode = options.render.call(null, renderContext._c, renderContext);
  4675. if (vnode instanceof VNode) {
  4676. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext);
  4677. }
  4678. else if (isArray(vnode)) {
  4679. const vnodes = normalizeChildren(vnode) || [];
  4680. const res = new Array(vnodes.length);
  4681. for (let i = 0; i < vnodes.length; i++) {
  4682. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  4683. }
  4684. return res;
  4685. }
  4686. }
  4687. function cloneAndMarkFunctionalResult(vnode, data, contextVm, options, renderContext) {
  4688. // #7817 clone node before setting fnContext, otherwise if the node is reused
  4689. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  4690. // that should not be matched to match.
  4691. const clone = cloneVNode(vnode);
  4692. clone.fnContext = contextVm;
  4693. clone.fnOptions = options;
  4694. if (process.env.NODE_ENV !== 'production') {
  4695. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext =
  4696. renderContext;
  4697. }
  4698. if (data.slot) {
  4699. (clone.data || (clone.data = {})).slot = data.slot;
  4700. }
  4701. return clone;
  4702. }
  4703. function mergeProps(to, from) {
  4704. for (const key in from) {
  4705. to[camelize(key)] = from[key];
  4706. }
  4707. }
  4708. function getComponentName(options) {
  4709. return options.name || options.__name || options._componentTag;
  4710. }
  4711. // inline hooks to be invoked on component VNodes during patch
  4712. const componentVNodeHooks = {
  4713. init(vnode, hydrating) {
  4714. if (vnode.componentInstance &&
  4715. !vnode.componentInstance._isDestroyed &&
  4716. vnode.data.keepAlive) {
  4717. // kept-alive components, treat as a patch
  4718. const mountedNode = vnode; // work around flow
  4719. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  4720. }
  4721. else {
  4722. const child = (vnode.componentInstance = createComponentInstanceForVnode(vnode, activeInstance));
  4723. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  4724. }
  4725. },
  4726. prepatch(oldVnode, vnode) {
  4727. const options = vnode.componentOptions;
  4728. const child = (vnode.componentInstance = oldVnode.componentInstance);
  4729. updateChildComponent(child, options.propsData, // updated props
  4730. options.listeners, // updated listeners
  4731. vnode, // new parent vnode
  4732. options.children // new children
  4733. );
  4734. },
  4735. insert(vnode) {
  4736. const { context, componentInstance } = vnode;
  4737. if (!componentInstance._isMounted) {
  4738. componentInstance._isMounted = true;
  4739. callHook(componentInstance, 'mounted');
  4740. }
  4741. if (vnode.data.keepAlive) {
  4742. if (context._isMounted) {
  4743. // vue-router#1212
  4744. // During updates, a kept-alive component's child components may
  4745. // change, so directly walking the tree here may call activated hooks
  4746. // on incorrect children. Instead we push them into a queue which will
  4747. // be processed after the whole patch process ended.
  4748. queueActivatedComponent(componentInstance);
  4749. }
  4750. else {
  4751. activateChildComponent(componentInstance, true /* direct */);
  4752. }
  4753. }
  4754. },
  4755. destroy(vnode) {
  4756. const { componentInstance } = vnode;
  4757. if (!componentInstance._isDestroyed) {
  4758. if (!vnode.data.keepAlive) {
  4759. componentInstance.$destroy();
  4760. }
  4761. else {
  4762. deactivateChildComponent(componentInstance, true /* direct */);
  4763. }
  4764. }
  4765. }
  4766. };
  4767. const hooksToMerge = Object.keys(componentVNodeHooks);
  4768. function createComponent(Ctor, data, context, children, tag) {
  4769. if (isUndef(Ctor)) {
  4770. return;
  4771. }
  4772. const baseCtor = context.$options._base;
  4773. // plain options object: turn it into a constructor
  4774. if (isObject$1(Ctor)) {
  4775. Ctor = baseCtor.extend(Ctor);
  4776. }
  4777. // if at this stage it's not a constructor or an async component factory,
  4778. // reject.
  4779. if (typeof Ctor !== 'function') {
  4780. if (process.env.NODE_ENV !== 'production') {
  4781. warn$3(`Invalid Component definition: ${String(Ctor)}`, context);
  4782. }
  4783. return;
  4784. }
  4785. // async component
  4786. let asyncFactory;
  4787. // @ts-expect-error
  4788. if (isUndef(Ctor.cid)) {
  4789. asyncFactory = Ctor;
  4790. Ctor = resolveAsyncComponent(asyncFactory);
  4791. if (Ctor === undefined) {
  4792. // return a placeholder node for async component, which is rendered
  4793. // as a comment node but preserves all the raw information for the node.
  4794. // the information will be used for async server-rendering and hydration.
  4795. return createAsyncPlaceholder(asyncFactory, data, context, children, tag);
  4796. }
  4797. }
  4798. data = data || {};
  4799. // resolve constructor options in case global mixins are applied after
  4800. // component constructor creation
  4801. resolveConstructorOptions(Ctor);
  4802. // transform component v-model data into props & events
  4803. if (isDef(data.model)) {
  4804. // @ts-expect-error
  4805. transformModel(Ctor.options, data);
  4806. }
  4807. // extract props
  4808. // @ts-expect-error
  4809. const propsData = extractPropsFromVNodeData(data, Ctor, tag);
  4810. // functional component
  4811. // @ts-expect-error
  4812. if (isTrue(Ctor.options.functional)) {
  4813. return createFunctionalComponent(Ctor, propsData, data, context, children);
  4814. }
  4815. // extract listeners, since these needs to be treated as
  4816. // child component listeners instead of DOM listeners
  4817. const listeners = data.on;
  4818. // replace with listeners with .native modifier
  4819. // so it gets processed during parent component patch.
  4820. data.on = data.nativeOn;
  4821. // @ts-expect-error
  4822. if (isTrue(Ctor.options.abstract)) {
  4823. // abstract components do not keep anything
  4824. // other than props & listeners & slot
  4825. // work around flow
  4826. const slot = data.slot;
  4827. data = {};
  4828. if (slot) {
  4829. data.slot = slot;
  4830. }
  4831. }
  4832. // install component management hooks onto the placeholder node
  4833. installComponentHooks(data);
  4834. // return a placeholder vnode
  4835. // @ts-expect-error
  4836. const name = getComponentName(Ctor.options) || tag;
  4837. const vnode = new VNode(
  4838. // @ts-expect-error
  4839. `vue-component-${Ctor.cid}${name ? `-${name}` : ''}`, data, undefined, undefined, undefined, context,
  4840. // @ts-expect-error
  4841. { Ctor, propsData, listeners, tag, children }, asyncFactory);
  4842. return vnode;
  4843. }
  4844. function createComponentInstanceForVnode(
  4845. // we know it's MountedComponentVNode but flow doesn't
  4846. vnode,
  4847. // activeInstance in lifecycle state
  4848. parent) {
  4849. const options = {
  4850. _isComponent: true,
  4851. _parentVnode: vnode,
  4852. parent
  4853. };
  4854. // check inline-template render functions
  4855. const inlineTemplate = vnode.data.inlineTemplate;
  4856. if (isDef(inlineTemplate)) {
  4857. options.render = inlineTemplate.render;
  4858. options.staticRenderFns = inlineTemplate.staticRenderFns;
  4859. }
  4860. return new vnode.componentOptions.Ctor(options);
  4861. }
  4862. function installComponentHooks(data) {
  4863. const hooks = data.hook || (data.hook = {});
  4864. for (let i = 0; i < hooksToMerge.length; i++) {
  4865. const key = hooksToMerge[i];
  4866. const existing = hooks[key];
  4867. const toMerge = componentVNodeHooks[key];
  4868. // @ts-expect-error
  4869. if (existing !== toMerge && !(existing && existing._merged)) {
  4870. hooks[key] = existing ? mergeHook(toMerge, existing) : toMerge;
  4871. }
  4872. }
  4873. }
  4874. function mergeHook(f1, f2) {
  4875. const merged = (a, b) => {
  4876. // flow complains about extra args which is why we use any
  4877. f1(a, b);
  4878. f2(a, b);
  4879. };
  4880. merged._merged = true;
  4881. return merged;
  4882. }
  4883. // transform component v-model info (value and callback) into
  4884. // prop and event handler respectively.
  4885. function transformModel(options, data) {
  4886. const prop = (options.model && options.model.prop) || 'value';
  4887. const event = (options.model && options.model.event) || 'input';
  4888. (data.attrs || (data.attrs = {}))[prop] = data.model.value;
  4889. const on = data.on || (data.on = {});
  4890. const existing = on[event];
  4891. const callback = data.model.callback;
  4892. if (isDef(existing)) {
  4893. if (isArray(existing)
  4894. ? existing.indexOf(callback) === -1
  4895. : existing !== callback) {
  4896. on[event] = [callback].concat(existing);
  4897. }
  4898. }
  4899. else {
  4900. on[event] = callback;
  4901. }
  4902. }
  4903. let warn$3 = noop;
  4904. let tip = noop;
  4905. let generateComponentTrace; // work around flow check
  4906. let formatComponentName;
  4907. if (process.env.NODE_ENV !== 'production') {
  4908. const hasConsole = typeof console !== 'undefined';
  4909. const classifyRE = /(?:^|[-_])(\w)/g;
  4910. const classify = str => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
  4911. warn$3 = (msg, vm = currentInstance) => {
  4912. const trace = vm ? generateComponentTrace(vm) : '';
  4913. if (hasConsole && !config.silent) {
  4914. console.error(`[Vue warn]: ${msg}${trace}`);
  4915. }
  4916. };
  4917. tip = (msg, vm) => {
  4918. if (hasConsole && !config.silent) {
  4919. console.warn(`[Vue tip]: ${msg}` + (vm ? generateComponentTrace(vm) : ''));
  4920. }
  4921. };
  4922. formatComponentName = (vm, includeFile) => {
  4923. if (vm.$root === vm) {
  4924. return '<Root>';
  4925. }
  4926. const options = isFunction(vm) && vm.cid != null
  4927. ? vm.options
  4928. : vm._isVue
  4929. ? vm.$options || vm.constructor.options
  4930. : vm;
  4931. let name = getComponentName(options);
  4932. const file = options.__file;
  4933. if (!name && file) {
  4934. const match = file.match(/([^/\\]+)\.vue$/);
  4935. name = match && match[1];
  4936. }
  4937. return ((name ? `<${classify(name)}>` : `<Anonymous>`) +
  4938. (file && includeFile !== false ? ` at ${file}` : ''));
  4939. };
  4940. const repeat = (str, n) => {
  4941. let res = '';
  4942. while (n) {
  4943. if (n % 2 === 1)
  4944. res += str;
  4945. if (n > 1)
  4946. str += str;
  4947. n >>= 1;
  4948. }
  4949. return res;
  4950. };
  4951. generateComponentTrace = (vm) => {
  4952. if (vm._isVue && vm.$parent) {
  4953. const tree = [];
  4954. let currentRecursiveSequence = 0;
  4955. while (vm) {
  4956. if (tree.length > 0) {
  4957. const last = tree[tree.length - 1];
  4958. if (last.constructor === vm.constructor) {
  4959. currentRecursiveSequence++;
  4960. vm = vm.$parent;
  4961. continue;
  4962. }
  4963. else if (currentRecursiveSequence > 0) {
  4964. tree[tree.length - 1] = [last, currentRecursiveSequence];
  4965. currentRecursiveSequence = 0;
  4966. }
  4967. }
  4968. tree.push(vm);
  4969. vm = vm.$parent;
  4970. }
  4971. return ('\n\nfound in\n\n' +
  4972. tree
  4973. .map((vm, i) => `${i === 0 ? '---> ' : repeat(' ', 5 + i * 2)}${isArray(vm)
  4974. ? `${formatComponentName(vm[0])}... (${vm[1]} recursive calls)`
  4975. : formatComponentName(vm)}`)
  4976. .join('\n'));
  4977. }
  4978. else {
  4979. return `\n\n(found in ${formatComponentName(vm)})`;
  4980. }
  4981. };
  4982. }
  4983. /**
  4984. * Option overwriting strategies are functions that handle
  4985. * how to merge a parent option value and a child option
  4986. * value into the final value.
  4987. */
  4988. const strats = config.optionMergeStrategies;
  4989. /**
  4990. * Options with restrictions
  4991. */
  4992. if (process.env.NODE_ENV !== 'production') {
  4993. strats.el = strats.propsData = function (parent, child, vm, key) {
  4994. if (!vm) {
  4995. warn$3(`option "${key}" can only be used during instance ` +
  4996. 'creation with the `new` keyword.');
  4997. }
  4998. return defaultStrat(parent, child);
  4999. };
  5000. }
  5001. /**
  5002. * Helper that recursively merges two data objects together.
  5003. */
  5004. function mergeData(to, from, recursive = true) {
  5005. if (!from)
  5006. return to;
  5007. let key, toVal, fromVal;
  5008. const keys = hasSymbol
  5009. ? Reflect.ownKeys(from)
  5010. : Object.keys(from);
  5011. for (let i = 0; i < keys.length; i++) {
  5012. key = keys[i];
  5013. // in case the object is already observed...
  5014. if (key === '__ob__')
  5015. continue;
  5016. toVal = to[key];
  5017. fromVal = from[key];
  5018. if (!recursive || !hasOwn(to, key)) {
  5019. set(to, key, fromVal);
  5020. }
  5021. else if (toVal !== fromVal &&
  5022. isPlainObject(toVal) &&
  5023. isPlainObject(fromVal)) {
  5024. mergeData(toVal, fromVal);
  5025. }
  5026. }
  5027. return to;
  5028. }
  5029. /**
  5030. * Data
  5031. */
  5032. function mergeDataOrFn(parentVal, childVal, vm) {
  5033. if (!vm) {
  5034. // in a Vue.extend merge, both should be functions
  5035. if (!childVal) {
  5036. return parentVal;
  5037. }
  5038. if (!parentVal) {
  5039. return childVal;
  5040. }
  5041. // when parentVal & childVal are both present,
  5042. // we need to return a function that returns the
  5043. // merged result of both functions... no need to
  5044. // check if parentVal is a function here because
  5045. // it has to be a function to pass previous merges.
  5046. return function mergedDataFn() {
  5047. return mergeData(isFunction(childVal) ? childVal.call(this, this) : childVal, isFunction(parentVal) ? parentVal.call(this, this) : parentVal);
  5048. };
  5049. }
  5050. else {
  5051. return function mergedInstanceDataFn() {
  5052. // instance merge
  5053. const instanceData = isFunction(childVal)
  5054. ? childVal.call(vm, vm)
  5055. : childVal;
  5056. const defaultData = isFunction(parentVal)
  5057. ? parentVal.call(vm, vm)
  5058. : parentVal;
  5059. if (instanceData) {
  5060. return mergeData(instanceData, defaultData);
  5061. }
  5062. else {
  5063. return defaultData;
  5064. }
  5065. };
  5066. }
  5067. }
  5068. strats.data = function (parentVal, childVal, vm) {
  5069. if (!vm) {
  5070. if (childVal && typeof childVal !== 'function') {
  5071. process.env.NODE_ENV !== 'production' &&
  5072. warn$3('The "data" option should be a function ' +
  5073. 'that returns a per-instance value in component ' +
  5074. 'definitions.', vm);
  5075. return parentVal;
  5076. }
  5077. return mergeDataOrFn(parentVal, childVal);
  5078. }
  5079. return mergeDataOrFn(parentVal, childVal, vm);
  5080. };
  5081. /**
  5082. * Hooks and props are merged as arrays.
  5083. */
  5084. function mergeLifecycleHook(parentVal, childVal) {
  5085. const res = childVal
  5086. ? parentVal
  5087. ? parentVal.concat(childVal)
  5088. : isArray(childVal)
  5089. ? childVal
  5090. : [childVal]
  5091. : parentVal;
  5092. return res ? dedupeHooks(res) : res;
  5093. }
  5094. function dedupeHooks(hooks) {
  5095. const res = [];
  5096. for (let i = 0; i < hooks.length; i++) {
  5097. if (res.indexOf(hooks[i]) === -1) {
  5098. res.push(hooks[i]);
  5099. }
  5100. }
  5101. return res;
  5102. }
  5103. LIFECYCLE_HOOKS.forEach(hook => {
  5104. strats[hook] = mergeLifecycleHook;
  5105. });
  5106. /**
  5107. * Assets
  5108. *
  5109. * When a vm is present (instance creation), we need to do
  5110. * a three-way merge between constructor options, instance
  5111. * options and parent options.
  5112. */
  5113. function mergeAssets(parentVal, childVal, vm, key) {
  5114. const res = Object.create(parentVal || null);
  5115. if (childVal) {
  5116. process.env.NODE_ENV !== 'production' && assertObjectType(key, childVal, vm);
  5117. return extend(res, childVal);
  5118. }
  5119. else {
  5120. return res;
  5121. }
  5122. }
  5123. ASSET_TYPES.forEach(function (type) {
  5124. strats[type + 's'] = mergeAssets;
  5125. });
  5126. /**
  5127. * Watchers.
  5128. *
  5129. * Watchers hashes should not overwrite one
  5130. * another, so we merge them as arrays.
  5131. */
  5132. strats.watch = function (parentVal, childVal, vm, key) {
  5133. // work around Firefox's Object.prototype.watch...
  5134. //@ts-expect-error work around
  5135. if (parentVal === nativeWatch)
  5136. parentVal = undefined;
  5137. //@ts-expect-error work around
  5138. if (childVal === nativeWatch)
  5139. childVal = undefined;
  5140. /* istanbul ignore if */
  5141. if (!childVal)
  5142. return Object.create(parentVal || null);
  5143. if (process.env.NODE_ENV !== 'production') {
  5144. assertObjectType(key, childVal, vm);
  5145. }
  5146. if (!parentVal)
  5147. return childVal;
  5148. const ret = {};
  5149. extend(ret, parentVal);
  5150. for (const key in childVal) {
  5151. let parent = ret[key];
  5152. const child = childVal[key];
  5153. if (parent && !isArray(parent)) {
  5154. parent = [parent];
  5155. }
  5156. ret[key] = parent ? parent.concat(child) : isArray(child) ? child : [child];
  5157. }
  5158. return ret;
  5159. };
  5160. /**
  5161. * Other object hashes.
  5162. */
  5163. strats.props =
  5164. strats.methods =
  5165. strats.inject =
  5166. strats.computed =
  5167. function (parentVal, childVal, vm, key) {
  5168. if (childVal && process.env.NODE_ENV !== 'production') {
  5169. assertObjectType(key, childVal, vm);
  5170. }
  5171. if (!parentVal)
  5172. return childVal;
  5173. const ret = Object.create(null);
  5174. extend(ret, parentVal);
  5175. if (childVal)
  5176. extend(ret, childVal);
  5177. return ret;
  5178. };
  5179. strats.provide = function (parentVal, childVal) {
  5180. if (!parentVal)
  5181. return childVal;
  5182. return function () {
  5183. const ret = Object.create(null);
  5184. mergeData(ret, isFunction(parentVal) ? parentVal.call(this) : parentVal);
  5185. if (childVal) {
  5186. mergeData(ret, isFunction(childVal) ? childVal.call(this) : childVal, false // non-recursive
  5187. );
  5188. }
  5189. return ret;
  5190. };
  5191. };
  5192. /**
  5193. * Default strategy.
  5194. */
  5195. const defaultStrat = function (parentVal, childVal) {
  5196. return childVal === undefined ? parentVal : childVal;
  5197. };
  5198. /**
  5199. * Validate component names
  5200. */
  5201. function checkComponents(options) {
  5202. for (const key in options.components) {
  5203. validateComponentName(key);
  5204. }
  5205. }
  5206. function validateComponentName(name) {
  5207. if (!new RegExp(`^[a-zA-Z][\\-\\.0-9_${unicodeRegExp.source}]*$`).test(name)) {
  5208. warn$3('Invalid component name: "' +
  5209. name +
  5210. '". Component names ' +
  5211. 'should conform to valid custom element name in html5 specification.');
  5212. }
  5213. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  5214. warn$3('Do not use built-in or reserved HTML elements as component ' +
  5215. 'id: ' +
  5216. name);
  5217. }
  5218. }
  5219. /**
  5220. * Ensure all props option syntax are normalized into the
  5221. * Object-based format.
  5222. */
  5223. function normalizeProps(options, vm) {
  5224. const props = options.props;
  5225. if (!props)
  5226. return;
  5227. const res = {};
  5228. let i, val, name;
  5229. if (isArray(props)) {
  5230. i = props.length;
  5231. while (i--) {
  5232. val = props[i];
  5233. if (typeof val === 'string') {
  5234. name = camelize(val);
  5235. res[name] = { type: null };
  5236. }
  5237. else if (process.env.NODE_ENV !== 'production') {
  5238. warn$3('props must be strings when using array syntax.');
  5239. }
  5240. }
  5241. }
  5242. else if (isPlainObject(props)) {
  5243. for (const key in props) {
  5244. val = props[key];
  5245. name = camelize(key);
  5246. res[name] = isPlainObject(val) ? val : { type: val };
  5247. }
  5248. }
  5249. else if (process.env.NODE_ENV !== 'production') {
  5250. warn$3(`Invalid value for option "props": expected an Array or an Object, ` +
  5251. `but got ${toRawType(props)}.`, vm);
  5252. }
  5253. options.props = res;
  5254. }
  5255. /**
  5256. * Normalize all injections into Object-based format
  5257. */
  5258. function normalizeInject(options, vm) {
  5259. const inject = options.inject;
  5260. if (!inject)
  5261. return;
  5262. const normalized = (options.inject = {});
  5263. if (isArray(inject)) {
  5264. for (let i = 0; i < inject.length; i++) {
  5265. normalized[inject[i]] = { from: inject[i] };
  5266. }
  5267. }
  5268. else if (isPlainObject(inject)) {
  5269. for (const key in inject) {
  5270. const val = inject[key];
  5271. normalized[key] = isPlainObject(val)
  5272. ? extend({ from: key }, val)
  5273. : { from: val };
  5274. }
  5275. }
  5276. else if (process.env.NODE_ENV !== 'production') {
  5277. warn$3(`Invalid value for option "inject": expected an Array or an Object, ` +
  5278. `but got ${toRawType(inject)}.`, vm);
  5279. }
  5280. }
  5281. /**
  5282. * Normalize raw function directives into object format.
  5283. */
  5284. function normalizeDirectives(options) {
  5285. const dirs = options.directives;
  5286. if (dirs) {
  5287. for (const key in dirs) {
  5288. const def = dirs[key];
  5289. if (isFunction(def)) {
  5290. dirs[key] = { bind: def, update: def };
  5291. }
  5292. }
  5293. }
  5294. }
  5295. function assertObjectType(name, value, vm) {
  5296. if (!isPlainObject(value)) {
  5297. warn$3(`Invalid value for option "${name}": expected an Object, ` +
  5298. `but got ${toRawType(value)}.`, vm);
  5299. }
  5300. }
  5301. /**
  5302. * Merge two option objects into a new one.
  5303. * Core utility used in both instantiation and inheritance.
  5304. */
  5305. function mergeOptions(parent, child, vm) {
  5306. if (process.env.NODE_ENV !== 'production') {
  5307. checkComponents(child);
  5308. }
  5309. if (isFunction(child)) {
  5310. // @ts-expect-error
  5311. child = child.options;
  5312. }
  5313. normalizeProps(child, vm);
  5314. normalizeInject(child, vm);
  5315. normalizeDirectives(child);
  5316. // Apply extends and mixins on the child options,
  5317. // but only if it is a raw options object that isn't
  5318. // the result of another mergeOptions call.
  5319. // Only merged options has the _base property.
  5320. if (!child._base) {
  5321. if (child.extends) {
  5322. parent = mergeOptions(parent, child.extends, vm);
  5323. }
  5324. if (child.mixins) {
  5325. for (let i = 0, l = child.mixins.length; i < l; i++) {
  5326. parent = mergeOptions(parent, child.mixins[i], vm);
  5327. }
  5328. }
  5329. }
  5330. const options = {};
  5331. let key;
  5332. for (key in parent) {
  5333. mergeField(key);
  5334. }
  5335. for (key in child) {
  5336. if (!hasOwn(parent, key)) {
  5337. mergeField(key);
  5338. }
  5339. }
  5340. function mergeField(key) {
  5341. const strat = strats[key] || defaultStrat;
  5342. options[key] = strat(parent[key], child[key], vm, key);
  5343. }
  5344. return options;
  5345. }
  5346. /**
  5347. * Resolve an asset.
  5348. * This function is used because child instances need access
  5349. * to assets defined in its ancestor chain.
  5350. */
  5351. function resolveAsset(options, type, id, warnMissing) {
  5352. /* istanbul ignore if */
  5353. if (typeof id !== 'string') {
  5354. return;
  5355. }
  5356. const assets = options[type];
  5357. // check local registration variations first
  5358. if (hasOwn(assets, id))
  5359. return assets[id];
  5360. const camelizedId = camelize(id);
  5361. if (hasOwn(assets, camelizedId))
  5362. return assets[camelizedId];
  5363. const PascalCaseId = capitalize(camelizedId);
  5364. if (hasOwn(assets, PascalCaseId))
  5365. return assets[PascalCaseId];
  5366. // fallback to prototype chain
  5367. const res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  5368. if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
  5369. warn$3('Failed to resolve ' + type.slice(0, -1) + ': ' + id);
  5370. }
  5371. return res;
  5372. }
  5373. function validateProp(key, propOptions, propsData, vm) {
  5374. const prop = propOptions[key];
  5375. const absent = !hasOwn(propsData, key);
  5376. let value = propsData[key];
  5377. // boolean casting
  5378. const booleanIndex = getTypeIndex(Boolean, prop.type);
  5379. if (booleanIndex > -1) {
  5380. if (absent && !hasOwn(prop, 'default')) {
  5381. value = false;
  5382. }
  5383. else if (value === '' || value === hyphenate(key)) {
  5384. // only cast empty string / same name to boolean if
  5385. // boolean has higher priority
  5386. const stringIndex = getTypeIndex(String, prop.type);
  5387. if (stringIndex < 0 || booleanIndex < stringIndex) {
  5388. value = true;
  5389. }
  5390. }
  5391. }
  5392. // check default value
  5393. if (value === undefined) {
  5394. value = getPropDefaultValue(vm, prop, key);
  5395. // since the default value is a fresh copy,
  5396. // make sure to observe it.
  5397. const prevShouldObserve = shouldObserve;
  5398. toggleObserving(true);
  5399. observe(value);
  5400. toggleObserving(prevShouldObserve);
  5401. }
  5402. if (process.env.NODE_ENV !== 'production') {
  5403. assertProp(prop, key, value, vm, absent);
  5404. }
  5405. return value;
  5406. }
  5407. /**
  5408. * Get the default value of a prop.
  5409. */
  5410. function getPropDefaultValue(vm, prop, key) {
  5411. // no default, return undefined
  5412. if (!hasOwn(prop, 'default')) {
  5413. return undefined;
  5414. }
  5415. const def = prop.default;
  5416. // warn against non-factory defaults for Object & Array
  5417. if (process.env.NODE_ENV !== 'production' && isObject$1(def)) {
  5418. warn$3('Invalid default value for prop "' +
  5419. key +
  5420. '": ' +
  5421. 'Props with type Object/Array must use a factory function ' +
  5422. 'to return the default value.', vm);
  5423. }
  5424. // the raw prop value was also undefined from previous render,
  5425. // return previous default value to avoid unnecessary watcher trigger
  5426. if (vm &&
  5427. vm.$options.propsData &&
  5428. vm.$options.propsData[key] === undefined &&
  5429. vm._props[key] !== undefined) {
  5430. return vm._props[key];
  5431. }
  5432. // call factory function for non-Function types
  5433. // a value is Function if its prototype is function even across different execution context
  5434. return isFunction(def) && getType(prop.type) !== 'Function'
  5435. ? def.call(vm)
  5436. : def;
  5437. }
  5438. /**
  5439. * Assert whether a prop is valid.
  5440. */
  5441. function assertProp(prop, name, value, vm, absent) {
  5442. if (prop.required && absent) {
  5443. warn$3('Missing required prop: "' + name + '"', vm);
  5444. return;
  5445. }
  5446. if (value == null && !prop.required) {
  5447. return;
  5448. }
  5449. let type = prop.type;
  5450. let valid = !type || type === true;
  5451. const expectedTypes = [];
  5452. if (type) {
  5453. if (!isArray(type)) {
  5454. type = [type];
  5455. }
  5456. for (let i = 0; i < type.length && !valid; i++) {
  5457. const assertedType = assertType(value, type[i], vm);
  5458. expectedTypes.push(assertedType.expectedType || '');
  5459. valid = assertedType.valid;
  5460. }
  5461. }
  5462. const haveExpectedTypes = expectedTypes.some(t => t);
  5463. if (!valid && haveExpectedTypes) {
  5464. warn$3(getInvalidTypeMessage(name, value, expectedTypes), vm);
  5465. return;
  5466. }
  5467. const validator = prop.validator;
  5468. if (validator) {
  5469. if (!validator(value)) {
  5470. warn$3('Invalid prop: custom validator check failed for prop "' + name + '".', vm);
  5471. }
  5472. }
  5473. }
  5474. const simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/;
  5475. function assertType(value, type, vm) {
  5476. let valid;
  5477. const expectedType = getType(type);
  5478. if (simpleCheckRE.test(expectedType)) {
  5479. const t = typeof value;
  5480. valid = t === expectedType.toLowerCase();
  5481. // for primitive wrapper objects
  5482. if (!valid && t === 'object') {
  5483. valid = value instanceof type;
  5484. }
  5485. }
  5486. else if (expectedType === 'Object') {
  5487. valid = isPlainObject(value);
  5488. }
  5489. else if (expectedType === 'Array') {
  5490. valid = isArray(value);
  5491. }
  5492. else {
  5493. try {
  5494. valid = value instanceof type;
  5495. }
  5496. catch (e) {
  5497. warn$3('Invalid prop type: "' + String(type) + '" is not a constructor', vm);
  5498. valid = false;
  5499. }
  5500. }
  5501. return {
  5502. valid,
  5503. expectedType
  5504. };
  5505. }
  5506. const functionTypeCheckRE = /^\s*function (\w+)/;
  5507. /**
  5508. * Use function string name to check built-in types,
  5509. * because a simple equality check will fail when running
  5510. * across different vms / iframes.
  5511. */
  5512. function getType(fn) {
  5513. const match = fn && fn.toString().match(functionTypeCheckRE);
  5514. return match ? match[1] : '';
  5515. }
  5516. function isSameType(a, b) {
  5517. return getType(a) === getType(b);
  5518. }
  5519. function getTypeIndex(type, expectedTypes) {
  5520. if (!isArray(expectedTypes)) {
  5521. return isSameType(expectedTypes, type) ? 0 : -1;
  5522. }
  5523. for (let i = 0, len = expectedTypes.length; i < len; i++) {
  5524. if (isSameType(expectedTypes[i], type)) {
  5525. return i;
  5526. }
  5527. }
  5528. return -1;
  5529. }
  5530. function getInvalidTypeMessage(name, value, expectedTypes) {
  5531. let message = `Invalid prop: type check failed for prop "${name}".` +
  5532. ` Expected ${expectedTypes.map(capitalize).join(', ')}`;
  5533. const expectedType = expectedTypes[0];
  5534. const receivedType = toRawType(value);
  5535. // check if we need to specify expected value
  5536. if (expectedTypes.length === 1 &&
  5537. isExplicable(expectedType) &&
  5538. isExplicable(typeof value) &&
  5539. !isBoolean(expectedType, receivedType)) {
  5540. message += ` with value ${styleValue(value, expectedType)}`;
  5541. }
  5542. message += `, got ${receivedType} `;
  5543. // check if we need to specify received value
  5544. if (isExplicable(receivedType)) {
  5545. message += `with value ${styleValue(value, receivedType)}.`;
  5546. }
  5547. return message;
  5548. }
  5549. function styleValue(value, type) {
  5550. if (type === 'String') {
  5551. return `"${value}"`;
  5552. }
  5553. else if (type === 'Number') {
  5554. return `${Number(value)}`;
  5555. }
  5556. else {
  5557. return `${value}`;
  5558. }
  5559. }
  5560. const EXPLICABLE_TYPES = ['string', 'number', 'boolean'];
  5561. function isExplicable(value) {
  5562. return EXPLICABLE_TYPES.some(elem => value.toLowerCase() === elem);
  5563. }
  5564. function isBoolean(...args) {
  5565. return args.some(elem => elem.toLowerCase() === 'boolean');
  5566. }
  5567. // these are reserved for web because they are directly compiled away
  5568. // during template compilation
  5569. makeMap('style,class');
  5570. // attributes that should be using props for binding
  5571. const acceptValue = makeMap('input,textarea,option,select,progress');
  5572. const mustUseProp = (tag, type, attr) => {
  5573. return ((attr === 'value' && acceptValue(tag) && type !== 'button') ||
  5574. (attr === 'selected' && tag === 'option') ||
  5575. (attr === 'checked' && tag === 'input') ||
  5576. (attr === 'muted' && tag === 'video'));
  5577. };
  5578. const isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  5579. makeMap('events,caret,typing,plaintext-only');
  5580. const isBooleanAttr = makeMap('allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  5581. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  5582. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  5583. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  5584. 'required,reversed,scoped,seamless,selected,sortable,' +
  5585. 'truespeed,typemustmatch,visible');
  5586. const isHTMLTag = makeMap('html,body,base,head,link,meta,style,title,' +
  5587. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  5588. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  5589. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  5590. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  5591. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  5592. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  5593. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  5594. 'output,progress,select,textarea,' +
  5595. 'details,dialog,menu,menuitem,summary,' +
  5596. 'content,element,shadow,template,blockquote,iframe,tfoot');
  5597. // this map is intentionally selective, only covering SVG elements that may
  5598. // contain child elements.
  5599. const isSVG = makeMap('svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  5600. 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  5601. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', true);
  5602. const isPreTag = (tag) => tag === 'pre';
  5603. const isReservedTag = (tag) => {
  5604. return isHTMLTag(tag) || isSVG(tag);
  5605. };
  5606. function getTagNamespace(tag) {
  5607. if (isSVG(tag)) {
  5608. return 'svg';
  5609. }
  5610. // basic support for MathML
  5611. // note it doesn't support other MathML elements being component roots
  5612. if (tag === 'math') {
  5613. return 'math';
  5614. }
  5615. }
  5616. makeMap('text,number,password,search,email,tel,url');
  5617. const validDivisionCharRE = /[\w).+\-_$\]]/;
  5618. function parseFilters(exp) {
  5619. let inSingle = false;
  5620. let inDouble = false;
  5621. let inTemplateString = false;
  5622. let inRegex = false;
  5623. let curly = 0;
  5624. let square = 0;
  5625. let paren = 0;
  5626. let lastFilterIndex = 0;
  5627. let c, prev, i, expression, filters;
  5628. for (i = 0; i < exp.length; i++) {
  5629. prev = c;
  5630. c = exp.charCodeAt(i);
  5631. if (inSingle) {
  5632. if (c === 0x27 && prev !== 0x5c)
  5633. inSingle = false;
  5634. }
  5635. else if (inDouble) {
  5636. if (c === 0x22 && prev !== 0x5c)
  5637. inDouble = false;
  5638. }
  5639. else if (inTemplateString) {
  5640. if (c === 0x60 && prev !== 0x5c)
  5641. inTemplateString = false;
  5642. }
  5643. else if (inRegex) {
  5644. if (c === 0x2f && prev !== 0x5c)
  5645. inRegex = false;
  5646. }
  5647. else if (c === 0x7c && // pipe
  5648. exp.charCodeAt(i + 1) !== 0x7c &&
  5649. exp.charCodeAt(i - 1) !== 0x7c &&
  5650. !curly &&
  5651. !square &&
  5652. !paren) {
  5653. if (expression === undefined) {
  5654. // first filter, end of expression
  5655. lastFilterIndex = i + 1;
  5656. expression = exp.slice(0, i).trim();
  5657. }
  5658. else {
  5659. pushFilter();
  5660. }
  5661. }
  5662. else {
  5663. switch (c) {
  5664. case 0x22:
  5665. inDouble = true;
  5666. break; // "
  5667. case 0x27:
  5668. inSingle = true;
  5669. break; // '
  5670. case 0x60:
  5671. inTemplateString = true;
  5672. break; // `
  5673. case 0x28:
  5674. paren++;
  5675. break; // (
  5676. case 0x29:
  5677. paren--;
  5678. break; // )
  5679. case 0x5b:
  5680. square++;
  5681. break; // [
  5682. case 0x5d:
  5683. square--;
  5684. break; // ]
  5685. case 0x7b:
  5686. curly++;
  5687. break; // {
  5688. case 0x7d:
  5689. curly--;
  5690. break; // }
  5691. }
  5692. if (c === 0x2f) {
  5693. // /
  5694. let j = i - 1;
  5695. let p;
  5696. // find first non-whitespace prev char
  5697. for (; j >= 0; j--) {
  5698. p = exp.charAt(j);
  5699. if (p !== ' ')
  5700. break;
  5701. }
  5702. if (!p || !validDivisionCharRE.test(p)) {
  5703. inRegex = true;
  5704. }
  5705. }
  5706. }
  5707. }
  5708. if (expression === undefined) {
  5709. expression = exp.slice(0, i).trim();
  5710. }
  5711. else if (lastFilterIndex !== 0) {
  5712. pushFilter();
  5713. }
  5714. function pushFilter() {
  5715. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  5716. lastFilterIndex = i + 1;
  5717. }
  5718. if (filters) {
  5719. for (i = 0; i < filters.length; i++) {
  5720. expression = wrapFilter(expression, filters[i]);
  5721. }
  5722. }
  5723. return expression;
  5724. }
  5725. function wrapFilter(exp, filter) {
  5726. const i = filter.indexOf('(');
  5727. if (i < 0) {
  5728. // _f: resolveFilter
  5729. return `_f("${filter}")(${exp})`;
  5730. }
  5731. else {
  5732. const name = filter.slice(0, i);
  5733. const args = filter.slice(i + 1);
  5734. return `_f("${name}")(${exp}${args !== ')' ? ',' + args : args}`;
  5735. }
  5736. }
  5737. const defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  5738. const regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  5739. const buildRegex = cached(delimiters => {
  5740. const open = delimiters[0].replace(regexEscapeRE, '\\$&');
  5741. const close = delimiters[1].replace(regexEscapeRE, '\\$&');
  5742. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g');
  5743. });
  5744. function parseText(text, delimiters) {
  5745. //@ts-expect-error
  5746. const tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  5747. if (!tagRE.test(text)) {
  5748. return;
  5749. }
  5750. const tokens = [];
  5751. const rawTokens = [];
  5752. let lastIndex = (tagRE.lastIndex = 0);
  5753. let match, index, tokenValue;
  5754. while ((match = tagRE.exec(text))) {
  5755. index = match.index;
  5756. // push text token
  5757. if (index > lastIndex) {
  5758. rawTokens.push((tokenValue = text.slice(lastIndex, index)));
  5759. tokens.push(JSON.stringify(tokenValue));
  5760. }
  5761. // tag token
  5762. const exp = parseFilters(match[1].trim());
  5763. tokens.push(`_s(${exp})`);
  5764. rawTokens.push({ '@binding': exp });
  5765. lastIndex = index + match[0].length;
  5766. }
  5767. if (lastIndex < text.length) {
  5768. rawTokens.push((tokenValue = text.slice(lastIndex)));
  5769. tokens.push(JSON.stringify(tokenValue));
  5770. }
  5771. return {
  5772. expression: tokens.join('+'),
  5773. tokens: rawTokens
  5774. };
  5775. }
  5776. /* eslint-disable no-unused-vars */
  5777. function baseWarn(msg, range) {
  5778. console.error(`[Vue compiler]: ${msg}`);
  5779. }
  5780. /* eslint-enable no-unused-vars */
  5781. function pluckModuleFunction(modules, key) {
  5782. return modules ? modules.map(m => m[key]).filter(_ => _) : [];
  5783. }
  5784. function addProp(el, name, value, range, dynamic) {
  5785. (el.props || (el.props = [])).push(rangeSetItem({ name, value, dynamic }, range));
  5786. el.plain = false;
  5787. }
  5788. function addAttr(el, name, value, range, dynamic) {
  5789. const attrs = dynamic
  5790. ? el.dynamicAttrs || (el.dynamicAttrs = [])
  5791. : el.attrs || (el.attrs = []);
  5792. attrs.push(rangeSetItem({ name, value, dynamic }, range));
  5793. el.plain = false;
  5794. }
  5795. // add a raw attr (use this in preTransforms)
  5796. function addRawAttr(el, name, value, range) {
  5797. el.attrsMap[name] = value;
  5798. el.attrsList.push(rangeSetItem({ name, value }, range));
  5799. }
  5800. function addDirective(el, name, rawName, value, arg, isDynamicArg, modifiers, range) {
  5801. (el.directives || (el.directives = [])).push(rangeSetItem({
  5802. name,
  5803. rawName,
  5804. value,
  5805. arg,
  5806. isDynamicArg,
  5807. modifiers
  5808. }, range));
  5809. el.plain = false;
  5810. }
  5811. function prependModifierMarker(symbol, name, dynamic) {
  5812. return dynamic ? `_p(${name},"${symbol}")` : symbol + name; // mark the event as captured
  5813. }
  5814. function addHandler(el, name, value, modifiers, important, warn, range, dynamic) {
  5815. modifiers = modifiers || emptyObject;
  5816. // warn prevent and passive modifier
  5817. /* istanbul ignore if */
  5818. if (process.env.NODE_ENV !== 'production' && warn && modifiers.prevent && modifiers.passive) {
  5819. warn("passive and prevent can't be used together. " +
  5820. "Passive handler can't prevent default event.", range);
  5821. }
  5822. // normalize click.right and click.middle since they don't actually fire
  5823. // this is technically browser-specific, but at least for now browsers are
  5824. // the only target envs that have right/middle clicks.
  5825. if (modifiers.right) {
  5826. if (dynamic) {
  5827. name = `(${name})==='click'?'contextmenu':(${name})`;
  5828. }
  5829. else if (name === 'click') {
  5830. name = 'contextmenu';
  5831. delete modifiers.right;
  5832. }
  5833. }
  5834. else if (modifiers.middle) {
  5835. if (dynamic) {
  5836. name = `(${name})==='click'?'mouseup':(${name})`;
  5837. }
  5838. else if (name === 'click') {
  5839. name = 'mouseup';
  5840. }
  5841. }
  5842. // check capture modifier
  5843. if (modifiers.capture) {
  5844. delete modifiers.capture;
  5845. name = prependModifierMarker('!', name, dynamic);
  5846. }
  5847. if (modifiers.once) {
  5848. delete modifiers.once;
  5849. name = prependModifierMarker('~', name, dynamic);
  5850. }
  5851. /* istanbul ignore if */
  5852. if (modifiers.passive) {
  5853. delete modifiers.passive;
  5854. name = prependModifierMarker('&', name, dynamic);
  5855. }
  5856. let events;
  5857. if (modifiers.native) {
  5858. delete modifiers.native;
  5859. events = el.nativeEvents || (el.nativeEvents = {});
  5860. }
  5861. else {
  5862. events = el.events || (el.events = {});
  5863. }
  5864. const newHandler = rangeSetItem({ value: value.trim(), dynamic }, range);
  5865. if (modifiers !== emptyObject) {
  5866. newHandler.modifiers = modifiers;
  5867. }
  5868. const handlers = events[name];
  5869. /* istanbul ignore if */
  5870. if (Array.isArray(handlers)) {
  5871. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  5872. }
  5873. else if (handlers) {
  5874. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  5875. }
  5876. else {
  5877. events[name] = newHandler;
  5878. }
  5879. el.plain = false;
  5880. }
  5881. function getRawBindingAttr(el, name) {
  5882. return (el.rawAttrsMap[':' + name] ||
  5883. el.rawAttrsMap['v-bind:' + name] ||
  5884. el.rawAttrsMap[name]);
  5885. }
  5886. function getBindingAttr(el, name, getStatic) {
  5887. const dynamicValue = getAndRemoveAttr(el, ':' + name) || getAndRemoveAttr(el, 'v-bind:' + name);
  5888. if (dynamicValue != null) {
  5889. return parseFilters(dynamicValue);
  5890. }
  5891. else if (getStatic !== false) {
  5892. const staticValue = getAndRemoveAttr(el, name);
  5893. if (staticValue != null) {
  5894. return JSON.stringify(staticValue);
  5895. }
  5896. }
  5897. }
  5898. // note: this only removes the attr from the Array (attrsList) so that it
  5899. // doesn't get processed by processAttrs.
  5900. // By default it does NOT remove it from the map (attrsMap) because the map is
  5901. // needed during codegen.
  5902. function getAndRemoveAttr(el, name, removeFromMap) {
  5903. let val;
  5904. if ((val = el.attrsMap[name]) != null) {
  5905. const list = el.attrsList;
  5906. for (let i = 0, l = list.length; i < l; i++) {
  5907. if (list[i].name === name) {
  5908. list.splice(i, 1);
  5909. break;
  5910. }
  5911. }
  5912. }
  5913. if (removeFromMap) {
  5914. delete el.attrsMap[name];
  5915. }
  5916. return val;
  5917. }
  5918. function getAndRemoveAttrByRegex(el, name) {
  5919. const list = el.attrsList;
  5920. for (let i = 0, l = list.length; i < l; i++) {
  5921. const attr = list[i];
  5922. if (name.test(attr.name)) {
  5923. list.splice(i, 1);
  5924. return attr;
  5925. }
  5926. }
  5927. }
  5928. function rangeSetItem(item, range) {
  5929. if (range) {
  5930. if (range.start != null) {
  5931. item.start = range.start;
  5932. }
  5933. if (range.end != null) {
  5934. item.end = range.end;
  5935. }
  5936. }
  5937. return item;
  5938. }
  5939. function transformNode$1(el, options) {
  5940. const warn = options.warn || baseWarn;
  5941. const staticClass = getAndRemoveAttr(el, 'class');
  5942. if (process.env.NODE_ENV !== 'production' && staticClass) {
  5943. const res = parseText(staticClass, options.delimiters);
  5944. if (res) {
  5945. warn(`class="${staticClass}": ` +
  5946. 'Interpolation inside attributes has been removed. ' +
  5947. 'Use v-bind or the colon shorthand instead. For example, ' +
  5948. 'instead of <div class="{{ val }}">, use <div :class="val">.', el.rawAttrsMap['class']);
  5949. }
  5950. }
  5951. if (staticClass) {
  5952. el.staticClass = JSON.stringify(staticClass.replace(/\s+/g, ' ').trim());
  5953. }
  5954. const classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  5955. if (classBinding) {
  5956. el.classBinding = classBinding;
  5957. }
  5958. }
  5959. function genData$2(el) {
  5960. let data = '';
  5961. if (el.staticClass) {
  5962. data += `staticClass:${el.staticClass},`;
  5963. }
  5964. if (el.classBinding) {
  5965. data += `class:${el.classBinding},`;
  5966. }
  5967. return data;
  5968. }
  5969. var klass = {
  5970. staticKeys: ['staticClass'],
  5971. transformNode: transformNode$1,
  5972. genData: genData$2
  5973. };
  5974. const parseStyleText = cached(function (cssText) {
  5975. const res = {};
  5976. const listDelimiter = /;(?![^(]*\))/g;
  5977. const propertyDelimiter = /:(.+)/;
  5978. cssText.split(listDelimiter).forEach(function (item) {
  5979. if (item) {
  5980. const tmp = item.split(propertyDelimiter);
  5981. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  5982. }
  5983. });
  5984. return res;
  5985. });
  5986. function transformNode(el, options) {
  5987. const warn = options.warn || baseWarn;
  5988. const staticStyle = getAndRemoveAttr(el, 'style');
  5989. if (staticStyle) {
  5990. /* istanbul ignore if */
  5991. if (process.env.NODE_ENV !== 'production') {
  5992. const res = parseText(staticStyle, options.delimiters);
  5993. if (res) {
  5994. warn(`style="${staticStyle}": ` +
  5995. 'Interpolation inside attributes has been removed. ' +
  5996. 'Use v-bind or the colon shorthand instead. For example, ' +
  5997. 'instead of <div style="{{ val }}">, use <div :style="val">.', el.rawAttrsMap['style']);
  5998. }
  5999. }
  6000. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  6001. }
  6002. const styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  6003. if (styleBinding) {
  6004. el.styleBinding = styleBinding;
  6005. }
  6006. }
  6007. function genData$1(el) {
  6008. let data = '';
  6009. if (el.staticStyle) {
  6010. data += `staticStyle:${el.staticStyle},`;
  6011. }
  6012. if (el.styleBinding) {
  6013. data += `style:(${el.styleBinding}),`;
  6014. }
  6015. return data;
  6016. }
  6017. var style = {
  6018. staticKeys: ['staticStyle'],
  6019. transformNode,
  6020. genData: genData$1
  6021. };
  6022. var he$1 = {exports: {}};
  6023. /*! https://mths.be/he v1.2.0 by @mathias | MIT license */
  6024. (function (module, exports) {
  6025. (function(root) {
  6026. // Detect free variables `exports`.
  6027. var freeExports = exports;
  6028. // Detect free variable `module`.
  6029. var freeModule = module &&
  6030. module.exports == freeExports && module;
  6031. // Detect free variable `global`, from Node.js or Browserified code,
  6032. // and use it as `root`.
  6033. var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal;
  6034. if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
  6035. root = freeGlobal;
  6036. }
  6037. /*--------------------------------------------------------------------------*/
  6038. // All astral symbols.
  6039. var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  6040. // All ASCII symbols (not just printable ASCII) except those listed in the
  6041. // first column of the overrides table.
  6042. // https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides
  6043. var regexAsciiWhitelist = /[\x01-\x7F]/g;
  6044. // All BMP symbols that are not ASCII newlines, printable ASCII symbols, or
  6045. // code points listed in the first column of the overrides table on
  6046. // https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides.
  6047. var regexBmpWhitelist = /[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g;
  6048. var regexEncodeNonAscii = /<\u20D2|=\u20E5|>\u20D2|\u205F\u200A|\u219D\u0338|\u2202\u0338|\u2220\u20D2|\u2229\uFE00|\u222A\uFE00|\u223C\u20D2|\u223D\u0331|\u223E\u0333|\u2242\u0338|\u224B\u0338|\u224D\u20D2|\u224E\u0338|\u224F\u0338|\u2250\u0338|\u2261\u20E5|\u2264\u20D2|\u2265\u20D2|\u2266\u0338|\u2267\u0338|\u2268\uFE00|\u2269\uFE00|\u226A\u0338|\u226A\u20D2|\u226B\u0338|\u226B\u20D2|\u227F\u0338|\u2282\u20D2|\u2283\u20D2|\u228A\uFE00|\u228B\uFE00|\u228F\u0338|\u2290\u0338|\u2293\uFE00|\u2294\uFE00|\u22B4\u20D2|\u22B5\u20D2|\u22D8\u0338|\u22D9\u0338|\u22DA\uFE00|\u22DB\uFE00|\u22F5\u0338|\u22F9\u0338|\u2933\u0338|\u29CF\u0338|\u29D0\u0338|\u2A6D\u0338|\u2A70\u0338|\u2A7D\u0338|\u2A7E\u0338|\u2AA1\u0338|\u2AA2\u0338|\u2AAC\uFE00|\u2AAD\uFE00|\u2AAF\u0338|\u2AB0\u0338|\u2AC5\u0338|\u2AC6\u0338|\u2ACB\uFE00|\u2ACC\uFE00|\u2AFD\u20E5|[\xA0-\u0113\u0116-\u0122\u0124-\u012B\u012E-\u014D\u0150-\u017E\u0192\u01B5\u01F5\u0237\u02C6\u02C7\u02D8-\u02DD\u0311\u0391-\u03A1\u03A3-\u03A9\u03B1-\u03C9\u03D1\u03D2\u03D5\u03D6\u03DC\u03DD\u03F0\u03F1\u03F5\u03F6\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E\u045F\u2002-\u2005\u2007-\u2010\u2013-\u2016\u2018-\u201A\u201C-\u201E\u2020-\u2022\u2025\u2026\u2030-\u2035\u2039\u203A\u203E\u2041\u2043\u2044\u204F\u2057\u205F-\u2063\u20AC\u20DB\u20DC\u2102\u2105\u210A-\u2113\u2115-\u211E\u2122\u2124\u2127-\u2129\u212C\u212D\u212F-\u2131\u2133-\u2138\u2145-\u2148\u2153-\u215E\u2190-\u219B\u219D-\u21A7\u21A9-\u21AE\u21B0-\u21B3\u21B5-\u21B7\u21BA-\u21DB\u21DD\u21E4\u21E5\u21F5\u21FD-\u2205\u2207-\u2209\u220B\u220C\u220F-\u2214\u2216-\u2218\u221A\u221D-\u2238\u223A-\u2257\u2259\u225A\u225C\u225F-\u2262\u2264-\u228B\u228D-\u229B\u229D-\u22A5\u22A7-\u22B0\u22B2-\u22BB\u22BD-\u22DB\u22DE-\u22E3\u22E6-\u22F7\u22F9-\u22FE\u2305\u2306\u2308-\u2310\u2312\u2313\u2315\u2316\u231C-\u231F\u2322\u2323\u232D\u232E\u2336\u233D\u233F\u237C\u23B0\u23B1\u23B4-\u23B6\u23DC-\u23DF\u23E2\u23E7\u2423\u24C8\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2550-\u256C\u2580\u2584\u2588\u2591-\u2593\u25A1\u25AA\u25AB\u25AD\u25AE\u25B1\u25B3-\u25B5\u25B8\u25B9\u25BD-\u25BF\u25C2\u25C3\u25CA\u25CB\u25EC\u25EF\u25F8-\u25FC\u2605\u2606\u260E\u2640\u2642\u2660\u2663\u2665\u2666\u266A\u266D-\u266F\u2713\u2717\u2720\u2736\u2758\u2772\u2773\u27C8\u27C9\u27E6-\u27ED\u27F5-\u27FA\u27FC\u27FF\u2902-\u2905\u290C-\u2913\u2916\u2919-\u2920\u2923-\u292A\u2933\u2935-\u2939\u293C\u293D\u2945\u2948-\u294B\u294E-\u2976\u2978\u2979\u297B-\u297F\u2985\u2986\u298B-\u2996\u299A\u299C\u299D\u29A4-\u29B7\u29B9\u29BB\u29BC\u29BE-\u29C5\u29C9\u29CD-\u29D0\u29DC-\u29DE\u29E3-\u29E5\u29EB\u29F4\u29F6\u2A00-\u2A02\u2A04\u2A06\u2A0C\u2A0D\u2A10-\u2A17\u2A22-\u2A27\u2A29\u2A2A\u2A2D-\u2A31\u2A33-\u2A3C\u2A3F\u2A40\u2A42-\u2A4D\u2A50\u2A53-\u2A58\u2A5A-\u2A5D\u2A5F\u2A66\u2A6A\u2A6D-\u2A75\u2A77-\u2A9A\u2A9D-\u2AA2\u2AA4-\u2AB0\u2AB3-\u2AC8\u2ACB\u2ACC\u2ACF-\u2ADB\u2AE4\u2AE6-\u2AE9\u2AEB-\u2AF3\u2AFD\uFB00-\uFB04]|\uD835[\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDD6B]/g;
  6049. var encodeMap = {'\xAD':'shy','\u200C':'zwnj','\u200D':'zwj','\u200E':'lrm','\u2063':'ic','\u2062':'it','\u2061':'af','\u200F':'rlm','\u200B':'ZeroWidthSpace','\u2060':'NoBreak','\u0311':'DownBreve','\u20DB':'tdot','\u20DC':'DotDot','\t':'Tab','\n':'NewLine','\u2008':'puncsp','\u205F':'MediumSpace','\u2009':'thinsp','\u200A':'hairsp','\u2004':'emsp13','\u2002':'ensp','\u2005':'emsp14','\u2003':'emsp','\u2007':'numsp','\xA0':'nbsp','\u205F\u200A':'ThickSpace','\u203E':'oline','_':'lowbar','\u2010':'dash','\u2013':'ndash','\u2014':'mdash','\u2015':'horbar',',':'comma',';':'semi','\u204F':'bsemi',':':'colon','\u2A74':'Colone','!':'excl','\xA1':'iexcl','?':'quest','\xBF':'iquest','.':'period','\u2025':'nldr','\u2026':'mldr','\xB7':'middot','\'':'apos','\u2018':'lsquo','\u2019':'rsquo','\u201A':'sbquo','\u2039':'lsaquo','\u203A':'rsaquo','"':'quot','\u201C':'ldquo','\u201D':'rdquo','\u201E':'bdquo','\xAB':'laquo','\xBB':'raquo','(':'lpar',')':'rpar','[':'lsqb',']':'rsqb','{':'lcub','}':'rcub','\u2308':'lceil','\u2309':'rceil','\u230A':'lfloor','\u230B':'rfloor','\u2985':'lopar','\u2986':'ropar','\u298B':'lbrke','\u298C':'rbrke','\u298D':'lbrkslu','\u298E':'rbrksld','\u298F':'lbrksld','\u2990':'rbrkslu','\u2991':'langd','\u2992':'rangd','\u2993':'lparlt','\u2994':'rpargt','\u2995':'gtlPar','\u2996':'ltrPar','\u27E6':'lobrk','\u27E7':'robrk','\u27E8':'lang','\u27E9':'rang','\u27EA':'Lang','\u27EB':'Rang','\u27EC':'loang','\u27ED':'roang','\u2772':'lbbrk','\u2773':'rbbrk','\u2016':'Vert','\xA7':'sect','\xB6':'para','@':'commat','*':'ast','/':'sol','undefined':null,'&':'amp','#':'num','%':'percnt','\u2030':'permil','\u2031':'pertenk','\u2020':'dagger','\u2021':'Dagger','\u2022':'bull','\u2043':'hybull','\u2032':'prime','\u2033':'Prime','\u2034':'tprime','\u2057':'qprime','\u2035':'bprime','\u2041':'caret','`':'grave','\xB4':'acute','\u02DC':'tilde','^':'Hat','\xAF':'macr','\u02D8':'breve','\u02D9':'dot','\xA8':'die','\u02DA':'ring','\u02DD':'dblac','\xB8':'cedil','\u02DB':'ogon','\u02C6':'circ','\u02C7':'caron','\xB0':'deg','\xA9':'copy','\xAE':'reg','\u2117':'copysr','\u2118':'wp','\u211E':'rx','\u2127':'mho','\u2129':'iiota','\u2190':'larr','\u219A':'nlarr','\u2192':'rarr','\u219B':'nrarr','\u2191':'uarr','\u2193':'darr','\u2194':'harr','\u21AE':'nharr','\u2195':'varr','\u2196':'nwarr','\u2197':'nearr','\u2198':'searr','\u2199':'swarr','\u219D':'rarrw','\u219D\u0338':'nrarrw','\u219E':'Larr','\u219F':'Uarr','\u21A0':'Rarr','\u21A1':'Darr','\u21A2':'larrtl','\u21A3':'rarrtl','\u21A4':'mapstoleft','\u21A5':'mapstoup','\u21A6':'map','\u21A7':'mapstodown','\u21A9':'larrhk','\u21AA':'rarrhk','\u21AB':'larrlp','\u21AC':'rarrlp','\u21AD':'harrw','\u21B0':'lsh','\u21B1':'rsh','\u21B2':'ldsh','\u21B3':'rdsh','\u21B5':'crarr','\u21B6':'cularr','\u21B7':'curarr','\u21BA':'olarr','\u21BB':'orarr','\u21BC':'lharu','\u21BD':'lhard','\u21BE':'uharr','\u21BF':'uharl','\u21C0':'rharu','\u21C1':'rhard','\u21C2':'dharr','\u21C3':'dharl','\u21C4':'rlarr','\u21C5':'udarr','\u21C6':'lrarr','\u21C7':'llarr','\u21C8':'uuarr','\u21C9':'rrarr','\u21CA':'ddarr','\u21CB':'lrhar','\u21CC':'rlhar','\u21D0':'lArr','\u21CD':'nlArr','\u21D1':'uArr','\u21D2':'rArr','\u21CF':'nrArr','\u21D3':'dArr','\u21D4':'iff','\u21CE':'nhArr','\u21D5':'vArr','\u21D6':'nwArr','\u21D7':'neArr','\u21D8':'seArr','\u21D9':'swArr','\u21DA':'lAarr','\u21DB':'rAarr','\u21DD':'zigrarr','\u21E4':'larrb','\u21E5':'rarrb','\u21F5':'duarr','\u21FD':'loarr','\u21FE':'roarr','\u21FF':'hoarr','\u2200':'forall','\u2201':'comp','\u2202':'part','\u2202\u0338':'npart','\u2203':'exist','\u2204':'nexist','\u2205':'empty','\u2207':'Del','\u2208':'in','\u2209':'notin','\u220B':'ni','\u220C':'notni','\u03F6':'bepsi','\u220F':'prod','\u2210':'coprod','\u2211':'sum','+':'plus','\xB1':'pm','\xF7':'div','\xD7':'times','<':'lt','\u226E':'nlt','<\u20D2':'nvlt','=':'equals','\u2260':'ne','=\u20E5':'bne','\u2A75':'Equal','>':'gt','\u226F':'ngt','>\u20D2':'nvgt','\xAC':'not','|':'vert','\xA6':'brvbar','\u2212':'minus','\u2213':'mp','\u2214':'plusdo','\u2044':'frasl','\u2216':'setmn','\u2217':'lowast','\u2218':'compfn','\u221A':'Sqrt','\u221D':'prop','\u221E':'infin','\u221F':'angrt','\u2220':'ang','\u2220\u20D2':'nang','\u2221':'angmsd','\u2222':'angsph','\u2223':'mid','\u2224':'nmid','\u2225':'par','\u2226':'npar','\u2227':'and','\u2228':'or','\u2229':'cap','\u2229\uFE00':'caps','\u222A':'cup','\u222A\uFE00':'cups','\u222B':'int','\u222C':'Int','\u222D':'tint','\u2A0C':'qint','\u222E':'oint','\u222F':'Conint','\u2230':'Cconint','\u2231':'cwint','\u2232':'cwconint','\u2233':'awconint','\u2234':'there4','\u2235':'becaus','\u2236':'ratio','\u2237':'Colon','\u2238':'minusd','\u223A':'mDDot','\u223B':'homtht','\u223C':'sim','\u2241':'nsim','\u223C\u20D2':'nvsim','\u223D':'bsim','\u223D\u0331':'race','\u223E':'ac','\u223E\u0333':'acE','\u223F':'acd','\u2240':'wr','\u2242':'esim','\u2242\u0338':'nesim','\u2243':'sime','\u2244':'nsime','\u2245':'cong','\u2247':'ncong','\u2246':'simne','\u2248':'ap','\u2249':'nap','\u224A':'ape','\u224B':'apid','\u224B\u0338':'napid','\u224C':'bcong','\u224D':'CupCap','\u226D':'NotCupCap','\u224D\u20D2':'nvap','\u224E':'bump','\u224E\u0338':'nbump','\u224F':'bumpe','\u224F\u0338':'nbumpe','\u2250':'doteq','\u2250\u0338':'nedot','\u2251':'eDot','\u2252':'efDot','\u2253':'erDot','\u2254':'colone','\u2255':'ecolon','\u2256':'ecir','\u2257':'cire','\u2259':'wedgeq','\u225A':'veeeq','\u225C':'trie','\u225F':'equest','\u2261':'equiv','\u2262':'nequiv','\u2261\u20E5':'bnequiv','\u2264':'le','\u2270':'nle','\u2264\u20D2':'nvle','\u2265':'ge','\u2271':'nge','\u2265\u20D2':'nvge','\u2266':'lE','\u2266\u0338':'nlE','\u2267':'gE','\u2267\u0338':'ngE','\u2268\uFE00':'lvnE','\u2268':'lnE','\u2269':'gnE','\u2269\uFE00':'gvnE','\u226A':'ll','\u226A\u0338':'nLtv','\u226A\u20D2':'nLt','\u226B':'gg','\u226B\u0338':'nGtv','\u226B\u20D2':'nGt','\u226C':'twixt','\u2272':'lsim','\u2274':'nlsim','\u2273':'gsim','\u2275':'ngsim','\u2276':'lg','\u2278':'ntlg','\u2277':'gl','\u2279':'ntgl','\u227A':'pr','\u2280':'npr','\u227B':'sc','\u2281':'nsc','\u227C':'prcue','\u22E0':'nprcue','\u227D':'sccue','\u22E1':'nsccue','\u227E':'prsim','\u227F':'scsim','\u227F\u0338':'NotSucceedsTilde','\u2282':'sub','\u2284':'nsub','\u2282\u20D2':'vnsub','\u2283':'sup','\u2285':'nsup','\u2283\u20D2':'vnsup','\u2286':'sube','\u2288':'nsube','\u2287':'supe','\u2289':'nsupe','\u228A\uFE00':'vsubne','\u228A':'subne','\u228B\uFE00':'vsupne','\u228B':'supne','\u228D':'cupdot','\u228E':'uplus','\u228F':'sqsub','\u228F\u0338':'NotSquareSubset','\u2290':'sqsup','\u2290\u0338':'NotSquareSuperset','\u2291':'sqsube','\u22E2':'nsqsube','\u2292':'sqsupe','\u22E3':'nsqsupe','\u2293':'sqcap','\u2293\uFE00':'sqcaps','\u2294':'sqcup','\u2294\uFE00':'sqcups','\u2295':'oplus','\u2296':'ominus','\u2297':'otimes','\u2298':'osol','\u2299':'odot','\u229A':'ocir','\u229B':'oast','\u229D':'odash','\u229E':'plusb','\u229F':'minusb','\u22A0':'timesb','\u22A1':'sdotb','\u22A2':'vdash','\u22AC':'nvdash','\u22A3':'dashv','\u22A4':'top','\u22A5':'bot','\u22A7':'models','\u22A8':'vDash','\u22AD':'nvDash','\u22A9':'Vdash','\u22AE':'nVdash','\u22AA':'Vvdash','\u22AB':'VDash','\u22AF':'nVDash','\u22B0':'prurel','\u22B2':'vltri','\u22EA':'nltri','\u22B3':'vrtri','\u22EB':'nrtri','\u22B4':'ltrie','\u22EC':'nltrie','\u22B4\u20D2':'nvltrie','\u22B5':'rtrie','\u22ED':'nrtrie','\u22B5\u20D2':'nvrtrie','\u22B6':'origof','\u22B7':'imof','\u22B8':'mumap','\u22B9':'hercon','\u22BA':'intcal','\u22BB':'veebar','\u22BD':'barvee','\u22BE':'angrtvb','\u22BF':'lrtri','\u22C0':'Wedge','\u22C1':'Vee','\u22C2':'xcap','\u22C3':'xcup','\u22C4':'diam','\u22C5':'sdot','\u22C6':'Star','\u22C7':'divonx','\u22C8':'bowtie','\u22C9':'ltimes','\u22CA':'rtimes','\u22CB':'lthree','\u22CC':'rthree','\u22CD':'bsime','\u22CE':'cuvee','\u22CF':'cuwed','\u22D0':'Sub','\u22D1':'Sup','\u22D2':'Cap','\u22D3':'Cup','\u22D4':'fork','\u22D5':'epar','\u22D6':'ltdot','\u22D7':'gtdot','\u22D8':'Ll','\u22D8\u0338':'nLl','\u22D9':'Gg','\u22D9\u0338':'nGg','\u22DA\uFE00':'lesg','\u22DA':'leg','\u22DB':'gel','\u22DB\uFE00':'gesl','\u22DE':'cuepr','\u22DF':'cuesc','\u22E6':'lnsim','\u22E7':'gnsim','\u22E8':'prnsim','\u22E9':'scnsim','\u22EE':'vellip','\u22EF':'ctdot','\u22F0':'utdot','\u22F1':'dtdot','\u22F2':'disin','\u22F3':'isinsv','\u22F4':'isins','\u22F5':'isindot','\u22F5\u0338':'notindot','\u22F6':'notinvc','\u22F7':'notinvb','\u22F9':'isinE','\u22F9\u0338':'notinE','\u22FA':'nisd','\u22FB':'xnis','\u22FC':'nis','\u22FD':'notnivc','\u22FE':'notnivb','\u2305':'barwed','\u2306':'Barwed','\u230C':'drcrop','\u230D':'dlcrop','\u230E':'urcrop','\u230F':'ulcrop','\u2310':'bnot','\u2312':'profline','\u2313':'profsurf','\u2315':'telrec','\u2316':'target','\u231C':'ulcorn','\u231D':'urcorn','\u231E':'dlcorn','\u231F':'drcorn','\u2322':'frown','\u2323':'smile','\u232D':'cylcty','\u232E':'profalar','\u2336':'topbot','\u233D':'ovbar','\u233F':'solbar','\u237C':'angzarr','\u23B0':'lmoust','\u23B1':'rmoust','\u23B4':'tbrk','\u23B5':'bbrk','\u23B6':'bbrktbrk','\u23DC':'OverParenthesis','\u23DD':'UnderParenthesis','\u23DE':'OverBrace','\u23DF':'UnderBrace','\u23E2':'trpezium','\u23E7':'elinters','\u2423':'blank','\u2500':'boxh','\u2502':'boxv','\u250C':'boxdr','\u2510':'boxdl','\u2514':'boxur','\u2518':'boxul','\u251C':'boxvr','\u2524':'boxvl','\u252C':'boxhd','\u2534':'boxhu','\u253C':'boxvh','\u2550':'boxH','\u2551':'boxV','\u2552':'boxdR','\u2553':'boxDr','\u2554':'boxDR','\u2555':'boxdL','\u2556':'boxDl','\u2557':'boxDL','\u2558':'boxuR','\u2559':'boxUr','\u255A':'boxUR','\u255B':'boxuL','\u255C':'boxUl','\u255D':'boxUL','\u255E':'boxvR','\u255F':'boxVr','\u2560':'boxVR','\u2561':'boxvL','\u2562':'boxVl','\u2563':'boxVL','\u2564':'boxHd','\u2565':'boxhD','\u2566':'boxHD','\u2567':'boxHu','\u2568':'boxhU','\u2569':'boxHU','\u256A':'boxvH','\u256B':'boxVh','\u256C':'boxVH','\u2580':'uhblk','\u2584':'lhblk','\u2588':'block','\u2591':'blk14','\u2592':'blk12','\u2593':'blk34','\u25A1':'squ','\u25AA':'squf','\u25AB':'EmptyVerySmallSquare','\u25AD':'rect','\u25AE':'marker','\u25B1':'fltns','\u25B3':'xutri','\u25B4':'utrif','\u25B5':'utri','\u25B8':'rtrif','\u25B9':'rtri','\u25BD':'xdtri','\u25BE':'dtrif','\u25BF':'dtri','\u25C2':'ltrif','\u25C3':'ltri','\u25CA':'loz','\u25CB':'cir','\u25EC':'tridot','\u25EF':'xcirc','\u25F8':'ultri','\u25F9':'urtri','\u25FA':'lltri','\u25FB':'EmptySmallSquare','\u25FC':'FilledSmallSquare','\u2605':'starf','\u2606':'star','\u260E':'phone','\u2640':'female','\u2642':'male','\u2660':'spades','\u2663':'clubs','\u2665':'hearts','\u2666':'diams','\u266A':'sung','\u2713':'check','\u2717':'cross','\u2720':'malt','\u2736':'sext','\u2758':'VerticalSeparator','\u27C8':'bsolhsub','\u27C9':'suphsol','\u27F5':'xlarr','\u27F6':'xrarr','\u27F7':'xharr','\u27F8':'xlArr','\u27F9':'xrArr','\u27FA':'xhArr','\u27FC':'xmap','\u27FF':'dzigrarr','\u2902':'nvlArr','\u2903':'nvrArr','\u2904':'nvHarr','\u2905':'Map','\u290C':'lbarr','\u290D':'rbarr','\u290E':'lBarr','\u290F':'rBarr','\u2910':'RBarr','\u2911':'DDotrahd','\u2912':'UpArrowBar','\u2913':'DownArrowBar','\u2916':'Rarrtl','\u2919':'latail','\u291A':'ratail','\u291B':'lAtail','\u291C':'rAtail','\u291D':'larrfs','\u291E':'rarrfs','\u291F':'larrbfs','\u2920':'rarrbfs','\u2923':'nwarhk','\u2924':'nearhk','\u2925':'searhk','\u2926':'swarhk','\u2927':'nwnear','\u2928':'toea','\u2929':'tosa','\u292A':'swnwar','\u2933':'rarrc','\u2933\u0338':'nrarrc','\u2935':'cudarrr','\u2936':'ldca','\u2937':'rdca','\u2938':'cudarrl','\u2939':'larrpl','\u293C':'curarrm','\u293D':'cularrp','\u2945':'rarrpl','\u2948':'harrcir','\u2949':'Uarrocir','\u294A':'lurdshar','\u294B':'ldrushar','\u294E':'LeftRightVector','\u294F':'RightUpDownVector','\u2950':'DownLeftRightVector','\u2951':'LeftUpDownVector','\u2952':'LeftVectorBar','\u2953':'RightVectorBar','\u2954':'RightUpVectorBar','\u2955':'RightDownVectorBar','\u2956':'DownLeftVectorBar','\u2957':'DownRightVectorBar','\u2958':'LeftUpVectorBar','\u2959':'LeftDownVectorBar','\u295A':'LeftTeeVector','\u295B':'RightTeeVector','\u295C':'RightUpTeeVector','\u295D':'RightDownTeeVector','\u295E':'DownLeftTeeVector','\u295F':'DownRightTeeVector','\u2960':'LeftUpTeeVector','\u2961':'LeftDownTeeVector','\u2962':'lHar','\u2963':'uHar','\u2964':'rHar','\u2965':'dHar','\u2966':'luruhar','\u2967':'ldrdhar','\u2968':'ruluhar','\u2969':'rdldhar','\u296A':'lharul','\u296B':'llhard','\u296C':'rharul','\u296D':'lrhard','\u296E':'udhar','\u296F':'duhar','\u2970':'RoundImplies','\u2971':'erarr','\u2972':'simrarr','\u2973':'larrsim','\u2974':'rarrsim','\u2975':'rarrap','\u2976':'ltlarr','\u2978':'gtrarr','\u2979':'subrarr','\u297B':'suplarr','\u297C':'lfisht','\u297D':'rfisht','\u297E':'ufisht','\u297F':'dfisht','\u299A':'vzigzag','\u299C':'vangrt','\u299D':'angrtvbd','\u29A4':'ange','\u29A5':'range','\u29A6':'dwangle','\u29A7':'uwangle','\u29A8':'angmsdaa','\u29A9':'angmsdab','\u29AA':'angmsdac','\u29AB':'angmsdad','\u29AC':'angmsdae','\u29AD':'angmsdaf','\u29AE':'angmsdag','\u29AF':'angmsdah','\u29B0':'bemptyv','\u29B1':'demptyv','\u29B2':'cemptyv','\u29B3':'raemptyv','\u29B4':'laemptyv','\u29B5':'ohbar','\u29B6':'omid','\u29B7':'opar','\u29B9':'operp','\u29BB':'olcross','\u29BC':'odsold','\u29BE':'olcir','\u29BF':'ofcir','\u29C0':'olt','\u29C1':'ogt','\u29C2':'cirscir','\u29C3':'cirE','\u29C4':'solb','\u29C5':'bsolb','\u29C9':'boxbox','\u29CD':'trisb','\u29CE':'rtriltri','\u29CF':'LeftTriangleBar','\u29CF\u0338':'NotLeftTriangleBar','\u29D0':'RightTriangleBar','\u29D0\u0338':'NotRightTriangleBar','\u29DC':'iinfin','\u29DD':'infintie','\u29DE':'nvinfin','\u29E3':'eparsl','\u29E4':'smeparsl','\u29E5':'eqvparsl','\u29EB':'lozf','\u29F4':'RuleDelayed','\u29F6':'dsol','\u2A00':'xodot','\u2A01':'xoplus','\u2A02':'xotime','\u2A04':'xuplus','\u2A06':'xsqcup','\u2A0D':'fpartint','\u2A10':'cirfnint','\u2A11':'awint','\u2A12':'rppolint','\u2A13':'scpolint','\u2A14':'npolint','\u2A15':'pointint','\u2A16':'quatint','\u2A17':'intlarhk','\u2A22':'pluscir','\u2A23':'plusacir','\u2A24':'simplus','\u2A25':'plusdu','\u2A26':'plussim','\u2A27':'plustwo','\u2A29':'mcomma','\u2A2A':'minusdu','\u2A2D':'loplus','\u2A2E':'roplus','\u2A2F':'Cross','\u2A30':'timesd','\u2A31':'timesbar','\u2A33':'smashp','\u2A34':'lotimes','\u2A35':'rotimes','\u2A36':'otimesas','\u2A37':'Otimes','\u2A38':'odiv','\u2A39':'triplus','\u2A3A':'triminus','\u2A3B':'tritime','\u2A3C':'iprod','\u2A3F':'amalg','\u2A40':'capdot','\u2A42':'ncup','\u2A43':'ncap','\u2A44':'capand','\u2A45':'cupor','\u2A46':'cupcap','\u2A47':'capcup','\u2A48':'cupbrcap','\u2A49':'capbrcup','\u2A4A':'cupcup','\u2A4B':'capcap','\u2A4C':'ccups','\u2A4D':'ccaps','\u2A50':'ccupssm','\u2A53':'And','\u2A54':'Or','\u2A55':'andand','\u2A56':'oror','\u2A57':'orslope','\u2A58':'andslope','\u2A5A':'andv','\u2A5B':'orv','\u2A5C':'andd','\u2A5D':'ord','\u2A5F':'wedbar','\u2A66':'sdote','\u2A6A':'simdot','\u2A6D':'congdot','\u2A6D\u0338':'ncongdot','\u2A6E':'easter','\u2A6F':'apacir','\u2A70':'apE','\u2A70\u0338':'napE','\u2A71':'eplus','\u2A72':'pluse','\u2A73':'Esim','\u2A77':'eDDot','\u2A78':'equivDD','\u2A79':'ltcir','\u2A7A':'gtcir','\u2A7B':'ltquest','\u2A7C':'gtquest','\u2A7D':'les','\u2A7D\u0338':'nles','\u2A7E':'ges','\u2A7E\u0338':'nges','\u2A7F':'lesdot','\u2A80':'gesdot','\u2A81':'lesdoto','\u2A82':'gesdoto','\u2A83':'lesdotor','\u2A84':'gesdotol','\u2A85':'lap','\u2A86':'gap','\u2A87':'lne','\u2A88':'gne','\u2A89':'lnap','\u2A8A':'gnap','\u2A8B':'lEg','\u2A8C':'gEl','\u2A8D':'lsime','\u2A8E':'gsime','\u2A8F':'lsimg','\u2A90':'gsiml','\u2A91':'lgE','\u2A92':'glE','\u2A93':'lesges','\u2A94':'gesles','\u2A95':'els','\u2A96':'egs','\u2A97':'elsdot','\u2A98':'egsdot','\u2A99':'el','\u2A9A':'eg','\u2A9D':'siml','\u2A9E':'simg','\u2A9F':'simlE','\u2AA0':'simgE','\u2AA1':'LessLess','\u2AA1\u0338':'NotNestedLessLess','\u2AA2':'GreaterGreater','\u2AA2\u0338':'NotNestedGreaterGreater','\u2AA4':'glj','\u2AA5':'gla','\u2AA6':'ltcc','\u2AA7':'gtcc','\u2AA8':'lescc','\u2AA9':'gescc','\u2AAA':'smt','\u2AAB':'lat','\u2AAC':'smte','\u2AAC\uFE00':'smtes','\u2AAD':'late','\u2AAD\uFE00':'lates','\u2AAE':'bumpE','\u2AAF':'pre','\u2AAF\u0338':'npre','\u2AB0':'sce','\u2AB0\u0338':'nsce','\u2AB3':'prE','\u2AB4':'scE','\u2AB5':'prnE','\u2AB6':'scnE','\u2AB7':'prap','\u2AB8':'scap','\u2AB9':'prnap','\u2ABA':'scnap','\u2ABB':'Pr','\u2ABC':'Sc','\u2ABD':'subdot','\u2ABE':'supdot','\u2ABF':'subplus','\u2AC0':'supplus','\u2AC1':'submult','\u2AC2':'supmult','\u2AC3':'subedot','\u2AC4':'supedot','\u2AC5':'subE','\u2AC5\u0338':'nsubE','\u2AC6':'supE','\u2AC6\u0338':'nsupE','\u2AC7':'subsim','\u2AC8':'supsim','\u2ACB\uFE00':'vsubnE','\u2ACB':'subnE','\u2ACC\uFE00':'vsupnE','\u2ACC':'supnE','\u2ACF':'csub','\u2AD0':'csup','\u2AD1':'csube','\u2AD2':'csupe','\u2AD3':'subsup','\u2AD4':'supsub','\u2AD5':'subsub','\u2AD6':'supsup','\u2AD7':'suphsub','\u2AD8':'supdsub','\u2AD9':'forkv','\u2ADA':'topfork','\u2ADB':'mlcp','\u2AE4':'Dashv','\u2AE6':'Vdashl','\u2AE7':'Barv','\u2AE8':'vBar','\u2AE9':'vBarv','\u2AEB':'Vbar','\u2AEC':'Not','\u2AED':'bNot','\u2AEE':'rnmid','\u2AEF':'cirmid','\u2AF0':'midcir','\u2AF1':'topcir','\u2AF2':'nhpar','\u2AF3':'parsim','\u2AFD':'parsl','\u2AFD\u20E5':'nparsl','\u266D':'flat','\u266E':'natur','\u266F':'sharp','\xA4':'curren','\xA2':'cent','$':'dollar','\xA3':'pound','\xA5':'yen','\u20AC':'euro','\xB9':'sup1','\xBD':'half','\u2153':'frac13','\xBC':'frac14','\u2155':'frac15','\u2159':'frac16','\u215B':'frac18','\xB2':'sup2','\u2154':'frac23','\u2156':'frac25','\xB3':'sup3','\xBE':'frac34','\u2157':'frac35','\u215C':'frac38','\u2158':'frac45','\u215A':'frac56','\u215D':'frac58','\u215E':'frac78','\uD835\uDCB6':'ascr','\uD835\uDD52':'aopf','\uD835\uDD1E':'afr','\uD835\uDD38':'Aopf','\uD835\uDD04':'Afr','\uD835\uDC9C':'Ascr','\xAA':'ordf','\xE1':'aacute','\xC1':'Aacute','\xE0':'agrave','\xC0':'Agrave','\u0103':'abreve','\u0102':'Abreve','\xE2':'acirc','\xC2':'Acirc','\xE5':'aring','\xC5':'angst','\xE4':'auml','\xC4':'Auml','\xE3':'atilde','\xC3':'Atilde','\u0105':'aogon','\u0104':'Aogon','\u0101':'amacr','\u0100':'Amacr','\xE6':'aelig','\xC6':'AElig','\uD835\uDCB7':'bscr','\uD835\uDD53':'bopf','\uD835\uDD1F':'bfr','\uD835\uDD39':'Bopf','\u212C':'Bscr','\uD835\uDD05':'Bfr','\uD835\uDD20':'cfr','\uD835\uDCB8':'cscr','\uD835\uDD54':'copf','\u212D':'Cfr','\uD835\uDC9E':'Cscr','\u2102':'Copf','\u0107':'cacute','\u0106':'Cacute','\u0109':'ccirc','\u0108':'Ccirc','\u010D':'ccaron','\u010C':'Ccaron','\u010B':'cdot','\u010A':'Cdot','\xE7':'ccedil','\xC7':'Ccedil','\u2105':'incare','\uD835\uDD21':'dfr','\u2146':'dd','\uD835\uDD55':'dopf','\uD835\uDCB9':'dscr','\uD835\uDC9F':'Dscr','\uD835\uDD07':'Dfr','\u2145':'DD','\uD835\uDD3B':'Dopf','\u010F':'dcaron','\u010E':'Dcaron','\u0111':'dstrok','\u0110':'Dstrok','\xF0':'eth','\xD0':'ETH','\u2147':'ee','\u212F':'escr','\uD835\uDD22':'efr','\uD835\uDD56':'eopf','\u2130':'Escr','\uD835\uDD08':'Efr','\uD835\uDD3C':'Eopf','\xE9':'eacute','\xC9':'Eacute','\xE8':'egrave','\xC8':'Egrave','\xEA':'ecirc','\xCA':'Ecirc','\u011B':'ecaron','\u011A':'Ecaron','\xEB':'euml','\xCB':'Euml','\u0117':'edot','\u0116':'Edot','\u0119':'eogon','\u0118':'Eogon','\u0113':'emacr','\u0112':'Emacr','\uD835\uDD23':'ffr','\uD835\uDD57':'fopf','\uD835\uDCBB':'fscr','\uD835\uDD09':'Ffr','\uD835\uDD3D':'Fopf','\u2131':'Fscr','\uFB00':'fflig','\uFB03':'ffilig','\uFB04':'ffllig','\uFB01':'filig','fj':'fjlig','\uFB02':'fllig','\u0192':'fnof','\u210A':'gscr','\uD835\uDD58':'gopf','\uD835\uDD24':'gfr','\uD835\uDCA2':'Gscr','\uD835\uDD3E':'Gopf','\uD835\uDD0A':'Gfr','\u01F5':'gacute','\u011F':'gbreve','\u011E':'Gbreve','\u011D':'gcirc','\u011C':'Gcirc','\u0121':'gdot','\u0120':'Gdot','\u0122':'Gcedil','\uD835\uDD25':'hfr','\u210E':'planckh','\uD835\uDCBD':'hscr','\uD835\uDD59':'hopf','\u210B':'Hscr','\u210C':'Hfr','\u210D':'Hopf','\u0125':'hcirc','\u0124':'Hcirc','\u210F':'hbar','\u0127':'hstrok','\u0126':'Hstrok','\uD835\uDD5A':'iopf','\uD835\uDD26':'ifr','\uD835\uDCBE':'iscr','\u2148':'ii','\uD835\uDD40':'Iopf','\u2110':'Iscr','\u2111':'Im','\xED':'iacute','\xCD':'Iacute','\xEC':'igrave','\xCC':'Igrave','\xEE':'icirc','\xCE':'Icirc','\xEF':'iuml','\xCF':'Iuml','\u0129':'itilde','\u0128':'Itilde','\u0130':'Idot','\u012F':'iogon','\u012E':'Iogon','\u012B':'imacr','\u012A':'Imacr','\u0133':'ijlig','\u0132':'IJlig','\u0131':'imath','\uD835\uDCBF':'jscr','\uD835\uDD5B':'jopf','\uD835\uDD27':'jfr','\uD835\uDCA5':'Jscr','\uD835\uDD0D':'Jfr','\uD835\uDD41':'Jopf','\u0135':'jcirc','\u0134':'Jcirc','\u0237':'jmath','\uD835\uDD5C':'kopf','\uD835\uDCC0':'kscr','\uD835\uDD28':'kfr','\uD835\uDCA6':'Kscr','\uD835\uDD42':'Kopf','\uD835\uDD0E':'Kfr','\u0137':'kcedil','\u0136':'Kcedil','\uD835\uDD29':'lfr','\uD835\uDCC1':'lscr','\u2113':'ell','\uD835\uDD5D':'lopf','\u2112':'Lscr','\uD835\uDD0F':'Lfr','\uD835\uDD43':'Lopf','\u013A':'lacute','\u0139':'Lacute','\u013E':'lcaron','\u013D':'Lcaron','\u013C':'lcedil','\u013B':'Lcedil','\u0142':'lstrok','\u0141':'Lstrok','\u0140':'lmidot','\u013F':'Lmidot','\uD835\uDD2A':'mfr','\uD835\uDD5E':'mopf','\uD835\uDCC2':'mscr','\uD835\uDD10':'Mfr','\uD835\uDD44':'Mopf','\u2133':'Mscr','\uD835\uDD2B':'nfr','\uD835\uDD5F':'nopf','\uD835\uDCC3':'nscr','\u2115':'Nopf','\uD835\uDCA9':'Nscr','\uD835\uDD11':'Nfr','\u0144':'nacute','\u0143':'Nacute','\u0148':'ncaron','\u0147':'Ncaron','\xF1':'ntilde','\xD1':'Ntilde','\u0146':'ncedil','\u0145':'Ncedil','\u2116':'numero','\u014B':'eng','\u014A':'ENG','\uD835\uDD60':'oopf','\uD835\uDD2C':'ofr','\u2134':'oscr','\uD835\uDCAA':'Oscr','\uD835\uDD12':'Ofr','\uD835\uDD46':'Oopf','\xBA':'ordm','\xF3':'oacute','\xD3':'Oacute','\xF2':'ograve','\xD2':'Ograve','\xF4':'ocirc','\xD4':'Ocirc','\xF6':'ouml','\xD6':'Ouml','\u0151':'odblac','\u0150':'Odblac','\xF5':'otilde','\xD5':'Otilde','\xF8':'oslash','\xD8':'Oslash','\u014D':'omacr','\u014C':'Omacr','\u0153':'oelig','\u0152':'OElig','\uD835\uDD2D':'pfr','\uD835\uDCC5':'pscr','\uD835\uDD61':'popf','\u2119':'Popf','\uD835\uDD13':'Pfr','\uD835\uDCAB':'Pscr','\uD835\uDD62':'qopf','\uD835\uDD2E':'qfr','\uD835\uDCC6':'qscr','\uD835\uDCAC':'Qscr','\uD835\uDD14':'Qfr','\u211A':'Qopf','\u0138':'kgreen','\uD835\uDD2F':'rfr','\uD835\uDD63':'ropf','\uD835\uDCC7':'rscr','\u211B':'Rscr','\u211C':'Re','\u211D':'Ropf','\u0155':'racute','\u0154':'Racute','\u0159':'rcaron','\u0158':'Rcaron','\u0157':'rcedil','\u0156':'Rcedil','\uD835\uDD64':'sopf','\uD835\uDCC8':'sscr','\uD835\uDD30':'sfr','\uD835\uDD4A':'Sopf','\uD835\uDD16':'Sfr','\uD835\uDCAE':'Sscr','\u24C8':'oS','\u015B':'sacute','\u015A':'Sacute','\u015D':'scirc','\u015C':'Scirc','\u0161':'scaron','\u0160':'Scaron','\u015F':'scedil','\u015E':'Scedil','\xDF':'szlig','\uD835\uDD31':'tfr','\uD835\uDCC9':'tscr','\uD835\uDD65':'topf','\uD835\uDCAF':'Tscr','\uD835\uDD17':'Tfr','\uD835\uDD4B':'Topf','\u0165':'tcaron','\u0164':'Tcaron','\u0163':'tcedil','\u0162':'Tcedil','\u2122':'trade','\u0167':'tstrok','\u0166':'Tstrok','\uD835\uDCCA':'uscr','\uD835\uDD66':'uopf','\uD835\uDD32':'ufr','\uD835\uDD4C':'Uopf','\uD835\uDD18':'Ufr','\uD835\uDCB0':'Uscr','\xFA':'uacute','\xDA':'Uacute','\xF9':'ugrave','\xD9':'Ugrave','\u016D':'ubreve','\u016C':'Ubreve','\xFB':'ucirc','\xDB':'Ucirc','\u016F':'uring','\u016E':'Uring','\xFC':'uuml','\xDC':'Uuml','\u0171':'udblac','\u0170':'Udblac','\u0169':'utilde','\u0168':'Utilde','\u0173':'uogon','\u0172':'Uogon','\u016B':'umacr','\u016A':'Umacr','\uD835\uDD33':'vfr','\uD835\uDD67':'vopf','\uD835\uDCCB':'vscr','\uD835\uDD19':'Vfr','\uD835\uDD4D':'Vopf','\uD835\uDCB1':'Vscr','\uD835\uDD68':'wopf','\uD835\uDCCC':'wscr','\uD835\uDD34':'wfr','\uD835\uDCB2':'Wscr','\uD835\uDD4E':'Wopf','\uD835\uDD1A':'Wfr','\u0175':'wcirc','\u0174':'Wcirc','\uD835\uDD35':'xfr','\uD835\uDCCD':'xscr','\uD835\uDD69':'xopf','\uD835\uDD4F':'Xopf','\uD835\uDD1B':'Xfr','\uD835\uDCB3':'Xscr','\uD835\uDD36':'yfr','\uD835\uDCCE':'yscr','\uD835\uDD6A':'yopf','\uD835\uDCB4':'Yscr','\uD835\uDD1C':'Yfr','\uD835\uDD50':'Yopf','\xFD':'yacute','\xDD':'Yacute','\u0177':'ycirc','\u0176':'Ycirc','\xFF':'yuml','\u0178':'Yuml','\uD835\uDCCF':'zscr','\uD835\uDD37':'zfr','\uD835\uDD6B':'zopf','\u2128':'Zfr','\u2124':'Zopf','\uD835\uDCB5':'Zscr','\u017A':'zacute','\u0179':'Zacute','\u017E':'zcaron','\u017D':'Zcaron','\u017C':'zdot','\u017B':'Zdot','\u01B5':'imped','\xFE':'thorn','\xDE':'THORN','\u0149':'napos','\u03B1':'alpha','\u0391':'Alpha','\u03B2':'beta','\u0392':'Beta','\u03B3':'gamma','\u0393':'Gamma','\u03B4':'delta','\u0394':'Delta','\u03B5':'epsi','\u03F5':'epsiv','\u0395':'Epsilon','\u03DD':'gammad','\u03DC':'Gammad','\u03B6':'zeta','\u0396':'Zeta','\u03B7':'eta','\u0397':'Eta','\u03B8':'theta','\u03D1':'thetav','\u0398':'Theta','\u03B9':'iota','\u0399':'Iota','\u03BA':'kappa','\u03F0':'kappav','\u039A':'Kappa','\u03BB':'lambda','\u039B':'Lambda','\u03BC':'mu','\xB5':'micro','\u039C':'Mu','\u03BD':'nu','\u039D':'Nu','\u03BE':'xi','\u039E':'Xi','\u03BF':'omicron','\u039F':'Omicron','\u03C0':'pi','\u03D6':'piv','\u03A0':'Pi','\u03C1':'rho','\u03F1':'rhov','\u03A1':'Rho','\u03C3':'sigma','\u03A3':'Sigma','\u03C2':'sigmaf','\u03C4':'tau','\u03A4':'Tau','\u03C5':'upsi','\u03A5':'Upsilon','\u03D2':'Upsi','\u03C6':'phi','\u03D5':'phiv','\u03A6':'Phi','\u03C7':'chi','\u03A7':'Chi','\u03C8':'psi','\u03A8':'Psi','\u03C9':'omega','\u03A9':'ohm','\u0430':'acy','\u0410':'Acy','\u0431':'bcy','\u0411':'Bcy','\u0432':'vcy','\u0412':'Vcy','\u0433':'gcy','\u0413':'Gcy','\u0453':'gjcy','\u0403':'GJcy','\u0434':'dcy','\u0414':'Dcy','\u0452':'djcy','\u0402':'DJcy','\u0435':'iecy','\u0415':'IEcy','\u0451':'iocy','\u0401':'IOcy','\u0454':'jukcy','\u0404':'Jukcy','\u0436':'zhcy','\u0416':'ZHcy','\u0437':'zcy','\u0417':'Zcy','\u0455':'dscy','\u0405':'DScy','\u0438':'icy','\u0418':'Icy','\u0456':'iukcy','\u0406':'Iukcy','\u0457':'yicy','\u0407':'YIcy','\u0439':'jcy','\u0419':'Jcy','\u0458':'jsercy','\u0408':'Jsercy','\u043A':'kcy','\u041A':'Kcy','\u045C':'kjcy','\u040C':'KJcy','\u043B':'lcy','\u041B':'Lcy','\u0459':'ljcy','\u0409':'LJcy','\u043C':'mcy','\u041C':'Mcy','\u043D':'ncy','\u041D':'Ncy','\u045A':'njcy','\u040A':'NJcy','\u043E':'ocy','\u041E':'Ocy','\u043F':'pcy','\u041F':'Pcy','\u0440':'rcy','\u0420':'Rcy','\u0441':'scy','\u0421':'Scy','\u0442':'tcy','\u0422':'Tcy','\u045B':'tshcy','\u040B':'TSHcy','\u0443':'ucy','\u0423':'Ucy','\u045E':'ubrcy','\u040E':'Ubrcy','\u0444':'fcy','\u0424':'Fcy','\u0445':'khcy','\u0425':'KHcy','\u0446':'tscy','\u0426':'TScy','\u0447':'chcy','\u0427':'CHcy','\u045F':'dzcy','\u040F':'DZcy','\u0448':'shcy','\u0428':'SHcy','\u0449':'shchcy','\u0429':'SHCHcy','\u044A':'hardcy','\u042A':'HARDcy','\u044B':'ycy','\u042B':'Ycy','\u044C':'softcy','\u042C':'SOFTcy','\u044D':'ecy','\u042D':'Ecy','\u044E':'yucy','\u042E':'YUcy','\u044F':'yacy','\u042F':'YAcy','\u2135':'aleph','\u2136':'beth','\u2137':'gimel','\u2138':'daleth'};
  6050. var regexEscape = /["&'<>`]/g;
  6051. var escapeMap = {
  6052. '"': '&quot;',
  6053. '&': '&amp;',
  6054. '\'': '&#x27;',
  6055. '<': '&lt;',
  6056. // See https://mathiasbynens.be/notes/ambiguous-ampersands: in HTML, the
  6057. // following is not strictly necessary unless it’s part of a tag or an
  6058. // unquoted attribute value. We’re only escaping it to support those
  6059. // situations, and for XML support.
  6060. '>': '&gt;',
  6061. // In Internet Explorer ≤ 8, the backtick character can be used
  6062. // to break out of (un)quoted attribute values or HTML comments.
  6063. // See http://html5sec.org/#102, http://html5sec.org/#108, and
  6064. // http://html5sec.org/#133.
  6065. '`': '&#x60;'
  6066. };
  6067. var regexInvalidEntity = /&#(?:[xX][^a-fA-F0-9]|[^0-9xX])/;
  6068. var regexInvalidRawCodePoint = /[\0-\x08\x0B\x0E-\x1F\x7F-\x9F\uFDD0-\uFDEF\uFFFE\uFFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDFFE\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
  6069. var regexDecode = /&(CounterClockwiseContourIntegral|DoubleLongLeftRightArrow|ClockwiseContourIntegral|NotNestedGreaterGreater|NotSquareSupersetEqual|DiacriticalDoubleAcute|NotRightTriangleEqual|NotSucceedsSlantEqual|NotPrecedesSlantEqual|CloseCurlyDoubleQuote|NegativeVeryThinSpace|DoubleContourIntegral|FilledVerySmallSquare|CapitalDifferentialD|OpenCurlyDoubleQuote|EmptyVerySmallSquare|NestedGreaterGreater|DoubleLongRightArrow|NotLeftTriangleEqual|NotGreaterSlantEqual|ReverseUpEquilibrium|DoubleLeftRightArrow|NotSquareSubsetEqual|NotDoubleVerticalBar|RightArrowLeftArrow|NotGreaterFullEqual|NotRightTriangleBar|SquareSupersetEqual|DownLeftRightVector|DoubleLongLeftArrow|leftrightsquigarrow|LeftArrowRightArrow|NegativeMediumSpace|blacktriangleright|RightDownVectorBar|PrecedesSlantEqual|RightDoubleBracket|SucceedsSlantEqual|NotLeftTriangleBar|RightTriangleEqual|SquareIntersection|RightDownTeeVector|ReverseEquilibrium|NegativeThickSpace|longleftrightarrow|Longleftrightarrow|LongLeftRightArrow|DownRightTeeVector|DownRightVectorBar|GreaterSlantEqual|SquareSubsetEqual|LeftDownVectorBar|LeftDoubleBracket|VerticalSeparator|rightleftharpoons|NotGreaterGreater|NotSquareSuperset|blacktriangleleft|blacktriangledown|NegativeThinSpace|LeftDownTeeVector|NotLessSlantEqual|leftrightharpoons|DoubleUpDownArrow|DoubleVerticalBar|LeftTriangleEqual|FilledSmallSquare|twoheadrightarrow|NotNestedLessLess|DownLeftTeeVector|DownLeftVectorBar|RightAngleBracket|NotTildeFullEqual|NotReverseElement|RightUpDownVector|DiacriticalTilde|NotSucceedsTilde|circlearrowright|NotPrecedesEqual|rightharpoondown|DoubleRightArrow|NotSucceedsEqual|NonBreakingSpace|NotRightTriangle|LessEqualGreater|RightUpTeeVector|LeftAngleBracket|GreaterFullEqual|DownArrowUpArrow|RightUpVectorBar|twoheadleftarrow|GreaterEqualLess|downharpoonright|RightTriangleBar|ntrianglerighteq|NotSupersetEqual|LeftUpDownVector|DiacriticalAcute|rightrightarrows|vartriangleright|UpArrowDownArrow|DiacriticalGrave|UnderParenthesis|EmptySmallSquare|LeftUpVectorBar|leftrightarrows|DownRightVector|downharpoonleft|trianglerighteq|ShortRightArrow|OverParenthesis|DoubleLeftArrow|DoubleDownArrow|NotSquareSubset|bigtriangledown|ntrianglelefteq|UpperRightArrow|curvearrowright|vartriangleleft|NotLeftTriangle|nleftrightarrow|LowerRightArrow|NotHumpDownHump|NotGreaterTilde|rightthreetimes|LeftUpTeeVector|NotGreaterEqual|straightepsilon|LeftTriangleBar|rightsquigarrow|ContourIntegral|rightleftarrows|CloseCurlyQuote|RightDownVector|LeftRightVector|nLeftrightarrow|leftharpoondown|circlearrowleft|SquareSuperset|OpenCurlyQuote|hookrightarrow|HorizontalLine|DiacriticalDot|NotLessGreater|ntriangleright|DoubleRightTee|InvisibleComma|InvisibleTimes|LowerLeftArrow|DownLeftVector|NotSubsetEqual|curvearrowleft|trianglelefteq|NotVerticalBar|TildeFullEqual|downdownarrows|NotGreaterLess|RightTeeVector|ZeroWidthSpace|looparrowright|LongRightArrow|doublebarwedge|ShortLeftArrow|ShortDownArrow|RightVectorBar|GreaterGreater|ReverseElement|rightharpoonup|LessSlantEqual|leftthreetimes|upharpoonright|rightarrowtail|LeftDownVector|Longrightarrow|NestedLessLess|UpperLeftArrow|nshortparallel|leftleftarrows|leftrightarrow|Leftrightarrow|LeftRightArrow|longrightarrow|upharpoonleft|RightArrowBar|ApplyFunction|LeftTeeVector|leftarrowtail|NotEqualTilde|varsubsetneqq|varsupsetneqq|RightTeeArrow|SucceedsEqual|SucceedsTilde|LeftVectorBar|SupersetEqual|hookleftarrow|DifferentialD|VerticalTilde|VeryThinSpace|blacktriangle|bigtriangleup|LessFullEqual|divideontimes|leftharpoonup|UpEquilibrium|ntriangleleft|RightTriangle|measuredangle|shortparallel|longleftarrow|Longleftarrow|LongLeftArrow|DoubleLeftTee|Poincareplane|PrecedesEqual|triangleright|DoubleUpArrow|RightUpVector|fallingdotseq|looparrowleft|PrecedesTilde|NotTildeEqual|NotTildeTilde|smallsetminus|Proportional|triangleleft|triangledown|UnderBracket|NotHumpEqual|exponentiale|ExponentialE|NotLessTilde|HilbertSpace|RightCeiling|blacklozenge|varsupsetneq|HumpDownHump|GreaterEqual|VerticalLine|LeftTeeArrow|NotLessEqual|DownTeeArrow|LeftTriangle|varsubsetneq|Intersection|NotCongruent|DownArrowBar|LeftUpVector|LeftArrowBar|risingdotseq|GreaterTilde|RoundImplies|SquareSubset|ShortUpArrow|NotSuperset|quaternions|precnapprox|backepsilon|preccurlyeq|OverBracket|blacksquare|MediumSpace|VerticalBar|circledcirc|circleddash|CircleMinus|CircleTimes|LessGreater|curlyeqprec|curlyeqsucc|diamondsuit|UpDownArrow|Updownarrow|RuleDelayed|Rrightarrow|updownarrow|RightVector|nRightarrow|nrightarrow|eqslantless|LeftCeiling|Equilibrium|SmallCircle|expectation|NotSucceeds|thickapprox|GreaterLess|SquareUnion|NotPrecedes|NotLessLess|straightphi|succnapprox|succcurlyeq|SubsetEqual|sqsupseteq|Proportion|Laplacetrf|ImaginaryI|supsetneqq|NotGreater|gtreqqless|NotElement|ThickSpace|TildeEqual|TildeTilde|Fouriertrf|rmoustache|EqualTilde|eqslantgtr|UnderBrace|LeftVector|UpArrowBar|nLeftarrow|nsubseteqq|subsetneqq|nsupseteqq|nleftarrow|succapprox|lessapprox|UpTeeArrow|upuparrows|curlywedge|lesseqqgtr|varepsilon|varnothing|RightFloor|complement|CirclePlus|sqsubseteq|Lleftarrow|circledast|RightArrow|Rightarrow|rightarrow|lmoustache|Bernoullis|precapprox|mapstoleft|mapstodown|longmapsto|dotsquare|downarrow|DoubleDot|nsubseteq|supsetneq|leftarrow|nsupseteq|subsetneq|ThinSpace|ngeqslant|subseteqq|HumpEqual|NotSubset|triangleq|NotCupCap|lesseqgtr|heartsuit|TripleDot|Leftarrow|Coproduct|Congruent|varpropto|complexes|gvertneqq|LeftArrow|LessTilde|supseteqq|MinusPlus|CircleDot|nleqslant|NotExists|gtreqless|nparallel|UnionPlus|LeftFloor|checkmark|CenterDot|centerdot|Mellintrf|gtrapprox|bigotimes|OverBrace|spadesuit|therefore|pitchfork|rationals|PlusMinus|Backslash|Therefore|DownBreve|backsimeq|backprime|DownArrow|nshortmid|Downarrow|lvertneqq|eqvparsl|imagline|imagpart|infintie|integers|Integral|intercal|LessLess|Uarrocir|intlarhk|sqsupset|angmsdaf|sqsubset|llcorner|vartheta|cupbrcap|lnapprox|Superset|SuchThat|succnsim|succneqq|angmsdag|biguplus|curlyvee|trpezium|Succeeds|NotTilde|bigwedge|angmsdah|angrtvbd|triminus|cwconint|fpartint|lrcorner|smeparsl|subseteq|urcorner|lurdshar|laemptyv|DDotrahd|approxeq|ldrushar|awconint|mapstoup|backcong|shortmid|triangle|geqslant|gesdotol|timesbar|circledR|circledS|setminus|multimap|naturals|scpolint|ncongdot|RightTee|boxminus|gnapprox|boxtimes|andslope|thicksim|angmsdaa|varsigma|cirfnint|rtriltri|angmsdab|rppolint|angmsdac|barwedge|drbkarow|clubsuit|thetasym|bsolhsub|capbrcup|dzigrarr|doteqdot|DotEqual|dotminus|UnderBar|NotEqual|realpart|otimesas|ulcorner|hksearow|hkswarow|parallel|PartialD|elinters|emptyset|plusacir|bbrktbrk|angmsdad|pointint|bigoplus|angmsdae|Precedes|bigsqcup|varkappa|notindot|supseteq|precneqq|precnsim|profalar|profline|profsurf|leqslant|lesdotor|raemptyv|subplus|notnivb|notnivc|subrarr|zigrarr|vzigzag|submult|subedot|Element|between|cirscir|larrbfs|larrsim|lotimes|lbrksld|lbrkslu|lozenge|ldrdhar|dbkarow|bigcirc|epsilon|simrarr|simplus|ltquest|Epsilon|luruhar|gtquest|maltese|npolint|eqcolon|npreceq|bigodot|ddagger|gtrless|bnequiv|harrcir|ddotseq|equivDD|backsim|demptyv|nsqsube|nsqsupe|Upsilon|nsubset|upsilon|minusdu|nsucceq|swarrow|nsupset|coloneq|searrow|boxplus|napprox|natural|asympeq|alefsym|congdot|nearrow|bigstar|diamond|supplus|tritime|LeftTee|nvinfin|triplus|NewLine|nvltrie|nvrtrie|nwarrow|nexists|Diamond|ruluhar|Implies|supmult|angzarr|suplarr|suphsub|questeq|because|digamma|Because|olcross|bemptyv|omicron|Omicron|rotimes|NoBreak|intprod|angrtvb|orderof|uwangle|suphsol|lesdoto|orslope|DownTee|realine|cudarrl|rdldhar|OverBar|supedot|lessdot|supdsub|topfork|succsim|rbrkslu|rbrksld|pertenk|cudarrr|isindot|planckh|lessgtr|pluscir|gesdoto|plussim|plustwo|lesssim|cularrp|rarrsim|Cayleys|notinva|notinvb|notinvc|UpArrow|Uparrow|uparrow|NotLess|dwangle|precsim|Product|curarrm|Cconint|dotplus|rarrbfs|ccupssm|Cedilla|cemptyv|notniva|quatint|frac35|frac38|frac45|frac56|frac58|frac78|tridot|xoplus|gacute|gammad|Gammad|lfisht|lfloor|bigcup|sqsupe|gbreve|Gbreve|lharul|sqsube|sqcups|Gcedil|apacir|llhard|lmidot|Lmidot|lmoust|andand|sqcaps|approx|Abreve|spades|circeq|tprime|divide|topcir|Assign|topbot|gesdot|divonx|xuplus|timesd|gesles|atilde|solbar|SOFTcy|loplus|timesb|lowast|lowbar|dlcorn|dlcrop|softcy|dollar|lparlt|thksim|lrhard|Atilde|lsaquo|smashp|bigvee|thinsp|wreath|bkarow|lsquor|lstrok|Lstrok|lthree|ltimes|ltlarr|DotDot|simdot|ltrPar|weierp|xsqcup|angmsd|sigmav|sigmaf|zeetrf|Zcaron|zcaron|mapsto|vsupne|thetav|cirmid|marker|mcomma|Zacute|vsubnE|there4|gtlPar|vsubne|bottom|gtrarr|SHCHcy|shchcy|midast|midcir|middot|minusb|minusd|gtrdot|bowtie|sfrown|mnplus|models|colone|seswar|Colone|mstpos|searhk|gtrsim|nacute|Nacute|boxbox|telrec|hairsp|Tcedil|nbumpe|scnsim|ncaron|Ncaron|ncedil|Ncedil|hamilt|Scedil|nearhk|hardcy|HARDcy|tcedil|Tcaron|commat|nequiv|nesear|tcaron|target|hearts|nexist|varrho|scedil|Scaron|scaron|hellip|Sacute|sacute|hercon|swnwar|compfn|rtimes|rthree|rsquor|rsaquo|zacute|wedgeq|homtht|barvee|barwed|Barwed|rpargt|horbar|conint|swarhk|roplus|nltrie|hslash|hstrok|Hstrok|rmoust|Conint|bprime|hybull|hyphen|iacute|Iacute|supsup|supsub|supsim|varphi|coprod|brvbar|agrave|Supset|supset|igrave|Igrave|notinE|Agrave|iiiint|iinfin|copysr|wedbar|Verbar|vangrt|becaus|incare|verbar|inodot|bullet|drcorn|intcal|drcrop|cularr|vellip|Utilde|bumpeq|cupcap|dstrok|Dstrok|CupCap|cupcup|cupdot|eacute|Eacute|supdot|iquest|easter|ecaron|Ecaron|ecolon|isinsv|utilde|itilde|Itilde|curarr|succeq|Bumpeq|cacute|ulcrop|nparsl|Cacute|nprcue|egrave|Egrave|nrarrc|nrarrw|subsup|subsub|nrtrie|jsercy|nsccue|Jsercy|kappav|kcedil|Kcedil|subsim|ulcorn|nsimeq|egsdot|veebar|kgreen|capand|elsdot|Subset|subset|curren|aacute|lacute|Lacute|emptyv|ntilde|Ntilde|lagran|lambda|Lambda|capcap|Ugrave|langle|subdot|emsp13|numero|emsp14|nvdash|nvDash|nVdash|nVDash|ugrave|ufisht|nvHarr|larrfs|nvlArr|larrhk|larrlp|larrpl|nvrArr|Udblac|nwarhk|larrtl|nwnear|oacute|Oacute|latail|lAtail|sstarf|lbrace|odblac|Odblac|lbrack|udblac|odsold|eparsl|lcaron|Lcaron|ograve|Ograve|lcedil|Lcedil|Aacute|ssmile|ssetmn|squarf|ldquor|capcup|ominus|cylcty|rharul|eqcirc|dagger|rfloor|rfisht|Dagger|daleth|equals|origof|capdot|equest|dcaron|Dcaron|rdquor|oslash|Oslash|otilde|Otilde|otimes|Otimes|urcrop|Ubreve|ubreve|Yacute|Uacute|uacute|Rcedil|rcedil|urcorn|parsim|Rcaron|Vdashl|rcaron|Tstrok|percnt|period|permil|Exists|yacute|rbrack|rbrace|phmmat|ccaron|Ccaron|planck|ccedil|plankv|tstrok|female|plusdo|plusdu|ffilig|plusmn|ffllig|Ccedil|rAtail|dfisht|bernou|ratail|Rarrtl|rarrtl|angsph|rarrpl|rarrlp|rarrhk|xwedge|xotime|forall|ForAll|Vvdash|vsupnE|preceq|bigcap|frac12|frac13|frac14|primes|rarrfs|prnsim|frac15|Square|frac16|square|lesdot|frac18|frac23|propto|prurel|rarrap|rangle|puncsp|frac25|Racute|qprime|racute|lesges|frac34|abreve|AElig|eqsim|utdot|setmn|urtri|Equal|Uring|seArr|uring|searr|dashv|Dashv|mumap|nabla|iogon|Iogon|sdote|sdotb|scsim|napid|napos|equiv|natur|Acirc|dblac|erarr|nbump|iprod|erDot|ucirc|awint|esdot|angrt|ncong|isinE|scnap|Scirc|scirc|ndash|isins|Ubrcy|nearr|neArr|isinv|nedot|ubrcy|acute|Ycirc|iukcy|Iukcy|xutri|nesim|caret|jcirc|Jcirc|caron|twixt|ddarr|sccue|exist|jmath|sbquo|ngeqq|angst|ccaps|lceil|ngsim|UpTee|delta|Delta|rtrif|nharr|nhArr|nhpar|rtrie|jukcy|Jukcy|kappa|rsquo|Kappa|nlarr|nlArr|TSHcy|rrarr|aogon|Aogon|fflig|xrarr|tshcy|ccirc|nleqq|filig|upsih|nless|dharl|nlsim|fjlig|ropar|nltri|dharr|robrk|roarr|fllig|fltns|roang|rnmid|subnE|subne|lAarr|trisb|Ccirc|acirc|ccups|blank|VDash|forkv|Vdash|langd|cedil|blk12|blk14|laquo|strns|diams|notin|vDash|larrb|blk34|block|disin|uplus|vdash|vBarv|aelig|starf|Wedge|check|xrArr|lates|lbarr|lBarr|notni|lbbrk|bcong|frasl|lbrke|frown|vrtri|vprop|vnsup|gamma|Gamma|wedge|xodot|bdquo|srarr|doteq|ldquo|boxdl|boxdL|gcirc|Gcirc|boxDl|boxDL|boxdr|boxdR|boxDr|TRADE|trade|rlhar|boxDR|vnsub|npart|vltri|rlarr|boxhd|boxhD|nprec|gescc|nrarr|nrArr|boxHd|boxHD|boxhu|boxhU|nrtri|boxHu|clubs|boxHU|times|colon|Colon|gimel|xlArr|Tilde|nsime|tilde|nsmid|nspar|THORN|thorn|xlarr|nsube|nsubE|thkap|xhArr|comma|nsucc|boxul|boxuL|nsupe|nsupE|gneqq|gnsim|boxUl|boxUL|grave|boxur|boxuR|boxUr|boxUR|lescc|angle|bepsi|boxvh|varpi|boxvH|numsp|Theta|gsime|gsiml|theta|boxVh|boxVH|boxvl|gtcir|gtdot|boxvL|boxVl|boxVL|crarr|cross|Cross|nvsim|boxvr|nwarr|nwArr|sqsup|dtdot|Uogon|lhard|lharu|dtrif|ocirc|Ocirc|lhblk|duarr|odash|sqsub|Hacek|sqcup|llarr|duhar|oelig|OElig|ofcir|boxvR|uogon|lltri|boxVr|csube|uuarr|ohbar|csupe|ctdot|olarr|olcir|harrw|oline|sqcap|omacr|Omacr|omega|Omega|boxVR|aleph|lneqq|lnsim|loang|loarr|rharu|lobrk|hcirc|operp|oplus|rhard|Hcirc|orarr|Union|order|ecirc|Ecirc|cuepr|szlig|cuesc|breve|reals|eDDot|Breve|hoarr|lopar|utrif|rdquo|Umacr|umacr|efDot|swArr|ultri|alpha|rceil|ovbar|swarr|Wcirc|wcirc|smtes|smile|bsemi|lrarr|aring|parsl|lrhar|bsime|uhblk|lrtri|cupor|Aring|uharr|uharl|slarr|rbrke|bsolb|lsime|rbbrk|RBarr|lsimg|phone|rBarr|rbarr|icirc|lsquo|Icirc|emacr|Emacr|ratio|simne|plusb|simlE|simgE|simeq|pluse|ltcir|ltdot|empty|xharr|xdtri|iexcl|Alpha|ltrie|rarrw|pound|ltrif|xcirc|bumpe|prcue|bumpE|asymp|amacr|cuvee|Sigma|sigma|iiint|udhar|iiota|ijlig|IJlig|supnE|imacr|Imacr|prime|Prime|image|prnap|eogon|Eogon|rarrc|mdash|mDDot|cuwed|imath|supne|imped|Amacr|udarr|prsim|micro|rarrb|cwint|raquo|infin|eplus|range|rangd|Ucirc|radic|minus|amalg|veeeq|rAarr|epsiv|ycirc|quest|sharp|quot|zwnj|Qscr|race|qscr|Qopf|qopf|qint|rang|Rang|Zscr|zscr|Zopf|zopf|rarr|rArr|Rarr|Pscr|pscr|prop|prod|prnE|prec|ZHcy|zhcy|prap|Zeta|zeta|Popf|popf|Zdot|plus|zdot|Yuml|yuml|phiv|YUcy|yucy|Yscr|yscr|perp|Yopf|yopf|part|para|YIcy|Ouml|rcub|yicy|YAcy|rdca|ouml|osol|Oscr|rdsh|yacy|real|oscr|xvee|andd|rect|andv|Xscr|oror|ordm|ordf|xscr|ange|aopf|Aopf|rHar|Xopf|opar|Oopf|xopf|xnis|rhov|oopf|omid|xmap|oint|apid|apos|ogon|ascr|Ascr|odot|odiv|xcup|xcap|ocir|oast|nvlt|nvle|nvgt|nvge|nvap|Wscr|wscr|auml|ntlg|ntgl|nsup|nsub|nsim|Nscr|nscr|nsce|Wopf|ring|npre|wopf|npar|Auml|Barv|bbrk|Nopf|nopf|nmid|nLtv|beta|ropf|Ropf|Beta|beth|nles|rpar|nleq|bnot|bNot|nldr|NJcy|rscr|Rscr|Vscr|vscr|rsqb|njcy|bopf|nisd|Bopf|rtri|Vopf|nGtv|ngtr|vopf|boxh|boxH|boxv|nges|ngeq|boxV|bscr|scap|Bscr|bsim|Vert|vert|bsol|bull|bump|caps|cdot|ncup|scnE|ncap|nbsp|napE|Cdot|cent|sdot|Vbar|nang|vBar|chcy|Mscr|mscr|sect|semi|CHcy|Mopf|mopf|sext|circ|cire|mldr|mlcp|cirE|comp|shcy|SHcy|vArr|varr|cong|copf|Copf|copy|COPY|malt|male|macr|lvnE|cscr|ltri|sime|ltcc|simg|Cscr|siml|csub|Uuml|lsqb|lsim|uuml|csup|Lscr|lscr|utri|smid|lpar|cups|smte|lozf|darr|Lopf|Uscr|solb|lopf|sopf|Sopf|lneq|uscr|spar|dArr|lnap|Darr|dash|Sqrt|LJcy|ljcy|lHar|dHar|Upsi|upsi|diam|lesg|djcy|DJcy|leqq|dopf|Dopf|dscr|Dscr|dscy|ldsh|ldca|squf|DScy|sscr|Sscr|dsol|lcub|late|star|Star|Uopf|Larr|lArr|larr|uopf|dtri|dzcy|sube|subE|Lang|lang|Kscr|kscr|Kopf|kopf|KJcy|kjcy|KHcy|khcy|DZcy|ecir|edot|eDot|Jscr|jscr|succ|Jopf|jopf|Edot|uHar|emsp|ensp|Iuml|iuml|eopf|isin|Iscr|iscr|Eopf|epar|sung|epsi|escr|sup1|sup2|sup3|Iota|iota|supe|supE|Iopf|iopf|IOcy|iocy|Escr|esim|Esim|imof|Uarr|QUOT|uArr|uarr|euml|IEcy|iecy|Idot|Euml|euro|excl|Hscr|hscr|Hopf|hopf|TScy|tscy|Tscr|hbar|tscr|flat|tbrk|fnof|hArr|harr|half|fopf|Fopf|tdot|gvnE|fork|trie|gtcc|fscr|Fscr|gdot|gsim|Gscr|gscr|Gopf|gopf|gneq|Gdot|tosa|gnap|Topf|topf|geqq|toea|GJcy|gjcy|tint|gesl|mid|Sfr|ggg|top|ges|gla|glE|glj|geq|gne|gEl|gel|gnE|Gcy|gcy|gap|Tfr|tfr|Tcy|tcy|Hat|Tau|Ffr|tau|Tab|hfr|Hfr|ffr|Fcy|fcy|icy|Icy|iff|ETH|eth|ifr|Ifr|Eta|eta|int|Int|Sup|sup|ucy|Ucy|Sum|sum|jcy|ENG|ufr|Ufr|eng|Jcy|jfr|els|ell|egs|Efr|efr|Jfr|uml|kcy|Kcy|Ecy|ecy|kfr|Kfr|lap|Sub|sub|lat|lcy|Lcy|leg|Dot|dot|lEg|leq|les|squ|div|die|lfr|Lfr|lgE|Dfr|dfr|Del|deg|Dcy|dcy|lne|lnE|sol|loz|smt|Cup|lrm|cup|lsh|Lsh|sim|shy|map|Map|mcy|Mcy|mfr|Mfr|mho|gfr|Gfr|sfr|cir|Chi|chi|nap|Cfr|vcy|Vcy|cfr|Scy|scy|ncy|Ncy|vee|Vee|Cap|cap|nfr|scE|sce|Nfr|nge|ngE|nGg|vfr|Vfr|ngt|bot|nGt|nis|niv|Rsh|rsh|nle|nlE|bne|Bfr|bfr|nLl|nlt|nLt|Bcy|bcy|not|Not|rlm|wfr|Wfr|npr|nsc|num|ocy|ast|Ocy|ofr|xfr|Xfr|Ofr|ogt|ohm|apE|olt|Rho|ape|rho|Rfr|rfr|ord|REG|ang|reg|orv|And|and|AMP|Rcy|amp|Afr|ycy|Ycy|yen|yfr|Yfr|rcy|par|pcy|Pcy|pfr|Pfr|phi|Phi|afr|Acy|acy|zcy|Zcy|piv|acE|acd|zfr|Zfr|pre|prE|psi|Psi|qfr|Qfr|zwj|Or|ge|Gg|gt|gg|el|oS|lt|Lt|LT|Re|lg|gl|eg|ne|Im|it|le|DD|wp|wr|nu|Nu|dd|lE|Sc|sc|pi|Pi|ee|af|ll|Ll|rx|gE|xi|pm|Xi|ic|pr|Pr|in|ni|mp|mu|ac|Mu|or|ap|Gt|GT|ii);|&(Aacute|Agrave|Atilde|Ccedil|Eacute|Egrave|Iacute|Igrave|Ntilde|Oacute|Ograve|Oslash|Otilde|Uacute|Ugrave|Yacute|aacute|agrave|atilde|brvbar|ccedil|curren|divide|eacute|egrave|frac12|frac14|frac34|iacute|igrave|iquest|middot|ntilde|oacute|ograve|oslash|otilde|plusmn|uacute|ugrave|yacute|AElig|Acirc|Aring|Ecirc|Icirc|Ocirc|THORN|Ucirc|acirc|acute|aelig|aring|cedil|ecirc|icirc|iexcl|laquo|micro|ocirc|pound|raquo|szlig|thorn|times|ucirc|Auml|COPY|Euml|Iuml|Ouml|QUOT|Uuml|auml|cent|copy|euml|iuml|macr|nbsp|ordf|ordm|ouml|para|quot|sect|sup1|sup2|sup3|uuml|yuml|AMP|ETH|REG|amp|deg|eth|not|reg|shy|uml|yen|GT|LT|gt|lt)(?!;)([=a-zA-Z0-9]?)|&#([0-9]+)(;?)|&#[xX]([a-fA-F0-9]+)(;?)|&([0-9a-zA-Z]+)/g;
  6070. var decodeMap = {'aacute':'\xE1','Aacute':'\xC1','abreve':'\u0103','Abreve':'\u0102','ac':'\u223E','acd':'\u223F','acE':'\u223E\u0333','acirc':'\xE2','Acirc':'\xC2','acute':'\xB4','acy':'\u0430','Acy':'\u0410','aelig':'\xE6','AElig':'\xC6','af':'\u2061','afr':'\uD835\uDD1E','Afr':'\uD835\uDD04','agrave':'\xE0','Agrave':'\xC0','alefsym':'\u2135','aleph':'\u2135','alpha':'\u03B1','Alpha':'\u0391','amacr':'\u0101','Amacr':'\u0100','amalg':'\u2A3F','amp':'&','AMP':'&','and':'\u2227','And':'\u2A53','andand':'\u2A55','andd':'\u2A5C','andslope':'\u2A58','andv':'\u2A5A','ang':'\u2220','ange':'\u29A4','angle':'\u2220','angmsd':'\u2221','angmsdaa':'\u29A8','angmsdab':'\u29A9','angmsdac':'\u29AA','angmsdad':'\u29AB','angmsdae':'\u29AC','angmsdaf':'\u29AD','angmsdag':'\u29AE','angmsdah':'\u29AF','angrt':'\u221F','angrtvb':'\u22BE','angrtvbd':'\u299D','angsph':'\u2222','angst':'\xC5','angzarr':'\u237C','aogon':'\u0105','Aogon':'\u0104','aopf':'\uD835\uDD52','Aopf':'\uD835\uDD38','ap':'\u2248','apacir':'\u2A6F','ape':'\u224A','apE':'\u2A70','apid':'\u224B','apos':'\'','ApplyFunction':'\u2061','approx':'\u2248','approxeq':'\u224A','aring':'\xE5','Aring':'\xC5','ascr':'\uD835\uDCB6','Ascr':'\uD835\uDC9C','Assign':'\u2254','ast':'*','asymp':'\u2248','asympeq':'\u224D','atilde':'\xE3','Atilde':'\xC3','auml':'\xE4','Auml':'\xC4','awconint':'\u2233','awint':'\u2A11','backcong':'\u224C','backepsilon':'\u03F6','backprime':'\u2035','backsim':'\u223D','backsimeq':'\u22CD','Backslash':'\u2216','Barv':'\u2AE7','barvee':'\u22BD','barwed':'\u2305','Barwed':'\u2306','barwedge':'\u2305','bbrk':'\u23B5','bbrktbrk':'\u23B6','bcong':'\u224C','bcy':'\u0431','Bcy':'\u0411','bdquo':'\u201E','becaus':'\u2235','because':'\u2235','Because':'\u2235','bemptyv':'\u29B0','bepsi':'\u03F6','bernou':'\u212C','Bernoullis':'\u212C','beta':'\u03B2','Beta':'\u0392','beth':'\u2136','between':'\u226C','bfr':'\uD835\uDD1F','Bfr':'\uD835\uDD05','bigcap':'\u22C2','bigcirc':'\u25EF','bigcup':'\u22C3','bigodot':'\u2A00','bigoplus':'\u2A01','bigotimes':'\u2A02','bigsqcup':'\u2A06','bigstar':'\u2605','bigtriangledown':'\u25BD','bigtriangleup':'\u25B3','biguplus':'\u2A04','bigvee':'\u22C1','bigwedge':'\u22C0','bkarow':'\u290D','blacklozenge':'\u29EB','blacksquare':'\u25AA','blacktriangle':'\u25B4','blacktriangledown':'\u25BE','blacktriangleleft':'\u25C2','blacktriangleright':'\u25B8','blank':'\u2423','blk12':'\u2592','blk14':'\u2591','blk34':'\u2593','block':'\u2588','bne':'=\u20E5','bnequiv':'\u2261\u20E5','bnot':'\u2310','bNot':'\u2AED','bopf':'\uD835\uDD53','Bopf':'\uD835\uDD39','bot':'\u22A5','bottom':'\u22A5','bowtie':'\u22C8','boxbox':'\u29C9','boxdl':'\u2510','boxdL':'\u2555','boxDl':'\u2556','boxDL':'\u2557','boxdr':'\u250C','boxdR':'\u2552','boxDr':'\u2553','boxDR':'\u2554','boxh':'\u2500','boxH':'\u2550','boxhd':'\u252C','boxhD':'\u2565','boxHd':'\u2564','boxHD':'\u2566','boxhu':'\u2534','boxhU':'\u2568','boxHu':'\u2567','boxHU':'\u2569','boxminus':'\u229F','boxplus':'\u229E','boxtimes':'\u22A0','boxul':'\u2518','boxuL':'\u255B','boxUl':'\u255C','boxUL':'\u255D','boxur':'\u2514','boxuR':'\u2558','boxUr':'\u2559','boxUR':'\u255A','boxv':'\u2502','boxV':'\u2551','boxvh':'\u253C','boxvH':'\u256A','boxVh':'\u256B','boxVH':'\u256C','boxvl':'\u2524','boxvL':'\u2561','boxVl':'\u2562','boxVL':'\u2563','boxvr':'\u251C','boxvR':'\u255E','boxVr':'\u255F','boxVR':'\u2560','bprime':'\u2035','breve':'\u02D8','Breve':'\u02D8','brvbar':'\xA6','bscr':'\uD835\uDCB7','Bscr':'\u212C','bsemi':'\u204F','bsim':'\u223D','bsime':'\u22CD','bsol':'\\','bsolb':'\u29C5','bsolhsub':'\u27C8','bull':'\u2022','bullet':'\u2022','bump':'\u224E','bumpe':'\u224F','bumpE':'\u2AAE','bumpeq':'\u224F','Bumpeq':'\u224E','cacute':'\u0107','Cacute':'\u0106','cap':'\u2229','Cap':'\u22D2','capand':'\u2A44','capbrcup':'\u2A49','capcap':'\u2A4B','capcup':'\u2A47','capdot':'\u2A40','CapitalDifferentialD':'\u2145','caps':'\u2229\uFE00','caret':'\u2041','caron':'\u02C7','Cayleys':'\u212D','ccaps':'\u2A4D','ccaron':'\u010D','Ccaron':'\u010C','ccedil':'\xE7','Ccedil':'\xC7','ccirc':'\u0109','Ccirc':'\u0108','Cconint':'\u2230','ccups':'\u2A4C','ccupssm':'\u2A50','cdot':'\u010B','Cdot':'\u010A','cedil':'\xB8','Cedilla':'\xB8','cemptyv':'\u29B2','cent':'\xA2','centerdot':'\xB7','CenterDot':'\xB7','cfr':'\uD835\uDD20','Cfr':'\u212D','chcy':'\u0447','CHcy':'\u0427','check':'\u2713','checkmark':'\u2713','chi':'\u03C7','Chi':'\u03A7','cir':'\u25CB','circ':'\u02C6','circeq':'\u2257','circlearrowleft':'\u21BA','circlearrowright':'\u21BB','circledast':'\u229B','circledcirc':'\u229A','circleddash':'\u229D','CircleDot':'\u2299','circledR':'\xAE','circledS':'\u24C8','CircleMinus':'\u2296','CirclePlus':'\u2295','CircleTimes':'\u2297','cire':'\u2257','cirE':'\u29C3','cirfnint':'\u2A10','cirmid':'\u2AEF','cirscir':'\u29C2','ClockwiseContourIntegral':'\u2232','CloseCurlyDoubleQuote':'\u201D','CloseCurlyQuote':'\u2019','clubs':'\u2663','clubsuit':'\u2663','colon':':','Colon':'\u2237','colone':'\u2254','Colone':'\u2A74','coloneq':'\u2254','comma':',','commat':'@','comp':'\u2201','compfn':'\u2218','complement':'\u2201','complexes':'\u2102','cong':'\u2245','congdot':'\u2A6D','Congruent':'\u2261','conint':'\u222E','Conint':'\u222F','ContourIntegral':'\u222E','copf':'\uD835\uDD54','Copf':'\u2102','coprod':'\u2210','Coproduct':'\u2210','copy':'\xA9','COPY':'\xA9','copysr':'\u2117','CounterClockwiseContourIntegral':'\u2233','crarr':'\u21B5','cross':'\u2717','Cross':'\u2A2F','cscr':'\uD835\uDCB8','Cscr':'\uD835\uDC9E','csub':'\u2ACF','csube':'\u2AD1','csup':'\u2AD0','csupe':'\u2AD2','ctdot':'\u22EF','cudarrl':'\u2938','cudarrr':'\u2935','cuepr':'\u22DE','cuesc':'\u22DF','cularr':'\u21B6','cularrp':'\u293D','cup':'\u222A','Cup':'\u22D3','cupbrcap':'\u2A48','cupcap':'\u2A46','CupCap':'\u224D','cupcup':'\u2A4A','cupdot':'\u228D','cupor':'\u2A45','cups':'\u222A\uFE00','curarr':'\u21B7','curarrm':'\u293C','curlyeqprec':'\u22DE','curlyeqsucc':'\u22DF','curlyvee':'\u22CE','curlywedge':'\u22CF','curren':'\xA4','curvearrowleft':'\u21B6','curvearrowright':'\u21B7','cuvee':'\u22CE','cuwed':'\u22CF','cwconint':'\u2232','cwint':'\u2231','cylcty':'\u232D','dagger':'\u2020','Dagger':'\u2021','daleth':'\u2138','darr':'\u2193','dArr':'\u21D3','Darr':'\u21A1','dash':'\u2010','dashv':'\u22A3','Dashv':'\u2AE4','dbkarow':'\u290F','dblac':'\u02DD','dcaron':'\u010F','Dcaron':'\u010E','dcy':'\u0434','Dcy':'\u0414','dd':'\u2146','DD':'\u2145','ddagger':'\u2021','ddarr':'\u21CA','DDotrahd':'\u2911','ddotseq':'\u2A77','deg':'\xB0','Del':'\u2207','delta':'\u03B4','Delta':'\u0394','demptyv':'\u29B1','dfisht':'\u297F','dfr':'\uD835\uDD21','Dfr':'\uD835\uDD07','dHar':'\u2965','dharl':'\u21C3','dharr':'\u21C2','DiacriticalAcute':'\xB4','DiacriticalDot':'\u02D9','DiacriticalDoubleAcute':'\u02DD','DiacriticalGrave':'`','DiacriticalTilde':'\u02DC','diam':'\u22C4','diamond':'\u22C4','Diamond':'\u22C4','diamondsuit':'\u2666','diams':'\u2666','die':'\xA8','DifferentialD':'\u2146','digamma':'\u03DD','disin':'\u22F2','div':'\xF7','divide':'\xF7','divideontimes':'\u22C7','divonx':'\u22C7','djcy':'\u0452','DJcy':'\u0402','dlcorn':'\u231E','dlcrop':'\u230D','dollar':'$','dopf':'\uD835\uDD55','Dopf':'\uD835\uDD3B','dot':'\u02D9','Dot':'\xA8','DotDot':'\u20DC','doteq':'\u2250','doteqdot':'\u2251','DotEqual':'\u2250','dotminus':'\u2238','dotplus':'\u2214','dotsquare':'\u22A1','doublebarwedge':'\u2306','DoubleContourIntegral':'\u222F','DoubleDot':'\xA8','DoubleDownArrow':'\u21D3','DoubleLeftArrow':'\u21D0','DoubleLeftRightArrow':'\u21D4','DoubleLeftTee':'\u2AE4','DoubleLongLeftArrow':'\u27F8','DoubleLongLeftRightArrow':'\u27FA','DoubleLongRightArrow':'\u27F9','DoubleRightArrow':'\u21D2','DoubleRightTee':'\u22A8','DoubleUpArrow':'\u21D1','DoubleUpDownArrow':'\u21D5','DoubleVerticalBar':'\u2225','downarrow':'\u2193','Downarrow':'\u21D3','DownArrow':'\u2193','DownArrowBar':'\u2913','DownArrowUpArrow':'\u21F5','DownBreve':'\u0311','downdownarrows':'\u21CA','downharpoonleft':'\u21C3','downharpoonright':'\u21C2','DownLeftRightVector':'\u2950','DownLeftTeeVector':'\u295E','DownLeftVector':'\u21BD','DownLeftVectorBar':'\u2956','DownRightTeeVector':'\u295F','DownRightVector':'\u21C1','DownRightVectorBar':'\u2957','DownTee':'\u22A4','DownTeeArrow':'\u21A7','drbkarow':'\u2910','drcorn':'\u231F','drcrop':'\u230C','dscr':'\uD835\uDCB9','Dscr':'\uD835\uDC9F','dscy':'\u0455','DScy':'\u0405','dsol':'\u29F6','dstrok':'\u0111','Dstrok':'\u0110','dtdot':'\u22F1','dtri':'\u25BF','dtrif':'\u25BE','duarr':'\u21F5','duhar':'\u296F','dwangle':'\u29A6','dzcy':'\u045F','DZcy':'\u040F','dzigrarr':'\u27FF','eacute':'\xE9','Eacute':'\xC9','easter':'\u2A6E','ecaron':'\u011B','Ecaron':'\u011A','ecir':'\u2256','ecirc':'\xEA','Ecirc':'\xCA','ecolon':'\u2255','ecy':'\u044D','Ecy':'\u042D','eDDot':'\u2A77','edot':'\u0117','eDot':'\u2251','Edot':'\u0116','ee':'\u2147','efDot':'\u2252','efr':'\uD835\uDD22','Efr':'\uD835\uDD08','eg':'\u2A9A','egrave':'\xE8','Egrave':'\xC8','egs':'\u2A96','egsdot':'\u2A98','el':'\u2A99','Element':'\u2208','elinters':'\u23E7','ell':'\u2113','els':'\u2A95','elsdot':'\u2A97','emacr':'\u0113','Emacr':'\u0112','empty':'\u2205','emptyset':'\u2205','EmptySmallSquare':'\u25FB','emptyv':'\u2205','EmptyVerySmallSquare':'\u25AB','emsp':'\u2003','emsp13':'\u2004','emsp14':'\u2005','eng':'\u014B','ENG':'\u014A','ensp':'\u2002','eogon':'\u0119','Eogon':'\u0118','eopf':'\uD835\uDD56','Eopf':'\uD835\uDD3C','epar':'\u22D5','eparsl':'\u29E3','eplus':'\u2A71','epsi':'\u03B5','epsilon':'\u03B5','Epsilon':'\u0395','epsiv':'\u03F5','eqcirc':'\u2256','eqcolon':'\u2255','eqsim':'\u2242','eqslantgtr':'\u2A96','eqslantless':'\u2A95','Equal':'\u2A75','equals':'=','EqualTilde':'\u2242','equest':'\u225F','Equilibrium':'\u21CC','equiv':'\u2261','equivDD':'\u2A78','eqvparsl':'\u29E5','erarr':'\u2971','erDot':'\u2253','escr':'\u212F','Escr':'\u2130','esdot':'\u2250','esim':'\u2242','Esim':'\u2A73','eta':'\u03B7','Eta':'\u0397','eth':'\xF0','ETH':'\xD0','euml':'\xEB','Euml':'\xCB','euro':'\u20AC','excl':'!','exist':'\u2203','Exists':'\u2203','expectation':'\u2130','exponentiale':'\u2147','ExponentialE':'\u2147','fallingdotseq':'\u2252','fcy':'\u0444','Fcy':'\u0424','female':'\u2640','ffilig':'\uFB03','fflig':'\uFB00','ffllig':'\uFB04','ffr':'\uD835\uDD23','Ffr':'\uD835\uDD09','filig':'\uFB01','FilledSmallSquare':'\u25FC','FilledVerySmallSquare':'\u25AA','fjlig':'fj','flat':'\u266D','fllig':'\uFB02','fltns':'\u25B1','fnof':'\u0192','fopf':'\uD835\uDD57','Fopf':'\uD835\uDD3D','forall':'\u2200','ForAll':'\u2200','fork':'\u22D4','forkv':'\u2AD9','Fouriertrf':'\u2131','fpartint':'\u2A0D','frac12':'\xBD','frac13':'\u2153','frac14':'\xBC','frac15':'\u2155','frac16':'\u2159','frac18':'\u215B','frac23':'\u2154','frac25':'\u2156','frac34':'\xBE','frac35':'\u2157','frac38':'\u215C','frac45':'\u2158','frac56':'\u215A','frac58':'\u215D','frac78':'\u215E','frasl':'\u2044','frown':'\u2322','fscr':'\uD835\uDCBB','Fscr':'\u2131','gacute':'\u01F5','gamma':'\u03B3','Gamma':'\u0393','gammad':'\u03DD','Gammad':'\u03DC','gap':'\u2A86','gbreve':'\u011F','Gbreve':'\u011E','Gcedil':'\u0122','gcirc':'\u011D','Gcirc':'\u011C','gcy':'\u0433','Gcy':'\u0413','gdot':'\u0121','Gdot':'\u0120','ge':'\u2265','gE':'\u2267','gel':'\u22DB','gEl':'\u2A8C','geq':'\u2265','geqq':'\u2267','geqslant':'\u2A7E','ges':'\u2A7E','gescc':'\u2AA9','gesdot':'\u2A80','gesdoto':'\u2A82','gesdotol':'\u2A84','gesl':'\u22DB\uFE00','gesles':'\u2A94','gfr':'\uD835\uDD24','Gfr':'\uD835\uDD0A','gg':'\u226B','Gg':'\u22D9','ggg':'\u22D9','gimel':'\u2137','gjcy':'\u0453','GJcy':'\u0403','gl':'\u2277','gla':'\u2AA5','glE':'\u2A92','glj':'\u2AA4','gnap':'\u2A8A','gnapprox':'\u2A8A','gne':'\u2A88','gnE':'\u2269','gneq':'\u2A88','gneqq':'\u2269','gnsim':'\u22E7','gopf':'\uD835\uDD58','Gopf':'\uD835\uDD3E','grave':'`','GreaterEqual':'\u2265','GreaterEqualLess':'\u22DB','GreaterFullEqual':'\u2267','GreaterGreater':'\u2AA2','GreaterLess':'\u2277','GreaterSlantEqual':'\u2A7E','GreaterTilde':'\u2273','gscr':'\u210A','Gscr':'\uD835\uDCA2','gsim':'\u2273','gsime':'\u2A8E','gsiml':'\u2A90','gt':'>','Gt':'\u226B','GT':'>','gtcc':'\u2AA7','gtcir':'\u2A7A','gtdot':'\u22D7','gtlPar':'\u2995','gtquest':'\u2A7C','gtrapprox':'\u2A86','gtrarr':'\u2978','gtrdot':'\u22D7','gtreqless':'\u22DB','gtreqqless':'\u2A8C','gtrless':'\u2277','gtrsim':'\u2273','gvertneqq':'\u2269\uFE00','gvnE':'\u2269\uFE00','Hacek':'\u02C7','hairsp':'\u200A','half':'\xBD','hamilt':'\u210B','hardcy':'\u044A','HARDcy':'\u042A','harr':'\u2194','hArr':'\u21D4','harrcir':'\u2948','harrw':'\u21AD','Hat':'^','hbar':'\u210F','hcirc':'\u0125','Hcirc':'\u0124','hearts':'\u2665','heartsuit':'\u2665','hellip':'\u2026','hercon':'\u22B9','hfr':'\uD835\uDD25','Hfr':'\u210C','HilbertSpace':'\u210B','hksearow':'\u2925','hkswarow':'\u2926','hoarr':'\u21FF','homtht':'\u223B','hookleftarrow':'\u21A9','hookrightarrow':'\u21AA','hopf':'\uD835\uDD59','Hopf':'\u210D','horbar':'\u2015','HorizontalLine':'\u2500','hscr':'\uD835\uDCBD','Hscr':'\u210B','hslash':'\u210F','hstrok':'\u0127','Hstrok':'\u0126','HumpDownHump':'\u224E','HumpEqual':'\u224F','hybull':'\u2043','hyphen':'\u2010','iacute':'\xED','Iacute':'\xCD','ic':'\u2063','icirc':'\xEE','Icirc':'\xCE','icy':'\u0438','Icy':'\u0418','Idot':'\u0130','iecy':'\u0435','IEcy':'\u0415','iexcl':'\xA1','iff':'\u21D4','ifr':'\uD835\uDD26','Ifr':'\u2111','igrave':'\xEC','Igrave':'\xCC','ii':'\u2148','iiiint':'\u2A0C','iiint':'\u222D','iinfin':'\u29DC','iiota':'\u2129','ijlig':'\u0133','IJlig':'\u0132','Im':'\u2111','imacr':'\u012B','Imacr':'\u012A','image':'\u2111','ImaginaryI':'\u2148','imagline':'\u2110','imagpart':'\u2111','imath':'\u0131','imof':'\u22B7','imped':'\u01B5','Implies':'\u21D2','in':'\u2208','incare':'\u2105','infin':'\u221E','infintie':'\u29DD','inodot':'\u0131','int':'\u222B','Int':'\u222C','intcal':'\u22BA','integers':'\u2124','Integral':'\u222B','intercal':'\u22BA','Intersection':'\u22C2','intlarhk':'\u2A17','intprod':'\u2A3C','InvisibleComma':'\u2063','InvisibleTimes':'\u2062','iocy':'\u0451','IOcy':'\u0401','iogon':'\u012F','Iogon':'\u012E','iopf':'\uD835\uDD5A','Iopf':'\uD835\uDD40','iota':'\u03B9','Iota':'\u0399','iprod':'\u2A3C','iquest':'\xBF','iscr':'\uD835\uDCBE','Iscr':'\u2110','isin':'\u2208','isindot':'\u22F5','isinE':'\u22F9','isins':'\u22F4','isinsv':'\u22F3','isinv':'\u2208','it':'\u2062','itilde':'\u0129','Itilde':'\u0128','iukcy':'\u0456','Iukcy':'\u0406','iuml':'\xEF','Iuml':'\xCF','jcirc':'\u0135','Jcirc':'\u0134','jcy':'\u0439','Jcy':'\u0419','jfr':'\uD835\uDD27','Jfr':'\uD835\uDD0D','jmath':'\u0237','jopf':'\uD835\uDD5B','Jopf':'\uD835\uDD41','jscr':'\uD835\uDCBF','Jscr':'\uD835\uDCA5','jsercy':'\u0458','Jsercy':'\u0408','jukcy':'\u0454','Jukcy':'\u0404','kappa':'\u03BA','Kappa':'\u039A','kappav':'\u03F0','kcedil':'\u0137','Kcedil':'\u0136','kcy':'\u043A','Kcy':'\u041A','kfr':'\uD835\uDD28','Kfr':'\uD835\uDD0E','kgreen':'\u0138','khcy':'\u0445','KHcy':'\u0425','kjcy':'\u045C','KJcy':'\u040C','kopf':'\uD835\uDD5C','Kopf':'\uD835\uDD42','kscr':'\uD835\uDCC0','Kscr':'\uD835\uDCA6','lAarr':'\u21DA','lacute':'\u013A','Lacute':'\u0139','laemptyv':'\u29B4','lagran':'\u2112','lambda':'\u03BB','Lambda':'\u039B','lang':'\u27E8','Lang':'\u27EA','langd':'\u2991','langle':'\u27E8','lap':'\u2A85','Laplacetrf':'\u2112','laquo':'\xAB','larr':'\u2190','lArr':'\u21D0','Larr':'\u219E','larrb':'\u21E4','larrbfs':'\u291F','larrfs':'\u291D','larrhk':'\u21A9','larrlp':'\u21AB','larrpl':'\u2939','larrsim':'\u2973','larrtl':'\u21A2','lat':'\u2AAB','latail':'\u2919','lAtail':'\u291B','late':'\u2AAD','lates':'\u2AAD\uFE00','lbarr':'\u290C','lBarr':'\u290E','lbbrk':'\u2772','lbrace':'{','lbrack':'[','lbrke':'\u298B','lbrksld':'\u298F','lbrkslu':'\u298D','lcaron':'\u013E','Lcaron':'\u013D','lcedil':'\u013C','Lcedil':'\u013B','lceil':'\u2308','lcub':'{','lcy':'\u043B','Lcy':'\u041B','ldca':'\u2936','ldquo':'\u201C','ldquor':'\u201E','ldrdhar':'\u2967','ldrushar':'\u294B','ldsh':'\u21B2','le':'\u2264','lE':'\u2266','LeftAngleBracket':'\u27E8','leftarrow':'\u2190','Leftarrow':'\u21D0','LeftArrow':'\u2190','LeftArrowBar':'\u21E4','LeftArrowRightArrow':'\u21C6','leftarrowtail':'\u21A2','LeftCeiling':'\u2308','LeftDoubleBracket':'\u27E6','LeftDownTeeVector':'\u2961','LeftDownVector':'\u21C3','LeftDownVectorBar':'\u2959','LeftFloor':'\u230A','leftharpoondown':'\u21BD','leftharpoonup':'\u21BC','leftleftarrows':'\u21C7','leftrightarrow':'\u2194','Leftrightarrow':'\u21D4','LeftRightArrow':'\u2194','leftrightarrows':'\u21C6','leftrightharpoons':'\u21CB','leftrightsquigarrow':'\u21AD','LeftRightVector':'\u294E','LeftTee':'\u22A3','LeftTeeArrow':'\u21A4','LeftTeeVector':'\u295A','leftthreetimes':'\u22CB','LeftTriangle':'\u22B2','LeftTriangleBar':'\u29CF','LeftTriangleEqual':'\u22B4','LeftUpDownVector':'\u2951','LeftUpTeeVector':'\u2960','LeftUpVector':'\u21BF','LeftUpVectorBar':'\u2958','LeftVector':'\u21BC','LeftVectorBar':'\u2952','leg':'\u22DA','lEg':'\u2A8B','leq':'\u2264','leqq':'\u2266','leqslant':'\u2A7D','les':'\u2A7D','lescc':'\u2AA8','lesdot':'\u2A7F','lesdoto':'\u2A81','lesdotor':'\u2A83','lesg':'\u22DA\uFE00','lesges':'\u2A93','lessapprox':'\u2A85','lessdot':'\u22D6','lesseqgtr':'\u22DA','lesseqqgtr':'\u2A8B','LessEqualGreater':'\u22DA','LessFullEqual':'\u2266','LessGreater':'\u2276','lessgtr':'\u2276','LessLess':'\u2AA1','lesssim':'\u2272','LessSlantEqual':'\u2A7D','LessTilde':'\u2272','lfisht':'\u297C','lfloor':'\u230A','lfr':'\uD835\uDD29','Lfr':'\uD835\uDD0F','lg':'\u2276','lgE':'\u2A91','lHar':'\u2962','lhard':'\u21BD','lharu':'\u21BC','lharul':'\u296A','lhblk':'\u2584','ljcy':'\u0459','LJcy':'\u0409','ll':'\u226A','Ll':'\u22D8','llarr':'\u21C7','llcorner':'\u231E','Lleftarrow':'\u21DA','llhard':'\u296B','lltri':'\u25FA','lmidot':'\u0140','Lmidot':'\u013F','lmoust':'\u23B0','lmoustache':'\u23B0','lnap':'\u2A89','lnapprox':'\u2A89','lne':'\u2A87','lnE':'\u2268','lneq':'\u2A87','lneqq':'\u2268','lnsim':'\u22E6','loang':'\u27EC','loarr':'\u21FD','lobrk':'\u27E6','longleftarrow':'\u27F5','Longleftarrow':'\u27F8','LongLeftArrow':'\u27F5','longleftrightarrow':'\u27F7','Longleftrightarrow':'\u27FA','LongLeftRightArrow':'\u27F7','longmapsto':'\u27FC','longrightarrow':'\u27F6','Longrightarrow':'\u27F9','LongRightArrow':'\u27F6','looparrowleft':'\u21AB','looparrowright':'\u21AC','lopar':'\u2985','lopf':'\uD835\uDD5D','Lopf':'\uD835\uDD43','loplus':'\u2A2D','lotimes':'\u2A34','lowast':'\u2217','lowbar':'_','LowerLeftArrow':'\u2199','LowerRightArrow':'\u2198','loz':'\u25CA','lozenge':'\u25CA','lozf':'\u29EB','lpar':'(','lparlt':'\u2993','lrarr':'\u21C6','lrcorner':'\u231F','lrhar':'\u21CB','lrhard':'\u296D','lrm':'\u200E','lrtri':'\u22BF','lsaquo':'\u2039','lscr':'\uD835\uDCC1','Lscr':'\u2112','lsh':'\u21B0','Lsh':'\u21B0','lsim':'\u2272','lsime':'\u2A8D','lsimg':'\u2A8F','lsqb':'[','lsquo':'\u2018','lsquor':'\u201A','lstrok':'\u0142','Lstrok':'\u0141','lt':'<','Lt':'\u226A','LT':'<','ltcc':'\u2AA6','ltcir':'\u2A79','ltdot':'\u22D6','lthree':'\u22CB','ltimes':'\u22C9','ltlarr':'\u2976','ltquest':'\u2A7B','ltri':'\u25C3','ltrie':'\u22B4','ltrif':'\u25C2','ltrPar':'\u2996','lurdshar':'\u294A','luruhar':'\u2966','lvertneqq':'\u2268\uFE00','lvnE':'\u2268\uFE00','macr':'\xAF','male':'\u2642','malt':'\u2720','maltese':'\u2720','map':'\u21A6','Map':'\u2905','mapsto':'\u21A6','mapstodown':'\u21A7','mapstoleft':'\u21A4','mapstoup':'\u21A5','marker':'\u25AE','mcomma':'\u2A29','mcy':'\u043C','Mcy':'\u041C','mdash':'\u2014','mDDot':'\u223A','measuredangle':'\u2221','MediumSpace':'\u205F','Mellintrf':'\u2133','mfr':'\uD835\uDD2A','Mfr':'\uD835\uDD10','mho':'\u2127','micro':'\xB5','mid':'\u2223','midast':'*','midcir':'\u2AF0','middot':'\xB7','minus':'\u2212','minusb':'\u229F','minusd':'\u2238','minusdu':'\u2A2A','MinusPlus':'\u2213','mlcp':'\u2ADB','mldr':'\u2026','mnplus':'\u2213','models':'\u22A7','mopf':'\uD835\uDD5E','Mopf':'\uD835\uDD44','mp':'\u2213','mscr':'\uD835\uDCC2','Mscr':'\u2133','mstpos':'\u223E','mu':'\u03BC','Mu':'\u039C','multimap':'\u22B8','mumap':'\u22B8','nabla':'\u2207','nacute':'\u0144','Nacute':'\u0143','nang':'\u2220\u20D2','nap':'\u2249','napE':'\u2A70\u0338','napid':'\u224B\u0338','napos':'\u0149','napprox':'\u2249','natur':'\u266E','natural':'\u266E','naturals':'\u2115','nbsp':'\xA0','nbump':'\u224E\u0338','nbumpe':'\u224F\u0338','ncap':'\u2A43','ncaron':'\u0148','Ncaron':'\u0147','ncedil':'\u0146','Ncedil':'\u0145','ncong':'\u2247','ncongdot':'\u2A6D\u0338','ncup':'\u2A42','ncy':'\u043D','Ncy':'\u041D','ndash':'\u2013','ne':'\u2260','nearhk':'\u2924','nearr':'\u2197','neArr':'\u21D7','nearrow':'\u2197','nedot':'\u2250\u0338','NegativeMediumSpace':'\u200B','NegativeThickSpace':'\u200B','NegativeThinSpace':'\u200B','NegativeVeryThinSpace':'\u200B','nequiv':'\u2262','nesear':'\u2928','nesim':'\u2242\u0338','NestedGreaterGreater':'\u226B','NestedLessLess':'\u226A','NewLine':'\n','nexist':'\u2204','nexists':'\u2204','nfr':'\uD835\uDD2B','Nfr':'\uD835\uDD11','nge':'\u2271','ngE':'\u2267\u0338','ngeq':'\u2271','ngeqq':'\u2267\u0338','ngeqslant':'\u2A7E\u0338','nges':'\u2A7E\u0338','nGg':'\u22D9\u0338','ngsim':'\u2275','ngt':'\u226F','nGt':'\u226B\u20D2','ngtr':'\u226F','nGtv':'\u226B\u0338','nharr':'\u21AE','nhArr':'\u21CE','nhpar':'\u2AF2','ni':'\u220B','nis':'\u22FC','nisd':'\u22FA','niv':'\u220B','njcy':'\u045A','NJcy':'\u040A','nlarr':'\u219A','nlArr':'\u21CD','nldr':'\u2025','nle':'\u2270','nlE':'\u2266\u0338','nleftarrow':'\u219A','nLeftarrow':'\u21CD','nleftrightarrow':'\u21AE','nLeftrightarrow':'\u21CE','nleq':'\u2270','nleqq':'\u2266\u0338','nleqslant':'\u2A7D\u0338','nles':'\u2A7D\u0338','nless':'\u226E','nLl':'\u22D8\u0338','nlsim':'\u2274','nlt':'\u226E','nLt':'\u226A\u20D2','nltri':'\u22EA','nltrie':'\u22EC','nLtv':'\u226A\u0338','nmid':'\u2224','NoBreak':'\u2060','NonBreakingSpace':'\xA0','nopf':'\uD835\uDD5F','Nopf':'\u2115','not':'\xAC','Not':'\u2AEC','NotCongruent':'\u2262','NotCupCap':'\u226D','NotDoubleVerticalBar':'\u2226','NotElement':'\u2209','NotEqual':'\u2260','NotEqualTilde':'\u2242\u0338','NotExists':'\u2204','NotGreater':'\u226F','NotGreaterEqual':'\u2271','NotGreaterFullEqual':'\u2267\u0338','NotGreaterGreater':'\u226B\u0338','NotGreaterLess':'\u2279','NotGreaterSlantEqual':'\u2A7E\u0338','NotGreaterTilde':'\u2275','NotHumpDownHump':'\u224E\u0338','NotHumpEqual':'\u224F\u0338','notin':'\u2209','notindot':'\u22F5\u0338','notinE':'\u22F9\u0338','notinva':'\u2209','notinvb':'\u22F7','notinvc':'\u22F6','NotLeftTriangle':'\u22EA','NotLeftTriangleBar':'\u29CF\u0338','NotLeftTriangleEqual':'\u22EC','NotLess':'\u226E','NotLessEqual':'\u2270','NotLessGreater':'\u2278','NotLessLess':'\u226A\u0338','NotLessSlantEqual':'\u2A7D\u0338','NotLessTilde':'\u2274','NotNestedGreaterGreater':'\u2AA2\u0338','NotNestedLessLess':'\u2AA1\u0338','notni':'\u220C','notniva':'\u220C','notnivb':'\u22FE','notnivc':'\u22FD','NotPrecedes':'\u2280','NotPrecedesEqual':'\u2AAF\u0338','NotPrecedesSlantEqual':'\u22E0','NotReverseElement':'\u220C','NotRightTriangle':'\u22EB','NotRightTriangleBar':'\u29D0\u0338','NotRightTriangleEqual':'\u22ED','NotSquareSubset':'\u228F\u0338','NotSquareSubsetEqual':'\u22E2','NotSquareSuperset':'\u2290\u0338','NotSquareSupersetEqual':'\u22E3','NotSubset':'\u2282\u20D2','NotSubsetEqual':'\u2288','NotSucceeds':'\u2281','NotSucceedsEqual':'\u2AB0\u0338','NotSucceedsSlantEqual':'\u22E1','NotSucceedsTilde':'\u227F\u0338','NotSuperset':'\u2283\u20D2','NotSupersetEqual':'\u2289','NotTilde':'\u2241','NotTildeEqual':'\u2244','NotTildeFullEqual':'\u2247','NotTildeTilde':'\u2249','NotVerticalBar':'\u2224','npar':'\u2226','nparallel':'\u2226','nparsl':'\u2AFD\u20E5','npart':'\u2202\u0338','npolint':'\u2A14','npr':'\u2280','nprcue':'\u22E0','npre':'\u2AAF\u0338','nprec':'\u2280','npreceq':'\u2AAF\u0338','nrarr':'\u219B','nrArr':'\u21CF','nrarrc':'\u2933\u0338','nrarrw':'\u219D\u0338','nrightarrow':'\u219B','nRightarrow':'\u21CF','nrtri':'\u22EB','nrtrie':'\u22ED','nsc':'\u2281','nsccue':'\u22E1','nsce':'\u2AB0\u0338','nscr':'\uD835\uDCC3','Nscr':'\uD835\uDCA9','nshortmid':'\u2224','nshortparallel':'\u2226','nsim':'\u2241','nsime':'\u2244','nsimeq':'\u2244','nsmid':'\u2224','nspar':'\u2226','nsqsube':'\u22E2','nsqsupe':'\u22E3','nsub':'\u2284','nsube':'\u2288','nsubE':'\u2AC5\u0338','nsubset':'\u2282\u20D2','nsubseteq':'\u2288','nsubseteqq':'\u2AC5\u0338','nsucc':'\u2281','nsucceq':'\u2AB0\u0338','nsup':'\u2285','nsupe':'\u2289','nsupE':'\u2AC6\u0338','nsupset':'\u2283\u20D2','nsupseteq':'\u2289','nsupseteqq':'\u2AC6\u0338','ntgl':'\u2279','ntilde':'\xF1','Ntilde':'\xD1','ntlg':'\u2278','ntriangleleft':'\u22EA','ntrianglelefteq':'\u22EC','ntriangleright':'\u22EB','ntrianglerighteq':'\u22ED','nu':'\u03BD','Nu':'\u039D','num':'#','numero':'\u2116','numsp':'\u2007','nvap':'\u224D\u20D2','nvdash':'\u22AC','nvDash':'\u22AD','nVdash':'\u22AE','nVDash':'\u22AF','nvge':'\u2265\u20D2','nvgt':'>\u20D2','nvHarr':'\u2904','nvinfin':'\u29DE','nvlArr':'\u2902','nvle':'\u2264\u20D2','nvlt':'<\u20D2','nvltrie':'\u22B4\u20D2','nvrArr':'\u2903','nvrtrie':'\u22B5\u20D2','nvsim':'\u223C\u20D2','nwarhk':'\u2923','nwarr':'\u2196','nwArr':'\u21D6','nwarrow':'\u2196','nwnear':'\u2927','oacute':'\xF3','Oacute':'\xD3','oast':'\u229B','ocir':'\u229A','ocirc':'\xF4','Ocirc':'\xD4','ocy':'\u043E','Ocy':'\u041E','odash':'\u229D','odblac':'\u0151','Odblac':'\u0150','odiv':'\u2A38','odot':'\u2299','odsold':'\u29BC','oelig':'\u0153','OElig':'\u0152','ofcir':'\u29BF','ofr':'\uD835\uDD2C','Ofr':'\uD835\uDD12','ogon':'\u02DB','ograve':'\xF2','Ograve':'\xD2','ogt':'\u29C1','ohbar':'\u29B5','ohm':'\u03A9','oint':'\u222E','olarr':'\u21BA','olcir':'\u29BE','olcross':'\u29BB','oline':'\u203E','olt':'\u29C0','omacr':'\u014D','Omacr':'\u014C','omega':'\u03C9','Omega':'\u03A9','omicron':'\u03BF','Omicron':'\u039F','omid':'\u29B6','ominus':'\u2296','oopf':'\uD835\uDD60','Oopf':'\uD835\uDD46','opar':'\u29B7','OpenCurlyDoubleQuote':'\u201C','OpenCurlyQuote':'\u2018','operp':'\u29B9','oplus':'\u2295','or':'\u2228','Or':'\u2A54','orarr':'\u21BB','ord':'\u2A5D','order':'\u2134','orderof':'\u2134','ordf':'\xAA','ordm':'\xBA','origof':'\u22B6','oror':'\u2A56','orslope':'\u2A57','orv':'\u2A5B','oS':'\u24C8','oscr':'\u2134','Oscr':'\uD835\uDCAA','oslash':'\xF8','Oslash':'\xD8','osol':'\u2298','otilde':'\xF5','Otilde':'\xD5','otimes':'\u2297','Otimes':'\u2A37','otimesas':'\u2A36','ouml':'\xF6','Ouml':'\xD6','ovbar':'\u233D','OverBar':'\u203E','OverBrace':'\u23DE','OverBracket':'\u23B4','OverParenthesis':'\u23DC','par':'\u2225','para':'\xB6','parallel':'\u2225','parsim':'\u2AF3','parsl':'\u2AFD','part':'\u2202','PartialD':'\u2202','pcy':'\u043F','Pcy':'\u041F','percnt':'%','period':'.','permil':'\u2030','perp':'\u22A5','pertenk':'\u2031','pfr':'\uD835\uDD2D','Pfr':'\uD835\uDD13','phi':'\u03C6','Phi':'\u03A6','phiv':'\u03D5','phmmat':'\u2133','phone':'\u260E','pi':'\u03C0','Pi':'\u03A0','pitchfork':'\u22D4','piv':'\u03D6','planck':'\u210F','planckh':'\u210E','plankv':'\u210F','plus':'+','plusacir':'\u2A23','plusb':'\u229E','pluscir':'\u2A22','plusdo':'\u2214','plusdu':'\u2A25','pluse':'\u2A72','PlusMinus':'\xB1','plusmn':'\xB1','plussim':'\u2A26','plustwo':'\u2A27','pm':'\xB1','Poincareplane':'\u210C','pointint':'\u2A15','popf':'\uD835\uDD61','Popf':'\u2119','pound':'\xA3','pr':'\u227A','Pr':'\u2ABB','prap':'\u2AB7','prcue':'\u227C','pre':'\u2AAF','prE':'\u2AB3','prec':'\u227A','precapprox':'\u2AB7','preccurlyeq':'\u227C','Precedes':'\u227A','PrecedesEqual':'\u2AAF','PrecedesSlantEqual':'\u227C','PrecedesTilde':'\u227E','preceq':'\u2AAF','precnapprox':'\u2AB9','precneqq':'\u2AB5','precnsim':'\u22E8','precsim':'\u227E','prime':'\u2032','Prime':'\u2033','primes':'\u2119','prnap':'\u2AB9','prnE':'\u2AB5','prnsim':'\u22E8','prod':'\u220F','Product':'\u220F','profalar':'\u232E','profline':'\u2312','profsurf':'\u2313','prop':'\u221D','Proportion':'\u2237','Proportional':'\u221D','propto':'\u221D','prsim':'\u227E','prurel':'\u22B0','pscr':'\uD835\uDCC5','Pscr':'\uD835\uDCAB','psi':'\u03C8','Psi':'\u03A8','puncsp':'\u2008','qfr':'\uD835\uDD2E','Qfr':'\uD835\uDD14','qint':'\u2A0C','qopf':'\uD835\uDD62','Qopf':'\u211A','qprime':'\u2057','qscr':'\uD835\uDCC6','Qscr':'\uD835\uDCAC','quaternions':'\u210D','quatint':'\u2A16','quest':'?','questeq':'\u225F','quot':'"','QUOT':'"','rAarr':'\u21DB','race':'\u223D\u0331','racute':'\u0155','Racute':'\u0154','radic':'\u221A','raemptyv':'\u29B3','rang':'\u27E9','Rang':'\u27EB','rangd':'\u2992','range':'\u29A5','rangle':'\u27E9','raquo':'\xBB','rarr':'\u2192','rArr':'\u21D2','Rarr':'\u21A0','rarrap':'\u2975','rarrb':'\u21E5','rarrbfs':'\u2920','rarrc':'\u2933','rarrfs':'\u291E','rarrhk':'\u21AA','rarrlp':'\u21AC','rarrpl':'\u2945','rarrsim':'\u2974','rarrtl':'\u21A3','Rarrtl':'\u2916','rarrw':'\u219D','ratail':'\u291A','rAtail':'\u291C','ratio':'\u2236','rationals':'\u211A','rbarr':'\u290D','rBarr':'\u290F','RBarr':'\u2910','rbbrk':'\u2773','rbrace':'}','rbrack':']','rbrke':'\u298C','rbrksld':'\u298E','rbrkslu':'\u2990','rcaron':'\u0159','Rcaron':'\u0158','rcedil':'\u0157','Rcedil':'\u0156','rceil':'\u2309','rcub':'}','rcy':'\u0440','Rcy':'\u0420','rdca':'\u2937','rdldhar':'\u2969','rdquo':'\u201D','rdquor':'\u201D','rdsh':'\u21B3','Re':'\u211C','real':'\u211C','realine':'\u211B','realpart':'\u211C','reals':'\u211D','rect':'\u25AD','reg':'\xAE','REG':'\xAE','ReverseElement':'\u220B','ReverseEquilibrium':'\u21CB','ReverseUpEquilibrium':'\u296F','rfisht':'\u297D','rfloor':'\u230B','rfr':'\uD835\uDD2F','Rfr':'\u211C','rHar':'\u2964','rhard':'\u21C1','rharu':'\u21C0','rharul':'\u296C','rho':'\u03C1','Rho':'\u03A1','rhov':'\u03F1','RightAngleBracket':'\u27E9','rightarrow':'\u2192','Rightarrow':'\u21D2','RightArrow':'\u2192','RightArrowBar':'\u21E5','RightArrowLeftArrow':'\u21C4','rightarrowtail':'\u21A3','RightCeiling':'\u2309','RightDoubleBracket':'\u27E7','RightDownTeeVector':'\u295D','RightDownVector':'\u21C2','RightDownVectorBar':'\u2955','RightFloor':'\u230B','rightharpoondown':'\u21C1','rightharpoonup':'\u21C0','rightleftarrows':'\u21C4','rightleftharpoons':'\u21CC','rightrightarrows':'\u21C9','rightsquigarrow':'\u219D','RightTee':'\u22A2','RightTeeArrow':'\u21A6','RightTeeVector':'\u295B','rightthreetimes':'\u22CC','RightTriangle':'\u22B3','RightTriangleBar':'\u29D0','RightTriangleEqual':'\u22B5','RightUpDownVector':'\u294F','RightUpTeeVector':'\u295C','RightUpVector':'\u21BE','RightUpVectorBar':'\u2954','RightVector':'\u21C0','RightVectorBar':'\u2953','ring':'\u02DA','risingdotseq':'\u2253','rlarr':'\u21C4','rlhar':'\u21CC','rlm':'\u200F','rmoust':'\u23B1','rmoustache':'\u23B1','rnmid':'\u2AEE','roang':'\u27ED','roarr':'\u21FE','robrk':'\u27E7','ropar':'\u2986','ropf':'\uD835\uDD63','Ropf':'\u211D','roplus':'\u2A2E','rotimes':'\u2A35','RoundImplies':'\u2970','rpar':')','rpargt':'\u2994','rppolint':'\u2A12','rrarr':'\u21C9','Rrightarrow':'\u21DB','rsaquo':'\u203A','rscr':'\uD835\uDCC7','Rscr':'\u211B','rsh':'\u21B1','Rsh':'\u21B1','rsqb':']','rsquo':'\u2019','rsquor':'\u2019','rthree':'\u22CC','rtimes':'\u22CA','rtri':'\u25B9','rtrie':'\u22B5','rtrif':'\u25B8','rtriltri':'\u29CE','RuleDelayed':'\u29F4','ruluhar':'\u2968','rx':'\u211E','sacute':'\u015B','Sacute':'\u015A','sbquo':'\u201A','sc':'\u227B','Sc':'\u2ABC','scap':'\u2AB8','scaron':'\u0161','Scaron':'\u0160','sccue':'\u227D','sce':'\u2AB0','scE':'\u2AB4','scedil':'\u015F','Scedil':'\u015E','scirc':'\u015D','Scirc':'\u015C','scnap':'\u2ABA','scnE':'\u2AB6','scnsim':'\u22E9','scpolint':'\u2A13','scsim':'\u227F','scy':'\u0441','Scy':'\u0421','sdot':'\u22C5','sdotb':'\u22A1','sdote':'\u2A66','searhk':'\u2925','searr':'\u2198','seArr':'\u21D8','searrow':'\u2198','sect':'\xA7','semi':';','seswar':'\u2929','setminus':'\u2216','setmn':'\u2216','sext':'\u2736','sfr':'\uD835\uDD30','Sfr':'\uD835\uDD16','sfrown':'\u2322','sharp':'\u266F','shchcy':'\u0449','SHCHcy':'\u0429','shcy':'\u0448','SHcy':'\u0428','ShortDownArrow':'\u2193','ShortLeftArrow':'\u2190','shortmid':'\u2223','shortparallel':'\u2225','ShortRightArrow':'\u2192','ShortUpArrow':'\u2191','shy':'\xAD','sigma':'\u03C3','Sigma':'\u03A3','sigmaf':'\u03C2','sigmav':'\u03C2','sim':'\u223C','simdot':'\u2A6A','sime':'\u2243','simeq':'\u2243','simg':'\u2A9E','simgE':'\u2AA0','siml':'\u2A9D','simlE':'\u2A9F','simne':'\u2246','simplus':'\u2A24','simrarr':'\u2972','slarr':'\u2190','SmallCircle':'\u2218','smallsetminus':'\u2216','smashp':'\u2A33','smeparsl':'\u29E4','smid':'\u2223','smile':'\u2323','smt':'\u2AAA','smte':'\u2AAC','smtes':'\u2AAC\uFE00','softcy':'\u044C','SOFTcy':'\u042C','sol':'/','solb':'\u29C4','solbar':'\u233F','sopf':'\uD835\uDD64','Sopf':'\uD835\uDD4A','spades':'\u2660','spadesuit':'\u2660','spar':'\u2225','sqcap':'\u2293','sqcaps':'\u2293\uFE00','sqcup':'\u2294','sqcups':'\u2294\uFE00','Sqrt':'\u221A','sqsub':'\u228F','sqsube':'\u2291','sqsubset':'\u228F','sqsubseteq':'\u2291','sqsup':'\u2290','sqsupe':'\u2292','sqsupset':'\u2290','sqsupseteq':'\u2292','squ':'\u25A1','square':'\u25A1','Square':'\u25A1','SquareIntersection':'\u2293','SquareSubset':'\u228F','SquareSubsetEqual':'\u2291','SquareSuperset':'\u2290','SquareSupersetEqual':'\u2292','SquareUnion':'\u2294','squarf':'\u25AA','squf':'\u25AA','srarr':'\u2192','sscr':'\uD835\uDCC8','Sscr':'\uD835\uDCAE','ssetmn':'\u2216','ssmile':'\u2323','sstarf':'\u22C6','star':'\u2606','Star':'\u22C6','starf':'\u2605','straightepsilon':'\u03F5','straightphi':'\u03D5','strns':'\xAF','sub':'\u2282','Sub':'\u22D0','subdot':'\u2ABD','sube':'\u2286','subE':'\u2AC5','subedot':'\u2AC3','submult':'\u2AC1','subne':'\u228A','subnE':'\u2ACB','subplus':'\u2ABF','subrarr':'\u2979','subset':'\u2282','Subset':'\u22D0','subseteq':'\u2286','subseteqq':'\u2AC5','SubsetEqual':'\u2286','subsetneq':'\u228A','subsetneqq':'\u2ACB','subsim':'\u2AC7','subsub':'\u2AD5','subsup':'\u2AD3','succ':'\u227B','succapprox':'\u2AB8','succcurlyeq':'\u227D','Succeeds':'\u227B','SucceedsEqual':'\u2AB0','SucceedsSlantEqual':'\u227D','SucceedsTilde':'\u227F','succeq':'\u2AB0','succnapprox':'\u2ABA','succneqq':'\u2AB6','succnsim':'\u22E9','succsim':'\u227F','SuchThat':'\u220B','sum':'\u2211','Sum':'\u2211','sung':'\u266A','sup':'\u2283','Sup':'\u22D1','sup1':'\xB9','sup2':'\xB2','sup3':'\xB3','supdot':'\u2ABE','supdsub':'\u2AD8','supe':'\u2287','supE':'\u2AC6','supedot':'\u2AC4','Superset':'\u2283','SupersetEqual':'\u2287','suphsol':'\u27C9','suphsub':'\u2AD7','suplarr':'\u297B','supmult':'\u2AC2','supne':'\u228B','supnE':'\u2ACC','supplus':'\u2AC0','supset':'\u2283','Supset':'\u22D1','supseteq':'\u2287','supseteqq':'\u2AC6','supsetneq':'\u228B','supsetneqq':'\u2ACC','supsim':'\u2AC8','supsub':'\u2AD4','supsup':'\u2AD6','swarhk':'\u2926','swarr':'\u2199','swArr':'\u21D9','swarrow':'\u2199','swnwar':'\u292A','szlig':'\xDF','Tab':'\t','target':'\u2316','tau':'\u03C4','Tau':'\u03A4','tbrk':'\u23B4','tcaron':'\u0165','Tcaron':'\u0164','tcedil':'\u0163','Tcedil':'\u0162','tcy':'\u0442','Tcy':'\u0422','tdot':'\u20DB','telrec':'\u2315','tfr':'\uD835\uDD31','Tfr':'\uD835\uDD17','there4':'\u2234','therefore':'\u2234','Therefore':'\u2234','theta':'\u03B8','Theta':'\u0398','thetasym':'\u03D1','thetav':'\u03D1','thickapprox':'\u2248','thicksim':'\u223C','ThickSpace':'\u205F\u200A','thinsp':'\u2009','ThinSpace':'\u2009','thkap':'\u2248','thksim':'\u223C','thorn':'\xFE','THORN':'\xDE','tilde':'\u02DC','Tilde':'\u223C','TildeEqual':'\u2243','TildeFullEqual':'\u2245','TildeTilde':'\u2248','times':'\xD7','timesb':'\u22A0','timesbar':'\u2A31','timesd':'\u2A30','tint':'\u222D','toea':'\u2928','top':'\u22A4','topbot':'\u2336','topcir':'\u2AF1','topf':'\uD835\uDD65','Topf':'\uD835\uDD4B','topfork':'\u2ADA','tosa':'\u2929','tprime':'\u2034','trade':'\u2122','TRADE':'\u2122','triangle':'\u25B5','triangledown':'\u25BF','triangleleft':'\u25C3','trianglelefteq':'\u22B4','triangleq':'\u225C','triangleright':'\u25B9','trianglerighteq':'\u22B5','tridot':'\u25EC','trie':'\u225C','triminus':'\u2A3A','TripleDot':'\u20DB','triplus':'\u2A39','trisb':'\u29CD','tritime':'\u2A3B','trpezium':'\u23E2','tscr':'\uD835\uDCC9','Tscr':'\uD835\uDCAF','tscy':'\u0446','TScy':'\u0426','tshcy':'\u045B','TSHcy':'\u040B','tstrok':'\u0167','Tstrok':'\u0166','twixt':'\u226C','twoheadleftarrow':'\u219E','twoheadrightarrow':'\u21A0','uacute':'\xFA','Uacute':'\xDA','uarr':'\u2191','uArr':'\u21D1','Uarr':'\u219F','Uarrocir':'\u2949','ubrcy':'\u045E','Ubrcy':'\u040E','ubreve':'\u016D','Ubreve':'\u016C','ucirc':'\xFB','Ucirc':'\xDB','ucy':'\u0443','Ucy':'\u0423','udarr':'\u21C5','udblac':'\u0171','Udblac':'\u0170','udhar':'\u296E','ufisht':'\u297E','ufr':'\uD835\uDD32','Ufr':'\uD835\uDD18','ugrave':'\xF9','Ugrave':'\xD9','uHar':'\u2963','uharl':'\u21BF','uharr':'\u21BE','uhblk':'\u2580','ulcorn':'\u231C','ulcorner':'\u231C','ulcrop':'\u230F','ultri':'\u25F8','umacr':'\u016B','Umacr':'\u016A','uml':'\xA8','UnderBar':'_','UnderBrace':'\u23DF','UnderBracket':'\u23B5','UnderParenthesis':'\u23DD','Union':'\u22C3','UnionPlus':'\u228E','uogon':'\u0173','Uogon':'\u0172','uopf':'\uD835\uDD66','Uopf':'\uD835\uDD4C','uparrow':'\u2191','Uparrow':'\u21D1','UpArrow':'\u2191','UpArrowBar':'\u2912','UpArrowDownArrow':'\u21C5','updownarrow':'\u2195','Updownarrow':'\u21D5','UpDownArrow':'\u2195','UpEquilibrium':'\u296E','upharpoonleft':'\u21BF','upharpoonright':'\u21BE','uplus':'\u228E','UpperLeftArrow':'\u2196','UpperRightArrow':'\u2197','upsi':'\u03C5','Upsi':'\u03D2','upsih':'\u03D2','upsilon':'\u03C5','Upsilon':'\u03A5','UpTee':'\u22A5','UpTeeArrow':'\u21A5','upuparrows':'\u21C8','urcorn':'\u231D','urcorner':'\u231D','urcrop':'\u230E','uring':'\u016F','Uring':'\u016E','urtri':'\u25F9','uscr':'\uD835\uDCCA','Uscr':'\uD835\uDCB0','utdot':'\u22F0','utilde':'\u0169','Utilde':'\u0168','utri':'\u25B5','utrif':'\u25B4','uuarr':'\u21C8','uuml':'\xFC','Uuml':'\xDC','uwangle':'\u29A7','vangrt':'\u299C','varepsilon':'\u03F5','varkappa':'\u03F0','varnothing':'\u2205','varphi':'\u03D5','varpi':'\u03D6','varpropto':'\u221D','varr':'\u2195','vArr':'\u21D5','varrho':'\u03F1','varsigma':'\u03C2','varsubsetneq':'\u228A\uFE00','varsubsetneqq':'\u2ACB\uFE00','varsupsetneq':'\u228B\uFE00','varsupsetneqq':'\u2ACC\uFE00','vartheta':'\u03D1','vartriangleleft':'\u22B2','vartriangleright':'\u22B3','vBar':'\u2AE8','Vbar':'\u2AEB','vBarv':'\u2AE9','vcy':'\u0432','Vcy':'\u0412','vdash':'\u22A2','vDash':'\u22A8','Vdash':'\u22A9','VDash':'\u22AB','Vdashl':'\u2AE6','vee':'\u2228','Vee':'\u22C1','veebar':'\u22BB','veeeq':'\u225A','vellip':'\u22EE','verbar':'|','Verbar':'\u2016','vert':'|','Vert':'\u2016','VerticalBar':'\u2223','VerticalLine':'|','VerticalSeparator':'\u2758','VerticalTilde':'\u2240','VeryThinSpace':'\u200A','vfr':'\uD835\uDD33','Vfr':'\uD835\uDD19','vltri':'\u22B2','vnsub':'\u2282\u20D2','vnsup':'\u2283\u20D2','vopf':'\uD835\uDD67','Vopf':'\uD835\uDD4D','vprop':'\u221D','vrtri':'\u22B3','vscr':'\uD835\uDCCB','Vscr':'\uD835\uDCB1','vsubne':'\u228A\uFE00','vsubnE':'\u2ACB\uFE00','vsupne':'\u228B\uFE00','vsupnE':'\u2ACC\uFE00','Vvdash':'\u22AA','vzigzag':'\u299A','wcirc':'\u0175','Wcirc':'\u0174','wedbar':'\u2A5F','wedge':'\u2227','Wedge':'\u22C0','wedgeq':'\u2259','weierp':'\u2118','wfr':'\uD835\uDD34','Wfr':'\uD835\uDD1A','wopf':'\uD835\uDD68','Wopf':'\uD835\uDD4E','wp':'\u2118','wr':'\u2240','wreath':'\u2240','wscr':'\uD835\uDCCC','Wscr':'\uD835\uDCB2','xcap':'\u22C2','xcirc':'\u25EF','xcup':'\u22C3','xdtri':'\u25BD','xfr':'\uD835\uDD35','Xfr':'\uD835\uDD1B','xharr':'\u27F7','xhArr':'\u27FA','xi':'\u03BE','Xi':'\u039E','xlarr':'\u27F5','xlArr':'\u27F8','xmap':'\u27FC','xnis':'\u22FB','xodot':'\u2A00','xopf':'\uD835\uDD69','Xopf':'\uD835\uDD4F','xoplus':'\u2A01','xotime':'\u2A02','xrarr':'\u27F6','xrArr':'\u27F9','xscr':'\uD835\uDCCD','Xscr':'\uD835\uDCB3','xsqcup':'\u2A06','xuplus':'\u2A04','xutri':'\u25B3','xvee':'\u22C1','xwedge':'\u22C0','yacute':'\xFD','Yacute':'\xDD','yacy':'\u044F','YAcy':'\u042F','ycirc':'\u0177','Ycirc':'\u0176','ycy':'\u044B','Ycy':'\u042B','yen':'\xA5','yfr':'\uD835\uDD36','Yfr':'\uD835\uDD1C','yicy':'\u0457','YIcy':'\u0407','yopf':'\uD835\uDD6A','Yopf':'\uD835\uDD50','yscr':'\uD835\uDCCE','Yscr':'\uD835\uDCB4','yucy':'\u044E','YUcy':'\u042E','yuml':'\xFF','Yuml':'\u0178','zacute':'\u017A','Zacute':'\u0179','zcaron':'\u017E','Zcaron':'\u017D','zcy':'\u0437','Zcy':'\u0417','zdot':'\u017C','Zdot':'\u017B','zeetrf':'\u2128','ZeroWidthSpace':'\u200B','zeta':'\u03B6','Zeta':'\u0396','zfr':'\uD835\uDD37','Zfr':'\u2128','zhcy':'\u0436','ZHcy':'\u0416','zigrarr':'\u21DD','zopf':'\uD835\uDD6B','Zopf':'\u2124','zscr':'\uD835\uDCCF','Zscr':'\uD835\uDCB5','zwj':'\u200D','zwnj':'\u200C'};
  6071. var decodeMapLegacy = {'aacute':'\xE1','Aacute':'\xC1','acirc':'\xE2','Acirc':'\xC2','acute':'\xB4','aelig':'\xE6','AElig':'\xC6','agrave':'\xE0','Agrave':'\xC0','amp':'&','AMP':'&','aring':'\xE5','Aring':'\xC5','atilde':'\xE3','Atilde':'\xC3','auml':'\xE4','Auml':'\xC4','brvbar':'\xA6','ccedil':'\xE7','Ccedil':'\xC7','cedil':'\xB8','cent':'\xA2','copy':'\xA9','COPY':'\xA9','curren':'\xA4','deg':'\xB0','divide':'\xF7','eacute':'\xE9','Eacute':'\xC9','ecirc':'\xEA','Ecirc':'\xCA','egrave':'\xE8','Egrave':'\xC8','eth':'\xF0','ETH':'\xD0','euml':'\xEB','Euml':'\xCB','frac12':'\xBD','frac14':'\xBC','frac34':'\xBE','gt':'>','GT':'>','iacute':'\xED','Iacute':'\xCD','icirc':'\xEE','Icirc':'\xCE','iexcl':'\xA1','igrave':'\xEC','Igrave':'\xCC','iquest':'\xBF','iuml':'\xEF','Iuml':'\xCF','laquo':'\xAB','lt':'<','LT':'<','macr':'\xAF','micro':'\xB5','middot':'\xB7','nbsp':'\xA0','not':'\xAC','ntilde':'\xF1','Ntilde':'\xD1','oacute':'\xF3','Oacute':'\xD3','ocirc':'\xF4','Ocirc':'\xD4','ograve':'\xF2','Ograve':'\xD2','ordf':'\xAA','ordm':'\xBA','oslash':'\xF8','Oslash':'\xD8','otilde':'\xF5','Otilde':'\xD5','ouml':'\xF6','Ouml':'\xD6','para':'\xB6','plusmn':'\xB1','pound':'\xA3','quot':'"','QUOT':'"','raquo':'\xBB','reg':'\xAE','REG':'\xAE','sect':'\xA7','shy':'\xAD','sup1':'\xB9','sup2':'\xB2','sup3':'\xB3','szlig':'\xDF','thorn':'\xFE','THORN':'\xDE','times':'\xD7','uacute':'\xFA','Uacute':'\xDA','ucirc':'\xFB','Ucirc':'\xDB','ugrave':'\xF9','Ugrave':'\xD9','uml':'\xA8','uuml':'\xFC','Uuml':'\xDC','yacute':'\xFD','Yacute':'\xDD','yen':'\xA5','yuml':'\xFF'};
  6072. var decodeMapNumeric = {'0':'\uFFFD','128':'\u20AC','130':'\u201A','131':'\u0192','132':'\u201E','133':'\u2026','134':'\u2020','135':'\u2021','136':'\u02C6','137':'\u2030','138':'\u0160','139':'\u2039','140':'\u0152','142':'\u017D','145':'\u2018','146':'\u2019','147':'\u201C','148':'\u201D','149':'\u2022','150':'\u2013','151':'\u2014','152':'\u02DC','153':'\u2122','154':'\u0161','155':'\u203A','156':'\u0153','158':'\u017E','159':'\u0178'};
  6073. var invalidReferenceCodePoints = [1,2,3,4,5,6,7,8,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,64976,64977,64978,64979,64980,64981,64982,64983,64984,64985,64986,64987,64988,64989,64990,64991,64992,64993,64994,64995,64996,64997,64998,64999,65000,65001,65002,65003,65004,65005,65006,65007,65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111];
  6074. /*--------------------------------------------------------------------------*/
  6075. var stringFromCharCode = String.fromCharCode;
  6076. var object = {};
  6077. var hasOwnProperty = object.hasOwnProperty;
  6078. var has = function(object, propertyName) {
  6079. return hasOwnProperty.call(object, propertyName);
  6080. };
  6081. var contains = function(array, value) {
  6082. var index = -1;
  6083. var length = array.length;
  6084. while (++index < length) {
  6085. if (array[index] == value) {
  6086. return true;
  6087. }
  6088. }
  6089. return false;
  6090. };
  6091. var merge = function(options, defaults) {
  6092. if (!options) {
  6093. return defaults;
  6094. }
  6095. var result = {};
  6096. var key;
  6097. for (key in defaults) {
  6098. // A `hasOwnProperty` check is not needed here, since only recognized
  6099. // option names are used anyway. Any others are ignored.
  6100. result[key] = has(options, key) ? options[key] : defaults[key];
  6101. }
  6102. return result;
  6103. };
  6104. // Modified version of `ucs2encode`; see https://mths.be/punycode.
  6105. var codePointToSymbol = function(codePoint, strict) {
  6106. var output = '';
  6107. if ((codePoint >= 0xD800 && codePoint <= 0xDFFF) || codePoint > 0x10FFFF) {
  6108. // See issue #4:
  6109. // “Otherwise, if the number is in the range 0xD800 to 0xDFFF or is
  6110. // greater than 0x10FFFF, then this is a parse error. Return a U+FFFD
  6111. // REPLACEMENT CHARACTER.”
  6112. if (strict) {
  6113. parseError('character reference outside the permissible Unicode range');
  6114. }
  6115. return '\uFFFD';
  6116. }
  6117. if (has(decodeMapNumeric, codePoint)) {
  6118. if (strict) {
  6119. parseError('disallowed character reference');
  6120. }
  6121. return decodeMapNumeric[codePoint];
  6122. }
  6123. if (strict && contains(invalidReferenceCodePoints, codePoint)) {
  6124. parseError('disallowed character reference');
  6125. }
  6126. if (codePoint > 0xFFFF) {
  6127. codePoint -= 0x10000;
  6128. output += stringFromCharCode(codePoint >>> 10 & 0x3FF | 0xD800);
  6129. codePoint = 0xDC00 | codePoint & 0x3FF;
  6130. }
  6131. output += stringFromCharCode(codePoint);
  6132. return output;
  6133. };
  6134. var hexEscape = function(codePoint) {
  6135. return '&#x' + codePoint.toString(16).toUpperCase() + ';';
  6136. };
  6137. var decEscape = function(codePoint) {
  6138. return '&#' + codePoint + ';';
  6139. };
  6140. var parseError = function(message) {
  6141. throw Error('Parse error: ' + message);
  6142. };
  6143. /*--------------------------------------------------------------------------*/
  6144. var encode = function(string, options) {
  6145. options = merge(options, encode.options);
  6146. var strict = options.strict;
  6147. if (strict && regexInvalidRawCodePoint.test(string)) {
  6148. parseError('forbidden code point');
  6149. }
  6150. var encodeEverything = options.encodeEverything;
  6151. var useNamedReferences = options.useNamedReferences;
  6152. var allowUnsafeSymbols = options.allowUnsafeSymbols;
  6153. var escapeCodePoint = options.decimal ? decEscape : hexEscape;
  6154. var escapeBmpSymbol = function(symbol) {
  6155. return escapeCodePoint(symbol.charCodeAt(0));
  6156. };
  6157. if (encodeEverything) {
  6158. // Encode ASCII symbols.
  6159. string = string.replace(regexAsciiWhitelist, function(symbol) {
  6160. // Use named references if requested & possible.
  6161. if (useNamedReferences && has(encodeMap, symbol)) {
  6162. return '&' + encodeMap[symbol] + ';';
  6163. }
  6164. return escapeBmpSymbol(symbol);
  6165. });
  6166. // Shorten a few escapes that represent two symbols, of which at least one
  6167. // is within the ASCII range.
  6168. if (useNamedReferences) {
  6169. string = string
  6170. .replace(/&gt;\u20D2/g, '&nvgt;')
  6171. .replace(/&lt;\u20D2/g, '&nvlt;')
  6172. .replace(/&#x66;&#x6A;/g, '&fjlig;');
  6173. }
  6174. // Encode non-ASCII symbols.
  6175. if (useNamedReferences) {
  6176. // Encode non-ASCII symbols that can be replaced with a named reference.
  6177. string = string.replace(regexEncodeNonAscii, function(string) {
  6178. // Note: there is no need to check `has(encodeMap, string)` here.
  6179. return '&' + encodeMap[string] + ';';
  6180. });
  6181. }
  6182. // Note: any remaining non-ASCII symbols are handled outside of the `if`.
  6183. } else if (useNamedReferences) {
  6184. // Apply named character references.
  6185. // Encode `<>"'&` using named character references.
  6186. if (!allowUnsafeSymbols) {
  6187. string = string.replace(regexEscape, function(string) {
  6188. return '&' + encodeMap[string] + ';'; // no need to check `has()` here
  6189. });
  6190. }
  6191. // Shorten escapes that represent two symbols, of which at least one is
  6192. // `<>"'&`.
  6193. string = string
  6194. .replace(/&gt;\u20D2/g, '&nvgt;')
  6195. .replace(/&lt;\u20D2/g, '&nvlt;');
  6196. // Encode non-ASCII symbols that can be replaced with a named reference.
  6197. string = string.replace(regexEncodeNonAscii, function(string) {
  6198. // Note: there is no need to check `has(encodeMap, string)` here.
  6199. return '&' + encodeMap[string] + ';';
  6200. });
  6201. } else if (!allowUnsafeSymbols) {
  6202. // Encode `<>"'&` using hexadecimal escapes, now that they’re not handled
  6203. // using named character references.
  6204. string = string.replace(regexEscape, escapeBmpSymbol);
  6205. }
  6206. return string
  6207. // Encode astral symbols.
  6208. .replace(regexAstralSymbols, function($0) {
  6209. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  6210. var high = $0.charCodeAt(0);
  6211. var low = $0.charCodeAt(1);
  6212. var codePoint = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000;
  6213. return escapeCodePoint(codePoint);
  6214. })
  6215. // Encode any remaining BMP symbols that are not printable ASCII symbols
  6216. // using a hexadecimal escape.
  6217. .replace(regexBmpWhitelist, escapeBmpSymbol);
  6218. };
  6219. // Expose default options (so they can be overridden globally).
  6220. encode.options = {
  6221. 'allowUnsafeSymbols': false,
  6222. 'encodeEverything': false,
  6223. 'strict': false,
  6224. 'useNamedReferences': false,
  6225. 'decimal' : false
  6226. };
  6227. var decode = function(html, options) {
  6228. options = merge(options, decode.options);
  6229. var strict = options.strict;
  6230. if (strict && regexInvalidEntity.test(html)) {
  6231. parseError('malformed character reference');
  6232. }
  6233. return html.replace(regexDecode, function($0, $1, $2, $3, $4, $5, $6, $7, $8) {
  6234. var codePoint;
  6235. var semicolon;
  6236. var decDigits;
  6237. var hexDigits;
  6238. var reference;
  6239. var next;
  6240. if ($1) {
  6241. reference = $1;
  6242. // Note: there is no need to check `has(decodeMap, reference)`.
  6243. return decodeMap[reference];
  6244. }
  6245. if ($2) {
  6246. // Decode named character references without trailing `;`, e.g. `&amp`.
  6247. // This is only a parse error if it gets converted to `&`, or if it is
  6248. // followed by `=` in an attribute context.
  6249. reference = $2;
  6250. next = $3;
  6251. if (next && options.isAttributeValue) {
  6252. if (strict && next == '=') {
  6253. parseError('`&` did not start a character reference');
  6254. }
  6255. return $0;
  6256. } else {
  6257. if (strict) {
  6258. parseError(
  6259. 'named character reference was not terminated by a semicolon'
  6260. );
  6261. }
  6262. // Note: there is no need to check `has(decodeMapLegacy, reference)`.
  6263. return decodeMapLegacy[reference] + (next || '');
  6264. }
  6265. }
  6266. if ($4) {
  6267. // Decode decimal escapes, e.g. `&#119558;`.
  6268. decDigits = $4;
  6269. semicolon = $5;
  6270. if (strict && !semicolon) {
  6271. parseError('character reference was not terminated by a semicolon');
  6272. }
  6273. codePoint = parseInt(decDigits, 10);
  6274. return codePointToSymbol(codePoint, strict);
  6275. }
  6276. if ($6) {
  6277. // Decode hexadecimal escapes, e.g. `&#x1D306;`.
  6278. hexDigits = $6;
  6279. semicolon = $7;
  6280. if (strict && !semicolon) {
  6281. parseError('character reference was not terminated by a semicolon');
  6282. }
  6283. codePoint = parseInt(hexDigits, 16);
  6284. return codePointToSymbol(codePoint, strict);
  6285. }
  6286. // If we’re still here, `if ($7)` is implied; it’s an ambiguous
  6287. // ampersand for sure. https://mths.be/notes/ambiguous-ampersands
  6288. if (strict) {
  6289. parseError(
  6290. 'named character reference was not terminated by a semicolon'
  6291. );
  6292. }
  6293. return $0;
  6294. });
  6295. };
  6296. // Expose default options (so they can be overridden globally).
  6297. decode.options = {
  6298. 'isAttributeValue': false,
  6299. 'strict': false
  6300. };
  6301. var escape = function(string) {
  6302. return string.replace(regexEscape, function($0) {
  6303. // Note: there is no need to check `has(escapeMap, $0)` here.
  6304. return escapeMap[$0];
  6305. });
  6306. };
  6307. /*--------------------------------------------------------------------------*/
  6308. var he = {
  6309. 'version': '1.2.0',
  6310. 'encode': encode,
  6311. 'decode': decode,
  6312. 'escape': escape,
  6313. 'unescape': decode
  6314. };
  6315. // Some AMD build optimizers, like r.js, check for specific condition patterns
  6316. // like the following:
  6317. if (freeExports && !freeExports.nodeType) {
  6318. if (freeModule) { // in Node.js, io.js, or RingoJS v0.8.0+
  6319. freeModule.exports = he;
  6320. } else { // in Narwhal or RingoJS v0.7.0-
  6321. for (var key in he) {
  6322. has(he, key) && (freeExports[key] = he[key]);
  6323. }
  6324. }
  6325. } else { // in Rhino or a web browser
  6326. root.he = he;
  6327. }
  6328. }(commonjsGlobal));
  6329. } (he$1, he$1.exports));
  6330. var he = he$1.exports;
  6331. /**
  6332. * Cross-platform code generation for component v-model
  6333. */
  6334. function genComponentModel(el, value, modifiers) {
  6335. const { number, trim } = modifiers || {};
  6336. const baseValueExpression = '$$v';
  6337. let valueExpression = baseValueExpression;
  6338. if (trim) {
  6339. valueExpression =
  6340. `(typeof ${baseValueExpression} === 'string'` +
  6341. `? ${baseValueExpression}.trim()` +
  6342. `: ${baseValueExpression})`;
  6343. }
  6344. if (number) {
  6345. valueExpression = `_n(${valueExpression})`;
  6346. }
  6347. const assignment = genAssignmentCode(value, valueExpression);
  6348. el.model = {
  6349. value: `(${value})`,
  6350. expression: JSON.stringify(value),
  6351. callback: `function (${baseValueExpression}) {${assignment}}`
  6352. };
  6353. }
  6354. /**
  6355. * Cross-platform codegen helper for generating v-model value assignment code.
  6356. */
  6357. function genAssignmentCode(value, assignment) {
  6358. const res = parseModel(value);
  6359. if (res.key === null) {
  6360. return `${value}=${assignment}`;
  6361. }
  6362. else {
  6363. return `$set(${res.exp}, ${res.key}, ${assignment})`;
  6364. }
  6365. }
  6366. /**
  6367. * Parse a v-model expression into a base path and a final key segment.
  6368. * Handles both dot-path and possible square brackets.
  6369. *
  6370. * Possible cases:
  6371. *
  6372. * - test
  6373. * - test[key]
  6374. * - test[test1[key]]
  6375. * - test["a"][key]
  6376. * - xxx.test[a[a].test1[key]]
  6377. * - test.xxx.a["asa"][test1[key]]
  6378. *
  6379. */
  6380. let len, str$1, chr, index, expressionPos, expressionEndPos;
  6381. function parseModel(val) {
  6382. // Fix https://github.com/vuejs/vue/pull/7730
  6383. // allow v-model="obj.val " (trailing whitespace)
  6384. val = val.trim();
  6385. len = val.length;
  6386. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  6387. index = val.lastIndexOf('.');
  6388. if (index > -1) {
  6389. return {
  6390. exp: val.slice(0, index),
  6391. key: '"' + val.slice(index + 1) + '"'
  6392. };
  6393. }
  6394. else {
  6395. return {
  6396. exp: val,
  6397. key: null
  6398. };
  6399. }
  6400. }
  6401. str$1 = val;
  6402. index = expressionPos = expressionEndPos = 0;
  6403. while (!eof()) {
  6404. chr = next();
  6405. /* istanbul ignore if */
  6406. if (isStringStart(chr)) {
  6407. parseString(chr);
  6408. }
  6409. else if (chr === 0x5b) {
  6410. parseBracket(chr);
  6411. }
  6412. }
  6413. return {
  6414. exp: val.slice(0, expressionPos),
  6415. key: val.slice(expressionPos + 1, expressionEndPos)
  6416. };
  6417. }
  6418. function next() {
  6419. return str$1.charCodeAt(++index);
  6420. }
  6421. function eof() {
  6422. return index >= len;
  6423. }
  6424. function isStringStart(chr) {
  6425. return chr === 0x22 || chr === 0x27;
  6426. }
  6427. function parseBracket(chr) {
  6428. let inBracket = 1;
  6429. expressionPos = index;
  6430. while (!eof()) {
  6431. chr = next();
  6432. if (isStringStart(chr)) {
  6433. parseString(chr);
  6434. continue;
  6435. }
  6436. if (chr === 0x5b)
  6437. inBracket++;
  6438. if (chr === 0x5d)
  6439. inBracket--;
  6440. if (inBracket === 0) {
  6441. expressionEndPos = index;
  6442. break;
  6443. }
  6444. }
  6445. }
  6446. function parseString(chr) {
  6447. const stringQuote = chr;
  6448. while (!eof()) {
  6449. chr = next();
  6450. if (chr === stringQuote) {
  6451. break;
  6452. }
  6453. }
  6454. }
  6455. const onRE = /^@|^v-on:/;
  6456. const dirRE = /^v-|^@|^:|^#/;
  6457. const forAliasRE$1 = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  6458. const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  6459. const stripParensRE = /^\(|\)$/g;
  6460. const dynamicArgRE = /^\[.*\]$/;
  6461. const argRE = /:(.*)$/;
  6462. const bindRE = /^:|^\.|^v-bind:/;
  6463. const modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  6464. const slotRE = /^v-slot(:|$)|^#/;
  6465. const lineBreakRE = /[\r\n]/;
  6466. const whitespaceRE = /[ \f\t\r\n]+/g;
  6467. const invalidAttributeRE = /[\s"'<>\/=]/;
  6468. const decodeHTMLCached = cached(he.decode);
  6469. const emptySlotScopeToken = `_empty_`;
  6470. // configurable state
  6471. let warn$2;
  6472. let delimiters;
  6473. let transforms;
  6474. let preTransforms;
  6475. let postTransforms;
  6476. let platformIsPreTag;
  6477. let platformMustUseProp;
  6478. let platformGetTagNamespace;
  6479. let maybeComponent;
  6480. function createASTElement(tag, attrs, parent) {
  6481. return {
  6482. type: 1,
  6483. tag,
  6484. attrsList: attrs,
  6485. attrsMap: makeAttrsMap(attrs),
  6486. rawAttrsMap: {},
  6487. parent,
  6488. children: []
  6489. };
  6490. }
  6491. /**
  6492. * Convert HTML string to AST.
  6493. */
  6494. function parse$1(template, options) {
  6495. warn$2 = options.warn || baseWarn;
  6496. platformIsPreTag = options.isPreTag || no;
  6497. platformMustUseProp = options.mustUseProp || no;
  6498. platformGetTagNamespace = options.getTagNamespace || no;
  6499. const isReservedTag = options.isReservedTag || no;
  6500. maybeComponent = (el) => !!(el.component ||
  6501. el.attrsMap[':is'] ||
  6502. el.attrsMap['v-bind:is'] ||
  6503. !(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag)));
  6504. transforms = pluckModuleFunction(options.modules, 'transformNode');
  6505. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  6506. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  6507. delimiters = options.delimiters;
  6508. const stack = [];
  6509. const preserveWhitespace = options.preserveWhitespace !== false;
  6510. const whitespaceOption = options.whitespace;
  6511. let root;
  6512. let currentParent;
  6513. let inVPre = false;
  6514. let inPre = false;
  6515. let warned = false;
  6516. function warnOnce(msg, range) {
  6517. if (!warned) {
  6518. warned = true;
  6519. warn$2(msg, range);
  6520. }
  6521. }
  6522. function closeElement(element) {
  6523. trimEndingWhitespace(element);
  6524. if (!inVPre && !element.processed) {
  6525. element = processElement(element, options);
  6526. }
  6527. // tree management
  6528. if (!stack.length && element !== root) {
  6529. // allow root elements with v-if, v-else-if and v-else
  6530. if (root.if && (element.elseif || element.else)) {
  6531. if (process.env.NODE_ENV !== 'production') {
  6532. checkRootConstraints(element);
  6533. }
  6534. addIfCondition(root, {
  6535. exp: element.elseif,
  6536. block: element
  6537. });
  6538. }
  6539. else if (process.env.NODE_ENV !== 'production') {
  6540. warnOnce(`Component template should contain exactly one root element. ` +
  6541. `If you are using v-if on multiple elements, ` +
  6542. `use v-else-if to chain them instead.`, { start: element.start });
  6543. }
  6544. }
  6545. if (currentParent && !element.forbidden) {
  6546. if (element.elseif || element.else) {
  6547. processIfConditions(element, currentParent);
  6548. }
  6549. else {
  6550. if (element.slotScope) {
  6551. // scoped slot
  6552. // keep it in the children list so that v-else(-if) conditions can
  6553. // find it as the prev node.
  6554. const name = element.slotTarget || '"default"';
  6555. (currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  6556. }
  6557. currentParent.children.push(element);
  6558. element.parent = currentParent;
  6559. }
  6560. }
  6561. // final children cleanup
  6562. // filter out scoped slots
  6563. element.children = element.children.filter(c => !c.slotScope);
  6564. // remove trailing whitespace node again
  6565. trimEndingWhitespace(element);
  6566. // check pre state
  6567. if (element.pre) {
  6568. inVPre = false;
  6569. }
  6570. if (platformIsPreTag(element.tag)) {
  6571. inPre = false;
  6572. }
  6573. // apply post-transforms
  6574. for (let i = 0; i < postTransforms.length; i++) {
  6575. postTransforms[i](element, options);
  6576. }
  6577. }
  6578. function trimEndingWhitespace(el) {
  6579. // remove trailing whitespace node
  6580. if (!inPre) {
  6581. let lastNode;
  6582. while ((lastNode = el.children[el.children.length - 1]) &&
  6583. lastNode.type === 3 &&
  6584. lastNode.text === ' ') {
  6585. el.children.pop();
  6586. }
  6587. }
  6588. }
  6589. function checkRootConstraints(el) {
  6590. if (el.tag === 'slot' || el.tag === 'template') {
  6591. warnOnce(`Cannot use <${el.tag}> as component root element because it may ` +
  6592. 'contain multiple nodes.', { start: el.start });
  6593. }
  6594. if (el.attrsMap.hasOwnProperty('v-for')) {
  6595. warnOnce('Cannot use v-for on stateful component root element because ' +
  6596. 'it renders multiple elements.', el.rawAttrsMap['v-for']);
  6597. }
  6598. }
  6599. parseHTML(template, {
  6600. warn: warn$2,
  6601. expectHTML: options.expectHTML,
  6602. isUnaryTag: options.isUnaryTag,
  6603. canBeLeftOpenTag: options.canBeLeftOpenTag,
  6604. shouldDecodeNewlines: options.shouldDecodeNewlines,
  6605. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  6606. shouldKeepComment: options.comments,
  6607. outputSourceRange: options.outputSourceRange,
  6608. start(tag, attrs, unary, start, end) {
  6609. // check namespace.
  6610. // inherit parent ns if there is one
  6611. const ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  6612. // handle IE svg bug
  6613. /* istanbul ignore if */
  6614. if (isIE && ns === 'svg') {
  6615. attrs = guardIESVGBug(attrs);
  6616. }
  6617. let element = createASTElement(tag, attrs, currentParent);
  6618. if (ns) {
  6619. element.ns = ns;
  6620. }
  6621. if (process.env.NODE_ENV !== 'production') {
  6622. if (options.outputSourceRange) {
  6623. element.start = start;
  6624. element.end = end;
  6625. element.rawAttrsMap = element.attrsList.reduce((cumulated, attr) => {
  6626. cumulated[attr.name] = attr;
  6627. return cumulated;
  6628. }, {});
  6629. }
  6630. attrs.forEach(attr => {
  6631. if (invalidAttributeRE.test(attr.name)) {
  6632. warn$2(`Invalid dynamic argument expression: attribute names cannot contain ` +
  6633. `spaces, quotes, <, >, / or =.`, options.outputSourceRange
  6634. ? {
  6635. start: attr.start + attr.name.indexOf(`[`),
  6636. end: attr.start + attr.name.length
  6637. }
  6638. : undefined);
  6639. }
  6640. });
  6641. }
  6642. if (isForbiddenTag(element) && !isServerRendering()) {
  6643. element.forbidden = true;
  6644. process.env.NODE_ENV !== 'production' &&
  6645. warn$2('Templates should only be responsible for mapping the state to the ' +
  6646. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  6647. `<${tag}>` +
  6648. ', as they will not be parsed.', { start: element.start });
  6649. }
  6650. // apply pre-transforms
  6651. for (let i = 0; i < preTransforms.length; i++) {
  6652. element = preTransforms[i](element, options) || element;
  6653. }
  6654. if (!inVPre) {
  6655. processPre(element);
  6656. if (element.pre) {
  6657. inVPre = true;
  6658. }
  6659. }
  6660. if (platformIsPreTag(element.tag)) {
  6661. inPre = true;
  6662. }
  6663. if (inVPre) {
  6664. processRawAttrs(element);
  6665. }
  6666. else if (!element.processed) {
  6667. // structural directives
  6668. processFor(element);
  6669. processIf(element);
  6670. processOnce(element);
  6671. }
  6672. if (!root) {
  6673. root = element;
  6674. if (process.env.NODE_ENV !== 'production') {
  6675. checkRootConstraints(root);
  6676. }
  6677. }
  6678. if (!unary) {
  6679. currentParent = element;
  6680. stack.push(element);
  6681. }
  6682. else {
  6683. closeElement(element);
  6684. }
  6685. },
  6686. end(tag, start, end) {
  6687. const element = stack[stack.length - 1];
  6688. // pop stack
  6689. stack.length -= 1;
  6690. currentParent = stack[stack.length - 1];
  6691. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  6692. element.end = end;
  6693. }
  6694. closeElement(element);
  6695. },
  6696. chars(text, start, end) {
  6697. if (!currentParent) {
  6698. if (process.env.NODE_ENV !== 'production') {
  6699. if (text === template) {
  6700. warnOnce('Component template requires a root element, rather than just text.', { start });
  6701. }
  6702. else if ((text = text.trim())) {
  6703. warnOnce(`text "${text}" outside root element will be ignored.`, {
  6704. start
  6705. });
  6706. }
  6707. }
  6708. return;
  6709. }
  6710. // IE textarea placeholder bug
  6711. /* istanbul ignore if */
  6712. if (isIE &&
  6713. currentParent.tag === 'textarea' &&
  6714. currentParent.attrsMap.placeholder === text) {
  6715. return;
  6716. }
  6717. const children = currentParent.children;
  6718. if (inPre || text.trim()) {
  6719. text = isTextTag(currentParent)
  6720. ? text
  6721. : decodeHTMLCached(text);
  6722. }
  6723. else if (!children.length) {
  6724. // remove the whitespace-only node right after an opening tag
  6725. text = '';
  6726. }
  6727. else if (whitespaceOption) {
  6728. if (whitespaceOption === 'condense') {
  6729. // in condense mode, remove the whitespace node if it contains
  6730. // line break, otherwise condense to a single space
  6731. text = lineBreakRE.test(text) ? '' : ' ';
  6732. }
  6733. else {
  6734. text = ' ';
  6735. }
  6736. }
  6737. else {
  6738. text = preserveWhitespace ? ' ' : '';
  6739. }
  6740. if (text) {
  6741. if (!inPre && whitespaceOption === 'condense') {
  6742. // condense consecutive whitespaces into single space
  6743. text = text.replace(whitespaceRE, ' ');
  6744. }
  6745. let res;
  6746. let child;
  6747. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  6748. child = {
  6749. type: 2,
  6750. expression: res.expression,
  6751. tokens: res.tokens,
  6752. text
  6753. };
  6754. }
  6755. else if (text !== ' ' ||
  6756. !children.length ||
  6757. children[children.length - 1].text !== ' ') {
  6758. child = {
  6759. type: 3,
  6760. text
  6761. };
  6762. }
  6763. if (child) {
  6764. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  6765. child.start = start;
  6766. child.end = end;
  6767. }
  6768. children.push(child);
  6769. }
  6770. }
  6771. },
  6772. comment(text, start, end) {
  6773. // adding anything as a sibling to the root node is forbidden
  6774. // comments should still be allowed, but ignored
  6775. if (currentParent) {
  6776. const child = {
  6777. type: 3,
  6778. text,
  6779. isComment: true
  6780. };
  6781. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  6782. child.start = start;
  6783. child.end = end;
  6784. }
  6785. currentParent.children.push(child);
  6786. }
  6787. }
  6788. });
  6789. return root;
  6790. }
  6791. function processPre(el) {
  6792. if (getAndRemoveAttr(el, 'v-pre') != null) {
  6793. el.pre = true;
  6794. }
  6795. }
  6796. function processRawAttrs(el) {
  6797. const list = el.attrsList;
  6798. const len = list.length;
  6799. if (len) {
  6800. const attrs = (el.attrs = new Array(len));
  6801. for (let i = 0; i < len; i++) {
  6802. attrs[i] = {
  6803. name: list[i].name,
  6804. value: JSON.stringify(list[i].value)
  6805. };
  6806. if (list[i].start != null) {
  6807. attrs[i].start = list[i].start;
  6808. attrs[i].end = list[i].end;
  6809. }
  6810. }
  6811. }
  6812. else if (!el.pre) {
  6813. // non root node in pre blocks with no attributes
  6814. el.plain = true;
  6815. }
  6816. }
  6817. function processElement(element, options) {
  6818. processKey(element);
  6819. // determine whether this is a plain element after
  6820. // removing structural attributes
  6821. element.plain =
  6822. !element.key && !element.scopedSlots && !element.attrsList.length;
  6823. processRef(element);
  6824. processSlotContent(element);
  6825. processSlotOutlet(element);
  6826. processComponent(element);
  6827. for (let i = 0; i < transforms.length; i++) {
  6828. element = transforms[i](element, options) || element;
  6829. }
  6830. processAttrs(element);
  6831. return element;
  6832. }
  6833. function processKey(el) {
  6834. const exp = getBindingAttr(el, 'key');
  6835. if (exp) {
  6836. if (process.env.NODE_ENV !== 'production') {
  6837. if (el.tag === 'template') {
  6838. warn$2(`<template> cannot be keyed. Place the key on real elements instead.`, getRawBindingAttr(el, 'key'));
  6839. }
  6840. if (el.for) {
  6841. const iterator = el.iterator2 || el.iterator1;
  6842. const parent = el.parent;
  6843. if (iterator &&
  6844. iterator === exp &&
  6845. parent &&
  6846. parent.tag === 'transition-group') {
  6847. warn$2(`Do not use v-for index as key on <transition-group> children, ` +
  6848. `this is the same as not using keys.`, getRawBindingAttr(el, 'key'), true /* tip */);
  6849. }
  6850. }
  6851. }
  6852. el.key = exp;
  6853. }
  6854. }
  6855. function processRef(el) {
  6856. const ref = getBindingAttr(el, 'ref');
  6857. if (ref) {
  6858. el.ref = ref;
  6859. el.refInFor = checkInFor(el);
  6860. }
  6861. }
  6862. function processFor(el) {
  6863. let exp;
  6864. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  6865. const res = parseFor(exp);
  6866. if (res) {
  6867. extend(el, res);
  6868. }
  6869. else if (process.env.NODE_ENV !== 'production') {
  6870. warn$2(`Invalid v-for expression: ${exp}`, el.rawAttrsMap['v-for']);
  6871. }
  6872. }
  6873. }
  6874. function parseFor(exp) {
  6875. const inMatch = exp.match(forAliasRE$1);
  6876. if (!inMatch)
  6877. return;
  6878. const res = {};
  6879. res.for = inMatch[2].trim();
  6880. const alias = inMatch[1].trim().replace(stripParensRE, '');
  6881. const iteratorMatch = alias.match(forIteratorRE);
  6882. if (iteratorMatch) {
  6883. res.alias = alias.replace(forIteratorRE, '').trim();
  6884. res.iterator1 = iteratorMatch[1].trim();
  6885. if (iteratorMatch[2]) {
  6886. res.iterator2 = iteratorMatch[2].trim();
  6887. }
  6888. }
  6889. else {
  6890. res.alias = alias;
  6891. }
  6892. return res;
  6893. }
  6894. function processIf(el) {
  6895. const exp = getAndRemoveAttr(el, 'v-if');
  6896. if (exp) {
  6897. el.if = exp;
  6898. addIfCondition(el, {
  6899. exp: exp,
  6900. block: el
  6901. });
  6902. }
  6903. else {
  6904. if (getAndRemoveAttr(el, 'v-else') != null) {
  6905. el.else = true;
  6906. }
  6907. const elseif = getAndRemoveAttr(el, 'v-else-if');
  6908. if (elseif) {
  6909. el.elseif = elseif;
  6910. }
  6911. }
  6912. }
  6913. function processIfConditions(el, parent) {
  6914. const prev = findPrevElement(parent.children);
  6915. if (prev && prev.if) {
  6916. addIfCondition(prev, {
  6917. exp: el.elseif,
  6918. block: el
  6919. });
  6920. }
  6921. else if (process.env.NODE_ENV !== 'production') {
  6922. warn$2(`v-${el.elseif ? 'else-if="' + el.elseif + '"' : 'else'} ` +
  6923. `used on element <${el.tag}> without corresponding v-if.`, el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']);
  6924. }
  6925. }
  6926. function findPrevElement(children) {
  6927. let i = children.length;
  6928. while (i--) {
  6929. if (children[i].type === 1) {
  6930. return children[i];
  6931. }
  6932. else {
  6933. if (process.env.NODE_ENV !== 'production' && children[i].text !== ' ') {
  6934. warn$2(`text "${children[i].text.trim()}" between v-if and v-else(-if) ` +
  6935. `will be ignored.`, children[i]);
  6936. }
  6937. children.pop();
  6938. }
  6939. }
  6940. }
  6941. function addIfCondition(el, condition) {
  6942. if (!el.ifConditions) {
  6943. el.ifConditions = [];
  6944. }
  6945. el.ifConditions.push(condition);
  6946. }
  6947. function processOnce(el) {
  6948. const once = getAndRemoveAttr(el, 'v-once');
  6949. if (once != null) {
  6950. el.once = true;
  6951. }
  6952. }
  6953. // handle content being passed to a component as slot,
  6954. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  6955. function processSlotContent(el) {
  6956. let slotScope;
  6957. if (el.tag === 'template') {
  6958. slotScope = getAndRemoveAttr(el, 'scope');
  6959. /* istanbul ignore if */
  6960. if (process.env.NODE_ENV !== 'production' && slotScope) {
  6961. warn$2(`the "scope" attribute for scoped slots have been deprecated and ` +
  6962. `replaced by "slot-scope" since 2.5. The new "slot-scope" attribute ` +
  6963. `can also be used on plain elements in addition to <template> to ` +
  6964. `denote scoped slots.`, el.rawAttrsMap['scope'], true);
  6965. }
  6966. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  6967. }
  6968. else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  6969. /* istanbul ignore if */
  6970. if (process.env.NODE_ENV !== 'production' && el.attrsMap['v-for']) {
  6971. warn$2(`Ambiguous combined usage of slot-scope and v-for on <${el.tag}> ` +
  6972. `(v-for takes higher priority). Use a wrapper <template> for the ` +
  6973. `scoped slot to make it clearer.`, el.rawAttrsMap['slot-scope'], true);
  6974. }
  6975. el.slotScope = slotScope;
  6976. }
  6977. // slot="xxx"
  6978. const slotTarget = getBindingAttr(el, 'slot');
  6979. if (slotTarget) {
  6980. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  6981. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  6982. // preserve slot as an attribute for native shadow DOM compat
  6983. // only for non-scoped slots.
  6984. if (el.tag !== 'template' && !el.slotScope) {
  6985. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  6986. }
  6987. }
  6988. // 2.6 v-slot syntax
  6989. {
  6990. if (el.tag === 'template') {
  6991. // v-slot on <template>
  6992. const slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  6993. if (slotBinding) {
  6994. if (process.env.NODE_ENV !== 'production') {
  6995. if (el.slotTarget || el.slotScope) {
  6996. warn$2(`Unexpected mixed usage of different slot syntaxes.`, el);
  6997. }
  6998. if (el.parent && !maybeComponent(el.parent)) {
  6999. warn$2(`<template v-slot> can only appear at the root level inside ` +
  7000. `the receiving component`, el);
  7001. }
  7002. }
  7003. const { name, dynamic } = getSlotName(slotBinding);
  7004. el.slotTarget = name;
  7005. el.slotTargetDynamic = dynamic;
  7006. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  7007. }
  7008. }
  7009. else {
  7010. // v-slot on component, denotes default slot
  7011. const slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  7012. if (slotBinding) {
  7013. if (process.env.NODE_ENV !== 'production') {
  7014. if (!maybeComponent(el)) {
  7015. warn$2(`v-slot can only be used on components or <template>.`, slotBinding);
  7016. }
  7017. if (el.slotScope || el.slotTarget) {
  7018. warn$2(`Unexpected mixed usage of different slot syntaxes.`, el);
  7019. }
  7020. if (el.scopedSlots) {
  7021. warn$2(`To avoid scope ambiguity, the default slot should also use ` +
  7022. `<template> syntax when there are other named slots.`, slotBinding);
  7023. }
  7024. }
  7025. // add the component's children to its default slot
  7026. const slots = el.scopedSlots || (el.scopedSlots = {});
  7027. const { name, dynamic } = getSlotName(slotBinding);
  7028. const slotContainer = (slots[name] = createASTElement('template', [], el));
  7029. slotContainer.slotTarget = name;
  7030. slotContainer.slotTargetDynamic = dynamic;
  7031. slotContainer.children = el.children.filter((c) => {
  7032. if (!c.slotScope) {
  7033. c.parent = slotContainer;
  7034. return true;
  7035. }
  7036. });
  7037. slotContainer.slotScope = slotBinding.value || emptySlotScopeToken;
  7038. // remove children as they are returned from scopedSlots now
  7039. el.children = [];
  7040. // mark el non-plain so data gets generated
  7041. el.plain = false;
  7042. }
  7043. }
  7044. }
  7045. }
  7046. function getSlotName(binding) {
  7047. let name = binding.name.replace(slotRE, '');
  7048. if (!name) {
  7049. if (binding.name[0] !== '#') {
  7050. name = 'default';
  7051. }
  7052. else if (process.env.NODE_ENV !== 'production') {
  7053. warn$2(`v-slot shorthand syntax requires a slot name.`, binding);
  7054. }
  7055. }
  7056. return dynamicArgRE.test(name)
  7057. ? // dynamic [name]
  7058. { name: name.slice(1, -1), dynamic: true }
  7059. : // static name
  7060. { name: `"${name}"`, dynamic: false };
  7061. }
  7062. // handle <slot/> outlets
  7063. function processSlotOutlet(el) {
  7064. if (el.tag === 'slot') {
  7065. el.slotName = getBindingAttr(el, 'name');
  7066. if (process.env.NODE_ENV !== 'production' && el.key) {
  7067. warn$2(`\`key\` does not work on <slot> because slots are abstract outlets ` +
  7068. `and can possibly expand into multiple elements. ` +
  7069. `Use the key on a wrapping element instead.`, getRawBindingAttr(el, 'key'));
  7070. }
  7071. }
  7072. }
  7073. function processComponent(el) {
  7074. let binding;
  7075. if ((binding = getBindingAttr(el, 'is'))) {
  7076. el.component = binding;
  7077. }
  7078. if (getAndRemoveAttr(el, 'inline-template') != null) {
  7079. el.inlineTemplate = true;
  7080. }
  7081. }
  7082. function processAttrs(el) {
  7083. const list = el.attrsList;
  7084. let i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  7085. for (i = 0, l = list.length; i < l; i++) {
  7086. name = rawName = list[i].name;
  7087. value = list[i].value;
  7088. if (dirRE.test(name)) {
  7089. // mark element as dynamic
  7090. el.hasBindings = true;
  7091. // modifiers
  7092. modifiers = parseModifiers(name.replace(dirRE, ''));
  7093. // support .foo shorthand syntax for the .prop modifier
  7094. if (modifiers) {
  7095. name = name.replace(modifierRE, '');
  7096. }
  7097. if (bindRE.test(name)) {
  7098. // v-bind
  7099. name = name.replace(bindRE, '');
  7100. value = parseFilters(value);
  7101. isDynamic = dynamicArgRE.test(name);
  7102. if (isDynamic) {
  7103. name = name.slice(1, -1);
  7104. }
  7105. if (process.env.NODE_ENV !== 'production' && value.trim().length === 0) {
  7106. warn$2(`The value for a v-bind expression cannot be empty. Found in "v-bind:${name}"`);
  7107. }
  7108. if (modifiers) {
  7109. if (modifiers.prop && !isDynamic) {
  7110. name = camelize(name);
  7111. if (name === 'innerHtml')
  7112. name = 'innerHTML';
  7113. }
  7114. if (modifiers.camel && !isDynamic) {
  7115. name = camelize(name);
  7116. }
  7117. if (modifiers.sync) {
  7118. syncGen = genAssignmentCode(value, `$event`);
  7119. if (!isDynamic) {
  7120. addHandler(el, `update:${camelize(name)}`, syncGen, null, false, warn$2, list[i]);
  7121. if (hyphenate(name) !== camelize(name)) {
  7122. addHandler(el, `update:${hyphenate(name)}`, syncGen, null, false, warn$2, list[i]);
  7123. }
  7124. }
  7125. else {
  7126. // handler w/ dynamic event name
  7127. addHandler(el, `"update:"+(${name})`, syncGen, null, false, warn$2, list[i], true // dynamic
  7128. );
  7129. }
  7130. }
  7131. }
  7132. if ((modifiers && modifiers.prop) ||
  7133. (!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name))) {
  7134. addProp(el, name, value, list[i], isDynamic);
  7135. }
  7136. else {
  7137. addAttr(el, name, value, list[i], isDynamic);
  7138. }
  7139. }
  7140. else if (onRE.test(name)) {
  7141. // v-on
  7142. name = name.replace(onRE, '');
  7143. isDynamic = dynamicArgRE.test(name);
  7144. if (isDynamic) {
  7145. name = name.slice(1, -1);
  7146. }
  7147. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  7148. }
  7149. else {
  7150. // normal directives
  7151. name = name.replace(dirRE, '');
  7152. // parse arg
  7153. const argMatch = name.match(argRE);
  7154. let arg = argMatch && argMatch[1];
  7155. isDynamic = false;
  7156. if (arg) {
  7157. name = name.slice(0, -(arg.length + 1));
  7158. if (dynamicArgRE.test(arg)) {
  7159. arg = arg.slice(1, -1);
  7160. isDynamic = true;
  7161. }
  7162. }
  7163. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  7164. if (process.env.NODE_ENV !== 'production' && name === 'model') {
  7165. checkForAliasModel(el, value);
  7166. }
  7167. }
  7168. }
  7169. else {
  7170. // literal attribute
  7171. if (process.env.NODE_ENV !== 'production') {
  7172. const res = parseText(value, delimiters);
  7173. if (res) {
  7174. warn$2(`${name}="${value}": ` +
  7175. 'Interpolation inside attributes has been removed. ' +
  7176. 'Use v-bind or the colon shorthand instead. For example, ' +
  7177. 'instead of <div id="{{ val }}">, use <div :id="val">.', list[i]);
  7178. }
  7179. }
  7180. addAttr(el, name, JSON.stringify(value), list[i]);
  7181. // #6887 firefox doesn't update muted state if set via attribute
  7182. // even immediately after element creation
  7183. if (!el.component &&
  7184. name === 'muted' &&
  7185. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  7186. addProp(el, name, 'true', list[i]);
  7187. }
  7188. }
  7189. }
  7190. }
  7191. function checkInFor(el) {
  7192. let parent = el;
  7193. while (parent) {
  7194. if (parent.for !== undefined) {
  7195. return true;
  7196. }
  7197. parent = parent.parent;
  7198. }
  7199. return false;
  7200. }
  7201. function parseModifiers(name) {
  7202. const match = name.match(modifierRE);
  7203. if (match) {
  7204. const ret = {};
  7205. match.forEach(m => {
  7206. ret[m.slice(1)] = true;
  7207. });
  7208. return ret;
  7209. }
  7210. }
  7211. function makeAttrsMap(attrs) {
  7212. const map = {};
  7213. for (let i = 0, l = attrs.length; i < l; i++) {
  7214. if (process.env.NODE_ENV !== 'production' && map[attrs[i].name] && !isIE && !isEdge) {
  7215. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  7216. }
  7217. map[attrs[i].name] = attrs[i].value;
  7218. }
  7219. return map;
  7220. }
  7221. // for script (e.g. type="x/template") or style, do not decode content
  7222. function isTextTag(el) {
  7223. return el.tag === 'script' || el.tag === 'style';
  7224. }
  7225. function isForbiddenTag(el) {
  7226. return (el.tag === 'style' ||
  7227. (el.tag === 'script' &&
  7228. (!el.attrsMap.type || el.attrsMap.type === 'text/javascript')));
  7229. }
  7230. const ieNSBug = /^xmlns:NS\d+/;
  7231. const ieNSPrefix = /^NS\d+:/;
  7232. /* istanbul ignore next */
  7233. function guardIESVGBug(attrs) {
  7234. const res = [];
  7235. for (let i = 0; i < attrs.length; i++) {
  7236. const attr = attrs[i];
  7237. if (!ieNSBug.test(attr.name)) {
  7238. attr.name = attr.name.replace(ieNSPrefix, '');
  7239. res.push(attr);
  7240. }
  7241. }
  7242. return res;
  7243. }
  7244. function checkForAliasModel(el, value) {
  7245. let _el = el;
  7246. while (_el) {
  7247. if (_el.for && _el.alias === value) {
  7248. warn$2(`<${el.tag} v-model="${value}">: ` +
  7249. `You are binding v-model directly to a v-for iteration alias. ` +
  7250. `This will not be able to modify the v-for source array because ` +
  7251. `writing to the alias is like modifying a function local variable. ` +
  7252. `Consider using an array of objects and use v-model on an object property instead.`, el.rawAttrsMap['v-model']);
  7253. }
  7254. _el = _el.parent;
  7255. }
  7256. }
  7257. /**
  7258. * Expand input[v-model] with dynamic type bindings into v-if-else chains
  7259. * Turn this:
  7260. * <input v-model="data[type]" :type="type">
  7261. * into this:
  7262. * <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
  7263. * <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
  7264. * <input v-else :type="type" v-model="data[type]">
  7265. */
  7266. function preTransformNode(el, options) {
  7267. if (el.tag === 'input') {
  7268. const map = el.attrsMap;
  7269. if (!map['v-model']) {
  7270. return;
  7271. }
  7272. let typeBinding;
  7273. if (map[':type'] || map['v-bind:type']) {
  7274. typeBinding = getBindingAttr(el, 'type');
  7275. }
  7276. if (!map.type && !typeBinding && map['v-bind']) {
  7277. typeBinding = `(${map['v-bind']}).type`;
  7278. }
  7279. if (typeBinding) {
  7280. const ifCondition = getAndRemoveAttr(el, 'v-if', true);
  7281. const ifConditionExtra = ifCondition ? `&&(${ifCondition})` : ``;
  7282. const hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  7283. const elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  7284. // 1. checkbox
  7285. const branch0 = cloneASTElement(el);
  7286. // process for on the main node
  7287. processFor(branch0);
  7288. addRawAttr(branch0, 'type', 'checkbox');
  7289. processElement(branch0, options);
  7290. branch0.processed = true; // prevent it from double-processed
  7291. branch0.if = `(${typeBinding})==='checkbox'` + ifConditionExtra;
  7292. addIfCondition(branch0, {
  7293. exp: branch0.if,
  7294. block: branch0
  7295. });
  7296. // 2. add radio else-if condition
  7297. const branch1 = cloneASTElement(el);
  7298. getAndRemoveAttr(branch1, 'v-for', true);
  7299. addRawAttr(branch1, 'type', 'radio');
  7300. processElement(branch1, options);
  7301. addIfCondition(branch0, {
  7302. exp: `(${typeBinding})==='radio'` + ifConditionExtra,
  7303. block: branch1
  7304. });
  7305. // 3. other
  7306. const branch2 = cloneASTElement(el);
  7307. getAndRemoveAttr(branch2, 'v-for', true);
  7308. addRawAttr(branch2, ':type', typeBinding);
  7309. processElement(branch2, options);
  7310. addIfCondition(branch0, {
  7311. exp: ifCondition,
  7312. block: branch2
  7313. });
  7314. if (hasElse) {
  7315. branch0.else = true;
  7316. }
  7317. else if (elseIfCondition) {
  7318. branch0.elseif = elseIfCondition;
  7319. }
  7320. return branch0;
  7321. }
  7322. }
  7323. }
  7324. function cloneASTElement(el) {
  7325. return createASTElement(el.tag, el.attrsList.slice(), el.parent);
  7326. }
  7327. var model$1 = {
  7328. preTransformNode
  7329. };
  7330. var modules = [klass, style, model$1];
  7331. let warn$1;
  7332. // in some cases, the event used has to be determined at runtime
  7333. // so we used some reserved tokens during compile.
  7334. const RANGE_TOKEN = '__r';
  7335. function model(el, dir, _warn) {
  7336. warn$1 = _warn;
  7337. const value = dir.value;
  7338. const modifiers = dir.modifiers;
  7339. const tag = el.tag;
  7340. const type = el.attrsMap.type;
  7341. if (process.env.NODE_ENV !== 'production') {
  7342. // inputs with type="file" are read only and setting the input's
  7343. // value will throw an error.
  7344. if (tag === 'input' && type === 'file') {
  7345. warn$1(`<${el.tag} v-model="${value}" type="file">:\n` +
  7346. `File inputs are read only. Use a v-on:change listener instead.`, el.rawAttrsMap['v-model']);
  7347. }
  7348. }
  7349. if (el.component) {
  7350. genComponentModel(el, value, modifiers);
  7351. // component v-model doesn't need extra runtime
  7352. return false;
  7353. }
  7354. else if (tag === 'select') {
  7355. genSelect(el, value, modifiers);
  7356. }
  7357. else if (tag === 'input' && type === 'checkbox') {
  7358. genCheckboxModel(el, value, modifiers);
  7359. }
  7360. else if (tag === 'input' && type === 'radio') {
  7361. genRadioModel(el, value, modifiers);
  7362. }
  7363. else if (tag === 'input' || tag === 'textarea') {
  7364. genDefaultModel(el, value, modifiers);
  7365. }
  7366. else {
  7367. genComponentModel(el, value, modifiers);
  7368. // component v-model doesn't need extra runtime
  7369. return false;
  7370. }
  7371. // ensure runtime directive metadata
  7372. return true;
  7373. }
  7374. function genCheckboxModel(el, value, modifiers) {
  7375. const number = modifiers && modifiers.number;
  7376. const valueBinding = getBindingAttr(el, 'value') || 'null';
  7377. const trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  7378. const falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  7379. addProp(el, 'checked', `Array.isArray(${value})` +
  7380. `?_i(${value},${valueBinding})>-1` +
  7381. (trueValueBinding === 'true'
  7382. ? `:(${value})`
  7383. : `:_q(${value},${trueValueBinding})`));
  7384. addHandler(el, 'change', `var $$a=${value},` +
  7385. '$$el=$event.target,' +
  7386. `$$c=$$el.checked?(${trueValueBinding}):(${falseValueBinding});` +
  7387. 'if(Array.isArray($$a)){' +
  7388. `var $$v=${number ? '_n(' + valueBinding + ')' : valueBinding},` +
  7389. '$$i=_i($$a,$$v);' +
  7390. `if($$el.checked){$$i<0&&(${genAssignmentCode(value, '$$a.concat([$$v])')})}` +
  7391. `else{$$i>-1&&(${genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')})}` +
  7392. `}else{${genAssignmentCode(value, '$$c')}}`, null, true);
  7393. }
  7394. function genRadioModel(el, value, modifiers) {
  7395. const number = modifiers && modifiers.number;
  7396. let valueBinding = getBindingAttr(el, 'value') || 'null';
  7397. valueBinding = number ? `_n(${valueBinding})` : valueBinding;
  7398. addProp(el, 'checked', `_q(${value},${valueBinding})`);
  7399. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  7400. }
  7401. function genSelect(el, value, modifiers) {
  7402. const number = modifiers && modifiers.number;
  7403. const selectedVal = `Array.prototype.filter` +
  7404. `.call($event.target.options,function(o){return o.selected})` +
  7405. `.map(function(o){var val = "_value" in o ? o._value : o.value;` +
  7406. `return ${number ? '_n(val)' : 'val'}})`;
  7407. const assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  7408. let code = `var $$selectedVal = ${selectedVal};`;
  7409. code = `${code} ${genAssignmentCode(value, assignment)}`;
  7410. addHandler(el, 'change', code, null, true);
  7411. }
  7412. function genDefaultModel(el, value, modifiers) {
  7413. const type = el.attrsMap.type;
  7414. // warn if v-bind:value conflicts with v-model
  7415. // except for inputs with v-bind:type
  7416. if (process.env.NODE_ENV !== 'production') {
  7417. const value = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  7418. const typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  7419. if (value && !typeBinding) {
  7420. const binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  7421. warn$1(`${binding}="${value}" conflicts with v-model on the same element ` +
  7422. 'because the latter already expands to a value binding internally', el.rawAttrsMap[binding]);
  7423. }
  7424. }
  7425. const { lazy, number, trim } = modifiers || {};
  7426. const needCompositionGuard = !lazy && type !== 'range';
  7427. const event = lazy ? 'change' : type === 'range' ? RANGE_TOKEN : 'input';
  7428. let valueExpression = '$event.target.value';
  7429. if (trim) {
  7430. valueExpression = `$event.target.value.trim()`;
  7431. }
  7432. if (number) {
  7433. valueExpression = `_n(${valueExpression})`;
  7434. }
  7435. let code = genAssignmentCode(value, valueExpression);
  7436. if (needCompositionGuard) {
  7437. code = `if($event.target.composing)return;${code}`;
  7438. }
  7439. addProp(el, 'value', `(${value})`);
  7440. addHandler(el, event, code, null, true);
  7441. if (trim || number) {
  7442. addHandler(el, 'blur', '$forceUpdate()');
  7443. }
  7444. }
  7445. function text(el, dir) {
  7446. if (dir.value) {
  7447. addProp(el, 'textContent', `_s(${dir.value})`, dir);
  7448. }
  7449. }
  7450. function html(el, dir) {
  7451. if (dir.value) {
  7452. addProp(el, 'innerHTML', `_s(${dir.value})`, dir);
  7453. }
  7454. }
  7455. var directives = {
  7456. model,
  7457. text,
  7458. html
  7459. };
  7460. const baseOptions = {
  7461. expectHTML: true,
  7462. modules,
  7463. directives,
  7464. isPreTag,
  7465. isUnaryTag,
  7466. mustUseProp,
  7467. canBeLeftOpenTag,
  7468. isReservedTag,
  7469. getTagNamespace,
  7470. staticKeys: genStaticKeys$1(modules)
  7471. };
  7472. const hasWarned = {};
  7473. function warnOnce(msg) {
  7474. const isNodeProd = typeof process !== 'undefined' && process.env.NODE_ENV === 'production';
  7475. if (!isNodeProd && !hasWarned[msg]) {
  7476. hasWarned[msg] = true;
  7477. warn(msg);
  7478. }
  7479. }
  7480. function warn(msg) {
  7481. console.warn(`\x1b[1m\x1b[33m[@vue/compiler-sfc]\x1b[0m\x1b[33m ${msg}\x1b[0m\n`);
  7482. }
  7483. const doNotPrefix = makeMap('Infinity,undefined,NaN,isFinite,isNaN,' +
  7484. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  7485. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  7486. 'require,' + // for webpack
  7487. 'arguments,' + // parsed as identifier but is a special keyword...
  7488. '_c' // cached to save property access
  7489. );
  7490. /**
  7491. * The input is expected to be a valid expression.
  7492. */
  7493. function prefixIdentifiers(source, isFunctional = false, isTS = false, babelOptions = {}, bindings) {
  7494. const s = new MagicString(source);
  7495. const plugins = [
  7496. ...(isTS ? ['typescript'] : []),
  7497. ...((babelOptions === null || babelOptions === void 0 ? void 0 : babelOptions.plugins) || [])
  7498. ];
  7499. const ast = parser$1.parseExpression(source, Object.assign(Object.assign({}, babelOptions), { plugins }));
  7500. const isScriptSetup = bindings && bindings.__isScriptSetup !== false;
  7501. walkIdentifiers(ast, (ident, parent) => {
  7502. const { name } = ident;
  7503. if (doNotPrefix(name)) {
  7504. return;
  7505. }
  7506. let prefix = `_vm.`;
  7507. if (isScriptSetup) {
  7508. const type = bindings[name];
  7509. if (type && type.startsWith('setup')) {
  7510. prefix = `_setup.`;
  7511. }
  7512. }
  7513. if (isStaticProperty(parent) && parent.shorthand) {
  7514. // property shorthand like { foo }, we need to add the key since
  7515. // we rewrite the value
  7516. // { foo } -> { foo: _vm.foo }
  7517. s.appendLeft(ident.end, `: ${prefix}${name}`);
  7518. }
  7519. else {
  7520. s.prependRight(ident.start, prefix);
  7521. }
  7522. }, node => {
  7523. if (node.type === 'WithStatement') {
  7524. s.remove(node.start, node.body.start + 1);
  7525. s.remove(node.end - 1, node.end);
  7526. if (!isFunctional) {
  7527. s.prependRight(node.start, `var _vm=this,_c=_vm._self._c${isScriptSetup ? `,_setup=_vm._self._setupProxy;` : `;`}`);
  7528. }
  7529. }
  7530. });
  7531. return s.toString();
  7532. }
  7533. const CSS_VARS_HELPER = `useCssVars`;
  7534. function genCssVarsFromList(vars, id, isProd, isSSR = false) {
  7535. return `{\n ${vars
  7536. .map(key => `"${isSSR ? `--` : ``}${genVarName(id, key, isProd)}": (${key})`)
  7537. .join(',\n ')}\n}`;
  7538. }
  7539. function genVarName(id, raw, isProd) {
  7540. if (isProd) {
  7541. return hashSum(id + raw);
  7542. }
  7543. else {
  7544. return `${id}-${raw.replace(/([^\w-])/g, '_')}`;
  7545. }
  7546. }
  7547. function normalizeExpression(exp) {
  7548. exp = exp.trim();
  7549. if ((exp[0] === `'` && exp[exp.length - 1] === `'`) ||
  7550. (exp[0] === `"` && exp[exp.length - 1] === `"`)) {
  7551. return exp.slice(1, -1);
  7552. }
  7553. return exp;
  7554. }
  7555. const vBindRE = /v-bind\s*\(/g;
  7556. function parseCssVars(sfc) {
  7557. const vars = [];
  7558. sfc.styles.forEach(style => {
  7559. let match;
  7560. // ignore v-bind() in comments /* ... */
  7561. const content = style.content.replace(/\/\*([\s\S]*?)\*\//g, '');
  7562. while ((match = vBindRE.exec(content))) {
  7563. const start = match.index + match[0].length;
  7564. const end = lexBinding(content, start);
  7565. if (end !== null) {
  7566. const variable = normalizeExpression(content.slice(start, end));
  7567. if (!vars.includes(variable)) {
  7568. vars.push(variable);
  7569. }
  7570. }
  7571. }
  7572. });
  7573. return vars;
  7574. }
  7575. function lexBinding(content, start) {
  7576. let state = 0 /* LexerState.inParens */;
  7577. let parenDepth = 0;
  7578. for (let i = start; i < content.length; i++) {
  7579. const char = content.charAt(i);
  7580. switch (state) {
  7581. case 0 /* LexerState.inParens */:
  7582. if (char === `'`) {
  7583. state = 1 /* LexerState.inSingleQuoteString */;
  7584. }
  7585. else if (char === `"`) {
  7586. state = 2 /* LexerState.inDoubleQuoteString */;
  7587. }
  7588. else if (char === `(`) {
  7589. parenDepth++;
  7590. }
  7591. else if (char === `)`) {
  7592. if (parenDepth > 0) {
  7593. parenDepth--;
  7594. }
  7595. else {
  7596. return i;
  7597. }
  7598. }
  7599. break;
  7600. case 1 /* LexerState.inSingleQuoteString */:
  7601. if (char === `'`) {
  7602. state = 0 /* LexerState.inParens */;
  7603. }
  7604. break;
  7605. case 2 /* LexerState.inDoubleQuoteString */:
  7606. if (char === `"`) {
  7607. state = 0 /* LexerState.inParens */;
  7608. }
  7609. break;
  7610. }
  7611. }
  7612. return null;
  7613. }
  7614. const cssVarsPlugin = opts => {
  7615. const { id, isProd } = opts;
  7616. return {
  7617. postcssPlugin: 'vue-sfc-vars',
  7618. Declaration(decl) {
  7619. // rewrite CSS variables
  7620. const value = decl.value;
  7621. if (vBindRE.test(value)) {
  7622. vBindRE.lastIndex = 0;
  7623. let transformed = '';
  7624. let lastIndex = 0;
  7625. let match;
  7626. while ((match = vBindRE.exec(value))) {
  7627. const start = match.index + match[0].length;
  7628. const end = lexBinding(value, start);
  7629. if (end !== null) {
  7630. const variable = normalizeExpression(value.slice(start, end));
  7631. transformed +=
  7632. value.slice(lastIndex, match.index) +
  7633. `var(--${genVarName(id, variable, isProd)})`;
  7634. lastIndex = end + 1;
  7635. }
  7636. }
  7637. decl.value = transformed + value.slice(lastIndex);
  7638. }
  7639. }
  7640. };
  7641. };
  7642. cssVarsPlugin.postcss = true;
  7643. function genCssVarsCode(vars, bindings, id, isProd) {
  7644. const varsExp = genCssVarsFromList(vars, id, isProd);
  7645. return `_${CSS_VARS_HELPER}((_vm, _setup) => ${prefixIdentifiers(`(${varsExp})`, false, false, undefined, bindings)})`;
  7646. }
  7647. // <script setup> already gets the calls injected as part of the transform
  7648. // this is only for single normal <script>
  7649. function genNormalScriptCssVarsCode(cssVars, bindings, id, isProd) {
  7650. return (`\nimport { ${CSS_VARS_HELPER} as _${CSS_VARS_HELPER} } from 'vue'\n` +
  7651. `const __injectCSSVars__ = () => {\n${genCssVarsCode(cssVars, bindings, id, isProd)}}\n` +
  7652. `const __setup__ = __default__.setup\n` +
  7653. `__default__.setup = __setup__\n` +
  7654. ` ? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) }\n` +
  7655. ` : __injectCSSVars__\n`);
  7656. }
  7657. const defaultExportRE = /((?:^|\n|;)\s*)export(\s*)default/;
  7658. const namedDefaultExportRE = /((?:^|\n|;)\s*)export(.+)(?:as)?(\s*)default/s;
  7659. const exportDefaultClassRE = /((?:^|\n|;)\s*)export\s+default\s+class\s+([\w$]+)/;
  7660. /**
  7661. * Utility for rewriting `export default` in a script block into a variable
  7662. * declaration so that we can inject things into it
  7663. */
  7664. function rewriteDefault(input, as, parserPlugins) {
  7665. if (!hasDefaultExport(input)) {
  7666. return input + `\nconst ${as} = {}`;
  7667. }
  7668. let replaced;
  7669. const classMatch = input.match(exportDefaultClassRE);
  7670. if (classMatch) {
  7671. replaced =
  7672. input.replace(exportDefaultClassRE, '$1class $2') +
  7673. `\nconst ${as} = ${classMatch[2]}`;
  7674. }
  7675. else {
  7676. replaced = input.replace(defaultExportRE, `$1const ${as} =`);
  7677. }
  7678. if (!hasDefaultExport(replaced)) {
  7679. return replaced;
  7680. }
  7681. // if the script somehow still contains `default export`, it probably has
  7682. // multi-line comments or template strings. fallback to a full parse.
  7683. const s = new MagicString(input);
  7684. const ast = parser$1.parse(input, {
  7685. sourceType: 'module',
  7686. plugins: parserPlugins
  7687. }).program.body;
  7688. ast.forEach(node => {
  7689. if (node.type === 'ExportDefaultDeclaration') {
  7690. if (node.declaration.type === 'ClassDeclaration') {
  7691. s.overwrite(node.start, node.declaration.id.start, `class `);
  7692. s.append(`\nconst ${as} = ${node.declaration.id.name}`);
  7693. }
  7694. else {
  7695. s.overwrite(node.start, node.declaration.start, `const ${as} = `);
  7696. }
  7697. }
  7698. if (node.type === 'ExportNamedDeclaration') {
  7699. for (const specifier of node.specifiers) {
  7700. if (specifier.type === 'ExportSpecifier' &&
  7701. specifier.exported.type === 'Identifier' &&
  7702. specifier.exported.name === 'default') {
  7703. if (node.source) {
  7704. if (specifier.local.name === 'default') {
  7705. const end = specifierEnd(input, specifier.local.end, node.end);
  7706. s.prepend(`import { default as __VUE_DEFAULT__ } from '${node.source.value}'\n`);
  7707. s.overwrite(specifier.start, end, ``);
  7708. s.append(`\nconst ${as} = __VUE_DEFAULT__`);
  7709. continue;
  7710. }
  7711. else {
  7712. const end = specifierEnd(input, specifier.exported.end, node.end);
  7713. s.prepend(`import { ${input.slice(specifier.local.start, specifier.local.end)} } from '${node.source.value}'\n`);
  7714. s.overwrite(specifier.start, end, ``);
  7715. s.append(`\nconst ${as} = ${specifier.local.name}`);
  7716. continue;
  7717. }
  7718. }
  7719. const end = specifierEnd(input, specifier.end, node.end);
  7720. s.overwrite(specifier.start, end, ``);
  7721. s.append(`\nconst ${as} = ${specifier.local.name}`);
  7722. }
  7723. }
  7724. }
  7725. });
  7726. return s.toString();
  7727. }
  7728. function hasDefaultExport(input) {
  7729. return defaultExportRE.test(input) || namedDefaultExportRE.test(input);
  7730. }
  7731. function specifierEnd(input, end, nodeEnd) {
  7732. // export { default , foo } ...
  7733. let hasCommas = false;
  7734. let oldEnd = end;
  7735. while (end < nodeEnd) {
  7736. if (/\s/.test(input.charAt(end))) {
  7737. end++;
  7738. }
  7739. else if (input.charAt(end) === ',') {
  7740. end++;
  7741. hasCommas = true;
  7742. break;
  7743. }
  7744. else if (input.charAt(end) === '}') {
  7745. break;
  7746. }
  7747. }
  7748. return hasCommas ? end : oldEnd;
  7749. }
  7750. // Special compiler macros
  7751. const DEFINE_PROPS = 'defineProps';
  7752. const DEFINE_EMITS = 'defineEmits';
  7753. const DEFINE_EXPOSE = 'defineExpose';
  7754. const WITH_DEFAULTS = 'withDefaults';
  7755. // constants
  7756. const DEFAULT_VAR = `__default__`;
  7757. const isBuiltInDir$1 = makeMap(`once,memo,if,for,else,else-if,slot,text,html,on,bind,model,show,cloak,is`);
  7758. /**
  7759. * Compile `<script setup>`
  7760. * It requires the whole SFC descriptor because we need to handle and merge
  7761. * normal `<script>` + `<script setup>` if both are present.
  7762. */
  7763. function compileScript(sfc, options = { id: '' }) {
  7764. let { filename, script, scriptSetup, source } = sfc;
  7765. const isProd = !!options.isProd;
  7766. const genSourceMap = options.sourceMap !== false;
  7767. const cssVars = sfc.cssVars;
  7768. const scopeId = options.id ? options.id.replace(/^data-v-/, '') : '';
  7769. const scriptLang = script && script.lang;
  7770. const scriptSetupLang = scriptSetup && scriptSetup.lang;
  7771. const isTS = scriptLang === 'ts' ||
  7772. scriptLang === 'tsx' ||
  7773. scriptSetupLang === 'ts' ||
  7774. scriptSetupLang === 'tsx';
  7775. // resolve parser plugins
  7776. const plugins = [];
  7777. if (!isTS || scriptLang === 'tsx' || scriptSetupLang === 'tsx') {
  7778. plugins.push('jsx');
  7779. }
  7780. else {
  7781. // If don't match the case of adding jsx, should remove the jsx from the babelParserPlugins
  7782. if (options.babelParserPlugins)
  7783. options.babelParserPlugins = options.babelParserPlugins.filter(n => n !== 'jsx');
  7784. }
  7785. if (options.babelParserPlugins)
  7786. plugins.push(...options.babelParserPlugins);
  7787. if (isTS) {
  7788. plugins.push('typescript');
  7789. if (!plugins.includes('decorators')) {
  7790. plugins.push('decorators-legacy');
  7791. }
  7792. }
  7793. if (!scriptSetup) {
  7794. if (!script) {
  7795. throw new Error(`[@vue/compiler-sfc] SFC contains no <script> tags.`);
  7796. }
  7797. if (scriptLang && !isTS && scriptLang !== 'jsx') {
  7798. // do not process non js/ts script blocks
  7799. return script;
  7800. }
  7801. try {
  7802. let content = script.content;
  7803. let map = script.map;
  7804. const scriptAst = parser$1.parse(content, {
  7805. plugins,
  7806. sourceType: 'module'
  7807. }).program;
  7808. const bindings = analyzeScriptBindings(scriptAst.body);
  7809. if (cssVars.length) {
  7810. content = rewriteDefault(content, DEFAULT_VAR, plugins);
  7811. content += genNormalScriptCssVarsCode(cssVars, bindings, scopeId, isProd);
  7812. content += `\nexport default ${DEFAULT_VAR}`;
  7813. }
  7814. return Object.assign(Object.assign({}, script), { content,
  7815. map,
  7816. bindings, scriptAst: scriptAst.body });
  7817. }
  7818. catch (e) {
  7819. // silently fallback if parse fails since user may be using custom
  7820. // babel syntax
  7821. return script;
  7822. }
  7823. }
  7824. if (script && scriptLang !== scriptSetupLang) {
  7825. throw new Error(`[@vue/compiler-sfc] <script> and <script setup> must have the same ` +
  7826. `language type.`);
  7827. }
  7828. if (scriptSetupLang && !isTS && scriptSetupLang !== 'jsx') {
  7829. // do not process non js/ts script blocks
  7830. return scriptSetup;
  7831. }
  7832. // metadata that needs to be returned
  7833. const bindingMetadata = {};
  7834. const helperImports = new Set();
  7835. const userImports = Object.create(null);
  7836. const userImportAlias = Object.create(null);
  7837. const scriptBindings = Object.create(null);
  7838. const setupBindings = Object.create(null);
  7839. let defaultExport;
  7840. let hasDefinePropsCall = false;
  7841. let hasDefineEmitCall = false;
  7842. let hasDefineExposeCall = false;
  7843. let hasDefaultExportName = false;
  7844. let propsRuntimeDecl;
  7845. let propsRuntimeDefaults;
  7846. let propsDestructureDecl;
  7847. let propsTypeDecl;
  7848. let propsTypeDeclRaw;
  7849. let propsIdentifier;
  7850. let emitsRuntimeDecl;
  7851. let emitsTypeDecl;
  7852. let emitsTypeDeclRaw;
  7853. let emitIdentifier;
  7854. // props/emits declared via types
  7855. const typeDeclaredProps = {};
  7856. const typeDeclaredEmits = new Set();
  7857. // record declared types for runtime props type generation
  7858. const declaredTypes = {};
  7859. // props destructure data
  7860. const propsDestructuredBindings = Object.create(null);
  7861. // magic-string state
  7862. const s = new MagicString(source);
  7863. const startOffset = scriptSetup.start;
  7864. const endOffset = scriptSetup.end;
  7865. const scriptStartOffset = script && script.start;
  7866. const scriptEndOffset = script && script.end;
  7867. function helper(key) {
  7868. helperImports.add(key);
  7869. return `_${key}`;
  7870. }
  7871. function parse(input, options, offset) {
  7872. try {
  7873. return parser$1.parse(input, options).program;
  7874. }
  7875. catch (e) {
  7876. e.message = `[@vue/compiler-sfc] ${e.message}\n\n${filename}\n${generateCodeFrame(source, e.pos + offset, e.pos + offset + 1)}`;
  7877. throw e;
  7878. }
  7879. }
  7880. function error(msg, node, end = node.end + startOffset) {
  7881. throw new Error(`[@vue/compiler-sfc] ${msg}\n\n${filename}\n${generateCodeFrame(source, node.start + startOffset, end)}`);
  7882. }
  7883. function registerUserImport(source, local, imported, isType, isFromSetup) {
  7884. if (source === 'vue' && imported) {
  7885. userImportAlias[imported] = local;
  7886. }
  7887. let isUsedInTemplate = true;
  7888. if (sfc.template && !sfc.template.src && !sfc.template.lang) {
  7889. isUsedInTemplate = isImportUsed(local, sfc, isTS);
  7890. }
  7891. userImports[local] = {
  7892. isType,
  7893. imported: imported || 'default',
  7894. source,
  7895. isFromSetup,
  7896. isUsedInTemplate
  7897. };
  7898. }
  7899. function processDefineProps(node, declId) {
  7900. if (!isCallOf(node, DEFINE_PROPS)) {
  7901. return false;
  7902. }
  7903. if (hasDefinePropsCall) {
  7904. error(`duplicate ${DEFINE_PROPS}() call`, node);
  7905. }
  7906. hasDefinePropsCall = true;
  7907. propsRuntimeDecl = node.arguments[0];
  7908. // call has type parameters - infer runtime types from it
  7909. if (node.typeParameters) {
  7910. if (propsRuntimeDecl) {
  7911. error(`${DEFINE_PROPS}() cannot accept both type and non-type arguments ` +
  7912. `at the same time. Use one or the other.`, node);
  7913. }
  7914. propsTypeDeclRaw = node.typeParameters.params[0];
  7915. propsTypeDecl = resolveQualifiedType(propsTypeDeclRaw, node => node.type === 'TSTypeLiteral');
  7916. if (!propsTypeDecl) {
  7917. error(`type argument passed to ${DEFINE_PROPS}() must be a literal type, ` +
  7918. `or a reference to an interface or literal type.`, propsTypeDeclRaw);
  7919. }
  7920. }
  7921. if (declId) {
  7922. propsIdentifier = scriptSetup.content.slice(declId.start, declId.end);
  7923. }
  7924. return true;
  7925. }
  7926. function processWithDefaults(node, declId) {
  7927. if (!isCallOf(node, WITH_DEFAULTS)) {
  7928. return false;
  7929. }
  7930. if (processDefineProps(node.arguments[0], declId)) {
  7931. if (propsRuntimeDecl) {
  7932. error(`${WITH_DEFAULTS} can only be used with type-based ` +
  7933. `${DEFINE_PROPS} declaration.`, node);
  7934. }
  7935. propsRuntimeDefaults = node.arguments[1];
  7936. if (!propsRuntimeDefaults ||
  7937. propsRuntimeDefaults.type !== 'ObjectExpression') {
  7938. error(`The 2nd argument of ${WITH_DEFAULTS} must be an object literal.`, propsRuntimeDefaults || node);
  7939. }
  7940. }
  7941. else {
  7942. error(`${WITH_DEFAULTS}' first argument must be a ${DEFINE_PROPS} call.`, node.arguments[0] || node);
  7943. }
  7944. return true;
  7945. }
  7946. function processDefineEmits(node, declId) {
  7947. if (!isCallOf(node, DEFINE_EMITS)) {
  7948. return false;
  7949. }
  7950. if (hasDefineEmitCall) {
  7951. error(`duplicate ${DEFINE_EMITS}() call`, node);
  7952. }
  7953. hasDefineEmitCall = true;
  7954. emitsRuntimeDecl = node.arguments[0];
  7955. if (node.typeParameters) {
  7956. if (emitsRuntimeDecl) {
  7957. error(`${DEFINE_EMITS}() cannot accept both type and non-type arguments ` +
  7958. `at the same time. Use one or the other.`, node);
  7959. }
  7960. emitsTypeDeclRaw = node.typeParameters.params[0];
  7961. emitsTypeDecl = resolveQualifiedType(emitsTypeDeclRaw, node => node.type === 'TSFunctionType' || node.type === 'TSTypeLiteral');
  7962. if (!emitsTypeDecl) {
  7963. error(`type argument passed to ${DEFINE_EMITS}() must be a function type, ` +
  7964. `a literal type with call signatures, or a reference to the above types.`, emitsTypeDeclRaw);
  7965. }
  7966. }
  7967. if (declId) {
  7968. emitIdentifier = scriptSetup.content.slice(declId.start, declId.end);
  7969. }
  7970. return true;
  7971. }
  7972. function resolveQualifiedType(node, qualifier) {
  7973. if (qualifier(node)) {
  7974. return node;
  7975. }
  7976. if (node.type === 'TSTypeReference' &&
  7977. node.typeName.type === 'Identifier') {
  7978. const refName = node.typeName.name;
  7979. const isQualifiedType = (node) => {
  7980. if (node.type === 'TSInterfaceDeclaration' &&
  7981. node.id.name === refName) {
  7982. return node.body;
  7983. }
  7984. else if (node.type === 'TSTypeAliasDeclaration' &&
  7985. node.id.name === refName &&
  7986. qualifier(node.typeAnnotation)) {
  7987. return node.typeAnnotation;
  7988. }
  7989. else if (node.type === 'ExportNamedDeclaration' && node.declaration) {
  7990. return isQualifiedType(node.declaration);
  7991. }
  7992. };
  7993. const body = scriptAst
  7994. ? [...scriptSetupAst.body, ...scriptAst.body]
  7995. : scriptSetupAst.body;
  7996. for (const node of body) {
  7997. const qualified = isQualifiedType(node);
  7998. if (qualified) {
  7999. return qualified;
  8000. }
  8001. }
  8002. }
  8003. }
  8004. function processDefineExpose(node) {
  8005. if (isCallOf(node, DEFINE_EXPOSE)) {
  8006. if (hasDefineExposeCall) {
  8007. error(`duplicate ${DEFINE_EXPOSE}() call`, node);
  8008. }
  8009. hasDefineExposeCall = true;
  8010. return true;
  8011. }
  8012. return false;
  8013. }
  8014. function checkInvalidScopeReference(node, method) {
  8015. if (!node)
  8016. return;
  8017. walkIdentifiers(node, id => {
  8018. if (setupBindings[id.name]) {
  8019. error(`\`${method}()\` in <script setup> cannot reference locally ` +
  8020. `declared variables because it will be hoisted outside of the ` +
  8021. `setup() function. If your component options require initialization ` +
  8022. `in the module scope, use a separate normal <script> to export ` +
  8023. `the options instead.`, id);
  8024. }
  8025. });
  8026. }
  8027. /**
  8028. * check defaults. If the default object is an object literal with only
  8029. * static properties, we can directly generate more optimized default
  8030. * declarations. Otherwise we will have to fallback to runtime merging.
  8031. */
  8032. function hasStaticWithDefaults() {
  8033. return (propsRuntimeDefaults &&
  8034. propsRuntimeDefaults.type === 'ObjectExpression' &&
  8035. propsRuntimeDefaults.properties.every(node => (node.type === 'ObjectProperty' && !node.computed) ||
  8036. node.type === 'ObjectMethod'));
  8037. }
  8038. function genRuntimeProps(props) {
  8039. const keys = Object.keys(props);
  8040. if (!keys.length) {
  8041. return ``;
  8042. }
  8043. const hasStaticDefaults = hasStaticWithDefaults();
  8044. const scriptSetupSource = scriptSetup.content;
  8045. let propsDecls = `{
  8046. ${keys
  8047. .map(key => {
  8048. let defaultString;
  8049. const destructured = genDestructuredDefaultValue(key);
  8050. if (destructured) {
  8051. defaultString = `default: ${destructured}`;
  8052. }
  8053. else if (hasStaticDefaults) {
  8054. const prop = propsRuntimeDefaults.properties.find((node) => node.key.name === key);
  8055. if (prop) {
  8056. if (prop.type === 'ObjectProperty') {
  8057. // prop has corresponding static default value
  8058. defaultString = `default: ${scriptSetupSource.slice(prop.value.start, prop.value.end)}`;
  8059. }
  8060. else {
  8061. defaultString = `default() ${scriptSetupSource.slice(prop.body.start, prop.body.end)}`;
  8062. }
  8063. }
  8064. }
  8065. const { type, required } = props[key];
  8066. if (!isProd) {
  8067. return `${key}: { type: ${toRuntimeTypeString(type)}, required: ${required}${defaultString ? `, ${defaultString}` : ``} }`;
  8068. }
  8069. else if (type.some(el => el === 'Boolean' || (defaultString && el === 'Function'))) {
  8070. // #4783 production: if boolean or defaultString and function exists, should keep the type.
  8071. return `${key}: { type: ${toRuntimeTypeString(type)}${defaultString ? `, ${defaultString}` : ``} }`;
  8072. }
  8073. else {
  8074. // production: checks are useless
  8075. return `${key}: ${defaultString ? `{ ${defaultString} }` : 'null'}`;
  8076. }
  8077. })
  8078. .join(',\n ')}\n }`;
  8079. if (propsRuntimeDefaults && !hasStaticDefaults) {
  8080. propsDecls = `${helper('mergeDefaults')}(${propsDecls}, ${source.slice(propsRuntimeDefaults.start + startOffset, propsRuntimeDefaults.end + startOffset)})`;
  8081. }
  8082. return `\n props: ${propsDecls},`;
  8083. }
  8084. function genDestructuredDefaultValue(key) {
  8085. const destructured = propsDestructuredBindings[key];
  8086. if (destructured && destructured.default) {
  8087. const value = scriptSetup.content.slice(destructured.default.start, destructured.default.end);
  8088. const isLiteral = destructured.default.type.endsWith('Literal');
  8089. return isLiteral ? value : `() => (${value})`;
  8090. }
  8091. }
  8092. function genSetupPropsType(node) {
  8093. const scriptSetupSource = scriptSetup.content;
  8094. if (hasStaticWithDefaults()) {
  8095. // if withDefaults() is used, we need to remove the optional flags
  8096. // on props that have default values
  8097. let res = `{ `;
  8098. const members = node.type === 'TSTypeLiteral' ? node.members : node.body;
  8099. for (const m of members) {
  8100. if ((m.type === 'TSPropertySignature' ||
  8101. m.type === 'TSMethodSignature') &&
  8102. m.typeAnnotation &&
  8103. m.key.type === 'Identifier') {
  8104. if (propsRuntimeDefaults.properties.some((p) => p.key.name === m.key.name)) {
  8105. res +=
  8106. m.key.name +
  8107. (m.type === 'TSMethodSignature' ? '()' : '') +
  8108. scriptSetupSource.slice(m.typeAnnotation.start, m.typeAnnotation.end) +
  8109. ', ';
  8110. }
  8111. else {
  8112. res +=
  8113. scriptSetupSource.slice(m.start, m.typeAnnotation.end) + `, `;
  8114. }
  8115. }
  8116. }
  8117. return (res.length ? res.slice(0, -2) : res) + ` }`;
  8118. }
  8119. else {
  8120. return scriptSetupSource.slice(node.start, node.end);
  8121. }
  8122. }
  8123. // 1. process normal <script> first if it exists
  8124. let scriptAst;
  8125. if (script) {
  8126. scriptAst = parse(script.content, {
  8127. plugins,
  8128. sourceType: 'module'
  8129. }, scriptStartOffset);
  8130. for (const node of scriptAst.body) {
  8131. if (node.type === 'ImportDeclaration') {
  8132. // record imports for dedupe
  8133. for (const specifier of node.specifiers) {
  8134. const imported = specifier.type === 'ImportSpecifier' &&
  8135. specifier.imported.type === 'Identifier' &&
  8136. specifier.imported.name;
  8137. registerUserImport(node.source.value, specifier.local.name, imported, node.importKind === 'type' ||
  8138. (specifier.type === 'ImportSpecifier' &&
  8139. specifier.importKind === 'type'), false);
  8140. }
  8141. }
  8142. else if (node.type === 'ExportDefaultDeclaration') {
  8143. // export default
  8144. defaultExport = node;
  8145. // check if user has manually specified `name` or 'render` option in
  8146. // export default
  8147. // if has name, skip name inference
  8148. // if has render and no template, generate return object instead of
  8149. // empty render function (#4980)
  8150. let optionProperties;
  8151. if (defaultExport.declaration.type === 'ObjectExpression') {
  8152. optionProperties = defaultExport.declaration.properties;
  8153. }
  8154. else if (defaultExport.declaration.type === 'CallExpression' &&
  8155. defaultExport.declaration.arguments[0].type === 'ObjectExpression') {
  8156. optionProperties = defaultExport.declaration.arguments[0].properties;
  8157. }
  8158. if (optionProperties) {
  8159. for (const s of optionProperties) {
  8160. if (s.type === 'ObjectProperty' &&
  8161. s.key.type === 'Identifier' &&
  8162. s.key.name === 'name') {
  8163. hasDefaultExportName = true;
  8164. }
  8165. }
  8166. }
  8167. // export default { ... } --> const __default__ = { ... }
  8168. const start = node.start + scriptStartOffset;
  8169. const end = node.declaration.start + scriptStartOffset;
  8170. s.overwrite(start, end, `const ${DEFAULT_VAR} = `);
  8171. }
  8172. else if (node.type === 'ExportNamedDeclaration') {
  8173. const defaultSpecifier = node.specifiers.find(s => s.exported.type === 'Identifier' && s.exported.name === 'default');
  8174. if (defaultSpecifier) {
  8175. defaultExport = node;
  8176. // 1. remove specifier
  8177. if (node.specifiers.length > 1) {
  8178. s.remove(defaultSpecifier.start + scriptStartOffset, defaultSpecifier.end + scriptStartOffset);
  8179. }
  8180. else {
  8181. s.remove(node.start + scriptStartOffset, node.end + scriptStartOffset);
  8182. }
  8183. if (node.source) {
  8184. // export { x as default } from './x'
  8185. // rewrite to `import { x as __default__ } from './x'` and
  8186. // add to top
  8187. s.prepend(`import { ${defaultSpecifier.local.name} as ${DEFAULT_VAR} } from '${node.source.value}'\n`);
  8188. }
  8189. else {
  8190. // export { x as default }
  8191. // rewrite to `const __default__ = x` and move to end
  8192. s.appendLeft(scriptEndOffset, `\nconst ${DEFAULT_VAR} = ${defaultSpecifier.local.name}\n`);
  8193. }
  8194. }
  8195. if (node.declaration) {
  8196. walkDeclaration(node.declaration, scriptBindings, userImportAlias);
  8197. }
  8198. }
  8199. else if ((node.type === 'VariableDeclaration' ||
  8200. node.type === 'FunctionDeclaration' ||
  8201. node.type === 'ClassDeclaration' ||
  8202. node.type === 'TSEnumDeclaration') &&
  8203. !node.declare) {
  8204. walkDeclaration(node, scriptBindings, userImportAlias);
  8205. }
  8206. }
  8207. // apply reactivity transform
  8208. // if (enableReactivityTransform && shouldTransform(script.content)) {
  8209. // const { rootRefs, importedHelpers } = transformAST(
  8210. // scriptAst,
  8211. // s,
  8212. // scriptStartOffset!
  8213. // )
  8214. // refBindings = rootRefs
  8215. // for (const h of importedHelpers) {
  8216. // helperImports.add(h)
  8217. // }
  8218. // }
  8219. // <script> after <script setup>
  8220. // we need to move the block up so that `const __default__` is
  8221. // declared before being used in the actual component definition
  8222. if (scriptStartOffset > startOffset) {
  8223. // if content doesn't end with newline, add one
  8224. if (!/\n$/.test(script.content.trim())) {
  8225. s.appendLeft(scriptEndOffset, `\n`);
  8226. }
  8227. s.move(scriptStartOffset, scriptEndOffset, 0);
  8228. }
  8229. }
  8230. // 2. parse <script setup> and walk over top level statements
  8231. const scriptSetupAst = parse(scriptSetup.content, {
  8232. plugins: [
  8233. ...plugins,
  8234. // allow top level await but only inside <script setup>
  8235. 'topLevelAwait'
  8236. ],
  8237. sourceType: 'module'
  8238. }, startOffset);
  8239. for (const node of scriptSetupAst.body) {
  8240. const start = node.start + startOffset;
  8241. let end = node.end + startOffset;
  8242. // locate comment
  8243. if (node.trailingComments && node.trailingComments.length > 0) {
  8244. const lastCommentNode = node.trailingComments[node.trailingComments.length - 1];
  8245. end = lastCommentNode.end + startOffset;
  8246. }
  8247. // locate the end of whitespace between this statement and the next
  8248. while (end <= source.length) {
  8249. if (!/\s/.test(source.charAt(end))) {
  8250. break;
  8251. }
  8252. end++;
  8253. }
  8254. // (Dropped) `ref: x` bindings
  8255. if (node.type === 'LabeledStatement' &&
  8256. node.label.name === 'ref' &&
  8257. node.body.type === 'ExpressionStatement') {
  8258. error(`ref sugar using the label syntax was an experimental proposal and ` +
  8259. `has been dropped based on community feedback. Please check out ` +
  8260. `the new proposal at https://github.com/vuejs/rfcs/discussions/369`, node);
  8261. }
  8262. if (node.type === 'ImportDeclaration') {
  8263. // import declarations are moved to top
  8264. s.move(start, end, 0);
  8265. // dedupe imports
  8266. let removed = 0;
  8267. const removeSpecifier = (i) => {
  8268. const removeLeft = i > removed;
  8269. removed++;
  8270. const current = node.specifiers[i];
  8271. const next = node.specifiers[i + 1];
  8272. s.remove(removeLeft
  8273. ? node.specifiers[i - 1].end + startOffset
  8274. : current.start + startOffset, next && !removeLeft
  8275. ? next.start + startOffset
  8276. : current.end + startOffset);
  8277. };
  8278. for (let i = 0; i < node.specifiers.length; i++) {
  8279. const specifier = node.specifiers[i];
  8280. const local = specifier.local.name;
  8281. let imported = specifier.type === 'ImportSpecifier' &&
  8282. specifier.imported.type === 'Identifier' &&
  8283. specifier.imported.name;
  8284. if (specifier.type === 'ImportNamespaceSpecifier') {
  8285. imported = '*';
  8286. }
  8287. const source = node.source.value;
  8288. const existing = userImports[local];
  8289. if (source === 'vue' &&
  8290. (imported === DEFINE_PROPS ||
  8291. imported === DEFINE_EMITS ||
  8292. imported === DEFINE_EXPOSE)) {
  8293. warnOnce(`\`${imported}\` is a compiler macro and no longer needs to be imported.`);
  8294. removeSpecifier(i);
  8295. }
  8296. else if (existing) {
  8297. if (existing.source === source && existing.imported === imported) {
  8298. // already imported in <script setup>, dedupe
  8299. removeSpecifier(i);
  8300. }
  8301. else {
  8302. error(`different imports aliased to same local name.`, specifier);
  8303. }
  8304. }
  8305. else {
  8306. registerUserImport(source, local, imported, node.importKind === 'type' ||
  8307. (specifier.type === 'ImportSpecifier' &&
  8308. specifier.importKind === 'type'), true);
  8309. }
  8310. }
  8311. if (node.specifiers.length && removed === node.specifiers.length) {
  8312. s.remove(node.start + startOffset, node.end + startOffset);
  8313. }
  8314. }
  8315. if (node.type === 'ExpressionStatement') {
  8316. // process `defineProps` and `defineEmit(s)` calls
  8317. if (processDefineProps(node.expression) ||
  8318. processDefineEmits(node.expression) ||
  8319. processWithDefaults(node.expression)) {
  8320. s.remove(node.start + startOffset, node.end + startOffset);
  8321. }
  8322. else if (processDefineExpose(node.expression)) {
  8323. // defineExpose({}) -> expose({})
  8324. const callee = node.expression.callee;
  8325. s.overwrite(callee.start + startOffset, callee.end + startOffset, 'expose');
  8326. }
  8327. }
  8328. if (node.type === 'VariableDeclaration' && !node.declare) {
  8329. const total = node.declarations.length;
  8330. let left = total;
  8331. for (let i = 0; i < total; i++) {
  8332. const decl = node.declarations[i];
  8333. if (decl.init) {
  8334. // defineProps / defineEmits
  8335. const isDefineProps = processDefineProps(decl.init, decl.id) ||
  8336. processWithDefaults(decl.init, decl.id);
  8337. const isDefineEmits = processDefineEmits(decl.init, decl.id);
  8338. if (isDefineProps || isDefineEmits) {
  8339. if (left === 1) {
  8340. s.remove(node.start + startOffset, node.end + startOffset);
  8341. }
  8342. else {
  8343. let start = decl.start + startOffset;
  8344. let end = decl.end + startOffset;
  8345. if (i < total - 1) {
  8346. // not the last one, locate the start of the next
  8347. end = node.declarations[i + 1].start + startOffset;
  8348. }
  8349. else {
  8350. // last one, locate the end of the prev
  8351. start = node.declarations[i - 1].end + startOffset;
  8352. }
  8353. s.remove(start, end);
  8354. left--;
  8355. }
  8356. }
  8357. }
  8358. }
  8359. }
  8360. // walk declarations to record declared bindings
  8361. if ((node.type === 'VariableDeclaration' ||
  8362. node.type === 'FunctionDeclaration' ||
  8363. node.type === 'ClassDeclaration') &&
  8364. !node.declare) {
  8365. walkDeclaration(node, setupBindings, userImportAlias);
  8366. }
  8367. // walk statements & named exports / variable declarations for top level
  8368. // await
  8369. if ((node.type === 'VariableDeclaration' && !node.declare) ||
  8370. node.type.endsWith('Statement')) {
  8371. const scope = [scriptSetupAst.body];
  8372. walk$1(node, {
  8373. enter(child, parent) {
  8374. if (isFunctionType(child)) {
  8375. this.skip();
  8376. }
  8377. if (child.type === 'BlockStatement') {
  8378. scope.push(child.body);
  8379. }
  8380. if (child.type === 'AwaitExpression') {
  8381. error(`Vue 2 does not support top level await in <script setup>.`, child);
  8382. }
  8383. },
  8384. exit(node) {
  8385. if (node.type === 'BlockStatement')
  8386. scope.pop();
  8387. }
  8388. });
  8389. }
  8390. if ((node.type === 'ExportNamedDeclaration' && node.exportKind !== 'type') ||
  8391. node.type === 'ExportAllDeclaration' ||
  8392. node.type === 'ExportDefaultDeclaration') {
  8393. error(`<script setup> cannot contain ES module exports. ` +
  8394. `If you are using a previous version of <script setup>, please ` +
  8395. `consult the updated RFC at https://github.com/vuejs/rfcs/pull/227.`, node);
  8396. }
  8397. if (isTS) {
  8398. // runtime enum
  8399. if (node.type === 'TSEnumDeclaration') {
  8400. registerBinding(setupBindings, node.id, "setup-const" /* BindingTypes.SETUP_CONST */);
  8401. }
  8402. // move all Type declarations to outer scope
  8403. if (node.type.startsWith('TS') ||
  8404. (node.type === 'ExportNamedDeclaration' &&
  8405. node.exportKind === 'type') ||
  8406. (node.type === 'VariableDeclaration' && node.declare)) {
  8407. recordType(node, declaredTypes);
  8408. s.move(start, end, 0);
  8409. }
  8410. }
  8411. }
  8412. // 3. Apply reactivity transform
  8413. // if (
  8414. // (enableReactivityTransform &&
  8415. // // normal <script> had ref bindings that maybe used in <script setup>
  8416. // (refBindings || shouldTransform(scriptSetup.content))) ||
  8417. // propsDestructureDecl
  8418. // ) {
  8419. // const { rootRefs, importedHelpers } = transformAST(
  8420. // scriptSetupAst,
  8421. // s,
  8422. // startOffset,
  8423. // refBindings,
  8424. // propsDestructuredBindings
  8425. // )
  8426. // refBindings = refBindings ? [...refBindings, ...rootRefs] : rootRefs
  8427. // for (const h of importedHelpers) {
  8428. // helperImports.add(h)
  8429. // }
  8430. // }
  8431. // 4. extract runtime props/emits code from setup context type
  8432. if (propsTypeDecl) {
  8433. extractRuntimeProps(propsTypeDecl, typeDeclaredProps, declaredTypes);
  8434. }
  8435. if (emitsTypeDecl) {
  8436. extractRuntimeEmits(emitsTypeDecl, typeDeclaredEmits);
  8437. }
  8438. // 5. check useOptions args to make sure it doesn't reference setup scope
  8439. // variables
  8440. checkInvalidScopeReference(propsRuntimeDecl, DEFINE_PROPS);
  8441. checkInvalidScopeReference(propsRuntimeDefaults, DEFINE_PROPS);
  8442. checkInvalidScopeReference(propsDestructureDecl, DEFINE_PROPS);
  8443. checkInvalidScopeReference(emitsRuntimeDecl, DEFINE_EMITS);
  8444. // 6. remove non-script content
  8445. if (script) {
  8446. if (startOffset < scriptStartOffset) {
  8447. // <script setup> before <script>
  8448. s.remove(0, startOffset);
  8449. s.remove(endOffset, scriptStartOffset);
  8450. s.remove(scriptEndOffset, source.length);
  8451. }
  8452. else {
  8453. // <script> before <script setup>
  8454. s.remove(0, scriptStartOffset);
  8455. s.remove(scriptEndOffset, startOffset);
  8456. s.remove(endOffset, source.length);
  8457. }
  8458. }
  8459. else {
  8460. // only <script setup>
  8461. s.remove(0, startOffset);
  8462. s.remove(endOffset, source.length);
  8463. }
  8464. // 7. analyze binding metadata
  8465. if (scriptAst) {
  8466. Object.assign(bindingMetadata, analyzeScriptBindings(scriptAst.body));
  8467. }
  8468. if (propsRuntimeDecl) {
  8469. for (const key of getObjectOrArrayExpressionKeys(propsRuntimeDecl)) {
  8470. bindingMetadata[key] = "props" /* BindingTypes.PROPS */;
  8471. }
  8472. }
  8473. for (const key in typeDeclaredProps) {
  8474. bindingMetadata[key] = "props" /* BindingTypes.PROPS */;
  8475. }
  8476. // props aliases
  8477. // if (propsDestructureDecl) {
  8478. // if (propsDestructureRestId) {
  8479. // bindingMetadata[propsDestructureRestId] =
  8480. // BindingTypes.SETUP_REACTIVE_CONST
  8481. // }
  8482. // for (const key in propsDestructuredBindings) {
  8483. // const { local } = propsDestructuredBindings[key]
  8484. // if (local !== key) {
  8485. // bindingMetadata[local] = BindingTypes.PROPS_ALIASED
  8486. // ;(bindingMetadata.__propsAliases ||
  8487. // (bindingMetadata.__propsAliases = {}))[local] = key
  8488. // }
  8489. // }
  8490. // }
  8491. for (const [key, { isType, imported, source }] of Object.entries(userImports)) {
  8492. if (isType)
  8493. continue;
  8494. bindingMetadata[key] =
  8495. imported === '*' ||
  8496. (imported === 'default' && source.endsWith('.vue')) ||
  8497. source === 'vue'
  8498. ? "setup-const" /* BindingTypes.SETUP_CONST */
  8499. : "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */;
  8500. }
  8501. for (const key in scriptBindings) {
  8502. bindingMetadata[key] = scriptBindings[key];
  8503. }
  8504. for (const key in setupBindings) {
  8505. bindingMetadata[key] = setupBindings[key];
  8506. }
  8507. // 8. inject `useCssVars` calls
  8508. if (cssVars.length) {
  8509. helperImports.add(CSS_VARS_HELPER);
  8510. s.prependRight(startOffset, `\n${genCssVarsCode(cssVars, bindingMetadata, scopeId, isProd)}\n`);
  8511. }
  8512. // 9. finalize setup() argument signature
  8513. let args = `__props`;
  8514. if (propsTypeDecl) {
  8515. // mark as any and only cast on assignment
  8516. // since the user defined complex types may be incompatible with the
  8517. // inferred type from generated runtime declarations
  8518. args += `: any`;
  8519. }
  8520. // inject user assignment of props
  8521. // we use a default __props so that template expressions referencing props
  8522. // can use it directly
  8523. if (propsIdentifier) {
  8524. s.prependLeft(startOffset, `\nconst ${propsIdentifier} = __props${propsTypeDecl ? ` as ${genSetupPropsType(propsTypeDecl)}` : ``}\n`);
  8525. }
  8526. const destructureElements = hasDefineExposeCall ? [`expose`] : [];
  8527. if (emitIdentifier) {
  8528. destructureElements.push(emitIdentifier === `emit` ? `emit` : `emit: ${emitIdentifier}`);
  8529. }
  8530. if (destructureElements.length) {
  8531. args += `, { ${destructureElements.join(', ')} }`;
  8532. if (emitsTypeDecl) {
  8533. args += `: { emit: (${scriptSetup.content.slice(emitsTypeDecl.start, emitsTypeDecl.end)}), expose: any, slots: any, attrs: any }`;
  8534. }
  8535. }
  8536. // 10. generate return statement
  8537. const allBindings = Object.assign(Object.assign({}, scriptBindings), setupBindings);
  8538. for (const key in userImports) {
  8539. if (!userImports[key].isType && userImports[key].isUsedInTemplate) {
  8540. allBindings[key] = true;
  8541. }
  8542. }
  8543. // __sfc marker indicates these bindings are compiled from <script setup>
  8544. // and should not be proxied on `this`
  8545. const returned = `{ ${`__sfc: true,`}${Object.keys(allBindings).join(', ')} }`;
  8546. s.appendRight(endOffset, `\nreturn ${returned}\n}\n\n`);
  8547. // 11. finalize default export
  8548. let runtimeOptions = ``;
  8549. if (!hasDefaultExportName && filename && filename !== DEFAULT_FILENAME) {
  8550. const match = filename.match(/([^/\\]+)\.\w+$/);
  8551. if (match) {
  8552. runtimeOptions += `\n __name: '${match[1]}',`;
  8553. }
  8554. }
  8555. if (propsRuntimeDecl) {
  8556. let declCode = scriptSetup.content
  8557. .slice(propsRuntimeDecl.start, propsRuntimeDecl.end)
  8558. .trim();
  8559. runtimeOptions += `\n props: ${declCode},`;
  8560. }
  8561. else if (propsTypeDecl) {
  8562. runtimeOptions += genRuntimeProps(typeDeclaredProps);
  8563. }
  8564. if (emitsRuntimeDecl) {
  8565. runtimeOptions += `\n emits: ${scriptSetup.content
  8566. .slice(emitsRuntimeDecl.start, emitsRuntimeDecl.end)
  8567. .trim()},`;
  8568. }
  8569. else if (emitsTypeDecl) {
  8570. runtimeOptions += genRuntimeEmits(typeDeclaredEmits);
  8571. }
  8572. // wrap setup code with function.
  8573. if (isTS) {
  8574. // for TS, make sure the exported type is still valid type with
  8575. // correct props information
  8576. // we have to use object spread for types to be merged properly
  8577. // user's TS setting should compile it down to proper targets
  8578. // export default defineComponent({ ...__default__, ... })
  8579. const def = defaultExport ? `\n ...${DEFAULT_VAR},` : ``;
  8580. s.prependLeft(startOffset, `\nexport default /*#__PURE__*/${helper(`defineComponent`)}({${def}${runtimeOptions}\n setup(${args}) {\n`);
  8581. s.appendRight(endOffset, `})`);
  8582. }
  8583. else {
  8584. if (defaultExport) {
  8585. // without TS, can't rely on rest spread, so we use Object.assign
  8586. // export default Object.assign(__default__, { ... })
  8587. s.prependLeft(startOffset, `\nexport default /*#__PURE__*/Object.assign(${DEFAULT_VAR}, {${runtimeOptions}\n ` +
  8588. `setup(${args}) {\n`);
  8589. s.appendRight(endOffset, `})`);
  8590. }
  8591. else {
  8592. s.prependLeft(startOffset, `\nexport default {${runtimeOptions}\n setup(${args}) {\n`);
  8593. s.appendRight(endOffset, `}`);
  8594. }
  8595. }
  8596. // 12. finalize Vue helper imports
  8597. if (helperImports.size > 0) {
  8598. s.prepend(`import { ${[...helperImports]
  8599. .map(h => `${h} as _${h}`)
  8600. .join(', ')} } from 'vue'\n`);
  8601. }
  8602. s.trim();
  8603. return Object.assign(Object.assign({}, scriptSetup), { bindings: bindingMetadata, imports: userImports, content: s.toString(), map: genSourceMap
  8604. ? s.generateMap({
  8605. source: filename,
  8606. hires: true,
  8607. includeContent: true
  8608. })
  8609. : undefined, scriptAst: scriptAst === null || scriptAst === void 0 ? void 0 : scriptAst.body, scriptSetupAst: scriptSetupAst === null || scriptSetupAst === void 0 ? void 0 : scriptSetupAst.body });
  8610. }
  8611. function registerBinding(bindings, node, type) {
  8612. bindings[node.name] = type;
  8613. }
  8614. function walkDeclaration(node, bindings, userImportAlias) {
  8615. if (node.type === 'VariableDeclaration') {
  8616. const isConst = node.kind === 'const';
  8617. // export const foo = ...
  8618. for (const { id, init } of node.declarations) {
  8619. const isDefineCall = !!(isConst &&
  8620. isCallOf(init, c => c === DEFINE_PROPS || c === DEFINE_EMITS || c === WITH_DEFAULTS));
  8621. if (id.type === 'Identifier') {
  8622. let bindingType;
  8623. const userReactiveBinding = userImportAlias['reactive'] || 'reactive';
  8624. if (isCallOf(init, userReactiveBinding)) {
  8625. // treat reactive() calls as let since it's meant to be mutable
  8626. bindingType = isConst
  8627. ? "setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */
  8628. : "setup-let" /* BindingTypes.SETUP_LET */;
  8629. }
  8630. else if (
  8631. // if a declaration is a const literal, we can mark it so that
  8632. // the generated render fn code doesn't need to unref() it
  8633. isDefineCall ||
  8634. (isConst && canNeverBeRef(init, userReactiveBinding))) {
  8635. bindingType = isCallOf(init, DEFINE_PROPS)
  8636. ? "setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */
  8637. : "setup-const" /* BindingTypes.SETUP_CONST */;
  8638. }
  8639. else if (isConst) {
  8640. if (isCallOf(init, userImportAlias['ref'] || 'ref')) {
  8641. bindingType = "setup-ref" /* BindingTypes.SETUP_REF */;
  8642. }
  8643. else {
  8644. bindingType = "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */;
  8645. }
  8646. }
  8647. else {
  8648. bindingType = "setup-let" /* BindingTypes.SETUP_LET */;
  8649. }
  8650. registerBinding(bindings, id, bindingType);
  8651. }
  8652. else {
  8653. if (isCallOf(init, DEFINE_PROPS)) {
  8654. // skip walking props destructure
  8655. return;
  8656. }
  8657. if (id.type === 'ObjectPattern') {
  8658. walkObjectPattern(id, bindings, isConst, isDefineCall);
  8659. }
  8660. else if (id.type === 'ArrayPattern') {
  8661. walkArrayPattern(id, bindings, isConst, isDefineCall);
  8662. }
  8663. }
  8664. }
  8665. }
  8666. else if (node.type === 'TSEnumDeclaration' ||
  8667. node.type === 'FunctionDeclaration' ||
  8668. node.type === 'ClassDeclaration') {
  8669. // export function foo() {} / export class Foo {}
  8670. // export declarations must be named.
  8671. bindings[node.id.name] = "setup-const" /* BindingTypes.SETUP_CONST */;
  8672. }
  8673. }
  8674. function walkObjectPattern(node, bindings, isConst, isDefineCall = false) {
  8675. for (const p of node.properties) {
  8676. if (p.type === 'ObjectProperty') {
  8677. if (p.key.type === 'Identifier' && p.key === p.value) {
  8678. // shorthand: const { x } = ...
  8679. const type = isDefineCall
  8680. ? "setup-const" /* BindingTypes.SETUP_CONST */
  8681. : isConst
  8682. ? "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */
  8683. : "setup-let" /* BindingTypes.SETUP_LET */;
  8684. registerBinding(bindings, p.key, type);
  8685. }
  8686. else {
  8687. walkPattern(p.value, bindings, isConst, isDefineCall);
  8688. }
  8689. }
  8690. else {
  8691. // ...rest
  8692. // argument can only be identifier when destructuring
  8693. const type = isConst ? "setup-const" /* BindingTypes.SETUP_CONST */ : "setup-let" /* BindingTypes.SETUP_LET */;
  8694. registerBinding(bindings, p.argument, type);
  8695. }
  8696. }
  8697. }
  8698. function walkArrayPattern(node, bindings, isConst, isDefineCall = false) {
  8699. for (const e of node.elements) {
  8700. e && walkPattern(e, bindings, isConst, isDefineCall);
  8701. }
  8702. }
  8703. function walkPattern(node, bindings, isConst, isDefineCall = false) {
  8704. if (node.type === 'Identifier') {
  8705. const type = isDefineCall
  8706. ? "setup-const" /* BindingTypes.SETUP_CONST */
  8707. : isConst
  8708. ? "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */
  8709. : "setup-let" /* BindingTypes.SETUP_LET */;
  8710. registerBinding(bindings, node, type);
  8711. }
  8712. else if (node.type === 'RestElement') {
  8713. // argument can only be identifier when destructuring
  8714. const type = isConst ? "setup-const" /* BindingTypes.SETUP_CONST */ : "setup-let" /* BindingTypes.SETUP_LET */;
  8715. registerBinding(bindings, node.argument, type);
  8716. }
  8717. else if (node.type === 'ObjectPattern') {
  8718. walkObjectPattern(node, bindings, isConst);
  8719. }
  8720. else if (node.type === 'ArrayPattern') {
  8721. walkArrayPattern(node, bindings, isConst);
  8722. }
  8723. else if (node.type === 'AssignmentPattern') {
  8724. if (node.left.type === 'Identifier') {
  8725. const type = isDefineCall
  8726. ? "setup-const" /* BindingTypes.SETUP_CONST */
  8727. : isConst
  8728. ? "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */
  8729. : "setup-let" /* BindingTypes.SETUP_LET */;
  8730. registerBinding(bindings, node.left, type);
  8731. }
  8732. else {
  8733. walkPattern(node.left, bindings, isConst);
  8734. }
  8735. }
  8736. }
  8737. function recordType(node, declaredTypes) {
  8738. if (node.type === 'TSInterfaceDeclaration') {
  8739. declaredTypes[node.id.name] = [`Object`];
  8740. }
  8741. else if (node.type === 'TSTypeAliasDeclaration') {
  8742. declaredTypes[node.id.name] = inferRuntimeType(node.typeAnnotation, declaredTypes);
  8743. }
  8744. else if (node.type === 'ExportNamedDeclaration' && node.declaration) {
  8745. recordType(node.declaration, declaredTypes);
  8746. }
  8747. }
  8748. function extractRuntimeProps(node, props, declaredTypes, isProd) {
  8749. const members = node.type === 'TSTypeLiteral' ? node.members : node.body;
  8750. for (const m of members) {
  8751. if ((m.type === 'TSPropertySignature' || m.type === 'TSMethodSignature') &&
  8752. m.key.type === 'Identifier') {
  8753. let type;
  8754. if (m.type === 'TSMethodSignature') {
  8755. type = ['Function'];
  8756. }
  8757. else if (m.typeAnnotation) {
  8758. type = inferRuntimeType(m.typeAnnotation.typeAnnotation, declaredTypes);
  8759. }
  8760. props[m.key.name] = {
  8761. key: m.key.name,
  8762. required: !m.optional,
  8763. type: type || [`null`]
  8764. };
  8765. }
  8766. }
  8767. }
  8768. function inferRuntimeType(node, declaredTypes) {
  8769. switch (node.type) {
  8770. case 'TSStringKeyword':
  8771. return ['String'];
  8772. case 'TSNumberKeyword':
  8773. return ['Number'];
  8774. case 'TSBooleanKeyword':
  8775. return ['Boolean'];
  8776. case 'TSObjectKeyword':
  8777. return ['Object'];
  8778. case 'TSTypeLiteral':
  8779. // TODO (nice to have) generate runtime property validation
  8780. return ['Object'];
  8781. case 'TSFunctionType':
  8782. return ['Function'];
  8783. case 'TSArrayType':
  8784. case 'TSTupleType':
  8785. // TODO (nice to have) generate runtime element type/length checks
  8786. return ['Array'];
  8787. case 'TSLiteralType':
  8788. switch (node.literal.type) {
  8789. case 'StringLiteral':
  8790. return ['String'];
  8791. case 'BooleanLiteral':
  8792. return ['Boolean'];
  8793. case 'NumericLiteral':
  8794. case 'BigIntLiteral':
  8795. return ['Number'];
  8796. default:
  8797. return [`null`];
  8798. }
  8799. case 'TSTypeReference':
  8800. if (node.typeName.type === 'Identifier') {
  8801. if (declaredTypes[node.typeName.name]) {
  8802. return declaredTypes[node.typeName.name];
  8803. }
  8804. switch (node.typeName.name) {
  8805. case 'Array':
  8806. case 'Function':
  8807. case 'Object':
  8808. case 'Set':
  8809. case 'Map':
  8810. case 'WeakSet':
  8811. case 'WeakMap':
  8812. case 'Date':
  8813. case 'Promise':
  8814. return [node.typeName.name];
  8815. case 'Record':
  8816. case 'Partial':
  8817. case 'Readonly':
  8818. case 'Pick':
  8819. case 'Omit':
  8820. case 'Exclude':
  8821. case 'Extract':
  8822. case 'Required':
  8823. case 'InstanceType':
  8824. return ['Object'];
  8825. }
  8826. }
  8827. return [`null`];
  8828. case 'TSParenthesizedType':
  8829. return inferRuntimeType(node.typeAnnotation, declaredTypes);
  8830. case 'TSUnionType':
  8831. return [
  8832. ...new Set([].concat(...node.types.map(t => inferRuntimeType(t, declaredTypes))))
  8833. ];
  8834. case 'TSIntersectionType':
  8835. return ['Object'];
  8836. case 'TSSymbolKeyword':
  8837. return ['Symbol'];
  8838. default:
  8839. return [`null`]; // no runtime check
  8840. }
  8841. }
  8842. function toRuntimeTypeString(types) {
  8843. return types.length > 1 ? `[${types.join(', ')}]` : types[0];
  8844. }
  8845. function extractRuntimeEmits(node, emits) {
  8846. if (node.type === 'TSTypeLiteral' || node.type === 'TSInterfaceBody') {
  8847. const members = node.type === 'TSTypeLiteral' ? node.members : node.body;
  8848. for (let t of members) {
  8849. if (t.type === 'TSCallSignatureDeclaration') {
  8850. extractEventNames(t.parameters[0], emits);
  8851. }
  8852. }
  8853. return;
  8854. }
  8855. else {
  8856. extractEventNames(node.parameters[0], emits);
  8857. }
  8858. }
  8859. function extractEventNames(eventName, emits) {
  8860. if (eventName.type === 'Identifier' &&
  8861. eventName.typeAnnotation &&
  8862. eventName.typeAnnotation.type === 'TSTypeAnnotation') {
  8863. const typeNode = eventName.typeAnnotation.typeAnnotation;
  8864. if (typeNode.type === 'TSLiteralType') {
  8865. if (typeNode.literal.type !== 'UnaryExpression' &&
  8866. typeNode.literal.type !== 'TemplateLiteral') {
  8867. emits.add(String(typeNode.literal.value));
  8868. }
  8869. }
  8870. else if (typeNode.type === 'TSUnionType') {
  8871. for (const t of typeNode.types) {
  8872. if (t.type === 'TSLiteralType' &&
  8873. t.literal.type !== 'UnaryExpression' &&
  8874. t.literal.type !== 'TemplateLiteral') {
  8875. emits.add(String(t.literal.value));
  8876. }
  8877. }
  8878. }
  8879. }
  8880. }
  8881. function genRuntimeEmits(emits) {
  8882. return emits.size
  8883. ? `\n emits: [${Array.from(emits)
  8884. .map(p => JSON.stringify(p))
  8885. .join(', ')}],`
  8886. : ``;
  8887. }
  8888. function isCallOf(node, test) {
  8889. return !!(node &&
  8890. node.type === 'CallExpression' &&
  8891. node.callee.type === 'Identifier' &&
  8892. (typeof test === 'string'
  8893. ? node.callee.name === test
  8894. : test(node.callee.name)));
  8895. }
  8896. function canNeverBeRef(node, userReactiveImport) {
  8897. if (isCallOf(node, userReactiveImport)) {
  8898. return true;
  8899. }
  8900. switch (node.type) {
  8901. case 'UnaryExpression':
  8902. case 'BinaryExpression':
  8903. case 'ArrayExpression':
  8904. case 'ObjectExpression':
  8905. case 'FunctionExpression':
  8906. case 'ArrowFunctionExpression':
  8907. case 'UpdateExpression':
  8908. case 'ClassExpression':
  8909. case 'TaggedTemplateExpression':
  8910. return true;
  8911. case 'SequenceExpression':
  8912. return canNeverBeRef(node.expressions[node.expressions.length - 1], userReactiveImport);
  8913. default:
  8914. if (node.type.endsWith('Literal')) {
  8915. return true;
  8916. }
  8917. return false;
  8918. }
  8919. }
  8920. /**
  8921. * Analyze bindings in normal `<script>`
  8922. * Note that `compileScriptSetup` already analyzes bindings as part of its
  8923. * compilation process so this should only be used on single `<script>` SFCs.
  8924. */
  8925. function analyzeScriptBindings(ast) {
  8926. for (const node of ast) {
  8927. if (node.type === 'ExportDefaultDeclaration' &&
  8928. node.declaration.type === 'ObjectExpression') {
  8929. return analyzeBindingsFromOptions(node.declaration);
  8930. }
  8931. }
  8932. return {};
  8933. }
  8934. function analyzeBindingsFromOptions(node) {
  8935. const bindings = {};
  8936. // #3270, #3275
  8937. // mark non-script-setup so we don't resolve components/directives from these
  8938. Object.defineProperty(bindings, '__isScriptSetup', {
  8939. enumerable: false,
  8940. value: false
  8941. });
  8942. for (const property of node.properties) {
  8943. if (property.type === 'ObjectProperty' &&
  8944. !property.computed &&
  8945. property.key.type === 'Identifier') {
  8946. // props
  8947. if (property.key.name === 'props') {
  8948. // props: ['foo']
  8949. // props: { foo: ... }
  8950. for (const key of getObjectOrArrayExpressionKeys(property.value)) {
  8951. bindings[key] = "props" /* BindingTypes.PROPS */;
  8952. }
  8953. }
  8954. // inject
  8955. else if (property.key.name === 'inject') {
  8956. // inject: ['foo']
  8957. // inject: { foo: {} }
  8958. for (const key of getObjectOrArrayExpressionKeys(property.value)) {
  8959. bindings[key] = "options" /* BindingTypes.OPTIONS */;
  8960. }
  8961. }
  8962. // computed & methods
  8963. else if (property.value.type === 'ObjectExpression' &&
  8964. (property.key.name === 'computed' || property.key.name === 'methods')) {
  8965. // methods: { foo() {} }
  8966. // computed: { foo() {} }
  8967. for (const key of getObjectExpressionKeys(property.value)) {
  8968. bindings[key] = "options" /* BindingTypes.OPTIONS */;
  8969. }
  8970. }
  8971. }
  8972. // setup & data
  8973. else if (property.type === 'ObjectMethod' &&
  8974. property.key.type === 'Identifier' &&
  8975. (property.key.name === 'setup' || property.key.name === 'data')) {
  8976. for (const bodyItem of property.body.body) {
  8977. // setup() {
  8978. // return {
  8979. // foo: null
  8980. // }
  8981. // }
  8982. if (bodyItem.type === 'ReturnStatement' &&
  8983. bodyItem.argument &&
  8984. bodyItem.argument.type === 'ObjectExpression') {
  8985. for (const key of getObjectExpressionKeys(bodyItem.argument)) {
  8986. bindings[key] =
  8987. property.key.name === 'setup'
  8988. ? "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */
  8989. : "data" /* BindingTypes.DATA */;
  8990. }
  8991. }
  8992. }
  8993. }
  8994. }
  8995. return bindings;
  8996. }
  8997. function getObjectExpressionKeys(node) {
  8998. const keys = [];
  8999. for (const prop of node.properties) {
  9000. if ((prop.type === 'ObjectProperty' || prop.type === 'ObjectMethod') &&
  9001. !prop.computed) {
  9002. if (prop.key.type === 'Identifier') {
  9003. keys.push(prop.key.name);
  9004. }
  9005. else if (prop.key.type === 'StringLiteral') {
  9006. keys.push(prop.key.value);
  9007. }
  9008. }
  9009. }
  9010. return keys;
  9011. }
  9012. function getArrayExpressionKeys(node) {
  9013. const keys = [];
  9014. for (const element of node.elements) {
  9015. if (element && element.type === 'StringLiteral') {
  9016. keys.push(element.value);
  9017. }
  9018. }
  9019. return keys;
  9020. }
  9021. function getObjectOrArrayExpressionKeys(value) {
  9022. if (value.type === 'ArrayExpression') {
  9023. return getArrayExpressionKeys(value);
  9024. }
  9025. if (value.type === 'ObjectExpression') {
  9026. return getObjectExpressionKeys(value);
  9027. }
  9028. return [];
  9029. }
  9030. const templateUsageCheckCache = new lruCache(512);
  9031. function resolveTemplateUsageCheckString(sfc, isTS) {
  9032. const { content } = sfc.template;
  9033. const cached = templateUsageCheckCache.get(content);
  9034. if (cached) {
  9035. return cached;
  9036. }
  9037. let code = '';
  9038. parseHTML(content, Object.assign(Object.assign({}, baseOptions), { start(tag, attrs) {
  9039. if (!isBuiltInTag(tag) && !isReservedTag(tag)) {
  9040. code += `,${camelize(tag)},${capitalize(camelize(tag))}`;
  9041. }
  9042. for (let i = 0; i < attrs.length; i++) {
  9043. const { name, value } = attrs[i];
  9044. if (dirRE.test(name)) {
  9045. const baseName = onRE.test(name)
  9046. ? 'on'
  9047. : slotRE.test(name)
  9048. ? 'slot'
  9049. : bindRE.test(name)
  9050. ? 'bind'
  9051. : name.replace(dirRE, '');
  9052. if (!isBuiltInDir$1(baseName)) {
  9053. code += `,v${capitalize(camelize(baseName))}`;
  9054. }
  9055. if (value) {
  9056. code += `,${processExp(value, isTS, baseName)}`;
  9057. }
  9058. }
  9059. }
  9060. },
  9061. chars(text) {
  9062. const res = parseText(text);
  9063. if (res) {
  9064. code += `,${processExp(res.expression, isTS)}`;
  9065. }
  9066. } }));
  9067. code += ';';
  9068. templateUsageCheckCache.set(content, code);
  9069. return code;
  9070. }
  9071. const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  9072. function processExp(exp, isTS, dir) {
  9073. if (isTS && / as\s+\w|<.*>|:/.test(exp)) {
  9074. if (dir === 'slot') {
  9075. exp = `(${exp})=>{}`;
  9076. }
  9077. else if (dir === 'on') {
  9078. exp = `()=>{${exp}}`;
  9079. }
  9080. else if (dir === 'for') {
  9081. const inMatch = exp.match(forAliasRE);
  9082. if (inMatch) {
  9083. const [, LHS, RHS] = inMatch;
  9084. return processExp(`(${LHS})=>{}`, true) + processExp(RHS, true);
  9085. }
  9086. }
  9087. let ret = '';
  9088. // has potential type cast or generic arguments that uses types
  9089. const ast = parser$1.parseExpression(exp, { plugins: ['typescript'] });
  9090. walkIdentifiers(ast, node => {
  9091. ret += `,` + node.name;
  9092. });
  9093. return ret;
  9094. }
  9095. return stripStrings(exp);
  9096. }
  9097. function stripStrings(exp) {
  9098. return exp
  9099. .replace(/'[^']*'|"[^"]*"/g, '')
  9100. .replace(/`[^`]+`/g, stripTemplateString);
  9101. }
  9102. function stripTemplateString(str) {
  9103. const interpMatch = str.match(/\${[^}]+}/g);
  9104. if (interpMatch) {
  9105. return interpMatch.map(m => m.slice(2, -1)).join(',');
  9106. }
  9107. return '';
  9108. }
  9109. function isImportUsed(local, sfc, isTS) {
  9110. return new RegExp(
  9111. // #4274 escape $ since it's a special char in regex
  9112. // (and is the only regex special char that is valid in identifiers)
  9113. `[^\\w$_]${local.replace(/\$/g, '\\$')}[^\\w$_]`).test(resolveTemplateUsageCheckString(sfc, isTS));
  9114. }
  9115. /**
  9116. * Note: this comparison assumes the prev/next script are already identical,
  9117. * and only checks the special case where <script setup> unused import
  9118. * pruning result changes due to template changes.
  9119. */
  9120. function hmrShouldReload(prevImports, next) {
  9121. if (!next.scriptSetup) {
  9122. return false;
  9123. }
  9124. const isTS = next.scriptSetup.lang === 'ts' || next.scriptSetup.lang === 'tsx';
  9125. // for each previous import, check if its used status remain the same based on
  9126. // the next descriptor's template
  9127. for (const key in prevImports) {
  9128. // if an import was previous unused, but now is used, we need to force
  9129. // reload so that the script now includes that import.
  9130. if (!prevImports[key].isUsedInTemplate && isImportUsed(key, next, isTS)) {
  9131. return true;
  9132. }
  9133. }
  9134. return false;
  9135. }
  9136. const cache = new lruCache(100);
  9137. const splitRE = /\r?\n/g;
  9138. const emptyRE = /^(?:\/\/)?\s*$/;
  9139. function parse(options) {
  9140. const { source, filename = DEFAULT_FILENAME, compiler, compilerParseOptions = { pad: false }, sourceRoot = '', needMap = true, sourceMap = needMap } = options;
  9141. const cacheKey = hashSum(filename + source + JSON.stringify(compilerParseOptions));
  9142. let output = cache.get(cacheKey);
  9143. if (output) {
  9144. return output;
  9145. }
  9146. if (compiler) {
  9147. // user-provided compiler
  9148. output = compiler.parseComponent(source, compilerParseOptions);
  9149. }
  9150. else {
  9151. // use built-in compiler
  9152. output = parseComponent(source, compilerParseOptions);
  9153. }
  9154. output.filename = filename;
  9155. // parse CSS vars
  9156. output.cssVars = parseCssVars(output);
  9157. output.shouldForceReload = prevImports => hmrShouldReload(prevImports, output);
  9158. if (sourceMap) {
  9159. if (output.script && !output.script.src) {
  9160. output.script.map = generateSourceMap(filename, source, output.script.content, sourceRoot, compilerParseOptions.pad);
  9161. }
  9162. if (output.styles) {
  9163. output.styles.forEach(style => {
  9164. if (!style.src) {
  9165. style.map = generateSourceMap(filename, source, style.content, sourceRoot, compilerParseOptions.pad);
  9166. }
  9167. });
  9168. }
  9169. }
  9170. cache.set(cacheKey, output);
  9171. return output;
  9172. }
  9173. function generateSourceMap(filename, source, generated, sourceRoot, pad) {
  9174. const map = new require$$0.SourceMapGenerator({
  9175. file: filename.replace(/\\/g, '/'),
  9176. sourceRoot: sourceRoot.replace(/\\/g, '/')
  9177. });
  9178. let offset = 0;
  9179. if (!pad) {
  9180. offset = source.split(generated).shift().split(splitRE).length - 1;
  9181. }
  9182. map.setSourceContent(filename, source);
  9183. generated.split(splitRE).forEach((line, index) => {
  9184. if (!emptyRE.test(line)) {
  9185. map.addMapping({
  9186. source: filename,
  9187. original: {
  9188. line: index + 1 + offset,
  9189. column: 0
  9190. },
  9191. generated: {
  9192. line: index + 1,
  9193. column: 0
  9194. }
  9195. });
  9196. }
  9197. });
  9198. return JSON.parse(map.toString());
  9199. }
  9200. function urlToRequire(url, transformAssetUrlsOption = {}) {
  9201. const returnValue = `"${url}"`;
  9202. // same logic as in transform-require.js
  9203. const firstChar = url.charAt(0);
  9204. if (firstChar === '~') {
  9205. const secondChar = url.charAt(1);
  9206. url = url.slice(secondChar === '/' ? 2 : 1);
  9207. }
  9208. if (isExternalUrl(url) || isDataUrl(url) || firstChar === '#') {
  9209. return returnValue;
  9210. }
  9211. const uriParts = parseUriParts(url);
  9212. if (transformAssetUrlsOption.base) {
  9213. // explicit base - directly rewrite the url into absolute url
  9214. // does not apply to absolute urls or urls that start with `@`
  9215. // since they are aliases
  9216. if (firstChar === '.' || firstChar === '~') {
  9217. // Allow for full hostnames provided in options.base
  9218. const base = parseUriParts(transformAssetUrlsOption.base);
  9219. const protocol = base.protocol || '';
  9220. const host = base.host ? protocol + '//' + base.host : '';
  9221. const basePath = base.path || '/';
  9222. // when packaged in the browser, path will be using the posix-
  9223. // only version provided by rollup-plugin-node-builtins.
  9224. return `"${host}${(path__default["default"].posix || path__default["default"]).join(basePath, uriParts.path + (uriParts.hash || ''))}"`;
  9225. }
  9226. }
  9227. if (transformAssetUrlsOption.includeAbsolute ||
  9228. firstChar === '.' ||
  9229. firstChar === '~' ||
  9230. firstChar === '@') {
  9231. if (!uriParts.hash) {
  9232. return `require("${url}")`;
  9233. }
  9234. else {
  9235. // support uri fragment case by excluding it from
  9236. // the require and instead appending it as string;
  9237. // assuming that the path part is sufficient according to
  9238. // the above caseing(t.i. no protocol-auth-host parts expected)
  9239. return `require("${uriParts.path}") + "${uriParts.hash}"`;
  9240. }
  9241. }
  9242. return returnValue;
  9243. }
  9244. /**
  9245. * vuejs/component-compiler-utils#22 Support uri fragment in transformed require
  9246. * @param urlString an url as a string
  9247. */
  9248. function parseUriParts(urlString) {
  9249. // initialize return value
  9250. const returnValue = url.parse('');
  9251. if (urlString) {
  9252. // A TypeError is thrown if urlString is not a string
  9253. // @see https://nodejs.org/api/url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost
  9254. if ('string' === typeof urlString) {
  9255. // check is an uri
  9256. return url.parse(urlString, false, true); // take apart the uri
  9257. }
  9258. }
  9259. return returnValue;
  9260. }
  9261. const externalRE = /^(https?:)?\/\//;
  9262. function isExternalUrl(url) {
  9263. return externalRE.test(url);
  9264. }
  9265. const dataUrlRE = /^\s*data:/i;
  9266. function isDataUrl(url) {
  9267. return dataUrlRE.test(url);
  9268. }
  9269. // vue compiler module for transforming `<tag>:<attribute>` to `require`
  9270. const defaultOptions = {
  9271. audio: 'src',
  9272. video: ['src', 'poster'],
  9273. source: 'src',
  9274. img: 'src',
  9275. image: ['xlink:href', 'href'],
  9276. use: ['xlink:href', 'href']
  9277. };
  9278. var assetUrlsModule = (userOptions, transformAssetUrlsOption) => {
  9279. const options = userOptions
  9280. ? Object.assign({}, defaultOptions, userOptions)
  9281. : defaultOptions;
  9282. return {
  9283. postTransformNode: (node) => {
  9284. transform$1(node, options, transformAssetUrlsOption);
  9285. }
  9286. };
  9287. };
  9288. function transform$1(node, options, transformAssetUrlsOption) {
  9289. if (node.type !== 1 || !node.attrs)
  9290. return;
  9291. for (const tag in options) {
  9292. if (tag === '*' || node.tag === tag) {
  9293. const attributes = options[tag];
  9294. if (typeof attributes === 'string') {
  9295. node.attrs.some(attr => rewrite(attr, attributes, transformAssetUrlsOption));
  9296. }
  9297. else if (Array.isArray(attributes)) {
  9298. attributes.forEach(item => node.attrs.some(attr => rewrite(attr, item, transformAssetUrlsOption)));
  9299. }
  9300. }
  9301. }
  9302. }
  9303. function rewrite(attr, name, transformAssetUrlsOption) {
  9304. if (attr.name === name) {
  9305. const value = attr.value;
  9306. // only transform static URLs
  9307. if (value.charAt(0) === '"' && value.charAt(value.length - 1) === '"') {
  9308. attr.value = urlToRequire(value.slice(1, -1), transformAssetUrlsOption);
  9309. return true;
  9310. }
  9311. }
  9312. return false;
  9313. }
  9314. // vue compiler module for transforming `img:srcset` to a number of `require`s
  9315. var srcsetModule = (transformAssetUrlsOptions) => ({
  9316. postTransformNode: (node) => {
  9317. transform(node, transformAssetUrlsOptions);
  9318. }
  9319. });
  9320. // http://w3c.github.io/html/semantics-embedded-content.html#ref-for-image-candidate-string-5
  9321. const escapedSpaceCharacters = /( |\\t|\\n|\\f|\\r)+/g;
  9322. function transform(node, transformAssetUrlsOptions) {
  9323. if (node.type !== 1 || !node.attrs) {
  9324. return;
  9325. }
  9326. if (node.tag === 'img' || node.tag === 'source') {
  9327. node.attrs.forEach(attr => {
  9328. if (attr.name === 'srcset') {
  9329. // same logic as in transform-require.js
  9330. const value = attr.value;
  9331. const isStatic = value.charAt(0) === '"' && value.charAt(value.length - 1) === '"';
  9332. if (!isStatic) {
  9333. return;
  9334. }
  9335. const imageCandidates = value
  9336. .slice(1, -1)
  9337. .split(',')
  9338. .map(s => {
  9339. // The attribute value arrives here with all whitespace, except
  9340. // normal spaces, represented by escape sequences
  9341. const [url, descriptor] = s
  9342. .replace(escapedSpaceCharacters, ' ')
  9343. .trim()
  9344. .split(' ', 2);
  9345. return {
  9346. require: urlToRequire(url, transformAssetUrlsOptions),
  9347. descriptor
  9348. };
  9349. });
  9350. // "require(url1)"
  9351. // "require(url1) 1x"
  9352. // "require(url1), require(url2)"
  9353. // "require(url1), require(url2) 2x"
  9354. // "require(url1) 1x, require(url2)"
  9355. // "require(url1) 1x, require(url2) 2x"
  9356. const code = imageCandidates
  9357. .map(({ require, descriptor }) => `${require} + "${descriptor ? ' ' + descriptor : ''}, " + `)
  9358. .join('')
  9359. .slice(0, -6)
  9360. .concat('"')
  9361. .replace(/ \+ ""$/, '');
  9362. attr.value = code;
  9363. }
  9364. });
  9365. }
  9366. }
  9367. var consolidate$2 = {exports: {}};
  9368. function commonjsRequire(path) {
  9369. 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.');
  9370. }
  9371. var consolidate$1 = {exports: {}};
  9372. (function (module, exports) {
  9373. /*
  9374. * Engines which do not support caching of their file contents
  9375. * should use the `read()` function defined in consolidate.js
  9376. * On top of this, when an engine compiles to a `Function`,
  9377. * these functions should either be cached within consolidate.js
  9378. * or the engine itself via `options.cache`. This will allow
  9379. * users and frameworks to pass `options.cache = true` for
  9380. * `NODE_ENV=production`, however edit the file(s) without
  9381. * re-loading the application in development.
  9382. */
  9383. /**
  9384. * Module dependencies.
  9385. */
  9386. var fs = require$$0__default["default"];
  9387. var path = path__default["default"];
  9388. var util = require$$2__default["default"];
  9389. var join = path.join;
  9390. var resolve = path.resolve;
  9391. var extname = path.extname;
  9392. var dirname = path.dirname;
  9393. var isAbsolute = path.isAbsolute;
  9394. var readCache = {};
  9395. /**
  9396. * Require cache.
  9397. */
  9398. var cacheStore = {};
  9399. /**
  9400. * Require cache.
  9401. */
  9402. var requires = {};
  9403. /**
  9404. * Clear the cache.
  9405. *
  9406. * @api public
  9407. */
  9408. exports.clearCache = function() {
  9409. readCache = {};
  9410. cacheStore = {};
  9411. };
  9412. /**
  9413. * Conditionally cache `compiled` template based
  9414. * on the `options` filename and `.cache` boolean.
  9415. *
  9416. * @param {Object} options
  9417. * @param {Function} compiled
  9418. * @return {Function}
  9419. * @api private
  9420. */
  9421. function cache(options, compiled) {
  9422. // cachable
  9423. if (compiled && options.filename && options.cache) {
  9424. delete readCache[options.filename];
  9425. cacheStore[options.filename] = compiled;
  9426. return compiled;
  9427. }
  9428. // check cache
  9429. if (options.filename && options.cache) {
  9430. return cacheStore[options.filename];
  9431. }
  9432. return compiled;
  9433. }
  9434. /**
  9435. * Read `path` with `options` with
  9436. * callback `(err, str)`. When `options.cache`
  9437. * is true the template string will be cached.
  9438. *
  9439. * @param {String} options
  9440. * @param {Function} cb
  9441. * @api private
  9442. */
  9443. function read(path, options, cb) {
  9444. var str = readCache[path];
  9445. var cached = options.cache && str && typeof str === 'string';
  9446. // cached (only if cached is a string and not a compiled template function)
  9447. if (cached) return cb(null, str);
  9448. // read
  9449. fs.readFile(path, 'utf8', function(err, str) {
  9450. if (err) return cb(err);
  9451. // remove extraneous utf8 BOM marker
  9452. str = str.replace(/^\uFEFF/, '');
  9453. if (options.cache) readCache[path] = str;
  9454. cb(null, str);
  9455. });
  9456. }
  9457. /**
  9458. * Read `path` with `options` with
  9459. * callback `(err, str)`. When `options.cache`
  9460. * is true the partial string will be cached.
  9461. *
  9462. * @param {String} options
  9463. * @param {Function} fn
  9464. * @api private
  9465. */
  9466. function readPartials(path, options, cb) {
  9467. if (!options.partials) return cb();
  9468. var keys = Object.keys(options.partials);
  9469. var partials = {};
  9470. function next(index) {
  9471. if (index === keys.length) return cb(null, partials);
  9472. var key = keys[index];
  9473. var partialPath = options.partials[key];
  9474. if (partialPath === undefined || partialPath === null || partialPath === false) {
  9475. return next(++index);
  9476. }
  9477. var file;
  9478. if (isAbsolute(partialPath)) {
  9479. if (extname(partialPath) !== '') {
  9480. file = partialPath;
  9481. } else {
  9482. file = join(partialPath + extname(path));
  9483. }
  9484. } else {
  9485. file = join(dirname(path), partialPath + extname(path));
  9486. }
  9487. read(file, options, function(err, str) {
  9488. if (err) return cb(err);
  9489. partials[key] = str;
  9490. next(++index);
  9491. });
  9492. }
  9493. next(0);
  9494. }
  9495. /**
  9496. * promisify
  9497. */
  9498. function promisify(cb, fn) {
  9499. return new Promise(function(resolve, reject) {
  9500. cb = cb || function(err, html) {
  9501. if (err) {
  9502. return reject(err);
  9503. }
  9504. resolve(html);
  9505. };
  9506. fn(cb);
  9507. });
  9508. }
  9509. /**
  9510. * fromStringRenderer
  9511. */
  9512. function fromStringRenderer(name) {
  9513. return function(path, options, cb) {
  9514. options.filename = path;
  9515. return promisify(cb, function(cb) {
  9516. readPartials(path, options, function(err, partials) {
  9517. var extend = (requires.extend || (requires.extend = require$$2__default["default"]._extend));
  9518. var opts = extend({}, options);
  9519. opts.partials = partials;
  9520. if (err) return cb(err);
  9521. if (cache(opts)) {
  9522. exports[name].render('', opts, cb);
  9523. } else {
  9524. read(path, opts, function(err, str) {
  9525. if (err) return cb(err);
  9526. exports[name].render(str, opts, cb);
  9527. });
  9528. }
  9529. });
  9530. });
  9531. };
  9532. }
  9533. /**
  9534. * velocity support.
  9535. */
  9536. exports.velocityjs = fromStringRenderer('velocityjs');
  9537. /**
  9538. * velocity string support.
  9539. */
  9540. exports.velocityjs.render = function(str, options, cb) {
  9541. return promisify(cb, function(cb) {
  9542. var engine = requires.velocityjs || (requires.velocityjs = require('velocityjs'));
  9543. try {
  9544. options.locals = options;
  9545. cb(null, engine.render(str, options).trimLeft());
  9546. } catch (err) {
  9547. cb(err);
  9548. }
  9549. });
  9550. };
  9551. /**
  9552. * Liquid support.
  9553. */
  9554. exports.liquid = fromStringRenderer('liquid');
  9555. /**
  9556. * Liquid string support.
  9557. */
  9558. /**
  9559. * Note that in order to get filters and custom tags we've had to push
  9560. * all user-defined locals down into @locals. However, just to make things
  9561. * backwards-compatible, any property of `options` that is left after
  9562. * processing and removing `locals`, `meta`, `filters`, `customTags` and
  9563. * `includeDir` will also become a local.
  9564. */
  9565. function _renderTinyliquid(engine, str, options, cb) {
  9566. var context = engine.newContext();
  9567. var k;
  9568. /**
  9569. * Note that there's a bug in the library that doesn't allow us to pass
  9570. * the locals to newContext(), hence looping through the keys:
  9571. */
  9572. if (options.locals) {
  9573. for (k in options.locals) {
  9574. context.setLocals(k, options.locals[k]);
  9575. }
  9576. delete options.locals;
  9577. }
  9578. if (options.meta) {
  9579. context.setLocals('page', options.meta);
  9580. delete options.meta;
  9581. }
  9582. /**
  9583. * Add any defined filters:
  9584. */
  9585. if (options.filters) {
  9586. for (k in options.filters) {
  9587. context.setFilter(k, options.filters[k]);
  9588. }
  9589. delete options.filters;
  9590. }
  9591. /**
  9592. * Set up a callback for the include directory:
  9593. */
  9594. var includeDir = options.includeDir || process.cwd();
  9595. context.onInclude(function(name, callback) {
  9596. var extname = path.extname(name) ? '' : '.liquid';
  9597. var filename = path.resolve(includeDir, name + extname);
  9598. fs.readFile(filename, {encoding: 'utf8'}, function(err, data) {
  9599. if (err) return callback(err);
  9600. callback(null, engine.parse(data));
  9601. });
  9602. });
  9603. delete options.includeDir;
  9604. /**
  9605. * The custom tag functions need to have their results pushed back
  9606. * through the parser, so set up a shim before calling the provided
  9607. * callback:
  9608. */
  9609. var compileOptions = {
  9610. customTags: {}
  9611. };
  9612. if (options.customTags) {
  9613. var tagFunctions = options.customTags;
  9614. for (k in options.customTags) {
  9615. /*Tell jshint there's no problem with having this function in the loop */
  9616. /*jshint -W083 */
  9617. compileOptions.customTags[k] = function(context, name, body) {
  9618. var tpl = tagFunctions[name](body.trim());
  9619. context.astStack.push(engine.parse(tpl));
  9620. };
  9621. /*jshint +W083 */
  9622. }
  9623. delete options.customTags;
  9624. }
  9625. /**
  9626. * Now anything left in `options` becomes a local:
  9627. */
  9628. for (k in options) {
  9629. context.setLocals(k, options[k]);
  9630. }
  9631. /**
  9632. * Finally, execute the template:
  9633. */
  9634. var tmpl = cache(context) || cache(context, engine.compile(str, compileOptions));
  9635. tmpl(context, cb);
  9636. }
  9637. exports.liquid.render = function(str, options, cb) {
  9638. return promisify(cb, function(cb) {
  9639. var engine = requires.liquid;
  9640. var Liquid;
  9641. try {
  9642. // set up tinyliquid engine
  9643. engine = requires.liquid = require('tinyliquid');
  9644. // use tinyliquid engine
  9645. _renderTinyliquid(engine, str, options, cb);
  9646. return;
  9647. } catch (err) {
  9648. // set up liquid-node engine
  9649. try {
  9650. Liquid = requires.liquid = require('liquid-node');
  9651. engine = new Liquid.Engine();
  9652. } catch (err) {
  9653. throw err;
  9654. }
  9655. }
  9656. // use liquid-node engine
  9657. try {
  9658. var locals = options.locals || {};
  9659. if (options.meta) {
  9660. locals.pages = options.meta;
  9661. delete options.meta;
  9662. }
  9663. /**
  9664. * Add any defined filters:
  9665. */
  9666. if (options.filters) {
  9667. engine.registerFilters(options.filters);
  9668. delete options.filters;
  9669. }
  9670. /**
  9671. * Set up a callback for the include directory:
  9672. */
  9673. var includeDir = options.includeDir || process.cwd();
  9674. engine.fileSystem = new Liquid.LocalFileSystem(includeDir, 'liquid');
  9675. delete options.includeDir;
  9676. /**
  9677. * The custom tag functions need to have their results pushed back
  9678. * through the parser, so set up a shim before calling the provided
  9679. * callback:
  9680. */
  9681. if (options.customTags) {
  9682. var tagFunctions = options.customTags;
  9683. for (k in options.customTags) {
  9684. engine.registerTag(k, tagFunctions[k]);
  9685. }
  9686. delete options.customTags;
  9687. }
  9688. /**
  9689. * Now anything left in `options` becomes a local:
  9690. */
  9691. for (var k in options) {
  9692. locals[k] = options[k];
  9693. }
  9694. /**
  9695. * Finally, execute the template:
  9696. */
  9697. return engine
  9698. .parseAndRender(str, locals)
  9699. .nodeify(function(err, result) {
  9700. if (err) {
  9701. throw new Error(err);
  9702. } else {
  9703. return cb(null, result);
  9704. }
  9705. });
  9706. } catch (err) {
  9707. cb(err);
  9708. }
  9709. });
  9710. };
  9711. /**
  9712. * Jade support.
  9713. */
  9714. exports.jade = function(path, options, cb) {
  9715. return promisify(cb, function(cb) {
  9716. var engine = requires.jade;
  9717. if (!engine) {
  9718. try {
  9719. engine = requires.jade = require('jade');
  9720. } catch (err) {
  9721. try {
  9722. engine = requires.jade = require('then-jade');
  9723. } catch (otherError) {
  9724. throw err;
  9725. }
  9726. }
  9727. }
  9728. try {
  9729. var tmpl = cache(options) || cache(options, engine.compileFile(path, options));
  9730. cb(null, tmpl(options));
  9731. } catch (err) {
  9732. cb(err);
  9733. }
  9734. });
  9735. };
  9736. /**
  9737. * Jade string support.
  9738. */
  9739. exports.jade.render = function(str, options, cb) {
  9740. return promisify(cb, function(cb) {
  9741. var engine = requires.jade;
  9742. if (!engine) {
  9743. try {
  9744. engine = requires.jade = require('jade');
  9745. } catch (err) {
  9746. try {
  9747. engine = requires.jade = require('then-jade');
  9748. } catch (otherError) {
  9749. throw err;
  9750. }
  9751. }
  9752. }
  9753. try {
  9754. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  9755. cb(null, tmpl(options));
  9756. } catch (err) {
  9757. cb(err);
  9758. }
  9759. });
  9760. };
  9761. /**
  9762. * Dust support.
  9763. */
  9764. exports.dust = fromStringRenderer('dust');
  9765. /**
  9766. * Dust string support.
  9767. */
  9768. exports.dust.render = function(str, options, cb) {
  9769. return promisify(cb, function(cb) {
  9770. var engine = requires.dust;
  9771. if (!engine) {
  9772. try {
  9773. engine = requires.dust = require('dust');
  9774. } catch (err) {
  9775. try {
  9776. engine = requires.dust = require('dustjs-helpers');
  9777. } catch (err) {
  9778. engine = requires.dust = require('dustjs-linkedin');
  9779. }
  9780. }
  9781. }
  9782. var ext = 'dust';
  9783. var views = '.';
  9784. if (options) {
  9785. if (options.ext) ext = options.ext;
  9786. if (options.views) views = options.views;
  9787. if (options.settings && options.settings.views) views = options.settings.views;
  9788. }
  9789. if (!options || (options && !options.cache)) engine.cache = {};
  9790. engine.onLoad = function(path, callback) {
  9791. if (extname(path) === '') path += '.' + ext;
  9792. if (path[0] !== '/') path = views + '/' + path;
  9793. read(path, options, callback);
  9794. };
  9795. try {
  9796. var templateName;
  9797. if (options.filename) {
  9798. templateName = options.filename.replace(new RegExp('^' + views + '/'), '').replace(new RegExp('\\.' + ext), '');
  9799. }
  9800. var tmpl = cache(options) || cache(options, engine.compileFn(str, templateName));
  9801. tmpl(options, cb);
  9802. } catch (err) {
  9803. cb(err);
  9804. }
  9805. });
  9806. };
  9807. /**
  9808. * Swig support.
  9809. */
  9810. exports.swig = fromStringRenderer('swig');
  9811. /**
  9812. * Swig string support.
  9813. */
  9814. exports.swig.render = function(str, options, cb) {
  9815. return promisify(cb, function(cb) {
  9816. var engine = requires.swig;
  9817. if (!engine) {
  9818. try {
  9819. engine = requires.swig = require('swig');
  9820. } catch (err) {
  9821. try {
  9822. engine = requires.swig = require('swig-templates');
  9823. } catch (otherError) {
  9824. throw err;
  9825. }
  9826. }
  9827. }
  9828. try {
  9829. if (options.cache === true) options.cache = 'memory';
  9830. engine.setDefaults({ cache: options.cache });
  9831. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  9832. cb(null, tmpl(options));
  9833. } catch (err) {
  9834. cb(err);
  9835. }
  9836. });
  9837. };
  9838. /**
  9839. * Razor support.
  9840. */
  9841. exports.razor = function(path, options, cb) {
  9842. return promisify(cb, function(cb) {
  9843. var engine = requires.razor;
  9844. if (!engine) {
  9845. try {
  9846. engine = requires.razor = require('razor-tmpl');
  9847. } catch (err) {
  9848. throw err;
  9849. }
  9850. }
  9851. try {
  9852. var tmpl = cache(options) || cache(options, (locals) => {
  9853. console.log('Rendering razor file', path);
  9854. return engine.renderFileSync(path, locals);
  9855. });
  9856. cb(null, tmpl(options));
  9857. } catch (err) {
  9858. cb(err);
  9859. }
  9860. });
  9861. };
  9862. /**
  9863. * razor string support.
  9864. */
  9865. exports.razor.render = function(str, options, cb) {
  9866. return promisify(cb, function(cb) {
  9867. try {
  9868. var engine = requires.razor = require('razor-tmpl');
  9869. } catch (err) {
  9870. throw err;
  9871. }
  9872. try {
  9873. var tf = engine.compile(str);
  9874. var tmpl = cache(options) || cache(options, tf);
  9875. cb(null, tmpl(options));
  9876. } catch (err) {
  9877. cb(err);
  9878. }
  9879. });
  9880. };
  9881. /**
  9882. * Atpl support.
  9883. */
  9884. exports.atpl = fromStringRenderer('atpl');
  9885. /**
  9886. * Atpl string support.
  9887. */
  9888. exports.atpl.render = function(str, options, cb) {
  9889. return promisify(cb, function(cb) {
  9890. var engine = requires.atpl || (requires.atpl = require('atpl'));
  9891. try {
  9892. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  9893. cb(null, tmpl(options));
  9894. } catch (err) {
  9895. cb(err);
  9896. }
  9897. });
  9898. };
  9899. /**
  9900. * Liquor support,
  9901. */
  9902. exports.liquor = fromStringRenderer('liquor');
  9903. /**
  9904. * Liquor string support.
  9905. */
  9906. exports.liquor.render = function(str, options, cb) {
  9907. return promisify(cb, function(cb) {
  9908. var engine = requires.liquor || (requires.liquor = require('liquor'));
  9909. try {
  9910. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  9911. cb(null, tmpl(options));
  9912. } catch (err) {
  9913. cb(err);
  9914. }
  9915. });
  9916. };
  9917. /**
  9918. * Twig support.
  9919. */
  9920. exports.twig = fromStringRenderer('twig');
  9921. /**
  9922. * Twig string support.
  9923. */
  9924. exports.twig.render = function(str, options, cb) {
  9925. return promisify(cb, function(cb) {
  9926. var engine = requires.twig || (requires.twig = require('twig').twig);
  9927. var templateData = {
  9928. data: str,
  9929. allowInlineIncludes: options.allowInlineIncludes,
  9930. namespaces: options.namespaces,
  9931. path: options.path
  9932. };
  9933. try {
  9934. var tmpl = cache(templateData) || cache(templateData, engine(templateData));
  9935. cb(null, tmpl.render(options));
  9936. } catch (err) {
  9937. cb(err);
  9938. }
  9939. });
  9940. };
  9941. /**
  9942. * EJS support.
  9943. */
  9944. exports.ejs = fromStringRenderer('ejs');
  9945. /**
  9946. * EJS string support.
  9947. */
  9948. exports.ejs.render = function(str, options, cb) {
  9949. return promisify(cb, function(cb) {
  9950. var engine = requires.ejs || (requires.ejs = require('ejs'));
  9951. try {
  9952. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  9953. cb(null, tmpl(options));
  9954. } catch (err) {
  9955. cb(err);
  9956. }
  9957. });
  9958. };
  9959. /**
  9960. * Eco support.
  9961. */
  9962. exports.eco = fromStringRenderer('eco');
  9963. /**
  9964. * Eco string support.
  9965. */
  9966. exports.eco.render = function(str, options, cb) {
  9967. return promisify(cb, function(cb) {
  9968. var engine = requires.eco || (requires.eco = require('eco'));
  9969. try {
  9970. cb(null, engine.render(str, options));
  9971. } catch (err) {
  9972. cb(err);
  9973. }
  9974. });
  9975. };
  9976. /**
  9977. * Jazz support.
  9978. */
  9979. exports.jazz = fromStringRenderer('jazz');
  9980. /**
  9981. * Jazz string support.
  9982. */
  9983. exports.jazz.render = function(str, options, cb) {
  9984. return promisify(cb, function(cb) {
  9985. var engine = requires.jazz || (requires.jazz = require('jazz'));
  9986. try {
  9987. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  9988. tmpl.eval(options, function(str) {
  9989. cb(null, str);
  9990. });
  9991. } catch (err) {
  9992. cb(err);
  9993. }
  9994. });
  9995. };
  9996. /**
  9997. * JQTPL support.
  9998. */
  9999. exports.jqtpl = fromStringRenderer('jqtpl');
  10000. /**
  10001. * JQTPL string support.
  10002. */
  10003. exports.jqtpl.render = function(str, options, cb) {
  10004. return promisify(cb, function(cb) {
  10005. var engine = requires.jqtpl || (requires.jqtpl = require('jqtpl'));
  10006. try {
  10007. engine.template(str, str);
  10008. cb(null, engine.tmpl(str, options));
  10009. } catch (err) {
  10010. cb(err);
  10011. }
  10012. });
  10013. };
  10014. /**
  10015. * Haml support.
  10016. */
  10017. exports.haml = fromStringRenderer('haml');
  10018. /**
  10019. * Haml string support.
  10020. */
  10021. exports.haml.render = function(str, options, cb) {
  10022. return promisify(cb, function(cb) {
  10023. var engine = requires.haml || (requires.haml = require('hamljs'));
  10024. try {
  10025. options.locals = options;
  10026. cb(null, engine.render(str, options).trimLeft());
  10027. } catch (err) {
  10028. cb(err);
  10029. }
  10030. });
  10031. };
  10032. /**
  10033. * Hamlet support.
  10034. */
  10035. exports.hamlet = fromStringRenderer('hamlet');
  10036. /**
  10037. * Hamlet string support.
  10038. */
  10039. exports.hamlet.render = function(str, options, cb) {
  10040. return promisify(cb, function(cb) {
  10041. var engine = requires.hamlet || (requires.hamlet = require('hamlet'));
  10042. try {
  10043. options.locals = options;
  10044. cb(null, engine.render(str, options).trimLeft());
  10045. } catch (err) {
  10046. cb(err);
  10047. }
  10048. });
  10049. };
  10050. /**
  10051. * Whiskers support.
  10052. */
  10053. exports.whiskers = function(path, options, cb) {
  10054. return promisify(cb, function(cb) {
  10055. var engine = requires.whiskers || (requires.whiskers = require('whiskers'));
  10056. engine.__express(path, options, cb);
  10057. });
  10058. };
  10059. /**
  10060. * Whiskers string support.
  10061. */
  10062. exports.whiskers.render = function(str, options, cb) {
  10063. return promisify(cb, function(cb) {
  10064. var engine = requires.whiskers || (requires.whiskers = require('whiskers'));
  10065. try {
  10066. cb(null, engine.render(str, options));
  10067. } catch (err) {
  10068. cb(err);
  10069. }
  10070. });
  10071. };
  10072. /**
  10073. * Coffee-HAML support.
  10074. */
  10075. exports['haml-coffee'] = fromStringRenderer('haml-coffee');
  10076. /**
  10077. * Coffee-HAML string support.
  10078. */
  10079. exports['haml-coffee'].render = function(str, options, cb) {
  10080. return promisify(cb, function(cb) {
  10081. var engine = requires['haml-coffee'] || (requires['haml-coffee'] = require('haml-coffee'));
  10082. try {
  10083. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  10084. cb(null, tmpl(options));
  10085. } catch (err) {
  10086. cb(err);
  10087. }
  10088. });
  10089. };
  10090. /**
  10091. * Hogan support.
  10092. */
  10093. exports.hogan = fromStringRenderer('hogan');
  10094. /**
  10095. * Hogan string support.
  10096. */
  10097. exports.hogan.render = function(str, options, cb) {
  10098. return promisify(cb, function(cb) {
  10099. var engine = requires.hogan || (requires.hogan = require('hogan.js'));
  10100. try {
  10101. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  10102. cb(null, tmpl.render(options, options.partials));
  10103. } catch (err) {
  10104. cb(err);
  10105. }
  10106. });
  10107. };
  10108. /**
  10109. * templayed.js support.
  10110. */
  10111. exports.templayed = fromStringRenderer('templayed');
  10112. /**
  10113. * templayed.js string support.
  10114. */
  10115. exports.templayed.render = function(str, options, cb) {
  10116. return promisify(cb, function(cb) {
  10117. var engine = requires.templayed || (requires.templayed = require('templayed'));
  10118. try {
  10119. var tmpl = cache(options) || cache(options, engine(str));
  10120. cb(null, tmpl(options));
  10121. } catch (err) {
  10122. cb(err);
  10123. }
  10124. });
  10125. };
  10126. /**
  10127. * Handlebars support.
  10128. */
  10129. exports.handlebars = fromStringRenderer('handlebars');
  10130. /**
  10131. * Handlebars string support.
  10132. */
  10133. exports.handlebars.render = function(str, options, cb) {
  10134. return promisify(cb, function(cb) {
  10135. var engine = requires.handlebars || (requires.handlebars = require('handlebars'));
  10136. try {
  10137. for (var partial in options.partials) {
  10138. engine.registerPartial(partial, options.partials[partial]);
  10139. }
  10140. for (var helper in options.helpers) {
  10141. engine.registerHelper(helper, options.helpers[helper]);
  10142. }
  10143. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  10144. cb(null, tmpl(options));
  10145. } catch (err) {
  10146. cb(err);
  10147. }
  10148. });
  10149. };
  10150. /**
  10151. * Underscore support.
  10152. */
  10153. exports.underscore = fromStringRenderer('underscore');
  10154. /**
  10155. * Underscore string support.
  10156. */
  10157. exports.underscore.render = function(str, options, cb) {
  10158. return promisify(cb, function(cb) {
  10159. var engine = requires.underscore || (requires.underscore = require('underscore'));
  10160. try {
  10161. const partials = {};
  10162. for (var partial in options.partials) {
  10163. partials[partial] = engine.template(options.partials[partial]);
  10164. }
  10165. options.partials = partials;
  10166. var tmpl = cache(options) || cache(options, engine.template(str, null, options));
  10167. cb(null, tmpl(options).replace(/\n$/, ''));
  10168. } catch (err) {
  10169. cb(err);
  10170. }
  10171. });
  10172. };
  10173. /**
  10174. * Lodash support.
  10175. */
  10176. exports.lodash = fromStringRenderer('lodash');
  10177. /**
  10178. * Lodash string support.
  10179. */
  10180. exports.lodash.render = function(str, options, cb) {
  10181. return promisify(cb, function(cb) {
  10182. var engine = requires.lodash || (requires.lodash = require('lodash'));
  10183. try {
  10184. var tmpl = cache(options) || cache(options, engine.template(str, options));
  10185. cb(null, tmpl(options).replace(/\n$/, ''));
  10186. } catch (err) {
  10187. cb(err);
  10188. }
  10189. });
  10190. };
  10191. /**
  10192. * Pug support. (formerly Jade)
  10193. */
  10194. exports.pug = function(path, options, cb) {
  10195. return promisify(cb, function(cb) {
  10196. var engine = requires.pug;
  10197. if (!engine) {
  10198. try {
  10199. engine = requires.pug = require('pug');
  10200. } catch (err) {
  10201. try {
  10202. engine = requires.pug = require('then-pug');
  10203. } catch (otherError) {
  10204. throw err;
  10205. }
  10206. }
  10207. }
  10208. try {
  10209. var tmpl = cache(options) || cache(options, engine.compileFile(path, options));
  10210. cb(null, tmpl(options));
  10211. } catch (err) {
  10212. cb(err);
  10213. }
  10214. });
  10215. };
  10216. /**
  10217. * Pug string support.
  10218. */
  10219. exports.pug.render = function(str, options, cb) {
  10220. return promisify(cb, function(cb) {
  10221. var engine = requires.pug;
  10222. if (!engine) {
  10223. try {
  10224. engine = requires.pug = require('pug');
  10225. } catch (err) {
  10226. try {
  10227. engine = requires.pug = require('then-pug');
  10228. } catch (otherError) {
  10229. throw err;
  10230. }
  10231. }
  10232. }
  10233. try {
  10234. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  10235. cb(null, tmpl(options));
  10236. } catch (err) {
  10237. cb(err);
  10238. }
  10239. });
  10240. };
  10241. /**
  10242. * QEJS support.
  10243. */
  10244. exports.qejs = fromStringRenderer('qejs');
  10245. /**
  10246. * QEJS string support.
  10247. */
  10248. exports.qejs.render = function(str, options, cb) {
  10249. return promisify(cb, function(cb) {
  10250. try {
  10251. var engine = requires.qejs || (requires.qejs = require('qejs'));
  10252. engine.render(str, options).then(function(result) {
  10253. cb(null, result);
  10254. }, function(err) {
  10255. cb(err);
  10256. }).done();
  10257. } catch (err) {
  10258. cb(err);
  10259. }
  10260. });
  10261. };
  10262. /**
  10263. * Walrus support.
  10264. */
  10265. exports.walrus = fromStringRenderer('walrus');
  10266. /**
  10267. * Walrus string support.
  10268. */
  10269. exports.walrus.render = function(str, options, cb) {
  10270. return promisify(cb, function(cb) {
  10271. var engine = requires.walrus || (requires.walrus = require('walrus'));
  10272. try {
  10273. var tmpl = cache(options) || cache(options, engine.parse(str));
  10274. cb(null, tmpl.compile(options));
  10275. } catch (err) {
  10276. cb(err);
  10277. }
  10278. });
  10279. };
  10280. /**
  10281. * Mustache support.
  10282. */
  10283. exports.mustache = fromStringRenderer('mustache');
  10284. /**
  10285. * Mustache string support.
  10286. */
  10287. exports.mustache.render = function(str, options, cb) {
  10288. return promisify(cb, function(cb) {
  10289. var engine = requires.mustache || (requires.mustache = require('mustache'));
  10290. try {
  10291. cb(null, engine.render(str, options, options.partials));
  10292. } catch (err) {
  10293. cb(err);
  10294. }
  10295. });
  10296. };
  10297. /**
  10298. * Just support.
  10299. */
  10300. exports.just = function(path, options, cb) {
  10301. return promisify(cb, function(cb) {
  10302. var engine = requires.just;
  10303. if (!engine) {
  10304. var JUST = require('just');
  10305. engine = requires.just = new JUST();
  10306. }
  10307. engine.configure({ useCache: options.cache });
  10308. engine.render(path, options, cb);
  10309. });
  10310. };
  10311. /**
  10312. * Just string support.
  10313. */
  10314. exports.just.render = function(str, options, cb) {
  10315. return promisify(cb, function(cb) {
  10316. var JUST = require('just');
  10317. var engine = new JUST({ root: { page: str }});
  10318. engine.render('page', options, cb);
  10319. });
  10320. };
  10321. /**
  10322. * ECT support.
  10323. */
  10324. exports.ect = function(path, options, cb) {
  10325. return promisify(cb, function(cb) {
  10326. var engine = requires.ect;
  10327. if (!engine) {
  10328. var ECT = require('ect');
  10329. engine = requires.ect = new ECT(options);
  10330. }
  10331. engine.configure({ cache: options.cache });
  10332. engine.render(path, options, cb);
  10333. });
  10334. };
  10335. /**
  10336. * ECT string support.
  10337. */
  10338. exports.ect.render = function(str, options, cb) {
  10339. return promisify(cb, function(cb) {
  10340. var ECT = require('ect');
  10341. var engine = new ECT({ root: { page: str }});
  10342. engine.render('page', options, cb);
  10343. });
  10344. };
  10345. /**
  10346. * mote support.
  10347. */
  10348. exports.mote = fromStringRenderer('mote');
  10349. /**
  10350. * mote string support.
  10351. */
  10352. exports.mote.render = function(str, options, cb) {
  10353. return promisify(cb, function(cb) {
  10354. var engine = requires.mote || (requires.mote = require('mote'));
  10355. try {
  10356. var tmpl = cache(options) || cache(options, engine.compile(str));
  10357. cb(null, tmpl(options));
  10358. } catch (err) {
  10359. cb(err);
  10360. }
  10361. });
  10362. };
  10363. /**
  10364. * Toffee support.
  10365. */
  10366. exports.toffee = function(path, options, cb) {
  10367. return promisify(cb, function(cb) {
  10368. var toffee = requires.toffee || (requires.toffee = require('toffee'));
  10369. toffee.__consolidate_engine_render(path, options, cb);
  10370. });
  10371. };
  10372. /**
  10373. * Toffee string support.
  10374. */
  10375. exports.toffee.render = function(str, options, cb) {
  10376. return promisify(cb, function(cb) {
  10377. var engine = requires.toffee || (requires.toffee = require('toffee'));
  10378. try {
  10379. engine.str_render(str, options, cb);
  10380. } catch (err) {
  10381. cb(err);
  10382. }
  10383. });
  10384. };
  10385. /**
  10386. * doT support.
  10387. */
  10388. exports.dot = fromStringRenderer('dot');
  10389. /**
  10390. * doT string support.
  10391. */
  10392. exports.dot.render = function(str, options, cb) {
  10393. return promisify(cb, function(cb) {
  10394. var engine = requires.dot || (requires.dot = require('dot'));
  10395. var extend = (requires.extend || (requires.extend = require$$2__default["default"]._extend));
  10396. try {
  10397. var settings = {};
  10398. settings = extend(settings, engine.templateSettings);
  10399. settings = extend(settings, options ? options.dot : {});
  10400. var tmpl = cache(options) || cache(options, engine.template(str, settings, options));
  10401. cb(null, tmpl(options));
  10402. } catch (err) {
  10403. cb(err);
  10404. }
  10405. });
  10406. };
  10407. /**
  10408. * bracket support.
  10409. */
  10410. exports.bracket = fromStringRenderer('bracket');
  10411. /**
  10412. * bracket string support.
  10413. */
  10414. exports.bracket.render = function(str, options, cb) {
  10415. return promisify(cb, function(cb) {
  10416. var engine = requires.bracket || (requires.bracket = require('bracket-template'));
  10417. try {
  10418. var tmpl = cache(options) || cache(options, engine.default.compile(str, options));
  10419. cb(null, tmpl(options));
  10420. } catch (err) {
  10421. cb(err);
  10422. }
  10423. });
  10424. };
  10425. /**
  10426. * Ractive support.
  10427. */
  10428. exports.ractive = fromStringRenderer('ractive');
  10429. /**
  10430. * Ractive string support.
  10431. */
  10432. exports.ractive.render = function(str, options, cb) {
  10433. return promisify(cb, function(cb) {
  10434. var Engine = requires.ractive || (requires.ractive = require('ractive'));
  10435. var template = cache(options) || cache(options, Engine.parse(str));
  10436. options.template = template;
  10437. if (options.data === null || options.data === undefined) {
  10438. var extend = (requires.extend || (requires.extend = require$$2__default["default"]._extend));
  10439. // Shallow clone the options object
  10440. options.data = extend({}, options);
  10441. // Remove consolidate-specific properties from the clone
  10442. var i;
  10443. var length;
  10444. var properties = ['template', 'filename', 'cache', 'partials'];
  10445. for (i = 0, length = properties.length; i < length; i++) {
  10446. var property = properties[i];
  10447. delete options.data[property];
  10448. }
  10449. }
  10450. try {
  10451. cb(null, new Engine(options).toHTML());
  10452. } catch (err) {
  10453. cb(err);
  10454. }
  10455. });
  10456. };
  10457. /**
  10458. * Nunjucks support.
  10459. */
  10460. exports.nunjucks = fromStringRenderer('nunjucks');
  10461. /**
  10462. * Nunjucks string support.
  10463. */
  10464. exports.nunjucks.render = function(str, options, cb) {
  10465. return promisify(cb, function(cb) {
  10466. try {
  10467. var engine = options.nunjucksEnv || requires.nunjucks || (requires.nunjucks = require('nunjucks'));
  10468. var env = engine;
  10469. // deprecated fallback support for express
  10470. // <https://github.com/tj/consolidate.js/pull/152>
  10471. // <https://github.com/tj/consolidate.js/pull/224>
  10472. if (options.settings && options.settings.views) {
  10473. env = engine.configure(options.settings.views);
  10474. } else if (options.nunjucks && options.nunjucks.configure) {
  10475. env = engine.configure.apply(engine, options.nunjucks.configure);
  10476. }
  10477. //
  10478. // because `renderString` does not initiate loaders
  10479. // we must manually create a loader for it based off
  10480. // either `options.settings.views` or `options.nunjucks` or `options.nunjucks.root`
  10481. //
  10482. // <https://github.com/mozilla/nunjucks/issues/730>
  10483. // <https://github.com/crocodilejs/node-email-templates/issues/182>
  10484. //
  10485. // so instead we simply check if we passed a custom loader
  10486. // otherwise we create a simple file based loader
  10487. if (options.loader) {
  10488. env = new engine.Environment(options.loader);
  10489. } else if (options.settings && options.settings.views) {
  10490. env = new engine.Environment(
  10491. new engine.FileSystemLoader(options.settings.views)
  10492. );
  10493. } else if (options.nunjucks && options.nunjucks.loader) {
  10494. if (typeof options.nunjucks.loader === 'string') {
  10495. env = new engine.Environment(new engine.FileSystemLoader(options.nunjucks.loader));
  10496. } else {
  10497. env = new engine.Environment(
  10498. new engine.FileSystemLoader(
  10499. options.nunjucks.loader[0],
  10500. options.nunjucks.loader[1]
  10501. )
  10502. );
  10503. }
  10504. }
  10505. env.renderString(str, options, cb);
  10506. } catch (err) {
  10507. throw cb(err);
  10508. }
  10509. });
  10510. };
  10511. /**
  10512. * HTMLing support.
  10513. */
  10514. exports.htmling = fromStringRenderer('htmling');
  10515. /**
  10516. * HTMLing string support.
  10517. */
  10518. exports.htmling.render = function(str, options, cb) {
  10519. return promisify(cb, function(cb) {
  10520. var engine = requires.htmling || (requires.htmling = require('htmling'));
  10521. try {
  10522. var tmpl = cache(options) || cache(options, engine.string(str));
  10523. cb(null, tmpl.render(options));
  10524. } catch (err) {
  10525. cb(err);
  10526. }
  10527. });
  10528. };
  10529. /**
  10530. * Rendering function
  10531. */
  10532. function requireReact(module, filename) {
  10533. var babel = requires.babel || (requires.babel = require('babel-core'));
  10534. var compiled = babel.transformFileSync(filename, { presets: [ 'react' ] }).code;
  10535. return module._compile(compiled, filename);
  10536. }
  10537. exports.requireReact = requireReact;
  10538. /**
  10539. * Converting a string into a node module.
  10540. */
  10541. function requireReactString(src, filename) {
  10542. var babel = requires.babel || (requires.babel = require('babel-core'));
  10543. if (!filename) filename = '';
  10544. var m = new module.constructor();
  10545. filename = filename || '';
  10546. // Compile Using React
  10547. var compiled = babel.transform(src, { presets: [ 'react' ] }).code;
  10548. // Compile as a module
  10549. m.paths = module.paths;
  10550. m._compile(compiled, filename);
  10551. return m.exports;
  10552. }
  10553. /**
  10554. * A naive helper to replace {{tags}} with options.tags content
  10555. */
  10556. function reactBaseTmpl(data, options) {
  10557. var exp;
  10558. var regex;
  10559. // Iterates through the keys in file object
  10560. // and interpolate / replace {{key}} with it's value
  10561. for (var k in options) {
  10562. if (options.hasOwnProperty(k)) {
  10563. exp = '{{' + k + '}}';
  10564. regex = new RegExp(exp, 'g');
  10565. if (data.match(regex)) {
  10566. data = data.replace(regex, options[k]);
  10567. }
  10568. }
  10569. }
  10570. return data;
  10571. }
  10572. /**
  10573. * Plates Support.
  10574. */
  10575. exports.plates = fromStringRenderer('plates');
  10576. /**
  10577. * Plates string support.
  10578. */
  10579. exports.plates.render = function(str, options, cb) {
  10580. return promisify(cb, function(cb) {
  10581. var engine = requires.plates || (requires.plates = require('plates'));
  10582. var map = options.map || undefined;
  10583. try {
  10584. var tmpl = engine.bind(str, options, map);
  10585. cb(null, tmpl);
  10586. } catch (err) {
  10587. cb(err);
  10588. }
  10589. });
  10590. };
  10591. /**
  10592. * The main render parser for React bsaed templates
  10593. */
  10594. function reactRenderer(type) {
  10595. if (commonjsRequire.extensions) {
  10596. // Ensure JSX is transformed on require
  10597. if (!commonjsRequire.extensions['.jsx']) {
  10598. commonjsRequire.extensions['.jsx'] = requireReact;
  10599. }
  10600. // Supporting .react extension as well as test cases
  10601. // Using .react extension is not recommended.
  10602. if (!commonjsRequire.extensions['.react']) {
  10603. commonjsRequire.extensions['.react'] = requireReact;
  10604. }
  10605. }
  10606. // Return rendering fx
  10607. return function(str, options, cb) {
  10608. return promisify(cb, function(cb) {
  10609. // React Import
  10610. var ReactDOM = requires.ReactDOM || (requires.ReactDOM = require('react-dom/server'));
  10611. var react = requires.react || (requires.react = require('react'));
  10612. // Assign HTML Base
  10613. var base = options.base;
  10614. delete options.base;
  10615. var enableCache = options.cache;
  10616. delete options.cache;
  10617. var isNonStatic = options.isNonStatic;
  10618. delete options.isNonStatic;
  10619. // Start Conversion
  10620. try {
  10621. var Code;
  10622. var Factory;
  10623. var baseStr;
  10624. var content;
  10625. var parsed;
  10626. if (!cache(options)) {
  10627. // Parsing
  10628. if (type === 'path') {
  10629. var path = resolve(str);
  10630. delete require.cache[path];
  10631. Code = commonjsRequire(path);
  10632. } else {
  10633. Code = requireReactString(str);
  10634. }
  10635. Factory = cache(options, react.createFactory(Code));
  10636. } else {
  10637. Factory = cache(options);
  10638. }
  10639. parsed = new Factory(options);
  10640. content = (isNonStatic) ? ReactDOM.renderToString(parsed) : ReactDOM.renderToStaticMarkup(parsed);
  10641. if (base) {
  10642. baseStr = readCache[str] || fs.readFileSync(resolve(base), 'utf8');
  10643. if (enableCache) {
  10644. readCache[str] = baseStr;
  10645. }
  10646. options.content = content;
  10647. content = reactBaseTmpl(baseStr, options);
  10648. }
  10649. cb(null, content);
  10650. } catch (err) {
  10651. cb(err);
  10652. }
  10653. });
  10654. };
  10655. }
  10656. /**
  10657. * React JS Support
  10658. */
  10659. exports.react = reactRenderer('path');
  10660. /**
  10661. * React JS string support.
  10662. */
  10663. exports.react.render = reactRenderer('string');
  10664. /**
  10665. * ARC-templates support.
  10666. */
  10667. exports['arc-templates'] = fromStringRenderer('arc-templates');
  10668. /**
  10669. * ARC-templates string support.
  10670. */
  10671. exports['arc-templates'].render = function(str, options, cb) {
  10672. var readFileWithOptions = util.promisify(read);
  10673. var consolidateFileSystem = {};
  10674. consolidateFileSystem.readFile = function(path) {
  10675. return readFileWithOptions(path, options);
  10676. };
  10677. return promisify(cb, function(cb) {
  10678. try {
  10679. var engine = requires['arc-templates'];
  10680. if (!engine) {
  10681. var Engine = require('arc-templates/dist/es5');
  10682. engine = requires['arc-templates'] = new Engine({ filesystem: consolidateFileSystem });
  10683. }
  10684. var compiler = cache(options) || cache(options, engine.compileString(str, options.filename));
  10685. compiler.then(function(func) { return func(options); })
  10686. .then(function(result) { cb(null, result.content); })
  10687. .catch(cb);
  10688. } catch (err) {
  10689. cb(err);
  10690. }
  10691. });
  10692. };
  10693. /**
  10694. * Vash support
  10695. */
  10696. exports.vash = fromStringRenderer('vash');
  10697. /**
  10698. * Vash string support
  10699. */
  10700. exports.vash.render = function(str, options, cb) {
  10701. return promisify(cb, function(cb) {
  10702. var engine = requires.vash || (requires.vash = require('vash'));
  10703. try {
  10704. // helper system : https://github.com/kirbysayshi/vash#helper-system
  10705. if (options.helpers) {
  10706. for (var key in options.helpers) {
  10707. if (!options.helpers.hasOwnProperty(key) || typeof options.helpers[key] !== 'function') {
  10708. continue;
  10709. }
  10710. engine.helpers[key] = options.helpers[key];
  10711. }
  10712. }
  10713. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  10714. tmpl(options, function sealLayout(err, ctx) {
  10715. if (err) cb(err);
  10716. ctx.finishLayout();
  10717. cb(null, ctx.toString().replace(/\n$/, ''));
  10718. });
  10719. } catch (err) {
  10720. cb(err);
  10721. }
  10722. });
  10723. };
  10724. /**
  10725. * Slm support.
  10726. */
  10727. exports.slm = fromStringRenderer('slm');
  10728. /**
  10729. * Slm string support.
  10730. */
  10731. exports.slm.render = function(str, options, cb) {
  10732. return promisify(cb, function(cb) {
  10733. var engine = requires.slm || (requires.slm = require('slm'));
  10734. try {
  10735. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  10736. cb(null, tmpl(options));
  10737. } catch (err) {
  10738. cb(err);
  10739. }
  10740. });
  10741. };
  10742. /**
  10743. * Marko support.
  10744. */
  10745. exports.marko = function(path, options, cb) {
  10746. return promisify(cb, function(cb) {
  10747. var engine = requires.marko || (requires.marko = require('marko'));
  10748. options.writeToDisk = !!options.cache;
  10749. try {
  10750. var tmpl = cache(options) || cache(options, engine.load(path, options));
  10751. tmpl.renderToString(options, cb);
  10752. } catch (err) {
  10753. cb(err);
  10754. }
  10755. });
  10756. };
  10757. /**
  10758. * Marko string support.
  10759. */
  10760. exports.marko.render = function(str, options, cb) {
  10761. return promisify(cb, function(cb) {
  10762. var engine = requires.marko || (requires.marko = require('marko'));
  10763. options.writeToDisk = !!options.cache;
  10764. options.filename = options.filename || 'string.marko';
  10765. try {
  10766. var tmpl = cache(options) || cache(options, engine.load(options.filename, str, options));
  10767. tmpl.renderToString(options, cb);
  10768. } catch (err) {
  10769. cb(err);
  10770. }
  10771. });
  10772. };
  10773. /**
  10774. * Teacup support.
  10775. */
  10776. exports.teacup = function(path, options, cb) {
  10777. return promisify(cb, function(cb) {
  10778. var engine = requires.teacup || (requires.teacup = require('teacup/lib/express'));
  10779. commonjsRequire.extensions['.teacup'] = commonjsRequire.extensions['.coffee'];
  10780. if (path[0] !== '/') {
  10781. path = join(process.cwd(), path);
  10782. }
  10783. if (!options.cache) {
  10784. var callback = cb;
  10785. cb = function() {
  10786. delete require.cache[path];
  10787. callback.apply(this, arguments);
  10788. };
  10789. }
  10790. engine.renderFile(path, options, cb);
  10791. });
  10792. };
  10793. /**
  10794. * Teacup string support.
  10795. */
  10796. exports.teacup.render = function(str, options, cb) {
  10797. var coffee = require('coffee-script');
  10798. var vm = require('vm');
  10799. var sandbox = {
  10800. module: {exports: {}},
  10801. require: commonjsRequire
  10802. };
  10803. return promisify(cb, function(cb) {
  10804. vm.runInNewContext(coffee.compile(str), sandbox);
  10805. var tmpl = sandbox.module.exports;
  10806. cb(null, tmpl(options));
  10807. });
  10808. };
  10809. /**
  10810. * Squirrelly support.
  10811. */
  10812. exports.squirrelly = fromStringRenderer('squirrelly');
  10813. /**
  10814. * Squirrelly string support.
  10815. */
  10816. exports.squirrelly.render = function(str, options, cb) {
  10817. return promisify(cb, function(cb) {
  10818. var engine = requires.squirrelly || (requires.squirrelly = require('squirrelly'));
  10819. try {
  10820. for (var partial in options.partials) {
  10821. engine.definePartial(partial, options.partials[partial]);
  10822. }
  10823. for (var helper in options.helpers) {
  10824. engine.defineHelper(helper, options.helpers[helper]);
  10825. }
  10826. var tmpl = cache(options) || cache(options, engine.Compile(str, options));
  10827. cb(null, tmpl(options, engine));
  10828. } catch (err) {
  10829. cb(err);
  10830. }
  10831. });
  10832. };
  10833. /**
  10834. * Twing support.
  10835. */
  10836. exports.twing = fromStringRenderer('twing');
  10837. /**
  10838. * Twing string support.
  10839. */
  10840. exports.twing.render = function(str, options, cb) {
  10841. return promisify(cb, function(cb) {
  10842. var engine = requires.twing || (requires.twing = require('twing'));
  10843. try {
  10844. new engine.TwingEnvironment(new engine.TwingLoaderNull()).createTemplate(str).then((twingTemplate) => {
  10845. twingTemplate.render(options).then((rendTmpl) => {
  10846. var tmpl = cache(options) || cache(options, rendTmpl);
  10847. cb(null, tmpl);
  10848. });
  10849. });
  10850. } catch (err) {
  10851. cb(err);
  10852. }
  10853. });
  10854. };
  10855. /**
  10856. * expose the instance of the engine
  10857. */
  10858. exports.requires = requires;
  10859. } (consolidate$1, consolidate$1.exports));
  10860. (function (module) {
  10861. module.exports = consolidate$1.exports;
  10862. } (consolidate$2));
  10863. var consolidate = /*@__PURE__*/getDefaultExportFromCjs(consolidate$2.exports);
  10864. let isStaticKey;
  10865. let isPlatformReservedTag$1;
  10866. const genStaticKeysCached = cached(genStaticKeys);
  10867. /**
  10868. * Goal of the optimizer: walk the generated template AST tree
  10869. * and detect sub-trees that are purely static, i.e. parts of
  10870. * the DOM that never needs to change.
  10871. *
  10872. * Once we detect these sub-trees, we can:
  10873. *
  10874. * 1. Hoist them into constants, so that we no longer need to
  10875. * create fresh nodes for them on each re-render;
  10876. * 2. Completely skip them in the patching process.
  10877. */
  10878. function optimize$1(root, options) {
  10879. if (!root)
  10880. return;
  10881. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  10882. isPlatformReservedTag$1 = options.isReservedTag || no;
  10883. // first pass: mark all non-static nodes.
  10884. markStatic(root);
  10885. // second pass: mark static roots.
  10886. markStaticRoots(root, false);
  10887. }
  10888. function genStaticKeys(keys) {
  10889. return makeMap('type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  10890. (keys ? ',' + keys : ''));
  10891. }
  10892. function markStatic(node) {
  10893. node.static = isStatic(node);
  10894. if (node.type === 1) {
  10895. // do not make component slot content static. this avoids
  10896. // 1. components not able to mutate slot nodes
  10897. // 2. static slot content fails for hot-reloading
  10898. if (!isPlatformReservedTag$1(node.tag) &&
  10899. node.tag !== 'slot' &&
  10900. node.attrsMap['inline-template'] == null) {
  10901. return;
  10902. }
  10903. for (let i = 0, l = node.children.length; i < l; i++) {
  10904. const child = node.children[i];
  10905. markStatic(child);
  10906. if (!child.static) {
  10907. node.static = false;
  10908. }
  10909. }
  10910. if (node.ifConditions) {
  10911. for (let i = 1, l = node.ifConditions.length; i < l; i++) {
  10912. const block = node.ifConditions[i].block;
  10913. markStatic(block);
  10914. if (!block.static) {
  10915. node.static = false;
  10916. }
  10917. }
  10918. }
  10919. }
  10920. }
  10921. function markStaticRoots(node, isInFor) {
  10922. if (node.type === 1) {
  10923. if (node.static || node.once) {
  10924. node.staticInFor = isInFor;
  10925. }
  10926. // For a node to qualify as a static root, it should have children that
  10927. // are not just static text. Otherwise the cost of hoisting out will
  10928. // outweigh the benefits and it's better off to just always render it fresh.
  10929. if (node.static &&
  10930. node.children.length &&
  10931. !(node.children.length === 1 && node.children[0].type === 3)) {
  10932. node.staticRoot = true;
  10933. return;
  10934. }
  10935. else {
  10936. node.staticRoot = false;
  10937. }
  10938. if (node.children) {
  10939. for (let i = 0, l = node.children.length; i < l; i++) {
  10940. markStaticRoots(node.children[i], isInFor || !!node.for);
  10941. }
  10942. }
  10943. if (node.ifConditions) {
  10944. for (let i = 1, l = node.ifConditions.length; i < l; i++) {
  10945. markStaticRoots(node.ifConditions[i].block, isInFor);
  10946. }
  10947. }
  10948. }
  10949. }
  10950. function isStatic(node) {
  10951. if (node.type === 2) {
  10952. // expression
  10953. return false;
  10954. }
  10955. if (node.type === 3) {
  10956. // text
  10957. return true;
  10958. }
  10959. return !!(node.pre ||
  10960. (!node.hasBindings && // no dynamic bindings
  10961. !node.if &&
  10962. !node.for && // not v-if or v-for or v-else
  10963. !isBuiltInTag(node.tag) && // not a built-in
  10964. isPlatformReservedTag$1(node.tag) && // not a component
  10965. !isDirectChildOfTemplateFor(node) &&
  10966. Object.keys(node).every(isStaticKey)));
  10967. }
  10968. function isDirectChildOfTemplateFor(node) {
  10969. while (node.parent) {
  10970. node = node.parent;
  10971. if (node.tag !== 'template') {
  10972. return false;
  10973. }
  10974. if (node.for) {
  10975. return true;
  10976. }
  10977. }
  10978. return false;
  10979. }
  10980. const fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  10981. const fnInvokeRE = /\([^)]*?\);*$/;
  10982. const simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  10983. // KeyboardEvent.keyCode aliases
  10984. const keyCodes = {
  10985. esc: 27,
  10986. tab: 9,
  10987. enter: 13,
  10988. space: 32,
  10989. up: 38,
  10990. left: 37,
  10991. right: 39,
  10992. down: 40,
  10993. delete: [8, 46]
  10994. };
  10995. // KeyboardEvent.key aliases
  10996. const keyNames = {
  10997. // #7880: IE11 and Edge use `Esc` for Escape key name.
  10998. esc: ['Esc', 'Escape'],
  10999. tab: 'Tab',
  11000. enter: 'Enter',
  11001. // #9112: IE11 uses `Spacebar` for Space key name.
  11002. space: [' ', 'Spacebar'],
  11003. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  11004. up: ['Up', 'ArrowUp'],
  11005. left: ['Left', 'ArrowLeft'],
  11006. right: ['Right', 'ArrowRight'],
  11007. down: ['Down', 'ArrowDown'],
  11008. // #9112: IE11 uses `Del` for Delete key name.
  11009. delete: ['Backspace', 'Delete', 'Del']
  11010. };
  11011. // #4868: modifiers that prevent the execution of the listener
  11012. // need to explicitly return null so that we can determine whether to remove
  11013. // the listener for .once
  11014. const genGuard = condition => `if(${condition})return null;`;
  11015. const modifierCode = {
  11016. stop: '$event.stopPropagation();',
  11017. prevent: '$event.preventDefault();',
  11018. self: genGuard(`$event.target !== $event.currentTarget`),
  11019. ctrl: genGuard(`!$event.ctrlKey`),
  11020. shift: genGuard(`!$event.shiftKey`),
  11021. alt: genGuard(`!$event.altKey`),
  11022. meta: genGuard(`!$event.metaKey`),
  11023. left: genGuard(`'button' in $event && $event.button !== 0`),
  11024. middle: genGuard(`'button' in $event && $event.button !== 1`),
  11025. right: genGuard(`'button' in $event && $event.button !== 2`)
  11026. };
  11027. function genHandlers(events, isNative) {
  11028. const prefix = isNative ? 'nativeOn:' : 'on:';
  11029. let staticHandlers = ``;
  11030. let dynamicHandlers = ``;
  11031. for (const name in events) {
  11032. const handlerCode = genHandler(events[name]);
  11033. //@ts-expect-error
  11034. if (events[name] && events[name].dynamic) {
  11035. dynamicHandlers += `${name},${handlerCode},`;
  11036. }
  11037. else {
  11038. staticHandlers += `"${name}":${handlerCode},`;
  11039. }
  11040. }
  11041. staticHandlers = `{${staticHandlers.slice(0, -1)}}`;
  11042. if (dynamicHandlers) {
  11043. return prefix + `_d(${staticHandlers},[${dynamicHandlers.slice(0, -1)}])`;
  11044. }
  11045. else {
  11046. return prefix + staticHandlers;
  11047. }
  11048. }
  11049. function genHandler(handler) {
  11050. if (!handler) {
  11051. return 'function(){}';
  11052. }
  11053. if (Array.isArray(handler)) {
  11054. return `[${handler.map(handler => genHandler(handler)).join(',')}]`;
  11055. }
  11056. const isMethodPath = simplePathRE.test(handler.value);
  11057. const isFunctionExpression = fnExpRE.test(handler.value);
  11058. const isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  11059. if (!handler.modifiers) {
  11060. if (isMethodPath || isFunctionExpression) {
  11061. return handler.value;
  11062. }
  11063. return `function($event){${isFunctionInvocation ? `return ${handler.value}` : handler.value}}`; // inline statement
  11064. }
  11065. else {
  11066. let code = '';
  11067. let genModifierCode = '';
  11068. const keys = [];
  11069. for (const key in handler.modifiers) {
  11070. if (modifierCode[key]) {
  11071. genModifierCode += modifierCode[key];
  11072. // left/right
  11073. if (keyCodes[key]) {
  11074. keys.push(key);
  11075. }
  11076. }
  11077. else if (key === 'exact') {
  11078. const modifiers = handler.modifiers;
  11079. genModifierCode += genGuard(['ctrl', 'shift', 'alt', 'meta']
  11080. .filter(keyModifier => !modifiers[keyModifier])
  11081. .map(keyModifier => `$event.${keyModifier}Key`)
  11082. .join('||'));
  11083. }
  11084. else {
  11085. keys.push(key);
  11086. }
  11087. }
  11088. if (keys.length) {
  11089. code += genKeyFilter(keys);
  11090. }
  11091. // Make sure modifiers like prevent and stop get executed after key filtering
  11092. if (genModifierCode) {
  11093. code += genModifierCode;
  11094. }
  11095. const handlerCode = isMethodPath
  11096. ? `return ${handler.value}.apply(null, arguments)`
  11097. : isFunctionExpression
  11098. ? `return (${handler.value}).apply(null, arguments)`
  11099. : isFunctionInvocation
  11100. ? `return ${handler.value}`
  11101. : handler.value;
  11102. return `function($event){${code}${handlerCode}}`;
  11103. }
  11104. }
  11105. function genKeyFilter(keys) {
  11106. return (
  11107. // make sure the key filters only apply to KeyboardEvents
  11108. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  11109. // key events that do not have keyCode property...
  11110. `if(!$event.type.indexOf('key')&&` +
  11111. `${keys.map(genFilterCode).join('&&')})return null;`);
  11112. }
  11113. function genFilterCode(key) {
  11114. const keyVal = parseInt(key, 10);
  11115. if (keyVal) {
  11116. return `$event.keyCode!==${keyVal}`;
  11117. }
  11118. const keyCode = keyCodes[key];
  11119. const keyName = keyNames[key];
  11120. return (`_k($event.keyCode,` +
  11121. `${JSON.stringify(key)},` +
  11122. `${JSON.stringify(keyCode)},` +
  11123. `$event.key,` +
  11124. `${JSON.stringify(keyName)}` +
  11125. `)`);
  11126. }
  11127. function on(el, dir) {
  11128. if (process.env.NODE_ENV !== 'production' && dir.modifiers) {
  11129. warn$3(`v-on without argument does not support modifiers.`);
  11130. }
  11131. el.wrapListeners = (code) => `_g(${code},${dir.value})`;
  11132. }
  11133. function bind(el, dir) {
  11134. el.wrapData = (code) => {
  11135. return `_b(${code},'${el.tag}',${dir.value},${dir.modifiers && dir.modifiers.prop ? 'true' : 'false'}${dir.modifiers && dir.modifiers.sync ? ',true' : ''})`;
  11136. };
  11137. }
  11138. var baseDirectives = {
  11139. on,
  11140. bind,
  11141. cloak: noop
  11142. };
  11143. class CodegenState {
  11144. constructor(options) {
  11145. this.options = options;
  11146. this.warn = options.warn || baseWarn;
  11147. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  11148. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  11149. this.directives = extend(extend({}, baseDirectives), options.directives);
  11150. const isReservedTag = options.isReservedTag || no;
  11151. this.maybeComponent = (el) => !!el.component || !isReservedTag(el.tag);
  11152. this.onceId = 0;
  11153. this.staticRenderFns = [];
  11154. this.pre = false;
  11155. }
  11156. }
  11157. function generate$1(ast, options) {
  11158. const state = new CodegenState(options);
  11159. // fix #11483, Root level <script> tags should not be rendered.
  11160. const code = ast
  11161. ? ast.tag === 'script'
  11162. ? 'null'
  11163. : genElement(ast, state)
  11164. : '_c("div")';
  11165. return {
  11166. render: `with(this){return ${code}}`,
  11167. staticRenderFns: state.staticRenderFns
  11168. };
  11169. }
  11170. function genElement(el, state) {
  11171. if (el.parent) {
  11172. el.pre = el.pre || el.parent.pre;
  11173. }
  11174. if (el.staticRoot && !el.staticProcessed) {
  11175. return genStatic(el, state);
  11176. }
  11177. else if (el.once && !el.onceProcessed) {
  11178. return genOnce(el, state);
  11179. }
  11180. else if (el.for && !el.forProcessed) {
  11181. return genFor(el, state);
  11182. }
  11183. else if (el.if && !el.ifProcessed) {
  11184. return genIf(el, state);
  11185. }
  11186. else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  11187. return genChildren(el, state) || 'void 0';
  11188. }
  11189. else if (el.tag === 'slot') {
  11190. return genSlot(el, state);
  11191. }
  11192. else {
  11193. // component or element
  11194. let code;
  11195. if (el.component) {
  11196. code = genComponent(el.component, el, state);
  11197. }
  11198. else {
  11199. let data;
  11200. const maybeComponent = state.maybeComponent(el);
  11201. if (!el.plain || (el.pre && maybeComponent)) {
  11202. data = genData(el, state);
  11203. }
  11204. let tag;
  11205. // check if this is a component in <script setup>
  11206. const bindings = state.options.bindings;
  11207. if (maybeComponent && bindings && bindings.__isScriptSetup !== false) {
  11208. tag = checkBindingType(bindings, el.tag);
  11209. }
  11210. if (!tag)
  11211. tag = `'${el.tag}'`;
  11212. const children = el.inlineTemplate ? null : genChildren(el, state, true);
  11213. code = `_c(${tag}${data ? `,${data}` : '' // data
  11214. }${children ? `,${children}` : '' // children
  11215. })`;
  11216. }
  11217. // module transforms
  11218. for (let i = 0; i < state.transforms.length; i++) {
  11219. code = state.transforms[i](el, code);
  11220. }
  11221. return code;
  11222. }
  11223. }
  11224. function checkBindingType(bindings, key) {
  11225. const camelName = camelize(key);
  11226. const PascalName = capitalize(camelName);
  11227. const checkType = (type) => {
  11228. if (bindings[key] === type) {
  11229. return key;
  11230. }
  11231. if (bindings[camelName] === type) {
  11232. return camelName;
  11233. }
  11234. if (bindings[PascalName] === type) {
  11235. return PascalName;
  11236. }
  11237. };
  11238. const fromConst = checkType("setup-const" /* BindingTypes.SETUP_CONST */) ||
  11239. checkType("setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */);
  11240. if (fromConst) {
  11241. return fromConst;
  11242. }
  11243. const fromMaybeRef = checkType("setup-let" /* BindingTypes.SETUP_LET */) ||
  11244. checkType("setup-ref" /* BindingTypes.SETUP_REF */) ||
  11245. checkType("setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */);
  11246. if (fromMaybeRef) {
  11247. return fromMaybeRef;
  11248. }
  11249. }
  11250. // hoist static sub-trees out
  11251. function genStatic(el, state) {
  11252. el.staticProcessed = true;
  11253. // Some elements (templates) need to behave differently inside of a v-pre
  11254. // node. All pre nodes are static roots, so we can use this as a location to
  11255. // wrap a state change and reset it upon exiting the pre node.
  11256. const originalPreState = state.pre;
  11257. if (el.pre) {
  11258. state.pre = el.pre;
  11259. }
  11260. state.staticRenderFns.push(`with(this){return ${genElement(el, state)}}`);
  11261. state.pre = originalPreState;
  11262. return `_m(${state.staticRenderFns.length - 1}${el.staticInFor ? ',true' : ''})`;
  11263. }
  11264. // v-once
  11265. function genOnce(el, state) {
  11266. el.onceProcessed = true;
  11267. if (el.if && !el.ifProcessed) {
  11268. return genIf(el, state);
  11269. }
  11270. else if (el.staticInFor) {
  11271. let key = '';
  11272. let parent = el.parent;
  11273. while (parent) {
  11274. if (parent.for) {
  11275. key = parent.key;
  11276. break;
  11277. }
  11278. parent = parent.parent;
  11279. }
  11280. if (!key) {
  11281. process.env.NODE_ENV !== 'production' &&
  11282. state.warn(`v-once can only be used inside v-for that is keyed. `, el.rawAttrsMap['v-once']);
  11283. return genElement(el, state);
  11284. }
  11285. return `_o(${genElement(el, state)},${state.onceId++},${key})`;
  11286. }
  11287. else {
  11288. return genStatic(el, state);
  11289. }
  11290. }
  11291. function genIf(el, state, altGen, altEmpty) {
  11292. el.ifProcessed = true; // avoid recursion
  11293. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty);
  11294. }
  11295. function genIfConditions(conditions, state, altGen, altEmpty) {
  11296. if (!conditions.length) {
  11297. return altEmpty || '_e()';
  11298. }
  11299. const condition = conditions.shift();
  11300. if (condition.exp) {
  11301. return `(${condition.exp})?${genTernaryExp(condition.block)}:${genIfConditions(conditions, state, altGen, altEmpty)}`;
  11302. }
  11303. else {
  11304. return `${genTernaryExp(condition.block)}`;
  11305. }
  11306. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  11307. function genTernaryExp(el) {
  11308. return altGen
  11309. ? altGen(el, state)
  11310. : el.once
  11311. ? genOnce(el, state)
  11312. : genElement(el, state);
  11313. }
  11314. }
  11315. function genFor(el, state, altGen, altHelper) {
  11316. const exp = el.for;
  11317. const alias = el.alias;
  11318. const iterator1 = el.iterator1 ? `,${el.iterator1}` : '';
  11319. const iterator2 = el.iterator2 ? `,${el.iterator2}` : '';
  11320. if (process.env.NODE_ENV !== 'production' &&
  11321. state.maybeComponent(el) &&
  11322. el.tag !== 'slot' &&
  11323. el.tag !== 'template' &&
  11324. !el.key) {
  11325. state.warn(`<${el.tag} v-for="${alias} in ${exp}">: component lists rendered with ` +
  11326. `v-for should have explicit keys. ` +
  11327. `See https://v2.vuejs.org/v2/guide/list.html#key for more info.`, el.rawAttrsMap['v-for'], true /* tip */);
  11328. }
  11329. el.forProcessed = true; // avoid recursion
  11330. return (`${altHelper || '_l'}((${exp}),` +
  11331. `function(${alias}${iterator1}${iterator2}){` +
  11332. `return ${(altGen || genElement)(el, state)}` +
  11333. '})');
  11334. }
  11335. function genData(el, state) {
  11336. let data = '{';
  11337. // directives first.
  11338. // directives may mutate the el's other properties before they are generated.
  11339. const dirs = genDirectives(el, state);
  11340. if (dirs)
  11341. data += dirs + ',';
  11342. // key
  11343. if (el.key) {
  11344. data += `key:${el.key},`;
  11345. }
  11346. // ref
  11347. if (el.ref) {
  11348. data += `ref:${el.ref},`;
  11349. }
  11350. if (el.refInFor) {
  11351. data += `refInFor:true,`;
  11352. }
  11353. // pre
  11354. if (el.pre) {
  11355. data += `pre:true,`;
  11356. }
  11357. // record original tag name for components using "is" attribute
  11358. if (el.component) {
  11359. data += `tag:"${el.tag}",`;
  11360. }
  11361. // module data generation functions
  11362. for (let i = 0; i < state.dataGenFns.length; i++) {
  11363. data += state.dataGenFns[i](el);
  11364. }
  11365. // attributes
  11366. if (el.attrs) {
  11367. data += `attrs:${genProps(el.attrs)},`;
  11368. }
  11369. // DOM props
  11370. if (el.props) {
  11371. data += `domProps:${genProps(el.props)},`;
  11372. }
  11373. // event handlers
  11374. if (el.events) {
  11375. data += `${genHandlers(el.events, false)},`;
  11376. }
  11377. if (el.nativeEvents) {
  11378. data += `${genHandlers(el.nativeEvents, true)},`;
  11379. }
  11380. // slot target
  11381. // only for non-scoped slots
  11382. if (el.slotTarget && !el.slotScope) {
  11383. data += `slot:${el.slotTarget},`;
  11384. }
  11385. // scoped slots
  11386. if (el.scopedSlots) {
  11387. data += `${genScopedSlots(el, el.scopedSlots, state)},`;
  11388. }
  11389. // component v-model
  11390. if (el.model) {
  11391. data += `model:{value:${el.model.value},callback:${el.model.callback},expression:${el.model.expression}},`;
  11392. }
  11393. // inline-template
  11394. if (el.inlineTemplate) {
  11395. const inlineTemplate = genInlineTemplate(el, state);
  11396. if (inlineTemplate) {
  11397. data += `${inlineTemplate},`;
  11398. }
  11399. }
  11400. data = data.replace(/,$/, '') + '}';
  11401. // v-bind dynamic argument wrap
  11402. // v-bind with dynamic arguments must be applied using the same v-bind object
  11403. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  11404. if (el.dynamicAttrs) {
  11405. data = `_b(${data},"${el.tag}",${genProps(el.dynamicAttrs)})`;
  11406. }
  11407. // v-bind data wrap
  11408. if (el.wrapData) {
  11409. data = el.wrapData(data);
  11410. }
  11411. // v-on data wrap
  11412. if (el.wrapListeners) {
  11413. data = el.wrapListeners(data);
  11414. }
  11415. return data;
  11416. }
  11417. function genDirectives(el, state) {
  11418. const dirs = el.directives;
  11419. if (!dirs)
  11420. return;
  11421. let res = 'directives:[';
  11422. let hasRuntime = false;
  11423. let i, l, dir, needRuntime;
  11424. for (i = 0, l = dirs.length; i < l; i++) {
  11425. dir = dirs[i];
  11426. needRuntime = true;
  11427. const gen = state.directives[dir.name];
  11428. if (gen) {
  11429. // compile-time directive that manipulates AST.
  11430. // returns true if it also needs a runtime counterpart.
  11431. needRuntime = !!gen(el, dir, state.warn);
  11432. }
  11433. if (needRuntime) {
  11434. hasRuntime = true;
  11435. res += `{name:"${dir.name}",rawName:"${dir.rawName}"${dir.value
  11436. ? `,value:(${dir.value}),expression:${JSON.stringify(dir.value)}`
  11437. : ''}${dir.arg ? `,arg:${dir.isDynamicArg ? dir.arg : `"${dir.arg}"`}` : ''}${dir.modifiers ? `,modifiers:${JSON.stringify(dir.modifiers)}` : ''}},`;
  11438. }
  11439. }
  11440. if (hasRuntime) {
  11441. return res.slice(0, -1) + ']';
  11442. }
  11443. }
  11444. function genInlineTemplate(el, state) {
  11445. const ast = el.children[0];
  11446. if (process.env.NODE_ENV !== 'production' && (el.children.length !== 1 || ast.type !== 1)) {
  11447. state.warn('Inline-template components must have exactly one child element.', { start: el.start });
  11448. }
  11449. if (ast && ast.type === 1) {
  11450. const inlineRenderFns = generate$1(ast, state.options);
  11451. return `inlineTemplate:{render:function(){${inlineRenderFns.render}},staticRenderFns:[${inlineRenderFns.staticRenderFns
  11452. .map(code => `function(){${code}}`)
  11453. .join(',')}]}`;
  11454. }
  11455. }
  11456. function genScopedSlots(el, slots, state) {
  11457. // by default scoped slots are considered "stable", this allows child
  11458. // components with only scoped slots to skip forced updates from parent.
  11459. // but in some cases we have to bail-out of this optimization
  11460. // for example if the slot contains dynamic names, has v-if or v-for on them...
  11461. let needsForceUpdate = el.for ||
  11462. Object.keys(slots).some(key => {
  11463. const slot = slots[key];
  11464. return (slot.slotTargetDynamic || slot.if || slot.for || containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  11465. );
  11466. });
  11467. // #9534: if a component with scoped slots is inside a conditional branch,
  11468. // it's possible for the same component to be reused but with different
  11469. // compiled slot content. To avoid that, we generate a unique key based on
  11470. // the generated code of all the slot contents.
  11471. let needsKey = !!el.if;
  11472. // OR when it is inside another scoped slot or v-for (the reactivity may be
  11473. // disconnected due to the intermediate scope variable)
  11474. // #9438, #9506
  11475. // TODO: this can be further optimized by properly analyzing in-scope bindings
  11476. // and skip force updating ones that do not actually use scope variables.
  11477. if (!needsForceUpdate) {
  11478. let parent = el.parent;
  11479. while (parent) {
  11480. if ((parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  11481. parent.for) {
  11482. needsForceUpdate = true;
  11483. break;
  11484. }
  11485. if (parent.if) {
  11486. needsKey = true;
  11487. }
  11488. parent = parent.parent;
  11489. }
  11490. }
  11491. const generatedSlots = Object.keys(slots)
  11492. .map(key => genScopedSlot(slots[key], state))
  11493. .join(',');
  11494. return `scopedSlots:_u([${generatedSlots}]${needsForceUpdate ? `,null,true` : ``}${!needsForceUpdate && needsKey ? `,null,false,${hash(generatedSlots)}` : ``})`;
  11495. }
  11496. function hash(str) {
  11497. let hash = 5381;
  11498. let i = str.length;
  11499. while (i) {
  11500. hash = (hash * 33) ^ str.charCodeAt(--i);
  11501. }
  11502. return hash >>> 0;
  11503. }
  11504. function containsSlotChild(el) {
  11505. if (el.type === 1) {
  11506. if (el.tag === 'slot') {
  11507. return true;
  11508. }
  11509. return el.children.some(containsSlotChild);
  11510. }
  11511. return false;
  11512. }
  11513. function genScopedSlot(el, state) {
  11514. const isLegacySyntax = el.attrsMap['slot-scope'];
  11515. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  11516. return genIf(el, state, genScopedSlot, `null`);
  11517. }
  11518. if (el.for && !el.forProcessed) {
  11519. return genFor(el, state, genScopedSlot);
  11520. }
  11521. const slotScope = el.slotScope === emptySlotScopeToken ? `` : String(el.slotScope);
  11522. const fn = `function(${slotScope}){` +
  11523. `return ${el.tag === 'template'
  11524. ? el.if && isLegacySyntax
  11525. ? `(${el.if})?${genChildren(el, state) || 'undefined'}:undefined`
  11526. : genChildren(el, state) || 'undefined'
  11527. : genElement(el, state)}}`;
  11528. // reverse proxy v-slot without scope on this.$slots
  11529. const reverseProxy = slotScope ? `` : `,proxy:true`;
  11530. return `{key:${el.slotTarget || `"default"`},fn:${fn}${reverseProxy}}`;
  11531. }
  11532. function genChildren(el, state, checkSkip, altGenElement, altGenNode) {
  11533. const children = el.children;
  11534. if (children.length) {
  11535. const el = children[0];
  11536. // optimize single v-for
  11537. if (children.length === 1 &&
  11538. el.for &&
  11539. el.tag !== 'template' &&
  11540. el.tag !== 'slot') {
  11541. const normalizationType = checkSkip
  11542. ? state.maybeComponent(el)
  11543. ? `,1`
  11544. : `,0`
  11545. : ``;
  11546. return `${(altGenElement || genElement)(el, state)}${normalizationType}`;
  11547. }
  11548. const normalizationType = checkSkip
  11549. ? getNormalizationType(children, state.maybeComponent)
  11550. : 0;
  11551. const gen = altGenNode || genNode;
  11552. return `[${children.map(c => gen(c, state)).join(',')}]${normalizationType ? `,${normalizationType}` : ''}`;
  11553. }
  11554. }
  11555. // determine the normalization needed for the children array.
  11556. // 0: no normalization needed
  11557. // 1: simple normalization needed (possible 1-level deep nested array)
  11558. // 2: full normalization needed
  11559. function getNormalizationType(children, maybeComponent) {
  11560. let res = 0;
  11561. for (let i = 0; i < children.length; i++) {
  11562. const el = children[i];
  11563. if (el.type !== 1) {
  11564. continue;
  11565. }
  11566. if (needsNormalization(el) ||
  11567. (el.ifConditions &&
  11568. el.ifConditions.some(c => needsNormalization(c.block)))) {
  11569. res = 2;
  11570. break;
  11571. }
  11572. if (maybeComponent(el) ||
  11573. (el.ifConditions && el.ifConditions.some(c => maybeComponent(c.block)))) {
  11574. res = 1;
  11575. }
  11576. }
  11577. return res;
  11578. }
  11579. function needsNormalization(el) {
  11580. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot';
  11581. }
  11582. function genNode(node, state) {
  11583. if (node.type === 1) {
  11584. return genElement(node, state);
  11585. }
  11586. else if (node.type === 3 && node.isComment) {
  11587. return genComment(node);
  11588. }
  11589. else {
  11590. return genText(node);
  11591. }
  11592. }
  11593. function genText(text) {
  11594. return `_v(${text.type === 2
  11595. ? text.expression // no need for () because already wrapped in _s()
  11596. : transformSpecialNewlines(JSON.stringify(text.text))})`;
  11597. }
  11598. function genComment(comment) {
  11599. return `_e(${JSON.stringify(comment.text)})`;
  11600. }
  11601. function genSlot(el, state) {
  11602. const slotName = el.slotName || '"default"';
  11603. const children = genChildren(el, state);
  11604. let res = `_t(${slotName}${children ? `,function(){return ${children}}` : ''}`;
  11605. const attrs = el.attrs || el.dynamicAttrs
  11606. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(attr => ({
  11607. // slot props are camelized
  11608. name: camelize(attr.name),
  11609. value: attr.value,
  11610. dynamic: attr.dynamic
  11611. })))
  11612. : null;
  11613. const bind = el.attrsMap['v-bind'];
  11614. if ((attrs || bind) && !children) {
  11615. res += `,null`;
  11616. }
  11617. if (attrs) {
  11618. res += `,${attrs}`;
  11619. }
  11620. if (bind) {
  11621. res += `${attrs ? '' : ',null'},${bind}`;
  11622. }
  11623. return res + ')';
  11624. }
  11625. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  11626. function genComponent(componentName, el, state) {
  11627. const children = el.inlineTemplate ? null : genChildren(el, state, true);
  11628. return `_c(${componentName},${genData(el, state)}${children ? `,${children}` : ''})`;
  11629. }
  11630. function genProps(props) {
  11631. let staticProps = ``;
  11632. let dynamicProps = ``;
  11633. for (let i = 0; i < props.length; i++) {
  11634. const prop = props[i];
  11635. const value = transformSpecialNewlines(prop.value);
  11636. if (prop.dynamic) {
  11637. dynamicProps += `${prop.name},${value},`;
  11638. }
  11639. else {
  11640. staticProps += `"${prop.name}":${value},`;
  11641. }
  11642. }
  11643. staticProps = `{${staticProps.slice(0, -1)}}`;
  11644. if (dynamicProps) {
  11645. return `_d(${staticProps},[${dynamicProps.slice(0, -1)}])`;
  11646. }
  11647. else {
  11648. return staticProps;
  11649. }
  11650. }
  11651. // #3895, #4268
  11652. function transformSpecialNewlines(text) {
  11653. return text.replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
  11654. }
  11655. // these keywords should not appear inside expressions, but operators like
  11656. // typeof, instanceof and in are allowed
  11657. const prohibitedKeywordRE = new RegExp('\\b' +
  11658. ('do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  11659. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  11660. 'extends,finally,continue,debugger,function,arguments')
  11661. .split(',')
  11662. .join('\\b|\\b') +
  11663. '\\b');
  11664. // these unary operators should not be used as property/method names
  11665. const unaryOperatorsRE = new RegExp('\\b' +
  11666. 'delete,typeof,void'.split(',').join('\\s*\\([^\\)]*\\)|\\b') +
  11667. '\\s*\\([^\\)]*\\)');
  11668. // strip strings in expressions
  11669. const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  11670. // detect problematic expressions in a template
  11671. function detectErrors(ast, warn) {
  11672. if (ast) {
  11673. checkNode(ast, warn);
  11674. }
  11675. }
  11676. function checkNode(node, warn) {
  11677. if (node.type === 1) {
  11678. for (const name in node.attrsMap) {
  11679. if (dirRE.test(name)) {
  11680. const value = node.attrsMap[name];
  11681. if (value) {
  11682. const range = node.rawAttrsMap[name];
  11683. if (name === 'v-for') {
  11684. checkFor(node, `v-for="${value}"`, warn, range);
  11685. }
  11686. else if (name === 'v-slot' || name[0] === '#') {
  11687. checkFunctionParameterExpression(value, `${name}="${value}"`, warn, range);
  11688. }
  11689. else if (onRE.test(name)) {
  11690. checkEvent(value, `${name}="${value}"`, warn, range);
  11691. }
  11692. else {
  11693. checkExpression(value, `${name}="${value}"`, warn, range);
  11694. }
  11695. }
  11696. }
  11697. }
  11698. if (node.children) {
  11699. for (let i = 0; i < node.children.length; i++) {
  11700. checkNode(node.children[i], warn);
  11701. }
  11702. }
  11703. }
  11704. else if (node.type === 2) {
  11705. checkExpression(node.expression, node.text, warn, node);
  11706. }
  11707. }
  11708. function checkEvent(exp, text, warn, range) {
  11709. const stripped = exp.replace(stripStringRE, '');
  11710. const keywordMatch = stripped.match(unaryOperatorsRE);
  11711. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  11712. warn(`avoid using JavaScript unary operator as property name: ` +
  11713. `"${keywordMatch[0]}" in expression ${text.trim()}`, range);
  11714. }
  11715. checkExpression(exp, text, warn, range);
  11716. }
  11717. function checkFor(node, text, warn, range) {
  11718. checkExpression(node.for || '', text, warn, range);
  11719. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  11720. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  11721. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  11722. }
  11723. function checkIdentifier(ident, type, text, warn, range) {
  11724. if (typeof ident === 'string') {
  11725. try {
  11726. new Function(`var ${ident}=_`);
  11727. }
  11728. catch (e) {
  11729. warn(`invalid ${type} "${ident}" in expression: ${text.trim()}`, range);
  11730. }
  11731. }
  11732. }
  11733. function checkExpression(exp, text, warn, range) {
  11734. try {
  11735. new Function(`return ${exp}`);
  11736. }
  11737. catch (e) {
  11738. const keywordMatch = exp
  11739. .replace(stripStringRE, '')
  11740. .match(prohibitedKeywordRE);
  11741. if (keywordMatch) {
  11742. warn(`avoid using JavaScript keyword as property name: ` +
  11743. `"${keywordMatch[0]}"\n Raw expression: ${text.trim()}`, range);
  11744. }
  11745. else {
  11746. warn(`invalid expression: ${e.message} in\n\n` +
  11747. ` ${exp}\n\n` +
  11748. ` Raw expression: ${text.trim()}\n`, range);
  11749. }
  11750. }
  11751. }
  11752. function checkFunctionParameterExpression(exp, text, warn, range) {
  11753. try {
  11754. new Function(exp, '');
  11755. }
  11756. catch (e) {
  11757. warn(`invalid function parameter expression: ${e.message} in\n\n` +
  11758. ` ${exp}\n\n` +
  11759. ` Raw expression: ${text.trim()}\n`, range);
  11760. }
  11761. }
  11762. function createFunction(code, errors) {
  11763. try {
  11764. return new Function(code);
  11765. }
  11766. catch (err) {
  11767. errors.push({ err, code });
  11768. return noop;
  11769. }
  11770. }
  11771. function createCompileToFunctionFn(compile) {
  11772. const cache = Object.create(null);
  11773. return function compileToFunctions(template, options, vm) {
  11774. options = extend({}, options);
  11775. const warn = options.warn || warn$3;
  11776. delete options.warn;
  11777. /* istanbul ignore if */
  11778. if (process.env.NODE_ENV !== 'production') {
  11779. // detect possible CSP restriction
  11780. try {
  11781. new Function('return 1');
  11782. }
  11783. catch (e) {
  11784. if (e.toString().match(/unsafe-eval|CSP/)) {
  11785. warn('It seems you are using the standalone build of Vue.js in an ' +
  11786. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  11787. 'The template compiler cannot work in this environment. Consider ' +
  11788. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  11789. 'templates into render functions.');
  11790. }
  11791. }
  11792. }
  11793. // check cache
  11794. const key = options.delimiters
  11795. ? String(options.delimiters) + template
  11796. : template;
  11797. if (cache[key]) {
  11798. return cache[key];
  11799. }
  11800. // compile
  11801. const compiled = compile(template, options);
  11802. // check compilation errors/tips
  11803. if (process.env.NODE_ENV !== 'production') {
  11804. if (compiled.errors && compiled.errors.length) {
  11805. if (options.outputSourceRange) {
  11806. compiled.errors.forEach(e => {
  11807. warn(`Error compiling template:\n\n${e.msg}\n\n` +
  11808. generateCodeFrame(template, e.start, e.end), vm);
  11809. });
  11810. }
  11811. else {
  11812. warn(`Error compiling template:\n\n${template}\n\n` +
  11813. compiled.errors.map(e => `- ${e}`).join('\n') +
  11814. '\n', vm);
  11815. }
  11816. }
  11817. if (compiled.tips && compiled.tips.length) {
  11818. if (options.outputSourceRange) {
  11819. compiled.tips.forEach(e => tip(e.msg, vm));
  11820. }
  11821. else {
  11822. compiled.tips.forEach(msg => tip(msg, vm));
  11823. }
  11824. }
  11825. }
  11826. // turn code into functions
  11827. const res = {};
  11828. const fnGenErrors = [];
  11829. res.render = createFunction(compiled.render, fnGenErrors);
  11830. res.staticRenderFns = compiled.staticRenderFns.map(code => {
  11831. return createFunction(code, fnGenErrors);
  11832. });
  11833. // check function generation errors.
  11834. // this should only happen if there is a bug in the compiler itself.
  11835. // mostly for codegen development use
  11836. /* istanbul ignore if */
  11837. if (process.env.NODE_ENV !== 'production') {
  11838. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  11839. warn(`Failed to generate render function:\n\n` +
  11840. fnGenErrors
  11841. .map(({ err, code }) => `${err.toString()} in\n\n${code}\n`)
  11842. .join('\n'), vm);
  11843. }
  11844. }
  11845. return (cache[key] = res);
  11846. };
  11847. }
  11848. function createCompilerCreator(baseCompile) {
  11849. return function createCompiler(baseOptions) {
  11850. function compile(template, options) {
  11851. const finalOptions = Object.create(baseOptions);
  11852. const errors = [];
  11853. const tips = [];
  11854. let warn = (msg, range, tip) => {
  11855. (tip ? tips : errors).push(msg);
  11856. };
  11857. if (options) {
  11858. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  11859. // $flow-disable-line
  11860. const leadingSpaceLength = template.match(/^\s*/)[0].length;
  11861. warn = (msg, range, tip) => {
  11862. const data = typeof msg === 'string' ? { msg } : msg;
  11863. if (range) {
  11864. if (range.start != null) {
  11865. data.start = range.start + leadingSpaceLength;
  11866. }
  11867. if (range.end != null) {
  11868. data.end = range.end + leadingSpaceLength;
  11869. }
  11870. }
  11871. (tip ? tips : errors).push(data);
  11872. };
  11873. }
  11874. // merge custom modules
  11875. if (options.modules) {
  11876. finalOptions.modules = (baseOptions.modules || []).concat(options.modules);
  11877. }
  11878. // merge custom directives
  11879. if (options.directives) {
  11880. finalOptions.directives = extend(Object.create(baseOptions.directives || null), options.directives);
  11881. }
  11882. // copy other options
  11883. for (const key in options) {
  11884. if (key !== 'modules' && key !== 'directives') {
  11885. finalOptions[key] = options[key];
  11886. }
  11887. }
  11888. }
  11889. finalOptions.warn = warn;
  11890. const compiled = baseCompile(template.trim(), finalOptions);
  11891. if (process.env.NODE_ENV !== 'production') {
  11892. detectErrors(compiled.ast, warn);
  11893. }
  11894. compiled.errors = errors;
  11895. compiled.tips = tips;
  11896. return compiled;
  11897. }
  11898. return {
  11899. compile,
  11900. compileToFunctions: createCompileToFunctionFn(compile)
  11901. };
  11902. };
  11903. }
  11904. // `createCompilerCreator` allows creating compilers that use alternative
  11905. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  11906. // Here we just export a default compiler using the default parts.
  11907. const createCompiler$1 = createCompilerCreator(function baseCompile(template, options) {
  11908. const ast = parse$1(template.trim(), options);
  11909. if (options.optimize !== false) {
  11910. optimize$1(ast, options);
  11911. }
  11912. const code = generate$1(ast, options);
  11913. return {
  11914. ast,
  11915. render: code.render,
  11916. staticRenderFns: code.staticRenderFns
  11917. };
  11918. });
  11919. const { compile: compile$1, compileToFunctions: compileToFunctions$1 } = createCompiler$1(baseOptions);
  11920. const isAttr = makeMap('accept,accept-charset,accesskey,action,align,alt,async,autocomplete,' +
  11921. 'autofocus,autoplay,autosave,bgcolor,border,buffered,challenge,charset,' +
  11922. 'checked,cite,class,code,codebase,color,cols,colspan,content,' +
  11923. 'contenteditable,contextmenu,controls,coords,data,datetime,default,' +
  11924. 'defer,dir,dirname,disabled,download,draggable,dropzone,enctype,for,' +
  11925. 'form,formaction,headers,height,hidden,high,href,hreflang,http-equiv,' +
  11926. 'icon,id,ismap,itemprop,keytype,kind,label,lang,language,list,loop,low,' +
  11927. 'manifest,max,maxlength,media,method,GET,POST,min,multiple,email,file,' +
  11928. 'muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,' +
  11929. 'preload,radiogroup,readonly,rel,required,reversed,rows,rowspan,sandbox,' +
  11930. 'scope,scoped,seamless,selected,shape,size,type,text,password,sizes,span,' +
  11931. 'spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,' +
  11932. 'target,title,usemap,value,width,wrap');
  11933. /* istanbul ignore next */
  11934. const isRenderableAttr = (name) => {
  11935. return (isAttr(name) || name.indexOf('data-') === 0 || name.indexOf('aria-') === 0);
  11936. };
  11937. const propsToAttrMap = {
  11938. acceptCharset: 'accept-charset',
  11939. className: 'class',
  11940. htmlFor: 'for',
  11941. httpEquiv: 'http-equiv'
  11942. };
  11943. const ESC = {
  11944. '<': '&lt;',
  11945. '>': '&gt;',
  11946. '"': '&quot;',
  11947. '&': '&amp;'
  11948. };
  11949. function escape(s) {
  11950. return s.replace(/[<>"&]/g, escapeChar);
  11951. }
  11952. function escapeChar(a) {
  11953. return ESC[a] || a;
  11954. }
  11955. const plainStringRE = /^"(?:[^"\\]|\\.)*"$|^'(?:[^'\\]|\\.)*'$/;
  11956. // let the model AST transform translate v-model into appropriate
  11957. // props bindings
  11958. function applyModelTransform(el, state) {
  11959. if (el.directives) {
  11960. for (let i = 0; i < el.directives.length; i++) {
  11961. const dir = el.directives[i];
  11962. if (dir.name === 'model') {
  11963. state.directives.model(el, dir, state.warn);
  11964. // remove value for textarea as its converted to text
  11965. if (el.tag === 'textarea' && el.props) {
  11966. el.props = el.props.filter(p => p.name !== 'value');
  11967. }
  11968. break;
  11969. }
  11970. }
  11971. }
  11972. }
  11973. function genAttrSegments(attrs) {
  11974. return attrs.map(({ name, value }) => genAttrSegment(name, value));
  11975. }
  11976. function genDOMPropSegments(props, attrs) {
  11977. const segments = [];
  11978. props.forEach(({ name, value }) => {
  11979. name = propsToAttrMap[name] || name.toLowerCase();
  11980. if (isRenderableAttr(name) &&
  11981. !(attrs && attrs.some(a => a.name === name))) {
  11982. segments.push(genAttrSegment(name, value));
  11983. }
  11984. });
  11985. return segments;
  11986. }
  11987. function genAttrSegment(name, value) {
  11988. if (plainStringRE.test(value)) {
  11989. // force double quote
  11990. value = value.replace(/^'|'$/g, '"');
  11991. // force enumerated attr to "true"
  11992. if (isEnumeratedAttr(name) && value !== `"false"`) {
  11993. value = `"true"`;
  11994. }
  11995. return {
  11996. type: RAW,
  11997. value: isBooleanAttr(name)
  11998. ? ` ${name}="${name}"`
  11999. : value === '""'
  12000. ? ` ${name}`
  12001. : ` ${name}="${JSON.parse(value)}"`
  12002. };
  12003. }
  12004. else {
  12005. return {
  12006. type: EXPRESSION,
  12007. value: `_ssrAttr(${JSON.stringify(name)},${value})`
  12008. };
  12009. }
  12010. }
  12011. function genClassSegments(staticClass, classBinding) {
  12012. if (staticClass && !classBinding) {
  12013. return [{ type: RAW, value: ` class="${JSON.parse(staticClass)}"` }];
  12014. }
  12015. else {
  12016. return [
  12017. {
  12018. type: EXPRESSION,
  12019. value: `_ssrClass(${staticClass || 'null'},${classBinding || 'null'})`
  12020. }
  12021. ];
  12022. }
  12023. }
  12024. function genStyleSegments(staticStyle, parsedStaticStyle, styleBinding, vShowExpression) {
  12025. if (staticStyle && !styleBinding && !vShowExpression) {
  12026. return [{ type: RAW, value: ` style=${JSON.stringify(staticStyle)}` }];
  12027. }
  12028. else {
  12029. return [
  12030. {
  12031. type: EXPRESSION,
  12032. value: `_ssrStyle(${parsedStaticStyle || 'null'},${styleBinding || 'null'}, ${vShowExpression
  12033. ? `{ display: (${vShowExpression}) ? '' : 'none' }`
  12034. : 'null'})`
  12035. }
  12036. ];
  12037. }
  12038. }
  12039. /**
  12040. * In SSR, the vdom tree is generated only once and never patched, so
  12041. * we can optimize most element / trees into plain string render functions.
  12042. * The SSR optimizer walks the AST tree to detect optimizable elements and trees.
  12043. *
  12044. * The criteria for SSR optimizability is quite a bit looser than static tree
  12045. * detection (which is designed for client re-render). In SSR we bail only for
  12046. * components/slots/custom directives.
  12047. */
  12048. // optimizability constants
  12049. const optimizability = {
  12050. FALSE: 0,
  12051. FULL: 1,
  12052. SELF: 2,
  12053. CHILDREN: 3,
  12054. PARTIAL: 4 // self un-optimizable with some un-optimizable children
  12055. };
  12056. let isPlatformReservedTag;
  12057. function optimize(root, options) {
  12058. if (!root)
  12059. return;
  12060. isPlatformReservedTag = options.isReservedTag || no;
  12061. walk(root, true);
  12062. }
  12063. function walk(node, isRoot) {
  12064. if (isUnOptimizableTree(node)) {
  12065. node.ssrOptimizability = optimizability.FALSE;
  12066. return;
  12067. }
  12068. // root node or nodes with custom directives should always be a VNode
  12069. const selfUnoptimizable = isRoot || hasCustomDirective(node);
  12070. const check = child => {
  12071. if (child.ssrOptimizability !== optimizability.FULL) {
  12072. node.ssrOptimizability = selfUnoptimizable
  12073. ? optimizability.PARTIAL
  12074. : optimizability.SELF;
  12075. }
  12076. };
  12077. if (selfUnoptimizable) {
  12078. node.ssrOptimizability = optimizability.CHILDREN;
  12079. }
  12080. if (node.type === 1) {
  12081. for (let i = 0, l = node.children.length; i < l; i++) {
  12082. const child = node.children[i];
  12083. walk(child);
  12084. check(child);
  12085. }
  12086. if (node.ifConditions) {
  12087. for (let i = 1, l = node.ifConditions.length; i < l; i++) {
  12088. const block = node.ifConditions[i].block;
  12089. walk(block, isRoot);
  12090. check(block);
  12091. }
  12092. }
  12093. if (node.ssrOptimizability == null ||
  12094. (!isRoot && (node.attrsMap['v-html'] || node.attrsMap['v-text']))) {
  12095. node.ssrOptimizability = optimizability.FULL;
  12096. }
  12097. else {
  12098. node.children = optimizeSiblings(node);
  12099. }
  12100. }
  12101. else {
  12102. node.ssrOptimizability = optimizability.FULL;
  12103. }
  12104. }
  12105. function optimizeSiblings(el) {
  12106. const children = el.children;
  12107. const optimizedChildren = [];
  12108. let currentOptimizableGroup = [];
  12109. const pushGroup = () => {
  12110. if (currentOptimizableGroup.length) {
  12111. optimizedChildren.push({
  12112. type: 1,
  12113. parent: el,
  12114. tag: 'template',
  12115. attrsList: [],
  12116. attrsMap: {},
  12117. rawAttrsMap: {},
  12118. children: currentOptimizableGroup,
  12119. ssrOptimizability: optimizability.FULL
  12120. });
  12121. }
  12122. currentOptimizableGroup = [];
  12123. };
  12124. for (let i = 0; i < children.length; i++) {
  12125. const c = children[i];
  12126. if (c.ssrOptimizability === optimizability.FULL) {
  12127. currentOptimizableGroup.push(c);
  12128. }
  12129. else {
  12130. // wrap fully-optimizable adjacent siblings inside a template tag
  12131. // so that they can be optimized into a single ssrNode by codegen
  12132. pushGroup();
  12133. optimizedChildren.push(c);
  12134. }
  12135. }
  12136. pushGroup();
  12137. return optimizedChildren;
  12138. }
  12139. function isUnOptimizableTree(node) {
  12140. if (node.type === 2 || node.type === 3) {
  12141. // text or expression
  12142. return false;
  12143. }
  12144. return (isBuiltInTag(node.tag) || // built-in (slot, component)
  12145. !isPlatformReservedTag(node.tag) || // custom component
  12146. !!node.component || // "is" component
  12147. isSelectWithModel(node) // <select v-model> requires runtime inspection
  12148. );
  12149. }
  12150. const isBuiltInDir = makeMap('text,html,show,on,bind,model,pre,cloak,once');
  12151. function hasCustomDirective(node) {
  12152. return (node.type === 1 &&
  12153. node.directives &&
  12154. node.directives.some(d => !isBuiltInDir(d.name)));
  12155. }
  12156. // <select v-model> cannot be optimized because it requires a runtime check
  12157. // to determine proper selected option
  12158. function isSelectWithModel(node) {
  12159. return (node.type === 1 &&
  12160. node.tag === 'select' &&
  12161. node.directives != null &&
  12162. node.directives.some(d => d.name === 'model'));
  12163. }
  12164. // The SSR codegen is essentially extending the default codegen to handle
  12165. // segment types
  12166. const RAW = 0;
  12167. const INTERPOLATION = 1;
  12168. const EXPRESSION = 2;
  12169. function generate(ast, options) {
  12170. const state = new CodegenState(options);
  12171. const code = ast ? genSSRElement(ast, state) : '_c("div")';
  12172. return {
  12173. render: `with(this){return ${code}}`,
  12174. staticRenderFns: state.staticRenderFns
  12175. };
  12176. }
  12177. function genSSRElement(el, state) {
  12178. if (el.for && !el.forProcessed) {
  12179. return genFor(el, state, genSSRElement);
  12180. }
  12181. else if (el.if && !el.ifProcessed) {
  12182. return genIf(el, state, genSSRElement);
  12183. }
  12184. else if (el.tag === 'template' && !el.slotTarget) {
  12185. return el.ssrOptimizability === optimizability.FULL
  12186. ? genChildrenAsStringNode(el, state)
  12187. : genSSRChildren(el, state) || 'void 0';
  12188. }
  12189. switch (el.ssrOptimizability) {
  12190. case optimizability.FULL:
  12191. // stringify whole tree
  12192. return genStringElement(el, state);
  12193. case optimizability.SELF:
  12194. // stringify self and check children
  12195. return genStringElementWithChildren(el, state);
  12196. case optimizability.CHILDREN:
  12197. // generate self as VNode and stringify children
  12198. return genNormalElement(el, state, true);
  12199. case optimizability.PARTIAL:
  12200. // generate self as VNode and check children
  12201. return genNormalElement(el, state, false);
  12202. default:
  12203. // bail whole tree
  12204. return genElement(el, state);
  12205. }
  12206. }
  12207. function genNormalElement(el, state, stringifyChildren) {
  12208. const data = el.plain ? undefined : genData(el, state);
  12209. const children = stringifyChildren
  12210. ? `[${genChildrenAsStringNode(el, state)}]`
  12211. : genSSRChildren(el, state, true);
  12212. return `_c('${el.tag}'${data ? `,${data}` : ''}${children ? `,${children}` : ''})`;
  12213. }
  12214. function genSSRChildren(el, state, checkSkip) {
  12215. return genChildren(el, state, checkSkip, genSSRElement, genSSRNode);
  12216. }
  12217. function genSSRNode(el, state) {
  12218. return el.type === 1 ? genSSRElement(el, state) : genText(el);
  12219. }
  12220. function genChildrenAsStringNode(el, state) {
  12221. return el.children.length
  12222. ? `_ssrNode(${flattenSegments(childrenToSegments(el, state))})`
  12223. : '';
  12224. }
  12225. function genStringElement(el, state) {
  12226. return `_ssrNode(${elementToString(el, state)})`;
  12227. }
  12228. function genStringElementWithChildren(el, state) {
  12229. const children = genSSRChildren(el, state, true);
  12230. return `_ssrNode(${flattenSegments(elementToOpenTagSegments(el, state))},"</${el.tag}>"${children ? `,${children}` : ''})`;
  12231. }
  12232. function elementToString(el, state) {
  12233. return `(${flattenSegments(elementToSegments(el, state))})`;
  12234. }
  12235. function elementToSegments(el, state) {
  12236. // v-for / v-if
  12237. if (el.for && !el.forProcessed) {
  12238. el.forProcessed = true;
  12239. return [
  12240. {
  12241. type: EXPRESSION,
  12242. value: genFor(el, state, elementToString, '_ssrList')
  12243. }
  12244. ];
  12245. }
  12246. else if (el.if && !el.ifProcessed) {
  12247. el.ifProcessed = true;
  12248. return [
  12249. {
  12250. type: EXPRESSION,
  12251. value: genIf(el, state, elementToString, '"<!---->"')
  12252. }
  12253. ];
  12254. }
  12255. else if (el.tag === 'template') {
  12256. return childrenToSegments(el, state);
  12257. }
  12258. const openSegments = elementToOpenTagSegments(el, state);
  12259. const childrenSegments = childrenToSegments(el, state);
  12260. const { isUnaryTag } = state.options;
  12261. const close = isUnaryTag && isUnaryTag(el.tag)
  12262. ? []
  12263. : [{ type: RAW, value: `</${el.tag}>` }];
  12264. return openSegments.concat(childrenSegments, close);
  12265. }
  12266. function elementToOpenTagSegments(el, state) {
  12267. applyModelTransform(el, state);
  12268. let binding;
  12269. const segments = [{ type: RAW, value: `<${el.tag}` }];
  12270. // attrs
  12271. if (el.attrs) {
  12272. segments.push.apply(segments, genAttrSegments(el.attrs));
  12273. }
  12274. // domProps
  12275. if (el.props) {
  12276. segments.push.apply(segments, genDOMPropSegments(el.props, el.attrs));
  12277. }
  12278. // v-bind="object"
  12279. if ((binding = el.attrsMap['v-bind'])) {
  12280. segments.push({ type: EXPRESSION, value: `_ssrAttrs(${binding})` });
  12281. }
  12282. // v-bind.prop="object"
  12283. if ((binding = el.attrsMap['v-bind.prop'])) {
  12284. segments.push({ type: EXPRESSION, value: `_ssrDOMProps(${binding})` });
  12285. }
  12286. // class
  12287. if (el.staticClass || el.classBinding) {
  12288. segments.push.apply(segments, genClassSegments(el.staticClass, el.classBinding));
  12289. }
  12290. // style & v-show
  12291. if (el.staticStyle || el.styleBinding || el.attrsMap['v-show']) {
  12292. segments.push.apply(segments, genStyleSegments(el.attrsMap.style, el.staticStyle, el.styleBinding, el.attrsMap['v-show']));
  12293. }
  12294. // _scopedId
  12295. if (state.options.scopeId) {
  12296. segments.push({ type: RAW, value: ` ${state.options.scopeId}` });
  12297. }
  12298. segments.push({ type: RAW, value: `>` });
  12299. return segments;
  12300. }
  12301. function childrenToSegments(el, state) {
  12302. let binding;
  12303. if ((binding = el.attrsMap['v-html'])) {
  12304. return [{ type: EXPRESSION, value: `_s(${binding})` }];
  12305. }
  12306. if ((binding = el.attrsMap['v-text'])) {
  12307. return [{ type: INTERPOLATION, value: `_s(${binding})` }];
  12308. }
  12309. if (el.tag === 'textarea' && (binding = el.attrsMap['v-model'])) {
  12310. return [{ type: INTERPOLATION, value: `_s(${binding})` }];
  12311. }
  12312. return el.children ? nodesToSegments(el.children, state) : [];
  12313. }
  12314. function nodesToSegments(children, state) {
  12315. const segments = [];
  12316. for (let i = 0; i < children.length; i++) {
  12317. const c = children[i];
  12318. if (c.type === 1) {
  12319. segments.push.apply(segments, elementToSegments(c, state));
  12320. }
  12321. else if (c.type === 2) {
  12322. segments.push({ type: INTERPOLATION, value: c.expression });
  12323. }
  12324. else if (c.type === 3) {
  12325. let text = escape(c.text);
  12326. if (c.isComment) {
  12327. text = '<!--' + text + '-->';
  12328. }
  12329. segments.push({ type: RAW, value: text });
  12330. }
  12331. }
  12332. return segments;
  12333. }
  12334. function flattenSegments(segments) {
  12335. const mergedSegments = [];
  12336. let textBuffer = '';
  12337. const pushBuffer = () => {
  12338. if (textBuffer) {
  12339. mergedSegments.push(JSON.stringify(textBuffer));
  12340. textBuffer = '';
  12341. }
  12342. };
  12343. for (let i = 0; i < segments.length; i++) {
  12344. const s = segments[i];
  12345. if (s.type === RAW) {
  12346. textBuffer += s.value;
  12347. }
  12348. else if (s.type === INTERPOLATION) {
  12349. pushBuffer();
  12350. mergedSegments.push(`_ssrEscape(${s.value})`);
  12351. }
  12352. else if (s.type === EXPRESSION) {
  12353. pushBuffer();
  12354. mergedSegments.push(`(${s.value})`);
  12355. }
  12356. }
  12357. pushBuffer();
  12358. return mergedSegments.join('+');
  12359. }
  12360. const createCompiler = createCompilerCreator(function baseCompile(template, options) {
  12361. const ast = parse$1(template.trim(), options);
  12362. optimize(ast, options);
  12363. const code = generate(ast, options);
  12364. return {
  12365. ast,
  12366. render: code.render,
  12367. staticRenderFns: code.staticRenderFns
  12368. };
  12369. });
  12370. const { compile, compileToFunctions } = createCompiler(baseOptions);
  12371. var _compiler = /*#__PURE__*/Object.freeze({
  12372. __proto__: null,
  12373. parseComponent: parseComponent,
  12374. compile: compile$1,
  12375. compileToFunctions: compileToFunctions$1,
  12376. ssrCompile: compile,
  12377. ssrCompileToFunctions: compileToFunctions,
  12378. generateCodeFrame: generateCodeFrame
  12379. });
  12380. function compileTemplate(options) {
  12381. const { preprocessLang } = options;
  12382. const preprocessor = preprocessLang && consolidate[preprocessLang];
  12383. if (preprocessor) {
  12384. return actuallyCompile(Object.assign({}, options, {
  12385. source: preprocess$1(options, preprocessor)
  12386. }));
  12387. }
  12388. else if (preprocessLang) {
  12389. return {
  12390. ast: {},
  12391. code: `var render = function () {}\n` + `var staticRenderFns = []\n`,
  12392. source: options.source,
  12393. tips: [
  12394. `Component ${options.filename} uses lang ${preprocessLang} for template. Please install the language preprocessor.`
  12395. ],
  12396. errors: [
  12397. `Component ${options.filename} uses lang ${preprocessLang} for template, however it is not installed.`
  12398. ]
  12399. };
  12400. }
  12401. else {
  12402. return actuallyCompile(options);
  12403. }
  12404. }
  12405. function preprocess$1(options, preprocessor) {
  12406. const { source, filename, preprocessOptions } = options;
  12407. const finalPreprocessOptions = Object.assign({
  12408. filename
  12409. }, preprocessOptions);
  12410. // Consolidate exposes a callback based API, but the callback is in fact
  12411. // called synchronously for most templating engines. In our case, we have to
  12412. // expose a synchronous API so that it is usable in Jest transforms (which
  12413. // have to be sync because they are applied via Node.js require hooks)
  12414. let res, err;
  12415. preprocessor.render(source, finalPreprocessOptions, (_err, _res) => {
  12416. if (_err)
  12417. err = _err;
  12418. res = _res;
  12419. });
  12420. if (err)
  12421. throw err;
  12422. return res;
  12423. }
  12424. function actuallyCompile(options) {
  12425. const { source, compiler = _compiler, compilerOptions = {}, transpileOptions = {}, transformAssetUrls, transformAssetUrlsOptions, isProduction = process.env.NODE_ENV === 'production', isFunctional = false, optimizeSSR = false, prettify = true, isTS = false, bindings } = options;
  12426. const compile = optimizeSSR && compiler.ssrCompile ? compiler.ssrCompile : compiler.compile;
  12427. let finalCompilerOptions = compilerOptions;
  12428. if (transformAssetUrls) {
  12429. const builtInModules = [
  12430. transformAssetUrls === true
  12431. ? assetUrlsModule(undefined, transformAssetUrlsOptions)
  12432. : assetUrlsModule(transformAssetUrls, transformAssetUrlsOptions),
  12433. srcsetModule(transformAssetUrlsOptions)
  12434. ];
  12435. finalCompilerOptions = Object.assign({}, compilerOptions, {
  12436. modules: [...builtInModules, ...(compilerOptions.modules || [])],
  12437. filename: options.filename
  12438. });
  12439. }
  12440. finalCompilerOptions.bindings = bindings;
  12441. const { ast, render, staticRenderFns, tips, errors } = compile(source, finalCompilerOptions);
  12442. if (errors && errors.length) {
  12443. return {
  12444. ast,
  12445. code: `var render = function () {}\n` + `var staticRenderFns = []\n`,
  12446. source,
  12447. tips,
  12448. errors
  12449. };
  12450. }
  12451. else {
  12452. // stripping `with` usage
  12453. let code = `var __render__ = ${prefixIdentifiers(`function render(${isFunctional ? `_c,_vm` : ``}){${render}\n}`, isFunctional, isTS, transpileOptions, bindings)}\n` +
  12454. `var __staticRenderFns__ = [${staticRenderFns.map(code => prefixIdentifiers(`function (${isFunctional ? `_c,_vm` : ``}){${code}\n}`, isFunctional, isTS, transpileOptions, bindings))}]` +
  12455. `\n`;
  12456. // #23 we use __render__ to avoid `render` not being prefixed by the
  12457. // transpiler when stripping with, but revert it back to `render` to
  12458. // maintain backwards compat
  12459. code = code.replace(/\s__(render|staticRenderFns)__\s/g, ' $1 ');
  12460. if (!isProduction) {
  12461. // mark with stripped (this enables Vue to use correct runtime proxy
  12462. // detection)
  12463. code += `render._withStripped = true`;
  12464. if (prettify) {
  12465. try {
  12466. code = require('prettier').format(code, {
  12467. semi: false,
  12468. parser: 'babel'
  12469. });
  12470. }
  12471. catch (e) {
  12472. if (e.code === 'MODULE_NOT_FOUND') {
  12473. tips.push('The `prettify` option is on, but the dependency `prettier` is not found.\n' +
  12474. 'Please either turn off `prettify` or manually install `prettier`.');
  12475. }
  12476. tips.push(`Failed to prettify component ${options.filename} template source after compilation.`);
  12477. }
  12478. }
  12479. }
  12480. return {
  12481. ast,
  12482. code,
  12483. source,
  12484. tips,
  12485. errors
  12486. };
  12487. }
  12488. }
  12489. const trimPlugin = () => {
  12490. return {
  12491. postcssPlugin: 'vue-sfc-trim',
  12492. Once(root) {
  12493. root.walk(({ type, raws }) => {
  12494. if (type === 'rule' || type === 'atrule') {
  12495. if (raws.before)
  12496. raws.before = '\n';
  12497. if ('after' in raws && raws.after)
  12498. raws.after = '\n';
  12499. }
  12500. });
  12501. }
  12502. };
  12503. };
  12504. trimPlugin.postcss = true;
  12505. var dist = {exports: {}};
  12506. var processor = {exports: {}};
  12507. var parser = {exports: {}};
  12508. var root$1 = {exports: {}};
  12509. var container = {exports: {}};
  12510. var node$1 = {exports: {}};
  12511. var util = {};
  12512. var unesc = {exports: {}};
  12513. (function (module, exports) {
  12514. exports.__esModule = true;
  12515. exports["default"] = unesc;
  12516. // Many thanks for this post which made this migration much easier.
  12517. // https://mathiasbynens.be/notes/css-escapes
  12518. /**
  12519. *
  12520. * @param {string} str
  12521. * @returns {[string, number]|undefined}
  12522. */
  12523. function gobbleHex(str) {
  12524. var lower = str.toLowerCase();
  12525. var hex = '';
  12526. var spaceTerminated = false;
  12527. for (var i = 0; i < 6 && lower[i] !== undefined; i++) {
  12528. var code = lower.charCodeAt(i); // check to see if we are dealing with a valid hex char [a-f|0-9]
  12529. var valid = code >= 97 && code <= 102 || code >= 48 && code <= 57; // https://drafts.csswg.org/css-syntax/#consume-escaped-code-point
  12530. spaceTerminated = code === 32;
  12531. if (!valid) {
  12532. break;
  12533. }
  12534. hex += lower[i];
  12535. }
  12536. if (hex.length === 0) {
  12537. return undefined;
  12538. }
  12539. var codePoint = parseInt(hex, 16);
  12540. var isSurrogate = codePoint >= 0xD800 && codePoint <= 0xDFFF; // Add special case for
  12541. // "If this number is zero, or is for a surrogate, or is greater than the maximum allowed code point"
  12542. // https://drafts.csswg.org/css-syntax/#maximum-allowed-code-point
  12543. if (isSurrogate || codePoint === 0x0000 || codePoint > 0x10FFFF) {
  12544. return ["\uFFFD", hex.length + (spaceTerminated ? 1 : 0)];
  12545. }
  12546. return [String.fromCodePoint(codePoint), hex.length + (spaceTerminated ? 1 : 0)];
  12547. }
  12548. var CONTAINS_ESCAPE = /\\/;
  12549. function unesc(str) {
  12550. var needToProcess = CONTAINS_ESCAPE.test(str);
  12551. if (!needToProcess) {
  12552. return str;
  12553. }
  12554. var ret = "";
  12555. for (var i = 0; i < str.length; i++) {
  12556. if (str[i] === "\\") {
  12557. var gobbled = gobbleHex(str.slice(i + 1, i + 7));
  12558. if (gobbled !== undefined) {
  12559. ret += gobbled[0];
  12560. i += gobbled[1];
  12561. continue;
  12562. } // Retain a pair of \\ if double escaped `\\\\`
  12563. // https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e
  12564. if (str[i + 1] === "\\") {
  12565. ret += "\\";
  12566. i++;
  12567. continue;
  12568. } // if \\ is at the end of the string retain it
  12569. // https://github.com/postcss/postcss-selector-parser/commit/01a6b346e3612ce1ab20219acc26abdc259ccefb
  12570. if (str.length === i + 1) {
  12571. ret += str[i];
  12572. }
  12573. continue;
  12574. }
  12575. ret += str[i];
  12576. }
  12577. return ret;
  12578. }
  12579. module.exports = exports.default;
  12580. } (unesc, unesc.exports));
  12581. var getProp = {exports: {}};
  12582. (function (module, exports) {
  12583. exports.__esModule = true;
  12584. exports["default"] = getProp;
  12585. function getProp(obj) {
  12586. for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  12587. props[_key - 1] = arguments[_key];
  12588. }
  12589. while (props.length > 0) {
  12590. var prop = props.shift();
  12591. if (!obj[prop]) {
  12592. return undefined;
  12593. }
  12594. obj = obj[prop];
  12595. }
  12596. return obj;
  12597. }
  12598. module.exports = exports.default;
  12599. } (getProp, getProp.exports));
  12600. var ensureObject = {exports: {}};
  12601. (function (module, exports) {
  12602. exports.__esModule = true;
  12603. exports["default"] = ensureObject;
  12604. function ensureObject(obj) {
  12605. for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  12606. props[_key - 1] = arguments[_key];
  12607. }
  12608. while (props.length > 0) {
  12609. var prop = props.shift();
  12610. if (!obj[prop]) {
  12611. obj[prop] = {};
  12612. }
  12613. obj = obj[prop];
  12614. }
  12615. }
  12616. module.exports = exports.default;
  12617. } (ensureObject, ensureObject.exports));
  12618. var stripComments = {exports: {}};
  12619. (function (module, exports) {
  12620. exports.__esModule = true;
  12621. exports["default"] = stripComments;
  12622. function stripComments(str) {
  12623. var s = "";
  12624. var commentStart = str.indexOf("/*");
  12625. var lastEnd = 0;
  12626. while (commentStart >= 0) {
  12627. s = s + str.slice(lastEnd, commentStart);
  12628. var commentEnd = str.indexOf("*/", commentStart + 2);
  12629. if (commentEnd < 0) {
  12630. return s;
  12631. }
  12632. lastEnd = commentEnd + 2;
  12633. commentStart = str.indexOf("/*", lastEnd);
  12634. }
  12635. s = s + str.slice(lastEnd);
  12636. return s;
  12637. }
  12638. module.exports = exports.default;
  12639. } (stripComments, stripComments.exports));
  12640. util.__esModule = true;
  12641. util.stripComments = util.ensureObject = util.getProp = util.unesc = void 0;
  12642. var _unesc = _interopRequireDefault$1(unesc.exports);
  12643. util.unesc = _unesc["default"];
  12644. var _getProp = _interopRequireDefault$1(getProp.exports);
  12645. util.getProp = _getProp["default"];
  12646. var _ensureObject = _interopRequireDefault$1(ensureObject.exports);
  12647. util.ensureObject = _ensureObject["default"];
  12648. var _stripComments = _interopRequireDefault$1(stripComments.exports);
  12649. util.stripComments = _stripComments["default"];
  12650. function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  12651. (function (module, exports) {
  12652. exports.__esModule = true;
  12653. exports["default"] = void 0;
  12654. var _util = util;
  12655. 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); } }
  12656. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  12657. var cloneNode = function cloneNode(obj, parent) {
  12658. if (typeof obj !== 'object' || obj === null) {
  12659. return obj;
  12660. }
  12661. var cloned = new obj.constructor();
  12662. for (var i in obj) {
  12663. if (!obj.hasOwnProperty(i)) {
  12664. continue;
  12665. }
  12666. var value = obj[i];
  12667. var type = typeof value;
  12668. if (i === 'parent' && type === 'object') {
  12669. if (parent) {
  12670. cloned[i] = parent;
  12671. }
  12672. } else if (value instanceof Array) {
  12673. cloned[i] = value.map(function (j) {
  12674. return cloneNode(j, cloned);
  12675. });
  12676. } else {
  12677. cloned[i] = cloneNode(value, cloned);
  12678. }
  12679. }
  12680. return cloned;
  12681. };
  12682. var Node = /*#__PURE__*/function () {
  12683. function Node(opts) {
  12684. if (opts === void 0) {
  12685. opts = {};
  12686. }
  12687. Object.assign(this, opts);
  12688. this.spaces = this.spaces || {};
  12689. this.spaces.before = this.spaces.before || '';
  12690. this.spaces.after = this.spaces.after || '';
  12691. }
  12692. var _proto = Node.prototype;
  12693. _proto.remove = function remove() {
  12694. if (this.parent) {
  12695. this.parent.removeChild(this);
  12696. }
  12697. this.parent = undefined;
  12698. return this;
  12699. };
  12700. _proto.replaceWith = function replaceWith() {
  12701. if (this.parent) {
  12702. for (var index in arguments) {
  12703. this.parent.insertBefore(this, arguments[index]);
  12704. }
  12705. this.remove();
  12706. }
  12707. return this;
  12708. };
  12709. _proto.next = function next() {
  12710. return this.parent.at(this.parent.index(this) + 1);
  12711. };
  12712. _proto.prev = function prev() {
  12713. return this.parent.at(this.parent.index(this) - 1);
  12714. };
  12715. _proto.clone = function clone(overrides) {
  12716. if (overrides === void 0) {
  12717. overrides = {};
  12718. }
  12719. var cloned = cloneNode(this);
  12720. for (var name in overrides) {
  12721. cloned[name] = overrides[name];
  12722. }
  12723. return cloned;
  12724. }
  12725. /**
  12726. * Some non-standard syntax doesn't follow normal escaping rules for css.
  12727. * This allows non standard syntax to be appended to an existing property
  12728. * by specifying the escaped value. By specifying the escaped value,
  12729. * illegal characters are allowed to be directly inserted into css output.
  12730. * @param {string} name the property to set
  12731. * @param {any} value the unescaped value of the property
  12732. * @param {string} valueEscaped optional. the escaped value of the property.
  12733. */
  12734. ;
  12735. _proto.appendToPropertyAndEscape = function appendToPropertyAndEscape(name, value, valueEscaped) {
  12736. if (!this.raws) {
  12737. this.raws = {};
  12738. }
  12739. var originalValue = this[name];
  12740. var originalEscaped = this.raws[name];
  12741. this[name] = originalValue + value; // this may trigger a setter that updates raws, so it has to be set first.
  12742. if (originalEscaped || valueEscaped !== value) {
  12743. this.raws[name] = (originalEscaped || originalValue) + valueEscaped;
  12744. } else {
  12745. delete this.raws[name]; // delete any escaped value that was created by the setter.
  12746. }
  12747. }
  12748. /**
  12749. * Some non-standard syntax doesn't follow normal escaping rules for css.
  12750. * This allows the escaped value to be specified directly, allowing illegal
  12751. * characters to be directly inserted into css output.
  12752. * @param {string} name the property to set
  12753. * @param {any} value the unescaped value of the property
  12754. * @param {string} valueEscaped the escaped value of the property.
  12755. */
  12756. ;
  12757. _proto.setPropertyAndEscape = function setPropertyAndEscape(name, value, valueEscaped) {
  12758. if (!this.raws) {
  12759. this.raws = {};
  12760. }
  12761. this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
  12762. this.raws[name] = valueEscaped;
  12763. }
  12764. /**
  12765. * When you want a value to passed through to CSS directly. This method
  12766. * deletes the corresponding raw value causing the stringifier to fallback
  12767. * to the unescaped value.
  12768. * @param {string} name the property to set.
  12769. * @param {any} value The value that is both escaped and unescaped.
  12770. */
  12771. ;
  12772. _proto.setPropertyWithoutEscape = function setPropertyWithoutEscape(name, value) {
  12773. this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
  12774. if (this.raws) {
  12775. delete this.raws[name];
  12776. }
  12777. }
  12778. /**
  12779. *
  12780. * @param {number} line The number (starting with 1)
  12781. * @param {number} column The column number (starting with 1)
  12782. */
  12783. ;
  12784. _proto.isAtPosition = function isAtPosition(line, column) {
  12785. if (this.source && this.source.start && this.source.end) {
  12786. if (this.source.start.line > line) {
  12787. return false;
  12788. }
  12789. if (this.source.end.line < line) {
  12790. return false;
  12791. }
  12792. if (this.source.start.line === line && this.source.start.column > column) {
  12793. return false;
  12794. }
  12795. if (this.source.end.line === line && this.source.end.column < column) {
  12796. return false;
  12797. }
  12798. return true;
  12799. }
  12800. return undefined;
  12801. };
  12802. _proto.stringifyProperty = function stringifyProperty(name) {
  12803. return this.raws && this.raws[name] || this[name];
  12804. };
  12805. _proto.valueToString = function valueToString() {
  12806. return String(this.stringifyProperty("value"));
  12807. };
  12808. _proto.toString = function toString() {
  12809. return [this.rawSpaceBefore, this.valueToString(), this.rawSpaceAfter].join('');
  12810. };
  12811. _createClass(Node, [{
  12812. key: "rawSpaceBefore",
  12813. get: function get() {
  12814. var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.before;
  12815. if (rawSpace === undefined) {
  12816. rawSpace = this.spaces && this.spaces.before;
  12817. }
  12818. return rawSpace || "";
  12819. },
  12820. set: function set(raw) {
  12821. (0, _util.ensureObject)(this, "raws", "spaces");
  12822. this.raws.spaces.before = raw;
  12823. }
  12824. }, {
  12825. key: "rawSpaceAfter",
  12826. get: function get() {
  12827. var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.after;
  12828. if (rawSpace === undefined) {
  12829. rawSpace = this.spaces.after;
  12830. }
  12831. return rawSpace || "";
  12832. },
  12833. set: function set(raw) {
  12834. (0, _util.ensureObject)(this, "raws", "spaces");
  12835. this.raws.spaces.after = raw;
  12836. }
  12837. }]);
  12838. return Node;
  12839. }();
  12840. exports["default"] = Node;
  12841. module.exports = exports.default;
  12842. } (node$1, node$1.exports));
  12843. var types = {};
  12844. types.__esModule = true;
  12845. types.UNIVERSAL = types.ATTRIBUTE = types.CLASS = types.COMBINATOR = types.COMMENT = types.ID = types.NESTING = types.PSEUDO = types.ROOT = types.SELECTOR = types.STRING = types.TAG = void 0;
  12846. var TAG = 'tag';
  12847. types.TAG = TAG;
  12848. var STRING = 'string';
  12849. types.STRING = STRING;
  12850. var SELECTOR = 'selector';
  12851. types.SELECTOR = SELECTOR;
  12852. var ROOT = 'root';
  12853. types.ROOT = ROOT;
  12854. var PSEUDO = 'pseudo';
  12855. types.PSEUDO = PSEUDO;
  12856. var NESTING = 'nesting';
  12857. types.NESTING = NESTING;
  12858. var ID = 'id';
  12859. types.ID = ID;
  12860. var COMMENT = 'comment';
  12861. types.COMMENT = COMMENT;
  12862. var COMBINATOR = 'combinator';
  12863. types.COMBINATOR = COMBINATOR;
  12864. var CLASS = 'class';
  12865. types.CLASS = CLASS;
  12866. var ATTRIBUTE = 'attribute';
  12867. types.ATTRIBUTE = ATTRIBUTE;
  12868. var UNIVERSAL = 'universal';
  12869. types.UNIVERSAL = UNIVERSAL;
  12870. (function (module, exports) {
  12871. exports.__esModule = true;
  12872. exports["default"] = void 0;
  12873. var _node = _interopRequireDefault(node$1.exports);
  12874. var types$1 = _interopRequireWildcard(types);
  12875. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
  12876. 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; }
  12877. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  12878. 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); }
  12879. 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); }
  12880. 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; }
  12881. 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); } }
  12882. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  12883. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  12884. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  12885. var Container = /*#__PURE__*/function (_Node) {
  12886. _inheritsLoose(Container, _Node);
  12887. function Container(opts) {
  12888. var _this;
  12889. _this = _Node.call(this, opts) || this;
  12890. if (!_this.nodes) {
  12891. _this.nodes = [];
  12892. }
  12893. return _this;
  12894. }
  12895. var _proto = Container.prototype;
  12896. _proto.append = function append(selector) {
  12897. selector.parent = this;
  12898. this.nodes.push(selector);
  12899. return this;
  12900. };
  12901. _proto.prepend = function prepend(selector) {
  12902. selector.parent = this;
  12903. this.nodes.unshift(selector);
  12904. return this;
  12905. };
  12906. _proto.at = function at(index) {
  12907. return this.nodes[index];
  12908. };
  12909. _proto.index = function index(child) {
  12910. if (typeof child === 'number') {
  12911. return child;
  12912. }
  12913. return this.nodes.indexOf(child);
  12914. };
  12915. _proto.removeChild = function removeChild(child) {
  12916. child = this.index(child);
  12917. this.at(child).parent = undefined;
  12918. this.nodes.splice(child, 1);
  12919. var index;
  12920. for (var id in this.indexes) {
  12921. index = this.indexes[id];
  12922. if (index >= child) {
  12923. this.indexes[id] = index - 1;
  12924. }
  12925. }
  12926. return this;
  12927. };
  12928. _proto.removeAll = function removeAll() {
  12929. for (var _iterator = _createForOfIteratorHelperLoose(this.nodes), _step; !(_step = _iterator()).done;) {
  12930. var node = _step.value;
  12931. node.parent = undefined;
  12932. }
  12933. this.nodes = [];
  12934. return this;
  12935. };
  12936. _proto.empty = function empty() {
  12937. return this.removeAll();
  12938. };
  12939. _proto.insertAfter = function insertAfter(oldNode, newNode) {
  12940. newNode.parent = this;
  12941. var oldIndex = this.index(oldNode);
  12942. this.nodes.splice(oldIndex + 1, 0, newNode);
  12943. newNode.parent = this;
  12944. var index;
  12945. for (var id in this.indexes) {
  12946. index = this.indexes[id];
  12947. if (oldIndex <= index) {
  12948. this.indexes[id] = index + 1;
  12949. }
  12950. }
  12951. return this;
  12952. };
  12953. _proto.insertBefore = function insertBefore(oldNode, newNode) {
  12954. newNode.parent = this;
  12955. var oldIndex = this.index(oldNode);
  12956. this.nodes.splice(oldIndex, 0, newNode);
  12957. newNode.parent = this;
  12958. var index;
  12959. for (var id in this.indexes) {
  12960. index = this.indexes[id];
  12961. if (index <= oldIndex) {
  12962. this.indexes[id] = index + 1;
  12963. }
  12964. }
  12965. return this;
  12966. };
  12967. _proto._findChildAtPosition = function _findChildAtPosition(line, col) {
  12968. var found = undefined;
  12969. this.each(function (node) {
  12970. if (node.atPosition) {
  12971. var foundChild = node.atPosition(line, col);
  12972. if (foundChild) {
  12973. found = foundChild;
  12974. return false;
  12975. }
  12976. } else if (node.isAtPosition(line, col)) {
  12977. found = node;
  12978. return false;
  12979. }
  12980. });
  12981. return found;
  12982. }
  12983. /**
  12984. * Return the most specific node at the line and column number given.
  12985. * The source location is based on the original parsed location, locations aren't
  12986. * updated as selector nodes are mutated.
  12987. *
  12988. * Note that this location is relative to the location of the first character
  12989. * of the selector, and not the location of the selector in the overall document
  12990. * when used in conjunction with postcss.
  12991. *
  12992. * If not found, returns undefined.
  12993. * @param {number} line The line number of the node to find. (1-based index)
  12994. * @param {number} col The column number of the node to find. (1-based index)
  12995. */
  12996. ;
  12997. _proto.atPosition = function atPosition(line, col) {
  12998. if (this.isAtPosition(line, col)) {
  12999. return this._findChildAtPosition(line, col) || this;
  13000. } else {
  13001. return undefined;
  13002. }
  13003. };
  13004. _proto._inferEndPosition = function _inferEndPosition() {
  13005. if (this.last && this.last.source && this.last.source.end) {
  13006. this.source = this.source || {};
  13007. this.source.end = this.source.end || {};
  13008. Object.assign(this.source.end, this.last.source.end);
  13009. }
  13010. };
  13011. _proto.each = function each(callback) {
  13012. if (!this.lastEach) {
  13013. this.lastEach = 0;
  13014. }
  13015. if (!this.indexes) {
  13016. this.indexes = {};
  13017. }
  13018. this.lastEach++;
  13019. var id = this.lastEach;
  13020. this.indexes[id] = 0;
  13021. if (!this.length) {
  13022. return undefined;
  13023. }
  13024. var index, result;
  13025. while (this.indexes[id] < this.length) {
  13026. index = this.indexes[id];
  13027. result = callback(this.at(index), index);
  13028. if (result === false) {
  13029. break;
  13030. }
  13031. this.indexes[id] += 1;
  13032. }
  13033. delete this.indexes[id];
  13034. if (result === false) {
  13035. return false;
  13036. }
  13037. };
  13038. _proto.walk = function walk(callback) {
  13039. return this.each(function (node, i) {
  13040. var result = callback(node, i);
  13041. if (result !== false && node.length) {
  13042. result = node.walk(callback);
  13043. }
  13044. if (result === false) {
  13045. return false;
  13046. }
  13047. });
  13048. };
  13049. _proto.walkAttributes = function walkAttributes(callback) {
  13050. var _this2 = this;
  13051. return this.walk(function (selector) {
  13052. if (selector.type === types$1.ATTRIBUTE) {
  13053. return callback.call(_this2, selector);
  13054. }
  13055. });
  13056. };
  13057. _proto.walkClasses = function walkClasses(callback) {
  13058. var _this3 = this;
  13059. return this.walk(function (selector) {
  13060. if (selector.type === types$1.CLASS) {
  13061. return callback.call(_this3, selector);
  13062. }
  13063. });
  13064. };
  13065. _proto.walkCombinators = function walkCombinators(callback) {
  13066. var _this4 = this;
  13067. return this.walk(function (selector) {
  13068. if (selector.type === types$1.COMBINATOR) {
  13069. return callback.call(_this4, selector);
  13070. }
  13071. });
  13072. };
  13073. _proto.walkComments = function walkComments(callback) {
  13074. var _this5 = this;
  13075. return this.walk(function (selector) {
  13076. if (selector.type === types$1.COMMENT) {
  13077. return callback.call(_this5, selector);
  13078. }
  13079. });
  13080. };
  13081. _proto.walkIds = function walkIds(callback) {
  13082. var _this6 = this;
  13083. return this.walk(function (selector) {
  13084. if (selector.type === types$1.ID) {
  13085. return callback.call(_this6, selector);
  13086. }
  13087. });
  13088. };
  13089. _proto.walkNesting = function walkNesting(callback) {
  13090. var _this7 = this;
  13091. return this.walk(function (selector) {
  13092. if (selector.type === types$1.NESTING) {
  13093. return callback.call(_this7, selector);
  13094. }
  13095. });
  13096. };
  13097. _proto.walkPseudos = function walkPseudos(callback) {
  13098. var _this8 = this;
  13099. return this.walk(function (selector) {
  13100. if (selector.type === types$1.PSEUDO) {
  13101. return callback.call(_this8, selector);
  13102. }
  13103. });
  13104. };
  13105. _proto.walkTags = function walkTags(callback) {
  13106. var _this9 = this;
  13107. return this.walk(function (selector) {
  13108. if (selector.type === types$1.TAG) {
  13109. return callback.call(_this9, selector);
  13110. }
  13111. });
  13112. };
  13113. _proto.walkUniversals = function walkUniversals(callback) {
  13114. var _this10 = this;
  13115. return this.walk(function (selector) {
  13116. if (selector.type === types$1.UNIVERSAL) {
  13117. return callback.call(_this10, selector);
  13118. }
  13119. });
  13120. };
  13121. _proto.split = function split(callback) {
  13122. var _this11 = this;
  13123. var current = [];
  13124. return this.reduce(function (memo, node, index) {
  13125. var split = callback.call(_this11, node);
  13126. current.push(node);
  13127. if (split) {
  13128. memo.push(current);
  13129. current = [];
  13130. } else if (index === _this11.length - 1) {
  13131. memo.push(current);
  13132. }
  13133. return memo;
  13134. }, []);
  13135. };
  13136. _proto.map = function map(callback) {
  13137. return this.nodes.map(callback);
  13138. };
  13139. _proto.reduce = function reduce(callback, memo) {
  13140. return this.nodes.reduce(callback, memo);
  13141. };
  13142. _proto.every = function every(callback) {
  13143. return this.nodes.every(callback);
  13144. };
  13145. _proto.some = function some(callback) {
  13146. return this.nodes.some(callback);
  13147. };
  13148. _proto.filter = function filter(callback) {
  13149. return this.nodes.filter(callback);
  13150. };
  13151. _proto.sort = function sort(callback) {
  13152. return this.nodes.sort(callback);
  13153. };
  13154. _proto.toString = function toString() {
  13155. return this.map(String).join('');
  13156. };
  13157. _createClass(Container, [{
  13158. key: "first",
  13159. get: function get() {
  13160. return this.at(0);
  13161. }
  13162. }, {
  13163. key: "last",
  13164. get: function get() {
  13165. return this.at(this.length - 1);
  13166. }
  13167. }, {
  13168. key: "length",
  13169. get: function get() {
  13170. return this.nodes.length;
  13171. }
  13172. }]);
  13173. return Container;
  13174. }(_node["default"]);
  13175. exports["default"] = Container;
  13176. module.exports = exports.default;
  13177. } (container, container.exports));
  13178. (function (module, exports) {
  13179. exports.__esModule = true;
  13180. exports["default"] = void 0;
  13181. var _container = _interopRequireDefault(container.exports);
  13182. var _types = types;
  13183. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  13184. 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); } }
  13185. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  13186. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  13187. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  13188. var Root = /*#__PURE__*/function (_Container) {
  13189. _inheritsLoose(Root, _Container);
  13190. function Root(opts) {
  13191. var _this;
  13192. _this = _Container.call(this, opts) || this;
  13193. _this.type = _types.ROOT;
  13194. return _this;
  13195. }
  13196. var _proto = Root.prototype;
  13197. _proto.toString = function toString() {
  13198. var str = this.reduce(function (memo, selector) {
  13199. memo.push(String(selector));
  13200. return memo;
  13201. }, []).join(',');
  13202. return this.trailingComma ? str + ',' : str;
  13203. };
  13204. _proto.error = function error(message, options) {
  13205. if (this._error) {
  13206. return this._error(message, options);
  13207. } else {
  13208. return new Error(message);
  13209. }
  13210. };
  13211. _createClass(Root, [{
  13212. key: "errorGenerator",
  13213. set: function set(handler) {
  13214. this._error = handler;
  13215. }
  13216. }]);
  13217. return Root;
  13218. }(_container["default"]);
  13219. exports["default"] = Root;
  13220. module.exports = exports.default;
  13221. } (root$1, root$1.exports));
  13222. var selector$1 = {exports: {}};
  13223. (function (module, exports) {
  13224. exports.__esModule = true;
  13225. exports["default"] = void 0;
  13226. var _container = _interopRequireDefault(container.exports);
  13227. var _types = types;
  13228. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  13229. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  13230. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  13231. var Selector = /*#__PURE__*/function (_Container) {
  13232. _inheritsLoose(Selector, _Container);
  13233. function Selector(opts) {
  13234. var _this;
  13235. _this = _Container.call(this, opts) || this;
  13236. _this.type = _types.SELECTOR;
  13237. return _this;
  13238. }
  13239. return Selector;
  13240. }(_container["default"]);
  13241. exports["default"] = Selector;
  13242. module.exports = exports.default;
  13243. } (selector$1, selector$1.exports));
  13244. var className$1 = {exports: {}};
  13245. /*! https://mths.be/cssesc v3.0.0 by @mathias */
  13246. var object = {};
  13247. var hasOwnProperty = object.hasOwnProperty;
  13248. var merge$1 = function merge(options, defaults) {
  13249. if (!options) {
  13250. return defaults;
  13251. }
  13252. var result = {};
  13253. for (var key in defaults) {
  13254. // `if (defaults.hasOwnProperty(key) { … }` is not needed here, since
  13255. // only recognized option names are used.
  13256. result[key] = hasOwnProperty.call(options, key) ? options[key] : defaults[key];
  13257. }
  13258. return result;
  13259. };
  13260. var regexAnySingleEscape = /[ -,\.\/:-@\[-\^`\{-~]/;
  13261. var regexSingleEscape = /[ -,\.\/:-@\[\]\^`\{-~]/;
  13262. var regexExcessiveSpaces = /(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g;
  13263. // https://mathiasbynens.be/notes/css-escapes#css
  13264. var cssesc = function cssesc(string, options) {
  13265. options = merge$1(options, cssesc.options);
  13266. if (options.quotes != 'single' && options.quotes != 'double') {
  13267. options.quotes = 'single';
  13268. }
  13269. var quote = options.quotes == 'double' ? '"' : '\'';
  13270. var isIdentifier = options.isIdentifier;
  13271. var firstChar = string.charAt(0);
  13272. var output = '';
  13273. var counter = 0;
  13274. var length = string.length;
  13275. while (counter < length) {
  13276. var character = string.charAt(counter++);
  13277. var codePoint = character.charCodeAt();
  13278. var value = void 0;
  13279. // If it’s not a printable ASCII character…
  13280. if (codePoint < 0x20 || codePoint > 0x7E) {
  13281. if (codePoint >= 0xD800 && codePoint <= 0xDBFF && counter < length) {
  13282. // It’s a high surrogate, and there is a next character.
  13283. var extra = string.charCodeAt(counter++);
  13284. if ((extra & 0xFC00) == 0xDC00) {
  13285. // next character is low surrogate
  13286. codePoint = ((codePoint & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000;
  13287. } else {
  13288. // It’s an unmatched surrogate; only append this code unit, in case
  13289. // the next code unit is the high surrogate of a surrogate pair.
  13290. counter--;
  13291. }
  13292. }
  13293. value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
  13294. } else {
  13295. if (options.escapeEverything) {
  13296. if (regexAnySingleEscape.test(character)) {
  13297. value = '\\' + character;
  13298. } else {
  13299. value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
  13300. }
  13301. } else if (/[\t\n\f\r\x0B]/.test(character)) {
  13302. value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
  13303. } else if (character == '\\' || !isIdentifier && (character == '"' && quote == character || character == '\'' && quote == character) || isIdentifier && regexSingleEscape.test(character)) {
  13304. value = '\\' + character;
  13305. } else {
  13306. value = character;
  13307. }
  13308. }
  13309. output += value;
  13310. }
  13311. if (isIdentifier) {
  13312. if (/^-[-\d]/.test(output)) {
  13313. output = '\\-' + output.slice(1);
  13314. } else if (/\d/.test(firstChar)) {
  13315. output = '\\3' + firstChar + ' ' + output.slice(1);
  13316. }
  13317. }
  13318. // Remove spaces after `\HEX` escapes that are not followed by a hex digit,
  13319. // since they’re redundant. Note that this is only possible if the escape
  13320. // sequence isn’t preceded by an odd number of backslashes.
  13321. output = output.replace(regexExcessiveSpaces, function ($0, $1, $2) {
  13322. if ($1 && $1.length % 2) {
  13323. // It’s not safe to remove the space, so don’t.
  13324. return $0;
  13325. }
  13326. // Strip the space.
  13327. return ($1 || '') + $2;
  13328. });
  13329. if (!isIdentifier && options.wrap) {
  13330. return quote + output + quote;
  13331. }
  13332. return output;
  13333. };
  13334. // Expose default options (so they can be overridden globally).
  13335. cssesc.options = {
  13336. 'escapeEverything': false,
  13337. 'isIdentifier': false,
  13338. 'quotes': 'single',
  13339. 'wrap': false
  13340. };
  13341. cssesc.version = '3.0.0';
  13342. var cssesc_1 = cssesc;
  13343. (function (module, exports) {
  13344. exports.__esModule = true;
  13345. exports["default"] = void 0;
  13346. var _cssesc = _interopRequireDefault(cssesc_1);
  13347. var _util = util;
  13348. var _node = _interopRequireDefault(node$1.exports);
  13349. var _types = types;
  13350. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  13351. 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); } }
  13352. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  13353. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  13354. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  13355. var ClassName = /*#__PURE__*/function (_Node) {
  13356. _inheritsLoose(ClassName, _Node);
  13357. function ClassName(opts) {
  13358. var _this;
  13359. _this = _Node.call(this, opts) || this;
  13360. _this.type = _types.CLASS;
  13361. _this._constructed = true;
  13362. return _this;
  13363. }
  13364. var _proto = ClassName.prototype;
  13365. _proto.valueToString = function valueToString() {
  13366. return '.' + _Node.prototype.valueToString.call(this);
  13367. };
  13368. _createClass(ClassName, [{
  13369. key: "value",
  13370. get: function get() {
  13371. return this._value;
  13372. },
  13373. set: function set(v) {
  13374. if (this._constructed) {
  13375. var escaped = (0, _cssesc["default"])(v, {
  13376. isIdentifier: true
  13377. });
  13378. if (escaped !== v) {
  13379. (0, _util.ensureObject)(this, "raws");
  13380. this.raws.value = escaped;
  13381. } else if (this.raws) {
  13382. delete this.raws.value;
  13383. }
  13384. }
  13385. this._value = v;
  13386. }
  13387. }]);
  13388. return ClassName;
  13389. }(_node["default"]);
  13390. exports["default"] = ClassName;
  13391. module.exports = exports.default;
  13392. } (className$1, className$1.exports));
  13393. var comment$2 = {exports: {}};
  13394. (function (module, exports) {
  13395. exports.__esModule = true;
  13396. exports["default"] = void 0;
  13397. var _node = _interopRequireDefault(node$1.exports);
  13398. var _types = types;
  13399. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  13400. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  13401. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  13402. var Comment = /*#__PURE__*/function (_Node) {
  13403. _inheritsLoose(Comment, _Node);
  13404. function Comment(opts) {
  13405. var _this;
  13406. _this = _Node.call(this, opts) || this;
  13407. _this.type = _types.COMMENT;
  13408. return _this;
  13409. }
  13410. return Comment;
  13411. }(_node["default"]);
  13412. exports["default"] = Comment;
  13413. module.exports = exports.default;
  13414. } (comment$2, comment$2.exports));
  13415. var id$1 = {exports: {}};
  13416. (function (module, exports) {
  13417. exports.__esModule = true;
  13418. exports["default"] = void 0;
  13419. var _node = _interopRequireDefault(node$1.exports);
  13420. var _types = types;
  13421. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  13422. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  13423. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  13424. var ID = /*#__PURE__*/function (_Node) {
  13425. _inheritsLoose(ID, _Node);
  13426. function ID(opts) {
  13427. var _this;
  13428. _this = _Node.call(this, opts) || this;
  13429. _this.type = _types.ID;
  13430. return _this;
  13431. }
  13432. var _proto = ID.prototype;
  13433. _proto.valueToString = function valueToString() {
  13434. return '#' + _Node.prototype.valueToString.call(this);
  13435. };
  13436. return ID;
  13437. }(_node["default"]);
  13438. exports["default"] = ID;
  13439. module.exports = exports.default;
  13440. } (id$1, id$1.exports));
  13441. var tag$1 = {exports: {}};
  13442. var namespace = {exports: {}};
  13443. (function (module, exports) {
  13444. exports.__esModule = true;
  13445. exports["default"] = void 0;
  13446. var _cssesc = _interopRequireDefault(cssesc_1);
  13447. var _util = util;
  13448. var _node = _interopRequireDefault(node$1.exports);
  13449. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  13450. 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); } }
  13451. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  13452. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  13453. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  13454. var Namespace = /*#__PURE__*/function (_Node) {
  13455. _inheritsLoose(Namespace, _Node);
  13456. function Namespace() {
  13457. return _Node.apply(this, arguments) || this;
  13458. }
  13459. var _proto = Namespace.prototype;
  13460. _proto.qualifiedName = function qualifiedName(value) {
  13461. if (this.namespace) {
  13462. return this.namespaceString + "|" + value;
  13463. } else {
  13464. return value;
  13465. }
  13466. };
  13467. _proto.valueToString = function valueToString() {
  13468. return this.qualifiedName(_Node.prototype.valueToString.call(this));
  13469. };
  13470. _createClass(Namespace, [{
  13471. key: "namespace",
  13472. get: function get() {
  13473. return this._namespace;
  13474. },
  13475. set: function set(namespace) {
  13476. if (namespace === true || namespace === "*" || namespace === "&") {
  13477. this._namespace = namespace;
  13478. if (this.raws) {
  13479. delete this.raws.namespace;
  13480. }
  13481. return;
  13482. }
  13483. var escaped = (0, _cssesc["default"])(namespace, {
  13484. isIdentifier: true
  13485. });
  13486. this._namespace = namespace;
  13487. if (escaped !== namespace) {
  13488. (0, _util.ensureObject)(this, "raws");
  13489. this.raws.namespace = escaped;
  13490. } else if (this.raws) {
  13491. delete this.raws.namespace;
  13492. }
  13493. }
  13494. }, {
  13495. key: "ns",
  13496. get: function get() {
  13497. return this._namespace;
  13498. },
  13499. set: function set(namespace) {
  13500. this.namespace = namespace;
  13501. }
  13502. }, {
  13503. key: "namespaceString",
  13504. get: function get() {
  13505. if (this.namespace) {
  13506. var ns = this.stringifyProperty("namespace");
  13507. if (ns === true) {
  13508. return '';
  13509. } else {
  13510. return ns;
  13511. }
  13512. } else {
  13513. return '';
  13514. }
  13515. }
  13516. }]);
  13517. return Namespace;
  13518. }(_node["default"]);
  13519. exports["default"] = Namespace;
  13520. module.exports = exports.default;
  13521. } (namespace, namespace.exports));
  13522. (function (module, exports) {
  13523. exports.__esModule = true;
  13524. exports["default"] = void 0;
  13525. var _namespace = _interopRequireDefault(namespace.exports);
  13526. var _types = types;
  13527. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  13528. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  13529. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  13530. var Tag = /*#__PURE__*/function (_Namespace) {
  13531. _inheritsLoose(Tag, _Namespace);
  13532. function Tag(opts) {
  13533. var _this;
  13534. _this = _Namespace.call(this, opts) || this;
  13535. _this.type = _types.TAG;
  13536. return _this;
  13537. }
  13538. return Tag;
  13539. }(_namespace["default"]);
  13540. exports["default"] = Tag;
  13541. module.exports = exports.default;
  13542. } (tag$1, tag$1.exports));
  13543. var string$1 = {exports: {}};
  13544. (function (module, exports) {
  13545. exports.__esModule = true;
  13546. exports["default"] = void 0;
  13547. var _node = _interopRequireDefault(node$1.exports);
  13548. var _types = types;
  13549. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  13550. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  13551. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  13552. var String = /*#__PURE__*/function (_Node) {
  13553. _inheritsLoose(String, _Node);
  13554. function String(opts) {
  13555. var _this;
  13556. _this = _Node.call(this, opts) || this;
  13557. _this.type = _types.STRING;
  13558. return _this;
  13559. }
  13560. return String;
  13561. }(_node["default"]);
  13562. exports["default"] = String;
  13563. module.exports = exports.default;
  13564. } (string$1, string$1.exports));
  13565. var pseudo$1 = {exports: {}};
  13566. (function (module, exports) {
  13567. exports.__esModule = true;
  13568. exports["default"] = void 0;
  13569. var _container = _interopRequireDefault(container.exports);
  13570. var _types = types;
  13571. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  13572. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  13573. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  13574. var Pseudo = /*#__PURE__*/function (_Container) {
  13575. _inheritsLoose(Pseudo, _Container);
  13576. function Pseudo(opts) {
  13577. var _this;
  13578. _this = _Container.call(this, opts) || this;
  13579. _this.type = _types.PSEUDO;
  13580. return _this;
  13581. }
  13582. var _proto = Pseudo.prototype;
  13583. _proto.toString = function toString() {
  13584. var params = this.length ? '(' + this.map(String).join(',') + ')' : '';
  13585. return [this.rawSpaceBefore, this.stringifyProperty("value"), params, this.rawSpaceAfter].join('');
  13586. };
  13587. return Pseudo;
  13588. }(_container["default"]);
  13589. exports["default"] = Pseudo;
  13590. module.exports = exports.default;
  13591. } (pseudo$1, pseudo$1.exports));
  13592. var attribute$1 = {};
  13593. /**
  13594. * For Node.js, simply re-export the core `util.deprecate` function.
  13595. */
  13596. var node = require$$2__default["default"].deprecate;
  13597. (function (exports) {
  13598. exports.__esModule = true;
  13599. exports.unescapeValue = unescapeValue;
  13600. exports["default"] = void 0;
  13601. var _cssesc = _interopRequireDefault(cssesc_1);
  13602. var _unesc = _interopRequireDefault(unesc.exports);
  13603. var _namespace = _interopRequireDefault(namespace.exports);
  13604. var _types = types;
  13605. var _CSSESC_QUOTE_OPTIONS;
  13606. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  13607. 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); } }
  13608. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  13609. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  13610. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  13611. var deprecate = node;
  13612. var WRAPPED_IN_QUOTES = /^('|")([^]*)\1$/;
  13613. var warnOfDeprecatedValueAssignment = deprecate(function () {}, "Assigning an attribute a value containing characters that might need to be escaped is deprecated. " + "Call attribute.setValue() instead.");
  13614. var warnOfDeprecatedQuotedAssignment = deprecate(function () {}, "Assigning attr.quoted is deprecated and has no effect. Assign to attr.quoteMark instead.");
  13615. var warnOfDeprecatedConstructor = deprecate(function () {}, "Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now.");
  13616. function unescapeValue(value) {
  13617. var deprecatedUsage = false;
  13618. var quoteMark = null;
  13619. var unescaped = value;
  13620. var m = unescaped.match(WRAPPED_IN_QUOTES);
  13621. if (m) {
  13622. quoteMark = m[1];
  13623. unescaped = m[2];
  13624. }
  13625. unescaped = (0, _unesc["default"])(unescaped);
  13626. if (unescaped !== value) {
  13627. deprecatedUsage = true;
  13628. }
  13629. return {
  13630. deprecatedUsage: deprecatedUsage,
  13631. unescaped: unescaped,
  13632. quoteMark: quoteMark
  13633. };
  13634. }
  13635. function handleDeprecatedContructorOpts(opts) {
  13636. if (opts.quoteMark !== undefined) {
  13637. return opts;
  13638. }
  13639. if (opts.value === undefined) {
  13640. return opts;
  13641. }
  13642. warnOfDeprecatedConstructor();
  13643. var _unescapeValue = unescapeValue(opts.value),
  13644. quoteMark = _unescapeValue.quoteMark,
  13645. unescaped = _unescapeValue.unescaped;
  13646. if (!opts.raws) {
  13647. opts.raws = {};
  13648. }
  13649. if (opts.raws.value === undefined) {
  13650. opts.raws.value = opts.value;
  13651. }
  13652. opts.value = unescaped;
  13653. opts.quoteMark = quoteMark;
  13654. return opts;
  13655. }
  13656. var Attribute = /*#__PURE__*/function (_Namespace) {
  13657. _inheritsLoose(Attribute, _Namespace);
  13658. function Attribute(opts) {
  13659. var _this;
  13660. if (opts === void 0) {
  13661. opts = {};
  13662. }
  13663. _this = _Namespace.call(this, handleDeprecatedContructorOpts(opts)) || this;
  13664. _this.type = _types.ATTRIBUTE;
  13665. _this.raws = _this.raws || {};
  13666. Object.defineProperty(_this.raws, 'unquoted', {
  13667. get: deprecate(function () {
  13668. return _this.value;
  13669. }, "attr.raws.unquoted is deprecated. Call attr.value instead."),
  13670. set: deprecate(function () {
  13671. return _this.value;
  13672. }, "Setting attr.raws.unquoted is deprecated and has no effect. attr.value is unescaped by default now.")
  13673. });
  13674. _this._constructed = true;
  13675. return _this;
  13676. }
  13677. /**
  13678. * Returns the Attribute's value quoted such that it would be legal to use
  13679. * in the value of a css file. The original value's quotation setting
  13680. * used for stringification is left unchanged. See `setValue(value, options)`
  13681. * if you want to control the quote settings of a new value for the attribute.
  13682. *
  13683. * You can also change the quotation used for the current value by setting quoteMark.
  13684. *
  13685. * Options:
  13686. * * quoteMark {'"' | "'" | null} - Use this value to quote the value. If this
  13687. * option is not set, the original value for quoteMark will be used. If
  13688. * indeterminate, a double quote is used. The legal values are:
  13689. * * `null` - the value will be unquoted and characters will be escaped as necessary.
  13690. * * `'` - the value will be quoted with a single quote and single quotes are escaped.
  13691. * * `"` - the value will be quoted with a double quote and double quotes are escaped.
  13692. * * preferCurrentQuoteMark {boolean} - if true, prefer the source quote mark
  13693. * over the quoteMark option value.
  13694. * * smart {boolean} - if true, will select a quote mark based on the value
  13695. * and the other options specified here. See the `smartQuoteMark()`
  13696. * method.
  13697. **/
  13698. var _proto = Attribute.prototype;
  13699. _proto.getQuotedValue = function getQuotedValue(options) {
  13700. if (options === void 0) {
  13701. options = {};
  13702. }
  13703. var quoteMark = this._determineQuoteMark(options);
  13704. var cssescopts = CSSESC_QUOTE_OPTIONS[quoteMark];
  13705. var escaped = (0, _cssesc["default"])(this._value, cssescopts);
  13706. return escaped;
  13707. };
  13708. _proto._determineQuoteMark = function _determineQuoteMark(options) {
  13709. return options.smart ? this.smartQuoteMark(options) : this.preferredQuoteMark(options);
  13710. }
  13711. /**
  13712. * Set the unescaped value with the specified quotation options. The value
  13713. * provided must not include any wrapping quote marks -- those quotes will
  13714. * be interpreted as part of the value and escaped accordingly.
  13715. */
  13716. ;
  13717. _proto.setValue = function setValue(value, options) {
  13718. if (options === void 0) {
  13719. options = {};
  13720. }
  13721. this._value = value;
  13722. this._quoteMark = this._determineQuoteMark(options);
  13723. this._syncRawValue();
  13724. }
  13725. /**
  13726. * Intelligently select a quoteMark value based on the value's contents. If
  13727. * the value is a legal CSS ident, it will not be quoted. Otherwise a quote
  13728. * mark will be picked that minimizes the number of escapes.
  13729. *
  13730. * If there's no clear winner, the quote mark from these options is used,
  13731. * then the source quote mark (this is inverted if `preferCurrentQuoteMark` is
  13732. * true). If the quoteMark is unspecified, a double quote is used.
  13733. *
  13734. * @param options This takes the quoteMark and preferCurrentQuoteMark options
  13735. * from the quoteValue method.
  13736. */
  13737. ;
  13738. _proto.smartQuoteMark = function smartQuoteMark(options) {
  13739. var v = this.value;
  13740. var numSingleQuotes = v.replace(/[^']/g, '').length;
  13741. var numDoubleQuotes = v.replace(/[^"]/g, '').length;
  13742. if (numSingleQuotes + numDoubleQuotes === 0) {
  13743. var escaped = (0, _cssesc["default"])(v, {
  13744. isIdentifier: true
  13745. });
  13746. if (escaped === v) {
  13747. return Attribute.NO_QUOTE;
  13748. } else {
  13749. var pref = this.preferredQuoteMark(options);
  13750. if (pref === Attribute.NO_QUOTE) {
  13751. // pick a quote mark that isn't none and see if it's smaller
  13752. var quote = this.quoteMark || options.quoteMark || Attribute.DOUBLE_QUOTE;
  13753. var opts = CSSESC_QUOTE_OPTIONS[quote];
  13754. var quoteValue = (0, _cssesc["default"])(v, opts);
  13755. if (quoteValue.length < escaped.length) {
  13756. return quote;
  13757. }
  13758. }
  13759. return pref;
  13760. }
  13761. } else if (numDoubleQuotes === numSingleQuotes) {
  13762. return this.preferredQuoteMark(options);
  13763. } else if (numDoubleQuotes < numSingleQuotes) {
  13764. return Attribute.DOUBLE_QUOTE;
  13765. } else {
  13766. return Attribute.SINGLE_QUOTE;
  13767. }
  13768. }
  13769. /**
  13770. * Selects the preferred quote mark based on the options and the current quote mark value.
  13771. * If you want the quote mark to depend on the attribute value, call `smartQuoteMark(opts)`
  13772. * instead.
  13773. */
  13774. ;
  13775. _proto.preferredQuoteMark = function preferredQuoteMark(options) {
  13776. var quoteMark = options.preferCurrentQuoteMark ? this.quoteMark : options.quoteMark;
  13777. if (quoteMark === undefined) {
  13778. quoteMark = options.preferCurrentQuoteMark ? options.quoteMark : this.quoteMark;
  13779. }
  13780. if (quoteMark === undefined) {
  13781. quoteMark = Attribute.DOUBLE_QUOTE;
  13782. }
  13783. return quoteMark;
  13784. };
  13785. _proto._syncRawValue = function _syncRawValue() {
  13786. var rawValue = (0, _cssesc["default"])(this._value, CSSESC_QUOTE_OPTIONS[this.quoteMark]);
  13787. if (rawValue === this._value) {
  13788. if (this.raws) {
  13789. delete this.raws.value;
  13790. }
  13791. } else {
  13792. this.raws.value = rawValue;
  13793. }
  13794. };
  13795. _proto._handleEscapes = function _handleEscapes(prop, value) {
  13796. if (this._constructed) {
  13797. var escaped = (0, _cssesc["default"])(value, {
  13798. isIdentifier: true
  13799. });
  13800. if (escaped !== value) {
  13801. this.raws[prop] = escaped;
  13802. } else {
  13803. delete this.raws[prop];
  13804. }
  13805. }
  13806. };
  13807. _proto._spacesFor = function _spacesFor(name) {
  13808. var attrSpaces = {
  13809. before: '',
  13810. after: ''
  13811. };
  13812. var spaces = this.spaces[name] || {};
  13813. var rawSpaces = this.raws.spaces && this.raws.spaces[name] || {};
  13814. return Object.assign(attrSpaces, spaces, rawSpaces);
  13815. };
  13816. _proto._stringFor = function _stringFor(name, spaceName, concat) {
  13817. if (spaceName === void 0) {
  13818. spaceName = name;
  13819. }
  13820. if (concat === void 0) {
  13821. concat = defaultAttrConcat;
  13822. }
  13823. var attrSpaces = this._spacesFor(spaceName);
  13824. return concat(this.stringifyProperty(name), attrSpaces);
  13825. }
  13826. /**
  13827. * returns the offset of the attribute part specified relative to the
  13828. * start of the node of the output string.
  13829. *
  13830. * * "ns" - alias for "namespace"
  13831. * * "namespace" - the namespace if it exists.
  13832. * * "attribute" - the attribute name
  13833. * * "attributeNS" - the start of the attribute or its namespace
  13834. * * "operator" - the match operator of the attribute
  13835. * * "value" - The value (string or identifier)
  13836. * * "insensitive" - the case insensitivity flag;
  13837. * @param part One of the possible values inside an attribute.
  13838. * @returns -1 if the name is invalid or the value doesn't exist in this attribute.
  13839. */
  13840. ;
  13841. _proto.offsetOf = function offsetOf(name) {
  13842. var count = 1;
  13843. var attributeSpaces = this._spacesFor("attribute");
  13844. count += attributeSpaces.before.length;
  13845. if (name === "namespace" || name === "ns") {
  13846. return this.namespace ? count : -1;
  13847. }
  13848. if (name === "attributeNS") {
  13849. return count;
  13850. }
  13851. count += this.namespaceString.length;
  13852. if (this.namespace) {
  13853. count += 1;
  13854. }
  13855. if (name === "attribute") {
  13856. return count;
  13857. }
  13858. count += this.stringifyProperty("attribute").length;
  13859. count += attributeSpaces.after.length;
  13860. var operatorSpaces = this._spacesFor("operator");
  13861. count += operatorSpaces.before.length;
  13862. var operator = this.stringifyProperty("operator");
  13863. if (name === "operator") {
  13864. return operator ? count : -1;
  13865. }
  13866. count += operator.length;
  13867. count += operatorSpaces.after.length;
  13868. var valueSpaces = this._spacesFor("value");
  13869. count += valueSpaces.before.length;
  13870. var value = this.stringifyProperty("value");
  13871. if (name === "value") {
  13872. return value ? count : -1;
  13873. }
  13874. count += value.length;
  13875. count += valueSpaces.after.length;
  13876. var insensitiveSpaces = this._spacesFor("insensitive");
  13877. count += insensitiveSpaces.before.length;
  13878. if (name === "insensitive") {
  13879. return this.insensitive ? count : -1;
  13880. }
  13881. return -1;
  13882. };
  13883. _proto.toString = function toString() {
  13884. var _this2 = this;
  13885. var selector = [this.rawSpaceBefore, '['];
  13886. selector.push(this._stringFor('qualifiedAttribute', 'attribute'));
  13887. if (this.operator && (this.value || this.value === '')) {
  13888. selector.push(this._stringFor('operator'));
  13889. selector.push(this._stringFor('value'));
  13890. selector.push(this._stringFor('insensitiveFlag', 'insensitive', function (attrValue, attrSpaces) {
  13891. if (attrValue.length > 0 && !_this2.quoted && attrSpaces.before.length === 0 && !(_this2.spaces.value && _this2.spaces.value.after)) {
  13892. attrSpaces.before = " ";
  13893. }
  13894. return defaultAttrConcat(attrValue, attrSpaces);
  13895. }));
  13896. }
  13897. selector.push(']');
  13898. selector.push(this.rawSpaceAfter);
  13899. return selector.join('');
  13900. };
  13901. _createClass(Attribute, [{
  13902. key: "quoted",
  13903. get: function get() {
  13904. var qm = this.quoteMark;
  13905. return qm === "'" || qm === '"';
  13906. },
  13907. set: function set(value) {
  13908. warnOfDeprecatedQuotedAssignment();
  13909. }
  13910. /**
  13911. * returns a single (`'`) or double (`"`) quote character if the value is quoted.
  13912. * returns `null` if the value is not quoted.
  13913. * returns `undefined` if the quotation state is unknown (this can happen when
  13914. * the attribute is constructed without specifying a quote mark.)
  13915. */
  13916. }, {
  13917. key: "quoteMark",
  13918. get: function get() {
  13919. return this._quoteMark;
  13920. }
  13921. /**
  13922. * Set the quote mark to be used by this attribute's value.
  13923. * If the quote mark changes, the raw (escaped) value at `attr.raws.value` of the attribute
  13924. * value is updated accordingly.
  13925. *
  13926. * @param {"'" | '"' | null} quoteMark The quote mark or `null` if the value should be unquoted.
  13927. */
  13928. ,
  13929. set: function set(quoteMark) {
  13930. if (!this._constructed) {
  13931. this._quoteMark = quoteMark;
  13932. return;
  13933. }
  13934. if (this._quoteMark !== quoteMark) {
  13935. this._quoteMark = quoteMark;
  13936. this._syncRawValue();
  13937. }
  13938. }
  13939. }, {
  13940. key: "qualifiedAttribute",
  13941. get: function get() {
  13942. return this.qualifiedName(this.raws.attribute || this.attribute);
  13943. }
  13944. }, {
  13945. key: "insensitiveFlag",
  13946. get: function get() {
  13947. return this.insensitive ? 'i' : '';
  13948. }
  13949. }, {
  13950. key: "value",
  13951. get: function get() {
  13952. return this._value;
  13953. }
  13954. /**
  13955. * Before 3.0, the value had to be set to an escaped value including any wrapped
  13956. * quote marks. In 3.0, the semantics of `Attribute.value` changed so that the value
  13957. * is unescaped during parsing and any quote marks are removed.
  13958. *
  13959. * Because the ambiguity of this semantic change, if you set `attr.value = newValue`,
  13960. * a deprecation warning is raised when the new value contains any characters that would
  13961. * require escaping (including if it contains wrapped quotes).
  13962. *
  13963. * Instead, you should call `attr.setValue(newValue, opts)` and pass options that describe
  13964. * how the new value is quoted.
  13965. */
  13966. ,
  13967. set: function set(v) {
  13968. if (this._constructed) {
  13969. var _unescapeValue2 = unescapeValue(v),
  13970. deprecatedUsage = _unescapeValue2.deprecatedUsage,
  13971. unescaped = _unescapeValue2.unescaped,
  13972. quoteMark = _unescapeValue2.quoteMark;
  13973. if (deprecatedUsage) {
  13974. warnOfDeprecatedValueAssignment();
  13975. }
  13976. if (unescaped === this._value && quoteMark === this._quoteMark) {
  13977. return;
  13978. }
  13979. this._value = unescaped;
  13980. this._quoteMark = quoteMark;
  13981. this._syncRawValue();
  13982. } else {
  13983. this._value = v;
  13984. }
  13985. }
  13986. }, {
  13987. key: "attribute",
  13988. get: function get() {
  13989. return this._attribute;
  13990. },
  13991. set: function set(name) {
  13992. this._handleEscapes("attribute", name);
  13993. this._attribute = name;
  13994. }
  13995. }]);
  13996. return Attribute;
  13997. }(_namespace["default"]);
  13998. exports["default"] = Attribute;
  13999. Attribute.NO_QUOTE = null;
  14000. Attribute.SINGLE_QUOTE = "'";
  14001. Attribute.DOUBLE_QUOTE = '"';
  14002. var CSSESC_QUOTE_OPTIONS = (_CSSESC_QUOTE_OPTIONS = {
  14003. "'": {
  14004. quotes: 'single',
  14005. wrap: true
  14006. },
  14007. '"': {
  14008. quotes: 'double',
  14009. wrap: true
  14010. }
  14011. }, _CSSESC_QUOTE_OPTIONS[null] = {
  14012. isIdentifier: true
  14013. }, _CSSESC_QUOTE_OPTIONS);
  14014. function defaultAttrConcat(attrValue, attrSpaces) {
  14015. return "" + attrSpaces.before + attrValue + attrSpaces.after;
  14016. }
  14017. } (attribute$1));
  14018. var universal$1 = {exports: {}};
  14019. (function (module, exports) {
  14020. exports.__esModule = true;
  14021. exports["default"] = void 0;
  14022. var _namespace = _interopRequireDefault(namespace.exports);
  14023. var _types = types;
  14024. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  14025. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  14026. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  14027. var Universal = /*#__PURE__*/function (_Namespace) {
  14028. _inheritsLoose(Universal, _Namespace);
  14029. function Universal(opts) {
  14030. var _this;
  14031. _this = _Namespace.call(this, opts) || this;
  14032. _this.type = _types.UNIVERSAL;
  14033. _this.value = '*';
  14034. return _this;
  14035. }
  14036. return Universal;
  14037. }(_namespace["default"]);
  14038. exports["default"] = Universal;
  14039. module.exports = exports.default;
  14040. } (universal$1, universal$1.exports));
  14041. var combinator$2 = {exports: {}};
  14042. (function (module, exports) {
  14043. exports.__esModule = true;
  14044. exports["default"] = void 0;
  14045. var _node = _interopRequireDefault(node$1.exports);
  14046. var _types = types;
  14047. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  14048. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  14049. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  14050. var Combinator = /*#__PURE__*/function (_Node) {
  14051. _inheritsLoose(Combinator, _Node);
  14052. function Combinator(opts) {
  14053. var _this;
  14054. _this = _Node.call(this, opts) || this;
  14055. _this.type = _types.COMBINATOR;
  14056. return _this;
  14057. }
  14058. return Combinator;
  14059. }(_node["default"]);
  14060. exports["default"] = Combinator;
  14061. module.exports = exports.default;
  14062. } (combinator$2, combinator$2.exports));
  14063. var nesting$1 = {exports: {}};
  14064. (function (module, exports) {
  14065. exports.__esModule = true;
  14066. exports["default"] = void 0;
  14067. var _node = _interopRequireDefault(node$1.exports);
  14068. var _types = types;
  14069. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  14070. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  14071. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  14072. var Nesting = /*#__PURE__*/function (_Node) {
  14073. _inheritsLoose(Nesting, _Node);
  14074. function Nesting(opts) {
  14075. var _this;
  14076. _this = _Node.call(this, opts) || this;
  14077. _this.type = _types.NESTING;
  14078. _this.value = '&';
  14079. return _this;
  14080. }
  14081. return Nesting;
  14082. }(_node["default"]);
  14083. exports["default"] = Nesting;
  14084. module.exports = exports.default;
  14085. } (nesting$1, nesting$1.exports));
  14086. var sortAscending = {exports: {}};
  14087. (function (module, exports) {
  14088. exports.__esModule = true;
  14089. exports["default"] = sortAscending;
  14090. function sortAscending(list) {
  14091. return list.sort(function (a, b) {
  14092. return a - b;
  14093. });
  14094. }
  14095. module.exports = exports.default;
  14096. } (sortAscending, sortAscending.exports));
  14097. var tokenize = {};
  14098. var tokenTypes = {};
  14099. tokenTypes.__esModule = true;
  14100. tokenTypes.combinator = tokenTypes.word = tokenTypes.comment = tokenTypes.str = tokenTypes.tab = tokenTypes.newline = tokenTypes.feed = tokenTypes.cr = tokenTypes.backslash = tokenTypes.bang = tokenTypes.slash = tokenTypes.doubleQuote = tokenTypes.singleQuote = tokenTypes.space = tokenTypes.greaterThan = tokenTypes.pipe = tokenTypes.equals = tokenTypes.plus = tokenTypes.caret = tokenTypes.tilde = tokenTypes.dollar = tokenTypes.closeSquare = tokenTypes.openSquare = tokenTypes.closeParenthesis = tokenTypes.openParenthesis = tokenTypes.semicolon = tokenTypes.colon = tokenTypes.comma = tokenTypes.at = tokenTypes.asterisk = tokenTypes.ampersand = void 0;
  14101. var ampersand = 38; // `&`.charCodeAt(0);
  14102. tokenTypes.ampersand = ampersand;
  14103. var asterisk = 42; // `*`.charCodeAt(0);
  14104. tokenTypes.asterisk = asterisk;
  14105. var at = 64; // `@`.charCodeAt(0);
  14106. tokenTypes.at = at;
  14107. var comma = 44; // `,`.charCodeAt(0);
  14108. tokenTypes.comma = comma;
  14109. var colon = 58; // `:`.charCodeAt(0);
  14110. tokenTypes.colon = colon;
  14111. var semicolon = 59; // `;`.charCodeAt(0);
  14112. tokenTypes.semicolon = semicolon;
  14113. var openParenthesis = 40; // `(`.charCodeAt(0);
  14114. tokenTypes.openParenthesis = openParenthesis;
  14115. var closeParenthesis = 41; // `)`.charCodeAt(0);
  14116. tokenTypes.closeParenthesis = closeParenthesis;
  14117. var openSquare = 91; // `[`.charCodeAt(0);
  14118. tokenTypes.openSquare = openSquare;
  14119. var closeSquare = 93; // `]`.charCodeAt(0);
  14120. tokenTypes.closeSquare = closeSquare;
  14121. var dollar = 36; // `$`.charCodeAt(0);
  14122. tokenTypes.dollar = dollar;
  14123. var tilde = 126; // `~`.charCodeAt(0);
  14124. tokenTypes.tilde = tilde;
  14125. var caret = 94; // `^`.charCodeAt(0);
  14126. tokenTypes.caret = caret;
  14127. var plus = 43; // `+`.charCodeAt(0);
  14128. tokenTypes.plus = plus;
  14129. var equals = 61; // `=`.charCodeAt(0);
  14130. tokenTypes.equals = equals;
  14131. var pipe = 124; // `|`.charCodeAt(0);
  14132. tokenTypes.pipe = pipe;
  14133. var greaterThan = 62; // `>`.charCodeAt(0);
  14134. tokenTypes.greaterThan = greaterThan;
  14135. var space = 32; // ` `.charCodeAt(0);
  14136. tokenTypes.space = space;
  14137. var singleQuote = 39; // `'`.charCodeAt(0);
  14138. tokenTypes.singleQuote = singleQuote;
  14139. var doubleQuote = 34; // `"`.charCodeAt(0);
  14140. tokenTypes.doubleQuote = doubleQuote;
  14141. var slash = 47; // `/`.charCodeAt(0);
  14142. tokenTypes.slash = slash;
  14143. var bang = 33; // `!`.charCodeAt(0);
  14144. tokenTypes.bang = bang;
  14145. var backslash = 92; // '\\'.charCodeAt(0);
  14146. tokenTypes.backslash = backslash;
  14147. var cr = 13; // '\r'.charCodeAt(0);
  14148. tokenTypes.cr = cr;
  14149. var feed = 12; // '\f'.charCodeAt(0);
  14150. tokenTypes.feed = feed;
  14151. var newline = 10; // '\n'.charCodeAt(0);
  14152. tokenTypes.newline = newline;
  14153. var tab = 9; // '\t'.charCodeAt(0);
  14154. // Expose aliases primarily for readability.
  14155. tokenTypes.tab = tab;
  14156. var str = singleQuote; // No good single character representation!
  14157. tokenTypes.str = str;
  14158. var comment$1 = -1;
  14159. tokenTypes.comment = comment$1;
  14160. var word = -2;
  14161. tokenTypes.word = word;
  14162. var combinator$1 = -3;
  14163. tokenTypes.combinator = combinator$1;
  14164. (function (exports) {
  14165. exports.__esModule = true;
  14166. exports["default"] = tokenize;
  14167. exports.FIELDS = void 0;
  14168. var t = _interopRequireWildcard(tokenTypes);
  14169. var _unescapable, _wordDelimiters;
  14170. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
  14171. 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; }
  14172. var unescapable = (_unescapable = {}, _unescapable[t.tab] = true, _unescapable[t.newline] = true, _unescapable[t.cr] = true, _unescapable[t.feed] = true, _unescapable);
  14173. 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);
  14174. var hex = {};
  14175. var hexChars = "0123456789abcdefABCDEF";
  14176. for (var i = 0; i < hexChars.length; i++) {
  14177. hex[hexChars.charCodeAt(i)] = true;
  14178. }
  14179. /**
  14180. * Returns the last index of the bar css word
  14181. * @param {string} css The string in which the word begins
  14182. * @param {number} start The index into the string where word's first letter occurs
  14183. */
  14184. function consumeWord(css, start) {
  14185. var next = start;
  14186. var code;
  14187. do {
  14188. code = css.charCodeAt(next);
  14189. if (wordDelimiters[code]) {
  14190. return next - 1;
  14191. } else if (code === t.backslash) {
  14192. next = consumeEscape(css, next) + 1;
  14193. } else {
  14194. // All other characters are part of the word
  14195. next++;
  14196. }
  14197. } while (next < css.length);
  14198. return next - 1;
  14199. }
  14200. /**
  14201. * Returns the last index of the escape sequence
  14202. * @param {string} css The string in which the sequence begins
  14203. * @param {number} start The index into the string where escape character (`\`) occurs.
  14204. */
  14205. function consumeEscape(css, start) {
  14206. var next = start;
  14207. var code = css.charCodeAt(next + 1);
  14208. if (unescapable[code]) ; else if (hex[code]) {
  14209. var hexDigits = 0; // consume up to 6 hex chars
  14210. do {
  14211. next++;
  14212. hexDigits++;
  14213. code = css.charCodeAt(next + 1);
  14214. } while (hex[code] && hexDigits < 6); // if fewer than 6 hex chars, a trailing space ends the escape
  14215. if (hexDigits < 6 && code === t.space) {
  14216. next++;
  14217. }
  14218. } else {
  14219. // the next char is part of the current word
  14220. next++;
  14221. }
  14222. return next;
  14223. }
  14224. var FIELDS = {
  14225. TYPE: 0,
  14226. START_LINE: 1,
  14227. START_COL: 2,
  14228. END_LINE: 3,
  14229. END_COL: 4,
  14230. START_POS: 5,
  14231. END_POS: 6
  14232. };
  14233. exports.FIELDS = FIELDS;
  14234. function tokenize(input) {
  14235. var tokens = [];
  14236. var css = input.css.valueOf();
  14237. var _css = css,
  14238. length = _css.length;
  14239. var offset = -1;
  14240. var line = 1;
  14241. var start = 0;
  14242. var end = 0;
  14243. var code, content, endColumn, endLine, escaped, escapePos, last, lines, next, nextLine, nextOffset, quote, tokenType;
  14244. function unclosed(what, fix) {
  14245. if (input.safe) {
  14246. // fyi: this is never set to true.
  14247. css += fix;
  14248. next = css.length - 1;
  14249. } else {
  14250. throw input.error('Unclosed ' + what, line, start - offset, start);
  14251. }
  14252. }
  14253. while (start < length) {
  14254. code = css.charCodeAt(start);
  14255. if (code === t.newline) {
  14256. offset = start;
  14257. line += 1;
  14258. }
  14259. switch (code) {
  14260. case t.space:
  14261. case t.tab:
  14262. case t.newline:
  14263. case t.cr:
  14264. case t.feed:
  14265. next = start;
  14266. do {
  14267. next += 1;
  14268. code = css.charCodeAt(next);
  14269. if (code === t.newline) {
  14270. offset = next;
  14271. line += 1;
  14272. }
  14273. } while (code === t.space || code === t.newline || code === t.tab || code === t.cr || code === t.feed);
  14274. tokenType = t.space;
  14275. endLine = line;
  14276. endColumn = next - offset - 1;
  14277. end = next;
  14278. break;
  14279. case t.plus:
  14280. case t.greaterThan:
  14281. case t.tilde:
  14282. case t.pipe:
  14283. next = start;
  14284. do {
  14285. next += 1;
  14286. code = css.charCodeAt(next);
  14287. } while (code === t.plus || code === t.greaterThan || code === t.tilde || code === t.pipe);
  14288. tokenType = t.combinator;
  14289. endLine = line;
  14290. endColumn = start - offset;
  14291. end = next;
  14292. break;
  14293. // Consume these characters as single tokens.
  14294. case t.asterisk:
  14295. case t.ampersand:
  14296. case t.bang:
  14297. case t.comma:
  14298. case t.equals:
  14299. case t.dollar:
  14300. case t.caret:
  14301. case t.openSquare:
  14302. case t.closeSquare:
  14303. case t.colon:
  14304. case t.semicolon:
  14305. case t.openParenthesis:
  14306. case t.closeParenthesis:
  14307. next = start;
  14308. tokenType = code;
  14309. endLine = line;
  14310. endColumn = start - offset;
  14311. end = next + 1;
  14312. break;
  14313. case t.singleQuote:
  14314. case t.doubleQuote:
  14315. quote = code === t.singleQuote ? "'" : '"';
  14316. next = start;
  14317. do {
  14318. escaped = false;
  14319. next = css.indexOf(quote, next + 1);
  14320. if (next === -1) {
  14321. unclosed('quote', quote);
  14322. }
  14323. escapePos = next;
  14324. while (css.charCodeAt(escapePos - 1) === t.backslash) {
  14325. escapePos -= 1;
  14326. escaped = !escaped;
  14327. }
  14328. } while (escaped);
  14329. tokenType = t.str;
  14330. endLine = line;
  14331. endColumn = start - offset;
  14332. end = next + 1;
  14333. break;
  14334. default:
  14335. if (code === t.slash && css.charCodeAt(start + 1) === t.asterisk) {
  14336. next = css.indexOf('*/', start + 2) + 1;
  14337. if (next === 0) {
  14338. unclosed('comment', '*/');
  14339. }
  14340. content = css.slice(start, next + 1);
  14341. lines = content.split('\n');
  14342. last = lines.length - 1;
  14343. if (last > 0) {
  14344. nextLine = line + last;
  14345. nextOffset = next - lines[last].length;
  14346. } else {
  14347. nextLine = line;
  14348. nextOffset = offset;
  14349. }
  14350. tokenType = t.comment;
  14351. line = nextLine;
  14352. endLine = nextLine;
  14353. endColumn = next - nextOffset;
  14354. } else if (code === t.slash) {
  14355. next = start;
  14356. tokenType = code;
  14357. endLine = line;
  14358. endColumn = start - offset;
  14359. end = next + 1;
  14360. } else {
  14361. next = consumeWord(css, start);
  14362. tokenType = t.word;
  14363. endLine = line;
  14364. endColumn = next - offset;
  14365. }
  14366. end = next + 1;
  14367. break;
  14368. } // Ensure that the token structure remains consistent
  14369. tokens.push([tokenType, // [0] Token type
  14370. line, // [1] Starting line
  14371. start - offset, // [2] Starting column
  14372. endLine, // [3] Ending line
  14373. endColumn, // [4] Ending column
  14374. start, // [5] Start position / Source index
  14375. end // [6] End position
  14376. ]); // Reset offset for the next token
  14377. if (nextOffset) {
  14378. offset = nextOffset;
  14379. nextOffset = null;
  14380. }
  14381. start = end;
  14382. }
  14383. return tokens;
  14384. }
  14385. } (tokenize));
  14386. (function (module, exports) {
  14387. exports.__esModule = true;
  14388. exports["default"] = void 0;
  14389. var _root = _interopRequireDefault(root$1.exports);
  14390. var _selector = _interopRequireDefault(selector$1.exports);
  14391. var _className = _interopRequireDefault(className$1.exports);
  14392. var _comment = _interopRequireDefault(comment$2.exports);
  14393. var _id = _interopRequireDefault(id$1.exports);
  14394. var _tag = _interopRequireDefault(tag$1.exports);
  14395. var _string = _interopRequireDefault(string$1.exports);
  14396. var _pseudo = _interopRequireDefault(pseudo$1.exports);
  14397. var _attribute = _interopRequireWildcard(attribute$1);
  14398. var _universal = _interopRequireDefault(universal$1.exports);
  14399. var _combinator = _interopRequireDefault(combinator$2.exports);
  14400. var _nesting = _interopRequireDefault(nesting$1.exports);
  14401. var _sortAscending = _interopRequireDefault(sortAscending.exports);
  14402. var _tokenize = _interopRequireWildcard(tokenize);
  14403. var tokens = _interopRequireWildcard(tokenTypes);
  14404. var types$1 = _interopRequireWildcard(types);
  14405. var _util = util;
  14406. var _WHITESPACE_TOKENS, _Object$assign;
  14407. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
  14408. 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; }
  14409. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  14410. 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); } }
  14411. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  14412. 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);
  14413. var WHITESPACE_EQUIV_TOKENS = Object.assign({}, WHITESPACE_TOKENS, (_Object$assign = {}, _Object$assign[tokens.comment] = true, _Object$assign));
  14414. function tokenStart(token) {
  14415. return {
  14416. line: token[_tokenize.FIELDS.START_LINE],
  14417. column: token[_tokenize.FIELDS.START_COL]
  14418. };
  14419. }
  14420. function tokenEnd(token) {
  14421. return {
  14422. line: token[_tokenize.FIELDS.END_LINE],
  14423. column: token[_tokenize.FIELDS.END_COL]
  14424. };
  14425. }
  14426. function getSource(startLine, startColumn, endLine, endColumn) {
  14427. return {
  14428. start: {
  14429. line: startLine,
  14430. column: startColumn
  14431. },
  14432. end: {
  14433. line: endLine,
  14434. column: endColumn
  14435. }
  14436. };
  14437. }
  14438. function getTokenSource(token) {
  14439. return getSource(token[_tokenize.FIELDS.START_LINE], token[_tokenize.FIELDS.START_COL], token[_tokenize.FIELDS.END_LINE], token[_tokenize.FIELDS.END_COL]);
  14440. }
  14441. function getTokenSourceSpan(startToken, endToken) {
  14442. if (!startToken) {
  14443. return undefined;
  14444. }
  14445. return getSource(startToken[_tokenize.FIELDS.START_LINE], startToken[_tokenize.FIELDS.START_COL], endToken[_tokenize.FIELDS.END_LINE], endToken[_tokenize.FIELDS.END_COL]);
  14446. }
  14447. function unescapeProp(node, prop) {
  14448. var value = node[prop];
  14449. if (typeof value !== "string") {
  14450. return;
  14451. }
  14452. if (value.indexOf("\\") !== -1) {
  14453. (0, _util.ensureObject)(node, 'raws');
  14454. node[prop] = (0, _util.unesc)(value);
  14455. if (node.raws[prop] === undefined) {
  14456. node.raws[prop] = value;
  14457. }
  14458. }
  14459. return node;
  14460. }
  14461. function indexesOf(array, item) {
  14462. var i = -1;
  14463. var indexes = [];
  14464. while ((i = array.indexOf(item, i + 1)) !== -1) {
  14465. indexes.push(i);
  14466. }
  14467. return indexes;
  14468. }
  14469. function uniqs() {
  14470. var list = Array.prototype.concat.apply([], arguments);
  14471. return list.filter(function (item, i) {
  14472. return i === list.indexOf(item);
  14473. });
  14474. }
  14475. var Parser = /*#__PURE__*/function () {
  14476. function Parser(rule, options) {
  14477. if (options === void 0) {
  14478. options = {};
  14479. }
  14480. this.rule = rule;
  14481. this.options = Object.assign({
  14482. lossy: false,
  14483. safe: false
  14484. }, options);
  14485. this.position = 0;
  14486. this.css = typeof this.rule === 'string' ? this.rule : this.rule.selector;
  14487. this.tokens = (0, _tokenize["default"])({
  14488. css: this.css,
  14489. error: this._errorGenerator(),
  14490. safe: this.options.safe
  14491. });
  14492. var rootSource = getTokenSourceSpan(this.tokens[0], this.tokens[this.tokens.length - 1]);
  14493. this.root = new _root["default"]({
  14494. source: rootSource
  14495. });
  14496. this.root.errorGenerator = this._errorGenerator();
  14497. var selector = new _selector["default"]({
  14498. source: {
  14499. start: {
  14500. line: 1,
  14501. column: 1
  14502. }
  14503. }
  14504. });
  14505. this.root.append(selector);
  14506. this.current = selector;
  14507. this.loop();
  14508. }
  14509. var _proto = Parser.prototype;
  14510. _proto._errorGenerator = function _errorGenerator() {
  14511. var _this = this;
  14512. return function (message, errorOptions) {
  14513. if (typeof _this.rule === 'string') {
  14514. return new Error(message);
  14515. }
  14516. return _this.rule.error(message, errorOptions);
  14517. };
  14518. };
  14519. _proto.attribute = function attribute() {
  14520. var attr = [];
  14521. var startingToken = this.currToken;
  14522. this.position++;
  14523. while (this.position < this.tokens.length && this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
  14524. attr.push(this.currToken);
  14525. this.position++;
  14526. }
  14527. if (this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
  14528. return this.expected('closing square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
  14529. }
  14530. var len = attr.length;
  14531. var node = {
  14532. source: getSource(startingToken[1], startingToken[2], this.currToken[3], this.currToken[4]),
  14533. sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
  14534. };
  14535. if (len === 1 && !~[tokens.word].indexOf(attr[0][_tokenize.FIELDS.TYPE])) {
  14536. return this.expected('attribute', attr[0][_tokenize.FIELDS.START_POS]);
  14537. }
  14538. var pos = 0;
  14539. var spaceBefore = '';
  14540. var commentBefore = '';
  14541. var lastAdded = null;
  14542. var spaceAfterMeaningfulToken = false;
  14543. while (pos < len) {
  14544. var token = attr[pos];
  14545. var content = this.content(token);
  14546. var next = attr[pos + 1];
  14547. switch (token[_tokenize.FIELDS.TYPE]) {
  14548. case tokens.space:
  14549. // if (
  14550. // len === 1 ||
  14551. // pos === 0 && this.content(next) === '|'
  14552. // ) {
  14553. // return this.expected('attribute', token[TOKEN.START_POS], content);
  14554. // }
  14555. spaceAfterMeaningfulToken = true;
  14556. if (this.options.lossy) {
  14557. break;
  14558. }
  14559. if (lastAdded) {
  14560. (0, _util.ensureObject)(node, 'spaces', lastAdded);
  14561. var prevContent = node.spaces[lastAdded].after || '';
  14562. node.spaces[lastAdded].after = prevContent + content;
  14563. var existingComment = (0, _util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || null;
  14564. if (existingComment) {
  14565. node.raws.spaces[lastAdded].after = existingComment + content;
  14566. }
  14567. } else {
  14568. spaceBefore = spaceBefore + content;
  14569. commentBefore = commentBefore + content;
  14570. }
  14571. break;
  14572. case tokens.asterisk:
  14573. if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
  14574. node.operator = content;
  14575. lastAdded = 'operator';
  14576. } else if ((!node.namespace || lastAdded === "namespace" && !spaceAfterMeaningfulToken) && next) {
  14577. if (spaceBefore) {
  14578. (0, _util.ensureObject)(node, 'spaces', 'attribute');
  14579. node.spaces.attribute.before = spaceBefore;
  14580. spaceBefore = '';
  14581. }
  14582. if (commentBefore) {
  14583. (0, _util.ensureObject)(node, 'raws', 'spaces', 'attribute');
  14584. node.raws.spaces.attribute.before = spaceBefore;
  14585. commentBefore = '';
  14586. }
  14587. node.namespace = (node.namespace || "") + content;
  14588. var rawValue = (0, _util.getProp)(node, 'raws', 'namespace') || null;
  14589. if (rawValue) {
  14590. node.raws.namespace += content;
  14591. }
  14592. lastAdded = 'namespace';
  14593. }
  14594. spaceAfterMeaningfulToken = false;
  14595. break;
  14596. case tokens.dollar:
  14597. if (lastAdded === "value") {
  14598. var oldRawValue = (0, _util.getProp)(node, 'raws', 'value');
  14599. node.value += "$";
  14600. if (oldRawValue) {
  14601. node.raws.value = oldRawValue + "$";
  14602. }
  14603. break;
  14604. }
  14605. // Falls through
  14606. case tokens.caret:
  14607. if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
  14608. node.operator = content;
  14609. lastAdded = 'operator';
  14610. }
  14611. spaceAfterMeaningfulToken = false;
  14612. break;
  14613. case tokens.combinator:
  14614. if (content === '~' && next[_tokenize.FIELDS.TYPE] === tokens.equals) {
  14615. node.operator = content;
  14616. lastAdded = 'operator';
  14617. }
  14618. if (content !== '|') {
  14619. spaceAfterMeaningfulToken = false;
  14620. break;
  14621. }
  14622. if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
  14623. node.operator = content;
  14624. lastAdded = 'operator';
  14625. } else if (!node.namespace && !node.attribute) {
  14626. node.namespace = true;
  14627. }
  14628. spaceAfterMeaningfulToken = false;
  14629. break;
  14630. case tokens.word:
  14631. 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.
  14632. !node.operator && !node.namespace) {
  14633. node.namespace = content;
  14634. lastAdded = 'namespace';
  14635. } else if (!node.attribute || lastAdded === "attribute" && !spaceAfterMeaningfulToken) {
  14636. if (spaceBefore) {
  14637. (0, _util.ensureObject)(node, 'spaces', 'attribute');
  14638. node.spaces.attribute.before = spaceBefore;
  14639. spaceBefore = '';
  14640. }
  14641. if (commentBefore) {
  14642. (0, _util.ensureObject)(node, 'raws', 'spaces', 'attribute');
  14643. node.raws.spaces.attribute.before = commentBefore;
  14644. commentBefore = '';
  14645. }
  14646. node.attribute = (node.attribute || "") + content;
  14647. var _rawValue = (0, _util.getProp)(node, 'raws', 'attribute') || null;
  14648. if (_rawValue) {
  14649. node.raws.attribute += content;
  14650. }
  14651. lastAdded = 'attribute';
  14652. } else if (!node.value && node.value !== "" || lastAdded === "value" && !spaceAfterMeaningfulToken) {
  14653. var _unescaped = (0, _util.unesc)(content);
  14654. var _oldRawValue = (0, _util.getProp)(node, 'raws', 'value') || '';
  14655. var oldValue = node.value || '';
  14656. node.value = oldValue + _unescaped;
  14657. node.quoteMark = null;
  14658. if (_unescaped !== content || _oldRawValue) {
  14659. (0, _util.ensureObject)(node, 'raws');
  14660. node.raws.value = (_oldRawValue || oldValue) + content;
  14661. }
  14662. lastAdded = 'value';
  14663. } else {
  14664. var insensitive = content === 'i' || content === "I";
  14665. if ((node.value || node.value === '') && (node.quoteMark || spaceAfterMeaningfulToken)) {
  14666. node.insensitive = insensitive;
  14667. if (!insensitive || content === "I") {
  14668. (0, _util.ensureObject)(node, 'raws');
  14669. node.raws.insensitiveFlag = content;
  14670. }
  14671. lastAdded = 'insensitive';
  14672. if (spaceBefore) {
  14673. (0, _util.ensureObject)(node, 'spaces', 'insensitive');
  14674. node.spaces.insensitive.before = spaceBefore;
  14675. spaceBefore = '';
  14676. }
  14677. if (commentBefore) {
  14678. (0, _util.ensureObject)(node, 'raws', 'spaces', 'insensitive');
  14679. node.raws.spaces.insensitive.before = commentBefore;
  14680. commentBefore = '';
  14681. }
  14682. } else if (node.value || node.value === '') {
  14683. lastAdded = 'value';
  14684. node.value += content;
  14685. if (node.raws.value) {
  14686. node.raws.value += content;
  14687. }
  14688. }
  14689. }
  14690. spaceAfterMeaningfulToken = false;
  14691. break;
  14692. case tokens.str:
  14693. if (!node.attribute || !node.operator) {
  14694. return this.error("Expected an attribute followed by an operator preceding the string.", {
  14695. index: token[_tokenize.FIELDS.START_POS]
  14696. });
  14697. }
  14698. var _unescapeValue = (0, _attribute.unescapeValue)(content),
  14699. unescaped = _unescapeValue.unescaped,
  14700. quoteMark = _unescapeValue.quoteMark;
  14701. node.value = unescaped;
  14702. node.quoteMark = quoteMark;
  14703. lastAdded = 'value';
  14704. (0, _util.ensureObject)(node, 'raws');
  14705. node.raws.value = content;
  14706. spaceAfterMeaningfulToken = false;
  14707. break;
  14708. case tokens.equals:
  14709. if (!node.attribute) {
  14710. return this.expected('attribute', token[_tokenize.FIELDS.START_POS], content);
  14711. }
  14712. if (node.value) {
  14713. return this.error('Unexpected "=" found; an operator was already defined.', {
  14714. index: token[_tokenize.FIELDS.START_POS]
  14715. });
  14716. }
  14717. node.operator = node.operator ? node.operator + content : content;
  14718. lastAdded = 'operator';
  14719. spaceAfterMeaningfulToken = false;
  14720. break;
  14721. case tokens.comment:
  14722. if (lastAdded) {
  14723. if (spaceAfterMeaningfulToken || next && next[_tokenize.FIELDS.TYPE] === tokens.space || lastAdded === 'insensitive') {
  14724. var lastComment = (0, _util.getProp)(node, 'spaces', lastAdded, 'after') || '';
  14725. var rawLastComment = (0, _util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || lastComment;
  14726. (0, _util.ensureObject)(node, 'raws', 'spaces', lastAdded);
  14727. node.raws.spaces[lastAdded].after = rawLastComment + content;
  14728. } else {
  14729. var lastValue = node[lastAdded] || '';
  14730. var rawLastValue = (0, _util.getProp)(node, 'raws', lastAdded) || lastValue;
  14731. (0, _util.ensureObject)(node, 'raws');
  14732. node.raws[lastAdded] = rawLastValue + content;
  14733. }
  14734. } else {
  14735. commentBefore = commentBefore + content;
  14736. }
  14737. break;
  14738. default:
  14739. return this.error("Unexpected \"" + content + "\" found.", {
  14740. index: token[_tokenize.FIELDS.START_POS]
  14741. });
  14742. }
  14743. pos++;
  14744. }
  14745. unescapeProp(node, "attribute");
  14746. unescapeProp(node, "namespace");
  14747. this.newNode(new _attribute["default"](node));
  14748. this.position++;
  14749. }
  14750. /**
  14751. * return a node containing meaningless garbage up to (but not including) the specified token position.
  14752. * if the token position is negative, all remaining tokens are consumed.
  14753. *
  14754. * This returns an array containing a single string node if all whitespace,
  14755. * otherwise an array of comment nodes with space before and after.
  14756. *
  14757. * These tokens are not added to the current selector, the caller can add them or use them to amend
  14758. * a previous node's space metadata.
  14759. *
  14760. * In lossy mode, this returns only comments.
  14761. */
  14762. ;
  14763. _proto.parseWhitespaceEquivalentTokens = function parseWhitespaceEquivalentTokens(stopPosition) {
  14764. if (stopPosition < 0) {
  14765. stopPosition = this.tokens.length;
  14766. }
  14767. var startPosition = this.position;
  14768. var nodes = [];
  14769. var space = "";
  14770. var lastComment = undefined;
  14771. do {
  14772. if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) {
  14773. if (!this.options.lossy) {
  14774. space += this.content();
  14775. }
  14776. } else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.comment) {
  14777. var spaces = {};
  14778. if (space) {
  14779. spaces.before = space;
  14780. space = "";
  14781. }
  14782. lastComment = new _comment["default"]({
  14783. value: this.content(),
  14784. source: getTokenSource(this.currToken),
  14785. sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],
  14786. spaces: spaces
  14787. });
  14788. nodes.push(lastComment);
  14789. }
  14790. } while (++this.position < stopPosition);
  14791. if (space) {
  14792. if (lastComment) {
  14793. lastComment.spaces.after = space;
  14794. } else if (!this.options.lossy) {
  14795. var firstToken = this.tokens[startPosition];
  14796. var lastToken = this.tokens[this.position - 1];
  14797. nodes.push(new _string["default"]({
  14798. value: '',
  14799. source: getSource(firstToken[_tokenize.FIELDS.START_LINE], firstToken[_tokenize.FIELDS.START_COL], lastToken[_tokenize.FIELDS.END_LINE], lastToken[_tokenize.FIELDS.END_COL]),
  14800. sourceIndex: firstToken[_tokenize.FIELDS.START_POS],
  14801. spaces: {
  14802. before: space,
  14803. after: ''
  14804. }
  14805. }));
  14806. }
  14807. }
  14808. return nodes;
  14809. }
  14810. /**
  14811. *
  14812. * @param {*} nodes
  14813. */
  14814. ;
  14815. _proto.convertWhitespaceNodesToSpace = function convertWhitespaceNodesToSpace(nodes, requiredSpace) {
  14816. var _this2 = this;
  14817. if (requiredSpace === void 0) {
  14818. requiredSpace = false;
  14819. }
  14820. var space = "";
  14821. var rawSpace = "";
  14822. nodes.forEach(function (n) {
  14823. var spaceBefore = _this2.lossySpace(n.spaces.before, requiredSpace);
  14824. var rawSpaceBefore = _this2.lossySpace(n.rawSpaceBefore, requiredSpace);
  14825. space += spaceBefore + _this2.lossySpace(n.spaces.after, requiredSpace && spaceBefore.length === 0);
  14826. rawSpace += spaceBefore + n.value + _this2.lossySpace(n.rawSpaceAfter, requiredSpace && rawSpaceBefore.length === 0);
  14827. });
  14828. if (rawSpace === space) {
  14829. rawSpace = undefined;
  14830. }
  14831. var result = {
  14832. space: space,
  14833. rawSpace: rawSpace
  14834. };
  14835. return result;
  14836. };
  14837. _proto.isNamedCombinator = function isNamedCombinator(position) {
  14838. if (position === void 0) {
  14839. position = this.position;
  14840. }
  14841. 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;
  14842. };
  14843. _proto.namedCombinator = function namedCombinator() {
  14844. if (this.isNamedCombinator()) {
  14845. var nameRaw = this.content(this.tokens[this.position + 1]);
  14846. var name = (0, _util.unesc)(nameRaw).toLowerCase();
  14847. var raws = {};
  14848. if (name !== nameRaw) {
  14849. raws.value = "/" + nameRaw + "/";
  14850. }
  14851. var node = new _combinator["default"]({
  14852. value: "/" + name + "/",
  14853. 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]),
  14854. sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],
  14855. raws: raws
  14856. });
  14857. this.position = this.position + 3;
  14858. return node;
  14859. } else {
  14860. this.unexpected();
  14861. }
  14862. };
  14863. _proto.combinator = function combinator() {
  14864. var _this3 = this;
  14865. if (this.content() === '|') {
  14866. return this.namespace();
  14867. } // We need to decide between a space that's a descendant combinator and meaningless whitespace at the end of a selector.
  14868. var nextSigTokenPos = this.locateNextMeaningfulToken(this.position);
  14869. if (nextSigTokenPos < 0 || this.tokens[nextSigTokenPos][_tokenize.FIELDS.TYPE] === tokens.comma) {
  14870. var nodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
  14871. if (nodes.length > 0) {
  14872. var last = this.current.last;
  14873. if (last) {
  14874. var _this$convertWhitespa = this.convertWhitespaceNodesToSpace(nodes),
  14875. space = _this$convertWhitespa.space,
  14876. rawSpace = _this$convertWhitespa.rawSpace;
  14877. if (rawSpace !== undefined) {
  14878. last.rawSpaceAfter += rawSpace;
  14879. }
  14880. last.spaces.after += space;
  14881. } else {
  14882. nodes.forEach(function (n) {
  14883. return _this3.newNode(n);
  14884. });
  14885. }
  14886. }
  14887. return;
  14888. }
  14889. var firstToken = this.currToken;
  14890. var spaceOrDescendantSelectorNodes = undefined;
  14891. if (nextSigTokenPos > this.position) {
  14892. spaceOrDescendantSelectorNodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
  14893. }
  14894. var node;
  14895. if (this.isNamedCombinator()) {
  14896. node = this.namedCombinator();
  14897. } else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.combinator) {
  14898. node = new _combinator["default"]({
  14899. value: this.content(),
  14900. source: getTokenSource(this.currToken),
  14901. sourceIndex: this.currToken[_tokenize.FIELDS.START_POS]
  14902. });
  14903. this.position++;
  14904. } else if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) ; else if (!spaceOrDescendantSelectorNodes) {
  14905. this.unexpected();
  14906. }
  14907. if (node) {
  14908. if (spaceOrDescendantSelectorNodes) {
  14909. var _this$convertWhitespa2 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes),
  14910. _space = _this$convertWhitespa2.space,
  14911. _rawSpace = _this$convertWhitespa2.rawSpace;
  14912. node.spaces.before = _space;
  14913. node.rawSpaceBefore = _rawSpace;
  14914. }
  14915. } else {
  14916. // descendant combinator
  14917. var _this$convertWhitespa3 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes, true),
  14918. _space2 = _this$convertWhitespa3.space,
  14919. _rawSpace2 = _this$convertWhitespa3.rawSpace;
  14920. if (!_rawSpace2) {
  14921. _rawSpace2 = _space2;
  14922. }
  14923. var spaces = {};
  14924. var raws = {
  14925. spaces: {}
  14926. };
  14927. if (_space2.endsWith(' ') && _rawSpace2.endsWith(' ')) {
  14928. spaces.before = _space2.slice(0, _space2.length - 1);
  14929. raws.spaces.before = _rawSpace2.slice(0, _rawSpace2.length - 1);
  14930. } else if (_space2.startsWith(' ') && _rawSpace2.startsWith(' ')) {
  14931. spaces.after = _space2.slice(1);
  14932. raws.spaces.after = _rawSpace2.slice(1);
  14933. } else {
  14934. raws.value = _rawSpace2;
  14935. }
  14936. node = new _combinator["default"]({
  14937. value: ' ',
  14938. source: getTokenSourceSpan(firstToken, this.tokens[this.position - 1]),
  14939. sourceIndex: firstToken[_tokenize.FIELDS.START_POS],
  14940. spaces: spaces,
  14941. raws: raws
  14942. });
  14943. }
  14944. if (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.space) {
  14945. node.spaces.after = this.optionalSpace(this.content());
  14946. this.position++;
  14947. }
  14948. return this.newNode(node);
  14949. };
  14950. _proto.comma = function comma() {
  14951. if (this.position === this.tokens.length - 1) {
  14952. this.root.trailingComma = true;
  14953. this.position++;
  14954. return;
  14955. }
  14956. this.current._inferEndPosition();
  14957. var selector = new _selector["default"]({
  14958. source: {
  14959. start: tokenStart(this.tokens[this.position + 1])
  14960. }
  14961. });
  14962. this.current.parent.append(selector);
  14963. this.current = selector;
  14964. this.position++;
  14965. };
  14966. _proto.comment = function comment() {
  14967. var current = this.currToken;
  14968. this.newNode(new _comment["default"]({
  14969. value: this.content(),
  14970. source: getTokenSource(current),
  14971. sourceIndex: current[_tokenize.FIELDS.START_POS]
  14972. }));
  14973. this.position++;
  14974. };
  14975. _proto.error = function error(message, opts) {
  14976. throw this.root.error(message, opts);
  14977. };
  14978. _proto.missingBackslash = function missingBackslash() {
  14979. return this.error('Expected a backslash preceding the semicolon.', {
  14980. index: this.currToken[_tokenize.FIELDS.START_POS]
  14981. });
  14982. };
  14983. _proto.missingParenthesis = function missingParenthesis() {
  14984. return this.expected('opening parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
  14985. };
  14986. _proto.missingSquareBracket = function missingSquareBracket() {
  14987. return this.expected('opening square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
  14988. };
  14989. _proto.unexpected = function unexpected() {
  14990. return this.error("Unexpected '" + this.content() + "'. Escaping special characters with \\ may help.", this.currToken[_tokenize.FIELDS.START_POS]);
  14991. };
  14992. _proto.namespace = function namespace() {
  14993. var before = this.prevToken && this.content(this.prevToken) || true;
  14994. if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.word) {
  14995. this.position++;
  14996. return this.word(before);
  14997. } else if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.asterisk) {
  14998. this.position++;
  14999. return this.universal(before);
  15000. }
  15001. };
  15002. _proto.nesting = function nesting() {
  15003. if (this.nextToken) {
  15004. var nextContent = this.content(this.nextToken);
  15005. if (nextContent === "|") {
  15006. this.position++;
  15007. return;
  15008. }
  15009. }
  15010. var current = this.currToken;
  15011. this.newNode(new _nesting["default"]({
  15012. value: this.content(),
  15013. source: getTokenSource(current),
  15014. sourceIndex: current[_tokenize.FIELDS.START_POS]
  15015. }));
  15016. this.position++;
  15017. };
  15018. _proto.parentheses = function parentheses() {
  15019. var last = this.current.last;
  15020. var unbalanced = 1;
  15021. this.position++;
  15022. if (last && last.type === types$1.PSEUDO) {
  15023. var selector = new _selector["default"]({
  15024. source: {
  15025. start: tokenStart(this.tokens[this.position - 1])
  15026. }
  15027. });
  15028. var cache = this.current;
  15029. last.append(selector);
  15030. this.current = selector;
  15031. while (this.position < this.tokens.length && unbalanced) {
  15032. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
  15033. unbalanced++;
  15034. }
  15035. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
  15036. unbalanced--;
  15037. }
  15038. if (unbalanced) {
  15039. this.parse();
  15040. } else {
  15041. this.current.source.end = tokenEnd(this.currToken);
  15042. this.current.parent.source.end = tokenEnd(this.currToken);
  15043. this.position++;
  15044. }
  15045. }
  15046. this.current = cache;
  15047. } else {
  15048. // I think this case should be an error. It's used to implement a basic parse of media queries
  15049. // but I don't think it's a good idea.
  15050. var parenStart = this.currToken;
  15051. var parenValue = "(";
  15052. var parenEnd;
  15053. while (this.position < this.tokens.length && unbalanced) {
  15054. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
  15055. unbalanced++;
  15056. }
  15057. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
  15058. unbalanced--;
  15059. }
  15060. parenEnd = this.currToken;
  15061. parenValue += this.parseParenthesisToken(this.currToken);
  15062. this.position++;
  15063. }
  15064. if (last) {
  15065. last.appendToPropertyAndEscape("value", parenValue, parenValue);
  15066. } else {
  15067. this.newNode(new _string["default"]({
  15068. value: parenValue,
  15069. source: getSource(parenStart[_tokenize.FIELDS.START_LINE], parenStart[_tokenize.FIELDS.START_COL], parenEnd[_tokenize.FIELDS.END_LINE], parenEnd[_tokenize.FIELDS.END_COL]),
  15070. sourceIndex: parenStart[_tokenize.FIELDS.START_POS]
  15071. }));
  15072. }
  15073. }
  15074. if (unbalanced) {
  15075. return this.expected('closing parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
  15076. }
  15077. };
  15078. _proto.pseudo = function pseudo() {
  15079. var _this4 = this;
  15080. var pseudoStr = '';
  15081. var startingToken = this.currToken;
  15082. while (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.colon) {
  15083. pseudoStr += this.content();
  15084. this.position++;
  15085. }
  15086. if (!this.currToken) {
  15087. return this.expected(['pseudo-class', 'pseudo-element'], this.position - 1);
  15088. }
  15089. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.word) {
  15090. this.splitWord(false, function (first, length) {
  15091. pseudoStr += first;
  15092. _this4.newNode(new _pseudo["default"]({
  15093. value: pseudoStr,
  15094. source: getTokenSourceSpan(startingToken, _this4.currToken),
  15095. sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
  15096. }));
  15097. if (length > 1 && _this4.nextToken && _this4.nextToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
  15098. _this4.error('Misplaced parenthesis.', {
  15099. index: _this4.nextToken[_tokenize.FIELDS.START_POS]
  15100. });
  15101. }
  15102. });
  15103. } else {
  15104. return this.expected(['pseudo-class', 'pseudo-element'], this.currToken[_tokenize.FIELDS.START_POS]);
  15105. }
  15106. };
  15107. _proto.space = function space() {
  15108. var content = this.content(); // Handle space before and after the selector
  15109. if (this.position === 0 || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis || this.current.nodes.every(function (node) {
  15110. return node.type === 'comment';
  15111. })) {
  15112. this.spaces = this.optionalSpace(content);
  15113. this.position++;
  15114. } else if (this.position === this.tokens.length - 1 || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
  15115. this.current.last.spaces.after = this.optionalSpace(content);
  15116. this.position++;
  15117. } else {
  15118. this.combinator();
  15119. }
  15120. };
  15121. _proto.string = function string() {
  15122. var current = this.currToken;
  15123. this.newNode(new _string["default"]({
  15124. value: this.content(),
  15125. source: getTokenSource(current),
  15126. sourceIndex: current[_tokenize.FIELDS.START_POS]
  15127. }));
  15128. this.position++;
  15129. };
  15130. _proto.universal = function universal(namespace) {
  15131. var nextToken = this.nextToken;
  15132. if (nextToken && this.content(nextToken) === '|') {
  15133. this.position++;
  15134. return this.namespace();
  15135. }
  15136. var current = this.currToken;
  15137. this.newNode(new _universal["default"]({
  15138. value: this.content(),
  15139. source: getTokenSource(current),
  15140. sourceIndex: current[_tokenize.FIELDS.START_POS]
  15141. }), namespace);
  15142. this.position++;
  15143. };
  15144. _proto.splitWord = function splitWord(namespace, firstCallback) {
  15145. var _this5 = this;
  15146. var nextToken = this.nextToken;
  15147. var word = this.content();
  15148. while (nextToken && ~[tokens.dollar, tokens.caret, tokens.equals, tokens.word].indexOf(nextToken[_tokenize.FIELDS.TYPE])) {
  15149. this.position++;
  15150. var current = this.content();
  15151. word += current;
  15152. if (current.lastIndexOf('\\') === current.length - 1) {
  15153. var next = this.nextToken;
  15154. if (next && next[_tokenize.FIELDS.TYPE] === tokens.space) {
  15155. word += this.requiredSpace(this.content(next));
  15156. this.position++;
  15157. }
  15158. }
  15159. nextToken = this.nextToken;
  15160. }
  15161. var hasClass = indexesOf(word, '.').filter(function (i) {
  15162. // Allow escaped dot within class name
  15163. var escapedDot = word[i - 1] === '\\'; // Allow decimal numbers percent in @keyframes
  15164. var isKeyframesPercent = /^\d+\.\d+%$/.test(word);
  15165. return !escapedDot && !isKeyframesPercent;
  15166. });
  15167. var hasId = indexesOf(word, '#').filter(function (i) {
  15168. return word[i - 1] !== '\\';
  15169. }); // Eliminate Sass interpolations from the list of id indexes
  15170. var interpolations = indexesOf(word, '#{');
  15171. if (interpolations.length) {
  15172. hasId = hasId.filter(function (hashIndex) {
  15173. return !~interpolations.indexOf(hashIndex);
  15174. });
  15175. }
  15176. var indices = (0, _sortAscending["default"])(uniqs([0].concat(hasClass, hasId)));
  15177. indices.forEach(function (ind, i) {
  15178. var index = indices[i + 1] || word.length;
  15179. var value = word.slice(ind, index);
  15180. if (i === 0 && firstCallback) {
  15181. return firstCallback.call(_this5, value, indices.length);
  15182. }
  15183. var node;
  15184. var current = _this5.currToken;
  15185. var sourceIndex = current[_tokenize.FIELDS.START_POS] + indices[i];
  15186. var source = getSource(current[1], current[2] + ind, current[3], current[2] + (index - 1));
  15187. if (~hasClass.indexOf(ind)) {
  15188. var classNameOpts = {
  15189. value: value.slice(1),
  15190. source: source,
  15191. sourceIndex: sourceIndex
  15192. };
  15193. node = new _className["default"](unescapeProp(classNameOpts, "value"));
  15194. } else if (~hasId.indexOf(ind)) {
  15195. var idOpts = {
  15196. value: value.slice(1),
  15197. source: source,
  15198. sourceIndex: sourceIndex
  15199. };
  15200. node = new _id["default"](unescapeProp(idOpts, "value"));
  15201. } else {
  15202. var tagOpts = {
  15203. value: value,
  15204. source: source,
  15205. sourceIndex: sourceIndex
  15206. };
  15207. unescapeProp(tagOpts, "value");
  15208. node = new _tag["default"](tagOpts);
  15209. }
  15210. _this5.newNode(node, namespace); // Ensure that the namespace is used only once
  15211. namespace = null;
  15212. });
  15213. this.position++;
  15214. };
  15215. _proto.word = function word(namespace) {
  15216. var nextToken = this.nextToken;
  15217. if (nextToken && this.content(nextToken) === '|') {
  15218. this.position++;
  15219. return this.namespace();
  15220. }
  15221. return this.splitWord(namespace);
  15222. };
  15223. _proto.loop = function loop() {
  15224. while (this.position < this.tokens.length) {
  15225. this.parse(true);
  15226. }
  15227. this.current._inferEndPosition();
  15228. return this.root;
  15229. };
  15230. _proto.parse = function parse(throwOnParenthesis) {
  15231. switch (this.currToken[_tokenize.FIELDS.TYPE]) {
  15232. case tokens.space:
  15233. this.space();
  15234. break;
  15235. case tokens.comment:
  15236. this.comment();
  15237. break;
  15238. case tokens.openParenthesis:
  15239. this.parentheses();
  15240. break;
  15241. case tokens.closeParenthesis:
  15242. if (throwOnParenthesis) {
  15243. this.missingParenthesis();
  15244. }
  15245. break;
  15246. case tokens.openSquare:
  15247. this.attribute();
  15248. break;
  15249. case tokens.dollar:
  15250. case tokens.caret:
  15251. case tokens.equals:
  15252. case tokens.word:
  15253. this.word();
  15254. break;
  15255. case tokens.colon:
  15256. this.pseudo();
  15257. break;
  15258. case tokens.comma:
  15259. this.comma();
  15260. break;
  15261. case tokens.asterisk:
  15262. this.universal();
  15263. break;
  15264. case tokens.ampersand:
  15265. this.nesting();
  15266. break;
  15267. case tokens.slash:
  15268. case tokens.combinator:
  15269. this.combinator();
  15270. break;
  15271. case tokens.str:
  15272. this.string();
  15273. break;
  15274. // These cases throw; no break needed.
  15275. case tokens.closeSquare:
  15276. this.missingSquareBracket();
  15277. case tokens.semicolon:
  15278. this.missingBackslash();
  15279. default:
  15280. this.unexpected();
  15281. }
  15282. }
  15283. /**
  15284. * Helpers
  15285. */
  15286. ;
  15287. _proto.expected = function expected(description, index, found) {
  15288. if (Array.isArray(description)) {
  15289. var last = description.pop();
  15290. description = description.join(', ') + " or " + last;
  15291. }
  15292. var an = /^[aeiou]/.test(description[0]) ? 'an' : 'a';
  15293. if (!found) {
  15294. return this.error("Expected " + an + " " + description + ".", {
  15295. index: index
  15296. });
  15297. }
  15298. return this.error("Expected " + an + " " + description + ", found \"" + found + "\" instead.", {
  15299. index: index
  15300. });
  15301. };
  15302. _proto.requiredSpace = function requiredSpace(space) {
  15303. return this.options.lossy ? ' ' : space;
  15304. };
  15305. _proto.optionalSpace = function optionalSpace(space) {
  15306. return this.options.lossy ? '' : space;
  15307. };
  15308. _proto.lossySpace = function lossySpace(space, required) {
  15309. if (this.options.lossy) {
  15310. return required ? ' ' : '';
  15311. } else {
  15312. return space;
  15313. }
  15314. };
  15315. _proto.parseParenthesisToken = function parseParenthesisToken(token) {
  15316. var content = this.content(token);
  15317. if (token[_tokenize.FIELDS.TYPE] === tokens.space) {
  15318. return this.requiredSpace(content);
  15319. } else {
  15320. return content;
  15321. }
  15322. };
  15323. _proto.newNode = function newNode(node, namespace) {
  15324. if (namespace) {
  15325. if (/^ +$/.test(namespace)) {
  15326. if (!this.options.lossy) {
  15327. this.spaces = (this.spaces || '') + namespace;
  15328. }
  15329. namespace = true;
  15330. }
  15331. node.namespace = namespace;
  15332. unescapeProp(node, "namespace");
  15333. }
  15334. if (this.spaces) {
  15335. node.spaces.before = this.spaces;
  15336. this.spaces = '';
  15337. }
  15338. return this.current.append(node);
  15339. };
  15340. _proto.content = function content(token) {
  15341. if (token === void 0) {
  15342. token = this.currToken;
  15343. }
  15344. return this.css.slice(token[_tokenize.FIELDS.START_POS], token[_tokenize.FIELDS.END_POS]);
  15345. };
  15346. /**
  15347. * returns the index of the next non-whitespace, non-comment token.
  15348. * returns -1 if no meaningful token is found.
  15349. */
  15350. _proto.locateNextMeaningfulToken = function locateNextMeaningfulToken(startPosition) {
  15351. if (startPosition === void 0) {
  15352. startPosition = this.position + 1;
  15353. }
  15354. var searchPosition = startPosition;
  15355. while (searchPosition < this.tokens.length) {
  15356. if (WHITESPACE_EQUIV_TOKENS[this.tokens[searchPosition][_tokenize.FIELDS.TYPE]]) {
  15357. searchPosition++;
  15358. continue;
  15359. } else {
  15360. return searchPosition;
  15361. }
  15362. }
  15363. return -1;
  15364. };
  15365. _createClass(Parser, [{
  15366. key: "currToken",
  15367. get: function get() {
  15368. return this.tokens[this.position];
  15369. }
  15370. }, {
  15371. key: "nextToken",
  15372. get: function get() {
  15373. return this.tokens[this.position + 1];
  15374. }
  15375. }, {
  15376. key: "prevToken",
  15377. get: function get() {
  15378. return this.tokens[this.position - 1];
  15379. }
  15380. }]);
  15381. return Parser;
  15382. }();
  15383. exports["default"] = Parser;
  15384. module.exports = exports.default;
  15385. } (parser, parser.exports));
  15386. (function (module, exports) {
  15387. exports.__esModule = true;
  15388. exports["default"] = void 0;
  15389. var _parser = _interopRequireDefault(parser.exports);
  15390. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  15391. var Processor = /*#__PURE__*/function () {
  15392. function Processor(func, options) {
  15393. this.func = func || function noop() {};
  15394. this.funcRes = null;
  15395. this.options = options;
  15396. }
  15397. var _proto = Processor.prototype;
  15398. _proto._shouldUpdateSelector = function _shouldUpdateSelector(rule, options) {
  15399. if (options === void 0) {
  15400. options = {};
  15401. }
  15402. var merged = Object.assign({}, this.options, options);
  15403. if (merged.updateSelector === false) {
  15404. return false;
  15405. } else {
  15406. return typeof rule !== "string";
  15407. }
  15408. };
  15409. _proto._isLossy = function _isLossy(options) {
  15410. if (options === void 0) {
  15411. options = {};
  15412. }
  15413. var merged = Object.assign({}, this.options, options);
  15414. if (merged.lossless === false) {
  15415. return true;
  15416. } else {
  15417. return false;
  15418. }
  15419. };
  15420. _proto._root = function _root(rule, options) {
  15421. if (options === void 0) {
  15422. options = {};
  15423. }
  15424. var parser = new _parser["default"](rule, this._parseOptions(options));
  15425. return parser.root;
  15426. };
  15427. _proto._parseOptions = function _parseOptions(options) {
  15428. return {
  15429. lossy: this._isLossy(options)
  15430. };
  15431. };
  15432. _proto._run = function _run(rule, options) {
  15433. var _this = this;
  15434. if (options === void 0) {
  15435. options = {};
  15436. }
  15437. return new Promise(function (resolve, reject) {
  15438. try {
  15439. var root = _this._root(rule, options);
  15440. Promise.resolve(_this.func(root)).then(function (transform) {
  15441. var string = undefined;
  15442. if (_this._shouldUpdateSelector(rule, options)) {
  15443. string = root.toString();
  15444. rule.selector = string;
  15445. }
  15446. return {
  15447. transform: transform,
  15448. root: root,
  15449. string: string
  15450. };
  15451. }).then(resolve, reject);
  15452. } catch (e) {
  15453. reject(e);
  15454. return;
  15455. }
  15456. });
  15457. };
  15458. _proto._runSync = function _runSync(rule, options) {
  15459. if (options === void 0) {
  15460. options = {};
  15461. }
  15462. var root = this._root(rule, options);
  15463. var transform = this.func(root);
  15464. if (transform && typeof transform.then === "function") {
  15465. throw new Error("Selector processor returned a promise to a synchronous call.");
  15466. }
  15467. var string = undefined;
  15468. if (options.updateSelector && typeof rule !== "string") {
  15469. string = root.toString();
  15470. rule.selector = string;
  15471. }
  15472. return {
  15473. transform: transform,
  15474. root: root,
  15475. string: string
  15476. };
  15477. }
  15478. /**
  15479. * Process rule into a selector AST.
  15480. *
  15481. * @param rule {postcss.Rule | string} The css selector to be processed
  15482. * @param options The options for processing
  15483. * @returns {Promise<parser.Root>} The AST of the selector after processing it.
  15484. */
  15485. ;
  15486. _proto.ast = function ast(rule, options) {
  15487. return this._run(rule, options).then(function (result) {
  15488. return result.root;
  15489. });
  15490. }
  15491. /**
  15492. * Process rule into a selector AST synchronously.
  15493. *
  15494. * @param rule {postcss.Rule | string} The css selector to be processed
  15495. * @param options The options for processing
  15496. * @returns {parser.Root} The AST of the selector after processing it.
  15497. */
  15498. ;
  15499. _proto.astSync = function astSync(rule, options) {
  15500. return this._runSync(rule, options).root;
  15501. }
  15502. /**
  15503. * Process a selector into a transformed value asynchronously
  15504. *
  15505. * @param rule {postcss.Rule | string} The css selector to be processed
  15506. * @param options The options for processing
  15507. * @returns {Promise<any>} The value returned by the processor.
  15508. */
  15509. ;
  15510. _proto.transform = function transform(rule, options) {
  15511. return this._run(rule, options).then(function (result) {
  15512. return result.transform;
  15513. });
  15514. }
  15515. /**
  15516. * Process a selector into a transformed value synchronously.
  15517. *
  15518. * @param rule {postcss.Rule | string} The css selector to be processed
  15519. * @param options The options for processing
  15520. * @returns {any} The value returned by the processor.
  15521. */
  15522. ;
  15523. _proto.transformSync = function transformSync(rule, options) {
  15524. return this._runSync(rule, options).transform;
  15525. }
  15526. /**
  15527. * Process a selector into a new selector string asynchronously.
  15528. *
  15529. * @param rule {postcss.Rule | string} The css selector to be processed
  15530. * @param options The options for processing
  15531. * @returns {string} the selector after processing.
  15532. */
  15533. ;
  15534. _proto.process = function process(rule, options) {
  15535. return this._run(rule, options).then(function (result) {
  15536. return result.string || result.root.toString();
  15537. });
  15538. }
  15539. /**
  15540. * Process a selector into a new selector string synchronously.
  15541. *
  15542. * @param rule {postcss.Rule | string} The css selector to be processed
  15543. * @param options The options for processing
  15544. * @returns {string} the selector after processing.
  15545. */
  15546. ;
  15547. _proto.processSync = function processSync(rule, options) {
  15548. var result = this._runSync(rule, options);
  15549. return result.string || result.root.toString();
  15550. };
  15551. return Processor;
  15552. }();
  15553. exports["default"] = Processor;
  15554. module.exports = exports.default;
  15555. } (processor, processor.exports));
  15556. var selectors = {};
  15557. var constructors = {};
  15558. constructors.__esModule = true;
  15559. constructors.universal = constructors.tag = constructors.string = constructors.selector = constructors.root = constructors.pseudo = constructors.nesting = constructors.id = constructors.comment = constructors.combinator = constructors.className = constructors.attribute = void 0;
  15560. var _attribute = _interopRequireDefault(attribute$1);
  15561. var _className = _interopRequireDefault(className$1.exports);
  15562. var _combinator = _interopRequireDefault(combinator$2.exports);
  15563. var _comment = _interopRequireDefault(comment$2.exports);
  15564. var _id = _interopRequireDefault(id$1.exports);
  15565. var _nesting = _interopRequireDefault(nesting$1.exports);
  15566. var _pseudo = _interopRequireDefault(pseudo$1.exports);
  15567. var _root = _interopRequireDefault(root$1.exports);
  15568. var _selector = _interopRequireDefault(selector$1.exports);
  15569. var _string = _interopRequireDefault(string$1.exports);
  15570. var _tag = _interopRequireDefault(tag$1.exports);
  15571. var _universal = _interopRequireDefault(universal$1.exports);
  15572. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  15573. var attribute = function attribute(opts) {
  15574. return new _attribute["default"](opts);
  15575. };
  15576. constructors.attribute = attribute;
  15577. var className = function className(opts) {
  15578. return new _className["default"](opts);
  15579. };
  15580. constructors.className = className;
  15581. var combinator = function combinator(opts) {
  15582. return new _combinator["default"](opts);
  15583. };
  15584. constructors.combinator = combinator;
  15585. var comment = function comment(opts) {
  15586. return new _comment["default"](opts);
  15587. };
  15588. constructors.comment = comment;
  15589. var id = function id(opts) {
  15590. return new _id["default"](opts);
  15591. };
  15592. constructors.id = id;
  15593. var nesting = function nesting(opts) {
  15594. return new _nesting["default"](opts);
  15595. };
  15596. constructors.nesting = nesting;
  15597. var pseudo = function pseudo(opts) {
  15598. return new _pseudo["default"](opts);
  15599. };
  15600. constructors.pseudo = pseudo;
  15601. var root = function root(opts) {
  15602. return new _root["default"](opts);
  15603. };
  15604. constructors.root = root;
  15605. var selector = function selector(opts) {
  15606. return new _selector["default"](opts);
  15607. };
  15608. constructors.selector = selector;
  15609. var string = function string(opts) {
  15610. return new _string["default"](opts);
  15611. };
  15612. constructors.string = string;
  15613. var tag = function tag(opts) {
  15614. return new _tag["default"](opts);
  15615. };
  15616. constructors.tag = tag;
  15617. var universal = function universal(opts) {
  15618. return new _universal["default"](opts);
  15619. };
  15620. constructors.universal = universal;
  15621. var guards = {};
  15622. guards.__esModule = true;
  15623. guards.isNode = isNode;
  15624. guards.isPseudoElement = isPseudoElement;
  15625. guards.isPseudoClass = isPseudoClass;
  15626. guards.isContainer = isContainer;
  15627. guards.isNamespace = isNamespace;
  15628. guards.isUniversal = guards.isTag = guards.isString = guards.isSelector = guards.isRoot = guards.isPseudo = guards.isNesting = guards.isIdentifier = guards.isComment = guards.isCombinator = guards.isClassName = guards.isAttribute = void 0;
  15629. var _types = types;
  15630. var _IS_TYPE;
  15631. 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);
  15632. function isNode(node) {
  15633. return typeof node === "object" && IS_TYPE[node.type];
  15634. }
  15635. function isNodeType(type, node) {
  15636. return isNode(node) && node.type === type;
  15637. }
  15638. var isAttribute = isNodeType.bind(null, _types.ATTRIBUTE);
  15639. guards.isAttribute = isAttribute;
  15640. var isClassName = isNodeType.bind(null, _types.CLASS);
  15641. guards.isClassName = isClassName;
  15642. var isCombinator = isNodeType.bind(null, _types.COMBINATOR);
  15643. guards.isCombinator = isCombinator;
  15644. var isComment = isNodeType.bind(null, _types.COMMENT);
  15645. guards.isComment = isComment;
  15646. var isIdentifier = isNodeType.bind(null, _types.ID);
  15647. guards.isIdentifier = isIdentifier;
  15648. var isNesting = isNodeType.bind(null, _types.NESTING);
  15649. guards.isNesting = isNesting;
  15650. var isPseudo = isNodeType.bind(null, _types.PSEUDO);
  15651. guards.isPseudo = isPseudo;
  15652. var isRoot = isNodeType.bind(null, _types.ROOT);
  15653. guards.isRoot = isRoot;
  15654. var isSelector = isNodeType.bind(null, _types.SELECTOR);
  15655. guards.isSelector = isSelector;
  15656. var isString = isNodeType.bind(null, _types.STRING);
  15657. guards.isString = isString;
  15658. var isTag = isNodeType.bind(null, _types.TAG);
  15659. guards.isTag = isTag;
  15660. var isUniversal = isNodeType.bind(null, _types.UNIVERSAL);
  15661. guards.isUniversal = isUniversal;
  15662. function isPseudoElement(node) {
  15663. return isPseudo(node) && node.value && (node.value.startsWith("::") || node.value.toLowerCase() === ":before" || node.value.toLowerCase() === ":after" || node.value.toLowerCase() === ":first-letter" || node.value.toLowerCase() === ":first-line");
  15664. }
  15665. function isPseudoClass(node) {
  15666. return isPseudo(node) && !isPseudoElement(node);
  15667. }
  15668. function isContainer(node) {
  15669. return !!(isNode(node) && node.walk);
  15670. }
  15671. function isNamespace(node) {
  15672. return isAttribute(node) || isTag(node);
  15673. }
  15674. (function (exports) {
  15675. exports.__esModule = true;
  15676. var _types = types;
  15677. Object.keys(_types).forEach(function (key) {
  15678. if (key === "default" || key === "__esModule") return;
  15679. if (key in exports && exports[key] === _types[key]) return;
  15680. exports[key] = _types[key];
  15681. });
  15682. var _constructors = constructors;
  15683. Object.keys(_constructors).forEach(function (key) {
  15684. if (key === "default" || key === "__esModule") return;
  15685. if (key in exports && exports[key] === _constructors[key]) return;
  15686. exports[key] = _constructors[key];
  15687. });
  15688. var _guards = guards;
  15689. Object.keys(_guards).forEach(function (key) {
  15690. if (key === "default" || key === "__esModule") return;
  15691. if (key in exports && exports[key] === _guards[key]) return;
  15692. exports[key] = _guards[key];
  15693. });
  15694. } (selectors));
  15695. (function (module, exports) {
  15696. exports.__esModule = true;
  15697. exports["default"] = void 0;
  15698. var _processor = _interopRequireDefault(processor.exports);
  15699. var selectors$1 = _interopRequireWildcard(selectors);
  15700. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
  15701. 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; }
  15702. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  15703. var parser = function parser(processor) {
  15704. return new _processor["default"](processor);
  15705. };
  15706. Object.assign(parser, selectors$1);
  15707. delete parser.__esModule;
  15708. var _default = parser;
  15709. exports["default"] = _default;
  15710. module.exports = exports.default;
  15711. } (dist, dist.exports));
  15712. var selectorParser = /*@__PURE__*/getDefaultExportFromCjs(dist.exports);
  15713. const animationNameRE = /^(-\w+-)?animation-name$/;
  15714. const animationRE = /^(-\w+-)?animation$/;
  15715. const scopedPlugin = (id = '') => {
  15716. const keyframes = Object.create(null);
  15717. const shortId = id.replace(/^data-v-/, '');
  15718. return {
  15719. postcssPlugin: 'vue-sfc-scoped',
  15720. Rule(rule) {
  15721. processRule(id, rule);
  15722. },
  15723. AtRule(node) {
  15724. if (/-?keyframes$/.test(node.name) &&
  15725. !node.params.endsWith(`-${shortId}`)) {
  15726. // register keyframes
  15727. keyframes[node.params] = node.params = node.params + '-' + shortId;
  15728. }
  15729. },
  15730. OnceExit(root) {
  15731. if (Object.keys(keyframes).length) {
  15732. // If keyframes are found in this <style>, find and rewrite animation names
  15733. // in declarations.
  15734. // Caveat: this only works for keyframes and animation rules in the same
  15735. // <style> element.
  15736. // individual animation-name declaration
  15737. root.walkDecls(decl => {
  15738. if (animationNameRE.test(decl.prop)) {
  15739. decl.value = decl.value
  15740. .split(',')
  15741. .map(v => keyframes[v.trim()] || v.trim())
  15742. .join(',');
  15743. }
  15744. // shorthand
  15745. if (animationRE.test(decl.prop)) {
  15746. decl.value = decl.value
  15747. .split(',')
  15748. .map(v => {
  15749. const vals = v.trim().split(/\s+/);
  15750. const i = vals.findIndex(val => keyframes[val]);
  15751. if (i !== -1) {
  15752. vals.splice(i, 1, keyframes[vals[i]]);
  15753. return vals.join(' ');
  15754. }
  15755. else {
  15756. return v;
  15757. }
  15758. })
  15759. .join(',');
  15760. }
  15761. });
  15762. }
  15763. }
  15764. };
  15765. };
  15766. const processedRules = new WeakSet();
  15767. function processRule(id, rule) {
  15768. if (processedRules.has(rule) ||
  15769. (rule.parent &&
  15770. rule.parent.type === 'atrule' &&
  15771. /-?keyframes$/.test(rule.parent.name))) {
  15772. return;
  15773. }
  15774. processedRules.add(rule);
  15775. rule.selector = selectorParser(selectorRoot => {
  15776. selectorRoot.each(selector => {
  15777. rewriteSelector(id, selector, selectorRoot);
  15778. });
  15779. }).processSync(rule.selector);
  15780. }
  15781. function rewriteSelector(id, selector, selectorRoot) {
  15782. let node = null;
  15783. // find the last child node to insert attribute selector
  15784. selector.each(n => {
  15785. // DEPRECATED ">>>" and "/deep/" combinator
  15786. if (n.type === 'combinator' &&
  15787. (n.value === '>>>' || n.value === '/deep/')) {
  15788. n.value = ' ';
  15789. n.spaces.before = n.spaces.after = '';
  15790. // warn(
  15791. // `the >>> and /deep/ combinators have been deprecated. ` +
  15792. // `Use :deep() instead.`
  15793. // )
  15794. return false;
  15795. }
  15796. if (n.type === 'pseudo') {
  15797. const { value } = n;
  15798. // deep: inject [id] attribute at the node before the ::v-deep
  15799. // combinator.
  15800. if (value === ':deep' || value === '::v-deep') {
  15801. if (n.nodes.length) {
  15802. // .foo ::v-deep(.bar) -> .foo[xxxxxxx] .bar
  15803. // replace the current node with ::v-deep's inner selector
  15804. let last = n;
  15805. n.nodes[0].each(ss => {
  15806. selector.insertAfter(last, ss);
  15807. last = ss;
  15808. });
  15809. // insert a space combinator before if it doesn't already have one
  15810. const prev = selector.at(selector.index(n) - 1);
  15811. if (!prev || !isSpaceCombinator(prev)) {
  15812. selector.insertAfter(n, selectorParser.combinator({
  15813. value: ' '
  15814. }));
  15815. }
  15816. selector.removeChild(n);
  15817. }
  15818. else {
  15819. // DEPRECATED usage in v3
  15820. // .foo ::v-deep .bar -> .foo[xxxxxxx] .bar
  15821. // warn(
  15822. // `::v-deep usage as a combinator has ` +
  15823. // `been deprecated. Use :deep(<inner-selector>) instead.`
  15824. // )
  15825. const prev = selector.at(selector.index(n) - 1);
  15826. if (prev && isSpaceCombinator(prev)) {
  15827. selector.removeChild(prev);
  15828. }
  15829. selector.removeChild(n);
  15830. }
  15831. return false;
  15832. }
  15833. // !!! Vue 2 does not have :slotted support
  15834. // ::v-slotted(.foo) -> .foo[xxxxxxx-s]
  15835. // if (value === ':slotted' || value === '::v-slotted') {
  15836. // rewriteSelector(id, n.nodes[0], selectorRoot, true /* slotted */)
  15837. // let last: selectorParser.Selector['nodes'][0] = n
  15838. // n.nodes[0].each(ss => {
  15839. // selector.insertAfter(last, ss)
  15840. // last = ss
  15841. // })
  15842. // // selector.insertAfter(n, n.nodes[0])
  15843. // selector.removeChild(n)
  15844. // // since slotted attribute already scopes the selector there's no
  15845. // // need for the non-slot attribute.
  15846. // shouldInject = false
  15847. // return false
  15848. // }
  15849. // global: replace with inner selector and do not inject [id].
  15850. // ::v-global(.foo) -> .foo
  15851. if (value === ':global' || value === '::v-global') {
  15852. selectorRoot.insertAfter(selector, n.nodes[0]);
  15853. selectorRoot.removeChild(selector);
  15854. return false;
  15855. }
  15856. }
  15857. if (n.type !== 'pseudo' && n.type !== 'combinator') {
  15858. node = n;
  15859. }
  15860. });
  15861. if (node) {
  15862. node.spaces.after = '';
  15863. }
  15864. else {
  15865. // For deep selectors & standalone pseudo selectors,
  15866. // the attribute selectors are prepended rather than appended.
  15867. // So all leading spaces must be eliminated to avoid problems.
  15868. selector.first.spaces.before = '';
  15869. }
  15870. {
  15871. selector.insertAfter(
  15872. // If node is null it means we need to inject [id] at the start
  15873. // insertAfter can handle `null` here
  15874. node, selectorParser.attribute({
  15875. attribute: id,
  15876. value: id,
  15877. raws: {},
  15878. quoteMark: `"`
  15879. }));
  15880. }
  15881. }
  15882. function isSpaceCombinator(node) {
  15883. return node.type === 'combinator' && /^\s+$/.test(node.value);
  15884. }
  15885. scopedPlugin.postcss = true;
  15886. var sourceMap = require$$0__default$1["default"];
  15887. var SourceMapConsumer = sourceMap.SourceMapConsumer;
  15888. var SourceMapGenerator = sourceMap.SourceMapGenerator;
  15889. var mergeSourceMap = merge;
  15890. /**
  15891. * Merge old source map and new source map and return merged.
  15892. * If old or new source map value is falsy, return another one as it is.
  15893. *
  15894. * @param {object|string} [oldMap] old source map object
  15895. * @param {object|string} [newmap] new source map object
  15896. * @return {object|undefined} merged source map object, or undefined when both old and new source map are undefined
  15897. */
  15898. function merge(oldMap, newMap) {
  15899. if (!oldMap) return newMap
  15900. if (!newMap) return oldMap
  15901. var oldMapConsumer = new SourceMapConsumer(oldMap);
  15902. var newMapConsumer = new SourceMapConsumer(newMap);
  15903. var mergedMapGenerator = new SourceMapGenerator();
  15904. // iterate on new map and overwrite original position of new map with one of old map
  15905. newMapConsumer.eachMapping(function(m) {
  15906. // pass when `originalLine` is null.
  15907. // It occurs in case that the node does not have origin in original code.
  15908. if (m.originalLine == null) return
  15909. var origPosInOldMap = oldMapConsumer.originalPositionFor({
  15910. line: m.originalLine,
  15911. column: m.originalColumn
  15912. });
  15913. if (origPosInOldMap.source == null) return
  15914. mergedMapGenerator.addMapping({
  15915. original: {
  15916. line: origPosInOldMap.line,
  15917. column: origPosInOldMap.column
  15918. },
  15919. generated: {
  15920. line: m.generatedLine,
  15921. column: m.generatedColumn
  15922. },
  15923. source: origPosInOldMap.source,
  15924. name: origPosInOldMap.name
  15925. });
  15926. });
  15927. var consumers = [oldMapConsumer, newMapConsumer];
  15928. consumers.forEach(function(consumer) {
  15929. consumer.sources.forEach(function(sourceFile) {
  15930. mergedMapGenerator._sources.add(sourceFile);
  15931. var sourceContent = consumer.sourceContentFor(sourceFile);
  15932. if (sourceContent != null) {
  15933. mergedMapGenerator.setSourceContent(sourceFile, sourceContent);
  15934. }
  15935. });
  15936. });
  15937. mergedMapGenerator._sourceRoot = oldMap.sourceRoot;
  15938. mergedMapGenerator._file = oldMap.file;
  15939. return JSON.parse(mergedMapGenerator.toString())
  15940. }
  15941. // .scss/.sass processor
  15942. const scss = (source, map, options) => {
  15943. const nodeSass = require('sass');
  15944. const finalOptions = Object.assign(Object.assign({}, options), { data: getSource(source, options.filename, options.additionalData), file: options.filename, outFile: options.filename, sourceMap: !!map });
  15945. try {
  15946. const result = nodeSass.renderSync(finalOptions);
  15947. const dependencies = result.stats.includedFiles;
  15948. if (map) {
  15949. return {
  15950. code: result.css.toString(),
  15951. map: mergeSourceMap(map, JSON.parse(result.map.toString())),
  15952. errors: [],
  15953. dependencies
  15954. };
  15955. }
  15956. return { code: result.css.toString(), errors: [], dependencies };
  15957. }
  15958. catch (e) {
  15959. return { code: '', errors: [e], dependencies: [] };
  15960. }
  15961. };
  15962. const sass = (source, map, options) => scss(source, map, Object.assign(Object.assign({}, options), { indentedSyntax: true }));
  15963. // .less
  15964. const less = (source, map, options) => {
  15965. const nodeLess = require('less');
  15966. let result;
  15967. let error = null;
  15968. nodeLess.render(getSource(source, options.filename, options.additionalData), Object.assign(Object.assign({}, options), { syncImport: true }), (err, output) => {
  15969. error = err;
  15970. result = output;
  15971. });
  15972. if (error)
  15973. return { code: '', errors: [error], dependencies: [] };
  15974. const dependencies = result.imports;
  15975. if (map) {
  15976. return {
  15977. code: result.css.toString(),
  15978. map: mergeSourceMap(map, result.map),
  15979. errors: [],
  15980. dependencies: dependencies
  15981. };
  15982. }
  15983. return {
  15984. code: result.css.toString(),
  15985. errors: [],
  15986. dependencies: dependencies
  15987. };
  15988. };
  15989. // .styl
  15990. const styl = (source, map, options) => {
  15991. const nodeStylus = require('stylus');
  15992. try {
  15993. const ref = nodeStylus(source);
  15994. Object.keys(options).forEach(key => ref.set(key, options[key]));
  15995. if (map)
  15996. ref.set('sourcemap', { inline: false, comment: false });
  15997. const result = ref.render();
  15998. const dependencies = ref.deps();
  15999. if (map) {
  16000. return {
  16001. code: result,
  16002. map: mergeSourceMap(map, ref.sourcemap),
  16003. errors: [],
  16004. dependencies
  16005. };
  16006. }
  16007. return { code: result, errors: [], dependencies };
  16008. }
  16009. catch (e) {
  16010. return { code: '', errors: [e], dependencies: [] };
  16011. }
  16012. };
  16013. function getSource(source, filename, additionalData) {
  16014. if (!additionalData)
  16015. return source;
  16016. if (isFunction(additionalData)) {
  16017. return additionalData(source, filename);
  16018. }
  16019. return additionalData + source;
  16020. }
  16021. const processors = {
  16022. less,
  16023. sass,
  16024. scss,
  16025. styl,
  16026. stylus: styl
  16027. };
  16028. const postcss = require('postcss');
  16029. function compileStyle(options) {
  16030. return doCompileStyle(Object.assign(Object.assign({}, options), { isAsync: false }));
  16031. }
  16032. function compileStyleAsync(options) {
  16033. return Promise.resolve(doCompileStyle(Object.assign(Object.assign({}, options), { isAsync: true })));
  16034. }
  16035. function doCompileStyle(options) {
  16036. const { filename, id, scoped = true, trim = true, isProd = false, preprocessLang, postcssOptions, postcssPlugins } = options;
  16037. const preprocessor = preprocessLang && processors[preprocessLang];
  16038. const preProcessedSource = preprocessor && preprocess(options, preprocessor);
  16039. const map = preProcessedSource ? preProcessedSource.map : options.map;
  16040. const source = preProcessedSource ? preProcessedSource.code : options.source;
  16041. const plugins = (postcssPlugins || []).slice();
  16042. plugins.unshift(cssVarsPlugin({ id: id.replace(/^data-v-/, ''), isProd }));
  16043. if (trim) {
  16044. plugins.push(trimPlugin());
  16045. }
  16046. if (scoped) {
  16047. plugins.push(scopedPlugin(id));
  16048. }
  16049. const postCSSOptions = Object.assign(Object.assign({}, postcssOptions), { to: filename, from: filename });
  16050. if (map) {
  16051. postCSSOptions.map = {
  16052. inline: false,
  16053. annotation: false,
  16054. prev: map
  16055. };
  16056. }
  16057. let result, code, outMap;
  16058. const errors = [];
  16059. if (preProcessedSource && preProcessedSource.errors.length) {
  16060. errors.push(...preProcessedSource.errors);
  16061. }
  16062. try {
  16063. result = postcss(plugins).process(source, postCSSOptions);
  16064. // In async mode, return a promise.
  16065. if (options.isAsync) {
  16066. return result
  16067. .then((result) => ({
  16068. code: result.css || '',
  16069. map: result.map && result.map.toJSON(),
  16070. errors,
  16071. rawResult: result
  16072. }))
  16073. .catch((error) => ({
  16074. code: '',
  16075. map: undefined,
  16076. errors: [...errors, error.message],
  16077. rawResult: undefined
  16078. }));
  16079. }
  16080. // force synchronous transform (we know we only have sync plugins)
  16081. code = result.css;
  16082. outMap = result.map;
  16083. }
  16084. catch (e) {
  16085. errors.push(e);
  16086. }
  16087. return {
  16088. code: code || ``,
  16089. map: outMap && outMap.toJSON(),
  16090. errors,
  16091. rawResult: result
  16092. };
  16093. }
  16094. function preprocess(options, preprocessor) {
  16095. return preprocessor(options.source, options.map, Object.assign({
  16096. filename: options.filename
  16097. }, options.preprocessOptions));
  16098. }
  16099. exports.compileScript = compileScript;
  16100. exports.compileStyle = compileStyle;
  16101. exports.compileStyleAsync = compileStyleAsync;
  16102. exports.compileTemplate = compileTemplate;
  16103. exports.generateCodeFrame = generateCodeFrame;
  16104. exports.parse = parse;
  16105. exports.parseComponent = parseComponent;
  16106. exports.rewriteDefault = rewriteDefault;