main.js 365 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, {
  40. /******/ configurable: false,
  41. /******/ enumerable: true,
  42. /******/ get: getter
  43. /******/ });
  44. /******/ }
  45. /******/ };
  46. /******/
  47. /******/ // getDefaultExport function for compatibility with non-harmony modules
  48. /******/ __webpack_require__.n = function(module) {
  49. /******/ var getter = module && module.__esModule ?
  50. /******/ function getDefault() { return module['default']; } :
  51. /******/ function getModuleExports() { return module; };
  52. /******/ __webpack_require__.d(getter, 'a', getter);
  53. /******/ return getter;
  54. /******/ };
  55. /******/
  56. /******/ // Object.prototype.hasOwnProperty.call
  57. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  58. /******/
  59. /******/ // __webpack_public_path__
  60. /******/ __webpack_require__.p = "";
  61. /******/
  62. /******/ // Load entry module and return exports
  63. /******/ return __webpack_require__(__webpack_require__.s = 21);
  64. /******/ })
  65. /************************************************************************/
  66. /******/ ([
  67. /* 0 */
  68. /***/ (function(module, exports, __webpack_require__) {
  69. "use strict";
  70. // Utilities
  71. //
  72. function _class(obj) { return Object.prototype.toString.call(obj); }
  73. function isString(obj) { return _class(obj) === '[object String]'; }
  74. var _hasOwnProperty = Object.prototype.hasOwnProperty;
  75. function has(object, key) {
  76. return _hasOwnProperty.call(object, key);
  77. }
  78. // Merge objects
  79. //
  80. function assign(obj /*from1, from2, from3, ...*/) {
  81. var sources = Array.prototype.slice.call(arguments, 1);
  82. sources.forEach(function (source) {
  83. if (!source) { return; }
  84. if (typeof source !== 'object') {
  85. throw new TypeError(source + 'must be object');
  86. }
  87. Object.keys(source).forEach(function (key) {
  88. obj[key] = source[key];
  89. });
  90. });
  91. return obj;
  92. }
  93. // Remove element from array and put another array at those position.
  94. // Useful for some operations with tokens
  95. function arrayReplaceAt(src, pos, newElements) {
  96. return [].concat(src.slice(0, pos), newElements, src.slice(pos + 1));
  97. }
  98. ////////////////////////////////////////////////////////////////////////////////
  99. function isValidEntityCode(c) {
  100. /*eslint no-bitwise:0*/
  101. // broken sequence
  102. if (c >= 0xD800 && c <= 0xDFFF) { return false; }
  103. // never used
  104. if (c >= 0xFDD0 && c <= 0xFDEF) { return false; }
  105. if ((c & 0xFFFF) === 0xFFFF || (c & 0xFFFF) === 0xFFFE) { return false; }
  106. // control codes
  107. if (c >= 0x00 && c <= 0x08) { return false; }
  108. if (c === 0x0B) { return false; }
  109. if (c >= 0x0E && c <= 0x1F) { return false; }
  110. if (c >= 0x7F && c <= 0x9F) { return false; }
  111. // out of range
  112. if (c > 0x10FFFF) { return false; }
  113. return true;
  114. }
  115. function fromCodePoint(c) {
  116. /*eslint no-bitwise:0*/
  117. if (c > 0xffff) {
  118. c -= 0x10000;
  119. var surrogate1 = 0xd800 + (c >> 10),
  120. surrogate2 = 0xdc00 + (c & 0x3ff);
  121. return String.fromCharCode(surrogate1, surrogate2);
  122. }
  123. return String.fromCharCode(c);
  124. }
  125. var UNESCAPE_MD_RE = /\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g;
  126. var ENTITY_RE = /&([a-z#][a-z0-9]{1,31});/gi;
  127. var UNESCAPE_ALL_RE = new RegExp(UNESCAPE_MD_RE.source + '|' + ENTITY_RE.source, 'gi');
  128. var DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;
  129. var entities = __webpack_require__(11);
  130. function replaceEntityPattern(match, name) {
  131. var code = 0;
  132. if (has(entities, name)) {
  133. return entities[name];
  134. }
  135. if (name.charCodeAt(0) === 0x23/* # */ && DIGITAL_ENTITY_TEST_RE.test(name)) {
  136. code = name[1].toLowerCase() === 'x' ?
  137. parseInt(name.slice(2), 16)
  138. :
  139. parseInt(name.slice(1), 10);
  140. if (isValidEntityCode(code)) {
  141. return fromCodePoint(code);
  142. }
  143. }
  144. return match;
  145. }
  146. /*function replaceEntities(str) {
  147. if (str.indexOf('&') < 0) { return str; }
  148. return str.replace(ENTITY_RE, replaceEntityPattern);
  149. }*/
  150. function unescapeMd(str) {
  151. if (str.indexOf('\\') < 0) { return str; }
  152. return str.replace(UNESCAPE_MD_RE, '$1');
  153. }
  154. function unescapeAll(str) {
  155. if (str.indexOf('\\') < 0 && str.indexOf('&') < 0) { return str; }
  156. return str.replace(UNESCAPE_ALL_RE, function (match, escaped, entity) {
  157. if (escaped) { return escaped; }
  158. return replaceEntityPattern(match, entity);
  159. });
  160. }
  161. ////////////////////////////////////////////////////////////////////////////////
  162. var HTML_ESCAPE_TEST_RE = /[&<>"]/;
  163. var HTML_ESCAPE_REPLACE_RE = /[&<>"]/g;
  164. var HTML_REPLACEMENTS = {
  165. '&': '&amp;',
  166. '<': '&lt;',
  167. '>': '&gt;',
  168. '"': '&quot;'
  169. };
  170. function replaceUnsafeChar(ch) {
  171. return HTML_REPLACEMENTS[ch];
  172. }
  173. function escapeHtml(str) {
  174. if (HTML_ESCAPE_TEST_RE.test(str)) {
  175. return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);
  176. }
  177. return str;
  178. }
  179. ////////////////////////////////////////////////////////////////////////////////
  180. var REGEXP_ESCAPE_RE = /[.?*+^$[\]\\(){}|-]/g;
  181. function escapeRE(str) {
  182. return str.replace(REGEXP_ESCAPE_RE, '\\$&');
  183. }
  184. ////////////////////////////////////////////////////////////////////////////////
  185. function isSpace(code) {
  186. switch (code) {
  187. case 0x09:
  188. case 0x20:
  189. return true;
  190. }
  191. return false;
  192. }
  193. // Zs (unicode class) || [\t\f\v\r\n]
  194. function isWhiteSpace(code) {
  195. if (code >= 0x2000 && code <= 0x200A) { return true; }
  196. switch (code) {
  197. case 0x09: // \t
  198. case 0x0A: // \n
  199. case 0x0B: // \v
  200. case 0x0C: // \f
  201. case 0x0D: // \r
  202. case 0x20:
  203. case 0xA0:
  204. case 0x1680:
  205. case 0x202F:
  206. case 0x205F:
  207. case 0x3000:
  208. return true;
  209. }
  210. return false;
  211. }
  212. ////////////////////////////////////////////////////////////////////////////////
  213. /*eslint-disable max-len*/
  214. var UNICODE_PUNCT_RE = __webpack_require__(5);
  215. // Currently without astral characters support.
  216. function isPunctChar(ch) {
  217. return UNICODE_PUNCT_RE.test(ch);
  218. }
  219. // Markdown ASCII punctuation characters.
  220. //
  221. // !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~
  222. // http://spec.commonmark.org/0.15/#ascii-punctuation-character
  223. //
  224. // Don't confuse with unicode punctuation !!! It lacks some chars in ascii range.
  225. //
  226. function isMdAsciiPunct(ch) {
  227. switch (ch) {
  228. case 0x21/* ! */:
  229. case 0x22/* " */:
  230. case 0x23/* # */:
  231. case 0x24/* $ */:
  232. case 0x25/* % */:
  233. case 0x26/* & */:
  234. case 0x27/* ' */:
  235. case 0x28/* ( */:
  236. case 0x29/* ) */:
  237. case 0x2A/* * */:
  238. case 0x2B/* + */:
  239. case 0x2C/* , */:
  240. case 0x2D/* - */:
  241. case 0x2E/* . */:
  242. case 0x2F/* / */:
  243. case 0x3A/* : */:
  244. case 0x3B/* ; */:
  245. case 0x3C/* < */:
  246. case 0x3D/* = */:
  247. case 0x3E/* > */:
  248. case 0x3F/* ? */:
  249. case 0x40/* @ */:
  250. case 0x5B/* [ */:
  251. case 0x5C/* \ */:
  252. case 0x5D/* ] */:
  253. case 0x5E/* ^ */:
  254. case 0x5F/* _ */:
  255. case 0x60/* ` */:
  256. case 0x7B/* { */:
  257. case 0x7C/* | */:
  258. case 0x7D/* } */:
  259. case 0x7E/* ~ */:
  260. return true;
  261. default:
  262. return false;
  263. }
  264. }
  265. // Hepler to unify [reference labels].
  266. //
  267. function normalizeReference(str) {
  268. // use .toUpperCase() instead of .toLowerCase()
  269. // here to avoid a conflict with Object.prototype
  270. // members (most notably, `__proto__`)
  271. return str.trim().replace(/\s+/g, ' ').toUpperCase();
  272. }
  273. ////////////////////////////////////////////////////////////////////////////////
  274. // Re-export libraries commonly used in both markdown-it and its plugins,
  275. // so plugins won't have to depend on them explicitly, which reduces their
  276. // bundled size (e.g. a browser build).
  277. //
  278. exports.lib = {};
  279. exports.lib.mdurl = __webpack_require__(12);
  280. exports.lib.ucmicro = __webpack_require__(36);
  281. exports.assign = assign;
  282. exports.isString = isString;
  283. exports.has = has;
  284. exports.unescapeMd = unescapeMd;
  285. exports.unescapeAll = unescapeAll;
  286. exports.isValidEntityCode = isValidEntityCode;
  287. exports.fromCodePoint = fromCodePoint;
  288. // exports.replaceEntities = replaceEntities;
  289. exports.escapeHtml = escapeHtml;
  290. exports.arrayReplaceAt = arrayReplaceAt;
  291. exports.isSpace = isSpace;
  292. exports.isWhiteSpace = isWhiteSpace;
  293. exports.isMdAsciiPunct = isMdAsciiPunct;
  294. exports.isPunctChar = isPunctChar;
  295. exports.escapeRE = escapeRE;
  296. exports.normalizeReference = normalizeReference;
  297. /***/ }),
  298. /* 1 */
  299. /***/ (function(module, exports, __webpack_require__) {
  300. /* WEBPACK VAR INJECTION */(function(setImmediate, global) {;(function() {
  301. "use strict"
  302. function Vnode(tag, key, attrs0, children, text, dom) {
  303. return {tag: tag, key: key, attrs: attrs0, children: children, text: text, dom: dom, domSize: undefined, state: undefined, _state: undefined, events: undefined, instance: undefined, skip: false}
  304. }
  305. Vnode.normalize = function(node) {
  306. if (Array.isArray(node)) return Vnode("[", undefined, undefined, Vnode.normalizeChildren(node), undefined, undefined)
  307. if (node != null && typeof node !== "object") return Vnode("#", undefined, undefined, node === false ? "" : node, undefined, undefined)
  308. return node
  309. }
  310. Vnode.normalizeChildren = function normalizeChildren(children) {
  311. for (var i = 0; i < children.length; i++) {
  312. children[i] = Vnode.normalize(children[i])
  313. }
  314. return children
  315. }
  316. var selectorParser = /(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g
  317. var selectorCache = {}
  318. var hasOwn = {}.hasOwnProperty
  319. function isEmpty(object) {
  320. for (var key in object) if (hasOwn.call(object, key)) return false
  321. return true
  322. }
  323. function compileSelector(selector) {
  324. var match, tag = "div", classes = [], attrs = {}
  325. while (match = selectorParser.exec(selector)) {
  326. var type = match[1], value = match[2]
  327. if (type === "" && value !== "") tag = value
  328. else if (type === "#") attrs.id = value
  329. else if (type === ".") classes.push(value)
  330. else if (match[3][0] === "[") {
  331. var attrValue = match[6]
  332. if (attrValue) attrValue = attrValue.replace(/\\(["'])/g, "$1").replace(/\\\\/g, "\\")
  333. if (match[4] === "class") classes.push(attrValue)
  334. else attrs[match[4]] = attrValue === "" ? attrValue : attrValue || true
  335. }
  336. }
  337. if (classes.length > 0) attrs.className = classes.join(" ")
  338. return selectorCache[selector] = {tag: tag, attrs: attrs}
  339. }
  340. function execSelector(state, attrs, children) {
  341. var hasAttrs = false, childList, text
  342. var className = attrs.className || attrs.class
  343. if (!isEmpty(state.attrs) && !isEmpty(attrs)) {
  344. var newAttrs = {}
  345. for(var key in attrs) {
  346. if (hasOwn.call(attrs, key)) {
  347. newAttrs[key] = attrs[key]
  348. }
  349. }
  350. attrs = newAttrs
  351. }
  352. for (var key in state.attrs) {
  353. if (hasOwn.call(state.attrs, key)) {
  354. attrs[key] = state.attrs[key]
  355. }
  356. }
  357. if (className !== undefined) {
  358. if (attrs.class !== undefined) {
  359. attrs.class = undefined
  360. attrs.className = className
  361. }
  362. if (state.attrs.className != null) {
  363. attrs.className = state.attrs.className + " " + className
  364. }
  365. }
  366. for (var key in attrs) {
  367. if (hasOwn.call(attrs, key) && key !== "key") {
  368. hasAttrs = true
  369. break
  370. }
  371. }
  372. if (Array.isArray(children) && children.length === 1 && children[0] != null && children[0].tag === "#") {
  373. text = children[0].children
  374. } else {
  375. childList = children
  376. }
  377. return Vnode(state.tag, attrs.key, hasAttrs ? attrs : undefined, childList, text)
  378. }
  379. function hyperscript(selector) {
  380. // Because sloppy mode sucks
  381. var attrs = arguments[1], start = 2, children
  382. if (selector == null || typeof selector !== "string" && typeof selector !== "function" && typeof selector.view !== "function") {
  383. throw Error("The selector must be either a string or a component.");
  384. }
  385. if (typeof selector === "string") {
  386. var cached = selectorCache[selector] || compileSelector(selector)
  387. }
  388. if (attrs == null) {
  389. attrs = {}
  390. } else if (typeof attrs !== "object" || attrs.tag != null || Array.isArray(attrs)) {
  391. attrs = {}
  392. start = 1
  393. }
  394. if (arguments.length === start + 1) {
  395. children = arguments[start]
  396. if (!Array.isArray(children)) children = [children]
  397. } else {
  398. children = []
  399. while (start < arguments.length) children.push(arguments[start++])
  400. }
  401. var normalized = Vnode.normalizeChildren(children)
  402. if (typeof selector === "string") {
  403. return execSelector(cached, attrs, normalized)
  404. } else {
  405. return Vnode(selector, attrs.key, attrs, normalized)
  406. }
  407. }
  408. hyperscript.trust = function(html) {
  409. if (html == null) html = ""
  410. return Vnode("<", undefined, undefined, html, undefined, undefined)
  411. }
  412. hyperscript.fragment = function(attrs1, children) {
  413. return Vnode("[", attrs1.key, attrs1, Vnode.normalizeChildren(children), undefined, undefined)
  414. }
  415. var m = hyperscript
  416. /** @constructor */
  417. var PromisePolyfill = function(executor) {
  418. if (!(this instanceof PromisePolyfill)) throw new Error("Promise must be called with `new`")
  419. if (typeof executor !== "function") throw new TypeError("executor must be a function")
  420. var self = this, resolvers = [], rejectors = [], resolveCurrent = handler(resolvers, true), rejectCurrent = handler(rejectors, false)
  421. var instance = self._instance = {resolvers: resolvers, rejectors: rejectors}
  422. var callAsync = typeof setImmediate === "function" ? setImmediate : setTimeout
  423. function handler(list, shouldAbsorb) {
  424. return function execute(value) {
  425. var then
  426. try {
  427. if (shouldAbsorb && value != null && (typeof value === "object" || typeof value === "function") && typeof (then = value.then) === "function") {
  428. if (value === self) throw new TypeError("Promise can't be resolved w/ itself")
  429. executeOnce(then.bind(value))
  430. }
  431. else {
  432. callAsync(function() {
  433. if (!shouldAbsorb && list.length === 0) console.error("Possible unhandled promise rejection:", value)
  434. for (var i = 0; i < list.length; i++) list[i](value)
  435. resolvers.length = 0, rejectors.length = 0
  436. instance.state = shouldAbsorb
  437. instance.retry = function() {execute(value)}
  438. })
  439. }
  440. }
  441. catch (e) {
  442. rejectCurrent(e)
  443. }
  444. }
  445. }
  446. function executeOnce(then) {
  447. var runs = 0
  448. function run(fn) {
  449. return function(value) {
  450. if (runs++ > 0) return
  451. fn(value)
  452. }
  453. }
  454. var onerror = run(rejectCurrent)
  455. try {then(run(resolveCurrent), onerror)} catch (e) {onerror(e)}
  456. }
  457. executeOnce(executor)
  458. }
  459. PromisePolyfill.prototype.then = function(onFulfilled, onRejection) {
  460. var self = this, instance = self._instance
  461. function handle(callback, list, next, state) {
  462. list.push(function(value) {
  463. if (typeof callback !== "function") next(value)
  464. else try {resolveNext(callback(value))} catch (e) {if (rejectNext) rejectNext(e)}
  465. })
  466. if (typeof instance.retry === "function" && state === instance.state) instance.retry()
  467. }
  468. var resolveNext, rejectNext
  469. var promise = new PromisePolyfill(function(resolve, reject) {resolveNext = resolve, rejectNext = reject})
  470. handle(onFulfilled, instance.resolvers, resolveNext, true), handle(onRejection, instance.rejectors, rejectNext, false)
  471. return promise
  472. }
  473. PromisePolyfill.prototype.catch = function(onRejection) {
  474. return this.then(null, onRejection)
  475. }
  476. PromisePolyfill.resolve = function(value) {
  477. if (value instanceof PromisePolyfill) return value
  478. return new PromisePolyfill(function(resolve) {resolve(value)})
  479. }
  480. PromisePolyfill.reject = function(value) {
  481. return new PromisePolyfill(function(resolve, reject) {reject(value)})
  482. }
  483. PromisePolyfill.all = function(list) {
  484. return new PromisePolyfill(function(resolve, reject) {
  485. var total = list.length, count = 0, values = []
  486. if (list.length === 0) resolve([])
  487. else for (var i = 0; i < list.length; i++) {
  488. (function(i) {
  489. function consume(value) {
  490. count++
  491. values[i] = value
  492. if (count === total) resolve(values)
  493. }
  494. if (list[i] != null && (typeof list[i] === "object" || typeof list[i] === "function") && typeof list[i].then === "function") {
  495. list[i].then(consume, reject)
  496. }
  497. else consume(list[i])
  498. })(i)
  499. }
  500. })
  501. }
  502. PromisePolyfill.race = function(list) {
  503. return new PromisePolyfill(function(resolve, reject) {
  504. for (var i = 0; i < list.length; i++) {
  505. list[i].then(resolve, reject)
  506. }
  507. })
  508. }
  509. if (typeof window !== "undefined") {
  510. if (typeof window.Promise === "undefined") window.Promise = PromisePolyfill
  511. var PromisePolyfill = window.Promise
  512. } else if (typeof global !== "undefined") {
  513. if (typeof global.Promise === "undefined") global.Promise = PromisePolyfill
  514. var PromisePolyfill = global.Promise
  515. } else {
  516. }
  517. var buildQueryString = function(object) {
  518. if (Object.prototype.toString.call(object) !== "[object Object]") return ""
  519. var args = []
  520. for (var key0 in object) {
  521. destructure(key0, object[key0])
  522. }
  523. return args.join("&")
  524. function destructure(key0, value) {
  525. if (Array.isArray(value)) {
  526. for (var i = 0; i < value.length; i++) {
  527. destructure(key0 + "[" + i + "]", value[i])
  528. }
  529. }
  530. else if (Object.prototype.toString.call(value) === "[object Object]") {
  531. for (var i in value) {
  532. destructure(key0 + "[" + i + "]", value[i])
  533. }
  534. }
  535. else args.push(encodeURIComponent(key0) + (value != null && value !== "" ? "=" + encodeURIComponent(value) : ""))
  536. }
  537. }
  538. var FILE_PROTOCOL_REGEX = new RegExp("^file://", "i")
  539. var _8 = function($window, Promise) {
  540. var callbackCount = 0
  541. var oncompletion
  542. function setCompletionCallback(callback) {oncompletion = callback}
  543. function finalizer() {
  544. var count = 0
  545. function complete() {if (--count === 0 && typeof oncompletion === "function") oncompletion()}
  546. return function finalize(promise0) {
  547. var then0 = promise0.then
  548. promise0.then = function() {
  549. count++
  550. var next = then0.apply(promise0, arguments)
  551. next.then(complete, function(e) {
  552. complete()
  553. if (count === 0) throw e
  554. })
  555. return finalize(next)
  556. }
  557. return promise0
  558. }
  559. }
  560. function normalize(args, extra) {
  561. if (typeof args === "string") {
  562. var url = args
  563. args = extra || {}
  564. if (args.url == null) args.url = url
  565. }
  566. return args
  567. }
  568. function request(args, extra) {
  569. var finalize = finalizer()
  570. args = normalize(args, extra)
  571. var promise0 = new Promise(function(resolve, reject) {
  572. if (args.method == null) args.method = "GET"
  573. args.method = args.method.toUpperCase()
  574. var useBody = (args.method === "GET" || args.method === "TRACE") ? false : (typeof args.useBody === "boolean" ? args.useBody : true)
  575. if (typeof args.serialize !== "function") args.serialize = typeof FormData !== "undefined" && args.data instanceof FormData ? function(value) {return value} : JSON.stringify
  576. if (typeof args.deserialize !== "function") args.deserialize = deserialize
  577. if (typeof args.extract !== "function") args.extract = extract
  578. args.url = interpolate(args.url, args.data)
  579. if (useBody) args.data = args.serialize(args.data)
  580. else args.url = assemble(args.url, args.data)
  581. var xhr = new $window.XMLHttpRequest(),
  582. aborted = false,
  583. _abort = xhr.abort
  584. xhr.abort = function abort() {
  585. aborted = true
  586. _abort.call(xhr)
  587. }
  588. xhr.open(args.method, args.url, typeof args.async === "boolean" ? args.async : true, typeof args.user === "string" ? args.user : undefined, typeof args.password === "string" ? args.password : undefined)
  589. if (args.serialize === JSON.stringify && useBody && !(args.headers && args.headers.hasOwnProperty("Content-Type"))) {
  590. xhr.setRequestHeader("Content-Type", "application/json; charset=utf-8")
  591. }
  592. if (args.deserialize === deserialize && !(args.headers && args.headers.hasOwnProperty("Accept"))) {
  593. xhr.setRequestHeader("Accept", "application/json, text/*")
  594. }
  595. if (args.withCredentials) xhr.withCredentials = args.withCredentials
  596. for (var key in args.headers) if ({}.hasOwnProperty.call(args.headers, key)) {
  597. xhr.setRequestHeader(key, args.headers[key])
  598. }
  599. if (typeof args.config === "function") xhr = args.config(xhr, args) || xhr
  600. xhr.onreadystatechange = function() {
  601. // Don't throw errors on xhr.abort().
  602. if(aborted) return
  603. if (xhr.readyState === 4) {
  604. try {
  605. var response = (args.extract !== extract) ? args.extract(xhr, args) : args.deserialize(args.extract(xhr, args))
  606. if ((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304 || FILE_PROTOCOL_REGEX.test(args.url)) {
  607. resolve(cast(args.type, response))
  608. }
  609. else {
  610. var error = new Error(xhr.responseText)
  611. for (var key in response) error[key] = response[key]
  612. reject(error)
  613. }
  614. }
  615. catch (e) {
  616. reject(e)
  617. }
  618. }
  619. }
  620. if (useBody && (args.data != null)) xhr.send(args.data)
  621. else xhr.send()
  622. })
  623. return args.background === true ? promise0 : finalize(promise0)
  624. }
  625. function jsonp(args, extra) {
  626. var finalize = finalizer()
  627. args = normalize(args, extra)
  628. var promise0 = new Promise(function(resolve, reject) {
  629. var callbackName = args.callbackName || "_mithril_" + Math.round(Math.random() * 1e16) + "_" + callbackCount++
  630. var script = $window.document.createElement("script")
  631. $window[callbackName] = function(data) {
  632. script.parentNode.removeChild(script)
  633. resolve(cast(args.type, data))
  634. delete $window[callbackName]
  635. }
  636. script.onerror = function() {
  637. script.parentNode.removeChild(script)
  638. reject(new Error("JSONP request failed"))
  639. delete $window[callbackName]
  640. }
  641. if (args.data == null) args.data = {}
  642. args.url = interpolate(args.url, args.data)
  643. args.data[args.callbackKey || "callback"] = callbackName
  644. script.src = assemble(args.url, args.data)
  645. $window.document.documentElement.appendChild(script)
  646. })
  647. return args.background === true? promise0 : finalize(promise0)
  648. }
  649. function interpolate(url, data) {
  650. if (data == null) return url
  651. var tokens = url.match(/:[^\/]+/gi) || []
  652. for (var i = 0; i < tokens.length; i++) {
  653. var key = tokens[i].slice(1)
  654. if (data[key] != null) {
  655. url = url.replace(tokens[i], data[key])
  656. }
  657. }
  658. return url
  659. }
  660. function assemble(url, data) {
  661. var querystring = buildQueryString(data)
  662. if (querystring !== "") {
  663. var prefix = url.indexOf("?") < 0 ? "?" : "&"
  664. url += prefix + querystring
  665. }
  666. return url
  667. }
  668. function deserialize(data) {
  669. try {return data !== "" ? JSON.parse(data) : null}
  670. catch (e) {throw new Error(data)}
  671. }
  672. function extract(xhr) {return xhr.responseText}
  673. function cast(type0, data) {
  674. if (typeof type0 === "function") {
  675. if (Array.isArray(data)) {
  676. for (var i = 0; i < data.length; i++) {
  677. data[i] = new type0(data[i])
  678. }
  679. }
  680. else return new type0(data)
  681. }
  682. return data
  683. }
  684. return {request: request, jsonp: jsonp, setCompletionCallback: setCompletionCallback}
  685. }
  686. var requestService = _8(window, PromisePolyfill)
  687. var coreRenderer = function($window) {
  688. var $doc = $window.document
  689. var $emptyFragment = $doc.createDocumentFragment()
  690. var nameSpace = {
  691. svg: "http://www.w3.org/2000/svg",
  692. math: "http://www.w3.org/1998/Math/MathML"
  693. }
  694. var onevent
  695. function setEventCallback(callback) {return onevent = callback}
  696. function getNameSpace(vnode) {
  697. return vnode.attrs && vnode.attrs.xmlns || nameSpace[vnode.tag]
  698. }
  699. //create
  700. function createNodes(parent, vnodes, start, end, hooks, nextSibling, ns) {
  701. for (var i = start; i < end; i++) {
  702. var vnode = vnodes[i]
  703. if (vnode != null) {
  704. createNode(parent, vnode, hooks, ns, nextSibling)
  705. }
  706. }
  707. }
  708. function createNode(parent, vnode, hooks, ns, nextSibling) {
  709. var tag = vnode.tag
  710. if (typeof tag === "string") {
  711. vnode.state = {}
  712. if (vnode.attrs != null) initLifecycle(vnode.attrs, vnode, hooks)
  713. switch (tag) {
  714. case "#": return createText(parent, vnode, nextSibling)
  715. case "<": return createHTML(parent, vnode, nextSibling)
  716. case "[": return createFragment(parent, vnode, hooks, ns, nextSibling)
  717. default: return createElement(parent, vnode, hooks, ns, nextSibling)
  718. }
  719. }
  720. else return createComponent(parent, vnode, hooks, ns, nextSibling)
  721. }
  722. function createText(parent, vnode, nextSibling) {
  723. vnode.dom = $doc.createTextNode(vnode.children)
  724. insertNode(parent, vnode.dom, nextSibling)
  725. return vnode.dom
  726. }
  727. function createHTML(parent, vnode, nextSibling) {
  728. var match1 = vnode.children.match(/^\s*?<(\w+)/im) || []
  729. var parent1 = {caption: "table", thead: "table", tbody: "table", tfoot: "table", tr: "tbody", th: "tr", td: "tr", colgroup: "table", col: "colgroup"}[match1[1]] || "div"
  730. var temp = $doc.createElement(parent1)
  731. temp.innerHTML = vnode.children
  732. vnode.dom = temp.firstChild
  733. vnode.domSize = temp.childNodes.length
  734. var fragment = $doc.createDocumentFragment()
  735. var child
  736. while (child = temp.firstChild) {
  737. fragment.appendChild(child)
  738. }
  739. insertNode(parent, fragment, nextSibling)
  740. return fragment
  741. }
  742. function createFragment(parent, vnode, hooks, ns, nextSibling) {
  743. var fragment = $doc.createDocumentFragment()
  744. if (vnode.children != null) {
  745. var children = vnode.children
  746. createNodes(fragment, children, 0, children.length, hooks, null, ns)
  747. }
  748. vnode.dom = fragment.firstChild
  749. vnode.domSize = fragment.childNodes.length
  750. insertNode(parent, fragment, nextSibling)
  751. return fragment
  752. }
  753. function createElement(parent, vnode, hooks, ns, nextSibling) {
  754. var tag = vnode.tag
  755. var attrs2 = vnode.attrs
  756. var is = attrs2 && attrs2.is
  757. ns = getNameSpace(vnode) || ns
  758. var element = ns ?
  759. is ? $doc.createElementNS(ns, tag, {is: is}) : $doc.createElementNS(ns, tag) :
  760. is ? $doc.createElement(tag, {is: is}) : $doc.createElement(tag)
  761. vnode.dom = element
  762. if (attrs2 != null) {
  763. setAttrs(vnode, attrs2, ns)
  764. }
  765. insertNode(parent, element, nextSibling)
  766. if (vnode.attrs != null && vnode.attrs.contenteditable != null) {
  767. setContentEditable(vnode)
  768. }
  769. else {
  770. if (vnode.text != null) {
  771. if (vnode.text !== "") element.textContent = vnode.text
  772. else vnode.children = [Vnode("#", undefined, undefined, vnode.text, undefined, undefined)]
  773. }
  774. if (vnode.children != null) {
  775. var children = vnode.children
  776. createNodes(element, children, 0, children.length, hooks, null, ns)
  777. setLateAttrs(vnode)
  778. }
  779. }
  780. return element
  781. }
  782. function initComponent(vnode, hooks) {
  783. var sentinel
  784. if (typeof vnode.tag.view === "function") {
  785. vnode.state = Object.create(vnode.tag)
  786. sentinel = vnode.state.view
  787. if (sentinel.$$reentrantLock$$ != null) return $emptyFragment
  788. sentinel.$$reentrantLock$$ = true
  789. } else {
  790. vnode.state = void 0
  791. sentinel = vnode.tag
  792. if (sentinel.$$reentrantLock$$ != null) return $emptyFragment
  793. sentinel.$$reentrantLock$$ = true
  794. vnode.state = (vnode.tag.prototype != null && typeof vnode.tag.prototype.view === "function") ? new vnode.tag(vnode) : vnode.tag(vnode)
  795. }
  796. vnode._state = vnode.state
  797. if (vnode.attrs != null) initLifecycle(vnode.attrs, vnode, hooks)
  798. initLifecycle(vnode._state, vnode, hooks)
  799. vnode.instance = Vnode.normalize(vnode._state.view.call(vnode.state, vnode))
  800. if (vnode.instance === vnode) throw Error("A view cannot return the vnode it received as argument")
  801. sentinel.$$reentrantLock$$ = null
  802. }
  803. function createComponent(parent, vnode, hooks, ns, nextSibling) {
  804. initComponent(vnode, hooks)
  805. if (vnode.instance != null) {
  806. var element = createNode(parent, vnode.instance, hooks, ns, nextSibling)
  807. vnode.dom = vnode.instance.dom
  808. vnode.domSize = vnode.dom != null ? vnode.instance.domSize : 0
  809. insertNode(parent, element, nextSibling)
  810. return element
  811. }
  812. else {
  813. vnode.domSize = 0
  814. return $emptyFragment
  815. }
  816. }
  817. //update
  818. function updateNodes(parent, old, vnodes, recycling, hooks, nextSibling, ns) {
  819. if (old === vnodes || old == null && vnodes == null) return
  820. else if (old == null) createNodes(parent, vnodes, 0, vnodes.length, hooks, nextSibling, ns)
  821. else if (vnodes == null) removeNodes(old, 0, old.length, vnodes)
  822. else {
  823. if (old.length === vnodes.length) {
  824. var isUnkeyed = false
  825. for (var i = 0; i < vnodes.length; i++) {
  826. if (vnodes[i] != null && old[i] != null) {
  827. isUnkeyed = vnodes[i].key == null && old[i].key == null
  828. break
  829. }
  830. }
  831. if (isUnkeyed) {
  832. for (var i = 0; i < old.length; i++) {
  833. if (old[i] === vnodes[i]) continue
  834. else if (old[i] == null && vnodes[i] != null) createNode(parent, vnodes[i], hooks, ns, getNextSibling(old, i + 1, nextSibling))
  835. else if (vnodes[i] == null) removeNodes(old, i, i + 1, vnodes)
  836. else updateNode(parent, old[i], vnodes[i], hooks, getNextSibling(old, i + 1, nextSibling), recycling, ns)
  837. }
  838. return
  839. }
  840. }
  841. recycling = recycling || isRecyclable(old, vnodes)
  842. if (recycling) {
  843. var pool = old.pool
  844. old = old.concat(old.pool)
  845. }
  846. var oldStart = 0, start = 0, oldEnd = old.length - 1, end = vnodes.length - 1, map
  847. while (oldEnd >= oldStart && end >= start) {
  848. var o = old[oldStart], v = vnodes[start]
  849. if (o === v && !recycling) oldStart++, start++
  850. else if (o == null) oldStart++
  851. else if (v == null) start++
  852. else if (o.key === v.key) {
  853. var shouldRecycle = (pool != null && oldStart >= old.length - pool.length) || ((pool == null) && recycling)
  854. oldStart++, start++
  855. updateNode(parent, o, v, hooks, getNextSibling(old, oldStart, nextSibling), shouldRecycle, ns)
  856. if (recycling && o.tag === v.tag) insertNode(parent, toFragment(o), nextSibling)
  857. }
  858. else {
  859. var o = old[oldEnd]
  860. if (o === v && !recycling) oldEnd--, start++
  861. else if (o == null) oldEnd--
  862. else if (v == null) start++
  863. else if (o.key === v.key) {
  864. var shouldRecycle = (pool != null && oldEnd >= old.length - pool.length) || ((pool == null) && recycling)
  865. updateNode(parent, o, v, hooks, getNextSibling(old, oldEnd + 1, nextSibling), shouldRecycle, ns)
  866. if (recycling || start < end) insertNode(parent, toFragment(o), getNextSibling(old, oldStart, nextSibling))
  867. oldEnd--, start++
  868. }
  869. else break
  870. }
  871. }
  872. while (oldEnd >= oldStart && end >= start) {
  873. var o = old[oldEnd], v = vnodes[end]
  874. if (o === v && !recycling) oldEnd--, end--
  875. else if (o == null) oldEnd--
  876. else if (v == null) end--
  877. else if (o.key === v.key) {
  878. var shouldRecycle = (pool != null && oldEnd >= old.length - pool.length) || ((pool == null) && recycling)
  879. updateNode(parent, o, v, hooks, getNextSibling(old, oldEnd + 1, nextSibling), shouldRecycle, ns)
  880. if (recycling && o.tag === v.tag) insertNode(parent, toFragment(o), nextSibling)
  881. if (o.dom != null) nextSibling = o.dom
  882. oldEnd--, end--
  883. }
  884. else {
  885. if (!map) map = getKeyMap(old, oldEnd)
  886. if (v != null) {
  887. var oldIndex = map[v.key]
  888. if (oldIndex != null) {
  889. var movable = old[oldIndex]
  890. var shouldRecycle = (pool != null && oldIndex >= old.length - pool.length) || ((pool == null) && recycling)
  891. updateNode(parent, movable, v, hooks, getNextSibling(old, oldEnd + 1, nextSibling), recycling, ns)
  892. insertNode(parent, toFragment(movable), nextSibling)
  893. old[oldIndex].skip = true
  894. if (movable.dom != null) nextSibling = movable.dom
  895. }
  896. else {
  897. var dom = createNode(parent, v, hooks, ns, nextSibling)
  898. nextSibling = dom
  899. }
  900. }
  901. end--
  902. }
  903. if (end < start) break
  904. }
  905. createNodes(parent, vnodes, start, end + 1, hooks, nextSibling, ns)
  906. removeNodes(old, oldStart, oldEnd + 1, vnodes)
  907. }
  908. }
  909. function updateNode(parent, old, vnode, hooks, nextSibling, recycling, ns) {
  910. var oldTag = old.tag, tag = vnode.tag
  911. if (oldTag === tag) {
  912. vnode.state = old.state
  913. vnode._state = old._state
  914. vnode.events = old.events
  915. if (!recycling && shouldNotUpdate(vnode, old)) return
  916. if (typeof oldTag === "string") {
  917. if (vnode.attrs != null) {
  918. if (recycling) {
  919. vnode.state = {}
  920. initLifecycle(vnode.attrs, vnode, hooks)
  921. }
  922. else updateLifecycle(vnode.attrs, vnode, hooks)
  923. }
  924. switch (oldTag) {
  925. case "#": updateText(old, vnode); break
  926. case "<": updateHTML(parent, old, vnode, nextSibling); break
  927. case "[": updateFragment(parent, old, vnode, recycling, hooks, nextSibling, ns); break
  928. default: updateElement(old, vnode, recycling, hooks, ns)
  929. }
  930. }
  931. else updateComponent(parent, old, vnode, hooks, nextSibling, recycling, ns)
  932. }
  933. else {
  934. removeNode(old, null)
  935. createNode(parent, vnode, hooks, ns, nextSibling)
  936. }
  937. }
  938. function updateText(old, vnode) {
  939. if (old.children.toString() !== vnode.children.toString()) {
  940. old.dom.nodeValue = vnode.children
  941. }
  942. vnode.dom = old.dom
  943. }
  944. function updateHTML(parent, old, vnode, nextSibling) {
  945. if (old.children !== vnode.children) {
  946. toFragment(old)
  947. createHTML(parent, vnode, nextSibling)
  948. }
  949. else vnode.dom = old.dom, vnode.domSize = old.domSize
  950. }
  951. function updateFragment(parent, old, vnode, recycling, hooks, nextSibling, ns) {
  952. updateNodes(parent, old.children, vnode.children, recycling, hooks, nextSibling, ns)
  953. var domSize = 0, children = vnode.children
  954. vnode.dom = null
  955. if (children != null) {
  956. for (var i = 0; i < children.length; i++) {
  957. var child = children[i]
  958. if (child != null && child.dom != null) {
  959. if (vnode.dom == null) vnode.dom = child.dom
  960. domSize += child.domSize || 1
  961. }
  962. }
  963. if (domSize !== 1) vnode.domSize = domSize
  964. }
  965. }
  966. function updateElement(old, vnode, recycling, hooks, ns) {
  967. var element = vnode.dom = old.dom
  968. ns = getNameSpace(vnode) || ns
  969. if (vnode.tag === "textarea") {
  970. if (vnode.attrs == null) vnode.attrs = {}
  971. if (vnode.text != null) {
  972. vnode.attrs.value = vnode.text //FIXME handle0 multiple children
  973. vnode.text = undefined
  974. }
  975. }
  976. updateAttrs(vnode, old.attrs, vnode.attrs, ns)
  977. if (vnode.attrs != null && vnode.attrs.contenteditable != null) {
  978. setContentEditable(vnode)
  979. }
  980. else if (old.text != null && vnode.text != null && vnode.text !== "") {
  981. if (old.text.toString() !== vnode.text.toString()) old.dom.firstChild.nodeValue = vnode.text
  982. }
  983. else {
  984. if (old.text != null) old.children = [Vnode("#", undefined, undefined, old.text, undefined, old.dom.firstChild)]
  985. if (vnode.text != null) vnode.children = [Vnode("#", undefined, undefined, vnode.text, undefined, undefined)]
  986. updateNodes(element, old.children, vnode.children, recycling, hooks, null, ns)
  987. }
  988. }
  989. function updateComponent(parent, old, vnode, hooks, nextSibling, recycling, ns) {
  990. if (recycling) {
  991. initComponent(vnode, hooks)
  992. } else {
  993. vnode.instance = Vnode.normalize(vnode._state.view.call(vnode.state, vnode))
  994. if (vnode.instance === vnode) throw Error("A view cannot return the vnode it received as argument")
  995. if (vnode.attrs != null) updateLifecycle(vnode.attrs, vnode, hooks)
  996. updateLifecycle(vnode._state, vnode, hooks)
  997. }
  998. if (vnode.instance != null) {
  999. if (old.instance == null) createNode(parent, vnode.instance, hooks, ns, nextSibling)
  1000. else updateNode(parent, old.instance, vnode.instance, hooks, nextSibling, recycling, ns)
  1001. vnode.dom = vnode.instance.dom
  1002. vnode.domSize = vnode.instance.domSize
  1003. }
  1004. else if (old.instance != null) {
  1005. removeNode(old.instance, null)
  1006. vnode.dom = undefined
  1007. vnode.domSize = 0
  1008. }
  1009. else {
  1010. vnode.dom = old.dom
  1011. vnode.domSize = old.domSize
  1012. }
  1013. }
  1014. function isRecyclable(old, vnodes) {
  1015. if (old.pool != null && Math.abs(old.pool.length - vnodes.length) <= Math.abs(old.length - vnodes.length)) {
  1016. var oldChildrenLength = old[0] && old[0].children && old[0].children.length || 0
  1017. var poolChildrenLength = old.pool[0] && old.pool[0].children && old.pool[0].children.length || 0
  1018. var vnodesChildrenLength = vnodes[0] && vnodes[0].children && vnodes[0].children.length || 0
  1019. if (Math.abs(poolChildrenLength - vnodesChildrenLength) <= Math.abs(oldChildrenLength - vnodesChildrenLength)) {
  1020. return true
  1021. }
  1022. }
  1023. return false
  1024. }
  1025. function getKeyMap(vnodes, end) {
  1026. var map = {}, i = 0
  1027. for (var i = 0; i < end; i++) {
  1028. var vnode = vnodes[i]
  1029. if (vnode != null) {
  1030. var key2 = vnode.key
  1031. if (key2 != null) map[key2] = i
  1032. }
  1033. }
  1034. return map
  1035. }
  1036. function toFragment(vnode) {
  1037. var count0 = vnode.domSize
  1038. if (count0 != null || vnode.dom == null) {
  1039. var fragment = $doc.createDocumentFragment()
  1040. if (count0 > 0) {
  1041. var dom = vnode.dom
  1042. while (--count0) fragment.appendChild(dom.nextSibling)
  1043. fragment.insertBefore(dom, fragment.firstChild)
  1044. }
  1045. return fragment
  1046. }
  1047. else return vnode.dom
  1048. }
  1049. function getNextSibling(vnodes, i, nextSibling) {
  1050. for (; i < vnodes.length; i++) {
  1051. if (vnodes[i] != null && vnodes[i].dom != null) return vnodes[i].dom
  1052. }
  1053. return nextSibling
  1054. }
  1055. function insertNode(parent, dom, nextSibling) {
  1056. if (nextSibling && nextSibling.parentNode) parent.insertBefore(dom, nextSibling)
  1057. else parent.appendChild(dom)
  1058. }
  1059. function setContentEditable(vnode) {
  1060. var children = vnode.children
  1061. if (children != null && children.length === 1 && children[0].tag === "<") {
  1062. var content = children[0].children
  1063. if (vnode.dom.innerHTML !== content) vnode.dom.innerHTML = content
  1064. }
  1065. else if (vnode.text != null || children != null && children.length !== 0) throw new Error("Child node of a contenteditable must be trusted")
  1066. }
  1067. //remove
  1068. function removeNodes(vnodes, start, end, context) {
  1069. for (var i = start; i < end; i++) {
  1070. var vnode = vnodes[i]
  1071. if (vnode != null) {
  1072. if (vnode.skip) vnode.skip = false
  1073. else removeNode(vnode, context)
  1074. }
  1075. }
  1076. }
  1077. function removeNode(vnode, context) {
  1078. var expected = 1, called = 0
  1079. if (vnode.attrs && typeof vnode.attrs.onbeforeremove === "function") {
  1080. var result = vnode.attrs.onbeforeremove.call(vnode.state, vnode)
  1081. if (result != null && typeof result.then === "function") {
  1082. expected++
  1083. result.then(continuation, continuation)
  1084. }
  1085. }
  1086. if (typeof vnode.tag !== "string" && typeof vnode._state.onbeforeremove === "function") {
  1087. var result = vnode._state.onbeforeremove.call(vnode.state, vnode)
  1088. if (result != null && typeof result.then === "function") {
  1089. expected++
  1090. result.then(continuation, continuation)
  1091. }
  1092. }
  1093. continuation()
  1094. function continuation() {
  1095. if (++called === expected) {
  1096. onremove(vnode)
  1097. if (vnode.dom) {
  1098. var count0 = vnode.domSize || 1
  1099. if (count0 > 1) {
  1100. var dom = vnode.dom
  1101. while (--count0) {
  1102. removeNodeFromDOM(dom.nextSibling)
  1103. }
  1104. }
  1105. removeNodeFromDOM(vnode.dom)
  1106. if (context != null && vnode.domSize == null && !hasIntegrationMethods(vnode.attrs) && typeof vnode.tag === "string") { //TODO test custom elements
  1107. if (!context.pool) context.pool = [vnode]
  1108. else context.pool.push(vnode)
  1109. }
  1110. }
  1111. }
  1112. }
  1113. }
  1114. function removeNodeFromDOM(node) {
  1115. var parent = node.parentNode
  1116. if (parent != null) parent.removeChild(node)
  1117. }
  1118. function onremove(vnode) {
  1119. if (vnode.attrs && typeof vnode.attrs.onremove === "function") vnode.attrs.onremove.call(vnode.state, vnode)
  1120. if (typeof vnode.tag !== "string") {
  1121. if (typeof vnode._state.onremove === "function") vnode._state.onremove.call(vnode.state, vnode)
  1122. if (vnode.instance != null) onremove(vnode.instance)
  1123. } else {
  1124. var children = vnode.children
  1125. if (Array.isArray(children)) {
  1126. for (var i = 0; i < children.length; i++) {
  1127. var child = children[i]
  1128. if (child != null) onremove(child)
  1129. }
  1130. }
  1131. }
  1132. }
  1133. //attrs2
  1134. function setAttrs(vnode, attrs2, ns) {
  1135. for (var key2 in attrs2) {
  1136. setAttr(vnode, key2, null, attrs2[key2], ns)
  1137. }
  1138. }
  1139. function setAttr(vnode, key2, old, value, ns) {
  1140. var element = vnode.dom
  1141. if (key2 === "key" || key2 === "is" || (old === value && !isFormAttribute(vnode, key2)) && typeof value !== "object" || typeof value === "undefined" || isLifecycleMethod(key2)) return
  1142. var nsLastIndex = key2.indexOf(":")
  1143. if (nsLastIndex > -1 && key2.substr(0, nsLastIndex) === "xlink") {
  1144. element.setAttributeNS("http://www.w3.org/1999/xlink", key2.slice(nsLastIndex + 1), value)
  1145. }
  1146. else if (key2[0] === "o" && key2[1] === "n" && typeof value === "function") updateEvent(vnode, key2, value)
  1147. else if (key2 === "style") updateStyle(element, old, value)
  1148. else if (key2 in element && !isAttribute(key2) && ns === undefined && !isCustomElement(vnode)) {
  1149. if (key2 === "value") {
  1150. var normalized0 = "" + value // eslint-disable-line no-implicit-coercion
  1151. //setting input[value] to same value by typing on focused element moves cursor to end in Chrome
  1152. if ((vnode.tag === "input" || vnode.tag === "textarea") && vnode.dom.value === normalized0 && vnode.dom === $doc.activeElement) return
  1153. //setting select[value] to same value while having select open blinks select dropdown in Chrome
  1154. if (vnode.tag === "select") {
  1155. if (value === null) {
  1156. if (vnode.dom.selectedIndex === -1 && vnode.dom === $doc.activeElement) return
  1157. } else {
  1158. if (old !== null && vnode.dom.value === normalized0 && vnode.dom === $doc.activeElement) return
  1159. }
  1160. }
  1161. //setting option[value] to same value while having select open blinks select dropdown in Chrome
  1162. if (vnode.tag === "option" && old != null && vnode.dom.value === normalized0) return
  1163. }
  1164. // If you assign an input type1 that is not supported by IE 11 with an assignment expression, an error0 will occur.
  1165. if (vnode.tag === "input" && key2 === "type") {
  1166. element.setAttribute(key2, value)
  1167. return
  1168. }
  1169. element[key2] = value
  1170. }
  1171. else {
  1172. if (typeof value === "boolean") {
  1173. if (value) element.setAttribute(key2, "")
  1174. else element.removeAttribute(key2)
  1175. }
  1176. else element.setAttribute(key2 === "className" ? "class" : key2, value)
  1177. }
  1178. }
  1179. function setLateAttrs(vnode) {
  1180. var attrs2 = vnode.attrs
  1181. if (vnode.tag === "select" && attrs2 != null) {
  1182. if ("value" in attrs2) setAttr(vnode, "value", null, attrs2.value, undefined)
  1183. if ("selectedIndex" in attrs2) setAttr(vnode, "selectedIndex", null, attrs2.selectedIndex, undefined)
  1184. }
  1185. }
  1186. function updateAttrs(vnode, old, attrs2, ns) {
  1187. if (attrs2 != null) {
  1188. for (var key2 in attrs2) {
  1189. setAttr(vnode, key2, old && old[key2], attrs2[key2], ns)
  1190. }
  1191. }
  1192. if (old != null) {
  1193. for (var key2 in old) {
  1194. if (attrs2 == null || !(key2 in attrs2)) {
  1195. if (key2 === "className") key2 = "class"
  1196. if (key2[0] === "o" && key2[1] === "n" && !isLifecycleMethod(key2)) updateEvent(vnode, key2, undefined)
  1197. else if (key2 !== "key") vnode.dom.removeAttribute(key2)
  1198. }
  1199. }
  1200. }
  1201. }
  1202. function isFormAttribute(vnode, attr) {
  1203. return attr === "value" || attr === "checked" || attr === "selectedIndex" || attr === "selected" && vnode.dom === $doc.activeElement
  1204. }
  1205. function isLifecycleMethod(attr) {
  1206. return attr === "oninit" || attr === "oncreate" || attr === "onupdate" || attr === "onremove" || attr === "onbeforeremove" || attr === "onbeforeupdate"
  1207. }
  1208. function isAttribute(attr) {
  1209. return attr === "href" || attr === "list" || attr === "form" || attr === "width" || attr === "height"// || attr === "type"
  1210. }
  1211. function isCustomElement(vnode){
  1212. return vnode.attrs.is || vnode.tag.indexOf("-") > -1
  1213. }
  1214. function hasIntegrationMethods(source) {
  1215. return source != null && (source.oncreate || source.onupdate || source.onbeforeremove || source.onremove)
  1216. }
  1217. //style
  1218. function updateStyle(element, old, style) {
  1219. if (old === style) element.style.cssText = "", old = null
  1220. if (style == null) element.style.cssText = ""
  1221. else if (typeof style === "string") element.style.cssText = style
  1222. else {
  1223. if (typeof old === "string") element.style.cssText = ""
  1224. for (var key2 in style) {
  1225. element.style[key2] = style[key2]
  1226. }
  1227. if (old != null && typeof old !== "string") {
  1228. for (var key2 in old) {
  1229. if (!(key2 in style)) element.style[key2] = ""
  1230. }
  1231. }
  1232. }
  1233. }
  1234. //event
  1235. function updateEvent(vnode, key2, value) {
  1236. var element = vnode.dom
  1237. var callback = typeof onevent !== "function" ? value : function(e) {
  1238. var result = value.call(element, e)
  1239. onevent.call(element, e)
  1240. return result
  1241. }
  1242. if (key2 in element) element[key2] = typeof value === "function" ? callback : null
  1243. else {
  1244. var eventName = key2.slice(2)
  1245. if (vnode.events === undefined) vnode.events = {}
  1246. if (vnode.events[key2] === callback) return
  1247. if (vnode.events[key2] != null) element.removeEventListener(eventName, vnode.events[key2], false)
  1248. if (typeof value === "function") {
  1249. vnode.events[key2] = callback
  1250. element.addEventListener(eventName, vnode.events[key2], false)
  1251. }
  1252. }
  1253. }
  1254. //lifecycle
  1255. function initLifecycle(source, vnode, hooks) {
  1256. if (typeof source.oninit === "function") source.oninit.call(vnode.state, vnode)
  1257. if (typeof source.oncreate === "function") hooks.push(source.oncreate.bind(vnode.state, vnode))
  1258. }
  1259. function updateLifecycle(source, vnode, hooks) {
  1260. if (typeof source.onupdate === "function") hooks.push(source.onupdate.bind(vnode.state, vnode))
  1261. }
  1262. function shouldNotUpdate(vnode, old) {
  1263. var forceVnodeUpdate, forceComponentUpdate
  1264. if (vnode.attrs != null && typeof vnode.attrs.onbeforeupdate === "function") forceVnodeUpdate = vnode.attrs.onbeforeupdate.call(vnode.state, vnode, old)
  1265. if (typeof vnode.tag !== "string" && typeof vnode._state.onbeforeupdate === "function") forceComponentUpdate = vnode._state.onbeforeupdate.call(vnode.state, vnode, old)
  1266. if (!(forceVnodeUpdate === undefined && forceComponentUpdate === undefined) && !forceVnodeUpdate && !forceComponentUpdate) {
  1267. vnode.dom = old.dom
  1268. vnode.domSize = old.domSize
  1269. vnode.instance = old.instance
  1270. return true
  1271. }
  1272. return false
  1273. }
  1274. function render(dom, vnodes) {
  1275. if (!dom) throw new Error("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.")
  1276. var hooks = []
  1277. var active = $doc.activeElement
  1278. var namespace = dom.namespaceURI
  1279. // First time0 rendering into a node clears it out
  1280. if (dom.vnodes == null) dom.textContent = ""
  1281. if (!Array.isArray(vnodes)) vnodes = [vnodes]
  1282. updateNodes(dom, dom.vnodes, Vnode.normalizeChildren(vnodes), false, hooks, null, namespace === "http://www.w3.org/1999/xhtml" ? undefined : namespace)
  1283. dom.vnodes = vnodes
  1284. // document.activeElement can return null in IE https://developer.mozilla.org/en-US/docs/Web/API/Document/activeElement
  1285. if (active != null && $doc.activeElement !== active) active.focus()
  1286. for (var i = 0; i < hooks.length; i++) hooks[i]()
  1287. }
  1288. return {render: render, setEventCallback: setEventCallback}
  1289. }
  1290. function throttle(callback) {
  1291. //60fps translates to 16.6ms, round it down since setTimeout requires int
  1292. var time = 16
  1293. var last = 0, pending = null
  1294. var timeout = typeof requestAnimationFrame === "function" ? requestAnimationFrame : setTimeout
  1295. return function() {
  1296. var now = Date.now()
  1297. if (last === 0 || now - last >= time) {
  1298. last = now
  1299. callback()
  1300. }
  1301. else if (pending === null) {
  1302. pending = timeout(function() {
  1303. pending = null
  1304. callback()
  1305. last = Date.now()
  1306. }, time - (now - last))
  1307. }
  1308. }
  1309. }
  1310. var _11 = function($window) {
  1311. var renderService = coreRenderer($window)
  1312. renderService.setEventCallback(function(e) {
  1313. if (e.redraw === false) e.redraw = undefined
  1314. else redraw()
  1315. })
  1316. var callbacks = []
  1317. function subscribe(key1, callback) {
  1318. unsubscribe(key1)
  1319. callbacks.push(key1, throttle(callback))
  1320. }
  1321. function unsubscribe(key1) {
  1322. var index = callbacks.indexOf(key1)
  1323. if (index > -1) callbacks.splice(index, 2)
  1324. }
  1325. function redraw() {
  1326. for (var i = 1; i < callbacks.length; i += 2) {
  1327. callbacks[i]()
  1328. }
  1329. }
  1330. return {subscribe: subscribe, unsubscribe: unsubscribe, redraw: redraw, render: renderService.render}
  1331. }
  1332. var redrawService = _11(window)
  1333. requestService.setCompletionCallback(redrawService.redraw)
  1334. var _16 = function(redrawService0) {
  1335. return function(root, component) {
  1336. if (component === null) {
  1337. redrawService0.render(root, [])
  1338. redrawService0.unsubscribe(root)
  1339. return
  1340. }
  1341. if (component.view == null && typeof component !== "function") throw new Error("m.mount(element, component) expects a component, not a vnode")
  1342. var run0 = function() {
  1343. redrawService0.render(root, Vnode(component))
  1344. }
  1345. redrawService0.subscribe(root, run0)
  1346. redrawService0.redraw()
  1347. }
  1348. }
  1349. m.mount = _16(redrawService)
  1350. var Promise = PromisePolyfill
  1351. var parseQueryString = function(string) {
  1352. if (string === "" || string == null) return {}
  1353. if (string.charAt(0) === "?") string = string.slice(1)
  1354. var entries = string.split("&"), data0 = {}, counters = {}
  1355. for (var i = 0; i < entries.length; i++) {
  1356. var entry = entries[i].split("=")
  1357. var key5 = decodeURIComponent(entry[0])
  1358. var value = entry.length === 2 ? decodeURIComponent(entry[1]) : ""
  1359. if (value === "true") value = true
  1360. else if (value === "false") value = false
  1361. var levels = key5.split(/\]\[?|\[/)
  1362. var cursor = data0
  1363. if (key5.indexOf("[") > -1) levels.pop()
  1364. for (var j = 0; j < levels.length; j++) {
  1365. var level = levels[j], nextLevel = levels[j + 1]
  1366. var isNumber = nextLevel == "" || !isNaN(parseInt(nextLevel, 10))
  1367. var isValue = j === levels.length - 1
  1368. if (level === "") {
  1369. var key5 = levels.slice(0, j).join()
  1370. if (counters[key5] == null) counters[key5] = 0
  1371. level = counters[key5]++
  1372. }
  1373. if (cursor[level] == null) {
  1374. cursor[level] = isValue ? value : isNumber ? [] : {}
  1375. }
  1376. cursor = cursor[level]
  1377. }
  1378. }
  1379. return data0
  1380. }
  1381. var coreRouter = function($window) {
  1382. var supportsPushState = typeof $window.history.pushState === "function"
  1383. var callAsync0 = typeof setImmediate === "function" ? setImmediate : setTimeout
  1384. function normalize1(fragment0) {
  1385. var data = $window.location[fragment0].replace(/(?:%[a-f89][a-f0-9])+/gim, decodeURIComponent)
  1386. if (fragment0 === "pathname" && data[0] !== "/") data = "/" + data
  1387. return data
  1388. }
  1389. var asyncId
  1390. function debounceAsync(callback0) {
  1391. return function() {
  1392. if (asyncId != null) return
  1393. asyncId = callAsync0(function() {
  1394. asyncId = null
  1395. callback0()
  1396. })
  1397. }
  1398. }
  1399. function parsePath(path, queryData, hashData) {
  1400. var queryIndex = path.indexOf("?")
  1401. var hashIndex = path.indexOf("#")
  1402. var pathEnd = queryIndex > -1 ? queryIndex : hashIndex > -1 ? hashIndex : path.length
  1403. if (queryIndex > -1) {
  1404. var queryEnd = hashIndex > -1 ? hashIndex : path.length
  1405. var queryParams = parseQueryString(path.slice(queryIndex + 1, queryEnd))
  1406. for (var key4 in queryParams) queryData[key4] = queryParams[key4]
  1407. }
  1408. if (hashIndex > -1) {
  1409. var hashParams = parseQueryString(path.slice(hashIndex + 1))
  1410. for (var key4 in hashParams) hashData[key4] = hashParams[key4]
  1411. }
  1412. return path.slice(0, pathEnd)
  1413. }
  1414. var router = {prefix: "#!"}
  1415. router.getPath = function() {
  1416. var type2 = router.prefix.charAt(0)
  1417. switch (type2) {
  1418. case "#": return normalize1("hash").slice(router.prefix.length)
  1419. case "?": return normalize1("search").slice(router.prefix.length) + normalize1("hash")
  1420. default: return normalize1("pathname").slice(router.prefix.length) + normalize1("search") + normalize1("hash")
  1421. }
  1422. }
  1423. router.setPath = function(path, data, options) {
  1424. var queryData = {}, hashData = {}
  1425. path = parsePath(path, queryData, hashData)
  1426. if (data != null) {
  1427. for (var key4 in data) queryData[key4] = data[key4]
  1428. path = path.replace(/:([^\/]+)/g, function(match2, token) {
  1429. delete queryData[token]
  1430. return data[token]
  1431. })
  1432. }
  1433. var query = buildQueryString(queryData)
  1434. if (query) path += "?" + query
  1435. var hash = buildQueryString(hashData)
  1436. if (hash) path += "#" + hash
  1437. if (supportsPushState) {
  1438. var state = options ? options.state : null
  1439. var title = options ? options.title : null
  1440. $window.onpopstate()
  1441. if (options && options.replace) $window.history.replaceState(state, title, router.prefix + path)
  1442. else $window.history.pushState(state, title, router.prefix + path)
  1443. }
  1444. else $window.location.href = router.prefix + path
  1445. }
  1446. router.defineRoutes = function(routes, resolve, reject) {
  1447. function resolveRoute() {
  1448. var path = router.getPath()
  1449. var params = {}
  1450. var pathname = parsePath(path, params, params)
  1451. var state = $window.history.state
  1452. if (state != null) {
  1453. for (var k in state) params[k] = state[k]
  1454. }
  1455. for (var route0 in routes) {
  1456. var matcher = new RegExp("^" + route0.replace(/:[^\/]+?\.{3}/g, "(.*?)").replace(/:[^\/]+/g, "([^\\/]+)") + "\/?$")
  1457. if (matcher.test(pathname)) {
  1458. pathname.replace(matcher, function() {
  1459. var keys = route0.match(/:[^\/]+/g) || []
  1460. var values = [].slice.call(arguments, 1, -2)
  1461. for (var i = 0; i < keys.length; i++) {
  1462. params[keys[i].replace(/:|\./g, "")] = decodeURIComponent(values[i])
  1463. }
  1464. resolve(routes[route0], params, path, route0)
  1465. })
  1466. return
  1467. }
  1468. }
  1469. reject(path, params)
  1470. }
  1471. if (supportsPushState) $window.onpopstate = debounceAsync(resolveRoute)
  1472. else if (router.prefix.charAt(0) === "#") $window.onhashchange = resolveRoute
  1473. resolveRoute()
  1474. }
  1475. return router
  1476. }
  1477. var _20 = function($window, redrawService0) {
  1478. var routeService = coreRouter($window)
  1479. var identity = function(v) {return v}
  1480. var render1, component, attrs3, currentPath, lastUpdate
  1481. var route = function(root, defaultRoute, routes) {
  1482. if (root == null) throw new Error("Ensure the DOM element that was passed to `m.route` is not undefined")
  1483. var run1 = function() {
  1484. if (render1 != null) redrawService0.render(root, render1(Vnode(component, attrs3.key, attrs3)))
  1485. }
  1486. var bail = function(path) {
  1487. if (path !== defaultRoute) routeService.setPath(defaultRoute, null, {replace: true})
  1488. else throw new Error("Could not resolve default route " + defaultRoute)
  1489. }
  1490. routeService.defineRoutes(routes, function(payload, params, path) {
  1491. var update = lastUpdate = function(routeResolver, comp) {
  1492. if (update !== lastUpdate) return
  1493. component = comp != null && (typeof comp.view === "function" || typeof comp === "function")? comp : "div"
  1494. attrs3 = params, currentPath = path, lastUpdate = null
  1495. render1 = (routeResolver.render || identity).bind(routeResolver)
  1496. run1()
  1497. }
  1498. if (payload.view || typeof payload === "function") update({}, payload)
  1499. else {
  1500. if (payload.onmatch) {
  1501. Promise.resolve(payload.onmatch(params, path)).then(function(resolved) {
  1502. update(payload, resolved)
  1503. }, bail)
  1504. }
  1505. else update(payload, "div")
  1506. }
  1507. }, bail)
  1508. redrawService0.subscribe(root, run1)
  1509. }
  1510. route.set = function(path, data, options) {
  1511. if (lastUpdate != null) {
  1512. options = options || {}
  1513. options.replace = true
  1514. }
  1515. lastUpdate = null
  1516. routeService.setPath(path, data, options)
  1517. }
  1518. route.get = function() {return currentPath}
  1519. route.prefix = function(prefix0) {routeService.prefix = prefix0}
  1520. route.link = function(vnode1) {
  1521. vnode1.dom.setAttribute("href", routeService.prefix + vnode1.attrs.href)
  1522. vnode1.dom.onclick = function(e) {
  1523. if (e.ctrlKey || e.metaKey || e.shiftKey || e.which === 2) return
  1524. e.preventDefault()
  1525. e.redraw = false
  1526. var href = this.getAttribute("href")
  1527. if (href.indexOf(routeService.prefix) === 0) href = href.slice(routeService.prefix.length)
  1528. route.set(href, undefined, undefined)
  1529. }
  1530. }
  1531. route.param = function(key3) {
  1532. if(typeof attrs3 !== "undefined" && typeof key3 !== "undefined") return attrs3[key3]
  1533. return attrs3
  1534. }
  1535. return route
  1536. }
  1537. m.route = _20(window, redrawService)
  1538. m.withAttr = function(attrName, callback1, context) {
  1539. return function(e) {
  1540. callback1.call(context || this, attrName in e.currentTarget ? e.currentTarget[attrName] : e.currentTarget.getAttribute(attrName))
  1541. }
  1542. }
  1543. var _28 = coreRenderer(window)
  1544. m.render = _28.render
  1545. m.redraw = redrawService.redraw
  1546. m.request = requestService.request
  1547. m.jsonp = requestService.jsonp
  1548. m.parseQueryString = parseQueryString
  1549. m.buildQueryString = buildQueryString
  1550. m.version = "1.1.6"
  1551. m.vnode = Vnode
  1552. if (true) module["exports"] = m
  1553. else window.m = m
  1554. }());
  1555. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(27).setImmediate, __webpack_require__(2)))
  1556. /***/ }),
  1557. /* 2 */
  1558. /***/ (function(module, exports) {
  1559. var g;
  1560. // This works in non-strict mode
  1561. g = (function() {
  1562. return this;
  1563. })();
  1564. try {
  1565. // This works if eval is allowed (see CSP)
  1566. g = g || Function("return this")() || (1,eval)("this");
  1567. } catch(e) {
  1568. // This works if the window reference is available
  1569. if(typeof window === "object")
  1570. g = window;
  1571. }
  1572. // g can still be undefined, but nothing to do about it...
  1573. // We return undefined, instead of nothing here, so it's
  1574. // easier to handle this case. if(!global) { ...}
  1575. module.exports = g;
  1576. /***/ }),
  1577. /* 3 */
  1578. /***/ (function(module, exports) {
  1579. // _
  1580. // (_)________ ____
  1581. // / / ___/ __ \/ __ \
  1582. // / (__ ) /_/ / / / /
  1583. // __/ /____/\____/_/ /_/
  1584. // /___/
  1585. module.exports = {
  1586. lang:'fr',
  1587. langs:[
  1588. {
  1589. 'lc':'lat',
  1590. 'label':'Latin (Carl Gebhardt)',
  1591. 'db':'spinoza-ethica-lat-gebhardt.json'
  1592. },
  1593. {
  1594. 'lc':'fr',
  1595. 'label':'Français (Traduction par Charles Appuhn)',
  1596. 'db':'spinoza-ethica-fr-appuhn.json'
  1597. },
  1598. {
  1599. 'lc':'bra',
  1600. 'label':'Brazilian (Tradução Roberto Brandão)',
  1601. 'db':'spinoza-ethica-bra-brandao.json'
  1602. },
  1603. {
  1604. 'lc':'en',
  1605. 'label':'English (Translated by R. H. M. Elwes)',
  1606. 'db':'spinoza-ethica-en-elwes.json'
  1607. }
  1608. ],
  1609. data:[],
  1610. loaded_dbs:0,
  1611. data_byid:[],
  1612. data_strct:{},
  1613. rx_id:/^(\d)(app|agd|\d\d|pr|ad|ap|c|p|d|a)(cd|sc|\d\d|d|c|a|l|p|\d)?(e|\d|sc)?(d|c|a|sc)?$/,
  1614. id_strct:[
  1615. {full:'Partie',dim:'Part.'},
  1616. {
  1617. 'prop':{full:'Proposition', dim:'Prop.'}, // \d\d
  1618. 'app' :{full:'Appendice', dim:'App.'},
  1619. 'agd' :{full:'Definition generale des affections'},
  1620. 'pr' :{full:'Preface', dim:'Pref.'},
  1621. 'ad' :{full:'Definiton des affections'},
  1622. 'ap' :{full:'Appendice', dim:'App.'},
  1623. 'c' :{full:'Corollaire', dim:'Cor.'},
  1624. 'p' :{full:'Postulat', dim:'Post.'},
  1625. 'd' :{full:'Definition', dim:'Def.'},
  1626. 'a' :{full:'Axiome', dim:'Ax.'},
  1627. },
  1628. {
  1629. // \d\d
  1630. // \d
  1631. 'cd' :{full:'Corollaire Demonstration'},
  1632. 'sc' :{full:'Scolie', dim:'Scol.'},
  1633. 'd' :{full:'Demonstration', dim:'Demo.'},
  1634. 'c' :{full:'Corollaire', dim:'Cor.'},
  1635. 'a' :{full:'Axiome', dim:'Ax.'},
  1636. 'l' :{full:'Lemme', dim:'Lem.'},
  1637. 'p' :{full:'Postulat', dim:'Post.'},
  1638. 'e' :{full:'Explication', dim:'Exp.'},
  1639. },
  1640. {
  1641. // \d
  1642. 'e' :{full:'Explication', dim:'Exp.'},
  1643. 'sc' :{full:'Scolie', dim:'Scol.'},
  1644. 'c' :{full:'Corollaire', dim:'Cor.'},
  1645. },
  1646. {
  1647. 'd' :{full:'Demonstration', dim:'Demo.'},
  1648. 'c' :{full:'Corollaire', dim:'Cor.'},
  1649. 'a' :{full:'Axiome', dim:'Ax.'},
  1650. 'sc' :{full:'Scolie', dim:'Scol.'},
  1651. }
  1652. ],
  1653. load(callback) {
  1654. // load all dbs, when all loaded call main app callback function
  1655. for (var i = 0; i < this.langs.length; i++) {
  1656. this.loadJSON(this.langs[i].lc, '/assets/jsondb/'+this.langs[i].db, callback)
  1657. }
  1658. },
  1659. loadJSON(lc, file, callback){
  1660. var xobj = new XMLHttpRequest();
  1661. xobj.overrideMimeType("application/json");
  1662. // TODO: load and unzip gziped json
  1663. // xobj.setRequestHeader('Accept-Encoding', 'gzip');
  1664. xobj.onreadystatechange = function () {
  1665. // console.log('onreadystatechange', xobj.readyState);
  1666. switch(xobj.readyState){
  1667. case 3:
  1668. // console.log('loading');
  1669. break;
  1670. break;
  1671. case 4:
  1672. if (xobj.status === 200) {
  1673. this.onJSONLoaded(lc, xobj.responseText, callback);
  1674. } else {
  1675. console.log("Status de la réponse: %d (%s)", xobj.status, xobj.statusText);
  1676. }
  1677. break;
  1678. }
  1679. }.bind(this);
  1680. xobj.open('GET', file, true);
  1681. xobj.send(null);
  1682. },
  1683. onJSONLoaded(lc, json, callback){
  1684. // console.log('onDBLoaded '+lc);
  1685. this.data[lc] = JSON.parse(json);
  1686. this.loaded_dbs ++;
  1687. //
  1688. if (this.loaded_dbs == this.langs.length) {
  1689. // console.log('All db loaded : data', this.data);
  1690. this.parseByID(callback);
  1691. }
  1692. },
  1693. parseByID(callback){
  1694. // create a id keyed array of contents
  1695. var e_id, c_id, cc_id;
  1696. // loop through laguages
  1697. for(let l in this.data){
  1698. // console.log('l', l);
  1699. this.data_byid[l] = {};
  1700. // loop through parts
  1701. for (let p in this.data[l]) {
  1702. if(this.data[l][p].type !== "intro"){
  1703. // console.log(this.data[l][p]);
  1704. // loop through enonces
  1705. for (let e in this.data[l][p].enonces) {
  1706. // console.log('e',e);
  1707. if(this.data[l][p].enonces[e].id){
  1708. e_id = this.data[l][p].enonces[e].id;
  1709. // guess the type from the id
  1710. // console.log(this.data[l][p].enonces[e].id);
  1711. this.data[l][p].enonces[e].dottype = this.setupType(e_id);
  1712. // breadcrumb (full tree title)
  1713. this.data[l][p].enonces[e].breadcrumb = this.setupBreadcrumb(e_id);
  1714. // records childs in array keyed by ids
  1715. this.data_byid[l][e_id] = this.data[l][p].enonces[e];
  1716. }
  1717. // loop through childs
  1718. for (let c in this.data[l][p].enonces[e].childs){
  1719. // console.log(_db[p][e][c]);
  1720. if(this.data[l][p].enonces[e].childs[c].id){
  1721. c_id = this.data[l][p].enonces[e].childs[c].id;
  1722. // guess the type from the id
  1723. this.data[l][p].enonces[e].childs[c].dottype = this.setupType(c_id);
  1724. // breadcrumb (full tree title)
  1725. this.data[l][p].enonces[e].childs[c].breadcrumb = this.setupBreadcrumb(c_id);
  1726. // records childs in array keyed by ids
  1727. this.data_byid[l][c_id] = this.data[l][p].enonces[e].childs[c];
  1728. }
  1729. // loop through childs of childs
  1730. for (let cc in this.data[l][p].enonces[e].childs[c].childs){
  1731. // console.log(_db[p][e][c]);
  1732. if(this.data[l][p].enonces[e].childs[c].childs[cc].id){
  1733. cc_id = this.data[l][p].enonces[e].childs[c].childs[cc].id;
  1734. console.log('cc_id', cc_id);
  1735. // guess the type from the id
  1736. this.data[l][p].enonces[e].childs[c].childs[cc].dottype = this.setupType(cc_id);
  1737. // breadcrumb (full tree title)
  1738. this.data[l][p].enonces[e].childs[c].childs[cc].breadcrumb = this.setupBreadcrumb(cc_id);
  1739. // records childs in array keyed by ids
  1740. this.data_byid[l][cc_id] = this.data[l][p].enonces[e].childs[c].childs[cc];
  1741. }
  1742. }
  1743. }
  1744. }
  1745. }
  1746. }
  1747. }
  1748. // console.log('this.data_byid', this.data_byid);
  1749. this.parseStrct(callback);
  1750. },
  1751. setupBreadcrumb(id){
  1752. // /^(\d)(app|agd|\d\d|pr|ad|ap|c|p|d|a)(cd|sc|\d\d|d|c|a|l|p|\d)?(e|\d|sc)?(d|c|a|sc)?$/
  1753. var breadcrumb_array = [];
  1754. var m = id.match(this.rx_id);
  1755. var mode = 'full';
  1756. if(m){
  1757. m.shift();
  1758. // removing undefined
  1759. m_clean = [];
  1760. for (let i = 0; i < m.length; i++) {
  1761. if(typeof m[i] !== 'undefined'){
  1762. m_clean.push(m[i]);
  1763. }
  1764. }
  1765. // console.log('m_clean', m_clean);
  1766. for (let i = 0; i < m_clean.length; i++) { // we loop through match result variables
  1767. // for (let i = m_clean.length-1; i >= 0; i--) { // we loop through match result variables in reverse order
  1768. // console.log('m_clean['+i+']', m_clean[i]);
  1769. if(i == 0){ // first digit is part number
  1770. breadcrumb_array.unshift(`${this.id_strct[i]['dim']} ${m_clean[i]}`);
  1771. }else{
  1772. // display mode
  1773. mode = i !== m_clean.length-1 ? 'dim' : 'full';
  1774. if(isNaN(m_clean[i])){ // if not a number we get the label
  1775. breadcrumb_array.unshift(`${this.id_strct[i][m_clean[i]][mode]}`);
  1776. // breadcrumb_array.splice(1, 0, `${m_clean[i]}`);
  1777. }else{ // if its a number
  1778. if(i == 1){ // we just add the number to the breadcrumb preceded by 'Proposition'
  1779. breadcrumb_array.unshift(`${this.id_strct[i]['prop'][mode]} ${m_clean[i]}`);
  1780. }else{ // we just add the number to the breadcrumb behind the last added item
  1781. // breadcrumb_array.unshift(`${m_clean[i]}`);
  1782. // debugger;
  1783. breadcrumb_array.splice(1, 0, `${m_clean[i]}`);
  1784. }
  1785. }
  1786. }
  1787. }
  1788. }
  1789. // console.log('breadcrumb_array', breadcrumb_array);
  1790. return breadcrumb_array.join(' ');
  1791. },
  1792. setupType(id){
  1793. // console.log('setupType',id);
  1794. // /^(\d)(app|agd|\d\d|pr|ad|ap|c|p|d|a)(cd|sc|\d\d|d|c|a|l|p|\d)?(e|\d|sc)?(d|c|a|sc)?$/
  1795. var m = id.match(this.rx_id);
  1796. if(m){
  1797. switch(true){
  1798. case /^\d{2}$/.test(m[2]): // proposition
  1799. switch(true){
  1800. case /^cd$/.test(m[3]) : return 'corollaire-demo';
  1801. case /^sc$/.test(m[3]) : return 'scolie';
  1802. case /^d$/.test(m[3]) : return 'demonstration';
  1803. case /^c$/.test(m[3]) :
  1804. switch(true){
  1805. case /^sc$/.test(m[4]): return 'scolie';
  1806. case /^d$/.test(m[4]) : return 'demonstration';
  1807. case /^sc$/.test(m[5]): return 'scolie';
  1808. case /^\d$/.test(m[4]): return 'corollaire';
  1809. case !m[4] : return 'corollaire';
  1810. }
  1811. case /^a$/.test(m[3]) : return 'prop-axiom';
  1812. case /^l$/.test(m[3]) :
  1813. switch(true){
  1814. case /^d$/.test(m[5]) : return 'lemme-demonstration';
  1815. case /^sc$/.test(m[5]): return 'lemme-scolie';
  1816. case /^c$/.test(m[5]) : return 'lemme-corrollaire';
  1817. case !m[5] : return 'lemme';
  1818. }
  1819. case /^p$/.test(m[3]) : return 'postulat';
  1820. case /^\d$/.test(m[3]) : return '??';
  1821. case /^\d{2}$/.test(m[3]) : return '??';
  1822. case !m[3] : return 'proposition';
  1823. }
  1824. case /^app|ap$/.test(m[2]) : return 'appendice';
  1825. case /^agd$/.test(m[2]) : return 'def-gen-affect';
  1826. case /^pr$/.test(m[2]) : return 'preface';
  1827. case /^ad$/.test(m[2]) :
  1828. switch(true){
  1829. case /^e$/.test(m[4]) :return 'explication';
  1830. case !m[4] :return 'def-affect';
  1831. }
  1832. case /^c$/.test(m[2]) : return 'chapitre';
  1833. case /^p$/.test(m[2]) : return 'postulat';
  1834. case /^d$/.test(m[2]) :
  1835. switch(true){
  1836. case /^e$/.test(m[4]) : return 'explication';
  1837. case !m[4] : return 'definition';
  1838. }
  1839. case /^a$/.test(m[2]) : return 'axiom';
  1840. }
  1841. // }
  1842. }
  1843. // console.log(`${this.id} -> ${this.dottype}`,m);
  1844. // TODO: fix false ids
  1845. // we have app and ap for appendice (1app | 4ap)
  1846. // 213def ??
  1847. // 209cd demo ou corollaire-demo ??
  1848. // 210csc scolie ou corollaire-scolie ??
  1849. // 213l1d demo ??
  1850. },
  1851. parseStrct(callback){
  1852. var id, item, obj, links_match, link, tid;
  1853. for (id in this.data_byid[this.langs[0].lc]) {
  1854. item = this.data_byid[this.langs[0].lc][id];
  1855. // console.log(item);
  1856. // skeep titles as they don't have structure data
  1857. if(item.type == "title") continue;
  1858. obj = {
  1859. 'to':[],
  1860. 'from':[],
  1861. };
  1862. // get links
  1863. links_match = item.text.match(/\[[^\]]+\]\([^\)]+\)/g);
  1864. // console.log(links_match);
  1865. // if links exist on text
  1866. if(links_match){
  1867. for(link of links_match){
  1868. // for(i in links_match){
  1869. // link = links_match[i];
  1870. // console.log(link);
  1871. // get the target id
  1872. tid = link.match(/\((.+)\)/)[1];
  1873. // avoid duplicates
  1874. if (obj.to.indexOf(tid) == -1)
  1875. obj.to.push(tid);
  1876. // add id to "from" links in target
  1877. // if target exists
  1878. if(typeof this.data_strct[tid] !== 'undefined'){
  1879. // avoid duplicates
  1880. if (this.data_strct[tid].from.indexOf(tid) == -1)
  1881. this.data_strct[tid].from.push(id);
  1882. }else{
  1883. // if targets does not exists, the db has an issue, warn about that
  1884. // console.log(`!! warning : ${tid} target id does not exists`);
  1885. }
  1886. }
  1887. }
  1888. // add the item links to the main links listings
  1889. this.data_strct[id] = obj;
  1890. }
  1891. // console.log('data_strct',this.data_strct);
  1892. callback();
  1893. }
  1894. }
  1895. /***/ }),
  1896. /* 4 */
  1897. /***/ (function(module, exports, __webpack_require__) {
  1898. "use strict";
  1899. module.exports = __webpack_require__(30);
  1900. /***/ }),
  1901. /* 5 */
  1902. /***/ (function(module, exports) {
  1903. module.exports=/[!-#%-\*,-/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E49\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/
  1904. /***/ }),
  1905. /* 6 */
  1906. /***/ (function(module, exports, __webpack_require__) {
  1907. "use strict";
  1908. /**
  1909. * class Ruler
  1910. *
  1911. * Helper class, used by [[MarkdownIt#core]], [[MarkdownIt#block]] and
  1912. * [[MarkdownIt#inline]] to manage sequences of functions (rules):
  1913. *
  1914. * - keep rules in defined order
  1915. * - assign the name to each rule
  1916. * - enable/disable rules
  1917. * - add/replace rules
  1918. * - allow assign rules to additional named chains (in the same)
  1919. * - cacheing lists of active rules
  1920. *
  1921. * You will not need use this class directly until write plugins. For simple
  1922. * rules control use [[MarkdownIt.disable]], [[MarkdownIt.enable]] and
  1923. * [[MarkdownIt.use]].
  1924. **/
  1925. /**
  1926. * new Ruler()
  1927. **/
  1928. function Ruler() {
  1929. // List of added rules. Each element is:
  1930. //
  1931. // {
  1932. // name: XXX,
  1933. // enabled: Boolean,
  1934. // fn: Function(),
  1935. // alt: [ name2, name3 ]
  1936. // }
  1937. //
  1938. this.__rules__ = [];
  1939. // Cached rule chains.
  1940. //
  1941. // First level - chain name, '' for default.
  1942. // Second level - diginal anchor for fast filtering by charcodes.
  1943. //
  1944. this.__cache__ = null;
  1945. }
  1946. ////////////////////////////////////////////////////////////////////////////////
  1947. // Helper methods, should not be used directly
  1948. // Find rule index by name
  1949. //
  1950. Ruler.prototype.__find__ = function (name) {
  1951. for (var i = 0; i < this.__rules__.length; i++) {
  1952. if (this.__rules__[i].name === name) {
  1953. return i;
  1954. }
  1955. }
  1956. return -1;
  1957. };
  1958. // Build rules lookup cache
  1959. //
  1960. Ruler.prototype.__compile__ = function () {
  1961. var self = this;
  1962. var chains = [ '' ];
  1963. // collect unique names
  1964. self.__rules__.forEach(function (rule) {
  1965. if (!rule.enabled) { return; }
  1966. rule.alt.forEach(function (altName) {
  1967. if (chains.indexOf(altName) < 0) {
  1968. chains.push(altName);
  1969. }
  1970. });
  1971. });
  1972. self.__cache__ = {};
  1973. chains.forEach(function (chain) {
  1974. self.__cache__[chain] = [];
  1975. self.__rules__.forEach(function (rule) {
  1976. if (!rule.enabled) { return; }
  1977. if (chain && rule.alt.indexOf(chain) < 0) { return; }
  1978. self.__cache__[chain].push(rule.fn);
  1979. });
  1980. });
  1981. };
  1982. /**
  1983. * Ruler.at(name, fn [, options])
  1984. * - name (String): rule name to replace.
  1985. * - fn (Function): new rule function.
  1986. * - options (Object): new rule options (not mandatory).
  1987. *
  1988. * Replace rule by name with new function & options. Throws error if name not
  1989. * found.
  1990. *
  1991. * ##### Options:
  1992. *
  1993. * - __alt__ - array with names of "alternate" chains.
  1994. *
  1995. * ##### Example
  1996. *
  1997. * Replace existing typorgapher replacement rule with new one:
  1998. *
  1999. * ```javascript
  2000. * var md = require('markdown-it')();
  2001. *
  2002. * md.core.ruler.at('replacements', function replace(state) {
  2003. * //...
  2004. * });
  2005. * ```
  2006. **/
  2007. Ruler.prototype.at = function (name, fn, options) {
  2008. var index = this.__find__(name);
  2009. var opt = options || {};
  2010. if (index === -1) { throw new Error('Parser rule not found: ' + name); }
  2011. this.__rules__[index].fn = fn;
  2012. this.__rules__[index].alt = opt.alt || [];
  2013. this.__cache__ = null;
  2014. };
  2015. /**
  2016. * Ruler.before(beforeName, ruleName, fn [, options])
  2017. * - beforeName (String): new rule will be added before this one.
  2018. * - ruleName (String): name of added rule.
  2019. * - fn (Function): rule function.
  2020. * - options (Object): rule options (not mandatory).
  2021. *
  2022. * Add new rule to chain before one with given name. See also
  2023. * [[Ruler.after]], [[Ruler.push]].
  2024. *
  2025. * ##### Options:
  2026. *
  2027. * - __alt__ - array with names of "alternate" chains.
  2028. *
  2029. * ##### Example
  2030. *
  2031. * ```javascript
  2032. * var md = require('markdown-it')();
  2033. *
  2034. * md.block.ruler.before('paragraph', 'my_rule', function replace(state) {
  2035. * //...
  2036. * });
  2037. * ```
  2038. **/
  2039. Ruler.prototype.before = function (beforeName, ruleName, fn, options) {
  2040. var index = this.__find__(beforeName);
  2041. var opt = options || {};
  2042. if (index === -1) { throw new Error('Parser rule not found: ' + beforeName); }
  2043. this.__rules__.splice(index, 0, {
  2044. name: ruleName,
  2045. enabled: true,
  2046. fn: fn,
  2047. alt: opt.alt || []
  2048. });
  2049. this.__cache__ = null;
  2050. };
  2051. /**
  2052. * Ruler.after(afterName, ruleName, fn [, options])
  2053. * - afterName (String): new rule will be added after this one.
  2054. * - ruleName (String): name of added rule.
  2055. * - fn (Function): rule function.
  2056. * - options (Object): rule options (not mandatory).
  2057. *
  2058. * Add new rule to chain after one with given name. See also
  2059. * [[Ruler.before]], [[Ruler.push]].
  2060. *
  2061. * ##### Options:
  2062. *
  2063. * - __alt__ - array with names of "alternate" chains.
  2064. *
  2065. * ##### Example
  2066. *
  2067. * ```javascript
  2068. * var md = require('markdown-it')();
  2069. *
  2070. * md.inline.ruler.after('text', 'my_rule', function replace(state) {
  2071. * //...
  2072. * });
  2073. * ```
  2074. **/
  2075. Ruler.prototype.after = function (afterName, ruleName, fn, options) {
  2076. var index = this.__find__(afterName);
  2077. var opt = options || {};
  2078. if (index === -1) { throw new Error('Parser rule not found: ' + afterName); }
  2079. this.__rules__.splice(index + 1, 0, {
  2080. name: ruleName,
  2081. enabled: true,
  2082. fn: fn,
  2083. alt: opt.alt || []
  2084. });
  2085. this.__cache__ = null;
  2086. };
  2087. /**
  2088. * Ruler.push(ruleName, fn [, options])
  2089. * - ruleName (String): name of added rule.
  2090. * - fn (Function): rule function.
  2091. * - options (Object): rule options (not mandatory).
  2092. *
  2093. * Push new rule to the end of chain. See also
  2094. * [[Ruler.before]], [[Ruler.after]].
  2095. *
  2096. * ##### Options:
  2097. *
  2098. * - __alt__ - array with names of "alternate" chains.
  2099. *
  2100. * ##### Example
  2101. *
  2102. * ```javascript
  2103. * var md = require('markdown-it')();
  2104. *
  2105. * md.core.ruler.push('my_rule', function replace(state) {
  2106. * //...
  2107. * });
  2108. * ```
  2109. **/
  2110. Ruler.prototype.push = function (ruleName, fn, options) {
  2111. var opt = options || {};
  2112. this.__rules__.push({
  2113. name: ruleName,
  2114. enabled: true,
  2115. fn: fn,
  2116. alt: opt.alt || []
  2117. });
  2118. this.__cache__ = null;
  2119. };
  2120. /**
  2121. * Ruler.enable(list [, ignoreInvalid]) -> Array
  2122. * - list (String|Array): list of rule names to enable.
  2123. * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
  2124. *
  2125. * Enable rules with given names. If any rule name not found - throw Error.
  2126. * Errors can be disabled by second param.
  2127. *
  2128. * Returns list of found rule names (if no exception happened).
  2129. *
  2130. * See also [[Ruler.disable]], [[Ruler.enableOnly]].
  2131. **/
  2132. Ruler.prototype.enable = function (list, ignoreInvalid) {
  2133. if (!Array.isArray(list)) { list = [ list ]; }
  2134. var result = [];
  2135. // Search by name and enable
  2136. list.forEach(function (name) {
  2137. var idx = this.__find__(name);
  2138. if (idx < 0) {
  2139. if (ignoreInvalid) { return; }
  2140. throw new Error('Rules manager: invalid rule name ' + name);
  2141. }
  2142. this.__rules__[idx].enabled = true;
  2143. result.push(name);
  2144. }, this);
  2145. this.__cache__ = null;
  2146. return result;
  2147. };
  2148. /**
  2149. * Ruler.enableOnly(list [, ignoreInvalid])
  2150. * - list (String|Array): list of rule names to enable (whitelist).
  2151. * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
  2152. *
  2153. * Enable rules with given names, and disable everything else. If any rule name
  2154. * not found - throw Error. Errors can be disabled by second param.
  2155. *
  2156. * See also [[Ruler.disable]], [[Ruler.enable]].
  2157. **/
  2158. Ruler.prototype.enableOnly = function (list, ignoreInvalid) {
  2159. if (!Array.isArray(list)) { list = [ list ]; }
  2160. this.__rules__.forEach(function (rule) { rule.enabled = false; });
  2161. this.enable(list, ignoreInvalid);
  2162. };
  2163. /**
  2164. * Ruler.disable(list [, ignoreInvalid]) -> Array
  2165. * - list (String|Array): list of rule names to disable.
  2166. * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
  2167. *
  2168. * Disable rules with given names. If any rule name not found - throw Error.
  2169. * Errors can be disabled by second param.
  2170. *
  2171. * Returns list of found rule names (if no exception happened).
  2172. *
  2173. * See also [[Ruler.enable]], [[Ruler.enableOnly]].
  2174. **/
  2175. Ruler.prototype.disable = function (list, ignoreInvalid) {
  2176. if (!Array.isArray(list)) { list = [ list ]; }
  2177. var result = [];
  2178. // Search by name and disable
  2179. list.forEach(function (name) {
  2180. var idx = this.__find__(name);
  2181. if (idx < 0) {
  2182. if (ignoreInvalid) { return; }
  2183. throw new Error('Rules manager: invalid rule name ' + name);
  2184. }
  2185. this.__rules__[idx].enabled = false;
  2186. result.push(name);
  2187. }, this);
  2188. this.__cache__ = null;
  2189. return result;
  2190. };
  2191. /**
  2192. * Ruler.getRules(chainName) -> Array
  2193. *
  2194. * Return array of active functions (rules) for given chain name. It analyzes
  2195. * rules configuration, compiles caches if not exists and returns result.
  2196. *
  2197. * Default chain name is `''` (empty string). It can't be skipped. That's
  2198. * done intentionally, to keep signature monomorphic for high speed.
  2199. **/
  2200. Ruler.prototype.getRules = function (chainName) {
  2201. if (this.__cache__ === null) {
  2202. this.__compile__();
  2203. }
  2204. // Chain can be empty, if rules disabled. But we still have to return Array.
  2205. return this.__cache__[chainName] || [];
  2206. };
  2207. module.exports = Ruler;
  2208. /***/ }),
  2209. /* 7 */
  2210. /***/ (function(module, exports, __webpack_require__) {
  2211. "use strict";
  2212. // Token class
  2213. /**
  2214. * class Token
  2215. **/
  2216. /**
  2217. * new Token(type, tag, nesting)
  2218. *
  2219. * Create new token and fill passed properties.
  2220. **/
  2221. function Token(type, tag, nesting) {
  2222. /**
  2223. * Token#type -> String
  2224. *
  2225. * Type of the token (string, e.g. "paragraph_open")
  2226. **/
  2227. this.type = type;
  2228. /**
  2229. * Token#tag -> String
  2230. *
  2231. * html tag name, e.g. "p"
  2232. **/
  2233. this.tag = tag;
  2234. /**
  2235. * Token#attrs -> Array
  2236. *
  2237. * Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]`
  2238. **/
  2239. this.attrs = null;
  2240. /**
  2241. * Token#map -> Array
  2242. *
  2243. * Source map info. Format: `[ line_begin, line_end ]`
  2244. **/
  2245. this.map = null;
  2246. /**
  2247. * Token#nesting -> Number
  2248. *
  2249. * Level change (number in {-1, 0, 1} set), where:
  2250. *
  2251. * - `1` means the tag is opening
  2252. * - `0` means the tag is self-closing
  2253. * - `-1` means the tag is closing
  2254. **/
  2255. this.nesting = nesting;
  2256. /**
  2257. * Token#level -> Number
  2258. *
  2259. * nesting level, the same as `state.level`
  2260. **/
  2261. this.level = 0;
  2262. /**
  2263. * Token#children -> Array
  2264. *
  2265. * An array of child nodes (inline and img tokens)
  2266. **/
  2267. this.children = null;
  2268. /**
  2269. * Token#content -> String
  2270. *
  2271. * In a case of self-closing tag (code, html, fence, etc.),
  2272. * it has contents of this tag.
  2273. **/
  2274. this.content = '';
  2275. /**
  2276. * Token#markup -> String
  2277. *
  2278. * '*' or '_' for emphasis, fence string for fence, etc.
  2279. **/
  2280. this.markup = '';
  2281. /**
  2282. * Token#info -> String
  2283. *
  2284. * fence infostring
  2285. **/
  2286. this.info = '';
  2287. /**
  2288. * Token#meta -> Object
  2289. *
  2290. * A place for plugins to store an arbitrary data
  2291. **/
  2292. this.meta = null;
  2293. /**
  2294. * Token#block -> Boolean
  2295. *
  2296. * True for block-level tokens, false for inline tokens.
  2297. * Used in renderer to calculate line breaks
  2298. **/
  2299. this.block = false;
  2300. /**
  2301. * Token#hidden -> Boolean
  2302. *
  2303. * If it's true, ignore this element when rendering. Used for tight lists
  2304. * to hide paragraphs.
  2305. **/
  2306. this.hidden = false;
  2307. }
  2308. /**
  2309. * Token.attrIndex(name) -> Number
  2310. *
  2311. * Search attribute index by name.
  2312. **/
  2313. Token.prototype.attrIndex = function attrIndex(name) {
  2314. var attrs, i, len;
  2315. if (!this.attrs) { return -1; }
  2316. attrs = this.attrs;
  2317. for (i = 0, len = attrs.length; i < len; i++) {
  2318. if (attrs[i][0] === name) { return i; }
  2319. }
  2320. return -1;
  2321. };
  2322. /**
  2323. * Token.attrPush(attrData)
  2324. *
  2325. * Add `[ name, value ]` attribute to list. Init attrs if necessary
  2326. **/
  2327. Token.prototype.attrPush = function attrPush(attrData) {
  2328. if (this.attrs) {
  2329. this.attrs.push(attrData);
  2330. } else {
  2331. this.attrs = [ attrData ];
  2332. }
  2333. };
  2334. /**
  2335. * Token.attrSet(name, value)
  2336. *
  2337. * Set `name` attribute to `value`. Override old value if exists.
  2338. **/
  2339. Token.prototype.attrSet = function attrSet(name, value) {
  2340. var idx = this.attrIndex(name),
  2341. attrData = [ name, value ];
  2342. if (idx < 0) {
  2343. this.attrPush(attrData);
  2344. } else {
  2345. this.attrs[idx] = attrData;
  2346. }
  2347. };
  2348. /**
  2349. * Token.attrGet(name)
  2350. *
  2351. * Get the value of attribute `name`, or null if it does not exist.
  2352. **/
  2353. Token.prototype.attrGet = function attrGet(name) {
  2354. var idx = this.attrIndex(name), value = null;
  2355. if (idx >= 0) {
  2356. value = this.attrs[idx][1];
  2357. }
  2358. return value;
  2359. };
  2360. /**
  2361. * Token.attrJoin(name, value)
  2362. *
  2363. * Join value to existing attribute via space. Or create new attribute if not
  2364. * exists. Useful to operate with token classes.
  2365. **/
  2366. Token.prototype.attrJoin = function attrJoin(name, value) {
  2367. var idx = this.attrIndex(name);
  2368. if (idx < 0) {
  2369. this.attrPush([ name, value ]);
  2370. } else {
  2371. this.attrs[idx][1] = this.attrs[idx][1] + ' ' + value;
  2372. }
  2373. };
  2374. module.exports = Token;
  2375. /***/ }),
  2376. /* 8 */
  2377. /***/ (function(module, exports, __webpack_require__) {
  2378. "use strict";
  2379. // Process footnotes
  2380. //
  2381. ////////////////////////////////////////////////////////////////////////////////
  2382. // Renderer partials
  2383. function render_footnote_anchor_name(tokens, idx, options, env/*, slf*/) {
  2384. var n = Number(tokens[idx].meta.id + 1).toString();
  2385. var prefix = '';
  2386. if (typeof env.docId === 'string') {
  2387. prefix = '-' + env.docId + '-';
  2388. }
  2389. return prefix + n;
  2390. }
  2391. function render_footnote_caption(tokens, idx/*, options, env, slf*/) {
  2392. var n = Number(tokens[idx].meta.id + 1).toString();
  2393. if (tokens[idx].meta.subId > 0) {
  2394. n += ':' + tokens[idx].meta.subId;
  2395. }
  2396. return '[' + n + ']';
  2397. }
  2398. function render_footnote_ref(tokens, idx, options, env, slf) {
  2399. var id = slf.rules.footnote_anchor_name(tokens, idx, options, env, slf);
  2400. var caption = slf.rules.footnote_caption(tokens, idx, options, env, slf);
  2401. var refid = id;
  2402. if (tokens[idx].meta.subId > 0) {
  2403. refid += ':' + tokens[idx].meta.subId;
  2404. }
  2405. return '<sup class="footnote-ref"><a href="#fn' + id + '" id="fnref' + refid + '">' + caption + '</a></sup>';
  2406. }
  2407. function render_footnote_block_open(tokens, idx, options) {
  2408. return (options.xhtmlOut ? '<hr class="footnotes-sep" />\n' : '<hr class="footnotes-sep">\n') +
  2409. '<section class="footnotes">\n' +
  2410. '<ol class="footnotes-list">\n';
  2411. }
  2412. function render_footnote_block_close() {
  2413. return '</ol>\n</section>\n';
  2414. }
  2415. function render_footnote_open(tokens, idx, options, env, slf) {
  2416. var id = slf.rules.footnote_anchor_name(tokens, idx, options, env, slf);
  2417. if (tokens[idx].meta.subId > 0) {
  2418. id += ':' + tokens[idx].meta.subId;
  2419. }
  2420. return '<li id="fn' + id + '" class="footnote-item">';
  2421. }
  2422. function render_footnote_close() {
  2423. return '</li>\n';
  2424. }
  2425. function render_footnote_anchor(tokens, idx, options, env, slf) {
  2426. var id = slf.rules.footnote_anchor_name(tokens, idx, options, env, slf);
  2427. if (tokens[idx].meta.subId > 0) {
  2428. id += ':' + tokens[idx].meta.subId;
  2429. }
  2430. /* ↩ with escape code to prevent display as Apple Emoji on iOS */
  2431. return ' <a href="#fnref' + id + '" class="footnote-backref">\u21a9\uFE0E</a>';
  2432. }
  2433. module.exports = function footnote_plugin(md) {
  2434. var parseLinkLabel = md.helpers.parseLinkLabel,
  2435. isSpace = md.utils.isSpace;
  2436. md.renderer.rules.footnote_ref = render_footnote_ref;
  2437. md.renderer.rules.footnote_block_open = render_footnote_block_open;
  2438. md.renderer.rules.footnote_block_close = render_footnote_block_close;
  2439. md.renderer.rules.footnote_open = render_footnote_open;
  2440. md.renderer.rules.footnote_close = render_footnote_close;
  2441. md.renderer.rules.footnote_anchor = render_footnote_anchor;
  2442. // helpers (only used in other rules, no tokens are attached to those)
  2443. md.renderer.rules.footnote_caption = render_footnote_caption;
  2444. md.renderer.rules.footnote_anchor_name = render_footnote_anchor_name;
  2445. // Process footnote block definition
  2446. function footnote_def(state, startLine, endLine, silent) {
  2447. var oldBMark, oldTShift, oldSCount, oldParentType, pos, label, token,
  2448. initial, offset, ch, posAfterColon,
  2449. start = state.bMarks[startLine] + state.tShift[startLine],
  2450. max = state.eMarks[startLine];
  2451. // line should be at least 5 chars - "[^x]:"
  2452. if (start + 4 > max) { return false; }
  2453. if (state.src.charCodeAt(start) !== 0x5B/* [ */) { return false; }
  2454. if (state.src.charCodeAt(start + 1) !== 0x5E/* ^ */) { return false; }
  2455. for (pos = start + 2; pos < max; pos++) {
  2456. if (state.src.charCodeAt(pos) === 0x20) { return false; }
  2457. if (state.src.charCodeAt(pos) === 0x5D /* ] */) {
  2458. break;
  2459. }
  2460. }
  2461. if (pos === start + 2) { return false; } // no empty footnote labels
  2462. if (pos + 1 >= max || state.src.charCodeAt(++pos) !== 0x3A /* : */) { return false; }
  2463. if (silent) { return true; }
  2464. pos++;
  2465. if (!state.env.footnotes) { state.env.footnotes = {}; }
  2466. if (!state.env.footnotes.refs) { state.env.footnotes.refs = {}; }
  2467. label = state.src.slice(start + 2, pos - 2);
  2468. state.env.footnotes.refs[':' + label] = -1;
  2469. token = new state.Token('footnote_reference_open', '', 1);
  2470. token.meta = { label: label };
  2471. token.level = state.level++;
  2472. state.tokens.push(token);
  2473. oldBMark = state.bMarks[startLine];
  2474. oldTShift = state.tShift[startLine];
  2475. oldSCount = state.sCount[startLine];
  2476. oldParentType = state.parentType;
  2477. posAfterColon = pos;
  2478. initial = offset = state.sCount[startLine] + pos - (state.bMarks[startLine] + state.tShift[startLine]);
  2479. while (pos < max) {
  2480. ch = state.src.charCodeAt(pos);
  2481. if (isSpace(ch)) {
  2482. if (ch === 0x09) {
  2483. offset += 4 - offset % 4;
  2484. } else {
  2485. offset++;
  2486. }
  2487. } else {
  2488. break;
  2489. }
  2490. pos++;
  2491. }
  2492. state.tShift[startLine] = pos - posAfterColon;
  2493. state.sCount[startLine] = offset - initial;
  2494. state.bMarks[startLine] = posAfterColon;
  2495. state.blkIndent += 4;
  2496. state.parentType = 'footnote';
  2497. if (state.sCount[startLine] < state.blkIndent) {
  2498. state.sCount[startLine] += state.blkIndent;
  2499. }
  2500. state.md.block.tokenize(state, startLine, endLine, true);
  2501. state.parentType = oldParentType;
  2502. state.blkIndent -= 4;
  2503. state.tShift[startLine] = oldTShift;
  2504. state.sCount[startLine] = oldSCount;
  2505. state.bMarks[startLine] = oldBMark;
  2506. token = new state.Token('footnote_reference_close', '', -1);
  2507. token.level = --state.level;
  2508. state.tokens.push(token);
  2509. return true;
  2510. }
  2511. // Process inline footnotes (^[...])
  2512. function footnote_inline(state, silent) {
  2513. var labelStart,
  2514. labelEnd,
  2515. footnoteId,
  2516. token,
  2517. tokens,
  2518. max = state.posMax,
  2519. start = state.pos;
  2520. if (start + 2 >= max) { return false; }
  2521. if (state.src.charCodeAt(start) !== 0x5E/* ^ */) { return false; }
  2522. if (state.src.charCodeAt(start + 1) !== 0x5B/* [ */) { return false; }
  2523. labelStart = start + 2;
  2524. labelEnd = parseLinkLabel(state, start + 1);
  2525. // parser failed to find ']', so it's not a valid note
  2526. if (labelEnd < 0) { return false; }
  2527. // We found the end of the link, and know for a fact it's a valid link;
  2528. // so all that's left to do is to call tokenizer.
  2529. //
  2530. if (!silent) {
  2531. if (!state.env.footnotes) { state.env.footnotes = {}; }
  2532. if (!state.env.footnotes.list) { state.env.footnotes.list = []; }
  2533. footnoteId = state.env.footnotes.list.length;
  2534. state.md.inline.parse(
  2535. state.src.slice(labelStart, labelEnd),
  2536. state.md,
  2537. state.env,
  2538. tokens = []
  2539. );
  2540. token = state.push('footnote_ref', '', 0);
  2541. token.meta = { id: footnoteId };
  2542. state.env.footnotes.list[footnoteId] = { tokens: tokens };
  2543. }
  2544. state.pos = labelEnd + 1;
  2545. state.posMax = max;
  2546. return true;
  2547. }
  2548. // Process footnote references ([^...])
  2549. function footnote_ref(state, silent) {
  2550. var label,
  2551. pos,
  2552. footnoteId,
  2553. footnoteSubId,
  2554. token,
  2555. max = state.posMax,
  2556. start = state.pos;
  2557. // should be at least 4 chars - "[^x]"
  2558. if (start + 3 > max) { return false; }
  2559. if (!state.env.footnotes || !state.env.footnotes.refs) { return false; }
  2560. if (state.src.charCodeAt(start) !== 0x5B/* [ */) { return false; }
  2561. if (state.src.charCodeAt(start + 1) !== 0x5E/* ^ */) { return false; }
  2562. for (pos = start + 2; pos < max; pos++) {
  2563. if (state.src.charCodeAt(pos) === 0x20) { return false; }
  2564. if (state.src.charCodeAt(pos) === 0x0A) { return false; }
  2565. if (state.src.charCodeAt(pos) === 0x5D /* ] */) {
  2566. break;
  2567. }
  2568. }
  2569. if (pos === start + 2) { return false; } // no empty footnote labels
  2570. if (pos >= max) { return false; }
  2571. pos++;
  2572. label = state.src.slice(start + 2, pos - 1);
  2573. if (typeof state.env.footnotes.refs[':' + label] === 'undefined') { return false; }
  2574. if (!silent) {
  2575. if (!state.env.footnotes.list) { state.env.footnotes.list = []; }
  2576. if (state.env.footnotes.refs[':' + label] < 0) {
  2577. footnoteId = state.env.footnotes.list.length;
  2578. state.env.footnotes.list[footnoteId] = { label: label, count: 0 };
  2579. state.env.footnotes.refs[':' + label] = footnoteId;
  2580. } else {
  2581. footnoteId = state.env.footnotes.refs[':' + label];
  2582. }
  2583. footnoteSubId = state.env.footnotes.list[footnoteId].count;
  2584. state.env.footnotes.list[footnoteId].count++;
  2585. token = state.push('footnote_ref', '', 0);
  2586. token.meta = { id: footnoteId, subId: footnoteSubId, label: label };
  2587. }
  2588. state.pos = pos;
  2589. state.posMax = max;
  2590. return true;
  2591. }
  2592. // Glue footnote tokens to end of token stream
  2593. function footnote_tail(state) {
  2594. var i, l, j, t, lastParagraph, list, token, tokens, current, currentLabel,
  2595. insideRef = false,
  2596. refTokens = {};
  2597. if (!state.env.footnotes) { return; }
  2598. state.tokens = state.tokens.filter(function (tok) {
  2599. if (tok.type === 'footnote_reference_open') {
  2600. insideRef = true;
  2601. current = [];
  2602. currentLabel = tok.meta.label;
  2603. return false;
  2604. }
  2605. if (tok.type === 'footnote_reference_close') {
  2606. insideRef = false;
  2607. // prepend ':' to avoid conflict with Object.prototype members
  2608. refTokens[':' + currentLabel] = current;
  2609. return false;
  2610. }
  2611. if (insideRef) { current.push(tok); }
  2612. return !insideRef;
  2613. });
  2614. if (!state.env.footnotes.list) { return; }
  2615. list = state.env.footnotes.list;
  2616. token = new state.Token('footnote_block_open', '', 1);
  2617. state.tokens.push(token);
  2618. for (i = 0, l = list.length; i < l; i++) {
  2619. token = new state.Token('footnote_open', '', 1);
  2620. token.meta = { id: i, label: list[i].label };
  2621. state.tokens.push(token);
  2622. if (list[i].tokens) {
  2623. tokens = [];
  2624. token = new state.Token('paragraph_open', 'p', 1);
  2625. token.block = true;
  2626. tokens.push(token);
  2627. token = new state.Token('inline', '', 0);
  2628. token.children = list[i].tokens;
  2629. token.content = '';
  2630. tokens.push(token);
  2631. token = new state.Token('paragraph_close', 'p', -1);
  2632. token.block = true;
  2633. tokens.push(token);
  2634. } else if (list[i].label) {
  2635. tokens = refTokens[':' + list[i].label];
  2636. }
  2637. state.tokens = state.tokens.concat(tokens);
  2638. if (state.tokens[state.tokens.length - 1].type === 'paragraph_close') {
  2639. lastParagraph = state.tokens.pop();
  2640. } else {
  2641. lastParagraph = null;
  2642. }
  2643. t = list[i].count > 0 ? list[i].count : 1;
  2644. for (j = 0; j < t; j++) {
  2645. token = new state.Token('footnote_anchor', '', 0);
  2646. token.meta = { id: i, subId: j, label: list[i].label };
  2647. state.tokens.push(token);
  2648. }
  2649. if (lastParagraph) {
  2650. state.tokens.push(lastParagraph);
  2651. }
  2652. token = new state.Token('footnote_close', '', -1);
  2653. state.tokens.push(token);
  2654. }
  2655. token = new state.Token('footnote_block_close', '', -1);
  2656. state.tokens.push(token);
  2657. }
  2658. md.block.ruler.before('reference', 'footnote_def', footnote_def, { alt: [ 'paragraph', 'reference' ] });
  2659. md.inline.ruler.after('image', 'footnote_inline', footnote_inline);
  2660. md.inline.ruler.after('footnote_inline', 'footnote_ref', footnote_ref);
  2661. md.core.ruler.after('inline', 'footnote_tail', footnote_tail);
  2662. };
  2663. /***/ }),
  2664. /* 9 */
  2665. /***/ (function(module, exports) {
  2666. module.exports = {
  2667. t(key){
  2668. if(this.locales[key]){
  2669. if(this.lang){
  2670. if(this.locales[key][this.lang]){
  2671. return this.locales[key][this.lang];// key for current language
  2672. }else{this.log(`Key "${key}" does not exists for language ${this.lang}`);}
  2673. }else if(this.locales[key][this.fallback]){
  2674. return this.locales[key][this.fallback];// key for fallback language
  2675. }else{this.log(`Key "${key}" does not exists for fallback language ${this.fallback}`);}
  2676. }else{this.log(`Key "${key}" does not exists.`);}
  2677. return key;// if nothing else retrn key it self
  2678. },
  2679. setLang(l){
  2680. this.lang = l
  2681. },
  2682. log(msg){
  2683. console.log(`i18n : ${msg}`);
  2684. },
  2685. fallback:'en',
  2686. lang: null,
  2687. locales:{
  2688. 'Parts':{
  2689. 'en':'Parts',
  2690. 'fr':'Parties',
  2691. 'bra':'Peças',
  2692. 'lat':'Pars'
  2693. },
  2694. 'Mode':{
  2695. 'en':'Mode',
  2696. 'fr':'Mode',
  2697. 'bra':'Modo',
  2698. 'lat':'Modus'
  2699. },
  2700. 'Language':{
  2701. 'en':'Language',
  2702. 'fr':'Langue',
  2703. 'bra':'Língua',
  2704. 'lat':'Lingua'
  2705. },
  2706. 'Text':{
  2707. 'en':'Text',
  2708. 'fr':'Texte',
  2709. 'bra':'Texto',
  2710. 'lat':'Illud'
  2711. },
  2712. 'Connections':{
  2713. 'en':'Connections',
  2714. 'fr':'Connections',
  2715. 'bra':'Conexões',
  2716. 'lat':'Hospites'
  2717. },
  2718. }
  2719. }
  2720. /***/ }),
  2721. /* 10 */
  2722. /***/ (function(module, exports, __webpack_require__) {
  2723. var m = __webpack_require__(1);
  2724. var _dbs = __webpack_require__(3);
  2725. var _i18n = __webpack_require__(9);
  2726. var markdown = __webpack_require__(4)()
  2727. .use(__webpack_require__(8));
  2728. // import * as i18next from 'i18next';
  2729. // __ __ __
  2730. // / / / /__ ____ _____/ /__ _____
  2731. // / /_/ / _ \/ __ `/ __ / _ \/ ___/
  2732. // / __ / __/ /_/ / /_/ / __/ /
  2733. // /_/ /_/\___/\__,_/\__,_/\___/_/
  2734. module.exports = {
  2735. // onupdate(vn){
  2736. // // console.log("Header onupdate : vn", vn);
  2737. // },
  2738. view(vn){
  2739. // console.log("Header view : vn", vn);
  2740. return m('header', [
  2741. m('hgroup', [
  2742. m('h1', 'Ethica'),
  2743. m('h2', 'Spinoza (1632-1677)')
  2744. ]),
  2745. m('div', {'id':"menus"}, [
  2746. m(_PartsNav),
  2747. m(_RouteMenu),
  2748. m(_LangMenu)
  2749. ])
  2750. ]);
  2751. }
  2752. }
  2753. // ____ __
  2754. // / __ \____ ______/ /______ ____ ___ ___ ____ __ __
  2755. // / /_/ / __ `/ ___/ __/ ___/ / __ `__ \/ _ \/ __ \/ / / /
  2756. // / ____/ /_/ / / / /_(__ ) / / / / / / __/ / / / /_/ /
  2757. // /_/ \__,_/_/ \__/____/ /_/ /_/ /_/\___/_/ /_/\__,_/
  2758. var _PartsNav = {
  2759. view(vn){
  2760. var lang = m.route.param('lang');
  2761. // console.log('partsmenu', lang);
  2762. return m('nav', {id:'parts-nav'}, [
  2763. // TODO: replaced labels with localized content
  2764. m('h3', _i18n.t('Parts')),
  2765. m('ul', _dbs.data[lang].map(function(p){
  2766. // console.log("anchors, part", p);
  2767. if(p.id !== "intro"){
  2768. return m('li', [
  2769. m('a', {'href':'#'+p.id}, m.trust(markdown.renderInline(p.title)))
  2770. ]);
  2771. }
  2772. })
  2773. )
  2774. ]);
  2775. }
  2776. };
  2777. // ____ __
  2778. // / __ \____ __ __/ /____ ____ ___ ___ ____ __ __
  2779. // / /_/ / __ \/ / / / __/ _ \ / __ `__ \/ _ \/ __ \/ / / /
  2780. // / _, _/ /_/ / /_/ / /_/ __/ / / / / / / __/ / / / /_/ /
  2781. // /_/ |_|\____/\__,_/\__/\___/ /_/ /_/ /_/\___/_/ /_/\__,_/
  2782. var _RouteMenu = {
  2783. view(){
  2784. var lang = m.route.param('lang');
  2785. var path = m.route.get().match(/^(\/[^\/]+)(\/[^\/|#]+)(.*)$/);
  2786. // console.log('Route menu Path', path);
  2787. return m('nav', {id:'routes'}, [
  2788. // TODO: replaced labels with localized content
  2789. m('h3', _i18n.t('Mode')),
  2790. m('ul', [
  2791. m('li', m('a', {
  2792. 'href':`/${lang}/text${path[3]}`,
  2793. oncreate : m.route.link,
  2794. onupdate : m.route.link
  2795. }, _i18n.t("Text"))),
  2796. m('li', m('a', {
  2797. 'href':`/${lang}/connections${path[3]}`,
  2798. oncreate : m.route.link,
  2799. onupdate : m.route.link
  2800. }, _i18n.t("Connections"))),
  2801. ])
  2802. ]);
  2803. }
  2804. }
  2805. // __ __ ___
  2806. // / / ____ _____ ____ _/ |/ /__ ____ __ __
  2807. // / / / __ `/ __ \/ __ `/ /|_/ / _ \/ __ \/ / / /
  2808. // / /___/ /_/ / / / / /_/ / / / / __/ / / / /_/ /
  2809. // /_____/\__,_/_/ /_/\__, /_/ /_/\___/_/ /_/\__,_/
  2810. // /____/
  2811. var _LangMenu = {
  2812. view(){
  2813. var path = m.route.get().match(/^\/[^\/]+(.+)$/);
  2814. // console.log('Lang menu Path', path);
  2815. // create ul dom
  2816. // console.log("Header _LangMenu view : i18next", i18next);
  2817. return m('nav', {id:'languages'}, [
  2818. // TODO: replaced labels with localized content
  2819. m('h3', _i18n.t('Language')),
  2820. m('ul', _dbs.langs.map(lang => {
  2821. // create li dom for each lang link
  2822. return m('li', m('a', {
  2823. 'lang':lang.lc,
  2824. 'href':`/${lang.lc}${path[1]}`,
  2825. oncreate : m.route.link,
  2826. onupdate : m.route.link
  2827. }, lang.label)
  2828. );
  2829. }))
  2830. ]);
  2831. }
  2832. }
  2833. /***/ }),
  2834. /* 11 */
  2835. /***/ (function(module, exports, __webpack_require__) {
  2836. "use strict";
  2837. // HTML5 entities map: { name -> utf16string }
  2838. //
  2839. /*eslint quotes:0*/
  2840. module.exports = __webpack_require__(31);
  2841. /***/ }),
  2842. /* 12 */
  2843. /***/ (function(module, exports, __webpack_require__) {
  2844. "use strict";
  2845. module.exports.encode = __webpack_require__(32);
  2846. module.exports.decode = __webpack_require__(33);
  2847. module.exports.format = __webpack_require__(34);
  2848. module.exports.parse = __webpack_require__(35);
  2849. /***/ }),
  2850. /* 13 */
  2851. /***/ (function(module, exports) {
  2852. module.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/
  2853. /***/ }),
  2854. /* 14 */
  2855. /***/ (function(module, exports) {
  2856. module.exports=/[\0-\x1F\x7F-\x9F]/
  2857. /***/ }),
  2858. /* 15 */
  2859. /***/ (function(module, exports) {
  2860. module.exports=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/
  2861. /***/ }),
  2862. /* 16 */
  2863. /***/ (function(module, exports, __webpack_require__) {
  2864. "use strict";
  2865. // Regexps to match html elements
  2866. var attr_name = '[a-zA-Z_:][a-zA-Z0-9:._-]*';
  2867. var unquoted = '[^"\'=<>`\\x00-\\x20]+';
  2868. var single_quoted = "'[^']*'";
  2869. var double_quoted = '"[^"]*"';
  2870. var attr_value = '(?:' + unquoted + '|' + single_quoted + '|' + double_quoted + ')';
  2871. var attribute = '(?:\\s+' + attr_name + '(?:\\s*=\\s*' + attr_value + ')?)';
  2872. var open_tag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>';
  2873. var close_tag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>';
  2874. var comment = '<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->';
  2875. var processing = '<[?].*?[?]>';
  2876. var declaration = '<![A-Z]+\\s+[^>]*>';
  2877. var cdata = '<!\\[CDATA\\[[\\s\\S]*?\\]\\]>';
  2878. var HTML_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + '|' + comment +
  2879. '|' + processing + '|' + declaration + '|' + cdata + ')');
  2880. var HTML_OPEN_CLOSE_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + ')');
  2881. module.exports.HTML_TAG_RE = HTML_TAG_RE;
  2882. module.exports.HTML_OPEN_CLOSE_TAG_RE = HTML_OPEN_CLOSE_TAG_RE;
  2883. /***/ }),
  2884. /* 17 */
  2885. /***/ (function(module, exports, __webpack_require__) {
  2886. "use strict";
  2887. // ~~strike through~~
  2888. //
  2889. // Insert each marker as a separate text token, and add it to delimiter list
  2890. //
  2891. module.exports.tokenize = function strikethrough(state, silent) {
  2892. var i, scanned, token, len, ch,
  2893. start = state.pos,
  2894. marker = state.src.charCodeAt(start);
  2895. if (silent) { return false; }
  2896. if (marker !== 0x7E/* ~ */) { return false; }
  2897. scanned = state.scanDelims(state.pos, true);
  2898. len = scanned.length;
  2899. ch = String.fromCharCode(marker);
  2900. if (len < 2) { return false; }
  2901. if (len % 2) {
  2902. token = state.push('text', '', 0);
  2903. token.content = ch;
  2904. len--;
  2905. }
  2906. for (i = 0; i < len; i += 2) {
  2907. token = state.push('text', '', 0);
  2908. token.content = ch + ch;
  2909. state.delimiters.push({
  2910. marker: marker,
  2911. jump: i,
  2912. token: state.tokens.length - 1,
  2913. level: state.level,
  2914. end: -1,
  2915. open: scanned.can_open,
  2916. close: scanned.can_close
  2917. });
  2918. }
  2919. state.pos += scanned.length;
  2920. return true;
  2921. };
  2922. // Walk through delimiter list and replace text tokens with tags
  2923. //
  2924. module.exports.postProcess = function strikethrough(state) {
  2925. var i, j,
  2926. startDelim,
  2927. endDelim,
  2928. token,
  2929. loneMarkers = [],
  2930. delimiters = state.delimiters,
  2931. max = state.delimiters.length;
  2932. for (i = 0; i < max; i++) {
  2933. startDelim = delimiters[i];
  2934. if (startDelim.marker !== 0x7E/* ~ */) {
  2935. continue;
  2936. }
  2937. if (startDelim.end === -1) {
  2938. continue;
  2939. }
  2940. endDelim = delimiters[startDelim.end];
  2941. token = state.tokens[startDelim.token];
  2942. token.type = 's_open';
  2943. token.tag = 's';
  2944. token.nesting = 1;
  2945. token.markup = '~~';
  2946. token.content = '';
  2947. token = state.tokens[endDelim.token];
  2948. token.type = 's_close';
  2949. token.tag = 's';
  2950. token.nesting = -1;
  2951. token.markup = '~~';
  2952. token.content = '';
  2953. if (state.tokens[endDelim.token - 1].type === 'text' &&
  2954. state.tokens[endDelim.token - 1].content === '~') {
  2955. loneMarkers.push(endDelim.token - 1);
  2956. }
  2957. }
  2958. // If a marker sequence has an odd number of characters, it's splitted
  2959. // like this: `~~~~~` -> `~` + `~~` + `~~`, leaving one marker at the
  2960. // start of the sequence.
  2961. //
  2962. // So, we have to move all those markers after subsequent s_close tags.
  2963. //
  2964. while (loneMarkers.length) {
  2965. i = loneMarkers.pop();
  2966. j = i + 1;
  2967. while (j < state.tokens.length && state.tokens[j].type === 's_close') {
  2968. j++;
  2969. }
  2970. j--;
  2971. if (i !== j) {
  2972. token = state.tokens[j];
  2973. state.tokens[j] = state.tokens[i];
  2974. state.tokens[i] = token;
  2975. }
  2976. }
  2977. };
  2978. /***/ }),
  2979. /* 18 */
  2980. /***/ (function(module, exports, __webpack_require__) {
  2981. "use strict";
  2982. // Process *this* and _that_
  2983. //
  2984. // Insert each marker as a separate text token, and add it to delimiter list
  2985. //
  2986. module.exports.tokenize = function emphasis(state, silent) {
  2987. var i, scanned, token,
  2988. start = state.pos,
  2989. marker = state.src.charCodeAt(start);
  2990. if (silent) { return false; }
  2991. if (marker !== 0x5F /* _ */ && marker !== 0x2A /* * */) { return false; }
  2992. scanned = state.scanDelims(state.pos, marker === 0x2A);
  2993. for (i = 0; i < scanned.length; i++) {
  2994. token = state.push('text', '', 0);
  2995. token.content = String.fromCharCode(marker);
  2996. state.delimiters.push({
  2997. // Char code of the starting marker (number).
  2998. //
  2999. marker: marker,
  3000. // Total length of these series of delimiters.
  3001. //
  3002. length: scanned.length,
  3003. // An amount of characters before this one that's equivalent to
  3004. // current one. In plain English: if this delimiter does not open
  3005. // an emphasis, neither do previous `jump` characters.
  3006. //
  3007. // Used to skip sequences like "*****" in one step, for 1st asterisk
  3008. // value will be 0, for 2nd it's 1 and so on.
  3009. //
  3010. jump: i,
  3011. // A position of the token this delimiter corresponds to.
  3012. //
  3013. token: state.tokens.length - 1,
  3014. // Token level.
  3015. //
  3016. level: state.level,
  3017. // If this delimiter is matched as a valid opener, `end` will be
  3018. // equal to its position, otherwise it's `-1`.
  3019. //
  3020. end: -1,
  3021. // Boolean flags that determine if this delimiter could open or close
  3022. // an emphasis.
  3023. //
  3024. open: scanned.can_open,
  3025. close: scanned.can_close
  3026. });
  3027. }
  3028. state.pos += scanned.length;
  3029. return true;
  3030. };
  3031. // Walk through delimiter list and replace text tokens with tags
  3032. //
  3033. module.exports.postProcess = function emphasis(state) {
  3034. var i,
  3035. startDelim,
  3036. endDelim,
  3037. token,
  3038. ch,
  3039. isStrong,
  3040. delimiters = state.delimiters,
  3041. max = state.delimiters.length;
  3042. for (i = max - 1; i >= 0; i--) {
  3043. startDelim = delimiters[i];
  3044. if (startDelim.marker !== 0x5F/* _ */ && startDelim.marker !== 0x2A/* * */) {
  3045. continue;
  3046. }
  3047. // Process only opening markers
  3048. if (startDelim.end === -1) {
  3049. continue;
  3050. }
  3051. endDelim = delimiters[startDelim.end];
  3052. // If the previous delimiter has the same marker and is adjacent to this one,
  3053. // merge those into one strong delimiter.
  3054. //
  3055. // `<em><em>whatever</em></em>` -> `<strong>whatever</strong>`
  3056. //
  3057. isStrong = i > 0 &&
  3058. delimiters[i - 1].end === startDelim.end + 1 &&
  3059. delimiters[i - 1].token === startDelim.token - 1 &&
  3060. delimiters[startDelim.end + 1].token === endDelim.token + 1 &&
  3061. delimiters[i - 1].marker === startDelim.marker;
  3062. ch = String.fromCharCode(startDelim.marker);
  3063. token = state.tokens[startDelim.token];
  3064. token.type = isStrong ? 'strong_open' : 'em_open';
  3065. token.tag = isStrong ? 'strong' : 'em';
  3066. token.nesting = 1;
  3067. token.markup = isStrong ? ch + ch : ch;
  3068. token.content = '';
  3069. token = state.tokens[endDelim.token];
  3070. token.type = isStrong ? 'strong_close' : 'em_close';
  3071. token.tag = isStrong ? 'strong' : 'em';
  3072. token.nesting = -1;
  3073. token.markup = isStrong ? ch + ch : ch;
  3074. token.content = '';
  3075. if (isStrong) {
  3076. state.tokens[delimiters[i - 1].token].content = '';
  3077. state.tokens[delimiters[startDelim.end + 1].token].content = '';
  3078. i--;
  3079. }
  3080. }
  3081. };
  3082. /***/ }),
  3083. /* 19 */
  3084. /***/ (function(module, exports, __webpack_require__) {
  3085. var m = __webpack_require__(1);
  3086. // ____ __
  3087. // / __/___ ____ / /____ _____
  3088. // / /_/ __ \/ __ \/ __/ _ \/ ___/
  3089. // / __/ /_/ / /_/ / /_/ __/ /
  3090. // /_/ \____/\____/\__/\___/_/
  3091. module.exports = {
  3092. view(vn){
  3093. return m('footer', [
  3094. m('p', m.trust('© 2017 <a href="./">Ethica Spinoza</a>'))
  3095. ]);
  3096. }
  3097. }
  3098. /***/ }),
  3099. /* 20 */
  3100. /***/ (function(module, exports) {
  3101. /**
  3102. * @Author: Bachir Soussi Chiadmi <bach>
  3103. * @Date: 12-09-2017
  3104. * @Email: bachir@figureslibres.io
  3105. * @Last modified by: bach
  3106. * @Last modified time: 12-09-2017
  3107. * @License: GPL-V3
  3108. */
  3109. // https://plainjs.com
  3110. module.exports = {
  3111. init(){
  3112. // console.log('UI init');
  3113. this.initStickyTitles();
  3114. },
  3115. initStickyTitles(){
  3116. // _____ __ _ __ __ _ __ __
  3117. // / ___// /_(_)____/ /____ __ / /_(_) /_/ /__
  3118. // \__ \/ __/ / ___/ //_/ / / / / __/ / __/ / _ \
  3119. // ___/ / /_/ / /__/ ,< / /_/ / / /_/ / /_/ / __/
  3120. // /____/\__/_/\___/_/|_|\__, / \__/_/\__/_/\___/
  3121. // /____/
  3122. // https://codepen.io/chrissp26/pen/gBrdo?editors=0010
  3123. // let header_height = $('header').height();
  3124. let header_height = document.getElementsByTagName('header')[0].clientHeight;
  3125. // console.log(header_height);
  3126. // create the stkd titles wrapper block
  3127. var stkd_wrapper = document.querySelector('.sticky-clone-wrapper');
  3128. if(!stkd_wrapper){
  3129. var stkd_wrapper = document.createElement('div');
  3130. stkd_wrapper.classList.add('sticky-clone-wrapper');
  3131. document.body.append(stkd_wrapper);
  3132. }
  3133. // get all part title
  3134. var part_titles = new Array();
  3135. Array.from(document.querySelectorAll('h1.part-title')).forEach(function(e){
  3136. e._part = e.getAttribute('part');
  3137. part_titles.push(e)
  3138. });
  3139. // console.log('part_titles', part_titles);
  3140. var stkd_part,
  3141. last_stkd_part = false,
  3142. subparts,
  3143. stkd_subpart,
  3144. last_stkd_subpart = false,
  3145. clone;
  3146. let OnScroll = function(event){
  3147. // console.log('on scrool', event);
  3148. stkd_part = false;
  3149. for (let i = part_titles.length-1; i >= 0; i--) {
  3150. if(part_titles[i].getBoundingClientRect().top < header_height){
  3151. stkd_part = part_titles[i];
  3152. // console.log("stkd_part");
  3153. break;
  3154. }
  3155. }
  3156. if (stkd_part) {
  3157. // console.log('got stkd_part', stkd_part._part);
  3158. if(stkd_part._part !== last_stkd_part._part){
  3159. // console.log('new sticky', stkd_part.innerHTML);
  3160. // clone only once
  3161. clone = stkd_part.cloneNode(true);
  3162. stkd_wrapper.innerHTML = '';
  3163. // fill stkd_wrapper
  3164. stkd_wrapper.appendChild(clone);
  3165. last_stkd_part = stkd_part;
  3166. // // get all subpart title only once
  3167. // let part_wrapper = stkd_part.parentNode;
  3168. // subparts = new Array();
  3169. // Array.from(part_wrapper.querySelectorAll('h2.title')).forEach(function(e){
  3170. // subparts.push(e)
  3171. // });
  3172. // // console.log('subparts', subparts);
  3173. }
  3174. // // subtitle
  3175. // stkd_subpart = false;
  3176. // for (let i = subparts.length-1; i >= 0; i--) {
  3177. // if(subparts[i].getBoundingClientRect().top < header_height + stkd_part.clientHeight){
  3178. // stkd_subpart = subparts[i];
  3179. // break;
  3180. // }
  3181. // }
  3182. //
  3183. // if (stkd_subpart){
  3184. // if( stkd_subpart.innerHTML !== last_stkd_subpart.innerHTML ){
  3185. // console.log("new stkd_subpart "+stkd_subpart.innerHTML);
  3186. // clone = stkd_subpart.cloneNode(true);
  3187. // // stkd_wrapper.lastChild.remove();
  3188. // stkd_wrapper.appendChild(clone);
  3189. // last_stkd_subpart = stkd_subpart;
  3190. // }
  3191. // }else{
  3192. // // stkd_wrapper.lastChild.remove();
  3193. // stkd_subpart = last_stkd_subpart = false;
  3194. // }
  3195. }else{
  3196. // empty stkd_wrapper
  3197. stkd_wrapper.innerHTML = '';
  3198. stkd_part = last_stkd_part = false;
  3199. }
  3200. };
  3201. //
  3202. // $window.on('scroll', OnScroll);
  3203. // console.log('window', window);
  3204. window.onscroll = OnScroll;
  3205. }
  3206. }
  3207. /***/ }),
  3208. /* 21 */
  3209. /***/ (function(module, exports, __webpack_require__) {
  3210. __webpack_require__(22);
  3211. module.exports = __webpack_require__(87);
  3212. /***/ }),
  3213. /* 22 */
  3214. /***/ (function(module, exports, __webpack_require__) {
  3215. /**
  3216. * @Author: Bachir Soussi Chiadmi <bach>
  3217. * @Date: 16-04-2017
  3218. * @Email: bachir@figureslibres.io
  3219. * @Last modified by: bach
  3220. * @Last modified time: 18-04-2017
  3221. * @License: GPL-V3
  3222. */
  3223. __webpack_require__(23);
  3224. __webpack_require__(24);
  3225. __webpack_require__(25);
  3226. __webpack_require__(26);
  3227. const m = __webpack_require__(1);
  3228. // var marked = require('marked');
  3229. // var _helpers = require('modules/helpers');
  3230. const _dbs = __webpack_require__(3);
  3231. const _i18n = __webpack_require__(9);
  3232. const _Header = __webpack_require__(10);
  3233. const _Footer = __webpack_require__(19);
  3234. const _ModeText = __webpack_require__(85);
  3235. const _ModeConnections = __webpack_require__(86);
  3236. var Layout = {
  3237. view(vn){
  3238. // console.log('Layout view : lang', vn.attrs.lang);
  3239. _i18n.setLang(vn.attrs.lang);
  3240. return [
  3241. m(_Header, vn.attrs),
  3242. vn.children,
  3243. m(_Footer, vn.attrs)
  3244. ]
  3245. }
  3246. }
  3247. function init(){
  3248. _dbs.load(function(){
  3249. console.log('init dbs callback');
  3250. console.log("Init _dbs.data", _dbs.data);
  3251. console.log("Init _dbs.data_byid", _dbs.data_byid);
  3252. console.log("Init _dbs.data_strct", _dbs.data_strct);
  3253. m.route.prefix("");
  3254. m.route(document.body, "/fr/connections", {
  3255. "/:lang/text": {
  3256. render(vn){
  3257. // console.log('Routing render : vn', vn);
  3258. return m(Layout, vn.attrs, m(_ModeText, vn.attrs));
  3259. }
  3260. },
  3261. "/:lang/connections": {
  3262. render(vn){
  3263. return m(Layout, vn.attrs, m(_ModeConnections, vn.attrs));
  3264. }
  3265. }
  3266. });
  3267. });
  3268. };
  3269. // ___
  3270. // / | ____ ____
  3271. // / /| | / __ \/ __ \
  3272. // / ___ |/ /_/ / /_/ /
  3273. // /_/ |_/ .___/ .___/
  3274. // /_/ /_/
  3275. // var _App = {
  3276. // view(){
  3277. // console.log('_App view', _lang);
  3278. // return [
  3279. // m('header', [
  3280. // m('h1', 'Ethica'),
  3281. // m('aside', {'id':"menus"}, m(_LangMenu) )
  3282. // ]),
  3283. // m(_Tree),
  3284. // m('footer', [
  3285. // m('p', m.trust('© 2017 <a href="./">Ethica Spinoza</a>'))
  3286. // ])
  3287. // ]
  3288. // }
  3289. // }
  3290. // _ _ __
  3291. // (_)___ (_) /_
  3292. // / / __ \/ / __/
  3293. // / / / / / / /_
  3294. // /_/_/ /_/_/\__/
  3295. init()
  3296. /***/ }),
  3297. /* 23 */
  3298. /***/ (function(module, exports) {
  3299. // removed by extract-text-webpack-plugin
  3300. /***/ }),
  3301. /* 24 */
  3302. /***/ (function(module, exports) {
  3303. // removed by extract-text-webpack-plugin
  3304. /***/ }),
  3305. /* 25 */
  3306. /***/ (function(module, exports) {
  3307. // removed by extract-text-webpack-plugin
  3308. /***/ }),
  3309. /* 26 */
  3310. /***/ (function(module, exports) {
  3311. // removed by extract-text-webpack-plugin
  3312. /***/ }),
  3313. /* 27 */
  3314. /***/ (function(module, exports, __webpack_require__) {
  3315. /* WEBPACK VAR INJECTION */(function(global) {var apply = Function.prototype.apply;
  3316. // DOM APIs, for completeness
  3317. exports.setTimeout = function() {
  3318. return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
  3319. };
  3320. exports.setInterval = function() {
  3321. return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
  3322. };
  3323. exports.clearTimeout =
  3324. exports.clearInterval = function(timeout) {
  3325. if (timeout) {
  3326. timeout.close();
  3327. }
  3328. };
  3329. function Timeout(id, clearFn) {
  3330. this._id = id;
  3331. this._clearFn = clearFn;
  3332. }
  3333. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  3334. Timeout.prototype.close = function() {
  3335. this._clearFn.call(window, this._id);
  3336. };
  3337. // Does not start the time, just sets up the members needed.
  3338. exports.enroll = function(item, msecs) {
  3339. clearTimeout(item._idleTimeoutId);
  3340. item._idleTimeout = msecs;
  3341. };
  3342. exports.unenroll = function(item) {
  3343. clearTimeout(item._idleTimeoutId);
  3344. item._idleTimeout = -1;
  3345. };
  3346. exports._unrefActive = exports.active = function(item) {
  3347. clearTimeout(item._idleTimeoutId);
  3348. var msecs = item._idleTimeout;
  3349. if (msecs >= 0) {
  3350. item._idleTimeoutId = setTimeout(function onTimeout() {
  3351. if (item._onTimeout)
  3352. item._onTimeout();
  3353. }, msecs);
  3354. }
  3355. };
  3356. // setimmediate attaches itself to the global object
  3357. __webpack_require__(28);
  3358. // On some exotic environments, it's not clear which object `setimmeidate` was
  3359. // able to install onto. Search each possibility in the same order as the
  3360. // `setimmediate` library.
  3361. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  3362. (typeof global !== "undefined" && global.setImmediate) ||
  3363. (this && this.setImmediate);
  3364. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  3365. (typeof global !== "undefined" && global.clearImmediate) ||
  3366. (this && this.clearImmediate);
  3367. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
  3368. /***/ }),
  3369. /* 28 */
  3370. /***/ (function(module, exports, __webpack_require__) {
  3371. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  3372. "use strict";
  3373. if (global.setImmediate) {
  3374. return;
  3375. }
  3376. var nextHandle = 1; // Spec says greater than zero
  3377. var tasksByHandle = {};
  3378. var currentlyRunningATask = false;
  3379. var doc = global.document;
  3380. var registerImmediate;
  3381. function setImmediate(callback) {
  3382. // Callback can either be a function or a string
  3383. if (typeof callback !== "function") {
  3384. callback = new Function("" + callback);
  3385. }
  3386. // Copy function arguments
  3387. var args = new Array(arguments.length - 1);
  3388. for (var i = 0; i < args.length; i++) {
  3389. args[i] = arguments[i + 1];
  3390. }
  3391. // Store and register the task
  3392. var task = { callback: callback, args: args };
  3393. tasksByHandle[nextHandle] = task;
  3394. registerImmediate(nextHandle);
  3395. return nextHandle++;
  3396. }
  3397. function clearImmediate(handle) {
  3398. delete tasksByHandle[handle];
  3399. }
  3400. function run(task) {
  3401. var callback = task.callback;
  3402. var args = task.args;
  3403. switch (args.length) {
  3404. case 0:
  3405. callback();
  3406. break;
  3407. case 1:
  3408. callback(args[0]);
  3409. break;
  3410. case 2:
  3411. callback(args[0], args[1]);
  3412. break;
  3413. case 3:
  3414. callback(args[0], args[1], args[2]);
  3415. break;
  3416. default:
  3417. callback.apply(undefined, args);
  3418. break;
  3419. }
  3420. }
  3421. function runIfPresent(handle) {
  3422. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  3423. // So if we're currently running a task, we'll need to delay this invocation.
  3424. if (currentlyRunningATask) {
  3425. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  3426. // "too much recursion" error.
  3427. setTimeout(runIfPresent, 0, handle);
  3428. } else {
  3429. var task = tasksByHandle[handle];
  3430. if (task) {
  3431. currentlyRunningATask = true;
  3432. try {
  3433. run(task);
  3434. } finally {
  3435. clearImmediate(handle);
  3436. currentlyRunningATask = false;
  3437. }
  3438. }
  3439. }
  3440. }
  3441. function installNextTickImplementation() {
  3442. registerImmediate = function(handle) {
  3443. process.nextTick(function () { runIfPresent(handle); });
  3444. };
  3445. }
  3446. function canUsePostMessage() {
  3447. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  3448. // where `global.postMessage` means something completely different and can't be used for this purpose.
  3449. if (global.postMessage && !global.importScripts) {
  3450. var postMessageIsAsynchronous = true;
  3451. var oldOnMessage = global.onmessage;
  3452. global.onmessage = function() {
  3453. postMessageIsAsynchronous = false;
  3454. };
  3455. global.postMessage("", "*");
  3456. global.onmessage = oldOnMessage;
  3457. return postMessageIsAsynchronous;
  3458. }
  3459. }
  3460. function installPostMessageImplementation() {
  3461. // Installs an event handler on `global` for the `message` event: see
  3462. // * https://developer.mozilla.org/en/DOM/window.postMessage
  3463. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  3464. var messagePrefix = "setImmediate$" + Math.random() + "$";
  3465. var onGlobalMessage = function(event) {
  3466. if (event.source === global &&
  3467. typeof event.data === "string" &&
  3468. event.data.indexOf(messagePrefix) === 0) {
  3469. runIfPresent(+event.data.slice(messagePrefix.length));
  3470. }
  3471. };
  3472. if (global.addEventListener) {
  3473. global.addEventListener("message", onGlobalMessage, false);
  3474. } else {
  3475. global.attachEvent("onmessage", onGlobalMessage);
  3476. }
  3477. registerImmediate = function(handle) {
  3478. global.postMessage(messagePrefix + handle, "*");
  3479. };
  3480. }
  3481. function installMessageChannelImplementation() {
  3482. var channel = new MessageChannel();
  3483. channel.port1.onmessage = function(event) {
  3484. var handle = event.data;
  3485. runIfPresent(handle);
  3486. };
  3487. registerImmediate = function(handle) {
  3488. channel.port2.postMessage(handle);
  3489. };
  3490. }
  3491. function installReadyStateChangeImplementation() {
  3492. var html = doc.documentElement;
  3493. registerImmediate = function(handle) {
  3494. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  3495. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  3496. var script = doc.createElement("script");
  3497. script.onreadystatechange = function () {
  3498. runIfPresent(handle);
  3499. script.onreadystatechange = null;
  3500. html.removeChild(script);
  3501. script = null;
  3502. };
  3503. html.appendChild(script);
  3504. };
  3505. }
  3506. function installSetTimeoutImplementation() {
  3507. registerImmediate = function(handle) {
  3508. setTimeout(runIfPresent, 0, handle);
  3509. };
  3510. }
  3511. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  3512. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  3513. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  3514. // Don't get fooled by e.g. browserify environments.
  3515. if ({}.toString.call(global.process) === "[object process]") {
  3516. // For Node.js before 0.9
  3517. installNextTickImplementation();
  3518. } else if (canUsePostMessage()) {
  3519. // For non-IE10 modern browsers
  3520. installPostMessageImplementation();
  3521. } else if (global.MessageChannel) {
  3522. // For web workers, where supported
  3523. installMessageChannelImplementation();
  3524. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  3525. // For IE 6–8
  3526. installReadyStateChangeImplementation();
  3527. } else {
  3528. // For older browsers
  3529. installSetTimeoutImplementation();
  3530. }
  3531. attachTo.setImmediate = setImmediate;
  3532. attachTo.clearImmediate = clearImmediate;
  3533. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  3534. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(29)))
  3535. /***/ }),
  3536. /* 29 */
  3537. /***/ (function(module, exports) {
  3538. // shim for using process in browser
  3539. var process = module.exports = {};
  3540. // cached from whatever global is present so that test runners that stub it
  3541. // don't break things. But we need to wrap it in a try catch in case it is
  3542. // wrapped in strict mode code which doesn't define any globals. It's inside a
  3543. // function because try/catches deoptimize in certain engines.
  3544. var cachedSetTimeout;
  3545. var cachedClearTimeout;
  3546. function defaultSetTimout() {
  3547. throw new Error('setTimeout has not been defined');
  3548. }
  3549. function defaultClearTimeout () {
  3550. throw new Error('clearTimeout has not been defined');
  3551. }
  3552. (function () {
  3553. try {
  3554. if (typeof setTimeout === 'function') {
  3555. cachedSetTimeout = setTimeout;
  3556. } else {
  3557. cachedSetTimeout = defaultSetTimout;
  3558. }
  3559. } catch (e) {
  3560. cachedSetTimeout = defaultSetTimout;
  3561. }
  3562. try {
  3563. if (typeof clearTimeout === 'function') {
  3564. cachedClearTimeout = clearTimeout;
  3565. } else {
  3566. cachedClearTimeout = defaultClearTimeout;
  3567. }
  3568. } catch (e) {
  3569. cachedClearTimeout = defaultClearTimeout;
  3570. }
  3571. } ())
  3572. function runTimeout(fun) {
  3573. if (cachedSetTimeout === setTimeout) {
  3574. //normal enviroments in sane situations
  3575. return setTimeout(fun, 0);
  3576. }
  3577. // if setTimeout wasn't available but was latter defined
  3578. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  3579. cachedSetTimeout = setTimeout;
  3580. return setTimeout(fun, 0);
  3581. }
  3582. try {
  3583. // when when somebody has screwed with setTimeout but no I.E. maddness
  3584. return cachedSetTimeout(fun, 0);
  3585. } catch(e){
  3586. try {
  3587. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  3588. return cachedSetTimeout.call(null, fun, 0);
  3589. } catch(e){
  3590. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
  3591. return cachedSetTimeout.call(this, fun, 0);
  3592. }
  3593. }
  3594. }
  3595. function runClearTimeout(marker) {
  3596. if (cachedClearTimeout === clearTimeout) {
  3597. //normal enviroments in sane situations
  3598. return clearTimeout(marker);
  3599. }
  3600. // if clearTimeout wasn't available but was latter defined
  3601. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  3602. cachedClearTimeout = clearTimeout;
  3603. return clearTimeout(marker);
  3604. }
  3605. try {
  3606. // when when somebody has screwed with setTimeout but no I.E. maddness
  3607. return cachedClearTimeout(marker);
  3608. } catch (e){
  3609. try {
  3610. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  3611. return cachedClearTimeout.call(null, marker);
  3612. } catch (e){
  3613. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
  3614. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  3615. return cachedClearTimeout.call(this, marker);
  3616. }
  3617. }
  3618. }
  3619. var queue = [];
  3620. var draining = false;
  3621. var currentQueue;
  3622. var queueIndex = -1;
  3623. function cleanUpNextTick() {
  3624. if (!draining || !currentQueue) {
  3625. return;
  3626. }
  3627. draining = false;
  3628. if (currentQueue.length) {
  3629. queue = currentQueue.concat(queue);
  3630. } else {
  3631. queueIndex = -1;
  3632. }
  3633. if (queue.length) {
  3634. drainQueue();
  3635. }
  3636. }
  3637. function drainQueue() {
  3638. if (draining) {
  3639. return;
  3640. }
  3641. var timeout = runTimeout(cleanUpNextTick);
  3642. draining = true;
  3643. var len = queue.length;
  3644. while(len) {
  3645. currentQueue = queue;
  3646. queue = [];
  3647. while (++queueIndex < len) {
  3648. if (currentQueue) {
  3649. currentQueue[queueIndex].run();
  3650. }
  3651. }
  3652. queueIndex = -1;
  3653. len = queue.length;
  3654. }
  3655. currentQueue = null;
  3656. draining = false;
  3657. runClearTimeout(timeout);
  3658. }
  3659. process.nextTick = function (fun) {
  3660. var args = new Array(arguments.length - 1);
  3661. if (arguments.length > 1) {
  3662. for (var i = 1; i < arguments.length; i++) {
  3663. args[i - 1] = arguments[i];
  3664. }
  3665. }
  3666. queue.push(new Item(fun, args));
  3667. if (queue.length === 1 && !draining) {
  3668. runTimeout(drainQueue);
  3669. }
  3670. };
  3671. // v8 likes predictible objects
  3672. function Item(fun, array) {
  3673. this.fun = fun;
  3674. this.array = array;
  3675. }
  3676. Item.prototype.run = function () {
  3677. this.fun.apply(null, this.array);
  3678. };
  3679. process.title = 'browser';
  3680. process.browser = true;
  3681. process.env = {};
  3682. process.argv = [];
  3683. process.version = ''; // empty string to avoid regexp issues
  3684. process.versions = {};
  3685. function noop() {}
  3686. process.on = noop;
  3687. process.addListener = noop;
  3688. process.once = noop;
  3689. process.off = noop;
  3690. process.removeListener = noop;
  3691. process.removeAllListeners = noop;
  3692. process.emit = noop;
  3693. process.prependListener = noop;
  3694. process.prependOnceListener = noop;
  3695. process.listeners = function (name) { return [] }
  3696. process.binding = function (name) {
  3697. throw new Error('process.binding is not supported');
  3698. };
  3699. process.cwd = function () { return '/' };
  3700. process.chdir = function (dir) {
  3701. throw new Error('process.chdir is not supported');
  3702. };
  3703. process.umask = function() { return 0; };
  3704. /***/ }),
  3705. /* 30 */
  3706. /***/ (function(module, exports, __webpack_require__) {
  3707. "use strict";
  3708. // Main parser class
  3709. var utils = __webpack_require__(0);
  3710. var helpers = __webpack_require__(38);
  3711. var Renderer = __webpack_require__(42);
  3712. var ParserCore = __webpack_require__(43);
  3713. var ParserBlock = __webpack_require__(51);
  3714. var ParserInline = __webpack_require__(65);
  3715. var LinkifyIt = __webpack_require__(78);
  3716. var mdurl = __webpack_require__(12);
  3717. var punycode = __webpack_require__(80);
  3718. var config = {
  3719. 'default': __webpack_require__(82),
  3720. zero: __webpack_require__(83),
  3721. commonmark: __webpack_require__(84)
  3722. };
  3723. ////////////////////////////////////////////////////////////////////////////////
  3724. //
  3725. // This validator can prohibit more than really needed to prevent XSS. It's a
  3726. // tradeoff to keep code simple and to be secure by default.
  3727. //
  3728. // If you need different setup - override validator method as you wish. Or
  3729. // replace it with dummy function and use external sanitizer.
  3730. //
  3731. var BAD_PROTO_RE = /^(vbscript|javascript|file|data):/;
  3732. var GOOD_DATA_RE = /^data:image\/(gif|png|jpeg|webp);/;
  3733. function validateLink(url) {
  3734. // url should be normalized at this point, and existing entities are decoded
  3735. var str = url.trim().toLowerCase();
  3736. return BAD_PROTO_RE.test(str) ? (GOOD_DATA_RE.test(str) ? true : false) : true;
  3737. }
  3738. ////////////////////////////////////////////////////////////////////////////////
  3739. var RECODE_HOSTNAME_FOR = [ 'http:', 'https:', 'mailto:' ];
  3740. function normalizeLink(url) {
  3741. var parsed = mdurl.parse(url, true);
  3742. if (parsed.hostname) {
  3743. // Encode hostnames in urls like:
  3744. // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`
  3745. //
  3746. // We don't encode unknown schemas, because it's likely that we encode
  3747. // something we shouldn't (e.g. `skype:name` treated as `skype:host`)
  3748. //
  3749. if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {
  3750. try {
  3751. parsed.hostname = punycode.toASCII(parsed.hostname);
  3752. } catch (er) { /**/ }
  3753. }
  3754. }
  3755. return mdurl.encode(mdurl.format(parsed));
  3756. }
  3757. function normalizeLinkText(url) {
  3758. var parsed = mdurl.parse(url, true);
  3759. if (parsed.hostname) {
  3760. // Encode hostnames in urls like:
  3761. // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`
  3762. //
  3763. // We don't encode unknown schemas, because it's likely that we encode
  3764. // something we shouldn't (e.g. `skype:name` treated as `skype:host`)
  3765. //
  3766. if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {
  3767. try {
  3768. parsed.hostname = punycode.toUnicode(parsed.hostname);
  3769. } catch (er) { /**/ }
  3770. }
  3771. }
  3772. return mdurl.decode(mdurl.format(parsed));
  3773. }
  3774. /**
  3775. * class MarkdownIt
  3776. *
  3777. * Main parser/renderer class.
  3778. *
  3779. * ##### Usage
  3780. *
  3781. * ```javascript
  3782. * // node.js, "classic" way:
  3783. * var MarkdownIt = require('markdown-it'),
  3784. * md = new MarkdownIt();
  3785. * var result = md.render('# markdown-it rulezz!');
  3786. *
  3787. * // node.js, the same, but with sugar:
  3788. * var md = require('markdown-it')();
  3789. * var result = md.render('# markdown-it rulezz!');
  3790. *
  3791. * // browser without AMD, added to "window" on script load
  3792. * // Note, there are no dash.
  3793. * var md = window.markdownit();
  3794. * var result = md.render('# markdown-it rulezz!');
  3795. * ```
  3796. *
  3797. * Single line rendering, without paragraph wrap:
  3798. *
  3799. * ```javascript
  3800. * var md = require('markdown-it')();
  3801. * var result = md.renderInline('__markdown-it__ rulezz!');
  3802. * ```
  3803. **/
  3804. /**
  3805. * new MarkdownIt([presetName, options])
  3806. * - presetName (String): optional, `commonmark` / `zero`
  3807. * - options (Object)
  3808. *
  3809. * Creates parser instanse with given config. Can be called without `new`.
  3810. *
  3811. * ##### presetName
  3812. *
  3813. * MarkdownIt provides named presets as a convenience to quickly
  3814. * enable/disable active syntax rules and options for common use cases.
  3815. *
  3816. * - ["commonmark"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/commonmark.js) -
  3817. * configures parser to strict [CommonMark](http://commonmark.org/) mode.
  3818. * - [default](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/default.js) -
  3819. * similar to GFM, used when no preset name given. Enables all available rules,
  3820. * but still without html, typographer & autolinker.
  3821. * - ["zero"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/zero.js) -
  3822. * all rules disabled. Useful to quickly setup your config via `.enable()`.
  3823. * For example, when you need only `bold` and `italic` markup and nothing else.
  3824. *
  3825. * ##### options:
  3826. *
  3827. * - __html__ - `false`. Set `true` to enable HTML tags in source. Be careful!
  3828. * That's not safe! You may need external sanitizer to protect output from XSS.
  3829. * It's better to extend features via plugins, instead of enabling HTML.
  3830. * - __xhtmlOut__ - `false`. Set `true` to add '/' when closing single tags
  3831. * (`<br />`). This is needed only for full CommonMark compatibility. In real
  3832. * world you will need HTML output.
  3833. * - __breaks__ - `false`. Set `true` to convert `\n` in paragraphs into `<br>`.
  3834. * - __langPrefix__ - `language-`. CSS language class prefix for fenced blocks.
  3835. * Can be useful for external highlighters.
  3836. * - __linkify__ - `false`. Set `true` to autoconvert URL-like text to links.
  3837. * - __typographer__ - `false`. Set `true` to enable [some language-neutral
  3838. * replacement](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js) +
  3839. * quotes beautification (smartquotes).
  3840. * - __quotes__ - `“”‘’`, String or Array. Double + single quotes replacement
  3841. * pairs, when typographer enabled and smartquotes on. For example, you can
  3842. * use `'«»„“'` for Russian, `'„“‚‘'` for German, and
  3843. * `['«\xA0', '\xA0»', '‹\xA0', '\xA0›']` for French (including nbsp).
  3844. * - __highlight__ - `null`. Highlighter function for fenced code blocks.
  3845. * Highlighter `function (str, lang)` should return escaped HTML. It can also
  3846. * return empty string if the source was not changed and should be escaped
  3847. * externaly. If result starts with <pre... internal wrapper is skipped.
  3848. *
  3849. * ##### Example
  3850. *
  3851. * ```javascript
  3852. * // commonmark mode
  3853. * var md = require('markdown-it')('commonmark');
  3854. *
  3855. * // default mode
  3856. * var md = require('markdown-it')();
  3857. *
  3858. * // enable everything
  3859. * var md = require('markdown-it')({
  3860. * html: true,
  3861. * linkify: true,
  3862. * typographer: true
  3863. * });
  3864. * ```
  3865. *
  3866. * ##### Syntax highlighting
  3867. *
  3868. * ```js
  3869. * var hljs = require('highlight.js') // https://highlightjs.org/
  3870. *
  3871. * var md = require('markdown-it')({
  3872. * highlight: function (str, lang) {
  3873. * if (lang && hljs.getLanguage(lang)) {
  3874. * try {
  3875. * return hljs.highlight(lang, str, true).value;
  3876. * } catch (__) {}
  3877. * }
  3878. *
  3879. * return ''; // use external default escaping
  3880. * }
  3881. * });
  3882. * ```
  3883. *
  3884. * Or with full wrapper override (if you need assign class to `<pre>`):
  3885. *
  3886. * ```javascript
  3887. * var hljs = require('highlight.js') // https://highlightjs.org/
  3888. *
  3889. * // Actual default values
  3890. * var md = require('markdown-it')({
  3891. * highlight: function (str, lang) {
  3892. * if (lang && hljs.getLanguage(lang)) {
  3893. * try {
  3894. * return '<pre class="hljs"><code>' +
  3895. * hljs.highlight(lang, str, true).value +
  3896. * '</code></pre>';
  3897. * } catch (__) {}
  3898. * }
  3899. *
  3900. * return '<pre class="hljs"><code>' + md.utils.escapeHtml(str) + '</code></pre>';
  3901. * }
  3902. * });
  3903. * ```
  3904. *
  3905. **/
  3906. function MarkdownIt(presetName, options) {
  3907. if (!(this instanceof MarkdownIt)) {
  3908. return new MarkdownIt(presetName, options);
  3909. }
  3910. if (!options) {
  3911. if (!utils.isString(presetName)) {
  3912. options = presetName || {};
  3913. presetName = 'default';
  3914. }
  3915. }
  3916. /**
  3917. * MarkdownIt#inline -> ParserInline
  3918. *
  3919. * Instance of [[ParserInline]]. You may need it to add new rules when
  3920. * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
  3921. * [[MarkdownIt.enable]].
  3922. **/
  3923. this.inline = new ParserInline();
  3924. /**
  3925. * MarkdownIt#block -> ParserBlock
  3926. *
  3927. * Instance of [[ParserBlock]]. You may need it to add new rules when
  3928. * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
  3929. * [[MarkdownIt.enable]].
  3930. **/
  3931. this.block = new ParserBlock();
  3932. /**
  3933. * MarkdownIt#core -> Core
  3934. *
  3935. * Instance of [[Core]] chain executor. You may need it to add new rules when
  3936. * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
  3937. * [[MarkdownIt.enable]].
  3938. **/
  3939. this.core = new ParserCore();
  3940. /**
  3941. * MarkdownIt#renderer -> Renderer
  3942. *
  3943. * Instance of [[Renderer]]. Use it to modify output look. Or to add rendering
  3944. * rules for new token types, generated by plugins.
  3945. *
  3946. * ##### Example
  3947. *
  3948. * ```javascript
  3949. * var md = require('markdown-it')();
  3950. *
  3951. * function myToken(tokens, idx, options, env, self) {
  3952. * //...
  3953. * return result;
  3954. * };
  3955. *
  3956. * md.renderer.rules['my_token'] = myToken
  3957. * ```
  3958. *
  3959. * See [[Renderer]] docs and [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js).
  3960. **/
  3961. this.renderer = new Renderer();
  3962. /**
  3963. * MarkdownIt#linkify -> LinkifyIt
  3964. *
  3965. * [linkify-it](https://github.com/markdown-it/linkify-it) instance.
  3966. * Used by [linkify](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js)
  3967. * rule.
  3968. **/
  3969. this.linkify = new LinkifyIt();
  3970. /**
  3971. * MarkdownIt#validateLink(url) -> Boolean
  3972. *
  3973. * Link validation function. CommonMark allows too much in links. By default
  3974. * we disable `javascript:`, `vbscript:`, `file:` schemas, and almost all `data:...` schemas
  3975. * except some embedded image types.
  3976. *
  3977. * You can change this behaviour:
  3978. *
  3979. * ```javascript
  3980. * var md = require('markdown-it')();
  3981. * // enable everything
  3982. * md.validateLink = function () { return true; }
  3983. * ```
  3984. **/
  3985. this.validateLink = validateLink;
  3986. /**
  3987. * MarkdownIt#normalizeLink(url) -> String
  3988. *
  3989. * Function used to encode link url to a machine-readable format,
  3990. * which includes url-encoding, punycode, etc.
  3991. **/
  3992. this.normalizeLink = normalizeLink;
  3993. /**
  3994. * MarkdownIt#normalizeLinkText(url) -> String
  3995. *
  3996. * Function used to decode link url to a human-readable format`
  3997. **/
  3998. this.normalizeLinkText = normalizeLinkText;
  3999. // Expose utils & helpers for easy acces from plugins
  4000. /**
  4001. * MarkdownIt#utils -> utils
  4002. *
  4003. * Assorted utility functions, useful to write plugins. See details
  4004. * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/common/utils.js).
  4005. **/
  4006. this.utils = utils;
  4007. /**
  4008. * MarkdownIt#helpers -> helpers
  4009. *
  4010. * Link components parser functions, useful to write plugins. See details
  4011. * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/helpers).
  4012. **/
  4013. this.helpers = utils.assign({}, helpers);
  4014. this.options = {};
  4015. this.configure(presetName);
  4016. if (options) { this.set(options); }
  4017. }
  4018. /** chainable
  4019. * MarkdownIt.set(options)
  4020. *
  4021. * Set parser options (in the same format as in constructor). Probably, you
  4022. * will never need it, but you can change options after constructor call.
  4023. *
  4024. * ##### Example
  4025. *
  4026. * ```javascript
  4027. * var md = require('markdown-it')()
  4028. * .set({ html: true, breaks: true })
  4029. * .set({ typographer, true });
  4030. * ```
  4031. *
  4032. * __Note:__ To achieve the best possible performance, don't modify a
  4033. * `markdown-it` instance options on the fly. If you need multiple configurations
  4034. * it's best to create multiple instances and initialize each with separate
  4035. * config.
  4036. **/
  4037. MarkdownIt.prototype.set = function (options) {
  4038. utils.assign(this.options, options);
  4039. return this;
  4040. };
  4041. /** chainable, internal
  4042. * MarkdownIt.configure(presets)
  4043. *
  4044. * Batch load of all options and compenent settings. This is internal method,
  4045. * and you probably will not need it. But if you with - see available presets
  4046. * and data structure [here](https://github.com/markdown-it/markdown-it/tree/master/lib/presets)
  4047. *
  4048. * We strongly recommend to use presets instead of direct config loads. That
  4049. * will give better compatibility with next versions.
  4050. **/
  4051. MarkdownIt.prototype.configure = function (presets) {
  4052. var self = this, presetName;
  4053. if (utils.isString(presets)) {
  4054. presetName = presets;
  4055. presets = config[presetName];
  4056. if (!presets) { throw new Error('Wrong `markdown-it` preset "' + presetName + '", check name'); }
  4057. }
  4058. if (!presets) { throw new Error('Wrong `markdown-it` preset, can\'t be empty'); }
  4059. if (presets.options) { self.set(presets.options); }
  4060. if (presets.components) {
  4061. Object.keys(presets.components).forEach(function (name) {
  4062. if (presets.components[name].rules) {
  4063. self[name].ruler.enableOnly(presets.components[name].rules);
  4064. }
  4065. if (presets.components[name].rules2) {
  4066. self[name].ruler2.enableOnly(presets.components[name].rules2);
  4067. }
  4068. });
  4069. }
  4070. return this;
  4071. };
  4072. /** chainable
  4073. * MarkdownIt.enable(list, ignoreInvalid)
  4074. * - list (String|Array): rule name or list of rule names to enable
  4075. * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
  4076. *
  4077. * Enable list or rules. It will automatically find appropriate components,
  4078. * containing rules with given names. If rule not found, and `ignoreInvalid`
  4079. * not set - throws exception.
  4080. *
  4081. * ##### Example
  4082. *
  4083. * ```javascript
  4084. * var md = require('markdown-it')()
  4085. * .enable(['sub', 'sup'])
  4086. * .disable('smartquotes');
  4087. * ```
  4088. **/
  4089. MarkdownIt.prototype.enable = function (list, ignoreInvalid) {
  4090. var result = [];
  4091. if (!Array.isArray(list)) { list = [ list ]; }
  4092. [ 'core', 'block', 'inline' ].forEach(function (chain) {
  4093. result = result.concat(this[chain].ruler.enable(list, true));
  4094. }, this);
  4095. result = result.concat(this.inline.ruler2.enable(list, true));
  4096. var missed = list.filter(function (name) { return result.indexOf(name) < 0; });
  4097. if (missed.length && !ignoreInvalid) {
  4098. throw new Error('MarkdownIt. Failed to enable unknown rule(s): ' + missed);
  4099. }
  4100. return this;
  4101. };
  4102. /** chainable
  4103. * MarkdownIt.disable(list, ignoreInvalid)
  4104. * - list (String|Array): rule name or list of rule names to disable.
  4105. * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
  4106. *
  4107. * The same as [[MarkdownIt.enable]], but turn specified rules off.
  4108. **/
  4109. MarkdownIt.prototype.disable = function (list, ignoreInvalid) {
  4110. var result = [];
  4111. if (!Array.isArray(list)) { list = [ list ]; }
  4112. [ 'core', 'block', 'inline' ].forEach(function (chain) {
  4113. result = result.concat(this[chain].ruler.disable(list, true));
  4114. }, this);
  4115. result = result.concat(this.inline.ruler2.disable(list, true));
  4116. var missed = list.filter(function (name) { return result.indexOf(name) < 0; });
  4117. if (missed.length && !ignoreInvalid) {
  4118. throw new Error('MarkdownIt. Failed to disable unknown rule(s): ' + missed);
  4119. }
  4120. return this;
  4121. };
  4122. /** chainable
  4123. * MarkdownIt.use(plugin, params)
  4124. *
  4125. * Load specified plugin with given params into current parser instance.
  4126. * It's just a sugar to call `plugin(md, params)` with curring.
  4127. *
  4128. * ##### Example
  4129. *
  4130. * ```javascript
  4131. * var iterator = require('markdown-it-for-inline');
  4132. * var md = require('markdown-it')()
  4133. * .use(iterator, 'foo_replace', 'text', function (tokens, idx) {
  4134. * tokens[idx].content = tokens[idx].content.replace(/foo/g, 'bar');
  4135. * });
  4136. * ```
  4137. **/
  4138. MarkdownIt.prototype.use = function (plugin /*, params, ... */) {
  4139. var args = [ this ].concat(Array.prototype.slice.call(arguments, 1));
  4140. plugin.apply(plugin, args);
  4141. return this;
  4142. };
  4143. /** internal
  4144. * MarkdownIt.parse(src, env) -> Array
  4145. * - src (String): source string
  4146. * - env (Object): environment sandbox
  4147. *
  4148. * Parse input string and returns list of block tokens (special token type
  4149. * "inline" will contain list of inline tokens). You should not call this
  4150. * method directly, until you write custom renderer (for example, to produce
  4151. * AST).
  4152. *
  4153. * `env` is used to pass data between "distributed" rules and return additional
  4154. * metadata like reference info, needed for the renderer. It also can be used to
  4155. * inject data in specific cases. Usually, you will be ok to pass `{}`,
  4156. * and then pass updated object to renderer.
  4157. **/
  4158. MarkdownIt.prototype.parse = function (src, env) {
  4159. if (typeof src !== 'string') {
  4160. throw new Error('Input data should be a String');
  4161. }
  4162. var state = new this.core.State(src, this, env);
  4163. this.core.process(state);
  4164. return state.tokens;
  4165. };
  4166. /**
  4167. * MarkdownIt.render(src [, env]) -> String
  4168. * - src (String): source string
  4169. * - env (Object): environment sandbox
  4170. *
  4171. * Render markdown string into html. It does all magic for you :).
  4172. *
  4173. * `env` can be used to inject additional metadata (`{}` by default).
  4174. * But you will not need it with high probability. See also comment
  4175. * in [[MarkdownIt.parse]].
  4176. **/
  4177. MarkdownIt.prototype.render = function (src, env) {
  4178. env = env || {};
  4179. return this.renderer.render(this.parse(src, env), this.options, env);
  4180. };
  4181. /** internal
  4182. * MarkdownIt.parseInline(src, env) -> Array
  4183. * - src (String): source string
  4184. * - env (Object): environment sandbox
  4185. *
  4186. * The same as [[MarkdownIt.parse]] but skip all block rules. It returns the
  4187. * block tokens list with the single `inline` element, containing parsed inline
  4188. * tokens in `children` property. Also updates `env` object.
  4189. **/
  4190. MarkdownIt.prototype.parseInline = function (src, env) {
  4191. var state = new this.core.State(src, this, env);
  4192. state.inlineMode = true;
  4193. this.core.process(state);
  4194. return state.tokens;
  4195. };
  4196. /**
  4197. * MarkdownIt.renderInline(src [, env]) -> String
  4198. * - src (String): source string
  4199. * - env (Object): environment sandbox
  4200. *
  4201. * Similar to [[MarkdownIt.render]] but for single paragraph content. Result
  4202. * will NOT be wrapped into `<p>` tags.
  4203. **/
  4204. MarkdownIt.prototype.renderInline = function (src, env) {
  4205. env = env || {};
  4206. return this.renderer.render(this.parseInline(src, env), this.options, env);
  4207. };
  4208. module.exports = MarkdownIt;
  4209. /***/ }),
  4210. /* 31 */
  4211. /***/ (function(module, exports) {
  4212. module.exports = {"Aacute":"Á","aacute":"á","Abreve":"Ă","abreve":"ă","ac":"∾","acd":"∿","acE":"∾̳","Acirc":"Â","acirc":"â","acute":"´","Acy":"А","acy":"а","AElig":"Æ","aelig":"æ","af":"⁡","Afr":"𝔄","afr":"𝔞","Agrave":"À","agrave":"à","alefsym":"ℵ","aleph":"ℵ","Alpha":"Α","alpha":"α","Amacr":"Ā","amacr":"ā","amalg":"⨿","amp":"&","AMP":"&","andand":"⩕","And":"⩓","and":"∧","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angmsd":"∡","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"Å","angzarr":"⍼","Aogon":"Ą","aogon":"ą","Aopf":"𝔸","aopf":"𝕒","apacir":"⩯","ap":"≈","apE":"⩰","ape":"≊","apid":"≋","apos":"'","ApplyFunction":"⁡","approx":"≈","approxeq":"≊","Aring":"Å","aring":"å","Ascr":"𝒜","ascr":"𝒶","Assign":"≔","ast":"*","asymp":"≈","asympeq":"≍","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","awconint":"∳","awint":"⨑","backcong":"≌","backepsilon":"϶","backprime":"‵","backsim":"∽","backsimeq":"⋍","Backslash":"∖","Barv":"⫧","barvee":"⊽","barwed":"⌅","Barwed":"⌆","barwedge":"⌅","bbrk":"⎵","bbrktbrk":"⎶","bcong":"≌","Bcy":"Б","bcy":"б","bdquo":"„","becaus":"∵","because":"∵","Because":"∵","bemptyv":"⦰","bepsi":"϶","bernou":"ℬ","Bernoullis":"ℬ","Beta":"Β","beta":"β","beth":"ℶ","between":"≬","Bfr":"𝔅","bfr":"𝔟","bigcap":"⋂","bigcirc":"◯","bigcup":"⋃","bigodot":"⨀","bigoplus":"⨁","bigotimes":"⨂","bigsqcup":"⨆","bigstar":"★","bigtriangledown":"▽","bigtriangleup":"△","biguplus":"⨄","bigvee":"⋁","bigwedge":"⋀","bkarow":"⤍","blacklozenge":"⧫","blacksquare":"▪","blacktriangle":"▴","blacktriangledown":"▾","blacktriangleleft":"◂","blacktriangleright":"▸","blank":"␣","blk12":"▒","blk14":"░","blk34":"▓","block":"█","bne":"=⃥","bnequiv":"≡⃥","bNot":"⫭","bnot":"⌐","Bopf":"𝔹","bopf":"𝕓","bot":"⊥","bottom":"⊥","bowtie":"⋈","boxbox":"⧉","boxdl":"┐","boxdL":"╕","boxDl":"╖","boxDL":"╗","boxdr":"┌","boxdR":"╒","boxDr":"╓","boxDR":"╔","boxh":"─","boxH":"═","boxhd":"┬","boxHd":"╤","boxhD":"╥","boxHD":"╦","boxhu":"┴","boxHu":"╧","boxhU":"╨","boxHU":"╩","boxminus":"⊟","boxplus":"⊞","boxtimes":"⊠","boxul":"┘","boxuL":"╛","boxUl":"╜","boxUL":"╝","boxur":"└","boxuR":"╘","boxUr":"╙","boxUR":"╚","boxv":"│","boxV":"║","boxvh":"┼","boxvH":"╪","boxVh":"╫","boxVH":"╬","boxvl":"┤","boxvL":"╡","boxVl":"╢","boxVL":"╣","boxvr":"├","boxvR":"╞","boxVr":"╟","boxVR":"╠","bprime":"‵","breve":"˘","Breve":"˘","brvbar":"¦","bscr":"𝒷","Bscr":"ℬ","bsemi":"⁏","bsim":"∽","bsime":"⋍","bsolb":"⧅","bsol":"\\","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","Bumpeq":"≎","bumpeq":"≏","Cacute":"Ć","cacute":"ć","capand":"⩄","capbrcup":"⩉","capcap":"⩋","cap":"∩","Cap":"⋒","capcup":"⩇","capdot":"⩀","CapitalDifferentialD":"ⅅ","caps":"∩︀","caret":"⁁","caron":"ˇ","Cayleys":"ℭ","ccaps":"⩍","Ccaron":"Č","ccaron":"č","Ccedil":"Ç","ccedil":"ç","Ccirc":"Ĉ","ccirc":"ĉ","Cconint":"∰","ccups":"⩌","ccupssm":"⩐","Cdot":"Ċ","cdot":"ċ","cedil":"¸","Cedilla":"¸","cemptyv":"⦲","cent":"¢","centerdot":"·","CenterDot":"·","cfr":"𝔠","Cfr":"ℭ","CHcy":"Ч","chcy":"ч","check":"✓","checkmark":"✓","Chi":"Χ","chi":"χ","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","CircleDot":"⊙","circledR":"®","circledS":"Ⓢ","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","cir":"○","cirE":"⧃","cire":"≗","cirfnint":"⨐","cirmid":"⫯","cirscir":"⧂","ClockwiseContourIntegral":"∲","CloseCurlyDoubleQuote":"”","CloseCurlyQuote":"’","clubs":"♣","clubsuit":"♣","colon":":","Colon":"∷","Colone":"⩴","colone":"≔","coloneq":"≔","comma":",","commat":"@","comp":"∁","compfn":"∘","complement":"∁","complexes":"ℂ","cong":"≅","congdot":"⩭","Congruent":"≡","conint":"∮","Conint":"∯","ContourIntegral":"∮","copf":"𝕔","Copf":"ℂ","coprod":"∐","Coproduct":"∐","copy":"©","COPY":"©","copysr":"℗","CounterClockwiseContourIntegral":"∳","crarr":"↵","cross":"✗","Cross":"⨯","Cscr":"𝒞","cscr":"𝒸","csub":"⫏","csube":"⫑","csup":"⫐","csupe":"⫒","ctdot":"⋯","cudarrl":"⤸","cudarrr":"⤵","cuepr":"⋞","cuesc":"⋟","cularr":"↶","cularrp":"⤽","cupbrcap":"⩈","cupcap":"⩆","CupCap":"≍","cup":"∪","Cup":"⋓","cupcup":"⩊","cupdot":"⊍","cupor":"⩅","cups":"∪︀","curarr":"↷","curarrm":"⤼","curlyeqprec":"⋞","curlyeqsucc":"⋟","curlyvee":"⋎","curlywedge":"⋏","curren":"¤","curvearrowleft":"↶","curvearrowright":"↷","cuvee":"⋎","cuwed":"⋏","cwconint":"∲","cwint":"∱","cylcty":"⌭","dagger":"†","Dagger":"‡","daleth":"ℸ","darr":"↓","Darr":"↡","dArr":"⇓","dash":"‐","Dashv":"⫤","dashv":"⊣","dbkarow":"⤏","dblac":"˝","Dcaron":"Ď","dcaron":"ď","Dcy":"Д","dcy":"д","ddagger":"‡","ddarr":"⇊","DD":"ⅅ","dd":"ⅆ","DDotrahd":"⤑","ddotseq":"⩷","deg":"°","Del":"∇","Delta":"Δ","delta":"δ","demptyv":"⦱","dfisht":"⥿","Dfr":"𝔇","dfr":"𝔡","dHar":"⥥","dharl":"⇃","dharr":"⇂","DiacriticalAcute":"´","DiacriticalDot":"˙","DiacriticalDoubleAcute":"˝","DiacriticalGrave":"`","DiacriticalTilde":"˜","diam":"⋄","diamond":"⋄","Diamond":"⋄","diamondsuit":"♦","diams":"♦","die":"¨","DifferentialD":"ⅆ","digamma":"ϝ","disin":"⋲","div":"÷","divide":"÷","divideontimes":"⋇","divonx":"⋇","DJcy":"Ђ","djcy":"ђ","dlcorn":"⌞","dlcrop":"⌍","dollar":"$","Dopf":"𝔻","dopf":"𝕕","Dot":"¨","dot":"˙","DotDot":"⃜","doteq":"≐","doteqdot":"≑","DotEqual":"≐","dotminus":"∸","dotplus":"∔","dotsquare":"⊡","doublebarwedge":"⌆","DoubleContourIntegral":"∯","DoubleDot":"¨","DoubleDownArrow":"⇓","DoubleLeftArrow":"⇐","DoubleLeftRightArrow":"⇔","DoubleLeftTee":"⫤","DoubleLongLeftArrow":"⟸","DoubleLongLeftRightArrow":"⟺","DoubleLongRightArrow":"⟹","DoubleRightArrow":"⇒","DoubleRightTee":"⊨","DoubleUpArrow":"⇑","DoubleUpDownArrow":"⇕","DoubleVerticalBar":"∥","DownArrowBar":"⤓","downarrow":"↓","DownArrow":"↓","Downarrow":"⇓","DownArrowUpArrow":"⇵","DownBreve":"̑","downdownarrows":"⇊","downharpoonleft":"⇃","downharpoonright":"⇂","DownLeftRightVector":"⥐","DownLeftTeeVector":"⥞","DownLeftVectorBar":"⥖","DownLeftVector":"↽","DownRightTeeVector":"⥟","DownRightVectorBar":"⥗","DownRightVector":"⇁","DownTeeArrow":"↧","DownTee":"⊤","drbkarow":"⤐","drcorn":"⌟","drcrop":"⌌","Dscr":"𝒟","dscr":"𝒹","DScy":"Ѕ","dscy":"ѕ","dsol":"⧶","Dstrok":"Đ","dstrok":"đ","dtdot":"⋱","dtri":"▿","dtrif":"▾","duarr":"⇵","duhar":"⥯","dwangle":"⦦","DZcy":"Џ","dzcy":"џ","dzigrarr":"⟿","Eacute":"É","eacute":"é","easter":"⩮","Ecaron":"Ě","ecaron":"ě","Ecirc":"Ê","ecirc":"ê","ecir":"≖","ecolon":"≕","Ecy":"Э","ecy":"э","eDDot":"⩷","Edot":"Ė","edot":"ė","eDot":"≑","ee":"ⅇ","efDot":"≒","Efr":"𝔈","efr":"𝔢","eg":"⪚","Egrave":"È","egrave":"è","egs":"⪖","egsdot":"⪘","el":"⪙","Element":"∈","elinters":"⏧","ell":"ℓ","els":"⪕","elsdot":"⪗","Emacr":"Ē","emacr":"ē","empty":"∅","emptyset":"∅","EmptySmallSquare":"◻","emptyv":"∅","EmptyVerySmallSquare":"▫","emsp13":" ","emsp14":" ","emsp":" ","ENG":"Ŋ","eng":"ŋ","ensp":" ","Eogon":"Ę","eogon":"ę","Eopf":"𝔼","eopf":"𝕖","epar":"⋕","eparsl":"⧣","eplus":"⩱","epsi":"ε","Epsilon":"Ε","epsilon":"ε","epsiv":"ϵ","eqcirc":"≖","eqcolon":"≕","eqsim":"≂","eqslantgtr":"⪖","eqslantless":"⪕","Equal":"⩵","equals":"=","EqualTilde":"≂","equest":"≟","Equilibrium":"⇌","equiv":"≡","equivDD":"⩸","eqvparsl":"⧥","erarr":"⥱","erDot":"≓","escr":"ℯ","Escr":"ℰ","esdot":"≐","Esim":"⩳","esim":"≂","Eta":"Η","eta":"η","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","euro":"€","excl":"!","exist":"∃","Exists":"∃","expectation":"ℰ","exponentiale":"ⅇ","ExponentialE":"ⅇ","fallingdotseq":"≒","Fcy":"Ф","fcy":"ф","female":"♀","ffilig":"ffi","fflig":"ff","ffllig":"ffl","Ffr":"𝔉","ffr":"𝔣","filig":"fi","FilledSmallSquare":"◼","FilledVerySmallSquare":"▪","fjlig":"fj","flat":"♭","fllig":"fl","fltns":"▱","fnof":"ƒ","Fopf":"𝔽","fopf":"𝕗","forall":"∀","ForAll":"∀","fork":"⋔","forkv":"⫙","Fouriertrf":"ℱ","fpartint":"⨍","frac12":"½","frac13":"⅓","frac14":"¼","frac15":"⅕","frac16":"⅙","frac18":"⅛","frac23":"⅔","frac25":"⅖","frac34":"¾","frac35":"⅗","frac38":"⅜","frac45":"⅘","frac56":"⅚","frac58":"⅝","frac78":"⅞","frasl":"⁄","frown":"⌢","fscr":"𝒻","Fscr":"ℱ","gacute":"ǵ","Gamma":"Γ","gamma":"γ","Gammad":"Ϝ","gammad":"ϝ","gap":"⪆","Gbreve":"Ğ","gbreve":"ğ","Gcedil":"Ģ","Gcirc":"Ĝ","gcirc":"ĝ","Gcy":"Г","gcy":"г","Gdot":"Ġ","gdot":"ġ","ge":"≥","gE":"≧","gEl":"⪌","gel":"⋛","geq":"≥","geqq":"≧","geqslant":"⩾","gescc":"⪩","ges":"⩾","gesdot":"⪀","gesdoto":"⪂","gesdotol":"⪄","gesl":"⋛︀","gesles":"⪔","Gfr":"𝔊","gfr":"𝔤","gg":"≫","Gg":"⋙","ggg":"⋙","gimel":"ℷ","GJcy":"Ѓ","gjcy":"ѓ","gla":"⪥","gl":"≷","glE":"⪒","glj":"⪤","gnap":"⪊","gnapprox":"⪊","gne":"⪈","gnE":"≩","gneq":"⪈","gneqq":"≩","gnsim":"⋧","Gopf":"𝔾","gopf":"𝕘","grave":"`","GreaterEqual":"≥","GreaterEqualLess":"⋛","GreaterFullEqual":"≧","GreaterGreater":"⪢","GreaterLess":"≷","GreaterSlantEqual":"⩾","GreaterTilde":"≳","Gscr":"𝒢","gscr":"ℊ","gsim":"≳","gsime":"⪎","gsiml":"⪐","gtcc":"⪧","gtcir":"⩺","gt":">","GT":">","Gt":"≫","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","Hacek":"ˇ","hairsp":" ","half":"½","hamilt":"ℋ","HARDcy":"Ъ","hardcy":"ъ","harrcir":"⥈","harr":"↔","hArr":"⇔","harrw":"↭","Hat":"^","hbar":"ℏ","Hcirc":"Ĥ","hcirc":"ĥ","hearts":"♥","heartsuit":"♥","hellip":"…","hercon":"⊹","hfr":"𝔥","Hfr":"ℌ","HilbertSpace":"ℋ","hksearow":"⤥","hkswarow":"⤦","hoarr":"⇿","homtht":"∻","hookleftarrow":"↩","hookrightarrow":"↪","hopf":"𝕙","Hopf":"ℍ","horbar":"―","HorizontalLine":"─","hscr":"𝒽","Hscr":"ℋ","hslash":"ℏ","Hstrok":"Ħ","hstrok":"ħ","HumpDownHump":"≎","HumpEqual":"≏","hybull":"⁃","hyphen":"‐","Iacute":"Í","iacute":"í","ic":"⁣","Icirc":"Î","icirc":"î","Icy":"И","icy":"и","Idot":"İ","IEcy":"Е","iecy":"е","iexcl":"¡","iff":"⇔","ifr":"𝔦","Ifr":"ℑ","Igrave":"Ì","igrave":"ì","ii":"ⅈ","iiiint":"⨌","iiint":"∭","iinfin":"⧜","iiota":"℩","IJlig":"IJ","ijlig":"ij","Imacr":"Ī","imacr":"ī","image":"ℑ","ImaginaryI":"ⅈ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","Im":"ℑ","imof":"⊷","imped":"Ƶ","Implies":"⇒","incare":"℅","in":"∈","infin":"∞","infintie":"⧝","inodot":"ı","intcal":"⊺","int":"∫","Int":"∬","integers":"ℤ","Integral":"∫","intercal":"⊺","Intersection":"⋂","intlarhk":"⨗","intprod":"⨼","InvisibleComma":"⁣","InvisibleTimes":"⁢","IOcy":"Ё","iocy":"ё","Iogon":"Į","iogon":"į","Iopf":"𝕀","iopf":"𝕚","Iota":"Ι","iota":"ι","iprod":"⨼","iquest":"¿","iscr":"𝒾","Iscr":"ℐ","isin":"∈","isindot":"⋵","isinE":"⋹","isins":"⋴","isinsv":"⋳","isinv":"∈","it":"⁢","Itilde":"Ĩ","itilde":"ĩ","Iukcy":"І","iukcy":"і","Iuml":"Ï","iuml":"ï","Jcirc":"Ĵ","jcirc":"ĵ","Jcy":"Й","jcy":"й","Jfr":"𝔍","jfr":"𝔧","jmath":"ȷ","Jopf":"𝕁","jopf":"𝕛","Jscr":"𝒥","jscr":"𝒿","Jsercy":"Ј","jsercy":"ј","Jukcy":"Є","jukcy":"є","Kappa":"Κ","kappa":"κ","kappav":"ϰ","Kcedil":"Ķ","kcedil":"ķ","Kcy":"К","kcy":"к","Kfr":"𝔎","kfr":"𝔨","kgreen":"ĸ","KHcy":"Х","khcy":"х","KJcy":"Ќ","kjcy":"ќ","Kopf":"𝕂","kopf":"𝕜","Kscr":"𝒦","kscr":"𝓀","lAarr":"⇚","Lacute":"Ĺ","lacute":"ĺ","laemptyv":"⦴","lagran":"ℒ","Lambda":"Λ","lambda":"λ","lang":"⟨","Lang":"⟪","langd":"⦑","langle":"⟨","lap":"⪅","Laplacetrf":"ℒ","laquo":"«","larrb":"⇤","larrbfs":"⤟","larr":"←","Larr":"↞","lArr":"⇐","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","latail":"⤙","lAtail":"⤛","lat":"⪫","late":"⪭","lates":"⪭︀","lbarr":"⤌","lBarr":"⤎","lbbrk":"❲","lbrace":"{","lbrack":"[","lbrke":"⦋","lbrksld":"⦏","lbrkslu":"⦍","Lcaron":"Ľ","lcaron":"ľ","Lcedil":"Ļ","lcedil":"ļ","lceil":"⌈","lcub":"{","Lcy":"Л","lcy":"л","ldca":"⤶","ldquo":"“","ldquor":"„","ldrdhar":"⥧","ldrushar":"⥋","ldsh":"↲","le":"≤","lE":"≦","LeftAngleBracket":"⟨","LeftArrowBar":"⇤","leftarrow":"←","LeftArrow":"←","Leftarrow":"⇐","LeftArrowRightArrow":"⇆","leftarrowtail":"↢","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVectorBar":"⥙","LeftDownVector":"⇃","LeftFloor":"⌊","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","leftrightarrow":"↔","LeftRightArrow":"↔","Leftrightarrow":"⇔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","LeftRightVector":"⥎","LeftTeeArrow":"↤","LeftTee":"⊣","LeftTeeVector":"⥚","leftthreetimes":"⋋","LeftTriangleBar":"⧏","LeftTriangle":"⊲","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVectorBar":"⥘","LeftUpVector":"↿","LeftVectorBar":"⥒","LeftVector":"↼","lEg":"⪋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","lescc":"⪨","les":"⩽","lesdot":"⩿","lesdoto":"⪁","lesdotor":"⪃","lesg":"⋚︀","lesges":"⪓","lessapprox":"⪅","lessdot":"⋖","lesseqgtr":"⋚","lesseqqgtr":"⪋","LessEqualGreater":"⋚","LessFullEqual":"≦","LessGreater":"≶","lessgtr":"≶","LessLess":"⪡","lesssim":"≲","LessSlantEqual":"⩽","LessTilde":"≲","lfisht":"⥼","lfloor":"⌊","Lfr":"𝔏","lfr":"𝔩","lg":"≶","lgE":"⪑","lHar":"⥢","lhard":"↽","lharu":"↼","lharul":"⥪","lhblk":"▄","LJcy":"Љ","ljcy":"љ","llarr":"⇇","ll":"≪","Ll":"⋘","llcorner":"⌞","Lleftarrow":"⇚","llhard":"⥫","lltri":"◺","Lmidot":"Ŀ","lmidot":"ŀ","lmoustache":"⎰","lmoust":"⎰","lnap":"⪉","lnapprox":"⪉","lne":"⪇","lnE":"≨","lneq":"⪇","lneqq":"≨","lnsim":"⋦","loang":"⟬","loarr":"⇽","lobrk":"⟦","longleftarrow":"⟵","LongLeftArrow":"⟵","Longleftarrow":"⟸","longleftrightarrow":"⟷","LongLeftRightArrow":"⟷","Longleftrightarrow":"⟺","longmapsto":"⟼","longrightarrow":"⟶","LongRightArrow":"⟶","Longrightarrow":"⟹","looparrowleft":"↫","looparrowright":"↬","lopar":"⦅","Lopf":"𝕃","lopf":"𝕝","loplus":"⨭","lotimes":"⨴","lowast":"∗","lowbar":"_","LowerLeftArrow":"↙","LowerRightArrow":"↘","loz":"◊","lozenge":"◊","lozf":"⧫","lpar":"(","lparlt":"⦓","lrarr":"⇆","lrcorner":"⌟","lrhar":"⇋","lrhard":"⥭","lrm":"‎","lrtri":"⊿","lsaquo":"‹","lscr":"𝓁","Lscr":"ℒ","lsh":"↰","Lsh":"↰","lsim":"≲","lsime":"⪍","lsimg":"⪏","lsqb":"[","lsquo":"‘","lsquor":"‚","Lstrok":"Ł","lstrok":"ł","ltcc":"⪦","ltcir":"⩹","lt":"<","LT":"<","Lt":"≪","ltdot":"⋖","lthree":"⋋","ltimes":"⋉","ltlarr":"⥶","ltquest":"⩻","ltri":"◃","ltrie":"⊴","ltrif":"◂","ltrPar":"⦖","lurdshar":"⥊","luruhar":"⥦","lvertneqq":"≨︀","lvnE":"≨︀","macr":"¯","male":"♂","malt":"✠","maltese":"✠","Map":"⤅","map":"↦","mapsto":"↦","mapstodown":"↧","mapstoleft":"↤","mapstoup":"↥","marker":"▮","mcomma":"⨩","Mcy":"М","mcy":"м","mdash":"—","mDDot":"∺","measuredangle":"∡","MediumSpace":" ","Mellintrf":"ℳ","Mfr":"𝔐","mfr":"𝔪","mho":"℧","micro":"µ","midast":"*","midcir":"⫰","mid":"∣","middot":"·","minusb":"⊟","minus":"−","minusd":"∸","minusdu":"⨪","MinusPlus":"∓","mlcp":"⫛","mldr":"…","mnplus":"∓","models":"⊧","Mopf":"𝕄","mopf":"𝕞","mp":"∓","mscr":"𝓂","Mscr":"ℳ","mstpos":"∾","Mu":"Μ","mu":"μ","multimap":"⊸","mumap":"⊸","nabla":"∇","Nacute":"Ń","nacute":"ń","nang":"∠⃒","nap":"≉","napE":"⩰̸","napid":"≋̸","napos":"ʼn","napprox":"≉","natural":"♮","naturals":"ℕ","natur":"♮","nbsp":" ","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","Ncaron":"Ň","ncaron":"ň","Ncedil":"Ņ","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","Ncy":"Н","ncy":"н","ndash":"–","nearhk":"⤤","nearr":"↗","neArr":"⇗","nearrow":"↗","ne":"≠","nedot":"≐̸","NegativeMediumSpace":"​","NegativeThickSpace":"​","NegativeThinSpace":"​","NegativeVeryThinSpace":"​","nequiv":"≢","nesear":"⤨","nesim":"≂̸","NestedGreaterGreater":"≫","NestedLessLess":"≪","NewLine":"\n","nexist":"∄","nexists":"∄","Nfr":"𝔑","nfr":"𝔫","ngE":"≧̸","nge":"≱","ngeq":"≱","ngeqq":"≧̸","ngeqslant":"⩾̸","nges":"⩾̸","nGg":"⋙̸","ngsim":"≵","nGt":"≫⃒","ngt":"≯","ngtr":"≯","nGtv":"≫̸","nharr":"↮","nhArr":"⇎","nhpar":"⫲","ni":"∋","nis":"⋼","nisd":"⋺","niv":"∋","NJcy":"Њ","njcy":"њ","nlarr":"↚","nlArr":"⇍","nldr":"‥","nlE":"≦̸","nle":"≰","nleftarrow":"↚","nLeftarrow":"⇍","nleftrightarrow":"↮","nLeftrightarrow":"⇎","nleq":"≰","nleqq":"≦̸","nleqslant":"⩽̸","nles":"⩽̸","nless":"≮","nLl":"⋘̸","nlsim":"≴","nLt":"≪⃒","nlt":"≮","nltri":"⋪","nltrie":"⋬","nLtv":"≪̸","nmid":"∤","NoBreak":"⁠","NonBreakingSpace":" ","nopf":"𝕟","Nopf":"ℕ","Not":"⫬","not":"¬","NotCongruent":"≢","NotCupCap":"≭","NotDoubleVerticalBar":"∦","NotElement":"∉","NotEqual":"≠","NotEqualTilde":"≂̸","NotExists":"∄","NotGreater":"≯","NotGreaterEqual":"≱","NotGreaterFullEqual":"≧̸","NotGreaterGreater":"≫̸","NotGreaterLess":"≹","NotGreaterSlantEqual":"⩾̸","NotGreaterTilde":"≵","NotHumpDownHump":"≎̸","NotHumpEqual":"≏̸","notin":"∉","notindot":"⋵̸","notinE":"⋹̸","notinva":"∉","notinvb":"⋷","notinvc":"⋶","NotLeftTriangleBar":"⧏̸","NotLeftTriangle":"⋪","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangleBar":"⧐̸","NotRightTriangle":"⋫","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","nparallel":"∦","npar":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","nprec":"⊀","npreceq":"⪯̸","npre":"⪯̸","nrarrc":"⤳̸","nrarr":"↛","nrArr":"⇏","nrarrw":"↝̸","nrightarrow":"↛","nRightarrow":"⇏","nrtri":"⋫","nrtrie":"⋭","nsc":"⊁","nsccue":"⋡","nsce":"⪰̸","Nscr":"𝒩","nscr":"𝓃","nshortmid":"∤","nshortparallel":"∦","nsim":"≁","nsime":"≄","nsimeq":"≄","nsmid":"∤","nspar":"∦","nsqsube":"⋢","nsqsupe":"⋣","nsub":"⊄","nsubE":"⫅̸","nsube":"⊈","nsubset":"⊂⃒","nsubseteq":"⊈","nsubseteqq":"⫅̸","nsucc":"⊁","nsucceq":"⪰̸","nsup":"⊅","nsupE":"⫆̸","nsupe":"⊉","nsupset":"⊃⃒","nsupseteq":"⊉","nsupseteqq":"⫆̸","ntgl":"≹","Ntilde":"Ñ","ntilde":"ñ","ntlg":"≸","ntriangleleft":"⋪","ntrianglelefteq":"⋬","ntriangleright":"⋫","ntrianglerighteq":"⋭","Nu":"Ν","nu":"ν","num":"#","numero":"№","numsp":" ","nvap":"≍⃒","nvdash":"⊬","nvDash":"⊭","nVdash":"⊮","nVDash":"⊯","nvge":"≥⃒","nvgt":">⃒","nvHarr":"⤄","nvinfin":"⧞","nvlArr":"⤂","nvle":"≤⃒","nvlt":"<⃒","nvltrie":"⊴⃒","nvrArr":"⤃","nvrtrie":"⊵⃒","nvsim":"∼⃒","nwarhk":"⤣","nwarr":"↖","nwArr":"⇖","nwarrow":"↖","nwnear":"⤧","Oacute":"Ó","oacute":"ó","oast":"⊛","Ocirc":"Ô","ocirc":"ô","ocir":"⊚","Ocy":"О","ocy":"о","odash":"⊝","Odblac":"Ő","odblac":"ő","odiv":"⨸","odot":"⊙","odsold":"⦼","OElig":"Œ","oelig":"œ","ofcir":"⦿","Ofr":"𝔒","ofr":"𝔬","ogon":"˛","Ograve":"Ò","ograve":"ò","ogt":"⧁","ohbar":"⦵","ohm":"Ω","oint":"∮","olarr":"↺","olcir":"⦾","olcross":"⦻","oline":"‾","olt":"⧀","Omacr":"Ō","omacr":"ō","Omega":"Ω","omega":"ω","Omicron":"Ο","omicron":"ο","omid":"⦶","ominus":"⊖","Oopf":"𝕆","oopf":"𝕠","opar":"⦷","OpenCurlyDoubleQuote":"“","OpenCurlyQuote":"‘","operp":"⦹","oplus":"⊕","orarr":"↻","Or":"⩔","or":"∨","ord":"⩝","order":"ℴ","orderof":"ℴ","ordf":"ª","ordm":"º","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oS":"Ⓢ","Oscr":"𝒪","oscr":"ℴ","Oslash":"Ø","oslash":"ø","osol":"⊘","Otilde":"Õ","otilde":"õ","otimesas":"⨶","Otimes":"⨷","otimes":"⊗","Ouml":"Ö","ouml":"ö","ovbar":"⌽","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","para":"¶","parallel":"∥","par":"∥","parsim":"⫳","parsl":"⫽","part":"∂","PartialD":"∂","Pcy":"П","pcy":"п","percnt":"%","period":".","permil":"‰","perp":"⊥","pertenk":"‱","Pfr":"𝔓","pfr":"𝔭","Phi":"Φ","phi":"φ","phiv":"ϕ","phmmat":"ℳ","phone":"☎","Pi":"Π","pi":"π","pitchfork":"⋔","piv":"ϖ","planck":"ℏ","planckh":"ℎ","plankv":"ℏ","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plus":"+","plusdo":"∔","plusdu":"⨥","pluse":"⩲","PlusMinus":"±","plusmn":"±","plussim":"⨦","plustwo":"⨧","pm":"±","Poincareplane":"ℌ","pointint":"⨕","popf":"𝕡","Popf":"ℙ","pound":"£","prap":"⪷","Pr":"⪻","pr":"≺","prcue":"≼","precapprox":"⪷","prec":"≺","preccurlyeq":"≼","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","pre":"⪯","prE":"⪳","precsim":"≾","prime":"′","Prime":"″","primes":"ℙ","prnap":"⪹","prnE":"⪵","prnsim":"⋨","prod":"∏","Product":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","Proportional":"∝","Proportion":"∷","propto":"∝","prsim":"≾","prurel":"⊰","Pscr":"𝒫","pscr":"𝓅","Psi":"Ψ","psi":"ψ","puncsp":" ","Qfr":"𝔔","qfr":"𝔮","qint":"⨌","qopf":"𝕢","Qopf":"ℚ","qprime":"⁗","Qscr":"𝒬","qscr":"𝓆","quaternions":"ℍ","quatint":"⨖","quest":"?","questeq":"≟","quot":"\"","QUOT":"\"","rAarr":"⇛","race":"∽̱","Racute":"Ŕ","racute":"ŕ","radic":"√","raemptyv":"⦳","rang":"⟩","Rang":"⟫","rangd":"⦒","range":"⦥","rangle":"⟩","raquo":"»","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarr":"→","Rarr":"↠","rArr":"⇒","rarrfs":"⤞","rarrhk":"↪","rarrlp":"↬","rarrpl":"⥅","rarrsim":"⥴","Rarrtl":"⤖","rarrtl":"↣","rarrw":"↝","ratail":"⤚","rAtail":"⤜","ratio":"∶","rationals":"ℚ","rbarr":"⤍","rBarr":"⤏","RBarr":"⤐","rbbrk":"❳","rbrace":"}","rbrack":"]","rbrke":"⦌","rbrksld":"⦎","rbrkslu":"⦐","Rcaron":"Ř","rcaron":"ř","Rcedil":"Ŗ","rcedil":"ŗ","rceil":"⌉","rcub":"}","Rcy":"Р","rcy":"р","rdca":"⤷","rdldhar":"⥩","rdquo":"”","rdquor":"”","rdsh":"↳","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","Re":"ℜ","rect":"▭","reg":"®","REG":"®","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","rfisht":"⥽","rfloor":"⌋","rfr":"𝔯","Rfr":"ℜ","rHar":"⥤","rhard":"⇁","rharu":"⇀","rharul":"⥬","Rho":"Ρ","rho":"ρ","rhov":"ϱ","RightAngleBracket":"⟩","RightArrowBar":"⇥","rightarrow":"→","RightArrow":"→","Rightarrow":"⇒","RightArrowLeftArrow":"⇄","rightarrowtail":"↣","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVectorBar":"⥕","RightDownVector":"⇂","RightFloor":"⌋","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","RightTeeArrow":"↦","RightTee":"⊢","RightTeeVector":"⥛","rightthreetimes":"⋌","RightTriangleBar":"⧐","RightTriangle":"⊳","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVectorBar":"⥔","RightUpVector":"↾","RightVectorBar":"⥓","RightVector":"⇀","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"‏","rmoustache":"⎱","rmoust":"⎱","rnmid":"⫮","roang":"⟭","roarr":"⇾","robrk":"⟧","ropar":"⦆","ropf":"𝕣","Ropf":"ℝ","roplus":"⨮","rotimes":"⨵","RoundImplies":"⥰","rpar":")","rpargt":"⦔","rppolint":"⨒","rrarr":"⇉","Rrightarrow":"⇛","rsaquo":"›","rscr":"𝓇","Rscr":"ℛ","rsh":"↱","Rsh":"↱","rsqb":"]","rsquo":"’","rsquor":"’","rthree":"⋌","rtimes":"⋊","rtri":"▹","rtrie":"⊵","rtrif":"▸","rtriltri":"⧎","RuleDelayed":"⧴","ruluhar":"⥨","rx":"℞","Sacute":"Ś","sacute":"ś","sbquo":"‚","scap":"⪸","Scaron":"Š","scaron":"š","Sc":"⪼","sc":"≻","sccue":"≽","sce":"⪰","scE":"⪴","Scedil":"Ş","scedil":"ş","Scirc":"Ŝ","scirc":"ŝ","scnap":"⪺","scnE":"⪶","scnsim":"⋩","scpolint":"⨓","scsim":"≿","Scy":"С","scy":"с","sdotb":"⊡","sdot":"⋅","sdote":"⩦","searhk":"⤥","searr":"↘","seArr":"⇘","searrow":"↘","sect":"§","semi":";","seswar":"⤩","setminus":"∖","setmn":"∖","sext":"✶","Sfr":"𝔖","sfr":"𝔰","sfrown":"⌢","sharp":"♯","SHCHcy":"Щ","shchcy":"щ","SHcy":"Ш","shcy":"ш","ShortDownArrow":"↓","ShortLeftArrow":"←","shortmid":"∣","shortparallel":"∥","ShortRightArrow":"→","ShortUpArrow":"↑","shy":"­","Sigma":"Σ","sigma":"σ","sigmaf":"ς","sigmav":"ς","sim":"∼","simdot":"⩪","sime":"≃","simeq":"≃","simg":"⪞","simgE":"⪠","siml":"⪝","simlE":"⪟","simne":"≆","simplus":"⨤","simrarr":"⥲","slarr":"←","SmallCircle":"∘","smallsetminus":"∖","smashp":"⨳","smeparsl":"⧤","smid":"∣","smile":"⌣","smt":"⪪","smte":"⪬","smtes":"⪬︀","SOFTcy":"Ь","softcy":"ь","solbar":"⌿","solb":"⧄","sol":"/","Sopf":"𝕊","sopf":"𝕤","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","Sqrt":"√","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","square":"□","Square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","squarf":"▪","squ":"□","squf":"▪","srarr":"→","Sscr":"𝒮","sscr":"𝓈","ssetmn":"∖","ssmile":"⌣","sstarf":"⋆","Star":"⋆","star":"☆","starf":"★","straightepsilon":"ϵ","straightphi":"ϕ","strns":"¯","sub":"⊂","Sub":"⋐","subdot":"⪽","subE":"⫅","sube":"⊆","subedot":"⫃","submult":"⫁","subnE":"⫋","subne":"⊊","subplus":"⪿","subrarr":"⥹","subset":"⊂","Subset":"⋐","subseteq":"⊆","subseteqq":"⫅","SubsetEqual":"⊆","subsetneq":"⊊","subsetneqq":"⫋","subsim":"⫇","subsub":"⫕","subsup":"⫓","succapprox":"⪸","succ":"≻","succcurlyeq":"≽","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","SuchThat":"∋","sum":"∑","Sum":"∑","sung":"♪","sup1":"¹","sup2":"²","sup3":"³","sup":"⊃","Sup":"⋑","supdot":"⪾","supdsub":"⫘","supE":"⫆","supe":"⊇","supedot":"⫄","Superset":"⊃","SupersetEqual":"⊇","suphsol":"⟉","suphsub":"⫗","suplarr":"⥻","supmult":"⫂","supnE":"⫌","supne":"⊋","supplus":"⫀","supset":"⊃","Supset":"⋑","supseteq":"⊇","supseteqq":"⫆","supsetneq":"⊋","supsetneqq":"⫌","supsim":"⫈","supsub":"⫔","supsup":"⫖","swarhk":"⤦","swarr":"↙","swArr":"⇙","swarrow":"↙","swnwar":"⤪","szlig":"ß","Tab":"\t","target":"⌖","Tau":"Τ","tau":"τ","tbrk":"⎴","Tcaron":"Ť","tcaron":"ť","Tcedil":"Ţ","tcedil":"ţ","Tcy":"Т","tcy":"т","tdot":"⃛","telrec":"⌕","Tfr":"𝔗","tfr":"𝔱","there4":"∴","therefore":"∴","Therefore":"∴","Theta":"Θ","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","ThickSpace":"  ","ThinSpace":" ","thinsp":" ","thkap":"≈","thksim":"∼","THORN":"Þ","thorn":"þ","tilde":"˜","Tilde":"∼","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","timesbar":"⨱","timesb":"⊠","times":"×","timesd":"⨰","tint":"∭","toea":"⤨","topbot":"⌶","topcir":"⫱","top":"⊤","Topf":"𝕋","topf":"𝕥","topfork":"⫚","tosa":"⤩","tprime":"‴","trade":"™","TRADE":"™","triangle":"▵","triangledown":"▿","triangleleft":"◃","trianglelefteq":"⊴","triangleq":"≜","triangleright":"▹","trianglerighteq":"⊵","tridot":"◬","trie":"≜","triminus":"⨺","TripleDot":"⃛","triplus":"⨹","trisb":"⧍","tritime":"⨻","trpezium":"⏢","Tscr":"𝒯","tscr":"𝓉","TScy":"Ц","tscy":"ц","TSHcy":"Ћ","tshcy":"ћ","Tstrok":"Ŧ","tstrok":"ŧ","twixt":"≬","twoheadleftarrow":"↞","twoheadrightarrow":"↠","Uacute":"Ú","uacute":"ú","uarr":"↑","Uarr":"↟","uArr":"⇑","Uarrocir":"⥉","Ubrcy":"Ў","ubrcy":"ў","Ubreve":"Ŭ","ubreve":"ŭ","Ucirc":"Û","ucirc":"û","Ucy":"У","ucy":"у","udarr":"⇅","Udblac":"Ű","udblac":"ű","udhar":"⥮","ufisht":"⥾","Ufr":"𝔘","ufr":"𝔲","Ugrave":"Ù","ugrave":"ù","uHar":"⥣","uharl":"↿","uharr":"↾","uhblk":"▀","ulcorn":"⌜","ulcorner":"⌜","ulcrop":"⌏","ultri":"◸","Umacr":"Ū","umacr":"ū","uml":"¨","UnderBar":"_","UnderBrace":"⏟","UnderBracket":"⎵","UnderParenthesis":"⏝","Union":"⋃","UnionPlus":"⊎","Uogon":"Ų","uogon":"ų","Uopf":"𝕌","uopf":"𝕦","UpArrowBar":"⤒","uparrow":"↑","UpArrow":"↑","Uparrow":"⇑","UpArrowDownArrow":"⇅","updownarrow":"↕","UpDownArrow":"↕","Updownarrow":"⇕","UpEquilibrium":"⥮","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","UpperLeftArrow":"↖","UpperRightArrow":"↗","upsi":"υ","Upsi":"ϒ","upsih":"ϒ","Upsilon":"Υ","upsilon":"υ","UpTeeArrow":"↥","UpTee":"⊥","upuparrows":"⇈","urcorn":"⌝","urcorner":"⌝","urcrop":"⌎","Uring":"Ů","uring":"ů","urtri":"◹","Uscr":"𝒰","uscr":"𝓊","utdot":"⋰","Utilde":"Ũ","utilde":"ũ","utri":"▵","utrif":"▴","uuarr":"⇈","Uuml":"Ü","uuml":"ü","uwangle":"⦧","vangrt":"⦜","varepsilon":"ϵ","varkappa":"ϰ","varnothing":"∅","varphi":"ϕ","varpi":"ϖ","varpropto":"∝","varr":"↕","vArr":"⇕","varrho":"ϱ","varsigma":"ς","varsubsetneq":"⊊︀","varsubsetneqq":"⫋︀","varsupsetneq":"⊋︀","varsupsetneqq":"⫌︀","vartheta":"ϑ","vartriangleleft":"⊲","vartriangleright":"⊳","vBar":"⫨","Vbar":"⫫","vBarv":"⫩","Vcy":"В","vcy":"в","vdash":"⊢","vDash":"⊨","Vdash":"⊩","VDash":"⊫","Vdashl":"⫦","veebar":"⊻","vee":"∨","Vee":"⋁","veeeq":"≚","vellip":"⋮","verbar":"|","Verbar":"‖","vert":"|","Vert":"‖","VerticalBar":"∣","VerticalLine":"|","VerticalSeparator":"❘","VerticalTilde":"≀","VeryThinSpace":" ","Vfr":"𝔙","vfr":"𝔳","vltri":"⊲","vnsub":"⊂⃒","vnsup":"⊃⃒","Vopf":"𝕍","vopf":"𝕧","vprop":"∝","vrtri":"⊳","Vscr":"𝒱","vscr":"𝓋","vsubnE":"⫋︀","vsubne":"⊊︀","vsupnE":"⫌︀","vsupne":"⊋︀","Vvdash":"⊪","vzigzag":"⦚","Wcirc":"Ŵ","wcirc":"ŵ","wedbar":"⩟","wedge":"∧","Wedge":"⋀","wedgeq":"≙","weierp":"℘","Wfr":"𝔚","wfr":"𝔴","Wopf":"𝕎","wopf":"𝕨","wp":"℘","wr":"≀","wreath":"≀","Wscr":"𝒲","wscr":"𝓌","xcap":"⋂","xcirc":"◯","xcup":"⋃","xdtri":"▽","Xfr":"𝔛","xfr":"𝔵","xharr":"⟷","xhArr":"⟺","Xi":"Ξ","xi":"ξ","xlarr":"⟵","xlArr":"⟸","xmap":"⟼","xnis":"⋻","xodot":"⨀","Xopf":"𝕏","xopf":"𝕩","xoplus":"⨁","xotime":"⨂","xrarr":"⟶","xrArr":"⟹","Xscr":"𝒳","xscr":"𝓍","xsqcup":"⨆","xuplus":"⨄","xutri":"△","xvee":"⋁","xwedge":"⋀","Yacute":"Ý","yacute":"ý","YAcy":"Я","yacy":"я","Ycirc":"Ŷ","ycirc":"ŷ","Ycy":"Ы","ycy":"ы","yen":"¥","Yfr":"𝔜","yfr":"𝔶","YIcy":"Ї","yicy":"ї","Yopf":"𝕐","yopf":"𝕪","Yscr":"𝒴","yscr":"𝓎","YUcy":"Ю","yucy":"ю","yuml":"ÿ","Yuml":"Ÿ","Zacute":"Ź","zacute":"ź","Zcaron":"Ž","zcaron":"ž","Zcy":"З","zcy":"з","Zdot":"Ż","zdot":"ż","zeetrf":"ℨ","ZeroWidthSpace":"​","Zeta":"Ζ","zeta":"ζ","zfr":"𝔷","Zfr":"ℨ","ZHcy":"Ж","zhcy":"ж","zigrarr":"⇝","zopf":"𝕫","Zopf":"ℤ","Zscr":"𝒵","zscr":"𝓏","zwj":"‍","zwnj":"‌"}
  4213. /***/ }),
  4214. /* 32 */
  4215. /***/ (function(module, exports, __webpack_require__) {
  4216. "use strict";
  4217. var encodeCache = {};
  4218. // Create a lookup array where anything but characters in `chars` string
  4219. // and alphanumeric chars is percent-encoded.
  4220. //
  4221. function getEncodeCache(exclude) {
  4222. var i, ch, cache = encodeCache[exclude];
  4223. if (cache) { return cache; }
  4224. cache = encodeCache[exclude] = [];
  4225. for (i = 0; i < 128; i++) {
  4226. ch = String.fromCharCode(i);
  4227. if (/^[0-9a-z]$/i.test(ch)) {
  4228. // always allow unencoded alphanumeric characters
  4229. cache.push(ch);
  4230. } else {
  4231. cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2));
  4232. }
  4233. }
  4234. for (i = 0; i < exclude.length; i++) {
  4235. cache[exclude.charCodeAt(i)] = exclude[i];
  4236. }
  4237. return cache;
  4238. }
  4239. // Encode unsafe characters with percent-encoding, skipping already
  4240. // encoded sequences.
  4241. //
  4242. // - string - string to encode
  4243. // - exclude - list of characters to ignore (in addition to a-zA-Z0-9)
  4244. // - keepEscaped - don't encode '%' in a correct escape sequence (default: true)
  4245. //
  4246. function encode(string, exclude, keepEscaped) {
  4247. var i, l, code, nextCode, cache,
  4248. result = '';
  4249. if (typeof exclude !== 'string') {
  4250. // encode(string, keepEscaped)
  4251. keepEscaped = exclude;
  4252. exclude = encode.defaultChars;
  4253. }
  4254. if (typeof keepEscaped === 'undefined') {
  4255. keepEscaped = true;
  4256. }
  4257. cache = getEncodeCache(exclude);
  4258. for (i = 0, l = string.length; i < l; i++) {
  4259. code = string.charCodeAt(i);
  4260. if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) {
  4261. if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {
  4262. result += string.slice(i, i + 3);
  4263. i += 2;
  4264. continue;
  4265. }
  4266. }
  4267. if (code < 128) {
  4268. result += cache[code];
  4269. continue;
  4270. }
  4271. if (code >= 0xD800 && code <= 0xDFFF) {
  4272. if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {
  4273. nextCode = string.charCodeAt(i + 1);
  4274. if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {
  4275. result += encodeURIComponent(string[i] + string[i + 1]);
  4276. i++;
  4277. continue;
  4278. }
  4279. }
  4280. result += '%EF%BF%BD';
  4281. continue;
  4282. }
  4283. result += encodeURIComponent(string[i]);
  4284. }
  4285. return result;
  4286. }
  4287. encode.defaultChars = ";/?:@&=+$,-_.!~*'()#";
  4288. encode.componentChars = "-_.!~*'()";
  4289. module.exports = encode;
  4290. /***/ }),
  4291. /* 33 */
  4292. /***/ (function(module, exports, __webpack_require__) {
  4293. "use strict";
  4294. /* eslint-disable no-bitwise */
  4295. var decodeCache = {};
  4296. function getDecodeCache(exclude) {
  4297. var i, ch, cache = decodeCache[exclude];
  4298. if (cache) { return cache; }
  4299. cache = decodeCache[exclude] = [];
  4300. for (i = 0; i < 128; i++) {
  4301. ch = String.fromCharCode(i);
  4302. cache.push(ch);
  4303. }
  4304. for (i = 0; i < exclude.length; i++) {
  4305. ch = exclude.charCodeAt(i);
  4306. cache[ch] = '%' + ('0' + ch.toString(16).toUpperCase()).slice(-2);
  4307. }
  4308. return cache;
  4309. }
  4310. // Decode percent-encoded string.
  4311. //
  4312. function decode(string, exclude) {
  4313. var cache;
  4314. if (typeof exclude !== 'string') {
  4315. exclude = decode.defaultChars;
  4316. }
  4317. cache = getDecodeCache(exclude);
  4318. return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) {
  4319. var i, l, b1, b2, b3, b4, chr,
  4320. result = '';
  4321. for (i = 0, l = seq.length; i < l; i += 3) {
  4322. b1 = parseInt(seq.slice(i + 1, i + 3), 16);
  4323. if (b1 < 0x80) {
  4324. result += cache[b1];
  4325. continue;
  4326. }
  4327. if ((b1 & 0xE0) === 0xC0 && (i + 3 < l)) {
  4328. // 110xxxxx 10xxxxxx
  4329. b2 = parseInt(seq.slice(i + 4, i + 6), 16);
  4330. if ((b2 & 0xC0) === 0x80) {
  4331. chr = ((b1 << 6) & 0x7C0) | (b2 & 0x3F);
  4332. if (chr < 0x80) {
  4333. result += '\ufffd\ufffd';
  4334. } else {
  4335. result += String.fromCharCode(chr);
  4336. }
  4337. i += 3;
  4338. continue;
  4339. }
  4340. }
  4341. if ((b1 & 0xF0) === 0xE0 && (i + 6 < l)) {
  4342. // 1110xxxx 10xxxxxx 10xxxxxx
  4343. b2 = parseInt(seq.slice(i + 4, i + 6), 16);
  4344. b3 = parseInt(seq.slice(i + 7, i + 9), 16);
  4345. if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {
  4346. chr = ((b1 << 12) & 0xF000) | ((b2 << 6) & 0xFC0) | (b3 & 0x3F);
  4347. if (chr < 0x800 || (chr >= 0xD800 && chr <= 0xDFFF)) {
  4348. result += '\ufffd\ufffd\ufffd';
  4349. } else {
  4350. result += String.fromCharCode(chr);
  4351. }
  4352. i += 6;
  4353. continue;
  4354. }
  4355. }
  4356. if ((b1 & 0xF8) === 0xF0 && (i + 9 < l)) {
  4357. // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx
  4358. b2 = parseInt(seq.slice(i + 4, i + 6), 16);
  4359. b3 = parseInt(seq.slice(i + 7, i + 9), 16);
  4360. b4 = parseInt(seq.slice(i + 10, i + 12), 16);
  4361. if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80 && (b4 & 0xC0) === 0x80) {
  4362. chr = ((b1 << 18) & 0x1C0000) | ((b2 << 12) & 0x3F000) | ((b3 << 6) & 0xFC0) | (b4 & 0x3F);
  4363. if (chr < 0x10000 || chr > 0x10FFFF) {
  4364. result += '\ufffd\ufffd\ufffd\ufffd';
  4365. } else {
  4366. chr -= 0x10000;
  4367. result += String.fromCharCode(0xD800 + (chr >> 10), 0xDC00 + (chr & 0x3FF));
  4368. }
  4369. i += 9;
  4370. continue;
  4371. }
  4372. }
  4373. result += '\ufffd';
  4374. }
  4375. return result;
  4376. });
  4377. }
  4378. decode.defaultChars = ';/?:@&=+$,#';
  4379. decode.componentChars = '';
  4380. module.exports = decode;
  4381. /***/ }),
  4382. /* 34 */
  4383. /***/ (function(module, exports, __webpack_require__) {
  4384. "use strict";
  4385. module.exports = function format(url) {
  4386. var result = '';
  4387. result += url.protocol || '';
  4388. result += url.slashes ? '//' : '';
  4389. result += url.auth ? url.auth + '@' : '';
  4390. if (url.hostname && url.hostname.indexOf(':') !== -1) {
  4391. // ipv6 address
  4392. result += '[' + url.hostname + ']';
  4393. } else {
  4394. result += url.hostname || '';
  4395. }
  4396. result += url.port ? ':' + url.port : '';
  4397. result += url.pathname || '';
  4398. result += url.search || '';
  4399. result += url.hash || '';
  4400. return result;
  4401. };
  4402. /***/ }),
  4403. /* 35 */
  4404. /***/ (function(module, exports, __webpack_require__) {
  4405. "use strict";
  4406. // Copyright Joyent, Inc. and other Node contributors.
  4407. //
  4408. // Permission is hereby granted, free of charge, to any person obtaining a
  4409. // copy of this software and associated documentation files (the
  4410. // "Software"), to deal in the Software without restriction, including
  4411. // without limitation the rights to use, copy, modify, merge, publish,
  4412. // distribute, sublicense, and/or sell copies of the Software, and to permit
  4413. // persons to whom the Software is furnished to do so, subject to the
  4414. // following conditions:
  4415. //
  4416. // The above copyright notice and this permission notice shall be included
  4417. // in all copies or substantial portions of the Software.
  4418. //
  4419. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  4420. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  4421. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  4422. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  4423. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  4424. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  4425. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  4426. //
  4427. // Changes from joyent/node:
  4428. //
  4429. // 1. No leading slash in paths,
  4430. // e.g. in `url.parse('http://foo?bar')` pathname is ``, not `/`
  4431. //
  4432. // 2. Backslashes are not replaced with slashes,
  4433. // so `http:\\example.org\` is treated like a relative path
  4434. //
  4435. // 3. Trailing colon is treated like a part of the path,
  4436. // i.e. in `http://example.org:foo` pathname is `:foo`
  4437. //
  4438. // 4. Nothing is URL-encoded in the resulting object,
  4439. // (in joyent/node some chars in auth and paths are encoded)
  4440. //
  4441. // 5. `url.parse()` does not have `parseQueryString` argument
  4442. //
  4443. // 6. Removed extraneous result properties: `host`, `path`, `query`, etc.,
  4444. // which can be constructed using other parts of the url.
  4445. //
  4446. function Url() {
  4447. this.protocol = null;
  4448. this.slashes = null;
  4449. this.auth = null;
  4450. this.port = null;
  4451. this.hostname = null;
  4452. this.hash = null;
  4453. this.search = null;
  4454. this.pathname = null;
  4455. }
  4456. // Reference: RFC 3986, RFC 1808, RFC 2396
  4457. // define these here so at least they only have to be
  4458. // compiled once on the first module load.
  4459. var protocolPattern = /^([a-z0-9.+-]+:)/i,
  4460. portPattern = /:[0-9]*$/,
  4461. // Special case for a simple path URL
  4462. simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
  4463. // RFC 2396: characters reserved for delimiting URLs.
  4464. // We actually just auto-escape these.
  4465. delims = [ '<', '>', '"', '`', ' ', '\r', '\n', '\t' ],
  4466. // RFC 2396: characters not allowed for various reasons.
  4467. unwise = [ '{', '}', '|', '\\', '^', '`' ].concat(delims),
  4468. // Allowed by RFCs, but cause of XSS attacks. Always escape these.
  4469. autoEscape = [ '\'' ].concat(unwise),
  4470. // Characters that are never ever allowed in a hostname.
  4471. // Note that any invalid chars are also handled, but these
  4472. // are the ones that are *expected* to be seen, so we fast-path
  4473. // them.
  4474. nonHostChars = [ '%', '/', '?', ';', '#' ].concat(autoEscape),
  4475. hostEndingChars = [ '/', '?', '#' ],
  4476. hostnameMaxLen = 255,
  4477. hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
  4478. hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
  4479. // protocols that can allow "unsafe" and "unwise" chars.
  4480. /* eslint-disable no-script-url */
  4481. // protocols that never have a hostname.
  4482. hostlessProtocol = {
  4483. 'javascript': true,
  4484. 'javascript:': true
  4485. },
  4486. // protocols that always contain a // bit.
  4487. slashedProtocol = {
  4488. 'http': true,
  4489. 'https': true,
  4490. 'ftp': true,
  4491. 'gopher': true,
  4492. 'file': true,
  4493. 'http:': true,
  4494. 'https:': true,
  4495. 'ftp:': true,
  4496. 'gopher:': true,
  4497. 'file:': true
  4498. };
  4499. /* eslint-enable no-script-url */
  4500. function urlParse(url, slashesDenoteHost) {
  4501. if (url && url instanceof Url) { return url; }
  4502. var u = new Url();
  4503. u.parse(url, slashesDenoteHost);
  4504. return u;
  4505. }
  4506. Url.prototype.parse = function(url, slashesDenoteHost) {
  4507. var i, l, lowerProto, hec, slashes,
  4508. rest = url;
  4509. // trim before proceeding.
  4510. // This is to support parse stuff like " http://foo.com \n"
  4511. rest = rest.trim();
  4512. if (!slashesDenoteHost && url.split('#').length === 1) {
  4513. // Try fast path regexp
  4514. var simplePath = simplePathPattern.exec(rest);
  4515. if (simplePath) {
  4516. this.pathname = simplePath[1];
  4517. if (simplePath[2]) {
  4518. this.search = simplePath[2];
  4519. }
  4520. return this;
  4521. }
  4522. }
  4523. var proto = protocolPattern.exec(rest);
  4524. if (proto) {
  4525. proto = proto[0];
  4526. lowerProto = proto.toLowerCase();
  4527. this.protocol = proto;
  4528. rest = rest.substr(proto.length);
  4529. }
  4530. // figure out if it's got a host
  4531. // user@server is *always* interpreted as a hostname, and url
  4532. // resolution will treat //foo/bar as host=foo,path=bar because that's
  4533. // how the browser resolves relative URLs.
  4534. if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
  4535. slashes = rest.substr(0, 2) === '//';
  4536. if (slashes && !(proto && hostlessProtocol[proto])) {
  4537. rest = rest.substr(2);
  4538. this.slashes = true;
  4539. }
  4540. }
  4541. if (!hostlessProtocol[proto] &&
  4542. (slashes || (proto && !slashedProtocol[proto]))) {
  4543. // there's a hostname.
  4544. // the first instance of /, ?, ;, or # ends the host.
  4545. //
  4546. // If there is an @ in the hostname, then non-host chars *are* allowed
  4547. // to the left of the last @ sign, unless some host-ending character
  4548. // comes *before* the @-sign.
  4549. // URLs are obnoxious.
  4550. //
  4551. // ex:
  4552. // http://a@b@c/ => user:a@b host:c
  4553. // http://a@b?@c => user:a host:c path:/?@c
  4554. // v0.12 TODO(isaacs): This is not quite how Chrome does things.
  4555. // Review our test case against browsers more comprehensively.
  4556. // find the first instance of any hostEndingChars
  4557. var hostEnd = -1;
  4558. for (i = 0; i < hostEndingChars.length; i++) {
  4559. hec = rest.indexOf(hostEndingChars[i]);
  4560. if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
  4561. hostEnd = hec;
  4562. }
  4563. }
  4564. // at this point, either we have an explicit point where the
  4565. // auth portion cannot go past, or the last @ char is the decider.
  4566. var auth, atSign;
  4567. if (hostEnd === -1) {
  4568. // atSign can be anywhere.
  4569. atSign = rest.lastIndexOf('@');
  4570. } else {
  4571. // atSign must be in auth portion.
  4572. // http://a@b/c@d => host:b auth:a path:/c@d
  4573. atSign = rest.lastIndexOf('@', hostEnd);
  4574. }
  4575. // Now we have a portion which is definitely the auth.
  4576. // Pull that off.
  4577. if (atSign !== -1) {
  4578. auth = rest.slice(0, atSign);
  4579. rest = rest.slice(atSign + 1);
  4580. this.auth = auth;
  4581. }
  4582. // the host is the remaining to the left of the first non-host char
  4583. hostEnd = -1;
  4584. for (i = 0; i < nonHostChars.length; i++) {
  4585. hec = rest.indexOf(nonHostChars[i]);
  4586. if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
  4587. hostEnd = hec;
  4588. }
  4589. }
  4590. // if we still have not hit it, then the entire thing is a host.
  4591. if (hostEnd === -1) {
  4592. hostEnd = rest.length;
  4593. }
  4594. if (rest[hostEnd - 1] === ':') { hostEnd--; }
  4595. var host = rest.slice(0, hostEnd);
  4596. rest = rest.slice(hostEnd);
  4597. // pull out port.
  4598. this.parseHost(host);
  4599. // we've indicated that there is a hostname,
  4600. // so even if it's empty, it has to be present.
  4601. this.hostname = this.hostname || '';
  4602. // if hostname begins with [ and ends with ]
  4603. // assume that it's an IPv6 address.
  4604. var ipv6Hostname = this.hostname[0] === '[' &&
  4605. this.hostname[this.hostname.length - 1] === ']';
  4606. // validate a little.
  4607. if (!ipv6Hostname) {
  4608. var hostparts = this.hostname.split(/\./);
  4609. for (i = 0, l = hostparts.length; i < l; i++) {
  4610. var part = hostparts[i];
  4611. if (!part) { continue; }
  4612. if (!part.match(hostnamePartPattern)) {
  4613. var newpart = '';
  4614. for (var j = 0, k = part.length; j < k; j++) {
  4615. if (part.charCodeAt(j) > 127) {
  4616. // we replace non-ASCII char with a temporary placeholder
  4617. // we need this to make sure size of hostname is not
  4618. // broken by replacing non-ASCII by nothing
  4619. newpart += 'x';
  4620. } else {
  4621. newpart += part[j];
  4622. }
  4623. }
  4624. // we test again with ASCII char only
  4625. if (!newpart.match(hostnamePartPattern)) {
  4626. var validParts = hostparts.slice(0, i);
  4627. var notHost = hostparts.slice(i + 1);
  4628. var bit = part.match(hostnamePartStart);
  4629. if (bit) {
  4630. validParts.push(bit[1]);
  4631. notHost.unshift(bit[2]);
  4632. }
  4633. if (notHost.length) {
  4634. rest = notHost.join('.') + rest;
  4635. }
  4636. this.hostname = validParts.join('.');
  4637. break;
  4638. }
  4639. }
  4640. }
  4641. }
  4642. if (this.hostname.length > hostnameMaxLen) {
  4643. this.hostname = '';
  4644. }
  4645. // strip [ and ] from the hostname
  4646. // the host field still retains them, though
  4647. if (ipv6Hostname) {
  4648. this.hostname = this.hostname.substr(1, this.hostname.length - 2);
  4649. }
  4650. }
  4651. // chop off from the tail first.
  4652. var hash = rest.indexOf('#');
  4653. if (hash !== -1) {
  4654. // got a fragment string.
  4655. this.hash = rest.substr(hash);
  4656. rest = rest.slice(0, hash);
  4657. }
  4658. var qm = rest.indexOf('?');
  4659. if (qm !== -1) {
  4660. this.search = rest.substr(qm);
  4661. rest = rest.slice(0, qm);
  4662. }
  4663. if (rest) { this.pathname = rest; }
  4664. if (slashedProtocol[lowerProto] &&
  4665. this.hostname && !this.pathname) {
  4666. this.pathname = '';
  4667. }
  4668. return this;
  4669. };
  4670. Url.prototype.parseHost = function(host) {
  4671. var port = portPattern.exec(host);
  4672. if (port) {
  4673. port = port[0];
  4674. if (port !== ':') {
  4675. this.port = port.substr(1);
  4676. }
  4677. host = host.substr(0, host.length - port.length);
  4678. }
  4679. if (host) { this.hostname = host; }
  4680. };
  4681. module.exports = urlParse;
  4682. /***/ }),
  4683. /* 36 */
  4684. /***/ (function(module, exports, __webpack_require__) {
  4685. "use strict";
  4686. exports.Any = __webpack_require__(13);
  4687. exports.Cc = __webpack_require__(14);
  4688. exports.Cf = __webpack_require__(37);
  4689. exports.P = __webpack_require__(5);
  4690. exports.Z = __webpack_require__(15);
  4691. /***/ }),
  4692. /* 37 */
  4693. /***/ (function(module, exports) {
  4694. module.exports=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804\uDCBD|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/
  4695. /***/ }),
  4696. /* 38 */
  4697. /***/ (function(module, exports, __webpack_require__) {
  4698. "use strict";
  4699. // Just a shortcut for bulk export
  4700. exports.parseLinkLabel = __webpack_require__(39);
  4701. exports.parseLinkDestination = __webpack_require__(40);
  4702. exports.parseLinkTitle = __webpack_require__(41);
  4703. /***/ }),
  4704. /* 39 */
  4705. /***/ (function(module, exports, __webpack_require__) {
  4706. "use strict";
  4707. // Parse link label
  4708. //
  4709. // this function assumes that first character ("[") already matches;
  4710. // returns the end of the label
  4711. //
  4712. module.exports = function parseLinkLabel(state, start, disableNested) {
  4713. var level, found, marker, prevPos,
  4714. labelEnd = -1,
  4715. max = state.posMax,
  4716. oldPos = state.pos;
  4717. state.pos = start + 1;
  4718. level = 1;
  4719. while (state.pos < max) {
  4720. marker = state.src.charCodeAt(state.pos);
  4721. if (marker === 0x5D /* ] */) {
  4722. level--;
  4723. if (level === 0) {
  4724. found = true;
  4725. break;
  4726. }
  4727. }
  4728. prevPos = state.pos;
  4729. state.md.inline.skipToken(state);
  4730. if (marker === 0x5B /* [ */) {
  4731. if (prevPos === state.pos - 1) {
  4732. // increase level if we find text `[`, which is not a part of any token
  4733. level++;
  4734. } else if (disableNested) {
  4735. state.pos = oldPos;
  4736. return -1;
  4737. }
  4738. }
  4739. }
  4740. if (found) {
  4741. labelEnd = state.pos;
  4742. }
  4743. // restore old state
  4744. state.pos = oldPos;
  4745. return labelEnd;
  4746. };
  4747. /***/ }),
  4748. /* 40 */
  4749. /***/ (function(module, exports, __webpack_require__) {
  4750. "use strict";
  4751. // Parse link destination
  4752. //
  4753. var isSpace = __webpack_require__(0).isSpace;
  4754. var unescapeAll = __webpack_require__(0).unescapeAll;
  4755. module.exports = function parseLinkDestination(str, pos, max) {
  4756. var code, level,
  4757. lines = 0,
  4758. start = pos,
  4759. result = {
  4760. ok: false,
  4761. pos: 0,
  4762. lines: 0,
  4763. str: ''
  4764. };
  4765. if (str.charCodeAt(pos) === 0x3C /* < */) {
  4766. pos++;
  4767. while (pos < max) {
  4768. code = str.charCodeAt(pos);
  4769. if (code === 0x0A /* \n */ || isSpace(code)) { return result; }
  4770. if (code === 0x3E /* > */) {
  4771. result.pos = pos + 1;
  4772. result.str = unescapeAll(str.slice(start + 1, pos));
  4773. result.ok = true;
  4774. return result;
  4775. }
  4776. if (code === 0x5C /* \ */ && pos + 1 < max) {
  4777. pos += 2;
  4778. continue;
  4779. }
  4780. pos++;
  4781. }
  4782. // no closing '>'
  4783. return result;
  4784. }
  4785. // this should be ... } else { ... branch
  4786. level = 0;
  4787. while (pos < max) {
  4788. code = str.charCodeAt(pos);
  4789. if (code === 0x20) { break; }
  4790. // ascii control characters
  4791. if (code < 0x20 || code === 0x7F) { break; }
  4792. if (code === 0x5C /* \ */ && pos + 1 < max) {
  4793. pos += 2;
  4794. continue;
  4795. }
  4796. if (code === 0x28 /* ( */) {
  4797. level++;
  4798. }
  4799. if (code === 0x29 /* ) */) {
  4800. if (level === 0) { break; }
  4801. level--;
  4802. }
  4803. pos++;
  4804. }
  4805. if (start === pos) { return result; }
  4806. if (level !== 0) { return result; }
  4807. result.str = unescapeAll(str.slice(start, pos));
  4808. result.lines = lines;
  4809. result.pos = pos;
  4810. result.ok = true;
  4811. return result;
  4812. };
  4813. /***/ }),
  4814. /* 41 */
  4815. /***/ (function(module, exports, __webpack_require__) {
  4816. "use strict";
  4817. // Parse link title
  4818. //
  4819. var unescapeAll = __webpack_require__(0).unescapeAll;
  4820. module.exports = function parseLinkTitle(str, pos, max) {
  4821. var code,
  4822. marker,
  4823. lines = 0,
  4824. start = pos,
  4825. result = {
  4826. ok: false,
  4827. pos: 0,
  4828. lines: 0,
  4829. str: ''
  4830. };
  4831. if (pos >= max) { return result; }
  4832. marker = str.charCodeAt(pos);
  4833. if (marker !== 0x22 /* " */ && marker !== 0x27 /* ' */ && marker !== 0x28 /* ( */) { return result; }
  4834. pos++;
  4835. // if opening marker is "(", switch it to closing marker ")"
  4836. if (marker === 0x28) { marker = 0x29; }
  4837. while (pos < max) {
  4838. code = str.charCodeAt(pos);
  4839. if (code === marker) {
  4840. result.pos = pos + 1;
  4841. result.lines = lines;
  4842. result.str = unescapeAll(str.slice(start + 1, pos));
  4843. result.ok = true;
  4844. return result;
  4845. } else if (code === 0x0A) {
  4846. lines++;
  4847. } else if (code === 0x5C /* \ */ && pos + 1 < max) {
  4848. pos++;
  4849. if (str.charCodeAt(pos) === 0x0A) {
  4850. lines++;
  4851. }
  4852. }
  4853. pos++;
  4854. }
  4855. return result;
  4856. };
  4857. /***/ }),
  4858. /* 42 */
  4859. /***/ (function(module, exports, __webpack_require__) {
  4860. "use strict";
  4861. /**
  4862. * class Renderer
  4863. *
  4864. * Generates HTML from parsed token stream. Each instance has independent
  4865. * copy of rules. Those can be rewritten with ease. Also, you can add new
  4866. * rules if you create plugin and adds new token types.
  4867. **/
  4868. var assign = __webpack_require__(0).assign;
  4869. var unescapeAll = __webpack_require__(0).unescapeAll;
  4870. var escapeHtml = __webpack_require__(0).escapeHtml;
  4871. ////////////////////////////////////////////////////////////////////////////////
  4872. var default_rules = {};
  4873. default_rules.code_inline = function (tokens, idx, options, env, slf) {
  4874. var token = tokens[idx];
  4875. return '<code' + slf.renderAttrs(token) + '>' +
  4876. escapeHtml(tokens[idx].content) +
  4877. '</code>';
  4878. };
  4879. default_rules.code_block = function (tokens, idx, options, env, slf) {
  4880. var token = tokens[idx];
  4881. return '<pre' + slf.renderAttrs(token) + '><code>' +
  4882. escapeHtml(tokens[idx].content) +
  4883. '</code></pre>\n';
  4884. };
  4885. default_rules.fence = function (tokens, idx, options, env, slf) {
  4886. var token = tokens[idx],
  4887. info = token.info ? unescapeAll(token.info).trim() : '',
  4888. langName = '',
  4889. highlighted, i, tmpAttrs, tmpToken;
  4890. if (info) {
  4891. langName = info.split(/\s+/g)[0];
  4892. }
  4893. if (options.highlight) {
  4894. highlighted = options.highlight(token.content, langName) || escapeHtml(token.content);
  4895. } else {
  4896. highlighted = escapeHtml(token.content);
  4897. }
  4898. if (highlighted.indexOf('<pre') === 0) {
  4899. return highlighted + '\n';
  4900. }
  4901. // If language exists, inject class gently, without modifying original token.
  4902. // May be, one day we will add .clone() for token and simplify this part, but
  4903. // now we prefer to keep things local.
  4904. if (info) {
  4905. i = token.attrIndex('class');
  4906. tmpAttrs = token.attrs ? token.attrs.slice() : [];
  4907. if (i < 0) {
  4908. tmpAttrs.push([ 'class', options.langPrefix + langName ]);
  4909. } else {
  4910. tmpAttrs[i][1] += ' ' + options.langPrefix + langName;
  4911. }
  4912. // Fake token just to render attributes
  4913. tmpToken = {
  4914. attrs: tmpAttrs
  4915. };
  4916. return '<pre><code' + slf.renderAttrs(tmpToken) + '>'
  4917. + highlighted
  4918. + '</code></pre>\n';
  4919. }
  4920. return '<pre><code' + slf.renderAttrs(token) + '>'
  4921. + highlighted
  4922. + '</code></pre>\n';
  4923. };
  4924. default_rules.image = function (tokens, idx, options, env, slf) {
  4925. var token = tokens[idx];
  4926. // "alt" attr MUST be set, even if empty. Because it's mandatory and
  4927. // should be placed on proper position for tests.
  4928. //
  4929. // Replace content with actual value
  4930. token.attrs[token.attrIndex('alt')][1] =
  4931. slf.renderInlineAsText(token.children, options, env);
  4932. return slf.renderToken(tokens, idx, options);
  4933. };
  4934. default_rules.hardbreak = function (tokens, idx, options /*, env */) {
  4935. return options.xhtmlOut ? '<br />\n' : '<br>\n';
  4936. };
  4937. default_rules.softbreak = function (tokens, idx, options /*, env */) {
  4938. return options.breaks ? (options.xhtmlOut ? '<br />\n' : '<br>\n') : '\n';
  4939. };
  4940. default_rules.text = function (tokens, idx /*, options, env */) {
  4941. return escapeHtml(tokens[idx].content);
  4942. };
  4943. default_rules.html_block = function (tokens, idx /*, options, env */) {
  4944. return tokens[idx].content;
  4945. };
  4946. default_rules.html_inline = function (tokens, idx /*, options, env */) {
  4947. return tokens[idx].content;
  4948. };
  4949. /**
  4950. * new Renderer()
  4951. *
  4952. * Creates new [[Renderer]] instance and fill [[Renderer#rules]] with defaults.
  4953. **/
  4954. function Renderer() {
  4955. /**
  4956. * Renderer#rules -> Object
  4957. *
  4958. * Contains render rules for tokens. Can be updated and extended.
  4959. *
  4960. * ##### Example
  4961. *
  4962. * ```javascript
  4963. * var md = require('markdown-it')();
  4964. *
  4965. * md.renderer.rules.strong_open = function () { return '<b>'; };
  4966. * md.renderer.rules.strong_close = function () { return '</b>'; };
  4967. *
  4968. * var result = md.renderInline(...);
  4969. * ```
  4970. *
  4971. * Each rule is called as independed static function with fixed signature:
  4972. *
  4973. * ```javascript
  4974. * function my_token_render(tokens, idx, options, env, renderer) {
  4975. * // ...
  4976. * return renderedHTML;
  4977. * }
  4978. * ```
  4979. *
  4980. * See [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js)
  4981. * for more details and examples.
  4982. **/
  4983. this.rules = assign({}, default_rules);
  4984. }
  4985. /**
  4986. * Renderer.renderAttrs(token) -> String
  4987. *
  4988. * Render token attributes to string.
  4989. **/
  4990. Renderer.prototype.renderAttrs = function renderAttrs(token) {
  4991. var i, l, result;
  4992. if (!token.attrs) { return ''; }
  4993. result = '';
  4994. for (i = 0, l = token.attrs.length; i < l; i++) {
  4995. result += ' ' + escapeHtml(token.attrs[i][0]) + '="' + escapeHtml(token.attrs[i][1]) + '"';
  4996. }
  4997. return result;
  4998. };
  4999. /**
  5000. * Renderer.renderToken(tokens, idx, options) -> String
  5001. * - tokens (Array): list of tokens
  5002. * - idx (Numbed): token index to render
  5003. * - options (Object): params of parser instance
  5004. *
  5005. * Default token renderer. Can be overriden by custom function
  5006. * in [[Renderer#rules]].
  5007. **/
  5008. Renderer.prototype.renderToken = function renderToken(tokens, idx, options) {
  5009. var nextToken,
  5010. result = '',
  5011. needLf = false,
  5012. token = tokens[idx];
  5013. // Tight list paragraphs
  5014. if (token.hidden) {
  5015. return '';
  5016. }
  5017. // Insert a newline between hidden paragraph and subsequent opening
  5018. // block-level tag.
  5019. //
  5020. // For example, here we should insert a newline before blockquote:
  5021. // - a
  5022. // >
  5023. //
  5024. if (token.block && token.nesting !== -1 && idx && tokens[idx - 1].hidden) {
  5025. result += '\n';
  5026. }
  5027. // Add token name, e.g. `<img`
  5028. result += (token.nesting === -1 ? '</' : '<') + token.tag;
  5029. // Encode attributes, e.g. `<img src="foo"`
  5030. result += this.renderAttrs(token);
  5031. // Add a slash for self-closing tags, e.g. `<img src="foo" /`
  5032. if (token.nesting === 0 && options.xhtmlOut) {
  5033. result += ' /';
  5034. }
  5035. // Check if we need to add a newline after this tag
  5036. if (token.block) {
  5037. needLf = true;
  5038. if (token.nesting === 1) {
  5039. if (idx + 1 < tokens.length) {
  5040. nextToken = tokens[idx + 1];
  5041. if (nextToken.type === 'inline' || nextToken.hidden) {
  5042. // Block-level tag containing an inline tag.
  5043. //
  5044. needLf = false;
  5045. } else if (nextToken.nesting === -1 && nextToken.tag === token.tag) {
  5046. // Opening tag + closing tag of the same type. E.g. `<li></li>`.
  5047. //
  5048. needLf = false;
  5049. }
  5050. }
  5051. }
  5052. }
  5053. result += needLf ? '>\n' : '>';
  5054. return result;
  5055. };
  5056. /**
  5057. * Renderer.renderInline(tokens, options, env) -> String
  5058. * - tokens (Array): list on block tokens to renter
  5059. * - options (Object): params of parser instance
  5060. * - env (Object): additional data from parsed input (references, for example)
  5061. *
  5062. * The same as [[Renderer.render]], but for single token of `inline` type.
  5063. **/
  5064. Renderer.prototype.renderInline = function (tokens, options, env) {
  5065. var type,
  5066. result = '',
  5067. rules = this.rules;
  5068. for (var i = 0, len = tokens.length; i < len; i++) {
  5069. type = tokens[i].type;
  5070. if (typeof rules[type] !== 'undefined') {
  5071. result += rules[type](tokens, i, options, env, this);
  5072. } else {
  5073. result += this.renderToken(tokens, i, options);
  5074. }
  5075. }
  5076. return result;
  5077. };
  5078. /** internal
  5079. * Renderer.renderInlineAsText(tokens, options, env) -> String
  5080. * - tokens (Array): list on block tokens to renter
  5081. * - options (Object): params of parser instance
  5082. * - env (Object): additional data from parsed input (references, for example)
  5083. *
  5084. * Special kludge for image `alt` attributes to conform CommonMark spec.
  5085. * Don't try to use it! Spec requires to show `alt` content with stripped markup,
  5086. * instead of simple escaping.
  5087. **/
  5088. Renderer.prototype.renderInlineAsText = function (tokens, options, env) {
  5089. var result = '';
  5090. for (var i = 0, len = tokens.length; i < len; i++) {
  5091. if (tokens[i].type === 'text') {
  5092. result += tokens[i].content;
  5093. } else if (tokens[i].type === 'image') {
  5094. result += this.renderInlineAsText(tokens[i].children, options, env);
  5095. }
  5096. }
  5097. return result;
  5098. };
  5099. /**
  5100. * Renderer.render(tokens, options, env) -> String
  5101. * - tokens (Array): list on block tokens to renter
  5102. * - options (Object): params of parser instance
  5103. * - env (Object): additional data from parsed input (references, for example)
  5104. *
  5105. * Takes token stream and generates HTML. Probably, you will never need to call
  5106. * this method directly.
  5107. **/
  5108. Renderer.prototype.render = function (tokens, options, env) {
  5109. var i, len, type,
  5110. result = '',
  5111. rules = this.rules;
  5112. for (i = 0, len = tokens.length; i < len; i++) {
  5113. type = tokens[i].type;
  5114. if (type === 'inline') {
  5115. result += this.renderInline(tokens[i].children, options, env);
  5116. } else if (typeof rules[type] !== 'undefined') {
  5117. result += rules[tokens[i].type](tokens, i, options, env, this);
  5118. } else {
  5119. result += this.renderToken(tokens, i, options, env);
  5120. }
  5121. }
  5122. return result;
  5123. };
  5124. module.exports = Renderer;
  5125. /***/ }),
  5126. /* 43 */
  5127. /***/ (function(module, exports, __webpack_require__) {
  5128. "use strict";
  5129. /** internal
  5130. * class Core
  5131. *
  5132. * Top-level rules executor. Glues block/inline parsers and does intermediate
  5133. * transformations.
  5134. **/
  5135. var Ruler = __webpack_require__(6);
  5136. var _rules = [
  5137. [ 'normalize', __webpack_require__(44) ],
  5138. [ 'block', __webpack_require__(45) ],
  5139. [ 'inline', __webpack_require__(46) ],
  5140. [ 'linkify', __webpack_require__(47) ],
  5141. [ 'replacements', __webpack_require__(48) ],
  5142. [ 'smartquotes', __webpack_require__(49) ]
  5143. ];
  5144. /**
  5145. * new Core()
  5146. **/
  5147. function Core() {
  5148. /**
  5149. * Core#ruler -> Ruler
  5150. *
  5151. * [[Ruler]] instance. Keep configuration of core rules.
  5152. **/
  5153. this.ruler = new Ruler();
  5154. for (var i = 0; i < _rules.length; i++) {
  5155. this.ruler.push(_rules[i][0], _rules[i][1]);
  5156. }
  5157. }
  5158. /**
  5159. * Core.process(state)
  5160. *
  5161. * Executes core chain rules.
  5162. **/
  5163. Core.prototype.process = function (state) {
  5164. var i, l, rules;
  5165. rules = this.ruler.getRules('');
  5166. for (i = 0, l = rules.length; i < l; i++) {
  5167. rules[i](state);
  5168. }
  5169. };
  5170. Core.prototype.State = __webpack_require__(50);
  5171. module.exports = Core;
  5172. /***/ }),
  5173. /* 44 */
  5174. /***/ (function(module, exports, __webpack_require__) {
  5175. "use strict";
  5176. // Normalize input string
  5177. var NEWLINES_RE = /\r[\n\u0085]?|[\u2424\u2028\u0085]/g;
  5178. var NULL_RE = /\u0000/g;
  5179. module.exports = function inline(state) {
  5180. var str;
  5181. // Normalize newlines
  5182. str = state.src.replace(NEWLINES_RE, '\n');
  5183. // Replace NULL characters
  5184. str = str.replace(NULL_RE, '\uFFFD');
  5185. state.src = str;
  5186. };
  5187. /***/ }),
  5188. /* 45 */
  5189. /***/ (function(module, exports, __webpack_require__) {
  5190. "use strict";
  5191. module.exports = function block(state) {
  5192. var token;
  5193. if (state.inlineMode) {
  5194. token = new state.Token('inline', '', 0);
  5195. token.content = state.src;
  5196. token.map = [ 0, 1 ];
  5197. token.children = [];
  5198. state.tokens.push(token);
  5199. } else {
  5200. state.md.block.parse(state.src, state.md, state.env, state.tokens);
  5201. }
  5202. };
  5203. /***/ }),
  5204. /* 46 */
  5205. /***/ (function(module, exports, __webpack_require__) {
  5206. "use strict";
  5207. module.exports = function inline(state) {
  5208. var tokens = state.tokens, tok, i, l;
  5209. // Parse inlines
  5210. for (i = 0, l = tokens.length; i < l; i++) {
  5211. tok = tokens[i];
  5212. if (tok.type === 'inline') {
  5213. state.md.inline.parse(tok.content, state.md, state.env, tok.children);
  5214. }
  5215. }
  5216. };
  5217. /***/ }),
  5218. /* 47 */
  5219. /***/ (function(module, exports, __webpack_require__) {
  5220. "use strict";
  5221. // Replace link-like texts with link nodes.
  5222. //
  5223. // Currently restricted by `md.validateLink()` to http/https/ftp
  5224. //
  5225. var arrayReplaceAt = __webpack_require__(0).arrayReplaceAt;
  5226. function isLinkOpen(str) {
  5227. return /^<a[>\s]/i.test(str);
  5228. }
  5229. function isLinkClose(str) {
  5230. return /^<\/a\s*>/i.test(str);
  5231. }
  5232. module.exports = function linkify(state) {
  5233. var i, j, l, tokens, token, currentToken, nodes, ln, text, pos, lastPos,
  5234. level, htmlLinkLevel, url, fullUrl, urlText,
  5235. blockTokens = state.tokens,
  5236. links;
  5237. if (!state.md.options.linkify) { return; }
  5238. for (j = 0, l = blockTokens.length; j < l; j++) {
  5239. if (blockTokens[j].type !== 'inline' ||
  5240. !state.md.linkify.pretest(blockTokens[j].content)) {
  5241. continue;
  5242. }
  5243. tokens = blockTokens[j].children;
  5244. htmlLinkLevel = 0;
  5245. // We scan from the end, to keep position when new tags added.
  5246. // Use reversed logic in links start/end match
  5247. for (i = tokens.length - 1; i >= 0; i--) {
  5248. currentToken = tokens[i];
  5249. // Skip content of markdown links
  5250. if (currentToken.type === 'link_close') {
  5251. i--;
  5252. while (tokens[i].level !== currentToken.level && tokens[i].type !== 'link_open') {
  5253. i--;
  5254. }
  5255. continue;
  5256. }
  5257. // Skip content of html tag links
  5258. if (currentToken.type === 'html_inline') {
  5259. if (isLinkOpen(currentToken.content) && htmlLinkLevel > 0) {
  5260. htmlLinkLevel--;
  5261. }
  5262. if (isLinkClose(currentToken.content)) {
  5263. htmlLinkLevel++;
  5264. }
  5265. }
  5266. if (htmlLinkLevel > 0) { continue; }
  5267. if (currentToken.type === 'text' && state.md.linkify.test(currentToken.content)) {
  5268. text = currentToken.content;
  5269. links = state.md.linkify.match(text);
  5270. // Now split string to nodes
  5271. nodes = [];
  5272. level = currentToken.level;
  5273. lastPos = 0;
  5274. for (ln = 0; ln < links.length; ln++) {
  5275. url = links[ln].url;
  5276. fullUrl = state.md.normalizeLink(url);
  5277. if (!state.md.validateLink(fullUrl)) { continue; }
  5278. urlText = links[ln].text;
  5279. // Linkifier might send raw hostnames like "example.com", where url
  5280. // starts with domain name. So we prepend http:// in those cases,
  5281. // and remove it afterwards.
  5282. //
  5283. if (!links[ln].schema) {
  5284. urlText = state.md.normalizeLinkText('http://' + urlText).replace(/^http:\/\//, '');
  5285. } else if (links[ln].schema === 'mailto:' && !/^mailto:/i.test(urlText)) {
  5286. urlText = state.md.normalizeLinkText('mailto:' + urlText).replace(/^mailto:/, '');
  5287. } else {
  5288. urlText = state.md.normalizeLinkText(urlText);
  5289. }
  5290. pos = links[ln].index;
  5291. if (pos > lastPos) {
  5292. token = new state.Token('text', '', 0);
  5293. token.content = text.slice(lastPos, pos);
  5294. token.level = level;
  5295. nodes.push(token);
  5296. }
  5297. token = new state.Token('link_open', 'a', 1);
  5298. token.attrs = [ [ 'href', fullUrl ] ];
  5299. token.level = level++;
  5300. token.markup = 'linkify';
  5301. token.info = 'auto';
  5302. nodes.push(token);
  5303. token = new state.Token('text', '', 0);
  5304. token.content = urlText;
  5305. token.level = level;
  5306. nodes.push(token);
  5307. token = new state.Token('link_close', 'a', -1);
  5308. token.level = --level;
  5309. token.markup = 'linkify';
  5310. token.info = 'auto';
  5311. nodes.push(token);
  5312. lastPos = links[ln].lastIndex;
  5313. }
  5314. if (lastPos < text.length) {
  5315. token = new state.Token('text', '', 0);
  5316. token.content = text.slice(lastPos);
  5317. token.level = level;
  5318. nodes.push(token);
  5319. }
  5320. // replace current node
  5321. blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);
  5322. }
  5323. }
  5324. }
  5325. };
  5326. /***/ }),
  5327. /* 48 */
  5328. /***/ (function(module, exports, __webpack_require__) {
  5329. "use strict";
  5330. // Simple typographyc replacements
  5331. //
  5332. // (c) (C) → ©
  5333. // (tm) (TM) → ™
  5334. // (r) (R) → ®
  5335. // +- → ±
  5336. // (p) (P) -> §
  5337. // ... → … (also ?.... → ?.., !.... → !..)
  5338. // ???????? → ???, !!!!! → !!!, `,,` → `,`
  5339. // -- → &ndash;, --- → &mdash;
  5340. //
  5341. // TODO:
  5342. // - fractionals 1/2, 1/4, 3/4 -> ½, ¼, ¾
  5343. // - miltiplication 2 x 4 -> 2 × 4
  5344. var RARE_RE = /\+-|\.\.|\?\?\?\?|!!!!|,,|--/;
  5345. // Workaround for phantomjs - need regex without /g flag,
  5346. // or root check will fail every second time
  5347. var SCOPED_ABBR_TEST_RE = /\((c|tm|r|p)\)/i;
  5348. var SCOPED_ABBR_RE = /\((c|tm|r|p)\)/ig;
  5349. var SCOPED_ABBR = {
  5350. c: '©',
  5351. r: '®',
  5352. p: '§',
  5353. tm: '™'
  5354. };
  5355. function replaceFn(match, name) {
  5356. return SCOPED_ABBR[name.toLowerCase()];
  5357. }
  5358. function replace_scoped(inlineTokens) {
  5359. var i, token, inside_autolink = 0;
  5360. for (i = inlineTokens.length - 1; i >= 0; i--) {
  5361. token = inlineTokens[i];
  5362. if (token.type === 'text' && !inside_autolink) {
  5363. token.content = token.content.replace(SCOPED_ABBR_RE, replaceFn);
  5364. }
  5365. if (token.type === 'link_open' && token.info === 'auto') {
  5366. inside_autolink--;
  5367. }
  5368. if (token.type === 'link_close' && token.info === 'auto') {
  5369. inside_autolink++;
  5370. }
  5371. }
  5372. }
  5373. function replace_rare(inlineTokens) {
  5374. var i, token, inside_autolink = 0;
  5375. for (i = inlineTokens.length - 1; i >= 0; i--) {
  5376. token = inlineTokens[i];
  5377. if (token.type === 'text' && !inside_autolink) {
  5378. if (RARE_RE.test(token.content)) {
  5379. token.content = token.content
  5380. .replace(/\+-/g, '±')
  5381. // .., ..., ....... -> …
  5382. // but ?..... & !..... -> ?.. & !..
  5383. .replace(/\.{2,}/g, '…').replace(/([?!])…/g, '$1..')
  5384. .replace(/([?!]){4,}/g, '$1$1$1').replace(/,{2,}/g, ',')
  5385. // em-dash
  5386. .replace(/(^|[^-])---([^-]|$)/mg, '$1\u2014$2')
  5387. // en-dash
  5388. .replace(/(^|\s)--(\s|$)/mg, '$1\u2013$2')
  5389. .replace(/(^|[^-\s])--([^-\s]|$)/mg, '$1\u2013$2');
  5390. }
  5391. }
  5392. if (token.type === 'link_open' && token.info === 'auto') {
  5393. inside_autolink--;
  5394. }
  5395. if (token.type === 'link_close' && token.info === 'auto') {
  5396. inside_autolink++;
  5397. }
  5398. }
  5399. }
  5400. module.exports = function replace(state) {
  5401. var blkIdx;
  5402. if (!state.md.options.typographer) { return; }
  5403. for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {
  5404. if (state.tokens[blkIdx].type !== 'inline') { continue; }
  5405. if (SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)) {
  5406. replace_scoped(state.tokens[blkIdx].children);
  5407. }
  5408. if (RARE_RE.test(state.tokens[blkIdx].content)) {
  5409. replace_rare(state.tokens[blkIdx].children);
  5410. }
  5411. }
  5412. };
  5413. /***/ }),
  5414. /* 49 */
  5415. /***/ (function(module, exports, __webpack_require__) {
  5416. "use strict";
  5417. // Convert straight quotation marks to typographic ones
  5418. //
  5419. var isWhiteSpace = __webpack_require__(0).isWhiteSpace;
  5420. var isPunctChar = __webpack_require__(0).isPunctChar;
  5421. var isMdAsciiPunct = __webpack_require__(0).isMdAsciiPunct;
  5422. var QUOTE_TEST_RE = /['"]/;
  5423. var QUOTE_RE = /['"]/g;
  5424. var APOSTROPHE = '\u2019'; /* ’ */
  5425. function replaceAt(str, index, ch) {
  5426. return str.substr(0, index) + ch + str.substr(index + 1);
  5427. }
  5428. function process_inlines(tokens, state) {
  5429. var i, token, text, t, pos, max, thisLevel, item, lastChar, nextChar,
  5430. isLastPunctChar, isNextPunctChar, isLastWhiteSpace, isNextWhiteSpace,
  5431. canOpen, canClose, j, isSingle, stack, openQuote, closeQuote;
  5432. stack = [];
  5433. for (i = 0; i < tokens.length; i++) {
  5434. token = tokens[i];
  5435. thisLevel = tokens[i].level;
  5436. for (j = stack.length - 1; j >= 0; j--) {
  5437. if (stack[j].level <= thisLevel) { break; }
  5438. }
  5439. stack.length = j + 1;
  5440. if (token.type !== 'text') { continue; }
  5441. text = token.content;
  5442. pos = 0;
  5443. max = text.length;
  5444. /*eslint no-labels:0,block-scoped-var:0*/
  5445. OUTER:
  5446. while (pos < max) {
  5447. QUOTE_RE.lastIndex = pos;
  5448. t = QUOTE_RE.exec(text);
  5449. if (!t) { break; }
  5450. canOpen = canClose = true;
  5451. pos = t.index + 1;
  5452. isSingle = (t[0] === "'");
  5453. // Find previous character,
  5454. // default to space if it's the beginning of the line
  5455. //
  5456. lastChar = 0x20;
  5457. if (t.index - 1 >= 0) {
  5458. lastChar = text.charCodeAt(t.index - 1);
  5459. } else {
  5460. for (j = i - 1; j >= 0; j--) {
  5461. if (tokens[j].type !== 'text') { continue; }
  5462. lastChar = tokens[j].content.charCodeAt(tokens[j].content.length - 1);
  5463. break;
  5464. }
  5465. }
  5466. // Find next character,
  5467. // default to space if it's the end of the line
  5468. //
  5469. nextChar = 0x20;
  5470. if (pos < max) {
  5471. nextChar = text.charCodeAt(pos);
  5472. } else {
  5473. for (j = i + 1; j < tokens.length; j++) {
  5474. if (tokens[j].type !== 'text') { continue; }
  5475. nextChar = tokens[j].content.charCodeAt(0);
  5476. break;
  5477. }
  5478. }
  5479. isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
  5480. isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
  5481. isLastWhiteSpace = isWhiteSpace(lastChar);
  5482. isNextWhiteSpace = isWhiteSpace(nextChar);
  5483. if (isNextWhiteSpace) {
  5484. canOpen = false;
  5485. } else if (isNextPunctChar) {
  5486. if (!(isLastWhiteSpace || isLastPunctChar)) {
  5487. canOpen = false;
  5488. }
  5489. }
  5490. if (isLastWhiteSpace) {
  5491. canClose = false;
  5492. } else if (isLastPunctChar) {
  5493. if (!(isNextWhiteSpace || isNextPunctChar)) {
  5494. canClose = false;
  5495. }
  5496. }
  5497. if (nextChar === 0x22 /* " */ && t[0] === '"') {
  5498. if (lastChar >= 0x30 /* 0 */ && lastChar <= 0x39 /* 9 */) {
  5499. // special case: 1"" - count first quote as an inch
  5500. canClose = canOpen = false;
  5501. }
  5502. }
  5503. if (canOpen && canClose) {
  5504. // treat this as the middle of the word
  5505. canOpen = false;
  5506. canClose = isNextPunctChar;
  5507. }
  5508. if (!canOpen && !canClose) {
  5509. // middle of word
  5510. if (isSingle) {
  5511. token.content = replaceAt(token.content, t.index, APOSTROPHE);
  5512. }
  5513. continue;
  5514. }
  5515. if (canClose) {
  5516. // this could be a closing quote, rewind the stack to get a match
  5517. for (j = stack.length - 1; j >= 0; j--) {
  5518. item = stack[j];
  5519. if (stack[j].level < thisLevel) { break; }
  5520. if (item.single === isSingle && stack[j].level === thisLevel) {
  5521. item = stack[j];
  5522. if (isSingle) {
  5523. openQuote = state.md.options.quotes[2];
  5524. closeQuote = state.md.options.quotes[3];
  5525. } else {
  5526. openQuote = state.md.options.quotes[0];
  5527. closeQuote = state.md.options.quotes[1];
  5528. }
  5529. // replace token.content *before* tokens[item.token].content,
  5530. // because, if they are pointing at the same token, replaceAt
  5531. // could mess up indices when quote length != 1
  5532. token.content = replaceAt(token.content, t.index, closeQuote);
  5533. tokens[item.token].content = replaceAt(
  5534. tokens[item.token].content, item.pos, openQuote);
  5535. pos += closeQuote.length - 1;
  5536. if (item.token === i) { pos += openQuote.length - 1; }
  5537. text = token.content;
  5538. max = text.length;
  5539. stack.length = j;
  5540. continue OUTER;
  5541. }
  5542. }
  5543. }
  5544. if (canOpen) {
  5545. stack.push({
  5546. token: i,
  5547. pos: t.index,
  5548. single: isSingle,
  5549. level: thisLevel
  5550. });
  5551. } else if (canClose && isSingle) {
  5552. token.content = replaceAt(token.content, t.index, APOSTROPHE);
  5553. }
  5554. }
  5555. }
  5556. }
  5557. module.exports = function smartquotes(state) {
  5558. /*eslint max-depth:0*/
  5559. var blkIdx;
  5560. if (!state.md.options.typographer) { return; }
  5561. for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {
  5562. if (state.tokens[blkIdx].type !== 'inline' ||
  5563. !QUOTE_TEST_RE.test(state.tokens[blkIdx].content)) {
  5564. continue;
  5565. }
  5566. process_inlines(state.tokens[blkIdx].children, state);
  5567. }
  5568. };
  5569. /***/ }),
  5570. /* 50 */
  5571. /***/ (function(module, exports, __webpack_require__) {
  5572. "use strict";
  5573. // Core state object
  5574. //
  5575. var Token = __webpack_require__(7);
  5576. function StateCore(src, md, env) {
  5577. this.src = src;
  5578. this.env = env;
  5579. this.tokens = [];
  5580. this.inlineMode = false;
  5581. this.md = md; // link to parser instance
  5582. }
  5583. // re-export Token class to use in core rules
  5584. StateCore.prototype.Token = Token;
  5585. module.exports = StateCore;
  5586. /***/ }),
  5587. /* 51 */
  5588. /***/ (function(module, exports, __webpack_require__) {
  5589. "use strict";
  5590. /** internal
  5591. * class ParserBlock
  5592. *
  5593. * Block-level tokenizer.
  5594. **/
  5595. var Ruler = __webpack_require__(6);
  5596. var _rules = [
  5597. // First 2 params - rule name & source. Secondary array - list of rules,
  5598. // which can be terminated by this one.
  5599. [ 'table', __webpack_require__(52), [ 'paragraph', 'reference' ] ],
  5600. [ 'code', __webpack_require__(53) ],
  5601. [ 'fence', __webpack_require__(54), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],
  5602. [ 'blockquote', __webpack_require__(55), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],
  5603. [ 'hr', __webpack_require__(56), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],
  5604. [ 'list', __webpack_require__(57), [ 'paragraph', 'reference', 'blockquote' ] ],
  5605. [ 'reference', __webpack_require__(58) ],
  5606. [ 'heading', __webpack_require__(59), [ 'paragraph', 'reference', 'blockquote' ] ],
  5607. [ 'lheading', __webpack_require__(60) ],
  5608. [ 'html_block', __webpack_require__(61), [ 'paragraph', 'reference', 'blockquote' ] ],
  5609. [ 'paragraph', __webpack_require__(63) ]
  5610. ];
  5611. /**
  5612. * new ParserBlock()
  5613. **/
  5614. function ParserBlock() {
  5615. /**
  5616. * ParserBlock#ruler -> Ruler
  5617. *
  5618. * [[Ruler]] instance. Keep configuration of block rules.
  5619. **/
  5620. this.ruler = new Ruler();
  5621. for (var i = 0; i < _rules.length; i++) {
  5622. this.ruler.push(_rules[i][0], _rules[i][1], { alt: (_rules[i][2] || []).slice() });
  5623. }
  5624. }
  5625. // Generate tokens for input range
  5626. //
  5627. ParserBlock.prototype.tokenize = function (state, startLine, endLine) {
  5628. var ok, i,
  5629. rules = this.ruler.getRules(''),
  5630. len = rules.length,
  5631. line = startLine,
  5632. hasEmptyLines = false,
  5633. maxNesting = state.md.options.maxNesting;
  5634. while (line < endLine) {
  5635. state.line = line = state.skipEmptyLines(line);
  5636. if (line >= endLine) { break; }
  5637. // Termination condition for nested calls.
  5638. // Nested calls currently used for blockquotes & lists
  5639. if (state.sCount[line] < state.blkIndent) { break; }
  5640. // If nesting level exceeded - skip tail to the end. That's not ordinary
  5641. // situation and we should not care about content.
  5642. if (state.level >= maxNesting) {
  5643. state.line = endLine;
  5644. break;
  5645. }
  5646. // Try all possible rules.
  5647. // On success, rule should:
  5648. //
  5649. // - update `state.line`
  5650. // - update `state.tokens`
  5651. // - return true
  5652. for (i = 0; i < len; i++) {
  5653. ok = rules[i](state, line, endLine, false);
  5654. if (ok) { break; }
  5655. }
  5656. // set state.tight if we had an empty line before current tag
  5657. // i.e. latest empty line should not count
  5658. state.tight = !hasEmptyLines;
  5659. // paragraph might "eat" one newline after it in nested lists
  5660. if (state.isEmpty(state.line - 1)) {
  5661. hasEmptyLines = true;
  5662. }
  5663. line = state.line;
  5664. if (line < endLine && state.isEmpty(line)) {
  5665. hasEmptyLines = true;
  5666. line++;
  5667. state.line = line;
  5668. }
  5669. }
  5670. };
  5671. /**
  5672. * ParserBlock.parse(str, md, env, outTokens)
  5673. *
  5674. * Process input string and push block tokens into `outTokens`
  5675. **/
  5676. ParserBlock.prototype.parse = function (src, md, env, outTokens) {
  5677. var state;
  5678. if (!src) { return; }
  5679. state = new this.State(src, md, env, outTokens);
  5680. this.tokenize(state, state.line, state.lineMax);
  5681. };
  5682. ParserBlock.prototype.State = __webpack_require__(64);
  5683. module.exports = ParserBlock;
  5684. /***/ }),
  5685. /* 52 */
  5686. /***/ (function(module, exports, __webpack_require__) {
  5687. "use strict";
  5688. // GFM table, non-standard
  5689. var isSpace = __webpack_require__(0).isSpace;
  5690. function getLine(state, line) {
  5691. var pos = state.bMarks[line] + state.blkIndent,
  5692. max = state.eMarks[line];
  5693. return state.src.substr(pos, max - pos);
  5694. }
  5695. function escapedSplit(str) {
  5696. var result = [],
  5697. pos = 0,
  5698. max = str.length,
  5699. ch,
  5700. escapes = 0,
  5701. lastPos = 0,
  5702. backTicked = false,
  5703. lastBackTick = 0;
  5704. ch = str.charCodeAt(pos);
  5705. while (pos < max) {
  5706. if (ch === 0x60/* ` */) {
  5707. if (backTicked) {
  5708. // make \` close code sequence, but not open it;
  5709. // the reason is: `\` is correct code block
  5710. backTicked = false;
  5711. lastBackTick = pos;
  5712. } else if (escapes % 2 === 0) {
  5713. backTicked = true;
  5714. lastBackTick = pos;
  5715. }
  5716. } else if (ch === 0x7c/* | */ && (escapes % 2 === 0) && !backTicked) {
  5717. result.push(str.substring(lastPos, pos));
  5718. lastPos = pos + 1;
  5719. }
  5720. if (ch === 0x5c/* \ */) {
  5721. escapes++;
  5722. } else {
  5723. escapes = 0;
  5724. }
  5725. pos++;
  5726. // If there was an un-closed backtick, go back to just after
  5727. // the last backtick, but as if it was a normal character
  5728. if (pos === max && backTicked) {
  5729. backTicked = false;
  5730. pos = lastBackTick + 1;
  5731. }
  5732. ch = str.charCodeAt(pos);
  5733. }
  5734. result.push(str.substring(lastPos));
  5735. return result;
  5736. }
  5737. module.exports = function table(state, startLine, endLine, silent) {
  5738. var ch, lineText, pos, i, nextLine, columns, columnCount, token,
  5739. aligns, t, tableLines, tbodyLines;
  5740. // should have at least two lines
  5741. if (startLine + 2 > endLine) { return false; }
  5742. nextLine = startLine + 1;
  5743. if (state.sCount[nextLine] < state.blkIndent) { return false; }
  5744. // if it's indented more than 3 spaces, it should be a code block
  5745. if (state.sCount[nextLine] - state.blkIndent >= 4) { return false; }
  5746. // first character of the second line should be '|', '-', ':',
  5747. // and no other characters are allowed but spaces;
  5748. // basically, this is the equivalent of /^[-:|][-:|\s]*$/ regexp
  5749. pos = state.bMarks[nextLine] + state.tShift[nextLine];
  5750. if (pos >= state.eMarks[nextLine]) { return false; }
  5751. ch = state.src.charCodeAt(pos++);
  5752. if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */ && ch !== 0x3A/* : */) { return false; }
  5753. while (pos < state.eMarks[nextLine]) {
  5754. ch = state.src.charCodeAt(pos);
  5755. if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */ && ch !== 0x3A/* : */ && !isSpace(ch)) { return false; }
  5756. pos++;
  5757. }
  5758. lineText = getLine(state, startLine + 1);
  5759. columns = lineText.split('|');
  5760. aligns = [];
  5761. for (i = 0; i < columns.length; i++) {
  5762. t = columns[i].trim();
  5763. if (!t) {
  5764. // allow empty columns before and after table, but not in between columns;
  5765. // e.g. allow ` |---| `, disallow ` ---||--- `
  5766. if (i === 0 || i === columns.length - 1) {
  5767. continue;
  5768. } else {
  5769. return false;
  5770. }
  5771. }
  5772. if (!/^:?-+:?$/.test(t)) { return false; }
  5773. if (t.charCodeAt(t.length - 1) === 0x3A/* : */) {
  5774. aligns.push(t.charCodeAt(0) === 0x3A/* : */ ? 'center' : 'right');
  5775. } else if (t.charCodeAt(0) === 0x3A/* : */) {
  5776. aligns.push('left');
  5777. } else {
  5778. aligns.push('');
  5779. }
  5780. }
  5781. lineText = getLine(state, startLine).trim();
  5782. if (lineText.indexOf('|') === -1) { return false; }
  5783. if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
  5784. columns = escapedSplit(lineText.replace(/^\||\|$/g, ''));
  5785. // header row will define an amount of columns in the entire table,
  5786. // and align row shouldn't be smaller than that (the rest of the rows can)
  5787. columnCount = columns.length;
  5788. if (columnCount > aligns.length) { return false; }
  5789. if (silent) { return true; }
  5790. token = state.push('table_open', 'table', 1);
  5791. token.map = tableLines = [ startLine, 0 ];
  5792. token = state.push('thead_open', 'thead', 1);
  5793. token.map = [ startLine, startLine + 1 ];
  5794. token = state.push('tr_open', 'tr', 1);
  5795. token.map = [ startLine, startLine + 1 ];
  5796. for (i = 0; i < columns.length; i++) {
  5797. token = state.push('th_open', 'th', 1);
  5798. token.map = [ startLine, startLine + 1 ];
  5799. if (aligns[i]) {
  5800. token.attrs = [ [ 'style', 'text-align:' + aligns[i] ] ];
  5801. }
  5802. token = state.push('inline', '', 0);
  5803. token.content = columns[i].trim();
  5804. token.map = [ startLine, startLine + 1 ];
  5805. token.children = [];
  5806. token = state.push('th_close', 'th', -1);
  5807. }
  5808. token = state.push('tr_close', 'tr', -1);
  5809. token = state.push('thead_close', 'thead', -1);
  5810. token = state.push('tbody_open', 'tbody', 1);
  5811. token.map = tbodyLines = [ startLine + 2, 0 ];
  5812. for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {
  5813. if (state.sCount[nextLine] < state.blkIndent) { break; }
  5814. lineText = getLine(state, nextLine).trim();
  5815. if (lineText.indexOf('|') === -1) { break; }
  5816. if (state.sCount[nextLine] - state.blkIndent >= 4) { break; }
  5817. columns = escapedSplit(lineText.replace(/^\||\|$/g, ''));
  5818. token = state.push('tr_open', 'tr', 1);
  5819. for (i = 0; i < columnCount; i++) {
  5820. token = state.push('td_open', 'td', 1);
  5821. if (aligns[i]) {
  5822. token.attrs = [ [ 'style', 'text-align:' + aligns[i] ] ];
  5823. }
  5824. token = state.push('inline', '', 0);
  5825. token.content = columns[i] ? columns[i].trim() : '';
  5826. token.children = [];
  5827. token = state.push('td_close', 'td', -1);
  5828. }
  5829. token = state.push('tr_close', 'tr', -1);
  5830. }
  5831. token = state.push('tbody_close', 'tbody', -1);
  5832. token = state.push('table_close', 'table', -1);
  5833. tableLines[1] = tbodyLines[1] = nextLine;
  5834. state.line = nextLine;
  5835. return true;
  5836. };
  5837. /***/ }),
  5838. /* 53 */
  5839. /***/ (function(module, exports, __webpack_require__) {
  5840. "use strict";
  5841. // Code block (4 spaces padded)
  5842. module.exports = function code(state, startLine, endLine/*, silent*/) {
  5843. var nextLine, last, token;
  5844. if (state.sCount[startLine] - state.blkIndent < 4) { return false; }
  5845. last = nextLine = startLine + 1;
  5846. while (nextLine < endLine) {
  5847. if (state.isEmpty(nextLine)) {
  5848. nextLine++;
  5849. continue;
  5850. }
  5851. if (state.sCount[nextLine] - state.blkIndent >= 4) {
  5852. nextLine++;
  5853. last = nextLine;
  5854. continue;
  5855. }
  5856. break;
  5857. }
  5858. state.line = last;
  5859. token = state.push('code_block', 'code', 0);
  5860. token.content = state.getLines(startLine, last, 4 + state.blkIndent, true);
  5861. token.map = [ startLine, state.line ];
  5862. return true;
  5863. };
  5864. /***/ }),
  5865. /* 54 */
  5866. /***/ (function(module, exports, __webpack_require__) {
  5867. "use strict";
  5868. // fences (``` lang, ~~~ lang)
  5869. module.exports = function fence(state, startLine, endLine, silent) {
  5870. var marker, len, params, nextLine, mem, token, markup,
  5871. haveEndMarker = false,
  5872. pos = state.bMarks[startLine] + state.tShift[startLine],
  5873. max = state.eMarks[startLine];
  5874. // if it's indented more than 3 spaces, it should be a code block
  5875. if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
  5876. if (pos + 3 > max) { return false; }
  5877. marker = state.src.charCodeAt(pos);
  5878. if (marker !== 0x7E/* ~ */ && marker !== 0x60 /* ` */) {
  5879. return false;
  5880. }
  5881. // scan marker length
  5882. mem = pos;
  5883. pos = state.skipChars(pos, marker);
  5884. len = pos - mem;
  5885. if (len < 3) { return false; }
  5886. markup = state.src.slice(mem, pos);
  5887. params = state.src.slice(pos, max);
  5888. if (params.indexOf(String.fromCharCode(marker)) >= 0) { return false; }
  5889. // Since start is found, we can report success here in validation mode
  5890. if (silent) { return true; }
  5891. // search end of block
  5892. nextLine = startLine;
  5893. for (;;) {
  5894. nextLine++;
  5895. if (nextLine >= endLine) {
  5896. // unclosed block should be autoclosed by end of document.
  5897. // also block seems to be autoclosed by end of parent
  5898. break;
  5899. }
  5900. pos = mem = state.bMarks[nextLine] + state.tShift[nextLine];
  5901. max = state.eMarks[nextLine];
  5902. if (pos < max && state.sCount[nextLine] < state.blkIndent) {
  5903. // non-empty line with negative indent should stop the list:
  5904. // - ```
  5905. // test
  5906. break;
  5907. }
  5908. if (state.src.charCodeAt(pos) !== marker) { continue; }
  5909. if (state.sCount[nextLine] - state.blkIndent >= 4) {
  5910. // closing fence should be indented less than 4 spaces
  5911. continue;
  5912. }
  5913. pos = state.skipChars(pos, marker);
  5914. // closing code fence must be at least as long as the opening one
  5915. if (pos - mem < len) { continue; }
  5916. // make sure tail has spaces only
  5917. pos = state.skipSpaces(pos);
  5918. if (pos < max) { continue; }
  5919. haveEndMarker = true;
  5920. // found!
  5921. break;
  5922. }
  5923. // If a fence has heading spaces, they should be removed from its inner block
  5924. len = state.sCount[startLine];
  5925. state.line = nextLine + (haveEndMarker ? 1 : 0);
  5926. token = state.push('fence', 'code', 0);
  5927. token.info = params;
  5928. token.content = state.getLines(startLine + 1, nextLine, len, true);
  5929. token.markup = markup;
  5930. token.map = [ startLine, state.line ];
  5931. return true;
  5932. };
  5933. /***/ }),
  5934. /* 55 */
  5935. /***/ (function(module, exports, __webpack_require__) {
  5936. "use strict";
  5937. // Block quotes
  5938. var isSpace = __webpack_require__(0).isSpace;
  5939. module.exports = function blockquote(state, startLine, endLine, silent) {
  5940. var adjustTab,
  5941. ch,
  5942. i,
  5943. initial,
  5944. l,
  5945. lastLineEmpty,
  5946. lines,
  5947. nextLine,
  5948. offset,
  5949. oldBMarks,
  5950. oldBSCount,
  5951. oldIndent,
  5952. oldParentType,
  5953. oldSCount,
  5954. oldTShift,
  5955. spaceAfterMarker,
  5956. terminate,
  5957. terminatorRules,
  5958. token,
  5959. wasOutdented,
  5960. oldLineMax = state.lineMax,
  5961. pos = state.bMarks[startLine] + state.tShift[startLine],
  5962. max = state.eMarks[startLine];
  5963. // if it's indented more than 3 spaces, it should be a code block
  5964. if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
  5965. // check the block quote marker
  5966. if (state.src.charCodeAt(pos++) !== 0x3E/* > */) { return false; }
  5967. // we know that it's going to be a valid blockquote,
  5968. // so no point trying to find the end of it in silent mode
  5969. if (silent) { return true; }
  5970. // skip spaces after ">" and re-calculate offset
  5971. initial = offset = state.sCount[startLine] + pos - (state.bMarks[startLine] + state.tShift[startLine]);
  5972. // skip one optional space after '>'
  5973. if (state.src.charCodeAt(pos) === 0x20 /* space */) {
  5974. // ' > test '
  5975. // ^ -- position start of line here:
  5976. pos++;
  5977. initial++;
  5978. offset++;
  5979. adjustTab = false;
  5980. spaceAfterMarker = true;
  5981. } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) {
  5982. spaceAfterMarker = true;
  5983. if ((state.bsCount[startLine] + offset) % 4 === 3) {
  5984. // ' >\t test '
  5985. // ^ -- position start of line here (tab has width===1)
  5986. pos++;
  5987. initial++;
  5988. offset++;
  5989. adjustTab = false;
  5990. } else {
  5991. // ' >\t test '
  5992. // ^ -- position start of line here + shift bsCount slightly
  5993. // to make extra space appear
  5994. adjustTab = true;
  5995. }
  5996. } else {
  5997. spaceAfterMarker = false;
  5998. }
  5999. oldBMarks = [ state.bMarks[startLine] ];
  6000. state.bMarks[startLine] = pos;
  6001. while (pos < max) {
  6002. ch = state.src.charCodeAt(pos);
  6003. if (isSpace(ch)) {
  6004. if (ch === 0x09) {
  6005. offset += 4 - (offset + state.bsCount[startLine] + (adjustTab ? 1 : 0)) % 4;
  6006. } else {
  6007. offset++;
  6008. }
  6009. } else {
  6010. break;
  6011. }
  6012. pos++;
  6013. }
  6014. oldBSCount = [ state.bsCount[startLine] ];
  6015. state.bsCount[startLine] = state.sCount[startLine] + 1 + (spaceAfterMarker ? 1 : 0);
  6016. lastLineEmpty = pos >= max;
  6017. oldSCount = [ state.sCount[startLine] ];
  6018. state.sCount[startLine] = offset - initial;
  6019. oldTShift = [ state.tShift[startLine] ];
  6020. state.tShift[startLine] = pos - state.bMarks[startLine];
  6021. terminatorRules = state.md.block.ruler.getRules('blockquote');
  6022. oldParentType = state.parentType;
  6023. state.parentType = 'blockquote';
  6024. wasOutdented = false;
  6025. // Search the end of the block
  6026. //
  6027. // Block ends with either:
  6028. // 1. an empty line outside:
  6029. // ```
  6030. // > test
  6031. //
  6032. // ```
  6033. // 2. an empty line inside:
  6034. // ```
  6035. // >
  6036. // test
  6037. // ```
  6038. // 3. another tag:
  6039. // ```
  6040. // > test
  6041. // - - -
  6042. // ```
  6043. for (nextLine = startLine + 1; nextLine < endLine; nextLine++) {
  6044. // check if it's outdented, i.e. it's inside list item and indented
  6045. // less than said list item:
  6046. //
  6047. // ```
  6048. // 1. anything
  6049. // > current blockquote
  6050. // 2. checking this line
  6051. // ```
  6052. if (state.sCount[nextLine] < state.blkIndent) wasOutdented = true;
  6053. pos = state.bMarks[nextLine] + state.tShift[nextLine];
  6054. max = state.eMarks[nextLine];
  6055. if (pos >= max) {
  6056. // Case 1: line is not inside the blockquote, and this line is empty.
  6057. break;
  6058. }
  6059. if (state.src.charCodeAt(pos++) === 0x3E/* > */ && !wasOutdented) {
  6060. // This line is inside the blockquote.
  6061. // skip spaces after ">" and re-calculate offset
  6062. initial = offset = state.sCount[nextLine] + pos - (state.bMarks[nextLine] + state.tShift[nextLine]);
  6063. // skip one optional space after '>'
  6064. if (state.src.charCodeAt(pos) === 0x20 /* space */) {
  6065. // ' > test '
  6066. // ^ -- position start of line here:
  6067. pos++;
  6068. initial++;
  6069. offset++;
  6070. adjustTab = false;
  6071. spaceAfterMarker = true;
  6072. } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) {
  6073. spaceAfterMarker = true;
  6074. if ((state.bsCount[nextLine] + offset) % 4 === 3) {
  6075. // ' >\t test '
  6076. // ^ -- position start of line here (tab has width===1)
  6077. pos++;
  6078. initial++;
  6079. offset++;
  6080. adjustTab = false;
  6081. } else {
  6082. // ' >\t test '
  6083. // ^ -- position start of line here + shift bsCount slightly
  6084. // to make extra space appear
  6085. adjustTab = true;
  6086. }
  6087. } else {
  6088. spaceAfterMarker = false;
  6089. }
  6090. oldBMarks.push(state.bMarks[nextLine]);
  6091. state.bMarks[nextLine] = pos;
  6092. while (pos < max) {
  6093. ch = state.src.charCodeAt(pos);
  6094. if (isSpace(ch)) {
  6095. if (ch === 0x09) {
  6096. offset += 4 - (offset + state.bsCount[nextLine] + (adjustTab ? 1 : 0)) % 4;
  6097. } else {
  6098. offset++;
  6099. }
  6100. } else {
  6101. break;
  6102. }
  6103. pos++;
  6104. }
  6105. lastLineEmpty = pos >= max;
  6106. oldBSCount.push(state.bsCount[nextLine]);
  6107. state.bsCount[nextLine] = state.sCount[nextLine] + 1 + (spaceAfterMarker ? 1 : 0);
  6108. oldSCount.push(state.sCount[nextLine]);
  6109. state.sCount[nextLine] = offset - initial;
  6110. oldTShift.push(state.tShift[nextLine]);
  6111. state.tShift[nextLine] = pos - state.bMarks[nextLine];
  6112. continue;
  6113. }
  6114. // Case 2: line is not inside the blockquote, and the last line was empty.
  6115. if (lastLineEmpty) { break; }
  6116. // Case 3: another tag found.
  6117. terminate = false;
  6118. for (i = 0, l = terminatorRules.length; i < l; i++) {
  6119. if (terminatorRules[i](state, nextLine, endLine, true)) {
  6120. terminate = true;
  6121. break;
  6122. }
  6123. }
  6124. if (terminate) {
  6125. // Quirk to enforce "hard termination mode" for paragraphs;
  6126. // normally if you call `tokenize(state, startLine, nextLine)`,
  6127. // paragraphs will look below nextLine for paragraph continuation,
  6128. // but if blockquote is terminated by another tag, they shouldn't
  6129. state.lineMax = nextLine;
  6130. if (state.blkIndent !== 0) {
  6131. // state.blkIndent was non-zero, we now set it to zero,
  6132. // so we need to re-calculate all offsets to appear as
  6133. // if indent wasn't changed
  6134. oldBMarks.push(state.bMarks[nextLine]);
  6135. oldBSCount.push(state.bsCount[nextLine]);
  6136. oldTShift.push(state.tShift[nextLine]);
  6137. oldSCount.push(state.sCount[nextLine]);
  6138. state.sCount[nextLine] -= state.blkIndent;
  6139. }
  6140. break;
  6141. }
  6142. oldBMarks.push(state.bMarks[nextLine]);
  6143. oldBSCount.push(state.bsCount[nextLine]);
  6144. oldTShift.push(state.tShift[nextLine]);
  6145. oldSCount.push(state.sCount[nextLine]);
  6146. // A negative indentation means that this is a paragraph continuation
  6147. //
  6148. state.sCount[nextLine] = -1;
  6149. }
  6150. oldIndent = state.blkIndent;
  6151. state.blkIndent = 0;
  6152. token = state.push('blockquote_open', 'blockquote', 1);
  6153. token.markup = '>';
  6154. token.map = lines = [ startLine, 0 ];
  6155. state.md.block.tokenize(state, startLine, nextLine);
  6156. token = state.push('blockquote_close', 'blockquote', -1);
  6157. token.markup = '>';
  6158. state.lineMax = oldLineMax;
  6159. state.parentType = oldParentType;
  6160. lines[1] = state.line;
  6161. // Restore original tShift; this might not be necessary since the parser
  6162. // has already been here, but just to make sure we can do that.
  6163. for (i = 0; i < oldTShift.length; i++) {
  6164. state.bMarks[i + startLine] = oldBMarks[i];
  6165. state.tShift[i + startLine] = oldTShift[i];
  6166. state.sCount[i + startLine] = oldSCount[i];
  6167. state.bsCount[i + startLine] = oldBSCount[i];
  6168. }
  6169. state.blkIndent = oldIndent;
  6170. return true;
  6171. };
  6172. /***/ }),
  6173. /* 56 */
  6174. /***/ (function(module, exports, __webpack_require__) {
  6175. "use strict";
  6176. // Horizontal rule
  6177. var isSpace = __webpack_require__(0).isSpace;
  6178. module.exports = function hr(state, startLine, endLine, silent) {
  6179. var marker, cnt, ch, token,
  6180. pos = state.bMarks[startLine] + state.tShift[startLine],
  6181. max = state.eMarks[startLine];
  6182. // if it's indented more than 3 spaces, it should be a code block
  6183. if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
  6184. marker = state.src.charCodeAt(pos++);
  6185. // Check hr marker
  6186. if (marker !== 0x2A/* * */ &&
  6187. marker !== 0x2D/* - */ &&
  6188. marker !== 0x5F/* _ */) {
  6189. return false;
  6190. }
  6191. // markers can be mixed with spaces, but there should be at least 3 of them
  6192. cnt = 1;
  6193. while (pos < max) {
  6194. ch = state.src.charCodeAt(pos++);
  6195. if (ch !== marker && !isSpace(ch)) { return false; }
  6196. if (ch === marker) { cnt++; }
  6197. }
  6198. if (cnt < 3) { return false; }
  6199. if (silent) { return true; }
  6200. state.line = startLine + 1;
  6201. token = state.push('hr', 'hr', 0);
  6202. token.map = [ startLine, state.line ];
  6203. token.markup = Array(cnt + 1).join(String.fromCharCode(marker));
  6204. return true;
  6205. };
  6206. /***/ }),
  6207. /* 57 */
  6208. /***/ (function(module, exports, __webpack_require__) {
  6209. "use strict";
  6210. // Lists
  6211. var isSpace = __webpack_require__(0).isSpace;
  6212. // Search `[-+*][\n ]`, returns next pos after marker on success
  6213. // or -1 on fail.
  6214. function skipBulletListMarker(state, startLine) {
  6215. var marker, pos, max, ch;
  6216. pos = state.bMarks[startLine] + state.tShift[startLine];
  6217. max = state.eMarks[startLine];
  6218. marker = state.src.charCodeAt(pos++);
  6219. // Check bullet
  6220. if (marker !== 0x2A/* * */ &&
  6221. marker !== 0x2D/* - */ &&
  6222. marker !== 0x2B/* + */) {
  6223. return -1;
  6224. }
  6225. if (pos < max) {
  6226. ch = state.src.charCodeAt(pos);
  6227. if (!isSpace(ch)) {
  6228. // " -test " - is not a list item
  6229. return -1;
  6230. }
  6231. }
  6232. return pos;
  6233. }
  6234. // Search `\d+[.)][\n ]`, returns next pos after marker on success
  6235. // or -1 on fail.
  6236. function skipOrderedListMarker(state, startLine) {
  6237. var ch,
  6238. start = state.bMarks[startLine] + state.tShift[startLine],
  6239. pos = start,
  6240. max = state.eMarks[startLine];
  6241. // List marker should have at least 2 chars (digit + dot)
  6242. if (pos + 1 >= max) { return -1; }
  6243. ch = state.src.charCodeAt(pos++);
  6244. if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }
  6245. for (;;) {
  6246. // EOL -> fail
  6247. if (pos >= max) { return -1; }
  6248. ch = state.src.charCodeAt(pos++);
  6249. if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {
  6250. // List marker should have no more than 9 digits
  6251. // (prevents integer overflow in browsers)
  6252. if (pos - start >= 10) { return -1; }
  6253. continue;
  6254. }
  6255. // found valid marker
  6256. if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {
  6257. break;
  6258. }
  6259. return -1;
  6260. }
  6261. if (pos < max) {
  6262. ch = state.src.charCodeAt(pos);
  6263. if (!isSpace(ch)) {
  6264. // " 1.test " - is not a list item
  6265. return -1;
  6266. }
  6267. }
  6268. return pos;
  6269. }
  6270. function markTightParagraphs(state, idx) {
  6271. var i, l,
  6272. level = state.level + 2;
  6273. for (i = idx + 2, l = state.tokens.length - 2; i < l; i++) {
  6274. if (state.tokens[i].level === level && state.tokens[i].type === 'paragraph_open') {
  6275. state.tokens[i + 2].hidden = true;
  6276. state.tokens[i].hidden = true;
  6277. i += 2;
  6278. }
  6279. }
  6280. }
  6281. module.exports = function list(state, startLine, endLine, silent) {
  6282. var ch,
  6283. contentStart,
  6284. i,
  6285. indent,
  6286. indentAfterMarker,
  6287. initial,
  6288. isOrdered,
  6289. itemLines,
  6290. l,
  6291. listLines,
  6292. listTokIdx,
  6293. markerCharCode,
  6294. markerValue,
  6295. max,
  6296. nextLine,
  6297. offset,
  6298. oldIndent,
  6299. oldLIndent,
  6300. oldParentType,
  6301. oldTShift,
  6302. oldTight,
  6303. pos,
  6304. posAfterMarker,
  6305. prevEmptyEnd,
  6306. start,
  6307. terminate,
  6308. terminatorRules,
  6309. token,
  6310. isTerminatingParagraph = false,
  6311. tight = true;
  6312. // if it's indented more than 3 spaces, it should be a code block
  6313. if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
  6314. // limit conditions when list can interrupt
  6315. // a paragraph (validation mode only)
  6316. if (silent && state.parentType === 'paragraph') {
  6317. // Next list item should still terminate previous list item;
  6318. //
  6319. // This code can fail if plugins use blkIndent as well as lists,
  6320. // but I hope the spec gets fixed long before that happens.
  6321. //
  6322. if (state.tShift[startLine] >= state.blkIndent) {
  6323. isTerminatingParagraph = true;
  6324. }
  6325. }
  6326. // Detect list type and position after marker
  6327. if ((posAfterMarker = skipOrderedListMarker(state, startLine)) >= 0) {
  6328. isOrdered = true;
  6329. start = state.bMarks[startLine] + state.tShift[startLine];
  6330. markerValue = Number(state.src.substr(start, posAfterMarker - start - 1));
  6331. // If we're starting a new ordered list right after
  6332. // a paragraph, it should start with 1.
  6333. if (isTerminatingParagraph && markerValue !== 1) return false;
  6334. } else if ((posAfterMarker = skipBulletListMarker(state, startLine)) >= 0) {
  6335. isOrdered = false;
  6336. } else {
  6337. return false;
  6338. }
  6339. // If we're starting a new unordered list right after
  6340. // a paragraph, first line should not be empty.
  6341. if (isTerminatingParagraph) {
  6342. if (state.skipSpaces(posAfterMarker) >= state.eMarks[startLine]) return false;
  6343. }
  6344. // We should terminate list on style change. Remember first one to compare.
  6345. markerCharCode = state.src.charCodeAt(posAfterMarker - 1);
  6346. // For validation mode we can terminate immediately
  6347. if (silent) { return true; }
  6348. // Start list
  6349. listTokIdx = state.tokens.length;
  6350. if (isOrdered) {
  6351. token = state.push('ordered_list_open', 'ol', 1);
  6352. if (markerValue !== 1) {
  6353. token.attrs = [ [ 'start', markerValue ] ];
  6354. }
  6355. } else {
  6356. token = state.push('bullet_list_open', 'ul', 1);
  6357. }
  6358. token.map = listLines = [ startLine, 0 ];
  6359. token.markup = String.fromCharCode(markerCharCode);
  6360. //
  6361. // Iterate list items
  6362. //
  6363. nextLine = startLine;
  6364. prevEmptyEnd = false;
  6365. terminatorRules = state.md.block.ruler.getRules('list');
  6366. oldParentType = state.parentType;
  6367. state.parentType = 'list';
  6368. while (nextLine < endLine) {
  6369. pos = posAfterMarker;
  6370. max = state.eMarks[nextLine];
  6371. initial = offset = state.sCount[nextLine] + posAfterMarker - (state.bMarks[startLine] + state.tShift[startLine]);
  6372. while (pos < max) {
  6373. ch = state.src.charCodeAt(pos);
  6374. if (ch === 0x09) {
  6375. offset += 4 - (offset + state.bsCount[nextLine]) % 4;
  6376. } else if (ch === 0x20) {
  6377. offset++;
  6378. } else {
  6379. break;
  6380. }
  6381. pos++;
  6382. }
  6383. contentStart = pos;
  6384. if (contentStart >= max) {
  6385. // trimming space in "- \n 3" case, indent is 1 here
  6386. indentAfterMarker = 1;
  6387. } else {
  6388. indentAfterMarker = offset - initial;
  6389. }
  6390. // If we have more than 4 spaces, the indent is 1
  6391. // (the rest is just indented code block)
  6392. if (indentAfterMarker > 4) { indentAfterMarker = 1; }
  6393. // " - test"
  6394. // ^^^^^ - calculating total length of this thing
  6395. indent = initial + indentAfterMarker;
  6396. // Run subparser & write tokens
  6397. token = state.push('list_item_open', 'li', 1);
  6398. token.markup = String.fromCharCode(markerCharCode);
  6399. token.map = itemLines = [ startLine, 0 ];
  6400. oldIndent = state.blkIndent;
  6401. oldTight = state.tight;
  6402. oldTShift = state.tShift[startLine];
  6403. oldLIndent = state.sCount[startLine];
  6404. state.blkIndent = indent;
  6405. state.tight = true;
  6406. state.tShift[startLine] = contentStart - state.bMarks[startLine];
  6407. state.sCount[startLine] = offset;
  6408. if (contentStart >= max && state.isEmpty(startLine + 1)) {
  6409. // workaround for this case
  6410. // (list item is empty, list terminates before "foo"):
  6411. // ~~~~~~~~
  6412. // -
  6413. //
  6414. // foo
  6415. // ~~~~~~~~
  6416. state.line = Math.min(state.line + 2, endLine);
  6417. } else {
  6418. state.md.block.tokenize(state, startLine, endLine, true);
  6419. }
  6420. // If any of list item is tight, mark list as tight
  6421. if (!state.tight || prevEmptyEnd) {
  6422. tight = false;
  6423. }
  6424. // Item become loose if finish with empty line,
  6425. // but we should filter last element, because it means list finish
  6426. prevEmptyEnd = (state.line - startLine) > 1 && state.isEmpty(state.line - 1);
  6427. state.blkIndent = oldIndent;
  6428. state.tShift[startLine] = oldTShift;
  6429. state.sCount[startLine] = oldLIndent;
  6430. state.tight = oldTight;
  6431. token = state.push('list_item_close', 'li', -1);
  6432. token.markup = String.fromCharCode(markerCharCode);
  6433. nextLine = startLine = state.line;
  6434. itemLines[1] = nextLine;
  6435. contentStart = state.bMarks[startLine];
  6436. if (nextLine >= endLine) { break; }
  6437. //
  6438. // Try to check if list is terminated or continued.
  6439. //
  6440. if (state.sCount[nextLine] < state.blkIndent) { break; }
  6441. // fail if terminating block found
  6442. terminate = false;
  6443. for (i = 0, l = terminatorRules.length; i < l; i++) {
  6444. if (terminatorRules[i](state, nextLine, endLine, true)) {
  6445. terminate = true;
  6446. break;
  6447. }
  6448. }
  6449. if (terminate) { break; }
  6450. // fail if list has another type
  6451. if (isOrdered) {
  6452. posAfterMarker = skipOrderedListMarker(state, nextLine);
  6453. if (posAfterMarker < 0) { break; }
  6454. } else {
  6455. posAfterMarker = skipBulletListMarker(state, nextLine);
  6456. if (posAfterMarker < 0) { break; }
  6457. }
  6458. if (markerCharCode !== state.src.charCodeAt(posAfterMarker - 1)) { break; }
  6459. }
  6460. // Finalize list
  6461. if (isOrdered) {
  6462. token = state.push('ordered_list_close', 'ol', -1);
  6463. } else {
  6464. token = state.push('bullet_list_close', 'ul', -1);
  6465. }
  6466. token.markup = String.fromCharCode(markerCharCode);
  6467. listLines[1] = nextLine;
  6468. state.line = nextLine;
  6469. state.parentType = oldParentType;
  6470. // mark paragraphs tight if needed
  6471. if (tight) {
  6472. markTightParagraphs(state, listTokIdx);
  6473. }
  6474. return true;
  6475. };
  6476. /***/ }),
  6477. /* 58 */
  6478. /***/ (function(module, exports, __webpack_require__) {
  6479. "use strict";
  6480. var normalizeReference = __webpack_require__(0).normalizeReference;
  6481. var isSpace = __webpack_require__(0).isSpace;
  6482. module.exports = function reference(state, startLine, _endLine, silent) {
  6483. var ch,
  6484. destEndPos,
  6485. destEndLineNo,
  6486. endLine,
  6487. href,
  6488. i,
  6489. l,
  6490. label,
  6491. labelEnd,
  6492. oldParentType,
  6493. res,
  6494. start,
  6495. str,
  6496. terminate,
  6497. terminatorRules,
  6498. title,
  6499. lines = 0,
  6500. pos = state.bMarks[startLine] + state.tShift[startLine],
  6501. max = state.eMarks[startLine],
  6502. nextLine = startLine + 1;
  6503. // if it's indented more than 3 spaces, it should be a code block
  6504. if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
  6505. if (state.src.charCodeAt(pos) !== 0x5B/* [ */) { return false; }
  6506. // Simple check to quickly interrupt scan on [link](url) at the start of line.
  6507. // Can be useful on practice: https://github.com/markdown-it/markdown-it/issues/54
  6508. while (++pos < max) {
  6509. if (state.src.charCodeAt(pos) === 0x5D /* ] */ &&
  6510. state.src.charCodeAt(pos - 1) !== 0x5C/* \ */) {
  6511. if (pos + 1 === max) { return false; }
  6512. if (state.src.charCodeAt(pos + 1) !== 0x3A/* : */) { return false; }
  6513. break;
  6514. }
  6515. }
  6516. endLine = state.lineMax;
  6517. // jump line-by-line until empty one or EOF
  6518. terminatorRules = state.md.block.ruler.getRules('reference');
  6519. oldParentType = state.parentType;
  6520. state.parentType = 'reference';
  6521. for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
  6522. // this would be a code block normally, but after paragraph
  6523. // it's considered a lazy continuation regardless of what's there
  6524. if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }
  6525. // quirk for blockquotes, this line should already be checked by that rule
  6526. if (state.sCount[nextLine] < 0) { continue; }
  6527. // Some tags can terminate paragraph without empty line.
  6528. terminate = false;
  6529. for (i = 0, l = terminatorRules.length; i < l; i++) {
  6530. if (terminatorRules[i](state, nextLine, endLine, true)) {
  6531. terminate = true;
  6532. break;
  6533. }
  6534. }
  6535. if (terminate) { break; }
  6536. }
  6537. str = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
  6538. max = str.length;
  6539. for (pos = 1; pos < max; pos++) {
  6540. ch = str.charCodeAt(pos);
  6541. if (ch === 0x5B /* [ */) {
  6542. return false;
  6543. } else if (ch === 0x5D /* ] */) {
  6544. labelEnd = pos;
  6545. break;
  6546. } else if (ch === 0x0A /* \n */) {
  6547. lines++;
  6548. } else if (ch === 0x5C /* \ */) {
  6549. pos++;
  6550. if (pos < max && str.charCodeAt(pos) === 0x0A) {
  6551. lines++;
  6552. }
  6553. }
  6554. }
  6555. if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 0x3A/* : */) { return false; }
  6556. // [label]: destination 'title'
  6557. // ^^^ skip optional whitespace here
  6558. for (pos = labelEnd + 2; pos < max; pos++) {
  6559. ch = str.charCodeAt(pos);
  6560. if (ch === 0x0A) {
  6561. lines++;
  6562. } else if (isSpace(ch)) {
  6563. /*eslint no-empty:0*/
  6564. } else {
  6565. break;
  6566. }
  6567. }
  6568. // [label]: destination 'title'
  6569. // ^^^^^^^^^^^ parse this
  6570. res = state.md.helpers.parseLinkDestination(str, pos, max);
  6571. if (!res.ok) { return false; }
  6572. href = state.md.normalizeLink(res.str);
  6573. if (!state.md.validateLink(href)) { return false; }
  6574. pos = res.pos;
  6575. lines += res.lines;
  6576. // save cursor state, we could require to rollback later
  6577. destEndPos = pos;
  6578. destEndLineNo = lines;
  6579. // [label]: destination 'title'
  6580. // ^^^ skipping those spaces
  6581. start = pos;
  6582. for (; pos < max; pos++) {
  6583. ch = str.charCodeAt(pos);
  6584. if (ch === 0x0A) {
  6585. lines++;
  6586. } else if (isSpace(ch)) {
  6587. /*eslint no-empty:0*/
  6588. } else {
  6589. break;
  6590. }
  6591. }
  6592. // [label]: destination 'title'
  6593. // ^^^^^^^ parse this
  6594. res = state.md.helpers.parseLinkTitle(str, pos, max);
  6595. if (pos < max && start !== pos && res.ok) {
  6596. title = res.str;
  6597. pos = res.pos;
  6598. lines += res.lines;
  6599. } else {
  6600. title = '';
  6601. pos = destEndPos;
  6602. lines = destEndLineNo;
  6603. }
  6604. // skip trailing spaces until the rest of the line
  6605. while (pos < max) {
  6606. ch = str.charCodeAt(pos);
  6607. if (!isSpace(ch)) { break; }
  6608. pos++;
  6609. }
  6610. if (pos < max && str.charCodeAt(pos) !== 0x0A) {
  6611. if (title) {
  6612. // garbage at the end of the line after title,
  6613. // but it could still be a valid reference if we roll back
  6614. title = '';
  6615. pos = destEndPos;
  6616. lines = destEndLineNo;
  6617. while (pos < max) {
  6618. ch = str.charCodeAt(pos);
  6619. if (!isSpace(ch)) { break; }
  6620. pos++;
  6621. }
  6622. }
  6623. }
  6624. if (pos < max && str.charCodeAt(pos) !== 0x0A) {
  6625. // garbage at the end of the line
  6626. return false;
  6627. }
  6628. label = normalizeReference(str.slice(1, labelEnd));
  6629. if (!label) {
  6630. // CommonMark 0.20 disallows empty labels
  6631. return false;
  6632. }
  6633. // Reference can not terminate anything. This check is for safety only.
  6634. /*istanbul ignore if*/
  6635. if (silent) { return true; }
  6636. if (typeof state.env.references === 'undefined') {
  6637. state.env.references = {};
  6638. }
  6639. if (typeof state.env.references[label] === 'undefined') {
  6640. state.env.references[label] = { title: title, href: href };
  6641. }
  6642. state.parentType = oldParentType;
  6643. state.line = startLine + lines + 1;
  6644. return true;
  6645. };
  6646. /***/ }),
  6647. /* 59 */
  6648. /***/ (function(module, exports, __webpack_require__) {
  6649. "use strict";
  6650. // heading (#, ##, ...)
  6651. var isSpace = __webpack_require__(0).isSpace;
  6652. module.exports = function heading(state, startLine, endLine, silent) {
  6653. var ch, level, tmp, token,
  6654. pos = state.bMarks[startLine] + state.tShift[startLine],
  6655. max = state.eMarks[startLine];
  6656. // if it's indented more than 3 spaces, it should be a code block
  6657. if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
  6658. ch = state.src.charCodeAt(pos);
  6659. if (ch !== 0x23/* # */ || pos >= max) { return false; }
  6660. // count heading level
  6661. level = 1;
  6662. ch = state.src.charCodeAt(++pos);
  6663. while (ch === 0x23/* # */ && pos < max && level <= 6) {
  6664. level++;
  6665. ch = state.src.charCodeAt(++pos);
  6666. }
  6667. if (level > 6 || (pos < max && !isSpace(ch))) { return false; }
  6668. if (silent) { return true; }
  6669. // Let's cut tails like ' ### ' from the end of string
  6670. max = state.skipSpacesBack(max, pos);
  6671. tmp = state.skipCharsBack(max, 0x23, pos); // #
  6672. if (tmp > pos && isSpace(state.src.charCodeAt(tmp - 1))) {
  6673. max = tmp;
  6674. }
  6675. state.line = startLine + 1;
  6676. token = state.push('heading_open', 'h' + String(level), 1);
  6677. token.markup = '########'.slice(0, level);
  6678. token.map = [ startLine, state.line ];
  6679. token = state.push('inline', '', 0);
  6680. token.content = state.src.slice(pos, max).trim();
  6681. token.map = [ startLine, state.line ];
  6682. token.children = [];
  6683. token = state.push('heading_close', 'h' + String(level), -1);
  6684. token.markup = '########'.slice(0, level);
  6685. return true;
  6686. };
  6687. /***/ }),
  6688. /* 60 */
  6689. /***/ (function(module, exports, __webpack_require__) {
  6690. "use strict";
  6691. // lheading (---, ===)
  6692. module.exports = function lheading(state, startLine, endLine/*, silent*/) {
  6693. var content, terminate, i, l, token, pos, max, level, marker,
  6694. nextLine = startLine + 1, oldParentType,
  6695. terminatorRules = state.md.block.ruler.getRules('paragraph');
  6696. // if it's indented more than 3 spaces, it should be a code block
  6697. if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
  6698. oldParentType = state.parentType;
  6699. state.parentType = 'paragraph'; // use paragraph to match terminatorRules
  6700. // jump line-by-line until empty one or EOF
  6701. for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
  6702. // this would be a code block normally, but after paragraph
  6703. // it's considered a lazy continuation regardless of what's there
  6704. if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }
  6705. //
  6706. // Check for underline in setext header
  6707. //
  6708. if (state.sCount[nextLine] >= state.blkIndent) {
  6709. pos = state.bMarks[nextLine] + state.tShift[nextLine];
  6710. max = state.eMarks[nextLine];
  6711. if (pos < max) {
  6712. marker = state.src.charCodeAt(pos);
  6713. if (marker === 0x2D/* - */ || marker === 0x3D/* = */) {
  6714. pos = state.skipChars(pos, marker);
  6715. pos = state.skipSpaces(pos);
  6716. if (pos >= max) {
  6717. level = (marker === 0x3D/* = */ ? 1 : 2);
  6718. break;
  6719. }
  6720. }
  6721. }
  6722. }
  6723. // quirk for blockquotes, this line should already be checked by that rule
  6724. if (state.sCount[nextLine] < 0) { continue; }
  6725. // Some tags can terminate paragraph without empty line.
  6726. terminate = false;
  6727. for (i = 0, l = terminatorRules.length; i < l; i++) {
  6728. if (terminatorRules[i](state, nextLine, endLine, true)) {
  6729. terminate = true;
  6730. break;
  6731. }
  6732. }
  6733. if (terminate) { break; }
  6734. }
  6735. if (!level) {
  6736. // Didn't find valid underline
  6737. return false;
  6738. }
  6739. content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
  6740. state.line = nextLine + 1;
  6741. token = state.push('heading_open', 'h' + String(level), 1);
  6742. token.markup = String.fromCharCode(marker);
  6743. token.map = [ startLine, state.line ];
  6744. token = state.push('inline', '', 0);
  6745. token.content = content;
  6746. token.map = [ startLine, state.line - 1 ];
  6747. token.children = [];
  6748. token = state.push('heading_close', 'h' + String(level), -1);
  6749. token.markup = String.fromCharCode(marker);
  6750. state.parentType = oldParentType;
  6751. return true;
  6752. };
  6753. /***/ }),
  6754. /* 61 */
  6755. /***/ (function(module, exports, __webpack_require__) {
  6756. "use strict";
  6757. // HTML block
  6758. var block_names = __webpack_require__(62);
  6759. var HTML_OPEN_CLOSE_TAG_RE = __webpack_require__(16).HTML_OPEN_CLOSE_TAG_RE;
  6760. // An array of opening and corresponding closing sequences for html tags,
  6761. // last argument defines whether it can terminate a paragraph or not
  6762. //
  6763. var HTML_SEQUENCES = [
  6764. [ /^<(script|pre|style)(?=(\s|>|$))/i, /<\/(script|pre|style)>/i, true ],
  6765. [ /^<!--/, /-->/, true ],
  6766. [ /^<\?/, /\?>/, true ],
  6767. [ /^<![A-Z]/, />/, true ],
  6768. [ /^<!\[CDATA\[/, /\]\]>/, true ],
  6769. [ new RegExp('^</?(' + block_names.join('|') + ')(?=(\\s|/?>|$))', 'i'), /^$/, true ],
  6770. [ new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + '\\s*$'), /^$/, false ]
  6771. ];
  6772. module.exports = function html_block(state, startLine, endLine, silent) {
  6773. var i, nextLine, token, lineText,
  6774. pos = state.bMarks[startLine] + state.tShift[startLine],
  6775. max = state.eMarks[startLine];
  6776. // if it's indented more than 3 spaces, it should be a code block
  6777. if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
  6778. if (!state.md.options.html) { return false; }
  6779. if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }
  6780. lineText = state.src.slice(pos, max);
  6781. for (i = 0; i < HTML_SEQUENCES.length; i++) {
  6782. if (HTML_SEQUENCES[i][0].test(lineText)) { break; }
  6783. }
  6784. if (i === HTML_SEQUENCES.length) { return false; }
  6785. if (silent) {
  6786. // true if this sequence can be a terminator, false otherwise
  6787. return HTML_SEQUENCES[i][2];
  6788. }
  6789. nextLine = startLine + 1;
  6790. // If we are here - we detected HTML block.
  6791. // Let's roll down till block end.
  6792. if (!HTML_SEQUENCES[i][1].test(lineText)) {
  6793. for (; nextLine < endLine; nextLine++) {
  6794. if (state.sCount[nextLine] < state.blkIndent) { break; }
  6795. pos = state.bMarks[nextLine] + state.tShift[nextLine];
  6796. max = state.eMarks[nextLine];
  6797. lineText = state.src.slice(pos, max);
  6798. if (HTML_SEQUENCES[i][1].test(lineText)) {
  6799. if (lineText.length !== 0) { nextLine++; }
  6800. break;
  6801. }
  6802. }
  6803. }
  6804. state.line = nextLine;
  6805. token = state.push('html_block', '', 0);
  6806. token.map = [ startLine, nextLine ];
  6807. token.content = state.getLines(startLine, nextLine, state.blkIndent, true);
  6808. return true;
  6809. };
  6810. /***/ }),
  6811. /* 62 */
  6812. /***/ (function(module, exports, __webpack_require__) {
  6813. "use strict";
  6814. // List of valid html blocks names, accorting to commonmark spec
  6815. // http://jgm.github.io/CommonMark/spec.html#html-blocks
  6816. module.exports = [
  6817. 'address',
  6818. 'article',
  6819. 'aside',
  6820. 'base',
  6821. 'basefont',
  6822. 'blockquote',
  6823. 'body',
  6824. 'caption',
  6825. 'center',
  6826. 'col',
  6827. 'colgroup',
  6828. 'dd',
  6829. 'details',
  6830. 'dialog',
  6831. 'dir',
  6832. 'div',
  6833. 'dl',
  6834. 'dt',
  6835. 'fieldset',
  6836. 'figcaption',
  6837. 'figure',
  6838. 'footer',
  6839. 'form',
  6840. 'frame',
  6841. 'frameset',
  6842. 'h1',
  6843. 'h2',
  6844. 'h3',
  6845. 'h4',
  6846. 'h5',
  6847. 'h6',
  6848. 'head',
  6849. 'header',
  6850. 'hr',
  6851. 'html',
  6852. 'iframe',
  6853. 'legend',
  6854. 'li',
  6855. 'link',
  6856. 'main',
  6857. 'menu',
  6858. 'menuitem',
  6859. 'meta',
  6860. 'nav',
  6861. 'noframes',
  6862. 'ol',
  6863. 'optgroup',
  6864. 'option',
  6865. 'p',
  6866. 'param',
  6867. 'section',
  6868. 'source',
  6869. 'summary',
  6870. 'table',
  6871. 'tbody',
  6872. 'td',
  6873. 'tfoot',
  6874. 'th',
  6875. 'thead',
  6876. 'title',
  6877. 'tr',
  6878. 'track',
  6879. 'ul'
  6880. ];
  6881. /***/ }),
  6882. /* 63 */
  6883. /***/ (function(module, exports, __webpack_require__) {
  6884. "use strict";
  6885. // Paragraph
  6886. module.exports = function paragraph(state, startLine/*, endLine*/) {
  6887. var content, terminate, i, l, token, oldParentType,
  6888. nextLine = startLine + 1,
  6889. terminatorRules = state.md.block.ruler.getRules('paragraph'),
  6890. endLine = state.lineMax;
  6891. oldParentType = state.parentType;
  6892. state.parentType = 'paragraph';
  6893. // jump line-by-line until empty one or EOF
  6894. for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
  6895. // this would be a code block normally, but after paragraph
  6896. // it's considered a lazy continuation regardless of what's there
  6897. if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }
  6898. // quirk for blockquotes, this line should already be checked by that rule
  6899. if (state.sCount[nextLine] < 0) { continue; }
  6900. // Some tags can terminate paragraph without empty line.
  6901. terminate = false;
  6902. for (i = 0, l = terminatorRules.length; i < l; i++) {
  6903. if (terminatorRules[i](state, nextLine, endLine, true)) {
  6904. terminate = true;
  6905. break;
  6906. }
  6907. }
  6908. if (terminate) { break; }
  6909. }
  6910. content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
  6911. state.line = nextLine;
  6912. token = state.push('paragraph_open', 'p', 1);
  6913. token.map = [ startLine, state.line ];
  6914. token = state.push('inline', '', 0);
  6915. token.content = content;
  6916. token.map = [ startLine, state.line ];
  6917. token.children = [];
  6918. token = state.push('paragraph_close', 'p', -1);
  6919. state.parentType = oldParentType;
  6920. return true;
  6921. };
  6922. /***/ }),
  6923. /* 64 */
  6924. /***/ (function(module, exports, __webpack_require__) {
  6925. "use strict";
  6926. // Parser state class
  6927. var Token = __webpack_require__(7);
  6928. var isSpace = __webpack_require__(0).isSpace;
  6929. function StateBlock(src, md, env, tokens) {
  6930. var ch, s, start, pos, len, indent, offset, indent_found;
  6931. this.src = src;
  6932. // link to parser instance
  6933. this.md = md;
  6934. this.env = env;
  6935. //
  6936. // Internal state vartiables
  6937. //
  6938. this.tokens = tokens;
  6939. this.bMarks = []; // line begin offsets for fast jumps
  6940. this.eMarks = []; // line end offsets for fast jumps
  6941. this.tShift = []; // offsets of the first non-space characters (tabs not expanded)
  6942. this.sCount = []; // indents for each line (tabs expanded)
  6943. // An amount of virtual spaces (tabs expanded) between beginning
  6944. // of each line (bMarks) and real beginning of that line.
  6945. //
  6946. // It exists only as a hack because blockquotes override bMarks
  6947. // losing information in the process.
  6948. //
  6949. // It's used only when expanding tabs, you can think about it as
  6950. // an initial tab length, e.g. bsCount=21 applied to string `\t123`
  6951. // means first tab should be expanded to 4-21%4 === 3 spaces.
  6952. //
  6953. this.bsCount = [];
  6954. // block parser variables
  6955. this.blkIndent = 0; // required block content indent
  6956. // (for example, if we are in list)
  6957. this.line = 0; // line index in src
  6958. this.lineMax = 0; // lines count
  6959. this.tight = false; // loose/tight mode for lists
  6960. this.ddIndent = -1; // indent of the current dd block (-1 if there isn't any)
  6961. // can be 'blockquote', 'list', 'root', 'paragraph' or 'reference'
  6962. // used in lists to determine if they interrupt a paragraph
  6963. this.parentType = 'root';
  6964. this.level = 0;
  6965. // renderer
  6966. this.result = '';
  6967. // Create caches
  6968. // Generate markers.
  6969. s = this.src;
  6970. indent_found = false;
  6971. for (start = pos = indent = offset = 0, len = s.length; pos < len; pos++) {
  6972. ch = s.charCodeAt(pos);
  6973. if (!indent_found) {
  6974. if (isSpace(ch)) {
  6975. indent++;
  6976. if (ch === 0x09) {
  6977. offset += 4 - offset % 4;
  6978. } else {
  6979. offset++;
  6980. }
  6981. continue;
  6982. } else {
  6983. indent_found = true;
  6984. }
  6985. }
  6986. if (ch === 0x0A || pos === len - 1) {
  6987. if (ch !== 0x0A) { pos++; }
  6988. this.bMarks.push(start);
  6989. this.eMarks.push(pos);
  6990. this.tShift.push(indent);
  6991. this.sCount.push(offset);
  6992. this.bsCount.push(0);
  6993. indent_found = false;
  6994. indent = 0;
  6995. offset = 0;
  6996. start = pos + 1;
  6997. }
  6998. }
  6999. // Push fake entry to simplify cache bounds checks
  7000. this.bMarks.push(s.length);
  7001. this.eMarks.push(s.length);
  7002. this.tShift.push(0);
  7003. this.sCount.push(0);
  7004. this.bsCount.push(0);
  7005. this.lineMax = this.bMarks.length - 1; // don't count last fake line
  7006. }
  7007. // Push new token to "stream".
  7008. //
  7009. StateBlock.prototype.push = function (type, tag, nesting) {
  7010. var token = new Token(type, tag, nesting);
  7011. token.block = true;
  7012. if (nesting < 0) { this.level--; }
  7013. token.level = this.level;
  7014. if (nesting > 0) { this.level++; }
  7015. this.tokens.push(token);
  7016. return token;
  7017. };
  7018. StateBlock.prototype.isEmpty = function isEmpty(line) {
  7019. return this.bMarks[line] + this.tShift[line] >= this.eMarks[line];
  7020. };
  7021. StateBlock.prototype.skipEmptyLines = function skipEmptyLines(from) {
  7022. for (var max = this.lineMax; from < max; from++) {
  7023. if (this.bMarks[from] + this.tShift[from] < this.eMarks[from]) {
  7024. break;
  7025. }
  7026. }
  7027. return from;
  7028. };
  7029. // Skip spaces from given position.
  7030. StateBlock.prototype.skipSpaces = function skipSpaces(pos) {
  7031. var ch;
  7032. for (var max = this.src.length; pos < max; pos++) {
  7033. ch = this.src.charCodeAt(pos);
  7034. if (!isSpace(ch)) { break; }
  7035. }
  7036. return pos;
  7037. };
  7038. // Skip spaces from given position in reverse.
  7039. StateBlock.prototype.skipSpacesBack = function skipSpacesBack(pos, min) {
  7040. if (pos <= min) { return pos; }
  7041. while (pos > min) {
  7042. if (!isSpace(this.src.charCodeAt(--pos))) { return pos + 1; }
  7043. }
  7044. return pos;
  7045. };
  7046. // Skip char codes from given position
  7047. StateBlock.prototype.skipChars = function skipChars(pos, code) {
  7048. for (var max = this.src.length; pos < max; pos++) {
  7049. if (this.src.charCodeAt(pos) !== code) { break; }
  7050. }
  7051. return pos;
  7052. };
  7053. // Skip char codes reverse from given position - 1
  7054. StateBlock.prototype.skipCharsBack = function skipCharsBack(pos, code, min) {
  7055. if (pos <= min) { return pos; }
  7056. while (pos > min) {
  7057. if (code !== this.src.charCodeAt(--pos)) { return pos + 1; }
  7058. }
  7059. return pos;
  7060. };
  7061. // cut lines range from source.
  7062. StateBlock.prototype.getLines = function getLines(begin, end, indent, keepLastLF) {
  7063. var i, lineIndent, ch, first, last, queue, lineStart,
  7064. line = begin;
  7065. if (begin >= end) {
  7066. return '';
  7067. }
  7068. queue = new Array(end - begin);
  7069. for (i = 0; line < end; line++, i++) {
  7070. lineIndent = 0;
  7071. lineStart = first = this.bMarks[line];
  7072. if (line + 1 < end || keepLastLF) {
  7073. // No need for bounds check because we have fake entry on tail.
  7074. last = this.eMarks[line] + 1;
  7075. } else {
  7076. last = this.eMarks[line];
  7077. }
  7078. while (first < last && lineIndent < indent) {
  7079. ch = this.src.charCodeAt(first);
  7080. if (isSpace(ch)) {
  7081. if (ch === 0x09) {
  7082. lineIndent += 4 - (lineIndent + this.bsCount[line]) % 4;
  7083. } else {
  7084. lineIndent++;
  7085. }
  7086. } else if (first - lineStart < this.tShift[line]) {
  7087. // patched tShift masked characters to look like spaces (blockquotes, list markers)
  7088. lineIndent++;
  7089. } else {
  7090. break;
  7091. }
  7092. first++;
  7093. }
  7094. if (lineIndent > indent) {
  7095. // partially expanding tabs in code blocks, e.g '\t\tfoobar'
  7096. // with indent=2 becomes ' \tfoobar'
  7097. queue[i] = new Array(lineIndent - indent + 1).join(' ') + this.src.slice(first, last);
  7098. } else {
  7099. queue[i] = this.src.slice(first, last);
  7100. }
  7101. }
  7102. return queue.join('');
  7103. };
  7104. // re-export Token class to use in block rules
  7105. StateBlock.prototype.Token = Token;
  7106. module.exports = StateBlock;
  7107. /***/ }),
  7108. /* 65 */
  7109. /***/ (function(module, exports, __webpack_require__) {
  7110. "use strict";
  7111. /** internal
  7112. * class ParserInline
  7113. *
  7114. * Tokenizes paragraph content.
  7115. **/
  7116. var Ruler = __webpack_require__(6);
  7117. ////////////////////////////////////////////////////////////////////////////////
  7118. // Parser rules
  7119. var _rules = [
  7120. [ 'text', __webpack_require__(66) ],
  7121. [ 'newline', __webpack_require__(67) ],
  7122. [ 'escape', __webpack_require__(68) ],
  7123. [ 'backticks', __webpack_require__(69) ],
  7124. [ 'strikethrough', __webpack_require__(17).tokenize ],
  7125. [ 'emphasis', __webpack_require__(18).tokenize ],
  7126. [ 'link', __webpack_require__(70) ],
  7127. [ 'image', __webpack_require__(71) ],
  7128. [ 'autolink', __webpack_require__(72) ],
  7129. [ 'html_inline', __webpack_require__(73) ],
  7130. [ 'entity', __webpack_require__(74) ]
  7131. ];
  7132. var _rules2 = [
  7133. [ 'balance_pairs', __webpack_require__(75) ],
  7134. [ 'strikethrough', __webpack_require__(17).postProcess ],
  7135. [ 'emphasis', __webpack_require__(18).postProcess ],
  7136. [ 'text_collapse', __webpack_require__(76) ]
  7137. ];
  7138. /**
  7139. * new ParserInline()
  7140. **/
  7141. function ParserInline() {
  7142. var i;
  7143. /**
  7144. * ParserInline#ruler -> Ruler
  7145. *
  7146. * [[Ruler]] instance. Keep configuration of inline rules.
  7147. **/
  7148. this.ruler = new Ruler();
  7149. for (i = 0; i < _rules.length; i++) {
  7150. this.ruler.push(_rules[i][0], _rules[i][1]);
  7151. }
  7152. /**
  7153. * ParserInline#ruler2 -> Ruler
  7154. *
  7155. * [[Ruler]] instance. Second ruler used for post-processing
  7156. * (e.g. in emphasis-like rules).
  7157. **/
  7158. this.ruler2 = new Ruler();
  7159. for (i = 0; i < _rules2.length; i++) {
  7160. this.ruler2.push(_rules2[i][0], _rules2[i][1]);
  7161. }
  7162. }
  7163. // Skip single token by running all rules in validation mode;
  7164. // returns `true` if any rule reported success
  7165. //
  7166. ParserInline.prototype.skipToken = function (state) {
  7167. var ok, i, pos = state.pos,
  7168. rules = this.ruler.getRules(''),
  7169. len = rules.length,
  7170. maxNesting = state.md.options.maxNesting,
  7171. cache = state.cache;
  7172. if (typeof cache[pos] !== 'undefined') {
  7173. state.pos = cache[pos];
  7174. return;
  7175. }
  7176. if (state.level < maxNesting) {
  7177. for (i = 0; i < len; i++) {
  7178. // Increment state.level and decrement it later to limit recursion.
  7179. // It's harmless to do here, because no tokens are created. But ideally,
  7180. // we'd need a separate private state variable for this purpose.
  7181. //
  7182. state.level++;
  7183. ok = rules[i](state, true);
  7184. state.level--;
  7185. if (ok) { break; }
  7186. }
  7187. } else {
  7188. // Too much nesting, just skip until the end of the paragraph.
  7189. //
  7190. // NOTE: this will cause links to behave incorrectly in the following case,
  7191. // when an amount of `[` is exactly equal to `maxNesting + 1`:
  7192. //
  7193. // [[[[[[[[[[[[[[[[[[[[[foo]()
  7194. //
  7195. // TODO: remove this workaround when CM standard will allow nested links
  7196. // (we can replace it by preventing links from being parsed in
  7197. // validation mode)
  7198. //
  7199. state.pos = state.posMax;
  7200. }
  7201. if (!ok) { state.pos++; }
  7202. cache[pos] = state.pos;
  7203. };
  7204. // Generate tokens for input range
  7205. //
  7206. ParserInline.prototype.tokenize = function (state) {
  7207. var ok, i,
  7208. rules = this.ruler.getRules(''),
  7209. len = rules.length,
  7210. end = state.posMax,
  7211. maxNesting = state.md.options.maxNesting;
  7212. while (state.pos < end) {
  7213. // Try all possible rules.
  7214. // On success, rule should:
  7215. //
  7216. // - update `state.pos`
  7217. // - update `state.tokens`
  7218. // - return true
  7219. if (state.level < maxNesting) {
  7220. for (i = 0; i < len; i++) {
  7221. ok = rules[i](state, false);
  7222. if (ok) { break; }
  7223. }
  7224. }
  7225. if (ok) {
  7226. if (state.pos >= end) { break; }
  7227. continue;
  7228. }
  7229. state.pending += state.src[state.pos++];
  7230. }
  7231. if (state.pending) {
  7232. state.pushPending();
  7233. }
  7234. };
  7235. /**
  7236. * ParserInline.parse(str, md, env, outTokens)
  7237. *
  7238. * Process input string and push inline tokens into `outTokens`
  7239. **/
  7240. ParserInline.prototype.parse = function (str, md, env, outTokens) {
  7241. var i, rules, len;
  7242. var state = new this.State(str, md, env, outTokens);
  7243. this.tokenize(state);
  7244. rules = this.ruler2.getRules('');
  7245. len = rules.length;
  7246. for (i = 0; i < len; i++) {
  7247. rules[i](state);
  7248. }
  7249. };
  7250. ParserInline.prototype.State = __webpack_require__(77);
  7251. module.exports = ParserInline;
  7252. /***/ }),
  7253. /* 66 */
  7254. /***/ (function(module, exports, __webpack_require__) {
  7255. "use strict";
  7256. // Skip text characters for text token, place those to pending buffer
  7257. // and increment current pos
  7258. // Rule to skip pure text
  7259. // '{}$%@~+=:' reserved for extentions
  7260. // !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~
  7261. // !!!! Don't confuse with "Markdown ASCII Punctuation" chars
  7262. // http://spec.commonmark.org/0.15/#ascii-punctuation-character
  7263. function isTerminatorChar(ch) {
  7264. switch (ch) {
  7265. case 0x0A/* \n */:
  7266. case 0x21/* ! */:
  7267. case 0x23/* # */:
  7268. case 0x24/* $ */:
  7269. case 0x25/* % */:
  7270. case 0x26/* & */:
  7271. case 0x2A/* * */:
  7272. case 0x2B/* + */:
  7273. case 0x2D/* - */:
  7274. case 0x3A/* : */:
  7275. case 0x3C/* < */:
  7276. case 0x3D/* = */:
  7277. case 0x3E/* > */:
  7278. case 0x40/* @ */:
  7279. case 0x5B/* [ */:
  7280. case 0x5C/* \ */:
  7281. case 0x5D/* ] */:
  7282. case 0x5E/* ^ */:
  7283. case 0x5F/* _ */:
  7284. case 0x60/* ` */:
  7285. case 0x7B/* { */:
  7286. case 0x7D/* } */:
  7287. case 0x7E/* ~ */:
  7288. return true;
  7289. default:
  7290. return false;
  7291. }
  7292. }
  7293. module.exports = function text(state, silent) {
  7294. var pos = state.pos;
  7295. while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) {
  7296. pos++;
  7297. }
  7298. if (pos === state.pos) { return false; }
  7299. if (!silent) { state.pending += state.src.slice(state.pos, pos); }
  7300. state.pos = pos;
  7301. return true;
  7302. };
  7303. // Alternative implementation, for memory.
  7304. //
  7305. // It costs 10% of performance, but allows extend terminators list, if place it
  7306. // to `ParcerInline` property. Probably, will switch to it sometime, such
  7307. // flexibility required.
  7308. /*
  7309. var TERMINATOR_RE = /[\n!#$%&*+\-:<=>@[\\\]^_`{}~]/;
  7310. module.exports = function text(state, silent) {
  7311. var pos = state.pos,
  7312. idx = state.src.slice(pos).search(TERMINATOR_RE);
  7313. // first char is terminator -> empty text
  7314. if (idx === 0) { return false; }
  7315. // no terminator -> text till end of string
  7316. if (idx < 0) {
  7317. if (!silent) { state.pending += state.src.slice(pos); }
  7318. state.pos = state.src.length;
  7319. return true;
  7320. }
  7321. if (!silent) { state.pending += state.src.slice(pos, pos + idx); }
  7322. state.pos += idx;
  7323. return true;
  7324. };*/
  7325. /***/ }),
  7326. /* 67 */
  7327. /***/ (function(module, exports, __webpack_require__) {
  7328. "use strict";
  7329. // Proceess '\n'
  7330. var isSpace = __webpack_require__(0).isSpace;
  7331. module.exports = function newline(state, silent) {
  7332. var pmax, max, pos = state.pos;
  7333. if (state.src.charCodeAt(pos) !== 0x0A/* \n */) { return false; }
  7334. pmax = state.pending.length - 1;
  7335. max = state.posMax;
  7336. // ' \n' -> hardbreak
  7337. // Lookup in pending chars is bad practice! Don't copy to other rules!
  7338. // Pending string is stored in concat mode, indexed lookups will cause
  7339. // convertion to flat mode.
  7340. if (!silent) {
  7341. if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) {
  7342. if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) {
  7343. state.pending = state.pending.replace(/ +$/, '');
  7344. state.push('hardbreak', 'br', 0);
  7345. } else {
  7346. state.pending = state.pending.slice(0, -1);
  7347. state.push('softbreak', 'br', 0);
  7348. }
  7349. } else {
  7350. state.push('softbreak', 'br', 0);
  7351. }
  7352. }
  7353. pos++;
  7354. // skip heading spaces for next line
  7355. while (pos < max && isSpace(state.src.charCodeAt(pos))) { pos++; }
  7356. state.pos = pos;
  7357. return true;
  7358. };
  7359. /***/ }),
  7360. /* 68 */
  7361. /***/ (function(module, exports, __webpack_require__) {
  7362. "use strict";
  7363. // Process escaped chars and hardbreaks
  7364. var isSpace = __webpack_require__(0).isSpace;
  7365. var ESCAPED = [];
  7366. for (var i = 0; i < 256; i++) { ESCAPED.push(0); }
  7367. '\\!"#$%&\'()*+,./:;<=>?@[]^_`{|}~-'
  7368. .split('').forEach(function (ch) { ESCAPED[ch.charCodeAt(0)] = 1; });
  7369. module.exports = function escape(state, silent) {
  7370. var ch, pos = state.pos, max = state.posMax;
  7371. if (state.src.charCodeAt(pos) !== 0x5C/* \ */) { return false; }
  7372. pos++;
  7373. if (pos < max) {
  7374. ch = state.src.charCodeAt(pos);
  7375. if (ch < 256 && ESCAPED[ch] !== 0) {
  7376. if (!silent) { state.pending += state.src[pos]; }
  7377. state.pos += 2;
  7378. return true;
  7379. }
  7380. if (ch === 0x0A) {
  7381. if (!silent) {
  7382. state.push('hardbreak', 'br', 0);
  7383. }
  7384. pos++;
  7385. // skip leading whitespaces from next line
  7386. while (pos < max) {
  7387. ch = state.src.charCodeAt(pos);
  7388. if (!isSpace(ch)) { break; }
  7389. pos++;
  7390. }
  7391. state.pos = pos;
  7392. return true;
  7393. }
  7394. }
  7395. if (!silent) { state.pending += '\\'; }
  7396. state.pos++;
  7397. return true;
  7398. };
  7399. /***/ }),
  7400. /* 69 */
  7401. /***/ (function(module, exports, __webpack_require__) {
  7402. "use strict";
  7403. // Parse backticks
  7404. module.exports = function backtick(state, silent) {
  7405. var start, max, marker, matchStart, matchEnd, token,
  7406. pos = state.pos,
  7407. ch = state.src.charCodeAt(pos);
  7408. if (ch !== 0x60/* ` */) { return false; }
  7409. start = pos;
  7410. pos++;
  7411. max = state.posMax;
  7412. while (pos < max && state.src.charCodeAt(pos) === 0x60/* ` */) { pos++; }
  7413. marker = state.src.slice(start, pos);
  7414. matchStart = matchEnd = pos;
  7415. while ((matchStart = state.src.indexOf('`', matchEnd)) !== -1) {
  7416. matchEnd = matchStart + 1;
  7417. while (matchEnd < max && state.src.charCodeAt(matchEnd) === 0x60/* ` */) { matchEnd++; }
  7418. if (matchEnd - matchStart === marker.length) {
  7419. if (!silent) {
  7420. token = state.push('code_inline', 'code', 0);
  7421. token.markup = marker;
  7422. token.content = state.src.slice(pos, matchStart)
  7423. .replace(/[ \n]+/g, ' ')
  7424. .trim();
  7425. }
  7426. state.pos = matchEnd;
  7427. return true;
  7428. }
  7429. }
  7430. if (!silent) { state.pending += marker; }
  7431. state.pos += marker.length;
  7432. return true;
  7433. };
  7434. /***/ }),
  7435. /* 70 */
  7436. /***/ (function(module, exports, __webpack_require__) {
  7437. "use strict";
  7438. // Process [link](<to> "stuff")
  7439. var normalizeReference = __webpack_require__(0).normalizeReference;
  7440. var isSpace = __webpack_require__(0).isSpace;
  7441. module.exports = function link(state, silent) {
  7442. var attrs,
  7443. code,
  7444. label,
  7445. labelEnd,
  7446. labelStart,
  7447. pos,
  7448. res,
  7449. ref,
  7450. title,
  7451. token,
  7452. href = '',
  7453. oldPos = state.pos,
  7454. max = state.posMax,
  7455. start = state.pos,
  7456. parseReference = true;
  7457. if (state.src.charCodeAt(state.pos) !== 0x5B/* [ */) { return false; }
  7458. labelStart = state.pos + 1;
  7459. labelEnd = state.md.helpers.parseLinkLabel(state, state.pos, true);
  7460. // parser failed to find ']', so it's not a valid link
  7461. if (labelEnd < 0) { return false; }
  7462. pos = labelEnd + 1;
  7463. if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {
  7464. //
  7465. // Inline link
  7466. //
  7467. // might have found a valid shortcut link, disable reference parsing
  7468. parseReference = false;
  7469. // [link]( <href> "title" )
  7470. // ^^ skipping these spaces
  7471. pos++;
  7472. for (; pos < max; pos++) {
  7473. code = state.src.charCodeAt(pos);
  7474. if (!isSpace(code) && code !== 0x0A) { break; }
  7475. }
  7476. if (pos >= max) { return false; }
  7477. // [link]( <href> "title" )
  7478. // ^^^^^^ parsing link destination
  7479. start = pos;
  7480. res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);
  7481. if (res.ok) {
  7482. href = state.md.normalizeLink(res.str);
  7483. if (state.md.validateLink(href)) {
  7484. pos = res.pos;
  7485. } else {
  7486. href = '';
  7487. }
  7488. }
  7489. // [link]( <href> "title" )
  7490. // ^^ skipping these spaces
  7491. start = pos;
  7492. for (; pos < max; pos++) {
  7493. code = state.src.charCodeAt(pos);
  7494. if (!isSpace(code) && code !== 0x0A) { break; }
  7495. }
  7496. // [link]( <href> "title" )
  7497. // ^^^^^^^ parsing link title
  7498. res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);
  7499. if (pos < max && start !== pos && res.ok) {
  7500. title = res.str;
  7501. pos = res.pos;
  7502. // [link]( <href> "title" )
  7503. // ^^ skipping these spaces
  7504. for (; pos < max; pos++) {
  7505. code = state.src.charCodeAt(pos);
  7506. if (!isSpace(code) && code !== 0x0A) { break; }
  7507. }
  7508. } else {
  7509. title = '';
  7510. }
  7511. if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {
  7512. // parsing a valid shortcut link failed, fallback to reference
  7513. parseReference = true;
  7514. }
  7515. pos++;
  7516. }
  7517. if (parseReference) {
  7518. //
  7519. // Link reference
  7520. //
  7521. if (typeof state.env.references === 'undefined') { return false; }
  7522. if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {
  7523. start = pos + 1;
  7524. pos = state.md.helpers.parseLinkLabel(state, pos);
  7525. if (pos >= 0) {
  7526. label = state.src.slice(start, pos++);
  7527. } else {
  7528. pos = labelEnd + 1;
  7529. }
  7530. } else {
  7531. pos = labelEnd + 1;
  7532. }
  7533. // covers label === '' and label === undefined
  7534. // (collapsed reference link and shortcut reference link respectively)
  7535. if (!label) { label = state.src.slice(labelStart, labelEnd); }
  7536. ref = state.env.references[normalizeReference(label)];
  7537. if (!ref) {
  7538. state.pos = oldPos;
  7539. return false;
  7540. }
  7541. href = ref.href;
  7542. title = ref.title;
  7543. }
  7544. //
  7545. // We found the end of the link, and know for a fact it's a valid link;
  7546. // so all that's left to do is to call tokenizer.
  7547. //
  7548. if (!silent) {
  7549. state.pos = labelStart;
  7550. state.posMax = labelEnd;
  7551. token = state.push('link_open', 'a', 1);
  7552. token.attrs = attrs = [ [ 'href', href ] ];
  7553. if (title) {
  7554. attrs.push([ 'title', title ]);
  7555. }
  7556. state.md.inline.tokenize(state);
  7557. token = state.push('link_close', 'a', -1);
  7558. }
  7559. state.pos = pos;
  7560. state.posMax = max;
  7561. return true;
  7562. };
  7563. /***/ }),
  7564. /* 71 */
  7565. /***/ (function(module, exports, __webpack_require__) {
  7566. "use strict";
  7567. // Process ![image](<src> "title")
  7568. var normalizeReference = __webpack_require__(0).normalizeReference;
  7569. var isSpace = __webpack_require__(0).isSpace;
  7570. module.exports = function image(state, silent) {
  7571. var attrs,
  7572. code,
  7573. content,
  7574. label,
  7575. labelEnd,
  7576. labelStart,
  7577. pos,
  7578. ref,
  7579. res,
  7580. title,
  7581. token,
  7582. tokens,
  7583. start,
  7584. href = '',
  7585. oldPos = state.pos,
  7586. max = state.posMax;
  7587. if (state.src.charCodeAt(state.pos) !== 0x21/* ! */) { return false; }
  7588. if (state.src.charCodeAt(state.pos + 1) !== 0x5B/* [ */) { return false; }
  7589. labelStart = state.pos + 2;
  7590. labelEnd = state.md.helpers.parseLinkLabel(state, state.pos + 1, false);
  7591. // parser failed to find ']', so it's not a valid link
  7592. if (labelEnd < 0) { return false; }
  7593. pos = labelEnd + 1;
  7594. if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {
  7595. //
  7596. // Inline link
  7597. //
  7598. // [link]( <href> "title" )
  7599. // ^^ skipping these spaces
  7600. pos++;
  7601. for (; pos < max; pos++) {
  7602. code = state.src.charCodeAt(pos);
  7603. if (!isSpace(code) && code !== 0x0A) { break; }
  7604. }
  7605. if (pos >= max) { return false; }
  7606. // [link]( <href> "title" )
  7607. // ^^^^^^ parsing link destination
  7608. start = pos;
  7609. res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);
  7610. if (res.ok) {
  7611. href = state.md.normalizeLink(res.str);
  7612. if (state.md.validateLink(href)) {
  7613. pos = res.pos;
  7614. } else {
  7615. href = '';
  7616. }
  7617. }
  7618. // [link]( <href> "title" )
  7619. // ^^ skipping these spaces
  7620. start = pos;
  7621. for (; pos < max; pos++) {
  7622. code = state.src.charCodeAt(pos);
  7623. if (!isSpace(code) && code !== 0x0A) { break; }
  7624. }
  7625. // [link]( <href> "title" )
  7626. // ^^^^^^^ parsing link title
  7627. res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);
  7628. if (pos < max && start !== pos && res.ok) {
  7629. title = res.str;
  7630. pos = res.pos;
  7631. // [link]( <href> "title" )
  7632. // ^^ skipping these spaces
  7633. for (; pos < max; pos++) {
  7634. code = state.src.charCodeAt(pos);
  7635. if (!isSpace(code) && code !== 0x0A) { break; }
  7636. }
  7637. } else {
  7638. title = '';
  7639. }
  7640. if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {
  7641. state.pos = oldPos;
  7642. return false;
  7643. }
  7644. pos++;
  7645. } else {
  7646. //
  7647. // Link reference
  7648. //
  7649. if (typeof state.env.references === 'undefined') { return false; }
  7650. if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {
  7651. start = pos + 1;
  7652. pos = state.md.helpers.parseLinkLabel(state, pos);
  7653. if (pos >= 0) {
  7654. label = state.src.slice(start, pos++);
  7655. } else {
  7656. pos = labelEnd + 1;
  7657. }
  7658. } else {
  7659. pos = labelEnd + 1;
  7660. }
  7661. // covers label === '' and label === undefined
  7662. // (collapsed reference link and shortcut reference link respectively)
  7663. if (!label) { label = state.src.slice(labelStart, labelEnd); }
  7664. ref = state.env.references[normalizeReference(label)];
  7665. if (!ref) {
  7666. state.pos = oldPos;
  7667. return false;
  7668. }
  7669. href = ref.href;
  7670. title = ref.title;
  7671. }
  7672. //
  7673. // We found the end of the link, and know for a fact it's a valid link;
  7674. // so all that's left to do is to call tokenizer.
  7675. //
  7676. if (!silent) {
  7677. content = state.src.slice(labelStart, labelEnd);
  7678. state.md.inline.parse(
  7679. content,
  7680. state.md,
  7681. state.env,
  7682. tokens = []
  7683. );
  7684. token = state.push('image', 'img', 0);
  7685. token.attrs = attrs = [ [ 'src', href ], [ 'alt', '' ] ];
  7686. token.children = tokens;
  7687. token.content = content;
  7688. if (title) {
  7689. attrs.push([ 'title', title ]);
  7690. }
  7691. }
  7692. state.pos = pos;
  7693. state.posMax = max;
  7694. return true;
  7695. };
  7696. /***/ }),
  7697. /* 72 */
  7698. /***/ (function(module, exports, __webpack_require__) {
  7699. "use strict";
  7700. // Process autolinks '<protocol:...>'
  7701. /*eslint max-len:0*/
  7702. var EMAIL_RE = /^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/;
  7703. var AUTOLINK_RE = /^<([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)>/;
  7704. module.exports = function autolink(state, silent) {
  7705. var tail, linkMatch, emailMatch, url, fullUrl, token,
  7706. pos = state.pos;
  7707. if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }
  7708. tail = state.src.slice(pos);
  7709. if (tail.indexOf('>') < 0) { return false; }
  7710. if (AUTOLINK_RE.test(tail)) {
  7711. linkMatch = tail.match(AUTOLINK_RE);
  7712. url = linkMatch[0].slice(1, -1);
  7713. fullUrl = state.md.normalizeLink(url);
  7714. if (!state.md.validateLink(fullUrl)) { return false; }
  7715. if (!silent) {
  7716. token = state.push('link_open', 'a', 1);
  7717. token.attrs = [ [ 'href', fullUrl ] ];
  7718. token.markup = 'autolink';
  7719. token.info = 'auto';
  7720. token = state.push('text', '', 0);
  7721. token.content = state.md.normalizeLinkText(url);
  7722. token = state.push('link_close', 'a', -1);
  7723. token.markup = 'autolink';
  7724. token.info = 'auto';
  7725. }
  7726. state.pos += linkMatch[0].length;
  7727. return true;
  7728. }
  7729. if (EMAIL_RE.test(tail)) {
  7730. emailMatch = tail.match(EMAIL_RE);
  7731. url = emailMatch[0].slice(1, -1);
  7732. fullUrl = state.md.normalizeLink('mailto:' + url);
  7733. if (!state.md.validateLink(fullUrl)) { return false; }
  7734. if (!silent) {
  7735. token = state.push('link_open', 'a', 1);
  7736. token.attrs = [ [ 'href', fullUrl ] ];
  7737. token.markup = 'autolink';
  7738. token.info = 'auto';
  7739. token = state.push('text', '', 0);
  7740. token.content = state.md.normalizeLinkText(url);
  7741. token = state.push('link_close', 'a', -1);
  7742. token.markup = 'autolink';
  7743. token.info = 'auto';
  7744. }
  7745. state.pos += emailMatch[0].length;
  7746. return true;
  7747. }
  7748. return false;
  7749. };
  7750. /***/ }),
  7751. /* 73 */
  7752. /***/ (function(module, exports, __webpack_require__) {
  7753. "use strict";
  7754. // Process html tags
  7755. var HTML_TAG_RE = __webpack_require__(16).HTML_TAG_RE;
  7756. function isLetter(ch) {
  7757. /*eslint no-bitwise:0*/
  7758. var lc = ch | 0x20; // to lower case
  7759. return (lc >= 0x61/* a */) && (lc <= 0x7a/* z */);
  7760. }
  7761. module.exports = function html_inline(state, silent) {
  7762. var ch, match, max, token,
  7763. pos = state.pos;
  7764. if (!state.md.options.html) { return false; }
  7765. // Check start
  7766. max = state.posMax;
  7767. if (state.src.charCodeAt(pos) !== 0x3C/* < */ ||
  7768. pos + 2 >= max) {
  7769. return false;
  7770. }
  7771. // Quick fail on second char
  7772. ch = state.src.charCodeAt(pos + 1);
  7773. if (ch !== 0x21/* ! */ &&
  7774. ch !== 0x3F/* ? */ &&
  7775. ch !== 0x2F/* / */ &&
  7776. !isLetter(ch)) {
  7777. return false;
  7778. }
  7779. match = state.src.slice(pos).match(HTML_TAG_RE);
  7780. if (!match) { return false; }
  7781. if (!silent) {
  7782. token = state.push('html_inline', '', 0);
  7783. token.content = state.src.slice(pos, pos + match[0].length);
  7784. }
  7785. state.pos += match[0].length;
  7786. return true;
  7787. };
  7788. /***/ }),
  7789. /* 74 */
  7790. /***/ (function(module, exports, __webpack_require__) {
  7791. "use strict";
  7792. // Process html entity - &#123;, &#xAF;, &quot;, ...
  7793. var entities = __webpack_require__(11);
  7794. var has = __webpack_require__(0).has;
  7795. var isValidEntityCode = __webpack_require__(0).isValidEntityCode;
  7796. var fromCodePoint = __webpack_require__(0).fromCodePoint;
  7797. var DIGITAL_RE = /^&#((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i;
  7798. var NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;
  7799. module.exports = function entity(state, silent) {
  7800. var ch, code, match, pos = state.pos, max = state.posMax;
  7801. if (state.src.charCodeAt(pos) !== 0x26/* & */) { return false; }
  7802. if (pos + 1 < max) {
  7803. ch = state.src.charCodeAt(pos + 1);
  7804. if (ch === 0x23 /* # */) {
  7805. match = state.src.slice(pos).match(DIGITAL_RE);
  7806. if (match) {
  7807. if (!silent) {
  7808. code = match[1][0].toLowerCase() === 'x' ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10);
  7809. state.pending += isValidEntityCode(code) ? fromCodePoint(code) : fromCodePoint(0xFFFD);
  7810. }
  7811. state.pos += match[0].length;
  7812. return true;
  7813. }
  7814. } else {
  7815. match = state.src.slice(pos).match(NAMED_RE);
  7816. if (match) {
  7817. if (has(entities, match[1])) {
  7818. if (!silent) { state.pending += entities[match[1]]; }
  7819. state.pos += match[0].length;
  7820. return true;
  7821. }
  7822. }
  7823. }
  7824. }
  7825. if (!silent) { state.pending += '&'; }
  7826. state.pos++;
  7827. return true;
  7828. };
  7829. /***/ }),
  7830. /* 75 */
  7831. /***/ (function(module, exports, __webpack_require__) {
  7832. "use strict";
  7833. // For each opening emphasis-like marker find a matching closing one
  7834. //
  7835. module.exports = function link_pairs(state) {
  7836. var i, j, lastDelim, currDelim,
  7837. delimiters = state.delimiters,
  7838. max = state.delimiters.length;
  7839. for (i = 0; i < max; i++) {
  7840. lastDelim = delimiters[i];
  7841. if (!lastDelim.close) { continue; }
  7842. j = i - lastDelim.jump - 1;
  7843. while (j >= 0) {
  7844. currDelim = delimiters[j];
  7845. if (currDelim.open &&
  7846. currDelim.marker === lastDelim.marker &&
  7847. currDelim.end < 0 &&
  7848. currDelim.level === lastDelim.level) {
  7849. // typeofs are for backward compatibility with plugins
  7850. var odd_match = (currDelim.close || lastDelim.open) &&
  7851. typeof currDelim.length !== 'undefined' &&
  7852. typeof lastDelim.length !== 'undefined' &&
  7853. (currDelim.length + lastDelim.length) % 3 === 0;
  7854. if (!odd_match) {
  7855. lastDelim.jump = i - j;
  7856. lastDelim.open = false;
  7857. currDelim.end = i;
  7858. currDelim.jump = 0;
  7859. break;
  7860. }
  7861. }
  7862. j -= currDelim.jump + 1;
  7863. }
  7864. }
  7865. };
  7866. /***/ }),
  7867. /* 76 */
  7868. /***/ (function(module, exports, __webpack_require__) {
  7869. "use strict";
  7870. // Merge adjacent text nodes into one, and re-calculate all token levels
  7871. //
  7872. module.exports = function text_collapse(state) {
  7873. var curr, last,
  7874. level = 0,
  7875. tokens = state.tokens,
  7876. max = state.tokens.length;
  7877. for (curr = last = 0; curr < max; curr++) {
  7878. // re-calculate levels
  7879. level += tokens[curr].nesting;
  7880. tokens[curr].level = level;
  7881. if (tokens[curr].type === 'text' &&
  7882. curr + 1 < max &&
  7883. tokens[curr + 1].type === 'text') {
  7884. // collapse two adjacent text nodes
  7885. tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;
  7886. } else {
  7887. if (curr !== last) { tokens[last] = tokens[curr]; }
  7888. last++;
  7889. }
  7890. }
  7891. if (curr !== last) {
  7892. tokens.length = last;
  7893. }
  7894. };
  7895. /***/ }),
  7896. /* 77 */
  7897. /***/ (function(module, exports, __webpack_require__) {
  7898. "use strict";
  7899. // Inline parser state
  7900. var Token = __webpack_require__(7);
  7901. var isWhiteSpace = __webpack_require__(0).isWhiteSpace;
  7902. var isPunctChar = __webpack_require__(0).isPunctChar;
  7903. var isMdAsciiPunct = __webpack_require__(0).isMdAsciiPunct;
  7904. function StateInline(src, md, env, outTokens) {
  7905. this.src = src;
  7906. this.env = env;
  7907. this.md = md;
  7908. this.tokens = outTokens;
  7909. this.pos = 0;
  7910. this.posMax = this.src.length;
  7911. this.level = 0;
  7912. this.pending = '';
  7913. this.pendingLevel = 0;
  7914. this.cache = {}; // Stores { start: end } pairs. Useful for backtrack
  7915. // optimization of pairs parse (emphasis, strikes).
  7916. this.delimiters = []; // Emphasis-like delimiters
  7917. }
  7918. // Flush pending text
  7919. //
  7920. StateInline.prototype.pushPending = function () {
  7921. var token = new Token('text', '', 0);
  7922. token.content = this.pending;
  7923. token.level = this.pendingLevel;
  7924. this.tokens.push(token);
  7925. this.pending = '';
  7926. return token;
  7927. };
  7928. // Push new token to "stream".
  7929. // If pending text exists - flush it as text token
  7930. //
  7931. StateInline.prototype.push = function (type, tag, nesting) {
  7932. if (this.pending) {
  7933. this.pushPending();
  7934. }
  7935. var token = new Token(type, tag, nesting);
  7936. if (nesting < 0) { this.level--; }
  7937. token.level = this.level;
  7938. if (nesting > 0) { this.level++; }
  7939. this.pendingLevel = this.level;
  7940. this.tokens.push(token);
  7941. return token;
  7942. };
  7943. // Scan a sequence of emphasis-like markers, and determine whether
  7944. // it can start an emphasis sequence or end an emphasis sequence.
  7945. //
  7946. // - start - position to scan from (it should point at a valid marker);
  7947. // - canSplitWord - determine if these markers can be found inside a word
  7948. //
  7949. StateInline.prototype.scanDelims = function (start, canSplitWord) {
  7950. var pos = start, lastChar, nextChar, count, can_open, can_close,
  7951. isLastWhiteSpace, isLastPunctChar,
  7952. isNextWhiteSpace, isNextPunctChar,
  7953. left_flanking = true,
  7954. right_flanking = true,
  7955. max = this.posMax,
  7956. marker = this.src.charCodeAt(start);
  7957. // treat beginning of the line as a whitespace
  7958. lastChar = start > 0 ? this.src.charCodeAt(start - 1) : 0x20;
  7959. while (pos < max && this.src.charCodeAt(pos) === marker) { pos++; }
  7960. count = pos - start;
  7961. // treat end of the line as a whitespace
  7962. nextChar = pos < max ? this.src.charCodeAt(pos) : 0x20;
  7963. isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
  7964. isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
  7965. isLastWhiteSpace = isWhiteSpace(lastChar);
  7966. isNextWhiteSpace = isWhiteSpace(nextChar);
  7967. if (isNextWhiteSpace) {
  7968. left_flanking = false;
  7969. } else if (isNextPunctChar) {
  7970. if (!(isLastWhiteSpace || isLastPunctChar)) {
  7971. left_flanking = false;
  7972. }
  7973. }
  7974. if (isLastWhiteSpace) {
  7975. right_flanking = false;
  7976. } else if (isLastPunctChar) {
  7977. if (!(isNextWhiteSpace || isNextPunctChar)) {
  7978. right_flanking = false;
  7979. }
  7980. }
  7981. if (!canSplitWord) {
  7982. can_open = left_flanking && (!right_flanking || isLastPunctChar);
  7983. can_close = right_flanking && (!left_flanking || isNextPunctChar);
  7984. } else {
  7985. can_open = left_flanking;
  7986. can_close = right_flanking;
  7987. }
  7988. return {
  7989. can_open: can_open,
  7990. can_close: can_close,
  7991. length: count
  7992. };
  7993. };
  7994. // re-export Token class to use in block rules
  7995. StateInline.prototype.Token = Token;
  7996. module.exports = StateInline;
  7997. /***/ }),
  7998. /* 78 */
  7999. /***/ (function(module, exports, __webpack_require__) {
  8000. "use strict";
  8001. ////////////////////////////////////////////////////////////////////////////////
  8002. // Helpers
  8003. // Merge objects
  8004. //
  8005. function assign(obj /*from1, from2, from3, ...*/) {
  8006. var sources = Array.prototype.slice.call(arguments, 1);
  8007. sources.forEach(function (source) {
  8008. if (!source) { return; }
  8009. Object.keys(source).forEach(function (key) {
  8010. obj[key] = source[key];
  8011. });
  8012. });
  8013. return obj;
  8014. }
  8015. function _class(obj) { return Object.prototype.toString.call(obj); }
  8016. function isString(obj) { return _class(obj) === '[object String]'; }
  8017. function isObject(obj) { return _class(obj) === '[object Object]'; }
  8018. function isRegExp(obj) { return _class(obj) === '[object RegExp]'; }
  8019. function isFunction(obj) { return _class(obj) === '[object Function]'; }
  8020. function escapeRE(str) { return str.replace(/[.?*+^$[\]\\(){}|-]/g, '\\$&'); }
  8021. ////////////////////////////////////////////////////////////////////////////////
  8022. var defaultOptions = {
  8023. fuzzyLink: true,
  8024. fuzzyEmail: true,
  8025. fuzzyIP: false
  8026. };
  8027. function isOptionsObj(obj) {
  8028. return Object.keys(obj || {}).reduce(function (acc, k) {
  8029. return acc || defaultOptions.hasOwnProperty(k);
  8030. }, false);
  8031. }
  8032. var defaultSchemas = {
  8033. 'http:': {
  8034. validate: function (text, pos, self) {
  8035. var tail = text.slice(pos);
  8036. if (!self.re.http) {
  8037. // compile lazily, because "host"-containing variables can change on tlds update.
  8038. self.re.http = new RegExp(
  8039. '^\\/\\/' + self.re.src_auth + self.re.src_host_port_strict + self.re.src_path, 'i'
  8040. );
  8041. }
  8042. if (self.re.http.test(tail)) {
  8043. return tail.match(self.re.http)[0].length;
  8044. }
  8045. return 0;
  8046. }
  8047. },
  8048. 'https:': 'http:',
  8049. 'ftp:': 'http:',
  8050. '//': {
  8051. validate: function (text, pos, self) {
  8052. var tail = text.slice(pos);
  8053. if (!self.re.no_http) {
  8054. // compile lazily, because "host"-containing variables can change on tlds update.
  8055. self.re.no_http = new RegExp(
  8056. '^' +
  8057. self.re.src_auth +
  8058. // Don't allow single-level domains, because of false positives like '//test'
  8059. // with code comments
  8060. '(?:localhost|(?:(?:' + self.re.src_domain + ')\\.)+' + self.re.src_domain_root + ')' +
  8061. self.re.src_port +
  8062. self.re.src_host_terminator +
  8063. self.re.src_path,
  8064. 'i'
  8065. );
  8066. }
  8067. if (self.re.no_http.test(tail)) {
  8068. // should not be `://` & `///`, that protects from errors in protocol name
  8069. if (pos >= 3 && text[pos - 3] === ':') { return 0; }
  8070. if (pos >= 3 && text[pos - 3] === '/') { return 0; }
  8071. return tail.match(self.re.no_http)[0].length;
  8072. }
  8073. return 0;
  8074. }
  8075. },
  8076. 'mailto:': {
  8077. validate: function (text, pos, self) {
  8078. var tail = text.slice(pos);
  8079. if (!self.re.mailto) {
  8080. self.re.mailto = new RegExp(
  8081. '^' + self.re.src_email_name + '@' + self.re.src_host_strict, 'i'
  8082. );
  8083. }
  8084. if (self.re.mailto.test(tail)) {
  8085. return tail.match(self.re.mailto)[0].length;
  8086. }
  8087. return 0;
  8088. }
  8089. }
  8090. };
  8091. /*eslint-disable max-len*/
  8092. // RE pattern for 2-character tlds (autogenerated by ./support/tlds_2char_gen.js)
  8093. var tlds_2ch_src_re = 'a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]';
  8094. // DON'T try to make PRs with changes. Extend TLDs with LinkifyIt.tlds() instead
  8095. var tlds_default = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'.split('|');
  8096. /*eslint-enable max-len*/
  8097. ////////////////////////////////////////////////////////////////////////////////
  8098. function resetScanCache(self) {
  8099. self.__index__ = -1;
  8100. self.__text_cache__ = '';
  8101. }
  8102. function createValidator(re) {
  8103. return function (text, pos) {
  8104. var tail = text.slice(pos);
  8105. if (re.test(tail)) {
  8106. return tail.match(re)[0].length;
  8107. }
  8108. return 0;
  8109. };
  8110. }
  8111. function createNormalizer() {
  8112. return function (match, self) {
  8113. self.normalize(match);
  8114. };
  8115. }
  8116. // Schemas compiler. Build regexps.
  8117. //
  8118. function compile(self) {
  8119. // Load & clone RE patterns.
  8120. var re = self.re = __webpack_require__(79)(self.__opts__);
  8121. // Define dynamic patterns
  8122. var tlds = self.__tlds__.slice();
  8123. self.onCompile();
  8124. if (!self.__tlds_replaced__) {
  8125. tlds.push(tlds_2ch_src_re);
  8126. }
  8127. tlds.push(re.src_xn);
  8128. re.src_tlds = tlds.join('|');
  8129. function untpl(tpl) { return tpl.replace('%TLDS%', re.src_tlds); }
  8130. re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), 'i');
  8131. re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), 'i');
  8132. re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'i');
  8133. re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), 'i');
  8134. //
  8135. // Compile each schema
  8136. //
  8137. var aliases = [];
  8138. self.__compiled__ = {}; // Reset compiled data
  8139. function schemaError(name, val) {
  8140. throw new Error('(LinkifyIt) Invalid schema "' + name + '": ' + val);
  8141. }
  8142. Object.keys(self.__schemas__).forEach(function (name) {
  8143. var val = self.__schemas__[name];
  8144. // skip disabled methods
  8145. if (val === null) { return; }
  8146. var compiled = { validate: null, link: null };
  8147. self.__compiled__[name] = compiled;
  8148. if (isObject(val)) {
  8149. if (isRegExp(val.validate)) {
  8150. compiled.validate = createValidator(val.validate);
  8151. } else if (isFunction(val.validate)) {
  8152. compiled.validate = val.validate;
  8153. } else {
  8154. schemaError(name, val);
  8155. }
  8156. if (isFunction(val.normalize)) {
  8157. compiled.normalize = val.normalize;
  8158. } else if (!val.normalize) {
  8159. compiled.normalize = createNormalizer();
  8160. } else {
  8161. schemaError(name, val);
  8162. }
  8163. return;
  8164. }
  8165. if (isString(val)) {
  8166. aliases.push(name);
  8167. return;
  8168. }
  8169. schemaError(name, val);
  8170. });
  8171. //
  8172. // Compile postponed aliases
  8173. //
  8174. aliases.forEach(function (alias) {
  8175. if (!self.__compiled__[self.__schemas__[alias]]) {
  8176. // Silently fail on missed schemas to avoid errons on disable.
  8177. // schemaError(alias, self.__schemas__[alias]);
  8178. return;
  8179. }
  8180. self.__compiled__[alias].validate =
  8181. self.__compiled__[self.__schemas__[alias]].validate;
  8182. self.__compiled__[alias].normalize =
  8183. self.__compiled__[self.__schemas__[alias]].normalize;
  8184. });
  8185. //
  8186. // Fake record for guessed links
  8187. //
  8188. self.__compiled__[''] = { validate: null, normalize: createNormalizer() };
  8189. //
  8190. // Build schema condition
  8191. //
  8192. var slist = Object.keys(self.__compiled__)
  8193. .filter(function (name) {
  8194. // Filter disabled & fake schemas
  8195. return name.length > 0 && self.__compiled__[name];
  8196. })
  8197. .map(escapeRE)
  8198. .join('|');
  8199. // (?!_) cause 1.5x slowdown
  8200. self.re.schema_test = RegExp('(^|(?!_)(?:[><\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'i');
  8201. self.re.schema_search = RegExp('(^|(?!_)(?:[><\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'ig');
  8202. self.re.pretest = RegExp(
  8203. '(' + self.re.schema_test.source + ')|' +
  8204. '(' + self.re.host_fuzzy_test.source + ')|' +
  8205. '@',
  8206. 'i');
  8207. //
  8208. // Cleanup
  8209. //
  8210. resetScanCache(self);
  8211. }
  8212. /**
  8213. * class Match
  8214. *
  8215. * Match result. Single element of array, returned by [[LinkifyIt#match]]
  8216. **/
  8217. function Match(self, shift) {
  8218. var start = self.__index__,
  8219. end = self.__last_index__,
  8220. text = self.__text_cache__.slice(start, end);
  8221. /**
  8222. * Match#schema -> String
  8223. *
  8224. * Prefix (protocol) for matched string.
  8225. **/
  8226. this.schema = self.__schema__.toLowerCase();
  8227. /**
  8228. * Match#index -> Number
  8229. *
  8230. * First position of matched string.
  8231. **/
  8232. this.index = start + shift;
  8233. /**
  8234. * Match#lastIndex -> Number
  8235. *
  8236. * Next position after matched string.
  8237. **/
  8238. this.lastIndex = end + shift;
  8239. /**
  8240. * Match#raw -> String
  8241. *
  8242. * Matched string.
  8243. **/
  8244. this.raw = text;
  8245. /**
  8246. * Match#text -> String
  8247. *
  8248. * Notmalized text of matched string.
  8249. **/
  8250. this.text = text;
  8251. /**
  8252. * Match#url -> String
  8253. *
  8254. * Normalized url of matched string.
  8255. **/
  8256. this.url = text;
  8257. }
  8258. function createMatch(self, shift) {
  8259. var match = new Match(self, shift);
  8260. self.__compiled__[match.schema].normalize(match, self);
  8261. return match;
  8262. }
  8263. /**
  8264. * class LinkifyIt
  8265. **/
  8266. /**
  8267. * new LinkifyIt(schemas, options)
  8268. * - schemas (Object): Optional. Additional schemas to validate (prefix/validator)
  8269. * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }
  8270. *
  8271. * Creates new linkifier instance with optional additional schemas.
  8272. * Can be called without `new` keyword for convenience.
  8273. *
  8274. * By default understands:
  8275. *
  8276. * - `http(s)://...` , `ftp://...`, `mailto:...` & `//...` links
  8277. * - "fuzzy" links and emails (example.com, foo@bar.com).
  8278. *
  8279. * `schemas` is an object, where each key/value describes protocol/rule:
  8280. *
  8281. * - __key__ - link prefix (usually, protocol name with `:` at the end, `skype:`
  8282. * for example). `linkify-it` makes shure that prefix is not preceeded with
  8283. * alphanumeric char and symbols. Only whitespaces and punctuation allowed.
  8284. * - __value__ - rule to check tail after link prefix
  8285. * - _String_ - just alias to existing rule
  8286. * - _Object_
  8287. * - _validate_ - validator function (should return matched length on success),
  8288. * or `RegExp`.
  8289. * - _normalize_ - optional function to normalize text & url of matched result
  8290. * (for example, for @twitter mentions).
  8291. *
  8292. * `options`:
  8293. *
  8294. * - __fuzzyLink__ - recognige URL-s without `http(s):` prefix. Default `true`.
  8295. * - __fuzzyIP__ - allow IPs in fuzzy links above. Can conflict with some texts
  8296. * like version numbers. Default `false`.
  8297. * - __fuzzyEmail__ - recognize emails without `mailto:` prefix.
  8298. *
  8299. **/
  8300. function LinkifyIt(schemas, options) {
  8301. if (!(this instanceof LinkifyIt)) {
  8302. return new LinkifyIt(schemas, options);
  8303. }
  8304. if (!options) {
  8305. if (isOptionsObj(schemas)) {
  8306. options = schemas;
  8307. schemas = {};
  8308. }
  8309. }
  8310. this.__opts__ = assign({}, defaultOptions, options);
  8311. // Cache last tested result. Used to skip repeating steps on next `match` call.
  8312. this.__index__ = -1;
  8313. this.__last_index__ = -1; // Next scan position
  8314. this.__schema__ = '';
  8315. this.__text_cache__ = '';
  8316. this.__schemas__ = assign({}, defaultSchemas, schemas);
  8317. this.__compiled__ = {};
  8318. this.__tlds__ = tlds_default;
  8319. this.__tlds_replaced__ = false;
  8320. this.re = {};
  8321. compile(this);
  8322. }
  8323. /** chainable
  8324. * LinkifyIt#add(schema, definition)
  8325. * - schema (String): rule name (fixed pattern prefix)
  8326. * - definition (String|RegExp|Object): schema definition
  8327. *
  8328. * Add new rule definition. See constructor description for details.
  8329. **/
  8330. LinkifyIt.prototype.add = function add(schema, definition) {
  8331. this.__schemas__[schema] = definition;
  8332. compile(this);
  8333. return this;
  8334. };
  8335. /** chainable
  8336. * LinkifyIt#set(options)
  8337. * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }
  8338. *
  8339. * Set recognition options for links without schema.
  8340. **/
  8341. LinkifyIt.prototype.set = function set(options) {
  8342. this.__opts__ = assign(this.__opts__, options);
  8343. return this;
  8344. };
  8345. /**
  8346. * LinkifyIt#test(text) -> Boolean
  8347. *
  8348. * Searches linkifiable pattern and returns `true` on success or `false` on fail.
  8349. **/
  8350. LinkifyIt.prototype.test = function test(text) {
  8351. // Reset scan cache
  8352. this.__text_cache__ = text;
  8353. this.__index__ = -1;
  8354. if (!text.length) { return false; }
  8355. var m, ml, me, len, shift, next, re, tld_pos, at_pos;
  8356. // try to scan for link with schema - that's the most simple rule
  8357. if (this.re.schema_test.test(text)) {
  8358. re = this.re.schema_search;
  8359. re.lastIndex = 0;
  8360. while ((m = re.exec(text)) !== null) {
  8361. len = this.testSchemaAt(text, m[2], re.lastIndex);
  8362. if (len) {
  8363. this.__schema__ = m[2];
  8364. this.__index__ = m.index + m[1].length;
  8365. this.__last_index__ = m.index + m[0].length + len;
  8366. break;
  8367. }
  8368. }
  8369. }
  8370. if (this.__opts__.fuzzyLink && this.__compiled__['http:']) {
  8371. // guess schemaless links
  8372. tld_pos = text.search(this.re.host_fuzzy_test);
  8373. if (tld_pos >= 0) {
  8374. // if tld is located after found link - no need to check fuzzy pattern
  8375. if (this.__index__ < 0 || tld_pos < this.__index__) {
  8376. if ((ml = text.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) !== null) {
  8377. shift = ml.index + ml[1].length;
  8378. if (this.__index__ < 0 || shift < this.__index__) {
  8379. this.__schema__ = '';
  8380. this.__index__ = shift;
  8381. this.__last_index__ = ml.index + ml[0].length;
  8382. }
  8383. }
  8384. }
  8385. }
  8386. }
  8387. if (this.__opts__.fuzzyEmail && this.__compiled__['mailto:']) {
  8388. // guess schemaless emails
  8389. at_pos = text.indexOf('@');
  8390. if (at_pos >= 0) {
  8391. // We can't skip this check, because this cases are possible:
  8392. // 192.168.1.1@gmail.com, my.in@example.com
  8393. if ((me = text.match(this.re.email_fuzzy)) !== null) {
  8394. shift = me.index + me[1].length;
  8395. next = me.index + me[0].length;
  8396. if (this.__index__ < 0 || shift < this.__index__ ||
  8397. (shift === this.__index__ && next > this.__last_index__)) {
  8398. this.__schema__ = 'mailto:';
  8399. this.__index__ = shift;
  8400. this.__last_index__ = next;
  8401. }
  8402. }
  8403. }
  8404. }
  8405. return this.__index__ >= 0;
  8406. };
  8407. /**
  8408. * LinkifyIt#pretest(text) -> Boolean
  8409. *
  8410. * Very quick check, that can give false positives. Returns true if link MAY BE
  8411. * can exists. Can be used for speed optimization, when you need to check that
  8412. * link NOT exists.
  8413. **/
  8414. LinkifyIt.prototype.pretest = function pretest(text) {
  8415. return this.re.pretest.test(text);
  8416. };
  8417. /**
  8418. * LinkifyIt#testSchemaAt(text, name, position) -> Number
  8419. * - text (String): text to scan
  8420. * - name (String): rule (schema) name
  8421. * - position (Number): text offset to check from
  8422. *
  8423. * Similar to [[LinkifyIt#test]] but checks only specific protocol tail exactly
  8424. * at given position. Returns length of found pattern (0 on fail).
  8425. **/
  8426. LinkifyIt.prototype.testSchemaAt = function testSchemaAt(text, schema, pos) {
  8427. // If not supported schema check requested - terminate
  8428. if (!this.__compiled__[schema.toLowerCase()]) {
  8429. return 0;
  8430. }
  8431. return this.__compiled__[schema.toLowerCase()].validate(text, pos, this);
  8432. };
  8433. /**
  8434. * LinkifyIt#match(text) -> Array|null
  8435. *
  8436. * Returns array of found link descriptions or `null` on fail. We strongly
  8437. * recommend to use [[LinkifyIt#test]] first, for best speed.
  8438. *
  8439. * ##### Result match description
  8440. *
  8441. * - __schema__ - link schema, can be empty for fuzzy links, or `//` for
  8442. * protocol-neutral links.
  8443. * - __index__ - offset of matched text
  8444. * - __lastIndex__ - index of next char after mathch end
  8445. * - __raw__ - matched text
  8446. * - __text__ - normalized text
  8447. * - __url__ - link, generated from matched text
  8448. **/
  8449. LinkifyIt.prototype.match = function match(text) {
  8450. var shift = 0, result = [];
  8451. // Try to take previous element from cache, if .test() called before
  8452. if (this.__index__ >= 0 && this.__text_cache__ === text) {
  8453. result.push(createMatch(this, shift));
  8454. shift = this.__last_index__;
  8455. }
  8456. // Cut head if cache was used
  8457. var tail = shift ? text.slice(shift) : text;
  8458. // Scan string until end reached
  8459. while (this.test(tail)) {
  8460. result.push(createMatch(this, shift));
  8461. tail = tail.slice(this.__last_index__);
  8462. shift += this.__last_index__;
  8463. }
  8464. if (result.length) {
  8465. return result;
  8466. }
  8467. return null;
  8468. };
  8469. /** chainable
  8470. * LinkifyIt#tlds(list [, keepOld]) -> this
  8471. * - list (Array): list of tlds
  8472. * - keepOld (Boolean): merge with current list if `true` (`false` by default)
  8473. *
  8474. * Load (or merge) new tlds list. Those are user for fuzzy links (without prefix)
  8475. * to avoid false positives. By default this algorythm used:
  8476. *
  8477. * - hostname with any 2-letter root zones are ok.
  8478. * - biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф
  8479. * are ok.
  8480. * - encoded (`xn--...`) root zones are ok.
  8481. *
  8482. * If list is replaced, then exact match for 2-chars root zones will be checked.
  8483. **/
  8484. LinkifyIt.prototype.tlds = function tlds(list, keepOld) {
  8485. list = Array.isArray(list) ? list : [ list ];
  8486. if (!keepOld) {
  8487. this.__tlds__ = list.slice();
  8488. this.__tlds_replaced__ = true;
  8489. compile(this);
  8490. return this;
  8491. }
  8492. this.__tlds__ = this.__tlds__.concat(list)
  8493. .sort()
  8494. .filter(function (el, idx, arr) {
  8495. return el !== arr[idx - 1];
  8496. })
  8497. .reverse();
  8498. compile(this);
  8499. return this;
  8500. };
  8501. /**
  8502. * LinkifyIt#normalize(match)
  8503. *
  8504. * Default normalizer (if schema does not define it's own).
  8505. **/
  8506. LinkifyIt.prototype.normalize = function normalize(match) {
  8507. // Do minimal possible changes by default. Need to collect feedback prior
  8508. // to move forward https://github.com/markdown-it/linkify-it/issues/1
  8509. if (!match.schema) { match.url = 'http://' + match.url; }
  8510. if (match.schema === 'mailto:' && !/^mailto:/i.test(match.url)) {
  8511. match.url = 'mailto:' + match.url;
  8512. }
  8513. };
  8514. /**
  8515. * LinkifyIt#onCompile()
  8516. *
  8517. * Override to modify basic RegExp-s.
  8518. **/
  8519. LinkifyIt.prototype.onCompile = function onCompile() {
  8520. };
  8521. module.exports = LinkifyIt;
  8522. /***/ }),
  8523. /* 79 */
  8524. /***/ (function(module, exports, __webpack_require__) {
  8525. "use strict";
  8526. module.exports = function (opts) {
  8527. var re = {};
  8528. // Use direct extract instead of `regenerate` to reduse browserified size
  8529. re.src_Any = __webpack_require__(13).source;
  8530. re.src_Cc = __webpack_require__(14).source;
  8531. re.src_Z = __webpack_require__(15).source;
  8532. re.src_P = __webpack_require__(5).source;
  8533. // \p{\Z\P\Cc\CF} (white spaces + control + format + punctuation)
  8534. re.src_ZPCc = [ re.src_Z, re.src_P, re.src_Cc ].join('|');
  8535. // \p{\Z\Cc} (white spaces + control)
  8536. re.src_ZCc = [ re.src_Z, re.src_Cc ].join('|');
  8537. // Experimental. List of chars, completely prohibited in links
  8538. // because can separate it from other part of text
  8539. var text_separators = '[><\uff5c]';
  8540. // All possible word characters (everything without punctuation, spaces & controls)
  8541. // Defined via punctuation & spaces to save space
  8542. // Should be something like \p{\L\N\S\M} (\w but without `_`)
  8543. re.src_pseudo_letter = '(?:(?!' + text_separators + '|' + re.src_ZPCc + ')' + re.src_Any + ')';
  8544. // The same as abothe but without [0-9]
  8545. // var src_pseudo_letter_non_d = '(?:(?![0-9]|' + src_ZPCc + ')' + src_Any + ')';
  8546. ////////////////////////////////////////////////////////////////////////////////
  8547. re.src_ip4 =
  8548. '(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
  8549. // Prohibit any of "@/[]()" in user/pass to avoid wrong domain fetch.
  8550. re.src_auth = '(?:(?:(?!' + re.src_ZCc + '|[@/\\[\\]()]).)+@)?';
  8551. re.src_port =
  8552. '(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?';
  8553. re.src_host_terminator =
  8554. '(?=$|' + text_separators + '|' + re.src_ZPCc + ')(?!-|_|:\\d|\\.-|\\.(?!$|' + re.src_ZPCc + '))';
  8555. re.src_path =
  8556. '(?:' +
  8557. '[/?#]' +
  8558. '(?:' +
  8559. '(?!' + re.src_ZCc + '|' + text_separators + '|[()[\\]{}.,"\'?!\\-]).|' +
  8560. '\\[(?:(?!' + re.src_ZCc + '|\\]).)*\\]|' +
  8561. '\\((?:(?!' + re.src_ZCc + '|[)]).)*\\)|' +
  8562. '\\{(?:(?!' + re.src_ZCc + '|[}]).)*\\}|' +
  8563. '\\"(?:(?!' + re.src_ZCc + '|["]).)+\\"|' +
  8564. "\\'(?:(?!" + re.src_ZCc + "|[']).)+\\'|" +
  8565. "\\'(?=" + re.src_pseudo_letter + '|[-]).|' + // allow `I'm_king` if no pair found
  8566. '\\.{2,3}[a-zA-Z0-9%/]|' + // github has ... in commit range links. Restrict to
  8567. // - english
  8568. // - percent-encoded
  8569. // - parts of file path
  8570. // until more examples found.
  8571. '\\.(?!' + re.src_ZCc + '|[.]).|' +
  8572. (opts && opts['---'] ?
  8573. '\\-(?!--(?:[^-]|$))(?:-*)|' // `---` => long dash, terminate
  8574. :
  8575. '\\-+|'
  8576. ) +
  8577. '\\,(?!' + re.src_ZCc + ').|' + // allow `,,,` in paths
  8578. '\\!(?!' + re.src_ZCc + '|[!]).|' +
  8579. '\\?(?!' + re.src_ZCc + '|[?]).' +
  8580. ')+' +
  8581. '|\\/' +
  8582. ')?';
  8583. re.src_email_name =
  8584. '[\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]+';
  8585. re.src_xn =
  8586. 'xn--[a-z0-9\\-]{1,59}';
  8587. // More to read about domain names
  8588. // http://serverfault.com/questions/638260/
  8589. re.src_domain_root =
  8590. // Allow letters & digits (http://test1)
  8591. '(?:' +
  8592. re.src_xn +
  8593. '|' +
  8594. re.src_pseudo_letter + '{1,63}' +
  8595. ')';
  8596. re.src_domain =
  8597. '(?:' +
  8598. re.src_xn +
  8599. '|' +
  8600. '(?:' + re.src_pseudo_letter + ')' +
  8601. '|' +
  8602. // don't allow `--` in domain names, because:
  8603. // - that can conflict with markdown &mdash; / &ndash;
  8604. // - nobody use those anyway
  8605. '(?:' + re.src_pseudo_letter + '(?:-(?!-)|' + re.src_pseudo_letter + '){0,61}' + re.src_pseudo_letter + ')' +
  8606. ')';
  8607. re.src_host =
  8608. '(?:' +
  8609. // Don't need IP check, because digits are already allowed in normal domain names
  8610. // src_ip4 +
  8611. // '|' +
  8612. '(?:(?:(?:' + re.src_domain + ')\\.)*' + re.src_domain/*_root*/ + ')' +
  8613. ')';
  8614. re.tpl_host_fuzzy =
  8615. '(?:' +
  8616. re.src_ip4 +
  8617. '|' +
  8618. '(?:(?:(?:' + re.src_domain + ')\\.)+(?:%TLDS%))' +
  8619. ')';
  8620. re.tpl_host_no_ip_fuzzy =
  8621. '(?:(?:(?:' + re.src_domain + ')\\.)+(?:%TLDS%))';
  8622. re.src_host_strict =
  8623. re.src_host + re.src_host_terminator;
  8624. re.tpl_host_fuzzy_strict =
  8625. re.tpl_host_fuzzy + re.src_host_terminator;
  8626. re.src_host_port_strict =
  8627. re.src_host + re.src_port + re.src_host_terminator;
  8628. re.tpl_host_port_fuzzy_strict =
  8629. re.tpl_host_fuzzy + re.src_port + re.src_host_terminator;
  8630. re.tpl_host_port_no_ip_fuzzy_strict =
  8631. re.tpl_host_no_ip_fuzzy + re.src_port + re.src_host_terminator;
  8632. ////////////////////////////////////////////////////////////////////////////////
  8633. // Main rules
  8634. // Rude test fuzzy links by host, for quick deny
  8635. re.tpl_host_fuzzy_test =
  8636. 'localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:' + re.src_ZPCc + '|>|$))';
  8637. re.tpl_email_fuzzy =
  8638. '(^|' + text_separators + '|\\(|' + re.src_ZCc + ')(' + re.src_email_name + '@' + re.tpl_host_fuzzy_strict + ')';
  8639. re.tpl_link_fuzzy =
  8640. // Fuzzy link can't be prepended with .:/\- and non punctuation.
  8641. // but can start with > (markdown blockquote)
  8642. '(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|' + re.src_ZPCc + '))' +
  8643. '((?![$+<=>^`|\uff5c])' + re.tpl_host_port_fuzzy_strict + re.src_path + ')';
  8644. re.tpl_link_no_ip_fuzzy =
  8645. // Fuzzy link can't be prepended with .:/\- and non punctuation.
  8646. // but can start with > (markdown blockquote)
  8647. '(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|' + re.src_ZPCc + '))' +
  8648. '((?![$+<=>^`|\uff5c])' + re.tpl_host_port_no_ip_fuzzy_strict + re.src_path + ')';
  8649. return re;
  8650. };
  8651. /***/ }),
  8652. /* 80 */
  8653. /***/ (function(module, exports, __webpack_require__) {
  8654. /* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.4.1 by @mathias */
  8655. ;(function(root) {
  8656. /** Detect free variables */
  8657. var freeExports = typeof exports == 'object' && exports &&
  8658. !exports.nodeType && exports;
  8659. var freeModule = typeof module == 'object' && module &&
  8660. !module.nodeType && module;
  8661. var freeGlobal = typeof global == 'object' && global;
  8662. if (
  8663. freeGlobal.global === freeGlobal ||
  8664. freeGlobal.window === freeGlobal ||
  8665. freeGlobal.self === freeGlobal
  8666. ) {
  8667. root = freeGlobal;
  8668. }
  8669. /**
  8670. * The `punycode` object.
  8671. * @name punycode
  8672. * @type Object
  8673. */
  8674. var punycode,
  8675. /** Highest positive signed 32-bit float value */
  8676. maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
  8677. /** Bootstring parameters */
  8678. base = 36,
  8679. tMin = 1,
  8680. tMax = 26,
  8681. skew = 38,
  8682. damp = 700,
  8683. initialBias = 72,
  8684. initialN = 128, // 0x80
  8685. delimiter = '-', // '\x2D'
  8686. /** Regular expressions */
  8687. regexPunycode = /^xn--/,
  8688. regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
  8689. regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
  8690. /** Error messages */
  8691. errors = {
  8692. 'overflow': 'Overflow: input needs wider integers to process',
  8693. 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
  8694. 'invalid-input': 'Invalid input'
  8695. },
  8696. /** Convenience shortcuts */
  8697. baseMinusTMin = base - tMin,
  8698. floor = Math.floor,
  8699. stringFromCharCode = String.fromCharCode,
  8700. /** Temporary variable */
  8701. key;
  8702. /*--------------------------------------------------------------------------*/
  8703. /**
  8704. * A generic error utility function.
  8705. * @private
  8706. * @param {String} type The error type.
  8707. * @returns {Error} Throws a `RangeError` with the applicable error message.
  8708. */
  8709. function error(type) {
  8710. throw new RangeError(errors[type]);
  8711. }
  8712. /**
  8713. * A generic `Array#map` utility function.
  8714. * @private
  8715. * @param {Array} array The array to iterate over.
  8716. * @param {Function} callback The function that gets called for every array
  8717. * item.
  8718. * @returns {Array} A new array of values returned by the callback function.
  8719. */
  8720. function map(array, fn) {
  8721. var length = array.length;
  8722. var result = [];
  8723. while (length--) {
  8724. result[length] = fn(array[length]);
  8725. }
  8726. return result;
  8727. }
  8728. /**
  8729. * A simple `Array#map`-like wrapper to work with domain name strings or email
  8730. * addresses.
  8731. * @private
  8732. * @param {String} domain The domain name or email address.
  8733. * @param {Function} callback The function that gets called for every
  8734. * character.
  8735. * @returns {Array} A new string of characters returned by the callback
  8736. * function.
  8737. */
  8738. function mapDomain(string, fn) {
  8739. var parts = string.split('@');
  8740. var result = '';
  8741. if (parts.length > 1) {
  8742. // In email addresses, only the domain name should be punycoded. Leave
  8743. // the local part (i.e. everything up to `@`) intact.
  8744. result = parts[0] + '@';
  8745. string = parts[1];
  8746. }
  8747. // Avoid `split(regex)` for IE8 compatibility. See #17.
  8748. string = string.replace(regexSeparators, '\x2E');
  8749. var labels = string.split('.');
  8750. var encoded = map(labels, fn).join('.');
  8751. return result + encoded;
  8752. }
  8753. /**
  8754. * Creates an array containing the numeric code points of each Unicode
  8755. * character in the string. While JavaScript uses UCS-2 internally,
  8756. * this function will convert a pair of surrogate halves (each of which
  8757. * UCS-2 exposes as separate characters) into a single code point,
  8758. * matching UTF-16.
  8759. * @see `punycode.ucs2.encode`
  8760. * @see <https://mathiasbynens.be/notes/javascript-encoding>
  8761. * @memberOf punycode.ucs2
  8762. * @name decode
  8763. * @param {String} string The Unicode input string (UCS-2).
  8764. * @returns {Array} The new array of code points.
  8765. */
  8766. function ucs2decode(string) {
  8767. var output = [],
  8768. counter = 0,
  8769. length = string.length,
  8770. value,
  8771. extra;
  8772. while (counter < length) {
  8773. value = string.charCodeAt(counter++);
  8774. if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
  8775. // high surrogate, and there is a next character
  8776. extra = string.charCodeAt(counter++);
  8777. if ((extra & 0xFC00) == 0xDC00) { // low surrogate
  8778. output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
  8779. } else {
  8780. // unmatched surrogate; only append this code unit, in case the next
  8781. // code unit is the high surrogate of a surrogate pair
  8782. output.push(value);
  8783. counter--;
  8784. }
  8785. } else {
  8786. output.push(value);
  8787. }
  8788. }
  8789. return output;
  8790. }
  8791. /**
  8792. * Creates a string based on an array of numeric code points.
  8793. * @see `punycode.ucs2.decode`
  8794. * @memberOf punycode.ucs2
  8795. * @name encode
  8796. * @param {Array} codePoints The array of numeric code points.
  8797. * @returns {String} The new Unicode string (UCS-2).
  8798. */
  8799. function ucs2encode(array) {
  8800. return map(array, function(value) {
  8801. var output = '';
  8802. if (value > 0xFFFF) {
  8803. value -= 0x10000;
  8804. output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
  8805. value = 0xDC00 | value & 0x3FF;
  8806. }
  8807. output += stringFromCharCode(value);
  8808. return output;
  8809. }).join('');
  8810. }
  8811. /**
  8812. * Converts a basic code point into a digit/integer.
  8813. * @see `digitToBasic()`
  8814. * @private
  8815. * @param {Number} codePoint The basic numeric code point value.
  8816. * @returns {Number} The numeric value of a basic code point (for use in
  8817. * representing integers) in the range `0` to `base - 1`, or `base` if
  8818. * the code point does not represent a value.
  8819. */
  8820. function basicToDigit(codePoint) {
  8821. if (codePoint - 48 < 10) {
  8822. return codePoint - 22;
  8823. }
  8824. if (codePoint - 65 < 26) {
  8825. return codePoint - 65;
  8826. }
  8827. if (codePoint - 97 < 26) {
  8828. return codePoint - 97;
  8829. }
  8830. return base;
  8831. }
  8832. /**
  8833. * Converts a digit/integer into a basic code point.
  8834. * @see `basicToDigit()`
  8835. * @private
  8836. * @param {Number} digit The numeric value of a basic code point.
  8837. * @returns {Number} The basic code point whose value (when used for
  8838. * representing integers) is `digit`, which needs to be in the range
  8839. * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
  8840. * used; else, the lowercase form is used. The behavior is undefined
  8841. * if `flag` is non-zero and `digit` has no uppercase form.
  8842. */
  8843. function digitToBasic(digit, flag) {
  8844. // 0..25 map to ASCII a..z or A..Z
  8845. // 26..35 map to ASCII 0..9
  8846. return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
  8847. }
  8848. /**
  8849. * Bias adaptation function as per section 3.4 of RFC 3492.
  8850. * https://tools.ietf.org/html/rfc3492#section-3.4
  8851. * @private
  8852. */
  8853. function adapt(delta, numPoints, firstTime) {
  8854. var k = 0;
  8855. delta = firstTime ? floor(delta / damp) : delta >> 1;
  8856. delta += floor(delta / numPoints);
  8857. for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
  8858. delta = floor(delta / baseMinusTMin);
  8859. }
  8860. return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
  8861. }
  8862. /**
  8863. * Converts a Punycode string of ASCII-only symbols to a string of Unicode
  8864. * symbols.
  8865. * @memberOf punycode
  8866. * @param {String} input The Punycode string of ASCII-only symbols.
  8867. * @returns {String} The resulting string of Unicode symbols.
  8868. */
  8869. function decode(input) {
  8870. // Don't use UCS-2
  8871. var output = [],
  8872. inputLength = input.length,
  8873. out,
  8874. i = 0,
  8875. n = initialN,
  8876. bias = initialBias,
  8877. basic,
  8878. j,
  8879. index,
  8880. oldi,
  8881. w,
  8882. k,
  8883. digit,
  8884. t,
  8885. /** Cached calculation results */
  8886. baseMinusT;
  8887. // Handle the basic code points: let `basic` be the number of input code
  8888. // points before the last delimiter, or `0` if there is none, then copy
  8889. // the first basic code points to the output.
  8890. basic = input.lastIndexOf(delimiter);
  8891. if (basic < 0) {
  8892. basic = 0;
  8893. }
  8894. for (j = 0; j < basic; ++j) {
  8895. // if it's not a basic code point
  8896. if (input.charCodeAt(j) >= 0x80) {
  8897. error('not-basic');
  8898. }
  8899. output.push(input.charCodeAt(j));
  8900. }
  8901. // Main decoding loop: start just after the last delimiter if any basic code
  8902. // points were copied; start at the beginning otherwise.
  8903. for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
  8904. // `index` is the index of the next character to be consumed.
  8905. // Decode a generalized variable-length integer into `delta`,
  8906. // which gets added to `i`. The overflow checking is easier
  8907. // if we increase `i` as we go, then subtract off its starting
  8908. // value at the end to obtain `delta`.
  8909. for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
  8910. if (index >= inputLength) {
  8911. error('invalid-input');
  8912. }
  8913. digit = basicToDigit(input.charCodeAt(index++));
  8914. if (digit >= base || digit > floor((maxInt - i) / w)) {
  8915. error('overflow');
  8916. }
  8917. i += digit * w;
  8918. t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
  8919. if (digit < t) {
  8920. break;
  8921. }
  8922. baseMinusT = base - t;
  8923. if (w > floor(maxInt / baseMinusT)) {
  8924. error('overflow');
  8925. }
  8926. w *= baseMinusT;
  8927. }
  8928. out = output.length + 1;
  8929. bias = adapt(i - oldi, out, oldi == 0);
  8930. // `i` was supposed to wrap around from `out` to `0`,
  8931. // incrementing `n` each time, so we'll fix that now:
  8932. if (floor(i / out) > maxInt - n) {
  8933. error('overflow');
  8934. }
  8935. n += floor(i / out);
  8936. i %= out;
  8937. // Insert `n` at position `i` of the output
  8938. output.splice(i++, 0, n);
  8939. }
  8940. return ucs2encode(output);
  8941. }
  8942. /**
  8943. * Converts a string of Unicode symbols (e.g. a domain name label) to a
  8944. * Punycode string of ASCII-only symbols.
  8945. * @memberOf punycode
  8946. * @param {String} input The string of Unicode symbols.
  8947. * @returns {String} The resulting Punycode string of ASCII-only symbols.
  8948. */
  8949. function encode(input) {
  8950. var n,
  8951. delta,
  8952. handledCPCount,
  8953. basicLength,
  8954. bias,
  8955. j,
  8956. m,
  8957. q,
  8958. k,
  8959. t,
  8960. currentValue,
  8961. output = [],
  8962. /** `inputLength` will hold the number of code points in `input`. */
  8963. inputLength,
  8964. /** Cached calculation results */
  8965. handledCPCountPlusOne,
  8966. baseMinusT,
  8967. qMinusT;
  8968. // Convert the input in UCS-2 to Unicode
  8969. input = ucs2decode(input);
  8970. // Cache the length
  8971. inputLength = input.length;
  8972. // Initialize the state
  8973. n = initialN;
  8974. delta = 0;
  8975. bias = initialBias;
  8976. // Handle the basic code points
  8977. for (j = 0; j < inputLength; ++j) {
  8978. currentValue = input[j];
  8979. if (currentValue < 0x80) {
  8980. output.push(stringFromCharCode(currentValue));
  8981. }
  8982. }
  8983. handledCPCount = basicLength = output.length;
  8984. // `handledCPCount` is the number of code points that have been handled;
  8985. // `basicLength` is the number of basic code points.
  8986. // Finish the basic string - if it is not empty - with a delimiter
  8987. if (basicLength) {
  8988. output.push(delimiter);
  8989. }
  8990. // Main encoding loop:
  8991. while (handledCPCount < inputLength) {
  8992. // All non-basic code points < n have been handled already. Find the next
  8993. // larger one:
  8994. for (m = maxInt, j = 0; j < inputLength; ++j) {
  8995. currentValue = input[j];
  8996. if (currentValue >= n && currentValue < m) {
  8997. m = currentValue;
  8998. }
  8999. }
  9000. // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
  9001. // but guard against overflow
  9002. handledCPCountPlusOne = handledCPCount + 1;
  9003. if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
  9004. error('overflow');
  9005. }
  9006. delta += (m - n) * handledCPCountPlusOne;
  9007. n = m;
  9008. for (j = 0; j < inputLength; ++j) {
  9009. currentValue = input[j];
  9010. if (currentValue < n && ++delta > maxInt) {
  9011. error('overflow');
  9012. }
  9013. if (currentValue == n) {
  9014. // Represent delta as a generalized variable-length integer
  9015. for (q = delta, k = base; /* no condition */; k += base) {
  9016. t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
  9017. if (q < t) {
  9018. break;
  9019. }
  9020. qMinusT = q - t;
  9021. baseMinusT = base - t;
  9022. output.push(
  9023. stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
  9024. );
  9025. q = floor(qMinusT / baseMinusT);
  9026. }
  9027. output.push(stringFromCharCode(digitToBasic(q, 0)));
  9028. bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
  9029. delta = 0;
  9030. ++handledCPCount;
  9031. }
  9032. }
  9033. ++delta;
  9034. ++n;
  9035. }
  9036. return output.join('');
  9037. }
  9038. /**
  9039. * Converts a Punycode string representing a domain name or an email address
  9040. * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
  9041. * it doesn't matter if you call it on a string that has already been
  9042. * converted to Unicode.
  9043. * @memberOf punycode
  9044. * @param {String} input The Punycoded domain name or email address to
  9045. * convert to Unicode.
  9046. * @returns {String} The Unicode representation of the given Punycode
  9047. * string.
  9048. */
  9049. function toUnicode(input) {
  9050. return mapDomain(input, function(string) {
  9051. return regexPunycode.test(string)
  9052. ? decode(string.slice(4).toLowerCase())
  9053. : string;
  9054. });
  9055. }
  9056. /**
  9057. * Converts a Unicode string representing a domain name or an email address to
  9058. * Punycode. Only the non-ASCII parts of the domain name will be converted,
  9059. * i.e. it doesn't matter if you call it with a domain that's already in
  9060. * ASCII.
  9061. * @memberOf punycode
  9062. * @param {String} input The domain name or email address to convert, as a
  9063. * Unicode string.
  9064. * @returns {String} The Punycode representation of the given domain name or
  9065. * email address.
  9066. */
  9067. function toASCII(input) {
  9068. return mapDomain(input, function(string) {
  9069. return regexNonASCII.test(string)
  9070. ? 'xn--' + encode(string)
  9071. : string;
  9072. });
  9073. }
  9074. /*--------------------------------------------------------------------------*/
  9075. /** Define the public API */
  9076. punycode = {
  9077. /**
  9078. * A string representing the current Punycode.js version number.
  9079. * @memberOf punycode
  9080. * @type String
  9081. */
  9082. 'version': '1.4.1',
  9083. /**
  9084. * An object of methods to convert from JavaScript's internal character
  9085. * representation (UCS-2) to Unicode code points, and back.
  9086. * @see <https://mathiasbynens.be/notes/javascript-encoding>
  9087. * @memberOf punycode
  9088. * @type Object
  9089. */
  9090. 'ucs2': {
  9091. 'decode': ucs2decode,
  9092. 'encode': ucs2encode
  9093. },
  9094. 'decode': decode,
  9095. 'encode': encode,
  9096. 'toASCII': toASCII,
  9097. 'toUnicode': toUnicode
  9098. };
  9099. /** Expose `punycode` */
  9100. // Some AMD build optimizers, like r.js, check for specific condition patterns
  9101. // like the following:
  9102. if (
  9103. true
  9104. ) {
  9105. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  9106. return punycode;
  9107. }).call(exports, __webpack_require__, exports, module),
  9108. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  9109. } else if (freeExports && freeModule) {
  9110. if (module.exports == freeExports) {
  9111. // in Node.js, io.js, or RingoJS v0.8.0+
  9112. freeModule.exports = punycode;
  9113. } else {
  9114. // in Narwhal or RingoJS v0.7.0-
  9115. for (key in punycode) {
  9116. punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
  9117. }
  9118. }
  9119. } else {
  9120. // in Rhino or a web browser
  9121. root.punycode = punycode;
  9122. }
  9123. }(this));
  9124. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(81)(module), __webpack_require__(2)))
  9125. /***/ }),
  9126. /* 81 */
  9127. /***/ (function(module, exports) {
  9128. module.exports = function(module) {
  9129. if(!module.webpackPolyfill) {
  9130. module.deprecate = function() {};
  9131. module.paths = [];
  9132. // module.parent = undefined by default
  9133. if(!module.children) module.children = [];
  9134. Object.defineProperty(module, "loaded", {
  9135. enumerable: true,
  9136. get: function() {
  9137. return module.l;
  9138. }
  9139. });
  9140. Object.defineProperty(module, "id", {
  9141. enumerable: true,
  9142. get: function() {
  9143. return module.i;
  9144. }
  9145. });
  9146. module.webpackPolyfill = 1;
  9147. }
  9148. return module;
  9149. };
  9150. /***/ }),
  9151. /* 82 */
  9152. /***/ (function(module, exports, __webpack_require__) {
  9153. "use strict";
  9154. // markdown-it default options
  9155. module.exports = {
  9156. options: {
  9157. html: false, // Enable HTML tags in source
  9158. xhtmlOut: false, // Use '/' to close single tags (<br />)
  9159. breaks: false, // Convert '\n' in paragraphs into <br>
  9160. langPrefix: 'language-', // CSS language prefix for fenced blocks
  9161. linkify: false, // autoconvert URL-like texts to links
  9162. // Enable some language-neutral replacements + quotes beautification
  9163. typographer: false,
  9164. // Double + single quotes replacement pairs, when typographer enabled,
  9165. // and smartquotes on. Could be either a String or an Array.
  9166. //
  9167. // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
  9168. // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
  9169. quotes: '\u201c\u201d\u2018\u2019', /* “”‘’ */
  9170. // Highlighter function. Should return escaped HTML,
  9171. // or '' if the source string is not changed and should be escaped externaly.
  9172. // If result starts with <pre... internal wrapper is skipped.
  9173. //
  9174. // function (/*str, lang*/) { return ''; }
  9175. //
  9176. highlight: null,
  9177. maxNesting: 100 // Internal protection, recursion limit
  9178. },
  9179. components: {
  9180. core: {},
  9181. block: {},
  9182. inline: {}
  9183. }
  9184. };
  9185. /***/ }),
  9186. /* 83 */
  9187. /***/ (function(module, exports, __webpack_require__) {
  9188. "use strict";
  9189. // "Zero" preset, with nothing enabled. Useful for manual configuring of simple
  9190. // modes. For example, to parse bold/italic only.
  9191. module.exports = {
  9192. options: {
  9193. html: false, // Enable HTML tags in source
  9194. xhtmlOut: false, // Use '/' to close single tags (<br />)
  9195. breaks: false, // Convert '\n' in paragraphs into <br>
  9196. langPrefix: 'language-', // CSS language prefix for fenced blocks
  9197. linkify: false, // autoconvert URL-like texts to links
  9198. // Enable some language-neutral replacements + quotes beautification
  9199. typographer: false,
  9200. // Double + single quotes replacement pairs, when typographer enabled,
  9201. // and smartquotes on. Could be either a String or an Array.
  9202. //
  9203. // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
  9204. // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
  9205. quotes: '\u201c\u201d\u2018\u2019', /* “”‘’ */
  9206. // Highlighter function. Should return escaped HTML,
  9207. // or '' if the source string is not changed and should be escaped externaly.
  9208. // If result starts with <pre... internal wrapper is skipped.
  9209. //
  9210. // function (/*str, lang*/) { return ''; }
  9211. //
  9212. highlight: null,
  9213. maxNesting: 20 // Internal protection, recursion limit
  9214. },
  9215. components: {
  9216. core: {
  9217. rules: [
  9218. 'normalize',
  9219. 'block',
  9220. 'inline'
  9221. ]
  9222. },
  9223. block: {
  9224. rules: [
  9225. 'paragraph'
  9226. ]
  9227. },
  9228. inline: {
  9229. rules: [
  9230. 'text'
  9231. ],
  9232. rules2: [
  9233. 'balance_pairs',
  9234. 'text_collapse'
  9235. ]
  9236. }
  9237. }
  9238. };
  9239. /***/ }),
  9240. /* 84 */
  9241. /***/ (function(module, exports, __webpack_require__) {
  9242. "use strict";
  9243. // Commonmark default options
  9244. module.exports = {
  9245. options: {
  9246. html: true, // Enable HTML tags in source
  9247. xhtmlOut: true, // Use '/' to close single tags (<br />)
  9248. breaks: false, // Convert '\n' in paragraphs into <br>
  9249. langPrefix: 'language-', // CSS language prefix for fenced blocks
  9250. linkify: false, // autoconvert URL-like texts to links
  9251. // Enable some language-neutral replacements + quotes beautification
  9252. typographer: false,
  9253. // Double + single quotes replacement pairs, when typographer enabled,
  9254. // and smartquotes on. Could be either a String or an Array.
  9255. //
  9256. // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
  9257. // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
  9258. quotes: '\u201c\u201d\u2018\u2019', /* “”‘’ */
  9259. // Highlighter function. Should return escaped HTML,
  9260. // or '' if the source string is not changed and should be escaped externaly.
  9261. // If result starts with <pre... internal wrapper is skipped.
  9262. //
  9263. // function (/*str, lang*/) { return ''; }
  9264. //
  9265. highlight: null,
  9266. maxNesting: 20 // Internal protection, recursion limit
  9267. },
  9268. components: {
  9269. core: {
  9270. rules: [
  9271. 'normalize',
  9272. 'block',
  9273. 'inline'
  9274. ]
  9275. },
  9276. block: {
  9277. rules: [
  9278. 'blockquote',
  9279. 'code',
  9280. 'fence',
  9281. 'heading',
  9282. 'hr',
  9283. 'html_block',
  9284. 'lheading',
  9285. 'list',
  9286. 'reference',
  9287. 'paragraph'
  9288. ]
  9289. },
  9290. inline: {
  9291. rules: [
  9292. 'autolink',
  9293. 'backticks',
  9294. 'emphasis',
  9295. 'entity',
  9296. 'escape',
  9297. 'html_inline',
  9298. 'image',
  9299. 'link',
  9300. 'newline',
  9301. 'text'
  9302. ],
  9303. rules2: [
  9304. 'balance_pairs',
  9305. 'emphasis',
  9306. 'text_collapse'
  9307. ]
  9308. }
  9309. }
  9310. };
  9311. /***/ }),
  9312. /* 85 */
  9313. /***/ (function(module, exports, __webpack_require__) {
  9314. var m = __webpack_require__(1);
  9315. // https://github.com/markdown-it/markdown-it
  9316. var markdown = __webpack_require__(4)()
  9317. .use(__webpack_require__(8));
  9318. var _dbs = __webpack_require__(3);
  9319. // var _Header = require('./header');
  9320. // var _Footer = require('./footer');
  9321. var _Ui = __webpack_require__(20);
  9322. // __ _ __
  9323. // / / (_)___ / /__
  9324. // / / / / __ \/ //_/
  9325. // / /___/ / / / / ,<
  9326. // /_____/_/_/ /_/_/|_|
  9327. var _Link = {
  9328. parent_id:null,
  9329. tid:"",
  9330. opened:false,
  9331. oninit(vn){
  9332. // console.log("INIT LINK : vn", vn);
  9333. // define target id
  9334. this.tid = vn.attrs.href;
  9335. },
  9336. onbeforeupdate(vn){
  9337. this.tid = vn.attrs.href;
  9338. },
  9339. view(vn){
  9340. this.tid_known = typeof _dbs.data_byid[_dbs.lang][this.tid] === 'undefined' ? false : true;
  9341. if (!this.tid_known) {
  9342. // console.log(`!! in ${this.id}, target id ${this.tid} is unkonwn !!`);
  9343. }
  9344. if(this.opened && this.tid_known){
  9345. // console.log('this.tid', vn.state);
  9346. // traget object
  9347. this.tob = Object.assign({"nested":true},_dbs.data_byid[_dbs.lang][this.tid]);
  9348. return m('div', {'class':'opened-link'},
  9349. [
  9350. m('span', {'class':"link text"}, vn.children),
  9351. m('div', {
  9352. 'class':'close-link-btn',
  9353. onclick(e){
  9354. // e.preventDefault();
  9355. console.log('click close btn', this);
  9356. vn.state.opened = false;
  9357. // return false;
  9358. }
  9359. }, m('span', m.trust("&#128473;"))),
  9360. typeof _dbs.data_byid[_dbs.lang][this.tid].childs != "undefined"
  9361. ? m(_Enonce, this.tob)
  9362. : m(_Item, this.tob)
  9363. ]
  9364. );
  9365. }else{
  9366. // console.log(vn);
  9367. return m('a', {
  9368. 'class':'link',
  9369. 'href':'#'+this.tid,
  9370. 'rel':this.tid,
  9371. onclick(e){
  9372. e.preventDefault();
  9373. console.log('click', this);
  9374. vn.state.opened = true;
  9375. return false;
  9376. }
  9377. }, vn.children); // c'est quoi ce vn.children ?
  9378. }
  9379. }
  9380. }
  9381. // ______ __
  9382. // /_ __/__ _ __/ /_
  9383. // / / / _ \| |/_/ __/
  9384. // / / / __/> </ /_
  9385. // /_/ \___/_/|_|\__/
  9386. // recusive function to record information of all subnodes
  9387. function parseTextDom(nodes){
  9388. var list = [];
  9389. // loop through childNodes
  9390. for (var i = 0; i < nodes.length; i++) {
  9391. var n = {};
  9392. if(typeof nodes[i].localName != "undefined"){
  9393. n.tag=nodes[i].localName;
  9394. if (n.tag == 'p') {
  9395. // replace p by div as we will insert other div in them
  9396. n.tag = 'div';
  9397. n.attrs = {'class':'paragraph'};
  9398. }
  9399. if (n.tag == 'a') {
  9400. // record the href attribute for cross reference
  9401. n.attrs = {'href':nodes[i].attributes.href.value};
  9402. }
  9403. if (n.tag == 'img') {
  9404. // record the href attribute for cross reference
  9405. n.attrs = {
  9406. 'src':nodes[i].attributes.src.value,
  9407. 'alt':nodes[i].attributes.alt.value
  9408. };
  9409. }
  9410. if(nodes[i].childNodes.length){
  9411. // again parse node's childs
  9412. n.childs = parseTextDom(nodes[i].childNodes);
  9413. }
  9414. }else if (nodes[i].textContent.length > 0){
  9415. // if node has no localName it is probably a #text node
  9416. // we record it if it's not empty
  9417. n.tag='#text';
  9418. n.text=nodes[i].textContent;
  9419. }
  9420. // add the node to the list if it has a tag
  9421. if(typeof n.tag != "undefined")
  9422. list.push(n);
  9423. }
  9424. return list;
  9425. }
  9426. // recusive fucntion to generate mithril object from information recorded with parseTextDom()
  9427. function populateTextDom(n,i){
  9428. // console.log('populateTextDom : '+i,n);
  9429. return n.tag == "#text"
  9430. ? m.trust(n.text)
  9431. : m(
  9432. n.tag != 'a' ? n.tag : _Link,
  9433. typeof n.attrs != "undefined" ? n.attrs : {},
  9434. typeof n.childs != "undefined"
  9435. ? n.childs.map(populateTextDom)
  9436. : typeof n.text != "undefined"
  9437. ? m.trust(n.text)
  9438. : null
  9439. );
  9440. }
  9441. var _Text = {
  9442. id:null,
  9443. text:"",
  9444. texthtml:"",
  9445. textdom:null,
  9446. textchilds:[],
  9447. parsetext(){
  9448. // console.log('parsetext', this);
  9449. // !! we need to convert markdown to html here because parseTextDom() is recursive through nodes tree
  9450. // convert markdown to html
  9451. this.texthtml = markdown.render(this.text)
  9452. // convert html string to virtual dom
  9453. this.textdom = new DOMParser().parseFromString(this.texthtml, "text/html");
  9454. // get the text nodes (avoid html document extra) and apply some transformations
  9455. this.textchilds = parseTextDom(this.textdom.getElementsByTagName('body')[0].childNodes);
  9456. },
  9457. oninit(vn){
  9458. this.id = vn.attrs.id;
  9459. this.text = vn.attrs.text || "";
  9460. this.parsetext();
  9461. },
  9462. onbeforeupdate(vn,old){
  9463. this.text = vn.attrs.text;
  9464. this.parsetext();
  9465. },
  9466. view(vn){
  9467. // console.log('_Text :: view : '+vn.attrs.slug, vn);
  9468. return m('div',
  9469. {'class':'text'},
  9470. // loop through childNodes list generated by parseTextDom() in init
  9471. this.textchilds.map(populateTextDom)
  9472. ); // /m.div.text
  9473. } // view:
  9474. }
  9475. // ______
  9476. // / _/ /____ ____ ___
  9477. // / // __/ _ \/ __ `__ \
  9478. // _/ // /_/ __/ / / / / /
  9479. // /___/\__/\___/_/ /_/ /_/
  9480. var _Item = {
  9481. id:null,
  9482. part:null,
  9483. type:null,
  9484. nested:false,
  9485. oninit(vn){
  9486. // console.log('vn.attrs', vn.attrs);
  9487. this.id = vn.attrs.id;
  9488. this.type = vn.attrs.type;
  9489. // vn.state.part = vn.state.slug.match(/^(\d)(.+)/)[1];
  9490. this.text = vn.attrs.text;
  9491. this.nested = vn.attrs.nested || false;
  9492. this.dottype = vn.attrs.dottype || null;
  9493. },
  9494. onbeforeupdate(vn, old){
  9495. this.nested = vn.attrs.nested || false;
  9496. this.type = vn.attrs.type;
  9497. this.text = vn.attrs.text;
  9498. },
  9499. view(vn){
  9500. // if(this.id == "340c2"){
  9501. // console.log(`${this.id} vn.attrs `,vn.attrs);
  9502. // }
  9503. return m("section", {
  9504. 'id':this.id,
  9505. // 'class':'item'+(this.nested ? ' nested':'')
  9506. 'class' :`item${this.nested ? ' nested':''} ${this.dottype}`
  9507. },
  9508. [
  9509. // create title node (only if not nested)
  9510. !this.nested
  9511. ? m("h3", {
  9512. // 'ref':vn.attrs.href,
  9513. // onclick(e){ WHAT IS THIS STATE ACTIVE ???
  9514. // vn.state.active = vn.state.active ? 0 : 1;
  9515. // }
  9516. }, m.trust(markdown.renderInline(this.type)))
  9517. : null,
  9518. // create text node
  9519. m(_Text, {'text':this.text, 'id':this.id}),
  9520. // add children (only if not nested)
  9521. // typeof vn.attrs.childs !== 'undefined' && !this.nested
  9522. // ? vn.attrs.childs.map(c => { return m(_Item, c); })
  9523. // : null
  9524. ]
  9525. )
  9526. }
  9527. };
  9528. // ______
  9529. // / ____/___ ____ ____ ________
  9530. // / __/ / __ \/ __ \/ __ \/ ___/ _ \
  9531. // / /___/ / / / /_/ / / / / /__/ __/
  9532. // /_____/_/ /_/\____/_/ /_/\___/\___/
  9533. var _Enonce = {
  9534. partid:null,
  9535. id:null,
  9536. title:null,
  9537. text:null,
  9538. nested:false,
  9539. childs:[],
  9540. oninit(vn){
  9541. // // console.log('Enonce on init', vn);
  9542. this.partid = vn.attrs.partid;
  9543. this.id = vn.attrs.id;
  9544. this.title = vn.attrs.title || "";
  9545. this.text = vn.attrs.text;
  9546. this.childs = vn.attrs.childs || [];
  9547. this.nested = vn.attrs.nested || false;
  9548. this.dottype = vn.attrs.dottype || "no-dottype";
  9549. },
  9550. onbeforeupdate(vn, old) {
  9551. // console.log(vn.attrs.childs);
  9552. this.title = vn.attrs.title || "";
  9553. this.text = vn.attrs.text;
  9554. this.childs = vn.attrs.childs || [];
  9555. this.nested = vn.attrs.nested || false;
  9556. // if(vn.attrs.id == '1d1') console.log('_Enonce UPDATE, text :', vn.attrs.text);
  9557. },
  9558. view(vn){
  9559. // if(vn.attrs.id == '1d1') console.log('_Enonce VIEW, text :', vn.attrs.text);
  9560. return m("section", {
  9561. 'id' :this.id,
  9562. 'class' :`enonce${this.nested ? ' nested':''} ${this.dottype}`
  9563. },
  9564. [
  9565. // create title node (only if not nested)
  9566. !this.nested ? m("h2", {}, m.trust(markdown.renderInline(this.title))) : null,
  9567. // create text node
  9568. m(_Text, {'text':this.text, 'id':this.id}),
  9569. // add children (only if not nested)
  9570. typeof this.childs !== 'undefined' && !this.nested
  9571. ? this.childs.map(c => { return m(_Item, c); })
  9572. : null
  9573. ])
  9574. }
  9575. }
  9576. // ____ __
  9577. // / __ \____ ______/ /_
  9578. // / /_/ / __ `/ ___/ __/
  9579. // / ____/ /_/ / / / /_
  9580. // /_/ \__,_/_/ \__/
  9581. var _Part = {
  9582. oninit(vn){
  9583. // this.id = vn.attrs.id;
  9584. // this.title = vn.attrs.title || '';
  9585. // this.enonces = vn.attrs.enonces;
  9586. },
  9587. onbeforeupdate(vn, old){
  9588. // console.log('_Part, onbeforeupdate old',old);
  9589. // this.title = vn.attrs.title || '';
  9590. // this.enonces = vn.attrs.enonces;
  9591. },
  9592. view(vn){
  9593. // console.log("part enonces", vn.attrs.enonces);
  9594. return m("section", {
  9595. 'id' :vn.attrs.id,
  9596. 'class' :'part'
  9597. },
  9598. [
  9599. // create title node
  9600. m("h1", {'class':'part-title', 'part':vn.attrs.id}, m.trust(markdown.renderInline(vn.attrs.title))),
  9601. // create text node
  9602. vn.attrs.enonces.map(e => {
  9603. // console.log(e.title +" - "+ e.type);
  9604. // var title = e.title || '';
  9605. switch (e.type) {
  9606. case "title":
  9607. // handle titles
  9608. // console.log('title');
  9609. return m("h2", {'class':'title'}, m.trust(markdown.renderInline(e.title)));
  9610. break;
  9611. case "filet":
  9612. // handle filets
  9613. // console.log('filet');
  9614. return m("h4", {'class':'filet'}, m.trust(markdown.renderInline(e.title)));
  9615. break;
  9616. default:
  9617. // or build structure
  9618. return m(_Enonce, Object.assign({"partid":vn.attrs.id},e));
  9619. }
  9620. })
  9621. ]
  9622. )
  9623. }
  9624. }
  9625. // ____ __
  9626. // / _/___ / /__________
  9627. // / // __ \/ __/ ___/ __ \
  9628. // _/ // / / / /_/ / / /_/ /
  9629. // /___/_/ /_/\__/_/ \____/
  9630. var _Intro = {
  9631. oninit(vn){
  9632. // console.log('_Intro : oninit : vn', vn);
  9633. this.id = vn.attrs.id;
  9634. this.text = vn.attrs.text || '';
  9635. },
  9636. onbeforeupdate(vn, old){
  9637. this.id = vn.attrs.id;
  9638. this.text = vn.attrs.text || '';
  9639. },
  9640. view(vn){
  9641. return m("section", {'class':'intro'}, m("p",m.trust(markdown.renderInline(this.text))));
  9642. }
  9643. }
  9644. // ______ __
  9645. // /_ __/__ _ __/ /_
  9646. // / / / _ \| |/_/ __/
  9647. // / / / __/> </ /_
  9648. // /_/ \___/_/|_|\__/
  9649. module.exports = {
  9650. // oninit(vn){
  9651. // // this.lang = vn.attrs.lang;
  9652. // console.log('ModeText oninit : lang', vn.attrs.lang);
  9653. // // i18next.changeLanguage(vn.attrs.lang);
  9654. // },
  9655. oncreate(vn){
  9656. document.body.classList.add('mode-text');
  9657. _Ui.init();
  9658. },
  9659. // onbeforeupdate(vn, old){
  9660. // console.log('ModeText onbeforeupdate : lang', vn.attrs.lang);
  9661. // // i18next.changeLanguage(vn.attrs.lang);
  9662. // },
  9663. view(vn){
  9664. // console.log('_ModeText view : _dbs.data', _dbs.data);
  9665. return m('main', {id:"content", 'class':'mode-text'}, _dbs.data[vn.attrs.lang].map((p) => {
  9666. // console.log("MAP _dbs", p);
  9667. if(p.id == 'intro'){
  9668. return m(_Intro,p);
  9669. }else{
  9670. return m(_Part,p);
  9671. }
  9672. })
  9673. );
  9674. }
  9675. }
  9676. /***/ }),
  9677. /* 86 */
  9678. /***/ (function(module, exports, __webpack_require__) {
  9679. var m = __webpack_require__(1);
  9680. // https://github.com/markdown-it/markdown-it
  9681. var markdown = __webpack_require__(4)()
  9682. .use(__webpack_require__(8));
  9683. var _dbs = __webpack_require__(3);
  9684. var _Header = __webpack_require__(10);
  9685. var _Footer = __webpack_require__(19);
  9686. var _Ui = __webpack_require__(20);
  9687. // ____ __
  9688. // / __ \____ / /_
  9689. // / / / / __ \/ __/
  9690. // / /_/ / /_/ / /_
  9691. // /_____/\____/\__/
  9692. var _Dot = {
  9693. id:null,
  9694. dottype:null,
  9695. type:'',
  9696. title:'',
  9697. breadcrumb:'',
  9698. text:'',
  9699. summary:'',
  9700. active:true,
  9701. opened:0,
  9702. nested:false,
  9703. links:null,
  9704. parents:[],
  9705. lang:_dbs.lang,
  9706. setupTitle(vn){
  9707. this.title = vn.attrs.title;
  9708. if(!this.title) this.title = this.type;
  9709. if(this.title)
  9710. this.title = markdown.renderInline(this.title);
  9711. },
  9712. setuptext(vn){
  9713. // console.log('setuptext', vn);
  9714. // construct text
  9715. this.text = vn.attrs.text || '';
  9716. this.rendered_text = markdown.render(this.text);
  9717. if(this.dottype == "preface"){
  9718. this.summary = this.rendered_text;
  9719. }else{
  9720. // construct summary
  9721. // TODO: summary needs more work (strip tags, markdown render)
  9722. // remove img
  9723. this.summary = this.text.replace(/!\[[^\]]+\]\([^\)]+\)/g, "");
  9724. // get portion of text
  9725. this.summary = this.summary.match('([^ ]*[ ]{0,1}){1,6}')[0];
  9726. // end underscores (italic) splited by summarizing
  9727. this.summary = this.summary.trim().replace(/_([^_]+)$/g, "_$1_");
  9728. // remove brackets (links) splited by summarizing
  9729. this.summary = this.summary.replace(/\[([^\]]+)$/g, "$1");
  9730. // render the markdown
  9731. this.summary = markdown.renderInline(this.summary) + "&nbsp;…";
  9732. }
  9733. },
  9734. oninit(vn){
  9735. this.id = vn.attrs.id;
  9736. this.type = vn.attrs.type;
  9737. this.dottype = vn.attrs.dottype;
  9738. this.breadcrumb = vn.attrs.breadcrumb;
  9739. // console.log(`${this.id} -> ${this.dottype}`);
  9740. if(typeof vn.attrs.active !== 'undefined')
  9741. this.active = vn.attrs.active;
  9742. // links
  9743. this.links = _dbs.data_strct[this.id];
  9744. // parents memorize where do we come from to avoid duplicates and looping nav
  9745. if(vn.attrs.parents){
  9746. this.parents = this.parents.concat(vn.attrs.parents);
  9747. // console.log('_Dot init '+this.id+' parents :',this.parents);
  9748. }
  9749. this.nested = this.parents.length ? true : false;
  9750. // if(this.nested) console.log(`oninit ${this.id}`);
  9751. this.setupTitle(vn);
  9752. this.setuptext(vn);
  9753. },
  9754. oncreate(vn){
  9755. if(this.active){
  9756. vn.dom.classList.remove('disabled');
  9757. }else{
  9758. vn.dom.classList.add('disabled');
  9759. }
  9760. },
  9761. onbeforeupdate(vn){
  9762. // if(this.opened) console.log(`onbeforeupdate ${this.id} : vn`,vn);
  9763. if(this.lang != _dbs.lang){
  9764. this.lang = _dbs.lang;
  9765. this.breadcrumb = vn.attrs.breadcrumb;
  9766. this.setuptext(vn);
  9767. this.setupTitle(vn);
  9768. }
  9769. // this.opened = 0;
  9770. },
  9771. onupdate(vn){
  9772. // if(this.nested) console.log(`onupdate ${this.id}`);
  9773. if(this.active){
  9774. if (this.opened){
  9775. vn.dom.classList.add('opened');
  9776. if(this.links.to.length)
  9777. vn.dom.classList.add('to-links');
  9778. if(this.links.from.length)
  9779. vn.dom.classList.add('from-links');
  9780. }else{
  9781. vn.dom.classList.remove('opened');
  9782. }
  9783. }
  9784. },
  9785. setupLinks(vn, c, links){
  9786. return m('nav', {'class':`links ${c}`}, links.map(id => {
  9787. // console.log(id);
  9788. if(typeof _dbs.data_byid[_dbs.lang][id] !== 'undefined'){
  9789. var obj = _dbs.data_byid[_dbs.lang][id];
  9790. // console.log('link to : obj', obj);
  9791. return m(_Dot, {
  9792. "id":id,
  9793. 'title':obj.title,
  9794. 'breadcrumb':obj.breadcrumb,
  9795. 'text':obj.text,
  9796. 'dottype':obj.dottype,
  9797. 'type':obj.type,
  9798. // passe the memory of crossed dots plus the current one
  9799. 'parents':vn.state.parents.concat([vn.state.id]),
  9800. // activate link only if not in parents (already went through it)
  9801. 'active':vn.state.parents.indexOf(id) == -1 ? true:false,
  9802. // 'nested':true,
  9803. });
  9804. }
  9805. })
  9806. );
  9807. },
  9808. viewOpenedContent(vn){
  9809. // if(this.nested) console.log(`viewOpenedContent ${this.id} : vn`, vn);
  9810. // if(this.nested) console.log(`viewOpenedContent ${this.id} : this`, this);
  9811. return m('div', {
  9812. 'uid':this.id,
  9813. 'class':`dot ${this.dottype}${this.nested ? ' nested':''}`},
  9814. [
  9815. // links to
  9816. this.links.to.length
  9817. ? this.setupLinks(vn, 'to', this.links.to)
  9818. : null, // if no links to, add nothing
  9819. // close btn
  9820. m('div', {
  9821. 'class':'close-link-btn',
  9822. onclick(e){
  9823. vn.state.opened = 0;
  9824. }
  9825. }, m('span', m.trust("&#128473;"))
  9826. ),
  9827. // Title
  9828. m('span', {'class':'title'}, m.trust(this.nested ? this.breadcrumb : this.title)),
  9829. // full text
  9830. m('section', {
  9831. 'class':'text',
  9832. onmouseover(e){
  9833. e.preventDefault();
  9834. if(e.target.nodeName == "A" ){
  9835. let id = e.target.getAttribute("href");
  9836. // add highlight class
  9837. vn.dom.querySelector(`nav.links>div[uid="${id}"]`).classList.add('highlight');
  9838. }else{
  9839. // remove all hilight class
  9840. for (link of vn.dom.querySelectorAll('nav.links>div.dot')) {
  9841. link.classList.remove('highlight');
  9842. }
  9843. }
  9844. },
  9845. onclick(e){
  9846. e.preventDefault();
  9847. if(e.target.nodeName == "A" ){
  9848. let id = e.target.getAttribute("href");
  9849. vn.dom.querySelector(`nav.links>div[uid="${id}"]>.title`).click();
  9850. }
  9851. }
  9852. }, m.trust(this.rendered_text)
  9853. ),
  9854. // links from
  9855. this.links.from.length
  9856. ? this.setupLinks(vn, 'from', this.links.from)
  9857. : null, // if no links from, add nothing
  9858. ]
  9859. );
  9860. },
  9861. viewPreviewContent(vn){
  9862. // if(this.nested) console.log(`viewPreviewContent ${this.id} : vn`, vn);
  9863. // if(this.nested) console.log(`viewPreviewContent ${this.id} : this`, this);
  9864. return m('div', {
  9865. 'uid':this.id,
  9866. 'class':`dot ${this.dottype}${this.nested ? ' nested':''}`
  9867. },
  9868. [
  9869. // bullet
  9870. m('div', {'class':'bullet'}, m('span', m.trust('&#9899;'))),
  9871. m('span', {
  9872. 'class':'title',
  9873. onclick(e){
  9874. if(!vn.state.opened) vn.state.opened = 1;
  9875. }
  9876. }, m.trust(this.nested ? this.breadcrumb : this.title)),
  9877. m('p', {'class':'summary'}, m.trust(this.summary))
  9878. ]
  9879. );
  9880. },
  9881. view(vn){
  9882. // if (this.nested) console.log(`view ${this.id}`);
  9883. // if (this.opened) console.log(`view ${this.id} : vn`,vn);
  9884. // if (this.nested) console.log(`view ${this.id} : this`,this);
  9885. return this.active && vn.state.opened
  9886. ? this.viewOpenedContent(vn) // full view of dot with linked dots
  9887. : this.viewPreviewContent(vn); // preview dot
  9888. }
  9889. }
  9890. /*
  9891. full list of black dotlikes from unicode
  9892. ● - &#9679; - Black Circle
  9893. ⏺ - &#9210; - Black Circle for Record
  9894. ⚫ - &#9899; - Medium Black Circle
  9895. ⬤ - &#11044; - Black Large Circle
  9896. ⧭ - &#10733; - Black Circle with Down Arrow
  9897. 🞄 - &#128900; - Black Slightly Small Circle
  9898. • - &#8226; - Bullet
  9899. ∙ - &#8729; - Bullet Operator
  9900. ⋅ - &#8901; - Dot Operator
  9901. 🌑 - &#127761; - New Moon Symbol
  9902. */
  9903. // _______ _ __ __
  9904. // / ___/ / (_) /__/ /
  9905. // / /__/ _ \/ / / _ /
  9906. // \___/_//_/_/_/\_,_/
  9907. var _Child = {
  9908. // id:null,
  9909. // part:null,
  9910. // type:null,
  9911. // dottype:null,
  9912. // // nested:false,
  9913. // text:'',
  9914. childs:[],
  9915. oninit(vn){
  9916. // // console.log('vn.attrs', vn.attrs);
  9917. // this.id = vn.attrs.id;
  9918. // this.type = vn.attrs.type;
  9919. // // vn.state.part = vn.state.slug.match(/^(\d)(.+)/)[1];
  9920. // this.text = vn.attrs.text;
  9921. // // this.nested = vn.attrs.nested || false;
  9922. // this.dottype = vn.attrs.dottype;
  9923. },
  9924. onbeforeupdate(vn, old){
  9925. // // this.nested = vn.attrs.nested || false;
  9926. // this.type = vn.attrs.type;
  9927. // this.text = vn.attrs.text;
  9928. },
  9929. view(vn){
  9930. // return m(_Dot, {"id":this.id, 'text':this.text, 'type':this.type, 'dottype':this.dottype});
  9931. // if (typeof vn.attrs.childs === 'undefined'){
  9932. // debugger;
  9933. // }
  9934. return [
  9935. m(_Dot, vn.attrs),
  9936. // add children
  9937. typeof vn.attrs.childs !== 'undefined'
  9938. ? vn.attrs.childs.map(c => { return m(_Child, c); })
  9939. : null
  9940. ];
  9941. }
  9942. };
  9943. // ______
  9944. // / ____/___ ____ ____ ________
  9945. // / __/ / __ \/ __ \/ __ \/ ___/ _ \
  9946. // / /___/ / / / /_/ / / / / /__/ __/
  9947. // /_____/_/ /_/\____/_/ /_/\___/\___/
  9948. var _Enonce = {
  9949. partid:null,
  9950. id:null,
  9951. title:null,
  9952. text:null,
  9953. dottype:null,
  9954. // nested:false,
  9955. childs:[],
  9956. oninit(vn){
  9957. // // // console.log('Enonce on init', vn);
  9958. // this.partid = vn.attrs.partid;
  9959. // this.id = vn.attrs.id;
  9960. // this.title = vn.attrs.title || "";
  9961. // this.text = vn.attrs.text;
  9962. // this.childs = vn.attrs.childs || [];
  9963. // // this.nested = vn.attrs.nested || false;
  9964. // this.dottype = vn.attrs.dottype;
  9965. },
  9966. onbeforeupdate(vn, old) {
  9967. // // console.log(vn.attrs.childs);
  9968. // this.title = vn.attrs.title || "";
  9969. // this.text = vn.attrs.text;
  9970. // this.childs = vn.attrs.childs || [];
  9971. // // this.nested = vn.attrs.nested || false;
  9972. // // if(vn.attrs.id == '1d1') console.log('_Enonce UPDATE, text :', vn.attrs.text);
  9973. // this.dottype = vn.attrs.dottype;
  9974. },
  9975. view(vn){
  9976. // if(vn.attrs.id == '1d1') console.log('_Enonce VIEW, text :', vn.attrs.text);
  9977. return [
  9978. // create dot
  9979. // m(_Dot, {
  9980. // 'id':this.id
  9981. // 'text':this.text
  9982. // 'type':this.title
  9983. // 'dottype':this.dottype
  9984. // }),
  9985. m(_Dot, vn.attrs),
  9986. // addd children
  9987. vn.attrs.childs.map(c => { return m(_Child, c); })
  9988. ]
  9989. }
  9990. }
  9991. // ____ __
  9992. // / __ \____ ______/ /_
  9993. // / /_/ / __ `/ ___/ __/
  9994. // / ____/ /_/ / / / /_
  9995. // /_/ \__,_/_/ \__/
  9996. var _Part = {
  9997. oninit(vn){
  9998. this.id = vn.attrs.id;
  9999. this.title = vn.attrs.title || "";
  10000. this.enonces = vn.attrs.enonces;
  10001. },
  10002. onbeforeupdate(vn, old){
  10003. // console.log('_Part, onbeforeupdate old',old);
  10004. this.title = vn.attrs.title || "";
  10005. this.enonces = vn.attrs.enonces;
  10006. },
  10007. view(vn){
  10008. // console.log(vn.attrs.enonces);
  10009. return m("section", {
  10010. 'id' :this.id,
  10011. 'class' :'part'
  10012. },
  10013. [
  10014. // create title node
  10015. m("h1", {'class':'part-title', 'part':this.id}, m.trust(markdown.renderInline(this.title))),
  10016. // create text node
  10017. this.enonces.map(e => {
  10018. // console.log(e.text);
  10019. // return m(_Enonce, Object.assign({"partid":this.id},e))
  10020. switch (e.type) {
  10021. case "title":
  10022. // handle titles
  10023. return m("h2", {'class':'title'}, m.trust(markdown.renderInline(e.title)));
  10024. break;
  10025. case "filet":
  10026. // handle filets
  10027. return m("h4", {'class':'filet'}, m.trust(markdown.renderInline(e.title)));
  10028. break;
  10029. default:
  10030. // or build structure
  10031. return m(_Enonce, Object.assign({"partid":this.id},e));
  10032. }
  10033. })
  10034. ]
  10035. )
  10036. }
  10037. }
  10038. // ____ __
  10039. // / _/___ / /__________
  10040. // / // __ \/ __/ ___/ __ \
  10041. // _/ // / / / /_/ / / /_/ /
  10042. // /___/_/ /_/\__/_/ \____/
  10043. var _Intro = {
  10044. oninit(vn){
  10045. console.log('_Intro : oninit : vn', vn);
  10046. this.id = vn.attrs.id;
  10047. this.text = vn.attrs.text || '';
  10048. },
  10049. onbeforeupdate(vn, old){
  10050. this.id = vn.attrs.id;
  10051. this.text = vn.attrs.text || '';
  10052. },
  10053. view(vn){
  10054. return m("section", {'class':'intro'}, m("p",m.trust(markdown.renderInline(this.text))));
  10055. }
  10056. }
  10057. // ______ __ _
  10058. // / ____/___ ____ ____ ___ _____/ /_(_)___ ____ _____
  10059. // / / / __ \/ __ \/ __ \/ _ \/ ___/ __/ / __ \/ __ \/ ___/
  10060. // / /___/ /_/ / / / / / / / __/ /__/ /_/ / /_/ / / / (__ )
  10061. // \____/\____/_/ /_/_/ /_/\___/\___/\__/_/\____/_/ /_/____/
  10062. module.exports = {
  10063. oncreate(vn){
  10064. document.body.classList.add('mode-connections');
  10065. _Ui.init();
  10066. },
  10067. view(vn){
  10068. // console.log('_ModeConnections view', vn.attrs.lang);
  10069. return m('main', {id:"content", 'class':'mode-connections'}, _dbs.data[vn.attrs.lang].map(p => {
  10070. if(p.id == 'intro'){
  10071. return m(_Intro,p);
  10072. }else{
  10073. return m(_Part,p);
  10074. }
  10075. })
  10076. );
  10077. }
  10078. }
  10079. /***/ }),
  10080. /* 87 */
  10081. /***/ (function(module, exports) {
  10082. // removed by extract-text-webpack-plugin
  10083. /***/ })
  10084. /******/ ]);
  10085. //# sourceMappingURL=main.js.map