chunk-REIMVYFT.js 470 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302
  1. // node_modules/katex/dist/katex.mjs
  2. var ParseError = class _ParseError extends Error {
  3. // Error start position based on passed-in Token or ParseNode.
  4. // Length of affected text based on passed-in Token or ParseNode.
  5. // The underlying error message without any context added.
  6. constructor(message, token) {
  7. var error = "KaTeX parse error: " + message;
  8. var start;
  9. var end;
  10. var loc = token && token.loc;
  11. if (loc && loc.start <= loc.end) {
  12. var input = loc.lexer.input;
  13. start = loc.start;
  14. end = loc.end;
  15. if (start === input.length) {
  16. error += " at end of input: ";
  17. } else {
  18. error += " at position " + (start + 1) + ": ";
  19. }
  20. var underlined = input.slice(start, end).replace(/[^]/g, "$&̲");
  21. var left;
  22. if (start > 15) {
  23. left = "…" + input.slice(start - 15, start);
  24. } else {
  25. left = input.slice(0, start);
  26. }
  27. var right;
  28. if (end + 15 < input.length) {
  29. right = input.slice(end, end + 15) + "…";
  30. } else {
  31. right = input.slice(end);
  32. }
  33. error += left + underlined + right;
  34. }
  35. super(error);
  36. this.name = "ParseError";
  37. Object.setPrototypeOf(this, _ParseError.prototype);
  38. this.position = start;
  39. if (start != null && end != null) {
  40. this.length = end - start;
  41. }
  42. this.rawMessage = message;
  43. }
  44. };
  45. var uppercase = /([A-Z])/g;
  46. var hyphenate = (str) => str.replace(uppercase, "-$1").toLowerCase();
  47. var ESCAPE_LOOKUP = {
  48. "&": "&amp;",
  49. ">": "&gt;",
  50. "<": "&lt;",
  51. '"': "&quot;",
  52. "'": "&#x27;"
  53. };
  54. var ESCAPE_REGEX = /[&><"']/g;
  55. var escape = (text2) => String(text2).replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
  56. var getBaseElem = (group) => {
  57. if (group.type === "ordgroup") {
  58. if (group.body.length === 1) {
  59. return getBaseElem(group.body[0]);
  60. } else {
  61. return group;
  62. }
  63. } else if (group.type === "color") {
  64. if (group.body.length === 1) {
  65. return getBaseElem(group.body[0]);
  66. } else {
  67. return group;
  68. }
  69. } else if (group.type === "font") {
  70. return getBaseElem(group.body);
  71. } else {
  72. return group;
  73. }
  74. };
  75. var characterNodesTypes = /* @__PURE__ */ new Set(["mathord", "textord", "atom"]);
  76. var isCharacterBox = (group) => characterNodesTypes.has(getBaseElem(group).type);
  77. var protocolFromUrl = (url) => {
  78. var protocol = /^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(url);
  79. if (!protocol) {
  80. return "_relative";
  81. }
  82. if (protocol[2] !== ":") {
  83. return null;
  84. }
  85. if (!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(protocol[1])) {
  86. return null;
  87. }
  88. return protocol[1].toLowerCase();
  89. };
  90. var SETTINGS_SCHEMA = {
  91. displayMode: {
  92. type: "boolean",
  93. description: "Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",
  94. cli: "-d, --display-mode"
  95. },
  96. output: {
  97. type: {
  98. enum: ["htmlAndMathml", "html", "mathml"]
  99. },
  100. description: "Determines the markup language of the output.",
  101. cli: "-F, --format <type>"
  102. },
  103. leqno: {
  104. type: "boolean",
  105. description: "Render display math in leqno style (left-justified tags)."
  106. },
  107. fleqn: {
  108. type: "boolean",
  109. description: "Render display math flush left."
  110. },
  111. throwOnError: {
  112. type: "boolean",
  113. default: true,
  114. cli: "-t, --no-throw-on-error",
  115. cliDescription: "Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."
  116. },
  117. errorColor: {
  118. type: "string",
  119. default: "#cc0000",
  120. cli: "-c, --error-color <color>",
  121. cliDescription: "A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",
  122. cliProcessor: (color) => "#" + color
  123. },
  124. macros: {
  125. type: "object",
  126. cli: "-m, --macro <def>",
  127. cliDescription: "Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",
  128. cliDefault: [],
  129. cliProcessor: (def, defs) => {
  130. defs.push(def);
  131. return defs;
  132. }
  133. },
  134. minRuleThickness: {
  135. type: "number",
  136. description: "Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",
  137. processor: (t) => Math.max(0, t),
  138. cli: "--min-rule-thickness <size>",
  139. cliProcessor: parseFloat
  140. },
  141. colorIsTextColor: {
  142. type: "boolean",
  143. description: "Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",
  144. cli: "-b, --color-is-text-color"
  145. },
  146. strict: {
  147. type: [{
  148. enum: ["warn", "ignore", "error"]
  149. }, "boolean", "function"],
  150. description: "Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",
  151. cli: "-S, --strict",
  152. cliDefault: false
  153. },
  154. trust: {
  155. type: ["boolean", "function"],
  156. description: "Trust the input, enabling all HTML features such as \\url.",
  157. cli: "-T, --trust"
  158. },
  159. maxSize: {
  160. type: "number",
  161. default: Infinity,
  162. description: "If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",
  163. processor: (s) => Math.max(0, s),
  164. cli: "-s, --max-size <n>",
  165. cliProcessor: parseInt
  166. },
  167. maxExpand: {
  168. type: "number",
  169. default: 1e3,
  170. description: "Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",
  171. processor: (n) => Math.max(0, n),
  172. cli: "-e, --max-expand <n>",
  173. cliProcessor: (n) => n === "Infinity" ? Infinity : parseInt(n)
  174. },
  175. globalGroup: {
  176. type: "boolean",
  177. cli: false
  178. }
  179. };
  180. function getDefaultValue(schema) {
  181. if ("default" in schema) {
  182. return schema.default;
  183. }
  184. var type = schema.type;
  185. var defaultType = Array.isArray(type) ? type[0] : type;
  186. if (typeof defaultType !== "string") {
  187. return defaultType.enum[0];
  188. }
  189. switch (defaultType) {
  190. case "boolean":
  191. return false;
  192. case "string":
  193. return "";
  194. case "number":
  195. return 0;
  196. case "object":
  197. return {};
  198. }
  199. }
  200. var Settings = class {
  201. constructor(options) {
  202. if (options === void 0) {
  203. options = {};
  204. }
  205. options = options || {};
  206. for (var prop of Object.keys(SETTINGS_SCHEMA)) {
  207. var schema = SETTINGS_SCHEMA[prop];
  208. var optionValue = options[prop];
  209. this[prop] = optionValue !== void 0 ? schema.processor ? schema.processor(optionValue) : optionValue : getDefaultValue(schema);
  210. }
  211. }
  212. /**
  213. * Report nonstrict (non-LaTeX-compatible) input.
  214. * Can safely not be called if `this.strict` is false in JavaScript.
  215. */
  216. reportNonstrict(errorCode, errorMsg, token) {
  217. var strict = this.strict;
  218. if (typeof strict === "function") {
  219. strict = strict(errorCode, errorMsg, token);
  220. }
  221. if (!strict || strict === "ignore") {
  222. return;
  223. } else if (strict === true || strict === "error") {
  224. throw new ParseError("LaTeX-incompatible input and strict mode is set to 'error': " + (errorMsg + " [" + errorCode + "]"), token);
  225. } else if (strict === "warn") {
  226. typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]"));
  227. } else {
  228. typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]"));
  229. }
  230. }
  231. /**
  232. * Check whether to apply strict (LaTeX-adhering) behavior for unusual
  233. * input (like `\\`). Unlike `nonstrict`, will not throw an error;
  234. * instead, "error" translates to a return value of `true`, while "ignore"
  235. * translates to a return value of `false`. May still print a warning:
  236. * "warn" prints a warning and returns `false`.
  237. * This is for the second category of `errorCode`s listed in the README.
  238. */
  239. useStrictBehavior(errorCode, errorMsg, token) {
  240. var strict = this.strict;
  241. if (typeof strict === "function") {
  242. try {
  243. strict = strict(errorCode, errorMsg, token);
  244. } catch (error) {
  245. strict = "error";
  246. }
  247. }
  248. if (!strict || strict === "ignore") {
  249. return false;
  250. } else if (strict === true || strict === "error") {
  251. return true;
  252. } else if (strict === "warn") {
  253. typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]"));
  254. return false;
  255. } else {
  256. typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]"));
  257. return false;
  258. }
  259. }
  260. /**
  261. * Check whether to test potentially dangerous input, and return
  262. * `true` (trusted) or `false` (untrusted). The sole argument `context`
  263. * should be an object with `command` field specifying the relevant LaTeX
  264. * command (as a string starting with `\`), and any other arguments, etc.
  265. * If `context` has a `url` field, a `protocol` field will automatically
  266. * get added by this function (changing the specified object).
  267. */
  268. isTrusted(context) {
  269. if ("url" in context && context.url && !context.protocol) {
  270. var protocol = protocolFromUrl(context.url);
  271. if (protocol == null) {
  272. return false;
  273. }
  274. context.protocol = protocol;
  275. }
  276. var trust = typeof this.trust === "function" ? this.trust(context) : this.trust;
  277. return Boolean(trust);
  278. }
  279. };
  280. var Style = class {
  281. constructor(id, size, cramped) {
  282. this.id = id;
  283. this.size = size;
  284. this.cramped = cramped;
  285. }
  286. /**
  287. * Get the style of a superscript given a base in the current style.
  288. */
  289. sup() {
  290. return styles[sup[this.id]];
  291. }
  292. /**
  293. * Get the style of a subscript given a base in the current style.
  294. */
  295. sub() {
  296. return styles[sub[this.id]];
  297. }
  298. /**
  299. * Get the style of a fraction numerator given the fraction in the current
  300. * style.
  301. */
  302. fracNum() {
  303. return styles[fracNum[this.id]];
  304. }
  305. /**
  306. * Get the style of a fraction denominator given the fraction in the current
  307. * style.
  308. */
  309. fracDen() {
  310. return styles[fracDen[this.id]];
  311. }
  312. /**
  313. * Get the cramped version of a style (in particular, cramping a cramped style
  314. * doesn't change the style).
  315. */
  316. cramp() {
  317. return styles[cramp[this.id]];
  318. }
  319. /**
  320. * Get a text or display version of this style.
  321. */
  322. text() {
  323. return styles[text$1[this.id]];
  324. }
  325. /**
  326. * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle)
  327. */
  328. isTight() {
  329. return this.size >= 2;
  330. }
  331. };
  332. var D = 0;
  333. var Dc = 1;
  334. var T = 2;
  335. var Tc = 3;
  336. var S = 4;
  337. var Sc = 5;
  338. var SS = 6;
  339. var SSc = 7;
  340. var styles = [new Style(D, 0, false), new Style(Dc, 0, true), new Style(T, 1, false), new Style(Tc, 1, true), new Style(S, 2, false), new Style(Sc, 2, true), new Style(SS, 3, false), new Style(SSc, 3, true)];
  341. var sup = [S, Sc, S, Sc, SS, SSc, SS, SSc];
  342. var sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc];
  343. var fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc];
  344. var fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc];
  345. var cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc];
  346. var text$1 = [D, Dc, T, Tc, T, Tc, T, Tc];
  347. var Style$1 = {
  348. DISPLAY: styles[D],
  349. TEXT: styles[T],
  350. SCRIPT: styles[S],
  351. SCRIPTSCRIPT: styles[SS]
  352. };
  353. var scriptData = [{
  354. // Latin characters beyond the Latin-1 characters we have metrics for.
  355. // Needed for Czech, Hungarian and Turkish text, for example.
  356. name: "latin",
  357. blocks: [
  358. [256, 591],
  359. // Latin Extended-A and Latin Extended-B
  360. [768, 879]
  361. // Combining Diacritical marks
  362. ]
  363. }, {
  364. // The Cyrillic script used by Russian and related languages.
  365. // A Cyrillic subset used to be supported as explicitly defined
  366. // symbols in symbols.js
  367. name: "cyrillic",
  368. blocks: [[1024, 1279]]
  369. }, {
  370. // Armenian
  371. name: "armenian",
  372. blocks: [[1328, 1423]]
  373. }, {
  374. // The Brahmic scripts of South and Southeast Asia
  375. // Devanagari (0900–097F)
  376. // Bengali (0980–09FF)
  377. // Gurmukhi (0A00–0A7F)
  378. // Gujarati (0A80–0AFF)
  379. // Oriya (0B00–0B7F)
  380. // Tamil (0B80–0BFF)
  381. // Telugu (0C00–0C7F)
  382. // Kannada (0C80–0CFF)
  383. // Malayalam (0D00–0D7F)
  384. // Sinhala (0D80–0DFF)
  385. // Thai (0E00–0E7F)
  386. // Lao (0E80–0EFF)
  387. // Tibetan (0F00–0FFF)
  388. // Myanmar (1000–109F)
  389. name: "brahmic",
  390. blocks: [[2304, 4255]]
  391. }, {
  392. name: "georgian",
  393. blocks: [[4256, 4351]]
  394. }, {
  395. // Chinese and Japanese.
  396. // The "k" in cjk is for Korean, but we've separated Korean out
  397. name: "cjk",
  398. blocks: [
  399. [12288, 12543],
  400. // CJK symbols and punctuation, Hiragana, Katakana
  401. [19968, 40879],
  402. // CJK ideograms
  403. [65280, 65376]
  404. // Fullwidth punctuation
  405. // TODO: add halfwidth Katakana and Romanji glyphs
  406. ]
  407. }, {
  408. // Korean
  409. name: "hangul",
  410. blocks: [[44032, 55215]]
  411. }];
  412. function scriptFromCodepoint(codepoint) {
  413. for (var i = 0; i < scriptData.length; i++) {
  414. var script = scriptData[i];
  415. for (var _i = 0; _i < script.blocks.length; _i++) {
  416. var block = script.blocks[_i];
  417. if (codepoint >= block[0] && codepoint <= block[1]) {
  418. return script.name;
  419. }
  420. }
  421. }
  422. return null;
  423. }
  424. var allBlocks = [];
  425. scriptData.forEach((s) => s.blocks.forEach((b) => allBlocks.push(...b)));
  426. function supportedCodepoint(codepoint) {
  427. for (var i = 0; i < allBlocks.length; i += 2) {
  428. if (codepoint >= allBlocks[i] && codepoint <= allBlocks[i + 1]) {
  429. return true;
  430. }
  431. }
  432. return false;
  433. }
  434. var hLinePad = 80;
  435. var sqrtMain = function sqrtMain2(extraVinculum, hLinePad2) {
  436. return "M95," + (622 + extraVinculum + hLinePad2) + "\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl" + extraVinculum / 2.075 + " -" + extraVinculum + "\nc5.3,-9.3,12,-14,20,-14\nH400000v" + (40 + extraVinculum) + "H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM" + (834 + extraVinculum) + " " + hLinePad2 + "h400000v" + (40 + extraVinculum) + "h-400000z";
  437. };
  438. var sqrtSize1 = function sqrtSize12(extraVinculum, hLinePad2) {
  439. return "M263," + (601 + extraVinculum + hLinePad2) + "c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl" + extraVinculum / 2.084 + " -" + extraVinculum + "\nc4.7,-7.3,11,-11,19,-11\nH40000v" + (40 + extraVinculum) + "H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM" + (1001 + extraVinculum) + " " + hLinePad2 + "h400000v" + (40 + extraVinculum) + "h-400000z";
  440. };
  441. var sqrtSize2 = function sqrtSize22(extraVinculum, hLinePad2) {
  442. return "M983 " + (10 + extraVinculum + hLinePad2) + "\nl" + extraVinculum / 3.13 + " -" + extraVinculum + "\nc4,-6.7,10,-10,18,-10 H400000v" + (40 + extraVinculum) + "\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM" + (1001 + extraVinculum) + " " + hLinePad2 + "h400000v" + (40 + extraVinculum) + "h-400000z";
  443. };
  444. var sqrtSize3 = function sqrtSize32(extraVinculum, hLinePad2) {
  445. return "M424," + (2398 + extraVinculum + hLinePad2) + "\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl" + extraVinculum / 4.223 + " -" + extraVinculum + "c4,-6.7,10,-10,18,-10 H400000\nv" + (40 + extraVinculum) + "H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M" + (1001 + extraVinculum) + " " + hLinePad2 + "\nh400000v" + (40 + extraVinculum) + "h-400000z";
  446. };
  447. var sqrtSize4 = function sqrtSize42(extraVinculum, hLinePad2) {
  448. return "M473," + (2713 + extraVinculum + hLinePad2) + "\nc339.3,-1799.3,509.3,-2700,510,-2702 l" + extraVinculum / 5.298 + " -" + extraVinculum + "\nc3.3,-7.3,9.3,-11,18,-11 H400000v" + (40 + extraVinculum) + "H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM" + (1001 + extraVinculum) + " " + hLinePad2 + "h400000v" + (40 + extraVinculum) + "H1017.7z";
  449. };
  450. var phasePath = function phasePath2(y) {
  451. var x = y / 2;
  452. return "M400000 " + y + " H0 L" + x + " 0 l65 45 L145 " + (y - 80) + " H400000z";
  453. };
  454. var sqrtTall = function sqrtTall2(extraVinculum, hLinePad2, viewBoxHeight) {
  455. var vertSegment = viewBoxHeight - 54 - hLinePad2 - extraVinculum;
  456. return "M702 " + (extraVinculum + hLinePad2) + "H400000" + (40 + extraVinculum) + "\nH742v" + vertSegment + "l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 " + hLinePad2 + "H400000v" + (40 + extraVinculum) + "H742z";
  457. };
  458. var sqrtPath = function sqrtPath2(size, extraVinculum, viewBoxHeight) {
  459. extraVinculum = 1e3 * extraVinculum;
  460. var path2 = "";
  461. switch (size) {
  462. case "sqrtMain":
  463. path2 = sqrtMain(extraVinculum, hLinePad);
  464. break;
  465. case "sqrtSize1":
  466. path2 = sqrtSize1(extraVinculum, hLinePad);
  467. break;
  468. case "sqrtSize2":
  469. path2 = sqrtSize2(extraVinculum, hLinePad);
  470. break;
  471. case "sqrtSize3":
  472. path2 = sqrtSize3(extraVinculum, hLinePad);
  473. break;
  474. case "sqrtSize4":
  475. path2 = sqrtSize4(extraVinculum, hLinePad);
  476. break;
  477. case "sqrtTall":
  478. path2 = sqrtTall(extraVinculum, hLinePad, viewBoxHeight);
  479. }
  480. return path2;
  481. };
  482. var innerPath = function innerPath2(name, height) {
  483. switch (name) {
  484. case "⎜":
  485. return "M291 0 H417 V" + height + " H291z M291 0 H417 V" + height + " H291z";
  486. case "∣":
  487. return "M145 0 H188 V" + height + " H145z M145 0 H188 V" + height + " H145z";
  488. case "∥":
  489. return "M145 0 H188 V" + height + " H145z M145 0 H188 V" + height + " H145z" + ("M367 0 H410 V" + height + " H367z M367 0 H410 V" + height + " H367z");
  490. case "⎟":
  491. return "M457 0 H583 V" + height + " H457z M457 0 H583 V" + height + " H457z";
  492. case "⎢":
  493. return "M319 0 H403 V" + height + " H319z M319 0 H403 V" + height + " H319z";
  494. case "⎥":
  495. return "M263 0 H347 V" + height + " H263z M263 0 H347 V" + height + " H263z";
  496. case "⎪":
  497. return "M384 0 H504 V" + height + " H384z M384 0 H504 V" + height + " H384z";
  498. case "⏐":
  499. return "M312 0 H355 V" + height + " H312z M312 0 H355 V" + height + " H312z";
  500. case "‖":
  501. return "M257 0 H300 V" + height + " H257z M257 0 H300 V" + height + " H257z" + ("M478 0 H521 V" + height + " H478z M478 0 H521 V" + height + " H478z");
  502. default:
  503. return "";
  504. }
  505. };
  506. var path = {
  507. // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main
  508. doubleleftarrow: "M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z",
  509. // doublerightarrow is from glyph U+21D2 in font KaTeX Main
  510. doublerightarrow: "M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z",
  511. // leftarrow is from glyph U+2190 in font KaTeX Main
  512. leftarrow: "M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z",
  513. // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular
  514. leftbrace: "M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z",
  515. leftbraceunder: "M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z",
  516. // overgroup is from the MnSymbol package (public domain)
  517. leftgroup: "M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z",
  518. leftgroupunder: "M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z",
  519. // Harpoons are from glyph U+21BD in font KaTeX Main
  520. leftharpoon: "M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z",
  521. leftharpoonplus: "M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z",
  522. leftharpoondown: "M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z",
  523. leftharpoondownplus: "M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z",
  524. // hook is from glyph U+21A9 in font KaTeX Main
  525. lefthook: "M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z",
  526. leftlinesegment: "M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z",
  527. leftbracketunder: "M0 0 h120 V290 H399995 v120 H0z\nM0 0 h120 V290 H399995 v120 H0z",
  528. leftbracketover: "M0 440 h120 V150 H399995 v-120 H0z\nM0 440 h120 V150 H399995 v-120 H0z",
  529. leftmapsto: "M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z",
  530. // tofrom is from glyph U+21C4 in font KaTeX AMS Regular
  531. leftToFrom: "M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z",
  532. longequal: "M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z",
  533. midbrace: "M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z",
  534. midbraceunder: "M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z",
  535. oiintSize1: "M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z",
  536. oiintSize2: "M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z",
  537. oiiintSize1: "M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z",
  538. oiiintSize2: "M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z",
  539. rightarrow: "M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z",
  540. rightbrace: "M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z",
  541. rightbraceunder: "M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z",
  542. rightgroup: "M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z",
  543. rightgroupunder: "M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z",
  544. rightharpoon: "M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z",
  545. rightharpoonplus: "M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z",
  546. rightharpoondown: "M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z",
  547. rightharpoondownplus: "M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z",
  548. righthook: "M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z",
  549. rightlinesegment: "M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z",
  550. rightbracketunder: "M399995 0 h-120 V290 H0 v120 H400000z\nM399995 0 h-120 V290 H0 v120 H400000z",
  551. rightbracketover: "M399995 440 h-120 V150 H0 v-120 H399995z\nM399995 440 h-120 V150 H0 v-120 H399995z",
  552. rightToFrom: "M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z",
  553. // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular
  554. twoheadleftarrow: "M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z",
  555. twoheadrightarrow: "M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z",
  556. // tilde1 is a modified version of a glyph from the MnSymbol package
  557. tilde1: "M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z",
  558. // ditto tilde2, tilde3, & tilde4
  559. tilde2: "M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z",
  560. tilde3: "M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z",
  561. tilde4: "M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z",
  562. // vec is from glyph U+20D7 in font KaTeX Main
  563. vec: "M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z",
  564. // widehat1 is a modified version of a glyph from the MnSymbol package
  565. widehat1: "M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z",
  566. // ditto widehat2, widehat3, & widehat4
  567. widehat2: "M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",
  568. widehat3: "M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",
  569. widehat4: "M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",
  570. // widecheck paths are all inverted versions of widehat
  571. widecheck1: "M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z",
  572. widecheck2: "M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",
  573. widecheck3: "M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",
  574. widecheck4: "M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",
  575. // The next ten paths support reaction arrows from the mhchem package.
  576. // Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX
  577. // baraboveleftarrow is mostly from glyph U+2190 in font KaTeX Main
  578. baraboveleftarrow: "M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",
  579. // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main
  580. rightarrowabovebar: "M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",
  581. // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end.
  582. // Ref from mhchem.sty: \rlap{\raisebox{-.22ex}{$\kern0.5em
  583. baraboveshortleftharpoon: "M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z",
  584. rightharpoonaboveshortbar: "M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z",
  585. shortbaraboveleftharpoon: "M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z",
  586. shortrightharpoonabovebar: "M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"
  587. };
  588. var tallDelim = function tallDelim2(label, midHeight) {
  589. switch (label) {
  590. case "lbrack":
  591. return "M403 1759 V84 H666 V0 H319 V1759 v" + midHeight + " v1759 h347 v-84\nH403z M403 1759 V0 H319 V1759 v" + midHeight + " v1759 h84z";
  592. case "rbrack":
  593. return "M347 1759 V0 H0 V84 H263 V1759 v" + midHeight + " v1759 H0 v84 H347z\nM347 1759 V0 H263 V1759 v" + midHeight + " v1759 h84z";
  594. case "vert":
  595. return "M145 15 v585 v" + midHeight + " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + -midHeight + " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v" + midHeight + " v585 h43z";
  596. case "doublevert":
  597. return "M145 15 v585 v" + midHeight + " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + -midHeight + " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v" + midHeight + " v585 h43z\nM367 15 v585 v" + midHeight + " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + -midHeight + " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M410 15 H367 v585 v" + midHeight + " v585 h43z";
  598. case "lfloor":
  599. return "M319 602 V0 H403 V602 v" + midHeight + " v1715 h263 v84 H319z\nMM319 602 V0 H403 V602 v" + midHeight + " v1715 H319z";
  600. case "rfloor":
  601. return "M319 602 V0 H403 V602 v" + midHeight + " v1799 H0 v-84 H319z\nMM319 602 V0 H403 V602 v" + midHeight + " v1715 H319z";
  602. case "lceil":
  603. return "M403 1759 V84 H666 V0 H319 V1759 v" + midHeight + " v602 h84z\nM403 1759 V0 H319 V1759 v" + midHeight + " v602 h84z";
  604. case "rceil":
  605. return "M347 1759 V0 H0 V84 H263 V1759 v" + midHeight + " v602 h84z\nM347 1759 V0 h-84 V1759 v" + midHeight + " v602 h84z";
  606. case "lparen":
  607. return "M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1\nc-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,\n-36,557 l0," + (midHeight + 84) + "c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,\n949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9\nc0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,\n-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189\nl0,-" + (midHeight + 92) + "c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,\n-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z";
  608. case "rparen":
  609. return "M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,\n63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5\nc11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0," + (midHeight + 9) + "\nc-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664\nc-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11\nc0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17\nc242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558\nl0,-" + (midHeight + 144) + "c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,\n-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z";
  610. default:
  611. throw new Error("Unknown stretchy delimiter.");
  612. }
  613. };
  614. var DocumentFragment = class {
  615. // Never used; needed for satisfying interface.
  616. constructor(children) {
  617. this.children = children;
  618. this.classes = [];
  619. this.height = 0;
  620. this.depth = 0;
  621. this.maxFontSize = 0;
  622. this.style = {};
  623. }
  624. hasClass(className) {
  625. return this.classes.includes(className);
  626. }
  627. /** Convert the fragment into a node. */
  628. toNode() {
  629. var frag = document.createDocumentFragment();
  630. for (var i = 0; i < this.children.length; i++) {
  631. frag.appendChild(this.children[i].toNode());
  632. }
  633. return frag;
  634. }
  635. /** Convert the fragment into HTML markup. */
  636. toMarkup() {
  637. var markup = "";
  638. for (var i = 0; i < this.children.length; i++) {
  639. markup += this.children[i].toMarkup();
  640. }
  641. return markup;
  642. }
  643. /**
  644. * Converts the math node into a string, similar to innerText. Applies to
  645. * MathDomNode's only.
  646. */
  647. toText() {
  648. var toText = (child) => child.toText();
  649. return this.children.map(toText).join("");
  650. }
  651. };
  652. var ptPerUnit = {
  653. // https://en.wikibooks.org/wiki/LaTeX/Lengths and
  654. // https://tex.stackexchange.com/a/8263
  655. "pt": 1,
  656. // TeX point
  657. "mm": 7227 / 2540,
  658. // millimeter
  659. "cm": 7227 / 254,
  660. // centimeter
  661. "in": 72.27,
  662. // inch
  663. "bp": 803 / 800,
  664. // big (PostScript) points
  665. "pc": 12,
  666. // pica
  667. "dd": 1238 / 1157,
  668. // didot
  669. "cc": 14856 / 1157,
  670. // cicero (12 didot)
  671. "nd": 685 / 642,
  672. // new didot
  673. "nc": 1370 / 107,
  674. // new cicero (12 new didot)
  675. "sp": 1 / 65536,
  676. // scaled point (TeX's internal smallest unit)
  677. // https://tex.stackexchange.com/a/41371
  678. "px": 803 / 800
  679. // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX
  680. };
  681. var relativeUnit = {
  682. "ex": true,
  683. "em": true,
  684. "mu": true
  685. };
  686. var validUnit = function validUnit2(unit) {
  687. if (typeof unit !== "string") {
  688. unit = unit.unit;
  689. }
  690. return unit in ptPerUnit || unit in relativeUnit || unit === "ex";
  691. };
  692. var calculateSize = function calculateSize2(sizeValue, options) {
  693. var scale;
  694. if (sizeValue.unit in ptPerUnit) {
  695. scale = ptPerUnit[sizeValue.unit] / options.fontMetrics().ptPerEm / options.sizeMultiplier;
  696. } else if (sizeValue.unit === "mu") {
  697. scale = options.fontMetrics().cssEmPerMu;
  698. } else {
  699. var unitOptions;
  700. if (options.style.isTight()) {
  701. unitOptions = options.havingStyle(options.style.text());
  702. } else {
  703. unitOptions = options;
  704. }
  705. if (sizeValue.unit === "ex") {
  706. scale = unitOptions.fontMetrics().xHeight;
  707. } else if (sizeValue.unit === "em") {
  708. scale = unitOptions.fontMetrics().quad;
  709. } else {
  710. throw new ParseError("Invalid unit: '" + sizeValue.unit + "'");
  711. }
  712. if (unitOptions !== options) {
  713. scale *= unitOptions.sizeMultiplier / options.sizeMultiplier;
  714. }
  715. }
  716. return Math.min(sizeValue.number * scale, options.maxSize);
  717. };
  718. var makeEm = function makeEm2(n) {
  719. return +n.toFixed(4) + "em";
  720. };
  721. var createClass = function createClass2(classes) {
  722. return classes.filter((cls) => cls).join(" ");
  723. };
  724. var initNode = function initNode2(classes, options, style) {
  725. this.classes = classes || [];
  726. this.attributes = {};
  727. this.height = 0;
  728. this.depth = 0;
  729. this.maxFontSize = 0;
  730. this.style = style || {};
  731. if (options) {
  732. if (options.style.isTight()) {
  733. this.classes.push("mtight");
  734. }
  735. var color = options.getColor();
  736. if (color) {
  737. this.style.color = color;
  738. }
  739. }
  740. };
  741. var toNode = function toNode2(tagName) {
  742. var node = document.createElement(tagName);
  743. node.className = createClass(this.classes);
  744. for (var key of Object.keys(this.style)) {
  745. node.style[key] = this.style[key];
  746. }
  747. for (var attr of Object.keys(this.attributes)) {
  748. node.setAttribute(attr, this.attributes[attr]);
  749. }
  750. for (var i = 0; i < this.children.length; i++) {
  751. node.appendChild(this.children[i].toNode());
  752. }
  753. return node;
  754. };
  755. var invalidAttributeNameRegex = /[\s"'>/=\x00-\x1f]/;
  756. var toMarkup = function toMarkup2(tagName) {
  757. var markup = "<" + tagName;
  758. if (this.classes.length) {
  759. markup += ' class="' + escape(createClass(this.classes)) + '"';
  760. }
  761. var styles2 = "";
  762. for (var key of Object.keys(this.style)) {
  763. styles2 += hyphenate(key) + ":" + this.style[key] + ";";
  764. }
  765. if (styles2) {
  766. markup += ' style="' + escape(styles2) + '"';
  767. }
  768. for (var attr of Object.keys(this.attributes)) {
  769. if (invalidAttributeNameRegex.test(attr)) {
  770. throw new ParseError("Invalid attribute name '" + attr + "'");
  771. }
  772. markup += " " + attr + '="' + escape(this.attributes[attr]) + '"';
  773. }
  774. markup += ">";
  775. for (var i = 0; i < this.children.length; i++) {
  776. markup += this.children[i].toMarkup();
  777. }
  778. markup += "</" + tagName + ">";
  779. return markup;
  780. };
  781. var Span = class {
  782. constructor(classes, children, options, style) {
  783. initNode.call(this, classes, options, style);
  784. this.children = children || [];
  785. }
  786. /**
  787. * Sets an arbitrary attribute on the span. Warning: use this wisely. Not
  788. * all browsers support attributes the same, and having too many custom
  789. * attributes is probably bad.
  790. */
  791. setAttribute(attribute, value) {
  792. this.attributes[attribute] = value;
  793. }
  794. hasClass(className) {
  795. return this.classes.includes(className);
  796. }
  797. toNode() {
  798. return toNode.call(this, "span");
  799. }
  800. toMarkup() {
  801. return toMarkup.call(this, "span");
  802. }
  803. };
  804. var Anchor = class {
  805. constructor(href, classes, children, options) {
  806. initNode.call(this, classes, options);
  807. this.children = children || [];
  808. this.setAttribute("href", href);
  809. }
  810. setAttribute(attribute, value) {
  811. this.attributes[attribute] = value;
  812. }
  813. hasClass(className) {
  814. return this.classes.includes(className);
  815. }
  816. toNode() {
  817. return toNode.call(this, "a");
  818. }
  819. toMarkup() {
  820. return toMarkup.call(this, "a");
  821. }
  822. };
  823. var Img = class {
  824. constructor(src, alt, style) {
  825. this.alt = alt;
  826. this.src = src;
  827. this.classes = ["mord"];
  828. this.height = 0;
  829. this.depth = 0;
  830. this.maxFontSize = 0;
  831. this.style = style;
  832. }
  833. hasClass(className) {
  834. return this.classes.includes(className);
  835. }
  836. toNode() {
  837. var node = document.createElement("img");
  838. node.src = this.src;
  839. node.alt = this.alt;
  840. node.className = "mord";
  841. for (var key of Object.keys(this.style)) {
  842. node.style[key] = this.style[key];
  843. }
  844. return node;
  845. }
  846. toMarkup() {
  847. var markup = '<img src="' + escape(this.src) + '"' + (' alt="' + escape(this.alt) + '"');
  848. var styles2 = "";
  849. for (var key of Object.keys(this.style)) {
  850. styles2 += hyphenate(key) + ":" + this.style[key] + ";";
  851. }
  852. if (styles2) {
  853. markup += ' style="' + escape(styles2) + '"';
  854. }
  855. markup += "'/>";
  856. return markup;
  857. }
  858. };
  859. var iCombinations = {
  860. "î": "ı̂",
  861. "ï": "ı̈",
  862. "í": "ı́",
  863. // 'ī': '\u0131\u0304', // enable when we add Extended Latin
  864. "ì": "ı̀"
  865. };
  866. var SymbolNode = class {
  867. constructor(text2, height, depth, italic, skew, width, classes, style) {
  868. this.text = text2;
  869. this.height = height || 0;
  870. this.depth = depth || 0;
  871. this.italic = italic || 0;
  872. this.skew = skew || 0;
  873. this.width = width || 0;
  874. this.classes = classes || [];
  875. this.style = style || {};
  876. this.maxFontSize = 0;
  877. var script = scriptFromCodepoint(this.text.charCodeAt(0));
  878. if (script) {
  879. this.classes.push(script + "_fallback");
  880. }
  881. if (/[îïíì]/.test(this.text)) {
  882. this.text = iCombinations[this.text];
  883. }
  884. }
  885. hasClass(className) {
  886. return this.classes.includes(className);
  887. }
  888. /**
  889. * Creates a text node or span from a symbol node. Note that a span is only
  890. * created if it is needed.
  891. */
  892. toNode() {
  893. var node = document.createTextNode(this.text);
  894. var span = null;
  895. if (this.italic > 0) {
  896. span = document.createElement("span");
  897. span.style.marginRight = makeEm(this.italic);
  898. }
  899. if (this.classes.length > 0) {
  900. span = span || document.createElement("span");
  901. span.className = createClass(this.classes);
  902. }
  903. for (var key of Object.keys(this.style)) {
  904. span = span || document.createElement("span");
  905. span.style[key] = this.style[key];
  906. }
  907. if (span) {
  908. span.appendChild(node);
  909. return span;
  910. } else {
  911. return node;
  912. }
  913. }
  914. /**
  915. * Creates markup for a symbol node.
  916. */
  917. toMarkup() {
  918. var needsSpan = false;
  919. var markup = "<span";
  920. if (this.classes.length) {
  921. needsSpan = true;
  922. markup += ' class="';
  923. markup += escape(createClass(this.classes));
  924. markup += '"';
  925. }
  926. var styles2 = "";
  927. if (this.italic > 0) {
  928. styles2 += "margin-right:" + makeEm(this.italic) + ";";
  929. }
  930. for (var key of Object.keys(this.style)) {
  931. styles2 += hyphenate(key) + ":" + this.style[key] + ";";
  932. }
  933. if (styles2) {
  934. needsSpan = true;
  935. markup += ' style="' + escape(styles2) + '"';
  936. }
  937. var escaped = escape(this.text);
  938. if (needsSpan) {
  939. markup += ">";
  940. markup += escaped;
  941. markup += "</span>";
  942. return markup;
  943. } else {
  944. return escaped;
  945. }
  946. }
  947. };
  948. var SvgNode = class {
  949. constructor(children, attributes) {
  950. this.children = children || [];
  951. this.attributes = attributes || {};
  952. }
  953. toNode() {
  954. var svgNS = "http://www.w3.org/2000/svg";
  955. var node = document.createElementNS(svgNS, "svg");
  956. for (var attr of Object.keys(this.attributes)) {
  957. node.setAttribute(attr, this.attributes[attr]);
  958. }
  959. for (var i = 0; i < this.children.length; i++) {
  960. node.appendChild(this.children[i].toNode());
  961. }
  962. return node;
  963. }
  964. toMarkup() {
  965. var markup = '<svg xmlns="http://www.w3.org/2000/svg"';
  966. for (var attr of Object.keys(this.attributes)) {
  967. markup += " " + attr + '="' + escape(this.attributes[attr]) + '"';
  968. }
  969. markup += ">";
  970. for (var i = 0; i < this.children.length; i++) {
  971. markup += this.children[i].toMarkup();
  972. }
  973. markup += "</svg>";
  974. return markup;
  975. }
  976. };
  977. var PathNode = class {
  978. constructor(pathName, alternate) {
  979. this.pathName = pathName;
  980. this.alternate = alternate;
  981. }
  982. toNode() {
  983. var svgNS = "http://www.w3.org/2000/svg";
  984. var node = document.createElementNS(svgNS, "path");
  985. if (this.alternate) {
  986. node.setAttribute("d", this.alternate);
  987. } else {
  988. node.setAttribute("d", path[this.pathName]);
  989. }
  990. return node;
  991. }
  992. toMarkup() {
  993. if (this.alternate) {
  994. return '<path d="' + escape(this.alternate) + '"/>';
  995. } else {
  996. return '<path d="' + escape(path[this.pathName]) + '"/>';
  997. }
  998. }
  999. };
  1000. var LineNode = class {
  1001. constructor(attributes) {
  1002. this.attributes = attributes || {};
  1003. }
  1004. toNode() {
  1005. var svgNS = "http://www.w3.org/2000/svg";
  1006. var node = document.createElementNS(svgNS, "line");
  1007. for (var attr of Object.keys(this.attributes)) {
  1008. node.setAttribute(attr, this.attributes[attr]);
  1009. }
  1010. return node;
  1011. }
  1012. toMarkup() {
  1013. var markup = "<line";
  1014. for (var attr of Object.keys(this.attributes)) {
  1015. markup += " " + attr + '="' + escape(this.attributes[attr]) + '"';
  1016. }
  1017. markup += "/>";
  1018. return markup;
  1019. }
  1020. };
  1021. function assertSymbolDomNode(group) {
  1022. if (group instanceof SymbolNode) {
  1023. return group;
  1024. } else {
  1025. throw new Error("Expected symbolNode but got " + String(group) + ".");
  1026. }
  1027. }
  1028. function assertSpan(group) {
  1029. if (group instanceof Span) {
  1030. return group;
  1031. } else {
  1032. throw new Error("Expected span<HtmlDomNode> but got " + String(group) + ".");
  1033. }
  1034. }
  1035. var hasHtmlDomChildren = (node) => node instanceof Span || node instanceof Anchor || node instanceof DocumentFragment;
  1036. var fontMetricsData = {
  1037. "AMS-Regular": {
  1038. "32": [0, 0, 0, 0, 0.25],
  1039. "65": [0, 0.68889, 0, 0, 0.72222],
  1040. "66": [0, 0.68889, 0, 0, 0.66667],
  1041. "67": [0, 0.68889, 0, 0, 0.72222],
  1042. "68": [0, 0.68889, 0, 0, 0.72222],
  1043. "69": [0, 0.68889, 0, 0, 0.66667],
  1044. "70": [0, 0.68889, 0, 0, 0.61111],
  1045. "71": [0, 0.68889, 0, 0, 0.77778],
  1046. "72": [0, 0.68889, 0, 0, 0.77778],
  1047. "73": [0, 0.68889, 0, 0, 0.38889],
  1048. "74": [0.16667, 0.68889, 0, 0, 0.5],
  1049. "75": [0, 0.68889, 0, 0, 0.77778],
  1050. "76": [0, 0.68889, 0, 0, 0.66667],
  1051. "77": [0, 0.68889, 0, 0, 0.94445],
  1052. "78": [0, 0.68889, 0, 0, 0.72222],
  1053. "79": [0.16667, 0.68889, 0, 0, 0.77778],
  1054. "80": [0, 0.68889, 0, 0, 0.61111],
  1055. "81": [0.16667, 0.68889, 0, 0, 0.77778],
  1056. "82": [0, 0.68889, 0, 0, 0.72222],
  1057. "83": [0, 0.68889, 0, 0, 0.55556],
  1058. "84": [0, 0.68889, 0, 0, 0.66667],
  1059. "85": [0, 0.68889, 0, 0, 0.72222],
  1060. "86": [0, 0.68889, 0, 0, 0.72222],
  1061. "87": [0, 0.68889, 0, 0, 1],
  1062. "88": [0, 0.68889, 0, 0, 0.72222],
  1063. "89": [0, 0.68889, 0, 0, 0.72222],
  1064. "90": [0, 0.68889, 0, 0, 0.66667],
  1065. "107": [0, 0.68889, 0, 0, 0.55556],
  1066. "160": [0, 0, 0, 0, 0.25],
  1067. "165": [0, 0.675, 0.025, 0, 0.75],
  1068. "174": [0.15559, 0.69224, 0, 0, 0.94666],
  1069. "240": [0, 0.68889, 0, 0, 0.55556],
  1070. "295": [0, 0.68889, 0, 0, 0.54028],
  1071. "710": [0, 0.825, 0, 0, 2.33334],
  1072. "732": [0, 0.9, 0, 0, 2.33334],
  1073. "770": [0, 0.825, 0, 0, 2.33334],
  1074. "771": [0, 0.9, 0, 0, 2.33334],
  1075. "989": [0.08167, 0.58167, 0, 0, 0.77778],
  1076. "1008": [0, 0.43056, 0.04028, 0, 0.66667],
  1077. "8245": [0, 0.54986, 0, 0, 0.275],
  1078. "8463": [0, 0.68889, 0, 0, 0.54028],
  1079. "8487": [0, 0.68889, 0, 0, 0.72222],
  1080. "8498": [0, 0.68889, 0, 0, 0.55556],
  1081. "8502": [0, 0.68889, 0, 0, 0.66667],
  1082. "8503": [0, 0.68889, 0, 0, 0.44445],
  1083. "8504": [0, 0.68889, 0, 0, 0.66667],
  1084. "8513": [0, 0.68889, 0, 0, 0.63889],
  1085. "8592": [-0.03598, 0.46402, 0, 0, 0.5],
  1086. "8594": [-0.03598, 0.46402, 0, 0, 0.5],
  1087. "8602": [-0.13313, 0.36687, 0, 0, 1],
  1088. "8603": [-0.13313, 0.36687, 0, 0, 1],
  1089. "8606": [0.01354, 0.52239, 0, 0, 1],
  1090. "8608": [0.01354, 0.52239, 0, 0, 1],
  1091. "8610": [0.01354, 0.52239, 0, 0, 1.11111],
  1092. "8611": [0.01354, 0.52239, 0, 0, 1.11111],
  1093. "8619": [0, 0.54986, 0, 0, 1],
  1094. "8620": [0, 0.54986, 0, 0, 1],
  1095. "8621": [-0.13313, 0.37788, 0, 0, 1.38889],
  1096. "8622": [-0.13313, 0.36687, 0, 0, 1],
  1097. "8624": [0, 0.69224, 0, 0, 0.5],
  1098. "8625": [0, 0.69224, 0, 0, 0.5],
  1099. "8630": [0, 0.43056, 0, 0, 1],
  1100. "8631": [0, 0.43056, 0, 0, 1],
  1101. "8634": [0.08198, 0.58198, 0, 0, 0.77778],
  1102. "8635": [0.08198, 0.58198, 0, 0, 0.77778],
  1103. "8638": [0.19444, 0.69224, 0, 0, 0.41667],
  1104. "8639": [0.19444, 0.69224, 0, 0, 0.41667],
  1105. "8642": [0.19444, 0.69224, 0, 0, 0.41667],
  1106. "8643": [0.19444, 0.69224, 0, 0, 0.41667],
  1107. "8644": [0.1808, 0.675, 0, 0, 1],
  1108. "8646": [0.1808, 0.675, 0, 0, 1],
  1109. "8647": [0.1808, 0.675, 0, 0, 1],
  1110. "8648": [0.19444, 0.69224, 0, 0, 0.83334],
  1111. "8649": [0.1808, 0.675, 0, 0, 1],
  1112. "8650": [0.19444, 0.69224, 0, 0, 0.83334],
  1113. "8651": [0.01354, 0.52239, 0, 0, 1],
  1114. "8652": [0.01354, 0.52239, 0, 0, 1],
  1115. "8653": [-0.13313, 0.36687, 0, 0, 1],
  1116. "8654": [-0.13313, 0.36687, 0, 0, 1],
  1117. "8655": [-0.13313, 0.36687, 0, 0, 1],
  1118. "8666": [0.13667, 0.63667, 0, 0, 1],
  1119. "8667": [0.13667, 0.63667, 0, 0, 1],
  1120. "8669": [-0.13313, 0.37788, 0, 0, 1],
  1121. "8672": [-0.064, 0.437, 0, 0, 1.334],
  1122. "8674": [-0.064, 0.437, 0, 0, 1.334],
  1123. "8705": [0, 0.825, 0, 0, 0.5],
  1124. "8708": [0, 0.68889, 0, 0, 0.55556],
  1125. "8709": [0.08167, 0.58167, 0, 0, 0.77778],
  1126. "8717": [0, 0.43056, 0, 0, 0.42917],
  1127. "8722": [-0.03598, 0.46402, 0, 0, 0.5],
  1128. "8724": [0.08198, 0.69224, 0, 0, 0.77778],
  1129. "8726": [0.08167, 0.58167, 0, 0, 0.77778],
  1130. "8733": [0, 0.69224, 0, 0, 0.77778],
  1131. "8736": [0, 0.69224, 0, 0, 0.72222],
  1132. "8737": [0, 0.69224, 0, 0, 0.72222],
  1133. "8738": [0.03517, 0.52239, 0, 0, 0.72222],
  1134. "8739": [0.08167, 0.58167, 0, 0, 0.22222],
  1135. "8740": [0.25142, 0.74111, 0, 0, 0.27778],
  1136. "8741": [0.08167, 0.58167, 0, 0, 0.38889],
  1137. "8742": [0.25142, 0.74111, 0, 0, 0.5],
  1138. "8756": [0, 0.69224, 0, 0, 0.66667],
  1139. "8757": [0, 0.69224, 0, 0, 0.66667],
  1140. "8764": [-0.13313, 0.36687, 0, 0, 0.77778],
  1141. "8765": [-0.13313, 0.37788, 0, 0, 0.77778],
  1142. "8769": [-0.13313, 0.36687, 0, 0, 0.77778],
  1143. "8770": [-0.03625, 0.46375, 0, 0, 0.77778],
  1144. "8774": [0.30274, 0.79383, 0, 0, 0.77778],
  1145. "8776": [-0.01688, 0.48312, 0, 0, 0.77778],
  1146. "8778": [0.08167, 0.58167, 0, 0, 0.77778],
  1147. "8782": [0.06062, 0.54986, 0, 0, 0.77778],
  1148. "8783": [0.06062, 0.54986, 0, 0, 0.77778],
  1149. "8785": [0.08198, 0.58198, 0, 0, 0.77778],
  1150. "8786": [0.08198, 0.58198, 0, 0, 0.77778],
  1151. "8787": [0.08198, 0.58198, 0, 0, 0.77778],
  1152. "8790": [0, 0.69224, 0, 0, 0.77778],
  1153. "8791": [0.22958, 0.72958, 0, 0, 0.77778],
  1154. "8796": [0.08198, 0.91667, 0, 0, 0.77778],
  1155. "8806": [0.25583, 0.75583, 0, 0, 0.77778],
  1156. "8807": [0.25583, 0.75583, 0, 0, 0.77778],
  1157. "8808": [0.25142, 0.75726, 0, 0, 0.77778],
  1158. "8809": [0.25142, 0.75726, 0, 0, 0.77778],
  1159. "8812": [0.25583, 0.75583, 0, 0, 0.5],
  1160. "8814": [0.20576, 0.70576, 0, 0, 0.77778],
  1161. "8815": [0.20576, 0.70576, 0, 0, 0.77778],
  1162. "8816": [0.30274, 0.79383, 0, 0, 0.77778],
  1163. "8817": [0.30274, 0.79383, 0, 0, 0.77778],
  1164. "8818": [0.22958, 0.72958, 0, 0, 0.77778],
  1165. "8819": [0.22958, 0.72958, 0, 0, 0.77778],
  1166. "8822": [0.1808, 0.675, 0, 0, 0.77778],
  1167. "8823": [0.1808, 0.675, 0, 0, 0.77778],
  1168. "8828": [0.13667, 0.63667, 0, 0, 0.77778],
  1169. "8829": [0.13667, 0.63667, 0, 0, 0.77778],
  1170. "8830": [0.22958, 0.72958, 0, 0, 0.77778],
  1171. "8831": [0.22958, 0.72958, 0, 0, 0.77778],
  1172. "8832": [0.20576, 0.70576, 0, 0, 0.77778],
  1173. "8833": [0.20576, 0.70576, 0, 0, 0.77778],
  1174. "8840": [0.30274, 0.79383, 0, 0, 0.77778],
  1175. "8841": [0.30274, 0.79383, 0, 0, 0.77778],
  1176. "8842": [0.13597, 0.63597, 0, 0, 0.77778],
  1177. "8843": [0.13597, 0.63597, 0, 0, 0.77778],
  1178. "8847": [0.03517, 0.54986, 0, 0, 0.77778],
  1179. "8848": [0.03517, 0.54986, 0, 0, 0.77778],
  1180. "8858": [0.08198, 0.58198, 0, 0, 0.77778],
  1181. "8859": [0.08198, 0.58198, 0, 0, 0.77778],
  1182. "8861": [0.08198, 0.58198, 0, 0, 0.77778],
  1183. "8862": [0, 0.675, 0, 0, 0.77778],
  1184. "8863": [0, 0.675, 0, 0, 0.77778],
  1185. "8864": [0, 0.675, 0, 0, 0.77778],
  1186. "8865": [0, 0.675, 0, 0, 0.77778],
  1187. "8872": [0, 0.69224, 0, 0, 0.61111],
  1188. "8873": [0, 0.69224, 0, 0, 0.72222],
  1189. "8874": [0, 0.69224, 0, 0, 0.88889],
  1190. "8876": [0, 0.68889, 0, 0, 0.61111],
  1191. "8877": [0, 0.68889, 0, 0, 0.61111],
  1192. "8878": [0, 0.68889, 0, 0, 0.72222],
  1193. "8879": [0, 0.68889, 0, 0, 0.72222],
  1194. "8882": [0.03517, 0.54986, 0, 0, 0.77778],
  1195. "8883": [0.03517, 0.54986, 0, 0, 0.77778],
  1196. "8884": [0.13667, 0.63667, 0, 0, 0.77778],
  1197. "8885": [0.13667, 0.63667, 0, 0, 0.77778],
  1198. "8888": [0, 0.54986, 0, 0, 1.11111],
  1199. "8890": [0.19444, 0.43056, 0, 0, 0.55556],
  1200. "8891": [0.19444, 0.69224, 0, 0, 0.61111],
  1201. "8892": [0.19444, 0.69224, 0, 0, 0.61111],
  1202. "8901": [0, 0.54986, 0, 0, 0.27778],
  1203. "8903": [0.08167, 0.58167, 0, 0, 0.77778],
  1204. "8905": [0.08167, 0.58167, 0, 0, 0.77778],
  1205. "8906": [0.08167, 0.58167, 0, 0, 0.77778],
  1206. "8907": [0, 0.69224, 0, 0, 0.77778],
  1207. "8908": [0, 0.69224, 0, 0, 0.77778],
  1208. "8909": [-0.03598, 0.46402, 0, 0, 0.77778],
  1209. "8910": [0, 0.54986, 0, 0, 0.76042],
  1210. "8911": [0, 0.54986, 0, 0, 0.76042],
  1211. "8912": [0.03517, 0.54986, 0, 0, 0.77778],
  1212. "8913": [0.03517, 0.54986, 0, 0, 0.77778],
  1213. "8914": [0, 0.54986, 0, 0, 0.66667],
  1214. "8915": [0, 0.54986, 0, 0, 0.66667],
  1215. "8916": [0, 0.69224, 0, 0, 0.66667],
  1216. "8918": [0.0391, 0.5391, 0, 0, 0.77778],
  1217. "8919": [0.0391, 0.5391, 0, 0, 0.77778],
  1218. "8920": [0.03517, 0.54986, 0, 0, 1.33334],
  1219. "8921": [0.03517, 0.54986, 0, 0, 1.33334],
  1220. "8922": [0.38569, 0.88569, 0, 0, 0.77778],
  1221. "8923": [0.38569, 0.88569, 0, 0, 0.77778],
  1222. "8926": [0.13667, 0.63667, 0, 0, 0.77778],
  1223. "8927": [0.13667, 0.63667, 0, 0, 0.77778],
  1224. "8928": [0.30274, 0.79383, 0, 0, 0.77778],
  1225. "8929": [0.30274, 0.79383, 0, 0, 0.77778],
  1226. "8934": [0.23222, 0.74111, 0, 0, 0.77778],
  1227. "8935": [0.23222, 0.74111, 0, 0, 0.77778],
  1228. "8936": [0.23222, 0.74111, 0, 0, 0.77778],
  1229. "8937": [0.23222, 0.74111, 0, 0, 0.77778],
  1230. "8938": [0.20576, 0.70576, 0, 0, 0.77778],
  1231. "8939": [0.20576, 0.70576, 0, 0, 0.77778],
  1232. "8940": [0.30274, 0.79383, 0, 0, 0.77778],
  1233. "8941": [0.30274, 0.79383, 0, 0, 0.77778],
  1234. "8994": [0.19444, 0.69224, 0, 0, 0.77778],
  1235. "8995": [0.19444, 0.69224, 0, 0, 0.77778],
  1236. "9416": [0.15559, 0.69224, 0, 0, 0.90222],
  1237. "9484": [0, 0.69224, 0, 0, 0.5],
  1238. "9488": [0, 0.69224, 0, 0, 0.5],
  1239. "9492": [0, 0.37788, 0, 0, 0.5],
  1240. "9496": [0, 0.37788, 0, 0, 0.5],
  1241. "9585": [0.19444, 0.68889, 0, 0, 0.88889],
  1242. "9586": [0.19444, 0.74111, 0, 0, 0.88889],
  1243. "9632": [0, 0.675, 0, 0, 0.77778],
  1244. "9633": [0, 0.675, 0, 0, 0.77778],
  1245. "9650": [0, 0.54986, 0, 0, 0.72222],
  1246. "9651": [0, 0.54986, 0, 0, 0.72222],
  1247. "9654": [0.03517, 0.54986, 0, 0, 0.77778],
  1248. "9660": [0, 0.54986, 0, 0, 0.72222],
  1249. "9661": [0, 0.54986, 0, 0, 0.72222],
  1250. "9664": [0.03517, 0.54986, 0, 0, 0.77778],
  1251. "9674": [0.11111, 0.69224, 0, 0, 0.66667],
  1252. "9733": [0.19444, 0.69224, 0, 0, 0.94445],
  1253. "10003": [0, 0.69224, 0, 0, 0.83334],
  1254. "10016": [0, 0.69224, 0, 0, 0.83334],
  1255. "10731": [0.11111, 0.69224, 0, 0, 0.66667],
  1256. "10846": [0.19444, 0.75583, 0, 0, 0.61111],
  1257. "10877": [0.13667, 0.63667, 0, 0, 0.77778],
  1258. "10878": [0.13667, 0.63667, 0, 0, 0.77778],
  1259. "10885": [0.25583, 0.75583, 0, 0, 0.77778],
  1260. "10886": [0.25583, 0.75583, 0, 0, 0.77778],
  1261. "10887": [0.13597, 0.63597, 0, 0, 0.77778],
  1262. "10888": [0.13597, 0.63597, 0, 0, 0.77778],
  1263. "10889": [0.26167, 0.75726, 0, 0, 0.77778],
  1264. "10890": [0.26167, 0.75726, 0, 0, 0.77778],
  1265. "10891": [0.48256, 0.98256, 0, 0, 0.77778],
  1266. "10892": [0.48256, 0.98256, 0, 0, 0.77778],
  1267. "10901": [0.13667, 0.63667, 0, 0, 0.77778],
  1268. "10902": [0.13667, 0.63667, 0, 0, 0.77778],
  1269. "10933": [0.25142, 0.75726, 0, 0, 0.77778],
  1270. "10934": [0.25142, 0.75726, 0, 0, 0.77778],
  1271. "10935": [0.26167, 0.75726, 0, 0, 0.77778],
  1272. "10936": [0.26167, 0.75726, 0, 0, 0.77778],
  1273. "10937": [0.26167, 0.75726, 0, 0, 0.77778],
  1274. "10938": [0.26167, 0.75726, 0, 0, 0.77778],
  1275. "10949": [0.25583, 0.75583, 0, 0, 0.77778],
  1276. "10950": [0.25583, 0.75583, 0, 0, 0.77778],
  1277. "10955": [0.28481, 0.79383, 0, 0, 0.77778],
  1278. "10956": [0.28481, 0.79383, 0, 0, 0.77778],
  1279. "57350": [0.08167, 0.58167, 0, 0, 0.22222],
  1280. "57351": [0.08167, 0.58167, 0, 0, 0.38889],
  1281. "57352": [0.08167, 0.58167, 0, 0, 0.77778],
  1282. "57353": [0, 0.43056, 0.04028, 0, 0.66667],
  1283. "57356": [0.25142, 0.75726, 0, 0, 0.77778],
  1284. "57357": [0.25142, 0.75726, 0, 0, 0.77778],
  1285. "57358": [0.41951, 0.91951, 0, 0, 0.77778],
  1286. "57359": [0.30274, 0.79383, 0, 0, 0.77778],
  1287. "57360": [0.30274, 0.79383, 0, 0, 0.77778],
  1288. "57361": [0.41951, 0.91951, 0, 0, 0.77778],
  1289. "57366": [0.25142, 0.75726, 0, 0, 0.77778],
  1290. "57367": [0.25142, 0.75726, 0, 0, 0.77778],
  1291. "57368": [0.25142, 0.75726, 0, 0, 0.77778],
  1292. "57369": [0.25142, 0.75726, 0, 0, 0.77778],
  1293. "57370": [0.13597, 0.63597, 0, 0, 0.77778],
  1294. "57371": [0.13597, 0.63597, 0, 0, 0.77778]
  1295. },
  1296. "Caligraphic-Regular": {
  1297. "32": [0, 0, 0, 0, 0.25],
  1298. "65": [0, 0.68333, 0, 0.19445, 0.79847],
  1299. "66": [0, 0.68333, 0.03041, 0.13889, 0.65681],
  1300. "67": [0, 0.68333, 0.05834, 0.13889, 0.52653],
  1301. "68": [0, 0.68333, 0.02778, 0.08334, 0.77139],
  1302. "69": [0, 0.68333, 0.08944, 0.11111, 0.52778],
  1303. "70": [0, 0.68333, 0.09931, 0.11111, 0.71875],
  1304. "71": [0.09722, 0.68333, 0.0593, 0.11111, 0.59487],
  1305. "72": [0, 0.68333, 965e-5, 0.11111, 0.84452],
  1306. "73": [0, 0.68333, 0.07382, 0, 0.54452],
  1307. "74": [0.09722, 0.68333, 0.18472, 0.16667, 0.67778],
  1308. "75": [0, 0.68333, 0.01445, 0.05556, 0.76195],
  1309. "76": [0, 0.68333, 0, 0.13889, 0.68972],
  1310. "77": [0, 0.68333, 0, 0.13889, 1.2009],
  1311. "78": [0, 0.68333, 0.14736, 0.08334, 0.82049],
  1312. "79": [0, 0.68333, 0.02778, 0.11111, 0.79611],
  1313. "80": [0, 0.68333, 0.08222, 0.08334, 0.69556],
  1314. "81": [0.09722, 0.68333, 0, 0.11111, 0.81667],
  1315. "82": [0, 0.68333, 0, 0.08334, 0.8475],
  1316. "83": [0, 0.68333, 0.075, 0.13889, 0.60556],
  1317. "84": [0, 0.68333, 0.25417, 0, 0.54464],
  1318. "85": [0, 0.68333, 0.09931, 0.08334, 0.62583],
  1319. "86": [0, 0.68333, 0.08222, 0, 0.61278],
  1320. "87": [0, 0.68333, 0.08222, 0.08334, 0.98778],
  1321. "88": [0, 0.68333, 0.14643, 0.13889, 0.7133],
  1322. "89": [0.09722, 0.68333, 0.08222, 0.08334, 0.66834],
  1323. "90": [0, 0.68333, 0.07944, 0.13889, 0.72473],
  1324. "160": [0, 0, 0, 0, 0.25]
  1325. },
  1326. "Fraktur-Regular": {
  1327. "32": [0, 0, 0, 0, 0.25],
  1328. "33": [0, 0.69141, 0, 0, 0.29574],
  1329. "34": [0, 0.69141, 0, 0, 0.21471],
  1330. "38": [0, 0.69141, 0, 0, 0.73786],
  1331. "39": [0, 0.69141, 0, 0, 0.21201],
  1332. "40": [0.24982, 0.74947, 0, 0, 0.38865],
  1333. "41": [0.24982, 0.74947, 0, 0, 0.38865],
  1334. "42": [0, 0.62119, 0, 0, 0.27764],
  1335. "43": [0.08319, 0.58283, 0, 0, 0.75623],
  1336. "44": [0, 0.10803, 0, 0, 0.27764],
  1337. "45": [0.08319, 0.58283, 0, 0, 0.75623],
  1338. "46": [0, 0.10803, 0, 0, 0.27764],
  1339. "47": [0.24982, 0.74947, 0, 0, 0.50181],
  1340. "48": [0, 0.47534, 0, 0, 0.50181],
  1341. "49": [0, 0.47534, 0, 0, 0.50181],
  1342. "50": [0, 0.47534, 0, 0, 0.50181],
  1343. "51": [0.18906, 0.47534, 0, 0, 0.50181],
  1344. "52": [0.18906, 0.47534, 0, 0, 0.50181],
  1345. "53": [0.18906, 0.47534, 0, 0, 0.50181],
  1346. "54": [0, 0.69141, 0, 0, 0.50181],
  1347. "55": [0.18906, 0.47534, 0, 0, 0.50181],
  1348. "56": [0, 0.69141, 0, 0, 0.50181],
  1349. "57": [0.18906, 0.47534, 0, 0, 0.50181],
  1350. "58": [0, 0.47534, 0, 0, 0.21606],
  1351. "59": [0.12604, 0.47534, 0, 0, 0.21606],
  1352. "61": [-0.13099, 0.36866, 0, 0, 0.75623],
  1353. "63": [0, 0.69141, 0, 0, 0.36245],
  1354. "65": [0, 0.69141, 0, 0, 0.7176],
  1355. "66": [0, 0.69141, 0, 0, 0.88397],
  1356. "67": [0, 0.69141, 0, 0, 0.61254],
  1357. "68": [0, 0.69141, 0, 0, 0.83158],
  1358. "69": [0, 0.69141, 0, 0, 0.66278],
  1359. "70": [0.12604, 0.69141, 0, 0, 0.61119],
  1360. "71": [0, 0.69141, 0, 0, 0.78539],
  1361. "72": [0.06302, 0.69141, 0, 0, 0.7203],
  1362. "73": [0, 0.69141, 0, 0, 0.55448],
  1363. "74": [0.12604, 0.69141, 0, 0, 0.55231],
  1364. "75": [0, 0.69141, 0, 0, 0.66845],
  1365. "76": [0, 0.69141, 0, 0, 0.66602],
  1366. "77": [0, 0.69141, 0, 0, 1.04953],
  1367. "78": [0, 0.69141, 0, 0, 0.83212],
  1368. "79": [0, 0.69141, 0, 0, 0.82699],
  1369. "80": [0.18906, 0.69141, 0, 0, 0.82753],
  1370. "81": [0.03781, 0.69141, 0, 0, 0.82699],
  1371. "82": [0, 0.69141, 0, 0, 0.82807],
  1372. "83": [0, 0.69141, 0, 0, 0.82861],
  1373. "84": [0, 0.69141, 0, 0, 0.66899],
  1374. "85": [0, 0.69141, 0, 0, 0.64576],
  1375. "86": [0, 0.69141, 0, 0, 0.83131],
  1376. "87": [0, 0.69141, 0, 0, 1.04602],
  1377. "88": [0, 0.69141, 0, 0, 0.71922],
  1378. "89": [0.18906, 0.69141, 0, 0, 0.83293],
  1379. "90": [0.12604, 0.69141, 0, 0, 0.60201],
  1380. "91": [0.24982, 0.74947, 0, 0, 0.27764],
  1381. "93": [0.24982, 0.74947, 0, 0, 0.27764],
  1382. "94": [0, 0.69141, 0, 0, 0.49965],
  1383. "97": [0, 0.47534, 0, 0, 0.50046],
  1384. "98": [0, 0.69141, 0, 0, 0.51315],
  1385. "99": [0, 0.47534, 0, 0, 0.38946],
  1386. "100": [0, 0.62119, 0, 0, 0.49857],
  1387. "101": [0, 0.47534, 0, 0, 0.40053],
  1388. "102": [0.18906, 0.69141, 0, 0, 0.32626],
  1389. "103": [0.18906, 0.47534, 0, 0, 0.5037],
  1390. "104": [0.18906, 0.69141, 0, 0, 0.52126],
  1391. "105": [0, 0.69141, 0, 0, 0.27899],
  1392. "106": [0, 0.69141, 0, 0, 0.28088],
  1393. "107": [0, 0.69141, 0, 0, 0.38946],
  1394. "108": [0, 0.69141, 0, 0, 0.27953],
  1395. "109": [0, 0.47534, 0, 0, 0.76676],
  1396. "110": [0, 0.47534, 0, 0, 0.52666],
  1397. "111": [0, 0.47534, 0, 0, 0.48885],
  1398. "112": [0.18906, 0.52396, 0, 0, 0.50046],
  1399. "113": [0.18906, 0.47534, 0, 0, 0.48912],
  1400. "114": [0, 0.47534, 0, 0, 0.38919],
  1401. "115": [0, 0.47534, 0, 0, 0.44266],
  1402. "116": [0, 0.62119, 0, 0, 0.33301],
  1403. "117": [0, 0.47534, 0, 0, 0.5172],
  1404. "118": [0, 0.52396, 0, 0, 0.5118],
  1405. "119": [0, 0.52396, 0, 0, 0.77351],
  1406. "120": [0.18906, 0.47534, 0, 0, 0.38865],
  1407. "121": [0.18906, 0.47534, 0, 0, 0.49884],
  1408. "122": [0.18906, 0.47534, 0, 0, 0.39054],
  1409. "160": [0, 0, 0, 0, 0.25],
  1410. "8216": [0, 0.69141, 0, 0, 0.21471],
  1411. "8217": [0, 0.69141, 0, 0, 0.21471],
  1412. "58112": [0, 0.62119, 0, 0, 0.49749],
  1413. "58113": [0, 0.62119, 0, 0, 0.4983],
  1414. "58114": [0.18906, 0.69141, 0, 0, 0.33328],
  1415. "58115": [0.18906, 0.69141, 0, 0, 0.32923],
  1416. "58116": [0.18906, 0.47534, 0, 0, 0.50343],
  1417. "58117": [0, 0.69141, 0, 0, 0.33301],
  1418. "58118": [0, 0.62119, 0, 0, 0.33409],
  1419. "58119": [0, 0.47534, 0, 0, 0.50073]
  1420. },
  1421. "Main-Bold": {
  1422. "32": [0, 0, 0, 0, 0.25],
  1423. "33": [0, 0.69444, 0, 0, 0.35],
  1424. "34": [0, 0.69444, 0, 0, 0.60278],
  1425. "35": [0.19444, 0.69444, 0, 0, 0.95833],
  1426. "36": [0.05556, 0.75, 0, 0, 0.575],
  1427. "37": [0.05556, 0.75, 0, 0, 0.95833],
  1428. "38": [0, 0.69444, 0, 0, 0.89444],
  1429. "39": [0, 0.69444, 0, 0, 0.31944],
  1430. "40": [0.25, 0.75, 0, 0, 0.44722],
  1431. "41": [0.25, 0.75, 0, 0, 0.44722],
  1432. "42": [0, 0.75, 0, 0, 0.575],
  1433. "43": [0.13333, 0.63333, 0, 0, 0.89444],
  1434. "44": [0.19444, 0.15556, 0, 0, 0.31944],
  1435. "45": [0, 0.44444, 0, 0, 0.38333],
  1436. "46": [0, 0.15556, 0, 0, 0.31944],
  1437. "47": [0.25, 0.75, 0, 0, 0.575],
  1438. "48": [0, 0.64444, 0, 0, 0.575],
  1439. "49": [0, 0.64444, 0, 0, 0.575],
  1440. "50": [0, 0.64444, 0, 0, 0.575],
  1441. "51": [0, 0.64444, 0, 0, 0.575],
  1442. "52": [0, 0.64444, 0, 0, 0.575],
  1443. "53": [0, 0.64444, 0, 0, 0.575],
  1444. "54": [0, 0.64444, 0, 0, 0.575],
  1445. "55": [0, 0.64444, 0, 0, 0.575],
  1446. "56": [0, 0.64444, 0, 0, 0.575],
  1447. "57": [0, 0.64444, 0, 0, 0.575],
  1448. "58": [0, 0.44444, 0, 0, 0.31944],
  1449. "59": [0.19444, 0.44444, 0, 0, 0.31944],
  1450. "60": [0.08556, 0.58556, 0, 0, 0.89444],
  1451. "61": [-0.10889, 0.39111, 0, 0, 0.89444],
  1452. "62": [0.08556, 0.58556, 0, 0, 0.89444],
  1453. "63": [0, 0.69444, 0, 0, 0.54305],
  1454. "64": [0, 0.69444, 0, 0, 0.89444],
  1455. "65": [0, 0.68611, 0, 0, 0.86944],
  1456. "66": [0, 0.68611, 0, 0, 0.81805],
  1457. "67": [0, 0.68611, 0, 0, 0.83055],
  1458. "68": [0, 0.68611, 0, 0, 0.88194],
  1459. "69": [0, 0.68611, 0, 0, 0.75555],
  1460. "70": [0, 0.68611, 0, 0, 0.72361],
  1461. "71": [0, 0.68611, 0, 0, 0.90416],
  1462. "72": [0, 0.68611, 0, 0, 0.9],
  1463. "73": [0, 0.68611, 0, 0, 0.43611],
  1464. "74": [0, 0.68611, 0, 0, 0.59444],
  1465. "75": [0, 0.68611, 0, 0, 0.90138],
  1466. "76": [0, 0.68611, 0, 0, 0.69166],
  1467. "77": [0, 0.68611, 0, 0, 1.09166],
  1468. "78": [0, 0.68611, 0, 0, 0.9],
  1469. "79": [0, 0.68611, 0, 0, 0.86388],
  1470. "80": [0, 0.68611, 0, 0, 0.78611],
  1471. "81": [0.19444, 0.68611, 0, 0, 0.86388],
  1472. "82": [0, 0.68611, 0, 0, 0.8625],
  1473. "83": [0, 0.68611, 0, 0, 0.63889],
  1474. "84": [0, 0.68611, 0, 0, 0.8],
  1475. "85": [0, 0.68611, 0, 0, 0.88472],
  1476. "86": [0, 0.68611, 0.01597, 0, 0.86944],
  1477. "87": [0, 0.68611, 0.01597, 0, 1.18888],
  1478. "88": [0, 0.68611, 0, 0, 0.86944],
  1479. "89": [0, 0.68611, 0.02875, 0, 0.86944],
  1480. "90": [0, 0.68611, 0, 0, 0.70277],
  1481. "91": [0.25, 0.75, 0, 0, 0.31944],
  1482. "92": [0.25, 0.75, 0, 0, 0.575],
  1483. "93": [0.25, 0.75, 0, 0, 0.31944],
  1484. "94": [0, 0.69444, 0, 0, 0.575],
  1485. "95": [0.31, 0.13444, 0.03194, 0, 0.575],
  1486. "97": [0, 0.44444, 0, 0, 0.55902],
  1487. "98": [0, 0.69444, 0, 0, 0.63889],
  1488. "99": [0, 0.44444, 0, 0, 0.51111],
  1489. "100": [0, 0.69444, 0, 0, 0.63889],
  1490. "101": [0, 0.44444, 0, 0, 0.52708],
  1491. "102": [0, 0.69444, 0.10903, 0, 0.35139],
  1492. "103": [0.19444, 0.44444, 0.01597, 0, 0.575],
  1493. "104": [0, 0.69444, 0, 0, 0.63889],
  1494. "105": [0, 0.69444, 0, 0, 0.31944],
  1495. "106": [0.19444, 0.69444, 0, 0, 0.35139],
  1496. "107": [0, 0.69444, 0, 0, 0.60694],
  1497. "108": [0, 0.69444, 0, 0, 0.31944],
  1498. "109": [0, 0.44444, 0, 0, 0.95833],
  1499. "110": [0, 0.44444, 0, 0, 0.63889],
  1500. "111": [0, 0.44444, 0, 0, 0.575],
  1501. "112": [0.19444, 0.44444, 0, 0, 0.63889],
  1502. "113": [0.19444, 0.44444, 0, 0, 0.60694],
  1503. "114": [0, 0.44444, 0, 0, 0.47361],
  1504. "115": [0, 0.44444, 0, 0, 0.45361],
  1505. "116": [0, 0.63492, 0, 0, 0.44722],
  1506. "117": [0, 0.44444, 0, 0, 0.63889],
  1507. "118": [0, 0.44444, 0.01597, 0, 0.60694],
  1508. "119": [0, 0.44444, 0.01597, 0, 0.83055],
  1509. "120": [0, 0.44444, 0, 0, 0.60694],
  1510. "121": [0.19444, 0.44444, 0.01597, 0, 0.60694],
  1511. "122": [0, 0.44444, 0, 0, 0.51111],
  1512. "123": [0.25, 0.75, 0, 0, 0.575],
  1513. "124": [0.25, 0.75, 0, 0, 0.31944],
  1514. "125": [0.25, 0.75, 0, 0, 0.575],
  1515. "126": [0.35, 0.34444, 0, 0, 0.575],
  1516. "160": [0, 0, 0, 0, 0.25],
  1517. "163": [0, 0.69444, 0, 0, 0.86853],
  1518. "168": [0, 0.69444, 0, 0, 0.575],
  1519. "172": [0, 0.44444, 0, 0, 0.76666],
  1520. "176": [0, 0.69444, 0, 0, 0.86944],
  1521. "177": [0.13333, 0.63333, 0, 0, 0.89444],
  1522. "184": [0.17014, 0, 0, 0, 0.51111],
  1523. "198": [0, 0.68611, 0, 0, 1.04166],
  1524. "215": [0.13333, 0.63333, 0, 0, 0.89444],
  1525. "216": [0.04861, 0.73472, 0, 0, 0.89444],
  1526. "223": [0, 0.69444, 0, 0, 0.59722],
  1527. "230": [0, 0.44444, 0, 0, 0.83055],
  1528. "247": [0.13333, 0.63333, 0, 0, 0.89444],
  1529. "248": [0.09722, 0.54167, 0, 0, 0.575],
  1530. "305": [0, 0.44444, 0, 0, 0.31944],
  1531. "338": [0, 0.68611, 0, 0, 1.16944],
  1532. "339": [0, 0.44444, 0, 0, 0.89444],
  1533. "567": [0.19444, 0.44444, 0, 0, 0.35139],
  1534. "710": [0, 0.69444, 0, 0, 0.575],
  1535. "711": [0, 0.63194, 0, 0, 0.575],
  1536. "713": [0, 0.59611, 0, 0, 0.575],
  1537. "714": [0, 0.69444, 0, 0, 0.575],
  1538. "715": [0, 0.69444, 0, 0, 0.575],
  1539. "728": [0, 0.69444, 0, 0, 0.575],
  1540. "729": [0, 0.69444, 0, 0, 0.31944],
  1541. "730": [0, 0.69444, 0, 0, 0.86944],
  1542. "732": [0, 0.69444, 0, 0, 0.575],
  1543. "733": [0, 0.69444, 0, 0, 0.575],
  1544. "915": [0, 0.68611, 0, 0, 0.69166],
  1545. "916": [0, 0.68611, 0, 0, 0.95833],
  1546. "920": [0, 0.68611, 0, 0, 0.89444],
  1547. "923": [0, 0.68611, 0, 0, 0.80555],
  1548. "926": [0, 0.68611, 0, 0, 0.76666],
  1549. "928": [0, 0.68611, 0, 0, 0.9],
  1550. "931": [0, 0.68611, 0, 0, 0.83055],
  1551. "933": [0, 0.68611, 0, 0, 0.89444],
  1552. "934": [0, 0.68611, 0, 0, 0.83055],
  1553. "936": [0, 0.68611, 0, 0, 0.89444],
  1554. "937": [0, 0.68611, 0, 0, 0.83055],
  1555. "8211": [0, 0.44444, 0.03194, 0, 0.575],
  1556. "8212": [0, 0.44444, 0.03194, 0, 1.14999],
  1557. "8216": [0, 0.69444, 0, 0, 0.31944],
  1558. "8217": [0, 0.69444, 0, 0, 0.31944],
  1559. "8220": [0, 0.69444, 0, 0, 0.60278],
  1560. "8221": [0, 0.69444, 0, 0, 0.60278],
  1561. "8224": [0.19444, 0.69444, 0, 0, 0.51111],
  1562. "8225": [0.19444, 0.69444, 0, 0, 0.51111],
  1563. "8242": [0, 0.55556, 0, 0, 0.34444],
  1564. "8407": [0, 0.72444, 0.15486, 0, 0.575],
  1565. "8463": [0, 0.69444, 0, 0, 0.66759],
  1566. "8465": [0, 0.69444, 0, 0, 0.83055],
  1567. "8467": [0, 0.69444, 0, 0, 0.47361],
  1568. "8472": [0.19444, 0.44444, 0, 0, 0.74027],
  1569. "8476": [0, 0.69444, 0, 0, 0.83055],
  1570. "8501": [0, 0.69444, 0, 0, 0.70277],
  1571. "8592": [-0.10889, 0.39111, 0, 0, 1.14999],
  1572. "8593": [0.19444, 0.69444, 0, 0, 0.575],
  1573. "8594": [-0.10889, 0.39111, 0, 0, 1.14999],
  1574. "8595": [0.19444, 0.69444, 0, 0, 0.575],
  1575. "8596": [-0.10889, 0.39111, 0, 0, 1.14999],
  1576. "8597": [0.25, 0.75, 0, 0, 0.575],
  1577. "8598": [0.19444, 0.69444, 0, 0, 1.14999],
  1578. "8599": [0.19444, 0.69444, 0, 0, 1.14999],
  1579. "8600": [0.19444, 0.69444, 0, 0, 1.14999],
  1580. "8601": [0.19444, 0.69444, 0, 0, 1.14999],
  1581. "8636": [-0.10889, 0.39111, 0, 0, 1.14999],
  1582. "8637": [-0.10889, 0.39111, 0, 0, 1.14999],
  1583. "8640": [-0.10889, 0.39111, 0, 0, 1.14999],
  1584. "8641": [-0.10889, 0.39111, 0, 0, 1.14999],
  1585. "8656": [-0.10889, 0.39111, 0, 0, 1.14999],
  1586. "8657": [0.19444, 0.69444, 0, 0, 0.70277],
  1587. "8658": [-0.10889, 0.39111, 0, 0, 1.14999],
  1588. "8659": [0.19444, 0.69444, 0, 0, 0.70277],
  1589. "8660": [-0.10889, 0.39111, 0, 0, 1.14999],
  1590. "8661": [0.25, 0.75, 0, 0, 0.70277],
  1591. "8704": [0, 0.69444, 0, 0, 0.63889],
  1592. "8706": [0, 0.69444, 0.06389, 0, 0.62847],
  1593. "8707": [0, 0.69444, 0, 0, 0.63889],
  1594. "8709": [0.05556, 0.75, 0, 0, 0.575],
  1595. "8711": [0, 0.68611, 0, 0, 0.95833],
  1596. "8712": [0.08556, 0.58556, 0, 0, 0.76666],
  1597. "8715": [0.08556, 0.58556, 0, 0, 0.76666],
  1598. "8722": [0.13333, 0.63333, 0, 0, 0.89444],
  1599. "8723": [0.13333, 0.63333, 0, 0, 0.89444],
  1600. "8725": [0.25, 0.75, 0, 0, 0.575],
  1601. "8726": [0.25, 0.75, 0, 0, 0.575],
  1602. "8727": [-0.02778, 0.47222, 0, 0, 0.575],
  1603. "8728": [-0.02639, 0.47361, 0, 0, 0.575],
  1604. "8729": [-0.02639, 0.47361, 0, 0, 0.575],
  1605. "8730": [0.18, 0.82, 0, 0, 0.95833],
  1606. "8733": [0, 0.44444, 0, 0, 0.89444],
  1607. "8734": [0, 0.44444, 0, 0, 1.14999],
  1608. "8736": [0, 0.69224, 0, 0, 0.72222],
  1609. "8739": [0.25, 0.75, 0, 0, 0.31944],
  1610. "8741": [0.25, 0.75, 0, 0, 0.575],
  1611. "8743": [0, 0.55556, 0, 0, 0.76666],
  1612. "8744": [0, 0.55556, 0, 0, 0.76666],
  1613. "8745": [0, 0.55556, 0, 0, 0.76666],
  1614. "8746": [0, 0.55556, 0, 0, 0.76666],
  1615. "8747": [0.19444, 0.69444, 0.12778, 0, 0.56875],
  1616. "8764": [-0.10889, 0.39111, 0, 0, 0.89444],
  1617. "8768": [0.19444, 0.69444, 0, 0, 0.31944],
  1618. "8771": [222e-5, 0.50222, 0, 0, 0.89444],
  1619. "8773": [0.027, 0.638, 0, 0, 0.894],
  1620. "8776": [0.02444, 0.52444, 0, 0, 0.89444],
  1621. "8781": [222e-5, 0.50222, 0, 0, 0.89444],
  1622. "8801": [222e-5, 0.50222, 0, 0, 0.89444],
  1623. "8804": [0.19667, 0.69667, 0, 0, 0.89444],
  1624. "8805": [0.19667, 0.69667, 0, 0, 0.89444],
  1625. "8810": [0.08556, 0.58556, 0, 0, 1.14999],
  1626. "8811": [0.08556, 0.58556, 0, 0, 1.14999],
  1627. "8826": [0.08556, 0.58556, 0, 0, 0.89444],
  1628. "8827": [0.08556, 0.58556, 0, 0, 0.89444],
  1629. "8834": [0.08556, 0.58556, 0, 0, 0.89444],
  1630. "8835": [0.08556, 0.58556, 0, 0, 0.89444],
  1631. "8838": [0.19667, 0.69667, 0, 0, 0.89444],
  1632. "8839": [0.19667, 0.69667, 0, 0, 0.89444],
  1633. "8846": [0, 0.55556, 0, 0, 0.76666],
  1634. "8849": [0.19667, 0.69667, 0, 0, 0.89444],
  1635. "8850": [0.19667, 0.69667, 0, 0, 0.89444],
  1636. "8851": [0, 0.55556, 0, 0, 0.76666],
  1637. "8852": [0, 0.55556, 0, 0, 0.76666],
  1638. "8853": [0.13333, 0.63333, 0, 0, 0.89444],
  1639. "8854": [0.13333, 0.63333, 0, 0, 0.89444],
  1640. "8855": [0.13333, 0.63333, 0, 0, 0.89444],
  1641. "8856": [0.13333, 0.63333, 0, 0, 0.89444],
  1642. "8857": [0.13333, 0.63333, 0, 0, 0.89444],
  1643. "8866": [0, 0.69444, 0, 0, 0.70277],
  1644. "8867": [0, 0.69444, 0, 0, 0.70277],
  1645. "8868": [0, 0.69444, 0, 0, 0.89444],
  1646. "8869": [0, 0.69444, 0, 0, 0.89444],
  1647. "8900": [-0.02639, 0.47361, 0, 0, 0.575],
  1648. "8901": [-0.02639, 0.47361, 0, 0, 0.31944],
  1649. "8902": [-0.02778, 0.47222, 0, 0, 0.575],
  1650. "8968": [0.25, 0.75, 0, 0, 0.51111],
  1651. "8969": [0.25, 0.75, 0, 0, 0.51111],
  1652. "8970": [0.25, 0.75, 0, 0, 0.51111],
  1653. "8971": [0.25, 0.75, 0, 0, 0.51111],
  1654. "8994": [-0.13889, 0.36111, 0, 0, 1.14999],
  1655. "8995": [-0.13889, 0.36111, 0, 0, 1.14999],
  1656. "9651": [0.19444, 0.69444, 0, 0, 1.02222],
  1657. "9657": [-0.02778, 0.47222, 0, 0, 0.575],
  1658. "9661": [0.19444, 0.69444, 0, 0, 1.02222],
  1659. "9667": [-0.02778, 0.47222, 0, 0, 0.575],
  1660. "9711": [0.19444, 0.69444, 0, 0, 1.14999],
  1661. "9824": [0.12963, 0.69444, 0, 0, 0.89444],
  1662. "9825": [0.12963, 0.69444, 0, 0, 0.89444],
  1663. "9826": [0.12963, 0.69444, 0, 0, 0.89444],
  1664. "9827": [0.12963, 0.69444, 0, 0, 0.89444],
  1665. "9837": [0, 0.75, 0, 0, 0.44722],
  1666. "9838": [0.19444, 0.69444, 0, 0, 0.44722],
  1667. "9839": [0.19444, 0.69444, 0, 0, 0.44722],
  1668. "10216": [0.25, 0.75, 0, 0, 0.44722],
  1669. "10217": [0.25, 0.75, 0, 0, 0.44722],
  1670. "10815": [0, 0.68611, 0, 0, 0.9],
  1671. "10927": [0.19667, 0.69667, 0, 0, 0.89444],
  1672. "10928": [0.19667, 0.69667, 0, 0, 0.89444],
  1673. "57376": [0.19444, 0.69444, 0, 0, 0]
  1674. },
  1675. "Main-BoldItalic": {
  1676. "32": [0, 0, 0, 0, 0.25],
  1677. "33": [0, 0.69444, 0.11417, 0, 0.38611],
  1678. "34": [0, 0.69444, 0.07939, 0, 0.62055],
  1679. "35": [0.19444, 0.69444, 0.06833, 0, 0.94444],
  1680. "37": [0.05556, 0.75, 0.12861, 0, 0.94444],
  1681. "38": [0, 0.69444, 0.08528, 0, 0.88555],
  1682. "39": [0, 0.69444, 0.12945, 0, 0.35555],
  1683. "40": [0.25, 0.75, 0.15806, 0, 0.47333],
  1684. "41": [0.25, 0.75, 0.03306, 0, 0.47333],
  1685. "42": [0, 0.75, 0.14333, 0, 0.59111],
  1686. "43": [0.10333, 0.60333, 0.03306, 0, 0.88555],
  1687. "44": [0.19444, 0.14722, 0, 0, 0.35555],
  1688. "45": [0, 0.44444, 0.02611, 0, 0.41444],
  1689. "46": [0, 0.14722, 0, 0, 0.35555],
  1690. "47": [0.25, 0.75, 0.15806, 0, 0.59111],
  1691. "48": [0, 0.64444, 0.13167, 0, 0.59111],
  1692. "49": [0, 0.64444, 0.13167, 0, 0.59111],
  1693. "50": [0, 0.64444, 0.13167, 0, 0.59111],
  1694. "51": [0, 0.64444, 0.13167, 0, 0.59111],
  1695. "52": [0.19444, 0.64444, 0.13167, 0, 0.59111],
  1696. "53": [0, 0.64444, 0.13167, 0, 0.59111],
  1697. "54": [0, 0.64444, 0.13167, 0, 0.59111],
  1698. "55": [0.19444, 0.64444, 0.13167, 0, 0.59111],
  1699. "56": [0, 0.64444, 0.13167, 0, 0.59111],
  1700. "57": [0, 0.64444, 0.13167, 0, 0.59111],
  1701. "58": [0, 0.44444, 0.06695, 0, 0.35555],
  1702. "59": [0.19444, 0.44444, 0.06695, 0, 0.35555],
  1703. "61": [-0.10889, 0.39111, 0.06833, 0, 0.88555],
  1704. "63": [0, 0.69444, 0.11472, 0, 0.59111],
  1705. "64": [0, 0.69444, 0.09208, 0, 0.88555],
  1706. "65": [0, 0.68611, 0, 0, 0.86555],
  1707. "66": [0, 0.68611, 0.0992, 0, 0.81666],
  1708. "67": [0, 0.68611, 0.14208, 0, 0.82666],
  1709. "68": [0, 0.68611, 0.09062, 0, 0.87555],
  1710. "69": [0, 0.68611, 0.11431, 0, 0.75666],
  1711. "70": [0, 0.68611, 0.12903, 0, 0.72722],
  1712. "71": [0, 0.68611, 0.07347, 0, 0.89527],
  1713. "72": [0, 0.68611, 0.17208, 0, 0.8961],
  1714. "73": [0, 0.68611, 0.15681, 0, 0.47166],
  1715. "74": [0, 0.68611, 0.145, 0, 0.61055],
  1716. "75": [0, 0.68611, 0.14208, 0, 0.89499],
  1717. "76": [0, 0.68611, 0, 0, 0.69777],
  1718. "77": [0, 0.68611, 0.17208, 0, 1.07277],
  1719. "78": [0, 0.68611, 0.17208, 0, 0.8961],
  1720. "79": [0, 0.68611, 0.09062, 0, 0.85499],
  1721. "80": [0, 0.68611, 0.0992, 0, 0.78721],
  1722. "81": [0.19444, 0.68611, 0.09062, 0, 0.85499],
  1723. "82": [0, 0.68611, 0.02559, 0, 0.85944],
  1724. "83": [0, 0.68611, 0.11264, 0, 0.64999],
  1725. "84": [0, 0.68611, 0.12903, 0, 0.7961],
  1726. "85": [0, 0.68611, 0.17208, 0, 0.88083],
  1727. "86": [0, 0.68611, 0.18625, 0, 0.86555],
  1728. "87": [0, 0.68611, 0.18625, 0, 1.15999],
  1729. "88": [0, 0.68611, 0.15681, 0, 0.86555],
  1730. "89": [0, 0.68611, 0.19803, 0, 0.86555],
  1731. "90": [0, 0.68611, 0.14208, 0, 0.70888],
  1732. "91": [0.25, 0.75, 0.1875, 0, 0.35611],
  1733. "93": [0.25, 0.75, 0.09972, 0, 0.35611],
  1734. "94": [0, 0.69444, 0.06709, 0, 0.59111],
  1735. "95": [0.31, 0.13444, 0.09811, 0, 0.59111],
  1736. "97": [0, 0.44444, 0.09426, 0, 0.59111],
  1737. "98": [0, 0.69444, 0.07861, 0, 0.53222],
  1738. "99": [0, 0.44444, 0.05222, 0, 0.53222],
  1739. "100": [0, 0.69444, 0.10861, 0, 0.59111],
  1740. "101": [0, 0.44444, 0.085, 0, 0.53222],
  1741. "102": [0.19444, 0.69444, 0.21778, 0, 0.4],
  1742. "103": [0.19444, 0.44444, 0.105, 0, 0.53222],
  1743. "104": [0, 0.69444, 0.09426, 0, 0.59111],
  1744. "105": [0, 0.69326, 0.11387, 0, 0.35555],
  1745. "106": [0.19444, 0.69326, 0.1672, 0, 0.35555],
  1746. "107": [0, 0.69444, 0.11111, 0, 0.53222],
  1747. "108": [0, 0.69444, 0.10861, 0, 0.29666],
  1748. "109": [0, 0.44444, 0.09426, 0, 0.94444],
  1749. "110": [0, 0.44444, 0.09426, 0, 0.64999],
  1750. "111": [0, 0.44444, 0.07861, 0, 0.59111],
  1751. "112": [0.19444, 0.44444, 0.07861, 0, 0.59111],
  1752. "113": [0.19444, 0.44444, 0.105, 0, 0.53222],
  1753. "114": [0, 0.44444, 0.11111, 0, 0.50167],
  1754. "115": [0, 0.44444, 0.08167, 0, 0.48694],
  1755. "116": [0, 0.63492, 0.09639, 0, 0.385],
  1756. "117": [0, 0.44444, 0.09426, 0, 0.62055],
  1757. "118": [0, 0.44444, 0.11111, 0, 0.53222],
  1758. "119": [0, 0.44444, 0.11111, 0, 0.76777],
  1759. "120": [0, 0.44444, 0.12583, 0, 0.56055],
  1760. "121": [0.19444, 0.44444, 0.105, 0, 0.56166],
  1761. "122": [0, 0.44444, 0.13889, 0, 0.49055],
  1762. "126": [0.35, 0.34444, 0.11472, 0, 0.59111],
  1763. "160": [0, 0, 0, 0, 0.25],
  1764. "168": [0, 0.69444, 0.11473, 0, 0.59111],
  1765. "176": [0, 0.69444, 0, 0, 0.94888],
  1766. "184": [0.17014, 0, 0, 0, 0.53222],
  1767. "198": [0, 0.68611, 0.11431, 0, 1.02277],
  1768. "216": [0.04861, 0.73472, 0.09062, 0, 0.88555],
  1769. "223": [0.19444, 0.69444, 0.09736, 0, 0.665],
  1770. "230": [0, 0.44444, 0.085, 0, 0.82666],
  1771. "248": [0.09722, 0.54167, 0.09458, 0, 0.59111],
  1772. "305": [0, 0.44444, 0.09426, 0, 0.35555],
  1773. "338": [0, 0.68611, 0.11431, 0, 1.14054],
  1774. "339": [0, 0.44444, 0.085, 0, 0.82666],
  1775. "567": [0.19444, 0.44444, 0.04611, 0, 0.385],
  1776. "710": [0, 0.69444, 0.06709, 0, 0.59111],
  1777. "711": [0, 0.63194, 0.08271, 0, 0.59111],
  1778. "713": [0, 0.59444, 0.10444, 0, 0.59111],
  1779. "714": [0, 0.69444, 0.08528, 0, 0.59111],
  1780. "715": [0, 0.69444, 0, 0, 0.59111],
  1781. "728": [0, 0.69444, 0.10333, 0, 0.59111],
  1782. "729": [0, 0.69444, 0.12945, 0, 0.35555],
  1783. "730": [0, 0.69444, 0, 0, 0.94888],
  1784. "732": [0, 0.69444, 0.11472, 0, 0.59111],
  1785. "733": [0, 0.69444, 0.11472, 0, 0.59111],
  1786. "915": [0, 0.68611, 0.12903, 0, 0.69777],
  1787. "916": [0, 0.68611, 0, 0, 0.94444],
  1788. "920": [0, 0.68611, 0.09062, 0, 0.88555],
  1789. "923": [0, 0.68611, 0, 0, 0.80666],
  1790. "926": [0, 0.68611, 0.15092, 0, 0.76777],
  1791. "928": [0, 0.68611, 0.17208, 0, 0.8961],
  1792. "931": [0, 0.68611, 0.11431, 0, 0.82666],
  1793. "933": [0, 0.68611, 0.10778, 0, 0.88555],
  1794. "934": [0, 0.68611, 0.05632, 0, 0.82666],
  1795. "936": [0, 0.68611, 0.10778, 0, 0.88555],
  1796. "937": [0, 0.68611, 0.0992, 0, 0.82666],
  1797. "8211": [0, 0.44444, 0.09811, 0, 0.59111],
  1798. "8212": [0, 0.44444, 0.09811, 0, 1.18221],
  1799. "8216": [0, 0.69444, 0.12945, 0, 0.35555],
  1800. "8217": [0, 0.69444, 0.12945, 0, 0.35555],
  1801. "8220": [0, 0.69444, 0.16772, 0, 0.62055],
  1802. "8221": [0, 0.69444, 0.07939, 0, 0.62055]
  1803. },
  1804. "Main-Italic": {
  1805. "32": [0, 0, 0, 0, 0.25],
  1806. "33": [0, 0.69444, 0.12417, 0, 0.30667],
  1807. "34": [0, 0.69444, 0.06961, 0, 0.51444],
  1808. "35": [0.19444, 0.69444, 0.06616, 0, 0.81777],
  1809. "37": [0.05556, 0.75, 0.13639, 0, 0.81777],
  1810. "38": [0, 0.69444, 0.09694, 0, 0.76666],
  1811. "39": [0, 0.69444, 0.12417, 0, 0.30667],
  1812. "40": [0.25, 0.75, 0.16194, 0, 0.40889],
  1813. "41": [0.25, 0.75, 0.03694, 0, 0.40889],
  1814. "42": [0, 0.75, 0.14917, 0, 0.51111],
  1815. "43": [0.05667, 0.56167, 0.03694, 0, 0.76666],
  1816. "44": [0.19444, 0.10556, 0, 0, 0.30667],
  1817. "45": [0, 0.43056, 0.02826, 0, 0.35778],
  1818. "46": [0, 0.10556, 0, 0, 0.30667],
  1819. "47": [0.25, 0.75, 0.16194, 0, 0.51111],
  1820. "48": [0, 0.64444, 0.13556, 0, 0.51111],
  1821. "49": [0, 0.64444, 0.13556, 0, 0.51111],
  1822. "50": [0, 0.64444, 0.13556, 0, 0.51111],
  1823. "51": [0, 0.64444, 0.13556, 0, 0.51111],
  1824. "52": [0.19444, 0.64444, 0.13556, 0, 0.51111],
  1825. "53": [0, 0.64444, 0.13556, 0, 0.51111],
  1826. "54": [0, 0.64444, 0.13556, 0, 0.51111],
  1827. "55": [0.19444, 0.64444, 0.13556, 0, 0.51111],
  1828. "56": [0, 0.64444, 0.13556, 0, 0.51111],
  1829. "57": [0, 0.64444, 0.13556, 0, 0.51111],
  1830. "58": [0, 0.43056, 0.0582, 0, 0.30667],
  1831. "59": [0.19444, 0.43056, 0.0582, 0, 0.30667],
  1832. "61": [-0.13313, 0.36687, 0.06616, 0, 0.76666],
  1833. "63": [0, 0.69444, 0.1225, 0, 0.51111],
  1834. "64": [0, 0.69444, 0.09597, 0, 0.76666],
  1835. "65": [0, 0.68333, 0, 0, 0.74333],
  1836. "66": [0, 0.68333, 0.10257, 0, 0.70389],
  1837. "67": [0, 0.68333, 0.14528, 0, 0.71555],
  1838. "68": [0, 0.68333, 0.09403, 0, 0.755],
  1839. "69": [0, 0.68333, 0.12028, 0, 0.67833],
  1840. "70": [0, 0.68333, 0.13305, 0, 0.65277],
  1841. "71": [0, 0.68333, 0.08722, 0, 0.77361],
  1842. "72": [0, 0.68333, 0.16389, 0, 0.74333],
  1843. "73": [0, 0.68333, 0.15806, 0, 0.38555],
  1844. "74": [0, 0.68333, 0.14028, 0, 0.525],
  1845. "75": [0, 0.68333, 0.14528, 0, 0.76888],
  1846. "76": [0, 0.68333, 0, 0, 0.62722],
  1847. "77": [0, 0.68333, 0.16389, 0, 0.89666],
  1848. "78": [0, 0.68333, 0.16389, 0, 0.74333],
  1849. "79": [0, 0.68333, 0.09403, 0, 0.76666],
  1850. "80": [0, 0.68333, 0.10257, 0, 0.67833],
  1851. "81": [0.19444, 0.68333, 0.09403, 0, 0.76666],
  1852. "82": [0, 0.68333, 0.03868, 0, 0.72944],
  1853. "83": [0, 0.68333, 0.11972, 0, 0.56222],
  1854. "84": [0, 0.68333, 0.13305, 0, 0.71555],
  1855. "85": [0, 0.68333, 0.16389, 0, 0.74333],
  1856. "86": [0, 0.68333, 0.18361, 0, 0.74333],
  1857. "87": [0, 0.68333, 0.18361, 0, 0.99888],
  1858. "88": [0, 0.68333, 0.15806, 0, 0.74333],
  1859. "89": [0, 0.68333, 0.19383, 0, 0.74333],
  1860. "90": [0, 0.68333, 0.14528, 0, 0.61333],
  1861. "91": [0.25, 0.75, 0.1875, 0, 0.30667],
  1862. "93": [0.25, 0.75, 0.10528, 0, 0.30667],
  1863. "94": [0, 0.69444, 0.06646, 0, 0.51111],
  1864. "95": [0.31, 0.12056, 0.09208, 0, 0.51111],
  1865. "97": [0, 0.43056, 0.07671, 0, 0.51111],
  1866. "98": [0, 0.69444, 0.06312, 0, 0.46],
  1867. "99": [0, 0.43056, 0.05653, 0, 0.46],
  1868. "100": [0, 0.69444, 0.10333, 0, 0.51111],
  1869. "101": [0, 0.43056, 0.07514, 0, 0.46],
  1870. "102": [0.19444, 0.69444, 0.21194, 0, 0.30667],
  1871. "103": [0.19444, 0.43056, 0.08847, 0, 0.46],
  1872. "104": [0, 0.69444, 0.07671, 0, 0.51111],
  1873. "105": [0, 0.65536, 0.1019, 0, 0.30667],
  1874. "106": [0.19444, 0.65536, 0.14467, 0, 0.30667],
  1875. "107": [0, 0.69444, 0.10764, 0, 0.46],
  1876. "108": [0, 0.69444, 0.10333, 0, 0.25555],
  1877. "109": [0, 0.43056, 0.07671, 0, 0.81777],
  1878. "110": [0, 0.43056, 0.07671, 0, 0.56222],
  1879. "111": [0, 0.43056, 0.06312, 0, 0.51111],
  1880. "112": [0.19444, 0.43056, 0.06312, 0, 0.51111],
  1881. "113": [0.19444, 0.43056, 0.08847, 0, 0.46],
  1882. "114": [0, 0.43056, 0.10764, 0, 0.42166],
  1883. "115": [0, 0.43056, 0.08208, 0, 0.40889],
  1884. "116": [0, 0.61508, 0.09486, 0, 0.33222],
  1885. "117": [0, 0.43056, 0.07671, 0, 0.53666],
  1886. "118": [0, 0.43056, 0.10764, 0, 0.46],
  1887. "119": [0, 0.43056, 0.10764, 0, 0.66444],
  1888. "120": [0, 0.43056, 0.12042, 0, 0.46389],
  1889. "121": [0.19444, 0.43056, 0.08847, 0, 0.48555],
  1890. "122": [0, 0.43056, 0.12292, 0, 0.40889],
  1891. "126": [0.35, 0.31786, 0.11585, 0, 0.51111],
  1892. "160": [0, 0, 0, 0, 0.25],
  1893. "168": [0, 0.66786, 0.10474, 0, 0.51111],
  1894. "176": [0, 0.69444, 0, 0, 0.83129],
  1895. "184": [0.17014, 0, 0, 0, 0.46],
  1896. "198": [0, 0.68333, 0.12028, 0, 0.88277],
  1897. "216": [0.04861, 0.73194, 0.09403, 0, 0.76666],
  1898. "223": [0.19444, 0.69444, 0.10514, 0, 0.53666],
  1899. "230": [0, 0.43056, 0.07514, 0, 0.71555],
  1900. "248": [0.09722, 0.52778, 0.09194, 0, 0.51111],
  1901. "338": [0, 0.68333, 0.12028, 0, 0.98499],
  1902. "339": [0, 0.43056, 0.07514, 0, 0.71555],
  1903. "710": [0, 0.69444, 0.06646, 0, 0.51111],
  1904. "711": [0, 0.62847, 0.08295, 0, 0.51111],
  1905. "713": [0, 0.56167, 0.10333, 0, 0.51111],
  1906. "714": [0, 0.69444, 0.09694, 0, 0.51111],
  1907. "715": [0, 0.69444, 0, 0, 0.51111],
  1908. "728": [0, 0.69444, 0.10806, 0, 0.51111],
  1909. "729": [0, 0.66786, 0.11752, 0, 0.30667],
  1910. "730": [0, 0.69444, 0, 0, 0.83129],
  1911. "732": [0, 0.66786, 0.11585, 0, 0.51111],
  1912. "733": [0, 0.69444, 0.1225, 0, 0.51111],
  1913. "915": [0, 0.68333, 0.13305, 0, 0.62722],
  1914. "916": [0, 0.68333, 0, 0, 0.81777],
  1915. "920": [0, 0.68333, 0.09403, 0, 0.76666],
  1916. "923": [0, 0.68333, 0, 0, 0.69222],
  1917. "926": [0, 0.68333, 0.15294, 0, 0.66444],
  1918. "928": [0, 0.68333, 0.16389, 0, 0.74333],
  1919. "931": [0, 0.68333, 0.12028, 0, 0.71555],
  1920. "933": [0, 0.68333, 0.11111, 0, 0.76666],
  1921. "934": [0, 0.68333, 0.05986, 0, 0.71555],
  1922. "936": [0, 0.68333, 0.11111, 0, 0.76666],
  1923. "937": [0, 0.68333, 0.10257, 0, 0.71555],
  1924. "8211": [0, 0.43056, 0.09208, 0, 0.51111],
  1925. "8212": [0, 0.43056, 0.09208, 0, 1.02222],
  1926. "8216": [0, 0.69444, 0.12417, 0, 0.30667],
  1927. "8217": [0, 0.69444, 0.12417, 0, 0.30667],
  1928. "8220": [0, 0.69444, 0.1685, 0, 0.51444],
  1929. "8221": [0, 0.69444, 0.06961, 0, 0.51444],
  1930. "8463": [0, 0.68889, 0, 0, 0.54028]
  1931. },
  1932. "Main-Regular": {
  1933. "32": [0, 0, 0, 0, 0.25],
  1934. "33": [0, 0.69444, 0, 0, 0.27778],
  1935. "34": [0, 0.69444, 0, 0, 0.5],
  1936. "35": [0.19444, 0.69444, 0, 0, 0.83334],
  1937. "36": [0.05556, 0.75, 0, 0, 0.5],
  1938. "37": [0.05556, 0.75, 0, 0, 0.83334],
  1939. "38": [0, 0.69444, 0, 0, 0.77778],
  1940. "39": [0, 0.69444, 0, 0, 0.27778],
  1941. "40": [0.25, 0.75, 0, 0, 0.38889],
  1942. "41": [0.25, 0.75, 0, 0, 0.38889],
  1943. "42": [0, 0.75, 0, 0, 0.5],
  1944. "43": [0.08333, 0.58333, 0, 0, 0.77778],
  1945. "44": [0.19444, 0.10556, 0, 0, 0.27778],
  1946. "45": [0, 0.43056, 0, 0, 0.33333],
  1947. "46": [0, 0.10556, 0, 0, 0.27778],
  1948. "47": [0.25, 0.75, 0, 0, 0.5],
  1949. "48": [0, 0.64444, 0, 0, 0.5],
  1950. "49": [0, 0.64444, 0, 0, 0.5],
  1951. "50": [0, 0.64444, 0, 0, 0.5],
  1952. "51": [0, 0.64444, 0, 0, 0.5],
  1953. "52": [0, 0.64444, 0, 0, 0.5],
  1954. "53": [0, 0.64444, 0, 0, 0.5],
  1955. "54": [0, 0.64444, 0, 0, 0.5],
  1956. "55": [0, 0.64444, 0, 0, 0.5],
  1957. "56": [0, 0.64444, 0, 0, 0.5],
  1958. "57": [0, 0.64444, 0, 0, 0.5],
  1959. "58": [0, 0.43056, 0, 0, 0.27778],
  1960. "59": [0.19444, 0.43056, 0, 0, 0.27778],
  1961. "60": [0.0391, 0.5391, 0, 0, 0.77778],
  1962. "61": [-0.13313, 0.36687, 0, 0, 0.77778],
  1963. "62": [0.0391, 0.5391, 0, 0, 0.77778],
  1964. "63": [0, 0.69444, 0, 0, 0.47222],
  1965. "64": [0, 0.69444, 0, 0, 0.77778],
  1966. "65": [0, 0.68333, 0, 0, 0.75],
  1967. "66": [0, 0.68333, 0, 0, 0.70834],
  1968. "67": [0, 0.68333, 0, 0, 0.72222],
  1969. "68": [0, 0.68333, 0, 0, 0.76389],
  1970. "69": [0, 0.68333, 0, 0, 0.68056],
  1971. "70": [0, 0.68333, 0, 0, 0.65278],
  1972. "71": [0, 0.68333, 0, 0, 0.78472],
  1973. "72": [0, 0.68333, 0, 0, 0.75],
  1974. "73": [0, 0.68333, 0, 0, 0.36111],
  1975. "74": [0, 0.68333, 0, 0, 0.51389],
  1976. "75": [0, 0.68333, 0, 0, 0.77778],
  1977. "76": [0, 0.68333, 0, 0, 0.625],
  1978. "77": [0, 0.68333, 0, 0, 0.91667],
  1979. "78": [0, 0.68333, 0, 0, 0.75],
  1980. "79": [0, 0.68333, 0, 0, 0.77778],
  1981. "80": [0, 0.68333, 0, 0, 0.68056],
  1982. "81": [0.19444, 0.68333, 0, 0, 0.77778],
  1983. "82": [0, 0.68333, 0, 0, 0.73611],
  1984. "83": [0, 0.68333, 0, 0, 0.55556],
  1985. "84": [0, 0.68333, 0, 0, 0.72222],
  1986. "85": [0, 0.68333, 0, 0, 0.75],
  1987. "86": [0, 0.68333, 0.01389, 0, 0.75],
  1988. "87": [0, 0.68333, 0.01389, 0, 1.02778],
  1989. "88": [0, 0.68333, 0, 0, 0.75],
  1990. "89": [0, 0.68333, 0.025, 0, 0.75],
  1991. "90": [0, 0.68333, 0, 0, 0.61111],
  1992. "91": [0.25, 0.75, 0, 0, 0.27778],
  1993. "92": [0.25, 0.75, 0, 0, 0.5],
  1994. "93": [0.25, 0.75, 0, 0, 0.27778],
  1995. "94": [0, 0.69444, 0, 0, 0.5],
  1996. "95": [0.31, 0.12056, 0.02778, 0, 0.5],
  1997. "97": [0, 0.43056, 0, 0, 0.5],
  1998. "98": [0, 0.69444, 0, 0, 0.55556],
  1999. "99": [0, 0.43056, 0, 0, 0.44445],
  2000. "100": [0, 0.69444, 0, 0, 0.55556],
  2001. "101": [0, 0.43056, 0, 0, 0.44445],
  2002. "102": [0, 0.69444, 0.07778, 0, 0.30556],
  2003. "103": [0.19444, 0.43056, 0.01389, 0, 0.5],
  2004. "104": [0, 0.69444, 0, 0, 0.55556],
  2005. "105": [0, 0.66786, 0, 0, 0.27778],
  2006. "106": [0.19444, 0.66786, 0, 0, 0.30556],
  2007. "107": [0, 0.69444, 0, 0, 0.52778],
  2008. "108": [0, 0.69444, 0, 0, 0.27778],
  2009. "109": [0, 0.43056, 0, 0, 0.83334],
  2010. "110": [0, 0.43056, 0, 0, 0.55556],
  2011. "111": [0, 0.43056, 0, 0, 0.5],
  2012. "112": [0.19444, 0.43056, 0, 0, 0.55556],
  2013. "113": [0.19444, 0.43056, 0, 0, 0.52778],
  2014. "114": [0, 0.43056, 0, 0, 0.39167],
  2015. "115": [0, 0.43056, 0, 0, 0.39445],
  2016. "116": [0, 0.61508, 0, 0, 0.38889],
  2017. "117": [0, 0.43056, 0, 0, 0.55556],
  2018. "118": [0, 0.43056, 0.01389, 0, 0.52778],
  2019. "119": [0, 0.43056, 0.01389, 0, 0.72222],
  2020. "120": [0, 0.43056, 0, 0, 0.52778],
  2021. "121": [0.19444, 0.43056, 0.01389, 0, 0.52778],
  2022. "122": [0, 0.43056, 0, 0, 0.44445],
  2023. "123": [0.25, 0.75, 0, 0, 0.5],
  2024. "124": [0.25, 0.75, 0, 0, 0.27778],
  2025. "125": [0.25, 0.75, 0, 0, 0.5],
  2026. "126": [0.35, 0.31786, 0, 0, 0.5],
  2027. "160": [0, 0, 0, 0, 0.25],
  2028. "163": [0, 0.69444, 0, 0, 0.76909],
  2029. "167": [0.19444, 0.69444, 0, 0, 0.44445],
  2030. "168": [0, 0.66786, 0, 0, 0.5],
  2031. "172": [0, 0.43056, 0, 0, 0.66667],
  2032. "176": [0, 0.69444, 0, 0, 0.75],
  2033. "177": [0.08333, 0.58333, 0, 0, 0.77778],
  2034. "182": [0.19444, 0.69444, 0, 0, 0.61111],
  2035. "184": [0.17014, 0, 0, 0, 0.44445],
  2036. "198": [0, 0.68333, 0, 0, 0.90278],
  2037. "215": [0.08333, 0.58333, 0, 0, 0.77778],
  2038. "216": [0.04861, 0.73194, 0, 0, 0.77778],
  2039. "223": [0, 0.69444, 0, 0, 0.5],
  2040. "230": [0, 0.43056, 0, 0, 0.72222],
  2041. "247": [0.08333, 0.58333, 0, 0, 0.77778],
  2042. "248": [0.09722, 0.52778, 0, 0, 0.5],
  2043. "305": [0, 0.43056, 0, 0, 0.27778],
  2044. "338": [0, 0.68333, 0, 0, 1.01389],
  2045. "339": [0, 0.43056, 0, 0, 0.77778],
  2046. "567": [0.19444, 0.43056, 0, 0, 0.30556],
  2047. "710": [0, 0.69444, 0, 0, 0.5],
  2048. "711": [0, 0.62847, 0, 0, 0.5],
  2049. "713": [0, 0.56778, 0, 0, 0.5],
  2050. "714": [0, 0.69444, 0, 0, 0.5],
  2051. "715": [0, 0.69444, 0, 0, 0.5],
  2052. "728": [0, 0.69444, 0, 0, 0.5],
  2053. "729": [0, 0.66786, 0, 0, 0.27778],
  2054. "730": [0, 0.69444, 0, 0, 0.75],
  2055. "732": [0, 0.66786, 0, 0, 0.5],
  2056. "733": [0, 0.69444, 0, 0, 0.5],
  2057. "915": [0, 0.68333, 0, 0, 0.625],
  2058. "916": [0, 0.68333, 0, 0, 0.83334],
  2059. "920": [0, 0.68333, 0, 0, 0.77778],
  2060. "923": [0, 0.68333, 0, 0, 0.69445],
  2061. "926": [0, 0.68333, 0, 0, 0.66667],
  2062. "928": [0, 0.68333, 0, 0, 0.75],
  2063. "931": [0, 0.68333, 0, 0, 0.72222],
  2064. "933": [0, 0.68333, 0, 0, 0.77778],
  2065. "934": [0, 0.68333, 0, 0, 0.72222],
  2066. "936": [0, 0.68333, 0, 0, 0.77778],
  2067. "937": [0, 0.68333, 0, 0, 0.72222],
  2068. "8211": [0, 0.43056, 0.02778, 0, 0.5],
  2069. "8212": [0, 0.43056, 0.02778, 0, 1],
  2070. "8216": [0, 0.69444, 0, 0, 0.27778],
  2071. "8217": [0, 0.69444, 0, 0, 0.27778],
  2072. "8220": [0, 0.69444, 0, 0, 0.5],
  2073. "8221": [0, 0.69444, 0, 0, 0.5],
  2074. "8224": [0.19444, 0.69444, 0, 0, 0.44445],
  2075. "8225": [0.19444, 0.69444, 0, 0, 0.44445],
  2076. "8230": [0, 0.123, 0, 0, 1.172],
  2077. "8242": [0, 0.55556, 0, 0, 0.275],
  2078. "8407": [0, 0.71444, 0.15382, 0, 0.5],
  2079. "8463": [0, 0.68889, 0, 0, 0.54028],
  2080. "8465": [0, 0.69444, 0, 0, 0.72222],
  2081. "8467": [0, 0.69444, 0, 0.11111, 0.41667],
  2082. "8472": [0.19444, 0.43056, 0, 0.11111, 0.63646],
  2083. "8476": [0, 0.69444, 0, 0, 0.72222],
  2084. "8501": [0, 0.69444, 0, 0, 0.61111],
  2085. "8592": [-0.13313, 0.36687, 0, 0, 1],
  2086. "8593": [0.19444, 0.69444, 0, 0, 0.5],
  2087. "8594": [-0.13313, 0.36687, 0, 0, 1],
  2088. "8595": [0.19444, 0.69444, 0, 0, 0.5],
  2089. "8596": [-0.13313, 0.36687, 0, 0, 1],
  2090. "8597": [0.25, 0.75, 0, 0, 0.5],
  2091. "8598": [0.19444, 0.69444, 0, 0, 1],
  2092. "8599": [0.19444, 0.69444, 0, 0, 1],
  2093. "8600": [0.19444, 0.69444, 0, 0, 1],
  2094. "8601": [0.19444, 0.69444, 0, 0, 1],
  2095. "8614": [0.011, 0.511, 0, 0, 1],
  2096. "8617": [0.011, 0.511, 0, 0, 1.126],
  2097. "8618": [0.011, 0.511, 0, 0, 1.126],
  2098. "8636": [-0.13313, 0.36687, 0, 0, 1],
  2099. "8637": [-0.13313, 0.36687, 0, 0, 1],
  2100. "8640": [-0.13313, 0.36687, 0, 0, 1],
  2101. "8641": [-0.13313, 0.36687, 0, 0, 1],
  2102. "8652": [0.011, 0.671, 0, 0, 1],
  2103. "8656": [-0.13313, 0.36687, 0, 0, 1],
  2104. "8657": [0.19444, 0.69444, 0, 0, 0.61111],
  2105. "8658": [-0.13313, 0.36687, 0, 0, 1],
  2106. "8659": [0.19444, 0.69444, 0, 0, 0.61111],
  2107. "8660": [-0.13313, 0.36687, 0, 0, 1],
  2108. "8661": [0.25, 0.75, 0, 0, 0.61111],
  2109. "8704": [0, 0.69444, 0, 0, 0.55556],
  2110. "8706": [0, 0.69444, 0.05556, 0.08334, 0.5309],
  2111. "8707": [0, 0.69444, 0, 0, 0.55556],
  2112. "8709": [0.05556, 0.75, 0, 0, 0.5],
  2113. "8711": [0, 0.68333, 0, 0, 0.83334],
  2114. "8712": [0.0391, 0.5391, 0, 0, 0.66667],
  2115. "8715": [0.0391, 0.5391, 0, 0, 0.66667],
  2116. "8722": [0.08333, 0.58333, 0, 0, 0.77778],
  2117. "8723": [0.08333, 0.58333, 0, 0, 0.77778],
  2118. "8725": [0.25, 0.75, 0, 0, 0.5],
  2119. "8726": [0.25, 0.75, 0, 0, 0.5],
  2120. "8727": [-0.03472, 0.46528, 0, 0, 0.5],
  2121. "8728": [-0.05555, 0.44445, 0, 0, 0.5],
  2122. "8729": [-0.05555, 0.44445, 0, 0, 0.5],
  2123. "8730": [0.2, 0.8, 0, 0, 0.83334],
  2124. "8733": [0, 0.43056, 0, 0, 0.77778],
  2125. "8734": [0, 0.43056, 0, 0, 1],
  2126. "8736": [0, 0.69224, 0, 0, 0.72222],
  2127. "8739": [0.25, 0.75, 0, 0, 0.27778],
  2128. "8741": [0.25, 0.75, 0, 0, 0.5],
  2129. "8743": [0, 0.55556, 0, 0, 0.66667],
  2130. "8744": [0, 0.55556, 0, 0, 0.66667],
  2131. "8745": [0, 0.55556, 0, 0, 0.66667],
  2132. "8746": [0, 0.55556, 0, 0, 0.66667],
  2133. "8747": [0.19444, 0.69444, 0.11111, 0, 0.41667],
  2134. "8764": [-0.13313, 0.36687, 0, 0, 0.77778],
  2135. "8768": [0.19444, 0.69444, 0, 0, 0.27778],
  2136. "8771": [-0.03625, 0.46375, 0, 0, 0.77778],
  2137. "8773": [-0.022, 0.589, 0, 0, 0.778],
  2138. "8776": [-0.01688, 0.48312, 0, 0, 0.77778],
  2139. "8781": [-0.03625, 0.46375, 0, 0, 0.77778],
  2140. "8784": [-0.133, 0.673, 0, 0, 0.778],
  2141. "8801": [-0.03625, 0.46375, 0, 0, 0.77778],
  2142. "8804": [0.13597, 0.63597, 0, 0, 0.77778],
  2143. "8805": [0.13597, 0.63597, 0, 0, 0.77778],
  2144. "8810": [0.0391, 0.5391, 0, 0, 1],
  2145. "8811": [0.0391, 0.5391, 0, 0, 1],
  2146. "8826": [0.0391, 0.5391, 0, 0, 0.77778],
  2147. "8827": [0.0391, 0.5391, 0, 0, 0.77778],
  2148. "8834": [0.0391, 0.5391, 0, 0, 0.77778],
  2149. "8835": [0.0391, 0.5391, 0, 0, 0.77778],
  2150. "8838": [0.13597, 0.63597, 0, 0, 0.77778],
  2151. "8839": [0.13597, 0.63597, 0, 0, 0.77778],
  2152. "8846": [0, 0.55556, 0, 0, 0.66667],
  2153. "8849": [0.13597, 0.63597, 0, 0, 0.77778],
  2154. "8850": [0.13597, 0.63597, 0, 0, 0.77778],
  2155. "8851": [0, 0.55556, 0, 0, 0.66667],
  2156. "8852": [0, 0.55556, 0, 0, 0.66667],
  2157. "8853": [0.08333, 0.58333, 0, 0, 0.77778],
  2158. "8854": [0.08333, 0.58333, 0, 0, 0.77778],
  2159. "8855": [0.08333, 0.58333, 0, 0, 0.77778],
  2160. "8856": [0.08333, 0.58333, 0, 0, 0.77778],
  2161. "8857": [0.08333, 0.58333, 0, 0, 0.77778],
  2162. "8866": [0, 0.69444, 0, 0, 0.61111],
  2163. "8867": [0, 0.69444, 0, 0, 0.61111],
  2164. "8868": [0, 0.69444, 0, 0, 0.77778],
  2165. "8869": [0, 0.69444, 0, 0, 0.77778],
  2166. "8872": [0.249, 0.75, 0, 0, 0.867],
  2167. "8900": [-0.05555, 0.44445, 0, 0, 0.5],
  2168. "8901": [-0.05555, 0.44445, 0, 0, 0.27778],
  2169. "8902": [-0.03472, 0.46528, 0, 0, 0.5],
  2170. "8904": [5e-3, 0.505, 0, 0, 0.9],
  2171. "8942": [0.03, 0.903, 0, 0, 0.278],
  2172. "8943": [-0.19, 0.313, 0, 0, 1.172],
  2173. "8945": [-0.1, 0.823, 0, 0, 1.282],
  2174. "8968": [0.25, 0.75, 0, 0, 0.44445],
  2175. "8969": [0.25, 0.75, 0, 0, 0.44445],
  2176. "8970": [0.25, 0.75, 0, 0, 0.44445],
  2177. "8971": [0.25, 0.75, 0, 0, 0.44445],
  2178. "8994": [-0.14236, 0.35764, 0, 0, 1],
  2179. "8995": [-0.14236, 0.35764, 0, 0, 1],
  2180. "9136": [0.244, 0.744, 0, 0, 0.412],
  2181. "9137": [0.244, 0.745, 0, 0, 0.412],
  2182. "9651": [0.19444, 0.69444, 0, 0, 0.88889],
  2183. "9657": [-0.03472, 0.46528, 0, 0, 0.5],
  2184. "9661": [0.19444, 0.69444, 0, 0, 0.88889],
  2185. "9667": [-0.03472, 0.46528, 0, 0, 0.5],
  2186. "9711": [0.19444, 0.69444, 0, 0, 1],
  2187. "9824": [0.12963, 0.69444, 0, 0, 0.77778],
  2188. "9825": [0.12963, 0.69444, 0, 0, 0.77778],
  2189. "9826": [0.12963, 0.69444, 0, 0, 0.77778],
  2190. "9827": [0.12963, 0.69444, 0, 0, 0.77778],
  2191. "9837": [0, 0.75, 0, 0, 0.38889],
  2192. "9838": [0.19444, 0.69444, 0, 0, 0.38889],
  2193. "9839": [0.19444, 0.69444, 0, 0, 0.38889],
  2194. "10216": [0.25, 0.75, 0, 0, 0.38889],
  2195. "10217": [0.25, 0.75, 0, 0, 0.38889],
  2196. "10222": [0.244, 0.744, 0, 0, 0.412],
  2197. "10223": [0.244, 0.745, 0, 0, 0.412],
  2198. "10229": [0.011, 0.511, 0, 0, 1.609],
  2199. "10230": [0.011, 0.511, 0, 0, 1.638],
  2200. "10231": [0.011, 0.511, 0, 0, 1.859],
  2201. "10232": [0.024, 0.525, 0, 0, 1.609],
  2202. "10233": [0.024, 0.525, 0, 0, 1.638],
  2203. "10234": [0.024, 0.525, 0, 0, 1.858],
  2204. "10236": [0.011, 0.511, 0, 0, 1.638],
  2205. "10815": [0, 0.68333, 0, 0, 0.75],
  2206. "10927": [0.13597, 0.63597, 0, 0, 0.77778],
  2207. "10928": [0.13597, 0.63597, 0, 0, 0.77778],
  2208. "57376": [0.19444, 0.69444, 0, 0, 0]
  2209. },
  2210. "Math-BoldItalic": {
  2211. "32": [0, 0, 0, 0, 0.25],
  2212. "48": [0, 0.44444, 0, 0, 0.575],
  2213. "49": [0, 0.44444, 0, 0, 0.575],
  2214. "50": [0, 0.44444, 0, 0, 0.575],
  2215. "51": [0.19444, 0.44444, 0, 0, 0.575],
  2216. "52": [0.19444, 0.44444, 0, 0, 0.575],
  2217. "53": [0.19444, 0.44444, 0, 0, 0.575],
  2218. "54": [0, 0.64444, 0, 0, 0.575],
  2219. "55": [0.19444, 0.44444, 0, 0, 0.575],
  2220. "56": [0, 0.64444, 0, 0, 0.575],
  2221. "57": [0.19444, 0.44444, 0, 0, 0.575],
  2222. "65": [0, 0.68611, 0, 0, 0.86944],
  2223. "66": [0, 0.68611, 0.04835, 0, 0.8664],
  2224. "67": [0, 0.68611, 0.06979, 0, 0.81694],
  2225. "68": [0, 0.68611, 0.03194, 0, 0.93812],
  2226. "69": [0, 0.68611, 0.05451, 0, 0.81007],
  2227. "70": [0, 0.68611, 0.15972, 0, 0.68889],
  2228. "71": [0, 0.68611, 0, 0, 0.88673],
  2229. "72": [0, 0.68611, 0.08229, 0, 0.98229],
  2230. "73": [0, 0.68611, 0.07778, 0, 0.51111],
  2231. "74": [0, 0.68611, 0.10069, 0, 0.63125],
  2232. "75": [0, 0.68611, 0.06979, 0, 0.97118],
  2233. "76": [0, 0.68611, 0, 0, 0.75555],
  2234. "77": [0, 0.68611, 0.11424, 0, 1.14201],
  2235. "78": [0, 0.68611, 0.11424, 0, 0.95034],
  2236. "79": [0, 0.68611, 0.03194, 0, 0.83666],
  2237. "80": [0, 0.68611, 0.15972, 0, 0.72309],
  2238. "81": [0.19444, 0.68611, 0, 0, 0.86861],
  2239. "82": [0, 0.68611, 421e-5, 0, 0.87235],
  2240. "83": [0, 0.68611, 0.05382, 0, 0.69271],
  2241. "84": [0, 0.68611, 0.15972, 0, 0.63663],
  2242. "85": [0, 0.68611, 0.11424, 0, 0.80027],
  2243. "86": [0, 0.68611, 0.25555, 0, 0.67778],
  2244. "87": [0, 0.68611, 0.15972, 0, 1.09305],
  2245. "88": [0, 0.68611, 0.07778, 0, 0.94722],
  2246. "89": [0, 0.68611, 0.25555, 0, 0.67458],
  2247. "90": [0, 0.68611, 0.06979, 0, 0.77257],
  2248. "97": [0, 0.44444, 0, 0, 0.63287],
  2249. "98": [0, 0.69444, 0, 0, 0.52083],
  2250. "99": [0, 0.44444, 0, 0, 0.51342],
  2251. "100": [0, 0.69444, 0, 0, 0.60972],
  2252. "101": [0, 0.44444, 0, 0, 0.55361],
  2253. "102": [0.19444, 0.69444, 0.11042, 0, 0.56806],
  2254. "103": [0.19444, 0.44444, 0.03704, 0, 0.5449],
  2255. "104": [0, 0.69444, 0, 0, 0.66759],
  2256. "105": [0, 0.69326, 0, 0, 0.4048],
  2257. "106": [0.19444, 0.69326, 0.0622, 0, 0.47083],
  2258. "107": [0, 0.69444, 0.01852, 0, 0.6037],
  2259. "108": [0, 0.69444, 88e-4, 0, 0.34815],
  2260. "109": [0, 0.44444, 0, 0, 1.0324],
  2261. "110": [0, 0.44444, 0, 0, 0.71296],
  2262. "111": [0, 0.44444, 0, 0, 0.58472],
  2263. "112": [0.19444, 0.44444, 0, 0, 0.60092],
  2264. "113": [0.19444, 0.44444, 0.03704, 0, 0.54213],
  2265. "114": [0, 0.44444, 0.03194, 0, 0.5287],
  2266. "115": [0, 0.44444, 0, 0, 0.53125],
  2267. "116": [0, 0.63492, 0, 0, 0.41528],
  2268. "117": [0, 0.44444, 0, 0, 0.68102],
  2269. "118": [0, 0.44444, 0.03704, 0, 0.56666],
  2270. "119": [0, 0.44444, 0.02778, 0, 0.83148],
  2271. "120": [0, 0.44444, 0, 0, 0.65903],
  2272. "121": [0.19444, 0.44444, 0.03704, 0, 0.59028],
  2273. "122": [0, 0.44444, 0.04213, 0, 0.55509],
  2274. "160": [0, 0, 0, 0, 0.25],
  2275. "915": [0, 0.68611, 0.15972, 0, 0.65694],
  2276. "916": [0, 0.68611, 0, 0, 0.95833],
  2277. "920": [0, 0.68611, 0.03194, 0, 0.86722],
  2278. "923": [0, 0.68611, 0, 0, 0.80555],
  2279. "926": [0, 0.68611, 0.07458, 0, 0.84125],
  2280. "928": [0, 0.68611, 0.08229, 0, 0.98229],
  2281. "931": [0, 0.68611, 0.05451, 0, 0.88507],
  2282. "933": [0, 0.68611, 0.15972, 0, 0.67083],
  2283. "934": [0, 0.68611, 0, 0, 0.76666],
  2284. "936": [0, 0.68611, 0.11653, 0, 0.71402],
  2285. "937": [0, 0.68611, 0.04835, 0, 0.8789],
  2286. "945": [0, 0.44444, 0, 0, 0.76064],
  2287. "946": [0.19444, 0.69444, 0.03403, 0, 0.65972],
  2288. "947": [0.19444, 0.44444, 0.06389, 0, 0.59003],
  2289. "948": [0, 0.69444, 0.03819, 0, 0.52222],
  2290. "949": [0, 0.44444, 0, 0, 0.52882],
  2291. "950": [0.19444, 0.69444, 0.06215, 0, 0.50833],
  2292. "951": [0.19444, 0.44444, 0.03704, 0, 0.6],
  2293. "952": [0, 0.69444, 0.03194, 0, 0.5618],
  2294. "953": [0, 0.44444, 0, 0, 0.41204],
  2295. "954": [0, 0.44444, 0, 0, 0.66759],
  2296. "955": [0, 0.69444, 0, 0, 0.67083],
  2297. "956": [0.19444, 0.44444, 0, 0, 0.70787],
  2298. "957": [0, 0.44444, 0.06898, 0, 0.57685],
  2299. "958": [0.19444, 0.69444, 0.03021, 0, 0.50833],
  2300. "959": [0, 0.44444, 0, 0, 0.58472],
  2301. "960": [0, 0.44444, 0.03704, 0, 0.68241],
  2302. "961": [0.19444, 0.44444, 0, 0, 0.6118],
  2303. "962": [0.09722, 0.44444, 0.07917, 0, 0.42361],
  2304. "963": [0, 0.44444, 0.03704, 0, 0.68588],
  2305. "964": [0, 0.44444, 0.13472, 0, 0.52083],
  2306. "965": [0, 0.44444, 0.03704, 0, 0.63055],
  2307. "966": [0.19444, 0.44444, 0, 0, 0.74722],
  2308. "967": [0.19444, 0.44444, 0, 0, 0.71805],
  2309. "968": [0.19444, 0.69444, 0.03704, 0, 0.75833],
  2310. "969": [0, 0.44444, 0.03704, 0, 0.71782],
  2311. "977": [0, 0.69444, 0, 0, 0.69155],
  2312. "981": [0.19444, 0.69444, 0, 0, 0.7125],
  2313. "982": [0, 0.44444, 0.03194, 0, 0.975],
  2314. "1009": [0.19444, 0.44444, 0, 0, 0.6118],
  2315. "1013": [0, 0.44444, 0, 0, 0.48333],
  2316. "57649": [0, 0.44444, 0, 0, 0.39352],
  2317. "57911": [0.19444, 0.44444, 0, 0, 0.43889]
  2318. },
  2319. "Math-Italic": {
  2320. "32": [0, 0, 0, 0, 0.25],
  2321. "48": [0, 0.43056, 0, 0, 0.5],
  2322. "49": [0, 0.43056, 0, 0, 0.5],
  2323. "50": [0, 0.43056, 0, 0, 0.5],
  2324. "51": [0.19444, 0.43056, 0, 0, 0.5],
  2325. "52": [0.19444, 0.43056, 0, 0, 0.5],
  2326. "53": [0.19444, 0.43056, 0, 0, 0.5],
  2327. "54": [0, 0.64444, 0, 0, 0.5],
  2328. "55": [0.19444, 0.43056, 0, 0, 0.5],
  2329. "56": [0, 0.64444, 0, 0, 0.5],
  2330. "57": [0.19444, 0.43056, 0, 0, 0.5],
  2331. "65": [0, 0.68333, 0, 0.13889, 0.75],
  2332. "66": [0, 0.68333, 0.05017, 0.08334, 0.75851],
  2333. "67": [0, 0.68333, 0.07153, 0.08334, 0.71472],
  2334. "68": [0, 0.68333, 0.02778, 0.05556, 0.82792],
  2335. "69": [0, 0.68333, 0.05764, 0.08334, 0.7382],
  2336. "70": [0, 0.68333, 0.13889, 0.08334, 0.64306],
  2337. "71": [0, 0.68333, 0, 0.08334, 0.78625],
  2338. "72": [0, 0.68333, 0.08125, 0.05556, 0.83125],
  2339. "73": [0, 0.68333, 0.07847, 0.11111, 0.43958],
  2340. "74": [0, 0.68333, 0.09618, 0.16667, 0.55451],
  2341. "75": [0, 0.68333, 0.07153, 0.05556, 0.84931],
  2342. "76": [0, 0.68333, 0, 0.02778, 0.68056],
  2343. "77": [0, 0.68333, 0.10903, 0.08334, 0.97014],
  2344. "78": [0, 0.68333, 0.10903, 0.08334, 0.80347],
  2345. "79": [0, 0.68333, 0.02778, 0.08334, 0.76278],
  2346. "80": [0, 0.68333, 0.13889, 0.08334, 0.64201],
  2347. "81": [0.19444, 0.68333, 0, 0.08334, 0.79056],
  2348. "82": [0, 0.68333, 773e-5, 0.08334, 0.75929],
  2349. "83": [0, 0.68333, 0.05764, 0.08334, 0.6132],
  2350. "84": [0, 0.68333, 0.13889, 0.08334, 0.58438],
  2351. "85": [0, 0.68333, 0.10903, 0.02778, 0.68278],
  2352. "86": [0, 0.68333, 0.22222, 0, 0.58333],
  2353. "87": [0, 0.68333, 0.13889, 0, 0.94445],
  2354. "88": [0, 0.68333, 0.07847, 0.08334, 0.82847],
  2355. "89": [0, 0.68333, 0.22222, 0, 0.58056],
  2356. "90": [0, 0.68333, 0.07153, 0.08334, 0.68264],
  2357. "97": [0, 0.43056, 0, 0, 0.52859],
  2358. "98": [0, 0.69444, 0, 0, 0.42917],
  2359. "99": [0, 0.43056, 0, 0.05556, 0.43276],
  2360. "100": [0, 0.69444, 0, 0.16667, 0.52049],
  2361. "101": [0, 0.43056, 0, 0.05556, 0.46563],
  2362. "102": [0.19444, 0.69444, 0.10764, 0.16667, 0.48959],
  2363. "103": [0.19444, 0.43056, 0.03588, 0.02778, 0.47697],
  2364. "104": [0, 0.69444, 0, 0, 0.57616],
  2365. "105": [0, 0.65952, 0, 0, 0.34451],
  2366. "106": [0.19444, 0.65952, 0.05724, 0, 0.41181],
  2367. "107": [0, 0.69444, 0.03148, 0, 0.5206],
  2368. "108": [0, 0.69444, 0.01968, 0.08334, 0.29838],
  2369. "109": [0, 0.43056, 0, 0, 0.87801],
  2370. "110": [0, 0.43056, 0, 0, 0.60023],
  2371. "111": [0, 0.43056, 0, 0.05556, 0.48472],
  2372. "112": [0.19444, 0.43056, 0, 0.08334, 0.50313],
  2373. "113": [0.19444, 0.43056, 0.03588, 0.08334, 0.44641],
  2374. "114": [0, 0.43056, 0.02778, 0.05556, 0.45116],
  2375. "115": [0, 0.43056, 0, 0.05556, 0.46875],
  2376. "116": [0, 0.61508, 0, 0.08334, 0.36111],
  2377. "117": [0, 0.43056, 0, 0.02778, 0.57246],
  2378. "118": [0, 0.43056, 0.03588, 0.02778, 0.48472],
  2379. "119": [0, 0.43056, 0.02691, 0.08334, 0.71592],
  2380. "120": [0, 0.43056, 0, 0.02778, 0.57153],
  2381. "121": [0.19444, 0.43056, 0.03588, 0.05556, 0.49028],
  2382. "122": [0, 0.43056, 0.04398, 0.05556, 0.46505],
  2383. "160": [0, 0, 0, 0, 0.25],
  2384. "915": [0, 0.68333, 0.13889, 0.08334, 0.61528],
  2385. "916": [0, 0.68333, 0, 0.16667, 0.83334],
  2386. "920": [0, 0.68333, 0.02778, 0.08334, 0.76278],
  2387. "923": [0, 0.68333, 0, 0.16667, 0.69445],
  2388. "926": [0, 0.68333, 0.07569, 0.08334, 0.74236],
  2389. "928": [0, 0.68333, 0.08125, 0.05556, 0.83125],
  2390. "931": [0, 0.68333, 0.05764, 0.08334, 0.77986],
  2391. "933": [0, 0.68333, 0.13889, 0.05556, 0.58333],
  2392. "934": [0, 0.68333, 0, 0.08334, 0.66667],
  2393. "936": [0, 0.68333, 0.11, 0.05556, 0.61222],
  2394. "937": [0, 0.68333, 0.05017, 0.08334, 0.7724],
  2395. "945": [0, 0.43056, 37e-4, 0.02778, 0.6397],
  2396. "946": [0.19444, 0.69444, 0.05278, 0.08334, 0.56563],
  2397. "947": [0.19444, 0.43056, 0.05556, 0, 0.51773],
  2398. "948": [0, 0.69444, 0.03785, 0.05556, 0.44444],
  2399. "949": [0, 0.43056, 0, 0.08334, 0.46632],
  2400. "950": [0.19444, 0.69444, 0.07378, 0.08334, 0.4375],
  2401. "951": [0.19444, 0.43056, 0.03588, 0.05556, 0.49653],
  2402. "952": [0, 0.69444, 0.02778, 0.08334, 0.46944],
  2403. "953": [0, 0.43056, 0, 0.05556, 0.35394],
  2404. "954": [0, 0.43056, 0, 0, 0.57616],
  2405. "955": [0, 0.69444, 0, 0, 0.58334],
  2406. "956": [0.19444, 0.43056, 0, 0.02778, 0.60255],
  2407. "957": [0, 0.43056, 0.06366, 0.02778, 0.49398],
  2408. "958": [0.19444, 0.69444, 0.04601, 0.11111, 0.4375],
  2409. "959": [0, 0.43056, 0, 0.05556, 0.48472],
  2410. "960": [0, 0.43056, 0.03588, 0, 0.57003],
  2411. "961": [0.19444, 0.43056, 0, 0.08334, 0.51702],
  2412. "962": [0.09722, 0.43056, 0.07986, 0.08334, 0.36285],
  2413. "963": [0, 0.43056, 0.03588, 0, 0.57141],
  2414. "964": [0, 0.43056, 0.1132, 0.02778, 0.43715],
  2415. "965": [0, 0.43056, 0.03588, 0.02778, 0.54028],
  2416. "966": [0.19444, 0.43056, 0, 0.08334, 0.65417],
  2417. "967": [0.19444, 0.43056, 0, 0.05556, 0.62569],
  2418. "968": [0.19444, 0.69444, 0.03588, 0.11111, 0.65139],
  2419. "969": [0, 0.43056, 0.03588, 0, 0.62245],
  2420. "977": [0, 0.69444, 0, 0.08334, 0.59144],
  2421. "981": [0.19444, 0.69444, 0, 0.08334, 0.59583],
  2422. "982": [0, 0.43056, 0.02778, 0, 0.82813],
  2423. "1009": [0.19444, 0.43056, 0, 0.08334, 0.51702],
  2424. "1013": [0, 0.43056, 0, 0.05556, 0.4059],
  2425. "57649": [0, 0.43056, 0, 0.02778, 0.32246],
  2426. "57911": [0.19444, 0.43056, 0, 0.08334, 0.38403]
  2427. },
  2428. "SansSerif-Bold": {
  2429. "32": [0, 0, 0, 0, 0.25],
  2430. "33": [0, 0.69444, 0, 0, 0.36667],
  2431. "34": [0, 0.69444, 0, 0, 0.55834],
  2432. "35": [0.19444, 0.69444, 0, 0, 0.91667],
  2433. "36": [0.05556, 0.75, 0, 0, 0.55],
  2434. "37": [0.05556, 0.75, 0, 0, 1.02912],
  2435. "38": [0, 0.69444, 0, 0, 0.83056],
  2436. "39": [0, 0.69444, 0, 0, 0.30556],
  2437. "40": [0.25, 0.75, 0, 0, 0.42778],
  2438. "41": [0.25, 0.75, 0, 0, 0.42778],
  2439. "42": [0, 0.75, 0, 0, 0.55],
  2440. "43": [0.11667, 0.61667, 0, 0, 0.85556],
  2441. "44": [0.10556, 0.13056, 0, 0, 0.30556],
  2442. "45": [0, 0.45833, 0, 0, 0.36667],
  2443. "46": [0, 0.13056, 0, 0, 0.30556],
  2444. "47": [0.25, 0.75, 0, 0, 0.55],
  2445. "48": [0, 0.69444, 0, 0, 0.55],
  2446. "49": [0, 0.69444, 0, 0, 0.55],
  2447. "50": [0, 0.69444, 0, 0, 0.55],
  2448. "51": [0, 0.69444, 0, 0, 0.55],
  2449. "52": [0, 0.69444, 0, 0, 0.55],
  2450. "53": [0, 0.69444, 0, 0, 0.55],
  2451. "54": [0, 0.69444, 0, 0, 0.55],
  2452. "55": [0, 0.69444, 0, 0, 0.55],
  2453. "56": [0, 0.69444, 0, 0, 0.55],
  2454. "57": [0, 0.69444, 0, 0, 0.55],
  2455. "58": [0, 0.45833, 0, 0, 0.30556],
  2456. "59": [0.10556, 0.45833, 0, 0, 0.30556],
  2457. "61": [-0.09375, 0.40625, 0, 0, 0.85556],
  2458. "63": [0, 0.69444, 0, 0, 0.51945],
  2459. "64": [0, 0.69444, 0, 0, 0.73334],
  2460. "65": [0, 0.69444, 0, 0, 0.73334],
  2461. "66": [0, 0.69444, 0, 0, 0.73334],
  2462. "67": [0, 0.69444, 0, 0, 0.70278],
  2463. "68": [0, 0.69444, 0, 0, 0.79445],
  2464. "69": [0, 0.69444, 0, 0, 0.64167],
  2465. "70": [0, 0.69444, 0, 0, 0.61111],
  2466. "71": [0, 0.69444, 0, 0, 0.73334],
  2467. "72": [0, 0.69444, 0, 0, 0.79445],
  2468. "73": [0, 0.69444, 0, 0, 0.33056],
  2469. "74": [0, 0.69444, 0, 0, 0.51945],
  2470. "75": [0, 0.69444, 0, 0, 0.76389],
  2471. "76": [0, 0.69444, 0, 0, 0.58056],
  2472. "77": [0, 0.69444, 0, 0, 0.97778],
  2473. "78": [0, 0.69444, 0, 0, 0.79445],
  2474. "79": [0, 0.69444, 0, 0, 0.79445],
  2475. "80": [0, 0.69444, 0, 0, 0.70278],
  2476. "81": [0.10556, 0.69444, 0, 0, 0.79445],
  2477. "82": [0, 0.69444, 0, 0, 0.70278],
  2478. "83": [0, 0.69444, 0, 0, 0.61111],
  2479. "84": [0, 0.69444, 0, 0, 0.73334],
  2480. "85": [0, 0.69444, 0, 0, 0.76389],
  2481. "86": [0, 0.69444, 0.01528, 0, 0.73334],
  2482. "87": [0, 0.69444, 0.01528, 0, 1.03889],
  2483. "88": [0, 0.69444, 0, 0, 0.73334],
  2484. "89": [0, 0.69444, 0.0275, 0, 0.73334],
  2485. "90": [0, 0.69444, 0, 0, 0.67223],
  2486. "91": [0.25, 0.75, 0, 0, 0.34306],
  2487. "93": [0.25, 0.75, 0, 0, 0.34306],
  2488. "94": [0, 0.69444, 0, 0, 0.55],
  2489. "95": [0.35, 0.10833, 0.03056, 0, 0.55],
  2490. "97": [0, 0.45833, 0, 0, 0.525],
  2491. "98": [0, 0.69444, 0, 0, 0.56111],
  2492. "99": [0, 0.45833, 0, 0, 0.48889],
  2493. "100": [0, 0.69444, 0, 0, 0.56111],
  2494. "101": [0, 0.45833, 0, 0, 0.51111],
  2495. "102": [0, 0.69444, 0.07639, 0, 0.33611],
  2496. "103": [0.19444, 0.45833, 0.01528, 0, 0.55],
  2497. "104": [0, 0.69444, 0, 0, 0.56111],
  2498. "105": [0, 0.69444, 0, 0, 0.25556],
  2499. "106": [0.19444, 0.69444, 0, 0, 0.28611],
  2500. "107": [0, 0.69444, 0, 0, 0.53056],
  2501. "108": [0, 0.69444, 0, 0, 0.25556],
  2502. "109": [0, 0.45833, 0, 0, 0.86667],
  2503. "110": [0, 0.45833, 0, 0, 0.56111],
  2504. "111": [0, 0.45833, 0, 0, 0.55],
  2505. "112": [0.19444, 0.45833, 0, 0, 0.56111],
  2506. "113": [0.19444, 0.45833, 0, 0, 0.56111],
  2507. "114": [0, 0.45833, 0.01528, 0, 0.37222],
  2508. "115": [0, 0.45833, 0, 0, 0.42167],
  2509. "116": [0, 0.58929, 0, 0, 0.40417],
  2510. "117": [0, 0.45833, 0, 0, 0.56111],
  2511. "118": [0, 0.45833, 0.01528, 0, 0.5],
  2512. "119": [0, 0.45833, 0.01528, 0, 0.74445],
  2513. "120": [0, 0.45833, 0, 0, 0.5],
  2514. "121": [0.19444, 0.45833, 0.01528, 0, 0.5],
  2515. "122": [0, 0.45833, 0, 0, 0.47639],
  2516. "126": [0.35, 0.34444, 0, 0, 0.55],
  2517. "160": [0, 0, 0, 0, 0.25],
  2518. "168": [0, 0.69444, 0, 0, 0.55],
  2519. "176": [0, 0.69444, 0, 0, 0.73334],
  2520. "180": [0, 0.69444, 0, 0, 0.55],
  2521. "184": [0.17014, 0, 0, 0, 0.48889],
  2522. "305": [0, 0.45833, 0, 0, 0.25556],
  2523. "567": [0.19444, 0.45833, 0, 0, 0.28611],
  2524. "710": [0, 0.69444, 0, 0, 0.55],
  2525. "711": [0, 0.63542, 0, 0, 0.55],
  2526. "713": [0, 0.63778, 0, 0, 0.55],
  2527. "728": [0, 0.69444, 0, 0, 0.55],
  2528. "729": [0, 0.69444, 0, 0, 0.30556],
  2529. "730": [0, 0.69444, 0, 0, 0.73334],
  2530. "732": [0, 0.69444, 0, 0, 0.55],
  2531. "733": [0, 0.69444, 0, 0, 0.55],
  2532. "915": [0, 0.69444, 0, 0, 0.58056],
  2533. "916": [0, 0.69444, 0, 0, 0.91667],
  2534. "920": [0, 0.69444, 0, 0, 0.85556],
  2535. "923": [0, 0.69444, 0, 0, 0.67223],
  2536. "926": [0, 0.69444, 0, 0, 0.73334],
  2537. "928": [0, 0.69444, 0, 0, 0.79445],
  2538. "931": [0, 0.69444, 0, 0, 0.79445],
  2539. "933": [0, 0.69444, 0, 0, 0.85556],
  2540. "934": [0, 0.69444, 0, 0, 0.79445],
  2541. "936": [0, 0.69444, 0, 0, 0.85556],
  2542. "937": [0, 0.69444, 0, 0, 0.79445],
  2543. "8211": [0, 0.45833, 0.03056, 0, 0.55],
  2544. "8212": [0, 0.45833, 0.03056, 0, 1.10001],
  2545. "8216": [0, 0.69444, 0, 0, 0.30556],
  2546. "8217": [0, 0.69444, 0, 0, 0.30556],
  2547. "8220": [0, 0.69444, 0, 0, 0.55834],
  2548. "8221": [0, 0.69444, 0, 0, 0.55834]
  2549. },
  2550. "SansSerif-Italic": {
  2551. "32": [0, 0, 0, 0, 0.25],
  2552. "33": [0, 0.69444, 0.05733, 0, 0.31945],
  2553. "34": [0, 0.69444, 316e-5, 0, 0.5],
  2554. "35": [0.19444, 0.69444, 0.05087, 0, 0.83334],
  2555. "36": [0.05556, 0.75, 0.11156, 0, 0.5],
  2556. "37": [0.05556, 0.75, 0.03126, 0, 0.83334],
  2557. "38": [0, 0.69444, 0.03058, 0, 0.75834],
  2558. "39": [0, 0.69444, 0.07816, 0, 0.27778],
  2559. "40": [0.25, 0.75, 0.13164, 0, 0.38889],
  2560. "41": [0.25, 0.75, 0.02536, 0, 0.38889],
  2561. "42": [0, 0.75, 0.11775, 0, 0.5],
  2562. "43": [0.08333, 0.58333, 0.02536, 0, 0.77778],
  2563. "44": [0.125, 0.08333, 0, 0, 0.27778],
  2564. "45": [0, 0.44444, 0.01946, 0, 0.33333],
  2565. "46": [0, 0.08333, 0, 0, 0.27778],
  2566. "47": [0.25, 0.75, 0.13164, 0, 0.5],
  2567. "48": [0, 0.65556, 0.11156, 0, 0.5],
  2568. "49": [0, 0.65556, 0.11156, 0, 0.5],
  2569. "50": [0, 0.65556, 0.11156, 0, 0.5],
  2570. "51": [0, 0.65556, 0.11156, 0, 0.5],
  2571. "52": [0, 0.65556, 0.11156, 0, 0.5],
  2572. "53": [0, 0.65556, 0.11156, 0, 0.5],
  2573. "54": [0, 0.65556, 0.11156, 0, 0.5],
  2574. "55": [0, 0.65556, 0.11156, 0, 0.5],
  2575. "56": [0, 0.65556, 0.11156, 0, 0.5],
  2576. "57": [0, 0.65556, 0.11156, 0, 0.5],
  2577. "58": [0, 0.44444, 0.02502, 0, 0.27778],
  2578. "59": [0.125, 0.44444, 0.02502, 0, 0.27778],
  2579. "61": [-0.13, 0.37, 0.05087, 0, 0.77778],
  2580. "63": [0, 0.69444, 0.11809, 0, 0.47222],
  2581. "64": [0, 0.69444, 0.07555, 0, 0.66667],
  2582. "65": [0, 0.69444, 0, 0, 0.66667],
  2583. "66": [0, 0.69444, 0.08293, 0, 0.66667],
  2584. "67": [0, 0.69444, 0.11983, 0, 0.63889],
  2585. "68": [0, 0.69444, 0.07555, 0, 0.72223],
  2586. "69": [0, 0.69444, 0.11983, 0, 0.59722],
  2587. "70": [0, 0.69444, 0.13372, 0, 0.56945],
  2588. "71": [0, 0.69444, 0.11983, 0, 0.66667],
  2589. "72": [0, 0.69444, 0.08094, 0, 0.70834],
  2590. "73": [0, 0.69444, 0.13372, 0, 0.27778],
  2591. "74": [0, 0.69444, 0.08094, 0, 0.47222],
  2592. "75": [0, 0.69444, 0.11983, 0, 0.69445],
  2593. "76": [0, 0.69444, 0, 0, 0.54167],
  2594. "77": [0, 0.69444, 0.08094, 0, 0.875],
  2595. "78": [0, 0.69444, 0.08094, 0, 0.70834],
  2596. "79": [0, 0.69444, 0.07555, 0, 0.73611],
  2597. "80": [0, 0.69444, 0.08293, 0, 0.63889],
  2598. "81": [0.125, 0.69444, 0.07555, 0, 0.73611],
  2599. "82": [0, 0.69444, 0.08293, 0, 0.64584],
  2600. "83": [0, 0.69444, 0.09205, 0, 0.55556],
  2601. "84": [0, 0.69444, 0.13372, 0, 0.68056],
  2602. "85": [0, 0.69444, 0.08094, 0, 0.6875],
  2603. "86": [0, 0.69444, 0.1615, 0, 0.66667],
  2604. "87": [0, 0.69444, 0.1615, 0, 0.94445],
  2605. "88": [0, 0.69444, 0.13372, 0, 0.66667],
  2606. "89": [0, 0.69444, 0.17261, 0, 0.66667],
  2607. "90": [0, 0.69444, 0.11983, 0, 0.61111],
  2608. "91": [0.25, 0.75, 0.15942, 0, 0.28889],
  2609. "93": [0.25, 0.75, 0.08719, 0, 0.28889],
  2610. "94": [0, 0.69444, 0.0799, 0, 0.5],
  2611. "95": [0.35, 0.09444, 0.08616, 0, 0.5],
  2612. "97": [0, 0.44444, 981e-5, 0, 0.48056],
  2613. "98": [0, 0.69444, 0.03057, 0, 0.51667],
  2614. "99": [0, 0.44444, 0.08336, 0, 0.44445],
  2615. "100": [0, 0.69444, 0.09483, 0, 0.51667],
  2616. "101": [0, 0.44444, 0.06778, 0, 0.44445],
  2617. "102": [0, 0.69444, 0.21705, 0, 0.30556],
  2618. "103": [0.19444, 0.44444, 0.10836, 0, 0.5],
  2619. "104": [0, 0.69444, 0.01778, 0, 0.51667],
  2620. "105": [0, 0.67937, 0.09718, 0, 0.23889],
  2621. "106": [0.19444, 0.67937, 0.09162, 0, 0.26667],
  2622. "107": [0, 0.69444, 0.08336, 0, 0.48889],
  2623. "108": [0, 0.69444, 0.09483, 0, 0.23889],
  2624. "109": [0, 0.44444, 0.01778, 0, 0.79445],
  2625. "110": [0, 0.44444, 0.01778, 0, 0.51667],
  2626. "111": [0, 0.44444, 0.06613, 0, 0.5],
  2627. "112": [0.19444, 0.44444, 0.0389, 0, 0.51667],
  2628. "113": [0.19444, 0.44444, 0.04169, 0, 0.51667],
  2629. "114": [0, 0.44444, 0.10836, 0, 0.34167],
  2630. "115": [0, 0.44444, 0.0778, 0, 0.38333],
  2631. "116": [0, 0.57143, 0.07225, 0, 0.36111],
  2632. "117": [0, 0.44444, 0.04169, 0, 0.51667],
  2633. "118": [0, 0.44444, 0.10836, 0, 0.46111],
  2634. "119": [0, 0.44444, 0.10836, 0, 0.68334],
  2635. "120": [0, 0.44444, 0.09169, 0, 0.46111],
  2636. "121": [0.19444, 0.44444, 0.10836, 0, 0.46111],
  2637. "122": [0, 0.44444, 0.08752, 0, 0.43472],
  2638. "126": [0.35, 0.32659, 0.08826, 0, 0.5],
  2639. "160": [0, 0, 0, 0, 0.25],
  2640. "168": [0, 0.67937, 0.06385, 0, 0.5],
  2641. "176": [0, 0.69444, 0, 0, 0.73752],
  2642. "184": [0.17014, 0, 0, 0, 0.44445],
  2643. "305": [0, 0.44444, 0.04169, 0, 0.23889],
  2644. "567": [0.19444, 0.44444, 0.04169, 0, 0.26667],
  2645. "710": [0, 0.69444, 0.0799, 0, 0.5],
  2646. "711": [0, 0.63194, 0.08432, 0, 0.5],
  2647. "713": [0, 0.60889, 0.08776, 0, 0.5],
  2648. "714": [0, 0.69444, 0.09205, 0, 0.5],
  2649. "715": [0, 0.69444, 0, 0, 0.5],
  2650. "728": [0, 0.69444, 0.09483, 0, 0.5],
  2651. "729": [0, 0.67937, 0.07774, 0, 0.27778],
  2652. "730": [0, 0.69444, 0, 0, 0.73752],
  2653. "732": [0, 0.67659, 0.08826, 0, 0.5],
  2654. "733": [0, 0.69444, 0.09205, 0, 0.5],
  2655. "915": [0, 0.69444, 0.13372, 0, 0.54167],
  2656. "916": [0, 0.69444, 0, 0, 0.83334],
  2657. "920": [0, 0.69444, 0.07555, 0, 0.77778],
  2658. "923": [0, 0.69444, 0, 0, 0.61111],
  2659. "926": [0, 0.69444, 0.12816, 0, 0.66667],
  2660. "928": [0, 0.69444, 0.08094, 0, 0.70834],
  2661. "931": [0, 0.69444, 0.11983, 0, 0.72222],
  2662. "933": [0, 0.69444, 0.09031, 0, 0.77778],
  2663. "934": [0, 0.69444, 0.04603, 0, 0.72222],
  2664. "936": [0, 0.69444, 0.09031, 0, 0.77778],
  2665. "937": [0, 0.69444, 0.08293, 0, 0.72222],
  2666. "8211": [0, 0.44444, 0.08616, 0, 0.5],
  2667. "8212": [0, 0.44444, 0.08616, 0, 1],
  2668. "8216": [0, 0.69444, 0.07816, 0, 0.27778],
  2669. "8217": [0, 0.69444, 0.07816, 0, 0.27778],
  2670. "8220": [0, 0.69444, 0.14205, 0, 0.5],
  2671. "8221": [0, 0.69444, 316e-5, 0, 0.5]
  2672. },
  2673. "SansSerif-Regular": {
  2674. "32": [0, 0, 0, 0, 0.25],
  2675. "33": [0, 0.69444, 0, 0, 0.31945],
  2676. "34": [0, 0.69444, 0, 0, 0.5],
  2677. "35": [0.19444, 0.69444, 0, 0, 0.83334],
  2678. "36": [0.05556, 0.75, 0, 0, 0.5],
  2679. "37": [0.05556, 0.75, 0, 0, 0.83334],
  2680. "38": [0, 0.69444, 0, 0, 0.75834],
  2681. "39": [0, 0.69444, 0, 0, 0.27778],
  2682. "40": [0.25, 0.75, 0, 0, 0.38889],
  2683. "41": [0.25, 0.75, 0, 0, 0.38889],
  2684. "42": [0, 0.75, 0, 0, 0.5],
  2685. "43": [0.08333, 0.58333, 0, 0, 0.77778],
  2686. "44": [0.125, 0.08333, 0, 0, 0.27778],
  2687. "45": [0, 0.44444, 0, 0, 0.33333],
  2688. "46": [0, 0.08333, 0, 0, 0.27778],
  2689. "47": [0.25, 0.75, 0, 0, 0.5],
  2690. "48": [0, 0.65556, 0, 0, 0.5],
  2691. "49": [0, 0.65556, 0, 0, 0.5],
  2692. "50": [0, 0.65556, 0, 0, 0.5],
  2693. "51": [0, 0.65556, 0, 0, 0.5],
  2694. "52": [0, 0.65556, 0, 0, 0.5],
  2695. "53": [0, 0.65556, 0, 0, 0.5],
  2696. "54": [0, 0.65556, 0, 0, 0.5],
  2697. "55": [0, 0.65556, 0, 0, 0.5],
  2698. "56": [0, 0.65556, 0, 0, 0.5],
  2699. "57": [0, 0.65556, 0, 0, 0.5],
  2700. "58": [0, 0.44444, 0, 0, 0.27778],
  2701. "59": [0.125, 0.44444, 0, 0, 0.27778],
  2702. "61": [-0.13, 0.37, 0, 0, 0.77778],
  2703. "63": [0, 0.69444, 0, 0, 0.47222],
  2704. "64": [0, 0.69444, 0, 0, 0.66667],
  2705. "65": [0, 0.69444, 0, 0, 0.66667],
  2706. "66": [0, 0.69444, 0, 0, 0.66667],
  2707. "67": [0, 0.69444, 0, 0, 0.63889],
  2708. "68": [0, 0.69444, 0, 0, 0.72223],
  2709. "69": [0, 0.69444, 0, 0, 0.59722],
  2710. "70": [0, 0.69444, 0, 0, 0.56945],
  2711. "71": [0, 0.69444, 0, 0, 0.66667],
  2712. "72": [0, 0.69444, 0, 0, 0.70834],
  2713. "73": [0, 0.69444, 0, 0, 0.27778],
  2714. "74": [0, 0.69444, 0, 0, 0.47222],
  2715. "75": [0, 0.69444, 0, 0, 0.69445],
  2716. "76": [0, 0.69444, 0, 0, 0.54167],
  2717. "77": [0, 0.69444, 0, 0, 0.875],
  2718. "78": [0, 0.69444, 0, 0, 0.70834],
  2719. "79": [0, 0.69444, 0, 0, 0.73611],
  2720. "80": [0, 0.69444, 0, 0, 0.63889],
  2721. "81": [0.125, 0.69444, 0, 0, 0.73611],
  2722. "82": [0, 0.69444, 0, 0, 0.64584],
  2723. "83": [0, 0.69444, 0, 0, 0.55556],
  2724. "84": [0, 0.69444, 0, 0, 0.68056],
  2725. "85": [0, 0.69444, 0, 0, 0.6875],
  2726. "86": [0, 0.69444, 0.01389, 0, 0.66667],
  2727. "87": [0, 0.69444, 0.01389, 0, 0.94445],
  2728. "88": [0, 0.69444, 0, 0, 0.66667],
  2729. "89": [0, 0.69444, 0.025, 0, 0.66667],
  2730. "90": [0, 0.69444, 0, 0, 0.61111],
  2731. "91": [0.25, 0.75, 0, 0, 0.28889],
  2732. "93": [0.25, 0.75, 0, 0, 0.28889],
  2733. "94": [0, 0.69444, 0, 0, 0.5],
  2734. "95": [0.35, 0.09444, 0.02778, 0, 0.5],
  2735. "97": [0, 0.44444, 0, 0, 0.48056],
  2736. "98": [0, 0.69444, 0, 0, 0.51667],
  2737. "99": [0, 0.44444, 0, 0, 0.44445],
  2738. "100": [0, 0.69444, 0, 0, 0.51667],
  2739. "101": [0, 0.44444, 0, 0, 0.44445],
  2740. "102": [0, 0.69444, 0.06944, 0, 0.30556],
  2741. "103": [0.19444, 0.44444, 0.01389, 0, 0.5],
  2742. "104": [0, 0.69444, 0, 0, 0.51667],
  2743. "105": [0, 0.67937, 0, 0, 0.23889],
  2744. "106": [0.19444, 0.67937, 0, 0, 0.26667],
  2745. "107": [0, 0.69444, 0, 0, 0.48889],
  2746. "108": [0, 0.69444, 0, 0, 0.23889],
  2747. "109": [0, 0.44444, 0, 0, 0.79445],
  2748. "110": [0, 0.44444, 0, 0, 0.51667],
  2749. "111": [0, 0.44444, 0, 0, 0.5],
  2750. "112": [0.19444, 0.44444, 0, 0, 0.51667],
  2751. "113": [0.19444, 0.44444, 0, 0, 0.51667],
  2752. "114": [0, 0.44444, 0.01389, 0, 0.34167],
  2753. "115": [0, 0.44444, 0, 0, 0.38333],
  2754. "116": [0, 0.57143, 0, 0, 0.36111],
  2755. "117": [0, 0.44444, 0, 0, 0.51667],
  2756. "118": [0, 0.44444, 0.01389, 0, 0.46111],
  2757. "119": [0, 0.44444, 0.01389, 0, 0.68334],
  2758. "120": [0, 0.44444, 0, 0, 0.46111],
  2759. "121": [0.19444, 0.44444, 0.01389, 0, 0.46111],
  2760. "122": [0, 0.44444, 0, 0, 0.43472],
  2761. "126": [0.35, 0.32659, 0, 0, 0.5],
  2762. "160": [0, 0, 0, 0, 0.25],
  2763. "168": [0, 0.67937, 0, 0, 0.5],
  2764. "176": [0, 0.69444, 0, 0, 0.66667],
  2765. "184": [0.17014, 0, 0, 0, 0.44445],
  2766. "305": [0, 0.44444, 0, 0, 0.23889],
  2767. "567": [0.19444, 0.44444, 0, 0, 0.26667],
  2768. "710": [0, 0.69444, 0, 0, 0.5],
  2769. "711": [0, 0.63194, 0, 0, 0.5],
  2770. "713": [0, 0.60889, 0, 0, 0.5],
  2771. "714": [0, 0.69444, 0, 0, 0.5],
  2772. "715": [0, 0.69444, 0, 0, 0.5],
  2773. "728": [0, 0.69444, 0, 0, 0.5],
  2774. "729": [0, 0.67937, 0, 0, 0.27778],
  2775. "730": [0, 0.69444, 0, 0, 0.66667],
  2776. "732": [0, 0.67659, 0, 0, 0.5],
  2777. "733": [0, 0.69444, 0, 0, 0.5],
  2778. "915": [0, 0.69444, 0, 0, 0.54167],
  2779. "916": [0, 0.69444, 0, 0, 0.83334],
  2780. "920": [0, 0.69444, 0, 0, 0.77778],
  2781. "923": [0, 0.69444, 0, 0, 0.61111],
  2782. "926": [0, 0.69444, 0, 0, 0.66667],
  2783. "928": [0, 0.69444, 0, 0, 0.70834],
  2784. "931": [0, 0.69444, 0, 0, 0.72222],
  2785. "933": [0, 0.69444, 0, 0, 0.77778],
  2786. "934": [0, 0.69444, 0, 0, 0.72222],
  2787. "936": [0, 0.69444, 0, 0, 0.77778],
  2788. "937": [0, 0.69444, 0, 0, 0.72222],
  2789. "8211": [0, 0.44444, 0.02778, 0, 0.5],
  2790. "8212": [0, 0.44444, 0.02778, 0, 1],
  2791. "8216": [0, 0.69444, 0, 0, 0.27778],
  2792. "8217": [0, 0.69444, 0, 0, 0.27778],
  2793. "8220": [0, 0.69444, 0, 0, 0.5],
  2794. "8221": [0, 0.69444, 0, 0, 0.5]
  2795. },
  2796. "Script-Regular": {
  2797. "32": [0, 0, 0, 0, 0.25],
  2798. "65": [0, 0.7, 0.22925, 0, 0.80253],
  2799. "66": [0, 0.7, 0.04087, 0, 0.90757],
  2800. "67": [0, 0.7, 0.1689, 0, 0.66619],
  2801. "68": [0, 0.7, 0.09371, 0, 0.77443],
  2802. "69": [0, 0.7, 0.18583, 0, 0.56162],
  2803. "70": [0, 0.7, 0.13634, 0, 0.89544],
  2804. "71": [0, 0.7, 0.17322, 0, 0.60961],
  2805. "72": [0, 0.7, 0.29694, 0, 0.96919],
  2806. "73": [0, 0.7, 0.19189, 0, 0.80907],
  2807. "74": [0.27778, 0.7, 0.19189, 0, 1.05159],
  2808. "75": [0, 0.7, 0.31259, 0, 0.91364],
  2809. "76": [0, 0.7, 0.19189, 0, 0.87373],
  2810. "77": [0, 0.7, 0.15981, 0, 1.08031],
  2811. "78": [0, 0.7, 0.3525, 0, 0.9015],
  2812. "79": [0, 0.7, 0.08078, 0, 0.73787],
  2813. "80": [0, 0.7, 0.08078, 0, 1.01262],
  2814. "81": [0, 0.7, 0.03305, 0, 0.88282],
  2815. "82": [0, 0.7, 0.06259, 0, 0.85],
  2816. "83": [0, 0.7, 0.19189, 0, 0.86767],
  2817. "84": [0, 0.7, 0.29087, 0, 0.74697],
  2818. "85": [0, 0.7, 0.25815, 0, 0.79996],
  2819. "86": [0, 0.7, 0.27523, 0, 0.62204],
  2820. "87": [0, 0.7, 0.27523, 0, 0.80532],
  2821. "88": [0, 0.7, 0.26006, 0, 0.94445],
  2822. "89": [0, 0.7, 0.2939, 0, 0.70961],
  2823. "90": [0, 0.7, 0.24037, 0, 0.8212],
  2824. "160": [0, 0, 0, 0, 0.25]
  2825. },
  2826. "Size1-Regular": {
  2827. "32": [0, 0, 0, 0, 0.25],
  2828. "40": [0.35001, 0.85, 0, 0, 0.45834],
  2829. "41": [0.35001, 0.85, 0, 0, 0.45834],
  2830. "47": [0.35001, 0.85, 0, 0, 0.57778],
  2831. "91": [0.35001, 0.85, 0, 0, 0.41667],
  2832. "92": [0.35001, 0.85, 0, 0, 0.57778],
  2833. "93": [0.35001, 0.85, 0, 0, 0.41667],
  2834. "123": [0.35001, 0.85, 0, 0, 0.58334],
  2835. "125": [0.35001, 0.85, 0, 0, 0.58334],
  2836. "160": [0, 0, 0, 0, 0.25],
  2837. "710": [0, 0.72222, 0, 0, 0.55556],
  2838. "732": [0, 0.72222, 0, 0, 0.55556],
  2839. "770": [0, 0.72222, 0, 0, 0.55556],
  2840. "771": [0, 0.72222, 0, 0, 0.55556],
  2841. "8214": [-99e-5, 0.601, 0, 0, 0.77778],
  2842. "8593": [1e-5, 0.6, 0, 0, 0.66667],
  2843. "8595": [1e-5, 0.6, 0, 0, 0.66667],
  2844. "8657": [1e-5, 0.6, 0, 0, 0.77778],
  2845. "8659": [1e-5, 0.6, 0, 0, 0.77778],
  2846. "8719": [0.25001, 0.75, 0, 0, 0.94445],
  2847. "8720": [0.25001, 0.75, 0, 0, 0.94445],
  2848. "8721": [0.25001, 0.75, 0, 0, 1.05556],
  2849. "8730": [0.35001, 0.85, 0, 0, 1],
  2850. "8739": [-599e-5, 0.606, 0, 0, 0.33333],
  2851. "8741": [-599e-5, 0.606, 0, 0, 0.55556],
  2852. "8747": [0.30612, 0.805, 0.19445, 0, 0.47222],
  2853. "8748": [0.306, 0.805, 0.19445, 0, 0.47222],
  2854. "8749": [0.306, 0.805, 0.19445, 0, 0.47222],
  2855. "8750": [0.30612, 0.805, 0.19445, 0, 0.47222],
  2856. "8896": [0.25001, 0.75, 0, 0, 0.83334],
  2857. "8897": [0.25001, 0.75, 0, 0, 0.83334],
  2858. "8898": [0.25001, 0.75, 0, 0, 0.83334],
  2859. "8899": [0.25001, 0.75, 0, 0, 0.83334],
  2860. "8968": [0.35001, 0.85, 0, 0, 0.47222],
  2861. "8969": [0.35001, 0.85, 0, 0, 0.47222],
  2862. "8970": [0.35001, 0.85, 0, 0, 0.47222],
  2863. "8971": [0.35001, 0.85, 0, 0, 0.47222],
  2864. "9168": [-99e-5, 0.601, 0, 0, 0.66667],
  2865. "10216": [0.35001, 0.85, 0, 0, 0.47222],
  2866. "10217": [0.35001, 0.85, 0, 0, 0.47222],
  2867. "10752": [0.25001, 0.75, 0, 0, 1.11111],
  2868. "10753": [0.25001, 0.75, 0, 0, 1.11111],
  2869. "10754": [0.25001, 0.75, 0, 0, 1.11111],
  2870. "10756": [0.25001, 0.75, 0, 0, 0.83334],
  2871. "10758": [0.25001, 0.75, 0, 0, 0.83334]
  2872. },
  2873. "Size2-Regular": {
  2874. "32": [0, 0, 0, 0, 0.25],
  2875. "40": [0.65002, 1.15, 0, 0, 0.59722],
  2876. "41": [0.65002, 1.15, 0, 0, 0.59722],
  2877. "47": [0.65002, 1.15, 0, 0, 0.81111],
  2878. "91": [0.65002, 1.15, 0, 0, 0.47222],
  2879. "92": [0.65002, 1.15, 0, 0, 0.81111],
  2880. "93": [0.65002, 1.15, 0, 0, 0.47222],
  2881. "123": [0.65002, 1.15, 0, 0, 0.66667],
  2882. "125": [0.65002, 1.15, 0, 0, 0.66667],
  2883. "160": [0, 0, 0, 0, 0.25],
  2884. "710": [0, 0.75, 0, 0, 1],
  2885. "732": [0, 0.75, 0, 0, 1],
  2886. "770": [0, 0.75, 0, 0, 1],
  2887. "771": [0, 0.75, 0, 0, 1],
  2888. "8719": [0.55001, 1.05, 0, 0, 1.27778],
  2889. "8720": [0.55001, 1.05, 0, 0, 1.27778],
  2890. "8721": [0.55001, 1.05, 0, 0, 1.44445],
  2891. "8730": [0.65002, 1.15, 0, 0, 1],
  2892. "8747": [0.86225, 1.36, 0.44445, 0, 0.55556],
  2893. "8748": [0.862, 1.36, 0.44445, 0, 0.55556],
  2894. "8749": [0.862, 1.36, 0.44445, 0, 0.55556],
  2895. "8750": [0.86225, 1.36, 0.44445, 0, 0.55556],
  2896. "8896": [0.55001, 1.05, 0, 0, 1.11111],
  2897. "8897": [0.55001, 1.05, 0, 0, 1.11111],
  2898. "8898": [0.55001, 1.05, 0, 0, 1.11111],
  2899. "8899": [0.55001, 1.05, 0, 0, 1.11111],
  2900. "8968": [0.65002, 1.15, 0, 0, 0.52778],
  2901. "8969": [0.65002, 1.15, 0, 0, 0.52778],
  2902. "8970": [0.65002, 1.15, 0, 0, 0.52778],
  2903. "8971": [0.65002, 1.15, 0, 0, 0.52778],
  2904. "10216": [0.65002, 1.15, 0, 0, 0.61111],
  2905. "10217": [0.65002, 1.15, 0, 0, 0.61111],
  2906. "10752": [0.55001, 1.05, 0, 0, 1.51112],
  2907. "10753": [0.55001, 1.05, 0, 0, 1.51112],
  2908. "10754": [0.55001, 1.05, 0, 0, 1.51112],
  2909. "10756": [0.55001, 1.05, 0, 0, 1.11111],
  2910. "10758": [0.55001, 1.05, 0, 0, 1.11111]
  2911. },
  2912. "Size3-Regular": {
  2913. "32": [0, 0, 0, 0, 0.25],
  2914. "40": [0.95003, 1.45, 0, 0, 0.73611],
  2915. "41": [0.95003, 1.45, 0, 0, 0.73611],
  2916. "47": [0.95003, 1.45, 0, 0, 1.04445],
  2917. "91": [0.95003, 1.45, 0, 0, 0.52778],
  2918. "92": [0.95003, 1.45, 0, 0, 1.04445],
  2919. "93": [0.95003, 1.45, 0, 0, 0.52778],
  2920. "123": [0.95003, 1.45, 0, 0, 0.75],
  2921. "125": [0.95003, 1.45, 0, 0, 0.75],
  2922. "160": [0, 0, 0, 0, 0.25],
  2923. "710": [0, 0.75, 0, 0, 1.44445],
  2924. "732": [0, 0.75, 0, 0, 1.44445],
  2925. "770": [0, 0.75, 0, 0, 1.44445],
  2926. "771": [0, 0.75, 0, 0, 1.44445],
  2927. "8730": [0.95003, 1.45, 0, 0, 1],
  2928. "8968": [0.95003, 1.45, 0, 0, 0.58334],
  2929. "8969": [0.95003, 1.45, 0, 0, 0.58334],
  2930. "8970": [0.95003, 1.45, 0, 0, 0.58334],
  2931. "8971": [0.95003, 1.45, 0, 0, 0.58334],
  2932. "10216": [0.95003, 1.45, 0, 0, 0.75],
  2933. "10217": [0.95003, 1.45, 0, 0, 0.75]
  2934. },
  2935. "Size4-Regular": {
  2936. "32": [0, 0, 0, 0, 0.25],
  2937. "40": [1.25003, 1.75, 0, 0, 0.79167],
  2938. "41": [1.25003, 1.75, 0, 0, 0.79167],
  2939. "47": [1.25003, 1.75, 0, 0, 1.27778],
  2940. "91": [1.25003, 1.75, 0, 0, 0.58334],
  2941. "92": [1.25003, 1.75, 0, 0, 1.27778],
  2942. "93": [1.25003, 1.75, 0, 0, 0.58334],
  2943. "123": [1.25003, 1.75, 0, 0, 0.80556],
  2944. "125": [1.25003, 1.75, 0, 0, 0.80556],
  2945. "160": [0, 0, 0, 0, 0.25],
  2946. "710": [0, 0.825, 0, 0, 1.8889],
  2947. "732": [0, 0.825, 0, 0, 1.8889],
  2948. "770": [0, 0.825, 0, 0, 1.8889],
  2949. "771": [0, 0.825, 0, 0, 1.8889],
  2950. "8730": [1.25003, 1.75, 0, 0, 1],
  2951. "8968": [1.25003, 1.75, 0, 0, 0.63889],
  2952. "8969": [1.25003, 1.75, 0, 0, 0.63889],
  2953. "8970": [1.25003, 1.75, 0, 0, 0.63889],
  2954. "8971": [1.25003, 1.75, 0, 0, 0.63889],
  2955. "9115": [0.64502, 1.155, 0, 0, 0.875],
  2956. "9116": [1e-5, 0.6, 0, 0, 0.875],
  2957. "9117": [0.64502, 1.155, 0, 0, 0.875],
  2958. "9118": [0.64502, 1.155, 0, 0, 0.875],
  2959. "9119": [1e-5, 0.6, 0, 0, 0.875],
  2960. "9120": [0.64502, 1.155, 0, 0, 0.875],
  2961. "9121": [0.64502, 1.155, 0, 0, 0.66667],
  2962. "9122": [-99e-5, 0.601, 0, 0, 0.66667],
  2963. "9123": [0.64502, 1.155, 0, 0, 0.66667],
  2964. "9124": [0.64502, 1.155, 0, 0, 0.66667],
  2965. "9125": [-99e-5, 0.601, 0, 0, 0.66667],
  2966. "9126": [0.64502, 1.155, 0, 0, 0.66667],
  2967. "9127": [1e-5, 0.9, 0, 0, 0.88889],
  2968. "9128": [0.65002, 1.15, 0, 0, 0.88889],
  2969. "9129": [0.90001, 0, 0, 0, 0.88889],
  2970. "9130": [0, 0.3, 0, 0, 0.88889],
  2971. "9131": [1e-5, 0.9, 0, 0, 0.88889],
  2972. "9132": [0.65002, 1.15, 0, 0, 0.88889],
  2973. "9133": [0.90001, 0, 0, 0, 0.88889],
  2974. "9143": [0.88502, 0.915, 0, 0, 1.05556],
  2975. "10216": [1.25003, 1.75, 0, 0, 0.80556],
  2976. "10217": [1.25003, 1.75, 0, 0, 0.80556],
  2977. "57344": [-499e-5, 0.605, 0, 0, 1.05556],
  2978. "57345": [-499e-5, 0.605, 0, 0, 1.05556],
  2979. "57680": [0, 0.12, 0, 0, 0.45],
  2980. "57681": [0, 0.12, 0, 0, 0.45],
  2981. "57682": [0, 0.12, 0, 0, 0.45],
  2982. "57683": [0, 0.12, 0, 0, 0.45]
  2983. },
  2984. "Typewriter-Regular": {
  2985. "32": [0, 0, 0, 0, 0.525],
  2986. "33": [0, 0.61111, 0, 0, 0.525],
  2987. "34": [0, 0.61111, 0, 0, 0.525],
  2988. "35": [0, 0.61111, 0, 0, 0.525],
  2989. "36": [0.08333, 0.69444, 0, 0, 0.525],
  2990. "37": [0.08333, 0.69444, 0, 0, 0.525],
  2991. "38": [0, 0.61111, 0, 0, 0.525],
  2992. "39": [0, 0.61111, 0, 0, 0.525],
  2993. "40": [0.08333, 0.69444, 0, 0, 0.525],
  2994. "41": [0.08333, 0.69444, 0, 0, 0.525],
  2995. "42": [0, 0.52083, 0, 0, 0.525],
  2996. "43": [-0.08056, 0.53055, 0, 0, 0.525],
  2997. "44": [0.13889, 0.125, 0, 0, 0.525],
  2998. "45": [-0.08056, 0.53055, 0, 0, 0.525],
  2999. "46": [0, 0.125, 0, 0, 0.525],
  3000. "47": [0.08333, 0.69444, 0, 0, 0.525],
  3001. "48": [0, 0.61111, 0, 0, 0.525],
  3002. "49": [0, 0.61111, 0, 0, 0.525],
  3003. "50": [0, 0.61111, 0, 0, 0.525],
  3004. "51": [0, 0.61111, 0, 0, 0.525],
  3005. "52": [0, 0.61111, 0, 0, 0.525],
  3006. "53": [0, 0.61111, 0, 0, 0.525],
  3007. "54": [0, 0.61111, 0, 0, 0.525],
  3008. "55": [0, 0.61111, 0, 0, 0.525],
  3009. "56": [0, 0.61111, 0, 0, 0.525],
  3010. "57": [0, 0.61111, 0, 0, 0.525],
  3011. "58": [0, 0.43056, 0, 0, 0.525],
  3012. "59": [0.13889, 0.43056, 0, 0, 0.525],
  3013. "60": [-0.05556, 0.55556, 0, 0, 0.525],
  3014. "61": [-0.19549, 0.41562, 0, 0, 0.525],
  3015. "62": [-0.05556, 0.55556, 0, 0, 0.525],
  3016. "63": [0, 0.61111, 0, 0, 0.525],
  3017. "64": [0, 0.61111, 0, 0, 0.525],
  3018. "65": [0, 0.61111, 0, 0, 0.525],
  3019. "66": [0, 0.61111, 0, 0, 0.525],
  3020. "67": [0, 0.61111, 0, 0, 0.525],
  3021. "68": [0, 0.61111, 0, 0, 0.525],
  3022. "69": [0, 0.61111, 0, 0, 0.525],
  3023. "70": [0, 0.61111, 0, 0, 0.525],
  3024. "71": [0, 0.61111, 0, 0, 0.525],
  3025. "72": [0, 0.61111, 0, 0, 0.525],
  3026. "73": [0, 0.61111, 0, 0, 0.525],
  3027. "74": [0, 0.61111, 0, 0, 0.525],
  3028. "75": [0, 0.61111, 0, 0, 0.525],
  3029. "76": [0, 0.61111, 0, 0, 0.525],
  3030. "77": [0, 0.61111, 0, 0, 0.525],
  3031. "78": [0, 0.61111, 0, 0, 0.525],
  3032. "79": [0, 0.61111, 0, 0, 0.525],
  3033. "80": [0, 0.61111, 0, 0, 0.525],
  3034. "81": [0.13889, 0.61111, 0, 0, 0.525],
  3035. "82": [0, 0.61111, 0, 0, 0.525],
  3036. "83": [0, 0.61111, 0, 0, 0.525],
  3037. "84": [0, 0.61111, 0, 0, 0.525],
  3038. "85": [0, 0.61111, 0, 0, 0.525],
  3039. "86": [0, 0.61111, 0, 0, 0.525],
  3040. "87": [0, 0.61111, 0, 0, 0.525],
  3041. "88": [0, 0.61111, 0, 0, 0.525],
  3042. "89": [0, 0.61111, 0, 0, 0.525],
  3043. "90": [0, 0.61111, 0, 0, 0.525],
  3044. "91": [0.08333, 0.69444, 0, 0, 0.525],
  3045. "92": [0.08333, 0.69444, 0, 0, 0.525],
  3046. "93": [0.08333, 0.69444, 0, 0, 0.525],
  3047. "94": [0, 0.61111, 0, 0, 0.525],
  3048. "95": [0.09514, 0, 0, 0, 0.525],
  3049. "96": [0, 0.61111, 0, 0, 0.525],
  3050. "97": [0, 0.43056, 0, 0, 0.525],
  3051. "98": [0, 0.61111, 0, 0, 0.525],
  3052. "99": [0, 0.43056, 0, 0, 0.525],
  3053. "100": [0, 0.61111, 0, 0, 0.525],
  3054. "101": [0, 0.43056, 0, 0, 0.525],
  3055. "102": [0, 0.61111, 0, 0, 0.525],
  3056. "103": [0.22222, 0.43056, 0, 0, 0.525],
  3057. "104": [0, 0.61111, 0, 0, 0.525],
  3058. "105": [0, 0.61111, 0, 0, 0.525],
  3059. "106": [0.22222, 0.61111, 0, 0, 0.525],
  3060. "107": [0, 0.61111, 0, 0, 0.525],
  3061. "108": [0, 0.61111, 0, 0, 0.525],
  3062. "109": [0, 0.43056, 0, 0, 0.525],
  3063. "110": [0, 0.43056, 0, 0, 0.525],
  3064. "111": [0, 0.43056, 0, 0, 0.525],
  3065. "112": [0.22222, 0.43056, 0, 0, 0.525],
  3066. "113": [0.22222, 0.43056, 0, 0, 0.525],
  3067. "114": [0, 0.43056, 0, 0, 0.525],
  3068. "115": [0, 0.43056, 0, 0, 0.525],
  3069. "116": [0, 0.55358, 0, 0, 0.525],
  3070. "117": [0, 0.43056, 0, 0, 0.525],
  3071. "118": [0, 0.43056, 0, 0, 0.525],
  3072. "119": [0, 0.43056, 0, 0, 0.525],
  3073. "120": [0, 0.43056, 0, 0, 0.525],
  3074. "121": [0.22222, 0.43056, 0, 0, 0.525],
  3075. "122": [0, 0.43056, 0, 0, 0.525],
  3076. "123": [0.08333, 0.69444, 0, 0, 0.525],
  3077. "124": [0.08333, 0.69444, 0, 0, 0.525],
  3078. "125": [0.08333, 0.69444, 0, 0, 0.525],
  3079. "126": [0, 0.61111, 0, 0, 0.525],
  3080. "127": [0, 0.61111, 0, 0, 0.525],
  3081. "160": [0, 0, 0, 0, 0.525],
  3082. "176": [0, 0.61111, 0, 0, 0.525],
  3083. "184": [0.19445, 0, 0, 0, 0.525],
  3084. "305": [0, 0.43056, 0, 0, 0.525],
  3085. "567": [0.22222, 0.43056, 0, 0, 0.525],
  3086. "711": [0, 0.56597, 0, 0, 0.525],
  3087. "713": [0, 0.56555, 0, 0, 0.525],
  3088. "714": [0, 0.61111, 0, 0, 0.525],
  3089. "715": [0, 0.61111, 0, 0, 0.525],
  3090. "728": [0, 0.61111, 0, 0, 0.525],
  3091. "730": [0, 0.61111, 0, 0, 0.525],
  3092. "770": [0, 0.61111, 0, 0, 0.525],
  3093. "771": [0, 0.61111, 0, 0, 0.525],
  3094. "776": [0, 0.61111, 0, 0, 0.525],
  3095. "915": [0, 0.61111, 0, 0, 0.525],
  3096. "916": [0, 0.61111, 0, 0, 0.525],
  3097. "920": [0, 0.61111, 0, 0, 0.525],
  3098. "923": [0, 0.61111, 0, 0, 0.525],
  3099. "926": [0, 0.61111, 0, 0, 0.525],
  3100. "928": [0, 0.61111, 0, 0, 0.525],
  3101. "931": [0, 0.61111, 0, 0, 0.525],
  3102. "933": [0, 0.61111, 0, 0, 0.525],
  3103. "934": [0, 0.61111, 0, 0, 0.525],
  3104. "936": [0, 0.61111, 0, 0, 0.525],
  3105. "937": [0, 0.61111, 0, 0, 0.525],
  3106. "8216": [0, 0.61111, 0, 0, 0.525],
  3107. "8217": [0, 0.61111, 0, 0, 0.525],
  3108. "8242": [0, 0.61111, 0, 0, 0.525],
  3109. "9251": [0.11111, 0.21944, 0, 0, 0.525]
  3110. }
  3111. };
  3112. var sigmasAndXis = {
  3113. slant: [0.25, 0.25, 0.25],
  3114. // sigma1
  3115. space: [0, 0, 0],
  3116. // sigma2
  3117. stretch: [0, 0, 0],
  3118. // sigma3
  3119. shrink: [0, 0, 0],
  3120. // sigma4
  3121. xHeight: [0.431, 0.431, 0.431],
  3122. // sigma5
  3123. quad: [1, 1.171, 1.472],
  3124. // sigma6
  3125. extraSpace: [0, 0, 0],
  3126. // sigma7
  3127. num1: [0.677, 0.732, 0.925],
  3128. // sigma8
  3129. num2: [0.394, 0.384, 0.387],
  3130. // sigma9
  3131. num3: [0.444, 0.471, 0.504],
  3132. // sigma10
  3133. denom1: [0.686, 0.752, 1.025],
  3134. // sigma11
  3135. denom2: [0.345, 0.344, 0.532],
  3136. // sigma12
  3137. sup1: [0.413, 0.503, 0.504],
  3138. // sigma13
  3139. sup2: [0.363, 0.431, 0.404],
  3140. // sigma14
  3141. sup3: [0.289, 0.286, 0.294],
  3142. // sigma15
  3143. sub1: [0.15, 0.143, 0.2],
  3144. // sigma16
  3145. sub2: [0.247, 0.286, 0.4],
  3146. // sigma17
  3147. supDrop: [0.386, 0.353, 0.494],
  3148. // sigma18
  3149. subDrop: [0.05, 0.071, 0.1],
  3150. // sigma19
  3151. delim1: [2.39, 1.7, 1.98],
  3152. // sigma20
  3153. delim2: [1.01, 1.157, 1.42],
  3154. // sigma21
  3155. axisHeight: [0.25, 0.25, 0.25],
  3156. // sigma22
  3157. // These font metrics are extracted from TeX by using tftopl on cmex10.tfm;
  3158. // they correspond to the font parameters of the extension fonts (family 3).
  3159. // See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to
  3160. // match cmex7, we'd use cmex7.tfm values for script and scriptscript
  3161. // values.
  3162. defaultRuleThickness: [0.04, 0.049, 0.049],
  3163. // xi8; cmex7: 0.049
  3164. bigOpSpacing1: [0.111, 0.111, 0.111],
  3165. // xi9
  3166. bigOpSpacing2: [0.166, 0.166, 0.166],
  3167. // xi10
  3168. bigOpSpacing3: [0.2, 0.2, 0.2],
  3169. // xi11
  3170. bigOpSpacing4: [0.6, 0.611, 0.611],
  3171. // xi12; cmex7: 0.611
  3172. bigOpSpacing5: [0.1, 0.143, 0.143],
  3173. // xi13; cmex7: 0.143
  3174. // The \sqrt rule width is taken from the height of the surd character.
  3175. // Since we use the same font at all sizes, this thickness doesn't scale.
  3176. sqrtRuleThickness: [0.04, 0.04, 0.04],
  3177. // This value determines how large a pt is, for metrics which are defined
  3178. // in terms of pts.
  3179. // This value is also used in katex.scss; if you change it make sure the
  3180. // values match.
  3181. ptPerEm: [10, 10, 10],
  3182. // The space between adjacent `|` columns in an array definition. From
  3183. // `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm.
  3184. doubleRuleSep: [0.2, 0.2, 0.2],
  3185. // The width of separator lines in {array} environments. From
  3186. // `\showthe\arrayrulewidth` in LaTeX. Equals 0.4 / ptPerEm.
  3187. arrayRuleWidth: [0.04, 0.04, 0.04],
  3188. // Two values from LaTeX source2e:
  3189. fboxsep: [0.3, 0.3, 0.3],
  3190. // 3 pt / ptPerEm
  3191. fboxrule: [0.04, 0.04, 0.04]
  3192. // 0.4 pt / ptPerEm
  3193. };
  3194. var extraCharacterMap = {
  3195. // Latin-1
  3196. "Å": "A",
  3197. "Ð": "D",
  3198. "Þ": "o",
  3199. "å": "a",
  3200. "ð": "d",
  3201. "þ": "o",
  3202. // Cyrillic
  3203. "А": "A",
  3204. "Б": "B",
  3205. "В": "B",
  3206. "Г": "F",
  3207. "Д": "A",
  3208. "Е": "E",
  3209. "Ж": "K",
  3210. "З": "3",
  3211. "И": "N",
  3212. "Й": "N",
  3213. "К": "K",
  3214. "Л": "N",
  3215. "М": "M",
  3216. "Н": "H",
  3217. "О": "O",
  3218. "П": "N",
  3219. "Р": "P",
  3220. "С": "C",
  3221. "Т": "T",
  3222. "У": "y",
  3223. "Ф": "O",
  3224. "Х": "X",
  3225. "Ц": "U",
  3226. "Ч": "h",
  3227. "Ш": "W",
  3228. "Щ": "W",
  3229. "Ъ": "B",
  3230. "Ы": "X",
  3231. "Ь": "B",
  3232. "Э": "3",
  3233. "Ю": "X",
  3234. "Я": "R",
  3235. "а": "a",
  3236. "б": "b",
  3237. "в": "a",
  3238. "г": "r",
  3239. "д": "y",
  3240. "е": "e",
  3241. "ж": "m",
  3242. "з": "e",
  3243. "и": "n",
  3244. "й": "n",
  3245. "к": "n",
  3246. "л": "n",
  3247. "м": "m",
  3248. "н": "n",
  3249. "о": "o",
  3250. "п": "n",
  3251. "р": "p",
  3252. "с": "c",
  3253. "т": "o",
  3254. "у": "y",
  3255. "ф": "b",
  3256. "х": "x",
  3257. "ц": "n",
  3258. "ч": "n",
  3259. "ш": "w",
  3260. "щ": "w",
  3261. "ъ": "a",
  3262. "ы": "m",
  3263. "ь": "a",
  3264. "э": "e",
  3265. "ю": "m",
  3266. "я": "r"
  3267. };
  3268. function setFontMetrics(fontName, metrics) {
  3269. fontMetricsData[fontName] = metrics;
  3270. }
  3271. function getCharacterMetrics(character, font, mode) {
  3272. if (!fontMetricsData[font]) {
  3273. throw new Error("Font metrics not found for font: " + font + ".");
  3274. }
  3275. var ch = character.charCodeAt(0);
  3276. var metrics = fontMetricsData[font][ch];
  3277. if (!metrics && character[0] in extraCharacterMap) {
  3278. ch = extraCharacterMap[character[0]].charCodeAt(0);
  3279. metrics = fontMetricsData[font][ch];
  3280. }
  3281. if (!metrics && mode === "text") {
  3282. if (supportedCodepoint(ch)) {
  3283. metrics = fontMetricsData[font][77];
  3284. }
  3285. }
  3286. if (metrics) {
  3287. return {
  3288. depth: metrics[0],
  3289. height: metrics[1],
  3290. italic: metrics[2],
  3291. skew: metrics[3],
  3292. width: metrics[4]
  3293. };
  3294. }
  3295. }
  3296. var fontMetricsBySizeIndex = {};
  3297. function getGlobalMetrics(size) {
  3298. var sizeIndex;
  3299. if (size >= 5) {
  3300. sizeIndex = 0;
  3301. } else if (size >= 3) {
  3302. sizeIndex = 1;
  3303. } else {
  3304. sizeIndex = 2;
  3305. }
  3306. if (!fontMetricsBySizeIndex[sizeIndex]) {
  3307. var metrics = fontMetricsBySizeIndex[sizeIndex] = {
  3308. cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18
  3309. };
  3310. for (var key in sigmasAndXis) {
  3311. if (sigmasAndXis.hasOwnProperty(key)) {
  3312. metrics[key] = sigmasAndXis[key][sizeIndex];
  3313. }
  3314. }
  3315. }
  3316. return fontMetricsBySizeIndex[sizeIndex];
  3317. }
  3318. var ATOMS = {
  3319. "bin": 1,
  3320. "close": 1,
  3321. "inner": 1,
  3322. "open": 1,
  3323. "punct": 1,
  3324. "rel": 1
  3325. };
  3326. var NON_ATOMS = {
  3327. "accent-token": 1,
  3328. "mathord": 1,
  3329. "op-token": 1,
  3330. "spacing": 1,
  3331. "textord": 1
  3332. };
  3333. var symbols = {
  3334. "math": {},
  3335. "text": {}
  3336. };
  3337. function defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) {
  3338. symbols[mode][name] = {
  3339. font,
  3340. group,
  3341. replace
  3342. };
  3343. if (acceptUnicodeChar && replace) {
  3344. symbols[mode][replace] = symbols[mode][name];
  3345. }
  3346. }
  3347. var math = "math";
  3348. var text = "text";
  3349. var main = "main";
  3350. var ams = "ams";
  3351. var accent = "accent-token";
  3352. var bin = "bin";
  3353. var close = "close";
  3354. var inner = "inner";
  3355. var mathord = "mathord";
  3356. var op = "op-token";
  3357. var open = "open";
  3358. var punct = "punct";
  3359. var rel = "rel";
  3360. var spacing = "spacing";
  3361. var textord = "textord";
  3362. defineSymbol(math, main, rel, "≡", "\\equiv", true);
  3363. defineSymbol(math, main, rel, "≺", "\\prec", true);
  3364. defineSymbol(math, main, rel, "≻", "\\succ", true);
  3365. defineSymbol(math, main, rel, "∼", "\\sim", true);
  3366. defineSymbol(math, main, rel, "⊥", "\\perp");
  3367. defineSymbol(math, main, rel, "⪯", "\\preceq", true);
  3368. defineSymbol(math, main, rel, "⪰", "\\succeq", true);
  3369. defineSymbol(math, main, rel, "≃", "\\simeq", true);
  3370. defineSymbol(math, main, rel, "∣", "\\mid", true);
  3371. defineSymbol(math, main, rel, "≪", "\\ll", true);
  3372. defineSymbol(math, main, rel, "≫", "\\gg", true);
  3373. defineSymbol(math, main, rel, "≍", "\\asymp", true);
  3374. defineSymbol(math, main, rel, "∥", "\\parallel");
  3375. defineSymbol(math, main, rel, "⋈", "\\bowtie", true);
  3376. defineSymbol(math, main, rel, "⌣", "\\smile", true);
  3377. defineSymbol(math, main, rel, "⊑", "\\sqsubseteq", true);
  3378. defineSymbol(math, main, rel, "⊒", "\\sqsupseteq", true);
  3379. defineSymbol(math, main, rel, "≐", "\\doteq", true);
  3380. defineSymbol(math, main, rel, "⌢", "\\frown", true);
  3381. defineSymbol(math, main, rel, "∋", "\\ni", true);
  3382. defineSymbol(math, main, rel, "∝", "\\propto", true);
  3383. defineSymbol(math, main, rel, "⊢", "\\vdash", true);
  3384. defineSymbol(math, main, rel, "⊣", "\\dashv", true);
  3385. defineSymbol(math, main, rel, "∋", "\\owns");
  3386. defineSymbol(math, main, punct, ".", "\\ldotp");
  3387. defineSymbol(math, main, punct, "⋅", "\\cdotp");
  3388. defineSymbol(math, main, punct, "⋅", "·");
  3389. defineSymbol(text, main, textord, "⋅", "·");
  3390. defineSymbol(math, main, textord, "#", "\\#");
  3391. defineSymbol(text, main, textord, "#", "\\#");
  3392. defineSymbol(math, main, textord, "&", "\\&");
  3393. defineSymbol(text, main, textord, "&", "\\&");
  3394. defineSymbol(math, main, textord, "ℵ", "\\aleph", true);
  3395. defineSymbol(math, main, textord, "∀", "\\forall", true);
  3396. defineSymbol(math, main, textord, "ℏ", "\\hbar", true);
  3397. defineSymbol(math, main, textord, "∃", "\\exists", true);
  3398. defineSymbol(math, main, textord, "∇", "\\nabla", true);
  3399. defineSymbol(math, main, textord, "♭", "\\flat", true);
  3400. defineSymbol(math, main, textord, "ℓ", "\\ell", true);
  3401. defineSymbol(math, main, textord, "♮", "\\natural", true);
  3402. defineSymbol(math, main, textord, "♣", "\\clubsuit", true);
  3403. defineSymbol(math, main, textord, "℘", "\\wp", true);
  3404. defineSymbol(math, main, textord, "♯", "\\sharp", true);
  3405. defineSymbol(math, main, textord, "♢", "\\diamondsuit", true);
  3406. defineSymbol(math, main, textord, "ℜ", "\\Re", true);
  3407. defineSymbol(math, main, textord, "♡", "\\heartsuit", true);
  3408. defineSymbol(math, main, textord, "ℑ", "\\Im", true);
  3409. defineSymbol(math, main, textord, "♠", "\\spadesuit", true);
  3410. defineSymbol(math, main, textord, "§", "\\S", true);
  3411. defineSymbol(text, main, textord, "§", "\\S");
  3412. defineSymbol(math, main, textord, "¶", "\\P", true);
  3413. defineSymbol(text, main, textord, "¶", "\\P");
  3414. defineSymbol(math, main, textord, "†", "\\dag");
  3415. defineSymbol(text, main, textord, "†", "\\dag");
  3416. defineSymbol(text, main, textord, "†", "\\textdagger");
  3417. defineSymbol(math, main, textord, "‡", "\\ddag");
  3418. defineSymbol(text, main, textord, "‡", "\\ddag");
  3419. defineSymbol(text, main, textord, "‡", "\\textdaggerdbl");
  3420. defineSymbol(math, main, close, "⎱", "\\rmoustache", true);
  3421. defineSymbol(math, main, open, "⎰", "\\lmoustache", true);
  3422. defineSymbol(math, main, close, "⟯", "\\rgroup", true);
  3423. defineSymbol(math, main, open, "⟮", "\\lgroup", true);
  3424. defineSymbol(math, main, bin, "∓", "\\mp", true);
  3425. defineSymbol(math, main, bin, "⊖", "\\ominus", true);
  3426. defineSymbol(math, main, bin, "⊎", "\\uplus", true);
  3427. defineSymbol(math, main, bin, "⊓", "\\sqcap", true);
  3428. defineSymbol(math, main, bin, "∗", "\\ast");
  3429. defineSymbol(math, main, bin, "⊔", "\\sqcup", true);
  3430. defineSymbol(math, main, bin, "◯", "\\bigcirc", true);
  3431. defineSymbol(math, main, bin, "∙", "\\bullet", true);
  3432. defineSymbol(math, main, bin, "‡", "\\ddagger");
  3433. defineSymbol(math, main, bin, "≀", "\\wr", true);
  3434. defineSymbol(math, main, bin, "⨿", "\\amalg");
  3435. defineSymbol(math, main, bin, "&", "\\And");
  3436. defineSymbol(math, main, rel, "⟵", "\\longleftarrow", true);
  3437. defineSymbol(math, main, rel, "⇐", "\\Leftarrow", true);
  3438. defineSymbol(math, main, rel, "⟸", "\\Longleftarrow", true);
  3439. defineSymbol(math, main, rel, "⟶", "\\longrightarrow", true);
  3440. defineSymbol(math, main, rel, "⇒", "\\Rightarrow", true);
  3441. defineSymbol(math, main, rel, "⟹", "\\Longrightarrow", true);
  3442. defineSymbol(math, main, rel, "↔", "\\leftrightarrow", true);
  3443. defineSymbol(math, main, rel, "⟷", "\\longleftrightarrow", true);
  3444. defineSymbol(math, main, rel, "⇔", "\\Leftrightarrow", true);
  3445. defineSymbol(math, main, rel, "⟺", "\\Longleftrightarrow", true);
  3446. defineSymbol(math, main, rel, "↦", "\\mapsto", true);
  3447. defineSymbol(math, main, rel, "⟼", "\\longmapsto", true);
  3448. defineSymbol(math, main, rel, "↗", "\\nearrow", true);
  3449. defineSymbol(math, main, rel, "↩", "\\hookleftarrow", true);
  3450. defineSymbol(math, main, rel, "↪", "\\hookrightarrow", true);
  3451. defineSymbol(math, main, rel, "↘", "\\searrow", true);
  3452. defineSymbol(math, main, rel, "↼", "\\leftharpoonup", true);
  3453. defineSymbol(math, main, rel, "⇀", "\\rightharpoonup", true);
  3454. defineSymbol(math, main, rel, "↙", "\\swarrow", true);
  3455. defineSymbol(math, main, rel, "↽", "\\leftharpoondown", true);
  3456. defineSymbol(math, main, rel, "⇁", "\\rightharpoondown", true);
  3457. defineSymbol(math, main, rel, "↖", "\\nwarrow", true);
  3458. defineSymbol(math, main, rel, "⇌", "\\rightleftharpoons", true);
  3459. defineSymbol(math, ams, rel, "≮", "\\nless", true);
  3460. defineSymbol(math, ams, rel, "", "\\@nleqslant");
  3461. defineSymbol(math, ams, rel, "", "\\@nleqq");
  3462. defineSymbol(math, ams, rel, "⪇", "\\lneq", true);
  3463. defineSymbol(math, ams, rel, "≨", "\\lneqq", true);
  3464. defineSymbol(math, ams, rel, "", "\\@lvertneqq");
  3465. defineSymbol(math, ams, rel, "⋦", "\\lnsim", true);
  3466. defineSymbol(math, ams, rel, "⪉", "\\lnapprox", true);
  3467. defineSymbol(math, ams, rel, "⊀", "\\nprec", true);
  3468. defineSymbol(math, ams, rel, "⋠", "\\npreceq", true);
  3469. defineSymbol(math, ams, rel, "⋨", "\\precnsim", true);
  3470. defineSymbol(math, ams, rel, "⪹", "\\precnapprox", true);
  3471. defineSymbol(math, ams, rel, "≁", "\\nsim", true);
  3472. defineSymbol(math, ams, rel, "", "\\@nshortmid");
  3473. defineSymbol(math, ams, rel, "∤", "\\nmid", true);
  3474. defineSymbol(math, ams, rel, "⊬", "\\nvdash", true);
  3475. defineSymbol(math, ams, rel, "⊭", "\\nvDash", true);
  3476. defineSymbol(math, ams, rel, "⋪", "\\ntriangleleft");
  3477. defineSymbol(math, ams, rel, "⋬", "\\ntrianglelefteq", true);
  3478. defineSymbol(math, ams, rel, "⊊", "\\subsetneq", true);
  3479. defineSymbol(math, ams, rel, "", "\\@varsubsetneq");
  3480. defineSymbol(math, ams, rel, "⫋", "\\subsetneqq", true);
  3481. defineSymbol(math, ams, rel, "", "\\@varsubsetneqq");
  3482. defineSymbol(math, ams, rel, "≯", "\\ngtr", true);
  3483. defineSymbol(math, ams, rel, "", "\\@ngeqslant");
  3484. defineSymbol(math, ams, rel, "", "\\@ngeqq");
  3485. defineSymbol(math, ams, rel, "⪈", "\\gneq", true);
  3486. defineSymbol(math, ams, rel, "≩", "\\gneqq", true);
  3487. defineSymbol(math, ams, rel, "", "\\@gvertneqq");
  3488. defineSymbol(math, ams, rel, "⋧", "\\gnsim", true);
  3489. defineSymbol(math, ams, rel, "⪊", "\\gnapprox", true);
  3490. defineSymbol(math, ams, rel, "⊁", "\\nsucc", true);
  3491. defineSymbol(math, ams, rel, "⋡", "\\nsucceq", true);
  3492. defineSymbol(math, ams, rel, "⋩", "\\succnsim", true);
  3493. defineSymbol(math, ams, rel, "⪺", "\\succnapprox", true);
  3494. defineSymbol(math, ams, rel, "≆", "\\ncong", true);
  3495. defineSymbol(math, ams, rel, "", "\\@nshortparallel");
  3496. defineSymbol(math, ams, rel, "∦", "\\nparallel", true);
  3497. defineSymbol(math, ams, rel, "⊯", "\\nVDash", true);
  3498. defineSymbol(math, ams, rel, "⋫", "\\ntriangleright");
  3499. defineSymbol(math, ams, rel, "⋭", "\\ntrianglerighteq", true);
  3500. defineSymbol(math, ams, rel, "", "\\@nsupseteqq");
  3501. defineSymbol(math, ams, rel, "⊋", "\\supsetneq", true);
  3502. defineSymbol(math, ams, rel, "", "\\@varsupsetneq");
  3503. defineSymbol(math, ams, rel, "⫌", "\\supsetneqq", true);
  3504. defineSymbol(math, ams, rel, "", "\\@varsupsetneqq");
  3505. defineSymbol(math, ams, rel, "⊮", "\\nVdash", true);
  3506. defineSymbol(math, ams, rel, "⪵", "\\precneqq", true);
  3507. defineSymbol(math, ams, rel, "⪶", "\\succneqq", true);
  3508. defineSymbol(math, ams, rel, "", "\\@nsubseteqq");
  3509. defineSymbol(math, ams, bin, "⊴", "\\unlhd");
  3510. defineSymbol(math, ams, bin, "⊵", "\\unrhd");
  3511. defineSymbol(math, ams, rel, "↚", "\\nleftarrow", true);
  3512. defineSymbol(math, ams, rel, "↛", "\\nrightarrow", true);
  3513. defineSymbol(math, ams, rel, "⇍", "\\nLeftarrow", true);
  3514. defineSymbol(math, ams, rel, "⇏", "\\nRightarrow", true);
  3515. defineSymbol(math, ams, rel, "↮", "\\nleftrightarrow", true);
  3516. defineSymbol(math, ams, rel, "⇎", "\\nLeftrightarrow", true);
  3517. defineSymbol(math, ams, rel, "△", "\\vartriangle");
  3518. defineSymbol(math, ams, textord, "ℏ", "\\hslash");
  3519. defineSymbol(math, ams, textord, "▽", "\\triangledown");
  3520. defineSymbol(math, ams, textord, "◊", "\\lozenge");
  3521. defineSymbol(math, ams, textord, "Ⓢ", "\\circledS");
  3522. defineSymbol(math, ams, textord, "®", "\\circledR");
  3523. defineSymbol(text, ams, textord, "®", "\\circledR");
  3524. defineSymbol(math, ams, textord, "∡", "\\measuredangle", true);
  3525. defineSymbol(math, ams, textord, "∄", "\\nexists");
  3526. defineSymbol(math, ams, textord, "℧", "\\mho");
  3527. defineSymbol(math, ams, textord, "Ⅎ", "\\Finv", true);
  3528. defineSymbol(math, ams, textord, "⅁", "\\Game", true);
  3529. defineSymbol(math, ams, textord, "‵", "\\backprime");
  3530. defineSymbol(math, ams, textord, "▲", "\\blacktriangle");
  3531. defineSymbol(math, ams, textord, "▼", "\\blacktriangledown");
  3532. defineSymbol(math, ams, textord, "■", "\\blacksquare");
  3533. defineSymbol(math, ams, textord, "⧫", "\\blacklozenge");
  3534. defineSymbol(math, ams, textord, "★", "\\bigstar");
  3535. defineSymbol(math, ams, textord, "∢", "\\sphericalangle", true);
  3536. defineSymbol(math, ams, textord, "∁", "\\complement", true);
  3537. defineSymbol(math, ams, textord, "ð", "\\eth", true);
  3538. defineSymbol(text, main, textord, "ð", "ð");
  3539. defineSymbol(math, ams, textord, "╱", "\\diagup");
  3540. defineSymbol(math, ams, textord, "╲", "\\diagdown");
  3541. defineSymbol(math, ams, textord, "□", "\\square");
  3542. defineSymbol(math, ams, textord, "□", "\\Box");
  3543. defineSymbol(math, ams, textord, "◊", "\\Diamond");
  3544. defineSymbol(math, ams, textord, "¥", "\\yen", true);
  3545. defineSymbol(text, ams, textord, "¥", "\\yen", true);
  3546. defineSymbol(math, ams, textord, "✓", "\\checkmark", true);
  3547. defineSymbol(text, ams, textord, "✓", "\\checkmark");
  3548. defineSymbol(math, ams, textord, "ℶ", "\\beth", true);
  3549. defineSymbol(math, ams, textord, "ℸ", "\\daleth", true);
  3550. defineSymbol(math, ams, textord, "ℷ", "\\gimel", true);
  3551. defineSymbol(math, ams, textord, "ϝ", "\\digamma", true);
  3552. defineSymbol(math, ams, textord, "ϰ", "\\varkappa");
  3553. defineSymbol(math, ams, open, "┌", "\\@ulcorner", true);
  3554. defineSymbol(math, ams, close, "┐", "\\@urcorner", true);
  3555. defineSymbol(math, ams, open, "└", "\\@llcorner", true);
  3556. defineSymbol(math, ams, close, "┘", "\\@lrcorner", true);
  3557. defineSymbol(math, ams, rel, "≦", "\\leqq", true);
  3558. defineSymbol(math, ams, rel, "⩽", "\\leqslant", true);
  3559. defineSymbol(math, ams, rel, "⪕", "\\eqslantless", true);
  3560. defineSymbol(math, ams, rel, "≲", "\\lesssim", true);
  3561. defineSymbol(math, ams, rel, "⪅", "\\lessapprox", true);
  3562. defineSymbol(math, ams, rel, "≊", "\\approxeq", true);
  3563. defineSymbol(math, ams, bin, "⋖", "\\lessdot");
  3564. defineSymbol(math, ams, rel, "⋘", "\\lll", true);
  3565. defineSymbol(math, ams, rel, "≶", "\\lessgtr", true);
  3566. defineSymbol(math, ams, rel, "⋚", "\\lesseqgtr", true);
  3567. defineSymbol(math, ams, rel, "⪋", "\\lesseqqgtr", true);
  3568. defineSymbol(math, ams, rel, "≑", "\\doteqdot");
  3569. defineSymbol(math, ams, rel, "≓", "\\risingdotseq", true);
  3570. defineSymbol(math, ams, rel, "≒", "\\fallingdotseq", true);
  3571. defineSymbol(math, ams, rel, "∽", "\\backsim", true);
  3572. defineSymbol(math, ams, rel, "⋍", "\\backsimeq", true);
  3573. defineSymbol(math, ams, rel, "⫅", "\\subseteqq", true);
  3574. defineSymbol(math, ams, rel, "⋐", "\\Subset", true);
  3575. defineSymbol(math, ams, rel, "⊏", "\\sqsubset", true);
  3576. defineSymbol(math, ams, rel, "≼", "\\preccurlyeq", true);
  3577. defineSymbol(math, ams, rel, "⋞", "\\curlyeqprec", true);
  3578. defineSymbol(math, ams, rel, "≾", "\\precsim", true);
  3579. defineSymbol(math, ams, rel, "⪷", "\\precapprox", true);
  3580. defineSymbol(math, ams, rel, "⊲", "\\vartriangleleft");
  3581. defineSymbol(math, ams, rel, "⊴", "\\trianglelefteq");
  3582. defineSymbol(math, ams, rel, "⊨", "\\vDash", true);
  3583. defineSymbol(math, ams, rel, "⊪", "\\Vvdash", true);
  3584. defineSymbol(math, ams, rel, "⌣", "\\smallsmile");
  3585. defineSymbol(math, ams, rel, "⌢", "\\smallfrown");
  3586. defineSymbol(math, ams, rel, "≏", "\\bumpeq", true);
  3587. defineSymbol(math, ams, rel, "≎", "\\Bumpeq", true);
  3588. defineSymbol(math, ams, rel, "≧", "\\geqq", true);
  3589. defineSymbol(math, ams, rel, "⩾", "\\geqslant", true);
  3590. defineSymbol(math, ams, rel, "⪖", "\\eqslantgtr", true);
  3591. defineSymbol(math, ams, rel, "≳", "\\gtrsim", true);
  3592. defineSymbol(math, ams, rel, "⪆", "\\gtrapprox", true);
  3593. defineSymbol(math, ams, bin, "⋗", "\\gtrdot");
  3594. defineSymbol(math, ams, rel, "⋙", "\\ggg", true);
  3595. defineSymbol(math, ams, rel, "≷", "\\gtrless", true);
  3596. defineSymbol(math, ams, rel, "⋛", "\\gtreqless", true);
  3597. defineSymbol(math, ams, rel, "⪌", "\\gtreqqless", true);
  3598. defineSymbol(math, ams, rel, "≖", "\\eqcirc", true);
  3599. defineSymbol(math, ams, rel, "≗", "\\circeq", true);
  3600. defineSymbol(math, ams, rel, "≜", "\\triangleq", true);
  3601. defineSymbol(math, ams, rel, "∼", "\\thicksim");
  3602. defineSymbol(math, ams, rel, "≈", "\\thickapprox");
  3603. defineSymbol(math, ams, rel, "⫆", "\\supseteqq", true);
  3604. defineSymbol(math, ams, rel, "⋑", "\\Supset", true);
  3605. defineSymbol(math, ams, rel, "⊐", "\\sqsupset", true);
  3606. defineSymbol(math, ams, rel, "≽", "\\succcurlyeq", true);
  3607. defineSymbol(math, ams, rel, "⋟", "\\curlyeqsucc", true);
  3608. defineSymbol(math, ams, rel, "≿", "\\succsim", true);
  3609. defineSymbol(math, ams, rel, "⪸", "\\succapprox", true);
  3610. defineSymbol(math, ams, rel, "⊳", "\\vartriangleright");
  3611. defineSymbol(math, ams, rel, "⊵", "\\trianglerighteq");
  3612. defineSymbol(math, ams, rel, "⊩", "\\Vdash", true);
  3613. defineSymbol(math, ams, rel, "∣", "\\shortmid");
  3614. defineSymbol(math, ams, rel, "∥", "\\shortparallel");
  3615. defineSymbol(math, ams, rel, "≬", "\\between", true);
  3616. defineSymbol(math, ams, rel, "⋔", "\\pitchfork", true);
  3617. defineSymbol(math, ams, rel, "∝", "\\varpropto");
  3618. defineSymbol(math, ams, rel, "◀", "\\blacktriangleleft");
  3619. defineSymbol(math, ams, rel, "∴", "\\therefore", true);
  3620. defineSymbol(math, ams, rel, "∍", "\\backepsilon");
  3621. defineSymbol(math, ams, rel, "▶", "\\blacktriangleright");
  3622. defineSymbol(math, ams, rel, "∵", "\\because", true);
  3623. defineSymbol(math, ams, rel, "⋘", "\\llless");
  3624. defineSymbol(math, ams, rel, "⋙", "\\gggtr");
  3625. defineSymbol(math, ams, bin, "⊲", "\\lhd");
  3626. defineSymbol(math, ams, bin, "⊳", "\\rhd");
  3627. defineSymbol(math, ams, rel, "≂", "\\eqsim", true);
  3628. defineSymbol(math, main, rel, "⋈", "\\Join");
  3629. defineSymbol(math, ams, rel, "≑", "\\Doteq", true);
  3630. defineSymbol(math, ams, bin, "∔", "\\dotplus", true);
  3631. defineSymbol(math, ams, bin, "∖", "\\smallsetminus");
  3632. defineSymbol(math, ams, bin, "⋒", "\\Cap", true);
  3633. defineSymbol(math, ams, bin, "⋓", "\\Cup", true);
  3634. defineSymbol(math, ams, bin, "⩞", "\\doublebarwedge", true);
  3635. defineSymbol(math, ams, bin, "⊟", "\\boxminus", true);
  3636. defineSymbol(math, ams, bin, "⊞", "\\boxplus", true);
  3637. defineSymbol(math, ams, bin, "⋇", "\\divideontimes", true);
  3638. defineSymbol(math, ams, bin, "⋉", "\\ltimes", true);
  3639. defineSymbol(math, ams, bin, "⋊", "\\rtimes", true);
  3640. defineSymbol(math, ams, bin, "⋋", "\\leftthreetimes", true);
  3641. defineSymbol(math, ams, bin, "⋌", "\\rightthreetimes", true);
  3642. defineSymbol(math, ams, bin, "⋏", "\\curlywedge", true);
  3643. defineSymbol(math, ams, bin, "⋎", "\\curlyvee", true);
  3644. defineSymbol(math, ams, bin, "⊝", "\\circleddash", true);
  3645. defineSymbol(math, ams, bin, "⊛", "\\circledast", true);
  3646. defineSymbol(math, ams, bin, "⋅", "\\centerdot");
  3647. defineSymbol(math, ams, bin, "⊺", "\\intercal", true);
  3648. defineSymbol(math, ams, bin, "⋒", "\\doublecap");
  3649. defineSymbol(math, ams, bin, "⋓", "\\doublecup");
  3650. defineSymbol(math, ams, bin, "⊠", "\\boxtimes", true);
  3651. defineSymbol(math, ams, rel, "⇢", "\\dashrightarrow", true);
  3652. defineSymbol(math, ams, rel, "⇠", "\\dashleftarrow", true);
  3653. defineSymbol(math, ams, rel, "⇇", "\\leftleftarrows", true);
  3654. defineSymbol(math, ams, rel, "⇆", "\\leftrightarrows", true);
  3655. defineSymbol(math, ams, rel, "⇚", "\\Lleftarrow", true);
  3656. defineSymbol(math, ams, rel, "↞", "\\twoheadleftarrow", true);
  3657. defineSymbol(math, ams, rel, "↢", "\\leftarrowtail", true);
  3658. defineSymbol(math, ams, rel, "↫", "\\looparrowleft", true);
  3659. defineSymbol(math, ams, rel, "⇋", "\\leftrightharpoons", true);
  3660. defineSymbol(math, ams, rel, "↶", "\\curvearrowleft", true);
  3661. defineSymbol(math, ams, rel, "↺", "\\circlearrowleft", true);
  3662. defineSymbol(math, ams, rel, "↰", "\\Lsh", true);
  3663. defineSymbol(math, ams, rel, "⇈", "\\upuparrows", true);
  3664. defineSymbol(math, ams, rel, "↿", "\\upharpoonleft", true);
  3665. defineSymbol(math, ams, rel, "⇃", "\\downharpoonleft", true);
  3666. defineSymbol(math, main, rel, "⊶", "\\origof", true);
  3667. defineSymbol(math, main, rel, "⊷", "\\imageof", true);
  3668. defineSymbol(math, ams, rel, "⊸", "\\multimap", true);
  3669. defineSymbol(math, ams, rel, "↭", "\\leftrightsquigarrow", true);
  3670. defineSymbol(math, ams, rel, "⇉", "\\rightrightarrows", true);
  3671. defineSymbol(math, ams, rel, "⇄", "\\rightleftarrows", true);
  3672. defineSymbol(math, ams, rel, "↠", "\\twoheadrightarrow", true);
  3673. defineSymbol(math, ams, rel, "↣", "\\rightarrowtail", true);
  3674. defineSymbol(math, ams, rel, "↬", "\\looparrowright", true);
  3675. defineSymbol(math, ams, rel, "↷", "\\curvearrowright", true);
  3676. defineSymbol(math, ams, rel, "↻", "\\circlearrowright", true);
  3677. defineSymbol(math, ams, rel, "↱", "\\Rsh", true);
  3678. defineSymbol(math, ams, rel, "⇊", "\\downdownarrows", true);
  3679. defineSymbol(math, ams, rel, "↾", "\\upharpoonright", true);
  3680. defineSymbol(math, ams, rel, "⇂", "\\downharpoonright", true);
  3681. defineSymbol(math, ams, rel, "⇝", "\\rightsquigarrow", true);
  3682. defineSymbol(math, ams, rel, "⇝", "\\leadsto");
  3683. defineSymbol(math, ams, rel, "⇛", "\\Rrightarrow", true);
  3684. defineSymbol(math, ams, rel, "↾", "\\restriction");
  3685. defineSymbol(math, main, textord, "‘", "`");
  3686. defineSymbol(math, main, textord, "$", "\\$");
  3687. defineSymbol(text, main, textord, "$", "\\$");
  3688. defineSymbol(text, main, textord, "$", "\\textdollar");
  3689. defineSymbol(math, main, textord, "%", "\\%");
  3690. defineSymbol(text, main, textord, "%", "\\%");
  3691. defineSymbol(math, main, textord, "_", "\\_");
  3692. defineSymbol(text, main, textord, "_", "\\_");
  3693. defineSymbol(text, main, textord, "_", "\\textunderscore");
  3694. defineSymbol(math, main, textord, "∠", "\\angle", true);
  3695. defineSymbol(math, main, textord, "∞", "\\infty", true);
  3696. defineSymbol(math, main, textord, "′", "\\prime");
  3697. defineSymbol(math, main, textord, "△", "\\triangle");
  3698. defineSymbol(math, main, textord, "Γ", "\\Gamma", true);
  3699. defineSymbol(math, main, textord, "Δ", "\\Delta", true);
  3700. defineSymbol(math, main, textord, "Θ", "\\Theta", true);
  3701. defineSymbol(math, main, textord, "Λ", "\\Lambda", true);
  3702. defineSymbol(math, main, textord, "Ξ", "\\Xi", true);
  3703. defineSymbol(math, main, textord, "Π", "\\Pi", true);
  3704. defineSymbol(math, main, textord, "Σ", "\\Sigma", true);
  3705. defineSymbol(math, main, textord, "Υ", "\\Upsilon", true);
  3706. defineSymbol(math, main, textord, "Φ", "\\Phi", true);
  3707. defineSymbol(math, main, textord, "Ψ", "\\Psi", true);
  3708. defineSymbol(math, main, textord, "Ω", "\\Omega", true);
  3709. defineSymbol(math, main, textord, "A", "Α");
  3710. defineSymbol(math, main, textord, "B", "Β");
  3711. defineSymbol(math, main, textord, "E", "Ε");
  3712. defineSymbol(math, main, textord, "Z", "Ζ");
  3713. defineSymbol(math, main, textord, "H", "Η");
  3714. defineSymbol(math, main, textord, "I", "Ι");
  3715. defineSymbol(math, main, textord, "K", "Κ");
  3716. defineSymbol(math, main, textord, "M", "Μ");
  3717. defineSymbol(math, main, textord, "N", "Ν");
  3718. defineSymbol(math, main, textord, "O", "Ο");
  3719. defineSymbol(math, main, textord, "P", "Ρ");
  3720. defineSymbol(math, main, textord, "T", "Τ");
  3721. defineSymbol(math, main, textord, "X", "Χ");
  3722. defineSymbol(math, main, textord, "¬", "\\neg", true);
  3723. defineSymbol(math, main, textord, "¬", "\\lnot");
  3724. defineSymbol(math, main, textord, "⊤", "\\top");
  3725. defineSymbol(math, main, textord, "⊥", "\\bot");
  3726. defineSymbol(math, main, textord, "∅", "\\emptyset");
  3727. defineSymbol(math, ams, textord, "∅", "\\varnothing");
  3728. defineSymbol(math, main, mathord, "α", "\\alpha", true);
  3729. defineSymbol(math, main, mathord, "β", "\\beta", true);
  3730. defineSymbol(math, main, mathord, "γ", "\\gamma", true);
  3731. defineSymbol(math, main, mathord, "δ", "\\delta", true);
  3732. defineSymbol(math, main, mathord, "ϵ", "\\epsilon", true);
  3733. defineSymbol(math, main, mathord, "ζ", "\\zeta", true);
  3734. defineSymbol(math, main, mathord, "η", "\\eta", true);
  3735. defineSymbol(math, main, mathord, "θ", "\\theta", true);
  3736. defineSymbol(math, main, mathord, "ι", "\\iota", true);
  3737. defineSymbol(math, main, mathord, "κ", "\\kappa", true);
  3738. defineSymbol(math, main, mathord, "λ", "\\lambda", true);
  3739. defineSymbol(math, main, mathord, "μ", "\\mu", true);
  3740. defineSymbol(math, main, mathord, "ν", "\\nu", true);
  3741. defineSymbol(math, main, mathord, "ξ", "\\xi", true);
  3742. defineSymbol(math, main, mathord, "ο", "\\omicron", true);
  3743. defineSymbol(math, main, mathord, "π", "\\pi", true);
  3744. defineSymbol(math, main, mathord, "ρ", "\\rho", true);
  3745. defineSymbol(math, main, mathord, "σ", "\\sigma", true);
  3746. defineSymbol(math, main, mathord, "τ", "\\tau", true);
  3747. defineSymbol(math, main, mathord, "υ", "\\upsilon", true);
  3748. defineSymbol(math, main, mathord, "ϕ", "\\phi", true);
  3749. defineSymbol(math, main, mathord, "χ", "\\chi", true);
  3750. defineSymbol(math, main, mathord, "ψ", "\\psi", true);
  3751. defineSymbol(math, main, mathord, "ω", "\\omega", true);
  3752. defineSymbol(math, main, mathord, "ε", "\\varepsilon", true);
  3753. defineSymbol(math, main, mathord, "ϑ", "\\vartheta", true);
  3754. defineSymbol(math, main, mathord, "ϖ", "\\varpi", true);
  3755. defineSymbol(math, main, mathord, "ϱ", "\\varrho", true);
  3756. defineSymbol(math, main, mathord, "ς", "\\varsigma", true);
  3757. defineSymbol(math, main, mathord, "φ", "\\varphi", true);
  3758. defineSymbol(math, main, bin, "∗", "*", true);
  3759. defineSymbol(math, main, bin, "+", "+");
  3760. defineSymbol(math, main, bin, "−", "-", true);
  3761. defineSymbol(math, main, bin, "⋅", "\\cdot", true);
  3762. defineSymbol(math, main, bin, "∘", "\\circ", true);
  3763. defineSymbol(math, main, bin, "÷", "\\div", true);
  3764. defineSymbol(math, main, bin, "±", "\\pm", true);
  3765. defineSymbol(math, main, bin, "×", "\\times", true);
  3766. defineSymbol(math, main, bin, "∩", "\\cap", true);
  3767. defineSymbol(math, main, bin, "∪", "\\cup", true);
  3768. defineSymbol(math, main, bin, "∖", "\\setminus", true);
  3769. defineSymbol(math, main, bin, "∧", "\\land");
  3770. defineSymbol(math, main, bin, "∨", "\\lor");
  3771. defineSymbol(math, main, bin, "∧", "\\wedge", true);
  3772. defineSymbol(math, main, bin, "∨", "\\vee", true);
  3773. defineSymbol(math, main, textord, "√", "\\surd");
  3774. defineSymbol(math, main, open, "⟨", "\\langle", true);
  3775. defineSymbol(math, main, open, "∣", "\\lvert");
  3776. defineSymbol(math, main, open, "∥", "\\lVert");
  3777. defineSymbol(math, main, close, "?", "?");
  3778. defineSymbol(math, main, close, "!", "!");
  3779. defineSymbol(math, main, close, "⟩", "\\rangle", true);
  3780. defineSymbol(math, main, close, "∣", "\\rvert");
  3781. defineSymbol(math, main, close, "∥", "\\rVert");
  3782. defineSymbol(math, main, rel, "=", "=");
  3783. defineSymbol(math, main, rel, ":", ":");
  3784. defineSymbol(math, main, rel, "≈", "\\approx", true);
  3785. defineSymbol(math, main, rel, "≅", "\\cong", true);
  3786. defineSymbol(math, main, rel, "≥", "\\ge");
  3787. defineSymbol(math, main, rel, "≥", "\\geq", true);
  3788. defineSymbol(math, main, rel, "←", "\\gets");
  3789. defineSymbol(math, main, rel, ">", "\\gt", true);
  3790. defineSymbol(math, main, rel, "∈", "\\in", true);
  3791. defineSymbol(math, main, rel, "", "\\@not");
  3792. defineSymbol(math, main, rel, "⊂", "\\subset", true);
  3793. defineSymbol(math, main, rel, "⊃", "\\supset", true);
  3794. defineSymbol(math, main, rel, "⊆", "\\subseteq", true);
  3795. defineSymbol(math, main, rel, "⊇", "\\supseteq", true);
  3796. defineSymbol(math, ams, rel, "⊈", "\\nsubseteq", true);
  3797. defineSymbol(math, ams, rel, "⊉", "\\nsupseteq", true);
  3798. defineSymbol(math, main, rel, "⊨", "\\models");
  3799. defineSymbol(math, main, rel, "←", "\\leftarrow", true);
  3800. defineSymbol(math, main, rel, "≤", "\\le");
  3801. defineSymbol(math, main, rel, "≤", "\\leq", true);
  3802. defineSymbol(math, main, rel, "<", "\\lt", true);
  3803. defineSymbol(math, main, rel, "→", "\\rightarrow", true);
  3804. defineSymbol(math, main, rel, "→", "\\to");
  3805. defineSymbol(math, ams, rel, "≱", "\\ngeq", true);
  3806. defineSymbol(math, ams, rel, "≰", "\\nleq", true);
  3807. defineSymbol(math, main, spacing, " ", "\\ ");
  3808. defineSymbol(math, main, spacing, " ", "\\space");
  3809. defineSymbol(math, main, spacing, " ", "\\nobreakspace");
  3810. defineSymbol(text, main, spacing, " ", "\\ ");
  3811. defineSymbol(text, main, spacing, " ", " ");
  3812. defineSymbol(text, main, spacing, " ", "\\space");
  3813. defineSymbol(text, main, spacing, " ", "\\nobreakspace");
  3814. defineSymbol(math, main, spacing, null, "\\nobreak");
  3815. defineSymbol(math, main, spacing, null, "\\allowbreak");
  3816. defineSymbol(math, main, punct, ",", ",");
  3817. defineSymbol(math, main, punct, ";", ";");
  3818. defineSymbol(math, ams, bin, "⊼", "\\barwedge", true);
  3819. defineSymbol(math, ams, bin, "⊻", "\\veebar", true);
  3820. defineSymbol(math, main, bin, "⊙", "\\odot", true);
  3821. defineSymbol(math, main, bin, "⊕", "\\oplus", true);
  3822. defineSymbol(math, main, bin, "⊗", "\\otimes", true);
  3823. defineSymbol(math, main, textord, "∂", "\\partial", true);
  3824. defineSymbol(math, main, bin, "⊘", "\\oslash", true);
  3825. defineSymbol(math, ams, bin, "⊚", "\\circledcirc", true);
  3826. defineSymbol(math, ams, bin, "⊡", "\\boxdot", true);
  3827. defineSymbol(math, main, bin, "△", "\\bigtriangleup");
  3828. defineSymbol(math, main, bin, "▽", "\\bigtriangledown");
  3829. defineSymbol(math, main, bin, "†", "\\dagger");
  3830. defineSymbol(math, main, bin, "⋄", "\\diamond");
  3831. defineSymbol(math, main, bin, "⋆", "\\star");
  3832. defineSymbol(math, main, bin, "◃", "\\triangleleft");
  3833. defineSymbol(math, main, bin, "▹", "\\triangleright");
  3834. defineSymbol(math, main, open, "{", "\\{");
  3835. defineSymbol(text, main, textord, "{", "\\{");
  3836. defineSymbol(text, main, textord, "{", "\\textbraceleft");
  3837. defineSymbol(math, main, close, "}", "\\}");
  3838. defineSymbol(text, main, textord, "}", "\\}");
  3839. defineSymbol(text, main, textord, "}", "\\textbraceright");
  3840. defineSymbol(math, main, open, "{", "\\lbrace");
  3841. defineSymbol(math, main, close, "}", "\\rbrace");
  3842. defineSymbol(math, main, open, "[", "\\lbrack", true);
  3843. defineSymbol(text, main, textord, "[", "\\lbrack", true);
  3844. defineSymbol(math, main, close, "]", "\\rbrack", true);
  3845. defineSymbol(text, main, textord, "]", "\\rbrack", true);
  3846. defineSymbol(math, main, open, "(", "\\lparen", true);
  3847. defineSymbol(math, main, close, ")", "\\rparen", true);
  3848. defineSymbol(text, main, textord, "<", "\\textless", true);
  3849. defineSymbol(text, main, textord, ">", "\\textgreater", true);
  3850. defineSymbol(math, main, open, "⌊", "\\lfloor", true);
  3851. defineSymbol(math, main, close, "⌋", "\\rfloor", true);
  3852. defineSymbol(math, main, open, "⌈", "\\lceil", true);
  3853. defineSymbol(math, main, close, "⌉", "\\rceil", true);
  3854. defineSymbol(math, main, textord, "\\", "\\backslash");
  3855. defineSymbol(math, main, textord, "∣", "|");
  3856. defineSymbol(math, main, textord, "∣", "\\vert");
  3857. defineSymbol(text, main, textord, "|", "\\textbar", true);
  3858. defineSymbol(math, main, textord, "∥", "\\|");
  3859. defineSymbol(math, main, textord, "∥", "\\Vert");
  3860. defineSymbol(text, main, textord, "∥", "\\textbardbl");
  3861. defineSymbol(text, main, textord, "~", "\\textasciitilde");
  3862. defineSymbol(text, main, textord, "\\", "\\textbackslash");
  3863. defineSymbol(text, main, textord, "^", "\\textasciicircum");
  3864. defineSymbol(math, main, rel, "↑", "\\uparrow", true);
  3865. defineSymbol(math, main, rel, "⇑", "\\Uparrow", true);
  3866. defineSymbol(math, main, rel, "↓", "\\downarrow", true);
  3867. defineSymbol(math, main, rel, "⇓", "\\Downarrow", true);
  3868. defineSymbol(math, main, rel, "↕", "\\updownarrow", true);
  3869. defineSymbol(math, main, rel, "⇕", "\\Updownarrow", true);
  3870. defineSymbol(math, main, op, "∐", "\\coprod");
  3871. defineSymbol(math, main, op, "⋁", "\\bigvee");
  3872. defineSymbol(math, main, op, "⋀", "\\bigwedge");
  3873. defineSymbol(math, main, op, "⨄", "\\biguplus");
  3874. defineSymbol(math, main, op, "⋂", "\\bigcap");
  3875. defineSymbol(math, main, op, "⋃", "\\bigcup");
  3876. defineSymbol(math, main, op, "∫", "\\int");
  3877. defineSymbol(math, main, op, "∫", "\\intop");
  3878. defineSymbol(math, main, op, "∬", "\\iint");
  3879. defineSymbol(math, main, op, "∭", "\\iiint");
  3880. defineSymbol(math, main, op, "∏", "\\prod");
  3881. defineSymbol(math, main, op, "∑", "\\sum");
  3882. defineSymbol(math, main, op, "⨂", "\\bigotimes");
  3883. defineSymbol(math, main, op, "⨁", "\\bigoplus");
  3884. defineSymbol(math, main, op, "⨀", "\\bigodot");
  3885. defineSymbol(math, main, op, "∮", "\\oint");
  3886. defineSymbol(math, main, op, "∯", "\\oiint");
  3887. defineSymbol(math, main, op, "∰", "\\oiiint");
  3888. defineSymbol(math, main, op, "⨆", "\\bigsqcup");
  3889. defineSymbol(math, main, op, "∫", "\\smallint");
  3890. defineSymbol(text, main, inner, "…", "\\textellipsis");
  3891. defineSymbol(math, main, inner, "…", "\\mathellipsis");
  3892. defineSymbol(text, main, inner, "…", "\\ldots", true);
  3893. defineSymbol(math, main, inner, "…", "\\ldots", true);
  3894. defineSymbol(math, main, inner, "⋯", "\\@cdots", true);
  3895. defineSymbol(math, main, inner, "⋱", "\\ddots", true);
  3896. defineSymbol(math, main, textord, "⋮", "\\varvdots");
  3897. defineSymbol(text, main, textord, "⋮", "\\varvdots");
  3898. defineSymbol(math, main, accent, "ˊ", "\\acute");
  3899. defineSymbol(math, main, accent, "ˋ", "\\grave");
  3900. defineSymbol(math, main, accent, "¨", "\\ddot");
  3901. defineSymbol(math, main, accent, "~", "\\tilde");
  3902. defineSymbol(math, main, accent, "ˉ", "\\bar");
  3903. defineSymbol(math, main, accent, "˘", "\\breve");
  3904. defineSymbol(math, main, accent, "ˇ", "\\check");
  3905. defineSymbol(math, main, accent, "^", "\\hat");
  3906. defineSymbol(math, main, accent, "⃗", "\\vec");
  3907. defineSymbol(math, main, accent, "˙", "\\dot");
  3908. defineSymbol(math, main, accent, "˚", "\\mathring");
  3909. defineSymbol(math, main, mathord, "", "\\@imath");
  3910. defineSymbol(math, main, mathord, "", "\\@jmath");
  3911. defineSymbol(math, main, textord, "ı", "ı");
  3912. defineSymbol(math, main, textord, "ȷ", "ȷ");
  3913. defineSymbol(text, main, textord, "ı", "\\i", true);
  3914. defineSymbol(text, main, textord, "ȷ", "\\j", true);
  3915. defineSymbol(text, main, textord, "ß", "\\ss", true);
  3916. defineSymbol(text, main, textord, "æ", "\\ae", true);
  3917. defineSymbol(text, main, textord, "œ", "\\oe", true);
  3918. defineSymbol(text, main, textord, "ø", "\\o", true);
  3919. defineSymbol(text, main, textord, "Æ", "\\AE", true);
  3920. defineSymbol(text, main, textord, "Œ", "\\OE", true);
  3921. defineSymbol(text, main, textord, "Ø", "\\O", true);
  3922. defineSymbol(text, main, accent, "ˊ", "\\'");
  3923. defineSymbol(text, main, accent, "ˋ", "\\`");
  3924. defineSymbol(text, main, accent, "ˆ", "\\^");
  3925. defineSymbol(text, main, accent, "˜", "\\~");
  3926. defineSymbol(text, main, accent, "ˉ", "\\=");
  3927. defineSymbol(text, main, accent, "˘", "\\u");
  3928. defineSymbol(text, main, accent, "˙", "\\.");
  3929. defineSymbol(text, main, accent, "¸", "\\c");
  3930. defineSymbol(text, main, accent, "˚", "\\r");
  3931. defineSymbol(text, main, accent, "ˇ", "\\v");
  3932. defineSymbol(text, main, accent, "¨", '\\"');
  3933. defineSymbol(text, main, accent, "˝", "\\H");
  3934. defineSymbol(text, main, accent, "◯", "\\textcircled");
  3935. var ligatures = {
  3936. "--": true,
  3937. "---": true,
  3938. "``": true,
  3939. "''": true
  3940. };
  3941. defineSymbol(text, main, textord, "–", "--", true);
  3942. defineSymbol(text, main, textord, "–", "\\textendash");
  3943. defineSymbol(text, main, textord, "—", "---", true);
  3944. defineSymbol(text, main, textord, "—", "\\textemdash");
  3945. defineSymbol(text, main, textord, "‘", "`", true);
  3946. defineSymbol(text, main, textord, "‘", "\\textquoteleft");
  3947. defineSymbol(text, main, textord, "’", "'", true);
  3948. defineSymbol(text, main, textord, "’", "\\textquoteright");
  3949. defineSymbol(text, main, textord, "“", "``", true);
  3950. defineSymbol(text, main, textord, "“", "\\textquotedblleft");
  3951. defineSymbol(text, main, textord, "”", "''", true);
  3952. defineSymbol(text, main, textord, "”", "\\textquotedblright");
  3953. defineSymbol(math, main, textord, "°", "\\degree", true);
  3954. defineSymbol(text, main, textord, "°", "\\degree");
  3955. defineSymbol(text, main, textord, "°", "\\textdegree", true);
  3956. defineSymbol(math, main, textord, "£", "\\pounds");
  3957. defineSymbol(math, main, textord, "£", "\\mathsterling", true);
  3958. defineSymbol(text, main, textord, "£", "\\pounds");
  3959. defineSymbol(text, main, textord, "£", "\\textsterling", true);
  3960. defineSymbol(math, ams, textord, "✠", "\\maltese");
  3961. defineSymbol(text, ams, textord, "✠", "\\maltese");
  3962. var mathTextSymbols = '0123456789/@."';
  3963. for (i = 0; i < mathTextSymbols.length; i++) {
  3964. ch = mathTextSymbols.charAt(i);
  3965. defineSymbol(math, main, textord, ch, ch);
  3966. }
  3967. var ch;
  3968. var i;
  3969. var textSymbols = '0123456789!@*()-=+";:?/.,';
  3970. for (_i = 0; _i < textSymbols.length; _i++) {
  3971. _ch = textSymbols.charAt(_i);
  3972. defineSymbol(text, main, textord, _ch, _ch);
  3973. }
  3974. var _ch;
  3975. var _i;
  3976. var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
  3977. for (_i2 = 0; _i2 < letters.length; _i2++) {
  3978. _ch2 = letters.charAt(_i2);
  3979. defineSymbol(math, main, mathord, _ch2, _ch2);
  3980. defineSymbol(text, main, textord, _ch2, _ch2);
  3981. }
  3982. var _ch2;
  3983. var _i2;
  3984. defineSymbol(math, ams, textord, "C", "ℂ");
  3985. defineSymbol(text, ams, textord, "C", "ℂ");
  3986. defineSymbol(math, ams, textord, "H", "ℍ");
  3987. defineSymbol(text, ams, textord, "H", "ℍ");
  3988. defineSymbol(math, ams, textord, "N", "ℕ");
  3989. defineSymbol(text, ams, textord, "N", "ℕ");
  3990. defineSymbol(math, ams, textord, "P", "ℙ");
  3991. defineSymbol(text, ams, textord, "P", "ℙ");
  3992. defineSymbol(math, ams, textord, "Q", "ℚ");
  3993. defineSymbol(text, ams, textord, "Q", "ℚ");
  3994. defineSymbol(math, ams, textord, "R", "ℝ");
  3995. defineSymbol(text, ams, textord, "R", "ℝ");
  3996. defineSymbol(math, ams, textord, "Z", "ℤ");
  3997. defineSymbol(text, ams, textord, "Z", "ℤ");
  3998. defineSymbol(math, main, mathord, "h", "ℎ");
  3999. defineSymbol(text, main, mathord, "h", "ℎ");
  4000. var wideChar = "";
  4001. for (_i3 = 0; _i3 < letters.length; _i3++) {
  4002. _ch3 = letters.charAt(_i3);
  4003. wideChar = String.fromCharCode(55349, 56320 + _i3);
  4004. defineSymbol(math, main, mathord, _ch3, wideChar);
  4005. defineSymbol(text, main, textord, _ch3, wideChar);
  4006. wideChar = String.fromCharCode(55349, 56372 + _i3);
  4007. defineSymbol(math, main, mathord, _ch3, wideChar);
  4008. defineSymbol(text, main, textord, _ch3, wideChar);
  4009. wideChar = String.fromCharCode(55349, 56424 + _i3);
  4010. defineSymbol(math, main, mathord, _ch3, wideChar);
  4011. defineSymbol(text, main, textord, _ch3, wideChar);
  4012. wideChar = String.fromCharCode(55349, 56580 + _i3);
  4013. defineSymbol(math, main, mathord, _ch3, wideChar);
  4014. defineSymbol(text, main, textord, _ch3, wideChar);
  4015. wideChar = String.fromCharCode(55349, 56684 + _i3);
  4016. defineSymbol(math, main, mathord, _ch3, wideChar);
  4017. defineSymbol(text, main, textord, _ch3, wideChar);
  4018. wideChar = String.fromCharCode(55349, 56736 + _i3);
  4019. defineSymbol(math, main, mathord, _ch3, wideChar);
  4020. defineSymbol(text, main, textord, _ch3, wideChar);
  4021. wideChar = String.fromCharCode(55349, 56788 + _i3);
  4022. defineSymbol(math, main, mathord, _ch3, wideChar);
  4023. defineSymbol(text, main, textord, _ch3, wideChar);
  4024. wideChar = String.fromCharCode(55349, 56840 + _i3);
  4025. defineSymbol(math, main, mathord, _ch3, wideChar);
  4026. defineSymbol(text, main, textord, _ch3, wideChar);
  4027. wideChar = String.fromCharCode(55349, 56944 + _i3);
  4028. defineSymbol(math, main, mathord, _ch3, wideChar);
  4029. defineSymbol(text, main, textord, _ch3, wideChar);
  4030. if (_i3 < 26) {
  4031. wideChar = String.fromCharCode(55349, 56632 + _i3);
  4032. defineSymbol(math, main, mathord, _ch3, wideChar);
  4033. defineSymbol(text, main, textord, _ch3, wideChar);
  4034. wideChar = String.fromCharCode(55349, 56476 + _i3);
  4035. defineSymbol(math, main, mathord, _ch3, wideChar);
  4036. defineSymbol(text, main, textord, _ch3, wideChar);
  4037. }
  4038. }
  4039. var _ch3;
  4040. var _i3;
  4041. wideChar = String.fromCharCode(55349, 56668);
  4042. defineSymbol(math, main, mathord, "k", wideChar);
  4043. defineSymbol(text, main, textord, "k", wideChar);
  4044. for (_i4 = 0; _i4 < 10; _i4++) {
  4045. _ch4 = _i4.toString();
  4046. wideChar = String.fromCharCode(55349, 57294 + _i4);
  4047. defineSymbol(math, main, mathord, _ch4, wideChar);
  4048. defineSymbol(text, main, textord, _ch4, wideChar);
  4049. wideChar = String.fromCharCode(55349, 57314 + _i4);
  4050. defineSymbol(math, main, mathord, _ch4, wideChar);
  4051. defineSymbol(text, main, textord, _ch4, wideChar);
  4052. wideChar = String.fromCharCode(55349, 57324 + _i4);
  4053. defineSymbol(math, main, mathord, _ch4, wideChar);
  4054. defineSymbol(text, main, textord, _ch4, wideChar);
  4055. wideChar = String.fromCharCode(55349, 57334 + _i4);
  4056. defineSymbol(math, main, mathord, _ch4, wideChar);
  4057. defineSymbol(text, main, textord, _ch4, wideChar);
  4058. }
  4059. var _ch4;
  4060. var _i4;
  4061. var extraLatin = "ÐÞþ";
  4062. for (_i5 = 0; _i5 < extraLatin.length; _i5++) {
  4063. _ch5 = extraLatin.charAt(_i5);
  4064. defineSymbol(math, main, mathord, _ch5, _ch5);
  4065. defineSymbol(text, main, textord, _ch5, _ch5);
  4066. }
  4067. var _ch5;
  4068. var _i5;
  4069. var wideLatinLetterData = [
  4070. ["mathbf", "textbf", "Main-Bold"],
  4071. // A-Z bold upright
  4072. ["mathbf", "textbf", "Main-Bold"],
  4073. // a-z bold upright
  4074. ["mathnormal", "textit", "Math-Italic"],
  4075. // A-Z italic
  4076. ["mathnormal", "textit", "Math-Italic"],
  4077. // a-z italic
  4078. ["boldsymbol", "boldsymbol", "Main-BoldItalic"],
  4079. // A-Z bold italic
  4080. ["boldsymbol", "boldsymbol", "Main-BoldItalic"],
  4081. // a-z bold italic
  4082. // Map fancy A-Z letters to script, not calligraphic.
  4083. // This aligns with unicode-math and math fonts (except Cambria Math).
  4084. ["mathscr", "textscr", "Script-Regular"],
  4085. // A-Z script
  4086. ["", "", ""],
  4087. // a-z script. No font
  4088. ["", "", ""],
  4089. // A-Z bold script. No font
  4090. ["", "", ""],
  4091. // a-z bold script. No font
  4092. ["mathfrak", "textfrak", "Fraktur-Regular"],
  4093. // A-Z Fraktur
  4094. ["mathfrak", "textfrak", "Fraktur-Regular"],
  4095. // a-z Fraktur
  4096. ["mathbb", "textbb", "AMS-Regular"],
  4097. // A-Z double-struck
  4098. ["mathbb", "textbb", "AMS-Regular"],
  4099. // k double-struck
  4100. // Note that we are using a bold font, but font metrics for regular Fraktur.
  4101. ["mathboldfrak", "textboldfrak", "Fraktur-Regular"],
  4102. // A-Z bold Fraktur
  4103. ["mathboldfrak", "textboldfrak", "Fraktur-Regular"],
  4104. // a-z bold Fraktur
  4105. ["mathsf", "textsf", "SansSerif-Regular"],
  4106. // A-Z sans-serif
  4107. ["mathsf", "textsf", "SansSerif-Regular"],
  4108. // a-z sans-serif
  4109. ["mathboldsf", "textboldsf", "SansSerif-Bold"],
  4110. // A-Z bold sans-serif
  4111. ["mathboldsf", "textboldsf", "SansSerif-Bold"],
  4112. // a-z bold sans-serif
  4113. ["mathitsf", "textitsf", "SansSerif-Italic"],
  4114. // A-Z italic sans-serif
  4115. ["mathitsf", "textitsf", "SansSerif-Italic"],
  4116. // a-z italic sans-serif
  4117. ["", "", ""],
  4118. // A-Z bold italic sans. No font
  4119. ["", "", ""],
  4120. // a-z bold italic sans. No font
  4121. ["mathtt", "texttt", "Typewriter-Regular"],
  4122. // A-Z monospace
  4123. ["mathtt", "texttt", "Typewriter-Regular"]
  4124. // a-z monospace
  4125. ];
  4126. var wideNumeralData = [
  4127. ["mathbf", "textbf", "Main-Bold"],
  4128. // 0-9 bold
  4129. ["", "", ""],
  4130. // 0-9 double-struck. No KaTeX font.
  4131. ["mathsf", "textsf", "SansSerif-Regular"],
  4132. // 0-9 sans-serif
  4133. ["mathboldsf", "textboldsf", "SansSerif-Bold"],
  4134. // 0-9 bold sans-serif
  4135. ["mathtt", "texttt", "Typewriter-Regular"]
  4136. // 0-9 monospace
  4137. ];
  4138. var wideCharacterFont = (wideChar2, mode) => {
  4139. var H = wideChar2.charCodeAt(0);
  4140. var L = wideChar2.charCodeAt(1);
  4141. var codePoint = (H - 55296) * 1024 + (L - 56320) + 65536;
  4142. var j = mode === "math" ? 0 : 1;
  4143. if (119808 <= codePoint && codePoint < 120484) {
  4144. var i = Math.floor((codePoint - 119808) / 26);
  4145. return [wideLatinLetterData[i][2], wideLatinLetterData[i][j]];
  4146. } else if (120782 <= codePoint && codePoint <= 120831) {
  4147. var _i = Math.floor((codePoint - 120782) / 10);
  4148. return [wideNumeralData[_i][2], wideNumeralData[_i][j]];
  4149. } else if (codePoint === 120485 || codePoint === 120486) {
  4150. return [wideLatinLetterData[0][2], wideLatinLetterData[0][j]];
  4151. } else if (120486 < codePoint && codePoint < 120782) {
  4152. return ["", ""];
  4153. } else {
  4154. throw new ParseError("Unsupported character: " + wideChar2);
  4155. }
  4156. };
  4157. var lookupSymbol = function lookupSymbol2(value, fontName, mode) {
  4158. if (symbols[mode][value]) {
  4159. var replacement = symbols[mode][value].replace;
  4160. if (replacement) {
  4161. value = replacement;
  4162. }
  4163. }
  4164. return {
  4165. value,
  4166. metrics: getCharacterMetrics(value, fontName, mode)
  4167. };
  4168. };
  4169. var makeSymbol = function makeSymbol2(value, fontName, mode, options, classes) {
  4170. var lookup = lookupSymbol(value, fontName, mode);
  4171. var metrics = lookup.metrics;
  4172. value = lookup.value;
  4173. var symbolNode;
  4174. if (metrics) {
  4175. var italic = metrics.italic;
  4176. if (mode === "text" || options && options.font === "mathit") {
  4177. italic = 0;
  4178. }
  4179. symbolNode = new SymbolNode(value, metrics.height, metrics.depth, italic, metrics.skew, metrics.width, classes);
  4180. } else {
  4181. typeof console !== "undefined" && console.warn("No character metrics " + ("for '" + value + "' in style '" + fontName + "' and mode '" + mode + "'"));
  4182. symbolNode = new SymbolNode(value, 0, 0, 0, 0, 0, classes);
  4183. }
  4184. if (options) {
  4185. symbolNode.maxFontSize = options.sizeMultiplier;
  4186. if (options.style.isTight()) {
  4187. symbolNode.classes.push("mtight");
  4188. }
  4189. var color = options.getColor();
  4190. if (color) {
  4191. symbolNode.style.color = color;
  4192. }
  4193. }
  4194. return symbolNode;
  4195. };
  4196. var mathsym = function mathsym2(value, mode, options, classes) {
  4197. if (classes === void 0) {
  4198. classes = [];
  4199. }
  4200. if (options.font === "boldsymbol" && lookupSymbol(value, "Main-Bold", mode).metrics) {
  4201. return makeSymbol(value, "Main-Bold", mode, options, classes.concat(["mathbf"]));
  4202. } else if (value === "\\" || symbols[mode][value].font === "main") {
  4203. return makeSymbol(value, "Main-Regular", mode, options, classes);
  4204. } else {
  4205. return makeSymbol(value, "AMS-Regular", mode, options, classes.concat(["amsrm"]));
  4206. }
  4207. };
  4208. var boldsymbol = function boldsymbol2(value, mode, options, classes, type) {
  4209. if (type !== "textord" && lookupSymbol(value, "Math-BoldItalic", mode).metrics) {
  4210. return {
  4211. fontName: "Math-BoldItalic",
  4212. fontClass: "boldsymbol"
  4213. };
  4214. } else {
  4215. return {
  4216. fontName: "Main-Bold",
  4217. fontClass: "mathbf"
  4218. };
  4219. }
  4220. };
  4221. var makeOrd = function makeOrd2(group, options, type) {
  4222. var mode = group.mode;
  4223. var text2 = group.text;
  4224. var classes = ["mord"];
  4225. var isFont = mode === "math" || mode === "text" && options.font;
  4226. var fontOrFamily = isFont ? options.font : options.fontFamily;
  4227. var wideFontName = "";
  4228. var wideFontClass = "";
  4229. if (text2.charCodeAt(0) === 55349) {
  4230. [wideFontName, wideFontClass] = wideCharacterFont(text2, mode);
  4231. }
  4232. if (wideFontName.length > 0) {
  4233. return makeSymbol(text2, wideFontName, mode, options, classes.concat(wideFontClass));
  4234. } else if (fontOrFamily) {
  4235. var fontName;
  4236. var fontClasses;
  4237. if (fontOrFamily === "boldsymbol") {
  4238. var fontData = boldsymbol(text2, mode, options, classes, type);
  4239. fontName = fontData.fontName;
  4240. fontClasses = [fontData.fontClass];
  4241. } else if (isFont) {
  4242. fontName = fontMap[fontOrFamily].fontName;
  4243. fontClasses = [fontOrFamily];
  4244. } else {
  4245. fontName = retrieveTextFontName(fontOrFamily, options.fontWeight, options.fontShape);
  4246. fontClasses = [fontOrFamily, options.fontWeight, options.fontShape];
  4247. }
  4248. if (lookupSymbol(text2, fontName, mode).metrics) {
  4249. return makeSymbol(text2, fontName, mode, options, classes.concat(fontClasses));
  4250. } else if (ligatures.hasOwnProperty(text2) && fontName.slice(0, 10) === "Typewriter") {
  4251. var parts = [];
  4252. for (var i = 0; i < text2.length; i++) {
  4253. parts.push(makeSymbol(text2[i], fontName, mode, options, classes.concat(fontClasses)));
  4254. }
  4255. return makeFragment(parts);
  4256. }
  4257. }
  4258. if (type === "mathord") {
  4259. return makeSymbol(text2, "Math-Italic", mode, options, classes.concat(["mathnormal"]));
  4260. } else if (type === "textord") {
  4261. var font = symbols[mode][text2] && symbols[mode][text2].font;
  4262. if (font === "ams") {
  4263. var _fontName = retrieveTextFontName("amsrm", options.fontWeight, options.fontShape);
  4264. return makeSymbol(text2, _fontName, mode, options, classes.concat("amsrm", options.fontWeight, options.fontShape));
  4265. } else if (font === "main" || !font) {
  4266. var _fontName2 = retrieveTextFontName("textrm", options.fontWeight, options.fontShape);
  4267. return makeSymbol(text2, _fontName2, mode, options, classes.concat(options.fontWeight, options.fontShape));
  4268. } else {
  4269. var _fontName3 = retrieveTextFontName(font, options.fontWeight, options.fontShape);
  4270. return makeSymbol(text2, _fontName3, mode, options, classes.concat(_fontName3, options.fontWeight, options.fontShape));
  4271. }
  4272. } else {
  4273. throw new Error("unexpected type: " + type + " in makeOrd");
  4274. }
  4275. };
  4276. var canCombine = (prev, next) => {
  4277. if (createClass(prev.classes) !== createClass(next.classes) || prev.skew !== next.skew || prev.maxFontSize !== next.maxFontSize || prev.italic !== 0 && prev.hasClass("mathnormal")) {
  4278. return false;
  4279. }
  4280. if (prev.classes.length === 1) {
  4281. var cls = prev.classes[0];
  4282. if (cls === "mbin" || cls === "mord") {
  4283. return false;
  4284. }
  4285. }
  4286. for (var key of Object.keys(prev.style)) {
  4287. if (prev.style[key] !== next.style[key]) {
  4288. return false;
  4289. }
  4290. }
  4291. for (var _key of Object.keys(next.style)) {
  4292. if (prev.style[_key] !== next.style[_key]) {
  4293. return false;
  4294. }
  4295. }
  4296. return true;
  4297. };
  4298. var tryCombineChars = (chars) => {
  4299. for (var i = 0; i < chars.length - 1; i++) {
  4300. var prev = chars[i];
  4301. var next = chars[i + 1];
  4302. if (prev instanceof SymbolNode && next instanceof SymbolNode && canCombine(prev, next)) {
  4303. prev.text += next.text;
  4304. prev.height = Math.max(prev.height, next.height);
  4305. prev.depth = Math.max(prev.depth, next.depth);
  4306. prev.italic = next.italic;
  4307. chars.splice(i + 1, 1);
  4308. i--;
  4309. }
  4310. }
  4311. return chars;
  4312. };
  4313. var sizeElementFromChildren = function sizeElementFromChildren2(elem) {
  4314. var height = 0;
  4315. var depth = 0;
  4316. var maxFontSize = 0;
  4317. for (var i = 0; i < elem.children.length; i++) {
  4318. var child = elem.children[i];
  4319. if (child.height > height) {
  4320. height = child.height;
  4321. }
  4322. if (child.depth > depth) {
  4323. depth = child.depth;
  4324. }
  4325. if (child.maxFontSize > maxFontSize) {
  4326. maxFontSize = child.maxFontSize;
  4327. }
  4328. }
  4329. elem.height = height;
  4330. elem.depth = depth;
  4331. elem.maxFontSize = maxFontSize;
  4332. };
  4333. var makeSpan = function makeSpan2(classes, children, options, style) {
  4334. var span = new Span(classes, children, options, style);
  4335. sizeElementFromChildren(span);
  4336. return span;
  4337. };
  4338. var makeSvgSpan = (classes, children, options, style) => new Span(classes, children, options, style);
  4339. var makeLineSpan = function makeLineSpan2(className, options, thickness) {
  4340. var line = makeSpan([className], [], options);
  4341. line.height = Math.max(thickness || options.fontMetrics().defaultRuleThickness, options.minRuleThickness);
  4342. line.style.borderBottomWidth = makeEm(line.height);
  4343. line.maxFontSize = 1;
  4344. return line;
  4345. };
  4346. var makeAnchor = function makeAnchor2(href, classes, children, options) {
  4347. var anchor = new Anchor(href, classes, children, options);
  4348. sizeElementFromChildren(anchor);
  4349. return anchor;
  4350. };
  4351. var makeFragment = function makeFragment2(children) {
  4352. var fragment = new DocumentFragment(children);
  4353. sizeElementFromChildren(fragment);
  4354. return fragment;
  4355. };
  4356. var wrapFragment = function wrapFragment2(group, options) {
  4357. if (group instanceof DocumentFragment) {
  4358. return makeSpan([], [group], options);
  4359. }
  4360. return group;
  4361. };
  4362. var getVListChildrenAndDepth = function getVListChildrenAndDepth2(params) {
  4363. if (params.positionType === "individualShift") {
  4364. var oldChildren = params.children;
  4365. var children = [oldChildren[0]];
  4366. var _depth = -oldChildren[0].shift - oldChildren[0].elem.depth;
  4367. var currPos = _depth;
  4368. for (var i = 1; i < oldChildren.length; i++) {
  4369. var diff = -oldChildren[i].shift - currPos - oldChildren[i].elem.depth;
  4370. var size = diff - (oldChildren[i - 1].elem.height + oldChildren[i - 1].elem.depth);
  4371. currPos = currPos + diff;
  4372. children.push({
  4373. type: "kern",
  4374. size
  4375. });
  4376. children.push(oldChildren[i]);
  4377. }
  4378. return {
  4379. children,
  4380. depth: _depth
  4381. };
  4382. }
  4383. var depth;
  4384. if (params.positionType === "top") {
  4385. var bottom = params.positionData;
  4386. for (var _i = 0; _i < params.children.length; _i++) {
  4387. var child = params.children[_i];
  4388. bottom -= child.type === "kern" ? child.size : child.elem.height + child.elem.depth;
  4389. }
  4390. depth = bottom;
  4391. } else if (params.positionType === "bottom") {
  4392. depth = -params.positionData;
  4393. } else {
  4394. var firstChild = params.children[0];
  4395. if (firstChild.type !== "elem") {
  4396. throw new Error('First child must have type "elem".');
  4397. }
  4398. if (params.positionType === "shift") {
  4399. depth = -firstChild.elem.depth - params.positionData;
  4400. } else if (params.positionType === "firstBaseline") {
  4401. depth = -firstChild.elem.depth;
  4402. } else {
  4403. throw new Error("Invalid positionType " + params.positionType + ".");
  4404. }
  4405. }
  4406. return {
  4407. children: params.children,
  4408. depth
  4409. };
  4410. };
  4411. var makeVList = function makeVList2(params, options) {
  4412. var {
  4413. children,
  4414. depth
  4415. } = getVListChildrenAndDepth(params);
  4416. var pstrutSize = 0;
  4417. for (var i = 0; i < children.length; i++) {
  4418. var child = children[i];
  4419. if (child.type === "elem") {
  4420. var elem = child.elem;
  4421. pstrutSize = Math.max(pstrutSize, elem.maxFontSize, elem.height);
  4422. }
  4423. }
  4424. pstrutSize += 2;
  4425. var pstrut = makeSpan(["pstrut"], []);
  4426. pstrut.style.height = makeEm(pstrutSize);
  4427. var realChildren = [];
  4428. var minPos = depth;
  4429. var maxPos = depth;
  4430. var currPos = depth;
  4431. for (var _i2 = 0; _i2 < children.length; _i2++) {
  4432. var _child = children[_i2];
  4433. if (_child.type === "kern") {
  4434. currPos += _child.size;
  4435. } else {
  4436. var _elem = _child.elem;
  4437. var classes = _child.wrapperClasses || [];
  4438. var style = _child.wrapperStyle || {};
  4439. var childWrap = makeSpan(classes, [pstrut, _elem], void 0, style);
  4440. childWrap.style.top = makeEm(-pstrutSize - currPos - _elem.depth);
  4441. if (_child.marginLeft) {
  4442. childWrap.style.marginLeft = _child.marginLeft;
  4443. }
  4444. if (_child.marginRight) {
  4445. childWrap.style.marginRight = _child.marginRight;
  4446. }
  4447. realChildren.push(childWrap);
  4448. currPos += _elem.height + _elem.depth;
  4449. }
  4450. minPos = Math.min(minPos, currPos);
  4451. maxPos = Math.max(maxPos, currPos);
  4452. }
  4453. var vlist = makeSpan(["vlist"], realChildren);
  4454. vlist.style.height = makeEm(maxPos);
  4455. var rows;
  4456. if (minPos < 0) {
  4457. var emptySpan = makeSpan([], []);
  4458. var depthStrut = makeSpan(["vlist"], [emptySpan]);
  4459. depthStrut.style.height = makeEm(-minPos);
  4460. var topStrut = makeSpan(["vlist-s"], [new SymbolNode("​")]);
  4461. rows = [makeSpan(["vlist-r"], [vlist, topStrut]), makeSpan(["vlist-r"], [depthStrut])];
  4462. } else {
  4463. rows = [makeSpan(["vlist-r"], [vlist])];
  4464. }
  4465. var vtable = makeSpan(["vlist-t"], rows);
  4466. if (rows.length === 2) {
  4467. vtable.classes.push("vlist-t2");
  4468. }
  4469. vtable.height = maxPos;
  4470. vtable.depth = -minPos;
  4471. return vtable;
  4472. };
  4473. var makeGlue = (measurement, options) => {
  4474. var rule = makeSpan(["mspace"], [], options);
  4475. var size = calculateSize(measurement, options);
  4476. rule.style.marginRight = makeEm(size);
  4477. return rule;
  4478. };
  4479. var retrieveTextFontName = function retrieveTextFontName2(fontFamily, fontWeight, fontShape) {
  4480. var baseFontName = "";
  4481. switch (fontFamily) {
  4482. case "amsrm":
  4483. baseFontName = "AMS";
  4484. break;
  4485. case "textrm":
  4486. baseFontName = "Main";
  4487. break;
  4488. case "textsf":
  4489. baseFontName = "SansSerif";
  4490. break;
  4491. case "texttt":
  4492. baseFontName = "Typewriter";
  4493. break;
  4494. default:
  4495. baseFontName = fontFamily;
  4496. }
  4497. var fontStylesName;
  4498. if (fontWeight === "textbf" && fontShape === "textit") {
  4499. fontStylesName = "BoldItalic";
  4500. } else if (fontWeight === "textbf") {
  4501. fontStylesName = "Bold";
  4502. } else if (fontWeight === "textit") {
  4503. fontStylesName = "Italic";
  4504. } else {
  4505. fontStylesName = "Regular";
  4506. }
  4507. return baseFontName + "-" + fontStylesName;
  4508. };
  4509. var fontMap = {
  4510. // styles
  4511. "mathbf": {
  4512. variant: "bold",
  4513. fontName: "Main-Bold"
  4514. },
  4515. "mathrm": {
  4516. variant: "normal",
  4517. fontName: "Main-Regular"
  4518. },
  4519. "textit": {
  4520. variant: "italic",
  4521. fontName: "Main-Italic"
  4522. },
  4523. "mathit": {
  4524. variant: "italic",
  4525. fontName: "Main-Italic"
  4526. },
  4527. "mathnormal": {
  4528. variant: "italic",
  4529. fontName: "Math-Italic"
  4530. },
  4531. "mathsfit": {
  4532. variant: "sans-serif-italic",
  4533. fontName: "SansSerif-Italic"
  4534. },
  4535. // "boldsymbol" is missing because they require the use of multiple fonts:
  4536. // Math-BoldItalic and Main-Bold. This is handled by a special case in
  4537. // makeOrd which ends up calling boldsymbol.
  4538. // families
  4539. "mathbb": {
  4540. variant: "double-struck",
  4541. fontName: "AMS-Regular"
  4542. },
  4543. "mathcal": {
  4544. variant: "script",
  4545. fontName: "Caligraphic-Regular"
  4546. },
  4547. "mathfrak": {
  4548. variant: "fraktur",
  4549. fontName: "Fraktur-Regular"
  4550. },
  4551. "mathscr": {
  4552. variant: "script",
  4553. fontName: "Script-Regular"
  4554. },
  4555. "mathsf": {
  4556. variant: "sans-serif",
  4557. fontName: "SansSerif-Regular"
  4558. },
  4559. "mathtt": {
  4560. variant: "monospace",
  4561. fontName: "Typewriter-Regular"
  4562. }
  4563. };
  4564. var svgData = {
  4565. // path, width, height
  4566. vec: ["vec", 0.471, 0.714],
  4567. // values from the font glyph
  4568. oiintSize1: ["oiintSize1", 0.957, 0.499],
  4569. // oval to overlay the integrand
  4570. oiintSize2: ["oiintSize2", 1.472, 0.659],
  4571. oiiintSize1: ["oiiintSize1", 1.304, 0.499],
  4572. oiiintSize2: ["oiiintSize2", 1.98, 0.659]
  4573. };
  4574. var staticSvg = function staticSvg2(value, options) {
  4575. var [pathName, width, height] = svgData[value];
  4576. var path2 = new PathNode(pathName);
  4577. var svgNode = new SvgNode([path2], {
  4578. "width": makeEm(width),
  4579. "height": makeEm(height),
  4580. // Override CSS rule `.katex svg { width: 100% }`
  4581. "style": "width:" + makeEm(width),
  4582. "viewBox": "0 0 " + 1e3 * width + " " + 1e3 * height,
  4583. "preserveAspectRatio": "xMinYMin"
  4584. });
  4585. var span = makeSvgSpan(["overlay"], [svgNode], options);
  4586. span.height = height;
  4587. span.style.height = makeEm(height);
  4588. span.style.width = makeEm(width);
  4589. return span;
  4590. };
  4591. var thinspace = {
  4592. number: 3,
  4593. unit: "mu"
  4594. };
  4595. var mediumspace = {
  4596. number: 4,
  4597. unit: "mu"
  4598. };
  4599. var thickspace = {
  4600. number: 5,
  4601. unit: "mu"
  4602. };
  4603. var spacings = {
  4604. mord: {
  4605. mop: thinspace,
  4606. mbin: mediumspace,
  4607. mrel: thickspace,
  4608. minner: thinspace
  4609. },
  4610. mop: {
  4611. mord: thinspace,
  4612. mop: thinspace,
  4613. mrel: thickspace,
  4614. minner: thinspace
  4615. },
  4616. mbin: {
  4617. mord: mediumspace,
  4618. mop: mediumspace,
  4619. mopen: mediumspace,
  4620. minner: mediumspace
  4621. },
  4622. mrel: {
  4623. mord: thickspace,
  4624. mop: thickspace,
  4625. mopen: thickspace,
  4626. minner: thickspace
  4627. },
  4628. mopen: {},
  4629. mclose: {
  4630. mop: thinspace,
  4631. mbin: mediumspace,
  4632. mrel: thickspace,
  4633. minner: thinspace
  4634. },
  4635. mpunct: {
  4636. mord: thinspace,
  4637. mop: thinspace,
  4638. mrel: thickspace,
  4639. mopen: thinspace,
  4640. mclose: thinspace,
  4641. mpunct: thinspace,
  4642. minner: thinspace
  4643. },
  4644. minner: {
  4645. mord: thinspace,
  4646. mop: thinspace,
  4647. mbin: mediumspace,
  4648. mrel: thickspace,
  4649. mopen: thinspace,
  4650. mpunct: thinspace,
  4651. minner: thinspace
  4652. }
  4653. };
  4654. var tightSpacings = {
  4655. mord: {
  4656. mop: thinspace
  4657. },
  4658. mop: {
  4659. mord: thinspace,
  4660. mop: thinspace
  4661. },
  4662. mbin: {},
  4663. mrel: {},
  4664. mopen: {},
  4665. mclose: {
  4666. mop: thinspace
  4667. },
  4668. mpunct: {},
  4669. minner: {
  4670. mop: thinspace
  4671. }
  4672. };
  4673. var _functions = {};
  4674. var _htmlGroupBuilders = {};
  4675. var _mathmlGroupBuilders = {};
  4676. function defineFunction(_ref) {
  4677. var {
  4678. type,
  4679. names,
  4680. props,
  4681. handler,
  4682. htmlBuilder: htmlBuilder3,
  4683. mathmlBuilder: mathmlBuilder3
  4684. } = _ref;
  4685. var data = {
  4686. type,
  4687. numArgs: props.numArgs,
  4688. argTypes: props.argTypes,
  4689. allowedInArgument: !!props.allowedInArgument,
  4690. allowedInText: !!props.allowedInText,
  4691. allowedInMath: props.allowedInMath === void 0 ? true : props.allowedInMath,
  4692. numOptionalArgs: props.numOptionalArgs || 0,
  4693. infix: !!props.infix,
  4694. primitive: !!props.primitive,
  4695. handler
  4696. };
  4697. for (var i = 0; i < names.length; ++i) {
  4698. _functions[names[i]] = data;
  4699. }
  4700. if (type) {
  4701. if (htmlBuilder3) {
  4702. _htmlGroupBuilders[type] = htmlBuilder3;
  4703. }
  4704. if (mathmlBuilder3) {
  4705. _mathmlGroupBuilders[type] = mathmlBuilder3;
  4706. }
  4707. }
  4708. }
  4709. function defineFunctionBuilders(_ref2) {
  4710. var {
  4711. type,
  4712. htmlBuilder: htmlBuilder3,
  4713. mathmlBuilder: mathmlBuilder3
  4714. } = _ref2;
  4715. defineFunction({
  4716. type,
  4717. names: [],
  4718. props: {
  4719. numArgs: 0
  4720. },
  4721. handler() {
  4722. throw new Error("Should never be called.");
  4723. },
  4724. htmlBuilder: htmlBuilder3,
  4725. mathmlBuilder: mathmlBuilder3
  4726. });
  4727. }
  4728. var normalizeArgument = function normalizeArgument2(arg) {
  4729. return arg.type === "ordgroup" && arg.body.length === 1 ? arg.body[0] : arg;
  4730. };
  4731. var ordargument = function ordargument2(arg) {
  4732. return arg.type === "ordgroup" ? arg.body : [arg];
  4733. };
  4734. var binLeftCanceller = /* @__PURE__ */ new Set(["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"]);
  4735. var binRightCanceller = /* @__PURE__ */ new Set(["rightmost", "mrel", "mclose", "mpunct"]);
  4736. var styleMap$1 = {
  4737. "display": Style$1.DISPLAY,
  4738. "text": Style$1.TEXT,
  4739. "script": Style$1.SCRIPT,
  4740. "scriptscript": Style$1.SCRIPTSCRIPT
  4741. };
  4742. var DomEnum = {
  4743. mord: "mord",
  4744. mop: "mop",
  4745. mbin: "mbin",
  4746. mrel: "mrel",
  4747. mopen: "mopen",
  4748. mclose: "mclose",
  4749. mpunct: "mpunct",
  4750. minner: "minner"
  4751. };
  4752. var buildExpression$1 = function buildExpression(expression, options, isRealGroup, surrounding) {
  4753. if (surrounding === void 0) {
  4754. surrounding = [null, null];
  4755. }
  4756. var groups = [];
  4757. for (var i = 0; i < expression.length; i++) {
  4758. var output = buildGroup$1(expression[i], options);
  4759. if (output instanceof DocumentFragment) {
  4760. var children = output.children;
  4761. groups.push(...children);
  4762. } else {
  4763. groups.push(output);
  4764. }
  4765. }
  4766. tryCombineChars(groups);
  4767. if (!isRealGroup) {
  4768. return groups;
  4769. }
  4770. var glueOptions = options;
  4771. if (expression.length === 1) {
  4772. var node = expression[0];
  4773. if (node.type === "sizing") {
  4774. glueOptions = options.havingSize(node.size);
  4775. } else if (node.type === "styling") {
  4776. glueOptions = options.havingStyle(styleMap$1[node.style]);
  4777. }
  4778. }
  4779. var dummyPrev = makeSpan([surrounding[0] || "leftmost"], [], options);
  4780. var dummyNext = makeSpan([surrounding[1] || "rightmost"], [], options);
  4781. var isRoot = isRealGroup === "root";
  4782. _traverseNonSpaceNodes(groups, (node2, prev) => {
  4783. var prevType = prev.classes[0];
  4784. var type = node2.classes[0];
  4785. if (prevType === "mbin" && binRightCanceller.has(type)) {
  4786. prev.classes[0] = "mord";
  4787. } else if (type === "mbin" && binLeftCanceller.has(prevType)) {
  4788. node2.classes[0] = "mord";
  4789. }
  4790. }, {
  4791. node: dummyPrev
  4792. }, dummyNext, isRoot);
  4793. _traverseNonSpaceNodes(groups, (node2, prev) => {
  4794. var _tightSpacings$prevTy, _spacings$prevType;
  4795. var prevType = getTypeOfDomTree(prev);
  4796. var type = getTypeOfDomTree(node2);
  4797. var space = prevType && type ? node2.hasClass("mtight") ? (_tightSpacings$prevTy = tightSpacings[prevType]) == null ? void 0 : _tightSpacings$prevTy[type] : (_spacings$prevType = spacings[prevType]) == null ? void 0 : _spacings$prevType[type] : null;
  4798. if (space) {
  4799. return makeGlue(space, glueOptions);
  4800. }
  4801. }, {
  4802. node: dummyPrev
  4803. }, dummyNext, isRoot);
  4804. return groups;
  4805. };
  4806. var _traverseNonSpaceNodes = function traverseNonSpaceNodes(nodes, callback, prev, next, isRoot) {
  4807. if (next) {
  4808. nodes.push(next);
  4809. }
  4810. var i = 0;
  4811. for (; i < nodes.length; i++) {
  4812. var node = nodes[i];
  4813. var partialGroup = checkPartialGroup(node);
  4814. if (partialGroup) {
  4815. _traverseNonSpaceNodes(partialGroup.children, callback, prev, null, isRoot);
  4816. continue;
  4817. }
  4818. var nonspace = !node.hasClass("mspace");
  4819. if (nonspace) {
  4820. var result = callback(node, prev.node);
  4821. if (result) {
  4822. if (prev.insertAfter) {
  4823. prev.insertAfter(result);
  4824. } else {
  4825. nodes.unshift(result);
  4826. i++;
  4827. }
  4828. }
  4829. }
  4830. if (nonspace) {
  4831. prev.node = node;
  4832. } else if (isRoot && node.hasClass("newline")) {
  4833. prev.node = makeSpan(["leftmost"]);
  4834. }
  4835. prev.insertAfter = /* @__PURE__ */ ((index) => (n) => {
  4836. nodes.splice(index + 1, 0, n);
  4837. i++;
  4838. })(i);
  4839. }
  4840. if (next) {
  4841. nodes.pop();
  4842. }
  4843. };
  4844. var checkPartialGroup = function checkPartialGroup2(node) {
  4845. if (node instanceof DocumentFragment || node instanceof Anchor || node instanceof Span && node.hasClass("enclosing")) {
  4846. return node;
  4847. }
  4848. return null;
  4849. };
  4850. var _getOutermostNode = function getOutermostNode(node, side) {
  4851. var partialGroup = checkPartialGroup(node);
  4852. if (partialGroup) {
  4853. var children = partialGroup.children;
  4854. if (children.length) {
  4855. if (side === "right") {
  4856. return _getOutermostNode(children[children.length - 1], "right");
  4857. } else if (side === "left") {
  4858. return _getOutermostNode(children[0], "left");
  4859. }
  4860. }
  4861. }
  4862. return node;
  4863. };
  4864. var getTypeOfDomTree = function getTypeOfDomTree2(node, side) {
  4865. if (!node) {
  4866. return null;
  4867. }
  4868. if (side) {
  4869. node = _getOutermostNode(node, side);
  4870. }
  4871. var className = node.classes[0];
  4872. return DomEnum[className] || null;
  4873. };
  4874. var makeNullDelimiter = function makeNullDelimiter2(options, classes) {
  4875. var moreClasses = ["nulldelimiter"].concat(options.baseSizingClasses());
  4876. return makeSpan(classes.concat(moreClasses));
  4877. };
  4878. var buildGroup$1 = function buildGroup(group, options, baseOptions) {
  4879. if (!group) {
  4880. return makeSpan();
  4881. }
  4882. if (_htmlGroupBuilders[group.type]) {
  4883. var groupNode = _htmlGroupBuilders[group.type](group, options);
  4884. if (baseOptions && options.size !== baseOptions.size) {
  4885. groupNode = makeSpan(options.sizingClasses(baseOptions), [groupNode], options);
  4886. var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier;
  4887. groupNode.height *= multiplier;
  4888. groupNode.depth *= multiplier;
  4889. }
  4890. return groupNode;
  4891. } else {
  4892. throw new ParseError("Got group of unknown type: '" + group.type + "'");
  4893. }
  4894. };
  4895. function buildHTMLUnbreakable(children, options) {
  4896. var body = makeSpan(["base"], children, options);
  4897. var strut = makeSpan(["strut"]);
  4898. strut.style.height = makeEm(body.height + body.depth);
  4899. if (body.depth) {
  4900. strut.style.verticalAlign = makeEm(-body.depth);
  4901. }
  4902. body.children.unshift(strut);
  4903. return body;
  4904. }
  4905. function buildHTML(tree, options) {
  4906. var tag = null;
  4907. if (tree.length === 1 && tree[0].type === "tag") {
  4908. tag = tree[0].tag;
  4909. tree = tree[0].body;
  4910. }
  4911. var expression = buildExpression$1(tree, options, "root");
  4912. var eqnNum;
  4913. if (expression.length === 2 && expression[1].hasClass("tag")) {
  4914. eqnNum = expression.pop();
  4915. }
  4916. var children = [];
  4917. var parts = [];
  4918. for (var i = 0; i < expression.length; i++) {
  4919. parts.push(expression[i]);
  4920. if (expression[i].hasClass("mbin") || expression[i].hasClass("mrel") || expression[i].hasClass("allowbreak")) {
  4921. var nobreak = false;
  4922. while (i < expression.length - 1 && expression[i + 1].hasClass("mspace") && !expression[i + 1].hasClass("newline")) {
  4923. i++;
  4924. parts.push(expression[i]);
  4925. if (expression[i].hasClass("nobreak")) {
  4926. nobreak = true;
  4927. }
  4928. }
  4929. if (!nobreak) {
  4930. children.push(buildHTMLUnbreakable(parts, options));
  4931. parts = [];
  4932. }
  4933. } else if (expression[i].hasClass("newline")) {
  4934. parts.pop();
  4935. if (parts.length > 0) {
  4936. children.push(buildHTMLUnbreakable(parts, options));
  4937. parts = [];
  4938. }
  4939. children.push(expression[i]);
  4940. }
  4941. }
  4942. if (parts.length > 0) {
  4943. children.push(buildHTMLUnbreakable(parts, options));
  4944. }
  4945. var tagChild;
  4946. if (tag) {
  4947. tagChild = buildHTMLUnbreakable(buildExpression$1(tag, options, true), options);
  4948. tagChild.classes = ["tag"];
  4949. children.push(tagChild);
  4950. } else if (eqnNum) {
  4951. children.push(eqnNum);
  4952. }
  4953. var htmlNode = makeSpan(["katex-html"], children);
  4954. htmlNode.setAttribute("aria-hidden", "true");
  4955. if (tagChild) {
  4956. var strut = tagChild.children[0];
  4957. strut.style.height = makeEm(htmlNode.height + htmlNode.depth);
  4958. if (htmlNode.depth) {
  4959. strut.style.verticalAlign = makeEm(-htmlNode.depth);
  4960. }
  4961. }
  4962. return htmlNode;
  4963. }
  4964. function newDocumentFragment(children) {
  4965. return new DocumentFragment(children);
  4966. }
  4967. var MathNode = class {
  4968. constructor(type, children, classes) {
  4969. this.type = type;
  4970. this.attributes = {};
  4971. this.children = children || [];
  4972. this.classes = classes || [];
  4973. }
  4974. /**
  4975. * Sets an attribute on a MathML node. MathML depends on attributes to convey a
  4976. * semantic content, so this is used heavily.
  4977. */
  4978. setAttribute(name, value) {
  4979. this.attributes[name] = value;
  4980. }
  4981. /**
  4982. * Gets an attribute on a MathML node.
  4983. */
  4984. getAttribute(name) {
  4985. return this.attributes[name];
  4986. }
  4987. /**
  4988. * Converts the math node into a MathML-namespaced DOM element.
  4989. */
  4990. toNode() {
  4991. var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type);
  4992. for (var attr in this.attributes) {
  4993. if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
  4994. node.setAttribute(attr, this.attributes[attr]);
  4995. }
  4996. }
  4997. if (this.classes.length > 0) {
  4998. node.className = createClass(this.classes);
  4999. }
  5000. for (var i = 0; i < this.children.length; i++) {
  5001. if (this.children[i] instanceof TextNode && this.children[i + 1] instanceof TextNode) {
  5002. var text2 = this.children[i].toText() + this.children[++i].toText();
  5003. while (this.children[i + 1] instanceof TextNode) {
  5004. text2 += this.children[++i].toText();
  5005. }
  5006. node.appendChild(new TextNode(text2).toNode());
  5007. } else {
  5008. node.appendChild(this.children[i].toNode());
  5009. }
  5010. }
  5011. return node;
  5012. }
  5013. /**
  5014. * Converts the math node into an HTML markup string.
  5015. */
  5016. toMarkup() {
  5017. var markup = "<" + this.type;
  5018. for (var attr in this.attributes) {
  5019. if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
  5020. markup += " " + attr + '="';
  5021. markup += escape(this.attributes[attr]);
  5022. markup += '"';
  5023. }
  5024. }
  5025. if (this.classes.length > 0) {
  5026. markup += ' class ="' + escape(createClass(this.classes)) + '"';
  5027. }
  5028. markup += ">";
  5029. for (var i = 0; i < this.children.length; i++) {
  5030. markup += this.children[i].toMarkup();
  5031. }
  5032. markup += "</" + this.type + ">";
  5033. return markup;
  5034. }
  5035. /**
  5036. * Converts the math node into a string, similar to innerText, but escaped.
  5037. */
  5038. toText() {
  5039. return this.children.map((child) => child.toText()).join("");
  5040. }
  5041. };
  5042. var TextNode = class {
  5043. constructor(text2) {
  5044. this.text = text2;
  5045. }
  5046. /**
  5047. * Converts the text node into a DOM text node.
  5048. */
  5049. toNode() {
  5050. return document.createTextNode(this.text);
  5051. }
  5052. /**
  5053. * Converts the text node into escaped HTML markup
  5054. * (representing the text itself).
  5055. */
  5056. toMarkup() {
  5057. return escape(this.toText());
  5058. }
  5059. /**
  5060. * Converts the text node into a string
  5061. * (representing the text itself).
  5062. */
  5063. toText() {
  5064. return this.text;
  5065. }
  5066. };
  5067. var SpaceNode = class {
  5068. /**
  5069. * Create a Space node with width given in CSS ems.
  5070. */
  5071. constructor(width) {
  5072. this.width = width;
  5073. if (width >= 0.05555 && width <= 0.05556) {
  5074. this.character = " ";
  5075. } else if (width >= 0.1666 && width <= 0.1667) {
  5076. this.character = " ";
  5077. } else if (width >= 0.2222 && width <= 0.2223) {
  5078. this.character = " ";
  5079. } else if (width >= 0.2777 && width <= 0.2778) {
  5080. this.character = "  ";
  5081. } else if (width >= -0.05556 && width <= -0.05555) {
  5082. this.character = " ⁣";
  5083. } else if (width >= -0.1667 && width <= -0.1666) {
  5084. this.character = " ⁣";
  5085. } else if (width >= -0.2223 && width <= -0.2222) {
  5086. this.character = " ⁣";
  5087. } else if (width >= -0.2778 && width <= -0.2777) {
  5088. this.character = " ⁣";
  5089. } else {
  5090. this.character = null;
  5091. }
  5092. }
  5093. /**
  5094. * Converts the math node into a MathML-namespaced DOM element.
  5095. */
  5096. toNode() {
  5097. if (this.character) {
  5098. return document.createTextNode(this.character);
  5099. } else {
  5100. var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mspace");
  5101. node.setAttribute("width", makeEm(this.width));
  5102. return node;
  5103. }
  5104. }
  5105. /**
  5106. * Converts the math node into an HTML markup string.
  5107. */
  5108. toMarkup() {
  5109. if (this.character) {
  5110. return "<mtext>" + this.character + "</mtext>";
  5111. } else {
  5112. return '<mspace width="' + makeEm(this.width) + '"/>';
  5113. }
  5114. }
  5115. /**
  5116. * Converts the math node into a string, similar to innerText.
  5117. */
  5118. toText() {
  5119. if (this.character) {
  5120. return this.character;
  5121. } else {
  5122. return " ";
  5123. }
  5124. }
  5125. };
  5126. var noVariantSymbols = /* @__PURE__ */ new Set(["\\imath", "\\jmath"]);
  5127. var rowLikeTypes = /* @__PURE__ */ new Set(["mrow", "mtable"]);
  5128. var makeText = function makeText2(text2, mode, options) {
  5129. if (symbols[mode][text2] && symbols[mode][text2].replace && text2.charCodeAt(0) !== 55349 && !(ligatures.hasOwnProperty(text2) && options && (options.fontFamily && options.fontFamily.slice(4, 6) === "tt" || options.font && options.font.slice(4, 6) === "tt"))) {
  5130. text2 = symbols[mode][text2].replace;
  5131. }
  5132. return new TextNode(text2);
  5133. };
  5134. var makeRow = function makeRow2(body) {
  5135. if (body.length === 1) {
  5136. return body[0];
  5137. } else {
  5138. return new MathNode("mrow", body);
  5139. }
  5140. };
  5141. var getVariant = function getVariant2(group, options) {
  5142. if (options.fontFamily === "texttt") {
  5143. return "monospace";
  5144. } else if (options.fontFamily === "textsf") {
  5145. if (options.fontShape === "textit" && options.fontWeight === "textbf") {
  5146. return "sans-serif-bold-italic";
  5147. } else if (options.fontShape === "textit") {
  5148. return "sans-serif-italic";
  5149. } else if (options.fontWeight === "textbf") {
  5150. return "bold-sans-serif";
  5151. } else {
  5152. return "sans-serif";
  5153. }
  5154. } else if (options.fontShape === "textit" && options.fontWeight === "textbf") {
  5155. return "bold-italic";
  5156. } else if (options.fontShape === "textit") {
  5157. return "italic";
  5158. } else if (options.fontWeight === "textbf") {
  5159. return "bold";
  5160. }
  5161. var font = options.font;
  5162. if (!font || font === "mathnormal") {
  5163. return null;
  5164. }
  5165. var mode = group.mode;
  5166. if (font === "mathit") {
  5167. return "italic";
  5168. } else if (font === "boldsymbol") {
  5169. return group.type === "textord" ? "bold" : "bold-italic";
  5170. } else if (font === "mathbf") {
  5171. return "bold";
  5172. } else if (font === "mathbb") {
  5173. return "double-struck";
  5174. } else if (font === "mathsfit") {
  5175. return "sans-serif-italic";
  5176. } else if (font === "mathfrak") {
  5177. return "fraktur";
  5178. } else if (font === "mathscr" || font === "mathcal") {
  5179. return "script";
  5180. } else if (font === "mathsf") {
  5181. return "sans-serif";
  5182. } else if (font === "mathtt") {
  5183. return "monospace";
  5184. }
  5185. var text2 = group.text;
  5186. if (noVariantSymbols.has(text2)) {
  5187. return null;
  5188. }
  5189. if (symbols[mode][text2]) {
  5190. var replacement = symbols[mode][text2].replace;
  5191. if (replacement) {
  5192. text2 = replacement;
  5193. }
  5194. }
  5195. var fontName = fontMap[font].fontName;
  5196. if (getCharacterMetrics(text2, fontName, mode)) {
  5197. return fontMap[font].variant;
  5198. }
  5199. return null;
  5200. };
  5201. function isNumberPunctuation(group) {
  5202. if (!group) {
  5203. return false;
  5204. }
  5205. if (group.type === "mi" && group.children.length === 1) {
  5206. var child = group.children[0];
  5207. return child instanceof TextNode && child.text === ".";
  5208. } else if (group.type === "mo" && group.children.length === 1 && group.getAttribute("separator") === "true" && group.getAttribute("lspace") === "0em" && group.getAttribute("rspace") === "0em") {
  5209. var _child = group.children[0];
  5210. return _child instanceof TextNode && _child.text === ",";
  5211. } else {
  5212. return false;
  5213. }
  5214. }
  5215. var buildExpression2 = function buildExpression3(expression, options, isOrdgroup) {
  5216. if (expression.length === 1) {
  5217. var group = buildGroup2(expression[0], options);
  5218. if (isOrdgroup && group instanceof MathNode && group.type === "mo") {
  5219. group.setAttribute("lspace", "0em");
  5220. group.setAttribute("rspace", "0em");
  5221. }
  5222. return [group];
  5223. }
  5224. var groups = [];
  5225. var lastGroup;
  5226. for (var i = 0; i < expression.length; i++) {
  5227. var _group = buildGroup2(expression[i], options);
  5228. if (_group instanceof MathNode && lastGroup instanceof MathNode) {
  5229. if (_group.type === "mtext" && lastGroup.type === "mtext" && _group.getAttribute("mathvariant") === lastGroup.getAttribute("mathvariant")) {
  5230. lastGroup.children.push(..._group.children);
  5231. continue;
  5232. } else if (_group.type === "mn" && lastGroup.type === "mn") {
  5233. lastGroup.children.push(..._group.children);
  5234. continue;
  5235. } else if (isNumberPunctuation(_group) && lastGroup.type === "mn") {
  5236. lastGroup.children.push(..._group.children);
  5237. continue;
  5238. } else if (_group.type === "mn" && isNumberPunctuation(lastGroup)) {
  5239. _group.children = [...lastGroup.children, ..._group.children];
  5240. groups.pop();
  5241. } else if ((_group.type === "msup" || _group.type === "msub") && _group.children.length >= 1 && (lastGroup.type === "mn" || isNumberPunctuation(lastGroup))) {
  5242. var base = _group.children[0];
  5243. if (base instanceof MathNode && base.type === "mn") {
  5244. base.children = [...lastGroup.children, ...base.children];
  5245. groups.pop();
  5246. }
  5247. } else if (lastGroup.type === "mi" && lastGroup.children.length === 1) {
  5248. var lastChild = lastGroup.children[0];
  5249. if (lastChild instanceof TextNode && lastChild.text === "̸" && (_group.type === "mo" || _group.type === "mi" || _group.type === "mn")) {
  5250. var child = _group.children[0];
  5251. if (child instanceof TextNode && child.text.length > 0) {
  5252. child.text = child.text.slice(0, 1) + "̸" + child.text.slice(1);
  5253. groups.pop();
  5254. }
  5255. }
  5256. }
  5257. }
  5258. groups.push(_group);
  5259. lastGroup = _group;
  5260. }
  5261. return groups;
  5262. };
  5263. var buildExpressionRow = function buildExpressionRow2(expression, options, isOrdgroup) {
  5264. return makeRow(buildExpression2(expression, options, isOrdgroup));
  5265. };
  5266. var buildGroup2 = function buildGroup3(group, options) {
  5267. if (!group) {
  5268. return new MathNode("mrow");
  5269. }
  5270. if (_mathmlGroupBuilders[group.type]) {
  5271. var result = _mathmlGroupBuilders[group.type](group, options);
  5272. return result;
  5273. } else {
  5274. throw new ParseError("Got group of unknown type: '" + group.type + "'");
  5275. }
  5276. };
  5277. function buildMathML(tree, texExpression, options, isDisplayMode, forMathmlOnly) {
  5278. var expression = buildExpression2(tree, options);
  5279. var wrapper;
  5280. if (expression.length === 1 && expression[0] instanceof MathNode && rowLikeTypes.has(expression[0].type)) {
  5281. wrapper = expression[0];
  5282. } else {
  5283. wrapper = new MathNode("mrow", expression);
  5284. }
  5285. var annotation = new MathNode("annotation", [new TextNode(texExpression)]);
  5286. annotation.setAttribute("encoding", "application/x-tex");
  5287. var semantics = new MathNode("semantics", [wrapper, annotation]);
  5288. var math2 = new MathNode("math", [semantics]);
  5289. math2.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML");
  5290. if (isDisplayMode) {
  5291. math2.setAttribute("display", "block");
  5292. }
  5293. var wrapperClass = forMathmlOnly ? "katex" : "katex-mathml";
  5294. return makeSpan([wrapperClass], [math2]);
  5295. }
  5296. var sizeStyleMap = [
  5297. // Each element contains [textsize, scriptsize, scriptscriptsize].
  5298. // The size mappings are taken from TeX with \normalsize=10pt.
  5299. [1, 1, 1],
  5300. // size1: [5, 5, 5] \tiny
  5301. [2, 1, 1],
  5302. // size2: [6, 5, 5]
  5303. [3, 1, 1],
  5304. // size3: [7, 5, 5] \scriptsize
  5305. [4, 2, 1],
  5306. // size4: [8, 6, 5] \footnotesize
  5307. [5, 2, 1],
  5308. // size5: [9, 6, 5] \small
  5309. [6, 3, 1],
  5310. // size6: [10, 7, 5] \normalsize
  5311. [7, 4, 2],
  5312. // size7: [12, 8, 6] \large
  5313. [8, 6, 3],
  5314. // size8: [14.4, 10, 7] \Large
  5315. [9, 7, 6],
  5316. // size9: [17.28, 12, 10] \LARGE
  5317. [10, 8, 7],
  5318. // size10: [20.74, 14.4, 12] \huge
  5319. [11, 10, 9]
  5320. // size11: [24.88, 20.74, 17.28] \HUGE
  5321. ];
  5322. var sizeMultipliers = [
  5323. // fontMetrics.js:getGlobalMetrics also uses size indexes, so if
  5324. // you change size indexes, change that function.
  5325. 0.5,
  5326. 0.6,
  5327. 0.7,
  5328. 0.8,
  5329. 0.9,
  5330. 1,
  5331. 1.2,
  5332. 1.44,
  5333. 1.728,
  5334. 2.074,
  5335. 2.488
  5336. ];
  5337. var sizeAtStyle = function sizeAtStyle2(size, style) {
  5338. return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1];
  5339. };
  5340. var Options = class _Options {
  5341. constructor(data) {
  5342. this.style = data.style;
  5343. this.color = data.color;
  5344. this.size = data.size || _Options.BASESIZE;
  5345. this.textSize = data.textSize || this.size;
  5346. this.phantom = !!data.phantom;
  5347. this.font = data.font || "";
  5348. this.fontFamily = data.fontFamily || "";
  5349. this.fontWeight = data.fontWeight || "";
  5350. this.fontShape = data.fontShape || "";
  5351. this.sizeMultiplier = sizeMultipliers[this.size - 1];
  5352. this.maxSize = data.maxSize;
  5353. this.minRuleThickness = data.minRuleThickness;
  5354. this._fontMetrics = void 0;
  5355. }
  5356. /**
  5357. * Returns a new options object with the same properties as "this". Properties
  5358. * from "extension" will be copied to the new options object.
  5359. */
  5360. extend(extension) {
  5361. var data = {
  5362. style: this.style,
  5363. size: this.size,
  5364. textSize: this.textSize,
  5365. color: this.color,
  5366. phantom: this.phantom,
  5367. font: this.font,
  5368. fontFamily: this.fontFamily,
  5369. fontWeight: this.fontWeight,
  5370. fontShape: this.fontShape,
  5371. maxSize: this.maxSize,
  5372. minRuleThickness: this.minRuleThickness
  5373. };
  5374. Object.assign(data, extension);
  5375. return new _Options(data);
  5376. }
  5377. /**
  5378. * Return an options object with the given style. If `this.style === style`,
  5379. * returns `this`.
  5380. */
  5381. havingStyle(style) {
  5382. if (this.style === style) {
  5383. return this;
  5384. } else {
  5385. return this.extend({
  5386. style,
  5387. size: sizeAtStyle(this.textSize, style)
  5388. });
  5389. }
  5390. }
  5391. /**
  5392. * Return an options object with a cramped version of the current style. If
  5393. * the current style is cramped, returns `this`.
  5394. */
  5395. havingCrampedStyle() {
  5396. return this.havingStyle(this.style.cramp());
  5397. }
  5398. /**
  5399. * Return an options object with the given size and in at least `\textstyle`.
  5400. * Returns `this` if appropriate.
  5401. */
  5402. havingSize(size) {
  5403. if (this.size === size && this.textSize === size) {
  5404. return this;
  5405. } else {
  5406. return this.extend({
  5407. style: this.style.text(),
  5408. size,
  5409. textSize: size,
  5410. sizeMultiplier: sizeMultipliers[size - 1]
  5411. });
  5412. }
  5413. }
  5414. /**
  5415. * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted,
  5416. * changes to at least `\textstyle`.
  5417. */
  5418. havingBaseStyle(style) {
  5419. style = style || this.style.text();
  5420. var wantSize = sizeAtStyle(_Options.BASESIZE, style);
  5421. if (this.size === wantSize && this.textSize === _Options.BASESIZE && this.style === style) {
  5422. return this;
  5423. } else {
  5424. return this.extend({
  5425. style,
  5426. size: wantSize
  5427. });
  5428. }
  5429. }
  5430. /**
  5431. * Remove the effect of sizing changes such as \Huge.
  5432. * Keep the effect of the current style, such as \scriptstyle.
  5433. */
  5434. havingBaseSizing() {
  5435. var size;
  5436. switch (this.style.id) {
  5437. case 4:
  5438. case 5:
  5439. size = 3;
  5440. break;
  5441. case 6:
  5442. case 7:
  5443. size = 1;
  5444. break;
  5445. default:
  5446. size = 6;
  5447. }
  5448. return this.extend({
  5449. style: this.style.text(),
  5450. size
  5451. });
  5452. }
  5453. /**
  5454. * Create a new options object with the given color.
  5455. */
  5456. withColor(color) {
  5457. return this.extend({
  5458. color
  5459. });
  5460. }
  5461. /**
  5462. * Create a new options object with "phantom" set to true.
  5463. */
  5464. withPhantom() {
  5465. return this.extend({
  5466. phantom: true
  5467. });
  5468. }
  5469. /**
  5470. * Creates a new options object with the given math font or old text font.
  5471. * @type {[type]}
  5472. */
  5473. withFont(font) {
  5474. return this.extend({
  5475. font
  5476. });
  5477. }
  5478. /**
  5479. * Create a new options objects with the given fontFamily.
  5480. */
  5481. withTextFontFamily(fontFamily) {
  5482. return this.extend({
  5483. fontFamily,
  5484. font: ""
  5485. });
  5486. }
  5487. /**
  5488. * Creates a new options object with the given font weight
  5489. */
  5490. withTextFontWeight(fontWeight) {
  5491. return this.extend({
  5492. fontWeight,
  5493. font: ""
  5494. });
  5495. }
  5496. /**
  5497. * Creates a new options object with the given font weight
  5498. */
  5499. withTextFontShape(fontShape) {
  5500. return this.extend({
  5501. fontShape,
  5502. font: ""
  5503. });
  5504. }
  5505. /**
  5506. * Return the CSS sizing classes required to switch from enclosing options
  5507. * `oldOptions` to `this`. Returns an array of classes.
  5508. */
  5509. sizingClasses(oldOptions) {
  5510. if (oldOptions.size !== this.size) {
  5511. return ["sizing", "reset-size" + oldOptions.size, "size" + this.size];
  5512. } else {
  5513. return [];
  5514. }
  5515. }
  5516. /**
  5517. * Return the CSS sizing classes required to switch to the base size. Like
  5518. * `this.havingSize(BASESIZE).sizingClasses(this)`.
  5519. */
  5520. baseSizingClasses() {
  5521. if (this.size !== _Options.BASESIZE) {
  5522. return ["sizing", "reset-size" + this.size, "size" + _Options.BASESIZE];
  5523. } else {
  5524. return [];
  5525. }
  5526. }
  5527. /**
  5528. * Return the font metrics for this size.
  5529. */
  5530. fontMetrics() {
  5531. if (!this._fontMetrics) {
  5532. this._fontMetrics = getGlobalMetrics(this.size);
  5533. }
  5534. return this._fontMetrics;
  5535. }
  5536. /**
  5537. * Gets the CSS color of the current options object
  5538. */
  5539. getColor() {
  5540. if (this.phantom) {
  5541. return "transparent";
  5542. } else {
  5543. return this.color;
  5544. }
  5545. }
  5546. };
  5547. Options.BASESIZE = 6;
  5548. var optionsFromSettings = function optionsFromSettings2(settings) {
  5549. return new Options({
  5550. style: settings.displayMode ? Style$1.DISPLAY : Style$1.TEXT,
  5551. maxSize: settings.maxSize,
  5552. minRuleThickness: settings.minRuleThickness
  5553. });
  5554. };
  5555. var displayWrap = function displayWrap2(node, settings) {
  5556. if (settings.displayMode) {
  5557. var classes = ["katex-display"];
  5558. if (settings.leqno) {
  5559. classes.push("leqno");
  5560. }
  5561. if (settings.fleqn) {
  5562. classes.push("fleqn");
  5563. }
  5564. node = makeSpan(classes, [node]);
  5565. }
  5566. return node;
  5567. };
  5568. var buildTree = function buildTree2(tree, expression, settings) {
  5569. var options = optionsFromSettings(settings);
  5570. var katexNode;
  5571. if (settings.output === "mathml") {
  5572. return buildMathML(tree, expression, options, settings.displayMode, true);
  5573. } else if (settings.output === "html") {
  5574. var htmlNode = buildHTML(tree, options);
  5575. katexNode = makeSpan(["katex"], [htmlNode]);
  5576. } else {
  5577. var mathMLNode = buildMathML(tree, expression, options, settings.displayMode, false);
  5578. var _htmlNode = buildHTML(tree, options);
  5579. katexNode = makeSpan(["katex"], [mathMLNode, _htmlNode]);
  5580. }
  5581. return displayWrap(katexNode, settings);
  5582. };
  5583. var buildHTMLTree = function buildHTMLTree2(tree, expression, settings) {
  5584. var options = optionsFromSettings(settings);
  5585. var htmlNode = buildHTML(tree, options);
  5586. var katexNode = makeSpan(["katex"], [htmlNode]);
  5587. return displayWrap(katexNode, settings);
  5588. };
  5589. var stretchyCodePoint = {
  5590. widehat: "^",
  5591. widecheck: "ˇ",
  5592. widetilde: "~",
  5593. utilde: "~",
  5594. overleftarrow: "←",
  5595. underleftarrow: "←",
  5596. xleftarrow: "←",
  5597. overrightarrow: "→",
  5598. underrightarrow: "→",
  5599. xrightarrow: "→",
  5600. underbrace: "⏟",
  5601. overbrace: "⏞",
  5602. underbracket: "⎵",
  5603. overbracket: "⎴",
  5604. overgroup: "⏠",
  5605. undergroup: "⏡",
  5606. overleftrightarrow: "↔",
  5607. underleftrightarrow: "↔",
  5608. xleftrightarrow: "↔",
  5609. Overrightarrow: "⇒",
  5610. xRightarrow: "⇒",
  5611. overleftharpoon: "↼",
  5612. xleftharpoonup: "↼",
  5613. overrightharpoon: "⇀",
  5614. xrightharpoonup: "⇀",
  5615. xLeftarrow: "⇐",
  5616. xLeftrightarrow: "⇔",
  5617. xhookleftarrow: "↩",
  5618. xhookrightarrow: "↪",
  5619. xmapsto: "↦",
  5620. xrightharpoondown: "⇁",
  5621. xleftharpoondown: "↽",
  5622. xrightleftharpoons: "⇌",
  5623. xleftrightharpoons: "⇋",
  5624. xtwoheadleftarrow: "↞",
  5625. xtwoheadrightarrow: "↠",
  5626. xlongequal: "=",
  5627. xtofrom: "⇄",
  5628. xrightleftarrows: "⇄",
  5629. xrightequilibrium: "⇌",
  5630. // Not a perfect match.
  5631. xleftequilibrium: "⇋",
  5632. // None better available.
  5633. "\\cdrightarrow": "→",
  5634. "\\cdleftarrow": "←",
  5635. "\\cdlongequal": "="
  5636. };
  5637. var stretchyMathML = function stretchyMathML2(label) {
  5638. var node = new MathNode("mo", [new TextNode(stretchyCodePoint[label.replace(/^\\/, "")])]);
  5639. node.setAttribute("stretchy", "true");
  5640. return node;
  5641. };
  5642. var katexImagesData = {
  5643. // path(s), minWidth, height, align
  5644. overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"],
  5645. overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"],
  5646. underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"],
  5647. underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"],
  5648. xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"],
  5649. "\\cdrightarrow": [["rightarrow"], 3, 522, "xMaxYMin"],
  5650. // CD minwwidth2.5pc
  5651. xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"],
  5652. "\\cdleftarrow": [["leftarrow"], 3, 522, "xMinYMin"],
  5653. Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"],
  5654. xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"],
  5655. xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"],
  5656. overleftharpoon: [["leftharpoon"], 0.888, 522, "xMinYMin"],
  5657. xleftharpoonup: [["leftharpoon"], 0.888, 522, "xMinYMin"],
  5658. xleftharpoondown: [["leftharpoondown"], 0.888, 522, "xMinYMin"],
  5659. overrightharpoon: [["rightharpoon"], 0.888, 522, "xMaxYMin"],
  5660. xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"],
  5661. xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"],
  5662. xlongequal: [["longequal"], 0.888, 334, "xMinYMin"],
  5663. "\\cdlongequal": [["longequal"], 3, 334, "xMinYMin"],
  5664. xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"],
  5665. xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"],
  5666. overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522],
  5667. overbrace: [["leftbrace", "midbrace", "rightbrace"], 1.6, 548],
  5668. underbrace: [["leftbraceunder", "midbraceunder", "rightbraceunder"], 1.6, 548],
  5669. underleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522],
  5670. xleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522],
  5671. xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560],
  5672. xrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716],
  5673. xleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716],
  5674. xhookleftarrow: [["leftarrow", "righthook"], 1.08, 522],
  5675. xhookrightarrow: [["lefthook", "rightarrow"], 1.08, 522],
  5676. overlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522],
  5677. underlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522],
  5678. overbracket: [["leftbracketover", "rightbracketover"], 1.6, 440],
  5679. underbracket: [["leftbracketunder", "rightbracketunder"], 1.6, 410],
  5680. overgroup: [["leftgroup", "rightgroup"], 0.888, 342],
  5681. undergroup: [["leftgroupunder", "rightgroupunder"], 0.888, 342],
  5682. xmapsto: [["leftmapsto", "rightarrow"], 1.5, 522],
  5683. xtofrom: [["leftToFrom", "rightToFrom"], 1.75, 528],
  5684. // The next three arrows are from the mhchem package.
  5685. // In mhchem.sty, min-length is 2.0em. But these arrows might appear in the
  5686. // document as \xrightarrow or \xrightleftharpoons. Those have
  5687. // min-length = 1.75em, so we set min-length on these next three to match.
  5688. xrightleftarrows: [["baraboveleftarrow", "rightarrowabovebar"], 1.75, 901],
  5689. xrightequilibrium: [["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], 1.75, 716],
  5690. xleftequilibrium: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716]
  5691. };
  5692. var wideAccentLabels = /* @__PURE__ */ new Set(["widehat", "widecheck", "widetilde", "utilde"]);
  5693. var stretchySvg = function stretchySvg2(group, options) {
  5694. function buildSvgSpan_() {
  5695. var viewBoxWidth = 4e5;
  5696. var label = group.label.slice(1);
  5697. if (wideAccentLabels.has(label)) {
  5698. var grp = group;
  5699. var numChars = grp.base.type === "ordgroup" ? grp.base.body.length : 1;
  5700. var viewBoxHeight;
  5701. var pathName;
  5702. var _height;
  5703. if (numChars > 5) {
  5704. if (label === "widehat" || label === "widecheck") {
  5705. viewBoxHeight = 420;
  5706. viewBoxWidth = 2364;
  5707. _height = 0.42;
  5708. pathName = label + "4";
  5709. } else {
  5710. viewBoxHeight = 312;
  5711. viewBoxWidth = 2340;
  5712. _height = 0.34;
  5713. pathName = "tilde4";
  5714. }
  5715. } else {
  5716. var imgIndex = [1, 1, 2, 2, 3, 3][numChars];
  5717. if (label === "widehat" || label === "widecheck") {
  5718. viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex];
  5719. viewBoxHeight = [0, 239, 300, 360, 420][imgIndex];
  5720. _height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex];
  5721. pathName = label + imgIndex;
  5722. } else {
  5723. viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex];
  5724. viewBoxHeight = [0, 260, 286, 306, 312][imgIndex];
  5725. _height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex];
  5726. pathName = "tilde" + imgIndex;
  5727. }
  5728. }
  5729. var path2 = new PathNode(pathName);
  5730. var svgNode = new SvgNode([path2], {
  5731. "width": "100%",
  5732. "height": makeEm(_height),
  5733. "viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight,
  5734. "preserveAspectRatio": "none"
  5735. });
  5736. return {
  5737. span: makeSvgSpan([], [svgNode], options),
  5738. minWidth: 0,
  5739. height: _height
  5740. };
  5741. } else {
  5742. var spans = [];
  5743. var data = katexImagesData[label];
  5744. var [paths, _minWidth, _viewBoxHeight] = data;
  5745. var _height2 = _viewBoxHeight / 1e3;
  5746. var numSvgChildren = paths.length;
  5747. var widthClasses;
  5748. var aligns;
  5749. if (numSvgChildren === 1) {
  5750. var align1 = data[3];
  5751. widthClasses = ["hide-tail"];
  5752. aligns = [align1];
  5753. } else if (numSvgChildren === 2) {
  5754. widthClasses = ["halfarrow-left", "halfarrow-right"];
  5755. aligns = ["xMinYMin", "xMaxYMin"];
  5756. } else if (numSvgChildren === 3) {
  5757. widthClasses = ["brace-left", "brace-center", "brace-right"];
  5758. aligns = ["xMinYMin", "xMidYMin", "xMaxYMin"];
  5759. } else {
  5760. throw new Error("Correct katexImagesData or update code here to support\n " + numSvgChildren + " children.");
  5761. }
  5762. for (var i = 0; i < numSvgChildren; i++) {
  5763. var _path = new PathNode(paths[i]);
  5764. var _svgNode = new SvgNode([_path], {
  5765. "width": "400em",
  5766. "height": makeEm(_height2),
  5767. "viewBox": "0 0 " + viewBoxWidth + " " + _viewBoxHeight,
  5768. "preserveAspectRatio": aligns[i] + " slice"
  5769. });
  5770. var _span = makeSvgSpan([widthClasses[i]], [_svgNode], options);
  5771. if (numSvgChildren === 1) {
  5772. return {
  5773. span: _span,
  5774. minWidth: _minWidth,
  5775. height: _height2
  5776. };
  5777. } else {
  5778. _span.style.height = makeEm(_height2);
  5779. spans.push(_span);
  5780. }
  5781. }
  5782. return {
  5783. span: makeSpan(["stretchy"], spans, options),
  5784. minWidth: _minWidth,
  5785. height: _height2
  5786. };
  5787. }
  5788. }
  5789. var {
  5790. span,
  5791. minWidth,
  5792. height
  5793. } = buildSvgSpan_();
  5794. span.height = height;
  5795. span.style.height = makeEm(height);
  5796. if (minWidth > 0) {
  5797. span.style.minWidth = makeEm(minWidth);
  5798. }
  5799. return span;
  5800. };
  5801. var stretchyEnclose = function stretchyEnclose2(inner2, label, topPad, bottomPad, options) {
  5802. var img;
  5803. var totalHeight = inner2.height + inner2.depth + topPad + bottomPad;
  5804. if (/fbox|color|angl/.test(label)) {
  5805. img = makeSpan(["stretchy", label], [], options);
  5806. if (label === "fbox") {
  5807. var color = options.color && options.getColor();
  5808. if (color) {
  5809. img.style.borderColor = color;
  5810. }
  5811. }
  5812. } else {
  5813. var lines = [];
  5814. if (/^[bx]cancel$/.test(label)) {
  5815. lines.push(new LineNode({
  5816. "x1": "0",
  5817. "y1": "0",
  5818. "x2": "100%",
  5819. "y2": "100%",
  5820. "stroke-width": "0.046em"
  5821. }));
  5822. }
  5823. if (/^x?cancel$/.test(label)) {
  5824. lines.push(new LineNode({
  5825. "x1": "0",
  5826. "y1": "100%",
  5827. "x2": "100%",
  5828. "y2": "0",
  5829. "stroke-width": "0.046em"
  5830. }));
  5831. }
  5832. var svgNode = new SvgNode(lines, {
  5833. "width": "100%",
  5834. "height": makeEm(totalHeight)
  5835. });
  5836. img = makeSvgSpan([], [svgNode], options);
  5837. }
  5838. img.height = totalHeight;
  5839. img.style.height = makeEm(totalHeight);
  5840. return img;
  5841. };
  5842. function assertNodeType(node, type) {
  5843. if (!node || node.type !== type) {
  5844. throw new Error("Expected node of type " + type + ", but got " + (node ? "node of type " + node.type : String(node)));
  5845. }
  5846. return node;
  5847. }
  5848. function assertSymbolNodeType(node) {
  5849. var typedNode = checkSymbolNodeType(node);
  5850. if (!typedNode) {
  5851. throw new Error("Expected node of symbol group type, but got " + (node ? "node of type " + node.type : String(node)));
  5852. }
  5853. return typedNode;
  5854. }
  5855. function checkSymbolNodeType(node) {
  5856. if (node && (node.type === "atom" || NON_ATOMS.hasOwnProperty(node.type))) {
  5857. return node;
  5858. }
  5859. return null;
  5860. }
  5861. var getBaseSymbol = (group) => {
  5862. if (group instanceof SymbolNode) {
  5863. return group;
  5864. }
  5865. if (hasHtmlDomChildren(group) && group.children.length === 1) {
  5866. return getBaseSymbol(group.children[0]);
  5867. }
  5868. };
  5869. var htmlBuilder$a = (grp, options) => {
  5870. var base;
  5871. var group;
  5872. var supSubGroup;
  5873. if (grp && grp.type === "supsub") {
  5874. group = assertNodeType(grp.base, "accent");
  5875. base = group.base;
  5876. grp.base = base;
  5877. supSubGroup = assertSpan(buildGroup$1(grp, options));
  5878. grp.base = group;
  5879. } else {
  5880. group = assertNodeType(grp, "accent");
  5881. base = group.base;
  5882. }
  5883. var body = buildGroup$1(base, options.havingCrampedStyle());
  5884. var mustShift = group.isShifty && isCharacterBox(base);
  5885. var skew = 0;
  5886. if (mustShift) {
  5887. var _getBaseSymbol$skew, _getBaseSymbol;
  5888. skew = (_getBaseSymbol$skew = (_getBaseSymbol = getBaseSymbol(body)) == null ? void 0 : _getBaseSymbol.skew) != null ? _getBaseSymbol$skew : 0;
  5889. }
  5890. var accentBelow = group.label === "\\c";
  5891. var clearance = accentBelow ? body.height + body.depth : Math.min(body.height, options.fontMetrics().xHeight);
  5892. var accentBody;
  5893. if (!group.isStretchy) {
  5894. var accent2;
  5895. var width;
  5896. if (group.label === "\\vec") {
  5897. accent2 = staticSvg("vec", options);
  5898. width = svgData.vec[1];
  5899. } else {
  5900. accent2 = makeOrd({
  5901. type: "textord",
  5902. mode: group.mode,
  5903. text: group.label
  5904. }, options, "textord");
  5905. accent2 = assertSymbolDomNode(accent2);
  5906. accent2.italic = 0;
  5907. width = accent2.width;
  5908. if (accentBelow) {
  5909. clearance += accent2.depth;
  5910. }
  5911. }
  5912. accentBody = makeSpan(["accent-body"], [accent2]);
  5913. var accentFull = group.label === "\\textcircled";
  5914. if (accentFull) {
  5915. accentBody.classes.push("accent-full");
  5916. clearance = body.height;
  5917. }
  5918. var left = skew;
  5919. if (!accentFull) {
  5920. left -= width / 2;
  5921. }
  5922. accentBody.style.left = makeEm(left);
  5923. if (group.label === "\\textcircled") {
  5924. accentBody.style.top = ".2em";
  5925. }
  5926. accentBody = makeVList({
  5927. positionType: "firstBaseline",
  5928. children: [{
  5929. type: "elem",
  5930. elem: body
  5931. }, {
  5932. type: "kern",
  5933. size: -clearance
  5934. }, {
  5935. type: "elem",
  5936. elem: accentBody
  5937. }]
  5938. });
  5939. } else {
  5940. accentBody = stretchySvg(group, options);
  5941. accentBody = makeVList({
  5942. positionType: "firstBaseline",
  5943. children: [{
  5944. type: "elem",
  5945. elem: body
  5946. }, {
  5947. type: "elem",
  5948. elem: accentBody,
  5949. wrapperClasses: ["svg-align"],
  5950. wrapperStyle: skew > 0 ? {
  5951. width: "calc(100% - " + makeEm(2 * skew) + ")",
  5952. marginLeft: makeEm(2 * skew)
  5953. } : void 0
  5954. }]
  5955. });
  5956. }
  5957. var accentWrap = makeSpan(["mord", "accent"], [accentBody], options);
  5958. if (supSubGroup) {
  5959. supSubGroup.children[0] = accentWrap;
  5960. supSubGroup.height = Math.max(accentWrap.height, supSubGroup.height);
  5961. supSubGroup.classes[0] = "mord";
  5962. return supSubGroup;
  5963. } else {
  5964. return accentWrap;
  5965. }
  5966. };
  5967. var mathmlBuilder$9 = (group, options) => {
  5968. var accentNode = group.isStretchy ? stretchyMathML(group.label) : new MathNode("mo", [makeText(group.label, group.mode)]);
  5969. var node = new MathNode("mover", [buildGroup2(group.base, options), accentNode]);
  5970. node.setAttribute("accent", "true");
  5971. return node;
  5972. };
  5973. var NON_STRETCHY_ACCENT_REGEX = new RegExp(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring"].map((accent2) => "\\" + accent2).join("|"));
  5974. defineFunction({
  5975. type: "accent",
  5976. names: ["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring", "\\widecheck", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"],
  5977. props: {
  5978. numArgs: 1
  5979. },
  5980. handler: (context, args) => {
  5981. var base = normalizeArgument(args[0]);
  5982. var isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName);
  5983. var isShifty = !isStretchy || context.funcName === "\\widehat" || context.funcName === "\\widetilde" || context.funcName === "\\widecheck";
  5984. return {
  5985. type: "accent",
  5986. mode: context.parser.mode,
  5987. label: context.funcName,
  5988. isStretchy,
  5989. isShifty,
  5990. base
  5991. };
  5992. },
  5993. htmlBuilder: htmlBuilder$a,
  5994. mathmlBuilder: mathmlBuilder$9
  5995. });
  5996. defineFunction({
  5997. type: "accent",
  5998. names: ["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\c", "\\r", "\\H", "\\v", "\\textcircled"],
  5999. props: {
  6000. numArgs: 1,
  6001. allowedInText: true,
  6002. allowedInMath: true,
  6003. // unless in strict mode
  6004. argTypes: ["primitive"]
  6005. },
  6006. handler: (context, args) => {
  6007. var base = args[0];
  6008. var mode = context.parser.mode;
  6009. if (mode === "math") {
  6010. context.parser.settings.reportNonstrict("mathVsTextAccents", "LaTeX's accent " + context.funcName + " works only in text mode");
  6011. mode = "text";
  6012. }
  6013. return {
  6014. type: "accent",
  6015. mode,
  6016. label: context.funcName,
  6017. isStretchy: false,
  6018. isShifty: true,
  6019. base
  6020. };
  6021. },
  6022. htmlBuilder: htmlBuilder$a,
  6023. mathmlBuilder: mathmlBuilder$9
  6024. });
  6025. defineFunction({
  6026. type: "accentUnder",
  6027. names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"],
  6028. props: {
  6029. numArgs: 1
  6030. },
  6031. handler: (_ref, args) => {
  6032. var {
  6033. parser,
  6034. funcName
  6035. } = _ref;
  6036. var base = args[0];
  6037. return {
  6038. type: "accentUnder",
  6039. mode: parser.mode,
  6040. label: funcName,
  6041. base
  6042. };
  6043. },
  6044. htmlBuilder: (group, options) => {
  6045. var innerGroup = buildGroup$1(group.base, options);
  6046. var accentBody = stretchySvg(group, options);
  6047. var kern = group.label === "\\utilde" ? 0.12 : 0;
  6048. var vlist = makeVList({
  6049. positionType: "top",
  6050. positionData: innerGroup.height,
  6051. children: [{
  6052. type: "elem",
  6053. elem: accentBody,
  6054. wrapperClasses: ["svg-align"]
  6055. }, {
  6056. type: "kern",
  6057. size: kern
  6058. }, {
  6059. type: "elem",
  6060. elem: innerGroup
  6061. }]
  6062. });
  6063. return makeSpan(["mord", "accentunder"], [vlist], options);
  6064. },
  6065. mathmlBuilder: (group, options) => {
  6066. var accentNode = stretchyMathML(group.label);
  6067. var node = new MathNode("munder", [buildGroup2(group.base, options), accentNode]);
  6068. node.setAttribute("accentunder", "true");
  6069. return node;
  6070. }
  6071. });
  6072. var paddedNode = (group) => {
  6073. var node = new MathNode("mpadded", group ? [group] : []);
  6074. node.setAttribute("width", "+0.6em");
  6075. node.setAttribute("lspace", "0.3em");
  6076. return node;
  6077. };
  6078. defineFunction({
  6079. type: "xArrow",
  6080. names: [
  6081. "\\xleftarrow",
  6082. "\\xrightarrow",
  6083. "\\xLeftarrow",
  6084. "\\xRightarrow",
  6085. "\\xleftrightarrow",
  6086. "\\xLeftrightarrow",
  6087. "\\xhookleftarrow",
  6088. "\\xhookrightarrow",
  6089. "\\xmapsto",
  6090. "\\xrightharpoondown",
  6091. "\\xrightharpoonup",
  6092. "\\xleftharpoondown",
  6093. "\\xleftharpoonup",
  6094. "\\xrightleftharpoons",
  6095. "\\xleftrightharpoons",
  6096. "\\xlongequal",
  6097. "\\xtwoheadrightarrow",
  6098. "\\xtwoheadleftarrow",
  6099. "\\xtofrom",
  6100. // The next 3 functions are here to support the mhchem extension.
  6101. // Direct use of these functions is discouraged and may break someday.
  6102. "\\xrightleftarrows",
  6103. "\\xrightequilibrium",
  6104. "\\xleftequilibrium",
  6105. // The next 3 functions are here only to support the {CD} environment.
  6106. "\\\\cdrightarrow",
  6107. "\\\\cdleftarrow",
  6108. "\\\\cdlongequal"
  6109. ],
  6110. props: {
  6111. numArgs: 1,
  6112. numOptionalArgs: 1
  6113. },
  6114. handler(_ref, args, optArgs) {
  6115. var {
  6116. parser,
  6117. funcName
  6118. } = _ref;
  6119. return {
  6120. type: "xArrow",
  6121. mode: parser.mode,
  6122. label: funcName,
  6123. body: args[0],
  6124. below: optArgs[0]
  6125. };
  6126. },
  6127. htmlBuilder(group, options) {
  6128. var style = options.style;
  6129. var newOptions = options.havingStyle(style.sup());
  6130. var upperGroup = wrapFragment(buildGroup$1(group.body, newOptions, options), options);
  6131. var arrowPrefix = group.label.slice(0, 2) === "\\x" ? "x" : "cd";
  6132. upperGroup.classes.push(arrowPrefix + "-arrow-pad");
  6133. var lowerGroup;
  6134. if (group.below) {
  6135. newOptions = options.havingStyle(style.sub());
  6136. lowerGroup = wrapFragment(buildGroup$1(group.below, newOptions, options), options);
  6137. lowerGroup.classes.push(arrowPrefix + "-arrow-pad");
  6138. }
  6139. var arrowBody = stretchySvg(group, options);
  6140. var arrowShift = -options.fontMetrics().axisHeight + 0.5 * arrowBody.height;
  6141. var upperShift = -options.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111;
  6142. if (upperGroup.depth > 0.25 || group.label === "\\xleftequilibrium") {
  6143. upperShift -= upperGroup.depth;
  6144. }
  6145. var vlist;
  6146. if (lowerGroup) {
  6147. var lowerShift = -options.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111;
  6148. vlist = makeVList({
  6149. positionType: "individualShift",
  6150. children: [{
  6151. type: "elem",
  6152. elem: upperGroup,
  6153. shift: upperShift
  6154. }, {
  6155. type: "elem",
  6156. elem: arrowBody,
  6157. shift: arrowShift
  6158. }, {
  6159. type: "elem",
  6160. elem: lowerGroup,
  6161. shift: lowerShift
  6162. }]
  6163. });
  6164. } else {
  6165. vlist = makeVList({
  6166. positionType: "individualShift",
  6167. children: [{
  6168. type: "elem",
  6169. elem: upperGroup,
  6170. shift: upperShift
  6171. }, {
  6172. type: "elem",
  6173. elem: arrowBody,
  6174. shift: arrowShift
  6175. }]
  6176. });
  6177. }
  6178. vlist.children[0].children[0].children[1].classes.push("svg-align");
  6179. return makeSpan(["mrel", "x-arrow"], [vlist], options);
  6180. },
  6181. mathmlBuilder(group, options) {
  6182. var arrowNode = stretchyMathML(group.label);
  6183. arrowNode.setAttribute("minsize", group.label.charAt(0) === "x" ? "1.75em" : "3.0em");
  6184. var node;
  6185. if (group.body) {
  6186. var upperNode = paddedNode(buildGroup2(group.body, options));
  6187. if (group.below) {
  6188. var lowerNode = paddedNode(buildGroup2(group.below, options));
  6189. node = new MathNode("munderover", [arrowNode, lowerNode, upperNode]);
  6190. } else {
  6191. node = new MathNode("mover", [arrowNode, upperNode]);
  6192. }
  6193. } else if (group.below) {
  6194. var _lowerNode = paddedNode(buildGroup2(group.below, options));
  6195. node = new MathNode("munder", [arrowNode, _lowerNode]);
  6196. } else {
  6197. node = paddedNode();
  6198. node = new MathNode("mover", [arrowNode, node]);
  6199. }
  6200. return node;
  6201. }
  6202. });
  6203. function htmlBuilder$9(group, options) {
  6204. var elements = buildExpression$1(group.body, options, true);
  6205. return makeSpan([group.mclass], elements, options);
  6206. }
  6207. function mathmlBuilder$8(group, options) {
  6208. var node;
  6209. var inner2 = buildExpression2(group.body, options);
  6210. if (group.mclass === "minner") {
  6211. node = new MathNode("mpadded", inner2);
  6212. } else if (group.mclass === "mord") {
  6213. if (group.isCharacterBox) {
  6214. node = inner2[0];
  6215. node.type = "mi";
  6216. } else {
  6217. node = new MathNode("mi", inner2);
  6218. }
  6219. } else {
  6220. if (group.isCharacterBox) {
  6221. node = inner2[0];
  6222. node.type = "mo";
  6223. } else {
  6224. node = new MathNode("mo", inner2);
  6225. }
  6226. if (group.mclass === "mbin") {
  6227. node.attributes.lspace = "0.22em";
  6228. node.attributes.rspace = "0.22em";
  6229. } else if (group.mclass === "mpunct") {
  6230. node.attributes.lspace = "0em";
  6231. node.attributes.rspace = "0.17em";
  6232. } else if (group.mclass === "mopen" || group.mclass === "mclose") {
  6233. node.attributes.lspace = "0em";
  6234. node.attributes.rspace = "0em";
  6235. } else if (group.mclass === "minner") {
  6236. node.attributes.lspace = "0.0556em";
  6237. node.attributes.width = "+0.1111em";
  6238. }
  6239. }
  6240. return node;
  6241. }
  6242. defineFunction({
  6243. type: "mclass",
  6244. names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"],
  6245. props: {
  6246. numArgs: 1,
  6247. primitive: true
  6248. },
  6249. handler(_ref, args) {
  6250. var {
  6251. parser,
  6252. funcName
  6253. } = _ref;
  6254. var body = args[0];
  6255. return {
  6256. type: "mclass",
  6257. mode: parser.mode,
  6258. mclass: "m" + funcName.slice(5),
  6259. // TODO(kevinb): don't prefix with 'm'
  6260. body: ordargument(body),
  6261. isCharacterBox: isCharacterBox(body)
  6262. };
  6263. },
  6264. htmlBuilder: htmlBuilder$9,
  6265. mathmlBuilder: mathmlBuilder$8
  6266. });
  6267. var binrelClass = (arg) => {
  6268. var atom = arg.type === "ordgroup" && arg.body.length ? arg.body[0] : arg;
  6269. if (atom.type === "atom" && (atom.family === "bin" || atom.family === "rel")) {
  6270. return "m" + atom.family;
  6271. } else {
  6272. return "mord";
  6273. }
  6274. };
  6275. defineFunction({
  6276. type: "mclass",
  6277. names: ["\\@binrel"],
  6278. props: {
  6279. numArgs: 2
  6280. },
  6281. handler(_ref2, args) {
  6282. var {
  6283. parser
  6284. } = _ref2;
  6285. return {
  6286. type: "mclass",
  6287. mode: parser.mode,
  6288. mclass: binrelClass(args[0]),
  6289. body: ordargument(args[1]),
  6290. isCharacterBox: isCharacterBox(args[1])
  6291. };
  6292. }
  6293. });
  6294. defineFunction({
  6295. type: "mclass",
  6296. names: ["\\stackrel", "\\overset", "\\underset"],
  6297. props: {
  6298. numArgs: 2
  6299. },
  6300. handler(_ref3, args) {
  6301. var {
  6302. parser,
  6303. funcName
  6304. } = _ref3;
  6305. var baseArg = args[1];
  6306. var shiftedArg = args[0];
  6307. var mclass;
  6308. if (funcName !== "\\stackrel") {
  6309. mclass = binrelClass(baseArg);
  6310. } else {
  6311. mclass = "mrel";
  6312. }
  6313. var baseOp = {
  6314. type: "op",
  6315. mode: baseArg.mode,
  6316. limits: true,
  6317. alwaysHandleSupSub: true,
  6318. parentIsSupSub: false,
  6319. symbol: false,
  6320. suppressBaseShift: funcName !== "\\stackrel",
  6321. body: ordargument(baseArg)
  6322. };
  6323. var supsub = {
  6324. type: "supsub",
  6325. mode: shiftedArg.mode,
  6326. base: baseOp,
  6327. sup: funcName === "\\underset" ? null : shiftedArg,
  6328. sub: funcName === "\\underset" ? shiftedArg : null
  6329. };
  6330. return {
  6331. type: "mclass",
  6332. mode: parser.mode,
  6333. mclass,
  6334. body: [supsub],
  6335. isCharacterBox: isCharacterBox(supsub)
  6336. };
  6337. },
  6338. htmlBuilder: htmlBuilder$9,
  6339. mathmlBuilder: mathmlBuilder$8
  6340. });
  6341. defineFunction({
  6342. type: "pmb",
  6343. names: ["\\pmb"],
  6344. props: {
  6345. numArgs: 1,
  6346. allowedInText: true
  6347. },
  6348. handler(_ref, args) {
  6349. var {
  6350. parser
  6351. } = _ref;
  6352. return {
  6353. type: "pmb",
  6354. mode: parser.mode,
  6355. mclass: binrelClass(args[0]),
  6356. body: ordargument(args[0])
  6357. };
  6358. },
  6359. htmlBuilder(group, options) {
  6360. var elements = buildExpression$1(group.body, options, true);
  6361. var node = makeSpan([group.mclass], elements, options);
  6362. node.style.textShadow = "0.02em 0.01em 0.04px";
  6363. return node;
  6364. },
  6365. mathmlBuilder(group, style) {
  6366. var inner2 = buildExpression2(group.body, style);
  6367. var node = new MathNode("mstyle", inner2);
  6368. node.setAttribute("style", "text-shadow: 0.02em 0.01em 0.04px");
  6369. return node;
  6370. }
  6371. });
  6372. var cdArrowFunctionName = {
  6373. ">": "\\\\cdrightarrow",
  6374. "<": "\\\\cdleftarrow",
  6375. "=": "\\\\cdlongequal",
  6376. "A": "\\uparrow",
  6377. "V": "\\downarrow",
  6378. "|": "\\Vert",
  6379. ".": "no arrow"
  6380. };
  6381. var newCell = () => {
  6382. return {
  6383. type: "styling",
  6384. body: [],
  6385. mode: "math",
  6386. style: "display"
  6387. };
  6388. };
  6389. var isStartOfArrow = (node) => {
  6390. return node.type === "textord" && node.text === "@";
  6391. };
  6392. var isLabelEnd = (node, endChar) => {
  6393. return (node.type === "mathord" || node.type === "atom") && node.text === endChar;
  6394. };
  6395. function cdArrow(arrowChar, labels, parser) {
  6396. var funcName = cdArrowFunctionName[arrowChar];
  6397. switch (funcName) {
  6398. case "\\\\cdrightarrow":
  6399. case "\\\\cdleftarrow":
  6400. return parser.callFunction(funcName, [labels[0]], [labels[1]]);
  6401. case "\\uparrow":
  6402. case "\\downarrow": {
  6403. var leftLabel = parser.callFunction("\\\\cdleft", [labels[0]], []);
  6404. var bareArrow = {
  6405. type: "atom",
  6406. text: funcName,
  6407. mode: "math",
  6408. family: "rel"
  6409. };
  6410. var sizedArrow = parser.callFunction("\\Big", [bareArrow], []);
  6411. var rightLabel = parser.callFunction("\\\\cdright", [labels[1]], []);
  6412. var arrowGroup = {
  6413. type: "ordgroup",
  6414. mode: "math",
  6415. body: [leftLabel, sizedArrow, rightLabel]
  6416. };
  6417. return parser.callFunction("\\\\cdparent", [arrowGroup], []);
  6418. }
  6419. case "\\\\cdlongequal":
  6420. return parser.callFunction("\\\\cdlongequal", [], []);
  6421. case "\\Vert": {
  6422. var arrow = {
  6423. type: "textord",
  6424. text: "\\Vert",
  6425. mode: "math"
  6426. };
  6427. return parser.callFunction("\\Big", [arrow], []);
  6428. }
  6429. default:
  6430. return {
  6431. type: "textord",
  6432. text: " ",
  6433. mode: "math"
  6434. };
  6435. }
  6436. }
  6437. function parseCD(parser) {
  6438. var parsedRows = [];
  6439. parser.gullet.beginGroup();
  6440. parser.gullet.macros.set("\\cr", "\\\\\\relax");
  6441. parser.gullet.beginGroup();
  6442. while (true) {
  6443. parsedRows.push(parser.parseExpression(false, "\\\\"));
  6444. parser.gullet.endGroup();
  6445. parser.gullet.beginGroup();
  6446. var next = parser.fetch().text;
  6447. if (next === "&" || next === "\\\\") {
  6448. parser.consume();
  6449. } else if (next === "\\end") {
  6450. if (parsedRows[parsedRows.length - 1].length === 0) {
  6451. parsedRows.pop();
  6452. }
  6453. break;
  6454. } else {
  6455. throw new ParseError("Expected \\\\ or \\cr or \\end", parser.nextToken);
  6456. }
  6457. }
  6458. var row = [];
  6459. var body = [row];
  6460. for (var i = 0; i < parsedRows.length; i++) {
  6461. var rowNodes = parsedRows[i];
  6462. var cell = newCell();
  6463. for (var j = 0; j < rowNodes.length; j++) {
  6464. if (!isStartOfArrow(rowNodes[j])) {
  6465. cell.body.push(rowNodes[j]);
  6466. } else {
  6467. row.push(cell);
  6468. j += 1;
  6469. var arrowChar = assertSymbolNodeType(rowNodes[j]).text;
  6470. var labels = new Array(2);
  6471. labels[0] = {
  6472. type: "ordgroup",
  6473. mode: "math",
  6474. body: []
  6475. };
  6476. labels[1] = {
  6477. type: "ordgroup",
  6478. mode: "math",
  6479. body: []
  6480. };
  6481. if ("=|.".includes(arrowChar)) ;
  6482. else if ("<>AV".includes(arrowChar)) {
  6483. for (var labelNum = 0; labelNum < 2; labelNum++) {
  6484. var inLabel = true;
  6485. for (var k = j + 1; k < rowNodes.length; k++) {
  6486. if (isLabelEnd(rowNodes[k], arrowChar)) {
  6487. inLabel = false;
  6488. j = k;
  6489. break;
  6490. }
  6491. if (isStartOfArrow(rowNodes[k])) {
  6492. throw new ParseError("Missing a " + arrowChar + " character to complete a CD arrow.", rowNodes[k]);
  6493. }
  6494. labels[labelNum].body.push(rowNodes[k]);
  6495. }
  6496. if (inLabel) {
  6497. throw new ParseError("Missing a " + arrowChar + " character to complete a CD arrow.", rowNodes[j]);
  6498. }
  6499. }
  6500. } else {
  6501. throw new ParseError('Expected one of "<>AV=|." after @', rowNodes[j]);
  6502. }
  6503. var arrow = cdArrow(arrowChar, labels, parser);
  6504. var wrappedArrow = {
  6505. type: "styling",
  6506. body: [arrow],
  6507. mode: "math",
  6508. style: "display"
  6509. // CD is always displaystyle.
  6510. };
  6511. row.push(wrappedArrow);
  6512. cell = newCell();
  6513. }
  6514. }
  6515. if (i % 2 === 0) {
  6516. row.push(cell);
  6517. } else {
  6518. row.shift();
  6519. }
  6520. row = [];
  6521. body.push(row);
  6522. }
  6523. parser.gullet.endGroup();
  6524. parser.gullet.endGroup();
  6525. var cols = new Array(body[0].length).fill({
  6526. type: "align",
  6527. align: "c",
  6528. pregap: 0.25,
  6529. // CD package sets \enskip between columns.
  6530. postgap: 0.25
  6531. // So pre and post each get half an \enskip, i.e. 0.25em.
  6532. });
  6533. return {
  6534. type: "array",
  6535. mode: "math",
  6536. body,
  6537. arraystretch: 1,
  6538. addJot: true,
  6539. rowGaps: [null],
  6540. cols,
  6541. colSeparationType: "CD",
  6542. hLinesBeforeRow: new Array(body.length + 1).fill([])
  6543. };
  6544. }
  6545. defineFunction({
  6546. type: "cdlabel",
  6547. names: ["\\\\cdleft", "\\\\cdright"],
  6548. props: {
  6549. numArgs: 1
  6550. },
  6551. handler(_ref, args) {
  6552. var {
  6553. parser,
  6554. funcName
  6555. } = _ref;
  6556. return {
  6557. type: "cdlabel",
  6558. mode: parser.mode,
  6559. side: funcName.slice(4),
  6560. label: args[0]
  6561. };
  6562. },
  6563. htmlBuilder(group, options) {
  6564. var newOptions = options.havingStyle(options.style.sup());
  6565. var label = wrapFragment(buildGroup$1(group.label, newOptions, options), options);
  6566. label.classes.push("cd-label-" + group.side);
  6567. label.style.bottom = makeEm(0.8 - label.depth);
  6568. label.height = 0;
  6569. label.depth = 0;
  6570. return label;
  6571. },
  6572. mathmlBuilder(group, options) {
  6573. var label = new MathNode("mrow", [buildGroup2(group.label, options)]);
  6574. label = new MathNode("mpadded", [label]);
  6575. label.setAttribute("width", "0");
  6576. if (group.side === "left") {
  6577. label.setAttribute("lspace", "-1width");
  6578. }
  6579. label.setAttribute("voffset", "0.7em");
  6580. label = new MathNode("mstyle", [label]);
  6581. label.setAttribute("displaystyle", "false");
  6582. label.setAttribute("scriptlevel", "1");
  6583. return label;
  6584. }
  6585. });
  6586. defineFunction({
  6587. type: "cdlabelparent",
  6588. names: ["\\\\cdparent"],
  6589. props: {
  6590. numArgs: 1
  6591. },
  6592. handler(_ref2, args) {
  6593. var {
  6594. parser
  6595. } = _ref2;
  6596. return {
  6597. type: "cdlabelparent",
  6598. mode: parser.mode,
  6599. fragment: args[0]
  6600. };
  6601. },
  6602. htmlBuilder(group, options) {
  6603. var parent = wrapFragment(buildGroup$1(group.fragment, options), options);
  6604. parent.classes.push("cd-vert-arrow");
  6605. return parent;
  6606. },
  6607. mathmlBuilder(group, options) {
  6608. return new MathNode("mrow", [buildGroup2(group.fragment, options)]);
  6609. }
  6610. });
  6611. defineFunction({
  6612. type: "textord",
  6613. names: ["\\@char"],
  6614. props: {
  6615. numArgs: 1,
  6616. allowedInText: true
  6617. },
  6618. handler(_ref, args) {
  6619. var {
  6620. parser
  6621. } = _ref;
  6622. var arg = assertNodeType(args[0], "ordgroup");
  6623. var group = arg.body;
  6624. var number = "";
  6625. for (var i = 0; i < group.length; i++) {
  6626. var node = assertNodeType(group[i], "textord");
  6627. number += node.text;
  6628. }
  6629. var code = parseInt(number);
  6630. var text2;
  6631. if (isNaN(code)) {
  6632. throw new ParseError("\\@char has non-numeric argument " + number);
  6633. } else if (code < 0 || code >= 1114111) {
  6634. throw new ParseError("\\@char with invalid code point " + number);
  6635. } else if (code <= 65535) {
  6636. text2 = String.fromCharCode(code);
  6637. } else {
  6638. code -= 65536;
  6639. text2 = String.fromCharCode((code >> 10) + 55296, (code & 1023) + 56320);
  6640. }
  6641. return {
  6642. type: "textord",
  6643. mode: parser.mode,
  6644. text: text2
  6645. };
  6646. }
  6647. });
  6648. var htmlBuilder$8 = (group, options) => {
  6649. var elements = buildExpression$1(group.body, options.withColor(group.color), false);
  6650. return makeFragment(elements);
  6651. };
  6652. var mathmlBuilder$7 = (group, options) => {
  6653. var inner2 = buildExpression2(group.body, options.withColor(group.color));
  6654. var node = new MathNode("mstyle", inner2);
  6655. node.setAttribute("mathcolor", group.color);
  6656. return node;
  6657. };
  6658. defineFunction({
  6659. type: "color",
  6660. names: ["\\textcolor"],
  6661. props: {
  6662. numArgs: 2,
  6663. allowedInText: true,
  6664. argTypes: ["color", "original"]
  6665. },
  6666. handler(_ref, args) {
  6667. var {
  6668. parser
  6669. } = _ref;
  6670. var color = assertNodeType(args[0], "color-token").color;
  6671. var body = args[1];
  6672. return {
  6673. type: "color",
  6674. mode: parser.mode,
  6675. color,
  6676. body: ordargument(body)
  6677. };
  6678. },
  6679. htmlBuilder: htmlBuilder$8,
  6680. mathmlBuilder: mathmlBuilder$7
  6681. });
  6682. defineFunction({
  6683. type: "color",
  6684. names: ["\\color"],
  6685. props: {
  6686. numArgs: 1,
  6687. allowedInText: true,
  6688. argTypes: ["color"]
  6689. },
  6690. handler(_ref2, args) {
  6691. var {
  6692. parser,
  6693. breakOnTokenText
  6694. } = _ref2;
  6695. var color = assertNodeType(args[0], "color-token").color;
  6696. parser.gullet.macros.set("\\current@color", color);
  6697. var body = parser.parseExpression(true, breakOnTokenText);
  6698. return {
  6699. type: "color",
  6700. mode: parser.mode,
  6701. color,
  6702. body
  6703. };
  6704. },
  6705. htmlBuilder: htmlBuilder$8,
  6706. mathmlBuilder: mathmlBuilder$7
  6707. });
  6708. defineFunction({
  6709. type: "cr",
  6710. names: ["\\\\"],
  6711. props: {
  6712. numArgs: 0,
  6713. numOptionalArgs: 0,
  6714. allowedInText: true
  6715. },
  6716. handler(_ref, args, optArgs) {
  6717. var {
  6718. parser
  6719. } = _ref;
  6720. var size = parser.gullet.future().text === "[" ? parser.parseSizeGroup(true) : null;
  6721. var newLine = !parser.settings.displayMode || !parser.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline does nothing in display mode");
  6722. return {
  6723. type: "cr",
  6724. mode: parser.mode,
  6725. newLine,
  6726. size: size && assertNodeType(size, "size").value
  6727. };
  6728. },
  6729. // The following builders are called only at the top level,
  6730. // not within tabular/array environments.
  6731. htmlBuilder(group, options) {
  6732. var span = makeSpan(["mspace"], [], options);
  6733. if (group.newLine) {
  6734. span.classes.push("newline");
  6735. if (group.size) {
  6736. span.style.marginTop = makeEm(calculateSize(group.size, options));
  6737. }
  6738. }
  6739. return span;
  6740. },
  6741. mathmlBuilder(group, options) {
  6742. var node = new MathNode("mspace");
  6743. if (group.newLine) {
  6744. node.setAttribute("linebreak", "newline");
  6745. if (group.size) {
  6746. node.setAttribute("height", makeEm(calculateSize(group.size, options)));
  6747. }
  6748. }
  6749. return node;
  6750. }
  6751. });
  6752. var globalMap = {
  6753. "\\global": "\\global",
  6754. "\\long": "\\\\globallong",
  6755. "\\\\globallong": "\\\\globallong",
  6756. "\\def": "\\gdef",
  6757. "\\gdef": "\\gdef",
  6758. "\\edef": "\\xdef",
  6759. "\\xdef": "\\xdef",
  6760. "\\let": "\\\\globallet",
  6761. "\\futurelet": "\\\\globalfuture"
  6762. };
  6763. var checkControlSequence = (tok) => {
  6764. var name = tok.text;
  6765. if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) {
  6766. throw new ParseError("Expected a control sequence", tok);
  6767. }
  6768. return name;
  6769. };
  6770. var getRHS = (parser) => {
  6771. var tok = parser.gullet.popToken();
  6772. if (tok.text === "=") {
  6773. tok = parser.gullet.popToken();
  6774. if (tok.text === " ") {
  6775. tok = parser.gullet.popToken();
  6776. }
  6777. }
  6778. return tok;
  6779. };
  6780. var letCommand = (parser, name, tok, global) => {
  6781. var macro = parser.gullet.macros.get(tok.text);
  6782. if (macro == null) {
  6783. tok.noexpand = true;
  6784. macro = {
  6785. tokens: [tok],
  6786. numArgs: 0,
  6787. // reproduce the same behavior in expansion
  6788. unexpandable: !parser.gullet.isExpandable(tok.text)
  6789. };
  6790. }
  6791. parser.gullet.macros.set(name, macro, global);
  6792. };
  6793. defineFunction({
  6794. type: "internal",
  6795. names: [
  6796. "\\global",
  6797. "\\long",
  6798. "\\\\globallong"
  6799. // can’t be entered directly
  6800. ],
  6801. props: {
  6802. numArgs: 0,
  6803. allowedInText: true
  6804. },
  6805. handler(_ref) {
  6806. var {
  6807. parser,
  6808. funcName
  6809. } = _ref;
  6810. parser.consumeSpaces();
  6811. var token = parser.fetch();
  6812. if (globalMap[token.text]) {
  6813. if (funcName === "\\global" || funcName === "\\\\globallong") {
  6814. token.text = globalMap[token.text];
  6815. }
  6816. return assertNodeType(parser.parseFunction(), "internal");
  6817. }
  6818. throw new ParseError("Invalid token after macro prefix", token);
  6819. }
  6820. });
  6821. defineFunction({
  6822. type: "internal",
  6823. names: ["\\def", "\\gdef", "\\edef", "\\xdef"],
  6824. props: {
  6825. numArgs: 0,
  6826. allowedInText: true,
  6827. primitive: true
  6828. },
  6829. handler(_ref2) {
  6830. var {
  6831. parser,
  6832. funcName
  6833. } = _ref2;
  6834. var tok = parser.gullet.popToken();
  6835. var name = tok.text;
  6836. if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) {
  6837. throw new ParseError("Expected a control sequence", tok);
  6838. }
  6839. var numArgs = 0;
  6840. var insert;
  6841. var delimiters2 = [[]];
  6842. while (parser.gullet.future().text !== "{") {
  6843. tok = parser.gullet.popToken();
  6844. if (tok.text === "#") {
  6845. if (parser.gullet.future().text === "{") {
  6846. insert = parser.gullet.future();
  6847. delimiters2[numArgs].push("{");
  6848. break;
  6849. }
  6850. tok = parser.gullet.popToken();
  6851. if (!/^[1-9]$/.test(tok.text)) {
  6852. throw new ParseError('Invalid argument number "' + tok.text + '"');
  6853. }
  6854. if (parseInt(tok.text) !== numArgs + 1) {
  6855. throw new ParseError('Argument number "' + tok.text + '" out of order');
  6856. }
  6857. numArgs++;
  6858. delimiters2.push([]);
  6859. } else if (tok.text === "EOF") {
  6860. throw new ParseError("Expected a macro definition");
  6861. } else {
  6862. delimiters2[numArgs].push(tok.text);
  6863. }
  6864. }
  6865. var {
  6866. tokens
  6867. } = parser.gullet.consumeArg();
  6868. if (insert) {
  6869. tokens.unshift(insert);
  6870. }
  6871. if (funcName === "\\edef" || funcName === "\\xdef") {
  6872. tokens = parser.gullet.expandTokens(tokens);
  6873. tokens.reverse();
  6874. }
  6875. parser.gullet.macros.set(name, {
  6876. tokens,
  6877. numArgs,
  6878. delimiters: delimiters2
  6879. }, funcName === globalMap[funcName]);
  6880. return {
  6881. type: "internal",
  6882. mode: parser.mode
  6883. };
  6884. }
  6885. });
  6886. defineFunction({
  6887. type: "internal",
  6888. names: [
  6889. "\\let",
  6890. "\\\\globallet"
  6891. // can’t be entered directly
  6892. ],
  6893. props: {
  6894. numArgs: 0,
  6895. allowedInText: true,
  6896. primitive: true
  6897. },
  6898. handler(_ref3) {
  6899. var {
  6900. parser,
  6901. funcName
  6902. } = _ref3;
  6903. var name = checkControlSequence(parser.gullet.popToken());
  6904. parser.gullet.consumeSpaces();
  6905. var tok = getRHS(parser);
  6906. letCommand(parser, name, tok, funcName === "\\\\globallet");
  6907. return {
  6908. type: "internal",
  6909. mode: parser.mode
  6910. };
  6911. }
  6912. });
  6913. defineFunction({
  6914. type: "internal",
  6915. names: [
  6916. "\\futurelet",
  6917. "\\\\globalfuture"
  6918. // can’t be entered directly
  6919. ],
  6920. props: {
  6921. numArgs: 0,
  6922. allowedInText: true,
  6923. primitive: true
  6924. },
  6925. handler(_ref4) {
  6926. var {
  6927. parser,
  6928. funcName
  6929. } = _ref4;
  6930. var name = checkControlSequence(parser.gullet.popToken());
  6931. var middle = parser.gullet.popToken();
  6932. var tok = parser.gullet.popToken();
  6933. letCommand(parser, name, tok, funcName === "\\\\globalfuture");
  6934. parser.gullet.pushToken(tok);
  6935. parser.gullet.pushToken(middle);
  6936. return {
  6937. type: "internal",
  6938. mode: parser.mode
  6939. };
  6940. }
  6941. });
  6942. var getMetrics = function getMetrics2(symbol, font, mode) {
  6943. var replace = symbols.math[symbol] && symbols.math[symbol].replace;
  6944. var metrics = getCharacterMetrics(replace || symbol, font, mode);
  6945. if (!metrics) {
  6946. throw new Error("Unsupported symbol " + symbol + " and font size " + font + ".");
  6947. }
  6948. return metrics;
  6949. };
  6950. var styleWrap = function styleWrap2(delim, toStyle, options, classes) {
  6951. var newOptions = options.havingBaseStyle(toStyle);
  6952. var span = makeSpan(classes.concat(newOptions.sizingClasses(options)), [delim], options);
  6953. var delimSizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier;
  6954. span.height *= delimSizeMultiplier;
  6955. span.depth *= delimSizeMultiplier;
  6956. span.maxFontSize = newOptions.sizeMultiplier;
  6957. return span;
  6958. };
  6959. var centerSpan = function centerSpan2(span, options, style) {
  6960. var newOptions = options.havingBaseStyle(style);
  6961. var shift = (1 - options.sizeMultiplier / newOptions.sizeMultiplier) * options.fontMetrics().axisHeight;
  6962. span.classes.push("delimcenter");
  6963. span.style.top = makeEm(shift);
  6964. span.height -= shift;
  6965. span.depth += shift;
  6966. };
  6967. var makeSmallDelim = function makeSmallDelim2(delim, style, center, options, mode, classes) {
  6968. var text2 = makeSymbol(delim, "Main-Regular", mode, options);
  6969. var span = styleWrap(text2, style, options, classes);
  6970. if (center) {
  6971. centerSpan(span, options, style);
  6972. }
  6973. return span;
  6974. };
  6975. var mathrmSize = function mathrmSize2(value, size, mode, options) {
  6976. return makeSymbol(value, "Size" + size + "-Regular", mode, options);
  6977. };
  6978. var makeLargeDelim = function makeLargeDelim2(delim, size, center, options, mode, classes) {
  6979. var inner2 = mathrmSize(delim, size, mode, options);
  6980. var span = styleWrap(makeSpan(["delimsizing", "size" + size], [inner2], options), Style$1.TEXT, options, classes);
  6981. if (center) {
  6982. centerSpan(span, options, Style$1.TEXT);
  6983. }
  6984. return span;
  6985. };
  6986. var makeGlyphSpan = function makeGlyphSpan2(symbol, font, mode) {
  6987. var sizeClass;
  6988. if (font === "Size1-Regular") {
  6989. sizeClass = "delim-size1";
  6990. } else {
  6991. sizeClass = "delim-size4";
  6992. }
  6993. var corner = makeSpan(["delimsizinginner", sizeClass], [makeSpan([], [makeSymbol(symbol, font, mode)])]);
  6994. return {
  6995. type: "elem",
  6996. elem: corner
  6997. };
  6998. };
  6999. var makeInner = function makeInner2(ch, height, options) {
  7000. var width = fontMetricsData["Size4-Regular"][ch.charCodeAt(0)] ? fontMetricsData["Size4-Regular"][ch.charCodeAt(0)][4] : fontMetricsData["Size1-Regular"][ch.charCodeAt(0)][4];
  7001. var path2 = new PathNode("inner", innerPath(ch, Math.round(1e3 * height)));
  7002. var svgNode = new SvgNode([path2], {
  7003. "width": makeEm(width),
  7004. "height": makeEm(height),
  7005. // Override CSS rule `.katex svg { width: 100% }`
  7006. "style": "width:" + makeEm(width),
  7007. "viewBox": "0 0 " + 1e3 * width + " " + Math.round(1e3 * height),
  7008. "preserveAspectRatio": "xMinYMin"
  7009. });
  7010. var span = makeSvgSpan([], [svgNode], options);
  7011. span.height = height;
  7012. span.style.height = makeEm(height);
  7013. span.style.width = makeEm(width);
  7014. return {
  7015. type: "elem",
  7016. elem: span
  7017. };
  7018. };
  7019. var lapInEms = 8e-3;
  7020. var lap = {
  7021. type: "kern",
  7022. size: -1 * lapInEms
  7023. };
  7024. var verts = /* @__PURE__ */ new Set(["|", "\\lvert", "\\rvert", "\\vert"]);
  7025. var doubleVerts = /* @__PURE__ */ new Set(["\\|", "\\lVert", "\\rVert", "\\Vert"]);
  7026. var makeStackedDelim = function makeStackedDelim2(delim, heightTotal, center, options, mode, classes) {
  7027. var top;
  7028. var middle;
  7029. var repeat;
  7030. var bottom;
  7031. var svgLabel = "";
  7032. var viewBoxWidth = 0;
  7033. top = repeat = bottom = delim;
  7034. middle = null;
  7035. var font = "Size1-Regular";
  7036. if (delim === "\\uparrow") {
  7037. repeat = bottom = "⏐";
  7038. } else if (delim === "\\Uparrow") {
  7039. repeat = bottom = "‖";
  7040. } else if (delim === "\\downarrow") {
  7041. top = repeat = "⏐";
  7042. } else if (delim === "\\Downarrow") {
  7043. top = repeat = "‖";
  7044. } else if (delim === "\\updownarrow") {
  7045. top = "\\uparrow";
  7046. repeat = "⏐";
  7047. bottom = "\\downarrow";
  7048. } else if (delim === "\\Updownarrow") {
  7049. top = "\\Uparrow";
  7050. repeat = "‖";
  7051. bottom = "\\Downarrow";
  7052. } else if (verts.has(delim)) {
  7053. repeat = "∣";
  7054. svgLabel = "vert";
  7055. viewBoxWidth = 333;
  7056. } else if (doubleVerts.has(delim)) {
  7057. repeat = "∥";
  7058. svgLabel = "doublevert";
  7059. viewBoxWidth = 556;
  7060. } else if (delim === "[" || delim === "\\lbrack") {
  7061. top = "⎡";
  7062. repeat = "⎢";
  7063. bottom = "⎣";
  7064. font = "Size4-Regular";
  7065. svgLabel = "lbrack";
  7066. viewBoxWidth = 667;
  7067. } else if (delim === "]" || delim === "\\rbrack") {
  7068. top = "⎤";
  7069. repeat = "⎥";
  7070. bottom = "⎦";
  7071. font = "Size4-Regular";
  7072. svgLabel = "rbrack";
  7073. viewBoxWidth = 667;
  7074. } else if (delim === "\\lfloor" || delim === "⌊") {
  7075. repeat = top = "⎢";
  7076. bottom = "⎣";
  7077. font = "Size4-Regular";
  7078. svgLabel = "lfloor";
  7079. viewBoxWidth = 667;
  7080. } else if (delim === "\\lceil" || delim === "⌈") {
  7081. top = "⎡";
  7082. repeat = bottom = "⎢";
  7083. font = "Size4-Regular";
  7084. svgLabel = "lceil";
  7085. viewBoxWidth = 667;
  7086. } else if (delim === "\\rfloor" || delim === "⌋") {
  7087. repeat = top = "⎥";
  7088. bottom = "⎦";
  7089. font = "Size4-Regular";
  7090. svgLabel = "rfloor";
  7091. viewBoxWidth = 667;
  7092. } else if (delim === "\\rceil" || delim === "⌉") {
  7093. top = "⎤";
  7094. repeat = bottom = "⎥";
  7095. font = "Size4-Regular";
  7096. svgLabel = "rceil";
  7097. viewBoxWidth = 667;
  7098. } else if (delim === "(" || delim === "\\lparen") {
  7099. top = "⎛";
  7100. repeat = "⎜";
  7101. bottom = "⎝";
  7102. font = "Size4-Regular";
  7103. svgLabel = "lparen";
  7104. viewBoxWidth = 875;
  7105. } else if (delim === ")" || delim === "\\rparen") {
  7106. top = "⎞";
  7107. repeat = "⎟";
  7108. bottom = "⎠";
  7109. font = "Size4-Regular";
  7110. svgLabel = "rparen";
  7111. viewBoxWidth = 875;
  7112. } else if (delim === "\\{" || delim === "\\lbrace") {
  7113. top = "⎧";
  7114. middle = "⎨";
  7115. bottom = "⎩";
  7116. repeat = "⎪";
  7117. font = "Size4-Regular";
  7118. } else if (delim === "\\}" || delim === "\\rbrace") {
  7119. top = "⎫";
  7120. middle = "⎬";
  7121. bottom = "⎭";
  7122. repeat = "⎪";
  7123. font = "Size4-Regular";
  7124. } else if (delim === "\\lgroup" || delim === "⟮") {
  7125. top = "⎧";
  7126. bottom = "⎩";
  7127. repeat = "⎪";
  7128. font = "Size4-Regular";
  7129. } else if (delim === "\\rgroup" || delim === "⟯") {
  7130. top = "⎫";
  7131. bottom = "⎭";
  7132. repeat = "⎪";
  7133. font = "Size4-Regular";
  7134. } else if (delim === "\\lmoustache" || delim === "⎰") {
  7135. top = "⎧";
  7136. bottom = "⎭";
  7137. repeat = "⎪";
  7138. font = "Size4-Regular";
  7139. } else if (delim === "\\rmoustache" || delim === "⎱") {
  7140. top = "⎫";
  7141. bottom = "⎩";
  7142. repeat = "⎪";
  7143. font = "Size4-Regular";
  7144. }
  7145. var topMetrics = getMetrics(top, font, mode);
  7146. var topHeightTotal = topMetrics.height + topMetrics.depth;
  7147. var repeatMetrics = getMetrics(repeat, font, mode);
  7148. var repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth;
  7149. var bottomMetrics = getMetrics(bottom, font, mode);
  7150. var bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth;
  7151. var middleHeightTotal = 0;
  7152. var middleFactor = 1;
  7153. if (middle !== null) {
  7154. var middleMetrics = getMetrics(middle, font, mode);
  7155. middleHeightTotal = middleMetrics.height + middleMetrics.depth;
  7156. middleFactor = 2;
  7157. }
  7158. var minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal;
  7159. var repeatCount = Math.max(0, Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal)));
  7160. var realHeightTotal = minHeight + repeatCount * middleFactor * repeatHeightTotal;
  7161. var axisHeight = options.fontMetrics().axisHeight;
  7162. if (center) {
  7163. axisHeight *= options.sizeMultiplier;
  7164. }
  7165. var depth = realHeightTotal / 2 - axisHeight;
  7166. var stack = [];
  7167. if (svgLabel.length > 0) {
  7168. var midHeight = realHeightTotal - topHeightTotal - bottomHeightTotal;
  7169. var viewBoxHeight = Math.round(realHeightTotal * 1e3);
  7170. var pathStr = tallDelim(svgLabel, Math.round(midHeight * 1e3));
  7171. var path2 = new PathNode(svgLabel, pathStr);
  7172. var width = makeEm(viewBoxWidth / 1e3);
  7173. var height = makeEm(viewBoxHeight / 1e3);
  7174. var svg = new SvgNode([path2], {
  7175. "width": width,
  7176. "height": height,
  7177. "viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight
  7178. });
  7179. var wrapper = makeSvgSpan([], [svg], options);
  7180. wrapper.height = viewBoxHeight / 1e3;
  7181. wrapper.style.width = width;
  7182. wrapper.style.height = height;
  7183. stack.push({
  7184. type: "elem",
  7185. elem: wrapper
  7186. });
  7187. } else {
  7188. stack.push(makeGlyphSpan(bottom, font, mode));
  7189. stack.push(lap);
  7190. if (middle === null) {
  7191. var innerHeight = realHeightTotal - topHeightTotal - bottomHeightTotal + 2 * lapInEms;
  7192. stack.push(makeInner(repeat, innerHeight, options));
  7193. } else {
  7194. var _innerHeight = (realHeightTotal - topHeightTotal - bottomHeightTotal - middleHeightTotal) / 2 + 2 * lapInEms;
  7195. stack.push(makeInner(repeat, _innerHeight, options));
  7196. stack.push(lap);
  7197. stack.push(makeGlyphSpan(middle, font, mode));
  7198. stack.push(lap);
  7199. stack.push(makeInner(repeat, _innerHeight, options));
  7200. }
  7201. stack.push(lap);
  7202. stack.push(makeGlyphSpan(top, font, mode));
  7203. }
  7204. var newOptions = options.havingBaseStyle(Style$1.TEXT);
  7205. var inner2 = makeVList({
  7206. positionType: "bottom",
  7207. positionData: depth,
  7208. children: stack
  7209. });
  7210. return styleWrap(makeSpan(["delimsizing", "mult"], [inner2], newOptions), Style$1.TEXT, options, classes);
  7211. };
  7212. var vbPad = 80;
  7213. var emPad = 0.08;
  7214. var sqrtSvg = function sqrtSvg2(sqrtName, height, viewBoxHeight, extraVinculum, options) {
  7215. var path2 = sqrtPath(sqrtName, extraVinculum, viewBoxHeight);
  7216. var pathNode = new PathNode(sqrtName, path2);
  7217. var svg = new SvgNode([pathNode], {
  7218. // Note: 1000:1 ratio of viewBox to document em width.
  7219. "width": "400em",
  7220. "height": makeEm(height),
  7221. "viewBox": "0 0 400000 " + viewBoxHeight,
  7222. "preserveAspectRatio": "xMinYMin slice"
  7223. });
  7224. return makeSvgSpan(["hide-tail"], [svg], options);
  7225. };
  7226. var makeSqrtImage = function makeSqrtImage2(height, options) {
  7227. var newOptions = options.havingBaseSizing();
  7228. var delim = traverseSequence("\\surd", height * newOptions.sizeMultiplier, stackLargeDelimiterSequence, newOptions);
  7229. var sizeMultiplier = newOptions.sizeMultiplier;
  7230. var extraVinculum = Math.max(0, options.minRuleThickness - options.fontMetrics().sqrtRuleThickness);
  7231. var span;
  7232. var spanHeight = 0;
  7233. var texHeight = 0;
  7234. var viewBoxHeight = 0;
  7235. var advanceWidth;
  7236. if (delim.type === "small") {
  7237. viewBoxHeight = 1e3 + 1e3 * extraVinculum + vbPad;
  7238. if (height < 1) {
  7239. sizeMultiplier = 1;
  7240. } else if (height < 1.4) {
  7241. sizeMultiplier = 0.7;
  7242. }
  7243. spanHeight = (1 + extraVinculum + emPad) / sizeMultiplier;
  7244. texHeight = (1 + extraVinculum) / sizeMultiplier;
  7245. span = sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, extraVinculum, options);
  7246. span.style.minWidth = "0.853em";
  7247. advanceWidth = 0.833 / sizeMultiplier;
  7248. } else if (delim.type === "large") {
  7249. viewBoxHeight = (1e3 + vbPad) * sizeToMaxHeight[delim.size];
  7250. texHeight = (sizeToMaxHeight[delim.size] + extraVinculum) / sizeMultiplier;
  7251. spanHeight = (sizeToMaxHeight[delim.size] + extraVinculum + emPad) / sizeMultiplier;
  7252. span = sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight, extraVinculum, options);
  7253. span.style.minWidth = "1.02em";
  7254. advanceWidth = 1 / sizeMultiplier;
  7255. } else {
  7256. spanHeight = height + extraVinculum + emPad;
  7257. texHeight = height + extraVinculum;
  7258. viewBoxHeight = Math.floor(1e3 * height + extraVinculum) + vbPad;
  7259. span = sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, extraVinculum, options);
  7260. span.style.minWidth = "0.742em";
  7261. advanceWidth = 1.056;
  7262. }
  7263. span.height = texHeight;
  7264. span.style.height = makeEm(spanHeight);
  7265. return {
  7266. span,
  7267. advanceWidth,
  7268. // Calculate the actual line width.
  7269. // This actually should depend on the chosen font -- e.g. \boldmath
  7270. // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and
  7271. // have thicker rules.
  7272. ruleWidth: (options.fontMetrics().sqrtRuleThickness + extraVinculum) * sizeMultiplier
  7273. };
  7274. };
  7275. var stackLargeDelimiters = /* @__PURE__ */ new Set(["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "⌊", "⌋", "\\lceil", "\\rceil", "⌈", "⌉", "\\surd"]);
  7276. var stackAlwaysDelimiters = /* @__PURE__ */ new Set(["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "⟮", "⟯", "\\lmoustache", "\\rmoustache", "⎰", "⎱"]);
  7277. var stackNeverDelimiters = /* @__PURE__ */ new Set(["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"]);
  7278. var sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3];
  7279. var makeSizedDelim = function makeSizedDelim2(delim, size, options, mode, classes) {
  7280. if (delim === "<" || delim === "\\lt" || delim === "⟨") {
  7281. delim = "\\langle";
  7282. } else if (delim === ">" || delim === "\\gt" || delim === "⟩") {
  7283. delim = "\\rangle";
  7284. }
  7285. if (stackLargeDelimiters.has(delim) || stackNeverDelimiters.has(delim)) {
  7286. return makeLargeDelim(delim, size, false, options, mode, classes);
  7287. } else if (stackAlwaysDelimiters.has(delim)) {
  7288. return makeStackedDelim(delim, sizeToMaxHeight[size], false, options, mode, classes);
  7289. } else {
  7290. throw new ParseError("Illegal delimiter: '" + delim + "'");
  7291. }
  7292. };
  7293. var stackNeverDelimiterSequence = [{
  7294. type: "small",
  7295. style: Style$1.SCRIPTSCRIPT
  7296. }, {
  7297. type: "small",
  7298. style: Style$1.SCRIPT
  7299. }, {
  7300. type: "small",
  7301. style: Style$1.TEXT
  7302. }, {
  7303. type: "large",
  7304. size: 1
  7305. }, {
  7306. type: "large",
  7307. size: 2
  7308. }, {
  7309. type: "large",
  7310. size: 3
  7311. }, {
  7312. type: "large",
  7313. size: 4
  7314. }];
  7315. var stackAlwaysDelimiterSequence = [{
  7316. type: "small",
  7317. style: Style$1.SCRIPTSCRIPT
  7318. }, {
  7319. type: "small",
  7320. style: Style$1.SCRIPT
  7321. }, {
  7322. type: "small",
  7323. style: Style$1.TEXT
  7324. }, {
  7325. type: "stack"
  7326. }];
  7327. var stackLargeDelimiterSequence = [{
  7328. type: "small",
  7329. style: Style$1.SCRIPTSCRIPT
  7330. }, {
  7331. type: "small",
  7332. style: Style$1.SCRIPT
  7333. }, {
  7334. type: "small",
  7335. style: Style$1.TEXT
  7336. }, {
  7337. type: "large",
  7338. size: 1
  7339. }, {
  7340. type: "large",
  7341. size: 2
  7342. }, {
  7343. type: "large",
  7344. size: 3
  7345. }, {
  7346. type: "large",
  7347. size: 4
  7348. }, {
  7349. type: "stack"
  7350. }];
  7351. var delimTypeToFont = function delimTypeToFont2(type) {
  7352. if (type.type === "small") {
  7353. return "Main-Regular";
  7354. } else if (type.type === "large") {
  7355. return "Size" + type.size + "-Regular";
  7356. } else if (type.type === "stack") {
  7357. return "Size4-Regular";
  7358. } else {
  7359. var delimKind = type.type;
  7360. throw new Error("Add support for delim type '" + delimKind + "' here.");
  7361. }
  7362. };
  7363. var traverseSequence = function traverseSequence2(delim, height, sequence, options) {
  7364. var start = Math.min(2, 3 - options.style.size);
  7365. for (var i = start; i < sequence.length; i++) {
  7366. var delimType = sequence[i];
  7367. if (delimType.type === "stack") {
  7368. break;
  7369. }
  7370. var metrics = getMetrics(delim, delimTypeToFont(delimType), "math");
  7371. var heightDepth = metrics.height + metrics.depth;
  7372. if (delimType.type === "small") {
  7373. var newOptions = options.havingBaseStyle(delimType.style);
  7374. heightDepth *= newOptions.sizeMultiplier;
  7375. }
  7376. if (heightDepth > height) {
  7377. return delimType;
  7378. }
  7379. }
  7380. return sequence[sequence.length - 1];
  7381. };
  7382. var makeCustomSizedDelim = function makeCustomSizedDelim2(delim, height, center, options, mode, classes) {
  7383. if (delim === "<" || delim === "\\lt" || delim === "⟨") {
  7384. delim = "\\langle";
  7385. } else if (delim === ">" || delim === "\\gt" || delim === "⟩") {
  7386. delim = "\\rangle";
  7387. }
  7388. var sequence;
  7389. if (stackNeverDelimiters.has(delim)) {
  7390. sequence = stackNeverDelimiterSequence;
  7391. } else if (stackLargeDelimiters.has(delim)) {
  7392. sequence = stackLargeDelimiterSequence;
  7393. } else {
  7394. sequence = stackAlwaysDelimiterSequence;
  7395. }
  7396. var delimType = traverseSequence(delim, height, sequence, options);
  7397. if (delimType.type === "small") {
  7398. return makeSmallDelim(delim, delimType.style, center, options, mode, classes);
  7399. } else if (delimType.type === "large") {
  7400. return makeLargeDelim(delim, delimType.size, center, options, mode, classes);
  7401. } else {
  7402. return makeStackedDelim(delim, height, center, options, mode, classes);
  7403. }
  7404. };
  7405. var makeLeftRightDelim = function makeLeftRightDelim2(delim, height, depth, options, mode, classes) {
  7406. var axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier;
  7407. var delimiterFactor = 901;
  7408. var delimiterExtend = 5 / options.fontMetrics().ptPerEm;
  7409. var maxDistFromAxis = Math.max(height - axisHeight, depth + axisHeight);
  7410. var totalHeight = Math.max(
  7411. // In real TeX, calculations are done using integral values which are
  7412. // 65536 per pt, or 655360 per em. So, the division here truncates in
  7413. // TeX but doesn't here, producing different results. If we wanted to
  7414. // exactly match TeX's calculation, we could do
  7415. // Math.floor(655360 * maxDistFromAxis / 500) *
  7416. // delimiterFactor / 655360
  7417. // (To see the difference, compare
  7418. // x^{x^{\left(\rule{0.1em}{0.68em}\right)}}
  7419. // in TeX and KaTeX)
  7420. maxDistFromAxis / 500 * delimiterFactor,
  7421. 2 * maxDistFromAxis - delimiterExtend
  7422. );
  7423. return makeCustomSizedDelim(delim, totalHeight, true, options, mode, classes);
  7424. };
  7425. var delimiterSizes = {
  7426. "\\bigl": {
  7427. mclass: "mopen",
  7428. size: 1
  7429. },
  7430. "\\Bigl": {
  7431. mclass: "mopen",
  7432. size: 2
  7433. },
  7434. "\\biggl": {
  7435. mclass: "mopen",
  7436. size: 3
  7437. },
  7438. "\\Biggl": {
  7439. mclass: "mopen",
  7440. size: 4
  7441. },
  7442. "\\bigr": {
  7443. mclass: "mclose",
  7444. size: 1
  7445. },
  7446. "\\Bigr": {
  7447. mclass: "mclose",
  7448. size: 2
  7449. },
  7450. "\\biggr": {
  7451. mclass: "mclose",
  7452. size: 3
  7453. },
  7454. "\\Biggr": {
  7455. mclass: "mclose",
  7456. size: 4
  7457. },
  7458. "\\bigm": {
  7459. mclass: "mrel",
  7460. size: 1
  7461. },
  7462. "\\Bigm": {
  7463. mclass: "mrel",
  7464. size: 2
  7465. },
  7466. "\\biggm": {
  7467. mclass: "mrel",
  7468. size: 3
  7469. },
  7470. "\\Biggm": {
  7471. mclass: "mrel",
  7472. size: 4
  7473. },
  7474. "\\big": {
  7475. mclass: "mord",
  7476. size: 1
  7477. },
  7478. "\\Big": {
  7479. mclass: "mord",
  7480. size: 2
  7481. },
  7482. "\\bigg": {
  7483. mclass: "mord",
  7484. size: 3
  7485. },
  7486. "\\Bigg": {
  7487. mclass: "mord",
  7488. size: 4
  7489. }
  7490. };
  7491. var delimiters = /* @__PURE__ */ new Set(["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "⌊", "⌋", "\\lceil", "\\rceil", "⌈", "⌉", "<", ">", "\\langle", "⟨", "\\rangle", "⟩", "\\lt", "\\gt", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "⟮", "⟯", "\\lmoustache", "\\rmoustache", "⎰", "⎱", "/", "\\backslash", "|", "\\vert", "\\|", "\\Vert", "\\uparrow", "\\Uparrow", "\\downarrow", "\\Downarrow", "\\updownarrow", "\\Updownarrow", "."]);
  7492. function checkDelimiter(delim, context) {
  7493. var symDelim = checkSymbolNodeType(delim);
  7494. if (symDelim && delimiters.has(symDelim.text)) {
  7495. return symDelim;
  7496. } else if (symDelim) {
  7497. throw new ParseError("Invalid delimiter '" + symDelim.text + "' after '" + context.funcName + "'", delim);
  7498. } else {
  7499. throw new ParseError("Invalid delimiter type '" + delim.type + "'", delim);
  7500. }
  7501. }
  7502. defineFunction({
  7503. type: "delimsizing",
  7504. names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"],
  7505. props: {
  7506. numArgs: 1,
  7507. argTypes: ["primitive"]
  7508. },
  7509. handler: (context, args) => {
  7510. var delim = checkDelimiter(args[0], context);
  7511. return {
  7512. type: "delimsizing",
  7513. mode: context.parser.mode,
  7514. size: delimiterSizes[context.funcName].size,
  7515. mclass: delimiterSizes[context.funcName].mclass,
  7516. delim: delim.text
  7517. };
  7518. },
  7519. htmlBuilder: (group, options) => {
  7520. if (group.delim === ".") {
  7521. return makeSpan([group.mclass]);
  7522. }
  7523. return makeSizedDelim(group.delim, group.size, options, group.mode, [group.mclass]);
  7524. },
  7525. mathmlBuilder: (group) => {
  7526. var children = [];
  7527. if (group.delim !== ".") {
  7528. children.push(makeText(group.delim, group.mode));
  7529. }
  7530. var node = new MathNode("mo", children);
  7531. if (group.mclass === "mopen" || group.mclass === "mclose") {
  7532. node.setAttribute("fence", "true");
  7533. } else {
  7534. node.setAttribute("fence", "false");
  7535. }
  7536. node.setAttribute("stretchy", "true");
  7537. var size = makeEm(sizeToMaxHeight[group.size]);
  7538. node.setAttribute("minsize", size);
  7539. node.setAttribute("maxsize", size);
  7540. return node;
  7541. }
  7542. });
  7543. function assertParsed(group) {
  7544. if (!group.body) {
  7545. throw new Error("Bug: The leftright ParseNode wasn't fully parsed.");
  7546. }
  7547. }
  7548. defineFunction({
  7549. type: "leftright-right",
  7550. names: ["\\right"],
  7551. props: {
  7552. numArgs: 1,
  7553. primitive: true
  7554. },
  7555. handler: (context, args) => {
  7556. var color = context.parser.gullet.macros.get("\\current@color");
  7557. if (color && typeof color !== "string") {
  7558. throw new ParseError("\\current@color set to non-string in \\right");
  7559. }
  7560. return {
  7561. type: "leftright-right",
  7562. mode: context.parser.mode,
  7563. delim: checkDelimiter(args[0], context).text,
  7564. color
  7565. // undefined if not set via \color
  7566. };
  7567. }
  7568. });
  7569. defineFunction({
  7570. type: "leftright",
  7571. names: ["\\left"],
  7572. props: {
  7573. numArgs: 1,
  7574. primitive: true
  7575. },
  7576. handler: (context, args) => {
  7577. var delim = checkDelimiter(args[0], context);
  7578. var parser = context.parser;
  7579. ++parser.leftrightDepth;
  7580. var body = parser.parseExpression(false);
  7581. --parser.leftrightDepth;
  7582. parser.expect("\\right", false);
  7583. var right = assertNodeType(parser.parseFunction(), "leftright-right");
  7584. return {
  7585. type: "leftright",
  7586. mode: parser.mode,
  7587. body,
  7588. left: delim.text,
  7589. right: right.delim,
  7590. rightColor: right.color
  7591. };
  7592. },
  7593. htmlBuilder: (group, options) => {
  7594. assertParsed(group);
  7595. var inner2 = buildExpression$1(group.body, options, true, ["mopen", "mclose"]);
  7596. var innerHeight = 0;
  7597. var innerDepth = 0;
  7598. var hadMiddle = false;
  7599. for (var i = 0; i < inner2.length; i++) {
  7600. if (inner2[i].isMiddle) {
  7601. hadMiddle = true;
  7602. } else {
  7603. innerHeight = Math.max(inner2[i].height, innerHeight);
  7604. innerDepth = Math.max(inner2[i].depth, innerDepth);
  7605. }
  7606. }
  7607. innerHeight *= options.sizeMultiplier;
  7608. innerDepth *= options.sizeMultiplier;
  7609. var leftDelim;
  7610. if (group.left === ".") {
  7611. leftDelim = makeNullDelimiter(options, ["mopen"]);
  7612. } else {
  7613. leftDelim = makeLeftRightDelim(group.left, innerHeight, innerDepth, options, group.mode, ["mopen"]);
  7614. }
  7615. inner2.unshift(leftDelim);
  7616. if (hadMiddle) {
  7617. for (var _i = 1; _i < inner2.length; _i++) {
  7618. var middleDelim = inner2[_i];
  7619. var isMiddle = middleDelim.isMiddle;
  7620. if (isMiddle) {
  7621. inner2[_i] = makeLeftRightDelim(isMiddle.delim, innerHeight, innerDepth, isMiddle.options, group.mode, []);
  7622. }
  7623. }
  7624. }
  7625. var rightDelim;
  7626. if (group.right === ".") {
  7627. rightDelim = makeNullDelimiter(options, ["mclose"]);
  7628. } else {
  7629. var colorOptions = group.rightColor ? options.withColor(group.rightColor) : options;
  7630. rightDelim = makeLeftRightDelim(group.right, innerHeight, innerDepth, colorOptions, group.mode, ["mclose"]);
  7631. }
  7632. inner2.push(rightDelim);
  7633. return makeSpan(["minner"], inner2, options);
  7634. },
  7635. mathmlBuilder: (group, options) => {
  7636. assertParsed(group);
  7637. var inner2 = buildExpression2(group.body, options);
  7638. if (group.left !== ".") {
  7639. var leftNode = new MathNode("mo", [makeText(group.left, group.mode)]);
  7640. leftNode.setAttribute("fence", "true");
  7641. inner2.unshift(leftNode);
  7642. }
  7643. if (group.right !== ".") {
  7644. var rightNode = new MathNode("mo", [makeText(group.right, group.mode)]);
  7645. rightNode.setAttribute("fence", "true");
  7646. if (group.rightColor) {
  7647. rightNode.setAttribute("mathcolor", group.rightColor);
  7648. }
  7649. inner2.push(rightNode);
  7650. }
  7651. return makeRow(inner2);
  7652. }
  7653. });
  7654. defineFunction({
  7655. type: "middle",
  7656. names: ["\\middle"],
  7657. props: {
  7658. numArgs: 1,
  7659. primitive: true
  7660. },
  7661. handler: (context, args) => {
  7662. var delim = checkDelimiter(args[0], context);
  7663. if (!context.parser.leftrightDepth) {
  7664. throw new ParseError("\\middle without preceding \\left", delim);
  7665. }
  7666. return {
  7667. type: "middle",
  7668. mode: context.parser.mode,
  7669. delim: delim.text
  7670. };
  7671. },
  7672. htmlBuilder: (group, options) => {
  7673. var middleDelim;
  7674. if (group.delim === ".") {
  7675. middleDelim = makeNullDelimiter(options, []);
  7676. } else {
  7677. middleDelim = makeSizedDelim(group.delim, 1, options, group.mode, []);
  7678. var isMiddle = {
  7679. delim: group.delim,
  7680. options
  7681. };
  7682. middleDelim.isMiddle = isMiddle;
  7683. }
  7684. return middleDelim;
  7685. },
  7686. mathmlBuilder: (group, options) => {
  7687. var textNode = group.delim === "\\vert" || group.delim === "|" ? makeText("|", "text") : makeText(group.delim, group.mode);
  7688. var middleNode = new MathNode("mo", [textNode]);
  7689. middleNode.setAttribute("fence", "true");
  7690. middleNode.setAttribute("lspace", "0.05em");
  7691. middleNode.setAttribute("rspace", "0.05em");
  7692. return middleNode;
  7693. }
  7694. });
  7695. var htmlBuilder$7 = (group, options) => {
  7696. var inner2 = wrapFragment(buildGroup$1(group.body, options), options);
  7697. var label = group.label.slice(1);
  7698. var scale = options.sizeMultiplier;
  7699. var img;
  7700. var imgShift = 0;
  7701. var isSingleChar = isCharacterBox(group.body);
  7702. if (label === "sout") {
  7703. img = makeSpan(["stretchy", "sout"]);
  7704. img.height = options.fontMetrics().defaultRuleThickness / scale;
  7705. imgShift = -0.5 * options.fontMetrics().xHeight;
  7706. } else if (label === "phase") {
  7707. var lineWeight = calculateSize({
  7708. number: 0.6,
  7709. unit: "pt"
  7710. }, options);
  7711. var clearance = calculateSize({
  7712. number: 0.35,
  7713. unit: "ex"
  7714. }, options);
  7715. var newOptions = options.havingBaseSizing();
  7716. scale = scale / newOptions.sizeMultiplier;
  7717. var angleHeight = inner2.height + inner2.depth + lineWeight + clearance;
  7718. inner2.style.paddingLeft = makeEm(angleHeight / 2 + lineWeight);
  7719. var viewBoxHeight = Math.floor(1e3 * angleHeight * scale);
  7720. var path2 = phasePath(viewBoxHeight);
  7721. var svgNode = new SvgNode([new PathNode("phase", path2)], {
  7722. "width": "400em",
  7723. "height": makeEm(viewBoxHeight / 1e3),
  7724. "viewBox": "0 0 400000 " + viewBoxHeight,
  7725. "preserveAspectRatio": "xMinYMin slice"
  7726. });
  7727. img = makeSvgSpan(["hide-tail"], [svgNode], options);
  7728. img.style.height = makeEm(angleHeight);
  7729. imgShift = inner2.depth + lineWeight + clearance;
  7730. } else {
  7731. if (/cancel/.test(label)) {
  7732. if (!isSingleChar) {
  7733. inner2.classes.push("cancel-pad");
  7734. }
  7735. } else if (label === "angl") {
  7736. inner2.classes.push("anglpad");
  7737. } else {
  7738. inner2.classes.push("boxpad");
  7739. }
  7740. var topPad = 0;
  7741. var bottomPad = 0;
  7742. var ruleThickness = 0;
  7743. if (/box/.test(label)) {
  7744. ruleThickness = Math.max(
  7745. options.fontMetrics().fboxrule,
  7746. // default
  7747. options.minRuleThickness
  7748. );
  7749. topPad = options.fontMetrics().fboxsep + (label === "colorbox" ? 0 : ruleThickness);
  7750. bottomPad = topPad;
  7751. } else if (label === "angl") {
  7752. ruleThickness = Math.max(options.fontMetrics().defaultRuleThickness, options.minRuleThickness);
  7753. topPad = 4 * ruleThickness;
  7754. bottomPad = Math.max(0, 0.25 - inner2.depth);
  7755. } else {
  7756. topPad = isSingleChar ? 0.2 : 0;
  7757. bottomPad = topPad;
  7758. }
  7759. img = stretchyEnclose(inner2, label, topPad, bottomPad, options);
  7760. if (/fbox|boxed|fcolorbox/.test(label)) {
  7761. img.style.borderStyle = "solid";
  7762. img.style.borderWidth = makeEm(ruleThickness);
  7763. } else if (label === "angl" && ruleThickness !== 0.049) {
  7764. img.style.borderTopWidth = makeEm(ruleThickness);
  7765. img.style.borderRightWidth = makeEm(ruleThickness);
  7766. }
  7767. imgShift = inner2.depth + bottomPad;
  7768. if (group.backgroundColor) {
  7769. img.style.backgroundColor = group.backgroundColor;
  7770. if (group.borderColor) {
  7771. img.style.borderColor = group.borderColor;
  7772. }
  7773. }
  7774. }
  7775. var vlist;
  7776. if (group.backgroundColor) {
  7777. vlist = makeVList({
  7778. positionType: "individualShift",
  7779. children: [
  7780. // Put the color background behind inner;
  7781. {
  7782. type: "elem",
  7783. elem: img,
  7784. shift: imgShift
  7785. },
  7786. {
  7787. type: "elem",
  7788. elem: inner2,
  7789. shift: 0
  7790. }
  7791. ]
  7792. });
  7793. } else {
  7794. var classes = /cancel|phase/.test(label) ? ["svg-align"] : [];
  7795. vlist = makeVList({
  7796. positionType: "individualShift",
  7797. children: [
  7798. // Write the \cancel stroke on top of inner.
  7799. {
  7800. type: "elem",
  7801. elem: inner2,
  7802. shift: 0
  7803. },
  7804. {
  7805. type: "elem",
  7806. elem: img,
  7807. shift: imgShift,
  7808. wrapperClasses: classes
  7809. }
  7810. ]
  7811. });
  7812. }
  7813. if (/cancel/.test(label)) {
  7814. vlist.height = inner2.height;
  7815. vlist.depth = inner2.depth;
  7816. }
  7817. if (/cancel/.test(label) && !isSingleChar) {
  7818. return makeSpan(["mord", "cancel-lap"], [vlist], options);
  7819. } else {
  7820. return makeSpan(["mord"], [vlist], options);
  7821. }
  7822. };
  7823. var mathmlBuilder$6 = (group, options) => {
  7824. var fboxsep = 0;
  7825. var node = new MathNode(group.label.includes("colorbox") ? "mpadded" : "menclose", [buildGroup2(group.body, options)]);
  7826. switch (group.label) {
  7827. case "\\cancel":
  7828. node.setAttribute("notation", "updiagonalstrike");
  7829. break;
  7830. case "\\bcancel":
  7831. node.setAttribute("notation", "downdiagonalstrike");
  7832. break;
  7833. case "\\phase":
  7834. node.setAttribute("notation", "phasorangle");
  7835. break;
  7836. case "\\sout":
  7837. node.setAttribute("notation", "horizontalstrike");
  7838. break;
  7839. case "\\fbox":
  7840. node.setAttribute("notation", "box");
  7841. break;
  7842. case "\\angl":
  7843. node.setAttribute("notation", "actuarial");
  7844. break;
  7845. case "\\fcolorbox":
  7846. case "\\colorbox":
  7847. fboxsep = options.fontMetrics().fboxsep * options.fontMetrics().ptPerEm;
  7848. node.setAttribute("width", "+" + 2 * fboxsep + "pt");
  7849. node.setAttribute("height", "+" + 2 * fboxsep + "pt");
  7850. node.setAttribute("lspace", fboxsep + "pt");
  7851. node.setAttribute("voffset", fboxsep + "pt");
  7852. if (group.label === "\\fcolorbox") {
  7853. var thk = Math.max(
  7854. options.fontMetrics().fboxrule,
  7855. // default
  7856. options.minRuleThickness
  7857. );
  7858. node.setAttribute("style", "border: " + makeEm(thk) + " solid " + group.borderColor);
  7859. }
  7860. break;
  7861. case "\\xcancel":
  7862. node.setAttribute("notation", "updiagonalstrike downdiagonalstrike");
  7863. break;
  7864. }
  7865. if (group.backgroundColor) {
  7866. node.setAttribute("mathbackground", group.backgroundColor);
  7867. }
  7868. return node;
  7869. };
  7870. defineFunction({
  7871. type: "enclose",
  7872. names: ["\\colorbox"],
  7873. props: {
  7874. numArgs: 2,
  7875. allowedInText: true,
  7876. argTypes: ["color", "text"]
  7877. },
  7878. handler(_ref, args, optArgs) {
  7879. var {
  7880. parser,
  7881. funcName
  7882. } = _ref;
  7883. var color = assertNodeType(args[0], "color-token").color;
  7884. var body = args[1];
  7885. return {
  7886. type: "enclose",
  7887. mode: parser.mode,
  7888. label: funcName,
  7889. backgroundColor: color,
  7890. body
  7891. };
  7892. },
  7893. htmlBuilder: htmlBuilder$7,
  7894. mathmlBuilder: mathmlBuilder$6
  7895. });
  7896. defineFunction({
  7897. type: "enclose",
  7898. names: ["\\fcolorbox"],
  7899. props: {
  7900. numArgs: 3,
  7901. allowedInText: true,
  7902. argTypes: ["color", "color", "text"]
  7903. },
  7904. handler(_ref2, args, optArgs) {
  7905. var {
  7906. parser,
  7907. funcName
  7908. } = _ref2;
  7909. var borderColor = assertNodeType(args[0], "color-token").color;
  7910. var backgroundColor = assertNodeType(args[1], "color-token").color;
  7911. var body = args[2];
  7912. return {
  7913. type: "enclose",
  7914. mode: parser.mode,
  7915. label: funcName,
  7916. backgroundColor,
  7917. borderColor,
  7918. body
  7919. };
  7920. },
  7921. htmlBuilder: htmlBuilder$7,
  7922. mathmlBuilder: mathmlBuilder$6
  7923. });
  7924. defineFunction({
  7925. type: "enclose",
  7926. names: ["\\fbox"],
  7927. props: {
  7928. numArgs: 1,
  7929. argTypes: ["hbox"],
  7930. allowedInText: true
  7931. },
  7932. handler(_ref3, args) {
  7933. var {
  7934. parser
  7935. } = _ref3;
  7936. return {
  7937. type: "enclose",
  7938. mode: parser.mode,
  7939. label: "\\fbox",
  7940. body: args[0]
  7941. };
  7942. }
  7943. });
  7944. defineFunction({
  7945. type: "enclose",
  7946. names: ["\\cancel", "\\bcancel", "\\xcancel", "\\phase"],
  7947. props: {
  7948. numArgs: 1
  7949. },
  7950. handler(_ref4, args) {
  7951. var {
  7952. parser,
  7953. funcName
  7954. } = _ref4;
  7955. var body = args[0];
  7956. return {
  7957. type: "enclose",
  7958. mode: parser.mode,
  7959. label: funcName,
  7960. body
  7961. };
  7962. },
  7963. htmlBuilder: htmlBuilder$7,
  7964. mathmlBuilder: mathmlBuilder$6
  7965. });
  7966. defineFunction({
  7967. type: "enclose",
  7968. names: ["\\sout"],
  7969. props: {
  7970. numArgs: 1,
  7971. allowedInText: true
  7972. },
  7973. handler(_ref5, args) {
  7974. var {
  7975. parser,
  7976. funcName
  7977. } = _ref5;
  7978. if (parser.mode === "math") {
  7979. parser.settings.reportNonstrict("mathVsSout", "LaTeX's \\sout works only in text mode");
  7980. }
  7981. var body = args[0];
  7982. return {
  7983. type: "enclose",
  7984. mode: parser.mode,
  7985. label: funcName,
  7986. body
  7987. };
  7988. },
  7989. htmlBuilder: htmlBuilder$7,
  7990. mathmlBuilder: mathmlBuilder$6
  7991. });
  7992. defineFunction({
  7993. type: "enclose",
  7994. names: ["\\angl"],
  7995. props: {
  7996. numArgs: 1,
  7997. argTypes: ["hbox"],
  7998. allowedInText: false
  7999. },
  8000. handler(_ref6, args) {
  8001. var {
  8002. parser
  8003. } = _ref6;
  8004. return {
  8005. type: "enclose",
  8006. mode: parser.mode,
  8007. label: "\\angl",
  8008. body: args[0]
  8009. };
  8010. }
  8011. });
  8012. var _environments = {};
  8013. function defineEnvironment(_ref) {
  8014. var {
  8015. type,
  8016. names,
  8017. props,
  8018. handler,
  8019. htmlBuilder: htmlBuilder3,
  8020. mathmlBuilder: mathmlBuilder3
  8021. } = _ref;
  8022. var data = {
  8023. type,
  8024. numArgs: props.numArgs || 0,
  8025. allowedInText: false,
  8026. numOptionalArgs: 0,
  8027. handler
  8028. };
  8029. for (var i = 0; i < names.length; ++i) {
  8030. _environments[names[i]] = data;
  8031. }
  8032. if (htmlBuilder3) {
  8033. _htmlGroupBuilders[type] = htmlBuilder3;
  8034. }
  8035. if (mathmlBuilder3) {
  8036. _mathmlGroupBuilders[type] = mathmlBuilder3;
  8037. }
  8038. }
  8039. var _macros = {};
  8040. function defineMacro(name, body) {
  8041. _macros[name] = body;
  8042. }
  8043. var SourceLocation = class _SourceLocation {
  8044. // The + prefix indicates that these fields aren't writeable
  8045. // Lexer holding the input string.
  8046. // Start offset, zero-based inclusive.
  8047. // End offset, zero-based exclusive.
  8048. constructor(lexer, start, end) {
  8049. this.lexer = lexer;
  8050. this.start = start;
  8051. this.end = end;
  8052. }
  8053. /**
  8054. * Merges two `SourceLocation`s from location providers, given they are
  8055. * provided in order of appearance.
  8056. * - Returns the first one's location if only the first is provided.
  8057. * - Returns a merged range of the first and the last if both are provided
  8058. * and their lexers match.
  8059. * - Otherwise, returns null.
  8060. */
  8061. static range(first, second) {
  8062. if (!second) {
  8063. return first && first.loc;
  8064. } else if (!first || !first.loc || !second.loc || first.loc.lexer !== second.loc.lexer) {
  8065. return null;
  8066. } else {
  8067. return new _SourceLocation(first.loc.lexer, first.loc.start, second.loc.end);
  8068. }
  8069. }
  8070. };
  8071. var Token = class _Token {
  8072. // don't expand the token
  8073. // used in \noexpand
  8074. constructor(text2, loc) {
  8075. this.text = text2;
  8076. this.loc = loc;
  8077. }
  8078. /**
  8079. * Given a pair of tokens (this and endToken), compute a `Token` encompassing
  8080. * the whole input range enclosed by these two.
  8081. */
  8082. range(endToken, text2) {
  8083. return new _Token(text2, SourceLocation.range(this, endToken));
  8084. }
  8085. };
  8086. function getHLines(parser) {
  8087. var hlineInfo = [];
  8088. parser.consumeSpaces();
  8089. var nxt = parser.fetch().text;
  8090. if (nxt === "\\relax") {
  8091. parser.consume();
  8092. parser.consumeSpaces();
  8093. nxt = parser.fetch().text;
  8094. }
  8095. while (nxt === "\\hline" || nxt === "\\hdashline") {
  8096. parser.consume();
  8097. hlineInfo.push(nxt === "\\hdashline");
  8098. parser.consumeSpaces();
  8099. nxt = parser.fetch().text;
  8100. }
  8101. return hlineInfo;
  8102. }
  8103. var validateAmsEnvironmentContext = (context) => {
  8104. var settings = context.parser.settings;
  8105. if (!settings.displayMode) {
  8106. throw new ParseError("{" + context.envName + "} can be used only in display mode.");
  8107. }
  8108. };
  8109. var gatherEnvironments = /* @__PURE__ */ new Set(["gather", "gather*"]);
  8110. function getAutoTag(name) {
  8111. if (!name.includes("ed")) {
  8112. return !name.includes("*");
  8113. }
  8114. }
  8115. function parseArray(parser, _ref, style) {
  8116. var {
  8117. hskipBeforeAndAfter,
  8118. addJot,
  8119. cols,
  8120. arraystretch,
  8121. colSeparationType,
  8122. autoTag,
  8123. singleRow,
  8124. emptySingleRow,
  8125. maxNumCols,
  8126. leqno
  8127. } = _ref;
  8128. parser.gullet.beginGroup();
  8129. if (!singleRow) {
  8130. parser.gullet.macros.set("\\cr", "\\\\\\relax");
  8131. }
  8132. if (!arraystretch) {
  8133. var stretch = parser.gullet.expandMacroAsText("\\arraystretch");
  8134. if (stretch == null) {
  8135. arraystretch = 1;
  8136. } else {
  8137. arraystretch = parseFloat(stretch);
  8138. if (!arraystretch || arraystretch < 0) {
  8139. throw new ParseError("Invalid \\arraystretch: " + stretch);
  8140. }
  8141. }
  8142. }
  8143. parser.gullet.beginGroup();
  8144. var row = [];
  8145. var body = [row];
  8146. var rowGaps = [];
  8147. var hLinesBeforeRow = [];
  8148. var tags = autoTag != null ? [] : void 0;
  8149. function beginRow() {
  8150. if (autoTag) {
  8151. parser.gullet.macros.set("\\@eqnsw", "1", true);
  8152. }
  8153. }
  8154. function endRow() {
  8155. if (tags) {
  8156. if (parser.gullet.macros.get("\\df@tag")) {
  8157. tags.push(parser.subparse([new Token("\\df@tag")]));
  8158. parser.gullet.macros.set("\\df@tag", void 0, true);
  8159. } else {
  8160. tags.push(Boolean(autoTag) && parser.gullet.macros.get("\\@eqnsw") === "1");
  8161. }
  8162. }
  8163. }
  8164. beginRow();
  8165. hLinesBeforeRow.push(getHLines(parser));
  8166. while (true) {
  8167. var cellBody = parser.parseExpression(false, singleRow ? "\\end" : "\\\\");
  8168. parser.gullet.endGroup();
  8169. parser.gullet.beginGroup();
  8170. var cell = {
  8171. type: "ordgroup",
  8172. mode: parser.mode,
  8173. body: cellBody
  8174. };
  8175. if (style) {
  8176. cell = {
  8177. type: "styling",
  8178. mode: parser.mode,
  8179. style,
  8180. body: [cell]
  8181. };
  8182. }
  8183. row.push(cell);
  8184. var next = parser.fetch().text;
  8185. if (next === "&") {
  8186. if (maxNumCols && row.length === maxNumCols) {
  8187. if (singleRow || colSeparationType) {
  8188. throw new ParseError("Too many tab characters: &", parser.nextToken);
  8189. } else {
  8190. parser.settings.reportNonstrict("textEnv", "Too few columns specified in the {array} column argument.");
  8191. }
  8192. }
  8193. parser.consume();
  8194. } else if (next === "\\end") {
  8195. endRow();
  8196. if (row.length === 1 && cell.type === "styling" && cell.body.length === 1 && cell.body[0].type === "ordgroup" && cell.body[0].body.length === 0 && (body.length > 1 || !emptySingleRow)) {
  8197. body.pop();
  8198. }
  8199. if (hLinesBeforeRow.length < body.length + 1) {
  8200. hLinesBeforeRow.push([]);
  8201. }
  8202. break;
  8203. } else if (next === "\\\\") {
  8204. parser.consume();
  8205. var size = void 0;
  8206. if (parser.gullet.future().text !== " ") {
  8207. size = parser.parseSizeGroup(true);
  8208. }
  8209. rowGaps.push(size ? size.value : null);
  8210. endRow();
  8211. hLinesBeforeRow.push(getHLines(parser));
  8212. row = [];
  8213. body.push(row);
  8214. beginRow();
  8215. } else {
  8216. throw new ParseError("Expected & or \\\\ or \\cr or \\end", parser.nextToken);
  8217. }
  8218. }
  8219. parser.gullet.endGroup();
  8220. parser.gullet.endGroup();
  8221. return {
  8222. type: "array",
  8223. mode: parser.mode,
  8224. addJot,
  8225. arraystretch,
  8226. body,
  8227. cols,
  8228. rowGaps,
  8229. hskipBeforeAndAfter,
  8230. hLinesBeforeRow,
  8231. colSeparationType,
  8232. tags,
  8233. leqno
  8234. };
  8235. }
  8236. function dCellStyle(envName) {
  8237. if (envName.slice(0, 1) === "d") {
  8238. return "display";
  8239. } else {
  8240. return "text";
  8241. }
  8242. }
  8243. var htmlBuilder$6 = function htmlBuilder(group, options) {
  8244. var r;
  8245. var c;
  8246. var nr = group.body.length;
  8247. var hLinesBeforeRow = group.hLinesBeforeRow;
  8248. var nc = 0;
  8249. var body = new Array(nr);
  8250. var hlines = [];
  8251. var ruleThickness = Math.max(
  8252. // From LaTeX \showthe\arrayrulewidth. Equals 0.04 em.
  8253. options.fontMetrics().arrayRuleWidth,
  8254. options.minRuleThickness
  8255. );
  8256. var pt = 1 / options.fontMetrics().ptPerEm;
  8257. var arraycolsep = 5 * pt;
  8258. if (group.colSeparationType && group.colSeparationType === "small") {
  8259. var localMultiplier = options.havingStyle(Style$1.SCRIPT).sizeMultiplier;
  8260. arraycolsep = 0.2778 * (localMultiplier / options.sizeMultiplier);
  8261. }
  8262. var baselineskip = group.colSeparationType === "CD" ? calculateSize({
  8263. number: 3,
  8264. unit: "ex"
  8265. }, options) : 12 * pt;
  8266. var jot = 3 * pt;
  8267. var arrayskip = group.arraystretch * baselineskip;
  8268. var arstrutHeight = 0.7 * arrayskip;
  8269. var arstrutDepth = 0.3 * arrayskip;
  8270. var totalHeight = 0;
  8271. function setHLinePos(hlinesInGap) {
  8272. for (var i = 0; i < hlinesInGap.length; ++i) {
  8273. if (i > 0) {
  8274. totalHeight += 0.25;
  8275. }
  8276. hlines.push({
  8277. pos: totalHeight,
  8278. isDashed: hlinesInGap[i]
  8279. });
  8280. }
  8281. }
  8282. setHLinePos(hLinesBeforeRow[0]);
  8283. for (r = 0; r < group.body.length; ++r) {
  8284. var inrow = group.body[r];
  8285. var height = arstrutHeight;
  8286. var depth = arstrutDepth;
  8287. if (nc < inrow.length) {
  8288. nc = inrow.length;
  8289. }
  8290. var outrow = new Array(inrow.length);
  8291. for (c = 0; c < inrow.length; ++c) {
  8292. var elt = buildGroup$1(inrow[c], options);
  8293. if (depth < elt.depth) {
  8294. depth = elt.depth;
  8295. }
  8296. if (height < elt.height) {
  8297. height = elt.height;
  8298. }
  8299. outrow[c] = elt;
  8300. }
  8301. var rowGap = group.rowGaps[r];
  8302. var gap = 0;
  8303. if (rowGap) {
  8304. gap = calculateSize(rowGap, options);
  8305. if (gap > 0) {
  8306. gap += arstrutDepth;
  8307. if (depth < gap) {
  8308. depth = gap;
  8309. }
  8310. gap = 0;
  8311. }
  8312. }
  8313. if (group.addJot && r < group.body.length - 1) {
  8314. depth += jot;
  8315. }
  8316. outrow.height = height;
  8317. outrow.depth = depth;
  8318. totalHeight += height;
  8319. outrow.pos = totalHeight;
  8320. totalHeight += depth + gap;
  8321. body[r] = outrow;
  8322. setHLinePos(hLinesBeforeRow[r + 1]);
  8323. }
  8324. var offset = totalHeight / 2 + options.fontMetrics().axisHeight;
  8325. var colDescriptions = group.cols || [];
  8326. var cols = [];
  8327. var colSep;
  8328. var colDescrNum;
  8329. var tagSpans = [];
  8330. if (group.tags && group.tags.some((tag2) => tag2)) {
  8331. for (r = 0; r < nr; ++r) {
  8332. var rw = body[r];
  8333. var shift = rw.pos - offset;
  8334. var tag = group.tags[r];
  8335. var tagSpan = void 0;
  8336. if (tag === true) {
  8337. tagSpan = makeSpan(["eqn-num"], [], options);
  8338. } else if (tag === false) {
  8339. tagSpan = makeSpan([], [], options);
  8340. } else {
  8341. tagSpan = makeSpan([], buildExpression$1(tag, options, true), options);
  8342. }
  8343. tagSpan.depth = rw.depth;
  8344. tagSpan.height = rw.height;
  8345. tagSpans.push({
  8346. type: "elem",
  8347. elem: tagSpan,
  8348. shift
  8349. });
  8350. }
  8351. }
  8352. for (
  8353. c = 0, colDescrNum = 0;
  8354. // Continue while either there are more columns or more column
  8355. // descriptions, so trailing separators don't get lost.
  8356. c < nc || colDescrNum < colDescriptions.length;
  8357. ++c, ++colDescrNum
  8358. ) {
  8359. var _colDescr3;
  8360. var colDescr = colDescriptions[colDescrNum];
  8361. var firstSeparator = true;
  8362. while (((_colDescr = colDescr) == null ? void 0 : _colDescr.type) === "separator") {
  8363. var _colDescr;
  8364. if (!firstSeparator) {
  8365. colSep = makeSpan(["arraycolsep"], []);
  8366. colSep.style.width = makeEm(options.fontMetrics().doubleRuleSep);
  8367. cols.push(colSep);
  8368. }
  8369. if (colDescr.separator === "|" || colDescr.separator === ":") {
  8370. var lineType = colDescr.separator === "|" ? "solid" : "dashed";
  8371. var separator = makeSpan(["vertical-separator"], [], options);
  8372. separator.style.height = makeEm(totalHeight);
  8373. separator.style.borderRightWidth = makeEm(ruleThickness);
  8374. separator.style.borderRightStyle = lineType;
  8375. separator.style.margin = "0 " + makeEm(-ruleThickness / 2);
  8376. var _shift = totalHeight - offset;
  8377. if (_shift) {
  8378. separator.style.verticalAlign = makeEm(-_shift);
  8379. }
  8380. cols.push(separator);
  8381. } else {
  8382. throw new ParseError("Invalid separator type: " + colDescr.separator);
  8383. }
  8384. colDescrNum++;
  8385. colDescr = colDescriptions[colDescrNum];
  8386. firstSeparator = false;
  8387. }
  8388. if (c >= nc) {
  8389. continue;
  8390. }
  8391. var sepwidth = void 0;
  8392. if (c > 0 || group.hskipBeforeAndAfter) {
  8393. var _colDescr$pregap, _colDescr2;
  8394. sepwidth = (_colDescr$pregap = (_colDescr2 = colDescr) == null ? void 0 : _colDescr2.pregap) != null ? _colDescr$pregap : arraycolsep;
  8395. if (sepwidth !== 0) {
  8396. colSep = makeSpan(["arraycolsep"], []);
  8397. colSep.style.width = makeEm(sepwidth);
  8398. cols.push(colSep);
  8399. }
  8400. }
  8401. var colElems = [];
  8402. for (r = 0; r < nr; ++r) {
  8403. var row = body[r];
  8404. var elem = row[c];
  8405. if (!elem) {
  8406. continue;
  8407. }
  8408. var _shift2 = row.pos - offset;
  8409. elem.depth = row.depth;
  8410. elem.height = row.height;
  8411. colElems.push({
  8412. type: "elem",
  8413. elem,
  8414. shift: _shift2
  8415. });
  8416. }
  8417. var colVList = makeVList({
  8418. positionType: "individualShift",
  8419. children: colElems
  8420. });
  8421. var colSpan = makeSpan(["col-align-" + (((_colDescr3 = colDescr) == null ? void 0 : _colDescr3.align) || "c")], [colVList]);
  8422. cols.push(colSpan);
  8423. if (c < nc - 1 || group.hskipBeforeAndAfter) {
  8424. var _colDescr$postgap, _colDescr4;
  8425. sepwidth = (_colDescr$postgap = (_colDescr4 = colDescr) == null ? void 0 : _colDescr4.postgap) != null ? _colDescr$postgap : arraycolsep;
  8426. if (sepwidth !== 0) {
  8427. colSep = makeSpan(["arraycolsep"], []);
  8428. colSep.style.width = makeEm(sepwidth);
  8429. cols.push(colSep);
  8430. }
  8431. }
  8432. }
  8433. var tableBody = makeSpan(["mtable"], cols);
  8434. if (hlines.length > 0) {
  8435. var line = makeLineSpan("hline", options, ruleThickness);
  8436. var dashes = makeLineSpan("hdashline", options, ruleThickness);
  8437. var vListElems = [{
  8438. type: "elem",
  8439. elem: tableBody,
  8440. shift: 0
  8441. }];
  8442. while (hlines.length > 0) {
  8443. var hline = hlines.pop();
  8444. var lineShift = hline.pos - offset;
  8445. if (hline.isDashed) {
  8446. vListElems.push({
  8447. type: "elem",
  8448. elem: dashes,
  8449. shift: lineShift
  8450. });
  8451. } else {
  8452. vListElems.push({
  8453. type: "elem",
  8454. elem: line,
  8455. shift: lineShift
  8456. });
  8457. }
  8458. }
  8459. tableBody = makeVList({
  8460. positionType: "individualShift",
  8461. children: vListElems
  8462. });
  8463. }
  8464. if (tagSpans.length === 0) {
  8465. return makeSpan(["mord"], [tableBody], options);
  8466. } else {
  8467. var eqnNumCol = makeVList({
  8468. positionType: "individualShift",
  8469. children: tagSpans
  8470. });
  8471. var tagCol = makeSpan(["tag"], [eqnNumCol], options);
  8472. return makeFragment([tableBody, tagCol]);
  8473. }
  8474. };
  8475. var alignMap = {
  8476. c: "center ",
  8477. l: "left ",
  8478. r: "right "
  8479. };
  8480. var mathmlBuilder$5 = function mathmlBuilder(group, options) {
  8481. var tbl = [];
  8482. var glue = new MathNode("mtd", [], ["mtr-glue"]);
  8483. var tag = new MathNode("mtd", [], ["mml-eqn-num"]);
  8484. for (var i = 0; i < group.body.length; i++) {
  8485. var rw = group.body[i];
  8486. var row = [];
  8487. for (var j = 0; j < rw.length; j++) {
  8488. row.push(new MathNode("mtd", [buildGroup2(rw[j], options)]));
  8489. }
  8490. if (group.tags && group.tags[i]) {
  8491. row.unshift(glue);
  8492. row.push(glue);
  8493. if (group.leqno) {
  8494. row.unshift(tag);
  8495. } else {
  8496. row.push(tag);
  8497. }
  8498. }
  8499. tbl.push(new MathNode("mtr", row));
  8500. }
  8501. var table = new MathNode("mtable", tbl);
  8502. var gap = group.arraystretch === 0.5 ? 0.1 : 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0);
  8503. table.setAttribute("rowspacing", makeEm(gap));
  8504. var menclose = "";
  8505. var align = "";
  8506. if (group.cols && group.cols.length > 0) {
  8507. var cols = group.cols;
  8508. var columnLines = "";
  8509. var prevTypeWasAlign = false;
  8510. var iStart = 0;
  8511. var iEnd = cols.length;
  8512. if (cols[0].type === "separator") {
  8513. menclose += "top ";
  8514. iStart = 1;
  8515. }
  8516. if (cols[cols.length - 1].type === "separator") {
  8517. menclose += "bottom ";
  8518. iEnd -= 1;
  8519. }
  8520. for (var _i = iStart; _i < iEnd; _i++) {
  8521. var col = cols[_i];
  8522. if (col.type === "align") {
  8523. align += alignMap[col.align];
  8524. if (prevTypeWasAlign) {
  8525. columnLines += "none ";
  8526. }
  8527. prevTypeWasAlign = true;
  8528. } else if (col.type === "separator") {
  8529. if (prevTypeWasAlign) {
  8530. columnLines += col.separator === "|" ? "solid " : "dashed ";
  8531. prevTypeWasAlign = false;
  8532. }
  8533. }
  8534. }
  8535. table.setAttribute("columnalign", align.trim());
  8536. if (/[sd]/.test(columnLines)) {
  8537. table.setAttribute("columnlines", columnLines.trim());
  8538. }
  8539. }
  8540. if (group.colSeparationType === "align") {
  8541. var _cols = group.cols || [];
  8542. var spacing2 = "";
  8543. for (var _i2 = 1; _i2 < _cols.length; _i2++) {
  8544. spacing2 += _i2 % 2 ? "0em " : "1em ";
  8545. }
  8546. table.setAttribute("columnspacing", spacing2.trim());
  8547. } else if (group.colSeparationType === "alignat" || group.colSeparationType === "gather") {
  8548. table.setAttribute("columnspacing", "0em");
  8549. } else if (group.colSeparationType === "small") {
  8550. table.setAttribute("columnspacing", "0.2778em");
  8551. } else if (group.colSeparationType === "CD") {
  8552. table.setAttribute("columnspacing", "0.5em");
  8553. } else {
  8554. table.setAttribute("columnspacing", "1em");
  8555. }
  8556. var rowLines = "";
  8557. var hlines = group.hLinesBeforeRow;
  8558. menclose += hlines[0].length > 0 ? "left " : "";
  8559. menclose += hlines[hlines.length - 1].length > 0 ? "right " : "";
  8560. for (var _i3 = 1; _i3 < hlines.length - 1; _i3++) {
  8561. rowLines += hlines[_i3].length === 0 ? "none " : hlines[_i3][0] ? "dashed " : "solid ";
  8562. }
  8563. if (/[sd]/.test(rowLines)) {
  8564. table.setAttribute("rowlines", rowLines.trim());
  8565. }
  8566. if (menclose !== "") {
  8567. table = new MathNode("menclose", [table]);
  8568. table.setAttribute("notation", menclose.trim());
  8569. }
  8570. if (group.arraystretch && group.arraystretch < 1) {
  8571. table = new MathNode("mstyle", [table]);
  8572. table.setAttribute("scriptlevel", "1");
  8573. }
  8574. return table;
  8575. };
  8576. var alignedHandler = function alignedHandler2(context, args) {
  8577. if (!context.envName.includes("ed")) {
  8578. validateAmsEnvironmentContext(context);
  8579. }
  8580. var cols = [];
  8581. var separationType = context.envName.includes("at") ? "alignat" : "align";
  8582. var isSplit = context.envName === "split";
  8583. var res = parseArray(context.parser, {
  8584. cols,
  8585. addJot: true,
  8586. autoTag: isSplit ? void 0 : getAutoTag(context.envName),
  8587. emptySingleRow: true,
  8588. colSeparationType: separationType,
  8589. maxNumCols: isSplit ? 2 : void 0,
  8590. leqno: context.parser.settings.leqno
  8591. }, "display");
  8592. var numMaths = 0;
  8593. var numCols = 0;
  8594. var emptyGroup = {
  8595. type: "ordgroup",
  8596. mode: context.mode,
  8597. body: []
  8598. };
  8599. if (args[0] && args[0].type === "ordgroup") {
  8600. var arg0 = "";
  8601. for (var i = 0; i < args[0].body.length; i++) {
  8602. var textord2 = assertNodeType(args[0].body[i], "textord");
  8603. arg0 += textord2.text;
  8604. }
  8605. numMaths = Number(arg0);
  8606. numCols = numMaths * 2;
  8607. }
  8608. var isAligned = !numCols;
  8609. res.body.forEach(function(row) {
  8610. for (var _i4 = 1; _i4 < row.length; _i4 += 2) {
  8611. var styling = assertNodeType(row[_i4], "styling");
  8612. var ordgroup = assertNodeType(styling.body[0], "ordgroup");
  8613. ordgroup.body.unshift(emptyGroup);
  8614. }
  8615. if (!isAligned) {
  8616. var curMaths = row.length / 2;
  8617. if (numMaths < curMaths) {
  8618. throw new ParseError("Too many math in a row: " + ("expected " + numMaths + ", but got " + curMaths), row[0]);
  8619. }
  8620. } else if (numCols < row.length) {
  8621. numCols = row.length;
  8622. }
  8623. });
  8624. for (var _i5 = 0; _i5 < numCols; ++_i5) {
  8625. var align = "r";
  8626. var pregap = 0;
  8627. if (_i5 % 2 === 1) {
  8628. align = "l";
  8629. } else if (_i5 > 0 && isAligned) {
  8630. pregap = 1;
  8631. }
  8632. cols[_i5] = {
  8633. type: "align",
  8634. align,
  8635. pregap,
  8636. postgap: 0
  8637. };
  8638. }
  8639. res.colSeparationType = isAligned ? "align" : "alignat";
  8640. return res;
  8641. };
  8642. defineEnvironment({
  8643. type: "array",
  8644. names: ["array", "darray"],
  8645. props: {
  8646. numArgs: 1
  8647. },
  8648. handler(context, args) {
  8649. var symNode = checkSymbolNodeType(args[0]);
  8650. var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body;
  8651. var cols = colalign.map(function(nde) {
  8652. var node = assertSymbolNodeType(nde);
  8653. var ca = node.text;
  8654. if ("lcr".includes(ca)) {
  8655. return {
  8656. type: "align",
  8657. align: ca
  8658. };
  8659. } else if (ca === "|") {
  8660. return {
  8661. type: "separator",
  8662. separator: "|"
  8663. };
  8664. } else if (ca === ":") {
  8665. return {
  8666. type: "separator",
  8667. separator: ":"
  8668. };
  8669. }
  8670. throw new ParseError("Unknown column alignment: " + ca, nde);
  8671. });
  8672. var res = {
  8673. cols,
  8674. hskipBeforeAndAfter: true,
  8675. // \@preamble in lttab.dtx
  8676. maxNumCols: cols.length
  8677. };
  8678. return parseArray(context.parser, res, dCellStyle(context.envName));
  8679. },
  8680. htmlBuilder: htmlBuilder$6,
  8681. mathmlBuilder: mathmlBuilder$5
  8682. });
  8683. defineEnvironment({
  8684. type: "array",
  8685. names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix", "matrix*", "pmatrix*", "bmatrix*", "Bmatrix*", "vmatrix*", "Vmatrix*"],
  8686. props: {
  8687. numArgs: 0
  8688. },
  8689. handler(context) {
  8690. var delimiters2 = {
  8691. "matrix": null,
  8692. "pmatrix": ["(", ")"],
  8693. "bmatrix": ["[", "]"],
  8694. "Bmatrix": ["\\{", "\\}"],
  8695. "vmatrix": ["|", "|"],
  8696. "Vmatrix": ["\\Vert", "\\Vert"]
  8697. }[context.envName.replace("*", "")];
  8698. var colAlign = "c";
  8699. var payload = {
  8700. hskipBeforeAndAfter: false,
  8701. cols: [{
  8702. type: "align",
  8703. align: colAlign
  8704. }]
  8705. };
  8706. if (context.envName.charAt(context.envName.length - 1) === "*") {
  8707. var parser = context.parser;
  8708. parser.consumeSpaces();
  8709. if (parser.fetch().text === "[") {
  8710. parser.consume();
  8711. parser.consumeSpaces();
  8712. colAlign = parser.fetch().text;
  8713. if (!"lcr".includes(colAlign)) {
  8714. throw new ParseError("Expected l or c or r", parser.nextToken);
  8715. }
  8716. parser.consume();
  8717. parser.consumeSpaces();
  8718. parser.expect("]");
  8719. parser.consume();
  8720. payload.cols = [{
  8721. type: "align",
  8722. align: colAlign
  8723. }];
  8724. }
  8725. }
  8726. var res = parseArray(context.parser, payload, dCellStyle(context.envName));
  8727. var numCols = Math.max(0, ...res.body.map((row) => row.length));
  8728. res.cols = new Array(numCols).fill({
  8729. type: "align",
  8730. align: colAlign
  8731. });
  8732. return delimiters2 ? {
  8733. type: "leftright",
  8734. mode: context.mode,
  8735. body: [res],
  8736. left: delimiters2[0],
  8737. right: delimiters2[1],
  8738. rightColor: void 0
  8739. // \right uninfluenced by \color in array
  8740. } : res;
  8741. },
  8742. htmlBuilder: htmlBuilder$6,
  8743. mathmlBuilder: mathmlBuilder$5
  8744. });
  8745. defineEnvironment({
  8746. type: "array",
  8747. names: ["smallmatrix"],
  8748. props: {
  8749. numArgs: 0
  8750. },
  8751. handler(context) {
  8752. var payload = {
  8753. arraystretch: 0.5
  8754. };
  8755. var res = parseArray(context.parser, payload, "script");
  8756. res.colSeparationType = "small";
  8757. return res;
  8758. },
  8759. htmlBuilder: htmlBuilder$6,
  8760. mathmlBuilder: mathmlBuilder$5
  8761. });
  8762. defineEnvironment({
  8763. type: "array",
  8764. names: ["subarray"],
  8765. props: {
  8766. numArgs: 1
  8767. },
  8768. handler(context, args) {
  8769. var symNode = checkSymbolNodeType(args[0]);
  8770. var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body;
  8771. var cols = colalign.map(function(nde) {
  8772. var node = assertSymbolNodeType(nde);
  8773. var ca = node.text;
  8774. if ("lc".includes(ca)) {
  8775. return {
  8776. type: "align",
  8777. align: ca
  8778. };
  8779. }
  8780. throw new ParseError("Unknown column alignment: " + ca, nde);
  8781. });
  8782. if (cols.length > 1) {
  8783. throw new ParseError("{subarray} can contain only one column");
  8784. }
  8785. var payload = {
  8786. cols,
  8787. hskipBeforeAndAfter: false,
  8788. arraystretch: 0.5
  8789. };
  8790. var res = parseArray(context.parser, payload, "script");
  8791. if (res.body.length > 0 && res.body[0].length > 1) {
  8792. throw new ParseError("{subarray} can contain only one column");
  8793. }
  8794. return res;
  8795. },
  8796. htmlBuilder: htmlBuilder$6,
  8797. mathmlBuilder: mathmlBuilder$5
  8798. });
  8799. defineEnvironment({
  8800. type: "array",
  8801. names: ["cases", "dcases", "rcases", "drcases"],
  8802. props: {
  8803. numArgs: 0
  8804. },
  8805. handler(context) {
  8806. var payload = {
  8807. arraystretch: 1.2,
  8808. cols: [{
  8809. type: "align",
  8810. align: "l",
  8811. pregap: 0,
  8812. // TODO(kevinb) get the current style.
  8813. // For now we use the metrics for TEXT style which is what we were
  8814. // doing before. Before attempting to get the current style we
  8815. // should look at TeX's behavior especially for \over and matrices.
  8816. postgap: 1
  8817. /* 1em quad */
  8818. }, {
  8819. type: "align",
  8820. align: "l",
  8821. pregap: 0,
  8822. postgap: 0
  8823. }]
  8824. };
  8825. var res = parseArray(context.parser, payload, dCellStyle(context.envName));
  8826. return {
  8827. type: "leftright",
  8828. mode: context.mode,
  8829. body: [res],
  8830. left: context.envName.includes("r") ? "." : "\\{",
  8831. right: context.envName.includes("r") ? "\\}" : ".",
  8832. rightColor: void 0
  8833. };
  8834. },
  8835. htmlBuilder: htmlBuilder$6,
  8836. mathmlBuilder: mathmlBuilder$5
  8837. });
  8838. defineEnvironment({
  8839. type: "array",
  8840. names: ["align", "align*", "aligned", "split"],
  8841. props: {
  8842. numArgs: 0
  8843. },
  8844. handler: alignedHandler,
  8845. htmlBuilder: htmlBuilder$6,
  8846. mathmlBuilder: mathmlBuilder$5
  8847. });
  8848. defineEnvironment({
  8849. type: "array",
  8850. names: ["gathered", "gather", "gather*"],
  8851. props: {
  8852. numArgs: 0
  8853. },
  8854. handler(context) {
  8855. if (gatherEnvironments.has(context.envName)) {
  8856. validateAmsEnvironmentContext(context);
  8857. }
  8858. var res = {
  8859. cols: [{
  8860. type: "align",
  8861. align: "c"
  8862. }],
  8863. addJot: true,
  8864. colSeparationType: "gather",
  8865. autoTag: getAutoTag(context.envName),
  8866. emptySingleRow: true,
  8867. leqno: context.parser.settings.leqno
  8868. };
  8869. return parseArray(context.parser, res, "display");
  8870. },
  8871. htmlBuilder: htmlBuilder$6,
  8872. mathmlBuilder: mathmlBuilder$5
  8873. });
  8874. defineEnvironment({
  8875. type: "array",
  8876. names: ["alignat", "alignat*", "alignedat"],
  8877. props: {
  8878. numArgs: 1
  8879. },
  8880. handler: alignedHandler,
  8881. htmlBuilder: htmlBuilder$6,
  8882. mathmlBuilder: mathmlBuilder$5
  8883. });
  8884. defineEnvironment({
  8885. type: "array",
  8886. names: ["equation", "equation*"],
  8887. props: {
  8888. numArgs: 0
  8889. },
  8890. handler(context) {
  8891. validateAmsEnvironmentContext(context);
  8892. var res = {
  8893. autoTag: getAutoTag(context.envName),
  8894. emptySingleRow: true,
  8895. singleRow: true,
  8896. maxNumCols: 1,
  8897. leqno: context.parser.settings.leqno
  8898. };
  8899. return parseArray(context.parser, res, "display");
  8900. },
  8901. htmlBuilder: htmlBuilder$6,
  8902. mathmlBuilder: mathmlBuilder$5
  8903. });
  8904. defineEnvironment({
  8905. type: "array",
  8906. names: ["CD"],
  8907. props: {
  8908. numArgs: 0
  8909. },
  8910. handler(context) {
  8911. validateAmsEnvironmentContext(context);
  8912. return parseCD(context.parser);
  8913. },
  8914. htmlBuilder: htmlBuilder$6,
  8915. mathmlBuilder: mathmlBuilder$5
  8916. });
  8917. defineMacro("\\nonumber", "\\gdef\\@eqnsw{0}");
  8918. defineMacro("\\notag", "\\nonumber");
  8919. defineFunction({
  8920. type: "text",
  8921. // Doesn't matter what this is.
  8922. names: ["\\hline", "\\hdashline"],
  8923. props: {
  8924. numArgs: 0,
  8925. allowedInText: true,
  8926. allowedInMath: true
  8927. },
  8928. handler(context, args) {
  8929. throw new ParseError(context.funcName + " valid only within array environment");
  8930. }
  8931. });
  8932. var environments = _environments;
  8933. defineFunction({
  8934. type: "environment",
  8935. names: ["\\begin", "\\end"],
  8936. props: {
  8937. numArgs: 1,
  8938. argTypes: ["text"]
  8939. },
  8940. handler(_ref, args) {
  8941. var {
  8942. parser,
  8943. funcName
  8944. } = _ref;
  8945. var nameGroup = args[0];
  8946. if (nameGroup.type !== "ordgroup") {
  8947. throw new ParseError("Invalid environment name", nameGroup);
  8948. }
  8949. var envName = "";
  8950. for (var i = 0; i < nameGroup.body.length; ++i) {
  8951. envName += assertNodeType(nameGroup.body[i], "textord").text;
  8952. }
  8953. if (funcName === "\\begin") {
  8954. if (!environments.hasOwnProperty(envName)) {
  8955. throw new ParseError("No such environment: " + envName, nameGroup);
  8956. }
  8957. var env = environments[envName];
  8958. var {
  8959. args: _args,
  8960. optArgs
  8961. } = parser.parseArguments("\\begin{" + envName + "}", env);
  8962. var context = {
  8963. mode: parser.mode,
  8964. envName,
  8965. parser
  8966. };
  8967. var result = env.handler(context, _args, optArgs);
  8968. parser.expect("\\end", false);
  8969. var endNameToken = parser.nextToken;
  8970. var end = assertNodeType(parser.parseFunction(), "environment");
  8971. if (end.name !== envName) {
  8972. throw new ParseError("Mismatch: \\begin{" + envName + "} matched by \\end{" + end.name + "}", endNameToken);
  8973. }
  8974. return result;
  8975. }
  8976. return {
  8977. type: "environment",
  8978. mode: parser.mode,
  8979. name: envName,
  8980. nameGroup
  8981. };
  8982. }
  8983. });
  8984. var htmlBuilder$5 = (group, options) => {
  8985. var font = group.font;
  8986. var newOptions = options.withFont(font);
  8987. return buildGroup$1(group.body, newOptions);
  8988. };
  8989. var mathmlBuilder$4 = (group, options) => {
  8990. var font = group.font;
  8991. var newOptions = options.withFont(font);
  8992. return buildGroup2(group.body, newOptions);
  8993. };
  8994. var fontAliases = {
  8995. "\\Bbb": "\\mathbb",
  8996. "\\bold": "\\mathbf",
  8997. "\\frak": "\\mathfrak",
  8998. "\\bm": "\\boldsymbol"
  8999. };
  9000. defineFunction({
  9001. type: "font",
  9002. names: [
  9003. // styles, except \boldsymbol defined below
  9004. "\\mathrm",
  9005. "\\mathit",
  9006. "\\mathbf",
  9007. "\\mathnormal",
  9008. "\\mathsfit",
  9009. // families
  9010. "\\mathbb",
  9011. "\\mathcal",
  9012. "\\mathfrak",
  9013. "\\mathscr",
  9014. "\\mathsf",
  9015. "\\mathtt",
  9016. // aliases, except \bm defined below
  9017. "\\Bbb",
  9018. "\\bold",
  9019. "\\frak"
  9020. ],
  9021. props: {
  9022. numArgs: 1,
  9023. allowedInArgument: true
  9024. },
  9025. handler: (_ref, args) => {
  9026. var {
  9027. parser,
  9028. funcName
  9029. } = _ref;
  9030. var body = normalizeArgument(args[0]);
  9031. var func = funcName;
  9032. if (func in fontAliases) {
  9033. func = fontAliases[func];
  9034. }
  9035. return {
  9036. type: "font",
  9037. mode: parser.mode,
  9038. font: func.slice(1),
  9039. body
  9040. };
  9041. },
  9042. htmlBuilder: htmlBuilder$5,
  9043. mathmlBuilder: mathmlBuilder$4
  9044. });
  9045. defineFunction({
  9046. type: "mclass",
  9047. names: ["\\boldsymbol", "\\bm"],
  9048. props: {
  9049. numArgs: 1
  9050. },
  9051. handler: (_ref2, args) => {
  9052. var {
  9053. parser
  9054. } = _ref2;
  9055. var body = args[0];
  9056. return {
  9057. type: "mclass",
  9058. mode: parser.mode,
  9059. mclass: binrelClass(body),
  9060. body: [{
  9061. type: "font",
  9062. mode: parser.mode,
  9063. font: "boldsymbol",
  9064. body
  9065. }],
  9066. isCharacterBox: isCharacterBox(body)
  9067. };
  9068. }
  9069. });
  9070. defineFunction({
  9071. type: "font",
  9072. names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it", "\\cal"],
  9073. props: {
  9074. numArgs: 0,
  9075. allowedInText: true
  9076. },
  9077. handler: (_ref3, args) => {
  9078. var {
  9079. parser,
  9080. funcName,
  9081. breakOnTokenText
  9082. } = _ref3;
  9083. var {
  9084. mode
  9085. } = parser;
  9086. var body = parser.parseExpression(true, breakOnTokenText);
  9087. var style = "math" + funcName.slice(1);
  9088. return {
  9089. type: "font",
  9090. mode,
  9091. font: style,
  9092. body: {
  9093. type: "ordgroup",
  9094. mode: parser.mode,
  9095. body
  9096. }
  9097. };
  9098. },
  9099. htmlBuilder: htmlBuilder$5,
  9100. mathmlBuilder: mathmlBuilder$4
  9101. });
  9102. var htmlBuilder$4 = (group, options) => {
  9103. var style = options.style;
  9104. var nstyle = style.fracNum();
  9105. var dstyle = style.fracDen();
  9106. var newOptions;
  9107. newOptions = options.havingStyle(nstyle);
  9108. var numerm = buildGroup$1(group.numer, newOptions, options);
  9109. if (group.continued) {
  9110. var hStrut = 8.5 / options.fontMetrics().ptPerEm;
  9111. var dStrut = 3.5 / options.fontMetrics().ptPerEm;
  9112. numerm.height = numerm.height < hStrut ? hStrut : numerm.height;
  9113. numerm.depth = numerm.depth < dStrut ? dStrut : numerm.depth;
  9114. }
  9115. newOptions = options.havingStyle(dstyle);
  9116. var denomm = buildGroup$1(group.denom, newOptions, options);
  9117. var rule;
  9118. var ruleWidth;
  9119. var ruleSpacing;
  9120. if (group.hasBarLine) {
  9121. if (group.barSize) {
  9122. ruleWidth = calculateSize(group.barSize, options);
  9123. rule = makeLineSpan("frac-line", options, ruleWidth);
  9124. } else {
  9125. rule = makeLineSpan("frac-line", options);
  9126. }
  9127. ruleWidth = rule.height;
  9128. ruleSpacing = rule.height;
  9129. } else {
  9130. rule = null;
  9131. ruleWidth = 0;
  9132. ruleSpacing = options.fontMetrics().defaultRuleThickness;
  9133. }
  9134. var numShift;
  9135. var clearance;
  9136. var denomShift;
  9137. if (style.size === Style$1.DISPLAY.size) {
  9138. numShift = options.fontMetrics().num1;
  9139. if (ruleWidth > 0) {
  9140. clearance = 3 * ruleSpacing;
  9141. } else {
  9142. clearance = 7 * ruleSpacing;
  9143. }
  9144. denomShift = options.fontMetrics().denom1;
  9145. } else {
  9146. if (ruleWidth > 0) {
  9147. numShift = options.fontMetrics().num2;
  9148. clearance = ruleSpacing;
  9149. } else {
  9150. numShift = options.fontMetrics().num3;
  9151. clearance = 3 * ruleSpacing;
  9152. }
  9153. denomShift = options.fontMetrics().denom2;
  9154. }
  9155. var frac;
  9156. if (!rule) {
  9157. var candidateClearance = numShift - numerm.depth - (denomm.height - denomShift);
  9158. if (candidateClearance < clearance) {
  9159. numShift += 0.5 * (clearance - candidateClearance);
  9160. denomShift += 0.5 * (clearance - candidateClearance);
  9161. }
  9162. frac = makeVList({
  9163. positionType: "individualShift",
  9164. children: [{
  9165. type: "elem",
  9166. elem: denomm,
  9167. shift: denomShift
  9168. }, {
  9169. type: "elem",
  9170. elem: numerm,
  9171. shift: -numShift
  9172. }]
  9173. });
  9174. } else {
  9175. var axisHeight = options.fontMetrics().axisHeight;
  9176. if (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth) < clearance) {
  9177. numShift += clearance - (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth));
  9178. }
  9179. if (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift) < clearance) {
  9180. denomShift += clearance - (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift));
  9181. }
  9182. var midShift = -(axisHeight - 0.5 * ruleWidth);
  9183. frac = makeVList({
  9184. positionType: "individualShift",
  9185. children: [{
  9186. type: "elem",
  9187. elem: denomm,
  9188. shift: denomShift
  9189. }, {
  9190. type: "elem",
  9191. elem: rule,
  9192. shift: midShift
  9193. }, {
  9194. type: "elem",
  9195. elem: numerm,
  9196. shift: -numShift
  9197. }]
  9198. });
  9199. }
  9200. newOptions = options.havingStyle(style);
  9201. frac.height *= newOptions.sizeMultiplier / options.sizeMultiplier;
  9202. frac.depth *= newOptions.sizeMultiplier / options.sizeMultiplier;
  9203. var delimSize;
  9204. if (style.size === Style$1.DISPLAY.size) {
  9205. delimSize = options.fontMetrics().delim1;
  9206. } else if (style.size === Style$1.SCRIPTSCRIPT.size) {
  9207. delimSize = options.havingStyle(Style$1.SCRIPT).fontMetrics().delim2;
  9208. } else {
  9209. delimSize = options.fontMetrics().delim2;
  9210. }
  9211. var leftDelim;
  9212. var rightDelim;
  9213. if (group.leftDelim == null) {
  9214. leftDelim = makeNullDelimiter(options, ["mopen"]);
  9215. } else {
  9216. leftDelim = makeCustomSizedDelim(group.leftDelim, delimSize, true, options.havingStyle(style), group.mode, ["mopen"]);
  9217. }
  9218. if (group.continued) {
  9219. rightDelim = makeSpan([]);
  9220. } else if (group.rightDelim == null) {
  9221. rightDelim = makeNullDelimiter(options, ["mclose"]);
  9222. } else {
  9223. rightDelim = makeCustomSizedDelim(group.rightDelim, delimSize, true, options.havingStyle(style), group.mode, ["mclose"]);
  9224. }
  9225. return makeSpan(["mord"].concat(newOptions.sizingClasses(options)), [leftDelim, makeSpan(["mfrac"], [frac]), rightDelim], options);
  9226. };
  9227. var mathmlBuilder$3 = (group, options) => {
  9228. var node = new MathNode("mfrac", [buildGroup2(group.numer, options), buildGroup2(group.denom, options)]);
  9229. if (!group.hasBarLine) {
  9230. node.setAttribute("linethickness", "0px");
  9231. } else if (group.barSize) {
  9232. var ruleWidth = calculateSize(group.barSize, options);
  9233. node.setAttribute("linethickness", makeEm(ruleWidth));
  9234. }
  9235. if (group.leftDelim != null || group.rightDelim != null) {
  9236. var withDelims = [];
  9237. if (group.leftDelim != null) {
  9238. var leftOp = new MathNode("mo", [new TextNode(group.leftDelim.replace("\\", ""))]);
  9239. leftOp.setAttribute("fence", "true");
  9240. withDelims.push(leftOp);
  9241. }
  9242. withDelims.push(node);
  9243. if (group.rightDelim != null) {
  9244. var rightOp = new MathNode("mo", [new TextNode(group.rightDelim.replace("\\", ""))]);
  9245. rightOp.setAttribute("fence", "true");
  9246. withDelims.push(rightOp);
  9247. }
  9248. return makeRow(withDelims);
  9249. }
  9250. return node;
  9251. };
  9252. var wrapWithStyle = (frac, style) => {
  9253. if (!style) {
  9254. return frac;
  9255. }
  9256. var wrapper = {
  9257. type: "styling",
  9258. mode: frac.mode,
  9259. style,
  9260. body: [frac]
  9261. };
  9262. return wrapper;
  9263. };
  9264. defineFunction({
  9265. type: "genfrac",
  9266. names: [
  9267. "\\cfrac",
  9268. "\\dfrac",
  9269. "\\frac",
  9270. "\\tfrac",
  9271. "\\dbinom",
  9272. "\\binom",
  9273. "\\tbinom",
  9274. "\\\\atopfrac",
  9275. // can’t be entered directly
  9276. "\\\\bracefrac",
  9277. "\\\\brackfrac"
  9278. // ditto
  9279. ],
  9280. props: {
  9281. numArgs: 2,
  9282. allowedInArgument: true
  9283. },
  9284. handler: (_ref, args) => {
  9285. var {
  9286. parser,
  9287. funcName
  9288. } = _ref;
  9289. var numer = args[0];
  9290. var denom = args[1];
  9291. var hasBarLine;
  9292. var leftDelim = null;
  9293. var rightDelim = null;
  9294. switch (funcName) {
  9295. case "\\cfrac":
  9296. case "\\dfrac":
  9297. case "\\frac":
  9298. case "\\tfrac":
  9299. hasBarLine = true;
  9300. break;
  9301. case "\\\\atopfrac":
  9302. hasBarLine = false;
  9303. break;
  9304. case "\\dbinom":
  9305. case "\\binom":
  9306. case "\\tbinom":
  9307. hasBarLine = false;
  9308. leftDelim = "(";
  9309. rightDelim = ")";
  9310. break;
  9311. case "\\\\bracefrac":
  9312. hasBarLine = false;
  9313. leftDelim = "\\{";
  9314. rightDelim = "\\}";
  9315. break;
  9316. case "\\\\brackfrac":
  9317. hasBarLine = false;
  9318. leftDelim = "[";
  9319. rightDelim = "]";
  9320. break;
  9321. default:
  9322. throw new Error("Unrecognized genfrac command");
  9323. }
  9324. var continued = funcName === "\\cfrac";
  9325. var style = null;
  9326. if (continued || funcName.startsWith("\\d")) {
  9327. style = "display";
  9328. } else if (funcName.startsWith("\\t")) {
  9329. style = "text";
  9330. }
  9331. return wrapWithStyle({
  9332. type: "genfrac",
  9333. mode: parser.mode,
  9334. numer,
  9335. denom,
  9336. continued,
  9337. hasBarLine,
  9338. leftDelim,
  9339. rightDelim,
  9340. barSize: null
  9341. }, style);
  9342. },
  9343. htmlBuilder: htmlBuilder$4,
  9344. mathmlBuilder: mathmlBuilder$3
  9345. });
  9346. defineFunction({
  9347. type: "infix",
  9348. names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"],
  9349. props: {
  9350. numArgs: 0,
  9351. infix: true
  9352. },
  9353. handler(_ref2) {
  9354. var {
  9355. parser,
  9356. funcName,
  9357. token
  9358. } = _ref2;
  9359. var replaceWith;
  9360. switch (funcName) {
  9361. case "\\over":
  9362. replaceWith = "\\frac";
  9363. break;
  9364. case "\\choose":
  9365. replaceWith = "\\binom";
  9366. break;
  9367. case "\\atop":
  9368. replaceWith = "\\\\atopfrac";
  9369. break;
  9370. case "\\brace":
  9371. replaceWith = "\\\\bracefrac";
  9372. break;
  9373. case "\\brack":
  9374. replaceWith = "\\\\brackfrac";
  9375. break;
  9376. default:
  9377. throw new Error("Unrecognized infix genfrac command");
  9378. }
  9379. return {
  9380. type: "infix",
  9381. mode: parser.mode,
  9382. replaceWith,
  9383. token
  9384. };
  9385. }
  9386. });
  9387. var stylArray = ["display", "text", "script", "scriptscript"];
  9388. var delimFromValue = function delimFromValue2(delimString) {
  9389. var delim = null;
  9390. if (delimString.length > 0) {
  9391. delim = delimString;
  9392. delim = delim === "." ? null : delim;
  9393. }
  9394. return delim;
  9395. };
  9396. defineFunction({
  9397. type: "genfrac",
  9398. names: ["\\genfrac"],
  9399. props: {
  9400. numArgs: 6,
  9401. allowedInArgument: true,
  9402. argTypes: ["math", "math", "size", "text", "math", "math"]
  9403. },
  9404. handler(_ref3, args) {
  9405. var {
  9406. parser
  9407. } = _ref3;
  9408. var numer = args[4];
  9409. var denom = args[5];
  9410. var leftNode = normalizeArgument(args[0]);
  9411. var leftDelim = leftNode.type === "atom" && leftNode.family === "open" ? delimFromValue(leftNode.text) : null;
  9412. var rightNode = normalizeArgument(args[1]);
  9413. var rightDelim = rightNode.type === "atom" && rightNode.family === "close" ? delimFromValue(rightNode.text) : null;
  9414. var barNode = assertNodeType(args[2], "size");
  9415. var hasBarLine;
  9416. var barSize = null;
  9417. if (barNode.isBlank) {
  9418. hasBarLine = true;
  9419. } else {
  9420. barSize = barNode.value;
  9421. hasBarLine = barSize.number > 0;
  9422. }
  9423. var size = null;
  9424. var styl = args[3];
  9425. if (styl.type === "ordgroup") {
  9426. if (styl.body.length > 0) {
  9427. var textOrd = assertNodeType(styl.body[0], "textord");
  9428. size = stylArray[Number(textOrd.text)];
  9429. }
  9430. } else {
  9431. styl = assertNodeType(styl, "textord");
  9432. size = stylArray[Number(styl.text)];
  9433. }
  9434. return wrapWithStyle({
  9435. type: "genfrac",
  9436. mode: parser.mode,
  9437. numer,
  9438. denom,
  9439. continued: false,
  9440. hasBarLine,
  9441. barSize,
  9442. leftDelim,
  9443. rightDelim
  9444. }, size);
  9445. }
  9446. });
  9447. defineFunction({
  9448. type: "infix",
  9449. names: ["\\above"],
  9450. props: {
  9451. numArgs: 1,
  9452. argTypes: ["size"],
  9453. infix: true
  9454. },
  9455. handler(_ref4, args) {
  9456. var {
  9457. parser,
  9458. funcName,
  9459. token
  9460. } = _ref4;
  9461. return {
  9462. type: "infix",
  9463. mode: parser.mode,
  9464. replaceWith: "\\\\abovefrac",
  9465. size: assertNodeType(args[0], "size").value,
  9466. token
  9467. };
  9468. }
  9469. });
  9470. defineFunction({
  9471. type: "genfrac",
  9472. names: ["\\\\abovefrac"],
  9473. props: {
  9474. numArgs: 3,
  9475. argTypes: ["math", "size", "math"]
  9476. },
  9477. handler: (_ref5, args) => {
  9478. var {
  9479. parser,
  9480. funcName
  9481. } = _ref5;
  9482. var numer = args[0];
  9483. var barSize = assertNodeType(args[1], "infix").size;
  9484. if (!barSize) {
  9485. throw new Error("\\\\abovefrac expected size, but got " + String(barSize));
  9486. }
  9487. var denom = args[2];
  9488. var hasBarLine = barSize.number > 0;
  9489. return {
  9490. type: "genfrac",
  9491. mode: parser.mode,
  9492. numer,
  9493. denom,
  9494. continued: false,
  9495. hasBarLine,
  9496. barSize,
  9497. leftDelim: null,
  9498. rightDelim: null
  9499. };
  9500. }
  9501. });
  9502. var htmlBuilder$3 = (grp, options) => {
  9503. var style = options.style;
  9504. var supSubGroup;
  9505. var group;
  9506. if (grp.type === "supsub") {
  9507. supSubGroup = grp.sup ? buildGroup$1(grp.sup, options.havingStyle(style.sup()), options) : buildGroup$1(grp.sub, options.havingStyle(style.sub()), options);
  9508. group = assertNodeType(grp.base, "horizBrace");
  9509. } else {
  9510. group = assertNodeType(grp, "horizBrace");
  9511. }
  9512. var body = buildGroup$1(group.base, options.havingBaseStyle(Style$1.DISPLAY));
  9513. var braceBody = stretchySvg(group, options);
  9514. var vlist;
  9515. if (group.isOver) {
  9516. vlist = makeVList({
  9517. positionType: "firstBaseline",
  9518. children: [{
  9519. type: "elem",
  9520. elem: body
  9521. }, {
  9522. type: "kern",
  9523. size: 0.1
  9524. }, {
  9525. type: "elem",
  9526. elem: braceBody
  9527. }]
  9528. });
  9529. vlist.children[0].children[0].children[1].classes.push("svg-align");
  9530. } else {
  9531. vlist = makeVList({
  9532. positionType: "bottom",
  9533. positionData: body.depth + 0.1 + braceBody.height,
  9534. children: [{
  9535. type: "elem",
  9536. elem: braceBody
  9537. }, {
  9538. type: "kern",
  9539. size: 0.1
  9540. }, {
  9541. type: "elem",
  9542. elem: body
  9543. }]
  9544. });
  9545. vlist.children[0].children[0].children[0].classes.push("svg-align");
  9546. }
  9547. if (supSubGroup) {
  9548. var vSpan = makeSpan(["minner", group.isOver ? "mover" : "munder"], [vlist], options);
  9549. if (group.isOver) {
  9550. vlist = makeVList({
  9551. positionType: "firstBaseline",
  9552. children: [{
  9553. type: "elem",
  9554. elem: vSpan
  9555. }, {
  9556. type: "kern",
  9557. size: 0.2
  9558. }, {
  9559. type: "elem",
  9560. elem: supSubGroup
  9561. }]
  9562. });
  9563. } else {
  9564. vlist = makeVList({
  9565. positionType: "bottom",
  9566. positionData: vSpan.depth + 0.2 + supSubGroup.height + supSubGroup.depth,
  9567. children: [{
  9568. type: "elem",
  9569. elem: supSubGroup
  9570. }, {
  9571. type: "kern",
  9572. size: 0.2
  9573. }, {
  9574. type: "elem",
  9575. elem: vSpan
  9576. }]
  9577. });
  9578. }
  9579. }
  9580. return makeSpan(["minner", group.isOver ? "mover" : "munder"], [vlist], options);
  9581. };
  9582. var mathmlBuilder$2 = (group, options) => {
  9583. var accentNode = stretchyMathML(group.label);
  9584. return new MathNode(group.isOver ? "mover" : "munder", [buildGroup2(group.base, options), accentNode]);
  9585. };
  9586. defineFunction({
  9587. type: "horizBrace",
  9588. names: ["\\overbrace", "\\underbrace", "\\overbracket", "\\underbracket"],
  9589. props: {
  9590. numArgs: 1
  9591. },
  9592. handler(_ref, args) {
  9593. var {
  9594. parser,
  9595. funcName
  9596. } = _ref;
  9597. return {
  9598. type: "horizBrace",
  9599. mode: parser.mode,
  9600. label: funcName,
  9601. isOver: funcName.includes("\\over"),
  9602. base: args[0]
  9603. };
  9604. },
  9605. htmlBuilder: htmlBuilder$3,
  9606. mathmlBuilder: mathmlBuilder$2
  9607. });
  9608. defineFunction({
  9609. type: "href",
  9610. names: ["\\href"],
  9611. props: {
  9612. numArgs: 2,
  9613. argTypes: ["url", "original"],
  9614. allowedInText: true
  9615. },
  9616. handler: (_ref, args) => {
  9617. var {
  9618. parser
  9619. } = _ref;
  9620. var body = args[1];
  9621. var href = assertNodeType(args[0], "url").url;
  9622. if (!parser.settings.isTrusted({
  9623. command: "\\href",
  9624. url: href
  9625. })) {
  9626. return parser.formatUnsupportedCmd("\\href");
  9627. }
  9628. return {
  9629. type: "href",
  9630. mode: parser.mode,
  9631. href,
  9632. body: ordargument(body)
  9633. };
  9634. },
  9635. htmlBuilder: (group, options) => {
  9636. var elements = buildExpression$1(group.body, options, false);
  9637. return makeAnchor(group.href, [], elements, options);
  9638. },
  9639. mathmlBuilder: (group, options) => {
  9640. var math2 = buildExpressionRow(group.body, options);
  9641. if (!(math2 instanceof MathNode)) {
  9642. math2 = new MathNode("mrow", [math2]);
  9643. }
  9644. math2.setAttribute("href", group.href);
  9645. return math2;
  9646. }
  9647. });
  9648. defineFunction({
  9649. type: "href",
  9650. names: ["\\url"],
  9651. props: {
  9652. numArgs: 1,
  9653. argTypes: ["url"],
  9654. allowedInText: true
  9655. },
  9656. handler: (_ref2, args) => {
  9657. var {
  9658. parser
  9659. } = _ref2;
  9660. var href = assertNodeType(args[0], "url").url;
  9661. if (!parser.settings.isTrusted({
  9662. command: "\\url",
  9663. url: href
  9664. })) {
  9665. return parser.formatUnsupportedCmd("\\url");
  9666. }
  9667. var chars = [];
  9668. for (var i = 0; i < href.length; i++) {
  9669. var c = href[i];
  9670. if (c === "~") {
  9671. c = "\\textasciitilde";
  9672. }
  9673. chars.push({
  9674. type: "textord",
  9675. mode: "text",
  9676. text: c
  9677. });
  9678. }
  9679. var body = {
  9680. type: "text",
  9681. mode: parser.mode,
  9682. font: "\\texttt",
  9683. body: chars
  9684. };
  9685. return {
  9686. type: "href",
  9687. mode: parser.mode,
  9688. href,
  9689. body: ordargument(body)
  9690. };
  9691. }
  9692. });
  9693. defineFunction({
  9694. type: "hbox",
  9695. names: ["\\hbox"],
  9696. props: {
  9697. numArgs: 1,
  9698. argTypes: ["text"],
  9699. allowedInText: true,
  9700. primitive: true
  9701. },
  9702. handler(_ref, args) {
  9703. var {
  9704. parser
  9705. } = _ref;
  9706. return {
  9707. type: "hbox",
  9708. mode: parser.mode,
  9709. body: ordargument(args[0])
  9710. };
  9711. },
  9712. htmlBuilder(group, options) {
  9713. var elements = buildExpression$1(group.body, options, false);
  9714. return makeFragment(elements);
  9715. },
  9716. mathmlBuilder(group, options) {
  9717. return new MathNode("mrow", buildExpression2(group.body, options));
  9718. }
  9719. });
  9720. defineFunction({
  9721. type: "html",
  9722. names: ["\\htmlClass", "\\htmlId", "\\htmlStyle", "\\htmlData"],
  9723. props: {
  9724. numArgs: 2,
  9725. argTypes: ["raw", "original"],
  9726. allowedInText: true
  9727. },
  9728. handler: (_ref, args) => {
  9729. var {
  9730. parser,
  9731. funcName,
  9732. token
  9733. } = _ref;
  9734. var value = assertNodeType(args[0], "raw").string;
  9735. var body = args[1];
  9736. if (parser.settings.strict) {
  9737. parser.settings.reportNonstrict("htmlExtension", "HTML extension is disabled on strict mode");
  9738. }
  9739. var trustContext;
  9740. var attributes = {};
  9741. switch (funcName) {
  9742. case "\\htmlClass":
  9743. attributes.class = value;
  9744. trustContext = {
  9745. command: "\\htmlClass",
  9746. class: value
  9747. };
  9748. break;
  9749. case "\\htmlId":
  9750. attributes.id = value;
  9751. trustContext = {
  9752. command: "\\htmlId",
  9753. id: value
  9754. };
  9755. break;
  9756. case "\\htmlStyle":
  9757. attributes.style = value;
  9758. trustContext = {
  9759. command: "\\htmlStyle",
  9760. style: value
  9761. };
  9762. break;
  9763. case "\\htmlData": {
  9764. var data = value.split(",");
  9765. for (var i = 0; i < data.length; i++) {
  9766. var item = data[i];
  9767. var firstEquals = item.indexOf("=");
  9768. if (firstEquals < 0) {
  9769. throw new ParseError("\\htmlData key/value '" + item + "' missing equals sign");
  9770. }
  9771. var key = item.slice(0, firstEquals);
  9772. var _value = item.slice(firstEquals + 1);
  9773. attributes["data-" + key.trim()] = _value;
  9774. }
  9775. trustContext = {
  9776. command: "\\htmlData",
  9777. attributes
  9778. };
  9779. break;
  9780. }
  9781. default:
  9782. throw new Error("Unrecognized html command");
  9783. }
  9784. if (!parser.settings.isTrusted(trustContext)) {
  9785. return parser.formatUnsupportedCmd(funcName);
  9786. }
  9787. return {
  9788. type: "html",
  9789. mode: parser.mode,
  9790. attributes,
  9791. body: ordargument(body)
  9792. };
  9793. },
  9794. htmlBuilder: (group, options) => {
  9795. var elements = buildExpression$1(group.body, options, false);
  9796. var classes = ["enclosing"];
  9797. if (group.attributes.class) {
  9798. classes.push(...group.attributes.class.trim().split(/\s+/));
  9799. }
  9800. var span = makeSpan(classes, elements, options);
  9801. for (var attr in group.attributes) {
  9802. if (attr !== "class" && group.attributes.hasOwnProperty(attr)) {
  9803. span.setAttribute(attr, group.attributes[attr]);
  9804. }
  9805. }
  9806. return span;
  9807. },
  9808. mathmlBuilder: (group, options) => {
  9809. return buildExpressionRow(group.body, options);
  9810. }
  9811. });
  9812. defineFunction({
  9813. type: "htmlmathml",
  9814. names: ["\\html@mathml"],
  9815. props: {
  9816. numArgs: 2,
  9817. allowedInArgument: true,
  9818. allowedInText: true
  9819. },
  9820. handler: (_ref, args) => {
  9821. var {
  9822. parser
  9823. } = _ref;
  9824. return {
  9825. type: "htmlmathml",
  9826. mode: parser.mode,
  9827. html: ordargument(args[0]),
  9828. mathml: ordargument(args[1])
  9829. };
  9830. },
  9831. htmlBuilder: (group, options) => {
  9832. var elements = buildExpression$1(group.html, options, false);
  9833. return makeFragment(elements);
  9834. },
  9835. mathmlBuilder: (group, options) => {
  9836. return buildExpressionRow(group.mathml, options);
  9837. }
  9838. });
  9839. var sizeData = function sizeData2(str) {
  9840. if (/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(str)) {
  9841. return {
  9842. number: +str,
  9843. unit: "bp"
  9844. };
  9845. } else {
  9846. var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(str);
  9847. if (!match) {
  9848. throw new ParseError("Invalid size: '" + str + "' in \\includegraphics");
  9849. }
  9850. var data = {
  9851. number: +(match[1] + match[2]),
  9852. // sign + magnitude, cast to number
  9853. unit: match[3]
  9854. };
  9855. if (!validUnit(data)) {
  9856. throw new ParseError("Invalid unit: '" + data.unit + "' in \\includegraphics.");
  9857. }
  9858. return data;
  9859. }
  9860. };
  9861. defineFunction({
  9862. type: "includegraphics",
  9863. names: ["\\includegraphics"],
  9864. props: {
  9865. numArgs: 1,
  9866. numOptionalArgs: 1,
  9867. argTypes: ["raw", "url"],
  9868. allowedInText: false
  9869. },
  9870. handler: (_ref, args, optArgs) => {
  9871. var {
  9872. parser
  9873. } = _ref;
  9874. var width = {
  9875. number: 0,
  9876. unit: "em"
  9877. };
  9878. var height = {
  9879. number: 0.9,
  9880. unit: "em"
  9881. };
  9882. var totalheight = {
  9883. number: 0,
  9884. unit: "em"
  9885. };
  9886. var alt = "";
  9887. if (optArgs[0]) {
  9888. var attributeStr = assertNodeType(optArgs[0], "raw").string;
  9889. var attributes = attributeStr.split(",");
  9890. for (var i = 0; i < attributes.length; i++) {
  9891. var keyVal = attributes[i].split("=");
  9892. if (keyVal.length === 2) {
  9893. var str = keyVal[1].trim();
  9894. switch (keyVal[0].trim()) {
  9895. case "alt":
  9896. alt = str;
  9897. break;
  9898. case "width":
  9899. width = sizeData(str);
  9900. break;
  9901. case "height":
  9902. height = sizeData(str);
  9903. break;
  9904. case "totalheight":
  9905. totalheight = sizeData(str);
  9906. break;
  9907. default:
  9908. throw new ParseError("Invalid key: '" + keyVal[0] + "' in \\includegraphics.");
  9909. }
  9910. }
  9911. }
  9912. }
  9913. var src = assertNodeType(args[0], "url").url;
  9914. if (alt === "") {
  9915. alt = src;
  9916. alt = alt.replace(/^.*[\\/]/, "");
  9917. alt = alt.substring(0, alt.lastIndexOf("."));
  9918. }
  9919. if (!parser.settings.isTrusted({
  9920. command: "\\includegraphics",
  9921. url: src
  9922. })) {
  9923. return parser.formatUnsupportedCmd("\\includegraphics");
  9924. }
  9925. return {
  9926. type: "includegraphics",
  9927. mode: parser.mode,
  9928. alt,
  9929. width,
  9930. height,
  9931. totalheight,
  9932. src
  9933. };
  9934. },
  9935. htmlBuilder: (group, options) => {
  9936. var height = calculateSize(group.height, options);
  9937. var depth = 0;
  9938. if (group.totalheight.number > 0) {
  9939. depth = calculateSize(group.totalheight, options) - height;
  9940. }
  9941. var width = 0;
  9942. if (group.width.number > 0) {
  9943. width = calculateSize(group.width, options);
  9944. }
  9945. var style = {
  9946. height: makeEm(height + depth)
  9947. };
  9948. if (width > 0) {
  9949. style.width = makeEm(width);
  9950. }
  9951. if (depth > 0) {
  9952. style.verticalAlign = makeEm(-depth);
  9953. }
  9954. var node = new Img(group.src, group.alt, style);
  9955. node.height = height;
  9956. node.depth = depth;
  9957. return node;
  9958. },
  9959. mathmlBuilder: (group, options) => {
  9960. var node = new MathNode("mglyph", []);
  9961. node.setAttribute("alt", group.alt);
  9962. var height = calculateSize(group.height, options);
  9963. var depth = 0;
  9964. if (group.totalheight.number > 0) {
  9965. depth = calculateSize(group.totalheight, options) - height;
  9966. node.setAttribute("valign", makeEm(-depth));
  9967. }
  9968. node.setAttribute("height", makeEm(height + depth));
  9969. if (group.width.number > 0) {
  9970. var width = calculateSize(group.width, options);
  9971. node.setAttribute("width", makeEm(width));
  9972. }
  9973. node.setAttribute("src", group.src);
  9974. return node;
  9975. }
  9976. });
  9977. defineFunction({
  9978. type: "kern",
  9979. names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"],
  9980. props: {
  9981. numArgs: 1,
  9982. argTypes: ["size"],
  9983. primitive: true,
  9984. allowedInText: true
  9985. },
  9986. handler(_ref, args) {
  9987. var {
  9988. parser,
  9989. funcName
  9990. } = _ref;
  9991. var size = assertNodeType(args[0], "size");
  9992. if (parser.settings.strict) {
  9993. var mathFunction = funcName[1] === "m";
  9994. var muUnit = size.value.unit === "mu";
  9995. if (mathFunction) {
  9996. if (!muUnit) {
  9997. parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " supports only mu units, " + ("not " + size.value.unit + " units"));
  9998. }
  9999. if (parser.mode !== "math") {
  10000. parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " works only in math mode");
  10001. }
  10002. } else {
  10003. if (muUnit) {
  10004. parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " doesn't support mu units");
  10005. }
  10006. }
  10007. }
  10008. return {
  10009. type: "kern",
  10010. mode: parser.mode,
  10011. dimension: size.value
  10012. };
  10013. },
  10014. htmlBuilder(group, options) {
  10015. return makeGlue(group.dimension, options);
  10016. },
  10017. mathmlBuilder(group, options) {
  10018. var dimension = calculateSize(group.dimension, options);
  10019. return new SpaceNode(dimension);
  10020. }
  10021. });
  10022. defineFunction({
  10023. type: "lap",
  10024. names: ["\\mathllap", "\\mathrlap", "\\mathclap"],
  10025. props: {
  10026. numArgs: 1,
  10027. allowedInText: true
  10028. },
  10029. handler: (_ref, args) => {
  10030. var {
  10031. parser,
  10032. funcName
  10033. } = _ref;
  10034. var body = args[0];
  10035. return {
  10036. type: "lap",
  10037. mode: parser.mode,
  10038. alignment: funcName.slice(5),
  10039. body
  10040. };
  10041. },
  10042. htmlBuilder: (group, options) => {
  10043. var inner2;
  10044. if (group.alignment === "clap") {
  10045. inner2 = makeSpan([], [buildGroup$1(group.body, options)]);
  10046. inner2 = makeSpan(["inner"], [inner2], options);
  10047. } else {
  10048. inner2 = makeSpan(["inner"], [buildGroup$1(group.body, options)]);
  10049. }
  10050. var fix = makeSpan(["fix"], []);
  10051. var node = makeSpan([group.alignment], [inner2, fix], options);
  10052. var strut = makeSpan(["strut"]);
  10053. strut.style.height = makeEm(node.height + node.depth);
  10054. if (node.depth) {
  10055. strut.style.verticalAlign = makeEm(-node.depth);
  10056. }
  10057. node.children.unshift(strut);
  10058. node = makeSpan(["thinbox"], [node], options);
  10059. return makeSpan(["mord", "vbox"], [node], options);
  10060. },
  10061. mathmlBuilder: (group, options) => {
  10062. var node = new MathNode("mpadded", [buildGroup2(group.body, options)]);
  10063. if (group.alignment !== "rlap") {
  10064. var offset = group.alignment === "llap" ? "-1" : "-0.5";
  10065. node.setAttribute("lspace", offset + "width");
  10066. }
  10067. node.setAttribute("width", "0px");
  10068. return node;
  10069. }
  10070. });
  10071. defineFunction({
  10072. type: "styling",
  10073. names: ["\\(", "$"],
  10074. props: {
  10075. numArgs: 0,
  10076. allowedInText: true,
  10077. allowedInMath: false
  10078. },
  10079. handler(_ref, args) {
  10080. var {
  10081. funcName,
  10082. parser
  10083. } = _ref;
  10084. var outerMode = parser.mode;
  10085. parser.switchMode("math");
  10086. var close2 = funcName === "\\(" ? "\\)" : "$";
  10087. var body = parser.parseExpression(false, close2);
  10088. parser.expect(close2);
  10089. parser.switchMode(outerMode);
  10090. return {
  10091. type: "styling",
  10092. mode: parser.mode,
  10093. style: "text",
  10094. body
  10095. };
  10096. }
  10097. });
  10098. defineFunction({
  10099. type: "text",
  10100. // Doesn't matter what this is.
  10101. names: ["\\)", "\\]"],
  10102. props: {
  10103. numArgs: 0,
  10104. allowedInText: true,
  10105. allowedInMath: false
  10106. },
  10107. handler(context, args) {
  10108. throw new ParseError("Mismatched " + context.funcName);
  10109. }
  10110. });
  10111. var chooseMathStyle = (group, options) => {
  10112. switch (options.style.size) {
  10113. case Style$1.DISPLAY.size:
  10114. return group.display;
  10115. case Style$1.TEXT.size:
  10116. return group.text;
  10117. case Style$1.SCRIPT.size:
  10118. return group.script;
  10119. case Style$1.SCRIPTSCRIPT.size:
  10120. return group.scriptscript;
  10121. default:
  10122. return group.text;
  10123. }
  10124. };
  10125. defineFunction({
  10126. type: "mathchoice",
  10127. names: ["\\mathchoice"],
  10128. props: {
  10129. numArgs: 4,
  10130. primitive: true
  10131. },
  10132. handler: (_ref, args) => {
  10133. var {
  10134. parser
  10135. } = _ref;
  10136. return {
  10137. type: "mathchoice",
  10138. mode: parser.mode,
  10139. display: ordargument(args[0]),
  10140. text: ordargument(args[1]),
  10141. script: ordargument(args[2]),
  10142. scriptscript: ordargument(args[3])
  10143. };
  10144. },
  10145. htmlBuilder: (group, options) => {
  10146. var body = chooseMathStyle(group, options);
  10147. var elements = buildExpression$1(body, options, false);
  10148. return makeFragment(elements);
  10149. },
  10150. mathmlBuilder: (group, options) => {
  10151. var body = chooseMathStyle(group, options);
  10152. return buildExpressionRow(body, options);
  10153. }
  10154. });
  10155. var assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShift) => {
  10156. base = makeSpan([], [base]);
  10157. var subIsSingleCharacter = subGroup && isCharacterBox(subGroup);
  10158. var sub2;
  10159. var sup2;
  10160. if (supGroup) {
  10161. var elem = buildGroup$1(supGroup, options.havingStyle(style.sup()), options);
  10162. sup2 = {
  10163. elem,
  10164. kern: Math.max(options.fontMetrics().bigOpSpacing1, options.fontMetrics().bigOpSpacing3 - elem.depth)
  10165. };
  10166. }
  10167. if (subGroup) {
  10168. var _elem = buildGroup$1(subGroup, options.havingStyle(style.sub()), options);
  10169. sub2 = {
  10170. elem: _elem,
  10171. kern: Math.max(options.fontMetrics().bigOpSpacing2, options.fontMetrics().bigOpSpacing4 - _elem.height)
  10172. };
  10173. }
  10174. var finalGroup;
  10175. if (sup2 && sub2) {
  10176. var bottom = options.fontMetrics().bigOpSpacing5 + sub2.elem.height + sub2.elem.depth + sub2.kern + base.depth + baseShift;
  10177. finalGroup = makeVList({
  10178. positionType: "bottom",
  10179. positionData: bottom,
  10180. children: [{
  10181. type: "kern",
  10182. size: options.fontMetrics().bigOpSpacing5
  10183. }, {
  10184. type: "elem",
  10185. elem: sub2.elem,
  10186. marginLeft: makeEm(-slant)
  10187. }, {
  10188. type: "kern",
  10189. size: sub2.kern
  10190. }, {
  10191. type: "elem",
  10192. elem: base
  10193. }, {
  10194. type: "kern",
  10195. size: sup2.kern
  10196. }, {
  10197. type: "elem",
  10198. elem: sup2.elem,
  10199. marginLeft: makeEm(slant)
  10200. }, {
  10201. type: "kern",
  10202. size: options.fontMetrics().bigOpSpacing5
  10203. }]
  10204. });
  10205. } else if (sub2) {
  10206. var top = base.height - baseShift;
  10207. finalGroup = makeVList({
  10208. positionType: "top",
  10209. positionData: top,
  10210. children: [{
  10211. type: "kern",
  10212. size: options.fontMetrics().bigOpSpacing5
  10213. }, {
  10214. type: "elem",
  10215. elem: sub2.elem,
  10216. marginLeft: makeEm(-slant)
  10217. }, {
  10218. type: "kern",
  10219. size: sub2.kern
  10220. }, {
  10221. type: "elem",
  10222. elem: base
  10223. }]
  10224. });
  10225. } else if (sup2) {
  10226. var _bottom = base.depth + baseShift;
  10227. finalGroup = makeVList({
  10228. positionType: "bottom",
  10229. positionData: _bottom,
  10230. children: [{
  10231. type: "elem",
  10232. elem: base
  10233. }, {
  10234. type: "kern",
  10235. size: sup2.kern
  10236. }, {
  10237. type: "elem",
  10238. elem: sup2.elem,
  10239. marginLeft: makeEm(slant)
  10240. }, {
  10241. type: "kern",
  10242. size: options.fontMetrics().bigOpSpacing5
  10243. }]
  10244. });
  10245. } else {
  10246. return base;
  10247. }
  10248. var parts = [finalGroup];
  10249. if (sub2 && slant !== 0 && !subIsSingleCharacter) {
  10250. var spacer = makeSpan(["mspace"], [], options);
  10251. spacer.style.marginRight = makeEm(slant);
  10252. parts.unshift(spacer);
  10253. }
  10254. return makeSpan(["mop", "op-limits"], parts, options);
  10255. };
  10256. var noSuccessor = /* @__PURE__ */ new Set(["\\smallint"]);
  10257. var htmlBuilder$2 = (grp, options) => {
  10258. var supGroup;
  10259. var subGroup;
  10260. var hasLimits = false;
  10261. var group;
  10262. if (grp.type === "supsub") {
  10263. supGroup = grp.sup;
  10264. subGroup = grp.sub;
  10265. group = assertNodeType(grp.base, "op");
  10266. hasLimits = true;
  10267. } else {
  10268. group = assertNodeType(grp, "op");
  10269. }
  10270. var style = options.style;
  10271. var large = false;
  10272. if (style.size === Style$1.DISPLAY.size && group.symbol && !noSuccessor.has(group.name)) {
  10273. large = true;
  10274. }
  10275. var base;
  10276. if (group.symbol) {
  10277. var fontName = large ? "Size2-Regular" : "Size1-Regular";
  10278. var stash = "";
  10279. if (group.name === "\\oiint" || group.name === "\\oiiint") {
  10280. stash = group.name.slice(1);
  10281. group.name = stash === "oiint" ? "\\iint" : "\\iiint";
  10282. }
  10283. base = makeSymbol(group.name, fontName, "math", options, ["mop", "op-symbol", large ? "large-op" : "small-op"]);
  10284. if (stash.length > 0) {
  10285. var italic = base.italic;
  10286. var oval = staticSvg(stash + "Size" + (large ? "2" : "1"), options);
  10287. base = makeVList({
  10288. positionType: "individualShift",
  10289. children: [{
  10290. type: "elem",
  10291. elem: base,
  10292. shift: 0
  10293. }, {
  10294. type: "elem",
  10295. elem: oval,
  10296. shift: large ? 0.08 : 0
  10297. }]
  10298. });
  10299. group.name = "\\" + stash;
  10300. base.classes.unshift("mop");
  10301. base.italic = italic;
  10302. }
  10303. } else if (group.body) {
  10304. var inner2 = buildExpression$1(group.body, options, true);
  10305. if (inner2.length === 1 && inner2[0] instanceof SymbolNode) {
  10306. base = inner2[0];
  10307. base.classes[0] = "mop";
  10308. } else {
  10309. base = makeSpan(["mop"], inner2, options);
  10310. }
  10311. } else {
  10312. var output = [];
  10313. for (var i = 1; i < group.name.length; i++) {
  10314. output.push(mathsym(group.name[i], group.mode, options));
  10315. }
  10316. base = makeSpan(["mop"], output, options);
  10317. }
  10318. var baseShift = 0;
  10319. var slant = 0;
  10320. if ((base instanceof SymbolNode || group.name === "\\oiint" || group.name === "\\oiiint") && !group.suppressBaseShift) {
  10321. baseShift = (base.height - base.depth) / 2 - options.fontMetrics().axisHeight;
  10322. slant = base.italic || 0;
  10323. }
  10324. if (hasLimits) {
  10325. return assembleSupSub(base, supGroup, subGroup, options, style, slant, baseShift);
  10326. } else {
  10327. if (baseShift) {
  10328. base.style.position = "relative";
  10329. base.style.top = makeEm(baseShift);
  10330. }
  10331. return base;
  10332. }
  10333. };
  10334. var mathmlBuilder$1 = (group, options) => {
  10335. var node;
  10336. if (group.symbol) {
  10337. node = new MathNode("mo", [makeText(group.name, group.mode)]);
  10338. if (noSuccessor.has(group.name)) {
  10339. node.setAttribute("largeop", "false");
  10340. }
  10341. } else if (group.body) {
  10342. node = new MathNode("mo", buildExpression2(group.body, options));
  10343. } else {
  10344. node = new MathNode("mi", [new TextNode(group.name.slice(1))]);
  10345. var operator = new MathNode("mo", [makeText("⁡", "text")]);
  10346. if (group.parentIsSupSub) {
  10347. node = new MathNode("mrow", [node, operator]);
  10348. } else {
  10349. node = newDocumentFragment([node, operator]);
  10350. }
  10351. }
  10352. return node;
  10353. };
  10354. var singleCharBigOps = {
  10355. "∏": "\\prod",
  10356. "∐": "\\coprod",
  10357. "∑": "\\sum",
  10358. "⋀": "\\bigwedge",
  10359. "⋁": "\\bigvee",
  10360. "⋂": "\\bigcap",
  10361. "⋃": "\\bigcup",
  10362. "⨀": "\\bigodot",
  10363. "⨁": "\\bigoplus",
  10364. "⨂": "\\bigotimes",
  10365. "⨄": "\\biguplus",
  10366. "⨆": "\\bigsqcup"
  10367. };
  10368. defineFunction({
  10369. type: "op",
  10370. names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "∏", "∐", "∑", "⋀", "⋁", "⋂", "⋃", "⨀", "⨁", "⨂", "⨄", "⨆"],
  10371. props: {
  10372. numArgs: 0
  10373. },
  10374. handler: (_ref, args) => {
  10375. var {
  10376. parser,
  10377. funcName
  10378. } = _ref;
  10379. var fName = funcName;
  10380. if (fName.length === 1) {
  10381. fName = singleCharBigOps[fName];
  10382. }
  10383. return {
  10384. type: "op",
  10385. mode: parser.mode,
  10386. limits: true,
  10387. parentIsSupSub: false,
  10388. symbol: true,
  10389. name: fName
  10390. };
  10391. },
  10392. htmlBuilder: htmlBuilder$2,
  10393. mathmlBuilder: mathmlBuilder$1
  10394. });
  10395. defineFunction({
  10396. type: "op",
  10397. names: ["\\mathop"],
  10398. props: {
  10399. numArgs: 1,
  10400. primitive: true
  10401. },
  10402. handler: (_ref2, args) => {
  10403. var {
  10404. parser
  10405. } = _ref2;
  10406. var body = args[0];
  10407. return {
  10408. type: "op",
  10409. mode: parser.mode,
  10410. limits: false,
  10411. parentIsSupSub: false,
  10412. symbol: false,
  10413. body: ordargument(body)
  10414. };
  10415. },
  10416. htmlBuilder: htmlBuilder$2,
  10417. mathmlBuilder: mathmlBuilder$1
  10418. });
  10419. var singleCharIntegrals = {
  10420. "∫": "\\int",
  10421. "∬": "\\iint",
  10422. "∭": "\\iiint",
  10423. "∮": "\\oint",
  10424. "∯": "\\oiint",
  10425. "∰": "\\oiiint"
  10426. };
  10427. defineFunction({
  10428. type: "op",
  10429. names: ["\\arcsin", "\\arccos", "\\arctan", "\\arctg", "\\arcctg", "\\arg", "\\ch", "\\cos", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\deg", "\\dim", "\\exp", "\\hom", "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\sh", "\\tan", "\\tanh", "\\tg", "\\th"],
  10430. props: {
  10431. numArgs: 0
  10432. },
  10433. handler(_ref3) {
  10434. var {
  10435. parser,
  10436. funcName
  10437. } = _ref3;
  10438. return {
  10439. type: "op",
  10440. mode: parser.mode,
  10441. limits: false,
  10442. parentIsSupSub: false,
  10443. symbol: false,
  10444. name: funcName
  10445. };
  10446. },
  10447. htmlBuilder: htmlBuilder$2,
  10448. mathmlBuilder: mathmlBuilder$1
  10449. });
  10450. defineFunction({
  10451. type: "op",
  10452. names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"],
  10453. props: {
  10454. numArgs: 0
  10455. },
  10456. handler(_ref4) {
  10457. var {
  10458. parser,
  10459. funcName
  10460. } = _ref4;
  10461. return {
  10462. type: "op",
  10463. mode: parser.mode,
  10464. limits: true,
  10465. parentIsSupSub: false,
  10466. symbol: false,
  10467. name: funcName
  10468. };
  10469. },
  10470. htmlBuilder: htmlBuilder$2,
  10471. mathmlBuilder: mathmlBuilder$1
  10472. });
  10473. defineFunction({
  10474. type: "op",
  10475. names: ["\\int", "\\iint", "\\iiint", "\\oint", "\\oiint", "\\oiiint", "∫", "∬", "∭", "∮", "∯", "∰"],
  10476. props: {
  10477. numArgs: 0,
  10478. allowedInArgument: true
  10479. },
  10480. handler(_ref5) {
  10481. var {
  10482. parser,
  10483. funcName
  10484. } = _ref5;
  10485. var fName = funcName;
  10486. if (fName.length === 1) {
  10487. fName = singleCharIntegrals[fName];
  10488. }
  10489. return {
  10490. type: "op",
  10491. mode: parser.mode,
  10492. limits: false,
  10493. parentIsSupSub: false,
  10494. symbol: true,
  10495. name: fName
  10496. };
  10497. },
  10498. htmlBuilder: htmlBuilder$2,
  10499. mathmlBuilder: mathmlBuilder$1
  10500. });
  10501. var htmlBuilder$1 = (grp, options) => {
  10502. var supGroup;
  10503. var subGroup;
  10504. var hasLimits = false;
  10505. var group;
  10506. if (grp.type === "supsub") {
  10507. supGroup = grp.sup;
  10508. subGroup = grp.sub;
  10509. group = assertNodeType(grp.base, "operatorname");
  10510. hasLimits = true;
  10511. } else {
  10512. group = assertNodeType(grp, "operatorname");
  10513. }
  10514. var base;
  10515. if (group.body.length > 0) {
  10516. var body = group.body.map((child2) => {
  10517. var childText = "text" in child2 ? child2.text : void 0;
  10518. if (typeof childText === "string") {
  10519. return {
  10520. type: "textord",
  10521. mode: child2.mode,
  10522. text: childText
  10523. };
  10524. } else {
  10525. return child2;
  10526. }
  10527. });
  10528. var expression = buildExpression$1(body, options.withFont("mathrm"), true);
  10529. for (var i = 0; i < expression.length; i++) {
  10530. var child = expression[i];
  10531. if (child instanceof SymbolNode) {
  10532. child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*");
  10533. }
  10534. }
  10535. base = makeSpan(["mop"], expression, options);
  10536. } else {
  10537. base = makeSpan(["mop"], [], options);
  10538. }
  10539. if (hasLimits) {
  10540. return assembleSupSub(base, supGroup, subGroup, options, options.style, 0, 0);
  10541. } else {
  10542. return base;
  10543. }
  10544. };
  10545. var mathmlBuilder2 = (group, options) => {
  10546. var expression = buildExpression2(group.body, options.withFont("mathrm"));
  10547. var isAllString = true;
  10548. for (var i = 0; i < expression.length; i++) {
  10549. var node = expression[i];
  10550. if (node instanceof SpaceNode) ;
  10551. else if (node instanceof MathNode) {
  10552. switch (node.type) {
  10553. case "mi":
  10554. case "mn":
  10555. case "mspace":
  10556. case "mtext":
  10557. break;
  10558. // Do nothing yet.
  10559. case "mo": {
  10560. var child = node.children[0];
  10561. if (node.children.length === 1 && child instanceof TextNode) {
  10562. child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*");
  10563. } else {
  10564. isAllString = false;
  10565. }
  10566. break;
  10567. }
  10568. default:
  10569. isAllString = false;
  10570. }
  10571. } else {
  10572. isAllString = false;
  10573. }
  10574. }
  10575. if (isAllString) {
  10576. var word = expression.map((node2) => node2.toText()).join("");
  10577. expression = [new TextNode(word)];
  10578. }
  10579. var identifier = new MathNode("mi", expression);
  10580. identifier.setAttribute("mathvariant", "normal");
  10581. var operator = new MathNode("mo", [makeText("⁡", "text")]);
  10582. if (group.parentIsSupSub) {
  10583. return new MathNode("mrow", [identifier, operator]);
  10584. } else {
  10585. return newDocumentFragment([identifier, operator]);
  10586. }
  10587. };
  10588. defineFunction({
  10589. type: "operatorname",
  10590. names: ["\\operatorname@", "\\operatornamewithlimits"],
  10591. props: {
  10592. numArgs: 1
  10593. },
  10594. handler: (_ref, args) => {
  10595. var {
  10596. parser,
  10597. funcName
  10598. } = _ref;
  10599. var body = args[0];
  10600. return {
  10601. type: "operatorname",
  10602. mode: parser.mode,
  10603. body: ordargument(body),
  10604. alwaysHandleSupSub: funcName === "\\operatornamewithlimits",
  10605. limits: false,
  10606. parentIsSupSub: false
  10607. };
  10608. },
  10609. htmlBuilder: htmlBuilder$1,
  10610. mathmlBuilder: mathmlBuilder2
  10611. });
  10612. defineMacro("\\operatorname", "\\@ifstar\\operatornamewithlimits\\operatorname@");
  10613. defineFunctionBuilders({
  10614. type: "ordgroup",
  10615. htmlBuilder(group, options) {
  10616. if (group.semisimple) {
  10617. return makeFragment(buildExpression$1(group.body, options, false));
  10618. }
  10619. return makeSpan(["mord"], buildExpression$1(group.body, options, true), options);
  10620. },
  10621. mathmlBuilder(group, options) {
  10622. return buildExpressionRow(group.body, options, true);
  10623. }
  10624. });
  10625. defineFunction({
  10626. type: "overline",
  10627. names: ["\\overline"],
  10628. props: {
  10629. numArgs: 1
  10630. },
  10631. handler(_ref, args) {
  10632. var {
  10633. parser
  10634. } = _ref;
  10635. var body = args[0];
  10636. return {
  10637. type: "overline",
  10638. mode: parser.mode,
  10639. body
  10640. };
  10641. },
  10642. htmlBuilder(group, options) {
  10643. var innerGroup = buildGroup$1(group.body, options.havingCrampedStyle());
  10644. var line = makeLineSpan("overline-line", options);
  10645. var defaultRuleThickness = options.fontMetrics().defaultRuleThickness;
  10646. var vlist = makeVList({
  10647. positionType: "firstBaseline",
  10648. children: [{
  10649. type: "elem",
  10650. elem: innerGroup
  10651. }, {
  10652. type: "kern",
  10653. size: 3 * defaultRuleThickness
  10654. }, {
  10655. type: "elem",
  10656. elem: line
  10657. }, {
  10658. type: "kern",
  10659. size: defaultRuleThickness
  10660. }]
  10661. });
  10662. return makeSpan(["mord", "overline"], [vlist], options);
  10663. },
  10664. mathmlBuilder(group, options) {
  10665. var operator = new MathNode("mo", [new TextNode("‾")]);
  10666. operator.setAttribute("stretchy", "true");
  10667. var node = new MathNode("mover", [buildGroup2(group.body, options), operator]);
  10668. node.setAttribute("accent", "true");
  10669. return node;
  10670. }
  10671. });
  10672. defineFunction({
  10673. type: "phantom",
  10674. names: ["\\phantom"],
  10675. props: {
  10676. numArgs: 1,
  10677. allowedInText: true
  10678. },
  10679. handler: (_ref, args) => {
  10680. var {
  10681. parser
  10682. } = _ref;
  10683. var body = args[0];
  10684. return {
  10685. type: "phantom",
  10686. mode: parser.mode,
  10687. body: ordargument(body)
  10688. };
  10689. },
  10690. htmlBuilder: (group, options) => {
  10691. var elements = buildExpression$1(group.body, options.withPhantom(), false);
  10692. return makeFragment(elements);
  10693. },
  10694. mathmlBuilder: (group, options) => {
  10695. var inner2 = buildExpression2(group.body, options);
  10696. return new MathNode("mphantom", inner2);
  10697. }
  10698. });
  10699. defineMacro("\\hphantom", "\\smash{\\phantom{#1}}");
  10700. defineFunction({
  10701. type: "vphantom",
  10702. names: ["\\vphantom"],
  10703. props: {
  10704. numArgs: 1,
  10705. allowedInText: true
  10706. },
  10707. handler: (_ref2, args) => {
  10708. var {
  10709. parser
  10710. } = _ref2;
  10711. var body = args[0];
  10712. return {
  10713. type: "vphantom",
  10714. mode: parser.mode,
  10715. body
  10716. };
  10717. },
  10718. htmlBuilder: (group, options) => {
  10719. var inner2 = makeSpan(["inner"], [buildGroup$1(group.body, options.withPhantom())]);
  10720. var fix = makeSpan(["fix"], []);
  10721. return makeSpan(["mord", "rlap"], [inner2, fix], options);
  10722. },
  10723. mathmlBuilder: (group, options) => {
  10724. var inner2 = buildExpression2(ordargument(group.body), options);
  10725. var phantom = new MathNode("mphantom", inner2);
  10726. var node = new MathNode("mpadded", [phantom]);
  10727. node.setAttribute("width", "0px");
  10728. return node;
  10729. }
  10730. });
  10731. defineFunction({
  10732. type: "raisebox",
  10733. names: ["\\raisebox"],
  10734. props: {
  10735. numArgs: 2,
  10736. argTypes: ["size", "hbox"],
  10737. allowedInText: true
  10738. },
  10739. handler(_ref, args) {
  10740. var {
  10741. parser
  10742. } = _ref;
  10743. var amount = assertNodeType(args[0], "size").value;
  10744. var body = args[1];
  10745. return {
  10746. type: "raisebox",
  10747. mode: parser.mode,
  10748. dy: amount,
  10749. body
  10750. };
  10751. },
  10752. htmlBuilder(group, options) {
  10753. var body = buildGroup$1(group.body, options);
  10754. var dy = calculateSize(group.dy, options);
  10755. return makeVList({
  10756. positionType: "shift",
  10757. positionData: -dy,
  10758. children: [{
  10759. type: "elem",
  10760. elem: body
  10761. }]
  10762. });
  10763. },
  10764. mathmlBuilder(group, options) {
  10765. var node = new MathNode("mpadded", [buildGroup2(group.body, options)]);
  10766. var dy = group.dy.number + group.dy.unit;
  10767. node.setAttribute("voffset", dy);
  10768. return node;
  10769. }
  10770. });
  10771. defineFunction({
  10772. type: "internal",
  10773. names: ["\\relax"],
  10774. props: {
  10775. numArgs: 0,
  10776. allowedInText: true,
  10777. allowedInArgument: true
  10778. },
  10779. handler(_ref) {
  10780. var {
  10781. parser
  10782. } = _ref;
  10783. return {
  10784. type: "internal",
  10785. mode: parser.mode
  10786. };
  10787. }
  10788. });
  10789. defineFunction({
  10790. type: "rule",
  10791. names: ["\\rule"],
  10792. props: {
  10793. numArgs: 2,
  10794. numOptionalArgs: 1,
  10795. allowedInText: true,
  10796. allowedInMath: true,
  10797. argTypes: ["size", "size", "size"]
  10798. },
  10799. handler(_ref, args, optArgs) {
  10800. var {
  10801. parser
  10802. } = _ref;
  10803. var shift = optArgs[0];
  10804. var width = assertNodeType(args[0], "size");
  10805. var height = assertNodeType(args[1], "size");
  10806. return {
  10807. type: "rule",
  10808. mode: parser.mode,
  10809. shift: shift && assertNodeType(shift, "size").value,
  10810. width: width.value,
  10811. height: height.value
  10812. };
  10813. },
  10814. htmlBuilder(group, options) {
  10815. var rule = makeSpan(["mord", "rule"], [], options);
  10816. var width = calculateSize(group.width, options);
  10817. var height = calculateSize(group.height, options);
  10818. var shift = group.shift ? calculateSize(group.shift, options) : 0;
  10819. rule.style.borderRightWidth = makeEm(width);
  10820. rule.style.borderTopWidth = makeEm(height);
  10821. rule.style.bottom = makeEm(shift);
  10822. rule.width = width;
  10823. rule.height = height + shift;
  10824. rule.depth = -shift;
  10825. rule.maxFontSize = height * 1.125 * options.sizeMultiplier;
  10826. return rule;
  10827. },
  10828. mathmlBuilder(group, options) {
  10829. var width = calculateSize(group.width, options);
  10830. var height = calculateSize(group.height, options);
  10831. var shift = group.shift ? calculateSize(group.shift, options) : 0;
  10832. var color = options.color && options.getColor() || "black";
  10833. var rule = new MathNode("mspace");
  10834. rule.setAttribute("mathbackground", color);
  10835. rule.setAttribute("width", makeEm(width));
  10836. rule.setAttribute("height", makeEm(height));
  10837. var wrapper = new MathNode("mpadded", [rule]);
  10838. if (shift >= 0) {
  10839. wrapper.setAttribute("height", makeEm(shift));
  10840. } else {
  10841. wrapper.setAttribute("height", makeEm(shift));
  10842. wrapper.setAttribute("depth", makeEm(-shift));
  10843. }
  10844. wrapper.setAttribute("voffset", makeEm(shift));
  10845. return wrapper;
  10846. }
  10847. });
  10848. function sizingGroup(value, options, baseOptions) {
  10849. var inner2 = buildExpression$1(value, options, false);
  10850. var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier;
  10851. for (var i = 0; i < inner2.length; i++) {
  10852. var pos = inner2[i].classes.indexOf("sizing");
  10853. if (pos < 0) {
  10854. Array.prototype.push.apply(inner2[i].classes, options.sizingClasses(baseOptions));
  10855. } else if (inner2[i].classes[pos + 1] === "reset-size" + options.size) {
  10856. inner2[i].classes[pos + 1] = "reset-size" + baseOptions.size;
  10857. }
  10858. inner2[i].height *= multiplier;
  10859. inner2[i].depth *= multiplier;
  10860. }
  10861. return makeFragment(inner2);
  10862. }
  10863. var sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"];
  10864. var htmlBuilder2 = (group, options) => {
  10865. var newOptions = options.havingSize(group.size);
  10866. return sizingGroup(group.body, newOptions, options);
  10867. };
  10868. defineFunction({
  10869. type: "sizing",
  10870. names: sizeFuncs,
  10871. props: {
  10872. numArgs: 0,
  10873. allowedInText: true
  10874. },
  10875. handler: (_ref, args) => {
  10876. var {
  10877. breakOnTokenText,
  10878. funcName,
  10879. parser
  10880. } = _ref;
  10881. var body = parser.parseExpression(false, breakOnTokenText);
  10882. return {
  10883. type: "sizing",
  10884. mode: parser.mode,
  10885. // Figure out what size to use based on the list of functions above
  10886. size: sizeFuncs.indexOf(funcName) + 1,
  10887. body
  10888. };
  10889. },
  10890. htmlBuilder: htmlBuilder2,
  10891. mathmlBuilder: (group, options) => {
  10892. var newOptions = options.havingSize(group.size);
  10893. var inner2 = buildExpression2(group.body, newOptions);
  10894. var node = new MathNode("mstyle", inner2);
  10895. node.setAttribute("mathsize", makeEm(newOptions.sizeMultiplier));
  10896. return node;
  10897. }
  10898. });
  10899. defineFunction({
  10900. type: "smash",
  10901. names: ["\\smash"],
  10902. props: {
  10903. numArgs: 1,
  10904. numOptionalArgs: 1,
  10905. allowedInText: true
  10906. },
  10907. handler: (_ref, args, optArgs) => {
  10908. var {
  10909. parser
  10910. } = _ref;
  10911. var smashHeight = false;
  10912. var smashDepth = false;
  10913. var tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup");
  10914. if (tbArg) {
  10915. var letter = "";
  10916. for (var i = 0; i < tbArg.body.length; ++i) {
  10917. var node = tbArg.body[i];
  10918. letter = assertSymbolNodeType(node).text;
  10919. if (letter === "t") {
  10920. smashHeight = true;
  10921. } else if (letter === "b") {
  10922. smashDepth = true;
  10923. } else {
  10924. smashHeight = false;
  10925. smashDepth = false;
  10926. break;
  10927. }
  10928. }
  10929. } else {
  10930. smashHeight = true;
  10931. smashDepth = true;
  10932. }
  10933. var body = args[0];
  10934. return {
  10935. type: "smash",
  10936. mode: parser.mode,
  10937. body,
  10938. smashHeight,
  10939. smashDepth
  10940. };
  10941. },
  10942. htmlBuilder: (group, options) => {
  10943. var node = makeSpan([], [buildGroup$1(group.body, options)]);
  10944. if (!group.smashHeight && !group.smashDepth) {
  10945. return node;
  10946. }
  10947. if (group.smashHeight) {
  10948. node.height = 0;
  10949. }
  10950. if (group.smashDepth) {
  10951. node.depth = 0;
  10952. }
  10953. if (group.smashHeight && group.smashDepth) {
  10954. return makeSpan(["mord", "smash"], [node], options);
  10955. }
  10956. if (node.children) {
  10957. for (var i = 0; i < node.children.length; i++) {
  10958. if (group.smashHeight) {
  10959. node.children[i].height = 0;
  10960. }
  10961. if (group.smashDepth) {
  10962. node.children[i].depth = 0;
  10963. }
  10964. }
  10965. }
  10966. var smashedNode = makeVList({
  10967. positionType: "firstBaseline",
  10968. children: [{
  10969. type: "elem",
  10970. elem: node
  10971. }]
  10972. });
  10973. return makeSpan(["mord"], [smashedNode], options);
  10974. },
  10975. mathmlBuilder: (group, options) => {
  10976. var node = new MathNode("mpadded", [buildGroup2(group.body, options)]);
  10977. if (group.smashHeight) {
  10978. node.setAttribute("height", "0px");
  10979. }
  10980. if (group.smashDepth) {
  10981. node.setAttribute("depth", "0px");
  10982. }
  10983. return node;
  10984. }
  10985. });
  10986. defineFunction({
  10987. type: "sqrt",
  10988. names: ["\\sqrt"],
  10989. props: {
  10990. numArgs: 1,
  10991. numOptionalArgs: 1
  10992. },
  10993. handler(_ref, args, optArgs) {
  10994. var {
  10995. parser
  10996. } = _ref;
  10997. var index = optArgs[0];
  10998. var body = args[0];
  10999. return {
  11000. type: "sqrt",
  11001. mode: parser.mode,
  11002. body,
  11003. index
  11004. };
  11005. },
  11006. htmlBuilder(group, options) {
  11007. var inner2 = buildGroup$1(group.body, options.havingCrampedStyle());
  11008. if (inner2.height === 0) {
  11009. inner2.height = options.fontMetrics().xHeight;
  11010. }
  11011. inner2 = wrapFragment(inner2, options);
  11012. var metrics = options.fontMetrics();
  11013. var theta = metrics.defaultRuleThickness;
  11014. var phi = theta;
  11015. if (options.style.id < Style$1.TEXT.id) {
  11016. phi = options.fontMetrics().xHeight;
  11017. }
  11018. var lineClearance = theta + phi / 4;
  11019. var minDelimiterHeight = inner2.height + inner2.depth + lineClearance + theta;
  11020. var {
  11021. span: img,
  11022. ruleWidth,
  11023. advanceWidth
  11024. } = makeSqrtImage(minDelimiterHeight, options);
  11025. var delimDepth = img.height - ruleWidth;
  11026. if (delimDepth > inner2.height + inner2.depth + lineClearance) {
  11027. lineClearance = (lineClearance + delimDepth - inner2.height - inner2.depth) / 2;
  11028. }
  11029. var imgShift = img.height - inner2.height - lineClearance - ruleWidth;
  11030. inner2.style.paddingLeft = makeEm(advanceWidth);
  11031. var body = makeVList({
  11032. positionType: "firstBaseline",
  11033. children: [{
  11034. type: "elem",
  11035. elem: inner2,
  11036. wrapperClasses: ["svg-align"]
  11037. }, {
  11038. type: "kern",
  11039. size: -(inner2.height + imgShift)
  11040. }, {
  11041. type: "elem",
  11042. elem: img
  11043. }, {
  11044. type: "kern",
  11045. size: ruleWidth
  11046. }]
  11047. });
  11048. if (!group.index) {
  11049. return makeSpan(["mord", "sqrt"], [body], options);
  11050. } else {
  11051. var newOptions = options.havingStyle(Style$1.SCRIPTSCRIPT);
  11052. var rootm = buildGroup$1(group.index, newOptions, options);
  11053. var toShift = 0.6 * (body.height - body.depth);
  11054. var rootVList = makeVList({
  11055. positionType: "shift",
  11056. positionData: -toShift,
  11057. children: [{
  11058. type: "elem",
  11059. elem: rootm
  11060. }]
  11061. });
  11062. var rootVListWrap = makeSpan(["root"], [rootVList]);
  11063. return makeSpan(["mord", "sqrt"], [rootVListWrap, body], options);
  11064. }
  11065. },
  11066. mathmlBuilder(group, options) {
  11067. var {
  11068. body,
  11069. index
  11070. } = group;
  11071. return index ? new MathNode("mroot", [buildGroup2(body, options), buildGroup2(index, options)]) : new MathNode("msqrt", [buildGroup2(body, options)]);
  11072. }
  11073. });
  11074. var styleMap = {
  11075. "display": Style$1.DISPLAY,
  11076. "text": Style$1.TEXT,
  11077. "script": Style$1.SCRIPT,
  11078. "scriptscript": Style$1.SCRIPTSCRIPT
  11079. };
  11080. defineFunction({
  11081. type: "styling",
  11082. names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"],
  11083. props: {
  11084. numArgs: 0,
  11085. allowedInText: true,
  11086. primitive: true
  11087. },
  11088. handler(_ref, args) {
  11089. var {
  11090. breakOnTokenText,
  11091. funcName,
  11092. parser
  11093. } = _ref;
  11094. var body = parser.parseExpression(true, breakOnTokenText);
  11095. var style = funcName.slice(1, funcName.length - 5);
  11096. return {
  11097. type: "styling",
  11098. mode: parser.mode,
  11099. // Figure out what style to use by pulling out the style from
  11100. // the function name
  11101. style,
  11102. body
  11103. };
  11104. },
  11105. htmlBuilder(group, options) {
  11106. var newStyle = styleMap[group.style];
  11107. var newOptions = options.havingStyle(newStyle).withFont("");
  11108. return sizingGroup(group.body, newOptions, options);
  11109. },
  11110. mathmlBuilder(group, options) {
  11111. var newStyle = styleMap[group.style];
  11112. var newOptions = options.havingStyle(newStyle);
  11113. var inner2 = buildExpression2(group.body, newOptions);
  11114. var node = new MathNode("mstyle", inner2);
  11115. var styleAttributes = {
  11116. "display": ["0", "true"],
  11117. "text": ["0", "false"],
  11118. "script": ["1", "false"],
  11119. "scriptscript": ["2", "false"]
  11120. };
  11121. var attr = styleAttributes[group.style];
  11122. node.setAttribute("scriptlevel", attr[0]);
  11123. node.setAttribute("displaystyle", attr[1]);
  11124. return node;
  11125. }
  11126. });
  11127. var htmlBuilderDelegate = function htmlBuilderDelegate2(group, options) {
  11128. var base = group.base;
  11129. if (!base) {
  11130. return null;
  11131. } else if (base.type === "op") {
  11132. var delegate = base.limits && (options.style.size === Style$1.DISPLAY.size || base.alwaysHandleSupSub);
  11133. return delegate ? htmlBuilder$2 : null;
  11134. } else if (base.type === "operatorname") {
  11135. var _delegate = base.alwaysHandleSupSub && (options.style.size === Style$1.DISPLAY.size || base.limits);
  11136. return _delegate ? htmlBuilder$1 : null;
  11137. } else if (base.type === "accent") {
  11138. return isCharacterBox(base.base) ? htmlBuilder$a : null;
  11139. } else if (base.type === "horizBrace") {
  11140. var isSup = !group.sub;
  11141. return isSup === base.isOver ? htmlBuilder$3 : null;
  11142. } else {
  11143. return null;
  11144. }
  11145. };
  11146. defineFunctionBuilders({
  11147. type: "supsub",
  11148. htmlBuilder(group, options) {
  11149. var builderDelegate = htmlBuilderDelegate(group, options);
  11150. if (builderDelegate) {
  11151. return builderDelegate(group, options);
  11152. }
  11153. var {
  11154. base: valueBase,
  11155. sup: valueSup,
  11156. sub: valueSub
  11157. } = group;
  11158. var base = buildGroup$1(valueBase, options);
  11159. var supm;
  11160. var subm;
  11161. var metrics = options.fontMetrics();
  11162. var supShift = 0;
  11163. var subShift = 0;
  11164. var isCharBox = valueBase && isCharacterBox(valueBase);
  11165. if (valueSup) {
  11166. var newOptions = options.havingStyle(options.style.sup());
  11167. supm = buildGroup$1(valueSup, newOptions, options);
  11168. if (!isCharBox) {
  11169. supShift = base.height - newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier / options.sizeMultiplier;
  11170. }
  11171. }
  11172. if (valueSub) {
  11173. var _newOptions = options.havingStyle(options.style.sub());
  11174. subm = buildGroup$1(valueSub, _newOptions, options);
  11175. if (!isCharBox) {
  11176. subShift = base.depth + _newOptions.fontMetrics().subDrop * _newOptions.sizeMultiplier / options.sizeMultiplier;
  11177. }
  11178. }
  11179. var minSupShift;
  11180. if (options.style === Style$1.DISPLAY) {
  11181. minSupShift = metrics.sup1;
  11182. } else if (options.style.cramped) {
  11183. minSupShift = metrics.sup3;
  11184. } else {
  11185. minSupShift = metrics.sup2;
  11186. }
  11187. var multiplier = options.sizeMultiplier;
  11188. var marginRight = makeEm(0.5 / metrics.ptPerEm / multiplier);
  11189. var marginLeft = null;
  11190. if (subm) {
  11191. var isOiint = group.base && group.base.type === "op" && group.base.name && (group.base.name === "\\oiint" || group.base.name === "\\oiiint");
  11192. if (base instanceof SymbolNode || isOiint) {
  11193. marginLeft = makeEm(-base.italic);
  11194. }
  11195. }
  11196. var supsub;
  11197. if (supm && subm) {
  11198. supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight);
  11199. subShift = Math.max(subShift, metrics.sub2);
  11200. var ruleWidth = metrics.defaultRuleThickness;
  11201. var maxWidth = 4 * ruleWidth;
  11202. if (supShift - supm.depth - (subm.height - subShift) < maxWidth) {
  11203. subShift = maxWidth - (supShift - supm.depth) + subm.height;
  11204. var psi = 0.8 * metrics.xHeight - (supShift - supm.depth);
  11205. if (psi > 0) {
  11206. supShift += psi;
  11207. subShift -= psi;
  11208. }
  11209. }
  11210. var vlistElem = [{
  11211. type: "elem",
  11212. elem: subm,
  11213. shift: subShift,
  11214. marginRight,
  11215. marginLeft
  11216. }, {
  11217. type: "elem",
  11218. elem: supm,
  11219. shift: -supShift,
  11220. marginRight
  11221. }];
  11222. supsub = makeVList({
  11223. positionType: "individualShift",
  11224. children: vlistElem
  11225. });
  11226. } else if (subm) {
  11227. subShift = Math.max(subShift, metrics.sub1, subm.height - 0.8 * metrics.xHeight);
  11228. var _vlistElem = [{
  11229. type: "elem",
  11230. elem: subm,
  11231. marginLeft,
  11232. marginRight
  11233. }];
  11234. supsub = makeVList({
  11235. positionType: "shift",
  11236. positionData: subShift,
  11237. children: _vlistElem
  11238. });
  11239. } else if (supm) {
  11240. supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight);
  11241. supsub = makeVList({
  11242. positionType: "shift",
  11243. positionData: -supShift,
  11244. children: [{
  11245. type: "elem",
  11246. elem: supm,
  11247. marginRight
  11248. }]
  11249. });
  11250. } else {
  11251. throw new Error("supsub must have either sup or sub.");
  11252. }
  11253. var mclass = getTypeOfDomTree(base, "right") || "mord";
  11254. return makeSpan([mclass], [base, makeSpan(["msupsub"], [supsub])], options);
  11255. },
  11256. mathmlBuilder(group, options) {
  11257. var isBrace = false;
  11258. var isOver;
  11259. var isSup;
  11260. if (group.base && group.base.type === "horizBrace") {
  11261. isSup = !!group.sup;
  11262. if (isSup === group.base.isOver) {
  11263. isBrace = true;
  11264. isOver = group.base.isOver;
  11265. }
  11266. }
  11267. if (group.base && (group.base.type === "op" || group.base.type === "operatorname")) {
  11268. group.base.parentIsSupSub = true;
  11269. }
  11270. var children = [buildGroup2(group.base, options)];
  11271. if (group.sub) {
  11272. children.push(buildGroup2(group.sub, options));
  11273. }
  11274. if (group.sup) {
  11275. children.push(buildGroup2(group.sup, options));
  11276. }
  11277. var nodeType;
  11278. if (isBrace) {
  11279. nodeType = isOver ? "mover" : "munder";
  11280. } else if (!group.sub) {
  11281. var base = group.base;
  11282. if (base && base.type === "op" && base.limits && (options.style === Style$1.DISPLAY || base.alwaysHandleSupSub)) {
  11283. nodeType = "mover";
  11284. } else if (base && base.type === "operatorname" && base.alwaysHandleSupSub && (base.limits || options.style === Style$1.DISPLAY)) {
  11285. nodeType = "mover";
  11286. } else {
  11287. nodeType = "msup";
  11288. }
  11289. } else if (!group.sup) {
  11290. var _base = group.base;
  11291. if (_base && _base.type === "op" && _base.limits && (options.style === Style$1.DISPLAY || _base.alwaysHandleSupSub)) {
  11292. nodeType = "munder";
  11293. } else if (_base && _base.type === "operatorname" && _base.alwaysHandleSupSub && (_base.limits || options.style === Style$1.DISPLAY)) {
  11294. nodeType = "munder";
  11295. } else {
  11296. nodeType = "msub";
  11297. }
  11298. } else {
  11299. var _base2 = group.base;
  11300. if (_base2 && _base2.type === "op" && _base2.limits && options.style === Style$1.DISPLAY) {
  11301. nodeType = "munderover";
  11302. } else if (_base2 && _base2.type === "operatorname" && _base2.alwaysHandleSupSub && (options.style === Style$1.DISPLAY || _base2.limits)) {
  11303. nodeType = "munderover";
  11304. } else {
  11305. nodeType = "msubsup";
  11306. }
  11307. }
  11308. return new MathNode(nodeType, children);
  11309. }
  11310. });
  11311. defineFunctionBuilders({
  11312. type: "atom",
  11313. htmlBuilder(group, options) {
  11314. return mathsym(group.text, group.mode, options, ["m" + group.family]);
  11315. },
  11316. mathmlBuilder(group, options) {
  11317. var node = new MathNode("mo", [makeText(group.text, group.mode)]);
  11318. if (group.family === "bin") {
  11319. var variant = getVariant(group, options);
  11320. if (variant === "bold-italic") {
  11321. node.setAttribute("mathvariant", variant);
  11322. }
  11323. } else if (group.family === "punct") {
  11324. node.setAttribute("separator", "true");
  11325. } else if (group.family === "open" || group.family === "close") {
  11326. node.setAttribute("stretchy", "false");
  11327. }
  11328. return node;
  11329. }
  11330. });
  11331. var defaultVariant = {
  11332. "mi": "italic",
  11333. "mn": "normal",
  11334. "mtext": "normal"
  11335. };
  11336. defineFunctionBuilders({
  11337. type: "mathord",
  11338. htmlBuilder(group, options) {
  11339. return makeOrd(group, options, "mathord");
  11340. },
  11341. mathmlBuilder(group, options) {
  11342. var node = new MathNode("mi", [makeText(group.text, group.mode, options)]);
  11343. var variant = getVariant(group, options) || "italic";
  11344. if (variant !== defaultVariant[node.type]) {
  11345. node.setAttribute("mathvariant", variant);
  11346. }
  11347. return node;
  11348. }
  11349. });
  11350. defineFunctionBuilders({
  11351. type: "textord",
  11352. htmlBuilder(group, options) {
  11353. return makeOrd(group, options, "textord");
  11354. },
  11355. mathmlBuilder(group, options) {
  11356. var text2 = makeText(group.text, group.mode, options);
  11357. var variant = getVariant(group, options) || "normal";
  11358. var node;
  11359. if (group.mode === "text") {
  11360. node = new MathNode("mtext", [text2]);
  11361. } else if (/[0-9]/.test(group.text)) {
  11362. node = new MathNode("mn", [text2]);
  11363. } else if (group.text === "\\prime") {
  11364. node = new MathNode("mo", [text2]);
  11365. } else {
  11366. node = new MathNode("mi", [text2]);
  11367. }
  11368. if (variant !== defaultVariant[node.type]) {
  11369. node.setAttribute("mathvariant", variant);
  11370. }
  11371. return node;
  11372. }
  11373. });
  11374. var cssSpace = {
  11375. "\\nobreak": "nobreak",
  11376. "\\allowbreak": "allowbreak"
  11377. };
  11378. var regularSpace = {
  11379. " ": {},
  11380. "\\ ": {},
  11381. "~": {
  11382. className: "nobreak"
  11383. },
  11384. "\\space": {},
  11385. "\\nobreakspace": {
  11386. className: "nobreak"
  11387. }
  11388. };
  11389. defineFunctionBuilders({
  11390. type: "spacing",
  11391. htmlBuilder(group, options) {
  11392. if (regularSpace.hasOwnProperty(group.text)) {
  11393. var className = regularSpace[group.text].className || "";
  11394. if (group.mode === "text") {
  11395. var ord = makeOrd(group, options, "textord");
  11396. ord.classes.push(className);
  11397. return ord;
  11398. } else {
  11399. return makeSpan(["mspace", className], [mathsym(group.text, group.mode, options)], options);
  11400. }
  11401. } else if (cssSpace.hasOwnProperty(group.text)) {
  11402. return makeSpan(["mspace", cssSpace[group.text]], [], options);
  11403. } else {
  11404. throw new ParseError('Unknown type of space "' + group.text + '"');
  11405. }
  11406. },
  11407. mathmlBuilder(group, options) {
  11408. var node;
  11409. if (regularSpace.hasOwnProperty(group.text)) {
  11410. node = new MathNode("mtext", [new TextNode(" ")]);
  11411. } else if (cssSpace.hasOwnProperty(group.text)) {
  11412. return new MathNode("mspace");
  11413. } else {
  11414. throw new ParseError('Unknown type of space "' + group.text + '"');
  11415. }
  11416. return node;
  11417. }
  11418. });
  11419. var pad = () => {
  11420. var padNode = new MathNode("mtd", []);
  11421. padNode.setAttribute("width", "50%");
  11422. return padNode;
  11423. };
  11424. defineFunctionBuilders({
  11425. type: "tag",
  11426. mathmlBuilder(group, options) {
  11427. var table = new MathNode("mtable", [new MathNode("mtr", [pad(), new MathNode("mtd", [buildExpressionRow(group.body, options)]), pad(), new MathNode("mtd", [buildExpressionRow(group.tag, options)])])]);
  11428. table.setAttribute("width", "100%");
  11429. return table;
  11430. }
  11431. });
  11432. var textFontFamilies = {
  11433. "\\text": void 0,
  11434. "\\textrm": "textrm",
  11435. "\\textsf": "textsf",
  11436. "\\texttt": "texttt",
  11437. "\\textnormal": "textrm"
  11438. };
  11439. var textFontWeights = {
  11440. "\\textbf": "textbf",
  11441. "\\textmd": "textmd"
  11442. };
  11443. var textFontShapes = {
  11444. "\\textit": "textit",
  11445. "\\textup": "textup"
  11446. };
  11447. var optionsWithFont = (group, options) => {
  11448. var font = group.font;
  11449. if (!font) {
  11450. return options;
  11451. } else if (textFontFamilies[font]) {
  11452. return options.withTextFontFamily(textFontFamilies[font]);
  11453. } else if (textFontWeights[font]) {
  11454. return options.withTextFontWeight(textFontWeights[font]);
  11455. } else if (font === "\\emph") {
  11456. return options.fontShape === "textit" ? options.withTextFontShape("textup") : options.withTextFontShape("textit");
  11457. }
  11458. return options.withTextFontShape(textFontShapes[font]);
  11459. };
  11460. defineFunction({
  11461. type: "text",
  11462. names: [
  11463. // Font families
  11464. "\\text",
  11465. "\\textrm",
  11466. "\\textsf",
  11467. "\\texttt",
  11468. "\\textnormal",
  11469. // Font weights
  11470. "\\textbf",
  11471. "\\textmd",
  11472. // Font Shapes
  11473. "\\textit",
  11474. "\\textup",
  11475. "\\emph"
  11476. ],
  11477. props: {
  11478. numArgs: 1,
  11479. argTypes: ["text"],
  11480. allowedInArgument: true,
  11481. allowedInText: true
  11482. },
  11483. handler(_ref, args) {
  11484. var {
  11485. parser,
  11486. funcName
  11487. } = _ref;
  11488. var body = args[0];
  11489. return {
  11490. type: "text",
  11491. mode: parser.mode,
  11492. body: ordargument(body),
  11493. font: funcName
  11494. };
  11495. },
  11496. htmlBuilder(group, options) {
  11497. var newOptions = optionsWithFont(group, options);
  11498. var inner2 = buildExpression$1(group.body, newOptions, true);
  11499. return makeSpan(["mord", "text"], inner2, newOptions);
  11500. },
  11501. mathmlBuilder(group, options) {
  11502. var newOptions = optionsWithFont(group, options);
  11503. return buildExpressionRow(group.body, newOptions);
  11504. }
  11505. });
  11506. defineFunction({
  11507. type: "underline",
  11508. names: ["\\underline"],
  11509. props: {
  11510. numArgs: 1,
  11511. allowedInText: true
  11512. },
  11513. handler(_ref, args) {
  11514. var {
  11515. parser
  11516. } = _ref;
  11517. return {
  11518. type: "underline",
  11519. mode: parser.mode,
  11520. body: args[0]
  11521. };
  11522. },
  11523. htmlBuilder(group, options) {
  11524. var innerGroup = buildGroup$1(group.body, options);
  11525. var line = makeLineSpan("underline-line", options);
  11526. var defaultRuleThickness = options.fontMetrics().defaultRuleThickness;
  11527. var vlist = makeVList({
  11528. positionType: "top",
  11529. positionData: innerGroup.height,
  11530. children: [{
  11531. type: "kern",
  11532. size: defaultRuleThickness
  11533. }, {
  11534. type: "elem",
  11535. elem: line
  11536. }, {
  11537. type: "kern",
  11538. size: 3 * defaultRuleThickness
  11539. }, {
  11540. type: "elem",
  11541. elem: innerGroup
  11542. }]
  11543. });
  11544. return makeSpan(["mord", "underline"], [vlist], options);
  11545. },
  11546. mathmlBuilder(group, options) {
  11547. var operator = new MathNode("mo", [new TextNode("‾")]);
  11548. operator.setAttribute("stretchy", "true");
  11549. var node = new MathNode("munder", [buildGroup2(group.body, options), operator]);
  11550. node.setAttribute("accentunder", "true");
  11551. return node;
  11552. }
  11553. });
  11554. defineFunction({
  11555. type: "vcenter",
  11556. names: ["\\vcenter"],
  11557. props: {
  11558. numArgs: 1,
  11559. argTypes: ["original"],
  11560. // In LaTeX, \vcenter can act only on a box.
  11561. allowedInText: false
  11562. },
  11563. handler(_ref, args) {
  11564. var {
  11565. parser
  11566. } = _ref;
  11567. return {
  11568. type: "vcenter",
  11569. mode: parser.mode,
  11570. body: args[0]
  11571. };
  11572. },
  11573. htmlBuilder(group, options) {
  11574. var body = buildGroup$1(group.body, options);
  11575. var axisHeight = options.fontMetrics().axisHeight;
  11576. var dy = 0.5 * (body.height - axisHeight - (body.depth + axisHeight));
  11577. return makeVList({
  11578. positionType: "shift",
  11579. positionData: dy,
  11580. children: [{
  11581. type: "elem",
  11582. elem: body
  11583. }]
  11584. });
  11585. },
  11586. mathmlBuilder(group, options) {
  11587. return new MathNode("mpadded", [buildGroup2(group.body, options)], ["vcenter"]);
  11588. }
  11589. });
  11590. defineFunction({
  11591. type: "verb",
  11592. names: ["\\verb"],
  11593. props: {
  11594. numArgs: 0,
  11595. allowedInText: true
  11596. },
  11597. handler(context, args, optArgs) {
  11598. throw new ParseError("\\verb ended by end of line instead of matching delimiter");
  11599. },
  11600. htmlBuilder(group, options) {
  11601. var text2 = makeVerb(group);
  11602. var body = [];
  11603. var newOptions = options.havingStyle(options.style.text());
  11604. for (var i = 0; i < text2.length; i++) {
  11605. var c = text2[i];
  11606. if (c === "~") {
  11607. c = "\\textasciitilde";
  11608. }
  11609. body.push(makeSymbol(c, "Typewriter-Regular", group.mode, newOptions, ["mord", "texttt"]));
  11610. }
  11611. return makeSpan(["mord", "text"].concat(newOptions.sizingClasses(options)), tryCombineChars(body), newOptions);
  11612. },
  11613. mathmlBuilder(group, options) {
  11614. var text2 = new TextNode(makeVerb(group));
  11615. var node = new MathNode("mtext", [text2]);
  11616. node.setAttribute("mathvariant", "monospace");
  11617. return node;
  11618. }
  11619. });
  11620. var makeVerb = (group) => group.body.replace(/ /g, group.star ? "␣" : " ");
  11621. var functions = _functions;
  11622. var spaceRegexString = "[ \r\n ]";
  11623. var controlWordRegexString = "\\\\[a-zA-Z@]+";
  11624. var controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]";
  11625. var controlWordWhitespaceRegexString = "(" + controlWordRegexString + ")" + spaceRegexString + "*";
  11626. var controlSpaceRegexString = "\\\\(\n|[ \r ]+\n?)[ \r ]*";
  11627. var combiningDiacriticalMarkString = "[̀-ͯ]";
  11628. var combiningDiacriticalMarksEndRegex = new RegExp(combiningDiacriticalMarkString + "+$");
  11629. var tokenRegexString = "(" + spaceRegexString + "+)|" + // whitespace
  11630. (controlSpaceRegexString + "|") + // \whitespace
  11631. "([!-\\[\\]-‧‪-퟿豈-￿]" + // single codepoint
  11632. (combiningDiacriticalMarkString + "*") + // ...plus accents
  11633. "|[\uD800-\uDBFF][\uDC00-\uDFFF]" + // surrogate pair
  11634. (combiningDiacriticalMarkString + "*") + // ...plus accents
  11635. "|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5" + // \verb unstarred
  11636. ("|" + controlWordWhitespaceRegexString) + // \macroName + spaces
  11637. ("|" + controlSymbolRegexString + ")");
  11638. var Lexer = class {
  11639. // Category codes. The lexer only supports comment characters (14) for now.
  11640. // MacroExpander additionally distinguishes active (13).
  11641. constructor(input, settings) {
  11642. this.input = input;
  11643. this.settings = settings;
  11644. this.tokenRegex = new RegExp(tokenRegexString, "g");
  11645. this.catcodes = {
  11646. "%": 14,
  11647. // comment character
  11648. "~": 13
  11649. // active character
  11650. };
  11651. }
  11652. setCatcode(char, code) {
  11653. this.catcodes[char] = code;
  11654. }
  11655. /**
  11656. * This function lexes a single token.
  11657. */
  11658. lex() {
  11659. var input = this.input;
  11660. var pos = this.tokenRegex.lastIndex;
  11661. if (pos === input.length) {
  11662. return new Token("EOF", new SourceLocation(this, pos, pos));
  11663. }
  11664. var match = this.tokenRegex.exec(input);
  11665. if (match === null || match.index !== pos) {
  11666. throw new ParseError("Unexpected character: '" + input[pos] + "'", new Token(input[pos], new SourceLocation(this, pos, pos + 1)));
  11667. }
  11668. var text2 = match[6] || match[3] || (match[2] ? "\\ " : " ");
  11669. if (this.catcodes[text2] === 14) {
  11670. var nlIndex = input.indexOf("\n", this.tokenRegex.lastIndex);
  11671. if (nlIndex === -1) {
  11672. this.tokenRegex.lastIndex = input.length;
  11673. this.settings.reportNonstrict("commentAtEnd", "% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)");
  11674. } else {
  11675. this.tokenRegex.lastIndex = nlIndex + 1;
  11676. }
  11677. return this.lex();
  11678. }
  11679. return new Token(text2, new SourceLocation(this, pos, this.tokenRegex.lastIndex));
  11680. }
  11681. };
  11682. var Namespace = class {
  11683. /**
  11684. * Both arguments are optional. The first argument is an object of
  11685. * built-in mappings which never change. The second argument is an object
  11686. * of initial (global-level) mappings, which will constantly change
  11687. * according to any global/top-level `set`s done.
  11688. */
  11689. constructor(builtins, globalMacros) {
  11690. if (builtins === void 0) {
  11691. builtins = {};
  11692. }
  11693. if (globalMacros === void 0) {
  11694. globalMacros = {};
  11695. }
  11696. this.current = globalMacros;
  11697. this.builtins = builtins;
  11698. this.undefStack = [];
  11699. }
  11700. /**
  11701. * Start a new nested group, affecting future local `set`s.
  11702. */
  11703. beginGroup() {
  11704. this.undefStack.push({});
  11705. }
  11706. /**
  11707. * End current nested group, restoring values before the group began.
  11708. */
  11709. endGroup() {
  11710. if (this.undefStack.length === 0) {
  11711. throw new ParseError("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");
  11712. }
  11713. var undefs = this.undefStack.pop();
  11714. for (var undef in undefs) {
  11715. if (undefs.hasOwnProperty(undef)) {
  11716. if (undefs[undef] == null) {
  11717. delete this.current[undef];
  11718. } else {
  11719. this.current[undef] = undefs[undef];
  11720. }
  11721. }
  11722. }
  11723. }
  11724. /**
  11725. * Ends all currently nested groups (if any), restoring values before the
  11726. * groups began. Useful in case of an error in the middle of parsing.
  11727. */
  11728. endGroups() {
  11729. while (this.undefStack.length > 0) {
  11730. this.endGroup();
  11731. }
  11732. }
  11733. /**
  11734. * Detect whether `name` has a definition. Equivalent to
  11735. * `get(name) != null`.
  11736. */
  11737. has(name) {
  11738. return this.current.hasOwnProperty(name) || this.builtins.hasOwnProperty(name);
  11739. }
  11740. /**
  11741. * Get the current value of a name, or `undefined` if there is no value.
  11742. *
  11743. * Note: Do not use `if (namespace.get(...))` to detect whether a macro
  11744. * is defined, as the definition may be the empty string which evaluates
  11745. * to `false` in JavaScript. Use `if (namespace.get(...) != null)` or
  11746. * `if (namespace.has(...))`.
  11747. */
  11748. get(name) {
  11749. if (this.current.hasOwnProperty(name)) {
  11750. return this.current[name];
  11751. } else {
  11752. return this.builtins[name];
  11753. }
  11754. }
  11755. /**
  11756. * Set the current value of a name, and optionally set it globally too.
  11757. * Local set() sets the current value and (when appropriate) adds an undo
  11758. * operation to the undo stack. Global set() may change the undo
  11759. * operation at every level, so takes time linear in their number.
  11760. * A value of undefined means to delete existing definitions.
  11761. */
  11762. set(name, value, global) {
  11763. if (global === void 0) {
  11764. global = false;
  11765. }
  11766. if (global) {
  11767. for (var i = 0; i < this.undefStack.length; i++) {
  11768. delete this.undefStack[i][name];
  11769. }
  11770. if (this.undefStack.length > 0) {
  11771. this.undefStack[this.undefStack.length - 1][name] = value;
  11772. }
  11773. } else {
  11774. var top = this.undefStack[this.undefStack.length - 1];
  11775. if (top && !top.hasOwnProperty(name)) {
  11776. top[name] = this.current[name];
  11777. }
  11778. }
  11779. if (value == null) {
  11780. delete this.current[name];
  11781. } else {
  11782. this.current[name] = value;
  11783. }
  11784. }
  11785. };
  11786. var macros = _macros;
  11787. defineMacro("\\noexpand", function(context) {
  11788. var t = context.popToken();
  11789. if (context.isExpandable(t.text)) {
  11790. t.noexpand = true;
  11791. t.treatAsRelax = true;
  11792. }
  11793. return {
  11794. tokens: [t],
  11795. numArgs: 0
  11796. };
  11797. });
  11798. defineMacro("\\expandafter", function(context) {
  11799. var t = context.popToken();
  11800. context.expandOnce(true);
  11801. return {
  11802. tokens: [t],
  11803. numArgs: 0
  11804. };
  11805. });
  11806. defineMacro("\\@firstoftwo", function(context) {
  11807. var args = context.consumeArgs(2);
  11808. return {
  11809. tokens: args[0],
  11810. numArgs: 0
  11811. };
  11812. });
  11813. defineMacro("\\@secondoftwo", function(context) {
  11814. var args = context.consumeArgs(2);
  11815. return {
  11816. tokens: args[1],
  11817. numArgs: 0
  11818. };
  11819. });
  11820. defineMacro("\\@ifnextchar", function(context) {
  11821. var args = context.consumeArgs(3);
  11822. context.consumeSpaces();
  11823. var nextToken = context.future();
  11824. if (args[0].length === 1 && args[0][0].text === nextToken.text) {
  11825. return {
  11826. tokens: args[1],
  11827. numArgs: 0
  11828. };
  11829. } else {
  11830. return {
  11831. tokens: args[2],
  11832. numArgs: 0
  11833. };
  11834. }
  11835. });
  11836. defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}");
  11837. defineMacro("\\TextOrMath", function(context) {
  11838. var args = context.consumeArgs(2);
  11839. if (context.mode === "text") {
  11840. return {
  11841. tokens: args[0],
  11842. numArgs: 0
  11843. };
  11844. } else {
  11845. return {
  11846. tokens: args[1],
  11847. numArgs: 0
  11848. };
  11849. }
  11850. });
  11851. var digitToNumber = {
  11852. "0": 0,
  11853. "1": 1,
  11854. "2": 2,
  11855. "3": 3,
  11856. "4": 4,
  11857. "5": 5,
  11858. "6": 6,
  11859. "7": 7,
  11860. "8": 8,
  11861. "9": 9,
  11862. "a": 10,
  11863. "A": 10,
  11864. "b": 11,
  11865. "B": 11,
  11866. "c": 12,
  11867. "C": 12,
  11868. "d": 13,
  11869. "D": 13,
  11870. "e": 14,
  11871. "E": 14,
  11872. "f": 15,
  11873. "F": 15
  11874. };
  11875. defineMacro("\\char", function(context) {
  11876. var token = context.popToken();
  11877. var base;
  11878. var number = 0;
  11879. if (token.text === "'") {
  11880. base = 8;
  11881. token = context.popToken();
  11882. } else if (token.text === '"') {
  11883. base = 16;
  11884. token = context.popToken();
  11885. } else if (token.text === "`") {
  11886. token = context.popToken();
  11887. if (token.text[0] === "\\") {
  11888. number = token.text.charCodeAt(1);
  11889. } else if (token.text === "EOF") {
  11890. throw new ParseError("\\char` missing argument");
  11891. } else {
  11892. number = token.text.charCodeAt(0);
  11893. }
  11894. } else {
  11895. base = 10;
  11896. }
  11897. if (base) {
  11898. number = digitToNumber[token.text];
  11899. if (number == null || number >= base) {
  11900. throw new ParseError("Invalid base-" + base + " digit " + token.text);
  11901. }
  11902. var digit;
  11903. while ((digit = digitToNumber[context.future().text]) != null && digit < base) {
  11904. number *= base;
  11905. number += digit;
  11906. context.popToken();
  11907. }
  11908. }
  11909. return "\\@char{" + number + "}";
  11910. });
  11911. var newcommand = (context, existsOK, nonexistsOK, skipIfExists) => {
  11912. var arg = context.consumeArg().tokens;
  11913. if (arg.length !== 1) {
  11914. throw new ParseError("\\newcommand's first argument must be a macro name");
  11915. }
  11916. var name = arg[0].text;
  11917. var exists = context.isDefined(name);
  11918. if (exists && !existsOK) {
  11919. throw new ParseError("\\newcommand{" + name + "} attempting to redefine " + (name + "; use \\renewcommand"));
  11920. }
  11921. if (!exists && !nonexistsOK) {
  11922. throw new ParseError("\\renewcommand{" + name + "} when command " + name + " does not yet exist; use \\newcommand");
  11923. }
  11924. var numArgs = 0;
  11925. arg = context.consumeArg().tokens;
  11926. if (arg.length === 1 && arg[0].text === "[") {
  11927. var argText = "";
  11928. var token = context.expandNextToken();
  11929. while (token.text !== "]" && token.text !== "EOF") {
  11930. argText += token.text;
  11931. token = context.expandNextToken();
  11932. }
  11933. if (!argText.match(/^\s*[0-9]+\s*$/)) {
  11934. throw new ParseError("Invalid number of arguments: " + argText);
  11935. }
  11936. numArgs = parseInt(argText);
  11937. arg = context.consumeArg().tokens;
  11938. }
  11939. if (!(exists && skipIfExists)) {
  11940. context.macros.set(name, {
  11941. tokens: arg,
  11942. numArgs
  11943. });
  11944. }
  11945. return "";
  11946. };
  11947. defineMacro("\\newcommand", (context) => newcommand(context, false, true, false));
  11948. defineMacro("\\renewcommand", (context) => newcommand(context, true, false, false));
  11949. defineMacro("\\providecommand", (context) => newcommand(context, true, true, true));
  11950. defineMacro("\\message", (context) => {
  11951. var arg = context.consumeArgs(1)[0];
  11952. console.log(arg.reverse().map((token) => token.text).join(""));
  11953. return "";
  11954. });
  11955. defineMacro("\\errmessage", (context) => {
  11956. var arg = context.consumeArgs(1)[0];
  11957. console.error(arg.reverse().map((token) => token.text).join(""));
  11958. return "";
  11959. });
  11960. defineMacro("\\show", (context) => {
  11961. var tok = context.popToken();
  11962. var name = tok.text;
  11963. console.log(tok, context.macros.get(name), functions[name], symbols.math[name], symbols.text[name]);
  11964. return "";
  11965. });
  11966. defineMacro("\\bgroup", "{");
  11967. defineMacro("\\egroup", "}");
  11968. defineMacro("~", "\\nobreakspace");
  11969. defineMacro("\\lq", "`");
  11970. defineMacro("\\rq", "'");
  11971. defineMacro("\\aa", "\\r a");
  11972. defineMacro("\\AA", "\\r A");
  11973. defineMacro("\\textcopyright", "\\html@mathml{\\textcircled{c}}{\\char`©}");
  11974. defineMacro("\\copyright", "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");
  11975. defineMacro("\\textregistered", "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");
  11976. defineMacro("ℬ", "\\mathscr{B}");
  11977. defineMacro("ℰ", "\\mathscr{E}");
  11978. defineMacro("ℱ", "\\mathscr{F}");
  11979. defineMacro("ℋ", "\\mathscr{H}");
  11980. defineMacro("ℐ", "\\mathscr{I}");
  11981. defineMacro("ℒ", "\\mathscr{L}");
  11982. defineMacro("ℳ", "\\mathscr{M}");
  11983. defineMacro("ℛ", "\\mathscr{R}");
  11984. defineMacro("ℭ", "\\mathfrak{C}");
  11985. defineMacro("ℌ", "\\mathfrak{H}");
  11986. defineMacro("ℨ", "\\mathfrak{Z}");
  11987. defineMacro("\\Bbbk", "\\Bbb{k}");
  11988. defineMacro("\\llap", "\\mathllap{\\textrm{#1}}");
  11989. defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}");
  11990. defineMacro("\\clap", "\\mathclap{\\textrm{#1}}");
  11991. defineMacro("\\mathstrut", "\\vphantom{(}");
  11992. defineMacro("\\underbar", "\\underline{\\text{#1}}");
  11993. defineMacro("\\not", '\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');
  11994. defineMacro("\\neq", "\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");
  11995. defineMacro("\\ne", "\\neq");
  11996. defineMacro("≠", "\\neq");
  11997. defineMacro("\\notin", "\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");
  11998. defineMacro("∉", "\\notin");
  11999. defineMacro("≘", "\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");
  12000. defineMacro("≙", "\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");
  12001. defineMacro("≚", "\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");
  12002. defineMacro("≛", "\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");
  12003. defineMacro("≝", "\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");
  12004. defineMacro("≞", "\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");
  12005. defineMacro("≟", "\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");
  12006. defineMacro("⟂", "\\perp");
  12007. defineMacro("‼", "\\mathclose{!\\mkern-0.8mu!}");
  12008. defineMacro("∌", "\\notni");
  12009. defineMacro("⌜", "\\ulcorner");
  12010. defineMacro("⌝", "\\urcorner");
  12011. defineMacro("⌞", "\\llcorner");
  12012. defineMacro("⌟", "\\lrcorner");
  12013. defineMacro("©", "\\copyright");
  12014. defineMacro("®", "\\textregistered");
  12015. defineMacro("\\ulcorner", '\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');
  12016. defineMacro("\\urcorner", '\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');
  12017. defineMacro("\\llcorner", '\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');
  12018. defineMacro("\\lrcorner", '\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');
  12019. defineMacro("\\vdots", "{\\varvdots\\rule{0pt}{15pt}}");
  12020. defineMacro("⋮", "\\vdots");
  12021. defineMacro("\\varGamma", "\\mathit{\\Gamma}");
  12022. defineMacro("\\varDelta", "\\mathit{\\Delta}");
  12023. defineMacro("\\varTheta", "\\mathit{\\Theta}");
  12024. defineMacro("\\varLambda", "\\mathit{\\Lambda}");
  12025. defineMacro("\\varXi", "\\mathit{\\Xi}");
  12026. defineMacro("\\varPi", "\\mathit{\\Pi}");
  12027. defineMacro("\\varSigma", "\\mathit{\\Sigma}");
  12028. defineMacro("\\varUpsilon", "\\mathit{\\Upsilon}");
  12029. defineMacro("\\varPhi", "\\mathit{\\Phi}");
  12030. defineMacro("\\varPsi", "\\mathit{\\Psi}");
  12031. defineMacro("\\varOmega", "\\mathit{\\Omega}");
  12032. defineMacro("\\substack", "\\begin{subarray}{c}#1\\end{subarray}");
  12033. defineMacro("\\colon", "\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");
  12034. defineMacro("\\boxed", "\\fbox{$\\displaystyle{#1}$}");
  12035. defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;");
  12036. defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;");
  12037. defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;");
  12038. defineMacro("\\dddot", "{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");
  12039. defineMacro("\\ddddot", "{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");
  12040. var dotsByToken = {
  12041. ",": "\\dotsc",
  12042. "\\not": "\\dotsb",
  12043. // \keybin@ checks for the following:
  12044. "+": "\\dotsb",
  12045. "=": "\\dotsb",
  12046. "<": "\\dotsb",
  12047. ">": "\\dotsb",
  12048. "-": "\\dotsb",
  12049. "*": "\\dotsb",
  12050. ":": "\\dotsb",
  12051. // Symbols whose definition starts with \DOTSB:
  12052. "\\DOTSB": "\\dotsb",
  12053. "\\coprod": "\\dotsb",
  12054. "\\bigvee": "\\dotsb",
  12055. "\\bigwedge": "\\dotsb",
  12056. "\\biguplus": "\\dotsb",
  12057. "\\bigcap": "\\dotsb",
  12058. "\\bigcup": "\\dotsb",
  12059. "\\prod": "\\dotsb",
  12060. "\\sum": "\\dotsb",
  12061. "\\bigotimes": "\\dotsb",
  12062. "\\bigoplus": "\\dotsb",
  12063. "\\bigodot": "\\dotsb",
  12064. "\\bigsqcup": "\\dotsb",
  12065. "\\And": "\\dotsb",
  12066. "\\longrightarrow": "\\dotsb",
  12067. "\\Longrightarrow": "\\dotsb",
  12068. "\\longleftarrow": "\\dotsb",
  12069. "\\Longleftarrow": "\\dotsb",
  12070. "\\longleftrightarrow": "\\dotsb",
  12071. "\\Longleftrightarrow": "\\dotsb",
  12072. "\\mapsto": "\\dotsb",
  12073. "\\longmapsto": "\\dotsb",
  12074. "\\hookrightarrow": "\\dotsb",
  12075. "\\doteq": "\\dotsb",
  12076. // Symbols whose definition starts with \mathbin:
  12077. "\\mathbin": "\\dotsb",
  12078. // Symbols whose definition starts with \mathrel:
  12079. "\\mathrel": "\\dotsb",
  12080. "\\relbar": "\\dotsb",
  12081. "\\Relbar": "\\dotsb",
  12082. "\\xrightarrow": "\\dotsb",
  12083. "\\xleftarrow": "\\dotsb",
  12084. // Symbols whose definition starts with \DOTSI:
  12085. "\\DOTSI": "\\dotsi",
  12086. "\\int": "\\dotsi",
  12087. "\\oint": "\\dotsi",
  12088. "\\iint": "\\dotsi",
  12089. "\\iiint": "\\dotsi",
  12090. "\\iiiint": "\\dotsi",
  12091. "\\idotsint": "\\dotsi",
  12092. // Symbols whose definition starts with \DOTSX:
  12093. "\\DOTSX": "\\dotsx"
  12094. };
  12095. var dotsbGroups = /* @__PURE__ */ new Set(["bin", "rel"]);
  12096. defineMacro("\\dots", function(context) {
  12097. var thedots = "\\dotso";
  12098. var next = context.expandAfterFuture().text;
  12099. if (next in dotsByToken) {
  12100. thedots = dotsByToken[next];
  12101. } else if (next.slice(0, 4) === "\\not") {
  12102. thedots = "\\dotsb";
  12103. } else if (next in symbols.math) {
  12104. if (dotsbGroups.has(symbols.math[next].group)) {
  12105. thedots = "\\dotsb";
  12106. }
  12107. }
  12108. return thedots;
  12109. });
  12110. var spaceAfterDots = {
  12111. // \rightdelim@ checks for the following:
  12112. ")": true,
  12113. "]": true,
  12114. "\\rbrack": true,
  12115. "\\}": true,
  12116. "\\rbrace": true,
  12117. "\\rangle": true,
  12118. "\\rceil": true,
  12119. "\\rfloor": true,
  12120. "\\rgroup": true,
  12121. "\\rmoustache": true,
  12122. "\\right": true,
  12123. "\\bigr": true,
  12124. "\\biggr": true,
  12125. "\\Bigr": true,
  12126. "\\Biggr": true,
  12127. // \extra@ also tests for the following:
  12128. "$": true,
  12129. // \extrap@ checks for the following:
  12130. ";": true,
  12131. ".": true,
  12132. ",": true
  12133. };
  12134. defineMacro("\\dotso", function(context) {
  12135. var next = context.future().text;
  12136. if (next in spaceAfterDots) {
  12137. return "\\ldots\\,";
  12138. } else {
  12139. return "\\ldots";
  12140. }
  12141. });
  12142. defineMacro("\\dotsc", function(context) {
  12143. var next = context.future().text;
  12144. if (next in spaceAfterDots && next !== ",") {
  12145. return "\\ldots\\,";
  12146. } else {
  12147. return "\\ldots";
  12148. }
  12149. });
  12150. defineMacro("\\cdots", function(context) {
  12151. var next = context.future().text;
  12152. if (next in spaceAfterDots) {
  12153. return "\\@cdots\\,";
  12154. } else {
  12155. return "\\@cdots";
  12156. }
  12157. });
  12158. defineMacro("\\dotsb", "\\cdots");
  12159. defineMacro("\\dotsm", "\\cdots");
  12160. defineMacro("\\dotsi", "\\!\\cdots");
  12161. defineMacro("\\dotsx", "\\ldots\\,");
  12162. defineMacro("\\DOTSI", "\\relax");
  12163. defineMacro("\\DOTSB", "\\relax");
  12164. defineMacro("\\DOTSX", "\\relax");
  12165. defineMacro("\\tmspace", "\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");
  12166. defineMacro("\\,", "\\tmspace+{3mu}{.1667em}");
  12167. defineMacro("\\thinspace", "\\,");
  12168. defineMacro("\\>", "\\mskip{4mu}");
  12169. defineMacro("\\:", "\\tmspace+{4mu}{.2222em}");
  12170. defineMacro("\\medspace", "\\:");
  12171. defineMacro("\\;", "\\tmspace+{5mu}{.2777em}");
  12172. defineMacro("\\thickspace", "\\;");
  12173. defineMacro("\\!", "\\tmspace-{3mu}{.1667em}");
  12174. defineMacro("\\negthinspace", "\\!");
  12175. defineMacro("\\negmedspace", "\\tmspace-{4mu}{.2222em}");
  12176. defineMacro("\\negthickspace", "\\tmspace-{5mu}{.277em}");
  12177. defineMacro("\\enspace", "\\kern.5em ");
  12178. defineMacro("\\enskip", "\\hskip.5em\\relax");
  12179. defineMacro("\\quad", "\\hskip1em\\relax");
  12180. defineMacro("\\qquad", "\\hskip2em\\relax");
  12181. defineMacro("\\tag", "\\@ifstar\\tag@literal\\tag@paren");
  12182. defineMacro("\\tag@paren", "\\tag@literal{({#1})}");
  12183. defineMacro("\\tag@literal", (context) => {
  12184. if (context.macros.get("\\df@tag")) {
  12185. throw new ParseError("Multiple \\tag");
  12186. }
  12187. return "\\gdef\\df@tag{\\text{#1}}";
  12188. });
  12189. defineMacro("\\bmod", "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");
  12190. defineMacro("\\pod", "\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");
  12191. defineMacro("\\pmod", "\\pod{{\\rm mod}\\mkern6mu#1}");
  12192. defineMacro("\\mod", "\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");
  12193. defineMacro("\\newline", "\\\\\\relax");
  12194. defineMacro("\\TeX", "\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");
  12195. var latexRaiseA = makeEm(fontMetricsData["Main-Regular"]["T".charCodeAt(0)][1] - 0.7 * fontMetricsData["Main-Regular"]["A".charCodeAt(0)][1]);
  12196. defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" + ("L\\kern-.36em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{LaTeX}}");
  12197. defineMacro("\\KaTeX", "\\textrm{\\html@mathml{" + ("K\\kern-.17em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{KaTeX}}");
  12198. defineMacro("\\hspace", "\\@ifstar\\@hspacer\\@hspace");
  12199. defineMacro("\\@hspace", "\\hskip #1\\relax");
  12200. defineMacro("\\@hspacer", "\\rule{0pt}{0pt}\\hskip #1\\relax");
  12201. defineMacro("\\ordinarycolon", ":");
  12202. defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}");
  12203. defineMacro("\\dblcolon", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');
  12204. defineMacro("\\coloneqq", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');
  12205. defineMacro("\\Coloneqq", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');
  12206. defineMacro("\\coloneq", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');
  12207. defineMacro("\\Coloneq", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');
  12208. defineMacro("\\eqqcolon", '\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');
  12209. defineMacro("\\Eqqcolon", '\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');
  12210. defineMacro("\\eqcolon", '\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');
  12211. defineMacro("\\Eqcolon", '\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');
  12212. defineMacro("\\colonapprox", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');
  12213. defineMacro("\\Colonapprox", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');
  12214. defineMacro("\\colonsim", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');
  12215. defineMacro("\\Colonsim", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');
  12216. defineMacro("∷", "\\dblcolon");
  12217. defineMacro("∹", "\\eqcolon");
  12218. defineMacro("≔", "\\coloneqq");
  12219. defineMacro("≕", "\\eqqcolon");
  12220. defineMacro("⩴", "\\Coloneqq");
  12221. defineMacro("\\ratio", "\\vcentcolon");
  12222. defineMacro("\\coloncolon", "\\dblcolon");
  12223. defineMacro("\\colonequals", "\\coloneqq");
  12224. defineMacro("\\coloncolonequals", "\\Coloneqq");
  12225. defineMacro("\\equalscolon", "\\eqqcolon");
  12226. defineMacro("\\equalscoloncolon", "\\Eqqcolon");
  12227. defineMacro("\\colonminus", "\\coloneq");
  12228. defineMacro("\\coloncolonminus", "\\Coloneq");
  12229. defineMacro("\\minuscolon", "\\eqcolon");
  12230. defineMacro("\\minuscoloncolon", "\\Eqcolon");
  12231. defineMacro("\\coloncolonapprox", "\\Colonapprox");
  12232. defineMacro("\\coloncolonsim", "\\Colonsim");
  12233. defineMacro("\\simcolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");
  12234. defineMacro("\\simcoloncolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");
  12235. defineMacro("\\approxcolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");
  12236. defineMacro("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");
  12237. defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");
  12238. defineMacro("\\limsup", "\\DOTSB\\operatorname*{lim\\,sup}");
  12239. defineMacro("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}");
  12240. defineMacro("\\injlim", "\\DOTSB\\operatorname*{inj\\,lim}");
  12241. defineMacro("\\projlim", "\\DOTSB\\operatorname*{proj\\,lim}");
  12242. defineMacro("\\varlimsup", "\\DOTSB\\operatorname*{\\overline{lim}}");
  12243. defineMacro("\\varliminf", "\\DOTSB\\operatorname*{\\underline{lim}}");
  12244. defineMacro("\\varinjlim", "\\DOTSB\\operatorname*{\\underrightarrow{lim}}");
  12245. defineMacro("\\varprojlim", "\\DOTSB\\operatorname*{\\underleftarrow{lim}}");
  12246. defineMacro("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{≩}");
  12247. defineMacro("\\lvertneqq", "\\html@mathml{\\@lvertneqq}{≨}");
  12248. defineMacro("\\ngeqq", "\\html@mathml{\\@ngeqq}{≱}");
  12249. defineMacro("\\ngeqslant", "\\html@mathml{\\@ngeqslant}{≱}");
  12250. defineMacro("\\nleqq", "\\html@mathml{\\@nleqq}{≰}");
  12251. defineMacro("\\nleqslant", "\\html@mathml{\\@nleqslant}{≰}");
  12252. defineMacro("\\nshortmid", "\\html@mathml{\\@nshortmid}{∤}");
  12253. defineMacro("\\nshortparallel", "\\html@mathml{\\@nshortparallel}{∦}");
  12254. defineMacro("\\nsubseteqq", "\\html@mathml{\\@nsubseteqq}{⊈}");
  12255. defineMacro("\\nsupseteqq", "\\html@mathml{\\@nsupseteqq}{⊉}");
  12256. defineMacro("\\varsubsetneq", "\\html@mathml{\\@varsubsetneq}{⊊}");
  12257. defineMacro("\\varsubsetneqq", "\\html@mathml{\\@varsubsetneqq}{⫋}");
  12258. defineMacro("\\varsupsetneq", "\\html@mathml{\\@varsupsetneq}{⊋}");
  12259. defineMacro("\\varsupsetneqq", "\\html@mathml{\\@varsupsetneqq}{⫌}");
  12260. defineMacro("\\imath", "\\html@mathml{\\@imath}{ı}");
  12261. defineMacro("\\jmath", "\\html@mathml{\\@jmath}{ȷ}");
  12262. defineMacro("\\llbracket", "\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");
  12263. defineMacro("\\rrbracket", "\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");
  12264. defineMacro("⟦", "\\llbracket");
  12265. defineMacro("⟧", "\\rrbracket");
  12266. defineMacro("\\lBrace", "\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");
  12267. defineMacro("\\rBrace", "\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");
  12268. defineMacro("⦃", "\\lBrace");
  12269. defineMacro("⦄", "\\rBrace");
  12270. defineMacro("\\minuso", "\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");
  12271. defineMacro("⦵", "\\minuso");
  12272. defineMacro("\\darr", "\\downarrow");
  12273. defineMacro("\\dArr", "\\Downarrow");
  12274. defineMacro("\\Darr", "\\Downarrow");
  12275. defineMacro("\\lang", "\\langle");
  12276. defineMacro("\\rang", "\\rangle");
  12277. defineMacro("\\uarr", "\\uparrow");
  12278. defineMacro("\\uArr", "\\Uparrow");
  12279. defineMacro("\\Uarr", "\\Uparrow");
  12280. defineMacro("\\N", "\\mathbb{N}");
  12281. defineMacro("\\R", "\\mathbb{R}");
  12282. defineMacro("\\Z", "\\mathbb{Z}");
  12283. defineMacro("\\alef", "\\aleph");
  12284. defineMacro("\\alefsym", "\\aleph");
  12285. defineMacro("\\Alpha", "\\mathrm{A}");
  12286. defineMacro("\\Beta", "\\mathrm{B}");
  12287. defineMacro("\\bull", "\\bullet");
  12288. defineMacro("\\Chi", "\\mathrm{X}");
  12289. defineMacro("\\clubs", "\\clubsuit");
  12290. defineMacro("\\cnums", "\\mathbb{C}");
  12291. defineMacro("\\Complex", "\\mathbb{C}");
  12292. defineMacro("\\Dagger", "\\ddagger");
  12293. defineMacro("\\diamonds", "\\diamondsuit");
  12294. defineMacro("\\empty", "\\emptyset");
  12295. defineMacro("\\Epsilon", "\\mathrm{E}");
  12296. defineMacro("\\Eta", "\\mathrm{H}");
  12297. defineMacro("\\exist", "\\exists");
  12298. defineMacro("\\harr", "\\leftrightarrow");
  12299. defineMacro("\\hArr", "\\Leftrightarrow");
  12300. defineMacro("\\Harr", "\\Leftrightarrow");
  12301. defineMacro("\\hearts", "\\heartsuit");
  12302. defineMacro("\\image", "\\Im");
  12303. defineMacro("\\infin", "\\infty");
  12304. defineMacro("\\Iota", "\\mathrm{I}");
  12305. defineMacro("\\isin", "\\in");
  12306. defineMacro("\\Kappa", "\\mathrm{K}");
  12307. defineMacro("\\larr", "\\leftarrow");
  12308. defineMacro("\\lArr", "\\Leftarrow");
  12309. defineMacro("\\Larr", "\\Leftarrow");
  12310. defineMacro("\\lrarr", "\\leftrightarrow");
  12311. defineMacro("\\lrArr", "\\Leftrightarrow");
  12312. defineMacro("\\Lrarr", "\\Leftrightarrow");
  12313. defineMacro("\\Mu", "\\mathrm{M}");
  12314. defineMacro("\\natnums", "\\mathbb{N}");
  12315. defineMacro("\\Nu", "\\mathrm{N}");
  12316. defineMacro("\\Omicron", "\\mathrm{O}");
  12317. defineMacro("\\plusmn", "\\pm");
  12318. defineMacro("\\rarr", "\\rightarrow");
  12319. defineMacro("\\rArr", "\\Rightarrow");
  12320. defineMacro("\\Rarr", "\\Rightarrow");
  12321. defineMacro("\\real", "\\Re");
  12322. defineMacro("\\reals", "\\mathbb{R}");
  12323. defineMacro("\\Reals", "\\mathbb{R}");
  12324. defineMacro("\\Rho", "\\mathrm{P}");
  12325. defineMacro("\\sdot", "\\cdot");
  12326. defineMacro("\\sect", "\\S");
  12327. defineMacro("\\spades", "\\spadesuit");
  12328. defineMacro("\\sub", "\\subset");
  12329. defineMacro("\\sube", "\\subseteq");
  12330. defineMacro("\\supe", "\\supseteq");
  12331. defineMacro("\\Tau", "\\mathrm{T}");
  12332. defineMacro("\\thetasym", "\\vartheta");
  12333. defineMacro("\\weierp", "\\wp");
  12334. defineMacro("\\Zeta", "\\mathrm{Z}");
  12335. defineMacro("\\argmin", "\\DOTSB\\operatorname*{arg\\,min}");
  12336. defineMacro("\\argmax", "\\DOTSB\\operatorname*{arg\\,max}");
  12337. defineMacro("\\plim", "\\DOTSB\\mathop{\\operatorname{plim}}\\limits");
  12338. defineMacro("\\bra", "\\mathinner{\\langle{#1}|}");
  12339. defineMacro("\\ket", "\\mathinner{|{#1}\\rangle}");
  12340. defineMacro("\\braket", "\\mathinner{\\langle{#1}\\rangle}");
  12341. defineMacro("\\Bra", "\\left\\langle#1\\right|");
  12342. defineMacro("\\Ket", "\\left|#1\\right\\rangle");
  12343. var braketHelper = (one) => (context) => {
  12344. var left = context.consumeArg().tokens;
  12345. var middle = context.consumeArg().tokens;
  12346. var middleDouble = context.consumeArg().tokens;
  12347. var right = context.consumeArg().tokens;
  12348. var oldMiddle = context.macros.get("|");
  12349. var oldMiddleDouble = context.macros.get("\\|");
  12350. context.macros.beginGroup();
  12351. var midMacro = (double) => (context2) => {
  12352. if (one) {
  12353. context2.macros.set("|", oldMiddle);
  12354. if (middleDouble.length) {
  12355. context2.macros.set("\\|", oldMiddleDouble);
  12356. }
  12357. }
  12358. var doubled = double;
  12359. if (!double && middleDouble.length) {
  12360. var nextToken = context2.future();
  12361. if (nextToken.text === "|") {
  12362. context2.popToken();
  12363. doubled = true;
  12364. }
  12365. }
  12366. return {
  12367. tokens: doubled ? middleDouble : middle,
  12368. numArgs: 0
  12369. };
  12370. };
  12371. context.macros.set("|", midMacro(false));
  12372. if (middleDouble.length) {
  12373. context.macros.set("\\|", midMacro(true));
  12374. }
  12375. var arg = context.consumeArg().tokens;
  12376. var expanded = context.expandTokens([
  12377. ...right,
  12378. ...arg,
  12379. ...left
  12380. // reversed
  12381. ]);
  12382. context.macros.endGroup();
  12383. return {
  12384. tokens: expanded.reverse(),
  12385. numArgs: 0
  12386. };
  12387. };
  12388. defineMacro("\\bra@ket", braketHelper(false));
  12389. defineMacro("\\bra@set", braketHelper(true));
  12390. defineMacro("\\Braket", "\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");
  12391. defineMacro("\\Set", "\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");
  12392. defineMacro("\\set", "\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");
  12393. defineMacro("\\angln", "{\\angl n}");
  12394. defineMacro("\\blue", "\\textcolor{##6495ed}{#1}");
  12395. defineMacro("\\orange", "\\textcolor{##ffa500}{#1}");
  12396. defineMacro("\\pink", "\\textcolor{##ff00af}{#1}");
  12397. defineMacro("\\red", "\\textcolor{##df0030}{#1}");
  12398. defineMacro("\\green", "\\textcolor{##28ae7b}{#1}");
  12399. defineMacro("\\gray", "\\textcolor{gray}{#1}");
  12400. defineMacro("\\purple", "\\textcolor{##9d38bd}{#1}");
  12401. defineMacro("\\blueA", "\\textcolor{##ccfaff}{#1}");
  12402. defineMacro("\\blueB", "\\textcolor{##80f6ff}{#1}");
  12403. defineMacro("\\blueC", "\\textcolor{##63d9ea}{#1}");
  12404. defineMacro("\\blueD", "\\textcolor{##11accd}{#1}");
  12405. defineMacro("\\blueE", "\\textcolor{##0c7f99}{#1}");
  12406. defineMacro("\\tealA", "\\textcolor{##94fff5}{#1}");
  12407. defineMacro("\\tealB", "\\textcolor{##26edd5}{#1}");
  12408. defineMacro("\\tealC", "\\textcolor{##01d1c1}{#1}");
  12409. defineMacro("\\tealD", "\\textcolor{##01a995}{#1}");
  12410. defineMacro("\\tealE", "\\textcolor{##208170}{#1}");
  12411. defineMacro("\\greenA", "\\textcolor{##b6ffb0}{#1}");
  12412. defineMacro("\\greenB", "\\textcolor{##8af281}{#1}");
  12413. defineMacro("\\greenC", "\\textcolor{##74cf70}{#1}");
  12414. defineMacro("\\greenD", "\\textcolor{##1fab54}{#1}");
  12415. defineMacro("\\greenE", "\\textcolor{##0d923f}{#1}");
  12416. defineMacro("\\goldA", "\\textcolor{##ffd0a9}{#1}");
  12417. defineMacro("\\goldB", "\\textcolor{##ffbb71}{#1}");
  12418. defineMacro("\\goldC", "\\textcolor{##ff9c39}{#1}");
  12419. defineMacro("\\goldD", "\\textcolor{##e07d10}{#1}");
  12420. defineMacro("\\goldE", "\\textcolor{##a75a05}{#1}");
  12421. defineMacro("\\redA", "\\textcolor{##fca9a9}{#1}");
  12422. defineMacro("\\redB", "\\textcolor{##ff8482}{#1}");
  12423. defineMacro("\\redC", "\\textcolor{##f9685d}{#1}");
  12424. defineMacro("\\redD", "\\textcolor{##e84d39}{#1}");
  12425. defineMacro("\\redE", "\\textcolor{##bc2612}{#1}");
  12426. defineMacro("\\maroonA", "\\textcolor{##ffbde0}{#1}");
  12427. defineMacro("\\maroonB", "\\textcolor{##ff92c6}{#1}");
  12428. defineMacro("\\maroonC", "\\textcolor{##ed5fa6}{#1}");
  12429. defineMacro("\\maroonD", "\\textcolor{##ca337c}{#1}");
  12430. defineMacro("\\maroonE", "\\textcolor{##9e034e}{#1}");
  12431. defineMacro("\\purpleA", "\\textcolor{##ddd7ff}{#1}");
  12432. defineMacro("\\purpleB", "\\textcolor{##c6b9fc}{#1}");
  12433. defineMacro("\\purpleC", "\\textcolor{##aa87ff}{#1}");
  12434. defineMacro("\\purpleD", "\\textcolor{##7854ab}{#1}");
  12435. defineMacro("\\purpleE", "\\textcolor{##543b78}{#1}");
  12436. defineMacro("\\mintA", "\\textcolor{##f5f9e8}{#1}");
  12437. defineMacro("\\mintB", "\\textcolor{##edf2df}{#1}");
  12438. defineMacro("\\mintC", "\\textcolor{##e0e5cc}{#1}");
  12439. defineMacro("\\grayA", "\\textcolor{##f6f7f7}{#1}");
  12440. defineMacro("\\grayB", "\\textcolor{##f0f1f2}{#1}");
  12441. defineMacro("\\grayC", "\\textcolor{##e3e5e6}{#1}");
  12442. defineMacro("\\grayD", "\\textcolor{##d6d8da}{#1}");
  12443. defineMacro("\\grayE", "\\textcolor{##babec2}{#1}");
  12444. defineMacro("\\grayF", "\\textcolor{##888d93}{#1}");
  12445. defineMacro("\\grayG", "\\textcolor{##626569}{#1}");
  12446. defineMacro("\\grayH", "\\textcolor{##3b3e40}{#1}");
  12447. defineMacro("\\grayI", "\\textcolor{##21242c}{#1}");
  12448. defineMacro("\\kaBlue", "\\textcolor{##314453}{#1}");
  12449. defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}");
  12450. var implicitCommands = {
  12451. "^": true,
  12452. // Parser.js
  12453. "_": true,
  12454. // Parser.js
  12455. "\\limits": true,
  12456. // Parser.js
  12457. "\\nolimits": true
  12458. // Parser.js
  12459. };
  12460. var MacroExpander = class {
  12461. constructor(input, settings, mode) {
  12462. this.settings = settings;
  12463. this.expansionCount = 0;
  12464. this.feed(input);
  12465. this.macros = new Namespace(macros, settings.macros);
  12466. this.mode = mode;
  12467. this.stack = [];
  12468. }
  12469. /**
  12470. * Feed a new input string to the same MacroExpander
  12471. * (with existing macros etc.).
  12472. */
  12473. feed(input) {
  12474. this.lexer = new Lexer(input, this.settings);
  12475. }
  12476. /**
  12477. * Switches between "text" and "math" modes.
  12478. */
  12479. switchMode(newMode) {
  12480. this.mode = newMode;
  12481. }
  12482. /**
  12483. * Start a new group nesting within all namespaces.
  12484. */
  12485. beginGroup() {
  12486. this.macros.beginGroup();
  12487. }
  12488. /**
  12489. * End current group nesting within all namespaces.
  12490. */
  12491. endGroup() {
  12492. this.macros.endGroup();
  12493. }
  12494. /**
  12495. * Ends all currently nested groups (if any), restoring values before the
  12496. * groups began. Useful in case of an error in the middle of parsing.
  12497. */
  12498. endGroups() {
  12499. this.macros.endGroups();
  12500. }
  12501. /**
  12502. * Returns the topmost token on the stack, without expanding it.
  12503. * Similar in behavior to TeX's `\futurelet`.
  12504. */
  12505. future() {
  12506. if (this.stack.length === 0) {
  12507. this.pushToken(this.lexer.lex());
  12508. }
  12509. return this.stack[this.stack.length - 1];
  12510. }
  12511. /**
  12512. * Remove and return the next unexpanded token.
  12513. */
  12514. popToken() {
  12515. this.future();
  12516. return this.stack.pop();
  12517. }
  12518. /**
  12519. * Add a given token to the token stack. In particular, this get be used
  12520. * to put back a token returned from one of the other methods.
  12521. */
  12522. pushToken(token) {
  12523. this.stack.push(token);
  12524. }
  12525. /**
  12526. * Append an array of tokens to the token stack.
  12527. */
  12528. pushTokens(tokens) {
  12529. this.stack.push(...tokens);
  12530. }
  12531. /**
  12532. * Find an macro argument without expanding tokens and append the array of
  12533. * tokens to the token stack. Uses Token as a container for the result.
  12534. */
  12535. scanArgument(isOptional) {
  12536. var start;
  12537. var end;
  12538. var tokens;
  12539. if (isOptional) {
  12540. this.consumeSpaces();
  12541. if (this.future().text !== "[") {
  12542. return null;
  12543. }
  12544. start = this.popToken();
  12545. ({
  12546. tokens,
  12547. end
  12548. } = this.consumeArg(["]"]));
  12549. } else {
  12550. ({
  12551. tokens,
  12552. start,
  12553. end
  12554. } = this.consumeArg());
  12555. }
  12556. this.pushToken(new Token("EOF", end.loc));
  12557. this.pushTokens(tokens);
  12558. return new Token("", SourceLocation.range(start, end));
  12559. }
  12560. /**
  12561. * Consume all following space tokens, without expansion.
  12562. */
  12563. consumeSpaces() {
  12564. for (; ; ) {
  12565. var token = this.future();
  12566. if (token.text === " ") {
  12567. this.stack.pop();
  12568. } else {
  12569. break;
  12570. }
  12571. }
  12572. }
  12573. /**
  12574. * Consume an argument from the token stream, and return the resulting array
  12575. * of tokens and start/end token.
  12576. */
  12577. consumeArg(delims) {
  12578. var tokens = [];
  12579. var isDelimited = delims && delims.length > 0;
  12580. if (!isDelimited) {
  12581. this.consumeSpaces();
  12582. }
  12583. var start = this.future();
  12584. var tok;
  12585. var depth = 0;
  12586. var match = 0;
  12587. do {
  12588. tok = this.popToken();
  12589. tokens.push(tok);
  12590. if (tok.text === "{") {
  12591. ++depth;
  12592. } else if (tok.text === "}") {
  12593. --depth;
  12594. if (depth === -1) {
  12595. throw new ParseError("Extra }", tok);
  12596. }
  12597. } else if (tok.text === "EOF") {
  12598. throw new ParseError("Unexpected end of input in a macro argument, expected '" + (delims && isDelimited ? delims[match] : "}") + "'", tok);
  12599. }
  12600. if (delims && isDelimited) {
  12601. if ((depth === 0 || depth === 1 && delims[match] === "{") && tok.text === delims[match]) {
  12602. ++match;
  12603. if (match === delims.length) {
  12604. tokens.splice(-match, match);
  12605. break;
  12606. }
  12607. } else {
  12608. match = 0;
  12609. }
  12610. }
  12611. } while (depth !== 0 || isDelimited);
  12612. if (start.text === "{" && tokens[tokens.length - 1].text === "}") {
  12613. tokens.pop();
  12614. tokens.shift();
  12615. }
  12616. tokens.reverse();
  12617. return {
  12618. tokens,
  12619. start,
  12620. end: tok
  12621. };
  12622. }
  12623. /**
  12624. * Consume the specified number of (delimited) arguments from the token
  12625. * stream and return the resulting array of arguments.
  12626. */
  12627. consumeArgs(numArgs, delimiters2) {
  12628. if (delimiters2) {
  12629. if (delimiters2.length !== numArgs + 1) {
  12630. throw new ParseError("The length of delimiters doesn't match the number of args!");
  12631. }
  12632. var delims = delimiters2[0];
  12633. for (var i = 0; i < delims.length; i++) {
  12634. var tok = this.popToken();
  12635. if (delims[i] !== tok.text) {
  12636. throw new ParseError("Use of the macro doesn't match its definition", tok);
  12637. }
  12638. }
  12639. }
  12640. var args = [];
  12641. for (var _i = 0; _i < numArgs; _i++) {
  12642. args.push(this.consumeArg(delimiters2 && delimiters2[_i + 1]).tokens);
  12643. }
  12644. return args;
  12645. }
  12646. /**
  12647. * Increment `expansionCount` by the specified amount.
  12648. * Throw an error if it exceeds `maxExpand`.
  12649. */
  12650. countExpansion(amount) {
  12651. this.expansionCount += amount;
  12652. if (this.expansionCount > this.settings.maxExpand) {
  12653. throw new ParseError("Too many expansions: infinite loop or need to increase maxExpand setting");
  12654. }
  12655. }
  12656. /**
  12657. * Expand the next token only once if possible.
  12658. *
  12659. * If the token is expanded, the resulting tokens will be pushed onto
  12660. * the stack in reverse order, and the number of such tokens will be
  12661. * returned. This number might be zero or positive.
  12662. *
  12663. * If not, the return value is `false`, and the next token remains at the
  12664. * top of the stack.
  12665. *
  12666. * In either case, the next token will be on the top of the stack,
  12667. * or the stack will be empty (in case of empty expansion
  12668. * and no other tokens).
  12669. *
  12670. * Used to implement `expandAfterFuture` and `expandNextToken`.
  12671. *
  12672. * If expandableOnly, only expandable tokens are expanded and
  12673. * an undefined control sequence results in an error.
  12674. */
  12675. expandOnce(expandableOnly) {
  12676. var topToken = this.popToken();
  12677. var name = topToken.text;
  12678. var expansion = !topToken.noexpand ? this._getExpansion(name) : null;
  12679. if (expansion == null || expandableOnly && expansion.unexpandable) {
  12680. if (expandableOnly && expansion == null && name[0] === "\\" && !this.isDefined(name)) {
  12681. throw new ParseError("Undefined control sequence: " + name);
  12682. }
  12683. this.pushToken(topToken);
  12684. return false;
  12685. }
  12686. this.countExpansion(1);
  12687. var tokens = expansion.tokens;
  12688. var args = this.consumeArgs(expansion.numArgs, expansion.delimiters);
  12689. if (expansion.numArgs) {
  12690. tokens = tokens.slice();
  12691. for (var i = tokens.length - 1; i >= 0; --i) {
  12692. var tok = tokens[i];
  12693. if (tok.text === "#") {
  12694. if (i === 0) {
  12695. throw new ParseError("Incomplete placeholder at end of macro body", tok);
  12696. }
  12697. tok = tokens[--i];
  12698. if (tok.text === "#") {
  12699. tokens.splice(i + 1, 1);
  12700. } else if (/^[1-9]$/.test(tok.text)) {
  12701. tokens.splice(i, 2, ...args[+tok.text - 1]);
  12702. } else {
  12703. throw new ParseError("Not a valid argument number", tok);
  12704. }
  12705. }
  12706. }
  12707. }
  12708. this.pushTokens(tokens);
  12709. return tokens.length;
  12710. }
  12711. /**
  12712. * Expand the next token only once (if possible), and return the resulting
  12713. * top token on the stack (without removing anything from the stack).
  12714. * Similar in behavior to TeX's `\expandafter\futurelet`.
  12715. * Equivalent to expandOnce() followed by future().
  12716. */
  12717. expandAfterFuture() {
  12718. this.expandOnce();
  12719. return this.future();
  12720. }
  12721. /**
  12722. * Recursively expand first token, then return first non-expandable token.
  12723. */
  12724. expandNextToken() {
  12725. for (; ; ) {
  12726. if (this.expandOnce() === false) {
  12727. var token = this.stack.pop();
  12728. if (token.treatAsRelax) {
  12729. token.text = "\\relax";
  12730. }
  12731. return token;
  12732. }
  12733. }
  12734. }
  12735. /**
  12736. * Fully expand the given macro name and return the resulting list of
  12737. * tokens, or return `undefined` if no such macro is defined.
  12738. */
  12739. expandMacro(name) {
  12740. return this.macros.has(name) ? this.expandTokens([new Token(name)]) : void 0;
  12741. }
  12742. /**
  12743. * Fully expand the given token stream and return the resulting list of
  12744. * tokens. Note that the input tokens are in reverse order, but the
  12745. * output tokens are in forward order.
  12746. */
  12747. expandTokens(tokens) {
  12748. var output = [];
  12749. var oldStackLength = this.stack.length;
  12750. this.pushTokens(tokens);
  12751. while (this.stack.length > oldStackLength) {
  12752. if (this.expandOnce(true) === false) {
  12753. var token = this.stack.pop();
  12754. if (token.treatAsRelax) {
  12755. token.noexpand = false;
  12756. token.treatAsRelax = false;
  12757. }
  12758. output.push(token);
  12759. }
  12760. }
  12761. this.countExpansion(output.length);
  12762. return output;
  12763. }
  12764. /**
  12765. * Fully expand the given macro name and return the result as a string,
  12766. * or return `undefined` if no such macro is defined.
  12767. */
  12768. expandMacroAsText(name) {
  12769. var tokens = this.expandMacro(name);
  12770. if (tokens) {
  12771. return tokens.map((token) => token.text).join("");
  12772. } else {
  12773. return tokens;
  12774. }
  12775. }
  12776. /**
  12777. * Returns the expanded macro as a reversed array of tokens and a macro
  12778. * argument count. Or returns `null` if no such macro.
  12779. */
  12780. _getExpansion(name) {
  12781. var definition = this.macros.get(name);
  12782. if (definition == null) {
  12783. return definition;
  12784. }
  12785. if (name.length === 1) {
  12786. var catcode = this.lexer.catcodes[name];
  12787. if (catcode != null && catcode !== 13) {
  12788. return;
  12789. }
  12790. }
  12791. var expansion = typeof definition === "function" ? definition(this) : definition;
  12792. if (typeof expansion === "string") {
  12793. var numArgs = 0;
  12794. if (expansion.includes("#")) {
  12795. var stripped = expansion.replace(/##/g, "");
  12796. while (stripped.includes("#" + (numArgs + 1))) {
  12797. ++numArgs;
  12798. }
  12799. }
  12800. var bodyLexer = new Lexer(expansion, this.settings);
  12801. var tokens = [];
  12802. var tok = bodyLexer.lex();
  12803. while (tok.text !== "EOF") {
  12804. tokens.push(tok);
  12805. tok = bodyLexer.lex();
  12806. }
  12807. tokens.reverse();
  12808. var expanded = {
  12809. tokens,
  12810. numArgs
  12811. };
  12812. return expanded;
  12813. }
  12814. return expansion;
  12815. }
  12816. /**
  12817. * Determine whether a command is currently "defined" (has some
  12818. * functionality), meaning that it's a macro (in the current group),
  12819. * a function, a symbol, or one of the special commands listed in
  12820. * `implicitCommands`.
  12821. */
  12822. isDefined(name) {
  12823. return this.macros.has(name) || functions.hasOwnProperty(name) || symbols.math.hasOwnProperty(name) || symbols.text.hasOwnProperty(name) || implicitCommands.hasOwnProperty(name);
  12824. }
  12825. /**
  12826. * Determine whether a command is expandable.
  12827. */
  12828. isExpandable(name) {
  12829. var macro = this.macros.get(name);
  12830. return macro != null ? typeof macro === "string" || typeof macro === "function" || !macro.unexpandable : functions.hasOwnProperty(name) && !functions[name].primitive;
  12831. }
  12832. };
  12833. var unicodeSubRegEx = /^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/;
  12834. var uSubsAndSups = Object.freeze({
  12835. "₊": "+",
  12836. "₋": "-",
  12837. "₌": "=",
  12838. "₍": "(",
  12839. "₎": ")",
  12840. "₀": "0",
  12841. "₁": "1",
  12842. "₂": "2",
  12843. "₃": "3",
  12844. "₄": "4",
  12845. "₅": "5",
  12846. "₆": "6",
  12847. "₇": "7",
  12848. "₈": "8",
  12849. "₉": "9",
  12850. "ₐ": "a",
  12851. "ₑ": "e",
  12852. "ₕ": "h",
  12853. "ᵢ": "i",
  12854. "ⱼ": "j",
  12855. "ₖ": "k",
  12856. "ₗ": "l",
  12857. "ₘ": "m",
  12858. "ₙ": "n",
  12859. "ₒ": "o",
  12860. "ₚ": "p",
  12861. "ᵣ": "r",
  12862. "ₛ": "s",
  12863. "ₜ": "t",
  12864. "ᵤ": "u",
  12865. "ᵥ": "v",
  12866. "ₓ": "x",
  12867. "ᵦ": "β",
  12868. "ᵧ": "γ",
  12869. "ᵨ": "ρ",
  12870. "ᵩ": "ϕ",
  12871. "ᵪ": "χ",
  12872. "⁺": "+",
  12873. "⁻": "-",
  12874. "⁼": "=",
  12875. "⁽": "(",
  12876. "⁾": ")",
  12877. "⁰": "0",
  12878. "¹": "1",
  12879. "²": "2",
  12880. "³": "3",
  12881. "⁴": "4",
  12882. "⁵": "5",
  12883. "⁶": "6",
  12884. "⁷": "7",
  12885. "⁸": "8",
  12886. "⁹": "9",
  12887. "ᴬ": "A",
  12888. "ᴮ": "B",
  12889. "ᴰ": "D",
  12890. "ᴱ": "E",
  12891. "ᴳ": "G",
  12892. "ᴴ": "H",
  12893. "ᴵ": "I",
  12894. "ᴶ": "J",
  12895. "ᴷ": "K",
  12896. "ᴸ": "L",
  12897. "ᴹ": "M",
  12898. "ᴺ": "N",
  12899. "ᴼ": "O",
  12900. "ᴾ": "P",
  12901. "ᴿ": "R",
  12902. "ᵀ": "T",
  12903. "ᵁ": "U",
  12904. "ⱽ": "V",
  12905. "ᵂ": "W",
  12906. "ᵃ": "a",
  12907. "ᵇ": "b",
  12908. "ᶜ": "c",
  12909. "ᵈ": "d",
  12910. "ᵉ": "e",
  12911. "ᶠ": "f",
  12912. "ᵍ": "g",
  12913. "ʰ": "h",
  12914. "ⁱ": "i",
  12915. "ʲ": "j",
  12916. "ᵏ": "k",
  12917. "ˡ": "l",
  12918. "ᵐ": "m",
  12919. "ⁿ": "n",
  12920. "ᵒ": "o",
  12921. "ᵖ": "p",
  12922. "ʳ": "r",
  12923. "ˢ": "s",
  12924. "ᵗ": "t",
  12925. "ᵘ": "u",
  12926. "ᵛ": "v",
  12927. "ʷ": "w",
  12928. "ˣ": "x",
  12929. "ʸ": "y",
  12930. "ᶻ": "z",
  12931. "ᵝ": "β",
  12932. "ᵞ": "γ",
  12933. "ᵟ": "δ",
  12934. "ᵠ": "ϕ",
  12935. "ᵡ": "χ",
  12936. "ᶿ": "θ"
  12937. });
  12938. var unicodeAccents = {
  12939. "́": {
  12940. "text": "\\'",
  12941. "math": "\\acute"
  12942. },
  12943. "̀": {
  12944. "text": "\\`",
  12945. "math": "\\grave"
  12946. },
  12947. "̈": {
  12948. "text": '\\"',
  12949. "math": "\\ddot"
  12950. },
  12951. "̃": {
  12952. "text": "\\~",
  12953. "math": "\\tilde"
  12954. },
  12955. "̄": {
  12956. "text": "\\=",
  12957. "math": "\\bar"
  12958. },
  12959. "̆": {
  12960. "text": "\\u",
  12961. "math": "\\breve"
  12962. },
  12963. "̌": {
  12964. "text": "\\v",
  12965. "math": "\\check"
  12966. },
  12967. "̂": {
  12968. "text": "\\^",
  12969. "math": "\\hat"
  12970. },
  12971. "̇": {
  12972. "text": "\\.",
  12973. "math": "\\dot"
  12974. },
  12975. "̊": {
  12976. "text": "\\r",
  12977. "math": "\\mathring"
  12978. },
  12979. "̋": {
  12980. "text": "\\H"
  12981. },
  12982. "̧": {
  12983. "text": "\\c"
  12984. }
  12985. };
  12986. var unicodeSymbols = {
  12987. "á": "á",
  12988. "à": "à",
  12989. "ä": "ä",
  12990. "ǟ": "ǟ",
  12991. "ã": "ã",
  12992. "ā": "ā",
  12993. "ă": "ă",
  12994. "ắ": "ắ",
  12995. "ằ": "ằ",
  12996. "ẵ": "ẵ",
  12997. "ǎ": "ǎ",
  12998. "â": "â",
  12999. "ấ": "ấ",
  13000. "ầ": "ầ",
  13001. "ẫ": "ẫ",
  13002. "ȧ": "ȧ",
  13003. "ǡ": "ǡ",
  13004. "å": "å",
  13005. "ǻ": "ǻ",
  13006. "ḃ": "ḃ",
  13007. "ć": "ć",
  13008. "ḉ": "ḉ",
  13009. "č": "č",
  13010. "ĉ": "ĉ",
  13011. "ċ": "ċ",
  13012. "ç": "ç",
  13013. "ď": "ď",
  13014. "ḋ": "ḋ",
  13015. "ḑ": "ḑ",
  13016. "é": "é",
  13017. "è": "è",
  13018. "ë": "ë",
  13019. "ẽ": "ẽ",
  13020. "ē": "ē",
  13021. "ḗ": "ḗ",
  13022. "ḕ": "ḕ",
  13023. "ĕ": "ĕ",
  13024. "ḝ": "ḝ",
  13025. "ě": "ě",
  13026. "ê": "ê",
  13027. "ế": "ế",
  13028. "ề": "ề",
  13029. "ễ": "ễ",
  13030. "ė": "ė",
  13031. "ȩ": "ȩ",
  13032. "ḟ": "ḟ",
  13033. "ǵ": "ǵ",
  13034. "ḡ": "ḡ",
  13035. "ğ": "ğ",
  13036. "ǧ": "ǧ",
  13037. "ĝ": "ĝ",
  13038. "ġ": "ġ",
  13039. "ģ": "ģ",
  13040. "ḧ": "ḧ",
  13041. "ȟ": "ȟ",
  13042. "ĥ": "ĥ",
  13043. "ḣ": "ḣ",
  13044. "ḩ": "ḩ",
  13045. "í": "í",
  13046. "ì": "ì",
  13047. "ï": "ï",
  13048. "ḯ": "ḯ",
  13049. "ĩ": "ĩ",
  13050. "ī": "ī",
  13051. "ĭ": "ĭ",
  13052. "ǐ": "ǐ",
  13053. "î": "î",
  13054. "ǰ": "ǰ",
  13055. "ĵ": "ĵ",
  13056. "ḱ": "ḱ",
  13057. "ǩ": "ǩ",
  13058. "ķ": "ķ",
  13059. "ĺ": "ĺ",
  13060. "ľ": "ľ",
  13061. "ļ": "ļ",
  13062. "ḿ": "ḿ",
  13063. "ṁ": "ṁ",
  13064. "ń": "ń",
  13065. "ǹ": "ǹ",
  13066. "ñ": "ñ",
  13067. "ň": "ň",
  13068. "ṅ": "ṅ",
  13069. "ņ": "ņ",
  13070. "ó": "ó",
  13071. "ò": "ò",
  13072. "ö": "ö",
  13073. "ȫ": "ȫ",
  13074. "õ": "õ",
  13075. "ṍ": "ṍ",
  13076. "ṏ": "ṏ",
  13077. "ȭ": "ȭ",
  13078. "ō": "ō",
  13079. "ṓ": "ṓ",
  13080. "ṑ": "ṑ",
  13081. "ŏ": "ŏ",
  13082. "ǒ": "ǒ",
  13083. "ô": "ô",
  13084. "ố": "ố",
  13085. "ồ": "ồ",
  13086. "ỗ": "ỗ",
  13087. "ȯ": "ȯ",
  13088. "ȱ": "ȱ",
  13089. "ő": "ő",
  13090. "ṕ": "ṕ",
  13091. "ṗ": "ṗ",
  13092. "ŕ": "ŕ",
  13093. "ř": "ř",
  13094. "ṙ": "ṙ",
  13095. "ŗ": "ŗ",
  13096. "ś": "ś",
  13097. "ṥ": "ṥ",
  13098. "š": "š",
  13099. "ṧ": "ṧ",
  13100. "ŝ": "ŝ",
  13101. "ṡ": "ṡ",
  13102. "ş": "ş",
  13103. "ẗ": "ẗ",
  13104. "ť": "ť",
  13105. "ṫ": "ṫ",
  13106. "ţ": "ţ",
  13107. "ú": "ú",
  13108. "ù": "ù",
  13109. "ü": "ü",
  13110. "ǘ": "ǘ",
  13111. "ǜ": "ǜ",
  13112. "ǖ": "ǖ",
  13113. "ǚ": "ǚ",
  13114. "ũ": "ũ",
  13115. "ṹ": "ṹ",
  13116. "ū": "ū",
  13117. "ṻ": "ṻ",
  13118. "ŭ": "ŭ",
  13119. "ǔ": "ǔ",
  13120. "û": "û",
  13121. "ů": "ů",
  13122. "ű": "ű",
  13123. "ṽ": "ṽ",
  13124. "ẃ": "ẃ",
  13125. "ẁ": "ẁ",
  13126. "ẅ": "ẅ",
  13127. "ŵ": "ŵ",
  13128. "ẇ": "ẇ",
  13129. "ẘ": "ẘ",
  13130. "ẍ": "ẍ",
  13131. "ẋ": "ẋ",
  13132. "ý": "ý",
  13133. "ỳ": "ỳ",
  13134. "ÿ": "ÿ",
  13135. "ỹ": "ỹ",
  13136. "ȳ": "ȳ",
  13137. "ŷ": "ŷ",
  13138. "ẏ": "ẏ",
  13139. "ẙ": "ẙ",
  13140. "ź": "ź",
  13141. "ž": "ž",
  13142. "ẑ": "ẑ",
  13143. "ż": "ż",
  13144. "Á": "Á",
  13145. "À": "À",
  13146. "Ä": "Ä",
  13147. "Ǟ": "Ǟ",
  13148. "Ã": "Ã",
  13149. "Ā": "Ā",
  13150. "Ă": "Ă",
  13151. "Ắ": "Ắ",
  13152. "Ằ": "Ằ",
  13153. "Ẵ": "Ẵ",
  13154. "Ǎ": "Ǎ",
  13155. "Â": "Â",
  13156. "Ấ": "Ấ",
  13157. "Ầ": "Ầ",
  13158. "Ẫ": "Ẫ",
  13159. "Ȧ": "Ȧ",
  13160. "Ǡ": "Ǡ",
  13161. "Å": "Å",
  13162. "Ǻ": "Ǻ",
  13163. "Ḃ": "Ḃ",
  13164. "Ć": "Ć",
  13165. "Ḉ": "Ḉ",
  13166. "Č": "Č",
  13167. "Ĉ": "Ĉ",
  13168. "Ċ": "Ċ",
  13169. "Ç": "Ç",
  13170. "Ď": "Ď",
  13171. "Ḋ": "Ḋ",
  13172. "Ḑ": "Ḑ",
  13173. "É": "É",
  13174. "È": "È",
  13175. "Ë": "Ë",
  13176. "Ẽ": "Ẽ",
  13177. "Ē": "Ē",
  13178. "Ḗ": "Ḗ",
  13179. "Ḕ": "Ḕ",
  13180. "Ĕ": "Ĕ",
  13181. "Ḝ": "Ḝ",
  13182. "Ě": "Ě",
  13183. "Ê": "Ê",
  13184. "Ế": "Ế",
  13185. "Ề": "Ề",
  13186. "Ễ": "Ễ",
  13187. "Ė": "Ė",
  13188. "Ȩ": "Ȩ",
  13189. "Ḟ": "Ḟ",
  13190. "Ǵ": "Ǵ",
  13191. "Ḡ": "Ḡ",
  13192. "Ğ": "Ğ",
  13193. "Ǧ": "Ǧ",
  13194. "Ĝ": "Ĝ",
  13195. "Ġ": "Ġ",
  13196. "Ģ": "Ģ",
  13197. "Ḧ": "Ḧ",
  13198. "Ȟ": "Ȟ",
  13199. "Ĥ": "Ĥ",
  13200. "Ḣ": "Ḣ",
  13201. "Ḩ": "Ḩ",
  13202. "Í": "Í",
  13203. "Ì": "Ì",
  13204. "Ï": "Ï",
  13205. "Ḯ": "Ḯ",
  13206. "Ĩ": "Ĩ",
  13207. "Ī": "Ī",
  13208. "Ĭ": "Ĭ",
  13209. "Ǐ": "Ǐ",
  13210. "Î": "Î",
  13211. "İ": "İ",
  13212. "Ĵ": "Ĵ",
  13213. "Ḱ": "Ḱ",
  13214. "Ǩ": "Ǩ",
  13215. "Ķ": "Ķ",
  13216. "Ĺ": "Ĺ",
  13217. "Ľ": "Ľ",
  13218. "Ļ": "Ļ",
  13219. "Ḿ": "Ḿ",
  13220. "Ṁ": "Ṁ",
  13221. "Ń": "Ń",
  13222. "Ǹ": "Ǹ",
  13223. "Ñ": "Ñ",
  13224. "Ň": "Ň",
  13225. "Ṅ": "Ṅ",
  13226. "Ņ": "Ņ",
  13227. "Ó": "Ó",
  13228. "Ò": "Ò",
  13229. "Ö": "Ö",
  13230. "Ȫ": "Ȫ",
  13231. "Õ": "Õ",
  13232. "Ṍ": "Ṍ",
  13233. "Ṏ": "Ṏ",
  13234. "Ȭ": "Ȭ",
  13235. "Ō": "Ō",
  13236. "Ṓ": "Ṓ",
  13237. "Ṑ": "Ṑ",
  13238. "Ŏ": "Ŏ",
  13239. "Ǒ": "Ǒ",
  13240. "Ô": "Ô",
  13241. "Ố": "Ố",
  13242. "Ồ": "Ồ",
  13243. "Ỗ": "Ỗ",
  13244. "Ȯ": "Ȯ",
  13245. "Ȱ": "Ȱ",
  13246. "Ő": "Ő",
  13247. "Ṕ": "Ṕ",
  13248. "Ṗ": "Ṗ",
  13249. "Ŕ": "Ŕ",
  13250. "Ř": "Ř",
  13251. "Ṙ": "Ṙ",
  13252. "Ŗ": "Ŗ",
  13253. "Ś": "Ś",
  13254. "Ṥ": "Ṥ",
  13255. "Š": "Š",
  13256. "Ṧ": "Ṧ",
  13257. "Ŝ": "Ŝ",
  13258. "Ṡ": "Ṡ",
  13259. "Ş": "Ş",
  13260. "Ť": "Ť",
  13261. "Ṫ": "Ṫ",
  13262. "Ţ": "Ţ",
  13263. "Ú": "Ú",
  13264. "Ù": "Ù",
  13265. "Ü": "Ü",
  13266. "Ǘ": "Ǘ",
  13267. "Ǜ": "Ǜ",
  13268. "Ǖ": "Ǖ",
  13269. "Ǚ": "Ǚ",
  13270. "Ũ": "Ũ",
  13271. "Ṹ": "Ṹ",
  13272. "Ū": "Ū",
  13273. "Ṻ": "Ṻ",
  13274. "Ŭ": "Ŭ",
  13275. "Ǔ": "Ǔ",
  13276. "Û": "Û",
  13277. "Ů": "Ů",
  13278. "Ű": "Ű",
  13279. "Ṽ": "Ṽ",
  13280. "Ẃ": "Ẃ",
  13281. "Ẁ": "Ẁ",
  13282. "Ẅ": "Ẅ",
  13283. "Ŵ": "Ŵ",
  13284. "Ẇ": "Ẇ",
  13285. "Ẍ": "Ẍ",
  13286. "Ẋ": "Ẋ",
  13287. "Ý": "Ý",
  13288. "Ỳ": "Ỳ",
  13289. "Ÿ": "Ÿ",
  13290. "Ỹ": "Ỹ",
  13291. "Ȳ": "Ȳ",
  13292. "Ŷ": "Ŷ",
  13293. "Ẏ": "Ẏ",
  13294. "Ź": "Ź",
  13295. "Ž": "Ž",
  13296. "Ẑ": "Ẑ",
  13297. "Ż": "Ż",
  13298. "ά": "ά",
  13299. "ὰ": "ὰ",
  13300. "ᾱ": "ᾱ",
  13301. "ᾰ": "ᾰ",
  13302. "έ": "έ",
  13303. "ὲ": "ὲ",
  13304. "ή": "ή",
  13305. "ὴ": "ὴ",
  13306. "ί": "ί",
  13307. "ὶ": "ὶ",
  13308. "ϊ": "ϊ",
  13309. "ΐ": "ΐ",
  13310. "ῒ": "ῒ",
  13311. "ῑ": "ῑ",
  13312. "ῐ": "ῐ",
  13313. "ό": "ό",
  13314. "ὸ": "ὸ",
  13315. "ύ": "ύ",
  13316. "ὺ": "ὺ",
  13317. "ϋ": "ϋ",
  13318. "ΰ": "ΰ",
  13319. "ῢ": "ῢ",
  13320. "ῡ": "ῡ",
  13321. "ῠ": "ῠ",
  13322. "ώ": "ώ",
  13323. "ὼ": "ὼ",
  13324. "Ύ": "Ύ",
  13325. "Ὺ": "Ὺ",
  13326. "Ϋ": "Ϋ",
  13327. "Ῡ": "Ῡ",
  13328. "Ῠ": "Ῠ",
  13329. "Ώ": "Ώ",
  13330. "Ὼ": "Ὼ"
  13331. };
  13332. var Parser = class _Parser {
  13333. constructor(input, settings) {
  13334. this.mode = "math";
  13335. this.gullet = new MacroExpander(input, settings, this.mode);
  13336. this.settings = settings;
  13337. this.leftrightDepth = 0;
  13338. this.nextToken = null;
  13339. }
  13340. /**
  13341. * Checks a result to make sure it has the right type, and throws an
  13342. * appropriate error otherwise.
  13343. */
  13344. expect(text2, consume) {
  13345. if (consume === void 0) {
  13346. consume = true;
  13347. }
  13348. if (this.fetch().text !== text2) {
  13349. throw new ParseError("Expected '" + text2 + "', got '" + this.fetch().text + "'", this.fetch());
  13350. }
  13351. if (consume) {
  13352. this.consume();
  13353. }
  13354. }
  13355. /**
  13356. * Discards the current lookahead token, considering it consumed.
  13357. */
  13358. consume() {
  13359. this.nextToken = null;
  13360. }
  13361. /**
  13362. * Return the current lookahead token, or if there isn't one (at the
  13363. * beginning, or if the previous lookahead token was consume()d),
  13364. * fetch the next token as the new lookahead token and return it.
  13365. */
  13366. fetch() {
  13367. if (this.nextToken == null) {
  13368. this.nextToken = this.gullet.expandNextToken();
  13369. }
  13370. return this.nextToken;
  13371. }
  13372. /**
  13373. * Switches between "text" and "math" modes.
  13374. */
  13375. switchMode(newMode) {
  13376. this.mode = newMode;
  13377. this.gullet.switchMode(newMode);
  13378. }
  13379. /**
  13380. * Main parsing function, which parses an entire input.
  13381. */
  13382. parse() {
  13383. if (!this.settings.globalGroup) {
  13384. this.gullet.beginGroup();
  13385. }
  13386. if (this.settings.colorIsTextColor) {
  13387. this.gullet.macros.set("\\color", "\\textcolor");
  13388. }
  13389. try {
  13390. var parse = this.parseExpression(false);
  13391. this.expect("EOF");
  13392. if (!this.settings.globalGroup) {
  13393. this.gullet.endGroup();
  13394. }
  13395. return parse;
  13396. } finally {
  13397. this.gullet.endGroups();
  13398. }
  13399. }
  13400. /**
  13401. * Fully parse a separate sequence of tokens as a separate job.
  13402. * Tokens should be specified in reverse order, as in a MacroDefinition.
  13403. */
  13404. subparse(tokens) {
  13405. var oldToken = this.nextToken;
  13406. this.consume();
  13407. this.gullet.pushToken(new Token("}"));
  13408. this.gullet.pushTokens(tokens);
  13409. var parse = this.parseExpression(false);
  13410. this.expect("}");
  13411. this.nextToken = oldToken;
  13412. return parse;
  13413. }
  13414. /**
  13415. * Parses an "expression", which is a list of atoms.
  13416. *
  13417. * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This
  13418. * happens when functions have higher precedence than infix
  13419. * nodes in implicit parses.
  13420. *
  13421. * `breakOnTokenText`: The text of the token that the expression should end
  13422. * with, or `null` if something else should end the
  13423. * expression.
  13424. */
  13425. parseExpression(breakOnInfix, breakOnTokenText) {
  13426. var body = [];
  13427. while (true) {
  13428. if (this.mode === "math") {
  13429. this.consumeSpaces();
  13430. }
  13431. var lex = this.fetch();
  13432. if (_Parser.endOfExpression.has(lex.text)) {
  13433. break;
  13434. }
  13435. if (breakOnTokenText && lex.text === breakOnTokenText) {
  13436. break;
  13437. }
  13438. if (breakOnInfix && functions[lex.text] && functions[lex.text].infix) {
  13439. break;
  13440. }
  13441. var atom = this.parseAtom(breakOnTokenText);
  13442. if (!atom) {
  13443. break;
  13444. } else if (atom.type === "internal") {
  13445. continue;
  13446. }
  13447. body.push(atom);
  13448. }
  13449. if (this.mode === "text") {
  13450. this.formLigatures(body);
  13451. }
  13452. return this.handleInfixNodes(body);
  13453. }
  13454. /**
  13455. * Rewrites infix operators such as \over with corresponding commands such
  13456. * as \frac.
  13457. *
  13458. * There can only be one infix operator per group. If there's more than one
  13459. * then the expression is ambiguous. This can be resolved by adding {}.
  13460. */
  13461. handleInfixNodes(body) {
  13462. var overIndex = -1;
  13463. var funcName;
  13464. for (var i = 0; i < body.length; i++) {
  13465. var node = body[i];
  13466. if (node.type === "infix") {
  13467. if (overIndex !== -1) {
  13468. throw new ParseError("only one infix operator per group", node.token);
  13469. }
  13470. overIndex = i;
  13471. funcName = node.replaceWith;
  13472. }
  13473. }
  13474. if (overIndex !== -1 && funcName) {
  13475. var numerNode;
  13476. var denomNode;
  13477. var numerBody = body.slice(0, overIndex);
  13478. var denomBody = body.slice(overIndex + 1);
  13479. if (numerBody.length === 1 && numerBody[0].type === "ordgroup") {
  13480. numerNode = numerBody[0];
  13481. } else {
  13482. numerNode = {
  13483. type: "ordgroup",
  13484. mode: this.mode,
  13485. body: numerBody
  13486. };
  13487. }
  13488. if (denomBody.length === 1 && denomBody[0].type === "ordgroup") {
  13489. denomNode = denomBody[0];
  13490. } else {
  13491. denomNode = {
  13492. type: "ordgroup",
  13493. mode: this.mode,
  13494. body: denomBody
  13495. };
  13496. }
  13497. var _node;
  13498. if (funcName === "\\\\abovefrac") {
  13499. _node = this.callFunction(funcName, [numerNode, body[overIndex], denomNode], []);
  13500. } else {
  13501. _node = this.callFunction(funcName, [numerNode, denomNode], []);
  13502. }
  13503. return [_node];
  13504. } else {
  13505. return body;
  13506. }
  13507. }
  13508. /**
  13509. * Handle a subscript or superscript with nice errors.
  13510. */
  13511. handleSupSubscript(name) {
  13512. var symbolToken = this.fetch();
  13513. var symbol = symbolToken.text;
  13514. this.consume();
  13515. this.consumeSpaces();
  13516. var group;
  13517. do {
  13518. var _group;
  13519. group = this.parseGroup(name);
  13520. } while (((_group = group) == null ? void 0 : _group.type) === "internal");
  13521. if (!group) {
  13522. throw new ParseError("Expected group after '" + symbol + "'", symbolToken);
  13523. }
  13524. return group;
  13525. }
  13526. /**
  13527. * Converts the textual input of an unsupported command into a text node
  13528. * contained within a color node whose color is determined by errorColor
  13529. */
  13530. formatUnsupportedCmd(text2) {
  13531. var textordArray = [];
  13532. for (var i = 0; i < text2.length; i++) {
  13533. textordArray.push({
  13534. type: "textord",
  13535. mode: "text",
  13536. text: text2[i]
  13537. });
  13538. }
  13539. var textNode = {
  13540. type: "text",
  13541. mode: this.mode,
  13542. body: textordArray
  13543. };
  13544. var colorNode = {
  13545. type: "color",
  13546. mode: this.mode,
  13547. color: this.settings.errorColor,
  13548. body: [textNode]
  13549. };
  13550. return colorNode;
  13551. }
  13552. /**
  13553. * Parses a group with optional super/subscripts.
  13554. */
  13555. parseAtom(breakOnTokenText) {
  13556. var base = this.parseGroup("atom", breakOnTokenText);
  13557. if ((base == null ? void 0 : base.type) === "internal") {
  13558. return base;
  13559. }
  13560. if (this.mode === "text") {
  13561. return base;
  13562. }
  13563. var superscript;
  13564. var subscript;
  13565. while (true) {
  13566. this.consumeSpaces();
  13567. var lex = this.fetch();
  13568. if (lex.text === "\\limits" || lex.text === "\\nolimits") {
  13569. if (base && base.type === "op") {
  13570. var limits = lex.text === "\\limits";
  13571. base.limits = limits;
  13572. base.alwaysHandleSupSub = true;
  13573. } else if (base && base.type === "operatorname") {
  13574. if (base.alwaysHandleSupSub) {
  13575. base.limits = lex.text === "\\limits";
  13576. }
  13577. } else {
  13578. throw new ParseError("Limit controls must follow a math operator", lex);
  13579. }
  13580. this.consume();
  13581. } else if (lex.text === "^") {
  13582. if (superscript) {
  13583. throw new ParseError("Double superscript", lex);
  13584. }
  13585. superscript = this.handleSupSubscript("superscript");
  13586. } else if (lex.text === "_") {
  13587. if (subscript) {
  13588. throw new ParseError("Double subscript", lex);
  13589. }
  13590. subscript = this.handleSupSubscript("subscript");
  13591. } else if (lex.text === "'") {
  13592. if (superscript) {
  13593. throw new ParseError("Double superscript", lex);
  13594. }
  13595. var prime = {
  13596. type: "textord",
  13597. mode: this.mode,
  13598. text: "\\prime"
  13599. };
  13600. var primes = [prime];
  13601. this.consume();
  13602. while (this.fetch().text === "'") {
  13603. primes.push(prime);
  13604. this.consume();
  13605. }
  13606. if (this.fetch().text === "^") {
  13607. primes.push(this.handleSupSubscript("superscript"));
  13608. }
  13609. superscript = {
  13610. type: "ordgroup",
  13611. mode: this.mode,
  13612. body: primes
  13613. };
  13614. } else if (uSubsAndSups[lex.text]) {
  13615. var isSub = unicodeSubRegEx.test(lex.text);
  13616. var subsupTokens = [];
  13617. subsupTokens.push(new Token(uSubsAndSups[lex.text]));
  13618. this.consume();
  13619. while (true) {
  13620. var token = this.fetch().text;
  13621. if (!uSubsAndSups[token]) {
  13622. break;
  13623. }
  13624. if (unicodeSubRegEx.test(token) !== isSub) {
  13625. break;
  13626. }
  13627. subsupTokens.unshift(new Token(uSubsAndSups[token]));
  13628. this.consume();
  13629. }
  13630. var body = this.subparse(subsupTokens);
  13631. if (isSub) {
  13632. subscript = {
  13633. type: "ordgroup",
  13634. mode: "math",
  13635. body
  13636. };
  13637. } else {
  13638. superscript = {
  13639. type: "ordgroup",
  13640. mode: "math",
  13641. body
  13642. };
  13643. }
  13644. } else {
  13645. break;
  13646. }
  13647. }
  13648. if (superscript || subscript) {
  13649. return {
  13650. type: "supsub",
  13651. mode: this.mode,
  13652. base,
  13653. sup: superscript,
  13654. sub: subscript
  13655. };
  13656. } else {
  13657. return base;
  13658. }
  13659. }
  13660. /**
  13661. * Parses an entire function, including its base and all of its arguments.
  13662. */
  13663. parseFunction(breakOnTokenText, name) {
  13664. var token = this.fetch();
  13665. var func = token.text;
  13666. var funcData = functions[func];
  13667. if (!funcData) {
  13668. return null;
  13669. }
  13670. this.consume();
  13671. if (name && name !== "atom" && !funcData.allowedInArgument) {
  13672. throw new ParseError("Got function '" + func + "' with no arguments" + (name ? " as " + name : ""), token);
  13673. } else if (this.mode === "text" && !funcData.allowedInText) {
  13674. throw new ParseError("Can't use function '" + func + "' in text mode", token);
  13675. } else if (this.mode === "math" && funcData.allowedInMath === false) {
  13676. throw new ParseError("Can't use function '" + func + "' in math mode", token);
  13677. }
  13678. var {
  13679. args,
  13680. optArgs
  13681. } = this.parseArguments(func, funcData);
  13682. return this.callFunction(func, args, optArgs, token, breakOnTokenText);
  13683. }
  13684. /**
  13685. * Call a function handler with a suitable context and arguments.
  13686. */
  13687. callFunction(name, args, optArgs, token, breakOnTokenText) {
  13688. var context = {
  13689. funcName: name,
  13690. parser: this,
  13691. token,
  13692. breakOnTokenText
  13693. };
  13694. var func = functions[name];
  13695. if (func && func.handler) {
  13696. return func.handler(context, args, optArgs);
  13697. } else {
  13698. throw new ParseError("No function handler for " + name);
  13699. }
  13700. }
  13701. /**
  13702. * Parses the arguments of a function or environment
  13703. */
  13704. parseArguments(func, funcData) {
  13705. var totalArgs = funcData.numArgs + funcData.numOptionalArgs;
  13706. if (totalArgs === 0) {
  13707. return {
  13708. args: [],
  13709. optArgs: []
  13710. };
  13711. }
  13712. var args = [];
  13713. var optArgs = [];
  13714. for (var i = 0; i < totalArgs; i++) {
  13715. var argType = funcData.argTypes && funcData.argTypes[i];
  13716. var isOptional = i < funcData.numOptionalArgs;
  13717. if ("primitive" in funcData && funcData.primitive && argType == null || // \sqrt expands into primitive if optional argument doesn't exist
  13718. funcData.type === "sqrt" && i === 1 && optArgs[0] == null) {
  13719. argType = "primitive";
  13720. }
  13721. var arg = this.parseGroupOfType("argument to '" + func + "'", argType, isOptional);
  13722. if (isOptional) {
  13723. optArgs.push(arg);
  13724. } else if (arg != null) {
  13725. args.push(arg);
  13726. } else {
  13727. throw new ParseError("Null argument, please report this as a bug");
  13728. }
  13729. }
  13730. return {
  13731. args,
  13732. optArgs
  13733. };
  13734. }
  13735. /**
  13736. * Parses a group when the mode is changing.
  13737. */
  13738. parseGroupOfType(name, type, optional) {
  13739. switch (type) {
  13740. case "color":
  13741. return this.parseColorGroup(optional);
  13742. case "size":
  13743. return this.parseSizeGroup(optional);
  13744. case "url":
  13745. return this.parseUrlGroup(optional);
  13746. case "math":
  13747. case "text":
  13748. return this.parseArgumentGroup(optional, type);
  13749. case "hbox": {
  13750. var group = this.parseArgumentGroup(optional, "text");
  13751. return group != null ? {
  13752. type: "styling",
  13753. mode: group.mode,
  13754. body: [group],
  13755. style: "text"
  13756. // simulate \textstyle
  13757. } : null;
  13758. }
  13759. case "raw": {
  13760. var token = this.parseStringGroup("raw", optional);
  13761. return token != null ? {
  13762. type: "raw",
  13763. mode: "text",
  13764. string: token.text
  13765. } : null;
  13766. }
  13767. case "primitive": {
  13768. if (optional) {
  13769. throw new ParseError("A primitive argument cannot be optional");
  13770. }
  13771. var _group2 = this.parseGroup(name);
  13772. if (_group2 == null) {
  13773. throw new ParseError("Expected group as " + name, this.fetch());
  13774. }
  13775. return _group2;
  13776. }
  13777. case "original":
  13778. case null:
  13779. case void 0:
  13780. return this.parseArgumentGroup(optional);
  13781. default:
  13782. throw new ParseError("Unknown group type as " + name, this.fetch());
  13783. }
  13784. }
  13785. /**
  13786. * Discard any space tokens, fetching the next non-space token.
  13787. */
  13788. consumeSpaces() {
  13789. while (this.fetch().text === " ") {
  13790. this.consume();
  13791. }
  13792. }
  13793. /**
  13794. * Parses a group, essentially returning the string formed by the
  13795. * brace-enclosed tokens plus some position information.
  13796. */
  13797. parseStringGroup(modeName, optional) {
  13798. var argToken = this.gullet.scanArgument(optional);
  13799. if (argToken == null) {
  13800. return null;
  13801. }
  13802. var str = "";
  13803. var nextToken;
  13804. while ((nextToken = this.fetch()).text !== "EOF") {
  13805. str += nextToken.text;
  13806. this.consume();
  13807. }
  13808. this.consume();
  13809. argToken.text = str;
  13810. return argToken;
  13811. }
  13812. /**
  13813. * Parses a regex-delimited group: the largest sequence of tokens
  13814. * whose concatenated strings match `regex`. Returns the string
  13815. * formed by the tokens plus some position information.
  13816. */
  13817. parseRegexGroup(regex, modeName) {
  13818. var firstToken = this.fetch();
  13819. var lastToken = firstToken;
  13820. var str = "";
  13821. var nextToken;
  13822. while ((nextToken = this.fetch()).text !== "EOF" && regex.test(str + nextToken.text)) {
  13823. lastToken = nextToken;
  13824. str += lastToken.text;
  13825. this.consume();
  13826. }
  13827. if (str === "") {
  13828. throw new ParseError("Invalid " + modeName + ": '" + firstToken.text + "'", firstToken);
  13829. }
  13830. return firstToken.range(lastToken, str);
  13831. }
  13832. /**
  13833. * Parses a color description.
  13834. */
  13835. parseColorGroup(optional) {
  13836. var res = this.parseStringGroup("color", optional);
  13837. if (res == null) {
  13838. return null;
  13839. }
  13840. var match = /^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(res.text);
  13841. if (!match) {
  13842. throw new ParseError("Invalid color: '" + res.text + "'", res);
  13843. }
  13844. var color = match[0];
  13845. if (/^[0-9a-f]{6}$/i.test(color)) {
  13846. color = "#" + color;
  13847. }
  13848. return {
  13849. type: "color-token",
  13850. mode: this.mode,
  13851. color
  13852. };
  13853. }
  13854. /**
  13855. * Parses a size specification, consisting of magnitude and unit.
  13856. */
  13857. parseSizeGroup(optional) {
  13858. var res;
  13859. var isBlank = false;
  13860. this.gullet.consumeSpaces();
  13861. if (!optional && this.gullet.future().text !== "{") {
  13862. res = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size");
  13863. } else {
  13864. res = this.parseStringGroup("size", optional);
  13865. }
  13866. if (!res) {
  13867. return null;
  13868. }
  13869. if (!optional && res.text.length === 0) {
  13870. res.text = "0pt";
  13871. isBlank = true;
  13872. }
  13873. var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(res.text);
  13874. if (!match) {
  13875. throw new ParseError("Invalid size: '" + res.text + "'", res);
  13876. }
  13877. var data = {
  13878. number: +(match[1] + match[2]),
  13879. // sign + magnitude, cast to number
  13880. unit: match[3]
  13881. };
  13882. if (!validUnit(data)) {
  13883. throw new ParseError("Invalid unit: '" + data.unit + "'", res);
  13884. }
  13885. return {
  13886. type: "size",
  13887. mode: this.mode,
  13888. value: data,
  13889. isBlank
  13890. };
  13891. }
  13892. /**
  13893. * Parses an URL, checking escaped letters and allowed protocols,
  13894. * and setting the catcode of % as an active character (as in \hyperref).
  13895. */
  13896. parseUrlGroup(optional) {
  13897. this.gullet.lexer.setCatcode("%", 13);
  13898. this.gullet.lexer.setCatcode("~", 12);
  13899. var res = this.parseStringGroup("url", optional);
  13900. this.gullet.lexer.setCatcode("%", 14);
  13901. this.gullet.lexer.setCatcode("~", 13);
  13902. if (res == null) {
  13903. return null;
  13904. }
  13905. var url = res.text.replace(/\\([#$%&~_^{}])/g, "$1");
  13906. return {
  13907. type: "url",
  13908. mode: this.mode,
  13909. url
  13910. };
  13911. }
  13912. /**
  13913. * Parses an argument with the mode specified.
  13914. */
  13915. parseArgumentGroup(optional, mode) {
  13916. var argToken = this.gullet.scanArgument(optional);
  13917. if (argToken == null) {
  13918. return null;
  13919. }
  13920. var outerMode = this.mode;
  13921. if (mode) {
  13922. this.switchMode(mode);
  13923. }
  13924. this.gullet.beginGroup();
  13925. var expression = this.parseExpression(false, "EOF");
  13926. this.expect("EOF");
  13927. this.gullet.endGroup();
  13928. var result = {
  13929. type: "ordgroup",
  13930. mode: this.mode,
  13931. loc: argToken.loc,
  13932. body: expression
  13933. };
  13934. if (mode) {
  13935. this.switchMode(outerMode);
  13936. }
  13937. return result;
  13938. }
  13939. /**
  13940. * Parses an ordinary group, which is either a single nucleus (like "x")
  13941. * or an expression in braces (like "{x+y}") or an implicit group, a group
  13942. * that starts at the current position, and ends right before a higher explicit
  13943. * group ends, or at EOF.
  13944. */
  13945. parseGroup(name, breakOnTokenText) {
  13946. var firstToken = this.fetch();
  13947. var text2 = firstToken.text;
  13948. var result;
  13949. if (text2 === "{" || text2 === "\\begingroup") {
  13950. this.consume();
  13951. var groupEnd = text2 === "{" ? "}" : "\\endgroup";
  13952. this.gullet.beginGroup();
  13953. var expression = this.parseExpression(false, groupEnd);
  13954. var lastToken = this.fetch();
  13955. this.expect(groupEnd);
  13956. this.gullet.endGroup();
  13957. result = {
  13958. type: "ordgroup",
  13959. mode: this.mode,
  13960. loc: SourceLocation.range(firstToken, lastToken),
  13961. body: expression,
  13962. // A group formed by \begingroup...\endgroup is a semi-simple group
  13963. // which doesn't affect spacing in math mode, i.e., is transparent.
  13964. // https://tex.stackexchange.com/questions/1930/when-should-one-
  13965. // use-begingroup-instead-of-bgroup
  13966. semisimple: text2 === "\\begingroup" || void 0
  13967. };
  13968. } else {
  13969. result = this.parseFunction(breakOnTokenText, name) || this.parseSymbol();
  13970. if (result == null && text2[0] === "\\" && !implicitCommands.hasOwnProperty(text2)) {
  13971. if (this.settings.throwOnError) {
  13972. throw new ParseError("Undefined control sequence: " + text2, firstToken);
  13973. }
  13974. result = this.formatUnsupportedCmd(text2);
  13975. this.consume();
  13976. }
  13977. }
  13978. return result;
  13979. }
  13980. /**
  13981. * Form ligature-like combinations of characters for text mode.
  13982. * This includes inputs like "--", "---", "``" and "''".
  13983. * The result will simply replace multiple textord nodes with a single
  13984. * character in each value by a single textord node having multiple
  13985. * characters in its value. The representation is still ASCII source.
  13986. * The group will be modified in place.
  13987. */
  13988. formLigatures(group) {
  13989. var n = group.length - 1;
  13990. for (var i = 0; i < n; ++i) {
  13991. var a = group[i];
  13992. if (a.type !== "textord") {
  13993. continue;
  13994. }
  13995. var v = a.text;
  13996. var next = group[i + 1];
  13997. if (!next || next.type !== "textord") {
  13998. continue;
  13999. }
  14000. if (v === "-" && next.text === "-") {
  14001. var afterNext = group[i + 2];
  14002. if (i + 1 < n && afterNext && afterNext.type === "textord" && afterNext.text === "-") {
  14003. group.splice(i, 3, {
  14004. type: "textord",
  14005. mode: "text",
  14006. loc: SourceLocation.range(a, afterNext),
  14007. text: "---"
  14008. });
  14009. n -= 2;
  14010. } else {
  14011. group.splice(i, 2, {
  14012. type: "textord",
  14013. mode: "text",
  14014. loc: SourceLocation.range(a, next),
  14015. text: "--"
  14016. });
  14017. n -= 1;
  14018. }
  14019. }
  14020. if ((v === "'" || v === "`") && next.text === v) {
  14021. group.splice(i, 2, {
  14022. type: "textord",
  14023. mode: "text",
  14024. loc: SourceLocation.range(a, next),
  14025. text: v + v
  14026. });
  14027. n -= 1;
  14028. }
  14029. }
  14030. }
  14031. /**
  14032. * Parse a single symbol out of the string. Here, we handle single character
  14033. * symbols and special functions like \verb.
  14034. */
  14035. parseSymbol() {
  14036. var nucleus = this.fetch();
  14037. var text2 = nucleus.text;
  14038. if (/^\\verb[^a-zA-Z]/.test(text2)) {
  14039. this.consume();
  14040. var arg = text2.slice(5);
  14041. var star = arg.charAt(0) === "*";
  14042. if (star) {
  14043. arg = arg.slice(1);
  14044. }
  14045. if (arg.length < 2 || arg.charAt(0) !== arg.slice(-1)) {
  14046. throw new ParseError("\\verb assertion failed --\n please report what input caused this bug");
  14047. }
  14048. arg = arg.slice(1, -1);
  14049. return {
  14050. type: "verb",
  14051. mode: "text",
  14052. body: arg,
  14053. star
  14054. };
  14055. }
  14056. if (unicodeSymbols.hasOwnProperty(text2[0]) && !symbols[this.mode][text2[0]]) {
  14057. if (this.settings.strict && this.mode === "math") {
  14058. this.settings.reportNonstrict("unicodeTextInMathMode", 'Accented Unicode text character "' + text2[0] + '" used in math mode', nucleus);
  14059. }
  14060. text2 = unicodeSymbols[text2[0]] + text2.slice(1);
  14061. }
  14062. var match = combiningDiacriticalMarksEndRegex.exec(text2);
  14063. if (match) {
  14064. text2 = text2.substring(0, match.index);
  14065. if (text2 === "i") {
  14066. text2 = "ı";
  14067. } else if (text2 === "j") {
  14068. text2 = "ȷ";
  14069. }
  14070. }
  14071. var symbol;
  14072. if (symbols[this.mode][text2]) {
  14073. if (this.settings.strict && this.mode === "math" && extraLatin.includes(text2)) {
  14074. this.settings.reportNonstrict("unicodeTextInMathMode", 'Latin-1/Unicode text character "' + text2[0] + '" used in math mode', nucleus);
  14075. }
  14076. var group = symbols[this.mode][text2].group;
  14077. var loc = SourceLocation.range(nucleus);
  14078. var s;
  14079. if (ATOMS.hasOwnProperty(group)) {
  14080. var family = group;
  14081. s = {
  14082. type: "atom",
  14083. mode: this.mode,
  14084. family,
  14085. loc,
  14086. text: text2
  14087. };
  14088. } else {
  14089. s = {
  14090. type: group,
  14091. mode: this.mode,
  14092. loc,
  14093. text: text2
  14094. };
  14095. }
  14096. symbol = s;
  14097. } else if (text2.charCodeAt(0) >= 128) {
  14098. if (this.settings.strict) {
  14099. if (!supportedCodepoint(text2.charCodeAt(0))) {
  14100. this.settings.reportNonstrict("unknownSymbol", 'Unrecognized Unicode character "' + text2[0] + '"' + (" (" + text2.charCodeAt(0) + ")"), nucleus);
  14101. } else if (this.mode === "math") {
  14102. this.settings.reportNonstrict("unicodeTextInMathMode", 'Unicode text character "' + text2[0] + '" used in math mode', nucleus);
  14103. }
  14104. }
  14105. symbol = {
  14106. type: "textord",
  14107. mode: "text",
  14108. loc: SourceLocation.range(nucleus),
  14109. text: text2
  14110. };
  14111. } else {
  14112. return null;
  14113. }
  14114. this.consume();
  14115. if (match) {
  14116. for (var i = 0; i < match[0].length; i++) {
  14117. var accent2 = match[0][i];
  14118. if (!unicodeAccents[accent2]) {
  14119. throw new ParseError("Unknown accent ' " + accent2 + "'", nucleus);
  14120. }
  14121. var command = unicodeAccents[accent2][this.mode] || unicodeAccents[accent2].text;
  14122. if (!command) {
  14123. throw new ParseError("Accent " + accent2 + " unsupported in " + this.mode + " mode", nucleus);
  14124. }
  14125. symbol = {
  14126. type: "accent",
  14127. mode: this.mode,
  14128. loc: SourceLocation.range(nucleus),
  14129. label: command,
  14130. isStretchy: false,
  14131. isShifty: true,
  14132. // TODO(ts)
  14133. base: symbol
  14134. };
  14135. }
  14136. }
  14137. return symbol;
  14138. }
  14139. };
  14140. Parser.endOfExpression = /* @__PURE__ */ new Set(["}", "\\endgroup", "\\end", "\\right", "&"]);
  14141. var parseTree = function parseTree2(toParse, settings) {
  14142. if (!(typeof toParse === "string" || toParse instanceof String)) {
  14143. throw new TypeError("KaTeX can only parse string typed expression");
  14144. }
  14145. var parser = new Parser(toParse, settings);
  14146. delete parser.gullet.macros.current["\\df@tag"];
  14147. var tree = parser.parse();
  14148. delete parser.gullet.macros.current["\\current@color"];
  14149. delete parser.gullet.macros.current["\\color"];
  14150. if (parser.gullet.macros.get("\\df@tag")) {
  14151. if (!settings.displayMode) {
  14152. throw new ParseError("\\tag works only in display equations");
  14153. }
  14154. tree = [{
  14155. type: "tag",
  14156. mode: "text",
  14157. body: tree,
  14158. tag: parser.subparse([new Token("\\df@tag")])
  14159. }];
  14160. }
  14161. return tree;
  14162. };
  14163. var render = function render2(expression, baseNode, options) {
  14164. baseNode.textContent = "";
  14165. var node = renderToDomTree(expression, options).toNode();
  14166. baseNode.appendChild(node);
  14167. };
  14168. if (typeof document !== "undefined") {
  14169. if (document.compatMode !== "CSS1Compat") {
  14170. typeof console !== "undefined" && console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype.");
  14171. render = function render3() {
  14172. throw new ParseError("KaTeX doesn't work in quirks mode.");
  14173. };
  14174. }
  14175. }
  14176. var renderToString = function renderToString2(expression, options) {
  14177. var markup = renderToDomTree(expression, options).toMarkup();
  14178. return markup;
  14179. };
  14180. var generateParseTree = function generateParseTree2(expression, options) {
  14181. var settings = new Settings(options);
  14182. return parseTree(expression, settings);
  14183. };
  14184. var renderError = function renderError2(error, expression, options) {
  14185. if (options.throwOnError || !(error instanceof ParseError)) {
  14186. throw error;
  14187. }
  14188. var node = makeSpan(["katex-error"], [new SymbolNode(expression)]);
  14189. node.setAttribute("title", error.toString());
  14190. node.setAttribute("style", "color:" + options.errorColor);
  14191. return node;
  14192. };
  14193. var renderToDomTree = function renderToDomTree2(expression, options) {
  14194. var settings = new Settings(options);
  14195. try {
  14196. var tree = parseTree(expression, settings);
  14197. return buildTree(tree, expression, settings);
  14198. } catch (error) {
  14199. return renderError(error, expression, settings);
  14200. }
  14201. };
  14202. var renderToHTMLTree = function renderToHTMLTree2(expression, options) {
  14203. var settings = new Settings(options);
  14204. try {
  14205. var tree = parseTree(expression, settings);
  14206. return buildHTMLTree(tree, expression, settings);
  14207. } catch (error) {
  14208. return renderError(error, expression, settings);
  14209. }
  14210. };
  14211. var version = "0.16.44";
  14212. var __domTree = {
  14213. Span,
  14214. Anchor,
  14215. SymbolNode,
  14216. SvgNode,
  14217. PathNode,
  14218. LineNode
  14219. };
  14220. var katex = {
  14221. /**
  14222. * Current KaTeX version
  14223. */
  14224. version,
  14225. /**
  14226. * Renders the given LaTeX into an HTML+MathML combination, and adds
  14227. * it as a child to the specified DOM node.
  14228. */
  14229. render,
  14230. /**
  14231. * Renders the given LaTeX into an HTML+MathML combination string,
  14232. * for sending to the client.
  14233. */
  14234. renderToString,
  14235. /**
  14236. * KaTeX error, usually during parsing.
  14237. */
  14238. ParseError,
  14239. /**
  14240. * The schema of Settings
  14241. */
  14242. SETTINGS_SCHEMA,
  14243. /**
  14244. * Parses the given LaTeX into KaTeX's internal parse tree structure,
  14245. * without rendering to HTML or MathML.
  14246. *
  14247. * NOTE: This method is not currently recommended for public use.
  14248. * The internal tree representation is unstable and is very likely
  14249. * to change. Use at your own risk.
  14250. */
  14251. __parse: generateParseTree,
  14252. /**
  14253. * Renders the given LaTeX into an HTML+MathML internal DOM tree
  14254. * representation, without flattening that representation to a string.
  14255. *
  14256. * NOTE: This method is not currently recommended for public use.
  14257. * The internal tree representation is unstable and is very likely
  14258. * to change. Use at your own risk.
  14259. */
  14260. __renderToDomTree: renderToDomTree,
  14261. /**
  14262. * Renders the given LaTeX into an HTML internal DOM tree representation,
  14263. * without MathML and without flattening that representation to a string.
  14264. *
  14265. * NOTE: This method is not currently recommended for public use.
  14266. * The internal tree representation is unstable and is very likely
  14267. * to change. Use at your own risk.
  14268. */
  14269. __renderToHTMLTree: renderToHTMLTree,
  14270. /**
  14271. * extends internal font metrics object with a new object
  14272. * each key in the new object represents a font name
  14273. */
  14274. __setFontMetrics: setFontMetrics,
  14275. /**
  14276. * adds a new symbol to builtin symbols table
  14277. */
  14278. __defineSymbol: defineSymbol,
  14279. /**
  14280. * adds a new function to builtin function list,
  14281. * which directly produce parse tree elements
  14282. * and have their own html/mathml builders
  14283. */
  14284. __defineFunction: defineFunction,
  14285. /**
  14286. * adds a new macro to builtin macro list
  14287. */
  14288. __defineMacro: defineMacro,
  14289. /**
  14290. * Expose the dom tree node types, which can be useful for type checking nodes.
  14291. *
  14292. * NOTE: These methods are not currently recommended for public use.
  14293. * The internal tree representation is unstable and is very likely
  14294. * to change. Use at your own risk.
  14295. */
  14296. __domTree
  14297. };
  14298. export {
  14299. katex
  14300. };
  14301. //# sourceMappingURL=chunk-REIMVYFT.js.map