paged.polyfill.js 900 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241
  1. /**
  2. * @license Paged.js v0.4.2 | 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.layout = new Hook();
  1211. this.hooks.renderNode = new Hook();
  1212. this.hooks.layoutNode = new Hook();
  1213. this.hooks.beforeOverflow = new Hook();
  1214. this.hooks.onOverflow = new Hook();
  1215. this.hooks.afterOverflowRemoved = new Hook();
  1216. this.hooks.onBreakToken = new Hook();
  1217. }
  1218. this.settings = options || {};
  1219. this.maxChars = this.settings.maxChars || MAX_CHARS_PER_BREAK;
  1220. this.forceRenderBreak = false;
  1221. }
  1222. async renderTo(wrapper, source, breakToken, bounds = this.bounds) {
  1223. let start = this.getStart(source, breakToken);
  1224. let walker = walk$2(start, source);
  1225. let node;
  1226. let prevNode;
  1227. let done;
  1228. let next;
  1229. let hasRenderedContent = false;
  1230. let newBreakToken;
  1231. let length = 0;
  1232. let prevBreakToken = breakToken || new BreakToken(start);
  1233. while (!done && !newBreakToken) {
  1234. next = walker.next();
  1235. prevNode = node;
  1236. node = next.value;
  1237. done = next.done;
  1238. if (!node) {
  1239. this.hooks && this.hooks.layout.trigger(wrapper, this);
  1240. let imgs = wrapper.querySelectorAll("img");
  1241. if (imgs.length) {
  1242. await this.waitForImages(imgs);
  1243. }
  1244. newBreakToken = this.findBreakToken(wrapper, source, bounds, prevBreakToken);
  1245. if (newBreakToken && newBreakToken.equals(prevBreakToken)) {
  1246. console.warn("Unable to layout item: ", prevNode);
  1247. return new RenderResult(undefined, new OverflowContentError("Unable to layout item", [prevNode]));
  1248. }
  1249. this.rebuildTableFromBreakToken(newBreakToken, wrapper);
  1250. return new RenderResult(newBreakToken);
  1251. }
  1252. this.hooks && this.hooks.layoutNode.trigger(node);
  1253. // Check if the rendered element has a break set
  1254. if (hasRenderedContent && this.shouldBreak(node, start)) {
  1255. this.hooks && this.hooks.layout.trigger(wrapper, this);
  1256. let imgs = wrapper.querySelectorAll("img");
  1257. if (imgs.length) {
  1258. await this.waitForImages(imgs);
  1259. }
  1260. newBreakToken = this.findBreakToken(wrapper, source, bounds, prevBreakToken);
  1261. if (!newBreakToken) {
  1262. newBreakToken = this.breakAt(node);
  1263. } else {
  1264. this.rebuildTableFromBreakToken(newBreakToken, wrapper);
  1265. }
  1266. if (newBreakToken && newBreakToken.equals(prevBreakToken)) {
  1267. console.warn("Unable to layout item: ", node);
  1268. let after = newBreakToken.node && nodeAfter(newBreakToken.node);
  1269. if (after) {
  1270. newBreakToken = new BreakToken(after);
  1271. } else {
  1272. return new RenderResult(undefined, new OverflowContentError("Unable to layout item", [node]));
  1273. }
  1274. }
  1275. length = 0;
  1276. break;
  1277. }
  1278. if (node.dataset && node.dataset.page) {
  1279. let named = node.dataset.page;
  1280. let page = this.element.closest(".pagedjs_page");
  1281. page.classList.add("pagedjs_named_page");
  1282. page.classList.add("pagedjs_" + named + "_page");
  1283. if (!node.dataset.splitFrom) {
  1284. page.classList.add("pagedjs_" + named + "_first_page");
  1285. }
  1286. }
  1287. // Should the Node be a shallow or deep clone
  1288. let shallow = isContainer(node);
  1289. let rendered = this.append(node, wrapper, breakToken, shallow);
  1290. length += rendered.textContent.length;
  1291. // Check if layout has content yet
  1292. if (!hasRenderedContent) {
  1293. hasRenderedContent = hasContent(node);
  1294. }
  1295. // Skip to the next node if a deep clone was rendered
  1296. if (!shallow) {
  1297. walker = walk$2(nodeAfter(node, source), source);
  1298. }
  1299. if (this.forceRenderBreak) {
  1300. this.hooks && this.hooks.layout.trigger(wrapper, this);
  1301. newBreakToken = this.findBreakToken(wrapper, source, bounds, prevBreakToken);
  1302. if (!newBreakToken) {
  1303. newBreakToken = this.breakAt(node);
  1304. } else {
  1305. this.rebuildTableFromBreakToken(newBreakToken, wrapper);
  1306. }
  1307. length = 0;
  1308. this.forceRenderBreak = false;
  1309. break;
  1310. }
  1311. // Only check x characters
  1312. if (length >= this.maxChars) {
  1313. this.hooks && this.hooks.layout.trigger(wrapper, this);
  1314. let imgs = wrapper.querySelectorAll("img");
  1315. if (imgs.length) {
  1316. await this.waitForImages(imgs);
  1317. }
  1318. newBreakToken = this.findBreakToken(wrapper, source, bounds, prevBreakToken);
  1319. if (newBreakToken) {
  1320. length = 0;
  1321. this.rebuildTableFromBreakToken(newBreakToken, wrapper);
  1322. }
  1323. if (newBreakToken && newBreakToken.equals(prevBreakToken)) {
  1324. console.warn("Unable to layout item: ", node);
  1325. let after = newBreakToken.node && nodeAfter(newBreakToken.node);
  1326. if (after) {
  1327. newBreakToken = new BreakToken(after);
  1328. } else {
  1329. return new RenderResult(undefined, new OverflowContentError("Unable to layout item", [node]));
  1330. }
  1331. }
  1332. }
  1333. }
  1334. return new RenderResult(newBreakToken);
  1335. }
  1336. breakAt(node, offset = 0) {
  1337. let newBreakToken = new BreakToken(
  1338. node,
  1339. offset
  1340. );
  1341. let breakHooks = this.hooks.onBreakToken.triggerSync(newBreakToken, undefined, node, this);
  1342. breakHooks.forEach((newToken) => {
  1343. if (typeof newToken != "undefined") {
  1344. newBreakToken = newToken;
  1345. }
  1346. });
  1347. return newBreakToken;
  1348. }
  1349. shouldBreak(node, limiter) {
  1350. let previousNode = nodeBefore(node, limiter);
  1351. let parentNode = node.parentNode;
  1352. let parentBreakBefore = needsBreakBefore(node) && parentNode && !previousNode && needsBreakBefore(parentNode);
  1353. let doubleBreakBefore;
  1354. if (parentBreakBefore) {
  1355. doubleBreakBefore = node.dataset.breakBefore === parentNode.dataset.breakBefore;
  1356. }
  1357. return !doubleBreakBefore && needsBreakBefore(node) || needsPreviousBreakAfter(node) || needsPageBreak(node, previousNode);
  1358. }
  1359. forceBreak() {
  1360. this.forceRenderBreak = true;
  1361. }
  1362. getStart(source, breakToken) {
  1363. let start;
  1364. let node = breakToken && breakToken.node;
  1365. if (node) {
  1366. start = node;
  1367. } else {
  1368. start = source.firstChild;
  1369. }
  1370. return start;
  1371. }
  1372. append(node, dest, breakToken, shallow = true, rebuild = true) {
  1373. let clone = cloneNode(node, !shallow);
  1374. if (node.parentNode && isElement(node.parentNode)) {
  1375. let parent = findElement(node.parentNode, dest);
  1376. // Rebuild chain
  1377. if (parent) {
  1378. parent.appendChild(clone);
  1379. } else if (rebuild) {
  1380. let fragment = rebuildAncestors(node);
  1381. parent = findElement(node.parentNode, fragment);
  1382. if (!parent) {
  1383. dest.appendChild(clone);
  1384. } else if (breakToken && isText(breakToken.node) && breakToken.offset > 0) {
  1385. clone.textContent = clone.textContent.substring(breakToken.offset);
  1386. parent.appendChild(clone);
  1387. } else {
  1388. parent.appendChild(clone);
  1389. }
  1390. dest.appendChild(fragment);
  1391. } else {
  1392. dest.appendChild(clone);
  1393. }
  1394. } else {
  1395. dest.appendChild(clone);
  1396. }
  1397. if (clone.dataset && clone.dataset.ref) {
  1398. if (!dest.indexOfRefs) {
  1399. dest.indexOfRefs = {};
  1400. }
  1401. dest.indexOfRefs[clone.dataset.ref] = clone;
  1402. }
  1403. let nodeHooks = this.hooks.renderNode.triggerSync(clone, node, this);
  1404. nodeHooks.forEach((newNode) => {
  1405. if (typeof newNode != "undefined") {
  1406. clone = newNode;
  1407. }
  1408. });
  1409. return clone;
  1410. }
  1411. rebuildTableFromBreakToken(breakToken, dest) {
  1412. if (!breakToken || !breakToken.node) {
  1413. return;
  1414. }
  1415. let node = breakToken.node;
  1416. let td = isElement(node) ? node.closest("td") : node.parentElement.closest("td");
  1417. if (td) {
  1418. let rendered = findElement(td, dest, true);
  1419. if (!rendered) {
  1420. return;
  1421. }
  1422. while ((td = td.nextElementSibling)) {
  1423. this.append(td, dest, null, true);
  1424. }
  1425. }
  1426. }
  1427. async waitForImages(imgs) {
  1428. let results = Array.from(imgs).map(async (img) => {
  1429. return this.awaitImageLoaded(img);
  1430. });
  1431. await Promise.all(results);
  1432. }
  1433. async awaitImageLoaded(image) {
  1434. return new Promise(resolve => {
  1435. if (image.complete !== true) {
  1436. image.onload = function () {
  1437. let {width, height} = window.getComputedStyle(image);
  1438. resolve(width, height);
  1439. };
  1440. image.onerror = function (e) {
  1441. let {width, height} = window.getComputedStyle(image);
  1442. resolve(width, height, e);
  1443. };
  1444. } else {
  1445. let {width, height} = window.getComputedStyle(image);
  1446. resolve(width, height);
  1447. }
  1448. });
  1449. }
  1450. avoidBreakInside(node, limiter) {
  1451. let breakNode;
  1452. if (node === limiter) {
  1453. return;
  1454. }
  1455. while (node.parentNode) {
  1456. node = node.parentNode;
  1457. if (node === limiter) {
  1458. break;
  1459. }
  1460. if (window.getComputedStyle(node)["break-inside"] === "avoid") {
  1461. breakNode = node;
  1462. break;
  1463. }
  1464. }
  1465. return breakNode;
  1466. }
  1467. createBreakToken(overflow, rendered, source) {
  1468. let container = overflow.startContainer;
  1469. let offset = overflow.startOffset;
  1470. let node, renderedNode, parent, index, temp;
  1471. if (isElement(container)) {
  1472. temp = child(container, offset);
  1473. if (isElement(temp)) {
  1474. renderedNode = findElement(temp, rendered);
  1475. if (!renderedNode) {
  1476. // Find closest element with data-ref
  1477. let prevNode = prevValidNode(temp);
  1478. if (!isElement(prevNode)) {
  1479. prevNode = prevNode.parentElement;
  1480. }
  1481. renderedNode = findElement(prevNode, rendered);
  1482. // Check if temp is the last rendered node at its level.
  1483. if (!temp.nextSibling) {
  1484. // We need to ensure that the previous sibling of temp is fully rendered.
  1485. const renderedNodeFromSource = findElement(renderedNode, source);
  1486. const walker = document.createTreeWalker(renderedNodeFromSource, NodeFilter.SHOW_ELEMENT);
  1487. const lastChildOfRenderedNodeFromSource = walker.lastChild();
  1488. const lastChildOfRenderedNodeMatchingFromRendered = findElement(lastChildOfRenderedNodeFromSource, rendered);
  1489. // Check if we found that the last child in source
  1490. if (!lastChildOfRenderedNodeMatchingFromRendered) {
  1491. // Pending content to be rendered before virtual break token
  1492. return;
  1493. }
  1494. // Otherwise we will return a break token as per below
  1495. }
  1496. // renderedNode is actually the last unbroken box that does not overflow.
  1497. // Break Token is therefore the next sibling of renderedNode within source node.
  1498. node = findElement(renderedNode, source).nextSibling;
  1499. offset = 0;
  1500. } else {
  1501. node = findElement(renderedNode, source);
  1502. offset = 0;
  1503. }
  1504. } else {
  1505. renderedNode = findElement(container, rendered);
  1506. if (!renderedNode) {
  1507. renderedNode = findElement(prevValidNode(container), rendered);
  1508. }
  1509. parent = findElement(renderedNode, source);
  1510. index = indexOfTextNode(temp, parent);
  1511. // No seperatation for the first textNode of an element
  1512. if(index === 0) {
  1513. node = parent;
  1514. offset = 0;
  1515. } else {
  1516. node = child(parent, index);
  1517. offset = 0;
  1518. }
  1519. }
  1520. } else {
  1521. renderedNode = findElement(container.parentNode, rendered);
  1522. if (!renderedNode) {
  1523. renderedNode = findElement(prevValidNode(container.parentNode), rendered);
  1524. }
  1525. parent = findElement(renderedNode, source);
  1526. index = indexOfTextNode(container, parent);
  1527. if (index === -1) {
  1528. return;
  1529. }
  1530. node = child(parent, index);
  1531. offset += node.textContent.indexOf(container.textContent);
  1532. }
  1533. if (!node) {
  1534. return;
  1535. }
  1536. return new BreakToken(
  1537. node,
  1538. offset
  1539. );
  1540. }
  1541. findBreakToken(rendered, source, bounds = this.bounds, prevBreakToken, extract = true) {
  1542. let overflow = this.findOverflow(rendered, bounds);
  1543. let breakToken, breakLetter;
  1544. let overflowHooks = this.hooks.onOverflow.triggerSync(overflow, rendered, bounds, this);
  1545. overflowHooks.forEach((newOverflow) => {
  1546. if (typeof newOverflow != "undefined") {
  1547. overflow = newOverflow;
  1548. }
  1549. });
  1550. if (overflow) {
  1551. breakToken = this.createBreakToken(overflow, rendered, source);
  1552. // breakToken is nullable
  1553. let breakHooks = this.hooks.onBreakToken.triggerSync(breakToken, overflow, rendered, this);
  1554. breakHooks.forEach((newToken) => {
  1555. if (typeof newToken != "undefined") {
  1556. breakToken = newToken;
  1557. }
  1558. });
  1559. // Stop removal if we are in a loop
  1560. if (breakToken && breakToken.equals(prevBreakToken)) {
  1561. return breakToken;
  1562. }
  1563. if (breakToken && breakToken["node"] && breakToken["offset"] && breakToken["node"].textContent) {
  1564. breakLetter = breakToken["node"].textContent.charAt(breakToken["offset"]);
  1565. } else {
  1566. breakLetter = undefined;
  1567. }
  1568. if (breakToken && breakToken.node && extract) {
  1569. let removed = this.removeOverflow(overflow, breakLetter);
  1570. this.hooks && this.hooks.afterOverflowRemoved.trigger(removed, rendered, this);
  1571. }
  1572. }
  1573. return breakToken;
  1574. }
  1575. hasOverflow(element, bounds = this.bounds) {
  1576. let constrainingElement = element && element.parentNode; // this gets the element, instead of the wrapper for the width workaround
  1577. let {width, height} = element.getBoundingClientRect();
  1578. let scrollWidth = constrainingElement ? constrainingElement.scrollWidth : 0;
  1579. let scrollHeight = constrainingElement ? constrainingElement.scrollHeight : 0;
  1580. return Math.max(Math.floor(width), scrollWidth) > Math.round(bounds.width) ||
  1581. Math.max(Math.floor(height), scrollHeight) > Math.round(bounds.height);
  1582. }
  1583. findOverflow(rendered, bounds = this.bounds, gap = this.gap) {
  1584. if (!this.hasOverflow(rendered, bounds)) return;
  1585. let start = Math.floor(bounds.left);
  1586. let end = Math.round(bounds.right + gap);
  1587. let vStart = Math.round(bounds.top);
  1588. let vEnd = Math.round(bounds.bottom);
  1589. let range;
  1590. let walker = walk$2(rendered.firstChild, rendered);
  1591. // Find Start
  1592. let next, done, node, offset, skip, breakAvoid, prev, br;
  1593. while (!done) {
  1594. next = walker.next();
  1595. done = next.done;
  1596. node = next.value;
  1597. skip = false;
  1598. breakAvoid = false;
  1599. prev = undefined;
  1600. br = undefined;
  1601. if (node) {
  1602. let pos = getBoundingClientRect(node);
  1603. let left = Math.round(pos.left);
  1604. let right = Math.floor(pos.right);
  1605. let top = Math.round(pos.top);
  1606. let bottom = Math.floor(pos.bottom);
  1607. if (!range && (left >= end || top >= vEnd)) {
  1608. // Check if it is a float
  1609. let isFloat = false;
  1610. // Check if the node is inside a break-inside: avoid table cell
  1611. const insideTableCell = parentOf(node, "TD", rendered);
  1612. if (insideTableCell && window.getComputedStyle(insideTableCell)["break-inside"] === "avoid") {
  1613. // breaking inside a table cell produces unexpected result, as a workaround, we forcibly avoid break inside in a cell.
  1614. // But we take the whole row, not just the cell that is causing the break.
  1615. prev = insideTableCell.parentElement;
  1616. } else if (isElement(node)) {
  1617. let styles = window.getComputedStyle(node);
  1618. isFloat = styles.getPropertyValue("float") !== "none";
  1619. skip = styles.getPropertyValue("break-inside") === "avoid";
  1620. breakAvoid = node.dataset.breakBefore === "avoid" || node.dataset.previousBreakAfter === "avoid";
  1621. prev = breakAvoid && nodeBefore(node, rendered);
  1622. br = node.tagName === "BR" || node.tagName === "WBR";
  1623. }
  1624. let tableRow;
  1625. if (node.nodeName === "TR") {
  1626. tableRow = node;
  1627. } else {
  1628. tableRow = parentOf(node, "TR", rendered);
  1629. }
  1630. if (tableRow) {
  1631. // honor break-inside="avoid" in parent tbody/thead
  1632. let container = tableRow.parentElement;
  1633. if (["TBODY", "THEAD"].includes(container.nodeName)) {
  1634. let styles = window.getComputedStyle(container);
  1635. if (styles.getPropertyValue("break-inside") === "avoid") prev = container;
  1636. }
  1637. // Check if the node is inside a row with a rowspan
  1638. const table = parentOf(tableRow, "TABLE", rendered);
  1639. const rowspan = table.querySelector("[colspan]");
  1640. if (table && rowspan) {
  1641. let columnCount = 0;
  1642. for (const cell of Array.from(table.rows[0].cells)) {
  1643. columnCount += parseInt(cell.getAttribute("colspan") || "1");
  1644. }
  1645. if (tableRow.cells.length !== columnCount) {
  1646. let previousRow = tableRow.previousElementSibling;
  1647. let previousRowColumnCount;
  1648. while (previousRow !== null) {
  1649. previousRowColumnCount = 0;
  1650. for (const cell of Array.from(previousRow.cells)) {
  1651. previousRowColumnCount += parseInt(cell.getAttribute("colspan") || "1");
  1652. }
  1653. if (previousRowColumnCount === columnCount) {
  1654. break;
  1655. }
  1656. previousRow = previousRow.previousElementSibling;
  1657. }
  1658. if (previousRowColumnCount === columnCount) {
  1659. prev = previousRow;
  1660. }
  1661. }
  1662. }
  1663. }
  1664. if (prev) {
  1665. range = document.createRange();
  1666. range.selectNode(prev);
  1667. break;
  1668. }
  1669. if (!br && !isFloat && isElement(node)) {
  1670. range = document.createRange();
  1671. range.selectNode(node);
  1672. break;
  1673. }
  1674. if (isText(node) && node.textContent.trim().length) {
  1675. range = document.createRange();
  1676. range.selectNode(node);
  1677. break;
  1678. }
  1679. }
  1680. if (!range && isText(node) &&
  1681. node.textContent.trim().length &&
  1682. !breakInsideAvoidParentNode(node.parentNode)) {
  1683. let rects = getClientRects(node);
  1684. let rect;
  1685. left = 0;
  1686. top = 0;
  1687. for (var i = 0; i != rects.length; i++) {
  1688. rect = rects[i];
  1689. if (rect.width > 0 && (!left || rect.left > left)) {
  1690. left = rect.left;
  1691. }
  1692. if (rect.height > 0 && (!top || rect.top > top)) {
  1693. top = rect.top;
  1694. }
  1695. }
  1696. if (left >= end || top >= vEnd) {
  1697. range = document.createRange();
  1698. offset = this.textBreak(node, start, end, vStart, vEnd);
  1699. if (!offset) {
  1700. range = undefined;
  1701. } else {
  1702. range.setStart(node, offset);
  1703. }
  1704. break;
  1705. }
  1706. }
  1707. // Skip children
  1708. if (skip || (right <= end && bottom <= vEnd)) {
  1709. next = nodeAfter(node, rendered);
  1710. if (next) {
  1711. walker = walk$2(next, rendered);
  1712. }
  1713. }
  1714. }
  1715. }
  1716. // Find End
  1717. if (range) {
  1718. range.setEndAfter(rendered.lastChild);
  1719. return range;
  1720. }
  1721. }
  1722. findEndToken(rendered, source) {
  1723. if (rendered.childNodes.length === 0) {
  1724. return;
  1725. }
  1726. let lastChild = rendered.lastChild;
  1727. let lastNodeIndex;
  1728. while (lastChild && lastChild.lastChild) {
  1729. if (!validNode(lastChild)) {
  1730. // Only get elements with refs
  1731. lastChild = lastChild.previousSibling;
  1732. } else if (!validNode(lastChild.lastChild)) {
  1733. // Deal with invalid dom items
  1734. lastChild = prevValidNode(lastChild.lastChild);
  1735. break;
  1736. } else {
  1737. lastChild = lastChild.lastChild;
  1738. }
  1739. }
  1740. if (isText(lastChild)) {
  1741. if (lastChild.parentNode.dataset.ref) {
  1742. lastNodeIndex = indexOf$2(lastChild);
  1743. lastChild = lastChild.parentNode;
  1744. } else {
  1745. lastChild = lastChild.previousSibling;
  1746. }
  1747. }
  1748. let original = findElement(lastChild, source);
  1749. if (lastNodeIndex) {
  1750. original = original.childNodes[lastNodeIndex];
  1751. }
  1752. let after = nodeAfter(original);
  1753. return this.breakAt(after);
  1754. }
  1755. textBreak(node, start, end, vStart, vEnd) {
  1756. let wordwalker = words(node);
  1757. let left = 0;
  1758. let right = 0;
  1759. let top = 0;
  1760. let bottom = 0;
  1761. let word, next, done, pos;
  1762. let offset;
  1763. while (!done) {
  1764. next = wordwalker.next();
  1765. word = next.value;
  1766. done = next.done;
  1767. if (!word) {
  1768. break;
  1769. }
  1770. pos = getBoundingClientRect(word);
  1771. left = Math.floor(pos.left);
  1772. right = Math.floor(pos.right);
  1773. top = Math.floor(pos.top);
  1774. bottom = Math.floor(pos.bottom);
  1775. if (left >= end || top >= vEnd) {
  1776. offset = word.startOffset;
  1777. break;
  1778. }
  1779. if (right > end || bottom > vEnd) {
  1780. let letterwalker = letters(word);
  1781. let letter, nextLetter, doneLetter;
  1782. while (!doneLetter) {
  1783. nextLetter = letterwalker.next();
  1784. letter = nextLetter.value;
  1785. doneLetter = nextLetter.done;
  1786. if (!letter) {
  1787. break;
  1788. }
  1789. pos = getBoundingClientRect(letter);
  1790. left = Math.floor(pos.left);
  1791. top = Math.floor(pos.top);
  1792. if (left >= end || top >= vEnd) {
  1793. offset = letter.startOffset;
  1794. done = true;
  1795. break;
  1796. }
  1797. }
  1798. }
  1799. }
  1800. return offset;
  1801. }
  1802. removeOverflow(overflow, breakLetter) {
  1803. let {startContainer} = overflow;
  1804. let extracted = overflow.extractContents();
  1805. this.hyphenateAtBreak(startContainer, breakLetter);
  1806. return extracted;
  1807. }
  1808. hyphenateAtBreak(startContainer, breakLetter) {
  1809. if (isText(startContainer)) {
  1810. let startText = startContainer.textContent;
  1811. let prevLetter = startText[startText.length - 1];
  1812. // Add a hyphen if previous character is a letter or soft hyphen
  1813. if (
  1814. (breakLetter && /^\w|\u00AD$/.test(prevLetter) && /^\w|\u00AD$/.test(breakLetter)) ||
  1815. (!breakLetter && /^\w|\u00AD$/.test(prevLetter))
  1816. ) {
  1817. startContainer.parentNode.classList.add("pagedjs_hyphen");
  1818. startContainer.textContent += this.settings.hyphenGlyph || "\u2011";
  1819. }
  1820. }
  1821. }
  1822. equalTokens(a, b) {
  1823. if (!a || !b) {
  1824. return false;
  1825. }
  1826. if (a["node"] && b["node"] && a["node"] !== b["node"]) {
  1827. return false;
  1828. }
  1829. if (a["offset"] && b["offset"] && a["offset"] !== b["offset"]) {
  1830. return false;
  1831. }
  1832. return true;
  1833. }
  1834. }
  1835. EventEmitter(Layout.prototype);
  1836. /**
  1837. * Render a page
  1838. * @class
  1839. */
  1840. class Page {
  1841. constructor(pagesArea, pageTemplate, blank, hooks, options) {
  1842. this.pagesArea = pagesArea;
  1843. this.pageTemplate = pageTemplate;
  1844. this.blank = blank;
  1845. this.width = undefined;
  1846. this.height = undefined;
  1847. this.hooks = hooks;
  1848. this.settings = options || {};
  1849. // this.element = this.create(this.pageTemplate);
  1850. }
  1851. create(template, after) {
  1852. //let documentFragment = document.createRange().createContextualFragment( TEMPLATE );
  1853. //let page = documentFragment.children[0];
  1854. let clone = document.importNode(this.pageTemplate.content, true);
  1855. let page, index;
  1856. if (after) {
  1857. this.pagesArea.insertBefore(clone, after.nextElementSibling);
  1858. index = Array.prototype.indexOf.call(this.pagesArea.children, after.nextElementSibling);
  1859. page = this.pagesArea.children[index];
  1860. } else {
  1861. this.pagesArea.appendChild(clone);
  1862. page = this.pagesArea.lastChild;
  1863. }
  1864. let pagebox = page.querySelector(".pagedjs_pagebox");
  1865. let area = page.querySelector(".pagedjs_page_content");
  1866. let footnotesArea = page.querySelector(".pagedjs_footnote_area");
  1867. let size = area.getBoundingClientRect();
  1868. area.style.columnWidth = Math.round(size.width) + "px";
  1869. 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))";
  1870. // area.style.overflow = "scroll";
  1871. this.width = Math.round(size.width);
  1872. this.height = Math.round(size.height);
  1873. this.element = page;
  1874. this.pagebox = pagebox;
  1875. this.area = area;
  1876. this.footnotesArea = footnotesArea;
  1877. return page;
  1878. }
  1879. createWrapper() {
  1880. let wrapper = document.createElement("div");
  1881. this.area.appendChild(wrapper);
  1882. this.wrapper = wrapper;
  1883. return wrapper;
  1884. }
  1885. index(pgnum) {
  1886. this.position = pgnum;
  1887. let page = this.element;
  1888. // let pagebox = this.pagebox;
  1889. let index = pgnum + 1;
  1890. let id = `page-${index}`;
  1891. this.id = id;
  1892. // page.dataset.pageNumber = index;
  1893. page.dataset.pageNumber = index;
  1894. page.setAttribute("id", id);
  1895. if (this.name) {
  1896. page.classList.add("pagedjs_" + this.name + "_page");
  1897. }
  1898. if (this.blank) {
  1899. page.classList.add("pagedjs_blank_page");
  1900. }
  1901. if (pgnum === 0) {
  1902. page.classList.add("pagedjs_first_page");
  1903. }
  1904. if (pgnum % 2 !== 1) {
  1905. page.classList.remove("pagedjs_left_page");
  1906. page.classList.add("pagedjs_right_page");
  1907. } else {
  1908. page.classList.remove("pagedjs_right_page");
  1909. page.classList.add("pagedjs_left_page");
  1910. }
  1911. }
  1912. /*
  1913. size(width, height) {
  1914. if (width === this.width && height === this.height) {
  1915. return;
  1916. }
  1917. this.width = width;
  1918. this.height = height;
  1919. this.element.style.width = Math.round(width) + "px";
  1920. this.element.style.height = Math.round(height) + "px";
  1921. this.element.style.columnWidth = Math.round(width) + "px";
  1922. }
  1923. */
  1924. async layout(contents, breakToken, maxChars) {
  1925. this.clear();
  1926. this.startToken = breakToken;
  1927. let settings = this.settings;
  1928. if (!settings.maxChars && maxChars) {
  1929. settings.maxChars = maxChars;
  1930. }
  1931. this.layoutMethod = new Layout(this.area, this.hooks, settings);
  1932. let renderResult = await this.layoutMethod.renderTo(this.wrapper, contents, breakToken);
  1933. let newBreakToken = renderResult.breakToken;
  1934. this.addListeners(contents);
  1935. this.endToken = newBreakToken;
  1936. return newBreakToken;
  1937. }
  1938. async append(contents, breakToken) {
  1939. if (!this.layoutMethod) {
  1940. return this.layout(contents, breakToken);
  1941. }
  1942. let renderResult = await this.layoutMethod.renderTo(this.wrapper, contents, breakToken);
  1943. let newBreakToken = renderResult.breakToken;
  1944. this.endToken = newBreakToken;
  1945. return newBreakToken;
  1946. }
  1947. getByParent(ref, entries) {
  1948. let e;
  1949. for (var i = 0; i < entries.length; i++) {
  1950. e = entries[i];
  1951. if (e.dataset.ref === ref) {
  1952. return e;
  1953. }
  1954. }
  1955. }
  1956. onOverflow(func) {
  1957. this._onOverflow = func;
  1958. }
  1959. onUnderflow(func) {
  1960. this._onUnderflow = func;
  1961. }
  1962. clear() {
  1963. this.removeListeners();
  1964. this.wrapper && this.wrapper.remove();
  1965. this.createWrapper();
  1966. }
  1967. addListeners(contents) {
  1968. if (typeof ResizeObserver !== "undefined") {
  1969. this.addResizeObserver(contents);
  1970. } else {
  1971. this._checkOverflowAfterResize = this.checkOverflowAfterResize.bind(this, contents);
  1972. this.element.addEventListener("overflow", this._checkOverflowAfterResize, false);
  1973. this.element.addEventListener("underflow", this._checkOverflowAfterResize, false);
  1974. }
  1975. // TODO: fall back to mutation observer?
  1976. this._onScroll = function () {
  1977. if (this.listening) {
  1978. this.element.scrollLeft = 0;
  1979. }
  1980. }.bind(this);
  1981. // Keep scroll left from changing
  1982. this.element.addEventListener("scroll", this._onScroll);
  1983. this.listening = true;
  1984. return true;
  1985. }
  1986. removeListeners() {
  1987. this.listening = false;
  1988. if (typeof ResizeObserver !== "undefined" && this.ro) {
  1989. this.ro.disconnect();
  1990. } else if (this.element) {
  1991. this.element.removeEventListener("overflow", this._checkOverflowAfterResize, false);
  1992. this.element.removeEventListener("underflow", this._checkOverflowAfterResize, false);
  1993. }
  1994. this.element && this.element.removeEventListener("scroll", this._onScroll);
  1995. }
  1996. addResizeObserver(contents) {
  1997. let wrapper = this.wrapper;
  1998. let prevHeight = wrapper.getBoundingClientRect().height;
  1999. this.ro = new ResizeObserver(entries => {
  2000. if (!this.listening) {
  2001. return;
  2002. }
  2003. requestAnimationFrame(() => {
  2004. for (let entry of entries) {
  2005. const cr = entry.contentRect;
  2006. if (cr.height > prevHeight) {
  2007. this.checkOverflowAfterResize(contents);
  2008. prevHeight = wrapper.getBoundingClientRect().height;
  2009. } else if (cr.height < prevHeight) { // TODO: calc line height && (prevHeight - cr.height) >= 22
  2010. this.checkUnderflowAfterResize(contents);
  2011. prevHeight = cr.height;
  2012. }
  2013. }
  2014. });
  2015. });
  2016. this.ro.observe(wrapper);
  2017. }
  2018. checkOverflowAfterResize(contents) {
  2019. if (!this.listening || !this.layoutMethod) {
  2020. return;
  2021. }
  2022. let newBreakToken = this.layoutMethod.findBreakToken(this.wrapper, contents, this.startToken);
  2023. if (newBreakToken) {
  2024. this.endToken = newBreakToken;
  2025. this._onOverflow && this._onOverflow(newBreakToken);
  2026. }
  2027. }
  2028. checkUnderflowAfterResize(contents) {
  2029. if (!this.listening || !this.layoutMethod) {
  2030. return;
  2031. }
  2032. let endToken = this.layoutMethod.findEndToken(this.wrapper, contents);
  2033. if (endToken) {
  2034. this._onUnderflow && this._onUnderflow(endToken);
  2035. }
  2036. }
  2037. destroy() {
  2038. this.removeListeners();
  2039. this.element.remove();
  2040. this.element = undefined;
  2041. this.wrapper = undefined;
  2042. }
  2043. }
  2044. EventEmitter(Page.prototype);
  2045. /**
  2046. * Render a flow of text offscreen
  2047. * @class
  2048. */
  2049. class ContentParser {
  2050. constructor(content, cb) {
  2051. if (content && content.nodeType) {
  2052. // handle dom
  2053. this.dom = this.add(content);
  2054. } else if (typeof content === "string") {
  2055. this.dom = this.parse(content);
  2056. }
  2057. return this.dom;
  2058. }
  2059. parse(markup, mime) {
  2060. let range = document.createRange();
  2061. let fragment = range.createContextualFragment(markup);
  2062. this.addRefs(fragment);
  2063. return fragment;
  2064. }
  2065. add(contents) {
  2066. // let fragment = document.createDocumentFragment();
  2067. //
  2068. // let children = [...contents.childNodes];
  2069. // for (let child of children) {
  2070. // let clone = child.cloneNode(true);
  2071. // fragment.appendChild(clone);
  2072. // }
  2073. this.addRefs(contents);
  2074. return contents;
  2075. }
  2076. addRefs(content) {
  2077. var treeWalker = document.createTreeWalker(
  2078. content,
  2079. NodeFilter.SHOW_ELEMENT,
  2080. null,
  2081. false
  2082. );
  2083. let node = treeWalker.nextNode();
  2084. while(node) {
  2085. if (!node.hasAttribute("data-ref")) {
  2086. let uuid = UUID();
  2087. node.setAttribute("data-ref", uuid);
  2088. }
  2089. if (node.id) {
  2090. node.setAttribute("data-id", node.id);
  2091. }
  2092. // node.setAttribute("data-children", node.childNodes.length);
  2093. // node.setAttribute("data-text", node.textContent.trim().length);
  2094. node = treeWalker.nextNode();
  2095. }
  2096. }
  2097. find(ref) {
  2098. return this.refs[ref];
  2099. }
  2100. destroy() {
  2101. this.refs = undefined;
  2102. this.dom = undefined;
  2103. }
  2104. }
  2105. /**
  2106. * Queue for handling tasks one at a time
  2107. * @class
  2108. * @param {scope} context what this will resolve to in the tasks
  2109. */
  2110. class Queue {
  2111. constructor(context){
  2112. this._q = [];
  2113. this.context = context;
  2114. this.tick = requestAnimationFrame;
  2115. this.running = false;
  2116. this.paused = false;
  2117. }
  2118. /**
  2119. * Add an item to the queue
  2120. * @return {Promise} enqueued
  2121. */
  2122. enqueue() {
  2123. var deferred, promise;
  2124. var queued;
  2125. var task = [].shift.call(arguments);
  2126. var args = arguments;
  2127. // Handle single args without context
  2128. // if(args && !Array.isArray(args)) {
  2129. // args = [args];
  2130. // }
  2131. if(!task) {
  2132. throw new Error("No Task Provided");
  2133. }
  2134. if(typeof task === "function"){
  2135. deferred = new defer();
  2136. promise = deferred.promise;
  2137. queued = {
  2138. "task" : task,
  2139. "args" : args,
  2140. //"context" : context,
  2141. "deferred" : deferred,
  2142. "promise" : promise
  2143. };
  2144. } else {
  2145. // Task is a promise
  2146. queued = {
  2147. "promise" : task
  2148. };
  2149. }
  2150. this._q.push(queued);
  2151. // Wait to start queue flush
  2152. if (this.paused == false && !this.running) {
  2153. this.run();
  2154. }
  2155. return queued.promise;
  2156. }
  2157. /**
  2158. * Run one item
  2159. * @return {Promise} dequeued
  2160. */
  2161. dequeue(){
  2162. var inwait, task, result;
  2163. if(this._q.length && !this.paused) {
  2164. inwait = this._q.shift();
  2165. task = inwait.task;
  2166. if(task){
  2167. // console.log(task)
  2168. result = task.apply(this.context, inwait.args);
  2169. if(result && typeof result["then"] === "function") {
  2170. // Task is a function that returns a promise
  2171. return result.then(function(){
  2172. inwait.deferred.resolve.apply(this.context, arguments);
  2173. }.bind(this), function() {
  2174. inwait.deferred.reject.apply(this.context, arguments);
  2175. }.bind(this));
  2176. } else {
  2177. // Task resolves immediately
  2178. inwait.deferred.resolve.apply(this.context, result);
  2179. return inwait.promise;
  2180. }
  2181. } else if(inwait.promise) {
  2182. // Task is a promise
  2183. return inwait.promise;
  2184. }
  2185. } else {
  2186. inwait = new defer();
  2187. inwait.deferred.resolve();
  2188. return inwait.promise;
  2189. }
  2190. }
  2191. // Run All Immediately
  2192. dump(){
  2193. while(this._q.length) {
  2194. this.dequeue();
  2195. }
  2196. }
  2197. /**
  2198. * Run all tasks sequentially, at convince
  2199. * @return {Promise} all run
  2200. */
  2201. run(){
  2202. if(!this.running){
  2203. this.running = true;
  2204. this.defered = new defer();
  2205. }
  2206. this.tick.call(window, () => {
  2207. if(this._q.length) {
  2208. this.dequeue()
  2209. .then(function(){
  2210. this.run();
  2211. }.bind(this));
  2212. } else {
  2213. this.defered.resolve();
  2214. this.running = undefined;
  2215. }
  2216. });
  2217. // Unpause
  2218. if(this.paused == true) {
  2219. this.paused = false;
  2220. }
  2221. return this.defered.promise;
  2222. }
  2223. /**
  2224. * Flush all, as quickly as possible
  2225. * @return {Promise} ran
  2226. */
  2227. flush(){
  2228. if(this.running){
  2229. return this.running;
  2230. }
  2231. if(this._q.length) {
  2232. this.running = this.dequeue()
  2233. .then(function(){
  2234. this.running = undefined;
  2235. return this.flush();
  2236. }.bind(this));
  2237. return this.running;
  2238. }
  2239. }
  2240. /**
  2241. * Clear all items in wait
  2242. * @return {void}
  2243. */
  2244. clear(){
  2245. this._q = [];
  2246. }
  2247. /**
  2248. * Get the number of tasks in the queue
  2249. * @return {number} tasks
  2250. */
  2251. length(){
  2252. return this._q.length;
  2253. }
  2254. /**
  2255. * Pause a running queue
  2256. * @return {void}
  2257. */
  2258. pause(){
  2259. this.paused = true;
  2260. }
  2261. /**
  2262. * End the queue
  2263. * @return {void}
  2264. */
  2265. stop(){
  2266. this._q = [];
  2267. this.running = false;
  2268. this.paused = true;
  2269. }
  2270. }
  2271. const TEMPLATE = `
  2272. <div class="pagedjs_page">
  2273. <div class="pagedjs_sheet">
  2274. <div class="pagedjs_bleed pagedjs_bleed-top">
  2275. <div class="pagedjs_marks-crop"></div>
  2276. <div class="pagedjs_marks-middle">
  2277. <div class="pagedjs_marks-cross"></div>
  2278. </div>
  2279. <div class="pagedjs_marks-crop"></div>
  2280. </div>
  2281. <div class="pagedjs_bleed pagedjs_bleed-bottom">
  2282. <div class="pagedjs_marks-crop"></div>
  2283. <div class="pagedjs_marks-middle">
  2284. <div class="pagedjs_marks-cross"></div>
  2285. </div> <div class="pagedjs_marks-crop"></div>
  2286. </div>
  2287. <div class="pagedjs_bleed pagedjs_bleed-left">
  2288. <div class="pagedjs_marks-crop"></div>
  2289. <div class="pagedjs_marks-middle">
  2290. <div class="pagedjs_marks-cross"></div>
  2291. </div> <div class="pagedjs_marks-crop"></div>
  2292. </div>
  2293. <div class="pagedjs_bleed pagedjs_bleed-right">
  2294. <div class="pagedjs_marks-crop"></div>
  2295. <div class="pagedjs_marks-middle">
  2296. <div class="pagedjs_marks-cross"></div>
  2297. </div>
  2298. <div class="pagedjs_marks-crop"></div>
  2299. </div>
  2300. <div class="pagedjs_pagebox">
  2301. <div class="pagedjs_margin-top-left-corner-holder">
  2302. <div class="pagedjs_margin pagedjs_margin-top-left-corner"><div class="pagedjs_margin-content"></div></div>
  2303. </div>
  2304. <div class="pagedjs_margin-top">
  2305. <div class="pagedjs_margin pagedjs_margin-top-left"><div class="pagedjs_margin-content"></div></div>
  2306. <div class="pagedjs_margin pagedjs_margin-top-center"><div class="pagedjs_margin-content"></div></div>
  2307. <div class="pagedjs_margin pagedjs_margin-top-right"><div class="pagedjs_margin-content"></div></div>
  2308. </div>
  2309. <div class="pagedjs_margin-top-right-corner-holder">
  2310. <div class="pagedjs_margin pagedjs_margin-top-right-corner"><div class="pagedjs_margin-content"></div></div>
  2311. </div>
  2312. <div class="pagedjs_margin-right">
  2313. <div class="pagedjs_margin pagedjs_margin-right-top"><div class="pagedjs_margin-content"></div></div>
  2314. <div class="pagedjs_margin pagedjs_margin-right-middle"><div class="pagedjs_margin-content"></div></div>
  2315. <div class="pagedjs_margin pagedjs_margin-right-bottom"><div class="pagedjs_margin-content"></div></div>
  2316. </div>
  2317. <div class="pagedjs_margin-left">
  2318. <div class="pagedjs_margin pagedjs_margin-left-top"><div class="pagedjs_margin-content"></div></div>
  2319. <div class="pagedjs_margin pagedjs_margin-left-middle"><div class="pagedjs_margin-content"></div></div>
  2320. <div class="pagedjs_margin pagedjs_margin-left-bottom"><div class="pagedjs_margin-content"></div></div>
  2321. </div>
  2322. <div class="pagedjs_margin-bottom-left-corner-holder">
  2323. <div class="pagedjs_margin pagedjs_margin-bottom-left-corner"><div class="pagedjs_margin-content"></div></div>
  2324. </div>
  2325. <div class="pagedjs_margin-bottom">
  2326. <div class="pagedjs_margin pagedjs_margin-bottom-left"><div class="pagedjs_margin-content"></div></div>
  2327. <div class="pagedjs_margin pagedjs_margin-bottom-center"><div class="pagedjs_margin-content"></div></div>
  2328. <div class="pagedjs_margin pagedjs_margin-bottom-right"><div class="pagedjs_margin-content"></div></div>
  2329. </div>
  2330. <div class="pagedjs_margin-bottom-right-corner-holder">
  2331. <div class="pagedjs_margin pagedjs_margin-bottom-right-corner"><div class="pagedjs_margin-content"></div></div>
  2332. </div>
  2333. <div class="pagedjs_area">
  2334. <div class="pagedjs_page_content"></div>
  2335. <div class="pagedjs_footnote_area">
  2336. <div class="pagedjs_footnote_content pagedjs_footnote_empty">
  2337. <div class="pagedjs_footnote_inner_content"></div>
  2338. </div>
  2339. </div>
  2340. </div>
  2341. </div>
  2342. </div>
  2343. </div>`;
  2344. /**
  2345. * Chop up text into flows
  2346. * @class
  2347. */
  2348. class Chunker {
  2349. constructor(content, renderTo, options) {
  2350. // this.preview = preview;
  2351. this.settings = options || {};
  2352. this.hooks = {};
  2353. this.hooks.beforeParsed = new Hook(this);
  2354. this.hooks.filter = new Hook(this);
  2355. this.hooks.afterParsed = new Hook(this);
  2356. this.hooks.beforePageLayout = new Hook(this);
  2357. this.hooks.layout = new Hook(this);
  2358. this.hooks.renderNode = new Hook(this);
  2359. this.hooks.layoutNode = new Hook(this);
  2360. this.hooks.onOverflow = new Hook(this);
  2361. this.hooks.afterOverflowRemoved = new Hook(this);
  2362. this.hooks.onBreakToken = new Hook();
  2363. this.hooks.afterPageLayout = new Hook(this);
  2364. this.hooks.finalizePage = new Hook(this);
  2365. this.hooks.afterRendered = new Hook(this);
  2366. this.pages = [];
  2367. this.total = 0;
  2368. this.q = new Queue(this);
  2369. this.stopped = false;
  2370. this.rendered = false;
  2371. this.content = content;
  2372. this.charsPerBreak = [];
  2373. this.maxChars;
  2374. if (content) {
  2375. this.flow(content, renderTo);
  2376. }
  2377. }
  2378. setup(renderTo) {
  2379. this.pagesArea = document.createElement("div");
  2380. this.pagesArea.classList.add("pagedjs_pages");
  2381. if (renderTo) {
  2382. renderTo.appendChild(this.pagesArea);
  2383. } else {
  2384. document.querySelector("body").appendChild(this.pagesArea);
  2385. }
  2386. this.pageTemplate = document.createElement("template");
  2387. this.pageTemplate.innerHTML = TEMPLATE;
  2388. }
  2389. async flow(content, renderTo) {
  2390. let parsed;
  2391. await this.hooks.beforeParsed.trigger(content, this);
  2392. parsed = new ContentParser(content);
  2393. this.hooks.filter.triggerSync(parsed);
  2394. this.source = parsed;
  2395. this.breakToken = undefined;
  2396. if (this.pagesArea && this.pageTemplate) {
  2397. this.q.clear();
  2398. this.removePages();
  2399. } else {
  2400. this.setup(renderTo);
  2401. }
  2402. this.emit("rendering", parsed);
  2403. await this.hooks.afterParsed.trigger(parsed, this);
  2404. await this.loadFonts();
  2405. let rendered = await this.render(parsed, this.breakToken);
  2406. while (rendered.canceled) {
  2407. this.start();
  2408. rendered = await this.render(parsed, this.breakToken);
  2409. }
  2410. this.rendered = true;
  2411. this.pagesArea.style.setProperty("--pagedjs-page-count", this.total);
  2412. await this.hooks.afterRendered.trigger(this.pages, this);
  2413. this.emit("rendered", this.pages);
  2414. return this;
  2415. }
  2416. // oversetPages() {
  2417. // let overset = [];
  2418. // for (let i = 0; i < this.pages.length; i++) {
  2419. // let page = this.pages[i];
  2420. // if (page.overset) {
  2421. // overset.push(page);
  2422. // // page.overset = false;
  2423. // }
  2424. // }
  2425. // return overset;
  2426. // }
  2427. //
  2428. // async handleOverset(parsed) {
  2429. // let overset = this.oversetPages();
  2430. // if (overset.length) {
  2431. // console.log("overset", overset);
  2432. // let index = this.pages.indexOf(overset[0]) + 1;
  2433. // console.log("INDEX", index);
  2434. //
  2435. // // Remove pages
  2436. // // this.removePages(index);
  2437. //
  2438. // // await this.render(parsed, overset[0].overset);
  2439. //
  2440. // // return this.handleOverset(parsed);
  2441. // }
  2442. // }
  2443. async render(parsed, startAt) {
  2444. let renderer = this.layout(parsed, startAt);
  2445. let done = false;
  2446. let result;
  2447. while (!done) {
  2448. result = await this.q.enqueue(() => { return this.renderAsync(renderer); });
  2449. done = result.done;
  2450. }
  2451. return result;
  2452. }
  2453. start() {
  2454. this.rendered = false;
  2455. this.stopped = false;
  2456. }
  2457. stop() {
  2458. this.stopped = true;
  2459. // this.q.clear();
  2460. }
  2461. renderOnIdle(renderer) {
  2462. return new Promise(resolve => {
  2463. requestIdleCallback(async () => {
  2464. if (this.stopped) {
  2465. return resolve({ done: true, canceled: true });
  2466. }
  2467. let result = await renderer.next();
  2468. if (this.stopped) {
  2469. resolve({ done: true, canceled: true });
  2470. } else {
  2471. resolve(result);
  2472. }
  2473. });
  2474. });
  2475. }
  2476. async renderAsync(renderer) {
  2477. if (this.stopped) {
  2478. return { done: true, canceled: true };
  2479. }
  2480. let result = await renderer.next();
  2481. if (this.stopped) {
  2482. return { done: true, canceled: true };
  2483. } else {
  2484. return result;
  2485. }
  2486. }
  2487. async handleBreaks(node, force) {
  2488. let currentPage = this.total + 1;
  2489. let currentPosition = currentPage % 2 === 0 ? "left" : "right";
  2490. // TODO: Recto and Verso should reverse for rtl languages
  2491. let currentSide = currentPage % 2 === 0 ? "verso" : "recto";
  2492. let previousBreakAfter;
  2493. let breakBefore;
  2494. let page;
  2495. if (currentPage === 1) {
  2496. return;
  2497. }
  2498. if (node &&
  2499. typeof node.dataset !== "undefined" &&
  2500. typeof node.dataset.previousBreakAfter !== "undefined") {
  2501. previousBreakAfter = node.dataset.previousBreakAfter;
  2502. }
  2503. if (node &&
  2504. typeof node.dataset !== "undefined" &&
  2505. typeof node.dataset.breakBefore !== "undefined") {
  2506. breakBefore = node.dataset.breakBefore;
  2507. }
  2508. if (force) {
  2509. page = this.addPage(true);
  2510. } else if( previousBreakAfter &&
  2511. (previousBreakAfter === "left" || previousBreakAfter === "right") &&
  2512. previousBreakAfter !== currentPosition) {
  2513. page = this.addPage(true);
  2514. } else if( previousBreakAfter &&
  2515. (previousBreakAfter === "verso" || previousBreakAfter === "recto") &&
  2516. previousBreakAfter !== currentSide) {
  2517. page = this.addPage(true);
  2518. } else if( breakBefore &&
  2519. (breakBefore === "left" || breakBefore === "right") &&
  2520. breakBefore !== currentPosition) {
  2521. page = this.addPage(true);
  2522. } else if( breakBefore &&
  2523. (breakBefore === "verso" || breakBefore === "recto") &&
  2524. breakBefore !== currentSide) {
  2525. page = this.addPage(true);
  2526. }
  2527. if (page) {
  2528. await this.hooks.beforePageLayout.trigger(page, undefined, undefined, this);
  2529. this.emit("page", page);
  2530. // await this.hooks.layout.trigger(page.element, page, undefined, this);
  2531. await this.hooks.afterPageLayout.trigger(page.element, page, undefined, this);
  2532. await this.hooks.finalizePage.trigger(page.element, page, undefined, this);
  2533. this.emit("renderedPage", page);
  2534. }
  2535. }
  2536. async *layout(content, startAt) {
  2537. let breakToken = startAt || false;
  2538. let tokens = [];
  2539. while (breakToken !== undefined && (true)) {
  2540. if (breakToken && breakToken.node) {
  2541. await this.handleBreaks(breakToken.node);
  2542. } else {
  2543. await this.handleBreaks(content.firstChild);
  2544. }
  2545. let page = this.addPage();
  2546. await this.hooks.beforePageLayout.trigger(page, content, breakToken, this);
  2547. this.emit("page", page);
  2548. // Layout content in the page, starting from the breakToken
  2549. breakToken = await page.layout(content, breakToken, this.maxChars);
  2550. if (breakToken) {
  2551. let newToken = breakToken.toJSON(true);
  2552. if (tokens.lastIndexOf(newToken) > -1) {
  2553. // loop
  2554. let err = new OverflowContentError("Layout repeated", [breakToken.node]);
  2555. console.error("Layout repeated at: ", breakToken.node);
  2556. return err;
  2557. } else {
  2558. tokens.push(newToken);
  2559. }
  2560. }
  2561. await this.hooks.afterPageLayout.trigger(page.element, page, breakToken, this);
  2562. await this.hooks.finalizePage.trigger(page.element, page, undefined, this);
  2563. this.emit("renderedPage", page);
  2564. this.recoredCharLength(page.wrapper.textContent.length);
  2565. yield breakToken;
  2566. // Stop if we get undefined, showing we have reached the end of the content
  2567. }
  2568. }
  2569. recoredCharLength(length) {
  2570. if (length === 0) {
  2571. return;
  2572. }
  2573. this.charsPerBreak.push(length);
  2574. // Keep the length of the last few breaks
  2575. if (this.charsPerBreak.length > 4) {
  2576. this.charsPerBreak.shift();
  2577. }
  2578. this.maxChars = this.charsPerBreak.reduce((a, b) => a + b, 0) / (this.charsPerBreak.length);
  2579. }
  2580. removePages(fromIndex=0) {
  2581. if (fromIndex >= this.pages.length) {
  2582. return;
  2583. }
  2584. // Remove pages
  2585. for (let i = fromIndex; i < this.pages.length; i++) {
  2586. this.pages[i].destroy();
  2587. }
  2588. if (fromIndex > 0) {
  2589. this.pages.splice(fromIndex);
  2590. } else {
  2591. this.pages = [];
  2592. }
  2593. this.total = this.pages.length;
  2594. }
  2595. addPage(blank) {
  2596. let lastPage = this.pages[this.pages.length - 1];
  2597. // Create a new page from the template
  2598. let page = new Page(this.pagesArea, this.pageTemplate, blank, this.hooks, this.settings);
  2599. this.pages.push(page);
  2600. // Create the pages
  2601. page.create(undefined, lastPage && lastPage.element);
  2602. page.index(this.total);
  2603. if (!blank) {
  2604. // Listen for page overflow
  2605. page.onOverflow((overflowToken) => {
  2606. console.warn("overflow on", page.id, overflowToken);
  2607. // Only reflow while rendering
  2608. if (this.rendered) {
  2609. return;
  2610. }
  2611. let index = this.pages.indexOf(page) + 1;
  2612. // Stop the rendering
  2613. this.stop();
  2614. // Set the breakToken to resume at
  2615. this.breakToken = overflowToken;
  2616. // Remove pages
  2617. this.removePages(index);
  2618. if (this.rendered === true) {
  2619. this.rendered = false;
  2620. this.q.enqueue(async () => {
  2621. this.start();
  2622. await this.render(this.source, this.breakToken);
  2623. this.rendered = true;
  2624. });
  2625. }
  2626. });
  2627. page.onUnderflow((overflowToken) => {
  2628. // console.log("underflow on", page.id, overflowToken);
  2629. // page.append(this.source, overflowToken);
  2630. });
  2631. }
  2632. this.total = this.pages.length;
  2633. return page;
  2634. }
  2635. /*
  2636. insertPage(index, blank) {
  2637. let lastPage = this.pages[index];
  2638. // Create a new page from the template
  2639. let page = new Page(this.pagesArea, this.pageTemplate, blank, this.hooks);
  2640. let total = this.pages.splice(index, 0, page);
  2641. // Create the pages
  2642. page.create(undefined, lastPage && lastPage.element);
  2643. page.index(index + 1);
  2644. for (let i = index + 2; i < this.pages.length; i++) {
  2645. this.pages[i].index(i);
  2646. }
  2647. if (!blank) {
  2648. // Listen for page overflow
  2649. page.onOverflow((overflowToken) => {
  2650. if (total < this.pages.length) {
  2651. this.pages[total].layout(this.source, overflowToken);
  2652. } else {
  2653. let newPage = this.addPage();
  2654. newPage.layout(this.source, overflowToken);
  2655. }
  2656. });
  2657. page.onUnderflow(() => {
  2658. // console.log("underflow on", page.id);
  2659. });
  2660. }
  2661. this.total += 1;
  2662. return page;
  2663. }
  2664. */
  2665. async clonePage(originalPage) {
  2666. let lastPage = this.pages[this.pages.length - 1];
  2667. let page = new Page(this.pagesArea, this.pageTemplate, false, this.hooks);
  2668. this.pages.push(page);
  2669. // Create the pages
  2670. page.create(undefined, lastPage && lastPage.element);
  2671. page.index(this.total);
  2672. await this.hooks.beforePageLayout.trigger(page, undefined, undefined, this);
  2673. this.emit("page", page);
  2674. for (const className of originalPage.element.classList) {
  2675. if (className !== "pagedjs_left_page" && className !== "pagedjs_right_page") {
  2676. page.element.classList.add(className);
  2677. }
  2678. }
  2679. await this.hooks.afterPageLayout.trigger(page.element, page, undefined, this);
  2680. await this.hooks.finalizePage.trigger(page.element, page, undefined, this);
  2681. this.emit("renderedPage", page);
  2682. }
  2683. loadFonts() {
  2684. let fontPromises = [];
  2685. (document.fonts || []).forEach((fontFace) => {
  2686. if (fontFace.status !== "loaded") {
  2687. let fontLoaded = fontFace.load().then((r) => {
  2688. return fontFace.family;
  2689. }, (r) => {
  2690. console.warn("Failed to preload font-family:", fontFace.family);
  2691. return fontFace.family;
  2692. });
  2693. fontPromises.push(fontLoaded);
  2694. }
  2695. });
  2696. return Promise.all(fontPromises).catch((err) => {
  2697. console.warn(err);
  2698. });
  2699. }
  2700. destroy() {
  2701. this.pagesArea.remove();
  2702. this.pageTemplate.remove();
  2703. }
  2704. }
  2705. EventEmitter(Chunker.prototype);
  2706. var syntax = {exports: {}};
  2707. var create$4 = {};
  2708. //
  2709. // list
  2710. // ┌──────┐
  2711. // ┌──────────────┼─head │
  2712. // │ │ tail─┼──────────────┐
  2713. // │ └──────┘ │
  2714. // ▼ ▼
  2715. // item item item item
  2716. // ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐
  2717. // null ◀──┼─prev │◀───┼─prev │◀───┼─prev │◀───┼─prev │
  2718. // │ next─┼───▶│ next─┼───▶│ next─┼───▶│ next─┼──▶ null
  2719. // ├──────┤ ├──────┤ ├──────┤ ├──────┤
  2720. // │ data │ │ data │ │ data │ │ data │
  2721. // └──────┘ └──────┘ └──────┘ └──────┘
  2722. //
  2723. function createItem(data) {
  2724. return {
  2725. prev: null,
  2726. next: null,
  2727. data: data
  2728. };
  2729. }
  2730. function allocateCursor(node, prev, next) {
  2731. var cursor;
  2732. if (cursors !== null) {
  2733. cursor = cursors;
  2734. cursors = cursors.cursor;
  2735. cursor.prev = prev;
  2736. cursor.next = next;
  2737. cursor.cursor = node.cursor;
  2738. } else {
  2739. cursor = {
  2740. prev: prev,
  2741. next: next,
  2742. cursor: node.cursor
  2743. };
  2744. }
  2745. node.cursor = cursor;
  2746. return cursor;
  2747. }
  2748. function releaseCursor(node) {
  2749. var cursor = node.cursor;
  2750. node.cursor = cursor.cursor;
  2751. cursor.prev = null;
  2752. cursor.next = null;
  2753. cursor.cursor = cursors;
  2754. cursors = cursor;
  2755. }
  2756. var cursors = null;
  2757. var List$6 = function() {
  2758. this.cursor = null;
  2759. this.head = null;
  2760. this.tail = null;
  2761. };
  2762. List$6.createItem = createItem;
  2763. List$6.prototype.createItem = createItem;
  2764. List$6.prototype.updateCursors = function(prevOld, prevNew, nextOld, nextNew) {
  2765. var cursor = this.cursor;
  2766. while (cursor !== null) {
  2767. if (cursor.prev === prevOld) {
  2768. cursor.prev = prevNew;
  2769. }
  2770. if (cursor.next === nextOld) {
  2771. cursor.next = nextNew;
  2772. }
  2773. cursor = cursor.cursor;
  2774. }
  2775. };
  2776. List$6.prototype.getSize = function() {
  2777. var size = 0;
  2778. var cursor = this.head;
  2779. while (cursor) {
  2780. size++;
  2781. cursor = cursor.next;
  2782. }
  2783. return size;
  2784. };
  2785. List$6.prototype.fromArray = function(array) {
  2786. var cursor = null;
  2787. this.head = null;
  2788. for (var i = 0; i < array.length; i++) {
  2789. var item = createItem(array[i]);
  2790. if (cursor !== null) {
  2791. cursor.next = item;
  2792. } else {
  2793. this.head = item;
  2794. }
  2795. item.prev = cursor;
  2796. cursor = item;
  2797. }
  2798. this.tail = cursor;
  2799. return this;
  2800. };
  2801. List$6.prototype.toArray = function() {
  2802. var cursor = this.head;
  2803. var result = [];
  2804. while (cursor) {
  2805. result.push(cursor.data);
  2806. cursor = cursor.next;
  2807. }
  2808. return result;
  2809. };
  2810. List$6.prototype.toJSON = List$6.prototype.toArray;
  2811. List$6.prototype.isEmpty = function() {
  2812. return this.head === null;
  2813. };
  2814. List$6.prototype.first = function() {
  2815. return this.head && this.head.data;
  2816. };
  2817. List$6.prototype.last = function() {
  2818. return this.tail && this.tail.data;
  2819. };
  2820. List$6.prototype.each = function(fn, context) {
  2821. var item;
  2822. if (context === undefined) {
  2823. context = this;
  2824. }
  2825. // push cursor
  2826. var cursor = allocateCursor(this, null, this.head);
  2827. while (cursor.next !== null) {
  2828. item = cursor.next;
  2829. cursor.next = item.next;
  2830. fn.call(context, item.data, item, this);
  2831. }
  2832. // pop cursor
  2833. releaseCursor(this);
  2834. };
  2835. List$6.prototype.forEach = List$6.prototype.each;
  2836. List$6.prototype.eachRight = function(fn, context) {
  2837. var item;
  2838. if (context === undefined) {
  2839. context = this;
  2840. }
  2841. // push cursor
  2842. var cursor = allocateCursor(this, this.tail, null);
  2843. while (cursor.prev !== null) {
  2844. item = cursor.prev;
  2845. cursor.prev = item.prev;
  2846. fn.call(context, item.data, item, this);
  2847. }
  2848. // pop cursor
  2849. releaseCursor(this);
  2850. };
  2851. List$6.prototype.forEachRight = List$6.prototype.eachRight;
  2852. List$6.prototype.reduce = function(fn, initialValue, context) {
  2853. var item;
  2854. if (context === undefined) {
  2855. context = this;
  2856. }
  2857. // push cursor
  2858. var cursor = allocateCursor(this, null, this.head);
  2859. var acc = initialValue;
  2860. while (cursor.next !== null) {
  2861. item = cursor.next;
  2862. cursor.next = item.next;
  2863. acc = fn.call(context, acc, item.data, item, this);
  2864. }
  2865. // pop cursor
  2866. releaseCursor(this);
  2867. return acc;
  2868. };
  2869. List$6.prototype.reduceRight = function(fn, initialValue, context) {
  2870. var item;
  2871. if (context === undefined) {
  2872. context = this;
  2873. }
  2874. // push cursor
  2875. var cursor = allocateCursor(this, this.tail, null);
  2876. var acc = initialValue;
  2877. while (cursor.prev !== null) {
  2878. item = cursor.prev;
  2879. cursor.prev = item.prev;
  2880. acc = fn.call(context, acc, item.data, item, this);
  2881. }
  2882. // pop cursor
  2883. releaseCursor(this);
  2884. return acc;
  2885. };
  2886. List$6.prototype.nextUntil = function(start, fn, context) {
  2887. if (start === null) {
  2888. return;
  2889. }
  2890. var item;
  2891. if (context === undefined) {
  2892. context = this;
  2893. }
  2894. // push cursor
  2895. var cursor = allocateCursor(this, null, start);
  2896. while (cursor.next !== null) {
  2897. item = cursor.next;
  2898. cursor.next = item.next;
  2899. if (fn.call(context, item.data, item, this)) {
  2900. break;
  2901. }
  2902. }
  2903. // pop cursor
  2904. releaseCursor(this);
  2905. };
  2906. List$6.prototype.prevUntil = function(start, fn, context) {
  2907. if (start === null) {
  2908. return;
  2909. }
  2910. var item;
  2911. if (context === undefined) {
  2912. context = this;
  2913. }
  2914. // push cursor
  2915. var cursor = allocateCursor(this, start, null);
  2916. while (cursor.prev !== null) {
  2917. item = cursor.prev;
  2918. cursor.prev = item.prev;
  2919. if (fn.call(context, item.data, item, this)) {
  2920. break;
  2921. }
  2922. }
  2923. // pop cursor
  2924. releaseCursor(this);
  2925. };
  2926. List$6.prototype.some = function(fn, context) {
  2927. var cursor = this.head;
  2928. if (context === undefined) {
  2929. context = this;
  2930. }
  2931. while (cursor !== null) {
  2932. if (fn.call(context, cursor.data, cursor, this)) {
  2933. return true;
  2934. }
  2935. cursor = cursor.next;
  2936. }
  2937. return false;
  2938. };
  2939. List$6.prototype.map = function(fn, context) {
  2940. var result = new List$6();
  2941. var cursor = this.head;
  2942. if (context === undefined) {
  2943. context = this;
  2944. }
  2945. while (cursor !== null) {
  2946. result.appendData(fn.call(context, cursor.data, cursor, this));
  2947. cursor = cursor.next;
  2948. }
  2949. return result;
  2950. };
  2951. List$6.prototype.filter = function(fn, context) {
  2952. var result = new List$6();
  2953. var cursor = this.head;
  2954. if (context === undefined) {
  2955. context = this;
  2956. }
  2957. while (cursor !== null) {
  2958. if (fn.call(context, cursor.data, cursor, this)) {
  2959. result.appendData(cursor.data);
  2960. }
  2961. cursor = cursor.next;
  2962. }
  2963. return result;
  2964. };
  2965. List$6.prototype.clear = function() {
  2966. this.head = null;
  2967. this.tail = null;
  2968. };
  2969. List$6.prototype.copy = function() {
  2970. var result = new List$6();
  2971. var cursor = this.head;
  2972. while (cursor !== null) {
  2973. result.insert(createItem(cursor.data));
  2974. cursor = cursor.next;
  2975. }
  2976. return result;
  2977. };
  2978. List$6.prototype.prepend = function(item) {
  2979. // head
  2980. // ^
  2981. // item
  2982. this.updateCursors(null, item, this.head, item);
  2983. // insert to the beginning of the list
  2984. if (this.head !== null) {
  2985. // new item <- first item
  2986. this.head.prev = item;
  2987. // new item -> first item
  2988. item.next = this.head;
  2989. } else {
  2990. // if list has no head, then it also has no tail
  2991. // in this case tail points to the new item
  2992. this.tail = item;
  2993. }
  2994. // head always points to new item
  2995. this.head = item;
  2996. return this;
  2997. };
  2998. List$6.prototype.prependData = function(data) {
  2999. return this.prepend(createItem(data));
  3000. };
  3001. List$6.prototype.append = function(item) {
  3002. return this.insert(item);
  3003. };
  3004. List$6.prototype.appendData = function(data) {
  3005. return this.insert(createItem(data));
  3006. };
  3007. List$6.prototype.insert = function(item, before) {
  3008. if (before !== undefined && before !== null) {
  3009. // prev before
  3010. // ^
  3011. // item
  3012. this.updateCursors(before.prev, item, before, item);
  3013. if (before.prev === null) {
  3014. // insert to the beginning of list
  3015. if (this.head !== before) {
  3016. throw new Error('before doesn\'t belong to list');
  3017. }
  3018. // since head points to before therefore list doesn't empty
  3019. // no need to check tail
  3020. this.head = item;
  3021. before.prev = item;
  3022. item.next = before;
  3023. this.updateCursors(null, item);
  3024. } else {
  3025. // insert between two items
  3026. before.prev.next = item;
  3027. item.prev = before.prev;
  3028. before.prev = item;
  3029. item.next = before;
  3030. }
  3031. } else {
  3032. // tail
  3033. // ^
  3034. // item
  3035. this.updateCursors(this.tail, item, null, item);
  3036. // insert to the ending of the list
  3037. if (this.tail !== null) {
  3038. // last item -> new item
  3039. this.tail.next = item;
  3040. // last item <- new item
  3041. item.prev = this.tail;
  3042. } else {
  3043. // if list has no tail, then it also has no head
  3044. // in this case head points to new item
  3045. this.head = item;
  3046. }
  3047. // tail always points to new item
  3048. this.tail = item;
  3049. }
  3050. return this;
  3051. };
  3052. List$6.prototype.insertData = function(data, before) {
  3053. return this.insert(createItem(data), before);
  3054. };
  3055. List$6.prototype.remove = function(item) {
  3056. // item
  3057. // ^
  3058. // prev next
  3059. this.updateCursors(item, item.prev, item, item.next);
  3060. if (item.prev !== null) {
  3061. item.prev.next = item.next;
  3062. } else {
  3063. if (this.head !== item) {
  3064. throw new Error('item doesn\'t belong to list');
  3065. }
  3066. this.head = item.next;
  3067. }
  3068. if (item.next !== null) {
  3069. item.next.prev = item.prev;
  3070. } else {
  3071. if (this.tail !== item) {
  3072. throw new Error('item doesn\'t belong to list');
  3073. }
  3074. this.tail = item.prev;
  3075. }
  3076. item.prev = null;
  3077. item.next = null;
  3078. return item;
  3079. };
  3080. List$6.prototype.push = function(data) {
  3081. this.insert(createItem(data));
  3082. };
  3083. List$6.prototype.pop = function() {
  3084. if (this.tail !== null) {
  3085. return this.remove(this.tail);
  3086. }
  3087. };
  3088. List$6.prototype.unshift = function(data) {
  3089. this.prepend(createItem(data));
  3090. };
  3091. List$6.prototype.shift = function() {
  3092. if (this.head !== null) {
  3093. return this.remove(this.head);
  3094. }
  3095. };
  3096. List$6.prototype.prependList = function(list) {
  3097. return this.insertList(list, this.head);
  3098. };
  3099. List$6.prototype.appendList = function(list) {
  3100. return this.insertList(list);
  3101. };
  3102. List$6.prototype.insertList = function(list, before) {
  3103. // ignore empty lists
  3104. if (list.head === null) {
  3105. return this;
  3106. }
  3107. if (before !== undefined && before !== null) {
  3108. this.updateCursors(before.prev, list.tail, before, list.head);
  3109. // insert in the middle of dist list
  3110. if (before.prev !== null) {
  3111. // before.prev <-> list.head
  3112. before.prev.next = list.head;
  3113. list.head.prev = before.prev;
  3114. } else {
  3115. this.head = list.head;
  3116. }
  3117. before.prev = list.tail;
  3118. list.tail.next = before;
  3119. } else {
  3120. this.updateCursors(this.tail, list.tail, null, list.head);
  3121. // insert to end of the list
  3122. if (this.tail !== null) {
  3123. // if destination list has a tail, then it also has a head,
  3124. // but head doesn't change
  3125. // dest tail -> source head
  3126. this.tail.next = list.head;
  3127. // dest tail <- source head
  3128. list.head.prev = this.tail;
  3129. } else {
  3130. // if list has no a tail, then it also has no a head
  3131. // in this case points head to new item
  3132. this.head = list.head;
  3133. }
  3134. // tail always start point to new item
  3135. this.tail = list.tail;
  3136. }
  3137. list.head = null;
  3138. list.tail = null;
  3139. return this;
  3140. };
  3141. List$6.prototype.replace = function(oldItem, newItemOrList) {
  3142. if ('head' in newItemOrList) {
  3143. this.insertList(newItemOrList, oldItem);
  3144. } else {
  3145. this.insert(newItemOrList, oldItem);
  3146. }
  3147. this.remove(oldItem);
  3148. };
  3149. var List_1 = List$6;
  3150. var createCustomError$3 = function createCustomError(name, message) {
  3151. // use Object.create(), because some VMs prevent setting line/column otherwise
  3152. // (iOS Safari 10 even throws an exception)
  3153. var error = Object.create(SyntaxError.prototype);
  3154. var errorStack = new Error();
  3155. error.name = name;
  3156. error.message = message;
  3157. Object.defineProperty(error, 'stack', {
  3158. get: function() {
  3159. return (errorStack.stack || '').replace(/^(.+\n){1,3}/, name + ': ' + message + '\n');
  3160. }
  3161. });
  3162. return error;
  3163. };
  3164. var createCustomError$2 = createCustomError$3;
  3165. var MAX_LINE_LENGTH = 100;
  3166. var OFFSET_CORRECTION = 60;
  3167. var TAB_REPLACEMENT = ' ';
  3168. function sourceFragment(error, extraLines) {
  3169. function processLines(start, end) {
  3170. return lines.slice(start, end).map(function(line, idx) {
  3171. var num = String(start + idx + 1);
  3172. while (num.length < maxNumLength) {
  3173. num = ' ' + num;
  3174. }
  3175. return num + ' |' + line;
  3176. }).join('\n');
  3177. }
  3178. var lines = error.source.split(/\r\n?|\n|\f/);
  3179. var line = error.line;
  3180. var column = error.column;
  3181. var startLine = Math.max(1, line - extraLines) - 1;
  3182. var endLine = Math.min(line + extraLines, lines.length + 1);
  3183. var maxNumLength = Math.max(4, String(endLine).length) + 1;
  3184. var cutLeft = 0;
  3185. // column correction according to replaced tab before column
  3186. column += (TAB_REPLACEMENT.length - 1) * (lines[line - 1].substr(0, column - 1).match(/\t/g) || []).length;
  3187. if (column > MAX_LINE_LENGTH) {
  3188. cutLeft = column - OFFSET_CORRECTION + 3;
  3189. column = OFFSET_CORRECTION - 2;
  3190. }
  3191. for (var i = startLine; i <= endLine; i++) {
  3192. if (i >= 0 && i < lines.length) {
  3193. lines[i] = lines[i].replace(/\t/g, TAB_REPLACEMENT);
  3194. lines[i] =
  3195. (cutLeft > 0 && lines[i].length > cutLeft ? '\u2026' : '') +
  3196. lines[i].substr(cutLeft, MAX_LINE_LENGTH - 2) +
  3197. (lines[i].length > cutLeft + MAX_LINE_LENGTH - 1 ? '\u2026' : '');
  3198. }
  3199. }
  3200. return [
  3201. processLines(startLine, line),
  3202. new Array(column + maxNumLength + 2).join('-') + '^',
  3203. processLines(line, endLine)
  3204. ].filter(Boolean).join('\n');
  3205. }
  3206. var SyntaxError$4 = function(message, source, offset, line, column) {
  3207. var error = createCustomError$2('SyntaxError', message);
  3208. error.source = source;
  3209. error.offset = offset;
  3210. error.line = line;
  3211. error.column = column;
  3212. error.sourceFragment = function(extraLines) {
  3213. return sourceFragment(error, isNaN(extraLines) ? 0 : extraLines);
  3214. };
  3215. Object.defineProperty(error, 'formattedMessage', {
  3216. get: function() {
  3217. return (
  3218. 'Parse error: ' + error.message + '\n' +
  3219. sourceFragment(error, 2)
  3220. );
  3221. }
  3222. });
  3223. // for backward capability
  3224. error.parseError = {
  3225. offset: offset,
  3226. line: line,
  3227. column: column
  3228. };
  3229. return error;
  3230. };
  3231. var _SyntaxError$1 = SyntaxError$4;
  3232. // CSS Syntax Module Level 3
  3233. // https://www.w3.org/TR/css-syntax-3/
  3234. var TYPE$H = {
  3235. EOF: 0, // <EOF-token>
  3236. Ident: 1, // <ident-token>
  3237. Function: 2, // <function-token>
  3238. AtKeyword: 3, // <at-keyword-token>
  3239. Hash: 4, // <hash-token>
  3240. String: 5, // <string-token>
  3241. BadString: 6, // <bad-string-token>
  3242. Url: 7, // <url-token>
  3243. BadUrl: 8, // <bad-url-token>
  3244. Delim: 9, // <delim-token>
  3245. Number: 10, // <number-token>
  3246. Percentage: 11, // <percentage-token>
  3247. Dimension: 12, // <dimension-token>
  3248. WhiteSpace: 13, // <whitespace-token>
  3249. CDO: 14, // <CDO-token>
  3250. CDC: 15, // <CDC-token>
  3251. Colon: 16, // <colon-token> :
  3252. Semicolon: 17, // <semicolon-token> ;
  3253. Comma: 18, // <comma-token> ,
  3254. LeftSquareBracket: 19, // <[-token>
  3255. RightSquareBracket: 20, // <]-token>
  3256. LeftParenthesis: 21, // <(-token>
  3257. RightParenthesis: 22, // <)-token>
  3258. LeftCurlyBracket: 23, // <{-token>
  3259. RightCurlyBracket: 24, // <}-token>
  3260. Comment: 25
  3261. };
  3262. var NAME$3 = Object.keys(TYPE$H).reduce(function(result, key) {
  3263. result[TYPE$H[key]] = key;
  3264. return result;
  3265. }, {});
  3266. var _const = {
  3267. TYPE: TYPE$H,
  3268. NAME: NAME$3
  3269. };
  3270. var EOF$1 = 0;
  3271. // https://drafts.csswg.org/css-syntax-3/
  3272. // § 4.2. Definitions
  3273. // digit
  3274. // A code point between U+0030 DIGIT ZERO (0) and U+0039 DIGIT NINE (9).
  3275. function isDigit$5(code) {
  3276. return code >= 0x0030 && code <= 0x0039;
  3277. }
  3278. // hex digit
  3279. // A digit, or a code point between U+0041 LATIN CAPITAL LETTER A (A) and U+0046 LATIN CAPITAL LETTER F (F),
  3280. // or a code point between U+0061 LATIN SMALL LETTER A (a) and U+0066 LATIN SMALL LETTER F (f).
  3281. function isHexDigit$4(code) {
  3282. return (
  3283. isDigit$5(code) || // 0 .. 9
  3284. (code >= 0x0041 && code <= 0x0046) || // A .. F
  3285. (code >= 0x0061 && code <= 0x0066) // a .. f
  3286. );
  3287. }
  3288. // uppercase letter
  3289. // A code point between U+0041 LATIN CAPITAL LETTER A (A) and U+005A LATIN CAPITAL LETTER Z (Z).
  3290. function isUppercaseLetter$1(code) {
  3291. return code >= 0x0041 && code <= 0x005A;
  3292. }
  3293. // lowercase letter
  3294. // A code point between U+0061 LATIN SMALL LETTER A (a) and U+007A LATIN SMALL LETTER Z (z).
  3295. function isLowercaseLetter(code) {
  3296. return code >= 0x0061 && code <= 0x007A;
  3297. }
  3298. // letter
  3299. // An uppercase letter or a lowercase letter.
  3300. function isLetter(code) {
  3301. return isUppercaseLetter$1(code) || isLowercaseLetter(code);
  3302. }
  3303. // non-ASCII code point
  3304. // A code point with a value equal to or greater than U+0080 <control>.
  3305. function isNonAscii(code) {
  3306. return code >= 0x0080;
  3307. }
  3308. // name-start code point
  3309. // A letter, a non-ASCII code point, or U+005F LOW LINE (_).
  3310. function isNameStart(code) {
  3311. return isLetter(code) || isNonAscii(code) || code === 0x005F;
  3312. }
  3313. // name code point
  3314. // A name-start code point, a digit, or U+002D HYPHEN-MINUS (-).
  3315. function isName$2(code) {
  3316. return isNameStart(code) || isDigit$5(code) || code === 0x002D;
  3317. }
  3318. // non-printable code point
  3319. // A code point between U+0000 NULL and U+0008 BACKSPACE, or U+000B LINE TABULATION,
  3320. // or a code point between U+000E SHIFT OUT and U+001F INFORMATION SEPARATOR ONE, or U+007F DELETE.
  3321. function isNonPrintable(code) {
  3322. return (
  3323. (code >= 0x0000 && code <= 0x0008) ||
  3324. (code === 0x000B) ||
  3325. (code >= 0x000E && code <= 0x001F) ||
  3326. (code === 0x007F)
  3327. );
  3328. }
  3329. // newline
  3330. // U+000A LINE FEED. Note that U+000D CARRIAGE RETURN and U+000C FORM FEED are not included in this definition,
  3331. // as they are converted to U+000A LINE FEED during preprocessing.
  3332. // TODO: we doesn't do a preprocessing, so check a code point for U+000D CARRIAGE RETURN and U+000C FORM FEED
  3333. function isNewline$1(code) {
  3334. return code === 0x000A || code === 0x000D || code === 0x000C;
  3335. }
  3336. // whitespace
  3337. // A newline, U+0009 CHARACTER TABULATION, or U+0020 SPACE.
  3338. function isWhiteSpace$2(code) {
  3339. return isNewline$1(code) || code === 0x0020 || code === 0x0009;
  3340. }
  3341. // § 4.3.8. Check if two code points are a valid escape
  3342. function isValidEscape$2(first, second) {
  3343. // If the first code point is not U+005C REVERSE SOLIDUS (\), return false.
  3344. if (first !== 0x005C) {
  3345. return false;
  3346. }
  3347. // Otherwise, if the second code point is a newline or EOF, return false.
  3348. if (isNewline$1(second) || second === EOF$1) {
  3349. return false;
  3350. }
  3351. // Otherwise, return true.
  3352. return true;
  3353. }
  3354. // § 4.3.9. Check if three code points would start an identifier
  3355. function isIdentifierStart$2(first, second, third) {
  3356. // Look at the first code point:
  3357. // U+002D HYPHEN-MINUS
  3358. if (first === 0x002D) {
  3359. // If the second code point is a name-start code point or a U+002D HYPHEN-MINUS,
  3360. // or the second and third code points are a valid escape, return true. Otherwise, return false.
  3361. return (
  3362. isNameStart(second) ||
  3363. second === 0x002D ||
  3364. isValidEscape$2(second, third)
  3365. );
  3366. }
  3367. // name-start code point
  3368. if (isNameStart(first)) {
  3369. // Return true.
  3370. return true;
  3371. }
  3372. // U+005C REVERSE SOLIDUS (\)
  3373. if (first === 0x005C) {
  3374. // If the first and second code points are a valid escape, return true. Otherwise, return false.
  3375. return isValidEscape$2(first, second);
  3376. }
  3377. // anything else
  3378. // Return false.
  3379. return false;
  3380. }
  3381. // § 4.3.10. Check if three code points would start a number
  3382. function isNumberStart$1(first, second, third) {
  3383. // Look at the first code point:
  3384. // U+002B PLUS SIGN (+)
  3385. // U+002D HYPHEN-MINUS (-)
  3386. if (first === 0x002B || first === 0x002D) {
  3387. // If the second code point is a digit, return true.
  3388. if (isDigit$5(second)) {
  3389. return 2;
  3390. }
  3391. // Otherwise, if the second code point is a U+002E FULL STOP (.)
  3392. // and the third code point is a digit, return true.
  3393. // Otherwise, return false.
  3394. return second === 0x002E && isDigit$5(third) ? 3 : 0;
  3395. }
  3396. // U+002E FULL STOP (.)
  3397. if (first === 0x002E) {
  3398. // If the second code point is a digit, return true. Otherwise, return false.
  3399. return isDigit$5(second) ? 2 : 0;
  3400. }
  3401. // digit
  3402. if (isDigit$5(first)) {
  3403. // Return true.
  3404. return 1;
  3405. }
  3406. // anything else
  3407. // Return false.
  3408. return 0;
  3409. }
  3410. //
  3411. // Misc
  3412. //
  3413. // detect BOM (https://en.wikipedia.org/wiki/Byte_order_mark)
  3414. function isBOM$2(code) {
  3415. // UTF-16BE
  3416. if (code === 0xFEFF) {
  3417. return 1;
  3418. }
  3419. // UTF-16LE
  3420. if (code === 0xFFFE) {
  3421. return 1;
  3422. }
  3423. return 0;
  3424. }
  3425. // Fast code category
  3426. //
  3427. // https://drafts.csswg.org/css-syntax/#tokenizer-definitions
  3428. // > non-ASCII code point
  3429. // > A code point with a value equal to or greater than U+0080 <control>
  3430. // > name-start code point
  3431. // > A letter, a non-ASCII code point, or U+005F LOW LINE (_).
  3432. // > name code point
  3433. // > A name-start code point, a digit, or U+002D HYPHEN-MINUS (-)
  3434. // That means only ASCII code points has a special meaning and we define a maps for 0..127 codes only
  3435. var CATEGORY = new Array(0x80);
  3436. charCodeCategory$1.Eof = 0x80;
  3437. charCodeCategory$1.WhiteSpace = 0x82;
  3438. charCodeCategory$1.Digit = 0x83;
  3439. charCodeCategory$1.NameStart = 0x84;
  3440. charCodeCategory$1.NonPrintable = 0x85;
  3441. for (var i = 0; i < CATEGORY.length; i++) {
  3442. switch (true) {
  3443. case isWhiteSpace$2(i):
  3444. CATEGORY[i] = charCodeCategory$1.WhiteSpace;
  3445. break;
  3446. case isDigit$5(i):
  3447. CATEGORY[i] = charCodeCategory$1.Digit;
  3448. break;
  3449. case isNameStart(i):
  3450. CATEGORY[i] = charCodeCategory$1.NameStart;
  3451. break;
  3452. case isNonPrintable(i):
  3453. CATEGORY[i] = charCodeCategory$1.NonPrintable;
  3454. break;
  3455. default:
  3456. CATEGORY[i] = i || charCodeCategory$1.Eof;
  3457. }
  3458. }
  3459. function charCodeCategory$1(code) {
  3460. return code < 0x80 ? CATEGORY[code] : charCodeCategory$1.NameStart;
  3461. }
  3462. var charCodeDefinitions$1 = {
  3463. isDigit: isDigit$5,
  3464. isHexDigit: isHexDigit$4,
  3465. isUppercaseLetter: isUppercaseLetter$1,
  3466. isLowercaseLetter: isLowercaseLetter,
  3467. isLetter: isLetter,
  3468. isNonAscii: isNonAscii,
  3469. isNameStart: isNameStart,
  3470. isName: isName$2,
  3471. isNonPrintable: isNonPrintable,
  3472. isNewline: isNewline$1,
  3473. isWhiteSpace: isWhiteSpace$2,
  3474. isValidEscape: isValidEscape$2,
  3475. isIdentifierStart: isIdentifierStart$2,
  3476. isNumberStart: isNumberStart$1,
  3477. isBOM: isBOM$2,
  3478. charCodeCategory: charCodeCategory$1
  3479. };
  3480. var charCodeDef = charCodeDefinitions$1;
  3481. var isDigit$4 = charCodeDef.isDigit;
  3482. var isHexDigit$3 = charCodeDef.isHexDigit;
  3483. var isUppercaseLetter = charCodeDef.isUppercaseLetter;
  3484. var isName$1 = charCodeDef.isName;
  3485. var isWhiteSpace$1 = charCodeDef.isWhiteSpace;
  3486. var isValidEscape$1 = charCodeDef.isValidEscape;
  3487. function getCharCode(source, offset) {
  3488. return offset < source.length ? source.charCodeAt(offset) : 0;
  3489. }
  3490. function getNewlineLength$1(source, offset, code) {
  3491. if (code === 13 /* \r */ && getCharCode(source, offset + 1) === 10 /* \n */) {
  3492. return 2;
  3493. }
  3494. return 1;
  3495. }
  3496. function cmpChar$5(testStr, offset, referenceCode) {
  3497. var code = testStr.charCodeAt(offset);
  3498. // code.toLowerCase() for A..Z
  3499. if (isUppercaseLetter(code)) {
  3500. code = code | 32;
  3501. }
  3502. return code === referenceCode;
  3503. }
  3504. function cmpStr$6(testStr, start, end, referenceStr) {
  3505. if (end - start !== referenceStr.length) {
  3506. return false;
  3507. }
  3508. if (start < 0 || end > testStr.length) {
  3509. return false;
  3510. }
  3511. for (var i = start; i < end; i++) {
  3512. var testCode = testStr.charCodeAt(i);
  3513. var referenceCode = referenceStr.charCodeAt(i - start);
  3514. // testCode.toLowerCase() for A..Z
  3515. if (isUppercaseLetter(testCode)) {
  3516. testCode = testCode | 32;
  3517. }
  3518. if (testCode !== referenceCode) {
  3519. return false;
  3520. }
  3521. }
  3522. return true;
  3523. }
  3524. function findWhiteSpaceStart$1(source, offset) {
  3525. for (; offset >= 0; offset--) {
  3526. if (!isWhiteSpace$1(source.charCodeAt(offset))) {
  3527. break;
  3528. }
  3529. }
  3530. return offset + 1;
  3531. }
  3532. function findWhiteSpaceEnd$1(source, offset) {
  3533. for (; offset < source.length; offset++) {
  3534. if (!isWhiteSpace$1(source.charCodeAt(offset))) {
  3535. break;
  3536. }
  3537. }
  3538. return offset;
  3539. }
  3540. function findDecimalNumberEnd(source, offset) {
  3541. for (; offset < source.length; offset++) {
  3542. if (!isDigit$4(source.charCodeAt(offset))) {
  3543. break;
  3544. }
  3545. }
  3546. return offset;
  3547. }
  3548. // § 4.3.7. Consume an escaped code point
  3549. function consumeEscaped$1(source, offset) {
  3550. // It assumes that the U+005C REVERSE SOLIDUS (\) has already been consumed and
  3551. // that the next input code point has already been verified to be part of a valid escape.
  3552. offset += 2;
  3553. // hex digit
  3554. if (isHexDigit$3(getCharCode(source, offset - 1))) {
  3555. // Consume as many hex digits as possible, but no more than 5.
  3556. // Note that this means 1-6 hex digits have been consumed in total.
  3557. for (var maxOffset = Math.min(source.length, offset + 5); offset < maxOffset; offset++) {
  3558. if (!isHexDigit$3(getCharCode(source, offset))) {
  3559. break;
  3560. }
  3561. }
  3562. // If the next input code point is whitespace, consume it as well.
  3563. var code = getCharCode(source, offset);
  3564. if (isWhiteSpace$1(code)) {
  3565. offset += getNewlineLength$1(source, offset, code);
  3566. }
  3567. }
  3568. return offset;
  3569. }
  3570. // §4.3.11. Consume a name
  3571. // Note: This algorithm does not do the verification of the first few code points that are necessary
  3572. // to ensure the returned code points would constitute an <ident-token>. If that is the intended use,
  3573. // ensure that the stream starts with an identifier before calling this algorithm.
  3574. function consumeName$1(source, offset) {
  3575. // Let result initially be an empty string.
  3576. // Repeatedly consume the next input code point from the stream:
  3577. for (; offset < source.length; offset++) {
  3578. var code = source.charCodeAt(offset);
  3579. // name code point
  3580. if (isName$1(code)) {
  3581. // Append the code point to result.
  3582. continue;
  3583. }
  3584. // the stream starts with a valid escape
  3585. if (isValidEscape$1(code, getCharCode(source, offset + 1))) {
  3586. // Consume an escaped code point. Append the returned code point to result.
  3587. offset = consumeEscaped$1(source, offset) - 1;
  3588. continue;
  3589. }
  3590. // anything else
  3591. // Reconsume the current input code point. Return result.
  3592. break;
  3593. }
  3594. return offset;
  3595. }
  3596. // §4.3.12. Consume a number
  3597. function consumeNumber$5(source, offset) {
  3598. var code = source.charCodeAt(offset);
  3599. // 2. If the next input code point is U+002B PLUS SIGN (+) or U+002D HYPHEN-MINUS (-),
  3600. // consume it and append it to repr.
  3601. if (code === 0x002B || code === 0x002D) {
  3602. code = source.charCodeAt(offset += 1);
  3603. }
  3604. // 3. While the next input code point is a digit, consume it and append it to repr.
  3605. if (isDigit$4(code)) {
  3606. offset = findDecimalNumberEnd(source, offset + 1);
  3607. code = source.charCodeAt(offset);
  3608. }
  3609. // 4. If the next 2 input code points are U+002E FULL STOP (.) followed by a digit, then:
  3610. if (code === 0x002E && isDigit$4(source.charCodeAt(offset + 1))) {
  3611. // 4.1 Consume them.
  3612. // 4.2 Append them to repr.
  3613. code = source.charCodeAt(offset += 2);
  3614. // 4.3 Set type to "number".
  3615. // TODO
  3616. // 4.4 While the next input code point is a digit, consume it and append it to repr.
  3617. offset = findDecimalNumberEnd(source, offset);
  3618. }
  3619. // 5. If the next 2 or 3 input code points are U+0045 LATIN CAPITAL LETTER E (E)
  3620. // or U+0065 LATIN SMALL LETTER E (e), ... , followed by a digit, then:
  3621. if (cmpChar$5(source, offset, 101 /* e */)) {
  3622. var sign = 0;
  3623. code = source.charCodeAt(offset + 1);
  3624. // ... optionally followed by U+002D HYPHEN-MINUS (-) or U+002B PLUS SIGN (+) ...
  3625. if (code === 0x002D || code === 0x002B) {
  3626. sign = 1;
  3627. code = source.charCodeAt(offset + 2);
  3628. }
  3629. // ... followed by a digit
  3630. if (isDigit$4(code)) {
  3631. // 5.1 Consume them.
  3632. // 5.2 Append them to repr.
  3633. // 5.3 Set type to "number".
  3634. // TODO
  3635. // 5.4 While the next input code point is a digit, consume it and append it to repr.
  3636. offset = findDecimalNumberEnd(source, offset + 1 + sign + 1);
  3637. }
  3638. }
  3639. return offset;
  3640. }
  3641. // § 4.3.14. Consume the remnants of a bad url
  3642. // ... its sole use is to consume enough of the input stream to reach a recovery point
  3643. // where normal tokenizing can resume.
  3644. function consumeBadUrlRemnants$1(source, offset) {
  3645. // Repeatedly consume the next input code point from the stream:
  3646. for (; offset < source.length; offset++) {
  3647. var code = source.charCodeAt(offset);
  3648. // U+0029 RIGHT PARENTHESIS ())
  3649. // EOF
  3650. if (code === 0x0029) {
  3651. // Return.
  3652. offset++;
  3653. break;
  3654. }
  3655. if (isValidEscape$1(code, getCharCode(source, offset + 1))) {
  3656. // Consume an escaped code point.
  3657. // Note: This allows an escaped right parenthesis ("\)") to be encountered
  3658. // without ending the <bad-url-token>. This is otherwise identical to
  3659. // the "anything else" clause.
  3660. offset = consumeEscaped$1(source, offset);
  3661. }
  3662. }
  3663. return offset;
  3664. }
  3665. var utils$2 = {
  3666. consumeEscaped: consumeEscaped$1,
  3667. consumeName: consumeName$1,
  3668. consumeNumber: consumeNumber$5,
  3669. consumeBadUrlRemnants: consumeBadUrlRemnants$1,
  3670. cmpChar: cmpChar$5,
  3671. cmpStr: cmpStr$6,
  3672. getNewlineLength: getNewlineLength$1,
  3673. findWhiteSpaceStart: findWhiteSpaceStart$1,
  3674. findWhiteSpaceEnd: findWhiteSpaceEnd$1
  3675. };
  3676. var constants$2 = _const;
  3677. var TYPE$G = constants$2.TYPE;
  3678. var NAME$2 = constants$2.NAME;
  3679. var utils$1 = utils$2;
  3680. var cmpStr$5 = utils$1.cmpStr;
  3681. var EOF = TYPE$G.EOF;
  3682. var WHITESPACE$c = TYPE$G.WhiteSpace;
  3683. var COMMENT$a = TYPE$G.Comment;
  3684. var OFFSET_MASK$1 = 0x00FFFFFF;
  3685. var TYPE_SHIFT$1 = 24;
  3686. var TokenStream$4 = function() {
  3687. this.offsetAndType = null;
  3688. this.balance = null;
  3689. this.reset();
  3690. };
  3691. TokenStream$4.prototype = {
  3692. reset: function() {
  3693. this.eof = false;
  3694. this.tokenIndex = -1;
  3695. this.tokenType = 0;
  3696. this.tokenStart = this.firstCharOffset;
  3697. this.tokenEnd = this.firstCharOffset;
  3698. },
  3699. lookupType: function(offset) {
  3700. offset += this.tokenIndex;
  3701. if (offset < this.tokenCount) {
  3702. return this.offsetAndType[offset] >> TYPE_SHIFT$1;
  3703. }
  3704. return EOF;
  3705. },
  3706. lookupOffset: function(offset) {
  3707. offset += this.tokenIndex;
  3708. if (offset < this.tokenCount) {
  3709. return this.offsetAndType[offset - 1] & OFFSET_MASK$1;
  3710. }
  3711. return this.source.length;
  3712. },
  3713. lookupValue: function(offset, referenceStr) {
  3714. offset += this.tokenIndex;
  3715. if (offset < this.tokenCount) {
  3716. return cmpStr$5(
  3717. this.source,
  3718. this.offsetAndType[offset - 1] & OFFSET_MASK$1,
  3719. this.offsetAndType[offset] & OFFSET_MASK$1,
  3720. referenceStr
  3721. );
  3722. }
  3723. return false;
  3724. },
  3725. getTokenStart: function(tokenIndex) {
  3726. if (tokenIndex === this.tokenIndex) {
  3727. return this.tokenStart;
  3728. }
  3729. if (tokenIndex > 0) {
  3730. return tokenIndex < this.tokenCount
  3731. ? this.offsetAndType[tokenIndex - 1] & OFFSET_MASK$1
  3732. : this.offsetAndType[this.tokenCount] & OFFSET_MASK$1;
  3733. }
  3734. return this.firstCharOffset;
  3735. },
  3736. // TODO: -> skipUntilBalanced
  3737. getRawLength: function(startToken, mode) {
  3738. var cursor = startToken;
  3739. var balanceEnd;
  3740. var offset = this.offsetAndType[Math.max(cursor - 1, 0)] & OFFSET_MASK$1;
  3741. var type;
  3742. loop:
  3743. for (; cursor < this.tokenCount; cursor++) {
  3744. balanceEnd = this.balance[cursor];
  3745. // stop scanning on balance edge that points to offset before start token
  3746. if (balanceEnd < startToken) {
  3747. break loop;
  3748. }
  3749. type = this.offsetAndType[cursor] >> TYPE_SHIFT$1;
  3750. // check token is stop type
  3751. switch (mode(type, this.source, offset)) {
  3752. case 1:
  3753. break loop;
  3754. case 2:
  3755. cursor++;
  3756. break loop;
  3757. default:
  3758. // fast forward to the end of balanced block
  3759. if (this.balance[balanceEnd] === cursor) {
  3760. cursor = balanceEnd;
  3761. }
  3762. offset = this.offsetAndType[cursor] & OFFSET_MASK$1;
  3763. }
  3764. }
  3765. return cursor - this.tokenIndex;
  3766. },
  3767. isBalanceEdge: function(pos) {
  3768. return this.balance[this.tokenIndex] < pos;
  3769. },
  3770. isDelim: function(code, offset) {
  3771. if (offset) {
  3772. return (
  3773. this.lookupType(offset) === TYPE$G.Delim &&
  3774. this.source.charCodeAt(this.lookupOffset(offset)) === code
  3775. );
  3776. }
  3777. return (
  3778. this.tokenType === TYPE$G.Delim &&
  3779. this.source.charCodeAt(this.tokenStart) === code
  3780. );
  3781. },
  3782. getTokenValue: function() {
  3783. return this.source.substring(this.tokenStart, this.tokenEnd);
  3784. },
  3785. getTokenLength: function() {
  3786. return this.tokenEnd - this.tokenStart;
  3787. },
  3788. substrToCursor: function(start) {
  3789. return this.source.substring(start, this.tokenStart);
  3790. },
  3791. skipWS: function() {
  3792. for (var i = this.tokenIndex, skipTokenCount = 0; i < this.tokenCount; i++, skipTokenCount++) {
  3793. if ((this.offsetAndType[i] >> TYPE_SHIFT$1) !== WHITESPACE$c) {
  3794. break;
  3795. }
  3796. }
  3797. if (skipTokenCount > 0) {
  3798. this.skip(skipTokenCount);
  3799. }
  3800. },
  3801. skipSC: function() {
  3802. while (this.tokenType === WHITESPACE$c || this.tokenType === COMMENT$a) {
  3803. this.next();
  3804. }
  3805. },
  3806. skip: function(tokenCount) {
  3807. var next = this.tokenIndex + tokenCount;
  3808. if (next < this.tokenCount) {
  3809. this.tokenIndex = next;
  3810. this.tokenStart = this.offsetAndType[next - 1] & OFFSET_MASK$1;
  3811. next = this.offsetAndType[next];
  3812. this.tokenType = next >> TYPE_SHIFT$1;
  3813. this.tokenEnd = next & OFFSET_MASK$1;
  3814. } else {
  3815. this.tokenIndex = this.tokenCount;
  3816. this.next();
  3817. }
  3818. },
  3819. next: function() {
  3820. var next = this.tokenIndex + 1;
  3821. if (next < this.tokenCount) {
  3822. this.tokenIndex = next;
  3823. this.tokenStart = this.tokenEnd;
  3824. next = this.offsetAndType[next];
  3825. this.tokenType = next >> TYPE_SHIFT$1;
  3826. this.tokenEnd = next & OFFSET_MASK$1;
  3827. } else {
  3828. this.tokenIndex = this.tokenCount;
  3829. this.eof = true;
  3830. this.tokenType = EOF;
  3831. this.tokenStart = this.tokenEnd = this.source.length;
  3832. }
  3833. },
  3834. forEachToken(fn) {
  3835. for (var i = 0, offset = this.firstCharOffset; i < this.tokenCount; i++) {
  3836. var start = offset;
  3837. var item = this.offsetAndType[i];
  3838. var end = item & OFFSET_MASK$1;
  3839. var type = item >> TYPE_SHIFT$1;
  3840. offset = end;
  3841. fn(type, start, end, i);
  3842. }
  3843. },
  3844. dump() {
  3845. var tokens = new Array(this.tokenCount);
  3846. this.forEachToken((type, start, end, index) => {
  3847. tokens[index] = {
  3848. idx: index,
  3849. type: NAME$2[type],
  3850. chunk: this.source.substring(start, end),
  3851. balance: this.balance[index]
  3852. };
  3853. });
  3854. return tokens;
  3855. }
  3856. };
  3857. var TokenStream_1 = TokenStream$4;
  3858. function noop$3(value) {
  3859. return value;
  3860. }
  3861. function generateMultiplier(multiplier) {
  3862. if (multiplier.min === 0 && multiplier.max === 0) {
  3863. return '*';
  3864. }
  3865. if (multiplier.min === 0 && multiplier.max === 1) {
  3866. return '?';
  3867. }
  3868. if (multiplier.min === 1 && multiplier.max === 0) {
  3869. return multiplier.comma ? '#' : '+';
  3870. }
  3871. if (multiplier.min === 1 && multiplier.max === 1) {
  3872. return '';
  3873. }
  3874. return (
  3875. (multiplier.comma ? '#' : '') +
  3876. (multiplier.min === multiplier.max
  3877. ? '{' + multiplier.min + '}'
  3878. : '{' + multiplier.min + ',' + (multiplier.max !== 0 ? multiplier.max : '') + '}'
  3879. )
  3880. );
  3881. }
  3882. function generateTypeOpts(node) {
  3883. switch (node.type) {
  3884. case 'Range':
  3885. return (
  3886. ' [' +
  3887. (node.min === null ? '-∞' : node.min) +
  3888. ',' +
  3889. (node.max === null ? '∞' : node.max) +
  3890. ']'
  3891. );
  3892. default:
  3893. throw new Error('Unknown node type `' + node.type + '`');
  3894. }
  3895. }
  3896. function generateSequence(node, decorate, forceBraces, compact) {
  3897. var combinator = node.combinator === ' ' || compact ? node.combinator : ' ' + node.combinator + ' ';
  3898. var result = node.terms.map(function(term) {
  3899. return generate$2(term, decorate, forceBraces, compact);
  3900. }).join(combinator);
  3901. if (node.explicit || forceBraces) {
  3902. result = (compact || result[0] === ',' ? '[' : '[ ') + result + (compact ? ']' : ' ]');
  3903. }
  3904. return result;
  3905. }
  3906. function generate$2(node, decorate, forceBraces, compact) {
  3907. var result;
  3908. switch (node.type) {
  3909. case 'Group':
  3910. result =
  3911. generateSequence(node, decorate, forceBraces, compact) +
  3912. (node.disallowEmpty ? '!' : '');
  3913. break;
  3914. case 'Multiplier':
  3915. // return since node is a composition
  3916. return (
  3917. generate$2(node.term, decorate, forceBraces, compact) +
  3918. decorate(generateMultiplier(node), node)
  3919. );
  3920. case 'Type':
  3921. result = '<' + node.name + (node.opts ? decorate(generateTypeOpts(node.opts), node.opts) : '') + '>';
  3922. break;
  3923. case 'Property':
  3924. result = '<\'' + node.name + '\'>';
  3925. break;
  3926. case 'Keyword':
  3927. result = node.name;
  3928. break;
  3929. case 'AtKeyword':
  3930. result = '@' + node.name;
  3931. break;
  3932. case 'Function':
  3933. result = node.name + '(';
  3934. break;
  3935. case 'String':
  3936. case 'Token':
  3937. result = node.value;
  3938. break;
  3939. case 'Comma':
  3940. result = ',';
  3941. break;
  3942. default:
  3943. throw new Error('Unknown node type `' + node.type + '`');
  3944. }
  3945. return decorate(result, node);
  3946. }
  3947. var generate_1 = function(node, options) {
  3948. var decorate = noop$3;
  3949. var forceBraces = false;
  3950. var compact = false;
  3951. if (typeof options === 'function') {
  3952. decorate = options;
  3953. } else if (options) {
  3954. forceBraces = Boolean(options.forceBraces);
  3955. compact = Boolean(options.compact);
  3956. if (typeof options.decorate === 'function') {
  3957. decorate = options.decorate;
  3958. }
  3959. }
  3960. return generate$2(node, decorate, forceBraces, compact);
  3961. };
  3962. const createCustomError$1 = createCustomError$3;
  3963. const generate$1 = generate_1;
  3964. const defaultLoc = { offset: 0, line: 1, column: 1 };
  3965. function locateMismatch(matchResult, node) {
  3966. const tokens = matchResult.tokens;
  3967. const longestMatch = matchResult.longestMatch;
  3968. const mismatchNode = longestMatch < tokens.length ? tokens[longestMatch].node || null : null;
  3969. const badNode = mismatchNode !== node ? mismatchNode : null;
  3970. let mismatchOffset = 0;
  3971. let mismatchLength = 0;
  3972. let entries = 0;
  3973. let css = '';
  3974. let start;
  3975. let end;
  3976. for (let i = 0; i < tokens.length; i++) {
  3977. const token = tokens[i].value;
  3978. if (i === longestMatch) {
  3979. mismatchLength = token.length;
  3980. mismatchOffset = css.length;
  3981. }
  3982. if (badNode !== null && tokens[i].node === badNode) {
  3983. if (i <= longestMatch) {
  3984. entries++;
  3985. } else {
  3986. entries = 0;
  3987. }
  3988. }
  3989. css += token;
  3990. }
  3991. if (longestMatch === tokens.length || entries > 1) { // last
  3992. start = fromLoc(badNode || node, 'end') || buildLoc(defaultLoc, css);
  3993. end = buildLoc(start);
  3994. } else {
  3995. start = fromLoc(badNode, 'start') ||
  3996. buildLoc(fromLoc(node, 'start') || defaultLoc, css.slice(0, mismatchOffset));
  3997. end = fromLoc(badNode, 'end') ||
  3998. buildLoc(start, css.substr(mismatchOffset, mismatchLength));
  3999. }
  4000. return {
  4001. css,
  4002. mismatchOffset,
  4003. mismatchLength,
  4004. start,
  4005. end
  4006. };
  4007. }
  4008. function fromLoc(node, point) {
  4009. const value = node && node.loc && node.loc[point];
  4010. if (value) {
  4011. return 'line' in value ? buildLoc(value) : value;
  4012. }
  4013. return null;
  4014. }
  4015. function buildLoc({ offset, line, column }, extra) {
  4016. const loc = {
  4017. offset,
  4018. line,
  4019. column
  4020. };
  4021. if (extra) {
  4022. const lines = extra.split(/\n|\r\n?|\f/);
  4023. loc.offset += extra.length;
  4024. loc.line += lines.length - 1;
  4025. loc.column = lines.length === 1 ? loc.column + extra.length : lines.pop().length + 1;
  4026. }
  4027. return loc;
  4028. }
  4029. const SyntaxReferenceError$1 = function(type, referenceName) {
  4030. const error = createCustomError$1(
  4031. 'SyntaxReferenceError',
  4032. type + (referenceName ? ' `' + referenceName + '`' : '')
  4033. );
  4034. error.reference = referenceName;
  4035. return error;
  4036. };
  4037. const SyntaxMatchError$1 = function(message, syntax, node, matchResult) {
  4038. const error = createCustomError$1('SyntaxMatchError', message);
  4039. const {
  4040. css,
  4041. mismatchOffset,
  4042. mismatchLength,
  4043. start,
  4044. end
  4045. } = locateMismatch(matchResult, node);
  4046. error.rawMessage = message;
  4047. error.syntax = syntax ? generate$1(syntax) : '<generic>';
  4048. error.css = css;
  4049. error.mismatchOffset = mismatchOffset;
  4050. error.mismatchLength = mismatchLength;
  4051. error.message = message + '\n' +
  4052. ' syntax: ' + error.syntax + '\n' +
  4053. ' value: ' + (css || '<empty string>') + '\n' +
  4054. ' --------' + new Array(error.mismatchOffset + 1).join('-') + '^';
  4055. Object.assign(error, start);
  4056. error.loc = {
  4057. source: (node && node.loc && node.loc.source) || '<unknown>',
  4058. start,
  4059. end
  4060. };
  4061. return error;
  4062. };
  4063. var error = {
  4064. SyntaxReferenceError: SyntaxReferenceError$1,
  4065. SyntaxMatchError: SyntaxMatchError$1
  4066. };
  4067. var hasOwnProperty$7 = Object.prototype.hasOwnProperty;
  4068. var keywords$1 = Object.create(null);
  4069. var properties$1 = Object.create(null);
  4070. var HYPHENMINUS$5 = 45; // '-'.charCodeAt()
  4071. function isCustomProperty$1(str, offset) {
  4072. offset = offset || 0;
  4073. return str.length - offset >= 2 &&
  4074. str.charCodeAt(offset) === HYPHENMINUS$5 &&
  4075. str.charCodeAt(offset + 1) === HYPHENMINUS$5;
  4076. }
  4077. function getVendorPrefix(str, offset) {
  4078. offset = offset || 0;
  4079. // verdor prefix should be at least 3 chars length
  4080. if (str.length - offset >= 3) {
  4081. // vendor prefix starts with hyper minus following non-hyper minus
  4082. if (str.charCodeAt(offset) === HYPHENMINUS$5 &&
  4083. str.charCodeAt(offset + 1) !== HYPHENMINUS$5) {
  4084. // vendor prefix should contain a hyper minus at the ending
  4085. var secondDashIndex = str.indexOf('-', offset + 2);
  4086. if (secondDashIndex !== -1) {
  4087. return str.substring(offset, secondDashIndex + 1);
  4088. }
  4089. }
  4090. }
  4091. return '';
  4092. }
  4093. function getKeywordDescriptor(keyword) {
  4094. if (hasOwnProperty$7.call(keywords$1, keyword)) {
  4095. return keywords$1[keyword];
  4096. }
  4097. var name = keyword.toLowerCase();
  4098. if (hasOwnProperty$7.call(keywords$1, name)) {
  4099. return keywords$1[keyword] = keywords$1[name];
  4100. }
  4101. var custom = isCustomProperty$1(name, 0);
  4102. var vendor = !custom ? getVendorPrefix(name, 0) : '';
  4103. return keywords$1[keyword] = Object.freeze({
  4104. basename: name.substr(vendor.length),
  4105. name: name,
  4106. vendor: vendor,
  4107. prefix: vendor,
  4108. custom: custom
  4109. });
  4110. }
  4111. function getPropertyDescriptor(property) {
  4112. if (hasOwnProperty$7.call(properties$1, property)) {
  4113. return properties$1[property];
  4114. }
  4115. var name = property;
  4116. var hack = property[0];
  4117. if (hack === '/') {
  4118. hack = property[1] === '/' ? '//' : '/';
  4119. } else if (hack !== '_' &&
  4120. hack !== '*' &&
  4121. hack !== '$' &&
  4122. hack !== '#' &&
  4123. hack !== '+' &&
  4124. hack !== '&') {
  4125. hack = '';
  4126. }
  4127. var custom = isCustomProperty$1(name, hack.length);
  4128. // re-use result when possible (the same as for lower case)
  4129. if (!custom) {
  4130. name = name.toLowerCase();
  4131. if (hasOwnProperty$7.call(properties$1, name)) {
  4132. return properties$1[property] = properties$1[name];
  4133. }
  4134. }
  4135. var vendor = !custom ? getVendorPrefix(name, hack.length) : '';
  4136. var prefix = name.substr(0, hack.length + vendor.length);
  4137. return properties$1[property] = Object.freeze({
  4138. basename: name.substr(prefix.length),
  4139. name: name.substr(hack.length),
  4140. hack: hack,
  4141. vendor: vendor,
  4142. prefix: prefix,
  4143. custom: custom
  4144. });
  4145. }
  4146. var names$2 = {
  4147. keyword: getKeywordDescriptor,
  4148. property: getPropertyDescriptor,
  4149. isCustomProperty: isCustomProperty$1,
  4150. vendorPrefix: getVendorPrefix
  4151. };
  4152. var MIN_SIZE = 16 * 1024;
  4153. var SafeUint32Array = typeof Uint32Array !== 'undefined' ? Uint32Array : Array; // fallback on Array when TypedArray is not supported
  4154. var adoptBuffer$2 = function adoptBuffer(buffer, size) {
  4155. if (buffer === null || buffer.length < size) {
  4156. return new SafeUint32Array(Math.max(size + 1024, MIN_SIZE));
  4157. }
  4158. return buffer;
  4159. };
  4160. var TokenStream$3 = TokenStream_1;
  4161. var adoptBuffer$1 = adoptBuffer$2;
  4162. var constants$1 = _const;
  4163. var TYPE$F = constants$1.TYPE;
  4164. var charCodeDefinitions = charCodeDefinitions$1;
  4165. var isNewline = charCodeDefinitions.isNewline;
  4166. var isName = charCodeDefinitions.isName;
  4167. var isValidEscape = charCodeDefinitions.isValidEscape;
  4168. var isNumberStart = charCodeDefinitions.isNumberStart;
  4169. var isIdentifierStart$1 = charCodeDefinitions.isIdentifierStart;
  4170. var charCodeCategory = charCodeDefinitions.charCodeCategory;
  4171. var isBOM$1 = charCodeDefinitions.isBOM;
  4172. var utils = utils$2;
  4173. var cmpStr$4 = utils.cmpStr;
  4174. var getNewlineLength = utils.getNewlineLength;
  4175. var findWhiteSpaceEnd = utils.findWhiteSpaceEnd;
  4176. var consumeEscaped = utils.consumeEscaped;
  4177. var consumeName = utils.consumeName;
  4178. var consumeNumber$4 = utils.consumeNumber;
  4179. var consumeBadUrlRemnants = utils.consumeBadUrlRemnants;
  4180. var OFFSET_MASK = 0x00FFFFFF;
  4181. var TYPE_SHIFT = 24;
  4182. function tokenize$3(source, stream) {
  4183. function getCharCode(offset) {
  4184. return offset < sourceLength ? source.charCodeAt(offset) : 0;
  4185. }
  4186. // § 4.3.3. Consume a numeric token
  4187. function consumeNumericToken() {
  4188. // Consume a number and let number be the result.
  4189. offset = consumeNumber$4(source, offset);
  4190. // If the next 3 input code points would start an identifier, then:
  4191. if (isIdentifierStart$1(getCharCode(offset), getCharCode(offset + 1), getCharCode(offset + 2))) {
  4192. // Create a <dimension-token> with the same value and type flag as number, and a unit set initially to the empty string.
  4193. // Consume a name. Set the <dimension-token>’s unit to the returned value.
  4194. // Return the <dimension-token>.
  4195. type = TYPE$F.Dimension;
  4196. offset = consumeName(source, offset);
  4197. return;
  4198. }
  4199. // Otherwise, if the next input code point is U+0025 PERCENTAGE SIGN (%), consume it.
  4200. if (getCharCode(offset) === 0x0025) {
  4201. // Create a <percentage-token> with the same value as number, and return it.
  4202. type = TYPE$F.Percentage;
  4203. offset++;
  4204. return;
  4205. }
  4206. // Otherwise, create a <number-token> with the same value and type flag as number, and return it.
  4207. type = TYPE$F.Number;
  4208. }
  4209. // § 4.3.4. Consume an ident-like token
  4210. function consumeIdentLikeToken() {
  4211. const nameStartOffset = offset;
  4212. // Consume a name, and let string be the result.
  4213. offset = consumeName(source, offset);
  4214. // If string’s value is an ASCII case-insensitive match for "url",
  4215. // and the next input code point is U+0028 LEFT PARENTHESIS ((), consume it.
  4216. if (cmpStr$4(source, nameStartOffset, offset, 'url') && getCharCode(offset) === 0x0028) {
  4217. // While the next two input code points are whitespace, consume the next input code point.
  4218. offset = findWhiteSpaceEnd(source, offset + 1);
  4219. // If the next one or two input code points are U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('),
  4220. // or whitespace followed by U+0022 QUOTATION MARK (") or U+0027 APOSTROPHE ('),
  4221. // then create a <function-token> with its value set to string and return it.
  4222. if (getCharCode(offset) === 0x0022 ||
  4223. getCharCode(offset) === 0x0027) {
  4224. type = TYPE$F.Function;
  4225. offset = nameStartOffset + 4;
  4226. return;
  4227. }
  4228. // Otherwise, consume a url token, and return it.
  4229. consumeUrlToken();
  4230. return;
  4231. }
  4232. // Otherwise, if the next input code point is U+0028 LEFT PARENTHESIS ((), consume it.
  4233. // Create a <function-token> with its value set to string and return it.
  4234. if (getCharCode(offset) === 0x0028) {
  4235. type = TYPE$F.Function;
  4236. offset++;
  4237. return;
  4238. }
  4239. // Otherwise, create an <ident-token> with its value set to string and return it.
  4240. type = TYPE$F.Ident;
  4241. }
  4242. // § 4.3.5. Consume a string token
  4243. function consumeStringToken(endingCodePoint) {
  4244. // This algorithm may be called with an ending code point, which denotes the code point
  4245. // that ends the string. If an ending code point is not specified,
  4246. // the current input code point is used.
  4247. if (!endingCodePoint) {
  4248. endingCodePoint = getCharCode(offset++);
  4249. }
  4250. // Initially create a <string-token> with its value set to the empty string.
  4251. type = TYPE$F.String;
  4252. // Repeatedly consume the next input code point from the stream:
  4253. for (; offset < source.length; offset++) {
  4254. var code = source.charCodeAt(offset);
  4255. switch (charCodeCategory(code)) {
  4256. // ending code point
  4257. case endingCodePoint:
  4258. // Return the <string-token>.
  4259. offset++;
  4260. return;
  4261. // EOF
  4262. case charCodeCategory.Eof:
  4263. // This is a parse error. Return the <string-token>.
  4264. return;
  4265. // newline
  4266. case charCodeCategory.WhiteSpace:
  4267. if (isNewline(code)) {
  4268. // This is a parse error. Reconsume the current input code point,
  4269. // create a <bad-string-token>, and return it.
  4270. offset += getNewlineLength(source, offset, code);
  4271. type = TYPE$F.BadString;
  4272. return;
  4273. }
  4274. break;
  4275. // U+005C REVERSE SOLIDUS (\)
  4276. case 0x005C:
  4277. // If the next input code point is EOF, do nothing.
  4278. if (offset === source.length - 1) {
  4279. break;
  4280. }
  4281. var nextCode = getCharCode(offset + 1);
  4282. // Otherwise, if the next input code point is a newline, consume it.
  4283. if (isNewline(nextCode)) {
  4284. offset += getNewlineLength(source, offset + 1, nextCode);
  4285. } else if (isValidEscape(code, nextCode)) {
  4286. // Otherwise, (the stream starts with a valid escape) consume
  4287. // an escaped code point and append the returned code point to
  4288. // the <string-token>’s value.
  4289. offset = consumeEscaped(source, offset) - 1;
  4290. }
  4291. break;
  4292. // anything else
  4293. // Append the current input code point to the <string-token>’s value.
  4294. }
  4295. }
  4296. }
  4297. // § 4.3.6. Consume a url token
  4298. // Note: This algorithm assumes that the initial "url(" has already been consumed.
  4299. // This algorithm also assumes that it’s being called to consume an "unquoted" value, like url(foo).
  4300. // A quoted value, like url("foo"), is parsed as a <function-token>. Consume an ident-like token
  4301. // automatically handles this distinction; this algorithm shouldn’t be called directly otherwise.
  4302. function consumeUrlToken() {
  4303. // Initially create a <url-token> with its value set to the empty string.
  4304. type = TYPE$F.Url;
  4305. // Consume as much whitespace as possible.
  4306. offset = findWhiteSpaceEnd(source, offset);
  4307. // Repeatedly consume the next input code point from the stream:
  4308. for (; offset < source.length; offset++) {
  4309. var code = source.charCodeAt(offset);
  4310. switch (charCodeCategory(code)) {
  4311. // U+0029 RIGHT PARENTHESIS ())
  4312. case 0x0029:
  4313. // Return the <url-token>.
  4314. offset++;
  4315. return;
  4316. // EOF
  4317. case charCodeCategory.Eof:
  4318. // This is a parse error. Return the <url-token>.
  4319. return;
  4320. // whitespace
  4321. case charCodeCategory.WhiteSpace:
  4322. // Consume as much whitespace as possible.
  4323. offset = findWhiteSpaceEnd(source, offset);
  4324. // If the next input code point is U+0029 RIGHT PARENTHESIS ()) or EOF,
  4325. // consume it and return the <url-token>
  4326. // (if EOF was encountered, this is a parse error);
  4327. if (getCharCode(offset) === 0x0029 || offset >= source.length) {
  4328. if (offset < source.length) {
  4329. offset++;
  4330. }
  4331. return;
  4332. }
  4333. // otherwise, consume the remnants of a bad url, create a <bad-url-token>,
  4334. // and return it.
  4335. offset = consumeBadUrlRemnants(source, offset);
  4336. type = TYPE$F.BadUrl;
  4337. return;
  4338. // U+0022 QUOTATION MARK (")
  4339. // U+0027 APOSTROPHE (')
  4340. // U+0028 LEFT PARENTHESIS (()
  4341. // non-printable code point
  4342. case 0x0022:
  4343. case 0x0027:
  4344. case 0x0028:
  4345. case charCodeCategory.NonPrintable:
  4346. // This is a parse error. Consume the remnants of a bad url,
  4347. // create a <bad-url-token>, and return it.
  4348. offset = consumeBadUrlRemnants(source, offset);
  4349. type = TYPE$F.BadUrl;
  4350. return;
  4351. // U+005C REVERSE SOLIDUS (\)
  4352. case 0x005C:
  4353. // If the stream starts with a valid escape, consume an escaped code point and
  4354. // append the returned code point to the <url-token>’s value.
  4355. if (isValidEscape(code, getCharCode(offset + 1))) {
  4356. offset = consumeEscaped(source, offset) - 1;
  4357. break;
  4358. }
  4359. // Otherwise, this is a parse error. Consume the remnants of a bad url,
  4360. // create a <bad-url-token>, and return it.
  4361. offset = consumeBadUrlRemnants(source, offset);
  4362. type = TYPE$F.BadUrl;
  4363. return;
  4364. // anything else
  4365. // Append the current input code point to the <url-token>’s value.
  4366. }
  4367. }
  4368. }
  4369. if (!stream) {
  4370. stream = new TokenStream$3();
  4371. }
  4372. // ensure source is a string
  4373. source = String(source || '');
  4374. var sourceLength = source.length;
  4375. var offsetAndType = adoptBuffer$1(stream.offsetAndType, sourceLength + 1); // +1 because of eof-token
  4376. var balance = adoptBuffer$1(stream.balance, sourceLength + 1);
  4377. var tokenCount = 0;
  4378. var start = isBOM$1(getCharCode(0));
  4379. var offset = start;
  4380. var balanceCloseType = 0;
  4381. var balanceStart = 0;
  4382. var balancePrev = 0;
  4383. // https://drafts.csswg.org/css-syntax-3/#consume-token
  4384. // § 4.3.1. Consume a token
  4385. while (offset < sourceLength) {
  4386. var code = source.charCodeAt(offset);
  4387. var type = 0;
  4388. balance[tokenCount] = sourceLength;
  4389. switch (charCodeCategory(code)) {
  4390. // whitespace
  4391. case charCodeCategory.WhiteSpace:
  4392. // Consume as much whitespace as possible. Return a <whitespace-token>.
  4393. type = TYPE$F.WhiteSpace;
  4394. offset = findWhiteSpaceEnd(source, offset + 1);
  4395. break;
  4396. // U+0022 QUOTATION MARK (")
  4397. case 0x0022:
  4398. // Consume a string token and return it.
  4399. consumeStringToken();
  4400. break;
  4401. // U+0023 NUMBER SIGN (#)
  4402. case 0x0023:
  4403. // If the next input code point is a name code point or the next two input code points are a valid escape, then:
  4404. if (isName(getCharCode(offset + 1)) || isValidEscape(getCharCode(offset + 1), getCharCode(offset + 2))) {
  4405. // Create a <hash-token>.
  4406. type = TYPE$F.Hash;
  4407. // If the next 3 input code points would start an identifier, set the <hash-token>’s type flag to "id".
  4408. // if (isIdentifierStart(getCharCode(offset + 1), getCharCode(offset + 2), getCharCode(offset + 3))) {
  4409. // // TODO: set id flag
  4410. // }
  4411. // Consume a name, and set the <hash-token>’s value to the returned string.
  4412. offset = consumeName(source, offset + 1);
  4413. // Return the <hash-token>.
  4414. } else {
  4415. // Otherwise, return a <delim-token> with its value set to the current input code point.
  4416. type = TYPE$F.Delim;
  4417. offset++;
  4418. }
  4419. break;
  4420. // U+0027 APOSTROPHE (')
  4421. case 0x0027:
  4422. // Consume a string token and return it.
  4423. consumeStringToken();
  4424. break;
  4425. // U+0028 LEFT PARENTHESIS (()
  4426. case 0x0028:
  4427. // Return a <(-token>.
  4428. type = TYPE$F.LeftParenthesis;
  4429. offset++;
  4430. break;
  4431. // U+0029 RIGHT PARENTHESIS ())
  4432. case 0x0029:
  4433. // Return a <)-token>.
  4434. type = TYPE$F.RightParenthesis;
  4435. offset++;
  4436. break;
  4437. // U+002B PLUS SIGN (+)
  4438. case 0x002B:
  4439. // If the input stream starts with a number, ...
  4440. if (isNumberStart(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
  4441. // ... reconsume the current input code point, consume a numeric token, and return it.
  4442. consumeNumericToken();
  4443. } else {
  4444. // Otherwise, return a <delim-token> with its value set to the current input code point.
  4445. type = TYPE$F.Delim;
  4446. offset++;
  4447. }
  4448. break;
  4449. // U+002C COMMA (,)
  4450. case 0x002C:
  4451. // Return a <comma-token>.
  4452. type = TYPE$F.Comma;
  4453. offset++;
  4454. break;
  4455. // U+002D HYPHEN-MINUS (-)
  4456. case 0x002D:
  4457. // If the input stream starts with a number, reconsume the current input code point, consume a numeric token, and return it.
  4458. if (isNumberStart(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
  4459. consumeNumericToken();
  4460. } else {
  4461. // 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>.
  4462. if (getCharCode(offset + 1) === 0x002D &&
  4463. getCharCode(offset + 2) === 0x003E) {
  4464. type = TYPE$F.CDC;
  4465. offset = offset + 3;
  4466. } else {
  4467. // Otherwise, if the input stream starts with an identifier, ...
  4468. if (isIdentifierStart$1(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
  4469. // ... reconsume the current input code point, consume an ident-like token, and return it.
  4470. consumeIdentLikeToken();
  4471. } else {
  4472. // Otherwise, return a <delim-token> with its value set to the current input code point.
  4473. type = TYPE$F.Delim;
  4474. offset++;
  4475. }
  4476. }
  4477. }
  4478. break;
  4479. // U+002E FULL STOP (.)
  4480. case 0x002E:
  4481. // If the input stream starts with a number, ...
  4482. if (isNumberStart(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
  4483. // ... reconsume the current input code point, consume a numeric token, and return it.
  4484. consumeNumericToken();
  4485. } else {
  4486. // Otherwise, return a <delim-token> with its value set to the current input code point.
  4487. type = TYPE$F.Delim;
  4488. offset++;
  4489. }
  4490. break;
  4491. // U+002F SOLIDUS (/)
  4492. case 0x002F:
  4493. // If the next two input code point are U+002F SOLIDUS (/) followed by a U+002A ASTERISK (*),
  4494. if (getCharCode(offset + 1) === 0x002A) {
  4495. // ... consume them and all following code points up to and including the first U+002A ASTERISK (*)
  4496. // followed by a U+002F SOLIDUS (/), or up to an EOF code point.
  4497. type = TYPE$F.Comment;
  4498. offset = source.indexOf('*/', offset + 2) + 2;
  4499. if (offset === 1) {
  4500. offset = source.length;
  4501. }
  4502. } else {
  4503. type = TYPE$F.Delim;
  4504. offset++;
  4505. }
  4506. break;
  4507. // U+003A COLON (:)
  4508. case 0x003A:
  4509. // Return a <colon-token>.
  4510. type = TYPE$F.Colon;
  4511. offset++;
  4512. break;
  4513. // U+003B SEMICOLON (;)
  4514. case 0x003B:
  4515. // Return a <semicolon-token>.
  4516. type = TYPE$F.Semicolon;
  4517. offset++;
  4518. break;
  4519. // U+003C LESS-THAN SIGN (<)
  4520. case 0x003C:
  4521. // If the next 3 input code points are U+0021 EXCLAMATION MARK U+002D HYPHEN-MINUS U+002D HYPHEN-MINUS (!--), ...
  4522. if (getCharCode(offset + 1) === 0x0021 &&
  4523. getCharCode(offset + 2) === 0x002D &&
  4524. getCharCode(offset + 3) === 0x002D) {
  4525. // ... consume them and return a <CDO-token>.
  4526. type = TYPE$F.CDO;
  4527. offset = offset + 4;
  4528. } else {
  4529. // Otherwise, return a <delim-token> with its value set to the current input code point.
  4530. type = TYPE$F.Delim;
  4531. offset++;
  4532. }
  4533. break;
  4534. // U+0040 COMMERCIAL AT (@)
  4535. case 0x0040:
  4536. // If the next 3 input code points would start an identifier, ...
  4537. if (isIdentifierStart$1(getCharCode(offset + 1), getCharCode(offset + 2), getCharCode(offset + 3))) {
  4538. // ... consume a name, create an <at-keyword-token> with its value set to the returned value, and return it.
  4539. type = TYPE$F.AtKeyword;
  4540. offset = consumeName(source, offset + 1);
  4541. } else {
  4542. // Otherwise, return a <delim-token> with its value set to the current input code point.
  4543. type = TYPE$F.Delim;
  4544. offset++;
  4545. }
  4546. break;
  4547. // U+005B LEFT SQUARE BRACKET ([)
  4548. case 0x005B:
  4549. // Return a <[-token>.
  4550. type = TYPE$F.LeftSquareBracket;
  4551. offset++;
  4552. break;
  4553. // U+005C REVERSE SOLIDUS (\)
  4554. case 0x005C:
  4555. // If the input stream starts with a valid escape, ...
  4556. if (isValidEscape(code, getCharCode(offset + 1))) {
  4557. // ... reconsume the current input code point, consume an ident-like token, and return it.
  4558. consumeIdentLikeToken();
  4559. } else {
  4560. // Otherwise, this is a parse error. Return a <delim-token> with its value set to the current input code point.
  4561. type = TYPE$F.Delim;
  4562. offset++;
  4563. }
  4564. break;
  4565. // U+005D RIGHT SQUARE BRACKET (])
  4566. case 0x005D:
  4567. // Return a <]-token>.
  4568. type = TYPE$F.RightSquareBracket;
  4569. offset++;
  4570. break;
  4571. // U+007B LEFT CURLY BRACKET ({)
  4572. case 0x007B:
  4573. // Return a <{-token>.
  4574. type = TYPE$F.LeftCurlyBracket;
  4575. offset++;
  4576. break;
  4577. // U+007D RIGHT CURLY BRACKET (})
  4578. case 0x007D:
  4579. // Return a <}-token>.
  4580. type = TYPE$F.RightCurlyBracket;
  4581. offset++;
  4582. break;
  4583. // digit
  4584. case charCodeCategory.Digit:
  4585. // Reconsume the current input code point, consume a numeric token, and return it.
  4586. consumeNumericToken();
  4587. break;
  4588. // name-start code point
  4589. case charCodeCategory.NameStart:
  4590. // Reconsume the current input code point, consume an ident-like token, and return it.
  4591. consumeIdentLikeToken();
  4592. break;
  4593. // EOF
  4594. case charCodeCategory.Eof:
  4595. // Return an <EOF-token>.
  4596. break;
  4597. // anything else
  4598. default:
  4599. // Return a <delim-token> with its value set to the current input code point.
  4600. type = TYPE$F.Delim;
  4601. offset++;
  4602. }
  4603. switch (type) {
  4604. case balanceCloseType:
  4605. balancePrev = balanceStart & OFFSET_MASK;
  4606. balanceStart = balance[balancePrev];
  4607. balanceCloseType = balanceStart >> TYPE_SHIFT;
  4608. balance[tokenCount] = balancePrev;
  4609. balance[balancePrev++] = tokenCount;
  4610. for (; balancePrev < tokenCount; balancePrev++) {
  4611. if (balance[balancePrev] === sourceLength) {
  4612. balance[balancePrev] = tokenCount;
  4613. }
  4614. }
  4615. break;
  4616. case TYPE$F.LeftParenthesis:
  4617. case TYPE$F.Function:
  4618. balance[tokenCount] = balanceStart;
  4619. balanceCloseType = TYPE$F.RightParenthesis;
  4620. balanceStart = (balanceCloseType << TYPE_SHIFT) | tokenCount;
  4621. break;
  4622. case TYPE$F.LeftSquareBracket:
  4623. balance[tokenCount] = balanceStart;
  4624. balanceCloseType = TYPE$F.RightSquareBracket;
  4625. balanceStart = (balanceCloseType << TYPE_SHIFT) | tokenCount;
  4626. break;
  4627. case TYPE$F.LeftCurlyBracket:
  4628. balance[tokenCount] = balanceStart;
  4629. balanceCloseType = TYPE$F.RightCurlyBracket;
  4630. balanceStart = (balanceCloseType << TYPE_SHIFT) | tokenCount;
  4631. break;
  4632. }
  4633. offsetAndType[tokenCount++] = (type << TYPE_SHIFT) | offset;
  4634. }
  4635. // finalize buffers
  4636. offsetAndType[tokenCount] = (TYPE$F.EOF << TYPE_SHIFT) | offset; // <EOF-token>
  4637. balance[tokenCount] = sourceLength;
  4638. balance[sourceLength] = sourceLength; // prevents false positive balance match with any token
  4639. while (balanceStart !== 0) {
  4640. balancePrev = balanceStart & OFFSET_MASK;
  4641. balanceStart = balance[balancePrev];
  4642. balance[balancePrev] = sourceLength;
  4643. }
  4644. // update stream
  4645. stream.source = source;
  4646. stream.firstCharOffset = start;
  4647. stream.offsetAndType = offsetAndType;
  4648. stream.tokenCount = tokenCount;
  4649. stream.balance = balance;
  4650. stream.reset();
  4651. stream.next();
  4652. return stream;
  4653. }
  4654. // extend tokenizer with constants
  4655. Object.keys(constants$1).forEach(function(key) {
  4656. tokenize$3[key] = constants$1[key];
  4657. });
  4658. // extend tokenizer with static methods from utils
  4659. Object.keys(charCodeDefinitions).forEach(function(key) {
  4660. tokenize$3[key] = charCodeDefinitions[key];
  4661. });
  4662. Object.keys(utils).forEach(function(key) {
  4663. tokenize$3[key] = utils[key];
  4664. });
  4665. var tokenizer$3 = tokenize$3;
  4666. var isDigit$3 = tokenizer$3.isDigit;
  4667. var cmpChar$4 = tokenizer$3.cmpChar;
  4668. var TYPE$E = tokenizer$3.TYPE;
  4669. var DELIM$6 = TYPE$E.Delim;
  4670. var WHITESPACE$b = TYPE$E.WhiteSpace;
  4671. var COMMENT$9 = TYPE$E.Comment;
  4672. var IDENT$i = TYPE$E.Ident;
  4673. var NUMBER$9 = TYPE$E.Number;
  4674. var DIMENSION$7 = TYPE$E.Dimension;
  4675. var PLUSSIGN$8 = 0x002B; // U+002B PLUS SIGN (+)
  4676. var HYPHENMINUS$4 = 0x002D; // U+002D HYPHEN-MINUS (-)
  4677. var N$4 = 0x006E; // U+006E LATIN SMALL LETTER N (n)
  4678. var DISALLOW_SIGN$1 = true;
  4679. var ALLOW_SIGN$1 = false;
  4680. function isDelim$1(token, code) {
  4681. return token !== null && token.type === DELIM$6 && token.value.charCodeAt(0) === code;
  4682. }
  4683. function skipSC(token, offset, getNextToken) {
  4684. while (token !== null && (token.type === WHITESPACE$b || token.type === COMMENT$9)) {
  4685. token = getNextToken(++offset);
  4686. }
  4687. return offset;
  4688. }
  4689. function checkInteger$1(token, valueOffset, disallowSign, offset) {
  4690. if (!token) {
  4691. return 0;
  4692. }
  4693. var code = token.value.charCodeAt(valueOffset);
  4694. if (code === PLUSSIGN$8 || code === HYPHENMINUS$4) {
  4695. if (disallowSign) {
  4696. // Number sign is not allowed
  4697. return 0;
  4698. }
  4699. valueOffset++;
  4700. }
  4701. for (; valueOffset < token.value.length; valueOffset++) {
  4702. if (!isDigit$3(token.value.charCodeAt(valueOffset))) {
  4703. // Integer is expected
  4704. return 0;
  4705. }
  4706. }
  4707. return offset + 1;
  4708. }
  4709. // ... <signed-integer>
  4710. // ... ['+' | '-'] <signless-integer>
  4711. function consumeB$1(token, offset_, getNextToken) {
  4712. var sign = false;
  4713. var offset = skipSC(token, offset_, getNextToken);
  4714. token = getNextToken(offset);
  4715. if (token === null) {
  4716. return offset_;
  4717. }
  4718. if (token.type !== NUMBER$9) {
  4719. if (isDelim$1(token, PLUSSIGN$8) || isDelim$1(token, HYPHENMINUS$4)) {
  4720. sign = true;
  4721. offset = skipSC(getNextToken(++offset), offset, getNextToken);
  4722. token = getNextToken(offset);
  4723. if (token === null && token.type !== NUMBER$9) {
  4724. return 0;
  4725. }
  4726. } else {
  4727. return offset_;
  4728. }
  4729. }
  4730. if (!sign) {
  4731. var code = token.value.charCodeAt(0);
  4732. if (code !== PLUSSIGN$8 && code !== HYPHENMINUS$4) {
  4733. // Number sign is expected
  4734. return 0;
  4735. }
  4736. }
  4737. return checkInteger$1(token, sign ? 0 : 1, sign, offset);
  4738. }
  4739. // An+B microsyntax https://www.w3.org/TR/css-syntax-3/#anb
  4740. var genericAnPlusB = function anPlusB(token, getNextToken) {
  4741. /* eslint-disable brace-style*/
  4742. var offset = 0;
  4743. if (!token) {
  4744. return 0;
  4745. }
  4746. // <integer>
  4747. if (token.type === NUMBER$9) {
  4748. return checkInteger$1(token, 0, ALLOW_SIGN$1, offset); // b
  4749. }
  4750. // -n
  4751. // -n <signed-integer>
  4752. // -n ['+' | '-'] <signless-integer>
  4753. // -n- <signless-integer>
  4754. // <dashndashdigit-ident>
  4755. else if (token.type === IDENT$i && token.value.charCodeAt(0) === HYPHENMINUS$4) {
  4756. // expect 1st char is N
  4757. if (!cmpChar$4(token.value, 1, N$4)) {
  4758. return 0;
  4759. }
  4760. switch (token.value.length) {
  4761. // -n
  4762. // -n <signed-integer>
  4763. // -n ['+' | '-'] <signless-integer>
  4764. case 2:
  4765. return consumeB$1(getNextToken(++offset), offset, getNextToken);
  4766. // -n- <signless-integer>
  4767. case 3:
  4768. if (token.value.charCodeAt(2) !== HYPHENMINUS$4) {
  4769. return 0;
  4770. }
  4771. offset = skipSC(getNextToken(++offset), offset, getNextToken);
  4772. token = getNextToken(offset);
  4773. return checkInteger$1(token, 0, DISALLOW_SIGN$1, offset);
  4774. // <dashndashdigit-ident>
  4775. default:
  4776. if (token.value.charCodeAt(2) !== HYPHENMINUS$4) {
  4777. return 0;
  4778. }
  4779. return checkInteger$1(token, 3, DISALLOW_SIGN$1, offset);
  4780. }
  4781. }
  4782. // '+'? n
  4783. // '+'? n <signed-integer>
  4784. // '+'? n ['+' | '-'] <signless-integer>
  4785. // '+'? n- <signless-integer>
  4786. // '+'? <ndashdigit-ident>
  4787. else if (token.type === IDENT$i || (isDelim$1(token, PLUSSIGN$8) && getNextToken(offset + 1).type === IDENT$i)) {
  4788. // just ignore a plus
  4789. if (token.type !== IDENT$i) {
  4790. token = getNextToken(++offset);
  4791. }
  4792. if (token === null || !cmpChar$4(token.value, 0, N$4)) {
  4793. return 0;
  4794. }
  4795. switch (token.value.length) {
  4796. // '+'? n
  4797. // '+'? n <signed-integer>
  4798. // '+'? n ['+' | '-'] <signless-integer>
  4799. case 1:
  4800. return consumeB$1(getNextToken(++offset), offset, getNextToken);
  4801. // '+'? n- <signless-integer>
  4802. case 2:
  4803. if (token.value.charCodeAt(1) !== HYPHENMINUS$4) {
  4804. return 0;
  4805. }
  4806. offset = skipSC(getNextToken(++offset), offset, getNextToken);
  4807. token = getNextToken(offset);
  4808. return checkInteger$1(token, 0, DISALLOW_SIGN$1, offset);
  4809. // '+'? <ndashdigit-ident>
  4810. default:
  4811. if (token.value.charCodeAt(1) !== HYPHENMINUS$4) {
  4812. return 0;
  4813. }
  4814. return checkInteger$1(token, 2, DISALLOW_SIGN$1, offset);
  4815. }
  4816. }
  4817. // <ndashdigit-dimension>
  4818. // <ndash-dimension> <signless-integer>
  4819. // <n-dimension>
  4820. // <n-dimension> <signed-integer>
  4821. // <n-dimension> ['+' | '-'] <signless-integer>
  4822. else if (token.type === DIMENSION$7) {
  4823. var code = token.value.charCodeAt(0);
  4824. var sign = code === PLUSSIGN$8 || code === HYPHENMINUS$4 ? 1 : 0;
  4825. for (var i = sign; i < token.value.length; i++) {
  4826. if (!isDigit$3(token.value.charCodeAt(i))) {
  4827. break;
  4828. }
  4829. }
  4830. if (i === sign) {
  4831. // Integer is expected
  4832. return 0;
  4833. }
  4834. if (!cmpChar$4(token.value, i, N$4)) {
  4835. return 0;
  4836. }
  4837. // <n-dimension>
  4838. // <n-dimension> <signed-integer>
  4839. // <n-dimension> ['+' | '-'] <signless-integer>
  4840. if (i + 1 === token.value.length) {
  4841. return consumeB$1(getNextToken(++offset), offset, getNextToken);
  4842. } else {
  4843. if (token.value.charCodeAt(i + 1) !== HYPHENMINUS$4) {
  4844. return 0;
  4845. }
  4846. // <ndash-dimension> <signless-integer>
  4847. if (i + 2 === token.value.length) {
  4848. offset = skipSC(getNextToken(++offset), offset, getNextToken);
  4849. token = getNextToken(offset);
  4850. return checkInteger$1(token, 0, DISALLOW_SIGN$1, offset);
  4851. }
  4852. // <ndashdigit-dimension>
  4853. else {
  4854. return checkInteger$1(token, i + 2, DISALLOW_SIGN$1, offset);
  4855. }
  4856. }
  4857. }
  4858. return 0;
  4859. };
  4860. var isHexDigit$2 = tokenizer$3.isHexDigit;
  4861. var cmpChar$3 = tokenizer$3.cmpChar;
  4862. var TYPE$D = tokenizer$3.TYPE;
  4863. var IDENT$h = TYPE$D.Ident;
  4864. var DELIM$5 = TYPE$D.Delim;
  4865. var NUMBER$8 = TYPE$D.Number;
  4866. var DIMENSION$6 = TYPE$D.Dimension;
  4867. var PLUSSIGN$7 = 0x002B; // U+002B PLUS SIGN (+)
  4868. var HYPHENMINUS$3 = 0x002D; // U+002D HYPHEN-MINUS (-)
  4869. var QUESTIONMARK$2 = 0x003F; // U+003F QUESTION MARK (?)
  4870. var U$2 = 0x0075; // U+0075 LATIN SMALL LETTER U (u)
  4871. function isDelim(token, code) {
  4872. return token !== null && token.type === DELIM$5 && token.value.charCodeAt(0) === code;
  4873. }
  4874. function startsWith$1(token, code) {
  4875. return token.value.charCodeAt(0) === code;
  4876. }
  4877. function hexSequence(token, offset, allowDash) {
  4878. for (var pos = offset, hexlen = 0; pos < token.value.length; pos++) {
  4879. var code = token.value.charCodeAt(pos);
  4880. if (code === HYPHENMINUS$3 && allowDash && hexlen !== 0) {
  4881. if (hexSequence(token, offset + hexlen + 1, false) > 0) {
  4882. return 6; // dissallow following question marks
  4883. }
  4884. return 0; // dash at the ending of a hex sequence is not allowed
  4885. }
  4886. if (!isHexDigit$2(code)) {
  4887. return 0; // not a hex digit
  4888. }
  4889. if (++hexlen > 6) {
  4890. return 0; // too many hex digits
  4891. } }
  4892. return hexlen;
  4893. }
  4894. function withQuestionMarkSequence(consumed, length, getNextToken) {
  4895. if (!consumed) {
  4896. return 0; // nothing consumed
  4897. }
  4898. while (isDelim(getNextToken(length), QUESTIONMARK$2)) {
  4899. if (++consumed > 6) {
  4900. return 0; // too many question marks
  4901. }
  4902. length++;
  4903. }
  4904. return length;
  4905. }
  4906. // https://drafts.csswg.org/css-syntax/#urange
  4907. // Informally, the <urange> production has three forms:
  4908. // U+0001
  4909. // Defines a range consisting of a single code point, in this case the code point "1".
  4910. // U+0001-00ff
  4911. // Defines a range of codepoints between the first and the second value, in this case
  4912. // the range between "1" and "ff" (255 in decimal) inclusive.
  4913. // U+00??
  4914. // Defines a range of codepoints where the "?" characters range over all hex digits,
  4915. // in this case defining the same as the value U+0000-00ff.
  4916. // In each form, a maximum of 6 digits is allowed for each hexadecimal number (if you treat "?" as a hexadecimal digit).
  4917. //
  4918. // <urange> =
  4919. // u '+' <ident-token> '?'* |
  4920. // u <dimension-token> '?'* |
  4921. // u <number-token> '?'* |
  4922. // u <number-token> <dimension-token> |
  4923. // u <number-token> <number-token> |
  4924. // u '+' '?'+
  4925. var genericUrange = function urange(token, getNextToken) {
  4926. var length = 0;
  4927. // should start with `u` or `U`
  4928. if (token === null || token.type !== IDENT$h || !cmpChar$3(token.value, 0, U$2)) {
  4929. return 0;
  4930. }
  4931. token = getNextToken(++length);
  4932. if (token === null) {
  4933. return 0;
  4934. }
  4935. // u '+' <ident-token> '?'*
  4936. // u '+' '?'+
  4937. if (isDelim(token, PLUSSIGN$7)) {
  4938. token = getNextToken(++length);
  4939. if (token === null) {
  4940. return 0;
  4941. }
  4942. if (token.type === IDENT$h) {
  4943. // u '+' <ident-token> '?'*
  4944. return withQuestionMarkSequence(hexSequence(token, 0, true), ++length, getNextToken);
  4945. }
  4946. if (isDelim(token, QUESTIONMARK$2)) {
  4947. // u '+' '?'+
  4948. return withQuestionMarkSequence(1, ++length, getNextToken);
  4949. }
  4950. // Hex digit or question mark is expected
  4951. return 0;
  4952. }
  4953. // u <number-token> '?'*
  4954. // u <number-token> <dimension-token>
  4955. // u <number-token> <number-token>
  4956. if (token.type === NUMBER$8) {
  4957. if (!startsWith$1(token, PLUSSIGN$7)) {
  4958. return 0;
  4959. }
  4960. var consumedHexLength = hexSequence(token, 1, true);
  4961. if (consumedHexLength === 0) {
  4962. return 0;
  4963. }
  4964. token = getNextToken(++length);
  4965. if (token === null) {
  4966. // u <number-token> <eof>
  4967. return length;
  4968. }
  4969. if (token.type === DIMENSION$6 || token.type === NUMBER$8) {
  4970. // u <number-token> <dimension-token>
  4971. // u <number-token> <number-token>
  4972. if (!startsWith$1(token, HYPHENMINUS$3) || !hexSequence(token, 1, false)) {
  4973. return 0;
  4974. }
  4975. return length + 1;
  4976. }
  4977. // u <number-token> '?'*
  4978. return withQuestionMarkSequence(consumedHexLength, length, getNextToken);
  4979. }
  4980. // u <dimension-token> '?'*
  4981. if (token.type === DIMENSION$6) {
  4982. if (!startsWith$1(token, PLUSSIGN$7)) {
  4983. return 0;
  4984. }
  4985. return withQuestionMarkSequence(hexSequence(token, 1, true), ++length, getNextToken);
  4986. }
  4987. return 0;
  4988. };
  4989. var tokenizer$2 = tokenizer$3;
  4990. var isIdentifierStart = tokenizer$2.isIdentifierStart;
  4991. var isHexDigit$1 = tokenizer$2.isHexDigit;
  4992. var isDigit$2 = tokenizer$2.isDigit;
  4993. var cmpStr$3 = tokenizer$2.cmpStr;
  4994. var consumeNumber$3 = tokenizer$2.consumeNumber;
  4995. var TYPE$C = tokenizer$2.TYPE;
  4996. var anPlusB = genericAnPlusB;
  4997. var urange = genericUrange;
  4998. var cssWideKeywords$1 = ['unset', 'initial', 'inherit'];
  4999. var calcFunctionNames = ['calc(', '-moz-calc(', '-webkit-calc('];
  5000. // https://www.w3.org/TR/css-values-3/#lengths
  5001. var LENGTH = {
  5002. // absolute length units
  5003. 'px': true,
  5004. 'mm': true,
  5005. 'cm': true,
  5006. 'in': true,
  5007. 'pt': true,
  5008. 'pc': true,
  5009. 'q': true,
  5010. // relative length units
  5011. 'em': true,
  5012. 'ex': true,
  5013. 'ch': true,
  5014. 'rem': true,
  5015. // viewport-percentage lengths
  5016. 'vh': true,
  5017. 'vw': true,
  5018. 'vmin': true,
  5019. 'vmax': true,
  5020. 'vm': true
  5021. };
  5022. var ANGLE = {
  5023. 'deg': true,
  5024. 'grad': true,
  5025. 'rad': true,
  5026. 'turn': true
  5027. };
  5028. var TIME = {
  5029. 's': true,
  5030. 'ms': true
  5031. };
  5032. var FREQUENCY = {
  5033. 'hz': true,
  5034. 'khz': true
  5035. };
  5036. // https://www.w3.org/TR/css-values-3/#resolution (https://drafts.csswg.org/css-values/#resolution)
  5037. var RESOLUTION = {
  5038. 'dpi': true,
  5039. 'dpcm': true,
  5040. 'dppx': true,
  5041. 'x': true // https://github.com/w3c/csswg-drafts/issues/461
  5042. };
  5043. // https://drafts.csswg.org/css-grid/#fr-unit
  5044. var FLEX = {
  5045. 'fr': true
  5046. };
  5047. // https://www.w3.org/TR/css3-speech/#mixing-props-voice-volume
  5048. var DECIBEL = {
  5049. 'db': true
  5050. };
  5051. // https://www.w3.org/TR/css3-speech/#voice-props-voice-pitch
  5052. var SEMITONES = {
  5053. 'st': true
  5054. };
  5055. // safe char code getter
  5056. function charCode(str, index) {
  5057. return index < str.length ? str.charCodeAt(index) : 0;
  5058. }
  5059. function eqStr(actual, expected) {
  5060. return cmpStr$3(actual, 0, actual.length, expected);
  5061. }
  5062. function eqStrAny(actual, expected) {
  5063. for (var i = 0; i < expected.length; i++) {
  5064. if (eqStr(actual, expected[i])) {
  5065. return true;
  5066. }
  5067. }
  5068. return false;
  5069. }
  5070. // IE postfix hack, i.e. 123\0 or 123px\9
  5071. function isPostfixIeHack(str, offset) {
  5072. if (offset !== str.length - 2) {
  5073. return false;
  5074. }
  5075. return (
  5076. str.charCodeAt(offset) === 0x005C && // U+005C REVERSE SOLIDUS (\)
  5077. isDigit$2(str.charCodeAt(offset + 1))
  5078. );
  5079. }
  5080. function outOfRange(opts, value, numEnd) {
  5081. if (opts && opts.type === 'Range') {
  5082. var num = Number(
  5083. numEnd !== undefined && numEnd !== value.length
  5084. ? value.substr(0, numEnd)
  5085. : value
  5086. );
  5087. if (isNaN(num)) {
  5088. return true;
  5089. }
  5090. if (opts.min !== null && num < opts.min) {
  5091. return true;
  5092. }
  5093. if (opts.max !== null && num > opts.max) {
  5094. return true;
  5095. }
  5096. }
  5097. return false;
  5098. }
  5099. function consumeFunction(token, getNextToken) {
  5100. var startIdx = token.index;
  5101. var length = 0;
  5102. // balanced token consuming
  5103. do {
  5104. length++;
  5105. if (token.balance <= startIdx) {
  5106. break;
  5107. }
  5108. } while (token = getNextToken(length));
  5109. return length;
  5110. }
  5111. // TODO: implement
  5112. // can be used wherever <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> values are allowed
  5113. // https://drafts.csswg.org/css-values/#calc-notation
  5114. function calc(next) {
  5115. return function(token, getNextToken, opts) {
  5116. if (token === null) {
  5117. return 0;
  5118. }
  5119. if (token.type === TYPE$C.Function && eqStrAny(token.value, calcFunctionNames)) {
  5120. return consumeFunction(token, getNextToken);
  5121. }
  5122. return next(token, getNextToken, opts);
  5123. };
  5124. }
  5125. function tokenType(expectedTokenType) {
  5126. return function(token) {
  5127. if (token === null || token.type !== expectedTokenType) {
  5128. return 0;
  5129. }
  5130. return 1;
  5131. };
  5132. }
  5133. function func(name) {
  5134. name = name + '(';
  5135. return function(token, getNextToken) {
  5136. if (token !== null && eqStr(token.value, name)) {
  5137. return consumeFunction(token, getNextToken);
  5138. }
  5139. return 0;
  5140. };
  5141. }
  5142. // =========================
  5143. // Complex types
  5144. //
  5145. // https://drafts.csswg.org/css-values-4/#custom-idents
  5146. // 4.2. Author-defined Identifiers: the <custom-ident> type
  5147. // Some properties accept arbitrary author-defined identifiers as a component value.
  5148. // This generic data type is denoted by <custom-ident>, and represents any valid CSS identifier
  5149. // that would not be misinterpreted as a pre-defined keyword in that property’s value definition.
  5150. //
  5151. // See also: https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident
  5152. function customIdent(token) {
  5153. if (token === null || token.type !== TYPE$C.Ident) {
  5154. return 0;
  5155. }
  5156. var name = token.value.toLowerCase();
  5157. // The CSS-wide keywords are not valid <custom-ident>s
  5158. if (eqStrAny(name, cssWideKeywords$1)) {
  5159. return 0;
  5160. }
  5161. // The default keyword is reserved and is also not a valid <custom-ident>
  5162. if (eqStr(name, 'default')) {
  5163. return 0;
  5164. }
  5165. // TODO: ignore property specific keywords (as described https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident)
  5166. // Specifications using <custom-ident> must specify clearly what other keywords
  5167. // are excluded from <custom-ident>, if any—for example by saying that any pre-defined keywords
  5168. // in that property’s value definition are excluded. Excluded keywords are excluded
  5169. // in all ASCII case permutations.
  5170. return 1;
  5171. }
  5172. // https://drafts.csswg.org/css-variables/#typedef-custom-property-name
  5173. // A custom property is any property whose name starts with two dashes (U+002D HYPHEN-MINUS), like --foo.
  5174. // The <custom-property-name> production corresponds to this: it’s defined as any valid identifier
  5175. // that starts with two dashes, except -- itself, which is reserved for future use by CSS.
  5176. // NOTE: Current implementation treat `--` as a valid name since most (all?) major browsers treat it as valid.
  5177. function customPropertyName(token) {
  5178. // ... defined as any valid identifier
  5179. if (token === null || token.type !== TYPE$C.Ident) {
  5180. return 0;
  5181. }
  5182. // ... that starts with two dashes (U+002D HYPHEN-MINUS)
  5183. if (charCode(token.value, 0) !== 0x002D || charCode(token.value, 1) !== 0x002D) {
  5184. return 0;
  5185. }
  5186. return 1;
  5187. }
  5188. // https://drafts.csswg.org/css-color-4/#hex-notation
  5189. // The syntax of a <hex-color> is a <hash-token> token whose value consists of 3, 4, 6, or 8 hexadecimal digits.
  5190. // In other words, a hex color is written as a hash character, "#", followed by some number of digits 0-9 or
  5191. // letters a-f (the case of the letters doesn’t matter - #00ff00 is identical to #00FF00).
  5192. function hexColor(token) {
  5193. if (token === null || token.type !== TYPE$C.Hash) {
  5194. return 0;
  5195. }
  5196. var length = token.value.length;
  5197. // valid values (length): #rgb (4), #rgba (5), #rrggbb (7), #rrggbbaa (9)
  5198. if (length !== 4 && length !== 5 && length !== 7 && length !== 9) {
  5199. return 0;
  5200. }
  5201. for (var i = 1; i < length; i++) {
  5202. if (!isHexDigit$1(token.value.charCodeAt(i))) {
  5203. return 0;
  5204. }
  5205. }
  5206. return 1;
  5207. }
  5208. function idSelector(token) {
  5209. if (token === null || token.type !== TYPE$C.Hash) {
  5210. return 0;
  5211. }
  5212. if (!isIdentifierStart(charCode(token.value, 1), charCode(token.value, 2), charCode(token.value, 3))) {
  5213. return 0;
  5214. }
  5215. return 1;
  5216. }
  5217. // https://drafts.csswg.org/css-syntax/#any-value
  5218. // It represents the entirety of what a valid declaration can have as its value.
  5219. function declarationValue(token, getNextToken) {
  5220. if (!token) {
  5221. return 0;
  5222. }
  5223. var length = 0;
  5224. var level = 0;
  5225. var startIdx = token.index;
  5226. // The <declaration-value> production matches any sequence of one or more tokens,
  5227. // so long as the sequence ...
  5228. scan:
  5229. do {
  5230. switch (token.type) {
  5231. // ... does not contain <bad-string-token>, <bad-url-token>,
  5232. case TYPE$C.BadString:
  5233. case TYPE$C.BadUrl:
  5234. break scan;
  5235. // ... unmatched <)-token>, <]-token>, or <}-token>,
  5236. case TYPE$C.RightCurlyBracket:
  5237. case TYPE$C.RightParenthesis:
  5238. case TYPE$C.RightSquareBracket:
  5239. if (token.balance > token.index || token.balance < startIdx) {
  5240. break scan;
  5241. }
  5242. level--;
  5243. break;
  5244. // ... or top-level <semicolon-token> tokens
  5245. case TYPE$C.Semicolon:
  5246. if (level === 0) {
  5247. break scan;
  5248. }
  5249. break;
  5250. // ... or <delim-token> tokens with a value of "!"
  5251. case TYPE$C.Delim:
  5252. if (token.value === '!' && level === 0) {
  5253. break scan;
  5254. }
  5255. break;
  5256. case TYPE$C.Function:
  5257. case TYPE$C.LeftParenthesis:
  5258. case TYPE$C.LeftSquareBracket:
  5259. case TYPE$C.LeftCurlyBracket:
  5260. level++;
  5261. break;
  5262. }
  5263. length++;
  5264. // until balance closing
  5265. if (token.balance <= startIdx) {
  5266. break;
  5267. }
  5268. } while (token = getNextToken(length));
  5269. return length;
  5270. }
  5271. // https://drafts.csswg.org/css-syntax/#any-value
  5272. // The <any-value> production is identical to <declaration-value>, but also
  5273. // allows top-level <semicolon-token> tokens and <delim-token> tokens
  5274. // with a value of "!". It represents the entirety of what valid CSS can be in any context.
  5275. function anyValue(token, getNextToken) {
  5276. if (!token) {
  5277. return 0;
  5278. }
  5279. var startIdx = token.index;
  5280. var length = 0;
  5281. // The <any-value> production matches any sequence of one or more tokens,
  5282. // so long as the sequence ...
  5283. scan:
  5284. do {
  5285. switch (token.type) {
  5286. // ... does not contain <bad-string-token>, <bad-url-token>,
  5287. case TYPE$C.BadString:
  5288. case TYPE$C.BadUrl:
  5289. break scan;
  5290. // ... unmatched <)-token>, <]-token>, or <}-token>,
  5291. case TYPE$C.RightCurlyBracket:
  5292. case TYPE$C.RightParenthesis:
  5293. case TYPE$C.RightSquareBracket:
  5294. if (token.balance > token.index || token.balance < startIdx) {
  5295. break scan;
  5296. }
  5297. break;
  5298. }
  5299. length++;
  5300. // until balance closing
  5301. if (token.balance <= startIdx) {
  5302. break;
  5303. }
  5304. } while (token = getNextToken(length));
  5305. return length;
  5306. }
  5307. // =========================
  5308. // Dimensions
  5309. //
  5310. function dimension(type) {
  5311. return function(token, getNextToken, opts) {
  5312. if (token === null || token.type !== TYPE$C.Dimension) {
  5313. return 0;
  5314. }
  5315. var numberEnd = consumeNumber$3(token.value, 0);
  5316. // check unit
  5317. if (type !== null) {
  5318. // check for IE postfix hack, i.e. 123px\0 or 123px\9
  5319. var reverseSolidusOffset = token.value.indexOf('\\', numberEnd);
  5320. var unit = reverseSolidusOffset === -1 || !isPostfixIeHack(token.value, reverseSolidusOffset)
  5321. ? token.value.substr(numberEnd)
  5322. : token.value.substring(numberEnd, reverseSolidusOffset);
  5323. if (type.hasOwnProperty(unit.toLowerCase()) === false) {
  5324. return 0;
  5325. }
  5326. }
  5327. // check range if specified
  5328. if (outOfRange(opts, token.value, numberEnd)) {
  5329. return 0;
  5330. }
  5331. return 1;
  5332. };
  5333. }
  5334. // =========================
  5335. // Percentage
  5336. //
  5337. // §5.5. Percentages: the <percentage> type
  5338. // https://drafts.csswg.org/css-values-4/#percentages
  5339. function percentage(token, getNextToken, opts) {
  5340. // ... corresponds to the <percentage-token> production
  5341. if (token === null || token.type !== TYPE$C.Percentage) {
  5342. return 0;
  5343. }
  5344. // check range if specified
  5345. if (outOfRange(opts, token.value, token.value.length - 1)) {
  5346. return 0;
  5347. }
  5348. return 1;
  5349. }
  5350. // =========================
  5351. // Numeric
  5352. //
  5353. // https://drafts.csswg.org/css-values-4/#numbers
  5354. // The value <zero> represents a literal number with the value 0. Expressions that merely
  5355. // evaluate to a <number> with the value 0 (for example, calc(0)) do not match <zero>;
  5356. // only literal <number-token>s do.
  5357. function zero(next) {
  5358. if (typeof next !== 'function') {
  5359. next = function() {
  5360. return 0;
  5361. };
  5362. }
  5363. return function(token, getNextToken, opts) {
  5364. if (token !== null && token.type === TYPE$C.Number) {
  5365. if (Number(token.value) === 0) {
  5366. return 1;
  5367. }
  5368. }
  5369. return next(token, getNextToken, opts);
  5370. };
  5371. }
  5372. // § 5.3. Real Numbers: the <number> type
  5373. // https://drafts.csswg.org/css-values-4/#numbers
  5374. // Number values are denoted by <number>, and represent real numbers, possibly with a fractional component.
  5375. // ... It corresponds to the <number-token> production
  5376. function number(token, getNextToken, opts) {
  5377. if (token === null) {
  5378. return 0;
  5379. }
  5380. var numberEnd = consumeNumber$3(token.value, 0);
  5381. var isNumber = numberEnd === token.value.length;
  5382. if (!isNumber && !isPostfixIeHack(token.value, numberEnd)) {
  5383. return 0;
  5384. }
  5385. // check range if specified
  5386. if (outOfRange(opts, token.value, numberEnd)) {
  5387. return 0;
  5388. }
  5389. return 1;
  5390. }
  5391. // §5.2. Integers: the <integer> type
  5392. // https://drafts.csswg.org/css-values-4/#integers
  5393. function integer(token, getNextToken, opts) {
  5394. // ... corresponds to a subset of the <number-token> production
  5395. if (token === null || token.type !== TYPE$C.Number) {
  5396. return 0;
  5397. }
  5398. // The first digit of an integer may be immediately preceded by `-` or `+` to indicate the integer’s sign.
  5399. var i = token.value.charCodeAt(0) === 0x002B || // U+002B PLUS SIGN (+)
  5400. token.value.charCodeAt(0) === 0x002D ? 1 : 0; // U+002D HYPHEN-MINUS (-)
  5401. // When written literally, an integer is one or more decimal digits 0 through 9 ...
  5402. for (; i < token.value.length; i++) {
  5403. if (!isDigit$2(token.value.charCodeAt(i))) {
  5404. return 0;
  5405. }
  5406. }
  5407. // check range if specified
  5408. if (outOfRange(opts, token.value, i)) {
  5409. return 0;
  5410. }
  5411. return 1;
  5412. }
  5413. var generic$1 = {
  5414. // token types
  5415. 'ident-token': tokenType(TYPE$C.Ident),
  5416. 'function-token': tokenType(TYPE$C.Function),
  5417. 'at-keyword-token': tokenType(TYPE$C.AtKeyword),
  5418. 'hash-token': tokenType(TYPE$C.Hash),
  5419. 'string-token': tokenType(TYPE$C.String),
  5420. 'bad-string-token': tokenType(TYPE$C.BadString),
  5421. 'url-token': tokenType(TYPE$C.Url),
  5422. 'bad-url-token': tokenType(TYPE$C.BadUrl),
  5423. 'delim-token': tokenType(TYPE$C.Delim),
  5424. 'number-token': tokenType(TYPE$C.Number),
  5425. 'percentage-token': tokenType(TYPE$C.Percentage),
  5426. 'dimension-token': tokenType(TYPE$C.Dimension),
  5427. 'whitespace-token': tokenType(TYPE$C.WhiteSpace),
  5428. 'CDO-token': tokenType(TYPE$C.CDO),
  5429. 'CDC-token': tokenType(TYPE$C.CDC),
  5430. 'colon-token': tokenType(TYPE$C.Colon),
  5431. 'semicolon-token': tokenType(TYPE$C.Semicolon),
  5432. 'comma-token': tokenType(TYPE$C.Comma),
  5433. '[-token': tokenType(TYPE$C.LeftSquareBracket),
  5434. ']-token': tokenType(TYPE$C.RightSquareBracket),
  5435. '(-token': tokenType(TYPE$C.LeftParenthesis),
  5436. ')-token': tokenType(TYPE$C.RightParenthesis),
  5437. '{-token': tokenType(TYPE$C.LeftCurlyBracket),
  5438. '}-token': tokenType(TYPE$C.RightCurlyBracket),
  5439. // token type aliases
  5440. 'string': tokenType(TYPE$C.String),
  5441. 'ident': tokenType(TYPE$C.Ident),
  5442. // complex types
  5443. 'custom-ident': customIdent,
  5444. 'custom-property-name': customPropertyName,
  5445. 'hex-color': hexColor,
  5446. 'id-selector': idSelector, // element( <id-selector> )
  5447. 'an-plus-b': anPlusB,
  5448. 'urange': urange,
  5449. 'declaration-value': declarationValue,
  5450. 'any-value': anyValue,
  5451. // dimensions
  5452. 'dimension': calc(dimension(null)),
  5453. 'angle': calc(dimension(ANGLE)),
  5454. 'decibel': calc(dimension(DECIBEL)),
  5455. 'frequency': calc(dimension(FREQUENCY)),
  5456. 'flex': calc(dimension(FLEX)),
  5457. 'length': calc(zero(dimension(LENGTH))),
  5458. 'resolution': calc(dimension(RESOLUTION)),
  5459. 'semitones': calc(dimension(SEMITONES)),
  5460. 'time': calc(dimension(TIME)),
  5461. // percentage
  5462. 'percentage': calc(percentage),
  5463. // numeric
  5464. 'zero': zero(),
  5465. 'number': calc(number),
  5466. 'integer': calc(integer),
  5467. // old IE stuff
  5468. '-ms-legacy-expression': func('expression')
  5469. };
  5470. var createCustomError = createCustomError$3;
  5471. var _SyntaxError = function SyntaxError(message, input, offset) {
  5472. var error = createCustomError('SyntaxError', message);
  5473. error.input = input;
  5474. error.offset = offset;
  5475. error.rawMessage = message;
  5476. error.message = error.rawMessage + '\n' +
  5477. ' ' + error.input + '\n' +
  5478. '--' + new Array((error.offset || error.input.length) + 1).join('-') + '^';
  5479. return error;
  5480. };
  5481. var SyntaxError$3 = _SyntaxError;
  5482. var TAB$1 = 9;
  5483. var N$3 = 10;
  5484. var F$2 = 12;
  5485. var R$2 = 13;
  5486. var SPACE$2 = 32;
  5487. var Tokenizer$1 = function(str) {
  5488. this.str = str;
  5489. this.pos = 0;
  5490. };
  5491. Tokenizer$1.prototype = {
  5492. charCodeAt: function(pos) {
  5493. return pos < this.str.length ? this.str.charCodeAt(pos) : 0;
  5494. },
  5495. charCode: function() {
  5496. return this.charCodeAt(this.pos);
  5497. },
  5498. nextCharCode: function() {
  5499. return this.charCodeAt(this.pos + 1);
  5500. },
  5501. nextNonWsCode: function(pos) {
  5502. return this.charCodeAt(this.findWsEnd(pos));
  5503. },
  5504. findWsEnd: function(pos) {
  5505. for (; pos < this.str.length; pos++) {
  5506. var code = this.str.charCodeAt(pos);
  5507. if (code !== R$2 && code !== N$3 && code !== F$2 && code !== SPACE$2 && code !== TAB$1) {
  5508. break;
  5509. }
  5510. }
  5511. return pos;
  5512. },
  5513. substringToPos: function(end) {
  5514. return this.str.substring(this.pos, this.pos = end);
  5515. },
  5516. eat: function(code) {
  5517. if (this.charCode() !== code) {
  5518. this.error('Expect `' + String.fromCharCode(code) + '`');
  5519. }
  5520. this.pos++;
  5521. },
  5522. peek: function() {
  5523. return this.pos < this.str.length ? this.str.charAt(this.pos++) : '';
  5524. },
  5525. error: function(message) {
  5526. throw new SyntaxError$3(message, this.str, this.pos);
  5527. }
  5528. };
  5529. var tokenizer$1 = Tokenizer$1;
  5530. var Tokenizer = tokenizer$1;
  5531. var TAB = 9;
  5532. var N$2 = 10;
  5533. var F$1 = 12;
  5534. var R$1 = 13;
  5535. var SPACE$1 = 32;
  5536. var EXCLAMATIONMARK$3 = 33; // !
  5537. var NUMBERSIGN$4 = 35; // #
  5538. var AMPERSAND$1 = 38; // &
  5539. var APOSTROPHE = 39; // '
  5540. var LEFTPARENTHESIS$7 = 40; // (
  5541. var RIGHTPARENTHESIS$7 = 41; // )
  5542. var ASTERISK$6 = 42; // *
  5543. var PLUSSIGN$6 = 43; // +
  5544. var COMMA$4 = 44; // ,
  5545. var HYPERMINUS = 45; // -
  5546. var LESSTHANSIGN = 60; // <
  5547. var GREATERTHANSIGN$2 = 62; // >
  5548. var QUESTIONMARK$1 = 63; // ?
  5549. var COMMERCIALAT = 64; // @
  5550. var LEFTSQUAREBRACKET$4 = 91; // [
  5551. var RIGHTSQUAREBRACKET$2 = 93; // ]
  5552. var LEFTCURLYBRACKET$4 = 123; // {
  5553. var VERTICALLINE$3 = 124; // |
  5554. var RIGHTCURLYBRACKET$2 = 125; // }
  5555. var INFINITY = 8734; // ∞
  5556. var NAME_CHAR = createCharMap(function(ch) {
  5557. return /[a-zA-Z0-9\-]/.test(ch);
  5558. });
  5559. var COMBINATOR_PRECEDENCE = {
  5560. ' ': 1,
  5561. '&&': 2,
  5562. '||': 3,
  5563. '|': 4
  5564. };
  5565. function createCharMap(fn) {
  5566. var array = typeof Uint32Array === 'function' ? new Uint32Array(128) : new Array(128);
  5567. for (var i = 0; i < 128; i++) {
  5568. array[i] = fn(String.fromCharCode(i)) ? 1 : 0;
  5569. }
  5570. return array;
  5571. }
  5572. function scanSpaces(tokenizer) {
  5573. return tokenizer.substringToPos(
  5574. tokenizer.findWsEnd(tokenizer.pos)
  5575. );
  5576. }
  5577. function scanWord(tokenizer) {
  5578. var end = tokenizer.pos;
  5579. for (; end < tokenizer.str.length; end++) {
  5580. var code = tokenizer.str.charCodeAt(end);
  5581. if (code >= 128 || NAME_CHAR[code] === 0) {
  5582. break;
  5583. }
  5584. }
  5585. if (tokenizer.pos === end) {
  5586. tokenizer.error('Expect a keyword');
  5587. }
  5588. return tokenizer.substringToPos(end);
  5589. }
  5590. function scanNumber(tokenizer) {
  5591. var end = tokenizer.pos;
  5592. for (; end < tokenizer.str.length; end++) {
  5593. var code = tokenizer.str.charCodeAt(end);
  5594. if (code < 48 || code > 57) {
  5595. break;
  5596. }
  5597. }
  5598. if (tokenizer.pos === end) {
  5599. tokenizer.error('Expect a number');
  5600. }
  5601. return tokenizer.substringToPos(end);
  5602. }
  5603. function scanString(tokenizer) {
  5604. var end = tokenizer.str.indexOf('\'', tokenizer.pos + 1);
  5605. if (end === -1) {
  5606. tokenizer.pos = tokenizer.str.length;
  5607. tokenizer.error('Expect an apostrophe');
  5608. }
  5609. return tokenizer.substringToPos(end + 1);
  5610. }
  5611. function readMultiplierRange(tokenizer) {
  5612. var min = null;
  5613. var max = null;
  5614. tokenizer.eat(LEFTCURLYBRACKET$4);
  5615. min = scanNumber(tokenizer);
  5616. if (tokenizer.charCode() === COMMA$4) {
  5617. tokenizer.pos++;
  5618. if (tokenizer.charCode() !== RIGHTCURLYBRACKET$2) {
  5619. max = scanNumber(tokenizer);
  5620. }
  5621. } else {
  5622. max = min;
  5623. }
  5624. tokenizer.eat(RIGHTCURLYBRACKET$2);
  5625. return {
  5626. min: Number(min),
  5627. max: max ? Number(max) : 0
  5628. };
  5629. }
  5630. function readMultiplier(tokenizer) {
  5631. var range = null;
  5632. var comma = false;
  5633. switch (tokenizer.charCode()) {
  5634. case ASTERISK$6:
  5635. tokenizer.pos++;
  5636. range = {
  5637. min: 0,
  5638. max: 0
  5639. };
  5640. break;
  5641. case PLUSSIGN$6:
  5642. tokenizer.pos++;
  5643. range = {
  5644. min: 1,
  5645. max: 0
  5646. };
  5647. break;
  5648. case QUESTIONMARK$1:
  5649. tokenizer.pos++;
  5650. range = {
  5651. min: 0,
  5652. max: 1
  5653. };
  5654. break;
  5655. case NUMBERSIGN$4:
  5656. tokenizer.pos++;
  5657. comma = true;
  5658. if (tokenizer.charCode() === LEFTCURLYBRACKET$4) {
  5659. range = readMultiplierRange(tokenizer);
  5660. } else {
  5661. range = {
  5662. min: 1,
  5663. max: 0
  5664. };
  5665. }
  5666. break;
  5667. case LEFTCURLYBRACKET$4:
  5668. range = readMultiplierRange(tokenizer);
  5669. break;
  5670. default:
  5671. return null;
  5672. }
  5673. return {
  5674. type: 'Multiplier',
  5675. comma: comma,
  5676. min: range.min,
  5677. max: range.max,
  5678. term: null
  5679. };
  5680. }
  5681. function maybeMultiplied(tokenizer, node) {
  5682. var multiplier = readMultiplier(tokenizer);
  5683. if (multiplier !== null) {
  5684. multiplier.term = node;
  5685. return multiplier;
  5686. }
  5687. return node;
  5688. }
  5689. function maybeToken(tokenizer) {
  5690. var ch = tokenizer.peek();
  5691. if (ch === '') {
  5692. return null;
  5693. }
  5694. return {
  5695. type: 'Token',
  5696. value: ch
  5697. };
  5698. }
  5699. function readProperty$1(tokenizer) {
  5700. var name;
  5701. tokenizer.eat(LESSTHANSIGN);
  5702. tokenizer.eat(APOSTROPHE);
  5703. name = scanWord(tokenizer);
  5704. tokenizer.eat(APOSTROPHE);
  5705. tokenizer.eat(GREATERTHANSIGN$2);
  5706. return maybeMultiplied(tokenizer, {
  5707. type: 'Property',
  5708. name: name
  5709. });
  5710. }
  5711. // https://drafts.csswg.org/css-values-3/#numeric-ranges
  5712. // 4.1. Range Restrictions and Range Definition Notation
  5713. //
  5714. // Range restrictions can be annotated in the numeric type notation using CSS bracketed
  5715. // range notation—[min,max]—within the angle brackets, after the identifying keyword,
  5716. // indicating a closed range between (and including) min and max.
  5717. // For example, <integer [0, 10]> indicates an integer between 0 and 10, inclusive.
  5718. function readTypeRange(tokenizer) {
  5719. // use null for Infinity to make AST format JSON serializable/deserializable
  5720. var min = null; // -Infinity
  5721. var max = null; // Infinity
  5722. var sign = 1;
  5723. tokenizer.eat(LEFTSQUAREBRACKET$4);
  5724. if (tokenizer.charCode() === HYPERMINUS) {
  5725. tokenizer.peek();
  5726. sign = -1;
  5727. }
  5728. if (sign == -1 && tokenizer.charCode() === INFINITY) {
  5729. tokenizer.peek();
  5730. } else {
  5731. min = sign * Number(scanNumber(tokenizer));
  5732. }
  5733. scanSpaces(tokenizer);
  5734. tokenizer.eat(COMMA$4);
  5735. scanSpaces(tokenizer);
  5736. if (tokenizer.charCode() === INFINITY) {
  5737. tokenizer.peek();
  5738. } else {
  5739. sign = 1;
  5740. if (tokenizer.charCode() === HYPERMINUS) {
  5741. tokenizer.peek();
  5742. sign = -1;
  5743. }
  5744. max = sign * Number(scanNumber(tokenizer));
  5745. }
  5746. tokenizer.eat(RIGHTSQUAREBRACKET$2);
  5747. // If no range is indicated, either by using the bracketed range notation
  5748. // or in the property description, then [−∞,∞] is assumed.
  5749. if (min === null && max === null) {
  5750. return null;
  5751. }
  5752. return {
  5753. type: 'Range',
  5754. min: min,
  5755. max: max
  5756. };
  5757. }
  5758. function readType(tokenizer) {
  5759. var name;
  5760. var opts = null;
  5761. tokenizer.eat(LESSTHANSIGN);
  5762. name = scanWord(tokenizer);
  5763. if (tokenizer.charCode() === LEFTPARENTHESIS$7 &&
  5764. tokenizer.nextCharCode() === RIGHTPARENTHESIS$7) {
  5765. tokenizer.pos += 2;
  5766. name += '()';
  5767. }
  5768. if (tokenizer.charCodeAt(tokenizer.findWsEnd(tokenizer.pos)) === LEFTSQUAREBRACKET$4) {
  5769. scanSpaces(tokenizer);
  5770. opts = readTypeRange(tokenizer);
  5771. }
  5772. tokenizer.eat(GREATERTHANSIGN$2);
  5773. return maybeMultiplied(tokenizer, {
  5774. type: 'Type',
  5775. name: name,
  5776. opts: opts
  5777. });
  5778. }
  5779. function readKeywordOrFunction(tokenizer) {
  5780. var name;
  5781. name = scanWord(tokenizer);
  5782. if (tokenizer.charCode() === LEFTPARENTHESIS$7) {
  5783. tokenizer.pos++;
  5784. return {
  5785. type: 'Function',
  5786. name: name
  5787. };
  5788. }
  5789. return maybeMultiplied(tokenizer, {
  5790. type: 'Keyword',
  5791. name: name
  5792. });
  5793. }
  5794. function regroupTerms(terms, combinators) {
  5795. function createGroup(terms, combinator) {
  5796. return {
  5797. type: 'Group',
  5798. terms: terms,
  5799. combinator: combinator,
  5800. disallowEmpty: false,
  5801. explicit: false
  5802. };
  5803. }
  5804. combinators = Object.keys(combinators).sort(function(a, b) {
  5805. return COMBINATOR_PRECEDENCE[a] - COMBINATOR_PRECEDENCE[b];
  5806. });
  5807. while (combinators.length > 0) {
  5808. var combinator = combinators.shift();
  5809. for (var i = 0, subgroupStart = 0; i < terms.length; i++) {
  5810. var term = terms[i];
  5811. if (term.type === 'Combinator') {
  5812. if (term.value === combinator) {
  5813. if (subgroupStart === -1) {
  5814. subgroupStart = i - 1;
  5815. }
  5816. terms.splice(i, 1);
  5817. i--;
  5818. } else {
  5819. if (subgroupStart !== -1 && i - subgroupStart > 1) {
  5820. terms.splice(
  5821. subgroupStart,
  5822. i - subgroupStart,
  5823. createGroup(terms.slice(subgroupStart, i), combinator)
  5824. );
  5825. i = subgroupStart + 1;
  5826. }
  5827. subgroupStart = -1;
  5828. }
  5829. }
  5830. }
  5831. if (subgroupStart !== -1 && combinators.length) {
  5832. terms.splice(
  5833. subgroupStart,
  5834. i - subgroupStart,
  5835. createGroup(terms.slice(subgroupStart, i), combinator)
  5836. );
  5837. }
  5838. }
  5839. return combinator;
  5840. }
  5841. function readImplicitGroup(tokenizer) {
  5842. var terms = [];
  5843. var combinators = {};
  5844. var token;
  5845. var prevToken = null;
  5846. var prevTokenPos = tokenizer.pos;
  5847. while (token = peek(tokenizer)) {
  5848. if (token.type !== 'Spaces') {
  5849. if (token.type === 'Combinator') {
  5850. // check for combinator in group beginning and double combinator sequence
  5851. if (prevToken === null || prevToken.type === 'Combinator') {
  5852. tokenizer.pos = prevTokenPos;
  5853. tokenizer.error('Unexpected combinator');
  5854. }
  5855. combinators[token.value] = true;
  5856. } else if (prevToken !== null && prevToken.type !== 'Combinator') {
  5857. combinators[' '] = true; // a b
  5858. terms.push({
  5859. type: 'Combinator',
  5860. value: ' '
  5861. });
  5862. }
  5863. terms.push(token);
  5864. prevToken = token;
  5865. prevTokenPos = tokenizer.pos;
  5866. }
  5867. }
  5868. // check for combinator in group ending
  5869. if (prevToken !== null && prevToken.type === 'Combinator') {
  5870. tokenizer.pos -= prevTokenPos;
  5871. tokenizer.error('Unexpected combinator');
  5872. }
  5873. return {
  5874. type: 'Group',
  5875. terms: terms,
  5876. combinator: regroupTerms(terms, combinators) || ' ',
  5877. disallowEmpty: false,
  5878. explicit: false
  5879. };
  5880. }
  5881. function readGroup(tokenizer) {
  5882. var result;
  5883. tokenizer.eat(LEFTSQUAREBRACKET$4);
  5884. result = readImplicitGroup(tokenizer);
  5885. tokenizer.eat(RIGHTSQUAREBRACKET$2);
  5886. result.explicit = true;
  5887. if (tokenizer.charCode() === EXCLAMATIONMARK$3) {
  5888. tokenizer.pos++;
  5889. result.disallowEmpty = true;
  5890. }
  5891. return result;
  5892. }
  5893. function peek(tokenizer) {
  5894. var code = tokenizer.charCode();
  5895. if (code < 128 && NAME_CHAR[code] === 1) {
  5896. return readKeywordOrFunction(tokenizer);
  5897. }
  5898. switch (code) {
  5899. case RIGHTSQUAREBRACKET$2:
  5900. // don't eat, stop scan a group
  5901. break;
  5902. case LEFTSQUAREBRACKET$4:
  5903. return maybeMultiplied(tokenizer, readGroup(tokenizer));
  5904. case LESSTHANSIGN:
  5905. return tokenizer.nextCharCode() === APOSTROPHE
  5906. ? readProperty$1(tokenizer)
  5907. : readType(tokenizer);
  5908. case VERTICALLINE$3:
  5909. return {
  5910. type: 'Combinator',
  5911. value: tokenizer.substringToPos(
  5912. tokenizer.nextCharCode() === VERTICALLINE$3
  5913. ? tokenizer.pos + 2
  5914. : tokenizer.pos + 1
  5915. )
  5916. };
  5917. case AMPERSAND$1:
  5918. tokenizer.pos++;
  5919. tokenizer.eat(AMPERSAND$1);
  5920. return {
  5921. type: 'Combinator',
  5922. value: '&&'
  5923. };
  5924. case COMMA$4:
  5925. tokenizer.pos++;
  5926. return {
  5927. type: 'Comma'
  5928. };
  5929. case APOSTROPHE:
  5930. return maybeMultiplied(tokenizer, {
  5931. type: 'String',
  5932. value: scanString(tokenizer)
  5933. });
  5934. case SPACE$1:
  5935. case TAB:
  5936. case N$2:
  5937. case R$1:
  5938. case F$1:
  5939. return {
  5940. type: 'Spaces',
  5941. value: scanSpaces(tokenizer)
  5942. };
  5943. case COMMERCIALAT:
  5944. code = tokenizer.nextCharCode();
  5945. if (code < 128 && NAME_CHAR[code] === 1) {
  5946. tokenizer.pos++;
  5947. return {
  5948. type: 'AtKeyword',
  5949. name: scanWord(tokenizer)
  5950. };
  5951. }
  5952. return maybeToken(tokenizer);
  5953. case ASTERISK$6:
  5954. case PLUSSIGN$6:
  5955. case QUESTIONMARK$1:
  5956. case NUMBERSIGN$4:
  5957. case EXCLAMATIONMARK$3:
  5958. // prohibited tokens (used as a multiplier start)
  5959. break;
  5960. case LEFTCURLYBRACKET$4:
  5961. // LEFTCURLYBRACKET is allowed since mdn/data uses it w/o quoting
  5962. // check next char isn't a number, because it's likely a disjoined multiplier
  5963. code = tokenizer.nextCharCode();
  5964. if (code < 48 || code > 57) {
  5965. return maybeToken(tokenizer);
  5966. }
  5967. break;
  5968. default:
  5969. return maybeToken(tokenizer);
  5970. }
  5971. }
  5972. function parse$2(source) {
  5973. var tokenizer = new Tokenizer(source);
  5974. var result = readImplicitGroup(tokenizer);
  5975. if (tokenizer.pos !== source.length) {
  5976. tokenizer.error('Unexpected input');
  5977. }
  5978. // reduce redundant groups with single group term
  5979. if (result.terms.length === 1 && result.terms[0].type === 'Group') {
  5980. result = result.terms[0];
  5981. }
  5982. return result;
  5983. }
  5984. // warm up parse to elimitate code branches that never execute
  5985. // fix soft deoptimizations (insufficient type feedback)
  5986. parse$2('[a&&<b>#|<\'c\'>*||e() f{2} /,(% g#{1,2} h{2,})]!');
  5987. var parse_1 = parse$2;
  5988. var noop$2 = function() {};
  5989. function ensureFunction$1(value) {
  5990. return typeof value === 'function' ? value : noop$2;
  5991. }
  5992. var walk$1 = function(node, options, context) {
  5993. function walk(node) {
  5994. enter.call(context, node);
  5995. switch (node.type) {
  5996. case 'Group':
  5997. node.terms.forEach(walk);
  5998. break;
  5999. case 'Multiplier':
  6000. walk(node.term);
  6001. break;
  6002. case 'Type':
  6003. case 'Property':
  6004. case 'Keyword':
  6005. case 'AtKeyword':
  6006. case 'Function':
  6007. case 'String':
  6008. case 'Token':
  6009. case 'Comma':
  6010. break;
  6011. default:
  6012. throw new Error('Unknown type: ' + node.type);
  6013. }
  6014. leave.call(context, node);
  6015. }
  6016. var enter = noop$2;
  6017. var leave = noop$2;
  6018. if (typeof options === 'function') {
  6019. enter = options;
  6020. } else if (options) {
  6021. enter = ensureFunction$1(options.enter);
  6022. leave = ensureFunction$1(options.leave);
  6023. }
  6024. if (enter === noop$2 && leave === noop$2) {
  6025. throw new Error('Neither `enter` nor `leave` walker handler is set or both aren\'t a function');
  6026. }
  6027. walk(node);
  6028. };
  6029. var tokenize$2 = tokenizer$3;
  6030. var TokenStream$2 = TokenStream_1;
  6031. var tokenStream = new TokenStream$2();
  6032. var astToTokens = {
  6033. decorator: function(handlers) {
  6034. var curNode = null;
  6035. var prev = { len: 0, node: null };
  6036. var nodes = [prev];
  6037. var buffer = '';
  6038. return {
  6039. children: handlers.children,
  6040. node: function(node) {
  6041. var tmp = curNode;
  6042. curNode = node;
  6043. handlers.node.call(this, node);
  6044. curNode = tmp;
  6045. },
  6046. chunk: function(chunk) {
  6047. buffer += chunk;
  6048. if (prev.node !== curNode) {
  6049. nodes.push({
  6050. len: chunk.length,
  6051. node: curNode
  6052. });
  6053. } else {
  6054. prev.len += chunk.length;
  6055. }
  6056. },
  6057. result: function() {
  6058. return prepareTokens$1(buffer, nodes);
  6059. }
  6060. };
  6061. }
  6062. };
  6063. function prepareTokens$1(str, nodes) {
  6064. var tokens = [];
  6065. var nodesOffset = 0;
  6066. var nodesIndex = 0;
  6067. var currentNode = nodes ? nodes[nodesIndex].node : null;
  6068. tokenize$2(str, tokenStream);
  6069. while (!tokenStream.eof) {
  6070. if (nodes) {
  6071. while (nodesIndex < nodes.length && nodesOffset + nodes[nodesIndex].len <= tokenStream.tokenStart) {
  6072. nodesOffset += nodes[nodesIndex++].len;
  6073. currentNode = nodes[nodesIndex].node;
  6074. }
  6075. }
  6076. tokens.push({
  6077. type: tokenStream.tokenType,
  6078. value: tokenStream.getTokenValue(),
  6079. index: tokenStream.tokenIndex, // TODO: remove it, temporary solution
  6080. balance: tokenStream.balance[tokenStream.tokenIndex], // TODO: remove it, temporary solution
  6081. node: currentNode
  6082. });
  6083. tokenStream.next();
  6084. // console.log({ ...tokens[tokens.length - 1], node: undefined });
  6085. }
  6086. return tokens;
  6087. }
  6088. var prepareTokens_1 = function(value, syntax) {
  6089. if (typeof value === 'string') {
  6090. return prepareTokens$1(value, null);
  6091. }
  6092. return syntax.generate(value, astToTokens);
  6093. };
  6094. var parse$1 = parse_1;
  6095. var MATCH$1 = { type: 'Match' };
  6096. var MISMATCH$1 = { type: 'Mismatch' };
  6097. var DISALLOW_EMPTY$1 = { type: 'DisallowEmpty' };
  6098. var LEFTPARENTHESIS$6 = 40; // (
  6099. var RIGHTPARENTHESIS$6 = 41; // )
  6100. function createCondition(match, thenBranch, elseBranch) {
  6101. // reduce node count
  6102. if (thenBranch === MATCH$1 && elseBranch === MISMATCH$1) {
  6103. return match;
  6104. }
  6105. if (match === MATCH$1 && thenBranch === MATCH$1 && elseBranch === MATCH$1) {
  6106. return match;
  6107. }
  6108. if (match.type === 'If' && match.else === MISMATCH$1 && thenBranch === MATCH$1) {
  6109. thenBranch = match.then;
  6110. match = match.match;
  6111. }
  6112. return {
  6113. type: 'If',
  6114. match: match,
  6115. then: thenBranch,
  6116. else: elseBranch
  6117. };
  6118. }
  6119. function isFunctionType(name) {
  6120. return (
  6121. name.length > 2 &&
  6122. name.charCodeAt(name.length - 2) === LEFTPARENTHESIS$6 &&
  6123. name.charCodeAt(name.length - 1) === RIGHTPARENTHESIS$6
  6124. );
  6125. }
  6126. function isEnumCapatible(term) {
  6127. return (
  6128. term.type === 'Keyword' ||
  6129. term.type === 'AtKeyword' ||
  6130. term.type === 'Function' ||
  6131. term.type === 'Type' && isFunctionType(term.name)
  6132. );
  6133. }
  6134. function buildGroupMatchGraph(combinator, terms, atLeastOneTermMatched) {
  6135. switch (combinator) {
  6136. case ' ':
  6137. // Juxtaposing components means that all of them must occur, in the given order.
  6138. //
  6139. // a b c
  6140. // =
  6141. // match a
  6142. // then match b
  6143. // then match c
  6144. // then MATCH
  6145. // else MISMATCH
  6146. // else MISMATCH
  6147. // else MISMATCH
  6148. var result = MATCH$1;
  6149. for (var i = terms.length - 1; i >= 0; i--) {
  6150. var term = terms[i];
  6151. result = createCondition(
  6152. term,
  6153. result,
  6154. MISMATCH$1
  6155. );
  6156. }
  6157. return result;
  6158. case '|':
  6159. // A bar (|) separates two or more alternatives: exactly one of them must occur.
  6160. //
  6161. // a | b | c
  6162. // =
  6163. // match a
  6164. // then MATCH
  6165. // else match b
  6166. // then MATCH
  6167. // else match c
  6168. // then MATCH
  6169. // else MISMATCH
  6170. var result = MISMATCH$1;
  6171. var map = null;
  6172. for (var i = terms.length - 1; i >= 0; i--) {
  6173. var term = terms[i];
  6174. // reduce sequence of keywords into a Enum
  6175. if (isEnumCapatible(term)) {
  6176. if (map === null && i > 0 && isEnumCapatible(terms[i - 1])) {
  6177. map = Object.create(null);
  6178. result = createCondition(
  6179. {
  6180. type: 'Enum',
  6181. map: map
  6182. },
  6183. MATCH$1,
  6184. result
  6185. );
  6186. }
  6187. if (map !== null) {
  6188. var key = (isFunctionType(term.name) ? term.name.slice(0, -1) : term.name).toLowerCase();
  6189. if (key in map === false) {
  6190. map[key] = term;
  6191. continue;
  6192. }
  6193. }
  6194. }
  6195. map = null;
  6196. // create a new conditonal node
  6197. result = createCondition(
  6198. term,
  6199. MATCH$1,
  6200. result
  6201. );
  6202. }
  6203. return result;
  6204. case '&&':
  6205. // A double ampersand (&&) separates two or more components,
  6206. // all of which must occur, in any order.
  6207. // Use MatchOnce for groups with a large number of terms,
  6208. // since &&-groups produces at least N!-node trees
  6209. if (terms.length > 5) {
  6210. return {
  6211. type: 'MatchOnce',
  6212. terms: terms,
  6213. all: true
  6214. };
  6215. }
  6216. // Use a combination tree for groups with small number of terms
  6217. //
  6218. // a && b && c
  6219. // =
  6220. // match a
  6221. // then [b && c]
  6222. // else match b
  6223. // then [a && c]
  6224. // else match c
  6225. // then [a && b]
  6226. // else MISMATCH
  6227. //
  6228. // a && b
  6229. // =
  6230. // match a
  6231. // then match b
  6232. // then MATCH
  6233. // else MISMATCH
  6234. // else match b
  6235. // then match a
  6236. // then MATCH
  6237. // else MISMATCH
  6238. // else MISMATCH
  6239. var result = MISMATCH$1;
  6240. for (var i = terms.length - 1; i >= 0; i--) {
  6241. var term = terms[i];
  6242. var thenClause;
  6243. if (terms.length > 1) {
  6244. thenClause = buildGroupMatchGraph(
  6245. combinator,
  6246. terms.filter(function(newGroupTerm) {
  6247. return newGroupTerm !== term;
  6248. }),
  6249. false
  6250. );
  6251. } else {
  6252. thenClause = MATCH$1;
  6253. }
  6254. result = createCondition(
  6255. term,
  6256. thenClause,
  6257. result
  6258. );
  6259. }
  6260. return result;
  6261. case '||':
  6262. // A double bar (||) separates two or more options:
  6263. // one or more of them must occur, in any order.
  6264. // Use MatchOnce for groups with a large number of terms,
  6265. // since ||-groups produces at least N!-node trees
  6266. if (terms.length > 5) {
  6267. return {
  6268. type: 'MatchOnce',
  6269. terms: terms,
  6270. all: false
  6271. };
  6272. }
  6273. // Use a combination tree for groups with small number of terms
  6274. //
  6275. // a || b || c
  6276. // =
  6277. // match a
  6278. // then [b || c]
  6279. // else match b
  6280. // then [a || c]
  6281. // else match c
  6282. // then [a || b]
  6283. // else MISMATCH
  6284. //
  6285. // a || b
  6286. // =
  6287. // match a
  6288. // then match b
  6289. // then MATCH
  6290. // else MATCH
  6291. // else match b
  6292. // then match a
  6293. // then MATCH
  6294. // else MATCH
  6295. // else MISMATCH
  6296. var result = atLeastOneTermMatched ? MATCH$1 : MISMATCH$1;
  6297. for (var i = terms.length - 1; i >= 0; i--) {
  6298. var term = terms[i];
  6299. var thenClause;
  6300. if (terms.length > 1) {
  6301. thenClause = buildGroupMatchGraph(
  6302. combinator,
  6303. terms.filter(function(newGroupTerm) {
  6304. return newGroupTerm !== term;
  6305. }),
  6306. true
  6307. );
  6308. } else {
  6309. thenClause = MATCH$1;
  6310. }
  6311. result = createCondition(
  6312. term,
  6313. thenClause,
  6314. result
  6315. );
  6316. }
  6317. return result;
  6318. }
  6319. }
  6320. function buildMultiplierMatchGraph(node) {
  6321. var result = MATCH$1;
  6322. var matchTerm = buildMatchGraph$1(node.term);
  6323. if (node.max === 0) {
  6324. // disable repeating of empty match to prevent infinite loop
  6325. matchTerm = createCondition(
  6326. matchTerm,
  6327. DISALLOW_EMPTY$1,
  6328. MISMATCH$1
  6329. );
  6330. // an occurrence count is not limited, make a cycle;
  6331. // to collect more terms on each following matching mismatch
  6332. result = createCondition(
  6333. matchTerm,
  6334. null, // will be a loop
  6335. MISMATCH$1
  6336. );
  6337. result.then = createCondition(
  6338. MATCH$1,
  6339. MATCH$1,
  6340. result // make a loop
  6341. );
  6342. if (node.comma) {
  6343. result.then.else = createCondition(
  6344. { type: 'Comma', syntax: node },
  6345. result,
  6346. MISMATCH$1
  6347. );
  6348. }
  6349. } else {
  6350. // create a match node chain for [min .. max] interval with optional matches
  6351. for (var i = node.min || 1; i <= node.max; i++) {
  6352. if (node.comma && result !== MATCH$1) {
  6353. result = createCondition(
  6354. { type: 'Comma', syntax: node },
  6355. result,
  6356. MISMATCH$1
  6357. );
  6358. }
  6359. result = createCondition(
  6360. matchTerm,
  6361. createCondition(
  6362. MATCH$1,
  6363. MATCH$1,
  6364. result
  6365. ),
  6366. MISMATCH$1
  6367. );
  6368. }
  6369. }
  6370. if (node.min === 0) {
  6371. // allow zero match
  6372. result = createCondition(
  6373. MATCH$1,
  6374. MATCH$1,
  6375. result
  6376. );
  6377. } else {
  6378. // create a match node chain to collect [0 ... min - 1] required matches
  6379. for (var i = 0; i < node.min - 1; i++) {
  6380. if (node.comma && result !== MATCH$1) {
  6381. result = createCondition(
  6382. { type: 'Comma', syntax: node },
  6383. result,
  6384. MISMATCH$1
  6385. );
  6386. }
  6387. result = createCondition(
  6388. matchTerm,
  6389. result,
  6390. MISMATCH$1
  6391. );
  6392. }
  6393. }
  6394. return result;
  6395. }
  6396. function buildMatchGraph$1(node) {
  6397. if (typeof node === 'function') {
  6398. return {
  6399. type: 'Generic',
  6400. fn: node
  6401. };
  6402. }
  6403. switch (node.type) {
  6404. case 'Group':
  6405. var result = buildGroupMatchGraph(
  6406. node.combinator,
  6407. node.terms.map(buildMatchGraph$1),
  6408. false
  6409. );
  6410. if (node.disallowEmpty) {
  6411. result = createCondition(
  6412. result,
  6413. DISALLOW_EMPTY$1,
  6414. MISMATCH$1
  6415. );
  6416. }
  6417. return result;
  6418. case 'Multiplier':
  6419. return buildMultiplierMatchGraph(node);
  6420. case 'Type':
  6421. case 'Property':
  6422. return {
  6423. type: node.type,
  6424. name: node.name,
  6425. syntax: node
  6426. };
  6427. case 'Keyword':
  6428. return {
  6429. type: node.type,
  6430. name: node.name.toLowerCase(),
  6431. syntax: node
  6432. };
  6433. case 'AtKeyword':
  6434. return {
  6435. type: node.type,
  6436. name: '@' + node.name.toLowerCase(),
  6437. syntax: node
  6438. };
  6439. case 'Function':
  6440. return {
  6441. type: node.type,
  6442. name: node.name.toLowerCase() + '(',
  6443. syntax: node
  6444. };
  6445. case 'String':
  6446. // convert a one char length String to a Token
  6447. if (node.value.length === 3) {
  6448. return {
  6449. type: 'Token',
  6450. value: node.value.charAt(1),
  6451. syntax: node
  6452. };
  6453. }
  6454. // otherwise use it as is
  6455. return {
  6456. type: node.type,
  6457. value: node.value.substr(1, node.value.length - 2).replace(/\\'/g, '\''),
  6458. syntax: node
  6459. };
  6460. case 'Token':
  6461. return {
  6462. type: node.type,
  6463. value: node.value,
  6464. syntax: node
  6465. };
  6466. case 'Comma':
  6467. return {
  6468. type: node.type,
  6469. syntax: node
  6470. };
  6471. default:
  6472. throw new Error('Unknown node type:', node.type);
  6473. }
  6474. }
  6475. var matchGraph$1 = {
  6476. MATCH: MATCH$1,
  6477. MISMATCH: MISMATCH$1,
  6478. DISALLOW_EMPTY: DISALLOW_EMPTY$1,
  6479. buildMatchGraph: function(syntaxTree, ref) {
  6480. if (typeof syntaxTree === 'string') {
  6481. syntaxTree = parse$1(syntaxTree);
  6482. }
  6483. return {
  6484. type: 'MatchGraph',
  6485. match: buildMatchGraph$1(syntaxTree),
  6486. syntax: ref || null,
  6487. source: syntaxTree
  6488. };
  6489. }
  6490. };
  6491. var hasOwnProperty$6 = Object.prototype.hasOwnProperty;
  6492. var matchGraph = matchGraph$1;
  6493. var MATCH = matchGraph.MATCH;
  6494. var MISMATCH = matchGraph.MISMATCH;
  6495. var DISALLOW_EMPTY = matchGraph.DISALLOW_EMPTY;
  6496. var TYPE$B = _const.TYPE;
  6497. var STUB = 0;
  6498. var TOKEN = 1;
  6499. var OPEN_SYNTAX = 2;
  6500. var CLOSE_SYNTAX = 3;
  6501. var EXIT_REASON_MATCH = 'Match';
  6502. var EXIT_REASON_MISMATCH = 'Mismatch';
  6503. var EXIT_REASON_ITERATION_LIMIT = 'Maximum iteration number exceeded (please fill an issue on https://github.com/csstree/csstree/issues)';
  6504. var ITERATION_LIMIT = 15000;
  6505. var totalIterationCount = 0;
  6506. function reverseList(list) {
  6507. var prev = null;
  6508. var next = null;
  6509. var item = list;
  6510. while (item !== null) {
  6511. next = item.prev;
  6512. item.prev = prev;
  6513. prev = item;
  6514. item = next;
  6515. }
  6516. return prev;
  6517. }
  6518. function areStringsEqualCaseInsensitive(testStr, referenceStr) {
  6519. if (testStr.length !== referenceStr.length) {
  6520. return false;
  6521. }
  6522. for (var i = 0; i < testStr.length; i++) {
  6523. var testCode = testStr.charCodeAt(i);
  6524. var referenceCode = referenceStr.charCodeAt(i);
  6525. // testCode.toLowerCase() for U+0041 LATIN CAPITAL LETTER A (A) .. U+005A LATIN CAPITAL LETTER Z (Z).
  6526. if (testCode >= 0x0041 && testCode <= 0x005A) {
  6527. testCode = testCode | 32;
  6528. }
  6529. if (testCode !== referenceCode) {
  6530. return false;
  6531. }
  6532. }
  6533. return true;
  6534. }
  6535. function isContextEdgeDelim(token) {
  6536. if (token.type !== TYPE$B.Delim) {
  6537. return false;
  6538. }
  6539. // Fix matching for unicode-range: U+30??, U+FF00-FF9F
  6540. // Probably we need to check out previous match instead
  6541. return token.value !== '?';
  6542. }
  6543. function isCommaContextStart(token) {
  6544. if (token === null) {
  6545. return true;
  6546. }
  6547. return (
  6548. token.type === TYPE$B.Comma ||
  6549. token.type === TYPE$B.Function ||
  6550. token.type === TYPE$B.LeftParenthesis ||
  6551. token.type === TYPE$B.LeftSquareBracket ||
  6552. token.type === TYPE$B.LeftCurlyBracket ||
  6553. isContextEdgeDelim(token)
  6554. );
  6555. }
  6556. function isCommaContextEnd(token) {
  6557. if (token === null) {
  6558. return true;
  6559. }
  6560. return (
  6561. token.type === TYPE$B.RightParenthesis ||
  6562. token.type === TYPE$B.RightSquareBracket ||
  6563. token.type === TYPE$B.RightCurlyBracket ||
  6564. token.type === TYPE$B.Delim
  6565. );
  6566. }
  6567. function internalMatch(tokens, state, syntaxes) {
  6568. function moveToNextToken() {
  6569. do {
  6570. tokenIndex++;
  6571. token = tokenIndex < tokens.length ? tokens[tokenIndex] : null;
  6572. } while (token !== null && (token.type === TYPE$B.WhiteSpace || token.type === TYPE$B.Comment));
  6573. }
  6574. function getNextToken(offset) {
  6575. var nextIndex = tokenIndex + offset;
  6576. return nextIndex < tokens.length ? tokens[nextIndex] : null;
  6577. }
  6578. function stateSnapshotFromSyntax(nextState, prev) {
  6579. return {
  6580. nextState: nextState,
  6581. matchStack: matchStack,
  6582. syntaxStack: syntaxStack,
  6583. thenStack: thenStack,
  6584. tokenIndex: tokenIndex,
  6585. prev: prev
  6586. };
  6587. }
  6588. function pushThenStack(nextState) {
  6589. thenStack = {
  6590. nextState: nextState,
  6591. matchStack: matchStack,
  6592. syntaxStack: syntaxStack,
  6593. prev: thenStack
  6594. };
  6595. }
  6596. function pushElseStack(nextState) {
  6597. elseStack = stateSnapshotFromSyntax(nextState, elseStack);
  6598. }
  6599. function addTokenToMatch() {
  6600. matchStack = {
  6601. type: TOKEN,
  6602. syntax: state.syntax,
  6603. token: token,
  6604. prev: matchStack
  6605. };
  6606. moveToNextToken();
  6607. syntaxStash = null;
  6608. if (tokenIndex > longestMatch) {
  6609. longestMatch = tokenIndex;
  6610. }
  6611. }
  6612. function openSyntax() {
  6613. syntaxStack = {
  6614. syntax: state.syntax,
  6615. opts: state.syntax.opts || (syntaxStack !== null && syntaxStack.opts) || null,
  6616. prev: syntaxStack
  6617. };
  6618. matchStack = {
  6619. type: OPEN_SYNTAX,
  6620. syntax: state.syntax,
  6621. token: matchStack.token,
  6622. prev: matchStack
  6623. };
  6624. }
  6625. function closeSyntax() {
  6626. if (matchStack.type === OPEN_SYNTAX) {
  6627. matchStack = matchStack.prev;
  6628. } else {
  6629. matchStack = {
  6630. type: CLOSE_SYNTAX,
  6631. syntax: syntaxStack.syntax,
  6632. token: matchStack.token,
  6633. prev: matchStack
  6634. };
  6635. }
  6636. syntaxStack = syntaxStack.prev;
  6637. }
  6638. var syntaxStack = null;
  6639. var thenStack = null;
  6640. var elseStack = null;
  6641. // null – stashing allowed, nothing stashed
  6642. // false – stashing disabled, nothing stashed
  6643. // anithing else – fail stashable syntaxes, some syntax stashed
  6644. var syntaxStash = null;
  6645. var iterationCount = 0; // count iterations and prevent infinite loop
  6646. var exitReason = null;
  6647. var token = null;
  6648. var tokenIndex = -1;
  6649. var longestMatch = 0;
  6650. var matchStack = {
  6651. type: STUB,
  6652. syntax: null,
  6653. token: null,
  6654. prev: null
  6655. };
  6656. moveToNextToken();
  6657. while (exitReason === null && ++iterationCount < ITERATION_LIMIT) {
  6658. // function mapList(list, fn) {
  6659. // var result = [];
  6660. // while (list) {
  6661. // result.unshift(fn(list));
  6662. // list = list.prev;
  6663. // }
  6664. // return result;
  6665. // }
  6666. // console.log('--\n',
  6667. // '#' + iterationCount,
  6668. // require('util').inspect({
  6669. // 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),
  6670. // token: token && token.value,
  6671. // tokenIndex,
  6672. // syntax: syntax.type + (syntax.id ? ' #' + syntax.id : '')
  6673. // }, { depth: null })
  6674. // );
  6675. switch (state.type) {
  6676. case 'Match':
  6677. if (thenStack === null) {
  6678. // turn to MISMATCH when some tokens left unmatched
  6679. if (token !== null) {
  6680. // doesn't mismatch if just one token left and it's an IE hack
  6681. if (tokenIndex !== tokens.length - 1 || (token.value !== '\\0' && token.value !== '\\9')) {
  6682. state = MISMATCH;
  6683. break;
  6684. }
  6685. }
  6686. // break the main loop, return a result - MATCH
  6687. exitReason = EXIT_REASON_MATCH;
  6688. break;
  6689. }
  6690. // go to next syntax (`then` branch)
  6691. state = thenStack.nextState;
  6692. // check match is not empty
  6693. if (state === DISALLOW_EMPTY) {
  6694. if (thenStack.matchStack === matchStack) {
  6695. state = MISMATCH;
  6696. break;
  6697. } else {
  6698. state = MATCH;
  6699. }
  6700. }
  6701. // close syntax if needed
  6702. while (thenStack.syntaxStack !== syntaxStack) {
  6703. closeSyntax();
  6704. }
  6705. // pop stack
  6706. thenStack = thenStack.prev;
  6707. break;
  6708. case 'Mismatch':
  6709. // when some syntax is stashed
  6710. if (syntaxStash !== null && syntaxStash !== false) {
  6711. // there is no else branches or a branch reduce match stack
  6712. if (elseStack === null || tokenIndex > elseStack.tokenIndex) {
  6713. // restore state from the stash
  6714. elseStack = syntaxStash;
  6715. syntaxStash = false; // disable stashing
  6716. }
  6717. } else if (elseStack === null) {
  6718. // no else branches -> break the main loop
  6719. // return a result - MISMATCH
  6720. exitReason = EXIT_REASON_MISMATCH;
  6721. break;
  6722. }
  6723. // go to next syntax (`else` branch)
  6724. state = elseStack.nextState;
  6725. // restore all the rest stack states
  6726. thenStack = elseStack.thenStack;
  6727. syntaxStack = elseStack.syntaxStack;
  6728. matchStack = elseStack.matchStack;
  6729. tokenIndex = elseStack.tokenIndex;
  6730. token = tokenIndex < tokens.length ? tokens[tokenIndex] : null;
  6731. // pop stack
  6732. elseStack = elseStack.prev;
  6733. break;
  6734. case 'MatchGraph':
  6735. state = state.match;
  6736. break;
  6737. case 'If':
  6738. // IMPORTANT: else stack push must go first,
  6739. // since it stores the state of thenStack before changes
  6740. if (state.else !== MISMATCH) {
  6741. pushElseStack(state.else);
  6742. }
  6743. if (state.then !== MATCH) {
  6744. pushThenStack(state.then);
  6745. }
  6746. state = state.match;
  6747. break;
  6748. case 'MatchOnce':
  6749. state = {
  6750. type: 'MatchOnceBuffer',
  6751. syntax: state,
  6752. index: 0,
  6753. mask: 0
  6754. };
  6755. break;
  6756. case 'MatchOnceBuffer':
  6757. var terms = state.syntax.terms;
  6758. if (state.index === terms.length) {
  6759. // no matches at all or it's required all terms to be matched
  6760. if (state.mask === 0 || state.syntax.all) {
  6761. state = MISMATCH;
  6762. break;
  6763. }
  6764. // a partial match is ok
  6765. state = MATCH;
  6766. break;
  6767. }
  6768. // all terms are matched
  6769. if (state.mask === (1 << terms.length) - 1) {
  6770. state = MATCH;
  6771. break;
  6772. }
  6773. for (; state.index < terms.length; state.index++) {
  6774. var matchFlag = 1 << state.index;
  6775. if ((state.mask & matchFlag) === 0) {
  6776. // IMPORTANT: else stack push must go first,
  6777. // since it stores the state of thenStack before changes
  6778. pushElseStack(state);
  6779. pushThenStack({
  6780. type: 'AddMatchOnce',
  6781. syntax: state.syntax,
  6782. mask: state.mask | matchFlag
  6783. });
  6784. // match
  6785. state = terms[state.index++];
  6786. break;
  6787. }
  6788. }
  6789. break;
  6790. case 'AddMatchOnce':
  6791. state = {
  6792. type: 'MatchOnceBuffer',
  6793. syntax: state.syntax,
  6794. index: 0,
  6795. mask: state.mask
  6796. };
  6797. break;
  6798. case 'Enum':
  6799. if (token !== null) {
  6800. var name = token.value.toLowerCase();
  6801. // drop \0 and \9 hack from keyword name
  6802. if (name.indexOf('\\') !== -1) {
  6803. name = name.replace(/\\[09].*$/, '');
  6804. }
  6805. if (hasOwnProperty$6.call(state.map, name)) {
  6806. state = state.map[name];
  6807. break;
  6808. }
  6809. }
  6810. state = MISMATCH;
  6811. break;
  6812. case 'Generic':
  6813. var opts = syntaxStack !== null ? syntaxStack.opts : null;
  6814. var lastTokenIndex = tokenIndex + Math.floor(state.fn(token, getNextToken, opts));
  6815. if (!isNaN(lastTokenIndex) && lastTokenIndex > tokenIndex) {
  6816. while (tokenIndex < lastTokenIndex) {
  6817. addTokenToMatch();
  6818. }
  6819. state = MATCH;
  6820. } else {
  6821. state = MISMATCH;
  6822. }
  6823. break;
  6824. case 'Type':
  6825. case 'Property':
  6826. var syntaxDict = state.type === 'Type' ? 'types' : 'properties';
  6827. var dictSyntax = hasOwnProperty$6.call(syntaxes, syntaxDict) ? syntaxes[syntaxDict][state.name] : null;
  6828. if (!dictSyntax || !dictSyntax.match) {
  6829. throw new Error(
  6830. 'Bad syntax reference: ' +
  6831. (state.type === 'Type'
  6832. ? '<' + state.name + '>'
  6833. : '<\'' + state.name + '\'>')
  6834. );
  6835. }
  6836. // stash a syntax for types with low priority
  6837. if (syntaxStash !== false && token !== null && state.type === 'Type') {
  6838. var lowPriorityMatching =
  6839. // https://drafts.csswg.org/css-values-4/#custom-idents
  6840. // When parsing positionally-ambiguous keywords in a property value, a <custom-ident> production
  6841. // can only claim the keyword if no other unfulfilled production can claim it.
  6842. (state.name === 'custom-ident' && token.type === TYPE$B.Ident) ||
  6843. // https://drafts.csswg.org/css-values-4/#lengths
  6844. // ... if a `0` could be parsed as either a <number> or a <length> in a property (such as line-height),
  6845. // it must parse as a <number>
  6846. (state.name === 'length' && token.value === '0');
  6847. if (lowPriorityMatching) {
  6848. if (syntaxStash === null) {
  6849. syntaxStash = stateSnapshotFromSyntax(state, elseStack);
  6850. }
  6851. state = MISMATCH;
  6852. break;
  6853. }
  6854. }
  6855. openSyntax();
  6856. state = dictSyntax.match;
  6857. break;
  6858. case 'Keyword':
  6859. var name = state.name;
  6860. if (token !== null) {
  6861. var keywordName = token.value;
  6862. // drop \0 and \9 hack from keyword name
  6863. if (keywordName.indexOf('\\') !== -1) {
  6864. keywordName = keywordName.replace(/\\[09].*$/, '');
  6865. }
  6866. if (areStringsEqualCaseInsensitive(keywordName, name)) {
  6867. addTokenToMatch();
  6868. state = MATCH;
  6869. break;
  6870. }
  6871. }
  6872. state = MISMATCH;
  6873. break;
  6874. case 'AtKeyword':
  6875. case 'Function':
  6876. if (token !== null && areStringsEqualCaseInsensitive(token.value, state.name)) {
  6877. addTokenToMatch();
  6878. state = MATCH;
  6879. break;
  6880. }
  6881. state = MISMATCH;
  6882. break;
  6883. case 'Token':
  6884. if (token !== null && token.value === state.value) {
  6885. addTokenToMatch();
  6886. state = MATCH;
  6887. break;
  6888. }
  6889. state = MISMATCH;
  6890. break;
  6891. case 'Comma':
  6892. if (token !== null && token.type === TYPE$B.Comma) {
  6893. if (isCommaContextStart(matchStack.token)) {
  6894. state = MISMATCH;
  6895. } else {
  6896. addTokenToMatch();
  6897. state = isCommaContextEnd(token) ? MISMATCH : MATCH;
  6898. }
  6899. } else {
  6900. state = isCommaContextStart(matchStack.token) || isCommaContextEnd(token) ? MATCH : MISMATCH;
  6901. }
  6902. break;
  6903. case 'String':
  6904. var string = '';
  6905. for (var lastTokenIndex = tokenIndex; lastTokenIndex < tokens.length && string.length < state.value.length; lastTokenIndex++) {
  6906. string += tokens[lastTokenIndex].value;
  6907. }
  6908. if (areStringsEqualCaseInsensitive(string, state.value)) {
  6909. while (tokenIndex < lastTokenIndex) {
  6910. addTokenToMatch();
  6911. }
  6912. state = MATCH;
  6913. } else {
  6914. state = MISMATCH;
  6915. }
  6916. break;
  6917. default:
  6918. throw new Error('Unknown node type: ' + state.type);
  6919. }
  6920. }
  6921. totalIterationCount += iterationCount;
  6922. switch (exitReason) {
  6923. case null:
  6924. console.warn('[csstree-match] BREAK after ' + ITERATION_LIMIT + ' iterations');
  6925. exitReason = EXIT_REASON_ITERATION_LIMIT;
  6926. matchStack = null;
  6927. break;
  6928. case EXIT_REASON_MATCH:
  6929. while (syntaxStack !== null) {
  6930. closeSyntax();
  6931. }
  6932. break;
  6933. default:
  6934. matchStack = null;
  6935. }
  6936. return {
  6937. tokens: tokens,
  6938. reason: exitReason,
  6939. iterations: iterationCount,
  6940. match: matchStack,
  6941. longestMatch: longestMatch
  6942. };
  6943. }
  6944. function matchAsList(tokens, matchGraph, syntaxes) {
  6945. var matchResult = internalMatch(tokens, matchGraph, syntaxes || {});
  6946. if (matchResult.match !== null) {
  6947. var item = reverseList(matchResult.match).prev;
  6948. matchResult.match = [];
  6949. while (item !== null) {
  6950. switch (item.type) {
  6951. case STUB:
  6952. break;
  6953. case OPEN_SYNTAX:
  6954. case CLOSE_SYNTAX:
  6955. matchResult.match.push({
  6956. type: item.type,
  6957. syntax: item.syntax
  6958. });
  6959. break;
  6960. default:
  6961. matchResult.match.push({
  6962. token: item.token.value,
  6963. node: item.token.node
  6964. });
  6965. break;
  6966. }
  6967. item = item.prev;
  6968. }
  6969. }
  6970. return matchResult;
  6971. }
  6972. function matchAsTree$1(tokens, matchGraph, syntaxes) {
  6973. var matchResult = internalMatch(tokens, matchGraph, syntaxes || {});
  6974. if (matchResult.match === null) {
  6975. return matchResult;
  6976. }
  6977. var item = matchResult.match;
  6978. var host = matchResult.match = {
  6979. syntax: matchGraph.syntax || null,
  6980. match: []
  6981. };
  6982. var hostStack = [host];
  6983. // revert a list and start with 2nd item since 1st is a stub item
  6984. item = reverseList(item).prev;
  6985. // build a tree
  6986. while (item !== null) {
  6987. switch (item.type) {
  6988. case OPEN_SYNTAX:
  6989. host.match.push(host = {
  6990. syntax: item.syntax,
  6991. match: []
  6992. });
  6993. hostStack.push(host);
  6994. break;
  6995. case CLOSE_SYNTAX:
  6996. hostStack.pop();
  6997. host = hostStack[hostStack.length - 1];
  6998. break;
  6999. default:
  7000. host.match.push({
  7001. syntax: item.syntax || null,
  7002. token: item.token.value,
  7003. node: item.token.node
  7004. });
  7005. }
  7006. item = item.prev;
  7007. }
  7008. return matchResult;
  7009. }
  7010. var match = {
  7011. matchAsList: matchAsList,
  7012. matchAsTree: matchAsTree$1,
  7013. getTotalIterationCount: function() {
  7014. return totalIterationCount;
  7015. }
  7016. };
  7017. function getTrace(node) {
  7018. function shouldPutToTrace(syntax) {
  7019. if (syntax === null) {
  7020. return false;
  7021. }
  7022. return (
  7023. syntax.type === 'Type' ||
  7024. syntax.type === 'Property' ||
  7025. syntax.type === 'Keyword'
  7026. );
  7027. }
  7028. function hasMatch(matchNode) {
  7029. if (Array.isArray(matchNode.match)) {
  7030. // use for-loop for better perfomance
  7031. for (var i = 0; i < matchNode.match.length; i++) {
  7032. if (hasMatch(matchNode.match[i])) {
  7033. if (shouldPutToTrace(matchNode.syntax)) {
  7034. result.unshift(matchNode.syntax);
  7035. }
  7036. return true;
  7037. }
  7038. }
  7039. } else if (matchNode.node === node) {
  7040. result = shouldPutToTrace(matchNode.syntax)
  7041. ? [matchNode.syntax]
  7042. : [];
  7043. return true;
  7044. }
  7045. return false;
  7046. }
  7047. var result = null;
  7048. if (this.matched !== null) {
  7049. hasMatch(this.matched);
  7050. }
  7051. return result;
  7052. }
  7053. function testNode(match, node, fn) {
  7054. var trace = getTrace.call(match, node);
  7055. if (trace === null) {
  7056. return false;
  7057. }
  7058. return trace.some(fn);
  7059. }
  7060. function isType(node, type) {
  7061. return testNode(this, node, function(matchNode) {
  7062. return matchNode.type === 'Type' && matchNode.name === type;
  7063. });
  7064. }
  7065. function isProperty(node, property) {
  7066. return testNode(this, node, function(matchNode) {
  7067. return matchNode.type === 'Property' && matchNode.name === property;
  7068. });
  7069. }
  7070. function isKeyword(node) {
  7071. return testNode(this, node, function(matchNode) {
  7072. return matchNode.type === 'Keyword';
  7073. });
  7074. }
  7075. var trace$1 = {
  7076. getTrace: getTrace,
  7077. isType: isType,
  7078. isProperty: isProperty,
  7079. isKeyword: isKeyword
  7080. };
  7081. var List$5 = List_1;
  7082. function getFirstMatchNode(matchNode) {
  7083. if ('node' in matchNode) {
  7084. return matchNode.node;
  7085. }
  7086. return getFirstMatchNode(matchNode.match[0]);
  7087. }
  7088. function getLastMatchNode(matchNode) {
  7089. if ('node' in matchNode) {
  7090. return matchNode.node;
  7091. }
  7092. return getLastMatchNode(matchNode.match[matchNode.match.length - 1]);
  7093. }
  7094. function matchFragments(lexer, ast, match, type, name) {
  7095. function findFragments(matchNode) {
  7096. if (matchNode.syntax !== null &&
  7097. matchNode.syntax.type === type &&
  7098. matchNode.syntax.name === name) {
  7099. var start = getFirstMatchNode(matchNode);
  7100. var end = getLastMatchNode(matchNode);
  7101. lexer.syntax.walk(ast, function(node, item, list) {
  7102. if (node === start) {
  7103. var nodes = new List$5();
  7104. do {
  7105. nodes.appendData(item.data);
  7106. if (item.data === end) {
  7107. break;
  7108. }
  7109. item = item.next;
  7110. } while (item !== null);
  7111. fragments.push({
  7112. parent: list,
  7113. nodes: nodes
  7114. });
  7115. }
  7116. });
  7117. }
  7118. if (Array.isArray(matchNode.match)) {
  7119. matchNode.match.forEach(findFragments);
  7120. }
  7121. }
  7122. var fragments = [];
  7123. if (match.matched !== null) {
  7124. findFragments(match.matched);
  7125. }
  7126. return fragments;
  7127. }
  7128. var search$1 = {
  7129. matchFragments: matchFragments
  7130. };
  7131. var List$4 = List_1;
  7132. var hasOwnProperty$5 = Object.prototype.hasOwnProperty;
  7133. function isValidNumber(value) {
  7134. // Number.isInteger(value) && value >= 0
  7135. return (
  7136. typeof value === 'number' &&
  7137. isFinite(value) &&
  7138. Math.floor(value) === value &&
  7139. value >= 0
  7140. );
  7141. }
  7142. function isValidLocation(loc) {
  7143. return (
  7144. Boolean(loc) &&
  7145. isValidNumber(loc.offset) &&
  7146. isValidNumber(loc.line) &&
  7147. isValidNumber(loc.column)
  7148. );
  7149. }
  7150. function createNodeStructureChecker(type, fields) {
  7151. return function checkNode(node, warn) {
  7152. if (!node || node.constructor !== Object) {
  7153. return warn(node, 'Type of node should be an Object');
  7154. }
  7155. for (var key in node) {
  7156. var valid = true;
  7157. if (hasOwnProperty$5.call(node, key) === false) {
  7158. continue;
  7159. }
  7160. if (key === 'type') {
  7161. if (node.type !== type) {
  7162. warn(node, 'Wrong node type `' + node.type + '`, expected `' + type + '`');
  7163. }
  7164. } else if (key === 'loc') {
  7165. if (node.loc === null) {
  7166. continue;
  7167. } else if (node.loc && node.loc.constructor === Object) {
  7168. if (typeof node.loc.source !== 'string') {
  7169. key += '.source';
  7170. } else if (!isValidLocation(node.loc.start)) {
  7171. key += '.start';
  7172. } else if (!isValidLocation(node.loc.end)) {
  7173. key += '.end';
  7174. } else {
  7175. continue;
  7176. }
  7177. }
  7178. valid = false;
  7179. } else if (fields.hasOwnProperty(key)) {
  7180. for (var i = 0, valid = false; !valid && i < fields[key].length; i++) {
  7181. var fieldType = fields[key][i];
  7182. switch (fieldType) {
  7183. case String:
  7184. valid = typeof node[key] === 'string';
  7185. break;
  7186. case Boolean:
  7187. valid = typeof node[key] === 'boolean';
  7188. break;
  7189. case null:
  7190. valid = node[key] === null;
  7191. break;
  7192. default:
  7193. if (typeof fieldType === 'string') {
  7194. valid = node[key] && node[key].type === fieldType;
  7195. } else if (Array.isArray(fieldType)) {
  7196. valid = node[key] instanceof List$4;
  7197. }
  7198. }
  7199. }
  7200. } else {
  7201. warn(node, 'Unknown field `' + key + '` for ' + type + ' node type');
  7202. }
  7203. if (!valid) {
  7204. warn(node, 'Bad value for `' + type + '.' + key + '`');
  7205. }
  7206. }
  7207. for (var key in fields) {
  7208. if (hasOwnProperty$5.call(fields, key) &&
  7209. hasOwnProperty$5.call(node, key) === false) {
  7210. warn(node, 'Field `' + type + '.' + key + '` is missed');
  7211. }
  7212. }
  7213. };
  7214. }
  7215. function processStructure(name, nodeType) {
  7216. var structure = nodeType.structure;
  7217. var fields = {
  7218. type: String,
  7219. loc: true
  7220. };
  7221. var docs = {
  7222. type: '"' + name + '"'
  7223. };
  7224. for (var key in structure) {
  7225. if (hasOwnProperty$5.call(structure, key) === false) {
  7226. continue;
  7227. }
  7228. var docsTypes = [];
  7229. var fieldTypes = fields[key] = Array.isArray(structure[key])
  7230. ? structure[key].slice()
  7231. : [structure[key]];
  7232. for (var i = 0; i < fieldTypes.length; i++) {
  7233. var fieldType = fieldTypes[i];
  7234. if (fieldType === String || fieldType === Boolean) {
  7235. docsTypes.push(fieldType.name);
  7236. } else if (fieldType === null) {
  7237. docsTypes.push('null');
  7238. } else if (typeof fieldType === 'string') {
  7239. docsTypes.push('<' + fieldType + '>');
  7240. } else if (Array.isArray(fieldType)) {
  7241. docsTypes.push('List'); // TODO: use type enum
  7242. } else {
  7243. throw new Error('Wrong value `' + fieldType + '` in `' + name + '.' + key + '` structure definition');
  7244. }
  7245. }
  7246. docs[key] = docsTypes.join(' | ');
  7247. }
  7248. return {
  7249. docs: docs,
  7250. check: createNodeStructureChecker(name, fields)
  7251. };
  7252. }
  7253. var structure = {
  7254. getStructureFromConfig: function(config) {
  7255. var structure = {};
  7256. if (config.node) {
  7257. for (var name in config.node) {
  7258. if (hasOwnProperty$5.call(config.node, name)) {
  7259. var nodeType = config.node[name];
  7260. if (nodeType.structure) {
  7261. structure[name] = processStructure(name, nodeType);
  7262. } else {
  7263. throw new Error('Missed `structure` field in `' + name + '` node type definition');
  7264. }
  7265. }
  7266. }
  7267. }
  7268. return structure;
  7269. }
  7270. };
  7271. var SyntaxReferenceError = error.SyntaxReferenceError;
  7272. var SyntaxMatchError = error.SyntaxMatchError;
  7273. var names$1 = names$2;
  7274. var generic = generic$1;
  7275. var parse = parse_1;
  7276. var generate = generate_1;
  7277. var walk = walk$1;
  7278. var prepareTokens = prepareTokens_1;
  7279. var buildMatchGraph = matchGraph$1.buildMatchGraph;
  7280. var matchAsTree = match.matchAsTree;
  7281. var trace = trace$1;
  7282. var search = search$1;
  7283. var getStructureFromConfig = structure.getStructureFromConfig;
  7284. var cssWideKeywords = buildMatchGraph('inherit | initial | unset');
  7285. var cssWideKeywordsWithExpression = buildMatchGraph('inherit | initial | unset | <-ms-legacy-expression>');
  7286. function dumpMapSyntax(map, compact, syntaxAsAst) {
  7287. var result = {};
  7288. for (var name in map) {
  7289. if (map[name].syntax) {
  7290. result[name] = syntaxAsAst
  7291. ? map[name].syntax
  7292. : generate(map[name].syntax, { compact: compact });
  7293. }
  7294. }
  7295. return result;
  7296. }
  7297. function dumpAtruleMapSyntax(map, compact, syntaxAsAst) {
  7298. const result = {};
  7299. for (const [name, atrule] of Object.entries(map)) {
  7300. result[name] = {
  7301. prelude: atrule.prelude && (
  7302. syntaxAsAst
  7303. ? atrule.prelude.syntax
  7304. : generate(atrule.prelude.syntax, { compact })
  7305. ),
  7306. descriptors: atrule.descriptors && dumpMapSyntax(atrule.descriptors, compact, syntaxAsAst)
  7307. };
  7308. }
  7309. return result;
  7310. }
  7311. function valueHasVar(tokens) {
  7312. for (var i = 0; i < tokens.length; i++) {
  7313. if (tokens[i].value.toLowerCase() === 'var(') {
  7314. return true;
  7315. }
  7316. }
  7317. return false;
  7318. }
  7319. function buildMatchResult(match, error, iterations) {
  7320. return {
  7321. matched: match,
  7322. iterations: iterations,
  7323. error: error,
  7324. getTrace: trace.getTrace,
  7325. isType: trace.isType,
  7326. isProperty: trace.isProperty,
  7327. isKeyword: trace.isKeyword
  7328. };
  7329. }
  7330. function matchSyntax(lexer, syntax, value, useCommon) {
  7331. var tokens = prepareTokens(value, lexer.syntax);
  7332. var result;
  7333. if (valueHasVar(tokens)) {
  7334. return buildMatchResult(null, new Error('Matching for a tree with var() is not supported'));
  7335. }
  7336. if (useCommon) {
  7337. result = matchAsTree(tokens, lexer.valueCommonSyntax, lexer);
  7338. }
  7339. if (!useCommon || !result.match) {
  7340. result = matchAsTree(tokens, syntax.match, lexer);
  7341. if (!result.match) {
  7342. return buildMatchResult(
  7343. null,
  7344. new SyntaxMatchError(result.reason, syntax.syntax, value, result),
  7345. result.iterations
  7346. );
  7347. }
  7348. }
  7349. return buildMatchResult(result.match, null, result.iterations);
  7350. }
  7351. var Lexer$1 = function(config, syntax, structure) {
  7352. this.valueCommonSyntax = cssWideKeywords;
  7353. this.syntax = syntax;
  7354. this.generic = false;
  7355. this.atrules = {};
  7356. this.properties = {};
  7357. this.types = {};
  7358. this.structure = structure || getStructureFromConfig(config);
  7359. if (config) {
  7360. if (config.types) {
  7361. for (var name in config.types) {
  7362. this.addType_(name, config.types[name]);
  7363. }
  7364. }
  7365. if (config.generic) {
  7366. this.generic = true;
  7367. for (var name in generic) {
  7368. this.addType_(name, generic[name]);
  7369. }
  7370. }
  7371. if (config.atrules) {
  7372. for (var name in config.atrules) {
  7373. this.addAtrule_(name, config.atrules[name]);
  7374. }
  7375. }
  7376. if (config.properties) {
  7377. for (var name in config.properties) {
  7378. this.addProperty_(name, config.properties[name]);
  7379. }
  7380. }
  7381. }
  7382. };
  7383. Lexer$1.prototype = {
  7384. structure: {},
  7385. checkStructure: function(ast) {
  7386. function collectWarning(node, message) {
  7387. warns.push({
  7388. node: node,
  7389. message: message
  7390. });
  7391. }
  7392. var structure = this.structure;
  7393. var warns = [];
  7394. this.syntax.walk(ast, function(node) {
  7395. if (structure.hasOwnProperty(node.type)) {
  7396. structure[node.type].check(node, collectWarning);
  7397. } else {
  7398. collectWarning(node, 'Unknown node type `' + node.type + '`');
  7399. }
  7400. });
  7401. return warns.length ? warns : false;
  7402. },
  7403. createDescriptor: function(syntax, type, name, parent = null) {
  7404. var ref = {
  7405. type: type,
  7406. name: name
  7407. };
  7408. var descriptor = {
  7409. type: type,
  7410. name: name,
  7411. parent: parent,
  7412. syntax: null,
  7413. match: null
  7414. };
  7415. if (typeof syntax === 'function') {
  7416. descriptor.match = buildMatchGraph(syntax, ref);
  7417. } else {
  7418. if (typeof syntax === 'string') {
  7419. // lazy parsing on first access
  7420. Object.defineProperty(descriptor, 'syntax', {
  7421. get: function() {
  7422. Object.defineProperty(descriptor, 'syntax', {
  7423. value: parse(syntax)
  7424. });
  7425. return descriptor.syntax;
  7426. }
  7427. });
  7428. } else {
  7429. descriptor.syntax = syntax;
  7430. }
  7431. // lazy graph build on first access
  7432. Object.defineProperty(descriptor, 'match', {
  7433. get: function() {
  7434. Object.defineProperty(descriptor, 'match', {
  7435. value: buildMatchGraph(descriptor.syntax, ref)
  7436. });
  7437. return descriptor.match;
  7438. }
  7439. });
  7440. }
  7441. return descriptor;
  7442. },
  7443. addAtrule_: function(name, syntax) {
  7444. if (!syntax) {
  7445. return;
  7446. }
  7447. this.atrules[name] = {
  7448. type: 'Atrule',
  7449. name: name,
  7450. prelude: syntax.prelude ? this.createDescriptor(syntax.prelude, 'AtrulePrelude', name) : null,
  7451. descriptors: syntax.descriptors
  7452. ? Object.keys(syntax.descriptors).reduce((res, descName) => {
  7453. res[descName] = this.createDescriptor(syntax.descriptors[descName], 'AtruleDescriptor', descName, name);
  7454. return res;
  7455. }, {})
  7456. : null
  7457. };
  7458. },
  7459. addProperty_: function(name, syntax) {
  7460. if (!syntax) {
  7461. return;
  7462. }
  7463. this.properties[name] = this.createDescriptor(syntax, 'Property', name);
  7464. },
  7465. addType_: function(name, syntax) {
  7466. if (!syntax) {
  7467. return;
  7468. }
  7469. this.types[name] = this.createDescriptor(syntax, 'Type', name);
  7470. if (syntax === generic['-ms-legacy-expression']) {
  7471. this.valueCommonSyntax = cssWideKeywordsWithExpression;
  7472. }
  7473. },
  7474. checkAtruleName: function(atruleName) {
  7475. if (!this.getAtrule(atruleName)) {
  7476. return new SyntaxReferenceError('Unknown at-rule', '@' + atruleName);
  7477. }
  7478. },
  7479. checkAtrulePrelude: function(atruleName, prelude) {
  7480. let error = this.checkAtruleName(atruleName);
  7481. if (error) {
  7482. return error;
  7483. }
  7484. var atrule = this.getAtrule(atruleName);
  7485. if (!atrule.prelude && prelude) {
  7486. return new SyntaxError('At-rule `@' + atruleName + '` should not contain a prelude');
  7487. }
  7488. if (atrule.prelude && !prelude) {
  7489. return new SyntaxError('At-rule `@' + atruleName + '` should contain a prelude');
  7490. }
  7491. },
  7492. checkAtruleDescriptorName: function(atruleName, descriptorName) {
  7493. let error = this.checkAtruleName(atruleName);
  7494. if (error) {
  7495. return error;
  7496. }
  7497. var atrule = this.getAtrule(atruleName);
  7498. var descriptor = names$1.keyword(descriptorName);
  7499. if (!atrule.descriptors) {
  7500. return new SyntaxError('At-rule `@' + atruleName + '` has no known descriptors');
  7501. }
  7502. if (!atrule.descriptors[descriptor.name] &&
  7503. !atrule.descriptors[descriptor.basename]) {
  7504. return new SyntaxReferenceError('Unknown at-rule descriptor', descriptorName);
  7505. }
  7506. },
  7507. checkPropertyName: function(propertyName) {
  7508. var property = names$1.property(propertyName);
  7509. // don't match syntax for a custom property
  7510. if (property.custom) {
  7511. return new Error('Lexer matching doesn\'t applicable for custom properties');
  7512. }
  7513. if (!this.getProperty(propertyName)) {
  7514. return new SyntaxReferenceError('Unknown property', propertyName);
  7515. }
  7516. },
  7517. matchAtrulePrelude: function(atruleName, prelude) {
  7518. var error = this.checkAtrulePrelude(atruleName, prelude);
  7519. if (error) {
  7520. return buildMatchResult(null, error);
  7521. }
  7522. if (!prelude) {
  7523. return buildMatchResult(null, null);
  7524. }
  7525. return matchSyntax(this, this.getAtrule(atruleName).prelude, prelude, false);
  7526. },
  7527. matchAtruleDescriptor: function(atruleName, descriptorName, value) {
  7528. var error = this.checkAtruleDescriptorName(atruleName, descriptorName);
  7529. if (error) {
  7530. return buildMatchResult(null, error);
  7531. }
  7532. var atrule = this.getAtrule(atruleName);
  7533. var descriptor = names$1.keyword(descriptorName);
  7534. return matchSyntax(this, atrule.descriptors[descriptor.name] || atrule.descriptors[descriptor.basename], value, false);
  7535. },
  7536. matchDeclaration: function(node) {
  7537. if (node.type !== 'Declaration') {
  7538. return buildMatchResult(null, new Error('Not a Declaration node'));
  7539. }
  7540. return this.matchProperty(node.property, node.value);
  7541. },
  7542. matchProperty: function(propertyName, value) {
  7543. var error = this.checkPropertyName(propertyName);
  7544. if (error) {
  7545. return buildMatchResult(null, error);
  7546. }
  7547. return matchSyntax(this, this.getProperty(propertyName), value, true);
  7548. },
  7549. matchType: function(typeName, value) {
  7550. var typeSyntax = this.getType(typeName);
  7551. if (!typeSyntax) {
  7552. return buildMatchResult(null, new SyntaxReferenceError('Unknown type', typeName));
  7553. }
  7554. return matchSyntax(this, typeSyntax, value, false);
  7555. },
  7556. match: function(syntax, value) {
  7557. if (typeof syntax !== 'string' && (!syntax || !syntax.type)) {
  7558. return buildMatchResult(null, new SyntaxReferenceError('Bad syntax'));
  7559. }
  7560. if (typeof syntax === 'string' || !syntax.match) {
  7561. syntax = this.createDescriptor(syntax, 'Type', 'anonymous');
  7562. }
  7563. return matchSyntax(this, syntax, value, false);
  7564. },
  7565. findValueFragments: function(propertyName, value, type, name) {
  7566. return search.matchFragments(this, value, this.matchProperty(propertyName, value), type, name);
  7567. },
  7568. findDeclarationValueFragments: function(declaration, type, name) {
  7569. return search.matchFragments(this, declaration.value, this.matchDeclaration(declaration), type, name);
  7570. },
  7571. findAllFragments: function(ast, type, name) {
  7572. var result = [];
  7573. this.syntax.walk(ast, {
  7574. visit: 'Declaration',
  7575. enter: function(declaration) {
  7576. result.push.apply(result, this.findDeclarationValueFragments(declaration, type, name));
  7577. }.bind(this)
  7578. });
  7579. return result;
  7580. },
  7581. getAtrule: function(atruleName, fallbackBasename = true) {
  7582. var atrule = names$1.keyword(atruleName);
  7583. var atruleEntry = atrule.vendor && fallbackBasename
  7584. ? this.atrules[atrule.name] || this.atrules[atrule.basename]
  7585. : this.atrules[atrule.name];
  7586. return atruleEntry || null;
  7587. },
  7588. getAtrulePrelude: function(atruleName, fallbackBasename = true) {
  7589. const atrule = this.getAtrule(atruleName, fallbackBasename);
  7590. return atrule && atrule.prelude || null;
  7591. },
  7592. getAtruleDescriptor: function(atruleName, name) {
  7593. return this.atrules.hasOwnProperty(atruleName) && this.atrules.declarators
  7594. ? this.atrules[atruleName].declarators[name] || null
  7595. : null;
  7596. },
  7597. getProperty: function(propertyName, fallbackBasename = true) {
  7598. var property = names$1.property(propertyName);
  7599. var propertyEntry = property.vendor && fallbackBasename
  7600. ? this.properties[property.name] || this.properties[property.basename]
  7601. : this.properties[property.name];
  7602. return propertyEntry || null;
  7603. },
  7604. getType: function(name) {
  7605. return this.types.hasOwnProperty(name) ? this.types[name] : null;
  7606. },
  7607. validate: function() {
  7608. function validate(syntax, name, broken, descriptor) {
  7609. if (broken.hasOwnProperty(name)) {
  7610. return broken[name];
  7611. }
  7612. broken[name] = false;
  7613. if (descriptor.syntax !== null) {
  7614. walk(descriptor.syntax, function(node) {
  7615. if (node.type !== 'Type' && node.type !== 'Property') {
  7616. return;
  7617. }
  7618. var map = node.type === 'Type' ? syntax.types : syntax.properties;
  7619. var brokenMap = node.type === 'Type' ? brokenTypes : brokenProperties;
  7620. if (!map.hasOwnProperty(node.name) || validate(syntax, node.name, brokenMap, map[node.name])) {
  7621. broken[name] = true;
  7622. }
  7623. }, this);
  7624. }
  7625. }
  7626. var brokenTypes = {};
  7627. var brokenProperties = {};
  7628. for (var key in this.types) {
  7629. validate(this, key, brokenTypes, this.types[key]);
  7630. }
  7631. for (var key in this.properties) {
  7632. validate(this, key, brokenProperties, this.properties[key]);
  7633. }
  7634. brokenTypes = Object.keys(brokenTypes).filter(function(name) {
  7635. return brokenTypes[name];
  7636. });
  7637. brokenProperties = Object.keys(brokenProperties).filter(function(name) {
  7638. return brokenProperties[name];
  7639. });
  7640. if (brokenTypes.length || brokenProperties.length) {
  7641. return {
  7642. types: brokenTypes,
  7643. properties: brokenProperties
  7644. };
  7645. }
  7646. return null;
  7647. },
  7648. dump: function(syntaxAsAst, pretty) {
  7649. return {
  7650. generic: this.generic,
  7651. types: dumpMapSyntax(this.types, !pretty, syntaxAsAst),
  7652. properties: dumpMapSyntax(this.properties, !pretty, syntaxAsAst),
  7653. atrules: dumpAtruleMapSyntax(this.atrules, !pretty, syntaxAsAst)
  7654. };
  7655. },
  7656. toString: function() {
  7657. return JSON.stringify(this.dump());
  7658. }
  7659. };
  7660. var Lexer_1 = Lexer$1;
  7661. var definitionSyntax$1 = {
  7662. SyntaxError: _SyntaxError,
  7663. parse: parse_1,
  7664. generate: generate_1,
  7665. walk: walk$1
  7666. };
  7667. var adoptBuffer = adoptBuffer$2;
  7668. var isBOM = tokenizer$3.isBOM;
  7669. var N$1 = 10;
  7670. var F = 12;
  7671. var R = 13;
  7672. function computeLinesAndColumns(host, source) {
  7673. var sourceLength = source.length;
  7674. var lines = adoptBuffer(host.lines, sourceLength); // +1
  7675. var line = host.startLine;
  7676. var columns = adoptBuffer(host.columns, sourceLength);
  7677. var column = host.startColumn;
  7678. var startOffset = source.length > 0 ? isBOM(source.charCodeAt(0)) : 0;
  7679. for (var i = startOffset; i < sourceLength; i++) { // -1
  7680. var code = source.charCodeAt(i);
  7681. lines[i] = line;
  7682. columns[i] = column++;
  7683. if (code === N$1 || code === R || code === F) {
  7684. if (code === R && i + 1 < sourceLength && source.charCodeAt(i + 1) === N$1) {
  7685. i++;
  7686. lines[i] = line;
  7687. columns[i] = column;
  7688. }
  7689. line++;
  7690. column = 1;
  7691. }
  7692. }
  7693. lines[i] = line;
  7694. columns[i] = column;
  7695. host.lines = lines;
  7696. host.columns = columns;
  7697. }
  7698. var OffsetToLocation$1 = function() {
  7699. this.lines = null;
  7700. this.columns = null;
  7701. this.linesAndColumnsComputed = false;
  7702. };
  7703. OffsetToLocation$1.prototype = {
  7704. setSource: function(source, startOffset, startLine, startColumn) {
  7705. this.source = source;
  7706. this.startOffset = typeof startOffset === 'undefined' ? 0 : startOffset;
  7707. this.startLine = typeof startLine === 'undefined' ? 1 : startLine;
  7708. this.startColumn = typeof startColumn === 'undefined' ? 1 : startColumn;
  7709. this.linesAndColumnsComputed = false;
  7710. },
  7711. ensureLinesAndColumnsComputed: function() {
  7712. if (!this.linesAndColumnsComputed) {
  7713. computeLinesAndColumns(this, this.source);
  7714. this.linesAndColumnsComputed = true;
  7715. }
  7716. },
  7717. getLocation: function(offset, filename) {
  7718. this.ensureLinesAndColumnsComputed();
  7719. return {
  7720. source: filename,
  7721. offset: this.startOffset + offset,
  7722. line: this.lines[offset],
  7723. column: this.columns[offset]
  7724. };
  7725. },
  7726. getLocationRange: function(start, end, filename) {
  7727. this.ensureLinesAndColumnsComputed();
  7728. return {
  7729. source: filename,
  7730. start: {
  7731. offset: this.startOffset + start,
  7732. line: this.lines[start],
  7733. column: this.columns[start]
  7734. },
  7735. end: {
  7736. offset: this.startOffset + end,
  7737. line: this.lines[end],
  7738. column: this.columns[end]
  7739. }
  7740. };
  7741. }
  7742. };
  7743. var OffsetToLocation_1 = OffsetToLocation$1;
  7744. var TYPE$A = tokenizer$3.TYPE;
  7745. var WHITESPACE$a = TYPE$A.WhiteSpace;
  7746. var COMMENT$8 = TYPE$A.Comment;
  7747. var sequence$1 = function readSequence(recognizer) {
  7748. var children = this.createList();
  7749. var child = null;
  7750. var context = {
  7751. recognizer: recognizer,
  7752. space: null,
  7753. ignoreWS: false,
  7754. ignoreWSAfter: false
  7755. };
  7756. this.scanner.skipSC();
  7757. while (!this.scanner.eof) {
  7758. switch (this.scanner.tokenType) {
  7759. case COMMENT$8:
  7760. this.scanner.next();
  7761. continue;
  7762. case WHITESPACE$a:
  7763. if (context.ignoreWS) {
  7764. this.scanner.next();
  7765. } else {
  7766. context.space = this.WhiteSpace();
  7767. }
  7768. continue;
  7769. }
  7770. child = recognizer.getNode.call(this, context);
  7771. if (child === undefined) {
  7772. break;
  7773. }
  7774. if (context.space !== null) {
  7775. children.push(context.space);
  7776. context.space = null;
  7777. }
  7778. children.push(child);
  7779. if (context.ignoreWSAfter) {
  7780. context.ignoreWSAfter = false;
  7781. context.ignoreWS = true;
  7782. } else {
  7783. context.ignoreWS = false;
  7784. }
  7785. }
  7786. return children;
  7787. };
  7788. var OffsetToLocation = OffsetToLocation_1;
  7789. var SyntaxError$2 = _SyntaxError$1;
  7790. var TokenStream$1 = TokenStream_1;
  7791. var List$3 = List_1;
  7792. var tokenize$1 = tokenizer$3;
  7793. var constants = _const;
  7794. var { findWhiteSpaceStart, cmpStr: cmpStr$2 } = utils$2;
  7795. var sequence = sequence$1;
  7796. var noop$1 = function() {};
  7797. var TYPE$z = constants.TYPE;
  7798. var NAME$1 = constants.NAME;
  7799. var WHITESPACE$9 = TYPE$z.WhiteSpace;
  7800. var COMMENT$7 = TYPE$z.Comment;
  7801. var IDENT$g = TYPE$z.Ident;
  7802. var FUNCTION$6 = TYPE$z.Function;
  7803. var URL$4 = TYPE$z.Url;
  7804. var HASH$5 = TYPE$z.Hash;
  7805. var PERCENTAGE$3 = TYPE$z.Percentage;
  7806. var NUMBER$7 = TYPE$z.Number;
  7807. var NUMBERSIGN$3 = 0x0023; // U+0023 NUMBER SIGN (#)
  7808. var NULL = 0;
  7809. function createParseContext(name) {
  7810. return function() {
  7811. return this[name]();
  7812. };
  7813. }
  7814. function processConfig(config) {
  7815. var parserConfig = {
  7816. context: {},
  7817. scope: {},
  7818. atrule: {},
  7819. pseudo: {}
  7820. };
  7821. if (config.parseContext) {
  7822. for (var name in config.parseContext) {
  7823. switch (typeof config.parseContext[name]) {
  7824. case 'function':
  7825. parserConfig.context[name] = config.parseContext[name];
  7826. break;
  7827. case 'string':
  7828. parserConfig.context[name] = createParseContext(config.parseContext[name]);
  7829. break;
  7830. }
  7831. }
  7832. }
  7833. if (config.scope) {
  7834. for (var name in config.scope) {
  7835. parserConfig.scope[name] = config.scope[name];
  7836. }
  7837. }
  7838. if (config.atrule) {
  7839. for (var name in config.atrule) {
  7840. var atrule = config.atrule[name];
  7841. if (atrule.parse) {
  7842. parserConfig.atrule[name] = atrule.parse;
  7843. }
  7844. }
  7845. }
  7846. if (config.pseudo) {
  7847. for (var name in config.pseudo) {
  7848. var pseudo = config.pseudo[name];
  7849. if (pseudo.parse) {
  7850. parserConfig.pseudo[name] = pseudo.parse;
  7851. }
  7852. }
  7853. }
  7854. if (config.node) {
  7855. for (var name in config.node) {
  7856. parserConfig[name] = config.node[name].parse;
  7857. }
  7858. }
  7859. return parserConfig;
  7860. }
  7861. var create$3 = function createParser(config) {
  7862. var parser = {
  7863. scanner: new TokenStream$1(),
  7864. locationMap: new OffsetToLocation(),
  7865. filename: '<unknown>',
  7866. needPositions: false,
  7867. onParseError: noop$1,
  7868. onParseErrorThrow: false,
  7869. parseAtrulePrelude: true,
  7870. parseRulePrelude: true,
  7871. parseValue: true,
  7872. parseCustomProperty: false,
  7873. readSequence: sequence,
  7874. createList: function() {
  7875. return new List$3();
  7876. },
  7877. createSingleNodeList: function(node) {
  7878. return new List$3().appendData(node);
  7879. },
  7880. getFirstListNode: function(list) {
  7881. return list && list.first();
  7882. },
  7883. getLastListNode: function(list) {
  7884. return list.last();
  7885. },
  7886. parseWithFallback: function(consumer, fallback) {
  7887. var startToken = this.scanner.tokenIndex;
  7888. try {
  7889. return consumer.call(this);
  7890. } catch (e) {
  7891. if (this.onParseErrorThrow) {
  7892. throw e;
  7893. }
  7894. var fallbackNode = fallback.call(this, startToken);
  7895. this.onParseErrorThrow = true;
  7896. this.onParseError(e, fallbackNode);
  7897. this.onParseErrorThrow = false;
  7898. return fallbackNode;
  7899. }
  7900. },
  7901. lookupNonWSType: function(offset) {
  7902. do {
  7903. var type = this.scanner.lookupType(offset++);
  7904. if (type !== WHITESPACE$9) {
  7905. return type;
  7906. }
  7907. } while (type !== NULL);
  7908. return NULL;
  7909. },
  7910. eat: function(tokenType) {
  7911. if (this.scanner.tokenType !== tokenType) {
  7912. var offset = this.scanner.tokenStart;
  7913. var message = NAME$1[tokenType] + ' is expected';
  7914. // tweak message and offset
  7915. switch (tokenType) {
  7916. case IDENT$g:
  7917. // when identifier is expected but there is a function or url
  7918. if (this.scanner.tokenType === FUNCTION$6 || this.scanner.tokenType === URL$4) {
  7919. offset = this.scanner.tokenEnd - 1;
  7920. message = 'Identifier is expected but function found';
  7921. } else {
  7922. message = 'Identifier is expected';
  7923. }
  7924. break;
  7925. case HASH$5:
  7926. if (this.scanner.isDelim(NUMBERSIGN$3)) {
  7927. this.scanner.next();
  7928. offset++;
  7929. message = 'Name is expected';
  7930. }
  7931. break;
  7932. case PERCENTAGE$3:
  7933. if (this.scanner.tokenType === NUMBER$7) {
  7934. offset = this.scanner.tokenEnd;
  7935. message = 'Percent sign is expected';
  7936. }
  7937. break;
  7938. default:
  7939. // when test type is part of another token show error for current position + 1
  7940. // e.g. eat(HYPHENMINUS) will fail on "-foo", but pointing on "-" is odd
  7941. if (this.scanner.source.charCodeAt(this.scanner.tokenStart) === tokenType) {
  7942. offset = offset + 1;
  7943. }
  7944. }
  7945. this.error(message, offset);
  7946. }
  7947. this.scanner.next();
  7948. },
  7949. consume: function(tokenType) {
  7950. var value = this.scanner.getTokenValue();
  7951. this.eat(tokenType);
  7952. return value;
  7953. },
  7954. consumeFunctionName: function() {
  7955. var name = this.scanner.source.substring(this.scanner.tokenStart, this.scanner.tokenEnd - 1);
  7956. this.eat(FUNCTION$6);
  7957. return name;
  7958. },
  7959. getLocation: function(start, end) {
  7960. if (this.needPositions) {
  7961. return this.locationMap.getLocationRange(
  7962. start,
  7963. end,
  7964. this.filename
  7965. );
  7966. }
  7967. return null;
  7968. },
  7969. getLocationFromList: function(list) {
  7970. if (this.needPositions) {
  7971. var head = this.getFirstListNode(list);
  7972. var tail = this.getLastListNode(list);
  7973. return this.locationMap.getLocationRange(
  7974. head !== null ? head.loc.start.offset - this.locationMap.startOffset : this.scanner.tokenStart,
  7975. tail !== null ? tail.loc.end.offset - this.locationMap.startOffset : this.scanner.tokenStart,
  7976. this.filename
  7977. );
  7978. }
  7979. return null;
  7980. },
  7981. error: function(message, offset) {
  7982. var location = typeof offset !== 'undefined' && offset < this.scanner.source.length
  7983. ? this.locationMap.getLocation(offset)
  7984. : this.scanner.eof
  7985. ? this.locationMap.getLocation(findWhiteSpaceStart(this.scanner.source, this.scanner.source.length - 1))
  7986. : this.locationMap.getLocation(this.scanner.tokenStart);
  7987. throw new SyntaxError$2(
  7988. message || 'Unexpected input',
  7989. this.scanner.source,
  7990. location.offset,
  7991. location.line,
  7992. location.column
  7993. );
  7994. }
  7995. };
  7996. config = processConfig(config || {});
  7997. for (var key in config) {
  7998. parser[key] = config[key];
  7999. }
  8000. return function(source, options) {
  8001. options = options || {};
  8002. var context = options.context || 'default';
  8003. var onComment = options.onComment;
  8004. var ast;
  8005. tokenize$1(source, parser.scanner);
  8006. parser.locationMap.setSource(
  8007. source,
  8008. options.offset,
  8009. options.line,
  8010. options.column
  8011. );
  8012. parser.filename = options.filename || '<unknown>';
  8013. parser.needPositions = Boolean(options.positions);
  8014. parser.onParseError = typeof options.onParseError === 'function' ? options.onParseError : noop$1;
  8015. parser.onParseErrorThrow = false;
  8016. parser.parseAtrulePrelude = 'parseAtrulePrelude' in options ? Boolean(options.parseAtrulePrelude) : true;
  8017. parser.parseRulePrelude = 'parseRulePrelude' in options ? Boolean(options.parseRulePrelude) : true;
  8018. parser.parseValue = 'parseValue' in options ? Boolean(options.parseValue) : true;
  8019. parser.parseCustomProperty = 'parseCustomProperty' in options ? Boolean(options.parseCustomProperty) : false;
  8020. if (!parser.context.hasOwnProperty(context)) {
  8021. throw new Error('Unknown context `' + context + '`');
  8022. }
  8023. if (typeof onComment === 'function') {
  8024. parser.scanner.forEachToken((type, start, end) => {
  8025. if (type === COMMENT$7) {
  8026. const loc = parser.getLocation(start, end);
  8027. const value = cmpStr$2(source, end - 2, end, '*/')
  8028. ? source.slice(start + 2, end - 2)
  8029. : source.slice(start + 2, end);
  8030. onComment(value, loc);
  8031. }
  8032. });
  8033. }
  8034. ast = parser.context[context].call(parser, options);
  8035. if (!parser.scanner.eof) {
  8036. parser.error();
  8037. }
  8038. return ast;
  8039. };
  8040. };
  8041. var sourceMapGenerator = {};
  8042. var base64Vlq = {};
  8043. var base64$1 = {};
  8044. /* -*- Mode: js; js-indent-level: 2; -*- */
  8045. /*
  8046. * Copyright 2011 Mozilla Foundation and contributors
  8047. * Licensed under the New BSD license. See LICENSE or:
  8048. * http://opensource.org/licenses/BSD-3-Clause
  8049. */
  8050. var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
  8051. /**
  8052. * Encode an integer in the range of 0 to 63 to a single base 64 digit.
  8053. */
  8054. base64$1.encode = function (number) {
  8055. if (0 <= number && number < intToCharMap.length) {
  8056. return intToCharMap[number];
  8057. }
  8058. throw new TypeError("Must be between 0 and 63: " + number);
  8059. };
  8060. /**
  8061. * Decode a single base 64 character code digit to an integer. Returns -1 on
  8062. * failure.
  8063. */
  8064. base64$1.decode = function (charCode) {
  8065. var bigA = 65; // 'A'
  8066. var bigZ = 90; // 'Z'
  8067. var littleA = 97; // 'a'
  8068. var littleZ = 122; // 'z'
  8069. var zero = 48; // '0'
  8070. var nine = 57; // '9'
  8071. var plus = 43; // '+'
  8072. var slash = 47; // '/'
  8073. var littleOffset = 26;
  8074. var numberOffset = 52;
  8075. // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  8076. if (bigA <= charCode && charCode <= bigZ) {
  8077. return (charCode - bigA);
  8078. }
  8079. // 26 - 51: abcdefghijklmnopqrstuvwxyz
  8080. if (littleA <= charCode && charCode <= littleZ) {
  8081. return (charCode - littleA + littleOffset);
  8082. }
  8083. // 52 - 61: 0123456789
  8084. if (zero <= charCode && charCode <= nine) {
  8085. return (charCode - zero + numberOffset);
  8086. }
  8087. // 62: +
  8088. if (charCode == plus) {
  8089. return 62;
  8090. }
  8091. // 63: /
  8092. if (charCode == slash) {
  8093. return 63;
  8094. }
  8095. // Invalid base64 digit.
  8096. return -1;
  8097. };
  8098. /* -*- Mode: js; js-indent-level: 2; -*- */
  8099. /*
  8100. * Copyright 2011 Mozilla Foundation and contributors
  8101. * Licensed under the New BSD license. See LICENSE or:
  8102. * http://opensource.org/licenses/BSD-3-Clause
  8103. *
  8104. * Based on the Base 64 VLQ implementation in Closure Compiler:
  8105. * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
  8106. *
  8107. * Copyright 2011 The Closure Compiler Authors. All rights reserved.
  8108. * Redistribution and use in source and binary forms, with or without
  8109. * modification, are permitted provided that the following conditions are
  8110. * met:
  8111. *
  8112. * * Redistributions of source code must retain the above copyright
  8113. * notice, this list of conditions and the following disclaimer.
  8114. * * Redistributions in binary form must reproduce the above
  8115. * copyright notice, this list of conditions and the following
  8116. * disclaimer in the documentation and/or other materials provided
  8117. * with the distribution.
  8118. * * Neither the name of Google Inc. nor the names of its
  8119. * contributors may be used to endorse or promote products derived
  8120. * from this software without specific prior written permission.
  8121. *
  8122. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  8123. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  8124. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  8125. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  8126. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  8127. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  8128. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  8129. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  8130. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  8131. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  8132. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  8133. */
  8134. var base64 = base64$1;
  8135. // A single base 64 digit can contain 6 bits of data. For the base 64 variable
  8136. // length quantities we use in the source map spec, the first bit is the sign,
  8137. // the next four bits are the actual value, and the 6th bit is the
  8138. // continuation bit. The continuation bit tells us whether there are more
  8139. // digits in this value following this digit.
  8140. //
  8141. // Continuation
  8142. // | Sign
  8143. // | |
  8144. // V V
  8145. // 101011
  8146. var VLQ_BASE_SHIFT = 5;
  8147. // binary: 100000
  8148. var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
  8149. // binary: 011111
  8150. var VLQ_BASE_MASK = VLQ_BASE - 1;
  8151. // binary: 100000
  8152. var VLQ_CONTINUATION_BIT = VLQ_BASE;
  8153. /**
  8154. * Converts from a two-complement value to a value where the sign bit is
  8155. * placed in the least significant bit. For example, as decimals:
  8156. * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
  8157. * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
  8158. */
  8159. function toVLQSigned(aValue) {
  8160. return aValue < 0
  8161. ? ((-aValue) << 1) + 1
  8162. : (aValue << 1) + 0;
  8163. }
  8164. /**
  8165. * Converts to a two-complement value from a value where the sign bit is
  8166. * placed in the least significant bit. For example, as decimals:
  8167. * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
  8168. * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
  8169. */
  8170. function fromVLQSigned(aValue) {
  8171. var isNegative = (aValue & 1) === 1;
  8172. var shifted = aValue >> 1;
  8173. return isNegative
  8174. ? -shifted
  8175. : shifted;
  8176. }
  8177. /**
  8178. * Returns the base 64 VLQ encoded value.
  8179. */
  8180. base64Vlq.encode = function base64VLQ_encode(aValue) {
  8181. var encoded = "";
  8182. var digit;
  8183. var vlq = toVLQSigned(aValue);
  8184. do {
  8185. digit = vlq & VLQ_BASE_MASK;
  8186. vlq >>>= VLQ_BASE_SHIFT;
  8187. if (vlq > 0) {
  8188. // There are still more digits in this value, so we must make sure the
  8189. // continuation bit is marked.
  8190. digit |= VLQ_CONTINUATION_BIT;
  8191. }
  8192. encoded += base64.encode(digit);
  8193. } while (vlq > 0);
  8194. return encoded;
  8195. };
  8196. /**
  8197. * Decodes the next base 64 VLQ value from the given string and returns the
  8198. * value and the rest of the string via the out parameter.
  8199. */
  8200. base64Vlq.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
  8201. var strLen = aStr.length;
  8202. var result = 0;
  8203. var shift = 0;
  8204. var continuation, digit;
  8205. do {
  8206. if (aIndex >= strLen) {
  8207. throw new Error("Expected more digits in base 64 VLQ value.");
  8208. }
  8209. digit = base64.decode(aStr.charCodeAt(aIndex++));
  8210. if (digit === -1) {
  8211. throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
  8212. }
  8213. continuation = !!(digit & VLQ_CONTINUATION_BIT);
  8214. digit &= VLQ_BASE_MASK;
  8215. result = result + (digit << shift);
  8216. shift += VLQ_BASE_SHIFT;
  8217. } while (continuation);
  8218. aOutParam.value = fromVLQSigned(result);
  8219. aOutParam.rest = aIndex;
  8220. };
  8221. var util$3 = {};
  8222. /* -*- Mode: js; js-indent-level: 2; -*- */
  8223. (function (exports) {
  8224. /*
  8225. * Copyright 2011 Mozilla Foundation and contributors
  8226. * Licensed under the New BSD license. See LICENSE or:
  8227. * http://opensource.org/licenses/BSD-3-Clause
  8228. */
  8229. /**
  8230. * This is a helper function for getting values from parameter/options
  8231. * objects.
  8232. *
  8233. * @param args The object we are extracting values from
  8234. * @param name The name of the property we are getting.
  8235. * @param defaultValue An optional value to return if the property is missing
  8236. * from the object. If this is not specified and the property is missing, an
  8237. * error will be thrown.
  8238. */
  8239. function getArg(aArgs, aName, aDefaultValue) {
  8240. if (aName in aArgs) {
  8241. return aArgs[aName];
  8242. } else if (arguments.length === 3) {
  8243. return aDefaultValue;
  8244. } else {
  8245. throw new Error('"' + aName + '" is a required argument.');
  8246. }
  8247. }
  8248. exports.getArg = getArg;
  8249. var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
  8250. var dataUrlRegexp = /^data:.+\,.+$/;
  8251. function urlParse(aUrl) {
  8252. var match = aUrl.match(urlRegexp);
  8253. if (!match) {
  8254. return null;
  8255. }
  8256. return {
  8257. scheme: match[1],
  8258. auth: match[2],
  8259. host: match[3],
  8260. port: match[4],
  8261. path: match[5]
  8262. };
  8263. }
  8264. exports.urlParse = urlParse;
  8265. function urlGenerate(aParsedUrl) {
  8266. var url = '';
  8267. if (aParsedUrl.scheme) {
  8268. url += aParsedUrl.scheme + ':';
  8269. }
  8270. url += '//';
  8271. if (aParsedUrl.auth) {
  8272. url += aParsedUrl.auth + '@';
  8273. }
  8274. if (aParsedUrl.host) {
  8275. url += aParsedUrl.host;
  8276. }
  8277. if (aParsedUrl.port) {
  8278. url += ":" + aParsedUrl.port;
  8279. }
  8280. if (aParsedUrl.path) {
  8281. url += aParsedUrl.path;
  8282. }
  8283. return url;
  8284. }
  8285. exports.urlGenerate = urlGenerate;
  8286. /**
  8287. * Normalizes a path, or the path portion of a URL:
  8288. *
  8289. * - Replaces consecutive slashes with one slash.
  8290. * - Removes unnecessary '.' parts.
  8291. * - Removes unnecessary '<dir>/..' parts.
  8292. *
  8293. * Based on code in the Node.js 'path' core module.
  8294. *
  8295. * @param aPath The path or url to normalize.
  8296. */
  8297. function normalize(aPath) {
  8298. var path = aPath;
  8299. var url = urlParse(aPath);
  8300. if (url) {
  8301. if (!url.path) {
  8302. return aPath;
  8303. }
  8304. path = url.path;
  8305. }
  8306. var isAbsolute = exports.isAbsolute(path);
  8307. var parts = path.split(/\/+/);
  8308. for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
  8309. part = parts[i];
  8310. if (part === '.') {
  8311. parts.splice(i, 1);
  8312. } else if (part === '..') {
  8313. up++;
  8314. } else if (up > 0) {
  8315. if (part === '') {
  8316. // The first part is blank if the path is absolute. Trying to go
  8317. // above the root is a no-op. Therefore we can remove all '..' parts
  8318. // directly after the root.
  8319. parts.splice(i + 1, up);
  8320. up = 0;
  8321. } else {
  8322. parts.splice(i, 2);
  8323. up--;
  8324. }
  8325. }
  8326. }
  8327. path = parts.join('/');
  8328. if (path === '') {
  8329. path = isAbsolute ? '/' : '.';
  8330. }
  8331. if (url) {
  8332. url.path = path;
  8333. return urlGenerate(url);
  8334. }
  8335. return path;
  8336. }
  8337. exports.normalize = normalize;
  8338. /**
  8339. * Joins two paths/URLs.
  8340. *
  8341. * @param aRoot The root path or URL.
  8342. * @param aPath The path or URL to be joined with the root.
  8343. *
  8344. * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
  8345. * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
  8346. * first.
  8347. * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
  8348. * is updated with the result and aRoot is returned. Otherwise the result
  8349. * is returned.
  8350. * - If aPath is absolute, the result is aPath.
  8351. * - Otherwise the two paths are joined with a slash.
  8352. * - Joining for example 'http://' and 'www.example.com' is also supported.
  8353. */
  8354. function join(aRoot, aPath) {
  8355. if (aRoot === "") {
  8356. aRoot = ".";
  8357. }
  8358. if (aPath === "") {
  8359. aPath = ".";
  8360. }
  8361. var aPathUrl = urlParse(aPath);
  8362. var aRootUrl = urlParse(aRoot);
  8363. if (aRootUrl) {
  8364. aRoot = aRootUrl.path || '/';
  8365. }
  8366. // `join(foo, '//www.example.org')`
  8367. if (aPathUrl && !aPathUrl.scheme) {
  8368. if (aRootUrl) {
  8369. aPathUrl.scheme = aRootUrl.scheme;
  8370. }
  8371. return urlGenerate(aPathUrl);
  8372. }
  8373. if (aPathUrl || aPath.match(dataUrlRegexp)) {
  8374. return aPath;
  8375. }
  8376. // `join('http://', 'www.example.com')`
  8377. if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
  8378. aRootUrl.host = aPath;
  8379. return urlGenerate(aRootUrl);
  8380. }
  8381. var joined = aPath.charAt(0) === '/'
  8382. ? aPath
  8383. : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
  8384. if (aRootUrl) {
  8385. aRootUrl.path = joined;
  8386. return urlGenerate(aRootUrl);
  8387. }
  8388. return joined;
  8389. }
  8390. exports.join = join;
  8391. exports.isAbsolute = function (aPath) {
  8392. return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
  8393. };
  8394. /**
  8395. * Make a path relative to a URL or another path.
  8396. *
  8397. * @param aRoot The root path or URL.
  8398. * @param aPath The path or URL to be made relative to aRoot.
  8399. */
  8400. function relative(aRoot, aPath) {
  8401. if (aRoot === "") {
  8402. aRoot = ".";
  8403. }
  8404. aRoot = aRoot.replace(/\/$/, '');
  8405. // It is possible for the path to be above the root. In this case, simply
  8406. // checking whether the root is a prefix of the path won't work. Instead, we
  8407. // need to remove components from the root one by one, until either we find
  8408. // a prefix that fits, or we run out of components to remove.
  8409. var level = 0;
  8410. while (aPath.indexOf(aRoot + '/') !== 0) {
  8411. var index = aRoot.lastIndexOf("/");
  8412. if (index < 0) {
  8413. return aPath;
  8414. }
  8415. // If the only part of the root that is left is the scheme (i.e. http://,
  8416. // file:///, etc.), one or more slashes (/), or simply nothing at all, we
  8417. // have exhausted all components, so the path is not relative to the root.
  8418. aRoot = aRoot.slice(0, index);
  8419. if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
  8420. return aPath;
  8421. }
  8422. ++level;
  8423. }
  8424. // Make sure we add a "../" for each component we removed from the root.
  8425. return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
  8426. }
  8427. exports.relative = relative;
  8428. var supportsNullProto = (function () {
  8429. var obj = Object.create(null);
  8430. return !('__proto__' in obj);
  8431. }());
  8432. function identity (s) {
  8433. return s;
  8434. }
  8435. /**
  8436. * Because behavior goes wacky when you set `__proto__` on objects, we
  8437. * have to prefix all the strings in our set with an arbitrary character.
  8438. *
  8439. * See https://github.com/mozilla/source-map/pull/31 and
  8440. * https://github.com/mozilla/source-map/issues/30
  8441. *
  8442. * @param String aStr
  8443. */
  8444. function toSetString(aStr) {
  8445. if (isProtoString(aStr)) {
  8446. return '$' + aStr;
  8447. }
  8448. return aStr;
  8449. }
  8450. exports.toSetString = supportsNullProto ? identity : toSetString;
  8451. function fromSetString(aStr) {
  8452. if (isProtoString(aStr)) {
  8453. return aStr.slice(1);
  8454. }
  8455. return aStr;
  8456. }
  8457. exports.fromSetString = supportsNullProto ? identity : fromSetString;
  8458. function isProtoString(s) {
  8459. if (!s) {
  8460. return false;
  8461. }
  8462. var length = s.length;
  8463. if (length < 9 /* "__proto__".length */) {
  8464. return false;
  8465. }
  8466. if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
  8467. s.charCodeAt(length - 2) !== 95 /* '_' */ ||
  8468. s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
  8469. s.charCodeAt(length - 4) !== 116 /* 't' */ ||
  8470. s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
  8471. s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
  8472. s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
  8473. s.charCodeAt(length - 8) !== 95 /* '_' */ ||
  8474. s.charCodeAt(length - 9) !== 95 /* '_' */) {
  8475. return false;
  8476. }
  8477. for (var i = length - 10; i >= 0; i--) {
  8478. if (s.charCodeAt(i) !== 36 /* '$' */) {
  8479. return false;
  8480. }
  8481. }
  8482. return true;
  8483. }
  8484. /**
  8485. * Comparator between two mappings where the original positions are compared.
  8486. *
  8487. * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  8488. * mappings with the same original source/line/column, but different generated
  8489. * line and column the same. Useful when searching for a mapping with a
  8490. * stubbed out mapping.
  8491. */
  8492. function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
  8493. var cmp = strcmp(mappingA.source, mappingB.source);
  8494. if (cmp !== 0) {
  8495. return cmp;
  8496. }
  8497. cmp = mappingA.originalLine - mappingB.originalLine;
  8498. if (cmp !== 0) {
  8499. return cmp;
  8500. }
  8501. cmp = mappingA.originalColumn - mappingB.originalColumn;
  8502. if (cmp !== 0 || onlyCompareOriginal) {
  8503. return cmp;
  8504. }
  8505. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  8506. if (cmp !== 0) {
  8507. return cmp;
  8508. }
  8509. cmp = mappingA.generatedLine - mappingB.generatedLine;
  8510. if (cmp !== 0) {
  8511. return cmp;
  8512. }
  8513. return strcmp(mappingA.name, mappingB.name);
  8514. }
  8515. exports.compareByOriginalPositions = compareByOriginalPositions;
  8516. /**
  8517. * Comparator between two mappings with deflated source and name indices where
  8518. * the generated positions are compared.
  8519. *
  8520. * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  8521. * mappings with the same generated line and column, but different
  8522. * source/name/original line and column the same. Useful when searching for a
  8523. * mapping with a stubbed out mapping.
  8524. */
  8525. function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
  8526. var cmp = mappingA.generatedLine - mappingB.generatedLine;
  8527. if (cmp !== 0) {
  8528. return cmp;
  8529. }
  8530. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  8531. if (cmp !== 0 || onlyCompareGenerated) {
  8532. return cmp;
  8533. }
  8534. cmp = strcmp(mappingA.source, mappingB.source);
  8535. if (cmp !== 0) {
  8536. return cmp;
  8537. }
  8538. cmp = mappingA.originalLine - mappingB.originalLine;
  8539. if (cmp !== 0) {
  8540. return cmp;
  8541. }
  8542. cmp = mappingA.originalColumn - mappingB.originalColumn;
  8543. if (cmp !== 0) {
  8544. return cmp;
  8545. }
  8546. return strcmp(mappingA.name, mappingB.name);
  8547. }
  8548. exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
  8549. function strcmp(aStr1, aStr2) {
  8550. if (aStr1 === aStr2) {
  8551. return 0;
  8552. }
  8553. if (aStr1 === null) {
  8554. return 1; // aStr2 !== null
  8555. }
  8556. if (aStr2 === null) {
  8557. return -1; // aStr1 !== null
  8558. }
  8559. if (aStr1 > aStr2) {
  8560. return 1;
  8561. }
  8562. return -1;
  8563. }
  8564. /**
  8565. * Comparator between two mappings with inflated source and name strings where
  8566. * the generated positions are compared.
  8567. */
  8568. function compareByGeneratedPositionsInflated(mappingA, mappingB) {
  8569. var cmp = mappingA.generatedLine - mappingB.generatedLine;
  8570. if (cmp !== 0) {
  8571. return cmp;
  8572. }
  8573. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  8574. if (cmp !== 0) {
  8575. return cmp;
  8576. }
  8577. cmp = strcmp(mappingA.source, mappingB.source);
  8578. if (cmp !== 0) {
  8579. return cmp;
  8580. }
  8581. cmp = mappingA.originalLine - mappingB.originalLine;
  8582. if (cmp !== 0) {
  8583. return cmp;
  8584. }
  8585. cmp = mappingA.originalColumn - mappingB.originalColumn;
  8586. if (cmp !== 0) {
  8587. return cmp;
  8588. }
  8589. return strcmp(mappingA.name, mappingB.name);
  8590. }
  8591. exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
  8592. /**
  8593. * Strip any JSON XSSI avoidance prefix from the string (as documented
  8594. * in the source maps specification), and then parse the string as
  8595. * JSON.
  8596. */
  8597. function parseSourceMapInput(str) {
  8598. return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
  8599. }
  8600. exports.parseSourceMapInput = parseSourceMapInput;
  8601. /**
  8602. * Compute the URL of a source given the the source root, the source's
  8603. * URL, and the source map's URL.
  8604. */
  8605. function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
  8606. sourceURL = sourceURL || '';
  8607. if (sourceRoot) {
  8608. // This follows what Chrome does.
  8609. if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
  8610. sourceRoot += '/';
  8611. }
  8612. // The spec says:
  8613. // Line 4: An optional source root, useful for relocating source
  8614. // files on a server or removing repeated values in the
  8615. // “sources” entry. This value is prepended to the individual
  8616. // entries in the “source” field.
  8617. sourceURL = sourceRoot + sourceURL;
  8618. }
  8619. // Historically, SourceMapConsumer did not take the sourceMapURL as
  8620. // a parameter. This mode is still somewhat supported, which is why
  8621. // this code block is conditional. However, it's preferable to pass
  8622. // the source map URL to SourceMapConsumer, so that this function
  8623. // can implement the source URL resolution algorithm as outlined in
  8624. // the spec. This block is basically the equivalent of:
  8625. // new URL(sourceURL, sourceMapURL).toString()
  8626. // ... except it avoids using URL, which wasn't available in the
  8627. // older releases of node still supported by this library.
  8628. //
  8629. // The spec says:
  8630. // If the sources are not absolute URLs after prepending of the
  8631. // “sourceRoot”, the sources are resolved relative to the
  8632. // SourceMap (like resolving script src in a html document).
  8633. if (sourceMapURL) {
  8634. var parsed = urlParse(sourceMapURL);
  8635. if (!parsed) {
  8636. throw new Error("sourceMapURL could not be parsed");
  8637. }
  8638. if (parsed.path) {
  8639. // Strip the last path component, but keep the "/".
  8640. var index = parsed.path.lastIndexOf('/');
  8641. if (index >= 0) {
  8642. parsed.path = parsed.path.substring(0, index + 1);
  8643. }
  8644. }
  8645. sourceURL = join(urlGenerate(parsed), sourceURL);
  8646. }
  8647. return normalize(sourceURL);
  8648. }
  8649. exports.computeSourceURL = computeSourceURL;
  8650. } (util$3));
  8651. var arraySet = {};
  8652. /* -*- Mode: js; js-indent-level: 2; -*- */
  8653. /*
  8654. * Copyright 2011 Mozilla Foundation and contributors
  8655. * Licensed under the New BSD license. See LICENSE or:
  8656. * http://opensource.org/licenses/BSD-3-Clause
  8657. */
  8658. var util$2 = util$3;
  8659. var has$1 = Object.prototype.hasOwnProperty;
  8660. var hasNativeMap = typeof Map !== "undefined";
  8661. /**
  8662. * A data structure which is a combination of an array and a set. Adding a new
  8663. * member is O(1), testing for membership is O(1), and finding the index of an
  8664. * element is O(1). Removing elements from the set is not supported. Only
  8665. * strings are supported for membership.
  8666. */
  8667. function ArraySet$1() {
  8668. this._array = [];
  8669. this._set = hasNativeMap ? new Map() : Object.create(null);
  8670. }
  8671. /**
  8672. * Static method for creating ArraySet instances from an existing array.
  8673. */
  8674. ArraySet$1.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
  8675. var set = new ArraySet$1();
  8676. for (var i = 0, len = aArray.length; i < len; i++) {
  8677. set.add(aArray[i], aAllowDuplicates);
  8678. }
  8679. return set;
  8680. };
  8681. /**
  8682. * Return how many unique items are in this ArraySet. If duplicates have been
  8683. * added, than those do not count towards the size.
  8684. *
  8685. * @returns Number
  8686. */
  8687. ArraySet$1.prototype.size = function ArraySet_size() {
  8688. return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
  8689. };
  8690. /**
  8691. * Add the given string to this set.
  8692. *
  8693. * @param String aStr
  8694. */
  8695. ArraySet$1.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
  8696. var sStr = hasNativeMap ? aStr : util$2.toSetString(aStr);
  8697. var isDuplicate = hasNativeMap ? this.has(aStr) : has$1.call(this._set, sStr);
  8698. var idx = this._array.length;
  8699. if (!isDuplicate || aAllowDuplicates) {
  8700. this._array.push(aStr);
  8701. }
  8702. if (!isDuplicate) {
  8703. if (hasNativeMap) {
  8704. this._set.set(aStr, idx);
  8705. } else {
  8706. this._set[sStr] = idx;
  8707. }
  8708. }
  8709. };
  8710. /**
  8711. * Is the given string a member of this set?
  8712. *
  8713. * @param String aStr
  8714. */
  8715. ArraySet$1.prototype.has = function ArraySet_has(aStr) {
  8716. if (hasNativeMap) {
  8717. return this._set.has(aStr);
  8718. } else {
  8719. var sStr = util$2.toSetString(aStr);
  8720. return has$1.call(this._set, sStr);
  8721. }
  8722. };
  8723. /**
  8724. * What is the index of the given string in the array?
  8725. *
  8726. * @param String aStr
  8727. */
  8728. ArraySet$1.prototype.indexOf = function ArraySet_indexOf(aStr) {
  8729. if (hasNativeMap) {
  8730. var idx = this._set.get(aStr);
  8731. if (idx >= 0) {
  8732. return idx;
  8733. }
  8734. } else {
  8735. var sStr = util$2.toSetString(aStr);
  8736. if (has$1.call(this._set, sStr)) {
  8737. return this._set[sStr];
  8738. }
  8739. }
  8740. throw new Error('"' + aStr + '" is not in the set.');
  8741. };
  8742. /**
  8743. * What is the element at the given index?
  8744. *
  8745. * @param Number aIdx
  8746. */
  8747. ArraySet$1.prototype.at = function ArraySet_at(aIdx) {
  8748. if (aIdx >= 0 && aIdx < this._array.length) {
  8749. return this._array[aIdx];
  8750. }
  8751. throw new Error('No element indexed by ' + aIdx);
  8752. };
  8753. /**
  8754. * Returns the array representation of this set (which has the proper indices
  8755. * indicated by indexOf). Note that this is a copy of the internal array used
  8756. * for storing the members so that no one can mess with internal state.
  8757. */
  8758. ArraySet$1.prototype.toArray = function ArraySet_toArray() {
  8759. return this._array.slice();
  8760. };
  8761. arraySet.ArraySet = ArraySet$1;
  8762. var mappingList = {};
  8763. /* -*- Mode: js; js-indent-level: 2; -*- */
  8764. /*
  8765. * Copyright 2014 Mozilla Foundation and contributors
  8766. * Licensed under the New BSD license. See LICENSE or:
  8767. * http://opensource.org/licenses/BSD-3-Clause
  8768. */
  8769. var util$1 = util$3;
  8770. /**
  8771. * Determine whether mappingB is after mappingA with respect to generated
  8772. * position.
  8773. */
  8774. function generatedPositionAfter(mappingA, mappingB) {
  8775. // Optimized for most common case
  8776. var lineA = mappingA.generatedLine;
  8777. var lineB = mappingB.generatedLine;
  8778. var columnA = mappingA.generatedColumn;
  8779. var columnB = mappingB.generatedColumn;
  8780. return lineB > lineA || lineB == lineA && columnB >= columnA ||
  8781. util$1.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
  8782. }
  8783. /**
  8784. * A data structure to provide a sorted view of accumulated mappings in a
  8785. * performance conscious manner. It trades a neglibable overhead in general
  8786. * case for a large speedup in case of mappings being added in order.
  8787. */
  8788. function MappingList$1() {
  8789. this._array = [];
  8790. this._sorted = true;
  8791. // Serves as infimum
  8792. this._last = {generatedLine: -1, generatedColumn: 0};
  8793. }
  8794. /**
  8795. * Iterate through internal items. This method takes the same arguments that
  8796. * `Array.prototype.forEach` takes.
  8797. *
  8798. * NOTE: The order of the mappings is NOT guaranteed.
  8799. */
  8800. MappingList$1.prototype.unsortedForEach =
  8801. function MappingList_forEach(aCallback, aThisArg) {
  8802. this._array.forEach(aCallback, aThisArg);
  8803. };
  8804. /**
  8805. * Add the given source mapping.
  8806. *
  8807. * @param Object aMapping
  8808. */
  8809. MappingList$1.prototype.add = function MappingList_add(aMapping) {
  8810. if (generatedPositionAfter(this._last, aMapping)) {
  8811. this._last = aMapping;
  8812. this._array.push(aMapping);
  8813. } else {
  8814. this._sorted = false;
  8815. this._array.push(aMapping);
  8816. }
  8817. };
  8818. /**
  8819. * Returns the flat, sorted array of mappings. The mappings are sorted by
  8820. * generated position.
  8821. *
  8822. * WARNING: This method returns internal data without copying, for
  8823. * performance. The return value must NOT be mutated, and should be treated as
  8824. * an immutable borrow. If you want to take ownership, you must make your own
  8825. * copy.
  8826. */
  8827. MappingList$1.prototype.toArray = function MappingList_toArray() {
  8828. if (!this._sorted) {
  8829. this._array.sort(util$1.compareByGeneratedPositionsInflated);
  8830. this._sorted = true;
  8831. }
  8832. return this._array;
  8833. };
  8834. mappingList.MappingList = MappingList$1;
  8835. /* -*- Mode: js; js-indent-level: 2; -*- */
  8836. /*
  8837. * Copyright 2011 Mozilla Foundation and contributors
  8838. * Licensed under the New BSD license. See LICENSE or:
  8839. * http://opensource.org/licenses/BSD-3-Clause
  8840. */
  8841. var base64VLQ = base64Vlq;
  8842. var util = util$3;
  8843. var ArraySet = arraySet.ArraySet;
  8844. var MappingList = mappingList.MappingList;
  8845. /**
  8846. * An instance of the SourceMapGenerator represents a source map which is
  8847. * being built incrementally. You may pass an object with the following
  8848. * properties:
  8849. *
  8850. * - file: The filename of the generated source.
  8851. * - sourceRoot: A root for all relative URLs in this source map.
  8852. */
  8853. function SourceMapGenerator$1(aArgs) {
  8854. if (!aArgs) {
  8855. aArgs = {};
  8856. }
  8857. this._file = util.getArg(aArgs, 'file', null);
  8858. this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
  8859. this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
  8860. this._sources = new ArraySet();
  8861. this._names = new ArraySet();
  8862. this._mappings = new MappingList();
  8863. this._sourcesContents = null;
  8864. }
  8865. SourceMapGenerator$1.prototype._version = 3;
  8866. /**
  8867. * Creates a new SourceMapGenerator based on a SourceMapConsumer
  8868. *
  8869. * @param aSourceMapConsumer The SourceMap.
  8870. */
  8871. SourceMapGenerator$1.fromSourceMap =
  8872. function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
  8873. var sourceRoot = aSourceMapConsumer.sourceRoot;
  8874. var generator = new SourceMapGenerator$1({
  8875. file: aSourceMapConsumer.file,
  8876. sourceRoot: sourceRoot
  8877. });
  8878. aSourceMapConsumer.eachMapping(function (mapping) {
  8879. var newMapping = {
  8880. generated: {
  8881. line: mapping.generatedLine,
  8882. column: mapping.generatedColumn
  8883. }
  8884. };
  8885. if (mapping.source != null) {
  8886. newMapping.source = mapping.source;
  8887. if (sourceRoot != null) {
  8888. newMapping.source = util.relative(sourceRoot, newMapping.source);
  8889. }
  8890. newMapping.original = {
  8891. line: mapping.originalLine,
  8892. column: mapping.originalColumn
  8893. };
  8894. if (mapping.name != null) {
  8895. newMapping.name = mapping.name;
  8896. }
  8897. }
  8898. generator.addMapping(newMapping);
  8899. });
  8900. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  8901. var sourceRelative = sourceFile;
  8902. if (sourceRoot !== null) {
  8903. sourceRelative = util.relative(sourceRoot, sourceFile);
  8904. }
  8905. if (!generator._sources.has(sourceRelative)) {
  8906. generator._sources.add(sourceRelative);
  8907. }
  8908. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  8909. if (content != null) {
  8910. generator.setSourceContent(sourceFile, content);
  8911. }
  8912. });
  8913. return generator;
  8914. };
  8915. /**
  8916. * Add a single mapping from original source line and column to the generated
  8917. * source's line and column for this source map being created. The mapping
  8918. * object should have the following properties:
  8919. *
  8920. * - generated: An object with the generated line and column positions.
  8921. * - original: An object with the original line and column positions.
  8922. * - source: The original source file (relative to the sourceRoot).
  8923. * - name: An optional original token name for this mapping.
  8924. */
  8925. SourceMapGenerator$1.prototype.addMapping =
  8926. function SourceMapGenerator_addMapping(aArgs) {
  8927. var generated = util.getArg(aArgs, 'generated');
  8928. var original = util.getArg(aArgs, 'original', null);
  8929. var source = util.getArg(aArgs, 'source', null);
  8930. var name = util.getArg(aArgs, 'name', null);
  8931. if (!this._skipValidation) {
  8932. this._validateMapping(generated, original, source, name);
  8933. }
  8934. if (source != null) {
  8935. source = String(source);
  8936. if (!this._sources.has(source)) {
  8937. this._sources.add(source);
  8938. }
  8939. }
  8940. if (name != null) {
  8941. name = String(name);
  8942. if (!this._names.has(name)) {
  8943. this._names.add(name);
  8944. }
  8945. }
  8946. this._mappings.add({
  8947. generatedLine: generated.line,
  8948. generatedColumn: generated.column,
  8949. originalLine: original != null && original.line,
  8950. originalColumn: original != null && original.column,
  8951. source: source,
  8952. name: name
  8953. });
  8954. };
  8955. /**
  8956. * Set the source content for a source file.
  8957. */
  8958. SourceMapGenerator$1.prototype.setSourceContent =
  8959. function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
  8960. var source = aSourceFile;
  8961. if (this._sourceRoot != null) {
  8962. source = util.relative(this._sourceRoot, source);
  8963. }
  8964. if (aSourceContent != null) {
  8965. // Add the source content to the _sourcesContents map.
  8966. // Create a new _sourcesContents map if the property is null.
  8967. if (!this._sourcesContents) {
  8968. this._sourcesContents = Object.create(null);
  8969. }
  8970. this._sourcesContents[util.toSetString(source)] = aSourceContent;
  8971. } else if (this._sourcesContents) {
  8972. // Remove the source file from the _sourcesContents map.
  8973. // If the _sourcesContents map is empty, set the property to null.
  8974. delete this._sourcesContents[util.toSetString(source)];
  8975. if (Object.keys(this._sourcesContents).length === 0) {
  8976. this._sourcesContents = null;
  8977. }
  8978. }
  8979. };
  8980. /**
  8981. * Applies the mappings of a sub-source-map for a specific source file to the
  8982. * source map being generated. Each mapping to the supplied source file is
  8983. * rewritten using the supplied source map. Note: The resolution for the
  8984. * resulting mappings is the minimium of this map and the supplied map.
  8985. *
  8986. * @param aSourceMapConsumer The source map to be applied.
  8987. * @param aSourceFile Optional. The filename of the source file.
  8988. * If omitted, SourceMapConsumer's file property will be used.
  8989. * @param aSourceMapPath Optional. The dirname of the path to the source map
  8990. * to be applied. If relative, it is relative to the SourceMapConsumer.
  8991. * This parameter is needed when the two source maps aren't in the same
  8992. * directory, and the source map to be applied contains relative source
  8993. * paths. If so, those relative source paths need to be rewritten
  8994. * relative to the SourceMapGenerator.
  8995. */
  8996. SourceMapGenerator$1.prototype.applySourceMap =
  8997. function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
  8998. var sourceFile = aSourceFile;
  8999. // If aSourceFile is omitted, we will use the file property of the SourceMap
  9000. if (aSourceFile == null) {
  9001. if (aSourceMapConsumer.file == null) {
  9002. throw new Error(
  9003. 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
  9004. 'or the source map\'s "file" property. Both were omitted.'
  9005. );
  9006. }
  9007. sourceFile = aSourceMapConsumer.file;
  9008. }
  9009. var sourceRoot = this._sourceRoot;
  9010. // Make "sourceFile" relative if an absolute Url is passed.
  9011. if (sourceRoot != null) {
  9012. sourceFile = util.relative(sourceRoot, sourceFile);
  9013. }
  9014. // Applying the SourceMap can add and remove items from the sources and
  9015. // the names array.
  9016. var newSources = new ArraySet();
  9017. var newNames = new ArraySet();
  9018. // Find mappings for the "sourceFile"
  9019. this._mappings.unsortedForEach(function (mapping) {
  9020. if (mapping.source === sourceFile && mapping.originalLine != null) {
  9021. // Check if it can be mapped by the source map, then update the mapping.
  9022. var original = aSourceMapConsumer.originalPositionFor({
  9023. line: mapping.originalLine,
  9024. column: mapping.originalColumn
  9025. });
  9026. if (original.source != null) {
  9027. // Copy mapping
  9028. mapping.source = original.source;
  9029. if (aSourceMapPath != null) {
  9030. mapping.source = util.join(aSourceMapPath, mapping.source);
  9031. }
  9032. if (sourceRoot != null) {
  9033. mapping.source = util.relative(sourceRoot, mapping.source);
  9034. }
  9035. mapping.originalLine = original.line;
  9036. mapping.originalColumn = original.column;
  9037. if (original.name != null) {
  9038. mapping.name = original.name;
  9039. }
  9040. }
  9041. }
  9042. var source = mapping.source;
  9043. if (source != null && !newSources.has(source)) {
  9044. newSources.add(source);
  9045. }
  9046. var name = mapping.name;
  9047. if (name != null && !newNames.has(name)) {
  9048. newNames.add(name);
  9049. }
  9050. }, this);
  9051. this._sources = newSources;
  9052. this._names = newNames;
  9053. // Copy sourcesContents of applied map.
  9054. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  9055. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  9056. if (content != null) {
  9057. if (aSourceMapPath != null) {
  9058. sourceFile = util.join(aSourceMapPath, sourceFile);
  9059. }
  9060. if (sourceRoot != null) {
  9061. sourceFile = util.relative(sourceRoot, sourceFile);
  9062. }
  9063. this.setSourceContent(sourceFile, content);
  9064. }
  9065. }, this);
  9066. };
  9067. /**
  9068. * A mapping can have one of the three levels of data:
  9069. *
  9070. * 1. Just the generated position.
  9071. * 2. The Generated position, original position, and original source.
  9072. * 3. Generated and original position, original source, as well as a name
  9073. * token.
  9074. *
  9075. * To maintain consistency, we validate that any new mapping being added falls
  9076. * in to one of these categories.
  9077. */
  9078. SourceMapGenerator$1.prototype._validateMapping =
  9079. function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
  9080. aName) {
  9081. // When aOriginal is truthy but has empty values for .line and .column,
  9082. // it is most likely a programmer error. In this case we throw a very
  9083. // specific error message to try to guide them the right way.
  9084. // For example: https://github.com/Polymer/polymer-bundler/pull/519
  9085. if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
  9086. throw new Error(
  9087. 'original.line and original.column are not numbers -- you probably meant to omit ' +
  9088. 'the original mapping entirely and only map the generated position. If so, pass ' +
  9089. 'null for the original mapping instead of an object with empty or null values.'
  9090. );
  9091. }
  9092. if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
  9093. && aGenerated.line > 0 && aGenerated.column >= 0
  9094. && !aOriginal && !aSource && !aName) {
  9095. // Case 1.
  9096. return;
  9097. }
  9098. else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
  9099. && aOriginal && 'line' in aOriginal && 'column' in aOriginal
  9100. && aGenerated.line > 0 && aGenerated.column >= 0
  9101. && aOriginal.line > 0 && aOriginal.column >= 0
  9102. && aSource) {
  9103. // Cases 2 and 3.
  9104. return;
  9105. }
  9106. else {
  9107. throw new Error('Invalid mapping: ' + JSON.stringify({
  9108. generated: aGenerated,
  9109. source: aSource,
  9110. original: aOriginal,
  9111. name: aName
  9112. }));
  9113. }
  9114. };
  9115. /**
  9116. * Serialize the accumulated mappings in to the stream of base 64 VLQs
  9117. * specified by the source map format.
  9118. */
  9119. SourceMapGenerator$1.prototype._serializeMappings =
  9120. function SourceMapGenerator_serializeMappings() {
  9121. var previousGeneratedColumn = 0;
  9122. var previousGeneratedLine = 1;
  9123. var previousOriginalColumn = 0;
  9124. var previousOriginalLine = 0;
  9125. var previousName = 0;
  9126. var previousSource = 0;
  9127. var result = '';
  9128. var next;
  9129. var mapping;
  9130. var nameIdx;
  9131. var sourceIdx;
  9132. var mappings = this._mappings.toArray();
  9133. for (var i = 0, len = mappings.length; i < len; i++) {
  9134. mapping = mappings[i];
  9135. next = '';
  9136. if (mapping.generatedLine !== previousGeneratedLine) {
  9137. previousGeneratedColumn = 0;
  9138. while (mapping.generatedLine !== previousGeneratedLine) {
  9139. next += ';';
  9140. previousGeneratedLine++;
  9141. }
  9142. }
  9143. else {
  9144. if (i > 0) {
  9145. if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
  9146. continue;
  9147. }
  9148. next += ',';
  9149. }
  9150. }
  9151. next += base64VLQ.encode(mapping.generatedColumn
  9152. - previousGeneratedColumn);
  9153. previousGeneratedColumn = mapping.generatedColumn;
  9154. if (mapping.source != null) {
  9155. sourceIdx = this._sources.indexOf(mapping.source);
  9156. next += base64VLQ.encode(sourceIdx - previousSource);
  9157. previousSource = sourceIdx;
  9158. // lines are stored 0-based in SourceMap spec version 3
  9159. next += base64VLQ.encode(mapping.originalLine - 1
  9160. - previousOriginalLine);
  9161. previousOriginalLine = mapping.originalLine - 1;
  9162. next += base64VLQ.encode(mapping.originalColumn
  9163. - previousOriginalColumn);
  9164. previousOriginalColumn = mapping.originalColumn;
  9165. if (mapping.name != null) {
  9166. nameIdx = this._names.indexOf(mapping.name);
  9167. next += base64VLQ.encode(nameIdx - previousName);
  9168. previousName = nameIdx;
  9169. }
  9170. }
  9171. result += next;
  9172. }
  9173. return result;
  9174. };
  9175. SourceMapGenerator$1.prototype._generateSourcesContent =
  9176. function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
  9177. return aSources.map(function (source) {
  9178. if (!this._sourcesContents) {
  9179. return null;
  9180. }
  9181. if (aSourceRoot != null) {
  9182. source = util.relative(aSourceRoot, source);
  9183. }
  9184. var key = util.toSetString(source);
  9185. return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
  9186. ? this._sourcesContents[key]
  9187. : null;
  9188. }, this);
  9189. };
  9190. /**
  9191. * Externalize the source map.
  9192. */
  9193. SourceMapGenerator$1.prototype.toJSON =
  9194. function SourceMapGenerator_toJSON() {
  9195. var map = {
  9196. version: this._version,
  9197. sources: this._sources.toArray(),
  9198. names: this._names.toArray(),
  9199. mappings: this._serializeMappings()
  9200. };
  9201. if (this._file != null) {
  9202. map.file = this._file;
  9203. }
  9204. if (this._sourceRoot != null) {
  9205. map.sourceRoot = this._sourceRoot;
  9206. }
  9207. if (this._sourcesContents) {
  9208. map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
  9209. }
  9210. return map;
  9211. };
  9212. /**
  9213. * Render the source map being generated to a string.
  9214. */
  9215. SourceMapGenerator$1.prototype.toString =
  9216. function SourceMapGenerator_toString() {
  9217. return JSON.stringify(this.toJSON());
  9218. };
  9219. sourceMapGenerator.SourceMapGenerator = SourceMapGenerator$1;
  9220. var SourceMapGenerator = sourceMapGenerator.SourceMapGenerator;
  9221. var trackNodes = {
  9222. Atrule: true,
  9223. Selector: true,
  9224. Declaration: true
  9225. };
  9226. var sourceMap$1 = function generateSourceMap(handlers) {
  9227. var map = new SourceMapGenerator();
  9228. var line = 1;
  9229. var column = 0;
  9230. var generated = {
  9231. line: 1,
  9232. column: 0
  9233. };
  9234. var original = {
  9235. line: 0, // should be zero to add first mapping
  9236. column: 0
  9237. };
  9238. var sourceMappingActive = false;
  9239. var activatedGenerated = {
  9240. line: 1,
  9241. column: 0
  9242. };
  9243. var activatedMapping = {
  9244. generated: activatedGenerated
  9245. };
  9246. var handlersNode = handlers.node;
  9247. handlers.node = function(node) {
  9248. if (node.loc && node.loc.start && trackNodes.hasOwnProperty(node.type)) {
  9249. var nodeLine = node.loc.start.line;
  9250. var nodeColumn = node.loc.start.column - 1;
  9251. if (original.line !== nodeLine ||
  9252. original.column !== nodeColumn) {
  9253. original.line = nodeLine;
  9254. original.column = nodeColumn;
  9255. generated.line = line;
  9256. generated.column = column;
  9257. if (sourceMappingActive) {
  9258. sourceMappingActive = false;
  9259. if (generated.line !== activatedGenerated.line ||
  9260. generated.column !== activatedGenerated.column) {
  9261. map.addMapping(activatedMapping);
  9262. }
  9263. }
  9264. sourceMappingActive = true;
  9265. map.addMapping({
  9266. source: node.loc.source,
  9267. original: original,
  9268. generated: generated
  9269. });
  9270. }
  9271. }
  9272. handlersNode.call(this, node);
  9273. if (sourceMappingActive && trackNodes.hasOwnProperty(node.type)) {
  9274. activatedGenerated.line = line;
  9275. activatedGenerated.column = column;
  9276. }
  9277. };
  9278. var handlersChunk = handlers.chunk;
  9279. handlers.chunk = function(chunk) {
  9280. for (var i = 0; i < chunk.length; i++) {
  9281. if (chunk.charCodeAt(i) === 10) { // \n
  9282. line++;
  9283. column = 0;
  9284. } else {
  9285. column++;
  9286. }
  9287. }
  9288. handlersChunk(chunk);
  9289. };
  9290. var handlersResult = handlers.result;
  9291. handlers.result = function() {
  9292. if (sourceMappingActive) {
  9293. map.addMapping(activatedMapping);
  9294. }
  9295. return {
  9296. css: handlersResult(),
  9297. map: map
  9298. };
  9299. };
  9300. return handlers;
  9301. };
  9302. var sourceMap = sourceMap$1;
  9303. var hasOwnProperty$4 = Object.prototype.hasOwnProperty;
  9304. function processChildren(node, delimeter) {
  9305. var list = node.children;
  9306. var prev = null;
  9307. if (typeof delimeter !== 'function') {
  9308. list.forEach(this.node, this);
  9309. } else {
  9310. list.forEach(function(node) {
  9311. if (prev !== null) {
  9312. delimeter.call(this, prev);
  9313. }
  9314. this.node(node);
  9315. prev = node;
  9316. }, this);
  9317. }
  9318. }
  9319. var create$2 = function createGenerator(config) {
  9320. function processNode(node) {
  9321. if (hasOwnProperty$4.call(types, node.type)) {
  9322. types[node.type].call(this, node);
  9323. } else {
  9324. throw new Error('Unknown node type: ' + node.type);
  9325. }
  9326. }
  9327. var types = {};
  9328. if (config.node) {
  9329. for (var name in config.node) {
  9330. types[name] = config.node[name].generate;
  9331. }
  9332. }
  9333. return function(node, options) {
  9334. var buffer = '';
  9335. var handlers = {
  9336. children: processChildren,
  9337. node: processNode,
  9338. chunk: function(chunk) {
  9339. buffer += chunk;
  9340. },
  9341. result: function() {
  9342. return buffer;
  9343. }
  9344. };
  9345. if (options) {
  9346. if (typeof options.decorator === 'function') {
  9347. handlers = options.decorator(handlers);
  9348. }
  9349. if (options.sourceMap) {
  9350. handlers = sourceMap(handlers);
  9351. }
  9352. }
  9353. handlers.node(node);
  9354. return handlers.result();
  9355. };
  9356. };
  9357. var List$2 = List_1;
  9358. var create$1 = function createConvertors(walk) {
  9359. return {
  9360. fromPlainObject: function(ast) {
  9361. walk(ast, {
  9362. enter: function(node) {
  9363. if (node.children && node.children instanceof List$2 === false) {
  9364. node.children = new List$2().fromArray(node.children);
  9365. }
  9366. }
  9367. });
  9368. return ast;
  9369. },
  9370. toPlainObject: function(ast) {
  9371. walk(ast, {
  9372. leave: function(node) {
  9373. if (node.children && node.children instanceof List$2) {
  9374. node.children = node.children.toArray();
  9375. }
  9376. }
  9377. });
  9378. return ast;
  9379. }
  9380. };
  9381. };
  9382. var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
  9383. var noop = function() {};
  9384. function ensureFunction(value) {
  9385. return typeof value === 'function' ? value : noop;
  9386. }
  9387. function invokeForType(fn, type) {
  9388. return function(node, item, list) {
  9389. if (node.type === type) {
  9390. fn.call(this, node, item, list);
  9391. }
  9392. };
  9393. }
  9394. function getWalkersFromStructure(name, nodeType) {
  9395. var structure = nodeType.structure;
  9396. var walkers = [];
  9397. for (var key in structure) {
  9398. if (hasOwnProperty$3.call(structure, key) === false) {
  9399. continue;
  9400. }
  9401. var fieldTypes = structure[key];
  9402. var walker = {
  9403. name: key,
  9404. type: false,
  9405. nullable: false
  9406. };
  9407. if (!Array.isArray(structure[key])) {
  9408. fieldTypes = [structure[key]];
  9409. }
  9410. for (var i = 0; i < fieldTypes.length; i++) {
  9411. var fieldType = fieldTypes[i];
  9412. if (fieldType === null) {
  9413. walker.nullable = true;
  9414. } else if (typeof fieldType === 'string') {
  9415. walker.type = 'node';
  9416. } else if (Array.isArray(fieldType)) {
  9417. walker.type = 'list';
  9418. }
  9419. }
  9420. if (walker.type) {
  9421. walkers.push(walker);
  9422. }
  9423. }
  9424. if (walkers.length) {
  9425. return {
  9426. context: nodeType.walkContext,
  9427. fields: walkers
  9428. };
  9429. }
  9430. return null;
  9431. }
  9432. function getTypesFromConfig(config) {
  9433. var types = {};
  9434. for (var name in config.node) {
  9435. if (hasOwnProperty$3.call(config.node, name)) {
  9436. var nodeType = config.node[name];
  9437. if (!nodeType.structure) {
  9438. throw new Error('Missed `structure` field in `' + name + '` node type definition');
  9439. }
  9440. types[name] = getWalkersFromStructure(name, nodeType);
  9441. }
  9442. }
  9443. return types;
  9444. }
  9445. function createTypeIterator(config, reverse) {
  9446. var fields = config.fields.slice();
  9447. var contextName = config.context;
  9448. var useContext = typeof contextName === 'string';
  9449. if (reverse) {
  9450. fields.reverse();
  9451. }
  9452. return function(node, context, walk, walkReducer) {
  9453. var prevContextValue;
  9454. if (useContext) {
  9455. prevContextValue = context[contextName];
  9456. context[contextName] = node;
  9457. }
  9458. for (var i = 0; i < fields.length; i++) {
  9459. var field = fields[i];
  9460. var ref = node[field.name];
  9461. if (!field.nullable || ref) {
  9462. if (field.type === 'list') {
  9463. var breakWalk = reverse
  9464. ? ref.reduceRight(walkReducer, false)
  9465. : ref.reduce(walkReducer, false);
  9466. if (breakWalk) {
  9467. return true;
  9468. }
  9469. } else if (walk(ref)) {
  9470. return true;
  9471. }
  9472. }
  9473. }
  9474. if (useContext) {
  9475. context[contextName] = prevContextValue;
  9476. }
  9477. };
  9478. }
  9479. function createFastTraveralMap(iterators) {
  9480. return {
  9481. Atrule: {
  9482. StyleSheet: iterators.StyleSheet,
  9483. Atrule: iterators.Atrule,
  9484. Rule: iterators.Rule,
  9485. Block: iterators.Block
  9486. },
  9487. Rule: {
  9488. StyleSheet: iterators.StyleSheet,
  9489. Atrule: iterators.Atrule,
  9490. Rule: iterators.Rule,
  9491. Block: iterators.Block
  9492. },
  9493. Declaration: {
  9494. StyleSheet: iterators.StyleSheet,
  9495. Atrule: iterators.Atrule,
  9496. Rule: iterators.Rule,
  9497. Block: iterators.Block,
  9498. DeclarationList: iterators.DeclarationList
  9499. }
  9500. };
  9501. }
  9502. var create = function createWalker(config) {
  9503. var types = getTypesFromConfig(config);
  9504. var iteratorsNatural = {};
  9505. var iteratorsReverse = {};
  9506. var breakWalk = Symbol('break-walk');
  9507. var skipNode = Symbol('skip-node');
  9508. for (var name in types) {
  9509. if (hasOwnProperty$3.call(types, name) && types[name] !== null) {
  9510. iteratorsNatural[name] = createTypeIterator(types[name], false);
  9511. iteratorsReverse[name] = createTypeIterator(types[name], true);
  9512. }
  9513. }
  9514. var fastTraversalIteratorsNatural = createFastTraveralMap(iteratorsNatural);
  9515. var fastTraversalIteratorsReverse = createFastTraveralMap(iteratorsReverse);
  9516. var walk = function(root, options) {
  9517. function walkNode(node, item, list) {
  9518. var enterRet = enter.call(context, node, item, list);
  9519. if (enterRet === breakWalk) {
  9520. debugger;
  9521. return true;
  9522. }
  9523. if (enterRet === skipNode) {
  9524. return false;
  9525. }
  9526. if (iterators.hasOwnProperty(node.type)) {
  9527. if (iterators[node.type](node, context, walkNode, walkReducer)) {
  9528. return true;
  9529. }
  9530. }
  9531. if (leave.call(context, node, item, list) === breakWalk) {
  9532. return true;
  9533. }
  9534. return false;
  9535. }
  9536. var walkReducer = (ret, data, item, list) => ret || walkNode(data, item, list);
  9537. var enter = noop;
  9538. var leave = noop;
  9539. var iterators = iteratorsNatural;
  9540. var context = {
  9541. break: breakWalk,
  9542. skip: skipNode,
  9543. root: root,
  9544. stylesheet: null,
  9545. atrule: null,
  9546. atrulePrelude: null,
  9547. rule: null,
  9548. selector: null,
  9549. block: null,
  9550. declaration: null,
  9551. function: null
  9552. };
  9553. if (typeof options === 'function') {
  9554. enter = options;
  9555. } else if (options) {
  9556. enter = ensureFunction(options.enter);
  9557. leave = ensureFunction(options.leave);
  9558. if (options.reverse) {
  9559. iterators = iteratorsReverse;
  9560. }
  9561. if (options.visit) {
  9562. if (fastTraversalIteratorsNatural.hasOwnProperty(options.visit)) {
  9563. iterators = options.reverse
  9564. ? fastTraversalIteratorsReverse[options.visit]
  9565. : fastTraversalIteratorsNatural[options.visit];
  9566. } else if (!types.hasOwnProperty(options.visit)) {
  9567. throw new Error('Bad value `' + options.visit + '` for `visit` option (should be: ' + Object.keys(types).join(', ') + ')');
  9568. }
  9569. enter = invokeForType(enter, options.visit);
  9570. leave = invokeForType(leave, options.visit);
  9571. }
  9572. }
  9573. if (enter === noop && leave === noop) {
  9574. throw new Error('Neither `enter` nor `leave` walker handler is set or both aren\'t a function');
  9575. }
  9576. walkNode(root);
  9577. };
  9578. walk.break = breakWalk;
  9579. walk.skip = skipNode;
  9580. walk.find = function(ast, fn) {
  9581. var found = null;
  9582. walk(ast, function(node, item, list) {
  9583. if (fn.call(this, node, item, list)) {
  9584. found = node;
  9585. return breakWalk;
  9586. }
  9587. });
  9588. return found;
  9589. };
  9590. walk.findLast = function(ast, fn) {
  9591. var found = null;
  9592. walk(ast, {
  9593. reverse: true,
  9594. enter: function(node, item, list) {
  9595. if (fn.call(this, node, item, list)) {
  9596. found = node;
  9597. return breakWalk;
  9598. }
  9599. }
  9600. });
  9601. return found;
  9602. };
  9603. walk.findAll = function(ast, fn) {
  9604. var found = [];
  9605. walk(ast, function(node, item, list) {
  9606. if (fn.call(this, node, item, list)) {
  9607. found.push(node);
  9608. }
  9609. });
  9610. return found;
  9611. };
  9612. return walk;
  9613. };
  9614. var List$1 = List_1;
  9615. var clone$1 = function clone(node) {
  9616. var result = {};
  9617. for (var key in node) {
  9618. var value = node[key];
  9619. if (value) {
  9620. if (Array.isArray(value) || value instanceof List$1) {
  9621. value = value.map(clone);
  9622. } else if (value.constructor === Object) {
  9623. value = clone(value);
  9624. }
  9625. }
  9626. result[key] = value;
  9627. }
  9628. return result;
  9629. };
  9630. const hasOwnProperty$2 = Object.prototype.hasOwnProperty;
  9631. const shape$1 = {
  9632. generic: true,
  9633. types: appendOrAssign,
  9634. atrules: {
  9635. prelude: appendOrAssignOrNull,
  9636. descriptors: appendOrAssignOrNull
  9637. },
  9638. properties: appendOrAssign,
  9639. parseContext: assign,
  9640. scope: deepAssign,
  9641. atrule: ['parse'],
  9642. pseudo: ['parse'],
  9643. node: ['name', 'structure', 'parse', 'generate', 'walkContext']
  9644. };
  9645. function isObject$2(value) {
  9646. return value && value.constructor === Object;
  9647. }
  9648. function copy(value) {
  9649. return isObject$2(value)
  9650. ? Object.assign({}, value)
  9651. : value;
  9652. }
  9653. function assign(dest, src) {
  9654. return Object.assign(dest, src);
  9655. }
  9656. function deepAssign(dest, src) {
  9657. for (const key in src) {
  9658. if (hasOwnProperty$2.call(src, key)) {
  9659. if (isObject$2(dest[key])) {
  9660. deepAssign(dest[key], copy(src[key]));
  9661. } else {
  9662. dest[key] = copy(src[key]);
  9663. }
  9664. }
  9665. }
  9666. return dest;
  9667. }
  9668. function append(a, b) {
  9669. if (typeof b === 'string' && /^\s*\|/.test(b)) {
  9670. return typeof a === 'string'
  9671. ? a + b
  9672. : b.replace(/^\s*\|\s*/, '');
  9673. }
  9674. return b || null;
  9675. }
  9676. function appendOrAssign(a, b) {
  9677. if (typeof b === 'string') {
  9678. return append(a, b);
  9679. }
  9680. const result = Object.assign({}, a);
  9681. for (let key in b) {
  9682. if (hasOwnProperty$2.call(b, key)) {
  9683. result[key] = append(hasOwnProperty$2.call(a, key) ? a[key] : undefined, b[key]);
  9684. }
  9685. }
  9686. return result;
  9687. }
  9688. function appendOrAssignOrNull(a, b) {
  9689. const result = appendOrAssign(a, b);
  9690. return !isObject$2(result) || Object.keys(result).length
  9691. ? result
  9692. : null;
  9693. }
  9694. function mix$1(dest, src, shape) {
  9695. for (const key in shape) {
  9696. if (hasOwnProperty$2.call(shape, key) === false) {
  9697. continue;
  9698. }
  9699. if (shape[key] === true) {
  9700. if (key in src) {
  9701. if (hasOwnProperty$2.call(src, key)) {
  9702. dest[key] = copy(src[key]);
  9703. }
  9704. }
  9705. } else if (shape[key]) {
  9706. if (typeof shape[key] === 'function') {
  9707. const fn = shape[key];
  9708. dest[key] = fn({}, dest[key]);
  9709. dest[key] = fn(dest[key] || {}, src[key]);
  9710. } else if (isObject$2(shape[key])) {
  9711. const result = {};
  9712. for (let name in dest[key]) {
  9713. result[name] = mix$1({}, dest[key][name], shape[key]);
  9714. }
  9715. for (let name in src[key]) {
  9716. result[name] = mix$1(result[name] || {}, src[key][name], shape[key]);
  9717. }
  9718. dest[key] = result;
  9719. } else if (Array.isArray(shape[key])) {
  9720. const res = {};
  9721. const innerShape = shape[key].reduce(function(s, k) {
  9722. s[k] = true;
  9723. return s;
  9724. }, {});
  9725. for (const [name, value] of Object.entries(dest[key] || {})) {
  9726. res[name] = {};
  9727. if (value) {
  9728. mix$1(res[name], value, innerShape);
  9729. }
  9730. }
  9731. for (const name in src[key]) {
  9732. if (hasOwnProperty$2.call(src[key], name)) {
  9733. if (!res[name]) {
  9734. res[name] = {};
  9735. }
  9736. if (src[key] && src[key][name]) {
  9737. mix$1(res[name], src[key][name], innerShape);
  9738. }
  9739. }
  9740. }
  9741. dest[key] = res;
  9742. }
  9743. }
  9744. }
  9745. return dest;
  9746. }
  9747. var mix_1 = (dest, src) => mix$1(dest, src, shape$1);
  9748. var List = List_1;
  9749. var SyntaxError$1 = _SyntaxError$1;
  9750. var TokenStream = TokenStream_1;
  9751. var Lexer = Lexer_1;
  9752. var definitionSyntax = definitionSyntax$1;
  9753. var tokenize = tokenizer$3;
  9754. var createParser = create$3;
  9755. var createGenerator = create$2;
  9756. var createConvertor = create$1;
  9757. var createWalker = create;
  9758. var clone = clone$1;
  9759. var names = names$2;
  9760. var mix = mix_1;
  9761. function createSyntax(config) {
  9762. var parse = createParser(config);
  9763. var walk = createWalker(config);
  9764. var generate = createGenerator(config);
  9765. var convert = createConvertor(walk);
  9766. var syntax = {
  9767. List: List,
  9768. SyntaxError: SyntaxError$1,
  9769. TokenStream: TokenStream,
  9770. Lexer: Lexer,
  9771. vendorPrefix: names.vendorPrefix,
  9772. keyword: names.keyword,
  9773. property: names.property,
  9774. isCustomProperty: names.isCustomProperty,
  9775. definitionSyntax: definitionSyntax,
  9776. lexer: null,
  9777. createLexer: function(config) {
  9778. return new Lexer(config, syntax, syntax.lexer.structure);
  9779. },
  9780. tokenize: tokenize,
  9781. parse: parse,
  9782. walk: walk,
  9783. generate: generate,
  9784. find: walk.find,
  9785. findLast: walk.findLast,
  9786. findAll: walk.findAll,
  9787. clone: clone,
  9788. fromPlainObject: convert.fromPlainObject,
  9789. toPlainObject: convert.toPlainObject,
  9790. createSyntax: function(config) {
  9791. return createSyntax(mix({}, config));
  9792. },
  9793. fork: function(extension) {
  9794. var base = mix({}, config); // copy of config
  9795. return createSyntax(
  9796. typeof extension === 'function'
  9797. ? extension(base, Object.assign)
  9798. : mix(base, extension)
  9799. );
  9800. }
  9801. };
  9802. syntax.lexer = new Lexer({
  9803. generic: true,
  9804. types: config.types,
  9805. atrules: config.atrules,
  9806. properties: config.properties,
  9807. node: config.node
  9808. }, syntax);
  9809. return syntax;
  9810. }
  9811. create$4.create = function(config) {
  9812. return createSyntax(mix({}, config));
  9813. };
  9814. var require$$0 = {
  9815. "@charset": {
  9816. syntax: "@charset \"<charset>\";",
  9817. groups: [
  9818. "CSS Charsets"
  9819. ],
  9820. status: "standard",
  9821. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@charset"
  9822. },
  9823. "@counter-style": {
  9824. 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}",
  9825. interfaces: [
  9826. "CSSCounterStyleRule"
  9827. ],
  9828. groups: [
  9829. "CSS Counter Styles"
  9830. ],
  9831. descriptors: {
  9832. "additive-symbols": {
  9833. syntax: "[ <integer> && <symbol> ]#",
  9834. media: "all",
  9835. initial: "n/a (required)",
  9836. percentages: "no",
  9837. computed: "asSpecified",
  9838. order: "orderOfAppearance",
  9839. status: "standard"
  9840. },
  9841. fallback: {
  9842. syntax: "<counter-style-name>",
  9843. media: "all",
  9844. initial: "decimal",
  9845. percentages: "no",
  9846. computed: "asSpecified",
  9847. order: "uniqueOrder",
  9848. status: "standard"
  9849. },
  9850. negative: {
  9851. syntax: "<symbol> <symbol>?",
  9852. media: "all",
  9853. initial: "\"-\" hyphen-minus",
  9854. percentages: "no",
  9855. computed: "asSpecified",
  9856. order: "orderOfAppearance",
  9857. status: "standard"
  9858. },
  9859. pad: {
  9860. syntax: "<integer> && <symbol>",
  9861. media: "all",
  9862. initial: "0 \"\"",
  9863. percentages: "no",
  9864. computed: "asSpecified",
  9865. order: "uniqueOrder",
  9866. status: "standard"
  9867. },
  9868. prefix: {
  9869. syntax: "<symbol>",
  9870. media: "all",
  9871. initial: "\"\"",
  9872. percentages: "no",
  9873. computed: "asSpecified",
  9874. order: "uniqueOrder",
  9875. status: "standard"
  9876. },
  9877. range: {
  9878. syntax: "[ [ <integer> | infinite ]{2} ]# | auto",
  9879. media: "all",
  9880. initial: "auto",
  9881. percentages: "no",
  9882. computed: "asSpecified",
  9883. order: "orderOfAppearance",
  9884. status: "standard"
  9885. },
  9886. "speak-as": {
  9887. syntax: "auto | bullets | numbers | words | spell-out | <counter-style-name>",
  9888. media: "all",
  9889. initial: "auto",
  9890. percentages: "no",
  9891. computed: "asSpecified",
  9892. order: "uniqueOrder",
  9893. status: "standard"
  9894. },
  9895. suffix: {
  9896. syntax: "<symbol>",
  9897. media: "all",
  9898. initial: "\". \"",
  9899. percentages: "no",
  9900. computed: "asSpecified",
  9901. order: "uniqueOrder",
  9902. status: "standard"
  9903. },
  9904. symbols: {
  9905. syntax: "<symbol>+",
  9906. media: "all",
  9907. initial: "n/a (required)",
  9908. percentages: "no",
  9909. computed: "asSpecified",
  9910. order: "orderOfAppearance",
  9911. status: "standard"
  9912. },
  9913. system: {
  9914. syntax: "cyclic | numeric | alphabetic | symbolic | additive | [ fixed <integer>? ] | [ extends <counter-style-name> ]",
  9915. media: "all",
  9916. initial: "symbolic",
  9917. percentages: "no",
  9918. computed: "asSpecified",
  9919. order: "uniqueOrder",
  9920. status: "standard"
  9921. }
  9922. },
  9923. status: "standard",
  9924. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@counter-style"
  9925. },
  9926. "@document": {
  9927. syntax: "@document [ <url> | url-prefix(<string>) | domain(<string>) | media-document(<string>) | regexp(<string>) ]# {\n <group-rule-body>\n}",
  9928. interfaces: [
  9929. "CSSGroupingRule",
  9930. "CSSConditionRule"
  9931. ],
  9932. groups: [
  9933. "CSS Conditional Rules"
  9934. ],
  9935. status: "nonstandard",
  9936. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@document"
  9937. },
  9938. "@font-face": {
  9939. 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}",
  9940. interfaces: [
  9941. "CSSFontFaceRule"
  9942. ],
  9943. groups: [
  9944. "CSS Fonts"
  9945. ],
  9946. descriptors: {
  9947. "font-display": {
  9948. syntax: "[ auto | block | swap | fallback | optional ]",
  9949. media: "visual",
  9950. percentages: "no",
  9951. initial: "auto",
  9952. computed: "asSpecified",
  9953. order: "uniqueOrder",
  9954. status: "experimental"
  9955. },
  9956. "font-family": {
  9957. syntax: "<family-name>",
  9958. media: "all",
  9959. initial: "n/a (required)",
  9960. percentages: "no",
  9961. computed: "asSpecified",
  9962. order: "uniqueOrder",
  9963. status: "standard"
  9964. },
  9965. "font-feature-settings": {
  9966. syntax: "normal | <feature-tag-value>#",
  9967. media: "all",
  9968. initial: "normal",
  9969. percentages: "no",
  9970. computed: "asSpecified",
  9971. order: "orderOfAppearance",
  9972. status: "standard"
  9973. },
  9974. "font-variation-settings": {
  9975. syntax: "normal | [ <string> <number> ]#",
  9976. media: "all",
  9977. initial: "normal",
  9978. percentages: "no",
  9979. computed: "asSpecified",
  9980. order: "orderOfAppearance",
  9981. status: "standard"
  9982. },
  9983. "font-stretch": {
  9984. syntax: "<font-stretch-absolute>{1,2}",
  9985. media: "all",
  9986. initial: "normal",
  9987. percentages: "no",
  9988. computed: "asSpecified",
  9989. order: "uniqueOrder",
  9990. status: "standard"
  9991. },
  9992. "font-style": {
  9993. syntax: "normal | italic | oblique <angle>{0,2}",
  9994. media: "all",
  9995. initial: "normal",
  9996. percentages: "no",
  9997. computed: "asSpecified",
  9998. order: "uniqueOrder",
  9999. status: "standard"
  10000. },
  10001. "font-weight": {
  10002. syntax: "<font-weight-absolute>{1,2}",
  10003. media: "all",
  10004. initial: "normal",
  10005. percentages: "no",
  10006. computed: "asSpecified",
  10007. order: "uniqueOrder",
  10008. status: "standard"
  10009. },
  10010. "font-variant": {
  10011. 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 ]",
  10012. media: "all",
  10013. initial: "normal",
  10014. percentages: "no",
  10015. computed: "asSpecified",
  10016. order: "orderOfAppearance",
  10017. status: "standard"
  10018. },
  10019. src: {
  10020. syntax: "[ <url> [ format( <string># ) ]? | local( <family-name> ) ]#",
  10021. media: "all",
  10022. initial: "n/a (required)",
  10023. percentages: "no",
  10024. computed: "asSpecified",
  10025. order: "orderOfAppearance",
  10026. status: "standard"
  10027. },
  10028. "unicode-range": {
  10029. syntax: "<unicode-range>#",
  10030. media: "all",
  10031. initial: "U+0-10FFFF",
  10032. percentages: "no",
  10033. computed: "asSpecified",
  10034. order: "orderOfAppearance",
  10035. status: "standard"
  10036. }
  10037. },
  10038. status: "standard",
  10039. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@font-face"
  10040. },
  10041. "@font-feature-values": {
  10042. syntax: "@font-feature-values <family-name># {\n <feature-value-block-list>\n}",
  10043. interfaces: [
  10044. "CSSFontFeatureValuesRule"
  10045. ],
  10046. groups: [
  10047. "CSS Fonts"
  10048. ],
  10049. status: "standard",
  10050. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@font-feature-values"
  10051. },
  10052. "@import": {
  10053. syntax: "@import [ <string> | <url> ] [ <media-query-list> ]?;",
  10054. groups: [
  10055. "Media Queries"
  10056. ],
  10057. status: "standard",
  10058. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@import"
  10059. },
  10060. "@keyframes": {
  10061. syntax: "@keyframes <keyframes-name> {\n <keyframe-block-list>\n}",
  10062. interfaces: [
  10063. "CSSKeyframeRule",
  10064. "CSSKeyframesRule"
  10065. ],
  10066. groups: [
  10067. "CSS Animations"
  10068. ],
  10069. status: "standard",
  10070. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@keyframes"
  10071. },
  10072. "@media": {
  10073. syntax: "@media <media-query-list> {\n <group-rule-body>\n}",
  10074. interfaces: [
  10075. "CSSGroupingRule",
  10076. "CSSConditionRule",
  10077. "CSSMediaRule",
  10078. "CSSCustomMediaRule"
  10079. ],
  10080. groups: [
  10081. "CSS Conditional Rules",
  10082. "Media Queries"
  10083. ],
  10084. status: "standard",
  10085. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@media"
  10086. },
  10087. "@namespace": {
  10088. syntax: "@namespace <namespace-prefix>? [ <string> | <url> ];",
  10089. groups: [
  10090. "CSS Namespaces"
  10091. ],
  10092. status: "standard",
  10093. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@namespace"
  10094. },
  10095. "@page": {
  10096. syntax: "@page <page-selector-list> {\n <page-body>\n}",
  10097. interfaces: [
  10098. "CSSPageRule"
  10099. ],
  10100. groups: [
  10101. "CSS Pages"
  10102. ],
  10103. descriptors: {
  10104. bleed: {
  10105. syntax: "auto | <length>",
  10106. media: [
  10107. "visual",
  10108. "paged"
  10109. ],
  10110. initial: "auto",
  10111. percentages: "no",
  10112. computed: "asSpecified",
  10113. order: "uniqueOrder",
  10114. status: "standard"
  10115. },
  10116. marks: {
  10117. syntax: "none | [ crop || cross ]",
  10118. media: [
  10119. "visual",
  10120. "paged"
  10121. ],
  10122. initial: "none",
  10123. percentages: "no",
  10124. computed: "asSpecified",
  10125. order: "orderOfAppearance",
  10126. status: "standard"
  10127. },
  10128. size: {
  10129. syntax: "<length>{1,2} | auto | [ <page-size> || [ portrait | landscape ] ]",
  10130. media: [
  10131. "visual",
  10132. "paged"
  10133. ],
  10134. initial: "auto",
  10135. percentages: "no",
  10136. computed: "asSpecifiedRelativeToAbsoluteLengths",
  10137. order: "orderOfAppearance",
  10138. status: "standard"
  10139. }
  10140. },
  10141. status: "standard",
  10142. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@page"
  10143. },
  10144. "@property": {
  10145. syntax: "@property <custom-property-name> {\n <declaration-list>\n}",
  10146. interfaces: [
  10147. "CSS",
  10148. "CSSPropertyRule"
  10149. ],
  10150. groups: [
  10151. "CSS Houdini"
  10152. ],
  10153. descriptors: {
  10154. syntax: {
  10155. syntax: "<string>",
  10156. media: "all",
  10157. percentages: "no",
  10158. initial: "n/a (required)",
  10159. computed: "asSpecified",
  10160. order: "uniqueOrder",
  10161. status: "experimental"
  10162. },
  10163. inherits: {
  10164. syntax: "true | false",
  10165. media: "all",
  10166. percentages: "no",
  10167. initial: "auto",
  10168. computed: "asSpecified",
  10169. order: "uniqueOrder",
  10170. status: "experimental"
  10171. },
  10172. "initial-value": {
  10173. syntax: "<string>",
  10174. media: "all",
  10175. initial: "n/a (required)",
  10176. percentages: "no",
  10177. computed: "asSpecified",
  10178. order: "uniqueOrder",
  10179. status: "experimental"
  10180. }
  10181. },
  10182. status: "experimental",
  10183. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@property"
  10184. },
  10185. "@supports": {
  10186. syntax: "@supports <supports-condition> {\n <group-rule-body>\n}",
  10187. interfaces: [
  10188. "CSSGroupingRule",
  10189. "CSSConditionRule",
  10190. "CSSSupportsRule"
  10191. ],
  10192. groups: [
  10193. "CSS Conditional Rules"
  10194. ],
  10195. status: "standard",
  10196. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@supports"
  10197. },
  10198. "@viewport": {
  10199. syntax: "@viewport {\n <group-rule-body>\n}",
  10200. interfaces: [
  10201. "CSSViewportRule"
  10202. ],
  10203. groups: [
  10204. "CSS Device Adaptation"
  10205. ],
  10206. descriptors: {
  10207. height: {
  10208. syntax: "<viewport-length>{1,2}",
  10209. media: [
  10210. "visual",
  10211. "continuous"
  10212. ],
  10213. initial: [
  10214. "min-height",
  10215. "max-height"
  10216. ],
  10217. percentages: [
  10218. "min-height",
  10219. "max-height"
  10220. ],
  10221. computed: [
  10222. "min-height",
  10223. "max-height"
  10224. ],
  10225. order: "orderOfAppearance",
  10226. status: "standard"
  10227. },
  10228. "max-height": {
  10229. syntax: "<viewport-length>",
  10230. media: [
  10231. "visual",
  10232. "continuous"
  10233. ],
  10234. initial: "auto",
  10235. percentages: "referToHeightOfInitialViewport",
  10236. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  10237. order: "uniqueOrder",
  10238. status: "standard"
  10239. },
  10240. "max-width": {
  10241. syntax: "<viewport-length>",
  10242. media: [
  10243. "visual",
  10244. "continuous"
  10245. ],
  10246. initial: "auto",
  10247. percentages: "referToWidthOfInitialViewport",
  10248. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  10249. order: "uniqueOrder",
  10250. status: "standard"
  10251. },
  10252. "max-zoom": {
  10253. syntax: "auto | <number> | <percentage>",
  10254. media: [
  10255. "visual",
  10256. "continuous"
  10257. ],
  10258. initial: "auto",
  10259. percentages: "the zoom factor itself",
  10260. computed: "autoNonNegativeOrPercentage",
  10261. order: "uniqueOrder",
  10262. status: "standard"
  10263. },
  10264. "min-height": {
  10265. syntax: "<viewport-length>",
  10266. media: [
  10267. "visual",
  10268. "continuous"
  10269. ],
  10270. initial: "auto",
  10271. percentages: "referToHeightOfInitialViewport",
  10272. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  10273. order: "uniqueOrder",
  10274. status: "standard"
  10275. },
  10276. "min-width": {
  10277. syntax: "<viewport-length>",
  10278. media: [
  10279. "visual",
  10280. "continuous"
  10281. ],
  10282. initial: "auto",
  10283. percentages: "referToWidthOfInitialViewport",
  10284. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  10285. order: "uniqueOrder",
  10286. status: "standard"
  10287. },
  10288. "min-zoom": {
  10289. syntax: "auto | <number> | <percentage>",
  10290. media: [
  10291. "visual",
  10292. "continuous"
  10293. ],
  10294. initial: "auto",
  10295. percentages: "the zoom factor itself",
  10296. computed: "autoNonNegativeOrPercentage",
  10297. order: "uniqueOrder",
  10298. status: "standard"
  10299. },
  10300. orientation: {
  10301. syntax: "auto | portrait | landscape",
  10302. media: [
  10303. "visual",
  10304. "continuous"
  10305. ],
  10306. initial: "auto",
  10307. percentages: "referToSizeOfBoundingBox",
  10308. computed: "asSpecified",
  10309. order: "uniqueOrder",
  10310. status: "standard"
  10311. },
  10312. "user-zoom": {
  10313. syntax: "zoom | fixed",
  10314. media: [
  10315. "visual",
  10316. "continuous"
  10317. ],
  10318. initial: "zoom",
  10319. percentages: "referToSizeOfBoundingBox",
  10320. computed: "asSpecified",
  10321. order: "uniqueOrder",
  10322. status: "standard"
  10323. },
  10324. "viewport-fit": {
  10325. syntax: "auto | contain | cover",
  10326. media: [
  10327. "visual",
  10328. "continuous"
  10329. ],
  10330. initial: "auto",
  10331. percentages: "no",
  10332. computed: "asSpecified",
  10333. order: "uniqueOrder",
  10334. status: "standard"
  10335. },
  10336. width: {
  10337. syntax: "<viewport-length>{1,2}",
  10338. media: [
  10339. "visual",
  10340. "continuous"
  10341. ],
  10342. initial: [
  10343. "min-width",
  10344. "max-width"
  10345. ],
  10346. percentages: [
  10347. "min-width",
  10348. "max-width"
  10349. ],
  10350. computed: [
  10351. "min-width",
  10352. "max-width"
  10353. ],
  10354. order: "orderOfAppearance",
  10355. status: "standard"
  10356. },
  10357. zoom: {
  10358. syntax: "auto | <number> | <percentage>",
  10359. media: [
  10360. "visual",
  10361. "continuous"
  10362. ],
  10363. initial: "auto",
  10364. percentages: "the zoom factor itself",
  10365. computed: "autoNonNegativeOrPercentage",
  10366. order: "uniqueOrder",
  10367. status: "standard"
  10368. }
  10369. },
  10370. status: "standard",
  10371. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@viewport"
  10372. }
  10373. };
  10374. var all = {
  10375. syntax: "initial | inherit | unset | revert",
  10376. media: "noPracticalMedia",
  10377. inherited: false,
  10378. animationType: "eachOfShorthandPropertiesExceptUnicodeBiDiAndDirection",
  10379. percentages: "no",
  10380. groups: [
  10381. "CSS Miscellaneous"
  10382. ],
  10383. initial: "noPracticalInitialValue",
  10384. appliesto: "allElements",
  10385. computed: "asSpecifiedAppliesToEachProperty",
  10386. order: "uniqueOrder",
  10387. status: "standard",
  10388. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/all"
  10389. };
  10390. var animation = {
  10391. syntax: "<single-animation>#",
  10392. media: "visual",
  10393. inherited: false,
  10394. animationType: "discrete",
  10395. percentages: "no",
  10396. groups: [
  10397. "CSS Animations"
  10398. ],
  10399. initial: [
  10400. "animation-name",
  10401. "animation-duration",
  10402. "animation-timing-function",
  10403. "animation-delay",
  10404. "animation-iteration-count",
  10405. "animation-direction",
  10406. "animation-fill-mode",
  10407. "animation-play-state"
  10408. ],
  10409. appliesto: "allElementsAndPseudos",
  10410. computed: [
  10411. "animation-name",
  10412. "animation-duration",
  10413. "animation-timing-function",
  10414. "animation-delay",
  10415. "animation-direction",
  10416. "animation-iteration-count",
  10417. "animation-fill-mode",
  10418. "animation-play-state"
  10419. ],
  10420. order: "orderOfAppearance",
  10421. status: "standard",
  10422. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation"
  10423. };
  10424. var appearance = {
  10425. syntax: "none | auto | textfield | menulist-button | <compat-auto>",
  10426. media: "all",
  10427. inherited: false,
  10428. animationType: "discrete",
  10429. percentages: "no",
  10430. groups: [
  10431. "CSS Basic User Interface"
  10432. ],
  10433. initial: "auto",
  10434. appliesto: "allElements",
  10435. computed: "asSpecified",
  10436. order: "perGrammar",
  10437. status: "experimental",
  10438. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/appearance"
  10439. };
  10440. var azimuth = {
  10441. syntax: "<angle> | [ [ left-side | far-left | left | center-left | center | center-right | right | far-right | right-side ] || behind ] | leftwards | rightwards",
  10442. media: "aural",
  10443. inherited: true,
  10444. animationType: "discrete",
  10445. percentages: "no",
  10446. groups: [
  10447. "CSS Speech"
  10448. ],
  10449. initial: "center",
  10450. appliesto: "allElements",
  10451. computed: "normalizedAngle",
  10452. order: "orderOfAppearance",
  10453. status: "obsolete",
  10454. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/azimuth"
  10455. };
  10456. var background = {
  10457. syntax: "[ <bg-layer> , ]* <final-bg-layer>",
  10458. media: "visual",
  10459. inherited: false,
  10460. animationType: [
  10461. "background-color",
  10462. "background-image",
  10463. "background-clip",
  10464. "background-position",
  10465. "background-size",
  10466. "background-repeat",
  10467. "background-attachment"
  10468. ],
  10469. percentages: [
  10470. "background-position",
  10471. "background-size"
  10472. ],
  10473. groups: [
  10474. "CSS Backgrounds and Borders"
  10475. ],
  10476. initial: [
  10477. "background-image",
  10478. "background-position",
  10479. "background-size",
  10480. "background-repeat",
  10481. "background-origin",
  10482. "background-clip",
  10483. "background-attachment",
  10484. "background-color"
  10485. ],
  10486. appliesto: "allElements",
  10487. computed: [
  10488. "background-image",
  10489. "background-position",
  10490. "background-size",
  10491. "background-repeat",
  10492. "background-origin",
  10493. "background-clip",
  10494. "background-attachment",
  10495. "background-color"
  10496. ],
  10497. order: "orderOfAppearance",
  10498. alsoAppliesTo: [
  10499. "::first-letter",
  10500. "::first-line",
  10501. "::placeholder"
  10502. ],
  10503. status: "standard",
  10504. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background"
  10505. };
  10506. var border = {
  10507. syntax: "<line-width> || <line-style> || <color>",
  10508. media: "visual",
  10509. inherited: false,
  10510. animationType: [
  10511. "border-color",
  10512. "border-style",
  10513. "border-width"
  10514. ],
  10515. percentages: "no",
  10516. groups: [
  10517. "CSS Backgrounds and Borders"
  10518. ],
  10519. initial: [
  10520. "border-width",
  10521. "border-style",
  10522. "border-color"
  10523. ],
  10524. appliesto: "allElements",
  10525. computed: [
  10526. "border-width",
  10527. "border-style",
  10528. "border-color"
  10529. ],
  10530. order: "orderOfAppearance",
  10531. alsoAppliesTo: [
  10532. "::first-letter"
  10533. ],
  10534. status: "standard",
  10535. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border"
  10536. };
  10537. var bottom = {
  10538. syntax: "<length> | <percentage> | auto",
  10539. media: "visual",
  10540. inherited: false,
  10541. animationType: "lpc",
  10542. percentages: "referToContainingBlockHeight",
  10543. groups: [
  10544. "CSS Positioning"
  10545. ],
  10546. initial: "auto",
  10547. appliesto: "positionedElements",
  10548. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  10549. order: "uniqueOrder",
  10550. status: "standard",
  10551. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/bottom"
  10552. };
  10553. var clear = {
  10554. syntax: "none | left | right | both | inline-start | inline-end",
  10555. media: "visual",
  10556. inherited: false,
  10557. animationType: "discrete",
  10558. percentages: "no",
  10559. groups: [
  10560. "CSS Positioning"
  10561. ],
  10562. initial: "none",
  10563. appliesto: "blockLevelElements",
  10564. computed: "asSpecified",
  10565. order: "uniqueOrder",
  10566. status: "standard",
  10567. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/clear"
  10568. };
  10569. var clip = {
  10570. syntax: "<shape> | auto",
  10571. media: "visual",
  10572. inherited: false,
  10573. animationType: "rectangle",
  10574. percentages: "no",
  10575. groups: [
  10576. "CSS Masking"
  10577. ],
  10578. initial: "auto",
  10579. appliesto: "absolutelyPositionedElements",
  10580. computed: "autoOrRectangle",
  10581. order: "uniqueOrder",
  10582. status: "standard",
  10583. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/clip"
  10584. };
  10585. var color$1 = {
  10586. syntax: "<color>",
  10587. media: "visual",
  10588. inherited: true,
  10589. animationType: "color",
  10590. percentages: "no",
  10591. groups: [
  10592. "CSS Color"
  10593. ],
  10594. initial: "variesFromBrowserToBrowser",
  10595. appliesto: "allElements",
  10596. computed: "translucentValuesRGBAOtherwiseRGB",
  10597. order: "uniqueOrder",
  10598. alsoAppliesTo: [
  10599. "::first-letter",
  10600. "::first-line",
  10601. "::placeholder"
  10602. ],
  10603. status: "standard",
  10604. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/color"
  10605. };
  10606. var columns = {
  10607. syntax: "<'column-width'> || <'column-count'>",
  10608. media: "visual",
  10609. inherited: false,
  10610. animationType: [
  10611. "column-width",
  10612. "column-count"
  10613. ],
  10614. percentages: "no",
  10615. groups: [
  10616. "CSS Columns"
  10617. ],
  10618. initial: [
  10619. "column-width",
  10620. "column-count"
  10621. ],
  10622. appliesto: "blockContainersExceptTableWrappers",
  10623. computed: [
  10624. "column-width",
  10625. "column-count"
  10626. ],
  10627. order: "perGrammar",
  10628. status: "standard",
  10629. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/columns"
  10630. };
  10631. var contain = {
  10632. syntax: "none | strict | content | [ size || layout || style || paint ]",
  10633. media: "all",
  10634. inherited: false,
  10635. animationType: "discrete",
  10636. percentages: "no",
  10637. groups: [
  10638. "CSS Containment"
  10639. ],
  10640. initial: "none",
  10641. appliesto: "allElements",
  10642. computed: "asSpecified",
  10643. order: "perGrammar",
  10644. status: "standard",
  10645. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/contain"
  10646. };
  10647. var content = {
  10648. syntax: "normal | none | [ <content-replacement> | <content-list> ] [/ <string> ]?",
  10649. media: "all",
  10650. inherited: false,
  10651. animationType: "discrete",
  10652. percentages: "no",
  10653. groups: [
  10654. "CSS Generated Content"
  10655. ],
  10656. initial: "normal",
  10657. appliesto: "beforeAndAfterPseudos",
  10658. computed: "normalOnElementsForPseudosNoneAbsoluteURIStringOrAsSpecified",
  10659. order: "uniqueOrder",
  10660. status: "standard",
  10661. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/content"
  10662. };
  10663. var cursor = {
  10664. 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 ] ]",
  10665. media: [
  10666. "visual",
  10667. "interactive"
  10668. ],
  10669. inherited: true,
  10670. animationType: "discrete",
  10671. percentages: "no",
  10672. groups: [
  10673. "CSS Basic User Interface"
  10674. ],
  10675. initial: "auto",
  10676. appliesto: "allElements",
  10677. computed: "asSpecifiedURLsAbsolute",
  10678. order: "uniqueOrder",
  10679. status: "standard",
  10680. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/cursor"
  10681. };
  10682. var direction = {
  10683. syntax: "ltr | rtl",
  10684. media: "visual",
  10685. inherited: true,
  10686. animationType: "discrete",
  10687. percentages: "no",
  10688. groups: [
  10689. "CSS Writing Modes"
  10690. ],
  10691. initial: "ltr",
  10692. appliesto: "allElements",
  10693. computed: "asSpecified",
  10694. order: "uniqueOrder",
  10695. status: "standard",
  10696. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/direction"
  10697. };
  10698. var display = {
  10699. syntax: "[ <display-outside> || <display-inside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy>",
  10700. media: "all",
  10701. inherited: false,
  10702. animationType: "discrete",
  10703. percentages: "no",
  10704. groups: [
  10705. "CSS Display"
  10706. ],
  10707. initial: "inline",
  10708. appliesto: "allElements",
  10709. computed: "asSpecifiedExceptPositionedFloatingAndRootElementsKeywordMaybeDifferent",
  10710. order: "uniqueOrder",
  10711. status: "standard",
  10712. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/display"
  10713. };
  10714. var filter = {
  10715. syntax: "none | <filter-function-list>",
  10716. media: "visual",
  10717. inherited: false,
  10718. animationType: "filterList",
  10719. percentages: "no",
  10720. groups: [
  10721. "Filter Effects"
  10722. ],
  10723. initial: "none",
  10724. appliesto: "allElementsSVGContainerElements",
  10725. computed: "asSpecified",
  10726. order: "uniqueOrder",
  10727. status: "standard",
  10728. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/filter"
  10729. };
  10730. var flex = {
  10731. syntax: "none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]",
  10732. media: "visual",
  10733. inherited: false,
  10734. animationType: [
  10735. "flex-grow",
  10736. "flex-shrink",
  10737. "flex-basis"
  10738. ],
  10739. percentages: "no",
  10740. groups: [
  10741. "CSS Flexible Box Layout"
  10742. ],
  10743. initial: [
  10744. "flex-grow",
  10745. "flex-shrink",
  10746. "flex-basis"
  10747. ],
  10748. appliesto: "flexItemsAndInFlowPseudos",
  10749. computed: [
  10750. "flex-grow",
  10751. "flex-shrink",
  10752. "flex-basis"
  10753. ],
  10754. order: "orderOfAppearance",
  10755. status: "standard",
  10756. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex"
  10757. };
  10758. var float = {
  10759. syntax: "left | right | none | inline-start | inline-end",
  10760. media: "visual",
  10761. inherited: false,
  10762. animationType: "discrete",
  10763. percentages: "no",
  10764. groups: [
  10765. "CSS Positioning"
  10766. ],
  10767. initial: "none",
  10768. appliesto: "allElementsNoEffectIfDisplayNone",
  10769. computed: "asSpecified",
  10770. order: "uniqueOrder",
  10771. status: "standard",
  10772. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/float"
  10773. };
  10774. var font = {
  10775. 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",
  10776. media: "visual",
  10777. inherited: true,
  10778. animationType: [
  10779. "font-style",
  10780. "font-variant",
  10781. "font-weight",
  10782. "font-stretch",
  10783. "font-size",
  10784. "line-height",
  10785. "font-family"
  10786. ],
  10787. percentages: [
  10788. "font-size",
  10789. "line-height"
  10790. ],
  10791. groups: [
  10792. "CSS Fonts"
  10793. ],
  10794. initial: [
  10795. "font-style",
  10796. "font-variant",
  10797. "font-weight",
  10798. "font-stretch",
  10799. "font-size",
  10800. "line-height",
  10801. "font-family"
  10802. ],
  10803. appliesto: "allElements",
  10804. computed: [
  10805. "font-style",
  10806. "font-variant",
  10807. "font-weight",
  10808. "font-stretch",
  10809. "font-size",
  10810. "line-height",
  10811. "font-family"
  10812. ],
  10813. order: "orderOfAppearance",
  10814. alsoAppliesTo: [
  10815. "::first-letter",
  10816. "::first-line",
  10817. "::placeholder"
  10818. ],
  10819. status: "standard",
  10820. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font"
  10821. };
  10822. var gap = {
  10823. syntax: "<'row-gap'> <'column-gap'>?",
  10824. media: "visual",
  10825. inherited: false,
  10826. animationType: [
  10827. "row-gap",
  10828. "column-gap"
  10829. ],
  10830. percentages: "no",
  10831. groups: [
  10832. "CSS Box Alignment"
  10833. ],
  10834. initial: [
  10835. "row-gap",
  10836. "column-gap"
  10837. ],
  10838. appliesto: "multiColumnElementsFlexContainersGridContainers",
  10839. computed: [
  10840. "row-gap",
  10841. "column-gap"
  10842. ],
  10843. order: "uniqueOrder",
  10844. status: "standard",
  10845. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/gap"
  10846. };
  10847. var grid = {
  10848. syntax: "<'grid-template'> | <'grid-template-rows'> / [ auto-flow && dense? ] <'grid-auto-columns'>? | [ auto-flow && dense? ] <'grid-auto-rows'>? / <'grid-template-columns'>",
  10849. media: "visual",
  10850. inherited: false,
  10851. animationType: "discrete",
  10852. percentages: [
  10853. "grid-template-rows",
  10854. "grid-template-columns",
  10855. "grid-auto-rows",
  10856. "grid-auto-columns"
  10857. ],
  10858. groups: [
  10859. "CSS Grid Layout"
  10860. ],
  10861. initial: [
  10862. "grid-template-rows",
  10863. "grid-template-columns",
  10864. "grid-template-areas",
  10865. "grid-auto-rows",
  10866. "grid-auto-columns",
  10867. "grid-auto-flow",
  10868. "grid-column-gap",
  10869. "grid-row-gap",
  10870. "column-gap",
  10871. "row-gap"
  10872. ],
  10873. appliesto: "gridContainers",
  10874. computed: [
  10875. "grid-template-rows",
  10876. "grid-template-columns",
  10877. "grid-template-areas",
  10878. "grid-auto-rows",
  10879. "grid-auto-columns",
  10880. "grid-auto-flow",
  10881. "grid-column-gap",
  10882. "grid-row-gap",
  10883. "column-gap",
  10884. "row-gap"
  10885. ],
  10886. order: "uniqueOrder",
  10887. status: "standard",
  10888. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid"
  10889. };
  10890. var height = {
  10891. syntax: "auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)",
  10892. media: "visual",
  10893. inherited: false,
  10894. animationType: "lpc",
  10895. percentages: "regardingHeightOfGeneratedBoxContainingBlockPercentagesRelativeToContainingBlock",
  10896. groups: [
  10897. "CSS Box Model"
  10898. ],
  10899. initial: "auto",
  10900. appliesto: "allElementsButNonReplacedAndTableColumns",
  10901. computed: "percentageAutoOrAbsoluteLength",
  10902. order: "uniqueOrder",
  10903. status: "standard",
  10904. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/height"
  10905. };
  10906. var hyphens = {
  10907. syntax: "none | manual | auto",
  10908. media: "visual",
  10909. inherited: true,
  10910. animationType: "discrete",
  10911. percentages: "no",
  10912. groups: [
  10913. "CSS Text"
  10914. ],
  10915. initial: "manual",
  10916. appliesto: "allElements",
  10917. computed: "asSpecified",
  10918. order: "uniqueOrder",
  10919. status: "standard",
  10920. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/hyphens"
  10921. };
  10922. var inset = {
  10923. syntax: "<'top'>{1,4}",
  10924. media: "visual",
  10925. inherited: false,
  10926. animationType: "lpc",
  10927. percentages: "logicalHeightOfContainingBlock",
  10928. groups: [
  10929. "CSS Logical Properties"
  10930. ],
  10931. initial: "auto",
  10932. appliesto: "positionedElements",
  10933. computed: "sameAsBoxOffsets",
  10934. order: "uniqueOrder",
  10935. status: "standard",
  10936. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset"
  10937. };
  10938. var isolation = {
  10939. syntax: "auto | isolate",
  10940. media: "visual",
  10941. inherited: false,
  10942. animationType: "discrete",
  10943. percentages: "no",
  10944. groups: [
  10945. "Compositing and Blending"
  10946. ],
  10947. initial: "auto",
  10948. appliesto: "allElementsSVGContainerGraphicsAndGraphicsReferencingElements",
  10949. computed: "asSpecified",
  10950. order: "uniqueOrder",
  10951. status: "standard",
  10952. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/isolation"
  10953. };
  10954. var left = {
  10955. syntax: "<length> | <percentage> | auto",
  10956. media: "visual",
  10957. inherited: false,
  10958. animationType: "lpc",
  10959. percentages: "referToWidthOfContainingBlock",
  10960. groups: [
  10961. "CSS Positioning"
  10962. ],
  10963. initial: "auto",
  10964. appliesto: "positionedElements",
  10965. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  10966. order: "uniqueOrder",
  10967. status: "standard",
  10968. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/left"
  10969. };
  10970. var margin = {
  10971. syntax: "[ <length> | <percentage> | auto ]{1,4}",
  10972. media: "visual",
  10973. inherited: false,
  10974. animationType: "length",
  10975. percentages: "referToWidthOfContainingBlock",
  10976. groups: [
  10977. "CSS Box Model"
  10978. ],
  10979. initial: [
  10980. "margin-bottom",
  10981. "margin-left",
  10982. "margin-right",
  10983. "margin-top"
  10984. ],
  10985. appliesto: "allElementsExceptTableDisplayTypes",
  10986. computed: [
  10987. "margin-bottom",
  10988. "margin-left",
  10989. "margin-right",
  10990. "margin-top"
  10991. ],
  10992. order: "uniqueOrder",
  10993. alsoAppliesTo: [
  10994. "::first-letter",
  10995. "::first-line"
  10996. ],
  10997. status: "standard",
  10998. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin"
  10999. };
  11000. var mask = {
  11001. syntax: "<mask-layer>#",
  11002. media: "visual",
  11003. inherited: false,
  11004. animationType: [
  11005. "mask-image",
  11006. "mask-mode",
  11007. "mask-repeat",
  11008. "mask-position",
  11009. "mask-clip",
  11010. "mask-origin",
  11011. "mask-size",
  11012. "mask-composite"
  11013. ],
  11014. percentages: [
  11015. "mask-position"
  11016. ],
  11017. groups: [
  11018. "CSS Masking"
  11019. ],
  11020. initial: [
  11021. "mask-image",
  11022. "mask-mode",
  11023. "mask-repeat",
  11024. "mask-position",
  11025. "mask-clip",
  11026. "mask-origin",
  11027. "mask-size",
  11028. "mask-composite"
  11029. ],
  11030. appliesto: "allElementsSVGContainerElements",
  11031. computed: [
  11032. "mask-image",
  11033. "mask-mode",
  11034. "mask-repeat",
  11035. "mask-position",
  11036. "mask-clip",
  11037. "mask-origin",
  11038. "mask-size",
  11039. "mask-composite"
  11040. ],
  11041. order: "perGrammar",
  11042. stacking: true,
  11043. status: "standard",
  11044. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask"
  11045. };
  11046. var offset = {
  11047. syntax: "[ <'offset-position'>? [ <'offset-path'> [ <'offset-distance'> || <'offset-rotate'> ]? ]? ]! [ / <'offset-anchor'> ]?",
  11048. media: "visual",
  11049. inherited: false,
  11050. animationType: [
  11051. "offset-position",
  11052. "offset-path",
  11053. "offset-distance",
  11054. "offset-anchor",
  11055. "offset-rotate"
  11056. ],
  11057. percentages: [
  11058. "offset-position",
  11059. "offset-distance",
  11060. "offset-anchor"
  11061. ],
  11062. groups: [
  11063. "CSS Motion Path"
  11064. ],
  11065. initial: [
  11066. "offset-position",
  11067. "offset-path",
  11068. "offset-distance",
  11069. "offset-anchor",
  11070. "offset-rotate"
  11071. ],
  11072. appliesto: "transformableElements",
  11073. computed: [
  11074. "offset-position",
  11075. "offset-path",
  11076. "offset-distance",
  11077. "offset-anchor",
  11078. "offset-rotate"
  11079. ],
  11080. order: "perGrammar",
  11081. stacking: true,
  11082. status: "standard",
  11083. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset"
  11084. };
  11085. var opacity = {
  11086. syntax: "<alpha-value>",
  11087. media: "visual",
  11088. inherited: false,
  11089. animationType: "number",
  11090. percentages: "no",
  11091. groups: [
  11092. "CSS Color"
  11093. ],
  11094. initial: "1.0",
  11095. appliesto: "allElements",
  11096. computed: "specifiedValueClipped0To1",
  11097. order: "uniqueOrder",
  11098. alsoAppliesTo: [
  11099. "::placeholder"
  11100. ],
  11101. status: "standard",
  11102. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/opacity"
  11103. };
  11104. var order = {
  11105. syntax: "<integer>",
  11106. media: "visual",
  11107. inherited: false,
  11108. animationType: "integer",
  11109. percentages: "no",
  11110. groups: [
  11111. "CSS Flexible Box Layout"
  11112. ],
  11113. initial: "0",
  11114. appliesto: "flexItemsGridItemsAbsolutelyPositionedContainerChildren",
  11115. computed: "asSpecified",
  11116. order: "uniqueOrder",
  11117. status: "standard",
  11118. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/order"
  11119. };
  11120. var orphans = {
  11121. syntax: "<integer>",
  11122. media: "visual",
  11123. inherited: true,
  11124. animationType: "discrete",
  11125. percentages: "no",
  11126. groups: [
  11127. "CSS Fragmentation"
  11128. ],
  11129. initial: "2",
  11130. appliesto: "blockContainerElements",
  11131. computed: "asSpecified",
  11132. order: "perGrammar",
  11133. status: "standard",
  11134. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/orphans"
  11135. };
  11136. var outline = {
  11137. syntax: "[ <'outline-color'> || <'outline-style'> || <'outline-width'> ]",
  11138. media: [
  11139. "visual",
  11140. "interactive"
  11141. ],
  11142. inherited: false,
  11143. animationType: [
  11144. "outline-color",
  11145. "outline-width",
  11146. "outline-style"
  11147. ],
  11148. percentages: "no",
  11149. groups: [
  11150. "CSS Basic User Interface"
  11151. ],
  11152. initial: [
  11153. "outline-color",
  11154. "outline-style",
  11155. "outline-width"
  11156. ],
  11157. appliesto: "allElements",
  11158. computed: [
  11159. "outline-color",
  11160. "outline-width",
  11161. "outline-style"
  11162. ],
  11163. order: "orderOfAppearance",
  11164. status: "standard",
  11165. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline"
  11166. };
  11167. var overflow = {
  11168. syntax: "[ visible | hidden | clip | scroll | auto ]{1,2}",
  11169. media: "visual",
  11170. inherited: false,
  11171. animationType: "discrete",
  11172. percentages: "no",
  11173. groups: [
  11174. "CSS Overflow"
  11175. ],
  11176. initial: "visible",
  11177. appliesto: "blockContainersFlexContainersGridContainers",
  11178. computed: [
  11179. "overflow-x",
  11180. "overflow-y"
  11181. ],
  11182. order: "uniqueOrder",
  11183. status: "standard",
  11184. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow"
  11185. };
  11186. var padding = {
  11187. syntax: "[ <length> | <percentage> ]{1,4}",
  11188. media: "visual",
  11189. inherited: false,
  11190. animationType: "length",
  11191. percentages: "referToWidthOfContainingBlock",
  11192. groups: [
  11193. "CSS Box Model"
  11194. ],
  11195. initial: [
  11196. "padding-bottom",
  11197. "padding-left",
  11198. "padding-right",
  11199. "padding-top"
  11200. ],
  11201. appliesto: "allElementsExceptInternalTableDisplayTypes",
  11202. computed: [
  11203. "padding-bottom",
  11204. "padding-left",
  11205. "padding-right",
  11206. "padding-top"
  11207. ],
  11208. order: "uniqueOrder",
  11209. alsoAppliesTo: [
  11210. "::first-letter",
  11211. "::first-line"
  11212. ],
  11213. status: "standard",
  11214. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding"
  11215. };
  11216. var perspective = {
  11217. syntax: "none | <length>",
  11218. media: "visual",
  11219. inherited: false,
  11220. animationType: "length",
  11221. percentages: "no",
  11222. groups: [
  11223. "CSS Transforms"
  11224. ],
  11225. initial: "none",
  11226. appliesto: "transformableElements",
  11227. computed: "absoluteLengthOrNone",
  11228. order: "uniqueOrder",
  11229. stacking: true,
  11230. status: "standard",
  11231. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/perspective"
  11232. };
  11233. var position$1 = {
  11234. syntax: "static | relative | absolute | sticky | fixed",
  11235. media: "visual",
  11236. inherited: false,
  11237. animationType: "discrete",
  11238. percentages: "no",
  11239. groups: [
  11240. "CSS Positioning"
  11241. ],
  11242. initial: "static",
  11243. appliesto: "allElements",
  11244. computed: "asSpecified",
  11245. order: "uniqueOrder",
  11246. stacking: true,
  11247. status: "standard",
  11248. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/position"
  11249. };
  11250. var quotes = {
  11251. syntax: "none | auto | [ <string> <string> ]+",
  11252. media: "visual",
  11253. inherited: true,
  11254. animationType: "discrete",
  11255. percentages: "no",
  11256. groups: [
  11257. "CSS Generated Content"
  11258. ],
  11259. initial: "dependsOnUserAgent",
  11260. appliesto: "allElements",
  11261. computed: "asSpecified",
  11262. order: "uniqueOrder",
  11263. status: "standard",
  11264. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/quotes"
  11265. };
  11266. var resize = {
  11267. syntax: "none | both | horizontal | vertical | block | inline",
  11268. media: "visual",
  11269. inherited: false,
  11270. animationType: "discrete",
  11271. percentages: "no",
  11272. groups: [
  11273. "CSS Basic User Interface"
  11274. ],
  11275. initial: "none",
  11276. appliesto: "elementsWithOverflowNotVisibleAndReplacedElements",
  11277. computed: "asSpecified",
  11278. order: "uniqueOrder",
  11279. status: "standard",
  11280. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/resize"
  11281. };
  11282. var right = {
  11283. syntax: "<length> | <percentage> | auto",
  11284. media: "visual",
  11285. inherited: false,
  11286. animationType: "lpc",
  11287. percentages: "referToWidthOfContainingBlock",
  11288. groups: [
  11289. "CSS Positioning"
  11290. ],
  11291. initial: "auto",
  11292. appliesto: "positionedElements",
  11293. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  11294. order: "uniqueOrder",
  11295. status: "standard",
  11296. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/right"
  11297. };
  11298. var rotate = {
  11299. syntax: "none | <angle> | [ x | y | z | <number>{3} ] && <angle>",
  11300. media: "visual",
  11301. inherited: false,
  11302. animationType: "transform",
  11303. percentages: "no",
  11304. groups: [
  11305. "CSS Transforms"
  11306. ],
  11307. initial: "none",
  11308. appliesto: "transformableElements",
  11309. computed: "asSpecified",
  11310. order: "perGrammar",
  11311. stacking: true,
  11312. status: "standard",
  11313. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/rotate"
  11314. };
  11315. var scale = {
  11316. syntax: "none | <number>{1,3}",
  11317. media: "visual",
  11318. inherited: false,
  11319. animationType: "transform",
  11320. percentages: "no",
  11321. groups: [
  11322. "CSS Transforms"
  11323. ],
  11324. initial: "none",
  11325. appliesto: "transformableElements",
  11326. computed: "asSpecified",
  11327. order: "perGrammar",
  11328. stacking: true,
  11329. status: "standard",
  11330. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scale"
  11331. };
  11332. var top = {
  11333. syntax: "<length> | <percentage> | auto",
  11334. media: "visual",
  11335. inherited: false,
  11336. animationType: "lpc",
  11337. percentages: "referToContainingBlockHeight",
  11338. groups: [
  11339. "CSS Positioning"
  11340. ],
  11341. initial: "auto",
  11342. appliesto: "positionedElements",
  11343. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  11344. order: "uniqueOrder",
  11345. status: "standard",
  11346. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/top"
  11347. };
  11348. var transform = {
  11349. syntax: "none | <transform-list>",
  11350. media: "visual",
  11351. inherited: false,
  11352. animationType: "transform",
  11353. percentages: "referToSizeOfBoundingBox",
  11354. groups: [
  11355. "CSS Transforms"
  11356. ],
  11357. initial: "none",
  11358. appliesto: "transformableElements",
  11359. computed: "asSpecifiedRelativeToAbsoluteLengths",
  11360. order: "uniqueOrder",
  11361. stacking: true,
  11362. status: "standard",
  11363. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform"
  11364. };
  11365. var transition = {
  11366. syntax: "<single-transition>#",
  11367. media: "interactive",
  11368. inherited: false,
  11369. animationType: "discrete",
  11370. percentages: "no",
  11371. groups: [
  11372. "CSS Transitions"
  11373. ],
  11374. initial: [
  11375. "transition-delay",
  11376. "transition-duration",
  11377. "transition-property",
  11378. "transition-timing-function"
  11379. ],
  11380. appliesto: "allElementsAndPseudos",
  11381. computed: [
  11382. "transition-delay",
  11383. "transition-duration",
  11384. "transition-property",
  11385. "transition-timing-function"
  11386. ],
  11387. order: "orderOfAppearance",
  11388. status: "standard",
  11389. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition"
  11390. };
  11391. var translate = {
  11392. syntax: "none | <length-percentage> [ <length-percentage> <length>? ]?",
  11393. media: "visual",
  11394. inherited: false,
  11395. animationType: "transform",
  11396. percentages: "referToSizeOfBoundingBox",
  11397. groups: [
  11398. "CSS Transforms"
  11399. ],
  11400. initial: "none",
  11401. appliesto: "transformableElements",
  11402. computed: "asSpecifiedRelativeToAbsoluteLengths",
  11403. order: "perGrammar",
  11404. stacking: true,
  11405. status: "standard",
  11406. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/translate"
  11407. };
  11408. var visibility = {
  11409. syntax: "visible | hidden | collapse",
  11410. media: "visual",
  11411. inherited: true,
  11412. animationType: "visibility",
  11413. percentages: "no",
  11414. groups: [
  11415. "CSS Box Model"
  11416. ],
  11417. initial: "visible",
  11418. appliesto: "allElements",
  11419. computed: "asSpecified",
  11420. order: "uniqueOrder",
  11421. status: "standard",
  11422. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/visibility"
  11423. };
  11424. var widows = {
  11425. syntax: "<integer>",
  11426. media: "visual",
  11427. inherited: true,
  11428. animationType: "discrete",
  11429. percentages: "no",
  11430. groups: [
  11431. "CSS Fragmentation"
  11432. ],
  11433. initial: "2",
  11434. appliesto: "blockContainerElements",
  11435. computed: "asSpecified",
  11436. order: "perGrammar",
  11437. status: "standard",
  11438. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/widows"
  11439. };
  11440. var width = {
  11441. syntax: "auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)",
  11442. media: "visual",
  11443. inherited: false,
  11444. animationType: "lpc",
  11445. percentages: "referToWidthOfContainingBlock",
  11446. groups: [
  11447. "CSS Box Model"
  11448. ],
  11449. initial: "auto",
  11450. appliesto: "allElementsButNonReplacedAndTableRows",
  11451. computed: "percentageAutoOrAbsoluteLength",
  11452. order: "lengthOrPercentageBeforeKeywordIfBothPresent",
  11453. status: "standard",
  11454. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/width"
  11455. };
  11456. var zoom = {
  11457. syntax: "normal | reset | <number> | <percentage>",
  11458. media: "visual",
  11459. inherited: false,
  11460. animationType: "integer",
  11461. percentages: "no",
  11462. groups: [
  11463. "Microsoft Extensions"
  11464. ],
  11465. initial: "normal",
  11466. appliesto: "allElements",
  11467. computed: "asSpecified",
  11468. order: "uniqueOrder",
  11469. status: "nonstandard",
  11470. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/zoom"
  11471. };
  11472. var require$$1 = {
  11473. "--*": {
  11474. syntax: "<declaration-value>",
  11475. media: "all",
  11476. inherited: true,
  11477. animationType: "discrete",
  11478. percentages: "no",
  11479. groups: [
  11480. "CSS Variables"
  11481. ],
  11482. initial: "seeProse",
  11483. appliesto: "allElements",
  11484. computed: "asSpecifiedWithVarsSubstituted",
  11485. order: "perGrammar",
  11486. status: "experimental",
  11487. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/--*"
  11488. },
  11489. "-ms-accelerator": {
  11490. syntax: "false | true",
  11491. media: "visual",
  11492. inherited: false,
  11493. animationType: "discrete",
  11494. percentages: "no",
  11495. groups: [
  11496. "Microsoft Extensions"
  11497. ],
  11498. initial: "false",
  11499. appliesto: "allElements",
  11500. computed: "asSpecified",
  11501. order: "uniqueOrder",
  11502. status: "nonstandard",
  11503. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-accelerator"
  11504. },
  11505. "-ms-block-progression": {
  11506. syntax: "tb | rl | bt | lr",
  11507. media: "visual",
  11508. inherited: false,
  11509. animationType: "discrete",
  11510. percentages: "no",
  11511. groups: [
  11512. "Microsoft Extensions"
  11513. ],
  11514. initial: "tb",
  11515. appliesto: "allElements",
  11516. computed: "asSpecified",
  11517. order: "uniqueOrder",
  11518. status: "nonstandard",
  11519. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-block-progression"
  11520. },
  11521. "-ms-content-zoom-chaining": {
  11522. syntax: "none | chained",
  11523. media: "interactive",
  11524. inherited: false,
  11525. animationType: "discrete",
  11526. percentages: "no",
  11527. groups: [
  11528. "Microsoft Extensions"
  11529. ],
  11530. initial: "none",
  11531. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11532. computed: "asSpecified",
  11533. order: "uniqueOrder",
  11534. status: "nonstandard",
  11535. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-chaining"
  11536. },
  11537. "-ms-content-zooming": {
  11538. syntax: "none | zoom",
  11539. media: "interactive",
  11540. inherited: false,
  11541. animationType: "discrete",
  11542. percentages: "no",
  11543. groups: [
  11544. "Microsoft Extensions"
  11545. ],
  11546. initial: "zoomForTheTopLevelNoneForTheRest",
  11547. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11548. computed: "asSpecified",
  11549. order: "uniqueOrder",
  11550. status: "nonstandard",
  11551. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zooming"
  11552. },
  11553. "-ms-content-zoom-limit": {
  11554. syntax: "<'-ms-content-zoom-limit-min'> <'-ms-content-zoom-limit-max'>",
  11555. media: "interactive",
  11556. inherited: false,
  11557. animationType: "discrete",
  11558. percentages: [
  11559. "-ms-content-zoom-limit-max",
  11560. "-ms-content-zoom-limit-min"
  11561. ],
  11562. groups: [
  11563. "Microsoft Extensions"
  11564. ],
  11565. initial: [
  11566. "-ms-content-zoom-limit-max",
  11567. "-ms-content-zoom-limit-min"
  11568. ],
  11569. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11570. computed: [
  11571. "-ms-content-zoom-limit-max",
  11572. "-ms-content-zoom-limit-min"
  11573. ],
  11574. order: "uniqueOrder",
  11575. status: "nonstandard",
  11576. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-limit"
  11577. },
  11578. "-ms-content-zoom-limit-max": {
  11579. syntax: "<percentage>",
  11580. media: "interactive",
  11581. inherited: false,
  11582. animationType: "discrete",
  11583. percentages: "maxZoomFactor",
  11584. groups: [
  11585. "Microsoft Extensions"
  11586. ],
  11587. initial: "400%",
  11588. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11589. computed: "asSpecified",
  11590. order: "uniqueOrder",
  11591. status: "nonstandard",
  11592. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-limit-max"
  11593. },
  11594. "-ms-content-zoom-limit-min": {
  11595. syntax: "<percentage>",
  11596. media: "interactive",
  11597. inherited: false,
  11598. animationType: "discrete",
  11599. percentages: "minZoomFactor",
  11600. groups: [
  11601. "Microsoft Extensions"
  11602. ],
  11603. initial: "100%",
  11604. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11605. computed: "asSpecified",
  11606. order: "uniqueOrder",
  11607. status: "nonstandard",
  11608. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-limit-min"
  11609. },
  11610. "-ms-content-zoom-snap": {
  11611. syntax: "<'-ms-content-zoom-snap-type'> || <'-ms-content-zoom-snap-points'>",
  11612. media: "interactive",
  11613. inherited: false,
  11614. animationType: "discrete",
  11615. percentages: "no",
  11616. groups: [
  11617. "Microsoft Extensions"
  11618. ],
  11619. initial: [
  11620. "-ms-content-zoom-snap-type",
  11621. "-ms-content-zoom-snap-points"
  11622. ],
  11623. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11624. computed: [
  11625. "-ms-content-zoom-snap-type",
  11626. "-ms-content-zoom-snap-points"
  11627. ],
  11628. order: "uniqueOrder",
  11629. status: "nonstandard",
  11630. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-snap"
  11631. },
  11632. "-ms-content-zoom-snap-points": {
  11633. syntax: "snapInterval( <percentage>, <percentage> ) | snapList( <percentage># )",
  11634. media: "interactive",
  11635. inherited: false,
  11636. animationType: "discrete",
  11637. percentages: "no",
  11638. groups: [
  11639. "Microsoft Extensions"
  11640. ],
  11641. initial: "snapInterval(0%, 100%)",
  11642. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11643. computed: "asSpecified",
  11644. order: "uniqueOrder",
  11645. status: "nonstandard",
  11646. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-snap-points"
  11647. },
  11648. "-ms-content-zoom-snap-type": {
  11649. syntax: "none | proximity | mandatory",
  11650. media: "interactive",
  11651. inherited: false,
  11652. animationType: "discrete",
  11653. percentages: "no",
  11654. groups: [
  11655. "Microsoft Extensions"
  11656. ],
  11657. initial: "none",
  11658. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11659. computed: "asSpecified",
  11660. order: "uniqueOrder",
  11661. status: "nonstandard",
  11662. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-snap-type"
  11663. },
  11664. "-ms-filter": {
  11665. syntax: "<string>",
  11666. media: "visual",
  11667. inherited: false,
  11668. animationType: "discrete",
  11669. percentages: "no",
  11670. groups: [
  11671. "Microsoft Extensions"
  11672. ],
  11673. initial: "\"\"",
  11674. appliesto: "allElements",
  11675. computed: "asSpecified",
  11676. order: "uniqueOrder",
  11677. status: "nonstandard",
  11678. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-filter"
  11679. },
  11680. "-ms-flow-from": {
  11681. syntax: "[ none | <custom-ident> ]#",
  11682. media: "visual",
  11683. inherited: false,
  11684. animationType: "discrete",
  11685. percentages: "no",
  11686. groups: [
  11687. "Microsoft Extensions"
  11688. ],
  11689. initial: "none",
  11690. appliesto: "nonReplacedElements",
  11691. computed: "asSpecified",
  11692. order: "uniqueOrder",
  11693. status: "nonstandard",
  11694. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-flow-from"
  11695. },
  11696. "-ms-flow-into": {
  11697. syntax: "[ none | <custom-ident> ]#",
  11698. media: "visual",
  11699. inherited: false,
  11700. animationType: "discrete",
  11701. percentages: "no",
  11702. groups: [
  11703. "Microsoft Extensions"
  11704. ],
  11705. initial: "none",
  11706. appliesto: "iframeElements",
  11707. computed: "asSpecified",
  11708. order: "uniqueOrder",
  11709. status: "nonstandard",
  11710. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-flow-into"
  11711. },
  11712. "-ms-grid-columns": {
  11713. syntax: "none | <track-list> | <auto-track-list>",
  11714. media: "visual",
  11715. inherited: false,
  11716. animationType: "simpleListOfLpcDifferenceLpc",
  11717. percentages: "referToDimensionOfContentArea",
  11718. groups: [
  11719. "CSS Grid Layout"
  11720. ],
  11721. initial: "none",
  11722. appliesto: "gridContainers",
  11723. computed: "asSpecifiedRelativeToAbsoluteLengths",
  11724. order: "uniqueOrder",
  11725. status: "nonstandard",
  11726. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-grid-columns"
  11727. },
  11728. "-ms-grid-rows": {
  11729. syntax: "none | <track-list> | <auto-track-list>",
  11730. media: "visual",
  11731. inherited: false,
  11732. animationType: "simpleListOfLpcDifferenceLpc",
  11733. percentages: "referToDimensionOfContentArea",
  11734. groups: [
  11735. "CSS Grid Layout"
  11736. ],
  11737. initial: "none",
  11738. appliesto: "gridContainers",
  11739. computed: "asSpecifiedRelativeToAbsoluteLengths",
  11740. order: "uniqueOrder",
  11741. status: "nonstandard",
  11742. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-grid-rows"
  11743. },
  11744. "-ms-high-contrast-adjust": {
  11745. syntax: "auto | none",
  11746. media: "visual",
  11747. inherited: true,
  11748. animationType: "discrete",
  11749. percentages: "no",
  11750. groups: [
  11751. "Microsoft Extensions"
  11752. ],
  11753. initial: "auto",
  11754. appliesto: "allElements",
  11755. computed: "asSpecified",
  11756. order: "uniqueOrder",
  11757. status: "nonstandard",
  11758. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-high-contrast-adjust"
  11759. },
  11760. "-ms-hyphenate-limit-chars": {
  11761. syntax: "auto | <integer>{1,3}",
  11762. media: "visual",
  11763. inherited: true,
  11764. animationType: "discrete",
  11765. percentages: "no",
  11766. groups: [
  11767. "Microsoft Extensions"
  11768. ],
  11769. initial: "auto",
  11770. appliesto: "allElements",
  11771. computed: "asSpecified",
  11772. order: "uniqueOrder",
  11773. status: "nonstandard",
  11774. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-hyphenate-limit-chars"
  11775. },
  11776. "-ms-hyphenate-limit-lines": {
  11777. syntax: "no-limit | <integer>",
  11778. media: "visual",
  11779. inherited: true,
  11780. animationType: "discrete",
  11781. percentages: "no",
  11782. groups: [
  11783. "Microsoft Extensions"
  11784. ],
  11785. initial: "no-limit",
  11786. appliesto: "blockContainerElements",
  11787. computed: "asSpecified",
  11788. order: "uniqueOrder",
  11789. status: "nonstandard",
  11790. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-hyphenate-limit-lines"
  11791. },
  11792. "-ms-hyphenate-limit-zone": {
  11793. syntax: "<percentage> | <length>",
  11794. media: "visual",
  11795. inherited: true,
  11796. animationType: "discrete",
  11797. percentages: "referToLineBoxWidth",
  11798. groups: [
  11799. "Microsoft Extensions"
  11800. ],
  11801. initial: "0",
  11802. appliesto: "blockContainerElements",
  11803. computed: "asSpecified",
  11804. order: "uniqueOrder",
  11805. status: "nonstandard",
  11806. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-hyphenate-limit-zone"
  11807. },
  11808. "-ms-ime-align": {
  11809. syntax: "auto | after",
  11810. media: "visual",
  11811. inherited: false,
  11812. animationType: "discrete",
  11813. percentages: "no",
  11814. groups: [
  11815. "Microsoft Extensions"
  11816. ],
  11817. initial: "auto",
  11818. appliesto: "allElements",
  11819. computed: "asSpecified",
  11820. order: "uniqueOrder",
  11821. status: "nonstandard",
  11822. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-ime-align"
  11823. },
  11824. "-ms-overflow-style": {
  11825. syntax: "auto | none | scrollbar | -ms-autohiding-scrollbar",
  11826. media: "interactive",
  11827. inherited: true,
  11828. animationType: "discrete",
  11829. percentages: "no",
  11830. groups: [
  11831. "Microsoft Extensions"
  11832. ],
  11833. initial: "auto",
  11834. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11835. computed: "asSpecified",
  11836. order: "uniqueOrder",
  11837. status: "nonstandard",
  11838. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-overflow-style"
  11839. },
  11840. "-ms-scrollbar-3dlight-color": {
  11841. syntax: "<color>",
  11842. media: "visual",
  11843. inherited: true,
  11844. animationType: "discrete",
  11845. percentages: "no",
  11846. groups: [
  11847. "Microsoft Extensions"
  11848. ],
  11849. initial: "dependsOnUserAgent",
  11850. appliesto: "allElements",
  11851. computed: "asSpecified",
  11852. order: "uniqueOrder",
  11853. status: "nonstandard",
  11854. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-3dlight-color"
  11855. },
  11856. "-ms-scrollbar-arrow-color": {
  11857. syntax: "<color>",
  11858. media: "visual",
  11859. inherited: true,
  11860. animationType: "discrete",
  11861. percentages: "no",
  11862. groups: [
  11863. "Microsoft Extensions"
  11864. ],
  11865. initial: "ButtonText",
  11866. appliesto: "allElements",
  11867. computed: "asSpecified",
  11868. order: "uniqueOrder",
  11869. status: "nonstandard",
  11870. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-arrow-color"
  11871. },
  11872. "-ms-scrollbar-base-color": {
  11873. syntax: "<color>",
  11874. media: "visual",
  11875. inherited: true,
  11876. animationType: "discrete",
  11877. percentages: "no",
  11878. groups: [
  11879. "Microsoft Extensions"
  11880. ],
  11881. initial: "dependsOnUserAgent",
  11882. appliesto: "allElements",
  11883. computed: "asSpecified",
  11884. order: "uniqueOrder",
  11885. status: "nonstandard",
  11886. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-base-color"
  11887. },
  11888. "-ms-scrollbar-darkshadow-color": {
  11889. syntax: "<color>",
  11890. media: "visual",
  11891. inherited: true,
  11892. animationType: "discrete",
  11893. percentages: "no",
  11894. groups: [
  11895. "Microsoft Extensions"
  11896. ],
  11897. initial: "ThreeDDarkShadow",
  11898. appliesto: "allElements",
  11899. computed: "asSpecified",
  11900. order: "uniqueOrder",
  11901. status: "nonstandard",
  11902. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-darkshadow-color"
  11903. },
  11904. "-ms-scrollbar-face-color": {
  11905. syntax: "<color>",
  11906. media: "visual",
  11907. inherited: true,
  11908. animationType: "discrete",
  11909. percentages: "no",
  11910. groups: [
  11911. "Microsoft Extensions"
  11912. ],
  11913. initial: "ThreeDFace",
  11914. appliesto: "allElements",
  11915. computed: "asSpecified",
  11916. order: "uniqueOrder",
  11917. status: "nonstandard",
  11918. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-face-color"
  11919. },
  11920. "-ms-scrollbar-highlight-color": {
  11921. syntax: "<color>",
  11922. media: "visual",
  11923. inherited: true,
  11924. animationType: "discrete",
  11925. percentages: "no",
  11926. groups: [
  11927. "Microsoft Extensions"
  11928. ],
  11929. initial: "ThreeDHighlight",
  11930. appliesto: "allElements",
  11931. computed: "asSpecified",
  11932. order: "uniqueOrder",
  11933. status: "nonstandard",
  11934. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-highlight-color"
  11935. },
  11936. "-ms-scrollbar-shadow-color": {
  11937. syntax: "<color>",
  11938. media: "visual",
  11939. inherited: true,
  11940. animationType: "discrete",
  11941. percentages: "no",
  11942. groups: [
  11943. "Microsoft Extensions"
  11944. ],
  11945. initial: "ThreeDDarkShadow",
  11946. appliesto: "allElements",
  11947. computed: "asSpecified",
  11948. order: "uniqueOrder",
  11949. status: "nonstandard",
  11950. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-shadow-color"
  11951. },
  11952. "-ms-scrollbar-track-color": {
  11953. syntax: "<color>",
  11954. media: "visual",
  11955. inherited: true,
  11956. animationType: "discrete",
  11957. percentages: "no",
  11958. groups: [
  11959. "Microsoft Extensions"
  11960. ],
  11961. initial: "Scrollbar",
  11962. appliesto: "allElements",
  11963. computed: "asSpecified",
  11964. order: "uniqueOrder",
  11965. status: "nonstandard",
  11966. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-track-color"
  11967. },
  11968. "-ms-scroll-chaining": {
  11969. syntax: "chained | none",
  11970. media: "interactive",
  11971. inherited: false,
  11972. animationType: "discrete",
  11973. percentages: "no",
  11974. groups: [
  11975. "Microsoft Extensions"
  11976. ],
  11977. initial: "chained",
  11978. appliesto: "nonReplacedBlockAndInlineBlockElements",
  11979. computed: "asSpecified",
  11980. order: "uniqueOrder",
  11981. status: "nonstandard",
  11982. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-chaining"
  11983. },
  11984. "-ms-scroll-limit": {
  11985. syntax: "<'-ms-scroll-limit-x-min'> <'-ms-scroll-limit-y-min'> <'-ms-scroll-limit-x-max'> <'-ms-scroll-limit-y-max'>",
  11986. media: "interactive",
  11987. inherited: false,
  11988. animationType: "discrete",
  11989. percentages: "no",
  11990. groups: [
  11991. "Microsoft Extensions"
  11992. ],
  11993. initial: [
  11994. "-ms-scroll-limit-x-min",
  11995. "-ms-scroll-limit-y-min",
  11996. "-ms-scroll-limit-x-max",
  11997. "-ms-scroll-limit-y-max"
  11998. ],
  11999. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12000. computed: [
  12001. "-ms-scroll-limit-x-min",
  12002. "-ms-scroll-limit-y-min",
  12003. "-ms-scroll-limit-x-max",
  12004. "-ms-scroll-limit-y-max"
  12005. ],
  12006. order: "uniqueOrder",
  12007. status: "nonstandard",
  12008. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit"
  12009. },
  12010. "-ms-scroll-limit-x-max": {
  12011. syntax: "auto | <length>",
  12012. media: "interactive",
  12013. inherited: false,
  12014. animationType: "discrete",
  12015. percentages: "no",
  12016. groups: [
  12017. "Microsoft Extensions"
  12018. ],
  12019. initial: "auto",
  12020. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12021. computed: "asSpecified",
  12022. order: "uniqueOrder",
  12023. status: "nonstandard",
  12024. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-x-max"
  12025. },
  12026. "-ms-scroll-limit-x-min": {
  12027. syntax: "<length>",
  12028. media: "interactive",
  12029. inherited: false,
  12030. animationType: "discrete",
  12031. percentages: "no",
  12032. groups: [
  12033. "Microsoft Extensions"
  12034. ],
  12035. initial: "0",
  12036. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12037. computed: "asSpecified",
  12038. order: "uniqueOrder",
  12039. status: "nonstandard",
  12040. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-x-min"
  12041. },
  12042. "-ms-scroll-limit-y-max": {
  12043. syntax: "auto | <length>",
  12044. media: "interactive",
  12045. inherited: false,
  12046. animationType: "discrete",
  12047. percentages: "no",
  12048. groups: [
  12049. "Microsoft Extensions"
  12050. ],
  12051. initial: "auto",
  12052. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12053. computed: "asSpecified",
  12054. order: "uniqueOrder",
  12055. status: "nonstandard",
  12056. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-y-max"
  12057. },
  12058. "-ms-scroll-limit-y-min": {
  12059. syntax: "<length>",
  12060. media: "interactive",
  12061. inherited: false,
  12062. animationType: "discrete",
  12063. percentages: "no",
  12064. groups: [
  12065. "Microsoft Extensions"
  12066. ],
  12067. initial: "0",
  12068. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12069. computed: "asSpecified",
  12070. order: "uniqueOrder",
  12071. status: "nonstandard",
  12072. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-y-min"
  12073. },
  12074. "-ms-scroll-rails": {
  12075. syntax: "none | railed",
  12076. media: "interactive",
  12077. inherited: false,
  12078. animationType: "discrete",
  12079. percentages: "no",
  12080. groups: [
  12081. "Microsoft Extensions"
  12082. ],
  12083. initial: "railed",
  12084. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12085. computed: "asSpecified",
  12086. order: "uniqueOrder",
  12087. status: "nonstandard",
  12088. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-rails"
  12089. },
  12090. "-ms-scroll-snap-points-x": {
  12091. syntax: "snapInterval( <length-percentage>, <length-percentage> ) | snapList( <length-percentage># )",
  12092. media: "interactive",
  12093. inherited: false,
  12094. animationType: "discrete",
  12095. percentages: "no",
  12096. groups: [
  12097. "Microsoft Extensions"
  12098. ],
  12099. initial: "snapInterval(0px, 100%)",
  12100. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12101. computed: "asSpecified",
  12102. order: "uniqueOrder",
  12103. status: "nonstandard",
  12104. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-points-x"
  12105. },
  12106. "-ms-scroll-snap-points-y": {
  12107. syntax: "snapInterval( <length-percentage>, <length-percentage> ) | snapList( <length-percentage># )",
  12108. media: "interactive",
  12109. inherited: false,
  12110. animationType: "discrete",
  12111. percentages: "no",
  12112. groups: [
  12113. "Microsoft Extensions"
  12114. ],
  12115. initial: "snapInterval(0px, 100%)",
  12116. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12117. computed: "asSpecified",
  12118. order: "uniqueOrder",
  12119. status: "nonstandard",
  12120. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-points-y"
  12121. },
  12122. "-ms-scroll-snap-type": {
  12123. syntax: "none | proximity | mandatory",
  12124. media: "interactive",
  12125. inherited: false,
  12126. animationType: "discrete",
  12127. percentages: "no",
  12128. groups: [
  12129. "Microsoft Extensions"
  12130. ],
  12131. initial: "none",
  12132. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12133. computed: "asSpecified",
  12134. order: "uniqueOrder",
  12135. status: "nonstandard",
  12136. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-type"
  12137. },
  12138. "-ms-scroll-snap-x": {
  12139. syntax: "<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-x'>",
  12140. media: "interactive",
  12141. inherited: false,
  12142. animationType: "discrete",
  12143. percentages: "no",
  12144. groups: [
  12145. "Microsoft Extensions"
  12146. ],
  12147. initial: [
  12148. "-ms-scroll-snap-type",
  12149. "-ms-scroll-snap-points-x"
  12150. ],
  12151. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12152. computed: [
  12153. "-ms-scroll-snap-type",
  12154. "-ms-scroll-snap-points-x"
  12155. ],
  12156. order: "uniqueOrder",
  12157. status: "nonstandard",
  12158. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-x"
  12159. },
  12160. "-ms-scroll-snap-y": {
  12161. syntax: "<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-y'>",
  12162. media: "interactive",
  12163. inherited: false,
  12164. animationType: "discrete",
  12165. percentages: "no",
  12166. groups: [
  12167. "Microsoft Extensions"
  12168. ],
  12169. initial: [
  12170. "-ms-scroll-snap-type",
  12171. "-ms-scroll-snap-points-y"
  12172. ],
  12173. appliesto: "nonReplacedBlockAndInlineBlockElements",
  12174. computed: [
  12175. "-ms-scroll-snap-type",
  12176. "-ms-scroll-snap-points-y"
  12177. ],
  12178. order: "uniqueOrder",
  12179. status: "nonstandard",
  12180. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-y"
  12181. },
  12182. "-ms-scroll-translation": {
  12183. syntax: "none | vertical-to-horizontal",
  12184. media: "interactive",
  12185. inherited: true,
  12186. animationType: "discrete",
  12187. percentages: "no",
  12188. groups: [
  12189. "Microsoft Extensions"
  12190. ],
  12191. initial: "none",
  12192. appliesto: "allElements",
  12193. computed: "asSpecified",
  12194. order: "uniqueOrder",
  12195. status: "nonstandard",
  12196. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-translation"
  12197. },
  12198. "-ms-text-autospace": {
  12199. syntax: "none | ideograph-alpha | ideograph-numeric | ideograph-parenthesis | ideograph-space",
  12200. media: "visual",
  12201. inherited: false,
  12202. animationType: "discrete",
  12203. percentages: "no",
  12204. groups: [
  12205. "Microsoft Extensions"
  12206. ],
  12207. initial: "none",
  12208. appliesto: "allElements",
  12209. computed: "asSpecified",
  12210. order: "uniqueOrder",
  12211. status: "nonstandard",
  12212. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-text-autospace"
  12213. },
  12214. "-ms-touch-select": {
  12215. syntax: "grippers | none",
  12216. media: "interactive",
  12217. inherited: true,
  12218. animationType: "discrete",
  12219. percentages: "no",
  12220. groups: [
  12221. "Microsoft Extensions"
  12222. ],
  12223. initial: "grippers",
  12224. appliesto: "allElements",
  12225. computed: "asSpecified",
  12226. order: "uniqueOrder",
  12227. status: "nonstandard",
  12228. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-touch-select"
  12229. },
  12230. "-ms-user-select": {
  12231. syntax: "none | element | text",
  12232. media: "interactive",
  12233. inherited: false,
  12234. animationType: "discrete",
  12235. percentages: "no",
  12236. groups: [
  12237. "Microsoft Extensions"
  12238. ],
  12239. initial: "text",
  12240. appliesto: "nonReplacedElements",
  12241. computed: "asSpecified",
  12242. order: "uniqueOrder",
  12243. status: "nonstandard",
  12244. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-user-select"
  12245. },
  12246. "-ms-wrap-flow": {
  12247. syntax: "auto | both | start | end | maximum | clear",
  12248. media: "visual",
  12249. inherited: false,
  12250. animationType: "discrete",
  12251. percentages: "no",
  12252. groups: [
  12253. "Microsoft Extensions"
  12254. ],
  12255. initial: "auto",
  12256. appliesto: "blockLevelElements",
  12257. computed: "asSpecified",
  12258. order: "uniqueOrder",
  12259. status: "nonstandard",
  12260. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-wrap-flow"
  12261. },
  12262. "-ms-wrap-margin": {
  12263. syntax: "<length>",
  12264. media: "visual",
  12265. inherited: false,
  12266. animationType: "discrete",
  12267. percentages: "no",
  12268. groups: [
  12269. "Microsoft Extensions"
  12270. ],
  12271. initial: "0",
  12272. appliesto: "exclusionElements",
  12273. computed: "asSpecified",
  12274. order: "uniqueOrder",
  12275. status: "nonstandard",
  12276. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-wrap-margin"
  12277. },
  12278. "-ms-wrap-through": {
  12279. syntax: "wrap | none",
  12280. media: "visual",
  12281. inherited: false,
  12282. animationType: "discrete",
  12283. percentages: "no",
  12284. groups: [
  12285. "Microsoft Extensions"
  12286. ],
  12287. initial: "wrap",
  12288. appliesto: "blockLevelElements",
  12289. computed: "asSpecified",
  12290. order: "uniqueOrder",
  12291. status: "nonstandard",
  12292. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-wrap-through"
  12293. },
  12294. "-moz-appearance": {
  12295. 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",
  12296. media: "visual",
  12297. inherited: false,
  12298. animationType: "discrete",
  12299. percentages: "no",
  12300. groups: [
  12301. "Mozilla Extensions",
  12302. "WebKit Extensions"
  12303. ],
  12304. initial: "noneButOverriddenInUserAgentCSS",
  12305. appliesto: "allElements",
  12306. computed: "asSpecified",
  12307. order: "uniqueOrder",
  12308. status: "nonstandard",
  12309. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/appearance"
  12310. },
  12311. "-moz-binding": {
  12312. syntax: "<url> | none",
  12313. media: "visual",
  12314. inherited: false,
  12315. animationType: "discrete",
  12316. percentages: "no",
  12317. groups: [
  12318. "Mozilla Extensions"
  12319. ],
  12320. initial: "none",
  12321. appliesto: "allElementsExceptGeneratedContentOrPseudoElements",
  12322. computed: "asSpecified",
  12323. order: "uniqueOrder",
  12324. status: "nonstandard",
  12325. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-binding"
  12326. },
  12327. "-moz-border-bottom-colors": {
  12328. syntax: "<color>+ | none",
  12329. media: "visual",
  12330. inherited: false,
  12331. animationType: "discrete",
  12332. percentages: "no",
  12333. groups: [
  12334. "Mozilla Extensions"
  12335. ],
  12336. initial: "none",
  12337. appliesto: "allElements",
  12338. computed: "asSpecified",
  12339. order: "uniqueOrder",
  12340. status: "nonstandard",
  12341. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-border-bottom-colors"
  12342. },
  12343. "-moz-border-left-colors": {
  12344. syntax: "<color>+ | none",
  12345. media: "visual",
  12346. inherited: false,
  12347. animationType: "discrete",
  12348. percentages: "no",
  12349. groups: [
  12350. "Mozilla Extensions"
  12351. ],
  12352. initial: "none",
  12353. appliesto: "allElements",
  12354. computed: "asSpecified",
  12355. order: "uniqueOrder",
  12356. status: "nonstandard",
  12357. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-border-left-colors"
  12358. },
  12359. "-moz-border-right-colors": {
  12360. syntax: "<color>+ | none",
  12361. media: "visual",
  12362. inherited: false,
  12363. animationType: "discrete",
  12364. percentages: "no",
  12365. groups: [
  12366. "Mozilla Extensions"
  12367. ],
  12368. initial: "none",
  12369. appliesto: "allElements",
  12370. computed: "asSpecified",
  12371. order: "uniqueOrder",
  12372. status: "nonstandard",
  12373. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-border-right-colors"
  12374. },
  12375. "-moz-border-top-colors": {
  12376. syntax: "<color>+ | none",
  12377. media: "visual",
  12378. inherited: false,
  12379. animationType: "discrete",
  12380. percentages: "no",
  12381. groups: [
  12382. "Mozilla Extensions"
  12383. ],
  12384. initial: "none",
  12385. appliesto: "allElements",
  12386. computed: "asSpecified",
  12387. order: "uniqueOrder",
  12388. status: "nonstandard",
  12389. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-border-top-colors"
  12390. },
  12391. "-moz-context-properties": {
  12392. syntax: "none | [ fill | fill-opacity | stroke | stroke-opacity ]#",
  12393. media: "visual",
  12394. inherited: true,
  12395. animationType: "discrete",
  12396. percentages: "no",
  12397. groups: [
  12398. "Mozilla Extensions"
  12399. ],
  12400. initial: "none",
  12401. appliesto: "allElementsThatCanReferenceImages",
  12402. computed: "asSpecified",
  12403. order: "uniqueOrder",
  12404. status: "nonstandard",
  12405. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-context-properties"
  12406. },
  12407. "-moz-float-edge": {
  12408. syntax: "border-box | content-box | margin-box | padding-box",
  12409. media: "visual",
  12410. inherited: false,
  12411. animationType: "discrete",
  12412. percentages: "no",
  12413. groups: [
  12414. "Mozilla Extensions"
  12415. ],
  12416. initial: "content-box",
  12417. appliesto: "allElements",
  12418. computed: "asSpecified",
  12419. order: "uniqueOrder",
  12420. status: "nonstandard",
  12421. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-float-edge"
  12422. },
  12423. "-moz-force-broken-image-icon": {
  12424. syntax: "<integer [0,1]>",
  12425. media: "visual",
  12426. inherited: false,
  12427. animationType: "discrete",
  12428. percentages: "no",
  12429. groups: [
  12430. "Mozilla Extensions"
  12431. ],
  12432. initial: "0",
  12433. appliesto: "images",
  12434. computed: "asSpecified",
  12435. order: "uniqueOrder",
  12436. status: "nonstandard",
  12437. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-force-broken-image-icon"
  12438. },
  12439. "-moz-image-region": {
  12440. syntax: "<shape> | auto",
  12441. media: "visual",
  12442. inherited: true,
  12443. animationType: "discrete",
  12444. percentages: "no",
  12445. groups: [
  12446. "Mozilla Extensions"
  12447. ],
  12448. initial: "auto",
  12449. appliesto: "xulImageElements",
  12450. computed: "asSpecified",
  12451. order: "uniqueOrder",
  12452. status: "nonstandard",
  12453. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-image-region"
  12454. },
  12455. "-moz-orient": {
  12456. syntax: "inline | block | horizontal | vertical",
  12457. media: "visual",
  12458. inherited: false,
  12459. animationType: "discrete",
  12460. percentages: "no",
  12461. groups: [
  12462. "Mozilla Extensions"
  12463. ],
  12464. initial: "inline",
  12465. appliesto: "anyElementEffectOnProgressAndMeter",
  12466. computed: "asSpecified",
  12467. order: "uniqueOrder",
  12468. status: "nonstandard",
  12469. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-orient"
  12470. },
  12471. "-moz-outline-radius": {
  12472. syntax: "<outline-radius>{1,4} [ / <outline-radius>{1,4} ]?",
  12473. media: "visual",
  12474. inherited: false,
  12475. animationType: [
  12476. "-moz-outline-radius-topleft",
  12477. "-moz-outline-radius-topright",
  12478. "-moz-outline-radius-bottomright",
  12479. "-moz-outline-radius-bottomleft"
  12480. ],
  12481. percentages: [
  12482. "-moz-outline-radius-topleft",
  12483. "-moz-outline-radius-topright",
  12484. "-moz-outline-radius-bottomright",
  12485. "-moz-outline-radius-bottomleft"
  12486. ],
  12487. groups: [
  12488. "Mozilla Extensions"
  12489. ],
  12490. initial: [
  12491. "-moz-outline-radius-topleft",
  12492. "-moz-outline-radius-topright",
  12493. "-moz-outline-radius-bottomright",
  12494. "-moz-outline-radius-bottomleft"
  12495. ],
  12496. appliesto: "allElements",
  12497. computed: [
  12498. "-moz-outline-radius-topleft",
  12499. "-moz-outline-radius-topright",
  12500. "-moz-outline-radius-bottomright",
  12501. "-moz-outline-radius-bottomleft"
  12502. ],
  12503. order: "uniqueOrder",
  12504. status: "nonstandard",
  12505. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius"
  12506. },
  12507. "-moz-outline-radius-bottomleft": {
  12508. syntax: "<outline-radius>",
  12509. media: "visual",
  12510. inherited: false,
  12511. animationType: "lpc",
  12512. percentages: "referToDimensionOfBorderBox",
  12513. groups: [
  12514. "Mozilla Extensions"
  12515. ],
  12516. initial: "0",
  12517. appliesto: "allElements",
  12518. computed: "asSpecified",
  12519. order: "uniqueOrder",
  12520. status: "nonstandard",
  12521. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-bottomleft"
  12522. },
  12523. "-moz-outline-radius-bottomright": {
  12524. syntax: "<outline-radius>",
  12525. media: "visual",
  12526. inherited: false,
  12527. animationType: "lpc",
  12528. percentages: "referToDimensionOfBorderBox",
  12529. groups: [
  12530. "Mozilla Extensions"
  12531. ],
  12532. initial: "0",
  12533. appliesto: "allElements",
  12534. computed: "asSpecified",
  12535. order: "uniqueOrder",
  12536. status: "nonstandard",
  12537. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-bottomright"
  12538. },
  12539. "-moz-outline-radius-topleft": {
  12540. syntax: "<outline-radius>",
  12541. media: "visual",
  12542. inherited: false,
  12543. animationType: "lpc",
  12544. percentages: "referToDimensionOfBorderBox",
  12545. groups: [
  12546. "Mozilla Extensions"
  12547. ],
  12548. initial: "0",
  12549. appliesto: "allElements",
  12550. computed: "asSpecified",
  12551. order: "uniqueOrder",
  12552. status: "nonstandard",
  12553. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-topleft"
  12554. },
  12555. "-moz-outline-radius-topright": {
  12556. syntax: "<outline-radius>",
  12557. media: "visual",
  12558. inherited: false,
  12559. animationType: "lpc",
  12560. percentages: "referToDimensionOfBorderBox",
  12561. groups: [
  12562. "Mozilla Extensions"
  12563. ],
  12564. initial: "0",
  12565. appliesto: "allElements",
  12566. computed: "asSpecified",
  12567. order: "uniqueOrder",
  12568. status: "nonstandard",
  12569. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-topright"
  12570. },
  12571. "-moz-stack-sizing": {
  12572. syntax: "ignore | stretch-to-fit",
  12573. media: "visual",
  12574. inherited: true,
  12575. animationType: "discrete",
  12576. percentages: "no",
  12577. groups: [
  12578. "Mozilla Extensions"
  12579. ],
  12580. initial: "stretch-to-fit",
  12581. appliesto: "allElements",
  12582. computed: "asSpecified",
  12583. order: "uniqueOrder",
  12584. status: "nonstandard",
  12585. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-stack-sizing"
  12586. },
  12587. "-moz-text-blink": {
  12588. syntax: "none | blink",
  12589. media: "visual",
  12590. inherited: false,
  12591. animationType: "discrete",
  12592. percentages: "no",
  12593. groups: [
  12594. "Mozilla Extensions"
  12595. ],
  12596. initial: "none",
  12597. appliesto: "allElements",
  12598. computed: "asSpecified",
  12599. order: "uniqueOrder",
  12600. status: "nonstandard",
  12601. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-text-blink"
  12602. },
  12603. "-moz-user-focus": {
  12604. syntax: "ignore | normal | select-after | select-before | select-menu | select-same | select-all | none",
  12605. media: "interactive",
  12606. inherited: false,
  12607. animationType: "discrete",
  12608. percentages: "no",
  12609. groups: [
  12610. "Mozilla Extensions"
  12611. ],
  12612. initial: "none",
  12613. appliesto: "allElements",
  12614. computed: "asSpecified",
  12615. order: "uniqueOrder",
  12616. status: "nonstandard",
  12617. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-user-focus"
  12618. },
  12619. "-moz-user-input": {
  12620. syntax: "auto | none | enabled | disabled",
  12621. media: "visual",
  12622. inherited: true,
  12623. animationType: "discrete",
  12624. percentages: "no",
  12625. groups: [
  12626. "Mozilla Extensions"
  12627. ],
  12628. initial: "auto",
  12629. appliesto: "allElements",
  12630. computed: "asSpecified",
  12631. order: "uniqueOrder",
  12632. status: "nonstandard",
  12633. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-user-input"
  12634. },
  12635. "-moz-user-modify": {
  12636. syntax: "read-only | read-write | write-only",
  12637. media: "interactive",
  12638. inherited: true,
  12639. animationType: "discrete",
  12640. percentages: "no",
  12641. groups: [
  12642. "Mozilla Extensions"
  12643. ],
  12644. initial: "read-only",
  12645. appliesto: "allElements",
  12646. computed: "asSpecified",
  12647. order: "uniqueOrder",
  12648. status: "nonstandard",
  12649. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-user-modify"
  12650. },
  12651. "-moz-window-dragging": {
  12652. syntax: "drag | no-drag",
  12653. media: "visual",
  12654. inherited: false,
  12655. animationType: "discrete",
  12656. percentages: "no",
  12657. groups: [
  12658. "Mozilla Extensions"
  12659. ],
  12660. initial: "drag",
  12661. appliesto: "allElementsCreatingNativeWindows",
  12662. computed: "asSpecified",
  12663. order: "uniqueOrder",
  12664. status: "nonstandard",
  12665. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-window-dragging"
  12666. },
  12667. "-moz-window-shadow": {
  12668. syntax: "default | menu | tooltip | sheet | none",
  12669. media: "visual",
  12670. inherited: false,
  12671. animationType: "discrete",
  12672. percentages: "no",
  12673. groups: [
  12674. "Mozilla Extensions"
  12675. ],
  12676. initial: "default",
  12677. appliesto: "allElementsCreatingNativeWindows",
  12678. computed: "asSpecified",
  12679. order: "uniqueOrder",
  12680. status: "nonstandard",
  12681. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-window-shadow"
  12682. },
  12683. "-webkit-appearance": {
  12684. 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",
  12685. media: "visual",
  12686. inherited: false,
  12687. animationType: "discrete",
  12688. percentages: "no",
  12689. groups: [
  12690. "WebKit Extensions"
  12691. ],
  12692. initial: "noneButOverriddenInUserAgentCSS",
  12693. appliesto: "allElements",
  12694. computed: "asSpecified",
  12695. order: "uniqueOrder",
  12696. status: "nonstandard",
  12697. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/appearance"
  12698. },
  12699. "-webkit-border-before": {
  12700. syntax: "<'border-width'> || <'border-style'> || <'color'>",
  12701. media: "visual",
  12702. inherited: true,
  12703. animationType: "discrete",
  12704. percentages: [
  12705. "-webkit-border-before-width"
  12706. ],
  12707. groups: [
  12708. "WebKit Extensions"
  12709. ],
  12710. initial: [
  12711. "border-width",
  12712. "border-style",
  12713. "color"
  12714. ],
  12715. appliesto: "allElements",
  12716. computed: [
  12717. "border-width",
  12718. "border-style",
  12719. "color"
  12720. ],
  12721. order: "uniqueOrder",
  12722. status: "nonstandard",
  12723. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-border-before"
  12724. },
  12725. "-webkit-border-before-color": {
  12726. syntax: "<'color'>",
  12727. media: "visual",
  12728. inherited: true,
  12729. animationType: "discrete",
  12730. percentages: "no",
  12731. groups: [
  12732. "WebKit Extensions"
  12733. ],
  12734. initial: "currentcolor",
  12735. appliesto: "allElements",
  12736. computed: "computedColor",
  12737. order: "uniqueOrder",
  12738. status: "nonstandard"
  12739. },
  12740. "-webkit-border-before-style": {
  12741. syntax: "<'border-style'>",
  12742. media: "visual",
  12743. inherited: true,
  12744. animationType: "discrete",
  12745. percentages: "no",
  12746. groups: [
  12747. "WebKit Extensions"
  12748. ],
  12749. initial: "none",
  12750. appliesto: "allElements",
  12751. computed: "asSpecified",
  12752. order: "uniqueOrder",
  12753. status: "nonstandard"
  12754. },
  12755. "-webkit-border-before-width": {
  12756. syntax: "<'border-width'>",
  12757. media: "visual",
  12758. inherited: true,
  12759. animationType: "discrete",
  12760. percentages: "logicalWidthOfContainingBlock",
  12761. groups: [
  12762. "WebKit Extensions"
  12763. ],
  12764. initial: "medium",
  12765. appliesto: "allElements",
  12766. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  12767. order: "uniqueOrder",
  12768. status: "nonstandard"
  12769. },
  12770. "-webkit-box-reflect": {
  12771. syntax: "[ above | below | right | left ]? <length>? <image>?",
  12772. media: "visual",
  12773. inherited: false,
  12774. animationType: "discrete",
  12775. percentages: "no",
  12776. groups: [
  12777. "WebKit Extensions"
  12778. ],
  12779. initial: "none",
  12780. appliesto: "allElements",
  12781. computed: "asSpecified",
  12782. order: "uniqueOrder",
  12783. status: "nonstandard",
  12784. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-box-reflect"
  12785. },
  12786. "-webkit-line-clamp": {
  12787. syntax: "none | <integer>",
  12788. media: "visual",
  12789. inherited: false,
  12790. animationType: "byComputedValueType",
  12791. percentages: "no",
  12792. groups: [
  12793. "WebKit Extensions",
  12794. "CSS Overflow"
  12795. ],
  12796. initial: "none",
  12797. appliesto: "allElements",
  12798. computed: "asSpecified",
  12799. order: "uniqueOrder",
  12800. status: "standard",
  12801. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-line-clamp"
  12802. },
  12803. "-webkit-mask": {
  12804. syntax: "[ <mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || [ <box> | border | padding | content | text ] || [ <box> | border | padding | content ] ]#",
  12805. media: "visual",
  12806. inherited: false,
  12807. animationType: "discrete",
  12808. percentages: "no",
  12809. groups: [
  12810. "WebKit Extensions"
  12811. ],
  12812. initial: [
  12813. "-webkit-mask-image",
  12814. "-webkit-mask-repeat",
  12815. "-webkit-mask-attachment",
  12816. "-webkit-mask-position",
  12817. "-webkit-mask-origin",
  12818. "-webkit-mask-clip"
  12819. ],
  12820. appliesto: "allElements",
  12821. computed: [
  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. order: "uniqueOrder",
  12830. status: "nonstandard",
  12831. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask"
  12832. },
  12833. "-webkit-mask-attachment": {
  12834. syntax: "<attachment>#",
  12835. media: "visual",
  12836. inherited: false,
  12837. animationType: "discrete",
  12838. percentages: "no",
  12839. groups: [
  12840. "WebKit Extensions"
  12841. ],
  12842. initial: "scroll",
  12843. appliesto: "allElements",
  12844. computed: "asSpecified",
  12845. order: "orderOfAppearance",
  12846. status: "nonstandard",
  12847. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-attachment"
  12848. },
  12849. "-webkit-mask-clip": {
  12850. syntax: "[ <box> | border | padding | content | text ]#",
  12851. media: "visual",
  12852. inherited: false,
  12853. animationType: "discrete",
  12854. percentages: "no",
  12855. groups: [
  12856. "WebKit Extensions"
  12857. ],
  12858. initial: "border",
  12859. appliesto: "allElements",
  12860. computed: "asSpecified",
  12861. order: "orderOfAppearance",
  12862. status: "nonstandard",
  12863. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-clip"
  12864. },
  12865. "-webkit-mask-composite": {
  12866. syntax: "<composite-style>#",
  12867. media: "visual",
  12868. inherited: false,
  12869. animationType: "discrete",
  12870. percentages: "no",
  12871. groups: [
  12872. "WebKit Extensions"
  12873. ],
  12874. initial: "source-over",
  12875. appliesto: "allElements",
  12876. computed: "asSpecified",
  12877. order: "orderOfAppearance",
  12878. status: "nonstandard",
  12879. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-composite"
  12880. },
  12881. "-webkit-mask-image": {
  12882. syntax: "<mask-reference>#",
  12883. media: "visual",
  12884. inherited: false,
  12885. animationType: "discrete",
  12886. percentages: "no",
  12887. groups: [
  12888. "WebKit Extensions"
  12889. ],
  12890. initial: "none",
  12891. appliesto: "allElements",
  12892. computed: "absoluteURIOrNone",
  12893. order: "orderOfAppearance",
  12894. status: "nonstandard",
  12895. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-image"
  12896. },
  12897. "-webkit-mask-origin": {
  12898. syntax: "[ <box> | border | padding | content ]#",
  12899. media: "visual",
  12900. inherited: false,
  12901. animationType: "discrete",
  12902. percentages: "no",
  12903. groups: [
  12904. "WebKit Extensions"
  12905. ],
  12906. initial: "padding",
  12907. appliesto: "allElements",
  12908. computed: "asSpecified",
  12909. order: "orderOfAppearance",
  12910. status: "nonstandard",
  12911. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-origin"
  12912. },
  12913. "-webkit-mask-position": {
  12914. syntax: "<position>#",
  12915. media: "visual",
  12916. inherited: false,
  12917. animationType: "discrete",
  12918. percentages: "referToSizeOfElement",
  12919. groups: [
  12920. "WebKit Extensions"
  12921. ],
  12922. initial: "0% 0%",
  12923. appliesto: "allElements",
  12924. computed: "absoluteLengthOrPercentage",
  12925. order: "orderOfAppearance",
  12926. status: "nonstandard",
  12927. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-position"
  12928. },
  12929. "-webkit-mask-position-x": {
  12930. syntax: "[ <length-percentage> | left | center | right ]#",
  12931. media: "visual",
  12932. inherited: false,
  12933. animationType: "discrete",
  12934. percentages: "referToSizeOfElement",
  12935. groups: [
  12936. "WebKit Extensions"
  12937. ],
  12938. initial: "0%",
  12939. appliesto: "allElements",
  12940. computed: "absoluteLengthOrPercentage",
  12941. order: "orderOfAppearance",
  12942. status: "nonstandard",
  12943. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-position-x"
  12944. },
  12945. "-webkit-mask-position-y": {
  12946. syntax: "[ <length-percentage> | top | center | bottom ]#",
  12947. media: "visual",
  12948. inherited: false,
  12949. animationType: "discrete",
  12950. percentages: "referToSizeOfElement",
  12951. groups: [
  12952. "WebKit Extensions"
  12953. ],
  12954. initial: "0%",
  12955. appliesto: "allElements",
  12956. computed: "absoluteLengthOrPercentage",
  12957. order: "orderOfAppearance",
  12958. status: "nonstandard",
  12959. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-position-y"
  12960. },
  12961. "-webkit-mask-repeat": {
  12962. syntax: "<repeat-style>#",
  12963. media: "visual",
  12964. inherited: false,
  12965. animationType: "discrete",
  12966. percentages: "no",
  12967. groups: [
  12968. "WebKit Extensions"
  12969. ],
  12970. initial: "repeat",
  12971. appliesto: "allElements",
  12972. computed: "asSpecified",
  12973. order: "orderOfAppearance",
  12974. status: "nonstandard",
  12975. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-repeat"
  12976. },
  12977. "-webkit-mask-repeat-x": {
  12978. syntax: "repeat | no-repeat | space | round",
  12979. media: "visual",
  12980. inherited: false,
  12981. animationType: "discrete",
  12982. percentages: "no",
  12983. groups: [
  12984. "WebKit Extensions"
  12985. ],
  12986. initial: "repeat",
  12987. appliesto: "allElements",
  12988. computed: "asSpecified",
  12989. order: "orderOfAppearance",
  12990. status: "nonstandard",
  12991. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-repeat-x"
  12992. },
  12993. "-webkit-mask-repeat-y": {
  12994. syntax: "repeat | no-repeat | space | round",
  12995. media: "visual",
  12996. inherited: false,
  12997. animationType: "discrete",
  12998. percentages: "no",
  12999. groups: [
  13000. "WebKit Extensions"
  13001. ],
  13002. initial: "repeat",
  13003. appliesto: "allElements",
  13004. computed: "absoluteLengthOrPercentage",
  13005. order: "orderOfAppearance",
  13006. status: "nonstandard",
  13007. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-repeat-y"
  13008. },
  13009. "-webkit-mask-size": {
  13010. syntax: "<bg-size>#",
  13011. media: "visual",
  13012. inherited: false,
  13013. animationType: "discrete",
  13014. percentages: "relativeToBackgroundPositioningArea",
  13015. groups: [
  13016. "WebKit Extensions"
  13017. ],
  13018. initial: "auto auto",
  13019. appliesto: "allElements",
  13020. computed: "asSpecified",
  13021. order: "orderOfAppearance",
  13022. status: "nonstandard",
  13023. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-size"
  13024. },
  13025. "-webkit-overflow-scrolling": {
  13026. syntax: "auto | touch",
  13027. media: "visual",
  13028. inherited: true,
  13029. animationType: "discrete",
  13030. percentages: "no",
  13031. groups: [
  13032. "WebKit Extensions"
  13033. ],
  13034. initial: "auto",
  13035. appliesto: "scrollingBoxes",
  13036. computed: "asSpecified",
  13037. order: "orderOfAppearance",
  13038. status: "nonstandard",
  13039. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-overflow-scrolling"
  13040. },
  13041. "-webkit-tap-highlight-color": {
  13042. syntax: "<color>",
  13043. media: "visual",
  13044. inherited: false,
  13045. animationType: "discrete",
  13046. percentages: "no",
  13047. groups: [
  13048. "WebKit Extensions"
  13049. ],
  13050. initial: "black",
  13051. appliesto: "allElements",
  13052. computed: "asSpecified",
  13053. order: "uniqueOrder",
  13054. status: "nonstandard",
  13055. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-tap-highlight-color"
  13056. },
  13057. "-webkit-text-fill-color": {
  13058. syntax: "<color>",
  13059. media: "visual",
  13060. inherited: true,
  13061. animationType: "color",
  13062. percentages: "no",
  13063. groups: [
  13064. "WebKit Extensions"
  13065. ],
  13066. initial: "currentcolor",
  13067. appliesto: "allElements",
  13068. computed: "computedColor",
  13069. order: "uniqueOrder",
  13070. status: "nonstandard",
  13071. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-fill-color"
  13072. },
  13073. "-webkit-text-stroke": {
  13074. syntax: "<length> || <color>",
  13075. media: "visual",
  13076. inherited: true,
  13077. animationType: [
  13078. "-webkit-text-stroke-width",
  13079. "-webkit-text-stroke-color"
  13080. ],
  13081. percentages: "no",
  13082. groups: [
  13083. "WebKit Extensions"
  13084. ],
  13085. initial: [
  13086. "-webkit-text-stroke-width",
  13087. "-webkit-text-stroke-color"
  13088. ],
  13089. appliesto: "allElements",
  13090. computed: [
  13091. "-webkit-text-stroke-width",
  13092. "-webkit-text-stroke-color"
  13093. ],
  13094. order: "canonicalOrder",
  13095. status: "nonstandard",
  13096. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke"
  13097. },
  13098. "-webkit-text-stroke-color": {
  13099. syntax: "<color>",
  13100. media: "visual",
  13101. inherited: true,
  13102. animationType: "color",
  13103. percentages: "no",
  13104. groups: [
  13105. "WebKit Extensions"
  13106. ],
  13107. initial: "currentcolor",
  13108. appliesto: "allElements",
  13109. computed: "computedColor",
  13110. order: "uniqueOrder",
  13111. status: "nonstandard",
  13112. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke-color"
  13113. },
  13114. "-webkit-text-stroke-width": {
  13115. syntax: "<length>",
  13116. media: "visual",
  13117. inherited: true,
  13118. animationType: "discrete",
  13119. percentages: "no",
  13120. groups: [
  13121. "WebKit Extensions"
  13122. ],
  13123. initial: "0",
  13124. appliesto: "allElements",
  13125. computed: "absoluteLength",
  13126. order: "uniqueOrder",
  13127. status: "nonstandard",
  13128. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke-width"
  13129. },
  13130. "-webkit-touch-callout": {
  13131. syntax: "default | none",
  13132. media: "visual",
  13133. inherited: true,
  13134. animationType: "discrete",
  13135. percentages: "no",
  13136. groups: [
  13137. "WebKit Extensions"
  13138. ],
  13139. initial: "default",
  13140. appliesto: "allElements",
  13141. computed: "asSpecified",
  13142. order: "uniqueOrder",
  13143. status: "nonstandard",
  13144. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-touch-callout"
  13145. },
  13146. "-webkit-user-modify": {
  13147. syntax: "read-only | read-write | read-write-plaintext-only",
  13148. media: "interactive",
  13149. inherited: true,
  13150. animationType: "discrete",
  13151. percentages: "no",
  13152. groups: [
  13153. "WebKit Extensions"
  13154. ],
  13155. initial: "read-only",
  13156. appliesto: "allElements",
  13157. computed: "asSpecified",
  13158. order: "uniqueOrder",
  13159. status: "nonstandard"
  13160. },
  13161. "align-content": {
  13162. syntax: "normal | <baseline-position> | <content-distribution> | <overflow-position>? <content-position>",
  13163. media: "visual",
  13164. inherited: false,
  13165. animationType: "discrete",
  13166. percentages: "no",
  13167. groups: [
  13168. "CSS Box Alignment"
  13169. ],
  13170. initial: "normal",
  13171. appliesto: "multilineFlexContainers",
  13172. computed: "asSpecified",
  13173. order: "uniqueOrder",
  13174. status: "standard",
  13175. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/align-content"
  13176. },
  13177. "align-items": {
  13178. syntax: "normal | stretch | <baseline-position> | [ <overflow-position>? <self-position> ]",
  13179. media: "visual",
  13180. inherited: false,
  13181. animationType: "discrete",
  13182. percentages: "no",
  13183. groups: [
  13184. "CSS Box Alignment"
  13185. ],
  13186. initial: "normal",
  13187. appliesto: "allElements",
  13188. computed: "asSpecified",
  13189. order: "uniqueOrder",
  13190. status: "standard",
  13191. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/align-items"
  13192. },
  13193. "align-self": {
  13194. syntax: "auto | normal | stretch | <baseline-position> | <overflow-position>? <self-position>",
  13195. media: "visual",
  13196. inherited: false,
  13197. animationType: "discrete",
  13198. percentages: "no",
  13199. groups: [
  13200. "CSS Box Alignment"
  13201. ],
  13202. initial: "auto",
  13203. appliesto: "flexItemsGridItemsAndAbsolutelyPositionedBoxes",
  13204. computed: "autoOnAbsolutelyPositionedElementsValueOfAlignItemsOnParent",
  13205. order: "uniqueOrder",
  13206. status: "standard",
  13207. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/align-self"
  13208. },
  13209. "align-tracks": {
  13210. syntax: "[ normal | <baseline-position> | <content-distribution> | <overflow-position>? <content-position> ]#",
  13211. media: "visual",
  13212. inherited: false,
  13213. animationType: "discrete",
  13214. percentages: "no",
  13215. groups: [
  13216. "CSS Grid Layout"
  13217. ],
  13218. initial: "normal",
  13219. appliesto: "gridContainersWithMasonryLayoutInTheirBlockAxis",
  13220. computed: "asSpecified",
  13221. order: "uniqueOrder",
  13222. status: "experimental",
  13223. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/align-tracks"
  13224. },
  13225. all: all,
  13226. animation: animation,
  13227. "animation-delay": {
  13228. syntax: "<time>#",
  13229. media: "visual",
  13230. inherited: false,
  13231. animationType: "discrete",
  13232. percentages: "no",
  13233. groups: [
  13234. "CSS Animations"
  13235. ],
  13236. initial: "0s",
  13237. appliesto: "allElementsAndPseudos",
  13238. computed: "asSpecified",
  13239. order: "uniqueOrder",
  13240. status: "standard",
  13241. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-delay"
  13242. },
  13243. "animation-direction": {
  13244. syntax: "<single-animation-direction>#",
  13245. media: "visual",
  13246. inherited: false,
  13247. animationType: "discrete",
  13248. percentages: "no",
  13249. groups: [
  13250. "CSS Animations"
  13251. ],
  13252. initial: "normal",
  13253. appliesto: "allElementsAndPseudos",
  13254. computed: "asSpecified",
  13255. order: "uniqueOrder",
  13256. status: "standard",
  13257. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-direction"
  13258. },
  13259. "animation-duration": {
  13260. syntax: "<time>#",
  13261. media: "visual",
  13262. inherited: false,
  13263. animationType: "discrete",
  13264. percentages: "no",
  13265. groups: [
  13266. "CSS Animations"
  13267. ],
  13268. initial: "0s",
  13269. appliesto: "allElementsAndPseudos",
  13270. computed: "asSpecified",
  13271. order: "uniqueOrder",
  13272. status: "standard",
  13273. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-duration"
  13274. },
  13275. "animation-fill-mode": {
  13276. syntax: "<single-animation-fill-mode>#",
  13277. media: "visual",
  13278. inherited: false,
  13279. animationType: "discrete",
  13280. percentages: "no",
  13281. groups: [
  13282. "CSS Animations"
  13283. ],
  13284. initial: "none",
  13285. appliesto: "allElementsAndPseudos",
  13286. computed: "asSpecified",
  13287. order: "uniqueOrder",
  13288. status: "standard",
  13289. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-fill-mode"
  13290. },
  13291. "animation-iteration-count": {
  13292. syntax: "<single-animation-iteration-count>#",
  13293. media: "visual",
  13294. inherited: false,
  13295. animationType: "discrete",
  13296. percentages: "no",
  13297. groups: [
  13298. "CSS Animations"
  13299. ],
  13300. initial: "1",
  13301. appliesto: "allElementsAndPseudos",
  13302. computed: "asSpecified",
  13303. order: "uniqueOrder",
  13304. status: "standard",
  13305. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-iteration-count"
  13306. },
  13307. "animation-name": {
  13308. syntax: "[ none | <keyframes-name> ]#",
  13309. media: "visual",
  13310. inherited: false,
  13311. animationType: "discrete",
  13312. percentages: "no",
  13313. groups: [
  13314. "CSS Animations"
  13315. ],
  13316. initial: "none",
  13317. appliesto: "allElementsAndPseudos",
  13318. computed: "asSpecified",
  13319. order: "uniqueOrder",
  13320. status: "standard",
  13321. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-name"
  13322. },
  13323. "animation-play-state": {
  13324. syntax: "<single-animation-play-state>#",
  13325. media: "visual",
  13326. inherited: false,
  13327. animationType: "discrete",
  13328. percentages: "no",
  13329. groups: [
  13330. "CSS Animations"
  13331. ],
  13332. initial: "running",
  13333. appliesto: "allElementsAndPseudos",
  13334. computed: "asSpecified",
  13335. order: "uniqueOrder",
  13336. status: "standard",
  13337. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-play-state"
  13338. },
  13339. "animation-timing-function": {
  13340. syntax: "<timing-function>#",
  13341. media: "visual",
  13342. inherited: false,
  13343. animationType: "discrete",
  13344. percentages: "no",
  13345. groups: [
  13346. "CSS Animations"
  13347. ],
  13348. initial: "ease",
  13349. appliesto: "allElementsAndPseudos",
  13350. computed: "asSpecified",
  13351. order: "uniqueOrder",
  13352. status: "standard",
  13353. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-timing-function"
  13354. },
  13355. appearance: appearance,
  13356. "aspect-ratio": {
  13357. syntax: "auto | <ratio>",
  13358. media: "all",
  13359. inherited: false,
  13360. animationType: "discrete",
  13361. percentages: "no",
  13362. groups: [
  13363. "CSS Basic User Interface"
  13364. ],
  13365. initial: "auto",
  13366. appliesto: "allElementsExceptInlineBoxesAndInternalRubyOrTableBoxes",
  13367. computed: "asSpecified",
  13368. order: "perGrammar",
  13369. status: "experimental",
  13370. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/aspect-ratio"
  13371. },
  13372. azimuth: azimuth,
  13373. "backdrop-filter": {
  13374. syntax: "none | <filter-function-list>",
  13375. media: "visual",
  13376. inherited: false,
  13377. animationType: "filterList",
  13378. percentages: "no",
  13379. groups: [
  13380. "Filter Effects"
  13381. ],
  13382. initial: "none",
  13383. appliesto: "allElementsSVGContainerElements",
  13384. computed: "asSpecified",
  13385. order: "uniqueOrder",
  13386. status: "standard",
  13387. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/backdrop-filter"
  13388. },
  13389. "backface-visibility": {
  13390. syntax: "visible | hidden",
  13391. media: "visual",
  13392. inherited: false,
  13393. animationType: "discrete",
  13394. percentages: "no",
  13395. groups: [
  13396. "CSS Transforms"
  13397. ],
  13398. initial: "visible",
  13399. appliesto: "transformableElements",
  13400. computed: "asSpecified",
  13401. order: "uniqueOrder",
  13402. status: "standard",
  13403. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/backface-visibility"
  13404. },
  13405. background: background,
  13406. "background-attachment": {
  13407. syntax: "<attachment>#",
  13408. media: "visual",
  13409. inherited: false,
  13410. animationType: "discrete",
  13411. percentages: "no",
  13412. groups: [
  13413. "CSS Backgrounds and Borders"
  13414. ],
  13415. initial: "scroll",
  13416. appliesto: "allElements",
  13417. computed: "asSpecified",
  13418. order: "uniqueOrder",
  13419. alsoAppliesTo: [
  13420. "::first-letter",
  13421. "::first-line",
  13422. "::placeholder"
  13423. ],
  13424. status: "standard",
  13425. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-attachment"
  13426. },
  13427. "background-blend-mode": {
  13428. syntax: "<blend-mode>#",
  13429. media: "none",
  13430. inherited: false,
  13431. animationType: "discrete",
  13432. percentages: "no",
  13433. groups: [
  13434. "Compositing and Blending"
  13435. ],
  13436. initial: "normal",
  13437. appliesto: "allElementsSVGContainerGraphicsAndGraphicsReferencingElements",
  13438. computed: "asSpecified",
  13439. order: "uniqueOrder",
  13440. alsoAppliesTo: [
  13441. "::first-letter",
  13442. "::first-line",
  13443. "::placeholder"
  13444. ],
  13445. status: "standard",
  13446. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-blend-mode"
  13447. },
  13448. "background-clip": {
  13449. syntax: "<box>#",
  13450. media: "visual",
  13451. inherited: false,
  13452. animationType: "discrete",
  13453. percentages: "no",
  13454. groups: [
  13455. "CSS Backgrounds and Borders"
  13456. ],
  13457. initial: "border-box",
  13458. appliesto: "allElements",
  13459. computed: "asSpecified",
  13460. order: "uniqueOrder",
  13461. alsoAppliesTo: [
  13462. "::first-letter",
  13463. "::first-line",
  13464. "::placeholder"
  13465. ],
  13466. status: "standard",
  13467. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-clip"
  13468. },
  13469. "background-color": {
  13470. syntax: "<color>",
  13471. media: "visual",
  13472. inherited: false,
  13473. animationType: "color",
  13474. percentages: "no",
  13475. groups: [
  13476. "CSS Backgrounds and Borders"
  13477. ],
  13478. initial: "transparent",
  13479. appliesto: "allElements",
  13480. computed: "computedColor",
  13481. order: "uniqueOrder",
  13482. alsoAppliesTo: [
  13483. "::first-letter",
  13484. "::first-line",
  13485. "::placeholder"
  13486. ],
  13487. status: "standard",
  13488. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-color"
  13489. },
  13490. "background-image": {
  13491. syntax: "<bg-image>#",
  13492. media: "visual",
  13493. inherited: false,
  13494. animationType: "discrete",
  13495. percentages: "no",
  13496. groups: [
  13497. "CSS Backgrounds and Borders"
  13498. ],
  13499. initial: "none",
  13500. appliesto: "allElements",
  13501. computed: "asSpecifiedURLsAbsolute",
  13502. order: "uniqueOrder",
  13503. alsoAppliesTo: [
  13504. "::first-letter",
  13505. "::first-line",
  13506. "::placeholder"
  13507. ],
  13508. status: "standard",
  13509. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-image"
  13510. },
  13511. "background-origin": {
  13512. syntax: "<box>#",
  13513. media: "visual",
  13514. inherited: false,
  13515. animationType: "discrete",
  13516. percentages: "no",
  13517. groups: [
  13518. "CSS Backgrounds and Borders"
  13519. ],
  13520. initial: "padding-box",
  13521. appliesto: "allElements",
  13522. computed: "asSpecified",
  13523. order: "uniqueOrder",
  13524. alsoAppliesTo: [
  13525. "::first-letter",
  13526. "::first-line",
  13527. "::placeholder"
  13528. ],
  13529. status: "standard",
  13530. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-origin"
  13531. },
  13532. "background-position": {
  13533. syntax: "<bg-position>#",
  13534. media: "visual",
  13535. inherited: false,
  13536. animationType: "repeatableListOfSimpleListOfLpc",
  13537. percentages: "referToSizeOfBackgroundPositioningAreaMinusBackgroundImageSize",
  13538. groups: [
  13539. "CSS Backgrounds and Borders"
  13540. ],
  13541. initial: "0% 0%",
  13542. appliesto: "allElements",
  13543. computed: "listEachItemTwoKeywordsOriginOffsets",
  13544. order: "uniqueOrder",
  13545. alsoAppliesTo: [
  13546. "::first-letter",
  13547. "::first-line",
  13548. "::placeholder"
  13549. ],
  13550. status: "standard",
  13551. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-position"
  13552. },
  13553. "background-position-x": {
  13554. syntax: "[ center | [ [ left | right | x-start | x-end ]? <length-percentage>? ]! ]#",
  13555. media: "visual",
  13556. inherited: false,
  13557. animationType: "discrete",
  13558. percentages: "referToWidthOfBackgroundPositioningAreaMinusBackgroundImageHeight",
  13559. groups: [
  13560. "CSS Backgrounds and Borders"
  13561. ],
  13562. initial: "left",
  13563. appliesto: "allElements",
  13564. computed: "listEachItemConsistingOfAbsoluteLengthPercentageAndOrigin",
  13565. order: "uniqueOrder",
  13566. status: "experimental",
  13567. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-position-x"
  13568. },
  13569. "background-position-y": {
  13570. syntax: "[ center | [ [ top | bottom | y-start | y-end ]? <length-percentage>? ]! ]#",
  13571. media: "visual",
  13572. inherited: false,
  13573. animationType: "discrete",
  13574. percentages: "referToHeightOfBackgroundPositioningAreaMinusBackgroundImageHeight",
  13575. groups: [
  13576. "CSS Backgrounds and Borders"
  13577. ],
  13578. initial: "top",
  13579. appliesto: "allElements",
  13580. computed: "listEachItemConsistingOfAbsoluteLengthPercentageAndOrigin",
  13581. order: "uniqueOrder",
  13582. status: "experimental",
  13583. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-position-y"
  13584. },
  13585. "background-repeat": {
  13586. syntax: "<repeat-style>#",
  13587. media: "visual",
  13588. inherited: false,
  13589. animationType: "discrete",
  13590. percentages: "no",
  13591. groups: [
  13592. "CSS Backgrounds and Borders"
  13593. ],
  13594. initial: "repeat",
  13595. appliesto: "allElements",
  13596. computed: "listEachItemHasTwoKeywordsOnePerDimension",
  13597. order: "uniqueOrder",
  13598. alsoAppliesTo: [
  13599. "::first-letter",
  13600. "::first-line",
  13601. "::placeholder"
  13602. ],
  13603. status: "standard",
  13604. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-repeat"
  13605. },
  13606. "background-size": {
  13607. syntax: "<bg-size>#",
  13608. media: "visual",
  13609. inherited: false,
  13610. animationType: "repeatableListOfSimpleListOfLpc",
  13611. percentages: "relativeToBackgroundPositioningArea",
  13612. groups: [
  13613. "CSS Backgrounds and Borders"
  13614. ],
  13615. initial: "auto auto",
  13616. appliesto: "allElements",
  13617. computed: "asSpecifiedRelativeToAbsoluteLengths",
  13618. order: "uniqueOrder",
  13619. alsoAppliesTo: [
  13620. "::first-letter",
  13621. "::first-line",
  13622. "::placeholder"
  13623. ],
  13624. status: "standard",
  13625. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-size"
  13626. },
  13627. "block-overflow": {
  13628. syntax: "clip | ellipsis | <string>",
  13629. media: "visual",
  13630. inherited: true,
  13631. animationType: "discrete",
  13632. percentages: "no",
  13633. groups: [
  13634. "CSS Overflow"
  13635. ],
  13636. initial: "clip",
  13637. appliesto: "blockContainers",
  13638. computed: "asSpecified",
  13639. order: "perGrammar",
  13640. status: "experimental"
  13641. },
  13642. "block-size": {
  13643. syntax: "<'width'>",
  13644. media: "visual",
  13645. inherited: false,
  13646. animationType: "lpc",
  13647. percentages: "blockSizeOfContainingBlock",
  13648. groups: [
  13649. "CSS Logical Properties"
  13650. ],
  13651. initial: "auto",
  13652. appliesto: "sameAsWidthAndHeight",
  13653. computed: "sameAsWidthAndHeight",
  13654. order: "uniqueOrder",
  13655. status: "standard",
  13656. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/block-size"
  13657. },
  13658. border: border,
  13659. "border-block": {
  13660. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  13661. media: "visual",
  13662. inherited: false,
  13663. animationType: "discrete",
  13664. percentages: "no",
  13665. groups: [
  13666. "CSS Logical Properties"
  13667. ],
  13668. initial: [
  13669. "border-top-width",
  13670. "border-top-style",
  13671. "border-top-color"
  13672. ],
  13673. appliesto: "allElements",
  13674. computed: [
  13675. "border-top-width",
  13676. "border-top-style",
  13677. "border-top-color"
  13678. ],
  13679. order: "uniqueOrder",
  13680. status: "standard",
  13681. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block"
  13682. },
  13683. "border-block-color": {
  13684. syntax: "<'border-top-color'>{1,2}",
  13685. media: "visual",
  13686. inherited: false,
  13687. animationType: "discrete",
  13688. percentages: "no",
  13689. groups: [
  13690. "CSS Logical Properties"
  13691. ],
  13692. initial: "currentcolor",
  13693. appliesto: "allElements",
  13694. computed: "computedColor",
  13695. order: "uniqueOrder",
  13696. status: "standard",
  13697. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-color"
  13698. },
  13699. "border-block-style": {
  13700. syntax: "<'border-top-style'>",
  13701. media: "visual",
  13702. inherited: false,
  13703. animationType: "discrete",
  13704. percentages: "no",
  13705. groups: [
  13706. "CSS Logical Properties"
  13707. ],
  13708. initial: "none",
  13709. appliesto: "allElements",
  13710. computed: "asSpecified",
  13711. order: "uniqueOrder",
  13712. status: "standard",
  13713. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-style"
  13714. },
  13715. "border-block-width": {
  13716. syntax: "<'border-top-width'>",
  13717. media: "visual",
  13718. inherited: false,
  13719. animationType: "discrete",
  13720. percentages: "logicalWidthOfContainingBlock",
  13721. groups: [
  13722. "CSS Logical Properties"
  13723. ],
  13724. initial: "medium",
  13725. appliesto: "allElements",
  13726. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  13727. order: "uniqueOrder",
  13728. status: "standard",
  13729. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-width"
  13730. },
  13731. "border-block-end": {
  13732. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  13733. media: "visual",
  13734. inherited: false,
  13735. animationType: [
  13736. "border-block-end-color",
  13737. "border-block-end-style",
  13738. "border-block-end-width"
  13739. ],
  13740. percentages: "no",
  13741. groups: [
  13742. "CSS Logical Properties"
  13743. ],
  13744. initial: [
  13745. "border-top-width",
  13746. "border-top-style",
  13747. "border-top-color"
  13748. ],
  13749. appliesto: "allElements",
  13750. computed: [
  13751. "border-top-width",
  13752. "border-top-style",
  13753. "border-top-color"
  13754. ],
  13755. order: "uniqueOrder",
  13756. status: "standard",
  13757. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-end"
  13758. },
  13759. "border-block-end-color": {
  13760. syntax: "<'border-top-color'>",
  13761. media: "visual",
  13762. inherited: false,
  13763. animationType: "color",
  13764. percentages: "no",
  13765. groups: [
  13766. "CSS Logical Properties"
  13767. ],
  13768. initial: "currentcolor",
  13769. appliesto: "allElements",
  13770. computed: "computedColor",
  13771. order: "uniqueOrder",
  13772. status: "standard",
  13773. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-end-color"
  13774. },
  13775. "border-block-end-style": {
  13776. syntax: "<'border-top-style'>",
  13777. media: "visual",
  13778. inherited: false,
  13779. animationType: "discrete",
  13780. percentages: "no",
  13781. groups: [
  13782. "CSS Logical Properties"
  13783. ],
  13784. initial: "none",
  13785. appliesto: "allElements",
  13786. computed: "asSpecified",
  13787. order: "uniqueOrder",
  13788. status: "standard",
  13789. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-end-style"
  13790. },
  13791. "border-block-end-width": {
  13792. syntax: "<'border-top-width'>",
  13793. media: "visual",
  13794. inherited: false,
  13795. animationType: "length",
  13796. percentages: "logicalWidthOfContainingBlock",
  13797. groups: [
  13798. "CSS Logical Properties"
  13799. ],
  13800. initial: "medium",
  13801. appliesto: "allElements",
  13802. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  13803. order: "uniqueOrder",
  13804. status: "standard",
  13805. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-end-width"
  13806. },
  13807. "border-block-start": {
  13808. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  13809. media: "visual",
  13810. inherited: false,
  13811. animationType: [
  13812. "border-block-start-color",
  13813. "border-block-start-style",
  13814. "border-block-start-width"
  13815. ],
  13816. percentages: "no",
  13817. groups: [
  13818. "CSS Logical Properties"
  13819. ],
  13820. initial: [
  13821. "border-width",
  13822. "border-style",
  13823. "color"
  13824. ],
  13825. appliesto: "allElements",
  13826. computed: [
  13827. "border-width",
  13828. "border-style",
  13829. "border-block-start-color"
  13830. ],
  13831. order: "uniqueOrder",
  13832. status: "standard",
  13833. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-start"
  13834. },
  13835. "border-block-start-color": {
  13836. syntax: "<'border-top-color'>",
  13837. media: "visual",
  13838. inherited: false,
  13839. animationType: "color",
  13840. percentages: "no",
  13841. groups: [
  13842. "CSS Logical Properties"
  13843. ],
  13844. initial: "currentcolor",
  13845. appliesto: "allElements",
  13846. computed: "computedColor",
  13847. order: "uniqueOrder",
  13848. status: "standard",
  13849. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-start-color"
  13850. },
  13851. "border-block-start-style": {
  13852. syntax: "<'border-top-style'>",
  13853. media: "visual",
  13854. inherited: false,
  13855. animationType: "discrete",
  13856. percentages: "no",
  13857. groups: [
  13858. "CSS Logical Properties"
  13859. ],
  13860. initial: "none",
  13861. appliesto: "allElements",
  13862. computed: "asSpecified",
  13863. order: "uniqueOrder",
  13864. status: "standard",
  13865. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-start-style"
  13866. },
  13867. "border-block-start-width": {
  13868. syntax: "<'border-top-width'>",
  13869. media: "visual",
  13870. inherited: false,
  13871. animationType: "length",
  13872. percentages: "logicalWidthOfContainingBlock",
  13873. groups: [
  13874. "CSS Logical Properties"
  13875. ],
  13876. initial: "medium",
  13877. appliesto: "allElements",
  13878. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  13879. order: "uniqueOrder",
  13880. status: "standard",
  13881. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-start-width"
  13882. },
  13883. "border-bottom": {
  13884. syntax: "<line-width> || <line-style> || <color>",
  13885. media: "visual",
  13886. inherited: false,
  13887. animationType: [
  13888. "border-bottom-color",
  13889. "border-bottom-style",
  13890. "border-bottom-width"
  13891. ],
  13892. percentages: "no",
  13893. groups: [
  13894. "CSS Backgrounds and Borders"
  13895. ],
  13896. initial: [
  13897. "border-bottom-width",
  13898. "border-bottom-style",
  13899. "border-bottom-color"
  13900. ],
  13901. appliesto: "allElements",
  13902. computed: [
  13903. "border-bottom-width",
  13904. "border-bottom-style",
  13905. "border-bottom-color"
  13906. ],
  13907. order: "orderOfAppearance",
  13908. alsoAppliesTo: [
  13909. "::first-letter"
  13910. ],
  13911. status: "standard",
  13912. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom"
  13913. },
  13914. "border-bottom-color": {
  13915. syntax: "<'border-top-color'>",
  13916. media: "visual",
  13917. inherited: false,
  13918. animationType: "color",
  13919. percentages: "no",
  13920. groups: [
  13921. "CSS Backgrounds and Borders"
  13922. ],
  13923. initial: "currentcolor",
  13924. appliesto: "allElements",
  13925. computed: "computedColor",
  13926. order: "uniqueOrder",
  13927. alsoAppliesTo: [
  13928. "::first-letter"
  13929. ],
  13930. status: "standard",
  13931. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-color"
  13932. },
  13933. "border-bottom-left-radius": {
  13934. syntax: "<length-percentage>{1,2}",
  13935. media: "visual",
  13936. inherited: false,
  13937. animationType: "lpc",
  13938. percentages: "referToDimensionOfBorderBox",
  13939. groups: [
  13940. "CSS Backgrounds and Borders"
  13941. ],
  13942. initial: "0",
  13943. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  13944. computed: "twoAbsoluteLengthOrPercentages",
  13945. order: "uniqueOrder",
  13946. alsoAppliesTo: [
  13947. "::first-letter"
  13948. ],
  13949. status: "standard",
  13950. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-left-radius"
  13951. },
  13952. "border-bottom-right-radius": {
  13953. syntax: "<length-percentage>{1,2}",
  13954. media: "visual",
  13955. inherited: false,
  13956. animationType: "lpc",
  13957. percentages: "referToDimensionOfBorderBox",
  13958. groups: [
  13959. "CSS Backgrounds and Borders"
  13960. ],
  13961. initial: "0",
  13962. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  13963. computed: "twoAbsoluteLengthOrPercentages",
  13964. order: "uniqueOrder",
  13965. alsoAppliesTo: [
  13966. "::first-letter"
  13967. ],
  13968. status: "standard",
  13969. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-right-radius"
  13970. },
  13971. "border-bottom-style": {
  13972. syntax: "<line-style>",
  13973. media: "visual",
  13974. inherited: false,
  13975. animationType: "discrete",
  13976. percentages: "no",
  13977. groups: [
  13978. "CSS Backgrounds and Borders"
  13979. ],
  13980. initial: "none",
  13981. appliesto: "allElements",
  13982. computed: "asSpecified",
  13983. order: "uniqueOrder",
  13984. alsoAppliesTo: [
  13985. "::first-letter"
  13986. ],
  13987. status: "standard",
  13988. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-style"
  13989. },
  13990. "border-bottom-width": {
  13991. syntax: "<line-width>",
  13992. media: "visual",
  13993. inherited: false,
  13994. animationType: "length",
  13995. percentages: "no",
  13996. groups: [
  13997. "CSS Backgrounds and Borders"
  13998. ],
  13999. initial: "medium",
  14000. appliesto: "allElements",
  14001. computed: "absoluteLengthOr0IfBorderBottomStyleNoneOrHidden",
  14002. order: "uniqueOrder",
  14003. alsoAppliesTo: [
  14004. "::first-letter"
  14005. ],
  14006. status: "standard",
  14007. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-width"
  14008. },
  14009. "border-collapse": {
  14010. syntax: "collapse | separate",
  14011. media: "visual",
  14012. inherited: true,
  14013. animationType: "discrete",
  14014. percentages: "no",
  14015. groups: [
  14016. "CSS Table"
  14017. ],
  14018. initial: "separate",
  14019. appliesto: "tableElements",
  14020. computed: "asSpecified",
  14021. order: "uniqueOrder",
  14022. status: "standard",
  14023. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-collapse"
  14024. },
  14025. "border-color": {
  14026. syntax: "<color>{1,4}",
  14027. media: "visual",
  14028. inherited: false,
  14029. animationType: [
  14030. "border-bottom-color",
  14031. "border-left-color",
  14032. "border-right-color",
  14033. "border-top-color"
  14034. ],
  14035. percentages: "no",
  14036. groups: [
  14037. "CSS Backgrounds and Borders"
  14038. ],
  14039. initial: [
  14040. "border-top-color",
  14041. "border-right-color",
  14042. "border-bottom-color",
  14043. "border-left-color"
  14044. ],
  14045. appliesto: "allElements",
  14046. computed: [
  14047. "border-bottom-color",
  14048. "border-left-color",
  14049. "border-right-color",
  14050. "border-top-color"
  14051. ],
  14052. order: "uniqueOrder",
  14053. alsoAppliesTo: [
  14054. "::first-letter"
  14055. ],
  14056. status: "standard",
  14057. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-color"
  14058. },
  14059. "border-end-end-radius": {
  14060. syntax: "<length-percentage>{1,2}",
  14061. media: "visual",
  14062. inherited: false,
  14063. animationType: "lpc",
  14064. percentages: "referToDimensionOfBorderBox",
  14065. groups: [
  14066. "CSS Logical Properties"
  14067. ],
  14068. initial: "0",
  14069. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  14070. computed: "twoAbsoluteLengthOrPercentages",
  14071. order: "uniqueOrder",
  14072. alsoAppliesTo: [
  14073. "::first-letter"
  14074. ],
  14075. status: "standard",
  14076. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-end-end-radius"
  14077. },
  14078. "border-end-start-radius": {
  14079. syntax: "<length-percentage>{1,2}",
  14080. media: "visual",
  14081. inherited: false,
  14082. animationType: "lpc",
  14083. percentages: "referToDimensionOfBorderBox",
  14084. groups: [
  14085. "CSS Logical Properties"
  14086. ],
  14087. initial: "0",
  14088. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  14089. computed: "twoAbsoluteLengthOrPercentages",
  14090. order: "uniqueOrder",
  14091. alsoAppliesTo: [
  14092. "::first-letter"
  14093. ],
  14094. status: "standard",
  14095. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-end-start-radius"
  14096. },
  14097. "border-image": {
  14098. syntax: "<'border-image-source'> || <'border-image-slice'> [ / <'border-image-width'> | / <'border-image-width'>? / <'border-image-outset'> ]? || <'border-image-repeat'>",
  14099. media: "visual",
  14100. inherited: false,
  14101. animationType: "discrete",
  14102. percentages: [
  14103. "border-image-slice",
  14104. "border-image-width"
  14105. ],
  14106. groups: [
  14107. "CSS Backgrounds and Borders"
  14108. ],
  14109. initial: [
  14110. "border-image-source",
  14111. "border-image-slice",
  14112. "border-image-width",
  14113. "border-image-outset",
  14114. "border-image-repeat"
  14115. ],
  14116. appliesto: "allElementsExceptTableElementsWhenCollapse",
  14117. computed: [
  14118. "border-image-outset",
  14119. "border-image-repeat",
  14120. "border-image-slice",
  14121. "border-image-source",
  14122. "border-image-width"
  14123. ],
  14124. order: "uniqueOrder",
  14125. alsoAppliesTo: [
  14126. "::first-letter"
  14127. ],
  14128. status: "standard",
  14129. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image"
  14130. },
  14131. "border-image-outset": {
  14132. syntax: "[ <length> | <number> ]{1,4}",
  14133. media: "visual",
  14134. inherited: false,
  14135. animationType: "byComputedValueType",
  14136. percentages: "no",
  14137. groups: [
  14138. "CSS Backgrounds and Borders"
  14139. ],
  14140. initial: "0",
  14141. appliesto: "allElementsExceptTableElementsWhenCollapse",
  14142. computed: "asSpecifiedRelativeToAbsoluteLengths",
  14143. order: "uniqueOrder",
  14144. alsoAppliesTo: [
  14145. "::first-letter"
  14146. ],
  14147. status: "standard",
  14148. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-outset"
  14149. },
  14150. "border-image-repeat": {
  14151. syntax: "[ stretch | repeat | round | space ]{1,2}",
  14152. media: "visual",
  14153. inherited: false,
  14154. animationType: "discrete",
  14155. percentages: "no",
  14156. groups: [
  14157. "CSS Backgrounds and Borders"
  14158. ],
  14159. initial: "stretch",
  14160. appliesto: "allElementsExceptTableElementsWhenCollapse",
  14161. computed: "asSpecified",
  14162. order: "uniqueOrder",
  14163. alsoAppliesTo: [
  14164. "::first-letter"
  14165. ],
  14166. status: "standard",
  14167. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-repeat"
  14168. },
  14169. "border-image-slice": {
  14170. syntax: "<number-percentage>{1,4} && fill?",
  14171. media: "visual",
  14172. inherited: false,
  14173. animationType: "byComputedValueType",
  14174. percentages: "referToSizeOfBorderImage",
  14175. groups: [
  14176. "CSS Backgrounds and Borders"
  14177. ],
  14178. initial: "100%",
  14179. appliesto: "allElementsExceptTableElementsWhenCollapse",
  14180. computed: "oneToFourPercentagesOrAbsoluteLengthsPlusFill",
  14181. order: "percentagesOrLengthsFollowedByFill",
  14182. alsoAppliesTo: [
  14183. "::first-letter"
  14184. ],
  14185. status: "standard",
  14186. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-slice"
  14187. },
  14188. "border-image-source": {
  14189. syntax: "none | <image>",
  14190. media: "visual",
  14191. inherited: false,
  14192. animationType: "discrete",
  14193. percentages: "no",
  14194. groups: [
  14195. "CSS Backgrounds and Borders"
  14196. ],
  14197. initial: "none",
  14198. appliesto: "allElementsExceptTableElementsWhenCollapse",
  14199. computed: "noneOrImageWithAbsoluteURI",
  14200. order: "uniqueOrder",
  14201. alsoAppliesTo: [
  14202. "::first-letter"
  14203. ],
  14204. status: "standard",
  14205. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-source"
  14206. },
  14207. "border-image-width": {
  14208. syntax: "[ <length-percentage> | <number> | auto ]{1,4}",
  14209. media: "visual",
  14210. inherited: false,
  14211. animationType: "byComputedValueType",
  14212. percentages: "referToWidthOrHeightOfBorderImageArea",
  14213. groups: [
  14214. "CSS Backgrounds and Borders"
  14215. ],
  14216. initial: "1",
  14217. appliesto: "allElementsExceptTableElementsWhenCollapse",
  14218. computed: "asSpecifiedRelativeToAbsoluteLengths",
  14219. order: "uniqueOrder",
  14220. alsoAppliesTo: [
  14221. "::first-letter"
  14222. ],
  14223. status: "standard",
  14224. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-width"
  14225. },
  14226. "border-inline": {
  14227. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  14228. media: "visual",
  14229. inherited: false,
  14230. animationType: "discrete",
  14231. percentages: "no",
  14232. groups: [
  14233. "CSS Logical Properties"
  14234. ],
  14235. initial: [
  14236. "border-top-width",
  14237. "border-top-style",
  14238. "border-top-color"
  14239. ],
  14240. appliesto: "allElements",
  14241. computed: [
  14242. "border-top-width",
  14243. "border-top-style",
  14244. "border-top-color"
  14245. ],
  14246. order: "uniqueOrder",
  14247. status: "standard",
  14248. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline"
  14249. },
  14250. "border-inline-end": {
  14251. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  14252. media: "visual",
  14253. inherited: false,
  14254. animationType: [
  14255. "border-inline-end-color",
  14256. "border-inline-end-style",
  14257. "border-inline-end-width"
  14258. ],
  14259. percentages: "no",
  14260. groups: [
  14261. "CSS Logical Properties"
  14262. ],
  14263. initial: [
  14264. "border-width",
  14265. "border-style",
  14266. "color"
  14267. ],
  14268. appliesto: "allElements",
  14269. computed: [
  14270. "border-width",
  14271. "border-style",
  14272. "border-inline-end-color"
  14273. ],
  14274. order: "uniqueOrder",
  14275. status: "standard",
  14276. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-end"
  14277. },
  14278. "border-inline-color": {
  14279. syntax: "<'border-top-color'>{1,2}",
  14280. media: "visual",
  14281. inherited: false,
  14282. animationType: "discrete",
  14283. percentages: "no",
  14284. groups: [
  14285. "CSS Logical Properties"
  14286. ],
  14287. initial: "currentcolor",
  14288. appliesto: "allElements",
  14289. computed: "computedColor",
  14290. order: "uniqueOrder",
  14291. status: "standard",
  14292. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-color"
  14293. },
  14294. "border-inline-style": {
  14295. syntax: "<'border-top-style'>",
  14296. media: "visual",
  14297. inherited: false,
  14298. animationType: "discrete",
  14299. percentages: "no",
  14300. groups: [
  14301. "CSS Logical Properties"
  14302. ],
  14303. initial: "none",
  14304. appliesto: "allElements",
  14305. computed: "asSpecified",
  14306. order: "uniqueOrder",
  14307. status: "standard",
  14308. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-style"
  14309. },
  14310. "border-inline-width": {
  14311. syntax: "<'border-top-width'>",
  14312. media: "visual",
  14313. inherited: false,
  14314. animationType: "discrete",
  14315. percentages: "logicalWidthOfContainingBlock",
  14316. groups: [
  14317. "CSS Logical Properties"
  14318. ],
  14319. initial: "medium",
  14320. appliesto: "allElements",
  14321. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  14322. order: "uniqueOrder",
  14323. status: "standard",
  14324. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-width"
  14325. },
  14326. "border-inline-end-color": {
  14327. syntax: "<'border-top-color'>",
  14328. media: "visual",
  14329. inherited: false,
  14330. animationType: "color",
  14331. percentages: "no",
  14332. groups: [
  14333. "CSS Logical Properties"
  14334. ],
  14335. initial: "currentcolor",
  14336. appliesto: "allElements",
  14337. computed: "computedColor",
  14338. order: "uniqueOrder",
  14339. status: "standard",
  14340. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-end-color"
  14341. },
  14342. "border-inline-end-style": {
  14343. syntax: "<'border-top-style'>",
  14344. media: "visual",
  14345. inherited: false,
  14346. animationType: "discrete",
  14347. percentages: "no",
  14348. groups: [
  14349. "CSS Logical Properties"
  14350. ],
  14351. initial: "none",
  14352. appliesto: "allElements",
  14353. computed: "asSpecified",
  14354. order: "uniqueOrder",
  14355. status: "standard",
  14356. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-end-style"
  14357. },
  14358. "border-inline-end-width": {
  14359. syntax: "<'border-top-width'>",
  14360. media: "visual",
  14361. inherited: false,
  14362. animationType: "length",
  14363. percentages: "logicalWidthOfContainingBlock",
  14364. groups: [
  14365. "CSS Logical Properties"
  14366. ],
  14367. initial: "medium",
  14368. appliesto: "allElements",
  14369. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  14370. order: "uniqueOrder",
  14371. status: "standard",
  14372. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-end-width"
  14373. },
  14374. "border-inline-start": {
  14375. syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
  14376. media: "visual",
  14377. inherited: false,
  14378. animationType: [
  14379. "border-inline-start-color",
  14380. "border-inline-start-style",
  14381. "border-inline-start-width"
  14382. ],
  14383. percentages: "no",
  14384. groups: [
  14385. "CSS Logical Properties"
  14386. ],
  14387. initial: [
  14388. "border-width",
  14389. "border-style",
  14390. "color"
  14391. ],
  14392. appliesto: "allElements",
  14393. computed: [
  14394. "border-width",
  14395. "border-style",
  14396. "border-inline-start-color"
  14397. ],
  14398. order: "uniqueOrder",
  14399. status: "standard",
  14400. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-start"
  14401. },
  14402. "border-inline-start-color": {
  14403. syntax: "<'border-top-color'>",
  14404. media: "visual",
  14405. inherited: false,
  14406. animationType: "color",
  14407. percentages: "no",
  14408. groups: [
  14409. "CSS Logical Properties"
  14410. ],
  14411. initial: "currentcolor",
  14412. appliesto: "allElements",
  14413. computed: "computedColor",
  14414. order: "uniqueOrder",
  14415. status: "standard",
  14416. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-start-color"
  14417. },
  14418. "border-inline-start-style": {
  14419. syntax: "<'border-top-style'>",
  14420. media: "visual",
  14421. inherited: false,
  14422. animationType: "discrete",
  14423. percentages: "no",
  14424. groups: [
  14425. "CSS Logical Properties"
  14426. ],
  14427. initial: "none",
  14428. appliesto: "allElements",
  14429. computed: "asSpecified",
  14430. order: "uniqueOrder",
  14431. status: "standard",
  14432. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-start-style"
  14433. },
  14434. "border-inline-start-width": {
  14435. syntax: "<'border-top-width'>",
  14436. media: "visual",
  14437. inherited: false,
  14438. animationType: "length",
  14439. percentages: "logicalWidthOfContainingBlock",
  14440. groups: [
  14441. "CSS Logical Properties"
  14442. ],
  14443. initial: "medium",
  14444. appliesto: "allElements",
  14445. computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
  14446. order: "uniqueOrder",
  14447. status: "standard",
  14448. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-start-width"
  14449. },
  14450. "border-left": {
  14451. syntax: "<line-width> || <line-style> || <color>",
  14452. media: "visual",
  14453. inherited: false,
  14454. animationType: [
  14455. "border-left-color",
  14456. "border-left-style",
  14457. "border-left-width"
  14458. ],
  14459. percentages: "no",
  14460. groups: [
  14461. "CSS Backgrounds and Borders"
  14462. ],
  14463. initial: [
  14464. "border-left-width",
  14465. "border-left-style",
  14466. "border-left-color"
  14467. ],
  14468. appliesto: "allElements",
  14469. computed: [
  14470. "border-left-width",
  14471. "border-left-style",
  14472. "border-left-color"
  14473. ],
  14474. order: "orderOfAppearance",
  14475. alsoAppliesTo: [
  14476. "::first-letter"
  14477. ],
  14478. status: "standard",
  14479. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-left"
  14480. },
  14481. "border-left-color": {
  14482. syntax: "<color>",
  14483. media: "visual",
  14484. inherited: false,
  14485. animationType: "color",
  14486. percentages: "no",
  14487. groups: [
  14488. "CSS Backgrounds and Borders"
  14489. ],
  14490. initial: "currentcolor",
  14491. appliesto: "allElements",
  14492. computed: "computedColor",
  14493. order: "uniqueOrder",
  14494. alsoAppliesTo: [
  14495. "::first-letter"
  14496. ],
  14497. status: "standard",
  14498. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-left-color"
  14499. },
  14500. "border-left-style": {
  14501. syntax: "<line-style>",
  14502. media: "visual",
  14503. inherited: false,
  14504. animationType: "discrete",
  14505. percentages: "no",
  14506. groups: [
  14507. "CSS Backgrounds and Borders"
  14508. ],
  14509. initial: "none",
  14510. appliesto: "allElements",
  14511. computed: "asSpecified",
  14512. order: "uniqueOrder",
  14513. alsoAppliesTo: [
  14514. "::first-letter"
  14515. ],
  14516. status: "standard",
  14517. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-left-style"
  14518. },
  14519. "border-left-width": {
  14520. syntax: "<line-width>",
  14521. media: "visual",
  14522. inherited: false,
  14523. animationType: "length",
  14524. percentages: "no",
  14525. groups: [
  14526. "CSS Backgrounds and Borders"
  14527. ],
  14528. initial: "medium",
  14529. appliesto: "allElements",
  14530. computed: "absoluteLengthOr0IfBorderLeftStyleNoneOrHidden",
  14531. order: "uniqueOrder",
  14532. alsoAppliesTo: [
  14533. "::first-letter"
  14534. ],
  14535. status: "standard",
  14536. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-left-width"
  14537. },
  14538. "border-radius": {
  14539. syntax: "<length-percentage>{1,4} [ / <length-percentage>{1,4} ]?",
  14540. media: "visual",
  14541. inherited: false,
  14542. animationType: [
  14543. "border-top-left-radius",
  14544. "border-top-right-radius",
  14545. "border-bottom-right-radius",
  14546. "border-bottom-left-radius"
  14547. ],
  14548. percentages: "referToDimensionOfBorderBox",
  14549. groups: [
  14550. "CSS Backgrounds and Borders"
  14551. ],
  14552. initial: [
  14553. "border-top-left-radius",
  14554. "border-top-right-radius",
  14555. "border-bottom-right-radius",
  14556. "border-bottom-left-radius"
  14557. ],
  14558. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  14559. computed: [
  14560. "border-bottom-left-radius",
  14561. "border-bottom-right-radius",
  14562. "border-top-left-radius",
  14563. "border-top-right-radius"
  14564. ],
  14565. order: "uniqueOrder",
  14566. alsoAppliesTo: [
  14567. "::first-letter"
  14568. ],
  14569. status: "standard",
  14570. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-radius"
  14571. },
  14572. "border-right": {
  14573. syntax: "<line-width> || <line-style> || <color>",
  14574. media: "visual",
  14575. inherited: false,
  14576. animationType: [
  14577. "border-right-color",
  14578. "border-right-style",
  14579. "border-right-width"
  14580. ],
  14581. percentages: "no",
  14582. groups: [
  14583. "CSS Backgrounds and Borders"
  14584. ],
  14585. initial: [
  14586. "border-right-width",
  14587. "border-right-style",
  14588. "border-right-color"
  14589. ],
  14590. appliesto: "allElements",
  14591. computed: [
  14592. "border-right-width",
  14593. "border-right-style",
  14594. "border-right-color"
  14595. ],
  14596. order: "orderOfAppearance",
  14597. alsoAppliesTo: [
  14598. "::first-letter"
  14599. ],
  14600. status: "standard",
  14601. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-right"
  14602. },
  14603. "border-right-color": {
  14604. syntax: "<color>",
  14605. media: "visual",
  14606. inherited: false,
  14607. animationType: "color",
  14608. percentages: "no",
  14609. groups: [
  14610. "CSS Backgrounds and Borders"
  14611. ],
  14612. initial: "currentcolor",
  14613. appliesto: "allElements",
  14614. computed: "computedColor",
  14615. order: "uniqueOrder",
  14616. alsoAppliesTo: [
  14617. "::first-letter"
  14618. ],
  14619. status: "standard",
  14620. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-right-color"
  14621. },
  14622. "border-right-style": {
  14623. syntax: "<line-style>",
  14624. media: "visual",
  14625. inherited: false,
  14626. animationType: "discrete",
  14627. percentages: "no",
  14628. groups: [
  14629. "CSS Backgrounds and Borders"
  14630. ],
  14631. initial: "none",
  14632. appliesto: "allElements",
  14633. computed: "asSpecified",
  14634. order: "uniqueOrder",
  14635. alsoAppliesTo: [
  14636. "::first-letter"
  14637. ],
  14638. status: "standard",
  14639. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-right-style"
  14640. },
  14641. "border-right-width": {
  14642. syntax: "<line-width>",
  14643. media: "visual",
  14644. inherited: false,
  14645. animationType: "length",
  14646. percentages: "no",
  14647. groups: [
  14648. "CSS Backgrounds and Borders"
  14649. ],
  14650. initial: "medium",
  14651. appliesto: "allElements",
  14652. computed: "absoluteLengthOr0IfBorderRightStyleNoneOrHidden",
  14653. order: "uniqueOrder",
  14654. alsoAppliesTo: [
  14655. "::first-letter"
  14656. ],
  14657. status: "standard",
  14658. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-right-width"
  14659. },
  14660. "border-spacing": {
  14661. syntax: "<length> <length>?",
  14662. media: "visual",
  14663. inherited: true,
  14664. animationType: "discrete",
  14665. percentages: "no",
  14666. groups: [
  14667. "CSS Table"
  14668. ],
  14669. initial: "0",
  14670. appliesto: "tableElements",
  14671. computed: "twoAbsoluteLengths",
  14672. order: "uniqueOrder",
  14673. status: "standard",
  14674. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-spacing"
  14675. },
  14676. "border-start-end-radius": {
  14677. syntax: "<length-percentage>{1,2}",
  14678. media: "visual",
  14679. inherited: false,
  14680. animationType: "lpc",
  14681. percentages: "referToDimensionOfBorderBox",
  14682. groups: [
  14683. "CSS Logical Properties"
  14684. ],
  14685. initial: "0",
  14686. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  14687. computed: "twoAbsoluteLengthOrPercentages",
  14688. order: "uniqueOrder",
  14689. alsoAppliesTo: [
  14690. "::first-letter"
  14691. ],
  14692. status: "standard",
  14693. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-start-end-radius"
  14694. },
  14695. "border-start-start-radius": {
  14696. syntax: "<length-percentage>{1,2}",
  14697. media: "visual",
  14698. inherited: false,
  14699. animationType: "lpc",
  14700. percentages: "referToDimensionOfBorderBox",
  14701. groups: [
  14702. "CSS Logical Properties"
  14703. ],
  14704. initial: "0",
  14705. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  14706. computed: "twoAbsoluteLengthOrPercentages",
  14707. order: "uniqueOrder",
  14708. alsoAppliesTo: [
  14709. "::first-letter"
  14710. ],
  14711. status: "standard",
  14712. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-start-start-radius"
  14713. },
  14714. "border-style": {
  14715. syntax: "<line-style>{1,4}",
  14716. media: "visual",
  14717. inherited: false,
  14718. animationType: "discrete",
  14719. percentages: "no",
  14720. groups: [
  14721. "CSS Backgrounds and Borders"
  14722. ],
  14723. initial: [
  14724. "border-top-style",
  14725. "border-right-style",
  14726. "border-bottom-style",
  14727. "border-left-style"
  14728. ],
  14729. appliesto: "allElements",
  14730. computed: [
  14731. "border-bottom-style",
  14732. "border-left-style",
  14733. "border-right-style",
  14734. "border-top-style"
  14735. ],
  14736. order: "uniqueOrder",
  14737. alsoAppliesTo: [
  14738. "::first-letter"
  14739. ],
  14740. status: "standard",
  14741. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-style"
  14742. },
  14743. "border-top": {
  14744. syntax: "<line-width> || <line-style> || <color>",
  14745. media: "visual",
  14746. inherited: false,
  14747. animationType: [
  14748. "border-top-color",
  14749. "border-top-style",
  14750. "border-top-width"
  14751. ],
  14752. percentages: "no",
  14753. groups: [
  14754. "CSS Backgrounds and Borders"
  14755. ],
  14756. initial: [
  14757. "border-top-width",
  14758. "border-top-style",
  14759. "border-top-color"
  14760. ],
  14761. appliesto: "allElements",
  14762. computed: [
  14763. "border-top-width",
  14764. "border-top-style",
  14765. "border-top-color"
  14766. ],
  14767. order: "orderOfAppearance",
  14768. alsoAppliesTo: [
  14769. "::first-letter"
  14770. ],
  14771. status: "standard",
  14772. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top"
  14773. },
  14774. "border-top-color": {
  14775. syntax: "<color>",
  14776. media: "visual",
  14777. inherited: false,
  14778. animationType: "color",
  14779. percentages: "no",
  14780. groups: [
  14781. "CSS Backgrounds and Borders"
  14782. ],
  14783. initial: "currentcolor",
  14784. appliesto: "allElements",
  14785. computed: "computedColor",
  14786. order: "uniqueOrder",
  14787. alsoAppliesTo: [
  14788. "::first-letter"
  14789. ],
  14790. status: "standard",
  14791. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-color"
  14792. },
  14793. "border-top-left-radius": {
  14794. syntax: "<length-percentage>{1,2}",
  14795. media: "visual",
  14796. inherited: false,
  14797. animationType: "lpc",
  14798. percentages: "referToDimensionOfBorderBox",
  14799. groups: [
  14800. "CSS Backgrounds and Borders"
  14801. ],
  14802. initial: "0",
  14803. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  14804. computed: "twoAbsoluteLengthOrPercentages",
  14805. order: "uniqueOrder",
  14806. alsoAppliesTo: [
  14807. "::first-letter"
  14808. ],
  14809. status: "standard",
  14810. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-left-radius"
  14811. },
  14812. "border-top-right-radius": {
  14813. syntax: "<length-percentage>{1,2}",
  14814. media: "visual",
  14815. inherited: false,
  14816. animationType: "lpc",
  14817. percentages: "referToDimensionOfBorderBox",
  14818. groups: [
  14819. "CSS Backgrounds and Borders"
  14820. ],
  14821. initial: "0",
  14822. appliesto: "allElementsUAsNotRequiredWhenCollapse",
  14823. computed: "twoAbsoluteLengthOrPercentages",
  14824. order: "uniqueOrder",
  14825. alsoAppliesTo: [
  14826. "::first-letter"
  14827. ],
  14828. status: "standard",
  14829. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-right-radius"
  14830. },
  14831. "border-top-style": {
  14832. syntax: "<line-style>",
  14833. media: "visual",
  14834. inherited: false,
  14835. animationType: "discrete",
  14836. percentages: "no",
  14837. groups: [
  14838. "CSS Backgrounds and Borders"
  14839. ],
  14840. initial: "none",
  14841. appliesto: "allElements",
  14842. computed: "asSpecified",
  14843. order: "uniqueOrder",
  14844. alsoAppliesTo: [
  14845. "::first-letter"
  14846. ],
  14847. status: "standard",
  14848. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-style"
  14849. },
  14850. "border-top-width": {
  14851. syntax: "<line-width>",
  14852. media: "visual",
  14853. inherited: false,
  14854. animationType: "length",
  14855. percentages: "no",
  14856. groups: [
  14857. "CSS Backgrounds and Borders"
  14858. ],
  14859. initial: "medium",
  14860. appliesto: "allElements",
  14861. computed: "absoluteLengthOr0IfBorderTopStyleNoneOrHidden",
  14862. order: "uniqueOrder",
  14863. alsoAppliesTo: [
  14864. "::first-letter"
  14865. ],
  14866. status: "standard",
  14867. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-width"
  14868. },
  14869. "border-width": {
  14870. syntax: "<line-width>{1,4}",
  14871. media: "visual",
  14872. inherited: false,
  14873. animationType: [
  14874. "border-bottom-width",
  14875. "border-left-width",
  14876. "border-right-width",
  14877. "border-top-width"
  14878. ],
  14879. percentages: "no",
  14880. groups: [
  14881. "CSS Backgrounds and Borders"
  14882. ],
  14883. initial: [
  14884. "border-top-width",
  14885. "border-right-width",
  14886. "border-bottom-width",
  14887. "border-left-width"
  14888. ],
  14889. appliesto: "allElements",
  14890. computed: [
  14891. "border-bottom-width",
  14892. "border-left-width",
  14893. "border-right-width",
  14894. "border-top-width"
  14895. ],
  14896. order: "uniqueOrder",
  14897. alsoAppliesTo: [
  14898. "::first-letter"
  14899. ],
  14900. status: "standard",
  14901. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-width"
  14902. },
  14903. bottom: bottom,
  14904. "box-align": {
  14905. syntax: "start | center | end | baseline | stretch",
  14906. media: "visual",
  14907. inherited: false,
  14908. animationType: "discrete",
  14909. percentages: "no",
  14910. groups: [
  14911. "Mozilla Extensions",
  14912. "WebKit Extensions"
  14913. ],
  14914. initial: "stretch",
  14915. appliesto: "elementsWithDisplayBoxOrInlineBox",
  14916. computed: "asSpecified",
  14917. order: "uniqueOrder",
  14918. status: "nonstandard",
  14919. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-align"
  14920. },
  14921. "box-decoration-break": {
  14922. syntax: "slice | clone",
  14923. media: "visual",
  14924. inherited: false,
  14925. animationType: "discrete",
  14926. percentages: "no",
  14927. groups: [
  14928. "CSS Fragmentation"
  14929. ],
  14930. initial: "slice",
  14931. appliesto: "allElements",
  14932. computed: "asSpecified",
  14933. order: "uniqueOrder",
  14934. status: "standard",
  14935. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-decoration-break"
  14936. },
  14937. "box-direction": {
  14938. syntax: "normal | reverse | inherit",
  14939. media: "visual",
  14940. inherited: false,
  14941. animationType: "discrete",
  14942. percentages: "no",
  14943. groups: [
  14944. "Mozilla Extensions",
  14945. "WebKit Extensions"
  14946. ],
  14947. initial: "normal",
  14948. appliesto: "elementsWithDisplayBoxOrInlineBox",
  14949. computed: "asSpecified",
  14950. order: "uniqueOrder",
  14951. status: "nonstandard",
  14952. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-direction"
  14953. },
  14954. "box-flex": {
  14955. syntax: "<number>",
  14956. media: "visual",
  14957. inherited: false,
  14958. animationType: "discrete",
  14959. percentages: "no",
  14960. groups: [
  14961. "Mozilla Extensions",
  14962. "WebKit Extensions"
  14963. ],
  14964. initial: "0",
  14965. appliesto: "directChildrenOfElementsWithDisplayMozBoxMozInlineBox",
  14966. computed: "asSpecified",
  14967. order: "uniqueOrder",
  14968. status: "nonstandard",
  14969. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-flex"
  14970. },
  14971. "box-flex-group": {
  14972. syntax: "<integer>",
  14973. media: "visual",
  14974. inherited: false,
  14975. animationType: "discrete",
  14976. percentages: "no",
  14977. groups: [
  14978. "Mozilla Extensions",
  14979. "WebKit Extensions"
  14980. ],
  14981. initial: "1",
  14982. appliesto: "inFlowChildrenOfBoxElements",
  14983. computed: "asSpecified",
  14984. order: "uniqueOrder",
  14985. status: "nonstandard",
  14986. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-flex-group"
  14987. },
  14988. "box-lines": {
  14989. syntax: "single | multiple",
  14990. media: "visual",
  14991. inherited: false,
  14992. animationType: "discrete",
  14993. percentages: "no",
  14994. groups: [
  14995. "Mozilla Extensions",
  14996. "WebKit Extensions"
  14997. ],
  14998. initial: "single",
  14999. appliesto: "boxElements",
  15000. computed: "asSpecified",
  15001. order: "uniqueOrder",
  15002. status: "nonstandard",
  15003. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-lines"
  15004. },
  15005. "box-ordinal-group": {
  15006. syntax: "<integer>",
  15007. media: "visual",
  15008. inherited: false,
  15009. animationType: "discrete",
  15010. percentages: "no",
  15011. groups: [
  15012. "Mozilla Extensions",
  15013. "WebKit Extensions"
  15014. ],
  15015. initial: "1",
  15016. appliesto: "childrenOfBoxElements",
  15017. computed: "asSpecified",
  15018. order: "uniqueOrder",
  15019. status: "nonstandard",
  15020. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-ordinal-group"
  15021. },
  15022. "box-orient": {
  15023. syntax: "horizontal | vertical | inline-axis | block-axis | inherit",
  15024. media: "visual",
  15025. inherited: false,
  15026. animationType: "discrete",
  15027. percentages: "no",
  15028. groups: [
  15029. "Mozilla Extensions",
  15030. "WebKit Extensions"
  15031. ],
  15032. initial: "inlineAxisHorizontalInXUL",
  15033. appliesto: "elementsWithDisplayBoxOrInlineBox",
  15034. computed: "asSpecified",
  15035. order: "uniqueOrder",
  15036. status: "nonstandard",
  15037. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-orient"
  15038. },
  15039. "box-pack": {
  15040. syntax: "start | center | end | justify",
  15041. media: "visual",
  15042. inherited: false,
  15043. animationType: "discrete",
  15044. percentages: "no",
  15045. groups: [
  15046. "Mozilla Extensions",
  15047. "WebKit Extensions"
  15048. ],
  15049. initial: "start",
  15050. appliesto: "elementsWithDisplayMozBoxMozInlineBox",
  15051. computed: "asSpecified",
  15052. order: "uniqueOrder",
  15053. status: "nonstandard",
  15054. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-pack"
  15055. },
  15056. "box-shadow": {
  15057. syntax: "none | <shadow>#",
  15058. media: "visual",
  15059. inherited: false,
  15060. animationType: "shadowList",
  15061. percentages: "no",
  15062. groups: [
  15063. "CSS Backgrounds and Borders"
  15064. ],
  15065. initial: "none",
  15066. appliesto: "allElements",
  15067. computed: "absoluteLengthsSpecifiedColorAsSpecified",
  15068. order: "uniqueOrder",
  15069. alsoAppliesTo: [
  15070. "::first-letter"
  15071. ],
  15072. status: "standard",
  15073. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-shadow"
  15074. },
  15075. "box-sizing": {
  15076. syntax: "content-box | border-box",
  15077. media: "visual",
  15078. inherited: false,
  15079. animationType: "discrete",
  15080. percentages: "no",
  15081. groups: [
  15082. "CSS Basic User Interface"
  15083. ],
  15084. initial: "content-box",
  15085. appliesto: "allElementsAcceptingWidthOrHeight",
  15086. computed: "asSpecified",
  15087. order: "uniqueOrder",
  15088. status: "standard",
  15089. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-sizing"
  15090. },
  15091. "break-after": {
  15092. syntax: "auto | avoid | always | all | avoid-page | page | left | right | recto | verso | avoid-column | column | avoid-region | region",
  15093. media: "visual",
  15094. inherited: false,
  15095. animationType: "discrete",
  15096. percentages: "no",
  15097. groups: [
  15098. "CSS Fragmentation"
  15099. ],
  15100. initial: "auto",
  15101. appliesto: "blockLevelElements",
  15102. computed: "asSpecified",
  15103. order: "uniqueOrder",
  15104. status: "standard",
  15105. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/break-after"
  15106. },
  15107. "break-before": {
  15108. syntax: "auto | avoid | always | all | avoid-page | page | left | right | recto | verso | avoid-column | column | avoid-region | region",
  15109. media: "visual",
  15110. inherited: false,
  15111. animationType: "discrete",
  15112. percentages: "no",
  15113. groups: [
  15114. "CSS Fragmentation"
  15115. ],
  15116. initial: "auto",
  15117. appliesto: "blockLevelElements",
  15118. computed: "asSpecified",
  15119. order: "uniqueOrder",
  15120. status: "standard",
  15121. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/break-before"
  15122. },
  15123. "break-inside": {
  15124. syntax: "auto | avoid | avoid-page | avoid-column | avoid-region",
  15125. media: "visual",
  15126. inherited: false,
  15127. animationType: "discrete",
  15128. percentages: "no",
  15129. groups: [
  15130. "CSS Fragmentation"
  15131. ],
  15132. initial: "auto",
  15133. appliesto: "blockLevelElements",
  15134. computed: "asSpecified",
  15135. order: "uniqueOrder",
  15136. status: "standard",
  15137. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/break-inside"
  15138. },
  15139. "caption-side": {
  15140. syntax: "top | bottom | block-start | block-end | inline-start | inline-end",
  15141. media: "visual",
  15142. inherited: true,
  15143. animationType: "discrete",
  15144. percentages: "no",
  15145. groups: [
  15146. "CSS Table"
  15147. ],
  15148. initial: "top",
  15149. appliesto: "tableCaptionElements",
  15150. computed: "asSpecified",
  15151. order: "uniqueOrder",
  15152. status: "standard",
  15153. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/caption-side"
  15154. },
  15155. "caret-color": {
  15156. syntax: "auto | <color>",
  15157. media: "interactive",
  15158. inherited: true,
  15159. animationType: "color",
  15160. percentages: "no",
  15161. groups: [
  15162. "CSS Basic User Interface"
  15163. ],
  15164. initial: "auto",
  15165. appliesto: "allElements",
  15166. computed: "asAutoOrColor",
  15167. order: "perGrammar",
  15168. status: "standard",
  15169. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/caret-color"
  15170. },
  15171. clear: clear,
  15172. clip: clip,
  15173. "clip-path": {
  15174. syntax: "<clip-source> | [ <basic-shape> || <geometry-box> ] | none",
  15175. media: "visual",
  15176. inherited: false,
  15177. animationType: "basicShapeOtherwiseNo",
  15178. percentages: "referToReferenceBoxWhenSpecifiedOtherwiseBorderBox",
  15179. groups: [
  15180. "CSS Masking"
  15181. ],
  15182. initial: "none",
  15183. appliesto: "allElementsSVGContainerElements",
  15184. computed: "asSpecifiedURLsAbsolute",
  15185. order: "uniqueOrder",
  15186. status: "standard",
  15187. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/clip-path"
  15188. },
  15189. color: color$1,
  15190. "color-adjust": {
  15191. syntax: "economy | exact",
  15192. media: "visual",
  15193. inherited: true,
  15194. animationType: "discrete",
  15195. percentages: "no",
  15196. groups: [
  15197. "CSS Color"
  15198. ],
  15199. initial: "economy",
  15200. appliesto: "allElements",
  15201. computed: "asSpecified",
  15202. order: "perGrammar",
  15203. status: "standard",
  15204. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/color-adjust"
  15205. },
  15206. "column-count": {
  15207. syntax: "<integer> | auto",
  15208. media: "visual",
  15209. inherited: false,
  15210. animationType: "integer",
  15211. percentages: "no",
  15212. groups: [
  15213. "CSS Columns"
  15214. ],
  15215. initial: "auto",
  15216. appliesto: "blockContainersExceptTableWrappers",
  15217. computed: "asSpecified",
  15218. order: "perGrammar",
  15219. status: "standard",
  15220. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-count"
  15221. },
  15222. "column-fill": {
  15223. syntax: "auto | balance | balance-all",
  15224. media: "visualInContinuousMediaNoEffectInOverflowColumns",
  15225. inherited: false,
  15226. animationType: "discrete",
  15227. percentages: "no",
  15228. groups: [
  15229. "CSS Columns"
  15230. ],
  15231. initial: "balance",
  15232. appliesto: "multicolElements",
  15233. computed: "asSpecified",
  15234. order: "perGrammar",
  15235. status: "standard",
  15236. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-fill"
  15237. },
  15238. "column-gap": {
  15239. syntax: "normal | <length-percentage>",
  15240. media: "visual",
  15241. inherited: false,
  15242. animationType: "lpc",
  15243. percentages: "referToDimensionOfContentArea",
  15244. groups: [
  15245. "CSS Box Alignment"
  15246. ],
  15247. initial: "normal",
  15248. appliesto: "multiColumnElementsFlexContainersGridContainers",
  15249. computed: "asSpecifiedWithLengthsAbsoluteAndNormalComputingToZeroExceptMultiColumn",
  15250. order: "perGrammar",
  15251. status: "standard",
  15252. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-gap"
  15253. },
  15254. "column-rule": {
  15255. syntax: "<'column-rule-width'> || <'column-rule-style'> || <'column-rule-color'>",
  15256. media: "visual",
  15257. inherited: false,
  15258. animationType: [
  15259. "column-rule-color",
  15260. "column-rule-style",
  15261. "column-rule-width"
  15262. ],
  15263. percentages: "no",
  15264. groups: [
  15265. "CSS Columns"
  15266. ],
  15267. initial: [
  15268. "column-rule-width",
  15269. "column-rule-style",
  15270. "column-rule-color"
  15271. ],
  15272. appliesto: "multicolElements",
  15273. computed: [
  15274. "column-rule-color",
  15275. "column-rule-style",
  15276. "column-rule-width"
  15277. ],
  15278. order: "perGrammar",
  15279. status: "standard",
  15280. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-rule"
  15281. },
  15282. "column-rule-color": {
  15283. syntax: "<color>",
  15284. media: "visual",
  15285. inherited: false,
  15286. animationType: "color",
  15287. percentages: "no",
  15288. groups: [
  15289. "CSS Columns"
  15290. ],
  15291. initial: "currentcolor",
  15292. appliesto: "multicolElements",
  15293. computed: "computedColor",
  15294. order: "perGrammar",
  15295. status: "standard",
  15296. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-rule-color"
  15297. },
  15298. "column-rule-style": {
  15299. syntax: "<'border-style'>",
  15300. media: "visual",
  15301. inherited: false,
  15302. animationType: "discrete",
  15303. percentages: "no",
  15304. groups: [
  15305. "CSS Columns"
  15306. ],
  15307. initial: "none",
  15308. appliesto: "multicolElements",
  15309. computed: "asSpecified",
  15310. order: "perGrammar",
  15311. status: "standard",
  15312. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-rule-style"
  15313. },
  15314. "column-rule-width": {
  15315. syntax: "<'border-width'>",
  15316. media: "visual",
  15317. inherited: false,
  15318. animationType: "length",
  15319. percentages: "no",
  15320. groups: [
  15321. "CSS Columns"
  15322. ],
  15323. initial: "medium",
  15324. appliesto: "multicolElements",
  15325. computed: "absoluteLength0IfColumnRuleStyleNoneOrHidden",
  15326. order: "perGrammar",
  15327. status: "standard",
  15328. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-rule-width"
  15329. },
  15330. "column-span": {
  15331. syntax: "none | all",
  15332. media: "visual",
  15333. inherited: false,
  15334. animationType: "discrete",
  15335. percentages: "no",
  15336. groups: [
  15337. "CSS Columns"
  15338. ],
  15339. initial: "none",
  15340. appliesto: "inFlowBlockLevelElements",
  15341. computed: "asSpecified",
  15342. order: "perGrammar",
  15343. status: "standard",
  15344. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-span"
  15345. },
  15346. "column-width": {
  15347. syntax: "<length> | auto",
  15348. media: "visual",
  15349. inherited: false,
  15350. animationType: "length",
  15351. percentages: "no",
  15352. groups: [
  15353. "CSS Columns"
  15354. ],
  15355. initial: "auto",
  15356. appliesto: "blockContainersExceptTableWrappers",
  15357. computed: "absoluteLengthZeroOrLarger",
  15358. order: "perGrammar",
  15359. status: "standard",
  15360. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-width"
  15361. },
  15362. columns: columns,
  15363. contain: contain,
  15364. content: content,
  15365. "counter-increment": {
  15366. syntax: "[ <custom-ident> <integer>? ]+ | none",
  15367. media: "all",
  15368. inherited: false,
  15369. animationType: "discrete",
  15370. percentages: "no",
  15371. groups: [
  15372. "CSS Counter Styles"
  15373. ],
  15374. initial: "none",
  15375. appliesto: "allElements",
  15376. computed: "asSpecified",
  15377. order: "uniqueOrder",
  15378. status: "standard",
  15379. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/counter-increment"
  15380. },
  15381. "counter-reset": {
  15382. syntax: "[ <custom-ident> <integer>? ]+ | none",
  15383. media: "all",
  15384. inherited: false,
  15385. animationType: "discrete",
  15386. percentages: "no",
  15387. groups: [
  15388. "CSS Counter Styles"
  15389. ],
  15390. initial: "none",
  15391. appliesto: "allElements",
  15392. computed: "asSpecified",
  15393. order: "uniqueOrder",
  15394. status: "standard",
  15395. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/counter-reset"
  15396. },
  15397. "counter-set": {
  15398. syntax: "[ <custom-ident> <integer>? ]+ | none",
  15399. media: "all",
  15400. inherited: false,
  15401. animationType: "discrete",
  15402. percentages: "no",
  15403. groups: [
  15404. "CSS Counter Styles"
  15405. ],
  15406. initial: "none",
  15407. appliesto: "allElements",
  15408. computed: "asSpecified",
  15409. order: "uniqueOrder",
  15410. status: "standard",
  15411. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/counter-set"
  15412. },
  15413. cursor: cursor,
  15414. direction: direction,
  15415. display: display,
  15416. "empty-cells": {
  15417. syntax: "show | hide",
  15418. media: "visual",
  15419. inherited: true,
  15420. animationType: "discrete",
  15421. percentages: "no",
  15422. groups: [
  15423. "CSS Table"
  15424. ],
  15425. initial: "show",
  15426. appliesto: "tableCellElements",
  15427. computed: "asSpecified",
  15428. order: "uniqueOrder",
  15429. status: "standard",
  15430. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/empty-cells"
  15431. },
  15432. filter: filter,
  15433. flex: flex,
  15434. "flex-basis": {
  15435. syntax: "content | <'width'>",
  15436. media: "visual",
  15437. inherited: false,
  15438. animationType: "lpc",
  15439. percentages: "referToFlexContainersInnerMainSize",
  15440. groups: [
  15441. "CSS Flexible Box Layout"
  15442. ],
  15443. initial: "auto",
  15444. appliesto: "flexItemsAndInFlowPseudos",
  15445. computed: "asSpecifiedRelativeToAbsoluteLengths",
  15446. order: "lengthOrPercentageBeforeKeywordIfBothPresent",
  15447. status: "standard",
  15448. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-basis"
  15449. },
  15450. "flex-direction": {
  15451. syntax: "row | row-reverse | column | column-reverse",
  15452. media: "visual",
  15453. inherited: false,
  15454. animationType: "discrete",
  15455. percentages: "no",
  15456. groups: [
  15457. "CSS Flexible Box Layout"
  15458. ],
  15459. initial: "row",
  15460. appliesto: "flexContainers",
  15461. computed: "asSpecified",
  15462. order: "uniqueOrder",
  15463. status: "standard",
  15464. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-direction"
  15465. },
  15466. "flex-flow": {
  15467. syntax: "<'flex-direction'> || <'flex-wrap'>",
  15468. media: "visual",
  15469. inherited: false,
  15470. animationType: "discrete",
  15471. percentages: "no",
  15472. groups: [
  15473. "CSS Flexible Box Layout"
  15474. ],
  15475. initial: [
  15476. "flex-direction",
  15477. "flex-wrap"
  15478. ],
  15479. appliesto: "flexContainers",
  15480. computed: [
  15481. "flex-direction",
  15482. "flex-wrap"
  15483. ],
  15484. order: "orderOfAppearance",
  15485. status: "standard",
  15486. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-flow"
  15487. },
  15488. "flex-grow": {
  15489. syntax: "<number>",
  15490. media: "visual",
  15491. inherited: false,
  15492. animationType: "number",
  15493. percentages: "no",
  15494. groups: [
  15495. "CSS Flexible Box Layout"
  15496. ],
  15497. initial: "0",
  15498. appliesto: "flexItemsAndInFlowPseudos",
  15499. computed: "asSpecified",
  15500. order: "uniqueOrder",
  15501. status: "standard",
  15502. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-grow"
  15503. },
  15504. "flex-shrink": {
  15505. syntax: "<number>",
  15506. media: "visual",
  15507. inherited: false,
  15508. animationType: "number",
  15509. percentages: "no",
  15510. groups: [
  15511. "CSS Flexible Box Layout"
  15512. ],
  15513. initial: "1",
  15514. appliesto: "flexItemsAndInFlowPseudos",
  15515. computed: "asSpecified",
  15516. order: "uniqueOrder",
  15517. status: "standard",
  15518. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-shrink"
  15519. },
  15520. "flex-wrap": {
  15521. syntax: "nowrap | wrap | wrap-reverse",
  15522. media: "visual",
  15523. inherited: false,
  15524. animationType: "discrete",
  15525. percentages: "no",
  15526. groups: [
  15527. "CSS Flexible Box Layout"
  15528. ],
  15529. initial: "nowrap",
  15530. appliesto: "flexContainers",
  15531. computed: "asSpecified",
  15532. order: "uniqueOrder",
  15533. status: "standard",
  15534. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-wrap"
  15535. },
  15536. float: float,
  15537. font: font,
  15538. "font-family": {
  15539. syntax: "[ <family-name> | <generic-family> ]#",
  15540. media: "visual",
  15541. inherited: true,
  15542. animationType: "discrete",
  15543. percentages: "no",
  15544. groups: [
  15545. "CSS Fonts"
  15546. ],
  15547. initial: "dependsOnUserAgent",
  15548. appliesto: "allElements",
  15549. computed: "asSpecified",
  15550. order: "uniqueOrder",
  15551. alsoAppliesTo: [
  15552. "::first-letter",
  15553. "::first-line",
  15554. "::placeholder"
  15555. ],
  15556. status: "standard",
  15557. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-family"
  15558. },
  15559. "font-feature-settings": {
  15560. syntax: "normal | <feature-tag-value>#",
  15561. media: "visual",
  15562. inherited: true,
  15563. animationType: "discrete",
  15564. percentages: "no",
  15565. groups: [
  15566. "CSS Fonts"
  15567. ],
  15568. initial: "normal",
  15569. appliesto: "allElements",
  15570. computed: "asSpecified",
  15571. order: "uniqueOrder",
  15572. alsoAppliesTo: [
  15573. "::first-letter",
  15574. "::first-line",
  15575. "::placeholder"
  15576. ],
  15577. status: "standard",
  15578. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-feature-settings"
  15579. },
  15580. "font-kerning": {
  15581. syntax: "auto | normal | none",
  15582. media: "visual",
  15583. inherited: true,
  15584. animationType: "discrete",
  15585. percentages: "no",
  15586. groups: [
  15587. "CSS Fonts"
  15588. ],
  15589. initial: "auto",
  15590. appliesto: "allElements",
  15591. computed: "asSpecified",
  15592. order: "uniqueOrder",
  15593. alsoAppliesTo: [
  15594. "::first-letter",
  15595. "::first-line",
  15596. "::placeholder"
  15597. ],
  15598. status: "standard",
  15599. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-kerning"
  15600. },
  15601. "font-language-override": {
  15602. syntax: "normal | <string>",
  15603. media: "visual",
  15604. inherited: true,
  15605. animationType: "discrete",
  15606. percentages: "no",
  15607. groups: [
  15608. "CSS Fonts"
  15609. ],
  15610. initial: "normal",
  15611. appliesto: "allElements",
  15612. computed: "asSpecified",
  15613. order: "uniqueOrder",
  15614. alsoAppliesTo: [
  15615. "::first-letter",
  15616. "::first-line",
  15617. "::placeholder"
  15618. ],
  15619. status: "standard",
  15620. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-language-override"
  15621. },
  15622. "font-optical-sizing": {
  15623. syntax: "auto | none",
  15624. media: "visual",
  15625. inherited: true,
  15626. animationType: "discrete",
  15627. percentages: "no",
  15628. groups: [
  15629. "CSS Fonts"
  15630. ],
  15631. initial: "auto",
  15632. appliesto: "allElements",
  15633. computed: "asSpecified",
  15634. order: "perGrammar",
  15635. alsoAppliesTo: [
  15636. "::first-letter",
  15637. "::first-line",
  15638. "::placeholder"
  15639. ],
  15640. status: "standard",
  15641. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-optical-sizing"
  15642. },
  15643. "font-variation-settings": {
  15644. syntax: "normal | [ <string> <number> ]#",
  15645. media: "visual",
  15646. inherited: true,
  15647. animationType: "transform",
  15648. percentages: "no",
  15649. groups: [
  15650. "CSS Fonts"
  15651. ],
  15652. initial: "normal",
  15653. appliesto: "allElements",
  15654. computed: "asSpecified",
  15655. order: "perGrammar",
  15656. alsoAppliesTo: [
  15657. "::first-letter",
  15658. "::first-line",
  15659. "::placeholder"
  15660. ],
  15661. status: "standard",
  15662. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variation-settings"
  15663. },
  15664. "font-size": {
  15665. syntax: "<absolute-size> | <relative-size> | <length-percentage>",
  15666. media: "visual",
  15667. inherited: true,
  15668. animationType: "length",
  15669. percentages: "referToParentElementsFontSize",
  15670. groups: [
  15671. "CSS Fonts"
  15672. ],
  15673. initial: "medium",
  15674. appliesto: "allElements",
  15675. computed: "asSpecifiedRelativeToAbsoluteLengths",
  15676. order: "uniqueOrder",
  15677. alsoAppliesTo: [
  15678. "::first-letter",
  15679. "::first-line",
  15680. "::placeholder"
  15681. ],
  15682. status: "standard",
  15683. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-size"
  15684. },
  15685. "font-size-adjust": {
  15686. syntax: "none | <number>",
  15687. media: "visual",
  15688. inherited: true,
  15689. animationType: "number",
  15690. percentages: "no",
  15691. groups: [
  15692. "CSS Fonts"
  15693. ],
  15694. initial: "none",
  15695. appliesto: "allElements",
  15696. computed: "asSpecified",
  15697. order: "uniqueOrder",
  15698. alsoAppliesTo: [
  15699. "::first-letter",
  15700. "::first-line",
  15701. "::placeholder"
  15702. ],
  15703. status: "standard",
  15704. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-size-adjust"
  15705. },
  15706. "font-smooth": {
  15707. syntax: "auto | never | always | <absolute-size> | <length>",
  15708. media: "visual",
  15709. inherited: true,
  15710. animationType: "discrete",
  15711. percentages: "no",
  15712. groups: [
  15713. "CSS Fonts"
  15714. ],
  15715. initial: "auto",
  15716. appliesto: "allElements",
  15717. computed: "asSpecified",
  15718. order: "uniqueOrder",
  15719. status: "nonstandard",
  15720. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-smooth"
  15721. },
  15722. "font-stretch": {
  15723. syntax: "<font-stretch-absolute>",
  15724. media: "visual",
  15725. inherited: true,
  15726. animationType: "fontStretch",
  15727. percentages: "no",
  15728. groups: [
  15729. "CSS Fonts"
  15730. ],
  15731. initial: "normal",
  15732. appliesto: "allElements",
  15733. computed: "asSpecified",
  15734. order: "uniqueOrder",
  15735. alsoAppliesTo: [
  15736. "::first-letter",
  15737. "::first-line",
  15738. "::placeholder"
  15739. ],
  15740. status: "standard",
  15741. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-stretch"
  15742. },
  15743. "font-style": {
  15744. syntax: "normal | italic | oblique <angle>?",
  15745. media: "visual",
  15746. inherited: true,
  15747. animationType: "discrete",
  15748. percentages: "no",
  15749. groups: [
  15750. "CSS Fonts"
  15751. ],
  15752. initial: "normal",
  15753. appliesto: "allElements",
  15754. computed: "asSpecified",
  15755. order: "uniqueOrder",
  15756. alsoAppliesTo: [
  15757. "::first-letter",
  15758. "::first-line",
  15759. "::placeholder"
  15760. ],
  15761. status: "standard",
  15762. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-style"
  15763. },
  15764. "font-synthesis": {
  15765. syntax: "none | [ weight || style ]",
  15766. media: "visual",
  15767. inherited: true,
  15768. animationType: "discrete",
  15769. percentages: "no",
  15770. groups: [
  15771. "CSS Fonts"
  15772. ],
  15773. initial: "weight style",
  15774. appliesto: "allElements",
  15775. computed: "asSpecified",
  15776. order: "orderOfAppearance",
  15777. alsoAppliesTo: [
  15778. "::first-letter",
  15779. "::first-line",
  15780. "::placeholder"
  15781. ],
  15782. status: "standard",
  15783. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-synthesis"
  15784. },
  15785. "font-variant": {
  15786. 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 ]",
  15787. media: "visual",
  15788. inherited: true,
  15789. animationType: "discrete",
  15790. percentages: "no",
  15791. groups: [
  15792. "CSS Fonts"
  15793. ],
  15794. initial: "normal",
  15795. appliesto: "allElements",
  15796. computed: "asSpecified",
  15797. order: "uniqueOrder",
  15798. alsoAppliesTo: [
  15799. "::first-letter",
  15800. "::first-line",
  15801. "::placeholder"
  15802. ],
  15803. status: "standard",
  15804. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant"
  15805. },
  15806. "font-variant-alternates": {
  15807. 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> ) ]",
  15808. media: "visual",
  15809. inherited: true,
  15810. animationType: "discrete",
  15811. percentages: "no",
  15812. groups: [
  15813. "CSS Fonts"
  15814. ],
  15815. initial: "normal",
  15816. appliesto: "allElements",
  15817. computed: "asSpecified",
  15818. order: "orderOfAppearance",
  15819. alsoAppliesTo: [
  15820. "::first-letter",
  15821. "::first-line",
  15822. "::placeholder"
  15823. ],
  15824. status: "standard",
  15825. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-alternates"
  15826. },
  15827. "font-variant-caps": {
  15828. syntax: "normal | small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps",
  15829. media: "visual",
  15830. inherited: true,
  15831. animationType: "discrete",
  15832. percentages: "no",
  15833. groups: [
  15834. "CSS Fonts"
  15835. ],
  15836. initial: "normal",
  15837. appliesto: "allElements",
  15838. computed: "asSpecified",
  15839. order: "uniqueOrder",
  15840. alsoAppliesTo: [
  15841. "::first-letter",
  15842. "::first-line",
  15843. "::placeholder"
  15844. ],
  15845. status: "standard",
  15846. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-caps"
  15847. },
  15848. "font-variant-east-asian": {
  15849. syntax: "normal | [ <east-asian-variant-values> || <east-asian-width-values> || ruby ]",
  15850. media: "visual",
  15851. inherited: true,
  15852. animationType: "discrete",
  15853. percentages: "no",
  15854. groups: [
  15855. "CSS Fonts"
  15856. ],
  15857. initial: "normal",
  15858. appliesto: "allElements",
  15859. computed: "asSpecified",
  15860. order: "orderOfAppearance",
  15861. alsoAppliesTo: [
  15862. "::first-letter",
  15863. "::first-line",
  15864. "::placeholder"
  15865. ],
  15866. status: "standard",
  15867. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-east-asian"
  15868. },
  15869. "font-variant-ligatures": {
  15870. syntax: "normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> ]",
  15871. media: "visual",
  15872. inherited: true,
  15873. animationType: "discrete",
  15874. percentages: "no",
  15875. groups: [
  15876. "CSS Fonts"
  15877. ],
  15878. initial: "normal",
  15879. appliesto: "allElements",
  15880. computed: "asSpecified",
  15881. order: "orderOfAppearance",
  15882. alsoAppliesTo: [
  15883. "::first-letter",
  15884. "::first-line",
  15885. "::placeholder"
  15886. ],
  15887. status: "standard",
  15888. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-ligatures"
  15889. },
  15890. "font-variant-numeric": {
  15891. syntax: "normal | [ <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero ]",
  15892. media: "visual",
  15893. inherited: true,
  15894. animationType: "discrete",
  15895. percentages: "no",
  15896. groups: [
  15897. "CSS Fonts"
  15898. ],
  15899. initial: "normal",
  15900. appliesto: "allElements",
  15901. computed: "asSpecified",
  15902. order: "orderOfAppearance",
  15903. alsoAppliesTo: [
  15904. "::first-letter",
  15905. "::first-line",
  15906. "::placeholder"
  15907. ],
  15908. status: "standard",
  15909. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-numeric"
  15910. },
  15911. "font-variant-position": {
  15912. syntax: "normal | sub | super",
  15913. media: "visual",
  15914. inherited: true,
  15915. animationType: "discrete",
  15916. percentages: "no",
  15917. groups: [
  15918. "CSS Fonts"
  15919. ],
  15920. initial: "normal",
  15921. appliesto: "allElements",
  15922. computed: "asSpecified",
  15923. order: "uniqueOrder",
  15924. alsoAppliesTo: [
  15925. "::first-letter",
  15926. "::first-line",
  15927. "::placeholder"
  15928. ],
  15929. status: "standard",
  15930. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-position"
  15931. },
  15932. "font-weight": {
  15933. syntax: "<font-weight-absolute> | bolder | lighter",
  15934. media: "visual",
  15935. inherited: true,
  15936. animationType: "fontWeight",
  15937. percentages: "no",
  15938. groups: [
  15939. "CSS Fonts"
  15940. ],
  15941. initial: "normal",
  15942. appliesto: "allElements",
  15943. computed: "keywordOrNumericalValueBolderLighterTransformedToRealValue",
  15944. order: "uniqueOrder",
  15945. alsoAppliesTo: [
  15946. "::first-letter",
  15947. "::first-line",
  15948. "::placeholder"
  15949. ],
  15950. status: "standard",
  15951. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-weight"
  15952. },
  15953. gap: gap,
  15954. grid: grid,
  15955. "grid-area": {
  15956. syntax: "<grid-line> [ / <grid-line> ]{0,3}",
  15957. media: "visual",
  15958. inherited: false,
  15959. animationType: "discrete",
  15960. percentages: "no",
  15961. groups: [
  15962. "CSS Grid Layout"
  15963. ],
  15964. initial: [
  15965. "grid-row-start",
  15966. "grid-column-start",
  15967. "grid-row-end",
  15968. "grid-column-end"
  15969. ],
  15970. appliesto: "gridItemsAndBoxesWithinGridContainer",
  15971. computed: [
  15972. "grid-row-start",
  15973. "grid-column-start",
  15974. "grid-row-end",
  15975. "grid-column-end"
  15976. ],
  15977. order: "uniqueOrder",
  15978. status: "standard",
  15979. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-area"
  15980. },
  15981. "grid-auto-columns": {
  15982. syntax: "<track-size>+",
  15983. media: "visual",
  15984. inherited: false,
  15985. animationType: "discrete",
  15986. percentages: "referToDimensionOfContentArea",
  15987. groups: [
  15988. "CSS Grid Layout"
  15989. ],
  15990. initial: "auto",
  15991. appliesto: "gridContainers",
  15992. computed: "percentageAsSpecifiedOrAbsoluteLength",
  15993. order: "uniqueOrder",
  15994. status: "standard",
  15995. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-auto-columns"
  15996. },
  15997. "grid-auto-flow": {
  15998. syntax: "[ row | column ] || dense",
  15999. media: "visual",
  16000. inherited: false,
  16001. animationType: "discrete",
  16002. percentages: "no",
  16003. groups: [
  16004. "CSS Grid Layout"
  16005. ],
  16006. initial: "row",
  16007. appliesto: "gridContainers",
  16008. computed: "asSpecified",
  16009. order: "uniqueOrder",
  16010. status: "standard",
  16011. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-auto-flow"
  16012. },
  16013. "grid-auto-rows": {
  16014. syntax: "<track-size>+",
  16015. media: "visual",
  16016. inherited: false,
  16017. animationType: "discrete",
  16018. percentages: "referToDimensionOfContentArea",
  16019. groups: [
  16020. "CSS Grid Layout"
  16021. ],
  16022. initial: "auto",
  16023. appliesto: "gridContainers",
  16024. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16025. order: "uniqueOrder",
  16026. status: "standard",
  16027. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-auto-rows"
  16028. },
  16029. "grid-column": {
  16030. syntax: "<grid-line> [ / <grid-line> ]?",
  16031. media: "visual",
  16032. inherited: false,
  16033. animationType: "discrete",
  16034. percentages: "no",
  16035. groups: [
  16036. "CSS Grid Layout"
  16037. ],
  16038. initial: [
  16039. "grid-column-start",
  16040. "grid-column-end"
  16041. ],
  16042. appliesto: "gridItemsAndBoxesWithinGridContainer",
  16043. computed: [
  16044. "grid-column-start",
  16045. "grid-column-end"
  16046. ],
  16047. order: "uniqueOrder",
  16048. status: "standard",
  16049. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-column"
  16050. },
  16051. "grid-column-end": {
  16052. syntax: "<grid-line>",
  16053. media: "visual",
  16054. inherited: false,
  16055. animationType: "discrete",
  16056. percentages: "no",
  16057. groups: [
  16058. "CSS Grid Layout"
  16059. ],
  16060. initial: "auto",
  16061. appliesto: "gridItemsAndBoxesWithinGridContainer",
  16062. computed: "asSpecified",
  16063. order: "uniqueOrder",
  16064. status: "standard",
  16065. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-column-end"
  16066. },
  16067. "grid-column-gap": {
  16068. syntax: "<length-percentage>",
  16069. media: "visual",
  16070. inherited: false,
  16071. animationType: "length",
  16072. percentages: "referToDimensionOfContentArea",
  16073. groups: [
  16074. "CSS Grid Layout"
  16075. ],
  16076. initial: "0",
  16077. appliesto: "gridContainers",
  16078. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16079. order: "uniqueOrder",
  16080. status: "obsolete",
  16081. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-gap"
  16082. },
  16083. "grid-column-start": {
  16084. syntax: "<grid-line>",
  16085. media: "visual",
  16086. inherited: false,
  16087. animationType: "discrete",
  16088. percentages: "no",
  16089. groups: [
  16090. "CSS Grid Layout"
  16091. ],
  16092. initial: "auto",
  16093. appliesto: "gridItemsAndBoxesWithinGridContainer",
  16094. computed: "asSpecified",
  16095. order: "uniqueOrder",
  16096. status: "standard",
  16097. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-column-start"
  16098. },
  16099. "grid-gap": {
  16100. syntax: "<'grid-row-gap'> <'grid-column-gap'>?",
  16101. media: "visual",
  16102. inherited: false,
  16103. animationType: [
  16104. "grid-row-gap",
  16105. "grid-column-gap"
  16106. ],
  16107. percentages: "no",
  16108. groups: [
  16109. "CSS Grid Layout"
  16110. ],
  16111. initial: [
  16112. "grid-row-gap",
  16113. "grid-column-gap"
  16114. ],
  16115. appliesto: "gridContainers",
  16116. computed: [
  16117. "grid-row-gap",
  16118. "grid-column-gap"
  16119. ],
  16120. order: "uniqueOrder",
  16121. status: "obsolete",
  16122. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/gap"
  16123. },
  16124. "grid-row": {
  16125. syntax: "<grid-line> [ / <grid-line> ]?",
  16126. media: "visual",
  16127. inherited: false,
  16128. animationType: "discrete",
  16129. percentages: "no",
  16130. groups: [
  16131. "CSS Grid Layout"
  16132. ],
  16133. initial: [
  16134. "grid-row-start",
  16135. "grid-row-end"
  16136. ],
  16137. appliesto: "gridItemsAndBoxesWithinGridContainer",
  16138. computed: [
  16139. "grid-row-start",
  16140. "grid-row-end"
  16141. ],
  16142. order: "uniqueOrder",
  16143. status: "standard",
  16144. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-row"
  16145. },
  16146. "grid-row-end": {
  16147. syntax: "<grid-line>",
  16148. media: "visual",
  16149. inherited: false,
  16150. animationType: "discrete",
  16151. percentages: "no",
  16152. groups: [
  16153. "CSS Grid Layout"
  16154. ],
  16155. initial: "auto",
  16156. appliesto: "gridItemsAndBoxesWithinGridContainer",
  16157. computed: "asSpecified",
  16158. order: "uniqueOrder",
  16159. status: "standard",
  16160. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-row-end"
  16161. },
  16162. "grid-row-gap": {
  16163. syntax: "<length-percentage>",
  16164. media: "visual",
  16165. inherited: false,
  16166. animationType: "length",
  16167. percentages: "referToDimensionOfContentArea",
  16168. groups: [
  16169. "CSS Grid Layout"
  16170. ],
  16171. initial: "0",
  16172. appliesto: "gridContainers",
  16173. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16174. order: "uniqueOrder",
  16175. status: "obsolete",
  16176. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/row-gap"
  16177. },
  16178. "grid-row-start": {
  16179. syntax: "<grid-line>",
  16180. media: "visual",
  16181. inherited: false,
  16182. animationType: "discrete",
  16183. percentages: "no",
  16184. groups: [
  16185. "CSS Grid Layout"
  16186. ],
  16187. initial: "auto",
  16188. appliesto: "gridItemsAndBoxesWithinGridContainer",
  16189. computed: "asSpecified",
  16190. order: "uniqueOrder",
  16191. status: "standard",
  16192. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-row-start"
  16193. },
  16194. "grid-template": {
  16195. syntax: "none | [ <'grid-template-rows'> / <'grid-template-columns'> ] | [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]?",
  16196. media: "visual",
  16197. inherited: false,
  16198. animationType: "discrete",
  16199. percentages: [
  16200. "grid-template-columns",
  16201. "grid-template-rows"
  16202. ],
  16203. groups: [
  16204. "CSS Grid Layout"
  16205. ],
  16206. initial: [
  16207. "grid-template-columns",
  16208. "grid-template-rows",
  16209. "grid-template-areas"
  16210. ],
  16211. appliesto: "gridContainers",
  16212. computed: [
  16213. "grid-template-columns",
  16214. "grid-template-rows",
  16215. "grid-template-areas"
  16216. ],
  16217. order: "uniqueOrder",
  16218. status: "standard",
  16219. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-template"
  16220. },
  16221. "grid-template-areas": {
  16222. syntax: "none | <string>+",
  16223. media: "visual",
  16224. inherited: false,
  16225. animationType: "discrete",
  16226. percentages: "no",
  16227. groups: [
  16228. "CSS Grid Layout"
  16229. ],
  16230. initial: "none",
  16231. appliesto: "gridContainers",
  16232. computed: "asSpecified",
  16233. order: "uniqueOrder",
  16234. status: "standard",
  16235. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-template-areas"
  16236. },
  16237. "grid-template-columns": {
  16238. syntax: "none | <track-list> | <auto-track-list> | subgrid <line-name-list>?",
  16239. media: "visual",
  16240. inherited: false,
  16241. animationType: "simpleListOfLpcDifferenceLpc",
  16242. percentages: "referToDimensionOfContentArea",
  16243. groups: [
  16244. "CSS Grid Layout"
  16245. ],
  16246. initial: "none",
  16247. appliesto: "gridContainers",
  16248. computed: "asSpecifiedRelativeToAbsoluteLengths",
  16249. order: "uniqueOrder",
  16250. status: "standard",
  16251. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-template-columns"
  16252. },
  16253. "grid-template-rows": {
  16254. syntax: "none | <track-list> | <auto-track-list> | subgrid <line-name-list>?",
  16255. media: "visual",
  16256. inherited: false,
  16257. animationType: "simpleListOfLpcDifferenceLpc",
  16258. percentages: "referToDimensionOfContentArea",
  16259. groups: [
  16260. "CSS Grid Layout"
  16261. ],
  16262. initial: "none",
  16263. appliesto: "gridContainers",
  16264. computed: "asSpecifiedRelativeToAbsoluteLengths",
  16265. order: "uniqueOrder",
  16266. status: "standard",
  16267. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-template-rows"
  16268. },
  16269. "hanging-punctuation": {
  16270. syntax: "none | [ first || [ force-end | allow-end ] || last ]",
  16271. media: "visual",
  16272. inherited: true,
  16273. animationType: "discrete",
  16274. percentages: "no",
  16275. groups: [
  16276. "CSS Text"
  16277. ],
  16278. initial: "none",
  16279. appliesto: "allElements",
  16280. computed: "asSpecified",
  16281. order: "uniqueOrder",
  16282. status: "standard",
  16283. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/hanging-punctuation"
  16284. },
  16285. height: height,
  16286. hyphens: hyphens,
  16287. "image-orientation": {
  16288. syntax: "from-image | <angle> | [ <angle>? flip ]",
  16289. media: "visual",
  16290. inherited: true,
  16291. animationType: "discrete",
  16292. percentages: "no",
  16293. groups: [
  16294. "CSS Images"
  16295. ],
  16296. initial: "from-image",
  16297. appliesto: "allElements",
  16298. computed: "angleRoundedToNextQuarter",
  16299. order: "uniqueOrder",
  16300. status: "standard",
  16301. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/image-orientation"
  16302. },
  16303. "image-rendering": {
  16304. syntax: "auto | crisp-edges | pixelated",
  16305. media: "visual",
  16306. inherited: true,
  16307. animationType: "discrete",
  16308. percentages: "no",
  16309. groups: [
  16310. "CSS Images"
  16311. ],
  16312. initial: "auto",
  16313. appliesto: "allElements",
  16314. computed: "asSpecified",
  16315. order: "uniqueOrder",
  16316. status: "standard",
  16317. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/image-rendering"
  16318. },
  16319. "image-resolution": {
  16320. syntax: "[ from-image || <resolution> ] && snap?",
  16321. media: "visual",
  16322. inherited: true,
  16323. animationType: "discrete",
  16324. percentages: "no",
  16325. groups: [
  16326. "CSS Images"
  16327. ],
  16328. initial: "1dppx",
  16329. appliesto: "allElements",
  16330. computed: "asSpecifiedWithExceptionOfResolution",
  16331. order: "uniqueOrder",
  16332. status: "experimental"
  16333. },
  16334. "ime-mode": {
  16335. syntax: "auto | normal | active | inactive | disabled",
  16336. media: "interactive",
  16337. inherited: false,
  16338. animationType: "discrete",
  16339. percentages: "no",
  16340. groups: [
  16341. "CSS Basic User Interface"
  16342. ],
  16343. initial: "auto",
  16344. appliesto: "textFields",
  16345. computed: "asSpecified",
  16346. order: "uniqueOrder",
  16347. status: "obsolete",
  16348. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/ime-mode"
  16349. },
  16350. "initial-letter": {
  16351. syntax: "normal | [ <number> <integer>? ]",
  16352. media: "visual",
  16353. inherited: false,
  16354. animationType: "discrete",
  16355. percentages: "no",
  16356. groups: [
  16357. "CSS Inline"
  16358. ],
  16359. initial: "normal",
  16360. appliesto: "firstLetterPseudoElementsAndInlineLevelFirstChildren",
  16361. computed: "asSpecified",
  16362. order: "uniqueOrder",
  16363. status: "experimental",
  16364. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/initial-letter"
  16365. },
  16366. "initial-letter-align": {
  16367. syntax: "[ auto | alphabetic | hanging | ideographic ]",
  16368. media: "visual",
  16369. inherited: false,
  16370. animationType: "discrete",
  16371. percentages: "no",
  16372. groups: [
  16373. "CSS Inline"
  16374. ],
  16375. initial: "auto",
  16376. appliesto: "firstLetterPseudoElementsAndInlineLevelFirstChildren",
  16377. computed: "asSpecified",
  16378. order: "uniqueOrder",
  16379. status: "experimental",
  16380. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/initial-letter-align"
  16381. },
  16382. "inline-size": {
  16383. syntax: "<'width'>",
  16384. media: "visual",
  16385. inherited: false,
  16386. animationType: "lpc",
  16387. percentages: "inlineSizeOfContainingBlock",
  16388. groups: [
  16389. "CSS Logical Properties"
  16390. ],
  16391. initial: "auto",
  16392. appliesto: "sameAsWidthAndHeight",
  16393. computed: "sameAsWidthAndHeight",
  16394. order: "uniqueOrder",
  16395. status: "standard",
  16396. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inline-size"
  16397. },
  16398. inset: inset,
  16399. "inset-block": {
  16400. syntax: "<'top'>{1,2}",
  16401. media: "visual",
  16402. inherited: false,
  16403. animationType: "lpc",
  16404. percentages: "logicalHeightOfContainingBlock",
  16405. groups: [
  16406. "CSS Logical Properties"
  16407. ],
  16408. initial: "auto",
  16409. appliesto: "positionedElements",
  16410. computed: "sameAsBoxOffsets",
  16411. order: "uniqueOrder",
  16412. status: "standard",
  16413. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-block"
  16414. },
  16415. "inset-block-end": {
  16416. syntax: "<'top'>",
  16417. media: "visual",
  16418. inherited: false,
  16419. animationType: "lpc",
  16420. percentages: "logicalHeightOfContainingBlock",
  16421. groups: [
  16422. "CSS Logical Properties"
  16423. ],
  16424. initial: "auto",
  16425. appliesto: "positionedElements",
  16426. computed: "sameAsBoxOffsets",
  16427. order: "uniqueOrder",
  16428. status: "standard",
  16429. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-block-end"
  16430. },
  16431. "inset-block-start": {
  16432. syntax: "<'top'>",
  16433. media: "visual",
  16434. inherited: false,
  16435. animationType: "lpc",
  16436. percentages: "logicalHeightOfContainingBlock",
  16437. groups: [
  16438. "CSS Logical Properties"
  16439. ],
  16440. initial: "auto",
  16441. appliesto: "positionedElements",
  16442. computed: "sameAsBoxOffsets",
  16443. order: "uniqueOrder",
  16444. status: "standard",
  16445. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-block-start"
  16446. },
  16447. "inset-inline": {
  16448. syntax: "<'top'>{1,2}",
  16449. media: "visual",
  16450. inherited: false,
  16451. animationType: "lpc",
  16452. percentages: "logicalWidthOfContainingBlock",
  16453. groups: [
  16454. "CSS Logical Properties"
  16455. ],
  16456. initial: "auto",
  16457. appliesto: "positionedElements",
  16458. computed: "sameAsBoxOffsets",
  16459. order: "uniqueOrder",
  16460. status: "standard",
  16461. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-inline"
  16462. },
  16463. "inset-inline-end": {
  16464. syntax: "<'top'>",
  16465. media: "visual",
  16466. inherited: false,
  16467. animationType: "lpc",
  16468. percentages: "logicalWidthOfContainingBlock",
  16469. groups: [
  16470. "CSS Logical Properties"
  16471. ],
  16472. initial: "auto",
  16473. appliesto: "positionedElements",
  16474. computed: "sameAsBoxOffsets",
  16475. order: "uniqueOrder",
  16476. status: "standard",
  16477. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-inline-end"
  16478. },
  16479. "inset-inline-start": {
  16480. syntax: "<'top'>",
  16481. media: "visual",
  16482. inherited: false,
  16483. animationType: "lpc",
  16484. percentages: "logicalWidthOfContainingBlock",
  16485. groups: [
  16486. "CSS Logical Properties"
  16487. ],
  16488. initial: "auto",
  16489. appliesto: "positionedElements",
  16490. computed: "sameAsBoxOffsets",
  16491. order: "uniqueOrder",
  16492. status: "standard",
  16493. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-inline-start"
  16494. },
  16495. isolation: isolation,
  16496. "justify-content": {
  16497. syntax: "normal | <content-distribution> | <overflow-position>? [ <content-position> | left | right ]",
  16498. media: "visual",
  16499. inherited: false,
  16500. animationType: "discrete",
  16501. percentages: "no",
  16502. groups: [
  16503. "CSS Box Alignment"
  16504. ],
  16505. initial: "normal",
  16506. appliesto: "flexContainers",
  16507. computed: "asSpecified",
  16508. order: "uniqueOrder",
  16509. status: "standard",
  16510. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/justify-content"
  16511. },
  16512. "justify-items": {
  16513. syntax: "normal | stretch | <baseline-position> | <overflow-position>? [ <self-position> | left | right ] | legacy | legacy && [ left | right | center ]",
  16514. media: "visual",
  16515. inherited: false,
  16516. animationType: "discrete",
  16517. percentages: "no",
  16518. groups: [
  16519. "CSS Box Alignment"
  16520. ],
  16521. initial: "legacy",
  16522. appliesto: "allElements",
  16523. computed: "asSpecified",
  16524. order: "perGrammar",
  16525. status: "standard",
  16526. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/justify-items"
  16527. },
  16528. "justify-self": {
  16529. syntax: "auto | normal | stretch | <baseline-position> | <overflow-position>? [ <self-position> | left | right ]",
  16530. media: "visual",
  16531. inherited: false,
  16532. animationType: "discrete",
  16533. percentages: "no",
  16534. groups: [
  16535. "CSS Box Alignment"
  16536. ],
  16537. initial: "auto",
  16538. appliesto: "blockLevelBoxesAndAbsolutelyPositionedBoxesAndGridItems",
  16539. computed: "asSpecified",
  16540. order: "uniqueOrder",
  16541. status: "standard",
  16542. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/justify-self"
  16543. },
  16544. "justify-tracks": {
  16545. syntax: "[ normal | <content-distribution> | <overflow-position>? [ <content-position> | left | right ] ]#",
  16546. media: "visual",
  16547. inherited: false,
  16548. animationType: "discrete",
  16549. percentages: "no",
  16550. groups: [
  16551. "CSS Grid Layout"
  16552. ],
  16553. initial: "normal",
  16554. appliesto: "gridContainersWithMasonryLayoutInTheirInlineAxis",
  16555. computed: "asSpecified",
  16556. order: "uniqueOrder",
  16557. status: "experimental",
  16558. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/justify-tracks"
  16559. },
  16560. left: left,
  16561. "letter-spacing": {
  16562. syntax: "normal | <length>",
  16563. media: "visual",
  16564. inherited: true,
  16565. animationType: "length",
  16566. percentages: "no",
  16567. groups: [
  16568. "CSS Text"
  16569. ],
  16570. initial: "normal",
  16571. appliesto: "allElements",
  16572. computed: "optimumValueOfAbsoluteLengthOrNormal",
  16573. order: "uniqueOrder",
  16574. alsoAppliesTo: [
  16575. "::first-letter",
  16576. "::first-line"
  16577. ],
  16578. status: "standard",
  16579. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/letter-spacing"
  16580. },
  16581. "line-break": {
  16582. syntax: "auto | loose | normal | strict | anywhere",
  16583. media: "visual",
  16584. inherited: true,
  16585. animationType: "discrete",
  16586. percentages: "no",
  16587. groups: [
  16588. "CSS Text"
  16589. ],
  16590. initial: "auto",
  16591. appliesto: "allElements",
  16592. computed: "asSpecified",
  16593. order: "uniqueOrder",
  16594. status: "standard",
  16595. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/line-break"
  16596. },
  16597. "line-clamp": {
  16598. syntax: "none | <integer>",
  16599. media: "visual",
  16600. inherited: false,
  16601. animationType: "integer",
  16602. percentages: "no",
  16603. groups: [
  16604. "CSS Overflow"
  16605. ],
  16606. initial: "none",
  16607. appliesto: "blockContainersExceptMultiColumnContainers",
  16608. computed: "asSpecified",
  16609. order: "perGrammar",
  16610. status: "experimental"
  16611. },
  16612. "line-height": {
  16613. syntax: "normal | <number> | <length> | <percentage>",
  16614. media: "visual",
  16615. inherited: true,
  16616. animationType: "numberOrLength",
  16617. percentages: "referToElementFontSize",
  16618. groups: [
  16619. "CSS Fonts"
  16620. ],
  16621. initial: "normal",
  16622. appliesto: "allElements",
  16623. computed: "absoluteLengthOrAsSpecified",
  16624. order: "uniqueOrder",
  16625. alsoAppliesTo: [
  16626. "::first-letter",
  16627. "::first-line",
  16628. "::placeholder"
  16629. ],
  16630. status: "standard",
  16631. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/line-height"
  16632. },
  16633. "line-height-step": {
  16634. syntax: "<length>",
  16635. media: "visual",
  16636. inherited: true,
  16637. animationType: "discrete",
  16638. percentages: "no",
  16639. groups: [
  16640. "CSS Fonts"
  16641. ],
  16642. initial: "0",
  16643. appliesto: "blockContainers",
  16644. computed: "absoluteLength",
  16645. order: "perGrammar",
  16646. status: "experimental",
  16647. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/line-height-step"
  16648. },
  16649. "list-style": {
  16650. syntax: "<'list-style-type'> || <'list-style-position'> || <'list-style-image'>",
  16651. media: "visual",
  16652. inherited: true,
  16653. animationType: "discrete",
  16654. percentages: "no",
  16655. groups: [
  16656. "CSS Lists and Counters"
  16657. ],
  16658. initial: [
  16659. "list-style-type",
  16660. "list-style-position",
  16661. "list-style-image"
  16662. ],
  16663. appliesto: "listItems",
  16664. computed: [
  16665. "list-style-image",
  16666. "list-style-position",
  16667. "list-style-type"
  16668. ],
  16669. order: "orderOfAppearance",
  16670. status: "standard",
  16671. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/list-style"
  16672. },
  16673. "list-style-image": {
  16674. syntax: "<url> | none",
  16675. media: "visual",
  16676. inherited: true,
  16677. animationType: "discrete",
  16678. percentages: "no",
  16679. groups: [
  16680. "CSS Lists and Counters"
  16681. ],
  16682. initial: "none",
  16683. appliesto: "listItems",
  16684. computed: "noneOrImageWithAbsoluteURI",
  16685. order: "uniqueOrder",
  16686. status: "standard",
  16687. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/list-style-image"
  16688. },
  16689. "list-style-position": {
  16690. syntax: "inside | outside",
  16691. media: "visual",
  16692. inherited: true,
  16693. animationType: "discrete",
  16694. percentages: "no",
  16695. groups: [
  16696. "CSS Lists and Counters"
  16697. ],
  16698. initial: "outside",
  16699. appliesto: "listItems",
  16700. computed: "asSpecified",
  16701. order: "uniqueOrder",
  16702. status: "standard",
  16703. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/list-style-position"
  16704. },
  16705. "list-style-type": {
  16706. syntax: "<counter-style> | <string> | none",
  16707. media: "visual",
  16708. inherited: true,
  16709. animationType: "discrete",
  16710. percentages: "no",
  16711. groups: [
  16712. "CSS Lists and Counters"
  16713. ],
  16714. initial: "disc",
  16715. appliesto: "listItems",
  16716. computed: "asSpecified",
  16717. order: "uniqueOrder",
  16718. status: "standard",
  16719. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/list-style-type"
  16720. },
  16721. margin: margin,
  16722. "margin-block": {
  16723. syntax: "<'margin-left'>{1,2}",
  16724. media: "visual",
  16725. inherited: false,
  16726. animationType: "discrete",
  16727. percentages: "dependsOnLayoutModel",
  16728. groups: [
  16729. "CSS Logical Properties"
  16730. ],
  16731. initial: "0",
  16732. appliesto: "sameAsMargin",
  16733. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  16734. order: "uniqueOrder",
  16735. status: "standard",
  16736. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-block"
  16737. },
  16738. "margin-block-end": {
  16739. syntax: "<'margin-left'>",
  16740. media: "visual",
  16741. inherited: false,
  16742. animationType: "length",
  16743. percentages: "dependsOnLayoutModel",
  16744. groups: [
  16745. "CSS Logical Properties"
  16746. ],
  16747. initial: "0",
  16748. appliesto: "sameAsMargin",
  16749. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  16750. order: "uniqueOrder",
  16751. status: "standard",
  16752. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-block-end"
  16753. },
  16754. "margin-block-start": {
  16755. syntax: "<'margin-left'>",
  16756. media: "visual",
  16757. inherited: false,
  16758. animationType: "length",
  16759. percentages: "dependsOnLayoutModel",
  16760. groups: [
  16761. "CSS Logical Properties"
  16762. ],
  16763. initial: "0",
  16764. appliesto: "sameAsMargin",
  16765. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  16766. order: "uniqueOrder",
  16767. status: "standard",
  16768. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-block-start"
  16769. },
  16770. "margin-bottom": {
  16771. syntax: "<length> | <percentage> | auto",
  16772. media: "visual",
  16773. inherited: false,
  16774. animationType: "length",
  16775. percentages: "referToWidthOfContainingBlock",
  16776. groups: [
  16777. "CSS Box Model"
  16778. ],
  16779. initial: "0",
  16780. appliesto: "allElementsExceptTableDisplayTypes",
  16781. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16782. order: "uniqueOrder",
  16783. alsoAppliesTo: [
  16784. "::first-letter",
  16785. "::first-line"
  16786. ],
  16787. status: "standard",
  16788. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-bottom"
  16789. },
  16790. "margin-inline": {
  16791. syntax: "<'margin-left'>{1,2}",
  16792. media: "visual",
  16793. inherited: false,
  16794. animationType: "discrete",
  16795. percentages: "dependsOnLayoutModel",
  16796. groups: [
  16797. "CSS Logical Properties"
  16798. ],
  16799. initial: "0",
  16800. appliesto: "sameAsMargin",
  16801. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  16802. order: "uniqueOrder",
  16803. status: "standard",
  16804. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-inline"
  16805. },
  16806. "margin-inline-end": {
  16807. syntax: "<'margin-left'>",
  16808. media: "visual",
  16809. inherited: false,
  16810. animationType: "length",
  16811. percentages: "dependsOnLayoutModel",
  16812. groups: [
  16813. "CSS Logical Properties"
  16814. ],
  16815. initial: "0",
  16816. appliesto: "sameAsMargin",
  16817. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  16818. order: "uniqueOrder",
  16819. status: "standard",
  16820. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-inline-end"
  16821. },
  16822. "margin-inline-start": {
  16823. syntax: "<'margin-left'>",
  16824. media: "visual",
  16825. inherited: false,
  16826. animationType: "length",
  16827. percentages: "dependsOnLayoutModel",
  16828. groups: [
  16829. "CSS Logical Properties"
  16830. ],
  16831. initial: "0",
  16832. appliesto: "sameAsMargin",
  16833. computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
  16834. order: "uniqueOrder",
  16835. status: "standard",
  16836. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-inline-start"
  16837. },
  16838. "margin-left": {
  16839. syntax: "<length> | <percentage> | auto",
  16840. media: "visual",
  16841. inherited: false,
  16842. animationType: "length",
  16843. percentages: "referToWidthOfContainingBlock",
  16844. groups: [
  16845. "CSS Box Model"
  16846. ],
  16847. initial: "0",
  16848. appliesto: "allElementsExceptTableDisplayTypes",
  16849. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16850. order: "uniqueOrder",
  16851. alsoAppliesTo: [
  16852. "::first-letter",
  16853. "::first-line"
  16854. ],
  16855. status: "standard",
  16856. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-left"
  16857. },
  16858. "margin-right": {
  16859. syntax: "<length> | <percentage> | auto",
  16860. media: "visual",
  16861. inherited: false,
  16862. animationType: "length",
  16863. percentages: "referToWidthOfContainingBlock",
  16864. groups: [
  16865. "CSS Box Model"
  16866. ],
  16867. initial: "0",
  16868. appliesto: "allElementsExceptTableDisplayTypes",
  16869. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16870. order: "uniqueOrder",
  16871. alsoAppliesTo: [
  16872. "::first-letter",
  16873. "::first-line"
  16874. ],
  16875. status: "standard",
  16876. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-right"
  16877. },
  16878. "margin-top": {
  16879. syntax: "<length> | <percentage> | auto",
  16880. media: "visual",
  16881. inherited: false,
  16882. animationType: "length",
  16883. percentages: "referToWidthOfContainingBlock",
  16884. groups: [
  16885. "CSS Box Model"
  16886. ],
  16887. initial: "0",
  16888. appliesto: "allElementsExceptTableDisplayTypes",
  16889. computed: "percentageAsSpecifiedOrAbsoluteLength",
  16890. order: "uniqueOrder",
  16891. alsoAppliesTo: [
  16892. "::first-letter",
  16893. "::first-line"
  16894. ],
  16895. status: "standard",
  16896. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-top"
  16897. },
  16898. "margin-trim": {
  16899. syntax: "none | in-flow | all",
  16900. media: "visual",
  16901. inherited: false,
  16902. animationType: "discrete",
  16903. percentages: "no",
  16904. groups: [
  16905. "CSS Box Model"
  16906. ],
  16907. initial: "none",
  16908. appliesto: "blockContainersAndMultiColumnContainers",
  16909. computed: "asSpecified",
  16910. order: "perGrammar",
  16911. alsoAppliesTo: [
  16912. "::first-letter",
  16913. "::first-line"
  16914. ],
  16915. status: "experimental",
  16916. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-trim"
  16917. },
  16918. mask: mask,
  16919. "mask-border": {
  16920. syntax: "<'mask-border-source'> || <'mask-border-slice'> [ / <'mask-border-width'>? [ / <'mask-border-outset'> ]? ]? || <'mask-border-repeat'> || <'mask-border-mode'>",
  16921. media: "visual",
  16922. inherited: false,
  16923. animationType: [
  16924. "mask-border-mode",
  16925. "mask-border-outset",
  16926. "mask-border-repeat",
  16927. "mask-border-slice",
  16928. "mask-border-source",
  16929. "mask-border-width"
  16930. ],
  16931. percentages: [
  16932. "mask-border-slice",
  16933. "mask-border-width"
  16934. ],
  16935. groups: [
  16936. "CSS Masking"
  16937. ],
  16938. initial: [
  16939. "mask-border-mode",
  16940. "mask-border-outset",
  16941. "mask-border-repeat",
  16942. "mask-border-slice",
  16943. "mask-border-source",
  16944. "mask-border-width"
  16945. ],
  16946. appliesto: "allElementsSVGContainerElements",
  16947. computed: [
  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. order: "perGrammar",
  16956. stacking: true,
  16957. status: "standard",
  16958. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border"
  16959. },
  16960. "mask-border-mode": {
  16961. syntax: "luminance | alpha",
  16962. media: "visual",
  16963. inherited: false,
  16964. animationType: "discrete",
  16965. percentages: "no",
  16966. groups: [
  16967. "CSS Masking"
  16968. ],
  16969. initial: "alpha",
  16970. appliesto: "allElementsSVGContainerElements",
  16971. computed: "asSpecified",
  16972. order: "perGrammar",
  16973. status: "standard",
  16974. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-mode"
  16975. },
  16976. "mask-border-outset": {
  16977. syntax: "[ <length> | <number> ]{1,4}",
  16978. media: "visual",
  16979. inherited: false,
  16980. animationType: "discrete",
  16981. percentages: "no",
  16982. groups: [
  16983. "CSS Masking"
  16984. ],
  16985. initial: "0",
  16986. appliesto: "allElementsSVGContainerElements",
  16987. computed: "asSpecifiedRelativeToAbsoluteLengths",
  16988. order: "perGrammar",
  16989. status: "standard",
  16990. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-outset"
  16991. },
  16992. "mask-border-repeat": {
  16993. syntax: "[ stretch | repeat | round | space ]{1,2}",
  16994. media: "visual",
  16995. inherited: false,
  16996. animationType: "discrete",
  16997. percentages: "no",
  16998. groups: [
  16999. "CSS Masking"
  17000. ],
  17001. initial: "stretch",
  17002. appliesto: "allElementsSVGContainerElements",
  17003. computed: "asSpecified",
  17004. order: "perGrammar",
  17005. status: "standard",
  17006. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-repeat"
  17007. },
  17008. "mask-border-slice": {
  17009. syntax: "<number-percentage>{1,4} fill?",
  17010. media: "visual",
  17011. inherited: false,
  17012. animationType: "discrete",
  17013. percentages: "referToSizeOfMaskBorderImage",
  17014. groups: [
  17015. "CSS Masking"
  17016. ],
  17017. initial: "0",
  17018. appliesto: "allElementsSVGContainerElements",
  17019. computed: "asSpecified",
  17020. order: "perGrammar",
  17021. status: "standard",
  17022. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-slice"
  17023. },
  17024. "mask-border-source": {
  17025. syntax: "none | <image>",
  17026. media: "visual",
  17027. inherited: false,
  17028. animationType: "discrete",
  17029. percentages: "no",
  17030. groups: [
  17031. "CSS Masking"
  17032. ],
  17033. initial: "none",
  17034. appliesto: "allElementsSVGContainerElements",
  17035. computed: "asSpecifiedURLsAbsolute",
  17036. order: "perGrammar",
  17037. status: "standard",
  17038. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-source"
  17039. },
  17040. "mask-border-width": {
  17041. syntax: "[ <length-percentage> | <number> | auto ]{1,4}",
  17042. media: "visual",
  17043. inherited: false,
  17044. animationType: "discrete",
  17045. percentages: "relativeToMaskBorderImageArea",
  17046. groups: [
  17047. "CSS Masking"
  17048. ],
  17049. initial: "auto",
  17050. appliesto: "allElementsSVGContainerElements",
  17051. computed: "asSpecifiedRelativeToAbsoluteLengths",
  17052. order: "perGrammar",
  17053. status: "standard",
  17054. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-width"
  17055. },
  17056. "mask-clip": {
  17057. syntax: "[ <geometry-box> | no-clip ]#",
  17058. media: "visual",
  17059. inherited: false,
  17060. animationType: "discrete",
  17061. percentages: "no",
  17062. groups: [
  17063. "CSS Masking"
  17064. ],
  17065. initial: "border-box",
  17066. appliesto: "allElementsSVGContainerElements",
  17067. computed: "asSpecified",
  17068. order: "perGrammar",
  17069. status: "standard",
  17070. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-clip"
  17071. },
  17072. "mask-composite": {
  17073. syntax: "<compositing-operator>#",
  17074. media: "visual",
  17075. inherited: false,
  17076. animationType: "discrete",
  17077. percentages: "no",
  17078. groups: [
  17079. "CSS Masking"
  17080. ],
  17081. initial: "add",
  17082. appliesto: "allElementsSVGContainerElements",
  17083. computed: "asSpecified",
  17084. order: "perGrammar",
  17085. status: "standard",
  17086. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-composite"
  17087. },
  17088. "mask-image": {
  17089. syntax: "<mask-reference>#",
  17090. media: "visual",
  17091. inherited: false,
  17092. animationType: "discrete",
  17093. percentages: "no",
  17094. groups: [
  17095. "CSS Masking"
  17096. ],
  17097. initial: "none",
  17098. appliesto: "allElementsSVGContainerElements",
  17099. computed: "asSpecifiedURLsAbsolute",
  17100. order: "perGrammar",
  17101. status: "standard",
  17102. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-image"
  17103. },
  17104. "mask-mode": {
  17105. syntax: "<masking-mode>#",
  17106. media: "visual",
  17107. inherited: false,
  17108. animationType: "discrete",
  17109. percentages: "no",
  17110. groups: [
  17111. "CSS Masking"
  17112. ],
  17113. initial: "match-source",
  17114. appliesto: "allElementsSVGContainerElements",
  17115. computed: "asSpecified",
  17116. order: "perGrammar",
  17117. status: "standard",
  17118. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-mode"
  17119. },
  17120. "mask-origin": {
  17121. syntax: "<geometry-box>#",
  17122. media: "visual",
  17123. inherited: false,
  17124. animationType: "discrete",
  17125. percentages: "no",
  17126. groups: [
  17127. "CSS Masking"
  17128. ],
  17129. initial: "border-box",
  17130. appliesto: "allElementsSVGContainerElements",
  17131. computed: "asSpecified",
  17132. order: "perGrammar",
  17133. status: "standard",
  17134. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-origin"
  17135. },
  17136. "mask-position": {
  17137. syntax: "<position>#",
  17138. media: "visual",
  17139. inherited: false,
  17140. animationType: "repeatableListOfSimpleListOfLpc",
  17141. percentages: "referToSizeOfMaskPaintingArea",
  17142. groups: [
  17143. "CSS Masking"
  17144. ],
  17145. initial: "center",
  17146. appliesto: "allElementsSVGContainerElements",
  17147. computed: "consistsOfTwoKeywordsForOriginAndOffsets",
  17148. order: "perGrammar",
  17149. status: "standard",
  17150. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-position"
  17151. },
  17152. "mask-repeat": {
  17153. syntax: "<repeat-style>#",
  17154. media: "visual",
  17155. inherited: false,
  17156. animationType: "discrete",
  17157. percentages: "no",
  17158. groups: [
  17159. "CSS Masking"
  17160. ],
  17161. initial: "no-repeat",
  17162. appliesto: "allElementsSVGContainerElements",
  17163. computed: "consistsOfTwoDimensionKeywords",
  17164. order: "perGrammar",
  17165. status: "standard",
  17166. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-repeat"
  17167. },
  17168. "mask-size": {
  17169. syntax: "<bg-size>#",
  17170. media: "visual",
  17171. inherited: false,
  17172. animationType: "repeatableListOfSimpleListOfLpc",
  17173. percentages: "no",
  17174. groups: [
  17175. "CSS Masking"
  17176. ],
  17177. initial: "auto",
  17178. appliesto: "allElementsSVGContainerElements",
  17179. computed: "asSpecifiedRelativeToAbsoluteLengths",
  17180. order: "perGrammar",
  17181. status: "standard",
  17182. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-size"
  17183. },
  17184. "mask-type": {
  17185. syntax: "luminance | alpha",
  17186. media: "visual",
  17187. inherited: false,
  17188. animationType: "discrete",
  17189. percentages: "no",
  17190. groups: [
  17191. "CSS Masking"
  17192. ],
  17193. initial: "luminance",
  17194. appliesto: "maskElements",
  17195. computed: "asSpecified",
  17196. order: "perGrammar",
  17197. status: "standard",
  17198. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-type"
  17199. },
  17200. "masonry-auto-flow": {
  17201. syntax: "[ pack | next ] || [ definite-first | ordered ]",
  17202. media: "visual",
  17203. inherited: false,
  17204. animationType: "discrete",
  17205. percentages: "no",
  17206. groups: [
  17207. "CSS Grid Layout"
  17208. ],
  17209. initial: "pack",
  17210. appliesto: "gridContainersWithMasonryLayout",
  17211. computed: "asSpecified",
  17212. order: "uniqueOrder",
  17213. status: "experimental",
  17214. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/masonry-auto-flow"
  17215. },
  17216. "math-style": {
  17217. syntax: "normal | compact",
  17218. media: "visual",
  17219. inherited: true,
  17220. animationType: "notAnimatable",
  17221. percentages: "no",
  17222. groups: [
  17223. "MathML"
  17224. ],
  17225. initial: "normal",
  17226. appliesto: "allElements",
  17227. computed: "asSpecified",
  17228. order: "perGrammar",
  17229. status: "standard",
  17230. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/math-style"
  17231. },
  17232. "max-block-size": {
  17233. syntax: "<'max-width'>",
  17234. media: "visual",
  17235. inherited: false,
  17236. animationType: "lpc",
  17237. percentages: "blockSizeOfContainingBlock",
  17238. groups: [
  17239. "CSS Logical Properties"
  17240. ],
  17241. initial: "0",
  17242. appliesto: "sameAsWidthAndHeight",
  17243. computed: "sameAsMaxWidthAndMaxHeight",
  17244. order: "uniqueOrder",
  17245. status: "standard",
  17246. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-block-size"
  17247. },
  17248. "max-height": {
  17249. syntax: "none | <length-percentage> | min-content | max-content | fit-content(<length-percentage>)",
  17250. media: "visual",
  17251. inherited: false,
  17252. animationType: "lpc",
  17253. percentages: "regardingHeightOfGeneratedBoxContainingBlockPercentagesNone",
  17254. groups: [
  17255. "CSS Box Model"
  17256. ],
  17257. initial: "none",
  17258. appliesto: "allElementsButNonReplacedAndTableColumns",
  17259. computed: "percentageAsSpecifiedAbsoluteLengthOrNone",
  17260. order: "uniqueOrder",
  17261. status: "standard",
  17262. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-height"
  17263. },
  17264. "max-inline-size": {
  17265. syntax: "<'max-width'>",
  17266. media: "visual",
  17267. inherited: false,
  17268. animationType: "lpc",
  17269. percentages: "inlineSizeOfContainingBlock",
  17270. groups: [
  17271. "CSS Logical Properties"
  17272. ],
  17273. initial: "0",
  17274. appliesto: "sameAsWidthAndHeight",
  17275. computed: "sameAsMaxWidthAndMaxHeight",
  17276. order: "uniqueOrder",
  17277. status: "standard",
  17278. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-inline-size"
  17279. },
  17280. "max-lines": {
  17281. syntax: "none | <integer>",
  17282. media: "visual",
  17283. inherited: false,
  17284. animationType: "integer",
  17285. percentages: "no",
  17286. groups: [
  17287. "CSS Overflow"
  17288. ],
  17289. initial: "none",
  17290. appliesto: "blockContainersExceptMultiColumnContainers",
  17291. computed: "asSpecified",
  17292. order: "perGrammar",
  17293. status: "experimental"
  17294. },
  17295. "max-width": {
  17296. syntax: "none | <length-percentage> | min-content | max-content | fit-content(<length-percentage>)",
  17297. media: "visual",
  17298. inherited: false,
  17299. animationType: "lpc",
  17300. percentages: "referToWidthOfContainingBlock",
  17301. groups: [
  17302. "CSS Box Model"
  17303. ],
  17304. initial: "none",
  17305. appliesto: "allElementsButNonReplacedAndTableRows",
  17306. computed: "percentageAsSpecifiedAbsoluteLengthOrNone",
  17307. order: "uniqueOrder",
  17308. status: "standard",
  17309. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-width"
  17310. },
  17311. "min-block-size": {
  17312. syntax: "<'min-width'>",
  17313. media: "visual",
  17314. inherited: false,
  17315. animationType: "lpc",
  17316. percentages: "blockSizeOfContainingBlock",
  17317. groups: [
  17318. "CSS Logical Properties"
  17319. ],
  17320. initial: "0",
  17321. appliesto: "sameAsWidthAndHeight",
  17322. computed: "sameAsMinWidthAndMinHeight",
  17323. order: "uniqueOrder",
  17324. status: "standard",
  17325. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-block-size"
  17326. },
  17327. "min-height": {
  17328. syntax: "auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)",
  17329. media: "visual",
  17330. inherited: false,
  17331. animationType: "lpc",
  17332. percentages: "regardingHeightOfGeneratedBoxContainingBlockPercentages0",
  17333. groups: [
  17334. "CSS Box Model"
  17335. ],
  17336. initial: "auto",
  17337. appliesto: "allElementsButNonReplacedAndTableColumns",
  17338. computed: "percentageAsSpecifiedOrAbsoluteLength",
  17339. order: "uniqueOrder",
  17340. status: "standard",
  17341. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-height"
  17342. },
  17343. "min-inline-size": {
  17344. syntax: "<'min-width'>",
  17345. media: "visual",
  17346. inherited: false,
  17347. animationType: "lpc",
  17348. percentages: "inlineSizeOfContainingBlock",
  17349. groups: [
  17350. "CSS Logical Properties"
  17351. ],
  17352. initial: "0",
  17353. appliesto: "sameAsWidthAndHeight",
  17354. computed: "sameAsMinWidthAndMinHeight",
  17355. order: "uniqueOrder",
  17356. status: "standard",
  17357. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-inline-size"
  17358. },
  17359. "min-width": {
  17360. syntax: "auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)",
  17361. media: "visual",
  17362. inherited: false,
  17363. animationType: "lpc",
  17364. percentages: "referToWidthOfContainingBlock",
  17365. groups: [
  17366. "CSS Box Model"
  17367. ],
  17368. initial: "auto",
  17369. appliesto: "allElementsButNonReplacedAndTableRows",
  17370. computed: "percentageAsSpecifiedOrAbsoluteLength",
  17371. order: "uniqueOrder",
  17372. status: "standard",
  17373. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-width"
  17374. },
  17375. "mix-blend-mode": {
  17376. syntax: "<blend-mode>",
  17377. media: "visual",
  17378. inherited: false,
  17379. animationType: "discrete",
  17380. percentages: "no",
  17381. groups: [
  17382. "Compositing and Blending"
  17383. ],
  17384. initial: "normal",
  17385. appliesto: "allElements",
  17386. computed: "asSpecified",
  17387. order: "uniqueOrder",
  17388. stacking: true,
  17389. status: "standard",
  17390. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mix-blend-mode"
  17391. },
  17392. "object-fit": {
  17393. syntax: "fill | contain | cover | none | scale-down",
  17394. media: "visual",
  17395. inherited: false,
  17396. animationType: "discrete",
  17397. percentages: "no",
  17398. groups: [
  17399. "CSS Images"
  17400. ],
  17401. initial: "fill",
  17402. appliesto: "replacedElements",
  17403. computed: "asSpecified",
  17404. order: "uniqueOrder",
  17405. status: "standard",
  17406. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/object-fit"
  17407. },
  17408. "object-position": {
  17409. syntax: "<position>",
  17410. media: "visual",
  17411. inherited: true,
  17412. animationType: "repeatableListOfSimpleListOfLpc",
  17413. percentages: "referToWidthAndHeightOfElement",
  17414. groups: [
  17415. "CSS Images"
  17416. ],
  17417. initial: "50% 50%",
  17418. appliesto: "replacedElements",
  17419. computed: "asSpecified",
  17420. order: "uniqueOrder",
  17421. status: "standard",
  17422. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/object-position"
  17423. },
  17424. offset: offset,
  17425. "offset-anchor": {
  17426. syntax: "auto | <position>",
  17427. media: "visual",
  17428. inherited: false,
  17429. animationType: "position",
  17430. percentages: "relativeToWidthAndHeight",
  17431. groups: [
  17432. "CSS Motion Path"
  17433. ],
  17434. initial: "auto",
  17435. appliesto: "transformableElements",
  17436. computed: "forLengthAbsoluteValueOtherwisePercentage",
  17437. order: "perGrammar",
  17438. status: "standard"
  17439. },
  17440. "offset-distance": {
  17441. syntax: "<length-percentage>",
  17442. media: "visual",
  17443. inherited: false,
  17444. animationType: "lpc",
  17445. percentages: "referToTotalPathLength",
  17446. groups: [
  17447. "CSS Motion Path"
  17448. ],
  17449. initial: "0",
  17450. appliesto: "transformableElements",
  17451. computed: "forLengthAbsoluteValueOtherwisePercentage",
  17452. order: "perGrammar",
  17453. status: "standard",
  17454. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset-distance"
  17455. },
  17456. "offset-path": {
  17457. syntax: "none | ray( [ <angle> && <size> && contain? ] ) | <path()> | <url> | [ <basic-shape> || <geometry-box> ]",
  17458. media: "visual",
  17459. inherited: false,
  17460. animationType: "angleOrBasicShapeOrPath",
  17461. percentages: "no",
  17462. groups: [
  17463. "CSS Motion Path"
  17464. ],
  17465. initial: "none",
  17466. appliesto: "transformableElements",
  17467. computed: "asSpecified",
  17468. order: "perGrammar",
  17469. stacking: true,
  17470. status: "standard",
  17471. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset-path"
  17472. },
  17473. "offset-position": {
  17474. syntax: "auto | <position>",
  17475. media: "visual",
  17476. inherited: false,
  17477. animationType: "position",
  17478. percentages: "referToSizeOfContainingBlock",
  17479. groups: [
  17480. "CSS Motion Path"
  17481. ],
  17482. initial: "auto",
  17483. appliesto: "transformableElements",
  17484. computed: "forLengthAbsoluteValueOtherwisePercentage",
  17485. order: "perGrammar",
  17486. status: "experimental"
  17487. },
  17488. "offset-rotate": {
  17489. syntax: "[ auto | reverse ] || <angle>",
  17490. media: "visual",
  17491. inherited: false,
  17492. animationType: "angleOrBasicShapeOrPath",
  17493. percentages: "no",
  17494. groups: [
  17495. "CSS Motion Path"
  17496. ],
  17497. initial: "auto",
  17498. appliesto: "transformableElements",
  17499. computed: "asSpecified",
  17500. order: "perGrammar",
  17501. status: "standard",
  17502. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset-rotate"
  17503. },
  17504. opacity: opacity,
  17505. order: order,
  17506. orphans: orphans,
  17507. outline: outline,
  17508. "outline-color": {
  17509. syntax: "<color> | invert",
  17510. media: [
  17511. "visual",
  17512. "interactive"
  17513. ],
  17514. inherited: false,
  17515. animationType: "color",
  17516. percentages: "no",
  17517. groups: [
  17518. "CSS Basic User Interface"
  17519. ],
  17520. initial: "invertOrCurrentColor",
  17521. appliesto: "allElements",
  17522. computed: "invertForTranslucentColorRGBAOtherwiseRGB",
  17523. order: "uniqueOrder",
  17524. status: "standard",
  17525. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline-color"
  17526. },
  17527. "outline-offset": {
  17528. syntax: "<length>",
  17529. media: [
  17530. "visual",
  17531. "interactive"
  17532. ],
  17533. inherited: false,
  17534. animationType: "length",
  17535. percentages: "no",
  17536. groups: [
  17537. "CSS Basic User Interface"
  17538. ],
  17539. initial: "0",
  17540. appliesto: "allElements",
  17541. computed: "asSpecifiedRelativeToAbsoluteLengths",
  17542. order: "uniqueOrder",
  17543. status: "standard",
  17544. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline-offset"
  17545. },
  17546. "outline-style": {
  17547. syntax: "auto | <'border-style'>",
  17548. media: [
  17549. "visual",
  17550. "interactive"
  17551. ],
  17552. inherited: false,
  17553. animationType: "discrete",
  17554. percentages: "no",
  17555. groups: [
  17556. "CSS Basic User Interface"
  17557. ],
  17558. initial: "none",
  17559. appliesto: "allElements",
  17560. computed: "asSpecified",
  17561. order: "uniqueOrder",
  17562. status: "standard",
  17563. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline-style"
  17564. },
  17565. "outline-width": {
  17566. syntax: "<line-width>",
  17567. media: [
  17568. "visual",
  17569. "interactive"
  17570. ],
  17571. inherited: false,
  17572. animationType: "length",
  17573. percentages: "no",
  17574. groups: [
  17575. "CSS Basic User Interface"
  17576. ],
  17577. initial: "medium",
  17578. appliesto: "allElements",
  17579. computed: "absoluteLength0ForNone",
  17580. order: "uniqueOrder",
  17581. status: "standard",
  17582. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline-width"
  17583. },
  17584. overflow: overflow,
  17585. "overflow-anchor": {
  17586. syntax: "auto | none",
  17587. media: "visual",
  17588. inherited: false,
  17589. animationType: "discrete",
  17590. percentages: "no",
  17591. groups: [
  17592. "CSS Scroll Anchoring"
  17593. ],
  17594. initial: "auto",
  17595. appliesto: "allElements",
  17596. computed: "asSpecified",
  17597. order: "perGrammar",
  17598. status: "standard"
  17599. },
  17600. "overflow-block": {
  17601. syntax: "visible | hidden | clip | scroll | auto",
  17602. media: "visual",
  17603. inherited: false,
  17604. animationType: "discrete",
  17605. percentages: "no",
  17606. groups: [
  17607. "CSS Overflow"
  17608. ],
  17609. initial: "auto",
  17610. appliesto: "blockContainersFlexContainersGridContainers",
  17611. computed: "asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent",
  17612. order: "perGrammar",
  17613. status: "standard"
  17614. },
  17615. "overflow-clip-box": {
  17616. syntax: "padding-box | content-box",
  17617. media: "visual",
  17618. inherited: false,
  17619. animationType: "discrete",
  17620. percentages: "no",
  17621. groups: [
  17622. "Mozilla Extensions"
  17623. ],
  17624. initial: "padding-box",
  17625. appliesto: "allElements",
  17626. computed: "asSpecified",
  17627. order: "uniqueOrder",
  17628. status: "nonstandard",
  17629. mdn_url: "https://developer.mozilla.org/docs/Mozilla/CSS/overflow-clip-box"
  17630. },
  17631. "overflow-inline": {
  17632. syntax: "visible | hidden | clip | scroll | auto",
  17633. media: "visual",
  17634. inherited: false,
  17635. animationType: "discrete",
  17636. percentages: "no",
  17637. groups: [
  17638. "CSS Overflow"
  17639. ],
  17640. initial: "auto",
  17641. appliesto: "blockContainersFlexContainersGridContainers",
  17642. computed: "asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent",
  17643. order: "perGrammar",
  17644. status: "standard"
  17645. },
  17646. "overflow-wrap": {
  17647. syntax: "normal | break-word | anywhere",
  17648. media: "visual",
  17649. inherited: true,
  17650. animationType: "discrete",
  17651. percentages: "no",
  17652. groups: [
  17653. "CSS Text"
  17654. ],
  17655. initial: "normal",
  17656. appliesto: "nonReplacedInlineElements",
  17657. computed: "asSpecified",
  17658. order: "uniqueOrder",
  17659. status: "standard",
  17660. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-wrap"
  17661. },
  17662. "overflow-x": {
  17663. syntax: "visible | hidden | clip | scroll | auto",
  17664. media: "visual",
  17665. inherited: false,
  17666. animationType: "discrete",
  17667. percentages: "no",
  17668. groups: [
  17669. "CSS Overflow"
  17670. ],
  17671. initial: "visible",
  17672. appliesto: "blockContainersFlexContainersGridContainers",
  17673. computed: "asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent",
  17674. order: "uniqueOrder",
  17675. status: "standard",
  17676. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-x"
  17677. },
  17678. "overflow-y": {
  17679. syntax: "visible | hidden | clip | scroll | auto",
  17680. media: "visual",
  17681. inherited: false,
  17682. animationType: "discrete",
  17683. percentages: "no",
  17684. groups: [
  17685. "CSS Overflow"
  17686. ],
  17687. initial: "visible",
  17688. appliesto: "blockContainersFlexContainersGridContainers",
  17689. computed: "asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent",
  17690. order: "uniqueOrder",
  17691. status: "standard",
  17692. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-y"
  17693. },
  17694. "overscroll-behavior": {
  17695. syntax: "[ contain | none | auto ]{1,2}",
  17696. media: "visual",
  17697. inherited: false,
  17698. animationType: "discrete",
  17699. percentages: "no",
  17700. groups: [
  17701. "CSS Box Model"
  17702. ],
  17703. initial: "auto",
  17704. appliesto: "nonReplacedBlockAndInlineBlockElements",
  17705. computed: "asSpecified",
  17706. order: "uniqueOrder",
  17707. status: "standard",
  17708. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior"
  17709. },
  17710. "overscroll-behavior-block": {
  17711. syntax: "contain | none | auto",
  17712. media: "visual",
  17713. inherited: false,
  17714. animationType: "discrete",
  17715. percentages: "no",
  17716. groups: [
  17717. "CSS Box Model"
  17718. ],
  17719. initial: "auto",
  17720. appliesto: "nonReplacedBlockAndInlineBlockElements",
  17721. computed: "asSpecified",
  17722. order: "uniqueOrder",
  17723. status: "standard",
  17724. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-block"
  17725. },
  17726. "overscroll-behavior-inline": {
  17727. syntax: "contain | none | auto",
  17728. media: "visual",
  17729. inherited: false,
  17730. animationType: "discrete",
  17731. percentages: "no",
  17732. groups: [
  17733. "CSS Box Model"
  17734. ],
  17735. initial: "auto",
  17736. appliesto: "nonReplacedBlockAndInlineBlockElements",
  17737. computed: "asSpecified",
  17738. order: "uniqueOrder",
  17739. status: "standard",
  17740. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-inline"
  17741. },
  17742. "overscroll-behavior-x": {
  17743. syntax: "contain | none | auto",
  17744. media: "visual",
  17745. inherited: false,
  17746. animationType: "discrete",
  17747. percentages: "no",
  17748. groups: [
  17749. "CSS Box Model"
  17750. ],
  17751. initial: "auto",
  17752. appliesto: "nonReplacedBlockAndInlineBlockElements",
  17753. computed: "asSpecified",
  17754. order: "uniqueOrder",
  17755. status: "standard",
  17756. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-x"
  17757. },
  17758. "overscroll-behavior-y": {
  17759. syntax: "contain | none | auto",
  17760. media: "visual",
  17761. inherited: false,
  17762. animationType: "discrete",
  17763. percentages: "no",
  17764. groups: [
  17765. "CSS Box Model"
  17766. ],
  17767. initial: "auto",
  17768. appliesto: "nonReplacedBlockAndInlineBlockElements",
  17769. computed: "asSpecified",
  17770. order: "uniqueOrder",
  17771. status: "standard",
  17772. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-y"
  17773. },
  17774. padding: padding,
  17775. "padding-block": {
  17776. syntax: "<'padding-left'>{1,2}",
  17777. media: "visual",
  17778. inherited: false,
  17779. animationType: "discrete",
  17780. percentages: "logicalWidthOfContainingBlock",
  17781. groups: [
  17782. "CSS Logical Properties"
  17783. ],
  17784. initial: "0",
  17785. appliesto: "allElements",
  17786. computed: "asLength",
  17787. order: "uniqueOrder",
  17788. status: "standard",
  17789. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-block"
  17790. },
  17791. "padding-block-end": {
  17792. syntax: "<'padding-left'>",
  17793. media: "visual",
  17794. inherited: false,
  17795. animationType: "length",
  17796. percentages: "logicalWidthOfContainingBlock",
  17797. groups: [
  17798. "CSS Logical Properties"
  17799. ],
  17800. initial: "0",
  17801. appliesto: "allElements",
  17802. computed: "asLength",
  17803. order: "uniqueOrder",
  17804. status: "standard",
  17805. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-block-end"
  17806. },
  17807. "padding-block-start": {
  17808. syntax: "<'padding-left'>",
  17809. media: "visual",
  17810. inherited: false,
  17811. animationType: "length",
  17812. percentages: "logicalWidthOfContainingBlock",
  17813. groups: [
  17814. "CSS Logical Properties"
  17815. ],
  17816. initial: "0",
  17817. appliesto: "allElements",
  17818. computed: "asLength",
  17819. order: "uniqueOrder",
  17820. status: "standard",
  17821. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-block-start"
  17822. },
  17823. "padding-bottom": {
  17824. syntax: "<length> | <percentage>",
  17825. media: "visual",
  17826. inherited: false,
  17827. animationType: "length",
  17828. percentages: "referToWidthOfContainingBlock",
  17829. groups: [
  17830. "CSS Box Model"
  17831. ],
  17832. initial: "0",
  17833. appliesto: "allElementsExceptInternalTableDisplayTypes",
  17834. computed: "percentageAsSpecifiedOrAbsoluteLength",
  17835. order: "uniqueOrder",
  17836. alsoAppliesTo: [
  17837. "::first-letter",
  17838. "::first-line"
  17839. ],
  17840. status: "standard",
  17841. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-bottom"
  17842. },
  17843. "padding-inline": {
  17844. syntax: "<'padding-left'>{1,2}",
  17845. media: "visual",
  17846. inherited: false,
  17847. animationType: "discrete",
  17848. percentages: "logicalWidthOfContainingBlock",
  17849. groups: [
  17850. "CSS Logical Properties"
  17851. ],
  17852. initial: "0",
  17853. appliesto: "allElements",
  17854. computed: "asLength",
  17855. order: "uniqueOrder",
  17856. status: "standard",
  17857. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-inline"
  17858. },
  17859. "padding-inline-end": {
  17860. syntax: "<'padding-left'>",
  17861. media: "visual",
  17862. inherited: false,
  17863. animationType: "length",
  17864. percentages: "logicalWidthOfContainingBlock",
  17865. groups: [
  17866. "CSS Logical Properties"
  17867. ],
  17868. initial: "0",
  17869. appliesto: "allElements",
  17870. computed: "asLength",
  17871. order: "uniqueOrder",
  17872. status: "standard",
  17873. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-inline-end"
  17874. },
  17875. "padding-inline-start": {
  17876. syntax: "<'padding-left'>",
  17877. media: "visual",
  17878. inherited: false,
  17879. animationType: "length",
  17880. percentages: "logicalWidthOfContainingBlock",
  17881. groups: [
  17882. "CSS Logical Properties"
  17883. ],
  17884. initial: "0",
  17885. appliesto: "allElements",
  17886. computed: "asLength",
  17887. order: "uniqueOrder",
  17888. status: "standard",
  17889. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-inline-start"
  17890. },
  17891. "padding-left": {
  17892. syntax: "<length> | <percentage>",
  17893. media: "visual",
  17894. inherited: false,
  17895. animationType: "length",
  17896. percentages: "referToWidthOfContainingBlock",
  17897. groups: [
  17898. "CSS Box Model"
  17899. ],
  17900. initial: "0",
  17901. appliesto: "allElementsExceptInternalTableDisplayTypes",
  17902. computed: "percentageAsSpecifiedOrAbsoluteLength",
  17903. order: "uniqueOrder",
  17904. alsoAppliesTo: [
  17905. "::first-letter",
  17906. "::first-line"
  17907. ],
  17908. status: "standard",
  17909. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-left"
  17910. },
  17911. "padding-right": {
  17912. syntax: "<length> | <percentage>",
  17913. media: "visual",
  17914. inherited: false,
  17915. animationType: "length",
  17916. percentages: "referToWidthOfContainingBlock",
  17917. groups: [
  17918. "CSS Box Model"
  17919. ],
  17920. initial: "0",
  17921. appliesto: "allElementsExceptInternalTableDisplayTypes",
  17922. computed: "percentageAsSpecifiedOrAbsoluteLength",
  17923. order: "uniqueOrder",
  17924. alsoAppliesTo: [
  17925. "::first-letter",
  17926. "::first-line"
  17927. ],
  17928. status: "standard",
  17929. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-right"
  17930. },
  17931. "padding-top": {
  17932. syntax: "<length> | <percentage>",
  17933. media: "visual",
  17934. inherited: false,
  17935. animationType: "length",
  17936. percentages: "referToWidthOfContainingBlock",
  17937. groups: [
  17938. "CSS Box Model"
  17939. ],
  17940. initial: "0",
  17941. appliesto: "allElementsExceptInternalTableDisplayTypes",
  17942. computed: "percentageAsSpecifiedOrAbsoluteLength",
  17943. order: "uniqueOrder",
  17944. alsoAppliesTo: [
  17945. "::first-letter",
  17946. "::first-line"
  17947. ],
  17948. status: "standard",
  17949. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-top"
  17950. },
  17951. "page-break-after": {
  17952. syntax: "auto | always | avoid | left | right | recto | verso",
  17953. media: [
  17954. "visual",
  17955. "paged"
  17956. ],
  17957. inherited: false,
  17958. animationType: "discrete",
  17959. percentages: "no",
  17960. groups: [
  17961. "CSS Pages"
  17962. ],
  17963. initial: "auto",
  17964. appliesto: "blockElementsInNormalFlow",
  17965. computed: "asSpecified",
  17966. order: "uniqueOrder",
  17967. status: "standard",
  17968. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/page-break-after"
  17969. },
  17970. "page-break-before": {
  17971. syntax: "auto | always | avoid | left | right | recto | verso",
  17972. media: [
  17973. "visual",
  17974. "paged"
  17975. ],
  17976. inherited: false,
  17977. animationType: "discrete",
  17978. percentages: "no",
  17979. groups: [
  17980. "CSS Pages"
  17981. ],
  17982. initial: "auto",
  17983. appliesto: "blockElementsInNormalFlow",
  17984. computed: "asSpecified",
  17985. order: "uniqueOrder",
  17986. status: "standard",
  17987. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/page-break-before"
  17988. },
  17989. "page-break-inside": {
  17990. syntax: "auto | avoid",
  17991. media: [
  17992. "visual",
  17993. "paged"
  17994. ],
  17995. inherited: false,
  17996. animationType: "discrete",
  17997. percentages: "no",
  17998. groups: [
  17999. "CSS Pages"
  18000. ],
  18001. initial: "auto",
  18002. appliesto: "blockElementsInNormalFlow",
  18003. computed: "asSpecified",
  18004. order: "uniqueOrder",
  18005. status: "standard",
  18006. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/page-break-inside"
  18007. },
  18008. "paint-order": {
  18009. syntax: "normal | [ fill || stroke || markers ]",
  18010. media: "visual",
  18011. inherited: true,
  18012. animationType: "discrete",
  18013. percentages: "no",
  18014. groups: [
  18015. "CSS Text"
  18016. ],
  18017. initial: "normal",
  18018. appliesto: "textElements",
  18019. computed: "asSpecified",
  18020. order: "uniqueOrder",
  18021. status: "standard",
  18022. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/paint-order"
  18023. },
  18024. perspective: perspective,
  18025. "perspective-origin": {
  18026. syntax: "<position>",
  18027. media: "visual",
  18028. inherited: false,
  18029. animationType: "simpleListOfLpc",
  18030. percentages: "referToSizeOfBoundingBox",
  18031. groups: [
  18032. "CSS Transforms"
  18033. ],
  18034. initial: "50% 50%",
  18035. appliesto: "transformableElements",
  18036. computed: "forLengthAbsoluteValueOtherwisePercentage",
  18037. order: "oneOrTwoValuesLengthAbsoluteKeywordsPercentages",
  18038. status: "standard",
  18039. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/perspective-origin"
  18040. },
  18041. "place-content": {
  18042. syntax: "<'align-content'> <'justify-content'>?",
  18043. media: "visual",
  18044. inherited: false,
  18045. animationType: "discrete",
  18046. percentages: "no",
  18047. groups: [
  18048. "CSS Box Alignment"
  18049. ],
  18050. initial: "normal",
  18051. appliesto: "multilineFlexContainers",
  18052. computed: "asSpecified",
  18053. order: "uniqueOrder",
  18054. status: "standard",
  18055. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/place-content"
  18056. },
  18057. "place-items": {
  18058. syntax: "<'align-items'> <'justify-items'>?",
  18059. media: "visual",
  18060. inherited: false,
  18061. animationType: "discrete",
  18062. percentages: "no",
  18063. groups: [
  18064. "CSS Box Alignment"
  18065. ],
  18066. initial: [
  18067. "align-items",
  18068. "justify-items"
  18069. ],
  18070. appliesto: "allElements",
  18071. computed: [
  18072. "align-items",
  18073. "justify-items"
  18074. ],
  18075. order: "uniqueOrder",
  18076. status: "standard",
  18077. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/place-items"
  18078. },
  18079. "place-self": {
  18080. syntax: "<'align-self'> <'justify-self'>?",
  18081. media: "visual",
  18082. inherited: false,
  18083. animationType: "discrete",
  18084. percentages: "no",
  18085. groups: [
  18086. "CSS Box Alignment"
  18087. ],
  18088. initial: [
  18089. "align-self",
  18090. "justify-self"
  18091. ],
  18092. appliesto: "blockLevelBoxesAndAbsolutelyPositionedBoxesAndGridItems",
  18093. computed: [
  18094. "align-self",
  18095. "justify-self"
  18096. ],
  18097. order: "uniqueOrder",
  18098. status: "standard",
  18099. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/place-self"
  18100. },
  18101. "pointer-events": {
  18102. syntax: "auto | none | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | inherit",
  18103. media: "visual",
  18104. inherited: true,
  18105. animationType: "discrete",
  18106. percentages: "no",
  18107. groups: [
  18108. "Pointer Events"
  18109. ],
  18110. initial: "auto",
  18111. appliesto: "allElements",
  18112. computed: "asSpecified",
  18113. order: "uniqueOrder",
  18114. status: "standard",
  18115. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/pointer-events"
  18116. },
  18117. position: position$1,
  18118. quotes: quotes,
  18119. resize: resize,
  18120. right: right,
  18121. rotate: rotate,
  18122. "row-gap": {
  18123. syntax: "normal | <length-percentage>",
  18124. media: "visual",
  18125. inherited: false,
  18126. animationType: "lpc",
  18127. percentages: "referToDimensionOfContentArea",
  18128. groups: [
  18129. "CSS Box Alignment"
  18130. ],
  18131. initial: "normal",
  18132. appliesto: "multiColumnElementsFlexContainersGridContainers",
  18133. computed: "asSpecifiedWithLengthsAbsoluteAndNormalComputingToZeroExceptMultiColumn",
  18134. order: "perGrammar",
  18135. status: "standard",
  18136. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/row-gap"
  18137. },
  18138. "ruby-align": {
  18139. syntax: "start | center | space-between | space-around",
  18140. media: "visual",
  18141. inherited: true,
  18142. animationType: "discrete",
  18143. percentages: "no",
  18144. groups: [
  18145. "CSS Ruby"
  18146. ],
  18147. initial: "space-around",
  18148. appliesto: "rubyBasesAnnotationsBaseAnnotationContainers",
  18149. computed: "asSpecified",
  18150. order: "uniqueOrder",
  18151. status: "experimental",
  18152. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/ruby-align"
  18153. },
  18154. "ruby-merge": {
  18155. syntax: "separate | collapse | auto",
  18156. media: "visual",
  18157. inherited: true,
  18158. animationType: "discrete",
  18159. percentages: "no",
  18160. groups: [
  18161. "CSS Ruby"
  18162. ],
  18163. initial: "separate",
  18164. appliesto: "rubyAnnotationsContainers",
  18165. computed: "asSpecified",
  18166. order: "uniqueOrder",
  18167. status: "experimental"
  18168. },
  18169. "ruby-position": {
  18170. syntax: "over | under | inter-character",
  18171. media: "visual",
  18172. inherited: true,
  18173. animationType: "discrete",
  18174. percentages: "no",
  18175. groups: [
  18176. "CSS Ruby"
  18177. ],
  18178. initial: "over",
  18179. appliesto: "rubyAnnotationsContainers",
  18180. computed: "asSpecified",
  18181. order: "uniqueOrder",
  18182. status: "experimental",
  18183. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/ruby-position"
  18184. },
  18185. scale: scale,
  18186. "scrollbar-color": {
  18187. syntax: "auto | dark | light | <color>{2}",
  18188. media: "visual",
  18189. inherited: true,
  18190. animationType: "color",
  18191. percentages: "no",
  18192. groups: [
  18193. "CSS Scrollbars"
  18194. ],
  18195. initial: "auto",
  18196. appliesto: "scrollingBoxes",
  18197. computed: "asSpecified",
  18198. order: "perGrammar",
  18199. status: "standard",
  18200. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scrollbar-color"
  18201. },
  18202. "scrollbar-gutter": {
  18203. syntax: "auto | [ stable | always ] && both? && force?",
  18204. media: "visual",
  18205. inherited: false,
  18206. animationType: "discrete",
  18207. percentages: "no",
  18208. groups: [
  18209. "CSS Overflow"
  18210. ],
  18211. initial: "auto",
  18212. appliesto: "allElements",
  18213. computed: "asSpecified",
  18214. order: "perGrammar",
  18215. status: "standard",
  18216. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scrollbar-gutter"
  18217. },
  18218. "scrollbar-width": {
  18219. syntax: "auto | thin | none",
  18220. media: "visual",
  18221. inherited: false,
  18222. animationType: "discrete",
  18223. percentages: "no",
  18224. groups: [
  18225. "CSS Scrollbars"
  18226. ],
  18227. initial: "auto",
  18228. appliesto: "scrollingBoxes",
  18229. computed: "asSpecified",
  18230. order: "perGrammar",
  18231. status: "standard",
  18232. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scrollbar-width"
  18233. },
  18234. "scroll-behavior": {
  18235. syntax: "auto | smooth",
  18236. media: "visual",
  18237. inherited: false,
  18238. animationType: "discrete",
  18239. percentages: "no",
  18240. groups: [
  18241. "CSSOM View"
  18242. ],
  18243. initial: "auto",
  18244. appliesto: "scrollingBoxes",
  18245. computed: "asSpecified",
  18246. order: "uniqueOrder",
  18247. status: "standard",
  18248. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-behavior"
  18249. },
  18250. "scroll-margin": {
  18251. syntax: "<length>{1,4}",
  18252. media: "visual",
  18253. inherited: false,
  18254. animationType: "byComputedValueType",
  18255. percentages: "no",
  18256. groups: [
  18257. "CSS Scroll Snap"
  18258. ],
  18259. initial: "0",
  18260. appliesto: "allElements",
  18261. computed: "asSpecified",
  18262. order: "perGrammar",
  18263. status: "standard",
  18264. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin"
  18265. },
  18266. "scroll-margin-block": {
  18267. syntax: "<length>{1,2}",
  18268. media: "visual",
  18269. inherited: false,
  18270. animationType: "byComputedValueType",
  18271. percentages: "no",
  18272. groups: [
  18273. "CSS Scroll Snap"
  18274. ],
  18275. initial: "0",
  18276. appliesto: "allElements",
  18277. computed: "asSpecified",
  18278. order: "perGrammar",
  18279. status: "standard",
  18280. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block"
  18281. },
  18282. "scroll-margin-block-start": {
  18283. syntax: "<length>",
  18284. media: "visual",
  18285. inherited: false,
  18286. animationType: "byComputedValueType",
  18287. percentages: "no",
  18288. groups: [
  18289. "CSS Scroll Snap"
  18290. ],
  18291. initial: "0",
  18292. appliesto: "allElements",
  18293. computed: "asSpecified",
  18294. order: "perGrammar",
  18295. status: "standard",
  18296. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block-start"
  18297. },
  18298. "scroll-margin-block-end": {
  18299. syntax: "<length>",
  18300. media: "visual",
  18301. inherited: false,
  18302. animationType: "byComputedValueType",
  18303. percentages: "no",
  18304. groups: [
  18305. "CSS Scroll Snap"
  18306. ],
  18307. initial: "0",
  18308. appliesto: "allElements",
  18309. computed: "asSpecified",
  18310. order: "perGrammar",
  18311. status: "standard",
  18312. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block-end"
  18313. },
  18314. "scroll-margin-bottom": {
  18315. syntax: "<length>",
  18316. media: "visual",
  18317. inherited: false,
  18318. animationType: "byComputedValueType",
  18319. percentages: "no",
  18320. groups: [
  18321. "CSS Scroll Snap"
  18322. ],
  18323. initial: "0",
  18324. appliesto: "allElements",
  18325. computed: "asSpecified",
  18326. order: "perGrammar",
  18327. status: "standard",
  18328. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-bottom"
  18329. },
  18330. "scroll-margin-inline": {
  18331. syntax: "<length>{1,2}",
  18332. media: "visual",
  18333. inherited: false,
  18334. animationType: "byComputedValueType",
  18335. percentages: "no",
  18336. groups: [
  18337. "CSS Scroll Snap"
  18338. ],
  18339. initial: "0",
  18340. appliesto: "allElements",
  18341. computed: "asSpecified",
  18342. order: "perGrammar",
  18343. status: "standard",
  18344. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline"
  18345. },
  18346. "scroll-margin-inline-start": {
  18347. syntax: "<length>",
  18348. media: "visual",
  18349. inherited: false,
  18350. animationType: "byComputedValueType",
  18351. percentages: "no",
  18352. groups: [
  18353. "CSS Scroll Snap"
  18354. ],
  18355. initial: "0",
  18356. appliesto: "allElements",
  18357. computed: "asSpecified",
  18358. order: "perGrammar",
  18359. status: "standard",
  18360. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline-start"
  18361. },
  18362. "scroll-margin-inline-end": {
  18363. syntax: "<length>",
  18364. media: "visual",
  18365. inherited: false,
  18366. animationType: "byComputedValueType",
  18367. percentages: "no",
  18368. groups: [
  18369. "CSS Scroll Snap"
  18370. ],
  18371. initial: "0",
  18372. appliesto: "allElements",
  18373. computed: "asSpecified",
  18374. order: "perGrammar",
  18375. status: "standard",
  18376. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline-end"
  18377. },
  18378. "scroll-margin-left": {
  18379. syntax: "<length>",
  18380. media: "visual",
  18381. inherited: false,
  18382. animationType: "byComputedValueType",
  18383. percentages: "no",
  18384. groups: [
  18385. "CSS Scroll Snap"
  18386. ],
  18387. initial: "0",
  18388. appliesto: "allElements",
  18389. computed: "asSpecified",
  18390. order: "perGrammar",
  18391. status: "standard",
  18392. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-left"
  18393. },
  18394. "scroll-margin-right": {
  18395. syntax: "<length>",
  18396. media: "visual",
  18397. inherited: false,
  18398. animationType: "byComputedValueType",
  18399. percentages: "no",
  18400. groups: [
  18401. "CSS Scroll Snap"
  18402. ],
  18403. initial: "0",
  18404. appliesto: "allElements",
  18405. computed: "asSpecified",
  18406. order: "perGrammar",
  18407. status: "standard",
  18408. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-right"
  18409. },
  18410. "scroll-margin-top": {
  18411. syntax: "<length>",
  18412. media: "visual",
  18413. inherited: false,
  18414. animationType: "byComputedValueType",
  18415. percentages: "no",
  18416. groups: [
  18417. "CSS Scroll Snap"
  18418. ],
  18419. initial: "0",
  18420. appliesto: "allElements",
  18421. computed: "asSpecified",
  18422. order: "perGrammar",
  18423. status: "standard",
  18424. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-top"
  18425. },
  18426. "scroll-padding": {
  18427. syntax: "[ auto | <length-percentage> ]{1,4}",
  18428. media: "visual",
  18429. inherited: false,
  18430. animationType: "byComputedValueType",
  18431. percentages: "relativeToTheScrollContainersScrollport",
  18432. groups: [
  18433. "CSS Scroll Snap"
  18434. ],
  18435. initial: "auto",
  18436. appliesto: "scrollContainers",
  18437. computed: "asSpecified",
  18438. order: "perGrammar",
  18439. status: "standard",
  18440. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding"
  18441. },
  18442. "scroll-padding-block": {
  18443. syntax: "[ auto | <length-percentage> ]{1,2}",
  18444. media: "visual",
  18445. inherited: false,
  18446. animationType: "byComputedValueType",
  18447. percentages: "relativeToTheScrollContainersScrollport",
  18448. groups: [
  18449. "CSS Scroll Snap"
  18450. ],
  18451. initial: "auto",
  18452. appliesto: "scrollContainers",
  18453. computed: "asSpecified",
  18454. order: "perGrammar",
  18455. status: "standard",
  18456. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block"
  18457. },
  18458. "scroll-padding-block-start": {
  18459. syntax: "auto | <length-percentage>",
  18460. media: "visual",
  18461. inherited: false,
  18462. animationType: "byComputedValueType",
  18463. percentages: "relativeToTheScrollContainersScrollport",
  18464. groups: [
  18465. "CSS Scroll Snap"
  18466. ],
  18467. initial: "auto",
  18468. appliesto: "scrollContainers",
  18469. computed: "asSpecified",
  18470. order: "perGrammar",
  18471. status: "standard",
  18472. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block-start"
  18473. },
  18474. "scroll-padding-block-end": {
  18475. syntax: "auto | <length-percentage>",
  18476. media: "visual",
  18477. inherited: false,
  18478. animationType: "byComputedValueType",
  18479. percentages: "relativeToTheScrollContainersScrollport",
  18480. groups: [
  18481. "CSS Scroll Snap"
  18482. ],
  18483. initial: "auto",
  18484. appliesto: "scrollContainers",
  18485. computed: "asSpecified",
  18486. order: "perGrammar",
  18487. status: "standard",
  18488. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block-end"
  18489. },
  18490. "scroll-padding-bottom": {
  18491. syntax: "auto | <length-percentage>",
  18492. media: "visual",
  18493. inherited: false,
  18494. animationType: "byComputedValueType",
  18495. percentages: "relativeToTheScrollContainersScrollport",
  18496. groups: [
  18497. "CSS Scroll Snap"
  18498. ],
  18499. initial: "auto",
  18500. appliesto: "scrollContainers",
  18501. computed: "asSpecified",
  18502. order: "perGrammar",
  18503. status: "standard",
  18504. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-bottom"
  18505. },
  18506. "scroll-padding-inline": {
  18507. syntax: "[ auto | <length-percentage> ]{1,2}",
  18508. media: "visual",
  18509. inherited: false,
  18510. animationType: "byComputedValueType",
  18511. percentages: "relativeToTheScrollContainersScrollport",
  18512. groups: [
  18513. "CSS Scroll Snap"
  18514. ],
  18515. initial: "auto",
  18516. appliesto: "scrollContainers",
  18517. computed: "asSpecified",
  18518. order: "perGrammar",
  18519. status: "standard",
  18520. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline"
  18521. },
  18522. "scroll-padding-inline-start": {
  18523. syntax: "auto | <length-percentage>",
  18524. media: "visual",
  18525. inherited: false,
  18526. animationType: "byComputedValueType",
  18527. percentages: "relativeToTheScrollContainersScrollport",
  18528. groups: [
  18529. "CSS Scroll Snap"
  18530. ],
  18531. initial: "auto",
  18532. appliesto: "scrollContainers",
  18533. computed: "asSpecified",
  18534. order: "perGrammar",
  18535. status: "standard",
  18536. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline-start"
  18537. },
  18538. "scroll-padding-inline-end": {
  18539. syntax: "auto | <length-percentage>",
  18540. media: "visual",
  18541. inherited: false,
  18542. animationType: "byComputedValueType",
  18543. percentages: "relativeToTheScrollContainersScrollport",
  18544. groups: [
  18545. "CSS Scroll Snap"
  18546. ],
  18547. initial: "auto",
  18548. appliesto: "scrollContainers",
  18549. computed: "asSpecified",
  18550. order: "perGrammar",
  18551. status: "standard",
  18552. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline-end"
  18553. },
  18554. "scroll-padding-left": {
  18555. syntax: "auto | <length-percentage>",
  18556. media: "visual",
  18557. inherited: false,
  18558. animationType: "byComputedValueType",
  18559. percentages: "relativeToTheScrollContainersScrollport",
  18560. groups: [
  18561. "CSS Scroll Snap"
  18562. ],
  18563. initial: "auto",
  18564. appliesto: "scrollContainers",
  18565. computed: "asSpecified",
  18566. order: "perGrammar",
  18567. status: "standard",
  18568. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-left"
  18569. },
  18570. "scroll-padding-right": {
  18571. syntax: "auto | <length-percentage>",
  18572. media: "visual",
  18573. inherited: false,
  18574. animationType: "byComputedValueType",
  18575. percentages: "relativeToTheScrollContainersScrollport",
  18576. groups: [
  18577. "CSS Scroll Snap"
  18578. ],
  18579. initial: "auto",
  18580. appliesto: "scrollContainers",
  18581. computed: "asSpecified",
  18582. order: "perGrammar",
  18583. status: "standard",
  18584. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-right"
  18585. },
  18586. "scroll-padding-top": {
  18587. syntax: "auto | <length-percentage>",
  18588. media: "visual",
  18589. inherited: false,
  18590. animationType: "byComputedValueType",
  18591. percentages: "relativeToTheScrollContainersScrollport",
  18592. groups: [
  18593. "CSS Scroll Snap"
  18594. ],
  18595. initial: "auto",
  18596. appliesto: "scrollContainers",
  18597. computed: "asSpecified",
  18598. order: "perGrammar",
  18599. status: "standard",
  18600. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-top"
  18601. },
  18602. "scroll-snap-align": {
  18603. syntax: "[ none | start | end | center ]{1,2}",
  18604. media: "visual",
  18605. inherited: false,
  18606. animationType: "discrete",
  18607. percentages: "no",
  18608. groups: [
  18609. "CSS Scroll Snap"
  18610. ],
  18611. initial: "none",
  18612. appliesto: "allElements",
  18613. computed: "asSpecified",
  18614. order: "perGrammar",
  18615. status: "standard",
  18616. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-align"
  18617. },
  18618. "scroll-snap-coordinate": {
  18619. syntax: "none | <position>#",
  18620. media: "interactive",
  18621. inherited: false,
  18622. animationType: "position",
  18623. percentages: "referToBorderBox",
  18624. groups: [
  18625. "CSS Scroll Snap"
  18626. ],
  18627. initial: "none",
  18628. appliesto: "allElements",
  18629. computed: "asSpecifiedRelativeToAbsoluteLengths",
  18630. order: "uniqueOrder",
  18631. status: "obsolete",
  18632. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-coordinate"
  18633. },
  18634. "scroll-snap-destination": {
  18635. syntax: "<position>",
  18636. media: "interactive",
  18637. inherited: false,
  18638. animationType: "position",
  18639. percentages: "relativeToScrollContainerPaddingBoxAxis",
  18640. groups: [
  18641. "CSS Scroll Snap"
  18642. ],
  18643. initial: "0px 0px",
  18644. appliesto: "scrollContainers",
  18645. computed: "asSpecifiedRelativeToAbsoluteLengths",
  18646. order: "uniqueOrder",
  18647. status: "obsolete",
  18648. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-destination"
  18649. },
  18650. "scroll-snap-points-x": {
  18651. syntax: "none | repeat( <length-percentage> )",
  18652. media: "interactive",
  18653. inherited: false,
  18654. animationType: "discrete",
  18655. percentages: "relativeToScrollContainerPaddingBoxAxis",
  18656. groups: [
  18657. "CSS Scroll Snap"
  18658. ],
  18659. initial: "none",
  18660. appliesto: "scrollContainers",
  18661. computed: "asSpecifiedRelativeToAbsoluteLengths",
  18662. order: "uniqueOrder",
  18663. status: "obsolete",
  18664. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-points-x"
  18665. },
  18666. "scroll-snap-points-y": {
  18667. syntax: "none | repeat( <length-percentage> )",
  18668. media: "interactive",
  18669. inherited: false,
  18670. animationType: "discrete",
  18671. percentages: "relativeToScrollContainerPaddingBoxAxis",
  18672. groups: [
  18673. "CSS Scroll Snap"
  18674. ],
  18675. initial: "none",
  18676. appliesto: "scrollContainers",
  18677. computed: "asSpecifiedRelativeToAbsoluteLengths",
  18678. order: "uniqueOrder",
  18679. status: "obsolete",
  18680. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-points-y"
  18681. },
  18682. "scroll-snap-stop": {
  18683. syntax: "normal | always",
  18684. media: "visual",
  18685. inherited: false,
  18686. animationType: "discrete",
  18687. percentages: "no",
  18688. groups: [
  18689. "CSS Scroll Snap"
  18690. ],
  18691. initial: "normal",
  18692. appliesto: "allElements",
  18693. computed: "asSpecified",
  18694. order: "perGrammar",
  18695. status: "standard",
  18696. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-stop"
  18697. },
  18698. "scroll-snap-type": {
  18699. syntax: "none | [ x | y | block | inline | both ] [ mandatory | proximity ]?",
  18700. media: "interactive",
  18701. inherited: false,
  18702. animationType: "discrete",
  18703. percentages: "no",
  18704. groups: [
  18705. "CSS Scroll Snap"
  18706. ],
  18707. initial: "none",
  18708. appliesto: "allElements",
  18709. computed: "asSpecified",
  18710. order: "uniqueOrder",
  18711. status: "standard",
  18712. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type"
  18713. },
  18714. "scroll-snap-type-x": {
  18715. syntax: "none | mandatory | proximity",
  18716. media: "interactive",
  18717. inherited: false,
  18718. animationType: "discrete",
  18719. percentages: "no",
  18720. groups: [
  18721. "CSS Scroll Snap"
  18722. ],
  18723. initial: "none",
  18724. appliesto: "scrollContainers",
  18725. computed: "asSpecified",
  18726. order: "uniqueOrder",
  18727. status: "obsolete",
  18728. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type-x"
  18729. },
  18730. "scroll-snap-type-y": {
  18731. syntax: "none | mandatory | proximity",
  18732. media: "interactive",
  18733. inherited: false,
  18734. animationType: "discrete",
  18735. percentages: "no",
  18736. groups: [
  18737. "CSS Scroll Snap"
  18738. ],
  18739. initial: "none",
  18740. appliesto: "scrollContainers",
  18741. computed: "asSpecified",
  18742. order: "uniqueOrder",
  18743. status: "obsolete",
  18744. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type-y"
  18745. },
  18746. "shape-image-threshold": {
  18747. syntax: "<alpha-value>",
  18748. media: "visual",
  18749. inherited: false,
  18750. animationType: "number",
  18751. percentages: "no",
  18752. groups: [
  18753. "CSS Shapes"
  18754. ],
  18755. initial: "0.0",
  18756. appliesto: "floats",
  18757. computed: "specifiedValueNumberClipped0To1",
  18758. order: "uniqueOrder",
  18759. status: "standard",
  18760. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/shape-image-threshold"
  18761. },
  18762. "shape-margin": {
  18763. syntax: "<length-percentage>",
  18764. media: "visual",
  18765. inherited: false,
  18766. animationType: "lpc",
  18767. percentages: "referToWidthOfContainingBlock",
  18768. groups: [
  18769. "CSS Shapes"
  18770. ],
  18771. initial: "0",
  18772. appliesto: "floats",
  18773. computed: "asSpecifiedRelativeToAbsoluteLengths",
  18774. order: "uniqueOrder",
  18775. status: "standard",
  18776. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/shape-margin"
  18777. },
  18778. "shape-outside": {
  18779. syntax: "none | <shape-box> || <basic-shape> | <image>",
  18780. media: "visual",
  18781. inherited: false,
  18782. animationType: "basicShapeOtherwiseNo",
  18783. percentages: "no",
  18784. groups: [
  18785. "CSS Shapes"
  18786. ],
  18787. initial: "none",
  18788. appliesto: "floats",
  18789. computed: "asDefinedForBasicShapeWithAbsoluteURIOtherwiseAsSpecified",
  18790. order: "uniqueOrder",
  18791. status: "standard",
  18792. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/shape-outside"
  18793. },
  18794. "tab-size": {
  18795. syntax: "<integer> | <length>",
  18796. media: "visual",
  18797. inherited: true,
  18798. animationType: "length",
  18799. percentages: "no",
  18800. groups: [
  18801. "CSS Text"
  18802. ],
  18803. initial: "8",
  18804. appliesto: "blockContainers",
  18805. computed: "specifiedIntegerOrAbsoluteLength",
  18806. order: "uniqueOrder",
  18807. status: "standard",
  18808. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/tab-size"
  18809. },
  18810. "table-layout": {
  18811. syntax: "auto | fixed",
  18812. media: "visual",
  18813. inherited: false,
  18814. animationType: "discrete",
  18815. percentages: "no",
  18816. groups: [
  18817. "CSS Table"
  18818. ],
  18819. initial: "auto",
  18820. appliesto: "tableElements",
  18821. computed: "asSpecified",
  18822. order: "uniqueOrder",
  18823. status: "standard",
  18824. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/table-layout"
  18825. },
  18826. "text-align": {
  18827. syntax: "start | end | left | right | center | justify | match-parent",
  18828. media: "visual",
  18829. inherited: true,
  18830. animationType: "discrete",
  18831. percentages: "no",
  18832. groups: [
  18833. "CSS Text"
  18834. ],
  18835. initial: "startOrNamelessValueIfLTRRightIfRTL",
  18836. appliesto: "blockContainers",
  18837. computed: "asSpecifiedExceptMatchParent",
  18838. order: "orderOfAppearance",
  18839. alsoAppliesTo: [
  18840. "::placeholder"
  18841. ],
  18842. status: "standard",
  18843. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-align"
  18844. },
  18845. "text-align-last": {
  18846. syntax: "auto | start | end | left | right | center | justify",
  18847. media: "visual",
  18848. inherited: true,
  18849. animationType: "discrete",
  18850. percentages: "no",
  18851. groups: [
  18852. "CSS Text"
  18853. ],
  18854. initial: "auto",
  18855. appliesto: "blockContainers",
  18856. computed: "asSpecified",
  18857. order: "uniqueOrder",
  18858. status: "standard",
  18859. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-align-last"
  18860. },
  18861. "text-combine-upright": {
  18862. syntax: "none | all | [ digits <integer>? ]",
  18863. media: "visual",
  18864. inherited: true,
  18865. animationType: "notAnimatable",
  18866. percentages: "no",
  18867. groups: [
  18868. "CSS Writing Modes"
  18869. ],
  18870. initial: "none",
  18871. appliesto: "nonReplacedInlineElements",
  18872. computed: "keywordPlusIntegerIfDigits",
  18873. order: "uniqueOrder",
  18874. status: "standard",
  18875. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-combine-upright"
  18876. },
  18877. "text-decoration": {
  18878. syntax: "<'text-decoration-line'> || <'text-decoration-style'> || <'text-decoration-color'> || <'text-decoration-thickness'>",
  18879. media: "visual",
  18880. inherited: false,
  18881. animationType: [
  18882. "text-decoration-color",
  18883. "text-decoration-style",
  18884. "text-decoration-line",
  18885. "text-decoration-thickness"
  18886. ],
  18887. percentages: "no",
  18888. groups: [
  18889. "CSS Text Decoration"
  18890. ],
  18891. initial: [
  18892. "text-decoration-color",
  18893. "text-decoration-style",
  18894. "text-decoration-line"
  18895. ],
  18896. appliesto: "allElements",
  18897. computed: [
  18898. "text-decoration-line",
  18899. "text-decoration-style",
  18900. "text-decoration-color",
  18901. "text-decoration-thickness"
  18902. ],
  18903. order: "orderOfAppearance",
  18904. alsoAppliesTo: [
  18905. "::first-letter",
  18906. "::first-line",
  18907. "::placeholder"
  18908. ],
  18909. status: "standard",
  18910. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration"
  18911. },
  18912. "text-decoration-color": {
  18913. syntax: "<color>",
  18914. media: "visual",
  18915. inherited: false,
  18916. animationType: "color",
  18917. percentages: "no",
  18918. groups: [
  18919. "CSS Text Decoration"
  18920. ],
  18921. initial: "currentcolor",
  18922. appliesto: "allElements",
  18923. computed: "computedColor",
  18924. order: "uniqueOrder",
  18925. alsoAppliesTo: [
  18926. "::first-letter",
  18927. "::first-line",
  18928. "::placeholder"
  18929. ],
  18930. status: "standard",
  18931. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-color"
  18932. },
  18933. "text-decoration-line": {
  18934. syntax: "none | [ underline || overline || line-through || blink ] | spelling-error | grammar-error",
  18935. media: "visual",
  18936. inherited: false,
  18937. animationType: "discrete",
  18938. percentages: "no",
  18939. groups: [
  18940. "CSS Text Decoration"
  18941. ],
  18942. initial: "none",
  18943. appliesto: "allElements",
  18944. computed: "asSpecified",
  18945. order: "orderOfAppearance",
  18946. alsoAppliesTo: [
  18947. "::first-letter",
  18948. "::first-line",
  18949. "::placeholder"
  18950. ],
  18951. status: "standard",
  18952. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-line"
  18953. },
  18954. "text-decoration-skip": {
  18955. syntax: "none | [ objects || [ spaces | [ leading-spaces || trailing-spaces ] ] || edges || box-decoration ]",
  18956. media: "visual",
  18957. inherited: true,
  18958. animationType: "discrete",
  18959. percentages: "no",
  18960. groups: [
  18961. "CSS Text Decoration"
  18962. ],
  18963. initial: "objects",
  18964. appliesto: "allElements",
  18965. computed: "asSpecified",
  18966. order: "orderOfAppearance",
  18967. status: "experimental",
  18968. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-skip"
  18969. },
  18970. "text-decoration-skip-ink": {
  18971. syntax: "auto | all | none",
  18972. media: "visual",
  18973. inherited: true,
  18974. animationType: "discrete",
  18975. percentages: "no",
  18976. groups: [
  18977. "CSS Text Decoration"
  18978. ],
  18979. initial: "auto",
  18980. appliesto: "allElements",
  18981. computed: "asSpecified",
  18982. order: "orderOfAppearance",
  18983. status: "standard",
  18984. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-skip-ink"
  18985. },
  18986. "text-decoration-style": {
  18987. syntax: "solid | double | dotted | dashed | wavy",
  18988. media: "visual",
  18989. inherited: false,
  18990. animationType: "discrete",
  18991. percentages: "no",
  18992. groups: [
  18993. "CSS Text Decoration"
  18994. ],
  18995. initial: "solid",
  18996. appliesto: "allElements",
  18997. computed: "asSpecified",
  18998. order: "uniqueOrder",
  18999. alsoAppliesTo: [
  19000. "::first-letter",
  19001. "::first-line",
  19002. "::placeholder"
  19003. ],
  19004. status: "standard",
  19005. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-style"
  19006. },
  19007. "text-decoration-thickness": {
  19008. syntax: "auto | from-font | <length> | <percentage> ",
  19009. media: "visual",
  19010. inherited: false,
  19011. animationType: "byComputedValueType",
  19012. percentages: "referToElementFontSize",
  19013. groups: [
  19014. "CSS Text Decoration"
  19015. ],
  19016. initial: "auto",
  19017. appliesto: "allElements",
  19018. computed: "asSpecified",
  19019. order: "uniqueOrder",
  19020. alsoAppliesTo: [
  19021. "::first-letter",
  19022. "::first-line",
  19023. "::placeholder"
  19024. ],
  19025. status: "standard",
  19026. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-thickness"
  19027. },
  19028. "text-emphasis": {
  19029. syntax: "<'text-emphasis-style'> || <'text-emphasis-color'>",
  19030. media: "visual",
  19031. inherited: false,
  19032. animationType: [
  19033. "text-emphasis-color",
  19034. "text-emphasis-style"
  19035. ],
  19036. percentages: "no",
  19037. groups: [
  19038. "CSS Text Decoration"
  19039. ],
  19040. initial: [
  19041. "text-emphasis-style",
  19042. "text-emphasis-color"
  19043. ],
  19044. appliesto: "allElements",
  19045. computed: [
  19046. "text-emphasis-style",
  19047. "text-emphasis-color"
  19048. ],
  19049. order: "orderOfAppearance",
  19050. status: "standard",
  19051. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-emphasis"
  19052. },
  19053. "text-emphasis-color": {
  19054. syntax: "<color>",
  19055. media: "visual",
  19056. inherited: false,
  19057. animationType: "color",
  19058. percentages: "no",
  19059. groups: [
  19060. "CSS Text Decoration"
  19061. ],
  19062. initial: "currentcolor",
  19063. appliesto: "allElements",
  19064. computed: "computedColor",
  19065. order: "uniqueOrder",
  19066. status: "standard",
  19067. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-emphasis-color"
  19068. },
  19069. "text-emphasis-position": {
  19070. syntax: "[ over | under ] && [ right | left ]",
  19071. media: "visual",
  19072. inherited: false,
  19073. animationType: "discrete",
  19074. percentages: "no",
  19075. groups: [
  19076. "CSS Text Decoration"
  19077. ],
  19078. initial: "over right",
  19079. appliesto: "allElements",
  19080. computed: "asSpecified",
  19081. order: "uniqueOrder",
  19082. status: "standard",
  19083. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-emphasis-position"
  19084. },
  19085. "text-emphasis-style": {
  19086. syntax: "none | [ [ filled | open ] || [ dot | circle | double-circle | triangle | sesame ] ] | <string>",
  19087. media: "visual",
  19088. inherited: false,
  19089. animationType: "discrete",
  19090. percentages: "no",
  19091. groups: [
  19092. "CSS Text Decoration"
  19093. ],
  19094. initial: "none",
  19095. appliesto: "allElements",
  19096. computed: "asSpecified",
  19097. order: "uniqueOrder",
  19098. status: "standard",
  19099. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-emphasis-style"
  19100. },
  19101. "text-indent": {
  19102. syntax: "<length-percentage> && hanging? && each-line?",
  19103. media: "visual",
  19104. inherited: true,
  19105. animationType: "lpc",
  19106. percentages: "referToWidthOfContainingBlock",
  19107. groups: [
  19108. "CSS Text"
  19109. ],
  19110. initial: "0",
  19111. appliesto: "blockContainers",
  19112. computed: "percentageOrAbsoluteLengthPlusKeywords",
  19113. order: "lengthOrPercentageBeforeKeywords",
  19114. status: "standard",
  19115. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-indent"
  19116. },
  19117. "text-justify": {
  19118. syntax: "auto | inter-character | inter-word | none",
  19119. media: "visual",
  19120. inherited: true,
  19121. animationType: "discrete",
  19122. percentages: "no",
  19123. groups: [
  19124. "CSS Text"
  19125. ],
  19126. initial: "auto",
  19127. appliesto: "inlineLevelAndTableCellElements",
  19128. computed: "asSpecified",
  19129. order: "uniqueOrder",
  19130. status: "standard",
  19131. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-justify"
  19132. },
  19133. "text-orientation": {
  19134. syntax: "mixed | upright | sideways",
  19135. media: "visual",
  19136. inherited: true,
  19137. animationType: "discrete",
  19138. percentages: "no",
  19139. groups: [
  19140. "CSS Writing Modes"
  19141. ],
  19142. initial: "mixed",
  19143. appliesto: "allElementsExceptTableRowGroupsRowsColumnGroupsAndColumns",
  19144. computed: "asSpecified",
  19145. order: "uniqueOrder",
  19146. status: "standard",
  19147. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-orientation"
  19148. },
  19149. "text-overflow": {
  19150. syntax: "[ clip | ellipsis | <string> ]{1,2}",
  19151. media: "visual",
  19152. inherited: false,
  19153. animationType: "discrete",
  19154. percentages: "no",
  19155. groups: [
  19156. "CSS Basic User Interface"
  19157. ],
  19158. initial: "clip",
  19159. appliesto: "blockContainerElements",
  19160. computed: "asSpecified",
  19161. order: "uniqueOrder",
  19162. alsoAppliesTo: [
  19163. "::placeholder"
  19164. ],
  19165. status: "standard",
  19166. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-overflow"
  19167. },
  19168. "text-rendering": {
  19169. syntax: "auto | optimizeSpeed | optimizeLegibility | geometricPrecision",
  19170. media: "visual",
  19171. inherited: true,
  19172. animationType: "discrete",
  19173. percentages: "no",
  19174. groups: [
  19175. "CSS Miscellaneous"
  19176. ],
  19177. initial: "auto",
  19178. appliesto: "textElements",
  19179. computed: "asSpecified",
  19180. order: "uniqueOrder",
  19181. status: "standard",
  19182. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-rendering"
  19183. },
  19184. "text-shadow": {
  19185. syntax: "none | <shadow-t>#",
  19186. media: "visual",
  19187. inherited: true,
  19188. animationType: "shadowList",
  19189. percentages: "no",
  19190. groups: [
  19191. "CSS Text Decoration"
  19192. ],
  19193. initial: "none",
  19194. appliesto: "allElements",
  19195. computed: "colorPlusThreeAbsoluteLengths",
  19196. order: "uniqueOrder",
  19197. alsoAppliesTo: [
  19198. "::first-letter",
  19199. "::first-line",
  19200. "::placeholder"
  19201. ],
  19202. status: "standard",
  19203. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-shadow"
  19204. },
  19205. "text-size-adjust": {
  19206. syntax: "none | auto | <percentage>",
  19207. media: "visual",
  19208. inherited: true,
  19209. animationType: "discrete",
  19210. percentages: "referToSizeOfFont",
  19211. groups: [
  19212. "CSS Text"
  19213. ],
  19214. initial: "autoForSmartphoneBrowsersSupportingInflation",
  19215. appliesto: "allElements",
  19216. computed: "asSpecified",
  19217. order: "uniqueOrder",
  19218. status: "experimental",
  19219. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-size-adjust"
  19220. },
  19221. "text-transform": {
  19222. syntax: "none | capitalize | uppercase | lowercase | full-width | full-size-kana",
  19223. media: "visual",
  19224. inherited: true,
  19225. animationType: "discrete",
  19226. percentages: "no",
  19227. groups: [
  19228. "CSS Text"
  19229. ],
  19230. initial: "none",
  19231. appliesto: "allElements",
  19232. computed: "asSpecified",
  19233. order: "uniqueOrder",
  19234. alsoAppliesTo: [
  19235. "::first-letter",
  19236. "::first-line",
  19237. "::placeholder"
  19238. ],
  19239. status: "standard",
  19240. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-transform"
  19241. },
  19242. "text-underline-offset": {
  19243. syntax: "auto | <length> | <percentage> ",
  19244. media: "visual",
  19245. inherited: true,
  19246. animationType: "byComputedValueType",
  19247. percentages: "referToElementFontSize",
  19248. groups: [
  19249. "CSS Text Decoration"
  19250. ],
  19251. initial: "auto",
  19252. appliesto: "allElements",
  19253. computed: "asSpecified",
  19254. order: "uniqueOrder",
  19255. alsoAppliesTo: [
  19256. "::first-letter",
  19257. "::first-line",
  19258. "::placeholder"
  19259. ],
  19260. status: "standard",
  19261. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-underline-offset"
  19262. },
  19263. "text-underline-position": {
  19264. syntax: "auto | from-font | [ under || [ left | right ] ]",
  19265. media: "visual",
  19266. inherited: true,
  19267. animationType: "discrete",
  19268. percentages: "no",
  19269. groups: [
  19270. "CSS Text Decoration"
  19271. ],
  19272. initial: "auto",
  19273. appliesto: "allElements",
  19274. computed: "asSpecified",
  19275. order: "orderOfAppearance",
  19276. status: "standard",
  19277. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-underline-position"
  19278. },
  19279. top: top,
  19280. "touch-action": {
  19281. syntax: "auto | none | [ [ pan-x | pan-left | pan-right ] || [ pan-y | pan-up | pan-down ] || pinch-zoom ] | manipulation",
  19282. media: "visual",
  19283. inherited: false,
  19284. animationType: "discrete",
  19285. percentages: "no",
  19286. groups: [
  19287. "Pointer Events"
  19288. ],
  19289. initial: "auto",
  19290. appliesto: "allElementsExceptNonReplacedInlineElementsTableRowsColumnsRowColumnGroups",
  19291. computed: "asSpecified",
  19292. order: "uniqueOrder",
  19293. status: "standard",
  19294. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/touch-action"
  19295. },
  19296. transform: transform,
  19297. "transform-box": {
  19298. syntax: "content-box | border-box | fill-box | stroke-box | view-box",
  19299. media: "visual",
  19300. inherited: false,
  19301. animationType: "discrete",
  19302. percentages: "no",
  19303. groups: [
  19304. "CSS Transforms"
  19305. ],
  19306. initial: "view-box",
  19307. appliesto: "transformableElements",
  19308. computed: "asSpecified",
  19309. order: "perGrammar",
  19310. status: "standard",
  19311. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform-box"
  19312. },
  19313. "transform-origin": {
  19314. syntax: "[ <length-percentage> | left | center | right | top | bottom ] | [ [ <length-percentage> | left | center | right ] && [ <length-percentage> | top | center | bottom ] ] <length>?",
  19315. media: "visual",
  19316. inherited: false,
  19317. animationType: "simpleListOfLpc",
  19318. percentages: "referToSizeOfBoundingBox",
  19319. groups: [
  19320. "CSS Transforms"
  19321. ],
  19322. initial: "50% 50% 0",
  19323. appliesto: "transformableElements",
  19324. computed: "forLengthAbsoluteValueOtherwisePercentage",
  19325. order: "oneOrTwoValuesLengthAbsoluteKeywordsPercentages",
  19326. status: "standard",
  19327. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform-origin"
  19328. },
  19329. "transform-style": {
  19330. syntax: "flat | preserve-3d",
  19331. media: "visual",
  19332. inherited: false,
  19333. animationType: "discrete",
  19334. percentages: "no",
  19335. groups: [
  19336. "CSS Transforms"
  19337. ],
  19338. initial: "flat",
  19339. appliesto: "transformableElements",
  19340. computed: "asSpecified",
  19341. order: "uniqueOrder",
  19342. stacking: true,
  19343. status: "standard",
  19344. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform-style"
  19345. },
  19346. transition: transition,
  19347. "transition-delay": {
  19348. syntax: "<time>#",
  19349. media: "interactive",
  19350. inherited: false,
  19351. animationType: "discrete",
  19352. percentages: "no",
  19353. groups: [
  19354. "CSS Transitions"
  19355. ],
  19356. initial: "0s",
  19357. appliesto: "allElementsAndPseudos",
  19358. computed: "asSpecified",
  19359. order: "uniqueOrder",
  19360. status: "standard",
  19361. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition-delay"
  19362. },
  19363. "transition-duration": {
  19364. syntax: "<time>#",
  19365. media: "interactive",
  19366. inherited: false,
  19367. animationType: "discrete",
  19368. percentages: "no",
  19369. groups: [
  19370. "CSS Transitions"
  19371. ],
  19372. initial: "0s",
  19373. appliesto: "allElementsAndPseudos",
  19374. computed: "asSpecified",
  19375. order: "uniqueOrder",
  19376. status: "standard",
  19377. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition-duration"
  19378. },
  19379. "transition-property": {
  19380. syntax: "none | <single-transition-property>#",
  19381. media: "visual",
  19382. inherited: false,
  19383. animationType: "discrete",
  19384. percentages: "no",
  19385. groups: [
  19386. "CSS Transitions"
  19387. ],
  19388. initial: "all",
  19389. appliesto: "allElementsAndPseudos",
  19390. computed: "asSpecified",
  19391. order: "uniqueOrder",
  19392. status: "standard",
  19393. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition-property"
  19394. },
  19395. "transition-timing-function": {
  19396. syntax: "<timing-function>#",
  19397. media: "interactive",
  19398. inherited: false,
  19399. animationType: "discrete",
  19400. percentages: "no",
  19401. groups: [
  19402. "CSS Transitions"
  19403. ],
  19404. initial: "ease",
  19405. appliesto: "allElementsAndPseudos",
  19406. computed: "asSpecified",
  19407. order: "uniqueOrder",
  19408. status: "standard",
  19409. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition-timing-function"
  19410. },
  19411. translate: translate,
  19412. "unicode-bidi": {
  19413. syntax: "normal | embed | isolate | bidi-override | isolate-override | plaintext",
  19414. media: "visual",
  19415. inherited: false,
  19416. animationType: "discrete",
  19417. percentages: "no",
  19418. groups: [
  19419. "CSS Writing Modes"
  19420. ],
  19421. initial: "normal",
  19422. appliesto: "allElementsSomeValuesNoEffectOnNonInlineElements",
  19423. computed: "asSpecified",
  19424. order: "uniqueOrder",
  19425. status: "standard",
  19426. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/unicode-bidi"
  19427. },
  19428. "user-select": {
  19429. syntax: "auto | text | none | contain | all",
  19430. media: "visual",
  19431. inherited: false,
  19432. animationType: "discrete",
  19433. percentages: "no",
  19434. groups: [
  19435. "CSS Basic User Interface"
  19436. ],
  19437. initial: "auto",
  19438. appliesto: "allElements",
  19439. computed: "asSpecified",
  19440. order: "uniqueOrder",
  19441. status: "nonstandard",
  19442. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/user-select"
  19443. },
  19444. "vertical-align": {
  19445. syntax: "baseline | sub | super | text-top | text-bottom | middle | top | bottom | <percentage> | <length>",
  19446. media: "visual",
  19447. inherited: false,
  19448. animationType: "length",
  19449. percentages: "referToLineHeight",
  19450. groups: [
  19451. "CSS Table"
  19452. ],
  19453. initial: "baseline",
  19454. appliesto: "inlineLevelAndTableCellElements",
  19455. computed: "absoluteLengthOrKeyword",
  19456. order: "uniqueOrder",
  19457. alsoAppliesTo: [
  19458. "::first-letter",
  19459. "::first-line",
  19460. "::placeholder"
  19461. ],
  19462. status: "standard",
  19463. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/vertical-align"
  19464. },
  19465. visibility: visibility,
  19466. "white-space": {
  19467. syntax: "normal | pre | nowrap | pre-wrap | pre-line | break-spaces",
  19468. media: "visual",
  19469. inherited: true,
  19470. animationType: "discrete",
  19471. percentages: "no",
  19472. groups: [
  19473. "CSS Text"
  19474. ],
  19475. initial: "normal",
  19476. appliesto: "allElements",
  19477. computed: "asSpecified",
  19478. order: "uniqueOrder",
  19479. status: "standard",
  19480. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/white-space"
  19481. },
  19482. widows: widows,
  19483. width: width,
  19484. "will-change": {
  19485. syntax: "auto | <animateable-feature>#",
  19486. media: "all",
  19487. inherited: false,
  19488. animationType: "discrete",
  19489. percentages: "no",
  19490. groups: [
  19491. "CSS Will Change"
  19492. ],
  19493. initial: "auto",
  19494. appliesto: "allElements",
  19495. computed: "asSpecified",
  19496. order: "uniqueOrder",
  19497. status: "standard",
  19498. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/will-change"
  19499. },
  19500. "word-break": {
  19501. syntax: "normal | break-all | keep-all | break-word",
  19502. media: "visual",
  19503. inherited: true,
  19504. animationType: "discrete",
  19505. percentages: "no",
  19506. groups: [
  19507. "CSS Text"
  19508. ],
  19509. initial: "normal",
  19510. appliesto: "allElements",
  19511. computed: "asSpecified",
  19512. order: "uniqueOrder",
  19513. status: "standard",
  19514. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/word-break"
  19515. },
  19516. "word-spacing": {
  19517. syntax: "normal | <length-percentage>",
  19518. media: "visual",
  19519. inherited: true,
  19520. animationType: "length",
  19521. percentages: "referToWidthOfAffectedGlyph",
  19522. groups: [
  19523. "CSS Text"
  19524. ],
  19525. initial: "normal",
  19526. appliesto: "allElements",
  19527. computed: "optimumMinAndMaxValueOfAbsoluteLengthPercentageOrNormal",
  19528. order: "uniqueOrder",
  19529. alsoAppliesTo: [
  19530. "::first-letter",
  19531. "::first-line",
  19532. "::placeholder"
  19533. ],
  19534. status: "standard",
  19535. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/word-spacing"
  19536. },
  19537. "word-wrap": {
  19538. syntax: "normal | break-word",
  19539. media: "visual",
  19540. inherited: true,
  19541. animationType: "discrete",
  19542. percentages: "no",
  19543. groups: [
  19544. "CSS Text"
  19545. ],
  19546. initial: "normal",
  19547. appliesto: "nonReplacedInlineElements",
  19548. computed: "asSpecified",
  19549. order: "uniqueOrder",
  19550. status: "standard",
  19551. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-wrap"
  19552. },
  19553. "writing-mode": {
  19554. syntax: "horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr",
  19555. media: "visual",
  19556. inherited: true,
  19557. animationType: "discrete",
  19558. percentages: "no",
  19559. groups: [
  19560. "CSS Writing Modes"
  19561. ],
  19562. initial: "horizontal-tb",
  19563. appliesto: "allElementsExceptTableRowColumnGroupsTableRowsColumns",
  19564. computed: "asSpecified",
  19565. order: "uniqueOrder",
  19566. status: "standard",
  19567. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/writing-mode"
  19568. },
  19569. "z-index": {
  19570. syntax: "auto | <integer>",
  19571. media: "visual",
  19572. inherited: false,
  19573. animationType: "integer",
  19574. percentages: "no",
  19575. groups: [
  19576. "CSS Positioning"
  19577. ],
  19578. initial: "auto",
  19579. appliesto: "positionedElements",
  19580. computed: "asSpecified",
  19581. order: "uniqueOrder",
  19582. stacking: true,
  19583. status: "standard",
  19584. mdn_url: "https://developer.mozilla.org/docs/Web/CSS/z-index"
  19585. },
  19586. zoom: zoom
  19587. };
  19588. var attachment = {
  19589. syntax: "scroll | fixed | local"
  19590. };
  19591. var box = {
  19592. syntax: "border-box | padding-box | content-box"
  19593. };
  19594. var color = {
  19595. syntax: "<rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>"
  19596. };
  19597. var combinator = {
  19598. syntax: "'>' | '+' | '~' | [ '||' ]"
  19599. };
  19600. var gradient = {
  19601. syntax: "<linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> | <repeating-radial-gradient()> | <conic-gradient()>"
  19602. };
  19603. var hue = {
  19604. syntax: "<number> | <angle>"
  19605. };
  19606. var image = {
  19607. syntax: "<url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>"
  19608. };
  19609. var nth$1 = {
  19610. syntax: "<an-plus-b> | even | odd"
  19611. };
  19612. var position = {
  19613. 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> ] ]"
  19614. };
  19615. var quote = {
  19616. syntax: "open-quote | close-quote | no-open-quote | no-close-quote"
  19617. };
  19618. var shadow = {
  19619. syntax: "inset? && <length>{2,4} && <color>?"
  19620. };
  19621. var shape = {
  19622. syntax: "rect(<top>, <right>, <bottom>, <left>)"
  19623. };
  19624. var size = {
  19625. syntax: "closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}"
  19626. };
  19627. var symbol = {
  19628. syntax: "<string> | <image> | <custom-ident>"
  19629. };
  19630. var target = {
  19631. syntax: "<target-counter()> | <target-counters()> | <target-text()>"
  19632. };
  19633. var require$$2 = {
  19634. "absolute-size": {
  19635. syntax: "xx-small | x-small | small | medium | large | x-large | xx-large | xxx-large"
  19636. },
  19637. "alpha-value": {
  19638. syntax: "<number> | <percentage>"
  19639. },
  19640. "angle-percentage": {
  19641. syntax: "<angle> | <percentage>"
  19642. },
  19643. "angular-color-hint": {
  19644. syntax: "<angle-percentage>"
  19645. },
  19646. "angular-color-stop": {
  19647. syntax: "<color> && <color-stop-angle>?"
  19648. },
  19649. "angular-color-stop-list": {
  19650. syntax: "[ <angular-color-stop> [, <angular-color-hint>]? ]# , <angular-color-stop>"
  19651. },
  19652. "animateable-feature": {
  19653. syntax: "scroll-position | contents | <custom-ident>"
  19654. },
  19655. attachment: attachment,
  19656. "attr()": {
  19657. syntax: "attr( <attr-name> <type-or-unit>? [, <attr-fallback> ]? )"
  19658. },
  19659. "attr-matcher": {
  19660. syntax: "[ '~' | '|' | '^' | '$' | '*' ]? '='"
  19661. },
  19662. "attr-modifier": {
  19663. syntax: "i | s"
  19664. },
  19665. "attribute-selector": {
  19666. syntax: "'[' <wq-name> ']' | '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'"
  19667. },
  19668. "auto-repeat": {
  19669. syntax: "repeat( [ auto-fill | auto-fit ] , [ <line-names>? <fixed-size> ]+ <line-names>? )"
  19670. },
  19671. "auto-track-list": {
  19672. syntax: "[ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>? <auto-repeat>\n[ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>?"
  19673. },
  19674. "baseline-position": {
  19675. syntax: "[ first | last ]? baseline"
  19676. },
  19677. "basic-shape": {
  19678. syntax: "<inset()> | <circle()> | <ellipse()> | <polygon()> | <path()>"
  19679. },
  19680. "bg-image": {
  19681. syntax: "none | <image>"
  19682. },
  19683. "bg-layer": {
  19684. syntax: "<bg-image> || <bg-position> [ / <bg-size> ]? || <repeat-style> || <attachment> || <box> || <box>"
  19685. },
  19686. "bg-position": {
  19687. 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>? ] ]"
  19688. },
  19689. "bg-size": {
  19690. syntax: "[ <length-percentage> | auto ]{1,2} | cover | contain"
  19691. },
  19692. "blur()": {
  19693. syntax: "blur( <length> )"
  19694. },
  19695. "blend-mode": {
  19696. syntax: "normal | multiply | screen | overlay | darken | lighten | color-dodge | color-burn | hard-light | soft-light | difference | exclusion | hue | saturation | color | luminosity"
  19697. },
  19698. box: box,
  19699. "brightness()": {
  19700. syntax: "brightness( <number-percentage> )"
  19701. },
  19702. "calc()": {
  19703. syntax: "calc( <calc-sum> )"
  19704. },
  19705. "calc-sum": {
  19706. syntax: "<calc-product> [ [ '+' | '-' ] <calc-product> ]*"
  19707. },
  19708. "calc-product": {
  19709. syntax: "<calc-value> [ '*' <calc-value> | '/' <number> ]*"
  19710. },
  19711. "calc-value": {
  19712. syntax: "<number> | <dimension> | <percentage> | ( <calc-sum> )"
  19713. },
  19714. "cf-final-image": {
  19715. syntax: "<image> | <color>"
  19716. },
  19717. "cf-mixing-image": {
  19718. syntax: "<percentage>? && <image>"
  19719. },
  19720. "circle()": {
  19721. syntax: "circle( [ <shape-radius> ]? [ at <position> ]? )"
  19722. },
  19723. "clamp()": {
  19724. syntax: "clamp( <calc-sum>#{3} )"
  19725. },
  19726. "class-selector": {
  19727. syntax: "'.' <ident-token>"
  19728. },
  19729. "clip-source": {
  19730. syntax: "<url>"
  19731. },
  19732. color: color,
  19733. "color-stop": {
  19734. syntax: "<color-stop-length> | <color-stop-angle>"
  19735. },
  19736. "color-stop-angle": {
  19737. syntax: "<angle-percentage>{1,2}"
  19738. },
  19739. "color-stop-length": {
  19740. syntax: "<length-percentage>{1,2}"
  19741. },
  19742. "color-stop-list": {
  19743. syntax: "[ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop>"
  19744. },
  19745. combinator: combinator,
  19746. "common-lig-values": {
  19747. syntax: "[ common-ligatures | no-common-ligatures ]"
  19748. },
  19749. "compat-auto": {
  19750. syntax: "searchfield | textarea | push-button | slider-horizontal | checkbox | radio | square-button | menulist | listbox | meter | progress-bar | button"
  19751. },
  19752. "composite-style": {
  19753. syntax: "clear | copy | source-over | source-in | source-out | source-atop | destination-over | destination-in | destination-out | destination-atop | xor"
  19754. },
  19755. "compositing-operator": {
  19756. syntax: "add | subtract | intersect | exclude"
  19757. },
  19758. "compound-selector": {
  19759. syntax: "[ <type-selector>? <subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!"
  19760. },
  19761. "compound-selector-list": {
  19762. syntax: "<compound-selector>#"
  19763. },
  19764. "complex-selector": {
  19765. syntax: "<compound-selector> [ <combinator>? <compound-selector> ]*"
  19766. },
  19767. "complex-selector-list": {
  19768. syntax: "<complex-selector>#"
  19769. },
  19770. "conic-gradient()": {
  19771. syntax: "conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )"
  19772. },
  19773. "contextual-alt-values": {
  19774. syntax: "[ contextual | no-contextual ]"
  19775. },
  19776. "content-distribution": {
  19777. syntax: "space-between | space-around | space-evenly | stretch"
  19778. },
  19779. "content-list": {
  19780. syntax: "[ <string> | contents | <image> | <quote> | <target> | <leader()> ]+"
  19781. },
  19782. "content-position": {
  19783. syntax: "center | start | end | flex-start | flex-end"
  19784. },
  19785. "content-replacement": {
  19786. syntax: "<image>"
  19787. },
  19788. "contrast()": {
  19789. syntax: "contrast( [ <number-percentage> ] )"
  19790. },
  19791. "counter()": {
  19792. syntax: "counter( <custom-ident>, <counter-style>? )"
  19793. },
  19794. "counter-style": {
  19795. syntax: "<counter-style-name> | symbols()"
  19796. },
  19797. "counter-style-name": {
  19798. syntax: "<custom-ident>"
  19799. },
  19800. "counters()": {
  19801. syntax: "counters( <custom-ident>, <string>, <counter-style>? )"
  19802. },
  19803. "cross-fade()": {
  19804. syntax: "cross-fade( <cf-mixing-image> , <cf-final-image>? )"
  19805. },
  19806. "cubic-bezier-timing-function": {
  19807. syntax: "ease | ease-in | ease-out | ease-in-out | cubic-bezier(<number [0,1]>, <number>, <number [0,1]>, <number>)"
  19808. },
  19809. "deprecated-system-color": {
  19810. 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"
  19811. },
  19812. "discretionary-lig-values": {
  19813. syntax: "[ discretionary-ligatures | no-discretionary-ligatures ]"
  19814. },
  19815. "display-box": {
  19816. syntax: "contents | none"
  19817. },
  19818. "display-inside": {
  19819. syntax: "flow | flow-root | table | flex | grid | ruby"
  19820. },
  19821. "display-internal": {
  19822. 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"
  19823. },
  19824. "display-legacy": {
  19825. syntax: "inline-block | inline-list-item | inline-table | inline-flex | inline-grid"
  19826. },
  19827. "display-listitem": {
  19828. syntax: "<display-outside>? && [ flow | flow-root ]? && list-item"
  19829. },
  19830. "display-outside": {
  19831. syntax: "block | inline | run-in"
  19832. },
  19833. "drop-shadow()": {
  19834. syntax: "drop-shadow( <length>{2,3} <color>? )"
  19835. },
  19836. "east-asian-variant-values": {
  19837. syntax: "[ jis78 | jis83 | jis90 | jis04 | simplified | traditional ]"
  19838. },
  19839. "east-asian-width-values": {
  19840. syntax: "[ full-width | proportional-width ]"
  19841. },
  19842. "element()": {
  19843. syntax: "element( <id-selector> )"
  19844. },
  19845. "ellipse()": {
  19846. syntax: "ellipse( [ <shape-radius>{2} ]? [ at <position> ]? )"
  19847. },
  19848. "ending-shape": {
  19849. syntax: "circle | ellipse"
  19850. },
  19851. "env()": {
  19852. syntax: "env( <custom-ident> , <declaration-value>? )"
  19853. },
  19854. "explicit-track-list": {
  19855. syntax: "[ <line-names>? <track-size> ]+ <line-names>?"
  19856. },
  19857. "family-name": {
  19858. syntax: "<string> | <custom-ident>+"
  19859. },
  19860. "feature-tag-value": {
  19861. syntax: "<string> [ <integer> | on | off ]?"
  19862. },
  19863. "feature-type": {
  19864. syntax: "@stylistic | @historical-forms | @styleset | @character-variant | @swash | @ornaments | @annotation"
  19865. },
  19866. "feature-value-block": {
  19867. syntax: "<feature-type> '{' <feature-value-declaration-list> '}'"
  19868. },
  19869. "feature-value-block-list": {
  19870. syntax: "<feature-value-block>+"
  19871. },
  19872. "feature-value-declaration": {
  19873. syntax: "<custom-ident>: <integer>+;"
  19874. },
  19875. "feature-value-declaration-list": {
  19876. syntax: "<feature-value-declaration>"
  19877. },
  19878. "feature-value-name": {
  19879. syntax: "<custom-ident>"
  19880. },
  19881. "fill-rule": {
  19882. syntax: "nonzero | evenodd"
  19883. },
  19884. "filter-function": {
  19885. syntax: "<blur()> | <brightness()> | <contrast()> | <drop-shadow()> | <grayscale()> | <hue-rotate()> | <invert()> | <opacity()> | <saturate()> | <sepia()>"
  19886. },
  19887. "filter-function-list": {
  19888. syntax: "[ <filter-function> | <url> ]+"
  19889. },
  19890. "final-bg-layer": {
  19891. syntax: "<'background-color'> || <bg-image> || <bg-position> [ / <bg-size> ]? || <repeat-style> || <attachment> || <box> || <box>"
  19892. },
  19893. "fit-content()": {
  19894. syntax: "fit-content( [ <length> | <percentage> ] )"
  19895. },
  19896. "fixed-breadth": {
  19897. syntax: "<length-percentage>"
  19898. },
  19899. "fixed-repeat": {
  19900. syntax: "repeat( [ <positive-integer> ] , [ <line-names>? <fixed-size> ]+ <line-names>? )"
  19901. },
  19902. "fixed-size": {
  19903. syntax: "<fixed-breadth> | minmax( <fixed-breadth> , <track-breadth> ) | minmax( <inflexible-breadth> , <fixed-breadth> )"
  19904. },
  19905. "font-stretch-absolute": {
  19906. syntax: "normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | <percentage>"
  19907. },
  19908. "font-variant-css21": {
  19909. syntax: "[ normal | small-caps ]"
  19910. },
  19911. "font-weight-absolute": {
  19912. syntax: "normal | bold | <number [1,1000]>"
  19913. },
  19914. "frequency-percentage": {
  19915. syntax: "<frequency> | <percentage>"
  19916. },
  19917. "general-enclosed": {
  19918. syntax: "[ <function-token> <any-value> ) ] | ( <ident> <any-value> )"
  19919. },
  19920. "generic-family": {
  19921. syntax: "serif | sans-serif | cursive | fantasy | monospace"
  19922. },
  19923. "generic-name": {
  19924. syntax: "serif | sans-serif | cursive | fantasy | monospace"
  19925. },
  19926. "geometry-box": {
  19927. syntax: "<shape-box> | fill-box | stroke-box | view-box"
  19928. },
  19929. gradient: gradient,
  19930. "grayscale()": {
  19931. syntax: "grayscale( <number-percentage> )"
  19932. },
  19933. "grid-line": {
  19934. syntax: "auto | <custom-ident> | [ <integer> && <custom-ident>? ] | [ span && [ <integer> || <custom-ident> ] ]"
  19935. },
  19936. "historical-lig-values": {
  19937. syntax: "[ historical-ligatures | no-historical-ligatures ]"
  19938. },
  19939. "hsl()": {
  19940. syntax: "hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )"
  19941. },
  19942. "hsla()": {
  19943. syntax: "hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )"
  19944. },
  19945. hue: hue,
  19946. "hue-rotate()": {
  19947. syntax: "hue-rotate( <angle> )"
  19948. },
  19949. "id-selector": {
  19950. syntax: "<hash-token>"
  19951. },
  19952. image: image,
  19953. "image()": {
  19954. syntax: "image( <image-tags>? [ <image-src>? , <color>? ]! )"
  19955. },
  19956. "image-set()": {
  19957. syntax: "image-set( <image-set-option># )"
  19958. },
  19959. "image-set-option": {
  19960. syntax: "[ <image> | <string> ] <resolution>"
  19961. },
  19962. "image-src": {
  19963. syntax: "<url> | <string>"
  19964. },
  19965. "image-tags": {
  19966. syntax: "ltr | rtl"
  19967. },
  19968. "inflexible-breadth": {
  19969. syntax: "<length> | <percentage> | min-content | max-content | auto"
  19970. },
  19971. "inset()": {
  19972. syntax: "inset( <length-percentage>{1,4} [ round <'border-radius'> ]? )"
  19973. },
  19974. "invert()": {
  19975. syntax: "invert( <number-percentage> )"
  19976. },
  19977. "keyframes-name": {
  19978. syntax: "<custom-ident> | <string>"
  19979. },
  19980. "keyframe-block": {
  19981. syntax: "<keyframe-selector># {\n <declaration-list>\n}"
  19982. },
  19983. "keyframe-block-list": {
  19984. syntax: "<keyframe-block>+"
  19985. },
  19986. "keyframe-selector": {
  19987. syntax: "from | to | <percentage>"
  19988. },
  19989. "leader()": {
  19990. syntax: "leader( <leader-type> )"
  19991. },
  19992. "leader-type": {
  19993. syntax: "dotted | solid | space | <string>"
  19994. },
  19995. "length-percentage": {
  19996. syntax: "<length> | <percentage>"
  19997. },
  19998. "line-names": {
  19999. syntax: "'[' <custom-ident>* ']'"
  20000. },
  20001. "line-name-list": {
  20002. syntax: "[ <line-names> | <name-repeat> ]+"
  20003. },
  20004. "line-style": {
  20005. syntax: "none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset"
  20006. },
  20007. "line-width": {
  20008. syntax: "<length> | thin | medium | thick"
  20009. },
  20010. "linear-color-hint": {
  20011. syntax: "<length-percentage>"
  20012. },
  20013. "linear-color-stop": {
  20014. syntax: "<color> <color-stop-length>?"
  20015. },
  20016. "linear-gradient()": {
  20017. syntax: "linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )"
  20018. },
  20019. "mask-layer": {
  20020. syntax: "<mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || <geometry-box> || [ <geometry-box> | no-clip ] || <compositing-operator> || <masking-mode>"
  20021. },
  20022. "mask-position": {
  20023. syntax: "[ <length-percentage> | left | center | right ] [ <length-percentage> | top | center | bottom ]?"
  20024. },
  20025. "mask-reference": {
  20026. syntax: "none | <image> | <mask-source>"
  20027. },
  20028. "mask-source": {
  20029. syntax: "<url>"
  20030. },
  20031. "masking-mode": {
  20032. syntax: "alpha | luminance | match-source"
  20033. },
  20034. "matrix()": {
  20035. syntax: "matrix( <number>#{6} )"
  20036. },
  20037. "matrix3d()": {
  20038. syntax: "matrix3d( <number>#{16} )"
  20039. },
  20040. "max()": {
  20041. syntax: "max( <calc-sum># )"
  20042. },
  20043. "media-and": {
  20044. syntax: "<media-in-parens> [ and <media-in-parens> ]+"
  20045. },
  20046. "media-condition": {
  20047. syntax: "<media-not> | <media-and> | <media-or> | <media-in-parens>"
  20048. },
  20049. "media-condition-without-or": {
  20050. syntax: "<media-not> | <media-and> | <media-in-parens>"
  20051. },
  20052. "media-feature": {
  20053. syntax: "( [ <mf-plain> | <mf-boolean> | <mf-range> ] )"
  20054. },
  20055. "media-in-parens": {
  20056. syntax: "( <media-condition> ) | <media-feature> | <general-enclosed>"
  20057. },
  20058. "media-not": {
  20059. syntax: "not <media-in-parens>"
  20060. },
  20061. "media-or": {
  20062. syntax: "<media-in-parens> [ or <media-in-parens> ]+"
  20063. },
  20064. "media-query": {
  20065. syntax: "<media-condition> | [ not | only ]? <media-type> [ and <media-condition-without-or> ]?"
  20066. },
  20067. "media-query-list": {
  20068. syntax: "<media-query>#"
  20069. },
  20070. "media-type": {
  20071. syntax: "<ident>"
  20072. },
  20073. "mf-boolean": {
  20074. syntax: "<mf-name>"
  20075. },
  20076. "mf-name": {
  20077. syntax: "<ident>"
  20078. },
  20079. "mf-plain": {
  20080. syntax: "<mf-name> : <mf-value>"
  20081. },
  20082. "mf-range": {
  20083. syntax: "<mf-name> [ '<' | '>' ]? '='? <mf-value>\n| <mf-value> [ '<' | '>' ]? '='? <mf-name>\n| <mf-value> '<' '='? <mf-name> '<' '='? <mf-value>\n| <mf-value> '>' '='? <mf-name> '>' '='? <mf-value>"
  20084. },
  20085. "mf-value": {
  20086. syntax: "<number> | <dimension> | <ident> | <ratio>"
  20087. },
  20088. "min()": {
  20089. syntax: "min( <calc-sum># )"
  20090. },
  20091. "minmax()": {
  20092. syntax: "minmax( [ <length> | <percentage> | min-content | max-content | auto ] , [ <length> | <percentage> | <flex> | min-content | max-content | auto ] )"
  20093. },
  20094. "named-color": {
  20095. 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"
  20096. },
  20097. "namespace-prefix": {
  20098. syntax: "<ident>"
  20099. },
  20100. "ns-prefix": {
  20101. syntax: "[ <ident-token> | '*' ]? '|'"
  20102. },
  20103. "number-percentage": {
  20104. syntax: "<number> | <percentage>"
  20105. },
  20106. "numeric-figure-values": {
  20107. syntax: "[ lining-nums | oldstyle-nums ]"
  20108. },
  20109. "numeric-fraction-values": {
  20110. syntax: "[ diagonal-fractions | stacked-fractions ]"
  20111. },
  20112. "numeric-spacing-values": {
  20113. syntax: "[ proportional-nums | tabular-nums ]"
  20114. },
  20115. nth: nth$1,
  20116. "opacity()": {
  20117. syntax: "opacity( [ <number-percentage> ] )"
  20118. },
  20119. "overflow-position": {
  20120. syntax: "unsafe | safe"
  20121. },
  20122. "outline-radius": {
  20123. syntax: "<length> | <percentage>"
  20124. },
  20125. "page-body": {
  20126. syntax: "<declaration>? [ ; <page-body> ]? | <page-margin-box> <page-body>"
  20127. },
  20128. "page-margin-box": {
  20129. syntax: "<page-margin-box-type> '{' <declaration-list> '}'"
  20130. },
  20131. "page-margin-box-type": {
  20132. 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"
  20133. },
  20134. "page-selector-list": {
  20135. syntax: "[ <page-selector># ]?"
  20136. },
  20137. "page-selector": {
  20138. syntax: "<pseudo-page>+ | <ident> <pseudo-page>*"
  20139. },
  20140. "path()": {
  20141. syntax: "path( [ <fill-rule>, ]? <string> )"
  20142. },
  20143. "paint()": {
  20144. syntax: "paint( <ident>, <declaration-value>? )"
  20145. },
  20146. "perspective()": {
  20147. syntax: "perspective( <length> )"
  20148. },
  20149. "polygon()": {
  20150. syntax: "polygon( <fill-rule>? , [ <length-percentage> <length-percentage> ]# )"
  20151. },
  20152. position: position,
  20153. "pseudo-class-selector": {
  20154. syntax: "':' <ident-token> | ':' <function-token> <any-value> ')'"
  20155. },
  20156. "pseudo-element-selector": {
  20157. syntax: "':' <pseudo-class-selector>"
  20158. },
  20159. "pseudo-page": {
  20160. syntax: ": [ left | right | first | blank ]"
  20161. },
  20162. quote: quote,
  20163. "radial-gradient()": {
  20164. syntax: "radial-gradient( [ <ending-shape> || <size> ]? [ at <position> ]? , <color-stop-list> )"
  20165. },
  20166. "relative-selector": {
  20167. syntax: "<combinator>? <complex-selector>"
  20168. },
  20169. "relative-selector-list": {
  20170. syntax: "<relative-selector>#"
  20171. },
  20172. "relative-size": {
  20173. syntax: "larger | smaller"
  20174. },
  20175. "repeat-style": {
  20176. syntax: "repeat-x | repeat-y | [ repeat | space | round | no-repeat ]{1,2}"
  20177. },
  20178. "repeating-linear-gradient()": {
  20179. syntax: "repeating-linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )"
  20180. },
  20181. "repeating-radial-gradient()": {
  20182. syntax: "repeating-radial-gradient( [ <ending-shape> || <size> ]? [ at <position> ]? , <color-stop-list> )"
  20183. },
  20184. "rgb()": {
  20185. syntax: "rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )"
  20186. },
  20187. "rgba()": {
  20188. syntax: "rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <number>#{3} , <alpha-value>? )"
  20189. },
  20190. "rotate()": {
  20191. syntax: "rotate( [ <angle> | <zero> ] )"
  20192. },
  20193. "rotate3d()": {
  20194. syntax: "rotate3d( <number> , <number> , <number> , [ <angle> | <zero> ] )"
  20195. },
  20196. "rotateX()": {
  20197. syntax: "rotateX( [ <angle> | <zero> ] )"
  20198. },
  20199. "rotateY()": {
  20200. syntax: "rotateY( [ <angle> | <zero> ] )"
  20201. },
  20202. "rotateZ()": {
  20203. syntax: "rotateZ( [ <angle> | <zero> ] )"
  20204. },
  20205. "saturate()": {
  20206. syntax: "saturate( <number-percentage> )"
  20207. },
  20208. "scale()": {
  20209. syntax: "scale( <number> , <number>? )"
  20210. },
  20211. "scale3d()": {
  20212. syntax: "scale3d( <number> , <number> , <number> )"
  20213. },
  20214. "scaleX()": {
  20215. syntax: "scaleX( <number> )"
  20216. },
  20217. "scaleY()": {
  20218. syntax: "scaleY( <number> )"
  20219. },
  20220. "scaleZ()": {
  20221. syntax: "scaleZ( <number> )"
  20222. },
  20223. "self-position": {
  20224. syntax: "center | start | end | self-start | self-end | flex-start | flex-end"
  20225. },
  20226. "shape-radius": {
  20227. syntax: "<length-percentage> | closest-side | farthest-side"
  20228. },
  20229. "skew()": {
  20230. syntax: "skew( [ <angle> | <zero> ] , [ <angle> | <zero> ]? )"
  20231. },
  20232. "skewX()": {
  20233. syntax: "skewX( [ <angle> | <zero> ] )"
  20234. },
  20235. "skewY()": {
  20236. syntax: "skewY( [ <angle> | <zero> ] )"
  20237. },
  20238. "sepia()": {
  20239. syntax: "sepia( <number-percentage> )"
  20240. },
  20241. shadow: shadow,
  20242. "shadow-t": {
  20243. syntax: "[ <length>{2,3} && <color>? ]"
  20244. },
  20245. shape: shape,
  20246. "shape-box": {
  20247. syntax: "<box> | margin-box"
  20248. },
  20249. "side-or-corner": {
  20250. syntax: "[ left | right ] || [ top | bottom ]"
  20251. },
  20252. "single-animation": {
  20253. syntax: "<time> || <timing-function> || <time> || <single-animation-iteration-count> || <single-animation-direction> || <single-animation-fill-mode> || <single-animation-play-state> || [ none | <keyframes-name> ]"
  20254. },
  20255. "single-animation-direction": {
  20256. syntax: "normal | reverse | alternate | alternate-reverse"
  20257. },
  20258. "single-animation-fill-mode": {
  20259. syntax: "none | forwards | backwards | both"
  20260. },
  20261. "single-animation-iteration-count": {
  20262. syntax: "infinite | <number>"
  20263. },
  20264. "single-animation-play-state": {
  20265. syntax: "running | paused"
  20266. },
  20267. "single-transition": {
  20268. syntax: "[ none | <single-transition-property> ] || <time> || <timing-function> || <time>"
  20269. },
  20270. "single-transition-property": {
  20271. syntax: "all | <custom-ident>"
  20272. },
  20273. size: size,
  20274. "step-position": {
  20275. syntax: "jump-start | jump-end | jump-none | jump-both | start | end"
  20276. },
  20277. "step-timing-function": {
  20278. syntax: "step-start | step-end | steps(<integer>[, <step-position>]?)"
  20279. },
  20280. "subclass-selector": {
  20281. syntax: "<id-selector> | <class-selector> | <attribute-selector> | <pseudo-class-selector>"
  20282. },
  20283. "supports-condition": {
  20284. syntax: "not <supports-in-parens> | <supports-in-parens> [ and <supports-in-parens> ]* | <supports-in-parens> [ or <supports-in-parens> ]*"
  20285. },
  20286. "supports-in-parens": {
  20287. syntax: "( <supports-condition> ) | <supports-feature> | <general-enclosed>"
  20288. },
  20289. "supports-feature": {
  20290. syntax: "<supports-decl> | <supports-selector-fn>"
  20291. },
  20292. "supports-decl": {
  20293. syntax: "( <declaration> )"
  20294. },
  20295. "supports-selector-fn": {
  20296. syntax: "selector( <complex-selector> )"
  20297. },
  20298. symbol: symbol,
  20299. target: target,
  20300. "target-counter()": {
  20301. syntax: "target-counter( [ <string> | <url> ] , <custom-ident> , <counter-style>? )"
  20302. },
  20303. "target-counters()": {
  20304. syntax: "target-counters( [ <string> | <url> ] , <custom-ident> , <string> , <counter-style>? )"
  20305. },
  20306. "target-text()": {
  20307. syntax: "target-text( [ <string> | <url> ] , [ content | before | after | first-letter ]? )"
  20308. },
  20309. "time-percentage": {
  20310. syntax: "<time> | <percentage>"
  20311. },
  20312. "timing-function": {
  20313. syntax: "linear | <cubic-bezier-timing-function> | <step-timing-function>"
  20314. },
  20315. "track-breadth": {
  20316. syntax: "<length-percentage> | <flex> | min-content | max-content | auto"
  20317. },
  20318. "track-list": {
  20319. syntax: "[ <line-names>? [ <track-size> | <track-repeat> ] ]+ <line-names>?"
  20320. },
  20321. "track-repeat": {
  20322. syntax: "repeat( [ <positive-integer> ] , [ <line-names>? <track-size> ]+ <line-names>? )"
  20323. },
  20324. "track-size": {
  20325. syntax: "<track-breadth> | minmax( <inflexible-breadth> , <track-breadth> ) | fit-content( [ <length> | <percentage> ] )"
  20326. },
  20327. "transform-function": {
  20328. syntax: "<matrix()> | <translate()> | <translateX()> | <translateY()> | <scale()> | <scaleX()> | <scaleY()> | <rotate()> | <skew()> | <skewX()> | <skewY()> | <matrix3d()> | <translate3d()> | <translateZ()> | <scale3d()> | <scaleZ()> | <rotate3d()> | <rotateX()> | <rotateY()> | <rotateZ()> | <perspective()>"
  20329. },
  20330. "transform-list": {
  20331. syntax: "<transform-function>+"
  20332. },
  20333. "translate()": {
  20334. syntax: "translate( <length-percentage> , <length-percentage>? )"
  20335. },
  20336. "translate3d()": {
  20337. syntax: "translate3d( <length-percentage> , <length-percentage> , <length> )"
  20338. },
  20339. "translateX()": {
  20340. syntax: "translateX( <length-percentage> )"
  20341. },
  20342. "translateY()": {
  20343. syntax: "translateY( <length-percentage> )"
  20344. },
  20345. "translateZ()": {
  20346. syntax: "translateZ( <length> )"
  20347. },
  20348. "type-or-unit": {
  20349. 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 | %"
  20350. },
  20351. "type-selector": {
  20352. syntax: "<wq-name> | <ns-prefix>? '*'"
  20353. },
  20354. "var()": {
  20355. syntax: "var( <custom-property-name> , <declaration-value>? )"
  20356. },
  20357. "viewport-length": {
  20358. syntax: "auto | <length-percentage>"
  20359. },
  20360. "wq-name": {
  20361. syntax: "<ns-prefix>? <ident-token>"
  20362. }
  20363. };
  20364. var atrules = {
  20365. charset: {
  20366. prelude: "<string>"
  20367. },
  20368. "font-face": {
  20369. descriptors: {
  20370. "unicode-range": {
  20371. comment: "replaces <unicode-range>, an old production name",
  20372. syntax: "<urange>#"
  20373. }
  20374. }
  20375. }
  20376. };
  20377. var properties = {
  20378. "-moz-background-clip": {
  20379. comment: "deprecated syntax in old Firefox, https://developer.mozilla.org/en/docs/Web/CSS/background-clip",
  20380. syntax: "padding | border"
  20381. },
  20382. "-moz-border-radius-bottomleft": {
  20383. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-left-radius",
  20384. syntax: "<'border-bottom-left-radius'>"
  20385. },
  20386. "-moz-border-radius-bottomright": {
  20387. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-right-radius",
  20388. syntax: "<'border-bottom-right-radius'>"
  20389. },
  20390. "-moz-border-radius-topleft": {
  20391. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-top-left-radius",
  20392. syntax: "<'border-top-left-radius'>"
  20393. },
  20394. "-moz-border-radius-topright": {
  20395. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-right-radius",
  20396. syntax: "<'border-bottom-right-radius'>"
  20397. },
  20398. "-moz-control-character-visibility": {
  20399. comment: "firefox specific keywords, https://bugzilla.mozilla.org/show_bug.cgi?id=947588",
  20400. syntax: "visible | hidden"
  20401. },
  20402. "-moz-osx-font-smoothing": {
  20403. comment: "misssed old syntax https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth",
  20404. syntax: "auto | grayscale"
  20405. },
  20406. "-moz-user-select": {
  20407. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/user-select",
  20408. syntax: "none | text | all | -moz-none"
  20409. },
  20410. "-ms-flex-align": {
  20411. comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-align",
  20412. syntax: "start | end | center | baseline | stretch"
  20413. },
  20414. "-ms-flex-item-align": {
  20415. comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-align",
  20416. syntax: "auto | start | end | center | baseline | stretch"
  20417. },
  20418. "-ms-flex-line-pack": {
  20419. comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-line-pack",
  20420. syntax: "start | end | center | justify | distribute | stretch"
  20421. },
  20422. "-ms-flex-negative": {
  20423. comment: "misssed old syntax implemented in IE; TODO: find references for comfirmation",
  20424. syntax: "<'flex-shrink'>"
  20425. },
  20426. "-ms-flex-pack": {
  20427. comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-pack",
  20428. syntax: "start | end | center | justify | distribute"
  20429. },
  20430. "-ms-flex-order": {
  20431. comment: "misssed old syntax implemented in IE; https://msdn.microsoft.com/en-us/library/jj127303(v=vs.85).aspx",
  20432. syntax: "<integer>"
  20433. },
  20434. "-ms-flex-positive": {
  20435. comment: "misssed old syntax implemented in IE; TODO: find references for comfirmation",
  20436. syntax: "<'flex-grow'>"
  20437. },
  20438. "-ms-flex-preferred-size": {
  20439. comment: "misssed old syntax implemented in IE; TODO: find references for comfirmation",
  20440. syntax: "<'flex-basis'>"
  20441. },
  20442. "-ms-interpolation-mode": {
  20443. comment: "https://msdn.microsoft.com/en-us/library/ff521095(v=vs.85).aspx",
  20444. syntax: "nearest-neighbor | bicubic"
  20445. },
  20446. "-ms-grid-column-align": {
  20447. comment: "add this property first since it uses as fallback for flexbox, https://msdn.microsoft.com/en-us/library/windows/apps/hh466338.aspx",
  20448. syntax: "start | end | center | stretch"
  20449. },
  20450. "-ms-grid-row-align": {
  20451. comment: "add this property first since it uses as fallback for flexbox, https://msdn.microsoft.com/en-us/library/windows/apps/hh466348.aspx",
  20452. syntax: "start | end | center | stretch"
  20453. },
  20454. "-ms-hyphenate-limit-last": {
  20455. comment: "misssed old syntax implemented in IE; https://www.w3.org/TR/css-text-4/#hyphenate-line-limits",
  20456. syntax: "none | always | column | page | spread"
  20457. },
  20458. "-webkit-appearance": {
  20459. comment: "webkit specific keywords",
  20460. references: [
  20461. "http://css-infos.net/property/-webkit-appearance"
  20462. ],
  20463. 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"
  20464. },
  20465. "-webkit-background-clip": {
  20466. comment: "https://developer.mozilla.org/en/docs/Web/CSS/background-clip",
  20467. syntax: "[ <box> | border | padding | content | text ]#"
  20468. },
  20469. "-webkit-column-break-after": {
  20470. comment: "added, http://help.dottoro.com/lcrthhhv.php",
  20471. syntax: "always | auto | avoid"
  20472. },
  20473. "-webkit-column-break-before": {
  20474. comment: "added, http://help.dottoro.com/lcxquvkf.php",
  20475. syntax: "always | auto | avoid"
  20476. },
  20477. "-webkit-column-break-inside": {
  20478. comment: "added, http://help.dottoro.com/lclhnthl.php",
  20479. syntax: "always | auto | avoid"
  20480. },
  20481. "-webkit-font-smoothing": {
  20482. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth",
  20483. syntax: "auto | none | antialiased | subpixel-antialiased"
  20484. },
  20485. "-webkit-mask-box-image": {
  20486. comment: "missed; https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-mask-box-image",
  20487. syntax: "[ <url> | <gradient> | none ] [ <length-percentage>{4} <-webkit-mask-box-repeat>{2} ]?"
  20488. },
  20489. "-webkit-print-color-adjust": {
  20490. comment: "missed",
  20491. references: [
  20492. "https://developer.mozilla.org/en/docs/Web/CSS/-webkit-print-color-adjust"
  20493. ],
  20494. syntax: "economy | exact"
  20495. },
  20496. "-webkit-text-security": {
  20497. comment: "missed; http://help.dottoro.com/lcbkewgt.php",
  20498. syntax: "none | circle | disc | square"
  20499. },
  20500. "-webkit-user-drag": {
  20501. comment: "missed; http://help.dottoro.com/lcbixvwm.php",
  20502. syntax: "none | element | auto"
  20503. },
  20504. "-webkit-user-select": {
  20505. comment: "auto is supported by old webkit, https://developer.mozilla.org/en-US/docs/Web/CSS/user-select",
  20506. syntax: "auto | none | text | all"
  20507. },
  20508. "alignment-baseline": {
  20509. comment: "added SVG property",
  20510. references: [
  20511. "https://www.w3.org/TR/SVG/text.html#AlignmentBaselineProperty"
  20512. ],
  20513. syntax: "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical"
  20514. },
  20515. "baseline-shift": {
  20516. comment: "added SVG property",
  20517. references: [
  20518. "https://www.w3.org/TR/SVG/text.html#BaselineShiftProperty"
  20519. ],
  20520. syntax: "baseline | sub | super | <svg-length>"
  20521. },
  20522. behavior: {
  20523. comment: "added old IE property https://msdn.microsoft.com/en-us/library/ms530723(v=vs.85).aspx",
  20524. syntax: "<url>+"
  20525. },
  20526. "clip-rule": {
  20527. comment: "added SVG property",
  20528. references: [
  20529. "https://www.w3.org/TR/SVG/masking.html#ClipRuleProperty"
  20530. ],
  20531. syntax: "nonzero | evenodd"
  20532. },
  20533. cue: {
  20534. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20535. syntax: "<'cue-before'> <'cue-after'>?"
  20536. },
  20537. "cue-after": {
  20538. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20539. syntax: "<url> <decibel>? | none"
  20540. },
  20541. "cue-before": {
  20542. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20543. syntax: "<url> <decibel>? | none"
  20544. },
  20545. cursor: {
  20546. 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",
  20547. references: [
  20548. "https://www.sitepoint.com/css3-cursor-styles/"
  20549. ],
  20550. 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 ] ]"
  20551. },
  20552. display: {
  20553. comment: "extended with -ms-flexbox",
  20554. syntax: "| <-non-standard-display>"
  20555. },
  20556. position: {
  20557. comment: "extended with -webkit-sticky",
  20558. syntax: "| -webkit-sticky"
  20559. },
  20560. "dominant-baseline": {
  20561. comment: "added SVG property",
  20562. references: [
  20563. "https://www.w3.org/TR/SVG/text.html#DominantBaselineProperty"
  20564. ],
  20565. syntax: "auto | use-script | no-change | reset-size | ideographic | alphabetic | hanging | mathematical | central | middle | text-after-edge | text-before-edge"
  20566. },
  20567. "image-rendering": {
  20568. comment: "extended with <-non-standard-image-rendering>, added SVG keywords optimizeSpeed and optimizeQuality",
  20569. references: [
  20570. "https://developer.mozilla.org/en/docs/Web/CSS/image-rendering",
  20571. "https://www.w3.org/TR/SVG/painting.html#ImageRenderingProperty"
  20572. ],
  20573. syntax: "| optimizeSpeed | optimizeQuality | <-non-standard-image-rendering>"
  20574. },
  20575. fill: {
  20576. comment: "added SVG property",
  20577. references: [
  20578. "https://www.w3.org/TR/SVG/painting.html#FillProperty"
  20579. ],
  20580. syntax: "<paint>"
  20581. },
  20582. "fill-opacity": {
  20583. comment: "added SVG property",
  20584. references: [
  20585. "https://www.w3.org/TR/SVG/painting.html#FillProperty"
  20586. ],
  20587. syntax: "<number-zero-one>"
  20588. },
  20589. "fill-rule": {
  20590. comment: "added SVG property",
  20591. references: [
  20592. "https://www.w3.org/TR/SVG/painting.html#FillProperty"
  20593. ],
  20594. syntax: "nonzero | evenodd"
  20595. },
  20596. filter: {
  20597. comment: "extend with IE legacy syntaxes",
  20598. syntax: "| <-ms-filter-function-list>"
  20599. },
  20600. "glyph-orientation-horizontal": {
  20601. comment: "added SVG property",
  20602. references: [
  20603. "https://www.w3.org/TR/SVG/text.html#GlyphOrientationHorizontalProperty"
  20604. ],
  20605. syntax: "<angle>"
  20606. },
  20607. "glyph-orientation-vertical": {
  20608. comment: "added SVG property",
  20609. references: [
  20610. "https://www.w3.org/TR/SVG/text.html#GlyphOrientationVerticalProperty"
  20611. ],
  20612. syntax: "<angle>"
  20613. },
  20614. kerning: {
  20615. comment: "added SVG property",
  20616. references: [
  20617. "https://www.w3.org/TR/SVG/text.html#KerningProperty"
  20618. ],
  20619. syntax: "auto | <svg-length>"
  20620. },
  20621. "letter-spacing": {
  20622. comment: "fix syntax <length> -> <length-percentage>",
  20623. references: [
  20624. "https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/letter-spacing"
  20625. ],
  20626. syntax: "normal | <length-percentage>"
  20627. },
  20628. marker: {
  20629. comment: "added SVG property",
  20630. references: [
  20631. "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
  20632. ],
  20633. syntax: "none | <url>"
  20634. },
  20635. "marker-end": {
  20636. comment: "added SVG property",
  20637. references: [
  20638. "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
  20639. ],
  20640. syntax: "none | <url>"
  20641. },
  20642. "marker-mid": {
  20643. comment: "added SVG property",
  20644. references: [
  20645. "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
  20646. ],
  20647. syntax: "none | <url>"
  20648. },
  20649. "marker-start": {
  20650. comment: "added SVG property",
  20651. references: [
  20652. "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
  20653. ],
  20654. syntax: "none | <url>"
  20655. },
  20656. "max-width": {
  20657. 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",
  20658. syntax: "none | <length-percentage> | min-content | max-content | fit-content(<length-percentage>) | <-non-standard-width>"
  20659. },
  20660. width: {
  20661. 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)",
  20662. syntax: "| fit-content | -moz-fit-content | -webkit-fit-content"
  20663. },
  20664. "min-width": {
  20665. comment: "extend by non-standard width keywords https://developer.mozilla.org/en-US/docs/Web/CSS/width",
  20666. syntax: "auto | <length-percentage> | min-content | max-content | fit-content(<length-percentage>) | <-non-standard-width>"
  20667. },
  20668. overflow: {
  20669. comment: "extend by vendor keywords https://developer.mozilla.org/en-US/docs/Web/CSS/overflow",
  20670. syntax: "| <-non-standard-overflow>"
  20671. },
  20672. pause: {
  20673. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20674. syntax: "<'pause-before'> <'pause-after'>?"
  20675. },
  20676. "pause-after": {
  20677. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20678. syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
  20679. },
  20680. "pause-before": {
  20681. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20682. syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
  20683. },
  20684. rest: {
  20685. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20686. syntax: "<'rest-before'> <'rest-after'>?"
  20687. },
  20688. "rest-after": {
  20689. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20690. syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
  20691. },
  20692. "rest-before": {
  20693. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20694. syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
  20695. },
  20696. "shape-rendering": {
  20697. comment: "added SVG property",
  20698. references: [
  20699. "https://www.w3.org/TR/SVG/painting.html#ShapeRenderingPropert"
  20700. ],
  20701. syntax: "auto | optimizeSpeed | crispEdges | geometricPrecision"
  20702. },
  20703. src: {
  20704. comment: "added @font-face's src property https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src",
  20705. syntax: "[ <url> [ format( <string># ) ]? | local( <family-name> ) ]#"
  20706. },
  20707. speak: {
  20708. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20709. syntax: "auto | none | normal"
  20710. },
  20711. "speak-as": {
  20712. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20713. syntax: "normal | spell-out || digits || [ literal-punctuation | no-punctuation ]"
  20714. },
  20715. stroke: {
  20716. comment: "added SVG property",
  20717. references: [
  20718. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  20719. ],
  20720. syntax: "<paint>"
  20721. },
  20722. "stroke-dasharray": {
  20723. comment: "added SVG property; a list of comma and/or white space separated <length>s and <percentage>s",
  20724. references: [
  20725. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  20726. ],
  20727. syntax: "none | [ <svg-length>+ ]#"
  20728. },
  20729. "stroke-dashoffset": {
  20730. comment: "added SVG property",
  20731. references: [
  20732. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  20733. ],
  20734. syntax: "<svg-length>"
  20735. },
  20736. "stroke-linecap": {
  20737. comment: "added SVG property",
  20738. references: [
  20739. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  20740. ],
  20741. syntax: "butt | round | square"
  20742. },
  20743. "stroke-linejoin": {
  20744. comment: "added SVG property",
  20745. references: [
  20746. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  20747. ],
  20748. syntax: "miter | round | bevel"
  20749. },
  20750. "stroke-miterlimit": {
  20751. comment: "added SVG property (<miterlimit> = <number-one-or-greater>) ",
  20752. references: [
  20753. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  20754. ],
  20755. syntax: "<number-one-or-greater>"
  20756. },
  20757. "stroke-opacity": {
  20758. comment: "added SVG property",
  20759. references: [
  20760. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  20761. ],
  20762. syntax: "<number-zero-one>"
  20763. },
  20764. "stroke-width": {
  20765. comment: "added SVG property",
  20766. references: [
  20767. "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
  20768. ],
  20769. syntax: "<svg-length>"
  20770. },
  20771. "text-anchor": {
  20772. comment: "added SVG property",
  20773. references: [
  20774. "https://www.w3.org/TR/SVG/text.html#TextAlignmentProperties"
  20775. ],
  20776. syntax: "start | middle | end"
  20777. },
  20778. "unicode-bidi": {
  20779. comment: "added prefixed keywords https://developer.mozilla.org/en-US/docs/Web/CSS/unicode-bidi",
  20780. syntax: "| -moz-isolate | -moz-isolate-override | -moz-plaintext | -webkit-isolate | -webkit-isolate-override | -webkit-plaintext"
  20781. },
  20782. "unicode-range": {
  20783. comment: "added missed property https://developer.mozilla.org/en-US/docs/Web/CSS/%40font-face/unicode-range",
  20784. syntax: "<urange>#"
  20785. },
  20786. "voice-balance": {
  20787. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20788. syntax: "<number> | left | center | right | leftwards | rightwards"
  20789. },
  20790. "voice-duration": {
  20791. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20792. syntax: "auto | <time>"
  20793. },
  20794. "voice-family": {
  20795. comment: "<name> -> <family-name>, https://www.w3.org/TR/css3-speech/#property-index",
  20796. syntax: "[ [ <family-name> | <generic-voice> ] , ]* [ <family-name> | <generic-voice> ] | preserve"
  20797. },
  20798. "voice-pitch": {
  20799. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20800. syntax: "<frequency> && absolute | [ [ x-low | low | medium | high | x-high ] || [ <frequency> | <semitones> | <percentage> ] ]"
  20801. },
  20802. "voice-range": {
  20803. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20804. syntax: "<frequency> && absolute | [ [ x-low | low | medium | high | x-high ] || [ <frequency> | <semitones> | <percentage> ] ]"
  20805. },
  20806. "voice-rate": {
  20807. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20808. syntax: "[ normal | x-slow | slow | medium | fast | x-fast ] || <percentage>"
  20809. },
  20810. "voice-stress": {
  20811. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20812. syntax: "normal | strong | moderate | none | reduced"
  20813. },
  20814. "voice-volume": {
  20815. comment: "https://www.w3.org/TR/css3-speech/#property-index",
  20816. syntax: "silent | [ [ x-soft | soft | medium | loud | x-loud ] || <decibel> ]"
  20817. },
  20818. "writing-mode": {
  20819. comment: "extend with SVG keywords",
  20820. syntax: "| <svg-writing-mode>"
  20821. }
  20822. };
  20823. var syntaxes = {
  20824. "-legacy-gradient": {
  20825. comment: "added collection of legacy gradient syntaxes",
  20826. syntax: "<-webkit-gradient()> | <-legacy-linear-gradient> | <-legacy-repeating-linear-gradient> | <-legacy-radial-gradient> | <-legacy-repeating-radial-gradient>"
  20827. },
  20828. "-legacy-linear-gradient": {
  20829. comment: "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
  20830. syntax: "-moz-linear-gradient( <-legacy-linear-gradient-arguments> ) | -webkit-linear-gradient( <-legacy-linear-gradient-arguments> ) | -o-linear-gradient( <-legacy-linear-gradient-arguments> )"
  20831. },
  20832. "-legacy-repeating-linear-gradient": {
  20833. comment: "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
  20834. 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> )"
  20835. },
  20836. "-legacy-linear-gradient-arguments": {
  20837. comment: "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
  20838. syntax: "[ <angle> | <side-or-corner> ]? , <color-stop-list>"
  20839. },
  20840. "-legacy-radial-gradient": {
  20841. comment: "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
  20842. syntax: "-moz-radial-gradient( <-legacy-radial-gradient-arguments> ) | -webkit-radial-gradient( <-legacy-radial-gradient-arguments> ) | -o-radial-gradient( <-legacy-radial-gradient-arguments> )"
  20843. },
  20844. "-legacy-repeating-radial-gradient": {
  20845. comment: "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
  20846. 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> )"
  20847. },
  20848. "-legacy-radial-gradient-arguments": {
  20849. comment: "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
  20850. syntax: "[ <position> , ]? [ [ [ <-legacy-radial-gradient-shape> || <-legacy-radial-gradient-size> ] | [ <length> | <percentage> ]{2} ] , ]? <color-stop-list>"
  20851. },
  20852. "-legacy-radial-gradient-size": {
  20853. comment: "before a standard it contains 2 extra keywords (`contain` and `cover`) https://www.w3.org/TR/2011/WD-css3-images-20110908/#ltsize",
  20854. syntax: "closest-side | closest-corner | farthest-side | farthest-corner | contain | cover"
  20855. },
  20856. "-legacy-radial-gradient-shape": {
  20857. comment: "define to double sure it doesn't extends in future https://www.w3.org/TR/2011/WD-css3-images-20110908/#ltshape",
  20858. syntax: "circle | ellipse"
  20859. },
  20860. "-non-standard-font": {
  20861. comment: "non standard fonts",
  20862. references: [
  20863. "https://webkit.org/blog/3709/using-the-system-font-in-web-content/"
  20864. ],
  20865. 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"
  20866. },
  20867. "-non-standard-color": {
  20868. comment: "non standard colors",
  20869. references: [
  20870. "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",
  20871. "https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Mozilla_Color_Preference_Extensions"
  20872. ],
  20873. 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"
  20874. },
  20875. "-non-standard-image-rendering": {
  20876. comment: "non-standard keywords http://phrogz.net/tmp/canvas_image_zoom.html",
  20877. syntax: "optimize-contrast | -moz-crisp-edges | -o-crisp-edges | -webkit-optimize-contrast"
  20878. },
  20879. "-non-standard-overflow": {
  20880. comment: "non-standard keywords https://developer.mozilla.org/en-US/docs/Web/CSS/overflow",
  20881. syntax: "-moz-scrollbars-none | -moz-scrollbars-horizontal | -moz-scrollbars-vertical | -moz-hidden-unscrollable"
  20882. },
  20883. "-non-standard-width": {
  20884. comment: "non-standard keywords https://developer.mozilla.org/en-US/docs/Web/CSS/width",
  20885. syntax: "fill-available | min-intrinsic | intrinsic | -moz-available | -moz-fit-content | -moz-min-content | -moz-max-content | -webkit-min-content | -webkit-max-content"
  20886. },
  20887. "-webkit-gradient()": {
  20888. 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 )",
  20889. 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>]* )"
  20890. },
  20891. "-webkit-gradient-color-stop": {
  20892. comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
  20893. syntax: "from( <color> ) | color-stop( [ <number-zero-one> | <percentage> ] , <color> ) | to( <color> )"
  20894. },
  20895. "-webkit-gradient-point": {
  20896. comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
  20897. syntax: "[ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]"
  20898. },
  20899. "-webkit-gradient-radius": {
  20900. comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
  20901. syntax: "<length> | <percentage>"
  20902. },
  20903. "-webkit-gradient-type": {
  20904. comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
  20905. syntax: "linear | radial"
  20906. },
  20907. "-webkit-mask-box-repeat": {
  20908. comment: "missed; https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-mask-box-image",
  20909. syntax: "repeat | stretch | round"
  20910. },
  20911. "-webkit-mask-clip-style": {
  20912. comment: "missed; there is no enough information about `-webkit-mask-clip` property, but looks like all those keywords are working",
  20913. syntax: "border | border-box | padding | padding-box | content | content-box | text"
  20914. },
  20915. "-ms-filter-function-list": {
  20916. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
  20917. syntax: "<-ms-filter-function>+"
  20918. },
  20919. "-ms-filter-function": {
  20920. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
  20921. syntax: "<-ms-filter-function-progid> | <-ms-filter-function-legacy>"
  20922. },
  20923. "-ms-filter-function-progid": {
  20924. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
  20925. syntax: "'progid:' [ <ident-token> '.' ]* [ <ident-token> | <function-token> <any-value>? ) ]"
  20926. },
  20927. "-ms-filter-function-legacy": {
  20928. comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
  20929. syntax: "<ident-token> | <function-token> <any-value>? )"
  20930. },
  20931. "-ms-filter": {
  20932. syntax: "<string>"
  20933. },
  20934. age: {
  20935. comment: "https://www.w3.org/TR/css3-speech/#voice-family",
  20936. syntax: "child | young | old"
  20937. },
  20938. "attr-name": {
  20939. syntax: "<wq-name>"
  20940. },
  20941. "attr-fallback": {
  20942. syntax: "<any-value>"
  20943. },
  20944. "border-radius": {
  20945. comment: "missed, https://drafts.csswg.org/css-backgrounds-3/#the-border-radius",
  20946. syntax: "<length-percentage>{1,2}"
  20947. },
  20948. bottom: {
  20949. 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",
  20950. syntax: "<length> | auto"
  20951. },
  20952. "content-list": {
  20953. comment: "missed -> https://drafts.csswg.org/css-content/#typedef-content-list (document-url, <target> and leader() is omitted util stabilization)",
  20954. syntax: "[ <string> | contents | <image> | <quote> | <target> | <leader()> | <attr()> | counter( <ident>, <'list-style-type'>? ) ]+"
  20955. },
  20956. "element()": {
  20957. comment: "https://drafts.csswg.org/css-gcpm/#element-syntax & https://drafts.csswg.org/css-images-4/#element-notation",
  20958. syntax: "element( <custom-ident> , [ first | start | last | first-except ]? ) | element( <id-selector> )"
  20959. },
  20960. "generic-voice": {
  20961. comment: "https://www.w3.org/TR/css3-speech/#voice-family",
  20962. syntax: "[ <age>? <gender> <integer>? ]"
  20963. },
  20964. gender: {
  20965. comment: "https://www.w3.org/TR/css3-speech/#voice-family",
  20966. syntax: "male | female | neutral"
  20967. },
  20968. "generic-family": {
  20969. comment: "added -apple-system",
  20970. references: [
  20971. "https://webkit.org/blog/3709/using-the-system-font-in-web-content/"
  20972. ],
  20973. syntax: "| -apple-system"
  20974. },
  20975. gradient: {
  20976. comment: "added legacy syntaxes support",
  20977. syntax: "| <-legacy-gradient>"
  20978. },
  20979. left: {
  20980. 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",
  20981. syntax: "<length> | auto"
  20982. },
  20983. "mask-image": {
  20984. comment: "missed; https://drafts.fxtf.org/css-masking-1/#the-mask-image",
  20985. syntax: "<mask-reference>#"
  20986. },
  20987. "name-repeat": {
  20988. 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",
  20989. syntax: "repeat( [ <positive-integer> | auto-fill ], <line-names>+)"
  20990. },
  20991. "named-color": {
  20992. comment: "added non standard color names",
  20993. syntax: "| <-non-standard-color>"
  20994. },
  20995. paint: {
  20996. comment: "used by SVG https://www.w3.org/TR/SVG/painting.html#SpecifyingPaint",
  20997. syntax: "none | <color> | <url> [ none | <color> ]? | context-fill | context-stroke"
  20998. },
  20999. "page-size": {
  21000. comment: "https://www.w3.org/TR/css-page-3/#typedef-page-size-page-size",
  21001. syntax: "A5 | A4 | A3 | B5 | B4 | JIS-B5 | JIS-B4 | letter | legal | ledger"
  21002. },
  21003. ratio: {
  21004. comment: "missed, https://drafts.csswg.org/mediaqueries-4/#typedef-ratio",
  21005. syntax: "<integer> / <integer>"
  21006. },
  21007. right: {
  21008. 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",
  21009. syntax: "<length> | auto"
  21010. },
  21011. shape: {
  21012. comment: "missed spaces in function body and add backwards compatible syntax",
  21013. syntax: "rect( <top>, <right>, <bottom>, <left> ) | rect( <top> <right> <bottom> <left> )"
  21014. },
  21015. "svg-length": {
  21016. comment: "All coordinates and lengths in SVG can be specified with or without a unit identifier",
  21017. references: [
  21018. "https://www.w3.org/TR/SVG11/coords.html#Units"
  21019. ],
  21020. syntax: "<percentage> | <length> | <number>"
  21021. },
  21022. "svg-writing-mode": {
  21023. comment: "SVG specific keywords (deprecated for CSS)",
  21024. references: [
  21025. "https://developer.mozilla.org/en/docs/Web/CSS/writing-mode",
  21026. "https://www.w3.org/TR/SVG/text.html#WritingModeProperty"
  21027. ],
  21028. syntax: "lr-tb | rl-tb | tb-rl | lr | rl | tb"
  21029. },
  21030. top: {
  21031. 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",
  21032. syntax: "<length> | auto"
  21033. },
  21034. "track-group": {
  21035. comment: "used by old grid-columns and grid-rows syntax v0",
  21036. syntax: "'(' [ <string>* <track-minmax> <string>* ]+ ')' [ '[' <positive-integer> ']' ]? | <track-minmax>"
  21037. },
  21038. "track-list-v0": {
  21039. comment: "used by old grid-columns and grid-rows syntax v0",
  21040. syntax: "[ <string>* <track-group> <string>* ]+ | none"
  21041. },
  21042. "track-minmax": {
  21043. comment: "used by old grid-columns and grid-rows syntax v0",
  21044. syntax: "minmax( <track-breadth> , <track-breadth> ) | auto | <track-breadth> | fit-content"
  21045. },
  21046. x: {
  21047. 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",
  21048. syntax: "<number>"
  21049. },
  21050. y: {
  21051. 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",
  21052. syntax: "<number>"
  21053. },
  21054. declaration: {
  21055. comment: "missed, restored by https://drafts.csswg.org/css-syntax",
  21056. syntax: "<ident-token> : <declaration-value>? [ '!' important ]?"
  21057. },
  21058. "declaration-list": {
  21059. comment: "missed, restored by https://drafts.csswg.org/css-syntax",
  21060. syntax: "[ <declaration>? ';' ]* <declaration>?"
  21061. },
  21062. url: {
  21063. comment: "https://drafts.csswg.org/css-values-4/#urls",
  21064. syntax: "url( <string> <url-modifier>* ) | <url-token>"
  21065. },
  21066. "url-modifier": {
  21067. comment: "https://drafts.csswg.org/css-values-4/#typedef-url-modifier",
  21068. syntax: "<ident> | <function-token> <any-value> )"
  21069. },
  21070. "number-zero-one": {
  21071. syntax: "<number [0,1]>"
  21072. },
  21073. "number-one-or-greater": {
  21074. syntax: "<number [1,∞]>"
  21075. },
  21076. "positive-integer": {
  21077. syntax: "<integer [0,∞]>"
  21078. },
  21079. "-non-standard-display": {
  21080. 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"
  21081. }
  21082. };
  21083. var require$$3 = {
  21084. atrules: atrules,
  21085. properties: properties,
  21086. syntaxes: syntaxes
  21087. };
  21088. const mdnAtrules = require$$0;
  21089. const mdnProperties = require$$1;
  21090. const mdnSyntaxes = require$$2;
  21091. const patch = require$$3;
  21092. const extendSyntax = /^\s*\|\s*/;
  21093. function preprocessAtrules(dict) {
  21094. const result = Object.create(null);
  21095. for (const atruleName in dict) {
  21096. const atrule = dict[atruleName];
  21097. let descriptors = null;
  21098. if (atrule.descriptors) {
  21099. descriptors = Object.create(null);
  21100. for (const descriptor in atrule.descriptors) {
  21101. descriptors[descriptor] = atrule.descriptors[descriptor].syntax;
  21102. }
  21103. }
  21104. result[atruleName.substr(1)] = {
  21105. prelude: atrule.syntax.trim().match(/^@\S+\s+([^;\{]*)/)[1].trim() || null,
  21106. descriptors
  21107. };
  21108. }
  21109. return result;
  21110. }
  21111. function patchDictionary(dict, patchDict) {
  21112. const result = {};
  21113. // copy all syntaxes for an original dict
  21114. for (const key in dict) {
  21115. result[key] = dict[key].syntax || dict[key];
  21116. }
  21117. // apply a patch
  21118. for (const key in patchDict) {
  21119. if (key in dict) {
  21120. if (patchDict[key].syntax) {
  21121. result[key] = extendSyntax.test(patchDict[key].syntax)
  21122. ? result[key] + ' ' + patchDict[key].syntax.trim()
  21123. : patchDict[key].syntax;
  21124. } else {
  21125. delete result[key];
  21126. }
  21127. } else {
  21128. if (patchDict[key].syntax) {
  21129. result[key] = patchDict[key].syntax.replace(extendSyntax, '');
  21130. }
  21131. }
  21132. }
  21133. return result;
  21134. }
  21135. function unpackSyntaxes(dict) {
  21136. const result = {};
  21137. for (const key in dict) {
  21138. result[key] = dict[key].syntax;
  21139. }
  21140. return result;
  21141. }
  21142. function patchAtrules(dict, patchDict) {
  21143. const result = {};
  21144. // copy all syntaxes for an original dict
  21145. for (const key in dict) {
  21146. const patchDescriptors = (patchDict[key] && patchDict[key].descriptors) || null;
  21147. result[key] = {
  21148. prelude: key in patchDict && 'prelude' in patchDict[key]
  21149. ? patchDict[key].prelude
  21150. : dict[key].prelude || null,
  21151. descriptors: dict[key].descriptors
  21152. ? patchDictionary(dict[key].descriptors, patchDescriptors || {})
  21153. : patchDescriptors && unpackSyntaxes(patchDescriptors)
  21154. };
  21155. }
  21156. // apply a patch
  21157. for (const key in patchDict) {
  21158. if (!hasOwnProperty.call(dict, key)) {
  21159. result[key] = {
  21160. prelude: patchDict[key].prelude || null,
  21161. descriptors: patchDict[key].descriptors && unpackSyntaxes(patchDict[key].descriptors)
  21162. };
  21163. }
  21164. }
  21165. return result;
  21166. }
  21167. var data$1 = {
  21168. types: patchDictionary(mdnSyntaxes, patch.syntaxes),
  21169. atrules: patchAtrules(preprocessAtrules(mdnAtrules), patch.atrules),
  21170. properties: patchDictionary(mdnProperties, patch.properties)
  21171. };
  21172. var cmpChar$2 = tokenizer$3.cmpChar;
  21173. var isDigit$1 = tokenizer$3.isDigit;
  21174. var TYPE$y = tokenizer$3.TYPE;
  21175. var WHITESPACE$8 = TYPE$y.WhiteSpace;
  21176. var COMMENT$6 = TYPE$y.Comment;
  21177. var IDENT$f = TYPE$y.Ident;
  21178. var NUMBER$6 = TYPE$y.Number;
  21179. var DIMENSION$5 = TYPE$y.Dimension;
  21180. var PLUSSIGN$5 = 0x002B; // U+002B PLUS SIGN (+)
  21181. var HYPHENMINUS$2 = 0x002D; // U+002D HYPHEN-MINUS (-)
  21182. var N = 0x006E; // U+006E LATIN SMALL LETTER N (n)
  21183. var DISALLOW_SIGN = true;
  21184. var ALLOW_SIGN = false;
  21185. function checkInteger(offset, disallowSign) {
  21186. var pos = this.scanner.tokenStart + offset;
  21187. var code = this.scanner.source.charCodeAt(pos);
  21188. if (code === PLUSSIGN$5 || code === HYPHENMINUS$2) {
  21189. if (disallowSign) {
  21190. this.error('Number sign is not allowed');
  21191. }
  21192. pos++;
  21193. }
  21194. for (; pos < this.scanner.tokenEnd; pos++) {
  21195. if (!isDigit$1(this.scanner.source.charCodeAt(pos))) {
  21196. this.error('Integer is expected', pos);
  21197. }
  21198. }
  21199. }
  21200. function checkTokenIsInteger(disallowSign) {
  21201. return checkInteger.call(this, 0, disallowSign);
  21202. }
  21203. function expectCharCode(offset, code) {
  21204. if (!cmpChar$2(this.scanner.source, this.scanner.tokenStart + offset, code)) {
  21205. var msg = '';
  21206. switch (code) {
  21207. case N:
  21208. msg = 'N is expected';
  21209. break;
  21210. case HYPHENMINUS$2:
  21211. msg = 'HyphenMinus is expected';
  21212. break;
  21213. }
  21214. this.error(msg, this.scanner.tokenStart + offset);
  21215. }
  21216. }
  21217. // ... <signed-integer>
  21218. // ... ['+' | '-'] <signless-integer>
  21219. function consumeB() {
  21220. var offset = 0;
  21221. var sign = 0;
  21222. var type = this.scanner.tokenType;
  21223. while (type === WHITESPACE$8 || type === COMMENT$6) {
  21224. type = this.scanner.lookupType(++offset);
  21225. }
  21226. if (type !== NUMBER$6) {
  21227. if (this.scanner.isDelim(PLUSSIGN$5, offset) ||
  21228. this.scanner.isDelim(HYPHENMINUS$2, offset)) {
  21229. sign = this.scanner.isDelim(PLUSSIGN$5, offset) ? PLUSSIGN$5 : HYPHENMINUS$2;
  21230. do {
  21231. type = this.scanner.lookupType(++offset);
  21232. } while (type === WHITESPACE$8 || type === COMMENT$6);
  21233. if (type !== NUMBER$6) {
  21234. this.scanner.skip(offset);
  21235. checkTokenIsInteger.call(this, DISALLOW_SIGN);
  21236. }
  21237. } else {
  21238. return null;
  21239. }
  21240. }
  21241. if (offset > 0) {
  21242. this.scanner.skip(offset);
  21243. }
  21244. if (sign === 0) {
  21245. type = this.scanner.source.charCodeAt(this.scanner.tokenStart);
  21246. if (type !== PLUSSIGN$5 && type !== HYPHENMINUS$2) {
  21247. this.error('Number sign is expected');
  21248. }
  21249. }
  21250. checkTokenIsInteger.call(this, sign !== 0);
  21251. return sign === HYPHENMINUS$2 ? '-' + this.consume(NUMBER$6) : this.consume(NUMBER$6);
  21252. }
  21253. // An+B microsyntax https://www.w3.org/TR/css-syntax-3/#anb
  21254. var AnPlusB = {
  21255. name: 'AnPlusB',
  21256. structure: {
  21257. a: [String, null],
  21258. b: [String, null]
  21259. },
  21260. parse: function() {
  21261. /* eslint-disable brace-style*/
  21262. var start = this.scanner.tokenStart;
  21263. var a = null;
  21264. var b = null;
  21265. // <integer>
  21266. if (this.scanner.tokenType === NUMBER$6) {
  21267. checkTokenIsInteger.call(this, ALLOW_SIGN);
  21268. b = this.consume(NUMBER$6);
  21269. }
  21270. // -n
  21271. // -n <signed-integer>
  21272. // -n ['+' | '-'] <signless-integer>
  21273. // -n- <signless-integer>
  21274. // <dashndashdigit-ident>
  21275. else if (this.scanner.tokenType === IDENT$f && cmpChar$2(this.scanner.source, this.scanner.tokenStart, HYPHENMINUS$2)) {
  21276. a = '-1';
  21277. expectCharCode.call(this, 1, N);
  21278. switch (this.scanner.getTokenLength()) {
  21279. // -n
  21280. // -n <signed-integer>
  21281. // -n ['+' | '-'] <signless-integer>
  21282. case 2:
  21283. this.scanner.next();
  21284. b = consumeB.call(this);
  21285. break;
  21286. // -n- <signless-integer>
  21287. case 3:
  21288. expectCharCode.call(this, 2, HYPHENMINUS$2);
  21289. this.scanner.next();
  21290. this.scanner.skipSC();
  21291. checkTokenIsInteger.call(this, DISALLOW_SIGN);
  21292. b = '-' + this.consume(NUMBER$6);
  21293. break;
  21294. // <dashndashdigit-ident>
  21295. default:
  21296. expectCharCode.call(this, 2, HYPHENMINUS$2);
  21297. checkInteger.call(this, 3, DISALLOW_SIGN);
  21298. this.scanner.next();
  21299. b = this.scanner.substrToCursor(start + 2);
  21300. }
  21301. }
  21302. // '+'? n
  21303. // '+'? n <signed-integer>
  21304. // '+'? n ['+' | '-'] <signless-integer>
  21305. // '+'? n- <signless-integer>
  21306. // '+'? <ndashdigit-ident>
  21307. else if (this.scanner.tokenType === IDENT$f || (this.scanner.isDelim(PLUSSIGN$5) && this.scanner.lookupType(1) === IDENT$f)) {
  21308. var sign = 0;
  21309. a = '1';
  21310. // just ignore a plus
  21311. if (this.scanner.isDelim(PLUSSIGN$5)) {
  21312. sign = 1;
  21313. this.scanner.next();
  21314. }
  21315. expectCharCode.call(this, 0, N);
  21316. switch (this.scanner.getTokenLength()) {
  21317. // '+'? n
  21318. // '+'? n <signed-integer>
  21319. // '+'? n ['+' | '-'] <signless-integer>
  21320. case 1:
  21321. this.scanner.next();
  21322. b = consumeB.call(this);
  21323. break;
  21324. // '+'? n- <signless-integer>
  21325. case 2:
  21326. expectCharCode.call(this, 1, HYPHENMINUS$2);
  21327. this.scanner.next();
  21328. this.scanner.skipSC();
  21329. checkTokenIsInteger.call(this, DISALLOW_SIGN);
  21330. b = '-' + this.consume(NUMBER$6);
  21331. break;
  21332. // '+'? <ndashdigit-ident>
  21333. default:
  21334. expectCharCode.call(this, 1, HYPHENMINUS$2);
  21335. checkInteger.call(this, 2, DISALLOW_SIGN);
  21336. this.scanner.next();
  21337. b = this.scanner.substrToCursor(start + sign + 1);
  21338. }
  21339. }
  21340. // <ndashdigit-dimension>
  21341. // <ndash-dimension> <signless-integer>
  21342. // <n-dimension>
  21343. // <n-dimension> <signed-integer>
  21344. // <n-dimension> ['+' | '-'] <signless-integer>
  21345. else if (this.scanner.tokenType === DIMENSION$5) {
  21346. var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
  21347. var sign = code === PLUSSIGN$5 || code === HYPHENMINUS$2;
  21348. for (var i = this.scanner.tokenStart + sign; i < this.scanner.tokenEnd; i++) {
  21349. if (!isDigit$1(this.scanner.source.charCodeAt(i))) {
  21350. break;
  21351. }
  21352. }
  21353. if (i === this.scanner.tokenStart + sign) {
  21354. this.error('Integer is expected', this.scanner.tokenStart + sign);
  21355. }
  21356. expectCharCode.call(this, i - this.scanner.tokenStart, N);
  21357. a = this.scanner.source.substring(start, i);
  21358. // <n-dimension>
  21359. // <n-dimension> <signed-integer>
  21360. // <n-dimension> ['+' | '-'] <signless-integer>
  21361. if (i + 1 === this.scanner.tokenEnd) {
  21362. this.scanner.next();
  21363. b = consumeB.call(this);
  21364. } else {
  21365. expectCharCode.call(this, i - this.scanner.tokenStart + 1, HYPHENMINUS$2);
  21366. // <ndash-dimension> <signless-integer>
  21367. if (i + 2 === this.scanner.tokenEnd) {
  21368. this.scanner.next();
  21369. this.scanner.skipSC();
  21370. checkTokenIsInteger.call(this, DISALLOW_SIGN);
  21371. b = '-' + this.consume(NUMBER$6);
  21372. }
  21373. // <ndashdigit-dimension>
  21374. else {
  21375. checkInteger.call(this, i - this.scanner.tokenStart + 2, DISALLOW_SIGN);
  21376. this.scanner.next();
  21377. b = this.scanner.substrToCursor(i + 1);
  21378. }
  21379. }
  21380. } else {
  21381. this.error();
  21382. }
  21383. if (a !== null && a.charCodeAt(0) === PLUSSIGN$5) {
  21384. a = a.substr(1);
  21385. }
  21386. if (b !== null && b.charCodeAt(0) === PLUSSIGN$5) {
  21387. b = b.substr(1);
  21388. }
  21389. return {
  21390. type: 'AnPlusB',
  21391. loc: this.getLocation(start, this.scanner.tokenStart),
  21392. a: a,
  21393. b: b
  21394. };
  21395. },
  21396. generate: function(node) {
  21397. var a = node.a !== null && node.a !== undefined;
  21398. var b = node.b !== null && node.b !== undefined;
  21399. if (a) {
  21400. this.chunk(
  21401. node.a === '+1' ? '+n' : // eslint-disable-line operator-linebreak, indent
  21402. node.a === '1' ? 'n' : // eslint-disable-line operator-linebreak, indent
  21403. node.a === '-1' ? '-n' : // eslint-disable-line operator-linebreak, indent
  21404. node.a + 'n' // eslint-disable-line operator-linebreak, indent
  21405. );
  21406. if (b) {
  21407. b = String(node.b);
  21408. if (b.charAt(0) === '-' || b.charAt(0) === '+') {
  21409. this.chunk(b.charAt(0));
  21410. this.chunk(b.substr(1));
  21411. } else {
  21412. this.chunk('+');
  21413. this.chunk(b);
  21414. }
  21415. }
  21416. } else {
  21417. this.chunk(String(node.b));
  21418. }
  21419. }
  21420. };
  21421. var tokenizer = tokenizer$3;
  21422. var TYPE$x = tokenizer.TYPE;
  21423. var WhiteSpace$1 = TYPE$x.WhiteSpace;
  21424. var Semicolon = TYPE$x.Semicolon;
  21425. var LeftCurlyBracket = TYPE$x.LeftCurlyBracket;
  21426. var Delim = TYPE$x.Delim;
  21427. var EXCLAMATIONMARK$2 = 0x0021; // U+0021 EXCLAMATION MARK (!)
  21428. function getOffsetExcludeWS() {
  21429. if (this.scanner.tokenIndex > 0) {
  21430. if (this.scanner.lookupType(-1) === WhiteSpace$1) {
  21431. return this.scanner.tokenIndex > 1
  21432. ? this.scanner.getTokenStart(this.scanner.tokenIndex - 1)
  21433. : this.scanner.firstCharOffset;
  21434. }
  21435. }
  21436. return this.scanner.tokenStart;
  21437. }
  21438. // 0, 0, false
  21439. function balanceEnd() {
  21440. return 0;
  21441. }
  21442. // LEFTCURLYBRACKET, 0, false
  21443. function leftCurlyBracket(tokenType) {
  21444. return tokenType === LeftCurlyBracket ? 1 : 0;
  21445. }
  21446. // LEFTCURLYBRACKET, SEMICOLON, false
  21447. function leftCurlyBracketOrSemicolon(tokenType) {
  21448. return tokenType === LeftCurlyBracket || tokenType === Semicolon ? 1 : 0;
  21449. }
  21450. // EXCLAMATIONMARK, SEMICOLON, false
  21451. function exclamationMarkOrSemicolon(tokenType, source, offset) {
  21452. if (tokenType === Delim && source.charCodeAt(offset) === EXCLAMATIONMARK$2) {
  21453. return 1;
  21454. }
  21455. return tokenType === Semicolon ? 1 : 0;
  21456. }
  21457. // 0, SEMICOLON, true
  21458. function semicolonIncluded(tokenType) {
  21459. return tokenType === Semicolon ? 2 : 0;
  21460. }
  21461. var Raw = {
  21462. name: 'Raw',
  21463. structure: {
  21464. value: String
  21465. },
  21466. parse: function(startToken, mode, excludeWhiteSpace) {
  21467. var startOffset = this.scanner.getTokenStart(startToken);
  21468. var endOffset;
  21469. this.scanner.skip(
  21470. this.scanner.getRawLength(startToken, mode || balanceEnd)
  21471. );
  21472. if (excludeWhiteSpace && this.scanner.tokenStart > startOffset) {
  21473. endOffset = getOffsetExcludeWS.call(this);
  21474. } else {
  21475. endOffset = this.scanner.tokenStart;
  21476. }
  21477. return {
  21478. type: 'Raw',
  21479. loc: this.getLocation(startOffset, endOffset),
  21480. value: this.scanner.source.substring(startOffset, endOffset)
  21481. };
  21482. },
  21483. generate: function(node) {
  21484. this.chunk(node.value);
  21485. },
  21486. mode: {
  21487. default: balanceEnd,
  21488. leftCurlyBracket: leftCurlyBracket,
  21489. leftCurlyBracketOrSemicolon: leftCurlyBracketOrSemicolon,
  21490. exclamationMarkOrSemicolon: exclamationMarkOrSemicolon,
  21491. semicolonIncluded: semicolonIncluded
  21492. }
  21493. };
  21494. var TYPE$w = tokenizer$3.TYPE;
  21495. var rawMode$5 = Raw.mode;
  21496. var ATKEYWORD$2 = TYPE$w.AtKeyword;
  21497. var SEMICOLON$4 = TYPE$w.Semicolon;
  21498. var LEFTCURLYBRACKET$3 = TYPE$w.LeftCurlyBracket;
  21499. var RIGHTCURLYBRACKET$1 = TYPE$w.RightCurlyBracket;
  21500. function consumeRaw$5(startToken) {
  21501. return this.Raw(startToken, rawMode$5.leftCurlyBracketOrSemicolon, true);
  21502. }
  21503. function isDeclarationBlockAtrule() {
  21504. for (var offset = 1, type; type = this.scanner.lookupType(offset); offset++) {
  21505. if (type === RIGHTCURLYBRACKET$1) {
  21506. return true;
  21507. }
  21508. if (type === LEFTCURLYBRACKET$3 ||
  21509. type === ATKEYWORD$2) {
  21510. return false;
  21511. }
  21512. }
  21513. return false;
  21514. }
  21515. var Atrule = {
  21516. name: 'Atrule',
  21517. structure: {
  21518. name: String,
  21519. prelude: ['AtrulePrelude', 'Raw', null],
  21520. block: ['Block', null]
  21521. },
  21522. parse: function() {
  21523. var start = this.scanner.tokenStart;
  21524. var name;
  21525. var nameLowerCase;
  21526. var prelude = null;
  21527. var block = null;
  21528. this.eat(ATKEYWORD$2);
  21529. name = this.scanner.substrToCursor(start + 1);
  21530. nameLowerCase = name.toLowerCase();
  21531. this.scanner.skipSC();
  21532. // parse prelude
  21533. if (this.scanner.eof === false &&
  21534. this.scanner.tokenType !== LEFTCURLYBRACKET$3 &&
  21535. this.scanner.tokenType !== SEMICOLON$4) {
  21536. if (this.parseAtrulePrelude) {
  21537. prelude = this.parseWithFallback(this.AtrulePrelude.bind(this, name), consumeRaw$5);
  21538. // turn empty AtrulePrelude into null
  21539. if (prelude.type === 'AtrulePrelude' && prelude.children.head === null) {
  21540. prelude = null;
  21541. }
  21542. } else {
  21543. prelude = consumeRaw$5.call(this, this.scanner.tokenIndex);
  21544. }
  21545. this.scanner.skipSC();
  21546. }
  21547. switch (this.scanner.tokenType) {
  21548. case SEMICOLON$4:
  21549. this.scanner.next();
  21550. break;
  21551. case LEFTCURLYBRACKET$3:
  21552. if (this.atrule.hasOwnProperty(nameLowerCase) &&
  21553. typeof this.atrule[nameLowerCase].block === 'function') {
  21554. block = this.atrule[nameLowerCase].block.call(this);
  21555. } else {
  21556. // TODO: should consume block content as Raw?
  21557. block = this.Block(isDeclarationBlockAtrule.call(this));
  21558. }
  21559. break;
  21560. }
  21561. return {
  21562. type: 'Atrule',
  21563. loc: this.getLocation(start, this.scanner.tokenStart),
  21564. name: name,
  21565. prelude: prelude,
  21566. block: block
  21567. };
  21568. },
  21569. generate: function(node) {
  21570. this.chunk('@');
  21571. this.chunk(node.name);
  21572. if (node.prelude !== null) {
  21573. this.chunk(' ');
  21574. this.node(node.prelude);
  21575. }
  21576. if (node.block) {
  21577. this.node(node.block);
  21578. } else {
  21579. this.chunk(';');
  21580. }
  21581. },
  21582. walkContext: 'atrule'
  21583. };
  21584. var TYPE$v = tokenizer$3.TYPE;
  21585. var SEMICOLON$3 = TYPE$v.Semicolon;
  21586. var LEFTCURLYBRACKET$2 = TYPE$v.LeftCurlyBracket;
  21587. var AtrulePrelude = {
  21588. name: 'AtrulePrelude',
  21589. structure: {
  21590. children: [[]]
  21591. },
  21592. parse: function(name) {
  21593. var children = null;
  21594. if (name !== null) {
  21595. name = name.toLowerCase();
  21596. }
  21597. this.scanner.skipSC();
  21598. if (this.atrule.hasOwnProperty(name) &&
  21599. typeof this.atrule[name].prelude === 'function') {
  21600. // custom consumer
  21601. children = this.atrule[name].prelude.call(this);
  21602. } else {
  21603. // default consumer
  21604. children = this.readSequence(this.scope.AtrulePrelude);
  21605. }
  21606. this.scanner.skipSC();
  21607. if (this.scanner.eof !== true &&
  21608. this.scanner.tokenType !== LEFTCURLYBRACKET$2 &&
  21609. this.scanner.tokenType !== SEMICOLON$3) {
  21610. this.error('Semicolon or block is expected');
  21611. }
  21612. if (children === null) {
  21613. children = this.createList();
  21614. }
  21615. return {
  21616. type: 'AtrulePrelude',
  21617. loc: this.getLocationFromList(children),
  21618. children: children
  21619. };
  21620. },
  21621. generate: function(node) {
  21622. this.children(node);
  21623. },
  21624. walkContext: 'atrulePrelude'
  21625. };
  21626. var TYPE$u = tokenizer$3.TYPE;
  21627. var IDENT$e = TYPE$u.Ident;
  21628. var STRING$3 = TYPE$u.String;
  21629. var COLON$6 = TYPE$u.Colon;
  21630. var LEFTSQUAREBRACKET$3 = TYPE$u.LeftSquareBracket;
  21631. var RIGHTSQUAREBRACKET$1 = TYPE$u.RightSquareBracket;
  21632. var DOLLARSIGN$1 = 0x0024; // U+0024 DOLLAR SIGN ($)
  21633. var ASTERISK$5 = 0x002A; // U+002A ASTERISK (*)
  21634. var EQUALSSIGN = 0x003D; // U+003D EQUALS SIGN (=)
  21635. var CIRCUMFLEXACCENT = 0x005E; // U+005E (^)
  21636. var VERTICALLINE$2 = 0x007C; // U+007C VERTICAL LINE (|)
  21637. var TILDE$2 = 0x007E; // U+007E TILDE (~)
  21638. function getAttributeName() {
  21639. if (this.scanner.eof) {
  21640. this.error('Unexpected end of input');
  21641. }
  21642. var start = this.scanner.tokenStart;
  21643. var expectIdent = false;
  21644. var checkColon = true;
  21645. if (this.scanner.isDelim(ASTERISK$5)) {
  21646. expectIdent = true;
  21647. checkColon = false;
  21648. this.scanner.next();
  21649. } else if (!this.scanner.isDelim(VERTICALLINE$2)) {
  21650. this.eat(IDENT$e);
  21651. }
  21652. if (this.scanner.isDelim(VERTICALLINE$2)) {
  21653. if (this.scanner.source.charCodeAt(this.scanner.tokenStart + 1) !== EQUALSSIGN) {
  21654. this.scanner.next();
  21655. this.eat(IDENT$e);
  21656. } else if (expectIdent) {
  21657. this.error('Identifier is expected', this.scanner.tokenEnd);
  21658. }
  21659. } else if (expectIdent) {
  21660. this.error('Vertical line is expected');
  21661. }
  21662. if (checkColon && this.scanner.tokenType === COLON$6) {
  21663. this.scanner.next();
  21664. this.eat(IDENT$e);
  21665. }
  21666. return {
  21667. type: 'Identifier',
  21668. loc: this.getLocation(start, this.scanner.tokenStart),
  21669. name: this.scanner.substrToCursor(start)
  21670. };
  21671. }
  21672. function getOperator() {
  21673. var start = this.scanner.tokenStart;
  21674. var code = this.scanner.source.charCodeAt(start);
  21675. if (code !== EQUALSSIGN && // =
  21676. code !== TILDE$2 && // ~=
  21677. code !== CIRCUMFLEXACCENT && // ^=
  21678. code !== DOLLARSIGN$1 && // $=
  21679. code !== ASTERISK$5 && // *=
  21680. code !== VERTICALLINE$2 // |=
  21681. ) {
  21682. this.error('Attribute selector (=, ~=, ^=, $=, *=, |=) is expected');
  21683. }
  21684. this.scanner.next();
  21685. if (code !== EQUALSSIGN) {
  21686. if (!this.scanner.isDelim(EQUALSSIGN)) {
  21687. this.error('Equal sign is expected');
  21688. }
  21689. this.scanner.next();
  21690. }
  21691. return this.scanner.substrToCursor(start);
  21692. }
  21693. // '[' <wq-name> ']'
  21694. // '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'
  21695. var AttributeSelector = {
  21696. name: 'AttributeSelector',
  21697. structure: {
  21698. name: 'Identifier',
  21699. matcher: [String, null],
  21700. value: ['String', 'Identifier', null],
  21701. flags: [String, null]
  21702. },
  21703. parse: function() {
  21704. var start = this.scanner.tokenStart;
  21705. var name;
  21706. var matcher = null;
  21707. var value = null;
  21708. var flags = null;
  21709. this.eat(LEFTSQUAREBRACKET$3);
  21710. this.scanner.skipSC();
  21711. name = getAttributeName.call(this);
  21712. this.scanner.skipSC();
  21713. if (this.scanner.tokenType !== RIGHTSQUAREBRACKET$1) {
  21714. // avoid case `[name i]`
  21715. if (this.scanner.tokenType !== IDENT$e) {
  21716. matcher = getOperator.call(this);
  21717. this.scanner.skipSC();
  21718. value = this.scanner.tokenType === STRING$3
  21719. ? this.String()
  21720. : this.Identifier();
  21721. this.scanner.skipSC();
  21722. }
  21723. // attribute flags
  21724. if (this.scanner.tokenType === IDENT$e) {
  21725. flags = this.scanner.getTokenValue();
  21726. this.scanner.next();
  21727. this.scanner.skipSC();
  21728. }
  21729. }
  21730. this.eat(RIGHTSQUAREBRACKET$1);
  21731. return {
  21732. type: 'AttributeSelector',
  21733. loc: this.getLocation(start, this.scanner.tokenStart),
  21734. name: name,
  21735. matcher: matcher,
  21736. value: value,
  21737. flags: flags
  21738. };
  21739. },
  21740. generate: function(node) {
  21741. var flagsPrefix = ' ';
  21742. this.chunk('[');
  21743. this.node(node.name);
  21744. if (node.matcher !== null) {
  21745. this.chunk(node.matcher);
  21746. if (node.value !== null) {
  21747. this.node(node.value);
  21748. // space between string and flags is not required
  21749. if (node.value.type === 'String') {
  21750. flagsPrefix = '';
  21751. }
  21752. }
  21753. }
  21754. if (node.flags !== null) {
  21755. this.chunk(flagsPrefix);
  21756. this.chunk(node.flags);
  21757. }
  21758. this.chunk(']');
  21759. }
  21760. };
  21761. var TYPE$t = tokenizer$3.TYPE;
  21762. var rawMode$4 = Raw.mode;
  21763. var WHITESPACE$7 = TYPE$t.WhiteSpace;
  21764. var COMMENT$5 = TYPE$t.Comment;
  21765. var SEMICOLON$2 = TYPE$t.Semicolon;
  21766. var ATKEYWORD$1 = TYPE$t.AtKeyword;
  21767. var LEFTCURLYBRACKET$1 = TYPE$t.LeftCurlyBracket;
  21768. var RIGHTCURLYBRACKET = TYPE$t.RightCurlyBracket;
  21769. function consumeRaw$4(startToken) {
  21770. return this.Raw(startToken, null, true);
  21771. }
  21772. function consumeRule() {
  21773. return this.parseWithFallback(this.Rule, consumeRaw$4);
  21774. }
  21775. function consumeRawDeclaration(startToken) {
  21776. return this.Raw(startToken, rawMode$4.semicolonIncluded, true);
  21777. }
  21778. function consumeDeclaration() {
  21779. if (this.scanner.tokenType === SEMICOLON$2) {
  21780. return consumeRawDeclaration.call(this, this.scanner.tokenIndex);
  21781. }
  21782. var node = this.parseWithFallback(this.Declaration, consumeRawDeclaration);
  21783. if (this.scanner.tokenType === SEMICOLON$2) {
  21784. this.scanner.next();
  21785. }
  21786. return node;
  21787. }
  21788. var Block = {
  21789. name: 'Block',
  21790. structure: {
  21791. children: [[
  21792. 'Atrule',
  21793. 'Rule',
  21794. 'Declaration'
  21795. ]]
  21796. },
  21797. parse: function(isDeclaration) {
  21798. var consumer = isDeclaration ? consumeDeclaration : consumeRule;
  21799. var start = this.scanner.tokenStart;
  21800. var children = this.createList();
  21801. this.eat(LEFTCURLYBRACKET$1);
  21802. scan:
  21803. while (!this.scanner.eof) {
  21804. switch (this.scanner.tokenType) {
  21805. case RIGHTCURLYBRACKET:
  21806. break scan;
  21807. case WHITESPACE$7:
  21808. case COMMENT$5:
  21809. this.scanner.next();
  21810. break;
  21811. case ATKEYWORD$1:
  21812. children.push(this.parseWithFallback(this.Atrule, consumeRaw$4));
  21813. break;
  21814. default:
  21815. children.push(consumer.call(this));
  21816. }
  21817. }
  21818. if (!this.scanner.eof) {
  21819. this.eat(RIGHTCURLYBRACKET);
  21820. }
  21821. return {
  21822. type: 'Block',
  21823. loc: this.getLocation(start, this.scanner.tokenStart),
  21824. children: children
  21825. };
  21826. },
  21827. generate: function(node) {
  21828. this.chunk('{');
  21829. this.children(node, function(prev) {
  21830. if (prev.type === 'Declaration') {
  21831. this.chunk(';');
  21832. }
  21833. });
  21834. this.chunk('}');
  21835. },
  21836. walkContext: 'block'
  21837. };
  21838. var TYPE$s = tokenizer$3.TYPE;
  21839. var LEFTSQUAREBRACKET$2 = TYPE$s.LeftSquareBracket;
  21840. var RIGHTSQUAREBRACKET = TYPE$s.RightSquareBracket;
  21841. var Brackets = {
  21842. name: 'Brackets',
  21843. structure: {
  21844. children: [[]]
  21845. },
  21846. parse: function(readSequence, recognizer) {
  21847. var start = this.scanner.tokenStart;
  21848. var children = null;
  21849. this.eat(LEFTSQUAREBRACKET$2);
  21850. children = readSequence.call(this, recognizer);
  21851. if (!this.scanner.eof) {
  21852. this.eat(RIGHTSQUAREBRACKET);
  21853. }
  21854. return {
  21855. type: 'Brackets',
  21856. loc: this.getLocation(start, this.scanner.tokenStart),
  21857. children: children
  21858. };
  21859. },
  21860. generate: function(node) {
  21861. this.chunk('[');
  21862. this.children(node);
  21863. this.chunk(']');
  21864. }
  21865. };
  21866. var CDC$1 = tokenizer$3.TYPE.CDC;
  21867. var CDC_1 = {
  21868. name: 'CDC',
  21869. structure: [],
  21870. parse: function() {
  21871. var start = this.scanner.tokenStart;
  21872. this.eat(CDC$1); // -->
  21873. return {
  21874. type: 'CDC',
  21875. loc: this.getLocation(start, this.scanner.tokenStart)
  21876. };
  21877. },
  21878. generate: function() {
  21879. this.chunk('-->');
  21880. }
  21881. };
  21882. var CDO$1 = tokenizer$3.TYPE.CDO;
  21883. var CDO_1 = {
  21884. name: 'CDO',
  21885. structure: [],
  21886. parse: function() {
  21887. var start = this.scanner.tokenStart;
  21888. this.eat(CDO$1); // <!--
  21889. return {
  21890. type: 'CDO',
  21891. loc: this.getLocation(start, this.scanner.tokenStart)
  21892. };
  21893. },
  21894. generate: function() {
  21895. this.chunk('<!--');
  21896. }
  21897. };
  21898. var TYPE$r = tokenizer$3.TYPE;
  21899. var IDENT$d = TYPE$r.Ident;
  21900. var FULLSTOP$2 = 0x002E; // U+002E FULL STOP (.)
  21901. // '.' ident
  21902. var ClassSelector = {
  21903. name: 'ClassSelector',
  21904. structure: {
  21905. name: String
  21906. },
  21907. parse: function() {
  21908. if (!this.scanner.isDelim(FULLSTOP$2)) {
  21909. this.error('Full stop is expected');
  21910. }
  21911. this.scanner.next();
  21912. return {
  21913. type: 'ClassSelector',
  21914. loc: this.getLocation(this.scanner.tokenStart - 1, this.scanner.tokenEnd),
  21915. name: this.consume(IDENT$d)
  21916. };
  21917. },
  21918. generate: function(node) {
  21919. this.chunk('.');
  21920. this.chunk(node.name);
  21921. }
  21922. };
  21923. var TYPE$q = tokenizer$3.TYPE;
  21924. var IDENT$c = TYPE$q.Ident;
  21925. var PLUSSIGN$4 = 0x002B; // U+002B PLUS SIGN (+)
  21926. var SOLIDUS$5 = 0x002F; // U+002F SOLIDUS (/)
  21927. var GREATERTHANSIGN$1 = 0x003E; // U+003E GREATER-THAN SIGN (>)
  21928. var TILDE$1 = 0x007E; // U+007E TILDE (~)
  21929. // + | > | ~ | /deep/
  21930. var Combinator = {
  21931. name: 'Combinator',
  21932. structure: {
  21933. name: String
  21934. },
  21935. parse: function() {
  21936. var start = this.scanner.tokenStart;
  21937. var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
  21938. switch (code) {
  21939. case GREATERTHANSIGN$1:
  21940. case PLUSSIGN$4:
  21941. case TILDE$1:
  21942. this.scanner.next();
  21943. break;
  21944. case SOLIDUS$5:
  21945. this.scanner.next();
  21946. if (this.scanner.tokenType !== IDENT$c || this.scanner.lookupValue(0, 'deep') === false) {
  21947. this.error('Identifier `deep` is expected');
  21948. }
  21949. this.scanner.next();
  21950. if (!this.scanner.isDelim(SOLIDUS$5)) {
  21951. this.error('Solidus is expected');
  21952. }
  21953. this.scanner.next();
  21954. break;
  21955. default:
  21956. this.error('Combinator is expected');
  21957. }
  21958. return {
  21959. type: 'Combinator',
  21960. loc: this.getLocation(start, this.scanner.tokenStart),
  21961. name: this.scanner.substrToCursor(start)
  21962. };
  21963. },
  21964. generate: function(node) {
  21965. this.chunk(node.name);
  21966. }
  21967. };
  21968. var TYPE$p = tokenizer$3.TYPE;
  21969. var COMMENT$4 = TYPE$p.Comment;
  21970. var ASTERISK$4 = 0x002A; // U+002A ASTERISK (*)
  21971. var SOLIDUS$4 = 0x002F; // U+002F SOLIDUS (/)
  21972. // '/*' .* '*/'
  21973. var Comment = {
  21974. name: 'Comment',
  21975. structure: {
  21976. value: String
  21977. },
  21978. parse: function() {
  21979. var start = this.scanner.tokenStart;
  21980. var end = this.scanner.tokenEnd;
  21981. this.eat(COMMENT$4);
  21982. if ((end - start + 2) >= 2 &&
  21983. this.scanner.source.charCodeAt(end - 2) === ASTERISK$4 &&
  21984. this.scanner.source.charCodeAt(end - 1) === SOLIDUS$4) {
  21985. end -= 2;
  21986. }
  21987. return {
  21988. type: 'Comment',
  21989. loc: this.getLocation(start, this.scanner.tokenStart),
  21990. value: this.scanner.source.substring(start + 2, end)
  21991. };
  21992. },
  21993. generate: function(node) {
  21994. this.chunk('/*');
  21995. this.chunk(node.value);
  21996. this.chunk('*/');
  21997. }
  21998. };
  21999. var isCustomProperty = names$2.isCustomProperty;
  22000. var TYPE$o = tokenizer$3.TYPE;
  22001. var rawMode$3 = Raw.mode;
  22002. var IDENT$b = TYPE$o.Ident;
  22003. var HASH$4 = TYPE$o.Hash;
  22004. var COLON$5 = TYPE$o.Colon;
  22005. var SEMICOLON$1 = TYPE$o.Semicolon;
  22006. var DELIM$4 = TYPE$o.Delim;
  22007. var WHITESPACE$6 = TYPE$o.WhiteSpace;
  22008. var EXCLAMATIONMARK$1 = 0x0021; // U+0021 EXCLAMATION MARK (!)
  22009. var NUMBERSIGN$2 = 0x0023; // U+0023 NUMBER SIGN (#)
  22010. var DOLLARSIGN = 0x0024; // U+0024 DOLLAR SIGN ($)
  22011. var AMPERSAND = 0x0026; // U+0026 ANPERSAND (&)
  22012. var ASTERISK$3 = 0x002A; // U+002A ASTERISK (*)
  22013. var PLUSSIGN$3 = 0x002B; // U+002B PLUS SIGN (+)
  22014. var SOLIDUS$3 = 0x002F; // U+002F SOLIDUS (/)
  22015. function consumeValueRaw(startToken) {
  22016. return this.Raw(startToken, rawMode$3.exclamationMarkOrSemicolon, true);
  22017. }
  22018. function consumeCustomPropertyRaw(startToken) {
  22019. return this.Raw(startToken, rawMode$3.exclamationMarkOrSemicolon, false);
  22020. }
  22021. function consumeValue() {
  22022. var startValueToken = this.scanner.tokenIndex;
  22023. var value = this.Value();
  22024. if (value.type !== 'Raw' &&
  22025. this.scanner.eof === false &&
  22026. this.scanner.tokenType !== SEMICOLON$1 &&
  22027. this.scanner.isDelim(EXCLAMATIONMARK$1) === false &&
  22028. this.scanner.isBalanceEdge(startValueToken) === false) {
  22029. this.error();
  22030. }
  22031. return value;
  22032. }
  22033. var Declaration = {
  22034. name: 'Declaration',
  22035. structure: {
  22036. important: [Boolean, String],
  22037. property: String,
  22038. value: ['Value', 'Raw']
  22039. },
  22040. parse: function() {
  22041. var start = this.scanner.tokenStart;
  22042. var startToken = this.scanner.tokenIndex;
  22043. var property = readProperty.call(this);
  22044. var customProperty = isCustomProperty(property);
  22045. var parseValue = customProperty ? this.parseCustomProperty : this.parseValue;
  22046. var consumeRaw = customProperty ? consumeCustomPropertyRaw : consumeValueRaw;
  22047. var important = false;
  22048. var value;
  22049. this.scanner.skipSC();
  22050. this.eat(COLON$5);
  22051. const valueStart = this.scanner.tokenIndex;
  22052. if (!customProperty) {
  22053. this.scanner.skipSC();
  22054. }
  22055. if (parseValue) {
  22056. value = this.parseWithFallback(consumeValue, consumeRaw);
  22057. } else {
  22058. value = consumeRaw.call(this, this.scanner.tokenIndex);
  22059. }
  22060. if (customProperty && value.type === 'Value' && value.children.isEmpty()) {
  22061. for (let offset = valueStart - this.scanner.tokenIndex; offset <= 0; offset++) {
  22062. if (this.scanner.lookupType(offset) === WHITESPACE$6) {
  22063. value.children.appendData({
  22064. type: 'WhiteSpace',
  22065. loc: null,
  22066. value: ' '
  22067. });
  22068. break;
  22069. }
  22070. }
  22071. }
  22072. if (this.scanner.isDelim(EXCLAMATIONMARK$1)) {
  22073. important = getImportant.call(this);
  22074. this.scanner.skipSC();
  22075. }
  22076. // Do not include semicolon to range per spec
  22077. // https://drafts.csswg.org/css-syntax/#declaration-diagram
  22078. if (this.scanner.eof === false &&
  22079. this.scanner.tokenType !== SEMICOLON$1 &&
  22080. this.scanner.isBalanceEdge(startToken) === false) {
  22081. this.error();
  22082. }
  22083. return {
  22084. type: 'Declaration',
  22085. loc: this.getLocation(start, this.scanner.tokenStart),
  22086. important: important,
  22087. property: property,
  22088. value: value
  22089. };
  22090. },
  22091. generate: function(node) {
  22092. this.chunk(node.property);
  22093. this.chunk(':');
  22094. this.node(node.value);
  22095. if (node.important) {
  22096. this.chunk(node.important === true ? '!important' : '!' + node.important);
  22097. }
  22098. },
  22099. walkContext: 'declaration'
  22100. };
  22101. function readProperty() {
  22102. var start = this.scanner.tokenStart;
  22103. // hacks
  22104. if (this.scanner.tokenType === DELIM$4) {
  22105. switch (this.scanner.source.charCodeAt(this.scanner.tokenStart)) {
  22106. case ASTERISK$3:
  22107. case DOLLARSIGN:
  22108. case PLUSSIGN$3:
  22109. case NUMBERSIGN$2:
  22110. case AMPERSAND:
  22111. this.scanner.next();
  22112. break;
  22113. // TODO: not sure we should support this hack
  22114. case SOLIDUS$3:
  22115. this.scanner.next();
  22116. if (this.scanner.isDelim(SOLIDUS$3)) {
  22117. this.scanner.next();
  22118. }
  22119. break;
  22120. }
  22121. }
  22122. if (this.scanner.tokenType === HASH$4) {
  22123. this.eat(HASH$4);
  22124. } else {
  22125. this.eat(IDENT$b);
  22126. }
  22127. return this.scanner.substrToCursor(start);
  22128. }
  22129. // ! ws* important
  22130. function getImportant() {
  22131. this.eat(DELIM$4);
  22132. this.scanner.skipSC();
  22133. var important = this.consume(IDENT$b);
  22134. // store original value in case it differ from `important`
  22135. // for better original source restoring and hacks like `!ie` support
  22136. return important === 'important' ? true : important;
  22137. }
  22138. var TYPE$n = tokenizer$3.TYPE;
  22139. var rawMode$2 = Raw.mode;
  22140. var WHITESPACE$5 = TYPE$n.WhiteSpace;
  22141. var COMMENT$3 = TYPE$n.Comment;
  22142. var SEMICOLON = TYPE$n.Semicolon;
  22143. function consumeRaw$3(startToken) {
  22144. return this.Raw(startToken, rawMode$2.semicolonIncluded, true);
  22145. }
  22146. var DeclarationList = {
  22147. name: 'DeclarationList',
  22148. structure: {
  22149. children: [[
  22150. 'Declaration'
  22151. ]]
  22152. },
  22153. parse: function() {
  22154. var children = this.createList();
  22155. while (!this.scanner.eof) {
  22156. switch (this.scanner.tokenType) {
  22157. case WHITESPACE$5:
  22158. case COMMENT$3:
  22159. case SEMICOLON:
  22160. this.scanner.next();
  22161. break;
  22162. default:
  22163. children.push(this.parseWithFallback(this.Declaration, consumeRaw$3));
  22164. }
  22165. }
  22166. return {
  22167. type: 'DeclarationList',
  22168. loc: this.getLocationFromList(children),
  22169. children: children
  22170. };
  22171. },
  22172. generate: function(node) {
  22173. this.children(node, function(prev) {
  22174. if (prev.type === 'Declaration') {
  22175. this.chunk(';');
  22176. }
  22177. });
  22178. }
  22179. };
  22180. var consumeNumber$2 = utils$2.consumeNumber;
  22181. var TYPE$m = tokenizer$3.TYPE;
  22182. var DIMENSION$4 = TYPE$m.Dimension;
  22183. var Dimension = {
  22184. name: 'Dimension',
  22185. structure: {
  22186. value: String,
  22187. unit: String
  22188. },
  22189. parse: function() {
  22190. var start = this.scanner.tokenStart;
  22191. var numberEnd = consumeNumber$2(this.scanner.source, start);
  22192. this.eat(DIMENSION$4);
  22193. return {
  22194. type: 'Dimension',
  22195. loc: this.getLocation(start, this.scanner.tokenStart),
  22196. value: this.scanner.source.substring(start, numberEnd),
  22197. unit: this.scanner.source.substring(numberEnd, this.scanner.tokenStart)
  22198. };
  22199. },
  22200. generate: function(node) {
  22201. this.chunk(node.value);
  22202. this.chunk(node.unit);
  22203. }
  22204. };
  22205. var TYPE$l = tokenizer$3.TYPE;
  22206. var RIGHTPARENTHESIS$5 = TYPE$l.RightParenthesis;
  22207. // <function-token> <sequence> )
  22208. var _Function = {
  22209. name: 'Function',
  22210. structure: {
  22211. name: String,
  22212. children: [[]]
  22213. },
  22214. parse: function(readSequence, recognizer) {
  22215. var start = this.scanner.tokenStart;
  22216. var name = this.consumeFunctionName();
  22217. var nameLowerCase = name.toLowerCase();
  22218. var children;
  22219. children = recognizer.hasOwnProperty(nameLowerCase)
  22220. ? recognizer[nameLowerCase].call(this, recognizer)
  22221. : readSequence.call(this, recognizer);
  22222. if (!this.scanner.eof) {
  22223. this.eat(RIGHTPARENTHESIS$5);
  22224. }
  22225. return {
  22226. type: 'Function',
  22227. loc: this.getLocation(start, this.scanner.tokenStart),
  22228. name: name,
  22229. children: children
  22230. };
  22231. },
  22232. generate: function(node) {
  22233. this.chunk(node.name);
  22234. this.chunk('(');
  22235. this.children(node);
  22236. this.chunk(')');
  22237. },
  22238. walkContext: 'function'
  22239. };
  22240. var TYPE$k = tokenizer$3.TYPE;
  22241. var HASH$3 = TYPE$k.Hash;
  22242. // '#' ident
  22243. var Hash = {
  22244. name: 'Hash',
  22245. structure: {
  22246. value: String
  22247. },
  22248. parse: function() {
  22249. var start = this.scanner.tokenStart;
  22250. this.eat(HASH$3);
  22251. return {
  22252. type: 'Hash',
  22253. loc: this.getLocation(start, this.scanner.tokenStart),
  22254. value: this.scanner.substrToCursor(start + 1)
  22255. };
  22256. },
  22257. generate: function(node) {
  22258. this.chunk('#');
  22259. this.chunk(node.value);
  22260. }
  22261. };
  22262. var TYPE$j = tokenizer$3.TYPE;
  22263. var IDENT$a = TYPE$j.Ident;
  22264. var Identifier = {
  22265. name: 'Identifier',
  22266. structure: {
  22267. name: String
  22268. },
  22269. parse: function() {
  22270. return {
  22271. type: 'Identifier',
  22272. loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
  22273. name: this.consume(IDENT$a)
  22274. };
  22275. },
  22276. generate: function(node) {
  22277. this.chunk(node.name);
  22278. }
  22279. };
  22280. var TYPE$i = tokenizer$3.TYPE;
  22281. var HASH$2 = TYPE$i.Hash;
  22282. // <hash-token>
  22283. var IdSelector = {
  22284. name: 'IdSelector',
  22285. structure: {
  22286. name: String
  22287. },
  22288. parse: function() {
  22289. var start = this.scanner.tokenStart;
  22290. // TODO: check value is an ident
  22291. this.eat(HASH$2);
  22292. return {
  22293. type: 'IdSelector',
  22294. loc: this.getLocation(start, this.scanner.tokenStart),
  22295. name: this.scanner.substrToCursor(start + 1)
  22296. };
  22297. },
  22298. generate: function(node) {
  22299. this.chunk('#');
  22300. this.chunk(node.name);
  22301. }
  22302. };
  22303. var TYPE$h = tokenizer$3.TYPE;
  22304. var IDENT$9 = TYPE$h.Ident;
  22305. var NUMBER$5 = TYPE$h.Number;
  22306. var DIMENSION$3 = TYPE$h.Dimension;
  22307. var LEFTPARENTHESIS$5 = TYPE$h.LeftParenthesis;
  22308. var RIGHTPARENTHESIS$4 = TYPE$h.RightParenthesis;
  22309. var COLON$4 = TYPE$h.Colon;
  22310. var DELIM$3 = TYPE$h.Delim;
  22311. var MediaFeature = {
  22312. name: 'MediaFeature',
  22313. structure: {
  22314. name: String,
  22315. value: ['Identifier', 'Number', 'Dimension', 'Ratio', null]
  22316. },
  22317. parse: function() {
  22318. var start = this.scanner.tokenStart;
  22319. var name;
  22320. var value = null;
  22321. this.eat(LEFTPARENTHESIS$5);
  22322. this.scanner.skipSC();
  22323. name = this.consume(IDENT$9);
  22324. this.scanner.skipSC();
  22325. if (this.scanner.tokenType !== RIGHTPARENTHESIS$4) {
  22326. this.eat(COLON$4);
  22327. this.scanner.skipSC();
  22328. switch (this.scanner.tokenType) {
  22329. case NUMBER$5:
  22330. if (this.lookupNonWSType(1) === DELIM$3) {
  22331. value = this.Ratio();
  22332. } else {
  22333. value = this.Number();
  22334. }
  22335. break;
  22336. case DIMENSION$3:
  22337. value = this.Dimension();
  22338. break;
  22339. case IDENT$9:
  22340. value = this.Identifier();
  22341. break;
  22342. default:
  22343. this.error('Number, dimension, ratio or identifier is expected');
  22344. }
  22345. this.scanner.skipSC();
  22346. }
  22347. this.eat(RIGHTPARENTHESIS$4);
  22348. return {
  22349. type: 'MediaFeature',
  22350. loc: this.getLocation(start, this.scanner.tokenStart),
  22351. name: name,
  22352. value: value
  22353. };
  22354. },
  22355. generate: function(node) {
  22356. this.chunk('(');
  22357. this.chunk(node.name);
  22358. if (node.value !== null) {
  22359. this.chunk(':');
  22360. this.node(node.value);
  22361. }
  22362. this.chunk(')');
  22363. }
  22364. };
  22365. var TYPE$g = tokenizer$3.TYPE;
  22366. var WHITESPACE$4 = TYPE$g.WhiteSpace;
  22367. var COMMENT$2 = TYPE$g.Comment;
  22368. var IDENT$8 = TYPE$g.Ident;
  22369. var LEFTPARENTHESIS$4 = TYPE$g.LeftParenthesis;
  22370. var MediaQuery = {
  22371. name: 'MediaQuery',
  22372. structure: {
  22373. children: [[
  22374. 'Identifier',
  22375. 'MediaFeature',
  22376. 'WhiteSpace'
  22377. ]]
  22378. },
  22379. parse: function() {
  22380. this.scanner.skipSC();
  22381. var children = this.createList();
  22382. var child = null;
  22383. var space = null;
  22384. scan:
  22385. while (!this.scanner.eof) {
  22386. switch (this.scanner.tokenType) {
  22387. case COMMENT$2:
  22388. this.scanner.next();
  22389. continue;
  22390. case WHITESPACE$4:
  22391. space = this.WhiteSpace();
  22392. continue;
  22393. case IDENT$8:
  22394. child = this.Identifier();
  22395. break;
  22396. case LEFTPARENTHESIS$4:
  22397. child = this.MediaFeature();
  22398. break;
  22399. default:
  22400. break scan;
  22401. }
  22402. if (space !== null) {
  22403. children.push(space);
  22404. space = null;
  22405. }
  22406. children.push(child);
  22407. }
  22408. if (child === null) {
  22409. this.error('Identifier or parenthesis is expected');
  22410. }
  22411. return {
  22412. type: 'MediaQuery',
  22413. loc: this.getLocationFromList(children),
  22414. children: children
  22415. };
  22416. },
  22417. generate: function(node) {
  22418. this.children(node);
  22419. }
  22420. };
  22421. var COMMA$3 = tokenizer$3.TYPE.Comma;
  22422. var MediaQueryList = {
  22423. name: 'MediaQueryList',
  22424. structure: {
  22425. children: [[
  22426. 'MediaQuery'
  22427. ]]
  22428. },
  22429. parse: function(relative) {
  22430. var children = this.createList();
  22431. this.scanner.skipSC();
  22432. while (!this.scanner.eof) {
  22433. children.push(this.MediaQuery(relative));
  22434. if (this.scanner.tokenType !== COMMA$3) {
  22435. break;
  22436. }
  22437. this.scanner.next();
  22438. }
  22439. return {
  22440. type: 'MediaQueryList',
  22441. loc: this.getLocationFromList(children),
  22442. children: children
  22443. };
  22444. },
  22445. generate: function(node) {
  22446. this.children(node, function() {
  22447. this.chunk(',');
  22448. });
  22449. }
  22450. };
  22451. var Nth = {
  22452. name: 'Nth',
  22453. structure: {
  22454. nth: ['AnPlusB', 'Identifier'],
  22455. selector: ['SelectorList', null]
  22456. },
  22457. parse: function(allowOfClause) {
  22458. this.scanner.skipSC();
  22459. var start = this.scanner.tokenStart;
  22460. var end = start;
  22461. var selector = null;
  22462. var query;
  22463. if (this.scanner.lookupValue(0, 'odd') || this.scanner.lookupValue(0, 'even')) {
  22464. query = this.Identifier();
  22465. } else {
  22466. query = this.AnPlusB();
  22467. }
  22468. this.scanner.skipSC();
  22469. if (allowOfClause && this.scanner.lookupValue(0, 'of')) {
  22470. this.scanner.next();
  22471. selector = this.SelectorList();
  22472. if (this.needPositions) {
  22473. end = this.getLastListNode(selector.children).loc.end.offset;
  22474. }
  22475. } else {
  22476. if (this.needPositions) {
  22477. end = query.loc.end.offset;
  22478. }
  22479. }
  22480. return {
  22481. type: 'Nth',
  22482. loc: this.getLocation(start, end),
  22483. nth: query,
  22484. selector: selector
  22485. };
  22486. },
  22487. generate: function(node) {
  22488. this.node(node.nth);
  22489. if (node.selector !== null) {
  22490. this.chunk(' of ');
  22491. this.node(node.selector);
  22492. }
  22493. }
  22494. };
  22495. var NUMBER$4 = tokenizer$3.TYPE.Number;
  22496. var _Number = {
  22497. name: 'Number',
  22498. structure: {
  22499. value: String
  22500. },
  22501. parse: function() {
  22502. return {
  22503. type: 'Number',
  22504. loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
  22505. value: this.consume(NUMBER$4)
  22506. };
  22507. },
  22508. generate: function(node) {
  22509. this.chunk(node.value);
  22510. }
  22511. };
  22512. // '/' | '*' | ',' | ':' | '+' | '-'
  22513. var Operator = {
  22514. name: 'Operator',
  22515. structure: {
  22516. value: String
  22517. },
  22518. parse: function() {
  22519. var start = this.scanner.tokenStart;
  22520. this.scanner.next();
  22521. return {
  22522. type: 'Operator',
  22523. loc: this.getLocation(start, this.scanner.tokenStart),
  22524. value: this.scanner.substrToCursor(start)
  22525. };
  22526. },
  22527. generate: function(node) {
  22528. this.chunk(node.value);
  22529. }
  22530. };
  22531. var TYPE$f = tokenizer$3.TYPE;
  22532. var LEFTPARENTHESIS$3 = TYPE$f.LeftParenthesis;
  22533. var RIGHTPARENTHESIS$3 = TYPE$f.RightParenthesis;
  22534. var Parentheses = {
  22535. name: 'Parentheses',
  22536. structure: {
  22537. children: [[]]
  22538. },
  22539. parse: function(readSequence, recognizer) {
  22540. var start = this.scanner.tokenStart;
  22541. var children = null;
  22542. this.eat(LEFTPARENTHESIS$3);
  22543. children = readSequence.call(this, recognizer);
  22544. if (!this.scanner.eof) {
  22545. this.eat(RIGHTPARENTHESIS$3);
  22546. }
  22547. return {
  22548. type: 'Parentheses',
  22549. loc: this.getLocation(start, this.scanner.tokenStart),
  22550. children: children
  22551. };
  22552. },
  22553. generate: function(node) {
  22554. this.chunk('(');
  22555. this.children(node);
  22556. this.chunk(')');
  22557. }
  22558. };
  22559. var consumeNumber$1 = utils$2.consumeNumber;
  22560. var TYPE$e = tokenizer$3.TYPE;
  22561. var PERCENTAGE$2 = TYPE$e.Percentage;
  22562. var Percentage = {
  22563. name: 'Percentage',
  22564. structure: {
  22565. value: String
  22566. },
  22567. parse: function() {
  22568. var start = this.scanner.tokenStart;
  22569. var numberEnd = consumeNumber$1(this.scanner.source, start);
  22570. this.eat(PERCENTAGE$2);
  22571. return {
  22572. type: 'Percentage',
  22573. loc: this.getLocation(start, this.scanner.tokenStart),
  22574. value: this.scanner.source.substring(start, numberEnd)
  22575. };
  22576. },
  22577. generate: function(node) {
  22578. this.chunk(node.value);
  22579. this.chunk('%');
  22580. }
  22581. };
  22582. var TYPE$d = tokenizer$3.TYPE;
  22583. var IDENT$7 = TYPE$d.Ident;
  22584. var FUNCTION$5 = TYPE$d.Function;
  22585. var COLON$3 = TYPE$d.Colon;
  22586. var RIGHTPARENTHESIS$2 = TYPE$d.RightParenthesis;
  22587. // : [ <ident> | <function-token> <any-value>? ) ]
  22588. var PseudoClassSelector = {
  22589. name: 'PseudoClassSelector',
  22590. structure: {
  22591. name: String,
  22592. children: [['Raw'], null]
  22593. },
  22594. parse: function() {
  22595. var start = this.scanner.tokenStart;
  22596. var children = null;
  22597. var name;
  22598. var nameLowerCase;
  22599. this.eat(COLON$3);
  22600. if (this.scanner.tokenType === FUNCTION$5) {
  22601. name = this.consumeFunctionName();
  22602. nameLowerCase = name.toLowerCase();
  22603. if (this.pseudo.hasOwnProperty(nameLowerCase)) {
  22604. this.scanner.skipSC();
  22605. children = this.pseudo[nameLowerCase].call(this);
  22606. this.scanner.skipSC();
  22607. } else {
  22608. children = this.createList();
  22609. children.push(
  22610. this.Raw(this.scanner.tokenIndex, null, false)
  22611. );
  22612. }
  22613. this.eat(RIGHTPARENTHESIS$2);
  22614. } else {
  22615. name = this.consume(IDENT$7);
  22616. }
  22617. return {
  22618. type: 'PseudoClassSelector',
  22619. loc: this.getLocation(start, this.scanner.tokenStart),
  22620. name: name,
  22621. children: children
  22622. };
  22623. },
  22624. generate: function(node) {
  22625. this.chunk(':');
  22626. this.chunk(node.name);
  22627. if (node.children !== null) {
  22628. this.chunk('(');
  22629. this.children(node);
  22630. this.chunk(')');
  22631. }
  22632. },
  22633. walkContext: 'function'
  22634. };
  22635. var TYPE$c = tokenizer$3.TYPE;
  22636. var IDENT$6 = TYPE$c.Ident;
  22637. var FUNCTION$4 = TYPE$c.Function;
  22638. var COLON$2 = TYPE$c.Colon;
  22639. var RIGHTPARENTHESIS$1 = TYPE$c.RightParenthesis;
  22640. // :: [ <ident> | <function-token> <any-value>? ) ]
  22641. var PseudoElementSelector = {
  22642. name: 'PseudoElementSelector',
  22643. structure: {
  22644. name: String,
  22645. children: [['Raw'], null]
  22646. },
  22647. parse: function() {
  22648. var start = this.scanner.tokenStart;
  22649. var children = null;
  22650. var name;
  22651. var nameLowerCase;
  22652. this.eat(COLON$2);
  22653. this.eat(COLON$2);
  22654. if (this.scanner.tokenType === FUNCTION$4) {
  22655. name = this.consumeFunctionName();
  22656. nameLowerCase = name.toLowerCase();
  22657. if (this.pseudo.hasOwnProperty(nameLowerCase)) {
  22658. this.scanner.skipSC();
  22659. children = this.pseudo[nameLowerCase].call(this);
  22660. this.scanner.skipSC();
  22661. } else {
  22662. children = this.createList();
  22663. children.push(
  22664. this.Raw(this.scanner.tokenIndex, null, false)
  22665. );
  22666. }
  22667. this.eat(RIGHTPARENTHESIS$1);
  22668. } else {
  22669. name = this.consume(IDENT$6);
  22670. }
  22671. return {
  22672. type: 'PseudoElementSelector',
  22673. loc: this.getLocation(start, this.scanner.tokenStart),
  22674. name: name,
  22675. children: children
  22676. };
  22677. },
  22678. generate: function(node) {
  22679. this.chunk('::');
  22680. this.chunk(node.name);
  22681. if (node.children !== null) {
  22682. this.chunk('(');
  22683. this.children(node);
  22684. this.chunk(')');
  22685. }
  22686. },
  22687. walkContext: 'function'
  22688. };
  22689. var isDigit = tokenizer$3.isDigit;
  22690. var TYPE$b = tokenizer$3.TYPE;
  22691. var NUMBER$3 = TYPE$b.Number;
  22692. var DELIM$2 = TYPE$b.Delim;
  22693. var SOLIDUS$2 = 0x002F; // U+002F SOLIDUS (/)
  22694. var FULLSTOP$1 = 0x002E; // U+002E FULL STOP (.)
  22695. // Terms of <ratio> should be a positive numbers (not zero or negative)
  22696. // (see https://drafts.csswg.org/mediaqueries-3/#values)
  22697. // However, -o-min-device-pixel-ratio takes fractional values as a ratio's term
  22698. // and this is using by various sites. Therefore we relax checking on parse
  22699. // to test a term is unsigned number without an exponent part.
  22700. // Additional checking may be applied on lexer validation.
  22701. function consumeNumber() {
  22702. this.scanner.skipWS();
  22703. var value = this.consume(NUMBER$3);
  22704. for (var i = 0; i < value.length; i++) {
  22705. var code = value.charCodeAt(i);
  22706. if (!isDigit(code) && code !== FULLSTOP$1) {
  22707. this.error('Unsigned number is expected', this.scanner.tokenStart - value.length + i);
  22708. }
  22709. }
  22710. if (Number(value) === 0) {
  22711. this.error('Zero number is not allowed', this.scanner.tokenStart - value.length);
  22712. }
  22713. return value;
  22714. }
  22715. // <positive-integer> S* '/' S* <positive-integer>
  22716. var Ratio = {
  22717. name: 'Ratio',
  22718. structure: {
  22719. left: String,
  22720. right: String
  22721. },
  22722. parse: function() {
  22723. var start = this.scanner.tokenStart;
  22724. var left = consumeNumber.call(this);
  22725. var right;
  22726. this.scanner.skipWS();
  22727. if (!this.scanner.isDelim(SOLIDUS$2)) {
  22728. this.error('Solidus is expected');
  22729. }
  22730. this.eat(DELIM$2);
  22731. right = consumeNumber.call(this);
  22732. return {
  22733. type: 'Ratio',
  22734. loc: this.getLocation(start, this.scanner.tokenStart),
  22735. left: left,
  22736. right: right
  22737. };
  22738. },
  22739. generate: function(node) {
  22740. this.chunk(node.left);
  22741. this.chunk('/');
  22742. this.chunk(node.right);
  22743. }
  22744. };
  22745. var TYPE$a = tokenizer$3.TYPE;
  22746. var rawMode$1 = Raw.mode;
  22747. var LEFTCURLYBRACKET = TYPE$a.LeftCurlyBracket;
  22748. function consumeRaw$2(startToken) {
  22749. return this.Raw(startToken, rawMode$1.leftCurlyBracket, true);
  22750. }
  22751. function consumePrelude() {
  22752. var prelude = this.SelectorList();
  22753. if (prelude.type !== 'Raw' &&
  22754. this.scanner.eof === false &&
  22755. this.scanner.tokenType !== LEFTCURLYBRACKET) {
  22756. this.error();
  22757. }
  22758. return prelude;
  22759. }
  22760. var Rule = {
  22761. name: 'Rule',
  22762. structure: {
  22763. prelude: ['SelectorList', 'Raw'],
  22764. block: ['Block']
  22765. },
  22766. parse: function() {
  22767. var startToken = this.scanner.tokenIndex;
  22768. var startOffset = this.scanner.tokenStart;
  22769. var prelude;
  22770. var block;
  22771. if (this.parseRulePrelude) {
  22772. prelude = this.parseWithFallback(consumePrelude, consumeRaw$2);
  22773. } else {
  22774. prelude = consumeRaw$2.call(this, startToken);
  22775. }
  22776. block = this.Block(true);
  22777. return {
  22778. type: 'Rule',
  22779. loc: this.getLocation(startOffset, this.scanner.tokenStart),
  22780. prelude: prelude,
  22781. block: block
  22782. };
  22783. },
  22784. generate: function(node) {
  22785. this.node(node.prelude);
  22786. this.node(node.block);
  22787. },
  22788. walkContext: 'rule'
  22789. };
  22790. var Selector = {
  22791. name: 'Selector',
  22792. structure: {
  22793. children: [[
  22794. 'TypeSelector',
  22795. 'IdSelector',
  22796. 'ClassSelector',
  22797. 'AttributeSelector',
  22798. 'PseudoClassSelector',
  22799. 'PseudoElementSelector',
  22800. 'Combinator',
  22801. 'WhiteSpace'
  22802. ]]
  22803. },
  22804. parse: function() {
  22805. var children = this.readSequence(this.scope.Selector);
  22806. // nothing were consumed
  22807. if (this.getFirstListNode(children) === null) {
  22808. this.error('Selector is expected');
  22809. }
  22810. return {
  22811. type: 'Selector',
  22812. loc: this.getLocationFromList(children),
  22813. children: children
  22814. };
  22815. },
  22816. generate: function(node) {
  22817. this.children(node);
  22818. }
  22819. };
  22820. var TYPE$9 = tokenizer$3.TYPE;
  22821. var COMMA$2 = TYPE$9.Comma;
  22822. var SelectorList = {
  22823. name: 'SelectorList',
  22824. structure: {
  22825. children: [[
  22826. 'Selector',
  22827. 'Raw'
  22828. ]]
  22829. },
  22830. parse: function() {
  22831. var children = this.createList();
  22832. while (!this.scanner.eof) {
  22833. children.push(this.Selector());
  22834. if (this.scanner.tokenType === COMMA$2) {
  22835. this.scanner.next();
  22836. continue;
  22837. }
  22838. break;
  22839. }
  22840. return {
  22841. type: 'SelectorList',
  22842. loc: this.getLocationFromList(children),
  22843. children: children
  22844. };
  22845. },
  22846. generate: function(node) {
  22847. this.children(node, function() {
  22848. this.chunk(',');
  22849. });
  22850. },
  22851. walkContext: 'selector'
  22852. };
  22853. var STRING$2 = tokenizer$3.TYPE.String;
  22854. var _String = {
  22855. name: 'String',
  22856. structure: {
  22857. value: String
  22858. },
  22859. parse: function() {
  22860. return {
  22861. type: 'String',
  22862. loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
  22863. value: this.consume(STRING$2)
  22864. };
  22865. },
  22866. generate: function(node) {
  22867. this.chunk(node.value);
  22868. }
  22869. };
  22870. var TYPE$8 = tokenizer$3.TYPE;
  22871. var WHITESPACE$3 = TYPE$8.WhiteSpace;
  22872. var COMMENT$1 = TYPE$8.Comment;
  22873. var ATKEYWORD = TYPE$8.AtKeyword;
  22874. var CDO = TYPE$8.CDO;
  22875. var CDC = TYPE$8.CDC;
  22876. var EXCLAMATIONMARK = 0x0021; // U+0021 EXCLAMATION MARK (!)
  22877. function consumeRaw$1(startToken) {
  22878. return this.Raw(startToken, null, false);
  22879. }
  22880. var StyleSheet = {
  22881. name: 'StyleSheet',
  22882. structure: {
  22883. children: [[
  22884. 'Comment',
  22885. 'CDO',
  22886. 'CDC',
  22887. 'Atrule',
  22888. 'Rule',
  22889. 'Raw'
  22890. ]]
  22891. },
  22892. parse: function() {
  22893. var start = this.scanner.tokenStart;
  22894. var children = this.createList();
  22895. var child;
  22896. while (!this.scanner.eof) {
  22897. switch (this.scanner.tokenType) {
  22898. case WHITESPACE$3:
  22899. this.scanner.next();
  22900. continue;
  22901. case COMMENT$1:
  22902. // ignore comments except exclamation comments (i.e. /*! .. */) on top level
  22903. if (this.scanner.source.charCodeAt(this.scanner.tokenStart + 2) !== EXCLAMATIONMARK) {
  22904. this.scanner.next();
  22905. continue;
  22906. }
  22907. child = this.Comment();
  22908. break;
  22909. case CDO: // <!--
  22910. child = this.CDO();
  22911. break;
  22912. case CDC: // -->
  22913. child = this.CDC();
  22914. break;
  22915. // CSS Syntax Module Level 3
  22916. // §2.2 Error handling
  22917. // At the "top level" of a stylesheet, an <at-keyword-token> starts an at-rule.
  22918. case ATKEYWORD:
  22919. child = this.parseWithFallback(this.Atrule, consumeRaw$1);
  22920. break;
  22921. // Anything else starts a qualified rule ...
  22922. default:
  22923. child = this.parseWithFallback(this.Rule, consumeRaw$1);
  22924. }
  22925. children.push(child);
  22926. }
  22927. return {
  22928. type: 'StyleSheet',
  22929. loc: this.getLocation(start, this.scanner.tokenStart),
  22930. children: children
  22931. };
  22932. },
  22933. generate: function(node) {
  22934. this.children(node);
  22935. },
  22936. walkContext: 'stylesheet'
  22937. };
  22938. var TYPE$7 = tokenizer$3.TYPE;
  22939. var IDENT$5 = TYPE$7.Ident;
  22940. var ASTERISK$2 = 0x002A; // U+002A ASTERISK (*)
  22941. var VERTICALLINE$1 = 0x007C; // U+007C VERTICAL LINE (|)
  22942. function eatIdentifierOrAsterisk() {
  22943. if (this.scanner.tokenType !== IDENT$5 &&
  22944. this.scanner.isDelim(ASTERISK$2) === false) {
  22945. this.error('Identifier or asterisk is expected');
  22946. }
  22947. this.scanner.next();
  22948. }
  22949. // ident
  22950. // ident|ident
  22951. // ident|*
  22952. // *
  22953. // *|ident
  22954. // *|*
  22955. // |ident
  22956. // |*
  22957. var TypeSelector = {
  22958. name: 'TypeSelector',
  22959. structure: {
  22960. name: String
  22961. },
  22962. parse: function() {
  22963. var start = this.scanner.tokenStart;
  22964. if (this.scanner.isDelim(VERTICALLINE$1)) {
  22965. this.scanner.next();
  22966. eatIdentifierOrAsterisk.call(this);
  22967. } else {
  22968. eatIdentifierOrAsterisk.call(this);
  22969. if (this.scanner.isDelim(VERTICALLINE$1)) {
  22970. this.scanner.next();
  22971. eatIdentifierOrAsterisk.call(this);
  22972. }
  22973. }
  22974. return {
  22975. type: 'TypeSelector',
  22976. loc: this.getLocation(start, this.scanner.tokenStart),
  22977. name: this.scanner.substrToCursor(start)
  22978. };
  22979. },
  22980. generate: function(node) {
  22981. this.chunk(node.name);
  22982. }
  22983. };
  22984. var isHexDigit = tokenizer$3.isHexDigit;
  22985. var cmpChar$1 = tokenizer$3.cmpChar;
  22986. var TYPE$6 = tokenizer$3.TYPE;
  22987. var NAME = tokenizer$3.NAME;
  22988. var IDENT$4 = TYPE$6.Ident;
  22989. var NUMBER$2 = TYPE$6.Number;
  22990. var DIMENSION$2 = TYPE$6.Dimension;
  22991. var PLUSSIGN$2 = 0x002B; // U+002B PLUS SIGN (+)
  22992. var HYPHENMINUS$1 = 0x002D; // U+002D HYPHEN-MINUS (-)
  22993. var QUESTIONMARK = 0x003F; // U+003F QUESTION MARK (?)
  22994. var U$1 = 0x0075; // U+0075 LATIN SMALL LETTER U (u)
  22995. function eatHexSequence(offset, allowDash) {
  22996. for (var pos = this.scanner.tokenStart + offset, len = 0; pos < this.scanner.tokenEnd; pos++) {
  22997. var code = this.scanner.source.charCodeAt(pos);
  22998. if (code === HYPHENMINUS$1 && allowDash && len !== 0) {
  22999. if (eatHexSequence.call(this, offset + len + 1, false) === 0) {
  23000. this.error();
  23001. }
  23002. return -1;
  23003. }
  23004. if (!isHexDigit(code)) {
  23005. this.error(
  23006. allowDash && len !== 0
  23007. ? 'HyphenMinus' + (len < 6 ? ' or hex digit' : '') + ' is expected'
  23008. : (len < 6 ? 'Hex digit is expected' : 'Unexpected input'),
  23009. pos
  23010. );
  23011. }
  23012. if (++len > 6) {
  23013. this.error('Too many hex digits', pos);
  23014. } }
  23015. this.scanner.next();
  23016. return len;
  23017. }
  23018. function eatQuestionMarkSequence(max) {
  23019. var count = 0;
  23020. while (this.scanner.isDelim(QUESTIONMARK)) {
  23021. if (++count > max) {
  23022. this.error('Too many question marks');
  23023. }
  23024. this.scanner.next();
  23025. }
  23026. }
  23027. function startsWith(code) {
  23028. if (this.scanner.source.charCodeAt(this.scanner.tokenStart) !== code) {
  23029. this.error(NAME[code] + ' is expected');
  23030. }
  23031. }
  23032. // https://drafts.csswg.org/css-syntax/#urange
  23033. // Informally, the <urange> production has three forms:
  23034. // U+0001
  23035. // Defines a range consisting of a single code point, in this case the code point "1".
  23036. // U+0001-00ff
  23037. // Defines a range of codepoints between the first and the second value, in this case
  23038. // the range between "1" and "ff" (255 in decimal) inclusive.
  23039. // U+00??
  23040. // Defines a range of codepoints where the "?" characters range over all hex digits,
  23041. // in this case defining the same as the value U+0000-00ff.
  23042. // In each form, a maximum of 6 digits is allowed for each hexadecimal number (if you treat "?" as a hexadecimal digit).
  23043. //
  23044. // <urange> =
  23045. // u '+' <ident-token> '?'* |
  23046. // u <dimension-token> '?'* |
  23047. // u <number-token> '?'* |
  23048. // u <number-token> <dimension-token> |
  23049. // u <number-token> <number-token> |
  23050. // u '+' '?'+
  23051. function scanUnicodeRange() {
  23052. var hexLength = 0;
  23053. // u '+' <ident-token> '?'*
  23054. // u '+' '?'+
  23055. if (this.scanner.isDelim(PLUSSIGN$2)) {
  23056. this.scanner.next();
  23057. if (this.scanner.tokenType === IDENT$4) {
  23058. hexLength = eatHexSequence.call(this, 0, true);
  23059. if (hexLength > 0) {
  23060. eatQuestionMarkSequence.call(this, 6 - hexLength);
  23061. }
  23062. return;
  23063. }
  23064. if (this.scanner.isDelim(QUESTIONMARK)) {
  23065. this.scanner.next();
  23066. eatQuestionMarkSequence.call(this, 5);
  23067. return;
  23068. }
  23069. this.error('Hex digit or question mark is expected');
  23070. return;
  23071. }
  23072. // u <number-token> '?'*
  23073. // u <number-token> <dimension-token>
  23074. // u <number-token> <number-token>
  23075. if (this.scanner.tokenType === NUMBER$2) {
  23076. startsWith.call(this, PLUSSIGN$2);
  23077. hexLength = eatHexSequence.call(this, 1, true);
  23078. if (this.scanner.isDelim(QUESTIONMARK)) {
  23079. eatQuestionMarkSequence.call(this, 6 - hexLength);
  23080. return;
  23081. }
  23082. if (this.scanner.tokenType === DIMENSION$2 ||
  23083. this.scanner.tokenType === NUMBER$2) {
  23084. startsWith.call(this, HYPHENMINUS$1);
  23085. eatHexSequence.call(this, 1, false);
  23086. return;
  23087. }
  23088. return;
  23089. }
  23090. // u <dimension-token> '?'*
  23091. if (this.scanner.tokenType === DIMENSION$2) {
  23092. startsWith.call(this, PLUSSIGN$2);
  23093. hexLength = eatHexSequence.call(this, 1, true);
  23094. if (hexLength > 0) {
  23095. eatQuestionMarkSequence.call(this, 6 - hexLength);
  23096. }
  23097. return;
  23098. }
  23099. this.error();
  23100. }
  23101. var UnicodeRange = {
  23102. name: 'UnicodeRange',
  23103. structure: {
  23104. value: String
  23105. },
  23106. parse: function() {
  23107. var start = this.scanner.tokenStart;
  23108. // U or u
  23109. if (!cmpChar$1(this.scanner.source, start, U$1)) {
  23110. this.error('U is expected');
  23111. }
  23112. if (!cmpChar$1(this.scanner.source, start + 1, PLUSSIGN$2)) {
  23113. this.error('Plus sign is expected');
  23114. }
  23115. this.scanner.next();
  23116. scanUnicodeRange.call(this);
  23117. return {
  23118. type: 'UnicodeRange',
  23119. loc: this.getLocation(start, this.scanner.tokenStart),
  23120. value: this.scanner.substrToCursor(start)
  23121. };
  23122. },
  23123. generate: function(node) {
  23124. this.chunk(node.value);
  23125. }
  23126. };
  23127. var isWhiteSpace = tokenizer$3.isWhiteSpace;
  23128. var cmpStr$1 = tokenizer$3.cmpStr;
  23129. var TYPE$5 = tokenizer$3.TYPE;
  23130. var FUNCTION$3 = TYPE$5.Function;
  23131. var URL$3 = TYPE$5.Url;
  23132. var RIGHTPARENTHESIS = TYPE$5.RightParenthesis;
  23133. // <url-token> | <function-token> <string> )
  23134. var Url = {
  23135. name: 'Url',
  23136. structure: {
  23137. value: ['String', 'Raw']
  23138. },
  23139. parse: function() {
  23140. var start = this.scanner.tokenStart;
  23141. var value;
  23142. switch (this.scanner.tokenType) {
  23143. case URL$3:
  23144. var rawStart = start + 4;
  23145. var rawEnd = this.scanner.tokenEnd - 1;
  23146. while (rawStart < rawEnd && isWhiteSpace(this.scanner.source.charCodeAt(rawStart))) {
  23147. rawStart++;
  23148. }
  23149. while (rawStart < rawEnd && isWhiteSpace(this.scanner.source.charCodeAt(rawEnd - 1))) {
  23150. rawEnd--;
  23151. }
  23152. value = {
  23153. type: 'Raw',
  23154. loc: this.getLocation(rawStart, rawEnd),
  23155. value: this.scanner.source.substring(rawStart, rawEnd)
  23156. };
  23157. this.eat(URL$3);
  23158. break;
  23159. case FUNCTION$3:
  23160. if (!cmpStr$1(this.scanner.source, this.scanner.tokenStart, this.scanner.tokenEnd, 'url(')) {
  23161. this.error('Function name must be `url`');
  23162. }
  23163. this.eat(FUNCTION$3);
  23164. this.scanner.skipSC();
  23165. value = this.String();
  23166. this.scanner.skipSC();
  23167. this.eat(RIGHTPARENTHESIS);
  23168. break;
  23169. default:
  23170. this.error('Url or Function is expected');
  23171. }
  23172. return {
  23173. type: 'Url',
  23174. loc: this.getLocation(start, this.scanner.tokenStart),
  23175. value: value
  23176. };
  23177. },
  23178. generate: function(node) {
  23179. this.chunk('url');
  23180. this.chunk('(');
  23181. this.node(node.value);
  23182. this.chunk(')');
  23183. }
  23184. };
  23185. var Value = {
  23186. name: 'Value',
  23187. structure: {
  23188. children: [[]]
  23189. },
  23190. parse: function() {
  23191. var start = this.scanner.tokenStart;
  23192. var children = this.readSequence(this.scope.Value);
  23193. return {
  23194. type: 'Value',
  23195. loc: this.getLocation(start, this.scanner.tokenStart),
  23196. children: children
  23197. };
  23198. },
  23199. generate: function(node) {
  23200. this.children(node);
  23201. }
  23202. };
  23203. var WHITESPACE$2 = tokenizer$3.TYPE.WhiteSpace;
  23204. var SPACE = Object.freeze({
  23205. type: 'WhiteSpace',
  23206. loc: null,
  23207. value: ' '
  23208. });
  23209. var WhiteSpace = {
  23210. name: 'WhiteSpace',
  23211. structure: {
  23212. value: String
  23213. },
  23214. parse: function() {
  23215. this.eat(WHITESPACE$2);
  23216. return SPACE;
  23217. // return {
  23218. // type: 'WhiteSpace',
  23219. // loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
  23220. // value: this.consume(WHITESPACE)
  23221. // };
  23222. },
  23223. generate: function(node) {
  23224. this.chunk(node.value);
  23225. }
  23226. };
  23227. var node = {
  23228. AnPlusB: AnPlusB,
  23229. Atrule: Atrule,
  23230. AtrulePrelude: AtrulePrelude,
  23231. AttributeSelector: AttributeSelector,
  23232. Block: Block,
  23233. Brackets: Brackets,
  23234. CDC: CDC_1,
  23235. CDO: CDO_1,
  23236. ClassSelector: ClassSelector,
  23237. Combinator: Combinator,
  23238. Comment: Comment,
  23239. Declaration: Declaration,
  23240. DeclarationList: DeclarationList,
  23241. Dimension: Dimension,
  23242. Function: _Function,
  23243. Hash: Hash,
  23244. Identifier: Identifier,
  23245. IdSelector: IdSelector,
  23246. MediaFeature: MediaFeature,
  23247. MediaQuery: MediaQuery,
  23248. MediaQueryList: MediaQueryList,
  23249. Nth: Nth,
  23250. Number: _Number,
  23251. Operator: Operator,
  23252. Parentheses: Parentheses,
  23253. Percentage: Percentage,
  23254. PseudoClassSelector: PseudoClassSelector,
  23255. PseudoElementSelector: PseudoElementSelector,
  23256. Ratio: Ratio,
  23257. Raw: Raw,
  23258. Rule: Rule,
  23259. Selector: Selector,
  23260. SelectorList: SelectorList,
  23261. String: _String,
  23262. StyleSheet: StyleSheet,
  23263. TypeSelector: TypeSelector,
  23264. UnicodeRange: UnicodeRange,
  23265. Url: Url,
  23266. Value: Value,
  23267. WhiteSpace: WhiteSpace
  23268. };
  23269. var data = data$1;
  23270. var lexer = {
  23271. generic: true,
  23272. types: data.types,
  23273. atrules: data.atrules,
  23274. properties: data.properties,
  23275. node: node
  23276. };
  23277. var cmpChar = tokenizer$3.cmpChar;
  23278. var cmpStr = tokenizer$3.cmpStr;
  23279. var TYPE$4 = tokenizer$3.TYPE;
  23280. var IDENT$3 = TYPE$4.Ident;
  23281. var STRING$1 = TYPE$4.String;
  23282. var NUMBER$1 = TYPE$4.Number;
  23283. var FUNCTION$2 = TYPE$4.Function;
  23284. var URL$2 = TYPE$4.Url;
  23285. var HASH$1 = TYPE$4.Hash;
  23286. var DIMENSION$1 = TYPE$4.Dimension;
  23287. var PERCENTAGE$1 = TYPE$4.Percentage;
  23288. var LEFTPARENTHESIS$2 = TYPE$4.LeftParenthesis;
  23289. var LEFTSQUAREBRACKET$1 = TYPE$4.LeftSquareBracket;
  23290. var COMMA$1 = TYPE$4.Comma;
  23291. var DELIM$1 = TYPE$4.Delim;
  23292. var NUMBERSIGN$1 = 0x0023; // U+0023 NUMBER SIGN (#)
  23293. var ASTERISK$1 = 0x002A; // U+002A ASTERISK (*)
  23294. var PLUSSIGN$1 = 0x002B; // U+002B PLUS SIGN (+)
  23295. var HYPHENMINUS = 0x002D; // U+002D HYPHEN-MINUS (-)
  23296. var SOLIDUS$1 = 0x002F; // U+002F SOLIDUS (/)
  23297. var U = 0x0075; // U+0075 LATIN SMALL LETTER U (u)
  23298. var _default = function defaultRecognizer(context) {
  23299. switch (this.scanner.tokenType) {
  23300. case HASH$1:
  23301. return this.Hash();
  23302. case COMMA$1:
  23303. context.space = null;
  23304. context.ignoreWSAfter = true;
  23305. return this.Operator();
  23306. case LEFTPARENTHESIS$2:
  23307. return this.Parentheses(this.readSequence, context.recognizer);
  23308. case LEFTSQUAREBRACKET$1:
  23309. return this.Brackets(this.readSequence, context.recognizer);
  23310. case STRING$1:
  23311. return this.String();
  23312. case DIMENSION$1:
  23313. return this.Dimension();
  23314. case PERCENTAGE$1:
  23315. return this.Percentage();
  23316. case NUMBER$1:
  23317. return this.Number();
  23318. case FUNCTION$2:
  23319. return cmpStr(this.scanner.source, this.scanner.tokenStart, this.scanner.tokenEnd, 'url(')
  23320. ? this.Url()
  23321. : this.Function(this.readSequence, context.recognizer);
  23322. case URL$2:
  23323. return this.Url();
  23324. case IDENT$3:
  23325. // check for unicode range, it should start with u+ or U+
  23326. if (cmpChar(this.scanner.source, this.scanner.tokenStart, U) &&
  23327. cmpChar(this.scanner.source, this.scanner.tokenStart + 1, PLUSSIGN$1)) {
  23328. return this.UnicodeRange();
  23329. } else {
  23330. return this.Identifier();
  23331. }
  23332. case DELIM$1:
  23333. var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
  23334. if (code === SOLIDUS$1 ||
  23335. code === ASTERISK$1 ||
  23336. code === PLUSSIGN$1 ||
  23337. code === HYPHENMINUS) {
  23338. return this.Operator(); // TODO: replace with Delim
  23339. }
  23340. // TODO: produce a node with Delim node type
  23341. if (code === NUMBERSIGN$1) {
  23342. this.error('Hex or identifier is expected', this.scanner.tokenStart + 1);
  23343. }
  23344. break;
  23345. }
  23346. };
  23347. var atrulePrelude = {
  23348. getNode: _default
  23349. };
  23350. var TYPE$3 = tokenizer$3.TYPE;
  23351. var DELIM = TYPE$3.Delim;
  23352. var IDENT$2 = TYPE$3.Ident;
  23353. var DIMENSION = TYPE$3.Dimension;
  23354. var PERCENTAGE = TYPE$3.Percentage;
  23355. var NUMBER = TYPE$3.Number;
  23356. var HASH = TYPE$3.Hash;
  23357. var COLON$1 = TYPE$3.Colon;
  23358. var LEFTSQUAREBRACKET = TYPE$3.LeftSquareBracket;
  23359. var NUMBERSIGN = 0x0023; // U+0023 NUMBER SIGN (#)
  23360. var ASTERISK = 0x002A; // U+002A ASTERISK (*)
  23361. var PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
  23362. var SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
  23363. var FULLSTOP = 0x002E; // U+002E FULL STOP (.)
  23364. var GREATERTHANSIGN = 0x003E; // U+003E GREATER-THAN SIGN (>)
  23365. var VERTICALLINE = 0x007C; // U+007C VERTICAL LINE (|)
  23366. var TILDE = 0x007E; // U+007E TILDE (~)
  23367. function getNode(context) {
  23368. switch (this.scanner.tokenType) {
  23369. case LEFTSQUAREBRACKET:
  23370. return this.AttributeSelector();
  23371. case HASH:
  23372. return this.IdSelector();
  23373. case COLON$1:
  23374. if (this.scanner.lookupType(1) === COLON$1) {
  23375. return this.PseudoElementSelector();
  23376. } else {
  23377. return this.PseudoClassSelector();
  23378. }
  23379. case IDENT$2:
  23380. return this.TypeSelector();
  23381. case NUMBER:
  23382. case PERCENTAGE:
  23383. return this.Percentage();
  23384. case DIMENSION:
  23385. // throws when .123ident
  23386. if (this.scanner.source.charCodeAt(this.scanner.tokenStart) === FULLSTOP) {
  23387. this.error('Identifier is expected', this.scanner.tokenStart + 1);
  23388. }
  23389. break;
  23390. case DELIM:
  23391. var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
  23392. switch (code) {
  23393. case PLUSSIGN:
  23394. case GREATERTHANSIGN:
  23395. case TILDE:
  23396. context.space = null;
  23397. context.ignoreWSAfter = true;
  23398. return this.Combinator();
  23399. case SOLIDUS: // /deep/
  23400. return this.Combinator();
  23401. case FULLSTOP:
  23402. return this.ClassSelector();
  23403. case ASTERISK:
  23404. case VERTICALLINE:
  23405. return this.TypeSelector();
  23406. case NUMBERSIGN:
  23407. return this.IdSelector();
  23408. }
  23409. break;
  23410. }
  23411. }
  23412. var selector = {
  23413. getNode: getNode
  23414. };
  23415. // legacy IE function
  23416. // expression( <any-value> )
  23417. var expression = function() {
  23418. return this.createSingleNodeList(
  23419. this.Raw(this.scanner.tokenIndex, null, false)
  23420. );
  23421. };
  23422. var TYPE$2 = tokenizer$3.TYPE;
  23423. var rawMode = Raw.mode;
  23424. var COMMA = TYPE$2.Comma;
  23425. var WHITESPACE$1 = TYPE$2.WhiteSpace;
  23426. // var( <ident> , <value>? )
  23427. var _var = function() {
  23428. var children = this.createList();
  23429. this.scanner.skipSC();
  23430. // NOTE: Don't check more than a first argument is an ident, rest checks are for lexer
  23431. children.push(this.Identifier());
  23432. this.scanner.skipSC();
  23433. if (this.scanner.tokenType === COMMA) {
  23434. children.push(this.Operator());
  23435. const startIndex = this.scanner.tokenIndex;
  23436. const value = this.parseCustomProperty
  23437. ? this.Value(null)
  23438. : this.Raw(this.scanner.tokenIndex, rawMode.exclamationMarkOrSemicolon, false);
  23439. if (value.type === 'Value' && value.children.isEmpty()) {
  23440. for (let offset = startIndex - this.scanner.tokenIndex; offset <= 0; offset++) {
  23441. if (this.scanner.lookupType(offset) === WHITESPACE$1) {
  23442. value.children.appendData({
  23443. type: 'WhiteSpace',
  23444. loc: null,
  23445. value: ' '
  23446. });
  23447. break;
  23448. }
  23449. }
  23450. }
  23451. children.push(value);
  23452. }
  23453. return children;
  23454. };
  23455. var value$2 = {
  23456. getNode: _default,
  23457. 'expression': expression,
  23458. 'var': _var
  23459. };
  23460. var scope = {
  23461. AtrulePrelude: atrulePrelude,
  23462. Selector: selector,
  23463. Value: value$2
  23464. };
  23465. var fontFace = {
  23466. parse: {
  23467. prelude: null,
  23468. block: function() {
  23469. return this.Block(true);
  23470. }
  23471. }
  23472. };
  23473. var TYPE$1 = tokenizer$3.TYPE;
  23474. var STRING = TYPE$1.String;
  23475. var IDENT$1 = TYPE$1.Ident;
  23476. var URL$1 = TYPE$1.Url;
  23477. var FUNCTION$1 = TYPE$1.Function;
  23478. var LEFTPARENTHESIS$1 = TYPE$1.LeftParenthesis;
  23479. var _import = {
  23480. parse: {
  23481. prelude: function() {
  23482. var children = this.createList();
  23483. this.scanner.skipSC();
  23484. switch (this.scanner.tokenType) {
  23485. case STRING:
  23486. children.push(this.String());
  23487. break;
  23488. case URL$1:
  23489. case FUNCTION$1:
  23490. children.push(this.Url());
  23491. break;
  23492. default:
  23493. this.error('String or url() is expected');
  23494. }
  23495. if (this.lookupNonWSType(0) === IDENT$1 ||
  23496. this.lookupNonWSType(0) === LEFTPARENTHESIS$1) {
  23497. children.push(this.WhiteSpace());
  23498. children.push(this.MediaQueryList());
  23499. }
  23500. return children;
  23501. },
  23502. block: null
  23503. }
  23504. };
  23505. var media = {
  23506. parse: {
  23507. prelude: function() {
  23508. return this.createSingleNodeList(
  23509. this.MediaQueryList()
  23510. );
  23511. },
  23512. block: function() {
  23513. return this.Block(false);
  23514. }
  23515. }
  23516. };
  23517. var page = {
  23518. parse: {
  23519. prelude: function() {
  23520. return this.createSingleNodeList(
  23521. this.SelectorList()
  23522. );
  23523. },
  23524. block: function() {
  23525. return this.Block(true);
  23526. }
  23527. }
  23528. };
  23529. var TYPE = tokenizer$3.TYPE;
  23530. var WHITESPACE = TYPE.WhiteSpace;
  23531. var COMMENT = TYPE.Comment;
  23532. var IDENT = TYPE.Ident;
  23533. var FUNCTION = TYPE.Function;
  23534. var COLON = TYPE.Colon;
  23535. var LEFTPARENTHESIS = TYPE.LeftParenthesis;
  23536. function consumeRaw() {
  23537. return this.createSingleNodeList(
  23538. this.Raw(this.scanner.tokenIndex, null, false)
  23539. );
  23540. }
  23541. function parentheses() {
  23542. this.scanner.skipSC();
  23543. if (this.scanner.tokenType === IDENT &&
  23544. this.lookupNonWSType(1) === COLON) {
  23545. return this.createSingleNodeList(
  23546. this.Declaration()
  23547. );
  23548. }
  23549. return readSequence.call(this);
  23550. }
  23551. function readSequence() {
  23552. var children = this.createList();
  23553. var space = null;
  23554. var child;
  23555. this.scanner.skipSC();
  23556. scan:
  23557. while (!this.scanner.eof) {
  23558. switch (this.scanner.tokenType) {
  23559. case WHITESPACE:
  23560. space = this.WhiteSpace();
  23561. continue;
  23562. case COMMENT:
  23563. this.scanner.next();
  23564. continue;
  23565. case FUNCTION:
  23566. child = this.Function(consumeRaw, this.scope.AtrulePrelude);
  23567. break;
  23568. case IDENT:
  23569. child = this.Identifier();
  23570. break;
  23571. case LEFTPARENTHESIS:
  23572. child = this.Parentheses(parentheses, this.scope.AtrulePrelude);
  23573. break;
  23574. default:
  23575. break scan;
  23576. }
  23577. if (space !== null) {
  23578. children.push(space);
  23579. space = null;
  23580. }
  23581. children.push(child);
  23582. }
  23583. return children;
  23584. }
  23585. var supports = {
  23586. parse: {
  23587. prelude: function() {
  23588. var children = readSequence.call(this);
  23589. if (this.getFirstListNode(children) === null) {
  23590. this.error('Condition is expected');
  23591. }
  23592. return children;
  23593. },
  23594. block: function() {
  23595. return this.Block(false);
  23596. }
  23597. }
  23598. };
  23599. var atrule = {
  23600. 'font-face': fontFace,
  23601. 'import': _import,
  23602. 'media': media,
  23603. 'page': page,
  23604. 'supports': supports
  23605. };
  23606. var dir = {
  23607. parse: function() {
  23608. return this.createSingleNodeList(
  23609. this.Identifier()
  23610. );
  23611. }
  23612. };
  23613. var has = {
  23614. parse: function() {
  23615. return this.createSingleNodeList(
  23616. this.SelectorList()
  23617. );
  23618. }
  23619. };
  23620. var lang = {
  23621. parse: function() {
  23622. return this.createSingleNodeList(
  23623. this.Identifier()
  23624. );
  23625. }
  23626. };
  23627. var selectorList = {
  23628. parse: function selectorList() {
  23629. return this.createSingleNodeList(
  23630. this.SelectorList()
  23631. );
  23632. }
  23633. };
  23634. var matches = selectorList;
  23635. var not = selectorList;
  23636. var ALLOW_OF_CLAUSE = true;
  23637. var nthWithOfClause = {
  23638. parse: function nthWithOfClause() {
  23639. return this.createSingleNodeList(
  23640. this.Nth(ALLOW_OF_CLAUSE)
  23641. );
  23642. }
  23643. };
  23644. var nthChild = nthWithOfClause;
  23645. var nthLastChild = nthWithOfClause;
  23646. var DISALLOW_OF_CLAUSE = false;
  23647. var nth = {
  23648. parse: function nth() {
  23649. return this.createSingleNodeList(
  23650. this.Nth(DISALLOW_OF_CLAUSE)
  23651. );
  23652. }
  23653. };
  23654. var nthLastOfType = nth;
  23655. var nthOfType = nth;
  23656. var slotted = {
  23657. parse: function compoundSelector() {
  23658. return this.createSingleNodeList(
  23659. this.Selector()
  23660. );
  23661. }
  23662. };
  23663. var pseudo = {
  23664. 'dir': dir,
  23665. 'has': has,
  23666. 'lang': lang,
  23667. 'matches': matches,
  23668. 'not': not,
  23669. 'nth-child': nthChild,
  23670. 'nth-last-child': nthLastChild,
  23671. 'nth-last-of-type': nthLastOfType,
  23672. 'nth-of-type': nthOfType,
  23673. 'slotted': slotted
  23674. };
  23675. var parser = {
  23676. parseContext: {
  23677. default: 'StyleSheet',
  23678. stylesheet: 'StyleSheet',
  23679. atrule: 'Atrule',
  23680. atrulePrelude: function(options) {
  23681. return this.AtrulePrelude(options.atrule ? String(options.atrule) : null);
  23682. },
  23683. mediaQueryList: 'MediaQueryList',
  23684. mediaQuery: 'MediaQuery',
  23685. rule: 'Rule',
  23686. selectorList: 'SelectorList',
  23687. selector: 'Selector',
  23688. block: function() {
  23689. return this.Block(true);
  23690. },
  23691. declarationList: 'DeclarationList',
  23692. declaration: 'Declaration',
  23693. value: 'Value'
  23694. },
  23695. scope: scope,
  23696. atrule: atrule,
  23697. pseudo: pseudo,
  23698. node: node
  23699. };
  23700. var walker = {
  23701. node: node
  23702. };
  23703. var _args = [
  23704. [
  23705. "css-tree@1.1.3",
  23706. "/home/gitlab-runner/builds/BQJy2NwB/0/pagedjs/pagedjs"
  23707. ]
  23708. ];
  23709. var _from = "css-tree@1.1.3";
  23710. var _id = "css-tree@1.1.3";
  23711. var _inBundle = false;
  23712. var _integrity = "sha512-tRpdppF7TRazZrjJ6v3stzv93qxRcSsFmW6cX0Zm2NVKpxE1WV1HblnghVv9TreireHkqI/VDEsfolRF1p6y7Q==";
  23713. var _location = "/css-tree";
  23714. var _phantomChildren = {
  23715. };
  23716. var _requested = {
  23717. type: "version",
  23718. registry: true,
  23719. raw: "css-tree@1.1.3",
  23720. name: "css-tree",
  23721. escapedName: "css-tree",
  23722. rawSpec: "1.1.3",
  23723. saveSpec: null,
  23724. fetchSpec: "1.1.3"
  23725. };
  23726. var _requiredBy = [
  23727. "/"
  23728. ];
  23729. var _resolved = "https://registry.npmjs.org/css-tree/-/css-tree-1.1.3.tgz";
  23730. var _spec = "1.1.3";
  23731. var _where = "/home/gitlab-runner/builds/BQJy2NwB/0/pagedjs/pagedjs";
  23732. var author = {
  23733. name: "Roman Dvornov",
  23734. email: "rdvornov@gmail.com",
  23735. url: "https://github.com/lahmatiy"
  23736. };
  23737. var bugs = {
  23738. url: "https://github.com/csstree/csstree/issues"
  23739. };
  23740. var dependencies = {
  23741. "mdn-data": "2.0.14",
  23742. "source-map": "^0.6.1"
  23743. };
  23744. 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";
  23745. var devDependencies = {
  23746. "@rollup/plugin-commonjs": "^11.0.2",
  23747. "@rollup/plugin-json": "^4.0.2",
  23748. "@rollup/plugin-node-resolve": "^7.1.1",
  23749. coveralls: "^3.0.9",
  23750. eslint: "^6.8.0",
  23751. "json-to-ast": "^2.1.0",
  23752. mocha: "^6.2.3",
  23753. nyc: "^14.1.1",
  23754. rollup: "^1.32.1",
  23755. "rollup-plugin-terser": "^5.3.0"
  23756. };
  23757. var engines = {
  23758. node: ">=8.0.0"
  23759. };
  23760. var files = [
  23761. "data",
  23762. "dist",
  23763. "lib"
  23764. ];
  23765. var homepage = "https://github.com/csstree/csstree#readme";
  23766. var jsdelivr = "dist/csstree.min.js";
  23767. var keywords = [
  23768. "css",
  23769. "ast",
  23770. "tokenizer",
  23771. "parser",
  23772. "walker",
  23773. "lexer",
  23774. "generator",
  23775. "utils",
  23776. "syntax",
  23777. "validation"
  23778. ];
  23779. var license = "MIT";
  23780. var main = "lib/index.js";
  23781. var name = "css-tree";
  23782. var repository = {
  23783. type: "git",
  23784. url: "git+https://github.com/csstree/csstree.git"
  23785. };
  23786. var scripts = {
  23787. build: "rollup --config",
  23788. coverage: "nyc npm test",
  23789. coveralls: "nyc report --reporter=text-lcov | coveralls",
  23790. 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",
  23791. lint: "eslint data lib scripts test && node scripts/review-syntax-patch --lint && node scripts/update-docs --lint",
  23792. "lint-and-test": "npm run lint && npm test",
  23793. prepublishOnly: "npm run build",
  23794. "review:syntax-patch": "node scripts/review-syntax-patch",
  23795. test: "mocha --reporter progress",
  23796. travis: "nyc npm run lint-and-test && npm run coveralls",
  23797. "update:docs": "node scripts/update-docs"
  23798. };
  23799. var unpkg = "dist/csstree.min.js";
  23800. var version = "1.1.3";
  23801. var require$$4 = {
  23802. _args: _args,
  23803. _from: _from,
  23804. _id: _id,
  23805. _inBundle: _inBundle,
  23806. _integrity: _integrity,
  23807. _location: _location,
  23808. _phantomChildren: _phantomChildren,
  23809. _requested: _requested,
  23810. _requiredBy: _requiredBy,
  23811. _resolved: _resolved,
  23812. _spec: _spec,
  23813. _where: _where,
  23814. author: author,
  23815. bugs: bugs,
  23816. dependencies: dependencies,
  23817. description: description,
  23818. devDependencies: devDependencies,
  23819. engines: engines,
  23820. files: files,
  23821. homepage: homepage,
  23822. jsdelivr: jsdelivr,
  23823. keywords: keywords,
  23824. license: license,
  23825. main: main,
  23826. name: name,
  23827. repository: repository,
  23828. scripts: scripts,
  23829. unpkg: unpkg,
  23830. version: version
  23831. };
  23832. function merge() {
  23833. var dest = {};
  23834. for (var i = 0; i < arguments.length; i++) {
  23835. var src = arguments[i];
  23836. for (var key in src) {
  23837. dest[key] = src[key];
  23838. }
  23839. }
  23840. return dest;
  23841. }
  23842. syntax.exports = create$4.create(
  23843. merge(
  23844. lexer,
  23845. parser,
  23846. walker
  23847. )
  23848. );
  23849. syntax.exports.version = require$$4.version;
  23850. var syntaxExports = syntax.exports;
  23851. var lib = syntaxExports;
  23852. var csstree = /*@__PURE__*/getDefaultExportFromCjs(lib);
  23853. class Sheet {
  23854. constructor(url, hooks) {
  23855. if (hooks) {
  23856. this.hooks = hooks;
  23857. } else {
  23858. this.hooks = {};
  23859. this.hooks.onUrl = new Hook(this);
  23860. this.hooks.onAtPage = new Hook(this);
  23861. this.hooks.onAtMedia = new Hook(this);
  23862. this.hooks.onRule = new Hook(this);
  23863. this.hooks.onDeclaration = new Hook(this);
  23864. this.hooks.onSelector = new Hook(this);
  23865. this.hooks.onPseudoSelector = new Hook(this);
  23866. this.hooks.onContent = new Hook(this);
  23867. this.hooks.onImport = new Hook(this);
  23868. this.hooks.beforeTreeParse = new Hook(this);
  23869. this.hooks.beforeTreeWalk = new Hook(this);
  23870. this.hooks.afterTreeWalk = new Hook(this);
  23871. }
  23872. try {
  23873. this.url = new URL(url, window.location.href);
  23874. } catch (e) {
  23875. this.url = new URL(window.location.href);
  23876. }
  23877. }
  23878. // parse
  23879. async parse(text) {
  23880. this.text = text;
  23881. await this.hooks.beforeTreeParse.trigger(this.text, this);
  23882. // send to csstree
  23883. this.ast = csstree.parse(this._text);
  23884. await this.hooks.beforeTreeWalk.trigger(this.ast);
  23885. // Replace urls
  23886. this.replaceUrls(this.ast);
  23887. // Scope
  23888. this.id = UUID();
  23889. // this.addScope(this.ast, this.uuid);
  23890. // Replace IDs with data-id
  23891. this.replaceIds(this.ast);
  23892. this.imported = [];
  23893. // Trigger Hooks
  23894. this.urls(this.ast);
  23895. this.rules(this.ast);
  23896. this.atrules(this.ast);
  23897. await this.hooks.afterTreeWalk.trigger(this.ast, this);
  23898. // return ast
  23899. return this.ast;
  23900. }
  23901. insertRule(rule) {
  23902. let inserted = this.ast.children.appendData(rule);
  23903. this.declarations(rule);
  23904. return inserted;
  23905. }
  23906. urls(ast) {
  23907. csstree.walk(ast, {
  23908. visit: "Url",
  23909. enter: (node, item, list) => {
  23910. this.hooks.onUrl.trigger(node, item, list);
  23911. }
  23912. });
  23913. }
  23914. atrules(ast) {
  23915. csstree.walk(ast, {
  23916. visit: "Atrule",
  23917. enter: (node, item, list) => {
  23918. const basename = csstree.keyword(node.name).basename;
  23919. if (basename === "page") {
  23920. this.hooks.onAtPage.trigger(node, item, list);
  23921. this.declarations(node, item, list);
  23922. }
  23923. if (basename === "media") {
  23924. this.hooks.onAtMedia.trigger(node, item, list);
  23925. this.declarations(node, item, list);
  23926. }
  23927. if (basename === "import") {
  23928. this.hooks.onImport.trigger(node, item, list);
  23929. this.imports(node, item, list);
  23930. }
  23931. }
  23932. });
  23933. }
  23934. rules(ast) {
  23935. csstree.walk(ast, {
  23936. visit: "Rule",
  23937. enter: (ruleNode, ruleItem, rulelist) => {
  23938. this.hooks.onRule.trigger(ruleNode, ruleItem, rulelist);
  23939. this.declarations(ruleNode, ruleItem, rulelist);
  23940. this.onSelector(ruleNode, ruleItem, rulelist);
  23941. }
  23942. });
  23943. }
  23944. declarations(ruleNode, ruleItem, rulelist) {
  23945. csstree.walk(ruleNode, {
  23946. visit: "Declaration",
  23947. enter: (declarationNode, dItem, dList) => {
  23948. this.hooks.onDeclaration.trigger(declarationNode, dItem, dList, {ruleNode, ruleItem, rulelist});
  23949. if (declarationNode.property === "content") {
  23950. csstree.walk(declarationNode, {
  23951. visit: "Function",
  23952. enter: (funcNode, fItem, fList) => {
  23953. this.hooks.onContent.trigger(funcNode, fItem, fList, {declarationNode, dItem, dList}, {ruleNode, ruleItem, rulelist});
  23954. }
  23955. });
  23956. }
  23957. }
  23958. });
  23959. }
  23960. // add pseudo elements to parser
  23961. onSelector(ruleNode, ruleItem, rulelist) {
  23962. csstree.walk(ruleNode, {
  23963. visit: "Selector",
  23964. enter: (selectNode, selectItem, selectList) => {
  23965. this.hooks.onSelector.trigger(selectNode, selectItem, selectList, {ruleNode, ruleItem, rulelist});
  23966. if (selectNode.children.forEach(node => {if (node.type === "PseudoElementSelector") {
  23967. csstree.walk(node, {
  23968. visit: "PseudoElementSelector",
  23969. enter: (pseudoNode, pItem, pList) => {
  23970. this.hooks.onPseudoSelector.trigger(pseudoNode, pItem, pList, {selectNode, selectItem, selectList}, {ruleNode, ruleItem, rulelist});
  23971. }
  23972. });
  23973. }}));
  23974. }
  23975. });
  23976. }
  23977. replaceUrls(ast) {
  23978. csstree.walk(ast, {
  23979. visit: "Url",
  23980. enter: (node, item, list) => {
  23981. let content = node.value.value;
  23982. if ((node.value.type === "Raw" && content.startsWith("data:")) || (node.value.type === "String" && (content.startsWith("\"data:") || content.startsWith("'data:")))) ; else {
  23983. let href = content.replace(/["']/g, "");
  23984. let url = new URL(href, this.url);
  23985. node.value.value = url.toString();
  23986. }
  23987. }
  23988. });
  23989. }
  23990. addScope(ast, id) {
  23991. // Get all selector lists
  23992. // add an id
  23993. csstree.walk(ast, {
  23994. visit: "Selector",
  23995. enter: (node, item, list) => {
  23996. let children = node.children;
  23997. children.prepend(children.createItem({
  23998. type: "WhiteSpace",
  23999. value: " "
  24000. }));
  24001. children.prepend(children.createItem({
  24002. type: "IdSelector",
  24003. name: id,
  24004. loc: null,
  24005. children: null
  24006. }));
  24007. }
  24008. });
  24009. }
  24010. getNamedPageSelectors(ast) {
  24011. let namedPageSelectors = {};
  24012. csstree.walk(ast, {
  24013. visit: "Rule",
  24014. enter: (node, item, list) => {
  24015. csstree.walk(node, {
  24016. visit: "Declaration",
  24017. enter: (declaration, dItem, dList) => {
  24018. if (declaration.property === "page") {
  24019. let value = declaration.value.children.first();
  24020. let name = value.name;
  24021. let selector = csstree.generate(node.prelude);
  24022. namedPageSelectors[name] = {
  24023. name: name,
  24024. selector: selector
  24025. };
  24026. // dList.remove(dItem);
  24027. // Add in page break
  24028. declaration.property = "break-before";
  24029. value.type = "Identifier";
  24030. value.name = "always";
  24031. }
  24032. }
  24033. });
  24034. }
  24035. });
  24036. return namedPageSelectors;
  24037. }
  24038. replaceIds(ast) {
  24039. csstree.walk(ast, {
  24040. visit: "Rule",
  24041. enter: (node, item, list) => {
  24042. csstree.walk(node, {
  24043. visit: "IdSelector",
  24044. enter: (idNode, idItem, idList) => {
  24045. let name = idNode.name;
  24046. idNode.flags = null;
  24047. idNode.matcher = "=";
  24048. idNode.name = {type: "Identifier", loc: null, name: "data-id"};
  24049. idNode.type = "AttributeSelector";
  24050. idNode.value = {type: "String", loc: null, value: `"${name}"`};
  24051. }
  24052. });
  24053. }
  24054. });
  24055. }
  24056. imports(node, item, list) {
  24057. // console.log("import", node, item, list);
  24058. let queries = [];
  24059. csstree.walk(node, {
  24060. visit: "MediaQuery",
  24061. enter: (mqNode, mqItem, mqList) => {
  24062. csstree.walk(mqNode, {
  24063. visit: "Identifier",
  24064. enter: (identNode, identItem, identList) => {
  24065. queries.push(identNode.name);
  24066. }
  24067. });
  24068. }
  24069. });
  24070. // Just basic media query support for now
  24071. let shouldNotApply = queries.some((query, index) => {
  24072. let q = query;
  24073. if (q === "not") {
  24074. q = queries[index + 1];
  24075. return !(q === "screen" || q === "speech");
  24076. } else {
  24077. return (q === "screen" || q === "speech");
  24078. }
  24079. });
  24080. if (shouldNotApply) {
  24081. return;
  24082. }
  24083. csstree.walk(node, {
  24084. visit: "String",
  24085. enter: (urlNode, urlItem, urlList) => {
  24086. let href = urlNode.value.replace(/["']/g, "");
  24087. let url = new URL(href, this.url);
  24088. let value = url.toString();
  24089. this.imported.push(value);
  24090. // Remove the original
  24091. list.remove(item);
  24092. }
  24093. });
  24094. }
  24095. set text(t) {
  24096. this._text = t;
  24097. }
  24098. get text() {
  24099. return this._text;
  24100. }
  24101. // generate string
  24102. toString(ast) {
  24103. return csstree.generate(ast || this.ast);
  24104. }
  24105. }
  24106. var baseStyles = `
  24107. :root {
  24108. --pagedjs-width: 8.5in;
  24109. --pagedjs-height: 11in;
  24110. --pagedjs-width-right: 8.5in;
  24111. --pagedjs-height-right: 11in;
  24112. --pagedjs-width-left: 8.5in;
  24113. --pagedjs-height-left: 11in;
  24114. --pagedjs-pagebox-width: 8.5in;
  24115. --pagedjs-pagebox-height: 11in;
  24116. --pagedjs-footnotes-height: 0mm;
  24117. --pagedjs-margin-top: 1in;
  24118. --pagedjs-margin-right: 1in;
  24119. --pagedjs-margin-bottom: 1in;
  24120. --pagedjs-margin-left: 1in;
  24121. --pagedjs-padding-top: 0mm;
  24122. --pagedjs-padding-right: 0mm;
  24123. --pagedjs-padding-bottom: 0mm;
  24124. --pagedjs-padding-left: 0mm;
  24125. --pagedjs-border-top: 0mm;
  24126. --pagedjs-border-right: 0mm;
  24127. --pagedjs-border-bottom: 0mm;
  24128. --pagedjs-border-left: 0mm;
  24129. --pagedjs-bleed-top: 0mm;
  24130. --pagedjs-bleed-right: 0mm;
  24131. --pagedjs-bleed-bottom: 0mm;
  24132. --pagedjs-bleed-left: 0mm;
  24133. --pagedjs-bleed-right-top: 0mm;
  24134. --pagedjs-bleed-right-right: 0mm;
  24135. --pagedjs-bleed-right-bottom: 0mm;
  24136. --pagedjs-bleed-right-left: 0mm;
  24137. --pagedjs-bleed-left-top: 0mm;
  24138. --pagedjs-bleed-left-right: 0mm;
  24139. --pagedjs-bleed-left-bottom: 0mm;
  24140. --pagedjs-bleed-left-left: 0mm;
  24141. --pagedjs-crop-color: black;
  24142. --pagedjs-crop-shadow: white;
  24143. --pagedjs-crop-offset: 2mm;
  24144. --pagedjs-crop-stroke: 1px;
  24145. --pagedjs-cross-size: 5mm;
  24146. --pagedjs-mark-cross-display: none;
  24147. --pagedjs-mark-crop-display: none;
  24148. --pagedjs-page-count: 0;
  24149. --pagedjs-page-counter-increment: 1;
  24150. --pagedjs-footnotes-count: 0;
  24151. --pagedjs-column-gap-offset: 1000px;
  24152. }
  24153. @page {
  24154. size: letter;
  24155. margin: 0;
  24156. }
  24157. .pagedjs_sheet {
  24158. box-sizing: border-box;
  24159. width: var(--pagedjs-width);
  24160. height: var(--pagedjs-height);
  24161. overflow: hidden;
  24162. position: relative;
  24163. display: grid;
  24164. 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);
  24165. 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);
  24166. }
  24167. .pagedjs_right_page .pagedjs_sheet {
  24168. width: var(--pagedjs-width-right);
  24169. height: var(--pagedjs-height-right);
  24170. 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);
  24171. 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);
  24172. }
  24173. .pagedjs_left_page .pagedjs_sheet {
  24174. width: var(--pagedjs-width-left);
  24175. height: var(--pagedjs-height-left);
  24176. 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);
  24177. 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);
  24178. }
  24179. .pagedjs_bleed {
  24180. display: flex;
  24181. align-items: center;
  24182. justify-content: center;
  24183. flex-wrap: nowrap;
  24184. overflow: hidden;
  24185. }
  24186. .pagedjs_bleed-top {
  24187. grid-column: bleed-left / -1;
  24188. grid-row: bleed-top;
  24189. flex-direction: row;
  24190. }
  24191. .pagedjs_bleed-bottom {
  24192. grid-column: bleed-left / -1;
  24193. grid-row: bleed-bottom;
  24194. flex-direction: row;
  24195. }
  24196. .pagedjs_bleed-left {
  24197. grid-column: bleed-left;
  24198. grid-row: bleed-top / -1;
  24199. flex-direction: column;
  24200. }
  24201. .pagedjs_bleed-right {
  24202. grid-column: bleed-right;
  24203. grid-row: bleed-top / -1;
  24204. flex-direction: column;
  24205. }
  24206. .pagedjs_marks-crop {
  24207. display: var(--pagedjs-mark-crop-display);
  24208. flex-grow: 0;
  24209. flex-shrink: 0;
  24210. z-index: 9999999999;
  24211. }
  24212. .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(1),
  24213. .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(1) {
  24214. width: calc(var(--pagedjs-bleed-left) - var(--pagedjs-crop-stroke));
  24215. border-right: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color);
  24216. box-shadow: 1px 0px 0px 0px var(--pagedjs-crop-shadow);
  24217. }
  24218. .pagedjs_right_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(1),
  24219. .pagedjs_right_page .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(1) {
  24220. width: calc(var(--pagedjs-bleed-right-left) - var(--pagedjs-crop-stroke));
  24221. }
  24222. .pagedjs_left_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(1),
  24223. .pagedjs_left_page .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(1) {
  24224. width: calc(var(--pagedjs-bleed-left-left) - var(--pagedjs-crop-stroke));
  24225. }
  24226. .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(3),
  24227. .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(3) {
  24228. width: calc(var(--pagedjs-bleed-right) - var(--pagedjs-crop-stroke));
  24229. border-left: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color);
  24230. box-shadow: -1px 0px 0px 0px var(--pagedjs-crop-shadow);
  24231. }
  24232. .pagedjs_right_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(3),
  24233. .pagedjs_right_page .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(3) {
  24234. width: calc(var(--pagedjs-bleed-right-right) - var(--pagedjs-crop-stroke));
  24235. }
  24236. .pagedjs_left_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(3),
  24237. .pagedjs_left_page .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(3) {
  24238. width: calc(var(--pagedjs-bleed-left-right) - var(--pagedjs-crop-stroke));
  24239. }
  24240. .pagedjs_bleed-top .pagedjs_marks-crop {
  24241. align-self: flex-start;
  24242. height: calc(var(--pagedjs-bleed-top) - var(--pagedjs-crop-offset));
  24243. }
  24244. .pagedjs_right_page .pagedjs_bleed-top .pagedjs_marks-crop {
  24245. height: calc(var(--pagedjs-bleed-right-top) - var(--pagedjs-crop-offset));
  24246. }
  24247. .pagedjs_left_page .pagedjs_bleed-top .pagedjs_marks-crop {
  24248. height: calc(var(--pagedjs-bleed-left-top) - var(--pagedjs-crop-offset));
  24249. }
  24250. .pagedjs_bleed-bottom .pagedjs_marks-crop {
  24251. align-self: flex-end;
  24252. height: calc(var(--pagedjs-bleed-bottom) - var(--pagedjs-crop-offset));
  24253. }
  24254. .pagedjs_right_page .pagedjs_bleed-bottom .pagedjs_marks-crop {
  24255. height: calc(var(--pagedjs-bleed-right-bottom) - var(--pagedjs-crop-offset));
  24256. }
  24257. .pagedjs_left_page .pagedjs_bleed-bottom .pagedjs_marks-crop {
  24258. height: calc(var(--pagedjs-bleed-left-bottom) - var(--pagedjs-crop-offset));
  24259. }
  24260. .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(1),
  24261. .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(1) {
  24262. height: calc(var(--pagedjs-bleed-top) - var(--pagedjs-crop-stroke));
  24263. border-bottom: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color);
  24264. box-shadow: 0px 1px 0px 0px var(--pagedjs-crop-shadow);
  24265. }
  24266. .pagedjs_right_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(1),
  24267. .pagedjs_right_page .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(1) {
  24268. height: calc(var(--pagedjs-bleed-right-top) - var(--pagedjs-crop-stroke));
  24269. }
  24270. .pagedjs_left_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(1),
  24271. .pagedjs_left_page .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(1) {
  24272. height: calc(var(--pagedjs-bleed-left-top) - var(--pagedjs-crop-stroke));
  24273. }
  24274. .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(3),
  24275. .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(3) {
  24276. height: calc(var(--pagedjs-bleed-bottom) - var(--pagedjs-crop-stroke));
  24277. border-top: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color);
  24278. box-shadow: 0px -1px 0px 0px var(--pagedjs-crop-shadow);
  24279. }
  24280. .pagedjs_right_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(3),
  24281. .pagedjs_right_page .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(3) {
  24282. height: calc(var(--pagedjs-bleed-right-bottom) - var(--pagedjs-crop-stroke));
  24283. }
  24284. .pagedjs_left_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(3),
  24285. .pagedjs_left_page .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(3) {
  24286. height: calc(var(--pagedjs-bleed-left-bottom) - var(--pagedjs-crop-stroke));
  24287. }
  24288. .pagedjs_bleed-left .pagedjs_marks-crop {
  24289. width: calc(var(--pagedjs-bleed-left) - var(--pagedjs-crop-offset));
  24290. align-self: flex-start;
  24291. }
  24292. .pagedjs_right_page .pagedjs_bleed-left .pagedjs_marks-crop {
  24293. width: calc(var(--pagedjs-bleed-right-left) - var(--pagedjs-crop-offset));
  24294. }
  24295. .pagedjs_left_page .pagedjs_bleed-left .pagedjs_marks-crop {
  24296. width: calc(var(--pagedjs-bleed-left-left) - var(--pagedjs-crop-offset));
  24297. }
  24298. .pagedjs_bleed-right .pagedjs_marks-crop {
  24299. width: calc(var(--pagedjs-bleed-right) - var(--pagedjs-crop-offset));
  24300. align-self: flex-end;
  24301. }
  24302. .pagedjs_right_page .pagedjs_bleed-right .pagedjs_marks-crop {
  24303. width: calc(var(--pagedjs-bleed-right-right) - var(--pagedjs-crop-offset));
  24304. }
  24305. .pagedjs_left_page .pagedjs_bleed-right .pagedjs_marks-crop {
  24306. width: calc(var(--pagedjs-bleed-left-right) - var(--pagedjs-crop-offset));
  24307. }
  24308. .pagedjs_marks-middle {
  24309. display: flex;
  24310. flex-grow: 1;
  24311. flex-shrink: 0;
  24312. align-items: center;
  24313. justify-content: center;
  24314. }
  24315. .pagedjs_marks-cross {
  24316. display: var(--pagedjs-mark-cross-display);
  24317. background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSIzMi41MzdweCIgaGVpZ2h0PSIzMi41MzdweCIgdmlld0JveD0iMC4xMDQgMC4xMDQgMzIuNTM3IDMyLjUzNyIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwLjEwNCAwLjEwNCAzMi41MzcgMzIuNTM3IiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBmaWxsPSJub25lIiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMy4zODkzIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIGQ9Ik0yOS45MzEsMTYuMzczYzAsNy40ODktNi4wNjgsMTMuNTYtMTMuNTU4LDEzLjU2Yy03LjQ4MywwLTEzLjU1Ny02LjA3Mi0xMy41NTctMTMuNTZjMC03LjQ4Niw2LjA3NC0xMy41NTQsMTMuNTU3LTEzLjU1NEMyMy44NjIsMi44MTksMjkuOTMxLDguODg3LDI5LjkzMSwxNi4zNzN6Ii8+PGxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjRkZGRkZGIiBzdHJva2Utd2lkdGg9IjMuMzg5MyIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiB4MT0iMC4xMDQiIHkxPSIxNi4zNzMiIHgyPSIzMi42NDIiIHkyPSIxNi4zNzMiLz48bGluZSBmaWxsPSJub25lIiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMy4zODkzIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHgxPSIxNi4zNzMiIHkxPSIwLjEwNCIgeDI9IjE2LjM3MyIgeTI9IjMyLjY0MiIvPjxwYXRoIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIzLjM4OTMiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgZD0iTTI0LjUwOCwxNi4zNzNjMCw0LjQ5Ni0zLjYzOCw4LjEzNS04LjEzNSw4LjEzNWMtNC40OTEsMC04LjEzNS0zLjYzOC04LjEzNS04LjEzNWMwLTQuNDg5LDMuNjQ0LTguMTM1LDguMTM1LTguMTM1QzIwLjg2OSw4LjIzOSwyNC41MDgsMTEuODg0LDI0LjUwOCwxNi4zNzN6Ii8+PHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjAuNjc3OCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBkPSJNMjkuOTMxLDE2LjM3M2MwLDcuNDg5LTYuMDY4LDEzLjU2LTEzLjU1OCwxMy41NmMtNy40ODMsMC0xMy41NTctNi4wNzItMTMuNTU3LTEzLjU2YzAtNy40ODYsNi4wNzQtMTMuNTU0LDEzLjU1Ny0xMy41NTRDMjMuODYyLDIuODE5LDI5LjkzMSw4Ljg4NywyOS45MzEsMTYuMzczeiIvPjxsaW5lIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLXdpZHRoPSIwLjY3NzgiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgeDE9IjAuMTA0IiB5MT0iMTYuMzczIiB4Mj0iMzIuNjQyIiB5Mj0iMTYuMzczIi8+PGxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjAuNjc3OCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiB4MT0iMTYuMzczIiB5MT0iMC4xMDQiIHgyPSIxNi4zNzMiIHkyPSIzMi42NDIiLz48cGF0aCBkPSJNMjQuNTA4LDE2LjM3M2MwLDQuNDk2LTMuNjM4LDguMTM1LTguMTM1LDguMTM1Yy00LjQ5MSwwLTguMTM1LTMuNjM4LTguMTM1LTguMTM1YzAtNC40ODksMy42NDQtOC4xMzUsOC4xMzUtOC4xMzVDMjAuODY5LDguMjM5LDI0LjUwOCwxMS44ODQsMjQuNTA4LDE2LjM3MyIvPjxsaW5lIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIwLjY3NzgiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgeDE9IjguMjM5IiB5MT0iMTYuMzczIiB4Mj0iMjQuNTA4IiB5Mj0iMTYuMzczIi8+PGxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjRkZGRkZGIiBzdHJva2Utd2lkdGg9IjAuNjc3OCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiB4MT0iMTYuMzczIiB5MT0iOC4yMzkiIHgyPSIxNi4zNzMiIHkyPSIyNC41MDgiLz48L3N2Zz4=);
  24318. background-repeat: no-repeat;
  24319. background-position: 50% 50%;
  24320. background-size: var(--pagedjs-cross-size);
  24321. z-index: 2147483647;
  24322. width: var(--pagedjs-cross-size);
  24323. height: var(--pagedjs-cross-size);
  24324. }
  24325. .pagedjs_pagebox {
  24326. box-sizing: border-box;
  24327. width: var(--pagedjs-pagebox-width);
  24328. height: var(--pagedjs-pagebox-height);
  24329. position: relative;
  24330. display: grid;
  24331. 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);
  24332. 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);
  24333. grid-column: sheet-center;
  24334. grid-row: sheet-middle;
  24335. }
  24336. .pagedjs_pagebox * {
  24337. box-sizing: border-box;
  24338. }
  24339. .pagedjs_margin-top {
  24340. width: calc(var(--pagedjs-pagebox-width) - var(--pagedjs-margin-left) - var(--pagedjs-margin-right));
  24341. height: var(--pagedjs-margin-top);
  24342. grid-column: center;
  24343. grid-row: header;
  24344. flex-wrap: nowrap;
  24345. display: grid;
  24346. grid-template-columns: repeat(3, 1fr);
  24347. grid-template-rows: 100%;
  24348. }
  24349. .pagedjs_margin-top-left-corner-holder {
  24350. width: var(--pagedjs-margin-left);
  24351. height: var(--pagedjs-margin-top);
  24352. display: flex;
  24353. grid-column: left;
  24354. grid-row: header;
  24355. }
  24356. .pagedjs_margin-top-right-corner-holder {
  24357. width: var(--pagedjs-margin-right);
  24358. height: var(--pagedjs-margin-top);
  24359. display: flex;
  24360. grid-column: right;
  24361. grid-row: header;
  24362. }
  24363. .pagedjs_margin-top-left-corner {
  24364. width: var(--pagedjs-margin-left);
  24365. }
  24366. .pagedjs_margin-top-right-corner {
  24367. width: var(--pagedjs-margin-right);
  24368. }
  24369. .pagedjs_margin-right {
  24370. height: calc(var(--pagedjs-pagebox-height) - var(--pagedjs-margin-top) - var(--pagedjs-margin-bottom));
  24371. width: var(--pagedjs-margin-right);
  24372. right: 0;
  24373. grid-column: right;
  24374. grid-row: page;
  24375. display: grid;
  24376. grid-template-rows: repeat(3, 33.3333%);
  24377. grid-template-columns: 100%;
  24378. }
  24379. .pagedjs_margin-bottom {
  24380. width: calc(var(--pagedjs-pagebox-width) - var(--pagedjs-margin-left) - var(--pagedjs-margin-right));
  24381. height: var(--pagedjs-margin-bottom);
  24382. grid-column: center;
  24383. grid-row: footer;
  24384. display: grid;
  24385. grid-template-columns: repeat(3, 1fr);
  24386. grid-template-rows: 100%;
  24387. }
  24388. .pagedjs_margin-bottom-left-corner-holder {
  24389. width: var(--pagedjs-margin-left);
  24390. height: var(--pagedjs-margin-bottom);
  24391. display: flex;
  24392. grid-column: left;
  24393. grid-row: footer;
  24394. }
  24395. .pagedjs_margin-bottom-right-corner-holder {
  24396. width: var(--pagedjs-margin-right);
  24397. height: var(--pagedjs-margin-bottom);
  24398. display: flex;
  24399. grid-column: right;
  24400. grid-row: footer;
  24401. }
  24402. .pagedjs_margin-bottom-left-corner {
  24403. width: var(--pagedjs-margin-left);
  24404. }
  24405. .pagedjs_margin-bottom-right-corner {
  24406. width: var(--pagedjs-margin-right);
  24407. }
  24408. .pagedjs_margin-left {
  24409. height: calc(var(--pagedjs-pagebox-height) - var(--pagedjs-margin-top) - var(--pagedjs-margin-bottom));
  24410. width: var(--pagedjs-margin-left);
  24411. grid-column: left;
  24412. grid-row: page;
  24413. display: grid;
  24414. grid-template-rows: repeat(3, 33.33333%);
  24415. grid-template-columns: 100%;
  24416. }
  24417. .pagedjs_pages .pagedjs_pagebox .pagedjs_margin:not(.hasContent) {
  24418. visibility: hidden;
  24419. }
  24420. .pagedjs_pagebox > .pagedjs_area {
  24421. grid-column: center;
  24422. grid-row: page;
  24423. width: 100%;
  24424. height: 100%;
  24425. padding: var(--pagedjs-padding-top) var(--pagedjs-padding-right) var(--pagedjs-padding-bottom) var(--pagedjs-padding-left);
  24426. border-top: var(--pagedjs-border-top);
  24427. border-right: var(--pagedjs-border-right);
  24428. border-bottom: var(--pagedjs-border-bottom);
  24429. border-left: var(--pagedjs-border-left);
  24430. }
  24431. .pagedjs_pagebox > .pagedjs_area > .pagedjs_page_content {
  24432. width: 100%;
  24433. height: calc(100% - var(--pagedjs-footnotes-height));
  24434. position: relative;
  24435. column-fill: auto;
  24436. }
  24437. .pagedjs_pagebox > .pagedjs_area > .pagedjs_page_content > div {
  24438. height: inherit;
  24439. }
  24440. .pagedjs_pagebox > .pagedjs_area > .pagedjs_footnote_area {
  24441. position: relative;
  24442. overflow: hidden;
  24443. height: var(--pagedjs-footnotes-height);
  24444. display: flex;
  24445. justify-content: flex-end;
  24446. flex-flow: column;
  24447. }
  24448. .pagedjs_pagebox > .pagedjs_area > .pagedjs_footnote_area > .pagedjs_footnote_content {
  24449. overflow: hidden;
  24450. }
  24451. .pagedjs_pagebox > .pagedjs_area > .pagedjs_footnote_area > .pagedjs_footnote_inner_content {
  24452. overflow: hidden;
  24453. }
  24454. .pagedjs_area [data-footnote-call] {
  24455. all: unset;
  24456. counter-increment: footnote;
  24457. }
  24458. .pagedjs_area [data-split-from] {
  24459. counter-increment: unset;
  24460. counter-reset: unset;
  24461. }
  24462. [data-footnote-call]::after {
  24463. vertical-align: super;
  24464. font-size: 65%;
  24465. line-height: normal;
  24466. content: counter(footnote);
  24467. }
  24468. @supports ( font-variant-position: super ) {
  24469. [data-footnote-call]::after {
  24470. vertical-align: baseline;
  24471. font-size: 100%;
  24472. line-height: inherit;
  24473. font-variant-position: super;
  24474. }
  24475. }
  24476. .pagedjs_footnote_empty {
  24477. display: none;
  24478. }
  24479. .pagedjs_area [data-split-from] {
  24480. counter-increment: unset;
  24481. counter-reset: unset;
  24482. }
  24483. [data-footnote-marker] {
  24484. text-indent: 0;
  24485. display: list-item;
  24486. list-style-position: inside;
  24487. }
  24488. [data-footnote-marker][data-split-from] {
  24489. list-style: none;
  24490. }
  24491. [data-footnote-marker]:not([data-split-from]) {
  24492. counter-increment: footnote-marker;
  24493. }
  24494. [data-footnote-marker]::marker {
  24495. content: counter(footnote-marker) ". ";
  24496. }
  24497. [data-footnote-marker][data-split-from]::marker {
  24498. content: unset;
  24499. }
  24500. .pagedjs_area .pagedjs_footnote_inner_content [data-note-display="inline"] {
  24501. display: inline;
  24502. }
  24503. .pagedjs_page {
  24504. counter-increment: page var(--pagedjs-page-counter-increment);
  24505. width: var(--pagedjs-width);
  24506. height: var(--pagedjs-height);
  24507. }
  24508. .pagedjs_page.pagedjs_right_page {
  24509. width: var(--pagedjs-width-right);
  24510. height: var(--pagedjs-height-right);
  24511. }
  24512. .pagedjs_page.pagedjs_left_page {
  24513. width: var(--pagedjs-width-left);
  24514. height: var(--pagedjs-height-left);
  24515. }
  24516. .pagedjs_pages {
  24517. counter-reset: pages var(--pagedjs-page-count) footnote var(--pagedjs-footnotes-count) footnote-marker var(--pagedjs-footnotes-count);
  24518. }
  24519. .pagedjs_pagebox .pagedjs_margin-top-left-corner,
  24520. .pagedjs_pagebox .pagedjs_margin-top-right-corner,
  24521. .pagedjs_pagebox .pagedjs_margin-bottom-left-corner,
  24522. .pagedjs_pagebox .pagedjs_margin-bottom-right-corner,
  24523. .pagedjs_pagebox .pagedjs_margin-top-left,
  24524. .pagedjs_pagebox .pagedjs_margin-top-right,
  24525. .pagedjs_pagebox .pagedjs_margin-bottom-left,
  24526. .pagedjs_pagebox .pagedjs_margin-bottom-right,
  24527. .pagedjs_pagebox .pagedjs_margin-top-center,
  24528. .pagedjs_pagebox .pagedjs_margin-bottom-center,
  24529. .pagedjs_pagebox .pagedjs_margin-top-center,
  24530. .pagedjs_pagebox .pagedjs_margin-bottom-center,
  24531. .pagedjs_margin-right-middle,
  24532. .pagedjs_margin-left-middle {
  24533. display: flex;
  24534. align-items: center;
  24535. }
  24536. .pagedjs_margin-right-top,
  24537. .pagedjs_margin-left-top {
  24538. display: flex;
  24539. align-items: flex-top;
  24540. }
  24541. .pagedjs_margin-right-bottom,
  24542. .pagedjs_margin-left-bottom {
  24543. display: flex;
  24544. align-items: flex-end;
  24545. }
  24546. /*
  24547. .pagedjs_pagebox .pagedjs_margin-top-center,
  24548. .pagedjs_pagebox .pagedjs_margin-bottom-center {
  24549. height: 100%;
  24550. display: none;
  24551. align-items: center;
  24552. flex: 1 0 33%;
  24553. margin: 0 auto;
  24554. }
  24555. .pagedjs_pagebox .pagedjs_margin-top-left-corner,
  24556. .pagedjs_pagebox .pagedjs_margin-top-right-corner,
  24557. .pagedjs_pagebox .pagedjs_margin-bottom-right-corner,
  24558. .pagedjs_pagebox .pagedjs_margin-bottom-left-corner {
  24559. display: none;
  24560. align-items: center;
  24561. }
  24562. .pagedjs_pagebox .pagedjs_margin-left-top,
  24563. .pagedjs_pagebox .pagedjs_margin-right-top {
  24564. display: none;
  24565. align-items: flex-start;
  24566. }
  24567. .pagedjs_pagebox .pagedjs_margin-right-middle,
  24568. .pagedjs_pagebox .pagedjs_margin-left-middle {
  24569. display: none;
  24570. align-items: center;
  24571. }
  24572. .pagedjs_pagebox .pagedjs_margin-left-bottom,
  24573. .pagedjs_pagebox .pagedjs_margin-right-bottom {
  24574. display: none;
  24575. align-items: flex-end;
  24576. }
  24577. */
  24578. .pagedjs_pagebox .pagedjs_margin-top-left,
  24579. .pagedjs_pagebox .pagedjs_margin-top-right-corner,
  24580. .pagedjs_pagebox .pagedjs_margin-bottom-left,
  24581. .pagedjs_pagebox .pagedjs_margin-bottom-right-corner { text-align: left; }
  24582. .pagedjs_pagebox .pagedjs_margin-top-left-corner,
  24583. .pagedjs_pagebox .pagedjs_margin-top-right,
  24584. .pagedjs_pagebox .pagedjs_margin-bottom-left-corner,
  24585. .pagedjs_pagebox .pagedjs_margin-bottom-right { text-align: right; }
  24586. .pagedjs_pagebox .pagedjs_margin-top-center,
  24587. .pagedjs_pagebox .pagedjs_margin-bottom-center,
  24588. .pagedjs_pagebox .pagedjs_margin-left-top,
  24589. .pagedjs_pagebox .pagedjs_margin-left-middle,
  24590. .pagedjs_pagebox .pagedjs_margin-left-bottom,
  24591. .pagedjs_pagebox .pagedjs_margin-right-top,
  24592. .pagedjs_pagebox .pagedjs_margin-right-middle,
  24593. .pagedjs_pagebox .pagedjs_margin-right-bottom { text-align: center; }
  24594. .pagedjs_pages .pagedjs_margin .pagedjs_margin-content {
  24595. width: 100%;
  24596. }
  24597. .pagedjs_pages .pagedjs_margin-left .pagedjs_margin-content::after,
  24598. .pagedjs_pages .pagedjs_margin-top .pagedjs_margin-content::after,
  24599. .pagedjs_pages .pagedjs_margin-right .pagedjs_margin-content::after,
  24600. .pagedjs_pages .pagedjs_margin-bottom .pagedjs_margin-content::after {
  24601. display: block;
  24602. }
  24603. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-to] {
  24604. margin-bottom: unset;
  24605. padding-bottom: unset;
  24606. }
  24607. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from] {
  24608. text-indent: unset;
  24609. margin-top: unset;
  24610. padding-top: unset;
  24611. initial-letter: unset;
  24612. }
  24613. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from] > *::first-letter,
  24614. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from]::first-letter {
  24615. color: unset;
  24616. font-size: unset;
  24617. font-weight: unset;
  24618. font-family: unset;
  24619. color: unset;
  24620. line-height: unset;
  24621. float: unset;
  24622. padding: unset;
  24623. margin: unset;
  24624. }
  24625. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-to]:not([data-footnote-call]):after,
  24626. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-to]:not([data-footnote-call])::after {
  24627. content: unset;
  24628. }
  24629. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from]:not([data-footnote-call]):before,
  24630. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from]:not([data-footnote-call])::before {
  24631. content: unset;
  24632. }
  24633. .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div li[data-split-from]:first-of-type {
  24634. list-style: none;
  24635. }
  24636. /*
  24637. [data-page]:not([data-split-from]),
  24638. [data-break-before="page"]:not([data-split-from]),
  24639. [data-break-before="always"]:not([data-split-from]),
  24640. [data-break-before="left"]:not([data-split-from]),
  24641. [data-break-before="right"]:not([data-split-from]),
  24642. [data-break-before="recto"]:not([data-split-from]),
  24643. [data-break-before="verso"]:not([data-split-from])
  24644. {
  24645. break-before: column;
  24646. }
  24647. [data-page]:not([data-split-to]),
  24648. [data-break-after="page"]:not([data-split-to]),
  24649. [data-break-after="always"]:not([data-split-to]),
  24650. [data-break-after="left"]:not([data-split-to]),
  24651. [data-break-after="right"]:not([data-split-to]),
  24652. [data-break-after="recto"]:not([data-split-to]),
  24653. [data-break-after="verso"]:not([data-split-to])
  24654. {
  24655. break-after: column;
  24656. }
  24657. */
  24658. .pagedjs_clear-after::after {
  24659. content: none !important;
  24660. }
  24661. [data-align-last-split-element='justify'] {
  24662. text-align-last: justify;
  24663. }
  24664. @media print {
  24665. html {
  24666. width: 100%;
  24667. height: 100%;
  24668. -webkit-print-color-adjust: exact;
  24669. print-color-adjust: exact;
  24670. }
  24671. body {
  24672. margin: 0;
  24673. padding: 0;
  24674. width: 100% !important;
  24675. height: 100% !important;
  24676. min-width: 100%;
  24677. max-width: 100%;
  24678. min-height: 100%;
  24679. max-height: 100%;
  24680. }
  24681. .pagedjs_pages {
  24682. width: auto;
  24683. display: block !important;
  24684. transform: none !important;
  24685. height: 100% !important;
  24686. min-height: 100%;
  24687. max-height: 100%;
  24688. overflow: visible;
  24689. }
  24690. .pagedjs_page {
  24691. margin: 0;
  24692. padding: 0;
  24693. max-height: 100%;
  24694. min-height: 100%;
  24695. height: 100% !important;
  24696. page-break-after: always;
  24697. break-after: page;
  24698. }
  24699. .pagedjs_sheet {
  24700. margin: 0;
  24701. padding: 0;
  24702. max-height: 100%;
  24703. min-height: 100%;
  24704. height: 100% !important;
  24705. }
  24706. }
  24707. `;
  24708. async function request(url, options={}) {
  24709. return new Promise(function(resolve, reject) {
  24710. let request = new XMLHttpRequest();
  24711. request.open(options.method || "get", url, true);
  24712. for (let i in options.headers) {
  24713. request.setRequestHeader(i, options.headers[i]);
  24714. }
  24715. request.withCredentials = options.credentials === "include";
  24716. request.onload = () => {
  24717. // Chrome returns a status code of 0 for local files
  24718. const status = request.status === 0 && url.startsWith("file://") ? 200 : request.status;
  24719. resolve(new Response(request.responseText, {status}));
  24720. };
  24721. request.onerror = reject;
  24722. request.send(options.body || null);
  24723. });
  24724. }
  24725. class Polisher {
  24726. constructor(setup) {
  24727. this.sheets = [];
  24728. this.inserted = [];
  24729. this.hooks = {};
  24730. this.hooks.onUrl = new Hook(this);
  24731. this.hooks.onAtPage = new Hook(this);
  24732. this.hooks.onAtMedia = new Hook(this);
  24733. this.hooks.onRule = new Hook(this);
  24734. this.hooks.onDeclaration = new Hook(this);
  24735. this.hooks.onContent = new Hook(this);
  24736. this.hooks.onSelector = new Hook(this);
  24737. this.hooks.onPseudoSelector = new Hook(this);
  24738. this.hooks.onImport = new Hook(this);
  24739. this.hooks.beforeTreeParse = new Hook(this);
  24740. this.hooks.beforeTreeWalk = new Hook(this);
  24741. this.hooks.afterTreeWalk = new Hook(this);
  24742. if (setup !== false) {
  24743. this.setup();
  24744. }
  24745. }
  24746. setup() {
  24747. this.base = this.insert(baseStyles);
  24748. this.styleEl = document.createElement("style");
  24749. document.head.appendChild(this.styleEl);
  24750. this.styleSheet = this.styleEl.sheet;
  24751. return this.styleSheet;
  24752. }
  24753. async add() {
  24754. let fetched = [];
  24755. let urls = [];
  24756. for (var i = 0; i < arguments.length; i++) {
  24757. let f;
  24758. if (typeof arguments[i] === "object") {
  24759. for (let url in arguments[i]) {
  24760. let obj = arguments[i];
  24761. f = new Promise(function(resolve, reject) {
  24762. urls.push(url);
  24763. resolve(obj[url]);
  24764. });
  24765. }
  24766. } else {
  24767. urls.push(arguments[i]);
  24768. f = request(arguments[i]).then((response) => {
  24769. return response.text();
  24770. });
  24771. }
  24772. fetched.push(f);
  24773. }
  24774. return await Promise.all(fetched)
  24775. .then(async (originals) => {
  24776. let text = "";
  24777. for (let index = 0; index < originals.length; index++) {
  24778. text = await this.convertViaSheet(originals[index], urls[index]);
  24779. this.insert(text);
  24780. }
  24781. return text;
  24782. });
  24783. }
  24784. async convertViaSheet(cssStr, href) {
  24785. let sheet = new Sheet(href, this.hooks);
  24786. await sheet.parse(cssStr);
  24787. // Insert the imported sheets first
  24788. for (let url of sheet.imported) {
  24789. let str = await request(url).then((response) => {
  24790. return response.text();
  24791. });
  24792. let text = await this.convertViaSheet(str, url);
  24793. this.insert(text);
  24794. }
  24795. this.sheets.push(sheet);
  24796. if (typeof sheet.width !== "undefined") {
  24797. this.width = sheet.width;
  24798. }
  24799. if (typeof sheet.height !== "undefined") {
  24800. this.height = sheet.height;
  24801. }
  24802. if (typeof sheet.orientation !== "undefined") {
  24803. this.orientation = sheet.orientation;
  24804. }
  24805. return sheet.toString();
  24806. }
  24807. insert(text){
  24808. let head = document.querySelector("head");
  24809. let style = document.createElement("style");
  24810. style.setAttribute("data-pagedjs-inserted-styles", "true");
  24811. style.appendChild(document.createTextNode(text));
  24812. head.appendChild(style);
  24813. this.inserted.push(style);
  24814. return style;
  24815. }
  24816. destroy() {
  24817. this.styleEl.remove();
  24818. this.inserted.forEach((s) => {
  24819. s.remove();
  24820. });
  24821. this.sheets = [];
  24822. }
  24823. }
  24824. class Handler {
  24825. constructor(chunker, polisher, caller) {
  24826. let hooks = Object.assign({}, chunker && chunker.hooks, polisher && polisher.hooks, caller && caller.hooks);
  24827. this.chunker = chunker;
  24828. this.polisher = polisher;
  24829. this.caller = caller;
  24830. for (let name in hooks) {
  24831. if (name in this) {
  24832. let hook = hooks[name];
  24833. hook.register(this[name].bind(this));
  24834. }
  24835. }
  24836. }
  24837. }
  24838. EventEmitter(Handler.prototype);
  24839. // https://www.w3.org/TR/css3-page/#page-size-prop
  24840. var pageSizes = {
  24841. "A0": {
  24842. width: {
  24843. value: 841,
  24844. unit: "mm"
  24845. },
  24846. height: {
  24847. value: 1189,
  24848. unit: "mm"
  24849. }
  24850. },
  24851. "A1": {
  24852. width: {
  24853. value: 594,
  24854. unit: "mm"
  24855. },
  24856. height: {
  24857. value: 841,
  24858. unit: "mm"
  24859. }
  24860. },
  24861. "A2": {
  24862. width: {
  24863. value: 420,
  24864. unit: "mm"
  24865. },
  24866. height: {
  24867. value: 594,
  24868. unit: "mm"
  24869. }
  24870. },
  24871. "A3": {
  24872. width: {
  24873. value: 297,
  24874. unit: "mm"
  24875. },
  24876. height: {
  24877. value: 420,
  24878. unit: "mm"
  24879. }
  24880. },
  24881. "A4": {
  24882. width: {
  24883. value: 210,
  24884. unit: "mm"
  24885. },
  24886. height: {
  24887. value: 297,
  24888. unit: "mm"
  24889. }
  24890. },
  24891. "A5": {
  24892. width: {
  24893. value: 148,
  24894. unit: "mm"
  24895. },
  24896. height: {
  24897. value: 210,
  24898. unit: "mm"
  24899. }
  24900. },
  24901. "A6": {
  24902. width: {
  24903. value: 105,
  24904. unit: "mm"
  24905. },
  24906. height: {
  24907. value: 148,
  24908. unit: "mm"
  24909. }
  24910. },
  24911. "A7": {
  24912. width: {
  24913. value: 74,
  24914. unit: "mm"
  24915. },
  24916. height: {
  24917. value: 105,
  24918. unit: "mm"
  24919. }
  24920. },
  24921. "A8": {
  24922. width: {
  24923. value: 52,
  24924. unit: "mm"
  24925. },
  24926. height: {
  24927. value: 74,
  24928. unit: "mm"
  24929. }
  24930. },
  24931. "A9": {
  24932. width: {
  24933. value: 37,
  24934. unit: "mm"
  24935. },
  24936. height: {
  24937. value: 52,
  24938. unit: "mm"
  24939. }
  24940. },
  24941. "A10": {
  24942. width: {
  24943. value: 26,
  24944. unit: "mm"
  24945. },
  24946. height: {
  24947. value: 37,
  24948. unit: "mm"
  24949. }
  24950. },
  24951. "B4": {
  24952. width: {
  24953. value: 250,
  24954. unit: "mm"
  24955. },
  24956. height: {
  24957. value: 353,
  24958. unit: "mm"
  24959. }
  24960. },
  24961. "B5": {
  24962. width: {
  24963. value: 176,
  24964. unit: "mm"
  24965. },
  24966. height: {
  24967. value: 250,
  24968. unit: "mm"
  24969. }
  24970. },
  24971. "letter": {
  24972. width: {
  24973. value: 8.5,
  24974. unit: "in"
  24975. },
  24976. height: {
  24977. value: 11,
  24978. unit: "in"
  24979. }
  24980. },
  24981. "legal": {
  24982. width: {
  24983. value: 8.5,
  24984. unit: "in"
  24985. },
  24986. height: {
  24987. value: 14,
  24988. unit: "in"
  24989. }
  24990. },
  24991. "ledger": {
  24992. width: {
  24993. value: 11,
  24994. unit: "in"
  24995. },
  24996. height: {
  24997. value: 17,
  24998. unit: "in"
  24999. }
  25000. }
  25001. };
  25002. class AtPage extends Handler {
  25003. constructor(chunker, polisher, caller) {
  25004. super(chunker, polisher, caller);
  25005. this.pages = {};
  25006. this.width = undefined;
  25007. this.height = undefined;
  25008. this.orientation = undefined;
  25009. this.marginalia = {};
  25010. }
  25011. pageModel(selector) {
  25012. return {
  25013. selector: selector,
  25014. name: undefined,
  25015. psuedo: undefined,
  25016. nth: undefined,
  25017. marginalia: {},
  25018. width: undefined,
  25019. height: undefined,
  25020. orientation: undefined,
  25021. margin: {
  25022. top: {},
  25023. right: {},
  25024. left: {},
  25025. bottom: {}
  25026. },
  25027. padding: {
  25028. top: {},
  25029. right: {},
  25030. left: {},
  25031. bottom: {}
  25032. },
  25033. border: {
  25034. top: {},
  25035. right: {},
  25036. left: {},
  25037. bottom: {}
  25038. },
  25039. backgroundOrigin: undefined,
  25040. block: {},
  25041. marks: undefined,
  25042. notes: undefined,
  25043. added: false
  25044. };
  25045. }
  25046. // Find and Remove @page rules
  25047. onAtPage(node, item, list) {
  25048. let page, marginalia;
  25049. let selector = "";
  25050. let named, psuedo, nth;
  25051. let needsMerge = false;
  25052. if (node.prelude) {
  25053. named = this.getTypeSelector(node);
  25054. psuedo = this.getPsuedoSelector(node);
  25055. nth = this.getNthSelector(node);
  25056. selector = csstree.generate(node.prelude);
  25057. } else {
  25058. selector = "*";
  25059. }
  25060. if (selector in this.pages) {
  25061. // this.pages[selector] = Object.assign(this.pages[selector], page);
  25062. // console.log("after", selector, this.pages[selector]);
  25063. // this.pages[selector].added = false;
  25064. page = this.pages[selector];
  25065. marginalia = this.replaceMarginalia(node);
  25066. needsMerge = true;
  25067. // Mark page for getting classes added again
  25068. page.added = false;
  25069. } else {
  25070. page = this.pageModel(selector);
  25071. marginalia = this.replaceMarginalia(node);
  25072. this.pages[selector] = page;
  25073. }
  25074. page.name = named;
  25075. page.psuedo = psuedo;
  25076. page.nth = nth;
  25077. if (needsMerge) {
  25078. page.marginalia = Object.assign(page.marginalia, marginalia);
  25079. } else {
  25080. page.marginalia = marginalia;
  25081. }
  25082. let notes = this.replaceNotes(node);
  25083. page.notes = notes;
  25084. let declarations = this.replaceDeclarations(node);
  25085. if (declarations.size) {
  25086. page.size = declarations.size;
  25087. page.width = declarations.size.width;
  25088. page.height = declarations.size.height;
  25089. page.orientation = declarations.size.orientation;
  25090. page.format = declarations.size.format;
  25091. }
  25092. if (declarations.bleed && declarations.bleed[0] != "auto") {
  25093. switch (declarations.bleed.length) {
  25094. case 4: // top right bottom left
  25095. page.bleed = {
  25096. top: declarations.bleed[0],
  25097. right: declarations.bleed[1],
  25098. bottom: declarations.bleed[2],
  25099. left: declarations.bleed[3]
  25100. };
  25101. break;
  25102. case 3: // top right bottom right
  25103. page.bleed = {
  25104. top: declarations.bleed[0],
  25105. right: declarations.bleed[1],
  25106. bottom: declarations.bleed[2],
  25107. left: declarations.bleed[1]
  25108. };
  25109. break;
  25110. case 2: // top right top right
  25111. page.bleed = {
  25112. top: declarations.bleed[0],
  25113. right: declarations.bleed[1],
  25114. bottom: declarations.bleed[0],
  25115. left: declarations.bleed[1]
  25116. };
  25117. break;
  25118. default:
  25119. page.bleed = {
  25120. top: declarations.bleed[0],
  25121. right: declarations.bleed[0],
  25122. bottom: declarations.bleed[0],
  25123. left: declarations.bleed[0]
  25124. };
  25125. }
  25126. }
  25127. if (declarations.marks) {
  25128. if (!declarations.bleed || declarations.bleed && declarations.bleed[0] === "auto") {
  25129. // Spec say 6pt, but needs more space for marks
  25130. page.bleed = {
  25131. top: { value: 6, unit: "mm" },
  25132. right: { value: 6, unit: "mm" },
  25133. bottom: { value: 6, unit: "mm" },
  25134. left: { value: 6, unit: "mm" }
  25135. };
  25136. }
  25137. page.marks = declarations.marks;
  25138. }
  25139. if (declarations.margin) {
  25140. page.margin = declarations.margin;
  25141. }
  25142. if (declarations.padding) {
  25143. page.padding = declarations.padding;
  25144. }
  25145. if (declarations.border) {
  25146. page.border = declarations.border;
  25147. }
  25148. if (declarations.marks) {
  25149. page.marks = declarations.marks;
  25150. }
  25151. if (needsMerge) {
  25152. page.block.children.appendList(node.block.children);
  25153. } else {
  25154. page.block = node.block;
  25155. }
  25156. // Remove the rule
  25157. list.remove(item);
  25158. }
  25159. /* Handled in breaks */
  25160. /*
  25161. afterParsed(parsed) {
  25162. for (let b in this.named) {
  25163. // Find elements
  25164. let elements = parsed.querySelectorAll(b);
  25165. // Add break data
  25166. for (var i = 0; i < elements.length; i++) {
  25167. elements[i].setAttribute("data-page", this.named[b]);
  25168. }
  25169. }
  25170. }
  25171. */
  25172. afterTreeWalk(ast, sheet) {
  25173. let dirtyPage = "*" in this.pages && this.pages["*"].added === false;
  25174. this.addPageClasses(this.pages, ast, sheet);
  25175. if (dirtyPage) {
  25176. let width = this.pages["*"].width;
  25177. let height = this.pages["*"].height;
  25178. let format = this.pages["*"].format;
  25179. let orientation = this.pages["*"].orientation;
  25180. let bleed = this.pages["*"].bleed;
  25181. let marks = this.pages["*"].marks;
  25182. let bleedverso = undefined;
  25183. let bleedrecto = undefined;
  25184. if (":left" in this.pages) {
  25185. bleedverso = this.pages[":left"].bleed;
  25186. }
  25187. if (":right" in this.pages) {
  25188. bleedrecto = this.pages[":right"].bleed;
  25189. }
  25190. if ((width && height) &&
  25191. (this.width !== width || this.height !== height)) {
  25192. this.width = width;
  25193. this.height = height;
  25194. this.format = format;
  25195. this.orientation = orientation;
  25196. this.addRootVars(ast, width, height, orientation, bleed, bleedrecto, bleedverso, marks);
  25197. this.addRootPage(ast, this.pages["*"].size, bleed, bleedrecto, bleedverso);
  25198. this.emit("size", { width, height, orientation, format, bleed });
  25199. this.emit("atpages", this.pages);
  25200. }
  25201. }
  25202. }
  25203. getTypeSelector(ast) {
  25204. // Find page name
  25205. let name;
  25206. csstree.walk(ast, {
  25207. visit: "TypeSelector",
  25208. enter: (node, item, list) => {
  25209. name = node.name;
  25210. }
  25211. });
  25212. return name;
  25213. }
  25214. getPsuedoSelector(ast) {
  25215. // Find if it has :left & :right & :black & :first
  25216. let name;
  25217. csstree.walk(ast, {
  25218. visit: "PseudoClassSelector",
  25219. enter: (node, item, list) => {
  25220. if (node.name !== "nth") {
  25221. name = node.name;
  25222. }
  25223. }
  25224. });
  25225. return name;
  25226. }
  25227. getNthSelector(ast) {
  25228. // Find if it has :nth
  25229. let nth;
  25230. csstree.walk(ast, {
  25231. visit: "PseudoClassSelector",
  25232. enter: (node, item, list) => {
  25233. if (node.name === "nth" && node.children) {
  25234. let raw = node.children.first();
  25235. nth = raw.value;
  25236. }
  25237. }
  25238. });
  25239. return nth;
  25240. }
  25241. replaceMarginalia(ast) {
  25242. let parsed = {};
  25243. const MARGINS = [
  25244. "top-left-corner", "top-left", "top", "top-center", "top-right", "top-right-corner",
  25245. "bottom-left-corner", "bottom-left", "bottom", "bottom-center", "bottom-right", "bottom-right-corner",
  25246. "left-top", "left-middle", "left", "left-bottom", "top-right-corner",
  25247. "right-top", "right-middle", "right", "right-bottom", "right-right-corner"
  25248. ];
  25249. csstree.walk(ast.block, {
  25250. visit: "Atrule",
  25251. enter: (node, item, list) => {
  25252. let name = node.name;
  25253. if (MARGINS.includes(name)) {
  25254. if (name === "top") {
  25255. name = "top-center";
  25256. }
  25257. if (name === "right") {
  25258. name = "right-middle";
  25259. }
  25260. if (name === "left") {
  25261. name = "left-middle";
  25262. }
  25263. if (name === "bottom") {
  25264. name = "bottom-center";
  25265. }
  25266. parsed[name] = node.block;
  25267. list.remove(item);
  25268. }
  25269. }
  25270. });
  25271. return parsed;
  25272. }
  25273. replaceNotes(ast) {
  25274. let parsed = {};
  25275. csstree.walk(ast.block, {
  25276. visit: "Atrule",
  25277. enter: (node, item, list) => {
  25278. let name = node.name;
  25279. if (name === "footnote") {
  25280. parsed[name] = node.block;
  25281. list.remove(item);
  25282. }
  25283. }
  25284. });
  25285. return parsed;
  25286. }
  25287. replaceDeclarations(ast) {
  25288. let parsed = {};
  25289. csstree.walk(ast.block, {
  25290. visit: "Declaration",
  25291. enter: (declaration, dItem, dList) => {
  25292. let prop = csstree.property(declaration.property).name;
  25293. // let value = declaration.value;
  25294. if (prop === "marks") {
  25295. parsed.marks = [];
  25296. csstree.walk(declaration, {
  25297. visit: "Identifier",
  25298. enter: (ident) => {
  25299. parsed.marks.push(ident.name);
  25300. }
  25301. });
  25302. dList.remove(dItem);
  25303. } else if (prop === "margin") {
  25304. parsed.margin = this.getMargins(declaration);
  25305. dList.remove(dItem);
  25306. } else if (prop.indexOf("margin-") === 0) {
  25307. let m = prop.substring("margin-".length);
  25308. if (!parsed.margin) {
  25309. parsed.margin = {
  25310. top: {},
  25311. right: {},
  25312. left: {},
  25313. bottom: {}
  25314. };
  25315. }
  25316. parsed.margin[m] = declaration.value.children.first();
  25317. dList.remove(dItem);
  25318. } else if (prop === "padding") {
  25319. parsed.padding = this.getPaddings(declaration.value);
  25320. dList.remove(dItem);
  25321. } else if (prop.indexOf("padding-") === 0) {
  25322. let p = prop.substring("padding-".length);
  25323. if (!parsed.padding) {
  25324. parsed.padding = {
  25325. top: {},
  25326. right: {},
  25327. left: {},
  25328. bottom: {}
  25329. };
  25330. }
  25331. parsed.padding[p] = declaration.value.children.first();
  25332. dList.remove(dItem);
  25333. }
  25334. else if (prop === "border") {
  25335. if (!parsed.border) {
  25336. parsed.border = {
  25337. top: {},
  25338. right: {},
  25339. left: {},
  25340. bottom: {}
  25341. };
  25342. }
  25343. parsed.border.top = csstree.generate(declaration.value);
  25344. parsed.border.right = csstree.generate(declaration.value);
  25345. parsed.border.left = csstree.generate(declaration.value);
  25346. parsed.border.bottom = csstree.generate(declaration.value);
  25347. dList.remove(dItem);
  25348. }
  25349. else if (prop.indexOf("border-") === 0) {
  25350. if (!parsed.border) {
  25351. parsed.border = {
  25352. top: {},
  25353. right: {},
  25354. left: {},
  25355. bottom: {}
  25356. };
  25357. }
  25358. let p = prop.substring("border-".length);
  25359. parsed.border[p] = csstree.generate(declaration.value);
  25360. dList.remove(dItem);
  25361. }
  25362. else if (prop === "size") {
  25363. parsed.size = this.getSize(declaration);
  25364. dList.remove(dItem);
  25365. } else if (prop === "bleed") {
  25366. parsed.bleed = [];
  25367. csstree.walk(declaration, {
  25368. enter: (subNode) => {
  25369. switch (subNode.type) {
  25370. case "String": // bleed: "auto"
  25371. if (subNode.value.indexOf("auto") > -1) {
  25372. parsed.bleed.push("auto");
  25373. }
  25374. break;
  25375. case "Dimension": // bleed: 1in 2in, bleed: 20px ect.
  25376. parsed.bleed.push({
  25377. value: subNode.value,
  25378. unit: subNode.unit
  25379. });
  25380. break;
  25381. case "Number":
  25382. parsed.bleed.push({
  25383. value: subNode.value,
  25384. unit: "px"
  25385. });
  25386. break;
  25387. // ignore
  25388. }
  25389. }
  25390. });
  25391. dList.remove(dItem);
  25392. }
  25393. }
  25394. });
  25395. return parsed;
  25396. }
  25397. getSize(declaration) {
  25398. let width, height, orientation, format;
  25399. // Get size: Xmm Ymm
  25400. csstree.walk(declaration, {
  25401. visit: "Dimension",
  25402. enter: (node, item, list) => {
  25403. let { value, unit } = node;
  25404. if (typeof width === "undefined") {
  25405. width = { value, unit };
  25406. } else if (typeof height === "undefined") {
  25407. height = { value, unit };
  25408. }
  25409. }
  25410. });
  25411. // Get size: "A4"
  25412. csstree.walk(declaration, {
  25413. visit: "String",
  25414. enter: (node, item, list) => {
  25415. let name = node.value.replace(/["|']/g, "");
  25416. let s = pageSizes[name];
  25417. if (s) {
  25418. width = s.width;
  25419. height = s.height;
  25420. }
  25421. }
  25422. });
  25423. // Get Format or Landscape or Portrait
  25424. csstree.walk(declaration, {
  25425. visit: "Identifier",
  25426. enter: (node, item, list) => {
  25427. let name = node.name;
  25428. if (name === "landscape" || name === "portrait") {
  25429. orientation = node.name;
  25430. } else if (name !== "auto") {
  25431. let s = pageSizes[name];
  25432. if (s) {
  25433. width = s.width;
  25434. height = s.height;
  25435. }
  25436. format = name;
  25437. }
  25438. }
  25439. });
  25440. return {
  25441. width,
  25442. height,
  25443. orientation,
  25444. format
  25445. };
  25446. }
  25447. getMargins(declaration) {
  25448. let margins = [];
  25449. let margin = {
  25450. top: {},
  25451. right: {},
  25452. left: {},
  25453. bottom: {}
  25454. };
  25455. csstree.walk(declaration, {
  25456. enter: (node) => {
  25457. switch (node.type) {
  25458. case "Dimension": // margin: 1in 2in, margin: 20px, etc...
  25459. margins.push(node);
  25460. break;
  25461. case "Number": // margin: 0
  25462. margins.push({value: node.value, unit: "px"});
  25463. break;
  25464. // ignore
  25465. }
  25466. }
  25467. });
  25468. if (margins.length === 1) {
  25469. for (let m in margin) {
  25470. margin[m] = margins[0];
  25471. }
  25472. } else if (margins.length === 2) {
  25473. margin.top = margins[0];
  25474. margin.right = margins[1];
  25475. margin.bottom = margins[0];
  25476. margin.left = margins[1];
  25477. } else if (margins.length === 3) {
  25478. margin.top = margins[0];
  25479. margin.right = margins[1];
  25480. margin.bottom = margins[2];
  25481. margin.left = margins[1];
  25482. } else if (margins.length === 4) {
  25483. margin.top = margins[0];
  25484. margin.right = margins[1];
  25485. margin.bottom = margins[2];
  25486. margin.left = margins[3];
  25487. }
  25488. return margin;
  25489. }
  25490. getPaddings(declaration) {
  25491. let paddings = [];
  25492. let padding = {
  25493. top: {},
  25494. right: {},
  25495. left: {},
  25496. bottom: {}
  25497. };
  25498. csstree.walk(declaration, {
  25499. enter: (node) => {
  25500. switch (node.type) {
  25501. case "Dimension": // padding: 1in 2in, padding: 20px, etc...
  25502. paddings.push(node);
  25503. break;
  25504. case "Number": // padding: 0
  25505. paddings.push({value: node.value, unit: "px"});
  25506. break;
  25507. // ignore
  25508. }
  25509. }
  25510. });
  25511. if (paddings.length === 1) {
  25512. for (let p in padding) {
  25513. padding[p] = paddings[0];
  25514. }
  25515. } else if (paddings.length === 2) {
  25516. padding.top = paddings[0];
  25517. padding.right = paddings[1];
  25518. padding.bottom = paddings[0];
  25519. padding.left = paddings[1];
  25520. } else if (paddings.length === 3) {
  25521. padding.top = paddings[0];
  25522. padding.right = paddings[1];
  25523. padding.bottom = paddings[2];
  25524. padding.left = paddings[1];
  25525. } else if (paddings.length === 4) {
  25526. padding.top = paddings[0];
  25527. padding.right = paddings[1];
  25528. padding.bottom = paddings[2];
  25529. padding.left = paddings[3];
  25530. }
  25531. return padding;
  25532. }
  25533. // get values for the border on the @page to pass them to the element with the .pagedjs_area class
  25534. getBorders(declaration) {
  25535. let border = {
  25536. top: {},
  25537. right: {},
  25538. left: {},
  25539. bottom: {}
  25540. };
  25541. if (declaration.prop == "border") {
  25542. border.top = csstree.generate(declaration.value);
  25543. border.right = csstree.generate(declaration.value);
  25544. border.bottom = csstree.generate(declaration.value);
  25545. border.left = csstree.generate(declaration.value);
  25546. }
  25547. else if (declaration.prop == "border-top") {
  25548. border.top = csstree.generate(declaration.value);
  25549. }
  25550. else if (declaration.prop == "border-right") {
  25551. border.right = csstree.generate(declaration.value);
  25552. }
  25553. else if (declaration.prop == "border-bottom") {
  25554. border.bottom = csstree.generate(declaration.value);
  25555. }
  25556. else if (declaration.prop == "border-left") {
  25557. border.left = csstree.generate(declaration.value);
  25558. }
  25559. return border;
  25560. }
  25561. addPageClasses(pages, ast, sheet) {
  25562. // First add * page
  25563. if ("*" in pages && pages["*"].added === false) {
  25564. let p = this.createPage(pages["*"], ast.children, sheet);
  25565. sheet.insertRule(p);
  25566. pages["*"].added = true;
  25567. }
  25568. // Add :left & :right
  25569. if (":left" in pages && pages[":left"].added === false) {
  25570. let left = this.createPage(pages[":left"], ast.children, sheet);
  25571. sheet.insertRule(left);
  25572. pages[":left"].added = true;
  25573. }
  25574. if (":right" in pages && pages[":right"].added === false) {
  25575. let right = this.createPage(pages[":right"], ast.children, sheet);
  25576. sheet.insertRule(right);
  25577. pages[":right"].added = true;
  25578. }
  25579. // Add :first & :blank
  25580. if (":first" in pages && pages[":first"].added === false) {
  25581. let first = this.createPage(pages[":first"], ast.children, sheet);
  25582. sheet.insertRule(first);
  25583. pages[":first"].added = true;
  25584. }
  25585. if (":blank" in pages && pages[":blank"].added === false) {
  25586. let blank = this.createPage(pages[":blank"], ast.children, sheet);
  25587. sheet.insertRule(blank);
  25588. pages[":blank"].added = true;
  25589. }
  25590. // Add nth pages
  25591. for (let pg in pages) {
  25592. if (pages[pg].nth && pages[pg].added === false) {
  25593. let nth = this.createPage(pages[pg], ast.children, sheet);
  25594. sheet.insertRule(nth);
  25595. pages[pg].added = true;
  25596. }
  25597. }
  25598. // Add named pages
  25599. for (let pg in pages) {
  25600. if (pages[pg].name && pages[pg].added === false) {
  25601. let named = this.createPage(pages[pg], ast.children, sheet);
  25602. sheet.insertRule(named);
  25603. pages[pg].added = true;
  25604. }
  25605. }
  25606. }
  25607. createPage(page, ruleList, sheet) {
  25608. let selectors = this.selectorsForPage(page);
  25609. let children = page.block.children.copy();
  25610. let block = {
  25611. type: "Block",
  25612. loc: 0,
  25613. children: children
  25614. };
  25615. let rule = this.createRule(selectors, block);
  25616. this.addMarginVars(page.margin, children, children.first());
  25617. this.addPaddingVars(page.padding, children, children.first());
  25618. this.addBorderVars(page.border, children, children.first());
  25619. if (page.width) {
  25620. this.addDimensions(page.width, page.height, page.orientation, children, children.first());
  25621. }
  25622. if (page.marginalia) {
  25623. this.addMarginaliaStyles(page, ruleList, rule, sheet);
  25624. this.addMarginaliaContent(page, ruleList, rule, sheet);
  25625. }
  25626. if(page.notes) {
  25627. this.addNotesStyles(page.notes, page, ruleList, rule, sheet);
  25628. }
  25629. return rule;
  25630. }
  25631. addMarginVars(margin, list, item) {
  25632. // variables for margins
  25633. for (let m in margin) {
  25634. if (typeof margin[m].value !== "undefined") {
  25635. let value = margin[m].value + (margin[m].unit || "");
  25636. let mVar = list.createItem({
  25637. type: "Declaration",
  25638. property: "--pagedjs-margin-" + m,
  25639. value: {
  25640. type: "Raw",
  25641. value: value
  25642. }
  25643. });
  25644. list.append(mVar, item);
  25645. }
  25646. }
  25647. }
  25648. addPaddingVars(padding, list, item) {
  25649. // variables for padding
  25650. for (let p in padding) {
  25651. if (typeof padding[p].value !== "undefined") {
  25652. let value = padding[p].value + (padding[p].unit || "");
  25653. let pVar = list.createItem({
  25654. type: "Declaration",
  25655. property: "--pagedjs-padding-" + p,
  25656. value: {
  25657. type: "Raw",
  25658. value: value
  25659. }
  25660. });
  25661. list.append(pVar, item);
  25662. }
  25663. }
  25664. }
  25665. addBorderVars(border, list, item) {
  25666. // variables for borders
  25667. for (const name of Object.keys(border)) {
  25668. const value = border[name];
  25669. // value is an empty object when undefined
  25670. if (typeof value === "string") {
  25671. const borderItem = list.createItem({
  25672. type: "Declaration",
  25673. property: "--pagedjs-border-" + name,
  25674. value: {
  25675. type: "Raw",
  25676. value: value
  25677. }
  25678. });
  25679. list.append(borderItem, item);
  25680. }
  25681. }
  25682. }
  25683. addDimensions(width, height, orientation, list, item) {
  25684. let widthString, heightString;
  25685. widthString = CSSValueToString(width);
  25686. heightString = CSSValueToString(height);
  25687. if (orientation && orientation !== "portrait") {
  25688. // reverse for orientation
  25689. [widthString, heightString] = [heightString, widthString];
  25690. }
  25691. // width variable
  25692. let wVar = this.createVariable("--pagedjs-pagebox-width", widthString);
  25693. list.appendData(wVar);
  25694. // height variable
  25695. let hVar = this.createVariable("--pagedjs-pagebox-height", heightString);
  25696. list.appendData(hVar);
  25697. // let w = this.createDimension("width", width);
  25698. // let h = this.createDimension("height", height);
  25699. // list.appendData(w);
  25700. // list.appendData(h);
  25701. }
  25702. addMarginaliaStyles(page, list, item, sheet) {
  25703. for (let loc in page.marginalia) {
  25704. let block = csstree.clone(page.marginalia[loc]);
  25705. let hasContent = false;
  25706. if (block.children.isEmpty()) {
  25707. continue;
  25708. }
  25709. csstree.walk(block, {
  25710. visit: "Declaration",
  25711. enter: (node, item, list) => {
  25712. if (node.property === "content") {
  25713. if (node.value.children && node.value.children.first().name === "none") {
  25714. hasContent = false;
  25715. } else {
  25716. hasContent = true;
  25717. }
  25718. list.remove(item);
  25719. }
  25720. if (node.property === "vertical-align") {
  25721. csstree.walk(node, {
  25722. visit: "Identifier",
  25723. enter: (identNode, identItem, identlist) => {
  25724. let name = identNode.name;
  25725. if (name === "top") {
  25726. identNode.name = "flex-start";
  25727. } else if (name === "middle") {
  25728. identNode.name = "center";
  25729. } else if (name === "bottom") {
  25730. identNode.name = "flex-end";
  25731. }
  25732. }
  25733. });
  25734. node.property = "align-items";
  25735. }
  25736. if (node.property === "width" &&
  25737. (loc === "top-left" ||
  25738. loc === "top-center" ||
  25739. loc === "top-right" ||
  25740. loc === "bottom-left" ||
  25741. loc === "bottom-center" ||
  25742. loc === "bottom-right")) {
  25743. let c = csstree.clone(node);
  25744. c.property = "max-width";
  25745. list.appendData(c);
  25746. }
  25747. if (node.property === "height" &&
  25748. (loc === "left-top" ||
  25749. loc === "left-middle" ||
  25750. loc === "left-bottom" ||
  25751. loc === "right-top" ||
  25752. loc === "right-middle" ||
  25753. loc === "right-bottom")) {
  25754. let c = csstree.clone(node);
  25755. c.property = "max-height";
  25756. list.appendData(c);
  25757. }
  25758. }
  25759. });
  25760. let marginSelectors = this.selectorsForPageMargin(page, loc);
  25761. let marginRule = this.createRule(marginSelectors, block);
  25762. list.appendData(marginRule);
  25763. let sel = csstree.generate({
  25764. type: "Selector",
  25765. children: marginSelectors
  25766. });
  25767. this.marginalia[sel] = {
  25768. page: page,
  25769. selector: sel,
  25770. block: page.marginalia[loc],
  25771. hasContent: hasContent
  25772. };
  25773. }
  25774. }
  25775. addMarginaliaContent(page, list, item, sheet) {
  25776. let displayNone;
  25777. // Just content
  25778. for (let loc in page.marginalia) {
  25779. let content = csstree.clone(page.marginalia[loc]);
  25780. csstree.walk(content, {
  25781. visit: "Declaration",
  25782. enter: (node, item, list) => {
  25783. if (node.property !== "content") {
  25784. list.remove(item);
  25785. }
  25786. if (node.value.children && node.value.children.first().name === "none") {
  25787. displayNone = true;
  25788. }
  25789. }
  25790. });
  25791. if (content.children.isEmpty()) {
  25792. continue;
  25793. }
  25794. let displaySelectors = this.selectorsForPageMargin(page, loc);
  25795. let displayDeclaration;
  25796. displaySelectors.insertData({
  25797. type: "Combinator",
  25798. name: ">"
  25799. });
  25800. displaySelectors.insertData({
  25801. type: "ClassSelector",
  25802. name: "pagedjs_margin-content"
  25803. });
  25804. displaySelectors.insertData({
  25805. type: "Combinator",
  25806. name: ">"
  25807. });
  25808. displaySelectors.insertData({
  25809. type: "TypeSelector",
  25810. name: "*"
  25811. });
  25812. if (displayNone) {
  25813. displayDeclaration = this.createDeclaration("display", "none");
  25814. } else {
  25815. displayDeclaration = this.createDeclaration("display", "block");
  25816. }
  25817. let displayRule = this.createRule(displaySelectors, [displayDeclaration]);
  25818. sheet.insertRule(displayRule);
  25819. // insert content rule
  25820. let contentSelectors = this.selectorsForPageMargin(page, loc);
  25821. contentSelectors.insertData({
  25822. type: "Combinator",
  25823. name: ">"
  25824. });
  25825. contentSelectors.insertData({
  25826. type: "ClassSelector",
  25827. name: "pagedjs_margin-content"
  25828. });
  25829. contentSelectors.insertData({
  25830. type: "PseudoElementSelector",
  25831. name: "after",
  25832. children: null
  25833. });
  25834. let contentRule = this.createRule(contentSelectors, content);
  25835. sheet.insertRule(contentRule);
  25836. }
  25837. }
  25838. addRootVars(ast, width, height, orientation, bleed, bleedrecto, bleedverso, marks) {
  25839. let rules = [];
  25840. let selectors = new csstree.List();
  25841. selectors.insertData({
  25842. type: "PseudoClassSelector",
  25843. name: "root",
  25844. children: null
  25845. });
  25846. let widthString, heightString;
  25847. let widthStringRight, heightStringRight;
  25848. let widthStringLeft, heightStringLeft;
  25849. if (!bleed) {
  25850. widthString = CSSValueToString(width);
  25851. heightString = CSSValueToString(height);
  25852. widthStringRight = CSSValueToString(width);
  25853. heightStringRight = CSSValueToString(height);
  25854. widthStringLeft = CSSValueToString(width);
  25855. heightStringLeft = CSSValueToString(height);
  25856. } else {
  25857. widthString = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleed.left)} + ${CSSValueToString(bleed.right)} )`;
  25858. heightString = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleed.top)} + ${CSSValueToString(bleed.bottom)} )`;
  25859. widthStringRight = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleed.left)} + ${CSSValueToString(bleed.right)} )`;
  25860. heightStringRight = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleed.top)} + ${CSSValueToString(bleed.bottom)} )`;
  25861. widthStringLeft = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleed.left)} + ${CSSValueToString(bleed.right)} )`;
  25862. heightStringLeft = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleed.top)} + ${CSSValueToString(bleed.bottom)} )`;
  25863. let bleedTop = this.createVariable("--pagedjs-bleed-top", CSSValueToString(bleed.top));
  25864. let bleedRight = this.createVariable("--pagedjs-bleed-right", CSSValueToString(bleed.right));
  25865. let bleedBottom = this.createVariable("--pagedjs-bleed-bottom", CSSValueToString(bleed.bottom));
  25866. let bleedLeft = this.createVariable("--pagedjs-bleed-left", CSSValueToString(bleed.left));
  25867. let bleedTopRecto = this.createVariable("--pagedjs-bleed-right-top", CSSValueToString(bleed.top));
  25868. let bleedRightRecto = this.createVariable("--pagedjs-bleed-right-right", CSSValueToString(bleed.right));
  25869. let bleedBottomRecto = this.createVariable("--pagedjs-bleed-right-bottom", CSSValueToString(bleed.bottom));
  25870. let bleedLeftRecto = this.createVariable("--pagedjs-bleed-right-left", CSSValueToString(bleed.left));
  25871. let bleedTopVerso = this.createVariable("--pagedjs-bleed-left-top", CSSValueToString(bleed.top));
  25872. let bleedRightVerso = this.createVariable("--pagedjs-bleed-left-right", CSSValueToString(bleed.right));
  25873. let bleedBottomVerso = this.createVariable("--pagedjs-bleed-left-bottom", CSSValueToString(bleed.bottom));
  25874. let bleedLeftVerso = this.createVariable("--pagedjs-bleed-left-left", CSSValueToString(bleed.left));
  25875. if (bleedrecto) {
  25876. bleedTopRecto = this.createVariable("--pagedjs-bleed-right-top", CSSValueToString(bleedrecto.top));
  25877. bleedRightRecto = this.createVariable("--pagedjs-bleed-right-right", CSSValueToString(bleedrecto.right));
  25878. bleedBottomRecto = this.createVariable("--pagedjs-bleed-right-bottom", CSSValueToString(bleedrecto.bottom));
  25879. bleedLeftRecto = this.createVariable("--pagedjs-bleed-right-left", CSSValueToString(bleedrecto.left));
  25880. widthStringRight = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleedrecto.left)} + ${CSSValueToString(bleedrecto.right)} )`;
  25881. heightStringRight = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleedrecto.top)} + ${CSSValueToString(bleedrecto.bottom)} )`;
  25882. }
  25883. if (bleedverso) {
  25884. bleedTopVerso = this.createVariable("--pagedjs-bleed-left-top", CSSValueToString(bleedverso.top));
  25885. bleedRightVerso = this.createVariable("--pagedjs-bleed-left-right", CSSValueToString(bleedverso.right));
  25886. bleedBottomVerso = this.createVariable("--pagedjs-bleed-left-bottom", CSSValueToString(bleedverso.bottom));
  25887. bleedLeftVerso = this.createVariable("--pagedjs-bleed-left-left", CSSValueToString(bleedverso.left));
  25888. widthStringLeft = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleedverso.left)} + ${CSSValueToString(bleedverso.right)} )`;
  25889. heightStringLeft = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleedverso.top)} + ${CSSValueToString(bleedverso.bottom)} )`;
  25890. }
  25891. let pageWidthVar = this.createVariable("--pagedjs-width", CSSValueToString(width));
  25892. let pageHeightVar = this.createVariable("--pagedjs-height", CSSValueToString(height));
  25893. rules.push(
  25894. bleedTop,
  25895. bleedRight,
  25896. bleedBottom,
  25897. bleedLeft,
  25898. bleedTopRecto,
  25899. bleedRightRecto,
  25900. bleedBottomRecto,
  25901. bleedLeftRecto,
  25902. bleedTopVerso,
  25903. bleedRightVerso,
  25904. bleedBottomVerso,
  25905. bleedLeftVerso,
  25906. pageWidthVar,
  25907. pageHeightVar
  25908. );
  25909. }
  25910. if (marks) {
  25911. marks.forEach((mark) => {
  25912. let markDisplay = this.createVariable("--pagedjs-mark-" + mark + "-display", "block");
  25913. rules.push(markDisplay);
  25914. });
  25915. }
  25916. // orientation variable
  25917. if (orientation) {
  25918. let oVar = this.createVariable("--pagedjs-orientation", orientation);
  25919. rules.push(oVar);
  25920. if (orientation !== "portrait") {
  25921. // reverse for orientation
  25922. [widthString, heightString] = [heightString, widthString];
  25923. [widthStringRight, heightStringRight] = [heightStringRight, widthStringRight];
  25924. [widthStringLeft, heightStringLeft] = [heightStringLeft, widthStringLeft];
  25925. }
  25926. }
  25927. let wVar = this.createVariable("--pagedjs-width", widthString);
  25928. let hVar = this.createVariable("--pagedjs-height", heightString);
  25929. let wVarR = this.createVariable("--pagedjs-width-right", widthStringRight);
  25930. let hVarR = this.createVariable("--pagedjs-height-right", heightStringRight);
  25931. let wVarL = this.createVariable("--pagedjs-width-left", widthStringLeft);
  25932. let hVarL = this.createVariable("--pagedjs-height-left", heightStringLeft);
  25933. rules.push(wVar, hVar, wVarR, hVarR, wVarL, hVarL);
  25934. let rule = this.createRule(selectors, rules);
  25935. ast.children.appendData(rule);
  25936. }
  25937. addNotesStyles(notes, page, list, item, sheet) {
  25938. for (const note in notes) {
  25939. let selectors = this.selectorsForPage(page);
  25940. selectors.insertData({
  25941. type: "Combinator",
  25942. name: " "
  25943. });
  25944. selectors.insertData({
  25945. type: "ClassSelector",
  25946. name: "pagedjs_" + note + "_content"
  25947. });
  25948. let notesRule = this.createRule(selectors, notes[note]);
  25949. list.appendData(notesRule);
  25950. }
  25951. }
  25952. /*
  25953. @page {
  25954. size: var(--pagedjs-width) var(--pagedjs-height);
  25955. margin: 0;
  25956. padding: 0;
  25957. }
  25958. */
  25959. addRootPage(ast, size, bleed, bleedrecto, bleedverso) {
  25960. let { width, height, orientation, format } = size;
  25961. let children = new csstree.List();
  25962. let childrenLeft = new csstree.List();
  25963. let childrenRight = new csstree.List();
  25964. let dimensions = new csstree.List();
  25965. let dimensionsLeft = new csstree.List();
  25966. let dimensionsRight = new csstree.List();
  25967. if (bleed) {
  25968. let widthCalculations = new csstree.List();
  25969. let heightCalculations = new csstree.List();
  25970. // width
  25971. widthCalculations.appendData({
  25972. type: "Dimension",
  25973. unit: width.unit,
  25974. value: width.value
  25975. });
  25976. widthCalculations.appendData({
  25977. type: "WhiteSpace",
  25978. value: " "
  25979. });
  25980. widthCalculations.appendData({
  25981. type: "Operator",
  25982. value: "+"
  25983. });
  25984. widthCalculations.appendData({
  25985. type: "WhiteSpace",
  25986. value: " "
  25987. });
  25988. widthCalculations.appendData({
  25989. type: "Dimension",
  25990. unit: bleed.left.unit,
  25991. value: bleed.left.value
  25992. });
  25993. widthCalculations.appendData({
  25994. type: "WhiteSpace",
  25995. value: " "
  25996. });
  25997. widthCalculations.appendData({
  25998. type: "Operator",
  25999. value: "+"
  26000. });
  26001. widthCalculations.appendData({
  26002. type: "WhiteSpace",
  26003. value: " "
  26004. });
  26005. widthCalculations.appendData({
  26006. type: "Dimension",
  26007. unit: bleed.right.unit,
  26008. value: bleed.right.value
  26009. });
  26010. // height
  26011. heightCalculations.appendData({
  26012. type: "Dimension",
  26013. unit: height.unit,
  26014. value: height.value
  26015. });
  26016. heightCalculations.appendData({
  26017. type: "WhiteSpace",
  26018. value: " "
  26019. });
  26020. heightCalculations.appendData({
  26021. type: "Operator",
  26022. value: "+"
  26023. });
  26024. heightCalculations.appendData({
  26025. type: "WhiteSpace",
  26026. value: " "
  26027. });
  26028. heightCalculations.appendData({
  26029. type: "Dimension",
  26030. unit: bleed.top.unit,
  26031. value: bleed.top.value
  26032. });
  26033. heightCalculations.appendData({
  26034. type: "WhiteSpace",
  26035. value: " "
  26036. });
  26037. heightCalculations.appendData({
  26038. type: "Operator",
  26039. value: "+"
  26040. });
  26041. heightCalculations.appendData({
  26042. type: "WhiteSpace",
  26043. value: " "
  26044. });
  26045. heightCalculations.appendData({
  26046. type: "Dimension",
  26047. unit: bleed.bottom.unit,
  26048. value: bleed.bottom.value
  26049. });
  26050. dimensions.appendData({
  26051. type: "Function",
  26052. name: "calc",
  26053. children: widthCalculations
  26054. });
  26055. dimensions.appendData({
  26056. type: "WhiteSpace",
  26057. value: " "
  26058. });
  26059. dimensions.appendData({
  26060. type: "Function",
  26061. name: "calc",
  26062. children: heightCalculations
  26063. });
  26064. } else if (format) {
  26065. dimensions.appendData({
  26066. type: "Identifier",
  26067. name: format
  26068. });
  26069. if (orientation) {
  26070. dimensions.appendData({
  26071. type: "WhiteSpace",
  26072. value: " "
  26073. });
  26074. dimensions.appendData({
  26075. type: "Identifier",
  26076. name: orientation
  26077. });
  26078. }
  26079. } else {
  26080. dimensions.appendData({
  26081. type: "Dimension",
  26082. unit: width.unit,
  26083. value: width.value
  26084. });
  26085. dimensions.appendData({
  26086. type: "WhiteSpace",
  26087. value: " "
  26088. });
  26089. dimensions.appendData({
  26090. type: "Dimension",
  26091. unit: height.unit,
  26092. value: height.value
  26093. });
  26094. }
  26095. children.appendData({
  26096. type: "Declaration",
  26097. property: "size",
  26098. loc: null,
  26099. value: {
  26100. type: "Value",
  26101. children: dimensions
  26102. }
  26103. });
  26104. children.appendData({
  26105. type: "Declaration",
  26106. property: "margin",
  26107. loc: null,
  26108. value: {
  26109. type: "Value",
  26110. children: [{
  26111. type: "Dimension",
  26112. unit: "px",
  26113. value: 0
  26114. }]
  26115. }
  26116. });
  26117. children.appendData({
  26118. type: "Declaration",
  26119. property: "padding",
  26120. loc: null,
  26121. value: {
  26122. type: "Value",
  26123. children: [{
  26124. type: "Dimension",
  26125. unit: "px",
  26126. value: 0
  26127. }]
  26128. }
  26129. });
  26130. children.appendData({
  26131. type: "Declaration",
  26132. property: "padding",
  26133. loc: null,
  26134. value: {
  26135. type: "Value",
  26136. children: [{
  26137. type: "Dimension",
  26138. unit: "px",
  26139. value: 0
  26140. }]
  26141. }
  26142. });
  26143. let rule = ast.children.createItem({
  26144. type: "Atrule",
  26145. prelude: null,
  26146. name: "page",
  26147. block: {
  26148. type: "Block",
  26149. loc: null,
  26150. children: children
  26151. }
  26152. });
  26153. ast.children.append(rule);
  26154. if (bleedverso) {
  26155. let widthCalculationsLeft = new csstree.List();
  26156. let heightCalculationsLeft = new csstree.List();
  26157. // width
  26158. widthCalculationsLeft.appendData({
  26159. type: "Dimension",
  26160. unit: width.unit,
  26161. value: width.value
  26162. });
  26163. widthCalculationsLeft.appendData({
  26164. type: "WhiteSpace",
  26165. value: " "
  26166. });
  26167. widthCalculationsLeft.appendData({
  26168. type: "Operator",
  26169. value: "+"
  26170. });
  26171. widthCalculationsLeft.appendData({
  26172. type: "WhiteSpace",
  26173. value: " "
  26174. });
  26175. widthCalculationsLeft.appendData({
  26176. type: "Dimension",
  26177. unit: bleedverso.left.unit,
  26178. value: bleedverso.left.value
  26179. });
  26180. widthCalculationsLeft.appendData({
  26181. type: "WhiteSpace",
  26182. value: " "
  26183. });
  26184. widthCalculationsLeft.appendData({
  26185. type: "Operator",
  26186. value: "+"
  26187. });
  26188. widthCalculationsLeft.appendData({
  26189. type: "WhiteSpace",
  26190. value: " "
  26191. });
  26192. widthCalculationsLeft.appendData({
  26193. type: "Dimension",
  26194. unit: bleedverso.right.unit,
  26195. value: bleedverso.right.value
  26196. });
  26197. // height
  26198. heightCalculationsLeft.appendData({
  26199. type: "Dimension",
  26200. unit: height.unit,
  26201. value: height.value
  26202. });
  26203. heightCalculationsLeft.appendData({
  26204. type: "WhiteSpace",
  26205. value: " "
  26206. });
  26207. heightCalculationsLeft.appendData({
  26208. type: "Operator",
  26209. value: "+"
  26210. });
  26211. heightCalculationsLeft.appendData({
  26212. type: "WhiteSpace",
  26213. value: " "
  26214. });
  26215. heightCalculationsLeft.appendData({
  26216. type: "Dimension",
  26217. unit: bleedverso.top.unit,
  26218. value: bleedverso.top.value
  26219. });
  26220. heightCalculationsLeft.appendData({
  26221. type: "WhiteSpace",
  26222. value: " "
  26223. });
  26224. heightCalculationsLeft.appendData({
  26225. type: "Operator",
  26226. value: "+"
  26227. });
  26228. heightCalculationsLeft.appendData({
  26229. type: "WhiteSpace",
  26230. value: " "
  26231. });
  26232. heightCalculationsLeft.appendData({
  26233. type: "Dimension",
  26234. unit: bleedverso.bottom.unit,
  26235. value: bleedverso.bottom.value
  26236. });
  26237. dimensionsLeft.appendData({
  26238. type: "Function",
  26239. name: "calc",
  26240. children: widthCalculationsLeft
  26241. });
  26242. dimensionsLeft.appendData({
  26243. type: "WhiteSpace",
  26244. value: " "
  26245. });
  26246. dimensionsLeft.appendData({
  26247. type: "Function",
  26248. name: "calc",
  26249. children: heightCalculationsLeft
  26250. });
  26251. childrenLeft.appendData({
  26252. type: "Declaration",
  26253. property: "size",
  26254. loc: null,
  26255. value: {
  26256. type: "Value",
  26257. children: dimensionsLeft
  26258. }
  26259. });
  26260. let ruleLeft = ast.children.createItem({
  26261. type: "Atrule",
  26262. prelude: null,
  26263. name: "page :left",
  26264. block: {
  26265. type: "Block",
  26266. loc: null,
  26267. children: childrenLeft
  26268. }
  26269. });
  26270. ast.children.append(ruleLeft);
  26271. }
  26272. if (bleedrecto) {
  26273. let widthCalculationsRight = new csstree.List();
  26274. let heightCalculationsRight = new csstree.List();
  26275. // width
  26276. widthCalculationsRight.appendData({
  26277. type: "Dimension",
  26278. unit: width.unit,
  26279. value: width.value
  26280. });
  26281. widthCalculationsRight.appendData({
  26282. type: "WhiteSpace",
  26283. value: " "
  26284. });
  26285. widthCalculationsRight.appendData({
  26286. type: "Operator",
  26287. value: "+"
  26288. });
  26289. widthCalculationsRight.appendData({
  26290. type: "WhiteSpace",
  26291. value: " "
  26292. });
  26293. widthCalculationsRight.appendData({
  26294. type: "Dimension",
  26295. unit: bleedrecto.left.unit,
  26296. value: bleedrecto.left.value
  26297. });
  26298. widthCalculationsRight.appendData({
  26299. type: "WhiteSpace",
  26300. value: " "
  26301. });
  26302. widthCalculationsRight.appendData({
  26303. type: "Operator",
  26304. value: "+"
  26305. });
  26306. widthCalculationsRight.appendData({
  26307. type: "WhiteSpace",
  26308. value: " "
  26309. });
  26310. widthCalculationsRight.appendData({
  26311. type: "Dimension",
  26312. unit: bleedrecto.right.unit,
  26313. value: bleedrecto.right.value
  26314. });
  26315. // height
  26316. heightCalculationsRight.appendData({
  26317. type: "Dimension",
  26318. unit: height.unit,
  26319. value: height.value
  26320. });
  26321. heightCalculationsRight.appendData({
  26322. type: "WhiteSpace",
  26323. value: " "
  26324. });
  26325. heightCalculationsRight.appendData({
  26326. type: "Operator",
  26327. value: "+"
  26328. });
  26329. heightCalculationsRight.appendData({
  26330. type: "WhiteSpace",
  26331. value: " "
  26332. });
  26333. heightCalculationsRight.appendData({
  26334. type: "Dimension",
  26335. unit: bleedrecto.top.unit,
  26336. value: bleedrecto.top.value
  26337. });
  26338. heightCalculationsRight.appendData({
  26339. type: "WhiteSpace",
  26340. value: " "
  26341. });
  26342. heightCalculationsRight.appendData({
  26343. type: "Operator",
  26344. value: "+"
  26345. });
  26346. heightCalculationsRight.appendData({
  26347. type: "WhiteSpace",
  26348. value: " "
  26349. });
  26350. heightCalculationsRight.appendData({
  26351. type: "Dimension",
  26352. unit: bleedrecto.bottom.unit,
  26353. value: bleedrecto.bottom.value
  26354. });
  26355. dimensionsRight.appendData({
  26356. type: "Function",
  26357. name: "calc",
  26358. children: widthCalculationsRight
  26359. });
  26360. dimensionsRight.appendData({
  26361. type: "WhiteSpace",
  26362. value: " "
  26363. });
  26364. dimensionsRight.appendData({
  26365. type: "Function",
  26366. name: "calc",
  26367. children: heightCalculationsRight
  26368. });
  26369. childrenRight.appendData({
  26370. type: "Declaration",
  26371. property: "size",
  26372. loc: null,
  26373. value: {
  26374. type: "Value",
  26375. children: dimensionsRight
  26376. }
  26377. });
  26378. let ruleRight = ast.children.createItem({
  26379. type: "Atrule",
  26380. prelude: null,
  26381. name: "page :right",
  26382. block: {
  26383. type: "Block",
  26384. loc: null,
  26385. children: childrenRight
  26386. }
  26387. });
  26388. ast.children.append(ruleRight);
  26389. }
  26390. }
  26391. getNth(nth) {
  26392. let n = nth.indexOf("n");
  26393. let plus = nth.indexOf("+");
  26394. let splitN = nth.split("n");
  26395. let splitP = nth.split("+");
  26396. let a = null;
  26397. let b = null;
  26398. if (n > -1) {
  26399. a = splitN[0];
  26400. if (plus > -1) {
  26401. b = splitP[1];
  26402. }
  26403. } else {
  26404. b = nth;
  26405. }
  26406. return {
  26407. type: "Nth",
  26408. loc: null,
  26409. selector: null,
  26410. nth: {
  26411. type: "AnPlusB",
  26412. loc: null,
  26413. a: a,
  26414. b: b
  26415. }
  26416. };
  26417. }
  26418. addPageAttributes(page, start, pages) {
  26419. let namedPages = [start.dataset.page];
  26420. if (namedPages && namedPages.length) {
  26421. for (const named of namedPages) {
  26422. if (!named) {
  26423. continue;
  26424. }
  26425. page.name = named;
  26426. page.element.classList.add("pagedjs_named_page");
  26427. page.element.classList.add("pagedjs_" + named + "_page");
  26428. if (!start.dataset.splitFrom) {
  26429. page.element.classList.add("pagedjs_" + named + "_first_page");
  26430. }
  26431. }
  26432. }
  26433. }
  26434. getStartElement(content, breakToken) {
  26435. let node = breakToken && breakToken.node;
  26436. if (!content && !breakToken) {
  26437. return;
  26438. }
  26439. // No break
  26440. if (!node) {
  26441. return content.children[0];
  26442. }
  26443. // Top level element
  26444. if (node.nodeType === 1 && node.parentNode.nodeType === 11) {
  26445. return node;
  26446. }
  26447. // Named page
  26448. if (node.nodeType === 1 && node.dataset.page) {
  26449. return node;
  26450. }
  26451. // Get top level Named parent
  26452. let fragment = rebuildAncestors(node);
  26453. let pages = fragment.querySelectorAll("[data-page]");
  26454. if (pages.length) {
  26455. return pages[pages.length - 1];
  26456. } else {
  26457. return fragment.children[0];
  26458. }
  26459. }
  26460. beforePageLayout(page, contents, breakToken, chunker) {
  26461. let start = this.getStartElement(contents, breakToken);
  26462. if (start) {
  26463. this.addPageAttributes(page, start, chunker.pages);
  26464. }
  26465. // page.element.querySelector('.paged_area').style.color = red;
  26466. }
  26467. finalizePage(fragment, page, breakToken, chunker) {
  26468. for (let m in this.marginalia) {
  26469. let margin = this.marginalia[m];
  26470. let sels = m.split(" ");
  26471. let content;
  26472. if (page.element.matches(sels[0]) && margin.hasContent) {
  26473. content = page.element.querySelector(sels[1]);
  26474. content.classList.add("hasContent");
  26475. }
  26476. }
  26477. // check center
  26478. ["top", "bottom"].forEach((loc) => {
  26479. let marginGroup = page.element.querySelector(".pagedjs_margin-" + loc);
  26480. let center = page.element.querySelector(".pagedjs_margin-" + loc + "-center");
  26481. let left = page.element.querySelector(".pagedjs_margin-" + loc + "-left");
  26482. let right = page.element.querySelector(".pagedjs_margin-" + loc + "-right");
  26483. let centerContent = center.classList.contains("hasContent");
  26484. let leftContent = left.classList.contains("hasContent");
  26485. let rightContent = right.classList.contains("hasContent");
  26486. let centerWidth, leftWidth, rightWidth;
  26487. if (leftContent) {
  26488. leftWidth = window.getComputedStyle(left)["max-width"];
  26489. }
  26490. if (rightContent) {
  26491. rightWidth = window.getComputedStyle(right)["max-width"];
  26492. }
  26493. if (centerContent) {
  26494. centerWidth = window.getComputedStyle(center)["max-width"];
  26495. if (centerWidth === "none" || centerWidth === "auto") {
  26496. if (!leftContent && !rightContent) {
  26497. marginGroup.style["grid-template-columns"] = "0 1fr 0";
  26498. } else if (leftContent) {
  26499. if (!rightContent) {
  26500. if (leftWidth !== "none" && leftWidth !== "auto") {
  26501. marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + leftWidth;
  26502. } else {
  26503. marginGroup.style["grid-template-columns"] = "auto auto 1fr";
  26504. left.style["white-space"] = "nowrap";
  26505. center.style["white-space"] = "nowrap";
  26506. let leftOuterWidth = left.offsetWidth;
  26507. let centerOuterWidth = center.offsetWidth;
  26508. let outerwidths = leftOuterWidth + centerOuterWidth;
  26509. let newcenterWidth = centerOuterWidth * 100 / outerwidths;
  26510. marginGroup.style["grid-template-columns"] = "minmax(16.66%, 1fr) minmax(33%, " + newcenterWidth + "%) minmax(16.66%, 1fr)";
  26511. left.style["white-space"] = "normal";
  26512. center.style["white-space"] = "normal";
  26513. }
  26514. } else {
  26515. if (leftWidth !== "none" && leftWidth !== "auto") {
  26516. if (rightWidth !== "none" && rightWidth !== "auto") {
  26517. marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + rightWidth;
  26518. } else {
  26519. marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + leftWidth;
  26520. }
  26521. } else {
  26522. if (rightWidth !== "none" && rightWidth !== "auto") {
  26523. marginGroup.style["grid-template-columns"] = rightWidth + " 1fr " + rightWidth;
  26524. } else {
  26525. marginGroup.style["grid-template-columns"] = "auto auto 1fr";
  26526. left.style["white-space"] = "nowrap";
  26527. center.style["white-space"] = "nowrap";
  26528. right.style["white-space"] = "nowrap";
  26529. let leftOuterWidth = left.offsetWidth;
  26530. let centerOuterWidth = center.offsetWidth;
  26531. let rightOuterWidth = right.offsetWidth;
  26532. let outerwidths = leftOuterWidth + centerOuterWidth + rightOuterWidth;
  26533. let newcenterWidth = centerOuterWidth * 100 / outerwidths;
  26534. if (newcenterWidth > 40) {
  26535. marginGroup.style["grid-template-columns"] = "minmax(16.66%, 1fr) minmax(33%, " + newcenterWidth + "%) minmax(16.66%, 1fr)";
  26536. } else {
  26537. marginGroup.style["grid-template-columns"] = "repeat(3, 1fr)";
  26538. }
  26539. left.style["white-space"] = "normal";
  26540. center.style["white-space"] = "normal";
  26541. right.style["white-space"] = "normal";
  26542. }
  26543. }
  26544. }
  26545. } else {
  26546. if (rightWidth !== "none" && rightWidth !== "auto") {
  26547. marginGroup.style["grid-template-columns"] = rightWidth + " 1fr " + rightWidth;
  26548. } else {
  26549. marginGroup.style["grid-template-columns"] = "auto auto 1fr";
  26550. right.style["white-space"] = "nowrap";
  26551. center.style["white-space"] = "nowrap";
  26552. let rightOuterWidth = right.offsetWidth;
  26553. let centerOuterWidth = center.offsetWidth;
  26554. let outerwidths = rightOuterWidth + centerOuterWidth;
  26555. let newcenterWidth = centerOuterWidth * 100 / outerwidths;
  26556. marginGroup.style["grid-template-columns"] = "minmax(16.66%, 1fr) minmax(33%, " + newcenterWidth + "%) minmax(16.66%, 1fr)";
  26557. right.style["white-space"] = "normal";
  26558. center.style["white-space"] = "normal";
  26559. }
  26560. }
  26561. } else if (centerWidth !== "none" && centerWidth !== "auto") {
  26562. if (leftContent && leftWidth !== "none" && leftWidth !== "auto") {
  26563. marginGroup.style["grid-template-columns"] = leftWidth + " " + centerWidth + " 1fr";
  26564. } else if (rightContent && rightWidth !== "none" && rightWidth !== "auto") {
  26565. marginGroup.style["grid-template-columns"] = "1fr " + centerWidth + " " + rightWidth;
  26566. } else {
  26567. marginGroup.style["grid-template-columns"] = "1fr " + centerWidth + " 1fr";
  26568. }
  26569. }
  26570. } else {
  26571. if (leftContent) {
  26572. if (!rightContent) {
  26573. marginGroup.style["grid-template-columns"] = "1fr 0 0";
  26574. } else {
  26575. if (leftWidth !== "none" && leftWidth !== "auto") {
  26576. if (rightWidth !== "none" && rightWidth !== "auto") {
  26577. marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + rightWidth;
  26578. } else {
  26579. marginGroup.style["grid-template-columns"] = leftWidth + " 0 1fr";
  26580. }
  26581. } else {
  26582. if (rightWidth !== "none" && rightWidth !== "auto") {
  26583. marginGroup.style["grid-template-columns"] = "1fr 0 " + rightWidth;
  26584. } else {
  26585. marginGroup.style["grid-template-columns"] = "auto 1fr auto";
  26586. left.style["white-space"] = "nowrap";
  26587. right.style["white-space"] = "nowrap";
  26588. let leftOuterWidth = left.offsetWidth;
  26589. let rightOuterWidth = right.offsetWidth;
  26590. let outerwidths = leftOuterWidth + rightOuterWidth;
  26591. let newLeftWidth = leftOuterWidth * 100 / outerwidths;
  26592. marginGroup.style["grid-template-columns"] = "minmax(16.66%, " + newLeftWidth + "%) 0 1fr";
  26593. left.style["white-space"] = "normal";
  26594. right.style["white-space"] = "normal";
  26595. }
  26596. }
  26597. }
  26598. } else {
  26599. if (rightWidth !== "none" && rightWidth !== "auto") {
  26600. marginGroup.style["grid-template-columns"] = "1fr 0 " + rightWidth;
  26601. } else {
  26602. marginGroup.style["grid-template-columns"] = "0 0 1fr";
  26603. }
  26604. }
  26605. }
  26606. });
  26607. // check middle
  26608. ["left", "right"].forEach((loc) => {
  26609. let middle = page.element.querySelector(".pagedjs_margin-" + loc + "-middle.hasContent");
  26610. let marginGroup = page.element.querySelector(".pagedjs_margin-" + loc);
  26611. let top = page.element.querySelector(".pagedjs_margin-" + loc + "-top");
  26612. let bottom = page.element.querySelector(".pagedjs_margin-" + loc + "-bottom");
  26613. let topContent = top.classList.contains("hasContent");
  26614. let bottomContent = bottom.classList.contains("hasContent");
  26615. let middleHeight, topHeight, bottomHeight;
  26616. if (topContent) {
  26617. topHeight = window.getComputedStyle(top)["max-height"];
  26618. }
  26619. if (bottomContent) {
  26620. bottomHeight = window.getComputedStyle(bottom)["max-height"];
  26621. }
  26622. if (middle) {
  26623. middleHeight = window.getComputedStyle(middle)["max-height"];
  26624. if (middleHeight === "none" || middleHeight === "auto") {
  26625. if (!topContent && !bottomContent) {
  26626. marginGroup.style["grid-template-rows"] = "0 1fr 0";
  26627. } else if (topContent) {
  26628. if (!bottomContent) {
  26629. if (topHeight !== "none" && topHeight !== "auto") {
  26630. marginGroup.style["grid-template-rows"] = topHeight + " calc(100% - " + topHeight + "*2) " + topHeight;
  26631. }
  26632. } else {
  26633. if (topHeight !== "none" && topHeight !== "auto") {
  26634. if (bottomHeight !== "none" && bottomHeight !== "auto") {
  26635. marginGroup.style["grid-template-rows"] = topHeight + " calc(100% - " + topHeight + " - " + bottomHeight + ") " + bottomHeight;
  26636. } else {
  26637. marginGroup.style["grid-template-rows"] = topHeight + " calc(100% - " + topHeight + "*2) " + topHeight;
  26638. }
  26639. } else {
  26640. if (bottomHeight !== "none" && bottomHeight !== "auto") {
  26641. marginGroup.style["grid-template-rows"] = bottomHeight + " calc(100% - " + bottomHeight + "*2) " + bottomHeight;
  26642. }
  26643. }
  26644. }
  26645. } else {
  26646. if (bottomHeight !== "none" && bottomHeight !== "auto") {
  26647. marginGroup.style["grid-template-rows"] = bottomHeight + " calc(100% - " + bottomHeight + "*2) " + bottomHeight;
  26648. }
  26649. }
  26650. } else {
  26651. if (topContent && topHeight !== "none" && topHeight !== "auto") {
  26652. marginGroup.style["grid-template-rows"] = topHeight + " " + middleHeight + " calc(100% - (" + topHeight + " + " + middleHeight + "))";
  26653. } else if (bottomContent && bottomHeight !== "none" && bottomHeight !== "auto") {
  26654. marginGroup.style["grid-template-rows"] = "1fr " + middleHeight + " " + bottomHeight;
  26655. } else {
  26656. marginGroup.style["grid-template-rows"] = "calc((100% - " + middleHeight + ")/2) " + middleHeight + " calc((100% - " + middleHeight + ")/2)";
  26657. }
  26658. }
  26659. } else {
  26660. if (topContent) {
  26661. if (!bottomContent) {
  26662. marginGroup.style["grid-template-rows"] = "1fr 0 0";
  26663. } else {
  26664. if (topHeight !== "none" && topHeight !== "auto") {
  26665. if (bottomHeight !== "none" && bottomHeight !== "auto") {
  26666. marginGroup.style["grid-template-rows"] = topHeight + " 1fr " + bottomHeight;
  26667. } else {
  26668. marginGroup.style["grid-template-rows"] = topHeight + " 0 1fr";
  26669. }
  26670. } else {
  26671. if (bottomHeight !== "none" && bottomHeight !== "auto") {
  26672. marginGroup.style["grid-template-rows"] = "1fr 0 " + bottomHeight;
  26673. } else {
  26674. marginGroup.style["grid-template-rows"] = "1fr 0 1fr";
  26675. }
  26676. }
  26677. }
  26678. } else {
  26679. if (bottomHeight !== "none" && bottomHeight !== "auto") {
  26680. marginGroup.style["grid-template-rows"] = "1fr 0 " + bottomHeight;
  26681. } else {
  26682. marginGroup.style["grid-template-rows"] = "0 0 1fr";
  26683. }
  26684. }
  26685. }
  26686. });
  26687. }
  26688. // CSS Tree Helpers
  26689. selectorsForPage(page) {
  26690. let nthlist;
  26691. let nth;
  26692. let selectors = new csstree.List();
  26693. selectors.insertData({
  26694. type: "ClassSelector",
  26695. name: "pagedjs_page"
  26696. });
  26697. // Named page
  26698. if (page.name) {
  26699. selectors.insertData({
  26700. type: "ClassSelector",
  26701. name: "pagedjs_named_page"
  26702. });
  26703. selectors.insertData({
  26704. type: "ClassSelector",
  26705. name: "pagedjs_" + page.name + "_page"
  26706. });
  26707. }
  26708. // PsuedoSelector
  26709. if (page.psuedo && !(page.name && page.psuedo === "first")) {
  26710. selectors.insertData({
  26711. type: "ClassSelector",
  26712. name: "pagedjs_" + page.psuedo + "_page"
  26713. });
  26714. }
  26715. if (page.name && page.psuedo === "first") {
  26716. selectors.insertData({
  26717. type: "ClassSelector",
  26718. name: "pagedjs_" + page.name + "_" + page.psuedo + "_page"
  26719. });
  26720. }
  26721. // Nth
  26722. if (page.nth) {
  26723. nthlist = new csstree.List();
  26724. nth = this.getNth(page.nth);
  26725. nthlist.insertData(nth);
  26726. selectors.insertData({
  26727. type: "PseudoClassSelector",
  26728. name: "nth-of-type",
  26729. children: nthlist
  26730. });
  26731. }
  26732. return selectors;
  26733. }
  26734. selectorsForPageMargin(page, margin) {
  26735. let selectors = this.selectorsForPage(page);
  26736. selectors.insertData({
  26737. type: "Combinator",
  26738. name: " "
  26739. });
  26740. selectors.insertData({
  26741. type: "ClassSelector",
  26742. name: "pagedjs_margin-" + margin
  26743. });
  26744. return selectors;
  26745. }
  26746. createDeclaration(property, value, important) {
  26747. let children = new csstree.List();
  26748. children.insertData({
  26749. type: "Identifier",
  26750. loc: null,
  26751. name: value
  26752. });
  26753. return {
  26754. type: "Declaration",
  26755. loc: null,
  26756. important: important,
  26757. property: property,
  26758. value: {
  26759. type: "Value",
  26760. loc: null,
  26761. children: children
  26762. }
  26763. };
  26764. }
  26765. createVariable(property, value) {
  26766. return {
  26767. type: "Declaration",
  26768. loc: null,
  26769. property: property,
  26770. value: {
  26771. type: "Raw",
  26772. value: value
  26773. }
  26774. };
  26775. }
  26776. createCalculatedDimension(property, items, important, operator = "+") {
  26777. let children = new csstree.List();
  26778. let calculations = new csstree.List();
  26779. items.forEach((item, index) => {
  26780. calculations.appendData({
  26781. type: "Dimension",
  26782. unit: item.unit,
  26783. value: item.value
  26784. });
  26785. calculations.appendData({
  26786. type: "WhiteSpace",
  26787. value: " "
  26788. });
  26789. if (index + 1 < items.length) {
  26790. calculations.appendData({
  26791. type: "Operator",
  26792. value: operator
  26793. });
  26794. calculations.appendData({
  26795. type: "WhiteSpace",
  26796. value: " "
  26797. });
  26798. }
  26799. });
  26800. children.insertData({
  26801. type: "Function",
  26802. loc: null,
  26803. name: "calc",
  26804. children: calculations
  26805. });
  26806. return {
  26807. type: "Declaration",
  26808. loc: null,
  26809. important: important,
  26810. property: property,
  26811. value: {
  26812. type: "Value",
  26813. loc: null,
  26814. children: children
  26815. }
  26816. };
  26817. }
  26818. createDimension(property, cssValue, important) {
  26819. let children = new csstree.List();
  26820. children.insertData({
  26821. type: "Dimension",
  26822. loc: null,
  26823. value: cssValue.value,
  26824. unit: cssValue.unit
  26825. });
  26826. return {
  26827. type: "Declaration",
  26828. loc: null,
  26829. important: important,
  26830. property: property,
  26831. value: {
  26832. type: "Value",
  26833. loc: null,
  26834. children: children
  26835. }
  26836. };
  26837. }
  26838. createBlock(declarations) {
  26839. let block = new csstree.List();
  26840. declarations.forEach((declaration) => {
  26841. block.insertData(declaration);
  26842. });
  26843. return {
  26844. type: "Block",
  26845. loc: null,
  26846. children: block
  26847. };
  26848. }
  26849. createRule(selectors, block) {
  26850. let selectorList = new csstree.List();
  26851. selectorList.insertData({
  26852. type: "Selector",
  26853. children: selectors
  26854. });
  26855. if (Array.isArray(block)) {
  26856. block = this.createBlock(block);
  26857. }
  26858. return {
  26859. type: "Rule",
  26860. prelude: {
  26861. type: "SelectorList",
  26862. children: selectorList
  26863. },
  26864. block: block
  26865. };
  26866. }
  26867. }
  26868. class Breaks extends Handler {
  26869. constructor(chunker, polisher, caller) {
  26870. super(chunker, polisher, caller);
  26871. this.breaks = {};
  26872. }
  26873. onDeclaration(declaration, dItem, dList, rule) {
  26874. let property = declaration.property;
  26875. if (property === "page") {
  26876. let children = declaration.value.children.first();
  26877. let value = children.name;
  26878. let selector = csstree.generate(rule.ruleNode.prelude);
  26879. let name = value;
  26880. let breaker = {
  26881. property: property,
  26882. value: value,
  26883. selector: selector,
  26884. name: name
  26885. };
  26886. selector.split(",").forEach((s) => {
  26887. if (!this.breaks[s]) {
  26888. this.breaks[s] = [breaker];
  26889. } else {
  26890. this.breaks[s].push(breaker);
  26891. }
  26892. });
  26893. dList.remove(dItem);
  26894. }
  26895. if (property === "break-before" ||
  26896. property === "break-after" ||
  26897. property === "page-break-before" ||
  26898. property === "page-break-after"
  26899. ) {
  26900. let child = declaration.value.children.first();
  26901. let value = child.name;
  26902. let selector = csstree.generate(rule.ruleNode.prelude);
  26903. if (property === "page-break-before") {
  26904. property = "break-before";
  26905. } else if (property === "page-break-after") {
  26906. property = "break-after";
  26907. }
  26908. let breaker = {
  26909. property: property,
  26910. value: value,
  26911. selector: selector
  26912. };
  26913. selector.split(",").forEach((s) => {
  26914. if (!this.breaks[s]) {
  26915. this.breaks[s] = [breaker];
  26916. } else {
  26917. this.breaks[s].push(breaker);
  26918. }
  26919. });
  26920. // Remove from CSS -- handle right / left in module
  26921. dList.remove(dItem);
  26922. }
  26923. }
  26924. afterParsed(parsed) {
  26925. this.processBreaks(parsed, this.breaks);
  26926. }
  26927. processBreaks(parsed, breaks) {
  26928. for (let b in breaks) {
  26929. // Find elements
  26930. let elements = parsed.querySelectorAll(b);
  26931. // Add break data
  26932. for (var i = 0; i < elements.length; i++) {
  26933. for (let prop of breaks[b]) {
  26934. if (prop.property === "break-after") {
  26935. let nodeAfter = displayedElementAfter(elements[i], parsed);
  26936. elements[i].setAttribute("data-break-after", prop.value);
  26937. if (nodeAfter) {
  26938. nodeAfter.setAttribute("data-previous-break-after", prop.value);
  26939. }
  26940. } else if (prop.property === "break-before") {
  26941. let nodeBefore = displayedElementBefore(elements[i], parsed);
  26942. // Breaks are only allowed between siblings, not between a box and its container.
  26943. // If we cannot find a node before we should not break!
  26944. // https://drafts.csswg.org/css-break-3/#break-propagation
  26945. if (nodeBefore) {
  26946. if (prop.value === "page" && needsPageBreak(elements[i], nodeBefore)) {
  26947. // we ignore this explicit page break because an implicit page break is already needed
  26948. continue;
  26949. }
  26950. elements[i].setAttribute("data-break-before", prop.value);
  26951. nodeBefore.setAttribute("data-next-break-before", prop.value);
  26952. }
  26953. } else if (prop.property === "page") {
  26954. elements[i].setAttribute("data-page", prop.value);
  26955. let nodeAfter = displayedElementAfter(elements[i], parsed);
  26956. if (nodeAfter) {
  26957. nodeAfter.setAttribute("data-after-page", prop.value);
  26958. }
  26959. } else {
  26960. elements[i].setAttribute("data-" + prop.property, prop.value);
  26961. }
  26962. }
  26963. }
  26964. }
  26965. }
  26966. mergeBreaks(pageBreaks, newBreaks) {
  26967. for (let b in newBreaks) {
  26968. if (b in pageBreaks) {
  26969. pageBreaks[b] = pageBreaks[b].concat(newBreaks[b]);
  26970. } else {
  26971. pageBreaks[b] = newBreaks[b];
  26972. }
  26973. }
  26974. return pageBreaks;
  26975. }
  26976. addBreakAttributes(pageElement, page) {
  26977. let before = pageElement.querySelector("[data-break-before]");
  26978. let after = pageElement.querySelector("[data-break-after]");
  26979. let previousBreakAfter = pageElement.querySelector("[data-previous-break-after]");
  26980. if (before) {
  26981. if (before.dataset.splitFrom) {
  26982. page.splitFrom = before.dataset.splitFrom;
  26983. pageElement.setAttribute("data-split-from", before.dataset.splitFrom);
  26984. } else if (before.dataset.breakBefore && before.dataset.breakBefore !== "avoid") {
  26985. page.breakBefore = before.dataset.breakBefore;
  26986. pageElement.setAttribute("data-break-before", before.dataset.breakBefore);
  26987. }
  26988. }
  26989. if (after && after.dataset) {
  26990. if (after.dataset.splitTo) {
  26991. page.splitTo = after.dataset.splitTo;
  26992. pageElement.setAttribute("data-split-to", after.dataset.splitTo);
  26993. } else if (after.dataset.breakAfter && after.dataset.breakAfter !== "avoid") {
  26994. page.breakAfter = after.dataset.breakAfter;
  26995. pageElement.setAttribute("data-break-after", after.dataset.breakAfter);
  26996. }
  26997. }
  26998. if (previousBreakAfter && previousBreakAfter.dataset) {
  26999. if (previousBreakAfter.dataset.previousBreakAfter && previousBreakAfter.dataset.previousBreakAfter !== "avoid") {
  27000. page.previousBreakAfter = previousBreakAfter.dataset.previousBreakAfter;
  27001. }
  27002. }
  27003. }
  27004. afterPageLayout(pageElement, page) {
  27005. this.addBreakAttributes(pageElement, page);
  27006. }
  27007. }
  27008. class PrintMedia extends Handler {
  27009. constructor(chunker, polisher, caller) {
  27010. super(chunker, polisher, caller);
  27011. }
  27012. onAtMedia(node, item, list) {
  27013. let media = this.getMediaName(node);
  27014. let rules;
  27015. if (media.includes("print")) {
  27016. rules = node.block.children;
  27017. // Append rules to the end of main rules list
  27018. // TODO: this isn't working right, needs to check what is in the prelude
  27019. /*
  27020. rules.forEach((selectList) => {
  27021. if (selectList.prelude) {
  27022. selectList.prelude.children.forEach((rule) => {
  27023. rule.children.prependData({
  27024. type: "Combinator",
  27025. name: " "
  27026. });
  27027. rule.children.prependData({
  27028. type: "ClassSelector",
  27029. name: "pagedjs_page"
  27030. });
  27031. });
  27032. }
  27033. });
  27034. list.insertList(rules, item);
  27035. */
  27036. // Append rules to the end of main rules list
  27037. list.appendList(rules);
  27038. // Remove rules from the @media block
  27039. list.remove(item);
  27040. } else if (!media.includes("all") && !media.includes("pagedjs-ignore")) {
  27041. list.remove(item);
  27042. }
  27043. }
  27044. getMediaName(node) {
  27045. let media = [];
  27046. if (typeof node.prelude === "undefined" ||
  27047. node.prelude.type !== "AtrulePrelude" ) {
  27048. return;
  27049. }
  27050. csstree.walk(node.prelude, {
  27051. visit: "Identifier",
  27052. enter: (identNode, iItem, iList) => {
  27053. media.push(identNode.name);
  27054. }
  27055. });
  27056. return media;
  27057. }
  27058. }
  27059. class Splits extends Handler {
  27060. constructor(chunker, polisher, caller) {
  27061. super(chunker, polisher, caller);
  27062. }
  27063. afterPageLayout(pageElement, page, breakToken, chunker) {
  27064. let splits = Array.from(pageElement.querySelectorAll("[data-split-from]"));
  27065. let pages = pageElement.parentNode;
  27066. let index = Array.prototype.indexOf.call(pages.children, pageElement);
  27067. let prevPage;
  27068. if (index === 0) {
  27069. return;
  27070. }
  27071. prevPage = pages.children[index - 1];
  27072. let from; // Capture the last from element
  27073. splits.forEach((split) => {
  27074. let ref = split.dataset.ref;
  27075. from = prevPage.querySelector("[data-ref='"+ ref +"']:not([data-split-to])");
  27076. if (from) {
  27077. from.dataset.splitTo = ref;
  27078. if (!from.dataset.splitFrom) {
  27079. from.dataset.splitOriginal = true;
  27080. }
  27081. }
  27082. });
  27083. // Fix alignment on the deepest split element
  27084. if (from) {
  27085. this.handleAlignment(from);
  27086. }
  27087. }
  27088. handleAlignment(node) {
  27089. let styles = window.getComputedStyle(node);
  27090. let align = styles["text-align"];
  27091. let alignLast = styles["text-align-last"];
  27092. node.dataset.lastSplitElement = "true";
  27093. if (align === "justify" && alignLast === "auto") {
  27094. node.dataset.alignLastSplitElement = "justify";
  27095. } else {
  27096. node.dataset.alignLastSplitElement = alignLast;
  27097. }
  27098. }
  27099. }
  27100. class Counters extends Handler {
  27101. constructor(chunker, polisher, caller) {
  27102. super(chunker, polisher, caller);
  27103. this.styleSheet = polisher.styleSheet;
  27104. this.counters = {};
  27105. this.resetCountersMap = new Map();
  27106. }
  27107. onDeclaration(declaration, dItem, dList, rule) {
  27108. let property = declaration.property;
  27109. if (property === "counter-increment") {
  27110. this.handleIncrement(declaration, rule);
  27111. // clean up empty declaration
  27112. let hasProperities = false;
  27113. declaration.value.children.forEach((data) => {
  27114. if (data.type && data.type !== "WhiteSpace") {
  27115. hasProperities = true;
  27116. }
  27117. });
  27118. if (!hasProperities) {
  27119. dList.remove(dItem);
  27120. }
  27121. } else if (property === "counter-reset") {
  27122. this.handleReset(declaration, rule);
  27123. // clean up empty declaration
  27124. let hasProperities = false;
  27125. declaration.value.children.forEach((data) => {
  27126. if (data.type && data.type !== "WhiteSpace") {
  27127. hasProperities = true;
  27128. }
  27129. });
  27130. if (!hasProperities) {
  27131. dList.remove(dItem);
  27132. }
  27133. }
  27134. }
  27135. afterParsed(parsed) {
  27136. this.processCounters(parsed, this.counters);
  27137. this.scopeCounters(this.counters);
  27138. }
  27139. addCounter(name) {
  27140. if (name in this.counters) {
  27141. return this.counters[name];
  27142. }
  27143. this.counters[name] = {
  27144. name: name,
  27145. increments: {},
  27146. resets: {}
  27147. };
  27148. return this.counters[name];
  27149. }
  27150. handleIncrement(declaration, rule) {
  27151. let increments = [];
  27152. let children = declaration.value.children;
  27153. children.forEach((data, item) => {
  27154. if (data.type && data.type === "Identifier") {
  27155. let name = data.name;
  27156. if (name === "page" || name.indexOf("target-counter-") === 0) {
  27157. return;
  27158. }
  27159. let whitespace, number, value;
  27160. if (item.next && item.next.data.type === "WhiteSpace") {
  27161. whitespace = item.next;
  27162. }
  27163. if (whitespace && whitespace.next && whitespace.next.data.type === "Number") {
  27164. number = whitespace.next;
  27165. value = parseInt(number.data.value);
  27166. }
  27167. let selector = csstree.generate(rule.ruleNode.prelude);
  27168. let counter;
  27169. if (!(name in this.counters)) {
  27170. counter = this.addCounter(name);
  27171. } else {
  27172. counter = this.counters[name];
  27173. }
  27174. let increment = {
  27175. selector: selector,
  27176. number: value || 1
  27177. };
  27178. counter.increments[selector] = increment;
  27179. increments.push(increment);
  27180. // Remove the parsed resets
  27181. children.remove(item);
  27182. if (whitespace) {
  27183. children.remove(whitespace);
  27184. }
  27185. if (number) {
  27186. children.remove(number);
  27187. }
  27188. }
  27189. });
  27190. return increments;
  27191. }
  27192. handleReset(declaration, rule) {
  27193. let children = declaration.value.children;
  27194. children.forEach((data, item) => {
  27195. if (data.type && data.type === "Identifier") {
  27196. let name = data.name;
  27197. let whitespace, number, value;
  27198. if (item.next && item.next.data.type === "WhiteSpace") {
  27199. whitespace = item.next;
  27200. }
  27201. if (whitespace && whitespace.next) {
  27202. if (whitespace.next.data.type === "Number") {
  27203. // The counter reset value is specified using a number. E.g. counter-reset: c2 5;
  27204. number = whitespace.next;
  27205. value = parseInt(number.data.value);
  27206. } else if (whitespace.next.data.type === "Function" && whitespace.next.data.name === "var") {
  27207. // The counter reset value is specified using a CSS variable (custom property).
  27208. // E.g. counter-reset: c2 var(--my-variable);
  27209. // See https://developer.mozilla.org/en-US/docs/Web/CSS/var
  27210. number = whitespace.next;
  27211. // Use the variable name (e.g. '--my-variable') as value for now. The actual value is resolved later by the
  27212. // processCounterResets function.
  27213. value = whitespace.next.data.children.head.data.name;
  27214. }
  27215. }
  27216. let counter;
  27217. let selector;
  27218. let prelude = rule.ruleNode.prelude;
  27219. if (rule.ruleNode.type === "Atrule" && rule.ruleNode.name === "page") {
  27220. selector = ".pagedjs_page";
  27221. } else {
  27222. selector = csstree.generate(prelude || rule.ruleNode);
  27223. }
  27224. if (name === "footnote") {
  27225. this.addFootnoteMarkerCounter(declaration.value.children);
  27226. }
  27227. if (!(name in this.counters)) {
  27228. counter = this.addCounter(name);
  27229. } else {
  27230. counter = this.counters[name];
  27231. }
  27232. let reset = {
  27233. selector: selector,
  27234. number: value || 0
  27235. };
  27236. counter.resets[selector] = reset;
  27237. if (selector !== ".pagedjs_page") {
  27238. // Remove the parsed resets
  27239. children.remove(item);
  27240. if (whitespace) {
  27241. children.remove(whitespace);
  27242. }
  27243. if (number) {
  27244. children.remove(number);
  27245. }
  27246. }
  27247. }
  27248. });
  27249. }
  27250. processCounters(parsed, counters) {
  27251. let counter;
  27252. for (let c in counters) {
  27253. counter = this.counters[c];
  27254. this.processCounterIncrements(parsed, counter);
  27255. this.processCounterResets(parsed, counter);
  27256. if (c !== "page") {
  27257. this.addCounterValues(parsed, counter);
  27258. }
  27259. }
  27260. }
  27261. scopeCounters(counters) {
  27262. let countersArray = [];
  27263. for (let c in counters) {
  27264. if(c !== "page") {
  27265. countersArray.push(`${counters[c].name} 0`);
  27266. }
  27267. }
  27268. // Add to pages to allow cross page scope
  27269. 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)}`);
  27270. }
  27271. insertRule(rule) {
  27272. this.styleSheet.insertRule(rule, this.styleSheet.cssRules.length);
  27273. }
  27274. processCounterIncrements(parsed, counter) {
  27275. let increment;
  27276. for (let inc in counter.increments) {
  27277. increment = counter.increments[inc];
  27278. // Find elements for increments
  27279. let incrementElements = parsed.querySelectorAll(increment.selector);
  27280. // Add counter data
  27281. for (let i = 0; i < incrementElements.length; i++) {
  27282. incrementElements[i].setAttribute("data-counter-"+ counter.name +"-increment", increment.number);
  27283. if (incrementElements[i].getAttribute("data-counter-increment")) {
  27284. incrementElements[i].setAttribute("data-counter-increment", incrementElements[i].getAttribute("data-counter-increment") + " " + counter.name);
  27285. } else {
  27286. incrementElements[i].setAttribute("data-counter-increment", counter.name);
  27287. }
  27288. }
  27289. }
  27290. }
  27291. processCounterResets(parsed, counter) {
  27292. let reset;
  27293. for (let r in counter.resets) {
  27294. reset = counter.resets[r];
  27295. // Find elements for resets
  27296. let resetElements = parsed.querySelectorAll(reset.selector);
  27297. // Add counter data
  27298. for (var i = 0; i < resetElements.length; i++) {
  27299. let value = reset.number;
  27300. if (typeof value === "string" && value.startsWith("--")) {
  27301. // The value is specified using a CSS variable (custom property).
  27302. // FIXME: We get the variable value only from the inline style of the element because at this point the
  27303. // element is detached and thus using:
  27304. //
  27305. // getComputedStyle(resetElements[i]).getPropertyValue(value)
  27306. //
  27307. // always returns an empty string. We could try to temporarily attach the element to get its computed style,
  27308. // but for now using the inline style is enough for us.
  27309. value = resetElements[i].style.getPropertyValue(value) || 0;
  27310. }
  27311. resetElements[i].setAttribute("data-counter-"+ counter.name +"-reset", value);
  27312. if (resetElements[i].getAttribute("data-counter-reset")) {
  27313. resetElements[i].setAttribute("data-counter-reset", resetElements[i].getAttribute("data-counter-reset") + " " + counter.name);
  27314. } else {
  27315. resetElements[i].setAttribute("data-counter-reset", counter.name);
  27316. }
  27317. }
  27318. }
  27319. }
  27320. addCounterValues(parsed, counter) {
  27321. let counterName = counter.name;
  27322. if (counterName === "page" || counterName === "footnote") {
  27323. return;
  27324. }
  27325. let elements = parsed.querySelectorAll("[data-counter-"+ counterName +"-reset], [data-counter-"+ counterName +"-increment]");
  27326. let count = 0;
  27327. let element;
  27328. let increment, reset;
  27329. let resetValue, incrementValue, resetDelta;
  27330. let incrementArray;
  27331. for (let i = 0; i < elements.length; i++) {
  27332. element = elements[i];
  27333. resetDelta = 0;
  27334. incrementArray = [];
  27335. if (element.hasAttribute("data-counter-"+ counterName +"-reset")) {
  27336. reset = element.getAttribute("data-counter-"+ counterName +"-reset");
  27337. resetValue = parseInt(reset);
  27338. // Use negative increment value inplace of reset
  27339. resetDelta = resetValue - count;
  27340. incrementArray.push(`${counterName} ${resetDelta}`);
  27341. count = resetValue;
  27342. }
  27343. if (element.hasAttribute("data-counter-"+ counterName +"-increment")) {
  27344. increment = element.getAttribute("data-counter-"+ counterName +"-increment");
  27345. incrementValue = parseInt(increment);
  27346. count += incrementValue;
  27347. element.setAttribute("data-counter-"+counterName+"-value", count);
  27348. incrementArray.push(`${counterName} ${incrementValue}`);
  27349. }
  27350. if (incrementArray.length > 0) {
  27351. this.incrementCounterForElement(element, incrementArray);
  27352. }
  27353. }
  27354. }
  27355. addFootnoteMarkerCounter(list) {
  27356. let markers = [];
  27357. csstree.walk(list, {
  27358. visit: "Identifier",
  27359. enter: (identNode, iItem, iList) => {
  27360. markers.push(identNode.name);
  27361. }
  27362. });
  27363. // Already added
  27364. if (markers.includes("footnote-maker")) {
  27365. return;
  27366. }
  27367. list.insertData({
  27368. type: "WhiteSpace",
  27369. value: " "
  27370. });
  27371. list.insertData({
  27372. type: "Identifier",
  27373. name: "footnote-marker"
  27374. });
  27375. list.insertData({
  27376. type: "WhiteSpace",
  27377. value: " "
  27378. });
  27379. list.insertData({
  27380. type: "Number",
  27381. value: 0
  27382. });
  27383. }
  27384. incrementCounterForElement(element, incrementArray) {
  27385. if (!element || !incrementArray || incrementArray.length === 0) return;
  27386. const ref = element.dataset.ref;
  27387. const increments = Array.from(this.styleSheet.cssRules).filter((rule) => {
  27388. return rule.selectorText === `[data-ref="${element.dataset.ref}"]:not([data-split-from])`
  27389. && rule.style[0] === "counter-increment";
  27390. }).map(rule => rule.style.counterIncrement);
  27391. // Merge the current increments by summing the values because we generate both a decrement and an increment when the
  27392. // element resets and increments the counter at the same time. E.g. ['c1 -7', 'c1 1'] should lead to 'c1 -6'.
  27393. increments.push(this.mergeIncrements(incrementArray,
  27394. (prev, next) => (parseInt(prev) || 0) + (parseInt(next) || 0)));
  27395. // Keep the last value for each counter when merging with the previous increments. E.g. ['c1 -7 c2 3', 'c1 1']
  27396. // should lead to 'c1 1 c2 3'.
  27397. const counterIncrement = this.mergeIncrements(increments, (prev, next) => next);
  27398. this.insertRule(`[data-ref="${ref}"]:not([data-split-from]) { counter-increment: ${counterIncrement} }`);
  27399. }
  27400. /**
  27401. * Merge multiple values of a counter-increment CSS rule, using the specified operator.
  27402. *
  27403. * @param {Array} incrementArray the values to merge, e.g. ['c1 1', 'c1 -7 c2 1']
  27404. * @param {Function} operator the function used to merge counter values (e.g. keep the last value of a counter or sum
  27405. * the counter values)
  27406. * @return {string} the merged value of the counter-increment CSS rule
  27407. */
  27408. mergeIncrements(incrementArray, operator) {
  27409. const increments = {};
  27410. incrementArray.forEach(increment => {
  27411. let values = increment.split(" ");
  27412. for (let i = 0; i < values.length; i+=2) {
  27413. increments[values[i]] = operator(increments[values[i]], values[i + 1]);
  27414. }
  27415. });
  27416. return Object.entries(increments).map(([key, value]) => `${key} ${value}`).join(" ");
  27417. }
  27418. afterPageLayout(pageElement, page) {
  27419. let resets = [];
  27420. let pgreset = pageElement.querySelectorAll("[data-counter-page-reset]:not([data-split-from])");
  27421. pgreset.forEach((reset) => {
  27422. const ref = reset.dataset && reset.dataset.ref;
  27423. if (ref && this.resetCountersMap.has(ref)) ; else {
  27424. if (ref) {
  27425. this.resetCountersMap.set(ref, "");
  27426. }
  27427. let value = reset.dataset.counterPageReset;
  27428. resets.push(`page ${value}`);
  27429. }
  27430. });
  27431. let notereset = pageElement.querySelectorAll("[data-counter-footnote-reset]:not([data-split-from])");
  27432. notereset.forEach((reset) => {
  27433. let value = reset.dataset.counterFootnoteReset;
  27434. resets.push(`footnote ${value}`);
  27435. resets.push(`footnote-marker ${value}`);
  27436. });
  27437. if (resets.length) {
  27438. this.styleSheet.insertRule(`[data-page-number="${pageElement.dataset.pageNumber}"] { counter-increment: none; counter-reset: ${resets.join(" ")} }`, this.styleSheet.cssRules.length);
  27439. }
  27440. }
  27441. }
  27442. class Lists extends Handler {
  27443. constructor(chunker, polisher, caller) {
  27444. super(chunker, polisher, caller);
  27445. }
  27446. afterParsed(content) {
  27447. const orderedLists = content.querySelectorAll("ol");
  27448. for (var list of orderedLists) {
  27449. this.addDataNumbers(list);
  27450. }
  27451. }
  27452. afterPageLayout(pageElement, page, breakToken, chunker) {
  27453. var orderedLists = pageElement.getElementsByTagName("ol");
  27454. for (var list of orderedLists) {
  27455. if (list.firstElementChild) {
  27456. list.start = list.firstElementChild.dataset.itemNum;
  27457. }
  27458. }
  27459. }
  27460. addDataNumbers(list) {
  27461. let start = 1;
  27462. if (list.hasAttribute("start")) {
  27463. start = parseInt(list.getAttribute("start"), 10);
  27464. if (isNaN(start)) {
  27465. start = 1;
  27466. }
  27467. }
  27468. let items = list.children;
  27469. for (var i = 0; i < items.length; i++) {
  27470. items[i].setAttribute("data-item-num", i + start);
  27471. }
  27472. }
  27473. }
  27474. class PositionFixed extends Handler {
  27475. constructor(chunker, polisher, caller) {
  27476. super(chunker, polisher, caller);
  27477. this.styleSheet = polisher.styleSheet;
  27478. this.fixedElementsSelector = [];
  27479. this.fixedElements = [];
  27480. }
  27481. onDeclaration(declaration, dItem, dList, rule) {
  27482. if (declaration.property === "position" && declaration.value.children.first().name === "fixed") {
  27483. let selector = csstree.generate(rule.ruleNode.prelude);
  27484. this.fixedElementsSelector.push(selector);
  27485. dList.remove(dItem);
  27486. }
  27487. }
  27488. afterParsed(fragment) {
  27489. this.fixedElementsSelector.forEach(fixedEl => {
  27490. fragment.querySelectorAll(`${fixedEl}`).forEach(el => {
  27491. el.style.setProperty("position", "absolute");
  27492. this.fixedElements.push(el);
  27493. el.remove();
  27494. });
  27495. });
  27496. }
  27497. afterPageLayout(pageElement, page, breakToken) {
  27498. this.fixedElements.forEach(el => {
  27499. const clone = el.cloneNode(true);
  27500. pageElement.querySelector(".pagedjs_pagebox").insertAdjacentElement("afterbegin", clone);
  27501. });
  27502. }
  27503. }
  27504. class PageCounterIncrement extends Handler {
  27505. constructor(chunker, polisher, caller) {
  27506. super(chunker, polisher, caller);
  27507. this.styleSheet = polisher.styleSheet;
  27508. this.pageCounter = {
  27509. name: "page",
  27510. increments: {},
  27511. resets: {}
  27512. };
  27513. }
  27514. onDeclaration(declaration, dItem, dList, rule) {
  27515. const property = declaration.property;
  27516. if (property === "counter-increment") {
  27517. let inc = this.handleIncrement(declaration, rule);
  27518. if (inc) {
  27519. dList.remove(dItem);
  27520. }
  27521. }
  27522. }
  27523. afterParsed(_) {
  27524. for (const inc in this.pageCounter.increments) {
  27525. const increment = this.pageCounter.increments[inc];
  27526. this.insertRule(`${increment.selector} { --pagedjs-page-counter-increment: ${increment.number} }`);
  27527. }
  27528. }
  27529. handleIncrement(declaration, rule) {
  27530. const identifier = declaration.value.children.first();
  27531. const number = declaration.value.children.getSize() > 1 ? declaration.value.children.last().value : 1;
  27532. const name = identifier && identifier.name;
  27533. if (name && name.indexOf("target-counter-") === 0) {
  27534. return;
  27535. }
  27536. // A counter named page is automatically created and incremented by 1 on every page of the document,
  27537. // unless the counter-increment property in the page context explicitly specifies a different increment for the page counter.
  27538. // https://www.w3.org/TR/css-page-3/#page-based-counters
  27539. if (name !== "page") {
  27540. return;
  27541. }
  27542. // the counter-increment property is not defined on the page context (i.e. @page rule), ignoring...
  27543. if (rule.ruleNode.name === "page" && rule.ruleNode.type === "Atrule") {
  27544. return;
  27545. }
  27546. const selector = csstree.generate(rule.ruleNode.prelude);
  27547. return this.pageCounter.increments[selector] = {
  27548. selector: selector,
  27549. number
  27550. };
  27551. }
  27552. insertRule(rule) {
  27553. this.styleSheet.insertRule(rule, this.styleSheet.cssRules.length);
  27554. }
  27555. }
  27556. class NthOfType extends Handler {
  27557. constructor(chunker, polisher, caller) {
  27558. super(chunker, polisher, caller);
  27559. this.styleSheet = polisher.styleSheet;
  27560. this.selectors = {};
  27561. }
  27562. onRule(ruleNode, ruleItem, rulelist) {
  27563. let selector = csstree.generate(ruleNode.prelude);
  27564. if (selector.match(/:(first|last|nth)-of-type/)) {
  27565. let declarations = csstree.generate(ruleNode.block);
  27566. declarations = declarations.replace(/[{}]/g,"");
  27567. let uuid = "nth-of-type-" + UUID();
  27568. selector.split(",").forEach((s) => {
  27569. if (!this.selectors[s]) {
  27570. this.selectors[s] = [uuid, declarations];
  27571. } else {
  27572. this.selectors[s][1] = `${this.selectors[s][1]};${declarations}` ;
  27573. }
  27574. });
  27575. rulelist.remove(ruleItem);
  27576. }
  27577. }
  27578. afterParsed(parsed) {
  27579. this.processSelectors(parsed, this.selectors);
  27580. }
  27581. processSelectors(parsed, selectors) {
  27582. // add the new attributes to matching elements
  27583. for (let s in selectors) {
  27584. let elements = parsed.querySelectorAll(s);
  27585. for (var i = 0; i < elements.length; i++) {
  27586. let dataNthOfType = elements[i].getAttribute("data-nth-of-type");
  27587. if (dataNthOfType && dataNthOfType != "") {
  27588. dataNthOfType = `${dataNthOfType},${selectors[s][0]}`;
  27589. elements[i].setAttribute("data-nth-of-type", dataNthOfType);
  27590. } else {
  27591. elements[i].setAttribute("data-nth-of-type", selectors[s][0]);
  27592. }
  27593. }
  27594. let rule = `*[data-nth-of-type*='${selectors[s][0]}'] { ${selectors[s][1]}; }`;
  27595. this.styleSheet.insertRule(rule, this.styleSheet.cssRules.length);
  27596. }
  27597. }
  27598. }
  27599. class Following extends Handler {
  27600. constructor(chunker, polisher, caller) {
  27601. super(chunker, polisher, caller);
  27602. this.styleSheet = polisher.styleSheet;
  27603. this.selectors = {};
  27604. }
  27605. onRule(ruleNode, ruleItem, rulelist) {
  27606. let selector = csstree.generate(ruleNode.prelude);
  27607. if (selector.match(/\+/)) {
  27608. let declarations = csstree.generate(ruleNode.block);
  27609. declarations = declarations.replace(/[{}]/g,"");
  27610. let uuid = "following-" + UUID();
  27611. selector.split(",").forEach((s) => {
  27612. if (!this.selectors[s]) {
  27613. this.selectors[s] = [uuid, declarations];
  27614. } else {
  27615. this.selectors[s][1] = `${this.selectors[s][1]};${declarations}` ;
  27616. }
  27617. });
  27618. rulelist.remove(ruleItem);
  27619. }
  27620. }
  27621. afterParsed(parsed) {
  27622. this.processSelectors(parsed, this.selectors);
  27623. }
  27624. processSelectors(parsed, selectors) {
  27625. // add the new attributes to matching elements
  27626. for (let s in selectors) {
  27627. let elements = parsed.querySelectorAll(s);
  27628. for (var i = 0; i < elements.length; i++) {
  27629. let dataFollowing = elements[i].getAttribute("data-following");
  27630. if (dataFollowing && dataFollowing != "") {
  27631. dataFollowing = `${dataFollowing},${selectors[s][0]}`;
  27632. elements[i].setAttribute("data-following", dataFollowing);
  27633. } else {
  27634. elements[i].setAttribute("data-following", selectors[s][0]);
  27635. }
  27636. }
  27637. let rule = `*[data-following*='${selectors[s][0]}'] { ${selectors[s][1]}; }`;
  27638. this.styleSheet.insertRule(rule, this.styleSheet.cssRules.length);
  27639. }
  27640. }
  27641. }
  27642. class Footnotes extends Handler {
  27643. constructor(chunker, polisher, caller) {
  27644. super(chunker, polisher, caller);
  27645. this.footnotes = {};
  27646. this.needsLayout = [];
  27647. }
  27648. onDeclaration(declaration, dItem, dList, rule) {
  27649. let property = declaration.property;
  27650. if (property === "float") {
  27651. let identifier = declaration.value.children && declaration.value.children.first();
  27652. let location = identifier && identifier.name;
  27653. if (location === "footnote") {
  27654. let selector = csstree.generate(rule.ruleNode.prelude);
  27655. this.footnotes[selector] = {
  27656. selector: selector,
  27657. policy: "auto",
  27658. display: "block"
  27659. };
  27660. dList.remove(dItem);
  27661. }
  27662. }
  27663. if (property === "footnote-policy") {
  27664. let identifier = declaration.value.children && declaration.value.children.first();
  27665. let policy = identifier && identifier.name;
  27666. if (policy) {
  27667. let selector = csstree.generate(rule.ruleNode.prelude);
  27668. let note = this.footnotes[selector];
  27669. if (note) {
  27670. note.policy = policy;
  27671. }
  27672. }
  27673. }
  27674. if (property === "footnote-display") {
  27675. let identifier = declaration.value.children && declaration.value.children.first();
  27676. let display = identifier && identifier.name;
  27677. let selector = csstree.generate(rule.ruleNode.prelude);
  27678. if (display && this.footnotes[selector]) {
  27679. let note = this.footnotes[selector];
  27680. if (note) {
  27681. note.display = display;
  27682. }
  27683. }
  27684. }
  27685. }
  27686. onPseudoSelector(pseudoNode, pItem, pList, selector, rule) {
  27687. let name = pseudoNode.name;
  27688. if (name === "footnote-marker") {
  27689. // switch ::footnote-marker to [data-footnote-marker]::before
  27690. let prelude = rule.ruleNode.prelude;
  27691. let newPrelude = new csstree.List();
  27692. // Can't get remove to work, so just copying everything else
  27693. prelude.children.first().children.each((node) => {
  27694. if (node.type !== "PseudoElementSelector") {
  27695. newPrelude.appendData(node);
  27696. }
  27697. });
  27698. // Add our data call
  27699. newPrelude.appendData({
  27700. type: "AttributeSelector",
  27701. name: {
  27702. type: "Identifier",
  27703. name: "data-footnote-marker",
  27704. },
  27705. flags: null,
  27706. loc: null,
  27707. matcher: null,
  27708. value: null
  27709. });
  27710. // Add new pseudo element
  27711. newPrelude.appendData({
  27712. type: "PseudoElementSelector",
  27713. name: "marker",
  27714. loc: null,
  27715. children: null
  27716. });
  27717. prelude.children.first().children = newPrelude;
  27718. }
  27719. if (name === "footnote-call") {
  27720. // switch ::footnote-call to [data-footnote-call]::after
  27721. let prelude = rule.ruleNode.prelude;
  27722. let newPrelude = new csstree.List();
  27723. // Can't get remove to work, so just copying everything else
  27724. prelude.children.first().children.each((node) => {
  27725. if (node.type !== "PseudoElementSelector") {
  27726. newPrelude.appendData(node);
  27727. }
  27728. });
  27729. // Add our data call
  27730. newPrelude.appendData({
  27731. type: "AttributeSelector",
  27732. name: {
  27733. type: "Identifier",
  27734. name: "data-footnote-call",
  27735. },
  27736. flags: null,
  27737. loc: null,
  27738. matcher: null,
  27739. value: null
  27740. });
  27741. // Add new pseudo element
  27742. newPrelude.appendData({
  27743. type: "PseudoElementSelector",
  27744. name: "after",
  27745. loc: null,
  27746. children: null
  27747. });
  27748. prelude.children.first().children = newPrelude;
  27749. }
  27750. }
  27751. afterParsed(parsed) {
  27752. this.processFootnotes(parsed, this.footnotes);
  27753. }
  27754. processFootnotes(parsed, notes) {
  27755. for (let n in notes) {
  27756. // Find elements
  27757. let elements = parsed.querySelectorAll(n);
  27758. let element;
  27759. let note = notes[n];
  27760. for (var i = 0; i < elements.length; i++) {
  27761. element = elements[i];
  27762. // Add note type
  27763. element.setAttribute("data-note", "footnote");
  27764. element.setAttribute("data-break-before", "avoid");
  27765. element.setAttribute("data-note-policy", note.policy || "auto");
  27766. element.setAttribute("data-note-display", note.display || "block");
  27767. // Mark all parents
  27768. this.processFootnoteContainer(element);
  27769. }
  27770. }
  27771. }
  27772. processFootnoteContainer(node) {
  27773. // Find the container
  27774. let element = node.parentElement;
  27775. let prevElement = element;
  27776. // Walk up the dom until we find a container element
  27777. while (element) {
  27778. if (isContainer(element)) {
  27779. // Add flag to the previous non-container element that will render with children
  27780. prevElement.setAttribute("data-has-notes", "true");
  27781. break;
  27782. }
  27783. prevElement = element;
  27784. element = element.parentElement;
  27785. // If no containers were found and there are no further parents flag the last element
  27786. if (!element) {
  27787. prevElement.setAttribute("data-has-notes", "true");
  27788. }
  27789. }
  27790. }
  27791. renderNode(node) {
  27792. if (node.nodeType == 1) {
  27793. // Get all notes
  27794. let notes;
  27795. // Ingnore html element nodes, like mathml
  27796. if (!node.dataset) {
  27797. return;
  27798. }
  27799. if (node.dataset.note === "footnote") {
  27800. notes = [node];
  27801. } else if (node.dataset.hasNotes || node.querySelectorAll("[data-note='footnote']")) {
  27802. notes = node.querySelectorAll("[data-note='footnote']");
  27803. }
  27804. if (notes && notes.length) {
  27805. this.findVisibleFootnotes(notes, node);
  27806. }
  27807. }
  27808. }
  27809. findVisibleFootnotes(notes, node) {
  27810. let area, size, right;
  27811. area = node.closest(".pagedjs_page_content");
  27812. size = area.getBoundingClientRect();
  27813. right = size.left + size.width;
  27814. for (let i = 0; i < notes.length; ++i) {
  27815. let currentNote = notes[i];
  27816. let bounds = currentNote.getBoundingClientRect();
  27817. let left = bounds.left;
  27818. if (left < right) {
  27819. // Add call for the note
  27820. this.moveFootnote(currentNote, node.closest(".pagedjs_area"), true);
  27821. }
  27822. }
  27823. }
  27824. moveFootnote(node, pageArea, needsNoteCall) {
  27825. // let pageArea = node.closest(".pagedjs_area");
  27826. let noteArea = pageArea.querySelector(".pagedjs_footnote_area");
  27827. let noteContent = noteArea.querySelector(".pagedjs_footnote_content");
  27828. let noteInnerContent = noteContent.querySelector(".pagedjs_footnote_inner_content");
  27829. if (!isElement(node)) {
  27830. return;
  27831. }
  27832. // Add call for the note
  27833. let noteCall;
  27834. if (needsNoteCall) {
  27835. noteCall = this.createFootnoteCall(node);
  27836. }
  27837. // Remove the break before attribute for future layout
  27838. node.removeAttribute("data-break-before");
  27839. // Check if note already exists for overflow
  27840. let existing = noteInnerContent.querySelector(`[data-ref="${node.dataset.ref}"]`);
  27841. if (existing) {
  27842. // Remove the note from the flow but no need to render it again
  27843. node.remove();
  27844. return;
  27845. }
  27846. // Add the note node
  27847. noteInnerContent.appendChild(node);
  27848. // Remove empty class
  27849. if (noteContent.classList.contains("pagedjs_footnote_empty")) {
  27850. noteContent.classList.remove("pagedjs_footnote_empty");
  27851. }
  27852. // Add marker
  27853. node.dataset.footnoteMarker = node.dataset.ref;
  27854. // Add Id
  27855. node.id = `note-${node.dataset.ref}`;
  27856. // Get note content size
  27857. let height = noteContent.scrollHeight;
  27858. // Check the noteCall is still on screen
  27859. let area = pageArea.querySelector(".pagedjs_page_content");
  27860. let size = area.getBoundingClientRect();
  27861. let right = size.left + size.width;
  27862. // TODO: add a max height in CSS
  27863. // Check element sizes
  27864. let noteCallBounds = noteCall && noteCall.getBoundingClientRect();
  27865. let noteAreaBounds = noteArea.getBoundingClientRect();
  27866. // Get the @footnote margins
  27867. let noteContentMargins = this.marginsHeight(noteContent);
  27868. let noteContentPadding = this.paddingHeight(noteContent);
  27869. let noteContentBorders = this.borderHeight(noteContent);
  27870. let total = noteContentMargins + noteContentPadding + noteContentBorders;
  27871. // Get the top of the @footnote area
  27872. let notAreaTop = Math.floor(noteAreaBounds.top);
  27873. // If the height isn't set yet, remove the margins from the top
  27874. if (noteAreaBounds.height === 0) {
  27875. notAreaTop -= this.marginsHeight(noteContent, false);
  27876. notAreaTop -= this.paddingHeight(noteContent, false);
  27877. notAreaTop -= this.borderHeight(noteContent, false);
  27878. }
  27879. // Determine the note call position and offset per policy
  27880. let notePolicy = node.dataset.notePolicy;
  27881. let noteCallPosition = 0;
  27882. let noteCallOffset = 0;
  27883. if (noteCall) {
  27884. // Get the correct line bottom for super or sub styled callouts
  27885. let prevSibling = noteCall.previousSibling;
  27886. let range = new Range();
  27887. if (prevSibling) {
  27888. range.setStartBefore(prevSibling);
  27889. } else {
  27890. range.setStartBefore(noteCall);
  27891. }
  27892. range.setEndAfter(noteCall);
  27893. let rangeBounds = range.getBoundingClientRect();
  27894. noteCallPosition = rangeBounds.bottom;
  27895. if (!notePolicy || notePolicy === "auto") {
  27896. noteCallOffset = Math.ceil(rangeBounds.bottom);
  27897. } else if (notePolicy === "line") {
  27898. noteCallOffset = Math.ceil(rangeBounds.top);
  27899. } else if (notePolicy === "block") {
  27900. // Check that there is a previous element on the page
  27901. let parentParagraph = noteCall.closest("p").previousElementSibling;
  27902. if (parentParagraph) {
  27903. noteCallOffset = Math.ceil(
  27904. parentParagraph.getBoundingClientRect().bottom
  27905. );
  27906. } else {
  27907. noteCallOffset = Math.ceil(rangeBounds.bottom);
  27908. }
  27909. }
  27910. }
  27911. let contentDelta = height + total - noteAreaBounds.height;
  27912. // Space between the top of the footnotes area and the bottom of the footnote call
  27913. let noteDelta = noteCallPosition ? notAreaTop - noteCallPosition : 0;
  27914. // Space needed for the force a break for the policy of the footnote
  27915. let notePolicyDelta = noteCallPosition ? Math.floor(noteAreaBounds.top) - noteCallOffset : 0;
  27916. let hasNotes = noteArea.querySelector("[data-note='footnote']");
  27917. if (needsNoteCall && noteCallBounds.left > right) {
  27918. // Note is offscreen and will be chunked to the next page on overflow
  27919. node.remove();
  27920. } else if (!hasNotes && needsNoteCall && total > noteDelta) {
  27921. // No space to add even the footnote area
  27922. pageArea.style.setProperty("--pagedjs-footnotes-height", "0px");
  27923. // Add a wrapper as this div is removed later
  27924. let wrapperDiv = document.createElement("div");
  27925. wrapperDiv.appendChild(node);
  27926. // Push to the layout queue for the next page
  27927. this.needsLayout.push(wrapperDiv);
  27928. } else if (!needsNoteCall) {
  27929. // Call was previously added, force adding footnote
  27930. pageArea.style.setProperty(
  27931. "--pagedjs-footnotes-height",
  27932. `${height + total}px`
  27933. );
  27934. } else if (noteCallPosition < noteAreaBounds.top - contentDelta) {
  27935. // the current note content will fit without pushing the call to the next page
  27936. pageArea.style.setProperty(
  27937. "--pagedjs-footnotes-height",
  27938. `${height + noteContentMargins + noteContentBorders}px`
  27939. );
  27940. } else {
  27941. // set height to just before note call
  27942. pageArea.style.setProperty(
  27943. "--pagedjs-footnotes-height",
  27944. `${noteAreaBounds.height + notePolicyDelta}px`
  27945. );
  27946. noteInnerContent.style.height =
  27947. noteAreaBounds.height + notePolicyDelta - total + "px";
  27948. }
  27949. }
  27950. createFootnoteCall(node) {
  27951. let parentElement = node.parentElement;
  27952. let footnoteCall = document.createElement("a");
  27953. for (const className of node.classList) {
  27954. footnoteCall.classList.add(`${className}`);
  27955. }
  27956. footnoteCall.dataset.footnoteCall = node.dataset.ref;
  27957. footnoteCall.dataset.ref = node.dataset.ref;
  27958. // Increment for counters
  27959. footnoteCall.dataset.dataCounterFootnoteIncrement = 1;
  27960. // Add link
  27961. footnoteCall.href = `#note-${node.dataset.ref}`;
  27962. parentElement.insertBefore(footnoteCall, node);
  27963. return footnoteCall;
  27964. }
  27965. afterPageLayout(pageElement, page, breakToken, chunker) {
  27966. let pageArea = pageElement.querySelector(".pagedjs_area");
  27967. let noteArea = page.footnotesArea;
  27968. let noteContent = noteArea.querySelector(".pagedjs_footnote_content");
  27969. let noteInnerContent = noteArea.querySelector(".pagedjs_footnote_inner_content");
  27970. let noteContentBounds = noteContent.getBoundingClientRect();
  27971. let { width } = noteContentBounds;
  27972. noteInnerContent.style.columnWidth = Math.round(width) + "px";
  27973. noteInnerContent.style.columnGap = "calc(var(--pagedjs-margin-right) + var(--pagedjs-margin-left))";
  27974. // Get overflow
  27975. let layout = new Layout(noteArea, undefined, chunker.settings);
  27976. let overflow = layout.findOverflow(noteInnerContent, noteContentBounds);
  27977. if (overflow) {
  27978. let { startContainer, startOffset } = overflow;
  27979. let startIsNode;
  27980. if (isElement(startContainer)) {
  27981. let start = startContainer.childNodes[startOffset];
  27982. startIsNode = isElement(start) && start.hasAttribute("data-footnote-marker");
  27983. }
  27984. let extracted = overflow.extractContents();
  27985. if (!startIsNode) {
  27986. let splitChild = extracted.firstElementChild;
  27987. splitChild.dataset.splitFrom = splitChild.dataset.ref;
  27988. this.handleAlignment(noteInnerContent.lastElementChild);
  27989. }
  27990. this.needsLayout.push(extracted);
  27991. noteContent.style.removeProperty("height");
  27992. noteInnerContent.style.removeProperty("height");
  27993. let noteInnerContentBounds = noteInnerContent.getBoundingClientRect();
  27994. let { height } = noteInnerContentBounds;
  27995. // Get the @footnote margins
  27996. let noteContentMargins = this.marginsHeight(noteContent);
  27997. let noteContentPadding = this.paddingHeight(noteContent);
  27998. let noteContentBorders = this.borderHeight(noteContent);
  27999. pageArea.style.setProperty(
  28000. "--pagedjs-footnotes-height",
  28001. `${height + noteContentMargins + noteContentBorders + noteContentPadding}px`
  28002. );
  28003. // Hide footnote content if empty
  28004. if (noteInnerContent.childNodes.length === 0) {
  28005. noteContent.classList.add("pagedjs_footnote_empty");
  28006. }
  28007. if (!breakToken) {
  28008. chunker.clonePage(page);
  28009. } else {
  28010. let breakBefore, previousBreakAfter;
  28011. if (
  28012. breakToken.node &&
  28013. typeof breakToken.node.dataset !== "undefined" &&
  28014. typeof breakToken.node.dataset.previousBreakAfter !== "undefined"
  28015. ) {
  28016. previousBreakAfter = breakToken.node.dataset.previousBreakAfter;
  28017. }
  28018. if (
  28019. breakToken.node &&
  28020. typeof breakToken.node.dataset !== "undefined" &&
  28021. typeof breakToken.node.dataset.breakBefore !== "undefined"
  28022. ) {
  28023. breakBefore = breakToken.node.dataset.breakBefore;
  28024. }
  28025. if (breakBefore || previousBreakAfter) {
  28026. chunker.clonePage(page);
  28027. }
  28028. }
  28029. }
  28030. noteInnerContent.style.height = "auto";
  28031. }
  28032. handleAlignment(node) {
  28033. let styles = window.getComputedStyle(node);
  28034. let alignLast = styles["text-align-last"];
  28035. node.dataset.lastSplitElement = "true";
  28036. if (alignLast === "auto") {
  28037. node.dataset.alignLastSplitElement = "justify";
  28038. } else {
  28039. node.dataset.alignLastSplitElement = alignLast;
  28040. }
  28041. }
  28042. beforePageLayout(page) {
  28043. while (this.needsLayout.length) {
  28044. let fragment = this.needsLayout.shift();
  28045. Array.from(fragment.childNodes).forEach((node) => {
  28046. this.moveFootnote(
  28047. node,
  28048. page.element.querySelector(".pagedjs_area"),
  28049. false
  28050. );
  28051. });
  28052. }
  28053. }
  28054. afterOverflowRemoved(removed, rendered) {
  28055. // Find the page area
  28056. let area = rendered.closest(".pagedjs_area");
  28057. // Get any rendered footnotes
  28058. let notes = area.querySelectorAll(".pagedjs_footnote_area [data-note='footnote']");
  28059. for (let n = 0; n < notes.length; n++) {
  28060. const note = notes[n];
  28061. // Check if the call for that footnote has been removed with the overflow
  28062. let call = removed.querySelector(`[data-footnote-call="${note.dataset.ref}"]`);
  28063. if (call) {
  28064. note.remove();
  28065. }
  28066. }
  28067. // Hide footnote content if empty
  28068. let noteInnerContent = area.querySelector(".pagedjs_footnote_inner_content");
  28069. if (noteInnerContent && noteInnerContent.childNodes.length === 0) {
  28070. noteInnerContent.parentElement.classList.add("pagedjs_footnote_empty");
  28071. }
  28072. }
  28073. marginsHeight(element, total=true) {
  28074. let styles = window.getComputedStyle(element);
  28075. let marginTop = parseInt(styles.marginTop);
  28076. let marginBottom = parseInt(styles.marginBottom);
  28077. let margin = 0;
  28078. if (marginTop) {
  28079. margin += marginTop;
  28080. }
  28081. if (marginBottom && total) {
  28082. margin += marginBottom;
  28083. }
  28084. return margin;
  28085. }
  28086. paddingHeight(element, total=true) {
  28087. let styles = window.getComputedStyle(element);
  28088. let paddingTop = parseInt(styles.paddingTop);
  28089. let paddingBottom = parseInt(styles.paddingBottom);
  28090. let padding = 0;
  28091. if (paddingTop) {
  28092. padding += paddingTop;
  28093. }
  28094. if (paddingBottom && total) {
  28095. padding += paddingBottom;
  28096. }
  28097. return padding;
  28098. }
  28099. borderHeight(element, total=true) {
  28100. let styles = window.getComputedStyle(element);
  28101. let borderTop = parseInt(styles.borderTop);
  28102. let borderBottom = parseInt(styles.borderBottom);
  28103. let borders = 0;
  28104. if (borderTop) {
  28105. borders += borderTop;
  28106. }
  28107. if (borderBottom && total) {
  28108. borders += borderBottom;
  28109. }
  28110. return borders;
  28111. }
  28112. }
  28113. var pagedMediaHandlers = [
  28114. PrintMedia,
  28115. AtPage,
  28116. Breaks,
  28117. Splits,
  28118. Counters,
  28119. Lists,
  28120. PositionFixed,
  28121. PageCounterIncrement,
  28122. NthOfType,
  28123. Following,
  28124. Footnotes
  28125. ];
  28126. class RunningHeaders extends Handler {
  28127. constructor(chunker, polisher, caller) {
  28128. super(chunker, polisher, caller);
  28129. this.runningSelectors = {};
  28130. this.elements = {};
  28131. }
  28132. onDeclaration(declaration, dItem, dList, rule) {
  28133. if (declaration.property === "position") {
  28134. let selector = csstree.generate(rule.ruleNode.prelude);
  28135. let identifier = declaration.value.children.first().name;
  28136. if (identifier === "running") {
  28137. let value;
  28138. csstree.walk(declaration, {
  28139. visit: "Function",
  28140. enter: (node, item, list) => {
  28141. value = node.children.first().name;
  28142. }
  28143. });
  28144. this.runningSelectors[value] = {
  28145. identifier: identifier,
  28146. value: value,
  28147. selector: selector
  28148. };
  28149. }
  28150. }
  28151. if (declaration.property === "content") {
  28152. csstree.walk(declaration, {
  28153. visit: "Function",
  28154. enter: (funcNode, fItem, fList) => {
  28155. if (funcNode.name.indexOf("element") > -1) {
  28156. let selector = csstree.generate(rule.ruleNode.prelude);
  28157. let func = funcNode.name;
  28158. let value = funcNode.children.first().name;
  28159. let args = [value];
  28160. // we only handle first for now
  28161. let style = "first";
  28162. selector.split(",").forEach((s) => {
  28163. // remove before / after
  28164. s = s.replace(/::after|::before/, "");
  28165. this.elements[s] = {
  28166. func: func,
  28167. args: args,
  28168. value: value,
  28169. style: style ,
  28170. selector: s,
  28171. fullSelector: selector
  28172. };
  28173. });
  28174. }
  28175. }
  28176. });
  28177. }
  28178. }
  28179. afterParsed(fragment) {
  28180. for (let name of Object.keys(this.runningSelectors)) {
  28181. let set = this.runningSelectors[name];
  28182. let selected = Array.from(fragment.querySelectorAll(set.selector));
  28183. if (set.identifier === "running") {
  28184. for (let header of selected) {
  28185. header.style.display = "none";
  28186. }
  28187. }
  28188. }
  28189. }
  28190. afterPageLayout(fragment) {
  28191. for (let name of Object.keys(this.runningSelectors)) {
  28192. let set = this.runningSelectors[name];
  28193. let selected = fragment.querySelector(set.selector);
  28194. if (selected) {
  28195. // let cssVar;
  28196. if (set.identifier === "running") {
  28197. // cssVar = selected.textContent.replace(/\\([\s\S])|(["|'])/g,"\\$1$2");
  28198. // this.styleSheet.insertRule(`:root { --string-${name}: "${cssVar}"; }`, this.styleSheet.cssRules.length);
  28199. // fragment.style.setProperty(`--string-${name}`, `"${cssVar}"`);
  28200. set.first = selected;
  28201. } else {
  28202. console.warn(set.value + "needs css replacement");
  28203. }
  28204. }
  28205. }
  28206. // move elements
  28207. if (!this.orderedSelectors) {
  28208. this.orderedSelectors = this.orderSelectors(this.elements);
  28209. }
  28210. for (let selector of this.orderedSelectors) {
  28211. if (selector) {
  28212. let el = this.elements[selector];
  28213. let selected = fragment.querySelector(selector);
  28214. if (selected) {
  28215. let running = this.runningSelectors[el.args[0]];
  28216. if (running && running.first) {
  28217. selected.innerHTML = ""; // Clear node
  28218. // selected.classList.add("pagedjs_clear-after"); // Clear ::after
  28219. let clone = running.first.cloneNode(true);
  28220. clone.style.display = null;
  28221. selected.appendChild(clone);
  28222. }
  28223. }
  28224. }
  28225. }
  28226. }
  28227. /**
  28228. * Assign a weight to @page selector classes
  28229. * 1) page
  28230. * 2) left & right
  28231. * 3) blank
  28232. * 4) first & nth
  28233. * 5) named page
  28234. * 6) named left & right
  28235. * 7) named first & nth
  28236. * @param {string} [s] selector string
  28237. * @return {int} weight
  28238. */
  28239. pageWeight(s) {
  28240. let weight = 1;
  28241. let selector = s.split(" ");
  28242. let parts = selector.length && selector[0].split(".");
  28243. parts.shift(); // remove empty first part
  28244. switch (parts.length) {
  28245. case 4:
  28246. if (/^pagedjs_[\w-]+_first_page$/.test(parts[3])) {
  28247. weight = 7;
  28248. } else if (parts[3] === "pagedjs_left_page" || parts[3] === "pagedjs_right_page") {
  28249. weight = 6;
  28250. }
  28251. break;
  28252. case 3:
  28253. if (parts[1] === "pagedjs_named_page") {
  28254. if (parts[2].indexOf(":nth-of-type") > -1) {
  28255. weight = 7;
  28256. } else {
  28257. weight = 5;
  28258. }
  28259. }
  28260. break;
  28261. case 2:
  28262. if (parts[1] === "pagedjs_first_page") {
  28263. weight = 4;
  28264. } else if (parts[1] === "pagedjs_blank_page") {
  28265. weight = 3;
  28266. } else if (parts[1] === "pagedjs_left_page" || parts[1] === "pagedjs_right_page") {
  28267. weight = 2;
  28268. }
  28269. break;
  28270. default:
  28271. if (parts[0].indexOf(":nth-of-type") > -1) {
  28272. weight = 4;
  28273. } else {
  28274. weight = 1;
  28275. }
  28276. }
  28277. return weight;
  28278. }
  28279. /**
  28280. * Orders the selectors based on weight
  28281. *
  28282. * Does not try to deduplicate base on specifity of the selector
  28283. * Previous matched selector will just be overwritten
  28284. * @param {obj} [obj] selectors object
  28285. * @return {Array} orderedSelectors
  28286. */
  28287. orderSelectors(obj) {
  28288. let selectors = Object.keys(obj);
  28289. let weighted = {
  28290. 1: [],
  28291. 2: [],
  28292. 3: [],
  28293. 4: [],
  28294. 5: [],
  28295. 6: [],
  28296. 7: []
  28297. };
  28298. let orderedSelectors = [];
  28299. for (let s of selectors) {
  28300. let w = this.pageWeight(s);
  28301. weighted[w].unshift(s);
  28302. }
  28303. for (var i = 1; i <= 7; i++) {
  28304. orderedSelectors = orderedSelectors.concat(weighted[i]);
  28305. }
  28306. return orderedSelectors;
  28307. }
  28308. beforeTreeParse(text, sheet) {
  28309. // element(x) is parsed as image element selector, so update element to element-ident
  28310. sheet.text = text.replace(/element[\s]*\(([^|^#)]*)\)/g, "element-ident($1)");
  28311. }
  28312. }
  28313. function cleanPseudoContent(el, trim = "\"' ") {
  28314. if(el == null) return;
  28315. return el
  28316. .replace(new RegExp(`^[${trim}]+`), "")
  28317. .replace(new RegExp(`[${trim}]+$`), "")
  28318. .replace(/["']/g, match => {
  28319. return "\\" + match;
  28320. })
  28321. .replace(/[\n]/g, match => {
  28322. return "\\00000A";
  28323. });
  28324. }
  28325. function cleanSelector(el) {
  28326. if(el == null) return;
  28327. return el
  28328. .replace(new RegExp("::footnote-call", "g"), "")
  28329. .replace(new RegExp("::footnote-marker", "g"), "");
  28330. }
  28331. class StringSets extends Handler {
  28332. constructor(chunker, polisher, caller) {
  28333. super(chunker, polisher, caller);
  28334. this.stringSetSelectors = {};
  28335. this.type;
  28336. // pageLastString = last string variable defined on the page
  28337. this.pageLastString;
  28338. }
  28339. onDeclaration(declaration, dItem, dList, rule) {
  28340. if (declaration.property === "string-set") {
  28341. let selector = csstree.generate(rule.ruleNode.prelude);
  28342. let identifiers = [];
  28343. let functions = [];
  28344. let values = [];
  28345. declaration.value.children.forEach((child) => {
  28346. if (child.type === "Identifier") {
  28347. identifiers.push(child.name);
  28348. }
  28349. if (child.type === "Function") {
  28350. functions.push(child.name);
  28351. child.children.forEach((subchild) => {
  28352. if (subchild.type === "Identifier") {
  28353. values.push(subchild.name);
  28354. }
  28355. });
  28356. }
  28357. });
  28358. identifiers.forEach((identifier, index) => {
  28359. let func = functions[index];
  28360. let value = values[index];
  28361. this.stringSetSelectors[identifier] = {
  28362. identifier,
  28363. func,
  28364. value,
  28365. selector
  28366. };
  28367. });
  28368. }
  28369. }
  28370. onContent(funcNode, fItem, fList, declaration, rule) {
  28371. if (funcNode.name === "string") {
  28372. let identifier = funcNode.children && funcNode.children.first().name;
  28373. this.type = funcNode.children.last().name;
  28374. funcNode.name = "var";
  28375. funcNode.children = new csstree.List();
  28376. if(this.type === "first" || this.type === "last" || this.type === "start" || this.type === "first-except"){
  28377. funcNode.children.append(
  28378. funcNode.children.createItem({
  28379. type: "Identifier",
  28380. loc: null,
  28381. name: "--pagedjs-string-" + this.type + "-" + identifier
  28382. })
  28383. );
  28384. }else {
  28385. funcNode.children.append(
  28386. funcNode.children.createItem({
  28387. type: "Identifier",
  28388. loc: null,
  28389. name: "--pagedjs-string-first-" + identifier
  28390. })
  28391. );
  28392. }
  28393. }
  28394. }
  28395. afterPageLayout(fragment) {
  28396. if ( this.pageLastString === undefined )
  28397. {
  28398. this.pageLastString = {};
  28399. }
  28400. for (let name of Object.keys(this.stringSetSelectors)) {
  28401. let set = this.stringSetSelectors[name];
  28402. let value = set.value;
  28403. let func = set.func;
  28404. let selected = fragment.querySelectorAll(set.selector);
  28405. // Get the last found string for the current identifier
  28406. let stringPrevPage = ( name in this.pageLastString ) ? this.pageLastString[name] : "";
  28407. let varFirst, varLast, varStart, varFirstExcept;
  28408. if(selected.length == 0){
  28409. // if there is no sel. on the page
  28410. varFirst = stringPrevPage;
  28411. varLast = stringPrevPage;
  28412. varStart = stringPrevPage;
  28413. varFirstExcept = stringPrevPage;
  28414. }else {
  28415. selected.forEach((sel) => {
  28416. // push each content into the array to define in the variable the first and the last element of the page.
  28417. if (func === "content") {
  28418. this.pageLastString[name] = selected[selected.length - 1].textContent;
  28419. }
  28420. if (func === "attr") {
  28421. this.pageLastString[name] = selected[selected.length - 1].getAttribute(value) || "";
  28422. }
  28423. });
  28424. /* FIRST */
  28425. if (func === "content") {
  28426. varFirst = selected[0].textContent;
  28427. }
  28428. if (func === "attr") {
  28429. varFirst = selected[0].getAttribute(value) || "";
  28430. }
  28431. /* LAST */
  28432. if (func === "content") {
  28433. varLast = selected[selected.length - 1].textContent;
  28434. }
  28435. if (func === "attr") {
  28436. varLast = selected[selected.length - 1].getAttribute(value) || "";
  28437. }
  28438. /* START */
  28439. // Hack to find if the sel. is the first elem of the page / find a better way
  28440. let selTop = selected[0].getBoundingClientRect().top;
  28441. let pageContent = selected[0].closest(".pagedjs_page_content");
  28442. let pageContentTop = pageContent.getBoundingClientRect().top;
  28443. if(selTop == pageContentTop){
  28444. varStart = varFirst;
  28445. }else {
  28446. varStart = stringPrevPage;
  28447. }
  28448. /* FIRST EXCEPT */
  28449. varFirstExcept = "";
  28450. }
  28451. fragment.style.setProperty(`--pagedjs-string-first-${name}`, `"${cleanPseudoContent(varFirst)}`);
  28452. fragment.style.setProperty(`--pagedjs-string-last-${name}`, `"${cleanPseudoContent(varLast)}`);
  28453. fragment.style.setProperty(`--pagedjs-string-start-${name}`, `"${cleanPseudoContent(varStart)}`);
  28454. fragment.style.setProperty(`--pagedjs-string-first-except-${name}`, `"${cleanPseudoContent(varFirstExcept)}`);
  28455. }
  28456. }
  28457. }
  28458. class TargetCounters extends Handler {
  28459. constructor(chunker, polisher, caller) {
  28460. super(chunker, polisher, caller);
  28461. this.styleSheet = polisher.styleSheet;
  28462. this.counterTargets = {};
  28463. }
  28464. onContent(funcNode, fItem, fList, declaration, rule) {
  28465. if (funcNode.name === "target-counter") {
  28466. let selector = csstree.generate(rule.ruleNode.prelude);
  28467. let first = funcNode.children.first();
  28468. let func = first.name;
  28469. let value = csstree.generate(funcNode);
  28470. let args = [];
  28471. first.children.forEach((child) => {
  28472. if (child.type === "Identifier") {
  28473. args.push(child.name);
  28474. }
  28475. });
  28476. let counter;
  28477. let style;
  28478. let styleIdentifier;
  28479. funcNode.children.forEach((child) => {
  28480. if (child.type === "Identifier") {
  28481. if (!counter) {
  28482. counter = child.name;
  28483. } else if (!style) {
  28484. styleIdentifier = csstree.clone(child);
  28485. style = child.name;
  28486. }
  28487. }
  28488. });
  28489. let variable = "target-counter-" + UUID();
  28490. selector.split(",").forEach((s) => {
  28491. this.counterTargets[s] = {
  28492. func: func,
  28493. args: args,
  28494. value: value,
  28495. counter: counter,
  28496. style: style,
  28497. selector: s,
  28498. fullSelector: selector,
  28499. variable: variable
  28500. };
  28501. });
  28502. // Replace with counter
  28503. funcNode.name = "counter";
  28504. funcNode.children = new csstree.List();
  28505. funcNode.children.appendData({
  28506. type: "Identifier",
  28507. loc: 0,
  28508. name: variable
  28509. });
  28510. if (styleIdentifier) {
  28511. funcNode.children.appendData({type: "Operator", loc: null, value: ","});
  28512. funcNode.children.appendData(styleIdentifier);
  28513. }
  28514. }
  28515. }
  28516. afterPageLayout(fragment, page, breakToken, chunker) {
  28517. Object.keys(this.counterTargets).forEach((name) => {
  28518. let target = this.counterTargets[name];
  28519. let split = target.selector.split(/::?/g);
  28520. let query = split[0];
  28521. let queried = chunker.pagesArea.querySelectorAll(query + ":not([data-" + target.variable + "])");
  28522. queried.forEach((selected, index) => {
  28523. // TODO: handle func other than attr
  28524. if (target.func !== "attr") {
  28525. return;
  28526. }
  28527. let val = attr(selected, target.args);
  28528. let element = chunker.pagesArea.querySelector(querySelectorEscape(val));
  28529. if (element) {
  28530. let selector = UUID();
  28531. selected.setAttribute("data-" + target.variable, selector);
  28532. // TODO: handle other counter types (by query)
  28533. let pseudo = "";
  28534. if (split.length > 1) {
  28535. pseudo += "::" + split[1];
  28536. }
  28537. if (target.counter === "page") {
  28538. let pages = chunker.pagesArea.querySelectorAll(".pagedjs_page");
  28539. let pg = 0;
  28540. for (let i = 0; i < pages.length; i++) {
  28541. let page = pages[i];
  28542. let styles = window.getComputedStyle(page);
  28543. let reset = styles["counter-reset"].replace("page", "").trim();
  28544. let increment = styles["counter-increment"].replace("page", "").trim();
  28545. if (reset !== "none") {
  28546. pg = parseInt(reset);
  28547. }
  28548. if (increment !== "none") {
  28549. pg += parseInt(increment);
  28550. }
  28551. if (page.contains(element)){
  28552. break;
  28553. }
  28554. }
  28555. this.styleSheet.insertRule(`[data-${target.variable}="${selector}"]${pseudo} { counter-reset: ${target.variable} ${pg}; }`, this.styleSheet.cssRules.length);
  28556. } else {
  28557. let value = element.getAttribute(`data-counter-${target.counter}-value`);
  28558. if (value) {
  28559. this.styleSheet.insertRule(`[data-${target.variable}="${selector}"]${pseudo} { counter-reset: ${target.variable} ${target.variable} ${parseInt(value)}; }`, this.styleSheet.cssRules.length);
  28560. }
  28561. }
  28562. // force redraw
  28563. let el = document.querySelector(`[data-${target.variable}="${selector}"]`);
  28564. if (el) {
  28565. el.style.display = "none";
  28566. el.clientHeight;
  28567. el.style.removeProperty("display");
  28568. }
  28569. }
  28570. });
  28571. });
  28572. }
  28573. }
  28574. // import { nodeAfter } from "../../utils/dom";
  28575. class TargetText extends Handler {
  28576. constructor(chunker, polisher, caller) {
  28577. super(chunker, polisher, caller);
  28578. this.styleSheet = polisher.styleSheet;
  28579. this.textTargets = {};
  28580. this.beforeContent = "";
  28581. this.afterContent = "";
  28582. this.selector = {};
  28583. }
  28584. onContent(funcNode, fItem, fList, declaration, rule) {
  28585. if (funcNode.name === "target-text") {
  28586. this.selector = csstree.generate(rule.ruleNode.prelude);
  28587. let first = funcNode.children.first();
  28588. let last = funcNode.children.last();
  28589. let func = first.name;
  28590. let value = csstree.generate(funcNode);
  28591. let args = [];
  28592. first.children.forEach(child => {
  28593. if (child.type === "Identifier") {
  28594. args.push(child.name);
  28595. }
  28596. });
  28597. let style;
  28598. if (last !== first) {
  28599. style = last.name;
  28600. }
  28601. let variable = "--pagedjs-" + UUID();
  28602. this.selector.split(",").forEach(s => {
  28603. this.textTargets[s] = {
  28604. func: func,
  28605. args: args,
  28606. value: value,
  28607. style: style || "content",
  28608. selector: s,
  28609. fullSelector: this.selector,
  28610. variable: variable
  28611. };
  28612. });
  28613. // Replace with variable
  28614. funcNode.name = "var";
  28615. funcNode.children = new csstree.List();
  28616. funcNode.children.appendData({
  28617. type: "Identifier",
  28618. loc: 0,
  28619. name: variable
  28620. });
  28621. }
  28622. }
  28623. // parse this on the ONCONTENT : get all before and after and replace the value with a variable
  28624. onPseudoSelector(pseudoNode, pItem, pList, selector, rule) {
  28625. // console.log(pseudoNode);
  28626. // console.log(rule);
  28627. rule.ruleNode.block.children.forEach(properties => {
  28628. if (pseudoNode.name === "before" && properties.property === "content") {
  28629. // let beforeVariable = "--pagedjs-" + UUID();
  28630. let contenu = properties.value.children;
  28631. contenu.forEach(prop => {
  28632. if (prop.type === "String") {
  28633. this.beforeContent = prop.value;
  28634. }
  28635. });
  28636. } else if (pseudoNode.name === "after" && properties.property === "content") {
  28637. properties.value.children.forEach(prop => {
  28638. if (prop.type === "String") {
  28639. this.afterContent = prop.value;
  28640. }
  28641. });
  28642. }
  28643. });
  28644. }
  28645. afterParsed(fragment) {
  28646. Object.keys(this.textTargets).forEach(name => {
  28647. let target = this.textTargets[name];
  28648. let split = target.selector.split("::");
  28649. let query = split[0];
  28650. let queried = fragment.querySelectorAll(query);
  28651. let textContent;
  28652. queried.forEach((selected, index) => {
  28653. let val = attr(selected, target.args);
  28654. let element = fragment.querySelector(querySelectorEscape(val));
  28655. if (element) {
  28656. // content & first-letter & before & after refactorized
  28657. if (target.style) {
  28658. this.selector = UUID();
  28659. selected.setAttribute("data-target-text", this.selector);
  28660. let psuedo = "";
  28661. if (split.length > 1) {
  28662. psuedo += "::" + split[1];
  28663. }
  28664. if (target.style === "before" || target.style === "after") {
  28665. const pseudoType = `${target.style}Content`;
  28666. textContent = cleanPseudoContent(this[pseudoType]);
  28667. } else {
  28668. textContent = cleanPseudoContent(element.textContent, " ");
  28669. }
  28670. textContent = target.style === "first-letter" ? textContent.charAt(0) : textContent;
  28671. this.styleSheet.insertRule(`[data-target-text="${this.selector}"]${psuedo} { ${target.variable}: "${textContent}" }`);
  28672. } else {
  28673. console.warn("missed target", val);
  28674. }
  28675. }
  28676. });
  28677. });
  28678. }
  28679. }
  28680. var generatedContentHandlers = [
  28681. RunningHeaders,
  28682. StringSets,
  28683. TargetCounters,
  28684. TargetText
  28685. ];
  28686. class WhiteSpaceFilter extends Handler {
  28687. constructor(chunker, polisher, caller) {
  28688. super(chunker, polisher, caller);
  28689. }
  28690. filter(content) {
  28691. filterTree(content, (node) => {
  28692. return this.filterEmpty(node);
  28693. }, NodeFilter.SHOW_TEXT);
  28694. }
  28695. filterEmpty(node) {
  28696. if (node.textContent.length > 1 && isIgnorable(node)) {
  28697. // Do not touch the content if text is pre-formatted
  28698. let parent = node.parentNode;
  28699. let pre = isElement(parent) && parent.closest("pre");
  28700. if (pre) {
  28701. return NodeFilter.FILTER_REJECT;
  28702. }
  28703. const previousSibling = previousSignificantNode(node);
  28704. const nextSibling = nextSignificantNode(node);
  28705. if (nextSibling === null && previousSibling === null) {
  28706. // we should not remove a Node that does not have any siblings.
  28707. node.textContent = " ";
  28708. return NodeFilter.FILTER_REJECT;
  28709. }
  28710. if (nextSibling === null) {
  28711. // we can safely remove this node
  28712. return NodeFilter.FILTER_ACCEPT;
  28713. }
  28714. if (previousSibling === null) {
  28715. // we can safely remove this node
  28716. return NodeFilter.FILTER_ACCEPT;
  28717. }
  28718. // replace the content with a single space
  28719. node.textContent = " ";
  28720. // TODO: we also need to preserve sequences of white spaces when the parent has "white-space" rule:
  28721. // pre
  28722. // Sequences of white space are preserved. Lines are only broken at newline characters in the source and at <br> elements.
  28723. //
  28724. // pre-wrap
  28725. // Sequences of white space are preserved. Lines are broken at newline characters, at <br>, and as necessary to fill line boxes.
  28726. //
  28727. // pre-line
  28728. // Sequences of white space are collapsed. Lines are broken at newline characters, at <br>, and as necessary to fill line boxes.
  28729. //
  28730. // break-spaces
  28731. // The behavior is identical to that of pre-wrap, except that:
  28732. // - Any sequence of preserved white space always takes up space, including at the end of the line.
  28733. // - A line breaking opportunity exists after every preserved white space character, including between white space characters.
  28734. // - 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).
  28735. //
  28736. // See: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space#Values
  28737. return NodeFilter.FILTER_REJECT;
  28738. } else {
  28739. return NodeFilter.FILTER_REJECT;
  28740. }
  28741. }
  28742. }
  28743. class CommentsFilter extends Handler {
  28744. constructor(chunker, polisher, caller) {
  28745. super(chunker, polisher, caller);
  28746. }
  28747. filter(content) {
  28748. filterTree(content, null, NodeFilter.SHOW_COMMENT);
  28749. }
  28750. }
  28751. class ScriptsFilter extends Handler {
  28752. constructor(chunker, polisher, caller) {
  28753. super(chunker, polisher, caller);
  28754. }
  28755. filter(content) {
  28756. content.querySelectorAll("script").forEach( script => { script.remove(); });
  28757. }
  28758. }
  28759. var clearCut = {};
  28760. /**
  28761. * Originally ported from https://github.com/keeganstreet/specificity/blob/866bf7ab4e7f62a7179c15b13a95af4e1c7b1afa/specificity.js
  28762. *
  28763. * Calculates the specificity of CSS selectors
  28764. * http://www.w3.org/TR/css3-selectors/#specificity
  28765. *
  28766. * Returns a selector integer value
  28767. */
  28768. (function (exports) {
  28769. // The following regular expressions assume that selectors matching the preceding regular expressions have been removed
  28770. var attributeRegex = /(\[[^\]]+\])/g;
  28771. var idRegex = /(#[^\s\+>~\.\[:]+)/g;
  28772. var classRegex = /(\.[^\s\+>~\.\[:]+)/g;
  28773. var pseudoElementRegex = /(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/g;
  28774. var pseudoClassRegex = /(:[^\s\+>~\.\[:]+)/g;
  28775. var elementRegex = /([^\s\+>~\.\[:]+)/g;
  28776. var notRegex = /:not\(([^\)]*)\)/g;
  28777. var ruleRegex = /\{[^]*/gm;
  28778. var separatorRegex = /[\*\s\+>~]/g;
  28779. var straysRegex = /[#\.]/g;
  28780. // Find matches for a regular expression in a string and push their details to parts
  28781. // Type is "a" for IDs, "b" for classes, attributes and pseudo-classes and "c" for elements and pseudo-elements
  28782. var findMatch = function(regex, type, types, selector) {
  28783. var matches = selector.match(regex);
  28784. if (matches) {
  28785. for (var i = 0; i < matches.length; i++) {
  28786. types[type]++;
  28787. // Replace this simple selector with whitespace so it won't be counted in further simple selectors
  28788. selector = selector.replace(matches[i], ' ');
  28789. }
  28790. }
  28791. return selector;
  28792. };
  28793. // Calculate the specificity for a selector by dividing it into simple selectors and counting them
  28794. var calculate = function(selector) {
  28795. var commaIndex = selector.indexOf(',');
  28796. if (commaIndex !== -1) {
  28797. selector = selector.substring(0, commaIndex);
  28798. }
  28799. var types = {
  28800. a: 0,
  28801. b: 0,
  28802. c: 0
  28803. };
  28804. // Remove the negation psuedo-class (:not) but leave its argument because specificity is calculated on its argument
  28805. selector = selector.replace(notRegex, ' $1 ');
  28806. // Remove anything after a left brace in case a user has pasted in a rule, not just a selector
  28807. selector = selector.replace(ruleRegex, ' ');
  28808. // Add attribute selectors to parts collection (type b)
  28809. selector = findMatch(attributeRegex, 'b', types, selector);
  28810. // Add ID selectors to parts collection (type a)
  28811. selector = findMatch(idRegex, 'a', types, selector);
  28812. // Add class selectors to parts collection (type b)
  28813. selector = findMatch(classRegex, 'b', types, selector);
  28814. // Add pseudo-element selectors to parts collection (type c)
  28815. selector = findMatch(pseudoElementRegex, 'c', types, selector);
  28816. // Add pseudo-class selectors to parts collection (type b)
  28817. selector = findMatch(pseudoClassRegex, 'b', types, selector);
  28818. // Remove universal selector and separator characters
  28819. selector = selector.replace(separatorRegex, ' ');
  28820. // Remove any stray dots or hashes which aren't attached to words
  28821. // These may be present if the user is live-editing this selector
  28822. selector = selector.replace(straysRegex, ' ');
  28823. // The only things left should be element selectors (type c)
  28824. findMatch(elementRegex, 'c', types, selector);
  28825. return (types.a * 100) + (types.b * 10) + (types.c * 1);
  28826. };
  28827. var specificityCache = {};
  28828. exports.calculateSpecificity = function(selector) {
  28829. var specificity = specificityCache[selector];
  28830. if (specificity === undefined) {
  28831. specificity = calculate(selector);
  28832. specificityCache[selector] = specificity;
  28833. }
  28834. return specificity;
  28835. };
  28836. var validSelectorCache = {};
  28837. var testSelectorElement = null;
  28838. exports.isSelectorValid = function(selector) {
  28839. var valid = validSelectorCache[selector];
  28840. if (valid === undefined) {
  28841. if (testSelectorElement == null) {
  28842. testSelectorElement = document.createElement('div');
  28843. }
  28844. try {
  28845. testSelectorElement.querySelector(selector);
  28846. valid = true;
  28847. } catch (error) {
  28848. valid = false;
  28849. }
  28850. validSelectorCache[selector] = valid;
  28851. }
  28852. return valid;
  28853. };
  28854. exports.validateSelector = function(selector) {
  28855. if (!exports.isSelectorValid(selector)) {
  28856. var error = new SyntaxError(selector + ' is not a valid selector');
  28857. error.code = 'EBADSELECTOR';
  28858. throw error;
  28859. }
  28860. };
  28861. } (clearCut));
  28862. class UndisplayedFilter extends Handler {
  28863. constructor(chunker, polisher, caller) {
  28864. super(chunker, polisher, caller);
  28865. this.displayRules = {};
  28866. }
  28867. onDeclaration(declaration, dItem, dList, rule) {
  28868. if (declaration.property === "display") {
  28869. let selector = csstree.generate(rule.ruleNode.prelude);
  28870. let value = declaration.value.children.first().name;
  28871. selector.split(",").forEach((s) => {
  28872. this.displayRules[s] = {
  28873. value: value,
  28874. selector: s,
  28875. specificity: clearCut.calculateSpecificity(s),
  28876. important: declaration.important
  28877. };
  28878. });
  28879. }
  28880. }
  28881. filter(content) {
  28882. let { matches, selectors } = this.sortDisplayedSelectors(content, this.displayRules);
  28883. // Find matching elements that have display styles
  28884. for (let i = 0; i < matches.length; i++) {
  28885. let element = matches[i];
  28886. let selector = selectors[i];
  28887. let displayValue = selector[selector.length-1].value;
  28888. if(this.removable(element) && displayValue === "none") {
  28889. element.dataset.undisplayed = "undisplayed";
  28890. }
  28891. }
  28892. // Find elements that have inline styles
  28893. let styledElements = content.querySelectorAll("[style]");
  28894. for (let i = 0; i < styledElements.length; i++) {
  28895. let element = styledElements[i];
  28896. if (this.removable(element)) {
  28897. element.dataset.undisplayed = "undisplayed";
  28898. }
  28899. }
  28900. }
  28901. sorter(a, b) {
  28902. if (a.important && !b.important) {
  28903. return 1;
  28904. }
  28905. if (b.important && !a.important) {
  28906. return -1;
  28907. }
  28908. return a.specificity - b.specificity;
  28909. }
  28910. sortDisplayedSelectors(content, displayRules=[]) {
  28911. let matches = [];
  28912. let selectors = [];
  28913. for (let d in displayRules) {
  28914. let displayItem = displayRules[d];
  28915. let selector = displayItem.selector;
  28916. let query = [];
  28917. try {
  28918. try {
  28919. query = content.querySelectorAll(selector);
  28920. } catch (e) {
  28921. query = content.querySelectorAll(cleanSelector(selector));
  28922. }
  28923. } catch (e) {
  28924. query = [];
  28925. }
  28926. let elements = Array.from(query);
  28927. for (let e of elements) {
  28928. if (matches.includes(e)) {
  28929. let index = matches.indexOf(e);
  28930. selectors[index].push(displayItem);
  28931. selectors[index] = selectors[index].sort(this.sorter);
  28932. } else {
  28933. matches.push(e);
  28934. selectors.push([displayItem]);
  28935. }
  28936. }
  28937. }
  28938. return { matches, selectors };
  28939. }
  28940. removable(element) {
  28941. if (element.style &&
  28942. element.style.display !== "" &&
  28943. element.style.display !== "none") {
  28944. return false;
  28945. }
  28946. return true;
  28947. }
  28948. }
  28949. var filters = [
  28950. WhiteSpaceFilter,
  28951. CommentsFilter,
  28952. ScriptsFilter,
  28953. UndisplayedFilter
  28954. ];
  28955. var isImplemented$3 = function () {
  28956. var from = Array.from, arr, result;
  28957. if (typeof from !== "function") return false;
  28958. arr = ["raz", "dwa"];
  28959. result = from(arr);
  28960. return Boolean(result && (result !== arr) && (result[1] === "dwa"));
  28961. };
  28962. var isImplemented$2;
  28963. var hasRequiredIsImplemented;
  28964. function requireIsImplemented () {
  28965. if (hasRequiredIsImplemented) return isImplemented$2;
  28966. hasRequiredIsImplemented = 1;
  28967. var validTypes = { object: true, symbol: true };
  28968. isImplemented$2 = function () {
  28969. var symbol;
  28970. if (typeof Symbol !== 'function') return false;
  28971. symbol = Symbol('test symbol');
  28972. try { String(symbol); } catch (e) { return false; }
  28973. // Return 'true' also for polyfills
  28974. if (!validTypes[typeof Symbol.iterator]) return false;
  28975. if (!validTypes[typeof Symbol.toPrimitive]) return false;
  28976. if (!validTypes[typeof Symbol.toStringTag]) return false;
  28977. return true;
  28978. };
  28979. return isImplemented$2;
  28980. }
  28981. var isSymbol;
  28982. var hasRequiredIsSymbol;
  28983. function requireIsSymbol () {
  28984. if (hasRequiredIsSymbol) return isSymbol;
  28985. hasRequiredIsSymbol = 1;
  28986. isSymbol = function (x) {
  28987. if (!x) return false;
  28988. if (typeof x === 'symbol') return true;
  28989. if (!x.constructor) return false;
  28990. if (x.constructor.name !== 'Symbol') return false;
  28991. return (x[x.constructor.toStringTag] === 'Symbol');
  28992. };
  28993. return isSymbol;
  28994. }
  28995. var validateSymbol;
  28996. var hasRequiredValidateSymbol;
  28997. function requireValidateSymbol () {
  28998. if (hasRequiredValidateSymbol) return validateSymbol;
  28999. hasRequiredValidateSymbol = 1;
  29000. var isSymbol = requireIsSymbol();
  29001. validateSymbol = function (value) {
  29002. if (!isSymbol(value)) throw new TypeError(value + " is not a symbol");
  29003. return value;
  29004. };
  29005. return validateSymbol;
  29006. }
  29007. var polyfill;
  29008. var hasRequiredPolyfill;
  29009. function requirePolyfill () {
  29010. if (hasRequiredPolyfill) return polyfill;
  29011. hasRequiredPolyfill = 1;
  29012. var d = dExports
  29013. , validateSymbol = requireValidateSymbol()
  29014. , create = Object.create, defineProperties = Object.defineProperties
  29015. , defineProperty = Object.defineProperty, objPrototype = Object.prototype
  29016. , NativeSymbol, SymbolPolyfill, HiddenSymbol, globalSymbols = create(null)
  29017. , isNativeSafe;
  29018. if (typeof Symbol === 'function') {
  29019. NativeSymbol = Symbol;
  29020. try {
  29021. String(NativeSymbol());
  29022. isNativeSafe = true;
  29023. } catch (ignore) {}
  29024. }
  29025. var generateName = (function () {
  29026. var created = create(null);
  29027. return function (desc) {
  29028. var postfix = 0, name, ie11BugWorkaround;
  29029. while (created[desc + (postfix || '')]) ++postfix;
  29030. desc += (postfix || '');
  29031. created[desc] = true;
  29032. name = '@@' + desc;
  29033. defineProperty(objPrototype, name, d.gs(null, function (value) {
  29034. // For IE11 issue see:
  29035. // https://connect.microsoft.com/IE/feedbackdetail/view/1928508/
  29036. // ie11-broken-getters-on-dom-objects
  29037. // https://github.com/medikoo/es6-symbol/issues/12
  29038. if (ie11BugWorkaround) return;
  29039. ie11BugWorkaround = true;
  29040. defineProperty(this, name, d(value));
  29041. ie11BugWorkaround = false;
  29042. }));
  29043. return name;
  29044. };
  29045. }());
  29046. // Internal constructor (not one exposed) for creating Symbol instances.
  29047. // This one is used to ensure that `someSymbol instanceof Symbol` always return false
  29048. HiddenSymbol = function Symbol(description) {
  29049. if (this instanceof HiddenSymbol) throw new TypeError('Symbol is not a constructor');
  29050. return SymbolPolyfill(description);
  29051. };
  29052. // Exposed `Symbol` constructor
  29053. // (returns instances of HiddenSymbol)
  29054. polyfill = SymbolPolyfill = function Symbol(description) {
  29055. var symbol;
  29056. if (this instanceof Symbol) throw new TypeError('Symbol is not a constructor');
  29057. if (isNativeSafe) return NativeSymbol(description);
  29058. symbol = create(HiddenSymbol.prototype);
  29059. description = (description === undefined ? '' : String(description));
  29060. return defineProperties(symbol, {
  29061. __description__: d('', description),
  29062. __name__: d('', generateName(description))
  29063. });
  29064. };
  29065. defineProperties(SymbolPolyfill, {
  29066. for: d(function (key) {
  29067. if (globalSymbols[key]) return globalSymbols[key];
  29068. return (globalSymbols[key] = SymbolPolyfill(String(key)));
  29069. }),
  29070. keyFor: d(function (s) {
  29071. var key;
  29072. validateSymbol(s);
  29073. for (key in globalSymbols) if (globalSymbols[key] === s) return key;
  29074. }),
  29075. // To ensure proper interoperability with other native functions (e.g. Array.from)
  29076. // fallback to eventual native implementation of given symbol
  29077. hasInstance: d('', (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill('hasInstance')),
  29078. isConcatSpreadable: d('', (NativeSymbol && NativeSymbol.isConcatSpreadable) ||
  29079. SymbolPolyfill('isConcatSpreadable')),
  29080. iterator: d('', (NativeSymbol && NativeSymbol.iterator) || SymbolPolyfill('iterator')),
  29081. match: d('', (NativeSymbol && NativeSymbol.match) || SymbolPolyfill('match')),
  29082. replace: d('', (NativeSymbol && NativeSymbol.replace) || SymbolPolyfill('replace')),
  29083. search: d('', (NativeSymbol && NativeSymbol.search) || SymbolPolyfill('search')),
  29084. species: d('', (NativeSymbol && NativeSymbol.species) || SymbolPolyfill('species')),
  29085. split: d('', (NativeSymbol && NativeSymbol.split) || SymbolPolyfill('split')),
  29086. toPrimitive: d('', (NativeSymbol && NativeSymbol.toPrimitive) || SymbolPolyfill('toPrimitive')),
  29087. toStringTag: d('', (NativeSymbol && NativeSymbol.toStringTag) || SymbolPolyfill('toStringTag')),
  29088. unscopables: d('', (NativeSymbol && NativeSymbol.unscopables) || SymbolPolyfill('unscopables'))
  29089. });
  29090. // Internal tweaks for real symbol producer
  29091. defineProperties(HiddenSymbol.prototype, {
  29092. constructor: d(SymbolPolyfill),
  29093. toString: d('', function () { return this.__name__; })
  29094. });
  29095. // Proper implementation of methods exposed on Symbol.prototype
  29096. // They won't be accessible on produced symbol instances as they derive from HiddenSymbol.prototype
  29097. defineProperties(SymbolPolyfill.prototype, {
  29098. toString: d(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }),
  29099. valueOf: d(function () { return validateSymbol(this); })
  29100. });
  29101. defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d('', function () {
  29102. var symbol = validateSymbol(this);
  29103. if (typeof symbol === 'symbol') return symbol;
  29104. return symbol.toString();
  29105. }));
  29106. defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d('c', 'Symbol'));
  29107. // Proper implementaton of toPrimitive and toStringTag for returned symbol instances
  29108. defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toStringTag,
  29109. d('c', SymbolPolyfill.prototype[SymbolPolyfill.toStringTag]));
  29110. // Note: It's important to define `toPrimitive` as last one, as some implementations
  29111. // implement `toPrimitive` natively without implementing `toStringTag` (or other specified symbols)
  29112. // And that may invoke error in definition flow:
  29113. // See: https://github.com/medikoo/es6-symbol/issues/13#issuecomment-164146149
  29114. defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive,
  29115. d('c', SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive]));
  29116. return polyfill;
  29117. }
  29118. var es6Symbol;
  29119. var hasRequiredEs6Symbol;
  29120. function requireEs6Symbol () {
  29121. if (hasRequiredEs6Symbol) return es6Symbol;
  29122. hasRequiredEs6Symbol = 1;
  29123. es6Symbol = requireIsImplemented()() ? Symbol : requirePolyfill();
  29124. return es6Symbol;
  29125. }
  29126. var isArguments;
  29127. var hasRequiredIsArguments;
  29128. function requireIsArguments () {
  29129. if (hasRequiredIsArguments) return isArguments;
  29130. hasRequiredIsArguments = 1;
  29131. var objToString = Object.prototype.toString
  29132. , id = objToString.call(
  29133. (function () {
  29134. return arguments;
  29135. })()
  29136. );
  29137. isArguments = function (value) {
  29138. return objToString.call(value) === id;
  29139. };
  29140. return isArguments;
  29141. }
  29142. var isFunction;
  29143. var hasRequiredIsFunction;
  29144. function requireIsFunction () {
  29145. if (hasRequiredIsFunction) return isFunction;
  29146. hasRequiredIsFunction = 1;
  29147. var objToString = Object.prototype.toString, id = objToString.call(noop$4);
  29148. isFunction = function (value) {
  29149. return typeof value === "function" && objToString.call(value) === id;
  29150. };
  29151. return isFunction;
  29152. }
  29153. var isImplemented$1 = function () {
  29154. var sign = Math.sign;
  29155. if (typeof sign !== "function") return false;
  29156. return (sign(10) === 1) && (sign(-20) === -1);
  29157. };
  29158. var shim$2;
  29159. var hasRequiredShim$2;
  29160. function requireShim$2 () {
  29161. if (hasRequiredShim$2) return shim$2;
  29162. hasRequiredShim$2 = 1;
  29163. shim$2 = function (value) {
  29164. value = Number(value);
  29165. if (isNaN(value) || (value === 0)) return value;
  29166. return value > 0 ? 1 : -1;
  29167. };
  29168. return shim$2;
  29169. }
  29170. var sign$1 = isImplemented$1()
  29171. ? Math.sign
  29172. : requireShim$2();
  29173. var sign = sign$1
  29174. , abs$1 = Math.abs, floor$1 = Math.floor;
  29175. var toInteger$1 = function (value) {
  29176. if (isNaN(value)) return 0;
  29177. value = Number(value);
  29178. if ((value === 0) || !isFinite(value)) return value;
  29179. return sign(value) * floor$1(abs$1(value));
  29180. };
  29181. var toInteger = toInteger$1
  29182. , max = Math.max;
  29183. var toPosInteger = function (value) {
  29184. return max(0, toInteger(value));
  29185. };
  29186. var isString;
  29187. var hasRequiredIsString;
  29188. function requireIsString () {
  29189. if (hasRequiredIsString) return isString;
  29190. hasRequiredIsString = 1;
  29191. var objToString = Object.prototype.toString, id = objToString.call("");
  29192. isString = function (value) {
  29193. return (
  29194. typeof value === "string" ||
  29195. (value &&
  29196. typeof value === "object" &&
  29197. (value instanceof String || objToString.call(value) === id)) ||
  29198. false
  29199. );
  29200. };
  29201. return isString;
  29202. }
  29203. var shim$1;
  29204. var hasRequiredShim$1;
  29205. function requireShim$1 () {
  29206. if (hasRequiredShim$1) return shim$1;
  29207. hasRequiredShim$1 = 1;
  29208. var iteratorSymbol = requireEs6Symbol().iterator
  29209. , isArguments = requireIsArguments()
  29210. , isFunction = requireIsFunction()
  29211. , toPosInt = toPosInteger
  29212. , callable = validCallable
  29213. , validValue$1 = validValue
  29214. , isValue = isValue$3
  29215. , isString = requireIsString()
  29216. , isArray = Array.isArray
  29217. , call = Function.prototype.call
  29218. , desc = { configurable: true, enumerable: true, writable: true, value: null }
  29219. , defineProperty = Object.defineProperty;
  29220. // eslint-disable-next-line complexity
  29221. shim$1 = function (arrayLike /*, mapFn, thisArg*/) {
  29222. var mapFn = arguments[1]
  29223. , thisArg = arguments[2]
  29224. , Context
  29225. , i
  29226. , j
  29227. , arr
  29228. , length
  29229. , code
  29230. , iterator
  29231. , result
  29232. , getIterator
  29233. , value;
  29234. arrayLike = Object(validValue$1(arrayLike));
  29235. if (isValue(mapFn)) callable(mapFn);
  29236. if (!this || this === Array || !isFunction(this)) {
  29237. // Result: Plain array
  29238. if (!mapFn) {
  29239. if (isArguments(arrayLike)) {
  29240. // Source: Arguments
  29241. length = arrayLike.length;
  29242. if (length !== 1) return Array.apply(null, arrayLike);
  29243. arr = new Array(1);
  29244. arr[0] = arrayLike[0];
  29245. return arr;
  29246. }
  29247. if (isArray(arrayLike)) {
  29248. // Source: Array
  29249. arr = new Array(length = arrayLike.length);
  29250. for (i = 0; i < length; ++i) arr[i] = arrayLike[i];
  29251. return arr;
  29252. }
  29253. }
  29254. arr = [];
  29255. } else {
  29256. // Result: Non plain array
  29257. Context = this;
  29258. }
  29259. if (!isArray(arrayLike)) {
  29260. if ((getIterator = arrayLike[iteratorSymbol]) !== undefined) {
  29261. // Source: Iterator
  29262. iterator = callable(getIterator).call(arrayLike);
  29263. if (Context) arr = new Context();
  29264. result = iterator.next();
  29265. i = 0;
  29266. while (!result.done) {
  29267. value = mapFn ? call.call(mapFn, thisArg, result.value, i) : result.value;
  29268. if (Context) {
  29269. desc.value = value;
  29270. defineProperty(arr, i, desc);
  29271. } else {
  29272. arr[i] = value;
  29273. }
  29274. result = iterator.next();
  29275. ++i;
  29276. }
  29277. length = i;
  29278. } else if (isString(arrayLike)) {
  29279. // Source: String
  29280. length = arrayLike.length;
  29281. if (Context) arr = new Context();
  29282. for (i = 0, j = 0; i < length; ++i) {
  29283. value = arrayLike[i];
  29284. if (i + 1 < length) {
  29285. code = value.charCodeAt(0);
  29286. // eslint-disable-next-line max-depth
  29287. if (code >= 0xd800 && code <= 0xdbff) value += arrayLike[++i];
  29288. }
  29289. value = mapFn ? call.call(mapFn, thisArg, value, j) : value;
  29290. if (Context) {
  29291. desc.value = value;
  29292. defineProperty(arr, j, desc);
  29293. } else {
  29294. arr[j] = value;
  29295. }
  29296. ++j;
  29297. }
  29298. length = j;
  29299. }
  29300. }
  29301. if (length === undefined) {
  29302. // Source: array or array-like
  29303. length = toPosInt(arrayLike.length);
  29304. if (Context) arr = new Context(length);
  29305. for (i = 0; i < length; ++i) {
  29306. value = mapFn ? call.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i];
  29307. if (Context) {
  29308. desc.value = value;
  29309. defineProperty(arr, i, desc);
  29310. } else {
  29311. arr[i] = value;
  29312. }
  29313. }
  29314. }
  29315. if (Context) {
  29316. desc.value = null;
  29317. arr.length = length;
  29318. }
  29319. return arr;
  29320. };
  29321. return shim$1;
  29322. }
  29323. var from = isImplemented$3()
  29324. ? Array.from
  29325. : requireShim$1();
  29326. var isImplemented = function () {
  29327. var numberIsNaN = Number.isNaN;
  29328. if (typeof numberIsNaN !== "function") return false;
  29329. return !numberIsNaN({}) && numberIsNaN(NaN) && !numberIsNaN(34);
  29330. };
  29331. var shim;
  29332. var hasRequiredShim;
  29333. function requireShim () {
  29334. if (hasRequiredShim) return shim;
  29335. hasRequiredShim = 1;
  29336. shim = function (value) {
  29337. // eslint-disable-next-line no-self-compare
  29338. return value !== value;
  29339. };
  29340. return shim;
  29341. }
  29342. var isNan = isImplemented()
  29343. ? Number.isNaN
  29344. : requireShim();
  29345. var numberIsNaN = isNan
  29346. , toPosInt = toPosInteger
  29347. , value$1 = validValue
  29348. , indexOf$1 = Array.prototype.indexOf
  29349. , objHasOwnProperty = Object.prototype.hasOwnProperty
  29350. , abs = Math.abs
  29351. , floor = Math.floor;
  29352. var eIndexOf = function (searchElement /*, fromIndex*/) {
  29353. var i, length, fromIndex, val;
  29354. if (!numberIsNaN(searchElement)) return indexOf$1.apply(this, arguments);
  29355. length = toPosInt(value$1(this).length);
  29356. fromIndex = arguments[1];
  29357. if (isNaN(fromIndex)) fromIndex = 0;
  29358. else if (fromIndex >= 0) fromIndex = floor(fromIndex);
  29359. else fromIndex = toPosInt(this.length) - floor(abs(fromIndex));
  29360. for (i = fromIndex; i < length; ++i) {
  29361. if (objHasOwnProperty.call(this, i)) {
  29362. val = this[i];
  29363. if (numberIsNaN(val)) return i; // Jslint: ignore
  29364. }
  29365. }
  29366. return -1;
  29367. };
  29368. var indexOf = eIndexOf
  29369. , forEach = Array.prototype.forEach
  29370. , splice = Array.prototype.splice;
  29371. // eslint-disable-next-line no-unused-vars
  29372. var remove$1 = function (itemToRemove /*, …item*/) {
  29373. forEach.call(
  29374. arguments,
  29375. function (item) {
  29376. var index = indexOf.call(this, item);
  29377. if (index !== -1) splice.call(this, index, 1);
  29378. },
  29379. this
  29380. );
  29381. };
  29382. var isValue = isValue$3;
  29383. var map = { function: true, object: true };
  29384. var isObject$1 = function (value) {
  29385. return (isValue(value) && map[typeof value]) || false;
  29386. };
  29387. var isObject = isObject$1;
  29388. var validObject = function (value) {
  29389. if (!isObject(value)) throw new TypeError(value + " is not an Object");
  29390. return value;
  29391. };
  29392. var aFrom = from
  29393. , remove = remove$1
  29394. , value = validObject
  29395. , d = dExports
  29396. , emit = eventEmitterExports.methods.emit
  29397. , defineProperty = Object.defineProperty
  29398. , hasOwnProperty$1 = Object.prototype.hasOwnProperty
  29399. , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  29400. var pipe = function (e1, e2/*, name*/) {
  29401. var pipes, pipe, desc, name;
  29402. (value(e1) && value(e2));
  29403. name = arguments[2];
  29404. if (name === undefined) name = 'emit';
  29405. pipe = {
  29406. close: function () { remove.call(pipes, e2); }
  29407. };
  29408. if (hasOwnProperty$1.call(e1, '__eePipes__')) {
  29409. (pipes = e1.__eePipes__).push(e2);
  29410. return pipe;
  29411. }
  29412. defineProperty(e1, '__eePipes__', d('c', pipes = [e2]));
  29413. desc = getOwnPropertyDescriptor(e1, name);
  29414. if (!desc) {
  29415. desc = d('c', undefined);
  29416. } else {
  29417. delete desc.get;
  29418. delete desc.set;
  29419. }
  29420. desc.value = function () {
  29421. var i, emitter, data = aFrom(pipes);
  29422. emit.apply(this, arguments);
  29423. for (i = 0; (emitter = data[i]); ++i) emit.apply(emitter, arguments);
  29424. };
  29425. defineProperty(e1, name, desc);
  29426. return pipe;
  29427. };
  29428. var pipe$1 = /*@__PURE__*/getDefaultExportFromCjs(pipe);
  29429. let registeredHandlers = [...pagedMediaHandlers, ...generatedContentHandlers, ...filters];
  29430. class Handlers {
  29431. constructor(chunker, polisher, caller) {
  29432. registeredHandlers.forEach((Handler) => {
  29433. let handler = new Handler(chunker, polisher, caller);
  29434. pipe$1(handler, this);
  29435. });
  29436. }
  29437. }
  29438. EventEmitter(Handlers.prototype);
  29439. function registerHandlers() {
  29440. for (var i = 0; i < arguments.length; i++) {
  29441. registeredHandlers.push(arguments[i]);
  29442. }
  29443. }
  29444. function initializeHandlers(chunker, polisher, caller) {
  29445. let handlers = new Handlers(chunker, polisher, caller);
  29446. return handlers;
  29447. }
  29448. class Previewer {
  29449. constructor(options) {
  29450. // this.preview = this.getParams("preview") !== "false";
  29451. this.settings = options || {};
  29452. // Process styles
  29453. this.polisher = new Polisher(false);
  29454. // Chunk contents
  29455. this.chunker = new Chunker(undefined, undefined, this.settings);
  29456. // Hooks
  29457. this.hooks = {};
  29458. this.hooks.beforePreview = new Hook(this);
  29459. this.hooks.afterPreview = new Hook(this);
  29460. // default size
  29461. this.size = {
  29462. width: {
  29463. value: 8.5,
  29464. unit: "in"
  29465. },
  29466. height: {
  29467. value: 11,
  29468. unit: "in"
  29469. },
  29470. format: undefined,
  29471. orientation: undefined
  29472. };
  29473. this.chunker.on("page", (page) => {
  29474. this.emit("page", page);
  29475. });
  29476. this.chunker.on("rendering", () => {
  29477. this.emit("rendering", this.chunker);
  29478. });
  29479. }
  29480. initializeHandlers() {
  29481. let handlers = initializeHandlers(this.chunker, this.polisher, this);
  29482. handlers.on("size", (size) => {
  29483. this.size = size;
  29484. this.emit("size", size);
  29485. });
  29486. handlers.on("atpages", (pages) => {
  29487. this.atpages = pages;
  29488. this.emit("atpages", pages);
  29489. });
  29490. return handlers;
  29491. }
  29492. registerHandlers() {
  29493. return registerHandlers.apply(registerHandlers, arguments);
  29494. }
  29495. getParams(name) {
  29496. let param;
  29497. let url = new URL(window.location);
  29498. let params = new URLSearchParams(url.search);
  29499. for(var pair of params.entries()) {
  29500. if(pair[0] === name) {
  29501. param = pair[1];
  29502. }
  29503. }
  29504. return param;
  29505. }
  29506. wrapContent() {
  29507. // Wrap body in template tag
  29508. let body = document.querySelector("body");
  29509. // Check if a template exists
  29510. let template;
  29511. template = body.querySelector(":scope > template[data-ref='pagedjs-content']");
  29512. if (!template) {
  29513. // Otherwise create one
  29514. template = document.createElement("template");
  29515. template.dataset.ref = "pagedjs-content";
  29516. template.innerHTML = body.innerHTML;
  29517. body.innerHTML = "";
  29518. body.appendChild(template);
  29519. }
  29520. return template.content;
  29521. }
  29522. removeStyles(doc=document) {
  29523. // Get all stylesheets
  29524. const stylesheets = Array.from(doc.querySelectorAll("link[rel='stylesheet']:not([data-pagedjs-ignore], [media~='screen'])"));
  29525. // Get inline styles
  29526. const inlineStyles = Array.from(doc.querySelectorAll("style:not([data-pagedjs-inserted-styles], [data-pagedjs-ignore], [media~='screen'])"));
  29527. const elements = [...stylesheets, ...inlineStyles];
  29528. return elements
  29529. // preserve order
  29530. .sort(function (element1, element2) {
  29531. const position = element1.compareDocumentPosition(element2);
  29532. if (position === Node.DOCUMENT_POSITION_PRECEDING) {
  29533. return 1;
  29534. } else if (position === Node.DOCUMENT_POSITION_FOLLOWING) {
  29535. return -1;
  29536. }
  29537. return 0;
  29538. })
  29539. // extract the href
  29540. .map((element) => {
  29541. if (element.nodeName === "STYLE") {
  29542. const obj = {};
  29543. obj[window.location.href] = element.textContent;
  29544. element.remove();
  29545. return obj;
  29546. }
  29547. if (element.nodeName === "LINK") {
  29548. element.remove();
  29549. return element.href;
  29550. }
  29551. // ignore
  29552. console.warn(`Unable to process: ${element}, ignoring.`);
  29553. });
  29554. }
  29555. async preview(content, stylesheets, renderTo) {
  29556. await this.hooks.beforePreview.trigger(content, renderTo);
  29557. if (!content) {
  29558. content = this.wrapContent();
  29559. }
  29560. if (!stylesheets) {
  29561. stylesheets = this.removeStyles();
  29562. }
  29563. this.polisher.setup();
  29564. this.handlers = this.initializeHandlers();
  29565. await this.polisher.add(...stylesheets);
  29566. let startTime = performance.now();
  29567. // Render flow
  29568. let flow = await this.chunker.flow(content, renderTo);
  29569. let endTime = performance.now();
  29570. flow.performance = (endTime - startTime);
  29571. flow.size = this.size;
  29572. this.emit("rendered", flow);
  29573. await this.hooks.afterPreview.trigger(flow.pages);
  29574. return flow;
  29575. }
  29576. }
  29577. EventEmitter(Previewer.prototype);
  29578. var Paged = /*#__PURE__*/Object.freeze({
  29579. __proto__: null,
  29580. Chunker: Chunker,
  29581. Handler: Handler,
  29582. Polisher: Polisher,
  29583. Previewer: Previewer,
  29584. initializeHandlers: initializeHandlers,
  29585. registerHandlers: registerHandlers,
  29586. registeredHandlers: registeredHandlers
  29587. });
  29588. window.Paged = Paged;
  29589. let ready = new Promise(function(resolve, reject){
  29590. if (document.readyState === "interactive" || document.readyState === "complete") {
  29591. resolve(document.readyState);
  29592. return;
  29593. }
  29594. document.onreadystatechange = function ($) {
  29595. if (document.readyState === "interactive") {
  29596. resolve(document.readyState);
  29597. }
  29598. };
  29599. });
  29600. let config = window.PagedConfig || {
  29601. auto: true,
  29602. before: undefined,
  29603. after: undefined,
  29604. content: undefined,
  29605. stylesheets: undefined,
  29606. renderTo: undefined,
  29607. settings: undefined
  29608. };
  29609. let previewer = new Previewer(config.settings);
  29610. ready.then(async function () {
  29611. let done;
  29612. if (config.before) {
  29613. await config.before();
  29614. }
  29615. if(config.auto !== false) {
  29616. done = await previewer.preview(config.content, config.stylesheets, config.renderTo);
  29617. }
  29618. if (config.after) {
  29619. await config.after(done);
  29620. }
  29621. });
  29622. return previewer;
  29623. }));