main.js 363 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078
  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. langs:[
  1587. {
  1588. 'lc':'lat',
  1589. 'label':'Latin (Carl Gebhardt)',
  1590. 'db':'spinoza-ethica-lat-gebhardt.json'
  1591. },
  1592. {
  1593. 'lc':'fr',
  1594. 'label':'Français (Traduction par Charles Appuhn)',
  1595. 'db':'spinoza-ethica-fr-appuhn.json'
  1596. },
  1597. {
  1598. 'lc':'bra',
  1599. 'label':'Brazilian (Tradução Roberto Brandão)',
  1600. 'db':'spinoza-ethica-bra-brandao.json'
  1601. },
  1602. {
  1603. 'lc':'en',
  1604. 'label':'English (Translated by R. H. M. Elwes)',
  1605. 'db':'spinoza-ethica-en-elwes.json'
  1606. }
  1607. ],
  1608. data:[],
  1609. loaded_dbs:0,
  1610. data_byid:[],
  1611. data_strct:{},
  1612. 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)?$/,
  1613. id_strct:[
  1614. {full:'Partie',dim:'Part.'},
  1615. {
  1616. 'prop':{full:'Proposition', dim:'Prop.'}, // \d\d
  1617. 'app' :{full:'Appendice', dim:'App.'},
  1618. 'agd' :{full:'Definition generale des affections'},
  1619. 'pr' :{full:'Preface', dim:'Pref.'},
  1620. 'ad' :{full:'Definiton des affections'},
  1621. 'ap' :{full:'Appendice', dim:'App.'},
  1622. 'c' :{full:'Corollaire', dim:'Cor.'},
  1623. 'p' :{full:'Postulat', dim:'Post.'},
  1624. 'd' :{full:'Definition', dim:'Def.'},
  1625. 'a' :{full:'Axiome', dim:'Ax.'},
  1626. },
  1627. {
  1628. // \d\d
  1629. // \d
  1630. 'cd' :{full:'Corollaire Demonstration'},
  1631. 'sc' :{full:'Scolie', dim:'Scol.'},
  1632. 'd' :{full:'Demonstration', dim:'Demo.'},
  1633. 'c' :{full:'Corollaire', dim:'Cor.'},
  1634. 'a' :{full:'Axiome', dim:'Ax.'},
  1635. 'l' :{full:'Lemme', dim:'Lem.'},
  1636. 'p' :{full:'Postulat', dim:'Post.'},
  1637. 'e' :{full:'Explication', dim:'Exp.'},
  1638. },
  1639. {
  1640. // \d
  1641. 'e' :{full:'Explication', dim:'Exp.'},
  1642. 'sc' :{full:'Scolie', dim:'Scol.'},
  1643. 'c' :{full:'Corollaire', dim:'Cor.'},
  1644. },
  1645. {
  1646. 'd' :{full:'Demonstration', dim:'Demo.'},
  1647. 'c' :{full:'Corollaire', dim:'Cor.'},
  1648. 'a' :{full:'Axiome', dim:'Ax.'},
  1649. 'sc' :{full:'Scolie', dim:'Scol.'},
  1650. }
  1651. ],
  1652. // loading progress
  1653. loaded_by_file:{},
  1654. // totalloaded:0,
  1655. loader: document.getElementById('db-loaded'),
  1656. load(callback) {
  1657. // load all dbs, when all loaded call main app callback function
  1658. for (var i = 0; i < this.langs.length; i++) {
  1659. this.loaded_by_file[this.langs[i].lc] = 0;
  1660. this.loadJSON(this.langs[i].lc, '/assets/jsondb/'+this.langs[i].db, callback)
  1661. }
  1662. },
  1663. loadJSON(lc, file, callback){
  1664. var xobj = new XMLHttpRequest();
  1665. xobj.overrideMimeType("application/json");
  1666. // TODO: load and unzip gziped json
  1667. // xobj.setRequestHeader('Accept-Encoding', 'gzip');
  1668. // Display loading progress
  1669. xobj.addEventListener("progress", function(oEvent){
  1670. if (oEvent.lengthComputable) {
  1671. var percentComplete = oEvent.loaded / oEvent.total * 100;
  1672. console.log(lc+' loaded :',percentComplete);
  1673. this.loaded_by_file[lc] = percentComplete;
  1674. var totalloaded = 0;
  1675. for (var i = 0; i < this.langs.length; i++) {
  1676. totalloaded += this.loaded_by_file[this.langs[i].lc];
  1677. }
  1678. this.loader.style.width = (totalloaded/this.langs.length)+"%";
  1679. } else {
  1680. // Unable to compute progress information since the total size is unknown
  1681. console.log('no progress');
  1682. }
  1683. }.bind(this));
  1684. xobj.onreadystatechange = function () {
  1685. // console.log('onreadystatechange', xobj.readyState);
  1686. switch(xobj.readyState){
  1687. case 3:
  1688. // console.log('loading');
  1689. break;
  1690. break;
  1691. case 4:
  1692. if (xobj.status === 200) {
  1693. this.onJSONLoaded(lc, xobj.responseText, callback);
  1694. } else {
  1695. console.log("Status de la réponse: %d (%s)", xobj.status, xobj.statusText);
  1696. }
  1697. break;
  1698. }
  1699. }.bind(this);
  1700. xobj.open('GET', file, true);
  1701. xobj.send(null);
  1702. },
  1703. onJSONLoaded(lc, json, callback){
  1704. // console.log('onDBLoaded '+lc);
  1705. this.data[lc] = JSON.parse(json);
  1706. this.loaded_dbs ++;
  1707. //
  1708. if (this.loaded_dbs == this.langs.length) {
  1709. // console.log('All db loaded : data', this.data);
  1710. this.parseByID(callback);
  1711. }
  1712. },
  1713. parseByID(callback){
  1714. // create a id keyed array of contents
  1715. var e_id, c_id, cc_id;
  1716. // loop through laguages
  1717. for(let l in this.data){
  1718. // console.log('l', l);
  1719. this.data_byid[l] = {};
  1720. // loop through parts
  1721. for (let p in this.data[l]) {
  1722. if(this.data[l][p].type !== "intro"){
  1723. // console.log(this.data[l][p]);
  1724. // loop through enonces
  1725. for (let e in this.data[l][p].enonces) {
  1726. // console.log('e',e);
  1727. if(this.data[l][p].enonces[e].id){
  1728. e_id = this.data[l][p].enonces[e].id;
  1729. // guess the type from the id
  1730. // console.log(this.data[l][p].enonces[e].id);
  1731. this.data[l][p].enonces[e].dottype = this.setupType(e_id);
  1732. // breadcrumb (full tree title)
  1733. this.data[l][p].enonces[e].breadcrumb = this.setupBreadcrumb(e_id);
  1734. // records childs in array keyed by ids
  1735. this.data_byid[l][e_id] = this.data[l][p].enonces[e];
  1736. }
  1737. // loop through childs
  1738. for (let c in this.data[l][p].enonces[e].childs){
  1739. // console.log(_db[p][e][c]);
  1740. if(this.data[l][p].enonces[e].childs[c].id){
  1741. c_id = this.data[l][p].enonces[e].childs[c].id;
  1742. // guess the type from the id
  1743. this.data[l][p].enonces[e].childs[c].dottype = this.setupType(c_id);
  1744. // breadcrumb (full tree title)
  1745. this.data[l][p].enonces[e].childs[c].breadcrumb = this.setupBreadcrumb(c_id);
  1746. // records childs in array keyed by ids
  1747. this.data_byid[l][c_id] = this.data[l][p].enonces[e].childs[c];
  1748. }
  1749. // loop through childs of childs
  1750. for (let cc in this.data[l][p].enonces[e].childs[c].childs){
  1751. // console.log(_db[p][e][c]);
  1752. if(this.data[l][p].enonces[e].childs[c].childs[cc].id){
  1753. cc_id = this.data[l][p].enonces[e].childs[c].childs[cc].id;
  1754. console.log('cc_id', cc_id);
  1755. // guess the type from the id
  1756. this.data[l][p].enonces[e].childs[c].childs[cc].dottype = this.setupType(cc_id);
  1757. // breadcrumb (full tree title)
  1758. this.data[l][p].enonces[e].childs[c].childs[cc].breadcrumb = this.setupBreadcrumb(cc_id);
  1759. // records childs in array keyed by ids
  1760. this.data_byid[l][cc_id] = this.data[l][p].enonces[e].childs[c].childs[cc];
  1761. }
  1762. }
  1763. }
  1764. }
  1765. }
  1766. }
  1767. }
  1768. // console.log('this.data_byid', this.data_byid);
  1769. this.parseStrct(callback);
  1770. },
  1771. setupBreadcrumb(id){
  1772. // /^(\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)?$/
  1773. var breadcrumb_array = [];
  1774. var m = id.match(this.rx_id);
  1775. var mode = 'full';
  1776. if(m){
  1777. m.shift();
  1778. // removing undefined
  1779. m_clean = [];
  1780. for (let i = 0; i < m.length; i++) {
  1781. if(typeof m[i] !== 'undefined'){
  1782. m_clean.push(m[i]);
  1783. }
  1784. }
  1785. // console.log('m_clean', m_clean);
  1786. for (let i = 0; i < m_clean.length; i++) { // we loop through match result variables
  1787. // for (let i = m_clean.length-1; i >= 0; i--) { // we loop through match result variables in reverse order
  1788. // console.log('m_clean['+i+']', m_clean[i]);
  1789. if(i == 0){ // first digit is part number
  1790. breadcrumb_array.unshift(`${this.id_strct[i]['dim']} ${m_clean[i]}`);
  1791. }else{
  1792. // display mode
  1793. mode = i !== m_clean.length-1 ? 'dim' : 'full';
  1794. if(isNaN(m_clean[i])){ // if not a number we get the label
  1795. breadcrumb_array.unshift(`${this.id_strct[i][m_clean[i]][mode]}`);
  1796. // breadcrumb_array.splice(1, 0, `${m_clean[i]}`);
  1797. }else{ // if its a number
  1798. if(i == 1){ // we just add the number to the breadcrumb preceded by 'Proposition'
  1799. breadcrumb_array.unshift(`${this.id_strct[i]['prop'][mode]} ${m_clean[i]}`);
  1800. }else{ // we just add the number to the breadcrumb behind the last added item
  1801. // breadcrumb_array.unshift(`${m_clean[i]}`);
  1802. // debugger;
  1803. breadcrumb_array.splice(1, 0, `${m_clean[i]}`);
  1804. }
  1805. }
  1806. }
  1807. }
  1808. }
  1809. // console.log('breadcrumb_array', breadcrumb_array);
  1810. return breadcrumb_array.join(' ');
  1811. },
  1812. setupType(id){
  1813. // console.log('setupType',id);
  1814. // /^(\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)?$/
  1815. var m = id.match(this.rx_id);
  1816. if(m){
  1817. switch(true){
  1818. case /^\d{2}$/.test(m[2]): // proposition
  1819. switch(true){
  1820. case /^cd$/.test(m[3]) : return 'corollaire-demo';
  1821. case /^sc$/.test(m[3]) : return 'scolie';
  1822. case /^d$/.test(m[3]) : return 'demonstration';
  1823. case /^c$/.test(m[3]) :
  1824. switch(true){
  1825. case /^sc$/.test(m[4]): return 'scolie';
  1826. case /^d$/.test(m[4]) : return 'demonstration';
  1827. case /^sc$/.test(m[5]): return 'scolie';
  1828. case /^\d$/.test(m[4]): return 'corollaire';
  1829. case !m[4] : return 'corollaire';
  1830. }
  1831. case /^a$/.test(m[3]) : return 'prop-axiom';
  1832. case /^l$/.test(m[3]) :
  1833. switch(true){
  1834. case /^d$/.test(m[5]) : return 'lemme-demonstration';
  1835. case /^sc$/.test(m[5]): return 'lemme-scolie';
  1836. case /^c$/.test(m[5]) : return 'lemme-corrollaire';
  1837. case !m[5] : return 'lemme';
  1838. }
  1839. case /^p$/.test(m[3]) : return 'postulat';
  1840. case /^\d$/.test(m[3]) : return '??';
  1841. case /^\d{2}$/.test(m[3]) : return '??';
  1842. case !m[3] : return 'proposition';
  1843. }
  1844. case /^app|ap$/.test(m[2]) : return 'appendice';
  1845. case /^agd$/.test(m[2]) : return 'def-gen-affect';
  1846. case /^pr$/.test(m[2]) : return 'preface';
  1847. case /^ad$/.test(m[2]) :
  1848. switch(true){
  1849. case /^e$/.test(m[4]) :return 'explication';
  1850. case !m[4] :return 'def-affect';
  1851. }
  1852. case /^c$/.test(m[2]) : return 'chapitre';
  1853. case /^p$/.test(m[2]) : return 'postulat';
  1854. case /^d$/.test(m[2]) :
  1855. switch(true){
  1856. case /^e$/.test(m[4]) : return 'explication';
  1857. case !m[4] : return 'definition';
  1858. }
  1859. case /^a$/.test(m[2]) : return 'axiom';
  1860. }
  1861. // }
  1862. }
  1863. // console.log(`${this.id} -> ${this.dottype}`,m);
  1864. // TODO: fix false ids
  1865. // we have app and ap for appendice (1app | 4ap)
  1866. // 213def ??
  1867. // 209cd demo ou corollaire-demo ??
  1868. // 210csc scolie ou corollaire-scolie ??
  1869. // 213l1d demo ??
  1870. },
  1871. parseStrct(callback){
  1872. var id, item, obj, links_match, link, tid;
  1873. for (id in this.data_byid[this.langs[0].lc]) {
  1874. item = this.data_byid[this.langs[0].lc][id];
  1875. // console.log(item);
  1876. // skeep titles as they don't have structure data
  1877. if(item.type == "title") continue;
  1878. obj = {
  1879. 'to':[],
  1880. 'from':[],
  1881. };
  1882. // get links
  1883. links_match = item.text.match(/\[[^\]]+\]\([^\)]+\)/g);
  1884. // console.log(links_match);
  1885. // if links exist on text
  1886. if(links_match){
  1887. for(link of links_match){
  1888. // for(i in links_match){
  1889. // link = links_match[i];
  1890. // console.log(link);
  1891. // get the target id
  1892. tid = link.match(/\((.+)\)/)[1];
  1893. // avoid duplicates
  1894. if (obj.to.indexOf(tid) == -1)
  1895. obj.to.push(tid);
  1896. // add id to "from" links in target
  1897. // if target exists
  1898. if(typeof this.data_strct[tid] !== 'undefined'){
  1899. // avoid duplicates
  1900. if (this.data_strct[tid].from.indexOf(tid) == -1)
  1901. this.data_strct[tid].from.push(id);
  1902. }else{
  1903. // if targets does not exists, the db has an issue, warn about that
  1904. // console.log(`!! warning : ${tid} target id does not exists`);
  1905. }
  1906. }
  1907. }
  1908. // add the item links to the main links listings
  1909. this.data_strct[id] = obj;
  1910. }
  1911. // console.log('data_strct',this.data_strct);
  1912. callback();
  1913. }
  1914. }
  1915. /***/ }),
  1916. /* 4 */
  1917. /***/ (function(module, exports, __webpack_require__) {
  1918. "use strict";
  1919. module.exports = __webpack_require__(30);
  1920. /***/ }),
  1921. /* 5 */
  1922. /***/ (function(module, exports) {
  1923. 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]/
  1924. /***/ }),
  1925. /* 6 */
  1926. /***/ (function(module, exports, __webpack_require__) {
  1927. "use strict";
  1928. /**
  1929. * class Ruler
  1930. *
  1931. * Helper class, used by [[MarkdownIt#core]], [[MarkdownIt#block]] and
  1932. * [[MarkdownIt#inline]] to manage sequences of functions (rules):
  1933. *
  1934. * - keep rules in defined order
  1935. * - assign the name to each rule
  1936. * - enable/disable rules
  1937. * - add/replace rules
  1938. * - allow assign rules to additional named chains (in the same)
  1939. * - cacheing lists of active rules
  1940. *
  1941. * You will not need use this class directly until write plugins. For simple
  1942. * rules control use [[MarkdownIt.disable]], [[MarkdownIt.enable]] and
  1943. * [[MarkdownIt.use]].
  1944. **/
  1945. /**
  1946. * new Ruler()
  1947. **/
  1948. function Ruler() {
  1949. // List of added rules. Each element is:
  1950. //
  1951. // {
  1952. // name: XXX,
  1953. // enabled: Boolean,
  1954. // fn: Function(),
  1955. // alt: [ name2, name3 ]
  1956. // }
  1957. //
  1958. this.__rules__ = [];
  1959. // Cached rule chains.
  1960. //
  1961. // First level - chain name, '' for default.
  1962. // Second level - diginal anchor for fast filtering by charcodes.
  1963. //
  1964. this.__cache__ = null;
  1965. }
  1966. ////////////////////////////////////////////////////////////////////////////////
  1967. // Helper methods, should not be used directly
  1968. // Find rule index by name
  1969. //
  1970. Ruler.prototype.__find__ = function (name) {
  1971. for (var i = 0; i < this.__rules__.length; i++) {
  1972. if (this.__rules__[i].name === name) {
  1973. return i;
  1974. }
  1975. }
  1976. return -1;
  1977. };
  1978. // Build rules lookup cache
  1979. //
  1980. Ruler.prototype.__compile__ = function () {
  1981. var self = this;
  1982. var chains = [ '' ];
  1983. // collect unique names
  1984. self.__rules__.forEach(function (rule) {
  1985. if (!rule.enabled) { return; }
  1986. rule.alt.forEach(function (altName) {
  1987. if (chains.indexOf(altName) < 0) {
  1988. chains.push(altName);
  1989. }
  1990. });
  1991. });
  1992. self.__cache__ = {};
  1993. chains.forEach(function (chain) {
  1994. self.__cache__[chain] = [];
  1995. self.__rules__.forEach(function (rule) {
  1996. if (!rule.enabled) { return; }
  1997. if (chain && rule.alt.indexOf(chain) < 0) { return; }
  1998. self.__cache__[chain].push(rule.fn);
  1999. });
  2000. });
  2001. };
  2002. /**
  2003. * Ruler.at(name, fn [, options])
  2004. * - name (String): rule name to replace.
  2005. * - fn (Function): new rule function.
  2006. * - options (Object): new rule options (not mandatory).
  2007. *
  2008. * Replace rule by name with new function & options. Throws error if name not
  2009. * found.
  2010. *
  2011. * ##### Options:
  2012. *
  2013. * - __alt__ - array with names of "alternate" chains.
  2014. *
  2015. * ##### Example
  2016. *
  2017. * Replace existing typorgapher replacement rule with new one:
  2018. *
  2019. * ```javascript
  2020. * var md = require('markdown-it')();
  2021. *
  2022. * md.core.ruler.at('replacements', function replace(state) {
  2023. * //...
  2024. * });
  2025. * ```
  2026. **/
  2027. Ruler.prototype.at = function (name, fn, options) {
  2028. var index = this.__find__(name);
  2029. var opt = options || {};
  2030. if (index === -1) { throw new Error('Parser rule not found: ' + name); }
  2031. this.__rules__[index].fn = fn;
  2032. this.__rules__[index].alt = opt.alt || [];
  2033. this.__cache__ = null;
  2034. };
  2035. /**
  2036. * Ruler.before(beforeName, ruleName, fn [, options])
  2037. * - beforeName (String): new rule will be added before this one.
  2038. * - ruleName (String): name of added rule.
  2039. * - fn (Function): rule function.
  2040. * - options (Object): rule options (not mandatory).
  2041. *
  2042. * Add new rule to chain before one with given name. See also
  2043. * [[Ruler.after]], [[Ruler.push]].
  2044. *
  2045. * ##### Options:
  2046. *
  2047. * - __alt__ - array with names of "alternate" chains.
  2048. *
  2049. * ##### Example
  2050. *
  2051. * ```javascript
  2052. * var md = require('markdown-it')();
  2053. *
  2054. * md.block.ruler.before('paragraph', 'my_rule', function replace(state) {
  2055. * //...
  2056. * });
  2057. * ```
  2058. **/
  2059. Ruler.prototype.before = function (beforeName, ruleName, fn, options) {
  2060. var index = this.__find__(beforeName);
  2061. var opt = options || {};
  2062. if (index === -1) { throw new Error('Parser rule not found: ' + beforeName); }
  2063. this.__rules__.splice(index, 0, {
  2064. name: ruleName,
  2065. enabled: true,
  2066. fn: fn,
  2067. alt: opt.alt || []
  2068. });
  2069. this.__cache__ = null;
  2070. };
  2071. /**
  2072. * Ruler.after(afterName, ruleName, fn [, options])
  2073. * - afterName (String): new rule will be added after this one.
  2074. * - ruleName (String): name of added rule.
  2075. * - fn (Function): rule function.
  2076. * - options (Object): rule options (not mandatory).
  2077. *
  2078. * Add new rule to chain after one with given name. See also
  2079. * [[Ruler.before]], [[Ruler.push]].
  2080. *
  2081. * ##### Options:
  2082. *
  2083. * - __alt__ - array with names of "alternate" chains.
  2084. *
  2085. * ##### Example
  2086. *
  2087. * ```javascript
  2088. * var md = require('markdown-it')();
  2089. *
  2090. * md.inline.ruler.after('text', 'my_rule', function replace(state) {
  2091. * //...
  2092. * });
  2093. * ```
  2094. **/
  2095. Ruler.prototype.after = function (afterName, ruleName, fn, options) {
  2096. var index = this.__find__(afterName);
  2097. var opt = options || {};
  2098. if (index === -1) { throw new Error('Parser rule not found: ' + afterName); }
  2099. this.__rules__.splice(index + 1, 0, {
  2100. name: ruleName,
  2101. enabled: true,
  2102. fn: fn,
  2103. alt: opt.alt || []
  2104. });
  2105. this.__cache__ = null;
  2106. };
  2107. /**
  2108. * Ruler.push(ruleName, fn [, options])
  2109. * - ruleName (String): name of added rule.
  2110. * - fn (Function): rule function.
  2111. * - options (Object): rule options (not mandatory).
  2112. *
  2113. * Push new rule to the end of chain. See also
  2114. * [[Ruler.before]], [[Ruler.after]].
  2115. *
  2116. * ##### Options:
  2117. *
  2118. * - __alt__ - array with names of "alternate" chains.
  2119. *
  2120. * ##### Example
  2121. *
  2122. * ```javascript
  2123. * var md = require('markdown-it')();
  2124. *
  2125. * md.core.ruler.push('my_rule', function replace(state) {
  2126. * //...
  2127. * });
  2128. * ```
  2129. **/
  2130. Ruler.prototype.push = function (ruleName, fn, options) {
  2131. var opt = options || {};
  2132. this.__rules__.push({
  2133. name: ruleName,
  2134. enabled: true,
  2135. fn: fn,
  2136. alt: opt.alt || []
  2137. });
  2138. this.__cache__ = null;
  2139. };
  2140. /**
  2141. * Ruler.enable(list [, ignoreInvalid]) -> Array
  2142. * - list (String|Array): list of rule names to enable.
  2143. * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
  2144. *
  2145. * Enable rules with given names. If any rule name not found - throw Error.
  2146. * Errors can be disabled by second param.
  2147. *
  2148. * Returns list of found rule names (if no exception happened).
  2149. *
  2150. * See also [[Ruler.disable]], [[Ruler.enableOnly]].
  2151. **/
  2152. Ruler.prototype.enable = function (list, ignoreInvalid) {
  2153. if (!Array.isArray(list)) { list = [ list ]; }
  2154. var result = [];
  2155. // Search by name and enable
  2156. list.forEach(function (name) {
  2157. var idx = this.__find__(name);
  2158. if (idx < 0) {
  2159. if (ignoreInvalid) { return; }
  2160. throw new Error('Rules manager: invalid rule name ' + name);
  2161. }
  2162. this.__rules__[idx].enabled = true;
  2163. result.push(name);
  2164. }, this);
  2165. this.__cache__ = null;
  2166. return result;
  2167. };
  2168. /**
  2169. * Ruler.enableOnly(list [, ignoreInvalid])
  2170. * - list (String|Array): list of rule names to enable (whitelist).
  2171. * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
  2172. *
  2173. * Enable rules with given names, and disable everything else. If any rule name
  2174. * not found - throw Error. Errors can be disabled by second param.
  2175. *
  2176. * See also [[Ruler.disable]], [[Ruler.enable]].
  2177. **/
  2178. Ruler.prototype.enableOnly = function (list, ignoreInvalid) {
  2179. if (!Array.isArray(list)) { list = [ list ]; }
  2180. this.__rules__.forEach(function (rule) { rule.enabled = false; });
  2181. this.enable(list, ignoreInvalid);
  2182. };
  2183. /**
  2184. * Ruler.disable(list [, ignoreInvalid]) -> Array
  2185. * - list (String|Array): list of rule names to disable.
  2186. * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
  2187. *
  2188. * Disable rules with given names. If any rule name not found - throw Error.
  2189. * Errors can be disabled by second param.
  2190. *
  2191. * Returns list of found rule names (if no exception happened).
  2192. *
  2193. * See also [[Ruler.enable]], [[Ruler.enableOnly]].
  2194. **/
  2195. Ruler.prototype.disable = function (list, ignoreInvalid) {
  2196. if (!Array.isArray(list)) { list = [ list ]; }
  2197. var result = [];
  2198. // Search by name and disable
  2199. list.forEach(function (name) {
  2200. var idx = this.__find__(name);
  2201. if (idx < 0) {
  2202. if (ignoreInvalid) { return; }
  2203. throw new Error('Rules manager: invalid rule name ' + name);
  2204. }
  2205. this.__rules__[idx].enabled = false;
  2206. result.push(name);
  2207. }, this);
  2208. this.__cache__ = null;
  2209. return result;
  2210. };
  2211. /**
  2212. * Ruler.getRules(chainName) -> Array
  2213. *
  2214. * Return array of active functions (rules) for given chain name. It analyzes
  2215. * rules configuration, compiles caches if not exists and returns result.
  2216. *
  2217. * Default chain name is `''` (empty string). It can't be skipped. That's
  2218. * done intentionally, to keep signature monomorphic for high speed.
  2219. **/
  2220. Ruler.prototype.getRules = function (chainName) {
  2221. if (this.__cache__ === null) {
  2222. this.__compile__();
  2223. }
  2224. // Chain can be empty, if rules disabled. But we still have to return Array.
  2225. return this.__cache__[chainName] || [];
  2226. };
  2227. module.exports = Ruler;
  2228. /***/ }),
  2229. /* 7 */
  2230. /***/ (function(module, exports, __webpack_require__) {
  2231. "use strict";
  2232. // Token class
  2233. /**
  2234. * class Token
  2235. **/
  2236. /**
  2237. * new Token(type, tag, nesting)
  2238. *
  2239. * Create new token and fill passed properties.
  2240. **/
  2241. function Token(type, tag, nesting) {
  2242. /**
  2243. * Token#type -> String
  2244. *
  2245. * Type of the token (string, e.g. "paragraph_open")
  2246. **/
  2247. this.type = type;
  2248. /**
  2249. * Token#tag -> String
  2250. *
  2251. * html tag name, e.g. "p"
  2252. **/
  2253. this.tag = tag;
  2254. /**
  2255. * Token#attrs -> Array
  2256. *
  2257. * Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]`
  2258. **/
  2259. this.attrs = null;
  2260. /**
  2261. * Token#map -> Array
  2262. *
  2263. * Source map info. Format: `[ line_begin, line_end ]`
  2264. **/
  2265. this.map = null;
  2266. /**
  2267. * Token#nesting -> Number
  2268. *
  2269. * Level change (number in {-1, 0, 1} set), where:
  2270. *
  2271. * - `1` means the tag is opening
  2272. * - `0` means the tag is self-closing
  2273. * - `-1` means the tag is closing
  2274. **/
  2275. this.nesting = nesting;
  2276. /**
  2277. * Token#level -> Number
  2278. *
  2279. * nesting level, the same as `state.level`
  2280. **/
  2281. this.level = 0;
  2282. /**
  2283. * Token#children -> Array
  2284. *
  2285. * An array of child nodes (inline and img tokens)
  2286. **/
  2287. this.children = null;
  2288. /**
  2289. * Token#content -> String
  2290. *
  2291. * In a case of self-closing tag (code, html, fence, etc.),
  2292. * it has contents of this tag.
  2293. **/
  2294. this.content = '';
  2295. /**
  2296. * Token#markup -> String
  2297. *
  2298. * '*' or '_' for emphasis, fence string for fence, etc.
  2299. **/
  2300. this.markup = '';
  2301. /**
  2302. * Token#info -> String
  2303. *
  2304. * fence infostring
  2305. **/
  2306. this.info = '';
  2307. /**
  2308. * Token#meta -> Object
  2309. *
  2310. * A place for plugins to store an arbitrary data
  2311. **/
  2312. this.meta = null;
  2313. /**
  2314. * Token#block -> Boolean
  2315. *
  2316. * True for block-level tokens, false for inline tokens.
  2317. * Used in renderer to calculate line breaks
  2318. **/
  2319. this.block = false;
  2320. /**
  2321. * Token#hidden -> Boolean
  2322. *
  2323. * If it's true, ignore this element when rendering. Used for tight lists
  2324. * to hide paragraphs.
  2325. **/
  2326. this.hidden = false;
  2327. }
  2328. /**
  2329. * Token.attrIndex(name) -> Number
  2330. *
  2331. * Search attribute index by name.
  2332. **/
  2333. Token.prototype.attrIndex = function attrIndex(name) {
  2334. var attrs, i, len;
  2335. if (!this.attrs) { return -1; }
  2336. attrs = this.attrs;
  2337. for (i = 0, len = attrs.length; i < len; i++) {
  2338. if (attrs[i][0] === name) { return i; }
  2339. }
  2340. return -1;
  2341. };
  2342. /**
  2343. * Token.attrPush(attrData)
  2344. *
  2345. * Add `[ name, value ]` attribute to list. Init attrs if necessary
  2346. **/
  2347. Token.prototype.attrPush = function attrPush(attrData) {
  2348. if (this.attrs) {
  2349. this.attrs.push(attrData);
  2350. } else {
  2351. this.attrs = [ attrData ];
  2352. }
  2353. };
  2354. /**
  2355. * Token.attrSet(name, value)
  2356. *
  2357. * Set `name` attribute to `value`. Override old value if exists.
  2358. **/
  2359. Token.prototype.attrSet = function attrSet(name, value) {
  2360. var idx = this.attrIndex(name),
  2361. attrData = [ name, value ];
  2362. if (idx < 0) {
  2363. this.attrPush(attrData);
  2364. } else {
  2365. this.attrs[idx] = attrData;
  2366. }
  2367. };
  2368. /**
  2369. * Token.attrGet(name)
  2370. *
  2371. * Get the value of attribute `name`, or null if it does not exist.
  2372. **/
  2373. Token.prototype.attrGet = function attrGet(name) {
  2374. var idx = this.attrIndex(name), value = null;
  2375. if (idx >= 0) {
  2376. value = this.attrs[idx][1];
  2377. }
  2378. return value;
  2379. };
  2380. /**
  2381. * Token.attrJoin(name, value)
  2382. *
  2383. * Join value to existing attribute via space. Or create new attribute if not
  2384. * exists. Useful to operate with token classes.
  2385. **/
  2386. Token.prototype.attrJoin = function attrJoin(name, value) {
  2387. var idx = this.attrIndex(name);
  2388. if (idx < 0) {
  2389. this.attrPush([ name, value ]);
  2390. } else {
  2391. this.attrs[idx][1] = this.attrs[idx][1] + ' ' + value;
  2392. }
  2393. };
  2394. module.exports = Token;
  2395. /***/ }),
  2396. /* 8 */
  2397. /***/ (function(module, exports, __webpack_require__) {
  2398. "use strict";
  2399. // Process footnotes
  2400. //
  2401. ////////////////////////////////////////////////////////////////////////////////
  2402. // Renderer partials
  2403. function render_footnote_anchor_name(tokens, idx, options, env/*, slf*/) {
  2404. var n = Number(tokens[idx].meta.id + 1).toString();
  2405. var prefix = '';
  2406. if (typeof env.docId === 'string') {
  2407. prefix = '-' + env.docId + '-';
  2408. }
  2409. return prefix + n;
  2410. }
  2411. function render_footnote_caption(tokens, idx/*, options, env, slf*/) {
  2412. var n = Number(tokens[idx].meta.id + 1).toString();
  2413. if (tokens[idx].meta.subId > 0) {
  2414. n += ':' + tokens[idx].meta.subId;
  2415. }
  2416. return '[' + n + ']';
  2417. }
  2418. function render_footnote_ref(tokens, idx, options, env, slf) {
  2419. var id = slf.rules.footnote_anchor_name(tokens, idx, options, env, slf);
  2420. var caption = slf.rules.footnote_caption(tokens, idx, options, env, slf);
  2421. var refid = id;
  2422. if (tokens[idx].meta.subId > 0) {
  2423. refid += ':' + tokens[idx].meta.subId;
  2424. }
  2425. return '<sup class="footnote-ref"><a href="#fn' + id + '" id="fnref' + refid + '">' + caption + '</a></sup>';
  2426. }
  2427. function render_footnote_block_open(tokens, idx, options) {
  2428. return (options.xhtmlOut ? '<hr class="footnotes-sep" />\n' : '<hr class="footnotes-sep">\n') +
  2429. '<section class="footnotes">\n' +
  2430. '<ol class="footnotes-list">\n';
  2431. }
  2432. function render_footnote_block_close() {
  2433. return '</ol>\n</section>\n';
  2434. }
  2435. function render_footnote_open(tokens, idx, options, env, slf) {
  2436. var id = slf.rules.footnote_anchor_name(tokens, idx, options, env, slf);
  2437. if (tokens[idx].meta.subId > 0) {
  2438. id += ':' + tokens[idx].meta.subId;
  2439. }
  2440. return '<li id="fn' + id + '" class="footnote-item">';
  2441. }
  2442. function render_footnote_close() {
  2443. return '</li>\n';
  2444. }
  2445. function render_footnote_anchor(tokens, idx, options, env, slf) {
  2446. var id = slf.rules.footnote_anchor_name(tokens, idx, options, env, slf);
  2447. if (tokens[idx].meta.subId > 0) {
  2448. id += ':' + tokens[idx].meta.subId;
  2449. }
  2450. /* ↩ with escape code to prevent display as Apple Emoji on iOS */
  2451. return ' <a href="#fnref' + id + '" class="footnote-backref">\u21a9\uFE0E</a>';
  2452. }
  2453. module.exports = function footnote_plugin(md) {
  2454. var parseLinkLabel = md.helpers.parseLinkLabel,
  2455. isSpace = md.utils.isSpace;
  2456. md.renderer.rules.footnote_ref = render_footnote_ref;
  2457. md.renderer.rules.footnote_block_open = render_footnote_block_open;
  2458. md.renderer.rules.footnote_block_close = render_footnote_block_close;
  2459. md.renderer.rules.footnote_open = render_footnote_open;
  2460. md.renderer.rules.footnote_close = render_footnote_close;
  2461. md.renderer.rules.footnote_anchor = render_footnote_anchor;
  2462. // helpers (only used in other rules, no tokens are attached to those)
  2463. md.renderer.rules.footnote_caption = render_footnote_caption;
  2464. md.renderer.rules.footnote_anchor_name = render_footnote_anchor_name;
  2465. // Process footnote block definition
  2466. function footnote_def(state, startLine, endLine, silent) {
  2467. var oldBMark, oldTShift, oldSCount, oldParentType, pos, label, token,
  2468. initial, offset, ch, posAfterColon,
  2469. start = state.bMarks[startLine] + state.tShift[startLine],
  2470. max = state.eMarks[startLine];
  2471. // line should be at least 5 chars - "[^x]:"
  2472. if (start + 4 > max) { return false; }
  2473. if (state.src.charCodeAt(start) !== 0x5B/* [ */) { return false; }
  2474. if (state.src.charCodeAt(start + 1) !== 0x5E/* ^ */) { return false; }
  2475. for (pos = start + 2; pos < max; pos++) {
  2476. if (state.src.charCodeAt(pos) === 0x20) { return false; }
  2477. if (state.src.charCodeAt(pos) === 0x5D /* ] */) {
  2478. break;
  2479. }
  2480. }
  2481. if (pos === start + 2) { return false; } // no empty footnote labels
  2482. if (pos + 1 >= max || state.src.charCodeAt(++pos) !== 0x3A /* : */) { return false; }
  2483. if (silent) { return true; }
  2484. pos++;
  2485. if (!state.env.footnotes) { state.env.footnotes = {}; }
  2486. if (!state.env.footnotes.refs) { state.env.footnotes.refs = {}; }
  2487. label = state.src.slice(start + 2, pos - 2);
  2488. state.env.footnotes.refs[':' + label] = -1;
  2489. token = new state.Token('footnote_reference_open', '', 1);
  2490. token.meta = { label: label };
  2491. token.level = state.level++;
  2492. state.tokens.push(token);
  2493. oldBMark = state.bMarks[startLine];
  2494. oldTShift = state.tShift[startLine];
  2495. oldSCount = state.sCount[startLine];
  2496. oldParentType = state.parentType;
  2497. posAfterColon = pos;
  2498. initial = offset = state.sCount[startLine] + pos - (state.bMarks[startLine] + state.tShift[startLine]);
  2499. while (pos < max) {
  2500. ch = state.src.charCodeAt(pos);
  2501. if (isSpace(ch)) {
  2502. if (ch === 0x09) {
  2503. offset += 4 - offset % 4;
  2504. } else {
  2505. offset++;
  2506. }
  2507. } else {
  2508. break;
  2509. }
  2510. pos++;
  2511. }
  2512. state.tShift[startLine] = pos - posAfterColon;
  2513. state.sCount[startLine] = offset - initial;
  2514. state.bMarks[startLine] = posAfterColon;
  2515. state.blkIndent += 4;
  2516. state.parentType = 'footnote';
  2517. if (state.sCount[startLine] < state.blkIndent) {
  2518. state.sCount[startLine] += state.blkIndent;
  2519. }
  2520. state.md.block.tokenize(state, startLine, endLine, true);
  2521. state.parentType = oldParentType;
  2522. state.blkIndent -= 4;
  2523. state.tShift[startLine] = oldTShift;
  2524. state.sCount[startLine] = oldSCount;
  2525. state.bMarks[startLine] = oldBMark;
  2526. token = new state.Token('footnote_reference_close', '', -1);
  2527. token.level = --state.level;
  2528. state.tokens.push(token);
  2529. return true;
  2530. }
  2531. // Process inline footnotes (^[...])
  2532. function footnote_inline(state, silent) {
  2533. var labelStart,
  2534. labelEnd,
  2535. footnoteId,
  2536. token,
  2537. tokens,
  2538. max = state.posMax,
  2539. start = state.pos;
  2540. if (start + 2 >= max) { return false; }
  2541. if (state.src.charCodeAt(start) !== 0x5E/* ^ */) { return false; }
  2542. if (state.src.charCodeAt(start + 1) !== 0x5B/* [ */) { return false; }
  2543. labelStart = start + 2;
  2544. labelEnd = parseLinkLabel(state, start + 1);
  2545. // parser failed to find ']', so it's not a valid note
  2546. if (labelEnd < 0) { return false; }
  2547. // We found the end of the link, and know for a fact it's a valid link;
  2548. // so all that's left to do is to call tokenizer.
  2549. //
  2550. if (!silent) {
  2551. if (!state.env.footnotes) { state.env.footnotes = {}; }
  2552. if (!state.env.footnotes.list) { state.env.footnotes.list = []; }
  2553. footnoteId = state.env.footnotes.list.length;
  2554. state.md.inline.parse(
  2555. state.src.slice(labelStart, labelEnd),
  2556. state.md,
  2557. state.env,
  2558. tokens = []
  2559. );
  2560. token = state.push('footnote_ref', '', 0);
  2561. token.meta = { id: footnoteId };
  2562. state.env.footnotes.list[footnoteId] = { tokens: tokens };
  2563. }
  2564. state.pos = labelEnd + 1;
  2565. state.posMax = max;
  2566. return true;
  2567. }
  2568. // Process footnote references ([^...])
  2569. function footnote_ref(state, silent) {
  2570. var label,
  2571. pos,
  2572. footnoteId,
  2573. footnoteSubId,
  2574. token,
  2575. max = state.posMax,
  2576. start = state.pos;
  2577. // should be at least 4 chars - "[^x]"
  2578. if (start + 3 > max) { return false; }
  2579. if (!state.env.footnotes || !state.env.footnotes.refs) { return false; }
  2580. if (state.src.charCodeAt(start) !== 0x5B/* [ */) { return false; }
  2581. if (state.src.charCodeAt(start + 1) !== 0x5E/* ^ */) { return false; }
  2582. for (pos = start + 2; pos < max; pos++) {
  2583. if (state.src.charCodeAt(pos) === 0x20) { return false; }
  2584. if (state.src.charCodeAt(pos) === 0x0A) { return false; }
  2585. if (state.src.charCodeAt(pos) === 0x5D /* ] */) {
  2586. break;
  2587. }
  2588. }
  2589. if (pos === start + 2) { return false; } // no empty footnote labels
  2590. if (pos >= max) { return false; }
  2591. pos++;
  2592. label = state.src.slice(start + 2, pos - 1);
  2593. if (typeof state.env.footnotes.refs[':' + label] === 'undefined') { return false; }
  2594. if (!silent) {
  2595. if (!state.env.footnotes.list) { state.env.footnotes.list = []; }
  2596. if (state.env.footnotes.refs[':' + label] < 0) {
  2597. footnoteId = state.env.footnotes.list.length;
  2598. state.env.footnotes.list[footnoteId] = { label: label, count: 0 };
  2599. state.env.footnotes.refs[':' + label] = footnoteId;
  2600. } else {
  2601. footnoteId = state.env.footnotes.refs[':' + label];
  2602. }
  2603. footnoteSubId = state.env.footnotes.list[footnoteId].count;
  2604. state.env.footnotes.list[footnoteId].count++;
  2605. token = state.push('footnote_ref', '', 0);
  2606. token.meta = { id: footnoteId, subId: footnoteSubId, label: label };
  2607. }
  2608. state.pos = pos;
  2609. state.posMax = max;
  2610. return true;
  2611. }
  2612. // Glue footnote tokens to end of token stream
  2613. function footnote_tail(state) {
  2614. var i, l, j, t, lastParagraph, list, token, tokens, current, currentLabel,
  2615. insideRef = false,
  2616. refTokens = {};
  2617. if (!state.env.footnotes) { return; }
  2618. state.tokens = state.tokens.filter(function (tok) {
  2619. if (tok.type === 'footnote_reference_open') {
  2620. insideRef = true;
  2621. current = [];
  2622. currentLabel = tok.meta.label;
  2623. return false;
  2624. }
  2625. if (tok.type === 'footnote_reference_close') {
  2626. insideRef = false;
  2627. // prepend ':' to avoid conflict with Object.prototype members
  2628. refTokens[':' + currentLabel] = current;
  2629. return false;
  2630. }
  2631. if (insideRef) { current.push(tok); }
  2632. return !insideRef;
  2633. });
  2634. if (!state.env.footnotes.list) { return; }
  2635. list = state.env.footnotes.list;
  2636. token = new state.Token('footnote_block_open', '', 1);
  2637. state.tokens.push(token);
  2638. for (i = 0, l = list.length; i < l; i++) {
  2639. token = new state.Token('footnote_open', '', 1);
  2640. token.meta = { id: i, label: list[i].label };
  2641. state.tokens.push(token);
  2642. if (list[i].tokens) {
  2643. tokens = [];
  2644. token = new state.Token('paragraph_open', 'p', 1);
  2645. token.block = true;
  2646. tokens.push(token);
  2647. token = new state.Token('inline', '', 0);
  2648. token.children = list[i].tokens;
  2649. token.content = '';
  2650. tokens.push(token);
  2651. token = new state.Token('paragraph_close', 'p', -1);
  2652. token.block = true;
  2653. tokens.push(token);
  2654. } else if (list[i].label) {
  2655. tokens = refTokens[':' + list[i].label];
  2656. }
  2657. state.tokens = state.tokens.concat(tokens);
  2658. if (state.tokens[state.tokens.length - 1].type === 'paragraph_close') {
  2659. lastParagraph = state.tokens.pop();
  2660. } else {
  2661. lastParagraph = null;
  2662. }
  2663. t = list[i].count > 0 ? list[i].count : 1;
  2664. for (j = 0; j < t; j++) {
  2665. token = new state.Token('footnote_anchor', '', 0);
  2666. token.meta = { id: i, subId: j, label: list[i].label };
  2667. state.tokens.push(token);
  2668. }
  2669. if (lastParagraph) {
  2670. state.tokens.push(lastParagraph);
  2671. }
  2672. token = new state.Token('footnote_close', '', -1);
  2673. state.tokens.push(token);
  2674. }
  2675. token = new state.Token('footnote_block_close', '', -1);
  2676. state.tokens.push(token);
  2677. }
  2678. md.block.ruler.before('reference', 'footnote_def', footnote_def, { alt: [ 'paragraph', 'reference' ] });
  2679. md.inline.ruler.after('image', 'footnote_inline', footnote_inline);
  2680. md.inline.ruler.after('footnote_inline', 'footnote_ref', footnote_ref);
  2681. md.core.ruler.after('inline', 'footnote_tail', footnote_tail);
  2682. };
  2683. /***/ }),
  2684. /* 9 */
  2685. /***/ (function(module, exports) {
  2686. module.exports = {
  2687. t(key){
  2688. if(this.locales[key]){
  2689. if(this.lang){
  2690. if(this.locales[key][this.lang]){
  2691. return this.locales[key][this.lang];// key for current language
  2692. }else{this.log(`Key "${key}" does not exists for language ${this.lang}`);}
  2693. }else if(this.locales[key][this.fallback]){
  2694. return this.locales[key][this.fallback];// key for fallback language
  2695. }else{this.log(`Key "${key}" does not exists for fallback language ${this.fallback}`);}
  2696. }else{this.log(`Key "${key}" does not exists.`);}
  2697. return key;// if nothing else retrn key it self
  2698. },
  2699. setLang(l){
  2700. this.lang = l
  2701. },
  2702. log(msg){
  2703. console.log(`i18n : ${msg}`);
  2704. },
  2705. fallback:'en',
  2706. lang: null,
  2707. locales:{
  2708. 'Parts':{
  2709. 'en':'Parts',
  2710. 'fr':'Parties',
  2711. 'bra':'Peças',
  2712. 'lat':'Pars'
  2713. },
  2714. 'Mode':{
  2715. 'en':'Mode',
  2716. 'fr':'Mode',
  2717. 'bra':'Modo',
  2718. 'lat':'Modus'
  2719. },
  2720. 'Language':{
  2721. 'en':'Language',
  2722. 'fr':'Langue',
  2723. 'bra':'Língua',
  2724. 'lat':'Lingua'
  2725. },
  2726. 'Text':{
  2727. 'en':'Text',
  2728. 'fr':'Texte',
  2729. 'bra':'Texto',
  2730. 'lat':'Illud'
  2731. },
  2732. 'Connections':{
  2733. 'en':'Connections',
  2734. 'fr':'Connections',
  2735. 'bra':'Conexões',
  2736. 'lat':'Hospites'
  2737. },
  2738. }
  2739. }
  2740. /***/ }),
  2741. /* 10 */
  2742. /***/ (function(module, exports, __webpack_require__) {
  2743. var m = __webpack_require__(1);
  2744. var _dbs = __webpack_require__(3);
  2745. var _i18n = __webpack_require__(9);
  2746. var markdown = __webpack_require__(4)()
  2747. .use(__webpack_require__(8));
  2748. // import * as i18next from 'i18next';
  2749. // __ __ __
  2750. // / / / /__ ____ _____/ /__ _____
  2751. // / /_/ / _ \/ __ `/ __ / _ \/ ___/
  2752. // / __ / __/ /_/ / /_/ / __/ /
  2753. // /_/ /_/\___/\__,_/\__,_/\___/_/
  2754. module.exports = {
  2755. // onupdate(vn){
  2756. // // console.log("Header onupdate : vn", vn);
  2757. // },
  2758. view(vn){
  2759. // console.log("Header view : vn", vn);
  2760. return m('header', [
  2761. m('hgroup', [
  2762. m('h1', 'Ethica'),
  2763. m('h2', 'Spinoza (1632-1677)')
  2764. ]),
  2765. m('div', {'id':"menus"}, [
  2766. m(_PartsNav),
  2767. m(_RouteMenu),
  2768. m(_LangMenu)
  2769. ])
  2770. ]);
  2771. }
  2772. }
  2773. // ____ __
  2774. // / __ \____ ______/ /______ ____ ___ ___ ____ __ __
  2775. // / /_/ / __ `/ ___/ __/ ___/ / __ `__ \/ _ \/ __ \/ / / /
  2776. // / ____/ /_/ / / / /_(__ ) / / / / / / __/ / / / /_/ /
  2777. // /_/ \__,_/_/ \__/____/ /_/ /_/ /_/\___/_/ /_/\__,_/
  2778. var _PartsNav = {
  2779. view(vn){
  2780. var lang = m.route.param('lang');
  2781. // console.log('partsmenu', lang);
  2782. return m('nav', {id:'parts-nav'}, [
  2783. // TODO: replaced labels with localized content
  2784. m('h3', _i18n.t('Parts')),
  2785. m('ul', _dbs.data[lang].map(function(p){
  2786. // console.log("anchors, part", p);
  2787. if(p.id !== "intro"){
  2788. return m('li', [
  2789. m('a', {'href':'#'+p.id}, m.trust(markdown.renderInline(p.title)))
  2790. ]);
  2791. }
  2792. })
  2793. )
  2794. ]);
  2795. }
  2796. };
  2797. // ____ __
  2798. // / __ \____ __ __/ /____ ____ ___ ___ ____ __ __
  2799. // / /_/ / __ \/ / / / __/ _ \ / __ `__ \/ _ \/ __ \/ / / /
  2800. // / _, _/ /_/ / /_/ / /_/ __/ / / / / / / __/ / / / /_/ /
  2801. // /_/ |_|\____/\__,_/\__/\___/ /_/ /_/ /_/\___/_/ /_/\__,_/
  2802. var _RouteMenu = {
  2803. view(){
  2804. var lang = m.route.param('lang');
  2805. var path = m.route.get().match(/^(\/[^\/]+)(\/[^\/|#]+)(.*)$/);
  2806. // console.log('Route menu Path', path);
  2807. return m('nav', {id:'routes'}, [
  2808. // TODO: replaced labels with localized content
  2809. m('h3', _i18n.t('Mode')),
  2810. m('ul', [
  2811. m('li', m('a', {
  2812. 'href':`/${lang}/text${path[3]}`,
  2813. oncreate : m.route.link,
  2814. onupdate : m.route.link
  2815. }, _i18n.t("Text"))),
  2816. m('li', m('a', {
  2817. 'href':`/${lang}/connections${path[3]}`,
  2818. oncreate : m.route.link,
  2819. onupdate : m.route.link
  2820. }, _i18n.t("Connections"))),
  2821. ])
  2822. ]);
  2823. }
  2824. }
  2825. // __ __ ___
  2826. // / / ____ _____ ____ _/ |/ /__ ____ __ __
  2827. // / / / __ `/ __ \/ __ `/ /|_/ / _ \/ __ \/ / / /
  2828. // / /___/ /_/ / / / / /_/ / / / / __/ / / / /_/ /
  2829. // /_____/\__,_/_/ /_/\__, /_/ /_/\___/_/ /_/\__,_/
  2830. // /____/
  2831. var _LangMenu = {
  2832. view(){
  2833. var path = m.route.get().match(/^\/[^\/]+(.+)$/);
  2834. // console.log('Lang menu Path', path);
  2835. // create ul dom
  2836. // console.log("Header _LangMenu view : i18next", i18next);
  2837. return m('nav', {id:'languages'}, [
  2838. // TODO: replaced labels with localized content
  2839. m('h3', _i18n.t('Language')),
  2840. m('ul', _dbs.langs.map(lang => {
  2841. // create li dom for each lang link
  2842. return m('li', m('a', {
  2843. 'lang':lang.lc,
  2844. 'href':`/${lang.lc}${path[1]}`,
  2845. oncreate : m.route.link,
  2846. onupdate : m.route.link
  2847. }, lang.label)
  2848. );
  2849. }))
  2850. ]);
  2851. }
  2852. }
  2853. /***/ }),
  2854. /* 11 */
  2855. /***/ (function(module, exports, __webpack_require__) {
  2856. "use strict";
  2857. // HTML5 entities map: { name -> utf16string }
  2858. //
  2859. /*eslint quotes:0*/
  2860. module.exports = __webpack_require__(31);
  2861. /***/ }),
  2862. /* 12 */
  2863. /***/ (function(module, exports, __webpack_require__) {
  2864. "use strict";
  2865. module.exports.encode = __webpack_require__(32);
  2866. module.exports.decode = __webpack_require__(33);
  2867. module.exports.format = __webpack_require__(34);
  2868. module.exports.parse = __webpack_require__(35);
  2869. /***/ }),
  2870. /* 13 */
  2871. /***/ (function(module, exports) {
  2872. module.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/
  2873. /***/ }),
  2874. /* 14 */
  2875. /***/ (function(module, exports) {
  2876. module.exports=/[\0-\x1F\x7F-\x9F]/
  2877. /***/ }),
  2878. /* 15 */
  2879. /***/ (function(module, exports) {
  2880. module.exports=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/
  2881. /***/ }),
  2882. /* 16 */
  2883. /***/ (function(module, exports, __webpack_require__) {
  2884. "use strict";
  2885. // Regexps to match html elements
  2886. var attr_name = '[a-zA-Z_:][a-zA-Z0-9:._-]*';
  2887. var unquoted = '[^"\'=<>`\\x00-\\x20]+';
  2888. var single_quoted = "'[^']*'";
  2889. var double_quoted = '"[^"]*"';
  2890. var attr_value = '(?:' + unquoted + '|' + single_quoted + '|' + double_quoted + ')';
  2891. var attribute = '(?:\\s+' + attr_name + '(?:\\s*=\\s*' + attr_value + ')?)';
  2892. var open_tag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>';
  2893. var close_tag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>';
  2894. var comment = '<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->';
  2895. var processing = '<[?].*?[?]>';
  2896. var declaration = '<![A-Z]+\\s+[^>]*>';
  2897. var cdata = '<!\\[CDATA\\[[\\s\\S]*?\\]\\]>';
  2898. var HTML_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + '|' + comment +
  2899. '|' + processing + '|' + declaration + '|' + cdata + ')');
  2900. var HTML_OPEN_CLOSE_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + ')');
  2901. module.exports.HTML_TAG_RE = HTML_TAG_RE;
  2902. module.exports.HTML_OPEN_CLOSE_TAG_RE = HTML_OPEN_CLOSE_TAG_RE;
  2903. /***/ }),
  2904. /* 17 */
  2905. /***/ (function(module, exports, __webpack_require__) {
  2906. "use strict";
  2907. // ~~strike through~~
  2908. //
  2909. // Insert each marker as a separate text token, and add it to delimiter list
  2910. //
  2911. module.exports.tokenize = function strikethrough(state, silent) {
  2912. var i, scanned, token, len, ch,
  2913. start = state.pos,
  2914. marker = state.src.charCodeAt(start);
  2915. if (silent) { return false; }
  2916. if (marker !== 0x7E/* ~ */) { return false; }
  2917. scanned = state.scanDelims(state.pos, true);
  2918. len = scanned.length;
  2919. ch = String.fromCharCode(marker);
  2920. if (len < 2) { return false; }
  2921. if (len % 2) {
  2922. token = state.push('text', '', 0);
  2923. token.content = ch;
  2924. len--;
  2925. }
  2926. for (i = 0; i < len; i += 2) {
  2927. token = state.push('text', '', 0);
  2928. token.content = ch + ch;
  2929. state.delimiters.push({
  2930. marker: marker,
  2931. jump: i,
  2932. token: state.tokens.length - 1,
  2933. level: state.level,
  2934. end: -1,
  2935. open: scanned.can_open,
  2936. close: scanned.can_close
  2937. });
  2938. }
  2939. state.pos += scanned.length;
  2940. return true;
  2941. };
  2942. // Walk through delimiter list and replace text tokens with tags
  2943. //
  2944. module.exports.postProcess = function strikethrough(state) {
  2945. var i, j,
  2946. startDelim,
  2947. endDelim,
  2948. token,
  2949. loneMarkers = [],
  2950. delimiters = state.delimiters,
  2951. max = state.delimiters.length;
  2952. for (i = 0; i < max; i++) {
  2953. startDelim = delimiters[i];
  2954. if (startDelim.marker !== 0x7E/* ~ */) {
  2955. continue;
  2956. }
  2957. if (startDelim.end === -1) {
  2958. continue;
  2959. }
  2960. endDelim = delimiters[startDelim.end];
  2961. token = state.tokens[startDelim.token];
  2962. token.type = 's_open';
  2963. token.tag = 's';
  2964. token.nesting = 1;
  2965. token.markup = '~~';
  2966. token.content = '';
  2967. token = state.tokens[endDelim.token];
  2968. token.type = 's_close';
  2969. token.tag = 's';
  2970. token.nesting = -1;
  2971. token.markup = '~~';
  2972. token.content = '';
  2973. if (state.tokens[endDelim.token - 1].type === 'text' &&
  2974. state.tokens[endDelim.token - 1].content === '~') {
  2975. loneMarkers.push(endDelim.token - 1);
  2976. }
  2977. }
  2978. // If a marker sequence has an odd number of characters, it's splitted
  2979. // like this: `~~~~~` -> `~` + `~~` + `~~`, leaving one marker at the
  2980. // start of the sequence.
  2981. //
  2982. // So, we have to move all those markers after subsequent s_close tags.
  2983. //
  2984. while (loneMarkers.length) {
  2985. i = loneMarkers.pop();
  2986. j = i + 1;
  2987. while (j < state.tokens.length && state.tokens[j].type === 's_close') {
  2988. j++;
  2989. }
  2990. j--;
  2991. if (i !== j) {
  2992. token = state.tokens[j];
  2993. state.tokens[j] = state.tokens[i];
  2994. state.tokens[i] = token;
  2995. }
  2996. }
  2997. };
  2998. /***/ }),
  2999. /* 18 */
  3000. /***/ (function(module, exports, __webpack_require__) {
  3001. "use strict";
  3002. // Process *this* and _that_
  3003. //
  3004. // Insert each marker as a separate text token, and add it to delimiter list
  3005. //
  3006. module.exports.tokenize = function emphasis(state, silent) {
  3007. var i, scanned, token,
  3008. start = state.pos,
  3009. marker = state.src.charCodeAt(start);
  3010. if (silent) { return false; }
  3011. if (marker !== 0x5F /* _ */ && marker !== 0x2A /* * */) { return false; }
  3012. scanned = state.scanDelims(state.pos, marker === 0x2A);
  3013. for (i = 0; i < scanned.length; i++) {
  3014. token = state.push('text', '', 0);
  3015. token.content = String.fromCharCode(marker);
  3016. state.delimiters.push({
  3017. // Char code of the starting marker (number).
  3018. //
  3019. marker: marker,
  3020. // Total length of these series of delimiters.
  3021. //
  3022. length: scanned.length,
  3023. // An amount of characters before this one that's equivalent to
  3024. // current one. In plain English: if this delimiter does not open
  3025. // an emphasis, neither do previous `jump` characters.
  3026. //
  3027. // Used to skip sequences like "*****" in one step, for 1st asterisk
  3028. // value will be 0, for 2nd it's 1 and so on.
  3029. //
  3030. jump: i,
  3031. // A position of the token this delimiter corresponds to.
  3032. //
  3033. token: state.tokens.length - 1,
  3034. // Token level.
  3035. //
  3036. level: state.level,
  3037. // If this delimiter is matched as a valid opener, `end` will be
  3038. // equal to its position, otherwise it's `-1`.
  3039. //
  3040. end: -1,
  3041. // Boolean flags that determine if this delimiter could open or close
  3042. // an emphasis.
  3043. //
  3044. open: scanned.can_open,
  3045. close: scanned.can_close
  3046. });
  3047. }
  3048. state.pos += scanned.length;
  3049. return true;
  3050. };
  3051. // Walk through delimiter list and replace text tokens with tags
  3052. //
  3053. module.exports.postProcess = function emphasis(state) {
  3054. var i,
  3055. startDelim,
  3056. endDelim,
  3057. token,
  3058. ch,
  3059. isStrong,
  3060. delimiters = state.delimiters,
  3061. max = state.delimiters.length;
  3062. for (i = max - 1; i >= 0; i--) {
  3063. startDelim = delimiters[i];
  3064. if (startDelim.marker !== 0x5F/* _ */ && startDelim.marker !== 0x2A/* * */) {
  3065. continue;
  3066. }
  3067. // Process only opening markers
  3068. if (startDelim.end === -1) {
  3069. continue;
  3070. }
  3071. endDelim = delimiters[startDelim.end];
  3072. // If the previous delimiter has the same marker and is adjacent to this one,
  3073. // merge those into one strong delimiter.
  3074. //
  3075. // `<em><em>whatever</em></em>` -> `<strong>whatever</strong>`
  3076. //
  3077. isStrong = i > 0 &&
  3078. delimiters[i - 1].end === startDelim.end + 1 &&
  3079. delimiters[i - 1].token === startDelim.token - 1 &&
  3080. delimiters[startDelim.end + 1].token === endDelim.token + 1 &&
  3081. delimiters[i - 1].marker === startDelim.marker;
  3082. ch = String.fromCharCode(startDelim.marker);
  3083. token = state.tokens[startDelim.token];
  3084. token.type = isStrong ? 'strong_open' : 'em_open';
  3085. token.tag = isStrong ? 'strong' : 'em';
  3086. token.nesting = 1;
  3087. token.markup = isStrong ? ch + ch : ch;
  3088. token.content = '';
  3089. token = state.tokens[endDelim.token];
  3090. token.type = isStrong ? 'strong_close' : 'em_close';
  3091. token.tag = isStrong ? 'strong' : 'em';
  3092. token.nesting = -1;
  3093. token.markup = isStrong ? ch + ch : ch;
  3094. token.content = '';
  3095. if (isStrong) {
  3096. state.tokens[delimiters[i - 1].token].content = '';
  3097. state.tokens[delimiters[startDelim.end + 1].token].content = '';
  3098. i--;
  3099. }
  3100. }
  3101. };
  3102. /***/ }),
  3103. /* 19 */
  3104. /***/ (function(module, exports, __webpack_require__) {
  3105. var m = __webpack_require__(1);
  3106. // ____ __
  3107. // / __/___ ____ / /____ _____
  3108. // / /_/ __ \/ __ \/ __/ _ \/ ___/
  3109. // / __/ /_/ / /_/ / /_/ __/ /
  3110. // /_/ \____/\____/\__/\___/_/
  3111. module.exports = {
  3112. view(vn){
  3113. return m('footer', [
  3114. m('p', m.trust('© 2017 <a href="./">Ethica Spinoza</a>'))
  3115. ]);
  3116. }
  3117. }
  3118. /***/ }),
  3119. /* 20 */
  3120. /***/ (function(module, exports) {
  3121. /**
  3122. * @Author: Bachir Soussi Chiadmi <bach>
  3123. * @Date: 12-09-2017
  3124. * @Email: bachir@figureslibres.io
  3125. * @Last modified by: bach
  3126. * @Last modified time: 12-09-2017
  3127. * @License: GPL-V3
  3128. */
  3129. // https://plainjs.com
  3130. module.exports = {
  3131. init(){
  3132. // console.log('UI init');
  3133. this.initStickyTitles();
  3134. },
  3135. initStickyTitles(){
  3136. // _____ __ _ __ __ _ __ __
  3137. // / ___// /_(_)____/ /____ __ / /_(_) /_/ /__
  3138. // \__ \/ __/ / ___/ //_/ / / / / __/ / __/ / _ \
  3139. // ___/ / /_/ / /__/ ,< / /_/ / / /_/ / /_/ / __/
  3140. // /____/\__/_/\___/_/|_|\__, / \__/_/\__/_/\___/
  3141. // /____/
  3142. // https://codepen.io/chrissp26/pen/gBrdo?editors=0010
  3143. // let header_height = $('header').height();
  3144. let header_height = document.getElementsByTagName('header')[0].clientHeight;
  3145. // console.log(header_height);
  3146. // create the stkd titles wrapper block
  3147. var stkd_wrapper = document.querySelector('.sticky-clone-wrapper');
  3148. if(!stkd_wrapper){
  3149. var stkd_wrapper = document.createElement('div');
  3150. stkd_wrapper.classList.add('sticky-clone-wrapper');
  3151. document.body.append(stkd_wrapper);
  3152. }
  3153. // get all part title
  3154. var part_titles = new Array();
  3155. Array.from(document.querySelectorAll('h1.part-title')).forEach(function(e){
  3156. e._part = e.getAttribute('part');
  3157. part_titles.push(e)
  3158. });
  3159. // console.log('part_titles', part_titles);
  3160. var stkd_part,
  3161. last_stkd_part = false,
  3162. subparts,
  3163. stkd_subpart,
  3164. last_stkd_subpart = false,
  3165. clone;
  3166. let OnScroll = function(event){
  3167. // console.log('on scrool', event);
  3168. stkd_part = false;
  3169. for (let i = part_titles.length-1; i >= 0; i--) {
  3170. if(part_titles[i].getBoundingClientRect().top < header_height){
  3171. stkd_part = part_titles[i];
  3172. // console.log("stkd_part");
  3173. break;
  3174. }
  3175. }
  3176. if (stkd_part) {
  3177. // console.log('got stkd_part', stkd_part._part);
  3178. if(stkd_part._part !== last_stkd_part._part){
  3179. // console.log('new sticky', stkd_part.innerHTML);
  3180. // clone only once
  3181. clone = stkd_part.cloneNode(true);
  3182. stkd_wrapper.innerHTML = '';
  3183. // fill stkd_wrapper
  3184. stkd_wrapper.appendChild(clone);
  3185. last_stkd_part = stkd_part;
  3186. // // get all subpart title only once
  3187. // let part_wrapper = stkd_part.parentNode;
  3188. // subparts = new Array();
  3189. // Array.from(part_wrapper.querySelectorAll('h2.title')).forEach(function(e){
  3190. // subparts.push(e)
  3191. // });
  3192. // // console.log('subparts', subparts);
  3193. }
  3194. // // subtitle
  3195. // stkd_subpart = false;
  3196. // for (let i = subparts.length-1; i >= 0; i--) {
  3197. // if(subparts[i].getBoundingClientRect().top < header_height + stkd_part.clientHeight){
  3198. // stkd_subpart = subparts[i];
  3199. // break;
  3200. // }
  3201. // }
  3202. //
  3203. // if (stkd_subpart){
  3204. // if( stkd_subpart.innerHTML !== last_stkd_subpart.innerHTML ){
  3205. // console.log("new stkd_subpart "+stkd_subpart.innerHTML);
  3206. // clone = stkd_subpart.cloneNode(true);
  3207. // // stkd_wrapper.lastChild.remove();
  3208. // stkd_wrapper.appendChild(clone);
  3209. // last_stkd_subpart = stkd_subpart;
  3210. // }
  3211. // }else{
  3212. // // stkd_wrapper.lastChild.remove();
  3213. // stkd_subpart = last_stkd_subpart = false;
  3214. // }
  3215. }else{
  3216. // empty stkd_wrapper
  3217. stkd_wrapper.innerHTML = '';
  3218. stkd_part = last_stkd_part = false;
  3219. }
  3220. };
  3221. //
  3222. // $window.on('scroll', OnScroll);
  3223. // console.log('window', window);
  3224. window.onscroll = OnScroll;
  3225. }
  3226. }
  3227. /***/ }),
  3228. /* 21 */
  3229. /***/ (function(module, exports, __webpack_require__) {
  3230. __webpack_require__(22);
  3231. module.exports = __webpack_require__(87);
  3232. /***/ }),
  3233. /* 22 */
  3234. /***/ (function(module, exports, __webpack_require__) {
  3235. /**
  3236. * @Author: Bachir Soussi Chiadmi <bach>
  3237. * @Date: 16-04-2017
  3238. * @Email: bachir@figureslibres.io
  3239. * @Last modified by: bach
  3240. * @Last modified time: 18-04-2017
  3241. * @License: GPL-V3
  3242. */
  3243. __webpack_require__(23);
  3244. __webpack_require__(24);
  3245. __webpack_require__(25);
  3246. __webpack_require__(26);
  3247. const m = __webpack_require__(1);
  3248. // var marked = require('marked');
  3249. // var _helpers = require('modules/helpers');
  3250. const _dbs = __webpack_require__(3);
  3251. const _i18n = __webpack_require__(9);
  3252. const _Header = __webpack_require__(10);
  3253. const _Footer = __webpack_require__(19);
  3254. const _ModeText = __webpack_require__(85);
  3255. const _ModeConnections = __webpack_require__(86);
  3256. var Layout = {
  3257. view(vn){
  3258. // console.log('Layout view : lang', vn.attrs.lang);
  3259. _i18n.setLang(vn.attrs.lang);
  3260. return [
  3261. m(_Header, vn.attrs),
  3262. vn.children,
  3263. m(_Footer, vn.attrs)
  3264. ]
  3265. }
  3266. }
  3267. function init(){
  3268. _dbs.load(function(){
  3269. console.log('init dbs callback');
  3270. console.log("Init _dbs.data", _dbs.data);
  3271. console.log("Init _dbs.data_byid", _dbs.data_byid);
  3272. console.log("Init _dbs.data_strct", _dbs.data_strct);
  3273. m.route.prefix("");
  3274. m.route(document.body, "/fr/connections", {
  3275. "/:lang/text": {
  3276. render(vn){
  3277. // console.log('Routing render : vn', vn);
  3278. return m(Layout, vn.attrs, m(_ModeText, vn.attrs));
  3279. }
  3280. },
  3281. "/:lang/connections": {
  3282. render(vn){
  3283. return m(Layout, vn.attrs, m(_ModeConnections, vn.attrs));
  3284. }
  3285. }
  3286. });
  3287. });
  3288. };
  3289. // ___
  3290. // / | ____ ____
  3291. // / /| | / __ \/ __ \
  3292. // / ___ |/ /_/ / /_/ /
  3293. // /_/ |_/ .___/ .___/
  3294. // /_/ /_/
  3295. // var _App = {
  3296. // view(){
  3297. // console.log('_App view', _lang);
  3298. // return [
  3299. // m('header', [
  3300. // m('h1', 'Ethica'),
  3301. // m('aside', {'id':"menus"}, m(_LangMenu) )
  3302. // ]),
  3303. // m(_Tree),
  3304. // m('footer', [
  3305. // m('p', m.trust('© 2017 <a href="./">Ethica Spinoza</a>'))
  3306. // ])
  3307. // ]
  3308. // }
  3309. // }
  3310. // _ _ __
  3311. // (_)___ (_) /_
  3312. // / / __ \/ / __/
  3313. // / / / / / / /_
  3314. // /_/_/ /_/_/\__/
  3315. init()
  3316. /***/ }),
  3317. /* 23 */
  3318. /***/ (function(module, exports) {
  3319. // removed by extract-text-webpack-plugin
  3320. /***/ }),
  3321. /* 24 */
  3322. /***/ (function(module, exports) {
  3323. // removed by extract-text-webpack-plugin
  3324. /***/ }),
  3325. /* 25 */
  3326. /***/ (function(module, exports) {
  3327. // removed by extract-text-webpack-plugin
  3328. /***/ }),
  3329. /* 26 */
  3330. /***/ (function(module, exports) {
  3331. // removed by extract-text-webpack-plugin
  3332. /***/ }),
  3333. /* 27 */
  3334. /***/ (function(module, exports, __webpack_require__) {
  3335. /* WEBPACK VAR INJECTION */(function(global) {var apply = Function.prototype.apply;
  3336. // DOM APIs, for completeness
  3337. exports.setTimeout = function() {
  3338. return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
  3339. };
  3340. exports.setInterval = function() {
  3341. return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
  3342. };
  3343. exports.clearTimeout =
  3344. exports.clearInterval = function(timeout) {
  3345. if (timeout) {
  3346. timeout.close();
  3347. }
  3348. };
  3349. function Timeout(id, clearFn) {
  3350. this._id = id;
  3351. this._clearFn = clearFn;
  3352. }
  3353. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  3354. Timeout.prototype.close = function() {
  3355. this._clearFn.call(window, this._id);
  3356. };
  3357. // Does not start the time, just sets up the members needed.
  3358. exports.enroll = function(item, msecs) {
  3359. clearTimeout(item._idleTimeoutId);
  3360. item._idleTimeout = msecs;
  3361. };
  3362. exports.unenroll = function(item) {
  3363. clearTimeout(item._idleTimeoutId);
  3364. item._idleTimeout = -1;
  3365. };
  3366. exports._unrefActive = exports.active = function(item) {
  3367. clearTimeout(item._idleTimeoutId);
  3368. var msecs = item._idleTimeout;
  3369. if (msecs >= 0) {
  3370. item._idleTimeoutId = setTimeout(function onTimeout() {
  3371. if (item._onTimeout)
  3372. item._onTimeout();
  3373. }, msecs);
  3374. }
  3375. };
  3376. // setimmediate attaches itself to the global object
  3377. __webpack_require__(28);
  3378. // On some exotic environments, it's not clear which object `setimmeidate` was
  3379. // able to install onto. Search each possibility in the same order as the
  3380. // `setimmediate` library.
  3381. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  3382. (typeof global !== "undefined" && global.setImmediate) ||
  3383. (this && this.setImmediate);
  3384. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  3385. (typeof global !== "undefined" && global.clearImmediate) ||
  3386. (this && this.clearImmediate);
  3387. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
  3388. /***/ }),
  3389. /* 28 */
  3390. /***/ (function(module, exports, __webpack_require__) {
  3391. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  3392. "use strict";
  3393. if (global.setImmediate) {
  3394. return;
  3395. }
  3396. var nextHandle = 1; // Spec says greater than zero
  3397. var tasksByHandle = {};
  3398. var currentlyRunningATask = false;
  3399. var doc = global.document;
  3400. var registerImmediate;
  3401. function setImmediate(callback) {
  3402. // Callback can either be a function or a string
  3403. if (typeof callback !== "function") {
  3404. callback = new Function("" + callback);
  3405. }
  3406. // Copy function arguments
  3407. var args = new Array(arguments.length - 1);
  3408. for (var i = 0; i < args.length; i++) {
  3409. args[i] = arguments[i + 1];
  3410. }
  3411. // Store and register the task
  3412. var task = { callback: callback, args: args };
  3413. tasksByHandle[nextHandle] = task;
  3414. registerImmediate(nextHandle);
  3415. return nextHandle++;
  3416. }
  3417. function clearImmediate(handle) {
  3418. delete tasksByHandle[handle];
  3419. }
  3420. function run(task) {
  3421. var callback = task.callback;
  3422. var args = task.args;
  3423. switch (args.length) {
  3424. case 0:
  3425. callback();
  3426. break;
  3427. case 1:
  3428. callback(args[0]);
  3429. break;
  3430. case 2:
  3431. callback(args[0], args[1]);
  3432. break;
  3433. case 3:
  3434. callback(args[0], args[1], args[2]);
  3435. break;
  3436. default:
  3437. callback.apply(undefined, args);
  3438. break;
  3439. }
  3440. }
  3441. function runIfPresent(handle) {
  3442. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  3443. // So if we're currently running a task, we'll need to delay this invocation.
  3444. if (currentlyRunningATask) {
  3445. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  3446. // "too much recursion" error.
  3447. setTimeout(runIfPresent, 0, handle);
  3448. } else {
  3449. var task = tasksByHandle[handle];
  3450. if (task) {
  3451. currentlyRunningATask = true;
  3452. try {
  3453. run(task);
  3454. } finally {
  3455. clearImmediate(handle);
  3456. currentlyRunningATask = false;
  3457. }
  3458. }
  3459. }
  3460. }
  3461. function installNextTickImplementation() {
  3462. registerImmediate = function(handle) {
  3463. process.nextTick(function () { runIfPresent(handle); });
  3464. };
  3465. }
  3466. function canUsePostMessage() {
  3467. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  3468. // where `global.postMessage` means something completely different and can't be used for this purpose.
  3469. if (global.postMessage && !global.importScripts) {
  3470. var postMessageIsAsynchronous = true;
  3471. var oldOnMessage = global.onmessage;
  3472. global.onmessage = function() {
  3473. postMessageIsAsynchronous = false;
  3474. };
  3475. global.postMessage("", "*");
  3476. global.onmessage = oldOnMessage;
  3477. return postMessageIsAsynchronous;
  3478. }
  3479. }
  3480. function installPostMessageImplementation() {
  3481. // Installs an event handler on `global` for the `message` event: see
  3482. // * https://developer.mozilla.org/en/DOM/window.postMessage
  3483. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  3484. var messagePrefix = "setImmediate$" + Math.random() + "$";
  3485. var onGlobalMessage = function(event) {
  3486. if (event.source === global &&
  3487. typeof event.data === "string" &&
  3488. event.data.indexOf(messagePrefix) === 0) {
  3489. runIfPresent(+event.data.slice(messagePrefix.length));
  3490. }
  3491. };
  3492. if (global.addEventListener) {
  3493. global.addEventListener("message", onGlobalMessage, false);
  3494. } else {
  3495. global.attachEvent("onmessage", onGlobalMessage);
  3496. }
  3497. registerImmediate = function(handle) {
  3498. global.postMessage(messagePrefix + handle, "*");
  3499. };
  3500. }
  3501. function installMessageChannelImplementation() {
  3502. var channel = new MessageChannel();
  3503. channel.port1.onmessage = function(event) {
  3504. var handle = event.data;
  3505. runIfPresent(handle);
  3506. };
  3507. registerImmediate = function(handle) {
  3508. channel.port2.postMessage(handle);
  3509. };
  3510. }
  3511. function installReadyStateChangeImplementation() {
  3512. var html = doc.documentElement;
  3513. registerImmediate = function(handle) {
  3514. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  3515. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  3516. var script = doc.createElement("script");
  3517. script.onreadystatechange = function () {
  3518. runIfPresent(handle);
  3519. script.onreadystatechange = null;
  3520. html.removeChild(script);
  3521. script = null;
  3522. };
  3523. html.appendChild(script);
  3524. };
  3525. }
  3526. function installSetTimeoutImplementation() {
  3527. registerImmediate = function(handle) {
  3528. setTimeout(runIfPresent, 0, handle);
  3529. };
  3530. }
  3531. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  3532. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  3533. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  3534. // Don't get fooled by e.g. browserify environments.
  3535. if ({}.toString.call(global.process) === "[object process]") {
  3536. // For Node.js before 0.9
  3537. installNextTickImplementation();
  3538. } else if (canUsePostMessage()) {
  3539. // For non-IE10 modern browsers
  3540. installPostMessageImplementation();
  3541. } else if (global.MessageChannel) {
  3542. // For web workers, where supported
  3543. installMessageChannelImplementation();
  3544. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  3545. // For IE 6–8
  3546. installReadyStateChangeImplementation();
  3547. } else {
  3548. // For older browsers
  3549. installSetTimeoutImplementation();
  3550. }
  3551. attachTo.setImmediate = setImmediate;
  3552. attachTo.clearImmediate = clearImmediate;
  3553. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  3554. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(29)))
  3555. /***/ }),
  3556. /* 29 */
  3557. /***/ (function(module, exports) {
  3558. // shim for using process in browser
  3559. var process = module.exports = {};
  3560. // cached from whatever global is present so that test runners that stub it
  3561. // don't break things. But we need to wrap it in a try catch in case it is
  3562. // wrapped in strict mode code which doesn't define any globals. It's inside a
  3563. // function because try/catches deoptimize in certain engines.
  3564. var cachedSetTimeout;
  3565. var cachedClearTimeout;
  3566. function defaultSetTimout() {
  3567. throw new Error('setTimeout has not been defined');
  3568. }
  3569. function defaultClearTimeout () {
  3570. throw new Error('clearTimeout has not been defined');
  3571. }
  3572. (function () {
  3573. try {
  3574. if (typeof setTimeout === 'function') {
  3575. cachedSetTimeout = setTimeout;
  3576. } else {
  3577. cachedSetTimeout = defaultSetTimout;
  3578. }
  3579. } catch (e) {
  3580. cachedSetTimeout = defaultSetTimout;
  3581. }
  3582. try {
  3583. if (typeof clearTimeout === 'function') {
  3584. cachedClearTimeout = clearTimeout;
  3585. } else {
  3586. cachedClearTimeout = defaultClearTimeout;
  3587. }
  3588. } catch (e) {
  3589. cachedClearTimeout = defaultClearTimeout;
  3590. }
  3591. } ())
  3592. function runTimeout(fun) {
  3593. if (cachedSetTimeout === setTimeout) {
  3594. //normal enviroments in sane situations
  3595. return setTimeout(fun, 0);
  3596. }
  3597. // if setTimeout wasn't available but was latter defined
  3598. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  3599. cachedSetTimeout = setTimeout;
  3600. return setTimeout(fun, 0);
  3601. }
  3602. try {
  3603. // when when somebody has screwed with setTimeout but no I.E. maddness
  3604. return cachedSetTimeout(fun, 0);
  3605. } catch(e){
  3606. try {
  3607. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  3608. return cachedSetTimeout.call(null, fun, 0);
  3609. } catch(e){
  3610. // 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
  3611. return cachedSetTimeout.call(this, fun, 0);
  3612. }
  3613. }
  3614. }
  3615. function runClearTimeout(marker) {
  3616. if (cachedClearTimeout === clearTimeout) {
  3617. //normal enviroments in sane situations
  3618. return clearTimeout(marker);
  3619. }
  3620. // if clearTimeout wasn't available but was latter defined
  3621. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  3622. cachedClearTimeout = clearTimeout;
  3623. return clearTimeout(marker);
  3624. }
  3625. try {
  3626. // when when somebody has screwed with setTimeout but no I.E. maddness
  3627. return cachedClearTimeout(marker);
  3628. } catch (e){
  3629. try {
  3630. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  3631. return cachedClearTimeout.call(null, marker);
  3632. } catch (e){
  3633. // 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.
  3634. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  3635. return cachedClearTimeout.call(this, marker);
  3636. }
  3637. }
  3638. }
  3639. var queue = [];
  3640. var draining = false;
  3641. var currentQueue;
  3642. var queueIndex = -1;
  3643. function cleanUpNextTick() {
  3644. if (!draining || !currentQueue) {
  3645. return;
  3646. }
  3647. draining = false;
  3648. if (currentQueue.length) {
  3649. queue = currentQueue.concat(queue);
  3650. } else {
  3651. queueIndex = -1;
  3652. }
  3653. if (queue.length) {
  3654. drainQueue();
  3655. }
  3656. }
  3657. function drainQueue() {
  3658. if (draining) {
  3659. return;
  3660. }
  3661. var timeout = runTimeout(cleanUpNextTick);
  3662. draining = true;
  3663. var len = queue.length;
  3664. while(len) {
  3665. currentQueue = queue;
  3666. queue = [];
  3667. while (++queueIndex < len) {
  3668. if (currentQueue) {
  3669. currentQueue[queueIndex].run();
  3670. }
  3671. }
  3672. queueIndex = -1;
  3673. len = queue.length;
  3674. }
  3675. currentQueue = null;
  3676. draining = false;
  3677. runClearTimeout(timeout);
  3678. }
  3679. process.nextTick = function (fun) {
  3680. var args = new Array(arguments.length - 1);
  3681. if (arguments.length > 1) {
  3682. for (var i = 1; i < arguments.length; i++) {
  3683. args[i - 1] = arguments[i];
  3684. }
  3685. }
  3686. queue.push(new Item(fun, args));
  3687. if (queue.length === 1 && !draining) {
  3688. runTimeout(drainQueue);
  3689. }
  3690. };
  3691. // v8 likes predictible objects
  3692. function Item(fun, array) {
  3693. this.fun = fun;
  3694. this.array = array;
  3695. }
  3696. Item.prototype.run = function () {
  3697. this.fun.apply(null, this.array);
  3698. };
  3699. process.title = 'browser';
  3700. process.browser = true;
  3701. process.env = {};
  3702. process.argv = [];
  3703. process.version = ''; // empty string to avoid regexp issues
  3704. process.versions = {};
  3705. function noop() {}
  3706. process.on = noop;
  3707. process.addListener = noop;
  3708. process.once = noop;
  3709. process.off = noop;
  3710. process.removeListener = noop;
  3711. process.removeAllListeners = noop;
  3712. process.emit = noop;
  3713. process.prependListener = noop;
  3714. process.prependOnceListener = noop;
  3715. process.listeners = function (name) { return [] }
  3716. process.binding = function (name) {
  3717. throw new Error('process.binding is not supported');
  3718. };
  3719. process.cwd = function () { return '/' };
  3720. process.chdir = function (dir) {
  3721. throw new Error('process.chdir is not supported');
  3722. };
  3723. process.umask = function() { return 0; };
  3724. /***/ }),
  3725. /* 30 */
  3726. /***/ (function(module, exports, __webpack_require__) {
  3727. "use strict";
  3728. // Main parser class
  3729. var utils = __webpack_require__(0);
  3730. var helpers = __webpack_require__(38);
  3731. var Renderer = __webpack_require__(42);
  3732. var ParserCore = __webpack_require__(43);
  3733. var ParserBlock = __webpack_require__(51);
  3734. var ParserInline = __webpack_require__(65);
  3735. var LinkifyIt = __webpack_require__(78);
  3736. var mdurl = __webpack_require__(12);
  3737. var punycode = __webpack_require__(80);
  3738. var config = {
  3739. 'default': __webpack_require__(82),
  3740. zero: __webpack_require__(83),
  3741. commonmark: __webpack_require__(84)
  3742. };
  3743. ////////////////////////////////////////////////////////////////////////////////
  3744. //
  3745. // This validator can prohibit more than really needed to prevent XSS. It's a
  3746. // tradeoff to keep code simple and to be secure by default.
  3747. //
  3748. // If you need different setup - override validator method as you wish. Or
  3749. // replace it with dummy function and use external sanitizer.
  3750. //
  3751. var BAD_PROTO_RE = /^(vbscript|javascript|file|data):/;
  3752. var GOOD_DATA_RE = /^data:image\/(gif|png|jpeg|webp);/;
  3753. function validateLink(url) {
  3754. // url should be normalized at this point, and existing entities are decoded
  3755. var str = url.trim().toLowerCase();
  3756. return BAD_PROTO_RE.test(str) ? (GOOD_DATA_RE.test(str) ? true : false) : true;
  3757. }
  3758. ////////////////////////////////////////////////////////////////////////////////
  3759. var RECODE_HOSTNAME_FOR = [ 'http:', 'https:', 'mailto:' ];
  3760. function normalizeLink(url) {
  3761. var parsed = mdurl.parse(url, true);
  3762. if (parsed.hostname) {
  3763. // Encode hostnames in urls like:
  3764. // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`
  3765. //
  3766. // We don't encode unknown schemas, because it's likely that we encode
  3767. // something we shouldn't (e.g. `skype:name` treated as `skype:host`)
  3768. //
  3769. if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {
  3770. try {
  3771. parsed.hostname = punycode.toASCII(parsed.hostname);
  3772. } catch (er) { /**/ }
  3773. }
  3774. }
  3775. return mdurl.encode(mdurl.format(parsed));
  3776. }
  3777. function normalizeLinkText(url) {
  3778. var parsed = mdurl.parse(url, true);
  3779. if (parsed.hostname) {
  3780. // Encode hostnames in urls like:
  3781. // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`
  3782. //
  3783. // We don't encode unknown schemas, because it's likely that we encode
  3784. // something we shouldn't (e.g. `skype:name` treated as `skype:host`)
  3785. //
  3786. if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {
  3787. try {
  3788. parsed.hostname = punycode.toUnicode(parsed.hostname);
  3789. } catch (er) { /**/ }
  3790. }
  3791. }
  3792. return mdurl.decode(mdurl.format(parsed));
  3793. }
  3794. /**
  3795. * class MarkdownIt
  3796. *
  3797. * Main parser/renderer class.
  3798. *
  3799. * ##### Usage
  3800. *
  3801. * ```javascript
  3802. * // node.js, "classic" way:
  3803. * var MarkdownIt = require('markdown-it'),
  3804. * md = new MarkdownIt();
  3805. * var result = md.render('# markdown-it rulezz!');
  3806. *
  3807. * // node.js, the same, but with sugar:
  3808. * var md = require('markdown-it')();
  3809. * var result = md.render('# markdown-it rulezz!');
  3810. *
  3811. * // browser without AMD, added to "window" on script load
  3812. * // Note, there are no dash.
  3813. * var md = window.markdownit();
  3814. * var result = md.render('# markdown-it rulezz!');
  3815. * ```
  3816. *
  3817. * Single line rendering, without paragraph wrap:
  3818. *
  3819. * ```javascript
  3820. * var md = require('markdown-it')();
  3821. * var result = md.renderInline('__markdown-it__ rulezz!');
  3822. * ```
  3823. **/
  3824. /**
  3825. * new MarkdownIt([presetName, options])
  3826. * - presetName (String): optional, `commonmark` / `zero`
  3827. * - options (Object)
  3828. *
  3829. * Creates parser instanse with given config. Can be called without `new`.
  3830. *
  3831. * ##### presetName
  3832. *
  3833. * MarkdownIt provides named presets as a convenience to quickly
  3834. * enable/disable active syntax rules and options for common use cases.
  3835. *
  3836. * - ["commonmark"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/commonmark.js) -
  3837. * configures parser to strict [CommonMark](http://commonmark.org/) mode.
  3838. * - [default](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/default.js) -
  3839. * similar to GFM, used when no preset name given. Enables all available rules,
  3840. * but still without html, typographer & autolinker.
  3841. * - ["zero"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/zero.js) -
  3842. * all rules disabled. Useful to quickly setup your config via `.enable()`.
  3843. * For example, when you need only `bold` and `italic` markup and nothing else.
  3844. *
  3845. * ##### options:
  3846. *
  3847. * - __html__ - `false`. Set `true` to enable HTML tags in source. Be careful!
  3848. * That's not safe! You may need external sanitizer to protect output from XSS.
  3849. * It's better to extend features via plugins, instead of enabling HTML.
  3850. * - __xhtmlOut__ - `false`. Set `true` to add '/' when closing single tags
  3851. * (`<br />`). This is needed only for full CommonMark compatibility. In real
  3852. * world you will need HTML output.
  3853. * - __breaks__ - `false`. Set `true` to convert `\n` in paragraphs into `<br>`.
  3854. * - __langPrefix__ - `language-`. CSS language class prefix for fenced blocks.
  3855. * Can be useful for external highlighters.
  3856. * - __linkify__ - `false`. Set `true` to autoconvert URL-like text to links.
  3857. * - __typographer__ - `false`. Set `true` to enable [some language-neutral
  3858. * replacement](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js) +
  3859. * quotes beautification (smartquotes).
  3860. * - __quotes__ - `“”‘’`, String or Array. Double + single quotes replacement
  3861. * pairs, when typographer enabled and smartquotes on. For example, you can
  3862. * use `'«»„“'` for Russian, `'„“‚‘'` for German, and
  3863. * `['«\xA0', '\xA0»', '‹\xA0', '\xA0›']` for French (including nbsp).
  3864. * - __highlight__ - `null`. Highlighter function for fenced code blocks.
  3865. * Highlighter `function (str, lang)` should return escaped HTML. It can also
  3866. * return empty string if the source was not changed and should be escaped
  3867. * externaly. If result starts with <pre... internal wrapper is skipped.
  3868. *
  3869. * ##### Example
  3870. *
  3871. * ```javascript
  3872. * // commonmark mode
  3873. * var md = require('markdown-it')('commonmark');
  3874. *
  3875. * // default mode
  3876. * var md = require('markdown-it')();
  3877. *
  3878. * // enable everything
  3879. * var md = require('markdown-it')({
  3880. * html: true,
  3881. * linkify: true,
  3882. * typographer: true
  3883. * });
  3884. * ```
  3885. *
  3886. * ##### Syntax highlighting
  3887. *
  3888. * ```js
  3889. * var hljs = require('highlight.js') // https://highlightjs.org/
  3890. *
  3891. * var md = require('markdown-it')({
  3892. * highlight: function (str, lang) {
  3893. * if (lang && hljs.getLanguage(lang)) {
  3894. * try {
  3895. * return hljs.highlight(lang, str, true).value;
  3896. * } catch (__) {}
  3897. * }
  3898. *
  3899. * return ''; // use external default escaping
  3900. * }
  3901. * });
  3902. * ```
  3903. *
  3904. * Or with full wrapper override (if you need assign class to `<pre>`):
  3905. *
  3906. * ```javascript
  3907. * var hljs = require('highlight.js') // https://highlightjs.org/
  3908. *
  3909. * // Actual default values
  3910. * var md = require('markdown-it')({
  3911. * highlight: function (str, lang) {
  3912. * if (lang && hljs.getLanguage(lang)) {
  3913. * try {
  3914. * return '<pre class="hljs"><code>' +
  3915. * hljs.highlight(lang, str, true).value +
  3916. * '</code></pre>';
  3917. * } catch (__) {}
  3918. * }
  3919. *
  3920. * return '<pre class="hljs"><code>' + md.utils.escapeHtml(str) + '</code></pre>';
  3921. * }
  3922. * });
  3923. * ```
  3924. *
  3925. **/
  3926. function MarkdownIt(presetName, options) {
  3927. if (!(this instanceof MarkdownIt)) {
  3928. return new MarkdownIt(presetName, options);
  3929. }
  3930. if (!options) {
  3931. if (!utils.isString(presetName)) {
  3932. options = presetName || {};
  3933. presetName = 'default';
  3934. }
  3935. }
  3936. /**
  3937. * MarkdownIt#inline -> ParserInline
  3938. *
  3939. * Instance of [[ParserInline]]. You may need it to add new rules when
  3940. * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
  3941. * [[MarkdownIt.enable]].
  3942. **/
  3943. this.inline = new ParserInline();
  3944. /**
  3945. * MarkdownIt#block -> ParserBlock
  3946. *
  3947. * Instance of [[ParserBlock]]. You may need it to add new rules when
  3948. * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
  3949. * [[MarkdownIt.enable]].
  3950. **/
  3951. this.block = new ParserBlock();
  3952. /**
  3953. * MarkdownIt#core -> Core
  3954. *
  3955. * Instance of [[Core]] chain executor. You may need it to add new rules when
  3956. * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
  3957. * [[MarkdownIt.enable]].
  3958. **/
  3959. this.core = new ParserCore();
  3960. /**
  3961. * MarkdownIt#renderer -> Renderer
  3962. *
  3963. * Instance of [[Renderer]]. Use it to modify output look. Or to add rendering
  3964. * rules for new token types, generated by plugins.
  3965. *
  3966. * ##### Example
  3967. *
  3968. * ```javascript
  3969. * var md = require('markdown-it')();
  3970. *
  3971. * function myToken(tokens, idx, options, env, self) {
  3972. * //...
  3973. * return result;
  3974. * };
  3975. *
  3976. * md.renderer.rules['my_token'] = myToken
  3977. * ```
  3978. *
  3979. * See [[Renderer]] docs and [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js).
  3980. **/
  3981. this.renderer = new Renderer();
  3982. /**
  3983. * MarkdownIt#linkify -> LinkifyIt
  3984. *
  3985. * [linkify-it](https://github.com/markdown-it/linkify-it) instance.
  3986. * Used by [linkify](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js)
  3987. * rule.
  3988. **/
  3989. this.linkify = new LinkifyIt();
  3990. /**
  3991. * MarkdownIt#validateLink(url) -> Boolean
  3992. *
  3993. * Link validation function. CommonMark allows too much in links. By default
  3994. * we disable `javascript:`, `vbscript:`, `file:` schemas, and almost all `data:...` schemas
  3995. * except some embedded image types.
  3996. *
  3997. * You can change this behaviour:
  3998. *
  3999. * ```javascript
  4000. * var md = require('markdown-it')();
  4001. * // enable everything
  4002. * md.validateLink = function () { return true; }
  4003. * ```
  4004. **/
  4005. this.validateLink = validateLink;
  4006. /**
  4007. * MarkdownIt#normalizeLink(url) -> String
  4008. *
  4009. * Function used to encode link url to a machine-readable format,
  4010. * which includes url-encoding, punycode, etc.
  4011. **/
  4012. this.normalizeLink = normalizeLink;
  4013. /**
  4014. * MarkdownIt#normalizeLinkText(url) -> String
  4015. *
  4016. * Function used to decode link url to a human-readable format`
  4017. **/
  4018. this.normalizeLinkText = normalizeLinkText;
  4019. // Expose utils & helpers for easy acces from plugins
  4020. /**
  4021. * MarkdownIt#utils -> utils
  4022. *
  4023. * Assorted utility functions, useful to write plugins. See details
  4024. * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/common/utils.js).
  4025. **/
  4026. this.utils = utils;
  4027. /**
  4028. * MarkdownIt#helpers -> helpers
  4029. *
  4030. * Link components parser functions, useful to write plugins. See details
  4031. * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/helpers).
  4032. **/
  4033. this.helpers = utils.assign({}, helpers);
  4034. this.options = {};
  4035. this.configure(presetName);
  4036. if (options) { this.set(options); }
  4037. }
  4038. /** chainable
  4039. * MarkdownIt.set(options)
  4040. *
  4041. * Set parser options (in the same format as in constructor). Probably, you
  4042. * will never need it, but you can change options after constructor call.
  4043. *
  4044. * ##### Example
  4045. *
  4046. * ```javascript
  4047. * var md = require('markdown-it')()
  4048. * .set({ html: true, breaks: true })
  4049. * .set({ typographer, true });
  4050. * ```
  4051. *
  4052. * __Note:__ To achieve the best possible performance, don't modify a
  4053. * `markdown-it` instance options on the fly. If you need multiple configurations
  4054. * it's best to create multiple instances and initialize each with separate
  4055. * config.
  4056. **/
  4057. MarkdownIt.prototype.set = function (options) {
  4058. utils.assign(this.options, options);
  4059. return this;
  4060. };
  4061. /** chainable, internal
  4062. * MarkdownIt.configure(presets)
  4063. *
  4064. * Batch load of all options and compenent settings. This is internal method,
  4065. * and you probably will not need it. But if you with - see available presets
  4066. * and data structure [here](https://github.com/markdown-it/markdown-it/tree/master/lib/presets)
  4067. *
  4068. * We strongly recommend to use presets instead of direct config loads. That
  4069. * will give better compatibility with next versions.
  4070. **/
  4071. MarkdownIt.prototype.configure = function (presets) {
  4072. var self = this, presetName;
  4073. if (utils.isString(presets)) {
  4074. presetName = presets;
  4075. presets = config[presetName];
  4076. if (!presets) { throw new Error('Wrong `markdown-it` preset "' + presetName + '", check name'); }
  4077. }
  4078. if (!presets) { throw new Error('Wrong `markdown-it` preset, can\'t be empty'); }
  4079. if (presets.options) { self.set(presets.options); }
  4080. if (presets.components) {
  4081. Object.keys(presets.components).forEach(function (name) {
  4082. if (presets.components[name].rules) {
  4083. self[name].ruler.enableOnly(presets.components[name].rules);
  4084. }
  4085. if (presets.components[name].rules2) {
  4086. self[name].ruler2.enableOnly(presets.components[name].rules2);
  4087. }
  4088. });
  4089. }
  4090. return this;
  4091. };
  4092. /** chainable
  4093. * MarkdownIt.enable(list, ignoreInvalid)
  4094. * - list (String|Array): rule name or list of rule names to enable
  4095. * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
  4096. *
  4097. * Enable list or rules. It will automatically find appropriate components,
  4098. * containing rules with given names. If rule not found, and `ignoreInvalid`
  4099. * not set - throws exception.
  4100. *
  4101. * ##### Example
  4102. *
  4103. * ```javascript
  4104. * var md = require('markdown-it')()
  4105. * .enable(['sub', 'sup'])
  4106. * .disable('smartquotes');
  4107. * ```
  4108. **/
  4109. MarkdownIt.prototype.enable = 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.enable(list, true));
  4114. }, this);
  4115. result = result.concat(this.inline.ruler2.enable(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 enable unknown rule(s): ' + missed);
  4119. }
  4120. return this;
  4121. };
  4122. /** chainable
  4123. * MarkdownIt.disable(list, ignoreInvalid)
  4124. * - list (String|Array): rule name or list of rule names to disable.
  4125. * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
  4126. *
  4127. * The same as [[MarkdownIt.enable]], but turn specified rules off.
  4128. **/
  4129. MarkdownIt.prototype.disable = function (list, ignoreInvalid) {
  4130. var result = [];
  4131. if (!Array.isArray(list)) { list = [ list ]; }
  4132. [ 'core', 'block', 'inline' ].forEach(function (chain) {
  4133. result = result.concat(this[chain].ruler.disable(list, true));
  4134. }, this);
  4135. result = result.concat(this.inline.ruler2.disable(list, true));
  4136. var missed = list.filter(function (name) { return result.indexOf(name) < 0; });
  4137. if (missed.length && !ignoreInvalid) {
  4138. throw new Error('MarkdownIt. Failed to disable unknown rule(s): ' + missed);
  4139. }
  4140. return this;
  4141. };
  4142. /** chainable
  4143. * MarkdownIt.use(plugin, params)
  4144. *
  4145. * Load specified plugin with given params into current parser instance.
  4146. * It's just a sugar to call `plugin(md, params)` with curring.
  4147. *
  4148. * ##### Example
  4149. *
  4150. * ```javascript
  4151. * var iterator = require('markdown-it-for-inline');
  4152. * var md = require('markdown-it')()
  4153. * .use(iterator, 'foo_replace', 'text', function (tokens, idx) {
  4154. * tokens[idx].content = tokens[idx].content.replace(/foo/g, 'bar');
  4155. * });
  4156. * ```
  4157. **/
  4158. MarkdownIt.prototype.use = function (plugin /*, params, ... */) {
  4159. var args = [ this ].concat(Array.prototype.slice.call(arguments, 1));
  4160. plugin.apply(plugin, args);
  4161. return this;
  4162. };
  4163. /** internal
  4164. * MarkdownIt.parse(src, env) -> Array
  4165. * - src (String): source string
  4166. * - env (Object): environment sandbox
  4167. *
  4168. * Parse input string and returns list of block tokens (special token type
  4169. * "inline" will contain list of inline tokens). You should not call this
  4170. * method directly, until you write custom renderer (for example, to produce
  4171. * AST).
  4172. *
  4173. * `env` is used to pass data between "distributed" rules and return additional
  4174. * metadata like reference info, needed for the renderer. It also can be used to
  4175. * inject data in specific cases. Usually, you will be ok to pass `{}`,
  4176. * and then pass updated object to renderer.
  4177. **/
  4178. MarkdownIt.prototype.parse = function (src, env) {
  4179. if (typeof src !== 'string') {
  4180. throw new Error('Input data should be a String');
  4181. }
  4182. var state = new this.core.State(src, this, env);
  4183. this.core.process(state);
  4184. return state.tokens;
  4185. };
  4186. /**
  4187. * MarkdownIt.render(src [, env]) -> String
  4188. * - src (String): source string
  4189. * - env (Object): environment sandbox
  4190. *
  4191. * Render markdown string into html. It does all magic for you :).
  4192. *
  4193. * `env` can be used to inject additional metadata (`{}` by default).
  4194. * But you will not need it with high probability. See also comment
  4195. * in [[MarkdownIt.parse]].
  4196. **/
  4197. MarkdownIt.prototype.render = function (src, env) {
  4198. env = env || {};
  4199. return this.renderer.render(this.parse(src, env), this.options, env);
  4200. };
  4201. /** internal
  4202. * MarkdownIt.parseInline(src, env) -> Array
  4203. * - src (String): source string
  4204. * - env (Object): environment sandbox
  4205. *
  4206. * The same as [[MarkdownIt.parse]] but skip all block rules. It returns the
  4207. * block tokens list with the single `inline` element, containing parsed inline
  4208. * tokens in `children` property. Also updates `env` object.
  4209. **/
  4210. MarkdownIt.prototype.parseInline = function (src, env) {
  4211. var state = new this.core.State(src, this, env);
  4212. state.inlineMode = true;
  4213. this.core.process(state);
  4214. return state.tokens;
  4215. };
  4216. /**
  4217. * MarkdownIt.renderInline(src [, env]) -> String
  4218. * - src (String): source string
  4219. * - env (Object): environment sandbox
  4220. *
  4221. * Similar to [[MarkdownIt.render]] but for single paragraph content. Result
  4222. * will NOT be wrapped into `<p>` tags.
  4223. **/
  4224. MarkdownIt.prototype.renderInline = function (src, env) {
  4225. env = env || {};
  4226. return this.renderer.render(this.parseInline(src, env), this.options, env);
  4227. };
  4228. module.exports = MarkdownIt;
  4229. /***/ }),
  4230. /* 31 */
  4231. /***/ (function(module, exports) {
  4232. 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":"‌"}
  4233. /***/ }),
  4234. /* 32 */
  4235. /***/ (function(module, exports, __webpack_require__) {
  4236. "use strict";
  4237. var encodeCache = {};
  4238. // Create a lookup array where anything but characters in `chars` string
  4239. // and alphanumeric chars is percent-encoded.
  4240. //
  4241. function getEncodeCache(exclude) {
  4242. var i, ch, cache = encodeCache[exclude];
  4243. if (cache) { return cache; }
  4244. cache = encodeCache[exclude] = [];
  4245. for (i = 0; i < 128; i++) {
  4246. ch = String.fromCharCode(i);
  4247. if (/^[0-9a-z]$/i.test(ch)) {
  4248. // always allow unencoded alphanumeric characters
  4249. cache.push(ch);
  4250. } else {
  4251. cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2));
  4252. }
  4253. }
  4254. for (i = 0; i < exclude.length; i++) {
  4255. cache[exclude.charCodeAt(i)] = exclude[i];
  4256. }
  4257. return cache;
  4258. }
  4259. // Encode unsafe characters with percent-encoding, skipping already
  4260. // encoded sequences.
  4261. //
  4262. // - string - string to encode
  4263. // - exclude - list of characters to ignore (in addition to a-zA-Z0-9)
  4264. // - keepEscaped - don't encode '%' in a correct escape sequence (default: true)
  4265. //
  4266. function encode(string, exclude, keepEscaped) {
  4267. var i, l, code, nextCode, cache,
  4268. result = '';
  4269. if (typeof exclude !== 'string') {
  4270. // encode(string, keepEscaped)
  4271. keepEscaped = exclude;
  4272. exclude = encode.defaultChars;
  4273. }
  4274. if (typeof keepEscaped === 'undefined') {
  4275. keepEscaped = true;
  4276. }
  4277. cache = getEncodeCache(exclude);
  4278. for (i = 0, l = string.length; i < l; i++) {
  4279. code = string.charCodeAt(i);
  4280. if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) {
  4281. if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {
  4282. result += string.slice(i, i + 3);
  4283. i += 2;
  4284. continue;
  4285. }
  4286. }
  4287. if (code < 128) {
  4288. result += cache[code];
  4289. continue;
  4290. }
  4291. if (code >= 0xD800 && code <= 0xDFFF) {
  4292. if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {
  4293. nextCode = string.charCodeAt(i + 1);
  4294. if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {
  4295. result += encodeURIComponent(string[i] + string[i + 1]);
  4296. i++;
  4297. continue;
  4298. }
  4299. }
  4300. result += '%EF%BF%BD';
  4301. continue;
  4302. }
  4303. result += encodeURIComponent(string[i]);
  4304. }
  4305. return result;
  4306. }
  4307. encode.defaultChars = ";/?:@&=+$,-_.!~*'()#";
  4308. encode.componentChars = "-_.!~*'()";
  4309. module.exports = encode;
  4310. /***/ }),
  4311. /* 33 */
  4312. /***/ (function(module, exports, __webpack_require__) {
  4313. "use strict";
  4314. /* eslint-disable no-bitwise */
  4315. var decodeCache = {};
  4316. function getDecodeCache(exclude) {
  4317. var i, ch, cache = decodeCache[exclude];
  4318. if (cache) { return cache; }
  4319. cache = decodeCache[exclude] = [];
  4320. for (i = 0; i < 128; i++) {
  4321. ch = String.fromCharCode(i);
  4322. cache.push(ch);
  4323. }
  4324. for (i = 0; i < exclude.length; i++) {
  4325. ch = exclude.charCodeAt(i);
  4326. cache[ch] = '%' + ('0' + ch.toString(16).toUpperCase()).slice(-2);
  4327. }
  4328. return cache;
  4329. }
  4330. // Decode percent-encoded string.
  4331. //
  4332. function decode(string, exclude) {
  4333. var cache;
  4334. if (typeof exclude !== 'string') {
  4335. exclude = decode.defaultChars;
  4336. }
  4337. cache = getDecodeCache(exclude);
  4338. return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) {
  4339. var i, l, b1, b2, b3, b4, chr,
  4340. result = '';
  4341. for (i = 0, l = seq.length; i < l; i += 3) {
  4342. b1 = parseInt(seq.slice(i + 1, i + 3), 16);
  4343. if (b1 < 0x80) {
  4344. result += cache[b1];
  4345. continue;
  4346. }
  4347. if ((b1 & 0xE0) === 0xC0 && (i + 3 < l)) {
  4348. // 110xxxxx 10xxxxxx
  4349. b2 = parseInt(seq.slice(i + 4, i + 6), 16);
  4350. if ((b2 & 0xC0) === 0x80) {
  4351. chr = ((b1 << 6) & 0x7C0) | (b2 & 0x3F);
  4352. if (chr < 0x80) {
  4353. result += '\ufffd\ufffd';
  4354. } else {
  4355. result += String.fromCharCode(chr);
  4356. }
  4357. i += 3;
  4358. continue;
  4359. }
  4360. }
  4361. if ((b1 & 0xF0) === 0xE0 && (i + 6 < l)) {
  4362. // 1110xxxx 10xxxxxx 10xxxxxx
  4363. b2 = parseInt(seq.slice(i + 4, i + 6), 16);
  4364. b3 = parseInt(seq.slice(i + 7, i + 9), 16);
  4365. if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {
  4366. chr = ((b1 << 12) & 0xF000) | ((b2 << 6) & 0xFC0) | (b3 & 0x3F);
  4367. if (chr < 0x800 || (chr >= 0xD800 && chr <= 0xDFFF)) {
  4368. result += '\ufffd\ufffd\ufffd';
  4369. } else {
  4370. result += String.fromCharCode(chr);
  4371. }
  4372. i += 6;
  4373. continue;
  4374. }
  4375. }
  4376. if ((b1 & 0xF8) === 0xF0 && (i + 9 < l)) {
  4377. // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx
  4378. b2 = parseInt(seq.slice(i + 4, i + 6), 16);
  4379. b3 = parseInt(seq.slice(i + 7, i + 9), 16);
  4380. b4 = parseInt(seq.slice(i + 10, i + 12), 16);
  4381. if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80 && (b4 & 0xC0) === 0x80) {
  4382. chr = ((b1 << 18) & 0x1C0000) | ((b2 << 12) & 0x3F000) | ((b3 << 6) & 0xFC0) | (b4 & 0x3F);
  4383. if (chr < 0x10000 || chr > 0x10FFFF) {
  4384. result += '\ufffd\ufffd\ufffd\ufffd';
  4385. } else {
  4386. chr -= 0x10000;
  4387. result += String.fromCharCode(0xD800 + (chr >> 10), 0xDC00 + (chr & 0x3FF));
  4388. }
  4389. i += 9;
  4390. continue;
  4391. }
  4392. }
  4393. result += '\ufffd';
  4394. }
  4395. return result;
  4396. });
  4397. }
  4398. decode.defaultChars = ';/?:@&=+$,#';
  4399. decode.componentChars = '';
  4400. module.exports = decode;
  4401. /***/ }),
  4402. /* 34 */
  4403. /***/ (function(module, exports, __webpack_require__) {
  4404. "use strict";
  4405. module.exports = function format(url) {
  4406. var result = '';
  4407. result += url.protocol || '';
  4408. result += url.slashes ? '//' : '';
  4409. result += url.auth ? url.auth + '@' : '';
  4410. if (url.hostname && url.hostname.indexOf(':') !== -1) {
  4411. // ipv6 address
  4412. result += '[' + url.hostname + ']';
  4413. } else {
  4414. result += url.hostname || '';
  4415. }
  4416. result += url.port ? ':' + url.port : '';
  4417. result += url.pathname || '';
  4418. result += url.search || '';
  4419. result += url.hash || '';
  4420. return result;
  4421. };
  4422. /***/ }),
  4423. /* 35 */
  4424. /***/ (function(module, exports, __webpack_require__) {
  4425. "use strict";
  4426. // Copyright Joyent, Inc. and other Node contributors.
  4427. //
  4428. // Permission is hereby granted, free of charge, to any person obtaining a
  4429. // copy of this software and associated documentation files (the
  4430. // "Software"), to deal in the Software without restriction, including
  4431. // without limitation the rights to use, copy, modify, merge, publish,
  4432. // distribute, sublicense, and/or sell copies of the Software, and to permit
  4433. // persons to whom the Software is furnished to do so, subject to the
  4434. // following conditions:
  4435. //
  4436. // The above copyright notice and this permission notice shall be included
  4437. // in all copies or substantial portions of the Software.
  4438. //
  4439. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  4440. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  4441. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  4442. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  4443. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  4444. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  4445. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  4446. //
  4447. // Changes from joyent/node:
  4448. //
  4449. // 1. No leading slash in paths,
  4450. // e.g. in `url.parse('http://foo?bar')` pathname is ``, not `/`
  4451. //
  4452. // 2. Backslashes are not replaced with slashes,
  4453. // so `http:\\example.org\` is treated like a relative path
  4454. //
  4455. // 3. Trailing colon is treated like a part of the path,
  4456. // i.e. in `http://example.org:foo` pathname is `:foo`
  4457. //
  4458. // 4. Nothing is URL-encoded in the resulting object,
  4459. // (in joyent/node some chars in auth and paths are encoded)
  4460. //
  4461. // 5. `url.parse()` does not have `parseQueryString` argument
  4462. //
  4463. // 6. Removed extraneous result properties: `host`, `path`, `query`, etc.,
  4464. // which can be constructed using other parts of the url.
  4465. //
  4466. function Url() {
  4467. this.protocol = null;
  4468. this.slashes = null;
  4469. this.auth = null;
  4470. this.port = null;
  4471. this.hostname = null;
  4472. this.hash = null;
  4473. this.search = null;
  4474. this.pathname = null;
  4475. }
  4476. // Reference: RFC 3986, RFC 1808, RFC 2396
  4477. // define these here so at least they only have to be
  4478. // compiled once on the first module load.
  4479. var protocolPattern = /^([a-z0-9.+-]+:)/i,
  4480. portPattern = /:[0-9]*$/,
  4481. // Special case for a simple path URL
  4482. simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
  4483. // RFC 2396: characters reserved for delimiting URLs.
  4484. // We actually just auto-escape these.
  4485. delims = [ '<', '>', '"', '`', ' ', '\r', '\n', '\t' ],
  4486. // RFC 2396: characters not allowed for various reasons.
  4487. unwise = [ '{', '}', '|', '\\', '^', '`' ].concat(delims),
  4488. // Allowed by RFCs, but cause of XSS attacks. Always escape these.
  4489. autoEscape = [ '\'' ].concat(unwise),
  4490. // Characters that are never ever allowed in a hostname.
  4491. // Note that any invalid chars are also handled, but these
  4492. // are the ones that are *expected* to be seen, so we fast-path
  4493. // them.
  4494. nonHostChars = [ '%', '/', '?', ';', '#' ].concat(autoEscape),
  4495. hostEndingChars = [ '/', '?', '#' ],
  4496. hostnameMaxLen = 255,
  4497. hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
  4498. hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
  4499. // protocols that can allow "unsafe" and "unwise" chars.
  4500. /* eslint-disable no-script-url */
  4501. // protocols that never have a hostname.
  4502. hostlessProtocol = {
  4503. 'javascript': true,
  4504. 'javascript:': true
  4505. },
  4506. // protocols that always contain a // bit.
  4507. slashedProtocol = {
  4508. 'http': true,
  4509. 'https': true,
  4510. 'ftp': true,
  4511. 'gopher': true,
  4512. 'file': true,
  4513. 'http:': true,
  4514. 'https:': true,
  4515. 'ftp:': true,
  4516. 'gopher:': true,
  4517. 'file:': true
  4518. };
  4519. /* eslint-enable no-script-url */
  4520. function urlParse(url, slashesDenoteHost) {
  4521. if (url && url instanceof Url) { return url; }
  4522. var u = new Url();
  4523. u.parse(url, slashesDenoteHost);
  4524. return u;
  4525. }
  4526. Url.prototype.parse = function(url, slashesDenoteHost) {
  4527. var i, l, lowerProto, hec, slashes,
  4528. rest = url;
  4529. // trim before proceeding.
  4530. // This is to support parse stuff like " http://foo.com \n"
  4531. rest = rest.trim();
  4532. if (!slashesDenoteHost && url.split('#').length === 1) {
  4533. // Try fast path regexp
  4534. var simplePath = simplePathPattern.exec(rest);
  4535. if (simplePath) {
  4536. this.pathname = simplePath[1];
  4537. if (simplePath[2]) {
  4538. this.search = simplePath[2];
  4539. }
  4540. return this;
  4541. }
  4542. }
  4543. var proto = protocolPattern.exec(rest);
  4544. if (proto) {
  4545. proto = proto[0];
  4546. lowerProto = proto.toLowerCase();
  4547. this.protocol = proto;
  4548. rest = rest.substr(proto.length);
  4549. }
  4550. // figure out if it's got a host
  4551. // user@server is *always* interpreted as a hostname, and url
  4552. // resolution will treat //foo/bar as host=foo,path=bar because that's
  4553. // how the browser resolves relative URLs.
  4554. if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
  4555. slashes = rest.substr(0, 2) === '//';
  4556. if (slashes && !(proto && hostlessProtocol[proto])) {
  4557. rest = rest.substr(2);
  4558. this.slashes = true;
  4559. }
  4560. }
  4561. if (!hostlessProtocol[proto] &&
  4562. (slashes || (proto && !slashedProtocol[proto]))) {
  4563. // there's a hostname.
  4564. // the first instance of /, ?, ;, or # ends the host.
  4565. //
  4566. // If there is an @ in the hostname, then non-host chars *are* allowed
  4567. // to the left of the last @ sign, unless some host-ending character
  4568. // comes *before* the @-sign.
  4569. // URLs are obnoxious.
  4570. //
  4571. // ex:
  4572. // http://a@b@c/ => user:a@b host:c
  4573. // http://a@b?@c => user:a host:c path:/?@c
  4574. // v0.12 TODO(isaacs): This is not quite how Chrome does things.
  4575. // Review our test case against browsers more comprehensively.
  4576. // find the first instance of any hostEndingChars
  4577. var hostEnd = -1;
  4578. for (i = 0; i < hostEndingChars.length; i++) {
  4579. hec = rest.indexOf(hostEndingChars[i]);
  4580. if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
  4581. hostEnd = hec;
  4582. }
  4583. }
  4584. // at this point, either we have an explicit point where the
  4585. // auth portion cannot go past, or the last @ char is the decider.
  4586. var auth, atSign;
  4587. if (hostEnd === -1) {
  4588. // atSign can be anywhere.
  4589. atSign = rest.lastIndexOf('@');
  4590. } else {
  4591. // atSign must be in auth portion.
  4592. // http://a@b/c@d => host:b auth:a path:/c@d
  4593. atSign = rest.lastIndexOf('@', hostEnd);
  4594. }
  4595. // Now we have a portion which is definitely the auth.
  4596. // Pull that off.
  4597. if (atSign !== -1) {
  4598. auth = rest.slice(0, atSign);
  4599. rest = rest.slice(atSign + 1);
  4600. this.auth = auth;
  4601. }
  4602. // the host is the remaining to the left of the first non-host char
  4603. hostEnd = -1;
  4604. for (i = 0; i < nonHostChars.length; i++) {
  4605. hec = rest.indexOf(nonHostChars[i]);
  4606. if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
  4607. hostEnd = hec;
  4608. }
  4609. }
  4610. // if we still have not hit it, then the entire thing is a host.
  4611. if (hostEnd === -1) {
  4612. hostEnd = rest.length;
  4613. }
  4614. if (rest[hostEnd - 1] === ':') { hostEnd--; }
  4615. var host = rest.slice(0, hostEnd);
  4616. rest = rest.slice(hostEnd);
  4617. // pull out port.
  4618. this.parseHost(host);
  4619. // we've indicated that there is a hostname,
  4620. // so even if it's empty, it has to be present.
  4621. this.hostname = this.hostname || '';
  4622. // if hostname begins with [ and ends with ]
  4623. // assume that it's an IPv6 address.
  4624. var ipv6Hostname = this.hostname[0] === '[' &&
  4625. this.hostname[this.hostname.length - 1] === ']';
  4626. // validate a little.
  4627. if (!ipv6Hostname) {
  4628. var hostparts = this.hostname.split(/\./);
  4629. for (i = 0, l = hostparts.length; i < l; i++) {
  4630. var part = hostparts[i];
  4631. if (!part) { continue; }
  4632. if (!part.match(hostnamePartPattern)) {
  4633. var newpart = '';
  4634. for (var j = 0, k = part.length; j < k; j++) {
  4635. if (part.charCodeAt(j) > 127) {
  4636. // we replace non-ASCII char with a temporary placeholder
  4637. // we need this to make sure size of hostname is not
  4638. // broken by replacing non-ASCII by nothing
  4639. newpart += 'x';
  4640. } else {
  4641. newpart += part[j];
  4642. }
  4643. }
  4644. // we test again with ASCII char only
  4645. if (!newpart.match(hostnamePartPattern)) {
  4646. var validParts = hostparts.slice(0, i);
  4647. var notHost = hostparts.slice(i + 1);
  4648. var bit = part.match(hostnamePartStart);
  4649. if (bit) {
  4650. validParts.push(bit[1]);
  4651. notHost.unshift(bit[2]);
  4652. }
  4653. if (notHost.length) {
  4654. rest = notHost.join('.') + rest;
  4655. }
  4656. this.hostname = validParts.join('.');
  4657. break;
  4658. }
  4659. }
  4660. }
  4661. }
  4662. if (this.hostname.length > hostnameMaxLen) {
  4663. this.hostname = '';
  4664. }
  4665. // strip [ and ] from the hostname
  4666. // the host field still retains them, though
  4667. if (ipv6Hostname) {
  4668. this.hostname = this.hostname.substr(1, this.hostname.length - 2);
  4669. }
  4670. }
  4671. // chop off from the tail first.
  4672. var hash = rest.indexOf('#');
  4673. if (hash !== -1) {
  4674. // got a fragment string.
  4675. this.hash = rest.substr(hash);
  4676. rest = rest.slice(0, hash);
  4677. }
  4678. var qm = rest.indexOf('?');
  4679. if (qm !== -1) {
  4680. this.search = rest.substr(qm);
  4681. rest = rest.slice(0, qm);
  4682. }
  4683. if (rest) { this.pathname = rest; }
  4684. if (slashedProtocol[lowerProto] &&
  4685. this.hostname && !this.pathname) {
  4686. this.pathname = '';
  4687. }
  4688. return this;
  4689. };
  4690. Url.prototype.parseHost = function(host) {
  4691. var port = portPattern.exec(host);
  4692. if (port) {
  4693. port = port[0];
  4694. if (port !== ':') {
  4695. this.port = port.substr(1);
  4696. }
  4697. host = host.substr(0, host.length - port.length);
  4698. }
  4699. if (host) { this.hostname = host; }
  4700. };
  4701. module.exports = urlParse;
  4702. /***/ }),
  4703. /* 36 */
  4704. /***/ (function(module, exports, __webpack_require__) {
  4705. "use strict";
  4706. exports.Any = __webpack_require__(13);
  4707. exports.Cc = __webpack_require__(14);
  4708. exports.Cf = __webpack_require__(37);
  4709. exports.P = __webpack_require__(5);
  4710. exports.Z = __webpack_require__(15);
  4711. /***/ }),
  4712. /* 37 */
  4713. /***/ (function(module, exports) {
  4714. 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]/
  4715. /***/ }),
  4716. /* 38 */
  4717. /***/ (function(module, exports, __webpack_require__) {
  4718. "use strict";
  4719. // Just a shortcut for bulk export
  4720. exports.parseLinkLabel = __webpack_require__(39);
  4721. exports.parseLinkDestination = __webpack_require__(40);
  4722. exports.parseLinkTitle = __webpack_require__(41);
  4723. /***/ }),
  4724. /* 39 */
  4725. /***/ (function(module, exports, __webpack_require__) {
  4726. "use strict";
  4727. // Parse link label
  4728. //
  4729. // this function assumes that first character ("[") already matches;
  4730. // returns the end of the label
  4731. //
  4732. module.exports = function parseLinkLabel(state, start, disableNested) {
  4733. var level, found, marker, prevPos,
  4734. labelEnd = -1,
  4735. max = state.posMax,
  4736. oldPos = state.pos;
  4737. state.pos = start + 1;
  4738. level = 1;
  4739. while (state.pos < max) {
  4740. marker = state.src.charCodeAt(state.pos);
  4741. if (marker === 0x5D /* ] */) {
  4742. level--;
  4743. if (level === 0) {
  4744. found = true;
  4745. break;
  4746. }
  4747. }
  4748. prevPos = state.pos;
  4749. state.md.inline.skipToken(state);
  4750. if (marker === 0x5B /* [ */) {
  4751. if (prevPos === state.pos - 1) {
  4752. // increase level if we find text `[`, which is not a part of any token
  4753. level++;
  4754. } else if (disableNested) {
  4755. state.pos = oldPos;
  4756. return -1;
  4757. }
  4758. }
  4759. }
  4760. if (found) {
  4761. labelEnd = state.pos;
  4762. }
  4763. // restore old state
  4764. state.pos = oldPos;
  4765. return labelEnd;
  4766. };
  4767. /***/ }),
  4768. /* 40 */
  4769. /***/ (function(module, exports, __webpack_require__) {
  4770. "use strict";
  4771. // Parse link destination
  4772. //
  4773. var isSpace = __webpack_require__(0).isSpace;
  4774. var unescapeAll = __webpack_require__(0).unescapeAll;
  4775. module.exports = function parseLinkDestination(str, pos, max) {
  4776. var code, level,
  4777. lines = 0,
  4778. start = pos,
  4779. result = {
  4780. ok: false,
  4781. pos: 0,
  4782. lines: 0,
  4783. str: ''
  4784. };
  4785. if (str.charCodeAt(pos) === 0x3C /* < */) {
  4786. pos++;
  4787. while (pos < max) {
  4788. code = str.charCodeAt(pos);
  4789. if (code === 0x0A /* \n */ || isSpace(code)) { return result; }
  4790. if (code === 0x3E /* > */) {
  4791. result.pos = pos + 1;
  4792. result.str = unescapeAll(str.slice(start + 1, pos));
  4793. result.ok = true;
  4794. return result;
  4795. }
  4796. if (code === 0x5C /* \ */ && pos + 1 < max) {
  4797. pos += 2;
  4798. continue;
  4799. }
  4800. pos++;
  4801. }
  4802. // no closing '>'
  4803. return result;
  4804. }
  4805. // this should be ... } else { ... branch
  4806. level = 0;
  4807. while (pos < max) {
  4808. code = str.charCodeAt(pos);
  4809. if (code === 0x20) { break; }
  4810. // ascii control characters
  4811. if (code < 0x20 || code === 0x7F) { break; }
  4812. if (code === 0x5C /* \ */ && pos + 1 < max) {
  4813. pos += 2;
  4814. continue;
  4815. }
  4816. if (code === 0x28 /* ( */) {
  4817. level++;
  4818. }
  4819. if (code === 0x29 /* ) */) {
  4820. if (level === 0) { break; }
  4821. level--;
  4822. }
  4823. pos++;
  4824. }
  4825. if (start === pos) { return result; }
  4826. if (level !== 0) { return result; }
  4827. result.str = unescapeAll(str.slice(start, pos));
  4828. result.lines = lines;
  4829. result.pos = pos;
  4830. result.ok = true;
  4831. return result;
  4832. };
  4833. /***/ }),
  4834. /* 41 */
  4835. /***/ (function(module, exports, __webpack_require__) {
  4836. "use strict";
  4837. // Parse link title
  4838. //
  4839. var unescapeAll = __webpack_require__(0).unescapeAll;
  4840. module.exports = function parseLinkTitle(str, pos, max) {
  4841. var code,
  4842. marker,
  4843. lines = 0,
  4844. start = pos,
  4845. result = {
  4846. ok: false,
  4847. pos: 0,
  4848. lines: 0,
  4849. str: ''
  4850. };
  4851. if (pos >= max) { return result; }
  4852. marker = str.charCodeAt(pos);
  4853. if (marker !== 0x22 /* " */ && marker !== 0x27 /* ' */ && marker !== 0x28 /* ( */) { return result; }
  4854. pos++;
  4855. // if opening marker is "(", switch it to closing marker ")"
  4856. if (marker === 0x28) { marker = 0x29; }
  4857. while (pos < max) {
  4858. code = str.charCodeAt(pos);
  4859. if (code === marker) {
  4860. result.pos = pos + 1;
  4861. result.lines = lines;
  4862. result.str = unescapeAll(str.slice(start + 1, pos));
  4863. result.ok = true;
  4864. return result;
  4865. } else if (code === 0x0A) {
  4866. lines++;
  4867. } else if (code === 0x5C /* \ */ && pos + 1 < max) {
  4868. pos++;
  4869. if (str.charCodeAt(pos) === 0x0A) {
  4870. lines++;
  4871. }
  4872. }
  4873. pos++;
  4874. }
  4875. return result;
  4876. };
  4877. /***/ }),
  4878. /* 42 */
  4879. /***/ (function(module, exports, __webpack_require__) {
  4880. "use strict";
  4881. /**
  4882. * class Renderer
  4883. *
  4884. * Generates HTML from parsed token stream. Each instance has independent
  4885. * copy of rules. Those can be rewritten with ease. Also, you can add new
  4886. * rules if you create plugin and adds new token types.
  4887. **/
  4888. var assign = __webpack_require__(0).assign;
  4889. var unescapeAll = __webpack_require__(0).unescapeAll;
  4890. var escapeHtml = __webpack_require__(0).escapeHtml;
  4891. ////////////////////////////////////////////////////////////////////////////////
  4892. var default_rules = {};
  4893. default_rules.code_inline = function (tokens, idx, options, env, slf) {
  4894. var token = tokens[idx];
  4895. return '<code' + slf.renderAttrs(token) + '>' +
  4896. escapeHtml(tokens[idx].content) +
  4897. '</code>';
  4898. };
  4899. default_rules.code_block = function (tokens, idx, options, env, slf) {
  4900. var token = tokens[idx];
  4901. return '<pre' + slf.renderAttrs(token) + '><code>' +
  4902. escapeHtml(tokens[idx].content) +
  4903. '</code></pre>\n';
  4904. };
  4905. default_rules.fence = function (tokens, idx, options, env, slf) {
  4906. var token = tokens[idx],
  4907. info = token.info ? unescapeAll(token.info).trim() : '',
  4908. langName = '',
  4909. highlighted, i, tmpAttrs, tmpToken;
  4910. if (info) {
  4911. langName = info.split(/\s+/g)[0];
  4912. }
  4913. if (options.highlight) {
  4914. highlighted = options.highlight(token.content, langName) || escapeHtml(token.content);
  4915. } else {
  4916. highlighted = escapeHtml(token.content);
  4917. }
  4918. if (highlighted.indexOf('<pre') === 0) {
  4919. return highlighted + '\n';
  4920. }
  4921. // If language exists, inject class gently, without modifying original token.
  4922. // May be, one day we will add .clone() for token and simplify this part, but
  4923. // now we prefer to keep things local.
  4924. if (info) {
  4925. i = token.attrIndex('class');
  4926. tmpAttrs = token.attrs ? token.attrs.slice() : [];
  4927. if (i < 0) {
  4928. tmpAttrs.push([ 'class', options.langPrefix + langName ]);
  4929. } else {
  4930. tmpAttrs[i][1] += ' ' + options.langPrefix + langName;
  4931. }
  4932. // Fake token just to render attributes
  4933. tmpToken = {
  4934. attrs: tmpAttrs
  4935. };
  4936. return '<pre><code' + slf.renderAttrs(tmpToken) + '>'
  4937. + highlighted
  4938. + '</code></pre>\n';
  4939. }
  4940. return '<pre><code' + slf.renderAttrs(token) + '>'
  4941. + highlighted
  4942. + '</code></pre>\n';
  4943. };
  4944. default_rules.image = function (tokens, idx, options, env, slf) {
  4945. var token = tokens[idx];
  4946. // "alt" attr MUST be set, even if empty. Because it's mandatory and
  4947. // should be placed on proper position for tests.
  4948. //
  4949. // Replace content with actual value
  4950. token.attrs[token.attrIndex('alt')][1] =
  4951. slf.renderInlineAsText(token.children, options, env);
  4952. return slf.renderToken(tokens, idx, options);
  4953. };
  4954. default_rules.hardbreak = function (tokens, idx, options /*, env */) {
  4955. return options.xhtmlOut ? '<br />\n' : '<br>\n';
  4956. };
  4957. default_rules.softbreak = function (tokens, idx, options /*, env */) {
  4958. return options.breaks ? (options.xhtmlOut ? '<br />\n' : '<br>\n') : '\n';
  4959. };
  4960. default_rules.text = function (tokens, idx /*, options, env */) {
  4961. return escapeHtml(tokens[idx].content);
  4962. };
  4963. default_rules.html_block = function (tokens, idx /*, options, env */) {
  4964. return tokens[idx].content;
  4965. };
  4966. default_rules.html_inline = function (tokens, idx /*, options, env */) {
  4967. return tokens[idx].content;
  4968. };
  4969. /**
  4970. * new Renderer()
  4971. *
  4972. * Creates new [[Renderer]] instance and fill [[Renderer#rules]] with defaults.
  4973. **/
  4974. function Renderer() {
  4975. /**
  4976. * Renderer#rules -> Object
  4977. *
  4978. * Contains render rules for tokens. Can be updated and extended.
  4979. *
  4980. * ##### Example
  4981. *
  4982. * ```javascript
  4983. * var md = require('markdown-it')();
  4984. *
  4985. * md.renderer.rules.strong_open = function () { return '<b>'; };
  4986. * md.renderer.rules.strong_close = function () { return '</b>'; };
  4987. *
  4988. * var result = md.renderInline(...);
  4989. * ```
  4990. *
  4991. * Each rule is called as independed static function with fixed signature:
  4992. *
  4993. * ```javascript
  4994. * function my_token_render(tokens, idx, options, env, renderer) {
  4995. * // ...
  4996. * return renderedHTML;
  4997. * }
  4998. * ```
  4999. *
  5000. * See [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js)
  5001. * for more details and examples.
  5002. **/
  5003. this.rules = assign({}, default_rules);
  5004. }
  5005. /**
  5006. * Renderer.renderAttrs(token) -> String
  5007. *
  5008. * Render token attributes to string.
  5009. **/
  5010. Renderer.prototype.renderAttrs = function renderAttrs(token) {
  5011. var i, l, result;
  5012. if (!token.attrs) { return ''; }
  5013. result = '';
  5014. for (i = 0, l = token.attrs.length; i < l; i++) {
  5015. result += ' ' + escapeHtml(token.attrs[i][0]) + '="' + escapeHtml(token.attrs[i][1]) + '"';
  5016. }
  5017. return result;
  5018. };
  5019. /**
  5020. * Renderer.renderToken(tokens, idx, options) -> String
  5021. * - tokens (Array): list of tokens
  5022. * - idx (Numbed): token index to render
  5023. * - options (Object): params of parser instance
  5024. *
  5025. * Default token renderer. Can be overriden by custom function
  5026. * in [[Renderer#rules]].
  5027. **/
  5028. Renderer.prototype.renderToken = function renderToken(tokens, idx, options) {
  5029. var nextToken,
  5030. result = '',
  5031. needLf = false,
  5032. token = tokens[idx];
  5033. // Tight list paragraphs
  5034. if (token.hidden) {
  5035. return '';
  5036. }
  5037. // Insert a newline between hidden paragraph and subsequent opening
  5038. // block-level tag.
  5039. //
  5040. // For example, here we should insert a newline before blockquote:
  5041. // - a
  5042. // >
  5043. //
  5044. if (token.block && token.nesting !== -1 && idx && tokens[idx - 1].hidden) {
  5045. result += '\n';
  5046. }
  5047. // Add token name, e.g. `<img`
  5048. result += (token.nesting === -1 ? '</' : '<') + token.tag;
  5049. // Encode attributes, e.g. `<img src="foo"`
  5050. result += this.renderAttrs(token);
  5051. // Add a slash for self-closing tags, e.g. `<img src="foo" /`
  5052. if (token.nesting === 0 && options.xhtmlOut) {
  5053. result += ' /';
  5054. }
  5055. // Check if we need to add a newline after this tag
  5056. if (token.block) {
  5057. needLf = true;
  5058. if (token.nesting === 1) {
  5059. if (idx + 1 < tokens.length) {
  5060. nextToken = tokens[idx + 1];
  5061. if (nextToken.type === 'inline' || nextToken.hidden) {
  5062. // Block-level tag containing an inline tag.
  5063. //
  5064. needLf = false;
  5065. } else if (nextToken.nesting === -1 && nextToken.tag === token.tag) {
  5066. // Opening tag + closing tag of the same type. E.g. `<li></li>`.
  5067. //
  5068. needLf = false;
  5069. }
  5070. }
  5071. }
  5072. }
  5073. result += needLf ? '>\n' : '>';
  5074. return result;
  5075. };
  5076. /**
  5077. * Renderer.renderInline(tokens, options, env) -> String
  5078. * - tokens (Array): list on block tokens to renter
  5079. * - options (Object): params of parser instance
  5080. * - env (Object): additional data from parsed input (references, for example)
  5081. *
  5082. * The same as [[Renderer.render]], but for single token of `inline` type.
  5083. **/
  5084. Renderer.prototype.renderInline = function (tokens, options, env) {
  5085. var type,
  5086. result = '',
  5087. rules = this.rules;
  5088. for (var i = 0, len = tokens.length; i < len; i++) {
  5089. type = tokens[i].type;
  5090. if (typeof rules[type] !== 'undefined') {
  5091. result += rules[type](tokens, i, options, env, this);
  5092. } else {
  5093. result += this.renderToken(tokens, i, options);
  5094. }
  5095. }
  5096. return result;
  5097. };
  5098. /** internal
  5099. * Renderer.renderInlineAsText(tokens, options, env) -> String
  5100. * - tokens (Array): list on block tokens to renter
  5101. * - options (Object): params of parser instance
  5102. * - env (Object): additional data from parsed input (references, for example)
  5103. *
  5104. * Special kludge for image `alt` attributes to conform CommonMark spec.
  5105. * Don't try to use it! Spec requires to show `alt` content with stripped markup,
  5106. * instead of simple escaping.
  5107. **/
  5108. Renderer.prototype.renderInlineAsText = function (tokens, options, env) {
  5109. var result = '';
  5110. for (var i = 0, len = tokens.length; i < len; i++) {
  5111. if (tokens[i].type === 'text') {
  5112. result += tokens[i].content;
  5113. } else if (tokens[i].type === 'image') {
  5114. result += this.renderInlineAsText(tokens[i].children, options, env);
  5115. }
  5116. }
  5117. return result;
  5118. };
  5119. /**
  5120. * Renderer.render(tokens, options, env) -> String
  5121. * - tokens (Array): list on block tokens to renter
  5122. * - options (Object): params of parser instance
  5123. * - env (Object): additional data from parsed input (references, for example)
  5124. *
  5125. * Takes token stream and generates HTML. Probably, you will never need to call
  5126. * this method directly.
  5127. **/
  5128. Renderer.prototype.render = function (tokens, options, env) {
  5129. var i, len, type,
  5130. result = '',
  5131. rules = this.rules;
  5132. for (i = 0, len = tokens.length; i < len; i++) {
  5133. type = tokens[i].type;
  5134. if (type === 'inline') {
  5135. result += this.renderInline(tokens[i].children, options, env);
  5136. } else if (typeof rules[type] !== 'undefined') {
  5137. result += rules[tokens[i].type](tokens, i, options, env, this);
  5138. } else {
  5139. result += this.renderToken(tokens, i, options, env);
  5140. }
  5141. }
  5142. return result;
  5143. };
  5144. module.exports = Renderer;
  5145. /***/ }),
  5146. /* 43 */
  5147. /***/ (function(module, exports, __webpack_require__) {
  5148. "use strict";
  5149. /** internal
  5150. * class Core
  5151. *
  5152. * Top-level rules executor. Glues block/inline parsers and does intermediate
  5153. * transformations.
  5154. **/
  5155. var Ruler = __webpack_require__(6);
  5156. var _rules = [
  5157. [ 'normalize', __webpack_require__(44) ],
  5158. [ 'block', __webpack_require__(45) ],
  5159. [ 'inline', __webpack_require__(46) ],
  5160. [ 'linkify', __webpack_require__(47) ],
  5161. [ 'replacements', __webpack_require__(48) ],
  5162. [ 'smartquotes', __webpack_require__(49) ]
  5163. ];
  5164. /**
  5165. * new Core()
  5166. **/
  5167. function Core() {
  5168. /**
  5169. * Core#ruler -> Ruler
  5170. *
  5171. * [[Ruler]] instance. Keep configuration of core rules.
  5172. **/
  5173. this.ruler = new Ruler();
  5174. for (var i = 0; i < _rules.length; i++) {
  5175. this.ruler.push(_rules[i][0], _rules[i][1]);
  5176. }
  5177. }
  5178. /**
  5179. * Core.process(state)
  5180. *
  5181. * Executes core chain rules.
  5182. **/
  5183. Core.prototype.process = function (state) {
  5184. var i, l, rules;
  5185. rules = this.ruler.getRules('');
  5186. for (i = 0, l = rules.length; i < l; i++) {
  5187. rules[i](state);
  5188. }
  5189. };
  5190. Core.prototype.State = __webpack_require__(50);
  5191. module.exports = Core;
  5192. /***/ }),
  5193. /* 44 */
  5194. /***/ (function(module, exports, __webpack_require__) {
  5195. "use strict";
  5196. // Normalize input string
  5197. var NEWLINES_RE = /\r[\n\u0085]?|[\u2424\u2028\u0085]/g;
  5198. var NULL_RE = /\u0000/g;
  5199. module.exports = function inline(state) {
  5200. var str;
  5201. // Normalize newlines
  5202. str = state.src.replace(NEWLINES_RE, '\n');
  5203. // Replace NULL characters
  5204. str = str.replace(NULL_RE, '\uFFFD');
  5205. state.src = str;
  5206. };
  5207. /***/ }),
  5208. /* 45 */
  5209. /***/ (function(module, exports, __webpack_require__) {
  5210. "use strict";
  5211. module.exports = function block(state) {
  5212. var token;
  5213. if (state.inlineMode) {
  5214. token = new state.Token('inline', '', 0);
  5215. token.content = state.src;
  5216. token.map = [ 0, 1 ];
  5217. token.children = [];
  5218. state.tokens.push(token);
  5219. } else {
  5220. state.md.block.parse(state.src, state.md, state.env, state.tokens);
  5221. }
  5222. };
  5223. /***/ }),
  5224. /* 46 */
  5225. /***/ (function(module, exports, __webpack_require__) {
  5226. "use strict";
  5227. module.exports = function inline(state) {
  5228. var tokens = state.tokens, tok, i, l;
  5229. // Parse inlines
  5230. for (i = 0, l = tokens.length; i < l; i++) {
  5231. tok = tokens[i];
  5232. if (tok.type === 'inline') {
  5233. state.md.inline.parse(tok.content, state.md, state.env, tok.children);
  5234. }
  5235. }
  5236. };
  5237. /***/ }),
  5238. /* 47 */
  5239. /***/ (function(module, exports, __webpack_require__) {
  5240. "use strict";
  5241. // Replace link-like texts with link nodes.
  5242. //
  5243. // Currently restricted by `md.validateLink()` to http/https/ftp
  5244. //
  5245. var arrayReplaceAt = __webpack_require__(0).arrayReplaceAt;
  5246. function isLinkOpen(str) {
  5247. return /^<a[>\s]/i.test(str);
  5248. }
  5249. function isLinkClose(str) {
  5250. return /^<\/a\s*>/i.test(str);
  5251. }
  5252. module.exports = function linkify(state) {
  5253. var i, j, l, tokens, token, currentToken, nodes, ln, text, pos, lastPos,
  5254. level, htmlLinkLevel, url, fullUrl, urlText,
  5255. blockTokens = state.tokens,
  5256. links;
  5257. if (!state.md.options.linkify) { return; }
  5258. for (j = 0, l = blockTokens.length; j < l; j++) {
  5259. if (blockTokens[j].type !== 'inline' ||
  5260. !state.md.linkify.pretest(blockTokens[j].content)) {
  5261. continue;
  5262. }
  5263. tokens = blockTokens[j].children;
  5264. htmlLinkLevel = 0;
  5265. // We scan from the end, to keep position when new tags added.
  5266. // Use reversed logic in links start/end match
  5267. for (i = tokens.length - 1; i >= 0; i--) {
  5268. currentToken = tokens[i];
  5269. // Skip content of markdown links
  5270. if (currentToken.type === 'link_close') {
  5271. i--;
  5272. while (tokens[i].level !== currentToken.level && tokens[i].type !== 'link_open') {
  5273. i--;
  5274. }
  5275. continue;
  5276. }
  5277. // Skip content of html tag links
  5278. if (currentToken.type === 'html_inline') {
  5279. if (isLinkOpen(currentToken.content) && htmlLinkLevel > 0) {
  5280. htmlLinkLevel--;
  5281. }
  5282. if (isLinkClose(currentToken.content)) {
  5283. htmlLinkLevel++;
  5284. }
  5285. }
  5286. if (htmlLinkLevel > 0) { continue; }
  5287. if (currentToken.type === 'text' && state.md.linkify.test(currentToken.content)) {
  5288. text = currentToken.content;
  5289. links = state.md.linkify.match(text);
  5290. // Now split string to nodes
  5291. nodes = [];
  5292. level = currentToken.level;
  5293. lastPos = 0;
  5294. for (ln = 0; ln < links.length; ln++) {
  5295. url = links[ln].url;
  5296. fullUrl = state.md.normalizeLink(url);
  5297. if (!state.md.validateLink(fullUrl)) { continue; }
  5298. urlText = links[ln].text;
  5299. // Linkifier might send raw hostnames like "example.com", where url
  5300. // starts with domain name. So we prepend http:// in those cases,
  5301. // and remove it afterwards.
  5302. //
  5303. if (!links[ln].schema) {
  5304. urlText = state.md.normalizeLinkText('http://' + urlText).replace(/^http:\/\//, '');
  5305. } else if (links[ln].schema === 'mailto:' && !/^mailto:/i.test(urlText)) {
  5306. urlText = state.md.normalizeLinkText('mailto:' + urlText).replace(/^mailto:/, '');
  5307. } else {
  5308. urlText = state.md.normalizeLinkText(urlText);
  5309. }
  5310. pos = links[ln].index;
  5311. if (pos > lastPos) {
  5312. token = new state.Token('text', '', 0);
  5313. token.content = text.slice(lastPos, pos);
  5314. token.level = level;
  5315. nodes.push(token);
  5316. }
  5317. token = new state.Token('link_open', 'a', 1);
  5318. token.attrs = [ [ 'href', fullUrl ] ];
  5319. token.level = level++;
  5320. token.markup = 'linkify';
  5321. token.info = 'auto';
  5322. nodes.push(token);
  5323. token = new state.Token('text', '', 0);
  5324. token.content = urlText;
  5325. token.level = level;
  5326. nodes.push(token);
  5327. token = new state.Token('link_close', 'a', -1);
  5328. token.level = --level;
  5329. token.markup = 'linkify';
  5330. token.info = 'auto';
  5331. nodes.push(token);
  5332. lastPos = links[ln].lastIndex;
  5333. }
  5334. if (lastPos < text.length) {
  5335. token = new state.Token('text', '', 0);
  5336. token.content = text.slice(lastPos);
  5337. token.level = level;
  5338. nodes.push(token);
  5339. }
  5340. // replace current node
  5341. blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);
  5342. }
  5343. }
  5344. }
  5345. };
  5346. /***/ }),
  5347. /* 48 */
  5348. /***/ (function(module, exports, __webpack_require__) {
  5349. "use strict";
  5350. // Simple typographyc replacements
  5351. //
  5352. // (c) (C) → ©
  5353. // (tm) (TM) → ™
  5354. // (r) (R) → ®
  5355. // +- → ±
  5356. // (p) (P) -> §
  5357. // ... → … (also ?.... → ?.., !.... → !..)
  5358. // ???????? → ???, !!!!! → !!!, `,,` → `,`
  5359. // -- → &ndash;, --- → &mdash;
  5360. //
  5361. // TODO:
  5362. // - fractionals 1/2, 1/4, 3/4 -> ½, ¼, ¾
  5363. // - miltiplication 2 x 4 -> 2 × 4
  5364. var RARE_RE = /\+-|\.\.|\?\?\?\?|!!!!|,,|--/;
  5365. // Workaround for phantomjs - need regex without /g flag,
  5366. // or root check will fail every second time
  5367. var SCOPED_ABBR_TEST_RE = /\((c|tm|r|p)\)/i;
  5368. var SCOPED_ABBR_RE = /\((c|tm|r|p)\)/ig;
  5369. var SCOPED_ABBR = {
  5370. c: '©',
  5371. r: '®',
  5372. p: '§',
  5373. tm: '™'
  5374. };
  5375. function replaceFn(match, name) {
  5376. return SCOPED_ABBR[name.toLowerCase()];
  5377. }
  5378. function replace_scoped(inlineTokens) {
  5379. var i, token, inside_autolink = 0;
  5380. for (i = inlineTokens.length - 1; i >= 0; i--) {
  5381. token = inlineTokens[i];
  5382. if (token.type === 'text' && !inside_autolink) {
  5383. token.content = token.content.replace(SCOPED_ABBR_RE, replaceFn);
  5384. }
  5385. if (token.type === 'link_open' && token.info === 'auto') {
  5386. inside_autolink--;
  5387. }
  5388. if (token.type === 'link_close' && token.info === 'auto') {
  5389. inside_autolink++;
  5390. }
  5391. }
  5392. }
  5393. function replace_rare(inlineTokens) {
  5394. var i, token, inside_autolink = 0;
  5395. for (i = inlineTokens.length - 1; i >= 0; i--) {
  5396. token = inlineTokens[i];
  5397. if (token.type === 'text' && !inside_autolink) {
  5398. if (RARE_RE.test(token.content)) {
  5399. token.content = token.content
  5400. .replace(/\+-/g, '±')
  5401. // .., ..., ....... -> …
  5402. // but ?..... & !..... -> ?.. & !..
  5403. .replace(/\.{2,}/g, '…').replace(/([?!])…/g, '$1..')
  5404. .replace(/([?!]){4,}/g, '$1$1$1').replace(/,{2,}/g, ',')
  5405. // em-dash
  5406. .replace(/(^|[^-])---([^-]|$)/mg, '$1\u2014$2')
  5407. // en-dash
  5408. .replace(/(^|\s)--(\s|$)/mg, '$1\u2013$2')
  5409. .replace(/(^|[^-\s])--([^-\s]|$)/mg, '$1\u2013$2');
  5410. }
  5411. }
  5412. if (token.type === 'link_open' && token.info === 'auto') {
  5413. inside_autolink--;
  5414. }
  5415. if (token.type === 'link_close' && token.info === 'auto') {
  5416. inside_autolink++;
  5417. }
  5418. }
  5419. }
  5420. module.exports = function replace(state) {
  5421. var blkIdx;
  5422. if (!state.md.options.typographer) { return; }
  5423. for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {
  5424. if (state.tokens[blkIdx].type !== 'inline') { continue; }
  5425. if (SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)) {
  5426. replace_scoped(state.tokens[blkIdx].children);
  5427. }
  5428. if (RARE_RE.test(state.tokens[blkIdx].content)) {
  5429. replace_rare(state.tokens[blkIdx].children);
  5430. }
  5431. }
  5432. };
  5433. /***/ }),
  5434. /* 49 */
  5435. /***/ (function(module, exports, __webpack_require__) {
  5436. "use strict";
  5437. // Convert straight quotation marks to typographic ones
  5438. //
  5439. var isWhiteSpace = __webpack_require__(0).isWhiteSpace;
  5440. var isPunctChar = __webpack_require__(0).isPunctChar;
  5441. var isMdAsciiPunct = __webpack_require__(0).isMdAsciiPunct;
  5442. var QUOTE_TEST_RE = /['"]/;
  5443. var QUOTE_RE = /['"]/g;
  5444. var APOSTROPHE = '\u2019'; /* ’ */
  5445. function replaceAt(str, index, ch) {
  5446. return str.substr(0, index) + ch + str.substr(index + 1);
  5447. }
  5448. function process_inlines(tokens, state) {
  5449. var i, token, text, t, pos, max, thisLevel, item, lastChar, nextChar,
  5450. isLastPunctChar, isNextPunctChar, isLastWhiteSpace, isNextWhiteSpace,
  5451. canOpen, canClose, j, isSingle, stack, openQuote, closeQuote;
  5452. stack = [];
  5453. for (i = 0; i < tokens.length; i++) {
  5454. token = tokens[i];
  5455. thisLevel = tokens[i].level;
  5456. for (j = stack.length - 1; j >= 0; j--) {
  5457. if (stack[j].level <= thisLevel) { break; }
  5458. }
  5459. stack.length = j + 1;
  5460. if (token.type !== 'text') { continue; }
  5461. text = token.content;
  5462. pos = 0;
  5463. max = text.length;
  5464. /*eslint no-labels:0,block-scoped-var:0*/
  5465. OUTER:
  5466. while (pos < max) {
  5467. QUOTE_RE.lastIndex = pos;
  5468. t = QUOTE_RE.exec(text);
  5469. if (!t) { break; }
  5470. canOpen = canClose = true;
  5471. pos = t.index + 1;
  5472. isSingle = (t[0] === "'");
  5473. // Find previous character,
  5474. // default to space if it's the beginning of the line
  5475. //
  5476. lastChar = 0x20;
  5477. if (t.index - 1 >= 0) {
  5478. lastChar = text.charCodeAt(t.index - 1);
  5479. } else {
  5480. for (j = i - 1; j >= 0; j--) {
  5481. if (tokens[j].type !== 'text') { continue; }
  5482. lastChar = tokens[j].content.charCodeAt(tokens[j].content.length - 1);
  5483. break;
  5484. }
  5485. }
  5486. // Find next character,
  5487. // default to space if it's the end of the line
  5488. //
  5489. nextChar = 0x20;
  5490. if (pos < max) {
  5491. nextChar = text.charCodeAt(pos);
  5492. } else {
  5493. for (j = i + 1; j < tokens.length; j++) {
  5494. if (tokens[j].type !== 'text') { continue; }
  5495. nextChar = tokens[j].content.charCodeAt(0);
  5496. break;
  5497. }
  5498. }
  5499. isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
  5500. isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
  5501. isLastWhiteSpace = isWhiteSpace(lastChar);
  5502. isNextWhiteSpace = isWhiteSpace(nextChar);
  5503. if (isNextWhiteSpace) {
  5504. canOpen = false;
  5505. } else if (isNextPunctChar) {
  5506. if (!(isLastWhiteSpace || isLastPunctChar)) {
  5507. canOpen = false;
  5508. }
  5509. }
  5510. if (isLastWhiteSpace) {
  5511. canClose = false;
  5512. } else if (isLastPunctChar) {
  5513. if (!(isNextWhiteSpace || isNextPunctChar)) {
  5514. canClose = false;
  5515. }
  5516. }
  5517. if (nextChar === 0x22 /* " */ && t[0] === '"') {
  5518. if (lastChar >= 0x30 /* 0 */ && lastChar <= 0x39 /* 9 */) {
  5519. // special case: 1"" - count first quote as an inch
  5520. canClose = canOpen = false;
  5521. }
  5522. }
  5523. if (canOpen && canClose) {
  5524. // treat this as the middle of the word
  5525. canOpen = false;
  5526. canClose = isNextPunctChar;
  5527. }
  5528. if (!canOpen && !canClose) {
  5529. // middle of word
  5530. if (isSingle) {
  5531. token.content = replaceAt(token.content, t.index, APOSTROPHE);
  5532. }
  5533. continue;
  5534. }
  5535. if (canClose) {
  5536. // this could be a closing quote, rewind the stack to get a match
  5537. for (j = stack.length - 1; j >= 0; j--) {
  5538. item = stack[j];
  5539. if (stack[j].level < thisLevel) { break; }
  5540. if (item.single === isSingle && stack[j].level === thisLevel) {
  5541. item = stack[j];
  5542. if (isSingle) {
  5543. openQuote = state.md.options.quotes[2];
  5544. closeQuote = state.md.options.quotes[3];
  5545. } else {
  5546. openQuote = state.md.options.quotes[0];
  5547. closeQuote = state.md.options.quotes[1];
  5548. }
  5549. // replace token.content *before* tokens[item.token].content,
  5550. // because, if they are pointing at the same token, replaceAt
  5551. // could mess up indices when quote length != 1
  5552. token.content = replaceAt(token.content, t.index, closeQuote);
  5553. tokens[item.token].content = replaceAt(
  5554. tokens[item.token].content, item.pos, openQuote);
  5555. pos += closeQuote.length - 1;
  5556. if (item.token === i) { pos += openQuote.length - 1; }
  5557. text = token.content;
  5558. max = text.length;
  5559. stack.length = j;
  5560. continue OUTER;
  5561. }
  5562. }
  5563. }
  5564. if (canOpen) {
  5565. stack.push({
  5566. token: i,
  5567. pos: t.index,
  5568. single: isSingle,
  5569. level: thisLevel
  5570. });
  5571. } else if (canClose && isSingle) {
  5572. token.content = replaceAt(token.content, t.index, APOSTROPHE);
  5573. }
  5574. }
  5575. }
  5576. }
  5577. module.exports = function smartquotes(state) {
  5578. /*eslint max-depth:0*/
  5579. var blkIdx;
  5580. if (!state.md.options.typographer) { return; }
  5581. for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {
  5582. if (state.tokens[blkIdx].type !== 'inline' ||
  5583. !QUOTE_TEST_RE.test(state.tokens[blkIdx].content)) {
  5584. continue;
  5585. }
  5586. process_inlines(state.tokens[blkIdx].children, state);
  5587. }
  5588. };
  5589. /***/ }),
  5590. /* 50 */
  5591. /***/ (function(module, exports, __webpack_require__) {
  5592. "use strict";
  5593. // Core state object
  5594. //
  5595. var Token = __webpack_require__(7);
  5596. function StateCore(src, md, env) {
  5597. this.src = src;
  5598. this.env = env;
  5599. this.tokens = [];
  5600. this.inlineMode = false;
  5601. this.md = md; // link to parser instance
  5602. }
  5603. // re-export Token class to use in core rules
  5604. StateCore.prototype.Token = Token;
  5605. module.exports = StateCore;
  5606. /***/ }),
  5607. /* 51 */
  5608. /***/ (function(module, exports, __webpack_require__) {
  5609. "use strict";
  5610. /** internal
  5611. * class ParserBlock
  5612. *
  5613. * Block-level tokenizer.
  5614. **/
  5615. var Ruler = __webpack_require__(6);
  5616. var _rules = [
  5617. // First 2 params - rule name & source. Secondary array - list of rules,
  5618. // which can be terminated by this one.
  5619. [ 'table', __webpack_require__(52), [ 'paragraph', 'reference' ] ],
  5620. [ 'code', __webpack_require__(53) ],
  5621. [ 'fence', __webpack_require__(54), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],
  5622. [ 'blockquote', __webpack_require__(55), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],
  5623. [ 'hr', __webpack_require__(56), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],
  5624. [ 'list', __webpack_require__(57), [ 'paragraph', 'reference', 'blockquote' ] ],
  5625. [ 'reference', __webpack_require__(58) ],
  5626. [ 'heading', __webpack_require__(59), [ 'paragraph', 'reference', 'blockquote' ] ],
  5627. [ 'lheading', __webpack_require__(60) ],
  5628. [ 'html_block', __webpack_require__(61), [ 'paragraph', 'reference', 'blockquote' ] ],
  5629. [ 'paragraph', __webpack_require__(63) ]
  5630. ];
  5631. /**
  5632. * new ParserBlock()
  5633. **/
  5634. function ParserBlock() {
  5635. /**
  5636. * ParserBlock#ruler -> Ruler
  5637. *
  5638. * [[Ruler]] instance. Keep configuration of block rules.
  5639. **/
  5640. this.ruler = new Ruler();
  5641. for (var i = 0; i < _rules.length; i++) {
  5642. this.ruler.push(_rules[i][0], _rules[i][1], { alt: (_rules[i][2] || []).slice() });
  5643. }
  5644. }
  5645. // Generate tokens for input range
  5646. //
  5647. ParserBlock.prototype.tokenize = function (state, startLine, endLine) {
  5648. var ok, i,
  5649. rules = this.ruler.getRules(''),
  5650. len = rules.length,
  5651. line = startLine,
  5652. hasEmptyLines = false,
  5653. maxNesting = state.md.options.maxNesting;
  5654. while (line < endLine) {
  5655. state.line = line = state.skipEmptyLines(line);
  5656. if (line >= endLine) { break; }
  5657. // Termination condition for nested calls.
  5658. // Nested calls currently used for blockquotes & lists
  5659. if (state.sCount[line] < state.blkIndent) { break; }
  5660. // If nesting level exceeded - skip tail to the end. That's not ordinary
  5661. // situation and we should not care about content.
  5662. if (state.level >= maxNesting) {
  5663. state.line = endLine;
  5664. break;
  5665. }
  5666. // Try all possible rules.
  5667. // On success, rule should:
  5668. //
  5669. // - update `state.line`
  5670. // - update `state.tokens`
  5671. // - return true
  5672. for (i = 0; i < len; i++) {
  5673. ok = rules[i](state, line, endLine, false);
  5674. if (ok) { break; }
  5675. }
  5676. // set state.tight if we had an empty line before current tag
  5677. // i.e. latest empty line should not count
  5678. state.tight = !hasEmptyLines;
  5679. // paragraph might "eat" one newline after it in nested lists
  5680. if (state.isEmpty(state.line - 1)) {
  5681. hasEmptyLines = true;
  5682. }
  5683. line = state.line;
  5684. if (line < endLine && state.isEmpty(line)) {
  5685. hasEmptyLines = true;
  5686. line++;
  5687. state.line = line;
  5688. }
  5689. }
  5690. };
  5691. /**
  5692. * ParserBlock.parse(str, md, env, outTokens)
  5693. *
  5694. * Process input string and push block tokens into `outTokens`
  5695. **/
  5696. ParserBlock.prototype.parse = function (src, md, env, outTokens) {
  5697. var state;
  5698. if (!src) { return; }
  5699. state = new this.State(src, md, env, outTokens);
  5700. this.tokenize(state, state.line, state.lineMax);
  5701. };
  5702. ParserBlock.prototype.State = __webpack_require__(64);
  5703. module.exports = ParserBlock;
  5704. /***/ }),
  5705. /* 52 */
  5706. /***/ (function(module, exports, __webpack_require__) {
  5707. "use strict";
  5708. // GFM table, non-standard
  5709. var isSpace = __webpack_require__(0).isSpace;
  5710. function getLine(state, line) {
  5711. var pos = state.bMarks[line] + state.blkIndent,
  5712. max = state.eMarks[line];
  5713. return state.src.substr(pos, max - pos);
  5714. }
  5715. function escapedSplit(str) {
  5716. var result = [],
  5717. pos = 0,
  5718. max = str.length,
  5719. ch,
  5720. escapes = 0,
  5721. lastPos = 0,
  5722. backTicked = false,
  5723. lastBackTick = 0;
  5724. ch = str.charCodeAt(pos);
  5725. while (pos < max) {
  5726. if (ch === 0x60/* ` */) {
  5727. if (backTicked) {
  5728. // make \` close code sequence, but not open it;
  5729. // the reason is: `\` is correct code block
  5730. backTicked = false;
  5731. lastBackTick = pos;
  5732. } else if (escapes % 2 === 0) {
  5733. backTicked = true;
  5734. lastBackTick = pos;
  5735. }
  5736. } else if (ch === 0x7c/* | */ && (escapes % 2 === 0) && !backTicked) {
  5737. result.push(str.substring(lastPos, pos));
  5738. lastPos = pos + 1;
  5739. }
  5740. if (ch === 0x5c/* \ */) {
  5741. escapes++;
  5742. } else {
  5743. escapes = 0;
  5744. }
  5745. pos++;
  5746. // If there was an un-closed backtick, go back to just after
  5747. // the last backtick, but as if it was a normal character
  5748. if (pos === max && backTicked) {
  5749. backTicked = false;
  5750. pos = lastBackTick + 1;
  5751. }
  5752. ch = str.charCodeAt(pos);
  5753. }
  5754. result.push(str.substring(lastPos));
  5755. return result;
  5756. }
  5757. module.exports = function table(state, startLine, endLine, silent) {
  5758. var ch, lineText, pos, i, nextLine, columns, columnCount, token,
  5759. aligns, t, tableLines, tbodyLines;
  5760. // should have at least two lines
  5761. if (startLine + 2 > endLine) { return false; }
  5762. nextLine = startLine + 1;
  5763. if (state.sCount[nextLine] < state.blkIndent) { return false; }
  5764. // if it's indented more than 3 spaces, it should be a code block
  5765. if (state.sCount[nextLine] - state.blkIndent >= 4) { return false; }
  5766. // first character of the second line should be '|', '-', ':',
  5767. // and no other characters are allowed but spaces;
  5768. // basically, this is the equivalent of /^[-:|][-:|\s]*$/ regexp
  5769. pos = state.bMarks[nextLine] + state.tShift[nextLine];
  5770. if (pos >= state.eMarks[nextLine]) { return false; }
  5771. ch = state.src.charCodeAt(pos++);
  5772. if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */ && ch !== 0x3A/* : */) { return false; }
  5773. while (pos < state.eMarks[nextLine]) {
  5774. ch = state.src.charCodeAt(pos);
  5775. if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */ && ch !== 0x3A/* : */ && !isSpace(ch)) { return false; }
  5776. pos++;
  5777. }
  5778. lineText = getLine(state, startLine + 1);
  5779. columns = lineText.split('|');
  5780. aligns = [];
  5781. for (i = 0; i < columns.length; i++) {
  5782. t = columns[i].trim();
  5783. if (!t) {
  5784. // allow empty columns before and after table, but not in between columns;
  5785. // e.g. allow ` |---| `, disallow ` ---||--- `
  5786. if (i === 0 || i === columns.length - 1) {
  5787. continue;
  5788. } else {
  5789. return false;
  5790. }
  5791. }
  5792. if (!/^:?-+:?$/.test(t)) { return false; }
  5793. if (t.charCodeAt(t.length - 1) === 0x3A/* : */) {
  5794. aligns.push(t.charCodeAt(0) === 0x3A/* : */ ? 'center' : 'right');
  5795. } else if (t.charCodeAt(0) === 0x3A/* : */) {
  5796. aligns.push('left');
  5797. } else {
  5798. aligns.push('');
  5799. }
  5800. }
  5801. lineText = getLine(state, startLine).trim();
  5802. if (lineText.indexOf('|') === -1) { return false; }
  5803. if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
  5804. columns = escapedSplit(lineText.replace(/^\||\|$/g, ''));
  5805. // header row will define an amount of columns in the entire table,
  5806. // and align row shouldn't be smaller than that (the rest of the rows can)
  5807. columnCount = columns.length;
  5808. if (columnCount > aligns.length) { return false; }
  5809. if (silent) { return true; }
  5810. token = state.push('table_open', 'table', 1);
  5811. token.map = tableLines = [ startLine, 0 ];
  5812. token = state.push('thead_open', 'thead', 1);
  5813. token.map = [ startLine, startLine + 1 ];
  5814. token = state.push('tr_open', 'tr', 1);
  5815. token.map = [ startLine, startLine + 1 ];
  5816. for (i = 0; i < columns.length; i++) {
  5817. token = state.push('th_open', 'th', 1);
  5818. token.map = [ startLine, startLine + 1 ];
  5819. if (aligns[i]) {
  5820. token.attrs = [ [ 'style', 'text-align:' + aligns[i] ] ];
  5821. }
  5822. token = state.push('inline', '', 0);
  5823. token.content = columns[i].trim();
  5824. token.map = [ startLine, startLine + 1 ];
  5825. token.children = [];
  5826. token = state.push('th_close', 'th', -1);
  5827. }
  5828. token = state.push('tr_close', 'tr', -1);
  5829. token = state.push('thead_close', 'thead', -1);
  5830. token = state.push('tbody_open', 'tbody', 1);
  5831. token.map = tbodyLines = [ startLine + 2, 0 ];
  5832. for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {
  5833. if (state.sCount[nextLine] < state.blkIndent) { break; }
  5834. lineText = getLine(state, nextLine).trim();
  5835. if (lineText.indexOf('|') === -1) { break; }
  5836. if (state.sCount[nextLine] - state.blkIndent >= 4) { break; }
  5837. columns = escapedSplit(lineText.replace(/^\||\|$/g, ''));
  5838. token = state.push('tr_open', 'tr', 1);
  5839. for (i = 0; i < columnCount; i++) {
  5840. token = state.push('td_open', 'td', 1);
  5841. if (aligns[i]) {
  5842. token.attrs = [ [ 'style', 'text-align:' + aligns[i] ] ];
  5843. }
  5844. token = state.push('inline', '', 0);
  5845. token.content = columns[i] ? columns[i].trim() : '';
  5846. token.children = [];
  5847. token = state.push('td_close', 'td', -1);
  5848. }
  5849. token = state.push('tr_close', 'tr', -1);
  5850. }
  5851. token = state.push('tbody_close', 'tbody', -1);
  5852. token = state.push('table_close', 'table', -1);
  5853. tableLines[1] = tbodyLines[1] = nextLine;
  5854. state.line = nextLine;
  5855. return true;
  5856. };
  5857. /***/ }),
  5858. /* 53 */
  5859. /***/ (function(module, exports, __webpack_require__) {
  5860. "use strict";
  5861. // Code block (4 spaces padded)
  5862. module.exports = function code(state, startLine, endLine/*, silent*/) {
  5863. var nextLine, last, token;
  5864. if (state.sCount[startLine] - state.blkIndent < 4) { return false; }
  5865. last = nextLine = startLine + 1;
  5866. while (nextLine < endLine) {
  5867. if (state.isEmpty(nextLine)) {
  5868. nextLine++;
  5869. continue;
  5870. }
  5871. if (state.sCount[nextLine] - state.blkIndent >= 4) {
  5872. nextLine++;
  5873. last = nextLine;
  5874. continue;
  5875. }
  5876. break;
  5877. }
  5878. state.line = last;
  5879. token = state.push('code_block', 'code', 0);
  5880. token.content = state.getLines(startLine, last, 4 + state.blkIndent, true);
  5881. token.map = [ startLine, state.line ];
  5882. return true;
  5883. };
  5884. /***/ }),
  5885. /* 54 */
  5886. /***/ (function(module, exports, __webpack_require__) {
  5887. "use strict";
  5888. // fences (``` lang, ~~~ lang)
  5889. module.exports = function fence(state, startLine, endLine, silent) {
  5890. var marker, len, params, nextLine, mem, token, markup,
  5891. haveEndMarker = false,
  5892. pos = state.bMarks[startLine] + state.tShift[startLine],
  5893. max = state.eMarks[startLine];
  5894. // if it's indented more than 3 spaces, it should be a code block
  5895. if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
  5896. if (pos + 3 > max) { return false; }
  5897. marker = state.src.charCodeAt(pos);
  5898. if (marker !== 0x7E/* ~ */ && marker !== 0x60 /* ` */) {
  5899. return false;
  5900. }
  5901. // scan marker length
  5902. mem = pos;
  5903. pos = state.skipChars(pos, marker);
  5904. len = pos - mem;
  5905. if (len < 3) { return false; }
  5906. markup = state.src.slice(mem, pos);
  5907. params = state.src.slice(pos, max);
  5908. if (params.indexOf(String.fromCharCode(marker)) >= 0) { return false; }
  5909. // Since start is found, we can report success here in validation mode
  5910. if (silent) { return true; }
  5911. // search end of block
  5912. nextLine = startLine;
  5913. for (;;) {
  5914. nextLine++;
  5915. if (nextLine >= endLine) {
  5916. // unclosed block should be autoclosed by end of document.
  5917. // also block seems to be autoclosed by end of parent
  5918. break;
  5919. }
  5920. pos = mem = state.bMarks[nextLine] + state.tShift[nextLine];
  5921. max = state.eMarks[nextLine];
  5922. if (pos < max && state.sCount[nextLine] < state.blkIndent) {
  5923. // non-empty line with negative indent should stop the list:
  5924. // - ```
  5925. // test
  5926. break;
  5927. }
  5928. if (state.src.charCodeAt(pos) !== marker) { continue; }
  5929. if (state.sCount[nextLine] - state.blkIndent >= 4) {
  5930. // closing fence should be indented less than 4 spaces
  5931. continue;
  5932. }
  5933. pos = state.skipChars(pos, marker);
  5934. // closing code fence must be at least as long as the opening one
  5935. if (pos - mem < len) { continue; }
  5936. // make sure tail has spaces only
  5937. pos = state.skipSpaces(pos);
  5938. if (pos < max) { continue; }
  5939. haveEndMarker = true;
  5940. // found!
  5941. break;
  5942. }
  5943. // If a fence has heading spaces, they should be removed from its inner block
  5944. len = state.sCount[startLine];
  5945. state.line = nextLine + (haveEndMarker ? 1 : 0);
  5946. token = state.push('fence', 'code', 0);
  5947. token.info = params;
  5948. token.content = state.getLines(startLine + 1, nextLine, len, true);
  5949. token.markup = markup;
  5950. token.map = [ startLine, state.line ];
  5951. return true;
  5952. };
  5953. /***/ }),
  5954. /* 55 */
  5955. /***/ (function(module, exports, __webpack_require__) {
  5956. "use strict";
  5957. // Block quotes
  5958. var isSpace = __webpack_require__(0).isSpace;
  5959. module.exports = function blockquote(state, startLine, endLine, silent) {
  5960. var adjustTab,
  5961. ch,
  5962. i,
  5963. initial,
  5964. l,
  5965. lastLineEmpty,
  5966. lines,
  5967. nextLine,
  5968. offset,
  5969. oldBMarks,
  5970. oldBSCount,
  5971. oldIndent,
  5972. oldParentType,
  5973. oldSCount,
  5974. oldTShift,
  5975. spaceAfterMarker,
  5976. terminate,
  5977. terminatorRules,
  5978. token,
  5979. wasOutdented,
  5980. oldLineMax = state.lineMax,
  5981. pos = state.bMarks[startLine] + state.tShift[startLine],
  5982. max = state.eMarks[startLine];
  5983. // if it's indented more than 3 spaces, it should be a code block
  5984. if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
  5985. // check the block quote marker
  5986. if (state.src.charCodeAt(pos++) !== 0x3E/* > */) { return false; }
  5987. // we know that it's going to be a valid blockquote,
  5988. // so no point trying to find the end of it in silent mode
  5989. if (silent) { return true; }
  5990. // skip spaces after ">" and re-calculate offset
  5991. initial = offset = state.sCount[startLine] + pos - (state.bMarks[startLine] + state.tShift[startLine]);
  5992. // skip one optional space after '>'
  5993. if (state.src.charCodeAt(pos) === 0x20 /* space */) {
  5994. // ' > test '
  5995. // ^ -- position start of line here:
  5996. pos++;
  5997. initial++;
  5998. offset++;
  5999. adjustTab = false;
  6000. spaceAfterMarker = true;
  6001. } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) {
  6002. spaceAfterMarker = true;
  6003. if ((state.bsCount[startLine] + offset) % 4 === 3) {
  6004. // ' >\t test '
  6005. // ^ -- position start of line here (tab has width===1)
  6006. pos++;
  6007. initial++;
  6008. offset++;
  6009. adjustTab = false;
  6010. } else {
  6011. // ' >\t test '
  6012. // ^ -- position start of line here + shift bsCount slightly
  6013. // to make extra space appear
  6014. adjustTab = true;
  6015. }
  6016. } else {
  6017. spaceAfterMarker = false;
  6018. }
  6019. oldBMarks = [ state.bMarks[startLine] ];
  6020. state.bMarks[startLine] = pos;
  6021. while (pos < max) {
  6022. ch = state.src.charCodeAt(pos);
  6023. if (isSpace(ch)) {
  6024. if (ch === 0x09) {
  6025. offset += 4 - (offset + state.bsCount[startLine] + (adjustTab ? 1 : 0)) % 4;
  6026. } else {
  6027. offset++;
  6028. }
  6029. } else {
  6030. break;
  6031. }
  6032. pos++;
  6033. }
  6034. oldBSCount = [ state.bsCount[startLine] ];
  6035. state.bsCount[startLine] = state.sCount[startLine] + 1 + (spaceAfterMarker ? 1 : 0);
  6036. lastLineEmpty = pos >= max;
  6037. oldSCount = [ state.sCount[startLine] ];
  6038. state.sCount[startLine] = offset - initial;
  6039. oldTShift = [ state.tShift[startLine] ];
  6040. state.tShift[startLine] = pos - state.bMarks[startLine];
  6041. terminatorRules = state.md.block.ruler.getRules('blockquote');
  6042. oldParentType = state.parentType;
  6043. state.parentType = 'blockquote';
  6044. wasOutdented = false;
  6045. // Search the end of the block
  6046. //
  6047. // Block ends with either:
  6048. // 1. an empty line outside:
  6049. // ```
  6050. // > test
  6051. //
  6052. // ```
  6053. // 2. an empty line inside:
  6054. // ```
  6055. // >
  6056. // test
  6057. // ```
  6058. // 3. another tag:
  6059. // ```
  6060. // > test
  6061. // - - -
  6062. // ```
  6063. for (nextLine = startLine + 1; nextLine < endLine; nextLine++) {
  6064. // check if it's outdented, i.e. it's inside list item and indented
  6065. // less than said list item:
  6066. //
  6067. // ```
  6068. // 1. anything
  6069. // > current blockquote
  6070. // 2. checking this line
  6071. // ```
  6072. if (state.sCount[nextLine] < state.blkIndent) wasOutdented = true;
  6073. pos = state.bMarks[nextLine] + state.tShift[nextLine];
  6074. max = state.eMarks[nextLine];
  6075. if (pos >= max) {
  6076. // Case 1: line is not inside the blockquote, and this line is empty.
  6077. break;
  6078. }
  6079. if (state.src.charCodeAt(pos++) === 0x3E/* > */ && !wasOutdented) {
  6080. // This line is inside the blockquote.
  6081. // skip spaces after ">" and re-calculate offset
  6082. initial = offset = state.sCount[nextLine] + pos - (state.bMarks[nextLine] + state.tShift[nextLine]);
  6083. // skip one optional space after '>'
  6084. if (state.src.charCodeAt(pos) === 0x20 /* space */) {
  6085. // ' > test '
  6086. // ^ -- position start of line here:
  6087. pos++;
  6088. initial++;
  6089. offset++;
  6090. adjustTab = false;
  6091. spaceAfterMarker = true;
  6092. } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) {
  6093. spaceAfterMarker = true;
  6094. if ((state.bsCount[nextLine] + offset) % 4 === 3) {
  6095. // ' >\t test '
  6096. // ^ -- position start of line here (tab has width===1)
  6097. pos++;
  6098. initial++;
  6099. offset++;
  6100. adjustTab = false;
  6101. } else {
  6102. // ' >\t test '
  6103. // ^ -- position start of line here + shift bsCount slightly
  6104. // to make extra space appear
  6105. adjustTab = true;
  6106. }
  6107. } else {
  6108. spaceAfterMarker = false;
  6109. }
  6110. oldBMarks.push(state.bMarks[nextLine]);
  6111. state.bMarks[nextLine] = pos;
  6112. while (pos < max) {
  6113. ch = state.src.charCodeAt(pos);
  6114. if (isSpace(ch)) {
  6115. if (ch === 0x09) {
  6116. offset += 4 - (offset + state.bsCount[nextLine] + (adjustTab ? 1 : 0)) % 4;
  6117. } else {
  6118. offset++;
  6119. }
  6120. } else {
  6121. break;
  6122. }
  6123. pos++;
  6124. }
  6125. lastLineEmpty = pos >= max;
  6126. oldBSCount.push(state.bsCount[nextLine]);
  6127. state.bsCount[nextLine] = state.sCount[nextLine] + 1 + (spaceAfterMarker ? 1 : 0);
  6128. oldSCount.push(state.sCount[nextLine]);
  6129. state.sCount[nextLine] = offset - initial;
  6130. oldTShift.push(state.tShift[nextLine]);
  6131. state.tShift[nextLine] = pos - state.bMarks[nextLine];
  6132. continue;
  6133. }
  6134. // Case 2: line is not inside the blockquote, and the last line was empty.
  6135. if (lastLineEmpty) { break; }
  6136. // Case 3: another tag found.
  6137. terminate = false;
  6138. for (i = 0, l = terminatorRules.length; i < l; i++) {
  6139. if (terminatorRules[i](state, nextLine, endLine, true)) {
  6140. terminate = true;
  6141. break;
  6142. }
  6143. }
  6144. if (terminate) {
  6145. // Quirk to enforce "hard termination mode" for paragraphs;
  6146. // normally if you call `tokenize(state, startLine, nextLine)`,
  6147. // paragraphs will look below nextLine for paragraph continuation,
  6148. // but if blockquote is terminated by another tag, they shouldn't
  6149. state.lineMax = nextLine;
  6150. if (state.blkIndent !== 0) {
  6151. // state.blkIndent was non-zero, we now set it to zero,
  6152. // so we need to re-calculate all offsets to appear as
  6153. // if indent wasn't changed
  6154. oldBMarks.push(state.bMarks[nextLine]);
  6155. oldBSCount.push(state.bsCount[nextLine]);
  6156. oldTShift.push(state.tShift[nextLine]);
  6157. oldSCount.push(state.sCount[nextLine]);
  6158. state.sCount[nextLine] -= state.blkIndent;
  6159. }
  6160. break;
  6161. }
  6162. oldBMarks.push(state.bMarks[nextLine]);
  6163. oldBSCount.push(state.bsCount[nextLine]);
  6164. oldTShift.push(state.tShift[nextLine]);
  6165. oldSCount.push(state.sCount[nextLine]);
  6166. // A negative indentation means that this is a paragraph continuation
  6167. //
  6168. state.sCount[nextLine] = -1;
  6169. }
  6170. oldIndent = state.blkIndent;
  6171. state.blkIndent = 0;
  6172. token = state.push('blockquote_open', 'blockquote', 1);
  6173. token.markup = '>';
  6174. token.map = lines = [ startLine, 0 ];
  6175. state.md.block.tokenize(state, startLine, nextLine);
  6176. token = state.push('blockquote_close', 'blockquote', -1);
  6177. token.markup = '>';
  6178. state.lineMax = oldLineMax;
  6179. state.parentType = oldParentType;
  6180. lines[1] = state.line;
  6181. // Restore original tShift; this might not be necessary since the parser
  6182. // has already been here, but just to make sure we can do that.
  6183. for (i = 0; i < oldTShift.length; i++) {
  6184. state.bMarks[i + startLine] = oldBMarks[i];
  6185. state.tShift[i + startLine] = oldTShift[i];
  6186. state.sCount[i + startLine] = oldSCount[i];
  6187. state.bsCount[i + startLine] = oldBSCount[i];
  6188. }
  6189. state.blkIndent = oldIndent;
  6190. return true;
  6191. };
  6192. /***/ }),
  6193. /* 56 */
  6194. /***/ (function(module, exports, __webpack_require__) {
  6195. "use strict";
  6196. // Horizontal rule
  6197. var isSpace = __webpack_require__(0).isSpace;
  6198. module.exports = function hr(state, startLine, endLine, silent) {
  6199. var marker, cnt, ch, token,
  6200. pos = state.bMarks[startLine] + state.tShift[startLine],
  6201. max = state.eMarks[startLine];
  6202. // if it's indented more than 3 spaces, it should be a code block
  6203. if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
  6204. marker = state.src.charCodeAt(pos++);
  6205. // Check hr marker
  6206. if (marker !== 0x2A/* * */ &&
  6207. marker !== 0x2D/* - */ &&
  6208. marker !== 0x5F/* _ */) {
  6209. return false;
  6210. }
  6211. // markers can be mixed with spaces, but there should be at least 3 of them
  6212. cnt = 1;
  6213. while (pos < max) {
  6214. ch = state.src.charCodeAt(pos++);
  6215. if (ch !== marker && !isSpace(ch)) { return false; }
  6216. if (ch === marker) { cnt++; }
  6217. }
  6218. if (cnt < 3) { return false; }
  6219. if (silent) { return true; }
  6220. state.line = startLine + 1;
  6221. token = state.push('hr', 'hr', 0);
  6222. token.map = [ startLine, state.line ];
  6223. token.markup = Array(cnt + 1).join(String.fromCharCode(marker));
  6224. return true;
  6225. };
  6226. /***/ }),
  6227. /* 57 */
  6228. /***/ (function(module, exports, __webpack_require__) {
  6229. "use strict";
  6230. // Lists
  6231. var isSpace = __webpack_require__(0).isSpace;
  6232. // Search `[-+*][\n ]`, returns next pos after marker on success
  6233. // or -1 on fail.
  6234. function skipBulletListMarker(state, startLine) {
  6235. var marker, pos, max, ch;
  6236. pos = state.bMarks[startLine] + state.tShift[startLine];
  6237. max = state.eMarks[startLine];
  6238. marker = state.src.charCodeAt(pos++);
  6239. // Check bullet
  6240. if (marker !== 0x2A/* * */ &&
  6241. marker !== 0x2D/* - */ &&
  6242. marker !== 0x2B/* + */) {
  6243. return -1;
  6244. }
  6245. if (pos < max) {
  6246. ch = state.src.charCodeAt(pos);
  6247. if (!isSpace(ch)) {
  6248. // " -test " - is not a list item
  6249. return -1;
  6250. }
  6251. }
  6252. return pos;
  6253. }
  6254. // Search `\d+[.)][\n ]`, returns next pos after marker on success
  6255. // or -1 on fail.
  6256. function skipOrderedListMarker(state, startLine) {
  6257. var ch,
  6258. start = state.bMarks[startLine] + state.tShift[startLine],
  6259. pos = start,
  6260. max = state.eMarks[startLine];
  6261. // List marker should have at least 2 chars (digit + dot)
  6262. if (pos + 1 >= max) { return -1; }
  6263. ch = state.src.charCodeAt(pos++);
  6264. if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }
  6265. for (;;) {
  6266. // EOL -> fail
  6267. if (pos >= max) { return -1; }
  6268. ch = state.src.charCodeAt(pos++);
  6269. if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {
  6270. // List marker should have no more than 9 digits
  6271. // (prevents integer overflow in browsers)
  6272. if (pos - start >= 10) { return -1; }
  6273. continue;
  6274. }
  6275. // found valid marker
  6276. if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {
  6277. break;
  6278. }
  6279. return -1;
  6280. }
  6281. if (pos < max) {
  6282. ch = state.src.charCodeAt(pos);
  6283. if (!isSpace(ch)) {
  6284. // " 1.test " - is not a list item
  6285. return -1;
  6286. }
  6287. }
  6288. return pos;
  6289. }
  6290. function markTightParagraphs(state, idx) {
  6291. var i, l,
  6292. level = state.level + 2;
  6293. for (i = idx + 2, l = state.tokens.length - 2; i < l; i++) {
  6294. if (state.tokens[i].level === level && state.tokens[i].type === 'paragraph_open') {
  6295. state.tokens[i + 2].hidden = true;
  6296. state.tokens[i].hidden = true;
  6297. i += 2;
  6298. }
  6299. }
  6300. }
  6301. module.exports = function list(state, startLine, endLine, silent) {
  6302. var ch,
  6303. contentStart,
  6304. i,
  6305. indent,
  6306. indentAfterMarker,
  6307. initial,
  6308. isOrdered,
  6309. itemLines,
  6310. l,
  6311. listLines,
  6312. listTokIdx,
  6313. markerCharCode,
  6314. markerValue,
  6315. max,
  6316. nextLine,
  6317. offset,
  6318. oldIndent,
  6319. oldLIndent,
  6320. oldParentType,
  6321. oldTShift,
  6322. oldTight,
  6323. pos,
  6324. posAfterMarker,
  6325. prevEmptyEnd,
  6326. start,
  6327. terminate,
  6328. terminatorRules,
  6329. token,
  6330. isTerminatingParagraph = false,
  6331. tight = true;
  6332. // if it's indented more than 3 spaces, it should be a code block
  6333. if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
  6334. // limit conditions when list can interrupt
  6335. // a paragraph (validation mode only)
  6336. if (silent && state.parentType === 'paragraph') {
  6337. // Next list item should still terminate previous list item;
  6338. //
  6339. // This code can fail if plugins use blkIndent as well as lists,
  6340. // but I hope the spec gets fixed long before that happens.
  6341. //
  6342. if (state.tShift[startLine] >= state.blkIndent) {
  6343. isTerminatingParagraph = true;
  6344. }
  6345. }
  6346. // Detect list type and position after marker
  6347. if ((posAfterMarker = skipOrderedListMarker(state, startLine)) >= 0) {
  6348. isOrdered = true;
  6349. start = state.bMarks[startLine] + state.tShift[startLine];
  6350. markerValue = Number(state.src.substr(start, posAfterMarker - start - 1));
  6351. // If we're starting a new ordered list right after
  6352. // a paragraph, it should start with 1.
  6353. if (isTerminatingParagraph && markerValue !== 1) return false;
  6354. } else if ((posAfterMarker = skipBulletListMarker(state, startLine)) >= 0) {
  6355. isOrdered = false;
  6356. } else {
  6357. return false;
  6358. }
  6359. // If we're starting a new unordered list right after
  6360. // a paragraph, first line should not be empty.
  6361. if (isTerminatingParagraph) {
  6362. if (state.skipSpaces(posAfterMarker) >= state.eMarks[startLine]) return false;
  6363. }
  6364. // We should terminate list on style change. Remember first one to compare.
  6365. markerCharCode = state.src.charCodeAt(posAfterMarker - 1);
  6366. // For validation mode we can terminate immediately
  6367. if (silent) { return true; }
  6368. // Start list
  6369. listTokIdx = state.tokens.length;
  6370. if (isOrdered) {
  6371. token = state.push('ordered_list_open', 'ol', 1);
  6372. if (markerValue !== 1) {
  6373. token.attrs = [ [ 'start', markerValue ] ];
  6374. }
  6375. } else {
  6376. token = state.push('bullet_list_open', 'ul', 1);
  6377. }
  6378. token.map = listLines = [ startLine, 0 ];
  6379. token.markup = String.fromCharCode(markerCharCode);
  6380. //
  6381. // Iterate list items
  6382. //
  6383. nextLine = startLine;
  6384. prevEmptyEnd = false;
  6385. terminatorRules = state.md.block.ruler.getRules('list');
  6386. oldParentType = state.parentType;
  6387. state.parentType = 'list';
  6388. while (nextLine < endLine) {
  6389. pos = posAfterMarker;
  6390. max = state.eMarks[nextLine];
  6391. initial = offset = state.sCount[nextLine] + posAfterMarker - (state.bMarks[startLine] + state.tShift[startLine]);
  6392. while (pos < max) {
  6393. ch = state.src.charCodeAt(pos);
  6394. if (ch === 0x09) {
  6395. offset += 4 - (offset + state.bsCount[nextLine]) % 4;
  6396. } else if (ch === 0x20) {
  6397. offset++;
  6398. } else {
  6399. break;
  6400. }
  6401. pos++;
  6402. }
  6403. contentStart = pos;
  6404. if (contentStart >= max) {
  6405. // trimming space in "- \n 3" case, indent is 1 here
  6406. indentAfterMarker = 1;
  6407. } else {
  6408. indentAfterMarker = offset - initial;
  6409. }
  6410. // If we have more than 4 spaces, the indent is 1
  6411. // (the rest is just indented code block)
  6412. if (indentAfterMarker > 4) { indentAfterMarker = 1; }
  6413. // " - test"
  6414. // ^^^^^ - calculating total length of this thing
  6415. indent = initial + indentAfterMarker;
  6416. // Run subparser & write tokens
  6417. token = state.push('list_item_open', 'li', 1);
  6418. token.markup = String.fromCharCode(markerCharCode);
  6419. token.map = itemLines = [ startLine, 0 ];
  6420. oldIndent = state.blkIndent;
  6421. oldTight = state.tight;
  6422. oldTShift = state.tShift[startLine];
  6423. oldLIndent = state.sCount[startLine];
  6424. state.blkIndent = indent;
  6425. state.tight = true;
  6426. state.tShift[startLine] = contentStart - state.bMarks[startLine];
  6427. state.sCount[startLine] = offset;
  6428. if (contentStart >= max && state.isEmpty(startLine + 1)) {
  6429. // workaround for this case
  6430. // (list item is empty, list terminates before "foo"):
  6431. // ~~~~~~~~
  6432. // -
  6433. //
  6434. // foo
  6435. // ~~~~~~~~
  6436. state.line = Math.min(state.line + 2, endLine);
  6437. } else {
  6438. state.md.block.tokenize(state, startLine, endLine, true);
  6439. }
  6440. // If any of list item is tight, mark list as tight
  6441. if (!state.tight || prevEmptyEnd) {
  6442. tight = false;
  6443. }
  6444. // Item become loose if finish with empty line,
  6445. // but we should filter last element, because it means list finish
  6446. prevEmptyEnd = (state.line - startLine) > 1 && state.isEmpty(state.line - 1);
  6447. state.blkIndent = oldIndent;
  6448. state.tShift[startLine] = oldTShift;
  6449. state.sCount[startLine] = oldLIndent;
  6450. state.tight = oldTight;
  6451. token = state.push('list_item_close', 'li', -1);
  6452. token.markup = String.fromCharCode(markerCharCode);
  6453. nextLine = startLine = state.line;
  6454. itemLines[1] = nextLine;
  6455. contentStart = state.bMarks[startLine];
  6456. if (nextLine >= endLine) { break; }
  6457. //
  6458. // Try to check if list is terminated or continued.
  6459. //
  6460. if (state.sCount[nextLine] < state.blkIndent) { break; }
  6461. // fail if terminating block found
  6462. terminate = false;
  6463. for (i = 0, l = terminatorRules.length; i < l; i++) {
  6464. if (terminatorRules[i](state, nextLine, endLine, true)) {
  6465. terminate = true;
  6466. break;
  6467. }
  6468. }
  6469. if (terminate) { break; }
  6470. // fail if list has another type
  6471. if (isOrdered) {
  6472. posAfterMarker = skipOrderedListMarker(state, nextLine);
  6473. if (posAfterMarker < 0) { break; }
  6474. } else {
  6475. posAfterMarker = skipBulletListMarker(state, nextLine);
  6476. if (posAfterMarker < 0) { break; }
  6477. }
  6478. if (markerCharCode !== state.src.charCodeAt(posAfterMarker - 1)) { break; }
  6479. }
  6480. // Finalize list
  6481. if (isOrdered) {
  6482. token = state.push('ordered_list_close', 'ol', -1);
  6483. } else {
  6484. token = state.push('bullet_list_close', 'ul', -1);
  6485. }
  6486. token.markup = String.fromCharCode(markerCharCode);
  6487. listLines[1] = nextLine;
  6488. state.line = nextLine;
  6489. state.parentType = oldParentType;
  6490. // mark paragraphs tight if needed
  6491. if (tight) {
  6492. markTightParagraphs(state, listTokIdx);
  6493. }
  6494. return true;
  6495. };
  6496. /***/ }),
  6497. /* 58 */
  6498. /***/ (function(module, exports, __webpack_require__) {
  6499. "use strict";
  6500. var normalizeReference = __webpack_require__(0).normalizeReference;
  6501. var isSpace = __webpack_require__(0).isSpace;
  6502. module.exports = function reference(state, startLine, _endLine, silent) {
  6503. var ch,
  6504. destEndPos,
  6505. destEndLineNo,
  6506. endLine,
  6507. href,
  6508. i,
  6509. l,
  6510. label,
  6511. labelEnd,
  6512. oldParentType,
  6513. res,
  6514. start,
  6515. str,
  6516. terminate,
  6517. terminatorRules,
  6518. title,
  6519. lines = 0,
  6520. pos = state.bMarks[startLine] + state.tShift[startLine],
  6521. max = state.eMarks[startLine],
  6522. nextLine = startLine + 1;
  6523. // if it's indented more than 3 spaces, it should be a code block
  6524. if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
  6525. if (state.src.charCodeAt(pos) !== 0x5B/* [ */) { return false; }
  6526. // Simple check to quickly interrupt scan on [link](url) at the start of line.
  6527. // Can be useful on practice: https://github.com/markdown-it/markdown-it/issues/54
  6528. while (++pos < max) {
  6529. if (state.src.charCodeAt(pos) === 0x5D /* ] */ &&
  6530. state.src.charCodeAt(pos - 1) !== 0x5C/* \ */) {
  6531. if (pos + 1 === max) { return false; }
  6532. if (state.src.charCodeAt(pos + 1) !== 0x3A/* : */) { return false; }
  6533. break;
  6534. }
  6535. }
  6536. endLine = state.lineMax;
  6537. // jump line-by-line until empty one or EOF
  6538. terminatorRules = state.md.block.ruler.getRules('reference');
  6539. oldParentType = state.parentType;
  6540. state.parentType = 'reference';
  6541. for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
  6542. // this would be a code block normally, but after paragraph
  6543. // it's considered a lazy continuation regardless of what's there
  6544. if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }
  6545. // quirk for blockquotes, this line should already be checked by that rule
  6546. if (state.sCount[nextLine] < 0) { continue; }
  6547. // Some tags can terminate paragraph without empty line.
  6548. terminate = false;
  6549. for (i = 0, l = terminatorRules.length; i < l; i++) {
  6550. if (terminatorRules[i](state, nextLine, endLine, true)) {
  6551. terminate = true;
  6552. break;
  6553. }
  6554. }
  6555. if (terminate) { break; }
  6556. }
  6557. str = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
  6558. max = str.length;
  6559. for (pos = 1; pos < max; pos++) {
  6560. ch = str.charCodeAt(pos);
  6561. if (ch === 0x5B /* [ */) {
  6562. return false;
  6563. } else if (ch === 0x5D /* ] */) {
  6564. labelEnd = pos;
  6565. break;
  6566. } else if (ch === 0x0A /* \n */) {
  6567. lines++;
  6568. } else if (ch === 0x5C /* \ */) {
  6569. pos++;
  6570. if (pos < max && str.charCodeAt(pos) === 0x0A) {
  6571. lines++;
  6572. }
  6573. }
  6574. }
  6575. if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 0x3A/* : */) { return false; }
  6576. // [label]: destination 'title'
  6577. // ^^^ skip optional whitespace here
  6578. for (pos = labelEnd + 2; pos < max; pos++) {
  6579. ch = str.charCodeAt(pos);
  6580. if (ch === 0x0A) {
  6581. lines++;
  6582. } else if (isSpace(ch)) {
  6583. /*eslint no-empty:0*/
  6584. } else {
  6585. break;
  6586. }
  6587. }
  6588. // [label]: destination 'title'
  6589. // ^^^^^^^^^^^ parse this
  6590. res = state.md.helpers.parseLinkDestination(str, pos, max);
  6591. if (!res.ok) { return false; }
  6592. href = state.md.normalizeLink(res.str);
  6593. if (!state.md.validateLink(href)) { return false; }
  6594. pos = res.pos;
  6595. lines += res.lines;
  6596. // save cursor state, we could require to rollback later
  6597. destEndPos = pos;
  6598. destEndLineNo = lines;
  6599. // [label]: destination 'title'
  6600. // ^^^ skipping those spaces
  6601. start = pos;
  6602. for (; pos < max; pos++) {
  6603. ch = str.charCodeAt(pos);
  6604. if (ch === 0x0A) {
  6605. lines++;
  6606. } else if (isSpace(ch)) {
  6607. /*eslint no-empty:0*/
  6608. } else {
  6609. break;
  6610. }
  6611. }
  6612. // [label]: destination 'title'
  6613. // ^^^^^^^ parse this
  6614. res = state.md.helpers.parseLinkTitle(str, pos, max);
  6615. if (pos < max && start !== pos && res.ok) {
  6616. title = res.str;
  6617. pos = res.pos;
  6618. lines += res.lines;
  6619. } else {
  6620. title = '';
  6621. pos = destEndPos;
  6622. lines = destEndLineNo;
  6623. }
  6624. // skip trailing spaces until the rest of the line
  6625. while (pos < max) {
  6626. ch = str.charCodeAt(pos);
  6627. if (!isSpace(ch)) { break; }
  6628. pos++;
  6629. }
  6630. if (pos < max && str.charCodeAt(pos) !== 0x0A) {
  6631. if (title) {
  6632. // garbage at the end of the line after title,
  6633. // but it could still be a valid reference if we roll back
  6634. title = '';
  6635. pos = destEndPos;
  6636. lines = destEndLineNo;
  6637. while (pos < max) {
  6638. ch = str.charCodeAt(pos);
  6639. if (!isSpace(ch)) { break; }
  6640. pos++;
  6641. }
  6642. }
  6643. }
  6644. if (pos < max && str.charCodeAt(pos) !== 0x0A) {
  6645. // garbage at the end of the line
  6646. return false;
  6647. }
  6648. label = normalizeReference(str.slice(1, labelEnd));
  6649. if (!label) {
  6650. // CommonMark 0.20 disallows empty labels
  6651. return false;
  6652. }
  6653. // Reference can not terminate anything. This check is for safety only.
  6654. /*istanbul ignore if*/
  6655. if (silent) { return true; }
  6656. if (typeof state.env.references === 'undefined') {
  6657. state.env.references = {};
  6658. }
  6659. if (typeof state.env.references[label] === 'undefined') {
  6660. state.env.references[label] = { title: title, href: href };
  6661. }
  6662. state.parentType = oldParentType;
  6663. state.line = startLine + lines + 1;
  6664. return true;
  6665. };
  6666. /***/ }),
  6667. /* 59 */
  6668. /***/ (function(module, exports, __webpack_require__) {
  6669. "use strict";
  6670. // heading (#, ##, ...)
  6671. var isSpace = __webpack_require__(0).isSpace;
  6672. module.exports = function heading(state, startLine, endLine, silent) {
  6673. var ch, level, tmp, token,
  6674. pos = state.bMarks[startLine] + state.tShift[startLine],
  6675. max = state.eMarks[startLine];
  6676. // if it's indented more than 3 spaces, it should be a code block
  6677. if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
  6678. ch = state.src.charCodeAt(pos);
  6679. if (ch !== 0x23/* # */ || pos >= max) { return false; }
  6680. // count heading level
  6681. level = 1;
  6682. ch = state.src.charCodeAt(++pos);
  6683. while (ch === 0x23/* # */ && pos < max && level <= 6) {
  6684. level++;
  6685. ch = state.src.charCodeAt(++pos);
  6686. }
  6687. if (level > 6 || (pos < max && !isSpace(ch))) { return false; }
  6688. if (silent) { return true; }
  6689. // Let's cut tails like ' ### ' from the end of string
  6690. max = state.skipSpacesBack(max, pos);
  6691. tmp = state.skipCharsBack(max, 0x23, pos); // #
  6692. if (tmp > pos && isSpace(state.src.charCodeAt(tmp - 1))) {
  6693. max = tmp;
  6694. }
  6695. state.line = startLine + 1;
  6696. token = state.push('heading_open', 'h' + String(level), 1);
  6697. token.markup = '########'.slice(0, level);
  6698. token.map = [ startLine, state.line ];
  6699. token = state.push('inline', '', 0);
  6700. token.content = state.src.slice(pos, max).trim();
  6701. token.map = [ startLine, state.line ];
  6702. token.children = [];
  6703. token = state.push('heading_close', 'h' + String(level), -1);
  6704. token.markup = '########'.slice(0, level);
  6705. return true;
  6706. };
  6707. /***/ }),
  6708. /* 60 */
  6709. /***/ (function(module, exports, __webpack_require__) {
  6710. "use strict";
  6711. // lheading (---, ===)
  6712. module.exports = function lheading(state, startLine, endLine/*, silent*/) {
  6713. var content, terminate, i, l, token, pos, max, level, marker,
  6714. nextLine = startLine + 1, oldParentType,
  6715. terminatorRules = state.md.block.ruler.getRules('paragraph');
  6716. // if it's indented more than 3 spaces, it should be a code block
  6717. if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
  6718. oldParentType = state.parentType;
  6719. state.parentType = 'paragraph'; // use paragraph to match terminatorRules
  6720. // jump line-by-line until empty one or EOF
  6721. for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
  6722. // this would be a code block normally, but after paragraph
  6723. // it's considered a lazy continuation regardless of what's there
  6724. if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }
  6725. //
  6726. // Check for underline in setext header
  6727. //
  6728. if (state.sCount[nextLine] >= state.blkIndent) {
  6729. pos = state.bMarks[nextLine] + state.tShift[nextLine];
  6730. max = state.eMarks[nextLine];
  6731. if (pos < max) {
  6732. marker = state.src.charCodeAt(pos);
  6733. if (marker === 0x2D/* - */ || marker === 0x3D/* = */) {
  6734. pos = state.skipChars(pos, marker);
  6735. pos = state.skipSpaces(pos);
  6736. if (pos >= max) {
  6737. level = (marker === 0x3D/* = */ ? 1 : 2);
  6738. break;
  6739. }
  6740. }
  6741. }
  6742. }
  6743. // quirk for blockquotes, this line should already be checked by that rule
  6744. if (state.sCount[nextLine] < 0) { continue; }
  6745. // Some tags can terminate paragraph without empty line.
  6746. terminate = false;
  6747. for (i = 0, l = terminatorRules.length; i < l; i++) {
  6748. if (terminatorRules[i](state, nextLine, endLine, true)) {
  6749. terminate = true;
  6750. break;
  6751. }
  6752. }
  6753. if (terminate) { break; }
  6754. }
  6755. if (!level) {
  6756. // Didn't find valid underline
  6757. return false;
  6758. }
  6759. content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
  6760. state.line = nextLine + 1;
  6761. token = state.push('heading_open', 'h' + String(level), 1);
  6762. token.markup = String.fromCharCode(marker);
  6763. token.map = [ startLine, state.line ];
  6764. token = state.push('inline', '', 0);
  6765. token.content = content;
  6766. token.map = [ startLine, state.line - 1 ];
  6767. token.children = [];
  6768. token = state.push('heading_close', 'h' + String(level), -1);
  6769. token.markup = String.fromCharCode(marker);
  6770. state.parentType = oldParentType;
  6771. return true;
  6772. };
  6773. /***/ }),
  6774. /* 61 */
  6775. /***/ (function(module, exports, __webpack_require__) {
  6776. "use strict";
  6777. // HTML block
  6778. var block_names = __webpack_require__(62);
  6779. var HTML_OPEN_CLOSE_TAG_RE = __webpack_require__(16).HTML_OPEN_CLOSE_TAG_RE;
  6780. // An array of opening and corresponding closing sequences for html tags,
  6781. // last argument defines whether it can terminate a paragraph or not
  6782. //
  6783. var HTML_SEQUENCES = [
  6784. [ /^<(script|pre|style)(?=(\s|>|$))/i, /<\/(script|pre|style)>/i, true ],
  6785. [ /^<!--/, /-->/, true ],
  6786. [ /^<\?/, /\?>/, true ],
  6787. [ /^<![A-Z]/, />/, true ],
  6788. [ /^<!\[CDATA\[/, /\]\]>/, true ],
  6789. [ new RegExp('^</?(' + block_names.join('|') + ')(?=(\\s|/?>|$))', 'i'), /^$/, true ],
  6790. [ new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + '\\s*$'), /^$/, false ]
  6791. ];
  6792. module.exports = function html_block(state, startLine, endLine, silent) {
  6793. var i, nextLine, token, lineText,
  6794. pos = state.bMarks[startLine] + state.tShift[startLine],
  6795. max = state.eMarks[startLine];
  6796. // if it's indented more than 3 spaces, it should be a code block
  6797. if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
  6798. if (!state.md.options.html) { return false; }
  6799. if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }
  6800. lineText = state.src.slice(pos, max);
  6801. for (i = 0; i < HTML_SEQUENCES.length; i++) {
  6802. if (HTML_SEQUENCES[i][0].test(lineText)) { break; }
  6803. }
  6804. if (i === HTML_SEQUENCES.length) { return false; }
  6805. if (silent) {
  6806. // true if this sequence can be a terminator, false otherwise
  6807. return HTML_SEQUENCES[i][2];
  6808. }
  6809. nextLine = startLine + 1;
  6810. // If we are here - we detected HTML block.
  6811. // Let's roll down till block end.
  6812. if (!HTML_SEQUENCES[i][1].test(lineText)) {
  6813. for (; nextLine < endLine; nextLine++) {
  6814. if (state.sCount[nextLine] < state.blkIndent) { break; }
  6815. pos = state.bMarks[nextLine] + state.tShift[nextLine];
  6816. max = state.eMarks[nextLine];
  6817. lineText = state.src.slice(pos, max);
  6818. if (HTML_SEQUENCES[i][1].test(lineText)) {
  6819. if (lineText.length !== 0) { nextLine++; }
  6820. break;
  6821. }
  6822. }
  6823. }
  6824. state.line = nextLine;
  6825. token = state.push('html_block', '', 0);
  6826. token.map = [ startLine, nextLine ];
  6827. token.content = state.getLines(startLine, nextLine, state.blkIndent, true);
  6828. return true;
  6829. };
  6830. /***/ }),
  6831. /* 62 */
  6832. /***/ (function(module, exports, __webpack_require__) {
  6833. "use strict";
  6834. // List of valid html blocks names, accorting to commonmark spec
  6835. // http://jgm.github.io/CommonMark/spec.html#html-blocks
  6836. module.exports = [
  6837. 'address',
  6838. 'article',
  6839. 'aside',
  6840. 'base',
  6841. 'basefont',
  6842. 'blockquote',
  6843. 'body',
  6844. 'caption',
  6845. 'center',
  6846. 'col',
  6847. 'colgroup',
  6848. 'dd',
  6849. 'details',
  6850. 'dialog',
  6851. 'dir',
  6852. 'div',
  6853. 'dl',
  6854. 'dt',
  6855. 'fieldset',
  6856. 'figcaption',
  6857. 'figure',
  6858. 'footer',
  6859. 'form',
  6860. 'frame',
  6861. 'frameset',
  6862. 'h1',
  6863. 'h2',
  6864. 'h3',
  6865. 'h4',
  6866. 'h5',
  6867. 'h6',
  6868. 'head',
  6869. 'header',
  6870. 'hr',
  6871. 'html',
  6872. 'iframe',
  6873. 'legend',
  6874. 'li',
  6875. 'link',
  6876. 'main',
  6877. 'menu',
  6878. 'menuitem',
  6879. 'meta',
  6880. 'nav',
  6881. 'noframes',
  6882. 'ol',
  6883. 'optgroup',
  6884. 'option',
  6885. 'p',
  6886. 'param',
  6887. 'section',
  6888. 'source',
  6889. 'summary',
  6890. 'table',
  6891. 'tbody',
  6892. 'td',
  6893. 'tfoot',
  6894. 'th',
  6895. 'thead',
  6896. 'title',
  6897. 'tr',
  6898. 'track',
  6899. 'ul'
  6900. ];
  6901. /***/ }),
  6902. /* 63 */
  6903. /***/ (function(module, exports, __webpack_require__) {
  6904. "use strict";
  6905. // Paragraph
  6906. module.exports = function paragraph(state, startLine/*, endLine*/) {
  6907. var content, terminate, i, l, token, oldParentType,
  6908. nextLine = startLine + 1,
  6909. terminatorRules = state.md.block.ruler.getRules('paragraph'),
  6910. endLine = state.lineMax;
  6911. oldParentType = state.parentType;
  6912. state.parentType = 'paragraph';
  6913. // jump line-by-line until empty one or EOF
  6914. for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
  6915. // this would be a code block normally, but after paragraph
  6916. // it's considered a lazy continuation regardless of what's there
  6917. if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }
  6918. // quirk for blockquotes, this line should already be checked by that rule
  6919. if (state.sCount[nextLine] < 0) { continue; }
  6920. // Some tags can terminate paragraph without empty line.
  6921. terminate = false;
  6922. for (i = 0, l = terminatorRules.length; i < l; i++) {
  6923. if (terminatorRules[i](state, nextLine, endLine, true)) {
  6924. terminate = true;
  6925. break;
  6926. }
  6927. }
  6928. if (terminate) { break; }
  6929. }
  6930. content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
  6931. state.line = nextLine;
  6932. token = state.push('paragraph_open', 'p', 1);
  6933. token.map = [ startLine, state.line ];
  6934. token = state.push('inline', '', 0);
  6935. token.content = content;
  6936. token.map = [ startLine, state.line ];
  6937. token.children = [];
  6938. token = state.push('paragraph_close', 'p', -1);
  6939. state.parentType = oldParentType;
  6940. return true;
  6941. };
  6942. /***/ }),
  6943. /* 64 */
  6944. /***/ (function(module, exports, __webpack_require__) {
  6945. "use strict";
  6946. // Parser state class
  6947. var Token = __webpack_require__(7);
  6948. var isSpace = __webpack_require__(0).isSpace;
  6949. function StateBlock(src, md, env, tokens) {
  6950. var ch, s, start, pos, len, indent, offset, indent_found;
  6951. this.src = src;
  6952. // link to parser instance
  6953. this.md = md;
  6954. this.env = env;
  6955. //
  6956. // Internal state vartiables
  6957. //
  6958. this.tokens = tokens;
  6959. this.bMarks = []; // line begin offsets for fast jumps
  6960. this.eMarks = []; // line end offsets for fast jumps
  6961. this.tShift = []; // offsets of the first non-space characters (tabs not expanded)
  6962. this.sCount = []; // indents for each line (tabs expanded)
  6963. // An amount of virtual spaces (tabs expanded) between beginning
  6964. // of each line (bMarks) and real beginning of that line.
  6965. //
  6966. // It exists only as a hack because blockquotes override bMarks
  6967. // losing information in the process.
  6968. //
  6969. // It's used only when expanding tabs, you can think about it as
  6970. // an initial tab length, e.g. bsCount=21 applied to string `\t123`
  6971. // means first tab should be expanded to 4-21%4 === 3 spaces.
  6972. //
  6973. this.bsCount = [];
  6974. // block parser variables
  6975. this.blkIndent = 0; // required block content indent
  6976. // (for example, if we are in list)
  6977. this.line = 0; // line index in src
  6978. this.lineMax = 0; // lines count
  6979. this.tight = false; // loose/tight mode for lists
  6980. this.ddIndent = -1; // indent of the current dd block (-1 if there isn't any)
  6981. // can be 'blockquote', 'list', 'root', 'paragraph' or 'reference'
  6982. // used in lists to determine if they interrupt a paragraph
  6983. this.parentType = 'root';
  6984. this.level = 0;
  6985. // renderer
  6986. this.result = '';
  6987. // Create caches
  6988. // Generate markers.
  6989. s = this.src;
  6990. indent_found = false;
  6991. for (start = pos = indent = offset = 0, len = s.length; pos < len; pos++) {
  6992. ch = s.charCodeAt(pos);
  6993. if (!indent_found) {
  6994. if (isSpace(ch)) {
  6995. indent++;
  6996. if (ch === 0x09) {
  6997. offset += 4 - offset % 4;
  6998. } else {
  6999. offset++;
  7000. }
  7001. continue;
  7002. } else {
  7003. indent_found = true;
  7004. }
  7005. }
  7006. if (ch === 0x0A || pos === len - 1) {
  7007. if (ch !== 0x0A) { pos++; }
  7008. this.bMarks.push(start);
  7009. this.eMarks.push(pos);
  7010. this.tShift.push(indent);
  7011. this.sCount.push(offset);
  7012. this.bsCount.push(0);
  7013. indent_found = false;
  7014. indent = 0;
  7015. offset = 0;
  7016. start = pos + 1;
  7017. }
  7018. }
  7019. // Push fake entry to simplify cache bounds checks
  7020. this.bMarks.push(s.length);
  7021. this.eMarks.push(s.length);
  7022. this.tShift.push(0);
  7023. this.sCount.push(0);
  7024. this.bsCount.push(0);
  7025. this.lineMax = this.bMarks.length - 1; // don't count last fake line
  7026. }
  7027. // Push new token to "stream".
  7028. //
  7029. StateBlock.prototype.push = function (type, tag, nesting) {
  7030. var token = new Token(type, tag, nesting);
  7031. token.block = true;
  7032. if (nesting < 0) { this.level--; }
  7033. token.level = this.level;
  7034. if (nesting > 0) { this.level++; }
  7035. this.tokens.push(token);
  7036. return token;
  7037. };
  7038. StateBlock.prototype.isEmpty = function isEmpty(line) {
  7039. return this.bMarks[line] + this.tShift[line] >= this.eMarks[line];
  7040. };
  7041. StateBlock.prototype.skipEmptyLines = function skipEmptyLines(from) {
  7042. for (var max = this.lineMax; from < max; from++) {
  7043. if (this.bMarks[from] + this.tShift[from] < this.eMarks[from]) {
  7044. break;
  7045. }
  7046. }
  7047. return from;
  7048. };
  7049. // Skip spaces from given position.
  7050. StateBlock.prototype.skipSpaces = function skipSpaces(pos) {
  7051. var ch;
  7052. for (var max = this.src.length; pos < max; pos++) {
  7053. ch = this.src.charCodeAt(pos);
  7054. if (!isSpace(ch)) { break; }
  7055. }
  7056. return pos;
  7057. };
  7058. // Skip spaces from given position in reverse.
  7059. StateBlock.prototype.skipSpacesBack = function skipSpacesBack(pos, min) {
  7060. if (pos <= min) { return pos; }
  7061. while (pos > min) {
  7062. if (!isSpace(this.src.charCodeAt(--pos))) { return pos + 1; }
  7063. }
  7064. return pos;
  7065. };
  7066. // Skip char codes from given position
  7067. StateBlock.prototype.skipChars = function skipChars(pos, code) {
  7068. for (var max = this.src.length; pos < max; pos++) {
  7069. if (this.src.charCodeAt(pos) !== code) { break; }
  7070. }
  7071. return pos;
  7072. };
  7073. // Skip char codes reverse from given position - 1
  7074. StateBlock.prototype.skipCharsBack = function skipCharsBack(pos, code, min) {
  7075. if (pos <= min) { return pos; }
  7076. while (pos > min) {
  7077. if (code !== this.src.charCodeAt(--pos)) { return pos + 1; }
  7078. }
  7079. return pos;
  7080. };
  7081. // cut lines range from source.
  7082. StateBlock.prototype.getLines = function getLines(begin, end, indent, keepLastLF) {
  7083. var i, lineIndent, ch, first, last, queue, lineStart,
  7084. line = begin;
  7085. if (begin >= end) {
  7086. return '';
  7087. }
  7088. queue = new Array(end - begin);
  7089. for (i = 0; line < end; line++, i++) {
  7090. lineIndent = 0;
  7091. lineStart = first = this.bMarks[line];
  7092. if (line + 1 < end || keepLastLF) {
  7093. // No need for bounds check because we have fake entry on tail.
  7094. last = this.eMarks[line] + 1;
  7095. } else {
  7096. last = this.eMarks[line];
  7097. }
  7098. while (first < last && lineIndent < indent) {
  7099. ch = this.src.charCodeAt(first);
  7100. if (isSpace(ch)) {
  7101. if (ch === 0x09) {
  7102. lineIndent += 4 - (lineIndent + this.bsCount[line]) % 4;
  7103. } else {
  7104. lineIndent++;
  7105. }
  7106. } else if (first - lineStart < this.tShift[line]) {
  7107. // patched tShift masked characters to look like spaces (blockquotes, list markers)
  7108. lineIndent++;
  7109. } else {
  7110. break;
  7111. }
  7112. first++;
  7113. }
  7114. if (lineIndent > indent) {
  7115. // partially expanding tabs in code blocks, e.g '\t\tfoobar'
  7116. // with indent=2 becomes ' \tfoobar'
  7117. queue[i] = new Array(lineIndent - indent + 1).join(' ') + this.src.slice(first, last);
  7118. } else {
  7119. queue[i] = this.src.slice(first, last);
  7120. }
  7121. }
  7122. return queue.join('');
  7123. };
  7124. // re-export Token class to use in block rules
  7125. StateBlock.prototype.Token = Token;
  7126. module.exports = StateBlock;
  7127. /***/ }),
  7128. /* 65 */
  7129. /***/ (function(module, exports, __webpack_require__) {
  7130. "use strict";
  7131. /** internal
  7132. * class ParserInline
  7133. *
  7134. * Tokenizes paragraph content.
  7135. **/
  7136. var Ruler = __webpack_require__(6);
  7137. ////////////////////////////////////////////////////////////////////////////////
  7138. // Parser rules
  7139. var _rules = [
  7140. [ 'text', __webpack_require__(66) ],
  7141. [ 'newline', __webpack_require__(67) ],
  7142. [ 'escape', __webpack_require__(68) ],
  7143. [ 'backticks', __webpack_require__(69) ],
  7144. [ 'strikethrough', __webpack_require__(17).tokenize ],
  7145. [ 'emphasis', __webpack_require__(18).tokenize ],
  7146. [ 'link', __webpack_require__(70) ],
  7147. [ 'image', __webpack_require__(71) ],
  7148. [ 'autolink', __webpack_require__(72) ],
  7149. [ 'html_inline', __webpack_require__(73) ],
  7150. [ 'entity', __webpack_require__(74) ]
  7151. ];
  7152. var _rules2 = [
  7153. [ 'balance_pairs', __webpack_require__(75) ],
  7154. [ 'strikethrough', __webpack_require__(17).postProcess ],
  7155. [ 'emphasis', __webpack_require__(18).postProcess ],
  7156. [ 'text_collapse', __webpack_require__(76) ]
  7157. ];
  7158. /**
  7159. * new ParserInline()
  7160. **/
  7161. function ParserInline() {
  7162. var i;
  7163. /**
  7164. * ParserInline#ruler -> Ruler
  7165. *
  7166. * [[Ruler]] instance. Keep configuration of inline rules.
  7167. **/
  7168. this.ruler = new Ruler();
  7169. for (i = 0; i < _rules.length; i++) {
  7170. this.ruler.push(_rules[i][0], _rules[i][1]);
  7171. }
  7172. /**
  7173. * ParserInline#ruler2 -> Ruler
  7174. *
  7175. * [[Ruler]] instance. Second ruler used for post-processing
  7176. * (e.g. in emphasis-like rules).
  7177. **/
  7178. this.ruler2 = new Ruler();
  7179. for (i = 0; i < _rules2.length; i++) {
  7180. this.ruler2.push(_rules2[i][0], _rules2[i][1]);
  7181. }
  7182. }
  7183. // Skip single token by running all rules in validation mode;
  7184. // returns `true` if any rule reported success
  7185. //
  7186. ParserInline.prototype.skipToken = function (state) {
  7187. var ok, i, pos = state.pos,
  7188. rules = this.ruler.getRules(''),
  7189. len = rules.length,
  7190. maxNesting = state.md.options.maxNesting,
  7191. cache = state.cache;
  7192. if (typeof cache[pos] !== 'undefined') {
  7193. state.pos = cache[pos];
  7194. return;
  7195. }
  7196. if (state.level < maxNesting) {
  7197. for (i = 0; i < len; i++) {
  7198. // Increment state.level and decrement it later to limit recursion.
  7199. // It's harmless to do here, because no tokens are created. But ideally,
  7200. // we'd need a separate private state variable for this purpose.
  7201. //
  7202. state.level++;
  7203. ok = rules[i](state, true);
  7204. state.level--;
  7205. if (ok) { break; }
  7206. }
  7207. } else {
  7208. // Too much nesting, just skip until the end of the paragraph.
  7209. //
  7210. // NOTE: this will cause links to behave incorrectly in the following case,
  7211. // when an amount of `[` is exactly equal to `maxNesting + 1`:
  7212. //
  7213. // [[[[[[[[[[[[[[[[[[[[[foo]()
  7214. //
  7215. // TODO: remove this workaround when CM standard will allow nested links
  7216. // (we can replace it by preventing links from being parsed in
  7217. // validation mode)
  7218. //
  7219. state.pos = state.posMax;
  7220. }
  7221. if (!ok) { state.pos++; }
  7222. cache[pos] = state.pos;
  7223. };
  7224. // Generate tokens for input range
  7225. //
  7226. ParserInline.prototype.tokenize = function (state) {
  7227. var ok, i,
  7228. rules = this.ruler.getRules(''),
  7229. len = rules.length,
  7230. end = state.posMax,
  7231. maxNesting = state.md.options.maxNesting;
  7232. while (state.pos < end) {
  7233. // Try all possible rules.
  7234. // On success, rule should:
  7235. //
  7236. // - update `state.pos`
  7237. // - update `state.tokens`
  7238. // - return true
  7239. if (state.level < maxNesting) {
  7240. for (i = 0; i < len; i++) {
  7241. ok = rules[i](state, false);
  7242. if (ok) { break; }
  7243. }
  7244. }
  7245. if (ok) {
  7246. if (state.pos >= end) { break; }
  7247. continue;
  7248. }
  7249. state.pending += state.src[state.pos++];
  7250. }
  7251. if (state.pending) {
  7252. state.pushPending();
  7253. }
  7254. };
  7255. /**
  7256. * ParserInline.parse(str, md, env, outTokens)
  7257. *
  7258. * Process input string and push inline tokens into `outTokens`
  7259. **/
  7260. ParserInline.prototype.parse = function (str, md, env, outTokens) {
  7261. var i, rules, len;
  7262. var state = new this.State(str, md, env, outTokens);
  7263. this.tokenize(state);
  7264. rules = this.ruler2.getRules('');
  7265. len = rules.length;
  7266. for (i = 0; i < len; i++) {
  7267. rules[i](state);
  7268. }
  7269. };
  7270. ParserInline.prototype.State = __webpack_require__(77);
  7271. module.exports = ParserInline;
  7272. /***/ }),
  7273. /* 66 */
  7274. /***/ (function(module, exports, __webpack_require__) {
  7275. "use strict";
  7276. // Skip text characters for text token, place those to pending buffer
  7277. // and increment current pos
  7278. // Rule to skip pure text
  7279. // '{}$%@~+=:' reserved for extentions
  7280. // !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~
  7281. // !!!! Don't confuse with "Markdown ASCII Punctuation" chars
  7282. // http://spec.commonmark.org/0.15/#ascii-punctuation-character
  7283. function isTerminatorChar(ch) {
  7284. switch (ch) {
  7285. case 0x0A/* \n */:
  7286. case 0x21/* ! */:
  7287. case 0x23/* # */:
  7288. case 0x24/* $ */:
  7289. case 0x25/* % */:
  7290. case 0x26/* & */:
  7291. case 0x2A/* * */:
  7292. case 0x2B/* + */:
  7293. case 0x2D/* - */:
  7294. case 0x3A/* : */:
  7295. case 0x3C/* < */:
  7296. case 0x3D/* = */:
  7297. case 0x3E/* > */:
  7298. case 0x40/* @ */:
  7299. case 0x5B/* [ */:
  7300. case 0x5C/* \ */:
  7301. case 0x5D/* ] */:
  7302. case 0x5E/* ^ */:
  7303. case 0x5F/* _ */:
  7304. case 0x60/* ` */:
  7305. case 0x7B/* { */:
  7306. case 0x7D/* } */:
  7307. case 0x7E/* ~ */:
  7308. return true;
  7309. default:
  7310. return false;
  7311. }
  7312. }
  7313. module.exports = function text(state, silent) {
  7314. var pos = state.pos;
  7315. while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) {
  7316. pos++;
  7317. }
  7318. if (pos === state.pos) { return false; }
  7319. if (!silent) { state.pending += state.src.slice(state.pos, pos); }
  7320. state.pos = pos;
  7321. return true;
  7322. };
  7323. // Alternative implementation, for memory.
  7324. //
  7325. // It costs 10% of performance, but allows extend terminators list, if place it
  7326. // to `ParcerInline` property. Probably, will switch to it sometime, such
  7327. // flexibility required.
  7328. /*
  7329. var TERMINATOR_RE = /[\n!#$%&*+\-:<=>@[\\\]^_`{}~]/;
  7330. module.exports = function text(state, silent) {
  7331. var pos = state.pos,
  7332. idx = state.src.slice(pos).search(TERMINATOR_RE);
  7333. // first char is terminator -> empty text
  7334. if (idx === 0) { return false; }
  7335. // no terminator -> text till end of string
  7336. if (idx < 0) {
  7337. if (!silent) { state.pending += state.src.slice(pos); }
  7338. state.pos = state.src.length;
  7339. return true;
  7340. }
  7341. if (!silent) { state.pending += state.src.slice(pos, pos + idx); }
  7342. state.pos += idx;
  7343. return true;
  7344. };*/
  7345. /***/ }),
  7346. /* 67 */
  7347. /***/ (function(module, exports, __webpack_require__) {
  7348. "use strict";
  7349. // Proceess '\n'
  7350. var isSpace = __webpack_require__(0).isSpace;
  7351. module.exports = function newline(state, silent) {
  7352. var pmax, max, pos = state.pos;
  7353. if (state.src.charCodeAt(pos) !== 0x0A/* \n */) { return false; }
  7354. pmax = state.pending.length - 1;
  7355. max = state.posMax;
  7356. // ' \n' -> hardbreak
  7357. // Lookup in pending chars is bad practice! Don't copy to other rules!
  7358. // Pending string is stored in concat mode, indexed lookups will cause
  7359. // convertion to flat mode.
  7360. if (!silent) {
  7361. if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) {
  7362. if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) {
  7363. state.pending = state.pending.replace(/ +$/, '');
  7364. state.push('hardbreak', 'br', 0);
  7365. } else {
  7366. state.pending = state.pending.slice(0, -1);
  7367. state.push('softbreak', 'br', 0);
  7368. }
  7369. } else {
  7370. state.push('softbreak', 'br', 0);
  7371. }
  7372. }
  7373. pos++;
  7374. // skip heading spaces for next line
  7375. while (pos < max && isSpace(state.src.charCodeAt(pos))) { pos++; }
  7376. state.pos = pos;
  7377. return true;
  7378. };
  7379. /***/ }),
  7380. /* 68 */
  7381. /***/ (function(module, exports, __webpack_require__) {
  7382. "use strict";
  7383. // Process escaped chars and hardbreaks
  7384. var isSpace = __webpack_require__(0).isSpace;
  7385. var ESCAPED = [];
  7386. for (var i = 0; i < 256; i++) { ESCAPED.push(0); }
  7387. '\\!"#$%&\'()*+,./:;<=>?@[]^_`{|}~-'
  7388. .split('').forEach(function (ch) { ESCAPED[ch.charCodeAt(0)] = 1; });
  7389. module.exports = function escape(state, silent) {
  7390. var ch, pos = state.pos, max = state.posMax;
  7391. if (state.src.charCodeAt(pos) !== 0x5C/* \ */) { return false; }
  7392. pos++;
  7393. if (pos < max) {
  7394. ch = state.src.charCodeAt(pos);
  7395. if (ch < 256 && ESCAPED[ch] !== 0) {
  7396. if (!silent) { state.pending += state.src[pos]; }
  7397. state.pos += 2;
  7398. return true;
  7399. }
  7400. if (ch === 0x0A) {
  7401. if (!silent) {
  7402. state.push('hardbreak', 'br', 0);
  7403. }
  7404. pos++;
  7405. // skip leading whitespaces from next line
  7406. while (pos < max) {
  7407. ch = state.src.charCodeAt(pos);
  7408. if (!isSpace(ch)) { break; }
  7409. pos++;
  7410. }
  7411. state.pos = pos;
  7412. return true;
  7413. }
  7414. }
  7415. if (!silent) { state.pending += '\\'; }
  7416. state.pos++;
  7417. return true;
  7418. };
  7419. /***/ }),
  7420. /* 69 */
  7421. /***/ (function(module, exports, __webpack_require__) {
  7422. "use strict";
  7423. // Parse backticks
  7424. module.exports = function backtick(state, silent) {
  7425. var start, max, marker, matchStart, matchEnd, token,
  7426. pos = state.pos,
  7427. ch = state.src.charCodeAt(pos);
  7428. if (ch !== 0x60/* ` */) { return false; }
  7429. start = pos;
  7430. pos++;
  7431. max = state.posMax;
  7432. while (pos < max && state.src.charCodeAt(pos) === 0x60/* ` */) { pos++; }
  7433. marker = state.src.slice(start, pos);
  7434. matchStart = matchEnd = pos;
  7435. while ((matchStart = state.src.indexOf('`', matchEnd)) !== -1) {
  7436. matchEnd = matchStart + 1;
  7437. while (matchEnd < max && state.src.charCodeAt(matchEnd) === 0x60/* ` */) { matchEnd++; }
  7438. if (matchEnd - matchStart === marker.length) {
  7439. if (!silent) {
  7440. token = state.push('code_inline', 'code', 0);
  7441. token.markup = marker;
  7442. token.content = state.src.slice(pos, matchStart)
  7443. .replace(/[ \n]+/g, ' ')
  7444. .trim();
  7445. }
  7446. state.pos = matchEnd;
  7447. return true;
  7448. }
  7449. }
  7450. if (!silent) { state.pending += marker; }
  7451. state.pos += marker.length;
  7452. return true;
  7453. };
  7454. /***/ }),
  7455. /* 70 */
  7456. /***/ (function(module, exports, __webpack_require__) {
  7457. "use strict";
  7458. // Process [link](<to> "stuff")
  7459. var normalizeReference = __webpack_require__(0).normalizeReference;
  7460. var isSpace = __webpack_require__(0).isSpace;
  7461. module.exports = function link(state, silent) {
  7462. var attrs,
  7463. code,
  7464. label,
  7465. labelEnd,
  7466. labelStart,
  7467. pos,
  7468. res,
  7469. ref,
  7470. title,
  7471. token,
  7472. href = '',
  7473. oldPos = state.pos,
  7474. max = state.posMax,
  7475. start = state.pos,
  7476. parseReference = true;
  7477. if (state.src.charCodeAt(state.pos) !== 0x5B/* [ */) { return false; }
  7478. labelStart = state.pos + 1;
  7479. labelEnd = state.md.helpers.parseLinkLabel(state, state.pos, true);
  7480. // parser failed to find ']', so it's not a valid link
  7481. if (labelEnd < 0) { return false; }
  7482. pos = labelEnd + 1;
  7483. if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {
  7484. //
  7485. // Inline link
  7486. //
  7487. // might have found a valid shortcut link, disable reference parsing
  7488. parseReference = false;
  7489. // [link]( <href> "title" )
  7490. // ^^ skipping these spaces
  7491. pos++;
  7492. for (; pos < max; pos++) {
  7493. code = state.src.charCodeAt(pos);
  7494. if (!isSpace(code) && code !== 0x0A) { break; }
  7495. }
  7496. if (pos >= max) { return false; }
  7497. // [link]( <href> "title" )
  7498. // ^^^^^^ parsing link destination
  7499. start = pos;
  7500. res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);
  7501. if (res.ok) {
  7502. href = state.md.normalizeLink(res.str);
  7503. if (state.md.validateLink(href)) {
  7504. pos = res.pos;
  7505. } else {
  7506. href = '';
  7507. }
  7508. }
  7509. // [link]( <href> "title" )
  7510. // ^^ skipping these spaces
  7511. start = pos;
  7512. for (; pos < max; pos++) {
  7513. code = state.src.charCodeAt(pos);
  7514. if (!isSpace(code) && code !== 0x0A) { break; }
  7515. }
  7516. // [link]( <href> "title" )
  7517. // ^^^^^^^ parsing link title
  7518. res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);
  7519. if (pos < max && start !== pos && res.ok) {
  7520. title = res.str;
  7521. pos = res.pos;
  7522. // [link]( <href> "title" )
  7523. // ^^ skipping these spaces
  7524. for (; pos < max; pos++) {
  7525. code = state.src.charCodeAt(pos);
  7526. if (!isSpace(code) && code !== 0x0A) { break; }
  7527. }
  7528. } else {
  7529. title = '';
  7530. }
  7531. if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {
  7532. // parsing a valid shortcut link failed, fallback to reference
  7533. parseReference = true;
  7534. }
  7535. pos++;
  7536. }
  7537. if (parseReference) {
  7538. //
  7539. // Link reference
  7540. //
  7541. if (typeof state.env.references === 'undefined') { return false; }
  7542. if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {
  7543. start = pos + 1;
  7544. pos = state.md.helpers.parseLinkLabel(state, pos);
  7545. if (pos >= 0) {
  7546. label = state.src.slice(start, pos++);
  7547. } else {
  7548. pos = labelEnd + 1;
  7549. }
  7550. } else {
  7551. pos = labelEnd + 1;
  7552. }
  7553. // covers label === '' and label === undefined
  7554. // (collapsed reference link and shortcut reference link respectively)
  7555. if (!label) { label = state.src.slice(labelStart, labelEnd); }
  7556. ref = state.env.references[normalizeReference(label)];
  7557. if (!ref) {
  7558. state.pos = oldPos;
  7559. return false;
  7560. }
  7561. href = ref.href;
  7562. title = ref.title;
  7563. }
  7564. //
  7565. // We found the end of the link, and know for a fact it's a valid link;
  7566. // so all that's left to do is to call tokenizer.
  7567. //
  7568. if (!silent) {
  7569. state.pos = labelStart;
  7570. state.posMax = labelEnd;
  7571. token = state.push('link_open', 'a', 1);
  7572. token.attrs = attrs = [ [ 'href', href ] ];
  7573. if (title) {
  7574. attrs.push([ 'title', title ]);
  7575. }
  7576. state.md.inline.tokenize(state);
  7577. token = state.push('link_close', 'a', -1);
  7578. }
  7579. state.pos = pos;
  7580. state.posMax = max;
  7581. return true;
  7582. };
  7583. /***/ }),
  7584. /* 71 */
  7585. /***/ (function(module, exports, __webpack_require__) {
  7586. "use strict";
  7587. // Process ![image](<src> "title")
  7588. var normalizeReference = __webpack_require__(0).normalizeReference;
  7589. var isSpace = __webpack_require__(0).isSpace;
  7590. module.exports = function image(state, silent) {
  7591. var attrs,
  7592. code,
  7593. content,
  7594. label,
  7595. labelEnd,
  7596. labelStart,
  7597. pos,
  7598. ref,
  7599. res,
  7600. title,
  7601. token,
  7602. tokens,
  7603. start,
  7604. href = '',
  7605. oldPos = state.pos,
  7606. max = state.posMax;
  7607. if (state.src.charCodeAt(state.pos) !== 0x21/* ! */) { return false; }
  7608. if (state.src.charCodeAt(state.pos + 1) !== 0x5B/* [ */) { return false; }
  7609. labelStart = state.pos + 2;
  7610. labelEnd = state.md.helpers.parseLinkLabel(state, state.pos + 1, false);
  7611. // parser failed to find ']', so it's not a valid link
  7612. if (labelEnd < 0) { return false; }
  7613. pos = labelEnd + 1;
  7614. if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {
  7615. //
  7616. // Inline link
  7617. //
  7618. // [link]( <href> "title" )
  7619. // ^^ skipping these spaces
  7620. pos++;
  7621. for (; pos < max; pos++) {
  7622. code = state.src.charCodeAt(pos);
  7623. if (!isSpace(code) && code !== 0x0A) { break; }
  7624. }
  7625. if (pos >= max) { return false; }
  7626. // [link]( <href> "title" )
  7627. // ^^^^^^ parsing link destination
  7628. start = pos;
  7629. res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);
  7630. if (res.ok) {
  7631. href = state.md.normalizeLink(res.str);
  7632. if (state.md.validateLink(href)) {
  7633. pos = res.pos;
  7634. } else {
  7635. href = '';
  7636. }
  7637. }
  7638. // [link]( <href> "title" )
  7639. // ^^ skipping these spaces
  7640. start = pos;
  7641. for (; pos < max; pos++) {
  7642. code = state.src.charCodeAt(pos);
  7643. if (!isSpace(code) && code !== 0x0A) { break; }
  7644. }
  7645. // [link]( <href> "title" )
  7646. // ^^^^^^^ parsing link title
  7647. res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);
  7648. if (pos < max && start !== pos && res.ok) {
  7649. title = res.str;
  7650. pos = res.pos;
  7651. // [link]( <href> "title" )
  7652. // ^^ skipping these spaces
  7653. for (; pos < max; pos++) {
  7654. code = state.src.charCodeAt(pos);
  7655. if (!isSpace(code) && code !== 0x0A) { break; }
  7656. }
  7657. } else {
  7658. title = '';
  7659. }
  7660. if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {
  7661. state.pos = oldPos;
  7662. return false;
  7663. }
  7664. pos++;
  7665. } else {
  7666. //
  7667. // Link reference
  7668. //
  7669. if (typeof state.env.references === 'undefined') { return false; }
  7670. if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {
  7671. start = pos + 1;
  7672. pos = state.md.helpers.parseLinkLabel(state, pos);
  7673. if (pos >= 0) {
  7674. label = state.src.slice(start, pos++);
  7675. } else {
  7676. pos = labelEnd + 1;
  7677. }
  7678. } else {
  7679. pos = labelEnd + 1;
  7680. }
  7681. // covers label === '' and label === undefined
  7682. // (collapsed reference link and shortcut reference link respectively)
  7683. if (!label) { label = state.src.slice(labelStart, labelEnd); }
  7684. ref = state.env.references[normalizeReference(label)];
  7685. if (!ref) {
  7686. state.pos = oldPos;
  7687. return false;
  7688. }
  7689. href = ref.href;
  7690. title = ref.title;
  7691. }
  7692. //
  7693. // We found the end of the link, and know for a fact it's a valid link;
  7694. // so all that's left to do is to call tokenizer.
  7695. //
  7696. if (!silent) {
  7697. content = state.src.slice(labelStart, labelEnd);
  7698. state.md.inline.parse(
  7699. content,
  7700. state.md,
  7701. state.env,
  7702. tokens = []
  7703. );
  7704. token = state.push('image', 'img', 0);
  7705. token.attrs = attrs = [ [ 'src', href ], [ 'alt', '' ] ];
  7706. token.children = tokens;
  7707. token.content = content;
  7708. if (title) {
  7709. attrs.push([ 'title', title ]);
  7710. }
  7711. }
  7712. state.pos = pos;
  7713. state.posMax = max;
  7714. return true;
  7715. };
  7716. /***/ }),
  7717. /* 72 */
  7718. /***/ (function(module, exports, __webpack_require__) {
  7719. "use strict";
  7720. // Process autolinks '<protocol:...>'
  7721. /*eslint max-len:0*/
  7722. 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])?)*)>/;
  7723. var AUTOLINK_RE = /^<([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)>/;
  7724. module.exports = function autolink(state, silent) {
  7725. var tail, linkMatch, emailMatch, url, fullUrl, token,
  7726. pos = state.pos;
  7727. if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }
  7728. tail = state.src.slice(pos);
  7729. if (tail.indexOf('>') < 0) { return false; }
  7730. if (AUTOLINK_RE.test(tail)) {
  7731. linkMatch = tail.match(AUTOLINK_RE);
  7732. url = linkMatch[0].slice(1, -1);
  7733. fullUrl = state.md.normalizeLink(url);
  7734. if (!state.md.validateLink(fullUrl)) { return false; }
  7735. if (!silent) {
  7736. token = state.push('link_open', 'a', 1);
  7737. token.attrs = [ [ 'href', fullUrl ] ];
  7738. token.markup = 'autolink';
  7739. token.info = 'auto';
  7740. token = state.push('text', '', 0);
  7741. token.content = state.md.normalizeLinkText(url);
  7742. token = state.push('link_close', 'a', -1);
  7743. token.markup = 'autolink';
  7744. token.info = 'auto';
  7745. }
  7746. state.pos += linkMatch[0].length;
  7747. return true;
  7748. }
  7749. if (EMAIL_RE.test(tail)) {
  7750. emailMatch = tail.match(EMAIL_RE);
  7751. url = emailMatch[0].slice(1, -1);
  7752. fullUrl = state.md.normalizeLink('mailto:' + url);
  7753. if (!state.md.validateLink(fullUrl)) { return false; }
  7754. if (!silent) {
  7755. token = state.push('link_open', 'a', 1);
  7756. token.attrs = [ [ 'href', fullUrl ] ];
  7757. token.markup = 'autolink';
  7758. token.info = 'auto';
  7759. token = state.push('text', '', 0);
  7760. token.content = state.md.normalizeLinkText(url);
  7761. token = state.push('link_close', 'a', -1);
  7762. token.markup = 'autolink';
  7763. token.info = 'auto';
  7764. }
  7765. state.pos += emailMatch[0].length;
  7766. return true;
  7767. }
  7768. return false;
  7769. };
  7770. /***/ }),
  7771. /* 73 */
  7772. /***/ (function(module, exports, __webpack_require__) {
  7773. "use strict";
  7774. // Process html tags
  7775. var HTML_TAG_RE = __webpack_require__(16).HTML_TAG_RE;
  7776. function isLetter(ch) {
  7777. /*eslint no-bitwise:0*/
  7778. var lc = ch | 0x20; // to lower case
  7779. return (lc >= 0x61/* a */) && (lc <= 0x7a/* z */);
  7780. }
  7781. module.exports = function html_inline(state, silent) {
  7782. var ch, match, max, token,
  7783. pos = state.pos;
  7784. if (!state.md.options.html) { return false; }
  7785. // Check start
  7786. max = state.posMax;
  7787. if (state.src.charCodeAt(pos) !== 0x3C/* < */ ||
  7788. pos + 2 >= max) {
  7789. return false;
  7790. }
  7791. // Quick fail on second char
  7792. ch = state.src.charCodeAt(pos + 1);
  7793. if (ch !== 0x21/* ! */ &&
  7794. ch !== 0x3F/* ? */ &&
  7795. ch !== 0x2F/* / */ &&
  7796. !isLetter(ch)) {
  7797. return false;
  7798. }
  7799. match = state.src.slice(pos).match(HTML_TAG_RE);
  7800. if (!match) { return false; }
  7801. if (!silent) {
  7802. token = state.push('html_inline', '', 0);
  7803. token.content = state.src.slice(pos, pos + match[0].length);
  7804. }
  7805. state.pos += match[0].length;
  7806. return true;
  7807. };
  7808. /***/ }),
  7809. /* 74 */
  7810. /***/ (function(module, exports, __webpack_require__) {
  7811. "use strict";
  7812. // Process html entity - &#123;, &#xAF;, &quot;, ...
  7813. var entities = __webpack_require__(11);
  7814. var has = __webpack_require__(0).has;
  7815. var isValidEntityCode = __webpack_require__(0).isValidEntityCode;
  7816. var fromCodePoint = __webpack_require__(0).fromCodePoint;
  7817. var DIGITAL_RE = /^&#((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i;
  7818. var NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;
  7819. module.exports = function entity(state, silent) {
  7820. var ch, code, match, pos = state.pos, max = state.posMax;
  7821. if (state.src.charCodeAt(pos) !== 0x26/* & */) { return false; }
  7822. if (pos + 1 < max) {
  7823. ch = state.src.charCodeAt(pos + 1);
  7824. if (ch === 0x23 /* # */) {
  7825. match = state.src.slice(pos).match(DIGITAL_RE);
  7826. if (match) {
  7827. if (!silent) {
  7828. code = match[1][0].toLowerCase() === 'x' ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10);
  7829. state.pending += isValidEntityCode(code) ? fromCodePoint(code) : fromCodePoint(0xFFFD);
  7830. }
  7831. state.pos += match[0].length;
  7832. return true;
  7833. }
  7834. } else {
  7835. match = state.src.slice(pos).match(NAMED_RE);
  7836. if (match) {
  7837. if (has(entities, match[1])) {
  7838. if (!silent) { state.pending += entities[match[1]]; }
  7839. state.pos += match[0].length;
  7840. return true;
  7841. }
  7842. }
  7843. }
  7844. }
  7845. if (!silent) { state.pending += '&'; }
  7846. state.pos++;
  7847. return true;
  7848. };
  7849. /***/ }),
  7850. /* 75 */
  7851. /***/ (function(module, exports, __webpack_require__) {
  7852. "use strict";
  7853. // For each opening emphasis-like marker find a matching closing one
  7854. //
  7855. module.exports = function link_pairs(state) {
  7856. var i, j, lastDelim, currDelim,
  7857. delimiters = state.delimiters,
  7858. max = state.delimiters.length;
  7859. for (i = 0; i < max; i++) {
  7860. lastDelim = delimiters[i];
  7861. if (!lastDelim.close) { continue; }
  7862. j = i - lastDelim.jump - 1;
  7863. while (j >= 0) {
  7864. currDelim = delimiters[j];
  7865. if (currDelim.open &&
  7866. currDelim.marker === lastDelim.marker &&
  7867. currDelim.end < 0 &&
  7868. currDelim.level === lastDelim.level) {
  7869. // typeofs are for backward compatibility with plugins
  7870. var odd_match = (currDelim.close || lastDelim.open) &&
  7871. typeof currDelim.length !== 'undefined' &&
  7872. typeof lastDelim.length !== 'undefined' &&
  7873. (currDelim.length + lastDelim.length) % 3 === 0;
  7874. if (!odd_match) {
  7875. lastDelim.jump = i - j;
  7876. lastDelim.open = false;
  7877. currDelim.end = i;
  7878. currDelim.jump = 0;
  7879. break;
  7880. }
  7881. }
  7882. j -= currDelim.jump + 1;
  7883. }
  7884. }
  7885. };
  7886. /***/ }),
  7887. /* 76 */
  7888. /***/ (function(module, exports, __webpack_require__) {
  7889. "use strict";
  7890. // Merge adjacent text nodes into one, and re-calculate all token levels
  7891. //
  7892. module.exports = function text_collapse(state) {
  7893. var curr, last,
  7894. level = 0,
  7895. tokens = state.tokens,
  7896. max = state.tokens.length;
  7897. for (curr = last = 0; curr < max; curr++) {
  7898. // re-calculate levels
  7899. level += tokens[curr].nesting;
  7900. tokens[curr].level = level;
  7901. if (tokens[curr].type === 'text' &&
  7902. curr + 1 < max &&
  7903. tokens[curr + 1].type === 'text') {
  7904. // collapse two adjacent text nodes
  7905. tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;
  7906. } else {
  7907. if (curr !== last) { tokens[last] = tokens[curr]; }
  7908. last++;
  7909. }
  7910. }
  7911. if (curr !== last) {
  7912. tokens.length = last;
  7913. }
  7914. };
  7915. /***/ }),
  7916. /* 77 */
  7917. /***/ (function(module, exports, __webpack_require__) {
  7918. "use strict";
  7919. // Inline parser state
  7920. var Token = __webpack_require__(7);
  7921. var isWhiteSpace = __webpack_require__(0).isWhiteSpace;
  7922. var isPunctChar = __webpack_require__(0).isPunctChar;
  7923. var isMdAsciiPunct = __webpack_require__(0).isMdAsciiPunct;
  7924. function StateInline(src, md, env, outTokens) {
  7925. this.src = src;
  7926. this.env = env;
  7927. this.md = md;
  7928. this.tokens = outTokens;
  7929. this.pos = 0;
  7930. this.posMax = this.src.length;
  7931. this.level = 0;
  7932. this.pending = '';
  7933. this.pendingLevel = 0;
  7934. this.cache = {}; // Stores { start: end } pairs. Useful for backtrack
  7935. // optimization of pairs parse (emphasis, strikes).
  7936. this.delimiters = []; // Emphasis-like delimiters
  7937. }
  7938. // Flush pending text
  7939. //
  7940. StateInline.prototype.pushPending = function () {
  7941. var token = new Token('text', '', 0);
  7942. token.content = this.pending;
  7943. token.level = this.pendingLevel;
  7944. this.tokens.push(token);
  7945. this.pending = '';
  7946. return token;
  7947. };
  7948. // Push new token to "stream".
  7949. // If pending text exists - flush it as text token
  7950. //
  7951. StateInline.prototype.push = function (type, tag, nesting) {
  7952. if (this.pending) {
  7953. this.pushPending();
  7954. }
  7955. var token = new Token(type, tag, nesting);
  7956. if (nesting < 0) { this.level--; }
  7957. token.level = this.level;
  7958. if (nesting > 0) { this.level++; }
  7959. this.pendingLevel = this.level;
  7960. this.tokens.push(token);
  7961. return token;
  7962. };
  7963. // Scan a sequence of emphasis-like markers, and determine whether
  7964. // it can start an emphasis sequence or end an emphasis sequence.
  7965. //
  7966. // - start - position to scan from (it should point at a valid marker);
  7967. // - canSplitWord - determine if these markers can be found inside a word
  7968. //
  7969. StateInline.prototype.scanDelims = function (start, canSplitWord) {
  7970. var pos = start, lastChar, nextChar, count, can_open, can_close,
  7971. isLastWhiteSpace, isLastPunctChar,
  7972. isNextWhiteSpace, isNextPunctChar,
  7973. left_flanking = true,
  7974. right_flanking = true,
  7975. max = this.posMax,
  7976. marker = this.src.charCodeAt(start);
  7977. // treat beginning of the line as a whitespace
  7978. lastChar = start > 0 ? this.src.charCodeAt(start - 1) : 0x20;
  7979. while (pos < max && this.src.charCodeAt(pos) === marker) { pos++; }
  7980. count = pos - start;
  7981. // treat end of the line as a whitespace
  7982. nextChar = pos < max ? this.src.charCodeAt(pos) : 0x20;
  7983. isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
  7984. isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
  7985. isLastWhiteSpace = isWhiteSpace(lastChar);
  7986. isNextWhiteSpace = isWhiteSpace(nextChar);
  7987. if (isNextWhiteSpace) {
  7988. left_flanking = false;
  7989. } else if (isNextPunctChar) {
  7990. if (!(isLastWhiteSpace || isLastPunctChar)) {
  7991. left_flanking = false;
  7992. }
  7993. }
  7994. if (isLastWhiteSpace) {
  7995. right_flanking = false;
  7996. } else if (isLastPunctChar) {
  7997. if (!(isNextWhiteSpace || isNextPunctChar)) {
  7998. right_flanking = false;
  7999. }
  8000. }
  8001. if (!canSplitWord) {
  8002. can_open = left_flanking && (!right_flanking || isLastPunctChar);
  8003. can_close = right_flanking && (!left_flanking || isNextPunctChar);
  8004. } else {
  8005. can_open = left_flanking;
  8006. can_close = right_flanking;
  8007. }
  8008. return {
  8009. can_open: can_open,
  8010. can_close: can_close,
  8011. length: count
  8012. };
  8013. };
  8014. // re-export Token class to use in block rules
  8015. StateInline.prototype.Token = Token;
  8016. module.exports = StateInline;
  8017. /***/ }),
  8018. /* 78 */
  8019. /***/ (function(module, exports, __webpack_require__) {
  8020. "use strict";
  8021. ////////////////////////////////////////////////////////////////////////////////
  8022. // Helpers
  8023. // Merge objects
  8024. //
  8025. function assign(obj /*from1, from2, from3, ...*/) {
  8026. var sources = Array.prototype.slice.call(arguments, 1);
  8027. sources.forEach(function (source) {
  8028. if (!source) { return; }
  8029. Object.keys(source).forEach(function (key) {
  8030. obj[key] = source[key];
  8031. });
  8032. });
  8033. return obj;
  8034. }
  8035. function _class(obj) { return Object.prototype.toString.call(obj); }
  8036. function isString(obj) { return _class(obj) === '[object String]'; }
  8037. function isObject(obj) { return _class(obj) === '[object Object]'; }
  8038. function isRegExp(obj) { return _class(obj) === '[object RegExp]'; }
  8039. function isFunction(obj) { return _class(obj) === '[object Function]'; }
  8040. function escapeRE(str) { return str.replace(/[.?*+^$[\]\\(){}|-]/g, '\\$&'); }
  8041. ////////////////////////////////////////////////////////////////////////////////
  8042. var defaultOptions = {
  8043. fuzzyLink: true,
  8044. fuzzyEmail: true,
  8045. fuzzyIP: false
  8046. };
  8047. function isOptionsObj(obj) {
  8048. return Object.keys(obj || {}).reduce(function (acc, k) {
  8049. return acc || defaultOptions.hasOwnProperty(k);
  8050. }, false);
  8051. }
  8052. var defaultSchemas = {
  8053. 'http:': {
  8054. validate: function (text, pos, self) {
  8055. var tail = text.slice(pos);
  8056. if (!self.re.http) {
  8057. // compile lazily, because "host"-containing variables can change on tlds update.
  8058. self.re.http = new RegExp(
  8059. '^\\/\\/' + self.re.src_auth + self.re.src_host_port_strict + self.re.src_path, 'i'
  8060. );
  8061. }
  8062. if (self.re.http.test(tail)) {
  8063. return tail.match(self.re.http)[0].length;
  8064. }
  8065. return 0;
  8066. }
  8067. },
  8068. 'https:': 'http:',
  8069. 'ftp:': 'http:',
  8070. '//': {
  8071. validate: function (text, pos, self) {
  8072. var tail = text.slice(pos);
  8073. if (!self.re.no_http) {
  8074. // compile lazily, because "host"-containing variables can change on tlds update.
  8075. self.re.no_http = new RegExp(
  8076. '^' +
  8077. self.re.src_auth +
  8078. // Don't allow single-level domains, because of false positives like '//test'
  8079. // with code comments
  8080. '(?:localhost|(?:(?:' + self.re.src_domain + ')\\.)+' + self.re.src_domain_root + ')' +
  8081. self.re.src_port +
  8082. self.re.src_host_terminator +
  8083. self.re.src_path,
  8084. 'i'
  8085. );
  8086. }
  8087. if (self.re.no_http.test(tail)) {
  8088. // should not be `://` & `///`, that protects from errors in protocol name
  8089. if (pos >= 3 && text[pos - 3] === ':') { return 0; }
  8090. if (pos >= 3 && text[pos - 3] === '/') { return 0; }
  8091. return tail.match(self.re.no_http)[0].length;
  8092. }
  8093. return 0;
  8094. }
  8095. },
  8096. 'mailto:': {
  8097. validate: function (text, pos, self) {
  8098. var tail = text.slice(pos);
  8099. if (!self.re.mailto) {
  8100. self.re.mailto = new RegExp(
  8101. '^' + self.re.src_email_name + '@' + self.re.src_host_strict, 'i'
  8102. );
  8103. }
  8104. if (self.re.mailto.test(tail)) {
  8105. return tail.match(self.re.mailto)[0].length;
  8106. }
  8107. return 0;
  8108. }
  8109. }
  8110. };
  8111. /*eslint-disable max-len*/
  8112. // RE pattern for 2-character tlds (autogenerated by ./support/tlds_2char_gen.js)
  8113. 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]';
  8114. // DON'T try to make PRs with changes. Extend TLDs with LinkifyIt.tlds() instead
  8115. var tlds_default = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'.split('|');
  8116. /*eslint-enable max-len*/
  8117. ////////////////////////////////////////////////////////////////////////////////
  8118. function resetScanCache(self) {
  8119. self.__index__ = -1;
  8120. self.__text_cache__ = '';
  8121. }
  8122. function createValidator(re) {
  8123. return function (text, pos) {
  8124. var tail = text.slice(pos);
  8125. if (re.test(tail)) {
  8126. return tail.match(re)[0].length;
  8127. }
  8128. return 0;
  8129. };
  8130. }
  8131. function createNormalizer() {
  8132. return function (match, self) {
  8133. self.normalize(match);
  8134. };
  8135. }
  8136. // Schemas compiler. Build regexps.
  8137. //
  8138. function compile(self) {
  8139. // Load & clone RE patterns.
  8140. var re = self.re = __webpack_require__(79)(self.__opts__);
  8141. // Define dynamic patterns
  8142. var tlds = self.__tlds__.slice();
  8143. self.onCompile();
  8144. if (!self.__tlds_replaced__) {
  8145. tlds.push(tlds_2ch_src_re);
  8146. }
  8147. tlds.push(re.src_xn);
  8148. re.src_tlds = tlds.join('|');
  8149. function untpl(tpl) { return tpl.replace('%TLDS%', re.src_tlds); }
  8150. re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), 'i');
  8151. re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), 'i');
  8152. re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'i');
  8153. re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), 'i');
  8154. //
  8155. // Compile each schema
  8156. //
  8157. var aliases = [];
  8158. self.__compiled__ = {}; // Reset compiled data
  8159. function schemaError(name, val) {
  8160. throw new Error('(LinkifyIt) Invalid schema "' + name + '": ' + val);
  8161. }
  8162. Object.keys(self.__schemas__).forEach(function (name) {
  8163. var val = self.__schemas__[name];
  8164. // skip disabled methods
  8165. if (val === null) { return; }
  8166. var compiled = { validate: null, link: null };
  8167. self.__compiled__[name] = compiled;
  8168. if (isObject(val)) {
  8169. if (isRegExp(val.validate)) {
  8170. compiled.validate = createValidator(val.validate);
  8171. } else if (isFunction(val.validate)) {
  8172. compiled.validate = val.validate;
  8173. } else {
  8174. schemaError(name, val);
  8175. }
  8176. if (isFunction(val.normalize)) {
  8177. compiled.normalize = val.normalize;
  8178. } else if (!val.normalize) {
  8179. compiled.normalize = createNormalizer();
  8180. } else {
  8181. schemaError(name, val);
  8182. }
  8183. return;
  8184. }
  8185. if (isString(val)) {
  8186. aliases.push(name);
  8187. return;
  8188. }
  8189. schemaError(name, val);
  8190. });
  8191. //
  8192. // Compile postponed aliases
  8193. //
  8194. aliases.forEach(function (alias) {
  8195. if (!self.__compiled__[self.__schemas__[alias]]) {
  8196. // Silently fail on missed schemas to avoid errons on disable.
  8197. // schemaError(alias, self.__schemas__[alias]);
  8198. return;
  8199. }
  8200. self.__compiled__[alias].validate =
  8201. self.__compiled__[self.__schemas__[alias]].validate;
  8202. self.__compiled__[alias].normalize =
  8203. self.__compiled__[self.__schemas__[alias]].normalize;
  8204. });
  8205. //
  8206. // Fake record for guessed links
  8207. //
  8208. self.__compiled__[''] = { validate: null, normalize: createNormalizer() };
  8209. //
  8210. // Build schema condition
  8211. //
  8212. var slist = Object.keys(self.__compiled__)
  8213. .filter(function (name) {
  8214. // Filter disabled & fake schemas
  8215. return name.length > 0 && self.__compiled__[name];
  8216. })
  8217. .map(escapeRE)
  8218. .join('|');
  8219. // (?!_) cause 1.5x slowdown
  8220. self.re.schema_test = RegExp('(^|(?!_)(?:[><\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'i');
  8221. self.re.schema_search = RegExp('(^|(?!_)(?:[><\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'ig');
  8222. self.re.pretest = RegExp(
  8223. '(' + self.re.schema_test.source + ')|' +
  8224. '(' + self.re.host_fuzzy_test.source + ')|' +
  8225. '@',
  8226. 'i');
  8227. //
  8228. // Cleanup
  8229. //
  8230. resetScanCache(self);
  8231. }
  8232. /**
  8233. * class Match
  8234. *
  8235. * Match result. Single element of array, returned by [[LinkifyIt#match]]
  8236. **/
  8237. function Match(self, shift) {
  8238. var start = self.__index__,
  8239. end = self.__last_index__,
  8240. text = self.__text_cache__.slice(start, end);
  8241. /**
  8242. * Match#schema -> String
  8243. *
  8244. * Prefix (protocol) for matched string.
  8245. **/
  8246. this.schema = self.__schema__.toLowerCase();
  8247. /**
  8248. * Match#index -> Number
  8249. *
  8250. * First position of matched string.
  8251. **/
  8252. this.index = start + shift;
  8253. /**
  8254. * Match#lastIndex -> Number
  8255. *
  8256. * Next position after matched string.
  8257. **/
  8258. this.lastIndex = end + shift;
  8259. /**
  8260. * Match#raw -> String
  8261. *
  8262. * Matched string.
  8263. **/
  8264. this.raw = text;
  8265. /**
  8266. * Match#text -> String
  8267. *
  8268. * Notmalized text of matched string.
  8269. **/
  8270. this.text = text;
  8271. /**
  8272. * Match#url -> String
  8273. *
  8274. * Normalized url of matched string.
  8275. **/
  8276. this.url = text;
  8277. }
  8278. function createMatch(self, shift) {
  8279. var match = new Match(self, shift);
  8280. self.__compiled__[match.schema].normalize(match, self);
  8281. return match;
  8282. }
  8283. /**
  8284. * class LinkifyIt
  8285. **/
  8286. /**
  8287. * new LinkifyIt(schemas, options)
  8288. * - schemas (Object): Optional. Additional schemas to validate (prefix/validator)
  8289. * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }
  8290. *
  8291. * Creates new linkifier instance with optional additional schemas.
  8292. * Can be called without `new` keyword for convenience.
  8293. *
  8294. * By default understands:
  8295. *
  8296. * - `http(s)://...` , `ftp://...`, `mailto:...` & `//...` links
  8297. * - "fuzzy" links and emails (example.com, foo@bar.com).
  8298. *
  8299. * `schemas` is an object, where each key/value describes protocol/rule:
  8300. *
  8301. * - __key__ - link prefix (usually, protocol name with `:` at the end, `skype:`
  8302. * for example). `linkify-it` makes shure that prefix is not preceeded with
  8303. * alphanumeric char and symbols. Only whitespaces and punctuation allowed.
  8304. * - __value__ - rule to check tail after link prefix
  8305. * - _String_ - just alias to existing rule
  8306. * - _Object_
  8307. * - _validate_ - validator function (should return matched length on success),
  8308. * or `RegExp`.
  8309. * - _normalize_ - optional function to normalize text & url of matched result
  8310. * (for example, for @twitter mentions).
  8311. *
  8312. * `options`:
  8313. *
  8314. * - __fuzzyLink__ - recognige URL-s without `http(s):` prefix. Default `true`.
  8315. * - __fuzzyIP__ - allow IPs in fuzzy links above. Can conflict with some texts
  8316. * like version numbers. Default `false`.
  8317. * - __fuzzyEmail__ - recognize emails without `mailto:` prefix.
  8318. *
  8319. **/
  8320. function LinkifyIt(schemas, options) {
  8321. if (!(this instanceof LinkifyIt)) {
  8322. return new LinkifyIt(schemas, options);
  8323. }
  8324. if (!options) {
  8325. if (isOptionsObj(schemas)) {
  8326. options = schemas;
  8327. schemas = {};
  8328. }
  8329. }
  8330. this.__opts__ = assign({}, defaultOptions, options);
  8331. // Cache last tested result. Used to skip repeating steps on next `match` call.
  8332. this.__index__ = -1;
  8333. this.__last_index__ = -1; // Next scan position
  8334. this.__schema__ = '';
  8335. this.__text_cache__ = '';
  8336. this.__schemas__ = assign({}, defaultSchemas, schemas);
  8337. this.__compiled__ = {};
  8338. this.__tlds__ = tlds_default;
  8339. this.__tlds_replaced__ = false;
  8340. this.re = {};
  8341. compile(this);
  8342. }
  8343. /** chainable
  8344. * LinkifyIt#add(schema, definition)
  8345. * - schema (String): rule name (fixed pattern prefix)
  8346. * - definition (String|RegExp|Object): schema definition
  8347. *
  8348. * Add new rule definition. See constructor description for details.
  8349. **/
  8350. LinkifyIt.prototype.add = function add(schema, definition) {
  8351. this.__schemas__[schema] = definition;
  8352. compile(this);
  8353. return this;
  8354. };
  8355. /** chainable
  8356. * LinkifyIt#set(options)
  8357. * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }
  8358. *
  8359. * Set recognition options for links without schema.
  8360. **/
  8361. LinkifyIt.prototype.set = function set(options) {
  8362. this.__opts__ = assign(this.__opts__, options);
  8363. return this;
  8364. };
  8365. /**
  8366. * LinkifyIt#test(text) -> Boolean
  8367. *
  8368. * Searches linkifiable pattern and returns `true` on success or `false` on fail.
  8369. **/
  8370. LinkifyIt.prototype.test = function test(text) {
  8371. // Reset scan cache
  8372. this.__text_cache__ = text;
  8373. this.__index__ = -1;
  8374. if (!text.length) { return false; }
  8375. var m, ml, me, len, shift, next, re, tld_pos, at_pos;
  8376. // try to scan for link with schema - that's the most simple rule
  8377. if (this.re.schema_test.test(text)) {
  8378. re = this.re.schema_search;
  8379. re.lastIndex = 0;
  8380. while ((m = re.exec(text)) !== null) {
  8381. len = this.testSchemaAt(text, m[2], re.lastIndex);
  8382. if (len) {
  8383. this.__schema__ = m[2];
  8384. this.__index__ = m.index + m[1].length;
  8385. this.__last_index__ = m.index + m[0].length + len;
  8386. break;
  8387. }
  8388. }
  8389. }
  8390. if (this.__opts__.fuzzyLink && this.__compiled__['http:']) {
  8391. // guess schemaless links
  8392. tld_pos = text.search(this.re.host_fuzzy_test);
  8393. if (tld_pos >= 0) {
  8394. // if tld is located after found link - no need to check fuzzy pattern
  8395. if (this.__index__ < 0 || tld_pos < this.__index__) {
  8396. if ((ml = text.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) !== null) {
  8397. shift = ml.index + ml[1].length;
  8398. if (this.__index__ < 0 || shift < this.__index__) {
  8399. this.__schema__ = '';
  8400. this.__index__ = shift;
  8401. this.__last_index__ = ml.index + ml[0].length;
  8402. }
  8403. }
  8404. }
  8405. }
  8406. }
  8407. if (this.__opts__.fuzzyEmail && this.__compiled__['mailto:']) {
  8408. // guess schemaless emails
  8409. at_pos = text.indexOf('@');
  8410. if (at_pos >= 0) {
  8411. // We can't skip this check, because this cases are possible:
  8412. // 192.168.1.1@gmail.com, my.in@example.com
  8413. if ((me = text.match(this.re.email_fuzzy)) !== null) {
  8414. shift = me.index + me[1].length;
  8415. next = me.index + me[0].length;
  8416. if (this.__index__ < 0 || shift < this.__index__ ||
  8417. (shift === this.__index__ && next > this.__last_index__)) {
  8418. this.__schema__ = 'mailto:';
  8419. this.__index__ = shift;
  8420. this.__last_index__ = next;
  8421. }
  8422. }
  8423. }
  8424. }
  8425. return this.__index__ >= 0;
  8426. };
  8427. /**
  8428. * LinkifyIt#pretest(text) -> Boolean
  8429. *
  8430. * Very quick check, that can give false positives. Returns true if link MAY BE
  8431. * can exists. Can be used for speed optimization, when you need to check that
  8432. * link NOT exists.
  8433. **/
  8434. LinkifyIt.prototype.pretest = function pretest(text) {
  8435. return this.re.pretest.test(text);
  8436. };
  8437. /**
  8438. * LinkifyIt#testSchemaAt(text, name, position) -> Number
  8439. * - text (String): text to scan
  8440. * - name (String): rule (schema) name
  8441. * - position (Number): text offset to check from
  8442. *
  8443. * Similar to [[LinkifyIt#test]] but checks only specific protocol tail exactly
  8444. * at given position. Returns length of found pattern (0 on fail).
  8445. **/
  8446. LinkifyIt.prototype.testSchemaAt = function testSchemaAt(text, schema, pos) {
  8447. // If not supported schema check requested - terminate
  8448. if (!this.__compiled__[schema.toLowerCase()]) {
  8449. return 0;
  8450. }
  8451. return this.__compiled__[schema.toLowerCase()].validate(text, pos, this);
  8452. };
  8453. /**
  8454. * LinkifyIt#match(text) -> Array|null
  8455. *
  8456. * Returns array of found link descriptions or `null` on fail. We strongly
  8457. * recommend to use [[LinkifyIt#test]] first, for best speed.
  8458. *
  8459. * ##### Result match description
  8460. *
  8461. * - __schema__ - link schema, can be empty for fuzzy links, or `//` for
  8462. * protocol-neutral links.
  8463. * - __index__ - offset of matched text
  8464. * - __lastIndex__ - index of next char after mathch end
  8465. * - __raw__ - matched text
  8466. * - __text__ - normalized text
  8467. * - __url__ - link, generated from matched text
  8468. **/
  8469. LinkifyIt.prototype.match = function match(text) {
  8470. var shift = 0, result = [];
  8471. // Try to take previous element from cache, if .test() called before
  8472. if (this.__index__ >= 0 && this.__text_cache__ === text) {
  8473. result.push(createMatch(this, shift));
  8474. shift = this.__last_index__;
  8475. }
  8476. // Cut head if cache was used
  8477. var tail = shift ? text.slice(shift) : text;
  8478. // Scan string until end reached
  8479. while (this.test(tail)) {
  8480. result.push(createMatch(this, shift));
  8481. tail = tail.slice(this.__last_index__);
  8482. shift += this.__last_index__;
  8483. }
  8484. if (result.length) {
  8485. return result;
  8486. }
  8487. return null;
  8488. };
  8489. /** chainable
  8490. * LinkifyIt#tlds(list [, keepOld]) -> this
  8491. * - list (Array): list of tlds
  8492. * - keepOld (Boolean): merge with current list if `true` (`false` by default)
  8493. *
  8494. * Load (or merge) new tlds list. Those are user for fuzzy links (without prefix)
  8495. * to avoid false positives. By default this algorythm used:
  8496. *
  8497. * - hostname with any 2-letter root zones are ok.
  8498. * - biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф
  8499. * are ok.
  8500. * - encoded (`xn--...`) root zones are ok.
  8501. *
  8502. * If list is replaced, then exact match for 2-chars root zones will be checked.
  8503. **/
  8504. LinkifyIt.prototype.tlds = function tlds(list, keepOld) {
  8505. list = Array.isArray(list) ? list : [ list ];
  8506. if (!keepOld) {
  8507. this.__tlds__ = list.slice();
  8508. this.__tlds_replaced__ = true;
  8509. compile(this);
  8510. return this;
  8511. }
  8512. this.__tlds__ = this.__tlds__.concat(list)
  8513. .sort()
  8514. .filter(function (el, idx, arr) {
  8515. return el !== arr[idx - 1];
  8516. })
  8517. .reverse();
  8518. compile(this);
  8519. return this;
  8520. };
  8521. /**
  8522. * LinkifyIt#normalize(match)
  8523. *
  8524. * Default normalizer (if schema does not define it's own).
  8525. **/
  8526. LinkifyIt.prototype.normalize = function normalize(match) {
  8527. // Do minimal possible changes by default. Need to collect feedback prior
  8528. // to move forward https://github.com/markdown-it/linkify-it/issues/1
  8529. if (!match.schema) { match.url = 'http://' + match.url; }
  8530. if (match.schema === 'mailto:' && !/^mailto:/i.test(match.url)) {
  8531. match.url = 'mailto:' + match.url;
  8532. }
  8533. };
  8534. /**
  8535. * LinkifyIt#onCompile()
  8536. *
  8537. * Override to modify basic RegExp-s.
  8538. **/
  8539. LinkifyIt.prototype.onCompile = function onCompile() {
  8540. };
  8541. module.exports = LinkifyIt;
  8542. /***/ }),
  8543. /* 79 */
  8544. /***/ (function(module, exports, __webpack_require__) {
  8545. "use strict";
  8546. module.exports = function (opts) {
  8547. var re = {};
  8548. // Use direct extract instead of `regenerate` to reduse browserified size
  8549. re.src_Any = __webpack_require__(13).source;
  8550. re.src_Cc = __webpack_require__(14).source;
  8551. re.src_Z = __webpack_require__(15).source;
  8552. re.src_P = __webpack_require__(5).source;
  8553. // \p{\Z\P\Cc\CF} (white spaces + control + format + punctuation)
  8554. re.src_ZPCc = [ re.src_Z, re.src_P, re.src_Cc ].join('|');
  8555. // \p{\Z\Cc} (white spaces + control)
  8556. re.src_ZCc = [ re.src_Z, re.src_Cc ].join('|');
  8557. // Experimental. List of chars, completely prohibited in links
  8558. // because can separate it from other part of text
  8559. var text_separators = '[><\uff5c]';
  8560. // All possible word characters (everything without punctuation, spaces & controls)
  8561. // Defined via punctuation & spaces to save space
  8562. // Should be something like \p{\L\N\S\M} (\w but without `_`)
  8563. re.src_pseudo_letter = '(?:(?!' + text_separators + '|' + re.src_ZPCc + ')' + re.src_Any + ')';
  8564. // The same as abothe but without [0-9]
  8565. // var src_pseudo_letter_non_d = '(?:(?![0-9]|' + src_ZPCc + ')' + src_Any + ')';
  8566. ////////////////////////////////////////////////////////////////////////////////
  8567. re.src_ip4 =
  8568. '(?:(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]?)';
  8569. // Prohibit any of "@/[]()" in user/pass to avoid wrong domain fetch.
  8570. re.src_auth = '(?:(?:(?!' + re.src_ZCc + '|[@/\\[\\]()]).)+@)?';
  8571. re.src_port =
  8572. '(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?';
  8573. re.src_host_terminator =
  8574. '(?=$|' + text_separators + '|' + re.src_ZPCc + ')(?!-|_|:\\d|\\.-|\\.(?!$|' + re.src_ZPCc + '))';
  8575. re.src_path =
  8576. '(?:' +
  8577. '[/?#]' +
  8578. '(?:' +
  8579. '(?!' + re.src_ZCc + '|' + text_separators + '|[()[\\]{}.,"\'?!\\-]).|' +
  8580. '\\[(?:(?!' + re.src_ZCc + '|\\]).)*\\]|' +
  8581. '\\((?:(?!' + re.src_ZCc + '|[)]).)*\\)|' +
  8582. '\\{(?:(?!' + re.src_ZCc + '|[}]).)*\\}|' +
  8583. '\\"(?:(?!' + re.src_ZCc + '|["]).)+\\"|' +
  8584. "\\'(?:(?!" + re.src_ZCc + "|[']).)+\\'|" +
  8585. "\\'(?=" + re.src_pseudo_letter + '|[-]).|' + // allow `I'm_king` if no pair found
  8586. '\\.{2,3}[a-zA-Z0-9%/]|' + // github has ... in commit range links. Restrict to
  8587. // - english
  8588. // - percent-encoded
  8589. // - parts of file path
  8590. // until more examples found.
  8591. '\\.(?!' + re.src_ZCc + '|[.]).|' +
  8592. (opts && opts['---'] ?
  8593. '\\-(?!--(?:[^-]|$))(?:-*)|' // `---` => long dash, terminate
  8594. :
  8595. '\\-+|'
  8596. ) +
  8597. '\\,(?!' + re.src_ZCc + ').|' + // allow `,,,` in paths
  8598. '\\!(?!' + re.src_ZCc + '|[!]).|' +
  8599. '\\?(?!' + re.src_ZCc + '|[?]).' +
  8600. ')+' +
  8601. '|\\/' +
  8602. ')?';
  8603. re.src_email_name =
  8604. '[\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]+';
  8605. re.src_xn =
  8606. 'xn--[a-z0-9\\-]{1,59}';
  8607. // More to read about domain names
  8608. // http://serverfault.com/questions/638260/
  8609. re.src_domain_root =
  8610. // Allow letters & digits (http://test1)
  8611. '(?:' +
  8612. re.src_xn +
  8613. '|' +
  8614. re.src_pseudo_letter + '{1,63}' +
  8615. ')';
  8616. re.src_domain =
  8617. '(?:' +
  8618. re.src_xn +
  8619. '|' +
  8620. '(?:' + re.src_pseudo_letter + ')' +
  8621. '|' +
  8622. // don't allow `--` in domain names, because:
  8623. // - that can conflict with markdown &mdash; / &ndash;
  8624. // - nobody use those anyway
  8625. '(?:' + re.src_pseudo_letter + '(?:-(?!-)|' + re.src_pseudo_letter + '){0,61}' + re.src_pseudo_letter + ')' +
  8626. ')';
  8627. re.src_host =
  8628. '(?:' +
  8629. // Don't need IP check, because digits are already allowed in normal domain names
  8630. // src_ip4 +
  8631. // '|' +
  8632. '(?:(?:(?:' + re.src_domain + ')\\.)*' + re.src_domain/*_root*/ + ')' +
  8633. ')';
  8634. re.tpl_host_fuzzy =
  8635. '(?:' +
  8636. re.src_ip4 +
  8637. '|' +
  8638. '(?:(?:(?:' + re.src_domain + ')\\.)+(?:%TLDS%))' +
  8639. ')';
  8640. re.tpl_host_no_ip_fuzzy =
  8641. '(?:(?:(?:' + re.src_domain + ')\\.)+(?:%TLDS%))';
  8642. re.src_host_strict =
  8643. re.src_host + re.src_host_terminator;
  8644. re.tpl_host_fuzzy_strict =
  8645. re.tpl_host_fuzzy + re.src_host_terminator;
  8646. re.src_host_port_strict =
  8647. re.src_host + re.src_port + re.src_host_terminator;
  8648. re.tpl_host_port_fuzzy_strict =
  8649. re.tpl_host_fuzzy + re.src_port + re.src_host_terminator;
  8650. re.tpl_host_port_no_ip_fuzzy_strict =
  8651. re.tpl_host_no_ip_fuzzy + re.src_port + re.src_host_terminator;
  8652. ////////////////////////////////////////////////////////////////////////////////
  8653. // Main rules
  8654. // Rude test fuzzy links by host, for quick deny
  8655. re.tpl_host_fuzzy_test =
  8656. 'localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:' + re.src_ZPCc + '|>|$))';
  8657. re.tpl_email_fuzzy =
  8658. '(^|' + text_separators + '|\\(|' + re.src_ZCc + ')(' + re.src_email_name + '@' + re.tpl_host_fuzzy_strict + ')';
  8659. re.tpl_link_fuzzy =
  8660. // Fuzzy link can't be prepended with .:/\- and non punctuation.
  8661. // but can start with > (markdown blockquote)
  8662. '(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|' + re.src_ZPCc + '))' +
  8663. '((?![$+<=>^`|\uff5c])' + re.tpl_host_port_fuzzy_strict + re.src_path + ')';
  8664. re.tpl_link_no_ip_fuzzy =
  8665. // Fuzzy link can't be prepended with .:/\- and non punctuation.
  8666. // but can start with > (markdown blockquote)
  8667. '(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|' + re.src_ZPCc + '))' +
  8668. '((?![$+<=>^`|\uff5c])' + re.tpl_host_port_no_ip_fuzzy_strict + re.src_path + ')';
  8669. return re;
  8670. };
  8671. /***/ }),
  8672. /* 80 */
  8673. /***/ (function(module, exports, __webpack_require__) {
  8674. /* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.4.1 by @mathias */
  8675. ;(function(root) {
  8676. /** Detect free variables */
  8677. var freeExports = typeof exports == 'object' && exports &&
  8678. !exports.nodeType && exports;
  8679. var freeModule = typeof module == 'object' && module &&
  8680. !module.nodeType && module;
  8681. var freeGlobal = typeof global == 'object' && global;
  8682. if (
  8683. freeGlobal.global === freeGlobal ||
  8684. freeGlobal.window === freeGlobal ||
  8685. freeGlobal.self === freeGlobal
  8686. ) {
  8687. root = freeGlobal;
  8688. }
  8689. /**
  8690. * The `punycode` object.
  8691. * @name punycode
  8692. * @type Object
  8693. */
  8694. var punycode,
  8695. /** Highest positive signed 32-bit float value */
  8696. maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
  8697. /** Bootstring parameters */
  8698. base = 36,
  8699. tMin = 1,
  8700. tMax = 26,
  8701. skew = 38,
  8702. damp = 700,
  8703. initialBias = 72,
  8704. initialN = 128, // 0x80
  8705. delimiter = '-', // '\x2D'
  8706. /** Regular expressions */
  8707. regexPunycode = /^xn--/,
  8708. regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
  8709. regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
  8710. /** Error messages */
  8711. errors = {
  8712. 'overflow': 'Overflow: input needs wider integers to process',
  8713. 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
  8714. 'invalid-input': 'Invalid input'
  8715. },
  8716. /** Convenience shortcuts */
  8717. baseMinusTMin = base - tMin,
  8718. floor = Math.floor,
  8719. stringFromCharCode = String.fromCharCode,
  8720. /** Temporary variable */
  8721. key;
  8722. /*--------------------------------------------------------------------------*/
  8723. /**
  8724. * A generic error utility function.
  8725. * @private
  8726. * @param {String} type The error type.
  8727. * @returns {Error} Throws a `RangeError` with the applicable error message.
  8728. */
  8729. function error(type) {
  8730. throw new RangeError(errors[type]);
  8731. }
  8732. /**
  8733. * A generic `Array#map` utility function.
  8734. * @private
  8735. * @param {Array} array The array to iterate over.
  8736. * @param {Function} callback The function that gets called for every array
  8737. * item.
  8738. * @returns {Array} A new array of values returned by the callback function.
  8739. */
  8740. function map(array, fn) {
  8741. var length = array.length;
  8742. var result = [];
  8743. while (length--) {
  8744. result[length] = fn(array[length]);
  8745. }
  8746. return result;
  8747. }
  8748. /**
  8749. * A simple `Array#map`-like wrapper to work with domain name strings or email
  8750. * addresses.
  8751. * @private
  8752. * @param {String} domain The domain name or email address.
  8753. * @param {Function} callback The function that gets called for every
  8754. * character.
  8755. * @returns {Array} A new string of characters returned by the callback
  8756. * function.
  8757. */
  8758. function mapDomain(string, fn) {
  8759. var parts = string.split('@');
  8760. var result = '';
  8761. if (parts.length > 1) {
  8762. // In email addresses, only the domain name should be punycoded. Leave
  8763. // the local part (i.e. everything up to `@`) intact.
  8764. result = parts[0] + '@';
  8765. string = parts[1];
  8766. }
  8767. // Avoid `split(regex)` for IE8 compatibility. See #17.
  8768. string = string.replace(regexSeparators, '\x2E');
  8769. var labels = string.split('.');
  8770. var encoded = map(labels, fn).join('.');
  8771. return result + encoded;
  8772. }
  8773. /**
  8774. * Creates an array containing the numeric code points of each Unicode
  8775. * character in the string. While JavaScript uses UCS-2 internally,
  8776. * this function will convert a pair of surrogate halves (each of which
  8777. * UCS-2 exposes as separate characters) into a single code point,
  8778. * matching UTF-16.
  8779. * @see `punycode.ucs2.encode`
  8780. * @see <https://mathiasbynens.be/notes/javascript-encoding>
  8781. * @memberOf punycode.ucs2
  8782. * @name decode
  8783. * @param {String} string The Unicode input string (UCS-2).
  8784. * @returns {Array} The new array of code points.
  8785. */
  8786. function ucs2decode(string) {
  8787. var output = [],
  8788. counter = 0,
  8789. length = string.length,
  8790. value,
  8791. extra;
  8792. while (counter < length) {
  8793. value = string.charCodeAt(counter++);
  8794. if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
  8795. // high surrogate, and there is a next character
  8796. extra = string.charCodeAt(counter++);
  8797. if ((extra & 0xFC00) == 0xDC00) { // low surrogate
  8798. output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
  8799. } else {
  8800. // unmatched surrogate; only append this code unit, in case the next
  8801. // code unit is the high surrogate of a surrogate pair
  8802. output.push(value);
  8803. counter--;
  8804. }
  8805. } else {
  8806. output.push(value);
  8807. }
  8808. }
  8809. return output;
  8810. }
  8811. /**
  8812. * Creates a string based on an array of numeric code points.
  8813. * @see `punycode.ucs2.decode`
  8814. * @memberOf punycode.ucs2
  8815. * @name encode
  8816. * @param {Array} codePoints The array of numeric code points.
  8817. * @returns {String} The new Unicode string (UCS-2).
  8818. */
  8819. function ucs2encode(array) {
  8820. return map(array, function(value) {
  8821. var output = '';
  8822. if (value > 0xFFFF) {
  8823. value -= 0x10000;
  8824. output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
  8825. value = 0xDC00 | value & 0x3FF;
  8826. }
  8827. output += stringFromCharCode(value);
  8828. return output;
  8829. }).join('');
  8830. }
  8831. /**
  8832. * Converts a basic code point into a digit/integer.
  8833. * @see `digitToBasic()`
  8834. * @private
  8835. * @param {Number} codePoint The basic numeric code point value.
  8836. * @returns {Number} The numeric value of a basic code point (for use in
  8837. * representing integers) in the range `0` to `base - 1`, or `base` if
  8838. * the code point does not represent a value.
  8839. */
  8840. function basicToDigit(codePoint) {
  8841. if (codePoint - 48 < 10) {
  8842. return codePoint - 22;
  8843. }
  8844. if (codePoint - 65 < 26) {
  8845. return codePoint - 65;
  8846. }
  8847. if (codePoint - 97 < 26) {
  8848. return codePoint - 97;
  8849. }
  8850. return base;
  8851. }
  8852. /**
  8853. * Converts a digit/integer into a basic code point.
  8854. * @see `basicToDigit()`
  8855. * @private
  8856. * @param {Number} digit The numeric value of a basic code point.
  8857. * @returns {Number} The basic code point whose value (when used for
  8858. * representing integers) is `digit`, which needs to be in the range
  8859. * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
  8860. * used; else, the lowercase form is used. The behavior is undefined
  8861. * if `flag` is non-zero and `digit` has no uppercase form.
  8862. */
  8863. function digitToBasic(digit, flag) {
  8864. // 0..25 map to ASCII a..z or A..Z
  8865. // 26..35 map to ASCII 0..9
  8866. return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
  8867. }
  8868. /**
  8869. * Bias adaptation function as per section 3.4 of RFC 3492.
  8870. * https://tools.ietf.org/html/rfc3492#section-3.4
  8871. * @private
  8872. */
  8873. function adapt(delta, numPoints, firstTime) {
  8874. var k = 0;
  8875. delta = firstTime ? floor(delta / damp) : delta >> 1;
  8876. delta += floor(delta / numPoints);
  8877. for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
  8878. delta = floor(delta / baseMinusTMin);
  8879. }
  8880. return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
  8881. }
  8882. /**
  8883. * Converts a Punycode string of ASCII-only symbols to a string of Unicode
  8884. * symbols.
  8885. * @memberOf punycode
  8886. * @param {String} input The Punycode string of ASCII-only symbols.
  8887. * @returns {String} The resulting string of Unicode symbols.
  8888. */
  8889. function decode(input) {
  8890. // Don't use UCS-2
  8891. var output = [],
  8892. inputLength = input.length,
  8893. out,
  8894. i = 0,
  8895. n = initialN,
  8896. bias = initialBias,
  8897. basic,
  8898. j,
  8899. index,
  8900. oldi,
  8901. w,
  8902. k,
  8903. digit,
  8904. t,
  8905. /** Cached calculation results */
  8906. baseMinusT;
  8907. // Handle the basic code points: let `basic` be the number of input code
  8908. // points before the last delimiter, or `0` if there is none, then copy
  8909. // the first basic code points to the output.
  8910. basic = input.lastIndexOf(delimiter);
  8911. if (basic < 0) {
  8912. basic = 0;
  8913. }
  8914. for (j = 0; j < basic; ++j) {
  8915. // if it's not a basic code point
  8916. if (input.charCodeAt(j) >= 0x80) {
  8917. error('not-basic');
  8918. }
  8919. output.push(input.charCodeAt(j));
  8920. }
  8921. // Main decoding loop: start just after the last delimiter if any basic code
  8922. // points were copied; start at the beginning otherwise.
  8923. for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
  8924. // `index` is the index of the next character to be consumed.
  8925. // Decode a generalized variable-length integer into `delta`,
  8926. // which gets added to `i`. The overflow checking is easier
  8927. // if we increase `i` as we go, then subtract off its starting
  8928. // value at the end to obtain `delta`.
  8929. for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
  8930. if (index >= inputLength) {
  8931. error('invalid-input');
  8932. }
  8933. digit = basicToDigit(input.charCodeAt(index++));
  8934. if (digit >= base || digit > floor((maxInt - i) / w)) {
  8935. error('overflow');
  8936. }
  8937. i += digit * w;
  8938. t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
  8939. if (digit < t) {
  8940. break;
  8941. }
  8942. baseMinusT = base - t;
  8943. if (w > floor(maxInt / baseMinusT)) {
  8944. error('overflow');
  8945. }
  8946. w *= baseMinusT;
  8947. }
  8948. out = output.length + 1;
  8949. bias = adapt(i - oldi, out, oldi == 0);
  8950. // `i` was supposed to wrap around from `out` to `0`,
  8951. // incrementing `n` each time, so we'll fix that now:
  8952. if (floor(i / out) > maxInt - n) {
  8953. error('overflow');
  8954. }
  8955. n += floor(i / out);
  8956. i %= out;
  8957. // Insert `n` at position `i` of the output
  8958. output.splice(i++, 0, n);
  8959. }
  8960. return ucs2encode(output);
  8961. }
  8962. /**
  8963. * Converts a string of Unicode symbols (e.g. a domain name label) to a
  8964. * Punycode string of ASCII-only symbols.
  8965. * @memberOf punycode
  8966. * @param {String} input The string of Unicode symbols.
  8967. * @returns {String} The resulting Punycode string of ASCII-only symbols.
  8968. */
  8969. function encode(input) {
  8970. var n,
  8971. delta,
  8972. handledCPCount,
  8973. basicLength,
  8974. bias,
  8975. j,
  8976. m,
  8977. q,
  8978. k,
  8979. t,
  8980. currentValue,
  8981. output = [],
  8982. /** `inputLength` will hold the number of code points in `input`. */
  8983. inputLength,
  8984. /** Cached calculation results */
  8985. handledCPCountPlusOne,
  8986. baseMinusT,
  8987. qMinusT;
  8988. // Convert the input in UCS-2 to Unicode
  8989. input = ucs2decode(input);
  8990. // Cache the length
  8991. inputLength = input.length;
  8992. // Initialize the state
  8993. n = initialN;
  8994. delta = 0;
  8995. bias = initialBias;
  8996. // Handle the basic code points
  8997. for (j = 0; j < inputLength; ++j) {
  8998. currentValue = input[j];
  8999. if (currentValue < 0x80) {
  9000. output.push(stringFromCharCode(currentValue));
  9001. }
  9002. }
  9003. handledCPCount = basicLength = output.length;
  9004. // `handledCPCount` is the number of code points that have been handled;
  9005. // `basicLength` is the number of basic code points.
  9006. // Finish the basic string - if it is not empty - with a delimiter
  9007. if (basicLength) {
  9008. output.push(delimiter);
  9009. }
  9010. // Main encoding loop:
  9011. while (handledCPCount < inputLength) {
  9012. // All non-basic code points < n have been handled already. Find the next
  9013. // larger one:
  9014. for (m = maxInt, j = 0; j < inputLength; ++j) {
  9015. currentValue = input[j];
  9016. if (currentValue >= n && currentValue < m) {
  9017. m = currentValue;
  9018. }
  9019. }
  9020. // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
  9021. // but guard against overflow
  9022. handledCPCountPlusOne = handledCPCount + 1;
  9023. if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
  9024. error('overflow');
  9025. }
  9026. delta += (m - n) * handledCPCountPlusOne;
  9027. n = m;
  9028. for (j = 0; j < inputLength; ++j) {
  9029. currentValue = input[j];
  9030. if (currentValue < n && ++delta > maxInt) {
  9031. error('overflow');
  9032. }
  9033. if (currentValue == n) {
  9034. // Represent delta as a generalized variable-length integer
  9035. for (q = delta, k = base; /* no condition */; k += base) {
  9036. t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
  9037. if (q < t) {
  9038. break;
  9039. }
  9040. qMinusT = q - t;
  9041. baseMinusT = base - t;
  9042. output.push(
  9043. stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
  9044. );
  9045. q = floor(qMinusT / baseMinusT);
  9046. }
  9047. output.push(stringFromCharCode(digitToBasic(q, 0)));
  9048. bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
  9049. delta = 0;
  9050. ++handledCPCount;
  9051. }
  9052. }
  9053. ++delta;
  9054. ++n;
  9055. }
  9056. return output.join('');
  9057. }
  9058. /**
  9059. * Converts a Punycode string representing a domain name or an email address
  9060. * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
  9061. * it doesn't matter if you call it on a string that has already been
  9062. * converted to Unicode.
  9063. * @memberOf punycode
  9064. * @param {String} input The Punycoded domain name or email address to
  9065. * convert to Unicode.
  9066. * @returns {String} The Unicode representation of the given Punycode
  9067. * string.
  9068. */
  9069. function toUnicode(input) {
  9070. return mapDomain(input, function(string) {
  9071. return regexPunycode.test(string)
  9072. ? decode(string.slice(4).toLowerCase())
  9073. : string;
  9074. });
  9075. }
  9076. /**
  9077. * Converts a Unicode string representing a domain name or an email address to
  9078. * Punycode. Only the non-ASCII parts of the domain name will be converted,
  9079. * i.e. it doesn't matter if you call it with a domain that's already in
  9080. * ASCII.
  9081. * @memberOf punycode
  9082. * @param {String} input The domain name or email address to convert, as a
  9083. * Unicode string.
  9084. * @returns {String} The Punycode representation of the given domain name or
  9085. * email address.
  9086. */
  9087. function toASCII(input) {
  9088. return mapDomain(input, function(string) {
  9089. return regexNonASCII.test(string)
  9090. ? 'xn--' + encode(string)
  9091. : string;
  9092. });
  9093. }
  9094. /*--------------------------------------------------------------------------*/
  9095. /** Define the public API */
  9096. punycode = {
  9097. /**
  9098. * A string representing the current Punycode.js version number.
  9099. * @memberOf punycode
  9100. * @type String
  9101. */
  9102. 'version': '1.4.1',
  9103. /**
  9104. * An object of methods to convert from JavaScript's internal character
  9105. * representation (UCS-2) to Unicode code points, and back.
  9106. * @see <https://mathiasbynens.be/notes/javascript-encoding>
  9107. * @memberOf punycode
  9108. * @type Object
  9109. */
  9110. 'ucs2': {
  9111. 'decode': ucs2decode,
  9112. 'encode': ucs2encode
  9113. },
  9114. 'decode': decode,
  9115. 'encode': encode,
  9116. 'toASCII': toASCII,
  9117. 'toUnicode': toUnicode
  9118. };
  9119. /** Expose `punycode` */
  9120. // Some AMD build optimizers, like r.js, check for specific condition patterns
  9121. // like the following:
  9122. if (
  9123. true
  9124. ) {
  9125. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  9126. return punycode;
  9127. }).call(exports, __webpack_require__, exports, module),
  9128. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  9129. } else if (freeExports && freeModule) {
  9130. if (module.exports == freeExports) {
  9131. // in Node.js, io.js, or RingoJS v0.8.0+
  9132. freeModule.exports = punycode;
  9133. } else {
  9134. // in Narwhal or RingoJS v0.7.0-
  9135. for (key in punycode) {
  9136. punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
  9137. }
  9138. }
  9139. } else {
  9140. // in Rhino or a web browser
  9141. root.punycode = punycode;
  9142. }
  9143. }(this));
  9144. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(81)(module), __webpack_require__(2)))
  9145. /***/ }),
  9146. /* 81 */
  9147. /***/ (function(module, exports) {
  9148. module.exports = function(module) {
  9149. if(!module.webpackPolyfill) {
  9150. module.deprecate = function() {};
  9151. module.paths = [];
  9152. // module.parent = undefined by default
  9153. if(!module.children) module.children = [];
  9154. Object.defineProperty(module, "loaded", {
  9155. enumerable: true,
  9156. get: function() {
  9157. return module.l;
  9158. }
  9159. });
  9160. Object.defineProperty(module, "id", {
  9161. enumerable: true,
  9162. get: function() {
  9163. return module.i;
  9164. }
  9165. });
  9166. module.webpackPolyfill = 1;
  9167. }
  9168. return module;
  9169. };
  9170. /***/ }),
  9171. /* 82 */
  9172. /***/ (function(module, exports, __webpack_require__) {
  9173. "use strict";
  9174. // markdown-it default options
  9175. module.exports = {
  9176. options: {
  9177. html: false, // Enable HTML tags in source
  9178. xhtmlOut: false, // Use '/' to close single tags (<br />)
  9179. breaks: false, // Convert '\n' in paragraphs into <br>
  9180. langPrefix: 'language-', // CSS language prefix for fenced blocks
  9181. linkify: false, // autoconvert URL-like texts to links
  9182. // Enable some language-neutral replacements + quotes beautification
  9183. typographer: false,
  9184. // Double + single quotes replacement pairs, when typographer enabled,
  9185. // and smartquotes on. Could be either a String or an Array.
  9186. //
  9187. // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
  9188. // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
  9189. quotes: '\u201c\u201d\u2018\u2019', /* “”‘’ */
  9190. // Highlighter function. Should return escaped HTML,
  9191. // or '' if the source string is not changed and should be escaped externaly.
  9192. // If result starts with <pre... internal wrapper is skipped.
  9193. //
  9194. // function (/*str, lang*/) { return ''; }
  9195. //
  9196. highlight: null,
  9197. maxNesting: 100 // Internal protection, recursion limit
  9198. },
  9199. components: {
  9200. core: {},
  9201. block: {},
  9202. inline: {}
  9203. }
  9204. };
  9205. /***/ }),
  9206. /* 83 */
  9207. /***/ (function(module, exports, __webpack_require__) {
  9208. "use strict";
  9209. // "Zero" preset, with nothing enabled. Useful for manual configuring of simple
  9210. // modes. For example, to parse bold/italic only.
  9211. module.exports = {
  9212. options: {
  9213. html: false, // Enable HTML tags in source
  9214. xhtmlOut: false, // Use '/' to close single tags (<br />)
  9215. breaks: false, // Convert '\n' in paragraphs into <br>
  9216. langPrefix: 'language-', // CSS language prefix for fenced blocks
  9217. linkify: false, // autoconvert URL-like texts to links
  9218. // Enable some language-neutral replacements + quotes beautification
  9219. typographer: false,
  9220. // Double + single quotes replacement pairs, when typographer enabled,
  9221. // and smartquotes on. Could be either a String or an Array.
  9222. //
  9223. // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
  9224. // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
  9225. quotes: '\u201c\u201d\u2018\u2019', /* “”‘’ */
  9226. // Highlighter function. Should return escaped HTML,
  9227. // or '' if the source string is not changed and should be escaped externaly.
  9228. // If result starts with <pre... internal wrapper is skipped.
  9229. //
  9230. // function (/*str, lang*/) { return ''; }
  9231. //
  9232. highlight: null,
  9233. maxNesting: 20 // Internal protection, recursion limit
  9234. },
  9235. components: {
  9236. core: {
  9237. rules: [
  9238. 'normalize',
  9239. 'block',
  9240. 'inline'
  9241. ]
  9242. },
  9243. block: {
  9244. rules: [
  9245. 'paragraph'
  9246. ]
  9247. },
  9248. inline: {
  9249. rules: [
  9250. 'text'
  9251. ],
  9252. rules2: [
  9253. 'balance_pairs',
  9254. 'text_collapse'
  9255. ]
  9256. }
  9257. }
  9258. };
  9259. /***/ }),
  9260. /* 84 */
  9261. /***/ (function(module, exports, __webpack_require__) {
  9262. "use strict";
  9263. // Commonmark default options
  9264. module.exports = {
  9265. options: {
  9266. html: true, // Enable HTML tags in source
  9267. xhtmlOut: true, // Use '/' to close single tags (<br />)
  9268. breaks: false, // Convert '\n' in paragraphs into <br>
  9269. langPrefix: 'language-', // CSS language prefix for fenced blocks
  9270. linkify: false, // autoconvert URL-like texts to links
  9271. // Enable some language-neutral replacements + quotes beautification
  9272. typographer: false,
  9273. // Double + single quotes replacement pairs, when typographer enabled,
  9274. // and smartquotes on. Could be either a String or an Array.
  9275. //
  9276. // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
  9277. // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
  9278. quotes: '\u201c\u201d\u2018\u2019', /* “”‘’ */
  9279. // Highlighter function. Should return escaped HTML,
  9280. // or '' if the source string is not changed and should be escaped externaly.
  9281. // If result starts with <pre... internal wrapper is skipped.
  9282. //
  9283. // function (/*str, lang*/) { return ''; }
  9284. //
  9285. highlight: null,
  9286. maxNesting: 20 // Internal protection, recursion limit
  9287. },
  9288. components: {
  9289. core: {
  9290. rules: [
  9291. 'normalize',
  9292. 'block',
  9293. 'inline'
  9294. ]
  9295. },
  9296. block: {
  9297. rules: [
  9298. 'blockquote',
  9299. 'code',
  9300. 'fence',
  9301. 'heading',
  9302. 'hr',
  9303. 'html_block',
  9304. 'lheading',
  9305. 'list',
  9306. 'reference',
  9307. 'paragraph'
  9308. ]
  9309. },
  9310. inline: {
  9311. rules: [
  9312. 'autolink',
  9313. 'backticks',
  9314. 'emphasis',
  9315. 'entity',
  9316. 'escape',
  9317. 'html_inline',
  9318. 'image',
  9319. 'link',
  9320. 'newline',
  9321. 'text'
  9322. ],
  9323. rules2: [
  9324. 'balance_pairs',
  9325. 'emphasis',
  9326. 'text_collapse'
  9327. ]
  9328. }
  9329. }
  9330. };
  9331. /***/ }),
  9332. /* 85 */
  9333. /***/ (function(module, exports, __webpack_require__) {
  9334. var m = __webpack_require__(1);
  9335. // https://github.com/markdown-it/markdown-it
  9336. var markdown = __webpack_require__(4)()
  9337. .use(__webpack_require__(8));
  9338. var _dbs = __webpack_require__(3);
  9339. // var _Header = require('./header');
  9340. // var _Footer = require('./footer');
  9341. var _Ui = __webpack_require__(20);
  9342. // __ _ __
  9343. // / / (_)___ / /__
  9344. // / / / / __ \/ //_/
  9345. // / /___/ / / / / ,<
  9346. // /_____/_/_/ /_/_/|_|
  9347. var _Link = {
  9348. parent_id:null,
  9349. tid:"",
  9350. opened:false,
  9351. oninit(vn){
  9352. // console.log("INIT LINK : vn", vn);
  9353. // define target id
  9354. this.tid = vn.attrs.href;
  9355. },
  9356. onbeforeupdate(vn){
  9357. this.tid = vn.attrs.href;
  9358. },
  9359. view(vn){
  9360. this.tid_known = typeof _dbs.data_byid[_dbs.lang][this.tid] === 'undefined' ? false : true;
  9361. if (!this.tid_known) {
  9362. // console.log(`!! in ${this.id}, target id ${this.tid} is unkonwn !!`);
  9363. }
  9364. if(this.opened && this.tid_known){
  9365. // console.log('this.tid', vn.state);
  9366. // traget object
  9367. this.tob = Object.assign({"nested":true},_dbs.data_byid[_dbs.lang][this.tid]);
  9368. return m('div', {'class':'opened-link'},
  9369. [
  9370. m('span', {'class':"link text"}, vn.children),
  9371. m('div', {
  9372. 'class':'close-link-btn',
  9373. onclick(e){
  9374. // e.preventDefault();
  9375. console.log('click close btn', this);
  9376. vn.state.opened = false;
  9377. // return false;
  9378. }
  9379. }),//, m('span', m.trust("&#128473;"))),
  9380. typeof _dbs.data_byid[_dbs.lang][this.tid].childs != "undefined"
  9381. ? m(_Enonce, this.tob)
  9382. : m(_Item, this.tob)
  9383. ]
  9384. );
  9385. }else{
  9386. // console.log(vn);
  9387. return m('a', {
  9388. 'class':'link',
  9389. 'href':'#'+this.tid,
  9390. 'rel':this.tid,
  9391. onclick(e){
  9392. e.preventDefault();
  9393. console.log('click', this);
  9394. vn.state.opened = true;
  9395. return false;
  9396. }
  9397. }, vn.children); // c'est quoi ce vn.children ?
  9398. }
  9399. }
  9400. }
  9401. // ______ __
  9402. // /_ __/__ _ __/ /_
  9403. // / / / _ \| |/_/ __/
  9404. // / / / __/> </ /_
  9405. // /_/ \___/_/|_|\__/
  9406. // recusive function to record information of all subnodes
  9407. function parseTextDom(nodes){
  9408. var list = [];
  9409. // loop through childNodes
  9410. for (var i = 0; i < nodes.length; i++) {
  9411. var n = {};
  9412. if(typeof nodes[i].localName != "undefined"){
  9413. n.tag=nodes[i].localName;
  9414. if (n.tag == 'p') {
  9415. // replace p by div as we will insert other div in them
  9416. n.tag = 'div';
  9417. n.attrs = {'class':'paragraph'};
  9418. }
  9419. if (n.tag == 'a') {
  9420. // record the href attribute for cross reference
  9421. n.attrs = {'href':nodes[i].attributes.href.value};
  9422. }
  9423. if (n.tag == 'img') {
  9424. // record the href attribute for cross reference
  9425. n.attrs = {
  9426. 'src':nodes[i].attributes.src.value,
  9427. 'alt':nodes[i].attributes.alt.value
  9428. };
  9429. }
  9430. if(nodes[i].childNodes.length){
  9431. // again parse node's childs
  9432. n.childs = parseTextDom(nodes[i].childNodes);
  9433. }
  9434. }else if (nodes[i].textContent.length > 0){
  9435. // if node has no localName it is probably a #text node
  9436. // we record it if it's not empty
  9437. n.tag='#text';
  9438. n.text=nodes[i].textContent;
  9439. }
  9440. // add the node to the list if it has a tag
  9441. if(typeof n.tag != "undefined")
  9442. list.push(n);
  9443. }
  9444. return list;
  9445. }
  9446. // recusive fucntion to generate mithril object from information recorded with parseTextDom()
  9447. function populateTextDom(n,i){
  9448. // console.log('populateTextDom : '+i,n);
  9449. return n.tag == "#text"
  9450. ? m.trust(n.text)
  9451. : m(
  9452. n.tag != 'a' ? n.tag : _Link,
  9453. typeof n.attrs != "undefined" ? n.attrs : {},
  9454. typeof n.childs != "undefined"
  9455. ? n.childs.map(populateTextDom)
  9456. : typeof n.text != "undefined"
  9457. ? m.trust(n.text)
  9458. : null
  9459. );
  9460. }
  9461. var _Text = {
  9462. id:null,
  9463. text:"",
  9464. texthtml:"",
  9465. textdom:null,
  9466. textchilds:[],
  9467. parsetext(){
  9468. // console.log('parsetext', this);
  9469. // !! we need to convert markdown to html here because parseTextDom() is recursive through nodes tree
  9470. // convert markdown to html
  9471. this.texthtml = markdown.render(this.text)
  9472. // convert html string to virtual dom
  9473. this.textdom = new DOMParser().parseFromString(this.texthtml, "text/html");
  9474. // get the text nodes (avoid html document extra) and apply some transformations
  9475. this.textchilds = parseTextDom(this.textdom.getElementsByTagName('body')[0].childNodes);
  9476. },
  9477. oninit(vn){
  9478. this.id = vn.attrs.id;
  9479. this.text = vn.attrs.text || "";
  9480. this.parsetext();
  9481. },
  9482. onbeforeupdate(vn,old){
  9483. this.text = vn.attrs.text;
  9484. this.parsetext();
  9485. },
  9486. view(vn){
  9487. // console.log('_Text :: view : '+vn.attrs.slug, vn);
  9488. return m('div',
  9489. {'class':'text'},
  9490. // loop through childNodes list generated by parseTextDom() in init
  9491. this.textchilds.map(populateTextDom)
  9492. ); // /m.div.text
  9493. } // view:
  9494. }
  9495. // ______
  9496. // / _/ /____ ____ ___
  9497. // / // __/ _ \/ __ `__ \
  9498. // _/ // /_/ __/ / / / / /
  9499. // /___/\__/\___/_/ /_/ /_/
  9500. var _Item = {
  9501. id:null,
  9502. part:null,
  9503. type:null,
  9504. nested:false,
  9505. oninit(vn){
  9506. // console.log('vn.attrs', vn.attrs);
  9507. this.id = vn.attrs.id;
  9508. this.type = vn.attrs.type;
  9509. // vn.state.part = vn.state.slug.match(/^(\d)(.+)/)[1];
  9510. this.text = vn.attrs.text;
  9511. this.nested = vn.attrs.nested || false;
  9512. this.dottype = vn.attrs.dottype || null;
  9513. },
  9514. onbeforeupdate(vn, old){
  9515. this.nested = vn.attrs.nested || false;
  9516. this.type = vn.attrs.type;
  9517. this.text = vn.attrs.text;
  9518. },
  9519. view(vn){
  9520. // if(this.id == "340c2"){
  9521. // console.log(`${this.id} vn.attrs `,vn.attrs);
  9522. // }
  9523. return m("section", {
  9524. 'id':this.id,
  9525. // 'class':'item'+(this.nested ? ' nested':'')
  9526. 'class' :`item${this.nested ? ' nested':''} ${this.dottype}`
  9527. },
  9528. [
  9529. // create title node (only if not nested)
  9530. !this.nested
  9531. ? m("h3", {
  9532. // 'ref':vn.attrs.href,
  9533. // onclick(e){ WHAT IS THIS STATE ACTIVE ???
  9534. // vn.state.active = vn.state.active ? 0 : 1;
  9535. // }
  9536. }, m.trust(markdown.renderInline(this.type)))
  9537. : null,
  9538. // create text node
  9539. m(_Text, {'text':this.text, 'id':this.id}),
  9540. // add children (only if not nested)
  9541. // typeof vn.attrs.childs !== 'undefined' && !this.nested
  9542. // ? vn.attrs.childs.map(c => { return m(_Item, c); })
  9543. // : null
  9544. ]
  9545. )
  9546. }
  9547. };
  9548. // ______
  9549. // / ____/___ ____ ____ ________
  9550. // / __/ / __ \/ __ \/ __ \/ ___/ _ \
  9551. // / /___/ / / / /_/ / / / / /__/ __/
  9552. // /_____/_/ /_/\____/_/ /_/\___/\___/
  9553. var _Enonce = {
  9554. partid:null,
  9555. id:null,
  9556. title:null,
  9557. text:null,
  9558. nested:false,
  9559. childs:[],
  9560. oninit(vn){
  9561. // // console.log('Enonce on init', vn);
  9562. this.partid = vn.attrs.partid;
  9563. this.id = vn.attrs.id;
  9564. this.title = vn.attrs.title || "";
  9565. this.text = vn.attrs.text;
  9566. this.childs = vn.attrs.childs || [];
  9567. this.nested = vn.attrs.nested || false;
  9568. this.dottype = vn.attrs.dottype || "no-dottype";
  9569. },
  9570. onbeforeupdate(vn, old) {
  9571. // console.log(vn.attrs.childs);
  9572. this.title = vn.attrs.title || "";
  9573. this.text = vn.attrs.text;
  9574. this.childs = vn.attrs.childs || [];
  9575. this.nested = vn.attrs.nested || false;
  9576. // if(vn.attrs.id == '1d1') console.log('_Enonce UPDATE, text :', vn.attrs.text);
  9577. },
  9578. view(vn){
  9579. // if(vn.attrs.id == '1d1') console.log('_Enonce VIEW, text :', vn.attrs.text);
  9580. return m("section", {
  9581. 'id' :this.id,
  9582. 'class' :`enonce${this.nested ? ' nested':''} ${this.dottype}`
  9583. },
  9584. [
  9585. // create title node (only if not nested)
  9586. !this.nested ? m("h2", {}, m.trust(markdown.renderInline(this.title))) : null,
  9587. // create text node
  9588. m(_Text, {'text':this.text, 'id':this.id}),
  9589. // add children (only if not nested)
  9590. typeof this.childs !== 'undefined' && !this.nested
  9591. ? this.childs.map(c => { return m(_Item, c); })
  9592. : null
  9593. ])
  9594. }
  9595. }
  9596. // ____ __
  9597. // / __ \____ ______/ /_
  9598. // / /_/ / __ `/ ___/ __/
  9599. // / ____/ /_/ / / / /_
  9600. // /_/ \__,_/_/ \__/
  9601. var _Part = {
  9602. oninit(vn){
  9603. // this.id = vn.attrs.id;
  9604. // this.title = vn.attrs.title || '';
  9605. // this.enonces = vn.attrs.enonces;
  9606. },
  9607. onbeforeupdate(vn, old){
  9608. // console.log('_Part, onbeforeupdate old',old);
  9609. // this.title = vn.attrs.title || '';
  9610. // this.enonces = vn.attrs.enonces;
  9611. },
  9612. view(vn){
  9613. // console.log("part enonces", vn.attrs.enonces);
  9614. return m("section", {
  9615. 'id' :vn.attrs.id,
  9616. 'class' :'part'
  9617. },
  9618. [
  9619. // create title node
  9620. m("h1", {'class':'part-title', 'part':vn.attrs.id}, m.trust(markdown.renderInline(vn.attrs.title))),
  9621. // create text node
  9622. vn.attrs.enonces.map(e => {
  9623. // console.log(e.title +" - "+ e.type);
  9624. // var title = e.title || '';
  9625. switch (e.type) {
  9626. case "title":
  9627. // handle titles
  9628. // console.log('title');
  9629. return m("h2", {'class':'title'}, m.trust(markdown.renderInline(e.title)));
  9630. break;
  9631. case "filet":
  9632. // handle filets
  9633. // console.log('filet');
  9634. return m("h4", {'class':'filet'}, m.trust(markdown.renderInline(e.title)));
  9635. break;
  9636. default:
  9637. // or build structure
  9638. return m(_Enonce, Object.assign({"partid":vn.attrs.id},e));
  9639. }
  9640. })
  9641. ]
  9642. )
  9643. }
  9644. }
  9645. // ____ __
  9646. // / _/___ / /__________
  9647. // / // __ \/ __/ ___/ __ \
  9648. // _/ // / / / /_/ / / /_/ /
  9649. // /___/_/ /_/\__/_/ \____/
  9650. var _Intro = {
  9651. oninit(vn){
  9652. // console.log('_Intro : oninit : vn', vn);
  9653. this.id = vn.attrs.id;
  9654. this.text = vn.attrs.text || '';
  9655. },
  9656. onbeforeupdate(vn, old){
  9657. this.id = vn.attrs.id;
  9658. this.text = vn.attrs.text || '';
  9659. },
  9660. view(vn){
  9661. return m("section", {'class':'intro'}, m("p",m.trust(markdown.renderInline(this.text))));
  9662. }
  9663. }
  9664. // ______ __
  9665. // /_ __/__ _ __/ /_
  9666. // / / / _ \| |/_/ __/
  9667. // / / / __/> </ /_
  9668. // /_/ \___/_/|_|\__/
  9669. module.exports = {
  9670. // oninit(vn){
  9671. // // this.lang = vn.attrs.lang;
  9672. // console.log('ModeText oninit : lang', vn.attrs.lang);
  9673. // // i18next.changeLanguage(vn.attrs.lang);
  9674. // },
  9675. oncreate(vn){
  9676. document.body.classList.add('mode-text');
  9677. _Ui.init();
  9678. },
  9679. // onbeforeupdate(vn, old){
  9680. // console.log('ModeText onbeforeupdate : lang', vn.attrs.lang);
  9681. // // i18next.changeLanguage(vn.attrs.lang);
  9682. // },
  9683. view(vn){
  9684. // console.log('_ModeText view : _dbs.data', _dbs.data);
  9685. return m('main', {id:"content", 'class':'mode-text'}, _dbs.data[vn.attrs.lang].map((p) => {
  9686. // console.log("MAP _dbs", p);
  9687. if(p.id == 'intro'){
  9688. return m(_Intro,p);
  9689. }else{
  9690. return m(_Part,p);
  9691. }
  9692. })
  9693. );
  9694. }
  9695. }
  9696. /***/ }),
  9697. /* 86 */
  9698. /***/ (function(module, exports, __webpack_require__) {
  9699. var m = __webpack_require__(1);
  9700. // https://github.com/markdown-it/markdown-it
  9701. var markdown = __webpack_require__(4)()
  9702. .use(__webpack_require__(8));
  9703. var _dbs = __webpack_require__(3);
  9704. var _Header = __webpack_require__(10);
  9705. var _Footer = __webpack_require__(19);
  9706. var _Ui = __webpack_require__(20);
  9707. // ____ __
  9708. // / __ \____ / /_
  9709. // / / / / __ \/ __/
  9710. // / /_/ / /_/ / /_
  9711. // /_____/\____/\__/
  9712. var _Dot = {
  9713. id:null,
  9714. dottype:null,
  9715. type:'',
  9716. title:'',
  9717. breadcrumb:'',
  9718. text:'',
  9719. summary:'',
  9720. active:true,
  9721. opened:0,
  9722. nested:false,
  9723. links:null,
  9724. parents:[],
  9725. lang:null,
  9726. setupTitle(vn){
  9727. this.title = vn.attrs.title;
  9728. if(!this.title) this.title = this.type;
  9729. if(this.title)
  9730. this.title = markdown.renderInline(this.title);
  9731. },
  9732. setuptext(vn){
  9733. // console.log('setuptext', vn);
  9734. // construct text
  9735. this.text = vn.attrs.text || '';
  9736. this.rendered_text = markdown.render(this.text);
  9737. if(this.dottype == "preface"){
  9738. this.summary = this.rendered_text;
  9739. }else{
  9740. // construct summary
  9741. // TODO: summary needs more work (strip tags, markdown render)
  9742. // remove img
  9743. this.summary = this.text.replace(/!\[[^\]]+\]\([^\)]+\)/g, "");
  9744. // get portion of text
  9745. this.summary = this.summary.match('([^ ]*[ ]{0,1}){1,6}')[0];
  9746. // end underscores (italic) splited by summarizing
  9747. this.summary = this.summary.trim().replace(/_([^_]+)$/g, "_$1_");
  9748. // remove brackets (links) splited by summarizing
  9749. this.summary = this.summary.replace(/\[([^\]]+)$/g, "$1");
  9750. // render the markdown
  9751. this.summary = markdown.renderInline(this.summary) + "&nbsp;…";
  9752. }
  9753. },
  9754. oninit(vn){
  9755. this.id = vn.attrs.id;
  9756. this.type = vn.attrs.type;
  9757. this.level = vn.attrs.level;
  9758. this.dottype = vn.attrs.dottype;
  9759. this.breadcrumb = vn.attrs.breadcrumb;
  9760. // console.log(`${this.id} -> ${this.dottype}`);
  9761. if(typeof vn.attrs.active !== 'undefined')
  9762. this.active = vn.attrs.active;
  9763. // links
  9764. this.links = _dbs.data_strct[this.id];
  9765. // parents memorize where do we come from to avoid duplicates and looping nav
  9766. if(vn.attrs.parents){
  9767. this.parents = this.parents.concat(vn.attrs.parents);
  9768. // console.log('_Dot init '+this.id+' parents :',this.parents);
  9769. }
  9770. this.nested = this.parents.length ? true : false;
  9771. // if(this.nested) console.log(`oninit ${this.id}`);
  9772. this.lang = vn.attrs.lang;
  9773. this.setupTitle(vn);
  9774. this.setuptext(vn);
  9775. },
  9776. oncreate(vn){
  9777. if(this.active){
  9778. vn.dom.classList.remove('disabled');
  9779. }else{
  9780. vn.dom.classList.add('disabled');
  9781. }
  9782. },
  9783. onbeforeupdate(vn){
  9784. if(this.lang != vn.attrs.lang){
  9785. this.lang = vn.attrs.lang;
  9786. this.breadcrumb = vn.attrs.breadcrumb;
  9787. this.type = vn.attrs.type;
  9788. this.setuptext(vn);
  9789. this.setupTitle(vn);
  9790. }
  9791. },
  9792. onupdate(vn){
  9793. // if(this.nested) console.log(`onupdate ${this.id}`);
  9794. if(this.active){
  9795. if (this.opened){
  9796. vn.dom.classList.add('opened');
  9797. if(this.links.to.length)
  9798. vn.dom.classList.add('to-links');
  9799. if(this.links.from.length)
  9800. vn.dom.classList.add('from-links');
  9801. }else{
  9802. vn.dom.classList.remove('opened');
  9803. }
  9804. }
  9805. },
  9806. setupLinks(vn, c, links){
  9807. return m('nav', {'class':`links ${c}`}, links.map(id => {
  9808. // console.log(id);
  9809. if(typeof _dbs.data_byid[this.lang][id] !== 'undefined'){
  9810. var obj = _dbs.data_byid[this.lang][id];
  9811. // console.log('link to : obj', obj);
  9812. return m(_Dot, {
  9813. "id":id,
  9814. 'title':obj.title,
  9815. // TODO: translate breadcrumb
  9816. 'breadcrumb':obj.breadcrumb,
  9817. 'text':obj.text,
  9818. 'dottype':obj.dottype,
  9819. 'type':obj.type,
  9820. // passe the memory of crossed dots plus the current one
  9821. 'parents':vn.state.parents.concat([vn.state.id]),
  9822. // activate link only if not in parents (already went through it)
  9823. 'active':vn.state.parents.indexOf(id) == -1 ? true:false,
  9824. // 'nested':true,
  9825. 'lang':this.lang,
  9826. });
  9827. }
  9828. })
  9829. );
  9830. },
  9831. viewOpenedContent(vn){
  9832. return m('div', {
  9833. 'uid':this.id,
  9834. 'class':`dot ${this.dottype}${this.nested ? ' nested':''}`},
  9835. [
  9836. // links to
  9837. this.links.to.length
  9838. ? this.setupLinks(vn, 'to', this.links.to)
  9839. : null, // if no links to, add nothing
  9840. // close btn
  9841. m('div', {
  9842. 'class':'close-link-btn',
  9843. onclick(e){
  9844. vn.state.opened = 0;
  9845. }
  9846. }//, m('span') // , m.trust("&#128473;")
  9847. ),
  9848. // Title
  9849. m('span', {'class':'title'}, m.trust(this.nested ? this.breadcrumb : this.title)),
  9850. // full text
  9851. m('section', {
  9852. 'class':'text',
  9853. onmouseover(e){
  9854. e.preventDefault();
  9855. if(e.target.nodeName == "A" ){
  9856. let id = e.target.getAttribute("href");
  9857. // add highlight class
  9858. vn.dom.querySelector(`nav.links>div[uid="${id}"]`).classList.add('highlight');
  9859. }else{
  9860. // remove all hilight class
  9861. for (link of vn.dom.querySelectorAll('nav.links>div.dot')) {
  9862. link.classList.remove('highlight');
  9863. }
  9864. }
  9865. },
  9866. onclick(e){
  9867. e.preventDefault();
  9868. if(e.target.nodeName == "A" ){
  9869. let id = e.target.getAttribute("href");
  9870. vn.dom.querySelector(`nav.links>div[uid="${id}"]>.title`).click();
  9871. }
  9872. }
  9873. }, m.trust(this.rendered_text)
  9874. ),
  9875. // links from
  9876. this.links.from.length
  9877. ? this.setupLinks(vn, 'from', this.links.from)
  9878. : null, // if no links from, add nothing
  9879. ]
  9880. );
  9881. },
  9882. viewPreviewContent(vn){
  9883. return m('div', {
  9884. 'uid':this.id,
  9885. 'class':`dot ${this.dottype}${this.nested ? ' nested':''}`
  9886. },
  9887. [
  9888. // bullet
  9889. m('div', {'class':'bullet'}, m('span', m.trust('&#9899;'))),
  9890. m('span', {
  9891. 'class':'title',
  9892. onclick(e){
  9893. if(!vn.state.opened) vn.state.opened = 1;
  9894. }
  9895. }, m.trust(this.nested ? this.breadcrumb : this.title)),
  9896. m('p', {'class':'summary'}, m.trust(this.summary))
  9897. ]
  9898. );
  9899. },
  9900. view(vn){
  9901. return this.active && vn.state.opened
  9902. ? this.viewOpenedContent(vn) // full view of dot with linked dots
  9903. : this.viewPreviewContent(vn); // preview dot
  9904. }
  9905. }
  9906. /*
  9907. full list of black dotlikes from unicode
  9908. ● - &#9679; - Black Circle
  9909. ⏺ - &#9210; - Black Circle for Record
  9910. ⚫ - &#9899; - Medium Black Circle
  9911. ⬤ - &#11044; - Black Large Circle
  9912. ⧭ - &#10733; - Black Circle with Down Arrow
  9913. 🞄 - &#128900; - Black Slightly Small Circle
  9914. • - &#8226; - Bullet
  9915. ∙ - &#8729; - Bullet Operator
  9916. ⋅ - &#8901; - Dot Operator
  9917. 🌑 - &#127761; - New Moon Symbol
  9918. */
  9919. // _______ _ __ __
  9920. // / ___/ / (_) /__/ /
  9921. // / /__/ _ \/ / / _ /
  9922. // \___/_//_/_/_/\_,_/
  9923. var _Child = {
  9924. // oninit(vn){},
  9925. // onbeforeupdate(vn, old){},
  9926. view(vn){
  9927. return [
  9928. m(_Dot, vn.attrs),
  9929. // add children
  9930. typeof vn.attrs.childs !== 'undefined'
  9931. ? vn.attrs.childs.map(c => {
  9932. c.lang = vn.attrs.lang;
  9933. c.level = vn.attrs.level + 1;
  9934. return m(_Child, c);
  9935. })
  9936. : null
  9937. ];
  9938. }
  9939. };
  9940. // ______
  9941. // / ____/___ ____ ____ ________
  9942. // / __/ / __ \/ __ \/ __ \/ ___/ _ \
  9943. // / /___/ / / / /_/ / / / / /__/ __/
  9944. // /_____/_/ /_/\____/_/ /_/\___/\___/
  9945. var _Enonce = {
  9946. // oninit(vn){},
  9947. // onbeforeupdate(vn, old) {},
  9948. view(vn){
  9949. vn.attrs.level = 0;
  9950. return [
  9951. // create dot
  9952. m(_Dot, vn.attrs),
  9953. // addd children
  9954. vn.attrs.childs.map(c => {
  9955. c.lang = vn.attrs.lang;
  9956. c.level = 1;
  9957. return m(_Child, c);
  9958. })
  9959. ]
  9960. }
  9961. }
  9962. // ____ __
  9963. // / __ \____ ______/ /_
  9964. // / /_/ / __ `/ ___/ __/
  9965. // / ____/ /_/ / / / /_
  9966. // /_/ \__,_/_/ \__/
  9967. var _Part = {
  9968. oninit(vn){
  9969. this.id = vn.attrs.id;
  9970. this.title = vn.attrs.title || "";
  9971. },
  9972. onbeforeupdate(vn, old){
  9973. this.title = vn.attrs.title || "";
  9974. },
  9975. view(vn){
  9976. return m("section", {
  9977. 'id' :this.id,
  9978. 'class' :'part'
  9979. },
  9980. [
  9981. // create title node
  9982. m("h1", {'class':'part-title', 'part':this.id}, m.trust(markdown.renderInline(this.title))),
  9983. // create text node
  9984. vn.attrs.enonces.map(e => {
  9985. // console.log(e.text);
  9986. e.lang = vn.attrs.lang;
  9987. switch (e.type) {
  9988. case "title":
  9989. // handle titles
  9990. return m("h2", {'class':'title'}, m.trust(markdown.renderInline(e.title)));
  9991. break;
  9992. case "filet":
  9993. // handle filets
  9994. return m("h4", {'class':'filet'}, m.trust(markdown.renderInline(e.title)));
  9995. break;
  9996. default:
  9997. // or build structure
  9998. return m(_Enonce, Object.assign({"partid":this.id},e));
  9999. }
  10000. })
  10001. ]
  10002. )
  10003. }
  10004. }
  10005. // ____ __
  10006. // / _/___ / /__________
  10007. // / // __ \/ __/ ___/ __ \
  10008. // _/ // / / / /_/ / / /_/ /
  10009. // /___/_/ /_/\__/_/ \____/
  10010. var _Intro = {
  10011. oninit(vn){
  10012. console.log('_Intro : oninit : vn', vn);
  10013. this.id = vn.attrs.id;
  10014. this.text = vn.attrs.text || '';
  10015. },
  10016. onbeforeupdate(vn, old){
  10017. this.id = vn.attrs.id;
  10018. this.text = vn.attrs.text || '';
  10019. },
  10020. view(vn){
  10021. return m("section", {'class':'intro'}, m("p",m.trust(markdown.renderInline(this.text))));
  10022. }
  10023. }
  10024. // ______ __ _
  10025. // / ____/___ ____ ____ ___ _____/ /_(_)___ ____ _____
  10026. // / / / __ \/ __ \/ __ \/ _ \/ ___/ __/ / __ \/ __ \/ ___/
  10027. // / /___/ /_/ / / / / / / / __/ /__/ /_/ / /_/ / / / (__ )
  10028. // \____/\____/_/ /_/_/ /_/\___/\___/\__/_/\____/_/ /_/____/
  10029. module.exports = {
  10030. oncreate(vn){
  10031. document.body.classList.add('mode-connections');
  10032. _Ui.init();
  10033. },
  10034. onbeforeupdate(vn, old){
  10035. console.log('Connection, onbeforeupdate old',old, 'vn',vn);
  10036. },
  10037. view(vn){
  10038. console.log('_ModeConnections view', vn.attrs.lang);
  10039. return m('main', {id:"content", 'class':'mode-connections'}, _dbs.data[vn.attrs.lang].map(p => {
  10040. p.lang = vn.attrs.lang;
  10041. if(p.id == 'intro'){
  10042. return m(_Intro,p);
  10043. }else{
  10044. return m(_Part,p);
  10045. }
  10046. })
  10047. );
  10048. }
  10049. }
  10050. /***/ }),
  10051. /* 87 */
  10052. /***/ (function(module, exports) {
  10053. // removed by extract-text-webpack-plugin
  10054. /***/ })
  10055. /******/ ]);
  10056. //# sourceMappingURL=main.js.map