paged.polyfill.js 900 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251
  1. /**
  2. * @license Paged.js v0.4.3 | MIT | https://gitlab.coko.foundation/pagedjs/pagedjs
  3. */
  4. (function (global, factory) {
  5. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  6. typeof define === 'function' && define.amd ? define(factory) :
  7. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.PagedPolyfill = factory());
  8. })(this, (function () { 'use strict';
  9. function getDefaultExportFromCjs (x) {
  10. return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
  11. }
  12. var eventEmitter = {exports: {}};
  13. var d$2 = {exports: {}};
  14. var isImplemented$6 = function () {
  15. var assign = Object.assign, obj;
  16. if (typeof assign !== "function") return false;
  17. obj = { foo: "raz" };
  18. assign(obj, { bar: "dwa" }, { trzy: "trzy" });
  19. return (obj.foo + obj.bar + obj.trzy) === "razdwatrzy";
  20. };
  21. var isImplemented$5;
  22. var hasRequiredIsImplemented$1;
  23. function requireIsImplemented$1 () {
  24. if (hasRequiredIsImplemented$1) return isImplemented$5;
  25. hasRequiredIsImplemented$1 = 1;
  26. isImplemented$5 = function () {
  27. try {
  28. Object.keys("primitive");
  29. return true;
  30. } catch (e) {
  31. return false;
  32. }
  33. };
  34. return isImplemented$5;
  35. }
  36. // eslint-disable-next-line no-empty-function
  37. var noop$4 = function () {};
  38. var _undefined = noop$4(); // Support ES3 engines
  39. var isValue$3 = function (val) {
  40. return (val !== _undefined) && (val !== null);
  41. };
  42. var shim$5;
  43. var hasRequiredShim$5;
  44. function requireShim$5 () {
  45. if (hasRequiredShim$5) return shim$5;
  46. hasRequiredShim$5 = 1;
  47. var isValue = isValue$3;
  48. var keys = Object.keys;
  49. shim$5 = function (object) {
  50. return keys(isValue(object) ? Object(object) : object);
  51. };
  52. return shim$5;
  53. }
  54. var keys;
  55. var hasRequiredKeys;
  56. function requireKeys () {
  57. if (hasRequiredKeys) return keys;
  58. hasRequiredKeys = 1;
  59. keys = requireIsImplemented$1()()
  60. ? Object.keys
  61. : requireShim$5();
  62. return keys;
  63. }
  64. var isValue$2 = isValue$3;
  65. var validValue = function (value) {
  66. if (!isValue$2(value)) throw new TypeError("Cannot use null or undefined");
  67. return value;
  68. };
  69. var shim$4;
  70. var hasRequiredShim$4;
  71. function requireShim$4 () {
  72. if (hasRequiredShim$4) return shim$4;
  73. hasRequiredShim$4 = 1;
  74. var keys = requireKeys()
  75. , value = validValue
  76. , max = Math.max;
  77. shim$4 = function (dest, src /*, …srcn*/) {
  78. var error, i, length = max(arguments.length, 2), assign;
  79. dest = Object(value(dest));
  80. assign = function (key) {
  81. try {
  82. dest[key] = src[key];
  83. } catch (e) {
  84. if (!error) error = e;
  85. }
  86. };
  87. for (i = 1; i < length; ++i) {
  88. src = arguments[i];
  89. keys(src).forEach(assign);
  90. }
  91. if (error !== undefined) throw error;
  92. return dest;
  93. };
  94. return shim$4;
  95. }
  96. var assign$2 = isImplemented$6()
  97. ? Object.assign
  98. : requireShim$4();
  99. var isValue$1 = isValue$3;
  100. var forEach$1 = Array.prototype.forEach, create$5 = Object.create;
  101. var process = function (src, obj) {
  102. var key;
  103. for (key in src) obj[key] = src[key];
  104. };
  105. // eslint-disable-next-line no-unused-vars
  106. var normalizeOptions = function (opts1 /*, …options*/) {
  107. var result = create$5(null);
  108. forEach$1.call(arguments, function (options) {
  109. if (!isValue$1(options)) return;
  110. process(Object(options), result);
  111. });
  112. return result;
  113. };
  114. var isCallable$1 = function (obj) {
  115. return typeof obj === "function";
  116. };
  117. var str = "razdwatrzy";
  118. var isImplemented$4 = function () {
  119. if (typeof str.contains !== "function") return false;
  120. return (str.contains("dwa") === true) && (str.contains("foo") === false);
  121. };
  122. var shim$3;
  123. var hasRequiredShim$3;
  124. function requireShim$3 () {
  125. if (hasRequiredShim$3) return shim$3;
  126. hasRequiredShim$3 = 1;
  127. var indexOf = String.prototype.indexOf;
  128. shim$3 = function (searchString/*, position*/) {
  129. return indexOf.call(this, searchString, arguments[1]) > -1;
  130. };
  131. return shim$3;
  132. }
  133. var contains$1 = isImplemented$4()
  134. ? String.prototype.contains
  135. : requireShim$3();
  136. var assign$1 = assign$2
  137. , normalizeOpts = normalizeOptions
  138. , isCallable = isCallable$1
  139. , contains = contains$1
  140. , d$1;
  141. d$1 = d$2.exports = function (dscr, value/*, options*/) {
  142. var c, e, w, options, desc;
  143. if ((arguments.length < 2) || (typeof dscr !== 'string')) {
  144. options = value;
  145. value = dscr;
  146. dscr = null;
  147. } else {
  148. options = arguments[2];
  149. }
  150. if (dscr == null) {
  151. c = w = true;
  152. e = false;
  153. } else {
  154. c = contains.call(dscr, 'c');
  155. e = contains.call(dscr, 'e');
  156. w = contains.call(dscr, 'w');
  157. }
  158. desc = { value: value, configurable: c, enumerable: e, writable: w };
  159. return !options ? desc : assign$1(normalizeOpts(options), desc);
  160. };
  161. d$1.gs = function (dscr, get, set/*, options*/) {
  162. var c, e, options, desc;
  163. if (typeof dscr !== 'string') {
  164. options = set;
  165. set = get;
  166. get = dscr;
  167. dscr = null;
  168. } else {
  169. options = arguments[3];
  170. }
  171. if (get == null) {
  172. get = undefined;
  173. } else if (!isCallable(get)) {
  174. options = get;
  175. get = set = undefined;
  176. } else if (set == null) {
  177. set = undefined;
  178. } else if (!isCallable(set)) {
  179. options = set;
  180. set = undefined;
  181. }
  182. if (dscr == null) {
  183. c = true;
  184. e = false;
  185. } else {
  186. c = contains.call(dscr, 'c');
  187. e = contains.call(dscr, 'e');
  188. }
  189. desc = { get: get, set: set, configurable: c, enumerable: e };
  190. return !options ? desc : assign$1(normalizeOpts(options), desc);
  191. };
  192. var dExports = d$2.exports;
  193. var validCallable = function (fn) {
  194. if (typeof fn !== "function") throw new TypeError(fn + " is not a function");
  195. return fn;
  196. };
  197. (function (module, exports) {
  198. var d = dExports
  199. , callable = validCallable
  200. , apply = Function.prototype.apply, call = Function.prototype.call
  201. , create = Object.create, defineProperty = Object.defineProperty
  202. , defineProperties = Object.defineProperties
  203. , hasOwnProperty = Object.prototype.hasOwnProperty
  204. , descriptor = { configurable: true, enumerable: false, writable: true }
  205. , on, once, off, emit, methods, descriptors, base;
  206. on = function (type, listener) {
  207. var data;
  208. callable(listener);
  209. if (!hasOwnProperty.call(this, '__ee__')) {
  210. data = descriptor.value = create(null);
  211. defineProperty(this, '__ee__', descriptor);
  212. descriptor.value = null;
  213. } else {
  214. data = this.__ee__;
  215. }
  216. if (!data[type]) data[type] = listener;
  217. else if (typeof data[type] === 'object') data[type].push(listener);
  218. else data[type] = [data[type], listener];
  219. return this;
  220. };
  221. once = function (type, listener) {
  222. var once, self;
  223. callable(listener);
  224. self = this;
  225. on.call(this, type, once = function () {
  226. off.call(self, type, once);
  227. apply.call(listener, this, arguments);
  228. });
  229. once.__eeOnceListener__ = listener;
  230. return this;
  231. };
  232. off = function (type, listener) {
  233. var data, listeners, candidate, i;
  234. callable(listener);
  235. if (!hasOwnProperty.call(this, '__ee__')) return this;
  236. data = this.__ee__;
  237. if (!data[type]) return this;
  238. listeners = data[type];
  239. if (typeof listeners === 'object') {
  240. for (i = 0; (candidate = listeners[i]); ++i) {
  241. if ((candidate === listener) ||
  242. (candidate.__eeOnceListener__ === listener)) {
  243. if (listeners.length === 2) data[type] = listeners[i ? 0 : 1];
  244. else listeners.splice(i, 1);
  245. }
  246. }
  247. } else {
  248. if ((listeners === listener) ||
  249. (listeners.__eeOnceListener__ === listener)) {
  250. delete data[type];
  251. }
  252. }
  253. return this;
  254. };
  255. emit = function (type) {
  256. var i, l, listener, listeners, args;
  257. if (!hasOwnProperty.call(this, '__ee__')) return;
  258. listeners = this.__ee__[type];
  259. if (!listeners) return;
  260. if (typeof listeners === 'object') {
  261. l = arguments.length;
  262. args = new Array(l - 1);
  263. for (i = 1; i < l; ++i) args[i - 1] = arguments[i];
  264. listeners = listeners.slice();
  265. for (i = 0; (listener = listeners[i]); ++i) {
  266. apply.call(listener, this, args);
  267. }
  268. } else {
  269. switch (arguments.length) {
  270. case 1:
  271. call.call(listeners, this);
  272. break;
  273. case 2:
  274. call.call(listeners, this, arguments[1]);
  275. break;
  276. case 3:
  277. call.call(listeners, this, arguments[1], arguments[2]);
  278. break;
  279. default:
  280. l = arguments.length;
  281. args = new Array(l - 1);
  282. for (i = 1; i < l; ++i) {
  283. args[i - 1] = arguments[i];
  284. }
  285. apply.call(listeners, this, args);
  286. }
  287. }
  288. };
  289. methods = {
  290. on: on,
  291. once: once,
  292. off: off,
  293. emit: emit
  294. };
  295. descriptors = {
  296. on: d(on),
  297. once: d(once),
  298. off: d(off),
  299. emit: d(emit)
  300. };
  301. base = defineProperties({}, descriptors);
  302. module.exports = exports = function (o) {
  303. return (o == null) ? create(base) : defineProperties(Object(o), descriptors);
  304. };
  305. exports.methods = methods;
  306. } (eventEmitter, eventEmitter.exports));
  307. var eventEmitterExports = eventEmitter.exports;
  308. var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventEmitterExports);
  309. /**
  310. * Hooks allow for injecting functions that must all complete in order before finishing
  311. * They will execute in parallel but all must finish before continuing
  312. * Functions may return a promise if they are asycn.
  313. * From epubjs/src/utils/hooks
  314. * @param {any} context scope of this
  315. * @example this.content = new Hook(this);
  316. */
  317. class Hook {
  318. constructor(context){
  319. this.context = context || this;
  320. this.hooks = [];
  321. }
  322. /**
  323. * Adds a function to be run before a hook completes
  324. * @example this.content.register(function(){...});
  325. * @return {undefined} void
  326. */
  327. register(){
  328. for(var i = 0; i < arguments.length; ++i) {
  329. if (typeof arguments[i] === "function") {
  330. this.hooks.push(arguments[i]);
  331. } else {
  332. // unpack array
  333. for(var j = 0; j < arguments[i].length; ++j) {
  334. this.hooks.push(arguments[i][j]);
  335. }
  336. }
  337. }
  338. }
  339. /**
  340. * Triggers a hook to run all functions
  341. * @example this.content.trigger(args).then(function(){...});
  342. * @return {Promise} results
  343. */
  344. trigger(){
  345. var args = arguments;
  346. var context = this.context;
  347. var promises = [];
  348. this.hooks.forEach(function(task) {
  349. var executing = task.apply(context, args);
  350. if(executing && typeof executing["then"] === "function") {
  351. // Task is a function that returns a promise
  352. promises.push(executing);
  353. } else {
  354. // Otherwise Task resolves immediately, add resolved promise with result
  355. promises.push(new Promise((resolve, reject) => {
  356. resolve(executing);
  357. }));
  358. }
  359. });
  360. return Promise.all(promises);
  361. }
  362. /**
  363. * Triggers a hook to run all functions synchronously
  364. * @example this.content.trigger(args).then(function(){...});
  365. * @return {Array} results
  366. */
  367. triggerSync(){
  368. var args = arguments;
  369. var context = this.context;
  370. var results = [];
  371. this.hooks.forEach(function(task) {
  372. var executing = task.apply(context, args);
  373. results.push(executing);
  374. });
  375. return results;
  376. }
  377. // Adds a function to be run before a hook completes
  378. list(){
  379. return this.hooks;
  380. }
  381. clear(){
  382. return this.hooks = [];
  383. }
  384. }
  385. function getBoundingClientRect(element) {
  386. if (!element) {
  387. return;
  388. }
  389. let rect;
  390. if (typeof element.getBoundingClientRect !== "undefined") {
  391. rect = element.getBoundingClientRect();
  392. } else {
  393. let range = document.createRange();
  394. range.selectNode(element);
  395. rect = range.getBoundingClientRect();
  396. }
  397. return rect;
  398. }
  399. function getClientRects(element) {
  400. if (!element) {
  401. return;
  402. }
  403. let rect;
  404. if (typeof element.getClientRects !== "undefined") {
  405. rect = element.getClientRects();
  406. } else {
  407. let range = document.createRange();
  408. range.selectNode(element);
  409. rect = range.getClientRects();
  410. }
  411. return rect;
  412. }
  413. /**
  414. * Generates a UUID
  415. * based on: http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
  416. * @returns {string} uuid
  417. */
  418. function UUID() {
  419. var d = new Date().getTime();
  420. if (typeof performance !== "undefined" && typeof performance.now === "function") {
  421. d += performance.now(); //use high-precision timer if available
  422. }
  423. return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
  424. var r = (d + Math.random() * 16) % 16 | 0;
  425. d = Math.floor(d / 16);
  426. return (c === "x" ? r : (r & 0x3 | 0x8)).toString(16);
  427. });
  428. }
  429. function attr(element, attributes) {
  430. for (var i = 0; i < attributes.length; i++) {
  431. if (element.hasAttribute(attributes[i])) {
  432. return element.getAttribute(attributes[i]);
  433. }
  434. }
  435. }
  436. /* Based on by https://mths.be/cssescape v1.5.1 by @mathias | MIT license
  437. * Allows # and .
  438. */
  439. function querySelectorEscape(value) {
  440. if (arguments.length == 0) {
  441. throw new TypeError("`CSS.escape` requires an argument.");
  442. }
  443. var string = String(value);
  444. var length = string.length;
  445. var index = -1;
  446. var codeUnit;
  447. var result = "";
  448. var firstCodeUnit = string.charCodeAt(0);
  449. while (++index < length) {
  450. codeUnit = string.charCodeAt(index);
  451. // Note: there’s no need to special-case astral symbols, surrogate
  452. // pairs, or lone surrogates.
  453. // If the character is NULL (U+0000), then the REPLACEMENT CHARACTER
  454. // (U+FFFD).
  455. if (codeUnit == 0x0000) {
  456. result += "\uFFFD";
  457. continue;
  458. }
  459. if (
  460. // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
  461. // U+007F, […]
  462. (codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F ||
  463. // If the character is the first character and is in the range [0-9]
  464. // (U+0030 to U+0039), […]
  465. (index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
  466. // If the character is the second character and is in the range [0-9]
  467. // (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
  468. (
  469. index == 1 &&
  470. codeUnit >= 0x0030 && codeUnit <= 0x0039 &&
  471. firstCodeUnit == 0x002D
  472. )
  473. ) {
  474. // https://drafts.csswg.org/cssom/#escape-a-character-as-code-point
  475. result += "\\" + codeUnit.toString(16) + " ";
  476. continue;
  477. }
  478. if (
  479. // If the character is the first character and is a `-` (U+002D), and
  480. // there is no second character, […]
  481. index == 0 &&
  482. length == 1 &&
  483. codeUnit == 0x002D
  484. ) {
  485. result += "\\" + string.charAt(index);
  486. continue;
  487. }
  488. // support for period character in id
  489. if (codeUnit == 0x002E) {
  490. if (string.charAt(0) == "#") {
  491. result += "\\.";
  492. continue;
  493. }
  494. }
  495. // If the character is not handled by one of the above rules and is
  496. // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or
  497. // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
  498. // U+005A), or [a-z] (U+0061 to U+007A), […]
  499. if (
  500. codeUnit >= 0x0080 ||
  501. codeUnit == 0x002D ||
  502. codeUnit == 0x005F ||
  503. codeUnit == 35 || // Allow #
  504. codeUnit == 46 || // Allow .
  505. codeUnit >= 0x0030 && codeUnit <= 0x0039 ||
  506. codeUnit >= 0x0041 && codeUnit <= 0x005A ||
  507. codeUnit >= 0x0061 && codeUnit <= 0x007A
  508. ) {
  509. // the character itself
  510. result += string.charAt(index);
  511. continue;
  512. }
  513. // Otherwise, the escaped character.
  514. // https://drafts.csswg.org/cssom/#escape-a-character
  515. result += "\\" + string.charAt(index);
  516. }
  517. return result;
  518. }
  519. /**
  520. * Creates a new pending promise and provides methods to resolve or reject it.
  521. * From: https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred#backwards_forwards_compatible
  522. * @returns {object} defered
  523. */
  524. function defer() {
  525. this.resolve = null;
  526. this.reject = null;
  527. this.id = UUID();
  528. this.promise = new Promise((resolve, reject) => {
  529. this.resolve = resolve;
  530. this.reject = reject;
  531. });
  532. Object.freeze(this);
  533. }
  534. const requestIdleCallback = typeof window !== "undefined" && ("requestIdleCallback" in window ? window.requestIdleCallback : window.requestAnimationFrame);
  535. function CSSValueToString(obj) {
  536. return obj.value + (obj.unit || "");
  537. }
  538. function isElement(node) {
  539. return node && node.nodeType === 1;
  540. }
  541. function isText(node) {
  542. return node && node.nodeType === 3;
  543. }
  544. function* walk$2(start, limiter) {
  545. let node = start;
  546. while (node) {
  547. yield node;
  548. if (node.childNodes.length) {
  549. node = node.firstChild;
  550. } else if (node.nextSibling) {
  551. if (limiter && node === limiter) {
  552. node = undefined;
  553. break;
  554. }
  555. node = node.nextSibling;
  556. } else {
  557. while (node) {
  558. node = node.parentNode;
  559. if (limiter && node === limiter) {
  560. node = undefined;
  561. break;
  562. }
  563. if (node && node.nextSibling) {
  564. node = node.nextSibling;
  565. break;
  566. }
  567. }
  568. }
  569. }
  570. }
  571. function nodeAfter(node, limiter) {
  572. if (limiter && node === limiter) {
  573. return;
  574. }
  575. let significantNode = nextSignificantNode(node);
  576. if (significantNode) {
  577. return significantNode;
  578. }
  579. if (node.parentNode) {
  580. while ((node = node.parentNode)) {
  581. if (limiter && node === limiter) {
  582. return;
  583. }
  584. significantNode = nextSignificantNode(node);
  585. if (significantNode) {
  586. return significantNode;
  587. }
  588. }
  589. }
  590. }
  591. function nodeBefore(node, limiter) {
  592. if (limiter && node === limiter) {
  593. return;
  594. }
  595. let significantNode = previousSignificantNode(node);
  596. if (significantNode) {
  597. return significantNode;
  598. }
  599. if (node.parentNode) {
  600. while ((node = node.parentNode)) {
  601. if (limiter && node === limiter) {
  602. return;
  603. }
  604. significantNode = previousSignificantNode(node);
  605. if (significantNode) {
  606. return significantNode;
  607. }
  608. }
  609. }
  610. }
  611. function elementAfter(node, limiter) {
  612. let after = nodeAfter(node, limiter);
  613. while (after && after.nodeType !== 1) {
  614. after = nodeAfter(after, limiter);
  615. }
  616. return after;
  617. }
  618. function elementBefore(node, limiter) {
  619. let before = nodeBefore(node, limiter);
  620. while (before && before.nodeType !== 1) {
  621. before = nodeBefore(before, limiter);
  622. }
  623. return before;
  624. }
  625. function displayedElementAfter(node, limiter) {
  626. let after = elementAfter(node, limiter);
  627. while (after && after.dataset.undisplayed) {
  628. after = elementAfter(after, limiter);
  629. }
  630. return after;
  631. }
  632. function displayedElementBefore(node, limiter) {
  633. let before = elementBefore(node, limiter);
  634. while (before && before.dataset.undisplayed) {
  635. before = elementBefore(before, limiter);
  636. }
  637. return before;
  638. }
  639. function rebuildAncestors(node) {
  640. let parent, ancestor;
  641. let ancestors = [];
  642. let added = [];
  643. let fragment = document.createDocumentFragment();
  644. // Handle rowspan on table
  645. if (node.nodeName === "TR") {
  646. let previousRow = node.previousElementSibling;
  647. let previousRowDistance = 1;
  648. while (previousRow) {
  649. // previous row has more columns, might indicate a rowspan.
  650. if (previousRow.childElementCount > node.childElementCount) {
  651. const initialColumns = Array.from(node.children);
  652. while (node.firstChild) {
  653. node.firstChild.remove();
  654. }
  655. let k = 0;
  656. for (let j = 0; j < previousRow.children.length; j++) {
  657. let column = previousRow.children[j];
  658. if (column.rowSpan && column.rowSpan > previousRowDistance) {
  659. const duplicatedColumn = column.cloneNode(true);
  660. // Adjust rowspan value
  661. duplicatedColumn.rowSpan = column.rowSpan - previousRowDistance;
  662. // Add the column to the row
  663. node.appendChild(duplicatedColumn);
  664. } else {
  665. // Fill the gap with the initial columns (if exists)
  666. const initialColumn = initialColumns[k++];
  667. // The initial column can be undefined if the newly created table has less columns than the original table
  668. if (initialColumn) {
  669. node.appendChild(initialColumn);
  670. }
  671. }
  672. }
  673. }
  674. previousRow = previousRow.previousElementSibling;
  675. previousRowDistance++;
  676. }
  677. }
  678. // Gather all ancestors
  679. let element = node;
  680. while(element.parentNode && element.parentNode.nodeType === 1) {
  681. ancestors.unshift(element.parentNode);
  682. element = element.parentNode;
  683. }
  684. for (var i = 0; i < ancestors.length; i++) {
  685. ancestor = ancestors[i];
  686. parent = ancestor.cloneNode(false);
  687. parent.setAttribute("data-split-from", parent.getAttribute("data-ref"));
  688. // ancestor.setAttribute("data-split-to", parent.getAttribute("data-ref"));
  689. if (parent.hasAttribute("id")) {
  690. let dataID = parent.getAttribute("id");
  691. parent.setAttribute("data-id", dataID);
  692. parent.removeAttribute("id");
  693. }
  694. // This is handled by css :not, but also tidied up here
  695. if (parent.hasAttribute("data-break-before")) {
  696. parent.removeAttribute("data-break-before");
  697. }
  698. if (parent.hasAttribute("data-previous-break-after")) {
  699. parent.removeAttribute("data-previous-break-after");
  700. }
  701. if (added.length) {
  702. let container = added[added.length-1];
  703. container.appendChild(parent);
  704. } else {
  705. fragment.appendChild(parent);
  706. }
  707. added.push(parent);
  708. // rebuild table rows
  709. if (parent.nodeName === "TD" && ancestor.parentElement.contains(ancestor)) {
  710. let td = ancestor;
  711. let prev = parent;
  712. while ((td = td.previousElementSibling)) {
  713. let sib = td.cloneNode(false);
  714. parent.parentElement.insertBefore(sib, prev);
  715. prev = sib;
  716. }
  717. }
  718. }
  719. added = undefined;
  720. return fragment;
  721. }
  722. /*
  723. export function split(bound, cutElement, breakAfter) {
  724. let needsRemoval = [];
  725. let index = indexOf(cutElement);
  726. if (!breakAfter && index === 0) {
  727. return;
  728. }
  729. if (breakAfter && index === (cutElement.parentNode.children.length - 1)) {
  730. return;
  731. }
  732. // Create a fragment with rebuilt ancestors
  733. let fragment = rebuildAncestors(cutElement);
  734. // Clone cut
  735. if (!breakAfter) {
  736. let clone = cutElement.cloneNode(true);
  737. let ref = cutElement.parentNode.getAttribute('data-ref');
  738. let parent = fragment.querySelector("[data-ref='" + ref + "']");
  739. parent.appendChild(clone);
  740. needsRemoval.push(cutElement);
  741. }
  742. // Remove all after cut
  743. let next = nodeAfter(cutElement, bound);
  744. while (next) {
  745. let clone = next.cloneNode(true);
  746. let ref = next.parentNode.getAttribute('data-ref');
  747. let parent = fragment.querySelector("[data-ref='" + ref + "']");
  748. parent.appendChild(clone);
  749. needsRemoval.push(next);
  750. next = nodeAfter(next, bound);
  751. }
  752. // Remove originals
  753. needsRemoval.forEach((node) => {
  754. if (node) {
  755. node.remove();
  756. }
  757. });
  758. // Insert after bounds
  759. bound.parentNode.insertBefore(fragment, bound.nextSibling);
  760. return [bound, bound.nextSibling];
  761. }
  762. */
  763. function needsBreakBefore(node) {
  764. if( typeof node !== "undefined" &&
  765. typeof node.dataset !== "undefined" &&
  766. typeof node.dataset.breakBefore !== "undefined" &&
  767. (node.dataset.breakBefore === "always" ||
  768. node.dataset.breakBefore === "page" ||
  769. node.dataset.breakBefore === "left" ||
  770. node.dataset.breakBefore === "right" ||
  771. node.dataset.breakBefore === "recto" ||
  772. node.dataset.breakBefore === "verso")
  773. ) {
  774. return true;
  775. }
  776. return false;
  777. }
  778. function needsPreviousBreakAfter(node) {
  779. if( typeof node !== "undefined" &&
  780. typeof node.dataset !== "undefined" &&
  781. typeof node.dataset.previousBreakAfter !== "undefined" &&
  782. (node.dataset.previousBreakAfter === "always" ||
  783. node.dataset.previousBreakAfter === "page" ||
  784. node.dataset.previousBreakAfter === "left" ||
  785. node.dataset.previousBreakAfter === "right" ||
  786. node.dataset.previousBreakAfter === "recto" ||
  787. node.dataset.previousBreakAfter === "verso")
  788. ) {
  789. return true;
  790. }
  791. return false;
  792. }
  793. function needsPageBreak(node, previousSignificantNode) {
  794. if (typeof node === "undefined" || !previousSignificantNode || isIgnorable(node)) {
  795. return false;
  796. }
  797. if (node.dataset && node.dataset.undisplayed) {
  798. return false;
  799. }
  800. let previousSignificantNodePage = previousSignificantNode.dataset ? previousSignificantNode.dataset.page : undefined;
  801. if (typeof previousSignificantNodePage === "undefined") {
  802. const nodeWithNamedPage = getNodeWithNamedPage(previousSignificantNode);
  803. if (nodeWithNamedPage) {
  804. previousSignificantNodePage = nodeWithNamedPage.dataset.page;
  805. }
  806. }
  807. let currentNodePage = node.dataset ? node.dataset.page : undefined;
  808. if (typeof currentNodePage === "undefined") {
  809. const nodeWithNamedPage = getNodeWithNamedPage(node, previousSignificantNode);
  810. if (nodeWithNamedPage) {
  811. currentNodePage = nodeWithNamedPage.dataset.page;
  812. }
  813. }
  814. return currentNodePage !== previousSignificantNodePage;
  815. }
  816. function *words(node) {
  817. let currentText = node.nodeValue;
  818. let max = currentText.length;
  819. let currentOffset = 0;
  820. let currentLetter;
  821. let range;
  822. const significantWhitespaces = node.parentElement && node.parentElement.nodeName === "PRE";
  823. while (currentOffset < max) {
  824. currentLetter = currentText[currentOffset];
  825. if (/^[\S\u202F\u00A0]$/.test(currentLetter) || significantWhitespaces) {
  826. if (!range) {
  827. range = document.createRange();
  828. range.setStart(node, currentOffset);
  829. }
  830. } else {
  831. if (range) {
  832. range.setEnd(node, currentOffset);
  833. yield range;
  834. range = undefined;
  835. }
  836. }
  837. currentOffset += 1;
  838. }
  839. if (range) {
  840. range.setEnd(node, currentOffset);
  841. yield range;
  842. }
  843. }
  844. function *letters(wordRange) {
  845. let currentText = wordRange.startContainer;
  846. let max = currentText.length;
  847. let currentOffset = wordRange.startOffset;
  848. // let currentLetter;
  849. let range;
  850. while(currentOffset < max) {
  851. // currentLetter = currentText[currentOffset];
  852. range = document.createRange();
  853. range.setStart(currentText, currentOffset);
  854. range.setEnd(currentText, currentOffset+1);
  855. yield range;
  856. currentOffset += 1;
  857. }
  858. }
  859. function isContainer(node) {
  860. let container;
  861. if (typeof node.tagName === "undefined") {
  862. return true;
  863. }
  864. if (node.style && node.style.display === "none") {
  865. return false;
  866. }
  867. switch (node.tagName) {
  868. // Inline
  869. case "A":
  870. case "ABBR":
  871. case "ACRONYM":
  872. case "B":
  873. case "BDO":
  874. case "BIG":
  875. case "BR":
  876. case "BUTTON":
  877. case "CITE":
  878. case "CODE":
  879. case "DFN":
  880. case "EM":
  881. case "I":
  882. case "IMG":
  883. case "INPUT":
  884. case "KBD":
  885. case "LABEL":
  886. case "MAP":
  887. case "OBJECT":
  888. case "Q":
  889. case "SAMP":
  890. case "SCRIPT":
  891. case "SELECT":
  892. case "SMALL":
  893. case "SPAN":
  894. case "STRONG":
  895. case "SUB":
  896. case "SUP":
  897. case "TEXTAREA":
  898. case "TIME":
  899. case "TT":
  900. case "VAR":
  901. case "P":
  902. case "H1":
  903. case "H2":
  904. case "H3":
  905. case "H4":
  906. case "H5":
  907. case "H6":
  908. case "FIGCAPTION":
  909. case "BLOCKQUOTE":
  910. case "PRE":
  911. case "LI":
  912. case "TD":
  913. case "DT":
  914. case "DD":
  915. case "VIDEO":
  916. case "CANVAS":
  917. container = false;
  918. break;
  919. default:
  920. container = true;
  921. }
  922. return container;
  923. }
  924. function cloneNode(n, deep=false) {
  925. return n.cloneNode(deep);
  926. }
  927. function findElement(node, doc, forceQuery) {
  928. const ref = node.getAttribute("data-ref");
  929. return findRef(ref, doc, forceQuery);
  930. }
  931. function findRef(ref, doc, forceQuery) {
  932. if (!forceQuery && doc.indexOfRefs && doc.indexOfRefs[ref]) {
  933. return doc.indexOfRefs[ref];
  934. } else {
  935. return doc.querySelector(`[data-ref='${ref}']`);
  936. }
  937. }
  938. function validNode(node) {
  939. if (isText(node)) {
  940. return true;
  941. }
  942. if (isElement(node) && node.dataset.ref) {
  943. return true;
  944. }
  945. return false;
  946. }
  947. function prevValidNode(node) {
  948. while (!validNode(node)) {
  949. if (node.previousSibling) {
  950. node = node.previousSibling;
  951. } else {
  952. node = node.parentNode;
  953. }
  954. if (!node) {
  955. break;
  956. }
  957. }
  958. return node;
  959. }
  960. function indexOf$2(node) {
  961. let parent = node.parentNode;
  962. if (!parent) {
  963. return 0;
  964. }
  965. return Array.prototype.indexOf.call(parent.childNodes, node);
  966. }
  967. function child(node, index) {
  968. return node.childNodes[index];
  969. }
  970. function hasContent(node) {
  971. if (isElement(node)) {
  972. return true;
  973. } else if (isText(node) &&
  974. node.textContent.trim().length) {
  975. return true;
  976. }
  977. return false;
  978. }
  979. function indexOfTextNode(node, parent) {
  980. if (!isText(node)) {
  981. return -1;
  982. }
  983. let nodeTextContent = node.textContent;
  984. let child;
  985. let index = -1;
  986. for (var i = 0; i < parent.childNodes.length; i++) {
  987. child = parent.childNodes[i];
  988. if (child.nodeType === 3) {
  989. let text = parent.childNodes[i].textContent;
  990. if (text.includes(nodeTextContent)) {
  991. index = i;
  992. break;
  993. }
  994. }
  995. }
  996. return index;
  997. }
  998. /**
  999. * Throughout, whitespace is defined as one of the characters
  1000. * "\t" TAB \u0009
  1001. * "\n" LF \u000A
  1002. * "\r" CR \u000D
  1003. * " " SPC \u0020
  1004. *
  1005. * This does not use Javascript's "\s" because that includes non-breaking
  1006. * spaces (and also some other characters).
  1007. */
  1008. /**
  1009. * Determine if a node should be ignored by the iterator functions.
  1010. * taken from https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Whitespace#Whitespace_helper_functions
  1011. *
  1012. * @param {Node} node An object implementing the DOM1 |Node| interface.
  1013. * @return {boolean} true if the node is:
  1014. * 1) A |Text| node that is all whitespace
  1015. * 2) A |Comment| node
  1016. * and otherwise false.
  1017. */
  1018. function isIgnorable(node) {
  1019. return (node.nodeType === 8) || // A comment node
  1020. ((node.nodeType === 3) && isAllWhitespace(node)); // a text node, all whitespace
  1021. }
  1022. /**
  1023. * Determine whether a node's text content is entirely whitespace.
  1024. *
  1025. * @param {Node} node A node implementing the |CharacterData| interface (i.e., a |Text|, |Comment|, or |CDATASection| node
  1026. * @return {boolean} true if all of the text content of |nod| is whitespace, otherwise false.
  1027. */
  1028. function isAllWhitespace(node) {
  1029. return !(/[^\t\n\r ]/.test(node.textContent));
  1030. }
  1031. /**
  1032. * Version of |previousSibling| that skips nodes that are entirely
  1033. * whitespace or comments. (Normally |previousSibling| is a property
  1034. * of all DOM nodes that gives the sibling node, the node that is
  1035. * a child of the same parent, that occurs immediately before the
  1036. * reference node.)
  1037. *
  1038. * @param {ChildNode} sib The reference node.
  1039. * @return {Node|null} Either:
  1040. * 1) The closest previous sibling to |sib| that is not ignorable according to |is_ignorable|, or
  1041. * 2) null if no such node exists.
  1042. */
  1043. function previousSignificantNode(sib) {
  1044. while ((sib = sib.previousSibling)) {
  1045. if (!isIgnorable(sib)) return sib;
  1046. }
  1047. return null;
  1048. }
  1049. function getNodeWithNamedPage(node, limiter) {
  1050. if (node && node.dataset && node.dataset.page) {
  1051. return node;
  1052. }
  1053. if (node.parentNode) {
  1054. while ((node = node.parentNode)) {
  1055. if (limiter && node === limiter) {
  1056. return;
  1057. }
  1058. if (node.dataset && node.dataset.page) {
  1059. return node;
  1060. }
  1061. }
  1062. }
  1063. return null;
  1064. }
  1065. function breakInsideAvoidParentNode(node) {
  1066. while ((node = node.parentNode)) {
  1067. if (node && node.dataset && node.dataset.breakInside === "avoid") {
  1068. return node;
  1069. }
  1070. }
  1071. return null;
  1072. }
  1073. /**
  1074. * Find a parent with a given node name.
  1075. * @param {Node} node - initial Node
  1076. * @param {string} nodeName - node name (eg. "TD", "TABLE", "STRONG"...)
  1077. * @param {Node} limiter - go up to the parent until there's no more parent or the current node is equals to the limiter
  1078. * @returns {Node|undefined} - Either:
  1079. * 1) The closest parent for a the given node name, or
  1080. * 2) undefined if no such node exists.
  1081. */
  1082. function parentOf(node, nodeName, limiter) {
  1083. if (limiter && node === limiter) {
  1084. return;
  1085. }
  1086. if (node.parentNode) {
  1087. while ((node = node.parentNode)) {
  1088. if (limiter && node === limiter) {
  1089. return;
  1090. }
  1091. if (node.nodeName === nodeName) {
  1092. return node;
  1093. }
  1094. }
  1095. }
  1096. }
  1097. /**
  1098. * Version of |nextSibling| that skips nodes that are entirely
  1099. * whitespace or comments.
  1100. *
  1101. * @param {ChildNode} sib The reference node.
  1102. * @return {Node|null} Either:
  1103. * 1) The closest next sibling to |sib| that is not ignorable according to |is_ignorable|, or
  1104. * 2) null if no such node exists.
  1105. */
  1106. function nextSignificantNode(sib) {
  1107. while ((sib = sib.nextSibling)) {
  1108. if (!isIgnorable(sib)) return sib;
  1109. }
  1110. return null;
  1111. }
  1112. function filterTree(content, func, what) {
  1113. const treeWalker = document.createTreeWalker(
  1114. content || this.dom,
  1115. what || NodeFilter.SHOW_ALL,
  1116. func ? { acceptNode: func } : null,
  1117. false
  1118. );
  1119. let node;
  1120. let current;
  1121. node = treeWalker.nextNode();
  1122. while(node) {
  1123. current = node;
  1124. node = treeWalker.nextNode();
  1125. current.parentNode.removeChild(current);
  1126. }
  1127. }
  1128. /**
  1129. * BreakToken
  1130. * @class
  1131. */
  1132. class BreakToken {
  1133. constructor(node, offset) {
  1134. this.node = node;
  1135. this.offset = offset;
  1136. }
  1137. equals(otherBreakToken) {
  1138. if (!otherBreakToken) {
  1139. return false;
  1140. }
  1141. if (this["node"] && otherBreakToken["node"] &&
  1142. this["node"] !== otherBreakToken["node"]) {
  1143. return false;
  1144. }
  1145. if (this["offset"] && otherBreakToken["offset"] &&
  1146. this["offset"] !== otherBreakToken["offset"]) {
  1147. return false;
  1148. }
  1149. return true;
  1150. }
  1151. toJSON(hash) {
  1152. let node;
  1153. let index = 0;
  1154. if (!this.node) {
  1155. return {};
  1156. }
  1157. if (isElement(this.node) && this.node.dataset.ref) {
  1158. node = this.node.dataset.ref;
  1159. } else if (hash) {
  1160. node = this.node.parentElement.dataset.ref;
  1161. }
  1162. if (this.node.parentElement) {
  1163. const children = Array.from(this.node.parentElement.childNodes);
  1164. index = children.indexOf(this.node);
  1165. }
  1166. return JSON.stringify({
  1167. "node": node,
  1168. "index" : index,
  1169. "offset": this.offset
  1170. });
  1171. }
  1172. }
  1173. /**
  1174. * Render result.
  1175. * @class
  1176. */
  1177. class RenderResult {
  1178. constructor(breakToken, error) {
  1179. this.breakToken = breakToken;
  1180. this.error = error;
  1181. }
  1182. }
  1183. class OverflowContentError extends Error {
  1184. constructor(message, items) {
  1185. super(message);
  1186. this.items = items;
  1187. }
  1188. }
  1189. const MAX_CHARS_PER_BREAK = 1500;
  1190. /**
  1191. * Layout
  1192. * @class
  1193. */
  1194. class Layout {
  1195. constructor(element, hooks, options) {
  1196. this.element = element;
  1197. this.bounds = this.element.getBoundingClientRect();
  1198. this.parentBounds = this.element.offsetParent.getBoundingClientRect();
  1199. let gap = parseFloat(window.getComputedStyle(this.element).columnGap);
  1200. if (gap) {
  1201. let leftMargin = this.bounds.left - this.parentBounds.left;
  1202. this.gap = gap - leftMargin;
  1203. } else {
  1204. this.gap = 0;
  1205. }
  1206. if (hooks) {
  1207. this.hooks = hooks;
  1208. } else {
  1209. this.hooks = {};
  1210. this.hooks.onPageLayout = new Hook();
  1211. this.hooks.layout = new Hook();
  1212. this.hooks.renderNode = new Hook();
  1213. this.hooks.layoutNode = new Hook();
  1214. this.hooks.beforeOverflow = new Hook();
  1215. this.hooks.onOverflow = new Hook();
  1216. this.hooks.afterOverflowRemoved = new Hook();
  1217. this.hooks.onBreakToken = new Hook();
  1218. this.hooks.beforeRenderResult = new Hook();
  1219. }
  1220. this.settings = options || {};
  1221. this.maxChars = this.settings.maxChars || MAX_CHARS_PER_BREAK;
  1222. this.forceRenderBreak = false;
  1223. }
  1224. async renderTo(wrapper, source, breakToken, bounds = this.bounds) {
  1225. let start = this.getStart(source, breakToken);
  1226. let walker = walk$2(start, source);
  1227. let node;
  1228. let prevNode;
  1229. let done;
  1230. let next;
  1231. let hasRenderedContent = false;
  1232. let newBreakToken;
  1233. let length = 0;
  1234. let prevBreakToken = breakToken || new BreakToken(start);
  1235. this.hooks && this.hooks.onPageLayout.trigger(wrapper, prevBreakToken, this);
  1236. while (!done && !newBreakToken) {
  1237. next = walker.next();
  1238. prevNode = node;
  1239. node = next.value;
  1240. done = next.done;
  1241. if (!node) {
  1242. this.hooks && this.hooks.layout.trigger(wrapper, this);
  1243. let imgs = wrapper.querySelectorAll("img");
  1244. if (imgs.length) {
  1245. await this.waitForImages(imgs);
  1246. }
  1247. newBreakToken = this.findBreakToken(wrapper, source, bounds, prevBreakToken);
  1248. if (newBreakToken && newBreakToken.equals(prevBreakToken)) {
  1249. console.warn("Unable to layout item: ", prevNode);
  1250. this.hooks && this.hooks.beforeRenderResult.trigger(undefined, wrapper, this);
  1251. return new RenderResult(undefined, new OverflowContentError("Unable to layout item", [prevNode]));
  1252. }
  1253. this.rebuildTableFromBreakToken(newBreakToken, wrapper);
  1254. this.hooks && this.hooks.beforeRenderResult.trigger(newBreakToken, wrapper, this);
  1255. return new RenderResult(newBreakToken);
  1256. }
  1257. this.hooks && this.hooks.layoutNode.trigger(node);
  1258. // Check if the rendered element has a break set
  1259. if (hasRenderedContent && this.shouldBreak(node, start)) {
  1260. this.hooks && this.hooks.layout.trigger(wrapper, this);
  1261. let imgs = wrapper.querySelectorAll("img");
  1262. if (imgs.length) {
  1263. await this.waitForImages(imgs);
  1264. }
  1265. newBreakToken = this.findBreakToken(wrapper, source, bounds, prevBreakToken);
  1266. if (!newBreakToken) {
  1267. newBreakToken = this.breakAt(node);
  1268. } else {
  1269. this.rebuildTableFromBreakToken(newBreakToken, wrapper);
  1270. }
  1271. if (newBreakToken && newBreakToken.equals(prevBreakToken)) {
  1272. console.warn("Unable to layout item: ", node);
  1273. let after = newBreakToken.node && nodeAfter(newBreakToken.node);
  1274. if (after) {
  1275. newBreakToken = new BreakToken(after);
  1276. } else {
  1277. return new RenderResult(undefined, new OverflowContentError("Unable to layout item", [node]));
  1278. }
  1279. }
  1280. length = 0;
  1281. break;
  1282. }
  1283. if (node.dataset && node.dataset.page) {
  1284. let named = node.dataset.page;
  1285. let page = this.element.closest(".pagedjs_page");
  1286. page.classList.add("pagedjs_named_page");
  1287. page.classList.add("pagedjs_" + named + "_page");
  1288. if (!node.dataset.splitFrom) {
  1289. page.classList.add("pagedjs_" + named + "_first_page");
  1290. }
  1291. }
  1292. // Should the Node be a shallow or deep clone
  1293. let shallow = isContainer(node);
  1294. let rendered = this.append(node, wrapper, breakToken, shallow);
  1295. length += rendered.textContent.length;
  1296. // Check if layout has content yet
  1297. if (!hasRenderedContent) {
  1298. hasRenderedContent = hasContent(node);
  1299. }
  1300. // Skip to the next node if a deep clone was rendered
  1301. if (!shallow) {
  1302. walker = walk$2(nodeAfter(node, source), source);
  1303. }
  1304. if (this.forceRenderBreak) {
  1305. this.hooks && this.hooks.layout.trigger(wrapper, this);
  1306. newBreakToken = this.findBreakToken(wrapper, source, bounds, prevBreakToken);
  1307. if (!newBreakToken) {
  1308. newBreakToken = this.breakAt(node);
  1309. } else {
  1310. this.rebuildTableFromBreakToken(newBreakToken, wrapper);
  1311. }
  1312. length = 0;
  1313. this.forceRenderBreak = false;
  1314. break;
  1315. }
  1316. // Only check x characters
  1317. if (length >= this.maxChars) {
  1318. this.hooks && this.hooks.layout.trigger(wrapper, this);
  1319. let imgs = wrapper.querySelectorAll("img");
  1320. if (imgs.length) {
  1321. await this.waitForImages(imgs);
  1322. }
  1323. newBreakToken = this.findBreakToken(wrapper, source, bounds, prevBreakToken);
  1324. if (newBreakToken) {
  1325. length = 0;
  1326. this.rebuildTableFromBreakToken(newBreakToken, wrapper);
  1327. }
  1328. if (newBreakToken && newBreakToken.equals(prevBreakToken)) {
  1329. console.warn("Unable to layout item: ", node);
  1330. let after = newBreakToken.node && nodeAfter(newBreakToken.node);
  1331. if (after) {
  1332. newBreakToken = new BreakToken(after);
  1333. } else {
  1334. this.hooks && this.hooks.beforeRenderResult.trigger(undefined, wrapper, this);
  1335. return new RenderResult(undefined, new OverflowContentError("Unable to layout item", [node]));
  1336. }
  1337. }
  1338. }
  1339. }
  1340. this.hooks && this.hooks.beforeRenderResult.trigger(newBreakToken, wrapper, this);
  1341. return new RenderResult(newBreakToken);
  1342. }
  1343. breakAt(node, offset = 0) {
  1344. let newBreakToken = new BreakToken(
  1345. node,
  1346. offset
  1347. );
  1348. let breakHooks = this.hooks.onBreakToken.triggerSync(newBreakToken, undefined, node, this);
  1349. breakHooks.forEach((newToken) => {
  1350. if (typeof newToken != "undefined") {
  1351. newBreakToken = newToken;
  1352. }
  1353. });
  1354. return newBreakToken;
  1355. }
  1356. shouldBreak(node, limiter) {
  1357. let previousNode = nodeBefore(node, limiter);
  1358. let parentNode = node.parentNode;
  1359. let parentBreakBefore = needsBreakBefore(node) && parentNode && !previousNode && needsBreakBefore(parentNode);
  1360. let doubleBreakBefore;
  1361. if (parentBreakBefore) {
  1362. doubleBreakBefore = node.dataset.breakBefore === parentNode.dataset.breakBefore;
  1363. }
  1364. return !doubleBreakBefore && needsBreakBefore(node) || needsPreviousBreakAfter(node) || needsPageBreak(node, previousNode);
  1365. }
  1366. forceBreak() {
  1367. this.forceRenderBreak = true;
  1368. }
  1369. getStart(source, breakToken) {
  1370. let start;
  1371. let node = breakToken && breakToken.node;
  1372. if (node) {
  1373. start = node;
  1374. } else {
  1375. start = source.firstChild;
  1376. }
  1377. return start;
  1378. }
  1379. append(node, dest, breakToken, shallow = true, rebuild = true) {
  1380. let clone = cloneNode(node, !shallow);
  1381. if (node.parentNode && isElement(node.parentNode)) {
  1382. let parent = findElement(node.parentNode, dest);
  1383. // Rebuild chain
  1384. if (parent) {
  1385. parent.appendChild(clone);
  1386. } else if (rebuild) {
  1387. let fragment = rebuildAncestors(node);
  1388. parent = findElement(node.parentNode, fragment);
  1389. if (!parent) {
  1390. dest.appendChild(clone);
  1391. } else if (breakToken && isText(breakToken.node) && breakToken.offset > 0) {
  1392. clone.textContent = clone.textContent.substring(breakToken.offset);
  1393. parent.appendChild(clone);
  1394. } else {
  1395. parent.appendChild(clone);
  1396. }
  1397. dest.appendChild(fragment);
  1398. } else {
  1399. dest.appendChild(clone);
  1400. }
  1401. } else {
  1402. dest.appendChild(clone);
  1403. }
  1404. if (clone.dataset && clone.dataset.ref) {
  1405. if (!dest.indexOfRefs) {
  1406. dest.indexOfRefs = {};
  1407. }
  1408. dest.indexOfRefs[clone.dataset.ref] = clone;
  1409. }
  1410. let nodeHooks = this.hooks.renderNode.triggerSync(clone, node, this);
  1411. nodeHooks.forEach((newNode) => {
  1412. if (typeof newNode != "undefined") {
  1413. clone = newNode;
  1414. }
  1415. });
  1416. return clone;
  1417. }
  1418. rebuildTableFromBreakToken(breakToken, dest) {
  1419. if (!breakToken || !breakToken.node) {
  1420. return;
  1421. }
  1422. let node = breakToken.node;
  1423. let td = isElement(node) ? node.closest("td") : node.parentElement.closest("td");
  1424. if (td) {
  1425. let rendered = findElement(td, dest, true);
  1426. if (!rendered) {
  1427. return;
  1428. }
  1429. while ((td = td.nextElementSibling)) {
  1430. this.append(td, dest, null, true);
  1431. }
  1432. }
  1433. }
  1434. async waitForImages(imgs) {
  1435. let results = Array.from(imgs).map(async (img) => {
  1436. return this.awaitImageLoaded(img);
  1437. });
  1438. await Promise.all(results);
  1439. }
  1440. async awaitImageLoaded(image) {
  1441. return new Promise(resolve => {
  1442. if (image.complete !== true) {
  1443. image.onload = function () {
  1444. let {width, height} = window.getComputedStyle(image);
  1445. resolve(width, height);
  1446. };
  1447. image.onerror = function (e) {
  1448. let {width, height} = window.getComputedStyle(image);
  1449. resolve(width, height, e);
  1450. };
  1451. } else {
  1452. let {width, height} = window.getComputedStyle(image);
  1453. resolve(width, height);
  1454. }
  1455. });
  1456. }
  1457. avoidBreakInside(node, limiter) {
  1458. let breakNode;
  1459. if (node === limiter) {
  1460. return;
  1461. }
  1462. while (node.parentNode) {
  1463. node = node.parentNode;
  1464. if (node === limiter) {
  1465. break;
  1466. }
  1467. if (window.getComputedStyle(node)["break-inside"] === "avoid") {
  1468. breakNode = node;
  1469. break;
  1470. }
  1471. }
  1472. return breakNode;
  1473. }
  1474. createBreakToken(overflow, rendered, source) {
  1475. let container = overflow.startContainer;
  1476. let offset = overflow.startOffset;
  1477. let node, renderedNode, parent, index, temp;
  1478. if (isElement(container)) {
  1479. temp = child(container, offset);
  1480. if (isElement(temp)) {
  1481. renderedNode = findElement(temp, rendered);
  1482. if (!renderedNode) {
  1483. // Find closest element with data-ref
  1484. let prevNode = prevValidNode(temp);
  1485. if (!isElement(prevNode)) {
  1486. prevNode = prevNode.parentElement;
  1487. }
  1488. renderedNode = findElement(prevNode, rendered);
  1489. // Check if temp is the last rendered node at its level.
  1490. if (!temp.nextSibling) {
  1491. // We need to ensure that the previous sibling of temp is fully rendered.
  1492. const renderedNodeFromSource = findElement(renderedNode, source);
  1493. const walker = document.createTreeWalker(renderedNodeFromSource, NodeFilter.SHOW_ELEMENT);
  1494. const lastChildOfRenderedNodeFromSource = walker.lastChild();
  1495. const lastChildOfRenderedNodeMatchingFromRendered = findElement(lastChildOfRenderedNodeFromSource, rendered);
  1496. // Check if we found that the last child in source
  1497. if (!lastChildOfRenderedNodeMatchingFromRendered) {
  1498. // Pending content to be rendered before virtual break token
  1499. return;
  1500. }
  1501. // Otherwise we will return a break token as per below
  1502. }
  1503. // renderedNode is actually the last unbroken box that does not overflow.
  1504. // Break Token is therefore the next sibling of renderedNode within source node.
  1505. node = findElement(renderedNode, source).nextSibling;
  1506. offset = 0;
  1507. } else {
  1508. node = findElement(renderedNode, source);
  1509. offset = 0;
  1510. }
  1511. } else {
  1512. renderedNode = findElement(container, rendered);
  1513. if (!renderedNode) {
  1514. renderedNode = findElement(prevValidNode(container), rendered);
  1515. }
  1516. parent = findElement(renderedNode, source);
  1517. index = indexOfTextNode(temp, parent);
  1518. // No seperatation for the first textNode of an element
  1519. if(index === 0) {
  1520. node = parent;
  1521. offset = 0;
  1522. } else {
  1523. node = child(parent, index);
  1524. offset = 0;
  1525. }
  1526. }
  1527. } else {
  1528. renderedNode = findElement(container.parentNode, rendered);
  1529. if (!renderedNode) {
  1530. renderedNode = findElement(prevValidNode(container.parentNode), rendered);
  1531. }
  1532. parent = findElement(renderedNode, source);
  1533. index = indexOfTextNode(container, parent);
  1534. if (index === -1) {
  1535. return;
  1536. }
  1537. node = child(parent, index);
  1538. offset += node.textContent.indexOf(container.textContent);
  1539. }
  1540. if (!node) {
  1541. return;
  1542. }
  1543. return new BreakToken(
  1544. node,
  1545. offset
  1546. );
  1547. }
  1548. findBreakToken(rendered, source, bounds = this.bounds, prevBreakToken, extract = true) {
  1549. let overflow = this.findOverflow(rendered, bounds);
  1550. let breakToken, breakLetter;
  1551. let overflowHooks = this.hooks.onOverflow.triggerSync(overflow, rendered, bounds, this);
  1552. overflowHooks.forEach((newOverflow) => {
  1553. if (typeof newOverflow != "undefined") {
  1554. overflow = newOverflow;
  1555. }
  1556. });
  1557. if (overflow) {
  1558. breakToken = this.createBreakToken(overflow, rendered, source);
  1559. // breakToken is nullable
  1560. let breakHooks = this.hooks.onBreakToken.triggerSync(breakToken, overflow, rendered, this);
  1561. breakHooks.forEach((newToken) => {
  1562. if (typeof newToken != "undefined") {
  1563. breakToken = newToken;
  1564. }
  1565. });
  1566. // Stop removal if we are in a loop
  1567. if (breakToken && breakToken.equals(prevBreakToken)) {
  1568. return breakToken;
  1569. }
  1570. if (breakToken && breakToken["node"] && breakToken["offset"] && breakToken["node"].textContent) {
  1571. breakLetter = breakToken["node"].textContent.charAt(breakToken["offset"]);
  1572. } else {
  1573. breakLetter = undefined;
  1574. }
  1575. if (breakToken && breakToken.node && extract) {
  1576. let removed = this.removeOverflow(overflow, breakLetter);
  1577. this.hooks && this.hooks.afterOverflowRemoved.trigger(removed, rendered, this);
  1578. }
  1579. }
  1580. return breakToken;
  1581. }
  1582. hasOverflow(element, bounds = this.bounds) {
  1583. let constrainingElement = element && element.parentNode; // this gets the element, instead of the wrapper for the width workaround
  1584. let {width, height} = element.getBoundingClientRect();
  1585. let scrollWidth = constrainingElement ? constrainingElement.scrollWidth : 0;
  1586. let scrollHeight = constrainingElement ? constrainingElement.scrollHeight : 0;
  1587. return Math.max(Math.floor(width), scrollWidth) > Math.round(bounds.width) ||
  1588. Math.max(Math.floor(height), scrollHeight) > Math.round(bounds.height);
  1589. }
  1590. findOverflow(rendered, bounds = this.bounds, gap = this.gap) {
  1591. if (!this.hasOverflow(rendered, bounds)) return;
  1592. let start = Math.floor(bounds.left);
  1593. let end = Math.round(bounds.right + gap);
  1594. let vStart = Math.round(bounds.top);
  1595. let vEnd = Math.round(bounds.bottom);
  1596. let range;
  1597. let walker = walk$2(rendered.firstChild, rendered);
  1598. // Find Start
  1599. let next, done, node, offset, skip, breakAvoid, prev, br;
  1600. while (!done) {
  1601. next = walker.next();
  1602. done = next.done;
  1603. node = next.value;
  1604. skip = false;
  1605. breakAvoid = false;
  1606. prev = undefined;
  1607. br = undefined;
  1608. if (node) {
  1609. let pos = getBoundingClientRect(node);
  1610. let left = Math.round(pos.left);
  1611. let right = Math.floor(pos.right);
  1612. let top = Math.round(pos.top);
  1613. let bottom = Math.floor(pos.bottom);
  1614. if (!range && (left >= end || top >= vEnd)) {
  1615. // Check if it is a float
  1616. let isFloat = false;
  1617. // Check if the node is inside a break-inside: avoid table cell
  1618. const insideTableCell = parentOf(node, "TD", rendered);
  1619. if (insideTableCell && window.getComputedStyle(insideTableCell)["break-inside"] === "avoid") {
  1620. // breaking inside a table cell produces unexpected result, as a workaround, we forcibly avoid break inside in a cell.
  1621. // But we take the whole row, not just the cell that is causing the break.
  1622. prev = insideTableCell.parentElement;
  1623. } else if (isElement(node)) {
  1624. let styles = window.getComputedStyle(node);
  1625. isFloat = styles.getPropertyValue("float") !== "none";
  1626. skip = styles.getPropertyValue("break-inside") === "avoid";
  1627. breakAvoid = node.dataset.breakBefore === "avoid" || node.dataset.previousBreakAfter === "avoid";
  1628. prev = breakAvoid && nodeBefore(node, rendered);
  1629. br = node.tagName === "BR" || node.tagName === "WBR";
  1630. }
  1631. let tableRow;
  1632. if (node.nodeName === "TR") {
  1633. tableRow = node;
  1634. } else {
  1635. tableRow = parentOf(node, "TR", rendered);
  1636. }
  1637. if (tableRow) {
  1638. // honor break-inside="avoid" in parent tbody/thead
  1639. let container = tableRow.parentElement;
  1640. if (["TBODY", "THEAD"].includes(container.nodeName)) {
  1641. let styles = window.getComputedStyle(container);
  1642. if (styles.getPropertyValue("break-inside") === "avoid") prev = container;
  1643. }
  1644. // Check if the node is inside a row with a rowspan
  1645. const table = parentOf(tableRow, "TABLE", rendered);
  1646. const rowspan = table.querySelector("[colspan]");
  1647. if (table && rowspan) {
  1648. let columnCount = 0;
  1649. for (const cell of Array.from(table.rows[0].cells)) {
  1650. columnCount += parseInt(cell.getAttribute("colspan") || "1");
  1651. }
  1652. if (tableRow.cells.length !== columnCount) {
  1653. let previousRow = tableRow.previousElementSibling;
  1654. let previousRowColumnCount;
  1655. while (previousRow !== null) {
  1656. previousRowColumnCount = 0;
  1657. for (const cell of Array.from(previousRow.cells)) {
  1658. previousRowColumnCount += parseInt(cell.getAttribute("colspan") || "1");
  1659. }
  1660. if (previousRowColumnCount === columnCount) {
  1661. break;
  1662. }
  1663. previousRow = previousRow.previousElementSibling;
  1664. }
  1665. if (previousRowColumnCount === columnCount) {
  1666. prev = previousRow;
  1667. }
  1668. }
  1669. }
  1670. }
  1671. if (prev) {
  1672. range = document.createRange();
  1673. range.selectNode(prev);
  1674. break;
  1675. }
  1676. if (!br && !isFloat && isElement(node)) {
  1677. range = document.createRange();
  1678. range.selectNode(node);
  1679. break;
  1680. }
  1681. if (isText(node) && node.textContent.trim().length) {
  1682. range = document.createRange();
  1683. range.selectNode(node);
  1684. break;
  1685. }
  1686. }
  1687. if (!range && isText(node) &&
  1688. node.textContent.trim().length &&
  1689. !breakInsideAvoidParentNode(node.parentNode)) {
  1690. let rects = getClientRects(node);
  1691. let rect;
  1692. left = 0;
  1693. top = 0;
  1694. for (var i = 0; i != rects.length; i++) {
  1695. rect = rects[i];
  1696. if (rect.width > 0 && (!left || rect.left > left)) {
  1697. left = rect.left;
  1698. }
  1699. if (rect.height > 0 && (!top || rect.top > top)) {
  1700. top = rect.top;
  1701. }
  1702. }
  1703. if (left >= end || top >= vEnd) {
  1704. range = document.createRange();
  1705. offset = this.textBreak(node, start, end, vStart, vEnd);
  1706. if (!offset) {
  1707. range = undefined;
  1708. } else {
  1709. range.setStart(node, offset);
  1710. }
  1711. break;
  1712. }
  1713. }
  1714. // Skip children
  1715. if (skip || (right <= end && bottom <= vEnd)) {
  1716. next = nodeAfter(node, rendered);
  1717. if (next) {
  1718. walker = walk$2(next, rendered);
  1719. }
  1720. }
  1721. }
  1722. }
  1723. // Find End
  1724. if (range) {
  1725. range.setEndAfter(rendered.lastChild);
  1726. return range;
  1727. }
  1728. }
  1729. findEndToken(rendered, source) {
  1730. if (rendered.childNodes.length === 0) {
  1731. return;
  1732. }
  1733. let lastChild = rendered.lastChild;
  1734. let lastNodeIndex;
  1735. while (lastChild && lastChild.lastChild) {
  1736. if (!validNode(lastChild)) {
  1737. // Only get elements with refs
  1738. lastChild = lastChild.previousSibling;
  1739. } else if (!validNode(lastChild.lastChild)) {
  1740. // Deal with invalid dom items
  1741. lastChild = prevValidNode(lastChild.lastChild);
  1742. break;
  1743. } else {
  1744. lastChild = lastChild.lastChild;
  1745. }
  1746. }
  1747. if (isText(lastChild)) {
  1748. if (lastChild.parentNode.dataset.ref) {
  1749. lastNodeIndex = indexOf$2(lastChild);
  1750. lastChild = lastChild.parentNode;
  1751. } else {
  1752. lastChild = lastChild.previousSibling;
  1753. }
  1754. }
  1755. let original = findElement(lastChild, source);
  1756. if (lastNodeIndex) {
  1757. original = original.childNodes[lastNodeIndex];
  1758. }
  1759. let after = nodeAfter(original);
  1760. return this.breakAt(after);
  1761. }
  1762. textBreak(node, start, end, vStart, vEnd) {
  1763. let wordwalker = words(node);
  1764. let left = 0;
  1765. let right = 0;
  1766. let top = 0;
  1767. let bottom = 0;
  1768. let word, next, done, pos;
  1769. let offset;
  1770. while (!done) {
  1771. next = wordwalker.next();
  1772. word = next.value;
  1773. done = next.done;
  1774. if (!word) {
  1775. break;
  1776. }
  1777. pos = getBoundingClientRect(word);
  1778. left = Math.floor(pos.left);
  1779. right = Math.floor(pos.right);
  1780. top = Math.floor(pos.top);
  1781. bottom = Math.floor(pos.bottom);
  1782. if (left >= end || top >= vEnd) {
  1783. offset = word.startOffset;
  1784. break;
  1785. }
  1786. if (right > end || bottom > vEnd) {
  1787. let letterwalker = letters(word);
  1788. let letter, nextLetter, doneLetter;
  1789. while (!doneLetter) {
  1790. nextLetter = letterwalker.next();
  1791. letter = nextLetter.value;
  1792. doneLetter = nextLetter.done;
  1793. if (!letter) {
  1794. break;
  1795. }
  1796. pos = getBoundingClientRect(letter);
  1797. left = Math.floor(pos.left);
  1798. top = Math.floor(pos.top);
  1799. if (left >= end || top >= vEnd) {
  1800. offset = letter.startOffset;
  1801. done = true;
  1802. break;
  1803. }
  1804. }
  1805. }
  1806. }
  1807. return offset;
  1808. }
  1809. removeOverflow(overflow, breakLetter) {
  1810. let {startContainer} = overflow;
  1811. let extracted = overflow.extractContents();
  1812. this.hyphenateAtBreak(startContainer, breakLetter);
  1813. return extracted;
  1814. }
  1815. hyphenateAtBreak(startContainer, breakLetter) {
  1816. if (isText(startContainer)) {
  1817. let startText = startContainer.textContent;
  1818. let prevLetter = startText[startText.length - 1];
  1819. // Add a hyphen if previous character is a letter or soft hyphen
  1820. if (
  1821. (breakLetter && /^\w|\u00AD$/.test(prevLetter) && /^\w|\u00AD$/.test(breakLetter)) ||
  1822. (!breakLetter && /^\w|\u00AD$/.test(prevLetter))
  1823. ) {
  1824. startContainer.parentNode.classList.add("pagedjs_hyphen");
  1825. startContainer.textContent += this.settings.hyphenGlyph || "\u2011";
  1826. }
  1827. }
  1828. }
  1829. equalTokens(a, b) {
  1830. if (!a || !b) {
  1831. return false;
  1832. }
  1833. if (a["node"] && b["node"] && a["node"] !== b["node"]) {
  1834. return false;
  1835. }
  1836. if (a["offset"] && b["offset"] && a["offset"] !== b["offset"]) {
  1837. return false;
  1838. }
  1839. return true;
  1840. }
  1841. }
  1842. EventEmitter(Layout.prototype);
  1843. /**
  1844. * Render a page
  1845. * @class
  1846. */
  1847. class Page {
  1848. constructor(pagesArea, pageTemplate, blank, hooks, options) {
  1849. this.pagesArea = pagesArea;
  1850. this.pageTemplate = pageTemplate;
  1851. this.blank = blank;
  1852. this.width = undefined;
  1853. this.height = undefined;
  1854. this.hooks = hooks;
  1855. this.settings = options || {};
  1856. // this.element = this.create(this.pageTemplate);
  1857. }
  1858. create(template, after) {
  1859. //let documentFragment = document.createRange().createContextualFragment( TEMPLATE );
  1860. //let page = documentFragment.children[0];
  1861. let clone = document.importNode(this.pageTemplate.content, true);
  1862. let page, index;
  1863. if (after) {
  1864. this.pagesArea.insertBefore(clone, after.nextElementSibling);
  1865. index = Array.prototype.indexOf.call(this.pagesArea.children, after.nextElementSibling);
  1866. page = this.pagesArea.children[index];
  1867. } else {
  1868. this.pagesArea.appendChild(clone);
  1869. page = this.pagesArea.lastChild;
  1870. }
  1871. let pagebox = page.querySelector(".pagedjs_pagebox");
  1872. let area = page.querySelector(".pagedjs_page_content");
  1873. let footnotesArea = page.querySelector(".pagedjs_footnote_area");
  1874. let size = area.getBoundingClientRect();
  1875. area.style.columnWidth = Math.round(size.width) + "px";
  1876. area.style.columnGap = "calc(var(--pagedjs-margin-right) + var(--pagedjs-margin-left) + var(--pagedjs-bleed-right) + var(--pagedjs-bleed-left) + var(--pagedjs-column-gap-offset))";
  1877. // area.style.overflow = "scroll";
  1878. this.width = Math.round(size.width);
  1879. this.height = Math.round(size.height);
  1880. this.element = page;
  1881. this.pagebox = pagebox;
  1882. this.area = area;
  1883. this.footnotesArea = footnotesArea;
  1884. return page;
  1885. }
  1886. createWrapper() {
  1887. let wrapper = document.createElement("div");
  1888. this.area.appendChild(wrapper);
  1889. this.wrapper = wrapper;
  1890. return wrapper;
  1891. }
  1892. index(pgnum) {
  1893. this.position = pgnum;
  1894. let page = this.element;
  1895. // let pagebox = this.pagebox;
  1896. let index = pgnum + 1;
  1897. let id = `page-${index}`;
  1898. this.id = id;
  1899. // page.dataset.pageNumber = index;
  1900. page.dataset.pageNumber = index;
  1901. page.setAttribute("id", id);
  1902. if (this.name) {
  1903. page.classList.add("pagedjs_" + this.name + "_page");
  1904. }
  1905. if (this.blank) {
  1906. page.classList.add("pagedjs_blank_page");
  1907. }
  1908. if (pgnum === 0) {
  1909. page.classList.add("pagedjs_first_page");
  1910. }
  1911. if (pgnum % 2 !== 1) {
  1912. page.classList.remove("pagedjs_left_page");
  1913. page.classList.add("pagedjs_right_page");
  1914. } else {
  1915. page.classList.remove("pagedjs_right_page");
  1916. page.classList.add("pagedjs_left_page");
  1917. }
  1918. }
  1919. /*
  1920. size(width, height) {
  1921. if (width === this.width && height === this.height) {
  1922. return;
  1923. }
  1924. this.width = width;
  1925. this.height = height;
  1926. this.element.style.width = Math.round(width) + "px";
  1927. this.element.style.height = Math.round(height) + "px";
  1928. this.element.style.columnWidth = Math.round(width) + "px";
  1929. }
  1930. */
  1931. async layout(contents, breakToken, maxChars) {
  1932. this.clear();
  1933. this.startToken = breakToken;
  1934. let settings = this.settings;
  1935. if (!settings.maxChars && maxChars) {
  1936. settings.maxChars = maxChars;
  1937. }
  1938. this.layoutMethod = new Layout(this.area, this.hooks, settings);
  1939. let renderResult = await this.layoutMethod.renderTo(this.wrapper, contents, breakToken);
  1940. let newBreakToken = renderResult.breakToken;
  1941. this.addListeners(contents);
  1942. this.endToken = newBreakToken;
  1943. return newBreakToken;
  1944. }
  1945. async append(contents, breakToken) {
  1946. if (!this.layoutMethod) {
  1947. return this.layout(contents, breakToken);
  1948. }
  1949. let renderResult = await this.layoutMethod.renderTo(this.wrapper, contents, breakToken);
  1950. let newBreakToken = renderResult.breakToken;
  1951. this.endToken = newBreakToken;
  1952. return newBreakToken;
  1953. }
  1954. getByParent(ref, entries) {
  1955. let e;
  1956. for (var i = 0; i < entries.length; i++) {
  1957. e = entries[i];
  1958. if (e.dataset.ref === ref) {
  1959. return e;
  1960. }
  1961. }
  1962. }
  1963. onOverflow(func) {
  1964. this._onOverflow = func;
  1965. }
  1966. onUnderflow(func) {
  1967. this._onUnderflow = func;
  1968. }
  1969. clear() {
  1970. this.removeListeners();
  1971. this.wrapper && this.wrapper.remove();
  1972. this.createWrapper();
  1973. }
  1974. addListeners(contents) {
  1975. if (typeof ResizeObserver !== "undefined") {
  1976. this.addResizeObserver(contents);
  1977. } else {
  1978. this._checkOverflowAfterResize = this.checkOverflowAfterResize.bind(this, contents);
  1979. this.element.addEventListener("overflow", this._checkOverflowAfterResize, false);
  1980. this.element.addEventListener("underflow", this._checkOverflowAfterResize, false);
  1981. }
  1982. // TODO: fall back to mutation observer?
  1983. this._onScroll = function () {
  1984. if (this.listening) {
  1985. this.element.scrollLeft = 0;
  1986. }
  1987. }.bind(this);
  1988. // Keep scroll left from changing
  1989. this.element.addEventListener("scroll", this._onScroll);
  1990. this.listening = true;
  1991. return true;
  1992. }
  1993. removeListeners() {
  1994. this.listening = false;
  1995. if (typeof ResizeObserver !== "undefined" && this.ro) {
  1996. this.ro.disconnect();
  1997. } else if (this.element) {
  1998. this.element.removeEventListener("overflow", this._checkOverflowAfterResize, false);
  1999. this.element.removeEventListener("underflow", this._checkOverflowAfterResize, false);
  2000. }
  2001. this.element && this.element.removeEventListener("scroll", this._onScroll);
  2002. }
  2003. addResizeObserver(contents) {
  2004. let wrapper = this.wrapper;
  2005. let prevHeight = wrapper.getBoundingClientRect().height;
  2006. this.ro = new ResizeObserver(entries => {
  2007. if (!this.listening) {
  2008. return;
  2009. }
  2010. requestAnimationFrame(() => {
  2011. for (let entry of entries) {
  2012. const cr = entry.contentRect;
  2013. if (cr.height > prevHeight) {
  2014. this.checkOverflowAfterResize(contents);
  2015. prevHeight = wrapper.getBoundingClientRect().height;
  2016. } else if (cr.height < prevHeight) { // TODO: calc line height && (prevHeight - cr.height) >= 22
  2017. this.checkUnderflowAfterResize(contents);
  2018. prevHeight = cr.height;
  2019. }
  2020. }
  2021. });
  2022. });
  2023. this.ro.observe(wrapper);
  2024. }
  2025. checkOverflowAfterResize(contents) {
  2026. if (!this.listening || !this.layoutMethod) {
  2027. return;
  2028. }
  2029. let newBreakToken = this.layoutMethod.findBreakToken(this.wrapper, contents, this.startToken);
  2030. if (newBreakToken) {
  2031. this.endToken = newBreakToken;
  2032. this._onOverflow && this._onOverflow(newBreakToken);
  2033. }
  2034. }
  2035. checkUnderflowAfterResize(contents) {
  2036. if (!this.listening || !this.layoutMethod) {
  2037. return;
  2038. }
  2039. let endToken = this.layoutMethod.findEndToken(this.wrapper, contents);
  2040. if (endToken) {
  2041. this._onUnderflow && this._onUnderflow(endToken);
  2042. }
  2043. }
  2044. destroy() {
  2045. this.removeListeners();
  2046. this.element.remove();
  2047. this.element = undefined;
  2048. this.wrapper = undefined;
  2049. }
  2050. }
  2051. EventEmitter(Page.prototype);
  2052. /**
  2053. * Render a flow of text offscreen
  2054. * @class
  2055. */
  2056. class ContentParser {
  2057. constructor(content, cb) {
  2058. if (content && content.nodeType) {
  2059. // handle dom
  2060. this.dom = this.add(content);
  2061. } else if (typeof content === "string") {
  2062. this.dom = this.parse(content);
  2063. }
  2064. return this.dom;
  2065. }
  2066. parse(markup, mime) {
  2067. let range = document.createRange();
  2068. let fragment = range.createContextualFragment(markup);
  2069. this.addRefs(fragment);
  2070. return fragment;
  2071. }
  2072. add(contents) {
  2073. // let fragment = document.createDocumentFragment();
  2074. //
  2075. // let children = [...contents.childNodes];
  2076. // for (let child of children) {
  2077. // let clone = child.cloneNode(true);
  2078. // fragment.appendChild(clone);
  2079. // }
  2080. this.addRefs(contents);
  2081. return contents;
  2082. }
  2083. addRefs(content) {
  2084. var treeWalker = document.createTreeWalker(
  2085. content,
  2086. NodeFilter.SHOW_ELEMENT,
  2087. null,
  2088. false
  2089. );
  2090. let node = treeWalker.nextNode();
  2091. while(node) {
  2092. if (!node.hasAttribute("data-ref")) {
  2093. let uuid = UUID();
  2094. node.setAttribute("data-ref", uuid);
  2095. }
  2096. if (node.id) {
  2097. node.setAttribute("data-id", node.id);
  2098. }
  2099. // node.setAttribute("data-children", node.childNodes.length);
  2100. // node.setAttribute("data-text", node.textContent.trim().length);
  2101. node = treeWalker.nextNode();
  2102. }
  2103. }
  2104. find(ref) {
  2105. return this.refs[ref];
  2106. }
  2107. destroy() {
  2108. this.refs = undefined;
  2109. this.dom = undefined;
  2110. }
  2111. }
  2112. /**
  2113. * Queue for handling tasks one at a time
  2114. * @class
  2115. * @param {scope} context what this will resolve to in the tasks
  2116. */
  2117. class Queue {
  2118. constructor(context){
  2119. this._q = [];
  2120. this.context = context;
  2121. this.tick = requestAnimationFrame;
  2122. this.running = false;
  2123. this.paused = false;
  2124. }
  2125. /**
  2126. * Add an item to the queue
  2127. * @return {Promise} enqueued
  2128. */
  2129. enqueue() {
  2130. var deferred, promise;
  2131. var queued;
  2132. var task = [].shift.call(arguments);
  2133. var args = arguments;
  2134. // Handle single args without context
  2135. // if(args && !Array.isArray(args)) {
  2136. // args = [args];
  2137. // }
  2138. if(!task) {
  2139. throw new Error("No Task Provided");
  2140. }
  2141. if(typeof task === "function"){
  2142. deferred = new defer();
  2143. promise = deferred.promise;
  2144. queued = {
  2145. "task" : task,
  2146. "args" : args,
  2147. //"context" : context,
  2148. "deferred" : deferred,
  2149. "promise" : promise
  2150. };
  2151. } else {
  2152. // Task is a promise
  2153. queued = {
  2154. "promise" : task
  2155. };
  2156. }
  2157. this._q.push(queued);
  2158. // Wait to start queue flush
  2159. if (this.paused == false && !this.running) {
  2160. this.run();
  2161. }
  2162. return queued.promise;
  2163. }
  2164. /**
  2165. * Run one item
  2166. * @return {Promise} dequeued
  2167. */
  2168. dequeue(){
  2169. var inwait, task, result;
  2170. if(this._q.length && !this.paused) {
  2171. inwait = this._q.shift();
  2172. task = inwait.task;
  2173. if(task){
  2174. // console.log(task)
  2175. result = task.apply(this.context, inwait.args);
  2176. if(result && typeof result["then"] === "function") {
  2177. // Task is a function that returns a promise
  2178. return result.then(function(){
  2179. inwait.deferred.resolve.apply(this.context, arguments);
  2180. }.bind(this), function() {
  2181. inwait.deferred.reject.apply(this.context, arguments);
  2182. }.bind(this));
  2183. } else {
  2184. // Task resolves immediately
  2185. inwait.deferred.resolve.apply(this.context, result);
  2186. return inwait.promise;
  2187. }
  2188. } else if(inwait.promise) {
  2189. // Task is a promise
  2190. return inwait.promise;
  2191. }
  2192. } else {
  2193. inwait = new defer();
  2194. inwait.deferred.resolve();
  2195. return inwait.promise;
  2196. }
  2197. }
  2198. // Run All Immediately
  2199. dump(){
  2200. while(this._q.length) {
  2201. this.dequeue();
  2202. }
  2203. }
  2204. /**
  2205. * Run all tasks sequentially, at convince
  2206. * @return {Promise} all run
  2207. */
  2208. run(){
  2209. if(!this.running){
  2210. this.running = true;
  2211. this.defered = new defer();
  2212. }
  2213. this.tick.call(window, () => {
  2214. if(this._q.length) {
  2215. this.dequeue()
  2216. .then(function(){
  2217. this.run();
  2218. }.bind(this));
  2219. } else {
  2220. this.defered.resolve();
  2221. this.running = undefined;
  2222. }
  2223. });
  2224. // Unpause
  2225. if(this.paused == true) {
  2226. this.paused = false;
  2227. }
  2228. return this.defered.promise;
  2229. }
  2230. /**
  2231. * Flush all, as quickly as possible
  2232. * @return {Promise} ran
  2233. */
  2234. flush(){
  2235. if(this.running){
  2236. return this.running;
  2237. }
  2238. if(this._q.length) {
  2239. this.running = this.dequeue()
  2240. .then(function(){
  2241. this.running = undefined;
  2242. return this.flush();
  2243. }.bind(this));
  2244. return this.running;
  2245. }
  2246. }
  2247. /**
  2248. * Clear all items in wait
  2249. * @return {void}
  2250. */
  2251. clear(){
  2252. this._q = [];
  2253. }
  2254. /**
  2255. * Get the number of tasks in the queue
  2256. * @return {number} tasks
  2257. */
  2258. length(){
  2259. return this._q.length;
  2260. }
  2261. /**
  2262. * Pause a running queue
  2263. * @return {void}
  2264. */
  2265. pause(){
  2266. this.paused = true;
  2267. }
  2268. /**
  2269. * End the queue
  2270. * @return {void}
  2271. */
  2272. stop(){
  2273. this._q = [];
  2274. this.running = false;
  2275. this.paused = true;
  2276. }
  2277. }
  2278. const TEMPLATE = `
  2279. <div class="pagedjs_page">
  2280. <div class="pagedjs_sheet">
  2281. <div class="pagedjs_bleed pagedjs_bleed-top">
  2282. <div class="pagedjs_marks-crop"></div>
  2283. <div class="pagedjs_marks-middle">
  2284. <div class="pagedjs_marks-cross"></div>
  2285. </div>
  2286. <div class="pagedjs_marks-crop"></div>
  2287. </div>
  2288. <div class="pagedjs_bleed pagedjs_bleed-bottom">
  2289. <div class="pagedjs_marks-crop"></div>
  2290. <div class="pagedjs_marks-middle">
  2291. <div class="pagedjs_marks-cross"></div>
  2292. </div> <div class="pagedjs_marks-crop"></div>
  2293. </div>
  2294. <div class="pagedjs_bleed pagedjs_bleed-left">
  2295. <div class="pagedjs_marks-crop"></div>
  2296. <div class="pagedjs_marks-middle">
  2297. <div class="pagedjs_marks-cross"></div>
  2298. </div> <div class="pagedjs_marks-crop"></div>
  2299. </div>
  2300. <div class="pagedjs_bleed pagedjs_bleed-right">
  2301. <div class="pagedjs_marks-crop"></div>
  2302. <div class="pagedjs_marks-middle">
  2303. <div class="pagedjs_marks-cross"></div>
  2304. </div>
  2305. <div class="pagedjs_marks-crop"></div>
  2306. </div>
  2307. <div class="pagedjs_pagebox">
  2308. <div class="pagedjs_margin-top-left-corner-holder">
  2309. <div class="pagedjs_margin pagedjs_margin-top-left-corner"><div class="pagedjs_margin-content"></div></div>
  2310. </div>
  2311. <div class="pagedjs_margin-top">
  2312. <div class="pagedjs_margin pagedjs_margin-top-left"><div class="pagedjs_margin-content"></div></div>
  2313. <div class="pagedjs_margin pagedjs_margin-top-center"><div class="pagedjs_margin-content"></div></div>
  2314. <div class="pagedjs_margin pagedjs_margin-top-right"><div class="pagedjs_margin-content"></div></div>
  2315. </div>
  2316. <div class="pagedjs_margin-top-right-corner-holder">
  2317. <div class="pagedjs_margin pagedjs_margin-top-right-corner"><div class="pagedjs_margin-content"></div></div>
  2318. </div>
  2319. <div class="pagedjs_margin-right">
  2320. <div class="pagedjs_margin pagedjs_margin-right-top"><div class="pagedjs_margin-content"></div></div>
  2321. <div class="pagedjs_margin pagedjs_margin-right-middle"><div class="pagedjs_margin-content"></div></div>
  2322. <div class="pagedjs_margin pagedjs_margin-right-bottom"><div class="pagedjs_margin-content"></div></div>
  2323. </div>
  2324. <div class="pagedjs_margin-left">
  2325. <div class="pagedjs_margin pagedjs_margin-left-top"><div class="pagedjs_margin-content"></div></div>
  2326. <div class="pagedjs_margin pagedjs_margin-left-middle"><div class="pagedjs_margin-content"></div></div>
  2327. <div class="pagedjs_margin pagedjs_margin-left-bottom"><div class="pagedjs_margin-content"></div></div>
  2328. </div>
  2329. <div class="pagedjs_margin-bottom-left-corner-holder">
  2330. <div class="pagedjs_margin pagedjs_margin-bottom-left-corner"><div class="pagedjs_margin-content"></div></div>
  2331. </div>
  2332. <div class="pagedjs_margin-bottom">
  2333. <div class="pagedjs_margin pagedjs_margin-bottom-left"><div class="pagedjs_margin-content"></div></div>
  2334. <div class="pagedjs_margin pagedjs_margin-bottom-center"><div class="pagedjs_margin-content"></div></div>
  2335. <div class="pagedjs_margin pagedjs_margin-bottom-right"><div class="pagedjs_margin-content"></div></div>
  2336. </div>
  2337. <div class="pagedjs_margin-bottom-right-corner-holder">
  2338. <div class="pagedjs_margin pagedjs_margin-bottom-right-corner"><div class="pagedjs_margin-content"></div></div>
  2339. </div>
  2340. <div class="pagedjs_area">
  2341. <div class="pagedjs_page_content"></div>
  2342. <div class="pagedjs_footnote_area">
  2343. <div class="pagedjs_footnote_content pagedjs_footnote_empty">
  2344. <div class="pagedjs_footnote_inner_content"></div>
  2345. </div>
  2346. </div>
  2347. </div>
  2348. </div>
  2349. </div>
  2350. </div>`;
  2351. /**
  2352. * Chop up text into flows
  2353. * @class
  2354. */
  2355. class Chunker {
  2356. constructor(content, renderTo, options) {
  2357. // this.preview = preview;
  2358. this.settings = options || {};
  2359. this.hooks = {};
  2360. this.hooks.beforeParsed = new Hook(this);
  2361. this.hooks.filter = new Hook(this);
  2362. this.hooks.afterParsed = new Hook(this);
  2363. this.hooks.beforePageLayout = new Hook(this);
  2364. this.hooks.onPageLayout = new Hook(this);
  2365. this.hooks.layout = new Hook(this);
  2366. this.hooks.renderNode = new Hook(this);
  2367. this.hooks.layoutNode = new Hook(this);
  2368. this.hooks.onOverflow = new Hook(this);
  2369. this.hooks.afterOverflowRemoved = new Hook(this);
  2370. this.hooks.onBreakToken = new Hook();
  2371. this.hooks.beforeRenderResult = new Hook(this);
  2372. this.hooks.afterPageLayout = new Hook(this);
  2373. this.hooks.finalizePage = new Hook(this);
  2374. this.hooks.afterRendered = new Hook(this);
  2375. this.pages = [];
  2376. this.total = 0;
  2377. this.q = new Queue(this);
  2378. this.stopped = false;
  2379. this.rendered = false;
  2380. this.content = content;
  2381. this.charsPerBreak = [];
  2382. this.maxChars;
  2383. if (content) {
  2384. this.flow(content, renderTo);
  2385. }
  2386. }
  2387. setup(renderTo) {
  2388. this.pagesArea = document.createElement("div");
  2389. this.pagesArea.classList.add("pagedjs_pages");
  2390. if (renderTo) {
  2391. renderTo.appendChild(this.pagesArea);
  2392. } else {
  2393. document.querySelector("body").appendChild(this.pagesArea);
  2394. }
  2395. this.pageTemplate = document.createElement("template");
  2396. this.pageTemplate.innerHTML = TEMPLATE;
  2397. }
  2398. async flow(content, renderTo) {
  2399. let parsed;
  2400. await this.hooks.beforeParsed.trigger(content, this);
  2401. parsed = new ContentParser(content);
  2402. this.hooks.filter.triggerSync(parsed);
  2403. this.source = parsed;
  2404. this.breakToken = undefined;
  2405. if (this.pagesArea && this.pageTemplate) {
  2406. this.q.clear();
  2407. this.removePages();
  2408. } else {
  2409. this.setup(renderTo);
  2410. }
  2411. this.emit("rendering", parsed);
  2412. await this.hooks.afterParsed.trigger(parsed, this);
  2413. await this.loadFonts();
  2414. let rendered = await this.render(parsed, this.breakToken);
  2415. while (rendered.canceled) {
  2416. this.start();
  2417. rendered = await this.render(parsed, this.breakToken);
  2418. }
  2419. this.rendered = true;
  2420. this.pagesArea.style.setProperty("--pagedjs-page-count", this.total);
  2421. await this.hooks.afterRendered.trigger(this.pages, this);
  2422. this.emit("rendered", this.pages);
  2423. return this;
  2424. }
  2425. // oversetPages() {
  2426. // let overset = [];
  2427. // for (let i = 0; i < this.pages.length; i++) {
  2428. // let page = this.pages[i];
  2429. // if (page.overset) {
  2430. // overset.push(page);
  2431. // // page.overset = false;
  2432. // }
  2433. // }
  2434. // return overset;
  2435. // }
  2436. //
  2437. // async handleOverset(parsed) {
  2438. // let overset = this.oversetPages();
  2439. // if (overset.length) {
  2440. // console.log("overset", overset);
  2441. // let index = this.pages.indexOf(overset[0]) + 1;
  2442. // console.log("INDEX", index);
  2443. //
  2444. // // Remove pages
  2445. // // this.removePages(index);
  2446. //
  2447. // // await this.render(parsed, overset[0].overset);
  2448. //
  2449. // // return this.handleOverset(parsed);
  2450. // }
  2451. // }
  2452. async render(parsed, startAt) {
  2453. let renderer = this.layout(parsed, startAt);
  2454. let done = false;
  2455. let result;
  2456. while (!done) {
  2457. result = await this.q.enqueue(() => { return this.renderAsync(renderer); });
  2458. done = result.done;
  2459. }
  2460. return result;
  2461. }
  2462. start() {
  2463. this.rendered = false;
  2464. this.stopped = false;
  2465. }
  2466. stop() {
  2467. this.stopped = true;
  2468. // this.q.clear();
  2469. }
  2470. renderOnIdle(renderer) {
  2471. return new Promise(resolve => {
  2472. requestIdleCallback(async () => {
  2473. if (this.stopped) {
  2474. return resolve({ done: true, canceled: true });
  2475. }
  2476. let result = await renderer.next();
  2477. if (this.stopped) {
  2478. resolve({ done: true, canceled: true });
  2479. } else {
  2480. resolve(result);
  2481. }
  2482. });
  2483. });
  2484. }
  2485. async renderAsync(renderer) {
  2486. if (this.stopped) {
  2487. return { done: true, canceled: true };
  2488. }
  2489. let result = await renderer.next();
  2490. if (this.stopped) {
  2491. return { done: true, canceled: true };
  2492. } else {
  2493. return result;
  2494. }
  2495. }
  2496. async handleBreaks(node, force) {
  2497. let currentPage = this.total + 1;
  2498. let currentPosition = currentPage % 2 === 0 ? "left" : "right";
  2499. // TODO: Recto and Verso should reverse for rtl languages
  2500. let currentSide = currentPage % 2 === 0 ? "verso" : "recto";
  2501. let previousBreakAfter;
  2502. let breakBefore;
  2503. let page;
  2504. if (currentPage === 1) {
  2505. return;
  2506. }
  2507. if (node &&
  2508. typeof node.dataset !== "undefined" &&
  2509. typeof node.dataset.previousBreakAfter !== "undefined") {
  2510. previousBreakAfter = node.dataset.previousBreakAfter;
  2511. }
  2512. if (node &&
  2513. typeof node.dataset !== "undefined" &&
  2514. typeof node.dataset.breakBefore !== "undefined") {
  2515. breakBefore = node.dataset.breakBefore;
  2516. }
  2517. if (force) {
  2518. page = this.addPage(true);
  2519. } else if( previousBreakAfter &&
  2520. (previousBreakAfter === "left" || previousBreakAfter === "right") &&
  2521. previousBreakAfter !== currentPosition) {
  2522. page = this.addPage(true);
  2523. } else if( previousBreakAfter &&
  2524. (previousBreakAfter === "verso" || previousBreakAfter === "recto") &&
  2525. previousBreakAfter !== currentSide) {
  2526. page = this.addPage(true);
  2527. } else if( breakBefore &&
  2528. (breakBefore === "left" || breakBefore === "right") &&
  2529. breakBefore !== currentPosition) {
  2530. page = this.addPage(true);
  2531. } else if( breakBefore &&
  2532. (breakBefore === "verso" || breakBefore === "recto") &&
  2533. breakBefore !== currentSide) {
  2534. page = this.addPage(true);
  2535. }
  2536. if (page) {
  2537. await this.hooks.beforePageLayout.trigger(page, undefined, undefined, this);
  2538. this.emit("page", page);
  2539. // await this.hooks.layout.trigger(page.element, page, undefined, this);
  2540. await this.hooks.afterPageLayout.trigger(page.element, page, undefined, this);
  2541. await this.hooks.finalizePage.trigger(page.element, page, undefined, this);
  2542. this.emit("renderedPage", page);
  2543. }
  2544. }
  2545. async *layout(content, startAt) {
  2546. let breakToken = startAt || false;
  2547. let tokens = [];
  2548. while (breakToken !== undefined && (true)) {
  2549. if (breakToken && breakToken.node) {
  2550. await this.handleBreaks(breakToken.node);
  2551. } else {
  2552. await this.handleBreaks(content.firstChild);
  2553. }
  2554. let page = this.addPage();
  2555. await this.hooks.beforePageLayout.trigger(page, content, breakToken, this);
  2556. this.emit("page", page);
  2557. // Layout content in the page, starting from the breakToken
  2558. breakToken = await page.layout(content, breakToken, this.maxChars);
  2559. if (breakToken) {
  2560. let newToken = breakToken.toJSON(true);
  2561. if (tokens.lastIndexOf(newToken) > -1) {
  2562. // loop
  2563. let err = new OverflowContentError("Layout repeated", [breakToken.node]);
  2564. console.error("Layout repeated at: ", breakToken.node);
  2565. return err;
  2566. } else {
  2567. tokens.push(newToken);
  2568. }
  2569. }
  2570. await this.hooks.afterPageLayout.trigger(page.element, page, breakToken, this);
  2571. await this.hooks.finalizePage.trigger(page.element, page, undefined, this);
  2572. this.emit("renderedPage", page);
  2573. this.recoredCharLength(page.wrapper.textContent.length);
  2574. yield breakToken;
  2575. // Stop if we get undefined, showing we have reached the end of the content
  2576. }
  2577. }
  2578. recoredCharLength(length) {
  2579. if (length === 0) {
  2580. return;
  2581. }
  2582. this.charsPerBreak.push(length);
  2583. // Keep the length of the last few breaks
  2584. if (this.charsPerBreak.length > 4) {
  2585. this.charsPerBreak.shift();
  2586. }
  2587. this.maxChars = this.charsPerBreak.reduce((a, b) => a + b, 0) / (this.charsPerBreak.length);
  2588. }
  2589. removePages(fromIndex=0) {
  2590. if (fromIndex >= this.pages.length) {
  2591. return;
  2592. }
  2593. // Remove pages
  2594. for (let i = fromIndex; i < this.pages.length; i++) {
  2595. this.pages[i].destroy();
  2596. }
  2597. if (fromIndex > 0) {
  2598. this.pages.splice(fromIndex);
  2599. } else {
  2600. this.pages = [];
  2601. }
  2602. this.total = this.pages.length;
  2603. }
  2604. addPage(blank) {
  2605. let lastPage = this.pages[this.pages.length - 1];
  2606. // Create a new page from the template
  2607. let page = new Page(this.pagesArea, this.pageTemplate, blank, this.hooks, this.settings);
  2608. this.pages.push(page);
  2609. // Create the pages
  2610. page.create(undefined, lastPage && lastPage.element);
  2611. page.index(this.total);
  2612. if (!blank) {
  2613. // Listen for page overflow
  2614. page.onOverflow((overflowToken) => {
  2615. console.warn("overflow on", page.id, overflowToken);
  2616. // Only reflow while rendering
  2617. if (this.rendered) {
  2618. return;
  2619. }
  2620. let index = this.pages.indexOf(page) + 1;
  2621. // Stop the rendering
  2622. this.stop();
  2623. // Set the breakToken to resume at
  2624. this.breakToken = overflowToken;
  2625. // Remove pages
  2626. this.removePages(index);
  2627. if (this.rendered === true) {
  2628. this.rendered = false;
  2629. this.q.enqueue(async () => {
  2630. this.start();
  2631. await this.render(this.source, this.breakToken);
  2632. this.rendered = true;
  2633. });
  2634. }
  2635. });
  2636. page.onUnderflow((overflowToken) => {
  2637. // console.log("underflow on", page.id, overflowToken);
  2638. // page.append(this.source, overflowToken);
  2639. });
  2640. }
  2641. this.total = this.pages.length;
  2642. return page;
  2643. }
  2644. /*
  2645. insertPage(index, blank) {
  2646. let lastPage = this.pages[index];
  2647. // Create a new page from the template
  2648. let page = new Page(this.pagesArea, this.pageTemplate, blank, this.hooks);
  2649. let total = this.pages.splice(index, 0, page);
  2650. // Create the pages
  2651. page.create(undefined, lastPage && lastPage.element);
  2652. page.index(index + 1);
  2653. for (let i = index + 2; i < this.pages.length; i++) {
  2654. this.pages[i].index(i);
  2655. }
  2656. if (!blank) {
  2657. // Listen for page overflow
  2658. page.onOverflow((overflowToken) => {
  2659. if (total < this.pages.length) {
  2660. this.pages[total].layout(this.source, overflowToken);
  2661. } else {
  2662. let newPage = this.addPage();
  2663. newPage.layout(this.source, overflowToken);
  2664. }
  2665. });
  2666. page.onUnderflow(() => {
  2667. // console.log("underflow on", page.id);
  2668. });
  2669. }
  2670. this.total += 1;
  2671. return page;
  2672. }
  2673. */
  2674. async clonePage(originalPage) {
  2675. let lastPage = this.pages[this.pages.length - 1];
  2676. let page = new Page(this.pagesArea, this.pageTemplate, false, this.hooks);
  2677. this.pages.push(page);
  2678. // Create the pages
  2679. page.create(undefined, lastPage && lastPage.element);
  2680. page.index(this.total);
  2681. await this.hooks.beforePageLayout.trigger(page, undefined, undefined, this);
  2682. this.emit("page", page);
  2683. for (const className of originalPage.element.classList) {
  2684. if (className !== "pagedjs_left_page" && className !== "pagedjs_right_page") {
  2685. page.element.classList.add(className);
  2686. }
  2687. }
  2688. await this.hooks.afterPageLayout.trigger(page.element, page, undefined, this);
  2689. await this.hooks.finalizePage.trigger(page.element, page, undefined, this);
  2690. this.emit("renderedPage", page);
  2691. }
  2692. loadFonts() {
  2693. let fontPromises = [];
  2694. (document.fonts || []).forEach((fontFace) => {
  2695. if (fontFace.status !== "loaded") {
  2696. let fontLoaded = fontFace.load().then((r) => {
  2697. return fontFace.family;
  2698. }, (r) => {
  2699. console.warn("Failed to preload font-family:", fontFace.family);
  2700. return fontFace.family;
  2701. });
  2702. fontPromises.push(fontLoaded);
  2703. }
  2704. });
  2705. return Promise.all(fontPromises).catch((err) => {
  2706. console.warn(err);
  2707. });
  2708. }
  2709. destroy() {
  2710. this.pagesArea.remove();
  2711. this.pageTemplate.remove();
  2712. }
  2713. }
  2714. EventEmitter(Chunker.prototype);
  2715. var syntax = {exports: {}};
  2716. var create$4 = {};
  2717. //
  2718. // list
  2719. // ┌──────┐
  2720. // ┌──────────────┼─head │
  2721. // │ │ tail─┼──────────────┐
  2722. // │ └──────┘ │
  2723. // ▼ ▼
  2724. // item item item item
  2725. // ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐
  2726. // null ◀──┼─prev │◀───┼─prev │◀───┼─prev │◀───┼─prev │
  2727. // │ next─┼───▶│ next─┼───▶│ next─┼───▶│ next─┼──▶ null
  2728. // ├──────┤ ├──────┤ ├──────┤ ├──────┤
  2729. // │ data │ │ data │ │ data │ │ data │
  2730. // └──────┘ └──────┘ └──────┘ └──────┘
  2731. //
  2732. function createItem(data) {
  2733. return {
  2734. prev: null,
  2735. next: null,
  2736. data: data
  2737. };
  2738. }
  2739. function allocateCursor(node, prev, next) {
  2740. var cursor;
  2741. if (cursors !== null) {
  2742. cursor = cursors;
  2743. cursors = cursors.cursor;
  2744. cursor.prev = prev;
  2745. cursor.next = next;
  2746. cursor.cursor = node.cursor;
  2747. } else {
  2748. cursor = {
  2749. prev: prev,
  2750. next: next,
  2751. cursor: node.cursor
  2752. };
  2753. }
  2754. node.cursor = cursor;
  2755. return cursor;
  2756. }
  2757. function releaseCursor(node) {
  2758. var cursor = node.cursor;
  2759. node.cursor = cursor.cursor;
  2760. cursor.prev = null;
  2761. cursor.next = null;
  2762. cursor.cursor = cursors;
  2763. cursors = cursor;
  2764. }
  2765. var cursors = null;
  2766. var List$6 = function() {
  2767. this.cursor = null;
  2768. this.head = null;
  2769. this.tail = null;
  2770. };
  2771. List$6.createItem = createItem;
  2772. List$6.prototype.createItem = createItem;
  2773. List$6.prototype.updateCursors = function(prevOld, prevNew, nextOld, nextNew) {
  2774. var cursor = this.cursor;
  2775. while (cursor !== null) {
  2776. if (cursor.prev === prevOld) {
  2777. cursor.prev = prevNew;
  2778. }
  2779. if (cursor.next === nextOld) {
  2780. cursor.next = nextNew;
  2781. }
  2782. cursor = cursor.cursor;
  2783. }
  2784. };
  2785. List$6.prototype.getSize = function() {
  2786. var size = 0;
  2787. var cursor = this.head;
  2788. while (cursor) {
  2789. size++;
  2790. cursor = cursor.next;
  2791. }
  2792. return size;
  2793. };
  2794. List$6.prototype.fromArray = function(array) {
  2795. var cursor = null;
  2796. this.head = null;
  2797. for (var i = 0; i < array.length; i++) {
  2798. var item = createItem(array[i]);
  2799. if (cursor !== null) {
  2800. cursor.next = item;
  2801. } else {
  2802. this.head = item;
  2803. }
  2804. item.prev = cursor;
  2805. cursor = item;
  2806. }
  2807. this.tail = cursor;
  2808. return this;
  2809. };
  2810. List$6.prototype.toArray = function() {
  2811. var cursor = this.head;
  2812. var result = [];
  2813. while (cursor) {
  2814. result.push(cursor.data);
  2815. cursor = cursor.next;
  2816. }
  2817. return result;
  2818. };
  2819. List$6.prototype.toJSON = List$6.prototype.toArray;
  2820. List$6.prototype.isEmpty = function() {
  2821. return this.head === null;
  2822. };
  2823. List$6.prototype.first = function() {
  2824. return this.head && this.head.data;
  2825. };
  2826. List$6.prototype.last = function() {
  2827. return this.tail && this.tail.data;
  2828. };
  2829. List$6.prototype.each = function(fn, context) {
  2830. var item;
  2831. if (context === undefined) {
  2832. context = this;
  2833. }
  2834. // push cursor
  2835. var cursor = allocateCursor(this, null, this.head);
  2836. while (cursor.next !== null) {
  2837. item = cursor.next;
  2838. cursor.next = item.next;
  2839. fn.call(context, item.data, item, this);
  2840. }
  2841. // pop cursor
  2842. releaseCursor(this);
  2843. };
  2844. List$6.prototype.forEach = List$6.prototype.each;
  2845. List$6.prototype.eachRight = function(fn, context) {
  2846. var item;
  2847. if (context === undefined) {
  2848. context = this;
  2849. }
  2850. // push cursor
  2851. var cursor = allocateCursor(this, this.tail, null);
  2852. while (cursor.prev !== null) {
  2853. item = cursor.prev;
  2854. cursor.prev = item.prev;
  2855. fn.call(context, item.data, item, this);
  2856. }
  2857. // pop cursor
  2858. releaseCursor(this);
  2859. };
  2860. List$6.prototype.forEachRight = List$6.prototype.eachRight;
  2861. List$6.prototype.reduce = function(fn, initialValue, context) {
  2862. var item;
  2863. if (context === undefined) {
  2864. context = this;
  2865. }
  2866. // push cursor
  2867. var cursor = allocateCursor(this, null, this.head);
  2868. var acc = initialValue;
  2869. while (cursor.next !== null) {
  2870. item = cursor.next;
  2871. cursor.next = item.next;
  2872. acc = fn.call(context, acc, item.data, item, this);
  2873. }
  2874. // pop cursor
  2875. releaseCursor(this);
  2876. return acc;
  2877. };
  2878. List$6.prototype.reduceRight = function(fn, initialValue, context) {
  2879. var item;
  2880. if (context === undefined) {
  2881. context = this;
  2882. }
  2883. // push cursor
  2884. var cursor = allocateCursor(this, this.tail, null);
  2885. var acc = initialValue;
  2886. while (cursor.prev !== null) {
  2887. item = cursor.prev;
  2888. cursor.prev = item.prev;
  2889. acc = fn.call(context, acc, item.data, item, this);
  2890. }
  2891. // pop cursor
  2892. releaseCursor(this);
  2893. return acc;
  2894. };
  2895. List$6.prototype.nextUntil = function(start, fn, context) {
  2896. if (start === null) {
  2897. return;
  2898. }
  2899. var item;
  2900. if (context === undefined) {
  2901. context = this;
  2902. }
  2903. // push cursor
  2904. var cursor = allocateCursor(this, null, start);
  2905. while (cursor.next !== null) {
  2906. item = cursor.next;
  2907. cursor.next = item.next;
  2908. if (fn.call(context, item.data, item, this)) {
  2909. break;
  2910. }
  2911. }
  2912. // pop cursor
  2913. releaseCursor(this);
  2914. };
  2915. List$6.prototype.prevUntil = function(start, fn, context) {
  2916. if (start === null) {
  2917. return;
  2918. }
  2919. var item;
  2920. if (context === undefined) {
  2921. context = this;
  2922. }
  2923. // push cursor
  2924. var cursor = allocateCursor(this, start, null);
  2925. while (cursor.prev !== null) {
  2926. item = cursor.prev;
  2927. cursor.prev = item.prev;
  2928. if (fn.call(context, item.data, item, this)) {
  2929. break;
  2930. }
  2931. }
  2932. // pop cursor
  2933. releaseCursor(this);
  2934. };
  2935. List$6.prototype.some = function(fn, context) {
  2936. var cursor = this.head;
  2937. if (context === undefined) {
  2938. context = this;
  2939. }
  2940. while (cursor !== null) {
  2941. if (fn.call(context, cursor.data, cursor, this)) {
  2942. return true;
  2943. }
  2944. cursor = cursor.next;
  2945. }
  2946. return false;
  2947. };
  2948. List$6.prototype.map = function(fn, context) {
  2949. var result = new List$6();
  2950. var cursor = this.head;
  2951. if (context === undefined) {
  2952. context = this;
  2953. }
  2954. while (cursor !== null) {
  2955. result.appendData(fn.call(context, cursor.data, cursor, this));
  2956. cursor = cursor.next;
  2957. }
  2958. return result;
  2959. };
  2960. List$6.prototype.filter = function(fn, context) {
  2961. var result = new List$6();
  2962. var cursor = this.head;
  2963. if (context === undefined) {
  2964. context = this;
  2965. }
  2966. while (cursor !== null) {
  2967. if (fn.call(context, cursor.data, cursor, this)) {
  2968. result.appendData(cursor.data);
  2969. }
  2970. cursor = cursor.next;
  2971. }
  2972. return result;
  2973. };
  2974. List$6.prototype.clear = function() {
  2975. this.head = null;
  2976. this.tail = null;
  2977. };
  2978. List$6.prototype.copy = function() {
  2979. var result = new List$6();
  2980. var cursor = this.head;
  2981. while (cursor !== null) {
  2982. result.insert(createItem(cursor.data));
  2983. cursor = cursor.next;
  2984. }
  2985. return result;
  2986. };
  2987. List$6.prototype.prepend = function(item) {
  2988. // head
  2989. // ^
  2990. // item
  2991. this.updateCursors(null, item, this.head, item);
  2992. // insert to the beginning of the list
  2993. if (this.head !== null) {
  2994. // new item <- first item
  2995. this.head.prev = item;
  2996. // new item -> first item
  2997. item.next = this.head;
  2998. } else {
  2999. // if list has no head, then it also has no tail
  3000. // in this case tail points to the new item
  3001. this.tail = item;
  3002. }
  3003. // head always points to new item
  3004. this.head = item;
  3005. return this;
  3006. };
  3007. List$6.prototype.prependData = function(data) {
  3008. return this.prepend(createItem(data));
  3009. };
  3010. List$6.prototype.append = function(item) {
  3011. return this.insert(item);
  3012. };
  3013. List$6.prototype.appendData = function(data) {
  3014. return this.insert(createItem(data));
  3015. };
  3016. List$6.prototype.insert = function(item, before) {
  3017. if (before !== undefined && before !== null) {
  3018. // prev before
  3019. // ^
  3020. // item
  3021. this.updateCursors(before.prev, item, before, item);
  3022. if (before.prev === null) {
  3023. // insert to the beginning of list
  3024. if (this.head !== before) {
  3025. throw new Error('before doesn\'t belong to list');
  3026. }
  3027. // since head points to before therefore list doesn't empty
  3028. // no need to check tail
  3029. this.head = item;
  3030. before.prev = item;
  3031. item.next = before;
  3032. this.updateCursors(null, item);
  3033. } else {
  3034. // insert between two items
  3035. before.prev.next = item;
  3036. item.prev = before.prev;
  3037. before.prev = item;
  3038. item.next = before;
  3039. }
  3040. } else {
  3041. // tail
  3042. // ^
  3043. // item
  3044. this.updateCursors(this.tail, item, null, item);
  3045. // insert to the ending of the list
  3046. if (this.tail !== null) {
  3047. // last item -> new item
  3048. this.tail.next = item;
  3049. // last item <- new item
  3050. item.prev = this.tail;
  3051. } else {
  3052. // if list has no tail, then it also has no head
  3053. // in this case head points to new item
  3054. this.head = item;
  3055. }
  3056. // tail always points to new item
  3057. this.tail = item;
  3058. }
  3059. return this;
  3060. };
  3061. List$6.prototype.insertData = function(data, before) {
  3062. return this.insert(createItem(data), before);
  3063. };
  3064. List$6.prototype.remove = function(item) {
  3065. // item
  3066. // ^
  3067. // prev next
  3068. this.updateCursors(item, item.prev, item, item.next);
  3069. if (item.prev !== null) {
  3070. item.prev.next = item.next;
  3071. } else {
  3072. if (this.head !== item) {
  3073. throw new Error('item doesn\'t belong to list');
  3074. }
  3075. this.head = item.next;
  3076. }
  3077. if (item.next !== null) {
  3078. item.next.prev = item.prev;
  3079. } else {
  3080. if (this.tail !== item) {
  3081. throw new Error('item doesn\'t belong to list');
  3082. }
  3083. this.tail = item.prev;
  3084. }
  3085. item.prev = null;
  3086. item.next = null;
  3087. return item;
  3088. };
  3089. List$6.prototype.push = function(data) {
  3090. this.insert(createItem(data));
  3091. };
  3092. List$6.prototype.pop = function() {
  3093. if (this.tail !== null) {
  3094. return this.remove(this.tail);
  3095. }
  3096. };
  3097. List$6.prototype.unshift = function(data) {
  3098. this.prepend(createItem(data));
  3099. };
  3100. List$6.prototype.shift = function() {
  3101. if (this.head !== null) {
  3102. return this.remove(this.head);
  3103. }
  3104. };
  3105. List$6.prototype.prependList = function(list) {
  3106. return this.insertList(list, this.head);
  3107. };
  3108. List$6.prototype.appendList = function(list) {
  3109. return this.insertList(list);
  3110. };
  3111. List$6.prototype.insertList = function(list, before) {
  3112. // ignore empty lists
  3113. if (list.head === null) {
  3114. return this;
  3115. }
  3116. if (before !== undefined && before !== null) {
  3117. this.updateCursors(before.prev, list.tail, before, list.head);
  3118. // insert in the middle of dist list
  3119. if (before.prev !== null) {
  3120. // before.prev <-> list.head
  3121. before.prev.next = list.head;
  3122. list.head.prev = before.prev;
  3123. } else {
  3124. this.head = list.head;
  3125. }
  3126. before.prev = list.tail;
  3127. list.tail.next = before;
  3128. } else {
  3129. this.updateCursors(this.tail, list.tail, null, list.head);
  3130. // insert to end of the list
  3131. if (this.tail !== null) {
  3132. // if destination list has a tail, then it also has a head,
  3133. // but head doesn't change
  3134. // dest tail -> source head
  3135. this.tail.next = list.head;
  3136. // dest tail <- source head
  3137. list.head.prev = this.tail;
  3138. } else {
  3139. // if list has no a tail, then it also has no a head
  3140. // in this case points head to new item
  3141. this.head = list.head;
  3142. }
  3143. // tail always start point to new item
  3144. this.tail = list.tail;
  3145. }
  3146. list.head = null;
  3147. list.tail = null;
  3148. return this;
  3149. };
  3150. List$6.prototype.replace = function(oldItem, newItemOrList) {
  3151. if ('head' in newItemOrList) {
  3152. this.insertList(newItemOrList, oldItem);
  3153. } else {
  3154. this.insert(newItemOrList, oldItem);
  3155. }
  3156. this.remove(oldItem);
  3157. };
  3158. var List_1 = List$6;
  3159. var createCustomError$3 = function createCustomError(name, message) {
  3160. // use Object.create(), because some VMs prevent setting line/column otherwise
  3161. // (iOS Safari 10 even throws an exception)
  3162. var error = Object.create(SyntaxError.prototype);
  3163. var errorStack = new Error();
  3164. error.name = name;
  3165. error.message = message;
  3166. Object.defineProperty(error, 'stack', {
  3167. get: function() {
  3168. return (errorStack.stack || '').replace(/^(.+\n){1,3}/, name + ': ' + message + '\n');
  3169. }
  3170. });
  3171. return error;
  3172. };
  3173. var createCustomError$2 = createCustomError$3;
  3174. var MAX_LINE_LENGTH = 100;
  3175. var OFFSET_CORRECTION = 60;
  3176. var TAB_REPLACEMENT = ' ';
  3177. function sourceFragment(error, extraLines) {
  3178. function processLines(start, end) {
  3179. return lines.slice(start, end).map(function(line, idx) {
  3180. var num = String(start + idx + 1);
  3181. while (num.length < maxNumLength) {
  3182. num = ' ' + num;
  3183. }
  3184. return num + ' |' + line;
  3185. }).join('\n');
  3186. }
  3187. var lines = error.source.split(/\r\n?|\n|\f/);
  3188. var line = error.line;
  3189. var column = error.column;
  3190. var startLine = Math.max(1, line - extraLines) - 1;
  3191. var endLine = Math.min(line + extraLines, lines.length + 1);
  3192. var maxNumLength = Math.max(4, String(endLine).length) + 1;
  3193. var cutLeft = 0;
  3194. // column correction according to replaced tab before column
  3195. column += (TAB_REPLACEMENT.length - 1) * (lines[line - 1].substr(0, column - 1).match(/\t/g) || []).length;
  3196. if (column > MAX_LINE_LENGTH) {
  3197. cutLeft = column - OFFSET_CORRECTION + 3;
  3198. column = OFFSET_CORRECTION - 2;
  3199. }
  3200. for (var i = startLine; i <= endLine; i++) {
  3201. if (i >= 0 && i < lines.length) {
  3202. lines[i] = lines[i].replace(/\t/g, TAB_REPLACEMENT);
  3203. lines[i] =
  3204. (cutLeft > 0 && lines[i].length > cutLeft ? '\u2026' : '') +
  3205. lines[i].substr(cutLeft, MAX_LINE_LENGTH - 2) +
  3206. (lines[i].length > cutLeft + MAX_LINE_LENGTH - 1 ? '\u2026' : '');
  3207. }
  3208. }
  3209. return [
  3210. processLines(startLine, line),
  3211. new Array(column + maxNumLength + 2).join('-') + '^',
  3212. processLines(line, endLine)
  3213. ].filter(Boolean).join('\n');
  3214. }
  3215. var SyntaxError$4 = function(message, source, offset, line, column) {
  3216. var error = createCustomError$2('SyntaxError', message);
  3217. error.source = source;
  3218. error.offset = offset;
  3219. error.line = line;
  3220. error.column = column;
  3221. error.sourceFragment = function(extraLines) {
  3222. return sourceFragment(error, isNaN(extraLines) ? 0 : extraLines);
  3223. };
  3224. Object.defineProperty(error, 'formattedMessage', {
  3225. get: function() {
  3226. return (
  3227. 'Parse error: ' + error.message + '\n' +
  3228. sourceFragment(error, 2)
  3229. );
  3230. }
  3231. });
  3232. // for backward capability
  3233. error.parseError = {
  3234. offset: offset,
  3235. line: line,
  3236. column: column
  3237. };
  3238. return error;
  3239. };
  3240. var _SyntaxError$1 = SyntaxError$4;
  3241. // CSS Syntax Module Level 3
  3242. // https://www.w3.org/TR/css-syntax-3/
  3243. var TYPE$H = {
  3244. EOF: 0, // <EOF-token>
  3245. Ident: 1, // <ident-token>
  3246. Function: 2, // <function-token>
  3247. AtKeyword: 3, // <at-keyword-token>
  3248. Hash: 4, // <hash-token>
  3249. String: 5, // <string-token>
  3250. BadString: 6, // <bad-string-token>
  3251. Url: 7, // <url-token>
  3252. BadUrl: 8, // <bad-url-token>
  3253. Delim: 9, // <delim-token>
  3254. Number: 10, // <number-token>
  3255. Percentage: 11, // <percentage-token>
  3256. Dimension: 12, // <dimension-token>
  3257. WhiteSpace: 13, // <whitespace-token>
  3258. CDO: 14, // <CDO-token>
  3259. CDC: 15, // <CDC-token>
  3260. Colon: 16, // <colon-token> :
  3261. Semicolon: 17, // <semicolon-token> ;
  3262. Comma: 18, // <comma-token> ,
  3263. LeftSquareBracket: 19, // <[-token>
  3264. RightSquareBracket: 20, // <]-token>
  3265. LeftParenthesis: 21, // <(-token>
  3266. RightParenthesis: 22, // <)-token>
  3267. LeftCurlyBracket: 23, // <{-token>
  3268. RightCurlyBracket: 24, // <}-token>
  3269. Comment: 25
  3270. };
  3271. var NAME$3 = Object.keys(TYPE$H).reduce(function(result, key) {
  3272. result[TYPE$H[key]] = key;
  3273. return result;
  3274. }, {});
  3275. var _const = {
  3276. TYPE: TYPE$H,
  3277. NAME: NAME$3
  3278. };
  3279. var EOF$1 = 0;
  3280. // https://drafts.csswg.org/css-syntax-3/
  3281. // § 4.2. Definitions
  3282. // digit
  3283. // A code point between U+0030 DIGIT ZERO (0) and U+0039 DIGIT NINE (9).
  3284. function isDigit$5(code) {
  3285. return code >= 0x0030 && code <= 0x0039;
  3286. }
  3287. // hex digit
  3288. // A digit, or a code point between U+0041 LATIN CAPITAL LETTER A (A) and U+0046 LATIN CAPITAL LETTER F (F),
  3289. // or a code point between U+0061 LATIN SMALL LETTER A (a) and U+0066 LATIN SMALL LETTER F (f).
  3290. function isHexDigit$4(code) {
  3291. return (
  3292. isDigit$5(code) || // 0 .. 9
  3293. (code >= 0x0041 && code <= 0x0046) || // A .. F
  3294. (code >= 0x0061 && code <= 0x0066) // a .. f
  3295. );
  3296. }
  3297. // uppercase letter
  3298. // A code point between U+0041 LATIN CAPITAL LETTER A (A) and U+005A LATIN CAPITAL LETTER Z (Z).
  3299. function isUppercaseLetter$1(code) {
  3300. return code >= 0x0041 && code <= 0x005A;
  3301. }
  3302. // lowercase letter
  3303. // A code point between U+0061 LATIN SMALL LETTER A (a) and U+007A LATIN SMALL LETTER Z (z).
  3304. function isLowercaseLetter(code) {
  3305. return code >= 0x0061 && code <= 0x007A;
  3306. }
  3307. // letter
  3308. // An uppercase letter or a lowercase letter.
  3309. function isLetter(code) {
  3310. return isUppercaseLetter$1(code) || isLowercaseLetter(code);
  3311. }
  3312. // non-ASCII code point
  3313. // A code point with a value equal to or greater than U+0080 <control>.
  3314. function isNonAscii(code) {
  3315. return code >= 0x0080;
  3316. }
  3317. // name-start code point
  3318. // A letter, a non-ASCII code point, or U+005F LOW LINE (_).
  3319. function isNameStart(code) {
  3320. return isLetter(code) || isNonAscii(code) || code === 0x005F;
  3321. }
  3322. // name code point
  3323. // A name-start code point, a digit, or U+002D HYPHEN-MINUS (-).
  3324. function isName$2(code) {
  3325. return isNameStart(code) || isDigit$5(code) || code === 0x002D;
  3326. }
  3327. // non-printable code point
  3328. // A code point between U+0000 NULL and U+0008 BACKSPACE, or U+000B LINE TABULATION,
  3329. // or a code point between U+000E SHIFT OUT and U+001F INFORMATION SEPARATOR ONE, or U+007F DELETE.
  3330. function isNonPrintable(code) {
  3331. return (
  3332. (code >= 0x0000 && code <= 0x0008) ||
  3333. (code === 0x000B) ||
  3334. (code >= 0x000E && code <= 0x001F) ||
  3335. (code === 0x007F)
  3336. );
  3337. }
  3338. // newline
  3339. // U+000A LINE FEED. Note that U+000D CARRIAGE RETURN and U+000C FORM FEED are not included in this definition,
  3340. // as they are converted to U+000A LINE FEED during preprocessing.
  3341. // TODO: we doesn't do a preprocessing, so check a code point for U+000D CARRIAGE RETURN and U+000C FORM FEED
  3342. function isNewline$1(code) {
  3343. return code === 0x000A || code === 0x000D || code === 0x000C;
  3344. }
  3345. // whitespace
  3346. // A newline, U+0009 CHARACTER TABULATION, or U+0020 SPACE.
  3347. function isWhiteSpace$2(code) {
  3348. return isNewline$1(code) || code === 0x0020 || code === 0x0009;
  3349. }
  3350. // § 4.3.8. Check if two code points are a valid escape
  3351. function isValidEscape$2(first, second) {
  3352. // If the first code point is not U+005C REVERSE SOLIDUS (\), return false.
  3353. if (first !== 0x005C) {
  3354. return false;
  3355. }
  3356. // Otherwise, if the second code point is a newline or EOF, return false.
  3357. if (isNewline$1(second) || second === EOF$1) {
  3358. return false;
  3359. }
  3360. // Otherwise, return true.
  3361. return true;
  3362. }
  3363. // § 4.3.9. Check if three code points would start an identifier
  3364. function isIdentifierStart$2(first, second, third) {
  3365. // Look at the first code point:
  3366. // U+002D HYPHEN-MINUS
  3367. if (first === 0x002D) {
  3368. // If the second code point is a name-start code point or a U+002D HYPHEN-MINUS,
  3369. // or the second and third code points are a valid escape, return true. Otherwise, return false.
  3370. return (
  3371. isNameStart(second) ||
  3372. second === 0x002D ||
  3373. isValidEscape$2(second, third)
  3374. );
  3375. }
  3376. // name-start code point
  3377. if (isNameStart(first)) {
  3378. // Return true.
  3379. return true;
  3380. }
  3381. // U+005C REVERSE SOLIDUS (\)
  3382. if (first === 0x005C) {
  3383. // If the first and second code points are a valid escape, return true. Otherwise, return false.
  3384. return isValidEscape$2(first, second);
  3385. }
  3386. // anything else
  3387. // Return false.
  3388. return false;
  3389. }
  3390. // § 4.3.10. Check if three code points would start a number
  3391. function isNumberStart$1(first, second, third) {
  3392. // Look at the first code point:
  3393. // U+002B PLUS SIGN (+)
  3394. // U+002D HYPHEN-MINUS (-)
  3395. if (first === 0x002B || first === 0x002D) {
  3396. // If the second code point is a digit, return true.
  3397. if (isDigit$5(second)) {
  3398. return 2;
  3399. }
  3400. // Otherwise, if the second code point is a U+002E FULL STOP (.)
  3401. // and the third code point is a digit, return true.
  3402. // Otherwise, return false.
  3403. return second === 0x002E && isDigit$5(third) ? 3 : 0;
  3404. }
  3405. // U+002E FULL STOP (.)
  3406. if (first === 0x002E) {
  3407. // If the second code point is a digit, return true. Otherwise, return false.
  3408. return isDigit$5(second) ? 2 : 0;
  3409. }
  3410. // digit
  3411. if (isDigit$5(first)) {
  3412. // Return true.
  3413. return 1;
  3414. }
  3415. // anything else
  3416. // Return false.
  3417. return 0;
  3418. }
  3419. //
  3420. // Misc
  3421. //
  3422. // detect BOM (https://en.wikipedia.org/wiki/Byte_order_mark)
  3423. function isBOM$2(code) {
  3424. // UTF-16BE
  3425. if (code === 0xFEFF) {
  3426. return 1;
  3427. }
  3428. // UTF-16LE
  3429. if (code === 0xFFFE) {
  3430. return 1;
  3431. }
  3432. return 0;
  3433. }
  3434. // Fast code category
  3435. //
  3436. // https://drafts.csswg.org/css-syntax/#tokenizer-definitions
  3437. // > non-ASCII code point
  3438. // > A code point with a value equal to or greater than U+0080 <control>
  3439. // > name-start code point
  3440. // > A letter, a non-ASCII code point, or U+005F LOW LINE (_).
  3441. // > name code point
  3442. // > A name-start code point, a digit, or U+002D HYPHEN-MINUS (-)
  3443. // That means only ASCII code points has a special meaning and we define a maps for 0..127 codes only
  3444. var CATEGORY = new Array(0x80);
  3445. charCodeCategory$1.Eof = 0x80;
  3446. charCodeCategory$1.WhiteSpace = 0x82;
  3447. charCodeCategory$1.Digit = 0x83;
  3448. charCodeCategory$1.NameStart = 0x84;
  3449. charCodeCategory$1.NonPrintable = 0x85;
  3450. for (var i = 0; i < CATEGORY.length; i++) {
  3451. switch (true) {
  3452. case isWhiteSpace$2(i):
  3453. CATEGORY[i] = charCodeCategory$1.WhiteSpace;
  3454. break;
  3455. case isDigit$5(i):
  3456. CATEGORY[i] = charCodeCategory$1.Digit;
  3457. break;
  3458. case isNameStart(i):
  3459. CATEGORY[i] = charCodeCategory$1.NameStart;
  3460. break;
  3461. case isNonPrintable(i):
  3462. CATEGORY[i] = charCodeCategory$1.NonPrintable;
  3463. break;
  3464. default:
  3465. CATEGORY[i] = i || charCodeCategory$1.Eof;
  3466. }
  3467. }
  3468. function charCodeCategory$1(code) {
  3469. return code < 0x80 ? CATEGORY[code] : charCodeCategory$1.NameStart;
  3470. }
  3471. var charCodeDefinitions$1 = {
  3472. isDigit: isDigit$5,
  3473. isHexDigit: isHexDigit$4,
  3474. isUppercaseLetter: isUppercaseLetter$1,
  3475. isLowercaseLetter: isLowercaseLetter,
  3476. isLetter: isLetter,
  3477. isNonAscii: isNonAscii,
  3478. isNameStart: isNameStart,
  3479. isName: isName$2,
  3480. isNonPrintable: isNonPrintable,
  3481. isNewline: isNewline$1,
  3482. isWhiteSpace: isWhiteSpace$2,
  3483. isValidEscape: isValidEscape$2,
  3484. isIdentifierStart: isIdentifierStart$2,
  3485. isNumberStart: isNumberStart$1,
  3486. isBOM: isBOM$2,
  3487. charCodeCategory: charCodeCategory$1
  3488. };
  3489. var charCodeDef = charCodeDefinitions$1;
  3490. var isDigit$4 = charCodeDef.isDigit;
  3491. var isHexDigit$3 = charCodeDef.isHexDigit;
  3492. var isUppercaseLetter = charCodeDef.isUppercaseLetter;
  3493. var isName$1 = charCodeDef.isName;
  3494. var isWhiteSpace$1 = charCodeDef.isWhiteSpace;
  3495. var isValidEscape$1 = charCodeDef.isValidEscape;
  3496. function getCharCode(source, offset) {
  3497. return offset < source.length ? source.charCodeAt(offset) : 0;
  3498. }
  3499. function getNewlineLength$1(source, offset, code) {
  3500. if (code === 13 /* \r */ && getCharCode(source, offset + 1) === 10 /* \n */) {
  3501. return 2;
  3502. }
  3503. return 1;
  3504. }
  3505. function cmpChar$5(testStr, offset, referenceCode) {
  3506. var code = testStr.charCodeAt(offset);
  3507. // code.toLowerCase() for A..Z
  3508. if (isUppercaseLetter(code)) {
  3509. code = code | 32;
  3510. }
  3511. return code === referenceCode;
  3512. }
  3513. function cmpStr$6(testStr, start, end, referenceStr) {
  3514. if (end - start !== referenceStr.length) {
  3515. return false;
  3516. }
  3517. if (start < 0 || end > testStr.length) {
  3518. return false;
  3519. }
  3520. for (var i = start; i < end; i++) {
  3521. var testCode = testStr.charCodeAt(i);
  3522. var referenceCode = referenceStr.charCodeAt(i - start);
  3523. // testCode.toLowerCase() for A..Z
  3524. if (isUppercaseLetter(testCode)) {
  3525. testCode = testCode | 32;
  3526. }
  3527. if (testCode !== referenceCode) {
  3528. return false;
  3529. }
  3530. }
  3531. return true;
  3532. }
  3533. function findWhiteSpaceStart$1(source, offset) {
  3534. for (; offset >= 0; offset--) {
  3535. if (!isWhiteSpace$1(source.charCodeAt(offset))) {
  3536. break;
  3537. }
  3538. }
  3539. return offset + 1;
  3540. }
  3541. function findWhiteSpaceEnd$1(source, offset) {
  3542. for (; offset < source.length; offset++) {
  3543. if (!isWhiteSpace$1(source.charCodeAt(offset))) {
  3544. break;
  3545. }
  3546. }
  3547. return offset;
  3548. }
  3549. function findDecimalNumberEnd(source, offset) {
  3550. for (; offset < source.length; offset++) {
  3551. if (!isDigit$4(source.charCodeAt(offset))) {
  3552. break;
  3553. }
  3554. }
  3555. return offset;
  3556. }
  3557. // § 4.3.7. Consume an escaped code point
  3558. function consumeEscaped$1(source, offset) {
  3559. // It assumes that the U+005C REVERSE SOLIDUS (\) has already been consumed and
  3560. // that the next input code point has already been verified to be part of a valid escape.
  3561. offset += 2;
  3562. // hex digit
  3563. if (isHexDigit$3(getCharCode(source, offset - 1))) {
  3564. // Consume as many hex digits as possible, but no more than 5.
  3565. // Note that this means 1-6 hex digits have been consumed in total.
  3566. for (var maxOffset = Math.min(source.length, offset + 5); offset < maxOffset; offset++) {
  3567. if (!isHexDigit$3(getCharCode(source, offset))) {
  3568. break;
  3569. }
  3570. }
  3571. // If the next input code point is whitespace, consume it as well.
  3572. var code = getCharCode(source, offset);
  3573. if (isWhiteSpace$1(code)) {
  3574. offset += getNewlineLength$1(source, offset, code);
  3575. }
  3576. }
  3577. return offset;
  3578. }
  3579. // §4.3.11. Consume a name
  3580. // Note: This algorithm does not do the verification of the first few code points that are necessary
  3581. // to ensure the returned code points would constitute an <ident-token>. If that is the intended use,
  3582. // ensure that the stream starts with an identifier before calling this algorithm.
  3583. function consumeName$1(source, offset) {
  3584. // Let result initially be an empty string.
  3585. // Repeatedly consume the next input code point from the stream:
  3586. for (; offset < source.length; offset++) {
  3587. var code = source.charCodeAt(offset);
  3588. // name code point
  3589. if (isName$1(code)) {
  3590. // Append the code point to result.
  3591. continue;
  3592. }
  3593. // the stream starts with a valid escape
  3594. if (isValidEscape$1(code, getCharCode(source, offset + 1))) {
  3595. // Consume an escaped code point. Append the returned code point to result.
  3596. offset = consumeEscaped$1(source, offset) - 1;
  3597. continue;
  3598. }
  3599. // anything else
  3600. // Reconsume the current input code point. Return result.
  3601. break;
  3602. }
  3603. return offset;
  3604. }
  3605. // §4.3.12. Consume a number
  3606. function consumeNumber$5(source, offset) {
  3607. var code = source.charCodeAt(offset);
  3608. // 2. If the next input code point is U+002B PLUS SIGN (+) or U+002D HYPHEN-MINUS (-),
  3609. // consume it and append it to repr.
  3610. if (code === 0x002B || code === 0x002D) {
  3611. code = source.charCodeAt(offset += 1);
  3612. }
  3613. // 3. While the next input code point is a digit, consume it and append it to repr.
  3614. if (isDigit$4(code)) {
  3615. offset = findDecimalNumberEnd(source, offset + 1);
  3616. code = source.charCodeAt(offset);
  3617. }
  3618. // 4. If the next 2 input code points are U+002E FULL STOP (.) followed by a digit, then:
  3619. if (code === 0x002E && isDigit$4(source.charCodeAt(offset + 1))) {
  3620. // 4.1 Consume them.
  3621. // 4.2 Append them to repr.
  3622. code = source.charCodeAt(offset += 2);
  3623. // 4.3 Set type to "number".
  3624. // TODO
  3625. // 4.4 While the next input code point is a digit, consume it and append it to repr.
  3626. offset = findDecimalNumberEnd(source, offset);
  3627. }
  3628. // 5. If the next 2 or 3 input code points are U+0045 LATIN CAPITAL LETTER E (E)
  3629. // or U+0065 LATIN SMALL LETTER E (e), ... , followed by a digit, then:
  3630. if (cmpChar$5(source, offset, 101 /* e */)) {
  3631. var sign = 0;
  3632. code = source.charCodeAt(offset + 1);
  3633. // ... optionally followed by U+002D HYPHEN-MINUS (-) or U+002B PLUS SIGN (+) ...
  3634. if (code === 0x002D || code === 0x002B) {
  3635. sign = 1;
  3636. code = source.charCodeAt(offset + 2);
  3637. }
  3638. // ... followed by a digit
  3639. if (isDigit$4(code)) {
  3640. // 5.1 Consume them.
  3641. // 5.2 Append them to repr.
  3642. // 5.3 Set type to "number".
  3643. // TODO
  3644. // 5.4 While the next input code point is a digit, consume it and append it to repr.
  3645. offset = findDecimalNumberEnd(source, offset + 1 + sign + 1);
  3646. }
  3647. }
  3648. return offset;
  3649. }
  3650. // § 4.3.14. Consume the remnants of a bad url
  3651. // ... its sole use is to consume enough of the input stream to reach a recovery point
  3652. // where normal tokenizing can resume.
  3653. function consumeBadUrlRemnants$1(source, offset) {
  3654. // Repeatedly consume the next input code point from the stream:
  3655. for (; offset < source.length; offset++) {
  3656. var code = source.charCodeAt(offset);
  3657. // U+0029 RIGHT PARENTHESIS ())
  3658. // EOF
  3659. if (code === 0x0029) {
  3660. // Return.
  3661. offset++;
  3662. break;
  3663. }
  3664. if (isValidEscape$1(code, getCharCode(source, offset + 1))) {
  3665. // Consume an escaped code point.
  3666. // Note: This allows an escaped right parenthesis ("\)") to be encountered
  3667. // without ending the <bad-url-token>. This is otherwise identical to
  3668. // the "anything else" clause.
  3669. offset = consumeEscaped$1(source, offset);
  3670. }
  3671. }
  3672. return offset;
  3673. }
  3674. var utils$2 = {
  3675. consumeEscaped: consumeEscaped$1,
  3676. consumeName: consumeName$1,
  3677. consumeNumber: consumeNumber$5,
  3678. consumeBadUrlRemnants: consumeBadUrlRemnants$1,
  3679. cmpChar: cmpChar$5,
  3680. cmpStr: cmpStr$6,
  3681. getNewlineLength: getNewlineLength$1,
  3682. findWhiteSpaceStart: findWhiteSpaceStart$1,
  3683. findWhiteSpaceEnd: findWhiteSpaceEnd$1
  3684. };
  3685. var constants$2 = _const;
  3686. var TYPE$G = constants$2.TYPE;
  3687. var NAME$2 = constants$2.NAME;
  3688. var utils$1 = utils$2;
  3689. var cmpStr$5 = utils$1.cmpStr;
  3690. var EOF = TYPE$G.EOF;
  3691. var WHITESPACE$c = TYPE$G.WhiteSpace;
  3692. var COMMENT$a = TYPE$G.Comment;
  3693. var OFFSET_MASK$1 = 0x00FFFFFF;
  3694. var TYPE_SHIFT$1 = 24;
  3695. var TokenStream$4 = function() {
  3696. this.offsetAndType = null;
  3697. this.balance = null;
  3698. this.reset();
  3699. };
  3700. TokenStream$4.prototype = {
  3701. reset: function() {
  3702. this.eof = false;
  3703. this.tokenIndex = -1;
  3704. this.tokenType = 0;
  3705. this.tokenStart = this.firstCharOffset;
  3706. this.tokenEnd = this.firstCharOffset;
  3707. },
  3708. lookupType: function(offset) {
  3709. offset += this.tokenIndex;
  3710. if (offset < this.tokenCount) {
  3711. return this.offsetAndType[offset] >> TYPE_SHIFT$1;
  3712. }
  3713. return EOF;
  3714. },
  3715. lookupOffset: function(offset) {
  3716. offset += this.tokenIndex;
  3717. if (offset < this.tokenCount) {
  3718. return this.offsetAndType[offset - 1] & OFFSET_MASK$1;
  3719. }
  3720. return this.source.length;
  3721. },
  3722. lookupValue: function(offset, referenceStr) {
  3723. offset += this.tokenIndex;
  3724. if (offset < this.tokenCount) {
  3725. return cmpStr$5(
  3726. this.source,
  3727. this.offsetAndType[offset - 1] & OFFSET_MASK$1,
  3728. this.offsetAndType[offset] & OFFSET_MASK$1,
  3729. referenceStr
  3730. );
  3731. }
  3732. return false;
  3733. },
  3734. getTokenStart: function(tokenIndex) {
  3735. if (tokenIndex === this.tokenIndex) {
  3736. return this.tokenStart;
  3737. }
  3738. if (tokenIndex > 0) {
  3739. return tokenIndex < this.tokenCount
  3740. ? this.offsetAndType[tokenIndex - 1] & OFFSET_MASK$1
  3741. : this.offsetAndType[this.tokenCount] & OFFSET_MASK$1;
  3742. }
  3743. return this.firstCharOffset;
  3744. },
  3745. // TODO: -> skipUntilBalanced
  3746. getRawLength: function(startToken, mode) {
  3747. var cursor = startToken;
  3748. var balanceEnd;
  3749. var offset = this.offsetAndType[Math.max(cursor - 1, 0)] & OFFSET_MASK$1;
  3750. var type;
  3751. loop:
  3752. for (; cursor < this.tokenCount; cursor++) {
  3753. balanceEnd = this.balance[cursor];
  3754. // stop scanning on balance edge that points to offset before start token
  3755. if (balanceEnd < startToken) {
  3756. break loop;
  3757. }
  3758. type = this.offsetAndType[cursor] >> TYPE_SHIFT$1;
  3759. // check token is stop type
  3760. switch (mode(type, this.source, offset)) {
  3761. case 1:
  3762. break loop;
  3763. case 2:
  3764. cursor++;
  3765. break loop;
  3766. default:
  3767. // fast forward to the end of balanced block
  3768. if (this.balance[balanceEnd] === cursor) {
  3769. cursor = balanceEnd;
  3770. }
  3771. offset = this.offsetAndType[cursor] & OFFSET_MASK$1;
  3772. }
  3773. }
  3774. return cursor - this.tokenIndex;
  3775. },
  3776. isBalanceEdge: function(pos) {
  3777. return this.balance[this.tokenIndex] < pos;
  3778. },
  3779. isDelim: function(code, offset) {
  3780. if (offset) {
  3781. return (
  3782. this.lookupType(offset) === TYPE$G.Delim &&
  3783. this.source.charCodeAt(this.lookupOffset(offset)) === code
  3784. );
  3785. }
  3786. return (
  3787. this.tokenType === TYPE$G.Delim &&
  3788. this.source.charCodeAt(this.tokenStart) === code
  3789. );
  3790. },
  3791. getTokenValue: function() {
  3792. return this.source.substring(this.tokenStart, this.tokenEnd);
  3793. },
  3794. getTokenLength: function() {
  3795. return this.tokenEnd - this.tokenStart;
  3796. },
  3797. substrToCursor: function(start) {
  3798. return this.source.substring(start, this.tokenStart);
  3799. },
  3800. skipWS: function() {
  3801. for (var i = this.tokenIndex, skipTokenCount = 0; i < this.tokenCount; i++, skipTokenCount++) {
  3802. if ((this.offsetAndType[i] >> TYPE_SHIFT$1) !== WHITESPACE$c) {
  3803. break;
  3804. }
  3805. }
  3806. if (skipTokenCount > 0) {
  3807. this.skip(skipTokenCount);
  3808. }
  3809. },
  3810. skipSC: function() {
  3811. while (this.tokenType === WHITESPACE$c || this.tokenType === COMMENT$a) {
  3812. this.next();
  3813. }
  3814. },
  3815. skip: function(tokenCount) {
  3816. var next = this.tokenIndex + tokenCount;
  3817. if (next < this.tokenCount) {
  3818. this.tokenIndex = next;
  3819. this.tokenStart = this.offsetAndType[next - 1] & OFFSET_MASK$1;
  3820. next = this.offsetAndType[next];
  3821. this.tokenType = next >> TYPE_SHIFT$1;
  3822. this.tokenEnd = next & OFFSET_MASK$1;
  3823. } else {
  3824. this.tokenIndex = this.tokenCount;
  3825. this.next();
  3826. }
  3827. },
  3828. next: function() {
  3829. var next = this.tokenIndex + 1;
  3830. if (next < this.tokenCount) {
  3831. this.tokenIndex = next;
  3832. this.tokenStart = this.tokenEnd;
  3833. next = this.offsetAndType[next];
  3834. this.tokenType = next >> TYPE_SHIFT$1;
  3835. this.tokenEnd = next & OFFSET_MASK$1;
  3836. } else {
  3837. this.tokenIndex = this.tokenCount;
  3838. this.eof = true;
  3839. this.tokenType = EOF;
  3840. this.tokenStart = this.tokenEnd = this.source.length;
  3841. }
  3842. },
  3843. forEachToken(fn) {
  3844. for (var i = 0, offset = this.firstCharOffset; i < this.tokenCount; i++) {
  3845. var start = offset;
  3846. var item = this.offsetAndType[i];
  3847. var end = item & OFFSET_MASK$1;
  3848. var type = item >> TYPE_SHIFT$1;
  3849. offset = end;
  3850. fn(type, start, end, i);
  3851. }
  3852. },
  3853. dump() {
  3854. var tokens = new Array(this.tokenCount);
  3855. this.forEachToken((type, start, end, index) => {
  3856. tokens[index] = {
  3857. idx: index,
  3858. type: NAME$2[type],
  3859. chunk: this.source.substring(start, end),
  3860. balance: this.balance[index]
  3861. };
  3862. });
  3863. return tokens;
  3864. }
  3865. };
  3866. var TokenStream_1 = TokenStream$4;
  3867. function noop$3(value) {
  3868. return value;
  3869. }
  3870. function generateMultiplier(multiplier) {
  3871. if (multiplier.min === 0 && multiplier.max === 0) {
  3872. return '*';
  3873. }
  3874. if (multiplier.min === 0 && multiplier.max === 1) {
  3875. return '?';
  3876. }
  3877. if (multiplier.min === 1 && multiplier.max === 0) {
  3878. return multiplier.comma ? '#' : '+';
  3879. }
  3880. if (multiplier.min === 1 && multiplier.max === 1) {
  3881. return '';
  3882. }
  3883. return (
  3884. (multiplier.comma ? '#' : '') +
  3885. (multiplier.min === multiplier.max
  3886. ? '{' + multiplier.min + '}'
  3887. : '{' + multiplier.min + ',' + (multiplier.max !== 0 ? multiplier.max : '') + '}'
  3888. )
  3889. );
  3890. }
  3891. function generateTypeOpts(node) {
  3892. switch (node.type) {
  3893. case 'Range':
  3894. return (
  3895. ' [' +
  3896. (node.min === null ? '-∞' : node.min) +
  3897. ',' +
  3898. (node.max === null ? '∞' : node.max) +
  3899. ']'
  3900. );
  3901. default:
  3902. throw new Error('Unknown node type `' + node.type + '`');
  3903. }
  3904. }
  3905. function generateSequence(node, decorate, forceBraces, compact) {
  3906. var combinator = node.combinator === ' ' || compact ? node.combinator : ' ' + node.combinator + ' ';
  3907. var result = node.terms.map(function(term) {
  3908. return generate$2(term, decorate, forceBraces, compact);
  3909. }).join(combinator);
  3910. if (node.explicit || forceBraces) {
  3911. result = (compact || result[0] === ',' ? '[' : '[ ') + result + (compact ? ']' : ' ]');
  3912. }
  3913. return result;
  3914. }
  3915. function generate$2(node, decorate, forceBraces, compact) {
  3916. var result;
  3917. switch (node.type) {
  3918. case 'Group':
  3919. result =
  3920. generateSequence(node, decorate, forceBraces, compact) +
  3921. (node.disallowEmpty ? '!' : '');
  3922. break;
  3923. case 'Multiplier':
  3924. // return since node is a composition
  3925. return (
  3926. generate$2(node.term, decorate, forceBraces, compact) +
  3927. decorate(generateMultiplier(node), node)
  3928. );
  3929. case 'Type':
  3930. result = '<' + node.name + (node.opts ? decorate(generateTypeOpts(node.opts), node.opts) : '') + '>';
  3931. break;
  3932. case 'Property':
  3933. result = '<\'' + node.name + '\'>';
  3934. break;
  3935. case 'Keyword':
  3936. result = node.name;
  3937. break;
  3938. case 'AtKeyword':
  3939. result = '@' + node.name;
  3940. break;
  3941. case 'Function':
  3942. result = node.name + '(';
  3943. break;
  3944. case 'String':
  3945. case 'Token':
  3946. result = node.value;
  3947. break;
  3948. case 'Comma':
  3949. result = ',';
  3950. break;
  3951. default:
  3952. throw new Error('Unknown node type `' + node.type + '`');
  3953. }
  3954. return decorate(result, node);
  3955. }
  3956. var generate_1 = function(node, options) {
  3957. var decorate = noop$3;
  3958. var forceBraces = false;
  3959. var compact = false;
  3960. if (typeof options === 'function') {
  3961. decorate = options;
  3962. } else if (options) {
  3963. forceBraces = Boolean(options.forceBraces);
  3964. compact = Boolean(options.compact);
  3965. if (typeof options.decorate === 'function') {
  3966. decorate = options.decorate;
  3967. }
  3968. }
  3969. return generate$2(node, decorate, forceBraces, compact);
  3970. };
  3971. const createCustomError$1 = createCustomError$3;
  3972. const generate$1 = generate_1;
  3973. const defaultLoc = { offset: 0, line: 1, column: 1 };
  3974. function locateMismatch(matchResult, node) {
  3975. const tokens = matchResult.tokens;
  3976. const longestMatch = matchResult.longestMatch;
  3977. const mismatchNode = longestMatch < tokens.length ? tokens[longestMatch].node || null : null;
  3978. const badNode = mismatchNode !== node ? mismatchNode : null;
  3979. let mismatchOffset = 0;
  3980. let mismatchLength = 0;
  3981. let entries = 0;
  3982. let css = '';
  3983. let start;
  3984. let end;
  3985. for (let i = 0; i < tokens.length; i++) {
  3986. const token = tokens[i].value;
  3987. if (i === longestMatch) {
  3988. mismatchLength = token.length;
  3989. mismatchOffset = css.length;
  3990. }
  3991. if (badNode !== null && tokens[i].node === badNode) {
  3992. if (i <= longestMatch) {
  3993. entries++;
  3994. } else {
  3995. entries = 0;
  3996. }
  3997. }
  3998. css += token;
  3999. }
  4000. if (longestMatch === tokens.length || entries > 1) { // last
  4001. start = fromLoc(badNode || node, 'end') || buildLoc(defaultLoc, css);
  4002. end = buildLoc(start);
  4003. } else {
  4004. start = fromLoc(badNode, 'start') ||
  4005. buildLoc(fromLoc(node, 'start') || defaultLoc, css.slice(0, mismatchOffset));
  4006. end = fromLoc(badNode, 'end') ||
  4007. buildLoc(start, css.substr(mismatchOffset, mismatchLength));
  4008. }
  4009. return {
  4010. css,
  4011. mismatchOffset,
  4012. mismatchLength,
  4013. start,
  4014. end
  4015. };
  4016. }
  4017. function fromLoc(node, point) {
  4018. const value = node && node.loc && node.loc[point];
  4019. if (value) {
  4020. return 'line' in value ? buildLoc(value) : value;
  4021. }
  4022. return null;
  4023. }
  4024. function buildLoc({ offset, line, column }, extra) {
  4025. const loc = {
  4026. offset,
  4027. line,
  4028. column
  4029. };
  4030. if (extra) {
  4031. const lines = extra.split(/\n|\r\n?|\f/);
  4032. loc.offset += extra.length;
  4033. loc.line += lines.length - 1;
  4034. loc.column = lines.length === 1 ? loc.column + extra.length : lines.pop().length + 1;
  4035. }
  4036. return loc;
  4037. }
  4038. const SyntaxReferenceError$1 = function(type, referenceName) {
  4039. const error = createCustomError$1(
  4040. 'SyntaxReferenceError',
  4041. type + (referenceName ? ' `' + referenceName + '`' : '')
  4042. );
  4043. error.reference = referenceName;
  4044. return error;
  4045. };
  4046. const SyntaxMatchError$1 = function(message, syntax, node, matchResult) {
  4047. const error = createCustomError$1('SyntaxMatchError', message);
  4048. const {
  4049. css,
  4050. mismatchOffset,
  4051. mismatchLength,
  4052. start,
  4053. end
  4054. } = locateMismatch(matchResult, node);
  4055. error.rawMessage = message;
  4056. error.syntax = syntax ? generate$1(syntax) : '<generic>';
  4057. error.css = css;
  4058. error.mismatchOffset = mismatchOffset;
  4059. error.mismatchLength = mismatchLength;
  4060. error.message = message + '\n' +
  4061. ' syntax: ' + error.syntax + '\n' +
  4062. ' value: ' + (css || '<empty string>') + '\n' +
  4063. ' --------' + new Array(error.mismatchOffset + 1).join('-') + '^';
  4064. Object.assign(error, start);
  4065. error.loc = {
  4066. source: (node && node.loc && node.loc.source) || '<unknown>',
  4067. start,
  4068. end
  4069. };
  4070. return error;
  4071. };
  4072. var error = {
  4073. SyntaxReferenceError: SyntaxReferenceError$1,
  4074. SyntaxMatchError: SyntaxMatchError$1
  4075. };
  4076. var hasOwnProperty$7 = Object.prototype.hasOwnProperty;
  4077. var keywords$1 = Object.create(null);
  4078. var properties$1 = Object.create(null);
  4079. var HYPHENMINUS$5 = 45; // '-'.charCodeAt()
  4080. function isCustomProperty$1(str, offset) {
  4081. offset = offset || 0;
  4082. return str.length - offset >= 2 &&
  4083. str.charCodeAt(offset) === HYPHENMINUS$5 &&
  4084. str.charCodeAt(offset + 1) === HYPHENMINUS$5;
  4085. }
  4086. function getVendorPrefix(str, offset) {
  4087. offset = offset || 0;
  4088. // verdor prefix should be at least 3 chars length
  4089. if (str.length - offset >= 3) {
  4090. // vendor prefix starts with hyper minus following non-hyper minus
  4091. if (str.charCodeAt(offset) === HYPHENMINUS$5 &&
  4092. str.charCodeAt(offset + 1) !== HYPHENMINUS$5) {
  4093. // vendor prefix should contain a hyper minus at the ending
  4094. var secondDashIndex = str.indexOf('-', offset + 2);
  4095. if (secondDashIndex !== -1) {
  4096. return str.substring(offset, secondDashIndex + 1);
  4097. }
  4098. }
  4099. }
  4100. return '';
  4101. }
  4102. function getKeywordDescriptor(keyword) {
  4103. if (hasOwnProperty$7.call(keywords$1, keyword)) {
  4104. return keywords$1[keyword];
  4105. }
  4106. var name = keyword.toLowerCase();
  4107. if (hasOwnProperty$7.call(keywords$1, name)) {
  4108. return keywords$1[keyword] = keywords$1[name];
  4109. }
  4110. var custom = isCustomProperty$1(name, 0);
  4111. var vendor = !custom ? getVendorPrefix(name, 0) : '';
  4112. return keywords$1[keyword] = Object.freeze({
  4113. basename: name.substr(vendor.length),
  4114. name: name,
  4115. vendor: vendor,
  4116. prefix: vendor,
  4117. custom: custom
  4118. });
  4119. }
  4120. function getPropertyDescriptor(property) {
  4121. if (hasOwnProperty$7.call(properties$1, property)) {
  4122. return properties$1[property];
  4123. }
  4124. var name = property;
  4125. var hack = property[0];
  4126. if (hack === '/') {
  4127. hack = property[1] === '/' ? '//' : '/';
  4128. } else if (hack !== '_' &&
  4129. hack !== '*' &&
  4130. hack !== '$' &&
  4131. hack !== '#' &&
  4132. hack !== '+' &&
  4133. hack !== '&') {
  4134. hack = '';
  4135. }
  4136. var custom = isCustomProperty$1(name, hack.length);
  4137. // re-use result when possible (the same as for lower case)
  4138. if (!custom) {
  4139. name = name.toLowerCase();
  4140. if (hasOwnProperty$7.call(properties$1, name)) {
  4141. return properties$1[property] = properties$1[name];
  4142. }
  4143. }
  4144. var vendor = !custom ? getVendorPrefix(name, hack.length) : '';
  4145. var prefix = name.substr(0, hack.length + vendor.length);
  4146. return properties$1[property] = Object.freeze({
  4147. basename: name.substr(prefix.length),
  4148. name: name.substr(hack.length),
  4149. hack: hack,
  4150. vendor: vendor,
  4151. prefix: prefix,
  4152. custom: custom
  4153. });
  4154. }
  4155. var names$2 = {
  4156. keyword: getKeywordDescriptor,
  4157. property: getPropertyDescriptor,
  4158. isCustomProperty: isCustomProperty$1,
  4159. vendorPrefix: getVendorPrefix
  4160. };
  4161. var MIN_SIZE = 16 * 1024;
  4162. var SafeUint32Array = typeof Uint32Array !== 'undefined' ? Uint32Array : Array; // fallback on Array when TypedArray is not supported
  4163. var adoptBuffer$2 = function adoptBuffer(buffer, size) {
  4164. if (buffer === null || buffer.length < size) {
  4165. return new SafeUint32Array(Math.max(size + 1024, MIN_SIZE));
  4166. }
  4167. return buffer;
  4168. };
  4169. var TokenStream$3 = TokenStream_1;
  4170. var adoptBuffer$1 = adoptBuffer$2;
  4171. var constants$1 = _const;
  4172. var TYPE$F = constants$1.TYPE;
  4173. var charCodeDefinitions = charCodeDefinitions$1;
  4174. var isNewline = charCodeDefinitions.isNewline;
  4175. var isName = charCodeDefinitions.isName;
  4176. var isValidEscape = charCodeDefinitions.isValidEscape;
  4177. var isNumberStart = charCodeDefinitions.isNumberStart;
  4178. var isIdentifierStart$1 = charCodeDefinitions.isIdentifierStart;
  4179. var charCodeCategory = charCodeDefinitions.charCodeCategory;
  4180. var isBOM$1 = charCodeDefinitions.isBOM;
  4181. var utils = utils$2;
  4182. var cmpStr$4 = utils.cmpStr;
  4183. var getNewlineLength = utils.getNewlineLength;
  4184. var findWhiteSpaceEnd = utils.findWhiteSpaceEnd;
  4185. var consumeEscaped = utils.consumeEscaped;
  4186. var consumeName = utils.consumeName;
  4187. var consumeNumber$4 = utils.consumeNumber;
  4188. var consumeBadUrlRemnants = utils.consumeBadUrlRemnants;
  4189. var OFFSET_MASK = 0x00FFFFFF;
  4190. var TYPE_SHIFT = 24;
  4191. function tokenize$3(source, stream) {
  4192. function getCharCode(offset) {
  4193. return offset < sourceLength ? source.charCodeAt(offset) : 0;
  4194. }
  4195. // § 4.3.3. Consume a numeric token
  4196. function consumeNumericToken() {
  4197. // Consume a number and let number be the result.
  4198. offset = consumeNumber$4(source, offset);
  4199. // If the next 3 input code points would start an identifier, then:
  4200. if (isIdentifierStart$1(getCharCode(offset), getCharCode(offset + 1), getCharCode(offset + 2))) {
  4201. // Create a <dimension-token> with the same value and type flag as number, and a unit set initially to the empty string.
  4202. // Consume a name. Set the <dimension-token>’s unit to the returned value.
  4203. // Return the <dimension-token>.
  4204. type = TYPE$F.Dimension;
  4205. offset = consumeName(source, offset);
  4206. return;
  4207. }
  4208. // Otherwise, if the next input code point is U+0025 PERCENTAGE SIGN (%), consume it.
  4209. if (getCharCode(offset) === 0x0025) {
  4210. // Create a <percentage-token> with the same value as number, and return it.
  4211. type = TYPE$F.Percentage;
  4212. offset++;
  4213. return;
  4214. }
  4215. // Otherwise, create a <number-token> with the same value and type flag as number, and return it.
  4216. type = TYPE$F.Number;
  4217. }
  4218. // § 4.3.4. Consume an ident-like token
  4219. function consumeIdentLikeToken() {
  4220. const nameStartOffset = offset;
  4221. // Consume a name, and let string be the result.
  4222. offset = consumeName(source, offset);
  4223. // If string’s value is an ASCII case-insensitive match for "url",
  4224. // and the next input code point is U+0028 LEFT PARENTHESIS ((), consume it.
  4225. if (cmpStr$4(source, nameStartOffset, offset, 'url') && getCharCode(offset) === 0x0028) {
  4226. // While the next two input code points are whitespace, consume the next input code point.
  4227. offset = findWhiteSpaceEnd(source, offset + 1);
  4228. // If the next one or two input code points are U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('),
  4229. // or whitespace followed by U+0022 QUOTATION MARK (") or U+0027 APOSTROPHE ('),
  4230. // then create a <function-token> with its value set to string and return it.
  4231. if (getCharCode(offset) === 0x0022 ||
  4232. getCharCode(offset) === 0x0027) {
  4233. type = TYPE$F.Function;
  4234. offset = nameStartOffset + 4;
  4235. return;
  4236. }
  4237. // Otherwise, consume a url token, and return it.
  4238. consumeUrlToken();
  4239. return;
  4240. }
  4241. // Otherwise, if the next input code point is U+0028 LEFT PARENTHESIS ((), consume it.
  4242. // Create a <function-token> with its value set to string and return it.
  4243. if (getCharCode(offset) === 0x0028) {
  4244. type = TYPE$F.Function;
  4245. offset++;
  4246. return;
  4247. }
  4248. // Otherwise, create an <ident-token> with its value set to string and return it.
  4249. type = TYPE$F.Ident;
  4250. }
  4251. // § 4.3.5. Consume a string token
  4252. function consumeStringToken(endingCodePoint) {
  4253. // This algorithm may be called with an ending code point, which denotes the code point
  4254. // that ends the string. If an ending code point is not specified,
  4255. // the current input code point is used.
  4256. if (!endingCodePoint) {
  4257. endingCodePoint = getCharCode(offset++);
  4258. }
  4259. // Initially create a <string-token> with its value set to the empty string.
  4260. type = TYPE$F.String;
  4261. // Repeatedly consume the next input code point from the stream:
  4262. for (; offset < source.length; offset++) {
  4263. var code = source.charCodeAt(offset);
  4264. switch (charCodeCategory(code)) {
  4265. // ending code point
  4266. case endingCodePoint:
  4267. // Return the <string-token>.
  4268. offset++;
  4269. return;
  4270. // EOF
  4271. case charCodeCategory.Eof:
  4272. // This is a parse error. Return the <string-token>.
  4273. return;
  4274. // newline
  4275. case charCodeCategory.WhiteSpace:
  4276. if (isNewline(code)) {
  4277. // This is a parse error. Reconsume the current input code point,
  4278. // create a <bad-string-token>, and return it.
  4279. offset += getNewlineLength(source, offset, code);
  4280. type = TYPE$F.BadString;
  4281. return;
  4282. }
  4283. break;
  4284. // U+005C REVERSE SOLIDUS (\)
  4285. case 0x005C:
  4286. // If the next input code point is EOF, do nothing.
  4287. if (offset === source.length - 1) {
  4288. break;
  4289. }
  4290. var nextCode = getCharCode(offset + 1);
  4291. // Otherwise, if the next input code point is a newline, consume it.
  4292. if (isNewline(nextCode)) {
  4293. offset += getNewlineLength(source, offset + 1, nextCode);
  4294. } else if (isValidEscape(code, nextCode)) {
  4295. // Otherwise, (the stream starts with a valid escape) consume
  4296. // an escaped code point and append the returned code point to
  4297. // the <string-token>’s value.
  4298. offset = consumeEscaped(source, offset) - 1;
  4299. }
  4300. break;
  4301. // anything else
  4302. // Append the current input code point to the <string-token>’s value.
  4303. }
  4304. }
  4305. }
  4306. // § 4.3.6. Consume a url token
  4307. // Note: This algorithm assumes that the initial "url(" has already been consumed.
  4308. // This algorithm also assumes that it’s being called to consume an "unquoted" value, like url(foo).
  4309. // A quoted value, like url("foo"), is parsed as a <function-token>. Consume an ident-like token
  4310. // automatically handles this distinction; this algorithm shouldn’t be called directly otherwise.
  4311. function consumeUrlToken() {
  4312. // Initially create a <url-token> with its value set to the empty string.
  4313. type = TYPE$F.Url;
  4314. // Consume as much whitespace as possible.
  4315. offset = findWhiteSpaceEnd(source, offset);
  4316. // Repeatedly consume the next input code point from the stream:
  4317. for (; offset < source.length; offset++) {
  4318. var code = source.charCodeAt(offset);
  4319. switch (charCodeCategory(code)) {
  4320. // U+0029 RIGHT PARENTHESIS ())
  4321. case 0x0029:
  4322. // Return the <url-token>.
  4323. offset++;
  4324. return;
  4325. // EOF
  4326. case charCodeCategory.Eof:
  4327. // This is a parse error. Return the <url-token>.
  4328. return;
  4329. // whitespace
  4330. case charCodeCategory.WhiteSpace:
  4331. // Consume as much whitespace as possible.
  4332. offset = findWhiteSpaceEnd(source, offset);
  4333. // If the next input code point is U+0029 RIGHT PARENTHESIS ()) or EOF,
  4334. // consume it and return the <url-token>
  4335. // (if EOF was encountered, this is a parse error);
  4336. if (getCharCode(offset) === 0x0029 || offset >= source.length) {
  4337. if (offset < source.length) {
  4338. offset++;
  4339. }
  4340. return;
  4341. }
  4342. // otherwise, consume the remnants of a bad url, create a <bad-url-token>,
  4343. // and return it.
  4344. offset = consumeBadUrlRemnants(source, offset);
  4345. type = TYPE$F.BadUrl;
  4346. return;
  4347. // U+0022 QUOTATION MARK (")
  4348. // U+0027 APOSTROPHE (')
  4349. // U+0028 LEFT PARENTHESIS (()
  4350. // non-printable code point
  4351. case 0x0022:
  4352. case 0x0027:
  4353. case 0x0028:
  4354. case charCodeCategory.NonPrintable:
  4355. // This is a parse error. Consume the remnants of a bad url,
  4356. // create a <bad-url-token>, and return it.
  4357. offset = consumeBadUrlRemnants(source, offset);
  4358. type = TYPE$F.BadUrl;
  4359. return;
  4360. // U+005C REVERSE SOLIDUS (\)
  4361. case 0x005C:
  4362. // If the stream starts with a valid escape, consume an escaped code point and
  4363. // append the returned code point to the <url-token>’s value.
  4364. if (isValidEscape(code, getCharCode(offset + 1))) {
  4365. offset = consumeEscaped(source, offset) - 1;
  4366. break;
  4367. }
  4368. // Otherwise, this is a parse error. Consume the remnants of a bad url,
  4369. // create a <bad-url-token>, and return it.
  4370. offset = consumeBadUrlRemnants(source, offset);
  4371. type = TYPE$F.BadUrl;
  4372. return;
  4373. // anything else
  4374. // Append the current input code point to the <url-token>’s value.
  4375. }
  4376. }
  4377. }
  4378. if (!stream) {
  4379. stream = new TokenStream$3();
  4380. }
  4381. // ensure source is a string
  4382. source = String(source || '');
  4383. var sourceLength = source.length;
  4384. var offsetAndType = adoptBuffer$1(stream.offsetAndType, sourceLength + 1); // +1 because of eof-token
  4385. var balance = adoptBuffer$1(stream.balance, sourceLength + 1);
  4386. var tokenCount = 0;
  4387. var start = isBOM$1(getCharCode(0));
  4388. var offset = start;
  4389. var balanceCloseType = 0;
  4390. var balanceStart = 0;
  4391. var balancePrev = 0;
  4392. // https://drafts.csswg.org/css-syntax-3/#consume-token
  4393. // § 4.3.1. Consume a token
  4394. while (offset < sourceLength) {
  4395. var code = source.charCodeAt(offset);
  4396. var type = 0;
  4397. balance[tokenCount] = sourceLength;
  4398. switch (charCodeCategory(code)) {
  4399. // whitespace
  4400. case charCodeCategory.WhiteSpace:
  4401. // Consume as much whitespace as possible. Return a <whitespace-token>.
  4402. type = TYPE$F.WhiteSpace;
  4403. offset = findWhiteSpaceEnd(source, offset + 1);
  4404. break;
  4405. // U+0022 QUOTATION MARK (")
  4406. case 0x0022:
  4407. // Consume a string token and return it.
  4408. consumeStringToken();
  4409. break;
  4410. // U+0023 NUMBER SIGN (#)
  4411. case 0x0023:
  4412. // If the next input code point is a name code point or the next two input code points are a valid escape, then:
  4413. if (isName(getCharCode(offset + 1)) || isValidEscape(getCharCode(offset + 1), getCharCode(offset + 2))) {
  4414. // Create a <hash-token>.
  4415. type = TYPE$F.Hash;
  4416. // If the next 3 input code points would start an identifier, set the <hash-token>’s type flag to "id".
  4417. // if (isIdentifierStart(getCharCode(offset + 1), getCharCode(offset + 2), getCharCode(offset + 3))) {
  4418. // // TODO: set id flag
  4419. // }
  4420. // Consume a name, and set the <hash-token>’s value to the returned string.
  4421. offset = consumeName(source, offset + 1);
  4422. // Return the <hash-token>.
  4423. } else {
  4424. // Otherwise, return a <delim-token> with its value set to the current input code point.
  4425. type = TYPE$F.Delim;
  4426. offset++;
  4427. }
  4428. break;
  4429. // U+0027 APOSTROPHE (')
  4430. case 0x0027:
  4431. // Consume a string token and return it.
  4432. consumeStringToken();
  4433. break;
  4434. // U+0028 LEFT PARENTHESIS (()
  4435. case 0x0028:
  4436. // Return a <(-token>.
  4437. type = TYPE$F.LeftParenthesis;
  4438. offset++;
  4439. break;
  4440. // U+0029 RIGHT PARENTHESIS ())
  4441. case 0x0029:
  4442. // Return a <)-token>.
  4443. type = TYPE$F.RightParenthesis;
  4444. offset++;
  4445. break;
  4446. // U+002B PLUS SIGN (+)
  4447. case 0x002B:
  4448. // If the input stream starts with a number, ...
  4449. if (isNumberStart(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
  4450. // ... reconsume the current input code point, consume a numeric token, and return it.
  4451. consumeNumericToken();
  4452. } else {
  4453. // Otherwise, return a <delim-token> with its value set to the current input code point.
  4454. type = TYPE$F.Delim;
  4455. offset++;
  4456. }
  4457. break;
  4458. // U+002C COMMA (,)
  4459. case 0x002C:
  4460. // Return a <comma-token>.
  4461. type = TYPE$F.Comma;
  4462. offset++;
  4463. break;
  4464. // U+002D HYPHEN-MINUS (-)
  4465. case 0x002D:
  4466. // If the input stream starts with a number, reconsume the current input code point, consume a numeric token, and return it.
  4467. if (isNumberStart(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
  4468. consumeNumericToken();
  4469. } else {
  4470. // Otherwise, if the next 2 input code points are U+002D HYPHEN-MINUS U+003E GREATER-THAN SIGN (->), consume them and return a <CDC-token>.
  4471. if (getCharCode(offset + 1) === 0x002D &&
  4472. getCharCode(offset + 2) === 0x003E) {
  4473. type = TYPE$F.CDC;
  4474. offset = offset + 3;
  4475. } else {
  4476. // Otherwise, if the input stream starts with an identifier, ...
  4477. if (isIdentifierStart$1(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
  4478. // ... reconsume the current input code point, consume an ident-like token, and return it.
  4479. consumeIdentLikeToken();
  4480. } else {
  4481. // Otherwise, return a <delim-token> with its value set to the current input code point.
  4482. type = TYPE$F.Delim;
  4483. offset++;
  4484. }
  4485. }
  4486. }
  4487. break;
  4488. // U+002E FULL STOP (.)
  4489. case 0x002E:
  4490. // If the input stream starts with a number, ...
  4491. if (isNumberStart(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
  4492. // ... reconsume the current input code point, consume a numeric token, and return it.
  4493. consumeNumericToken();
  4494. } else {
  4495. // Otherwise, return a <delim-token> with its value set to the current input code point.
  4496. type = TYPE$F.Delim;
  4497. offset++;
  4498. }
  4499. break;
  4500. // U+002F SOLIDUS (/)
  4501. case 0x002F:
  4502. // If the next two input code point are U+002F SOLIDUS (/) followed by a U+002A ASTERISK (*),
  4503. if (getCharCode(offset + 1) === 0x002A) {
  4504. // ... consume them and all following code points up to and including the first U+002A ASTERISK (*)
  4505. // followed by a U+002F SOLIDUS (/), or up to an EOF code point.
  4506. type = TYPE$F.Comment;
  4507. offset = source.indexOf('*/', offset + 2) + 2;
  4508. if (offset === 1) {
  4509. offset = source.length;
  4510. }
  4511. } else {
  4512. type = TYPE$F.Delim;
  4513. offset++;
  4514. }
  4515. break;
  4516. // U+003A COLON (:)
  4517. case 0x003A:
  4518. // Return a <colon-token>.
  4519. type = TYPE$F.Colon;
  4520. offset++;
  4521. break;
  4522. // U+003B SEMICOLON (;)
  4523. case 0x003B:
  4524. // Return a <semicolon-token>.
  4525. type = TYPE$F.Semicolon;
  4526. offset++;
  4527. break;
  4528. // U+003C LESS-THAN SIGN (<)
  4529. case 0x003C:
  4530. // If the next 3 input code points are U+0021 EXCLAMATION MARK U+002D HYPHEN-MINUS U+002D HYPHEN-MINUS (!--), ...
  4531. if (getCharCode(offset + 1) === 0x0021 &&
  4532. getCharCode(offset + 2) === 0x002D &&
  4533. getCharCode(offset + 3) === 0x002D) {
  4534. // ... consume them and return a <CDO-token>.
  4535. type = TYPE$F.CDO;
  4536. offset = offset + 4;
  4537. } else {
  4538. // Otherwise, return a <delim-token> with its value set to the current input code point.
  4539. type = TYPE$F.Delim;
  4540. offset++;
  4541. }
  4542. break;
  4543. // U+0040 COMMERCIAL AT (@)
  4544. case 0x0040:
  4545. // If the next 3 input code points would start an identifier, ...
  4546. if (isIdentifierStart$1(getCharCode(offset + 1), getCharCode(offset + 2), getCharCode(offset + 3))) {
  4547. // ... consume a name, create an <at-keyword-token> with its value set to the returned value, and return it.
  4548. type = TYPE$F.AtKeyword;
  4549. offset = consumeName(source, offset + 1);
  4550. } else {
  4551. // Otherwise, return a <delim-token> with its value set to the current input code point.
  4552. type = TYPE$F.Delim;
  4553. offset++;
  4554. }
  4555. break;
  4556. // U+005B LEFT SQUARE BRACKET ([)
  4557. case 0x005B:
  4558. // Return a <[-token>.
  4559. type = TYPE$F.LeftSquareBracket;
  4560. offset++;
  4561. break;
  4562. // U+005C REVERSE SOLIDUS (\)
  4563. case 0x005C:
  4564. // If the input stream starts with a valid escape, ...
  4565. if (isValidEscape(code, getCharCode(offset + 1))) {
  4566. // ... reconsume the current input code point, consume an ident-like token, and return it.
  4567. consumeIdentLikeToken();
  4568. } else {
  4569. // Otherwise, this is a parse error. Return a <delim-token> with its value set to the current input code point.
  4570. type = TYPE$F.Delim;
  4571. offset++;
  4572. }
  4573. break;
  4574. // U+005D RIGHT SQUARE BRACKET (])
  4575. case 0x005D:
  4576. // Return a <]-token>.
  4577. type = TYPE$F.RightSquareBracket;
  4578. offset++;
  4579. break;
  4580. // U+007B LEFT CURLY BRACKET ({)
  4581. case 0x007B:
  4582. // Return a <{-token>.
  4583. type = TYPE$F.LeftCurlyBracket;
  4584. offset++;
  4585. break;
  4586. // U+007D RIGHT CURLY BRACKET (})
  4587. case 0x007D:
  4588. // Return a <}-token>.
  4589. type = TYPE$F.RightCurlyBracket;
  4590. offset++;
  4591. break;
  4592. // digit
  4593. case charCodeCategory.Digit:
  4594. // Reconsume the current input code point, consume a numeric token, and return it.
  4595. consumeNumericToken();
  4596. break;
  4597. // name-start code point
  4598. case charCodeCategory.NameStart:
  4599. // Reconsume the current input code point, consume an ident-like token, and return it.
  4600. consumeIdentLikeToken();
  4601. break;
  4602. // EOF
  4603. case charCodeCategory.Eof:
  4604. // Return an <EOF-token>.
  4605. break;
  4606. // anything else
  4607. default:
  4608. // Return a <delim-token> with its value set to the current input code point.
  4609. type = TYPE$F.Delim;
  4610. offset++;
  4611. }
  4612. switch (type) {
  4613. case balanceCloseType:
  4614. balancePrev = balanceStart & OFFSET_MASK;
  4615. balanceStart = balance[balancePrev];
  4616. balanceCloseType = balanceStart >> TYPE_SHIFT;
  4617. balance[tokenCount] = balancePrev;
  4618. balance[balancePrev++] = tokenCount;
  4619. for (; balancePrev < tokenCount; balancePrev++) {
  4620. if (balance[balancePrev] === sourceLength) {
  4621. balance[balancePrev] = tokenCount;
  4622. }
  4623. }
  4624. break;
  4625. case TYPE$F.LeftParenthesis:
  4626. case TYPE$F.Function:
  4627. balance[tokenCount] = balanceStart;
  4628. balanceCloseType = TYPE$F.RightParenthesis;
  4629. balanceStart = (balanceCloseType << TYPE_SHIFT) | tokenCount;
  4630. break;
  4631. case TYPE$F.LeftSquareBracket:
  4632. balance[tokenCount] = balanceStart;
  4633. balanceCloseType = TYPE$F.RightSquareBracket;
  4634. balanceStart = (balanceCloseType << TYPE_SHIFT) | tokenCount;
  4635. break;
  4636. case TYPE$F.LeftCurlyBracket:
  4637. balance[tokenCount] = balanceStart;
  4638. balanceCloseType = TYPE$F.RightCurlyBracket;
  4639. balanceStart = (balanceCloseType << TYPE_SHIFT) | tokenCount;
  4640. break;
  4641. }
  4642. offsetAndType[tokenCount++] = (type << TYPE_SHIFT) | offset;
  4643. }
  4644. // finalize buffers
  4645. offsetAndType[tokenCount] = (TYPE$F.EOF << TYPE_SHIFT) | offset; // <EOF-token>
  4646. balance[tokenCount] = sourceLength;
  4647. balance[sourceLength] = sourceLength; // prevents false positive balance match with any token
  4648. while (balanceStart !== 0) {
  4649. balancePrev = balanceStart & OFFSET_MASK;
  4650. balanceStart = balance[balancePrev];
  4651. balance[balancePrev] = sourceLength;
  4652. }
  4653. // update stream
  4654. stream.source = source;
  4655. stream.firstCharOffset = start;
  4656. stream.offsetAndType = offsetAndType;
  4657. stream.tokenCount = tokenCount;
  4658. stream.balance = balance;
  4659. stream.reset();
  4660. stream.next();
  4661. return stream;
  4662. }
  4663. // extend tokenizer with constants
  4664. Object.keys(constants$1).forEach(function(key) {
  4665. tokenize$3[key] = constants$1[key];
  4666. });
  4667. // extend tokenizer with static methods from utils
  4668. Object.keys(charCodeDefinitions).forEach(function(key) {
  4669. tokenize$3[key] = charCodeDefinitions[key];
  4670. });
  4671. Object.keys(utils).forEach(function(key) {
  4672. tokenize$3[key] = utils[key];
  4673. });
  4674. var tokenizer$3 = tokenize$3;
  4675. var isDigit$3 = tokenizer$3.isDigit;
  4676. var cmpChar$4 = tokenizer$3.cmpChar;
  4677. var TYPE$E = tokenizer$3.TYPE;
  4678. var DELIM$6 = TYPE$E.Delim;
  4679. var WHITESPACE$b = TYPE$E.WhiteSpace;
  4680. var COMMENT$9 = TYPE$E.Comment;
  4681. var IDENT$i = TYPE$E.Ident;
  4682. var NUMBER$9 = TYPE$E.Number;
  4683. var DIMENSION$7 = TYPE$E.Dimension;
  4684. var PLUSSIGN$8 = 0x002B; // U+002B PLUS SIGN (+)
  4685. var HYPHENMINUS$4 = 0x002D; // U+002D HYPHEN-MINUS (-)
  4686. var N$4 = 0x006E; // U+006E LATIN SMALL LETTER N (n)
  4687. var DISALLOW_SIGN$1 = true;
  4688. var ALLOW_SIGN$1 = false;
  4689. function isDelim$1(token, code) {
  4690. return token !== null && token.type === DELIM$6 && token.value.charCodeAt(0) === code;
  4691. }
  4692. function skipSC(token, offset, getNextToken) {
  4693. while (token !== null && (token.type === WHITESPACE$b || token.type === COMMENT$9)) {
  4694. token = getNextToken(++offset);
  4695. }
  4696. return offset;
  4697. }
  4698. function checkInteger$1(token, valueOffset, disallowSign, offset) {
  4699. if (!token) {
  4700. return 0;
  4701. }
  4702. var code = token.value.charCodeAt(valueOffset);
  4703. if (code === PLUSSIGN$8 || code === HYPHENMINUS$4) {
  4704. if (disallowSign) {
  4705. // Number sign is not allowed
  4706. return 0;
  4707. }
  4708. valueOffset++;
  4709. }
  4710. for (; valueOffset < token.value.length; valueOffset++) {
  4711. if (!isDigit$3(token.value.charCodeAt(valueOffset))) {
  4712. // Integer is expected
  4713. return 0;
  4714. }
  4715. }
  4716. return offset + 1;
  4717. }
  4718. // ... <signed-integer>
  4719. // ... ['+' | '-'] <signless-integer>
  4720. function consumeB$1(token, offset_, getNextToken) {
  4721. var sign = false;
  4722. var offset = skipSC(token, offset_, getNextToken);
  4723. token = getNextToken(offset);
  4724. if (token === null) {
  4725. return offset_;
  4726. }
  4727. if (token.type !== NUMBER$9) {
  4728. if (isDelim$1(token, PLUSSIGN$8) || isDelim$1(token, HYPHENMINUS$4)) {
  4729. sign = true;
  4730. offset = skipSC(getNextToken(++offset), offset, getNextToken);
  4731. token = getNextToken(offset);
  4732. if (token === null && token.type !== NUMBER$9) {
  4733. return 0;
  4734. }
  4735. } else {
  4736. return offset_;
  4737. }
  4738. }
  4739. if (!sign) {
  4740. var code = token.value.charCodeAt(0);
  4741. if (code !== PLUSSIGN$8 && code !== HYPHENMINUS$4) {
  4742. // Number sign is expected
  4743. return 0;
  4744. }
  4745. }
  4746. return checkInteger$1(token, sign ? 0 : 1, sign, offset);
  4747. }
  4748. // An+B microsyntax https://www.w3.org/TR/css-syntax-3/#anb
  4749. var genericAnPlusB = function anPlusB(token, getNextToken) {
  4750. /* eslint-disable brace-style*/
  4751. var offset = 0;
  4752. if (!token) {
  4753. return 0;
  4754. }
  4755. // <integer>
  4756. if (token.type === NUMBER$9) {
  4757. return checkInteger$1(token, 0, ALLOW_SIGN$1, offset); // b
  4758. }
  4759. // -n
  4760. // -n <signed-integer>
  4761. // -n ['+' | '-'] <signless-integer>
  4762. // -n- <signless-integer>
  4763. // <dashndashdigit-ident>
  4764. else if (token.type === IDENT$i && token.value.charCodeAt(0) === HYPHENMINUS$4) {
  4765. // expect 1st char is N
  4766. if (!cmpChar$4(token.value, 1, N$4)) {
  4767. return 0;
  4768. }
  4769. switch (token.value.length) {
  4770. // -n
  4771. // -n <signed-integer>
  4772. // -n ['+' | '-'] <signless-integer>
  4773. case 2:
  4774. return consumeB$1(getNextToken(++offset), offset, getNextToken);
  4775. // -n- <signless-integer>
  4776. case 3:
  4777. if (token.value.charCodeAt(2) !== HYPHENMINUS$4) {
  4778. return 0;
  4779. }
  4780. offset = skipSC(getNextToken(++offset), offset, getNextToken);
  4781. token = getNextToken(offset);
  4782. return checkInteger$1(token, 0, DISALLOW_SIGN$1, offset);
  4783. // <dashndashdigit-ident>
  4784. default:
  4785. if (token.value.charCodeAt(2) !== HYPHENMINUS$4) {
  4786. return 0;
  4787. }
  4788. return checkInteger$1(token, 3, DISALLOW_SIGN$1, offset);
  4789. }
  4790. }
  4791. // '+'? n
  4792. // '+'? n <signed-integer>
  4793. // '+'? n ['+' | '-'] <signless-integer>
  4794. // '+'? n- <signless-integer>
  4795. // '+'? <ndashdigit-ident>
  4796. else if (token.type === IDENT$i || (isDelim$1(token, PLUSSIGN$8) && getNextToken(offset + 1).type === IDENT$i)) {
  4797. // just ignore a plus
  4798. if (token.type !== IDENT$i) {
  4799. token = getNextToken(++offset);
  4800. }
  4801. if (token === null || !cmpChar$4(token.value, 0, N$4)) {
  4802. return 0;
  4803. }
  4804. switch (token.value.length) {
  4805. // '+'? n
  4806. // '+'? n <signed-integer>
  4807. // '+'? n ['+' | '-'] <signless-integer>
  4808. case 1:
  4809. return consumeB$1(getNextToken(++offset), offset, getNextToken);
  4810. // '+'? n- <signless-integer>
  4811. case 2:
  4812. if (token.value.charCodeAt(1) !== HYPHENMINUS$4) {
  4813. return 0;
  4814. }
  4815. offset = skipSC(getNextToken(++offset), offset, getNextToken);
  4816. token = getNextToken(offset);
  4817. return checkInteger$1(token, 0, DISALLOW_SIGN$1, offset);
  4818. // '+'? <ndashdigit-ident>
  4819. default:
  4820. if (token.value.charCodeAt(1) !== HYPHENMINUS$4) {
  4821. return 0;
  4822. }
  4823. return checkInteger$1(token, 2, DISALLOW_SIGN$1, offset);
  4824. }
  4825. }
  4826. // <ndashdigit-dimension>
  4827. // <ndash-dimension> <signless-integer>
  4828. // <n-dimension>
  4829. // <n-dimension> <signed-integer>
  4830. // <n-dimension> ['+' | '-'] <signless-integer>
  4831. else if (token.type === DIMENSION$7) {
  4832. var code = token.value.charCodeAt(0);
  4833. var sign = code === PLUSSIGN$8 || code === HYPHENMINUS$4 ? 1 : 0;
  4834. for (var i = sign; i < token.value.length; i++) {
  4835. if (!isDigit$3(token.value.charCodeAt(i))) {
  4836. break;
  4837. }
  4838. }
  4839. if (i === sign) {
  4840. // Integer is expected
  4841. return 0;
  4842. }
  4843. if (!cmpChar$4(token.value, i, N$4)) {
  4844. return 0;
  4845. }
  4846. // <n-dimension>
  4847. // <n-dimension> <signed-integer>
  4848. // <n-dimension> ['+' | '-'] <signless-integer>
  4849. if (i + 1 === token.value.length) {
  4850. return consumeB$1(getNextToken(++offset), offset, getNextToken);
  4851. } else {
  4852. if (token.value.charCodeAt(i + 1) !== HYPHENMINUS$4) {
  4853. return 0;
  4854. }
  4855. // <ndash-dimension> <signless-integer>
  4856. if (i + 2 === token.value.length) {
  4857. offset = skipSC(getNextToken(++offset), offset, getNextToken);
  4858. token = getNextToken(offset);
  4859. return checkInteger$1(token, 0, DISALLOW_SIGN$1, offset);
  4860. }
  4861. // <ndashdigit-dimension>
  4862. else {
  4863. return checkInteger$1(token, i + 2, DISALLOW_SIGN$1, offset);
  4864. }
  4865. }
  4866. }
  4867. return 0;
  4868. };
  4869. var isHexDigit$2 = tokenizer$3.isHexDigit;
  4870. var cmpChar$3 = tokenizer$3.cmpChar;
  4871. var TYPE$D = tokenizer$3.TYPE;
  4872. var IDENT$h = TYPE$D.Ident;
  4873. var DELIM$5 = TYPE$D.Delim;
  4874. var NUMBER$8 = TYPE$D.Number;
  4875. var DIMENSION$6 = TYPE$D.Dimension;
  4876. var PLUSSIGN$7 = 0x002B; // U+002B PLUS SIGN (+)
  4877. var HYPHENMINUS$3 = 0x002D; // U+002D HYPHEN-MINUS (-)
  4878. var QUESTIONMARK$2 = 0x003F; // U+003F QUESTION MARK (?)
  4879. var U$2 = 0x0075; // U+0075 LATIN SMALL LETTER U (u)
  4880. function isDelim(token, code) {
  4881. return token !== null && token.type === DELIM$5 && token.value.charCodeAt(0) === code;
  4882. }
  4883. function startsWith$1(token, code) {
  4884. return token.value.charCodeAt(0) === code;
  4885. }
  4886. function hexSequence(token, offset, allowDash) {
  4887. for (var pos = offset, hexlen = 0; pos < token.value.length; pos++) {
  4888. var code = token.value.charCodeAt(pos);
  4889. if (code === HYPHENMINUS$3 && allowDash && hexlen !== 0) {
  4890. if (hexSequence(token, offset + hexlen + 1, false) > 0) {
  4891. return 6; // dissallow following question marks
  4892. }
  4893. return 0; // dash at the ending of a hex sequence is not allowed
  4894. }
  4895. if (!isHexDigit$2(code)) {
  4896. return 0; // not a hex digit
  4897. }
  4898. if (++hexlen > 6) {
  4899. return 0; // too many hex digits
  4900. } }
  4901. return hexlen;
  4902. }
  4903. function withQuestionMarkSequence(consumed, length, getNextToken) {
  4904. if (!consumed) {
  4905. return 0; // nothing consumed
  4906. }
  4907. while (isDelim(getNextToken(length), QUESTIONMARK$2)) {
  4908. if (++consumed > 6) {
  4909. return 0; // too many question marks
  4910. }
  4911. length++;
  4912. }
  4913. return length;
  4914. }
  4915. // https://drafts.csswg.org/css-syntax/#urange
  4916. // Informally, the <urange> production has three forms:
  4917. // U+0001
  4918. // Defines a range consisting of a single code point, in this case the code point "1".
  4919. // U+0001-00ff
  4920. // Defines a range of codepoints between the first and the second value, in this case
  4921. // the range between "1" and "ff" (255 in decimal) inclusive.
  4922. // U+00??
  4923. // Defines a range of codepoints where the "?" characters range over all hex digits,
  4924. // in this case defining the same as the value U+0000-00ff.
  4925. // In each form, a maximum of 6 digits is allowed for each hexadecimal number (if you treat "?" as a hexadecimal digit).
  4926. //
  4927. // <urange> =
  4928. // u '+' <ident-token> '?'* |
  4929. // u <dimension-token> '?'* |
  4930. // u <number-token> '?'* |
  4931. // u <number-token> <dimension-token> |
  4932. // u <number-token> <number-token> |
  4933. // u '+' '?'+
  4934. var genericUrange = function urange(token, getNextToken) {
  4935. var length = 0;
  4936. // should start with `u` or `U`
  4937. if (token === null || token.type !== IDENT$h || !cmpChar$3(token.value, 0, U$2)) {
  4938. return 0;
  4939. }
  4940. token = getNextToken(++length);
  4941. if (token === null) {
  4942. return 0;
  4943. }
  4944. // u '+' <ident-token> '?'*
  4945. // u '+' '?'+
  4946. if (isDelim(token, PLUSSIGN$7)) {
  4947. token = getNextToken(++length);
  4948. if (token === null) {
  4949. return 0;
  4950. }
  4951. if (token.type === IDENT$h) {
  4952. // u '+' <ident-token> '?'*
  4953. return withQuestionMarkSequence(hexSequence(token, 0, true), ++length, getNextToken);
  4954. }
  4955. if (isDelim(token, QUESTIONMARK$2)) {
  4956. // u '+' '?'+
  4957. return withQuestionMarkSequence(1, ++length, getNextToken);
  4958. }
  4959. // Hex digit or question mark is expected
  4960. return 0;
  4961. }
  4962. // u <number-token> '?'*
  4963. // u <number-token> <dimension-token>
  4964. // u <number-token> <number-token>
  4965. if (token.type === NUMBER$8) {
  4966. if (!startsWith$1(token, PLUSSIGN$7)) {
  4967. return 0;
  4968. }
  4969. var consumedHexLength = hexSequence(token, 1, true);
  4970. if (consumedHexLength === 0) {
  4971. return 0;
  4972. }
  4973. token = getNextToken(++length);
  4974. if (token === null) {
  4975. // u <number-token> <eof>
  4976. return length;
  4977. }
  4978. if (token.type === DIMENSION$6 || token.type === NUMBER$8) {
  4979. // u <number-token> <dimension-token>
  4980. // u <number-token> <number-token>
  4981. if (!startsWith$1(token, HYPHENMINUS$3) || !hexSequence(token, 1, false)) {
  4982. return 0;
  4983. }
  4984. return length + 1;
  4985. }
  4986. // u <number-token> '?'*
  4987. return withQuestionMarkSequence(consumedHexLength, length, getNextToken);
  4988. }
  4989. // u <dimension-token> '?'*
  4990. if (token.type === DIMENSION$6) {
  4991. if (!startsWith$1(token, PLUSSIGN$7)) {
  4992. return 0;
  4993. }
  4994. return withQuestionMarkSequence(hexSequence(token, 1, true), ++length, getNextToken);
  4995. }
  4996. return 0;
  4997. };
  4998. var tokenizer$2 = tokenizer$3;
  4999. var isIdentifierStart = tokenizer$2.isIdentifierStart;
  5000. var isHexDigit$1 = tokenizer$2.isHexDigit;
  5001. var isDigit$2 = tokenizer$2.isDigit;
  5002. var cmpStr$3 = tokenizer$2.cmpStr;
  5003. var consumeNumber$3 = tokenizer$2.consumeNumber;
  5004. var TYPE$C = tokenizer$2.TYPE;
  5005. var anPlusB = genericAnPlusB;
  5006. var urange = genericUrange;
  5007. var cssWideKeywords$1 = ['unset', 'initial', 'inherit'];
  5008. var calcFunctionNames = ['calc(', '-moz-calc(', '-webkit-calc('];
  5009. // https://www.w3.org/TR/css-values-3/#lengths
  5010. var LENGTH = {
  5011. // absolute length units
  5012. 'px': true,
  5013. 'mm': true,
  5014. 'cm': true,
  5015. 'in': true,
  5016. 'pt': true,
  5017. 'pc': true,
  5018. 'q': true,
  5019. // relative length units
  5020. 'em': true,
  5021. 'ex': true,
  5022. 'ch': true,
  5023. 'rem': true,
  5024. // viewport-percentage lengths
  5025. 'vh': true,
  5026. 'vw': true,
  5027. 'vmin': true,
  5028. 'vmax': true,
  5029. 'vm': true
  5030. };
  5031. var ANGLE = {
  5032. 'deg': true,
  5033. 'grad': true,
  5034. 'rad': true,
  5035. 'turn': true
  5036. };
  5037. var TIME = {
  5038. 's': true,
  5039. 'ms': true
  5040. };
  5041. var FREQUENCY = {
  5042. 'hz': true,
  5043. 'khz': true
  5044. };
  5045. // https://www.w3.org/TR/css-values-3/#resolution (https://drafts.csswg.org/css-values/#resolution)
  5046. var RESOLUTION = {
  5047. 'dpi': true,
  5048. 'dpcm': true,
  5049. 'dppx': true,
  5050. 'x': true // https://github.com/w3c/csswg-drafts/issues/461
  5051. };
  5052. // https://drafts.csswg.org/css-grid/#fr-unit
  5053. var FLEX = {
  5054. 'fr': true
  5055. };
  5056. // https://www.w3.org/TR/css3-speech/#mixing-props-voice-volume
  5057. var DECIBEL = {
  5058. 'db': true
  5059. };
  5060. // https://www.w3.org/TR/css3-speech/#voice-props-voice-pitch
  5061. var SEMITONES = {
  5062. 'st': true
  5063. };
  5064. // safe char code getter
  5065. function charCode(str, index) {
  5066. return index < str.length ? str.charCodeAt(index) : 0;
  5067. }
  5068. function eqStr(actual, expected) {
  5069. return cmpStr$3(actual, 0, actual.length, expected);
  5070. }
  5071. function eqStrAny(actual, expected) {
  5072. for (var i = 0; i < expected.length; i++) {
  5073. if (eqStr(actual, expected[i])) {
  5074. return true;
  5075. }
  5076. }
  5077. return false;
  5078. }
  5079. // IE postfix hack, i.e. 123\0 or 123px\9
  5080. function isPostfixIeHack(str, offset) {
  5081. if (offset !== str.length - 2) {
  5082. return false;
  5083. }
  5084. return (
  5085. str.charCodeAt(offset) === 0x005C && // U+005C REVERSE SOLIDUS (\)
  5086. isDigit$2(str.charCodeAt(offset + 1))
  5087. );
  5088. }
  5089. function outOfRange(opts, value, numEnd) {
  5090. if (opts && opts.type === 'Range') {
  5091. var num = Number(
  5092. numEnd !== undefined && numEnd !== value.length
  5093. ? value.substr(0, numEnd)
  5094. : value
  5095. );
  5096. if (isNaN(num)) {
  5097. return true;
  5098. }
  5099. if (opts.min !== null && num < opts.min) {
  5100. return true;
  5101. }
  5102. if (opts.max !== null && num > opts.max) {
  5103. return true;
  5104. }
  5105. }
  5106. return false;
  5107. }
  5108. function consumeFunction(token, getNextToken) {
  5109. var startIdx = token.index;
  5110. var length = 0;
  5111. // balanced token consuming
  5112. do {
  5113. length++;
  5114. if (token.balance <= startIdx) {
  5115. break;
  5116. }
  5117. } while (token = getNextToken(length));
  5118. return length;
  5119. }
  5120. // TODO: implement
  5121. // can be used wherever <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> values are allowed
  5122. // https://drafts.csswg.org/css-values/#calc-notation
  5123. function calc(next) {
  5124. return function(token, getNextToken, opts) {
  5125. if (token === null) {
  5126. return 0;
  5127. }
  5128. if (token.type === TYPE$C.Function && eqStrAny(token.value, calcFunctionNames)) {
  5129. return consumeFunction(token, getNextToken);
  5130. }
  5131. return next(token, getNextToken, opts);
  5132. };
  5133. }
  5134. function tokenType(expectedTokenType) {
  5135. return function(token) {
  5136. if (token === null || token.type !== expectedTokenType) {
  5137. return 0;
  5138. }
  5139. return 1;
  5140. };
  5141. }
  5142. function func(name) {
  5143. name = name + '(';
  5144. return function(token, getNextToken) {
  5145. if (token !== null && eqStr(token.value, name)) {
  5146. return consumeFunction(token, getNextToken);
  5147. }
  5148. return 0;
  5149. };
  5150. }
  5151. // =========================
  5152. // Complex types
  5153. //
  5154. // https://drafts.csswg.org/css-values-4/#custom-idents
  5155. // 4.2. Author-defined Identifiers: the <custom-ident> type
  5156. // Some properties accept arbitrary author-defined identifiers as a component value.
  5157. // This generic data type is denoted by <custom-ident>, and represents any valid CSS identifier
  5158. // that would not be misinterpreted as a pre-defined keyword in that property’s value definition.
  5159. //
  5160. // See also: https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident
  5161. function customIdent(token) {
  5162. if (token === null || token.type !== TYPE$C.Ident) {
  5163. return 0;
  5164. }
  5165. var name = token.value.toLowerCase();
  5166. // The CSS-wide keywords are not valid <custom-ident>s
  5167. if (eqStrAny(name, cssWideKeywords$1)) {
  5168. return 0;
  5169. }
  5170. // The default keyword is reserved and is also not a valid <custom-ident>
  5171. if (eqStr(name, 'default')) {
  5172. return 0;
  5173. }
  5174. // TODO: ignore property specific keywords (as described https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident)
  5175. // Specifications using <custom-ident> must specify clearly what other keywords
  5176. // are excluded from <custom-ident>, if any—for example by saying that any pre-defined keywords
  5177. // in that property’s value definition are excluded. Excluded keywords are excluded
  5178. // in all ASCII case permutations.
  5179. return 1;
  5180. }
  5181. // https://drafts.csswg.org/css-variables/#typedef-custom-property-name
  5182. // A custom property is any property whose name starts with two dashes (U+002D HYPHEN-MINUS), like --foo.
  5183. // The <custom-property-name> production corresponds to this: it’s defined as any valid identifier
  5184. // that starts with two dashes, except -- itself, which is reserved for future use by CSS.
  5185. // NOTE: Current implementation treat `--` as a valid name since most (all?) major browsers treat it as valid.
  5186. function customPropertyName(token) {
  5187. // ... defined as any valid identifier
  5188. if (token === null || token.type !== TYPE$C.Ident) {
  5189. return 0;
  5190. }
  5191. // ... that starts with two dashes (U+002D HYPHEN-MINUS)
  5192. if (charCode(token.value, 0) !== 0x002D || charCode(token.value, 1) !== 0x002D) {
  5193. return 0;
  5194. }
  5195. return 1;
  5196. }
  5197. // https://drafts.csswg.org/css-color-4/#hex-notation
  5198. // The syntax of a <hex-color> is a <hash-token> token whose value consists of 3, 4, 6, or 8 hexadecimal digits.
  5199. // In other words, a hex color is written as a hash character, "#", followed by some number of digits 0-9 or
  5200. // letters a-f (the case of the letters doesn’t matter - #00ff00 is identical to #00FF00).
  5201. function hexColor(token) {
  5202. if (token === null || token.type !== TYPE$C.Hash) {
  5203. return 0;
  5204. }
  5205. var length = token.value.length;
  5206. // valid values (length): #rgb (4), #rgba (5), #rrggbb (7), #rrggbbaa (9)
  5207. if (length !== 4 && length !== 5 && length !== 7 && length !== 9) {
  5208. return 0;
  5209. }
  5210. for (var i = 1; i < length; i++) {
  5211. if (!isHexDigit$1(token.value.charCodeAt(i))) {
  5212. return 0;
  5213. }
  5214. }
  5215. return 1;
  5216. }
  5217. function idSelector(token) {
  5218. if (token === null || token.type !== TYPE$C.Hash) {
  5219. return 0;
  5220. }
  5221. if (!isIdentifierStart(charCode(token.value, 1), charCode(token.value, 2), charCode(token.value, 3))) {
  5222. return 0;
  5223. }
  5224. return 1;
  5225. }
  5226. // https://drafts.csswg.org/css-syntax/#any-value
  5227. // It represents the entirety of what a valid declaration can have as its value.
  5228. function declarationValue(token, getNextToken) {
  5229. if (!token) {
  5230. return 0;
  5231. }
  5232. var length = 0;
  5233. var level = 0;
  5234. var startIdx = token.index;
  5235. // The <declaration-value> production matches any sequence of one or more tokens,
  5236. // so long as the sequence ...
  5237. scan:
  5238. do {
  5239. switch (token.type) {
  5240. // ... does not contain <bad-string-token>, <bad-url-token>,
  5241. case TYPE$C.BadString:
  5242. case TYPE$C.BadUrl:
  5243. break scan;
  5244. // ... unmatched <)-token>, <]-token>, or <}-token>,
  5245. case TYPE$C.RightCurlyBracket:
  5246. case TYPE$C.RightParenthesis:
  5247. case TYPE$C.RightSquareBracket:
  5248. if (token.balance > token.index || token.balance < startIdx) {
  5249. break scan;
  5250. }
  5251. level--;
  5252. break;
  5253. // ... or top-level <semicolon-token> tokens
  5254. case TYPE$C.Semicolon:
  5255. if (level === 0) {
  5256. break scan;
  5257. }
  5258. break;
  5259. // ... or <delim-token> tokens with a value of "!"
  5260. case TYPE$C.Delim:
  5261. if (token.value === '!' && level === 0) {
  5262. break scan;
  5263. }
  5264. break;
  5265. case TYPE$C.Function:
  5266. case TYPE$C.LeftParenthesis:
  5267. case TYPE$C.LeftSquareBracket:
  5268. case TYPE$C.LeftCurlyBracket:
  5269. level++;
  5270. break;
  5271. }
  5272. length++;
  5273. // until balance closing
  5274. if (token.balance <= startIdx) {
  5275. break;
  5276. }
  5277. } while (token = getNextToken(length));
  5278. return length;
  5279. }
  5280. // https://drafts.csswg.org/css-syntax/#any-value
  5281. // The <any-value> production is identical to <declaration-value>, but also
  5282. // allows top-level <semicolon-token> tokens and <delim-token> tokens
  5283. // with a value of "!". It represents the entirety of what valid CSS can be in any context.
  5284. function anyValue(token, getNextToken) {
  5285. if (!token) {
  5286. return 0;
  5287. }
  5288. var startIdx = token.index;
  5289. var length = 0;
  5290. // The <any-value> production matches any sequence of one or more tokens,
  5291. // so long as the sequence ...
  5292. scan:
  5293. do {
  5294. switch (token.type) {
  5295. // ... does not contain <bad-string-token>, <bad-url-token>,
  5296. case TYPE$C.BadString:
  5297. case TYPE$C.BadUrl:
  5298. break scan;
  5299. // ... unmatched <)-token>, <]-token>, or <}-token>,
  5300. case TYPE$C.RightCurlyBracket:
  5301. case TYPE$C.RightParenthesis:
  5302. case TYPE$C.RightSquareBracket:
  5303. if (token.balance > token.index || token.balance < startIdx) {
  5304. break scan;
  5305. }
  5306. break;
  5307. }
  5308. length++;
  5309. // until balance closing
  5310. if (token.balance <= startIdx) {
  5311. break;
  5312. }
  5313. } while (token = getNextToken(length));
  5314. return length;
  5315. }
  5316. // =========================
  5317. // Dimensions
  5318. //
  5319. function dimension(type) {
  5320. return function(token, getNextToken, opts) {
  5321. if (token === null || token.type !== TYPE$C.Dimension) {
  5322. return 0;
  5323. }
  5324. var numberEnd = consumeNumber$3(token.value, 0);
  5325. // check unit
  5326. if (type !== null) {
  5327. // check for IE postfix hack, i.e. 123px\0 or 123px\9
  5328. var reverseSolidusOffset = token.value.indexOf('\\', numberEnd);
  5329. var unit = reverseSolidusOffset === -1 || !isPostfixIeHack(token.value, reverseSolidusOffset)
  5330. ? token.value.substr(numberEnd)
  5331. : token.value.substring(numberEnd, reverseSolidusOffset);
  5332. if (type.hasOwnProperty(unit.toLowerCase()) === false) {
  5333. return 0;
  5334. }
  5335. }
  5336. // check range if specified
  5337. if (outOfRange(opts, token.value, numberEnd)) {
  5338. return 0;
  5339. }
  5340. return 1;
  5341. };
  5342. }
  5343. // =========================
  5344. // Percentage
  5345. //
  5346. // §5.5. Percentages: the <percentage> type
  5347. // https://drafts.csswg.org/css-values-4/#percentages
  5348. function percentage(token, getNextToken, opts) {
  5349. // ... corresponds to the <percentage-token> production
  5350. if (token === null || token.type !== TYPE$C.Percentage) {
  5351. return 0;
  5352. }
  5353. // check range if specified
  5354. if (outOfRange(opts, token.value, token.value.length - 1)) {
  5355. return 0;
  5356. }
  5357. return 1;
  5358. }
  5359. // =========================
  5360. // Numeric
  5361. //
  5362. // https://drafts.csswg.org/css-values-4/#numbers
  5363. // The value <zero> represents a literal number with the value 0. Expressions that merely
  5364. // evaluate to a <number> with the value 0 (for example, calc(0)) do not match <zero>;
  5365. // only literal <number-token>s do.
  5366. function zero(next) {
  5367. if (typeof next !== 'function') {
  5368. next = function() {
  5369. return 0;
  5370. };
  5371. }
  5372. return function(token, getNextToken, opts) {
  5373. if (token !== null && token.type === TYPE$C.Number) {
  5374. if (Number(token.value) === 0) {
  5375. return 1;
  5376. }
  5377. }
  5378. return next(token, getNextToken, opts);
  5379. };
  5380. }
  5381. // § 5.3. Real Numbers: the <number> type
  5382. // https://drafts.csswg.org/css-values-4/#numbers
  5383. // Number values are denoted by <number>, and represent real numbers, possibly with a fractional component.
  5384. // ... It corresponds to the <number-token> production
  5385. function number(token, getNextToken, opts) {
  5386. if (token === null) {
  5387. return 0;
  5388. }
  5389. var numberEnd = consumeNumber$3(token.value, 0);
  5390. var isNumber = numberEnd === token.value.length;
  5391. if (!isNumber && !isPostfixIeHack(token.value, numberEnd)) {
  5392. return 0;
  5393. }
  5394. // check range if specified
  5395. if (outOfRange(opts, token.value, numberEnd)) {
  5396. return 0;
  5397. }
  5398. return 1;
  5399. }
  5400. // §5.2. Integers: the <integer> type
  5401. // https://drafts.csswg.org/css-values-4/#integers
  5402. function integer(token, getNextToken, opts) {
  5403. // ... corresponds to a subset of the <number-token> production
  5404. if (token === null || token.type !== TYPE$C.Number) {
  5405. return 0;
  5406. }
  5407. // The first digit of an integer may be immediately preceded by `-` or `+` to indicate the integer’s sign.
  5408. var i = token.value.charCodeAt(0) === 0x002B || // U+002B PLUS SIGN (+)
  5409. token.value.charCodeAt(0) === 0x002D ? 1 : 0; // U+002D HYPHEN-MINUS (-)
  5410. // When written literally, an integer is one or more decimal digits 0 through 9 ...
  5411. for (; i < token.value.length; i++) {
  5412. if (!isDigit$2(token.value.charCodeAt(i))) {
  5413. return 0;
  5414. }
  5415. }
  5416. // check range if specified
  5417. if (outOfRange(opts, token.value, i)) {
  5418. return 0;
  5419. }
  5420. return 1;
  5421. }
  5422. var generic$1 = {
  5423. // token types
  5424. 'ident-token': tokenType(TYPE$C.Ident),
  5425. 'function-token': tokenType(TYPE$C.Function),
  5426. 'at-keyword-token': tokenType(TYPE$C.AtKeyword),
  5427. 'hash-token': tokenType(TYPE$C.Hash),
  5428. 'string-token': tokenType(TYPE$C.String),
  5429. 'bad-string-token': tokenType(TYPE$C.BadString),
  5430. 'url-token': tokenType(TYPE$C.Url),
  5431. 'bad-url-token': tokenType(TYPE$C.BadUrl),
  5432. 'delim-token': tokenType(TYPE$C.Delim),
  5433. 'number-token': tokenType(TYPE$C.Number),
  5434. 'percentage-token': tokenType(TYPE$C.Percentage),
  5435. 'dimension-token': tokenType(TYPE$C.Dimension),
  5436. 'whitespace-token': tokenType(TYPE$C.WhiteSpace),
  5437. 'CDO-token': tokenType(TYPE$C.CDO),
  5438. 'CDC-token': tokenType(TYPE$C.CDC),
  5439. 'colon-token': tokenType(TYPE$C.Colon),
  5440. 'semicolon-token': tokenType(TYPE$C.Semicolon),
  5441. 'comma-token': tokenType(TYPE$C.Comma),
  5442. '[-token': tokenType(TYPE$C.LeftSquareBracket),
  5443. ']-token': tokenType(TYPE$C.RightSquareBracket),
  5444. '(-token': tokenType(TYPE$C.LeftParenthesis),
  5445. ')-token': tokenType(TYPE$C.RightParenthesis),
  5446. '{-token': tokenType(TYPE$C.LeftCurlyBracket),
  5447. '}-token': tokenType(TYPE$C.RightCurlyBracket),
  5448. // token type aliases
  5449. 'string': tokenType(TYPE$C.String),
  5450. 'ident': tokenType(TYPE$C.Ident),
  5451. // complex types
  5452. 'custom-ident': customIdent,
  5453. 'custom-property-name': customPropertyName,
  5454. 'hex-color': hexColor,
  5455. 'id-selector': idSelector, // element( <id-selector> )
  5456. 'an-plus-b': anPlusB,
  5457. 'urange': urange,
  5458. 'declaration-value': declarationValue,
  5459. 'any-value': anyValue,
  5460. // dimensions
  5461. 'dimension': calc(dimension(null)),
  5462. 'angle': calc(dimension(ANGLE)),
  5463. 'decibel': calc(dimension(DECIBEL)),
  5464. 'frequency': calc(dimension(FREQUENCY)),
  5465. 'flex': calc(dimension(FLEX)),
  5466. 'length': calc(zero(dimension(LENGTH))),
  5467. 'resolution': calc(dimension(RESOLUTION)),
  5468. 'semitones': calc(dimension(SEMITONES)),
  5469. 'time': calc(dimension(TIME)),
  5470. // percentage
  5471. 'percentage': calc(percentage),
  5472. // numeric
  5473. 'zero': zero(),
  5474. 'number': calc(number),
  5475. 'integer': calc(integer),
  5476. // old IE stuff
  5477. '-ms-legacy-expression': func('expression')
  5478. };
  5479. var createCustomError = createCustomError$3;
  5480. var _SyntaxError = function SyntaxError(message, input, offset) {
  5481. var error = createCustomError('SyntaxError', message);
  5482. error.input = input;
  5483. error.offset = offset;
  5484. error.rawMessage = message;
  5485. error.message = error.rawMessage + '\n' +
  5486. ' ' + error.input + '\n' +
  5487. '--' + new Array((error.offset || error.input.length) + 1).join('-') + '^';
  5488. return error;
  5489. };
  5490. var SyntaxError$3 = _SyntaxError;
  5491. var TAB$1 = 9;
  5492. var N$3 = 10;
  5493. var F$2 = 12;
  5494. var R$2 = 13;
  5495. var SPACE$2 = 32;
  5496. var Tokenizer$1 = function(str) {
  5497. this.str = str;
  5498. this.pos = 0;
  5499. };
  5500. Tokenizer$1.prototype = {
  5501. charCodeAt: function(pos) {
  5502. return pos < this.str.length ? this.str.charCodeAt(pos) : 0;
  5503. },
  5504. charCode: function() {
  5505. return this.charCodeAt(this.pos);
  5506. },
  5507. nextCharCode: function() {
  5508. return this.charCodeAt(this.pos + 1);
  5509. },
  5510. nextNonWsCode: function(pos) {
  5511. return this.charCodeAt(this.findWsEnd(pos));
  5512. },
  5513. findWsEnd: function(pos) {
  5514. for (; pos < this.str.length; pos++) {
  5515. var code = this.str.charCodeAt(pos);
  5516. if (code !== R$2 && code !== N$3 && code !== F$2 && code !== SPACE$2 && code !== TAB$1) {
  5517. break;
  5518. }
  5519. }
  5520. return pos;
  5521. },
  5522. substringToPos: function(end) {
  5523. return this.str.substring(this.pos, this.pos = end);
  5524. },
  5525. eat: function(code) {
  5526. if (this.charCode() !== code) {
  5527. this.error('Expect `' + String.fromCharCode(code) + '`');
  5528. }
  5529. this.pos++;
  5530. },
  5531. peek: function() {
  5532. return this.pos < this.str.length ? this.str.charAt(this.pos++) : '';
  5533. },
  5534. error: function(message) {
  5535. throw new SyntaxError$3(message, this.str, this.pos);
  5536. }
  5537. };
  5538. var tokenizer$1 = Tokenizer$1;
  5539. var Tokenizer = tokenizer$1;
  5540. var TAB = 9;
  5541. var N$2 = 10;
  5542. var F$1 = 12;
  5543. var R$1 = 13;
  5544. var SPACE$1 = 32;
  5545. var EXCLAMATIONMARK$3 = 33; // !
  5546. var NUMBERSIGN$4 = 35; // #
  5547. var AMPERSAND$1 = 38; // &
  5548. var APOSTROPHE = 39; // '
  5549. var LEFTPARENTHESIS$7 = 40; // (
  5550. var RIGHTPARENTHESIS$7 = 41; // )
  5551. var ASTERISK$6 = 42; // *
  5552. var PLUSSIGN$6 = 43; // +
  5553. var COMMA$4 = 44; // ,
  5554. var HYPERMINUS = 45; // -
  5555. var LESSTHANSIGN = 60; // <
  5556. var GREATERTHANSIGN$2 = 62; // >
  5557. var QUESTIONMARK$1 = 63; // ?
  5558. var COMMERCIALAT = 64; // @
  5559. var LEFTSQUAREBRACKET$4 = 91; // [
  5560. var RIGHTSQUAREBRACKET$2 = 93; // ]
  5561. var LEFTCURLYBRACKET$4 = 123; // {
  5562. var VERTICALLINE$3 = 124; // |
  5563. var RIGHTCURLYBRACKET$2 = 125; // }
  5564. var INFINITY = 8734; // ∞
  5565. var NAME_CHAR = createCharMap(function(ch) {
  5566. return /[a-zA-Z0-9\-]/.test(ch);
  5567. });
  5568. var COMBINATOR_PRECEDENCE = {
  5569. ' ': 1,
  5570. '&&': 2,
  5571. '||': 3,
  5572. '|': 4
  5573. };
  5574. function createCharMap(fn) {
  5575. var array = typeof Uint32Array === 'function' ? new Uint32Array(128) : new Array(128);
  5576. for (var i = 0; i < 128; i++) {
  5577. array[i] = fn(String.fromCharCode(i)) ? 1 : 0;
  5578. }
  5579. return array;
  5580. }
  5581. function scanSpaces(tokenizer) {
  5582. return tokenizer.substringToPos(
  5583. tokenizer.findWsEnd(tokenizer.pos)
  5584. );
  5585. }
  5586. function scanWord(tokenizer) {
  5587. var end = tokenizer.pos;
  5588. for (; end < tokenizer.str.length; end++) {
  5589. var code = tokenizer.str.charCodeAt(end);
  5590. if (code >= 128 || NAME_CHAR[code] === 0) {
  5591. break;
  5592. }
  5593. }
  5594. if (tokenizer.pos === end) {
  5595. tokenizer.error('Expect a keyword');
  5596. }
  5597. return tokenizer.substringToPos(end);
  5598. }
  5599. function scanNumber(tokenizer) {
  5600. var end = tokenizer.pos;
  5601. for (; end < tokenizer.str.length; end++) {
  5602. var code = tokenizer.str.charCodeAt(end);
  5603. if (code < 48 || code > 57) {
  5604. break;
  5605. }
  5606. }
  5607. if (tokenizer.pos === end) {
  5608. tokenizer.error('Expect a number');
  5609. }
  5610. return tokenizer.substringToPos(end);
  5611. }
  5612. function scanString(tokenizer) {
  5613. var end = tokenizer.str.indexOf('\'', tokenizer.pos + 1);
  5614. if (end === -1) {
  5615. tokenizer.pos = tokenizer.str.length;
  5616. tokenizer.error('Expect an apostrophe');
  5617. }
  5618. return tokenizer.substringToPos(end + 1);
  5619. }
  5620. function readMultiplierRange(tokenizer) {
  5621. var min = null;
  5622. var max = null;
  5623. tokenizer.eat(LEFTCURLYBRACKET$4);
  5624. min = scanNumber(tokenizer);
  5625. if (tokenizer.charCode() === COMMA$4) {
  5626. tokenizer.pos++;
  5627. if (tokenizer.charCode() !== RIGHTCURLYBRACKET$2) {
  5628. max = scanNumber(tokenizer);
  5629. }
  5630. } else {
  5631. max = min;
  5632. }
  5633. tokenizer.eat(RIGHTCURLYBRACKET$2);
  5634. return {
  5635. min: Number(min),
  5636. max: max ? Number(max) : 0
  5637. };
  5638. }
  5639. function readMultiplier(tokenizer) {
  5640. var range = null;
  5641. var comma = false;
  5642. switch (tokenizer.charCode()) {
  5643. case ASTERISK$6:
  5644. tokenizer.pos++;
  5645. range = {
  5646. min: 0,
  5647. max: 0
  5648. };
  5649. break;
  5650. case PLUSSIGN$6:
  5651. tokenizer.pos++;
  5652. range = {
  5653. min: 1,
  5654. max: 0
  5655. };
  5656. break;
  5657. case QUESTIONMARK$1:
  5658. tokenizer.pos++;
  5659. range = {
  5660. min: 0,
  5661. max: 1
  5662. };
  5663. break;
  5664. case NUMBERSIGN$4:
  5665. tokenizer.pos++;
  5666. comma = true;
  5667. if (tokenizer.charCode() === LEFTCURLYBRACKET$4) {
  5668. range = readMultiplierRange(tokenizer);
  5669. } else {
  5670. range = {
  5671. min: 1,
  5672. max: 0
  5673. };
  5674. }
  5675. break;
  5676. case LEFTCURLYBRACKET$4:
  5677. range = readMultiplierRange(tokenizer);
  5678. break;
  5679. default:
  5680. return null;
  5681. }
  5682. return {
  5683. type: 'Multiplier',
  5684. comma: comma,
  5685. min: range.min,
  5686. max: range.max,
  5687. term: null
  5688. };
  5689. }
  5690. function maybeMultiplied(tokenizer, node) {
  5691. var multiplier = readMultiplier(tokenizer);
  5692. if (multiplier !== null) {
  5693. multiplier.term = node;
  5694. return multiplier;
  5695. }
  5696. return node;
  5697. }
  5698. function maybeToken(tokenizer) {
  5699. var ch = tokenizer.peek();
  5700. if (ch === '') {
  5701. return null;
  5702. }
  5703. return {
  5704. type: 'Token',
  5705. value: ch
  5706. };
  5707. }
  5708. function readProperty$1(tokenizer) {
  5709. var name;
  5710. tokenizer.eat(LESSTHANSIGN);
  5711. tokenizer.eat(APOSTROPHE);
  5712. name = scanWord(tokenizer);
  5713. tokenizer.eat(APOSTROPHE);
  5714. tokenizer.eat(GREATERTHANSIGN$2);
  5715. return maybeMultiplied(tokenizer, {
  5716. type: 'Property',
  5717. name: name
  5718. });
  5719. }
  5720. // https://drafts.csswg.org/css-values-3/#numeric-ranges
  5721. // 4.1. Range Restrictions and Range Definition Notation
  5722. //
  5723. // Range restrictions can be annotated in the numeric type notation using CSS bracketed
  5724. // range notation—[min,max]—within the angle brackets, after the identifying keyword,
  5725. // indicating a closed range between (and including) min and max.
  5726. // For example, <integer [0, 10]> indicates an integer between 0 and 10, inclusive.
  5727. function readTypeRange(tokenizer) {
  5728. // use null for Infinity to make AST format JSON serializable/deserializable
  5729. var min = null; // -Infinity
  5730. var max = null; // Infinity
  5731. var sign = 1;
  5732. tokenizer.eat(LEFTSQUAREBRACKET$4);
  5733. if (tokenizer.charCode() === HYPERMINUS) {
  5734. tokenizer.peek();
  5735. sign = -1;
  5736. }
  5737. if (sign == -1 && tokenizer.charCode() === INFINITY) {
  5738. tokenizer.peek();
  5739. } else {
  5740. min = sign * Number(scanNumber(tokenizer));
  5741. }
  5742. scanSpaces(tokenizer);
  5743. tokenizer.eat(COMMA$4);
  5744. scanSpaces(tokenizer);
  5745. if (tokenizer.charCode() === INFINITY) {
  5746. tokenizer.peek();
  5747. } else {
  5748. sign = 1;
  5749. if (tokenizer.charCode() === HYPERMINUS) {
  5750. tokenizer.peek();
  5751. sign = -1;
  5752. }
  5753. max = sign * Number(scanNumber(tokenizer));
  5754. }
  5755. tokenizer.eat(RIGHTSQUAREBRACKET$2);
  5756. // If no range is indicated, either by using the bracketed range notation
  5757. // or in the property description, then [−∞,∞] is assumed.
  5758. if (min === null && max === null) {
  5759. return null;
  5760. }
  5761. return {
  5762. type: 'Range',
  5763. min: min,
  5764. max: max
  5765. };
  5766. }
  5767. function readType(tokenizer) {
  5768. var name;
  5769. var opts = null;
  5770. tokenizer.eat(LESSTHANSIGN);
  5771. name = scanWord(tokenizer);
  5772. if (tokenizer.charCode() === LEFTPARENTHESIS$7 &&
  5773. tokenizer.nextCharCode() === RIGHTPARENTHESIS$7) {
  5774. tokenizer.pos += 2;
  5775. name += '()';
  5776. }
  5777. if (tokenizer.charCodeAt(tokenizer.findWsEnd(tokenizer.pos)) === LEFTSQUAREBRACKET$4) {
  5778. scanSpaces(tokenizer);
  5779. opts = readTypeRange(tokenizer);
  5780. }
  5781. tokenizer.eat(GREATERTHANSIGN$2);
  5782. return maybeMultiplied(tokenizer, {
  5783. type: 'Type',
  5784. name: name,
  5785. opts: opts
  5786. });
  5787. }
  5788. function readKeywordOrFunction(tokenizer) {
  5789. var name;
  5790. name = scanWord(tokenizer);
  5791. if (tokenizer.charCode() === LEFTPARENTHESIS$7) {
  5792. tokenizer.pos++;
  5793. return {
  5794. type: 'Function',
  5795. name: name
  5796. };
  5797. }
  5798. return maybeMultiplied(tokenizer, {
  5799. type: 'Keyword',
  5800. name: name
  5801. });
  5802. }
  5803. function regroupTerms(terms, combinators) {
  5804. function createGroup(terms, combinator) {
  5805. return {
  5806. type: 'Group',
  5807. terms: terms,
  5808. combinator: combinator,
  5809. disallowEmpty: false,
  5810. explicit: false
  5811. };
  5812. }
  5813. combinators = Object.keys(combinators).sort(function(a, b) {
  5814. return COMBINATOR_PRECEDENCE[a] - COMBINATOR_PRECEDENCE[b];
  5815. });
  5816. while (combinators.length > 0) {
  5817. var combinator = combinators.shift();
  5818. for (var i = 0, subgroupStart = 0; i < terms.length; i++) {
  5819. var term = terms[i];
  5820. if (term.type === 'Combinator') {
  5821. if (term.value === combinator) {
  5822. if (subgroupStart === -1) {
  5823. subgroupStart = i - 1;
  5824. }
  5825. terms.splice(i, 1);
  5826. i--;
  5827. } else {
  5828. if (subgroupStart !== -1 && i - subgroupStart > 1) {
  5829. terms.splice(
  5830. subgroupStart,
  5831. i - subgroupStart,
  5832. createGroup(terms.slice(subgroupStart, i), combinator)
  5833. );
  5834. i = subgroupStart + 1;
  5835. }
  5836. subgroupStart = -1;
  5837. }
  5838. }
  5839. }
  5840. if (subgroupStart !== -1 && combinators.length) {
  5841. terms.splice(
  5842. subgroupStart,
  5843. i - subgroupStart,
  5844. createGroup(terms.slice(subgroupStart, i), combinator)
  5845. );
  5846. }
  5847. }
  5848. return combinator;
  5849. }
  5850. function readImplicitGroup(tokenizer) {
  5851. var terms = [];
  5852. var combinators = {};
  5853. var token;
  5854. var prevToken = null;
  5855. var prevTokenPos = tokenizer.pos;
  5856. while (token = peek(tokenizer)) {
  5857. if (token.type !== 'Spaces') {
  5858. if (token.type === 'Combinator') {
  5859. // check for combinator in group beginning and double combinator sequence
  5860. if (prevToken === null || prevToken.type === 'Combinator') {
  5861. tokenizer.pos = prevTokenPos;
  5862. tokenizer.error('Unexpected combinator');
  5863. }
  5864. combinators[token.value] = true;
  5865. } else if (prevToken !== null && prevToken.type !== 'Combinator') {
  5866. combinators[' '] = true; // a b
  5867. terms.push({
  5868. type: 'Combinator',
  5869. value: ' '
  5870. });
  5871. }
  5872. terms.push(token);
  5873. prevToken = token;
  5874. prevTokenPos = tokenizer.pos;
  5875. }
  5876. }
  5877. // check for combinator in group ending
  5878. if (prevToken !== null && prevToken.type === 'Combinator') {
  5879. tokenizer.pos -= prevTokenPos;
  5880. tokenizer.error('Unexpected combinator');
  5881. }
  5882. return {
  5883. type: 'Group',
  5884. terms: terms,
  5885. combinator: regroupTerms(terms, combinators) || ' ',
  5886. disallowEmpty: false,
  5887. explicit: false
  5888. };
  5889. }
  5890. function readGroup(tokenizer) {
  5891. var result;
  5892. tokenizer.eat(LEFTSQUAREBRACKET$4);
  5893. result = readImplicitGroup(tokenizer);
  5894. tokenizer.eat(RIGHTSQUAREBRACKET$2);
  5895. result.explicit = true;
  5896. if (tokenizer.charCode() === EXCLAMATIONMARK$3) {
  5897. tokenizer.pos++;
  5898. result.disallowEmpty = true;
  5899. }
  5900. return result;
  5901. }
  5902. function peek(tokenizer) {
  5903. var code = tokenizer.charCode();
  5904. if (code < 128 && NAME_CHAR[code] === 1) {
  5905. return readKeywordOrFunction(tokenizer);
  5906. }
  5907. switch (code) {
  5908. case RIGHTSQUAREBRACKET$2:
  5909. // don't eat, stop scan a group
  5910. break;
  5911. case LEFTSQUAREBRACKET$4:
  5912. return maybeMultiplied(tokenizer, readGroup(tokenizer));
  5913. case LESSTHANSIGN:
  5914. return tokenizer.nextCharCode() === APOSTROPHE
  5915. ? readProperty$1(tokenizer)
  5916. : readType(tokenizer);
  5917. case VERTICALLINE$3:
  5918. return {
  5919. type: 'Combinator',
  5920. value: tokenizer.substringToPos(
  5921. tokenizer.nextCharCode() === VERTICALLINE$3
  5922. ? tokenizer.pos + 2
  5923. : tokenizer.pos + 1
  5924. )
  5925. };
  5926. case AMPERSAND$1:
  5927. tokenizer.pos++;
  5928. tokenizer.eat(AMPERSAND$1);
  5929. return {
  5930. type: 'Combinator',
  5931. value: '&&'
  5932. };
  5933. case COMMA$4:
  5934. tokenizer.pos++;
  5935. return {
  5936. type: 'Comma'
  5937. };
  5938. case APOSTROPHE:
  5939. return maybeMultiplied(tokenizer, {
  5940. type: 'String',
  5941. value: scanString(tokenizer)
  5942. });
  5943. case SPACE$1:
  5944. case TAB:
  5945. case N$2:
  5946. case R$1:
  5947. case F$1:
  5948. return {
  5949. type: 'Spaces',
  5950. value: scanSpaces(tokenizer)
  5951. };
  5952. case COMMERCIALAT:
  5953. code = tokenizer.nextCharCode();
  5954. if (code < 128 && NAME_CHAR[code] === 1) {
  5955. tokenizer.pos++;
  5956. return {
  5957. type: 'AtKeyword',
  5958. name: scanWord(tokenizer)
  5959. };
  5960. }
  5961. return maybeToken(tokenizer);
  5962. case ASTERISK$6:
  5963. case PLUSSIGN$6:
  5964. case QUESTIONMARK$1:
  5965. case NUMBERSIGN$4:
  5966. case EXCLAMATIONMARK$3:
  5967. // prohibited tokens (used as a multiplier start)
  5968. break;
  5969. case LEFTCURLYBRACKET$4:
  5970. // LEFTCURLYBRACKET is allowed since mdn/data uses it w/o quoting
  5971. // check next char isn't a number, because it's likely a disjoined multiplier
  5972. code = tokenizer.nextCharCode();
  5973. if (code < 48 || code > 57) {
  5974. return maybeToken(tokenizer);
  5975. }
  5976. break;
  5977. default:
  5978. return maybeToken(tokenizer);
  5979. }
  5980. }
  5981. function parse$2(source) {
  5982. var tokenizer = new Tokenizer(source);
  5983. var result = readImplicitGroup(tokenizer);
  5984. if (tokenizer.pos !== source.length) {
  5985. tokenizer.error('Unexpected input');
  5986. }
  5987. // reduce redundant groups with single group term
  5988. if (result.terms.length === 1 && result.terms[0].type === 'Group') {
  5989. result = result.terms[0];
  5990. }
  5991. return result;
  5992. }
  5993. // warm up parse to elimitate code branches that never execute
  5994. // fix soft deoptimizations (insufficient type feedback)
  5995. parse$2('[a&&<b>#|<\'c\'>*||e() f{2} /,(% g#{1,2} h{2,})]!');
  5996. var parse_1 = parse$2;
  5997. var noop$2 = function() {};
  5998. function ensureFunction$1(value) {
  5999. return typeof value === 'function' ? value : noop$2;
  6000. }
  6001. var walk$1 = function(node, options, context) {
  6002. function walk(node) {
  6003. enter.call(context, node);
  6004. switch (node.type) {
  6005. case 'Group':
  6006. node.terms.forEach(walk);
  6007. break;
  6008. case 'Multiplier':
  6009. walk(node.term);
  6010. break;
  6011. case 'Type':
  6012. case 'Property':
  6013. case 'Keyword':
  6014. case 'AtKeyword':
  6015. case 'Function':
  6016. case 'String':
  6017. case 'Token':
  6018. case 'Comma':
  6019. break;
  6020. default:
  6021. throw new Error('Unknown type: ' + node.type);
  6022. }
  6023. leave.call(context, node);
  6024. }
  6025. var enter = noop$2;
  6026. var leave = noop$2;
  6027. if (typeof options === 'function') {
  6028. enter = options;
  6029. } else if (options) {
  6030. enter = ensureFunction$1(options.enter);
  6031. leave = ensureFunction$1(options.leave);
  6032. }
  6033. if (enter === noop$2 && leave === noop$2) {
  6034. throw new Error('Neither `enter` nor `leave` walker handler is set or both aren\'t a function');
  6035. }
  6036. walk(node);
  6037. };
  6038. var tokenize$2 = tokenizer$3;
  6039. var TokenStream$2 = TokenStream_1;
  6040. var tokenStream = new TokenStream$2();
  6041. var astToTokens = {
  6042. decorator: function(handlers) {
  6043. var curNode = null;
  6044. var prev = { len: 0, node: null };
  6045. var nodes = [prev];
  6046. var buffer = '';
  6047. return {
  6048. children: handlers.children,
  6049. node: function(node) {
  6050. var tmp = curNode;
  6051. curNode = node;
  6052. handlers.node.call(this, node);
  6053. curNode = tmp;
  6054. },
  6055. chunk: function(chunk) {
  6056. buffer += chunk;
  6057. if (prev.node !== curNode) {
  6058. nodes.push({
  6059. len: chunk.length,
  6060. node: curNode
  6061. });
  6062. } else {
  6063. prev.len += chunk.length;
  6064. }
  6065. },
  6066. result: function() {
  6067. return prepareTokens$1(buffer, nodes);
  6068. }
  6069. };
  6070. }
  6071. };
  6072. function prepareTokens$1(str, nodes) {
  6073. var tokens = [];
  6074. var nodesOffset = 0;
  6075. var nodesIndex = 0;
  6076. var currentNode = nodes ? nodes[nodesIndex].node : null;
  6077. tokenize$2(str, tokenStream);
  6078. while (!tokenStream.eof) {
  6079. if (nodes) {
  6080. while (nodesIndex < nodes.length && nodesOffset + nodes[nodesIndex].len <= tokenStream.tokenStart) {
  6081. nodesOffset += nodes[nodesIndex++].len;
  6082. currentNode = nodes[nodesIndex].node;
  6083. }
  6084. }
  6085. tokens.push({
  6086. type: tokenStream.tokenType,
  6087. value: tokenStream.getTokenValue(),
  6088. index: tokenStream.tokenIndex, // TODO: remove it, temporary solution
  6089. balance: tokenStream.balance[tokenStream.tokenIndex], // TODO: remove it, temporary solution
  6090. node: currentNode
  6091. });
  6092. tokenStream.next();
  6093. // console.log({ ...tokens[tokens.length - 1], node: undefined });
  6094. }
  6095. return tokens;
  6096. }
  6097. var prepareTokens_1 = function(value, syntax) {
  6098. if (typeof value === 'string') {
  6099. return prepareTokens$1(value, null);
  6100. }
  6101. return syntax.generate(value, astToTokens);
  6102. };
  6103. var parse$1 = parse_1;
  6104. var MATCH$1 = { type: 'Match' };
  6105. var MISMATCH$1 = { type: 'Mismatch' };
  6106. var DISALLOW_EMPTY$1 = { type: 'DisallowEmpty' };
  6107. var LEFTPARENTHESIS$6 = 40; // (
  6108. var RIGHTPARENTHESIS$6 = 41; // )
  6109. function createCondition(match, thenBranch, elseBranch) {
  6110. // reduce node count
  6111. if (thenBranch === MATCH$1 && elseBranch === MISMATCH$1) {
  6112. return match;
  6113. }
  6114. if (match === MATCH$1 && thenBranch === MATCH$1 && elseBranch === MATCH$1) {
  6115. return match;
  6116. }
  6117. if (match.type === 'If' && match.else === MISMATCH$1 && thenBranch === MATCH$1) {
  6118. thenBranch = match.then;
  6119. match = match.match;
  6120. }
  6121. return {
  6122. type: 'If',
  6123. match: match,
  6124. then: thenBranch,
  6125. else: elseBranch
  6126. };
  6127. }
  6128. function isFunctionType(name) {
  6129. return (
  6130. name.length > 2 &&
  6131. name.charCodeAt(name.length - 2) === LEFTPARENTHESIS$6 &&
  6132. name.charCodeAt(name.length - 1) === RIGHTPARENTHESIS$6
  6133. );
  6134. }
  6135. function isEnumCapatible(term) {
  6136. return (
  6137. term.type === 'Keyword' ||
  6138. term.type === 'AtKeyword' ||
  6139. term.type === 'Function' ||
  6140. term.type === 'Type' && isFunctionType(term.name)
  6141. );
  6142. }
  6143. function buildGroupMatchGraph(combinator, terms, atLeastOneTermMatched) {
  6144. switch (combinator) {
  6145. case ' ':
  6146. // Juxtaposing components means that all of them must occur, in the given order.
  6147. //
  6148. // a b c
  6149. // =
  6150. // match a
  6151. // then match b
  6152. // then match c
  6153. // then MATCH
  6154. // else MISMATCH
  6155. // else MISMATCH
  6156. // else MISMATCH
  6157. var result = MATCH$1;
  6158. for (var i = terms.length - 1; i >= 0; i--) {
  6159. var term = terms[i];
  6160. result = createCondition(
  6161. term,
  6162. result,
  6163. MISMATCH$1
  6164. );
  6165. }
  6166. return result;
  6167. case '|':
  6168. // A bar (|) separates two or more alternatives: exactly one of them must occur.
  6169. //
  6170. // a | b | c
  6171. // =
  6172. // match a
  6173. // then MATCH
  6174. // else match b
  6175. // then MATCH
  6176. // else match c
  6177. // then MATCH
  6178. // else MISMATCH
  6179. var result = MISMATCH$1;
  6180. var map = null;
  6181. for (var i = terms.length - 1; i >= 0; i--) {
  6182. var term = terms[i];
  6183. // reduce sequence of keywords into a Enum
  6184. if (isEnumCapatible(term)) {
  6185. if (map === null && i > 0 && isEnumCapatible(terms[i - 1])) {
  6186. map = Object.create(null);
  6187. result = createCondition(
  6188. {
  6189. type: 'Enum',
  6190. map: map
  6191. },
  6192. MATCH$1,
  6193. result
  6194. );
  6195. }
  6196. if (map !== null) {
  6197. var key = (isFunctionType(term.name) ? term.name.slice(0, -1) : term.name).toLowerCase();
  6198. if (key in map === false) {
  6199. map[key] = term;
  6200. continue;
  6201. }
  6202. }
  6203. }
  6204. map = null;
  6205. // create a new conditonal node
  6206. result = createCondition(
  6207. term,
  6208. MATCH$1,
  6209. result
  6210. );
  6211. }
  6212. return result;
  6213. case '&&':
  6214. // A double ampersand (&&) separates two or more components,
  6215. // all of which must occur, in any order.
  6216. // Use MatchOnce for groups with a large number of terms,
  6217. // since &&-groups produces at least N!-node trees
  6218. if (terms.length > 5) {
  6219. return {
  6220. type: 'MatchOnce',
  6221. terms: terms,
  6222. all: true
  6223. };
  6224. }
  6225. // Use a combination tree for groups with small number of terms
  6226. //
  6227. // a && b && c
  6228. // =
  6229. // match a
  6230. // then [b && c]
  6231. // else match b
  6232. // then [a && c]
  6233. // else match c
  6234. // then [a && b]
  6235. // else MISMATCH
  6236. //
  6237. // a && b
  6238. // =
  6239. // match a
  6240. // then match b
  6241. // then MATCH
  6242. // else MISMATCH
  6243. // else match b
  6244. // then match a
  6245. // then MATCH
  6246. // else MISMATCH
  6247. // else MISMATCH
  6248. var result = MISMATCH$1;
  6249. for (var i = terms.length - 1; i >= 0; i--) {
  6250. var term = terms[i];
  6251. var thenClause;
  6252. if (terms.length > 1) {
  6253. thenClause = buildGroupMatchGraph(
  6254. combinator,
  6255. terms.filter(function(newGroupTerm) {
  6256. return newGroupTerm !== term;
  6257. }),
  6258. false
  6259. );
  6260. } else {
  6261. thenClause = MATCH$1;
  6262. }
  6263. result = createCondition(
  6264. term,
  6265. thenClause,
  6266. result
  6267. );
  6268. }
  6269. return result;
  6270. case '||':
  6271. // A double bar (||) separates two or more options:
  6272. // one or more of them must occur, in any order.
  6273. // Use MatchOnce for groups with a large number of terms,
  6274. // since ||-groups produces at least N!-node trees
  6275. if (terms.length > 5) {
  6276. return {
  6277. type: 'MatchOnce',
  6278. terms: terms,
  6279. all: false
  6280. };
  6281. }
  6282. // Use a combination tree for groups with small number of terms
  6283. //
  6284. // a || b || c
  6285. // =
  6286. // match a
  6287. // then [b || c]
  6288. // else match b
  6289. // then [a || c]
  6290. // else match c
  6291. // then [a || b]
  6292. // else MISMATCH
  6293. //
  6294. // a || b
  6295. // =
  6296. // match a
  6297. // then match b
  6298. // then MATCH
  6299. // else MATCH
  6300. // else match b
  6301. // then match a
  6302. // then MATCH
  6303. // else MATCH
  6304. // else MISMATCH
  6305. var result = atLeastOneTermMatched ? MATCH$1 : MISMATCH$1;
  6306. for (var i = terms.length - 1; i >= 0; i--) {
  6307. var term = terms[i];
  6308. var thenClause;
  6309. if (terms.length > 1) {
  6310. thenClause = buildGroupMatchGraph(
  6311. combinator,
  6312. terms.filter(function(newGroupTerm) {
  6313. return newGroupTerm !== term;
  6314. }),
  6315. true
  6316. );
  6317. } else {
  6318. thenClause = MATCH$1;
  6319. }
  6320. result = createCondition(
  6321. term,
  6322. thenClause,
  6323. result
  6324. );
  6325. }
  6326. return result;
  6327. }
  6328. }
  6329. function buildMultiplierMatchGraph(node) {
  6330. var result = MATCH$1;
  6331. var matchTerm = buildMatchGraph$1(node.term);
  6332. if (node.max === 0) {
  6333. // disable repeating of empty match to prevent infinite loop
  6334. matchTerm = createCondition(
  6335. matchTerm,
  6336. DISALLOW_EMPTY$1,
  6337. MISMATCH$1
  6338. );
  6339. // an occurrence count is not limited, make a cycle;
  6340. // to collect more terms on each following matching mismatch
  6341. result = createCondition(
  6342. matchTerm,
  6343. null, // will be a loop
  6344. MISMATCH$1
  6345. );
  6346. result.then = createCondition(
  6347. MATCH$1,
  6348. MATCH$1,
  6349. result // make a loop
  6350. );
  6351. if (node.comma) {
  6352. result.then.else = createCondition(
  6353. { type: 'Comma', syntax: node },
  6354. result,
  6355. MISMATCH$1
  6356. );
  6357. }
  6358. } else {
  6359. // create a match node chain for [min .. max] interval with optional matches
  6360. for (var i = node.min || 1; i <= node.max; i++) {
  6361. if (node.comma && result !== MATCH$1) {
  6362. result = createCondition(
  6363. { type: 'Comma', syntax: node },
  6364. result,
  6365. MISMATCH$1
  6366. );
  6367. }
  6368. result = createCondition(
  6369. matchTerm,
  6370. createCondition(
  6371. MATCH$1,
  6372. MATCH$1,
  6373. result
  6374. ),
  6375. MISMATCH$1
  6376. );
  6377. }
  6378. }
  6379. if (node.min === 0) {
  6380. // allow zero match
  6381. result = createCondition(
  6382. MATCH$1,
  6383. MATCH$1,
  6384. result
  6385. );
  6386. } else {
  6387. // create a match node chain to collect [0 ... min - 1] required matches
  6388. for (var i = 0; i < node.min - 1; i++) {
  6389. if (node.comma && result !== MATCH$1) {
  6390. result = createCondition(
  6391. { type: 'Comma', syntax: node },
  6392. result,
  6393. MISMATCH$1
  6394. );
  6395. }
  6396. result = createCondition(
  6397. matchTerm,
  6398. result,
  6399. MISMATCH$1
  6400. );
  6401. }
  6402. }
  6403. return result;
  6404. }
  6405. function buildMatchGraph$1(node) {
  6406. if (typeof node === 'function') {
  6407. return {
  6408. type: 'Generic',
  6409. fn: node
  6410. };
  6411. }
  6412. switch (node.type) {
  6413. case 'Group':
  6414. var result = buildGroupMatchGraph(
  6415. node.combinator,
  6416. node.terms.map(buildMatchGraph$1),
  6417. false
  6418. );
  6419. if (node.disallowEmpty) {
  6420. result = createCondition(
  6421. result,
  6422. DISALLOW_EMPTY$1,
  6423. MISMATCH$1
  6424. );
  6425. }
  6426. return result;
  6427. case 'Multiplier':
  6428. return buildMultiplierMatchGraph(node);
  6429. case 'Type':
  6430. case 'Property':
  6431. return {
  6432. type: node.type,
  6433. name: node.name,
  6434. syntax: node
  6435. };
  6436. case 'Keyword':
  6437. return {
  6438. type: node.type,
  6439. name: node.name.toLowerCase(),
  6440. syntax: node
  6441. };
  6442. case 'AtKeyword':
  6443. return {
  6444. type: node.type,
  6445. name: '@' + node.name.toLowerCase(),
  6446. syntax: node
  6447. };
  6448. case 'Function':
  6449. return {
  6450. type: node.type,
  6451. name: node.name.toLowerCase() + '(',
  6452. syntax: node
  6453. };
  6454. case 'String':
  6455. // convert a one char length String to a Token
  6456. if (node.value.length === 3) {
  6457. return {
  6458. type: 'Token',
  6459. value: node.value.charAt(1),
  6460. syntax: node
  6461. };
  6462. }
  6463. // otherwise use it as is
  6464. return {
  6465. type: node.type,
  6466. value: node.value.substr(1, node.value.length - 2).replace(/\\'/g, '\''),
  6467. syntax: node
  6468. };
  6469. case 'Token':
  6470. return {
  6471. type: node.type,
  6472. value: node.value,
  6473. syntax: node
  6474. };
  6475. case 'Comma':
  6476. return {
  6477. type: node.type,
  6478. syntax: node
  6479. };
  6480. default:
  6481. throw new Error('Unknown node type:', node.type);
  6482. }
  6483. }
  6484. var matchGraph$1 = {
  6485. MATCH: MATCH$1,
  6486. MISMATCH: MISMATCH$1,
  6487. DISALLOW_EMPTY: DISALLOW_EMPTY$1,
  6488. buildMatchGraph: function(syntaxTree, ref) {
  6489. if (typeof syntaxTree === 'string') {
  6490. syntaxTree = parse$1(syntaxTree);
  6491. }
  6492. return {
  6493. type: 'MatchGraph',
  6494. match: buildMatchGraph$1(syntaxTree),
  6495. syntax: ref || null,
  6496. source: syntaxTree
  6497. };
  6498. }
  6499. };
  6500. var hasOwnProperty$6 = Object.prototype.hasOwnProperty;
  6501. var matchGraph = matchGraph$1;
  6502. var MATCH = matchGraph.MATCH;
  6503. var MISMATCH = matchGraph.MISMATCH;
  6504. var DISALLOW_EMPTY = matchGraph.DISALLOW_EMPTY;
  6505. var TYPE$B = _const.TYPE;
  6506. var STUB = 0;
  6507. var TOKEN = 1;
  6508. var OPEN_SYNTAX = 2;
  6509. var CLOSE_SYNTAX = 3;
  6510. var EXIT_REASON_MATCH = 'Match';
  6511. var EXIT_REASON_MISMATCH = 'Mismatch';
  6512. var EXIT_REASON_ITERATION_LIMIT = 'Maximum iteration number exceeded (please fill an issue on https://github.com/csstree/csstree/issues)';
  6513. var ITERATION_LIMIT = 15000;
  6514. var totalIterationCount = 0;
  6515. function reverseList(list) {
  6516. var prev = null;
  6517. var next = null;
  6518. var item = list;
  6519. while (item !== null) {
  6520. next = item.prev;
  6521. item.prev = prev;
  6522. prev = item;
  6523. item = next;
  6524. }
  6525. return prev;
  6526. }
  6527. function areStringsEqualCaseInsensitive(testStr, referenceStr) {
  6528. if (testStr.length !== referenceStr.length) {
  6529. return false;
  6530. }
  6531. for (var i = 0; i < testStr.length; i++) {
  6532. var testCode = testStr.charCodeAt(i);
  6533. var referenceCode = referenceStr.charCodeAt(i);
  6534. // testCode.toLowerCase() for U+0041 LATIN CAPITAL LETTER A (A) .. U+005A LATIN CAPITAL LETTER Z (Z).
  6535. if (testCode >= 0x0041 && testCode <= 0x005A) {
  6536. testCode = testCode | 32;
  6537. }
  6538. if (testCode !== referenceCode) {
  6539. return false;
  6540. }
  6541. }
  6542. return true;
  6543. }
  6544. function isContextEdgeDelim(token) {
  6545. if (token.type !== TYPE$B.Delim) {
  6546. return false;
  6547. }
  6548. // Fix matching for unicode-range: U+30??, U+FF00-FF9F
  6549. // Probably we need to check out previous match instead
  6550. return token.value !== '?';
  6551. }
  6552. function isCommaContextStart(token) {
  6553. if (token === null) {
  6554. return true;
  6555. }
  6556. return (
  6557. token.type === TYPE$B.Comma ||
  6558. token.type === TYPE$B.Function ||
  6559. token.type === TYPE$B.LeftParenthesis ||
  6560. token.type === TYPE$B.LeftSquareBracket ||
  6561. token.type === TYPE$B.LeftCurlyBracket ||
  6562. isContextEdgeDelim(token)
  6563. );
  6564. }
  6565. function isCommaContextEnd(token) {
  6566. if (token === null) {
  6567. return true;
  6568. }
  6569. return (
  6570. token.type === TYPE$B.RightParenthesis ||
  6571. token.type === TYPE$B.RightSquareBracket ||
  6572. token.type === TYPE$B.RightCurlyBracket ||
  6573. token.type === TYPE$B.Delim
  6574. );
  6575. }
  6576. function internalMatch(tokens, state, syntaxes) {
  6577. function moveToNextToken() {
  6578. do {
  6579. tokenIndex++;
  6580. token = tokenIndex < tokens.length ? tokens[tokenIndex] : null;
  6581. } while (token !== null && (token.type === TYPE$B.WhiteSpace || token.type === TYPE$B.Comment));
  6582. }
  6583. function getNextToken(offset) {
  6584. var nextIndex = tokenIndex + offset;
  6585. return nextIndex < tokens.length ? tokens[nextIndex] : null;
  6586. }
  6587. function stateSnapshotFromSyntax(nextState, prev) {
  6588. return {
  6589. nextState: nextState,
  6590. matchStack: matchStack,
  6591. syntaxStack: syntaxStack,
  6592. thenStack: thenStack,
  6593. tokenIndex: tokenIndex,
  6594. prev: prev
  6595. };
  6596. }
  6597. function pushThenStack(nextState) {
  6598. thenStack = {
  6599. nextState: nextState,
  6600. matchStack: matchStack,
  6601. syntaxStack: syntaxStack,
  6602. prev: thenStack
  6603. };
  6604. }
  6605. function pushElseStack(nextState) {
  6606. elseStack = stateSnapshotFromSyntax(nextState, elseStack);
  6607. }
  6608. function addTokenToMatch() {
  6609. matchStack = {
  6610. type: TOKEN,
  6611. syntax: state.syntax,
  6612. token: token,
  6613. prev: matchStack
  6614. };
  6615. moveToNextToken();
  6616. syntaxStash = null;
  6617. if (tokenIndex > longestMatch) {
  6618. longestMatch = tokenIndex;
  6619. }
  6620. }
  6621. function openSyntax() {
  6622. syntaxStack = {
  6623. syntax: state.syntax,
  6624. opts: state.syntax.opts || (syntaxStack !== null && syntaxStack.opts) || null,
  6625. prev: syntaxStack
  6626. };
  6627. matchStack = {
  6628. type: OPEN_SYNTAX,
  6629. syntax: state.syntax,
  6630. token: matchStack.token,
  6631. prev: matchStack
  6632. };
  6633. }
  6634. function closeSyntax() {
  6635. if (matchStack.type === OPEN_SYNTAX) {
  6636. matchStack = matchStack.prev;
  6637. } else {
  6638. matchStack = {
  6639. type: CLOSE_SYNTAX,
  6640. syntax: syntaxStack.syntax,
  6641. token: matchStack.token,
  6642. prev: matchStack
  6643. };
  6644. }
  6645. syntaxStack = syntaxStack.prev;
  6646. }
  6647. var syntaxStack = null;
  6648. var thenStack = null;
  6649. var elseStack = null;
  6650. // null – stashing allowed, nothing stashed
  6651. // false – stashing disabled, nothing stashed
  6652. // anithing else – fail stashable syntaxes, some syntax stashed
  6653. var syntaxStash = null;
  6654. var iterationCount = 0; // count iterations and prevent infinite loop
  6655. var exitReason = null;
  6656. var token = null;
  6657. var tokenIndex = -1;
  6658. var longestMatch = 0;
  6659. var matchStack = {
  6660. type: STUB,
  6661. syntax: null,
  6662. token: null,
  6663. prev: null
  6664. };
  6665. moveToNextToken();
  6666. while (exitReason === null && ++iterationCount < ITERATION_LIMIT) {
  6667. // function mapList(list, fn) {
  6668. // var result = [];
  6669. // while (list) {
  6670. // result.unshift(fn(list));
  6671. // list = list.prev;
  6672. // }
  6673. // return result;
  6674. // }
  6675. // console.log('--\n',
  6676. // '#' + iterationCount,
  6677. // require('util').inspect({
  6678. // match: mapList(matchStack, x => x.type === TOKEN ? x.token && x.token.value : x.syntax ? ({ [OPEN_SYNTAX]: '<', [CLOSE_SYNTAX]: '</' }[x.type] || x.type) + '!' + x.syntax.name : null),
  6679. // token: token && token.value,
  6680. // tokenIndex,
  6681. // syntax: syntax.type + (syntax.id ? ' #' + syntax.id : '')
  6682. // }, { depth: null })
  6683. // );
  6684. switch (state.type) {
  6685. case 'Match':
  6686. if (thenStack === null) {
  6687. // turn to MISMATCH when some tokens left unmatched
  6688. if (token !== null) {
  6689. // doesn't mismatch if just one token left and it's an IE hack
  6690. if (tokenIndex !== tokens.length - 1 || (token.value !== '\\0' && token.value !== '\\9')) {
  6691. state = MISMATCH;
  6692. break;
  6693. }
  6694. }
  6695. // break the main loop, return a result - MATCH
  6696. exitReason = EXIT_REASON_MATCH;
  6697. break;
  6698. }
  6699. // go to next syntax (`then` branch)
  6700. state = thenStack.nextState;
  6701. // check match is not empty
  6702. if (state === DISALLOW_EMPTY) {
  6703. if (thenStack.matchStack === matchStack) {
  6704. state = MISMATCH;
  6705. break;
  6706. } else {
  6707. state = MATCH;
  6708. }
  6709. }
  6710. // close syntax if needed
  6711. while (thenStack.syntaxStack !== syntaxStack) {
  6712. closeSyntax();
  6713. }
  6714. // pop stack
  6715. thenStack = thenStack.prev;
  6716. break;
  6717. case 'Mismatch':
  6718. // when some syntax is stashed
  6719. if (syntaxStash !== null && syntaxStash !== false) {
  6720. // there is no else branches or a branch reduce match stack
  6721. if (elseStack === null || tokenIndex > elseStack.tokenIndex) {
  6722. // restore state from the stash
  6723. elseStack = syntaxStash;
  6724. syntaxStash = false; // disable stashing
  6725. }
  6726. } else if (elseStack === null) {
  6727. // no else branches -> break the main loop
  6728. // return a result - MISMATCH
  6729. exitReason = EXIT_REASON_MISMATCH;
  6730. break;
  6731. }
  6732. // go to next syntax (`else` branch)
  6733. state = elseStack.nextState;
  6734. // restore all the rest stack states
  6735. thenStack = elseStack.thenStack;
  6736. syntaxStack = elseStack.syntaxStack;
  6737. matchStack = elseStack.matchStack;
  6738. tokenIndex = elseStack.tokenIndex;
  6739. token = tokenIndex < tokens.length ? tokens[tokenIndex] : null;
  6740. // pop stack
  6741. elseStack = elseStack.prev;
  6742. break;
  6743. case 'MatchGraph':
  6744. state = state.match;
  6745. break;
  6746. case 'If':
  6747. // IMPORTANT: else stack push must go first,
  6748. // since it stores the state of thenStack before changes
  6749. if (state.else !== MISMATCH) {
  6750. pushElseStack(state.else);
  6751. }
  6752. if (state.then !== MATCH) {
  6753. pushThenStack(state.then);
  6754. }
  6755. state = state.match;
  6756. break;
  6757. case 'MatchOnce':
  6758. state = {
  6759. type: 'MatchOnceBuffer',
  6760. syntax: state,
  6761. index: 0,
  6762. mask: 0
  6763. };
  6764. break;
  6765. case 'MatchOnceBuffer':
  6766. var terms = state.syntax.terms;
  6767. if (state.index === terms.length) {
  6768. // no matches at all or it's required all terms to be matched
  6769. if (state.mask === 0 || state.syntax.all) {
  6770. state = MISMATCH;
  6771. break;
  6772. }
  6773. // a partial match is ok
  6774. state = MATCH;
  6775. break;
  6776. }
  6777. // all terms are matched
  6778. if (state.mask === (1 << terms.length) - 1) {
  6779. state = MATCH;
  6780. break;
  6781. }
  6782. for (; state.index < terms.length; state.index++) {
  6783. var matchFlag = 1 << state.index;
  6784. if ((state.mask & matchFlag) === 0) {
  6785. // IMPORTANT: else stack push must go first,
  6786. // since it stores the state of thenStack before changes
  6787. pushElseStack(state);
  6788. pushThenStack({
  6789. type: 'AddMatchOnce',
  6790. syntax: state.syntax,
  6791. mask: state.mask | matchFlag
  6792. });
  6793. // match
  6794. state = terms[state.index++];
  6795. break;
  6796. }
  6797. }
  6798. break;
  6799. case 'AddMatchOnce':
  6800. state = {
  6801. type: 'MatchOnceBuffer',
  6802. syntax: state.syntax,
  6803. index: 0,
  6804. mask: state.mask
  6805. };
  6806. break;
  6807. case 'Enum':
  6808. if (token !== null) {
  6809. var name = token.value.toLowerCase();
  6810. // drop \0 and \9 hack from keyword name
  6811. if (name.indexOf('\\') !== -1) {
  6812. name = name.replace(/\\[09].*$/, '');
  6813. }
  6814. if (hasOwnProperty$6.call(state.map, name)) {
  6815. state = state.map[name];
  6816. break;
  6817. }
  6818. }
  6819. state = MISMATCH;
  6820. break;
  6821. case 'Generic':
  6822. var opts = syntaxStack !== null ? syntaxStack.opts : null;
  6823. var lastTokenIndex = tokenIndex + Math.floor(state.fn(token, getNextToken, opts));
  6824. if (!isNaN(lastTokenIndex) && lastTokenIndex > tokenIndex) {
  6825. while (tokenIndex < lastTokenIndex) {
  6826. addTokenToMatch();
  6827. }
  6828. state = MATCH;
  6829. } else {
  6830. state = MISMATCH;
  6831. }
  6832. break;
  6833. case 'Type':
  6834. case 'Property':
  6835. var syntaxDict = state.type === 'Type' ? 'types' : 'properties';
  6836. var dictSyntax = hasOwnProperty$6.call(syntaxes, syntaxDict) ? syntaxes[syntaxDict][state.name] : null;
  6837. if (!dictSyntax || !dictSyntax.match) {
  6838. throw new Error(
  6839. 'Bad syntax reference: ' +
  6840. (state.type === 'Type'
  6841. ? '<' + state.name + '>'
  6842. : '<\'' + state.name + '\'>')
  6843. );
  6844. }
  6845. // stash a syntax for types with low priority
  6846. if (syntaxStash !== false && token !== null && state.type === 'Type') {
  6847. var lowPriorityMatching =
  6848. // https://drafts.csswg.org/css-values-4/#custom-idents
  6849. // When parsing positionally-ambiguous keywords in a property value, a <custom-ident> production
  6850. // can only claim the keyword if no other unfulfilled production can claim it.
  6851. (state.name === 'custom-ident' && token.type === TYPE$B.Ident) ||
  6852. // https://drafts.csswg.org/css-values-4/#lengths
  6853. // ... if a `0` could be parsed as either a <number> or a <length> in a property (such as line-height),
  6854. // it must parse as a <number>
  6855. (state.name === 'length' && token.value === '0');
  6856. if (lowPriorityMatching) {
  6857. if (syntaxStash === null) {
  6858. syntaxStash = stateSnapshotFromSyntax(state, elseStack);
  6859. }
  6860. state = MISMATCH;
  6861. break;
  6862. }
  6863. }
  6864. openSyntax();
  6865. state = dictSyntax.match;
  6866. break;
  6867. case 'Keyword':
  6868. var name = state.name;
  6869. if (token !== null) {
  6870. var keywordName = token.value;
  6871. // drop \0 and \9 hack from keyword name
  6872. if (keywordName.indexOf('\\') !== -1) {
  6873. keywordName = keywordName.replace(/\\[09].*$/, '');
  6874. }
  6875. if (areStringsEqualCaseInsensitive(keywordName, name)) {
  6876. addTokenToMatch();
  6877. state = MATCH;
  6878. break;
  6879. }
  6880. }
  6881. state = MISMATCH;
  6882. break;
  6883. case 'AtKeyword':
  6884. case 'Function':
  6885. if (token !== null && areStringsEqualCaseInsensitive(token.value, state.name)) {
  6886. addTokenToMatch();
  6887. state = MATCH;
  6888. break;
  6889. }
  6890. state = MISMATCH;
  6891. break;
  6892. case 'Token':
  6893. if (token !== null && token.value === state.value) {
  6894. addTokenToMatch();
  6895. state = MATCH;
  6896. break;
  6897. }
  6898. state = MISMATCH;
  6899. break;
  6900. case 'Comma':
  6901. if (token !== null && token.type === TYPE$B.Comma) {
  6902. if (isCommaContextStart(matchStack.token)) {
  6903. state = MISMATCH;
  6904. } else {
  6905. addTokenToMatch();
  6906. state = isCommaContextEnd(token) ? MISMATCH : MATCH;
  6907. }
  6908. } else {
  6909. state = isCommaContextStart(matchStack.token) || isCommaContextEnd(token) ? MATCH : MISMATCH;
  6910. }
  6911. break;
  6912. case 'String':
  6913. var string = '';
  6914. for (var lastTokenIndex = tokenIndex; lastTokenIndex < tokens.length && string.length < state.value.length; lastTokenIndex++) {
  6915. string += tokens[lastTokenIndex].value;
  6916. }
  6917. if (areStringsEqualCaseInsensitive(string, state.value)) {
  6918. while (tokenIndex < lastTokenIndex) {
  6919. addTokenToMatch();
  6920. }
  6921. state = MATCH;
  6922. } else {
  6923. state = MISMATCH;
  6924. }
  6925. break;
  6926. default:
  6927. throw new Error('Unknown node type: ' + state.type);
  6928. }
  6929. }
  6930. totalIterationCount += iterationCount;
  6931. switch (exitReason) {
  6932. case null:
  6933. console.warn('[csstree-match] BREAK after ' + ITERATION_LIMIT + ' iterations');
  6934. exitReason = EXIT_REASON_ITERATION_LIMIT;
  6935. matchStack = null;
  6936. break;
  6937. case EXIT_REASON_MATCH:
  6938. while (syntaxStack !== null) {
  6939. closeSyntax();
  6940. }
  6941. break;
  6942. default:
  6943. matchStack = null;
  6944. }
  6945. return {
  6946. tokens: tokens,
  6947. reason: exitReason,
  6948. iterations: iterationCount,
  6949. match: matchStack,
  6950. longestMatch: longestMatch
  6951. };
  6952. }
  6953. function matchAsList(tokens, matchGraph, syntaxes) {
  6954. var matchResult = internalMatch(tokens, matchGraph, syntaxes || {});
  6955. if (matchResult.match !== null) {
  6956. var item = reverseList(matchResult.match).prev;
  6957. matchResult.match = [];
  6958. while (item !== null) {
  6959. switch (item.type) {
  6960. case STUB:
  6961. break;
  6962. case OPEN_SYNTAX:
  6963. case CLOSE_SYNTAX:
  6964. matchResult.match.push({
  6965. type: item.type,
  6966. syntax: item.syntax
  6967. });
  6968. break;
  6969. default:
  6970. matchResult.match.push({
  6971. token: item.token.value,
  6972. node: item.token.node
  6973. });
  6974. break;
  6975. }
  6976. item = item.prev;
  6977. }
  6978. }
  6979. return matchResult;
  6980. }
  6981. function matchAsTree$1(tokens, matchGraph, syntaxes) {
  6982. var matchResult = internalMatch(tokens, matchGraph, syntaxes || {});
  6983. if (matchResult.match === null) {
  6984. return matchResult;
  6985. }
  6986. var item = matchResult.match;
  6987. var host = matchResult.match = {
  6988. syntax: matchGraph.syntax || null,
  6989. match: []
  6990. };
  6991. var hostStack = [host];
  6992. // revert a list and start with 2nd item since 1st is a stub item
  6993. item = reverseList(item).prev;
  6994. // build a tree
  6995. while (item !== null) {
  6996. switch (item.type) {
  6997. case OPEN_SYNTAX:
  6998. host.match.push(host = {
  6999. syntax: item.syntax,
  7000. match: []
  7001. });
  7002. hostStack.push(host);
  7003. break;
  7004. case CLOSE_SYNTAX:
  7005. hostStack.pop();
  7006. host = hostStack[hostStack.length - 1];
  7007. break;
  7008. default:
  7009. host.match.push({
  7010. syntax: item.syntax || null,
  7011. token: item.token.value,
  7012. node: item.token.node
  7013. });
  7014. }
  7015. item = item.prev;
  7016. }
  7017. return matchResult;
  7018. }
  7019. var match = {
  7020. matchAsList: matchAsList,
  7021. matchAsTree: matchAsTree$1,
  7022. getTotalIterationCount: function() {
  7023. return totalIterationCount;
  7024. }
  7025. };
  7026. function getTrace(node) {
  7027. function shouldPutToTrace(syntax) {
  7028. if (syntax === null) {
  7029. return false;
  7030. }
  7031. return (
  7032. syntax.type === 'Type' ||
  7033. syntax.type === 'Property' ||
  7034. syntax.type === 'Keyword'
  7035. );
  7036. }
  7037. function hasMatch(matchNode) {
  7038. if (Array.isArray(matchNode.match)) {
  7039. // use for-loop for better perfomance
  7040. for (var i = 0; i < matchNode.match.length; i++) {
  7041. if (hasMatch(matchNode.match[i])) {
  7042. if (shouldPutToTrace(matchNode.syntax)) {
  7043. result.unshift(matchNode.syntax);
  7044. }
  7045. return true;
  7046. }
  7047. }
  7048. } else if (matchNode.node === node) {
  7049. result = shouldPutToTrace(matchNode.syntax)
  7050. ? [matchNode.syntax]
  7051. : [];
  7052. return true;
  7053. }
  7054. return false;
  7055. }
  7056. var result = null;
  7057. if (this.matched !== null) {
  7058. hasMatch(this.matched);
  7059. }
  7060. return result;
  7061. }
  7062. function testNode(match, node, fn) {
  7063. var trace = getTrace.call(match, node);
  7064. if (trace === null) {
  7065. return false;
  7066. }
  7067. return trace.some(fn);
  7068. }
  7069. function isType(node, type) {
  7070. return testNode(this, node, function(matchNode) {
  7071. return matchNode.type === 'Type' && matchNode.name === type;
  7072. });
  7073. }
  7074. function isProperty(node, property) {
  7075. return testNode(this, node, function(matchNode) {
  7076. return matchNode.type === 'Property' && matchNode.name === property;
  7077. });
  7078. }
  7079. function isKeyword(node) {
  7080. return testNode(this, node, function(matchNode) {
  7081. return matchNode.type === 'Keyword';
  7082. });
  7083. }
  7084. var trace$1 = {
  7085. getTrace: getTrace,
  7086. isType: isType,
  7087. isProperty: isProperty,
  7088. isKeyword: isKeyword
  7089. };
  7090. var List$5 = List_1;
  7091. function getFirstMatchNode(matchNode) {
  7092. if ('node' in matchNode) {
  7093. return matchNode.node;
  7094. }
  7095. return getFirstMatchNode(matchNode.match[0]);
  7096. }
  7097. function getLastMatchNode(matchNode) {
  7098. if ('node' in matchNode) {
  7099. return matchNode.node;
  7100. }
  7101. return getLastMatchNode(matchNode.match[matchNode.match.length - 1]);
  7102. }
  7103. function matchFragments(lexer, ast, match, type, name) {
  7104. function findFragments(matchNode) {
  7105. if (matchNode.syntax !== null &&
  7106. matchNode.syntax.type === type &&
  7107. matchNode.syntax.name === name) {
  7108. var start = getFirstMatchNode(matchNode);
  7109. var end = getLastMatchNode(matchNode);
  7110. lexer.syntax.walk(ast, function(node, item, list) {
  7111. if (node === start) {
  7112. var nodes = new List$5();
  7113. do {
  7114. nodes.appendData(item.data);
  7115. if (item.data === end) {
  7116. break;
  7117. }
  7118. item = item.next;
  7119. } while (item !== null);
  7120. fragments.push({
  7121. parent: list,
  7122. nodes: nodes
  7123. });
  7124. }
  7125. });
  7126. }
  7127. if (Array.isArray(matchNode.match)) {
  7128. matchNode.match.forEach(findFragments);
  7129. }
  7130. }
  7131. var fragments = [];
  7132. if (match.matched !== null) {
  7133. findFragments(match.matched);
  7134. }
  7135. return fragments;
  7136. }
  7137. var search$1 = {
  7138. matchFragments: matchFragments
  7139. };
  7140. var List$4 = List_1;
  7141. var hasOwnProperty$5 = Object.prototype.hasOwnProperty;
  7142. function isValidNumber(value) {
  7143. // Number.isInteger(value) && value >= 0
  7144. return (
  7145. typeof value === 'number' &&
  7146. isFinite(value) &&
  7147. Math.floor(value) === value &&
  7148. value >= 0
  7149. );
  7150. }
  7151. function isValidLocation(loc) {
  7152. return (
  7153. Boolean(loc) &&
  7154. isValidNumber(loc.offset) &&
  7155. isValidNumber(loc.line) &&
  7156. isValidNumber(loc.column)
  7157. );
  7158. }
  7159. function createNodeStructureChecker(type, fields) {
  7160. return function checkNode(node, warn) {
  7161. if (!node || node.constructor !== Object) {
  7162. return warn(node, 'Type of node should be an Object');
  7163. }
  7164. for (var key in node) {
  7165. var valid = true;
  7166. if (hasOwnProperty$5.call(node, key) === false) {
  7167. continue;
  7168. }
  7169. if (key === 'type') {
  7170. if (node.type !== type) {
  7171. warn(node, 'Wrong node type `' + node.type + '`, expected `' + type + '`');
  7172. }
  7173. } else if (key === 'loc') {
  7174. if (node.loc === null) {
  7175. continue;
  7176. } else if (node.loc && node.loc.constructor === Object) {
  7177. if (typeof node.loc.source !== 'string') {
  7178. key += '.source';
  7179. } else if (!isValidLocation(node.loc.start)) {
  7180. key += '.start';
  7181. } else if (!isValidLocation(node.loc.end)) {
  7182. key += '.end';
  7183. } else {
  7184. continue;
  7185. }
  7186. }
  7187. valid = false;
  7188. } else if (fields.hasOwnProperty(key)) {
  7189. for (var i = 0, valid = false; !valid && i < fields[key].length; i++) {
  7190. var fieldType = fields[key][i];
  7191. switch (fieldType) {
  7192. case String:
  7193. valid = typeof node[key] === 'string';
  7194. break;
  7195. case Boolean:
  7196. valid = typeof node[key] === 'boolean';
  7197. break;
  7198. case null:
  7199. valid = node[key] === null;
  7200. break;
  7201. default:
  7202. if (typeof fieldType === 'string') {
  7203. valid = node[key] && node[key].type === fieldType;
  7204. } else if (Array.isArray(fieldType)) {
  7205. valid = node[key] instanceof List$4;
  7206. }
  7207. }
  7208. }
  7209. } else {
  7210. warn(node, 'Unknown field `' + key + '` for ' + type + ' node type');
  7211. }
  7212. if (!valid) {
  7213. warn(node, 'Bad value for `' + type + '.' + key + '`');
  7214. }
  7215. }
  7216. for (var key in fields) {
  7217. if (hasOwnProperty$5.call(fields, key) &&
  7218. hasOwnProperty$5.call(node, key) === false) {
  7219. warn(node, 'Field `' + type + '.' + key + '` is missed');
  7220. }
  7221. }
  7222. };
  7223. }
  7224. function processStructure(name, nodeType) {
  7225. var structure = nodeType.structure;
  7226. var fields = {
  7227. type: String,
  7228. loc: true
  7229. };
  7230. var docs = {
  7231. type: '"' + name + '"'
  7232. };
  7233. for (var key in structure) {
  7234. if (hasOwnProperty$5.call(structure, key) === false) {
  7235. continue;
  7236. }
  7237. var docsTypes = [];
  7238. var fieldTypes = fields[key] = Array.isArray(structure[key])
  7239. ? structure[key].slice()
  7240. : [structure[key]];
  7241. for (var i = 0; i < fieldTypes.length; i++) {
  7242. var fieldType = fieldTypes[i];
  7243. if (fieldType === String || fieldType === Boolean) {
  7244. docsTypes.push(fieldType.name);
  7245. } else if (fieldType === null) {
  7246. docsTypes.push('null');
  7247. } else if (typeof fieldType === 'string') {
  7248. docsTypes.push('<' + fieldType + '>');
  7249. } else if (Array.isArray(fieldType)) {
  7250. docsTypes.push('List'); // TODO: use type enum
  7251. } else {
  7252. throw new Error('Wrong value `' + fieldType + '` in `' + name + '.' + key + '` structure definition');
  7253. }
  7254. }
  7255. docs[key] = docsTypes.join(' | ');
  7256. }
  7257. return {
  7258. docs: docs,
  7259. check: createNodeStructureChecker(name, fields)
  7260. };
  7261. }
  7262. var structure = {
  7263. getStructureFromConfig: function(config) {
  7264. var structure = {};
  7265. if (config.node) {
  7266. for (var name in config.node) {
  7267. if (hasOwnProperty$5.call(config.node, name)) {
  7268. var nodeType = config.node[name];
  7269. if (nodeType.structure) {
  7270. structure[name] = processStructure(name, nodeType);
  7271. } else {
  7272. throw new Error('Missed `structure` field in `' + name + '` node type definition');
  7273. }
  7274. }
  7275. }
  7276. }
  7277. return structure;
  7278. }
  7279. };
  7280. var SyntaxReferenceError = error.SyntaxReferenceError;
  7281. var SyntaxMatchError = error.SyntaxMatchError;
  7282. var names$1 = names$2;
  7283. var generic = generic$1;
  7284. var parse = parse_1;
  7285. var generate = generate_1;
  7286. var walk = walk$1;
  7287. var prepareTokens = prepareTokens_1;
  7288. var buildMatchGraph = matchGraph$1.buildMatchGraph;
  7289. var matchAsTree = match.matchAsTree;
  7290. var trace = trace$1;
  7291. var search = search$1;
  7292. var getStructureFromConfig = structure.getStructureFromConfig;
  7293. var cssWideKeywords = buildMatchGraph('inherit | initial | unset');
  7294. var cssWideKeywordsWithExpression = buildMatchGraph('inherit | initial | unset | <-ms-legacy-expression>');
  7295. function dumpMapSyntax(map, compact, syntaxAsAst) {
  7296. var result = {};
  7297. for (var name in map) {
  7298. if (map[name].syntax) {
  7299. result[name] = syntaxAsAst
  7300. ? map[name].syntax
  7301. : generate(map[name].syntax, { compact: compact });
  7302. }
  7303. }
  7304. return result;
  7305. }
  7306. function dumpAtruleMapSyntax(map, compact, syntaxAsAst) {
  7307. const result = {};
  7308. for (const [name, atrule] of Object.entries(map)) {
  7309. result[name] = {
  7310. prelude: atrule.prelude && (
  7311. syntaxAsAst
  7312. ? atrule.prelude.syntax
  7313. : generate(atrule.prelude.syntax, { compact })
  7314. ),
  7315. descriptors: atrule.descriptors && dumpMapSyntax(atrule.descriptors, compact, syntaxAsAst)
  7316. };
  7317. }
  7318. return result;
  7319. }
  7320. function valueHasVar(tokens) {
  7321. for (var i = 0; i < tokens.length; i++) {
  7322. if (tokens[i].value.toLowerCase() === 'var(') {
  7323. return true;
  7324. }
  7325. }
  7326. return false;
  7327. }
  7328. function buildMatchResult(match, error, iterations) {
  7329. return {
  7330. matched: match,
  7331. iterations: iterations,
  7332. error: error,
  7333. getTrace: trace.getTrace,
  7334. isType: trace.isType,
  7335. isProperty: trace.isProperty,
  7336. isKeyword: trace.isKeyword
  7337. };
  7338. }
  7339. function matchSyntax(lexer, syntax, value, useCommon) {
  7340. var tokens = prepareTokens(value, lexer.syntax);
  7341. var result;
  7342. if (valueHasVar(tokens)) {
  7343. return buildMatchResult(null, new Error('Matching for a tree with var() is not supported'));
  7344. }
  7345. if (useCommon) {
  7346. result = matchAsTree(tokens, lexer.valueCommonSyntax, lexer);
  7347. }
  7348. if (!useCommon || !result.match) {
  7349. result = matchAsTree(tokens, syntax.match, lexer);
  7350. if (!result.match) {
  7351. return buildMatchResult(
  7352. null,
  7353. new SyntaxMatchError(result.reason, syntax.syntax, value, result),
  7354. result.iterations
  7355. );
  7356. }
  7357. }
  7358. return buildMatchResult(result.match, null, result.iterations);
  7359. }
  7360. var Lexer$1 = function(config, syntax, structure) {
  7361. this.valueCommonSyntax = cssWideKeywords;
  7362. this.syntax = syntax;
  7363. this.generic = false;
  7364. this.atrules = {};
  7365. this.properties = {};
  7366. this.types = {};
  7367. this.structure = structure || getStructureFromConfig(config);
  7368. if (config) {
  7369. if (config.types) {
  7370. for (var name in config.types) {
  7371. this.addType_(name, config.types[name]);
  7372. }
  7373. }
  7374. if (config.generic) {
  7375. this.generic = true;
  7376. for (var name in generic) {
  7377. this.addType_(name, generic[name]);
  7378. }
  7379. }
  7380. if (config.atrules) {
  7381. for (var name in config.atrules) {
  7382. this.addAtrule_(name, config.atrules[name]);
  7383. }
  7384. }
  7385. if (config.properties) {
  7386. for (var name in config.properties) {
  7387. this.addProperty_(name, config.properties[name]);
  7388. }
  7389. }
  7390. }
  7391. };
  7392. Lexer$1.prototype = {
  7393. structure: {},
  7394. checkStructure: function(ast) {
  7395. function collectWarning(node, message) {
  7396. warns.push({
  7397. node: node,
  7398. message: message
  7399. });
  7400. }
  7401. var structure = this.structure;
  7402. var warns = [];
  7403. this.syntax.walk(ast, function(node) {
  7404. if (structure.hasOwnProperty(node.type)) {
  7405. structure[node.type].check(node, collectWarning);
  7406. } else {
  7407. collectWarning(node, 'Unknown node type `' + node.type + '`');
  7408. }
  7409. });
  7410. return warns.length ? warns : false;
  7411. },
  7412. createDescriptor: function(syntax, type, name, parent = null) {
  7413. var ref = {
  7414. type: type,
  7415. name: name
  7416. };
  7417. var descriptor = {
  7418. type: type,
  7419. name: name,
  7420. parent: parent,
  7421. syntax: null,
  7422. match: null
  7423. };
  7424. if (typeof syntax === 'function') {
  7425. descriptor.match = buildMatchGraph(syntax, ref);
  7426. } else {
  7427. if (typeof syntax === 'string') {
  7428. // lazy parsing on first access
  7429. Object.defineProperty(descriptor, 'syntax', {
  7430. get: function() {
  7431. Object.defineProperty(descriptor, 'syntax', {
  7432. value: parse(syntax)
  7433. });
  7434. return descriptor.syntax;
  7435. }
  7436. });
  7437. } else {
  7438. descriptor.syntax = syntax;
  7439. }
  7440. // lazy graph build on first access
  7441. Object.defineProperty(descriptor, 'match', {
  7442. get: function() {
  7443. Object.defineProperty(descriptor, 'match', {
  7444. value: buildMatchGraph(descriptor.syntax, ref)
  7445. });
  7446. return descriptor.match;
  7447. }
  7448. });
  7449. }
  7450. return descriptor;
  7451. },
  7452. addAtrule_: function(name, syntax) {
  7453. if (!syntax) {
  7454. return;
  7455. }
  7456. this.atrules[name] = {
  7457. type: 'Atrule',
  7458. name: name,
  7459. prelude: syntax.prelude ? this.createDescriptor(syntax.prelude, 'AtrulePrelude', name) : null,
  7460. descriptors: syntax.descriptors
  7461. ? Object.keys(syntax.descriptors).reduce((res, descName) => {
  7462. res[descName] = this.createDescriptor(syntax.descriptors[descName], 'AtruleDescriptor', descName, name);
  7463. return res;
  7464. }, {})
  7465. : null
  7466. };
  7467. },
  7468. addProperty_: function(name, syntax) {
  7469. if (!syntax) {
  7470. return;
  7471. }
  7472. this.properties[name] = this.createDescriptor(syntax, 'Property', name);
  7473. },
  7474. addType_: function(name, syntax) {
  7475. if (!syntax) {
  7476. return;
  7477. }
  7478. this.types[name] = this.createDescriptor(syntax, 'Type', name);
  7479. if (syntax === generic['-ms-legacy-expression']) {
  7480. this.valueCommonSyntax = cssWideKeywordsWithExpression;
  7481. }
  7482. },
  7483. checkAtruleName: function(atruleName) {
  7484. if (!this.getAtrule(atruleName)) {
  7485. return new SyntaxReferenceError('Unknown at-rule', '@' + atruleName);
  7486. }
  7487. },
  7488. checkAtrulePrelude: function(atruleName, prelude) {
  7489. let error = this.checkAtruleName(atruleName);
  7490. if (error) {
  7491. return error;
  7492. }
  7493. var atrule = this.getAtrule(atruleName);
  7494. if (!atrule.prelude && prelude) {
  7495. return new SyntaxError('At-rule `@' + atruleName + '` should not contain a prelude');
  7496. }
  7497. if (atrule.prelude && !prelude) {
  7498. return new SyntaxError('At-rule `@' + atruleName + '` should contain a prelude');
  7499. }
  7500. },
  7501. checkAtruleDescriptorName: function(atruleName, descriptorName) {
  7502. let error = this.checkAtruleName(atruleName);
  7503. if (error) {
  7504. return error;
  7505. }
  7506. var atrule = this.getAtrule(atruleName);
  7507. var descriptor = names$1.keyword(descriptorName);
  7508. if (!atrule.descriptors) {
  7509. return new SyntaxError('At-rule `@' + atruleName + '` has no known descriptors');
  7510. }
  7511. if (!atrule.descriptors[descriptor.name] &&
  7512. !atrule.descriptors[descriptor.basename]) {
  7513. return new SyntaxReferenceError('Unknown at-rule descriptor', descriptorName);
  7514. }
  7515. },
  7516. checkPropertyName: function(propertyName) {
  7517. var property = names$1.property(propertyName);
  7518. // don't match syntax for a custom property
  7519. if (property.custom) {
  7520. return new Error('Lexer matching doesn\'t applicable for custom properties');
  7521. }
  7522. if (!this.getProperty(propertyName)) {
  7523. return new SyntaxReferenceError('Unknown property', propertyName);
  7524. }
  7525. },
  7526. matchAtrulePrelude: function(atruleName, prelude) {
  7527. var error = this.checkAtrulePrelude(atruleName, prelude);
  7528. if (error) {
  7529. return buildMatchResult(null, error);
  7530. }
  7531. if (!prelude) {
  7532. return buildMatchResult(null, null);
  7533. }
  7534. return matchSyntax(this, this.getAtrule(atruleName).prelude, prelude, false);
  7535. },
  7536. matchAtruleDescriptor: function(atruleName, descriptorName, value) {
  7537. var error = this.checkAtruleDescriptorName(atruleName, descriptorName);
  7538. if (error) {
  7539. return buildMatchResult(null, error);
  7540. }
  7541. var atrule = this.getAtrule(atruleName);
  7542. var descriptor = names$1.keyword(descriptorName);
  7543. return matchSyntax(this, atrule.descriptors[descriptor.name] || atrule.descriptors[descriptor.basename], value, false);
  7544. },
  7545. matchDeclaration: function(node) {
  7546. if (node.type !== 'Declaration') {
  7547. return buildMatchResult(null, new Error('Not a Declaration node'));
  7548. }
  7549. return this.matchProperty(node.property, node.value);
  7550. },
  7551. matchProperty: function(propertyName, value) {
  7552. var error = this.checkPropertyName(propertyName);
  7553. if (error) {
  7554. return buildMatchResult(null, error);
  7555. }
  7556. return matchSyntax(this, this.getProperty(propertyName), value, true);
  7557. },
  7558. matchType: function(typeName, value) {
  7559. var typeSyntax = this.getType(typeName);
  7560. if (!typeSyntax) {
  7561. return buildMatchResult(null, new SyntaxReferenceError('Unknown type', typeName));
  7562. }
  7563. return matchSyntax(this, typeSyntax, value, false);
  7564. },
  7565. match: function(syntax, value) {
  7566. if (typeof syntax !== 'string' && (!syntax || !syntax.type)) {
  7567. return buildMatchResult(null, new SyntaxReferenceError('Bad syntax'));
  7568. }
  7569. if (typeof syntax === 'string' || !syntax.match) {
  7570. syntax = this.createDescriptor(syntax, 'Type', 'anonymous');
  7571. }
  7572. return matchSyntax(this, syntax, value, false);
  7573. },
  7574. findValueFragments: function(propertyName, value, type, name) {
  7575. return search.matchFragments(this, value, this.matchProperty(propertyName, value), type, name);
  7576. },
  7577. findDeclarationValueFragments: function(declaration, type, name) {
  7578. return search.matchFragments(this, declaration.value, this.matchDeclaration(declaration), type, name);
  7579. },
  7580. findAllFragments: function(ast, type, name) {
  7581. var result = [];
  7582. this.syntax.walk(ast, {
  7583. visit: 'Declaration',
  7584. enter: function(declaration) {
  7585. result.push.apply(result, this.findDeclarationValueFragments(declaration, type, name));
  7586. }.bind(this)
  7587. });
  7588. return result;
  7589. },
  7590. getAtrule: function(atruleName, fallbackBasename = true) {
  7591. var atrule = names$1.keyword(atruleName);
  7592. var atruleEntry = atrule.vendor && fallbackBasename
  7593. ? this.atrules[atrule.name] || this.atrules[atrule.basename]
  7594. : this.atrules[atrule.name];
  7595. return atruleEntry || null;
  7596. },
  7597. getAtrulePrelude: function(atruleName, fallbackBasename = true) {
  7598. const atrule = this.getAtrule(atruleName, fallbackBasename);
  7599. return atrule && atrule.prelude || null;
  7600. },
  7601. getAtruleDescriptor: function(atruleName, name) {
  7602. return this.atrules.hasOwnProperty(atruleName) && this.atrules.declarators
  7603. ? this.atrules[atruleName].declarators[name] || null
  7604. : null;
  7605. },
  7606. getProperty: function(propertyName, fallbackBasename = true) {
  7607. var property = names$1.property(propertyName);
  7608. var propertyEntry = property.vendor && fallbackBasename
  7609. ? this.properties[property.name] || this.properties[property.basename]
  7610. : this.properties[property.name];
  7611. return propertyEntry || null;
  7612. },
  7613. getType: function(name) {
  7614. return this.types.hasOwnProperty(name) ? this.types[name] : null;
  7615. },
  7616. validate: function() {
  7617. function validate(syntax, name, broken, descriptor) {
  7618. if (broken.hasOwnProperty(name)) {
  7619. return broken[name];
  7620. }
  7621. broken[name] = false;
  7622. if (descriptor.syntax !== null) {
  7623. walk(descriptor.syntax, function(node) {
  7624. if (node.type !== 'Type' && node.type !== 'Property') {
  7625. return;
  7626. }
  7627. var map = node.type === 'Type' ? syntax.types : syntax.properties;
  7628. var brokenMap = node.type === 'Type' ? brokenTypes : brokenProperties;
  7629. if (!map.hasOwnProperty(node.name) || validate(syntax, node.name, brokenMap, map[node.name])) {
  7630. broken[name] = true;
  7631. }
  7632. }, this);
  7633. }
  7634. }
  7635. var brokenTypes = {};
  7636. var brokenProperties = {};
  7637. for (var key in this.types) {
  7638. validate(this, key, brokenTypes, this.types[key]);
  7639. }
  7640. for (var key in this.properties) {
  7641. validate(this, key, brokenProperties, this.properties[key]);
  7642. }
  7643. brokenTypes = Object.keys(brokenTypes).filter(function(name) {
  7644. return brokenTypes[name];
  7645. });
  7646. brokenProperties = Object.keys(brokenProperties).filter(function(name) {
  7647. return brokenProperties[name];
  7648. });
  7649. if (brokenTypes.length || brokenProperties.length) {
  7650. return {
  7651. types: brokenTypes,
  7652. properties: brokenProperties
  7653. };
  7654. }
  7655. return null;
  7656. },
  7657. dump: function(syntaxAsAst, pretty) {
  7658. return {
  7659. generic: this.generic,
  7660. types: dumpMapSyntax(this.types, !pretty, syntaxAsAst),
  7661. properties: dumpMapSyntax(this.properties, !pretty, syntaxAsAst),
  7662. atrules: dumpAtruleMapSyntax(this.atrules, !pretty, syntaxAsAst)
  7663. };
  7664. },
  7665. toString: function() {
  7666. return JSON.stringify(this.dump());
  7667. }
  7668. };
  7669. var Lexer_1 = Lexer$1;
  7670. var definitionSyntax$1 = {
  7671. SyntaxError: _SyntaxError,
  7672. parse: parse_1,
  7673. generate: generate_1,
  7674. walk: walk$1
  7675. };
  7676. var adoptBuffer = adoptBuffer$2;
  7677. var isBOM = tokenizer$3.isBOM;
  7678. var N$1 = 10;
  7679. var F = 12;
  7680. var R = 13;
  7681. function computeLinesAndColumns(host, source) {
  7682. var sourceLength = source.length;
  7683. var lines = adoptBuffer(host.lines, sourceLength); // +1
  7684. var line = host.startLine;
  7685. var columns = adoptBuffer(host.columns, sourceLength);
  7686. var column = host.startColumn;
  7687. var startOffset = source.length > 0 ? isBOM(source.charCodeAt(0)) : 0;
  7688. for (var i = startOffset; i < sourceLength; i++) { // -1
  7689. var code = source.charCodeAt(i);
  7690. lines[i] = line;
  7691. columns[i] = column++;
  7692. if (code === N$1 || code === R || code === F) {
  7693. if (code === R && i + 1 < sourceLength && source.charCodeAt(i + 1) === N$1) {
  7694. i++;
  7695. lines[i] = line;
  7696. columns[i] = column;
  7697. }
  7698. line++;
  7699. column = 1;
  7700. }
  7701. }
  7702. lines[i] = line;
  7703. columns[i] = column;
  7704. host.lines = lines;
  7705. host.columns = columns;
  7706. }
  7707. var OffsetToLocation$1 = function() {
  7708. this.lines = null;
  7709. this.columns = null;
  7710. this.linesAndColumnsComputed = false;
  7711. };
  7712. OffsetToLocation$1.prototype = {
  7713. setSource: function(source, startOffset, startLine, startColumn) {
  7714. this.source = source;
  7715. this.startOffset = typeof startOffset === 'undefined' ? 0 : startOffset;
  7716. this.startLine = typeof startLine === 'undefined' ? 1 : startLine;
  7717. this.startColumn = typeof startColumn === 'undefined' ? 1 : startColumn;
  7718. this.linesAndColumnsComputed = false;
  7719. },
  7720. ensureLinesAndColumnsComputed: function() {
  7721. if (!this.linesAndColumnsComputed) {
  7722. computeLinesAndColumns(this, this.source);
  7723. this.linesAndColumnsComputed = true;
  7724. }
  7725. },
  7726. getLocation: function(offset, filename) {
  7727. this.ensureLinesAndColumnsComputed();
  7728. return {
  7729. source: filename,
  7730. offset: this.startOffset + offset,
  7731. line: this.lines[offset],
  7732. column: this.columns[offset]
  7733. };
  7734. },
  7735. getLocationRange: function(start, end, filename) {
  7736. this.ensureLinesAndColumnsComputed();
  7737. return {
  7738. source: filename,
  7739. start: {
  7740. offset: this.startOffset + start,
  7741. line: this.lines[start],
  7742. column: this.columns[start]
  7743. },
  7744. end: {
  7745. offset: this.startOffset + end,
  7746. line: this.lines[end],
  7747. column: this.columns[end]
  7748. }
  7749. };
  7750. }
  7751. };
  7752. var OffsetToLocation_1 = OffsetToLocation$1;
  7753. var TYPE$A = tokenizer$3.TYPE;
  7754. var WHITESPACE$a = TYPE$A.WhiteSpace;
  7755. var COMMENT$8 = TYPE$A.Comment;
  7756. var sequence$1 = function readSequence(recognizer) {
  7757. var children = this.createList();
  7758. var child = null;
  7759. var context = {
  7760. recognizer: recognizer,
  7761. space: null,
  7762. ignoreWS: false,
  7763. ignoreWSAfter: false
  7764. };
  7765. this.scanner.skipSC();
  7766. while (!this.scanner.eof) {
  7767. switch (this.scanner.tokenType) {
  7768. case COMMENT$8:
  7769. this.scanner.next();
  7770. continue;
  7771. case WHITESPACE$a:
  7772. if (context.ignoreWS) {
  7773. this.scanner.next();
  7774. } else {
  7775. context.space = this.WhiteSpace();
  7776. }
  7777. continue;
  7778. }
  7779. child = recognizer.getNode.call(this, context);
  7780. if (child === undefined) {
  7781. break;
  7782. }
  7783. if (context.space !== null) {
  7784. children.push(context.space);
  7785. context.space = null;
  7786. }
  7787. children.push(child);
  7788. if (context.ignoreWSAfter) {
  7789. context.ignoreWSAfter = false;
  7790. context.ignoreWS = true;
  7791. } else {
  7792. context.ignoreWS = false;
  7793. }
  7794. }
  7795. return children;
  7796. };
  7797. var OffsetToLocation = OffsetToLocation_1;
  7798. var SyntaxError$2 = _SyntaxError$1;
  7799. var TokenStream$1 = TokenStream_1;
  7800. var List$3 = List_1;
  7801. var tokenize$1 = tokenizer$3;
  7802. var constants = _const;
  7803. var { findWhiteSpaceStart, cmpStr: cmpStr$2 } = utils$2;
  7804. var sequence = sequence$1;
  7805. var noop$1 = function() {};
  7806. var TYPE$z = constants.TYPE;
  7807. var NAME$1 = constants.NAME;
  7808. var WHITESPACE$9 = TYPE$z.WhiteSpace;
  7809. var COMMENT$7 = TYPE$z.Comment;
  7810. var IDENT$g = TYPE$z.Ident;
  7811. var FUNCTION$6 = TYPE$z.Function;
  7812. var URL$4 = TYPE$z.Url;
  7813. var HASH$5 = TYPE$z.Hash;
  7814. var PERCENTAGE$3 = TYPE$z.Percentage;
  7815. var NUMBER$7 = TYPE$z.Number;
  7816. var NUMBERSIGN$3 = 0x0023; // U+0023 NUMBER SIGN (#)
  7817. var NULL = 0;
  7818. function createParseContext(name) {
  7819. return function() {
  7820. return this[name]();
  7821. };
  7822. }
  7823. function processConfig(config) {
  7824. var parserConfig = {
  7825. context: {},
  7826. scope: {},
  7827. atrule: {},
  7828. pseudo: {}
  7829. };
  7830. if (config.parseContext) {
  7831. for (var name in config.parseContext) {
  7832. switch (typeof config.parseContext[name]) {
  7833. case 'function':
  7834. parserConfig.context[name] = config.parseContext[name];
  7835. break;
  7836. case 'string':
  7837. parserConfig.context[name] = createParseContext(config.parseContext[name]);
  7838. break;
  7839. }
  7840. }
  7841. }
  7842. if (config.scope) {
  7843. for (var name in config.scope) {
  7844. parserConfig.scope[name] = config.scope[name];
  7845. }
  7846. }
  7847. if (config.atrule) {
  7848. for (var name in config.atrule) {
  7849. var atrule = config.atrule[name];
  7850. if (atrule.parse) {
  7851. parserConfig.atrule[name] = atrule.parse;
  7852. }
  7853. }
  7854. }
  7855. if (config.pseudo) {
  7856. for (var name in config.pseudo) {
  7857. var pseudo = config.pseudo[name];
  7858. if (pseudo.parse) {
  7859. parserConfig.pseudo[name] = pseudo.parse;
  7860. }
  7861. }
  7862. }
  7863. if (config.node) {
  7864. for (var name in config.node) {
  7865. parserConfig[name] = config.node[name].parse;
  7866. }
  7867. }
  7868. return parserConfig;
  7869. }
  7870. var create$3 = function createParser(config) {
  7871. var parser = {
  7872. scanner: new TokenStream$1(),
  7873. locationMap: new OffsetToLocation(),
  7874. filename: '<unknown>',
  7875. needPositions: false,
  7876. onParseError: noop$1,
  7877. onParseErrorThrow: false,
  7878. parseAtrulePrelude: true,
  7879. parseRulePrelude: true,
  7880. parseValue: true,
  7881. parseCustomProperty: false,
  7882. readSequence: sequence,
  7883. createList: function() {
  7884. return new List$3();
  7885. },
  7886. createSingleNodeList: function(node) {
  7887. return new List$3().appendData(node);
  7888. },
  7889. getFirstListNode: function(list) {
  7890. return list && list.first();
  7891. },
  7892. getLastListNode: function(list) {
  7893. return list.last();
  7894. },
  7895. parseWithFallback: function(consumer, fallback) {
  7896. var startToken = this.scanner.tokenIndex;
  7897. try {
  7898. return consumer.call(this);
  7899. } catch (e) {
  7900. if (this.onParseErrorThrow) {
  7901. throw e;
  7902. }
  7903. var fallbackNode = fallback.call(this, startToken);
  7904. this.onParseErrorThrow = true;
  7905. this.onParseError(e, fallbackNode);
  7906. this.onParseErrorThrow = false;
  7907. return fallbackNode;
  7908. }
  7909. },
  7910. lookupNonWSType: function(offset) {
  7911. do {
  7912. var type = this.scanner.lookupType(offset++);
  7913. if (type !== WHITESPACE$9) {
  7914. return type;
  7915. }
  7916. } while (type !== NULL);
  7917. return NULL;
  7918. },
  7919. eat: function(tokenType) {
  7920. if (this.scanner.tokenType !== tokenType) {
  7921. var offset = this.scanner.tokenStart;
  7922. var message = NAME$1[tokenType] + ' is expected';
  7923. // tweak message and offset
  7924. switch (tokenType) {
  7925. case IDENT$g:
  7926. // when identifier is expected but there is a function or url
  7927. if (this.scanner.tokenType === FUNCTION$6 || this.scanner.tokenType === URL$4) {
  7928. offset = this.scanner.tokenEnd - 1;
  7929. message = 'Identifier is expected but function found';
  7930. } else {
  7931. message = 'Identifier is expected';
  7932. }
  7933. break;
  7934. case HASH$5:
  7935. if (this.scanner.isDelim(NUMBERSIGN$3)) {
  7936. this.scanner.next();
  7937. offset++;
  7938. message = 'Name is expected';
  7939. }
  7940. break;
  7941. case PERCENTAGE$3:
  7942. if (this.scanner.tokenType === NUMBER$7) {
  7943. offset = this.scanner.tokenEnd;
  7944. message = 'Percent sign is expected';
  7945. }
  7946. break;
  7947. default:
  7948. // when test type is part of another token show error for current position + 1
  7949. // e.g. eat(HYPHENMINUS) will fail on "-foo", but pointing on "-" is odd
  7950. if (this.scanner.source.charCodeAt(this.scanner.tokenStart) === tokenType) {
  7951. offset = offset + 1;
  7952. }
  7953. }
  7954. this.error(message, offset);
  7955. }
  7956. this.scanner.next();
  7957. },
  7958. consume: function(tokenType) {
  7959. var value = this.scanner.getTokenValue();
  7960. this.eat(tokenType);
  7961. return value;
  7962. },
  7963. consumeFunctionName: function() {
  7964. var name = this.scanner.source.substring(this.scanner.tokenStart, this.scanner.tokenEnd - 1);
  7965. this.eat(FUNCTION$6);
  7966. return name;
  7967. },
  7968. getLocation: function(start, end) {
  7969. if (this.needPositions) {
  7970. return this.locationMap.getLocationRange(
  7971. start,
  7972. end,
  7973. this.filename
  7974. );
  7975. }
  7976. return null;
  7977. },
  7978. getLocationFromList: function(list) {
  7979. if (this.needPositions) {
  7980. var head = this.getFirstListNode(list);
  7981. var tail = this.getLastListNode(list);
  7982. return this.locationMap.getLocationRange(
  7983. head !== null ? head.loc.start.offset - this.locationMap.startOffset : this.scanner.tokenStart,
  7984. tail !== null ? tail.loc.end.offset - this.locationMap.startOffset : this.scanner.tokenStart,
  7985. this.filename
  7986. );
  7987. }
  7988. return null;
  7989. },
  7990. error: function(message, offset) {
  7991. var location = typeof offset !== 'undefined' && offset < this.scanner.source.length
  7992. ? this.locationMap.getLocation(offset)
  7993. : this.scanner.eof
  7994. ? this.locationMap.getLocation(findWhiteSpaceStart(this.scanner.source, this.scanner.source.length - 1))
  7995. : this.locationMap.getLocation(this.scanner.tokenStart);
  7996. throw new SyntaxError$2(
  7997. message || 'Unexpected input',
  7998. this.scanner.source,
  7999. location.offset,
  8000. location.line,
  8001. location.column
  8002. );
  8003. }
  8004. };
  8005. config = processConfig(config || {});
  8006. for (var key in config) {
  8007. parser[key] = config[key];
  8008. }
  8009. return function(source, options) {
  8010. options = options || {};
  8011. var context = options.context || 'default';
  8012. var onComment = options.onComment;
  8013. var ast;
  8014. tokenize$1(source, parser.scanner);
  8015. parser.locationMap.setSource(
  8016. source,
  8017. options.offset,
  8018. options.line,
  8019. options.column
  8020. );
  8021. parser.filename = options.filename || '<unknown>';
  8022. parser.needPositions = Boolean(options.positions);
  8023. parser.onParseError = typeof options.onParseError === 'function' ? options.onParseError : noop$1;
  8024. parser.onParseErrorThrow = false;
  8025. parser.parseAtrulePrelude = 'parseAtrulePrelude' in options ? Boolean(options.parseAtrulePrelude) : true;
  8026. parser.parseRulePrelude = 'parseRulePrelude' in options ? Boolean(options.parseRulePrelude) : true;
  8027. parser.parseValue = 'parseValue' in options ? Boolean(options.parseValue) : true;
  8028. parser.parseCustomProperty = 'parseCustomProperty' in options ? Boolean(options.parseCustomProperty) : false;
  8029. if (!parser.context.hasOwnProperty(context)) {
  8030. throw new Error('Unknown context `' + context + '`');
  8031. }
  8032. if (typeof onComment === 'function') {
  8033. parser.scanner.forEachToken((type, start, end) => {
  8034. if (type === COMMENT$7) {
  8035. const loc = parser.getLocation(start, end);
  8036. const value = cmpStr$2(source, end - 2, end, '*/')
  8037. ? source.slice(start + 2, end - 2)
  8038. : source.slice(start + 2, end);
  8039. onComment(value, loc);
  8040. }
  8041. });
  8042. }
  8043. ast = parser.context[context].call(parser, options);
  8044. if (!parser.scanner.eof) {
  8045. parser.error();
  8046. }
  8047. return ast;
  8048. };
  8049. };
  8050. var sourceMapGenerator = {};
  8051. var base64Vlq = {};
  8052. var base64$1 = {};
  8053. /* -*- Mode: js; js-indent-level: 2; -*- */
  8054. /*
  8055. * Copyright 2011 Mozilla Foundation and contributors
  8056. * Licensed under the New BSD license. See LICENSE or:
  8057. * http://opensource.org/licenses/BSD-3-Clause
  8058. */
  8059. var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
  8060. /**
  8061. * Encode an integer in the range of 0 to 63 to a single base 64 digit.
  8062. */
  8063. base64$1.encode = function (number) {
  8064. if (0 <= number && number < intToCharMap.length) {
  8065. return intToCharMap[number];
  8066. }
  8067. throw new TypeError("Must be between 0 and 63: " + number);
  8068. };
  8069. /**
  8070. * Decode a single base 64 character code digit to an integer. Returns -1 on
  8071. * failure.
  8072. */
  8073. base64$1.decode = function (charCode) {
  8074. var bigA = 65; // 'A'
  8075. var bigZ = 90; // 'Z'
  8076. var littleA = 97; // 'a'
  8077. var littleZ = 122; // 'z'
  8078. var zero = 48; // '0'
  8079. var nine = 57; // '9'
  8080. var plus = 43; // '+'
  8081. var slash = 47; // '/'
  8082. var littleOffset = 26;
  8083. var numberOffset = 52;
  8084. // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  8085. if (bigA <= charCode && charCode <= bigZ) {
  8086. return (charCode - bigA);
  8087. }
  8088. // 26 - 51: abcdefghijklmnopqrstuvwxyz
  8089. if (littleA <= charCode && charCode <= littleZ) {
  8090. return (charCode - littleA + littleOffset);
  8091. }
  8092. // 52 - 61: 0123456789
  8093. if (zero <= charCode && charCode <= nine) {
  8094. return (charCode - zero + numberOffset);
  8095. }
  8096. // 62: +
  8097. if (charCode == plus) {
  8098. return 62;
  8099. }
  8100. // 63: /
  8101. if (charCode == slash) {
  8102. return 63;
  8103. }
  8104. // Invalid base64 digit.
  8105. return -1;
  8106. };
  8107. /* -*- Mode: js; js-indent-level: 2; -*- */
  8108. /*
  8109. * Copyright 2011 Mozilla Foundation and contributors
  8110. * Licensed under the New BSD license. See LICENSE or:
  8111. * http://opensource.org/licenses/BSD-3-Clause
  8112. *
  8113. * Based on the Base 64 VLQ implementation in Closure Compiler:
  8114. * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
  8115. *
  8116. * Copyright 2011 The Closure Compiler Authors. All rights reserved.
  8117. * Redistribution and use in source and binary forms, with or without
  8118. * modification, are permitted provided that the following conditions are
  8119. * met:
  8120. *
  8121. * * Redistributions of source code must retain the above copyright
  8122. * notice, this list of conditions and the following disclaimer.
  8123. * * Redistributions in binary form must reproduce the above
  8124. * copyright notice, this list of conditions and the following
  8125. * disclaimer in the documentation and/or other materials provided
  8126. * with the distribution.
  8127. * * Neither the name of Google Inc. nor the names of its
  8128. * contributors may be used to endorse or promote products derived
  8129. * from this software without specific prior written permission.
  8130. *
  8131. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  8132. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  8133. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  8134. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  8135. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  8136. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  8137. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  8138. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  8139. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  8140. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  8141. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  8142. */
  8143. var base64 = base64$1;
  8144. // A single base 64 digit can contain 6 bits of data. For the base 64 variable
  8145. // length quantities we use in the source map spec, the first bit is the sign,
  8146. // the next four bits are the actual value, and the 6th bit is the
  8147. // continuation bit. The continuation bit tells us whether there are more
  8148. // digits in this value following this digit.
  8149. //
  8150. // Continuation
  8151. // | Sign
  8152. // | |
  8153. // V V
  8154. // 101011
  8155. var VLQ_BASE_SHIFT = 5;
  8156. // binary: 100000
  8157. var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
  8158. // binary: 011111
  8159. var VLQ_BASE_MASK = VLQ_BASE - 1;
  8160. // binary: 100000
  8161. var VLQ_CONTINUATION_BIT = VLQ_BASE;
  8162. /**
  8163. * Converts from a two-complement value to a value where the sign bit is
  8164. * placed in the least significant bit. For example, as decimals:
  8165. * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
  8166. * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
  8167. */
  8168. function toVLQSigned(aValue) {
  8169. return aValue < 0
  8170. ? ((-aValue) << 1) + 1
  8171. : (aValue << 1) + 0;
  8172. }
  8173. /**
  8174. * Converts to a two-complement value from a value where the sign bit is
  8175. * placed in the least significant bit. For example, as decimals:
  8176. * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
  8177. * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
  8178. */
  8179. function fromVLQSigned(aValue) {
  8180. var isNegative = (aValue & 1) === 1;
  8181. var shifted = aValue >> 1;
  8182. return isNegative
  8183. ? -shifted
  8184. : shifted;
  8185. }
  8186. /**
  8187. * Returns the base 64 VLQ encoded value.
  8188. */
  8189. base64Vlq.encode = function base64VLQ_encode(aValue) {
  8190. var encoded = "";
  8191. var digit;
  8192. var vlq = toVLQSigned(aValue);
  8193. do {
  8194. digit = vlq & VLQ_BASE_MASK;
  8195. vlq >>>= VLQ_BASE_SHIFT;
  8196. if (vlq > 0) {
  8197. // There are still more digits in this value, so we must make sure the
  8198. // continuation bit is marked.
  8199. digit |= VLQ_CONTINUATION_BIT;
  8200. }
  8201. encoded += base64.encode(digit);
  8202. } while (vlq > 0);
  8203. return encoded;
  8204. };
  8205. /**
  8206. * Decodes the next base 64 VLQ value from the given string and returns the
  8207. * value and the rest of the string via the out parameter.
  8208. */
  8209. base64Vlq.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
  8210. var strLen = aStr.length;
  8211. var result = 0;
  8212. var shift = 0;
  8213. var continuation, digit;
  8214. do {
  8215. if (aIndex >= strLen) {
  8216. throw new Error("Expected more digits in base 64 VLQ value.");
  8217. }
  8218. digit = base64.decode(aStr.charCodeAt(aIndex++));
  8219. if (digit === -1) {
  8220. throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
  8221. }
  8222. continuation = !!(digit & VLQ_CONTINUATION_BIT);
  8223. digit &= VLQ_BASE_MASK;
  8224. result = result + (digit << shift);
  8225. shift += VLQ_BASE_SHIFT;
  8226. } while (continuation);
  8227. aOutParam.value = fromVLQSigned(result);
  8228. aOutParam.rest = aIndex;
  8229. };
  8230. var util$3 = {};
  8231. /* -*- Mode: js; js-indent-level: 2; -*- */
  8232. (function (exports) {
  8233. /*
  8234. * Copyright 2011 Mozilla Foundation and contributors
  8235. * Licensed under the New BSD license. See LICENSE or:
  8236. * http://opensource.org/licenses/BSD-3-Clause
  8237. */
  8238. /**
  8239. * This is a helper function for getting values from parameter/options
  8240. * objects.
  8241. *
  8242. * @param args The object we are extracting values from
  8243. * @param name The name of the property we are getting.
  8244. * @param defaultValue An optional value to return if the property is missing
  8245. * from the object. If this is not specified and the property is missing, an
  8246. * error will be thrown.
  8247. */
  8248. function getArg(aArgs, aName, aDefaultValue) {
  8249. if (aName in aArgs) {
  8250. return aArgs[aName];
  8251. } else if (arguments.length === 3) {
  8252. return aDefaultValue;
  8253. } else {
  8254. throw new Error('"' + aName + '" is a required argument.');
  8255. }
  8256. }
  8257. exports.getArg = getArg;
  8258. var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
  8259. var dataUrlRegexp = /^data:.+\,.+$/;
  8260. function urlParse(aUrl) {
  8261. var match = aUrl.match(urlRegexp);
  8262. if (!match) {
  8263. return null;
  8264. }
  8265. return {
  8266. scheme: match[1],
  8267. auth: match[2],
  8268. host: match[3],
  8269. port: match[4],
  8270. path: match[5]
  8271. };
  8272. }
  8273. exports.urlParse = urlParse;
  8274. function urlGenerate(aParsedUrl) {
  8275. var url = '';
  8276. if (aParsedUrl.scheme) {
  8277. url += aParsedUrl.scheme + ':';
  8278. }
  8279. url += '//';
  8280. if (aParsedUrl.auth) {
  8281. url += aParsedUrl.auth + '@';
  8282. }
  8283. if (aParsedUrl.host) {
  8284. url += aParsedUrl.host;
  8285. }
  8286. if (aParsedUrl.port) {
  8287. url += ":" + aParsedUrl.port;
  8288. }
  8289. if (aParsedUrl.path) {
  8290. url += aParsedUrl.path;
  8291. }
  8292. return url;
  8293. }
  8294. exports.urlGenerate = urlGenerate;
  8295. /**
  8296. * Normalizes a path, or the path portion of a URL:
  8297. *
  8298. * - Replaces consecutive slashes with one slash.
  8299. * - Removes unnecessary '.' parts.
  8300. * - Removes unnecessary '<dir>/..' parts.
  8301. *
  8302. * Based on code in the Node.js 'path' core module.
  8303. *
  8304. * @param aPath The path or url to normalize.
  8305. */
  8306. function normalize(aPath) {
  8307. var path = aPath;
  8308. var url = urlParse(aPath);
  8309. if (url) {
  8310. if (!url.path) {
  8311. return aPath;
  8312. }
  8313. path = url.path;
  8314. }
  8315. var isAbsolute = exports.isAbsolute(path);
  8316. var parts = path.split(/\/+/);
  8317. for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
  8318. part = parts[i];
  8319. if (part === '.') {
  8320. parts.splice(i, 1);
  8321. } else if (part === '..') {
  8322. up++;
  8323. } else if (up > 0) {
  8324. if (part === '') {
  8325. // The first part is blank if the path is absolute. Trying to go
  8326. // above the root is a no-op. Therefore we can remove all '..' parts
  8327. // directly after the root.
  8328. parts.splice(i + 1, up);
  8329. up = 0;
  8330. } else {
  8331. parts.splice(i, 2);
  8332. up--;
  8333. }
  8334. }
  8335. }
  8336. path = parts.join('/');
  8337. if (path === '') {
  8338. path = isAbsolute ? '/' : '.';
  8339. }
  8340. if (url) {
  8341. url.path = path;
  8342. return urlGenerate(url);
  8343. }
  8344. return path;
  8345. }
  8346. exports.normalize = normalize;
  8347. /**
  8348. * Joins two paths/URLs.
  8349. *
  8350. * @param aRoot The root path or URL.
  8351. * @param aPath The path or URL to be joined with the root.
  8352. *
  8353. * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
  8354. * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
  8355. * first.
  8356. * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
  8357. * is updated with the result and aRoot is returned. Otherwise the result
  8358. * is returned.
  8359. * - If aPath is absolute, the result is aPath.
  8360. * - Otherwise the two paths are joined with a slash.
  8361. * - Joining for example 'http://' and 'www.example.com' is also supported.
  8362. */
  8363. function join(aRoot, aPath) {
  8364. if (aRoot === "") {
  8365. aRoot = ".";
  8366. }
  8367. if (aPath === "") {
  8368. aPath = ".";
  8369. }
  8370. var aPathUrl = urlParse(aPath);
  8371. var aRootUrl = urlParse(aRoot);
  8372. if (aRootUrl) {
  8373. aRoot = aRootUrl.path || '/';
  8374. }
  8375. // `join(foo, '//www.example.org')`
  8376. if (aPathUrl && !aPathUrl.scheme) {
  8377. if (aRootUrl) {
  8378. aPathUrl.scheme = aRootUrl.scheme;
  8379. }
  8380. return urlGenerate(aPathUrl);
  8381. }
  8382. if (aPathUrl || aPath.match(dataUrlRegexp)) {
  8383. return aPath;
  8384. }
  8385. // `join('http://', 'www.example.com')`
  8386. if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
  8387. aRootUrl.host = aPath;
  8388. return urlGenerate(aRootUrl);
  8389. }
  8390. var joined = aPath.charAt(0) === '/'
  8391. ? aPath
  8392. : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
  8393. if (aRootUrl) {
  8394. aRootUrl.path = joined;
  8395. return urlGenerate(aRootUrl);
  8396. }
  8397. return joined;
  8398. }
  8399. exports.join = join;
  8400. exports.isAbsolute = function (aPath) {
  8401. return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
  8402. };
  8403. /**
  8404. * Make a path relative to a URL or another path.
  8405. *
  8406. * @param aRoot The root path or URL.
  8407. * @param aPath The path or URL to be made relative to aRoot.
  8408. */
  8409. function relative(aRoot, aPath) {
  8410. if (aRoot === "") {
  8411. aRoot = ".";
  8412. }
  8413. aRoot = aRoot.replace(/\/$/, '');
  8414. // It is possible for the path to be above the root. In this case, simply
  8415. // checking whether the root is a prefix of the path won't work. Instead, we
  8416. // need to remove components from the root one by one, until either we find
  8417. // a prefix that fits, or we run out of components to remove.
  8418. var level = 0;
  8419. while (aPath.indexOf(aRoot + '/') !== 0) {
  8420. var index = aRoot.lastIndexOf("/");
  8421. if (index < 0) {
  8422. return aPath;
  8423. }
  8424. // If the only part of the root that is left is the scheme (i.e. http://,
  8425. // file:///, etc.), one or more slashes (/), or simply nothing at all, we
  8426. // have exhausted all components, so the path is not relative to the root.
  8427. aRoot = aRoot.slice(0, index);
  8428. if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
  8429. return aPath;
  8430. }
  8431. ++level;
  8432. }
  8433. // Make sure we add a "../" for each component we removed from the root.
  8434. return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
  8435. }
  8436. exports.relative = relative;
  8437. var supportsNullProto = (function () {
  8438. var obj = Object.create(null);
  8439. return !('__proto__' in obj);
  8440. }());
  8441. function identity (s) {
  8442. return s;
  8443. }
  8444. /**
  8445. * Because behavior goes wacky when you set `__proto__` on objects, we
  8446. * have to prefix all the strings in our set with an arbitrary character.
  8447. *
  8448. * See https://github.com/mozilla/source-map/pull/31 and
  8449. * https://github.com/mozilla/source-map/issues/30
  8450. *
  8451. * @param String aStr
  8452. */
  8453. function toSetString(aStr) {
  8454. if (isProtoString(aStr)) {
  8455. return '$' + aStr;
  8456. }
  8457. return aStr;
  8458. }
  8459. exports.toSetString = supportsNullProto ? identity : toSetString;
  8460. function fromSetString(aStr) {
  8461. if (isProtoString(aStr)) {
  8462. return aStr.slice(1);
  8463. }
  8464. return aStr;
  8465. }
  8466. exports.fromSetString = supportsNullProto ? identity : fromSetString;
  8467. function isProtoString(s) {
  8468. if (!s) {
  8469. return false;
  8470. }
  8471. var length = s.length;
  8472. if (length < 9 /* "__proto__".length */) {
  8473. return false;
  8474. }
  8475. if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
  8476. s.charCodeAt(length - 2) !== 95 /* '_' */ ||
  8477. s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
  8478. s.charCodeAt(length - 4) !== 116 /* 't' */ ||
  8479. s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
  8480. s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
  8481. s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
  8482. s.charCodeAt(length - 8) !== 95 /* '_' */ ||
  8483. s.charCodeAt(length - 9) !== 95 /* '_' */) {
  8484. return false;
  8485. }
  8486. for (var i = length - 10; i >= 0; i--) {
  8487. if (s.charCodeAt(i) !== 36 /* '$' */) {
  8488. return false;
  8489. }
  8490. }
  8491. return true;
  8492. }
  8493. /**
  8494. * Comparator between two mappings where the original positions are compared.
  8495. *
  8496. * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  8497. * mappings with the same original source/line/column, but different generated
  8498. * line and column the same. Useful when searching for a mapping with a
  8499. * stubbed out mapping.
  8500. */
  8501. function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
  8502. var cmp = strcmp(mappingA.source, mappingB.source);
  8503. if (cmp !== 0) {
  8504. return cmp;
  8505. }
  8506. cmp = mappingA.originalLine - mappingB.originalLine;
  8507. if (cmp !== 0) {
  8508. return cmp;
  8509. }
  8510. cmp = mappingA.originalColumn - mappingB.originalColumn;
  8511. if (cmp !== 0 || onlyCompareOriginal) {
  8512. return cmp;
  8513. }
  8514. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  8515. if (cmp !== 0) {
  8516. return cmp;
  8517. }
  8518. cmp = mappingA.generatedLine - mappingB.generatedLine;
  8519. if (cmp !== 0) {
  8520. return cmp;
  8521. }
  8522. return strcmp(mappingA.name, mappingB.name);
  8523. }
  8524. exports.compareByOriginalPositions = compareByOriginalPositions;
  8525. /**
  8526. * Comparator between two mappings with deflated source and name indices where
  8527. * the generated positions are compared.
  8528. *
  8529. * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  8530. * mappings with the same generated line and column, but different
  8531. * source/name/original line and column the same. Useful when searching for a
  8532. * mapping with a stubbed out mapping.
  8533. */
  8534. function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
  8535. var cmp = mappingA.generatedLine - mappingB.generatedLine;
  8536. if (cmp !== 0) {
  8537. return cmp;
  8538. }
  8539. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  8540. if (cmp !== 0 || onlyCompareGenerated) {
  8541. return cmp;
  8542. }
  8543. cmp = strcmp(mappingA.source, mappingB.source);
  8544. if (cmp !== 0) {
  8545. return cmp;
  8546. }
  8547. cmp = mappingA.originalLine - mappingB.originalLine;
  8548. if (cmp !== 0) {
  8549. return cmp;
  8550. }
  8551. cmp = mappingA.originalColumn - mappingB.originalColumn;
  8552. if (cmp !== 0) {
  8553. return cmp;
  8554. }
  8555. return strcmp(mappingA.name, mappingB.name);
  8556. }
  8557. exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
  8558. function strcmp(aStr1, aStr2) {
  8559. if (aStr1 === aStr2) {
  8560. return 0;
  8561. }
  8562. if (aStr1 === null) {
  8563. return 1; // aStr2 !== null
  8564. }
  8565. if (aStr2 === null) {
  8566. return -1; // aStr1 !== null
  8567. }
  8568. if (aStr1 > aStr2) {
  8569. return 1;
  8570. }
  8571. return -1;
  8572. }
  8573. /**
  8574. * Comparator between two mappings with inflated source and name strings where
  8575. * the generated positions are compared.
  8576. */
  8577. function compareByGeneratedPositionsInflated(mappingA, mappingB) {
  8578. var cmp = mappingA.generatedLine - mappingB.generatedLine;
  8579. if (cmp !== 0) {
  8580. return cmp;
  8581. }
  8582. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  8583. if (cmp !== 0) {
  8584. return cmp;
  8585. }
  8586. cmp = strcmp(mappingA.source, mappingB.source);
  8587. if (cmp !== 0) {
  8588. return cmp;
  8589. }
  8590. cmp = mappingA.originalLine - mappingB.originalLine;
  8591. if (cmp !== 0) {
  8592. return cmp;
  8593. }
  8594. cmp = mappingA.originalColumn - mappingB.originalColumn;
  8595. if (cmp !== 0) {
  8596. return cmp;
  8597. }
  8598. return strcmp(mappingA.name, mappingB.name);
  8599. }
  8600. exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
  8601. /**
  8602. * Strip any JSON XSSI avoidance prefix from the string (as documented
  8603. * in the source maps specification), and then parse the string as
  8604. * JSON.
  8605. */
  8606. function parseSourceMapInput(str) {
  8607. return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
  8608. }
  8609. exports.parseSourceMapInput = parseSourceMapInput;
  8610. /**
  8611. * Compute the URL of a source given the the source root, the source's
  8612. * URL, and the source map's URL.
  8613. */
  8614. function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
  8615. sourceURL = sourceURL || '';
  8616. if (sourceRoot) {
  8617. // This follows what Chrome does.
  8618. if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
  8619. sourceRoot += '/';
  8620. }
  8621. // The spec says:
  8622. // Line 4: An optional source root, useful for relocating source
  8623. // files on a server or removing repeated values in the
  8624. // “sources” entry. This value is prepended to the individual
  8625. // entries in the “source” field.
  8626. sourceURL = sourceRoot + sourceURL;
  8627. }
  8628. // Historically, SourceMapConsumer did not take the sourceMapURL as
  8629. // a parameter. This mode is still somewhat supported, which is why
  8630. // this code block is conditional. However, it's preferable to pass
  8631. // the source map URL to SourceMapConsumer, so that this function
  8632. // can implement the source URL resolution algorithm as outlined in
  8633. // the spec. This block is basically the equivalent of:
  8634. // new URL(sourceURL, sourceMapURL).toString()
  8635. // ... except it avoids using URL, which wasn't available in the
  8636. // older releases of node still supported by this library.
  8637. //
  8638. // The spec says:
  8639. // If the sources are not absolute URLs after prepending of the
  8640. // “sourceRoot”, the sources are resolved relative to the
  8641. // SourceMap (like resolving script src in a html document).
  8642. if (sourceMapURL) {
  8643. var parsed = urlParse(sourceMapURL);
  8644. if (!parsed) {
  8645. throw new Error("sourceMapURL could not be parsed");
  8646. }
  8647. if (parsed.path) {
  8648. // Strip the last path component, but keep the "/".
  8649. var index = parsed.path.lastIndexOf('/');
  8650. if (index >= 0) {
  8651. parsed.path = parsed.path.substring(0, index + 1);
  8652. }
  8653. }
  8654. sourceURL = join(urlGenerate(parsed), sourceURL);
  8655. }
  8656. return normalize(sourceURL);
  8657. }
  8658. exports.computeSourceURL = computeSourceURL;
  8659. } (util$3));
  8660. var arraySet = {};
  8661. /* -*- Mode: js; js-indent-level: 2; -*- */
  8662. /*
  8663. * Copyright 2011 Mozilla Foundation and contributors
  8664. * Licensed under the New BSD license. See LICENSE or:
  8665. * http://opensource.org/licenses/BSD-3-Clause
  8666. */
  8667. var util$2 = util$3;
  8668. var has$1 = Object.prototype.hasOwnProperty;
  8669. var hasNativeMap = typeof Map !== "undefined";
  8670. /**
  8671. * A data structure which is a combination of an array and a set. Adding a new
  8672. * member is O(1), testing for membership is O(1), and finding the index of an
  8673. * element is O(1). Removing elements from the set is not supported. Only
  8674. * strings are supported for membership.
  8675. */
  8676. function ArraySet$1() {
  8677. this._array = [];
  8678. this._set = hasNativeMap ? new Map() : Object.create(null);
  8679. }
  8680. /**
  8681. * Static method for creating ArraySet instances from an existing array.
  8682. */
  8683. ArraySet$1.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
  8684. var set = new ArraySet$1();
  8685. for (var i = 0, len = aArray.length; i < len; i++) {
  8686. set.add(aArray[i], aAllowDuplicates);
  8687. }
  8688. return set;
  8689. };
  8690. /**
  8691. * Return how many unique items are in this ArraySet. If duplicates have been
  8692. * added, than those do not count towards the size.
  8693. *
  8694. * @returns Number
  8695. */
  8696. ArraySet$1.prototype.size = function ArraySet_size() {
  8697. return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
  8698. };
  8699. /**
  8700. * Add the given string to this set.
  8701. *
  8702. * @param String aStr
  8703. */
  8704. ArraySet$1.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
  8705. var sStr = hasNativeMap ? aStr : util$2.toSetString(aStr);
  8706. var isDuplicate = hasNativeMap ? this.has(aStr) : has$1.call(this._set, sStr);
  8707. var idx = this._array.length;
  8708. if (!isDuplicate || aAllowDuplicates) {
  8709. this._array.push(aStr);
  8710. }
  8711. if (!isDuplicate) {
  8712. if (hasNativeMap) {
  8713. this._set.set(aStr, idx);
  8714. } else {
  8715. this._set[sStr] = idx;
  8716. }
  8717. }
  8718. };
  8719. /**
  8720. * Is the given string a member of this set?
  8721. *
  8722. * @param String aStr
  8723. */
  8724. ArraySet$1.prototype.has = function ArraySet_has(aStr) {
  8725. if (hasNativeMap) {
  8726. return this._set.has(aStr);
  8727. } else {
  8728. var sStr = util$2.toSetString(aStr);
  8729. return has$1.call(this._set, sStr);
  8730. }
  8731. };
  8732. /**
  8733. * What is the index of the given string in the array?
  8734. *
  8735. * @param String aStr
  8736. */
  8737. ArraySet$1.prototype.indexOf = function ArraySet_indexOf(aStr) {
  8738. if (hasNativeMap) {
  8739. var idx = this._set.get(aStr);
  8740. if (idx >= 0) {
  8741. return idx;
  8742. }
  8743. } else {
  8744. var sStr = util$2.toSetString(aStr);
  8745. if (has$1.call(this._set, sStr)) {
  8746. return this._set[sStr];
  8747. }
  8748. }
  8749. throw new Error('"' + aStr + '" is not in the set.');
  8750. };
  8751. /**
  8752. * What is the element at the given index?
  8753. *
  8754. * @param Number aIdx
  8755. */
  8756. ArraySet$1.prototype.at = function ArraySet_at(aIdx) {
  8757. if (aIdx >= 0 && aIdx < this._array.length) {
  8758. return this._array[aIdx];
  8759. }
  8760. throw new Error('No element indexed by ' + aIdx);
  8761. };
  8762. /**
  8763. * Returns the array representation of this set (which has the proper indices
  8764. * indicated by indexOf). Note that this is a copy of the internal array used
  8765. * for storing the members so that no one can mess with internal state.
  8766. */
  8767. ArraySet$1.prototype.toArray = function ArraySet_toArray() {
  8768. return this._array.slice();
  8769. };
  8770. arraySet.ArraySet = ArraySet$1;
  8771. var mappingList = {};
  8772. /* -*- Mode: js; js-indent-level: 2; -*- */
  8773. /*
  8774. * Copyright 2014 Mozilla Foundation and contributors
  8775. * Licensed under the New BSD license. See LICENSE or:
  8776. * http://opensource.org/licenses/BSD-3-Clause
  8777. */
  8778. var util$1 = util$3;
  8779. /**
  8780. * Determine whether mappingB is after mappingA with respect to generated
  8781. * position.
  8782. */
  8783. function generatedPositionAfter(mappingA, mappingB) {
  8784. // Optimized for most common case
  8785. var lineA = mappingA.generatedLine;
  8786. var lineB = mappingB.generatedLine;
  8787. var columnA = mappingA.generatedColumn;
  8788. var columnB = mappingB.generatedColumn;
  8789. return lineB > lineA || lineB == lineA && columnB >= columnA ||
  8790. util$1.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
  8791. }
  8792. /**
  8793. * A data structure to provide a sorted view of accumulated mappings in a
  8794. * performance conscious manner. It trades a neglibable overhead in general
  8795. * case for a large speedup in case of mappings being added in order.
  8796. */
  8797. function MappingList$1() {
  8798. this._array = [];
  8799. this._sorted = true;
  8800. // Serves as infimum
  8801. this._last = {generatedLine: -1, generatedColumn: 0};
  8802. }
  8803. /**
  8804. * Iterate through internal items. This method takes the same arguments that
  8805. * `Array.prototype.forEach` takes.
  8806. *
  8807. * NOTE: The order of the mappings is NOT guaranteed.
  8808. */
  8809. MappingList$1.prototype.unsortedForEach =
  8810. function MappingList_forEach(aCallback, aThisArg) {
  8811. this._array.forEach(aCallback, aThisArg);
  8812. };
  8813. /**
  8814. * Add the given source mapping.
  8815. *
  8816. * @param Object aMapping
  8817. */
  8818. MappingList$1.prototype.add = function MappingList_add(aMapping) {
  8819. if (generatedPositionAfter(this._last, aMapping)) {
  8820. this._last = aMapping;
  8821. this._array.push(aMapping);
  8822. } else {
  8823. this._sorted = false;
  8824. this._array.push(aMapping);
  8825. }
  8826. };
  8827. /**
  8828. * Returns the flat, sorted array of mappings. The mappings are sorted by
  8829. * generated position.
  8830. *
  8831. * WARNING: This method returns internal data without copying, for
  8832. * performance. The return value must NOT be mutated, and should be treated as
  8833. * an immutable borrow. If you want to take ownership, you must make your own
  8834. * copy.
  8835. */
  8836. MappingList$1.prototype.toArray = function MappingList_toArray() {
  8837. if (!this._sorted) {
  8838. this._array.sort(util$1.compareByGeneratedPositionsInflated);
  8839. this._sorted = true;
  8840. }
  8841. return this._array;
  8842. };
  8843. mappingList.MappingList = MappingList$1;
  8844. /* -*- Mode: js; js-indent-level: 2; -*- */
  8845. /*
  8846. * Copyright 2011 Mozilla Foundation and contributors
  8847. * Licensed under the New BSD license. See LICENSE or:
  8848. * http://opensource.org/licenses/BSD-3-Clause
  8849. */
  8850. var base64VLQ = base64Vlq;
  8851. var util = util$3;
  8852. var ArraySet = arraySet.ArraySet;
  8853. var MappingList = mappingList.MappingList;
  8854. /**
  8855. * An instance of the SourceMapGenerator represents a source map which is
  8856. * being built incrementally. You may pass an object with the following
  8857. * properties:
  8858. *
  8859. * - file: The filename of the generated source.
  8860. * - sourceRoot: A root for all relative URLs in this source map.
  8861. */
  8862. function SourceMapGenerator$1(aArgs) {
  8863. if (!aArgs) {
  8864. aArgs = {};
  8865. }
  8866. this._file = util.getArg(aArgs, 'file', null);
  8867. this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
  8868. this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
  8869. this._sources = new ArraySet();
  8870. this._names = new ArraySet();
  8871. this._mappings = new MappingList();
  8872. this._sourcesContents = null;
  8873. }
  8874. SourceMapGenerator$1.prototype._version = 3;
  8875. /**
  8876. * Creates a new SourceMapGenerator based on a SourceMapConsumer
  8877. *
  8878. * @param aSourceMapConsumer The SourceMap.
  8879. */
  8880. SourceMapGenerator$1.fromSourceMap =
  8881. function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
  8882. var sourceRoot = aSourceMapConsumer.sourceRoot;
  8883. var generator = new SourceMapGenerator$1({
  8884. file: aSourceMapConsumer.file,
  8885. sourceRoot: sourceRoot
  8886. });
  8887. aSourceMapConsumer.eachMapping(function (mapping) {
  8888. var newMapping = {
  8889. generated: {
  8890. line: mapping.generatedLine,
  8891. column: mapping.generatedColumn
  8892. }
  8893. };
  8894. if (mapping.source != null) {
  8895. newMapping.source = mapping.source;
  8896. if (sourceRoot != null) {
  8897. newMapping.source = util.relative(sourceRoot, newMapping.source);
  8898. }
  8899. newMapping.original = {
  8900. line: mapping.originalLine,
  8901. column: mapping.originalColumn
  8902. };
  8903. if (mapping.name != null) {
  8904. newMapping.name = mapping.name;
  8905. }
  8906. }
  8907. generator.addMapping(newMapping);
  8908. });
  8909. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  8910. var sourceRelative = sourceFile;
  8911. if (sourceRoot !== null) {
  8912. sourceRelative = util.relative(sourceRoot, sourceFile);
  8913. }
  8914. if (!generator._sources.has(sourceRelative)) {
  8915. generator._sources.add(sourceRelative);
  8916. }
  8917. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  8918. if (content != null) {
  8919. generator.setSourceContent(sourceFile, content);
  8920. }
  8921. });
  8922. return generator;
  8923. };
  8924. /**
  8925. * Add a single mapping from original source line and column to the generated
  8926. * source's line and column for this source map being created. The mapping
  8927. * object should have the following properties:
  8928. *
  8929. * - generated: An object with the generated line and column positions.
  8930. * - original: An object with the original line and column positions.
  8931. * - source: The original source file (relative to the sourceRoot).
  8932. * - name: An optional original token name for this mapping.
  8933. */
  8934. SourceMapGenerator$1.prototype.addMapping =
  8935. function SourceMapGenerator_addMapping(aArgs) {
  8936. var generated = util.getArg(aArgs, 'generated');
  8937. var original = util.getArg(aArgs, 'original', null);
  8938. var source = util.getArg(aArgs, 'source', null);
  8939. var name = util.getArg(aArgs, 'name', null);
  8940. if (!this._skipValidation) {
  8941. this._validateMapping(generated, original, source, name);
  8942. }
  8943. if (source != null) {
  8944. source = String(source);
  8945. if (!this._sources.has(source)) {
  8946. this._sources.add(source);
  8947. }
  8948. }
  8949. if (name != null) {
  8950. name = String(name);
  8951. if (!this._names.has(name)) {
  8952. this._names.add(name);
  8953. }
  8954. }
  8955. this._mappings.add({
  8956. generatedLine: generated.line,
  8957. generatedColumn: generated.column,
  8958. originalLine: original != null && original.line,
  8959. originalColumn: original != null && original.column,
  8960. source: source,
  8961. name: name
  8962. });
  8963. };
  8964. /**
  8965. * Set the source content for a source file.
  8966. */
  8967. SourceMapGenerator$1.prototype.setSourceContent =
  8968. function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
  8969. var source = aSourceFile;
  8970. if (this._sourceRoot != null) {
  8971. source = util.relative(this._sourceRoot, source);
  8972. }
  8973. if (aSourceContent != null) {
  8974. // Add the source content to the _sourcesContents map.
  8975. // Create a new _sourcesContents map if the property is null.
  8976. if (!this._sourcesContents) {
  8977. this._sourcesContents = Object.create(null);
  8978. }
  8979. this._sourcesContents[util.toSetString(source)] = aSourceContent;
  8980. } else if (this._sourcesContents) {
  8981. // Remove the source file from the _sourcesContents map.
  8982. // If the _sourcesContents map is empty, set the property to null.
  8983. delete this._sourcesContents[util.toSetString(source)];
  8984. if (Object.keys(this._sourcesContents).length === 0) {
  8985. this._sourcesContents = null;
  8986. }
  8987. }
  8988. };
  8989. /**
  8990. * Applies the mappings of a sub-source-map for a specific source file to the
  8991. * source map being generated. Each mapping to the supplied source file is
  8992. * rewritten using the supplied source map. Note: The resolution for the
  8993. * resulting mappings is the minimium of this map and the supplied map.
  8994. *
  8995. * @param aSourceMapConsumer The source map to be applied.
  8996. * @param aSourceFile Optional. The filename of the source file.
  8997. * If omitted, SourceMapConsumer's file property will be used.
  8998. * @param aSourceMapPath Optional. The dirname of the path to the source map
  8999. * to be applied. If relative, it is relative to the SourceMapConsumer.
  9000. * This parameter is needed when the two source maps aren't in the same
  9001. * directory, and the source map to be applied contains relative source
  9002. * paths. If so, those relative source paths need to be rewritten
  9003. * relative to the SourceMapGenerator.
  9004. */
  9005. SourceMapGenerator$1.prototype.applySourceMap =
  9006. function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
  9007. var sourceFile = aSourceFile;
  9008. // If aSourceFile is omitted, we will use the file property of the SourceMap
  9009. if (aSourceFile == null) {
  9010. if (aSourceMapConsumer.file == null) {
  9011. throw new Error(
  9012. 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
  9013. 'or the source map\'s "file" property. Both were omitted.'
  9014. );
  9015. }
  9016. sourceFile = aSourceMapConsumer.file;
  9017. }
  9018. var sourceRoot = this._sourceRoot;
  9019. // Make "sourceFile" relative if an absolute Url is passed.
  9020. if (sourceRoot != null) {
  9021. sourceFile = util.relative(sourceRoot, sourceFile);
  9022. }
  9023. // Applying the SourceMap can add and remove items from the sources and
  9024. // the names array.
  9025. var newSources = new ArraySet();
  9026. var newNames = new ArraySet();
  9027. // Find mappings for the "sourceFile"
  9028. this._mappings.unsortedForEach(function (mapping) {
  9029. if (mapping.source === sourceFile && mapping.originalLine != null) {
  9030. // Check if it can be mapped by the source map, then update the mapping.
  9031. var original = aSourceMapConsumer.originalPositionFor({
  9032. line: mapping.originalLine,
  9033. column: mapping.originalColumn
  9034. });
  9035. if (original.source != null) {
  9036. // Copy mapping
  9037. mapping.source = original.source;
  9038. if (aSourceMapPath != null) {
  9039. mapping.source = util.join(aSourceMapPath, mapping.source);
  9040. }
  9041. if (sourceRoot != null) {
  9042. mapping.source = util.relative(sourceRoot, mapping.source);
  9043. }
  9044. mapping.originalLine = original.line;
  9045. mapping.originalColumn = original.column;
  9046. if (original.name != null) {
  9047. mapping.name = original.name;
  9048. }
  9049. }
  9050. }
  9051. var source = mapping.source;
  9052. if (source != null && !newSources.has(source)) {
  9053. newSources.add(source);
  9054. }
  9055. var name = mapping.name;
  9056. if (name != null && !newNames.has(name)) {
  9057. newNames.add(name);
  9058. }
  9059. }, this);
  9060. this._sources = newSources;
  9061. this._names = newNames;
  9062. // Copy sourcesContents of applied map.
  9063. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  9064. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  9065. if (content != null) {
  9066. if (aSourceMapPath != null) {
  9067. sourceFile = util.join(aSourceMapPath, sourceFile);
  9068. }
  9069. if (sourceRoot != null) {
  9070. sourceFile = util.relative(sourceRoot, sourceFile);
  9071. }
  9072. this.setSourceContent(sourceFile, content);
  9073. }
  9074. }, this);
  9075. };
  9076. /**
  9077. * A mapping can have one of the three levels of data:
  9078. *
  9079. * 1. Just the generated position.
  9080. * 2. The Generated position, original position, and original source.
  9081. * 3. Generated and original position, original source, as well as a name
  9082. * token.
  9083. *
  9084. * To maintain consistency, we validate that any new mapping being added falls
  9085. * in to one of these categories.
  9086. */
  9087. SourceMapGenerator$1.prototype._validateMapping =
  9088. function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
  9089. aName) {
  9090. // When aOriginal is truthy but has empty values for .line and .column,
  9091. // it is most likely a programmer error. In this case we throw a very
  9092. // specific error message to try to guide them the right way.
  9093. // For example: https://github.com/Polymer/polymer-bundler/pull/519
  9094. if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
  9095. throw new Error(
  9096. 'original.line and original.column are not numbers -- you probably meant to omit ' +
  9097. 'the original mapping entirely and only map the generated position. If so, pass ' +
  9098. 'null for the original mapping instead of an object with empty or null values.'
  9099. );
  9100. }
  9101. if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
  9102. && aGenerated.line > 0 && aGenerated.column >= 0
  9103. && !aOriginal && !aSource && !aName) {
  9104. // Case 1.
  9105. return;
  9106. }
  9107. else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
  9108. && aOriginal && 'line' in aOriginal && 'column' in aOriginal
  9109. && aGenerated.line > 0 && aGenerated.column >= 0
  9110. && aOriginal.line > 0 && aOriginal.column >= 0
  9111. && aSource) {
  9112. // Cases 2 and 3.
  9113. return;
  9114. }
  9115. else {
  9116. throw new Error('Invalid mapping: ' + JSON.stringify({
  9117. generated: aGenerated,
  9118. source: aSource,
  9119. original: aOriginal,
  9120. name: aName
  9121. }));
  9122. }
  9123. };
  9124. /**
  9125. * Serialize the accumulated mappings in to the stream of base 64 VLQs
  9126. * specified by the source map format.
  9127. */
  9128. SourceMapGenerator$1.prototype._serializeMappings =
  9129. function SourceMapGenerator_serializeMappings() {
  9130. var previousGeneratedColumn = 0;
  9131. var previousGeneratedLine = 1;
  9132. var previousOriginalColumn = 0;
  9133. var previousOriginalLine = 0;
  9134. var previousName = 0;
  9135. var previousSource = 0;
  9136. var result = '';
  9137. var next;
  9138. var mapping;
  9139. var nameIdx;
  9140. var sourceIdx;
  9141. var mappings = this._mappings.toArray();
  9142. for (var i = 0, len = mappings.length; i < len; i++) {
  9143. mapping = mappings[i];
  9144. next = '';
  9145. if (mapping.generatedLine !== previousGeneratedLine) {
  9146. previousGeneratedColumn = 0;
  9147. while (mapping.generatedLine !== previousGeneratedLine) {
  9148. next += ';';
  9149. previousGeneratedLine++;
  9150. }
  9151. }
  9152. else {
  9153. if (i > 0) {
  9154. if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
  9155. continue;
  9156. }
  9157. next += ',';
  9158. }
  9159. }
  9160. next += base64VLQ.encode(mapping.generatedColumn
  9161. - previousGeneratedColumn);
  9162. previousGeneratedColumn = mapping.generatedColumn;
  9163. if (mapping.source != null) {
  9164. sourceIdx = this._sources.indexOf(mapping.source);
  9165. next += base64VLQ.encode(sourceIdx - previousSource);
  9166. previousSource = sourceIdx;
  9167. // lines are stored 0-based in SourceMap spec version 3
  9168. next += base64VLQ.encode(mapping.originalLine - 1
  9169. - previousOriginalLine);
  9170. previousOriginalLine = mapping.originalLine - 1;
  9171. next += base64VLQ.encode(mapping.originalColumn
  9172. - previousOriginalColumn);
  9173. previousOriginalColumn = mapping.originalColumn;
  9174. if (mapping.name != null) {
  9175. nameIdx = this._names.indexOf(mapping.name);
  9176. next += base64VLQ.encode(nameIdx - previousName);
  9177. previousName = nameIdx;
  9178. }
  9179. }
  9180. result += next;
  9181. }
  9182. return result;
  9183. };
  9184. SourceMapGenerator$1.prototype._generateSourcesContent =
  9185. function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
  9186. return aSources.map(function (source) {
  9187. if (!this._sourcesContents) {
  9188. return null;
  9189. }
  9190. if (aSourceRoot != null) {
  9191. source = util.relative(aSourceRoot, source);
  9192. }
  9193. var key = util.toSetString(source);
  9194. return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
  9195. ? this._sourcesContents[key]
  9196. : null;
  9197. }, this);
  9198. };
  9199. /**
  9200. * Externalize the source map.
  9201. */
  9202. SourceMapGenerator$1.prototype.toJSON =
  9203. function SourceMapGenerator_toJSON() {
  9204. var map = {
  9205. version: this._version,
  9206. sources: this._sources.toArray(),
  9207. names: this._names.toArray(),
  9208. mappings: this._serializeMappings()
  9209. };
  9210. if (this._file != null) {
  9211. map.file = this._file;
  9212. }
  9213. if (this._sourceRoot != null) {
  9214. map.sourceRoot = this._sourceRoot;
  9215. }
  9216. if (this._sourcesContents) {
  9217. map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
  9218. }
  9219. return map;
  9220. };
  9221. /**
  9222. * Render the source map being generated to a string.
  9223. */
  9224. SourceMapGenerator$1.prototype.toString =
  9225. function SourceMapGenerator_toString() {
  9226. return JSON.stringify(this.toJSON());
  9227. };
  9228. sourceMapGenerator.SourceMapGenerator = SourceMapGenerator$1;
  9229. var SourceMapGenerator = sourceMapGenerator.SourceMapGenerator;
  9230. var trackNodes = {
  9231. Atrule: true,
  9232. Selector: true,
  9233. Declaration: true
  9234. };
  9235. var sourceMap$1 = function generateSourceMap(handlers) {
  9236. var map = new SourceMapGenerator();
  9237. var line = 1;
  9238. var column = 0;
  9239. var generated = {
  9240. line: 1,
  9241. column: 0
  9242. };
  9243. var original = {
  9244. line: 0, // should be zero to add first mapping
  9245. column: 0
  9246. };
  9247. var sourceMappingActive = false;
  9248. var activatedGenerated = {
  9249. line: 1,
  9250. column: 0
  9251. };
  9252. var activatedMapping = {
  9253. generated: activatedGenerated
  9254. };
  9255. var handlersNode = handlers.node;
  9256. handlers.node = function(node) {
  9257. if (node.loc && node.loc.start && trackNodes.hasOwnProperty(node.type)) {
  9258. var nodeLine = node.loc.start.line;
  9259. var nodeColumn = node.loc.start.column - 1;
  9260. if (original.line !== nodeLine ||
  9261. original.column !== nodeColumn) {
  9262. original.line = nodeLine;
  9263. original.column = nodeColumn;
  9264. generated.line = line;
  9265. generated.column = column;
  9266. if (sourceMappingActive) {
  9267. sourceMappingActive = false;
  9268. if (generated.line !== activatedGenerated.line ||
  9269. generated.column !== activatedGenerated.column) {
  9270. map.addMapping(activatedMapping);
  9271. }
  9272. }
  9273. sourceMappingActive = true;
  9274. map.addMapping({
  9275. source: node.loc.source,
  9276. original: original,
  9277. generated: generated
  9278. });
  9279. }
  9280. }
  9281. handlersNode.call(this, node);
  9282. if (sourceMappingActive && trackNodes.hasOwnProperty(node.type)) {
  9283. activatedGenerated.line = line;
  9284. activatedGenerated.column = column;
  9285. }
  9286. };
  9287. var handlersChunk = handlers.chunk;
  9288. handlers.chunk = function(chunk) {
  9289. for (var i = 0; i < chunk.length; i++) {
  9290. if (chunk.charCodeAt(i) === 10) { // \n
  9291. line++;
  9292. column = 0;
  9293. } else {
  9294. column++;
  9295. }
  9296. }
  9297. handlersChunk(chunk);
  9298. };
  9299. var handlersResult = handlers.result;
  9300. handlers.result = function() {
  9301. if (sourceMappingActive) {
  9302. map.addMapping(activatedMapping);
  9303. }
  9304. return {
  9305. css: handlersResult(),
  9306. map: map
  9307. };
  9308. };
  9309. return handlers;
  9310. };
  9311. var sourceMap = sourceMap$1;
  9312. var hasOwnProperty$4 = Object.prototype.hasOwnProperty;
  9313. function processChildren(node, delimeter) {
  9314. var list = node.children;
  9315. var prev = null;
  9316. if (typeof delimeter !== 'function') {
  9317. list.forEach(this.node, this);
  9318. } else {
  9319. list.forEach(function(node) {
  9320. if (prev !== null) {
  9321. delimeter.call(this, prev);
  9322. }
  9323. this.node(node);
  9324. prev = node;
  9325. }, this);
  9326. }
  9327. }
  9328. var create$2 = function createGenerator(config) {
  9329. function processNode(node) {
  9330. if (hasOwnProperty$4.call(types, node.type)) {
  9331. types[node.type].call(this, node);
  9332. } else {
  9333. throw new Error('Unknown node type: ' + node.type);
  9334. }
  9335. }
  9336. var types = {};
  9337. if (config.node) {
  9338. for (var name in config.node) {
  9339. types[name] = config.node[name].generate;
  9340. }
  9341. }
  9342. return function(node, options) {
  9343. var buffer = '';
  9344. var handlers = {
  9345. children: processChildren,
  9346. node: processNode,
  9347. chunk: function(chunk) {
  9348. buffer += chunk;
  9349. },
  9350. result: function() {
  9351. return buffer;
  9352. }
  9353. };
  9354. if (options) {
  9355. if (typeof options.decorator === 'function') {
  9356. handlers = options.decorator(handlers);
  9357. }
  9358. if (options.sourceMap) {
  9359. handlers = sourceMap(handlers);
  9360. }
  9361. }
  9362. handlers.node(node);
  9363. return handlers.result();
  9364. };
  9365. };
  9366. var List$2 = List_1;
  9367. var create$1 = function createConvertors(walk) {
  9368. return {
  9369. fromPlainObject: function(ast) {
  9370. walk(ast, {
  9371. enter: function(node) {
  9372. if (node.children && node.children instanceof List$2 === false) {
  9373. node.children = new List$2().fromArray(node.children);
  9374. }
  9375. }
  9376. });
  9377. return ast;
  9378. },
  9379. toPlainObject: function(ast) {
  9380. walk(ast, {
  9381. leave: function(node) {
  9382. if (node.children && node.children instanceof List$2) {
  9383. node.children = node.children.toArray();
  9384. }
  9385. }
  9386. });
  9387. return ast;
  9388. }
  9389. };
  9390. };
  9391. var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
  9392. var noop = function() {};
  9393. function ensureFunction(value) {
  9394. return typeof value === 'function' ? value : noop;
  9395. }
  9396. function invokeForType(fn, type) {
  9397. return function(node, item, list) {
  9398. if (node.type === type) {
  9399. fn.call(this, node, item, list);
  9400. }
  9401. };
  9402. }
  9403. function getWalkersFromStructure(name, nodeType) {
  9404. var structure = nodeType.structure;
  9405. var walkers = [];
  9406. for (var key in structure) {
  9407. if (hasOwnProperty$3.call(structure, key) === false) {
  9408. continue;
  9409. }
  9410. var fieldTypes = structure[key];
  9411. var walker = {
  9412. name: key,
  9413. type: false,
  9414. nullable: false
  9415. };
  9416. if (!Array.isArray(structure[key])) {
  9417. fieldTypes = [structure[key]];
  9418. }
  9419. for (var i = 0; i < fieldTypes.length; i++) {
  9420. var fieldType = fieldTypes[i];
  9421. if (fieldType === null) {
  9422. walker.nullable = true;
  9423. } else if (typeof fieldType === 'string') {
  9424. walker.type = 'node';
  9425. } else if (Array.isArray(fieldType)) {
  9426. walker.type = 'list';
  9427. }
  9428. }
  9429. if (walker.type) {
  9430. walkers.push(walker);
  9431. }
  9432. }
  9433. if (walkers.length) {
  9434. return {
  9435. context: nodeType.walkContext,
  9436. fields: walkers
  9437. };
  9438. }
  9439. return null;
  9440. }
  9441. function getTypesFromConfig(config) {
  9442. var types = {};
  9443. for (var name in config.node) {
  9444. if (hasOwnProperty$3.call(config.node, name)) {
  9445. var nodeType = config.node[name];
  9446. if (!nodeType.structure) {
  9447. throw new Error('Missed `structure` field in `' + name + '` node type definition');
  9448. }
  9449. types[name] = getWalkersFromStructure(name, nodeType);
  9450. }
  9451. }
  9452. return types;
  9453. }
  9454. function createTypeIterator(config, reverse) {
  9455. var fields = config.fields.slice();
  9456. var contextName = config.context;
  9457. var useContext = typeof contextName === 'string';
  9458. if (reverse) {
  9459. fields.reverse();
  9460. }
  9461. return function(node, context, walk, walkReducer) {
  9462. var prevContextValue;
  9463. if (useContext) {
  9464. prevContextValue = context[contextName];
  9465. context[contextName] = node;
  9466. }
  9467. for (var i = 0; i < fields.length; i++) {
  9468. var field = fields[i];
  9469. var ref = node[field.name];
  9470. if (!field.nullable || ref) {
  9471. if (field.type === 'list') {
  9472. var breakWalk = reverse
  9473. ? ref.reduceRight(walkReducer, false)
  9474. : ref.reduce(walkReducer, false);
  9475. if (breakWalk) {
  9476. return true;
  9477. }
  9478. } else if (walk(ref)) {
  9479. return true;
  9480. }
  9481. }
  9482. }
  9483. if (useContext) {
  9484. context[contextName] = prevContextValue;
  9485. }
  9486. };
  9487. }
  9488. function createFastTraveralMap(iterators) {
  9489. return {
  9490. Atrule: {
  9491. StyleSheet: iterators.StyleSheet,
  9492. Atrule: iterators.Atrule,
  9493. Rule: iterators.Rule,
  9494. Block: iterators.Block
  9495. },
  9496. Rule: {
  9497. StyleSheet: iterators.StyleSheet,
  9498. Atrule: iterators.Atrule,
  9499. Rule: iterators.Rule,
  9500. Block: iterators.Block
  9501. },
  9502. Declaration: {
  9503. StyleSheet: iterators.StyleSheet,
  9504. Atrule: iterators.Atrule,
  9505. Rule: iterators.Rule,
  9506. Block: iterators.Block,
  9507. DeclarationList: iterators.DeclarationList
  9508. }
  9509. };
  9510. }
  9511. var create = function createWalker(config) {
  9512. var types = getTypesFromConfig(config);
  9513. var iteratorsNatural = {};
  9514. var iteratorsReverse = {};
  9515. var breakWalk = Symbol('break-walk');
  9516. var skipNode = Symbol('skip-node');
  9517. for (var name in types) {
  9518. if (hasOwnProperty$3.call(types, name) && types[name] !== null) {
  9519. iteratorsNatural[name] = createTypeIterator(types[name], false);
  9520. iteratorsReverse[name] = createTypeIterator(types[name], true);
  9521. }
  9522. }
  9523. var fastTraversalIteratorsNatural = createFastTraveralMap(iteratorsNatural);
  9524. var fastTraversalIteratorsReverse = createFastTraveralMap(iteratorsReverse);
  9525. var walk = function(root, options) {
  9526. function walkNode(node, item, list) {
  9527. var enterRet = enter.call(context, node, item, list);
  9528. if (enterRet === breakWalk) {
  9529. debugger;
  9530. return true;
  9531. }
  9532. if (enterRet === skipNode) {
  9533. return false;
  9534. }
  9535. if (iterators.hasOwnProperty(node.type)) {
  9536. if (iterators[node.type](node, context, walkNode, walkReducer)) {
  9537. return true;
  9538. }
  9539. }
  9540. if (leave.call(context, node, item, list) === breakWalk) {
  9541. return true;
  9542. }
  9543. return false;
  9544. }
  9545. var walkReducer = (ret, data, item, list) => ret || walkNode(data, item, list);
  9546. var enter = noop;
  9547. var leave = noop;
  9548. var iterators = iteratorsNatural;
  9549. var context = {
  9550. break: breakWalk,
  9551. skip: skipNode,
  9552. root: root,
  9553. stylesheet: null,
  9554. atrule: null,
  9555. atrulePrelude: null,
  9556. rule: null,
  9557. selector: null,
  9558. block: null,
  9559. declaration: null,
  9560. function: null
  9561. };
  9562. if (typeof options === 'function') {
  9563. enter = options;
  9564. } else if (options) {
  9565. enter = ensureFunction(options.enter);
  9566. leave = ensureFunction(options.leave);
  9567. if (options.reverse) {
  9568. iterators = iteratorsReverse;
  9569. }
  9570. if (options.visit) {
  9571. if (fastTraversalIteratorsNatural.hasOwnProperty(options.visit)) {
  9572. iterators = options.reverse
  9573. ? fastTraversalIteratorsReverse[options.visit]
  9574. : fastTraversalIteratorsNatural[options.visit];
  9575. } else if (!types.hasOwnProperty(options.visit)) {
  9576. throw new Error('Bad value `' + options.visit + '` for `visit` option (should be: ' + Object.keys(types).join(', ') + ')');
  9577. }
  9578. enter = invokeForType(enter, options.visit);
  9579. leave = invokeForType(leave, options.visit);
  9580. }
  9581. }
  9582. if (enter === noop && leave === noop) {
  9583. throw new Error('Neither `enter` nor `leave` walker handler is set or both aren\'t a function');
  9584. }
  9585. walkNode(root);
  9586. };
  9587. walk.break = breakWalk;
  9588. walk.skip = skipNode;
  9589. walk.find = function(ast, fn) {
  9590. var found = null;
  9591. walk(ast, function(node, item, list) {
  9592. if (fn.call(this, node, item, list)) {
  9593. found = node;
  9594. return breakWalk;
  9595. }
  9596. });
  9597. return found;
  9598. };
  9599. walk.findLast = function(ast, fn) {
  9600. var found = null;
  9601. walk(ast, {
  9602. reverse: true,
  9603. enter: function(node, item, list) {
  9604. if (fn.call(this, node, item, list)) {
  9605. found = node;
  9606. return breakWalk;
  9607. }
  9608. }
  9609. });
  9610. return found;
  9611. };
  9612. walk.findAll = function(ast, fn) {
  9613. var found = [];
  9614. walk(ast, function(node, item, list) {
  9615. if (fn.call(this, node, item, list)) {
  9616. found.push(node);
  9617. }
  9618. });
  9619. return found;
  9620. };
  9621. return walk;
  9622. };
  9623. var List$1 = List_1;
  9624. var clone$1 = function clone(node) {
  9625. var result = {};
  9626. for (var key in node) {
  9627. var value = node[key];
  9628. if (value) {
  9629. if (Array.isArray(value) || value instanceof List$1) {
  9630. value = value.map(clone);
  9631. } else if (value.constructor === Object) {
  9632. value = clone(value);
  9633. }
  9634. }
  9635. result[key] = value;
  9636. }
  9637. return result;
  9638. };
  9639. const hasOwnProperty$2 = Object.prototype.hasOwnProperty;
  9640. const shape$1 = {
  9641. generic: true,
  9642. types: appendOrAssign,
  9643. atrules: {
  9644. prelude: appendOrAssignOrNull,
  9645. descriptors: appendOrAssignOrNull
  9646. },
  9647. properties: appendOrAssign,
  9648. parseContext: assign,
  9649. scope: deepAssign,
  9650. atrule: ['parse'],
  9651. pseudo: ['parse'],
  9652. node: ['name', 'structure', 'parse', 'generate', 'walkContext']
  9653. };
  9654. function isObject$2(value) {
  9655. return value && value.constructor === Object;
  9656. }
  9657. function copy(value) {
  9658. return isObject$2(value)
  9659. ? Object.assign({}, value)
  9660. : value;
  9661. }
  9662. function assign(dest, src) {
  9663. return Object.assign(dest, src);
  9664. }
  9665. function deepAssign(dest, src) {
  9666. for (const key in src) {
  9667. if (hasOwnProperty$2.call(src, key)) {
  9668. if (isObject$2(dest[key])) {
  9669. deepAssign(dest[key], copy(src[key]));
  9670. } else {
  9671. dest[key] = copy(src[key]);
  9672. }
  9673. }
  9674. }
  9675. return dest;
  9676. }
  9677. function append(a, b) {
  9678. if (typeof b === 'string' && /^\s*\|/.test(b)) {
  9679. return typeof a === 'string'
  9680. ? a + b
  9681. : b.replace(/^\s*\|\s*/, '');
  9682. }
  9683. return b || null;
  9684. }
  9685. function appendOrAssign(a, b) {
  9686. if (typeof b === 'string') {
  9687. return append(a, b);
  9688. }
  9689. const result = Object.assign({}, a);
  9690. for (let key in b) {
  9691. if (hasOwnProperty$2.call(b, key)) {
  9692. result[key] = append(hasOwnProperty$2.call(a, key) ? a[key] : undefined, b[key]);
  9693. }
  9694. }
  9695. return result;
  9696. }
  9697. function appendOrAssignOrNull(a, b) {
  9698. const result = appendOrAssign(a, b);
  9699. return !isObject$2(result) || Object.keys(result).length
  9700. ? result
  9701. : null;
  9702. }
  9703. function mix$1(dest, src, shape) {
  9704. for (const key in shape) {
  9705. if (hasOwnProperty$2.call(shape, key) === false) {
  9706. continue;
  9707. }
  9708. if (shape[key] === true) {
  9709. if (key in src) {
  9710. if (hasOwnProperty$2.call(src, key)) {
  9711. dest[key] = copy(src[key]);
  9712. }
  9713. }
  9714. } else if (shape[key]) {
  9715. if (typeof shape[key] === 'function') {
  9716. const fn = shape[key];
  9717. dest[key] = fn({}, dest[key]);
  9718. dest[key] = fn(dest[key] || {}, src[key]);
  9719. } else if (isObject$2(shape[key])) {
  9720. const result = {};
  9721. for (let name in dest[key]) {
  9722. result[name] = mix$1({}, dest[key][name], shape[key]);
  9723. }
  9724. for (let name in src[key]) {
  9725. result[name] = mix$1(result[name] || {}, src[key][name], shape[key]);
  9726. }
  9727. dest[key] = result;
  9728. } else if (Array.isArray(shape[key])) {
  9729. const res = {};
  9730. const innerShape = shape[key].reduce(function(s, k) {
  9731. s[k] = true;
  9732. return s;
  9733. }, {});
  9734. for (const [name, value] of Object.entries(dest[key] || {})) {
  9735. res[name] = {};
  9736. if (value) {
  9737. mix$1(res[name], value, innerShape);
  9738. }
  9739. }
  9740. for (const name in src[key]) {
  9741. if (hasOwnProperty$2.call(src[key], name)) {
  9742. if (!res[name]) {
  9743. res[name] = {};
  9744. }
  9745. if (src[key] && src[key][name]) {
  9746. mix$1(res[name], src[key][name], innerShape);
  9747. }
  9748. }
  9749. }
  9750. dest[key] = res;
  9751. }
  9752. }
  9753. }
  9754. return dest;
  9755. }
  9756. var mix_1 = (dest, src) => mix$1(dest, src, shape$1);
  9757. var List = List_1;
  9758. var SyntaxError$1 = _SyntaxError$1;
  9759. var TokenStream = TokenStream_1;
  9760. var Lexer = Lexer_1;
  9761. var definitionSyntax = definitionSyntax$1;
  9762. var tokenize = tokenizer$3;
  9763. var createParser = create$3;
  9764. var createGenerator = create$2;
  9765. var createConvertor = create$1;
  9766. var createWalker = create;
  9767. var clone = clone$1;
  9768. var names = names$2;
  9769. var mix = mix_1;
  9770. function createSyntax(config) {
  9771. var parse = createParser(config);
  9772. var walk = createWalker(config);
  9773. var generate = createGenerator(config);
  9774. var convert = createConvertor(walk);
  9775. var syntax = {
  9776. List: List,
  9777. SyntaxError: SyntaxError$1,
  9778. TokenStream: TokenStream,
  9779. Lexer: Lexer,
  9780. vendorPrefix: names.vendorPrefix,
  9781. keyword: names.keyword,
  9782. property: names.property,
  9783. isCustomProperty: names.isCustomProperty,
  9784. definitionSyntax: definitionSyntax,
  9785. lexer: null,
  9786. createLexer: function(config) {
  9787. return new Lexer(config, syntax, syntax.lexer.structure);
  9788. },
  9789. tokenize: tokenize,
  9790. parse: parse,
  9791. walk: walk,
  9792. generate: generate,
  9793. find: walk.find,
  9794. findLast: walk.findLast,
  9795. findAll: walk.findAll,
  9796. clone: clone,
  9797. fromPlainObject: convert.fromPlainObject,
  9798. toPlainObject: convert.toPlainObject,
  9799. createSyntax: function(config) {
  9800. return createSyntax(mix({}, config));
  9801. },
  9802. fork: function(extension) {
  9803. var base = mix({}, config); // copy of config
  9804. return createSyntax(
  9805. typeof extension === 'function'
  9806. ? extension(base, Object.assign)
  9807. : mix(base, extension)
  9808. );
  9809. }
  9810. };
  9811. syntax.lexer = new Lexer({
  9812. generic: true,
  9813. types: config.types,
  9814. atrules: config.atrules,
  9815. properties: config.properties,
  9816. node: config.node
  9817. }, syntax);
  9818. return syntax;
  9819. }
  9820. create$4.create = function(config) {
  9821. return createSyntax(mix({}, config));
  9822. };
  9823. var require$$0 = {
  9824. "@charset": {
  9825. syntax: "@charset \"<charset>\";",
  9826. groups: [
  9827. "CSS Charsets"
  9828. ],
  9829. status: "standard",
  9830. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@charset"
  9831. },
  9832. "@counter-style": {
  9833. syntax: "@counter-style <counter-style-name> {\n [ system: <counter-system>; ] ||\n [ symbols: <counter-symbols>; ] ||\n [ additive-symbols: <additive-symbols>; ] ||\n [ negative: <negative-symbol>; ] ||\n [ prefix: <prefix>; ] ||\n [ suffix: <suffix>; ] ||\n [ range: <range>; ] ||\n [ pad: <padding>; ] ||\n [ speak-as: <speak-as>; ] ||\n [ fallback: <counter-style-name>; ]\n}",
  9834. interfaces: [
  9835. "CSSCounterStyleRule"
  9836. ],
  9837. groups: [
  9838. "CSS Counter Styles"
  9839. ],
  9840. descriptors: {
  9841. "additive-symbols": {
  9842. syntax: "[ <integer> && <symbol> ]#",
  9843. media: "all",
  9844. initial: "n/a (required)",
  9845. percentages: "no",
  9846. computed: "asSpecified",
  9847. order: "orderOfAppearance",
  9848. status: "standard"
  9849. },
  9850. fallback: {
  9851. syntax: "<counter-style-name>",
  9852. media: "all",
  9853. initial: "decimal",
  9854. percentages: "no",
  9855. computed: "asSpecified",
  9856. order: "uniqueOrder",
  9857. status: "standard"
  9858. },
  9859. negative: {
  9860. syntax: "<symbol> <symbol>?",
  9861. media: "all",
  9862. initial: "\"-\" hyphen-minus",
  9863. percentages: "no",
  9864. computed: "asSpecified",
  9865. order: "orderOfAppearance",
  9866. status: "standard"
  9867. },
  9868. pad: {
  9869. syntax: "<integer> && <symbol>",
  9870. media: "all",
  9871. initial: "0 \"\"",
  9872. percentages: "no",
  9873. computed: "asSpecified",
  9874. order: "uniqueOrder",
  9875. status: "standard"
  9876. },
  9877. prefix: {
  9878. syntax: "<symbol>",
  9879. media: "all",
  9880. initial: "\"\"",
  9881. percentages: "no",
  9882. computed: "asSpecified",
  9883. order: "uniqueOrder",
  9884. status: "standard"
  9885. },
  9886. range: {
  9887. syntax: "[ [ <integer> | infinite ]{2} ]# | auto",
  9888. media: "all",
  9889. initial: "auto",
  9890. percentages: "no",
  9891. computed: "asSpecified",
  9892. order: "orderOfAppearance",
  9893. status: "standard"
  9894. },
  9895. "speak-as": {
  9896. syntax: "auto | bullets | numbers | words | spell-out | <counter-style-name>",
  9897. media: "all",
  9898. initial: "auto",
  9899. percentages: "no",
  9900. computed: "asSpecified",
  9901. order: "uniqueOrder",
  9902. status: "standard"
  9903. },
  9904. suffix: {
  9905. syntax: "<symbol>",
  9906. media: "all",
  9907. initial: "\". \"",
  9908. percentages: "no",
  9909. computed: "asSpecified",
  9910. order: "uniqueOrder",
  9911. status: "standard"
  9912. },
  9913. symbols: {
  9914. syntax: "<symbol>+",
  9915. media: "all",
  9916. initial: "n/a (required)",
  9917. percentages: "no",
  9918. computed: "asSpecified",
  9919. order: "orderOfAppearance",
  9920. status: "standard"
  9921. },
  9922. system: {
  9923. syntax: "cyclic | numeric | alphabetic | symbolic | additive | [ fixed <integer>? ] | [ extends <counter-style-name> ]",
  9924. media: "all",
  9925. initial: "symbolic",
  9926. percentages: "no",
  9927. computed: "asSpecified",
  9928. order: "uniqueOrder",
  9929. status: "standard"
  9930. }
  9931. },
  9932. status: "standard",
  9933. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@counter-style"
  9934. },
  9935. "@document": {
  9936. syntax: "@document [ <url> | url-prefix(<string>) | domain(<string>) | media-document(<string>) | regexp(<string>) ]# {\n <group-rule-body>\n}",
  9937. interfaces: [
  9938. "CSSGroupingRule",
  9939. "CSSConditionRule"
  9940. ],
  9941. groups: [
  9942. "CSS Conditional Rules"
  9943. ],
  9944. status: "nonstandard",
  9945. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@document"
  9946. },
  9947. "@font-face": {
  9948. syntax: "@font-face {\n [ font-family: <family-name>; ] ||\n [ src: <src>; ] ||\n [ unicode-range: <unicode-range>; ] ||\n [ font-variant: <font-variant>; ] ||\n [ font-feature-settings: <font-feature-settings>; ] ||\n [ font-variation-settings: <font-variation-settings>; ] ||\n [ font-stretch: <font-stretch>; ] ||\n [ font-weight: <font-weight>; ] ||\n [ font-style: <font-style>; ]\n}",
  9949. interfaces: [
  9950. "CSSFontFaceRule"
  9951. ],
  9952. groups: [
  9953. "CSS Fonts"
  9954. ],
  9955. descriptors: {
  9956. "font-display": {
  9957. syntax: "[ auto | block | swap | fallback | optional ]",
  9958. media: "visual",
  9959. percentages: "no",
  9960. initial: "auto",
  9961. computed: "asSpecified",
  9962. order: "uniqueOrder",
  9963. status: "experimental"
  9964. },
  9965. "font-family": {
  9966. syntax: "<family-name>",
  9967. media: "all",
  9968. initial: "n/a (required)",
  9969. percentages: "no",
  9970. computed: "asSpecified",
  9971. order: "uniqueOrder",
  9972. status: "standard"
  9973. },
  9974. "font-feature-settings": {
  9975. syntax: "normal | <feature-tag-value>#",
  9976. media: "all",
  9977. initial: "normal",
  9978. percentages: "no",
  9979. computed: "asSpecified",
  9980. order: "orderOfAppearance",
  9981. status: "standard"
  9982. },
  9983. "font-variation-settings": {
  9984. syntax: "normal | [ <string> <number> ]#",
  9985. media: "all",
  9986. initial: "normal",
  9987. percentages: "no",
  9988. computed: "asSpecified",
  9989. order: "orderOfAppearance",
  9990. status: "standard"
  9991. },
  9992. "font-stretch": {
  9993. syntax: "<font-stretch-absolute>{1,2}",
  9994. media: "all",
  9995. initial: "normal",
  9996. percentages: "no",
  9997. computed: "asSpecified",
  9998. order: "uniqueOrder",
  9999. status: "standard"
  10000. },
  10001. "font-style": {
  10002. syntax: "normal | italic | oblique <angle>{0,2}",
  10003. media: "all",
  10004. initial: "normal",
  10005. percentages: "no",
  10006. computed: "asSpecified",
  10007. order: "uniqueOrder",
  10008. status: "standard"
  10009. },
  10010. "font-weight": {
  10011. syntax: "<font-weight-absolute>{1,2}",
  10012. media: "all",
  10013. initial: "normal",
  10014. percentages: "no",
  10015. computed: "asSpecified",
  10016. order: "uniqueOrder",
  10017. status: "standard"
  10018. },
  10019. "font-variant": {
  10020. syntax: "normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> || stylistic(<feature-value-name>) || historical-forms || styleset(<feature-value-name>#) || character-variant(<feature-value-name>#) || swash(<feature-value-name>) || ornaments(<feature-value-name>) || annotation(<feature-value-name>) || [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ] || <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero || <east-asian-variant-values> || <east-asian-width-values> || ruby ]",
  10021. media: "all",
  10022. initial: "normal",
  10023. percentages: "no",
  10024. computed: "asSpecified",
  10025. order: "orderOfAppearance",
  10026. status: "standard"
  10027. },
  10028. src: {
  10029. syntax: "[ <url> [ format( <string># ) ]? | local( <family-name> ) ]#",
  10030. media: "all",
  10031. initial: "n/a (required)",
  10032. percentages: "no",
  10033. computed: "asSpecified",
  10034. order: "orderOfAppearance",
  10035. status: "standard"
  10036. },
  10037. "unicode-range": {
  10038. syntax: "<unicode-range>#",
  10039. media: "all",
  10040. initial: "U+0-10FFFF",
  10041. percentages: "no",
  10042. computed: "asSpecified",
  10043. order: "orderOfAppearance",
  10044. status: "standard"
  10045. }
  10046. },
  10047. status: "standard",
  10048. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@font-face"
  10049. },
  10050. "@font-feature-values": {
  10051. syntax: "@font-feature-values <family-name># {\n <feature-value-block-list>\n}",
  10052. interfaces: [
  10053. "CSSFontFeatureValuesRule"
  10054. ],
  10055. groups: [
  10056. "CSS Fonts"
  10057. ],
  10058. status: "standard",
  10059. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@font-feature-values"
  10060. },
  10061. "@import": {
  10062. syntax: "@import [ <string> | <url> ] [ <media-query-list> ]?;",
  10063. groups: [
  10064. "Media Queries"
  10065. ],
  10066. status: "standard",
  10067. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@import"
  10068. },
  10069. "@keyframes": {
  10070. syntax: "@keyframes <keyframes-name> {\n <keyframe-block-list>\n}",
  10071. interfaces: [
  10072. "CSSKeyframeRule",
  10073. "CSSKeyframesRule"
  10074. ],
  10075. groups: [
  10076. "CSS Animations"
  10077. ],
  10078. status: "standard",
  10079. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@keyframes"
  10080. },
  10081. "@media": {
  10082. syntax: "@media <media-query-list> {\n <group-rule-body>\n}",
  10083. interfaces: [
  10084. "CSSGroupingRule",
  10085. "CSSConditionRule",
  10086. "CSSMediaRule",
  10087. "CSSCustomMediaRule"
  10088. ],
  10089. groups: [
  10090. "CSS Conditional Rules",
  10091. "Media Queries"
  10092. ],
  10093. status: "standard",
  10094. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@media"
  10095. },
  10096. "@namespace": {
  10097. syntax: "@namespace <namespace-prefix>? [ <string> | <url> ];",
  10098. groups: [
  10099. "CSS Namespaces"
  10100. ],
  10101. status: "standard",
  10102. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@namespace"
  10103. },
  10104. "@page": {
  10105. syntax: "@page <page-selector-list> {\n <page-body>\n}",
  10106. interfaces: [
  10107. "CSSPageRule"
  10108. ],
  10109. groups: [
  10110. "CSS Pages"
  10111. ],
  10112. descriptors: {
  10113. bleed: {
  10114. syntax: "auto | <length>",
  10115. media: [
  10116. "visual",
  10117. "paged"
  10118. ],
  10119. initial: "auto",
  10120. percentages: "no",
  10121. computed: "asSpecified",
  10122. order: "uniqueOrder",
  10123. status: "standard"
  10124. },
  10125. marks: {
  10126. syntax: "none | [ crop || cross ]",
  10127. media: [
  10128. "visual",
  10129. "paged"
  10130. ],
  10131. initial: "none",
  10132. percentages: "no",
  10133. computed: "asSpecified",
  10134. order: "orderOfAppearance",
  10135. status: "standard"
  10136. },
  10137. size: {
  10138. syntax: "<length>{1,2} | auto | [ <page-size> || [ portrait | landscape ] ]",
  10139. media: [
  10140. "visual",
  10141. "paged"
  10142. ],
  10143. initial: "auto",
  10144. percentages: "no",
  10145. computed: "asSpecifiedRelativeToAbsoluteLengths",
  10146. order: "orderOfAppearance",
  10147. status: "standard"
  10148. }
  10149. },
  10150. status: "standard",
  10151. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@page"
  10152. },
  10153. "@property": {
  10154. syntax: "@property <custom-property-name> {\n <declaration-list>\n}",
  10155. interfaces: [
  10156. "CSS",
  10157. "CSSPropertyRule"
  10158. ],
  10159. groups: [
  10160. "CSS Houdini"
  10161. ],
  10162. descriptors: {
  10163. syntax: {
  10164. syntax: "<string>",
  10165. media: "all",
  10166. percentages: "no",
  10167. initial: "n/a (required)",
  10168. computed: "asSpecified",
  10169. order: "uniqueOrder",
  10170. status: "experimental"
  10171. },
  10172. inherits: {
  10173. syntax: "true | false",
  10174. media: "all",
  10175. percentages: "no",
  10176. initial: "auto",
  10177. computed: "asSpecified",
  10178. order: "uniqueOrder",
  10179. status: "experimental"
  10180. },
  10181. "initial-value": {
  10182. syntax: "<string>",
  10183. media: "all",
  10184. initial: "n/a (required)",
  10185. percentages: "no",
  10186. computed: "asSpecified",
  10187. order: "uniqueOrder",
  10188. status: "experimental"
  10189. }
  10190. },
  10191. status: "experimental",
  10192. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@property"
  10193. },
  10194. "@supports": {
  10195. syntax: "@supports <supports-condition> {\n <group-rule-body>\n}",
  10196. interfaces: [
  10197. "CSSGroupingRule",
  10198. "CSSConditionRule",
  10199. "CSSSupportsRule"
  10200. ],
  10201. groups: [
  10202. "CSS Conditional Rules"
  10203. ],
  10204. status: "standard",
  10205. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@supports"
  10206. },
  10207. "@viewport": {
  10208. syntax: "@viewport {\n <group-rule-body>\n}",
  10209. interfaces: [
  10210. "CSSViewportRule"
  10211. ],
  10212. groups: [
  10213. "CSS Device Adaptation"
  10214. ],
  10215. descriptors: {
  10216. height: {
  10217. syntax: "<viewport-length>{1,2}",
  10218. media: [
  10219. "visual",
  10220. "continuous"
  10221. ],
  10222. initial: [
  10223. "min-height",
  10224. "max-height"
  10225. ],
  10226. percentages: [
  10227. "min-height",
  10228. "max-height"
  10229. ],
  10230. computed: [
  10231. "min-height",
  10232. "max-height"
  10233. ],
  10234. order: "orderOfAppearance",
  10235. status: "standard"
  10236. },
  10237. "max-height": {
  10238. syntax: "<viewport-length>",
  10239. media: [
  10240. "visual",
  10241. "continuous"
  10242. ],
  10243. initial: "auto",
  10244. percentages: "referToHeightOfInitialViewport",
  10245. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  10246. order: "uniqueOrder",
  10247. status: "standard"
  10248. },
  10249. "max-width": {
  10250. syntax: "<viewport-length>",
  10251. media: [
  10252. "visual",
  10253. "continuous"
  10254. ],
  10255. initial: "auto",
  10256. percentages: "referToWidthOfInitialViewport",
  10257. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  10258. order: "uniqueOrder",
  10259. status: "standard"
  10260. },
  10261. "max-zoom": {
  10262. syntax: "auto | <number> | <percentage>",
  10263. media: [
  10264. "visual",
  10265. "continuous"
  10266. ],
  10267. initial: "auto",
  10268. percentages: "the zoom factor itself",
  10269. computed: "autoNonNegativeOrPercentage",
  10270. order: "uniqueOrder",
  10271. status: "standard"
  10272. },
  10273. "min-height": {
  10274. syntax: "<viewport-length>",
  10275. media: [
  10276. "visual",
  10277. "continuous"
  10278. ],
  10279. initial: "auto",
  10280. percentages: "referToHeightOfInitialViewport",
  10281. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  10282. order: "uniqueOrder",
  10283. status: "standard"
  10284. },
  10285. "min-width": {
  10286. syntax: "<viewport-length>",
  10287. media: [
  10288. "visual",
  10289. "continuous"
  10290. ],
  10291. initial: "auto",
  10292. percentages: "referToWidthOfInitialViewport",
  10293. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  10294. order: "uniqueOrder",
  10295. status: "standard"
  10296. },
  10297. "min-zoom": {
  10298. syntax: "auto | <number> | <percentage>",
  10299. media: [
  10300. "visual",
  10301. "continuous"
  10302. ],
  10303. initial: "auto",
  10304. percentages: "the zoom factor itself",
  10305. computed: "autoNonNegativeOrPercentage",
  10306. order: "uniqueOrder",
  10307. status: "standard"
  10308. },
  10309. orientation: {
  10310. syntax: "auto | portrait | landscape",
  10311. media: [
  10312. "visual",
  10313. "continuous"
  10314. ],
  10315. initial: "auto",
  10316. percentages: "referToSizeOfBoundingBox",
  10317. computed: "asSpecified",
  10318. order: "uniqueOrder",
  10319. status: "standard"
  10320. },
  10321. "user-zoom": {
  10322. syntax: "zoom | fixed",
  10323. media: [
  10324. "visual",
  10325. "continuous"
  10326. ],
  10327. initial: "zoom",
  10328. percentages: "referToSizeOfBoundingBox",
  10329. computed: "asSpecified",
  10330. order: "uniqueOrder",
  10331. status: "standard"
  10332. },
  10333. "viewport-fit": {
  10334. syntax: "auto | contain | cover",
  10335. media: [
  10336. "visual",
  10337. "continuous"
  10338. ],
  10339. initial: "auto",
  10340. percentages: "no",
  10341. computed: "asSpecified",
  10342. order: "uniqueOrder",
  10343. status: "standard"
  10344. },
  10345. width: {
  10346. syntax: "<viewport-length>{1,2}",
  10347. media: [
  10348. "visual",
  10349. "continuous"
  10350. ],
  10351. initial: [
  10352. "min-width",
  10353. "max-width"
  10354. ],
  10355. percentages: [
  10356. "min-width",
  10357. "max-width"
  10358. ],
  10359. computed: [
  10360. "min-width",
  10361. "max-width"
  10362. ],
  10363. order: "orderOfAppearance",
  10364. status: "standard"
  10365. },
  10366. zoom: {
  10367. syntax: "auto | <number> | <percentage>",
  10368. media: [
  10369. "visual",
  10370. "continuous"
  10371. ],
  10372. initial: "auto",
  10373. percentages: "the zoom factor itself",
  10374. computed: "autoNonNegativeOrPercentage",
  10375. order: "uniqueOrder",
  10376. status: "standard"
  10377. }
  10378. },
  10379. status: "standard",
  10380. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@viewport"
  10381. }
  10382. };
  10383. var all = {
  10384. syntax: "initial | inherit | unset | revert",
  10385. media: "noPracticalMedia",
  10386. inherited: false,
  10387. animationType: "eachOfShorthandPropertiesExceptUnicodeBiDiAndDirection",
  10388. percentages: "no",
  10389. groups: [
  10390. "CSS Miscellaneous"
  10391. ],
  10392. initial: "noPracticalInitialValue",
  10393. appliesto: "allElements",
  10394. computed: "asSpecifiedAppliesToEachProperty",
  10395. order: "uniqueOrder",
  10396. status: "standard",
  10397. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/all"
  10398. };
  10399. var animation = {
  10400. syntax: "<single-animation>#",
  10401. media: "visual",
  10402. inherited: false,
  10403. animationType: "discrete",
  10404. percentages: "no",
  10405. groups: [
  10406. "CSS Animations"
  10407. ],
  10408. initial: [
  10409. "animation-name",
  10410. "animation-duration",
  10411. "animation-timing-function",
  10412. "animation-delay",
  10413. "animation-iteration-count",
  10414. "animation-direction",
  10415. "animation-fill-mode",
  10416. "animation-play-state"
  10417. ],
  10418. appliesto: "allElementsAndPseudos",
  10419. computed: [
  10420. "animation-name",
  10421. "animation-duration",
  10422. "animation-timing-function",
  10423. "animation-delay",
  10424. "animation-direction",
  10425. "animation-iteration-count",
  10426. "animation-fill-mode",
  10427. "animation-play-state"
  10428. ],
  10429. order: "orderOfAppearance",
  10430. status: "standard",
  10431. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation"
  10432. };
  10433. var appearance = {
  10434. syntax: "none | auto | textfield | menulist-button | <compat-auto>",
  10435. media: "all",
  10436. inherited: false,
  10437. animationType: "discrete",
  10438. percentages: "no",
  10439. groups: [
  10440. "CSS Basic User Interface"
  10441. ],
  10442. initial: "auto",
  10443. appliesto: "allElements",
  10444. computed: "asSpecified",
  10445. order: "perGrammar",
  10446. status: "experimental",
  10447. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/appearance"
  10448. };
  10449. var azimuth = {
  10450. syntax: "<angle> | [ [ left-side | far-left | left | center-left | center | center-right | right | far-right | right-side ] || behind ] | leftwards | rightwards",
  10451. media: "aural",
  10452. inherited: true,
  10453. animationType: "discrete",
  10454. percentages: "no",
  10455. groups: [
  10456. "CSS Speech"
  10457. ],
  10458. initial: "center",
  10459. appliesto: "allElements",
  10460. computed: "normalizedAngle",
  10461. order: "orderOfAppearance",
  10462. status: "obsolete",
  10463. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/azimuth"
  10464. };
  10465. var background = {
  10466. syntax: "[ <bg-layer> , ]* <final-bg-layer>",
  10467. media: "visual",
  10468. inherited: false,
  10469. animationType: [
  10470. "background-color",
  10471. "background-image",
  10472. "background-clip",
  10473. "background-position",
  10474. "background-size",
  10475. "background-repeat",
  10476. "background-attachment"
  10477. ],
  10478. percentages: [
  10479. "background-position",
  10480. "background-size"
  10481. ],
  10482. groups: [
  10483. "CSS Backgrounds and Borders"
  10484. ],
  10485. initial: [
  10486. "background-image",
  10487. "background-position",
  10488. "background-size",
  10489. "background-repeat",
  10490. "background-origin",
  10491. "background-clip",
  10492. "background-attachment",
  10493. "background-color"
  10494. ],
  10495. appliesto: "allElements",
  10496. computed: [
  10497. "background-image",
  10498. "background-position",
  10499. "background-size",
  10500. "background-repeat",
  10501. "background-origin",
  10502. "background-clip",
  10503. "background-attachment",
  10504. "background-color"
  10505. ],
  10506. order: "orderOfAppearance",
  10507. alsoAppliesTo: [
  10508. "::first-letter",
  10509. "::first-line",
  10510. "::placeholder"
  10511. ],
  10512. status: "standard",
  10513. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background"
  10514. };
  10515. var border = {
  10516. syntax: "<line-width> || <line-style> || <color>",
  10517. media: "visual",
  10518. inherited: false,
  10519. animationType: [
  10520. "border-color",
  10521. "border-style",
  10522. "border-width"
  10523. ],
  10524. percentages: "no",
  10525. groups: [
  10526. "CSS Backgrounds and Borders"
  10527. ],
  10528. initial: [
  10529. "border-width",
  10530. "border-style",
  10531. "border-color"
  10532. ],
  10533. appliesto: "allElements",
  10534. computed: [
  10535. "border-width",
  10536. "border-style",
  10537. "border-color"
  10538. ],
  10539. order: "orderOfAppearance",
  10540. alsoAppliesTo: [
  10541. "::first-letter"
  10542. ],
  10543. status: "standard",
  10544. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border"
  10545. };
  10546. var bottom = {
  10547. syntax: "<length> | <percentage> | auto",
  10548. media: "visual",
  10549. inherited: false,
  10550. animationType: "lpc",
  10551. percentages: "referToContainingBlockHeight",
  10552. groups: [
  10553. "CSS Positioning"
  10554. ],
  10555. initial: "auto",
  10556. appliesto: "positionedElements",
  10557. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  10558. order: "uniqueOrder",
  10559. status: "standard",
  10560. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/bottom"
  10561. };
  10562. var clear = {
  10563. syntax: "none | left | right | both | inline-start | inline-end",
  10564. media: "visual",
  10565. inherited: false,
  10566. animationType: "discrete",
  10567. percentages: "no",
  10568. groups: [
  10569. "CSS Positioning"
  10570. ],
  10571. initial: "none",
  10572. appliesto: "blockLevelElements",
  10573. computed: "asSpecified",
  10574. order: "uniqueOrder",
  10575. status: "standard",
  10576. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/clear"
  10577. };
  10578. var clip = {
  10579. syntax: "<shape> | auto",
  10580. media: "visual",
  10581. inherited: false,
  10582. animationType: "rectangle",
  10583. percentages: "no",
  10584. groups: [
  10585. "CSS Masking"
  10586. ],
  10587. initial: "auto",
  10588. appliesto: "absolutelyPositionedElements",
  10589. computed: "autoOrRectangle",
  10590. order: "uniqueOrder",
  10591. status: "standard",
  10592. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/clip"
  10593. };
  10594. var color$1 = {
  10595. syntax: "<color>",
  10596. media: "visual",
  10597. inherited: true,
  10598. animationType: "color",
  10599. percentages: "no",
  10600. groups: [
  10601. "CSS Color"
  10602. ],
  10603. initial: "variesFromBrowserToBrowser",
  10604. appliesto: "allElements",
  10605. computed: "translucentValuesRGBAOtherwiseRGB",
  10606. order: "uniqueOrder",
  10607. alsoAppliesTo: [
  10608. "::first-letter",
  10609. "::first-line",
  10610. "::placeholder"
  10611. ],
  10612. status: "standard",
  10613. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/color"
  10614. };
  10615. var columns = {
  10616. syntax: "<'column-width'> || <'column-count'>",
  10617. media: "visual",
  10618. inherited: false,
  10619. animationType: [
  10620. "column-width",
  10621. "column-count"
  10622. ],
  10623. percentages: "no",
  10624. groups: [
  10625. "CSS Columns"
  10626. ],
  10627. initial: [
  10628. "column-width",
  10629. "column-count"
  10630. ],
  10631. appliesto: "blockContainersExceptTableWrappers",
  10632. computed: [
  10633. "column-width",
  10634. "column-count"
  10635. ],
  10636. order: "perGrammar",
  10637. status: "standard",
  10638. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/columns"
  10639. };
  10640. var contain = {
  10641. syntax: "none | strict | content | [ size || layout || style || paint ]",
  10642. media: "all",
  10643. inherited: false,
  10644. animationType: "discrete",
  10645. percentages: "no",
  10646. groups: [
  10647. "CSS Containment"
  10648. ],
  10649. initial: "none",
  10650. appliesto: "allElements",
  10651. computed: "asSpecified",
  10652. order: "perGrammar",
  10653. status: "standard",
  10654. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/contain"
  10655. };
  10656. var content = {
  10657. syntax: "normal | none | [ <content-replacement> | <content-list> ] [/ <string> ]?",
  10658. media: "all",
  10659. inherited: false,
  10660. animationType: "discrete",
  10661. percentages: "no",
  10662. groups: [
  10663. "CSS Generated Content"
  10664. ],
  10665. initial: "normal",
  10666. appliesto: "beforeAndAfterPseudos",
  10667. computed: "normalOnElementsForPseudosNoneAbsoluteURIStringOrAsSpecified",
  10668. order: "uniqueOrder",
  10669. status: "standard",
  10670. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/content"
  10671. };
  10672. var cursor = {
  10673. syntax: "[ [ <url> [ <x> <y> ]? , ]* [ auto | default | none | context-menu | help | pointer | progress | wait | cell | crosshair | text | vertical-text | alias | copy | move | no-drop | not-allowed | e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out | grab | grabbing ] ]",
  10674. media: [
  10675. "visual",
  10676. "interactive"
  10677. ],
  10678. inherited: true,
  10679. animationType: "discrete",
  10680. percentages: "no",
  10681. groups: [
  10682. "CSS Basic User Interface"
  10683. ],
  10684. initial: "auto",
  10685. appliesto: "allElements",
  10686. computed: "asSpecifiedURLsAbsolute",
  10687. order: "uniqueOrder",
  10688. status: "standard",
  10689. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/cursor"
  10690. };
  10691. var direction = {
  10692. syntax: "ltr | rtl",
  10693. media: "visual",
  10694. inherited: true,
  10695. animationType: "discrete",
  10696. percentages: "no",
  10697. groups: [
  10698. "CSS Writing Modes"
  10699. ],
  10700. initial: "ltr",
  10701. appliesto: "allElements",
  10702. computed: "asSpecified",
  10703. order: "uniqueOrder",
  10704. status: "standard",
  10705. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/direction"
  10706. };
  10707. var display = {
  10708. syntax: "[ <display-outside> || <display-inside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy>",
  10709. media: "all",
  10710. inherited: false,
  10711. animationType: "discrete",
  10712. percentages: "no",
  10713. groups: [
  10714. "CSS Display"
  10715. ],
  10716. initial: "inline",
  10717. appliesto: "allElements",
  10718. computed: "asSpecifiedExceptPositionedFloatingAndRootElementsKeywordMaybeDifferent",
  10719. order: "uniqueOrder",
  10720. status: "standard",
  10721. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/display"
  10722. };
  10723. var filter = {
  10724. syntax: "none | <filter-function-list>",
  10725. media: "visual",
  10726. inherited: false,
  10727. animationType: "filterList",
  10728. percentages: "no",
  10729. groups: [
  10730. "Filter Effects"
  10731. ],
  10732. initial: "none",
  10733. appliesto: "allElementsSVGContainerElements",
  10734. computed: "asSpecified",
  10735. order: "uniqueOrder",
  10736. status: "standard",
  10737. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/filter"
  10738. };
  10739. var flex = {
  10740. syntax: "none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]",
  10741. media: "visual",
  10742. inherited: false,
  10743. animationType: [
  10744. "flex-grow",
  10745. "flex-shrink",
  10746. "flex-basis"
  10747. ],
  10748. percentages: "no",
  10749. groups: [
  10750. "CSS Flexible Box Layout"
  10751. ],
  10752. initial: [
  10753. "flex-grow",
  10754. "flex-shrink",
  10755. "flex-basis"
  10756. ],
  10757. appliesto: "flexItemsAndInFlowPseudos",
  10758. computed: [
  10759. "flex-grow",
  10760. "flex-shrink",
  10761. "flex-basis"
  10762. ],
  10763. order: "orderOfAppearance",
  10764. status: "standard",
  10765. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex"
  10766. };
  10767. var float = {
  10768. syntax: "left | right | none | inline-start | inline-end",
  10769. media: "visual",
  10770. inherited: false,
  10771. animationType: "discrete",
  10772. percentages: "no",
  10773. groups: [
  10774. "CSS Positioning"
  10775. ],
  10776. initial: "none",
  10777. appliesto: "allElementsNoEffectIfDisplayNone",
  10778. computed: "asSpecified",
  10779. order: "uniqueOrder",
  10780. status: "standard",
  10781. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/float"
  10782. };
  10783. var font = {
  10784. syntax: "[ [ <'font-style'> || <font-variant-css21> || <'font-weight'> || <'font-stretch'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar",
  10785. media: "visual",
  10786. inherited: true,
  10787. animationType: [
  10788. "font-style",
  10789. "font-variant",
  10790. "font-weight",
  10791. "font-stretch",
  10792. "font-size",
  10793. "line-height",
  10794. "font-family"
  10795. ],
  10796. percentages: [
  10797. "font-size",
  10798. "line-height"
  10799. ],
  10800. groups: [
  10801. "CSS Fonts"
  10802. ],
  10803. initial: [
  10804. "font-style",
  10805. "font-variant",
  10806. "font-weight",
  10807. "font-stretch",
  10808. "font-size",
  10809. "line-height",
  10810. "font-family"
  10811. ],
  10812. appliesto: "allElements",
  10813. computed: [
  10814. "font-style",
  10815. "font-variant",
  10816. "font-weight",
  10817. "font-stretch",
  10818. "font-size",
  10819. "line-height",
  10820. "font-family"
  10821. ],
  10822. order: "orderOfAppearance",
  10823. alsoAppliesTo: [
  10824. "::first-letter",
  10825. "::first-line",
  10826. "::placeholder"
  10827. ],
  10828. status: "standard",
  10829. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font"
  10830. };
  10831. var gap = {
  10832. syntax: "<'row-gap'> <'column-gap'>?",
  10833. media: "visual",
  10834. inherited: false,
  10835. animationType: [
  10836. "row-gap",
  10837. "column-gap"
  10838. ],
  10839. percentages: "no",
  10840. groups: [
  10841. "CSS Box Alignment"
  10842. ],
  10843. initial: [
  10844. "row-gap",
  10845. "column-gap"
  10846. ],
  10847. appliesto: "multiColumnElementsFlexContainersGridContainers",
  10848. computed: [
  10849. "row-gap",
  10850. "column-gap"
  10851. ],
  10852. order: "uniqueOrder",
  10853. status: "standard",
  10854. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/gap"
  10855. };
  10856. var grid = {
  10857. syntax: "<'grid-template'> | <'grid-template-rows'> / [ auto-flow && dense? ] <'grid-auto-columns'>? | [ auto-flow && dense? ] <'grid-auto-rows'>? / <'grid-template-columns'>",
  10858. media: "visual",
  10859. inherited: false,
  10860. animationType: "discrete",
  10861. percentages: [
  10862. "grid-template-rows",
  10863. "grid-template-columns",
  10864. "grid-auto-rows",
  10865. "grid-auto-columns"
  10866. ],
  10867. groups: [
  10868. "CSS Grid Layout"
  10869. ],
  10870. initial: [
  10871. "grid-template-rows",
  10872. "grid-template-columns",
  10873. "grid-template-areas",
  10874. "grid-auto-rows",
  10875. "grid-auto-columns",
  10876. "grid-auto-flow",
  10877. "grid-column-gap",
  10878. "grid-row-gap",
  10879. "column-gap",
  10880. "row-gap"
  10881. ],
  10882. appliesto: "gridContainers",
  10883. computed: [
  10884. "grid-template-rows",
  10885. "grid-template-columns",
  10886. "grid-template-areas",
  10887. "grid-auto-rows",
  10888. "grid-auto-columns",
  10889. "grid-auto-flow",
  10890. "grid-column-gap",
  10891. "grid-row-gap",
  10892. "column-gap",
  10893. "row-gap"
  10894. ],
  10895. order: "uniqueOrder",
  10896. status: "standard",
  10897. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid"
  10898. };
  10899. var height = {
  10900. syntax: "auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)",
  10901. media: "visual",
  10902. inherited: false,
  10903. animationType: "lpc",
  10904. percentages: "regardingHeightOfGeneratedBoxContainingBlockPercentagesRelativeToContainingBlock",
  10905. groups: [
  10906. "CSS Box Model"
  10907. ],
  10908. initial: "auto",
  10909. appliesto: "allElementsButNonReplacedAndTableColumns",
  10910. computed: "percentageAutoOrAbsoluteLength",
  10911. order: "uniqueOrder",
  10912. status: "standard",
  10913. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/height"
  10914. };
  10915. var hyphens = {
  10916. syntax: "none | manual | auto",
  10917. media: "visual",
  10918. inherited: true,
  10919. animationType: "discrete",
  10920. percentages: "no",
  10921. groups: [
  10922. "CSS Text"
  10923. ],
  10924. initial: "manual",
  10925. appliesto: "allElements",
  10926. computed: "asSpecified",
  10927. order: "uniqueOrder",
  10928. status: "standard",
  10929. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/hyphens"
  10930. };
  10931. var inset = {
  10932. syntax: "<'top'>{1,4}",
  10933. media: "visual",
  10934. inherited: false,
  10935. animationType: "lpc",
  10936. percentages: "logicalHeightOfContainingBlock",
  10937. groups: [
  10938. "CSS Logical Properties"
  10939. ],
  10940. initial: "auto",
  10941. appliesto: "positionedElements",
  10942. computed: "sameAsBoxOffsets",
  10943. order: "uniqueOrder",
  10944. status: "standard",
  10945. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset"
  10946. };
  10947. var isolation = {
  10948. syntax: "auto | isolate",
  10949. media: "visual",
  10950. inherited: false,
  10951. animationType: "discrete",
  10952. percentages: "no",
  10953. groups: [
  10954. "Compositing and Blending"
  10955. ],
  10956. initial: "auto",
  10957. appliesto: "allElementsSVGContainerGraphicsAndGraphicsReferencingElements",
  10958. computed: "asSpecified",
  10959. order: "uniqueOrder",
  10960. status: "standard",
  10961. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/isolation"
  10962. };
  10963. var left = {
  10964. syntax: "<length> | <percentage> | auto",
  10965. media: "visual",
  10966. inherited: false,
  10967. animationType: "lpc",
  10968. percentages: "referToWidthOfContainingBlock",
  10969. groups: [
  10970. "CSS Positioning"
  10971. ],
  10972. initial: "auto",
  10973. appliesto: "positionedElements",
  10974. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  10975. order: "uniqueOrder",
  10976. status: "standard",
  10977. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/left"
  10978. };
  10979. var margin = {
  10980. syntax: "[ <length> | <percentage> | auto ]{1,4}",
  10981. media: "visual",
  10982. inherited: false,
  10983. animationType: "length",
  10984. percentages: "referToWidthOfContainingBlock",
  10985. groups: [
  10986. "CSS Box Model"
  10987. ],
  10988. initial: [
  10989. "margin-bottom",
  10990. "margin-left",
  10991. "margin-right",
  10992. "margin-top"
  10993. ],
  10994. appliesto: "allElementsExceptTableDisplayTypes",
  10995. computed: [
  10996. "margin-bottom",
  10997. "margin-left",
  10998. "margin-right",
  10999. "margin-top"
  11000. ],
  11001. order: "uniqueOrder",
  11002. alsoAppliesTo: [
  11003. "::first-letter",
  11004. "::first-line"
  11005. ],
  11006. status: "standard",
  11007. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin"
  11008. };
  11009. var mask = {
  11010. syntax: "<mask-layer>#",
  11011. media: "visual",
  11012. inherited: false,
  11013. animationType: [
  11014. "mask-image",
  11015. "mask-mode",
  11016. "mask-repeat",
  11017. "mask-position",
  11018. "mask-clip",
  11019. "mask-origin",
  11020. "mask-size",
  11021. "mask-composite"
  11022. ],
  11023. percentages: [
  11024. "mask-position"
  11025. ],
  11026. groups: [
  11027. "CSS Masking"
  11028. ],
  11029. initial: [
  11030. "mask-image",
  11031. "mask-mode",
  11032. "mask-repeat",
  11033. "mask-position",
  11034. "mask-clip",
  11035. "mask-origin",
  11036. "mask-size",
  11037. "mask-composite"
  11038. ],
  11039. appliesto: "allElementsSVGContainerElements",
  11040. computed: [
  11041. "mask-image",
  11042. "mask-mode",
  11043. "mask-repeat",
  11044. "mask-position",
  11045. "mask-clip",
  11046. "mask-origin",
  11047. "mask-size",
  11048. "mask-composite"
  11049. ],
  11050. order: "perGrammar",
  11051. stacking: true,
  11052. status: "standard",
  11053. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask"
  11054. };
  11055. var offset = {
  11056. syntax: "[ <'offset-position'>? [ <'offset-path'> [ <'offset-distance'> || <'offset-rotate'> ]? ]? ]! [ / <'offset-anchor'> ]?",
  11057. media: "visual",
  11058. inherited: false,
  11059. animationType: [
  11060. "offset-position",
  11061. "offset-path",
  11062. "offset-distance",
  11063. "offset-anchor",
  11064. "offset-rotate"
  11065. ],
  11066. percentages: [
  11067. "offset-position",
  11068. "offset-distance",
  11069. "offset-anchor"
  11070. ],
  11071. groups: [
  11072. "CSS Motion Path"
  11073. ],
  11074. initial: [
  11075. "offset-position",
  11076. "offset-path",
  11077. "offset-distance",
  11078. "offset-anchor",
  11079. "offset-rotate"
  11080. ],
  11081. appliesto: "transformableElements",
  11082. computed: [
  11083. "offset-position",
  11084. "offset-path",
  11085. "offset-distance",
  11086. "offset-anchor",
  11087. "offset-rotate"
  11088. ],
  11089. order: "perGrammar",
  11090. stacking: true,
  11091. status: "standard",
  11092. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset"
  11093. };
  11094. var opacity = {
  11095. syntax: "<alpha-value>",
  11096. media: "visual",
  11097. inherited: false,
  11098. animationType: "number",
  11099. percentages: "no",
  11100. groups: [
  11101. "CSS Color"
  11102. ],
  11103. initial: "1.0",
  11104. appliesto: "allElements",
  11105. computed: "specifiedValueClipped0To1",
  11106. order: "uniqueOrder",
  11107. alsoAppliesTo: [
  11108. "::placeholder"
  11109. ],
  11110. status: "standard",
  11111. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/opacity"
  11112. };
  11113. var order = {
  11114. syntax: "<integer>",
  11115. media: "visual",
  11116. inherited: false,
  11117. animationType: "integer",
  11118. percentages: "no",
  11119. groups: [
  11120. "CSS Flexible Box Layout"
  11121. ],
  11122. initial: "0",
  11123. appliesto: "flexItemsGridItemsAbsolutelyPositionedContainerChildren",
  11124. computed: "asSpecified",
  11125. order: "uniqueOrder",
  11126. status: "standard",
  11127. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/order"
  11128. };
  11129. var orphans = {
  11130. syntax: "<integer>",
  11131. media: "visual",
  11132. inherited: true,
  11133. animationType: "discrete",
  11134. percentages: "no",
  11135. groups: [
  11136. "CSS Fragmentation"
  11137. ],
  11138. initial: "2",
  11139. appliesto: "blockContainerElements",
  11140. computed: "asSpecified",
  11141. order: "perGrammar",
  11142. status: "standard",
  11143. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/orphans"
  11144. };
  11145. var outline = {
  11146. syntax: "[ <'outline-color'> || <'outline-style'> || <'outline-width'> ]",
  11147. media: [
  11148. "visual",
  11149. "interactive"
  11150. ],
  11151. inherited: false,
  11152. animationType: [
  11153. "outline-color",
  11154. "outline-width",
  11155. "outline-style"
  11156. ],
  11157. percentages: "no",
  11158. groups: [
  11159. "CSS Basic User Interface"
  11160. ],
  11161. initial: [
  11162. "outline-color",
  11163. "outline-style",
  11164. "outline-width"
  11165. ],
  11166. appliesto: "allElements",
  11167. computed: [
  11168. "outline-color",
  11169. "outline-width",
  11170. "outline-style"
  11171. ],
  11172. order: "orderOfAppearance",
  11173. status: "standard",
  11174. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline"
  11175. };
  11176. var overflow = {
  11177. syntax: "[ visible | hidden | clip | scroll | auto ]{1,2}",
  11178. media: "visual",
  11179. inherited: false,
  11180. animationType: "discrete",
  11181. percentages: "no",
  11182. groups: [
  11183. "CSS Overflow"
  11184. ],
  11185. initial: "visible",
  11186. appliesto: "blockContainersFlexContainersGridContainers",
  11187. computed: [
  11188. "overflow-x",
  11189. "overflow-y"
  11190. ],
  11191. order: "uniqueOrder",
  11192. status: "standard",
  11193. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow"
  11194. };
  11195. var padding = {
  11196. syntax: "[ <length> | <percentage> ]{1,4}",
  11197. media: "visual",
  11198. inherited: false,
  11199. animationType: "length",
  11200. percentages: "referToWidthOfContainingBlock",
  11201. groups: [
  11202. "CSS Box Model"
  11203. ],
  11204. initial: [
  11205. "padding-bottom",
  11206. "padding-left",
  11207. "padding-right",
  11208. "padding-top"
  11209. ],
  11210. appliesto: "allElementsExceptInternalTableDisplayTypes",
  11211. computed: [
  11212. "padding-bottom",
  11213. "padding-left",
  11214. "padding-right",
  11215. "padding-top"
  11216. ],
  11217. order: "uniqueOrder",
  11218. alsoAppliesTo: [
  11219. "::first-letter",
  11220. "::first-line"
  11221. ],
  11222. status: "standard",
  11223. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding"
  11224. };
  11225. var perspective = {
  11226. syntax: "none | <length>",
  11227. media: "visual",
  11228. inherited: false,
  11229. animationType: "length",
  11230. percentages: "no",
  11231. groups: [
  11232. "CSS Transforms"
  11233. ],
  11234. initial: "none",
  11235. appliesto: "transformableElements",
  11236. computed: "absoluteLengthOrNone",
  11237. order: "uniqueOrder",
  11238. stacking: true,
  11239. status: "standard",
  11240. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/perspective"
  11241. };
  11242. var position$1 = {
  11243. syntax: "static | relative | absolute | sticky | fixed",
  11244. media: "visual",
  11245. inherited: false,
  11246. animationType: "discrete",
  11247. percentages: "no",
  11248. groups: [
  11249. "CSS Positioning"
  11250. ],
  11251. initial: "static",
  11252. appliesto: "allElements",
  11253. computed: "asSpecified",
  11254. order: "uniqueOrder",
  11255. stacking: true,
  11256. status: "standard",
  11257. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/position"
  11258. };
  11259. var quotes = {
  11260. syntax: "none | auto | [ <string> <string> ]+",
  11261. media: "visual",
  11262. inherited: true,
  11263. animationType: "discrete",
  11264. percentages: "no",
  11265. groups: [
  11266. "CSS Generated Content"
  11267. ],
  11268. initial: "dependsOnUserAgent",
  11269. appliesto: "allElements",
  11270. computed: "asSpecified",
  11271. order: "uniqueOrder",
  11272. status: "standard",
  11273. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/quotes"
  11274. };
  11275. var resize = {
  11276. syntax: "none | both | horizontal | vertical | block | inline",
  11277. media: "visual",
  11278. inherited: false,
  11279. animationType: "discrete",
  11280. percentages: "no",
  11281. groups: [
  11282. "CSS Basic User Interface"
  11283. ],
  11284. initial: "none",
  11285. appliesto: "elementsWithOverflowNotVisibleAndReplacedElements",
  11286. computed: "asSpecified",
  11287. order: "uniqueOrder",
  11288. status: "standard",
  11289. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/resize"
  11290. };
  11291. var right = {
  11292. syntax: "<length> | <percentage> | auto",
  11293. media: "visual",
  11294. inherited: false,
  11295. animationType: "lpc",
  11296. percentages: "referToWidthOfContainingBlock",
  11297. groups: [
  11298. "CSS Positioning"
  11299. ],
  11300. initial: "auto",
  11301. appliesto: "positionedElements",
  11302. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  11303. order: "uniqueOrder",
  11304. status: "standard",
  11305. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/right"
  11306. };
  11307. var rotate = {
  11308. syntax: "none | <angle> | [ x | y | z | <number>{3} ] && <angle>",
  11309. media: "visual",
  11310. inherited: false,
  11311. animationType: "transform",
  11312. percentages: "no",
  11313. groups: [
  11314. "CSS Transforms"
  11315. ],
  11316. initial: "none",
  11317. appliesto: "transformableElements",
  11318. computed: "asSpecified",
  11319. order: "perGrammar",
  11320. stacking: true,
  11321. status: "standard",
  11322. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/rotate"
  11323. };
  11324. var scale = {
  11325. syntax: "none | <number>{1,3}",
  11326. media: "visual",
  11327. inherited: false,
  11328. animationType: "transform",
  11329. percentages: "no",
  11330. groups: [
  11331. "CSS Transforms"
  11332. ],
  11333. initial: "none",
  11334. appliesto: "transformableElements",
  11335. computed: "asSpecified",
  11336. order: "perGrammar",
  11337. stacking: true,
  11338. status: "standard",
  11339. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scale"
  11340. };
  11341. var top = {
  11342. syntax: "<length> | <percentage> | auto",
  11343. media: "visual",
  11344. inherited: false,
  11345. animationType: "lpc",
  11346. percentages: "referToContainingBlockHeight",
  11347. groups: [
  11348. "CSS Positioning"
  11349. ],
  11350. initial: "auto",
  11351. appliesto: "positionedElements",
  11352. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  11353. order: "uniqueOrder",
  11354. status: "standard",
  11355. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/top"
  11356. };
  11357. var transform = {
  11358. syntax: "none | <transform-list>",
  11359. media: "visual",
  11360. inherited: false,
  11361. animationType: "transform",
  11362. percentages: "referToSizeOfBoundingBox",
  11363. groups: [
  11364. "CSS Transforms"
  11365. ],
  11366. initial: "none",
  11367. appliesto: "transformableElements",
  11368. computed: "asSpecifiedRelativeToAbsoluteLengths",
  11369. order: "uniqueOrder",
  11370. stacking: true,
  11371. status: "standard",
  11372. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform"
  11373. };
  11374. var transition = {
  11375. syntax: "<single-transition>#",
  11376. media: "interactive",
  11377. inherited: false,
  11378. animationType: "discrete",
  11379. percentages: "no",
  11380. groups: [
  11381. "CSS Transitions"
  11382. ],
  11383. initial: [
  11384. "transition-delay",
  11385. "transition-duration",
  11386. "transition-property",
  11387. "transition-timing-function"
  11388. ],
  11389. appliesto: "allElementsAndPseudos",
  11390. computed: [
  11391. "transition-delay",
  11392. "transition-duration",
  11393. "transition-property",
  11394. "transition-timing-function"
  11395. ],
  11396. order: "orderOfAppearance",
  11397. status: "standard",
  11398. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition"
  11399. };
  11400. var translate = {
  11401. syntax: "none | <length-percentage> [ <length-percentage> <length>? ]?",
  11402. media: "visual",
  11403. inherited: false,
  11404. animationType: "transform",
  11405. percentages: "referToSizeOfBoundingBox",
  11406. groups: [
  11407. "CSS Transforms"
  11408. ],
  11409. initial: "none",
  11410. appliesto: "transformableElements",
  11411. computed: "asSpecifiedRelativeToAbsoluteLengths",
  11412. order: "perGrammar",
  11413. stacking: true,
  11414. status: "standard",
  11415. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/translate"
  11416. };
  11417. var visibility = {
  11418. syntax: "visible | hidden | collapse",
  11419. media: "visual",
  11420. inherited: true,
  11421. animationType: "visibility",
  11422. percentages: "no",
  11423. groups: [
  11424. "CSS Box Model"
  11425. ],
  11426. initial: "visible",
  11427. appliesto: "allElements",
  11428. computed: "asSpecified",
  11429. order: "uniqueOrder",
  11430. status: "standard",
  11431. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/visibility"
  11432. };
  11433. var widows = {
  11434. syntax: "<integer>",
  11435. media: "visual",
  11436. inherited: true,
  11437. animationType: "discrete",
  11438. percentages: "no",
  11439. groups: [
  11440. "CSS Fragmentation"
  11441. ],
  11442. initial: "2",
  11443. appliesto: "blockContainerElements",
  11444. computed: "asSpecified",
  11445. order: "perGrammar",
  11446. status: "standard",
  11447. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/widows"
  11448. };
  11449. var width = {
  11450. syntax: "auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)",
  11451. media: "visual",
  11452. inherited: false,
  11453. animationType: "lpc",
  11454. percentages: "referToWidthOfContainingBlock",
  11455. groups: [
  11456. "CSS Box Model"
  11457. ],
  11458. initial: "auto",
  11459. appliesto: "allElementsButNonReplacedAndTableRows",
  11460. computed: "percentageAutoOrAbsoluteLength",
  11461. order: "lengthOrPercentageBeforeKeywordIfBothPresent",
  11462. status: "standard",
  11463. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/width"
  11464. };
  11465. var zoom = {
  11466. syntax: "normal | reset | <number> | <percentage>",
  11467. media: "visual",
  11468. inherited: false,
  11469. animationType: "integer",
  11470. percentages: "no",
  11471. groups: [
  11472. "Microsoft Extensions"
  11473. ],
  11474. initial: "normal",
  11475. appliesto: "allElements",
  11476. computed: "asSpecified",
  11477. order: "uniqueOrder",
  11478. status: "nonstandard",
  11479. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/zoom"
  11480. };
  11481. var require$$1 = {
  11482. "--*": {
  11483. syntax: "<declaration-value>",
  11484. media: "all",
  11485. inherited: true,
  11486. animationType: "discrete",
  11487. percentages: "no",
  11488. groups: [
  11489. "CSS Variables"
  11490. ],
  11491. initial: "seeProse",
  11492. appliesto: "allElements",
  11493. computed: "asSpecifiedWithVarsSubstituted",
  11494. order: "perGrammar",
  11495. status: "experimental",
  11496. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/--*"
  11497. },
  11498. "-ms-accelerator": {
  11499. syntax: "false | true",
  11500. media: "visual",
  11501. inherited: false,
  11502. animationType: "discrete",
  11503. percentages: "no",
  11504. groups: [
  11505. "Microsoft Extensions"
  11506. ],
  11507. initial: "false",
  11508. appliesto: "allElements",
  11509. computed: "asSpecified",
  11510. order: "uniqueOrder",
  11511. status: "nonstandard",
  11512. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-accelerator"
  11513. },
  11514. "-ms-block-progression": {
  11515. syntax: "tb | rl | bt | lr",
  11516. media: "visual",
  11517. inherited: false,
  11518. animationType: "discrete",
  11519. percentages: "no",
  11520. groups: [
  11521. "Microsoft Extensions"
  11522. ],
  11523. initial: "tb",
  11524. appliesto: "allElements",
  11525. computed: "asSpecified",
  11526. order: "uniqueOrder",
  11527. status: "nonstandard",
  11528. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-block-progression"
  11529. },
  11530. "-ms-content-zoom-chaining": {
  11531. syntax: "none | chained",
  11532. media: "interactive",
  11533. inherited: false,
  11534. animationType: "discrete",
  11535. percentages: "no",
  11536. groups: [
  11537. "Microsoft Extensions"
  11538. ],
  11539. initial: "none",
  11540. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11541. computed: "asSpecified",
  11542. order: "uniqueOrder",
  11543. status: "nonstandard",
  11544. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-chaining"
  11545. },
  11546. "-ms-content-zooming": {
  11547. syntax: "none | zoom",
  11548. media: "interactive",
  11549. inherited: false,
  11550. animationType: "discrete",
  11551. percentages: "no",
  11552. groups: [
  11553. "Microsoft Extensions"
  11554. ],
  11555. initial: "zoomForTheTopLevelNoneForTheRest",
  11556. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11557. computed: "asSpecified",
  11558. order: "uniqueOrder",
  11559. status: "nonstandard",
  11560. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zooming"
  11561. },
  11562. "-ms-content-zoom-limit": {
  11563. syntax: "<'-ms-content-zoom-limit-min'> <'-ms-content-zoom-limit-max'>",
  11564. media: "interactive",
  11565. inherited: false,
  11566. animationType: "discrete",
  11567. percentages: [
  11568. "-ms-content-zoom-limit-max",
  11569. "-ms-content-zoom-limit-min"
  11570. ],
  11571. groups: [
  11572. "Microsoft Extensions"
  11573. ],
  11574. initial: [
  11575. "-ms-content-zoom-limit-max",
  11576. "-ms-content-zoom-limit-min"
  11577. ],
  11578. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11579. computed: [
  11580. "-ms-content-zoom-limit-max",
  11581. "-ms-content-zoom-limit-min"
  11582. ],
  11583. order: "uniqueOrder",
  11584. status: "nonstandard",
  11585. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-limit"
  11586. },
  11587. "-ms-content-zoom-limit-max": {
  11588. syntax: "<percentage>",
  11589. media: "interactive",
  11590. inherited: false,
  11591. animationType: "discrete",
  11592. percentages: "maxZoomFactor",
  11593. groups: [
  11594. "Microsoft Extensions"
  11595. ],
  11596. initial: "400%",
  11597. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11598. computed: "asSpecified",
  11599. order: "uniqueOrder",
  11600. status: "nonstandard",
  11601. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-limit-max"
  11602. },
  11603. "-ms-content-zoom-limit-min": {
  11604. syntax: "<percentage>",
  11605. media: "interactive",
  11606. inherited: false,
  11607. animationType: "discrete",
  11608. percentages: "minZoomFactor",
  11609. groups: [
  11610. "Microsoft Extensions"
  11611. ],
  11612. initial: "100%",
  11613. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11614. computed: "asSpecified",
  11615. order: "uniqueOrder",
  11616. status: "nonstandard",
  11617. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-limit-min"
  11618. },
  11619. "-ms-content-zoom-snap": {
  11620. syntax: "<'-ms-content-zoom-snap-type'> || <'-ms-content-zoom-snap-points'>",
  11621. media: "interactive",
  11622. inherited: false,
  11623. animationType: "discrete",
  11624. percentages: "no",
  11625. groups: [
  11626. "Microsoft Extensions"
  11627. ],
  11628. initial: [
  11629. "-ms-content-zoom-snap-type",
  11630. "-ms-content-zoom-snap-points"
  11631. ],
  11632. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11633. computed: [
  11634. "-ms-content-zoom-snap-type",
  11635. "-ms-content-zoom-snap-points"
  11636. ],
  11637. order: "uniqueOrder",
  11638. status: "nonstandard",
  11639. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-snap"
  11640. },
  11641. "-ms-content-zoom-snap-points": {
  11642. syntax: "snapInterval( <percentage>, <percentage> ) | snapList( <percentage># )",
  11643. media: "interactive",
  11644. inherited: false,
  11645. animationType: "discrete",
  11646. percentages: "no",
  11647. groups: [
  11648. "Microsoft Extensions"
  11649. ],
  11650. initial: "snapInterval(0%, 100%)",
  11651. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11652. computed: "asSpecified",
  11653. order: "uniqueOrder",
  11654. status: "nonstandard",
  11655. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-snap-points"
  11656. },
  11657. "-ms-content-zoom-snap-type": {
  11658. syntax: "none | proximity | mandatory",
  11659. media: "interactive",
  11660. inherited: false,
  11661. animationType: "discrete",
  11662. percentages: "no",
  11663. groups: [
  11664. "Microsoft Extensions"
  11665. ],
  11666. initial: "none",
  11667. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11668. computed: "asSpecified",
  11669. order: "uniqueOrder",
  11670. status: "nonstandard",
  11671. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-snap-type"
  11672. },
  11673. "-ms-filter": {
  11674. syntax: "<string>",
  11675. media: "visual",
  11676. inherited: false,
  11677. animationType: "discrete",
  11678. percentages: "no",
  11679. groups: [
  11680. "Microsoft Extensions"
  11681. ],
  11682. initial: "\"\"",
  11683. appliesto: "allElements",
  11684. computed: "asSpecified",
  11685. order: "uniqueOrder",
  11686. status: "nonstandard",
  11687. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-filter"
  11688. },
  11689. "-ms-flow-from": {
  11690. syntax: "[ none | <custom-ident> ]#",
  11691. media: "visual",
  11692. inherited: false,
  11693. animationType: "discrete",
  11694. percentages: "no",
  11695. groups: [
  11696. "Microsoft Extensions"
  11697. ],
  11698. initial: "none",
  11699. appliesto: "nonReplacedElements",
  11700. computed: "asSpecified",
  11701. order: "uniqueOrder",
  11702. status: "nonstandard",
  11703. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-flow-from"
  11704. },
  11705. "-ms-flow-into": {
  11706. syntax: "[ none | <custom-ident> ]#",
  11707. media: "visual",
  11708. inherited: false,
  11709. animationType: "discrete",
  11710. percentages: "no",
  11711. groups: [
  11712. "Microsoft Extensions"
  11713. ],
  11714. initial: "none",
  11715. appliesto: "iframeElements",
  11716. computed: "asSpecified",
  11717. order: "uniqueOrder",
  11718. status: "nonstandard",
  11719. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-flow-into"
  11720. },
  11721. "-ms-grid-columns": {
  11722. syntax: "none | <track-list> | <auto-track-list>",
  11723. media: "visual",
  11724. inherited: false,
  11725. animationType: "simpleListOfLpcDifferenceLpc",
  11726. percentages: "referToDimensionOfContentArea",
  11727. groups: [
  11728. "CSS Grid Layout"
  11729. ],
  11730. initial: "none",
  11731. appliesto: "gridContainers",
  11732. computed: "asSpecifiedRelativeToAbsoluteLengths",
  11733. order: "uniqueOrder",
  11734. status: "nonstandard",
  11735. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-grid-columns"
  11736. },
  11737. "-ms-grid-rows": {
  11738. syntax: "none | <track-list> | <auto-track-list>",
  11739. media: "visual",
  11740. inherited: false,
  11741. animationType: "simpleListOfLpcDifferenceLpc",
  11742. percentages: "referToDimensionOfContentArea",
  11743. groups: [
  11744. "CSS Grid Layout"
  11745. ],
  11746. initial: "none",
  11747. appliesto: "gridContainers",
  11748. computed: "asSpecifiedRelativeToAbsoluteLengths",
  11749. order: "uniqueOrder",
  11750. status: "nonstandard",
  11751. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-grid-rows"
  11752. },
  11753. "-ms-high-contrast-adjust": {
  11754. syntax: "auto | none",
  11755. media: "visual",
  11756. inherited: true,
  11757. animationType: "discrete",
  11758. percentages: "no",
  11759. groups: [
  11760. "Microsoft Extensions"
  11761. ],
  11762. initial: "auto",
  11763. appliesto: "allElements",
  11764. computed: "asSpecified",
  11765. order: "uniqueOrder",
  11766. status: "nonstandard",
  11767. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-high-contrast-adjust"
  11768. },
  11769. "-ms-hyphenate-limit-chars": {
  11770. syntax: "auto | <integer>{1,3}",
  11771. media: "visual",
  11772. inherited: true,
  11773. animationType: "discrete",
  11774. percentages: "no",
  11775. groups: [
  11776. "Microsoft Extensions"
  11777. ],
  11778. initial: "auto",
  11779. appliesto: "allElements",
  11780. computed: "asSpecified",
  11781. order: "uniqueOrder",
  11782. status: "nonstandard",
  11783. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-hyphenate-limit-chars"
  11784. },
  11785. "-ms-hyphenate-limit-lines": {
  11786. syntax: "no-limit | <integer>",
  11787. media: "visual",
  11788. inherited: true,
  11789. animationType: "discrete",
  11790. percentages: "no",
  11791. groups: [
  11792. "Microsoft Extensions"
  11793. ],
  11794. initial: "no-limit",
  11795. appliesto: "blockContainerElements",
  11796. computed: "asSpecified",
  11797. order: "uniqueOrder",
  11798. status: "nonstandard",
  11799. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-hyphenate-limit-lines"
  11800. },
  11801. "-ms-hyphenate-limit-zone": {
  11802. syntax: "<percentage> | <length>",
  11803. media: "visual",
  11804. inherited: true,
  11805. animationType: "discrete",
  11806. percentages: "referToLineBoxWidth",
  11807. groups: [
  11808. "Microsoft Extensions"
  11809. ],
  11810. initial: "0",
  11811. appliesto: "blockContainerElements",
  11812. computed: "asSpecified",
  11813. order: "uniqueOrder",
  11814. status: "nonstandard",
  11815. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-hyphenate-limit-zone"
  11816. },
  11817. "-ms-ime-align": {
  11818. syntax: "auto | after",
  11819. media: "visual",
  11820. inherited: false,
  11821. animationType: "discrete",
  11822. percentages: "no",
  11823. groups: [
  11824. "Microsoft Extensions"
  11825. ],
  11826. initial: "auto",
  11827. appliesto: "allElements",
  11828. computed: "asSpecified",
  11829. order: "uniqueOrder",
  11830. status: "nonstandard",
  11831. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-ime-align"
  11832. },
  11833. "-ms-overflow-style": {
  11834. syntax: "auto | none | scrollbar | -ms-autohiding-scrollbar",
  11835. media: "interactive",
  11836. inherited: true,
  11837. animationType: "discrete",
  11838. percentages: "no",
  11839. groups: [
  11840. "Microsoft Extensions"
  11841. ],
  11842. initial: "auto",
  11843. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11844. computed: "asSpecified",
  11845. order: "uniqueOrder",
  11846. status: "nonstandard",
  11847. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-overflow-style"
  11848. },
  11849. "-ms-scrollbar-3dlight-color": {
  11850. syntax: "<color>",
  11851. media: "visual",
  11852. inherited: true,
  11853. animationType: "discrete",
  11854. percentages: "no",
  11855. groups: [
  11856. "Microsoft Extensions"
  11857. ],
  11858. initial: "dependsOnUserAgent",
  11859. appliesto: "allElements",
  11860. computed: "asSpecified",
  11861. order: "uniqueOrder",
  11862. status: "nonstandard",
  11863. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-3dlight-color"
  11864. },
  11865. "-ms-scrollbar-arrow-color": {
  11866. syntax: "<color>",
  11867. media: "visual",
  11868. inherited: true,
  11869. animationType: "discrete",
  11870. percentages: "no",
  11871. groups: [
  11872. "Microsoft Extensions"
  11873. ],
  11874. initial: "ButtonText",
  11875. appliesto: "allElements",
  11876. computed: "asSpecified",
  11877. order: "uniqueOrder",
  11878. status: "nonstandard",
  11879. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-arrow-color"
  11880. },
  11881. "-ms-scrollbar-base-color": {
  11882. syntax: "<color>",
  11883. media: "visual",
  11884. inherited: true,
  11885. animationType: "discrete",
  11886. percentages: "no",
  11887. groups: [
  11888. "Microsoft Extensions"
  11889. ],
  11890. initial: "dependsOnUserAgent",
  11891. appliesto: "allElements",
  11892. computed: "asSpecified",
  11893. order: "uniqueOrder",
  11894. status: "nonstandard",
  11895. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-base-color"
  11896. },
  11897. "-ms-scrollbar-darkshadow-color": {
  11898. syntax: "<color>",
  11899. media: "visual",
  11900. inherited: true,
  11901. animationType: "discrete",
  11902. percentages: "no",
  11903. groups: [
  11904. "Microsoft Extensions"
  11905. ],
  11906. initial: "ThreeDDarkShadow",
  11907. appliesto: "allElements",
  11908. computed: "asSpecified",
  11909. order: "uniqueOrder",
  11910. status: "nonstandard",
  11911. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-darkshadow-color"
  11912. },
  11913. "-ms-scrollbar-face-color": {
  11914. syntax: "<color>",
  11915. media: "visual",
  11916. inherited: true,
  11917. animationType: "discrete",
  11918. percentages: "no",
  11919. groups: [
  11920. "Microsoft Extensions"
  11921. ],
  11922. initial: "ThreeDFace",
  11923. appliesto: "allElements",
  11924. computed: "asSpecified",
  11925. order: "uniqueOrder",
  11926. status: "nonstandard",
  11927. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-face-color"
  11928. },
  11929. "-ms-scrollbar-highlight-color": {
  11930. syntax: "<color>",
  11931. media: "visual",
  11932. inherited: true,
  11933. animationType: "discrete",
  11934. percentages: "no",
  11935. groups: [
  11936. "Microsoft Extensions"
  11937. ],
  11938. initial: "ThreeDHighlight",
  11939. appliesto: "allElements",
  11940. computed: "asSpecified",
  11941. order: "uniqueOrder",
  11942. status: "nonstandard",
  11943. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-highlight-color"
  11944. },
  11945. "-ms-scrollbar-shadow-color": {
  11946. syntax: "<color>",
  11947. media: "visual",
  11948. inherited: true,
  11949. animationType: "discrete",
  11950. percentages: "no",
  11951. groups: [
  11952. "Microsoft Extensions"
  11953. ],
  11954. initial: "ThreeDDarkShadow",
  11955. appliesto: "allElements",
  11956. computed: "asSpecified",
  11957. order: "uniqueOrder",
  11958. status: "nonstandard",
  11959. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-shadow-color"
  11960. },
  11961. "-ms-scrollbar-track-color": {
  11962. syntax: "<color>",
  11963. media: "visual",
  11964. inherited: true,
  11965. animationType: "discrete",
  11966. percentages: "no",
  11967. groups: [
  11968. "Microsoft Extensions"
  11969. ],
  11970. initial: "Scrollbar",
  11971. appliesto: "allElements",
  11972. computed: "asSpecified",
  11973. order: "uniqueOrder",
  11974. status: "nonstandard",
  11975. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-track-color"
  11976. },
  11977. "-ms-scroll-chaining": {
  11978. syntax: "chained | none",
  11979. media: "interactive",
  11980. inherited: false,
  11981. animationType: "discrete",
  11982. percentages: "no",
  11983. groups: [
  11984. "Microsoft Extensions"
  11985. ],
  11986. initial: "chained",
  11987. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11988. computed: "asSpecified",
  11989. order: "uniqueOrder",
  11990. status: "nonstandard",
  11991. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-chaining"
  11992. },
  11993. "-ms-scroll-limit": {
  11994. syntax: "<'-ms-scroll-limit-x-min'> <'-ms-scroll-limit-y-min'> <'-ms-scroll-limit-x-max'> <'-ms-scroll-limit-y-max'>",
  11995. media: "interactive",
  11996. inherited: false,
  11997. animationType: "discrete",
  11998. percentages: "no",
  11999. groups: [
  12000. "Microsoft Extensions"
  12001. ],
  12002. initial: [
  12003. "-ms-scroll-limit-x-min",
  12004. "-ms-scroll-limit-y-min",
  12005. "-ms-scroll-limit-x-max",
  12006. "-ms-scroll-limit-y-max"
  12007. ],
  12008. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12009. computed: [
  12010. "-ms-scroll-limit-x-min",
  12011. "-ms-scroll-limit-y-min",
  12012. "-ms-scroll-limit-x-max",
  12013. "-ms-scroll-limit-y-max"
  12014. ],
  12015. order: "uniqueOrder",
  12016. status: "nonstandard",
  12017. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit"
  12018. },
  12019. "-ms-scroll-limit-x-max": {
  12020. syntax: "auto | <length>",
  12021. media: "interactive",
  12022. inherited: false,
  12023. animationType: "discrete",
  12024. percentages: "no",
  12025. groups: [
  12026. "Microsoft Extensions"
  12027. ],
  12028. initial: "auto",
  12029. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12030. computed: "asSpecified",
  12031. order: "uniqueOrder",
  12032. status: "nonstandard",
  12033. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-x-max"
  12034. },
  12035. "-ms-scroll-limit-x-min": {
  12036. syntax: "<length>",
  12037. media: "interactive",
  12038. inherited: false,
  12039. animationType: "discrete",
  12040. percentages: "no",
  12041. groups: [
  12042. "Microsoft Extensions"
  12043. ],
  12044. initial: "0",
  12045. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12046. computed: "asSpecified",
  12047. order: "uniqueOrder",
  12048. status: "nonstandard",
  12049. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-x-min"
  12050. },
  12051. "-ms-scroll-limit-y-max": {
  12052. syntax: "auto | <length>",
  12053. media: "interactive",
  12054. inherited: false,
  12055. animationType: "discrete",
  12056. percentages: "no",
  12057. groups: [
  12058. "Microsoft Extensions"
  12059. ],
  12060. initial: "auto",
  12061. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12062. computed: "asSpecified",
  12063. order: "uniqueOrder",
  12064. status: "nonstandard",
  12065. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-y-max"
  12066. },
  12067. "-ms-scroll-limit-y-min": {
  12068. syntax: "<length>",
  12069. media: "interactive",
  12070. inherited: false,
  12071. animationType: "discrete",
  12072. percentages: "no",
  12073. groups: [
  12074. "Microsoft Extensions"
  12075. ],
  12076. initial: "0",
  12077. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12078. computed: "asSpecified",
  12079. order: "uniqueOrder",
  12080. status: "nonstandard",
  12081. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-y-min"
  12082. },
  12083. "-ms-scroll-rails": {
  12084. syntax: "none | railed",
  12085. media: "interactive",
  12086. inherited: false,
  12087. animationType: "discrete",
  12088. percentages: "no",
  12089. groups: [
  12090. "Microsoft Extensions"
  12091. ],
  12092. initial: "railed",
  12093. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12094. computed: "asSpecified",
  12095. order: "uniqueOrder",
  12096. status: "nonstandard",
  12097. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-rails"
  12098. },
  12099. "-ms-scroll-snap-points-x": {
  12100. syntax: "snapInterval( <length-percentage>, <length-percentage> ) | snapList( <length-percentage># )",
  12101. media: "interactive",
  12102. inherited: false,
  12103. animationType: "discrete",
  12104. percentages: "no",
  12105. groups: [
  12106. "Microsoft Extensions"
  12107. ],
  12108. initial: "snapInterval(0px, 100%)",
  12109. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12110. computed: "asSpecified",
  12111. order: "uniqueOrder",
  12112. status: "nonstandard",
  12113. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-points-x"
  12114. },
  12115. "-ms-scroll-snap-points-y": {
  12116. syntax: "snapInterval( <length-percentage>, <length-percentage> ) | snapList( <length-percentage># )",
  12117. media: "interactive",
  12118. inherited: false,
  12119. animationType: "discrete",
  12120. percentages: "no",
  12121. groups: [
  12122. "Microsoft Extensions"
  12123. ],
  12124. initial: "snapInterval(0px, 100%)",
  12125. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12126. computed: "asSpecified",
  12127. order: "uniqueOrder",
  12128. status: "nonstandard",
  12129. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-points-y"
  12130. },
  12131. "-ms-scroll-snap-type": {
  12132. syntax: "none | proximity | mandatory",
  12133. media: "interactive",
  12134. inherited: false,
  12135. animationType: "discrete",
  12136. percentages: "no",
  12137. groups: [
  12138. "Microsoft Extensions"
  12139. ],
  12140. initial: "none",
  12141. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12142. computed: "asSpecified",
  12143. order: "uniqueOrder",
  12144. status: "nonstandard",
  12145. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-type"
  12146. },
  12147. "-ms-scroll-snap-x": {
  12148. syntax: "<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-x'>",
  12149. media: "interactive",
  12150. inherited: false,
  12151. animationType: "discrete",
  12152. percentages: "no",
  12153. groups: [
  12154. "Microsoft Extensions"
  12155. ],
  12156. initial: [
  12157. "-ms-scroll-snap-type",
  12158. "-ms-scroll-snap-points-x"
  12159. ],
  12160. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12161. computed: [
  12162. "-ms-scroll-snap-type",
  12163. "-ms-scroll-snap-points-x"
  12164. ],
  12165. order: "uniqueOrder",
  12166. status: "nonstandard",
  12167. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-x"
  12168. },
  12169. "-ms-scroll-snap-y": {
  12170. syntax: "<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-y'>",
  12171. media: "interactive",
  12172. inherited: false,
  12173. animationType: "discrete",
  12174. percentages: "no",
  12175. groups: [
  12176. "Microsoft Extensions"
  12177. ],
  12178. initial: [
  12179. "-ms-scroll-snap-type",
  12180. "-ms-scroll-snap-points-y"
  12181. ],
  12182. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12183. computed: [
  12184. "-ms-scroll-snap-type",
  12185. "-ms-scroll-snap-points-y"
  12186. ],
  12187. order: "uniqueOrder",
  12188. status: "nonstandard",
  12189. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-y"
  12190. },
  12191. "-ms-scroll-translation": {
  12192. syntax: "none | vertical-to-horizontal",
  12193. media: "interactive",
  12194. inherited: true,
  12195. animationType: "discrete",
  12196. percentages: "no",
  12197. groups: [
  12198. "Microsoft Extensions"
  12199. ],
  12200. initial: "none",
  12201. appliesto: "allElements",
  12202. computed: "asSpecified",
  12203. order: "uniqueOrder",
  12204. status: "nonstandard",
  12205. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-translation"
  12206. },
  12207. "-ms-text-autospace": {
  12208. syntax: "none | ideograph-alpha | ideograph-numeric | ideograph-parenthesis | ideograph-space",
  12209. media: "visual",
  12210. inherited: false,
  12211. animationType: "discrete",
  12212. percentages: "no",
  12213. groups: [
  12214. "Microsoft Extensions"
  12215. ],
  12216. initial: "none",
  12217. appliesto: "allElements",
  12218. computed: "asSpecified",
  12219. order: "uniqueOrder",
  12220. status: "nonstandard",
  12221. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-text-autospace"
  12222. },
  12223. "-ms-touch-select": {
  12224. syntax: "grippers | none",
  12225. media: "interactive",
  12226. inherited: true,
  12227. animationType: "discrete",
  12228. percentages: "no",
  12229. groups: [
  12230. "Microsoft Extensions"
  12231. ],
  12232. initial: "grippers",
  12233. appliesto: "allElements",
  12234. computed: "asSpecified",
  12235. order: "uniqueOrder",
  12236. status: "nonstandard",
  12237. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-touch-select"
  12238. },
  12239. "-ms-user-select": {
  12240. syntax: "none | element | text",
  12241. media: "interactive",
  12242. inherited: false,
  12243. animationType: "discrete",
  12244. percentages: "no",
  12245. groups: [
  12246. "Microsoft Extensions"
  12247. ],
  12248. initial: "text",
  12249. appliesto: "nonReplacedElements",
  12250. computed: "asSpecified",
  12251. order: "uniqueOrder",
  12252. status: "nonstandard",
  12253. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-user-select"
  12254. },
  12255. "-ms-wrap-flow": {
  12256. syntax: "auto | both | start | end | maximum | clear",
  12257. media: "visual",
  12258. inherited: false,
  12259. animationType: "discrete",
  12260. percentages: "no",
  12261. groups: [
  12262. "Microsoft Extensions"
  12263. ],
  12264. initial: "auto",
  12265. appliesto: "blockLevelElements",
  12266. computed: "asSpecified",
  12267. order: "uniqueOrder",
  12268. status: "nonstandard",
  12269. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-wrap-flow"
  12270. },
  12271. "-ms-wrap-margin": {
  12272. syntax: "<length>",
  12273. media: "visual",
  12274. inherited: false,
  12275. animationType: "discrete",
  12276. percentages: "no",
  12277. groups: [
  12278. "Microsoft Extensions"
  12279. ],
  12280. initial: "0",
  12281. appliesto: "exclusionElements",
  12282. computed: "asSpecified",
  12283. order: "uniqueOrder",
  12284. status: "nonstandard",
  12285. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-wrap-margin"
  12286. },
  12287. "-ms-wrap-through": {
  12288. syntax: "wrap | none",
  12289. media: "visual",
  12290. inherited: false,
  12291. animationType: "discrete",
  12292. percentages: "no",
  12293. groups: [
  12294. "Microsoft Extensions"
  12295. ],
  12296. initial: "wrap",
  12297. appliesto: "blockLevelElements",
  12298. computed: "asSpecified",
  12299. order: "uniqueOrder",
  12300. status: "nonstandard",
  12301. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-wrap-through"
  12302. },
  12303. "-moz-appearance": {
  12304. syntax: "none | button | button-arrow-down | button-arrow-next | button-arrow-previous | button-arrow-up | button-bevel | button-focus | caret | checkbox | checkbox-container | checkbox-label | checkmenuitem | dualbutton | groupbox | listbox | listitem | menuarrow | menubar | menucheckbox | menuimage | menuitem | menuitemtext | menulist | menulist-button | menulist-text | menulist-textfield | menupopup | menuradio | menuseparator | meterbar | meterchunk | progressbar | progressbar-vertical | progresschunk | progresschunk-vertical | radio | radio-container | radio-label | radiomenuitem | range | range-thumb | resizer | resizerpanel | scale-horizontal | scalethumbend | scalethumb-horizontal | scalethumbstart | scalethumbtick | scalethumb-vertical | scale-vertical | scrollbarbutton-down | scrollbarbutton-left | scrollbarbutton-right | scrollbarbutton-up | scrollbarthumb-horizontal | scrollbarthumb-vertical | scrollbartrack-horizontal | scrollbartrack-vertical | searchfield | separator | sheet | spinner | spinner-downbutton | spinner-textfield | spinner-upbutton | splitter | statusbar | statusbarpanel | tab | tabpanel | tabpanels | tab-scroll-arrow-back | tab-scroll-arrow-forward | textfield | textfield-multiline | toolbar | toolbarbutton | toolbarbutton-dropdown | toolbargripper | toolbox | tooltip | treeheader | treeheadercell | treeheadersortarrow | treeitem | treeline | treetwisty | treetwistyopen | treeview | -moz-mac-unified-toolbar | -moz-win-borderless-glass | -moz-win-browsertabbar-toolbox | -moz-win-communicationstext | -moz-win-communications-toolbox | -moz-win-exclude-glass | -moz-win-glass | -moz-win-mediatext | -moz-win-media-toolbox | -moz-window-button-box | -moz-window-button-box-maximized | -moz-window-button-close | -moz-window-button-maximize | -moz-window-button-minimize | -moz-window-button-restore | -moz-window-frame-bottom | -moz-window-frame-left | -moz-window-frame-right | -moz-window-titlebar | -moz-window-titlebar-maximized",
  12305. media: "visual",
  12306. inherited: false,
  12307. animationType: "discrete",
  12308. percentages: "no",
  12309. groups: [
  12310. "Mozilla Extensions",
  12311. "WebKit Extensions"
  12312. ],
  12313. initial: "noneButOverriddenInUserAgentCSS",
  12314. appliesto: "allElements",
  12315. computed: "asSpecified",
  12316. order: "uniqueOrder",
  12317. status: "nonstandard",
  12318. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/appearance"
  12319. },
  12320. "-moz-binding": {
  12321. syntax: "<url> | none",
  12322. media: "visual",
  12323. inherited: false,
  12324. animationType: "discrete",
  12325. percentages: "no",
  12326. groups: [
  12327. "Mozilla Extensions"
  12328. ],
  12329. initial: "none",
  12330. appliesto: "allElementsExceptGeneratedContentOrPseudoElements",
  12331. computed: "asSpecified",
  12332. order: "uniqueOrder",
  12333. status: "nonstandard",
  12334. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-binding"
  12335. },
  12336. "-moz-border-bottom-colors": {
  12337. syntax: "<color>+ | none",
  12338. media: "visual",
  12339. inherited: false,
  12340. animationType: "discrete",
  12341. percentages: "no",
  12342. groups: [
  12343. "Mozilla Extensions"
  12344. ],
  12345. initial: "none",
  12346. appliesto: "allElements",
  12347. computed: "asSpecified",
  12348. order: "uniqueOrder",
  12349. status: "nonstandard",
  12350. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-border-bottom-colors"
  12351. },
  12352. "-moz-border-left-colors": {
  12353. syntax: "<color>+ | none",
  12354. media: "visual",
  12355. inherited: false,
  12356. animationType: "discrete",
  12357. percentages: "no",
  12358. groups: [
  12359. "Mozilla Extensions"
  12360. ],
  12361. initial: "none",
  12362. appliesto: "allElements",
  12363. computed: "asSpecified",
  12364. order: "uniqueOrder",
  12365. status: "nonstandard",
  12366. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-border-left-colors"
  12367. },
  12368. "-moz-border-right-colors": {
  12369. syntax: "<color>+ | none",
  12370. media: "visual",
  12371. inherited: false,
  12372. animationType: "discrete",
  12373. percentages: "no",
  12374. groups: [
  12375. "Mozilla Extensions"
  12376. ],
  12377. initial: "none",
  12378. appliesto: "allElements",
  12379. computed: "asSpecified",
  12380. order: "uniqueOrder",
  12381. status: "nonstandard",
  12382. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-border-right-colors"
  12383. },
  12384. "-moz-border-top-colors": {
  12385. syntax: "<color>+ | none",
  12386. media: "visual",
  12387. inherited: false,
  12388. animationType: "discrete",
  12389. percentages: "no",
  12390. groups: [
  12391. "Mozilla Extensions"
  12392. ],
  12393. initial: "none",
  12394. appliesto: "allElements",
  12395. computed: "asSpecified",
  12396. order: "uniqueOrder",
  12397. status: "nonstandard",
  12398. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-border-top-colors"
  12399. },
  12400. "-moz-context-properties": {
  12401. syntax: "none | [ fill | fill-opacity | stroke | stroke-opacity ]#",
  12402. media: "visual",
  12403. inherited: true,
  12404. animationType: "discrete",
  12405. percentages: "no",
  12406. groups: [
  12407. "Mozilla Extensions"
  12408. ],
  12409. initial: "none",
  12410. appliesto: "allElementsThatCanReferenceImages",
  12411. computed: "asSpecified",
  12412. order: "uniqueOrder",
  12413. status: "nonstandard",
  12414. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-context-properties"
  12415. },
  12416. "-moz-float-edge": {
  12417. syntax: "border-box | content-box | margin-box | padding-box",
  12418. media: "visual",
  12419. inherited: false,
  12420. animationType: "discrete",
  12421. percentages: "no",
  12422. groups: [
  12423. "Mozilla Extensions"
  12424. ],
  12425. initial: "content-box",
  12426. appliesto: "allElements",
  12427. computed: "asSpecified",
  12428. order: "uniqueOrder",
  12429. status: "nonstandard",
  12430. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-float-edge"
  12431. },
  12432. "-moz-force-broken-image-icon": {
  12433. syntax: "<integer [0,1]>",
  12434. media: "visual",
  12435. inherited: false,
  12436. animationType: "discrete",
  12437. percentages: "no",
  12438. groups: [
  12439. "Mozilla Extensions"
  12440. ],
  12441. initial: "0",
  12442. appliesto: "images",
  12443. computed: "asSpecified",
  12444. order: "uniqueOrder",
  12445. status: "nonstandard",
  12446. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-force-broken-image-icon"
  12447. },
  12448. "-moz-image-region": {
  12449. syntax: "<shape> | auto",
  12450. media: "visual",
  12451. inherited: true,
  12452. animationType: "discrete",
  12453. percentages: "no",
  12454. groups: [
  12455. "Mozilla Extensions"
  12456. ],
  12457. initial: "auto",
  12458. appliesto: "xulImageElements",
  12459. computed: "asSpecified",
  12460. order: "uniqueOrder",
  12461. status: "nonstandard",
  12462. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-image-region"
  12463. },
  12464. "-moz-orient": {
  12465. syntax: "inline | block | horizontal | vertical",
  12466. media: "visual",
  12467. inherited: false,
  12468. animationType: "discrete",
  12469. percentages: "no",
  12470. groups: [
  12471. "Mozilla Extensions"
  12472. ],
  12473. initial: "inline",
  12474. appliesto: "anyElementEffectOnProgressAndMeter",
  12475. computed: "asSpecified",
  12476. order: "uniqueOrder",
  12477. status: "nonstandard",
  12478. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-orient"
  12479. },
  12480. "-moz-outline-radius": {
  12481. syntax: "<outline-radius>{1,4} [ / <outline-radius>{1,4} ]?",
  12482. media: "visual",
  12483. inherited: false,
  12484. animationType: [
  12485. "-moz-outline-radius-topleft",
  12486. "-moz-outline-radius-topright",
  12487. "-moz-outline-radius-bottomright",
  12488. "-moz-outline-radius-bottomleft"
  12489. ],
  12490. percentages: [
  12491. "-moz-outline-radius-topleft",
  12492. "-moz-outline-radius-topright",
  12493. "-moz-outline-radius-bottomright",
  12494. "-moz-outline-radius-bottomleft"
  12495. ],
  12496. groups: [
  12497. "Mozilla Extensions"
  12498. ],
  12499. initial: [
  12500. "-moz-outline-radius-topleft",
  12501. "-moz-outline-radius-topright",
  12502. "-moz-outline-radius-bottomright",
  12503. "-moz-outline-radius-bottomleft"
  12504. ],
  12505. appliesto: "allElements",
  12506. computed: [
  12507. "-moz-outline-radius-topleft",
  12508. "-moz-outline-radius-topright",
  12509. "-moz-outline-radius-bottomright",
  12510. "-moz-outline-radius-bottomleft"
  12511. ],
  12512. order: "uniqueOrder",
  12513. status: "nonstandard",
  12514. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius"
  12515. },
  12516. "-moz-outline-radius-bottomleft": {
  12517. syntax: "<outline-radius>",
  12518. media: "visual",
  12519. inherited: false,
  12520. animationType: "lpc",
  12521. percentages: "referToDimensionOfBorderBox",
  12522. groups: [
  12523. "Mozilla Extensions"
  12524. ],
  12525. initial: "0",
  12526. appliesto: "allElements",
  12527. computed: "asSpecified",
  12528. order: "uniqueOrder",
  12529. status: "nonstandard",
  12530. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-bottomleft"
  12531. },
  12532. "-moz-outline-radius-bottomright": {
  12533. syntax: "<outline-radius>",
  12534. media: "visual",
  12535. inherited: false,
  12536. animationType: "lpc",
  12537. percentages: "referToDimensionOfBorderBox",
  12538. groups: [
  12539. "Mozilla Extensions"
  12540. ],
  12541. initial: "0",
  12542. appliesto: "allElements",
  12543. computed: "asSpecified",
  12544. order: "uniqueOrder",
  12545. status: "nonstandard",
  12546. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-bottomright"
  12547. },
  12548. "-moz-outline-radius-topleft": {
  12549. syntax: "<outline-radius>",
  12550. media: "visual",
  12551. inherited: false,
  12552. animationType: "lpc",
  12553. percentages: "referToDimensionOfBorderBox",
  12554. groups: [
  12555. "Mozilla Extensions"
  12556. ],
  12557. initial: "0",
  12558. appliesto: "allElements",
  12559. computed: "asSpecified",
  12560. order: "uniqueOrder",
  12561. status: "nonstandard",
  12562. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-topleft"
  12563. },
  12564. "-moz-outline-radius-topright": {
  12565. syntax: "<outline-radius>",
  12566. media: "visual",
  12567. inherited: false,
  12568. animationType: "lpc",
  12569. percentages: "referToDimensionOfBorderBox",
  12570. groups: [
  12571. "Mozilla Extensions"
  12572. ],
  12573. initial: "0",
  12574. appliesto: "allElements",
  12575. computed: "asSpecified",
  12576. order: "uniqueOrder",
  12577. status: "nonstandard",
  12578. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-topright"
  12579. },
  12580. "-moz-stack-sizing": {
  12581. syntax: "ignore | stretch-to-fit",
  12582. media: "visual",
  12583. inherited: true,
  12584. animationType: "discrete",
  12585. percentages: "no",
  12586. groups: [
  12587. "Mozilla Extensions"
  12588. ],
  12589. initial: "stretch-to-fit",
  12590. appliesto: "allElements",
  12591. computed: "asSpecified",
  12592. order: "uniqueOrder",
  12593. status: "nonstandard",
  12594. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-stack-sizing"
  12595. },
  12596. "-moz-text-blink": {
  12597. syntax: "none | blink",
  12598. media: "visual",
  12599. inherited: false,
  12600. animationType: "discrete",
  12601. percentages: "no",
  12602. groups: [
  12603. "Mozilla Extensions"
  12604. ],
  12605. initial: "none",
  12606. appliesto: "allElements",
  12607. computed: "asSpecified",
  12608. order: "uniqueOrder",
  12609. status: "nonstandard",
  12610. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-text-blink"
  12611. },
  12612. "-moz-user-focus": {
  12613. syntax: "ignore | normal | select-after | select-before | select-menu | select-same | select-all | none",
  12614. media: "interactive",
  12615. inherited: false,
  12616. animationType: "discrete",
  12617. percentages: "no",
  12618. groups: [
  12619. "Mozilla Extensions"
  12620. ],
  12621. initial: "none",
  12622. appliesto: "allElements",
  12623. computed: "asSpecified",
  12624. order: "uniqueOrder",
  12625. status: "nonstandard",
  12626. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-user-focus"
  12627. },
  12628. "-moz-user-input": {
  12629. syntax: "auto | none | enabled | disabled",
  12630. media: "visual",
  12631. inherited: true,
  12632. animationType: "discrete",
  12633. percentages: "no",
  12634. groups: [
  12635. "Mozilla Extensions"
  12636. ],
  12637. initial: "auto",
  12638. appliesto: "allElements",
  12639. computed: "asSpecified",
  12640. order: "uniqueOrder",
  12641. status: "nonstandard",
  12642. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-user-input"
  12643. },
  12644. "-moz-user-modify": {
  12645. syntax: "read-only | read-write | write-only",
  12646. media: "interactive",
  12647. inherited: true,
  12648. animationType: "discrete",
  12649. percentages: "no",
  12650. groups: [
  12651. "Mozilla Extensions"
  12652. ],
  12653. initial: "read-only",
  12654. appliesto: "allElements",
  12655. computed: "asSpecified",
  12656. order: "uniqueOrder",
  12657. status: "nonstandard",
  12658. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-user-modify"
  12659. },
  12660. "-moz-window-dragging": {
  12661. syntax: "drag | no-drag",
  12662. media: "visual",
  12663. inherited: false,
  12664. animationType: "discrete",
  12665. percentages: "no",
  12666. groups: [
  12667. "Mozilla Extensions"
  12668. ],
  12669. initial: "drag",
  12670. appliesto: "allElementsCreatingNativeWindows",
  12671. computed: "asSpecified",
  12672. order: "uniqueOrder",
  12673. status: "nonstandard",
  12674. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-window-dragging"
  12675. },
  12676. "-moz-window-shadow": {
  12677. syntax: "default | menu | tooltip | sheet | none",
  12678. media: "visual",
  12679. inherited: false,
  12680. animationType: "discrete",
  12681. percentages: "no",
  12682. groups: [
  12683. "Mozilla Extensions"
  12684. ],
  12685. initial: "default",
  12686. appliesto: "allElementsCreatingNativeWindows",
  12687. computed: "asSpecified",
  12688. order: "uniqueOrder",
  12689. status: "nonstandard",
  12690. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-window-shadow"
  12691. },
  12692. "-webkit-appearance": {
  12693. syntax: "none | button | button-bevel | caret | checkbox | default-button | inner-spin-button | listbox | listitem | media-controls-background | media-controls-fullscreen-background | media-current-time-display | media-enter-fullscreen-button | media-exit-fullscreen-button | media-fullscreen-button | media-mute-button | media-overlay-play-button | media-play-button | media-seek-back-button | media-seek-forward-button | media-slider | media-sliderthumb | media-time-remaining-display | media-toggle-closed-captions-button | media-volume-slider | media-volume-slider-container | media-volume-sliderthumb | menulist | menulist-button | menulist-text | menulist-textfield | meter | progress-bar | progress-bar-value | push-button | radio | searchfield | searchfield-cancel-button | searchfield-decoration | searchfield-results-button | searchfield-results-decoration | slider-horizontal | slider-vertical | sliderthumb-horizontal | sliderthumb-vertical | square-button | textarea | textfield | -apple-pay-button",
  12694. media: "visual",
  12695. inherited: false,
  12696. animationType: "discrete",
  12697. percentages: "no",
  12698. groups: [
  12699. "WebKit Extensions"
  12700. ],
  12701. initial: "noneButOverriddenInUserAgentCSS",
  12702. appliesto: "allElements",
  12703. computed: "asSpecified",
  12704. order: "uniqueOrder",
  12705. status: "nonstandard",
  12706. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/appearance"
  12707. },
  12708. "-webkit-border-before": {
  12709. syntax: "<'border-width'> || <'border-style'> || <'color'>",
  12710. media: "visual",
  12711. inherited: true,
  12712. animationType: "discrete",
  12713. percentages: [
  12714. "-webkit-border-before-width"
  12715. ],
  12716. groups: [
  12717. "WebKit Extensions"
  12718. ],
  12719. initial: [
  12720. "border-width",
  12721. "border-style",
  12722. "color"
  12723. ],
  12724. appliesto: "allElements",
  12725. computed: [
  12726. "border-width",
  12727. "border-style",
  12728. "color"
  12729. ],
  12730. order: "uniqueOrder",
  12731. status: "nonstandard",
  12732. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-border-before"
  12733. },
  12734. "-webkit-border-before-color": {
  12735. syntax: "<'color'>",
  12736. media: "visual",
  12737. inherited: true,
  12738. animationType: "discrete",
  12739. percentages: "no",
  12740. groups: [
  12741. "WebKit Extensions"
  12742. ],
  12743. initial: "currentcolor",
  12744. appliesto: "allElements",
  12745. computed: "computedColor",
  12746. order: "uniqueOrder",
  12747. status: "nonstandard"
  12748. },
  12749. "-webkit-border-before-style": {
  12750. syntax: "<'border-style'>",
  12751. media: "visual",
  12752. inherited: true,
  12753. animationType: "discrete",
  12754. percentages: "no",
  12755. groups: [
  12756. "WebKit Extensions"
  12757. ],
  12758. initial: "none",
  12759. appliesto: "allElements",
  12760. computed: "asSpecified",
  12761. order: "uniqueOrder",
  12762. status: "nonstandard"
  12763. },
  12764. "-webkit-border-before-width": {
  12765. syntax: "<'border-width'>",
  12766. media: "visual",
  12767. inherited: true,
  12768. animationType: "discrete",
  12769. percentages: "logicalWidthOfContainingBlock",
  12770. groups: [
  12771. "WebKit Extensions"
  12772. ],
  12773. initial: "medium",
  12774. appliesto: "allElements",
  12775. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  12776. order: "uniqueOrder",
  12777. status: "nonstandard"
  12778. },
  12779. "-webkit-box-reflect": {
  12780. syntax: "[ above | below | right | left ]? <length>? <image>?",
  12781. media: "visual",
  12782. inherited: false,
  12783. animationType: "discrete",
  12784. percentages: "no",
  12785. groups: [
  12786. "WebKit Extensions"
  12787. ],
  12788. initial: "none",
  12789. appliesto: "allElements",
  12790. computed: "asSpecified",
  12791. order: "uniqueOrder",
  12792. status: "nonstandard",
  12793. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-box-reflect"
  12794. },
  12795. "-webkit-line-clamp": {
  12796. syntax: "none | <integer>",
  12797. media: "visual",
  12798. inherited: false,
  12799. animationType: "byComputedValueType",
  12800. percentages: "no",
  12801. groups: [
  12802. "WebKit Extensions",
  12803. "CSS Overflow"
  12804. ],
  12805. initial: "none",
  12806. appliesto: "allElements",
  12807. computed: "asSpecified",
  12808. order: "uniqueOrder",
  12809. status: "standard",
  12810. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-line-clamp"
  12811. },
  12812. "-webkit-mask": {
  12813. syntax: "[ <mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || [ <box> | border | padding | content | text ] || [ <box> | border | padding | content ] ]#",
  12814. media: "visual",
  12815. inherited: false,
  12816. animationType: "discrete",
  12817. percentages: "no",
  12818. groups: [
  12819. "WebKit Extensions"
  12820. ],
  12821. initial: [
  12822. "-webkit-mask-image",
  12823. "-webkit-mask-repeat",
  12824. "-webkit-mask-attachment",
  12825. "-webkit-mask-position",
  12826. "-webkit-mask-origin",
  12827. "-webkit-mask-clip"
  12828. ],
  12829. appliesto: "allElements",
  12830. computed: [
  12831. "-webkit-mask-image",
  12832. "-webkit-mask-repeat",
  12833. "-webkit-mask-attachment",
  12834. "-webkit-mask-position",
  12835. "-webkit-mask-origin",
  12836. "-webkit-mask-clip"
  12837. ],
  12838. order: "uniqueOrder",
  12839. status: "nonstandard",
  12840. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask"
  12841. },
  12842. "-webkit-mask-attachment": {
  12843. syntax: "<attachment>#",
  12844. media: "visual",
  12845. inherited: false,
  12846. animationType: "discrete",
  12847. percentages: "no",
  12848. groups: [
  12849. "WebKit Extensions"
  12850. ],
  12851. initial: "scroll",
  12852. appliesto: "allElements",
  12853. computed: "asSpecified",
  12854. order: "orderOfAppearance",
  12855. status: "nonstandard",
  12856. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-attachment"
  12857. },
  12858. "-webkit-mask-clip": {
  12859. syntax: "[ <box> | border | padding | content | text ]#",
  12860. media: "visual",
  12861. inherited: false,
  12862. animationType: "discrete",
  12863. percentages: "no",
  12864. groups: [
  12865. "WebKit Extensions"
  12866. ],
  12867. initial: "border",
  12868. appliesto: "allElements",
  12869. computed: "asSpecified",
  12870. order: "orderOfAppearance",
  12871. status: "nonstandard",
  12872. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-clip"
  12873. },
  12874. "-webkit-mask-composite": {
  12875. syntax: "<composite-style>#",
  12876. media: "visual",
  12877. inherited: false,
  12878. animationType: "discrete",
  12879. percentages: "no",
  12880. groups: [
  12881. "WebKit Extensions"
  12882. ],
  12883. initial: "source-over",
  12884. appliesto: "allElements",
  12885. computed: "asSpecified",
  12886. order: "orderOfAppearance",
  12887. status: "nonstandard",
  12888. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-composite"
  12889. },
  12890. "-webkit-mask-image": {
  12891. syntax: "<mask-reference>#",
  12892. media: "visual",
  12893. inherited: false,
  12894. animationType: "discrete",
  12895. percentages: "no",
  12896. groups: [
  12897. "WebKit Extensions"
  12898. ],
  12899. initial: "none",
  12900. appliesto: "allElements",
  12901. computed: "absoluteURIOrNone",
  12902. order: "orderOfAppearance",
  12903. status: "nonstandard",
  12904. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-image"
  12905. },
  12906. "-webkit-mask-origin": {
  12907. syntax: "[ <box> | border | padding | content ]#",
  12908. media: "visual",
  12909. inherited: false,
  12910. animationType: "discrete",
  12911. percentages: "no",
  12912. groups: [
  12913. "WebKit Extensions"
  12914. ],
  12915. initial: "padding",
  12916. appliesto: "allElements",
  12917. computed: "asSpecified",
  12918. order: "orderOfAppearance",
  12919. status: "nonstandard",
  12920. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-origin"
  12921. },
  12922. "-webkit-mask-position": {
  12923. syntax: "<position>#",
  12924. media: "visual",
  12925. inherited: false,
  12926. animationType: "discrete",
  12927. percentages: "referToSizeOfElement",
  12928. groups: [
  12929. "WebKit Extensions"
  12930. ],
  12931. initial: "0% 0%",
  12932. appliesto: "allElements",
  12933. computed: "absoluteLengthOrPercentage",
  12934. order: "orderOfAppearance",
  12935. status: "nonstandard",
  12936. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-position"
  12937. },
  12938. "-webkit-mask-position-x": {
  12939. syntax: "[ <length-percentage> | left | center | right ]#",
  12940. media: "visual",
  12941. inherited: false,
  12942. animationType: "discrete",
  12943. percentages: "referToSizeOfElement",
  12944. groups: [
  12945. "WebKit Extensions"
  12946. ],
  12947. initial: "0%",
  12948. appliesto: "allElements",
  12949. computed: "absoluteLengthOrPercentage",
  12950. order: "orderOfAppearance",
  12951. status: "nonstandard",
  12952. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-position-x"
  12953. },
  12954. "-webkit-mask-position-y": {
  12955. syntax: "[ <length-percentage> | top | center | bottom ]#",
  12956. media: "visual",
  12957. inherited: false,
  12958. animationType: "discrete",
  12959. percentages: "referToSizeOfElement",
  12960. groups: [
  12961. "WebKit Extensions"
  12962. ],
  12963. initial: "0%",
  12964. appliesto: "allElements",
  12965. computed: "absoluteLengthOrPercentage",
  12966. order: "orderOfAppearance",
  12967. status: "nonstandard",
  12968. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-position-y"
  12969. },
  12970. "-webkit-mask-repeat": {
  12971. syntax: "<repeat-style>#",
  12972. media: "visual",
  12973. inherited: false,
  12974. animationType: "discrete",
  12975. percentages: "no",
  12976. groups: [
  12977. "WebKit Extensions"
  12978. ],
  12979. initial: "repeat",
  12980. appliesto: "allElements",
  12981. computed: "asSpecified",
  12982. order: "orderOfAppearance",
  12983. status: "nonstandard",
  12984. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-repeat"
  12985. },
  12986. "-webkit-mask-repeat-x": {
  12987. syntax: "repeat | no-repeat | space | round",
  12988. media: "visual",
  12989. inherited: false,
  12990. animationType: "discrete",
  12991. percentages: "no",
  12992. groups: [
  12993. "WebKit Extensions"
  12994. ],
  12995. initial: "repeat",
  12996. appliesto: "allElements",
  12997. computed: "asSpecified",
  12998. order: "orderOfAppearance",
  12999. status: "nonstandard",
  13000. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-repeat-x"
  13001. },
  13002. "-webkit-mask-repeat-y": {
  13003. syntax: "repeat | no-repeat | space | round",
  13004. media: "visual",
  13005. inherited: false,
  13006. animationType: "discrete",
  13007. percentages: "no",
  13008. groups: [
  13009. "WebKit Extensions"
  13010. ],
  13011. initial: "repeat",
  13012. appliesto: "allElements",
  13013. computed: "absoluteLengthOrPercentage",
  13014. order: "orderOfAppearance",
  13015. status: "nonstandard",
  13016. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-repeat-y"
  13017. },
  13018. "-webkit-mask-size": {
  13019. syntax: "<bg-size>#",
  13020. media: "visual",
  13021. inherited: false,
  13022. animationType: "discrete",
  13023. percentages: "relativeToBackgroundPositioningArea",
  13024. groups: [
  13025. "WebKit Extensions"
  13026. ],
  13027. initial: "auto auto",
  13028. appliesto: "allElements",
  13029. computed: "asSpecified",
  13030. order: "orderOfAppearance",
  13031. status: "nonstandard",
  13032. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-size"
  13033. },
  13034. "-webkit-overflow-scrolling": {
  13035. syntax: "auto | touch",
  13036. media: "visual",
  13037. inherited: true,
  13038. animationType: "discrete",
  13039. percentages: "no",
  13040. groups: [
  13041. "WebKit Extensions"
  13042. ],
  13043. initial: "auto",
  13044. appliesto: "scrollingBoxes",
  13045. computed: "asSpecified",
  13046. order: "orderOfAppearance",
  13047. status: "nonstandard",
  13048. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-overflow-scrolling"
  13049. },
  13050. "-webkit-tap-highlight-color": {
  13051. syntax: "<color>",
  13052. media: "visual",
  13053. inherited: false,
  13054. animationType: "discrete",
  13055. percentages: "no",
  13056. groups: [
  13057. "WebKit Extensions"
  13058. ],
  13059. initial: "black",
  13060. appliesto: "allElements",
  13061. computed: "asSpecified",
  13062. order: "uniqueOrder",
  13063. status: "nonstandard",
  13064. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-tap-highlight-color"
  13065. },
  13066. "-webkit-text-fill-color": {
  13067. syntax: "<color>",
  13068. media: "visual",
  13069. inherited: true,
  13070. animationType: "color",
  13071. percentages: "no",
  13072. groups: [
  13073. "WebKit Extensions"
  13074. ],
  13075. initial: "currentcolor",
  13076. appliesto: "allElements",
  13077. computed: "computedColor",
  13078. order: "uniqueOrder",
  13079. status: "nonstandard",
  13080. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-fill-color"
  13081. },
  13082. "-webkit-text-stroke": {
  13083. syntax: "<length> || <color>",
  13084. media: "visual",
  13085. inherited: true,
  13086. animationType: [
  13087. "-webkit-text-stroke-width",
  13088. "-webkit-text-stroke-color"
  13089. ],
  13090. percentages: "no",
  13091. groups: [
  13092. "WebKit Extensions"
  13093. ],
  13094. initial: [
  13095. "-webkit-text-stroke-width",
  13096. "-webkit-text-stroke-color"
  13097. ],
  13098. appliesto: "allElements",
  13099. computed: [
  13100. "-webkit-text-stroke-width",
  13101. "-webkit-text-stroke-color"
  13102. ],
  13103. order: "canonicalOrder",
  13104. status: "nonstandard",
  13105. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke"
  13106. },
  13107. "-webkit-text-stroke-color": {
  13108. syntax: "<color>",
  13109. media: "visual",
  13110. inherited: true,
  13111. animationType: "color",
  13112. percentages: "no",
  13113. groups: [
  13114. "WebKit Extensions"
  13115. ],
  13116. initial: "currentcolor",
  13117. appliesto: "allElements",
  13118. computed: "computedColor",
  13119. order: "uniqueOrder",
  13120. status: "nonstandard",
  13121. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke-color"
  13122. },
  13123. "-webkit-text-stroke-width": {
  13124. syntax: "<length>",
  13125. media: "visual",
  13126. inherited: true,
  13127. animationType: "discrete",
  13128. percentages: "no",
  13129. groups: [
  13130. "WebKit Extensions"
  13131. ],
  13132. initial: "0",
  13133. appliesto: "allElements",
  13134. computed: "absoluteLength",
  13135. order: "uniqueOrder",
  13136. status: "nonstandard",
  13137. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke-width"
  13138. },
  13139. "-webkit-touch-callout": {
  13140. syntax: "default | none",
  13141. media: "visual",
  13142. inherited: true,
  13143. animationType: "discrete",
  13144. percentages: "no",
  13145. groups: [
  13146. "WebKit Extensions"
  13147. ],
  13148. initial: "default",
  13149. appliesto: "allElements",
  13150. computed: "asSpecified",
  13151. order: "uniqueOrder",
  13152. status: "nonstandard",
  13153. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-touch-callout"
  13154. },
  13155. "-webkit-user-modify": {
  13156. syntax: "read-only | read-write | read-write-plaintext-only",
  13157. media: "interactive",
  13158. inherited: true,
  13159. animationType: "discrete",
  13160. percentages: "no",
  13161. groups: [
  13162. "WebKit Extensions"
  13163. ],
  13164. initial: "read-only",
  13165. appliesto: "allElements",
  13166. computed: "asSpecified",
  13167. order: "uniqueOrder",
  13168. status: "nonstandard"
  13169. },
  13170. "align-content": {
  13171. syntax: "normal | <baseline-position> | <content-distribution> | <overflow-position>? <content-position>",
  13172. media: "visual",
  13173. inherited: false,
  13174. animationType: "discrete",
  13175. percentages: "no",
  13176. groups: [
  13177. "CSS Box Alignment"
  13178. ],
  13179. initial: "normal",
  13180. appliesto: "multilineFlexContainers",
  13181. computed: "asSpecified",
  13182. order: "uniqueOrder",
  13183. status: "standard",
  13184. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/align-content"
  13185. },
  13186. "align-items": {
  13187. syntax: "normal | stretch | <baseline-position> | [ <overflow-position>? <self-position> ]",
  13188. media: "visual",
  13189. inherited: false,
  13190. animationType: "discrete",
  13191. percentages: "no",
  13192. groups: [
  13193. "CSS Box Alignment"
  13194. ],
  13195. initial: "normal",
  13196. appliesto: "allElements",
  13197. computed: "asSpecified",
  13198. order: "uniqueOrder",
  13199. status: "standard",
  13200. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/align-items"
  13201. },
  13202. "align-self": {
  13203. syntax: "auto | normal | stretch | <baseline-position> | <overflow-position>? <self-position>",
  13204. media: "visual",
  13205. inherited: false,
  13206. animationType: "discrete",
  13207. percentages: "no",
  13208. groups: [
  13209. "CSS Box Alignment"
  13210. ],
  13211. initial: "auto",
  13212. appliesto: "flexItemsGridItemsAndAbsolutelyPositionedBoxes",
  13213. computed: "autoOnAbsolutelyPositionedElementsValueOfAlignItemsOnParent",
  13214. order: "uniqueOrder",
  13215. status: "standard",
  13216. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/align-self"
  13217. },
  13218. "align-tracks": {
  13219. syntax: "[ normal | <baseline-position> | <content-distribution> | <overflow-position>? <content-position> ]#",
  13220. media: "visual",
  13221. inherited: false,
  13222. animationType: "discrete",
  13223. percentages: "no",
  13224. groups: [
  13225. "CSS Grid Layout"
  13226. ],
  13227. initial: "normal",
  13228. appliesto: "gridContainersWithMasonryLayoutInTheirBlockAxis",
  13229. computed: "asSpecified",
  13230. order: "uniqueOrder",
  13231. status: "experimental",
  13232. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/align-tracks"
  13233. },
  13234. all: all,
  13235. animation: animation,
  13236. "animation-delay": {
  13237. syntax: "<time>#",
  13238. media: "visual",
  13239. inherited: false,
  13240. animationType: "discrete",
  13241. percentages: "no",
  13242. groups: [
  13243. "CSS Animations"
  13244. ],
  13245. initial: "0s",
  13246. appliesto: "allElementsAndPseudos",
  13247. computed: "asSpecified",
  13248. order: "uniqueOrder",
  13249. status: "standard",
  13250. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-delay"
  13251. },
  13252. "animation-direction": {
  13253. syntax: "<single-animation-direction>#",
  13254. media: "visual",
  13255. inherited: false,
  13256. animationType: "discrete",
  13257. percentages: "no",
  13258. groups: [
  13259. "CSS Animations"
  13260. ],
  13261. initial: "normal",
  13262. appliesto: "allElementsAndPseudos",
  13263. computed: "asSpecified",
  13264. order: "uniqueOrder",
  13265. status: "standard",
  13266. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-direction"
  13267. },
  13268. "animation-duration": {
  13269. syntax: "<time>#",
  13270. media: "visual",
  13271. inherited: false,
  13272. animationType: "discrete",
  13273. percentages: "no",
  13274. groups: [
  13275. "CSS Animations"
  13276. ],
  13277. initial: "0s",
  13278. appliesto: "allElementsAndPseudos",
  13279. computed: "asSpecified",
  13280. order: "uniqueOrder",
  13281. status: "standard",
  13282. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-duration"
  13283. },
  13284. "animation-fill-mode": {
  13285. syntax: "<single-animation-fill-mode>#",
  13286. media: "visual",
  13287. inherited: false,
  13288. animationType: "discrete",
  13289. percentages: "no",
  13290. groups: [
  13291. "CSS Animations"
  13292. ],
  13293. initial: "none",
  13294. appliesto: "allElementsAndPseudos",
  13295. computed: "asSpecified",
  13296. order: "uniqueOrder",
  13297. status: "standard",
  13298. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-fill-mode"
  13299. },
  13300. "animation-iteration-count": {
  13301. syntax: "<single-animation-iteration-count>#",
  13302. media: "visual",
  13303. inherited: false,
  13304. animationType: "discrete",
  13305. percentages: "no",
  13306. groups: [
  13307. "CSS Animations"
  13308. ],
  13309. initial: "1",
  13310. appliesto: "allElementsAndPseudos",
  13311. computed: "asSpecified",
  13312. order: "uniqueOrder",
  13313. status: "standard",
  13314. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-iteration-count"
  13315. },
  13316. "animation-name": {
  13317. syntax: "[ none | <keyframes-name> ]#",
  13318. media: "visual",
  13319. inherited: false,
  13320. animationType: "discrete",
  13321. percentages: "no",
  13322. groups: [
  13323. "CSS Animations"
  13324. ],
  13325. initial: "none",
  13326. appliesto: "allElementsAndPseudos",
  13327. computed: "asSpecified",
  13328. order: "uniqueOrder",
  13329. status: "standard",
  13330. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-name"
  13331. },
  13332. "animation-play-state": {
  13333. syntax: "<single-animation-play-state>#",
  13334. media: "visual",
  13335. inherited: false,
  13336. animationType: "discrete",
  13337. percentages: "no",
  13338. groups: [
  13339. "CSS Animations"
  13340. ],
  13341. initial: "running",
  13342. appliesto: "allElementsAndPseudos",
  13343. computed: "asSpecified",
  13344. order: "uniqueOrder",
  13345. status: "standard",
  13346. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-play-state"
  13347. },
  13348. "animation-timing-function": {
  13349. syntax: "<timing-function>#",
  13350. media: "visual",
  13351. inherited: false,
  13352. animationType: "discrete",
  13353. percentages: "no",
  13354. groups: [
  13355. "CSS Animations"
  13356. ],
  13357. initial: "ease",
  13358. appliesto: "allElementsAndPseudos",
  13359. computed: "asSpecified",
  13360. order: "uniqueOrder",
  13361. status: "standard",
  13362. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-timing-function"
  13363. },
  13364. appearance: appearance,
  13365. "aspect-ratio": {
  13366. syntax: "auto | <ratio>",
  13367. media: "all",
  13368. inherited: false,
  13369. animationType: "discrete",
  13370. percentages: "no",
  13371. groups: [
  13372. "CSS Basic User Interface"
  13373. ],
  13374. initial: "auto",
  13375. appliesto: "allElementsExceptInlineBoxesAndInternalRubyOrTableBoxes",
  13376. computed: "asSpecified",
  13377. order: "perGrammar",
  13378. status: "experimental",
  13379. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/aspect-ratio"
  13380. },
  13381. azimuth: azimuth,
  13382. "backdrop-filter": {
  13383. syntax: "none | <filter-function-list>",
  13384. media: "visual",
  13385. inherited: false,
  13386. animationType: "filterList",
  13387. percentages: "no",
  13388. groups: [
  13389. "Filter Effects"
  13390. ],
  13391. initial: "none",
  13392. appliesto: "allElementsSVGContainerElements",
  13393. computed: "asSpecified",
  13394. order: "uniqueOrder",
  13395. status: "standard",
  13396. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/backdrop-filter"
  13397. },
  13398. "backface-visibility": {
  13399. syntax: "visible | hidden",
  13400. media: "visual",
  13401. inherited: false,
  13402. animationType: "discrete",
  13403. percentages: "no",
  13404. groups: [
  13405. "CSS Transforms"
  13406. ],
  13407. initial: "visible",
  13408. appliesto: "transformableElements",
  13409. computed: "asSpecified",
  13410. order: "uniqueOrder",
  13411. status: "standard",
  13412. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/backface-visibility"
  13413. },
  13414. background: background,
  13415. "background-attachment": {
  13416. syntax: "<attachment>#",
  13417. media: "visual",
  13418. inherited: false,
  13419. animationType: "discrete",
  13420. percentages: "no",
  13421. groups: [
  13422. "CSS Backgrounds and Borders"
  13423. ],
  13424. initial: "scroll",
  13425. appliesto: "allElements",
  13426. computed: "asSpecified",
  13427. order: "uniqueOrder",
  13428. alsoAppliesTo: [
  13429. "::first-letter",
  13430. "::first-line",
  13431. "::placeholder"
  13432. ],
  13433. status: "standard",
  13434. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-attachment"
  13435. },
  13436. "background-blend-mode": {
  13437. syntax: "<blend-mode>#",
  13438. media: "none",
  13439. inherited: false,
  13440. animationType: "discrete",
  13441. percentages: "no",
  13442. groups: [
  13443. "Compositing and Blending"
  13444. ],
  13445. initial: "normal",
  13446. appliesto: "allElementsSVGContainerGraphicsAndGraphicsReferencingElements",
  13447. computed: "asSpecified",
  13448. order: "uniqueOrder",
  13449. alsoAppliesTo: [
  13450. "::first-letter",
  13451. "::first-line",
  13452. "::placeholder"
  13453. ],
  13454. status: "standard",
  13455. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-blend-mode"
  13456. },
  13457. "background-clip": {
  13458. syntax: "<box>#",
  13459. media: "visual",
  13460. inherited: false,
  13461. animationType: "discrete",
  13462. percentages: "no",
  13463. groups: [
  13464. "CSS Backgrounds and Borders"
  13465. ],
  13466. initial: "border-box",
  13467. appliesto: "allElements",
  13468. computed: "asSpecified",
  13469. order: "uniqueOrder",
  13470. alsoAppliesTo: [
  13471. "::first-letter",
  13472. "::first-line",
  13473. "::placeholder"
  13474. ],
  13475. status: "standard",
  13476. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-clip"
  13477. },
  13478. "background-color": {
  13479. syntax: "<color>",
  13480. media: "visual",
  13481. inherited: false,
  13482. animationType: "color",
  13483. percentages: "no",
  13484. groups: [
  13485. "CSS Backgrounds and Borders"
  13486. ],
  13487. initial: "transparent",
  13488. appliesto: "allElements",
  13489. computed: "computedColor",
  13490. order: "uniqueOrder",
  13491. alsoAppliesTo: [
  13492. "::first-letter",
  13493. "::first-line",
  13494. "::placeholder"
  13495. ],
  13496. status: "standard",
  13497. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-color"
  13498. },
  13499. "background-image": {
  13500. syntax: "<bg-image>#",
  13501. media: "visual",
  13502. inherited: false,
  13503. animationType: "discrete",
  13504. percentages: "no",
  13505. groups: [
  13506. "CSS Backgrounds and Borders"
  13507. ],
  13508. initial: "none",
  13509. appliesto: "allElements",
  13510. computed: "asSpecifiedURLsAbsolute",
  13511. order: "uniqueOrder",
  13512. alsoAppliesTo: [
  13513. "::first-letter",
  13514. "::first-line",
  13515. "::placeholder"
  13516. ],
  13517. status: "standard",
  13518. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-image"
  13519. },
  13520. "background-origin": {
  13521. syntax: "<box>#",
  13522. media: "visual",
  13523. inherited: false,
  13524. animationType: "discrete",
  13525. percentages: "no",
  13526. groups: [
  13527. "CSS Backgrounds and Borders"
  13528. ],
  13529. initial: "padding-box",
  13530. appliesto: "allElements",
  13531. computed: "asSpecified",
  13532. order: "uniqueOrder",
  13533. alsoAppliesTo: [
  13534. "::first-letter",
  13535. "::first-line",
  13536. "::placeholder"
  13537. ],
  13538. status: "standard",
  13539. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-origin"
  13540. },
  13541. "background-position": {
  13542. syntax: "<bg-position>#",
  13543. media: "visual",
  13544. inherited: false,
  13545. animationType: "repeatableListOfSimpleListOfLpc",
  13546. percentages: "referToSizeOfBackgroundPositioningAreaMinusBackgroundImageSize",
  13547. groups: [
  13548. "CSS Backgrounds and Borders"
  13549. ],
  13550. initial: "0% 0%",
  13551. appliesto: "allElements",
  13552. computed: "listEachItemTwoKeywordsOriginOffsets",
  13553. order: "uniqueOrder",
  13554. alsoAppliesTo: [
  13555. "::first-letter",
  13556. "::first-line",
  13557. "::placeholder"
  13558. ],
  13559. status: "standard",
  13560. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-position"
  13561. },
  13562. "background-position-x": {
  13563. syntax: "[ center | [ [ left | right | x-start | x-end ]? <length-percentage>? ]! ]#",
  13564. media: "visual",
  13565. inherited: false,
  13566. animationType: "discrete",
  13567. percentages: "referToWidthOfBackgroundPositioningAreaMinusBackgroundImageHeight",
  13568. groups: [
  13569. "CSS Backgrounds and Borders"
  13570. ],
  13571. initial: "left",
  13572. appliesto: "allElements",
  13573. computed: "listEachItemConsistingOfAbsoluteLengthPercentageAndOrigin",
  13574. order: "uniqueOrder",
  13575. status: "experimental",
  13576. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-position-x"
  13577. },
  13578. "background-position-y": {
  13579. syntax: "[ center | [ [ top | bottom | y-start | y-end ]? <length-percentage>? ]! ]#",
  13580. media: "visual",
  13581. inherited: false,
  13582. animationType: "discrete",
  13583. percentages: "referToHeightOfBackgroundPositioningAreaMinusBackgroundImageHeight",
  13584. groups: [
  13585. "CSS Backgrounds and Borders"
  13586. ],
  13587. initial: "top",
  13588. appliesto: "allElements",
  13589. computed: "listEachItemConsistingOfAbsoluteLengthPercentageAndOrigin",
  13590. order: "uniqueOrder",
  13591. status: "experimental",
  13592. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-position-y"
  13593. },
  13594. "background-repeat": {
  13595. syntax: "<repeat-style>#",
  13596. media: "visual",
  13597. inherited: false,
  13598. animationType: "discrete",
  13599. percentages: "no",
  13600. groups: [
  13601. "CSS Backgrounds and Borders"
  13602. ],
  13603. initial: "repeat",
  13604. appliesto: "allElements",
  13605. computed: "listEachItemHasTwoKeywordsOnePerDimension",
  13606. order: "uniqueOrder",
  13607. alsoAppliesTo: [
  13608. "::first-letter",
  13609. "::first-line",
  13610. "::placeholder"
  13611. ],
  13612. status: "standard",
  13613. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-repeat"
  13614. },
  13615. "background-size": {
  13616. syntax: "<bg-size>#",
  13617. media: "visual",
  13618. inherited: false,
  13619. animationType: "repeatableListOfSimpleListOfLpc",
  13620. percentages: "relativeToBackgroundPositioningArea",
  13621. groups: [
  13622. "CSS Backgrounds and Borders"
  13623. ],
  13624. initial: "auto auto",
  13625. appliesto: "allElements",
  13626. computed: "asSpecifiedRelativeToAbsoluteLengths",
  13627. order: "uniqueOrder",
  13628. alsoAppliesTo: [
  13629. "::first-letter",
  13630. "::first-line",
  13631. "::placeholder"
  13632. ],
  13633. status: "standard",
  13634. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-size"
  13635. },
  13636. "block-overflow": {
  13637. syntax: "clip | ellipsis | <string>",
  13638. media: "visual",
  13639. inherited: true,
  13640. animationType: "discrete",
  13641. percentages: "no",
  13642. groups: [
  13643. "CSS Overflow"
  13644. ],
  13645. initial: "clip",
  13646. appliesto: "blockContainers",
  13647. computed: "asSpecified",
  13648. order: "perGrammar",
  13649. status: "experimental"
  13650. },
  13651. "block-size": {
  13652. syntax: "<'width'>",
  13653. media: "visual",
  13654. inherited: false,
  13655. animationType: "lpc",
  13656. percentages: "blockSizeOfContainingBlock",
  13657. groups: [
  13658. "CSS Logical Properties"
  13659. ],
  13660. initial: "auto",
  13661. appliesto: "sameAsWidthAndHeight",
  13662. computed: "sameAsWidthAndHeight",
  13663. order: "uniqueOrder",
  13664. status: "standard",
  13665. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/block-size"
  13666. },
  13667. border: border,
  13668. "border-block": {
  13669. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  13670. media: "visual",
  13671. inherited: false,
  13672. animationType: "discrete",
  13673. percentages: "no",
  13674. groups: [
  13675. "CSS Logical Properties"
  13676. ],
  13677. initial: [
  13678. "border-top-width",
  13679. "border-top-style",
  13680. "border-top-color"
  13681. ],
  13682. appliesto: "allElements",
  13683. computed: [
  13684. "border-top-width",
  13685. "border-top-style",
  13686. "border-top-color"
  13687. ],
  13688. order: "uniqueOrder",
  13689. status: "standard",
  13690. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block"
  13691. },
  13692. "border-block-color": {
  13693. syntax: "<'border-top-color'>{1,2}",
  13694. media: "visual",
  13695. inherited: false,
  13696. animationType: "discrete",
  13697. percentages: "no",
  13698. groups: [
  13699. "CSS Logical Properties"
  13700. ],
  13701. initial: "currentcolor",
  13702. appliesto: "allElements",
  13703. computed: "computedColor",
  13704. order: "uniqueOrder",
  13705. status: "standard",
  13706. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-color"
  13707. },
  13708. "border-block-style": {
  13709. syntax: "<'border-top-style'>",
  13710. media: "visual",
  13711. inherited: false,
  13712. animationType: "discrete",
  13713. percentages: "no",
  13714. groups: [
  13715. "CSS Logical Properties"
  13716. ],
  13717. initial: "none",
  13718. appliesto: "allElements",
  13719. computed: "asSpecified",
  13720. order: "uniqueOrder",
  13721. status: "standard",
  13722. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-style"
  13723. },
  13724. "border-block-width": {
  13725. syntax: "<'border-top-width'>",
  13726. media: "visual",
  13727. inherited: false,
  13728. animationType: "discrete",
  13729. percentages: "logicalWidthOfContainingBlock",
  13730. groups: [
  13731. "CSS Logical Properties"
  13732. ],
  13733. initial: "medium",
  13734. appliesto: "allElements",
  13735. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  13736. order: "uniqueOrder",
  13737. status: "standard",
  13738. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-width"
  13739. },
  13740. "border-block-end": {
  13741. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  13742. media: "visual",
  13743. inherited: false,
  13744. animationType: [
  13745. "border-block-end-color",
  13746. "border-block-end-style",
  13747. "border-block-end-width"
  13748. ],
  13749. percentages: "no",
  13750. groups: [
  13751. "CSS Logical Properties"
  13752. ],
  13753. initial: [
  13754. "border-top-width",
  13755. "border-top-style",
  13756. "border-top-color"
  13757. ],
  13758. appliesto: "allElements",
  13759. computed: [
  13760. "border-top-width",
  13761. "border-top-style",
  13762. "border-top-color"
  13763. ],
  13764. order: "uniqueOrder",
  13765. status: "standard",
  13766. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-end"
  13767. },
  13768. "border-block-end-color": {
  13769. syntax: "<'border-top-color'>",
  13770. media: "visual",
  13771. inherited: false,
  13772. animationType: "color",
  13773. percentages: "no",
  13774. groups: [
  13775. "CSS Logical Properties"
  13776. ],
  13777. initial: "currentcolor",
  13778. appliesto: "allElements",
  13779. computed: "computedColor",
  13780. order: "uniqueOrder",
  13781. status: "standard",
  13782. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-end-color"
  13783. },
  13784. "border-block-end-style": {
  13785. syntax: "<'border-top-style'>",
  13786. media: "visual",
  13787. inherited: false,
  13788. animationType: "discrete",
  13789. percentages: "no",
  13790. groups: [
  13791. "CSS Logical Properties"
  13792. ],
  13793. initial: "none",
  13794. appliesto: "allElements",
  13795. computed: "asSpecified",
  13796. order: "uniqueOrder",
  13797. status: "standard",
  13798. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-end-style"
  13799. },
  13800. "border-block-end-width": {
  13801. syntax: "<'border-top-width'>",
  13802. media: "visual",
  13803. inherited: false,
  13804. animationType: "length",
  13805. percentages: "logicalWidthOfContainingBlock",
  13806. groups: [
  13807. "CSS Logical Properties"
  13808. ],
  13809. initial: "medium",
  13810. appliesto: "allElements",
  13811. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  13812. order: "uniqueOrder",
  13813. status: "standard",
  13814. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-end-width"
  13815. },
  13816. "border-block-start": {
  13817. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  13818. media: "visual",
  13819. inherited: false,
  13820. animationType: [
  13821. "border-block-start-color",
  13822. "border-block-start-style",
  13823. "border-block-start-width"
  13824. ],
  13825. percentages: "no",
  13826. groups: [
  13827. "CSS Logical Properties"
  13828. ],
  13829. initial: [
  13830. "border-width",
  13831. "border-style",
  13832. "color"
  13833. ],
  13834. appliesto: "allElements",
  13835. computed: [
  13836. "border-width",
  13837. "border-style",
  13838. "border-block-start-color"
  13839. ],
  13840. order: "uniqueOrder",
  13841. status: "standard",
  13842. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-start"
  13843. },
  13844. "border-block-start-color": {
  13845. syntax: "<'border-top-color'>",
  13846. media: "visual",
  13847. inherited: false,
  13848. animationType: "color",
  13849. percentages: "no",
  13850. groups: [
  13851. "CSS Logical Properties"
  13852. ],
  13853. initial: "currentcolor",
  13854. appliesto: "allElements",
  13855. computed: "computedColor",
  13856. order: "uniqueOrder",
  13857. status: "standard",
  13858. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-start-color"
  13859. },
  13860. "border-block-start-style": {
  13861. syntax: "<'border-top-style'>",
  13862. media: "visual",
  13863. inherited: false,
  13864. animationType: "discrete",
  13865. percentages: "no",
  13866. groups: [
  13867. "CSS Logical Properties"
  13868. ],
  13869. initial: "none",
  13870. appliesto: "allElements",
  13871. computed: "asSpecified",
  13872. order: "uniqueOrder",
  13873. status: "standard",
  13874. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-start-style"
  13875. },
  13876. "border-block-start-width": {
  13877. syntax: "<'border-top-width'>",
  13878. media: "visual",
  13879. inherited: false,
  13880. animationType: "length",
  13881. percentages: "logicalWidthOfContainingBlock",
  13882. groups: [
  13883. "CSS Logical Properties"
  13884. ],
  13885. initial: "medium",
  13886. appliesto: "allElements",
  13887. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  13888. order: "uniqueOrder",
  13889. status: "standard",
  13890. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-start-width"
  13891. },
  13892. "border-bottom": {
  13893. syntax: "<line-width> || <line-style> || <color>",
  13894. media: "visual",
  13895. inherited: false,
  13896. animationType: [
  13897. "border-bottom-color",
  13898. "border-bottom-style",
  13899. "border-bottom-width"
  13900. ],
  13901. percentages: "no",
  13902. groups: [
  13903. "CSS Backgrounds and Borders"
  13904. ],
  13905. initial: [
  13906. "border-bottom-width",
  13907. "border-bottom-style",
  13908. "border-bottom-color"
  13909. ],
  13910. appliesto: "allElements",
  13911. computed: [
  13912. "border-bottom-width",
  13913. "border-bottom-style",
  13914. "border-bottom-color"
  13915. ],
  13916. order: "orderOfAppearance",
  13917. alsoAppliesTo: [
  13918. "::first-letter"
  13919. ],
  13920. status: "standard",
  13921. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom"
  13922. },
  13923. "border-bottom-color": {
  13924. syntax: "<'border-top-color'>",
  13925. media: "visual",
  13926. inherited: false,
  13927. animationType: "color",
  13928. percentages: "no",
  13929. groups: [
  13930. "CSS Backgrounds and Borders"
  13931. ],
  13932. initial: "currentcolor",
  13933. appliesto: "allElements",
  13934. computed: "computedColor",
  13935. order: "uniqueOrder",
  13936. alsoAppliesTo: [
  13937. "::first-letter"
  13938. ],
  13939. status: "standard",
  13940. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-color"
  13941. },
  13942. "border-bottom-left-radius": {
  13943. syntax: "<length-percentage>{1,2}",
  13944. media: "visual",
  13945. inherited: false,
  13946. animationType: "lpc",
  13947. percentages: "referToDimensionOfBorderBox",
  13948. groups: [
  13949. "CSS Backgrounds and Borders"
  13950. ],
  13951. initial: "0",
  13952. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  13953. computed: "twoAbsoluteLengthOrPercentages",
  13954. order: "uniqueOrder",
  13955. alsoAppliesTo: [
  13956. "::first-letter"
  13957. ],
  13958. status: "standard",
  13959. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-left-radius"
  13960. },
  13961. "border-bottom-right-radius": {
  13962. syntax: "<length-percentage>{1,2}",
  13963. media: "visual",
  13964. inherited: false,
  13965. animationType: "lpc",
  13966. percentages: "referToDimensionOfBorderBox",
  13967. groups: [
  13968. "CSS Backgrounds and Borders"
  13969. ],
  13970. initial: "0",
  13971. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  13972. computed: "twoAbsoluteLengthOrPercentages",
  13973. order: "uniqueOrder",
  13974. alsoAppliesTo: [
  13975. "::first-letter"
  13976. ],
  13977. status: "standard",
  13978. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-right-radius"
  13979. },
  13980. "border-bottom-style": {
  13981. syntax: "<line-style>",
  13982. media: "visual",
  13983. inherited: false,
  13984. animationType: "discrete",
  13985. percentages: "no",
  13986. groups: [
  13987. "CSS Backgrounds and Borders"
  13988. ],
  13989. initial: "none",
  13990. appliesto: "allElements",
  13991. computed: "asSpecified",
  13992. order: "uniqueOrder",
  13993. alsoAppliesTo: [
  13994. "::first-letter"
  13995. ],
  13996. status: "standard",
  13997. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-style"
  13998. },
  13999. "border-bottom-width": {
  14000. syntax: "<line-width>",
  14001. media: "visual",
  14002. inherited: false,
  14003. animationType: "length",
  14004. percentages: "no",
  14005. groups: [
  14006. "CSS Backgrounds and Borders"
  14007. ],
  14008. initial: "medium",
  14009. appliesto: "allElements",
  14010. computed: "absoluteLengthOr0IfBorderBottomStyleNoneOrHidden",
  14011. order: "uniqueOrder",
  14012. alsoAppliesTo: [
  14013. "::first-letter"
  14014. ],
  14015. status: "standard",
  14016. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-width"
  14017. },
  14018. "border-collapse": {
  14019. syntax: "collapse | separate",
  14020. media: "visual",
  14021. inherited: true,
  14022. animationType: "discrete",
  14023. percentages: "no",
  14024. groups: [
  14025. "CSS Table"
  14026. ],
  14027. initial: "separate",
  14028. appliesto: "tableElements",
  14029. computed: "asSpecified",
  14030. order: "uniqueOrder",
  14031. status: "standard",
  14032. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-collapse"
  14033. },
  14034. "border-color": {
  14035. syntax: "<color>{1,4}",
  14036. media: "visual",
  14037. inherited: false,
  14038. animationType: [
  14039. "border-bottom-color",
  14040. "border-left-color",
  14041. "border-right-color",
  14042. "border-top-color"
  14043. ],
  14044. percentages: "no",
  14045. groups: [
  14046. "CSS Backgrounds and Borders"
  14047. ],
  14048. initial: [
  14049. "border-top-color",
  14050. "border-right-color",
  14051. "border-bottom-color",
  14052. "border-left-color"
  14053. ],
  14054. appliesto: "allElements",
  14055. computed: [
  14056. "border-bottom-color",
  14057. "border-left-color",
  14058. "border-right-color",
  14059. "border-top-color"
  14060. ],
  14061. order: "uniqueOrder",
  14062. alsoAppliesTo: [
  14063. "::first-letter"
  14064. ],
  14065. status: "standard",
  14066. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-color"
  14067. },
  14068. "border-end-end-radius": {
  14069. syntax: "<length-percentage>{1,2}",
  14070. media: "visual",
  14071. inherited: false,
  14072. animationType: "lpc",
  14073. percentages: "referToDimensionOfBorderBox",
  14074. groups: [
  14075. "CSS Logical Properties"
  14076. ],
  14077. initial: "0",
  14078. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  14079. computed: "twoAbsoluteLengthOrPercentages",
  14080. order: "uniqueOrder",
  14081. alsoAppliesTo: [
  14082. "::first-letter"
  14083. ],
  14084. status: "standard",
  14085. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-end-end-radius"
  14086. },
  14087. "border-end-start-radius": {
  14088. syntax: "<length-percentage>{1,2}",
  14089. media: "visual",
  14090. inherited: false,
  14091. animationType: "lpc",
  14092. percentages: "referToDimensionOfBorderBox",
  14093. groups: [
  14094. "CSS Logical Properties"
  14095. ],
  14096. initial: "0",
  14097. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  14098. computed: "twoAbsoluteLengthOrPercentages",
  14099. order: "uniqueOrder",
  14100. alsoAppliesTo: [
  14101. "::first-letter"
  14102. ],
  14103. status: "standard",
  14104. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-end-start-radius"
  14105. },
  14106. "border-image": {
  14107. syntax: "<'border-image-source'> || <'border-image-slice'> [ / <'border-image-width'> | / <'border-image-width'>? / <'border-image-outset'> ]? || <'border-image-repeat'>",
  14108. media: "visual",
  14109. inherited: false,
  14110. animationType: "discrete",
  14111. percentages: [
  14112. "border-image-slice",
  14113. "border-image-width"
  14114. ],
  14115. groups: [
  14116. "CSS Backgrounds and Borders"
  14117. ],
  14118. initial: [
  14119. "border-image-source",
  14120. "border-image-slice",
  14121. "border-image-width",
  14122. "border-image-outset",
  14123. "border-image-repeat"
  14124. ],
  14125. appliesto: "allElementsExceptTableElementsWhenCollapse",
  14126. computed: [
  14127. "border-image-outset",
  14128. "border-image-repeat",
  14129. "border-image-slice",
  14130. "border-image-source",
  14131. "border-image-width"
  14132. ],
  14133. order: "uniqueOrder",
  14134. alsoAppliesTo: [
  14135. "::first-letter"
  14136. ],
  14137. status: "standard",
  14138. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image"
  14139. },
  14140. "border-image-outset": {
  14141. syntax: "[ <length> | <number> ]{1,4}",
  14142. media: "visual",
  14143. inherited: false,
  14144. animationType: "byComputedValueType",
  14145. percentages: "no",
  14146. groups: [
  14147. "CSS Backgrounds and Borders"
  14148. ],
  14149. initial: "0",
  14150. appliesto: "allElementsExceptTableElementsWhenCollapse",
  14151. computed: "asSpecifiedRelativeToAbsoluteLengths",
  14152. order: "uniqueOrder",
  14153. alsoAppliesTo: [
  14154. "::first-letter"
  14155. ],
  14156. status: "standard",
  14157. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-outset"
  14158. },
  14159. "border-image-repeat": {
  14160. syntax: "[ stretch | repeat | round | space ]{1,2}",
  14161. media: "visual",
  14162. inherited: false,
  14163. animationType: "discrete",
  14164. percentages: "no",
  14165. groups: [
  14166. "CSS Backgrounds and Borders"
  14167. ],
  14168. initial: "stretch",
  14169. appliesto: "allElementsExceptTableElementsWhenCollapse",
  14170. computed: "asSpecified",
  14171. order: "uniqueOrder",
  14172. alsoAppliesTo: [
  14173. "::first-letter"
  14174. ],
  14175. status: "standard",
  14176. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-repeat"
  14177. },
  14178. "border-image-slice": {
  14179. syntax: "<number-percentage>{1,4} && fill?",
  14180. media: "visual",
  14181. inherited: false,
  14182. animationType: "byComputedValueType",
  14183. percentages: "referToSizeOfBorderImage",
  14184. groups: [
  14185. "CSS Backgrounds and Borders"
  14186. ],
  14187. initial: "100%",
  14188. appliesto: "allElementsExceptTableElementsWhenCollapse",
  14189. computed: "oneToFourPercentagesOrAbsoluteLengthsPlusFill",
  14190. order: "percentagesOrLengthsFollowedByFill",
  14191. alsoAppliesTo: [
  14192. "::first-letter"
  14193. ],
  14194. status: "standard",
  14195. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-slice"
  14196. },
  14197. "border-image-source": {
  14198. syntax: "none | <image>",
  14199. media: "visual",
  14200. inherited: false,
  14201. animationType: "discrete",
  14202. percentages: "no",
  14203. groups: [
  14204. "CSS Backgrounds and Borders"
  14205. ],
  14206. initial: "none",
  14207. appliesto: "allElementsExceptTableElementsWhenCollapse",
  14208. computed: "noneOrImageWithAbsoluteURI",
  14209. order: "uniqueOrder",
  14210. alsoAppliesTo: [
  14211. "::first-letter"
  14212. ],
  14213. status: "standard",
  14214. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-source"
  14215. },
  14216. "border-image-width": {
  14217. syntax: "[ <length-percentage> | <number> | auto ]{1,4}",
  14218. media: "visual",
  14219. inherited: false,
  14220. animationType: "byComputedValueType",
  14221. percentages: "referToWidthOrHeightOfBorderImageArea",
  14222. groups: [
  14223. "CSS Backgrounds and Borders"
  14224. ],
  14225. initial: "1",
  14226. appliesto: "allElementsExceptTableElementsWhenCollapse",
  14227. computed: "asSpecifiedRelativeToAbsoluteLengths",
  14228. order: "uniqueOrder",
  14229. alsoAppliesTo: [
  14230. "::first-letter"
  14231. ],
  14232. status: "standard",
  14233. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-width"
  14234. },
  14235. "border-inline": {
  14236. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  14237. media: "visual",
  14238. inherited: false,
  14239. animationType: "discrete",
  14240. percentages: "no",
  14241. groups: [
  14242. "CSS Logical Properties"
  14243. ],
  14244. initial: [
  14245. "border-top-width",
  14246. "border-top-style",
  14247. "border-top-color"
  14248. ],
  14249. appliesto: "allElements",
  14250. computed: [
  14251. "border-top-width",
  14252. "border-top-style",
  14253. "border-top-color"
  14254. ],
  14255. order: "uniqueOrder",
  14256. status: "standard",
  14257. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline"
  14258. },
  14259. "border-inline-end": {
  14260. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  14261. media: "visual",
  14262. inherited: false,
  14263. animationType: [
  14264. "border-inline-end-color",
  14265. "border-inline-end-style",
  14266. "border-inline-end-width"
  14267. ],
  14268. percentages: "no",
  14269. groups: [
  14270. "CSS Logical Properties"
  14271. ],
  14272. initial: [
  14273. "border-width",
  14274. "border-style",
  14275. "color"
  14276. ],
  14277. appliesto: "allElements",
  14278. computed: [
  14279. "border-width",
  14280. "border-style",
  14281. "border-inline-end-color"
  14282. ],
  14283. order: "uniqueOrder",
  14284. status: "standard",
  14285. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-end"
  14286. },
  14287. "border-inline-color": {
  14288. syntax: "<'border-top-color'>{1,2}",
  14289. media: "visual",
  14290. inherited: false,
  14291. animationType: "discrete",
  14292. percentages: "no",
  14293. groups: [
  14294. "CSS Logical Properties"
  14295. ],
  14296. initial: "currentcolor",
  14297. appliesto: "allElements",
  14298. computed: "computedColor",
  14299. order: "uniqueOrder",
  14300. status: "standard",
  14301. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-color"
  14302. },
  14303. "border-inline-style": {
  14304. syntax: "<'border-top-style'>",
  14305. media: "visual",
  14306. inherited: false,
  14307. animationType: "discrete",
  14308. percentages: "no",
  14309. groups: [
  14310. "CSS Logical Properties"
  14311. ],
  14312. initial: "none",
  14313. appliesto: "allElements",
  14314. computed: "asSpecified",
  14315. order: "uniqueOrder",
  14316. status: "standard",
  14317. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-style"
  14318. },
  14319. "border-inline-width": {
  14320. syntax: "<'border-top-width'>",
  14321. media: "visual",
  14322. inherited: false,
  14323. animationType: "discrete",
  14324. percentages: "logicalWidthOfContainingBlock",
  14325. groups: [
  14326. "CSS Logical Properties"
  14327. ],
  14328. initial: "medium",
  14329. appliesto: "allElements",
  14330. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  14331. order: "uniqueOrder",
  14332. status: "standard",
  14333. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-width"
  14334. },
  14335. "border-inline-end-color": {
  14336. syntax: "<'border-top-color'>",
  14337. media: "visual",
  14338. inherited: false,
  14339. animationType: "color",
  14340. percentages: "no",
  14341. groups: [
  14342. "CSS Logical Properties"
  14343. ],
  14344. initial: "currentcolor",
  14345. appliesto: "allElements",
  14346. computed: "computedColor",
  14347. order: "uniqueOrder",
  14348. status: "standard",
  14349. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-end-color"
  14350. },
  14351. "border-inline-end-style": {
  14352. syntax: "<'border-top-style'>",
  14353. media: "visual",
  14354. inherited: false,
  14355. animationType: "discrete",
  14356. percentages: "no",
  14357. groups: [
  14358. "CSS Logical Properties"
  14359. ],
  14360. initial: "none",
  14361. appliesto: "allElements",
  14362. computed: "asSpecified",
  14363. order: "uniqueOrder",
  14364. status: "standard",
  14365. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-end-style"
  14366. },
  14367. "border-inline-end-width": {
  14368. syntax: "<'border-top-width'>",
  14369. media: "visual",
  14370. inherited: false,
  14371. animationType: "length",
  14372. percentages: "logicalWidthOfContainingBlock",
  14373. groups: [
  14374. "CSS Logical Properties"
  14375. ],
  14376. initial: "medium",
  14377. appliesto: "allElements",
  14378. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  14379. order: "uniqueOrder",
  14380. status: "standard",
  14381. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-end-width"
  14382. },
  14383. "border-inline-start": {
  14384. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  14385. media: "visual",
  14386. inherited: false,
  14387. animationType: [
  14388. "border-inline-start-color",
  14389. "border-inline-start-style",
  14390. "border-inline-start-width"
  14391. ],
  14392. percentages: "no",
  14393. groups: [
  14394. "CSS Logical Properties"
  14395. ],
  14396. initial: [
  14397. "border-width",
  14398. "border-style",
  14399. "color"
  14400. ],
  14401. appliesto: "allElements",
  14402. computed: [
  14403. "border-width",
  14404. "border-style",
  14405. "border-inline-start-color"
  14406. ],
  14407. order: "uniqueOrder",
  14408. status: "standard",
  14409. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-start"
  14410. },
  14411. "border-inline-start-color": {
  14412. syntax: "<'border-top-color'>",
  14413. media: "visual",
  14414. inherited: false,
  14415. animationType: "color",
  14416. percentages: "no",
  14417. groups: [
  14418. "CSS Logical Properties"
  14419. ],
  14420. initial: "currentcolor",
  14421. appliesto: "allElements",
  14422. computed: "computedColor",
  14423. order: "uniqueOrder",
  14424. status: "standard",
  14425. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-start-color"
  14426. },
  14427. "border-inline-start-style": {
  14428. syntax: "<'border-top-style'>",
  14429. media: "visual",
  14430. inherited: false,
  14431. animationType: "discrete",
  14432. percentages: "no",
  14433. groups: [
  14434. "CSS Logical Properties"
  14435. ],
  14436. initial: "none",
  14437. appliesto: "allElements",
  14438. computed: "asSpecified",
  14439. order: "uniqueOrder",
  14440. status: "standard",
  14441. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-start-style"
  14442. },
  14443. "border-inline-start-width": {
  14444. syntax: "<'border-top-width'>",
  14445. media: "visual",
  14446. inherited: false,
  14447. animationType: "length",
  14448. percentages: "logicalWidthOfContainingBlock",
  14449. groups: [
  14450. "CSS Logical Properties"
  14451. ],
  14452. initial: "medium",
  14453. appliesto: "allElements",
  14454. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  14455. order: "uniqueOrder",
  14456. status: "standard",
  14457. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-start-width"
  14458. },
  14459. "border-left": {
  14460. syntax: "<line-width> || <line-style> || <color>",
  14461. media: "visual",
  14462. inherited: false,
  14463. animationType: [
  14464. "border-left-color",
  14465. "border-left-style",
  14466. "border-left-width"
  14467. ],
  14468. percentages: "no",
  14469. groups: [
  14470. "CSS Backgrounds and Borders"
  14471. ],
  14472. initial: [
  14473. "border-left-width",
  14474. "border-left-style",
  14475. "border-left-color"
  14476. ],
  14477. appliesto: "allElements",
  14478. computed: [
  14479. "border-left-width",
  14480. "border-left-style",
  14481. "border-left-color"
  14482. ],
  14483. order: "orderOfAppearance",
  14484. alsoAppliesTo: [
  14485. "::first-letter"
  14486. ],
  14487. status: "standard",
  14488. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-left"
  14489. },
  14490. "border-left-color": {
  14491. syntax: "<color>",
  14492. media: "visual",
  14493. inherited: false,
  14494. animationType: "color",
  14495. percentages: "no",
  14496. groups: [
  14497. "CSS Backgrounds and Borders"
  14498. ],
  14499. initial: "currentcolor",
  14500. appliesto: "allElements",
  14501. computed: "computedColor",
  14502. order: "uniqueOrder",
  14503. alsoAppliesTo: [
  14504. "::first-letter"
  14505. ],
  14506. status: "standard",
  14507. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-left-color"
  14508. },
  14509. "border-left-style": {
  14510. syntax: "<line-style>",
  14511. media: "visual",
  14512. inherited: false,
  14513. animationType: "discrete",
  14514. percentages: "no",
  14515. groups: [
  14516. "CSS Backgrounds and Borders"
  14517. ],
  14518. initial: "none",
  14519. appliesto: "allElements",
  14520. computed: "asSpecified",
  14521. order: "uniqueOrder",
  14522. alsoAppliesTo: [
  14523. "::first-letter"
  14524. ],
  14525. status: "standard",
  14526. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-left-style"
  14527. },
  14528. "border-left-width": {
  14529. syntax: "<line-width>",
  14530. media: "visual",
  14531. inherited: false,
  14532. animationType: "length",
  14533. percentages: "no",
  14534. groups: [
  14535. "CSS Backgrounds and Borders"
  14536. ],
  14537. initial: "medium",
  14538. appliesto: "allElements",
  14539. computed: "absoluteLengthOr0IfBorderLeftStyleNoneOrHidden",
  14540. order: "uniqueOrder",
  14541. alsoAppliesTo: [
  14542. "::first-letter"
  14543. ],
  14544. status: "standard",
  14545. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-left-width"
  14546. },
  14547. "border-radius": {
  14548. syntax: "<length-percentage>{1,4} [ / <length-percentage>{1,4} ]?",
  14549. media: "visual",
  14550. inherited: false,
  14551. animationType: [
  14552. "border-top-left-radius",
  14553. "border-top-right-radius",
  14554. "border-bottom-right-radius",
  14555. "border-bottom-left-radius"
  14556. ],
  14557. percentages: "referToDimensionOfBorderBox",
  14558. groups: [
  14559. "CSS Backgrounds and Borders"
  14560. ],
  14561. initial: [
  14562. "border-top-left-radius",
  14563. "border-top-right-radius",
  14564. "border-bottom-right-radius",
  14565. "border-bottom-left-radius"
  14566. ],
  14567. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  14568. computed: [
  14569. "border-bottom-left-radius",
  14570. "border-bottom-right-radius",
  14571. "border-top-left-radius",
  14572. "border-top-right-radius"
  14573. ],
  14574. order: "uniqueOrder",
  14575. alsoAppliesTo: [
  14576. "::first-letter"
  14577. ],
  14578. status: "standard",
  14579. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-radius"
  14580. },
  14581. "border-right": {
  14582. syntax: "<line-width> || <line-style> || <color>",
  14583. media: "visual",
  14584. inherited: false,
  14585. animationType: [
  14586. "border-right-color",
  14587. "border-right-style",
  14588. "border-right-width"
  14589. ],
  14590. percentages: "no",
  14591. groups: [
  14592. "CSS Backgrounds and Borders"
  14593. ],
  14594. initial: [
  14595. "border-right-width",
  14596. "border-right-style",
  14597. "border-right-color"
  14598. ],
  14599. appliesto: "allElements",
  14600. computed: [
  14601. "border-right-width",
  14602. "border-right-style",
  14603. "border-right-color"
  14604. ],
  14605. order: "orderOfAppearance",
  14606. alsoAppliesTo: [
  14607. "::first-letter"
  14608. ],
  14609. status: "standard",
  14610. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-right"
  14611. },
  14612. "border-right-color": {
  14613. syntax: "<color>",
  14614. media: "visual",
  14615. inherited: false,
  14616. animationType: "color",
  14617. percentages: "no",
  14618. groups: [
  14619. "CSS Backgrounds and Borders"
  14620. ],
  14621. initial: "currentcolor",
  14622. appliesto: "allElements",
  14623. computed: "computedColor",
  14624. order: "uniqueOrder",
  14625. alsoAppliesTo: [
  14626. "::first-letter"
  14627. ],
  14628. status: "standard",
  14629. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-right-color"
  14630. },
  14631. "border-right-style": {
  14632. syntax: "<line-style>",
  14633. media: "visual",
  14634. inherited: false,
  14635. animationType: "discrete",
  14636. percentages: "no",
  14637. groups: [
  14638. "CSS Backgrounds and Borders"
  14639. ],
  14640. initial: "none",
  14641. appliesto: "allElements",
  14642. computed: "asSpecified",
  14643. order: "uniqueOrder",
  14644. alsoAppliesTo: [
  14645. "::first-letter"
  14646. ],
  14647. status: "standard",
  14648. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-right-style"
  14649. },
  14650. "border-right-width": {
  14651. syntax: "<line-width>",
  14652. media: "visual",
  14653. inherited: false,
  14654. animationType: "length",
  14655. percentages: "no",
  14656. groups: [
  14657. "CSS Backgrounds and Borders"
  14658. ],
  14659. initial: "medium",
  14660. appliesto: "allElements",
  14661. computed: "absoluteLengthOr0IfBorderRightStyleNoneOrHidden",
  14662. order: "uniqueOrder",
  14663. alsoAppliesTo: [
  14664. "::first-letter"
  14665. ],
  14666. status: "standard",
  14667. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-right-width"
  14668. },
  14669. "border-spacing": {
  14670. syntax: "<length> <length>?",
  14671. media: "visual",
  14672. inherited: true,
  14673. animationType: "discrete",
  14674. percentages: "no",
  14675. groups: [
  14676. "CSS Table"
  14677. ],
  14678. initial: "0",
  14679. appliesto: "tableElements",
  14680. computed: "twoAbsoluteLengths",
  14681. order: "uniqueOrder",
  14682. status: "standard",
  14683. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-spacing"
  14684. },
  14685. "border-start-end-radius": {
  14686. syntax: "<length-percentage>{1,2}",
  14687. media: "visual",
  14688. inherited: false,
  14689. animationType: "lpc",
  14690. percentages: "referToDimensionOfBorderBox",
  14691. groups: [
  14692. "CSS Logical Properties"
  14693. ],
  14694. initial: "0",
  14695. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  14696. computed: "twoAbsoluteLengthOrPercentages",
  14697. order: "uniqueOrder",
  14698. alsoAppliesTo: [
  14699. "::first-letter"
  14700. ],
  14701. status: "standard",
  14702. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-start-end-radius"
  14703. },
  14704. "border-start-start-radius": {
  14705. syntax: "<length-percentage>{1,2}",
  14706. media: "visual",
  14707. inherited: false,
  14708. animationType: "lpc",
  14709. percentages: "referToDimensionOfBorderBox",
  14710. groups: [
  14711. "CSS Logical Properties"
  14712. ],
  14713. initial: "0",
  14714. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  14715. computed: "twoAbsoluteLengthOrPercentages",
  14716. order: "uniqueOrder",
  14717. alsoAppliesTo: [
  14718. "::first-letter"
  14719. ],
  14720. status: "standard",
  14721. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-start-start-radius"
  14722. },
  14723. "border-style": {
  14724. syntax: "<line-style>{1,4}",
  14725. media: "visual",
  14726. inherited: false,
  14727. animationType: "discrete",
  14728. percentages: "no",
  14729. groups: [
  14730. "CSS Backgrounds and Borders"
  14731. ],
  14732. initial: [
  14733. "border-top-style",
  14734. "border-right-style",
  14735. "border-bottom-style",
  14736. "border-left-style"
  14737. ],
  14738. appliesto: "allElements",
  14739. computed: [
  14740. "border-bottom-style",
  14741. "border-left-style",
  14742. "border-right-style",
  14743. "border-top-style"
  14744. ],
  14745. order: "uniqueOrder",
  14746. alsoAppliesTo: [
  14747. "::first-letter"
  14748. ],
  14749. status: "standard",
  14750. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-style"
  14751. },
  14752. "border-top": {
  14753. syntax: "<line-width> || <line-style> || <color>",
  14754. media: "visual",
  14755. inherited: false,
  14756. animationType: [
  14757. "border-top-color",
  14758. "border-top-style",
  14759. "border-top-width"
  14760. ],
  14761. percentages: "no",
  14762. groups: [
  14763. "CSS Backgrounds and Borders"
  14764. ],
  14765. initial: [
  14766. "border-top-width",
  14767. "border-top-style",
  14768. "border-top-color"
  14769. ],
  14770. appliesto: "allElements",
  14771. computed: [
  14772. "border-top-width",
  14773. "border-top-style",
  14774. "border-top-color"
  14775. ],
  14776. order: "orderOfAppearance",
  14777. alsoAppliesTo: [
  14778. "::first-letter"
  14779. ],
  14780. status: "standard",
  14781. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top"
  14782. },
  14783. "border-top-color": {
  14784. syntax: "<color>",
  14785. media: "visual",
  14786. inherited: false,
  14787. animationType: "color",
  14788. percentages: "no",
  14789. groups: [
  14790. "CSS Backgrounds and Borders"
  14791. ],
  14792. initial: "currentcolor",
  14793. appliesto: "allElements",
  14794. computed: "computedColor",
  14795. order: "uniqueOrder",
  14796. alsoAppliesTo: [
  14797. "::first-letter"
  14798. ],
  14799. status: "standard",
  14800. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-color"
  14801. },
  14802. "border-top-left-radius": {
  14803. syntax: "<length-percentage>{1,2}",
  14804. media: "visual",
  14805. inherited: false,
  14806. animationType: "lpc",
  14807. percentages: "referToDimensionOfBorderBox",
  14808. groups: [
  14809. "CSS Backgrounds and Borders"
  14810. ],
  14811. initial: "0",
  14812. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  14813. computed: "twoAbsoluteLengthOrPercentages",
  14814. order: "uniqueOrder",
  14815. alsoAppliesTo: [
  14816. "::first-letter"
  14817. ],
  14818. status: "standard",
  14819. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-left-radius"
  14820. },
  14821. "border-top-right-radius": {
  14822. syntax: "<length-percentage>{1,2}",
  14823. media: "visual",
  14824. inherited: false,
  14825. animationType: "lpc",
  14826. percentages: "referToDimensionOfBorderBox",
  14827. groups: [
  14828. "CSS Backgrounds and Borders"
  14829. ],
  14830. initial: "0",
  14831. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  14832. computed: "twoAbsoluteLengthOrPercentages",
  14833. order: "uniqueOrder",
  14834. alsoAppliesTo: [
  14835. "::first-letter"
  14836. ],
  14837. status: "standard",
  14838. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-right-radius"
  14839. },
  14840. "border-top-style": {
  14841. syntax: "<line-style>",
  14842. media: "visual",
  14843. inherited: false,
  14844. animationType: "discrete",
  14845. percentages: "no",
  14846. groups: [
  14847. "CSS Backgrounds and Borders"
  14848. ],
  14849. initial: "none",
  14850. appliesto: "allElements",
  14851. computed: "asSpecified",
  14852. order: "uniqueOrder",
  14853. alsoAppliesTo: [
  14854. "::first-letter"
  14855. ],
  14856. status: "standard",
  14857. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-style"
  14858. },
  14859. "border-top-width": {
  14860. syntax: "<line-width>",
  14861. media: "visual",
  14862. inherited: false,
  14863. animationType: "length",
  14864. percentages: "no",
  14865. groups: [
  14866. "CSS Backgrounds and Borders"
  14867. ],
  14868. initial: "medium",
  14869. appliesto: "allElements",
  14870. computed: "absoluteLengthOr0IfBorderTopStyleNoneOrHidden",
  14871. order: "uniqueOrder",
  14872. alsoAppliesTo: [
  14873. "::first-letter"
  14874. ],
  14875. status: "standard",
  14876. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-width"
  14877. },
  14878. "border-width": {
  14879. syntax: "<line-width>{1,4}",
  14880. media: "visual",
  14881. inherited: false,
  14882. animationType: [
  14883. "border-bottom-width",
  14884. "border-left-width",
  14885. "border-right-width",
  14886. "border-top-width"
  14887. ],
  14888. percentages: "no",
  14889. groups: [
  14890. "CSS Backgrounds and Borders"
  14891. ],
  14892. initial: [
  14893. "border-top-width",
  14894. "border-right-width",
  14895. "border-bottom-width",
  14896. "border-left-width"
  14897. ],
  14898. appliesto: "allElements",
  14899. computed: [
  14900. "border-bottom-width",
  14901. "border-left-width",
  14902. "border-right-width",
  14903. "border-top-width"
  14904. ],
  14905. order: "uniqueOrder",
  14906. alsoAppliesTo: [
  14907. "::first-letter"
  14908. ],
  14909. status: "standard",
  14910. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-width"
  14911. },
  14912. bottom: bottom,
  14913. "box-align": {
  14914. syntax: "start | center | end | baseline | stretch",
  14915. media: "visual",
  14916. inherited: false,
  14917. animationType: "discrete",
  14918. percentages: "no",
  14919. groups: [
  14920. "Mozilla Extensions",
  14921. "WebKit Extensions"
  14922. ],
  14923. initial: "stretch",
  14924. appliesto: "elementsWithDisplayBoxOrInlineBox",
  14925. computed: "asSpecified",
  14926. order: "uniqueOrder",
  14927. status: "nonstandard",
  14928. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-align"
  14929. },
  14930. "box-decoration-break": {
  14931. syntax: "slice | clone",
  14932. media: "visual",
  14933. inherited: false,
  14934. animationType: "discrete",
  14935. percentages: "no",
  14936. groups: [
  14937. "CSS Fragmentation"
  14938. ],
  14939. initial: "slice",
  14940. appliesto: "allElements",
  14941. computed: "asSpecified",
  14942. order: "uniqueOrder",
  14943. status: "standard",
  14944. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-decoration-break"
  14945. },
  14946. "box-direction": {
  14947. syntax: "normal | reverse | inherit",
  14948. media: "visual",
  14949. inherited: false,
  14950. animationType: "discrete",
  14951. percentages: "no",
  14952. groups: [
  14953. "Mozilla Extensions",
  14954. "WebKit Extensions"
  14955. ],
  14956. initial: "normal",
  14957. appliesto: "elementsWithDisplayBoxOrInlineBox",
  14958. computed: "asSpecified",
  14959. order: "uniqueOrder",
  14960. status: "nonstandard",
  14961. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-direction"
  14962. },
  14963. "box-flex": {
  14964. syntax: "<number>",
  14965. media: "visual",
  14966. inherited: false,
  14967. animationType: "discrete",
  14968. percentages: "no",
  14969. groups: [
  14970. "Mozilla Extensions",
  14971. "WebKit Extensions"
  14972. ],
  14973. initial: "0",
  14974. appliesto: "directChildrenOfElementsWithDisplayMozBoxMozInlineBox",
  14975. computed: "asSpecified",
  14976. order: "uniqueOrder",
  14977. status: "nonstandard",
  14978. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-flex"
  14979. },
  14980. "box-flex-group": {
  14981. syntax: "<integer>",
  14982. media: "visual",
  14983. inherited: false,
  14984. animationType: "discrete",
  14985. percentages: "no",
  14986. groups: [
  14987. "Mozilla Extensions",
  14988. "WebKit Extensions"
  14989. ],
  14990. initial: "1",
  14991. appliesto: "inFlowChildrenOfBoxElements",
  14992. computed: "asSpecified",
  14993. order: "uniqueOrder",
  14994. status: "nonstandard",
  14995. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-flex-group"
  14996. },
  14997. "box-lines": {
  14998. syntax: "single | multiple",
  14999. media: "visual",
  15000. inherited: false,
  15001. animationType: "discrete",
  15002. percentages: "no",
  15003. groups: [
  15004. "Mozilla Extensions",
  15005. "WebKit Extensions"
  15006. ],
  15007. initial: "single",
  15008. appliesto: "boxElements",
  15009. computed: "asSpecified",
  15010. order: "uniqueOrder",
  15011. status: "nonstandard",
  15012. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-lines"
  15013. },
  15014. "box-ordinal-group": {
  15015. syntax: "<integer>",
  15016. media: "visual",
  15017. inherited: false,
  15018. animationType: "discrete",
  15019. percentages: "no",
  15020. groups: [
  15021. "Mozilla Extensions",
  15022. "WebKit Extensions"
  15023. ],
  15024. initial: "1",
  15025. appliesto: "childrenOfBoxElements",
  15026. computed: "asSpecified",
  15027. order: "uniqueOrder",
  15028. status: "nonstandard",
  15029. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-ordinal-group"
  15030. },
  15031. "box-orient": {
  15032. syntax: "horizontal | vertical | inline-axis | block-axis | inherit",
  15033. media: "visual",
  15034. inherited: false,
  15035. animationType: "discrete",
  15036. percentages: "no",
  15037. groups: [
  15038. "Mozilla Extensions",
  15039. "WebKit Extensions"
  15040. ],
  15041. initial: "inlineAxisHorizontalInXUL",
  15042. appliesto: "elementsWithDisplayBoxOrInlineBox",
  15043. computed: "asSpecified",
  15044. order: "uniqueOrder",
  15045. status: "nonstandard",
  15046. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-orient"
  15047. },
  15048. "box-pack": {
  15049. syntax: "start | center | end | justify",
  15050. media: "visual",
  15051. inherited: false,
  15052. animationType: "discrete",
  15053. percentages: "no",
  15054. groups: [
  15055. "Mozilla Extensions",
  15056. "WebKit Extensions"
  15057. ],
  15058. initial: "start",
  15059. appliesto: "elementsWithDisplayMozBoxMozInlineBox",
  15060. computed: "asSpecified",
  15061. order: "uniqueOrder",
  15062. status: "nonstandard",
  15063. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-pack"
  15064. },
  15065. "box-shadow": {
  15066. syntax: "none | <shadow>#",
  15067. media: "visual",
  15068. inherited: false,
  15069. animationType: "shadowList",
  15070. percentages: "no",
  15071. groups: [
  15072. "CSS Backgrounds and Borders"
  15073. ],
  15074. initial: "none",
  15075. appliesto: "allElements",
  15076. computed: "absoluteLengthsSpecifiedColorAsSpecified",
  15077. order: "uniqueOrder",
  15078. alsoAppliesTo: [
  15079. "::first-letter"
  15080. ],
  15081. status: "standard",
  15082. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-shadow"
  15083. },
  15084. "box-sizing": {
  15085. syntax: "content-box | border-box",
  15086. media: "visual",
  15087. inherited: false,
  15088. animationType: "discrete",
  15089. percentages: "no",
  15090. groups: [
  15091. "CSS Basic User Interface"
  15092. ],
  15093. initial: "content-box",
  15094. appliesto: "allElementsAcceptingWidthOrHeight",
  15095. computed: "asSpecified",
  15096. order: "uniqueOrder",
  15097. status: "standard",
  15098. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-sizing"
  15099. },
  15100. "break-after": {
  15101. syntax: "auto | avoid | always | all | avoid-page | page | left | right | recto | verso | avoid-column | column | avoid-region | region",
  15102. media: "visual",
  15103. inherited: false,
  15104. animationType: "discrete",
  15105. percentages: "no",
  15106. groups: [
  15107. "CSS Fragmentation"
  15108. ],
  15109. initial: "auto",
  15110. appliesto: "blockLevelElements",
  15111. computed: "asSpecified",
  15112. order: "uniqueOrder",
  15113. status: "standard",
  15114. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/break-after"
  15115. },
  15116. "break-before": {
  15117. syntax: "auto | avoid | always | all | avoid-page | page | left | right | recto | verso | avoid-column | column | avoid-region | region",
  15118. media: "visual",
  15119. inherited: false,
  15120. animationType: "discrete",
  15121. percentages: "no",
  15122. groups: [
  15123. "CSS Fragmentation"
  15124. ],
  15125. initial: "auto",
  15126. appliesto: "blockLevelElements",
  15127. computed: "asSpecified",
  15128. order: "uniqueOrder",
  15129. status: "standard",
  15130. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/break-before"
  15131. },
  15132. "break-inside": {
  15133. syntax: "auto | avoid | avoid-page | avoid-column | avoid-region",
  15134. media: "visual",
  15135. inherited: false,
  15136. animationType: "discrete",
  15137. percentages: "no",
  15138. groups: [
  15139. "CSS Fragmentation"
  15140. ],
  15141. initial: "auto",
  15142. appliesto: "blockLevelElements",
  15143. computed: "asSpecified",
  15144. order: "uniqueOrder",
  15145. status: "standard",
  15146. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/break-inside"
  15147. },
  15148. "caption-side": {
  15149. syntax: "top | bottom | block-start | block-end | inline-start | inline-end",
  15150. media: "visual",
  15151. inherited: true,
  15152. animationType: "discrete",
  15153. percentages: "no",
  15154. groups: [
  15155. "CSS Table"
  15156. ],
  15157. initial: "top",
  15158. appliesto: "tableCaptionElements",
  15159. computed: "asSpecified",
  15160. order: "uniqueOrder",
  15161. status: "standard",
  15162. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/caption-side"
  15163. },
  15164. "caret-color": {
  15165. syntax: "auto | <color>",
  15166. media: "interactive",
  15167. inherited: true,
  15168. animationType: "color",
  15169. percentages: "no",
  15170. groups: [
  15171. "CSS Basic User Interface"
  15172. ],
  15173. initial: "auto",
  15174. appliesto: "allElements",
  15175. computed: "asAutoOrColor",
  15176. order: "perGrammar",
  15177. status: "standard",
  15178. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/caret-color"
  15179. },
  15180. clear: clear,
  15181. clip: clip,
  15182. "clip-path": {
  15183. syntax: "<clip-source> | [ <basic-shape> || <geometry-box> ] | none",
  15184. media: "visual",
  15185. inherited: false,
  15186. animationType: "basicShapeOtherwiseNo",
  15187. percentages: "referToReferenceBoxWhenSpecifiedOtherwiseBorderBox",
  15188. groups: [
  15189. "CSS Masking"
  15190. ],
  15191. initial: "none",
  15192. appliesto: "allElementsSVGContainerElements",
  15193. computed: "asSpecifiedURLsAbsolute",
  15194. order: "uniqueOrder",
  15195. status: "standard",
  15196. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/clip-path"
  15197. },
  15198. color: color$1,
  15199. "color-adjust": {
  15200. syntax: "economy | exact",
  15201. media: "visual",
  15202. inherited: true,
  15203. animationType: "discrete",
  15204. percentages: "no",
  15205. groups: [
  15206. "CSS Color"
  15207. ],
  15208. initial: "economy",
  15209. appliesto: "allElements",
  15210. computed: "asSpecified",
  15211. order: "perGrammar",
  15212. status: "standard",
  15213. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/color-adjust"
  15214. },
  15215. "column-count": {
  15216. syntax: "<integer> | auto",
  15217. media: "visual",
  15218. inherited: false,
  15219. animationType: "integer",
  15220. percentages: "no",
  15221. groups: [
  15222. "CSS Columns"
  15223. ],
  15224. initial: "auto",
  15225. appliesto: "blockContainersExceptTableWrappers",
  15226. computed: "asSpecified",
  15227. order: "perGrammar",
  15228. status: "standard",
  15229. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-count"
  15230. },
  15231. "column-fill": {
  15232. syntax: "auto | balance | balance-all",
  15233. media: "visualInContinuousMediaNoEffectInOverflowColumns",
  15234. inherited: false,
  15235. animationType: "discrete",
  15236. percentages: "no",
  15237. groups: [
  15238. "CSS Columns"
  15239. ],
  15240. initial: "balance",
  15241. appliesto: "multicolElements",
  15242. computed: "asSpecified",
  15243. order: "perGrammar",
  15244. status: "standard",
  15245. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-fill"
  15246. },
  15247. "column-gap": {
  15248. syntax: "normal | <length-percentage>",
  15249. media: "visual",
  15250. inherited: false,
  15251. animationType: "lpc",
  15252. percentages: "referToDimensionOfContentArea",
  15253. groups: [
  15254. "CSS Box Alignment"
  15255. ],
  15256. initial: "normal",
  15257. appliesto: "multiColumnElementsFlexContainersGridContainers",
  15258. computed: "asSpecifiedWithLengthsAbsoluteAndNormalComputingToZeroExceptMultiColumn",
  15259. order: "perGrammar",
  15260. status: "standard",
  15261. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-gap"
  15262. },
  15263. "column-rule": {
  15264. syntax: "<'column-rule-width'> || <'column-rule-style'> || <'column-rule-color'>",
  15265. media: "visual",
  15266. inherited: false,
  15267. animationType: [
  15268. "column-rule-color",
  15269. "column-rule-style",
  15270. "column-rule-width"
  15271. ],
  15272. percentages: "no",
  15273. groups: [
  15274. "CSS Columns"
  15275. ],
  15276. initial: [
  15277. "column-rule-width",
  15278. "column-rule-style",
  15279. "column-rule-color"
  15280. ],
  15281. appliesto: "multicolElements",
  15282. computed: [
  15283. "column-rule-color",
  15284. "column-rule-style",
  15285. "column-rule-width"
  15286. ],
  15287. order: "perGrammar",
  15288. status: "standard",
  15289. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-rule"
  15290. },
  15291. "column-rule-color": {
  15292. syntax: "<color>",
  15293. media: "visual",
  15294. inherited: false,
  15295. animationType: "color",
  15296. percentages: "no",
  15297. groups: [
  15298. "CSS Columns"
  15299. ],
  15300. initial: "currentcolor",
  15301. appliesto: "multicolElements",
  15302. computed: "computedColor",
  15303. order: "perGrammar",
  15304. status: "standard",
  15305. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-rule-color"
  15306. },
  15307. "column-rule-style": {
  15308. syntax: "<'border-style'>",
  15309. media: "visual",
  15310. inherited: false,
  15311. animationType: "discrete",
  15312. percentages: "no",
  15313. groups: [
  15314. "CSS Columns"
  15315. ],
  15316. initial: "none",
  15317. appliesto: "multicolElements",
  15318. computed: "asSpecified",
  15319. order: "perGrammar",
  15320. status: "standard",
  15321. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-rule-style"
  15322. },
  15323. "column-rule-width": {
  15324. syntax: "<'border-width'>",
  15325. media: "visual",
  15326. inherited: false,
  15327. animationType: "length",
  15328. percentages: "no",
  15329. groups: [
  15330. "CSS Columns"
  15331. ],
  15332. initial: "medium",
  15333. appliesto: "multicolElements",
  15334. computed: "absoluteLength0IfColumnRuleStyleNoneOrHidden",
  15335. order: "perGrammar",
  15336. status: "standard",
  15337. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-rule-width"
  15338. },
  15339. "column-span": {
  15340. syntax: "none | all",
  15341. media: "visual",
  15342. inherited: false,
  15343. animationType: "discrete",
  15344. percentages: "no",
  15345. groups: [
  15346. "CSS Columns"
  15347. ],
  15348. initial: "none",
  15349. appliesto: "inFlowBlockLevelElements",
  15350. computed: "asSpecified",
  15351. order: "perGrammar",
  15352. status: "standard",
  15353. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-span"
  15354. },
  15355. "column-width": {
  15356. syntax: "<length> | auto",
  15357. media: "visual",
  15358. inherited: false,
  15359. animationType: "length",
  15360. percentages: "no",
  15361. groups: [
  15362. "CSS Columns"
  15363. ],
  15364. initial: "auto",
  15365. appliesto: "blockContainersExceptTableWrappers",
  15366. computed: "absoluteLengthZeroOrLarger",
  15367. order: "perGrammar",
  15368. status: "standard",
  15369. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-width"
  15370. },
  15371. columns: columns,
  15372. contain: contain,
  15373. content: content,
  15374. "counter-increment": {
  15375. syntax: "[ <custom-ident> <integer>? ]+ | none",
  15376. media: "all",
  15377. inherited: false,
  15378. animationType: "discrete",
  15379. percentages: "no",
  15380. groups: [
  15381. "CSS Counter Styles"
  15382. ],
  15383. initial: "none",
  15384. appliesto: "allElements",
  15385. computed: "asSpecified",
  15386. order: "uniqueOrder",
  15387. status: "standard",
  15388. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/counter-increment"
  15389. },
  15390. "counter-reset": {
  15391. syntax: "[ <custom-ident> <integer>? ]+ | none",
  15392. media: "all",
  15393. inherited: false,
  15394. animationType: "discrete",
  15395. percentages: "no",
  15396. groups: [
  15397. "CSS Counter Styles"
  15398. ],
  15399. initial: "none",
  15400. appliesto: "allElements",
  15401. computed: "asSpecified",
  15402. order: "uniqueOrder",
  15403. status: "standard",
  15404. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/counter-reset"
  15405. },
  15406. "counter-set": {
  15407. syntax: "[ <custom-ident> <integer>? ]+ | none",
  15408. media: "all",
  15409. inherited: false,
  15410. animationType: "discrete",
  15411. percentages: "no",
  15412. groups: [
  15413. "CSS Counter Styles"
  15414. ],
  15415. initial: "none",
  15416. appliesto: "allElements",
  15417. computed: "asSpecified",
  15418. order: "uniqueOrder",
  15419. status: "standard",
  15420. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/counter-set"
  15421. },
  15422. cursor: cursor,
  15423. direction: direction,
  15424. display: display,
  15425. "empty-cells": {
  15426. syntax: "show | hide",
  15427. media: "visual",
  15428. inherited: true,
  15429. animationType: "discrete",
  15430. percentages: "no",
  15431. groups: [
  15432. "CSS Table"
  15433. ],
  15434. initial: "show",
  15435. appliesto: "tableCellElements",
  15436. computed: "asSpecified",
  15437. order: "uniqueOrder",
  15438. status: "standard",
  15439. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/empty-cells"
  15440. },
  15441. filter: filter,
  15442. flex: flex,
  15443. "flex-basis": {
  15444. syntax: "content | <'width'>",
  15445. media: "visual",
  15446. inherited: false,
  15447. animationType: "lpc",
  15448. percentages: "referToFlexContainersInnerMainSize",
  15449. groups: [
  15450. "CSS Flexible Box Layout"
  15451. ],
  15452. initial: "auto",
  15453. appliesto: "flexItemsAndInFlowPseudos",
  15454. computed: "asSpecifiedRelativeToAbsoluteLengths",
  15455. order: "lengthOrPercentageBeforeKeywordIfBothPresent",
  15456. status: "standard",
  15457. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-basis"
  15458. },
  15459. "flex-direction": {
  15460. syntax: "row | row-reverse | column | column-reverse",
  15461. media: "visual",
  15462. inherited: false,
  15463. animationType: "discrete",
  15464. percentages: "no",
  15465. groups: [
  15466. "CSS Flexible Box Layout"
  15467. ],
  15468. initial: "row",
  15469. appliesto: "flexContainers",
  15470. computed: "asSpecified",
  15471. order: "uniqueOrder",
  15472. status: "standard",
  15473. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-direction"
  15474. },
  15475. "flex-flow": {
  15476. syntax: "<'flex-direction'> || <'flex-wrap'>",
  15477. media: "visual",
  15478. inherited: false,
  15479. animationType: "discrete",
  15480. percentages: "no",
  15481. groups: [
  15482. "CSS Flexible Box Layout"
  15483. ],
  15484. initial: [
  15485. "flex-direction",
  15486. "flex-wrap"
  15487. ],
  15488. appliesto: "flexContainers",
  15489. computed: [
  15490. "flex-direction",
  15491. "flex-wrap"
  15492. ],
  15493. order: "orderOfAppearance",
  15494. status: "standard",
  15495. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-flow"
  15496. },
  15497. "flex-grow": {
  15498. syntax: "<number>",
  15499. media: "visual",
  15500. inherited: false,
  15501. animationType: "number",
  15502. percentages: "no",
  15503. groups: [
  15504. "CSS Flexible Box Layout"
  15505. ],
  15506. initial: "0",
  15507. appliesto: "flexItemsAndInFlowPseudos",
  15508. computed: "asSpecified",
  15509. order: "uniqueOrder",
  15510. status: "standard",
  15511. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-grow"
  15512. },
  15513. "flex-shrink": {
  15514. syntax: "<number>",
  15515. media: "visual",
  15516. inherited: false,
  15517. animationType: "number",
  15518. percentages: "no",
  15519. groups: [
  15520. "CSS Flexible Box Layout"
  15521. ],
  15522. initial: "1",
  15523. appliesto: "flexItemsAndInFlowPseudos",
  15524. computed: "asSpecified",
  15525. order: "uniqueOrder",
  15526. status: "standard",
  15527. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-shrink"
  15528. },
  15529. "flex-wrap": {
  15530. syntax: "nowrap | wrap | wrap-reverse",
  15531. media: "visual",
  15532. inherited: false,
  15533. animationType: "discrete",
  15534. percentages: "no",
  15535. groups: [
  15536. "CSS Flexible Box Layout"
  15537. ],
  15538. initial: "nowrap",
  15539. appliesto: "flexContainers",
  15540. computed: "asSpecified",
  15541. order: "uniqueOrder",
  15542. status: "standard",
  15543. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-wrap"
  15544. },
  15545. float: float,
  15546. font: font,
  15547. "font-family": {
  15548. syntax: "[ <family-name> | <generic-family> ]#",
  15549. media: "visual",
  15550. inherited: true,
  15551. animationType: "discrete",
  15552. percentages: "no",
  15553. groups: [
  15554. "CSS Fonts"
  15555. ],
  15556. initial: "dependsOnUserAgent",
  15557. appliesto: "allElements",
  15558. computed: "asSpecified",
  15559. order: "uniqueOrder",
  15560. alsoAppliesTo: [
  15561. "::first-letter",
  15562. "::first-line",
  15563. "::placeholder"
  15564. ],
  15565. status: "standard",
  15566. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-family"
  15567. },
  15568. "font-feature-settings": {
  15569. syntax: "normal | <feature-tag-value>#",
  15570. media: "visual",
  15571. inherited: true,
  15572. animationType: "discrete",
  15573. percentages: "no",
  15574. groups: [
  15575. "CSS Fonts"
  15576. ],
  15577. initial: "normal",
  15578. appliesto: "allElements",
  15579. computed: "asSpecified",
  15580. order: "uniqueOrder",
  15581. alsoAppliesTo: [
  15582. "::first-letter",
  15583. "::first-line",
  15584. "::placeholder"
  15585. ],
  15586. status: "standard",
  15587. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-feature-settings"
  15588. },
  15589. "font-kerning": {
  15590. syntax: "auto | normal | none",
  15591. media: "visual",
  15592. inherited: true,
  15593. animationType: "discrete",
  15594. percentages: "no",
  15595. groups: [
  15596. "CSS Fonts"
  15597. ],
  15598. initial: "auto",
  15599. appliesto: "allElements",
  15600. computed: "asSpecified",
  15601. order: "uniqueOrder",
  15602. alsoAppliesTo: [
  15603. "::first-letter",
  15604. "::first-line",
  15605. "::placeholder"
  15606. ],
  15607. status: "standard",
  15608. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-kerning"
  15609. },
  15610. "font-language-override": {
  15611. syntax: "normal | <string>",
  15612. media: "visual",
  15613. inherited: true,
  15614. animationType: "discrete",
  15615. percentages: "no",
  15616. groups: [
  15617. "CSS Fonts"
  15618. ],
  15619. initial: "normal",
  15620. appliesto: "allElements",
  15621. computed: "asSpecified",
  15622. order: "uniqueOrder",
  15623. alsoAppliesTo: [
  15624. "::first-letter",
  15625. "::first-line",
  15626. "::placeholder"
  15627. ],
  15628. status: "standard",
  15629. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-language-override"
  15630. },
  15631. "font-optical-sizing": {
  15632. syntax: "auto | none",
  15633. media: "visual",
  15634. inherited: true,
  15635. animationType: "discrete",
  15636. percentages: "no",
  15637. groups: [
  15638. "CSS Fonts"
  15639. ],
  15640. initial: "auto",
  15641. appliesto: "allElements",
  15642. computed: "asSpecified",
  15643. order: "perGrammar",
  15644. alsoAppliesTo: [
  15645. "::first-letter",
  15646. "::first-line",
  15647. "::placeholder"
  15648. ],
  15649. status: "standard",
  15650. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-optical-sizing"
  15651. },
  15652. "font-variation-settings": {
  15653. syntax: "normal | [ <string> <number> ]#",
  15654. media: "visual",
  15655. inherited: true,
  15656. animationType: "transform",
  15657. percentages: "no",
  15658. groups: [
  15659. "CSS Fonts"
  15660. ],
  15661. initial: "normal",
  15662. appliesto: "allElements",
  15663. computed: "asSpecified",
  15664. order: "perGrammar",
  15665. alsoAppliesTo: [
  15666. "::first-letter",
  15667. "::first-line",
  15668. "::placeholder"
  15669. ],
  15670. status: "standard",
  15671. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variation-settings"
  15672. },
  15673. "font-size": {
  15674. syntax: "<absolute-size> | <relative-size> | <length-percentage>",
  15675. media: "visual",
  15676. inherited: true,
  15677. animationType: "length",
  15678. percentages: "referToParentElementsFontSize",
  15679. groups: [
  15680. "CSS Fonts"
  15681. ],
  15682. initial: "medium",
  15683. appliesto: "allElements",
  15684. computed: "asSpecifiedRelativeToAbsoluteLengths",
  15685. order: "uniqueOrder",
  15686. alsoAppliesTo: [
  15687. "::first-letter",
  15688. "::first-line",
  15689. "::placeholder"
  15690. ],
  15691. status: "standard",
  15692. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-size"
  15693. },
  15694. "font-size-adjust": {
  15695. syntax: "none | <number>",
  15696. media: "visual",
  15697. inherited: true,
  15698. animationType: "number",
  15699. percentages: "no",
  15700. groups: [
  15701. "CSS Fonts"
  15702. ],
  15703. initial: "none",
  15704. appliesto: "allElements",
  15705. computed: "asSpecified",
  15706. order: "uniqueOrder",
  15707. alsoAppliesTo: [
  15708. "::first-letter",
  15709. "::first-line",
  15710. "::placeholder"
  15711. ],
  15712. status: "standard",
  15713. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-size-adjust"
  15714. },
  15715. "font-smooth": {
  15716. syntax: "auto | never | always | <absolute-size> | <length>",
  15717. media: "visual",
  15718. inherited: true,
  15719. animationType: "discrete",
  15720. percentages: "no",
  15721. groups: [
  15722. "CSS Fonts"
  15723. ],
  15724. initial: "auto",
  15725. appliesto: "allElements",
  15726. computed: "asSpecified",
  15727. order: "uniqueOrder",
  15728. status: "nonstandard",
  15729. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-smooth"
  15730. },
  15731. "font-stretch": {
  15732. syntax: "<font-stretch-absolute>",
  15733. media: "visual",
  15734. inherited: true,
  15735. animationType: "fontStretch",
  15736. percentages: "no",
  15737. groups: [
  15738. "CSS Fonts"
  15739. ],
  15740. initial: "normal",
  15741. appliesto: "allElements",
  15742. computed: "asSpecified",
  15743. order: "uniqueOrder",
  15744. alsoAppliesTo: [
  15745. "::first-letter",
  15746. "::first-line",
  15747. "::placeholder"
  15748. ],
  15749. status: "standard",
  15750. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-stretch"
  15751. },
  15752. "font-style": {
  15753. syntax: "normal | italic | oblique <angle>?",
  15754. media: "visual",
  15755. inherited: true,
  15756. animationType: "discrete",
  15757. percentages: "no",
  15758. groups: [
  15759. "CSS Fonts"
  15760. ],
  15761. initial: "normal",
  15762. appliesto: "allElements",
  15763. computed: "asSpecified",
  15764. order: "uniqueOrder",
  15765. alsoAppliesTo: [
  15766. "::first-letter",
  15767. "::first-line",
  15768. "::placeholder"
  15769. ],
  15770. status: "standard",
  15771. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-style"
  15772. },
  15773. "font-synthesis": {
  15774. syntax: "none | [ weight || style ]",
  15775. media: "visual",
  15776. inherited: true,
  15777. animationType: "discrete",
  15778. percentages: "no",
  15779. groups: [
  15780. "CSS Fonts"
  15781. ],
  15782. initial: "weight style",
  15783. appliesto: "allElements",
  15784. computed: "asSpecified",
  15785. order: "orderOfAppearance",
  15786. alsoAppliesTo: [
  15787. "::first-letter",
  15788. "::first-line",
  15789. "::placeholder"
  15790. ],
  15791. status: "standard",
  15792. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-synthesis"
  15793. },
  15794. "font-variant": {
  15795. syntax: "normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> || stylistic( <feature-value-name> ) || historical-forms || styleset( <feature-value-name># ) || character-variant( <feature-value-name># ) || swash( <feature-value-name> ) || ornaments( <feature-value-name> ) || annotation( <feature-value-name> ) || [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ] || <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero || <east-asian-variant-values> || <east-asian-width-values> || ruby ]",
  15796. media: "visual",
  15797. inherited: true,
  15798. animationType: "discrete",
  15799. percentages: "no",
  15800. groups: [
  15801. "CSS Fonts"
  15802. ],
  15803. initial: "normal",
  15804. appliesto: "allElements",
  15805. computed: "asSpecified",
  15806. order: "uniqueOrder",
  15807. alsoAppliesTo: [
  15808. "::first-letter",
  15809. "::first-line",
  15810. "::placeholder"
  15811. ],
  15812. status: "standard",
  15813. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant"
  15814. },
  15815. "font-variant-alternates": {
  15816. syntax: "normal | [ stylistic( <feature-value-name> ) || historical-forms || styleset( <feature-value-name># ) || character-variant( <feature-value-name># ) || swash( <feature-value-name> ) || ornaments( <feature-value-name> ) || annotation( <feature-value-name> ) ]",
  15817. media: "visual",
  15818. inherited: true,
  15819. animationType: "discrete",
  15820. percentages: "no",
  15821. groups: [
  15822. "CSS Fonts"
  15823. ],
  15824. initial: "normal",
  15825. appliesto: "allElements",
  15826. computed: "asSpecified",
  15827. order: "orderOfAppearance",
  15828. alsoAppliesTo: [
  15829. "::first-letter",
  15830. "::first-line",
  15831. "::placeholder"
  15832. ],
  15833. status: "standard",
  15834. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-alternates"
  15835. },
  15836. "font-variant-caps": {
  15837. syntax: "normal | small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps",
  15838. media: "visual",
  15839. inherited: true,
  15840. animationType: "discrete",
  15841. percentages: "no",
  15842. groups: [
  15843. "CSS Fonts"
  15844. ],
  15845. initial: "normal",
  15846. appliesto: "allElements",
  15847. computed: "asSpecified",
  15848. order: "uniqueOrder",
  15849. alsoAppliesTo: [
  15850. "::first-letter",
  15851. "::first-line",
  15852. "::placeholder"
  15853. ],
  15854. status: "standard",
  15855. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-caps"
  15856. },
  15857. "font-variant-east-asian": {
  15858. syntax: "normal | [ <east-asian-variant-values> || <east-asian-width-values> || ruby ]",
  15859. media: "visual",
  15860. inherited: true,
  15861. animationType: "discrete",
  15862. percentages: "no",
  15863. groups: [
  15864. "CSS Fonts"
  15865. ],
  15866. initial: "normal",
  15867. appliesto: "allElements",
  15868. computed: "asSpecified",
  15869. order: "orderOfAppearance",
  15870. alsoAppliesTo: [
  15871. "::first-letter",
  15872. "::first-line",
  15873. "::placeholder"
  15874. ],
  15875. status: "standard",
  15876. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-east-asian"
  15877. },
  15878. "font-variant-ligatures": {
  15879. syntax: "normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> ]",
  15880. media: "visual",
  15881. inherited: true,
  15882. animationType: "discrete",
  15883. percentages: "no",
  15884. groups: [
  15885. "CSS Fonts"
  15886. ],
  15887. initial: "normal",
  15888. appliesto: "allElements",
  15889. computed: "asSpecified",
  15890. order: "orderOfAppearance",
  15891. alsoAppliesTo: [
  15892. "::first-letter",
  15893. "::first-line",
  15894. "::placeholder"
  15895. ],
  15896. status: "standard",
  15897. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-ligatures"
  15898. },
  15899. "font-variant-numeric": {
  15900. syntax: "normal | [ <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero ]",
  15901. media: "visual",
  15902. inherited: true,
  15903. animationType: "discrete",
  15904. percentages: "no",
  15905. groups: [
  15906. "CSS Fonts"
  15907. ],
  15908. initial: "normal",
  15909. appliesto: "allElements",
  15910. computed: "asSpecified",
  15911. order: "orderOfAppearance",
  15912. alsoAppliesTo: [
  15913. "::first-letter",
  15914. "::first-line",
  15915. "::placeholder"
  15916. ],
  15917. status: "standard",
  15918. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-numeric"
  15919. },
  15920. "font-variant-position": {
  15921. syntax: "normal | sub | super",
  15922. media: "visual",
  15923. inherited: true,
  15924. animationType: "discrete",
  15925. percentages: "no",
  15926. groups: [
  15927. "CSS Fonts"
  15928. ],
  15929. initial: "normal",
  15930. appliesto: "allElements",
  15931. computed: "asSpecified",
  15932. order: "uniqueOrder",
  15933. alsoAppliesTo: [
  15934. "::first-letter",
  15935. "::first-line",
  15936. "::placeholder"
  15937. ],
  15938. status: "standard",
  15939. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-position"
  15940. },
  15941. "font-weight": {
  15942. syntax: "<font-weight-absolute> | bolder | lighter",
  15943. media: "visual",
  15944. inherited: true,
  15945. animationType: "fontWeight",
  15946. percentages: "no",
  15947. groups: [
  15948. "CSS Fonts"
  15949. ],
  15950. initial: "normal",
  15951. appliesto: "allElements",
  15952. computed: "keywordOrNumericalValueBolderLighterTransformedToRealValue",
  15953. order: "uniqueOrder",
  15954. alsoAppliesTo: [
  15955. "::first-letter",
  15956. "::first-line",
  15957. "::placeholder"
  15958. ],
  15959. status: "standard",
  15960. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-weight"
  15961. },
  15962. gap: gap,
  15963. grid: grid,
  15964. "grid-area": {
  15965. syntax: "<grid-line> [ / <grid-line> ]{0,3}",
  15966. media: "visual",
  15967. inherited: false,
  15968. animationType: "discrete",
  15969. percentages: "no",
  15970. groups: [
  15971. "CSS Grid Layout"
  15972. ],
  15973. initial: [
  15974. "grid-row-start",
  15975. "grid-column-start",
  15976. "grid-row-end",
  15977. "grid-column-end"
  15978. ],
  15979. appliesto: "gridItemsAndBoxesWithinGridContainer",
  15980. computed: [
  15981. "grid-row-start",
  15982. "grid-column-start",
  15983. "grid-row-end",
  15984. "grid-column-end"
  15985. ],
  15986. order: "uniqueOrder",
  15987. status: "standard",
  15988. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-area"
  15989. },
  15990. "grid-auto-columns": {
  15991. syntax: "<track-size>+",
  15992. media: "visual",
  15993. inherited: false,
  15994. animationType: "discrete",
  15995. percentages: "referToDimensionOfContentArea",
  15996. groups: [
  15997. "CSS Grid Layout"
  15998. ],
  15999. initial: "auto",
  16000. appliesto: "gridContainers",
  16001. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16002. order: "uniqueOrder",
  16003. status: "standard",
  16004. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-auto-columns"
  16005. },
  16006. "grid-auto-flow": {
  16007. syntax: "[ row | column ] || dense",
  16008. media: "visual",
  16009. inherited: false,
  16010. animationType: "discrete",
  16011. percentages: "no",
  16012. groups: [
  16013. "CSS Grid Layout"
  16014. ],
  16015. initial: "row",
  16016. appliesto: "gridContainers",
  16017. computed: "asSpecified",
  16018. order: "uniqueOrder",
  16019. status: "standard",
  16020. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-auto-flow"
  16021. },
  16022. "grid-auto-rows": {
  16023. syntax: "<track-size>+",
  16024. media: "visual",
  16025. inherited: false,
  16026. animationType: "discrete",
  16027. percentages: "referToDimensionOfContentArea",
  16028. groups: [
  16029. "CSS Grid Layout"
  16030. ],
  16031. initial: "auto",
  16032. appliesto: "gridContainers",
  16033. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16034. order: "uniqueOrder",
  16035. status: "standard",
  16036. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-auto-rows"
  16037. },
  16038. "grid-column": {
  16039. syntax: "<grid-line> [ / <grid-line> ]?",
  16040. media: "visual",
  16041. inherited: false,
  16042. animationType: "discrete",
  16043. percentages: "no",
  16044. groups: [
  16045. "CSS Grid Layout"
  16046. ],
  16047. initial: [
  16048. "grid-column-start",
  16049. "grid-column-end"
  16050. ],
  16051. appliesto: "gridItemsAndBoxesWithinGridContainer",
  16052. computed: [
  16053. "grid-column-start",
  16054. "grid-column-end"
  16055. ],
  16056. order: "uniqueOrder",
  16057. status: "standard",
  16058. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-column"
  16059. },
  16060. "grid-column-end": {
  16061. syntax: "<grid-line>",
  16062. media: "visual",
  16063. inherited: false,
  16064. animationType: "discrete",
  16065. percentages: "no",
  16066. groups: [
  16067. "CSS Grid Layout"
  16068. ],
  16069. initial: "auto",
  16070. appliesto: "gridItemsAndBoxesWithinGridContainer",
  16071. computed: "asSpecified",
  16072. order: "uniqueOrder",
  16073. status: "standard",
  16074. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-column-end"
  16075. },
  16076. "grid-column-gap": {
  16077. syntax: "<length-percentage>",
  16078. media: "visual",
  16079. inherited: false,
  16080. animationType: "length",
  16081. percentages: "referToDimensionOfContentArea",
  16082. groups: [
  16083. "CSS Grid Layout"
  16084. ],
  16085. initial: "0",
  16086. appliesto: "gridContainers",
  16087. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16088. order: "uniqueOrder",
  16089. status: "obsolete",
  16090. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-gap"
  16091. },
  16092. "grid-column-start": {
  16093. syntax: "<grid-line>",
  16094. media: "visual",
  16095. inherited: false,
  16096. animationType: "discrete",
  16097. percentages: "no",
  16098. groups: [
  16099. "CSS Grid Layout"
  16100. ],
  16101. initial: "auto",
  16102. appliesto: "gridItemsAndBoxesWithinGridContainer",
  16103. computed: "asSpecified",
  16104. order: "uniqueOrder",
  16105. status: "standard",
  16106. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-column-start"
  16107. },
  16108. "grid-gap": {
  16109. syntax: "<'grid-row-gap'> <'grid-column-gap'>?",
  16110. media: "visual",
  16111. inherited: false,
  16112. animationType: [
  16113. "grid-row-gap",
  16114. "grid-column-gap"
  16115. ],
  16116. percentages: "no",
  16117. groups: [
  16118. "CSS Grid Layout"
  16119. ],
  16120. initial: [
  16121. "grid-row-gap",
  16122. "grid-column-gap"
  16123. ],
  16124. appliesto: "gridContainers",
  16125. computed: [
  16126. "grid-row-gap",
  16127. "grid-column-gap"
  16128. ],
  16129. order: "uniqueOrder",
  16130. status: "obsolete",
  16131. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/gap"
  16132. },
  16133. "grid-row": {
  16134. syntax: "<grid-line> [ / <grid-line> ]?",
  16135. media: "visual",
  16136. inherited: false,
  16137. animationType: "discrete",
  16138. percentages: "no",
  16139. groups: [
  16140. "CSS Grid Layout"
  16141. ],
  16142. initial: [
  16143. "grid-row-start",
  16144. "grid-row-end"
  16145. ],
  16146. appliesto: "gridItemsAndBoxesWithinGridContainer",
  16147. computed: [
  16148. "grid-row-start",
  16149. "grid-row-end"
  16150. ],
  16151. order: "uniqueOrder",
  16152. status: "standard",
  16153. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-row"
  16154. },
  16155. "grid-row-end": {
  16156. syntax: "<grid-line>",
  16157. media: "visual",
  16158. inherited: false,
  16159. animationType: "discrete",
  16160. percentages: "no",
  16161. groups: [
  16162. "CSS Grid Layout"
  16163. ],
  16164. initial: "auto",
  16165. appliesto: "gridItemsAndBoxesWithinGridContainer",
  16166. computed: "asSpecified",
  16167. order: "uniqueOrder",
  16168. status: "standard",
  16169. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-row-end"
  16170. },
  16171. "grid-row-gap": {
  16172. syntax: "<length-percentage>",
  16173. media: "visual",
  16174. inherited: false,
  16175. animationType: "length",
  16176. percentages: "referToDimensionOfContentArea",
  16177. groups: [
  16178. "CSS Grid Layout"
  16179. ],
  16180. initial: "0",
  16181. appliesto: "gridContainers",
  16182. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16183. order: "uniqueOrder",
  16184. status: "obsolete",
  16185. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/row-gap"
  16186. },
  16187. "grid-row-start": {
  16188. syntax: "<grid-line>",
  16189. media: "visual",
  16190. inherited: false,
  16191. animationType: "discrete",
  16192. percentages: "no",
  16193. groups: [
  16194. "CSS Grid Layout"
  16195. ],
  16196. initial: "auto",
  16197. appliesto: "gridItemsAndBoxesWithinGridContainer",
  16198. computed: "asSpecified",
  16199. order: "uniqueOrder",
  16200. status: "standard",
  16201. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-row-start"
  16202. },
  16203. "grid-template": {
  16204. syntax: "none | [ <'grid-template-rows'> / <'grid-template-columns'> ] | [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]?",
  16205. media: "visual",
  16206. inherited: false,
  16207. animationType: "discrete",
  16208. percentages: [
  16209. "grid-template-columns",
  16210. "grid-template-rows"
  16211. ],
  16212. groups: [
  16213. "CSS Grid Layout"
  16214. ],
  16215. initial: [
  16216. "grid-template-columns",
  16217. "grid-template-rows",
  16218. "grid-template-areas"
  16219. ],
  16220. appliesto: "gridContainers",
  16221. computed: [
  16222. "grid-template-columns",
  16223. "grid-template-rows",
  16224. "grid-template-areas"
  16225. ],
  16226. order: "uniqueOrder",
  16227. status: "standard",
  16228. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-template"
  16229. },
  16230. "grid-template-areas": {
  16231. syntax: "none | <string>+",
  16232. media: "visual",
  16233. inherited: false,
  16234. animationType: "discrete",
  16235. percentages: "no",
  16236. groups: [
  16237. "CSS Grid Layout"
  16238. ],
  16239. initial: "none",
  16240. appliesto: "gridContainers",
  16241. computed: "asSpecified",
  16242. order: "uniqueOrder",
  16243. status: "standard",
  16244. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-template-areas"
  16245. },
  16246. "grid-template-columns": {
  16247. syntax: "none | <track-list> | <auto-track-list> | subgrid <line-name-list>?",
  16248. media: "visual",
  16249. inherited: false,
  16250. animationType: "simpleListOfLpcDifferenceLpc",
  16251. percentages: "referToDimensionOfContentArea",
  16252. groups: [
  16253. "CSS Grid Layout"
  16254. ],
  16255. initial: "none",
  16256. appliesto: "gridContainers",
  16257. computed: "asSpecifiedRelativeToAbsoluteLengths",
  16258. order: "uniqueOrder",
  16259. status: "standard",
  16260. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-template-columns"
  16261. },
  16262. "grid-template-rows": {
  16263. syntax: "none | <track-list> | <auto-track-list> | subgrid <line-name-list>?",
  16264. media: "visual",
  16265. inherited: false,
  16266. animationType: "simpleListOfLpcDifferenceLpc",
  16267. percentages: "referToDimensionOfContentArea",
  16268. groups: [
  16269. "CSS Grid Layout"
  16270. ],
  16271. initial: "none",
  16272. appliesto: "gridContainers",
  16273. computed: "asSpecifiedRelativeToAbsoluteLengths",
  16274. order: "uniqueOrder",
  16275. status: "standard",
  16276. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-template-rows"
  16277. },
  16278. "hanging-punctuation": {
  16279. syntax: "none | [ first || [ force-end | allow-end ] || last ]",
  16280. media: "visual",
  16281. inherited: true,
  16282. animationType: "discrete",
  16283. percentages: "no",
  16284. groups: [
  16285. "CSS Text"
  16286. ],
  16287. initial: "none",
  16288. appliesto: "allElements",
  16289. computed: "asSpecified",
  16290. order: "uniqueOrder",
  16291. status: "standard",
  16292. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/hanging-punctuation"
  16293. },
  16294. height: height,
  16295. hyphens: hyphens,
  16296. "image-orientation": {
  16297. syntax: "from-image | <angle> | [ <angle>? flip ]",
  16298. media: "visual",
  16299. inherited: true,
  16300. animationType: "discrete",
  16301. percentages: "no",
  16302. groups: [
  16303. "CSS Images"
  16304. ],
  16305. initial: "from-image",
  16306. appliesto: "allElements",
  16307. computed: "angleRoundedToNextQuarter",
  16308. order: "uniqueOrder",
  16309. status: "standard",
  16310. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/image-orientation"
  16311. },
  16312. "image-rendering": {
  16313. syntax: "auto | crisp-edges | pixelated",
  16314. media: "visual",
  16315. inherited: true,
  16316. animationType: "discrete",
  16317. percentages: "no",
  16318. groups: [
  16319. "CSS Images"
  16320. ],
  16321. initial: "auto",
  16322. appliesto: "allElements",
  16323. computed: "asSpecified",
  16324. order: "uniqueOrder",
  16325. status: "standard",
  16326. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/image-rendering"
  16327. },
  16328. "image-resolution": {
  16329. syntax: "[ from-image || <resolution> ] && snap?",
  16330. media: "visual",
  16331. inherited: true,
  16332. animationType: "discrete",
  16333. percentages: "no",
  16334. groups: [
  16335. "CSS Images"
  16336. ],
  16337. initial: "1dppx",
  16338. appliesto: "allElements",
  16339. computed: "asSpecifiedWithExceptionOfResolution",
  16340. order: "uniqueOrder",
  16341. status: "experimental"
  16342. },
  16343. "ime-mode": {
  16344. syntax: "auto | normal | active | inactive | disabled",
  16345. media: "interactive",
  16346. inherited: false,
  16347. animationType: "discrete",
  16348. percentages: "no",
  16349. groups: [
  16350. "CSS Basic User Interface"
  16351. ],
  16352. initial: "auto",
  16353. appliesto: "textFields",
  16354. computed: "asSpecified",
  16355. order: "uniqueOrder",
  16356. status: "obsolete",
  16357. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/ime-mode"
  16358. },
  16359. "initial-letter": {
  16360. syntax: "normal | [ <number> <integer>? ]",
  16361. media: "visual",
  16362. inherited: false,
  16363. animationType: "discrete",
  16364. percentages: "no",
  16365. groups: [
  16366. "CSS Inline"
  16367. ],
  16368. initial: "normal",
  16369. appliesto: "firstLetterPseudoElementsAndInlineLevelFirstChildren",
  16370. computed: "asSpecified",
  16371. order: "uniqueOrder",
  16372. status: "experimental",
  16373. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/initial-letter"
  16374. },
  16375. "initial-letter-align": {
  16376. syntax: "[ auto | alphabetic | hanging | ideographic ]",
  16377. media: "visual",
  16378. inherited: false,
  16379. animationType: "discrete",
  16380. percentages: "no",
  16381. groups: [
  16382. "CSS Inline"
  16383. ],
  16384. initial: "auto",
  16385. appliesto: "firstLetterPseudoElementsAndInlineLevelFirstChildren",
  16386. computed: "asSpecified",
  16387. order: "uniqueOrder",
  16388. status: "experimental",
  16389. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/initial-letter-align"
  16390. },
  16391. "inline-size": {
  16392. syntax: "<'width'>",
  16393. media: "visual",
  16394. inherited: false,
  16395. animationType: "lpc",
  16396. percentages: "inlineSizeOfContainingBlock",
  16397. groups: [
  16398. "CSS Logical Properties"
  16399. ],
  16400. initial: "auto",
  16401. appliesto: "sameAsWidthAndHeight",
  16402. computed: "sameAsWidthAndHeight",
  16403. order: "uniqueOrder",
  16404. status: "standard",
  16405. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inline-size"
  16406. },
  16407. inset: inset,
  16408. "inset-block": {
  16409. syntax: "<'top'>{1,2}",
  16410. media: "visual",
  16411. inherited: false,
  16412. animationType: "lpc",
  16413. percentages: "logicalHeightOfContainingBlock",
  16414. groups: [
  16415. "CSS Logical Properties"
  16416. ],
  16417. initial: "auto",
  16418. appliesto: "positionedElements",
  16419. computed: "sameAsBoxOffsets",
  16420. order: "uniqueOrder",
  16421. status: "standard",
  16422. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-block"
  16423. },
  16424. "inset-block-end": {
  16425. syntax: "<'top'>",
  16426. media: "visual",
  16427. inherited: false,
  16428. animationType: "lpc",
  16429. percentages: "logicalHeightOfContainingBlock",
  16430. groups: [
  16431. "CSS Logical Properties"
  16432. ],
  16433. initial: "auto",
  16434. appliesto: "positionedElements",
  16435. computed: "sameAsBoxOffsets",
  16436. order: "uniqueOrder",
  16437. status: "standard",
  16438. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-block-end"
  16439. },
  16440. "inset-block-start": {
  16441. syntax: "<'top'>",
  16442. media: "visual",
  16443. inherited: false,
  16444. animationType: "lpc",
  16445. percentages: "logicalHeightOfContainingBlock",
  16446. groups: [
  16447. "CSS Logical Properties"
  16448. ],
  16449. initial: "auto",
  16450. appliesto: "positionedElements",
  16451. computed: "sameAsBoxOffsets",
  16452. order: "uniqueOrder",
  16453. status: "standard",
  16454. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-block-start"
  16455. },
  16456. "inset-inline": {
  16457. syntax: "<'top'>{1,2}",
  16458. media: "visual",
  16459. inherited: false,
  16460. animationType: "lpc",
  16461. percentages: "logicalWidthOfContainingBlock",
  16462. groups: [
  16463. "CSS Logical Properties"
  16464. ],
  16465. initial: "auto",
  16466. appliesto: "positionedElements",
  16467. computed: "sameAsBoxOffsets",
  16468. order: "uniqueOrder",
  16469. status: "standard",
  16470. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-inline"
  16471. },
  16472. "inset-inline-end": {
  16473. syntax: "<'top'>",
  16474. media: "visual",
  16475. inherited: false,
  16476. animationType: "lpc",
  16477. percentages: "logicalWidthOfContainingBlock",
  16478. groups: [
  16479. "CSS Logical Properties"
  16480. ],
  16481. initial: "auto",
  16482. appliesto: "positionedElements",
  16483. computed: "sameAsBoxOffsets",
  16484. order: "uniqueOrder",
  16485. status: "standard",
  16486. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-inline-end"
  16487. },
  16488. "inset-inline-start": {
  16489. syntax: "<'top'>",
  16490. media: "visual",
  16491. inherited: false,
  16492. animationType: "lpc",
  16493. percentages: "logicalWidthOfContainingBlock",
  16494. groups: [
  16495. "CSS Logical Properties"
  16496. ],
  16497. initial: "auto",
  16498. appliesto: "positionedElements",
  16499. computed: "sameAsBoxOffsets",
  16500. order: "uniqueOrder",
  16501. status: "standard",
  16502. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-inline-start"
  16503. },
  16504. isolation: isolation,
  16505. "justify-content": {
  16506. syntax: "normal | <content-distribution> | <overflow-position>? [ <content-position> | left | right ]",
  16507. media: "visual",
  16508. inherited: false,
  16509. animationType: "discrete",
  16510. percentages: "no",
  16511. groups: [
  16512. "CSS Box Alignment"
  16513. ],
  16514. initial: "normal",
  16515. appliesto: "flexContainers",
  16516. computed: "asSpecified",
  16517. order: "uniqueOrder",
  16518. status: "standard",
  16519. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/justify-content"
  16520. },
  16521. "justify-items": {
  16522. syntax: "normal | stretch | <baseline-position> | <overflow-position>? [ <self-position> | left | right ] | legacy | legacy && [ left | right | center ]",
  16523. media: "visual",
  16524. inherited: false,
  16525. animationType: "discrete",
  16526. percentages: "no",
  16527. groups: [
  16528. "CSS Box Alignment"
  16529. ],
  16530. initial: "legacy",
  16531. appliesto: "allElements",
  16532. computed: "asSpecified",
  16533. order: "perGrammar",
  16534. status: "standard",
  16535. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/justify-items"
  16536. },
  16537. "justify-self": {
  16538. syntax: "auto | normal | stretch | <baseline-position> | <overflow-position>? [ <self-position> | left | right ]",
  16539. media: "visual",
  16540. inherited: false,
  16541. animationType: "discrete",
  16542. percentages: "no",
  16543. groups: [
  16544. "CSS Box Alignment"
  16545. ],
  16546. initial: "auto",
  16547. appliesto: "blockLevelBoxesAndAbsolutelyPositionedBoxesAndGridItems",
  16548. computed: "asSpecified",
  16549. order: "uniqueOrder",
  16550. status: "standard",
  16551. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/justify-self"
  16552. },
  16553. "justify-tracks": {
  16554. syntax: "[ normal | <content-distribution> | <overflow-position>? [ <content-position> | left | right ] ]#",
  16555. media: "visual",
  16556. inherited: false,
  16557. animationType: "discrete",
  16558. percentages: "no",
  16559. groups: [
  16560. "CSS Grid Layout"
  16561. ],
  16562. initial: "normal",
  16563. appliesto: "gridContainersWithMasonryLayoutInTheirInlineAxis",
  16564. computed: "asSpecified",
  16565. order: "uniqueOrder",
  16566. status: "experimental",
  16567. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/justify-tracks"
  16568. },
  16569. left: left,
  16570. "letter-spacing": {
  16571. syntax: "normal | <length>",
  16572. media: "visual",
  16573. inherited: true,
  16574. animationType: "length",
  16575. percentages: "no",
  16576. groups: [
  16577. "CSS Text"
  16578. ],
  16579. initial: "normal",
  16580. appliesto: "allElements",
  16581. computed: "optimumValueOfAbsoluteLengthOrNormal",
  16582. order: "uniqueOrder",
  16583. alsoAppliesTo: [
  16584. "::first-letter",
  16585. "::first-line"
  16586. ],
  16587. status: "standard",
  16588. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/letter-spacing"
  16589. },
  16590. "line-break": {
  16591. syntax: "auto | loose | normal | strict | anywhere",
  16592. media: "visual",
  16593. inherited: true,
  16594. animationType: "discrete",
  16595. percentages: "no",
  16596. groups: [
  16597. "CSS Text"
  16598. ],
  16599. initial: "auto",
  16600. appliesto: "allElements",
  16601. computed: "asSpecified",
  16602. order: "uniqueOrder",
  16603. status: "standard",
  16604. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/line-break"
  16605. },
  16606. "line-clamp": {
  16607. syntax: "none | <integer>",
  16608. media: "visual",
  16609. inherited: false,
  16610. animationType: "integer",
  16611. percentages: "no",
  16612. groups: [
  16613. "CSS Overflow"
  16614. ],
  16615. initial: "none",
  16616. appliesto: "blockContainersExceptMultiColumnContainers",
  16617. computed: "asSpecified",
  16618. order: "perGrammar",
  16619. status: "experimental"
  16620. },
  16621. "line-height": {
  16622. syntax: "normal | <number> | <length> | <percentage>",
  16623. media: "visual",
  16624. inherited: true,
  16625. animationType: "numberOrLength",
  16626. percentages: "referToElementFontSize",
  16627. groups: [
  16628. "CSS Fonts"
  16629. ],
  16630. initial: "normal",
  16631. appliesto: "allElements",
  16632. computed: "absoluteLengthOrAsSpecified",
  16633. order: "uniqueOrder",
  16634. alsoAppliesTo: [
  16635. "::first-letter",
  16636. "::first-line",
  16637. "::placeholder"
  16638. ],
  16639. status: "standard",
  16640. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/line-height"
  16641. },
  16642. "line-height-step": {
  16643. syntax: "<length>",
  16644. media: "visual",
  16645. inherited: true,
  16646. animationType: "discrete",
  16647. percentages: "no",
  16648. groups: [
  16649. "CSS Fonts"
  16650. ],
  16651. initial: "0",
  16652. appliesto: "blockContainers",
  16653. computed: "absoluteLength",
  16654. order: "perGrammar",
  16655. status: "experimental",
  16656. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/line-height-step"
  16657. },
  16658. "list-style": {
  16659. syntax: "<'list-style-type'> || <'list-style-position'> || <'list-style-image'>",
  16660. media: "visual",
  16661. inherited: true,
  16662. animationType: "discrete",
  16663. percentages: "no",
  16664. groups: [
  16665. "CSS Lists and Counters"
  16666. ],
  16667. initial: [
  16668. "list-style-type",
  16669. "list-style-position",
  16670. "list-style-image"
  16671. ],
  16672. appliesto: "listItems",
  16673. computed: [
  16674. "list-style-image",
  16675. "list-style-position",
  16676. "list-style-type"
  16677. ],
  16678. order: "orderOfAppearance",
  16679. status: "standard",
  16680. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/list-style"
  16681. },
  16682. "list-style-image": {
  16683. syntax: "<url> | none",
  16684. media: "visual",
  16685. inherited: true,
  16686. animationType: "discrete",
  16687. percentages: "no",
  16688. groups: [
  16689. "CSS Lists and Counters"
  16690. ],
  16691. initial: "none",
  16692. appliesto: "listItems",
  16693. computed: "noneOrImageWithAbsoluteURI",
  16694. order: "uniqueOrder",
  16695. status: "standard",
  16696. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/list-style-image"
  16697. },
  16698. "list-style-position": {
  16699. syntax: "inside | outside",
  16700. media: "visual",
  16701. inherited: true,
  16702. animationType: "discrete",
  16703. percentages: "no",
  16704. groups: [
  16705. "CSS Lists and Counters"
  16706. ],
  16707. initial: "outside",
  16708. appliesto: "listItems",
  16709. computed: "asSpecified",
  16710. order: "uniqueOrder",
  16711. status: "standard",
  16712. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/list-style-position"
  16713. },
  16714. "list-style-type": {
  16715. syntax: "<counter-style> | <string> | none",
  16716. media: "visual",
  16717. inherited: true,
  16718. animationType: "discrete",
  16719. percentages: "no",
  16720. groups: [
  16721. "CSS Lists and Counters"
  16722. ],
  16723. initial: "disc",
  16724. appliesto: "listItems",
  16725. computed: "asSpecified",
  16726. order: "uniqueOrder",
  16727. status: "standard",
  16728. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/list-style-type"
  16729. },
  16730. margin: margin,
  16731. "margin-block": {
  16732. syntax: "<'margin-left'>{1,2}",
  16733. media: "visual",
  16734. inherited: false,
  16735. animationType: "discrete",
  16736. percentages: "dependsOnLayoutModel",
  16737. groups: [
  16738. "CSS Logical Properties"
  16739. ],
  16740. initial: "0",
  16741. appliesto: "sameAsMargin",
  16742. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  16743. order: "uniqueOrder",
  16744. status: "standard",
  16745. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-block"
  16746. },
  16747. "margin-block-end": {
  16748. syntax: "<'margin-left'>",
  16749. media: "visual",
  16750. inherited: false,
  16751. animationType: "length",
  16752. percentages: "dependsOnLayoutModel",
  16753. groups: [
  16754. "CSS Logical Properties"
  16755. ],
  16756. initial: "0",
  16757. appliesto: "sameAsMargin",
  16758. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  16759. order: "uniqueOrder",
  16760. status: "standard",
  16761. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-block-end"
  16762. },
  16763. "margin-block-start": {
  16764. syntax: "<'margin-left'>",
  16765. media: "visual",
  16766. inherited: false,
  16767. animationType: "length",
  16768. percentages: "dependsOnLayoutModel",
  16769. groups: [
  16770. "CSS Logical Properties"
  16771. ],
  16772. initial: "0",
  16773. appliesto: "sameAsMargin",
  16774. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  16775. order: "uniqueOrder",
  16776. status: "standard",
  16777. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-block-start"
  16778. },
  16779. "margin-bottom": {
  16780. syntax: "<length> | <percentage> | auto",
  16781. media: "visual",
  16782. inherited: false,
  16783. animationType: "length",
  16784. percentages: "referToWidthOfContainingBlock",
  16785. groups: [
  16786. "CSS Box Model"
  16787. ],
  16788. initial: "0",
  16789. appliesto: "allElementsExceptTableDisplayTypes",
  16790. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16791. order: "uniqueOrder",
  16792. alsoAppliesTo: [
  16793. "::first-letter",
  16794. "::first-line"
  16795. ],
  16796. status: "standard",
  16797. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-bottom"
  16798. },
  16799. "margin-inline": {
  16800. syntax: "<'margin-left'>{1,2}",
  16801. media: "visual",
  16802. inherited: false,
  16803. animationType: "discrete",
  16804. percentages: "dependsOnLayoutModel",
  16805. groups: [
  16806. "CSS Logical Properties"
  16807. ],
  16808. initial: "0",
  16809. appliesto: "sameAsMargin",
  16810. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  16811. order: "uniqueOrder",
  16812. status: "standard",
  16813. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-inline"
  16814. },
  16815. "margin-inline-end": {
  16816. syntax: "<'margin-left'>",
  16817. media: "visual",
  16818. inherited: false,
  16819. animationType: "length",
  16820. percentages: "dependsOnLayoutModel",
  16821. groups: [
  16822. "CSS Logical Properties"
  16823. ],
  16824. initial: "0",
  16825. appliesto: "sameAsMargin",
  16826. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  16827. order: "uniqueOrder",
  16828. status: "standard",
  16829. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-inline-end"
  16830. },
  16831. "margin-inline-start": {
  16832. syntax: "<'margin-left'>",
  16833. media: "visual",
  16834. inherited: false,
  16835. animationType: "length",
  16836. percentages: "dependsOnLayoutModel",
  16837. groups: [
  16838. "CSS Logical Properties"
  16839. ],
  16840. initial: "0",
  16841. appliesto: "sameAsMargin",
  16842. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  16843. order: "uniqueOrder",
  16844. status: "standard",
  16845. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-inline-start"
  16846. },
  16847. "margin-left": {
  16848. syntax: "<length> | <percentage> | auto",
  16849. media: "visual",
  16850. inherited: false,
  16851. animationType: "length",
  16852. percentages: "referToWidthOfContainingBlock",
  16853. groups: [
  16854. "CSS Box Model"
  16855. ],
  16856. initial: "0",
  16857. appliesto: "allElementsExceptTableDisplayTypes",
  16858. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16859. order: "uniqueOrder",
  16860. alsoAppliesTo: [
  16861. "::first-letter",
  16862. "::first-line"
  16863. ],
  16864. status: "standard",
  16865. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-left"
  16866. },
  16867. "margin-right": {
  16868. syntax: "<length> | <percentage> | auto",
  16869. media: "visual",
  16870. inherited: false,
  16871. animationType: "length",
  16872. percentages: "referToWidthOfContainingBlock",
  16873. groups: [
  16874. "CSS Box Model"
  16875. ],
  16876. initial: "0",
  16877. appliesto: "allElementsExceptTableDisplayTypes",
  16878. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16879. order: "uniqueOrder",
  16880. alsoAppliesTo: [
  16881. "::first-letter",
  16882. "::first-line"
  16883. ],
  16884. status: "standard",
  16885. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-right"
  16886. },
  16887. "margin-top": {
  16888. syntax: "<length> | <percentage> | auto",
  16889. media: "visual",
  16890. inherited: false,
  16891. animationType: "length",
  16892. percentages: "referToWidthOfContainingBlock",
  16893. groups: [
  16894. "CSS Box Model"
  16895. ],
  16896. initial: "0",
  16897. appliesto: "allElementsExceptTableDisplayTypes",
  16898. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16899. order: "uniqueOrder",
  16900. alsoAppliesTo: [
  16901. "::first-letter",
  16902. "::first-line"
  16903. ],
  16904. status: "standard",
  16905. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-top"
  16906. },
  16907. "margin-trim": {
  16908. syntax: "none | in-flow | all",
  16909. media: "visual",
  16910. inherited: false,
  16911. animationType: "discrete",
  16912. percentages: "no",
  16913. groups: [
  16914. "CSS Box Model"
  16915. ],
  16916. initial: "none",
  16917. appliesto: "blockContainersAndMultiColumnContainers",
  16918. computed: "asSpecified",
  16919. order: "perGrammar",
  16920. alsoAppliesTo: [
  16921. "::first-letter",
  16922. "::first-line"
  16923. ],
  16924. status: "experimental",
  16925. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-trim"
  16926. },
  16927. mask: mask,
  16928. "mask-border": {
  16929. syntax: "<'mask-border-source'> || <'mask-border-slice'> [ / <'mask-border-width'>? [ / <'mask-border-outset'> ]? ]? || <'mask-border-repeat'> || <'mask-border-mode'>",
  16930. media: "visual",
  16931. inherited: false,
  16932. animationType: [
  16933. "mask-border-mode",
  16934. "mask-border-outset",
  16935. "mask-border-repeat",
  16936. "mask-border-slice",
  16937. "mask-border-source",
  16938. "mask-border-width"
  16939. ],
  16940. percentages: [
  16941. "mask-border-slice",
  16942. "mask-border-width"
  16943. ],
  16944. groups: [
  16945. "CSS Masking"
  16946. ],
  16947. initial: [
  16948. "mask-border-mode",
  16949. "mask-border-outset",
  16950. "mask-border-repeat",
  16951. "mask-border-slice",
  16952. "mask-border-source",
  16953. "mask-border-width"
  16954. ],
  16955. appliesto: "allElementsSVGContainerElements",
  16956. computed: [
  16957. "mask-border-mode",
  16958. "mask-border-outset",
  16959. "mask-border-repeat",
  16960. "mask-border-slice",
  16961. "mask-border-source",
  16962. "mask-border-width"
  16963. ],
  16964. order: "perGrammar",
  16965. stacking: true,
  16966. status: "standard",
  16967. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border"
  16968. },
  16969. "mask-border-mode": {
  16970. syntax: "luminance | alpha",
  16971. media: "visual",
  16972. inherited: false,
  16973. animationType: "discrete",
  16974. percentages: "no",
  16975. groups: [
  16976. "CSS Masking"
  16977. ],
  16978. initial: "alpha",
  16979. appliesto: "allElementsSVGContainerElements",
  16980. computed: "asSpecified",
  16981. order: "perGrammar",
  16982. status: "standard",
  16983. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-mode"
  16984. },
  16985. "mask-border-outset": {
  16986. syntax: "[ <length> | <number> ]{1,4}",
  16987. media: "visual",
  16988. inherited: false,
  16989. animationType: "discrete",
  16990. percentages: "no",
  16991. groups: [
  16992. "CSS Masking"
  16993. ],
  16994. initial: "0",
  16995. appliesto: "allElementsSVGContainerElements",
  16996. computed: "asSpecifiedRelativeToAbsoluteLengths",
  16997. order: "perGrammar",
  16998. status: "standard",
  16999. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-outset"
  17000. },
  17001. "mask-border-repeat": {
  17002. syntax: "[ stretch | repeat | round | space ]{1,2}",
  17003. media: "visual",
  17004. inherited: false,
  17005. animationType: "discrete",
  17006. percentages: "no",
  17007. groups: [
  17008. "CSS Masking"
  17009. ],
  17010. initial: "stretch",
  17011. appliesto: "allElementsSVGContainerElements",
  17012. computed: "asSpecified",
  17013. order: "perGrammar",
  17014. status: "standard",
  17015. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-repeat"
  17016. },
  17017. "mask-border-slice": {
  17018. syntax: "<number-percentage>{1,4} fill?",
  17019. media: "visual",
  17020. inherited: false,
  17021. animationType: "discrete",
  17022. percentages: "referToSizeOfMaskBorderImage",
  17023. groups: [
  17024. "CSS Masking"
  17025. ],
  17026. initial: "0",
  17027. appliesto: "allElementsSVGContainerElements",
  17028. computed: "asSpecified",
  17029. order: "perGrammar",
  17030. status: "standard",
  17031. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-slice"
  17032. },
  17033. "mask-border-source": {
  17034. syntax: "none | <image>",
  17035. media: "visual",
  17036. inherited: false,
  17037. animationType: "discrete",
  17038. percentages: "no",
  17039. groups: [
  17040. "CSS Masking"
  17041. ],
  17042. initial: "none",
  17043. appliesto: "allElementsSVGContainerElements",
  17044. computed: "asSpecifiedURLsAbsolute",
  17045. order: "perGrammar",
  17046. status: "standard",
  17047. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-source"
  17048. },
  17049. "mask-border-width": {
  17050. syntax: "[ <length-percentage> | <number> | auto ]{1,4}",
  17051. media: "visual",
  17052. inherited: false,
  17053. animationType: "discrete",
  17054. percentages: "relativeToMaskBorderImageArea",
  17055. groups: [
  17056. "CSS Masking"
  17057. ],
  17058. initial: "auto",
  17059. appliesto: "allElementsSVGContainerElements",
  17060. computed: "asSpecifiedRelativeToAbsoluteLengths",
  17061. order: "perGrammar",
  17062. status: "standard",
  17063. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-width"
  17064. },
  17065. "mask-clip": {
  17066. syntax: "[ <geometry-box> | no-clip ]#",
  17067. media: "visual",
  17068. inherited: false,
  17069. animationType: "discrete",
  17070. percentages: "no",
  17071. groups: [
  17072. "CSS Masking"
  17073. ],
  17074. initial: "border-box",
  17075. appliesto: "allElementsSVGContainerElements",
  17076. computed: "asSpecified",
  17077. order: "perGrammar",
  17078. status: "standard",
  17079. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-clip"
  17080. },
  17081. "mask-composite": {
  17082. syntax: "<compositing-operator>#",
  17083. media: "visual",
  17084. inherited: false,
  17085. animationType: "discrete",
  17086. percentages: "no",
  17087. groups: [
  17088. "CSS Masking"
  17089. ],
  17090. initial: "add",
  17091. appliesto: "allElementsSVGContainerElements",
  17092. computed: "asSpecified",
  17093. order: "perGrammar",
  17094. status: "standard",
  17095. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-composite"
  17096. },
  17097. "mask-image": {
  17098. syntax: "<mask-reference>#",
  17099. media: "visual",
  17100. inherited: false,
  17101. animationType: "discrete",
  17102. percentages: "no",
  17103. groups: [
  17104. "CSS Masking"
  17105. ],
  17106. initial: "none",
  17107. appliesto: "allElementsSVGContainerElements",
  17108. computed: "asSpecifiedURLsAbsolute",
  17109. order: "perGrammar",
  17110. status: "standard",
  17111. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-image"
  17112. },
  17113. "mask-mode": {
  17114. syntax: "<masking-mode>#",
  17115. media: "visual",
  17116. inherited: false,
  17117. animationType: "discrete",
  17118. percentages: "no",
  17119. groups: [
  17120. "CSS Masking"
  17121. ],
  17122. initial: "match-source",
  17123. appliesto: "allElementsSVGContainerElements",
  17124. computed: "asSpecified",
  17125. order: "perGrammar",
  17126. status: "standard",
  17127. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-mode"
  17128. },
  17129. "mask-origin": {
  17130. syntax: "<geometry-box>#",
  17131. media: "visual",
  17132. inherited: false,
  17133. animationType: "discrete",
  17134. percentages: "no",
  17135. groups: [
  17136. "CSS Masking"
  17137. ],
  17138. initial: "border-box",
  17139. appliesto: "allElementsSVGContainerElements",
  17140. computed: "asSpecified",
  17141. order: "perGrammar",
  17142. status: "standard",
  17143. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-origin"
  17144. },
  17145. "mask-position": {
  17146. syntax: "<position>#",
  17147. media: "visual",
  17148. inherited: false,
  17149. animationType: "repeatableListOfSimpleListOfLpc",
  17150. percentages: "referToSizeOfMaskPaintingArea",
  17151. groups: [
  17152. "CSS Masking"
  17153. ],
  17154. initial: "center",
  17155. appliesto: "allElementsSVGContainerElements",
  17156. computed: "consistsOfTwoKeywordsForOriginAndOffsets",
  17157. order: "perGrammar",
  17158. status: "standard",
  17159. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-position"
  17160. },
  17161. "mask-repeat": {
  17162. syntax: "<repeat-style>#",
  17163. media: "visual",
  17164. inherited: false,
  17165. animationType: "discrete",
  17166. percentages: "no",
  17167. groups: [
  17168. "CSS Masking"
  17169. ],
  17170. initial: "no-repeat",
  17171. appliesto: "allElementsSVGContainerElements",
  17172. computed: "consistsOfTwoDimensionKeywords",
  17173. order: "perGrammar",
  17174. status: "standard",
  17175. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-repeat"
  17176. },
  17177. "mask-size": {
  17178. syntax: "<bg-size>#",
  17179. media: "visual",
  17180. inherited: false,
  17181. animationType: "repeatableListOfSimpleListOfLpc",
  17182. percentages: "no",
  17183. groups: [
  17184. "CSS Masking"
  17185. ],
  17186. initial: "auto",
  17187. appliesto: "allElementsSVGContainerElements",
  17188. computed: "asSpecifiedRelativeToAbsoluteLengths",
  17189. order: "perGrammar",
  17190. status: "standard",
  17191. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-size"
  17192. },
  17193. "mask-type": {
  17194. syntax: "luminance | alpha",
  17195. media: "visual",
  17196. inherited: false,
  17197. animationType: "discrete",
  17198. percentages: "no",
  17199. groups: [
  17200. "CSS Masking"
  17201. ],
  17202. initial: "luminance",
  17203. appliesto: "maskElements",
  17204. computed: "asSpecified",
  17205. order: "perGrammar",
  17206. status: "standard",
  17207. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-type"
  17208. },
  17209. "masonry-auto-flow": {
  17210. syntax: "[ pack | next ] || [ definite-first | ordered ]",
  17211. media: "visual",
  17212. inherited: false,
  17213. animationType: "discrete",
  17214. percentages: "no",
  17215. groups: [
  17216. "CSS Grid Layout"
  17217. ],
  17218. initial: "pack",
  17219. appliesto: "gridContainersWithMasonryLayout",
  17220. computed: "asSpecified",
  17221. order: "uniqueOrder",
  17222. status: "experimental",
  17223. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/masonry-auto-flow"
  17224. },
  17225. "math-style": {
  17226. syntax: "normal | compact",
  17227. media: "visual",
  17228. inherited: true,
  17229. animationType: "notAnimatable",
  17230. percentages: "no",
  17231. groups: [
  17232. "MathML"
  17233. ],
  17234. initial: "normal",
  17235. appliesto: "allElements",
  17236. computed: "asSpecified",
  17237. order: "perGrammar",
  17238. status: "standard",
  17239. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/math-style"
  17240. },
  17241. "max-block-size": {
  17242. syntax: "<'max-width'>",
  17243. media: "visual",
  17244. inherited: false,
  17245. animationType: "lpc",
  17246. percentages: "blockSizeOfContainingBlock",
  17247. groups: [
  17248. "CSS Logical Properties"
  17249. ],
  17250. initial: "0",
  17251. appliesto: "sameAsWidthAndHeight",
  17252. computed: "sameAsMaxWidthAndMaxHeight",
  17253. order: "uniqueOrder",
  17254. status: "standard",
  17255. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-block-size"
  17256. },
  17257. "max-height": {
  17258. syntax: "none | <length-percentage> | min-content | max-content | fit-content(<length-percentage>)",
  17259. media: "visual",
  17260. inherited: false,
  17261. animationType: "lpc",
  17262. percentages: "regardingHeightOfGeneratedBoxContainingBlockPercentagesNone",
  17263. groups: [
  17264. "CSS Box Model"
  17265. ],
  17266. initial: "none",
  17267. appliesto: "allElementsButNonReplacedAndTableColumns",
  17268. computed: "percentageAsSpecifiedAbsoluteLengthOrNone",
  17269. order: "uniqueOrder",
  17270. status: "standard",
  17271. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-height"
  17272. },
  17273. "max-inline-size": {
  17274. syntax: "<'max-width'>",
  17275. media: "visual",
  17276. inherited: false,
  17277. animationType: "lpc",
  17278. percentages: "inlineSizeOfContainingBlock",
  17279. groups: [
  17280. "CSS Logical Properties"
  17281. ],
  17282. initial: "0",
  17283. appliesto: "sameAsWidthAndHeight",
  17284. computed: "sameAsMaxWidthAndMaxHeight",
  17285. order: "uniqueOrder",
  17286. status: "standard",
  17287. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-inline-size"
  17288. },
  17289. "max-lines": {
  17290. syntax: "none | <integer>",
  17291. media: "visual",
  17292. inherited: false,
  17293. animationType: "integer",
  17294. percentages: "no",
  17295. groups: [
  17296. "CSS Overflow"
  17297. ],
  17298. initial: "none",
  17299. appliesto: "blockContainersExceptMultiColumnContainers",
  17300. computed: "asSpecified",
  17301. order: "perGrammar",
  17302. status: "experimental"
  17303. },
  17304. "max-width": {
  17305. syntax: "none | <length-percentage> | min-content | max-content | fit-content(<length-percentage>)",
  17306. media: "visual",
  17307. inherited: false,
  17308. animationType: "lpc",
  17309. percentages: "referToWidthOfContainingBlock",
  17310. groups: [
  17311. "CSS Box Model"
  17312. ],
  17313. initial: "none",
  17314. appliesto: "allElementsButNonReplacedAndTableRows",
  17315. computed: "percentageAsSpecifiedAbsoluteLengthOrNone",
  17316. order: "uniqueOrder",
  17317. status: "standard",
  17318. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-width"
  17319. },
  17320. "min-block-size": {
  17321. syntax: "<'min-width'>",
  17322. media: "visual",
  17323. inherited: false,
  17324. animationType: "lpc",
  17325. percentages: "blockSizeOfContainingBlock",
  17326. groups: [
  17327. "CSS Logical Properties"
  17328. ],
  17329. initial: "0",
  17330. appliesto: "sameAsWidthAndHeight",
  17331. computed: "sameAsMinWidthAndMinHeight",
  17332. order: "uniqueOrder",
  17333. status: "standard",
  17334. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-block-size"
  17335. },
  17336. "min-height": {
  17337. syntax: "auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)",
  17338. media: "visual",
  17339. inherited: false,
  17340. animationType: "lpc",
  17341. percentages: "regardingHeightOfGeneratedBoxContainingBlockPercentages0",
  17342. groups: [
  17343. "CSS Box Model"
  17344. ],
  17345. initial: "auto",
  17346. appliesto: "allElementsButNonReplacedAndTableColumns",
  17347. computed: "percentageAsSpecifiedOrAbsoluteLength",
  17348. order: "uniqueOrder",
  17349. status: "standard",
  17350. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-height"
  17351. },
  17352. "min-inline-size": {
  17353. syntax: "<'min-width'>",
  17354. media: "visual",
  17355. inherited: false,
  17356. animationType: "lpc",
  17357. percentages: "inlineSizeOfContainingBlock",
  17358. groups: [
  17359. "CSS Logical Properties"
  17360. ],
  17361. initial: "0",
  17362. appliesto: "sameAsWidthAndHeight",
  17363. computed: "sameAsMinWidthAndMinHeight",
  17364. order: "uniqueOrder",
  17365. status: "standard",
  17366. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-inline-size"
  17367. },
  17368. "min-width": {
  17369. syntax: "auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)",
  17370. media: "visual",
  17371. inherited: false,
  17372. animationType: "lpc",
  17373. percentages: "referToWidthOfContainingBlock",
  17374. groups: [
  17375. "CSS Box Model"
  17376. ],
  17377. initial: "auto",
  17378. appliesto: "allElementsButNonReplacedAndTableRows",
  17379. computed: "percentageAsSpecifiedOrAbsoluteLength",
  17380. order: "uniqueOrder",
  17381. status: "standard",
  17382. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-width"
  17383. },
  17384. "mix-blend-mode": {
  17385. syntax: "<blend-mode>",
  17386. media: "visual",
  17387. inherited: false,
  17388. animationType: "discrete",
  17389. percentages: "no",
  17390. groups: [
  17391. "Compositing and Blending"
  17392. ],
  17393. initial: "normal",
  17394. appliesto: "allElements",
  17395. computed: "asSpecified",
  17396. order: "uniqueOrder",
  17397. stacking: true,
  17398. status: "standard",
  17399. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mix-blend-mode"
  17400. },
  17401. "object-fit": {
  17402. syntax: "fill | contain | cover | none | scale-down",
  17403. media: "visual",
  17404. inherited: false,
  17405. animationType: "discrete",
  17406. percentages: "no",
  17407. groups: [
  17408. "CSS Images"
  17409. ],
  17410. initial: "fill",
  17411. appliesto: "replacedElements",
  17412. computed: "asSpecified",
  17413. order: "uniqueOrder",
  17414. status: "standard",
  17415. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/object-fit"
  17416. },
  17417. "object-position": {
  17418. syntax: "<position>",
  17419. media: "visual",
  17420. inherited: true,
  17421. animationType: "repeatableListOfSimpleListOfLpc",
  17422. percentages: "referToWidthAndHeightOfElement",
  17423. groups: [
  17424. "CSS Images"
  17425. ],
  17426. initial: "50% 50%",
  17427. appliesto: "replacedElements",
  17428. computed: "asSpecified",
  17429. order: "uniqueOrder",
  17430. status: "standard",
  17431. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/object-position"
  17432. },
  17433. offset: offset,
  17434. "offset-anchor": {
  17435. syntax: "auto | <position>",
  17436. media: "visual",
  17437. inherited: false,
  17438. animationType: "position",
  17439. percentages: "relativeToWidthAndHeight",
  17440. groups: [
  17441. "CSS Motion Path"
  17442. ],
  17443. initial: "auto",
  17444. appliesto: "transformableElements",
  17445. computed: "forLengthAbsoluteValueOtherwisePercentage",
  17446. order: "perGrammar",
  17447. status: "standard"
  17448. },
  17449. "offset-distance": {
  17450. syntax: "<length-percentage>",
  17451. media: "visual",
  17452. inherited: false,
  17453. animationType: "lpc",
  17454. percentages: "referToTotalPathLength",
  17455. groups: [
  17456. "CSS Motion Path"
  17457. ],
  17458. initial: "0",
  17459. appliesto: "transformableElements",
  17460. computed: "forLengthAbsoluteValueOtherwisePercentage",
  17461. order: "perGrammar",
  17462. status: "standard",
  17463. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset-distance"
  17464. },
  17465. "offset-path": {
  17466. syntax: "none | ray( [ <angle> && <size> && contain? ] ) | <path()> | <url> | [ <basic-shape> || <geometry-box> ]",
  17467. media: "visual",
  17468. inherited: false,
  17469. animationType: "angleOrBasicShapeOrPath",
  17470. percentages: "no",
  17471. groups: [
  17472. "CSS Motion Path"
  17473. ],
  17474. initial: "none",
  17475. appliesto: "transformableElements",
  17476. computed: "asSpecified",
  17477. order: "perGrammar",
  17478. stacking: true,
  17479. status: "standard",
  17480. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset-path"
  17481. },
  17482. "offset-position": {
  17483. syntax: "auto | <position>",
  17484. media: "visual",
  17485. inherited: false,
  17486. animationType: "position",
  17487. percentages: "referToSizeOfContainingBlock",
  17488. groups: [
  17489. "CSS Motion Path"
  17490. ],
  17491. initial: "auto",
  17492. appliesto: "transformableElements",
  17493. computed: "forLengthAbsoluteValueOtherwisePercentage",
  17494. order: "perGrammar",
  17495. status: "experimental"
  17496. },
  17497. "offset-rotate": {
  17498. syntax: "[ auto | reverse ] || <angle>",
  17499. media: "visual",
  17500. inherited: false,
  17501. animationType: "angleOrBasicShapeOrPath",
  17502. percentages: "no",
  17503. groups: [
  17504. "CSS Motion Path"
  17505. ],
  17506. initial: "auto",
  17507. appliesto: "transformableElements",
  17508. computed: "asSpecified",
  17509. order: "perGrammar",
  17510. status: "standard",
  17511. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset-rotate"
  17512. },
  17513. opacity: opacity,
  17514. order: order,
  17515. orphans: orphans,
  17516. outline: outline,
  17517. "outline-color": {
  17518. syntax: "<color> | invert",
  17519. media: [
  17520. "visual",
  17521. "interactive"
  17522. ],
  17523. inherited: false,
  17524. animationType: "color",
  17525. percentages: "no",
  17526. groups: [
  17527. "CSS Basic User Interface"
  17528. ],
  17529. initial: "invertOrCurrentColor",
  17530. appliesto: "allElements",
  17531. computed: "invertForTranslucentColorRGBAOtherwiseRGB",
  17532. order: "uniqueOrder",
  17533. status: "standard",
  17534. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline-color"
  17535. },
  17536. "outline-offset": {
  17537. syntax: "<length>",
  17538. media: [
  17539. "visual",
  17540. "interactive"
  17541. ],
  17542. inherited: false,
  17543. animationType: "length",
  17544. percentages: "no",
  17545. groups: [
  17546. "CSS Basic User Interface"
  17547. ],
  17548. initial: "0",
  17549. appliesto: "allElements",
  17550. computed: "asSpecifiedRelativeToAbsoluteLengths",
  17551. order: "uniqueOrder",
  17552. status: "standard",
  17553. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline-offset"
  17554. },
  17555. "outline-style": {
  17556. syntax: "auto | <'border-style'>",
  17557. media: [
  17558. "visual",
  17559. "interactive"
  17560. ],
  17561. inherited: false,
  17562. animationType: "discrete",
  17563. percentages: "no",
  17564. groups: [
  17565. "CSS Basic User Interface"
  17566. ],
  17567. initial: "none",
  17568. appliesto: "allElements",
  17569. computed: "asSpecified",
  17570. order: "uniqueOrder",
  17571. status: "standard",
  17572. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline-style"
  17573. },
  17574. "outline-width": {
  17575. syntax: "<line-width>",
  17576. media: [
  17577. "visual",
  17578. "interactive"
  17579. ],
  17580. inherited: false,
  17581. animationType: "length",
  17582. percentages: "no",
  17583. groups: [
  17584. "CSS Basic User Interface"
  17585. ],
  17586. initial: "medium",
  17587. appliesto: "allElements",
  17588. computed: "absoluteLength0ForNone",
  17589. order: "uniqueOrder",
  17590. status: "standard",
  17591. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline-width"
  17592. },
  17593. overflow: overflow,
  17594. "overflow-anchor": {
  17595. syntax: "auto | none",
  17596. media: "visual",
  17597. inherited: false,
  17598. animationType: "discrete",
  17599. percentages: "no",
  17600. groups: [
  17601. "CSS Scroll Anchoring"
  17602. ],
  17603. initial: "auto",
  17604. appliesto: "allElements",
  17605. computed: "asSpecified",
  17606. order: "perGrammar",
  17607. status: "standard"
  17608. },
  17609. "overflow-block": {
  17610. syntax: "visible | hidden | clip | scroll | auto",
  17611. media: "visual",
  17612. inherited: false,
  17613. animationType: "discrete",
  17614. percentages: "no",
  17615. groups: [
  17616. "CSS Overflow"
  17617. ],
  17618. initial: "auto",
  17619. appliesto: "blockContainersFlexContainersGridContainers",
  17620. computed: "asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent",
  17621. order: "perGrammar",
  17622. status: "standard"
  17623. },
  17624. "overflow-clip-box": {
  17625. syntax: "padding-box | content-box",
  17626. media: "visual",
  17627. inherited: false,
  17628. animationType: "discrete",
  17629. percentages: "no",
  17630. groups: [
  17631. "Mozilla Extensions"
  17632. ],
  17633. initial: "padding-box",
  17634. appliesto: "allElements",
  17635. computed: "asSpecified",
  17636. order: "uniqueOrder",
  17637. status: "nonstandard",
  17638. mdn_url: "https://developer.mozilla.org/docs/Mozilla/CSS/overflow-clip-box"
  17639. },
  17640. "overflow-inline": {
  17641. syntax: "visible | hidden | clip | scroll | auto",
  17642. media: "visual",
  17643. inherited: false,
  17644. animationType: "discrete",
  17645. percentages: "no",
  17646. groups: [
  17647. "CSS Overflow"
  17648. ],
  17649. initial: "auto",
  17650. appliesto: "blockContainersFlexContainersGridContainers",
  17651. computed: "asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent",
  17652. order: "perGrammar",
  17653. status: "standard"
  17654. },
  17655. "overflow-wrap": {
  17656. syntax: "normal | break-word | anywhere",
  17657. media: "visual",
  17658. inherited: true,
  17659. animationType: "discrete",
  17660. percentages: "no",
  17661. groups: [
  17662. "CSS Text"
  17663. ],
  17664. initial: "normal",
  17665. appliesto: "nonReplacedInlineElements",
  17666. computed: "asSpecified",
  17667. order: "uniqueOrder",
  17668. status: "standard",
  17669. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-wrap"
  17670. },
  17671. "overflow-x": {
  17672. syntax: "visible | hidden | clip | scroll | auto",
  17673. media: "visual",
  17674. inherited: false,
  17675. animationType: "discrete",
  17676. percentages: "no",
  17677. groups: [
  17678. "CSS Overflow"
  17679. ],
  17680. initial: "visible",
  17681. appliesto: "blockContainersFlexContainersGridContainers",
  17682. computed: "asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent",
  17683. order: "uniqueOrder",
  17684. status: "standard",
  17685. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-x"
  17686. },
  17687. "overflow-y": {
  17688. syntax: "visible | hidden | clip | scroll | auto",
  17689. media: "visual",
  17690. inherited: false,
  17691. animationType: "discrete",
  17692. percentages: "no",
  17693. groups: [
  17694. "CSS Overflow"
  17695. ],
  17696. initial: "visible",
  17697. appliesto: "blockContainersFlexContainersGridContainers",
  17698. computed: "asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent",
  17699. order: "uniqueOrder",
  17700. status: "standard",
  17701. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-y"
  17702. },
  17703. "overscroll-behavior": {
  17704. syntax: "[ contain | none | auto ]{1,2}",
  17705. media: "visual",
  17706. inherited: false,
  17707. animationType: "discrete",
  17708. percentages: "no",
  17709. groups: [
  17710. "CSS Box Model"
  17711. ],
  17712. initial: "auto",
  17713. appliesto: "nonReplacedBlockAndInlineBlockElements",
  17714. computed: "asSpecified",
  17715. order: "uniqueOrder",
  17716. status: "standard",
  17717. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior"
  17718. },
  17719. "overscroll-behavior-block": {
  17720. syntax: "contain | none | auto",
  17721. media: "visual",
  17722. inherited: false,
  17723. animationType: "discrete",
  17724. percentages: "no",
  17725. groups: [
  17726. "CSS Box Model"
  17727. ],
  17728. initial: "auto",
  17729. appliesto: "nonReplacedBlockAndInlineBlockElements",
  17730. computed: "asSpecified",
  17731. order: "uniqueOrder",
  17732. status: "standard",
  17733. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-block"
  17734. },
  17735. "overscroll-behavior-inline": {
  17736. syntax: "contain | none | auto",
  17737. media: "visual",
  17738. inherited: false,
  17739. animationType: "discrete",
  17740. percentages: "no",
  17741. groups: [
  17742. "CSS Box Model"
  17743. ],
  17744. initial: "auto",
  17745. appliesto: "nonReplacedBlockAndInlineBlockElements",
  17746. computed: "asSpecified",
  17747. order: "uniqueOrder",
  17748. status: "standard",
  17749. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-inline"
  17750. },
  17751. "overscroll-behavior-x": {
  17752. syntax: "contain | none | auto",
  17753. media: "visual",
  17754. inherited: false,
  17755. animationType: "discrete",
  17756. percentages: "no",
  17757. groups: [
  17758. "CSS Box Model"
  17759. ],
  17760. initial: "auto",
  17761. appliesto: "nonReplacedBlockAndInlineBlockElements",
  17762. computed: "asSpecified",
  17763. order: "uniqueOrder",
  17764. status: "standard",
  17765. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-x"
  17766. },
  17767. "overscroll-behavior-y": {
  17768. syntax: "contain | none | auto",
  17769. media: "visual",
  17770. inherited: false,
  17771. animationType: "discrete",
  17772. percentages: "no",
  17773. groups: [
  17774. "CSS Box Model"
  17775. ],
  17776. initial: "auto",
  17777. appliesto: "nonReplacedBlockAndInlineBlockElements",
  17778. computed: "asSpecified",
  17779. order: "uniqueOrder",
  17780. status: "standard",
  17781. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-y"
  17782. },
  17783. padding: padding,
  17784. "padding-block": {
  17785. syntax: "<'padding-left'>{1,2}",
  17786. media: "visual",
  17787. inherited: false,
  17788. animationType: "discrete",
  17789. percentages: "logicalWidthOfContainingBlock",
  17790. groups: [
  17791. "CSS Logical Properties"
  17792. ],
  17793. initial: "0",
  17794. appliesto: "allElements",
  17795. computed: "asLength",
  17796. order: "uniqueOrder",
  17797. status: "standard",
  17798. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-block"
  17799. },
  17800. "padding-block-end": {
  17801. syntax: "<'padding-left'>",
  17802. media: "visual",
  17803. inherited: false,
  17804. animationType: "length",
  17805. percentages: "logicalWidthOfContainingBlock",
  17806. groups: [
  17807. "CSS Logical Properties"
  17808. ],
  17809. initial: "0",
  17810. appliesto: "allElements",
  17811. computed: "asLength",
  17812. order: "uniqueOrder",
  17813. status: "standard",
  17814. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-block-end"
  17815. },
  17816. "padding-block-start": {
  17817. syntax: "<'padding-left'>",
  17818. media: "visual",
  17819. inherited: false,
  17820. animationType: "length",
  17821. percentages: "logicalWidthOfContainingBlock",
  17822. groups: [
  17823. "CSS Logical Properties"
  17824. ],
  17825. initial: "0",
  17826. appliesto: "allElements",
  17827. computed: "asLength",
  17828. order: "uniqueOrder",
  17829. status: "standard",
  17830. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-block-start"
  17831. },
  17832. "padding-bottom": {
  17833. syntax: "<length> | <percentage>",
  17834. media: "visual",
  17835. inherited: false,
  17836. animationType: "length",
  17837. percentages: "referToWidthOfContainingBlock",
  17838. groups: [
  17839. "CSS Box Model"
  17840. ],
  17841. initial: "0",
  17842. appliesto: "allElementsExceptInternalTableDisplayTypes",
  17843. computed: "percentageAsSpecifiedOrAbsoluteLength",
  17844. order: "uniqueOrder",
  17845. alsoAppliesTo: [
  17846. "::first-letter",
  17847. "::first-line"
  17848. ],
  17849. status: "standard",
  17850. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-bottom"
  17851. },
  17852. "padding-inline": {
  17853. syntax: "<'padding-left'>{1,2}",
  17854. media: "visual",
  17855. inherited: false,
  17856. animationType: "discrete",
  17857. percentages: "logicalWidthOfContainingBlock",
  17858. groups: [
  17859. "CSS Logical Properties"
  17860. ],
  17861. initial: "0",
  17862. appliesto: "allElements",
  17863. computed: "asLength",
  17864. order: "uniqueOrder",
  17865. status: "standard",
  17866. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-inline"
  17867. },
  17868. "padding-inline-end": {
  17869. syntax: "<'padding-left'>",
  17870. media: "visual",
  17871. inherited: false,
  17872. animationType: "length",
  17873. percentages: "logicalWidthOfContainingBlock",
  17874. groups: [
  17875. "CSS Logical Properties"
  17876. ],
  17877. initial: "0",
  17878. appliesto: "allElements",
  17879. computed: "asLength",
  17880. order: "uniqueOrder",
  17881. status: "standard",
  17882. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-inline-end"
  17883. },
  17884. "padding-inline-start": {
  17885. syntax: "<'padding-left'>",
  17886. media: "visual",
  17887. inherited: false,
  17888. animationType: "length",
  17889. percentages: "logicalWidthOfContainingBlock",
  17890. groups: [
  17891. "CSS Logical Properties"
  17892. ],
  17893. initial: "0",
  17894. appliesto: "allElements",
  17895. computed: "asLength",
  17896. order: "uniqueOrder",
  17897. status: "standard",
  17898. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-inline-start"
  17899. },
  17900. "padding-left": {
  17901. syntax: "<length> | <percentage>",
  17902. media: "visual",
  17903. inherited: false,
  17904. animationType: "length",
  17905. percentages: "referToWidthOfContainingBlock",
  17906. groups: [
  17907. "CSS Box Model"
  17908. ],
  17909. initial: "0",
  17910. appliesto: "allElementsExceptInternalTableDisplayTypes",
  17911. computed: "percentageAsSpecifiedOrAbsoluteLength",
  17912. order: "uniqueOrder",
  17913. alsoAppliesTo: [
  17914. "::first-letter",
  17915. "::first-line"
  17916. ],
  17917. status: "standard",
  17918. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-left"
  17919. },
  17920. "padding-right": {
  17921. syntax: "<length> | <percentage>",
  17922. media: "visual",
  17923. inherited: false,
  17924. animationType: "length",
  17925. percentages: "referToWidthOfContainingBlock",
  17926. groups: [
  17927. "CSS Box Model"
  17928. ],
  17929. initial: "0",
  17930. appliesto: "allElementsExceptInternalTableDisplayTypes",
  17931. computed: "percentageAsSpecifiedOrAbsoluteLength",
  17932. order: "uniqueOrder",
  17933. alsoAppliesTo: [
  17934. "::first-letter",
  17935. "::first-line"
  17936. ],
  17937. status: "standard",
  17938. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-right"
  17939. },
  17940. "padding-top": {
  17941. syntax: "<length> | <percentage>",
  17942. media: "visual",
  17943. inherited: false,
  17944. animationType: "length",
  17945. percentages: "referToWidthOfContainingBlock",
  17946. groups: [
  17947. "CSS Box Model"
  17948. ],
  17949. initial: "0",
  17950. appliesto: "allElementsExceptInternalTableDisplayTypes",
  17951. computed: "percentageAsSpecifiedOrAbsoluteLength",
  17952. order: "uniqueOrder",
  17953. alsoAppliesTo: [
  17954. "::first-letter",
  17955. "::first-line"
  17956. ],
  17957. status: "standard",
  17958. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-top"
  17959. },
  17960. "page-break-after": {
  17961. syntax: "auto | always | avoid | left | right | recto | verso",
  17962. media: [
  17963. "visual",
  17964. "paged"
  17965. ],
  17966. inherited: false,
  17967. animationType: "discrete",
  17968. percentages: "no",
  17969. groups: [
  17970. "CSS Pages"
  17971. ],
  17972. initial: "auto",
  17973. appliesto: "blockElementsInNormalFlow",
  17974. computed: "asSpecified",
  17975. order: "uniqueOrder",
  17976. status: "standard",
  17977. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/page-break-after"
  17978. },
  17979. "page-break-before": {
  17980. syntax: "auto | always | avoid | left | right | recto | verso",
  17981. media: [
  17982. "visual",
  17983. "paged"
  17984. ],
  17985. inherited: false,
  17986. animationType: "discrete",
  17987. percentages: "no",
  17988. groups: [
  17989. "CSS Pages"
  17990. ],
  17991. initial: "auto",
  17992. appliesto: "blockElementsInNormalFlow",
  17993. computed: "asSpecified",
  17994. order: "uniqueOrder",
  17995. status: "standard",
  17996. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/page-break-before"
  17997. },
  17998. "page-break-inside": {
  17999. syntax: "auto | avoid",
  18000. media: [
  18001. "visual",
  18002. "paged"
  18003. ],
  18004. inherited: false,
  18005. animationType: "discrete",
  18006. percentages: "no",
  18007. groups: [
  18008. "CSS Pages"
  18009. ],
  18010. initial: "auto",
  18011. appliesto: "blockElementsInNormalFlow",
  18012. computed: "asSpecified",
  18013. order: "uniqueOrder",
  18014. status: "standard",
  18015. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/page-break-inside"
  18016. },
  18017. "paint-order": {
  18018. syntax: "normal | [ fill || stroke || markers ]",
  18019. media: "visual",
  18020. inherited: true,
  18021. animationType: "discrete",
  18022. percentages: "no",
  18023. groups: [
  18024. "CSS Text"
  18025. ],
  18026. initial: "normal",
  18027. appliesto: "textElements",
  18028. computed: "asSpecified",
  18029. order: "uniqueOrder",
  18030. status: "standard",
  18031. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/paint-order"
  18032. },
  18033. perspective: perspective,
  18034. "perspective-origin": {
  18035. syntax: "<position>",
  18036. media: "visual",
  18037. inherited: false,
  18038. animationType: "simpleListOfLpc",
  18039. percentages: "referToSizeOfBoundingBox",
  18040. groups: [
  18041. "CSS Transforms"
  18042. ],
  18043. initial: "50% 50%",
  18044. appliesto: "transformableElements",
  18045. computed: "forLengthAbsoluteValueOtherwisePercentage",
  18046. order: "oneOrTwoValuesLengthAbsoluteKeywordsPercentages",
  18047. status: "standard",
  18048. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/perspective-origin"
  18049. },
  18050. "place-content": {
  18051. syntax: "<'align-content'> <'justify-content'>?",
  18052. media: "visual",
  18053. inherited: false,
  18054. animationType: "discrete",
  18055. percentages: "no",
  18056. groups: [
  18057. "CSS Box Alignment"
  18058. ],
  18059. initial: "normal",
  18060. appliesto: "multilineFlexContainers",
  18061. computed: "asSpecified",
  18062. order: "uniqueOrder",
  18063. status: "standard",
  18064. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/place-content"
  18065. },
  18066. "place-items": {
  18067. syntax: "<'align-items'> <'justify-items'>?",
  18068. media: "visual",
  18069. inherited: false,
  18070. animationType: "discrete",
  18071. percentages: "no",
  18072. groups: [
  18073. "CSS Box Alignment"
  18074. ],
  18075. initial: [
  18076. "align-items",
  18077. "justify-items"
  18078. ],
  18079. appliesto: "allElements",
  18080. computed: [
  18081. "align-items",
  18082. "justify-items"
  18083. ],
  18084. order: "uniqueOrder",
  18085. status: "standard",
  18086. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/place-items"
  18087. },
  18088. "place-self": {
  18089. syntax: "<'align-self'> <'justify-self'>?",
  18090. media: "visual",
  18091. inherited: false,
  18092. animationType: "discrete",
  18093. percentages: "no",
  18094. groups: [
  18095. "CSS Box Alignment"
  18096. ],
  18097. initial: [
  18098. "align-self",
  18099. "justify-self"
  18100. ],
  18101. appliesto: "blockLevelBoxesAndAbsolutelyPositionedBoxesAndGridItems",
  18102. computed: [
  18103. "align-self",
  18104. "justify-self"
  18105. ],
  18106. order: "uniqueOrder",
  18107. status: "standard",
  18108. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/place-self"
  18109. },
  18110. "pointer-events": {
  18111. syntax: "auto | none | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | inherit",
  18112. media: "visual",
  18113. inherited: true,
  18114. animationType: "discrete",
  18115. percentages: "no",
  18116. groups: [
  18117. "Pointer Events"
  18118. ],
  18119. initial: "auto",
  18120. appliesto: "allElements",
  18121. computed: "asSpecified",
  18122. order: "uniqueOrder",
  18123. status: "standard",
  18124. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/pointer-events"
  18125. },
  18126. position: position$1,
  18127. quotes: quotes,
  18128. resize: resize,
  18129. right: right,
  18130. rotate: rotate,
  18131. "row-gap": {
  18132. syntax: "normal | <length-percentage>",
  18133. media: "visual",
  18134. inherited: false,
  18135. animationType: "lpc",
  18136. percentages: "referToDimensionOfContentArea",
  18137. groups: [
  18138. "CSS Box Alignment"
  18139. ],
  18140. initial: "normal",
  18141. appliesto: "multiColumnElementsFlexContainersGridContainers",
  18142. computed: "asSpecifiedWithLengthsAbsoluteAndNormalComputingToZeroExceptMultiColumn",
  18143. order: "perGrammar",
  18144. status: "standard",
  18145. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/row-gap"
  18146. },
  18147. "ruby-align": {
  18148. syntax: "start | center | space-between | space-around",
  18149. media: "visual",
  18150. inherited: true,
  18151. animationType: "discrete",
  18152. percentages: "no",
  18153. groups: [
  18154. "CSS Ruby"
  18155. ],
  18156. initial: "space-around",
  18157. appliesto: "rubyBasesAnnotationsBaseAnnotationContainers",
  18158. computed: "asSpecified",
  18159. order: "uniqueOrder",
  18160. status: "experimental",
  18161. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/ruby-align"
  18162. },
  18163. "ruby-merge": {
  18164. syntax: "separate | collapse | auto",
  18165. media: "visual",
  18166. inherited: true,
  18167. animationType: "discrete",
  18168. percentages: "no",
  18169. groups: [
  18170. "CSS Ruby"
  18171. ],
  18172. initial: "separate",
  18173. appliesto: "rubyAnnotationsContainers",
  18174. computed: "asSpecified",
  18175. order: "uniqueOrder",
  18176. status: "experimental"
  18177. },
  18178. "ruby-position": {
  18179. syntax: "over | under | inter-character",
  18180. media: "visual",
  18181. inherited: true,
  18182. animationType: "discrete",
  18183. percentages: "no",
  18184. groups: [
  18185. "CSS Ruby"
  18186. ],
  18187. initial: "over",
  18188. appliesto: "rubyAnnotationsContainers",
  18189. computed: "asSpecified",
  18190. order: "uniqueOrder",
  18191. status: "experimental",
  18192. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/ruby-position"
  18193. },
  18194. scale: scale,
  18195. "scrollbar-color": {
  18196. syntax: "auto | dark | light | <color>{2}",
  18197. media: "visual",
  18198. inherited: true,
  18199. animationType: "color",
  18200. percentages: "no",
  18201. groups: [
  18202. "CSS Scrollbars"
  18203. ],
  18204. initial: "auto",
  18205. appliesto: "scrollingBoxes",
  18206. computed: "asSpecified",
  18207. order: "perGrammar",
  18208. status: "standard",
  18209. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scrollbar-color"
  18210. },
  18211. "scrollbar-gutter": {
  18212. syntax: "auto | [ stable | always ] && both? && force?",
  18213. media: "visual",
  18214. inherited: false,
  18215. animationType: "discrete",
  18216. percentages: "no",
  18217. groups: [
  18218. "CSS Overflow"
  18219. ],
  18220. initial: "auto",
  18221. appliesto: "allElements",
  18222. computed: "asSpecified",
  18223. order: "perGrammar",
  18224. status: "standard",
  18225. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scrollbar-gutter"
  18226. },
  18227. "scrollbar-width": {
  18228. syntax: "auto | thin | none",
  18229. media: "visual",
  18230. inherited: false,
  18231. animationType: "discrete",
  18232. percentages: "no",
  18233. groups: [
  18234. "CSS Scrollbars"
  18235. ],
  18236. initial: "auto",
  18237. appliesto: "scrollingBoxes",
  18238. computed: "asSpecified",
  18239. order: "perGrammar",
  18240. status: "standard",
  18241. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scrollbar-width"
  18242. },
  18243. "scroll-behavior": {
  18244. syntax: "auto | smooth",
  18245. media: "visual",
  18246. inherited: false,
  18247. animationType: "discrete",
  18248. percentages: "no",
  18249. groups: [
  18250. "CSSOM View"
  18251. ],
  18252. initial: "auto",
  18253. appliesto: "scrollingBoxes",
  18254. computed: "asSpecified",
  18255. order: "uniqueOrder",
  18256. status: "standard",
  18257. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-behavior"
  18258. },
  18259. "scroll-margin": {
  18260. syntax: "<length>{1,4}",
  18261. media: "visual",
  18262. inherited: false,
  18263. animationType: "byComputedValueType",
  18264. percentages: "no",
  18265. groups: [
  18266. "CSS Scroll Snap"
  18267. ],
  18268. initial: "0",
  18269. appliesto: "allElements",
  18270. computed: "asSpecified",
  18271. order: "perGrammar",
  18272. status: "standard",
  18273. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin"
  18274. },
  18275. "scroll-margin-block": {
  18276. syntax: "<length>{1,2}",
  18277. media: "visual",
  18278. inherited: false,
  18279. animationType: "byComputedValueType",
  18280. percentages: "no",
  18281. groups: [
  18282. "CSS Scroll Snap"
  18283. ],
  18284. initial: "0",
  18285. appliesto: "allElements",
  18286. computed: "asSpecified",
  18287. order: "perGrammar",
  18288. status: "standard",
  18289. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block"
  18290. },
  18291. "scroll-margin-block-start": {
  18292. syntax: "<length>",
  18293. media: "visual",
  18294. inherited: false,
  18295. animationType: "byComputedValueType",
  18296. percentages: "no",
  18297. groups: [
  18298. "CSS Scroll Snap"
  18299. ],
  18300. initial: "0",
  18301. appliesto: "allElements",
  18302. computed: "asSpecified",
  18303. order: "perGrammar",
  18304. status: "standard",
  18305. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block-start"
  18306. },
  18307. "scroll-margin-block-end": {
  18308. syntax: "<length>",
  18309. media: "visual",
  18310. inherited: false,
  18311. animationType: "byComputedValueType",
  18312. percentages: "no",
  18313. groups: [
  18314. "CSS Scroll Snap"
  18315. ],
  18316. initial: "0",
  18317. appliesto: "allElements",
  18318. computed: "asSpecified",
  18319. order: "perGrammar",
  18320. status: "standard",
  18321. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block-end"
  18322. },
  18323. "scroll-margin-bottom": {
  18324. syntax: "<length>",
  18325. media: "visual",
  18326. inherited: false,
  18327. animationType: "byComputedValueType",
  18328. percentages: "no",
  18329. groups: [
  18330. "CSS Scroll Snap"
  18331. ],
  18332. initial: "0",
  18333. appliesto: "allElements",
  18334. computed: "asSpecified",
  18335. order: "perGrammar",
  18336. status: "standard",
  18337. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-bottom"
  18338. },
  18339. "scroll-margin-inline": {
  18340. syntax: "<length>{1,2}",
  18341. media: "visual",
  18342. inherited: false,
  18343. animationType: "byComputedValueType",
  18344. percentages: "no",
  18345. groups: [
  18346. "CSS Scroll Snap"
  18347. ],
  18348. initial: "0",
  18349. appliesto: "allElements",
  18350. computed: "asSpecified",
  18351. order: "perGrammar",
  18352. status: "standard",
  18353. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline"
  18354. },
  18355. "scroll-margin-inline-start": {
  18356. syntax: "<length>",
  18357. media: "visual",
  18358. inherited: false,
  18359. animationType: "byComputedValueType",
  18360. percentages: "no",
  18361. groups: [
  18362. "CSS Scroll Snap"
  18363. ],
  18364. initial: "0",
  18365. appliesto: "allElements",
  18366. computed: "asSpecified",
  18367. order: "perGrammar",
  18368. status: "standard",
  18369. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline-start"
  18370. },
  18371. "scroll-margin-inline-end": {
  18372. syntax: "<length>",
  18373. media: "visual",
  18374. inherited: false,
  18375. animationType: "byComputedValueType",
  18376. percentages: "no",
  18377. groups: [
  18378. "CSS Scroll Snap"
  18379. ],
  18380. initial: "0",
  18381. appliesto: "allElements",
  18382. computed: "asSpecified",
  18383. order: "perGrammar",
  18384. status: "standard",
  18385. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline-end"
  18386. },
  18387. "scroll-margin-left": {
  18388. syntax: "<length>",
  18389. media: "visual",
  18390. inherited: false,
  18391. animationType: "byComputedValueType",
  18392. percentages: "no",
  18393. groups: [
  18394. "CSS Scroll Snap"
  18395. ],
  18396. initial: "0",
  18397. appliesto: "allElements",
  18398. computed: "asSpecified",
  18399. order: "perGrammar",
  18400. status: "standard",
  18401. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-left"
  18402. },
  18403. "scroll-margin-right": {
  18404. syntax: "<length>",
  18405. media: "visual",
  18406. inherited: false,
  18407. animationType: "byComputedValueType",
  18408. percentages: "no",
  18409. groups: [
  18410. "CSS Scroll Snap"
  18411. ],
  18412. initial: "0",
  18413. appliesto: "allElements",
  18414. computed: "asSpecified",
  18415. order: "perGrammar",
  18416. status: "standard",
  18417. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-right"
  18418. },
  18419. "scroll-margin-top": {
  18420. syntax: "<length>",
  18421. media: "visual",
  18422. inherited: false,
  18423. animationType: "byComputedValueType",
  18424. percentages: "no",
  18425. groups: [
  18426. "CSS Scroll Snap"
  18427. ],
  18428. initial: "0",
  18429. appliesto: "allElements",
  18430. computed: "asSpecified",
  18431. order: "perGrammar",
  18432. status: "standard",
  18433. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-top"
  18434. },
  18435. "scroll-padding": {
  18436. syntax: "[ auto | <length-percentage> ]{1,4}",
  18437. media: "visual",
  18438. inherited: false,
  18439. animationType: "byComputedValueType",
  18440. percentages: "relativeToTheScrollContainersScrollport",
  18441. groups: [
  18442. "CSS Scroll Snap"
  18443. ],
  18444. initial: "auto",
  18445. appliesto: "scrollContainers",
  18446. computed: "asSpecified",
  18447. order: "perGrammar",
  18448. status: "standard",
  18449. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding"
  18450. },
  18451. "scroll-padding-block": {
  18452. syntax: "[ auto | <length-percentage> ]{1,2}",
  18453. media: "visual",
  18454. inherited: false,
  18455. animationType: "byComputedValueType",
  18456. percentages: "relativeToTheScrollContainersScrollport",
  18457. groups: [
  18458. "CSS Scroll Snap"
  18459. ],
  18460. initial: "auto",
  18461. appliesto: "scrollContainers",
  18462. computed: "asSpecified",
  18463. order: "perGrammar",
  18464. status: "standard",
  18465. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block"
  18466. },
  18467. "scroll-padding-block-start": {
  18468. syntax: "auto | <length-percentage>",
  18469. media: "visual",
  18470. inherited: false,
  18471. animationType: "byComputedValueType",
  18472. percentages: "relativeToTheScrollContainersScrollport",
  18473. groups: [
  18474. "CSS Scroll Snap"
  18475. ],
  18476. initial: "auto",
  18477. appliesto: "scrollContainers",
  18478. computed: "asSpecified",
  18479. order: "perGrammar",
  18480. status: "standard",
  18481. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block-start"
  18482. },
  18483. "scroll-padding-block-end": {
  18484. syntax: "auto | <length-percentage>",
  18485. media: "visual",
  18486. inherited: false,
  18487. animationType: "byComputedValueType",
  18488. percentages: "relativeToTheScrollContainersScrollport",
  18489. groups: [
  18490. "CSS Scroll Snap"
  18491. ],
  18492. initial: "auto",
  18493. appliesto: "scrollContainers",
  18494. computed: "asSpecified",
  18495. order: "perGrammar",
  18496. status: "standard",
  18497. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block-end"
  18498. },
  18499. "scroll-padding-bottom": {
  18500. syntax: "auto | <length-percentage>",
  18501. media: "visual",
  18502. inherited: false,
  18503. animationType: "byComputedValueType",
  18504. percentages: "relativeToTheScrollContainersScrollport",
  18505. groups: [
  18506. "CSS Scroll Snap"
  18507. ],
  18508. initial: "auto",
  18509. appliesto: "scrollContainers",
  18510. computed: "asSpecified",
  18511. order: "perGrammar",
  18512. status: "standard",
  18513. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-bottom"
  18514. },
  18515. "scroll-padding-inline": {
  18516. syntax: "[ auto | <length-percentage> ]{1,2}",
  18517. media: "visual",
  18518. inherited: false,
  18519. animationType: "byComputedValueType",
  18520. percentages: "relativeToTheScrollContainersScrollport",
  18521. groups: [
  18522. "CSS Scroll Snap"
  18523. ],
  18524. initial: "auto",
  18525. appliesto: "scrollContainers",
  18526. computed: "asSpecified",
  18527. order: "perGrammar",
  18528. status: "standard",
  18529. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline"
  18530. },
  18531. "scroll-padding-inline-start": {
  18532. syntax: "auto | <length-percentage>",
  18533. media: "visual",
  18534. inherited: false,
  18535. animationType: "byComputedValueType",
  18536. percentages: "relativeToTheScrollContainersScrollport",
  18537. groups: [
  18538. "CSS Scroll Snap"
  18539. ],
  18540. initial: "auto",
  18541. appliesto: "scrollContainers",
  18542. computed: "asSpecified",
  18543. order: "perGrammar",
  18544. status: "standard",
  18545. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline-start"
  18546. },
  18547. "scroll-padding-inline-end": {
  18548. syntax: "auto | <length-percentage>",
  18549. media: "visual",
  18550. inherited: false,
  18551. animationType: "byComputedValueType",
  18552. percentages: "relativeToTheScrollContainersScrollport",
  18553. groups: [
  18554. "CSS Scroll Snap"
  18555. ],
  18556. initial: "auto",
  18557. appliesto: "scrollContainers",
  18558. computed: "asSpecified",
  18559. order: "perGrammar",
  18560. status: "standard",
  18561. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline-end"
  18562. },
  18563. "scroll-padding-left": {
  18564. syntax: "auto | <length-percentage>",
  18565. media: "visual",
  18566. inherited: false,
  18567. animationType: "byComputedValueType",
  18568. percentages: "relativeToTheScrollContainersScrollport",
  18569. groups: [
  18570. "CSS Scroll Snap"
  18571. ],
  18572. initial: "auto",
  18573. appliesto: "scrollContainers",
  18574. computed: "asSpecified",
  18575. order: "perGrammar",
  18576. status: "standard",
  18577. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-left"
  18578. },
  18579. "scroll-padding-right": {
  18580. syntax: "auto | <length-percentage>",
  18581. media: "visual",
  18582. inherited: false,
  18583. animationType: "byComputedValueType",
  18584. percentages: "relativeToTheScrollContainersScrollport",
  18585. groups: [
  18586. "CSS Scroll Snap"
  18587. ],
  18588. initial: "auto",
  18589. appliesto: "scrollContainers",
  18590. computed: "asSpecified",
  18591. order: "perGrammar",
  18592. status: "standard",
  18593. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-right"
  18594. },
  18595. "scroll-padding-top": {
  18596. syntax: "auto | <length-percentage>",
  18597. media: "visual",
  18598. inherited: false,
  18599. animationType: "byComputedValueType",
  18600. percentages: "relativeToTheScrollContainersScrollport",
  18601. groups: [
  18602. "CSS Scroll Snap"
  18603. ],
  18604. initial: "auto",
  18605. appliesto: "scrollContainers",
  18606. computed: "asSpecified",
  18607. order: "perGrammar",
  18608. status: "standard",
  18609. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-top"
  18610. },
  18611. "scroll-snap-align": {
  18612. syntax: "[ none | start | end | center ]{1,2}",
  18613. media: "visual",
  18614. inherited: false,
  18615. animationType: "discrete",
  18616. percentages: "no",
  18617. groups: [
  18618. "CSS Scroll Snap"
  18619. ],
  18620. initial: "none",
  18621. appliesto: "allElements",
  18622. computed: "asSpecified",
  18623. order: "perGrammar",
  18624. status: "standard",
  18625. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-align"
  18626. },
  18627. "scroll-snap-coordinate": {
  18628. syntax: "none | <position>#",
  18629. media: "interactive",
  18630. inherited: false,
  18631. animationType: "position",
  18632. percentages: "referToBorderBox",
  18633. groups: [
  18634. "CSS Scroll Snap"
  18635. ],
  18636. initial: "none",
  18637. appliesto: "allElements",
  18638. computed: "asSpecifiedRelativeToAbsoluteLengths",
  18639. order: "uniqueOrder",
  18640. status: "obsolete",
  18641. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-coordinate"
  18642. },
  18643. "scroll-snap-destination": {
  18644. syntax: "<position>",
  18645. media: "interactive",
  18646. inherited: false,
  18647. animationType: "position",
  18648. percentages: "relativeToScrollContainerPaddingBoxAxis",
  18649. groups: [
  18650. "CSS Scroll Snap"
  18651. ],
  18652. initial: "0px 0px",
  18653. appliesto: "scrollContainers",
  18654. computed: "asSpecifiedRelativeToAbsoluteLengths",
  18655. order: "uniqueOrder",
  18656. status: "obsolete",
  18657. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-destination"
  18658. },
  18659. "scroll-snap-points-x": {
  18660. syntax: "none | repeat( <length-percentage> )",
  18661. media: "interactive",
  18662. inherited: false,
  18663. animationType: "discrete",
  18664. percentages: "relativeToScrollContainerPaddingBoxAxis",
  18665. groups: [
  18666. "CSS Scroll Snap"
  18667. ],
  18668. initial: "none",
  18669. appliesto: "scrollContainers",
  18670. computed: "asSpecifiedRelativeToAbsoluteLengths",
  18671. order: "uniqueOrder",
  18672. status: "obsolete",
  18673. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-points-x"
  18674. },
  18675. "scroll-snap-points-y": {
  18676. syntax: "none | repeat( <length-percentage> )",
  18677. media: "interactive",
  18678. inherited: false,
  18679. animationType: "discrete",
  18680. percentages: "relativeToScrollContainerPaddingBoxAxis",
  18681. groups: [
  18682. "CSS Scroll Snap"
  18683. ],
  18684. initial: "none",
  18685. appliesto: "scrollContainers",
  18686. computed: "asSpecifiedRelativeToAbsoluteLengths",
  18687. order: "uniqueOrder",
  18688. status: "obsolete",
  18689. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-points-y"
  18690. },
  18691. "scroll-snap-stop": {
  18692. syntax: "normal | always",
  18693. media: "visual",
  18694. inherited: false,
  18695. animationType: "discrete",
  18696. percentages: "no",
  18697. groups: [
  18698. "CSS Scroll Snap"
  18699. ],
  18700. initial: "normal",
  18701. appliesto: "allElements",
  18702. computed: "asSpecified",
  18703. order: "perGrammar",
  18704. status: "standard",
  18705. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-stop"
  18706. },
  18707. "scroll-snap-type": {
  18708. syntax: "none | [ x | y | block | inline | both ] [ mandatory | proximity ]?",
  18709. media: "interactive",
  18710. inherited: false,
  18711. animationType: "discrete",
  18712. percentages: "no",
  18713. groups: [
  18714. "CSS Scroll Snap"
  18715. ],
  18716. initial: "none",
  18717. appliesto: "allElements",
  18718. computed: "asSpecified",
  18719. order: "uniqueOrder",
  18720. status: "standard",
  18721. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type"
  18722. },
  18723. "scroll-snap-type-x": {
  18724. syntax: "none | mandatory | proximity",
  18725. media: "interactive",
  18726. inherited: false,
  18727. animationType: "discrete",
  18728. percentages: "no",
  18729. groups: [
  18730. "CSS Scroll Snap"
  18731. ],
  18732. initial: "none",
  18733. appliesto: "scrollContainers",
  18734. computed: "asSpecified",
  18735. order: "uniqueOrder",
  18736. status: "obsolete",
  18737. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type-x"
  18738. },
  18739. "scroll-snap-type-y": {
  18740. syntax: "none | mandatory | proximity",
  18741. media: "interactive",
  18742. inherited: false,
  18743. animationType: "discrete",
  18744. percentages: "no",
  18745. groups: [
  18746. "CSS Scroll Snap"
  18747. ],
  18748. initial: "none",
  18749. appliesto: "scrollContainers",
  18750. computed: "asSpecified",
  18751. order: "uniqueOrder",
  18752. status: "obsolete",
  18753. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type-y"
  18754. },
  18755. "shape-image-threshold": {
  18756. syntax: "<alpha-value>",
  18757. media: "visual",
  18758. inherited: false,
  18759. animationType: "number",
  18760. percentages: "no",
  18761. groups: [
  18762. "CSS Shapes"
  18763. ],
  18764. initial: "0.0",
  18765. appliesto: "floats",
  18766. computed: "specifiedValueNumberClipped0To1",
  18767. order: "uniqueOrder",
  18768. status: "standard",
  18769. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/shape-image-threshold"
  18770. },
  18771. "shape-margin": {
  18772. syntax: "<length-percentage>",
  18773. media: "visual",
  18774. inherited: false,
  18775. animationType: "lpc",
  18776. percentages: "referToWidthOfContainingBlock",
  18777. groups: [
  18778. "CSS Shapes"
  18779. ],
  18780. initial: "0",
  18781. appliesto: "floats",
  18782. computed: "asSpecifiedRelativeToAbsoluteLengths",
  18783. order: "uniqueOrder",
  18784. status: "standard",
  18785. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/shape-margin"
  18786. },
  18787. "shape-outside": {
  18788. syntax: "none | <shape-box> || <basic-shape> | <image>",
  18789. media: "visual",
  18790. inherited: false,
  18791. animationType: "basicShapeOtherwiseNo",
  18792. percentages: "no",
  18793. groups: [
  18794. "CSS Shapes"
  18795. ],
  18796. initial: "none",
  18797. appliesto: "floats",
  18798. computed: "asDefinedForBasicShapeWithAbsoluteURIOtherwiseAsSpecified",
  18799. order: "uniqueOrder",
  18800. status: "standard",
  18801. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/shape-outside"
  18802. },
  18803. "tab-size": {
  18804. syntax: "<integer> | <length>",
  18805. media: "visual",
  18806. inherited: true,
  18807. animationType: "length",
  18808. percentages: "no",
  18809. groups: [
  18810. "CSS Text"
  18811. ],
  18812. initial: "8",
  18813. appliesto: "blockContainers",
  18814. computed: "specifiedIntegerOrAbsoluteLength",
  18815. order: "uniqueOrder",
  18816. status: "standard",
  18817. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/tab-size"
  18818. },
  18819. "table-layout": {
  18820. syntax: "auto | fixed",
  18821. media: "visual",
  18822. inherited: false,
  18823. animationType: "discrete",
  18824. percentages: "no",
  18825. groups: [
  18826. "CSS Table"
  18827. ],
  18828. initial: "auto",
  18829. appliesto: "tableElements",
  18830. computed: "asSpecified",
  18831. order: "uniqueOrder",
  18832. status: "standard",
  18833. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/table-layout"
  18834. },
  18835. "text-align": {
  18836. syntax: "start | end | left | right | center | justify | match-parent",
  18837. media: "visual",
  18838. inherited: true,
  18839. animationType: "discrete",
  18840. percentages: "no",
  18841. groups: [
  18842. "CSS Text"
  18843. ],
  18844. initial: "startOrNamelessValueIfLTRRightIfRTL",
  18845. appliesto: "blockContainers",
  18846. computed: "asSpecifiedExceptMatchParent",
  18847. order: "orderOfAppearance",
  18848. alsoAppliesTo: [
  18849. "::placeholder"
  18850. ],
  18851. status: "standard",
  18852. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-align"
  18853. },
  18854. "text-align-last": {
  18855. syntax: "auto | start | end | left | right | center | justify",
  18856. media: "visual",
  18857. inherited: true,
  18858. animationType: "discrete",
  18859. percentages: "no",
  18860. groups: [
  18861. "CSS Text"
  18862. ],
  18863. initial: "auto",
  18864. appliesto: "blockContainers",
  18865. computed: "asSpecified",
  18866. order: "uniqueOrder",
  18867. status: "standard",
  18868. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-align-last"
  18869. },
  18870. "text-combine-upright": {
  18871. syntax: "none | all | [ digits <integer>? ]",
  18872. media: "visual",
  18873. inherited: true,
  18874. animationType: "notAnimatable",
  18875. percentages: "no",
  18876. groups: [
  18877. "CSS Writing Modes"
  18878. ],
  18879. initial: "none",
  18880. appliesto: "nonReplacedInlineElements",
  18881. computed: "keywordPlusIntegerIfDigits",
  18882. order: "uniqueOrder",
  18883. status: "standard",
  18884. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-combine-upright"
  18885. },
  18886. "text-decoration": {
  18887. syntax: "<'text-decoration-line'> || <'text-decoration-style'> || <'text-decoration-color'> || <'text-decoration-thickness'>",
  18888. media: "visual",
  18889. inherited: false,
  18890. animationType: [
  18891. "text-decoration-color",
  18892. "text-decoration-style",
  18893. "text-decoration-line",
  18894. "text-decoration-thickness"
  18895. ],
  18896. percentages: "no",
  18897. groups: [
  18898. "CSS Text Decoration"
  18899. ],
  18900. initial: [
  18901. "text-decoration-color",
  18902. "text-decoration-style",
  18903. "text-decoration-line"
  18904. ],
  18905. appliesto: "allElements",
  18906. computed: [
  18907. "text-decoration-line",
  18908. "text-decoration-style",
  18909. "text-decoration-color",
  18910. "text-decoration-thickness"
  18911. ],
  18912. order: "orderOfAppearance",
  18913. alsoAppliesTo: [
  18914. "::first-letter",
  18915. "::first-line",
  18916. "::placeholder"
  18917. ],
  18918. status: "standard",
  18919. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration"
  18920. },
  18921. "text-decoration-color": {
  18922. syntax: "<color>",
  18923. media: "visual",
  18924. inherited: false,
  18925. animationType: "color",
  18926. percentages: "no",
  18927. groups: [
  18928. "CSS Text Decoration"
  18929. ],
  18930. initial: "currentcolor",
  18931. appliesto: "allElements",
  18932. computed: "computedColor",
  18933. order: "uniqueOrder",
  18934. alsoAppliesTo: [
  18935. "::first-letter",
  18936. "::first-line",
  18937. "::placeholder"
  18938. ],
  18939. status: "standard",
  18940. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-color"
  18941. },
  18942. "text-decoration-line": {
  18943. syntax: "none | [ underline || overline || line-through || blink ] | spelling-error | grammar-error",
  18944. media: "visual",
  18945. inherited: false,
  18946. animationType: "discrete",
  18947. percentages: "no",
  18948. groups: [
  18949. "CSS Text Decoration"
  18950. ],
  18951. initial: "none",
  18952. appliesto: "allElements",
  18953. computed: "asSpecified",
  18954. order: "orderOfAppearance",
  18955. alsoAppliesTo: [
  18956. "::first-letter",
  18957. "::first-line",
  18958. "::placeholder"
  18959. ],
  18960. status: "standard",
  18961. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-line"
  18962. },
  18963. "text-decoration-skip": {
  18964. syntax: "none | [ objects || [ spaces | [ leading-spaces || trailing-spaces ] ] || edges || box-decoration ]",
  18965. media: "visual",
  18966. inherited: true,
  18967. animationType: "discrete",
  18968. percentages: "no",
  18969. groups: [
  18970. "CSS Text Decoration"
  18971. ],
  18972. initial: "objects",
  18973. appliesto: "allElements",
  18974. computed: "asSpecified",
  18975. order: "orderOfAppearance",
  18976. status: "experimental",
  18977. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-skip"
  18978. },
  18979. "text-decoration-skip-ink": {
  18980. syntax: "auto | all | none",
  18981. media: "visual",
  18982. inherited: true,
  18983. animationType: "discrete",
  18984. percentages: "no",
  18985. groups: [
  18986. "CSS Text Decoration"
  18987. ],
  18988. initial: "auto",
  18989. appliesto: "allElements",
  18990. computed: "asSpecified",
  18991. order: "orderOfAppearance",
  18992. status: "standard",
  18993. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-skip-ink"
  18994. },
  18995. "text-decoration-style": {
  18996. syntax: "solid | double | dotted | dashed | wavy",
  18997. media: "visual",
  18998. inherited: false,
  18999. animationType: "discrete",
  19000. percentages: "no",
  19001. groups: [
  19002. "CSS Text Decoration"
  19003. ],
  19004. initial: "solid",
  19005. appliesto: "allElements",
  19006. computed: "asSpecified",
  19007. order: "uniqueOrder",
  19008. alsoAppliesTo: [
  19009. "::first-letter",
  19010. "::first-line",
  19011. "::placeholder"
  19012. ],
  19013. status: "standard",
  19014. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-style"
  19015. },
  19016. "text-decoration-thickness": {
  19017. syntax: "auto | from-font | <length> | <percentage> ",
  19018. media: "visual",
  19019. inherited: false,
  19020. animationType: "byComputedValueType",
  19021. percentages: "referToElementFontSize",
  19022. groups: [
  19023. "CSS Text Decoration"
  19024. ],
  19025. initial: "auto",
  19026. appliesto: "allElements",
  19027. computed: "asSpecified",
  19028. order: "uniqueOrder",
  19029. alsoAppliesTo: [
  19030. "::first-letter",
  19031. "::first-line",
  19032. "::placeholder"
  19033. ],
  19034. status: "standard",
  19035. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-thickness"
  19036. },
  19037. "text-emphasis": {
  19038. syntax: "<'text-emphasis-style'> || <'text-emphasis-color'>",
  19039. media: "visual",
  19040. inherited: false,
  19041. animationType: [
  19042. "text-emphasis-color",
  19043. "text-emphasis-style"
  19044. ],
  19045. percentages: "no",
  19046. groups: [
  19047. "CSS Text Decoration"
  19048. ],
  19049. initial: [
  19050. "text-emphasis-style",
  19051. "text-emphasis-color"
  19052. ],
  19053. appliesto: "allElements",
  19054. computed: [
  19055. "text-emphasis-style",
  19056. "text-emphasis-color"
  19057. ],
  19058. order: "orderOfAppearance",
  19059. status: "standard",
  19060. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-emphasis"
  19061. },
  19062. "text-emphasis-color": {
  19063. syntax: "<color>",
  19064. media: "visual",
  19065. inherited: false,
  19066. animationType: "color",
  19067. percentages: "no",
  19068. groups: [
  19069. "CSS Text Decoration"
  19070. ],
  19071. initial: "currentcolor",
  19072. appliesto: "allElements",
  19073. computed: "computedColor",
  19074. order: "uniqueOrder",
  19075. status: "standard",
  19076. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-emphasis-color"
  19077. },
  19078. "text-emphasis-position": {
  19079. syntax: "[ over | under ] && [ right | left ]",
  19080. media: "visual",
  19081. inherited: false,
  19082. animationType: "discrete",
  19083. percentages: "no",
  19084. groups: [
  19085. "CSS Text Decoration"
  19086. ],
  19087. initial: "over right",
  19088. appliesto: "allElements",
  19089. computed: "asSpecified",
  19090. order: "uniqueOrder",
  19091. status: "standard",
  19092. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-emphasis-position"
  19093. },
  19094. "text-emphasis-style": {
  19095. syntax: "none | [ [ filled | open ] || [ dot | circle | double-circle | triangle | sesame ] ] | <string>",
  19096. media: "visual",
  19097. inherited: false,
  19098. animationType: "discrete",
  19099. percentages: "no",
  19100. groups: [
  19101. "CSS Text Decoration"
  19102. ],
  19103. initial: "none",
  19104. appliesto: "allElements",
  19105. computed: "asSpecified",
  19106. order: "uniqueOrder",
  19107. status: "standard",
  19108. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-emphasis-style"
  19109. },
  19110. "text-indent": {
  19111. syntax: "<length-percentage> && hanging? && each-line?",
  19112. media: "visual",
  19113. inherited: true,
  19114. animationType: "lpc",
  19115. percentages: "referToWidthOfContainingBlock",
  19116. groups: [
  19117. "CSS Text"
  19118. ],
  19119. initial: "0",
  19120. appliesto: "blockContainers",
  19121. computed: "percentageOrAbsoluteLengthPlusKeywords",
  19122. order: "lengthOrPercentageBeforeKeywords",
  19123. status: "standard",
  19124. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-indent"
  19125. },
  19126. "text-justify": {
  19127. syntax: "auto | inter-character | inter-word | none",
  19128. media: "visual",
  19129. inherited: true,
  19130. animationType: "discrete",
  19131. percentages: "no",
  19132. groups: [
  19133. "CSS Text"
  19134. ],
  19135. initial: "auto",
  19136. appliesto: "inlineLevelAndTableCellElements",
  19137. computed: "asSpecified",
  19138. order: "uniqueOrder",
  19139. status: "standard",
  19140. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-justify"
  19141. },
  19142. "text-orientation": {
  19143. syntax: "mixed | upright | sideways",
  19144. media: "visual",
  19145. inherited: true,
  19146. animationType: "discrete",
  19147. percentages: "no",
  19148. groups: [
  19149. "CSS Writing Modes"
  19150. ],
  19151. initial: "mixed",
  19152. appliesto: "allElementsExceptTableRowGroupsRowsColumnGroupsAndColumns",
  19153. computed: "asSpecified",
  19154. order: "uniqueOrder",
  19155. status: "standard",
  19156. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-orientation"
  19157. },
  19158. "text-overflow": {
  19159. syntax: "[ clip | ellipsis | <string> ]{1,2}",
  19160. media: "visual",
  19161. inherited: false,
  19162. animationType: "discrete",
  19163. percentages: "no",
  19164. groups: [
  19165. "CSS Basic User Interface"
  19166. ],
  19167. initial: "clip",
  19168. appliesto: "blockContainerElements",
  19169. computed: "asSpecified",
  19170. order: "uniqueOrder",
  19171. alsoAppliesTo: [
  19172. "::placeholder"
  19173. ],
  19174. status: "standard",
  19175. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-overflow"
  19176. },
  19177. "text-rendering": {
  19178. syntax: "auto | optimizeSpeed | optimizeLegibility | geometricPrecision",
  19179. media: "visual",
  19180. inherited: true,
  19181. animationType: "discrete",
  19182. percentages: "no",
  19183. groups: [
  19184. "CSS Miscellaneous"
  19185. ],
  19186. initial: "auto",
  19187. appliesto: "textElements",
  19188. computed: "asSpecified",
  19189. order: "uniqueOrder",
  19190. status: "standard",
  19191. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-rendering"
  19192. },
  19193. "text-shadow": {
  19194. syntax: "none | <shadow-t>#",
  19195. media: "visual",
  19196. inherited: true,
  19197. animationType: "shadowList",
  19198. percentages: "no",
  19199. groups: [
  19200. "CSS Text Decoration"
  19201. ],
  19202. initial: "none",
  19203. appliesto: "allElements",
  19204. computed: "colorPlusThreeAbsoluteLengths",
  19205. order: "uniqueOrder",
  19206. alsoAppliesTo: [
  19207. "::first-letter",
  19208. "::first-line",
  19209. "::placeholder"
  19210. ],
  19211. status: "standard",
  19212. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-shadow"
  19213. },
  19214. "text-size-adjust": {
  19215. syntax: "none | auto | <percentage>",
  19216. media: "visual",
  19217. inherited: true,
  19218. animationType: "discrete",
  19219. percentages: "referToSizeOfFont",
  19220. groups: [
  19221. "CSS Text"
  19222. ],
  19223. initial: "autoForSmartphoneBrowsersSupportingInflation",
  19224. appliesto: "allElements",
  19225. computed: "asSpecified",
  19226. order: "uniqueOrder",
  19227. status: "experimental",
  19228. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-size-adjust"
  19229. },
  19230. "text-transform": {
  19231. syntax: "none | capitalize | uppercase | lowercase | full-width | full-size-kana",
  19232. media: "visual",
  19233. inherited: true,
  19234. animationType: "discrete",
  19235. percentages: "no",
  19236. groups: [
  19237. "CSS Text"
  19238. ],
  19239. initial: "none",
  19240. appliesto: "allElements",
  19241. computed: "asSpecified",
  19242. order: "uniqueOrder",
  19243. alsoAppliesTo: [
  19244. "::first-letter",
  19245. "::first-line",
  19246. "::placeholder"
  19247. ],
  19248. status: "standard",
  19249. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-transform"
  19250. },
  19251. "text-underline-offset": {
  19252. syntax: "auto | <length> | <percentage> ",
  19253. media: "visual",
  19254. inherited: true,
  19255. animationType: "byComputedValueType",
  19256. percentages: "referToElementFontSize",
  19257. groups: [
  19258. "CSS Text Decoration"
  19259. ],
  19260. initial: "auto",
  19261. appliesto: "allElements",
  19262. computed: "asSpecified",
  19263. order: "uniqueOrder",
  19264. alsoAppliesTo: [
  19265. "::first-letter",
  19266. "::first-line",
  19267. "::placeholder"
  19268. ],
  19269. status: "standard",
  19270. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-underline-offset"
  19271. },
  19272. "text-underline-position": {
  19273. syntax: "auto | from-font | [ under || [ left | right ] ]",
  19274. media: "visual",
  19275. inherited: true,
  19276. animationType: "discrete",
  19277. percentages: "no",
  19278. groups: [
  19279. "CSS Text Decoration"
  19280. ],
  19281. initial: "auto",
  19282. appliesto: "allElements",
  19283. computed: "asSpecified",
  19284. order: "orderOfAppearance",
  19285. status: "standard",
  19286. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-underline-position"
  19287. },
  19288. top: top,
  19289. "touch-action": {
  19290. syntax: "auto | none | [ [ pan-x | pan-left | pan-right ] || [ pan-y | pan-up | pan-down ] || pinch-zoom ] | manipulation",
  19291. media: "visual",
  19292. inherited: false,
  19293. animationType: "discrete",
  19294. percentages: "no",
  19295. groups: [
  19296. "Pointer Events"
  19297. ],
  19298. initial: "auto",
  19299. appliesto: "allElementsExceptNonReplacedInlineElementsTableRowsColumnsRowColumnGroups",
  19300. computed: "asSpecified",
  19301. order: "uniqueOrder",
  19302. status: "standard",
  19303. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/touch-action"
  19304. },
  19305. transform: transform,
  19306. "transform-box": {
  19307. syntax: "content-box | border-box | fill-box | stroke-box | view-box",
  19308. media: "visual",
  19309. inherited: false,
  19310. animationType: "discrete",
  19311. percentages: "no",
  19312. groups: [
  19313. "CSS Transforms"
  19314. ],
  19315. initial: "view-box",
  19316. appliesto: "transformableElements",
  19317. computed: "asSpecified",
  19318. order: "perGrammar",
  19319. status: "standard",
  19320. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform-box"
  19321. },
  19322. "transform-origin": {
  19323. syntax: "[ <length-percentage> | left | center | right | top | bottom ] | [ [ <length-percentage> | left | center | right ] && [ <length-percentage> | top | center | bottom ] ] <length>?",
  19324. media: "visual",
  19325. inherited: false,
  19326. animationType: "simpleListOfLpc",
  19327. percentages: "referToSizeOfBoundingBox",
  19328. groups: [
  19329. "CSS Transforms"
  19330. ],
  19331. initial: "50% 50% 0",
  19332. appliesto: "transformableElements",
  19333. computed: "forLengthAbsoluteValueOtherwisePercentage",
  19334. order: "oneOrTwoValuesLengthAbsoluteKeywordsPercentages",
  19335. status: "standard",
  19336. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform-origin"
  19337. },
  19338. "transform-style": {
  19339. syntax: "flat | preserve-3d",
  19340. media: "visual",
  19341. inherited: false,
  19342. animationType: "discrete",
  19343. percentages: "no",
  19344. groups: [
  19345. "CSS Transforms"
  19346. ],
  19347. initial: "flat",
  19348. appliesto: "transformableElements",
  19349. computed: "asSpecified",
  19350. order: "uniqueOrder",
  19351. stacking: true,
  19352. status: "standard",
  19353. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform-style"
  19354. },
  19355. transition: transition,
  19356. "transition-delay": {
  19357. syntax: "<time>#",
  19358. media: "interactive",
  19359. inherited: false,
  19360. animationType: "discrete",
  19361. percentages: "no",
  19362. groups: [
  19363. "CSS Transitions"
  19364. ],
  19365. initial: "0s",
  19366. appliesto: "allElementsAndPseudos",
  19367. computed: "asSpecified",
  19368. order: "uniqueOrder",
  19369. status: "standard",
  19370. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition-delay"
  19371. },
  19372. "transition-duration": {
  19373. syntax: "<time>#",
  19374. media: "interactive",
  19375. inherited: false,
  19376. animationType: "discrete",
  19377. percentages: "no",
  19378. groups: [
  19379. "CSS Transitions"
  19380. ],
  19381. initial: "0s",
  19382. appliesto: "allElementsAndPseudos",
  19383. computed: "asSpecified",
  19384. order: "uniqueOrder",
  19385. status: "standard",
  19386. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition-duration"
  19387. },
  19388. "transition-property": {
  19389. syntax: "none | <single-transition-property>#",
  19390. media: "visual",
  19391. inherited: false,
  19392. animationType: "discrete",
  19393. percentages: "no",
  19394. groups: [
  19395. "CSS Transitions"
  19396. ],
  19397. initial: "all",
  19398. appliesto: "allElementsAndPseudos",
  19399. computed: "asSpecified",
  19400. order: "uniqueOrder",
  19401. status: "standard",
  19402. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition-property"
  19403. },
  19404. "transition-timing-function": {
  19405. syntax: "<timing-function>#",
  19406. media: "interactive",
  19407. inherited: false,
  19408. animationType: "discrete",
  19409. percentages: "no",
  19410. groups: [
  19411. "CSS Transitions"
  19412. ],
  19413. initial: "ease",
  19414. appliesto: "allElementsAndPseudos",
  19415. computed: "asSpecified",
  19416. order: "uniqueOrder",
  19417. status: "standard",
  19418. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition-timing-function"
  19419. },
  19420. translate: translate,
  19421. "unicode-bidi": {
  19422. syntax: "normal | embed | isolate | bidi-override | isolate-override | plaintext",
  19423. media: "visual",
  19424. inherited: false,
  19425. animationType: "discrete",
  19426. percentages: "no",
  19427. groups: [
  19428. "CSS Writing Modes"
  19429. ],
  19430. initial: "normal",
  19431. appliesto: "allElementsSomeValuesNoEffectOnNonInlineElements",
  19432. computed: "asSpecified",
  19433. order: "uniqueOrder",
  19434. status: "standard",
  19435. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/unicode-bidi"
  19436. },
  19437. "user-select": {
  19438. syntax: "auto | text | none | contain | all",
  19439. media: "visual",
  19440. inherited: false,
  19441. animationType: "discrete",
  19442. percentages: "no",
  19443. groups: [
  19444. "CSS Basic User Interface"
  19445. ],
  19446. initial: "auto",
  19447. appliesto: "allElements",
  19448. computed: "asSpecified",
  19449. order: "uniqueOrder",
  19450. status: "nonstandard",
  19451. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/user-select"
  19452. },
  19453. "vertical-align": {
  19454. syntax: "baseline | sub | super | text-top | text-bottom | middle | top | bottom | <percentage> | <length>",
  19455. media: "visual",
  19456. inherited: false,
  19457. animationType: "length",
  19458. percentages: "referToLineHeight",
  19459. groups: [
  19460. "CSS Table"
  19461. ],
  19462. initial: "baseline",
  19463. appliesto: "inlineLevelAndTableCellElements",
  19464. computed: "absoluteLengthOrKeyword",
  19465. order: "uniqueOrder",
  19466. alsoAppliesTo: [
  19467. "::first-letter",
  19468. "::first-line",
  19469. "::placeholder"
  19470. ],
  19471. status: "standard",
  19472. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/vertical-align"
  19473. },
  19474. visibility: visibility,
  19475. "white-space": {
  19476. syntax: "normal | pre | nowrap | pre-wrap | pre-line | break-spaces",
  19477. media: "visual",
  19478. inherited: true,
  19479. animationType: "discrete",
  19480. percentages: "no",
  19481. groups: [
  19482. "CSS Text"
  19483. ],
  19484. initial: "normal",
  19485. appliesto: "allElements",
  19486. computed: "asSpecified",
  19487. order: "uniqueOrder",
  19488. status: "standard",
  19489. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/white-space"
  19490. },
  19491. widows: widows,
  19492. width: width,
  19493. "will-change": {
  19494. syntax: "auto | <animateable-feature>#",
  19495. media: "all",
  19496. inherited: false,
  19497. animationType: "discrete",
  19498. percentages: "no",
  19499. groups: [
  19500. "CSS Will Change"
  19501. ],
  19502. initial: "auto",
  19503. appliesto: "allElements",
  19504. computed: "asSpecified",
  19505. order: "uniqueOrder",
  19506. status: "standard",
  19507. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/will-change"
  19508. },
  19509. "word-break": {
  19510. syntax: "normal | break-all | keep-all | break-word",
  19511. media: "visual",
  19512. inherited: true,
  19513. animationType: "discrete",
  19514. percentages: "no",
  19515. groups: [
  19516. "CSS Text"
  19517. ],
  19518. initial: "normal",
  19519. appliesto: "allElements",
  19520. computed: "asSpecified",
  19521. order: "uniqueOrder",
  19522. status: "standard",
  19523. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/word-break"
  19524. },
  19525. "word-spacing": {
  19526. syntax: "normal | <length-percentage>",
  19527. media: "visual",
  19528. inherited: true,
  19529. animationType: "length",
  19530. percentages: "referToWidthOfAffectedGlyph",
  19531. groups: [
  19532. "CSS Text"
  19533. ],
  19534. initial: "normal",
  19535. appliesto: "allElements",
  19536. computed: "optimumMinAndMaxValueOfAbsoluteLengthPercentageOrNormal",
  19537. order: "uniqueOrder",
  19538. alsoAppliesTo: [
  19539. "::first-letter",
  19540. "::first-line",
  19541. "::placeholder"
  19542. ],
  19543. status: "standard",
  19544. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/word-spacing"
  19545. },
  19546. "word-wrap": {
  19547. syntax: "normal | break-word",
  19548. media: "visual",
  19549. inherited: true,
  19550. animationType: "discrete",
  19551. percentages: "no",
  19552. groups: [
  19553. "CSS Text"
  19554. ],
  19555. initial: "normal",
  19556. appliesto: "nonReplacedInlineElements",
  19557. computed: "asSpecified",
  19558. order: "uniqueOrder",
  19559. status: "standard",
  19560. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-wrap"
  19561. },
  19562. "writing-mode": {
  19563. syntax: "horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr",
  19564. media: "visual",
  19565. inherited: true,
  19566. animationType: "discrete",
  19567. percentages: "no",
  19568. groups: [
  19569. "CSS Writing Modes"
  19570. ],
  19571. initial: "horizontal-tb",
  19572. appliesto: "allElementsExceptTableRowColumnGroupsTableRowsColumns",
  19573. computed: "asSpecified",
  19574. order: "uniqueOrder",
  19575. status: "standard",
  19576. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/writing-mode"
  19577. },
  19578. "z-index": {
  19579. syntax: "auto | <integer>",
  19580. media: "visual",
  19581. inherited: false,
  19582. animationType: "integer",
  19583. percentages: "no",
  19584. groups: [
  19585. "CSS Positioning"
  19586. ],
  19587. initial: "auto",
  19588. appliesto: "positionedElements",
  19589. computed: "asSpecified",
  19590. order: "uniqueOrder",
  19591. stacking: true,
  19592. status: "standard",
  19593. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/z-index"
  19594. },
  19595. zoom: zoom
  19596. };
  19597. var attachment = {
  19598. syntax: "scroll | fixed | local"
  19599. };
  19600. var box = {
  19601. syntax: "border-box | padding-box | content-box"
  19602. };
  19603. var color = {
  19604. syntax: "<rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>"
  19605. };
  19606. var combinator = {
  19607. syntax: "'>' | '+' | '~' | [ '||' ]"
  19608. };
  19609. var gradient = {
  19610. syntax: "<linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> | <repeating-radial-gradient()> | <conic-gradient()>"
  19611. };
  19612. var hue = {
  19613. syntax: "<number> | <angle>"
  19614. };
  19615. var image = {
  19616. syntax: "<url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>"
  19617. };
  19618. var nth$1 = {
  19619. syntax: "<an-plus-b> | even | odd"
  19620. };
  19621. var position = {
  19622. syntax: "[ [ left | center | right ] || [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]"
  19623. };
  19624. var quote = {
  19625. syntax: "open-quote | close-quote | no-open-quote | no-close-quote"
  19626. };
  19627. var shadow = {
  19628. syntax: "inset? && <length>{2,4} && <color>?"
  19629. };
  19630. var shape = {
  19631. syntax: "rect(<top>, <right>, <bottom>, <left>)"
  19632. };
  19633. var size = {
  19634. syntax: "closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}"
  19635. };
  19636. var symbol = {
  19637. syntax: "<string> | <image> | <custom-ident>"
  19638. };
  19639. var target = {
  19640. syntax: "<target-counter()> | <target-counters()> | <target-text()>"
  19641. };
  19642. var require$$2 = {
  19643. "absolute-size": {
  19644. syntax: "xx-small | x-small | small | medium | large | x-large | xx-large | xxx-large"
  19645. },
  19646. "alpha-value": {
  19647. syntax: "<number> | <percentage>"
  19648. },
  19649. "angle-percentage": {
  19650. syntax: "<angle> | <percentage>"
  19651. },
  19652. "angular-color-hint": {
  19653. syntax: "<angle-percentage>"
  19654. },
  19655. "angular-color-stop": {
  19656. syntax: "<color> && <color-stop-angle>?"
  19657. },
  19658. "angular-color-stop-list": {
  19659. syntax: "[ <angular-color-stop> [, <angular-color-hint>]? ]# , <angular-color-stop>"
  19660. },
  19661. "animateable-feature": {
  19662. syntax: "scroll-position | contents | <custom-ident>"
  19663. },
  19664. attachment: attachment,
  19665. "attr()": {
  19666. syntax: "attr( <attr-name> <type-or-unit>? [, <attr-fallback> ]? )"
  19667. },
  19668. "attr-matcher": {
  19669. syntax: "[ '~' | '|' | '^' | '$' | '*' ]? '='"
  19670. },
  19671. "attr-modifier": {
  19672. syntax: "i | s"
  19673. },
  19674. "attribute-selector": {
  19675. syntax: "'[' <wq-name> ']' | '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'"
  19676. },
  19677. "auto-repeat": {
  19678. syntax: "repeat( [ auto-fill | auto-fit ] , [ <line-names>? <fixed-size> ]+ <line-names>? )"
  19679. },
  19680. "auto-track-list": {
  19681. syntax: "[ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>? <auto-repeat>\n[ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>?"
  19682. },
  19683. "baseline-position": {
  19684. syntax: "[ first | last ]? baseline"
  19685. },
  19686. "basic-shape": {
  19687. syntax: "<inset()> | <circle()> | <ellipse()> | <polygon()> | <path()>"
  19688. },
  19689. "bg-image": {
  19690. syntax: "none | <image>"
  19691. },
  19692. "bg-layer": {
  19693. syntax: "<bg-image> || <bg-position> [ / <bg-size> ]? || <repeat-style> || <attachment> || <box> || <box>"
  19694. },
  19695. "bg-position": {
  19696. syntax: "[ [ left | center | right | top | bottom | <length-percentage> ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ] | [ center | [ left | right ] <length-percentage>? ] && [ center | [ top | bottom ] <length-percentage>? ] ]"
  19697. },
  19698. "bg-size": {
  19699. syntax: "[ <length-percentage> | auto ]{1,2} | cover | contain"
  19700. },
  19701. "blur()": {
  19702. syntax: "blur( <length> )"
  19703. },
  19704. "blend-mode": {
  19705. syntax: "normal | multiply | screen | overlay | darken | lighten | color-dodge | color-burn | hard-light | soft-light | difference | exclusion | hue | saturation | color | luminosity"
  19706. },
  19707. box: box,
  19708. "brightness()": {
  19709. syntax: "brightness( <number-percentage> )"
  19710. },
  19711. "calc()": {
  19712. syntax: "calc( <calc-sum> )"
  19713. },
  19714. "calc-sum": {
  19715. syntax: "<calc-product> [ [ '+' | '-' ] <calc-product> ]*"
  19716. },
  19717. "calc-product": {
  19718. syntax: "<calc-value> [ '*' <calc-value> | '/' <number> ]*"
  19719. },
  19720. "calc-value": {
  19721. syntax: "<number> | <dimension> | <percentage> | ( <calc-sum> )"
  19722. },
  19723. "cf-final-image": {
  19724. syntax: "<image> | <color>"
  19725. },
  19726. "cf-mixing-image": {
  19727. syntax: "<percentage>? && <image>"
  19728. },
  19729. "circle()": {
  19730. syntax: "circle( [ <shape-radius> ]? [ at <position> ]? )"
  19731. },
  19732. "clamp()": {
  19733. syntax: "clamp( <calc-sum>#{3} )"
  19734. },
  19735. "class-selector": {
  19736. syntax: "'.' <ident-token>"
  19737. },
  19738. "clip-source": {
  19739. syntax: "<url>"
  19740. },
  19741. color: color,
  19742. "color-stop": {
  19743. syntax: "<color-stop-length> | <color-stop-angle>"
  19744. },
  19745. "color-stop-angle": {
  19746. syntax: "<angle-percentage>{1,2}"
  19747. },
  19748. "color-stop-length": {
  19749. syntax: "<length-percentage>{1,2}"
  19750. },
  19751. "color-stop-list": {
  19752. syntax: "[ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop>"
  19753. },
  19754. combinator: combinator,
  19755. "common-lig-values": {
  19756. syntax: "[ common-ligatures | no-common-ligatures ]"
  19757. },
  19758. "compat-auto": {
  19759. syntax: "searchfield | textarea | push-button | slider-horizontal | checkbox | radio | square-button | menulist | listbox | meter | progress-bar | button"
  19760. },
  19761. "composite-style": {
  19762. syntax: "clear | copy | source-over | source-in | source-out | source-atop | destination-over | destination-in | destination-out | destination-atop | xor"
  19763. },
  19764. "compositing-operator": {
  19765. syntax: "add | subtract | intersect | exclude"
  19766. },
  19767. "compound-selector": {
  19768. syntax: "[ <type-selector>? <subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!"
  19769. },
  19770. "compound-selector-list": {
  19771. syntax: "<compound-selector>#"
  19772. },
  19773. "complex-selector": {
  19774. syntax: "<compound-selector> [ <combinator>? <compound-selector> ]*"
  19775. },
  19776. "complex-selector-list": {
  19777. syntax: "<complex-selector>#"
  19778. },
  19779. "conic-gradient()": {
  19780. syntax: "conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )"
  19781. },
  19782. "contextual-alt-values": {
  19783. syntax: "[ contextual | no-contextual ]"
  19784. },
  19785. "content-distribution": {
  19786. syntax: "space-between | space-around | space-evenly | stretch"
  19787. },
  19788. "content-list": {
  19789. syntax: "[ <string> | contents | <image> | <quote> | <target> | <leader()> ]+"
  19790. },
  19791. "content-position": {
  19792. syntax: "center | start | end | flex-start | flex-end"
  19793. },
  19794. "content-replacement": {
  19795. syntax: "<image>"
  19796. },
  19797. "contrast()": {
  19798. syntax: "contrast( [ <number-percentage> ] )"
  19799. },
  19800. "counter()": {
  19801. syntax: "counter( <custom-ident>, <counter-style>? )"
  19802. },
  19803. "counter-style": {
  19804. syntax: "<counter-style-name> | symbols()"
  19805. },
  19806. "counter-style-name": {
  19807. syntax: "<custom-ident>"
  19808. },
  19809. "counters()": {
  19810. syntax: "counters( <custom-ident>, <string>, <counter-style>? )"
  19811. },
  19812. "cross-fade()": {
  19813. syntax: "cross-fade( <cf-mixing-image> , <cf-final-image>? )"
  19814. },
  19815. "cubic-bezier-timing-function": {
  19816. syntax: "ease | ease-in | ease-out | ease-in-out | cubic-bezier(<number [0,1]>, <number>, <number [0,1]>, <number>)"
  19817. },
  19818. "deprecated-system-color": {
  19819. syntax: "ActiveBorder | ActiveCaption | AppWorkspace | Background | ButtonFace | ButtonHighlight | ButtonShadow | ButtonText | CaptionText | GrayText | Highlight | HighlightText | InactiveBorder | InactiveCaption | InactiveCaptionText | InfoBackground | InfoText | Menu | MenuText | Scrollbar | ThreeDDarkShadow | ThreeDFace | ThreeDHighlight | ThreeDLightShadow | ThreeDShadow | Window | WindowFrame | WindowText"
  19820. },
  19821. "discretionary-lig-values": {
  19822. syntax: "[ discretionary-ligatures | no-discretionary-ligatures ]"
  19823. },
  19824. "display-box": {
  19825. syntax: "contents | none"
  19826. },
  19827. "display-inside": {
  19828. syntax: "flow | flow-root | table | flex | grid | ruby"
  19829. },
  19830. "display-internal": {
  19831. syntax: "table-row-group | table-header-group | table-footer-group | table-row | table-cell | table-column-group | table-column | table-caption | ruby-base | ruby-text | ruby-base-container | ruby-text-container"
  19832. },
  19833. "display-legacy": {
  19834. syntax: "inline-block | inline-list-item | inline-table | inline-flex | inline-grid"
  19835. },
  19836. "display-listitem": {
  19837. syntax: "<display-outside>? && [ flow | flow-root ]? && list-item"
  19838. },
  19839. "display-outside": {
  19840. syntax: "block | inline | run-in"
  19841. },
  19842. "drop-shadow()": {
  19843. syntax: "drop-shadow( <length>{2,3} <color>? )"
  19844. },
  19845. "east-asian-variant-values": {
  19846. syntax: "[ jis78 | jis83 | jis90 | jis04 | simplified | traditional ]"
  19847. },
  19848. "east-asian-width-values": {
  19849. syntax: "[ full-width | proportional-width ]"
  19850. },
  19851. "element()": {
  19852. syntax: "element( <id-selector> )"
  19853. },
  19854. "ellipse()": {
  19855. syntax: "ellipse( [ <shape-radius>{2} ]? [ at <position> ]? )"
  19856. },
  19857. "ending-shape": {
  19858. syntax: "circle | ellipse"
  19859. },
  19860. "env()": {
  19861. syntax: "env( <custom-ident> , <declaration-value>? )"
  19862. },
  19863. "explicit-track-list": {
  19864. syntax: "[ <line-names>? <track-size> ]+ <line-names>?"
  19865. },
  19866. "family-name": {
  19867. syntax: "<string> | <custom-ident>+"
  19868. },
  19869. "feature-tag-value": {
  19870. syntax: "<string> [ <integer> | on | off ]?"
  19871. },
  19872. "feature-type": {
  19873. syntax: "@stylistic | @historical-forms | @styleset | @character-variant | @swash | @ornaments | @annotation"
  19874. },
  19875. "feature-value-block": {
  19876. syntax: "<feature-type> '{' <feature-value-declaration-list> '}'"
  19877. },
  19878. "feature-value-block-list": {
  19879. syntax: "<feature-value-block>+"
  19880. },
  19881. "feature-value-declaration": {
  19882. syntax: "<custom-ident>: <integer>+;"
  19883. },
  19884. "feature-value-declaration-list": {
  19885. syntax: "<feature-value-declaration>"
  19886. },
  19887. "feature-value-name": {
  19888. syntax: "<custom-ident>"
  19889. },
  19890. "fill-rule": {
  19891. syntax: "nonzero | evenodd"
  19892. },
  19893. "filter-function": {
  19894. syntax: "<blur()> | <brightness()> | <contrast()> | <drop-shadow()> | <grayscale()> | <hue-rotate()> | <invert()> | <opacity()> | <saturate()> | <sepia()>"
  19895. },
  19896. "filter-function-list": {
  19897. syntax: "[ <filter-function> | <url> ]+"
  19898. },
  19899. "final-bg-layer": {
  19900. syntax: "<'background-color'> || <bg-image> || <bg-position> [ / <bg-size> ]? || <repeat-style> || <attachment> || <box> || <box>"
  19901. },
  19902. "fit-content()": {
  19903. syntax: "fit-content( [ <length> | <percentage> ] )"
  19904. },
  19905. "fixed-breadth": {
  19906. syntax: "<length-percentage>"
  19907. },
  19908. "fixed-repeat": {
  19909. syntax: "repeat( [ <positive-integer> ] , [ <line-names>? <fixed-size> ]+ <line-names>? )"
  19910. },
  19911. "fixed-size": {
  19912. syntax: "<fixed-breadth> | minmax( <fixed-breadth> , <track-breadth> ) | minmax( <inflexible-breadth> , <fixed-breadth> )"
  19913. },
  19914. "font-stretch-absolute": {
  19915. syntax: "normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | <percentage>"
  19916. },
  19917. "font-variant-css21": {
  19918. syntax: "[ normal | small-caps ]"
  19919. },
  19920. "font-weight-absolute": {
  19921. syntax: "normal | bold | <number [1,1000]>"
  19922. },
  19923. "frequency-percentage": {
  19924. syntax: "<frequency> | <percentage>"
  19925. },
  19926. "general-enclosed": {
  19927. syntax: "[ <function-token> <any-value> ) ] | ( <ident> <any-value> )"
  19928. },
  19929. "generic-family": {
  19930. syntax: "serif | sans-serif | cursive | fantasy | monospace"
  19931. },
  19932. "generic-name": {
  19933. syntax: "serif | sans-serif | cursive | fantasy | monospace"
  19934. },
  19935. "geometry-box": {
  19936. syntax: "<shape-box> | fill-box | stroke-box | view-box"
  19937. },
  19938. gradient: gradient,
  19939. "grayscale()": {
  19940. syntax: "grayscale( <number-percentage> )"
  19941. },
  19942. "grid-line": {
  19943. syntax: "auto | <custom-ident> | [ <integer> && <custom-ident>? ] | [ span && [ <integer> || <custom-ident> ] ]"
  19944. },
  19945. "historical-lig-values": {
  19946. syntax: "[ historical-ligatures | no-historical-ligatures ]"
  19947. },
  19948. "hsl()": {
  19949. syntax: "hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )"
  19950. },
  19951. "hsla()": {
  19952. syntax: "hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )"
  19953. },
  19954. hue: hue,
  19955. "hue-rotate()": {
  19956. syntax: "hue-rotate( <angle> )"
  19957. },
  19958. "id-selector": {
  19959. syntax: "<hash-token>"
  19960. },
  19961. image: image,
  19962. "image()": {
  19963. syntax: "image( <image-tags>? [ <image-src>? , <color>? ]! )"
  19964. },
  19965. "image-set()": {
  19966. syntax: "image-set( <image-set-option># )"
  19967. },
  19968. "image-set-option": {
  19969. syntax: "[ <image> | <string> ] <resolution>"
  19970. },
  19971. "image-src": {
  19972. syntax: "<url> | <string>"
  19973. },
  19974. "image-tags": {
  19975. syntax: "ltr | rtl"
  19976. },
  19977. "inflexible-breadth": {
  19978. syntax: "<length> | <percentage> | min-content | max-content | auto"
  19979. },
  19980. "inset()": {
  19981. syntax: "inset( <length-percentage>{1,4} [ round <'border-radius'> ]? )"
  19982. },
  19983. "invert()": {
  19984. syntax: "invert( <number-percentage> )"
  19985. },
  19986. "keyframes-name": {
  19987. syntax: "<custom-ident> | <string>"
  19988. },
  19989. "keyframe-block": {
  19990. syntax: "<keyframe-selector># {\n <declaration-list>\n}"
  19991. },
  19992. "keyframe-block-list": {
  19993. syntax: "<keyframe-block>+"
  19994. },
  19995. "keyframe-selector": {
  19996. syntax: "from | to | <percentage>"
  19997. },
  19998. "leader()": {
  19999. syntax: "leader( <leader-type> )"
  20000. },
  20001. "leader-type": {
  20002. syntax: "dotted | solid | space | <string>"
  20003. },
  20004. "length-percentage": {
  20005. syntax: "<length> | <percentage>"
  20006. },
  20007. "line-names": {
  20008. syntax: "'[' <custom-ident>* ']'"
  20009. },
  20010. "line-name-list": {
  20011. syntax: "[ <line-names> | <name-repeat> ]+"
  20012. },
  20013. "line-style": {
  20014. syntax: "none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset"
  20015. },
  20016. "line-width": {
  20017. syntax: "<length> | thin | medium | thick"
  20018. },
  20019. "linear-color-hint": {
  20020. syntax: "<length-percentage>"
  20021. },
  20022. "linear-color-stop": {
  20023. syntax: "<color> <color-stop-length>?"
  20024. },
  20025. "linear-gradient()": {
  20026. syntax: "linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )"
  20027. },
  20028. "mask-layer": {
  20029. syntax: "<mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || <geometry-box> || [ <geometry-box> | no-clip ] || <compositing-operator> || <masking-mode>"
  20030. },
  20031. "mask-position": {
  20032. syntax: "[ <length-percentage> | left | center | right ] [ <length-percentage> | top | center | bottom ]?"
  20033. },
  20034. "mask-reference": {
  20035. syntax: "none | <image> | <mask-source>"
  20036. },
  20037. "mask-source": {
  20038. syntax: "<url>"
  20039. },
  20040. "masking-mode": {
  20041. syntax: "alpha | luminance | match-source"
  20042. },
  20043. "matrix()": {
  20044. syntax: "matrix( <number>#{6} )"
  20045. },
  20046. "matrix3d()": {
  20047. syntax: "matrix3d( <number>#{16} )"
  20048. },
  20049. "max()": {
  20050. syntax: "max( <calc-sum># )"
  20051. },
  20052. "media-and": {
  20053. syntax: "<media-in-parens> [ and <media-in-parens> ]+"
  20054. },
  20055. "media-condition": {
  20056. syntax: "<media-not> | <media-and> | <media-or> | <media-in-parens>"
  20057. },
  20058. "media-condition-without-or": {
  20059. syntax: "<media-not> | <media-and> | <media-in-parens>"
  20060. },
  20061. "media-feature": {
  20062. syntax: "( [ <mf-plain> | <mf-boolean> | <mf-range> ] )"
  20063. },
  20064. "media-in-parens": {
  20065. syntax: "( <media-condition> ) | <media-feature> | <general-enclosed>"
  20066. },
  20067. "media-not": {
  20068. syntax: "not <media-in-parens>"
  20069. },
  20070. "media-or": {
  20071. syntax: "<media-in-parens> [ or <media-in-parens> ]+"
  20072. },
  20073. "media-query": {
  20074. syntax: "<media-condition> | [ not | only ]? <media-type> [ and <media-condition-without-or> ]?"
  20075. },
  20076. "media-query-list": {
  20077. syntax: "<media-query>#"
  20078. },
  20079. "media-type": {
  20080. syntax: "<ident>"
  20081. },
  20082. "mf-boolean": {
  20083. syntax: "<mf-name>"
  20084. },
  20085. "mf-name": {
  20086. syntax: "<ident>"
  20087. },
  20088. "mf-plain": {
  20089. syntax: "<mf-name> : <mf-value>"
  20090. },
  20091. "mf-range": {
  20092. syntax: "<mf-name> [ '<' | '>' ]? '='? <mf-value>\n| <mf-value> [ '<' | '>' ]? '='? <mf-name>\n| <mf-value> '<' '='? <mf-name> '<' '='? <mf-value>\n| <mf-value> '>' '='? <mf-name> '>' '='? <mf-value>"
  20093. },
  20094. "mf-value": {
  20095. syntax: "<number> | <dimension> | <ident> | <ratio>"
  20096. },
  20097. "min()": {
  20098. syntax: "min( <calc-sum># )"
  20099. },
  20100. "minmax()": {
  20101. syntax: "minmax( [ <length> | <percentage> | min-content | max-content | auto ] , [ <length> | <percentage> | <flex> | min-content | max-content | auto ] )"
  20102. },
  20103. "named-color": {
  20104. syntax: "transparent | aliceblue | antiquewhite | aqua | aquamarine | azure | beige | bisque | black | blanchedalmond | blue | blueviolet | brown | burlywood | cadetblue | chartreuse | chocolate | coral | cornflowerblue | cornsilk | crimson | cyan | darkblue | darkcyan | darkgoldenrod | darkgray | darkgreen | darkgrey | darkkhaki | darkmagenta | darkolivegreen | darkorange | darkorchid | darkred | darksalmon | darkseagreen | darkslateblue | darkslategray | darkslategrey | darkturquoise | darkviolet | deeppink | deepskyblue | dimgray | dimgrey | dodgerblue | firebrick | floralwhite | forestgreen | fuchsia | gainsboro | ghostwhite | gold | goldenrod | gray | green | greenyellow | grey | honeydew | hotpink | indianred | indigo | ivory | khaki | lavender | lavenderblush | lawngreen | lemonchiffon | lightblue | lightcoral | lightcyan | lightgoldenrodyellow | lightgray | lightgreen | lightgrey | lightpink | lightsalmon | lightseagreen | lightskyblue | lightslategray | lightslategrey | lightsteelblue | lightyellow | lime | limegreen | linen | magenta | maroon | mediumaquamarine | mediumblue | mediumorchid | mediumpurple | mediumseagreen | mediumslateblue | mediumspringgreen | mediumturquoise | mediumvioletred | midnightblue | mintcream | mistyrose | moccasin | navajowhite | navy | oldlace | olive | olivedrab | orange | orangered | orchid | palegoldenrod | palegreen | paleturquoise | palevioletred | papayawhip | peachpuff | peru | pink | plum | powderblue | purple | rebeccapurple | red | rosybrown | royalblue | saddlebrown | salmon | sandybrown | seagreen | seashell | sienna | silver | skyblue | slateblue | slategray | slategrey | snow | springgreen | steelblue | tan | teal | thistle | tomato | turquoise | violet | wheat | white | whitesmoke | yellow | yellowgreen"
  20105. },
  20106. "namespace-prefix": {
  20107. syntax: "<ident>"
  20108. },
  20109. "ns-prefix": {
  20110. syntax: "[ <ident-token> | '*' ]? '|'"
  20111. },
  20112. "number-percentage": {
  20113. syntax: "<number> | <percentage>"
  20114. },
  20115. "numeric-figure-values": {
  20116. syntax: "[ lining-nums | oldstyle-nums ]"
  20117. },
  20118. "numeric-fraction-values": {
  20119. syntax: "[ diagonal-fractions | stacked-fractions ]"
  20120. },
  20121. "numeric-spacing-values": {
  20122. syntax: "[ proportional-nums | tabular-nums ]"
  20123. },
  20124. nth: nth$1,
  20125. "opacity()": {
  20126. syntax: "opacity( [ <number-percentage> ] )"
  20127. },
  20128. "overflow-position": {
  20129. syntax: "unsafe | safe"
  20130. },
  20131. "outline-radius": {
  20132. syntax: "<length> | <percentage>"
  20133. },
  20134. "page-body": {
  20135. syntax: "<declaration>? [ ; <page-body> ]? | <page-margin-box> <page-body>"
  20136. },
  20137. "page-margin-box": {
  20138. syntax: "<page-margin-box-type> '{' <declaration-list> '}'"
  20139. },
  20140. "page-margin-box-type": {
  20141. syntax: "@top-left-corner | @top-left | @top-center | @top-right | @top-right-corner | @bottom-left-corner | @bottom-left | @bottom-center | @bottom-right | @bottom-right-corner | @left-top | @left-middle | @left-bottom | @right-top | @right-middle | @right-bottom"
  20142. },
  20143. "page-selector-list": {
  20144. syntax: "[ <page-selector># ]?"
  20145. },
  20146. "page-selector": {
  20147. syntax: "<pseudo-page>+ | <ident> <pseudo-page>*"
  20148. },
  20149. "path()": {
  20150. syntax: "path( [ <fill-rule>, ]? <string> )"
  20151. },
  20152. "paint()": {
  20153. syntax: "paint( <ident>, <declaration-value>? )"
  20154. },
  20155. "perspective()": {
  20156. syntax: "perspective( <length> )"
  20157. },
  20158. "polygon()": {
  20159. syntax: "polygon( <fill-rule>? , [ <length-percentage> <length-percentage> ]# )"
  20160. },
  20161. position: position,
  20162. "pseudo-class-selector": {
  20163. syntax: "':' <ident-token> | ':' <function-token> <any-value> ')'"
  20164. },
  20165. "pseudo-element-selector": {
  20166. syntax: "':' <pseudo-class-selector>"
  20167. },
  20168. "pseudo-page": {
  20169. syntax: ": [ left | right | first | blank ]"
  20170. },
  20171. quote: quote,
  20172. "radial-gradient()": {
  20173. syntax: "radial-gradient( [ <ending-shape> || <size> ]? [ at <position> ]? , <color-stop-list> )"
  20174. },
  20175. "relative-selector": {
  20176. syntax: "<combinator>? <complex-selector>"
  20177. },
  20178. "relative-selector-list": {
  20179. syntax: "<relative-selector>#"
  20180. },
  20181. "relative-size": {
  20182. syntax: "larger | smaller"
  20183. },
  20184. "repeat-style": {
  20185. syntax: "repeat-x | repeat-y | [ repeat | space | round | no-repeat ]{1,2}"
  20186. },
  20187. "repeating-linear-gradient()": {
  20188. syntax: "repeating-linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )"
  20189. },
  20190. "repeating-radial-gradient()": {
  20191. syntax: "repeating-radial-gradient( [ <ending-shape> || <size> ]? [ at <position> ]? , <color-stop-list> )"
  20192. },
  20193. "rgb()": {
  20194. syntax: "rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )"
  20195. },
  20196. "rgba()": {
  20197. syntax: "rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <number>#{3} , <alpha-value>? )"
  20198. },
  20199. "rotate()": {
  20200. syntax: "rotate( [ <angle> | <zero> ] )"
  20201. },
  20202. "rotate3d()": {
  20203. syntax: "rotate3d( <number> , <number> , <number> , [ <angle> | <zero> ] )"
  20204. },
  20205. "rotateX()": {
  20206. syntax: "rotateX( [ <angle> | <zero> ] )"
  20207. },
  20208. "rotateY()": {
  20209. syntax: "rotateY( [ <angle> | <zero> ] )"
  20210. },
  20211. "rotateZ()": {
  20212. syntax: "rotateZ( [ <angle> | <zero> ] )"
  20213. },
  20214. "saturate()": {
  20215. syntax: "saturate( <number-percentage> )"
  20216. },
  20217. "scale()": {
  20218. syntax: "scale( <number> , <number>? )"
  20219. },
  20220. "scale3d()": {
  20221. syntax: "scale3d( <number> , <number> , <number> )"
  20222. },
  20223. "scaleX()": {
  20224. syntax: "scaleX( <number> )"
  20225. },
  20226. "scaleY()": {
  20227. syntax: "scaleY( <number> )"
  20228. },
  20229. "scaleZ()": {
  20230. syntax: "scaleZ( <number> )"
  20231. },
  20232. "self-position": {
  20233. syntax: "center | start | end | self-start | self-end | flex-start | flex-end"
  20234. },
  20235. "shape-radius": {
  20236. syntax: "<length-percentage> | closest-side | farthest-side"
  20237. },
  20238. "skew()": {
  20239. syntax: "skew( [ <angle> | <zero> ] , [ <angle> | <zero> ]? )"
  20240. },
  20241. "skewX()": {
  20242. syntax: "skewX( [ <angle> | <zero> ] )"
  20243. },
  20244. "skewY()": {
  20245. syntax: "skewY( [ <angle> | <zero> ] )"
  20246. },
  20247. "sepia()": {
  20248. syntax: "sepia( <number-percentage> )"
  20249. },
  20250. shadow: shadow,
  20251. "shadow-t": {
  20252. syntax: "[ <length>{2,3} && <color>? ]"
  20253. },
  20254. shape: shape,
  20255. "shape-box": {
  20256. syntax: "<box> | margin-box"
  20257. },
  20258. "side-or-corner": {
  20259. syntax: "[ left | right ] || [ top | bottom ]"
  20260. },
  20261. "single-animation": {
  20262. syntax: "<time> || <timing-function> || <time> || <single-animation-iteration-count> || <single-animation-direction> || <single-animation-fill-mode> || <single-animation-play-state> || [ none | <keyframes-name> ]"
  20263. },
  20264. "single-animation-direction": {
  20265. syntax: "normal | reverse | alternate | alternate-reverse"
  20266. },
  20267. "single-animation-fill-mode": {
  20268. syntax: "none | forwards | backwards | both"
  20269. },
  20270. "single-animation-iteration-count": {
  20271. syntax: "infinite | <number>"
  20272. },
  20273. "single-animation-play-state": {
  20274. syntax: "running | paused"
  20275. },
  20276. "single-transition": {
  20277. syntax: "[ none | <single-transition-property> ] || <time> || <timing-function> || <time>"
  20278. },
  20279. "single-transition-property": {
  20280. syntax: "all | <custom-ident>"
  20281. },
  20282. size: size,
  20283. "step-position": {
  20284. syntax: "jump-start | jump-end | jump-none | jump-both | start | end"
  20285. },
  20286. "step-timing-function": {
  20287. syntax: "step-start | step-end | steps(<integer>[, <step-position>]?)"
  20288. },
  20289. "subclass-selector": {
  20290. syntax: "<id-selector> | <class-selector> | <attribute-selector> | <pseudo-class-selector>"
  20291. },
  20292. "supports-condition": {
  20293. syntax: "not <supports-in-parens> | <supports-in-parens> [ and <supports-in-parens> ]* | <supports-in-parens> [ or <supports-in-parens> ]*"
  20294. },
  20295. "supports-in-parens": {
  20296. syntax: "( <supports-condition> ) | <supports-feature> | <general-enclosed>"
  20297. },
  20298. "supports-feature": {
  20299. syntax: "<supports-decl> | <supports-selector-fn>"
  20300. },
  20301. "supports-decl": {
  20302. syntax: "( <declaration> )"
  20303. },
  20304. "supports-selector-fn": {
  20305. syntax: "selector( <complex-selector> )"
  20306. },
  20307. symbol: symbol,
  20308. target: target,
  20309. "target-counter()": {
  20310. syntax: "target-counter( [ <string> | <url> ] , <custom-ident> , <counter-style>? )"
  20311. },
  20312. "target-counters()": {
  20313. syntax: "target-counters( [ <string> | <url> ] , <custom-ident> , <string> , <counter-style>? )"
  20314. },
  20315. "target-text()": {
  20316. syntax: "target-text( [ <string> | <url> ] , [ content | before | after | first-letter ]? )"
  20317. },
  20318. "time-percentage": {
  20319. syntax: "<time> | <percentage>"
  20320. },
  20321. "timing-function": {
  20322. syntax: "linear | <cubic-bezier-timing-function> | <step-timing-function>"
  20323. },
  20324. "track-breadth": {
  20325. syntax: "<length-percentage> | <flex> | min-content | max-content | auto"
  20326. },
  20327. "track-list": {
  20328. syntax: "[ <line-names>? [ <track-size> | <track-repeat> ] ]+ <line-names>?"
  20329. },
  20330. "track-repeat": {
  20331. syntax: "repeat( [ <positive-integer> ] , [ <line-names>? <track-size> ]+ <line-names>? )"
  20332. },
  20333. "track-size": {
  20334. syntax: "<track-breadth> | minmax( <inflexible-breadth> , <track-breadth> ) | fit-content( [ <length> | <percentage> ] )"
  20335. },
  20336. "transform-function": {
  20337. syntax: "<matrix()> | <translate()> | <translateX()> | <translateY()> | <scale()> | <scaleX()> | <scaleY()> | <rotate()> | <skew()> | <skewX()> | <skewY()> | <matrix3d()> | <translate3d()> | <translateZ()> | <scale3d()> | <scaleZ()> | <rotate3d()> | <rotateX()> | <rotateY()> | <rotateZ()> | <perspective()>"
  20338. },
  20339. "transform-list": {
  20340. syntax: "<transform-function>+"
  20341. },
  20342. "translate()": {
  20343. syntax: "translate( <length-percentage> , <length-percentage>? )"
  20344. },
  20345. "translate3d()": {
  20346. syntax: "translate3d( <length-percentage> , <length-percentage> , <length> )"
  20347. },
  20348. "translateX()": {
  20349. syntax: "translateX( <length-percentage> )"
  20350. },
  20351. "translateY()": {
  20352. syntax: "translateY( <length-percentage> )"
  20353. },
  20354. "translateZ()": {
  20355. syntax: "translateZ( <length> )"
  20356. },
  20357. "type-or-unit": {
  20358. syntax: "string | color | url | integer | number | length | angle | time | frequency | cap | ch | em | ex | ic | lh | rlh | rem | vb | vi | vw | vh | vmin | vmax | mm | Q | cm | in | pt | pc | px | deg | grad | rad | turn | ms | s | Hz | kHz | %"
  20359. },
  20360. "type-selector": {
  20361. syntax: "<wq-name> | <ns-prefix>? '*'"
  20362. },
  20363. "var()": {
  20364. syntax: "var( <custom-property-name> , <declaration-value>? )"
  20365. },
  20366. "viewport-length": {
  20367. syntax: "auto | <length-percentage>"
  20368. },
  20369. "wq-name": {
  20370. syntax: "<ns-prefix>? <ident-token>"
  20371. }
  20372. };
  20373. var atrules = {
  20374. charset: {
  20375. prelude: "<string>"
  20376. },
  20377. "font-face": {
  20378. descriptors: {
  20379. "unicode-range": {
  20380. comment: "replaces <unicode-range>, an old production name",
  20381. syntax: "<urange>#"
  20382. }
  20383. }
  20384. }
  20385. };
  20386. var properties = {
  20387. "-moz-background-clip": {
  20388. comment: "deprecated syntax in old Firefox, https://developer.mozilla.org/en/docs/Web/CSS/background-clip",
  20389. syntax: "padding | border"
  20390. },
  20391. "-moz-border-radius-bottomleft": {
  20392. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-left-radius",
  20393. syntax: "<'border-bottom-left-radius'>"
  20394. },
  20395. "-moz-border-radius-bottomright": {
  20396. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-right-radius",
  20397. syntax: "<'border-bottom-right-radius'>"
  20398. },
  20399. "-moz-border-radius-topleft": {
  20400. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-top-left-radius",
  20401. syntax: "<'border-top-left-radius'>"
  20402. },
  20403. "-moz-border-radius-topright": {
  20404. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-right-radius",
  20405. syntax: "<'border-bottom-right-radius'>"
  20406. },
  20407. "-moz-control-character-visibility": {
  20408. comment: "firefox specific keywords, https://bugzilla.mozilla.org/show_bug.cgi?id=947588",
  20409. syntax: "visible | hidden"
  20410. },
  20411. "-moz-osx-font-smoothing": {
  20412. comment: "misssed old syntax https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth",
  20413. syntax: "auto | grayscale"
  20414. },
  20415. "-moz-user-select": {
  20416. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/user-select",
  20417. syntax: "none | text | all | -moz-none"
  20418. },
  20419. "-ms-flex-align": {
  20420. comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-align",
  20421. syntax: "start | end | center | baseline | stretch"
  20422. },
  20423. "-ms-flex-item-align": {
  20424. comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-align",
  20425. syntax: "auto | start | end | center | baseline | stretch"
  20426. },
  20427. "-ms-flex-line-pack": {
  20428. comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-line-pack",
  20429. syntax: "start | end | center | justify | distribute | stretch"
  20430. },
  20431. "-ms-flex-negative": {
  20432. comment: "misssed old syntax implemented in IE; TODO: find references for comfirmation",
  20433. syntax: "<'flex-shrink'>"
  20434. },
  20435. "-ms-flex-pack": {
  20436. comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-pack",
  20437. syntax: "start | end | center | justify | distribute"
  20438. },
  20439. "-ms-flex-order": {
  20440. comment: "misssed old syntax implemented in IE; https://msdn.microsoft.com/en-us/library/jj127303(v=vs.85).aspx",
  20441. syntax: "<integer>"
  20442. },
  20443. "-ms-flex-positive": {
  20444. comment: "misssed old syntax implemented in IE; TODO: find references for comfirmation",
  20445. syntax: "<'flex-grow'>"
  20446. },
  20447. "-ms-flex-preferred-size": {
  20448. comment: "misssed old syntax implemented in IE; TODO: find references for comfirmation",
  20449. syntax: "<'flex-basis'>"
  20450. },
  20451. "-ms-interpolation-mode": {
  20452. comment: "https://msdn.microsoft.com/en-us/library/ff521095(v=vs.85).aspx",
  20453. syntax: "nearest-neighbor | bicubic"
  20454. },
  20455. "-ms-grid-column-align": {
  20456. comment: "add this property first since it uses as fallback for flexbox, https://msdn.microsoft.com/en-us/library/windows/apps/hh466338.aspx",
  20457. syntax: "start | end | center | stretch"
  20458. },
  20459. "-ms-grid-row-align": {
  20460. comment: "add this property first since it uses as fallback for flexbox, https://msdn.microsoft.com/en-us/library/windows/apps/hh466348.aspx",
  20461. syntax: "start | end | center | stretch"
  20462. },
  20463. "-ms-hyphenate-limit-last": {
  20464. comment: "misssed old syntax implemented in IE; https://www.w3.org/TR/css-text-4/#hyphenate-line-limits",
  20465. syntax: "none | always | column | page | spread"
  20466. },
  20467. "-webkit-appearance": {
  20468. comment: "webkit specific keywords",
  20469. references: [
  20470. "http://css-infos.net/property/-webkit-appearance"
  20471. ],
  20472. syntax: "none | button | button-bevel | caps-lock-indicator | caret | checkbox | default-button | inner-spin-button | listbox | listitem | media-controls-background | media-controls-fullscreen-background | media-current-time-display | media-enter-fullscreen-button | media-exit-fullscreen-button | media-fullscreen-button | media-mute-button | media-overlay-play-button | media-play-button | media-seek-back-button | media-seek-forward-button | media-slider | media-sliderthumb | media-time-remaining-display | media-toggle-closed-captions-button | media-volume-slider | media-volume-slider-container | media-volume-sliderthumb | menulist | menulist-button | menulist-text | menulist-textfield | meter | progress-bar | progress-bar-value | push-button | radio | scrollbarbutton-down | scrollbarbutton-left | scrollbarbutton-right | scrollbarbutton-up | scrollbargripper-horizontal | scrollbargripper-vertical | scrollbarthumb-horizontal | scrollbarthumb-vertical | scrollbartrack-horizontal | scrollbartrack-vertical | searchfield | searchfield-cancel-button | searchfield-decoration | searchfield-results-button | searchfield-results-decoration | slider-horizontal | slider-vertical | sliderthumb-horizontal | sliderthumb-vertical | square-button | textarea | textfield | -apple-pay-button"
  20473. },
  20474. "-webkit-background-clip": {
  20475. comment: "https://developer.mozilla.org/en/docs/Web/CSS/background-clip",
  20476. syntax: "[ <box> | border | padding | content | text ]#"
  20477. },
  20478. "-webkit-column-break-after": {
  20479. comment: "added, http://help.dottoro.com/lcrthhhv.php",
  20480. syntax: "always | auto | avoid"
  20481. },
  20482. "-webkit-column-break-before": {
  20483. comment: "added, http://help.dottoro.com/lcxquvkf.php",
  20484. syntax: "always | auto | avoid"
  20485. },
  20486. "-webkit-column-break-inside": {
  20487. comment: "added, http://help.dottoro.com/lclhnthl.php",
  20488. syntax: "always | auto | avoid"
  20489. },
  20490. "-webkit-font-smoothing": {
  20491. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth",
  20492. syntax: "auto | none | antialiased | subpixel-antialiased"
  20493. },
  20494. "-webkit-mask-box-image": {
  20495. comment: "missed; https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-mask-box-image",
  20496. syntax: "[ <url> | <gradient> | none ] [ <length-percentage>{4} <-webkit-mask-box-repeat>{2} ]?"
  20497. },
  20498. "-webkit-print-color-adjust": {
  20499. comment: "missed",
  20500. references: [
  20501. "https://developer.mozilla.org/en/docs/Web/CSS/-webkit-print-color-adjust"
  20502. ],
  20503. syntax: "economy | exact"
  20504. },
  20505. "-webkit-text-security": {
  20506. comment: "missed; http://help.dottoro.com/lcbkewgt.php",
  20507. syntax: "none | circle | disc | square"
  20508. },
  20509. "-webkit-user-drag": {
  20510. comment: "missed; http://help.dottoro.com/lcbixvwm.php",
  20511. syntax: "none | element | auto"
  20512. },
  20513. "-webkit-user-select": {
  20514. comment: "auto is supported by old webkit, https://developer.mozilla.org/en-US/docs/Web/CSS/user-select",
  20515. syntax: "auto | none | text | all"
  20516. },
  20517. "alignment-baseline": {
  20518. comment: "added SVG property",
  20519. references: [
  20520. "https://www.w3.org/TR/SVG/text.html#AlignmentBaselineProperty"
  20521. ],
  20522. syntax: "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical"
  20523. },
  20524. "baseline-shift": {
  20525. comment: "added SVG property",
  20526. references: [
  20527. "https://www.w3.org/TR/SVG/text.html#BaselineShiftProperty"
  20528. ],
  20529. syntax: "baseline | sub | super | <svg-length>"
  20530. },
  20531. behavior: {
  20532. comment: "added old IE property https://msdn.microsoft.com/en-us/library/ms530723(v=vs.85).aspx",
  20533. syntax: "<url>+"
  20534. },
  20535. "clip-rule": {
  20536. comment: "added SVG property",
  20537. references: [
  20538. "https://www.w3.org/TR/SVG/masking.html#ClipRuleProperty"
  20539. ],
  20540. syntax: "nonzero | evenodd"
  20541. },
  20542. cue: {
  20543. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20544. syntax: "<'cue-before'> <'cue-after'>?"
  20545. },
  20546. "cue-after": {
  20547. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20548. syntax: "<url> <decibel>? | none"
  20549. },
  20550. "cue-before": {
  20551. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20552. syntax: "<url> <decibel>? | none"
  20553. },
  20554. cursor: {
  20555. comment: "added legacy keywords: hand, -webkit-grab. -webkit-grabbing, -webkit-zoom-in, -webkit-zoom-out, -moz-grab, -moz-grabbing, -moz-zoom-in, -moz-zoom-out",
  20556. references: [
  20557. "https://www.sitepoint.com/css3-cursor-styles/"
  20558. ],
  20559. syntax: "[ [ <url> [ <x> <y> ]? , ]* [ auto | default | none | context-menu | help | pointer | progress | wait | cell | crosshair | text | vertical-text | alias | copy | move | no-drop | not-allowed | e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out | grab | grabbing | hand | -webkit-grab | -webkit-grabbing | -webkit-zoom-in | -webkit-zoom-out | -moz-grab | -moz-grabbing | -moz-zoom-in | -moz-zoom-out ] ]"
  20560. },
  20561. display: {
  20562. comment: "extended with -ms-flexbox",
  20563. syntax: "| <-non-standard-display>"
  20564. },
  20565. position: {
  20566. comment: "extended with -webkit-sticky",
  20567. syntax: "| -webkit-sticky"
  20568. },
  20569. "dominant-baseline": {
  20570. comment: "added SVG property",
  20571. references: [
  20572. "https://www.w3.org/TR/SVG/text.html#DominantBaselineProperty"
  20573. ],
  20574. syntax: "auto | use-script | no-change | reset-size | ideographic | alphabetic | hanging | mathematical | central | middle | text-after-edge | text-before-edge"
  20575. },
  20576. "image-rendering": {
  20577. comment: "extended with <-non-standard-image-rendering>, added SVG keywords optimizeSpeed and optimizeQuality",
  20578. references: [
  20579. "https://developer.mozilla.org/en/docs/Web/CSS/image-rendering",
  20580. "https://www.w3.org/TR/SVG/painting.html#ImageRenderingProperty"
  20581. ],
  20582. syntax: "| optimizeSpeed | optimizeQuality | <-non-standard-image-rendering>"
  20583. },
  20584. fill: {
  20585. comment: "added SVG property",
  20586. references: [
  20587. "https://www.w3.org/TR/SVG/painting.html#FillProperty"
  20588. ],
  20589. syntax: "<paint>"
  20590. },
  20591. "fill-opacity": {
  20592. comment: "added SVG property",
  20593. references: [
  20594. "https://www.w3.org/TR/SVG/painting.html#FillProperty"
  20595. ],
  20596. syntax: "<number-zero-one>"
  20597. },
  20598. "fill-rule": {
  20599. comment: "added SVG property",
  20600. references: [
  20601. "https://www.w3.org/TR/SVG/painting.html#FillProperty"
  20602. ],
  20603. syntax: "nonzero | evenodd"
  20604. },
  20605. filter: {
  20606. comment: "extend with IE legacy syntaxes",
  20607. syntax: "| <-ms-filter-function-list>"
  20608. },
  20609. "glyph-orientation-horizontal": {
  20610. comment: "added SVG property",
  20611. references: [
  20612. "https://www.w3.org/TR/SVG/text.html#GlyphOrientationHorizontalProperty"
  20613. ],
  20614. syntax: "<angle>"
  20615. },
  20616. "glyph-orientation-vertical": {
  20617. comment: "added SVG property",
  20618. references: [
  20619. "https://www.w3.org/TR/SVG/text.html#GlyphOrientationVerticalProperty"
  20620. ],
  20621. syntax: "<angle>"
  20622. },
  20623. kerning: {
  20624. comment: "added SVG property",
  20625. references: [
  20626. "https://www.w3.org/TR/SVG/text.html#KerningProperty"
  20627. ],
  20628. syntax: "auto | <svg-length>"
  20629. },
  20630. "letter-spacing": {
  20631. comment: "fix syntax <length> -> <length-percentage>",
  20632. references: [
  20633. "https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/letter-spacing"
  20634. ],
  20635. syntax: "normal | <length-percentage>"
  20636. },
  20637. marker: {
  20638. comment: "added SVG property",
  20639. references: [
  20640. "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
  20641. ],
  20642. syntax: "none | <url>"
  20643. },
  20644. "marker-end": {
  20645. comment: "added SVG property",
  20646. references: [
  20647. "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
  20648. ],
  20649. syntax: "none | <url>"
  20650. },
  20651. "marker-mid": {
  20652. comment: "added SVG property",
  20653. references: [
  20654. "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
  20655. ],
  20656. syntax: "none | <url>"
  20657. },
  20658. "marker-start": {
  20659. comment: "added SVG property",
  20660. references: [
  20661. "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
  20662. ],
  20663. syntax: "none | <url>"
  20664. },
  20665. "max-width": {
  20666. comment: "fix auto -> none (https://github.com/mdn/data/pull/431); extend by non-standard width keywords https://developer.mozilla.org/en-US/docs/Web/CSS/max-width",
  20667. syntax: "none | <length-percentage> | min-content | max-content | fit-content(<length-percentage>) | <-non-standard-width>"
  20668. },
  20669. width: {
  20670. comment: "per spec fit-content should be a function, however browsers are supporting it as a keyword (https://github.com/csstree/stylelint-validator/issues/29)",
  20671. syntax: "| fit-content | -moz-fit-content | -webkit-fit-content"
  20672. },
  20673. "min-width": {
  20674. comment: "extend by non-standard width keywords https://developer.mozilla.org/en-US/docs/Web/CSS/width",
  20675. syntax: "auto | <length-percentage> | min-content | max-content | fit-content(<length-percentage>) | <-non-standard-width>"
  20676. },
  20677. overflow: {
  20678. comment: "extend by vendor keywords https://developer.mozilla.org/en-US/docs/Web/CSS/overflow",
  20679. syntax: "| <-non-standard-overflow>"
  20680. },
  20681. pause: {
  20682. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20683. syntax: "<'pause-before'> <'pause-after'>?"
  20684. },
  20685. "pause-after": {
  20686. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20687. syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
  20688. },
  20689. "pause-before": {
  20690. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20691. syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
  20692. },
  20693. rest: {
  20694. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20695. syntax: "<'rest-before'> <'rest-after'>?"
  20696. },
  20697. "rest-after": {
  20698. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20699. syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
  20700. },
  20701. "rest-before": {
  20702. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20703. syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
  20704. },
  20705. "shape-rendering": {
  20706. comment: "added SVG property",
  20707. references: [
  20708. "https://www.w3.org/TR/SVG/painting.html#ShapeRenderingPropert"
  20709. ],
  20710. syntax: "auto | optimizeSpeed | crispEdges | geometricPrecision"
  20711. },
  20712. src: {
  20713. comment: "added @font-face's src property https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src",
  20714. syntax: "[ <url> [ format( <string># ) ]? | local( <family-name> ) ]#"
  20715. },
  20716. speak: {
  20717. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20718. syntax: "auto | none | normal"
  20719. },
  20720. "speak-as": {
  20721. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20722. syntax: "normal | spell-out || digits || [ literal-punctuation | no-punctuation ]"
  20723. },
  20724. stroke: {
  20725. comment: "added SVG property",
  20726. references: [
  20727. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  20728. ],
  20729. syntax: "<paint>"
  20730. },
  20731. "stroke-dasharray": {
  20732. comment: "added SVG property; a list of comma and/or white space separated <length>s and <percentage>s",
  20733. references: [
  20734. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  20735. ],
  20736. syntax: "none | [ <svg-length>+ ]#"
  20737. },
  20738. "stroke-dashoffset": {
  20739. comment: "added SVG property",
  20740. references: [
  20741. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  20742. ],
  20743. syntax: "<svg-length>"
  20744. },
  20745. "stroke-linecap": {
  20746. comment: "added SVG property",
  20747. references: [
  20748. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  20749. ],
  20750. syntax: "butt | round | square"
  20751. },
  20752. "stroke-linejoin": {
  20753. comment: "added SVG property",
  20754. references: [
  20755. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  20756. ],
  20757. syntax: "miter | round | bevel"
  20758. },
  20759. "stroke-miterlimit": {
  20760. comment: "added SVG property (<miterlimit> = <number-one-or-greater>) ",
  20761. references: [
  20762. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  20763. ],
  20764. syntax: "<number-one-or-greater>"
  20765. },
  20766. "stroke-opacity": {
  20767. comment: "added SVG property",
  20768. references: [
  20769. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  20770. ],
  20771. syntax: "<number-zero-one>"
  20772. },
  20773. "stroke-width": {
  20774. comment: "added SVG property",
  20775. references: [
  20776. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  20777. ],
  20778. syntax: "<svg-length>"
  20779. },
  20780. "text-anchor": {
  20781. comment: "added SVG property",
  20782. references: [
  20783. "https://www.w3.org/TR/SVG/text.html#TextAlignmentProperties"
  20784. ],
  20785. syntax: "start | middle | end"
  20786. },
  20787. "unicode-bidi": {
  20788. comment: "added prefixed keywords https://developer.mozilla.org/en-US/docs/Web/CSS/unicode-bidi",
  20789. syntax: "| -moz-isolate | -moz-isolate-override | -moz-plaintext | -webkit-isolate | -webkit-isolate-override | -webkit-plaintext"
  20790. },
  20791. "unicode-range": {
  20792. comment: "added missed property https://developer.mozilla.org/en-US/docs/Web/CSS/%40font-face/unicode-range",
  20793. syntax: "<urange>#"
  20794. },
  20795. "voice-balance": {
  20796. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20797. syntax: "<number> | left | center | right | leftwards | rightwards"
  20798. },
  20799. "voice-duration": {
  20800. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20801. syntax: "auto | <time>"
  20802. },
  20803. "voice-family": {
  20804. comment: "<name> -> <family-name>, https://www.w3.org/TR/css3-speech/#property-index",
  20805. syntax: "[ [ <family-name> | <generic-voice> ] , ]* [ <family-name> | <generic-voice> ] | preserve"
  20806. },
  20807. "voice-pitch": {
  20808. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20809. syntax: "<frequency> && absolute | [ [ x-low | low | medium | high | x-high ] || [ <frequency> | <semitones> | <percentage> ] ]"
  20810. },
  20811. "voice-range": {
  20812. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20813. syntax: "<frequency> && absolute | [ [ x-low | low | medium | high | x-high ] || [ <frequency> | <semitones> | <percentage> ] ]"
  20814. },
  20815. "voice-rate": {
  20816. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20817. syntax: "[ normal | x-slow | slow | medium | fast | x-fast ] || <percentage>"
  20818. },
  20819. "voice-stress": {
  20820. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20821. syntax: "normal | strong | moderate | none | reduced"
  20822. },
  20823. "voice-volume": {
  20824. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20825. syntax: "silent | [ [ x-soft | soft | medium | loud | x-loud ] || <decibel> ]"
  20826. },
  20827. "writing-mode": {
  20828. comment: "extend with SVG keywords",
  20829. syntax: "| <svg-writing-mode>"
  20830. }
  20831. };
  20832. var syntaxes = {
  20833. "-legacy-gradient": {
  20834. comment: "added collection of legacy gradient syntaxes",
  20835. syntax: "<-webkit-gradient()> | <-legacy-linear-gradient> | <-legacy-repeating-linear-gradient> | <-legacy-radial-gradient> | <-legacy-repeating-radial-gradient>"
  20836. },
  20837. "-legacy-linear-gradient": {
  20838. comment: "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
  20839. syntax: "-moz-linear-gradient( <-legacy-linear-gradient-arguments> ) | -webkit-linear-gradient( <-legacy-linear-gradient-arguments> ) | -o-linear-gradient( <-legacy-linear-gradient-arguments> )"
  20840. },
  20841. "-legacy-repeating-linear-gradient": {
  20842. comment: "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
  20843. syntax: "-moz-repeating-linear-gradient( <-legacy-linear-gradient-arguments> ) | -webkit-repeating-linear-gradient( <-legacy-linear-gradient-arguments> ) | -o-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )"
  20844. },
  20845. "-legacy-linear-gradient-arguments": {
  20846. comment: "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
  20847. syntax: "[ <angle> | <side-or-corner> ]? , <color-stop-list>"
  20848. },
  20849. "-legacy-radial-gradient": {
  20850. comment: "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
  20851. syntax: "-moz-radial-gradient( <-legacy-radial-gradient-arguments> ) | -webkit-radial-gradient( <-legacy-radial-gradient-arguments> ) | -o-radial-gradient( <-legacy-radial-gradient-arguments> )"
  20852. },
  20853. "-legacy-repeating-radial-gradient": {
  20854. comment: "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
  20855. syntax: "-moz-repeating-radial-gradient( <-legacy-radial-gradient-arguments> ) | -webkit-repeating-radial-gradient( <-legacy-radial-gradient-arguments> ) | -o-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )"
  20856. },
  20857. "-legacy-radial-gradient-arguments": {
  20858. comment: "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
  20859. syntax: "[ <position> , ]? [ [ [ <-legacy-radial-gradient-shape> || <-legacy-radial-gradient-size> ] | [ <length> | <percentage> ]{2} ] , ]? <color-stop-list>"
  20860. },
  20861. "-legacy-radial-gradient-size": {
  20862. comment: "before a standard it contains 2 extra keywords (`contain` and `cover`) https://www.w3.org/TR/2011/WD-css3-images-20110908/#ltsize",
  20863. syntax: "closest-side | closest-corner | farthest-side | farthest-corner | contain | cover"
  20864. },
  20865. "-legacy-radial-gradient-shape": {
  20866. comment: "define to double sure it doesn't extends in future https://www.w3.org/TR/2011/WD-css3-images-20110908/#ltshape",
  20867. syntax: "circle | ellipse"
  20868. },
  20869. "-non-standard-font": {
  20870. comment: "non standard fonts",
  20871. references: [
  20872. "https://webkit.org/blog/3709/using-the-system-font-in-web-content/"
  20873. ],
  20874. syntax: "-apple-system-body | -apple-system-headline | -apple-system-subheadline | -apple-system-caption1 | -apple-system-caption2 | -apple-system-footnote | -apple-system-short-body | -apple-system-short-headline | -apple-system-short-subheadline | -apple-system-short-caption1 | -apple-system-short-footnote | -apple-system-tall-body"
  20875. },
  20876. "-non-standard-color": {
  20877. comment: "non standard colors",
  20878. references: [
  20879. "http://cssdot.ru/%D0%A1%D0%BF%D1%80%D0%B0%D0%B2%D0%BE%D1%87%D0%BD%D0%B8%D0%BA_CSS/color-i305.html",
  20880. "https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Mozilla_Color_Preference_Extensions"
  20881. ],
  20882. syntax: "-moz-ButtonDefault | -moz-ButtonHoverFace | -moz-ButtonHoverText | -moz-CellHighlight | -moz-CellHighlightText | -moz-Combobox | -moz-ComboboxText | -moz-Dialog | -moz-DialogText | -moz-dragtargetzone | -moz-EvenTreeRow | -moz-Field | -moz-FieldText | -moz-html-CellHighlight | -moz-html-CellHighlightText | -moz-mac-accentdarkestshadow | -moz-mac-accentdarkshadow | -moz-mac-accentface | -moz-mac-accentlightesthighlight | -moz-mac-accentlightshadow | -moz-mac-accentregularhighlight | -moz-mac-accentregularshadow | -moz-mac-chrome-active | -moz-mac-chrome-inactive | -moz-mac-focusring | -moz-mac-menuselect | -moz-mac-menushadow | -moz-mac-menutextselect | -moz-MenuHover | -moz-MenuHoverText | -moz-MenuBarText | -moz-MenuBarHoverText | -moz-nativehyperlinktext | -moz-OddTreeRow | -moz-win-communicationstext | -moz-win-mediatext | -moz-activehyperlinktext | -moz-default-background-color | -moz-default-color | -moz-hyperlinktext | -moz-visitedhyperlinktext | -webkit-activelink | -webkit-focus-ring-color | -webkit-link | -webkit-text"
  20883. },
  20884. "-non-standard-image-rendering": {
  20885. comment: "non-standard keywords http://phrogz.net/tmp/canvas_image_zoom.html",
  20886. syntax: "optimize-contrast | -moz-crisp-edges | -o-crisp-edges | -webkit-optimize-contrast"
  20887. },
  20888. "-non-standard-overflow": {
  20889. comment: "non-standard keywords https://developer.mozilla.org/en-US/docs/Web/CSS/overflow",
  20890. syntax: "-moz-scrollbars-none | -moz-scrollbars-horizontal | -moz-scrollbars-vertical | -moz-hidden-unscrollable"
  20891. },
  20892. "-non-standard-width": {
  20893. comment: "non-standard keywords https://developer.mozilla.org/en-US/docs/Web/CSS/width",
  20894. syntax: "fill-available | min-intrinsic | intrinsic | -moz-available | -moz-fit-content | -moz-min-content | -moz-max-content | -webkit-min-content | -webkit-max-content"
  20895. },
  20896. "-webkit-gradient()": {
  20897. comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/ - TODO: simplify when after match algorithm improvement ( [, point, radius | , point] -> [, radius]? , point )",
  20898. syntax: "-webkit-gradient( <-webkit-gradient-type>, <-webkit-gradient-point> [, <-webkit-gradient-point> | , <-webkit-gradient-radius>, <-webkit-gradient-point> ] [, <-webkit-gradient-radius>]? [, <-webkit-gradient-color-stop>]* )"
  20899. },
  20900. "-webkit-gradient-color-stop": {
  20901. comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
  20902. syntax: "from( <color> ) | color-stop( [ <number-zero-one> | <percentage> ] , <color> ) | to( <color> )"
  20903. },
  20904. "-webkit-gradient-point": {
  20905. comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
  20906. syntax: "[ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]"
  20907. },
  20908. "-webkit-gradient-radius": {
  20909. comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
  20910. syntax: "<length> | <percentage>"
  20911. },
  20912. "-webkit-gradient-type": {
  20913. comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
  20914. syntax: "linear | radial"
  20915. },
  20916. "-webkit-mask-box-repeat": {
  20917. comment: "missed; https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-mask-box-image",
  20918. syntax: "repeat | stretch | round"
  20919. },
  20920. "-webkit-mask-clip-style": {
  20921. comment: "missed; there is no enough information about `-webkit-mask-clip` property, but looks like all those keywords are working",
  20922. syntax: "border | border-box | padding | padding-box | content | content-box | text"
  20923. },
  20924. "-ms-filter-function-list": {
  20925. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
  20926. syntax: "<-ms-filter-function>+"
  20927. },
  20928. "-ms-filter-function": {
  20929. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
  20930. syntax: "<-ms-filter-function-progid> | <-ms-filter-function-legacy>"
  20931. },
  20932. "-ms-filter-function-progid": {
  20933. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
  20934. syntax: "'progid:' [ <ident-token> '.' ]* [ <ident-token> | <function-token> <any-value>? ) ]"
  20935. },
  20936. "-ms-filter-function-legacy": {
  20937. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
  20938. syntax: "<ident-token> | <function-token> <any-value>? )"
  20939. },
  20940. "-ms-filter": {
  20941. syntax: "<string>"
  20942. },
  20943. age: {
  20944. comment: "https://www.w3.org/TR/css3-speech/#voice-family",
  20945. syntax: "child | young | old"
  20946. },
  20947. "attr-name": {
  20948. syntax: "<wq-name>"
  20949. },
  20950. "attr-fallback": {
  20951. syntax: "<any-value>"
  20952. },
  20953. "border-radius": {
  20954. comment: "missed, https://drafts.csswg.org/css-backgrounds-3/#the-border-radius",
  20955. syntax: "<length-percentage>{1,2}"
  20956. },
  20957. bottom: {
  20958. comment: "missed; not sure we should add it, but no others except `shape` is using it so it's ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect",
  20959. syntax: "<length> | auto"
  20960. },
  20961. "content-list": {
  20962. comment: "missed -> https://drafts.csswg.org/css-content/#typedef-content-list (document-url, <target> and leader() is omitted util stabilization)",
  20963. syntax: "[ <string> | contents | <image> | <quote> | <target> | <leader()> | <attr()> | counter( <ident>, <'list-style-type'>? ) ]+"
  20964. },
  20965. "element()": {
  20966. comment: "https://drafts.csswg.org/css-gcpm/#element-syntax & https://drafts.csswg.org/css-images-4/#element-notation",
  20967. syntax: "element( <custom-ident> , [ first | start | last | first-except ]? ) | element( <id-selector> )"
  20968. },
  20969. "generic-voice": {
  20970. comment: "https://www.w3.org/TR/css3-speech/#voice-family",
  20971. syntax: "[ <age>? <gender> <integer>? ]"
  20972. },
  20973. gender: {
  20974. comment: "https://www.w3.org/TR/css3-speech/#voice-family",
  20975. syntax: "male | female | neutral"
  20976. },
  20977. "generic-family": {
  20978. comment: "added -apple-system",
  20979. references: [
  20980. "https://webkit.org/blog/3709/using-the-system-font-in-web-content/"
  20981. ],
  20982. syntax: "| -apple-system"
  20983. },
  20984. gradient: {
  20985. comment: "added legacy syntaxes support",
  20986. syntax: "| <-legacy-gradient>"
  20987. },
  20988. left: {
  20989. comment: "missed; not sure we should add it, but no others except `shape` is using it so it's ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect",
  20990. syntax: "<length> | auto"
  20991. },
  20992. "mask-image": {
  20993. comment: "missed; https://drafts.fxtf.org/css-masking-1/#the-mask-image",
  20994. syntax: "<mask-reference>#"
  20995. },
  20996. "name-repeat": {
  20997. comment: "missed, and looks like obsolete, keep it as is since other property syntaxes should be changed too; https://www.w3.org/TR/2015/WD-css-grid-1-20150917/#typedef-name-repeat",
  20998. syntax: "repeat( [ <positive-integer> | auto-fill ], <line-names>+)"
  20999. },
  21000. "named-color": {
  21001. comment: "added non standard color names",
  21002. syntax: "| <-non-standard-color>"
  21003. },
  21004. paint: {
  21005. comment: "used by SVG https://www.w3.org/TR/SVG/painting.html#SpecifyingPaint",
  21006. syntax: "none | <color> | <url> [ none | <color> ]? | context-fill | context-stroke"
  21007. },
  21008. "page-size": {
  21009. comment: "https://www.w3.org/TR/css-page-3/#typedef-page-size-page-size",
  21010. syntax: "A5 | A4 | A3 | B5 | B4 | JIS-B5 | JIS-B4 | letter | legal | ledger"
  21011. },
  21012. ratio: {
  21013. comment: "missed, https://drafts.csswg.org/mediaqueries-4/#typedef-ratio",
  21014. syntax: "<integer> / <integer>"
  21015. },
  21016. right: {
  21017. comment: "missed; not sure we should add it, but no others except `shape` is using it so it's ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect",
  21018. syntax: "<length> | auto"
  21019. },
  21020. shape: {
  21021. comment: "missed spaces in function body and add backwards compatible syntax",
  21022. syntax: "rect( <top>, <right>, <bottom>, <left> ) | rect( <top> <right> <bottom> <left> )"
  21023. },
  21024. "svg-length": {
  21025. comment: "All coordinates and lengths in SVG can be specified with or without a unit identifier",
  21026. references: [
  21027. "https://www.w3.org/TR/SVG11/coords.html#Units"
  21028. ],
  21029. syntax: "<percentage> | <length> | <number>"
  21030. },
  21031. "svg-writing-mode": {
  21032. comment: "SVG specific keywords (deprecated for CSS)",
  21033. references: [
  21034. "https://developer.mozilla.org/en/docs/Web/CSS/writing-mode",
  21035. "https://www.w3.org/TR/SVG/text.html#WritingModeProperty"
  21036. ],
  21037. syntax: "lr-tb | rl-tb | tb-rl | lr | rl | tb"
  21038. },
  21039. top: {
  21040. comment: "missed; not sure we should add it, but no others except `shape` is using it so it's ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect",
  21041. syntax: "<length> | auto"
  21042. },
  21043. "track-group": {
  21044. comment: "used by old grid-columns and grid-rows syntax v0",
  21045. syntax: "'(' [ <string>* <track-minmax> <string>* ]+ ')' [ '[' <positive-integer> ']' ]? | <track-minmax>"
  21046. },
  21047. "track-list-v0": {
  21048. comment: "used by old grid-columns and grid-rows syntax v0",
  21049. syntax: "[ <string>* <track-group> <string>* ]+ | none"
  21050. },
  21051. "track-minmax": {
  21052. comment: "used by old grid-columns and grid-rows syntax v0",
  21053. syntax: "minmax( <track-breadth> , <track-breadth> ) | auto | <track-breadth> | fit-content"
  21054. },
  21055. x: {
  21056. comment: "missed; not sure we should add it, but no others except `cursor` is using it so it's ok for now; https://drafts.csswg.org/css-ui-3/#cursor",
  21057. syntax: "<number>"
  21058. },
  21059. y: {
  21060. comment: "missed; not sure we should add it, but no others except `cursor` is using so it's ok for now; https://drafts.csswg.org/css-ui-3/#cursor",
  21061. syntax: "<number>"
  21062. },
  21063. declaration: {
  21064. comment: "missed, restored by https://drafts.csswg.org/css-syntax",
  21065. syntax: "<ident-token> : <declaration-value>? [ '!' important ]?"
  21066. },
  21067. "declaration-list": {
  21068. comment: "missed, restored by https://drafts.csswg.org/css-syntax",
  21069. syntax: "[ <declaration>? ';' ]* <declaration>?"
  21070. },
  21071. url: {
  21072. comment: "https://drafts.csswg.org/css-values-4/#urls",
  21073. syntax: "url( <string> <url-modifier>* ) | <url-token>"
  21074. },
  21075. "url-modifier": {
  21076. comment: "https://drafts.csswg.org/css-values-4/#typedef-url-modifier",
  21077. syntax: "<ident> | <function-token> <any-value> )"
  21078. },
  21079. "number-zero-one": {
  21080. syntax: "<number [0,1]>"
  21081. },
  21082. "number-one-or-greater": {
  21083. syntax: "<number [1,∞]>"
  21084. },
  21085. "positive-integer": {
  21086. syntax: "<integer [0,∞]>"
  21087. },
  21088. "-non-standard-display": {
  21089. syntax: "-ms-inline-flexbox | -ms-grid | -ms-inline-grid | -webkit-flex | -webkit-inline-flex | -webkit-box | -webkit-inline-box | -moz-inline-stack | -moz-box | -moz-inline-box"
  21090. }
  21091. };
  21092. var require$$3 = {
  21093. atrules: atrules,
  21094. properties: properties,
  21095. syntaxes: syntaxes
  21096. };
  21097. const mdnAtrules = require$$0;
  21098. const mdnProperties = require$$1;
  21099. const mdnSyntaxes = require$$2;
  21100. const patch = require$$3;
  21101. const extendSyntax = /^\s*\|\s*/;
  21102. function preprocessAtrules(dict) {
  21103. const result = Object.create(null);
  21104. for (const atruleName in dict) {
  21105. const atrule = dict[atruleName];
  21106. let descriptors = null;
  21107. if (atrule.descriptors) {
  21108. descriptors = Object.create(null);
  21109. for (const descriptor in atrule.descriptors) {
  21110. descriptors[descriptor] = atrule.descriptors[descriptor].syntax;
  21111. }
  21112. }
  21113. result[atruleName.substr(1)] = {
  21114. prelude: atrule.syntax.trim().match(/^@\S+\s+([^;\{]*)/)[1].trim() || null,
  21115. descriptors
  21116. };
  21117. }
  21118. return result;
  21119. }
  21120. function patchDictionary(dict, patchDict) {
  21121. const result = {};
  21122. // copy all syntaxes for an original dict
  21123. for (const key in dict) {
  21124. result[key] = dict[key].syntax || dict[key];
  21125. }
  21126. // apply a patch
  21127. for (const key in patchDict) {
  21128. if (key in dict) {
  21129. if (patchDict[key].syntax) {
  21130. result[key] = extendSyntax.test(patchDict[key].syntax)
  21131. ? result[key] + ' ' + patchDict[key].syntax.trim()
  21132. : patchDict[key].syntax;
  21133. } else {
  21134. delete result[key];
  21135. }
  21136. } else {
  21137. if (patchDict[key].syntax) {
  21138. result[key] = patchDict[key].syntax.replace(extendSyntax, '');
  21139. }
  21140. }
  21141. }
  21142. return result;
  21143. }
  21144. function unpackSyntaxes(dict) {
  21145. const result = {};
  21146. for (const key in dict) {
  21147. result[key] = dict[key].syntax;
  21148. }
  21149. return result;
  21150. }
  21151. function patchAtrules(dict, patchDict) {
  21152. const result = {};
  21153. // copy all syntaxes for an original dict
  21154. for (const key in dict) {
  21155. const patchDescriptors = (patchDict[key] && patchDict[key].descriptors) || null;
  21156. result[key] = {
  21157. prelude: key in patchDict && 'prelude' in patchDict[key]
  21158. ? patchDict[key].prelude
  21159. : dict[key].prelude || null,
  21160. descriptors: dict[key].descriptors
  21161. ? patchDictionary(dict[key].descriptors, patchDescriptors || {})
  21162. : patchDescriptors && unpackSyntaxes(patchDescriptors)
  21163. };
  21164. }
  21165. // apply a patch
  21166. for (const key in patchDict) {
  21167. if (!hasOwnProperty.call(dict, key)) {
  21168. result[key] = {
  21169. prelude: patchDict[key].prelude || null,
  21170. descriptors: patchDict[key].descriptors && unpackSyntaxes(patchDict[key].descriptors)
  21171. };
  21172. }
  21173. }
  21174. return result;
  21175. }
  21176. var data$1 = {
  21177. types: patchDictionary(mdnSyntaxes, patch.syntaxes),
  21178. atrules: patchAtrules(preprocessAtrules(mdnAtrules), patch.atrules),
  21179. properties: patchDictionary(mdnProperties, patch.properties)
  21180. };
  21181. var cmpChar$2 = tokenizer$3.cmpChar;
  21182. var isDigit$1 = tokenizer$3.isDigit;
  21183. var TYPE$y = tokenizer$3.TYPE;
  21184. var WHITESPACE$8 = TYPE$y.WhiteSpace;
  21185. var COMMENT$6 = TYPE$y.Comment;
  21186. var IDENT$f = TYPE$y.Ident;
  21187. var NUMBER$6 = TYPE$y.Number;
  21188. var DIMENSION$5 = TYPE$y.Dimension;
  21189. var PLUSSIGN$5 = 0x002B; // U+002B PLUS SIGN (+)
  21190. var HYPHENMINUS$2 = 0x002D; // U+002D HYPHEN-MINUS (-)
  21191. var N = 0x006E; // U+006E LATIN SMALL LETTER N (n)
  21192. var DISALLOW_SIGN = true;
  21193. var ALLOW_SIGN = false;
  21194. function checkInteger(offset, disallowSign) {
  21195. var pos = this.scanner.tokenStart + offset;
  21196. var code = this.scanner.source.charCodeAt(pos);
  21197. if (code === PLUSSIGN$5 || code === HYPHENMINUS$2) {
  21198. if (disallowSign) {
  21199. this.error('Number sign is not allowed');
  21200. }
  21201. pos++;
  21202. }
  21203. for (; pos < this.scanner.tokenEnd; pos++) {
  21204. if (!isDigit$1(this.scanner.source.charCodeAt(pos))) {
  21205. this.error('Integer is expected', pos);
  21206. }
  21207. }
  21208. }
  21209. function checkTokenIsInteger(disallowSign) {
  21210. return checkInteger.call(this, 0, disallowSign);
  21211. }
  21212. function expectCharCode(offset, code) {
  21213. if (!cmpChar$2(this.scanner.source, this.scanner.tokenStart + offset, code)) {
  21214. var msg = '';
  21215. switch (code) {
  21216. case N:
  21217. msg = 'N is expected';
  21218. break;
  21219. case HYPHENMINUS$2:
  21220. msg = 'HyphenMinus is expected';
  21221. break;
  21222. }
  21223. this.error(msg, this.scanner.tokenStart + offset);
  21224. }
  21225. }
  21226. // ... <signed-integer>
  21227. // ... ['+' | '-'] <signless-integer>
  21228. function consumeB() {
  21229. var offset = 0;
  21230. var sign = 0;
  21231. var type = this.scanner.tokenType;
  21232. while (type === WHITESPACE$8 || type === COMMENT$6) {
  21233. type = this.scanner.lookupType(++offset);
  21234. }
  21235. if (type !== NUMBER$6) {
  21236. if (this.scanner.isDelim(PLUSSIGN$5, offset) ||
  21237. this.scanner.isDelim(HYPHENMINUS$2, offset)) {
  21238. sign = this.scanner.isDelim(PLUSSIGN$5, offset) ? PLUSSIGN$5 : HYPHENMINUS$2;
  21239. do {
  21240. type = this.scanner.lookupType(++offset);
  21241. } while (type === WHITESPACE$8 || type === COMMENT$6);
  21242. if (type !== NUMBER$6) {
  21243. this.scanner.skip(offset);
  21244. checkTokenIsInteger.call(this, DISALLOW_SIGN);
  21245. }
  21246. } else {
  21247. return null;
  21248. }
  21249. }
  21250. if (offset > 0) {
  21251. this.scanner.skip(offset);
  21252. }
  21253. if (sign === 0) {
  21254. type = this.scanner.source.charCodeAt(this.scanner.tokenStart);
  21255. if (type !== PLUSSIGN$5 && type !== HYPHENMINUS$2) {
  21256. this.error('Number sign is expected');
  21257. }
  21258. }
  21259. checkTokenIsInteger.call(this, sign !== 0);
  21260. return sign === HYPHENMINUS$2 ? '-' + this.consume(NUMBER$6) : this.consume(NUMBER$6);
  21261. }
  21262. // An+B microsyntax https://www.w3.org/TR/css-syntax-3/#anb
  21263. var AnPlusB = {
  21264. name: 'AnPlusB',
  21265. structure: {
  21266. a: [String, null],
  21267. b: [String, null]
  21268. },
  21269. parse: function() {
  21270. /* eslint-disable brace-style*/
  21271. var start = this.scanner.tokenStart;
  21272. var a = null;
  21273. var b = null;
  21274. // <integer>
  21275. if (this.scanner.tokenType === NUMBER$6) {
  21276. checkTokenIsInteger.call(this, ALLOW_SIGN);
  21277. b = this.consume(NUMBER$6);
  21278. }
  21279. // -n
  21280. // -n <signed-integer>
  21281. // -n ['+' | '-'] <signless-integer>
  21282. // -n- <signless-integer>
  21283. // <dashndashdigit-ident>
  21284. else if (this.scanner.tokenType === IDENT$f && cmpChar$2(this.scanner.source, this.scanner.tokenStart, HYPHENMINUS$2)) {
  21285. a = '-1';
  21286. expectCharCode.call(this, 1, N);
  21287. switch (this.scanner.getTokenLength()) {
  21288. // -n
  21289. // -n <signed-integer>
  21290. // -n ['+' | '-'] <signless-integer>
  21291. case 2:
  21292. this.scanner.next();
  21293. b = consumeB.call(this);
  21294. break;
  21295. // -n- <signless-integer>
  21296. case 3:
  21297. expectCharCode.call(this, 2, HYPHENMINUS$2);
  21298. this.scanner.next();
  21299. this.scanner.skipSC();
  21300. checkTokenIsInteger.call(this, DISALLOW_SIGN);
  21301. b = '-' + this.consume(NUMBER$6);
  21302. break;
  21303. // <dashndashdigit-ident>
  21304. default:
  21305. expectCharCode.call(this, 2, HYPHENMINUS$2);
  21306. checkInteger.call(this, 3, DISALLOW_SIGN);
  21307. this.scanner.next();
  21308. b = this.scanner.substrToCursor(start + 2);
  21309. }
  21310. }
  21311. // '+'? n
  21312. // '+'? n <signed-integer>
  21313. // '+'? n ['+' | '-'] <signless-integer>
  21314. // '+'? n- <signless-integer>
  21315. // '+'? <ndashdigit-ident>
  21316. else if (this.scanner.tokenType === IDENT$f || (this.scanner.isDelim(PLUSSIGN$5) && this.scanner.lookupType(1) === IDENT$f)) {
  21317. var sign = 0;
  21318. a = '1';
  21319. // just ignore a plus
  21320. if (this.scanner.isDelim(PLUSSIGN$5)) {
  21321. sign = 1;
  21322. this.scanner.next();
  21323. }
  21324. expectCharCode.call(this, 0, N);
  21325. switch (this.scanner.getTokenLength()) {
  21326. // '+'? n
  21327. // '+'? n <signed-integer>
  21328. // '+'? n ['+' | '-'] <signless-integer>
  21329. case 1:
  21330. this.scanner.next();
  21331. b = consumeB.call(this);
  21332. break;
  21333. // '+'? n- <signless-integer>
  21334. case 2:
  21335. expectCharCode.call(this, 1, HYPHENMINUS$2);
  21336. this.scanner.next();
  21337. this.scanner.skipSC();
  21338. checkTokenIsInteger.call(this, DISALLOW_SIGN);
  21339. b = '-' + this.consume(NUMBER$6);
  21340. break;
  21341. // '+'? <ndashdigit-ident>
  21342. default:
  21343. expectCharCode.call(this, 1, HYPHENMINUS$2);
  21344. checkInteger.call(this, 2, DISALLOW_SIGN);
  21345. this.scanner.next();
  21346. b = this.scanner.substrToCursor(start + sign + 1);
  21347. }
  21348. }
  21349. // <ndashdigit-dimension>
  21350. // <ndash-dimension> <signless-integer>
  21351. // <n-dimension>
  21352. // <n-dimension> <signed-integer>
  21353. // <n-dimension> ['+' | '-'] <signless-integer>
  21354. else if (this.scanner.tokenType === DIMENSION$5) {
  21355. var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
  21356. var sign = code === PLUSSIGN$5 || code === HYPHENMINUS$2;
  21357. for (var i = this.scanner.tokenStart + sign; i < this.scanner.tokenEnd; i++) {
  21358. if (!isDigit$1(this.scanner.source.charCodeAt(i))) {
  21359. break;
  21360. }
  21361. }
  21362. if (i === this.scanner.tokenStart + sign) {
  21363. this.error('Integer is expected', this.scanner.tokenStart + sign);
  21364. }
  21365. expectCharCode.call(this, i - this.scanner.tokenStart, N);
  21366. a = this.scanner.source.substring(start, i);
  21367. // <n-dimension>
  21368. // <n-dimension> <signed-integer>
  21369. // <n-dimension> ['+' | '-'] <signless-integer>
  21370. if (i + 1 === this.scanner.tokenEnd) {
  21371. this.scanner.next();
  21372. b = consumeB.call(this);
  21373. } else {
  21374. expectCharCode.call(this, i - this.scanner.tokenStart + 1, HYPHENMINUS$2);
  21375. // <ndash-dimension> <signless-integer>
  21376. if (i + 2 === this.scanner.tokenEnd) {
  21377. this.scanner.next();
  21378. this.scanner.skipSC();
  21379. checkTokenIsInteger.call(this, DISALLOW_SIGN);
  21380. b = '-' + this.consume(NUMBER$6);
  21381. }
  21382. // <ndashdigit-dimension>
  21383. else {
  21384. checkInteger.call(this, i - this.scanner.tokenStart + 2, DISALLOW_SIGN);
  21385. this.scanner.next();
  21386. b = this.scanner.substrToCursor(i + 1);
  21387. }
  21388. }
  21389. } else {
  21390. this.error();
  21391. }
  21392. if (a !== null && a.charCodeAt(0) === PLUSSIGN$5) {
  21393. a = a.substr(1);
  21394. }
  21395. if (b !== null && b.charCodeAt(0) === PLUSSIGN$5) {
  21396. b = b.substr(1);
  21397. }
  21398. return {
  21399. type: 'AnPlusB',
  21400. loc: this.getLocation(start, this.scanner.tokenStart),
  21401. a: a,
  21402. b: b
  21403. };
  21404. },
  21405. generate: function(node) {
  21406. var a = node.a !== null && node.a !== undefined;
  21407. var b = node.b !== null && node.b !== undefined;
  21408. if (a) {
  21409. this.chunk(
  21410. node.a === '+1' ? '+n' : // eslint-disable-line operator-linebreak, indent
  21411. node.a === '1' ? 'n' : // eslint-disable-line operator-linebreak, indent
  21412. node.a === '-1' ? '-n' : // eslint-disable-line operator-linebreak, indent
  21413. node.a + 'n' // eslint-disable-line operator-linebreak, indent
  21414. );
  21415. if (b) {
  21416. b = String(node.b);
  21417. if (b.charAt(0) === '-' || b.charAt(0) === '+') {
  21418. this.chunk(b.charAt(0));
  21419. this.chunk(b.substr(1));
  21420. } else {
  21421. this.chunk('+');
  21422. this.chunk(b);
  21423. }
  21424. }
  21425. } else {
  21426. this.chunk(String(node.b));
  21427. }
  21428. }
  21429. };
  21430. var tokenizer = tokenizer$3;
  21431. var TYPE$x = tokenizer.TYPE;
  21432. var WhiteSpace$1 = TYPE$x.WhiteSpace;
  21433. var Semicolon = TYPE$x.Semicolon;
  21434. var LeftCurlyBracket = TYPE$x.LeftCurlyBracket;
  21435. var Delim = TYPE$x.Delim;
  21436. var EXCLAMATIONMARK$2 = 0x0021; // U+0021 EXCLAMATION MARK (!)
  21437. function getOffsetExcludeWS() {
  21438. if (this.scanner.tokenIndex > 0) {
  21439. if (this.scanner.lookupType(-1) === WhiteSpace$1) {
  21440. return this.scanner.tokenIndex > 1
  21441. ? this.scanner.getTokenStart(this.scanner.tokenIndex - 1)
  21442. : this.scanner.firstCharOffset;
  21443. }
  21444. }
  21445. return this.scanner.tokenStart;
  21446. }
  21447. // 0, 0, false
  21448. function balanceEnd() {
  21449. return 0;
  21450. }
  21451. // LEFTCURLYBRACKET, 0, false
  21452. function leftCurlyBracket(tokenType) {
  21453. return tokenType === LeftCurlyBracket ? 1 : 0;
  21454. }
  21455. // LEFTCURLYBRACKET, SEMICOLON, false
  21456. function leftCurlyBracketOrSemicolon(tokenType) {
  21457. return tokenType === LeftCurlyBracket || tokenType === Semicolon ? 1 : 0;
  21458. }
  21459. // EXCLAMATIONMARK, SEMICOLON, false
  21460. function exclamationMarkOrSemicolon(tokenType, source, offset) {
  21461. if (tokenType === Delim && source.charCodeAt(offset) === EXCLAMATIONMARK$2) {
  21462. return 1;
  21463. }
  21464. return tokenType === Semicolon ? 1 : 0;
  21465. }
  21466. // 0, SEMICOLON, true
  21467. function semicolonIncluded(tokenType) {
  21468. return tokenType === Semicolon ? 2 : 0;
  21469. }
  21470. var Raw = {
  21471. name: 'Raw',
  21472. structure: {
  21473. value: String
  21474. },
  21475. parse: function(startToken, mode, excludeWhiteSpace) {
  21476. var startOffset = this.scanner.getTokenStart(startToken);
  21477. var endOffset;
  21478. this.scanner.skip(
  21479. this.scanner.getRawLength(startToken, mode || balanceEnd)
  21480. );
  21481. if (excludeWhiteSpace && this.scanner.tokenStart > startOffset) {
  21482. endOffset = getOffsetExcludeWS.call(this);
  21483. } else {
  21484. endOffset = this.scanner.tokenStart;
  21485. }
  21486. return {
  21487. type: 'Raw',
  21488. loc: this.getLocation(startOffset, endOffset),
  21489. value: this.scanner.source.substring(startOffset, endOffset)
  21490. };
  21491. },
  21492. generate: function(node) {
  21493. this.chunk(node.value);
  21494. },
  21495. mode: {
  21496. default: balanceEnd,
  21497. leftCurlyBracket: leftCurlyBracket,
  21498. leftCurlyBracketOrSemicolon: leftCurlyBracketOrSemicolon,
  21499. exclamationMarkOrSemicolon: exclamationMarkOrSemicolon,
  21500. semicolonIncluded: semicolonIncluded
  21501. }
  21502. };
  21503. var TYPE$w = tokenizer$3.TYPE;
  21504. var rawMode$5 = Raw.mode;
  21505. var ATKEYWORD$2 = TYPE$w.AtKeyword;
  21506. var SEMICOLON$4 = TYPE$w.Semicolon;
  21507. var LEFTCURLYBRACKET$3 = TYPE$w.LeftCurlyBracket;
  21508. var RIGHTCURLYBRACKET$1 = TYPE$w.RightCurlyBracket;
  21509. function consumeRaw$5(startToken) {
  21510. return this.Raw(startToken, rawMode$5.leftCurlyBracketOrSemicolon, true);
  21511. }
  21512. function isDeclarationBlockAtrule() {
  21513. for (var offset = 1, type; type = this.scanner.lookupType(offset); offset++) {
  21514. if (type === RIGHTCURLYBRACKET$1) {
  21515. return true;
  21516. }
  21517. if (type === LEFTCURLYBRACKET$3 ||
  21518. type === ATKEYWORD$2) {
  21519. return false;
  21520. }
  21521. }
  21522. return false;
  21523. }
  21524. var Atrule = {
  21525. name: 'Atrule',
  21526. structure: {
  21527. name: String,
  21528. prelude: ['AtrulePrelude', 'Raw', null],
  21529. block: ['Block', null]
  21530. },
  21531. parse: function() {
  21532. var start = this.scanner.tokenStart;
  21533. var name;
  21534. var nameLowerCase;
  21535. var prelude = null;
  21536. var block = null;
  21537. this.eat(ATKEYWORD$2);
  21538. name = this.scanner.substrToCursor(start + 1);
  21539. nameLowerCase = name.toLowerCase();
  21540. this.scanner.skipSC();
  21541. // parse prelude
  21542. if (this.scanner.eof === false &&
  21543. this.scanner.tokenType !== LEFTCURLYBRACKET$3 &&
  21544. this.scanner.tokenType !== SEMICOLON$4) {
  21545. if (this.parseAtrulePrelude) {
  21546. prelude = this.parseWithFallback(this.AtrulePrelude.bind(this, name), consumeRaw$5);
  21547. // turn empty AtrulePrelude into null
  21548. if (prelude.type === 'AtrulePrelude' && prelude.children.head === null) {
  21549. prelude = null;
  21550. }
  21551. } else {
  21552. prelude = consumeRaw$5.call(this, this.scanner.tokenIndex);
  21553. }
  21554. this.scanner.skipSC();
  21555. }
  21556. switch (this.scanner.tokenType) {
  21557. case SEMICOLON$4:
  21558. this.scanner.next();
  21559. break;
  21560. case LEFTCURLYBRACKET$3:
  21561. if (this.atrule.hasOwnProperty(nameLowerCase) &&
  21562. typeof this.atrule[nameLowerCase].block === 'function') {
  21563. block = this.atrule[nameLowerCase].block.call(this);
  21564. } else {
  21565. // TODO: should consume block content as Raw?
  21566. block = this.Block(isDeclarationBlockAtrule.call(this));
  21567. }
  21568. break;
  21569. }
  21570. return {
  21571. type: 'Atrule',
  21572. loc: this.getLocation(start, this.scanner.tokenStart),
  21573. name: name,
  21574. prelude: prelude,
  21575. block: block
  21576. };
  21577. },
  21578. generate: function(node) {
  21579. this.chunk('@');
  21580. this.chunk(node.name);
  21581. if (node.prelude !== null) {
  21582. this.chunk(' ');
  21583. this.node(node.prelude);
  21584. }
  21585. if (node.block) {
  21586. this.node(node.block);
  21587. } else {
  21588. this.chunk(';');
  21589. }
  21590. },
  21591. walkContext: 'atrule'
  21592. };
  21593. var TYPE$v = tokenizer$3.TYPE;
  21594. var SEMICOLON$3 = TYPE$v.Semicolon;
  21595. var LEFTCURLYBRACKET$2 = TYPE$v.LeftCurlyBracket;
  21596. var AtrulePrelude = {
  21597. name: 'AtrulePrelude',
  21598. structure: {
  21599. children: [[]]
  21600. },
  21601. parse: function(name) {
  21602. var children = null;
  21603. if (name !== null) {
  21604. name = name.toLowerCase();
  21605. }
  21606. this.scanner.skipSC();
  21607. if (this.atrule.hasOwnProperty(name) &&
  21608. typeof this.atrule[name].prelude === 'function') {
  21609. // custom consumer
  21610. children = this.atrule[name].prelude.call(this);
  21611. } else {
  21612. // default consumer
  21613. children = this.readSequence(this.scope.AtrulePrelude);
  21614. }
  21615. this.scanner.skipSC();
  21616. if (this.scanner.eof !== true &&
  21617. this.scanner.tokenType !== LEFTCURLYBRACKET$2 &&
  21618. this.scanner.tokenType !== SEMICOLON$3) {
  21619. this.error('Semicolon or block is expected');
  21620. }
  21621. if (children === null) {
  21622. children = this.createList();
  21623. }
  21624. return {
  21625. type: 'AtrulePrelude',
  21626. loc: this.getLocationFromList(children),
  21627. children: children
  21628. };
  21629. },
  21630. generate: function(node) {
  21631. this.children(node);
  21632. },
  21633. walkContext: 'atrulePrelude'
  21634. };
  21635. var TYPE$u = tokenizer$3.TYPE;
  21636. var IDENT$e = TYPE$u.Ident;
  21637. var STRING$3 = TYPE$u.String;
  21638. var COLON$6 = TYPE$u.Colon;
  21639. var LEFTSQUAREBRACKET$3 = TYPE$u.LeftSquareBracket;
  21640. var RIGHTSQUAREBRACKET$1 = TYPE$u.RightSquareBracket;
  21641. var DOLLARSIGN$1 = 0x0024; // U+0024 DOLLAR SIGN ($)
  21642. var ASTERISK$5 = 0x002A; // U+002A ASTERISK (*)
  21643. var EQUALSSIGN = 0x003D; // U+003D EQUALS SIGN (=)
  21644. var CIRCUMFLEXACCENT = 0x005E; // U+005E (^)
  21645. var VERTICALLINE$2 = 0x007C; // U+007C VERTICAL LINE (|)
  21646. var TILDE$2 = 0x007E; // U+007E TILDE (~)
  21647. function getAttributeName() {
  21648. if (this.scanner.eof) {
  21649. this.error('Unexpected end of input');
  21650. }
  21651. var start = this.scanner.tokenStart;
  21652. var expectIdent = false;
  21653. var checkColon = true;
  21654. if (this.scanner.isDelim(ASTERISK$5)) {
  21655. expectIdent = true;
  21656. checkColon = false;
  21657. this.scanner.next();
  21658. } else if (!this.scanner.isDelim(VERTICALLINE$2)) {
  21659. this.eat(IDENT$e);
  21660. }
  21661. if (this.scanner.isDelim(VERTICALLINE$2)) {
  21662. if (this.scanner.source.charCodeAt(this.scanner.tokenStart + 1) !== EQUALSSIGN) {
  21663. this.scanner.next();
  21664. this.eat(IDENT$e);
  21665. } else if (expectIdent) {
  21666. this.error('Identifier is expected', this.scanner.tokenEnd);
  21667. }
  21668. } else if (expectIdent) {
  21669. this.error('Vertical line is expected');
  21670. }
  21671. if (checkColon && this.scanner.tokenType === COLON$6) {
  21672. this.scanner.next();
  21673. this.eat(IDENT$e);
  21674. }
  21675. return {
  21676. type: 'Identifier',
  21677. loc: this.getLocation(start, this.scanner.tokenStart),
  21678. name: this.scanner.substrToCursor(start)
  21679. };
  21680. }
  21681. function getOperator() {
  21682. var start = this.scanner.tokenStart;
  21683. var code = this.scanner.source.charCodeAt(start);
  21684. if (code !== EQUALSSIGN && // =
  21685. code !== TILDE$2 && // ~=
  21686. code !== CIRCUMFLEXACCENT && // ^=
  21687. code !== DOLLARSIGN$1 && // $=
  21688. code !== ASTERISK$5 && // *=
  21689. code !== VERTICALLINE$2 // |=
  21690. ) {
  21691. this.error('Attribute selector (=, ~=, ^=, $=, *=, |=) is expected');
  21692. }
  21693. this.scanner.next();
  21694. if (code !== EQUALSSIGN) {
  21695. if (!this.scanner.isDelim(EQUALSSIGN)) {
  21696. this.error('Equal sign is expected');
  21697. }
  21698. this.scanner.next();
  21699. }
  21700. return this.scanner.substrToCursor(start);
  21701. }
  21702. // '[' <wq-name> ']'
  21703. // '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'
  21704. var AttributeSelector = {
  21705. name: 'AttributeSelector',
  21706. structure: {
  21707. name: 'Identifier',
  21708. matcher: [String, null],
  21709. value: ['String', 'Identifier', null],
  21710. flags: [String, null]
  21711. },
  21712. parse: function() {
  21713. var start = this.scanner.tokenStart;
  21714. var name;
  21715. var matcher = null;
  21716. var value = null;
  21717. var flags = null;
  21718. this.eat(LEFTSQUAREBRACKET$3);
  21719. this.scanner.skipSC();
  21720. name = getAttributeName.call(this);
  21721. this.scanner.skipSC();
  21722. if (this.scanner.tokenType !== RIGHTSQUAREBRACKET$1) {
  21723. // avoid case `[name i]`
  21724. if (this.scanner.tokenType !== IDENT$e) {
  21725. matcher = getOperator.call(this);
  21726. this.scanner.skipSC();
  21727. value = this.scanner.tokenType === STRING$3
  21728. ? this.String()
  21729. : this.Identifier();
  21730. this.scanner.skipSC();
  21731. }
  21732. // attribute flags
  21733. if (this.scanner.tokenType === IDENT$e) {
  21734. flags = this.scanner.getTokenValue();
  21735. this.scanner.next();
  21736. this.scanner.skipSC();
  21737. }
  21738. }
  21739. this.eat(RIGHTSQUAREBRACKET$1);
  21740. return {
  21741. type: 'AttributeSelector',
  21742. loc: this.getLocation(start, this.scanner.tokenStart),
  21743. name: name,
  21744. matcher: matcher,
  21745. value: value,
  21746. flags: flags
  21747. };
  21748. },
  21749. generate: function(node) {
  21750. var flagsPrefix = ' ';
  21751. this.chunk('[');
  21752. this.node(node.name);
  21753. if (node.matcher !== null) {
  21754. this.chunk(node.matcher);
  21755. if (node.value !== null) {
  21756. this.node(node.value);
  21757. // space between string and flags is not required
  21758. if (node.value.type === 'String') {
  21759. flagsPrefix = '';
  21760. }
  21761. }
  21762. }
  21763. if (node.flags !== null) {
  21764. this.chunk(flagsPrefix);
  21765. this.chunk(node.flags);
  21766. }
  21767. this.chunk(']');
  21768. }
  21769. };
  21770. var TYPE$t = tokenizer$3.TYPE;
  21771. var rawMode$4 = Raw.mode;
  21772. var WHITESPACE$7 = TYPE$t.WhiteSpace;
  21773. var COMMENT$5 = TYPE$t.Comment;
  21774. var SEMICOLON$2 = TYPE$t.Semicolon;
  21775. var ATKEYWORD$1 = TYPE$t.AtKeyword;
  21776. var LEFTCURLYBRACKET$1 = TYPE$t.LeftCurlyBracket;
  21777. var RIGHTCURLYBRACKET = TYPE$t.RightCurlyBracket;
  21778. function consumeRaw$4(startToken) {
  21779. return this.Raw(startToken, null, true);
  21780. }
  21781. function consumeRule() {
  21782. return this.parseWithFallback(this.Rule, consumeRaw$4);
  21783. }
  21784. function consumeRawDeclaration(startToken) {
  21785. return this.Raw(startToken, rawMode$4.semicolonIncluded, true);
  21786. }
  21787. function consumeDeclaration() {
  21788. if (this.scanner.tokenType === SEMICOLON$2) {
  21789. return consumeRawDeclaration.call(this, this.scanner.tokenIndex);
  21790. }
  21791. var node = this.parseWithFallback(this.Declaration, consumeRawDeclaration);
  21792. if (this.scanner.tokenType === SEMICOLON$2) {
  21793. this.scanner.next();
  21794. }
  21795. return node;
  21796. }
  21797. var Block = {
  21798. name: 'Block',
  21799. structure: {
  21800. children: [[
  21801. 'Atrule',
  21802. 'Rule',
  21803. 'Declaration'
  21804. ]]
  21805. },
  21806. parse: function(isDeclaration) {
  21807. var consumer = isDeclaration ? consumeDeclaration : consumeRule;
  21808. var start = this.scanner.tokenStart;
  21809. var children = this.createList();
  21810. this.eat(LEFTCURLYBRACKET$1);
  21811. scan:
  21812. while (!this.scanner.eof) {
  21813. switch (this.scanner.tokenType) {
  21814. case RIGHTCURLYBRACKET:
  21815. break scan;
  21816. case WHITESPACE$7:
  21817. case COMMENT$5:
  21818. this.scanner.next();
  21819. break;
  21820. case ATKEYWORD$1:
  21821. children.push(this.parseWithFallback(this.Atrule, consumeRaw$4));
  21822. break;
  21823. default:
  21824. children.push(consumer.call(this));
  21825. }
  21826. }
  21827. if (!this.scanner.eof) {
  21828. this.eat(RIGHTCURLYBRACKET);
  21829. }
  21830. return {
  21831. type: 'Block',
  21832. loc: this.getLocation(start, this.scanner.tokenStart),
  21833. children: children
  21834. };
  21835. },
  21836. generate: function(node) {
  21837. this.chunk('{');
  21838. this.children(node, function(prev) {
  21839. if (prev.type === 'Declaration') {
  21840. this.chunk(';');
  21841. }
  21842. });
  21843. this.chunk('}');
  21844. },
  21845. walkContext: 'block'
  21846. };
  21847. var TYPE$s = tokenizer$3.TYPE;
  21848. var LEFTSQUAREBRACKET$2 = TYPE$s.LeftSquareBracket;
  21849. var RIGHTSQUAREBRACKET = TYPE$s.RightSquareBracket;
  21850. var Brackets = {
  21851. name: 'Brackets',
  21852. structure: {
  21853. children: [[]]
  21854. },
  21855. parse: function(readSequence, recognizer) {
  21856. var start = this.scanner.tokenStart;
  21857. var children = null;
  21858. this.eat(LEFTSQUAREBRACKET$2);
  21859. children = readSequence.call(this, recognizer);
  21860. if (!this.scanner.eof) {
  21861. this.eat(RIGHTSQUAREBRACKET);
  21862. }
  21863. return {
  21864. type: 'Brackets',
  21865. loc: this.getLocation(start, this.scanner.tokenStart),
  21866. children: children
  21867. };
  21868. },
  21869. generate: function(node) {
  21870. this.chunk('[');
  21871. this.children(node);
  21872. this.chunk(']');
  21873. }
  21874. };
  21875. var CDC$1 = tokenizer$3.TYPE.CDC;
  21876. var CDC_1 = {
  21877. name: 'CDC',
  21878. structure: [],
  21879. parse: function() {
  21880. var start = this.scanner.tokenStart;
  21881. this.eat(CDC$1); // -->
  21882. return {
  21883. type: 'CDC',
  21884. loc: this.getLocation(start, this.scanner.tokenStart)
  21885. };
  21886. },
  21887. generate: function() {
  21888. this.chunk('-->');
  21889. }
  21890. };
  21891. var CDO$1 = tokenizer$3.TYPE.CDO;
  21892. var CDO_1 = {
  21893. name: 'CDO',
  21894. structure: [],
  21895. parse: function() {
  21896. var start = this.scanner.tokenStart;
  21897. this.eat(CDO$1); // <!--
  21898. return {
  21899. type: 'CDO',
  21900. loc: this.getLocation(start, this.scanner.tokenStart)
  21901. };
  21902. },
  21903. generate: function() {
  21904. this.chunk('<!--');
  21905. }
  21906. };
  21907. var TYPE$r = tokenizer$3.TYPE;
  21908. var IDENT$d = TYPE$r.Ident;
  21909. var FULLSTOP$2 = 0x002E; // U+002E FULL STOP (.)
  21910. // '.' ident
  21911. var ClassSelector = {
  21912. name: 'ClassSelector',
  21913. structure: {
  21914. name: String
  21915. },
  21916. parse: function() {
  21917. if (!this.scanner.isDelim(FULLSTOP$2)) {
  21918. this.error('Full stop is expected');
  21919. }
  21920. this.scanner.next();
  21921. return {
  21922. type: 'ClassSelector',
  21923. loc: this.getLocation(this.scanner.tokenStart - 1, this.scanner.tokenEnd),
  21924. name: this.consume(IDENT$d)
  21925. };
  21926. },
  21927. generate: function(node) {
  21928. this.chunk('.');
  21929. this.chunk(node.name);
  21930. }
  21931. };
  21932. var TYPE$q = tokenizer$3.TYPE;
  21933. var IDENT$c = TYPE$q.Ident;
  21934. var PLUSSIGN$4 = 0x002B; // U+002B PLUS SIGN (+)
  21935. var SOLIDUS$5 = 0x002F; // U+002F SOLIDUS (/)
  21936. var GREATERTHANSIGN$1 = 0x003E; // U+003E GREATER-THAN SIGN (>)
  21937. var TILDE$1 = 0x007E; // U+007E TILDE (~)
  21938. // + | > | ~ | /deep/
  21939. var Combinator = {
  21940. name: 'Combinator',
  21941. structure: {
  21942. name: String
  21943. },
  21944. parse: function() {
  21945. var start = this.scanner.tokenStart;
  21946. var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
  21947. switch (code) {
  21948. case GREATERTHANSIGN$1:
  21949. case PLUSSIGN$4:
  21950. case TILDE$1:
  21951. this.scanner.next();
  21952. break;
  21953. case SOLIDUS$5:
  21954. this.scanner.next();
  21955. if (this.scanner.tokenType !== IDENT$c || this.scanner.lookupValue(0, 'deep') === false) {
  21956. this.error('Identifier `deep` is expected');
  21957. }
  21958. this.scanner.next();
  21959. if (!this.scanner.isDelim(SOLIDUS$5)) {
  21960. this.error('Solidus is expected');
  21961. }
  21962. this.scanner.next();
  21963. break;
  21964. default:
  21965. this.error('Combinator is expected');
  21966. }
  21967. return {
  21968. type: 'Combinator',
  21969. loc: this.getLocation(start, this.scanner.tokenStart),
  21970. name: this.scanner.substrToCursor(start)
  21971. };
  21972. },
  21973. generate: function(node) {
  21974. this.chunk(node.name);
  21975. }
  21976. };
  21977. var TYPE$p = tokenizer$3.TYPE;
  21978. var COMMENT$4 = TYPE$p.Comment;
  21979. var ASTERISK$4 = 0x002A; // U+002A ASTERISK (*)
  21980. var SOLIDUS$4 = 0x002F; // U+002F SOLIDUS (/)
  21981. // '/*' .* '*/'
  21982. var Comment = {
  21983. name: 'Comment',
  21984. structure: {
  21985. value: String
  21986. },
  21987. parse: function() {
  21988. var start = this.scanner.tokenStart;
  21989. var end = this.scanner.tokenEnd;
  21990. this.eat(COMMENT$4);
  21991. if ((end - start + 2) >= 2 &&
  21992. this.scanner.source.charCodeAt(end - 2) === ASTERISK$4 &&
  21993. this.scanner.source.charCodeAt(end - 1) === SOLIDUS$4) {
  21994. end -= 2;
  21995. }
  21996. return {
  21997. type: 'Comment',
  21998. loc: this.getLocation(start, this.scanner.tokenStart),
  21999. value: this.scanner.source.substring(start + 2, end)
  22000. };
  22001. },
  22002. generate: function(node) {
  22003. this.chunk('/*');
  22004. this.chunk(node.value);
  22005. this.chunk('*/');
  22006. }
  22007. };
  22008. var isCustomProperty = names$2.isCustomProperty;
  22009. var TYPE$o = tokenizer$3.TYPE;
  22010. var rawMode$3 = Raw.mode;
  22011. var IDENT$b = TYPE$o.Ident;
  22012. var HASH$4 = TYPE$o.Hash;
  22013. var COLON$5 = TYPE$o.Colon;
  22014. var SEMICOLON$1 = TYPE$o.Semicolon;
  22015. var DELIM$4 = TYPE$o.Delim;
  22016. var WHITESPACE$6 = TYPE$o.WhiteSpace;
  22017. var EXCLAMATIONMARK$1 = 0x0021; // U+0021 EXCLAMATION MARK (!)
  22018. var NUMBERSIGN$2 = 0x0023; // U+0023 NUMBER SIGN (#)
  22019. var DOLLARSIGN = 0x0024; // U+0024 DOLLAR SIGN ($)
  22020. var AMPERSAND = 0x0026; // U+0026 ANPERSAND (&)
  22021. var ASTERISK$3 = 0x002A; // U+002A ASTERISK (*)
  22022. var PLUSSIGN$3 = 0x002B; // U+002B PLUS SIGN (+)
  22023. var SOLIDUS$3 = 0x002F; // U+002F SOLIDUS (/)
  22024. function consumeValueRaw(startToken) {
  22025. return this.Raw(startToken, rawMode$3.exclamationMarkOrSemicolon, true);
  22026. }
  22027. function consumeCustomPropertyRaw(startToken) {
  22028. return this.Raw(startToken, rawMode$3.exclamationMarkOrSemicolon, false);
  22029. }
  22030. function consumeValue() {
  22031. var startValueToken = this.scanner.tokenIndex;
  22032. var value = this.Value();
  22033. if (value.type !== 'Raw' &&
  22034. this.scanner.eof === false &&
  22035. this.scanner.tokenType !== SEMICOLON$1 &&
  22036. this.scanner.isDelim(EXCLAMATIONMARK$1) === false &&
  22037. this.scanner.isBalanceEdge(startValueToken) === false) {
  22038. this.error();
  22039. }
  22040. return value;
  22041. }
  22042. var Declaration = {
  22043. name: 'Declaration',
  22044. structure: {
  22045. important: [Boolean, String],
  22046. property: String,
  22047. value: ['Value', 'Raw']
  22048. },
  22049. parse: function() {
  22050. var start = this.scanner.tokenStart;
  22051. var startToken = this.scanner.tokenIndex;
  22052. var property = readProperty.call(this);
  22053. var customProperty = isCustomProperty(property);
  22054. var parseValue = customProperty ? this.parseCustomProperty : this.parseValue;
  22055. var consumeRaw = customProperty ? consumeCustomPropertyRaw : consumeValueRaw;
  22056. var important = false;
  22057. var value;
  22058. this.scanner.skipSC();
  22059. this.eat(COLON$5);
  22060. const valueStart = this.scanner.tokenIndex;
  22061. if (!customProperty) {
  22062. this.scanner.skipSC();
  22063. }
  22064. if (parseValue) {
  22065. value = this.parseWithFallback(consumeValue, consumeRaw);
  22066. } else {
  22067. value = consumeRaw.call(this, this.scanner.tokenIndex);
  22068. }
  22069. if (customProperty && value.type === 'Value' && value.children.isEmpty()) {
  22070. for (let offset = valueStart - this.scanner.tokenIndex; offset <= 0; offset++) {
  22071. if (this.scanner.lookupType(offset) === WHITESPACE$6) {
  22072. value.children.appendData({
  22073. type: 'WhiteSpace',
  22074. loc: null,
  22075. value: ' '
  22076. });
  22077. break;
  22078. }
  22079. }
  22080. }
  22081. if (this.scanner.isDelim(EXCLAMATIONMARK$1)) {
  22082. important = getImportant.call(this);
  22083. this.scanner.skipSC();
  22084. }
  22085. // Do not include semicolon to range per spec
  22086. // https://drafts.csswg.org/css-syntax/#declaration-diagram
  22087. if (this.scanner.eof === false &&
  22088. this.scanner.tokenType !== SEMICOLON$1 &&
  22089. this.scanner.isBalanceEdge(startToken) === false) {
  22090. this.error();
  22091. }
  22092. return {
  22093. type: 'Declaration',
  22094. loc: this.getLocation(start, this.scanner.tokenStart),
  22095. important: important,
  22096. property: property,
  22097. value: value
  22098. };
  22099. },
  22100. generate: function(node) {
  22101. this.chunk(node.property);
  22102. this.chunk(':');
  22103. this.node(node.value);
  22104. if (node.important) {
  22105. this.chunk(node.important === true ? '!important' : '!' + node.important);
  22106. }
  22107. },
  22108. walkContext: 'declaration'
  22109. };
  22110. function readProperty() {
  22111. var start = this.scanner.tokenStart;
  22112. // hacks
  22113. if (this.scanner.tokenType === DELIM$4) {
  22114. switch (this.scanner.source.charCodeAt(this.scanner.tokenStart)) {
  22115. case ASTERISK$3:
  22116. case DOLLARSIGN:
  22117. case PLUSSIGN$3:
  22118. case NUMBERSIGN$2:
  22119. case AMPERSAND:
  22120. this.scanner.next();
  22121. break;
  22122. // TODO: not sure we should support this hack
  22123. case SOLIDUS$3:
  22124. this.scanner.next();
  22125. if (this.scanner.isDelim(SOLIDUS$3)) {
  22126. this.scanner.next();
  22127. }
  22128. break;
  22129. }
  22130. }
  22131. if (this.scanner.tokenType === HASH$4) {
  22132. this.eat(HASH$4);
  22133. } else {
  22134. this.eat(IDENT$b);
  22135. }
  22136. return this.scanner.substrToCursor(start);
  22137. }
  22138. // ! ws* important
  22139. function getImportant() {
  22140. this.eat(DELIM$4);
  22141. this.scanner.skipSC();
  22142. var important = this.consume(IDENT$b);
  22143. // store original value in case it differ from `important`
  22144. // for better original source restoring and hacks like `!ie` support
  22145. return important === 'important' ? true : important;
  22146. }
  22147. var TYPE$n = tokenizer$3.TYPE;
  22148. var rawMode$2 = Raw.mode;
  22149. var WHITESPACE$5 = TYPE$n.WhiteSpace;
  22150. var COMMENT$3 = TYPE$n.Comment;
  22151. var SEMICOLON = TYPE$n.Semicolon;
  22152. function consumeRaw$3(startToken) {
  22153. return this.Raw(startToken, rawMode$2.semicolonIncluded, true);
  22154. }
  22155. var DeclarationList = {
  22156. name: 'DeclarationList',
  22157. structure: {
  22158. children: [[
  22159. 'Declaration'
  22160. ]]
  22161. },
  22162. parse: function() {
  22163. var children = this.createList();
  22164. while (!this.scanner.eof) {
  22165. switch (this.scanner.tokenType) {
  22166. case WHITESPACE$5:
  22167. case COMMENT$3:
  22168. case SEMICOLON:
  22169. this.scanner.next();
  22170. break;
  22171. default:
  22172. children.push(this.parseWithFallback(this.Declaration, consumeRaw$3));
  22173. }
  22174. }
  22175. return {
  22176. type: 'DeclarationList',
  22177. loc: this.getLocationFromList(children),
  22178. children: children
  22179. };
  22180. },
  22181. generate: function(node) {
  22182. this.children(node, function(prev) {
  22183. if (prev.type === 'Declaration') {
  22184. this.chunk(';');
  22185. }
  22186. });
  22187. }
  22188. };
  22189. var consumeNumber$2 = utils$2.consumeNumber;
  22190. var TYPE$m = tokenizer$3.TYPE;
  22191. var DIMENSION$4 = TYPE$m.Dimension;
  22192. var Dimension = {
  22193. name: 'Dimension',
  22194. structure: {
  22195. value: String,
  22196. unit: String
  22197. },
  22198. parse: function() {
  22199. var start = this.scanner.tokenStart;
  22200. var numberEnd = consumeNumber$2(this.scanner.source, start);
  22201. this.eat(DIMENSION$4);
  22202. return {
  22203. type: 'Dimension',
  22204. loc: this.getLocation(start, this.scanner.tokenStart),
  22205. value: this.scanner.source.substring(start, numberEnd),
  22206. unit: this.scanner.source.substring(numberEnd, this.scanner.tokenStart)
  22207. };
  22208. },
  22209. generate: function(node) {
  22210. this.chunk(node.value);
  22211. this.chunk(node.unit);
  22212. }
  22213. };
  22214. var TYPE$l = tokenizer$3.TYPE;
  22215. var RIGHTPARENTHESIS$5 = TYPE$l.RightParenthesis;
  22216. // <function-token> <sequence> )
  22217. var _Function = {
  22218. name: 'Function',
  22219. structure: {
  22220. name: String,
  22221. children: [[]]
  22222. },
  22223. parse: function(readSequence, recognizer) {
  22224. var start = this.scanner.tokenStart;
  22225. var name = this.consumeFunctionName();
  22226. var nameLowerCase = name.toLowerCase();
  22227. var children;
  22228. children = recognizer.hasOwnProperty(nameLowerCase)
  22229. ? recognizer[nameLowerCase].call(this, recognizer)
  22230. : readSequence.call(this, recognizer);
  22231. if (!this.scanner.eof) {
  22232. this.eat(RIGHTPARENTHESIS$5);
  22233. }
  22234. return {
  22235. type: 'Function',
  22236. loc: this.getLocation(start, this.scanner.tokenStart),
  22237. name: name,
  22238. children: children
  22239. };
  22240. },
  22241. generate: function(node) {
  22242. this.chunk(node.name);
  22243. this.chunk('(');
  22244. this.children(node);
  22245. this.chunk(')');
  22246. },
  22247. walkContext: 'function'
  22248. };
  22249. var TYPE$k = tokenizer$3.TYPE;
  22250. var HASH$3 = TYPE$k.Hash;
  22251. // '#' ident
  22252. var Hash = {
  22253. name: 'Hash',
  22254. structure: {
  22255. value: String
  22256. },
  22257. parse: function() {
  22258. var start = this.scanner.tokenStart;
  22259. this.eat(HASH$3);
  22260. return {
  22261. type: 'Hash',
  22262. loc: this.getLocation(start, this.scanner.tokenStart),
  22263. value: this.scanner.substrToCursor(start + 1)
  22264. };
  22265. },
  22266. generate: function(node) {
  22267. this.chunk('#');
  22268. this.chunk(node.value);
  22269. }
  22270. };
  22271. var TYPE$j = tokenizer$3.TYPE;
  22272. var IDENT$a = TYPE$j.Ident;
  22273. var Identifier = {
  22274. name: 'Identifier',
  22275. structure: {
  22276. name: String
  22277. },
  22278. parse: function() {
  22279. return {
  22280. type: 'Identifier',
  22281. loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
  22282. name: this.consume(IDENT$a)
  22283. };
  22284. },
  22285. generate: function(node) {
  22286. this.chunk(node.name);
  22287. }
  22288. };
  22289. var TYPE$i = tokenizer$3.TYPE;
  22290. var HASH$2 = TYPE$i.Hash;
  22291. // <hash-token>
  22292. var IdSelector = {
  22293. name: 'IdSelector',
  22294. structure: {
  22295. name: String
  22296. },
  22297. parse: function() {
  22298. var start = this.scanner.tokenStart;
  22299. // TODO: check value is an ident
  22300. this.eat(HASH$2);
  22301. return {
  22302. type: 'IdSelector',
  22303. loc: this.getLocation(start, this.scanner.tokenStart),
  22304. name: this.scanner.substrToCursor(start + 1)
  22305. };
  22306. },
  22307. generate: function(node) {
  22308. this.chunk('#');
  22309. this.chunk(node.name);
  22310. }
  22311. };
  22312. var TYPE$h = tokenizer$3.TYPE;
  22313. var IDENT$9 = TYPE$h.Ident;
  22314. var NUMBER$5 = TYPE$h.Number;
  22315. var DIMENSION$3 = TYPE$h.Dimension;
  22316. var LEFTPARENTHESIS$5 = TYPE$h.LeftParenthesis;
  22317. var RIGHTPARENTHESIS$4 = TYPE$h.RightParenthesis;
  22318. var COLON$4 = TYPE$h.Colon;
  22319. var DELIM$3 = TYPE$h.Delim;
  22320. var MediaFeature = {
  22321. name: 'MediaFeature',
  22322. structure: {
  22323. name: String,
  22324. value: ['Identifier', 'Number', 'Dimension', 'Ratio', null]
  22325. },
  22326. parse: function() {
  22327. var start = this.scanner.tokenStart;
  22328. var name;
  22329. var value = null;
  22330. this.eat(LEFTPARENTHESIS$5);
  22331. this.scanner.skipSC();
  22332. name = this.consume(IDENT$9);
  22333. this.scanner.skipSC();
  22334. if (this.scanner.tokenType !== RIGHTPARENTHESIS$4) {
  22335. this.eat(COLON$4);
  22336. this.scanner.skipSC();
  22337. switch (this.scanner.tokenType) {
  22338. case NUMBER$5:
  22339. if (this.lookupNonWSType(1) === DELIM$3) {
  22340. value = this.Ratio();
  22341. } else {
  22342. value = this.Number();
  22343. }
  22344. break;
  22345. case DIMENSION$3:
  22346. value = this.Dimension();
  22347. break;
  22348. case IDENT$9:
  22349. value = this.Identifier();
  22350. break;
  22351. default:
  22352. this.error('Number, dimension, ratio or identifier is expected');
  22353. }
  22354. this.scanner.skipSC();
  22355. }
  22356. this.eat(RIGHTPARENTHESIS$4);
  22357. return {
  22358. type: 'MediaFeature',
  22359. loc: this.getLocation(start, this.scanner.tokenStart),
  22360. name: name,
  22361. value: value
  22362. };
  22363. },
  22364. generate: function(node) {
  22365. this.chunk('(');
  22366. this.chunk(node.name);
  22367. if (node.value !== null) {
  22368. this.chunk(':');
  22369. this.node(node.value);
  22370. }
  22371. this.chunk(')');
  22372. }
  22373. };
  22374. var TYPE$g = tokenizer$3.TYPE;
  22375. var WHITESPACE$4 = TYPE$g.WhiteSpace;
  22376. var COMMENT$2 = TYPE$g.Comment;
  22377. var IDENT$8 = TYPE$g.Ident;
  22378. var LEFTPARENTHESIS$4 = TYPE$g.LeftParenthesis;
  22379. var MediaQuery = {
  22380. name: 'MediaQuery',
  22381. structure: {
  22382. children: [[
  22383. 'Identifier',
  22384. 'MediaFeature',
  22385. 'WhiteSpace'
  22386. ]]
  22387. },
  22388. parse: function() {
  22389. this.scanner.skipSC();
  22390. var children = this.createList();
  22391. var child = null;
  22392. var space = null;
  22393. scan:
  22394. while (!this.scanner.eof) {
  22395. switch (this.scanner.tokenType) {
  22396. case COMMENT$2:
  22397. this.scanner.next();
  22398. continue;
  22399. case WHITESPACE$4:
  22400. space = this.WhiteSpace();
  22401. continue;
  22402. case IDENT$8:
  22403. child = this.Identifier();
  22404. break;
  22405. case LEFTPARENTHESIS$4:
  22406. child = this.MediaFeature();
  22407. break;
  22408. default:
  22409. break scan;
  22410. }
  22411. if (space !== null) {
  22412. children.push(space);
  22413. space = null;
  22414. }
  22415. children.push(child);
  22416. }
  22417. if (child === null) {
  22418. this.error('Identifier or parenthesis is expected');
  22419. }
  22420. return {
  22421. type: 'MediaQuery',
  22422. loc: this.getLocationFromList(children),
  22423. children: children
  22424. };
  22425. },
  22426. generate: function(node) {
  22427. this.children(node);
  22428. }
  22429. };
  22430. var COMMA$3 = tokenizer$3.TYPE.Comma;
  22431. var MediaQueryList = {
  22432. name: 'MediaQueryList',
  22433. structure: {
  22434. children: [[
  22435. 'MediaQuery'
  22436. ]]
  22437. },
  22438. parse: function(relative) {
  22439. var children = this.createList();
  22440. this.scanner.skipSC();
  22441. while (!this.scanner.eof) {
  22442. children.push(this.MediaQuery(relative));
  22443. if (this.scanner.tokenType !== COMMA$3) {
  22444. break;
  22445. }
  22446. this.scanner.next();
  22447. }
  22448. return {
  22449. type: 'MediaQueryList',
  22450. loc: this.getLocationFromList(children),
  22451. children: children
  22452. };
  22453. },
  22454. generate: function(node) {
  22455. this.children(node, function() {
  22456. this.chunk(',');
  22457. });
  22458. }
  22459. };
  22460. var Nth = {
  22461. name: 'Nth',
  22462. structure: {
  22463. nth: ['AnPlusB', 'Identifier'],
  22464. selector: ['SelectorList', null]
  22465. },
  22466. parse: function(allowOfClause) {
  22467. this.scanner.skipSC();
  22468. var start = this.scanner.tokenStart;
  22469. var end = start;
  22470. var selector = null;
  22471. var query;
  22472. if (this.scanner.lookupValue(0, 'odd') || this.scanner.lookupValue(0, 'even')) {
  22473. query = this.Identifier();
  22474. } else {
  22475. query = this.AnPlusB();
  22476. }
  22477. this.scanner.skipSC();
  22478. if (allowOfClause && this.scanner.lookupValue(0, 'of')) {
  22479. this.scanner.next();
  22480. selector = this.SelectorList();
  22481. if (this.needPositions) {
  22482. end = this.getLastListNode(selector.children).loc.end.offset;
  22483. }
  22484. } else {
  22485. if (this.needPositions) {
  22486. end = query.loc.end.offset;
  22487. }
  22488. }
  22489. return {
  22490. type: 'Nth',
  22491. loc: this.getLocation(start, end),
  22492. nth: query,
  22493. selector: selector
  22494. };
  22495. },
  22496. generate: function(node) {
  22497. this.node(node.nth);
  22498. if (node.selector !== null) {
  22499. this.chunk(' of ');
  22500. this.node(node.selector);
  22501. }
  22502. }
  22503. };
  22504. var NUMBER$4 = tokenizer$3.TYPE.Number;
  22505. var _Number = {
  22506. name: 'Number',
  22507. structure: {
  22508. value: String
  22509. },
  22510. parse: function() {
  22511. return {
  22512. type: 'Number',
  22513. loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
  22514. value: this.consume(NUMBER$4)
  22515. };
  22516. },
  22517. generate: function(node) {
  22518. this.chunk(node.value);
  22519. }
  22520. };
  22521. // '/' | '*' | ',' | ':' | '+' | '-'
  22522. var Operator = {
  22523. name: 'Operator',
  22524. structure: {
  22525. value: String
  22526. },
  22527. parse: function() {
  22528. var start = this.scanner.tokenStart;
  22529. this.scanner.next();
  22530. return {
  22531. type: 'Operator',
  22532. loc: this.getLocation(start, this.scanner.tokenStart),
  22533. value: this.scanner.substrToCursor(start)
  22534. };
  22535. },
  22536. generate: function(node) {
  22537. this.chunk(node.value);
  22538. }
  22539. };
  22540. var TYPE$f = tokenizer$3.TYPE;
  22541. var LEFTPARENTHESIS$3 = TYPE$f.LeftParenthesis;
  22542. var RIGHTPARENTHESIS$3 = TYPE$f.RightParenthesis;
  22543. var Parentheses = {
  22544. name: 'Parentheses',
  22545. structure: {
  22546. children: [[]]
  22547. },
  22548. parse: function(readSequence, recognizer) {
  22549. var start = this.scanner.tokenStart;
  22550. var children = null;
  22551. this.eat(LEFTPARENTHESIS$3);
  22552. children = readSequence.call(this, recognizer);
  22553. if (!this.scanner.eof) {
  22554. this.eat(RIGHTPARENTHESIS$3);
  22555. }
  22556. return {
  22557. type: 'Parentheses',
  22558. loc: this.getLocation(start, this.scanner.tokenStart),
  22559. children: children
  22560. };
  22561. },
  22562. generate: function(node) {
  22563. this.chunk('(');
  22564. this.children(node);
  22565. this.chunk(')');
  22566. }
  22567. };
  22568. var consumeNumber$1 = utils$2.consumeNumber;
  22569. var TYPE$e = tokenizer$3.TYPE;
  22570. var PERCENTAGE$2 = TYPE$e.Percentage;
  22571. var Percentage = {
  22572. name: 'Percentage',
  22573. structure: {
  22574. value: String
  22575. },
  22576. parse: function() {
  22577. var start = this.scanner.tokenStart;
  22578. var numberEnd = consumeNumber$1(this.scanner.source, start);
  22579. this.eat(PERCENTAGE$2);
  22580. return {
  22581. type: 'Percentage',
  22582. loc: this.getLocation(start, this.scanner.tokenStart),
  22583. value: this.scanner.source.substring(start, numberEnd)
  22584. };
  22585. },
  22586. generate: function(node) {
  22587. this.chunk(node.value);
  22588. this.chunk('%');
  22589. }
  22590. };
  22591. var TYPE$d = tokenizer$3.TYPE;
  22592. var IDENT$7 = TYPE$d.Ident;
  22593. var FUNCTION$5 = TYPE$d.Function;
  22594. var COLON$3 = TYPE$d.Colon;
  22595. var RIGHTPARENTHESIS$2 = TYPE$d.RightParenthesis;
  22596. // : [ <ident> | <function-token> <any-value>? ) ]
  22597. var PseudoClassSelector = {
  22598. name: 'PseudoClassSelector',
  22599. structure: {
  22600. name: String,
  22601. children: [['Raw'], null]
  22602. },
  22603. parse: function() {
  22604. var start = this.scanner.tokenStart;
  22605. var children = null;
  22606. var name;
  22607. var nameLowerCase;
  22608. this.eat(COLON$3);
  22609. if (this.scanner.tokenType === FUNCTION$5) {
  22610. name = this.consumeFunctionName();
  22611. nameLowerCase = name.toLowerCase();
  22612. if (this.pseudo.hasOwnProperty(nameLowerCase)) {
  22613. this.scanner.skipSC();
  22614. children = this.pseudo[nameLowerCase].call(this);
  22615. this.scanner.skipSC();
  22616. } else {
  22617. children = this.createList();
  22618. children.push(
  22619. this.Raw(this.scanner.tokenIndex, null, false)
  22620. );
  22621. }
  22622. this.eat(RIGHTPARENTHESIS$2);
  22623. } else {
  22624. name = this.consume(IDENT$7);
  22625. }
  22626. return {
  22627. type: 'PseudoClassSelector',
  22628. loc: this.getLocation(start, this.scanner.tokenStart),
  22629. name: name,
  22630. children: children
  22631. };
  22632. },
  22633. generate: function(node) {
  22634. this.chunk(':');
  22635. this.chunk(node.name);
  22636. if (node.children !== null) {
  22637. this.chunk('(');
  22638. this.children(node);
  22639. this.chunk(')');
  22640. }
  22641. },
  22642. walkContext: 'function'
  22643. };
  22644. var TYPE$c = tokenizer$3.TYPE;
  22645. var IDENT$6 = TYPE$c.Ident;
  22646. var FUNCTION$4 = TYPE$c.Function;
  22647. var COLON$2 = TYPE$c.Colon;
  22648. var RIGHTPARENTHESIS$1 = TYPE$c.RightParenthesis;
  22649. // :: [ <ident> | <function-token> <any-value>? ) ]
  22650. var PseudoElementSelector = {
  22651. name: 'PseudoElementSelector',
  22652. structure: {
  22653. name: String,
  22654. children: [['Raw'], null]
  22655. },
  22656. parse: function() {
  22657. var start = this.scanner.tokenStart;
  22658. var children = null;
  22659. var name;
  22660. var nameLowerCase;
  22661. this.eat(COLON$2);
  22662. this.eat(COLON$2);
  22663. if (this.scanner.tokenType === FUNCTION$4) {
  22664. name = this.consumeFunctionName();
  22665. nameLowerCase = name.toLowerCase();
  22666. if (this.pseudo.hasOwnProperty(nameLowerCase)) {
  22667. this.scanner.skipSC();
  22668. children = this.pseudo[nameLowerCase].call(this);
  22669. this.scanner.skipSC();
  22670. } else {
  22671. children = this.createList();
  22672. children.push(
  22673. this.Raw(this.scanner.tokenIndex, null, false)
  22674. );
  22675. }
  22676. this.eat(RIGHTPARENTHESIS$1);
  22677. } else {
  22678. name = this.consume(IDENT$6);
  22679. }
  22680. return {
  22681. type: 'PseudoElementSelector',
  22682. loc: this.getLocation(start, this.scanner.tokenStart),
  22683. name: name,
  22684. children: children
  22685. };
  22686. },
  22687. generate: function(node) {
  22688. this.chunk('::');
  22689. this.chunk(node.name);
  22690. if (node.children !== null) {
  22691. this.chunk('(');
  22692. this.children(node);
  22693. this.chunk(')');
  22694. }
  22695. },
  22696. walkContext: 'function'
  22697. };
  22698. var isDigit = tokenizer$3.isDigit;
  22699. var TYPE$b = tokenizer$3.TYPE;
  22700. var NUMBER$3 = TYPE$b.Number;
  22701. var DELIM$2 = TYPE$b.Delim;
  22702. var SOLIDUS$2 = 0x002F; // U+002F SOLIDUS (/)
  22703. var FULLSTOP$1 = 0x002E; // U+002E FULL STOP (.)
  22704. // Terms of <ratio> should be a positive numbers (not zero or negative)
  22705. // (see https://drafts.csswg.org/mediaqueries-3/#values)
  22706. // However, -o-min-device-pixel-ratio takes fractional values as a ratio's term
  22707. // and this is using by various sites. Therefore we relax checking on parse
  22708. // to test a term is unsigned number without an exponent part.
  22709. // Additional checking may be applied on lexer validation.
  22710. function consumeNumber() {
  22711. this.scanner.skipWS();
  22712. var value = this.consume(NUMBER$3);
  22713. for (var i = 0; i < value.length; i++) {
  22714. var code = value.charCodeAt(i);
  22715. if (!isDigit(code) && code !== FULLSTOP$1) {
  22716. this.error('Unsigned number is expected', this.scanner.tokenStart - value.length + i);
  22717. }
  22718. }
  22719. if (Number(value) === 0) {
  22720. this.error('Zero number is not allowed', this.scanner.tokenStart - value.length);
  22721. }
  22722. return value;
  22723. }
  22724. // <positive-integer> S* '/' S* <positive-integer>
  22725. var Ratio = {
  22726. name: 'Ratio',
  22727. structure: {
  22728. left: String,
  22729. right: String
  22730. },
  22731. parse: function() {
  22732. var start = this.scanner.tokenStart;
  22733. var left = consumeNumber.call(this);
  22734. var right;
  22735. this.scanner.skipWS();
  22736. if (!this.scanner.isDelim(SOLIDUS$2)) {
  22737. this.error('Solidus is expected');
  22738. }
  22739. this.eat(DELIM$2);
  22740. right = consumeNumber.call(this);
  22741. return {
  22742. type: 'Ratio',
  22743. loc: this.getLocation(start, this.scanner.tokenStart),
  22744. left: left,
  22745. right: right
  22746. };
  22747. },
  22748. generate: function(node) {
  22749. this.chunk(node.left);
  22750. this.chunk('/');
  22751. this.chunk(node.right);
  22752. }
  22753. };
  22754. var TYPE$a = tokenizer$3.TYPE;
  22755. var rawMode$1 = Raw.mode;
  22756. var LEFTCURLYBRACKET = TYPE$a.LeftCurlyBracket;
  22757. function consumeRaw$2(startToken) {
  22758. return this.Raw(startToken, rawMode$1.leftCurlyBracket, true);
  22759. }
  22760. function consumePrelude() {
  22761. var prelude = this.SelectorList();
  22762. if (prelude.type !== 'Raw' &&
  22763. this.scanner.eof === false &&
  22764. this.scanner.tokenType !== LEFTCURLYBRACKET) {
  22765. this.error();
  22766. }
  22767. return prelude;
  22768. }
  22769. var Rule = {
  22770. name: 'Rule',
  22771. structure: {
  22772. prelude: ['SelectorList', 'Raw'],
  22773. block: ['Block']
  22774. },
  22775. parse: function() {
  22776. var startToken = this.scanner.tokenIndex;
  22777. var startOffset = this.scanner.tokenStart;
  22778. var prelude;
  22779. var block;
  22780. if (this.parseRulePrelude) {
  22781. prelude = this.parseWithFallback(consumePrelude, consumeRaw$2);
  22782. } else {
  22783. prelude = consumeRaw$2.call(this, startToken);
  22784. }
  22785. block = this.Block(true);
  22786. return {
  22787. type: 'Rule',
  22788. loc: this.getLocation(startOffset, this.scanner.tokenStart),
  22789. prelude: prelude,
  22790. block: block
  22791. };
  22792. },
  22793. generate: function(node) {
  22794. this.node(node.prelude);
  22795. this.node(node.block);
  22796. },
  22797. walkContext: 'rule'
  22798. };
  22799. var Selector = {
  22800. name: 'Selector',
  22801. structure: {
  22802. children: [[
  22803. 'TypeSelector',
  22804. 'IdSelector',
  22805. 'ClassSelector',
  22806. 'AttributeSelector',
  22807. 'PseudoClassSelector',
  22808. 'PseudoElementSelector',
  22809. 'Combinator',
  22810. 'WhiteSpace'
  22811. ]]
  22812. },
  22813. parse: function() {
  22814. var children = this.readSequence(this.scope.Selector);
  22815. // nothing were consumed
  22816. if (this.getFirstListNode(children) === null) {
  22817. this.error('Selector is expected');
  22818. }
  22819. return {
  22820. type: 'Selector',
  22821. loc: this.getLocationFromList(children),
  22822. children: children
  22823. };
  22824. },
  22825. generate: function(node) {
  22826. this.children(node);
  22827. }
  22828. };
  22829. var TYPE$9 = tokenizer$3.TYPE;
  22830. var COMMA$2 = TYPE$9.Comma;
  22831. var SelectorList = {
  22832. name: 'SelectorList',
  22833. structure: {
  22834. children: [[
  22835. 'Selector',
  22836. 'Raw'
  22837. ]]
  22838. },
  22839. parse: function() {
  22840. var children = this.createList();
  22841. while (!this.scanner.eof) {
  22842. children.push(this.Selector());
  22843. if (this.scanner.tokenType === COMMA$2) {
  22844. this.scanner.next();
  22845. continue;
  22846. }
  22847. break;
  22848. }
  22849. return {
  22850. type: 'SelectorList',
  22851. loc: this.getLocationFromList(children),
  22852. children: children
  22853. };
  22854. },
  22855. generate: function(node) {
  22856. this.children(node, function() {
  22857. this.chunk(',');
  22858. });
  22859. },
  22860. walkContext: 'selector'
  22861. };
  22862. var STRING$2 = tokenizer$3.TYPE.String;
  22863. var _String = {
  22864. name: 'String',
  22865. structure: {
  22866. value: String
  22867. },
  22868. parse: function() {
  22869. return {
  22870. type: 'String',
  22871. loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
  22872. value: this.consume(STRING$2)
  22873. };
  22874. },
  22875. generate: function(node) {
  22876. this.chunk(node.value);
  22877. }
  22878. };
  22879. var TYPE$8 = tokenizer$3.TYPE;
  22880. var WHITESPACE$3 = TYPE$8.WhiteSpace;
  22881. var COMMENT$1 = TYPE$8.Comment;
  22882. var ATKEYWORD = TYPE$8.AtKeyword;
  22883. var CDO = TYPE$8.CDO;
  22884. var CDC = TYPE$8.CDC;
  22885. var EXCLAMATIONMARK = 0x0021; // U+0021 EXCLAMATION MARK (!)
  22886. function consumeRaw$1(startToken) {
  22887. return this.Raw(startToken, null, false);
  22888. }
  22889. var StyleSheet = {
  22890. name: 'StyleSheet',
  22891. structure: {
  22892. children: [[
  22893. 'Comment',
  22894. 'CDO',
  22895. 'CDC',
  22896. 'Atrule',
  22897. 'Rule',
  22898. 'Raw'
  22899. ]]
  22900. },
  22901. parse: function() {
  22902. var start = this.scanner.tokenStart;
  22903. var children = this.createList();
  22904. var child;
  22905. while (!this.scanner.eof) {
  22906. switch (this.scanner.tokenType) {
  22907. case WHITESPACE$3:
  22908. this.scanner.next();
  22909. continue;
  22910. case COMMENT$1:
  22911. // ignore comments except exclamation comments (i.e. /*! .. */) on top level
  22912. if (this.scanner.source.charCodeAt(this.scanner.tokenStart + 2) !== EXCLAMATIONMARK) {
  22913. this.scanner.next();
  22914. continue;
  22915. }
  22916. child = this.Comment();
  22917. break;
  22918. case CDO: // <!--
  22919. child = this.CDO();
  22920. break;
  22921. case CDC: // -->
  22922. child = this.CDC();
  22923. break;
  22924. // CSS Syntax Module Level 3
  22925. // §2.2 Error handling
  22926. // At the "top level" of a stylesheet, an <at-keyword-token> starts an at-rule.
  22927. case ATKEYWORD:
  22928. child = this.parseWithFallback(this.Atrule, consumeRaw$1);
  22929. break;
  22930. // Anything else starts a qualified rule ...
  22931. default:
  22932. child = this.parseWithFallback(this.Rule, consumeRaw$1);
  22933. }
  22934. children.push(child);
  22935. }
  22936. return {
  22937. type: 'StyleSheet',
  22938. loc: this.getLocation(start, this.scanner.tokenStart),
  22939. children: children
  22940. };
  22941. },
  22942. generate: function(node) {
  22943. this.children(node);
  22944. },
  22945. walkContext: 'stylesheet'
  22946. };
  22947. var TYPE$7 = tokenizer$3.TYPE;
  22948. var IDENT$5 = TYPE$7.Ident;
  22949. var ASTERISK$2 = 0x002A; // U+002A ASTERISK (*)
  22950. var VERTICALLINE$1 = 0x007C; // U+007C VERTICAL LINE (|)
  22951. function eatIdentifierOrAsterisk() {
  22952. if (this.scanner.tokenType !== IDENT$5 &&
  22953. this.scanner.isDelim(ASTERISK$2) === false) {
  22954. this.error('Identifier or asterisk is expected');
  22955. }
  22956. this.scanner.next();
  22957. }
  22958. // ident
  22959. // ident|ident
  22960. // ident|*
  22961. // *
  22962. // *|ident
  22963. // *|*
  22964. // |ident
  22965. // |*
  22966. var TypeSelector = {
  22967. name: 'TypeSelector',
  22968. structure: {
  22969. name: String
  22970. },
  22971. parse: function() {
  22972. var start = this.scanner.tokenStart;
  22973. if (this.scanner.isDelim(VERTICALLINE$1)) {
  22974. this.scanner.next();
  22975. eatIdentifierOrAsterisk.call(this);
  22976. } else {
  22977. eatIdentifierOrAsterisk.call(this);
  22978. if (this.scanner.isDelim(VERTICALLINE$1)) {
  22979. this.scanner.next();
  22980. eatIdentifierOrAsterisk.call(this);
  22981. }
  22982. }
  22983. return {
  22984. type: 'TypeSelector',
  22985. loc: this.getLocation(start, this.scanner.tokenStart),
  22986. name: this.scanner.substrToCursor(start)
  22987. };
  22988. },
  22989. generate: function(node) {
  22990. this.chunk(node.name);
  22991. }
  22992. };
  22993. var isHexDigit = tokenizer$3.isHexDigit;
  22994. var cmpChar$1 = tokenizer$3.cmpChar;
  22995. var TYPE$6 = tokenizer$3.TYPE;
  22996. var NAME = tokenizer$3.NAME;
  22997. var IDENT$4 = TYPE$6.Ident;
  22998. var NUMBER$2 = TYPE$6.Number;
  22999. var DIMENSION$2 = TYPE$6.Dimension;
  23000. var PLUSSIGN$2 = 0x002B; // U+002B PLUS SIGN (+)
  23001. var HYPHENMINUS$1 = 0x002D; // U+002D HYPHEN-MINUS (-)
  23002. var QUESTIONMARK = 0x003F; // U+003F QUESTION MARK (?)
  23003. var U$1 = 0x0075; // U+0075 LATIN SMALL LETTER U (u)
  23004. function eatHexSequence(offset, allowDash) {
  23005. for (var pos = this.scanner.tokenStart + offset, len = 0; pos < this.scanner.tokenEnd; pos++) {
  23006. var code = this.scanner.source.charCodeAt(pos);
  23007. if (code === HYPHENMINUS$1 && allowDash && len !== 0) {
  23008. if (eatHexSequence.call(this, offset + len + 1, false) === 0) {
  23009. this.error();
  23010. }
  23011. return -1;
  23012. }
  23013. if (!isHexDigit(code)) {
  23014. this.error(
  23015. allowDash && len !== 0
  23016. ? 'HyphenMinus' + (len < 6 ? ' or hex digit' : '') + ' is expected'
  23017. : (len < 6 ? 'Hex digit is expected' : 'Unexpected input'),
  23018. pos
  23019. );
  23020. }
  23021. if (++len > 6) {
  23022. this.error('Too many hex digits', pos);
  23023. } }
  23024. this.scanner.next();
  23025. return len;
  23026. }
  23027. function eatQuestionMarkSequence(max) {
  23028. var count = 0;
  23029. while (this.scanner.isDelim(QUESTIONMARK)) {
  23030. if (++count > max) {
  23031. this.error('Too many question marks');
  23032. }
  23033. this.scanner.next();
  23034. }
  23035. }
  23036. function startsWith(code) {
  23037. if (this.scanner.source.charCodeAt(this.scanner.tokenStart) !== code) {
  23038. this.error(NAME[code] + ' is expected');
  23039. }
  23040. }
  23041. // https://drafts.csswg.org/css-syntax/#urange
  23042. // Informally, the <urange> production has three forms:
  23043. // U+0001
  23044. // Defines a range consisting of a single code point, in this case the code point "1".
  23045. // U+0001-00ff
  23046. // Defines a range of codepoints between the first and the second value, in this case
  23047. // the range between "1" and "ff" (255 in decimal) inclusive.
  23048. // U+00??
  23049. // Defines a range of codepoints where the "?" characters range over all hex digits,
  23050. // in this case defining the same as the value U+0000-00ff.
  23051. // In each form, a maximum of 6 digits is allowed for each hexadecimal number (if you treat "?" as a hexadecimal digit).
  23052. //
  23053. // <urange> =
  23054. // u '+' <ident-token> '?'* |
  23055. // u <dimension-token> '?'* |
  23056. // u <number-token> '?'* |
  23057. // u <number-token> <dimension-token> |
  23058. // u <number-token> <number-token> |
  23059. // u '+' '?'+
  23060. function scanUnicodeRange() {
  23061. var hexLength = 0;
  23062. // u '+' <ident-token> '?'*
  23063. // u '+' '?'+
  23064. if (this.scanner.isDelim(PLUSSIGN$2)) {
  23065. this.scanner.next();
  23066. if (this.scanner.tokenType === IDENT$4) {
  23067. hexLength = eatHexSequence.call(this, 0, true);
  23068. if (hexLength > 0) {
  23069. eatQuestionMarkSequence.call(this, 6 - hexLength);
  23070. }
  23071. return;
  23072. }
  23073. if (this.scanner.isDelim(QUESTIONMARK)) {
  23074. this.scanner.next();
  23075. eatQuestionMarkSequence.call(this, 5);
  23076. return;
  23077. }
  23078. this.error('Hex digit or question mark is expected');
  23079. return;
  23080. }
  23081. // u <number-token> '?'*
  23082. // u <number-token> <dimension-token>
  23083. // u <number-token> <number-token>
  23084. if (this.scanner.tokenType === NUMBER$2) {
  23085. startsWith.call(this, PLUSSIGN$2);
  23086. hexLength = eatHexSequence.call(this, 1, true);
  23087. if (this.scanner.isDelim(QUESTIONMARK)) {
  23088. eatQuestionMarkSequence.call(this, 6 - hexLength);
  23089. return;
  23090. }
  23091. if (this.scanner.tokenType === DIMENSION$2 ||
  23092. this.scanner.tokenType === NUMBER$2) {
  23093. startsWith.call(this, HYPHENMINUS$1);
  23094. eatHexSequence.call(this, 1, false);
  23095. return;
  23096. }
  23097. return;
  23098. }
  23099. // u <dimension-token> '?'*
  23100. if (this.scanner.tokenType === DIMENSION$2) {
  23101. startsWith.call(this, PLUSSIGN$2);
  23102. hexLength = eatHexSequence.call(this, 1, true);
  23103. if (hexLength > 0) {
  23104. eatQuestionMarkSequence.call(this, 6 - hexLength);
  23105. }
  23106. return;
  23107. }
  23108. this.error();
  23109. }
  23110. var UnicodeRange = {
  23111. name: 'UnicodeRange',
  23112. structure: {
  23113. value: String
  23114. },
  23115. parse: function() {
  23116. var start = this.scanner.tokenStart;
  23117. // U or u
  23118. if (!cmpChar$1(this.scanner.source, start, U$1)) {
  23119. this.error('U is expected');
  23120. }
  23121. if (!cmpChar$1(this.scanner.source, start + 1, PLUSSIGN$2)) {
  23122. this.error('Plus sign is expected');
  23123. }
  23124. this.scanner.next();
  23125. scanUnicodeRange.call(this);
  23126. return {
  23127. type: 'UnicodeRange',
  23128. loc: this.getLocation(start, this.scanner.tokenStart),
  23129. value: this.scanner.substrToCursor(start)
  23130. };
  23131. },
  23132. generate: function(node) {
  23133. this.chunk(node.value);
  23134. }
  23135. };
  23136. var isWhiteSpace = tokenizer$3.isWhiteSpace;
  23137. var cmpStr$1 = tokenizer$3.cmpStr;
  23138. var TYPE$5 = tokenizer$3.TYPE;
  23139. var FUNCTION$3 = TYPE$5.Function;
  23140. var URL$3 = TYPE$5.Url;
  23141. var RIGHTPARENTHESIS = TYPE$5.RightParenthesis;
  23142. // <url-token> | <function-token> <string> )
  23143. var Url = {
  23144. name: 'Url',
  23145. structure: {
  23146. value: ['String', 'Raw']
  23147. },
  23148. parse: function() {
  23149. var start = this.scanner.tokenStart;
  23150. var value;
  23151. switch (this.scanner.tokenType) {
  23152. case URL$3:
  23153. var rawStart = start + 4;
  23154. var rawEnd = this.scanner.tokenEnd - 1;
  23155. while (rawStart < rawEnd && isWhiteSpace(this.scanner.source.charCodeAt(rawStart))) {
  23156. rawStart++;
  23157. }
  23158. while (rawStart < rawEnd && isWhiteSpace(this.scanner.source.charCodeAt(rawEnd - 1))) {
  23159. rawEnd--;
  23160. }
  23161. value = {
  23162. type: 'Raw',
  23163. loc: this.getLocation(rawStart, rawEnd),
  23164. value: this.scanner.source.substring(rawStart, rawEnd)
  23165. };
  23166. this.eat(URL$3);
  23167. break;
  23168. case FUNCTION$3:
  23169. if (!cmpStr$1(this.scanner.source, this.scanner.tokenStart, this.scanner.tokenEnd, 'url(')) {
  23170. this.error('Function name must be `url`');
  23171. }
  23172. this.eat(FUNCTION$3);
  23173. this.scanner.skipSC();
  23174. value = this.String();
  23175. this.scanner.skipSC();
  23176. this.eat(RIGHTPARENTHESIS);
  23177. break;
  23178. default:
  23179. this.error('Url or Function is expected');
  23180. }
  23181. return {
  23182. type: 'Url',
  23183. loc: this.getLocation(start, this.scanner.tokenStart),
  23184. value: value
  23185. };
  23186. },
  23187. generate: function(node) {
  23188. this.chunk('url');
  23189. this.chunk('(');
  23190. this.node(node.value);
  23191. this.chunk(')');
  23192. }
  23193. };
  23194. var Value = {
  23195. name: 'Value',
  23196. structure: {
  23197. children: [[]]
  23198. },
  23199. parse: function() {
  23200. var start = this.scanner.tokenStart;
  23201. var children = this.readSequence(this.scope.Value);
  23202. return {
  23203. type: 'Value',
  23204. loc: this.getLocation(start, this.scanner.tokenStart),
  23205. children: children
  23206. };
  23207. },
  23208. generate: function(node) {
  23209. this.children(node);
  23210. }
  23211. };
  23212. var WHITESPACE$2 = tokenizer$3.TYPE.WhiteSpace;
  23213. var SPACE = Object.freeze({
  23214. type: 'WhiteSpace',
  23215. loc: null,
  23216. value: ' '
  23217. });
  23218. var WhiteSpace = {
  23219. name: 'WhiteSpace',
  23220. structure: {
  23221. value: String
  23222. },
  23223. parse: function() {
  23224. this.eat(WHITESPACE$2);
  23225. return SPACE;
  23226. // return {
  23227. // type: 'WhiteSpace',
  23228. // loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
  23229. // value: this.consume(WHITESPACE)
  23230. // };
  23231. },
  23232. generate: function(node) {
  23233. this.chunk(node.value);
  23234. }
  23235. };
  23236. var node = {
  23237. AnPlusB: AnPlusB,
  23238. Atrule: Atrule,
  23239. AtrulePrelude: AtrulePrelude,
  23240. AttributeSelector: AttributeSelector,
  23241. Block: Block,
  23242. Brackets: Brackets,
  23243. CDC: CDC_1,
  23244. CDO: CDO_1,
  23245. ClassSelector: ClassSelector,
  23246. Combinator: Combinator,
  23247. Comment: Comment,
  23248. Declaration: Declaration,
  23249. DeclarationList: DeclarationList,
  23250. Dimension: Dimension,
  23251. Function: _Function,
  23252. Hash: Hash,
  23253. Identifier: Identifier,
  23254. IdSelector: IdSelector,
  23255. MediaFeature: MediaFeature,
  23256. MediaQuery: MediaQuery,
  23257. MediaQueryList: MediaQueryList,
  23258. Nth: Nth,
  23259. Number: _Number,
  23260. Operator: Operator,
  23261. Parentheses: Parentheses,
  23262. Percentage: Percentage,
  23263. PseudoClassSelector: PseudoClassSelector,
  23264. PseudoElementSelector: PseudoElementSelector,
  23265. Ratio: Ratio,
  23266. Raw: Raw,
  23267. Rule: Rule,
  23268. Selector: Selector,
  23269. SelectorList: SelectorList,
  23270. String: _String,
  23271. StyleSheet: StyleSheet,
  23272. TypeSelector: TypeSelector,
  23273. UnicodeRange: UnicodeRange,
  23274. Url: Url,
  23275. Value: Value,
  23276. WhiteSpace: WhiteSpace
  23277. };
  23278. var data = data$1;
  23279. var lexer = {
  23280. generic: true,
  23281. types: data.types,
  23282. atrules: data.atrules,
  23283. properties: data.properties,
  23284. node: node
  23285. };
  23286. var cmpChar = tokenizer$3.cmpChar;
  23287. var cmpStr = tokenizer$3.cmpStr;
  23288. var TYPE$4 = tokenizer$3.TYPE;
  23289. var IDENT$3 = TYPE$4.Ident;
  23290. var STRING$1 = TYPE$4.String;
  23291. var NUMBER$1 = TYPE$4.Number;
  23292. var FUNCTION$2 = TYPE$4.Function;
  23293. var URL$2 = TYPE$4.Url;
  23294. var HASH$1 = TYPE$4.Hash;
  23295. var DIMENSION$1 = TYPE$4.Dimension;
  23296. var PERCENTAGE$1 = TYPE$4.Percentage;
  23297. var LEFTPARENTHESIS$2 = TYPE$4.LeftParenthesis;
  23298. var LEFTSQUAREBRACKET$1 = TYPE$4.LeftSquareBracket;
  23299. var COMMA$1 = TYPE$4.Comma;
  23300. var DELIM$1 = TYPE$4.Delim;
  23301. var NUMBERSIGN$1 = 0x0023; // U+0023 NUMBER SIGN (#)
  23302. var ASTERISK$1 = 0x002A; // U+002A ASTERISK (*)
  23303. var PLUSSIGN$1 = 0x002B; // U+002B PLUS SIGN (+)
  23304. var HYPHENMINUS = 0x002D; // U+002D HYPHEN-MINUS (-)
  23305. var SOLIDUS$1 = 0x002F; // U+002F SOLIDUS (/)
  23306. var U = 0x0075; // U+0075 LATIN SMALL LETTER U (u)
  23307. var _default = function defaultRecognizer(context) {
  23308. switch (this.scanner.tokenType) {
  23309. case HASH$1:
  23310. return this.Hash();
  23311. case COMMA$1:
  23312. context.space = null;
  23313. context.ignoreWSAfter = true;
  23314. return this.Operator();
  23315. case LEFTPARENTHESIS$2:
  23316. return this.Parentheses(this.readSequence, context.recognizer);
  23317. case LEFTSQUAREBRACKET$1:
  23318. return this.Brackets(this.readSequence, context.recognizer);
  23319. case STRING$1:
  23320. return this.String();
  23321. case DIMENSION$1:
  23322. return this.Dimension();
  23323. case PERCENTAGE$1:
  23324. return this.Percentage();
  23325. case NUMBER$1:
  23326. return this.Number();
  23327. case FUNCTION$2:
  23328. return cmpStr(this.scanner.source, this.scanner.tokenStart, this.scanner.tokenEnd, 'url(')
  23329. ? this.Url()
  23330. : this.Function(this.readSequence, context.recognizer);
  23331. case URL$2:
  23332. return this.Url();
  23333. case IDENT$3:
  23334. // check for unicode range, it should start with u+ or U+
  23335. if (cmpChar(this.scanner.source, this.scanner.tokenStart, U) &&
  23336. cmpChar(this.scanner.source, this.scanner.tokenStart + 1, PLUSSIGN$1)) {
  23337. return this.UnicodeRange();
  23338. } else {
  23339. return this.Identifier();
  23340. }
  23341. case DELIM$1:
  23342. var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
  23343. if (code === SOLIDUS$1 ||
  23344. code === ASTERISK$1 ||
  23345. code === PLUSSIGN$1 ||
  23346. code === HYPHENMINUS) {
  23347. return this.Operator(); // TODO: replace with Delim
  23348. }
  23349. // TODO: produce a node with Delim node type
  23350. if (code === NUMBERSIGN$1) {
  23351. this.error('Hex or identifier is expected', this.scanner.tokenStart + 1);
  23352. }
  23353. break;
  23354. }
  23355. };
  23356. var atrulePrelude = {
  23357. getNode: _default
  23358. };
  23359. var TYPE$3 = tokenizer$3.TYPE;
  23360. var DELIM = TYPE$3.Delim;
  23361. var IDENT$2 = TYPE$3.Ident;
  23362. var DIMENSION = TYPE$3.Dimension;
  23363. var PERCENTAGE = TYPE$3.Percentage;
  23364. var NUMBER = TYPE$3.Number;
  23365. var HASH = TYPE$3.Hash;
  23366. var COLON$1 = TYPE$3.Colon;
  23367. var LEFTSQUAREBRACKET = TYPE$3.LeftSquareBracket;
  23368. var NUMBERSIGN = 0x0023; // U+0023 NUMBER SIGN (#)
  23369. var ASTERISK = 0x002A; // U+002A ASTERISK (*)
  23370. var PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
  23371. var SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
  23372. var FULLSTOP = 0x002E; // U+002E FULL STOP (.)
  23373. var GREATERTHANSIGN = 0x003E; // U+003E GREATER-THAN SIGN (>)
  23374. var VERTICALLINE = 0x007C; // U+007C VERTICAL LINE (|)
  23375. var TILDE = 0x007E; // U+007E TILDE (~)
  23376. function getNode(context) {
  23377. switch (this.scanner.tokenType) {
  23378. case LEFTSQUAREBRACKET:
  23379. return this.AttributeSelector();
  23380. case HASH:
  23381. return this.IdSelector();
  23382. case COLON$1:
  23383. if (this.scanner.lookupType(1) === COLON$1) {
  23384. return this.PseudoElementSelector();
  23385. } else {
  23386. return this.PseudoClassSelector();
  23387. }
  23388. case IDENT$2:
  23389. return this.TypeSelector();
  23390. case NUMBER:
  23391. case PERCENTAGE:
  23392. return this.Percentage();
  23393. case DIMENSION:
  23394. // throws when .123ident
  23395. if (this.scanner.source.charCodeAt(this.scanner.tokenStart) === FULLSTOP) {
  23396. this.error('Identifier is expected', this.scanner.tokenStart + 1);
  23397. }
  23398. break;
  23399. case DELIM:
  23400. var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
  23401. switch (code) {
  23402. case PLUSSIGN:
  23403. case GREATERTHANSIGN:
  23404. case TILDE:
  23405. context.space = null;
  23406. context.ignoreWSAfter = true;
  23407. return this.Combinator();
  23408. case SOLIDUS: // /deep/
  23409. return this.Combinator();
  23410. case FULLSTOP:
  23411. return this.ClassSelector();
  23412. case ASTERISK:
  23413. case VERTICALLINE:
  23414. return this.TypeSelector();
  23415. case NUMBERSIGN:
  23416. return this.IdSelector();
  23417. }
  23418. break;
  23419. }
  23420. }
  23421. var selector = {
  23422. getNode: getNode
  23423. };
  23424. // legacy IE function
  23425. // expression( <any-value> )
  23426. var expression = function() {
  23427. return this.createSingleNodeList(
  23428. this.Raw(this.scanner.tokenIndex, null, false)
  23429. );
  23430. };
  23431. var TYPE$2 = tokenizer$3.TYPE;
  23432. var rawMode = Raw.mode;
  23433. var COMMA = TYPE$2.Comma;
  23434. var WHITESPACE$1 = TYPE$2.WhiteSpace;
  23435. // var( <ident> , <value>? )
  23436. var _var = function() {
  23437. var children = this.createList();
  23438. this.scanner.skipSC();
  23439. // NOTE: Don't check more than a first argument is an ident, rest checks are for lexer
  23440. children.push(this.Identifier());
  23441. this.scanner.skipSC();
  23442. if (this.scanner.tokenType === COMMA) {
  23443. children.push(this.Operator());
  23444. const startIndex = this.scanner.tokenIndex;
  23445. const value = this.parseCustomProperty
  23446. ? this.Value(null)
  23447. : this.Raw(this.scanner.tokenIndex, rawMode.exclamationMarkOrSemicolon, false);
  23448. if (value.type === 'Value' && value.children.isEmpty()) {
  23449. for (let offset = startIndex - this.scanner.tokenIndex; offset <= 0; offset++) {
  23450. if (this.scanner.lookupType(offset) === WHITESPACE$1) {
  23451. value.children.appendData({
  23452. type: 'WhiteSpace',
  23453. loc: null,
  23454. value: ' '
  23455. });
  23456. break;
  23457. }
  23458. }
  23459. }
  23460. children.push(value);
  23461. }
  23462. return children;
  23463. };
  23464. var value$2 = {
  23465. getNode: _default,
  23466. 'expression': expression,
  23467. 'var': _var
  23468. };
  23469. var scope = {
  23470. AtrulePrelude: atrulePrelude,
  23471. Selector: selector,
  23472. Value: value$2
  23473. };
  23474. var fontFace = {
  23475. parse: {
  23476. prelude: null,
  23477. block: function() {
  23478. return this.Block(true);
  23479. }
  23480. }
  23481. };
  23482. var TYPE$1 = tokenizer$3.TYPE;
  23483. var STRING = TYPE$1.String;
  23484. var IDENT$1 = TYPE$1.Ident;
  23485. var URL$1 = TYPE$1.Url;
  23486. var FUNCTION$1 = TYPE$1.Function;
  23487. var LEFTPARENTHESIS$1 = TYPE$1.LeftParenthesis;
  23488. var _import = {
  23489. parse: {
  23490. prelude: function() {
  23491. var children = this.createList();
  23492. this.scanner.skipSC();
  23493. switch (this.scanner.tokenType) {
  23494. case STRING:
  23495. children.push(this.String());
  23496. break;
  23497. case URL$1:
  23498. case FUNCTION$1:
  23499. children.push(this.Url());
  23500. break;
  23501. default:
  23502. this.error('String or url() is expected');
  23503. }
  23504. if (this.lookupNonWSType(0) === IDENT$1 ||
  23505. this.lookupNonWSType(0) === LEFTPARENTHESIS$1) {
  23506. children.push(this.WhiteSpace());
  23507. children.push(this.MediaQueryList());
  23508. }
  23509. return children;
  23510. },
  23511. block: null
  23512. }
  23513. };
  23514. var media = {
  23515. parse: {
  23516. prelude: function() {
  23517. return this.createSingleNodeList(
  23518. this.MediaQueryList()
  23519. );
  23520. },
  23521. block: function() {
  23522. return this.Block(false);
  23523. }
  23524. }
  23525. };
  23526. var page = {
  23527. parse: {
  23528. prelude: function() {
  23529. return this.createSingleNodeList(
  23530. this.SelectorList()
  23531. );
  23532. },
  23533. block: function() {
  23534. return this.Block(true);
  23535. }
  23536. }
  23537. };
  23538. var TYPE = tokenizer$3.TYPE;
  23539. var WHITESPACE = TYPE.WhiteSpace;
  23540. var COMMENT = TYPE.Comment;
  23541. var IDENT = TYPE.Ident;
  23542. var FUNCTION = TYPE.Function;
  23543. var COLON = TYPE.Colon;
  23544. var LEFTPARENTHESIS = TYPE.LeftParenthesis;
  23545. function consumeRaw() {
  23546. return this.createSingleNodeList(
  23547. this.Raw(this.scanner.tokenIndex, null, false)
  23548. );
  23549. }
  23550. function parentheses() {
  23551. this.scanner.skipSC();
  23552. if (this.scanner.tokenType === IDENT &&
  23553. this.lookupNonWSType(1) === COLON) {
  23554. return this.createSingleNodeList(
  23555. this.Declaration()
  23556. );
  23557. }
  23558. return readSequence.call(this);
  23559. }
  23560. function readSequence() {
  23561. var children = this.createList();
  23562. var space = null;
  23563. var child;
  23564. this.scanner.skipSC();
  23565. scan:
  23566. while (!this.scanner.eof) {
  23567. switch (this.scanner.tokenType) {
  23568. case WHITESPACE:
  23569. space = this.WhiteSpace();
  23570. continue;
  23571. case COMMENT:
  23572. this.scanner.next();
  23573. continue;
  23574. case FUNCTION:
  23575. child = this.Function(consumeRaw, this.scope.AtrulePrelude);
  23576. break;
  23577. case IDENT:
  23578. child = this.Identifier();
  23579. break;
  23580. case LEFTPARENTHESIS:
  23581. child = this.Parentheses(parentheses, this.scope.AtrulePrelude);
  23582. break;
  23583. default:
  23584. break scan;
  23585. }
  23586. if (space !== null) {
  23587. children.push(space);
  23588. space = null;
  23589. }
  23590. children.push(child);
  23591. }
  23592. return children;
  23593. }
  23594. var supports = {
  23595. parse: {
  23596. prelude: function() {
  23597. var children = readSequence.call(this);
  23598. if (this.getFirstListNode(children) === null) {
  23599. this.error('Condition is expected');
  23600. }
  23601. return children;
  23602. },
  23603. block: function() {
  23604. return this.Block(false);
  23605. }
  23606. }
  23607. };
  23608. var atrule = {
  23609. 'font-face': fontFace,
  23610. 'import': _import,
  23611. 'media': media,
  23612. 'page': page,
  23613. 'supports': supports
  23614. };
  23615. var dir = {
  23616. parse: function() {
  23617. return this.createSingleNodeList(
  23618. this.Identifier()
  23619. );
  23620. }
  23621. };
  23622. var has = {
  23623. parse: function() {
  23624. return this.createSingleNodeList(
  23625. this.SelectorList()
  23626. );
  23627. }
  23628. };
  23629. var lang = {
  23630. parse: function() {
  23631. return this.createSingleNodeList(
  23632. this.Identifier()
  23633. );
  23634. }
  23635. };
  23636. var selectorList = {
  23637. parse: function selectorList() {
  23638. return this.createSingleNodeList(
  23639. this.SelectorList()
  23640. );
  23641. }
  23642. };
  23643. var matches = selectorList;
  23644. var not = selectorList;
  23645. var ALLOW_OF_CLAUSE = true;
  23646. var nthWithOfClause = {
  23647. parse: function nthWithOfClause() {
  23648. return this.createSingleNodeList(
  23649. this.Nth(ALLOW_OF_CLAUSE)
  23650. );
  23651. }
  23652. };
  23653. var nthChild = nthWithOfClause;
  23654. var nthLastChild = nthWithOfClause;
  23655. var DISALLOW_OF_CLAUSE = false;
  23656. var nth = {
  23657. parse: function nth() {
  23658. return this.createSingleNodeList(
  23659. this.Nth(DISALLOW_OF_CLAUSE)
  23660. );
  23661. }
  23662. };
  23663. var nthLastOfType = nth;
  23664. var nthOfType = nth;
  23665. var slotted = {
  23666. parse: function compoundSelector() {
  23667. return this.createSingleNodeList(
  23668. this.Selector()
  23669. );
  23670. }
  23671. };
  23672. var pseudo = {
  23673. 'dir': dir,
  23674. 'has': has,
  23675. 'lang': lang,
  23676. 'matches': matches,
  23677. 'not': not,
  23678. 'nth-child': nthChild,
  23679. 'nth-last-child': nthLastChild,
  23680. 'nth-last-of-type': nthLastOfType,
  23681. 'nth-of-type': nthOfType,
  23682. 'slotted': slotted
  23683. };
  23684. var parser = {
  23685. parseContext: {
  23686. default: 'StyleSheet',
  23687. stylesheet: 'StyleSheet',
  23688. atrule: 'Atrule',
  23689. atrulePrelude: function(options) {
  23690. return this.AtrulePrelude(options.atrule ? String(options.atrule) : null);
  23691. },
  23692. mediaQueryList: 'MediaQueryList',
  23693. mediaQuery: 'MediaQuery',
  23694. rule: 'Rule',
  23695. selectorList: 'SelectorList',
  23696. selector: 'Selector',
  23697. block: function() {
  23698. return this.Block(true);
  23699. },
  23700. declarationList: 'DeclarationList',
  23701. declaration: 'Declaration',
  23702. value: 'Value'
  23703. },
  23704. scope: scope,
  23705. atrule: atrule,
  23706. pseudo: pseudo,
  23707. node: node
  23708. };
  23709. var walker = {
  23710. node: node
  23711. };
  23712. var _args = [
  23713. [
  23714. "css-tree@1.1.3",
  23715. "/home/gitlab-runner/builds/BQJy2NwB/0/pagedjs/pagedjs"
  23716. ]
  23717. ];
  23718. var _from = "css-tree@1.1.3";
  23719. var _id = "css-tree@1.1.3";
  23720. var _inBundle = false;
  23721. var _integrity = "sha512-tRpdppF7TRazZrjJ6v3stzv93qxRcSsFmW6cX0Zm2NVKpxE1WV1HblnghVv9TreireHkqI/VDEsfolRF1p6y7Q==";
  23722. var _location = "/css-tree";
  23723. var _phantomChildren = {
  23724. };
  23725. var _requested = {
  23726. type: "version",
  23727. registry: true,
  23728. raw: "css-tree@1.1.3",
  23729. name: "css-tree",
  23730. escapedName: "css-tree",
  23731. rawSpec: "1.1.3",
  23732. saveSpec: null,
  23733. fetchSpec: "1.1.3"
  23734. };
  23735. var _requiredBy = [
  23736. "/"
  23737. ];
  23738. var _resolved = "https://registry.npmjs.org/css-tree/-/css-tree-1.1.3.tgz";
  23739. var _spec = "1.1.3";
  23740. var _where = "/home/gitlab-runner/builds/BQJy2NwB/0/pagedjs/pagedjs";
  23741. var author = {
  23742. name: "Roman Dvornov",
  23743. email: "rdvornov@gmail.com",
  23744. url: "https://github.com/lahmatiy"
  23745. };
  23746. var bugs = {
  23747. url: "https://github.com/csstree/csstree/issues"
  23748. };
  23749. var dependencies = {
  23750. "mdn-data": "2.0.14",
  23751. "source-map": "^0.6.1"
  23752. };
  23753. var description = "A tool set for CSS: fast detailed parser (CSS → AST), walker (AST traversal), generator (AST → CSS) and lexer (validation and matching) based on specs and browser implementations";
  23754. var devDependencies = {
  23755. "@rollup/plugin-commonjs": "^11.0.2",
  23756. "@rollup/plugin-json": "^4.0.2",
  23757. "@rollup/plugin-node-resolve": "^7.1.1",
  23758. coveralls: "^3.0.9",
  23759. eslint: "^6.8.0",
  23760. "json-to-ast": "^2.1.0",
  23761. mocha: "^6.2.3",
  23762. nyc: "^14.1.1",
  23763. rollup: "^1.32.1",
  23764. "rollup-plugin-terser": "^5.3.0"
  23765. };
  23766. var engines = {
  23767. node: ">=8.0.0"
  23768. };
  23769. var files = [
  23770. "data",
  23771. "dist",
  23772. "lib"
  23773. ];
  23774. var homepage = "https://github.com/csstree/csstree#readme";
  23775. var jsdelivr = "dist/csstree.min.js";
  23776. var keywords = [
  23777. "css",
  23778. "ast",
  23779. "tokenizer",
  23780. "parser",
  23781. "walker",
  23782. "lexer",
  23783. "generator",
  23784. "utils",
  23785. "syntax",
  23786. "validation"
  23787. ];
  23788. var license = "MIT";
  23789. var main = "lib/index.js";
  23790. var name = "css-tree";
  23791. var repository = {
  23792. type: "git",
  23793. url: "git+https://github.com/csstree/csstree.git"
  23794. };
  23795. var scripts = {
  23796. build: "rollup --config",
  23797. coverage: "nyc npm test",
  23798. coveralls: "nyc report --reporter=text-lcov | coveralls",
  23799. hydrogen: "node --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces --redirect-code-traces-to=code.asm --trace_hydrogen_file=code.cfg --print-opt-code bin/parse --stat -o /dev/null",
  23800. lint: "eslint data lib scripts test && node scripts/review-syntax-patch --lint && node scripts/update-docs --lint",
  23801. "lint-and-test": "npm run lint && npm test",
  23802. prepublishOnly: "npm run build",
  23803. "review:syntax-patch": "node scripts/review-syntax-patch",
  23804. test: "mocha --reporter progress",
  23805. travis: "nyc npm run lint-and-test && npm run coveralls",
  23806. "update:docs": "node scripts/update-docs"
  23807. };
  23808. var unpkg = "dist/csstree.min.js";
  23809. var version = "1.1.3";
  23810. var require$$4 = {
  23811. _args: _args,
  23812. _from: _from,
  23813. _id: _id,
  23814. _inBundle: _inBundle,
  23815. _integrity: _integrity,
  23816. _location: _location,
  23817. _phantomChildren: _phantomChildren,
  23818. _requested: _requested,
  23819. _requiredBy: _requiredBy,
  23820. _resolved: _resolved,
  23821. _spec: _spec,
  23822. _where: _where,
  23823. author: author,
  23824. bugs: bugs,
  23825. dependencies: dependencies,
  23826. description: description,
  23827. devDependencies: devDependencies,
  23828. engines: engines,
  23829. files: files,
  23830. homepage: homepage,
  23831. jsdelivr: jsdelivr,
  23832. keywords: keywords,
  23833. license: license,
  23834. main: main,
  23835. name: name,
  23836. repository: repository,
  23837. scripts: scripts,
  23838. unpkg: unpkg,
  23839. version: version
  23840. };
  23841. function merge() {
  23842. var dest = {};
  23843. for (var i = 0; i < arguments.length; i++) {
  23844. var src = arguments[i];
  23845. for (var key in src) {
  23846. dest[key] = src[key];
  23847. }
  23848. }
  23849. return dest;
  23850. }
  23851. syntax.exports = create$4.create(
  23852. merge(
  23853. lexer,
  23854. parser,
  23855. walker
  23856. )
  23857. );
  23858. syntax.exports.version = require$$4.version;
  23859. var syntaxExports = syntax.exports;
  23860. var lib = syntaxExports;
  23861. var csstree = /*@__PURE__*/getDefaultExportFromCjs(lib);
  23862. class Sheet {
  23863. constructor(url, hooks) {
  23864. if (hooks) {
  23865. this.hooks = hooks;
  23866. } else {
  23867. this.hooks = {};
  23868. this.hooks.onUrl = new Hook(this);
  23869. this.hooks.onAtPage = new Hook(this);
  23870. this.hooks.onAtMedia = new Hook(this);
  23871. this.hooks.onRule = new Hook(this);
  23872. this.hooks.onDeclaration = new Hook(this);
  23873. this.hooks.onSelector = new Hook(this);
  23874. this.hooks.onPseudoSelector = new Hook(this);
  23875. this.hooks.onContent = new Hook(this);
  23876. this.hooks.onImport = new Hook(this);
  23877. this.hooks.beforeTreeParse = new Hook(this);
  23878. this.hooks.beforeTreeWalk = new Hook(this);
  23879. this.hooks.afterTreeWalk = new Hook(this);
  23880. }
  23881. try {
  23882. this.url = new URL(url, window.location.href);
  23883. } catch (e) {
  23884. this.url = new URL(window.location.href);
  23885. }
  23886. }
  23887. // parse
  23888. async parse(text) {
  23889. this.text = text;
  23890. await this.hooks.beforeTreeParse.trigger(this.text, this);
  23891. // send to csstree
  23892. this.ast = csstree.parse(this._text);
  23893. await this.hooks.beforeTreeWalk.trigger(this.ast);
  23894. // Replace urls
  23895. this.replaceUrls(this.ast);
  23896. // Scope
  23897. this.id = UUID();
  23898. // this.addScope(this.ast, this.uuid);
  23899. // Replace IDs with data-id
  23900. this.replaceIds(this.ast);
  23901. this.imported = [];
  23902. // Trigger Hooks
  23903. this.urls(this.ast);
  23904. this.rules(this.ast);
  23905. this.atrules(this.ast);
  23906. await this.hooks.afterTreeWalk.trigger(this.ast, this);
  23907. // return ast
  23908. return this.ast;
  23909. }
  23910. insertRule(rule) {
  23911. let inserted = this.ast.children.appendData(rule);
  23912. this.declarations(rule);
  23913. return inserted;
  23914. }
  23915. urls(ast) {
  23916. csstree.walk(ast, {
  23917. visit: "Url",
  23918. enter: (node, item, list) => {
  23919. this.hooks.onUrl.trigger(node, item, list);
  23920. }
  23921. });
  23922. }
  23923. atrules(ast) {
  23924. csstree.walk(ast, {
  23925. visit: "Atrule",
  23926. enter: (node, item, list) => {
  23927. const basename = csstree.keyword(node.name).basename;
  23928. if (basename === "page") {
  23929. this.hooks.onAtPage.trigger(node, item, list);
  23930. this.declarations(node, item, list);
  23931. }
  23932. if (basename === "media") {
  23933. this.hooks.onAtMedia.trigger(node, item, list);
  23934. this.declarations(node, item, list);
  23935. }
  23936. if (basename === "import") {
  23937. this.hooks.onImport.trigger(node, item, list);
  23938. this.imports(node, item, list);
  23939. }
  23940. }
  23941. });
  23942. }
  23943. rules(ast) {
  23944. csstree.walk(ast, {
  23945. visit: "Rule",
  23946. enter: (ruleNode, ruleItem, rulelist) => {
  23947. this.hooks.onRule.trigger(ruleNode, ruleItem, rulelist);
  23948. this.declarations(ruleNode, ruleItem, rulelist);
  23949. this.onSelector(ruleNode, ruleItem, rulelist);
  23950. }
  23951. });
  23952. }
  23953. declarations(ruleNode, ruleItem, rulelist) {
  23954. csstree.walk(ruleNode, {
  23955. visit: "Declaration",
  23956. enter: (declarationNode, dItem, dList) => {
  23957. this.hooks.onDeclaration.trigger(declarationNode, dItem, dList, {ruleNode, ruleItem, rulelist});
  23958. if (declarationNode.property === "content") {
  23959. csstree.walk(declarationNode, {
  23960. visit: "Function",
  23961. enter: (funcNode, fItem, fList) => {
  23962. this.hooks.onContent.trigger(funcNode, fItem, fList, {declarationNode, dItem, dList}, {ruleNode, ruleItem, rulelist});
  23963. }
  23964. });
  23965. }
  23966. }
  23967. });
  23968. }
  23969. // add pseudo elements to parser
  23970. onSelector(ruleNode, ruleItem, rulelist) {
  23971. csstree.walk(ruleNode, {
  23972. visit: "Selector",
  23973. enter: (selectNode, selectItem, selectList) => {
  23974. this.hooks.onSelector.trigger(selectNode, selectItem, selectList, {ruleNode, ruleItem, rulelist});
  23975. if (selectNode.children.forEach(node => {if (node.type === "PseudoElementSelector") {
  23976. csstree.walk(node, {
  23977. visit: "PseudoElementSelector",
  23978. enter: (pseudoNode, pItem, pList) => {
  23979. this.hooks.onPseudoSelector.trigger(pseudoNode, pItem, pList, {selectNode, selectItem, selectList}, {ruleNode, ruleItem, rulelist});
  23980. }
  23981. });
  23982. }}));
  23983. }
  23984. });
  23985. }
  23986. replaceUrls(ast) {
  23987. csstree.walk(ast, {
  23988. visit: "Url",
  23989. enter: (node, item, list) => {
  23990. let content = node.value.value;
  23991. if ((node.value.type === "Raw" && content.startsWith("data:")) || (node.value.type === "String" && (content.startsWith("\"data:") || content.startsWith("'data:")))) ; else {
  23992. let href = content.replace(/["']/g, "");
  23993. let url = new URL(href, this.url);
  23994. node.value.value = url.toString();
  23995. }
  23996. }
  23997. });
  23998. }
  23999. addScope(ast, id) {
  24000. // Get all selector lists
  24001. // add an id
  24002. csstree.walk(ast, {
  24003. visit: "Selector",
  24004. enter: (node, item, list) => {
  24005. let children = node.children;
  24006. children.prepend(children.createItem({
  24007. type: "WhiteSpace",
  24008. value: " "
  24009. }));
  24010. children.prepend(children.createItem({
  24011. type: "IdSelector",
  24012. name: id,
  24013. loc: null,
  24014. children: null
  24015. }));
  24016. }
  24017. });
  24018. }
  24019. getNamedPageSelectors(ast) {
  24020. let namedPageSelectors = {};
  24021. csstree.walk(ast, {
  24022. visit: "Rule",
  24023. enter: (node, item, list) => {
  24024. csstree.walk(node, {
  24025. visit: "Declaration",
  24026. enter: (declaration, dItem, dList) => {
  24027. if (declaration.property === "page") {
  24028. let value = declaration.value.children.first();
  24029. let name = value.name;
  24030. let selector = csstree.generate(node.prelude);
  24031. namedPageSelectors[name] = {
  24032. name: name,
  24033. selector: selector
  24034. };
  24035. // dList.remove(dItem);
  24036. // Add in page break
  24037. declaration.property = "break-before";
  24038. value.type = "Identifier";
  24039. value.name = "always";
  24040. }
  24041. }
  24042. });
  24043. }
  24044. });
  24045. return namedPageSelectors;
  24046. }
  24047. replaceIds(ast) {
  24048. csstree.walk(ast, {
  24049. visit: "Rule",
  24050. enter: (node, item, list) => {
  24051. csstree.walk(node, {
  24052. visit: "IdSelector",
  24053. enter: (idNode, idItem, idList) => {
  24054. let name = idNode.name;
  24055. idNode.flags = null;
  24056. idNode.matcher = "=";
  24057. idNode.name = {type: "Identifier", loc: null, name: "data-id"};
  24058. idNode.type = "AttributeSelector";
  24059. idNode.value = {type: "String", loc: null, value: `"${name}"`};
  24060. }
  24061. });
  24062. }
  24063. });
  24064. }
  24065. imports(node, item, list) {
  24066. // console.log("import", node, item, list);
  24067. let queries = [];
  24068. csstree.walk(node, {
  24069. visit: "MediaQuery",
  24070. enter: (mqNode, mqItem, mqList) => {
  24071. csstree.walk(mqNode, {
  24072. visit: "Identifier",
  24073. enter: (identNode, identItem, identList) => {
  24074. queries.push(identNode.name);
  24075. }
  24076. });
  24077. }
  24078. });
  24079. // Just basic media query support for now
  24080. let shouldNotApply = queries.some((query, index) => {
  24081. let q = query;
  24082. if (q === "not") {
  24083. q = queries[index + 1];
  24084. return !(q === "screen" || q === "speech");
  24085. } else {
  24086. return (q === "screen" || q === "speech");
  24087. }
  24088. });
  24089. if (shouldNotApply) {
  24090. return;
  24091. }
  24092. csstree.walk(node, {
  24093. visit: "String",
  24094. enter: (urlNode, urlItem, urlList) => {
  24095. let href = urlNode.value.replace(/["']/g, "");
  24096. let url = new URL(href, this.url);
  24097. let value = url.toString();
  24098. this.imported.push(value);
  24099. // Remove the original
  24100. list.remove(item);
  24101. }
  24102. });
  24103. }
  24104. set text(t) {
  24105. this._text = t;
  24106. }
  24107. get text() {
  24108. return this._text;
  24109. }
  24110. // generate string
  24111. toString(ast) {
  24112. return csstree.generate(ast || this.ast);
  24113. }
  24114. }
  24115. var baseStyles = `
  24116. :root {
  24117. --pagedjs-width: 8.5in;
  24118. --pagedjs-height: 11in;
  24119. --pagedjs-width-right: 8.5in;
  24120. --pagedjs-height-right: 11in;
  24121. --pagedjs-width-left: 8.5in;
  24122. --pagedjs-height-left: 11in;
  24123. --pagedjs-pagebox-width: 8.5in;
  24124. --pagedjs-pagebox-height: 11in;
  24125. --pagedjs-footnotes-height: 0mm;
  24126. --pagedjs-margin-top: 1in;
  24127. --pagedjs-margin-right: 1in;
  24128. --pagedjs-margin-bottom: 1in;
  24129. --pagedjs-margin-left: 1in;
  24130. --pagedjs-padding-top: 0mm;
  24131. --pagedjs-padding-right: 0mm;
  24132. --pagedjs-padding-bottom: 0mm;
  24133. --pagedjs-padding-left: 0mm;
  24134. --pagedjs-border-top: 0mm;
  24135. --pagedjs-border-right: 0mm;
  24136. --pagedjs-border-bottom: 0mm;
  24137. --pagedjs-border-left: 0mm;
  24138. --pagedjs-bleed-top: 0mm;
  24139. --pagedjs-bleed-right: 0mm;
  24140. --pagedjs-bleed-bottom: 0mm;
  24141. --pagedjs-bleed-left: 0mm;
  24142. --pagedjs-bleed-right-top: 0mm;
  24143. --pagedjs-bleed-right-right: 0mm;
  24144. --pagedjs-bleed-right-bottom: 0mm;
  24145. --pagedjs-bleed-right-left: 0mm;
  24146. --pagedjs-bleed-left-top: 0mm;
  24147. --pagedjs-bleed-left-right: 0mm;
  24148. --pagedjs-bleed-left-bottom: 0mm;
  24149. --pagedjs-bleed-left-left: 0mm;
  24150. --pagedjs-crop-color: black;
  24151. --pagedjs-crop-shadow: white;
  24152. --pagedjs-crop-offset: 2mm;
  24153. --pagedjs-crop-stroke: 1px;
  24154. --pagedjs-cross-size: 5mm;
  24155. --pagedjs-mark-cross-display: none;
  24156. --pagedjs-mark-crop-display: none;
  24157. --pagedjs-page-count: 0;
  24158. --pagedjs-page-counter-increment: 1;
  24159. --pagedjs-footnotes-count: 0;
  24160. --pagedjs-column-gap-offset: 1000px;
  24161. }
  24162. @page {
  24163. size: letter;
  24164. margin: 0;
  24165. }
  24166. .pagedjs_sheet {
  24167. box-sizing: border-box;
  24168. width: var(--pagedjs-width);
  24169. height: var(--pagedjs-height);
  24170. overflow: hidden;
  24171. position: relative;
  24172. display: grid;
  24173. grid-template-columns: [bleed-left] var(--pagedjs-bleed-left) [sheet-center] calc(var(--pagedjs-width) - var(--pagedjs-bleed-left) - var(--pagedjs-bleed-right)) [bleed-right] var(--pagedjs-bleed-right);
  24174. grid-template-rows: [bleed-top] var(--pagedjs-bleed-top) [sheet-middle] calc(var(--pagedjs-height) - var(--pagedjs-bleed-top) - var(--pagedjs-bleed-bottom)) [bleed-bottom] var(--pagedjs-bleed-bottom);
  24175. }
  24176. .pagedjs_right_page .pagedjs_sheet {
  24177. width: var(--pagedjs-width-right);
  24178. height: var(--pagedjs-height-right);
  24179. grid-template-columns: [bleed-left] var(--pagedjs-bleed-right-left) [sheet-center] calc(var(--pagedjs-width) - var(--pagedjs-bleed-right-left) - var(--pagedjs-bleed-right-right)) [bleed-right] var(--pagedjs-bleed-right-right);
  24180. grid-template-rows: [bleed-top] var(--pagedjs-bleed-right-top) [sheet-middle] calc(var(--pagedjs-height) - var(--pagedjs-bleed-right-top) - var(--pagedjs-bleed-right-bottom)) [bleed-bottom] var(--pagedjs-bleed-right-bottom);
  24181. }
  24182. .pagedjs_left_page .pagedjs_sheet {
  24183. width: var(--pagedjs-width-left);
  24184. height: var(--pagedjs-height-left);
  24185. grid-template-columns: [bleed-left] var(--pagedjs-bleed-left-left) [sheet-center] calc(var(--pagedjs-width) - var(--pagedjs-bleed-left-left) - var(--pagedjs-bleed-left-right)) [bleed-right] var(--pagedjs-bleed-left-right);
  24186. grid-template-rows: [bleed-top] var(--pagedjs-bleed-left-top) [sheet-middle] calc(var(--pagedjs-height) - var(--pagedjs-bleed-left-top) - var(--pagedjs-bleed-left-bottom)) [bleed-bottom] var(--pagedjs-bleed-left-bottom);
  24187. }
  24188. .pagedjs_bleed {
  24189. display: flex;
  24190. align-items: center;
  24191. justify-content: center;
  24192. flex-wrap: nowrap;
  24193. overflow: hidden;
  24194. }
  24195. .pagedjs_bleed-top {
  24196. grid-column: bleed-left / -1;
  24197. grid-row: bleed-top;
  24198. flex-direction: row;
  24199. }
  24200. .pagedjs_bleed-bottom {
  24201. grid-column: bleed-left / -1;
  24202. grid-row: bleed-bottom;
  24203. flex-direction: row;
  24204. }
  24205. .pagedjs_bleed-left {
  24206. grid-column: bleed-left;
  24207. grid-row: bleed-top / -1;
  24208. flex-direction: column;
  24209. }
  24210. .pagedjs_bleed-right {
  24211. grid-column: bleed-right;
  24212. grid-row: bleed-top / -1;
  24213. flex-direction: column;
  24214. }
  24215. .pagedjs_marks-crop {
  24216. display: var(--pagedjs-mark-crop-display);
  24217. flex-grow: 0;
  24218. flex-shrink: 0;
  24219. z-index: 9999999999;
  24220. }
  24221. .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(1),
  24222. .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(1) {
  24223. width: calc(var(--pagedjs-bleed-left) - var(--pagedjs-crop-stroke));
  24224. border-right: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color);
  24225. box-shadow: 1px 0px 0px 0px var(--pagedjs-crop-shadow);
  24226. }
  24227. .pagedjs_right_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(1),
  24228. .pagedjs_right_page .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(1) {
  24229. width: calc(var(--pagedjs-bleed-right-left) - var(--pagedjs-crop-stroke));
  24230. }
  24231. .pagedjs_left_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(1),
  24232. .pagedjs_left_page .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(1) {
  24233. width: calc(var(--pagedjs-bleed-left-left) - var(--pagedjs-crop-stroke));
  24234. }
  24235. .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(3),
  24236. .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(3) {
  24237. width: calc(var(--pagedjs-bleed-right) - var(--pagedjs-crop-stroke));
  24238. border-left: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color);
  24239. box-shadow: -1px 0px 0px 0px var(--pagedjs-crop-shadow);
  24240. }
  24241. .pagedjs_right_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(3),
  24242. .pagedjs_right_page .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(3) {
  24243. width: calc(var(--pagedjs-bleed-right-right) - var(--pagedjs-crop-stroke));
  24244. }
  24245. .pagedjs_left_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(3),
  24246. .pagedjs_left_page .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(3) {
  24247. width: calc(var(--pagedjs-bleed-left-right) - var(--pagedjs-crop-stroke));
  24248. }
  24249. .pagedjs_bleed-top .pagedjs_marks-crop {
  24250. align-self: flex-start;
  24251. height: calc(var(--pagedjs-bleed-top) - var(--pagedjs-crop-offset));
  24252. }
  24253. .pagedjs_right_page .pagedjs_bleed-top .pagedjs_marks-crop {
  24254. height: calc(var(--pagedjs-bleed-right-top) - var(--pagedjs-crop-offset));
  24255. }
  24256. .pagedjs_left_page .pagedjs_bleed-top .pagedjs_marks-crop {
  24257. height: calc(var(--pagedjs-bleed-left-top) - var(--pagedjs-crop-offset));
  24258. }
  24259. .pagedjs_bleed-bottom .pagedjs_marks-crop {
  24260. align-self: flex-end;
  24261. height: calc(var(--pagedjs-bleed-bottom) - var(--pagedjs-crop-offset));
  24262. }
  24263. .pagedjs_right_page .pagedjs_bleed-bottom .pagedjs_marks-crop {
  24264. height: calc(var(--pagedjs-bleed-right-bottom) - var(--pagedjs-crop-offset));
  24265. }
  24266. .pagedjs_left_page .pagedjs_bleed-bottom .pagedjs_marks-crop {
  24267. height: calc(var(--pagedjs-bleed-left-bottom) - var(--pagedjs-crop-offset));
  24268. }
  24269. .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(1),
  24270. .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(1) {
  24271. height: calc(var(--pagedjs-bleed-top) - var(--pagedjs-crop-stroke));
  24272. border-bottom: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color);
  24273. box-shadow: 0px 1px 0px 0px var(--pagedjs-crop-shadow);
  24274. }
  24275. .pagedjs_right_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(1),
  24276. .pagedjs_right_page .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(1) {
  24277. height: calc(var(--pagedjs-bleed-right-top) - var(--pagedjs-crop-stroke));
  24278. }
  24279. .pagedjs_left_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(1),
  24280. .pagedjs_left_page .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(1) {
  24281. height: calc(var(--pagedjs-bleed-left-top) - var(--pagedjs-crop-stroke));
  24282. }
  24283. .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(3),
  24284. .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(3) {
  24285. height: calc(var(--pagedjs-bleed-bottom) - var(--pagedjs-crop-stroke));
  24286. border-top: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color);
  24287. box-shadow: 0px -1px 0px 0px var(--pagedjs-crop-shadow);
  24288. }
  24289. .pagedjs_right_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(3),
  24290. .pagedjs_right_page .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(3) {
  24291. height: calc(var(--pagedjs-bleed-right-bottom) - var(--pagedjs-crop-stroke));
  24292. }
  24293. .pagedjs_left_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(3),
  24294. .pagedjs_left_page .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(3) {
  24295. height: calc(var(--pagedjs-bleed-left-bottom) - var(--pagedjs-crop-stroke));
  24296. }
  24297. .pagedjs_bleed-left .pagedjs_marks-crop {
  24298. width: calc(var(--pagedjs-bleed-left) - var(--pagedjs-crop-offset));
  24299. align-self: flex-start;
  24300. }
  24301. .pagedjs_right_page .pagedjs_bleed-left .pagedjs_marks-crop {
  24302. width: calc(var(--pagedjs-bleed-right-left) - var(--pagedjs-crop-offset));
  24303. }
  24304. .pagedjs_left_page .pagedjs_bleed-left .pagedjs_marks-crop {
  24305. width: calc(var(--pagedjs-bleed-left-left) - var(--pagedjs-crop-offset));
  24306. }
  24307. .pagedjs_bleed-right .pagedjs_marks-crop {
  24308. width: calc(var(--pagedjs-bleed-right) - var(--pagedjs-crop-offset));
  24309. align-self: flex-end;
  24310. }
  24311. .pagedjs_right_page .pagedjs_bleed-right .pagedjs_marks-crop {
  24312. width: calc(var(--pagedjs-bleed-right-right) - var(--pagedjs-crop-offset));
  24313. }
  24314. .pagedjs_left_page .pagedjs_bleed-right .pagedjs_marks-crop {
  24315. width: calc(var(--pagedjs-bleed-left-right) - var(--pagedjs-crop-offset));
  24316. }
  24317. .pagedjs_marks-middle {
  24318. display: flex;
  24319. flex-grow: 1;
  24320. flex-shrink: 0;
  24321. align-items: center;
  24322. justify-content: center;
  24323. }
  24324. .pagedjs_marks-cross {
  24325. display: var(--pagedjs-mark-cross-display);
  24326. background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSIzMi41MzdweCIgaGVpZ2h0PSIzMi41MzdweCIgdmlld0JveD0iMC4xMDQgMC4xMDQgMzIuNTM3IDMyLjUzNyIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwLjEwNCAwLjEwNCAzMi41MzcgMzIuNTM3IiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBmaWxsPSJub25lIiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMy4zODkzIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIGQ9Ik0yOS45MzEsMTYuMzczYzAsNy40ODktNi4wNjgsMTMuNTYtMTMuNTU4LDEzLjU2Yy03LjQ4MywwLTEzLjU1Ny02LjA3Mi0xMy41NTctMTMuNTZjMC03LjQ4Niw2LjA3NC0xMy41NTQsMTMuNTU3LTEzLjU1NEMyMy44NjIsMi44MTksMjkuOTMxLDguODg3LDI5LjkzMSwxNi4zNzN6Ii8+PGxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjRkZGRkZGIiBzdHJva2Utd2lkdGg9IjMuMzg5MyIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiB4MT0iMC4xMDQiIHkxPSIxNi4zNzMiIHgyPSIzMi42NDIiIHkyPSIxNi4zNzMiLz48bGluZSBmaWxsPSJub25lIiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMy4zODkzIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHgxPSIxNi4zNzMiIHkxPSIwLjEwNCIgeDI9IjE2LjM3MyIgeTI9IjMyLjY0MiIvPjxwYXRoIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIzLjM4OTMiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgZD0iTTI0LjUwOCwxNi4zNzNjMCw0LjQ5Ni0zLjYzOCw4LjEzNS04LjEzNSw4LjEzNWMtNC40OTEsMC04LjEzNS0zLjYzOC04LjEzNS04LjEzNWMwLTQuNDg5LDMuNjQ0LTguMTM1LDguMTM1LTguMTM1QzIwLjg2OSw4LjIzOSwyNC41MDgsMTEuODg0LDI0LjUwOCwxNi4zNzN6Ii8+PHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjAuNjc3OCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBkPSJNMjkuOTMxLDE2LjM3M2MwLDcuNDg5LTYuMDY4LDEzLjU2LTEzLjU1OCwxMy41NmMtNy40ODMsMC0xMy41NTctNi4wNzItMTMuNTU3LTEzLjU2YzAtNy40ODYsNi4wNzQtMTMuNTU0LDEzLjU1Ny0xMy41NTRDMjMuODYyLDIuODE5LDI5LjkzMSw4Ljg4NywyOS45MzEsMTYuMzczeiIvPjxsaW5lIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLXdpZHRoPSIwLjY3NzgiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgeDE9IjAuMTA0IiB5MT0iMTYuMzczIiB4Mj0iMzIuNjQyIiB5Mj0iMTYuMzczIi8+PGxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjAuNjc3OCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiB4MT0iMTYuMzczIiB5MT0iMC4xMDQiIHgyPSIxNi4zNzMiIHkyPSIzMi42NDIiLz48cGF0aCBkPSJNMjQuNTA4LDE2LjM3M2MwLDQuNDk2LTMuNjM4LDguMTM1LTguMTM1LDguMTM1Yy00LjQ5MSwwLTguMTM1LTMuNjM4LTguMTM1LTguMTM1YzAtNC40ODksMy42NDQtOC4xMzUsOC4xMzUtOC4xMzVDMjAuODY5LDguMjM5LDI0LjUwOCwxMS44ODQsMjQuNTA4LDE2LjM3MyIvPjxsaW5lIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIwLjY3NzgiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgeDE9IjguMjM5IiB5MT0iMTYuMzczIiB4Mj0iMjQuNTA4IiB5Mj0iMTYuMzczIi8+PGxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjRkZGRkZGIiBzdHJva2Utd2lkdGg9IjAuNjc3OCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiB4MT0iMTYuMzczIiB5MT0iOC4yMzkiIHgyPSIxNi4zNzMiIHkyPSIyNC41MDgiLz48L3N2Zz4=);
  24327. background-repeat: no-repeat;
  24328. background-position: 50% 50%;
  24329. background-size: var(--pagedjs-cross-size);
  24330. z-index: 2147483647;
  24331. width: var(--pagedjs-cross-size);
  24332. height: var(--pagedjs-cross-size);
  24333. }
  24334. .pagedjs_pagebox {
  24335. box-sizing: border-box;
  24336. width: var(--pagedjs-pagebox-width);
  24337. height: var(--pagedjs-pagebox-height);
  24338. position: relative;
  24339. display: grid;
  24340. grid-template-columns: [left] var(--pagedjs-margin-left) [center] calc(var(--pagedjs-pagebox-width) - var(--pagedjs-margin-left) - var(--pagedjs-margin-right)) [right] var(--pagedjs-margin-right);
  24341. grid-template-rows: [header] var(--pagedjs-margin-top) [page] calc(var(--pagedjs-pagebox-height) - var(--pagedjs-margin-top) - var(--pagedjs-margin-bottom)) [footer] var(--pagedjs-margin-bottom);
  24342. grid-column: sheet-center;
  24343. grid-row: sheet-middle;
  24344. }
  24345. .pagedjs_pagebox * {
  24346. box-sizing: border-box;
  24347. }
  24348. .pagedjs_margin-top {
  24349. width: calc(var(--pagedjs-pagebox-width) - var(--pagedjs-margin-left) - var(--pagedjs-margin-right));
  24350. height: var(--pagedjs-margin-top);
  24351. grid-column: center;
  24352. grid-row: header;
  24353. flex-wrap: nowrap;
  24354. display: grid;
  24355. grid-template-columns: repeat(3, 1fr);
  24356. grid-template-rows: 100%;
  24357. }
  24358. .pagedjs_margin-top-left-corner-holder {
  24359. width: var(--pagedjs-margin-left);
  24360. height: var(--pagedjs-margin-top);
  24361. display: flex;
  24362. grid-column: left;
  24363. grid-row: header;
  24364. }
  24365. .pagedjs_margin-top-right-corner-holder {
  24366. width: var(--pagedjs-margin-right);
  24367. height: var(--pagedjs-margin-top);
  24368. display: flex;
  24369. grid-column: right;
  24370. grid-row: header;
  24371. }
  24372. .pagedjs_margin-top-left-corner {
  24373. width: var(--pagedjs-margin-left);
  24374. }
  24375. .pagedjs_margin-top-right-corner {
  24376. width: var(--pagedjs-margin-right);
  24377. }
  24378. .pagedjs_margin-right {
  24379. height: calc(var(--pagedjs-pagebox-height) - var(--pagedjs-margin-top) - var(--pagedjs-margin-bottom));
  24380. width: var(--pagedjs-margin-right);
  24381. right: 0;
  24382. grid-column: right;
  24383. grid-row: page;
  24384. display: grid;
  24385. grid-template-rows: repeat(3, 33.3333%);
  24386. grid-template-columns: 100%;
  24387. }
  24388. .pagedjs_margin-bottom {
  24389. width: calc(var(--pagedjs-pagebox-width) - var(--pagedjs-margin-left) - var(--pagedjs-margin-right));
  24390. height: var(--pagedjs-margin-bottom);
  24391. grid-column: center;
  24392. grid-row: footer;
  24393. display: grid;
  24394. grid-template-columns: repeat(3, 1fr);
  24395. grid-template-rows: 100%;
  24396. }
  24397. .pagedjs_margin-bottom-left-corner-holder {
  24398. width: var(--pagedjs-margin-left);
  24399. height: var(--pagedjs-margin-bottom);
  24400. display: flex;
  24401. grid-column: left;
  24402. grid-row: footer;
  24403. }
  24404. .pagedjs_margin-bottom-right-corner-holder {
  24405. width: var(--pagedjs-margin-right);
  24406. height: var(--pagedjs-margin-bottom);
  24407. display: flex;
  24408. grid-column: right;
  24409. grid-row: footer;
  24410. }
  24411. .pagedjs_margin-bottom-left-corner {
  24412. width: var(--pagedjs-margin-left);
  24413. }
  24414. .pagedjs_margin-bottom-right-corner {
  24415. width: var(--pagedjs-margin-right);
  24416. }
  24417. .pagedjs_margin-left {
  24418. height: calc(var(--pagedjs-pagebox-height) - var(--pagedjs-margin-top) - var(--pagedjs-margin-bottom));
  24419. width: var(--pagedjs-margin-left);
  24420. grid-column: left;
  24421. grid-row: page;
  24422. display: grid;
  24423. grid-template-rows: repeat(3, 33.33333%);
  24424. grid-template-columns: 100%;
  24425. }
  24426. .pagedjs_pages .pagedjs_pagebox .pagedjs_margin:not(.hasContent) {
  24427. visibility: hidden;
  24428. }
  24429. .pagedjs_pagebox > .pagedjs_area {
  24430. grid-column: center;
  24431. grid-row: page;
  24432. width: 100%;
  24433. height: 100%;
  24434. padding: var(--pagedjs-padding-top) var(--pagedjs-padding-right) var(--pagedjs-padding-bottom) var(--pagedjs-padding-left);
  24435. border-top: var(--pagedjs-border-top);
  24436. border-right: var(--pagedjs-border-right);
  24437. border-bottom: var(--pagedjs-border-bottom);
  24438. border-left: var(--pagedjs-border-left);
  24439. }
  24440. .pagedjs_pagebox > .pagedjs_area > .pagedjs_page_content {
  24441. width: 100%;
  24442. height: calc(100% - var(--pagedjs-footnotes-height));
  24443. position: relative;
  24444. column-fill: auto;
  24445. }
  24446. .pagedjs_pagebox > .pagedjs_area > .pagedjs_page_content > div {
  24447. height: inherit;
  24448. }
  24449. .pagedjs_pagebox > .pagedjs_area > .pagedjs_footnote_area {
  24450. position: relative;
  24451. overflow: hidden;
  24452. height: var(--pagedjs-footnotes-height);
  24453. display: flex;
  24454. justify-content: flex-end;
  24455. flex-flow: column;
  24456. }
  24457. .pagedjs_pagebox > .pagedjs_area > .pagedjs_footnote_area > .pagedjs_footnote_content {
  24458. overflow: hidden;
  24459. }
  24460. .pagedjs_pagebox > .pagedjs_area > .pagedjs_footnote_area > .pagedjs_footnote_inner_content {
  24461. overflow: hidden;
  24462. }
  24463. .pagedjs_area [data-footnote-call] {
  24464. all: unset;
  24465. counter-increment: footnote;
  24466. }
  24467. .pagedjs_area [data-split-from] {
  24468. counter-increment: unset;
  24469. counter-reset: unset;
  24470. }
  24471. [data-footnote-call]::after {
  24472. vertical-align: super;
  24473. font-size: 65%;
  24474. line-height: normal;
  24475. content: counter(footnote);
  24476. }
  24477. @supports ( font-variant-position: super ) {
  24478. [data-footnote-call]::after {
  24479. vertical-align: baseline;
  24480. font-size: 100%;
  24481. line-height: inherit;
  24482. font-variant-position: super;
  24483. }
  24484. }
  24485. .pagedjs_footnote_empty {
  24486. display: none;
  24487. }
  24488. .pagedjs_area [data-split-from] {
  24489. counter-increment: unset;
  24490. counter-reset: unset;
  24491. }
  24492. [data-footnote-marker] {
  24493. text-indent: 0;
  24494. display: list-item;
  24495. list-style-position: inside;
  24496. }
  24497. [data-footnote-marker][data-split-from] {
  24498. list-style: none;
  24499. }
  24500. [data-footnote-marker]:not([data-split-from]) {
  24501. counter-increment: footnote-marker;
  24502. }
  24503. [data-footnote-marker]::marker {
  24504. content: counter(footnote-marker) ". ";
  24505. }
  24506. [data-footnote-marker][data-split-from]::marker {
  24507. content: unset;
  24508. }
  24509. .pagedjs_area .pagedjs_footnote_inner_content [data-note-display="inline"] {
  24510. display: inline;
  24511. }
  24512. .pagedjs_page {
  24513. counter-increment: page var(--pagedjs-page-counter-increment);
  24514. width: var(--pagedjs-width);
  24515. height: var(--pagedjs-height);
  24516. }
  24517. .pagedjs_page.pagedjs_right_page {
  24518. width: var(--pagedjs-width-right);
  24519. height: var(--pagedjs-height-right);
  24520. }
  24521. .pagedjs_page.pagedjs_left_page {
  24522. width: var(--pagedjs-width-left);
  24523. height: var(--pagedjs-height-left);
  24524. }
  24525. .pagedjs_pages {
  24526. counter-reset: pages var(--pagedjs-page-count) footnote var(--pagedjs-footnotes-count) footnote-marker var(--pagedjs-footnotes-count);
  24527. }
  24528. .pagedjs_pagebox .pagedjs_margin-top-left-corner,
  24529. .pagedjs_pagebox .pagedjs_margin-top-right-corner,
  24530. .pagedjs_pagebox .pagedjs_margin-bottom-left-corner,
  24531. .pagedjs_pagebox .pagedjs_margin-bottom-right-corner,
  24532. .pagedjs_pagebox .pagedjs_margin-top-left,
  24533. .pagedjs_pagebox .pagedjs_margin-top-right,
  24534. .pagedjs_pagebox .pagedjs_margin-bottom-left,
  24535. .pagedjs_pagebox .pagedjs_margin-bottom-right,
  24536. .pagedjs_pagebox .pagedjs_margin-top-center,
  24537. .pagedjs_pagebox .pagedjs_margin-bottom-center,
  24538. .pagedjs_pagebox .pagedjs_margin-top-center,
  24539. .pagedjs_pagebox .pagedjs_margin-bottom-center,
  24540. .pagedjs_margin-right-middle,
  24541. .pagedjs_margin-left-middle {
  24542. display: flex;
  24543. align-items: center;
  24544. }
  24545. .pagedjs_margin-right-top,
  24546. .pagedjs_margin-left-top {
  24547. display: flex;
  24548. align-items: flex-top;
  24549. }
  24550. .pagedjs_margin-right-bottom,
  24551. .pagedjs_margin-left-bottom {
  24552. display: flex;
  24553. align-items: flex-end;
  24554. }
  24555. /*
  24556. .pagedjs_pagebox .pagedjs_margin-top-center,
  24557. .pagedjs_pagebox .pagedjs_margin-bottom-center {
  24558. height: 100%;
  24559. display: none;
  24560. align-items: center;
  24561. flex: 1 0 33%;
  24562. margin: 0 auto;
  24563. }
  24564. .pagedjs_pagebox .pagedjs_margin-top-left-corner,
  24565. .pagedjs_pagebox .pagedjs_margin-top-right-corner,
  24566. .pagedjs_pagebox .pagedjs_margin-bottom-right-corner,
  24567. .pagedjs_pagebox .pagedjs_margin-bottom-left-corner {
  24568. display: none;
  24569. align-items: center;
  24570. }
  24571. .pagedjs_pagebox .pagedjs_margin-left-top,
  24572. .pagedjs_pagebox .pagedjs_margin-right-top {
  24573. display: none;
  24574. align-items: flex-start;
  24575. }
  24576. .pagedjs_pagebox .pagedjs_margin-right-middle,
  24577. .pagedjs_pagebox .pagedjs_margin-left-middle {
  24578. display: none;
  24579. align-items: center;
  24580. }
  24581. .pagedjs_pagebox .pagedjs_margin-left-bottom,
  24582. .pagedjs_pagebox .pagedjs_margin-right-bottom {
  24583. display: none;
  24584. align-items: flex-end;
  24585. }
  24586. */
  24587. .pagedjs_pagebox .pagedjs_margin-top-left,
  24588. .pagedjs_pagebox .pagedjs_margin-top-right-corner,
  24589. .pagedjs_pagebox .pagedjs_margin-bottom-left,
  24590. .pagedjs_pagebox .pagedjs_margin-bottom-right-corner { text-align: left; }
  24591. .pagedjs_pagebox .pagedjs_margin-top-left-corner,
  24592. .pagedjs_pagebox .pagedjs_margin-top-right,
  24593. .pagedjs_pagebox .pagedjs_margin-bottom-left-corner,
  24594. .pagedjs_pagebox .pagedjs_margin-bottom-right { text-align: right; }
  24595. .pagedjs_pagebox .pagedjs_margin-top-center,
  24596. .pagedjs_pagebox .pagedjs_margin-bottom-center,
  24597. .pagedjs_pagebox .pagedjs_margin-left-top,
  24598. .pagedjs_pagebox .pagedjs_margin-left-middle,
  24599. .pagedjs_pagebox .pagedjs_margin-left-bottom,
  24600. .pagedjs_pagebox .pagedjs_margin-right-top,
  24601. .pagedjs_pagebox .pagedjs_margin-right-middle,
  24602. .pagedjs_pagebox .pagedjs_margin-right-bottom { text-align: center; }
  24603. .pagedjs_pages .pagedjs_margin .pagedjs_margin-content {
  24604. width: 100%;
  24605. }
  24606. .pagedjs_pages .pagedjs_margin-left .pagedjs_margin-content::after,
  24607. .pagedjs_pages .pagedjs_margin-top .pagedjs_margin-content::after,
  24608. .pagedjs_pages .pagedjs_margin-right .pagedjs_margin-content::after,
  24609. .pagedjs_pages .pagedjs_margin-bottom .pagedjs_margin-content::after {
  24610. display: block;
  24611. }
  24612. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-to] {
  24613. margin-bottom: unset;
  24614. padding-bottom: unset;
  24615. }
  24616. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from] {
  24617. text-indent: unset;
  24618. margin-top: unset;
  24619. padding-top: unset;
  24620. initial-letter: unset;
  24621. }
  24622. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from] > *::first-letter,
  24623. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from]::first-letter {
  24624. color: unset;
  24625. font-size: unset;
  24626. font-weight: unset;
  24627. font-family: unset;
  24628. color: unset;
  24629. line-height: unset;
  24630. float: unset;
  24631. padding: unset;
  24632. margin: unset;
  24633. }
  24634. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-to]:not([data-footnote-call]):after,
  24635. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-to]:not([data-footnote-call])::after {
  24636. content: unset;
  24637. }
  24638. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from]:not([data-footnote-call]):before,
  24639. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from]:not([data-footnote-call])::before {
  24640. content: unset;
  24641. }
  24642. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div li[data-split-from]:first-of-type {
  24643. list-style: none;
  24644. }
  24645. /*
  24646. [data-page]:not([data-split-from]),
  24647. [data-break-before="page"]:not([data-split-from]),
  24648. [data-break-before="always"]:not([data-split-from]),
  24649. [data-break-before="left"]:not([data-split-from]),
  24650. [data-break-before="right"]:not([data-split-from]),
  24651. [data-break-before="recto"]:not([data-split-from]),
  24652. [data-break-before="verso"]:not([data-split-from])
  24653. {
  24654. break-before: column;
  24655. }
  24656. [data-page]:not([data-split-to]),
  24657. [data-break-after="page"]:not([data-split-to]),
  24658. [data-break-after="always"]:not([data-split-to]),
  24659. [data-break-after="left"]:not([data-split-to]),
  24660. [data-break-after="right"]:not([data-split-to]),
  24661. [data-break-after="recto"]:not([data-split-to]),
  24662. [data-break-after="verso"]:not([data-split-to])
  24663. {
  24664. break-after: column;
  24665. }
  24666. */
  24667. .pagedjs_clear-after::after {
  24668. content: none !important;
  24669. }
  24670. [data-align-last-split-element='justify'] {
  24671. text-align-last: justify;
  24672. }
  24673. @media print {
  24674. html {
  24675. width: 100%;
  24676. height: 100%;
  24677. -webkit-print-color-adjust: exact;
  24678. print-color-adjust: exact;
  24679. }
  24680. body {
  24681. margin: 0;
  24682. padding: 0;
  24683. width: 100% !important;
  24684. height: 100% !important;
  24685. min-width: 100%;
  24686. max-width: 100%;
  24687. min-height: 100%;
  24688. max-height: 100%;
  24689. }
  24690. .pagedjs_pages {
  24691. width: auto;
  24692. display: block !important;
  24693. transform: none !important;
  24694. height: 100% !important;
  24695. min-height: 100%;
  24696. max-height: 100%;
  24697. overflow: visible;
  24698. }
  24699. .pagedjs_page {
  24700. margin: 0;
  24701. padding: 0;
  24702. max-height: 100%;
  24703. min-height: 100%;
  24704. height: 100% !important;
  24705. page-break-after: always;
  24706. break-after: page;
  24707. }
  24708. .pagedjs_sheet {
  24709. margin: 0;
  24710. padding: 0;
  24711. max-height: 100%;
  24712. min-height: 100%;
  24713. height: 100% !important;
  24714. }
  24715. }
  24716. `;
  24717. async function request(url, options={}) {
  24718. return new Promise(function(resolve, reject) {
  24719. let request = new XMLHttpRequest();
  24720. request.open(options.method || "get", url, true);
  24721. for (let i in options.headers) {
  24722. request.setRequestHeader(i, options.headers[i]);
  24723. }
  24724. request.withCredentials = options.credentials === "include";
  24725. request.onload = () => {
  24726. // Chrome returns a status code of 0 for local files
  24727. const status = request.status === 0 && url.startsWith("file://") ? 200 : request.status;
  24728. resolve(new Response(request.responseText, {status}));
  24729. };
  24730. request.onerror = reject;
  24731. request.send(options.body || null);
  24732. });
  24733. }
  24734. class Polisher {
  24735. constructor(setup) {
  24736. this.sheets = [];
  24737. this.inserted = [];
  24738. this.hooks = {};
  24739. this.hooks.onUrl = new Hook(this);
  24740. this.hooks.onAtPage = new Hook(this);
  24741. this.hooks.onAtMedia = new Hook(this);
  24742. this.hooks.onRule = new Hook(this);
  24743. this.hooks.onDeclaration = new Hook(this);
  24744. this.hooks.onContent = new Hook(this);
  24745. this.hooks.onSelector = new Hook(this);
  24746. this.hooks.onPseudoSelector = new Hook(this);
  24747. this.hooks.onImport = new Hook(this);
  24748. this.hooks.beforeTreeParse = new Hook(this);
  24749. this.hooks.beforeTreeWalk = new Hook(this);
  24750. this.hooks.afterTreeWalk = new Hook(this);
  24751. if (setup !== false) {
  24752. this.setup();
  24753. }
  24754. }
  24755. setup() {
  24756. this.base = this.insert(baseStyles);
  24757. this.styleEl = document.createElement("style");
  24758. document.head.appendChild(this.styleEl);
  24759. this.styleSheet = this.styleEl.sheet;
  24760. return this.styleSheet;
  24761. }
  24762. async add() {
  24763. let fetched = [];
  24764. let urls = [];
  24765. for (var i = 0; i < arguments.length; i++) {
  24766. let f;
  24767. if (typeof arguments[i] === "object") {
  24768. for (let url in arguments[i]) {
  24769. let obj = arguments[i];
  24770. f = new Promise(function(resolve, reject) {
  24771. urls.push(url);
  24772. resolve(obj[url]);
  24773. });
  24774. }
  24775. } else {
  24776. urls.push(arguments[i]);
  24777. f = request(arguments[i]).then((response) => {
  24778. return response.text();
  24779. });
  24780. }
  24781. fetched.push(f);
  24782. }
  24783. return await Promise.all(fetched)
  24784. .then(async (originals) => {
  24785. let text = "";
  24786. for (let index = 0; index < originals.length; index++) {
  24787. text = await this.convertViaSheet(originals[index], urls[index]);
  24788. this.insert(text);
  24789. }
  24790. return text;
  24791. });
  24792. }
  24793. async convertViaSheet(cssStr, href) {
  24794. let sheet = new Sheet(href, this.hooks);
  24795. await sheet.parse(cssStr);
  24796. // Insert the imported sheets first
  24797. for (let url of sheet.imported) {
  24798. let str = await request(url).then((response) => {
  24799. return response.text();
  24800. });
  24801. let text = await this.convertViaSheet(str, url);
  24802. this.insert(text);
  24803. }
  24804. this.sheets.push(sheet);
  24805. if (typeof sheet.width !== "undefined") {
  24806. this.width = sheet.width;
  24807. }
  24808. if (typeof sheet.height !== "undefined") {
  24809. this.height = sheet.height;
  24810. }
  24811. if (typeof sheet.orientation !== "undefined") {
  24812. this.orientation = sheet.orientation;
  24813. }
  24814. return sheet.toString();
  24815. }
  24816. insert(text){
  24817. let head = document.querySelector("head");
  24818. let style = document.createElement("style");
  24819. style.setAttribute("data-pagedjs-inserted-styles", "true");
  24820. style.appendChild(document.createTextNode(text));
  24821. head.appendChild(style);
  24822. this.inserted.push(style);
  24823. return style;
  24824. }
  24825. destroy() {
  24826. this.styleEl.remove();
  24827. this.inserted.forEach((s) => {
  24828. s.remove();
  24829. });
  24830. this.sheets = [];
  24831. }
  24832. }
  24833. class Handler {
  24834. constructor(chunker, polisher, caller) {
  24835. let hooks = Object.assign({}, chunker && chunker.hooks, polisher && polisher.hooks, caller && caller.hooks);
  24836. this.chunker = chunker;
  24837. this.polisher = polisher;
  24838. this.caller = caller;
  24839. for (let name in hooks) {
  24840. if (name in this) {
  24841. let hook = hooks[name];
  24842. hook.register(this[name].bind(this));
  24843. }
  24844. }
  24845. }
  24846. }
  24847. EventEmitter(Handler.prototype);
  24848. // https://www.w3.org/TR/css3-page/#page-size-prop
  24849. var pageSizes = {
  24850. "A0": {
  24851. width: {
  24852. value: 841,
  24853. unit: "mm"
  24854. },
  24855. height: {
  24856. value: 1189,
  24857. unit: "mm"
  24858. }
  24859. },
  24860. "A1": {
  24861. width: {
  24862. value: 594,
  24863. unit: "mm"
  24864. },
  24865. height: {
  24866. value: 841,
  24867. unit: "mm"
  24868. }
  24869. },
  24870. "A2": {
  24871. width: {
  24872. value: 420,
  24873. unit: "mm"
  24874. },
  24875. height: {
  24876. value: 594,
  24877. unit: "mm"
  24878. }
  24879. },
  24880. "A3": {
  24881. width: {
  24882. value: 297,
  24883. unit: "mm"
  24884. },
  24885. height: {
  24886. value: 420,
  24887. unit: "mm"
  24888. }
  24889. },
  24890. "A4": {
  24891. width: {
  24892. value: 210,
  24893. unit: "mm"
  24894. },
  24895. height: {
  24896. value: 297,
  24897. unit: "mm"
  24898. }
  24899. },
  24900. "A5": {
  24901. width: {
  24902. value: 148,
  24903. unit: "mm"
  24904. },
  24905. height: {
  24906. value: 210,
  24907. unit: "mm"
  24908. }
  24909. },
  24910. "A6": {
  24911. width: {
  24912. value: 105,
  24913. unit: "mm"
  24914. },
  24915. height: {
  24916. value: 148,
  24917. unit: "mm"
  24918. }
  24919. },
  24920. "A7": {
  24921. width: {
  24922. value: 74,
  24923. unit: "mm"
  24924. },
  24925. height: {
  24926. value: 105,
  24927. unit: "mm"
  24928. }
  24929. },
  24930. "A8": {
  24931. width: {
  24932. value: 52,
  24933. unit: "mm"
  24934. },
  24935. height: {
  24936. value: 74,
  24937. unit: "mm"
  24938. }
  24939. },
  24940. "A9": {
  24941. width: {
  24942. value: 37,
  24943. unit: "mm"
  24944. },
  24945. height: {
  24946. value: 52,
  24947. unit: "mm"
  24948. }
  24949. },
  24950. "A10": {
  24951. width: {
  24952. value: 26,
  24953. unit: "mm"
  24954. },
  24955. height: {
  24956. value: 37,
  24957. unit: "mm"
  24958. }
  24959. },
  24960. "B4": {
  24961. width: {
  24962. value: 250,
  24963. unit: "mm"
  24964. },
  24965. height: {
  24966. value: 353,
  24967. unit: "mm"
  24968. }
  24969. },
  24970. "B5": {
  24971. width: {
  24972. value: 176,
  24973. unit: "mm"
  24974. },
  24975. height: {
  24976. value: 250,
  24977. unit: "mm"
  24978. }
  24979. },
  24980. "letter": {
  24981. width: {
  24982. value: 8.5,
  24983. unit: "in"
  24984. },
  24985. height: {
  24986. value: 11,
  24987. unit: "in"
  24988. }
  24989. },
  24990. "legal": {
  24991. width: {
  24992. value: 8.5,
  24993. unit: "in"
  24994. },
  24995. height: {
  24996. value: 14,
  24997. unit: "in"
  24998. }
  24999. },
  25000. "ledger": {
  25001. width: {
  25002. value: 11,
  25003. unit: "in"
  25004. },
  25005. height: {
  25006. value: 17,
  25007. unit: "in"
  25008. }
  25009. }
  25010. };
  25011. class AtPage extends Handler {
  25012. constructor(chunker, polisher, caller) {
  25013. super(chunker, polisher, caller);
  25014. this.pages = {};
  25015. this.width = undefined;
  25016. this.height = undefined;
  25017. this.orientation = undefined;
  25018. this.marginalia = {};
  25019. }
  25020. pageModel(selector) {
  25021. return {
  25022. selector: selector,
  25023. name: undefined,
  25024. psuedo: undefined,
  25025. nth: undefined,
  25026. marginalia: {},
  25027. width: undefined,
  25028. height: undefined,
  25029. orientation: undefined,
  25030. margin: {
  25031. top: {},
  25032. right: {},
  25033. left: {},
  25034. bottom: {}
  25035. },
  25036. padding: {
  25037. top: {},
  25038. right: {},
  25039. left: {},
  25040. bottom: {}
  25041. },
  25042. border: {
  25043. top: {},
  25044. right: {},
  25045. left: {},
  25046. bottom: {}
  25047. },
  25048. backgroundOrigin: undefined,
  25049. block: {},
  25050. marks: undefined,
  25051. notes: undefined,
  25052. added: false
  25053. };
  25054. }
  25055. // Find and Remove @page rules
  25056. onAtPage(node, item, list) {
  25057. let page, marginalia;
  25058. let selector = "";
  25059. let named, psuedo, nth;
  25060. let needsMerge = false;
  25061. if (node.prelude) {
  25062. named = this.getTypeSelector(node);
  25063. psuedo = this.getPsuedoSelector(node);
  25064. nth = this.getNthSelector(node);
  25065. selector = csstree.generate(node.prelude);
  25066. } else {
  25067. selector = "*";
  25068. }
  25069. if (selector in this.pages) {
  25070. // this.pages[selector] = Object.assign(this.pages[selector], page);
  25071. // console.log("after", selector, this.pages[selector]);
  25072. // this.pages[selector].added = false;
  25073. page = this.pages[selector];
  25074. marginalia = this.replaceMarginalia(node);
  25075. needsMerge = true;
  25076. // Mark page for getting classes added again
  25077. page.added = false;
  25078. } else {
  25079. page = this.pageModel(selector);
  25080. marginalia = this.replaceMarginalia(node);
  25081. this.pages[selector] = page;
  25082. }
  25083. page.name = named;
  25084. page.psuedo = psuedo;
  25085. page.nth = nth;
  25086. if (needsMerge) {
  25087. page.marginalia = Object.assign(page.marginalia, marginalia);
  25088. } else {
  25089. page.marginalia = marginalia;
  25090. }
  25091. let notes = this.replaceNotes(node);
  25092. page.notes = notes;
  25093. let declarations = this.replaceDeclarations(node);
  25094. if (declarations.size) {
  25095. page.size = declarations.size;
  25096. page.width = declarations.size.width;
  25097. page.height = declarations.size.height;
  25098. page.orientation = declarations.size.orientation;
  25099. page.format = declarations.size.format;
  25100. }
  25101. if (declarations.bleed && declarations.bleed[0] != "auto") {
  25102. switch (declarations.bleed.length) {
  25103. case 4: // top right bottom left
  25104. page.bleed = {
  25105. top: declarations.bleed[0],
  25106. right: declarations.bleed[1],
  25107. bottom: declarations.bleed[2],
  25108. left: declarations.bleed[3]
  25109. };
  25110. break;
  25111. case 3: // top right bottom right
  25112. page.bleed = {
  25113. top: declarations.bleed[0],
  25114. right: declarations.bleed[1],
  25115. bottom: declarations.bleed[2],
  25116. left: declarations.bleed[1]
  25117. };
  25118. break;
  25119. case 2: // top right top right
  25120. page.bleed = {
  25121. top: declarations.bleed[0],
  25122. right: declarations.bleed[1],
  25123. bottom: declarations.bleed[0],
  25124. left: declarations.bleed[1]
  25125. };
  25126. break;
  25127. default:
  25128. page.bleed = {
  25129. top: declarations.bleed[0],
  25130. right: declarations.bleed[0],
  25131. bottom: declarations.bleed[0],
  25132. left: declarations.bleed[0]
  25133. };
  25134. }
  25135. }
  25136. if (declarations.marks) {
  25137. if (!declarations.bleed || declarations.bleed && declarations.bleed[0] === "auto") {
  25138. // Spec say 6pt, but needs more space for marks
  25139. page.bleed = {
  25140. top: { value: 6, unit: "mm" },
  25141. right: { value: 6, unit: "mm" },
  25142. bottom: { value: 6, unit: "mm" },
  25143. left: { value: 6, unit: "mm" }
  25144. };
  25145. }
  25146. page.marks = declarations.marks;
  25147. }
  25148. if (declarations.margin) {
  25149. page.margin = declarations.margin;
  25150. }
  25151. if (declarations.padding) {
  25152. page.padding = declarations.padding;
  25153. }
  25154. if (declarations.border) {
  25155. page.border = declarations.border;
  25156. }
  25157. if (declarations.marks) {
  25158. page.marks = declarations.marks;
  25159. }
  25160. if (needsMerge) {
  25161. page.block.children.appendList(node.block.children);
  25162. } else {
  25163. page.block = node.block;
  25164. }
  25165. // Remove the rule
  25166. list.remove(item);
  25167. }
  25168. /* Handled in breaks */
  25169. /*
  25170. afterParsed(parsed) {
  25171. for (let b in this.named) {
  25172. // Find elements
  25173. let elements = parsed.querySelectorAll(b);
  25174. // Add break data
  25175. for (var i = 0; i < elements.length; i++) {
  25176. elements[i].setAttribute("data-page", this.named[b]);
  25177. }
  25178. }
  25179. }
  25180. */
  25181. afterTreeWalk(ast, sheet) {
  25182. let dirtyPage = "*" in this.pages && this.pages["*"].added === false;
  25183. this.addPageClasses(this.pages, ast, sheet);
  25184. if (dirtyPage) {
  25185. let width = this.pages["*"].width;
  25186. let height = this.pages["*"].height;
  25187. let format = this.pages["*"].format;
  25188. let orientation = this.pages["*"].orientation;
  25189. let bleed = this.pages["*"].bleed;
  25190. let marks = this.pages["*"].marks;
  25191. let bleedverso = undefined;
  25192. let bleedrecto = undefined;
  25193. if (":left" in this.pages) {
  25194. bleedverso = this.pages[":left"].bleed;
  25195. }
  25196. if (":right" in this.pages) {
  25197. bleedrecto = this.pages[":right"].bleed;
  25198. }
  25199. if ((width && height) &&
  25200. (this.width !== width || this.height !== height)) {
  25201. this.width = width;
  25202. this.height = height;
  25203. this.format = format;
  25204. this.orientation = orientation;
  25205. this.addRootVars(ast, width, height, orientation, bleed, bleedrecto, bleedverso, marks);
  25206. this.addRootPage(ast, this.pages["*"].size, bleed, bleedrecto, bleedverso);
  25207. this.emit("size", { width, height, orientation, format, bleed });
  25208. this.emit("atpages", this.pages);
  25209. }
  25210. }
  25211. }
  25212. getTypeSelector(ast) {
  25213. // Find page name
  25214. let name;
  25215. csstree.walk(ast, {
  25216. visit: "TypeSelector",
  25217. enter: (node, item, list) => {
  25218. name = node.name;
  25219. }
  25220. });
  25221. return name;
  25222. }
  25223. getPsuedoSelector(ast) {
  25224. // Find if it has :left & :right & :black & :first
  25225. let name;
  25226. csstree.walk(ast, {
  25227. visit: "PseudoClassSelector",
  25228. enter: (node, item, list) => {
  25229. if (node.name !== "nth") {
  25230. name = node.name;
  25231. }
  25232. }
  25233. });
  25234. return name;
  25235. }
  25236. getNthSelector(ast) {
  25237. // Find if it has :nth
  25238. let nth;
  25239. csstree.walk(ast, {
  25240. visit: "PseudoClassSelector",
  25241. enter: (node, item, list) => {
  25242. if (node.name === "nth" && node.children) {
  25243. let raw = node.children.first();
  25244. nth = raw.value;
  25245. }
  25246. }
  25247. });
  25248. return nth;
  25249. }
  25250. replaceMarginalia(ast) {
  25251. let parsed = {};
  25252. const MARGINS = [
  25253. "top-left-corner", "top-left", "top", "top-center", "top-right", "top-right-corner",
  25254. "bottom-left-corner", "bottom-left", "bottom", "bottom-center", "bottom-right", "bottom-right-corner",
  25255. "left-top", "left-middle", "left", "left-bottom", "top-right-corner",
  25256. "right-top", "right-middle", "right", "right-bottom", "right-right-corner"
  25257. ];
  25258. csstree.walk(ast.block, {
  25259. visit: "Atrule",
  25260. enter: (node, item, list) => {
  25261. let name = node.name;
  25262. if (MARGINS.includes(name)) {
  25263. if (name === "top") {
  25264. name = "top-center";
  25265. }
  25266. if (name === "right") {
  25267. name = "right-middle";
  25268. }
  25269. if (name === "left") {
  25270. name = "left-middle";
  25271. }
  25272. if (name === "bottom") {
  25273. name = "bottom-center";
  25274. }
  25275. parsed[name] = node.block;
  25276. list.remove(item);
  25277. }
  25278. }
  25279. });
  25280. return parsed;
  25281. }
  25282. replaceNotes(ast) {
  25283. let parsed = {};
  25284. csstree.walk(ast.block, {
  25285. visit: "Atrule",
  25286. enter: (node, item, list) => {
  25287. let name = node.name;
  25288. if (name === "footnote") {
  25289. parsed[name] = node.block;
  25290. list.remove(item);
  25291. }
  25292. }
  25293. });
  25294. return parsed;
  25295. }
  25296. replaceDeclarations(ast) {
  25297. let parsed = {};
  25298. csstree.walk(ast.block, {
  25299. visit: "Declaration",
  25300. enter: (declaration, dItem, dList) => {
  25301. let prop = csstree.property(declaration.property).name;
  25302. // let value = declaration.value;
  25303. if (prop === "marks") {
  25304. parsed.marks = [];
  25305. csstree.walk(declaration, {
  25306. visit: "Identifier",
  25307. enter: (ident) => {
  25308. parsed.marks.push(ident.name);
  25309. }
  25310. });
  25311. dList.remove(dItem);
  25312. } else if (prop === "margin") {
  25313. parsed.margin = this.getMargins(declaration);
  25314. dList.remove(dItem);
  25315. } else if (prop.indexOf("margin-") === 0) {
  25316. let m = prop.substring("margin-".length);
  25317. if (!parsed.margin) {
  25318. parsed.margin = {
  25319. top: {},
  25320. right: {},
  25321. left: {},
  25322. bottom: {}
  25323. };
  25324. }
  25325. parsed.margin[m] = declaration.value.children.first();
  25326. dList.remove(dItem);
  25327. } else if (prop === "padding") {
  25328. parsed.padding = this.getPaddings(declaration.value);
  25329. dList.remove(dItem);
  25330. } else if (prop.indexOf("padding-") === 0) {
  25331. let p = prop.substring("padding-".length);
  25332. if (!parsed.padding) {
  25333. parsed.padding = {
  25334. top: {},
  25335. right: {},
  25336. left: {},
  25337. bottom: {}
  25338. };
  25339. }
  25340. parsed.padding[p] = declaration.value.children.first();
  25341. dList.remove(dItem);
  25342. }
  25343. else if (prop === "border") {
  25344. if (!parsed.border) {
  25345. parsed.border = {
  25346. top: {},
  25347. right: {},
  25348. left: {},
  25349. bottom: {}
  25350. };
  25351. }
  25352. parsed.border.top = csstree.generate(declaration.value);
  25353. parsed.border.right = csstree.generate(declaration.value);
  25354. parsed.border.left = csstree.generate(declaration.value);
  25355. parsed.border.bottom = csstree.generate(declaration.value);
  25356. dList.remove(dItem);
  25357. }
  25358. else if (prop.indexOf("border-") === 0) {
  25359. if (!parsed.border) {
  25360. parsed.border = {
  25361. top: {},
  25362. right: {},
  25363. left: {},
  25364. bottom: {}
  25365. };
  25366. }
  25367. let p = prop.substring("border-".length);
  25368. parsed.border[p] = csstree.generate(declaration.value);
  25369. dList.remove(dItem);
  25370. }
  25371. else if (prop === "size") {
  25372. parsed.size = this.getSize(declaration);
  25373. dList.remove(dItem);
  25374. } else if (prop === "bleed") {
  25375. parsed.bleed = [];
  25376. csstree.walk(declaration, {
  25377. enter: (subNode) => {
  25378. switch (subNode.type) {
  25379. case "String": // bleed: "auto"
  25380. if (subNode.value.indexOf("auto") > -1) {
  25381. parsed.bleed.push("auto");
  25382. }
  25383. break;
  25384. case "Dimension": // bleed: 1in 2in, bleed: 20px ect.
  25385. parsed.bleed.push({
  25386. value: subNode.value,
  25387. unit: subNode.unit
  25388. });
  25389. break;
  25390. case "Number":
  25391. parsed.bleed.push({
  25392. value: subNode.value,
  25393. unit: "px"
  25394. });
  25395. break;
  25396. // ignore
  25397. }
  25398. }
  25399. });
  25400. dList.remove(dItem);
  25401. }
  25402. }
  25403. });
  25404. return parsed;
  25405. }
  25406. getSize(declaration) {
  25407. let width, height, orientation, format;
  25408. // Get size: Xmm Ymm
  25409. csstree.walk(declaration, {
  25410. visit: "Dimension",
  25411. enter: (node, item, list) => {
  25412. let { value, unit } = node;
  25413. if (typeof width === "undefined") {
  25414. width = { value, unit };
  25415. } else if (typeof height === "undefined") {
  25416. height = { value, unit };
  25417. }
  25418. }
  25419. });
  25420. // Get size: "A4"
  25421. csstree.walk(declaration, {
  25422. visit: "String",
  25423. enter: (node, item, list) => {
  25424. let name = node.value.replace(/["|']/g, "");
  25425. let s = pageSizes[name];
  25426. if (s) {
  25427. width = s.width;
  25428. height = s.height;
  25429. }
  25430. }
  25431. });
  25432. // Get Format or Landscape or Portrait
  25433. csstree.walk(declaration, {
  25434. visit: "Identifier",
  25435. enter: (node, item, list) => {
  25436. let name = node.name;
  25437. if (name === "landscape" || name === "portrait") {
  25438. orientation = node.name;
  25439. } else if (name !== "auto") {
  25440. let s = pageSizes[name];
  25441. if (s) {
  25442. width = s.width;
  25443. height = s.height;
  25444. }
  25445. format = name;
  25446. }
  25447. }
  25448. });
  25449. return {
  25450. width,
  25451. height,
  25452. orientation,
  25453. format
  25454. };
  25455. }
  25456. getMargins(declaration) {
  25457. let margins = [];
  25458. let margin = {
  25459. top: {},
  25460. right: {},
  25461. left: {},
  25462. bottom: {}
  25463. };
  25464. csstree.walk(declaration, {
  25465. enter: (node) => {
  25466. switch (node.type) {
  25467. case "Dimension": // margin: 1in 2in, margin: 20px, etc...
  25468. margins.push(node);
  25469. break;
  25470. case "Number": // margin: 0
  25471. margins.push({value: node.value, unit: "px"});
  25472. break;
  25473. // ignore
  25474. }
  25475. }
  25476. });
  25477. if (margins.length === 1) {
  25478. for (let m in margin) {
  25479. margin[m] = margins[0];
  25480. }
  25481. } else if (margins.length === 2) {
  25482. margin.top = margins[0];
  25483. margin.right = margins[1];
  25484. margin.bottom = margins[0];
  25485. margin.left = margins[1];
  25486. } else if (margins.length === 3) {
  25487. margin.top = margins[0];
  25488. margin.right = margins[1];
  25489. margin.bottom = margins[2];
  25490. margin.left = margins[1];
  25491. } else if (margins.length === 4) {
  25492. margin.top = margins[0];
  25493. margin.right = margins[1];
  25494. margin.bottom = margins[2];
  25495. margin.left = margins[3];
  25496. }
  25497. return margin;
  25498. }
  25499. getPaddings(declaration) {
  25500. let paddings = [];
  25501. let padding = {
  25502. top: {},
  25503. right: {},
  25504. left: {},
  25505. bottom: {}
  25506. };
  25507. csstree.walk(declaration, {
  25508. enter: (node) => {
  25509. switch (node.type) {
  25510. case "Dimension": // padding: 1in 2in, padding: 20px, etc...
  25511. paddings.push(node);
  25512. break;
  25513. case "Number": // padding: 0
  25514. paddings.push({value: node.value, unit: "px"});
  25515. break;
  25516. // ignore
  25517. }
  25518. }
  25519. });
  25520. if (paddings.length === 1) {
  25521. for (let p in padding) {
  25522. padding[p] = paddings[0];
  25523. }
  25524. } else if (paddings.length === 2) {
  25525. padding.top = paddings[0];
  25526. padding.right = paddings[1];
  25527. padding.bottom = paddings[0];
  25528. padding.left = paddings[1];
  25529. } else if (paddings.length === 3) {
  25530. padding.top = paddings[0];
  25531. padding.right = paddings[1];
  25532. padding.bottom = paddings[2];
  25533. padding.left = paddings[1];
  25534. } else if (paddings.length === 4) {
  25535. padding.top = paddings[0];
  25536. padding.right = paddings[1];
  25537. padding.bottom = paddings[2];
  25538. padding.left = paddings[3];
  25539. }
  25540. return padding;
  25541. }
  25542. // get values for the border on the @page to pass them to the element with the .pagedjs_area class
  25543. getBorders(declaration) {
  25544. let border = {
  25545. top: {},
  25546. right: {},
  25547. left: {},
  25548. bottom: {}
  25549. };
  25550. if (declaration.prop == "border") {
  25551. border.top = csstree.generate(declaration.value);
  25552. border.right = csstree.generate(declaration.value);
  25553. border.bottom = csstree.generate(declaration.value);
  25554. border.left = csstree.generate(declaration.value);
  25555. }
  25556. else if (declaration.prop == "border-top") {
  25557. border.top = csstree.generate(declaration.value);
  25558. }
  25559. else if (declaration.prop == "border-right") {
  25560. border.right = csstree.generate(declaration.value);
  25561. }
  25562. else if (declaration.prop == "border-bottom") {
  25563. border.bottom = csstree.generate(declaration.value);
  25564. }
  25565. else if (declaration.prop == "border-left") {
  25566. border.left = csstree.generate(declaration.value);
  25567. }
  25568. return border;
  25569. }
  25570. addPageClasses(pages, ast, sheet) {
  25571. // First add * page
  25572. if ("*" in pages && pages["*"].added === false) {
  25573. let p = this.createPage(pages["*"], ast.children, sheet);
  25574. sheet.insertRule(p);
  25575. pages["*"].added = true;
  25576. }
  25577. // Add :left & :right
  25578. if (":left" in pages && pages[":left"].added === false) {
  25579. let left = this.createPage(pages[":left"], ast.children, sheet);
  25580. sheet.insertRule(left);
  25581. pages[":left"].added = true;
  25582. }
  25583. if (":right" in pages && pages[":right"].added === false) {
  25584. let right = this.createPage(pages[":right"], ast.children, sheet);
  25585. sheet.insertRule(right);
  25586. pages[":right"].added = true;
  25587. }
  25588. // Add :first & :blank
  25589. if (":first" in pages && pages[":first"].added === false) {
  25590. let first = this.createPage(pages[":first"], ast.children, sheet);
  25591. sheet.insertRule(first);
  25592. pages[":first"].added = true;
  25593. }
  25594. if (":blank" in pages && pages[":blank"].added === false) {
  25595. let blank = this.createPage(pages[":blank"], ast.children, sheet);
  25596. sheet.insertRule(blank);
  25597. pages[":blank"].added = true;
  25598. }
  25599. // Add nth pages
  25600. for (let pg in pages) {
  25601. if (pages[pg].nth && pages[pg].added === false) {
  25602. let nth = this.createPage(pages[pg], ast.children, sheet);
  25603. sheet.insertRule(nth);
  25604. pages[pg].added = true;
  25605. }
  25606. }
  25607. // Add named pages
  25608. for (let pg in pages) {
  25609. if (pages[pg].name && pages[pg].added === false) {
  25610. let named = this.createPage(pages[pg], ast.children, sheet);
  25611. sheet.insertRule(named);
  25612. pages[pg].added = true;
  25613. }
  25614. }
  25615. }
  25616. createPage(page, ruleList, sheet) {
  25617. let selectors = this.selectorsForPage(page);
  25618. let children = page.block.children.copy();
  25619. let block = {
  25620. type: "Block",
  25621. loc: 0,
  25622. children: children
  25623. };
  25624. let rule = this.createRule(selectors, block);
  25625. this.addMarginVars(page.margin, children, children.first());
  25626. this.addPaddingVars(page.padding, children, children.first());
  25627. this.addBorderVars(page.border, children, children.first());
  25628. if (page.width) {
  25629. this.addDimensions(page.width, page.height, page.orientation, children, children.first());
  25630. }
  25631. if (page.marginalia) {
  25632. this.addMarginaliaStyles(page, ruleList, rule, sheet);
  25633. this.addMarginaliaContent(page, ruleList, rule, sheet);
  25634. }
  25635. if(page.notes) {
  25636. this.addNotesStyles(page.notes, page, ruleList, rule, sheet);
  25637. }
  25638. return rule;
  25639. }
  25640. addMarginVars(margin, list, item) {
  25641. // variables for margins
  25642. for (let m in margin) {
  25643. if (typeof margin[m].value !== "undefined") {
  25644. let value = margin[m].value + (margin[m].unit || "");
  25645. let mVar = list.createItem({
  25646. type: "Declaration",
  25647. property: "--pagedjs-margin-" + m,
  25648. value: {
  25649. type: "Raw",
  25650. value: value
  25651. }
  25652. });
  25653. list.append(mVar, item);
  25654. }
  25655. }
  25656. }
  25657. addPaddingVars(padding, list, item) {
  25658. // variables for padding
  25659. for (let p in padding) {
  25660. if (typeof padding[p].value !== "undefined") {
  25661. let value = padding[p].value + (padding[p].unit || "");
  25662. let pVar = list.createItem({
  25663. type: "Declaration",
  25664. property: "--pagedjs-padding-" + p,
  25665. value: {
  25666. type: "Raw",
  25667. value: value
  25668. }
  25669. });
  25670. list.append(pVar, item);
  25671. }
  25672. }
  25673. }
  25674. addBorderVars(border, list, item) {
  25675. // variables for borders
  25676. for (const name of Object.keys(border)) {
  25677. const value = border[name];
  25678. // value is an empty object when undefined
  25679. if (typeof value === "string") {
  25680. const borderItem = list.createItem({
  25681. type: "Declaration",
  25682. property: "--pagedjs-border-" + name,
  25683. value: {
  25684. type: "Raw",
  25685. value: value
  25686. }
  25687. });
  25688. list.append(borderItem, item);
  25689. }
  25690. }
  25691. }
  25692. addDimensions(width, height, orientation, list, item) {
  25693. let widthString, heightString;
  25694. widthString = CSSValueToString(width);
  25695. heightString = CSSValueToString(height);
  25696. if (orientation && orientation !== "portrait") {
  25697. // reverse for orientation
  25698. [widthString, heightString] = [heightString, widthString];
  25699. }
  25700. // width variable
  25701. let wVar = this.createVariable("--pagedjs-pagebox-width", widthString);
  25702. list.appendData(wVar);
  25703. // height variable
  25704. let hVar = this.createVariable("--pagedjs-pagebox-height", heightString);
  25705. list.appendData(hVar);
  25706. // let w = this.createDimension("width", width);
  25707. // let h = this.createDimension("height", height);
  25708. // list.appendData(w);
  25709. // list.appendData(h);
  25710. }
  25711. addMarginaliaStyles(page, list, item, sheet) {
  25712. for (let loc in page.marginalia) {
  25713. let block = csstree.clone(page.marginalia[loc]);
  25714. let hasContent = false;
  25715. if (block.children.isEmpty()) {
  25716. continue;
  25717. }
  25718. csstree.walk(block, {
  25719. visit: "Declaration",
  25720. enter: (node, item, list) => {
  25721. if (node.property === "content") {
  25722. if (node.value.children && node.value.children.first().name === "none") {
  25723. hasContent = false;
  25724. } else {
  25725. hasContent = true;
  25726. }
  25727. list.remove(item);
  25728. }
  25729. if (node.property === "vertical-align") {
  25730. csstree.walk(node, {
  25731. visit: "Identifier",
  25732. enter: (identNode, identItem, identlist) => {
  25733. let name = identNode.name;
  25734. if (name === "top") {
  25735. identNode.name = "flex-start";
  25736. } else if (name === "middle") {
  25737. identNode.name = "center";
  25738. } else if (name === "bottom") {
  25739. identNode.name = "flex-end";
  25740. }
  25741. }
  25742. });
  25743. node.property = "align-items";
  25744. }
  25745. if (node.property === "width" &&
  25746. (loc === "top-left" ||
  25747. loc === "top-center" ||
  25748. loc === "top-right" ||
  25749. loc === "bottom-left" ||
  25750. loc === "bottom-center" ||
  25751. loc === "bottom-right")) {
  25752. let c = csstree.clone(node);
  25753. c.property = "max-width";
  25754. list.appendData(c);
  25755. }
  25756. if (node.property === "height" &&
  25757. (loc === "left-top" ||
  25758. loc === "left-middle" ||
  25759. loc === "left-bottom" ||
  25760. loc === "right-top" ||
  25761. loc === "right-middle" ||
  25762. loc === "right-bottom")) {
  25763. let c = csstree.clone(node);
  25764. c.property = "max-height";
  25765. list.appendData(c);
  25766. }
  25767. }
  25768. });
  25769. let marginSelectors = this.selectorsForPageMargin(page, loc);
  25770. let marginRule = this.createRule(marginSelectors, block);
  25771. list.appendData(marginRule);
  25772. let sel = csstree.generate({
  25773. type: "Selector",
  25774. children: marginSelectors
  25775. });
  25776. this.marginalia[sel] = {
  25777. page: page,
  25778. selector: sel,
  25779. block: page.marginalia[loc],
  25780. hasContent: hasContent
  25781. };
  25782. }
  25783. }
  25784. addMarginaliaContent(page, list, item, sheet) {
  25785. let displayNone;
  25786. // Just content
  25787. for (let loc in page.marginalia) {
  25788. let content = csstree.clone(page.marginalia[loc]);
  25789. csstree.walk(content, {
  25790. visit: "Declaration",
  25791. enter: (node, item, list) => {
  25792. if (node.property !== "content") {
  25793. list.remove(item);
  25794. }
  25795. if (node.value.children && node.value.children.first().name === "none") {
  25796. displayNone = true;
  25797. }
  25798. }
  25799. });
  25800. if (content.children.isEmpty()) {
  25801. continue;
  25802. }
  25803. let displaySelectors = this.selectorsForPageMargin(page, loc);
  25804. let displayDeclaration;
  25805. displaySelectors.insertData({
  25806. type: "Combinator",
  25807. name: ">"
  25808. });
  25809. displaySelectors.insertData({
  25810. type: "ClassSelector",
  25811. name: "pagedjs_margin-content"
  25812. });
  25813. displaySelectors.insertData({
  25814. type: "Combinator",
  25815. name: ">"
  25816. });
  25817. displaySelectors.insertData({
  25818. type: "TypeSelector",
  25819. name: "*"
  25820. });
  25821. if (displayNone) {
  25822. displayDeclaration = this.createDeclaration("display", "none");
  25823. } else {
  25824. displayDeclaration = this.createDeclaration("display", "block");
  25825. }
  25826. let displayRule = this.createRule(displaySelectors, [displayDeclaration]);
  25827. sheet.insertRule(displayRule);
  25828. // insert content rule
  25829. let contentSelectors = this.selectorsForPageMargin(page, loc);
  25830. contentSelectors.insertData({
  25831. type: "Combinator",
  25832. name: ">"
  25833. });
  25834. contentSelectors.insertData({
  25835. type: "ClassSelector",
  25836. name: "pagedjs_margin-content"
  25837. });
  25838. contentSelectors.insertData({
  25839. type: "PseudoElementSelector",
  25840. name: "after",
  25841. children: null
  25842. });
  25843. let contentRule = this.createRule(contentSelectors, content);
  25844. sheet.insertRule(contentRule);
  25845. }
  25846. }
  25847. addRootVars(ast, width, height, orientation, bleed, bleedrecto, bleedverso, marks) {
  25848. let rules = [];
  25849. let selectors = new csstree.List();
  25850. selectors.insertData({
  25851. type: "PseudoClassSelector",
  25852. name: "root",
  25853. children: null
  25854. });
  25855. let widthString, heightString;
  25856. let widthStringRight, heightStringRight;
  25857. let widthStringLeft, heightStringLeft;
  25858. if (!bleed) {
  25859. widthString = CSSValueToString(width);
  25860. heightString = CSSValueToString(height);
  25861. widthStringRight = CSSValueToString(width);
  25862. heightStringRight = CSSValueToString(height);
  25863. widthStringLeft = CSSValueToString(width);
  25864. heightStringLeft = CSSValueToString(height);
  25865. } else {
  25866. widthString = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleed.left)} + ${CSSValueToString(bleed.right)} )`;
  25867. heightString = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleed.top)} + ${CSSValueToString(bleed.bottom)} )`;
  25868. widthStringRight = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleed.left)} + ${CSSValueToString(bleed.right)} )`;
  25869. heightStringRight = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleed.top)} + ${CSSValueToString(bleed.bottom)} )`;
  25870. widthStringLeft = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleed.left)} + ${CSSValueToString(bleed.right)} )`;
  25871. heightStringLeft = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleed.top)} + ${CSSValueToString(bleed.bottom)} )`;
  25872. let bleedTop = this.createVariable("--pagedjs-bleed-top", CSSValueToString(bleed.top));
  25873. let bleedRight = this.createVariable("--pagedjs-bleed-right", CSSValueToString(bleed.right));
  25874. let bleedBottom = this.createVariable("--pagedjs-bleed-bottom", CSSValueToString(bleed.bottom));
  25875. let bleedLeft = this.createVariable("--pagedjs-bleed-left", CSSValueToString(bleed.left));
  25876. let bleedTopRecto = this.createVariable("--pagedjs-bleed-right-top", CSSValueToString(bleed.top));
  25877. let bleedRightRecto = this.createVariable("--pagedjs-bleed-right-right", CSSValueToString(bleed.right));
  25878. let bleedBottomRecto = this.createVariable("--pagedjs-bleed-right-bottom", CSSValueToString(bleed.bottom));
  25879. let bleedLeftRecto = this.createVariable("--pagedjs-bleed-right-left", CSSValueToString(bleed.left));
  25880. let bleedTopVerso = this.createVariable("--pagedjs-bleed-left-top", CSSValueToString(bleed.top));
  25881. let bleedRightVerso = this.createVariable("--pagedjs-bleed-left-right", CSSValueToString(bleed.right));
  25882. let bleedBottomVerso = this.createVariable("--pagedjs-bleed-left-bottom", CSSValueToString(bleed.bottom));
  25883. let bleedLeftVerso = this.createVariable("--pagedjs-bleed-left-left", CSSValueToString(bleed.left));
  25884. if (bleedrecto) {
  25885. bleedTopRecto = this.createVariable("--pagedjs-bleed-right-top", CSSValueToString(bleedrecto.top));
  25886. bleedRightRecto = this.createVariable("--pagedjs-bleed-right-right", CSSValueToString(bleedrecto.right));
  25887. bleedBottomRecto = this.createVariable("--pagedjs-bleed-right-bottom", CSSValueToString(bleedrecto.bottom));
  25888. bleedLeftRecto = this.createVariable("--pagedjs-bleed-right-left", CSSValueToString(bleedrecto.left));
  25889. widthStringRight = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleedrecto.left)} + ${CSSValueToString(bleedrecto.right)} )`;
  25890. heightStringRight = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleedrecto.top)} + ${CSSValueToString(bleedrecto.bottom)} )`;
  25891. }
  25892. if (bleedverso) {
  25893. bleedTopVerso = this.createVariable("--pagedjs-bleed-left-top", CSSValueToString(bleedverso.top));
  25894. bleedRightVerso = this.createVariable("--pagedjs-bleed-left-right", CSSValueToString(bleedverso.right));
  25895. bleedBottomVerso = this.createVariable("--pagedjs-bleed-left-bottom", CSSValueToString(bleedverso.bottom));
  25896. bleedLeftVerso = this.createVariable("--pagedjs-bleed-left-left", CSSValueToString(bleedverso.left));
  25897. widthStringLeft = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleedverso.left)} + ${CSSValueToString(bleedverso.right)} )`;
  25898. heightStringLeft = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleedverso.top)} + ${CSSValueToString(bleedverso.bottom)} )`;
  25899. }
  25900. let pageWidthVar = this.createVariable("--pagedjs-width", CSSValueToString(width));
  25901. let pageHeightVar = this.createVariable("--pagedjs-height", CSSValueToString(height));
  25902. rules.push(
  25903. bleedTop,
  25904. bleedRight,
  25905. bleedBottom,
  25906. bleedLeft,
  25907. bleedTopRecto,
  25908. bleedRightRecto,
  25909. bleedBottomRecto,
  25910. bleedLeftRecto,
  25911. bleedTopVerso,
  25912. bleedRightVerso,
  25913. bleedBottomVerso,
  25914. bleedLeftVerso,
  25915. pageWidthVar,
  25916. pageHeightVar
  25917. );
  25918. }
  25919. if (marks) {
  25920. marks.forEach((mark) => {
  25921. let markDisplay = this.createVariable("--pagedjs-mark-" + mark + "-display", "block");
  25922. rules.push(markDisplay);
  25923. });
  25924. }
  25925. // orientation variable
  25926. if (orientation) {
  25927. let oVar = this.createVariable("--pagedjs-orientation", orientation);
  25928. rules.push(oVar);
  25929. if (orientation !== "portrait") {
  25930. // reverse for orientation
  25931. [widthString, heightString] = [heightString, widthString];
  25932. [widthStringRight, heightStringRight] = [heightStringRight, widthStringRight];
  25933. [widthStringLeft, heightStringLeft] = [heightStringLeft, widthStringLeft];
  25934. }
  25935. }
  25936. let wVar = this.createVariable("--pagedjs-width", widthString);
  25937. let hVar = this.createVariable("--pagedjs-height", heightString);
  25938. let wVarR = this.createVariable("--pagedjs-width-right", widthStringRight);
  25939. let hVarR = this.createVariable("--pagedjs-height-right", heightStringRight);
  25940. let wVarL = this.createVariable("--pagedjs-width-left", widthStringLeft);
  25941. let hVarL = this.createVariable("--pagedjs-height-left", heightStringLeft);
  25942. rules.push(wVar, hVar, wVarR, hVarR, wVarL, hVarL);
  25943. let rule = this.createRule(selectors, rules);
  25944. ast.children.appendData(rule);
  25945. }
  25946. addNotesStyles(notes, page, list, item, sheet) {
  25947. for (const note in notes) {
  25948. let selectors = this.selectorsForPage(page);
  25949. selectors.insertData({
  25950. type: "Combinator",
  25951. name: " "
  25952. });
  25953. selectors.insertData({
  25954. type: "ClassSelector",
  25955. name: "pagedjs_" + note + "_content"
  25956. });
  25957. let notesRule = this.createRule(selectors, notes[note]);
  25958. list.appendData(notesRule);
  25959. }
  25960. }
  25961. /*
  25962. @page {
  25963. size: var(--pagedjs-width) var(--pagedjs-height);
  25964. margin: 0;
  25965. padding: 0;
  25966. }
  25967. */
  25968. addRootPage(ast, size, bleed, bleedrecto, bleedverso) {
  25969. let { width, height, orientation, format } = size;
  25970. let children = new csstree.List();
  25971. let childrenLeft = new csstree.List();
  25972. let childrenRight = new csstree.List();
  25973. let dimensions = new csstree.List();
  25974. let dimensionsLeft = new csstree.List();
  25975. let dimensionsRight = new csstree.List();
  25976. if (bleed) {
  25977. let widthCalculations = new csstree.List();
  25978. let heightCalculations = new csstree.List();
  25979. // width
  25980. widthCalculations.appendData({
  25981. type: "Dimension",
  25982. unit: width.unit,
  25983. value: width.value
  25984. });
  25985. widthCalculations.appendData({
  25986. type: "WhiteSpace",
  25987. value: " "
  25988. });
  25989. widthCalculations.appendData({
  25990. type: "Operator",
  25991. value: "+"
  25992. });
  25993. widthCalculations.appendData({
  25994. type: "WhiteSpace",
  25995. value: " "
  25996. });
  25997. widthCalculations.appendData({
  25998. type: "Dimension",
  25999. unit: bleed.left.unit,
  26000. value: bleed.left.value
  26001. });
  26002. widthCalculations.appendData({
  26003. type: "WhiteSpace",
  26004. value: " "
  26005. });
  26006. widthCalculations.appendData({
  26007. type: "Operator",
  26008. value: "+"
  26009. });
  26010. widthCalculations.appendData({
  26011. type: "WhiteSpace",
  26012. value: " "
  26013. });
  26014. widthCalculations.appendData({
  26015. type: "Dimension",
  26016. unit: bleed.right.unit,
  26017. value: bleed.right.value
  26018. });
  26019. // height
  26020. heightCalculations.appendData({
  26021. type: "Dimension",
  26022. unit: height.unit,
  26023. value: height.value
  26024. });
  26025. heightCalculations.appendData({
  26026. type: "WhiteSpace",
  26027. value: " "
  26028. });
  26029. heightCalculations.appendData({
  26030. type: "Operator",
  26031. value: "+"
  26032. });
  26033. heightCalculations.appendData({
  26034. type: "WhiteSpace",
  26035. value: " "
  26036. });
  26037. heightCalculations.appendData({
  26038. type: "Dimension",
  26039. unit: bleed.top.unit,
  26040. value: bleed.top.value
  26041. });
  26042. heightCalculations.appendData({
  26043. type: "WhiteSpace",
  26044. value: " "
  26045. });
  26046. heightCalculations.appendData({
  26047. type: "Operator",
  26048. value: "+"
  26049. });
  26050. heightCalculations.appendData({
  26051. type: "WhiteSpace",
  26052. value: " "
  26053. });
  26054. heightCalculations.appendData({
  26055. type: "Dimension",
  26056. unit: bleed.bottom.unit,
  26057. value: bleed.bottom.value
  26058. });
  26059. dimensions.appendData({
  26060. type: "Function",
  26061. name: "calc",
  26062. children: widthCalculations
  26063. });
  26064. dimensions.appendData({
  26065. type: "WhiteSpace",
  26066. value: " "
  26067. });
  26068. dimensions.appendData({
  26069. type: "Function",
  26070. name: "calc",
  26071. children: heightCalculations
  26072. });
  26073. } else if (format) {
  26074. dimensions.appendData({
  26075. type: "Identifier",
  26076. name: format
  26077. });
  26078. if (orientation) {
  26079. dimensions.appendData({
  26080. type: "WhiteSpace",
  26081. value: " "
  26082. });
  26083. dimensions.appendData({
  26084. type: "Identifier",
  26085. name: orientation
  26086. });
  26087. }
  26088. } else {
  26089. dimensions.appendData({
  26090. type: "Dimension",
  26091. unit: width.unit,
  26092. value: width.value
  26093. });
  26094. dimensions.appendData({
  26095. type: "WhiteSpace",
  26096. value: " "
  26097. });
  26098. dimensions.appendData({
  26099. type: "Dimension",
  26100. unit: height.unit,
  26101. value: height.value
  26102. });
  26103. }
  26104. children.appendData({
  26105. type: "Declaration",
  26106. property: "size",
  26107. loc: null,
  26108. value: {
  26109. type: "Value",
  26110. children: dimensions
  26111. }
  26112. });
  26113. children.appendData({
  26114. type: "Declaration",
  26115. property: "margin",
  26116. loc: null,
  26117. value: {
  26118. type: "Value",
  26119. children: [{
  26120. type: "Dimension",
  26121. unit: "px",
  26122. value: 0
  26123. }]
  26124. }
  26125. });
  26126. children.appendData({
  26127. type: "Declaration",
  26128. property: "padding",
  26129. loc: null,
  26130. value: {
  26131. type: "Value",
  26132. children: [{
  26133. type: "Dimension",
  26134. unit: "px",
  26135. value: 0
  26136. }]
  26137. }
  26138. });
  26139. children.appendData({
  26140. type: "Declaration",
  26141. property: "padding",
  26142. loc: null,
  26143. value: {
  26144. type: "Value",
  26145. children: [{
  26146. type: "Dimension",
  26147. unit: "px",
  26148. value: 0
  26149. }]
  26150. }
  26151. });
  26152. let rule = ast.children.createItem({
  26153. type: "Atrule",
  26154. prelude: null,
  26155. name: "page",
  26156. block: {
  26157. type: "Block",
  26158. loc: null,
  26159. children: children
  26160. }
  26161. });
  26162. ast.children.append(rule);
  26163. if (bleedverso) {
  26164. let widthCalculationsLeft = new csstree.List();
  26165. let heightCalculationsLeft = new csstree.List();
  26166. // width
  26167. widthCalculationsLeft.appendData({
  26168. type: "Dimension",
  26169. unit: width.unit,
  26170. value: width.value
  26171. });
  26172. widthCalculationsLeft.appendData({
  26173. type: "WhiteSpace",
  26174. value: " "
  26175. });
  26176. widthCalculationsLeft.appendData({
  26177. type: "Operator",
  26178. value: "+"
  26179. });
  26180. widthCalculationsLeft.appendData({
  26181. type: "WhiteSpace",
  26182. value: " "
  26183. });
  26184. widthCalculationsLeft.appendData({
  26185. type: "Dimension",
  26186. unit: bleedverso.left.unit,
  26187. value: bleedverso.left.value
  26188. });
  26189. widthCalculationsLeft.appendData({
  26190. type: "WhiteSpace",
  26191. value: " "
  26192. });
  26193. widthCalculationsLeft.appendData({
  26194. type: "Operator",
  26195. value: "+"
  26196. });
  26197. widthCalculationsLeft.appendData({
  26198. type: "WhiteSpace",
  26199. value: " "
  26200. });
  26201. widthCalculationsLeft.appendData({
  26202. type: "Dimension",
  26203. unit: bleedverso.right.unit,
  26204. value: bleedverso.right.value
  26205. });
  26206. // height
  26207. heightCalculationsLeft.appendData({
  26208. type: "Dimension",
  26209. unit: height.unit,
  26210. value: height.value
  26211. });
  26212. heightCalculationsLeft.appendData({
  26213. type: "WhiteSpace",
  26214. value: " "
  26215. });
  26216. heightCalculationsLeft.appendData({
  26217. type: "Operator",
  26218. value: "+"
  26219. });
  26220. heightCalculationsLeft.appendData({
  26221. type: "WhiteSpace",
  26222. value: " "
  26223. });
  26224. heightCalculationsLeft.appendData({
  26225. type: "Dimension",
  26226. unit: bleedverso.top.unit,
  26227. value: bleedverso.top.value
  26228. });
  26229. heightCalculationsLeft.appendData({
  26230. type: "WhiteSpace",
  26231. value: " "
  26232. });
  26233. heightCalculationsLeft.appendData({
  26234. type: "Operator",
  26235. value: "+"
  26236. });
  26237. heightCalculationsLeft.appendData({
  26238. type: "WhiteSpace",
  26239. value: " "
  26240. });
  26241. heightCalculationsLeft.appendData({
  26242. type: "Dimension",
  26243. unit: bleedverso.bottom.unit,
  26244. value: bleedverso.bottom.value
  26245. });
  26246. dimensionsLeft.appendData({
  26247. type: "Function",
  26248. name: "calc",
  26249. children: widthCalculationsLeft
  26250. });
  26251. dimensionsLeft.appendData({
  26252. type: "WhiteSpace",
  26253. value: " "
  26254. });
  26255. dimensionsLeft.appendData({
  26256. type: "Function",
  26257. name: "calc",
  26258. children: heightCalculationsLeft
  26259. });
  26260. childrenLeft.appendData({
  26261. type: "Declaration",
  26262. property: "size",
  26263. loc: null,
  26264. value: {
  26265. type: "Value",
  26266. children: dimensionsLeft
  26267. }
  26268. });
  26269. let ruleLeft = ast.children.createItem({
  26270. type: "Atrule",
  26271. prelude: null,
  26272. name: "page :left",
  26273. block: {
  26274. type: "Block",
  26275. loc: null,
  26276. children: childrenLeft
  26277. }
  26278. });
  26279. ast.children.append(ruleLeft);
  26280. }
  26281. if (bleedrecto) {
  26282. let widthCalculationsRight = new csstree.List();
  26283. let heightCalculationsRight = new csstree.List();
  26284. // width
  26285. widthCalculationsRight.appendData({
  26286. type: "Dimension",
  26287. unit: width.unit,
  26288. value: width.value
  26289. });
  26290. widthCalculationsRight.appendData({
  26291. type: "WhiteSpace",
  26292. value: " "
  26293. });
  26294. widthCalculationsRight.appendData({
  26295. type: "Operator",
  26296. value: "+"
  26297. });
  26298. widthCalculationsRight.appendData({
  26299. type: "WhiteSpace",
  26300. value: " "
  26301. });
  26302. widthCalculationsRight.appendData({
  26303. type: "Dimension",
  26304. unit: bleedrecto.left.unit,
  26305. value: bleedrecto.left.value
  26306. });
  26307. widthCalculationsRight.appendData({
  26308. type: "WhiteSpace",
  26309. value: " "
  26310. });
  26311. widthCalculationsRight.appendData({
  26312. type: "Operator",
  26313. value: "+"
  26314. });
  26315. widthCalculationsRight.appendData({
  26316. type: "WhiteSpace",
  26317. value: " "
  26318. });
  26319. widthCalculationsRight.appendData({
  26320. type: "Dimension",
  26321. unit: bleedrecto.right.unit,
  26322. value: bleedrecto.right.value
  26323. });
  26324. // height
  26325. heightCalculationsRight.appendData({
  26326. type: "Dimension",
  26327. unit: height.unit,
  26328. value: height.value
  26329. });
  26330. heightCalculationsRight.appendData({
  26331. type: "WhiteSpace",
  26332. value: " "
  26333. });
  26334. heightCalculationsRight.appendData({
  26335. type: "Operator",
  26336. value: "+"
  26337. });
  26338. heightCalculationsRight.appendData({
  26339. type: "WhiteSpace",
  26340. value: " "
  26341. });
  26342. heightCalculationsRight.appendData({
  26343. type: "Dimension",
  26344. unit: bleedrecto.top.unit,
  26345. value: bleedrecto.top.value
  26346. });
  26347. heightCalculationsRight.appendData({
  26348. type: "WhiteSpace",
  26349. value: " "
  26350. });
  26351. heightCalculationsRight.appendData({
  26352. type: "Operator",
  26353. value: "+"
  26354. });
  26355. heightCalculationsRight.appendData({
  26356. type: "WhiteSpace",
  26357. value: " "
  26358. });
  26359. heightCalculationsRight.appendData({
  26360. type: "Dimension",
  26361. unit: bleedrecto.bottom.unit,
  26362. value: bleedrecto.bottom.value
  26363. });
  26364. dimensionsRight.appendData({
  26365. type: "Function",
  26366. name: "calc",
  26367. children: widthCalculationsRight
  26368. });
  26369. dimensionsRight.appendData({
  26370. type: "WhiteSpace",
  26371. value: " "
  26372. });
  26373. dimensionsRight.appendData({
  26374. type: "Function",
  26375. name: "calc",
  26376. children: heightCalculationsRight
  26377. });
  26378. childrenRight.appendData({
  26379. type: "Declaration",
  26380. property: "size",
  26381. loc: null,
  26382. value: {
  26383. type: "Value",
  26384. children: dimensionsRight
  26385. }
  26386. });
  26387. let ruleRight = ast.children.createItem({
  26388. type: "Atrule",
  26389. prelude: null,
  26390. name: "page :right",
  26391. block: {
  26392. type: "Block",
  26393. loc: null,
  26394. children: childrenRight
  26395. }
  26396. });
  26397. ast.children.append(ruleRight);
  26398. }
  26399. }
  26400. getNth(nth) {
  26401. let n = nth.indexOf("n");
  26402. let plus = nth.indexOf("+");
  26403. let splitN = nth.split("n");
  26404. let splitP = nth.split("+");
  26405. let a = null;
  26406. let b = null;
  26407. if (n > -1) {
  26408. a = splitN[0];
  26409. if (plus > -1) {
  26410. b = splitP[1];
  26411. }
  26412. } else {
  26413. b = nth;
  26414. }
  26415. return {
  26416. type: "Nth",
  26417. loc: null,
  26418. selector: null,
  26419. nth: {
  26420. type: "AnPlusB",
  26421. loc: null,
  26422. a: a,
  26423. b: b
  26424. }
  26425. };
  26426. }
  26427. addPageAttributes(page, start, pages) {
  26428. let namedPages = [start.dataset.page];
  26429. if (namedPages && namedPages.length) {
  26430. for (const named of namedPages) {
  26431. if (!named) {
  26432. continue;
  26433. }
  26434. page.name = named;
  26435. page.element.classList.add("pagedjs_named_page");
  26436. page.element.classList.add("pagedjs_" + named + "_page");
  26437. if (!start.dataset.splitFrom) {
  26438. page.element.classList.add("pagedjs_" + named + "_first_page");
  26439. }
  26440. }
  26441. }
  26442. }
  26443. getStartElement(content, breakToken) {
  26444. let node = breakToken && breakToken.node;
  26445. if (!content && !breakToken) {
  26446. return;
  26447. }
  26448. // No break
  26449. if (!node) {
  26450. return content.children[0];
  26451. }
  26452. // Top level element
  26453. if (node.nodeType === 1 && node.parentNode.nodeType === 11) {
  26454. return node;
  26455. }
  26456. // Named page
  26457. if (node.nodeType === 1 && node.dataset.page) {
  26458. return node;
  26459. }
  26460. // Get top level Named parent
  26461. let fragment = rebuildAncestors(node);
  26462. let pages = fragment.querySelectorAll("[data-page]");
  26463. if (pages.length) {
  26464. return pages[pages.length - 1];
  26465. } else {
  26466. return fragment.children[0];
  26467. }
  26468. }
  26469. beforePageLayout(page, contents, breakToken, chunker) {
  26470. let start = this.getStartElement(contents, breakToken);
  26471. if (start) {
  26472. this.addPageAttributes(page, start, chunker.pages);
  26473. }
  26474. // page.element.querySelector('.paged_area').style.color = red;
  26475. }
  26476. finalizePage(fragment, page, breakToken, chunker) {
  26477. for (let m in this.marginalia) {
  26478. let margin = this.marginalia[m];
  26479. let sels = m.split(" ");
  26480. let content;
  26481. if (page.element.matches(sels[0]) && margin.hasContent) {
  26482. content = page.element.querySelector(sels[1]);
  26483. content.classList.add("hasContent");
  26484. }
  26485. }
  26486. // check center
  26487. ["top", "bottom"].forEach((loc) => {
  26488. let marginGroup = page.element.querySelector(".pagedjs_margin-" + loc);
  26489. let center = page.element.querySelector(".pagedjs_margin-" + loc + "-center");
  26490. let left = page.element.querySelector(".pagedjs_margin-" + loc + "-left");
  26491. let right = page.element.querySelector(".pagedjs_margin-" + loc + "-right");
  26492. let centerContent = center.classList.contains("hasContent");
  26493. let leftContent = left.classList.contains("hasContent");
  26494. let rightContent = right.classList.contains("hasContent");
  26495. let centerWidth, leftWidth, rightWidth;
  26496. if (leftContent) {
  26497. leftWidth = window.getComputedStyle(left)["max-width"];
  26498. }
  26499. if (rightContent) {
  26500. rightWidth = window.getComputedStyle(right)["max-width"];
  26501. }
  26502. if (centerContent) {
  26503. centerWidth = window.getComputedStyle(center)["max-width"];
  26504. if (centerWidth === "none" || centerWidth === "auto") {
  26505. if (!leftContent && !rightContent) {
  26506. marginGroup.style["grid-template-columns"] = "0 1fr 0";
  26507. } else if (leftContent) {
  26508. if (!rightContent) {
  26509. if (leftWidth !== "none" && leftWidth !== "auto") {
  26510. marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + leftWidth;
  26511. } else {
  26512. marginGroup.style["grid-template-columns"] = "auto auto 1fr";
  26513. left.style["white-space"] = "nowrap";
  26514. center.style["white-space"] = "nowrap";
  26515. let leftOuterWidth = left.offsetWidth;
  26516. let centerOuterWidth = center.offsetWidth;
  26517. let outerwidths = leftOuterWidth + centerOuterWidth;
  26518. let newcenterWidth = centerOuterWidth * 100 / outerwidths;
  26519. marginGroup.style["grid-template-columns"] = "minmax(16.66%, 1fr) minmax(33%, " + newcenterWidth + "%) minmax(16.66%, 1fr)";
  26520. left.style["white-space"] = "normal";
  26521. center.style["white-space"] = "normal";
  26522. }
  26523. } else {
  26524. if (leftWidth !== "none" && leftWidth !== "auto") {
  26525. if (rightWidth !== "none" && rightWidth !== "auto") {
  26526. marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + rightWidth;
  26527. } else {
  26528. marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + leftWidth;
  26529. }
  26530. } else {
  26531. if (rightWidth !== "none" && rightWidth !== "auto") {
  26532. marginGroup.style["grid-template-columns"] = rightWidth + " 1fr " + rightWidth;
  26533. } else {
  26534. marginGroup.style["grid-template-columns"] = "auto auto 1fr";
  26535. left.style["white-space"] = "nowrap";
  26536. center.style["white-space"] = "nowrap";
  26537. right.style["white-space"] = "nowrap";
  26538. let leftOuterWidth = left.offsetWidth;
  26539. let centerOuterWidth = center.offsetWidth;
  26540. let rightOuterWidth = right.offsetWidth;
  26541. let outerwidths = leftOuterWidth + centerOuterWidth + rightOuterWidth;
  26542. let newcenterWidth = centerOuterWidth * 100 / outerwidths;
  26543. if (newcenterWidth > 40) {
  26544. marginGroup.style["grid-template-columns"] = "minmax(16.66%, 1fr) minmax(33%, " + newcenterWidth + "%) minmax(16.66%, 1fr)";
  26545. } else {
  26546. marginGroup.style["grid-template-columns"] = "repeat(3, 1fr)";
  26547. }
  26548. left.style["white-space"] = "normal";
  26549. center.style["white-space"] = "normal";
  26550. right.style["white-space"] = "normal";
  26551. }
  26552. }
  26553. }
  26554. } else {
  26555. if (rightWidth !== "none" && rightWidth !== "auto") {
  26556. marginGroup.style["grid-template-columns"] = rightWidth + " 1fr " + rightWidth;
  26557. } else {
  26558. marginGroup.style["grid-template-columns"] = "auto auto 1fr";
  26559. right.style["white-space"] = "nowrap";
  26560. center.style["white-space"] = "nowrap";
  26561. let rightOuterWidth = right.offsetWidth;
  26562. let centerOuterWidth = center.offsetWidth;
  26563. let outerwidths = rightOuterWidth + centerOuterWidth;
  26564. let newcenterWidth = centerOuterWidth * 100 / outerwidths;
  26565. marginGroup.style["grid-template-columns"] = "minmax(16.66%, 1fr) minmax(33%, " + newcenterWidth + "%) minmax(16.66%, 1fr)";
  26566. right.style["white-space"] = "normal";
  26567. center.style["white-space"] = "normal";
  26568. }
  26569. }
  26570. } else if (centerWidth !== "none" && centerWidth !== "auto") {
  26571. if (leftContent && leftWidth !== "none" && leftWidth !== "auto") {
  26572. marginGroup.style["grid-template-columns"] = leftWidth + " " + centerWidth + " 1fr";
  26573. } else if (rightContent && rightWidth !== "none" && rightWidth !== "auto") {
  26574. marginGroup.style["grid-template-columns"] = "1fr " + centerWidth + " " + rightWidth;
  26575. } else {
  26576. marginGroup.style["grid-template-columns"] = "1fr " + centerWidth + " 1fr";
  26577. }
  26578. }
  26579. } else {
  26580. if (leftContent) {
  26581. if (!rightContent) {
  26582. marginGroup.style["grid-template-columns"] = "1fr 0 0";
  26583. } else {
  26584. if (leftWidth !== "none" && leftWidth !== "auto") {
  26585. if (rightWidth !== "none" && rightWidth !== "auto") {
  26586. marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + rightWidth;
  26587. } else {
  26588. marginGroup.style["grid-template-columns"] = leftWidth + " 0 1fr";
  26589. }
  26590. } else {
  26591. if (rightWidth !== "none" && rightWidth !== "auto") {
  26592. marginGroup.style["grid-template-columns"] = "1fr 0 " + rightWidth;
  26593. } else {
  26594. marginGroup.style["grid-template-columns"] = "auto 1fr auto";
  26595. left.style["white-space"] = "nowrap";
  26596. right.style["white-space"] = "nowrap";
  26597. let leftOuterWidth = left.offsetWidth;
  26598. let rightOuterWidth = right.offsetWidth;
  26599. let outerwidths = leftOuterWidth + rightOuterWidth;
  26600. let newLeftWidth = leftOuterWidth * 100 / outerwidths;
  26601. marginGroup.style["grid-template-columns"] = "minmax(16.66%, " + newLeftWidth + "%) 0 1fr";
  26602. left.style["white-space"] = "normal";
  26603. right.style["white-space"] = "normal";
  26604. }
  26605. }
  26606. }
  26607. } else {
  26608. if (rightWidth !== "none" && rightWidth !== "auto") {
  26609. marginGroup.style["grid-template-columns"] = "1fr 0 " + rightWidth;
  26610. } else {
  26611. marginGroup.style["grid-template-columns"] = "0 0 1fr";
  26612. }
  26613. }
  26614. }
  26615. });
  26616. // check middle
  26617. ["left", "right"].forEach((loc) => {
  26618. let middle = page.element.querySelector(".pagedjs_margin-" + loc + "-middle.hasContent");
  26619. let marginGroup = page.element.querySelector(".pagedjs_margin-" + loc);
  26620. let top = page.element.querySelector(".pagedjs_margin-" + loc + "-top");
  26621. let bottom = page.element.querySelector(".pagedjs_margin-" + loc + "-bottom");
  26622. let topContent = top.classList.contains("hasContent");
  26623. let bottomContent = bottom.classList.contains("hasContent");
  26624. let middleHeight, topHeight, bottomHeight;
  26625. if (topContent) {
  26626. topHeight = window.getComputedStyle(top)["max-height"];
  26627. }
  26628. if (bottomContent) {
  26629. bottomHeight = window.getComputedStyle(bottom)["max-height"];
  26630. }
  26631. if (middle) {
  26632. middleHeight = window.getComputedStyle(middle)["max-height"];
  26633. if (middleHeight === "none" || middleHeight === "auto") {
  26634. if (!topContent && !bottomContent) {
  26635. marginGroup.style["grid-template-rows"] = "0 1fr 0";
  26636. } else if (topContent) {
  26637. if (!bottomContent) {
  26638. if (topHeight !== "none" && topHeight !== "auto") {
  26639. marginGroup.style["grid-template-rows"] = topHeight + " calc(100% - " + topHeight + "*2) " + topHeight;
  26640. }
  26641. } else {
  26642. if (topHeight !== "none" && topHeight !== "auto") {
  26643. if (bottomHeight !== "none" && bottomHeight !== "auto") {
  26644. marginGroup.style["grid-template-rows"] = topHeight + " calc(100% - " + topHeight + " - " + bottomHeight + ") " + bottomHeight;
  26645. } else {
  26646. marginGroup.style["grid-template-rows"] = topHeight + " calc(100% - " + topHeight + "*2) " + topHeight;
  26647. }
  26648. } else {
  26649. if (bottomHeight !== "none" && bottomHeight !== "auto") {
  26650. marginGroup.style["grid-template-rows"] = bottomHeight + " calc(100% - " + bottomHeight + "*2) " + bottomHeight;
  26651. }
  26652. }
  26653. }
  26654. } else {
  26655. if (bottomHeight !== "none" && bottomHeight !== "auto") {
  26656. marginGroup.style["grid-template-rows"] = bottomHeight + " calc(100% - " + bottomHeight + "*2) " + bottomHeight;
  26657. }
  26658. }
  26659. } else {
  26660. if (topContent && topHeight !== "none" && topHeight !== "auto") {
  26661. marginGroup.style["grid-template-rows"] = topHeight + " " + middleHeight + " calc(100% - (" + topHeight + " + " + middleHeight + "))";
  26662. } else if (bottomContent && bottomHeight !== "none" && bottomHeight !== "auto") {
  26663. marginGroup.style["grid-template-rows"] = "1fr " + middleHeight + " " + bottomHeight;
  26664. } else {
  26665. marginGroup.style["grid-template-rows"] = "calc((100% - " + middleHeight + ")/2) " + middleHeight + " calc((100% - " + middleHeight + ")/2)";
  26666. }
  26667. }
  26668. } else {
  26669. if (topContent) {
  26670. if (!bottomContent) {
  26671. marginGroup.style["grid-template-rows"] = "1fr 0 0";
  26672. } else {
  26673. if (topHeight !== "none" && topHeight !== "auto") {
  26674. if (bottomHeight !== "none" && bottomHeight !== "auto") {
  26675. marginGroup.style["grid-template-rows"] = topHeight + " 1fr " + bottomHeight;
  26676. } else {
  26677. marginGroup.style["grid-template-rows"] = topHeight + " 0 1fr";
  26678. }
  26679. } else {
  26680. if (bottomHeight !== "none" && bottomHeight !== "auto") {
  26681. marginGroup.style["grid-template-rows"] = "1fr 0 " + bottomHeight;
  26682. } else {
  26683. marginGroup.style["grid-template-rows"] = "1fr 0 1fr";
  26684. }
  26685. }
  26686. }
  26687. } else {
  26688. if (bottomHeight !== "none" && bottomHeight !== "auto") {
  26689. marginGroup.style["grid-template-rows"] = "1fr 0 " + bottomHeight;
  26690. } else {
  26691. marginGroup.style["grid-template-rows"] = "0 0 1fr";
  26692. }
  26693. }
  26694. }
  26695. });
  26696. }
  26697. // CSS Tree Helpers
  26698. selectorsForPage(page) {
  26699. let nthlist;
  26700. let nth;
  26701. let selectors = new csstree.List();
  26702. selectors.insertData({
  26703. type: "ClassSelector",
  26704. name: "pagedjs_page"
  26705. });
  26706. // Named page
  26707. if (page.name) {
  26708. selectors.insertData({
  26709. type: "ClassSelector",
  26710. name: "pagedjs_named_page"
  26711. });
  26712. selectors.insertData({
  26713. type: "ClassSelector",
  26714. name: "pagedjs_" + page.name + "_page"
  26715. });
  26716. }
  26717. // PsuedoSelector
  26718. if (page.psuedo && !(page.name && page.psuedo === "first")) {
  26719. selectors.insertData({
  26720. type: "ClassSelector",
  26721. name: "pagedjs_" + page.psuedo + "_page"
  26722. });
  26723. }
  26724. if (page.name && page.psuedo === "first") {
  26725. selectors.insertData({
  26726. type: "ClassSelector",
  26727. name: "pagedjs_" + page.name + "_" + page.psuedo + "_page"
  26728. });
  26729. }
  26730. // Nth
  26731. if (page.nth) {
  26732. nthlist = new csstree.List();
  26733. nth = this.getNth(page.nth);
  26734. nthlist.insertData(nth);
  26735. selectors.insertData({
  26736. type: "PseudoClassSelector",
  26737. name: "nth-of-type",
  26738. children: nthlist
  26739. });
  26740. }
  26741. return selectors;
  26742. }
  26743. selectorsForPageMargin(page, margin) {
  26744. let selectors = this.selectorsForPage(page);
  26745. selectors.insertData({
  26746. type: "Combinator",
  26747. name: " "
  26748. });
  26749. selectors.insertData({
  26750. type: "ClassSelector",
  26751. name: "pagedjs_margin-" + margin
  26752. });
  26753. return selectors;
  26754. }
  26755. createDeclaration(property, value, important) {
  26756. let children = new csstree.List();
  26757. children.insertData({
  26758. type: "Identifier",
  26759. loc: null,
  26760. name: value
  26761. });
  26762. return {
  26763. type: "Declaration",
  26764. loc: null,
  26765. important: important,
  26766. property: property,
  26767. value: {
  26768. type: "Value",
  26769. loc: null,
  26770. children: children
  26771. }
  26772. };
  26773. }
  26774. createVariable(property, value) {
  26775. return {
  26776. type: "Declaration",
  26777. loc: null,
  26778. property: property,
  26779. value: {
  26780. type: "Raw",
  26781. value: value
  26782. }
  26783. };
  26784. }
  26785. createCalculatedDimension(property, items, important, operator = "+") {
  26786. let children = new csstree.List();
  26787. let calculations = new csstree.List();
  26788. items.forEach((item, index) => {
  26789. calculations.appendData({
  26790. type: "Dimension",
  26791. unit: item.unit,
  26792. value: item.value
  26793. });
  26794. calculations.appendData({
  26795. type: "WhiteSpace",
  26796. value: " "
  26797. });
  26798. if (index + 1 < items.length) {
  26799. calculations.appendData({
  26800. type: "Operator",
  26801. value: operator
  26802. });
  26803. calculations.appendData({
  26804. type: "WhiteSpace",
  26805. value: " "
  26806. });
  26807. }
  26808. });
  26809. children.insertData({
  26810. type: "Function",
  26811. loc: null,
  26812. name: "calc",
  26813. children: calculations
  26814. });
  26815. return {
  26816. type: "Declaration",
  26817. loc: null,
  26818. important: important,
  26819. property: property,
  26820. value: {
  26821. type: "Value",
  26822. loc: null,
  26823. children: children
  26824. }
  26825. };
  26826. }
  26827. createDimension(property, cssValue, important) {
  26828. let children = new csstree.List();
  26829. children.insertData({
  26830. type: "Dimension",
  26831. loc: null,
  26832. value: cssValue.value,
  26833. unit: cssValue.unit
  26834. });
  26835. return {
  26836. type: "Declaration",
  26837. loc: null,
  26838. important: important,
  26839. property: property,
  26840. value: {
  26841. type: "Value",
  26842. loc: null,
  26843. children: children
  26844. }
  26845. };
  26846. }
  26847. createBlock(declarations) {
  26848. let block = new csstree.List();
  26849. declarations.forEach((declaration) => {
  26850. block.insertData(declaration);
  26851. });
  26852. return {
  26853. type: "Block",
  26854. loc: null,
  26855. children: block
  26856. };
  26857. }
  26858. createRule(selectors, block) {
  26859. let selectorList = new csstree.List();
  26860. selectorList.insertData({
  26861. type: "Selector",
  26862. children: selectors
  26863. });
  26864. if (Array.isArray(block)) {
  26865. block = this.createBlock(block);
  26866. }
  26867. return {
  26868. type: "Rule",
  26869. prelude: {
  26870. type: "SelectorList",
  26871. children: selectorList
  26872. },
  26873. block: block
  26874. };
  26875. }
  26876. }
  26877. class Breaks extends Handler {
  26878. constructor(chunker, polisher, caller) {
  26879. super(chunker, polisher, caller);
  26880. this.breaks = {};
  26881. }
  26882. onDeclaration(declaration, dItem, dList, rule) {
  26883. let property = declaration.property;
  26884. if (property === "page") {
  26885. let children = declaration.value.children.first();
  26886. let value = children.name;
  26887. let selector = csstree.generate(rule.ruleNode.prelude);
  26888. let name = value;
  26889. let breaker = {
  26890. property: property,
  26891. value: value,
  26892. selector: selector,
  26893. name: name
  26894. };
  26895. selector.split(",").forEach((s) => {
  26896. if (!this.breaks[s]) {
  26897. this.breaks[s] = [breaker];
  26898. } else {
  26899. this.breaks[s].push(breaker);
  26900. }
  26901. });
  26902. dList.remove(dItem);
  26903. }
  26904. if (property === "break-before" ||
  26905. property === "break-after" ||
  26906. property === "page-break-before" ||
  26907. property === "page-break-after"
  26908. ) {
  26909. let child = declaration.value.children.first();
  26910. let value = child.name;
  26911. let selector = csstree.generate(rule.ruleNode.prelude);
  26912. if (property === "page-break-before") {
  26913. property = "break-before";
  26914. } else if (property === "page-break-after") {
  26915. property = "break-after";
  26916. }
  26917. let breaker = {
  26918. property: property,
  26919. value: value,
  26920. selector: selector
  26921. };
  26922. selector.split(",").forEach((s) => {
  26923. if (!this.breaks[s]) {
  26924. this.breaks[s] = [breaker];
  26925. } else {
  26926. this.breaks[s].push(breaker);
  26927. }
  26928. });
  26929. // Remove from CSS -- handle right / left in module
  26930. dList.remove(dItem);
  26931. }
  26932. }
  26933. afterParsed(parsed) {
  26934. this.processBreaks(parsed, this.breaks);
  26935. }
  26936. processBreaks(parsed, breaks) {
  26937. for (let b in breaks) {
  26938. // Find elements
  26939. let elements = parsed.querySelectorAll(b);
  26940. // Add break data
  26941. for (var i = 0; i < elements.length; i++) {
  26942. for (let prop of breaks[b]) {
  26943. if (prop.property === "break-after") {
  26944. let nodeAfter = displayedElementAfter(elements[i], parsed);
  26945. elements[i].setAttribute("data-break-after", prop.value);
  26946. if (nodeAfter) {
  26947. nodeAfter.setAttribute("data-previous-break-after", prop.value);
  26948. }
  26949. } else if (prop.property === "break-before") {
  26950. let nodeBefore = displayedElementBefore(elements[i], parsed);
  26951. // Breaks are only allowed between siblings, not between a box and its container.
  26952. // If we cannot find a node before we should not break!
  26953. // https://drafts.csswg.org/css-break-3/#break-propagation
  26954. if (nodeBefore) {
  26955. if (prop.value === "page" && needsPageBreak(elements[i], nodeBefore)) {
  26956. // we ignore this explicit page break because an implicit page break is already needed
  26957. continue;
  26958. }
  26959. elements[i].setAttribute("data-break-before", prop.value);
  26960. nodeBefore.setAttribute("data-next-break-before", prop.value);
  26961. }
  26962. } else if (prop.property === "page") {
  26963. elements[i].setAttribute("data-page", prop.value);
  26964. let nodeAfter = displayedElementAfter(elements[i], parsed);
  26965. if (nodeAfter) {
  26966. nodeAfter.setAttribute("data-after-page", prop.value);
  26967. }
  26968. } else {
  26969. elements[i].setAttribute("data-" + prop.property, prop.value);
  26970. }
  26971. }
  26972. }
  26973. }
  26974. }
  26975. mergeBreaks(pageBreaks, newBreaks) {
  26976. for (let b in newBreaks) {
  26977. if (b in pageBreaks) {
  26978. pageBreaks[b] = pageBreaks[b].concat(newBreaks[b]);
  26979. } else {
  26980. pageBreaks[b] = newBreaks[b];
  26981. }
  26982. }
  26983. return pageBreaks;
  26984. }
  26985. addBreakAttributes(pageElement, page) {
  26986. let before = pageElement.querySelector("[data-break-before]");
  26987. let after = pageElement.querySelector("[data-break-after]");
  26988. let previousBreakAfter = pageElement.querySelector("[data-previous-break-after]");
  26989. if (before) {
  26990. if (before.dataset.splitFrom) {
  26991. page.splitFrom = before.dataset.splitFrom;
  26992. pageElement.setAttribute("data-split-from", before.dataset.splitFrom);
  26993. } else if (before.dataset.breakBefore && before.dataset.breakBefore !== "avoid") {
  26994. page.breakBefore = before.dataset.breakBefore;
  26995. pageElement.setAttribute("data-break-before", before.dataset.breakBefore);
  26996. }
  26997. }
  26998. if (after && after.dataset) {
  26999. if (after.dataset.splitTo) {
  27000. page.splitTo = after.dataset.splitTo;
  27001. pageElement.setAttribute("data-split-to", after.dataset.splitTo);
  27002. } else if (after.dataset.breakAfter && after.dataset.breakAfter !== "avoid") {
  27003. page.breakAfter = after.dataset.breakAfter;
  27004. pageElement.setAttribute("data-break-after", after.dataset.breakAfter);
  27005. }
  27006. }
  27007. if (previousBreakAfter && previousBreakAfter.dataset) {
  27008. if (previousBreakAfter.dataset.previousBreakAfter && previousBreakAfter.dataset.previousBreakAfter !== "avoid") {
  27009. page.previousBreakAfter = previousBreakAfter.dataset.previousBreakAfter;
  27010. }
  27011. }
  27012. }
  27013. afterPageLayout(pageElement, page) {
  27014. this.addBreakAttributes(pageElement, page);
  27015. }
  27016. }
  27017. class PrintMedia extends Handler {
  27018. constructor(chunker, polisher, caller) {
  27019. super(chunker, polisher, caller);
  27020. }
  27021. onAtMedia(node, item, list) {
  27022. let media = this.getMediaName(node);
  27023. let rules;
  27024. if (media.includes("print")) {
  27025. rules = node.block.children;
  27026. // Append rules to the end of main rules list
  27027. // TODO: this isn't working right, needs to check what is in the prelude
  27028. /*
  27029. rules.forEach((selectList) => {
  27030. if (selectList.prelude) {
  27031. selectList.prelude.children.forEach((rule) => {
  27032. rule.children.prependData({
  27033. type: "Combinator",
  27034. name: " "
  27035. });
  27036. rule.children.prependData({
  27037. type: "ClassSelector",
  27038. name: "pagedjs_page"
  27039. });
  27040. });
  27041. }
  27042. });
  27043. list.insertList(rules, item);
  27044. */
  27045. // Append rules to the end of main rules list
  27046. list.appendList(rules);
  27047. // Remove rules from the @media block
  27048. list.remove(item);
  27049. } else if (!media.includes("all") && !media.includes("pagedjs-ignore")) {
  27050. list.remove(item);
  27051. }
  27052. }
  27053. getMediaName(node) {
  27054. let media = [];
  27055. if (typeof node.prelude === "undefined" ||
  27056. node.prelude.type !== "AtrulePrelude" ) {
  27057. return;
  27058. }
  27059. csstree.walk(node.prelude, {
  27060. visit: "Identifier",
  27061. enter: (identNode, iItem, iList) => {
  27062. media.push(identNode.name);
  27063. }
  27064. });
  27065. return media;
  27066. }
  27067. }
  27068. class Splits extends Handler {
  27069. constructor(chunker, polisher, caller) {
  27070. super(chunker, polisher, caller);
  27071. }
  27072. afterPageLayout(pageElement, page, breakToken, chunker) {
  27073. let splits = Array.from(pageElement.querySelectorAll("[data-split-from]"));
  27074. let pages = pageElement.parentNode;
  27075. let index = Array.prototype.indexOf.call(pages.children, pageElement);
  27076. let prevPage;
  27077. if (index === 0) {
  27078. return;
  27079. }
  27080. prevPage = pages.children[index - 1];
  27081. let from; // Capture the last from element
  27082. splits.forEach((split) => {
  27083. let ref = split.dataset.ref;
  27084. from = prevPage.querySelector("[data-ref='"+ ref +"']:not([data-split-to])");
  27085. if (from) {
  27086. from.dataset.splitTo = ref;
  27087. if (!from.dataset.splitFrom) {
  27088. from.dataset.splitOriginal = true;
  27089. }
  27090. }
  27091. });
  27092. // Fix alignment on the deepest split element
  27093. if (from) {
  27094. this.handleAlignment(from);
  27095. }
  27096. }
  27097. handleAlignment(node) {
  27098. let styles = window.getComputedStyle(node);
  27099. let align = styles["text-align"];
  27100. let alignLast = styles["text-align-last"];
  27101. node.dataset.lastSplitElement = "true";
  27102. if (align === "justify" && alignLast === "auto") {
  27103. node.dataset.alignLastSplitElement = "justify";
  27104. } else {
  27105. node.dataset.alignLastSplitElement = alignLast;
  27106. }
  27107. }
  27108. }
  27109. class Counters extends Handler {
  27110. constructor(chunker, polisher, caller) {
  27111. super(chunker, polisher, caller);
  27112. this.styleSheet = polisher.styleSheet;
  27113. this.counters = {};
  27114. this.resetCountersMap = new Map();
  27115. }
  27116. onDeclaration(declaration, dItem, dList, rule) {
  27117. let property = declaration.property;
  27118. if (property === "counter-increment") {
  27119. this.handleIncrement(declaration, rule);
  27120. // clean up empty declaration
  27121. let hasProperities = false;
  27122. declaration.value.children.forEach((data) => {
  27123. if (data.type && data.type !== "WhiteSpace") {
  27124. hasProperities = true;
  27125. }
  27126. });
  27127. if (!hasProperities) {
  27128. dList.remove(dItem);
  27129. }
  27130. } else if (property === "counter-reset") {
  27131. this.handleReset(declaration, rule);
  27132. // clean up empty declaration
  27133. let hasProperities = false;
  27134. declaration.value.children.forEach((data) => {
  27135. if (data.type && data.type !== "WhiteSpace") {
  27136. hasProperities = true;
  27137. }
  27138. });
  27139. if (!hasProperities) {
  27140. dList.remove(dItem);
  27141. }
  27142. }
  27143. }
  27144. afterParsed(parsed) {
  27145. this.processCounters(parsed, this.counters);
  27146. this.scopeCounters(this.counters);
  27147. }
  27148. addCounter(name) {
  27149. if (name in this.counters) {
  27150. return this.counters[name];
  27151. }
  27152. this.counters[name] = {
  27153. name: name,
  27154. increments: {},
  27155. resets: {}
  27156. };
  27157. return this.counters[name];
  27158. }
  27159. handleIncrement(declaration, rule) {
  27160. let increments = [];
  27161. let children = declaration.value.children;
  27162. children.forEach((data, item) => {
  27163. if (data.type && data.type === "Identifier") {
  27164. let name = data.name;
  27165. if (name === "page" || name.indexOf("target-counter-") === 0) {
  27166. return;
  27167. }
  27168. let whitespace, number, value;
  27169. if (item.next && item.next.data.type === "WhiteSpace") {
  27170. whitespace = item.next;
  27171. }
  27172. if (whitespace && whitespace.next && whitespace.next.data.type === "Number") {
  27173. number = whitespace.next;
  27174. value = parseInt(number.data.value);
  27175. }
  27176. let selector = csstree.generate(rule.ruleNode.prelude);
  27177. let counter;
  27178. if (!(name in this.counters)) {
  27179. counter = this.addCounter(name);
  27180. } else {
  27181. counter = this.counters[name];
  27182. }
  27183. let increment = {
  27184. selector: selector,
  27185. number: value || 1
  27186. };
  27187. counter.increments[selector] = increment;
  27188. increments.push(increment);
  27189. // Remove the parsed resets
  27190. children.remove(item);
  27191. if (whitespace) {
  27192. children.remove(whitespace);
  27193. }
  27194. if (number) {
  27195. children.remove(number);
  27196. }
  27197. }
  27198. });
  27199. return increments;
  27200. }
  27201. handleReset(declaration, rule) {
  27202. let children = declaration.value.children;
  27203. children.forEach((data, item) => {
  27204. if (data.type && data.type === "Identifier") {
  27205. let name = data.name;
  27206. let whitespace, number, value;
  27207. if (item.next && item.next.data.type === "WhiteSpace") {
  27208. whitespace = item.next;
  27209. }
  27210. if (whitespace && whitespace.next) {
  27211. if (whitespace.next.data.type === "Number") {
  27212. // The counter reset value is specified using a number. E.g. counter-reset: c2 5;
  27213. number = whitespace.next;
  27214. value = parseInt(number.data.value);
  27215. } else if (whitespace.next.data.type === "Function" && whitespace.next.data.name === "var") {
  27216. // The counter reset value is specified using a CSS variable (custom property).
  27217. // E.g. counter-reset: c2 var(--my-variable);
  27218. // See https://developer.mozilla.org/en-US/docs/Web/CSS/var
  27219. number = whitespace.next;
  27220. // Use the variable name (e.g. '--my-variable') as value for now. The actual value is resolved later by the
  27221. // processCounterResets function.
  27222. value = whitespace.next.data.children.head.data.name;
  27223. }
  27224. }
  27225. let counter;
  27226. let selector;
  27227. let prelude = rule.ruleNode.prelude;
  27228. if (rule.ruleNode.type === "Atrule" && rule.ruleNode.name === "page") {
  27229. selector = ".pagedjs_page";
  27230. } else {
  27231. selector = csstree.generate(prelude || rule.ruleNode);
  27232. }
  27233. if (name === "footnote") {
  27234. this.addFootnoteMarkerCounter(declaration.value.children);
  27235. }
  27236. if (!(name in this.counters)) {
  27237. counter = this.addCounter(name);
  27238. } else {
  27239. counter = this.counters[name];
  27240. }
  27241. let reset = {
  27242. selector: selector,
  27243. number: value || 0
  27244. };
  27245. counter.resets[selector] = reset;
  27246. if (selector !== ".pagedjs_page") {
  27247. // Remove the parsed resets
  27248. children.remove(item);
  27249. if (whitespace) {
  27250. children.remove(whitespace);
  27251. }
  27252. if (number) {
  27253. children.remove(number);
  27254. }
  27255. }
  27256. }
  27257. });
  27258. }
  27259. processCounters(parsed, counters) {
  27260. let counter;
  27261. for (let c in counters) {
  27262. counter = this.counters[c];
  27263. this.processCounterIncrements(parsed, counter);
  27264. this.processCounterResets(parsed, counter);
  27265. if (c !== "page") {
  27266. this.addCounterValues(parsed, counter);
  27267. }
  27268. }
  27269. }
  27270. scopeCounters(counters) {
  27271. let countersArray = [];
  27272. for (let c in counters) {
  27273. if(c !== "page") {
  27274. countersArray.push(`${counters[c].name} 0`);
  27275. }
  27276. }
  27277. // Add to pages to allow cross page scope
  27278. this.insertRule(`.pagedjs_pages { counter-reset: ${countersArray.join(" ")} page 0 pages var(--pagedjs-page-count) footnote var(--pagedjs-footnotes-count) footnote-marker var(--pagedjs-footnotes-count)}`);
  27279. }
  27280. insertRule(rule) {
  27281. this.styleSheet.insertRule(rule, this.styleSheet.cssRules.length);
  27282. }
  27283. processCounterIncrements(parsed, counter) {
  27284. let increment;
  27285. for (let inc in counter.increments) {
  27286. increment = counter.increments[inc];
  27287. // Find elements for increments
  27288. let incrementElements = parsed.querySelectorAll(increment.selector);
  27289. // Add counter data
  27290. for (let i = 0; i < incrementElements.length; i++) {
  27291. incrementElements[i].setAttribute("data-counter-"+ counter.name +"-increment", increment.number);
  27292. if (incrementElements[i].getAttribute("data-counter-increment")) {
  27293. incrementElements[i].setAttribute("data-counter-increment", incrementElements[i].getAttribute("data-counter-increment") + " " + counter.name);
  27294. } else {
  27295. incrementElements[i].setAttribute("data-counter-increment", counter.name);
  27296. }
  27297. }
  27298. }
  27299. }
  27300. processCounterResets(parsed, counter) {
  27301. let reset;
  27302. for (let r in counter.resets) {
  27303. reset = counter.resets[r];
  27304. // Find elements for resets
  27305. let resetElements = parsed.querySelectorAll(reset.selector);
  27306. // Add counter data
  27307. for (var i = 0; i < resetElements.length; i++) {
  27308. let value = reset.number;
  27309. if (typeof value === "string" && value.startsWith("--")) {
  27310. // The value is specified using a CSS variable (custom property).
  27311. // FIXME: We get the variable value only from the inline style of the element because at this point the
  27312. // element is detached and thus using:
  27313. //
  27314. // getComputedStyle(resetElements[i]).getPropertyValue(value)
  27315. //
  27316. // always returns an empty string. We could try to temporarily attach the element to get its computed style,
  27317. // but for now using the inline style is enough for us.
  27318. value = resetElements[i].style.getPropertyValue(value) || 0;
  27319. }
  27320. resetElements[i].setAttribute("data-counter-"+ counter.name +"-reset", value);
  27321. if (resetElements[i].getAttribute("data-counter-reset")) {
  27322. resetElements[i].setAttribute("data-counter-reset", resetElements[i].getAttribute("data-counter-reset") + " " + counter.name);
  27323. } else {
  27324. resetElements[i].setAttribute("data-counter-reset", counter.name);
  27325. }
  27326. }
  27327. }
  27328. }
  27329. addCounterValues(parsed, counter) {
  27330. let counterName = counter.name;
  27331. if (counterName === "page" || counterName === "footnote") {
  27332. return;
  27333. }
  27334. let elements = parsed.querySelectorAll("[data-counter-"+ counterName +"-reset], [data-counter-"+ counterName +"-increment]");
  27335. let count = 0;
  27336. let element;
  27337. let increment, reset;
  27338. let resetValue, incrementValue, resetDelta;
  27339. let incrementArray;
  27340. for (let i = 0; i < elements.length; i++) {
  27341. element = elements[i];
  27342. resetDelta = 0;
  27343. incrementArray = [];
  27344. if (element.hasAttribute("data-counter-"+ counterName +"-reset")) {
  27345. reset = element.getAttribute("data-counter-"+ counterName +"-reset");
  27346. resetValue = parseInt(reset);
  27347. // Use negative increment value inplace of reset
  27348. resetDelta = resetValue - count;
  27349. incrementArray.push(`${counterName} ${resetDelta}`);
  27350. count = resetValue;
  27351. }
  27352. if (element.hasAttribute("data-counter-"+ counterName +"-increment")) {
  27353. increment = element.getAttribute("data-counter-"+ counterName +"-increment");
  27354. incrementValue = parseInt(increment);
  27355. count += incrementValue;
  27356. element.setAttribute("data-counter-"+counterName+"-value", count);
  27357. incrementArray.push(`${counterName} ${incrementValue}`);
  27358. }
  27359. if (incrementArray.length > 0) {
  27360. this.incrementCounterForElement(element, incrementArray);
  27361. }
  27362. }
  27363. }
  27364. addFootnoteMarkerCounter(list) {
  27365. let markers = [];
  27366. csstree.walk(list, {
  27367. visit: "Identifier",
  27368. enter: (identNode, iItem, iList) => {
  27369. markers.push(identNode.name);
  27370. }
  27371. });
  27372. // Already added
  27373. if (markers.includes("footnote-maker")) {
  27374. return;
  27375. }
  27376. list.insertData({
  27377. type: "WhiteSpace",
  27378. value: " "
  27379. });
  27380. list.insertData({
  27381. type: "Identifier",
  27382. name: "footnote-marker"
  27383. });
  27384. list.insertData({
  27385. type: "WhiteSpace",
  27386. value: " "
  27387. });
  27388. list.insertData({
  27389. type: "Number",
  27390. value: 0
  27391. });
  27392. }
  27393. incrementCounterForElement(element, incrementArray) {
  27394. if (!element || !incrementArray || incrementArray.length === 0) return;
  27395. const ref = element.dataset.ref;
  27396. const increments = Array.from(this.styleSheet.cssRules).filter((rule) => {
  27397. return rule.selectorText === `[data-ref="${element.dataset.ref}"]:not([data-split-from])`
  27398. && rule.style[0] === "counter-increment";
  27399. }).map(rule => rule.style.counterIncrement);
  27400. // Merge the current increments by summing the values because we generate both a decrement and an increment when the
  27401. // element resets and increments the counter at the same time. E.g. ['c1 -7', 'c1 1'] should lead to 'c1 -6'.
  27402. increments.push(this.mergeIncrements(incrementArray,
  27403. (prev, next) => (parseInt(prev) || 0) + (parseInt(next) || 0)));
  27404. // Keep the last value for each counter when merging with the previous increments. E.g. ['c1 -7 c2 3', 'c1 1']
  27405. // should lead to 'c1 1 c2 3'.
  27406. const counterIncrement = this.mergeIncrements(increments, (prev, next) => next);
  27407. this.insertRule(`[data-ref="${ref}"]:not([data-split-from]) { counter-increment: ${counterIncrement} }`);
  27408. }
  27409. /**
  27410. * Merge multiple values of a counter-increment CSS rule, using the specified operator.
  27411. *
  27412. * @param {Array} incrementArray the values to merge, e.g. ['c1 1', 'c1 -7 c2 1']
  27413. * @param {Function} operator the function used to merge counter values (e.g. keep the last value of a counter or sum
  27414. * the counter values)
  27415. * @return {string} the merged value of the counter-increment CSS rule
  27416. */
  27417. mergeIncrements(incrementArray, operator) {
  27418. const increments = {};
  27419. incrementArray.forEach(increment => {
  27420. let values = increment.split(" ");
  27421. for (let i = 0; i < values.length; i+=2) {
  27422. increments[values[i]] = operator(increments[values[i]], values[i + 1]);
  27423. }
  27424. });
  27425. return Object.entries(increments).map(([key, value]) => `${key} ${value}`).join(" ");
  27426. }
  27427. afterPageLayout(pageElement, page) {
  27428. let resets = [];
  27429. let pgreset = pageElement.querySelectorAll("[data-counter-page-reset]:not([data-split-from])");
  27430. pgreset.forEach((reset) => {
  27431. const ref = reset.dataset && reset.dataset.ref;
  27432. if (ref && this.resetCountersMap.has(ref)) ; else {
  27433. if (ref) {
  27434. this.resetCountersMap.set(ref, "");
  27435. }
  27436. let value = reset.dataset.counterPageReset;
  27437. resets.push(`page ${value}`);
  27438. }
  27439. });
  27440. let notereset = pageElement.querySelectorAll("[data-counter-footnote-reset]:not([data-split-from])");
  27441. notereset.forEach((reset) => {
  27442. let value = reset.dataset.counterFootnoteReset;
  27443. resets.push(`footnote ${value}`);
  27444. resets.push(`footnote-marker ${value}`);
  27445. });
  27446. if (resets.length) {
  27447. this.styleSheet.insertRule(`[data-page-number="${pageElement.dataset.pageNumber}"] { counter-increment: none; counter-reset: ${resets.join(" ")} }`, this.styleSheet.cssRules.length);
  27448. }
  27449. }
  27450. }
  27451. class Lists extends Handler {
  27452. constructor(chunker, polisher, caller) {
  27453. super(chunker, polisher, caller);
  27454. }
  27455. afterParsed(content) {
  27456. const orderedLists = content.querySelectorAll("ol");
  27457. for (var list of orderedLists) {
  27458. this.addDataNumbers(list);
  27459. }
  27460. }
  27461. afterPageLayout(pageElement, page, breakToken, chunker) {
  27462. var orderedLists = pageElement.getElementsByTagName("ol");
  27463. for (var list of orderedLists) {
  27464. if (list.firstElementChild) {
  27465. list.start = list.firstElementChild.dataset.itemNum;
  27466. }
  27467. }
  27468. }
  27469. addDataNumbers(list) {
  27470. let start = 1;
  27471. if (list.hasAttribute("start")) {
  27472. start = parseInt(list.getAttribute("start"), 10);
  27473. if (isNaN(start)) {
  27474. start = 1;
  27475. }
  27476. }
  27477. let items = list.children;
  27478. for (var i = 0; i < items.length; i++) {
  27479. items[i].setAttribute("data-item-num", i + start);
  27480. }
  27481. }
  27482. }
  27483. class PositionFixed extends Handler {
  27484. constructor(chunker, polisher, caller) {
  27485. super(chunker, polisher, caller);
  27486. this.styleSheet = polisher.styleSheet;
  27487. this.fixedElementsSelector = [];
  27488. this.fixedElements = [];
  27489. }
  27490. onDeclaration(declaration, dItem, dList, rule) {
  27491. if (declaration.property === "position" && declaration.value.children.first().name === "fixed") {
  27492. let selector = csstree.generate(rule.ruleNode.prelude);
  27493. this.fixedElementsSelector.push(selector);
  27494. dList.remove(dItem);
  27495. }
  27496. }
  27497. afterParsed(fragment) {
  27498. this.fixedElementsSelector.forEach(fixedEl => {
  27499. fragment.querySelectorAll(`${fixedEl}`).forEach(el => {
  27500. el.style.setProperty("position", "absolute");
  27501. this.fixedElements.push(el);
  27502. el.remove();
  27503. });
  27504. });
  27505. }
  27506. afterPageLayout(pageElement, page, breakToken) {
  27507. this.fixedElements.forEach(el => {
  27508. const clone = el.cloneNode(true);
  27509. pageElement.querySelector(".pagedjs_pagebox").insertAdjacentElement("afterbegin", clone);
  27510. });
  27511. }
  27512. }
  27513. class PageCounterIncrement extends Handler {
  27514. constructor(chunker, polisher, caller) {
  27515. super(chunker, polisher, caller);
  27516. this.styleSheet = polisher.styleSheet;
  27517. this.pageCounter = {
  27518. name: "page",
  27519. increments: {},
  27520. resets: {}
  27521. };
  27522. }
  27523. onDeclaration(declaration, dItem, dList, rule) {
  27524. const property = declaration.property;
  27525. if (property === "counter-increment") {
  27526. let inc = this.handleIncrement(declaration, rule);
  27527. if (inc) {
  27528. dList.remove(dItem);
  27529. }
  27530. }
  27531. }
  27532. afterParsed(_) {
  27533. for (const inc in this.pageCounter.increments) {
  27534. const increment = this.pageCounter.increments[inc];
  27535. this.insertRule(`${increment.selector} { --pagedjs-page-counter-increment: ${increment.number} }`);
  27536. }
  27537. }
  27538. handleIncrement(declaration, rule) {
  27539. const identifier = declaration.value.children.first();
  27540. const number = declaration.value.children.getSize() > 1 ? declaration.value.children.last().value : 1;
  27541. const name = identifier && identifier.name;
  27542. if (name && name.indexOf("target-counter-") === 0) {
  27543. return;
  27544. }
  27545. // A counter named page is automatically created and incremented by 1 on every page of the document,
  27546. // unless the counter-increment property in the page context explicitly specifies a different increment for the page counter.
  27547. // https://www.w3.org/TR/css-page-3/#page-based-counters
  27548. if (name !== "page") {
  27549. return;
  27550. }
  27551. // the counter-increment property is not defined on the page context (i.e. @page rule), ignoring...
  27552. if (rule.ruleNode.name === "page" && rule.ruleNode.type === "Atrule") {
  27553. return;
  27554. }
  27555. const selector = csstree.generate(rule.ruleNode.prelude);
  27556. return this.pageCounter.increments[selector] = {
  27557. selector: selector,
  27558. number
  27559. };
  27560. }
  27561. insertRule(rule) {
  27562. this.styleSheet.insertRule(rule, this.styleSheet.cssRules.length);
  27563. }
  27564. }
  27565. class NthOfType extends Handler {
  27566. constructor(chunker, polisher, caller) {
  27567. super(chunker, polisher, caller);
  27568. this.styleSheet = polisher.styleSheet;
  27569. this.selectors = {};
  27570. }
  27571. onRule(ruleNode, ruleItem, rulelist) {
  27572. let selector = csstree.generate(ruleNode.prelude);
  27573. if (selector.match(/:(first|last|nth)-of-type/)) {
  27574. let declarations = csstree.generate(ruleNode.block);
  27575. declarations = declarations.replace(/[{}]/g,"");
  27576. let uuid = "nth-of-type-" + UUID();
  27577. selector.split(",").forEach((s) => {
  27578. if (!this.selectors[s]) {
  27579. this.selectors[s] = [uuid, declarations];
  27580. } else {
  27581. this.selectors[s][1] = `${this.selectors[s][1]};${declarations}` ;
  27582. }
  27583. });
  27584. rulelist.remove(ruleItem);
  27585. }
  27586. }
  27587. afterParsed(parsed) {
  27588. this.processSelectors(parsed, this.selectors);
  27589. }
  27590. processSelectors(parsed, selectors) {
  27591. // add the new attributes to matching elements
  27592. for (let s in selectors) {
  27593. let elements = parsed.querySelectorAll(s);
  27594. for (var i = 0; i < elements.length; i++) {
  27595. let dataNthOfType = elements[i].getAttribute("data-nth-of-type");
  27596. if (dataNthOfType && dataNthOfType != "") {
  27597. dataNthOfType = `${dataNthOfType},${selectors[s][0]}`;
  27598. elements[i].setAttribute("data-nth-of-type", dataNthOfType);
  27599. } else {
  27600. elements[i].setAttribute("data-nth-of-type", selectors[s][0]);
  27601. }
  27602. }
  27603. let rule = `*[data-nth-of-type*='${selectors[s][0]}'] { ${selectors[s][1]}; }`;
  27604. this.styleSheet.insertRule(rule, this.styleSheet.cssRules.length);
  27605. }
  27606. }
  27607. }
  27608. class Following extends Handler {
  27609. constructor(chunker, polisher, caller) {
  27610. super(chunker, polisher, caller);
  27611. this.styleSheet = polisher.styleSheet;
  27612. this.selectors = {};
  27613. }
  27614. onRule(ruleNode, ruleItem, rulelist) {
  27615. let selector = csstree.generate(ruleNode.prelude);
  27616. if (selector.match(/\+/)) {
  27617. let declarations = csstree.generate(ruleNode.block);
  27618. declarations = declarations.replace(/[{}]/g,"");
  27619. let uuid = "following-" + UUID();
  27620. selector.split(",").forEach((s) => {
  27621. if (!this.selectors[s]) {
  27622. this.selectors[s] = [uuid, declarations];
  27623. } else {
  27624. this.selectors[s][1] = `${this.selectors[s][1]};${declarations}` ;
  27625. }
  27626. });
  27627. rulelist.remove(ruleItem);
  27628. }
  27629. }
  27630. afterParsed(parsed) {
  27631. this.processSelectors(parsed, this.selectors);
  27632. }
  27633. processSelectors(parsed, selectors) {
  27634. // add the new attributes to matching elements
  27635. for (let s in selectors) {
  27636. let elements = parsed.querySelectorAll(s);
  27637. for (var i = 0; i < elements.length; i++) {
  27638. let dataFollowing = elements[i].getAttribute("data-following");
  27639. if (dataFollowing && dataFollowing != "") {
  27640. dataFollowing = `${dataFollowing},${selectors[s][0]}`;
  27641. elements[i].setAttribute("data-following", dataFollowing);
  27642. } else {
  27643. elements[i].setAttribute("data-following", selectors[s][0]);
  27644. }
  27645. }
  27646. let rule = `*[data-following*='${selectors[s][0]}'] { ${selectors[s][1]}; }`;
  27647. this.styleSheet.insertRule(rule, this.styleSheet.cssRules.length);
  27648. }
  27649. }
  27650. }
  27651. class Footnotes extends Handler {
  27652. constructor(chunker, polisher, caller) {
  27653. super(chunker, polisher, caller);
  27654. this.footnotes = {};
  27655. this.needsLayout = [];
  27656. }
  27657. onDeclaration(declaration, dItem, dList, rule) {
  27658. let property = declaration.property;
  27659. if (property === "float") {
  27660. let identifier = declaration.value.children && declaration.value.children.first();
  27661. let location = identifier && identifier.name;
  27662. if (location === "footnote") {
  27663. let selector = csstree.generate(rule.ruleNode.prelude);
  27664. this.footnotes[selector] = {
  27665. selector: selector,
  27666. policy: "auto",
  27667. display: "block"
  27668. };
  27669. dList.remove(dItem);
  27670. }
  27671. }
  27672. if (property === "footnote-policy") {
  27673. let identifier = declaration.value.children && declaration.value.children.first();
  27674. let policy = identifier && identifier.name;
  27675. if (policy) {
  27676. let selector = csstree.generate(rule.ruleNode.prelude);
  27677. let note = this.footnotes[selector];
  27678. if (note) {
  27679. note.policy = policy;
  27680. }
  27681. }
  27682. }
  27683. if (property === "footnote-display") {
  27684. let identifier = declaration.value.children && declaration.value.children.first();
  27685. let display = identifier && identifier.name;
  27686. let selector = csstree.generate(rule.ruleNode.prelude);
  27687. if (display && this.footnotes[selector]) {
  27688. let note = this.footnotes[selector];
  27689. if (note) {
  27690. note.display = display;
  27691. }
  27692. }
  27693. }
  27694. }
  27695. onPseudoSelector(pseudoNode, pItem, pList, selector, rule) {
  27696. let name = pseudoNode.name;
  27697. if (name === "footnote-marker") {
  27698. // switch ::footnote-marker to [data-footnote-marker]::before
  27699. let prelude = rule.ruleNode.prelude;
  27700. let newPrelude = new csstree.List();
  27701. // Can't get remove to work, so just copying everything else
  27702. prelude.children.first().children.each((node) => {
  27703. if (node.type !== "PseudoElementSelector") {
  27704. newPrelude.appendData(node);
  27705. }
  27706. });
  27707. // Add our data call
  27708. newPrelude.appendData({
  27709. type: "AttributeSelector",
  27710. name: {
  27711. type: "Identifier",
  27712. name: "data-footnote-marker",
  27713. },
  27714. flags: null,
  27715. loc: null,
  27716. matcher: null,
  27717. value: null
  27718. });
  27719. // Add new pseudo element
  27720. newPrelude.appendData({
  27721. type: "PseudoElementSelector",
  27722. name: "marker",
  27723. loc: null,
  27724. children: null
  27725. });
  27726. prelude.children.first().children = newPrelude;
  27727. }
  27728. if (name === "footnote-call") {
  27729. // switch ::footnote-call to [data-footnote-call]::after
  27730. let prelude = rule.ruleNode.prelude;
  27731. let newPrelude = new csstree.List();
  27732. // Can't get remove to work, so just copying everything else
  27733. prelude.children.first().children.each((node) => {
  27734. if (node.type !== "PseudoElementSelector") {
  27735. newPrelude.appendData(node);
  27736. }
  27737. });
  27738. // Add our data call
  27739. newPrelude.appendData({
  27740. type: "AttributeSelector",
  27741. name: {
  27742. type: "Identifier",
  27743. name: "data-footnote-call",
  27744. },
  27745. flags: null,
  27746. loc: null,
  27747. matcher: null,
  27748. value: null
  27749. });
  27750. // Add new pseudo element
  27751. newPrelude.appendData({
  27752. type: "PseudoElementSelector",
  27753. name: "after",
  27754. loc: null,
  27755. children: null
  27756. });
  27757. prelude.children.first().children = newPrelude;
  27758. }
  27759. }
  27760. afterParsed(parsed) {
  27761. this.processFootnotes(parsed, this.footnotes);
  27762. }
  27763. processFootnotes(parsed, notes) {
  27764. for (let n in notes) {
  27765. // Find elements
  27766. let elements = parsed.querySelectorAll(n);
  27767. let element;
  27768. let note = notes[n];
  27769. for (var i = 0; i < elements.length; i++) {
  27770. element = elements[i];
  27771. // Add note type
  27772. element.setAttribute("data-note", "footnote");
  27773. element.setAttribute("data-break-before", "avoid");
  27774. element.setAttribute("data-note-policy", note.policy || "auto");
  27775. element.setAttribute("data-note-display", note.display || "block");
  27776. // Mark all parents
  27777. this.processFootnoteContainer(element);
  27778. }
  27779. }
  27780. }
  27781. processFootnoteContainer(node) {
  27782. // Find the container
  27783. let element = node.parentElement;
  27784. let prevElement = element;
  27785. // Walk up the dom until we find a container element
  27786. while (element) {
  27787. if (isContainer(element)) {
  27788. // Add flag to the previous non-container element that will render with children
  27789. prevElement.setAttribute("data-has-notes", "true");
  27790. break;
  27791. }
  27792. prevElement = element;
  27793. element = element.parentElement;
  27794. // If no containers were found and there are no further parents flag the last element
  27795. if (!element) {
  27796. prevElement.setAttribute("data-has-notes", "true");
  27797. }
  27798. }
  27799. }
  27800. renderNode(node) {
  27801. if (node.nodeType == 1) {
  27802. // Get all notes
  27803. let notes;
  27804. // Ingnore html element nodes, like mathml
  27805. if (!node.dataset) {
  27806. return;
  27807. }
  27808. if (node.dataset.note === "footnote") {
  27809. notes = [node];
  27810. } else if (node.dataset.hasNotes || node.querySelectorAll("[data-note='footnote']")) {
  27811. notes = node.querySelectorAll("[data-note='footnote']");
  27812. }
  27813. if (notes && notes.length) {
  27814. this.findVisibleFootnotes(notes, node);
  27815. }
  27816. }
  27817. }
  27818. findVisibleFootnotes(notes, node) {
  27819. let area, size, right;
  27820. area = node.closest(".pagedjs_page_content");
  27821. size = area.getBoundingClientRect();
  27822. right = size.left + size.width;
  27823. for (let i = 0; i < notes.length; ++i) {
  27824. let currentNote = notes[i];
  27825. let bounds = currentNote.getBoundingClientRect();
  27826. let left = bounds.left;
  27827. if (left < right) {
  27828. // Add call for the note
  27829. this.moveFootnote(currentNote, node.closest(".pagedjs_area"), true);
  27830. }
  27831. }
  27832. }
  27833. moveFootnote(node, pageArea, needsNoteCall) {
  27834. // let pageArea = node.closest(".pagedjs_area");
  27835. let noteArea = pageArea.querySelector(".pagedjs_footnote_area");
  27836. let noteContent = noteArea.querySelector(".pagedjs_footnote_content");
  27837. let noteInnerContent = noteContent.querySelector(".pagedjs_footnote_inner_content");
  27838. if (!isElement(node)) {
  27839. return;
  27840. }
  27841. // Add call for the note
  27842. let noteCall;
  27843. if (needsNoteCall) {
  27844. noteCall = this.createFootnoteCall(node);
  27845. }
  27846. // Remove the break before attribute for future layout
  27847. node.removeAttribute("data-break-before");
  27848. // Check if note already exists for overflow
  27849. let existing = noteInnerContent.querySelector(`[data-ref="${node.dataset.ref}"]`);
  27850. if (existing) {
  27851. // Remove the note from the flow but no need to render it again
  27852. node.remove();
  27853. return;
  27854. }
  27855. // Add the note node
  27856. noteInnerContent.appendChild(node);
  27857. // Remove empty class
  27858. if (noteContent.classList.contains("pagedjs_footnote_empty")) {
  27859. noteContent.classList.remove("pagedjs_footnote_empty");
  27860. }
  27861. // Add marker
  27862. node.dataset.footnoteMarker = node.dataset.ref;
  27863. // Add Id
  27864. node.id = `note-${node.dataset.ref}`;
  27865. // Get note content size
  27866. let height = noteContent.scrollHeight;
  27867. // Check the noteCall is still on screen
  27868. let area = pageArea.querySelector(".pagedjs_page_content");
  27869. let size = area.getBoundingClientRect();
  27870. let right = size.left + size.width;
  27871. // TODO: add a max height in CSS
  27872. // Check element sizes
  27873. let noteCallBounds = noteCall && noteCall.getBoundingClientRect();
  27874. let noteAreaBounds = noteArea.getBoundingClientRect();
  27875. // Get the @footnote margins
  27876. let noteContentMargins = this.marginsHeight(noteContent);
  27877. let noteContentPadding = this.paddingHeight(noteContent);
  27878. let noteContentBorders = this.borderHeight(noteContent);
  27879. let total = noteContentMargins + noteContentPadding + noteContentBorders;
  27880. // Get the top of the @footnote area
  27881. let notAreaTop = Math.floor(noteAreaBounds.top);
  27882. // If the height isn't set yet, remove the margins from the top
  27883. if (noteAreaBounds.height === 0) {
  27884. notAreaTop -= this.marginsHeight(noteContent, false);
  27885. notAreaTop -= this.paddingHeight(noteContent, false);
  27886. notAreaTop -= this.borderHeight(noteContent, false);
  27887. }
  27888. // Determine the note call position and offset per policy
  27889. let notePolicy = node.dataset.notePolicy;
  27890. let noteCallPosition = 0;
  27891. let noteCallOffset = 0;
  27892. if (noteCall) {
  27893. // Get the correct line bottom for super or sub styled callouts
  27894. let prevSibling = noteCall.previousSibling;
  27895. let range = new Range();
  27896. if (prevSibling) {
  27897. range.setStartBefore(prevSibling);
  27898. } else {
  27899. range.setStartBefore(noteCall);
  27900. }
  27901. range.setEndAfter(noteCall);
  27902. let rangeBounds = range.getBoundingClientRect();
  27903. noteCallPosition = rangeBounds.bottom;
  27904. if (!notePolicy || notePolicy === "auto") {
  27905. noteCallOffset = Math.ceil(rangeBounds.bottom);
  27906. } else if (notePolicy === "line") {
  27907. noteCallOffset = Math.ceil(rangeBounds.top);
  27908. } else if (notePolicy === "block") {
  27909. // Check that there is a previous element on the page
  27910. let parentParagraph = noteCall.closest("p").previousElementSibling;
  27911. if (parentParagraph) {
  27912. noteCallOffset = Math.ceil(
  27913. parentParagraph.getBoundingClientRect().bottom
  27914. );
  27915. } else {
  27916. noteCallOffset = Math.ceil(rangeBounds.bottom);
  27917. }
  27918. }
  27919. }
  27920. let contentDelta = height + total - noteAreaBounds.height;
  27921. // Space between the top of the footnotes area and the bottom of the footnote call
  27922. let noteDelta = noteCallPosition ? notAreaTop - noteCallPosition : 0;
  27923. // Space needed for the force a break for the policy of the footnote
  27924. let notePolicyDelta = noteCallPosition ? Math.floor(noteAreaBounds.top) - noteCallOffset : 0;
  27925. let hasNotes = noteArea.querySelector("[data-note='footnote']");
  27926. if (needsNoteCall && noteCallBounds.left > right) {
  27927. // Note is offscreen and will be chunked to the next page on overflow
  27928. node.remove();
  27929. } else if (!hasNotes && needsNoteCall && total > noteDelta) {
  27930. // No space to add even the footnote area
  27931. pageArea.style.setProperty("--pagedjs-footnotes-height", "0px");
  27932. // Add a wrapper as this div is removed later
  27933. let wrapperDiv = document.createElement("div");
  27934. wrapperDiv.appendChild(node);
  27935. // Push to the layout queue for the next page
  27936. this.needsLayout.push(wrapperDiv);
  27937. } else if (!needsNoteCall) {
  27938. // Call was previously added, force adding footnote
  27939. pageArea.style.setProperty(
  27940. "--pagedjs-footnotes-height",
  27941. `${height + total}px`
  27942. );
  27943. } else if (noteCallPosition < noteAreaBounds.top - contentDelta) {
  27944. // the current note content will fit without pushing the call to the next page
  27945. pageArea.style.setProperty(
  27946. "--pagedjs-footnotes-height",
  27947. `${height + noteContentMargins + noteContentBorders}px`
  27948. );
  27949. } else {
  27950. // set height to just before note call
  27951. pageArea.style.setProperty(
  27952. "--pagedjs-footnotes-height",
  27953. `${noteAreaBounds.height + notePolicyDelta}px`
  27954. );
  27955. noteInnerContent.style.height =
  27956. noteAreaBounds.height + notePolicyDelta - total + "px";
  27957. }
  27958. }
  27959. createFootnoteCall(node) {
  27960. let parentElement = node.parentElement;
  27961. let footnoteCall = document.createElement("a");
  27962. for (const className of node.classList) {
  27963. footnoteCall.classList.add(`${className}`);
  27964. }
  27965. footnoteCall.dataset.footnoteCall = node.dataset.ref;
  27966. footnoteCall.dataset.ref = node.dataset.ref;
  27967. // Increment for counters
  27968. footnoteCall.dataset.dataCounterFootnoteIncrement = 1;
  27969. // Add link
  27970. footnoteCall.href = `#note-${node.dataset.ref}`;
  27971. parentElement.insertBefore(footnoteCall, node);
  27972. return footnoteCall;
  27973. }
  27974. afterPageLayout(pageElement, page, breakToken, chunker) {
  27975. let pageArea = pageElement.querySelector(".pagedjs_area");
  27976. let noteArea = page.footnotesArea;
  27977. let noteContent = noteArea.querySelector(".pagedjs_footnote_content");
  27978. let noteInnerContent = noteArea.querySelector(".pagedjs_footnote_inner_content");
  27979. let noteContentBounds = noteContent.getBoundingClientRect();
  27980. let { width } = noteContentBounds;
  27981. noteInnerContent.style.columnWidth = Math.round(width) + "px";
  27982. noteInnerContent.style.columnGap = "calc(var(--pagedjs-margin-right) + var(--pagedjs-margin-left))";
  27983. // Get overflow
  27984. let layout = new Layout(noteArea, undefined, chunker.settings);
  27985. let overflow = layout.findOverflow(noteInnerContent, noteContentBounds);
  27986. if (overflow) {
  27987. let { startContainer, startOffset } = overflow;
  27988. let startIsNode;
  27989. if (isElement(startContainer)) {
  27990. let start = startContainer.childNodes[startOffset];
  27991. startIsNode = isElement(start) && start.hasAttribute("data-footnote-marker");
  27992. }
  27993. let extracted = overflow.extractContents();
  27994. if (!startIsNode) {
  27995. let splitChild = extracted.firstElementChild;
  27996. splitChild.dataset.splitFrom = splitChild.dataset.ref;
  27997. this.handleAlignment(noteInnerContent.lastElementChild);
  27998. }
  27999. this.needsLayout.push(extracted);
  28000. noteContent.style.removeProperty("height");
  28001. noteInnerContent.style.removeProperty("height");
  28002. let noteInnerContentBounds = noteInnerContent.getBoundingClientRect();
  28003. let { height } = noteInnerContentBounds;
  28004. // Get the @footnote margins
  28005. let noteContentMargins = this.marginsHeight(noteContent);
  28006. let noteContentPadding = this.paddingHeight(noteContent);
  28007. let noteContentBorders = this.borderHeight(noteContent);
  28008. pageArea.style.setProperty(
  28009. "--pagedjs-footnotes-height",
  28010. `${height + noteContentMargins + noteContentBorders + noteContentPadding}px`
  28011. );
  28012. // Hide footnote content if empty
  28013. if (noteInnerContent.childNodes.length === 0) {
  28014. noteContent.classList.add("pagedjs_footnote_empty");
  28015. }
  28016. if (!breakToken) {
  28017. chunker.clonePage(page);
  28018. } else {
  28019. let breakBefore, previousBreakAfter;
  28020. if (
  28021. breakToken.node &&
  28022. typeof breakToken.node.dataset !== "undefined" &&
  28023. typeof breakToken.node.dataset.previousBreakAfter !== "undefined"
  28024. ) {
  28025. previousBreakAfter = breakToken.node.dataset.previousBreakAfter;
  28026. }
  28027. if (
  28028. breakToken.node &&
  28029. typeof breakToken.node.dataset !== "undefined" &&
  28030. typeof breakToken.node.dataset.breakBefore !== "undefined"
  28031. ) {
  28032. breakBefore = breakToken.node.dataset.breakBefore;
  28033. }
  28034. if (breakBefore || previousBreakAfter) {
  28035. chunker.clonePage(page);
  28036. }
  28037. }
  28038. }
  28039. noteInnerContent.style.height = "auto";
  28040. }
  28041. handleAlignment(node) {
  28042. let styles = window.getComputedStyle(node);
  28043. let alignLast = styles["text-align-last"];
  28044. node.dataset.lastSplitElement = "true";
  28045. if (alignLast === "auto") {
  28046. node.dataset.alignLastSplitElement = "justify";
  28047. } else {
  28048. node.dataset.alignLastSplitElement = alignLast;
  28049. }
  28050. }
  28051. beforePageLayout(page) {
  28052. while (this.needsLayout.length) {
  28053. let fragment = this.needsLayout.shift();
  28054. Array.from(fragment.childNodes).forEach((node) => {
  28055. this.moveFootnote(
  28056. node,
  28057. page.element.querySelector(".pagedjs_area"),
  28058. false
  28059. );
  28060. });
  28061. }
  28062. }
  28063. afterOverflowRemoved(removed, rendered) {
  28064. // Find the page area
  28065. let area = rendered.closest(".pagedjs_area");
  28066. // Get any rendered footnotes
  28067. let notes = area.querySelectorAll(".pagedjs_footnote_area [data-note='footnote']");
  28068. for (let n = 0; n < notes.length; n++) {
  28069. const note = notes[n];
  28070. // Check if the call for that footnote has been removed with the overflow
  28071. let call = removed.querySelector(`[data-footnote-call="${note.dataset.ref}"]`);
  28072. if (call) {
  28073. note.remove();
  28074. }
  28075. }
  28076. // Hide footnote content if empty
  28077. let noteInnerContent = area.querySelector(".pagedjs_footnote_inner_content");
  28078. if (noteInnerContent && noteInnerContent.childNodes.length === 0) {
  28079. noteInnerContent.parentElement.classList.add("pagedjs_footnote_empty");
  28080. }
  28081. }
  28082. marginsHeight(element, total=true) {
  28083. let styles = window.getComputedStyle(element);
  28084. let marginTop = parseInt(styles.marginTop);
  28085. let marginBottom = parseInt(styles.marginBottom);
  28086. let margin = 0;
  28087. if (marginTop) {
  28088. margin += marginTop;
  28089. }
  28090. if (marginBottom && total) {
  28091. margin += marginBottom;
  28092. }
  28093. return margin;
  28094. }
  28095. paddingHeight(element, total=true) {
  28096. let styles = window.getComputedStyle(element);
  28097. let paddingTop = parseInt(styles.paddingTop);
  28098. let paddingBottom = parseInt(styles.paddingBottom);
  28099. let padding = 0;
  28100. if (paddingTop) {
  28101. padding += paddingTop;
  28102. }
  28103. if (paddingBottom && total) {
  28104. padding += paddingBottom;
  28105. }
  28106. return padding;
  28107. }
  28108. borderHeight(element, total=true) {
  28109. let styles = window.getComputedStyle(element);
  28110. let borderTop = parseInt(styles.borderTop);
  28111. let borderBottom = parseInt(styles.borderBottom);
  28112. let borders = 0;
  28113. if (borderTop) {
  28114. borders += borderTop;
  28115. }
  28116. if (borderBottom && total) {
  28117. borders += borderBottom;
  28118. }
  28119. return borders;
  28120. }
  28121. }
  28122. var pagedMediaHandlers = [
  28123. PrintMedia,
  28124. AtPage,
  28125. Breaks,
  28126. Splits,
  28127. Counters,
  28128. Lists,
  28129. PositionFixed,
  28130. PageCounterIncrement,
  28131. NthOfType,
  28132. Following,
  28133. Footnotes
  28134. ];
  28135. class RunningHeaders extends Handler {
  28136. constructor(chunker, polisher, caller) {
  28137. super(chunker, polisher, caller);
  28138. this.runningSelectors = {};
  28139. this.elements = {};
  28140. }
  28141. onDeclaration(declaration, dItem, dList, rule) {
  28142. if (declaration.property === "position") {
  28143. let selector = csstree.generate(rule.ruleNode.prelude);
  28144. let identifier = declaration.value.children.first().name;
  28145. if (identifier === "running") {
  28146. let value;
  28147. csstree.walk(declaration, {
  28148. visit: "Function",
  28149. enter: (node, item, list) => {
  28150. value = node.children.first().name;
  28151. }
  28152. });
  28153. this.runningSelectors[value] = {
  28154. identifier: identifier,
  28155. value: value,
  28156. selector: selector
  28157. };
  28158. }
  28159. }
  28160. if (declaration.property === "content") {
  28161. csstree.walk(declaration, {
  28162. visit: "Function",
  28163. enter: (funcNode, fItem, fList) => {
  28164. if (funcNode.name.indexOf("element") > -1) {
  28165. let selector = csstree.generate(rule.ruleNode.prelude);
  28166. let func = funcNode.name;
  28167. let value = funcNode.children.first().name;
  28168. let args = [value];
  28169. // we only handle first for now
  28170. let style = "first";
  28171. selector.split(",").forEach((s) => {
  28172. // remove before / after
  28173. s = s.replace(/::after|::before/, "");
  28174. this.elements[s] = {
  28175. func: func,
  28176. args: args,
  28177. value: value,
  28178. style: style ,
  28179. selector: s,
  28180. fullSelector: selector
  28181. };
  28182. });
  28183. }
  28184. }
  28185. });
  28186. }
  28187. }
  28188. afterParsed(fragment) {
  28189. for (let name of Object.keys(this.runningSelectors)) {
  28190. let set = this.runningSelectors[name];
  28191. let selected = Array.from(fragment.querySelectorAll(set.selector));
  28192. if (set.identifier === "running") {
  28193. for (let header of selected) {
  28194. header.style.display = "none";
  28195. }
  28196. }
  28197. }
  28198. }
  28199. afterPageLayout(fragment) {
  28200. for (let name of Object.keys(this.runningSelectors)) {
  28201. let set = this.runningSelectors[name];
  28202. let selected = fragment.querySelector(set.selector);
  28203. if (selected) {
  28204. // let cssVar;
  28205. if (set.identifier === "running") {
  28206. // cssVar = selected.textContent.replace(/\\([\s\S])|(["|'])/g,"\\$1$2");
  28207. // this.styleSheet.insertRule(`:root { --string-${name}: "${cssVar}"; }`, this.styleSheet.cssRules.length);
  28208. // fragment.style.setProperty(`--string-${name}`, `"${cssVar}"`);
  28209. set.first = selected;
  28210. } else {
  28211. console.warn(set.value + "needs css replacement");
  28212. }
  28213. }
  28214. }
  28215. // move elements
  28216. if (!this.orderedSelectors) {
  28217. this.orderedSelectors = this.orderSelectors(this.elements);
  28218. }
  28219. for (let selector of this.orderedSelectors) {
  28220. if (selector) {
  28221. let el = this.elements[selector];
  28222. let selected = fragment.querySelector(selector);
  28223. if (selected) {
  28224. let running = this.runningSelectors[el.args[0]];
  28225. if (running && running.first) {
  28226. selected.innerHTML = ""; // Clear node
  28227. // selected.classList.add("pagedjs_clear-after"); // Clear ::after
  28228. let clone = running.first.cloneNode(true);
  28229. clone.style.display = null;
  28230. selected.appendChild(clone);
  28231. }
  28232. }
  28233. }
  28234. }
  28235. }
  28236. /**
  28237. * Assign a weight to @page selector classes
  28238. * 1) page
  28239. * 2) left & right
  28240. * 3) blank
  28241. * 4) first & nth
  28242. * 5) named page
  28243. * 6) named left & right
  28244. * 7) named first & nth
  28245. * @param {string} [s] selector string
  28246. * @return {int} weight
  28247. */
  28248. pageWeight(s) {
  28249. let weight = 1;
  28250. let selector = s.split(" ");
  28251. let parts = selector.length && selector[0].split(".");
  28252. parts.shift(); // remove empty first part
  28253. switch (parts.length) {
  28254. case 4:
  28255. if (/^pagedjs_[\w-]+_first_page$/.test(parts[3])) {
  28256. weight = 7;
  28257. } else if (parts[3] === "pagedjs_left_page" || parts[3] === "pagedjs_right_page") {
  28258. weight = 6;
  28259. }
  28260. break;
  28261. case 3:
  28262. if (parts[1] === "pagedjs_named_page") {
  28263. if (parts[2].indexOf(":nth-of-type") > -1) {
  28264. weight = 7;
  28265. } else {
  28266. weight = 5;
  28267. }
  28268. }
  28269. break;
  28270. case 2:
  28271. if (parts[1] === "pagedjs_first_page") {
  28272. weight = 4;
  28273. } else if (parts[1] === "pagedjs_blank_page") {
  28274. weight = 3;
  28275. } else if (parts[1] === "pagedjs_left_page" || parts[1] === "pagedjs_right_page") {
  28276. weight = 2;
  28277. }
  28278. break;
  28279. default:
  28280. if (parts[0].indexOf(":nth-of-type") > -1) {
  28281. weight = 4;
  28282. } else {
  28283. weight = 1;
  28284. }
  28285. }
  28286. return weight;
  28287. }
  28288. /**
  28289. * Orders the selectors based on weight
  28290. *
  28291. * Does not try to deduplicate base on specifity of the selector
  28292. * Previous matched selector will just be overwritten
  28293. * @param {obj} [obj] selectors object
  28294. * @return {Array} orderedSelectors
  28295. */
  28296. orderSelectors(obj) {
  28297. let selectors = Object.keys(obj);
  28298. let weighted = {
  28299. 1: [],
  28300. 2: [],
  28301. 3: [],
  28302. 4: [],
  28303. 5: [],
  28304. 6: [],
  28305. 7: []
  28306. };
  28307. let orderedSelectors = [];
  28308. for (let s of selectors) {
  28309. let w = this.pageWeight(s);
  28310. weighted[w].unshift(s);
  28311. }
  28312. for (var i = 1; i <= 7; i++) {
  28313. orderedSelectors = orderedSelectors.concat(weighted[i]);
  28314. }
  28315. return orderedSelectors;
  28316. }
  28317. beforeTreeParse(text, sheet) {
  28318. // element(x) is parsed as image element selector, so update element to element-ident
  28319. sheet.text = text.replace(/element[\s]*\(([^|^#)]*)\)/g, "element-ident($1)");
  28320. }
  28321. }
  28322. function cleanPseudoContent(el, trim = "\"' ") {
  28323. if(el == null) return;
  28324. return el
  28325. .replace(new RegExp(`^[${trim}]+`), "")
  28326. .replace(new RegExp(`[${trim}]+$`), "")
  28327. .replace(/["']/g, match => {
  28328. return "\\" + match;
  28329. })
  28330. .replace(/[\n]/g, match => {
  28331. return "\\00000A";
  28332. });
  28333. }
  28334. function cleanSelector(el) {
  28335. if(el == null) return;
  28336. return el
  28337. .replace(new RegExp("::footnote-call", "g"), "")
  28338. .replace(new RegExp("::footnote-marker", "g"), "");
  28339. }
  28340. class StringSets extends Handler {
  28341. constructor(chunker, polisher, caller) {
  28342. super(chunker, polisher, caller);
  28343. this.stringSetSelectors = {};
  28344. this.type;
  28345. // pageLastString = last string variable defined on the page
  28346. this.pageLastString;
  28347. }
  28348. onDeclaration(declaration, dItem, dList, rule) {
  28349. if (declaration.property === "string-set") {
  28350. let selector = csstree.generate(rule.ruleNode.prelude);
  28351. let identifiers = [];
  28352. let functions = [];
  28353. let values = [];
  28354. declaration.value.children.forEach((child) => {
  28355. if (child.type === "Identifier") {
  28356. identifiers.push(child.name);
  28357. }
  28358. if (child.type === "Function") {
  28359. functions.push(child.name);
  28360. child.children.forEach((subchild) => {
  28361. if (subchild.type === "Identifier") {
  28362. values.push(subchild.name);
  28363. }
  28364. });
  28365. }
  28366. });
  28367. identifiers.forEach((identifier, index) => {
  28368. let func = functions[index];
  28369. let value = values[index];
  28370. this.stringSetSelectors[identifier] = {
  28371. identifier,
  28372. func,
  28373. value,
  28374. selector
  28375. };
  28376. });
  28377. }
  28378. }
  28379. onContent(funcNode, fItem, fList, declaration, rule) {
  28380. if (funcNode.name === "string") {
  28381. let identifier = funcNode.children && funcNode.children.first().name;
  28382. this.type = funcNode.children.last().name;
  28383. funcNode.name = "var";
  28384. funcNode.children = new csstree.List();
  28385. if(this.type === "first" || this.type === "last" || this.type === "start" || this.type === "first-except"){
  28386. funcNode.children.append(
  28387. funcNode.children.createItem({
  28388. type: "Identifier",
  28389. loc: null,
  28390. name: "--pagedjs-string-" + this.type + "-" + identifier
  28391. })
  28392. );
  28393. }else {
  28394. funcNode.children.append(
  28395. funcNode.children.createItem({
  28396. type: "Identifier",
  28397. loc: null,
  28398. name: "--pagedjs-string-first-" + identifier
  28399. })
  28400. );
  28401. }
  28402. }
  28403. }
  28404. afterPageLayout(fragment) {
  28405. if ( this.pageLastString === undefined )
  28406. {
  28407. this.pageLastString = {};
  28408. }
  28409. for (let name of Object.keys(this.stringSetSelectors)) {
  28410. let set = this.stringSetSelectors[name];
  28411. let value = set.value;
  28412. let func = set.func;
  28413. let selected = fragment.querySelectorAll(set.selector);
  28414. // Get the last found string for the current identifier
  28415. let stringPrevPage = ( name in this.pageLastString ) ? this.pageLastString[name] : "";
  28416. let varFirst, varLast, varStart, varFirstExcept;
  28417. if(selected.length == 0){
  28418. // if there is no sel. on the page
  28419. varFirst = stringPrevPage;
  28420. varLast = stringPrevPage;
  28421. varStart = stringPrevPage;
  28422. varFirstExcept = stringPrevPage;
  28423. }else {
  28424. selected.forEach((sel) => {
  28425. // push each content into the array to define in the variable the first and the last element of the page.
  28426. if (func === "content") {
  28427. this.pageLastString[name] = selected[selected.length - 1].textContent;
  28428. }
  28429. if (func === "attr") {
  28430. this.pageLastString[name] = selected[selected.length - 1].getAttribute(value) || "";
  28431. }
  28432. });
  28433. /* FIRST */
  28434. if (func === "content") {
  28435. varFirst = selected[0].textContent;
  28436. }
  28437. if (func === "attr") {
  28438. varFirst = selected[0].getAttribute(value) || "";
  28439. }
  28440. /* LAST */
  28441. if (func === "content") {
  28442. varLast = selected[selected.length - 1].textContent;
  28443. }
  28444. if (func === "attr") {
  28445. varLast = selected[selected.length - 1].getAttribute(value) || "";
  28446. }
  28447. /* START */
  28448. // Hack to find if the sel. is the first elem of the page / find a better way
  28449. let selTop = selected[0].getBoundingClientRect().top;
  28450. let pageContent = selected[0].closest(".pagedjs_page_content");
  28451. let pageContentTop = pageContent.getBoundingClientRect().top;
  28452. if(selTop == pageContentTop){
  28453. varStart = varFirst;
  28454. }else {
  28455. varStart = stringPrevPage;
  28456. }
  28457. /* FIRST EXCEPT */
  28458. varFirstExcept = "";
  28459. }
  28460. fragment.style.setProperty(`--pagedjs-string-first-${name}`, `"${cleanPseudoContent(varFirst)}`);
  28461. fragment.style.setProperty(`--pagedjs-string-last-${name}`, `"${cleanPseudoContent(varLast)}`);
  28462. fragment.style.setProperty(`--pagedjs-string-start-${name}`, `"${cleanPseudoContent(varStart)}`);
  28463. fragment.style.setProperty(`--pagedjs-string-first-except-${name}`, `"${cleanPseudoContent(varFirstExcept)}`);
  28464. }
  28465. }
  28466. }
  28467. class TargetCounters extends Handler {
  28468. constructor(chunker, polisher, caller) {
  28469. super(chunker, polisher, caller);
  28470. this.styleSheet = polisher.styleSheet;
  28471. this.counterTargets = {};
  28472. }
  28473. onContent(funcNode, fItem, fList, declaration, rule) {
  28474. if (funcNode.name === "target-counter") {
  28475. let selector = csstree.generate(rule.ruleNode.prelude);
  28476. let first = funcNode.children.first();
  28477. let func = first.name;
  28478. let value = csstree.generate(funcNode);
  28479. let args = [];
  28480. first.children.forEach((child) => {
  28481. if (child.type === "Identifier") {
  28482. args.push(child.name);
  28483. }
  28484. });
  28485. let counter;
  28486. let style;
  28487. let styleIdentifier;
  28488. funcNode.children.forEach((child) => {
  28489. if (child.type === "Identifier") {
  28490. if (!counter) {
  28491. counter = child.name;
  28492. } else if (!style) {
  28493. styleIdentifier = csstree.clone(child);
  28494. style = child.name;
  28495. }
  28496. }
  28497. });
  28498. let variable = "target-counter-" + UUID();
  28499. selector.split(",").forEach((s) => {
  28500. this.counterTargets[s] = {
  28501. func: func,
  28502. args: args,
  28503. value: value,
  28504. counter: counter,
  28505. style: style,
  28506. selector: s,
  28507. fullSelector: selector,
  28508. variable: variable
  28509. };
  28510. });
  28511. // Replace with counter
  28512. funcNode.name = "counter";
  28513. funcNode.children = new csstree.List();
  28514. funcNode.children.appendData({
  28515. type: "Identifier",
  28516. loc: 0,
  28517. name: variable
  28518. });
  28519. if (styleIdentifier) {
  28520. funcNode.children.appendData({type: "Operator", loc: null, value: ","});
  28521. funcNode.children.appendData(styleIdentifier);
  28522. }
  28523. }
  28524. }
  28525. afterPageLayout(fragment, page, breakToken, chunker) {
  28526. Object.keys(this.counterTargets).forEach((name) => {
  28527. let target = this.counterTargets[name];
  28528. let split = target.selector.split(/::?/g);
  28529. let query = split[0];
  28530. let queried = chunker.pagesArea.querySelectorAll(query + ":not([data-" + target.variable + "])");
  28531. queried.forEach((selected, index) => {
  28532. // TODO: handle func other than attr
  28533. if (target.func !== "attr") {
  28534. return;
  28535. }
  28536. let val = attr(selected, target.args);
  28537. let element = chunker.pagesArea.querySelector(querySelectorEscape(val));
  28538. if (element) {
  28539. let selector = UUID();
  28540. selected.setAttribute("data-" + target.variable, selector);
  28541. // TODO: handle other counter types (by query)
  28542. let pseudo = "";
  28543. if (split.length > 1) {
  28544. pseudo += "::" + split[1];
  28545. }
  28546. if (target.counter === "page") {
  28547. let pages = chunker.pagesArea.querySelectorAll(".pagedjs_page");
  28548. let pg = 0;
  28549. for (let i = 0; i < pages.length; i++) {
  28550. let page = pages[i];
  28551. let styles = window.getComputedStyle(page);
  28552. let reset = styles["counter-reset"].replace("page", "").trim();
  28553. let increment = styles["counter-increment"].replace("page", "").trim();
  28554. if (reset !== "none") {
  28555. pg = parseInt(reset);
  28556. }
  28557. if (increment !== "none") {
  28558. pg += parseInt(increment);
  28559. }
  28560. if (page.contains(element)){
  28561. break;
  28562. }
  28563. }
  28564. this.styleSheet.insertRule(`[data-${target.variable}="${selector}"]${pseudo} { counter-reset: ${target.variable} ${pg}; }`, this.styleSheet.cssRules.length);
  28565. } else {
  28566. let value = element.getAttribute(`data-counter-${target.counter}-value`);
  28567. if (value) {
  28568. this.styleSheet.insertRule(`[data-${target.variable}="${selector}"]${pseudo} { counter-reset: ${target.variable} ${target.variable} ${parseInt(value)}; }`, this.styleSheet.cssRules.length);
  28569. }
  28570. }
  28571. // force redraw
  28572. let el = document.querySelector(`[data-${target.variable}="${selector}"]`);
  28573. if (el) {
  28574. el.style.display = "none";
  28575. el.clientHeight;
  28576. el.style.removeProperty("display");
  28577. }
  28578. }
  28579. });
  28580. });
  28581. }
  28582. }
  28583. // import { nodeAfter } from "../../utils/dom";
  28584. class TargetText extends Handler {
  28585. constructor(chunker, polisher, caller) {
  28586. super(chunker, polisher, caller);
  28587. this.styleSheet = polisher.styleSheet;
  28588. this.textTargets = {};
  28589. this.beforeContent = "";
  28590. this.afterContent = "";
  28591. this.selector = {};
  28592. }
  28593. onContent(funcNode, fItem, fList, declaration, rule) {
  28594. if (funcNode.name === "target-text") {
  28595. this.selector = csstree.generate(rule.ruleNode.prelude);
  28596. let first = funcNode.children.first();
  28597. let last = funcNode.children.last();
  28598. let func = first.name;
  28599. let value = csstree.generate(funcNode);
  28600. let args = [];
  28601. first.children.forEach(child => {
  28602. if (child.type === "Identifier") {
  28603. args.push(child.name);
  28604. }
  28605. });
  28606. let style;
  28607. if (last !== first) {
  28608. style = last.name;
  28609. }
  28610. let variable = "--pagedjs-" + UUID();
  28611. this.selector.split(",").forEach(s => {
  28612. this.textTargets[s] = {
  28613. func: func,
  28614. args: args,
  28615. value: value,
  28616. style: style || "content",
  28617. selector: s,
  28618. fullSelector: this.selector,
  28619. variable: variable
  28620. };
  28621. });
  28622. // Replace with variable
  28623. funcNode.name = "var";
  28624. funcNode.children = new csstree.List();
  28625. funcNode.children.appendData({
  28626. type: "Identifier",
  28627. loc: 0,
  28628. name: variable
  28629. });
  28630. }
  28631. }
  28632. // parse this on the ONCONTENT : get all before and after and replace the value with a variable
  28633. onPseudoSelector(pseudoNode, pItem, pList, selector, rule) {
  28634. // console.log(pseudoNode);
  28635. // console.log(rule);
  28636. rule.ruleNode.block.children.forEach(properties => {
  28637. if (pseudoNode.name === "before" && properties.property === "content") {
  28638. // let beforeVariable = "--pagedjs-" + UUID();
  28639. let contenu = properties.value.children;
  28640. contenu.forEach(prop => {
  28641. if (prop.type === "String") {
  28642. this.beforeContent = prop.value;
  28643. }
  28644. });
  28645. } else if (pseudoNode.name === "after" && properties.property === "content") {
  28646. properties.value.children.forEach(prop => {
  28647. if (prop.type === "String") {
  28648. this.afterContent = prop.value;
  28649. }
  28650. });
  28651. }
  28652. });
  28653. }
  28654. afterParsed(fragment) {
  28655. Object.keys(this.textTargets).forEach(name => {
  28656. let target = this.textTargets[name];
  28657. let split = target.selector.split("::");
  28658. let query = split[0];
  28659. let queried = fragment.querySelectorAll(query);
  28660. let textContent;
  28661. queried.forEach((selected, index) => {
  28662. let val = attr(selected, target.args);
  28663. let element = fragment.querySelector(querySelectorEscape(val));
  28664. if (element) {
  28665. // content & first-letter & before & after refactorized
  28666. if (target.style) {
  28667. this.selector = UUID();
  28668. selected.setAttribute("data-target-text", this.selector);
  28669. let psuedo = "";
  28670. if (split.length > 1) {
  28671. psuedo += "::" + split[1];
  28672. }
  28673. if (target.style === "before" || target.style === "after") {
  28674. const pseudoType = `${target.style}Content`;
  28675. textContent = cleanPseudoContent(this[pseudoType]);
  28676. } else {
  28677. textContent = cleanPseudoContent(element.textContent, " ");
  28678. }
  28679. textContent = target.style === "first-letter" ? textContent.charAt(0) : textContent;
  28680. this.styleSheet.insertRule(`[data-target-text="${this.selector}"]${psuedo} { ${target.variable}: "${textContent}" }`);
  28681. } else {
  28682. console.warn("missed target", val);
  28683. }
  28684. }
  28685. });
  28686. });
  28687. }
  28688. }
  28689. var generatedContentHandlers = [
  28690. RunningHeaders,
  28691. StringSets,
  28692. TargetCounters,
  28693. TargetText
  28694. ];
  28695. class WhiteSpaceFilter extends Handler {
  28696. constructor(chunker, polisher, caller) {
  28697. super(chunker, polisher, caller);
  28698. }
  28699. filter(content) {
  28700. filterTree(content, (node) => {
  28701. return this.filterEmpty(node);
  28702. }, NodeFilter.SHOW_TEXT);
  28703. }
  28704. filterEmpty(node) {
  28705. if (node.textContent.length > 1 && isIgnorable(node)) {
  28706. // Do not touch the content if text is pre-formatted
  28707. let parent = node.parentNode;
  28708. let pre = isElement(parent) && parent.closest("pre");
  28709. if (pre) {
  28710. return NodeFilter.FILTER_REJECT;
  28711. }
  28712. const previousSibling = previousSignificantNode(node);
  28713. const nextSibling = nextSignificantNode(node);
  28714. if (nextSibling === null && previousSibling === null) {
  28715. // we should not remove a Node that does not have any siblings.
  28716. node.textContent = " ";
  28717. return NodeFilter.FILTER_REJECT;
  28718. }
  28719. if (nextSibling === null) {
  28720. // we can safely remove this node
  28721. return NodeFilter.FILTER_ACCEPT;
  28722. }
  28723. if (previousSibling === null) {
  28724. // we can safely remove this node
  28725. return NodeFilter.FILTER_ACCEPT;
  28726. }
  28727. // replace the content with a single space
  28728. node.textContent = " ";
  28729. // TODO: we also need to preserve sequences of white spaces when the parent has "white-space" rule:
  28730. // pre
  28731. // Sequences of white space are preserved. Lines are only broken at newline characters in the source and at <br> elements.
  28732. //
  28733. // pre-wrap
  28734. // Sequences of white space are preserved. Lines are broken at newline characters, at <br>, and as necessary to fill line boxes.
  28735. //
  28736. // pre-line
  28737. // Sequences of white space are collapsed. Lines are broken at newline characters, at <br>, and as necessary to fill line boxes.
  28738. //
  28739. // break-spaces
  28740. // The behavior is identical to that of pre-wrap, except that:
  28741. // - Any sequence of preserved white space always takes up space, including at the end of the line.
  28742. // - A line breaking opportunity exists after every preserved white space character, including between white space characters.
  28743. // - Such preserved spaces take up space and do not hang, and thus affect the box’s intrinsic sizes (min-content size and max-content size).
  28744. //
  28745. // See: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space#Values
  28746. return NodeFilter.FILTER_REJECT;
  28747. } else {
  28748. return NodeFilter.FILTER_REJECT;
  28749. }
  28750. }
  28751. }
  28752. class CommentsFilter extends Handler {
  28753. constructor(chunker, polisher, caller) {
  28754. super(chunker, polisher, caller);
  28755. }
  28756. filter(content) {
  28757. filterTree(content, null, NodeFilter.SHOW_COMMENT);
  28758. }
  28759. }
  28760. class ScriptsFilter extends Handler {
  28761. constructor(chunker, polisher, caller) {
  28762. super(chunker, polisher, caller);
  28763. }
  28764. filter(content) {
  28765. content.querySelectorAll("script").forEach( script => { script.remove(); });
  28766. }
  28767. }
  28768. var clearCut = {};
  28769. /**
  28770. * Originally ported from https://github.com/keeganstreet/specificity/blob/866bf7ab4e7f62a7179c15b13a95af4e1c7b1afa/specificity.js
  28771. *
  28772. * Calculates the specificity of CSS selectors
  28773. * http://www.w3.org/TR/css3-selectors/#specificity
  28774. *
  28775. * Returns a selector integer value
  28776. */
  28777. (function (exports) {
  28778. // The following regular expressions assume that selectors matching the preceding regular expressions have been removed
  28779. var attributeRegex = /(\[[^\]]+\])/g;
  28780. var idRegex = /(#[^\s\+>~\.\[:]+)/g;
  28781. var classRegex = /(\.[^\s\+>~\.\[:]+)/g;
  28782. var pseudoElementRegex = /(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/g;
  28783. var pseudoClassRegex = /(:[^\s\+>~\.\[:]+)/g;
  28784. var elementRegex = /([^\s\+>~\.\[:]+)/g;
  28785. var notRegex = /:not\(([^\)]*)\)/g;
  28786. var ruleRegex = /\{[^]*/gm;
  28787. var separatorRegex = /[\*\s\+>~]/g;
  28788. var straysRegex = /[#\.]/g;
  28789. // Find matches for a regular expression in a string and push their details to parts
  28790. // Type is "a" for IDs, "b" for classes, attributes and pseudo-classes and "c" for elements and pseudo-elements
  28791. var findMatch = function(regex, type, types, selector) {
  28792. var matches = selector.match(regex);
  28793. if (matches) {
  28794. for (var i = 0; i < matches.length; i++) {
  28795. types[type]++;
  28796. // Replace this simple selector with whitespace so it won't be counted in further simple selectors
  28797. selector = selector.replace(matches[i], ' ');
  28798. }
  28799. }
  28800. return selector;
  28801. };
  28802. // Calculate the specificity for a selector by dividing it into simple selectors and counting them
  28803. var calculate = function(selector) {
  28804. var commaIndex = selector.indexOf(',');
  28805. if (commaIndex !== -1) {
  28806. selector = selector.substring(0, commaIndex);
  28807. }
  28808. var types = {
  28809. a: 0,
  28810. b: 0,
  28811. c: 0
  28812. };
  28813. // Remove the negation psuedo-class (:not) but leave its argument because specificity is calculated on its argument
  28814. selector = selector.replace(notRegex, ' $1 ');
  28815. // Remove anything after a left brace in case a user has pasted in a rule, not just a selector
  28816. selector = selector.replace(ruleRegex, ' ');
  28817. // Add attribute selectors to parts collection (type b)
  28818. selector = findMatch(attributeRegex, 'b', types, selector);
  28819. // Add ID selectors to parts collection (type a)
  28820. selector = findMatch(idRegex, 'a', types, selector);
  28821. // Add class selectors to parts collection (type b)
  28822. selector = findMatch(classRegex, 'b', types, selector);
  28823. // Add pseudo-element selectors to parts collection (type c)
  28824. selector = findMatch(pseudoElementRegex, 'c', types, selector);
  28825. // Add pseudo-class selectors to parts collection (type b)
  28826. selector = findMatch(pseudoClassRegex, 'b', types, selector);
  28827. // Remove universal selector and separator characters
  28828. selector = selector.replace(separatorRegex, ' ');
  28829. // Remove any stray dots or hashes which aren't attached to words
  28830. // These may be present if the user is live-editing this selector
  28831. selector = selector.replace(straysRegex, ' ');
  28832. // The only things left should be element selectors (type c)
  28833. findMatch(elementRegex, 'c', types, selector);
  28834. return (types.a * 100) + (types.b * 10) + (types.c * 1);
  28835. };
  28836. var specificityCache = {};
  28837. exports.calculateSpecificity = function(selector) {
  28838. var specificity = specificityCache[selector];
  28839. if (specificity === undefined) {
  28840. specificity = calculate(selector);
  28841. specificityCache[selector] = specificity;
  28842. }
  28843. return specificity;
  28844. };
  28845. var validSelectorCache = {};
  28846. var testSelectorElement = null;
  28847. exports.isSelectorValid = function(selector) {
  28848. var valid = validSelectorCache[selector];
  28849. if (valid === undefined) {
  28850. if (testSelectorElement == null) {
  28851. testSelectorElement = document.createElement('div');
  28852. }
  28853. try {
  28854. testSelectorElement.querySelector(selector);
  28855. valid = true;
  28856. } catch (error) {
  28857. valid = false;
  28858. }
  28859. validSelectorCache[selector] = valid;
  28860. }
  28861. return valid;
  28862. };
  28863. exports.validateSelector = function(selector) {
  28864. if (!exports.isSelectorValid(selector)) {
  28865. var error = new SyntaxError(selector + ' is not a valid selector');
  28866. error.code = 'EBADSELECTOR';
  28867. throw error;
  28868. }
  28869. };
  28870. } (clearCut));
  28871. class UndisplayedFilter extends Handler {
  28872. constructor(chunker, polisher, caller) {
  28873. super(chunker, polisher, caller);
  28874. this.displayRules = {};
  28875. }
  28876. onDeclaration(declaration, dItem, dList, rule) {
  28877. if (declaration.property === "display") {
  28878. let selector = csstree.generate(rule.ruleNode.prelude);
  28879. let value = declaration.value.children.first().name;
  28880. selector.split(",").forEach((s) => {
  28881. this.displayRules[s] = {
  28882. value: value,
  28883. selector: s,
  28884. specificity: clearCut.calculateSpecificity(s),
  28885. important: declaration.important
  28886. };
  28887. });
  28888. }
  28889. }
  28890. filter(content) {
  28891. let { matches, selectors } = this.sortDisplayedSelectors(content, this.displayRules);
  28892. // Find matching elements that have display styles
  28893. for (let i = 0; i < matches.length; i++) {
  28894. let element = matches[i];
  28895. let selector = selectors[i];
  28896. let displayValue = selector[selector.length-1].value;
  28897. if(this.removable(element) && displayValue === "none") {
  28898. element.dataset.undisplayed = "undisplayed";
  28899. }
  28900. }
  28901. // Find elements that have inline styles
  28902. let styledElements = content.querySelectorAll("[style]");
  28903. for (let i = 0; i < styledElements.length; i++) {
  28904. let element = styledElements[i];
  28905. if (this.removable(element)) {
  28906. element.dataset.undisplayed = "undisplayed";
  28907. }
  28908. }
  28909. }
  28910. sorter(a, b) {
  28911. if (a.important && !b.important) {
  28912. return 1;
  28913. }
  28914. if (b.important && !a.important) {
  28915. return -1;
  28916. }
  28917. return a.specificity - b.specificity;
  28918. }
  28919. sortDisplayedSelectors(content, displayRules=[]) {
  28920. let matches = [];
  28921. let selectors = [];
  28922. for (let d in displayRules) {
  28923. let displayItem = displayRules[d];
  28924. let selector = displayItem.selector;
  28925. let query = [];
  28926. try {
  28927. try {
  28928. query = content.querySelectorAll(selector);
  28929. } catch (e) {
  28930. query = content.querySelectorAll(cleanSelector(selector));
  28931. }
  28932. } catch (e) {
  28933. query = [];
  28934. }
  28935. let elements = Array.from(query);
  28936. for (let e of elements) {
  28937. if (matches.includes(e)) {
  28938. let index = matches.indexOf(e);
  28939. selectors[index].push(displayItem);
  28940. selectors[index] = selectors[index].sort(this.sorter);
  28941. } else {
  28942. matches.push(e);
  28943. selectors.push([displayItem]);
  28944. }
  28945. }
  28946. }
  28947. return { matches, selectors };
  28948. }
  28949. removable(element) {
  28950. if (element.style &&
  28951. element.style.display !== "" &&
  28952. element.style.display !== "none") {
  28953. return false;
  28954. }
  28955. return true;
  28956. }
  28957. }
  28958. var filters = [
  28959. WhiteSpaceFilter,
  28960. CommentsFilter,
  28961. ScriptsFilter,
  28962. UndisplayedFilter
  28963. ];
  28964. var isImplemented$3 = function () {
  28965. var from = Array.from, arr, result;
  28966. if (typeof from !== "function") return false;
  28967. arr = ["raz", "dwa"];
  28968. result = from(arr);
  28969. return Boolean(result && (result !== arr) && (result[1] === "dwa"));
  28970. };
  28971. var isImplemented$2;
  28972. var hasRequiredIsImplemented;
  28973. function requireIsImplemented () {
  28974. if (hasRequiredIsImplemented) return isImplemented$2;
  28975. hasRequiredIsImplemented = 1;
  28976. var validTypes = { object: true, symbol: true };
  28977. isImplemented$2 = function () {
  28978. var symbol;
  28979. if (typeof Symbol !== 'function') return false;
  28980. symbol = Symbol('test symbol');
  28981. try { String(symbol); } catch (e) { return false; }
  28982. // Return 'true' also for polyfills
  28983. if (!validTypes[typeof Symbol.iterator]) return false;
  28984. if (!validTypes[typeof Symbol.toPrimitive]) return false;
  28985. if (!validTypes[typeof Symbol.toStringTag]) return false;
  28986. return true;
  28987. };
  28988. return isImplemented$2;
  28989. }
  28990. var isSymbol;
  28991. var hasRequiredIsSymbol;
  28992. function requireIsSymbol () {
  28993. if (hasRequiredIsSymbol) return isSymbol;
  28994. hasRequiredIsSymbol = 1;
  28995. isSymbol = function (x) {
  28996. if (!x) return false;
  28997. if (typeof x === 'symbol') return true;
  28998. if (!x.constructor) return false;
  28999. if (x.constructor.name !== 'Symbol') return false;
  29000. return (x[x.constructor.toStringTag] === 'Symbol');
  29001. };
  29002. return isSymbol;
  29003. }
  29004. var validateSymbol;
  29005. var hasRequiredValidateSymbol;
  29006. function requireValidateSymbol () {
  29007. if (hasRequiredValidateSymbol) return validateSymbol;
  29008. hasRequiredValidateSymbol = 1;
  29009. var isSymbol = requireIsSymbol();
  29010. validateSymbol = function (value) {
  29011. if (!isSymbol(value)) throw new TypeError(value + " is not a symbol");
  29012. return value;
  29013. };
  29014. return validateSymbol;
  29015. }
  29016. var polyfill;
  29017. var hasRequiredPolyfill;
  29018. function requirePolyfill () {
  29019. if (hasRequiredPolyfill) return polyfill;
  29020. hasRequiredPolyfill = 1;
  29021. var d = dExports
  29022. , validateSymbol = requireValidateSymbol()
  29023. , create = Object.create, defineProperties = Object.defineProperties
  29024. , defineProperty = Object.defineProperty, objPrototype = Object.prototype
  29025. , NativeSymbol, SymbolPolyfill, HiddenSymbol, globalSymbols = create(null)
  29026. , isNativeSafe;
  29027. if (typeof Symbol === 'function') {
  29028. NativeSymbol = Symbol;
  29029. try {
  29030. String(NativeSymbol());
  29031. isNativeSafe = true;
  29032. } catch (ignore) {}
  29033. }
  29034. var generateName = (function () {
  29035. var created = create(null);
  29036. return function (desc) {
  29037. var postfix = 0, name, ie11BugWorkaround;
  29038. while (created[desc + (postfix || '')]) ++postfix;
  29039. desc += (postfix || '');
  29040. created[desc] = true;
  29041. name = '@@' + desc;
  29042. defineProperty(objPrototype, name, d.gs(null, function (value) {
  29043. // For IE11 issue see:
  29044. // https://connect.microsoft.com/IE/feedbackdetail/view/1928508/
  29045. // ie11-broken-getters-on-dom-objects
  29046. // https://github.com/medikoo/es6-symbol/issues/12
  29047. if (ie11BugWorkaround) return;
  29048. ie11BugWorkaround = true;
  29049. defineProperty(this, name, d(value));
  29050. ie11BugWorkaround = false;
  29051. }));
  29052. return name;
  29053. };
  29054. }());
  29055. // Internal constructor (not one exposed) for creating Symbol instances.
  29056. // This one is used to ensure that `someSymbol instanceof Symbol` always return false
  29057. HiddenSymbol = function Symbol(description) {
  29058. if (this instanceof HiddenSymbol) throw new TypeError('Symbol is not a constructor');
  29059. return SymbolPolyfill(description);
  29060. };
  29061. // Exposed `Symbol` constructor
  29062. // (returns instances of HiddenSymbol)
  29063. polyfill = SymbolPolyfill = function Symbol(description) {
  29064. var symbol;
  29065. if (this instanceof Symbol) throw new TypeError('Symbol is not a constructor');
  29066. if (isNativeSafe) return NativeSymbol(description);
  29067. symbol = create(HiddenSymbol.prototype);
  29068. description = (description === undefined ? '' : String(description));
  29069. return defineProperties(symbol, {
  29070. __description__: d('', description),
  29071. __name__: d('', generateName(description))
  29072. });
  29073. };
  29074. defineProperties(SymbolPolyfill, {
  29075. for: d(function (key) {
  29076. if (globalSymbols[key]) return globalSymbols[key];
  29077. return (globalSymbols[key] = SymbolPolyfill(String(key)));
  29078. }),
  29079. keyFor: d(function (s) {
  29080. var key;
  29081. validateSymbol(s);
  29082. for (key in globalSymbols) if (globalSymbols[key] === s) return key;
  29083. }),
  29084. // To ensure proper interoperability with other native functions (e.g. Array.from)
  29085. // fallback to eventual native implementation of given symbol
  29086. hasInstance: d('', (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill('hasInstance')),
  29087. isConcatSpreadable: d('', (NativeSymbol && NativeSymbol.isConcatSpreadable) ||
  29088. SymbolPolyfill('isConcatSpreadable')),
  29089. iterator: d('', (NativeSymbol && NativeSymbol.iterator) || SymbolPolyfill('iterator')),
  29090. match: d('', (NativeSymbol && NativeSymbol.match) || SymbolPolyfill('match')),
  29091. replace: d('', (NativeSymbol && NativeSymbol.replace) || SymbolPolyfill('replace')),
  29092. search: d('', (NativeSymbol && NativeSymbol.search) || SymbolPolyfill('search')),
  29093. species: d('', (NativeSymbol && NativeSymbol.species) || SymbolPolyfill('species')),
  29094. split: d('', (NativeSymbol && NativeSymbol.split) || SymbolPolyfill('split')),
  29095. toPrimitive: d('', (NativeSymbol && NativeSymbol.toPrimitive) || SymbolPolyfill('toPrimitive')),
  29096. toStringTag: d('', (NativeSymbol && NativeSymbol.toStringTag) || SymbolPolyfill('toStringTag')),
  29097. unscopables: d('', (NativeSymbol && NativeSymbol.unscopables) || SymbolPolyfill('unscopables'))
  29098. });
  29099. // Internal tweaks for real symbol producer
  29100. defineProperties(HiddenSymbol.prototype, {
  29101. constructor: d(SymbolPolyfill),
  29102. toString: d('', function () { return this.__name__; })
  29103. });
  29104. // Proper implementation of methods exposed on Symbol.prototype
  29105. // They won't be accessible on produced symbol instances as they derive from HiddenSymbol.prototype
  29106. defineProperties(SymbolPolyfill.prototype, {
  29107. toString: d(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }),
  29108. valueOf: d(function () { return validateSymbol(this); })
  29109. });
  29110. defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d('', function () {
  29111. var symbol = validateSymbol(this);
  29112. if (typeof symbol === 'symbol') return symbol;
  29113. return symbol.toString();
  29114. }));
  29115. defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d('c', 'Symbol'));
  29116. // Proper implementaton of toPrimitive and toStringTag for returned symbol instances
  29117. defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toStringTag,
  29118. d('c', SymbolPolyfill.prototype[SymbolPolyfill.toStringTag]));
  29119. // Note: It's important to define `toPrimitive` as last one, as some implementations
  29120. // implement `toPrimitive` natively without implementing `toStringTag` (or other specified symbols)
  29121. // And that may invoke error in definition flow:
  29122. // See: https://github.com/medikoo/es6-symbol/issues/13#issuecomment-164146149
  29123. defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive,
  29124. d('c', SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive]));
  29125. return polyfill;
  29126. }
  29127. var es6Symbol;
  29128. var hasRequiredEs6Symbol;
  29129. function requireEs6Symbol () {
  29130. if (hasRequiredEs6Symbol) return es6Symbol;
  29131. hasRequiredEs6Symbol = 1;
  29132. es6Symbol = requireIsImplemented()() ? Symbol : requirePolyfill();
  29133. return es6Symbol;
  29134. }
  29135. var isArguments;
  29136. var hasRequiredIsArguments;
  29137. function requireIsArguments () {
  29138. if (hasRequiredIsArguments) return isArguments;
  29139. hasRequiredIsArguments = 1;
  29140. var objToString = Object.prototype.toString
  29141. , id = objToString.call(
  29142. (function () {
  29143. return arguments;
  29144. })()
  29145. );
  29146. isArguments = function (value) {
  29147. return objToString.call(value) === id;
  29148. };
  29149. return isArguments;
  29150. }
  29151. var isFunction;
  29152. var hasRequiredIsFunction;
  29153. function requireIsFunction () {
  29154. if (hasRequiredIsFunction) return isFunction;
  29155. hasRequiredIsFunction = 1;
  29156. var objToString = Object.prototype.toString, id = objToString.call(noop$4);
  29157. isFunction = function (value) {
  29158. return typeof value === "function" && objToString.call(value) === id;
  29159. };
  29160. return isFunction;
  29161. }
  29162. var isImplemented$1 = function () {
  29163. var sign = Math.sign;
  29164. if (typeof sign !== "function") return false;
  29165. return (sign(10) === 1) && (sign(-20) === -1);
  29166. };
  29167. var shim$2;
  29168. var hasRequiredShim$2;
  29169. function requireShim$2 () {
  29170. if (hasRequiredShim$2) return shim$2;
  29171. hasRequiredShim$2 = 1;
  29172. shim$2 = function (value) {
  29173. value = Number(value);
  29174. if (isNaN(value) || (value === 0)) return value;
  29175. return value > 0 ? 1 : -1;
  29176. };
  29177. return shim$2;
  29178. }
  29179. var sign$1 = isImplemented$1()
  29180. ? Math.sign
  29181. : requireShim$2();
  29182. var sign = sign$1
  29183. , abs$1 = Math.abs, floor$1 = Math.floor;
  29184. var toInteger$1 = function (value) {
  29185. if (isNaN(value)) return 0;
  29186. value = Number(value);
  29187. if ((value === 0) || !isFinite(value)) return value;
  29188. return sign(value) * floor$1(abs$1(value));
  29189. };
  29190. var toInteger = toInteger$1
  29191. , max = Math.max;
  29192. var toPosInteger = function (value) {
  29193. return max(0, toInteger(value));
  29194. };
  29195. var isString;
  29196. var hasRequiredIsString;
  29197. function requireIsString () {
  29198. if (hasRequiredIsString) return isString;
  29199. hasRequiredIsString = 1;
  29200. var objToString = Object.prototype.toString, id = objToString.call("");
  29201. isString = function (value) {
  29202. return (
  29203. typeof value === "string" ||
  29204. (value &&
  29205. typeof value === "object" &&
  29206. (value instanceof String || objToString.call(value) === id)) ||
  29207. false
  29208. );
  29209. };
  29210. return isString;
  29211. }
  29212. var shim$1;
  29213. var hasRequiredShim$1;
  29214. function requireShim$1 () {
  29215. if (hasRequiredShim$1) return shim$1;
  29216. hasRequiredShim$1 = 1;
  29217. var iteratorSymbol = requireEs6Symbol().iterator
  29218. , isArguments = requireIsArguments()
  29219. , isFunction = requireIsFunction()
  29220. , toPosInt = toPosInteger
  29221. , callable = validCallable
  29222. , validValue$1 = validValue
  29223. , isValue = isValue$3
  29224. , isString = requireIsString()
  29225. , isArray = Array.isArray
  29226. , call = Function.prototype.call
  29227. , desc = { configurable: true, enumerable: true, writable: true, value: null }
  29228. , defineProperty = Object.defineProperty;
  29229. // eslint-disable-next-line complexity
  29230. shim$1 = function (arrayLike /*, mapFn, thisArg*/) {
  29231. var mapFn = arguments[1]
  29232. , thisArg = arguments[2]
  29233. , Context
  29234. , i
  29235. , j
  29236. , arr
  29237. , length
  29238. , code
  29239. , iterator
  29240. , result
  29241. , getIterator
  29242. , value;
  29243. arrayLike = Object(validValue$1(arrayLike));
  29244. if (isValue(mapFn)) callable(mapFn);
  29245. if (!this || this === Array || !isFunction(this)) {
  29246. // Result: Plain array
  29247. if (!mapFn) {
  29248. if (isArguments(arrayLike)) {
  29249. // Source: Arguments
  29250. length = arrayLike.length;
  29251. if (length !== 1) return Array.apply(null, arrayLike);
  29252. arr = new Array(1);
  29253. arr[0] = arrayLike[0];
  29254. return arr;
  29255. }
  29256. if (isArray(arrayLike)) {
  29257. // Source: Array
  29258. arr = new Array(length = arrayLike.length);
  29259. for (i = 0; i < length; ++i) arr[i] = arrayLike[i];
  29260. return arr;
  29261. }
  29262. }
  29263. arr = [];
  29264. } else {
  29265. // Result: Non plain array
  29266. Context = this;
  29267. }
  29268. if (!isArray(arrayLike)) {
  29269. if ((getIterator = arrayLike[iteratorSymbol]) !== undefined) {
  29270. // Source: Iterator
  29271. iterator = callable(getIterator).call(arrayLike);
  29272. if (Context) arr = new Context();
  29273. result = iterator.next();
  29274. i = 0;
  29275. while (!result.done) {
  29276. value = mapFn ? call.call(mapFn, thisArg, result.value, i) : result.value;
  29277. if (Context) {
  29278. desc.value = value;
  29279. defineProperty(arr, i, desc);
  29280. } else {
  29281. arr[i] = value;
  29282. }
  29283. result = iterator.next();
  29284. ++i;
  29285. }
  29286. length = i;
  29287. } else if (isString(arrayLike)) {
  29288. // Source: String
  29289. length = arrayLike.length;
  29290. if (Context) arr = new Context();
  29291. for (i = 0, j = 0; i < length; ++i) {
  29292. value = arrayLike[i];
  29293. if (i + 1 < length) {
  29294. code = value.charCodeAt(0);
  29295. // eslint-disable-next-line max-depth
  29296. if (code >= 0xd800 && code <= 0xdbff) value += arrayLike[++i];
  29297. }
  29298. value = mapFn ? call.call(mapFn, thisArg, value, j) : value;
  29299. if (Context) {
  29300. desc.value = value;
  29301. defineProperty(arr, j, desc);
  29302. } else {
  29303. arr[j] = value;
  29304. }
  29305. ++j;
  29306. }
  29307. length = j;
  29308. }
  29309. }
  29310. if (length === undefined) {
  29311. // Source: array or array-like
  29312. length = toPosInt(arrayLike.length);
  29313. if (Context) arr = new Context(length);
  29314. for (i = 0; i < length; ++i) {
  29315. value = mapFn ? call.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i];
  29316. if (Context) {
  29317. desc.value = value;
  29318. defineProperty(arr, i, desc);
  29319. } else {
  29320. arr[i] = value;
  29321. }
  29322. }
  29323. }
  29324. if (Context) {
  29325. desc.value = null;
  29326. arr.length = length;
  29327. }
  29328. return arr;
  29329. };
  29330. return shim$1;
  29331. }
  29332. var from = isImplemented$3()
  29333. ? Array.from
  29334. : requireShim$1();
  29335. var isImplemented = function () {
  29336. var numberIsNaN = Number.isNaN;
  29337. if (typeof numberIsNaN !== "function") return false;
  29338. return !numberIsNaN({}) && numberIsNaN(NaN) && !numberIsNaN(34);
  29339. };
  29340. var shim;
  29341. var hasRequiredShim;
  29342. function requireShim () {
  29343. if (hasRequiredShim) return shim;
  29344. hasRequiredShim = 1;
  29345. shim = function (value) {
  29346. // eslint-disable-next-line no-self-compare
  29347. return value !== value;
  29348. };
  29349. return shim;
  29350. }
  29351. var isNan = isImplemented()
  29352. ? Number.isNaN
  29353. : requireShim();
  29354. var numberIsNaN = isNan
  29355. , toPosInt = toPosInteger
  29356. , value$1 = validValue
  29357. , indexOf$1 = Array.prototype.indexOf
  29358. , objHasOwnProperty = Object.prototype.hasOwnProperty
  29359. , abs = Math.abs
  29360. , floor = Math.floor;
  29361. var eIndexOf = function (searchElement /*, fromIndex*/) {
  29362. var i, length, fromIndex, val;
  29363. if (!numberIsNaN(searchElement)) return indexOf$1.apply(this, arguments);
  29364. length = toPosInt(value$1(this).length);
  29365. fromIndex = arguments[1];
  29366. if (isNaN(fromIndex)) fromIndex = 0;
  29367. else if (fromIndex >= 0) fromIndex = floor(fromIndex);
  29368. else fromIndex = toPosInt(this.length) - floor(abs(fromIndex));
  29369. for (i = fromIndex; i < length; ++i) {
  29370. if (objHasOwnProperty.call(this, i)) {
  29371. val = this[i];
  29372. if (numberIsNaN(val)) return i; // Jslint: ignore
  29373. }
  29374. }
  29375. return -1;
  29376. };
  29377. var indexOf = eIndexOf
  29378. , forEach = Array.prototype.forEach
  29379. , splice = Array.prototype.splice;
  29380. // eslint-disable-next-line no-unused-vars
  29381. var remove$1 = function (itemToRemove /*, …item*/) {
  29382. forEach.call(
  29383. arguments,
  29384. function (item) {
  29385. var index = indexOf.call(this, item);
  29386. if (index !== -1) splice.call(this, index, 1);
  29387. },
  29388. this
  29389. );
  29390. };
  29391. var isValue = isValue$3;
  29392. var map = { function: true, object: true };
  29393. var isObject$1 = function (value) {
  29394. return (isValue(value) && map[typeof value]) || false;
  29395. };
  29396. var isObject = isObject$1;
  29397. var validObject = function (value) {
  29398. if (!isObject(value)) throw new TypeError(value + " is not an Object");
  29399. return value;
  29400. };
  29401. var aFrom = from
  29402. , remove = remove$1
  29403. , value = validObject
  29404. , d = dExports
  29405. , emit = eventEmitterExports.methods.emit
  29406. , defineProperty = Object.defineProperty
  29407. , hasOwnProperty$1 = Object.prototype.hasOwnProperty
  29408. , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  29409. var pipe = function (e1, e2/*, name*/) {
  29410. var pipes, pipe, desc, name;
  29411. (value(e1) && value(e2));
  29412. name = arguments[2];
  29413. if (name === undefined) name = 'emit';
  29414. pipe = {
  29415. close: function () { remove.call(pipes, e2); }
  29416. };
  29417. if (hasOwnProperty$1.call(e1, '__eePipes__')) {
  29418. (pipes = e1.__eePipes__).push(e2);
  29419. return pipe;
  29420. }
  29421. defineProperty(e1, '__eePipes__', d('c', pipes = [e2]));
  29422. desc = getOwnPropertyDescriptor(e1, name);
  29423. if (!desc) {
  29424. desc = d('c', undefined);
  29425. } else {
  29426. delete desc.get;
  29427. delete desc.set;
  29428. }
  29429. desc.value = function () {
  29430. var i, emitter, data = aFrom(pipes);
  29431. emit.apply(this, arguments);
  29432. for (i = 0; (emitter = data[i]); ++i) emit.apply(emitter, arguments);
  29433. };
  29434. defineProperty(e1, name, desc);
  29435. return pipe;
  29436. };
  29437. var pipe$1 = /*@__PURE__*/getDefaultExportFromCjs(pipe);
  29438. let registeredHandlers = [...pagedMediaHandlers, ...generatedContentHandlers, ...filters];
  29439. class Handlers {
  29440. constructor(chunker, polisher, caller) {
  29441. registeredHandlers.forEach((Handler) => {
  29442. let handler = new Handler(chunker, polisher, caller);
  29443. pipe$1(handler, this);
  29444. });
  29445. }
  29446. }
  29447. EventEmitter(Handlers.prototype);
  29448. function registerHandlers() {
  29449. for (var i = 0; i < arguments.length; i++) {
  29450. registeredHandlers.push(arguments[i]);
  29451. }
  29452. }
  29453. function initializeHandlers(chunker, polisher, caller) {
  29454. let handlers = new Handlers(chunker, polisher, caller);
  29455. return handlers;
  29456. }
  29457. class Previewer {
  29458. constructor(options) {
  29459. // this.preview = this.getParams("preview") !== "false";
  29460. this.settings = options || {};
  29461. // Process styles
  29462. this.polisher = new Polisher(false);
  29463. // Chunk contents
  29464. this.chunker = new Chunker(undefined, undefined, this.settings);
  29465. // Hooks
  29466. this.hooks = {};
  29467. this.hooks.beforePreview = new Hook(this);
  29468. this.hooks.afterPreview = new Hook(this);
  29469. // default size
  29470. this.size = {
  29471. width: {
  29472. value: 8.5,
  29473. unit: "in"
  29474. },
  29475. height: {
  29476. value: 11,
  29477. unit: "in"
  29478. },
  29479. format: undefined,
  29480. orientation: undefined
  29481. };
  29482. this.chunker.on("page", (page) => {
  29483. this.emit("page", page);
  29484. });
  29485. this.chunker.on("rendering", () => {
  29486. this.emit("rendering", this.chunker);
  29487. });
  29488. }
  29489. initializeHandlers() {
  29490. let handlers = initializeHandlers(this.chunker, this.polisher, this);
  29491. handlers.on("size", (size) => {
  29492. this.size = size;
  29493. this.emit("size", size);
  29494. });
  29495. handlers.on("atpages", (pages) => {
  29496. this.atpages = pages;
  29497. this.emit("atpages", pages);
  29498. });
  29499. return handlers;
  29500. }
  29501. registerHandlers() {
  29502. return registerHandlers.apply(registerHandlers, arguments);
  29503. }
  29504. getParams(name) {
  29505. let param;
  29506. let url = new URL(window.location);
  29507. let params = new URLSearchParams(url.search);
  29508. for(var pair of params.entries()) {
  29509. if(pair[0] === name) {
  29510. param = pair[1];
  29511. }
  29512. }
  29513. return param;
  29514. }
  29515. wrapContent() {
  29516. // Wrap body in template tag
  29517. let body = document.querySelector("body");
  29518. // Check if a template exists
  29519. let template;
  29520. template = body.querySelector(":scope > template[data-ref='pagedjs-content']");
  29521. if (!template) {
  29522. // Otherwise create one
  29523. template = document.createElement("template");
  29524. template.dataset.ref = "pagedjs-content";
  29525. template.innerHTML = body.innerHTML;
  29526. body.innerHTML = "";
  29527. body.appendChild(template);
  29528. }
  29529. return template.content;
  29530. }
  29531. removeStyles(doc=document) {
  29532. // Get all stylesheets
  29533. const stylesheets = Array.from(doc.querySelectorAll("link[rel='stylesheet']:not([data-pagedjs-ignore], [media~='screen'])"));
  29534. // Get inline styles
  29535. const inlineStyles = Array.from(doc.querySelectorAll("style:not([data-pagedjs-inserted-styles], [data-pagedjs-ignore], [media~='screen'])"));
  29536. const elements = [...stylesheets, ...inlineStyles];
  29537. return elements
  29538. // preserve order
  29539. .sort(function (element1, element2) {
  29540. const position = element1.compareDocumentPosition(element2);
  29541. if (position === Node.DOCUMENT_POSITION_PRECEDING) {
  29542. return 1;
  29543. } else if (position === Node.DOCUMENT_POSITION_FOLLOWING) {
  29544. return -1;
  29545. }
  29546. return 0;
  29547. })
  29548. // extract the href
  29549. .map((element) => {
  29550. if (element.nodeName === "STYLE") {
  29551. const obj = {};
  29552. obj[window.location.href] = element.textContent;
  29553. element.remove();
  29554. return obj;
  29555. }
  29556. if (element.nodeName === "LINK") {
  29557. element.remove();
  29558. return element.href;
  29559. }
  29560. // ignore
  29561. console.warn(`Unable to process: ${element}, ignoring.`);
  29562. });
  29563. }
  29564. async preview(content, stylesheets, renderTo) {
  29565. await this.hooks.beforePreview.trigger(content, renderTo);
  29566. if (!content) {
  29567. content = this.wrapContent();
  29568. }
  29569. if (!stylesheets) {
  29570. stylesheets = this.removeStyles();
  29571. }
  29572. this.polisher.setup();
  29573. this.handlers = this.initializeHandlers();
  29574. await this.polisher.add(...stylesheets);
  29575. let startTime = performance.now();
  29576. // Render flow
  29577. let flow = await this.chunker.flow(content, renderTo);
  29578. let endTime = performance.now();
  29579. flow.performance = (endTime - startTime);
  29580. flow.size = this.size;
  29581. this.emit("rendered", flow);
  29582. await this.hooks.afterPreview.trigger(flow.pages);
  29583. return flow;
  29584. }
  29585. }
  29586. EventEmitter(Previewer.prototype);
  29587. var Paged = /*#__PURE__*/Object.freeze({
  29588. __proto__: null,
  29589. Chunker: Chunker,
  29590. Handler: Handler,
  29591. Polisher: Polisher,
  29592. Previewer: Previewer,
  29593. initializeHandlers: initializeHandlers,
  29594. registerHandlers: registerHandlers,
  29595. registeredHandlers: registeredHandlers
  29596. });
  29597. window.Paged = Paged;
  29598. let ready = new Promise(function(resolve, reject){
  29599. if (document.readyState === "interactive" || document.readyState === "complete") {
  29600. resolve(document.readyState);
  29601. return;
  29602. }
  29603. document.onreadystatechange = function ($) {
  29604. if (document.readyState === "interactive") {
  29605. resolve(document.readyState);
  29606. }
  29607. };
  29608. });
  29609. let config = window.PagedConfig || {
  29610. auto: true,
  29611. before: undefined,
  29612. after: undefined,
  29613. content: undefined,
  29614. stylesheets: undefined,
  29615. renderTo: undefined,
  29616. settings: undefined
  29617. };
  29618. let previewer = new Previewer(config.settings);
  29619. ready.then(async function () {
  29620. let done;
  29621. if (config.before) {
  29622. await config.before();
  29623. }
  29624. if(config.auto !== false) {
  29625. done = await previewer.preview(config.content, config.stylesheets, config.renderTo);
  29626. }
  29627. if (config.after) {
  29628. await config.after(done);
  29629. }
  29630. });
  29631. return previewer;
  29632. }));