mditor.js 323 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517
  1. /*!
  2. * Mditor embed version 1.3.3
  3. * Homepage: http://mditor.com
  4. */
  5. /******/ (function(modules) { // webpackBootstrap
  6. /******/ // The module cache
  7. /******/ var installedModules = {};
  8. /******/
  9. /******/ // The require function
  10. /******/ function __webpack_require__(moduleId) {
  11. /******/
  12. /******/ // Check if module is in cache
  13. /******/ if(installedModules[moduleId])
  14. /******/ return installedModules[moduleId].exports;
  15. /******/
  16. /******/ // Create a new module (and put it into the cache)
  17. /******/ var module = installedModules[moduleId] = {
  18. /******/ exports: {},
  19. /******/ id: moduleId,
  20. /******/ loaded: false
  21. /******/ };
  22. /******/
  23. /******/ // Execute the module function
  24. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  25. /******/
  26. /******/ // Flag the module as loaded
  27. /******/ module.loaded = true;
  28. /******/
  29. /******/ // Return the exports of the module
  30. /******/ return module.exports;
  31. /******/ }
  32. /******/
  33. /******/
  34. /******/ // expose the modules object (__webpack_modules__)
  35. /******/ __webpack_require__.m = modules;
  36. /******/
  37. /******/ // expose the module cache
  38. /******/ __webpack_require__.c = installedModules;
  39. /******/
  40. /******/ // __webpack_public_path__
  41. /******/ __webpack_require__.p = "";
  42. /******/
  43. /******/ // Load entry module and return exports
  44. /******/ return __webpack_require__(0);
  45. /******/ })
  46. /************************************************************************/
  47. /******/ ([
  48. /* 0 */
  49. /***/ (function(module, exports, __webpack_require__) {
  50. /*istanbul ignore next*/'use strict';
  51. var mokit = __webpack_require__(1);
  52. var Toolbar = __webpack_require__(84);
  53. var Editor = __webpack_require__(89);
  54. var Viewer = __webpack_require__(94);
  55. var Finder = __webpack_require__(97);
  56. var Shortcut = __webpack_require__(100);
  57. var Parser = __webpack_require__(102);
  58. __webpack_require__(151);
  59. __webpack_require__(158);
  60. __webpack_require__(159);
  61. __webpack_require__(160);
  62. var HIDDEN_CLASS_NAME = 'mditor-hidden';
  63. var Mditor = new mokit.Component({
  64. template: __webpack_require__(162),
  65. /*istanbul ignore next*/onInit: function onInit() {
  66. this.PLATFORM = navigator.platform.toLowerCase();
  67. this.EOL = this.PLATFORM == 'win32' ? '\r\n' : '\n';
  68. this.CMD = this.PLATFORM.indexOf('mac') > -1 ? 'command' : 'ctrl';
  69. this.INDENT = ' ';
  70. this.shortcut = new Shortcut(this);
  71. this.Parser = Parser;
  72. this.parser = new Parser(this);
  73. },
  74. /*istanbul ignore next*/onReady: function onReady() {
  75. /*istanbul ignore next*/var _this = this;
  76. this.shortcut.bind('tab', this.editor.addIndent.bind(this.editor));
  77. this.shortcut.bind('shift+tab', this.editor.removeIndent.bind(this.editor));
  78. this.shortcut.bind('enter', function (event) {
  79. /*istanbul ignore next*/_this._ulAndQuoteAutoComplete(event);
  80. /*istanbul ignore next*/_this._olAutoComplete(event);
  81. /*istanbul ignore next*/_this._keepIndent(event);
  82. }, true);
  83. setTimeout(function () {
  84. /*istanbul ignore next*/_this.$emit('ready');
  85. }, 0);
  86. },
  87. components: {
  88. Toolbar: Toolbar,
  89. Editor: Editor,
  90. Viewer: Viewer,
  91. Finder: Finder
  92. },
  93. props: {
  94. height: '400px',
  95. width: 'auto',
  96. preview: false,
  97. split: true,
  98. fullscreen: false
  99. },
  100. /*istanbul ignore next*/data: function data() {
  101. return {
  102. self: this,
  103. value: ''
  104. };
  105. },
  106. /*istanbul ignore next*/find: function find(text) {
  107. this.finder.show(text);
  108. },
  109. /*istanbul ignore next*/syncScroll: function syncScroll() {
  110. if (!this.split || this.preview) return;
  111. var offsetHeight = this.editor.textarea.offsetHeight;
  112. var editorScrollHeight = this.editor.textarea.scrollHeight;
  113. var viewerScrollHeight = this.viewer.$element.scrollHeight;
  114. var editorScrollTop = this.editor.textarea.scrollTop;
  115. var viewerScrollTop = editorScrollTop * (viewerScrollHeight - offsetHeight) / (editorScrollHeight - offsetHeight);
  116. this.viewer.$element.scrollTop = viewerScrollTop;
  117. },
  118. /*istanbul ignore next*/onChanged: function onChanged(event) {
  119. this.$emit('changed', event);
  120. this.syncScroll();
  121. },
  122. /*istanbul ignore next*/onInput: function onInput(event) {
  123. this.$emit('input', event);
  124. },
  125. /*istanbul ignore next*/onPaste: function onPaste(event) {
  126. this.$emit('paste', event);
  127. this.syncScroll();
  128. },
  129. /*istanbul ignore next*/onHeadDblClick: function onHeadDblClick(event) {
  130. if (event.target.tagName == 'I') return;
  131. this.$emit('head-dblclick', event);
  132. },
  133. /*istanbul ignore next*/_keepIndent: function _keepIndent(event) {
  134. var text = this.editor.getBeforeTextInLine();
  135. var parts = text.split(this.INDENT);
  136. if (parts.length < 2) return;
  137. var count = 0;
  138. var buffer = [this.EOL];
  139. while (parts[count] === '' && count < parts.length - 1) {
  140. count++;
  141. buffer.push(this.INDENT);
  142. }
  143. this.editor.insertBeforeText(buffer.join(''));
  144. event.preventDefault();
  145. },
  146. /*istanbul ignore next*/_ulAndQuoteAutoComplete: function _ulAndQuoteAutoComplete(event) {
  147. var text = this.editor.getBeforeTextInLine();
  148. var prefix = text.substr(0, 2);
  149. if (prefix != '- ' && prefix != '* ' && prefix != '> ') return;
  150. if (text.length > prefix.length) {
  151. this.editor.insertBeforeText(this.EOL + prefix);
  152. } else {
  153. this.editor.selectBeforeText(prefix.length);
  154. this.editor.setSelectText('');
  155. }
  156. event.preventDefault();
  157. },
  158. /*istanbul ignore next*/_olAutoComplete: function _olAutoComplete(event) {
  159. var exp = /^\d+\./;
  160. var text = this.editor.getBeforeTextInLine();
  161. var trimedText = text.trim();
  162. if (!exp.test(trimedText)) return;
  163. var num = trimedText.split('.')[0];
  164. if (trimedText.length > num.length + 1) {
  165. this.editor.insertBeforeText(this.EOL + (parseInt(num) + 1) + '. ');
  166. } else {
  167. this.editor.selectBeforeText(text.length);
  168. this.editor.setSelectText('');
  169. }
  170. event.preventDefault();
  171. },
  172. /*istanbul ignore next*/focus: function focus() {
  173. if (this.preview) {
  174. this.$element.focus();
  175. } else {
  176. this.editor.focus();
  177. }
  178. },
  179. /*istanbul ignore next*/blur: function blur() {
  180. this.editor.blur();
  181. },
  182. /*istanbul ignore next*/addCommand: function addCommand(item) {
  183. if (!item.name || !item.handler) return;
  184. this.commands = this.commands || {};
  185. this.commands[item.name] = item;
  186. if (item.key) {
  187. this.shortcut.bind(item.key, item.name, item.allowDefault, item.owner);
  188. }
  189. },
  190. /*istanbul ignore next*/removeCommand: function removeCommand(name) {
  191. this.commands = this.commands || {};
  192. var item = this.commands[name];
  193. if (!item) return;
  194. this.shortcut.unbind(item.key);
  195. this.commands[name] = null;
  196. delete this.commands[name];
  197. },
  198. /*istanbul ignore next*/execCommand: function execCommand(name, event) {
  199. event = event || {};
  200. event.mditor = this;
  201. event.toolbar = this.toolbar;
  202. event.editor = this.editor;
  203. this.commands[name].handler.call(this, event);
  204. }
  205. });
  206. Mditor.fromTextarea = function (textarea) {
  207. textarea.classList.add(HIDDEN_CLASS_NAME);
  208. var mditor = new Mditor();
  209. mditor.value = textarea.value;
  210. mditor.$watch('value', function () {
  211. textarea.value = mditor.value;
  212. });
  213. mditor.$mount(textarea);
  214. mditor.switchTextarea = function () {
  215. if (textarea.classList.contains(HIDDEN_CLASS_NAME)) {
  216. textarea.value = mditor.value;
  217. mditor.$element.classList.add(HIDDEN_CLASS_NAME);
  218. textarea.classList.remove(HIDDEN_CLASS_NAME);
  219. } else {
  220. mditor.value = textarea.value;
  221. textarea.classList.add(HIDDEN_CLASS_NAME);
  222. mditor.$element.classList.remove(HIDDEN_CLASS_NAME);
  223. }
  224. };
  225. return mditor;
  226. };
  227. Mditor.Parser = Parser;
  228. module.exports = window.Mditor = Mditor;
  229. /***/ }),
  230. /* 1 */
  231. /***/ (function(module, exports, __webpack_require__) {
  232. /*istanbul ignore next*/'use strict';
  233. var info = __webpack_require__(2);
  234. var utils = __webpack_require__(3);
  235. var Class = __webpack_require__(4);
  236. var Watcher = __webpack_require__(5);
  237. var Observer = __webpack_require__(6);
  238. var Template = __webpack_require__(51);
  239. var Component = __webpack_require__(79);
  240. var EventEmitter = __webpack_require__(50);
  241. //持载模板相关对象
  242. utils.copy(Template, Component);
  243. Component.version = info.version;
  244. Component.Template = Template;
  245. Component.Watcher = Watcher;
  246. Component.Observer = Observer;
  247. Component.EventEmitter = EventEmitter;
  248. Component.utils = utils;
  249. Component.Class = Class;
  250. //定义安装插件的方法
  251. Component.use = function (plugin) {
  252. var install = plugin.install || plugin;
  253. if (!utils.isFunction(install)) {
  254. throw new Error('Invalid Plugin');
  255. }
  256. return install.call(plugin, this);
  257. };
  258. //安装内置的路由插件
  259. //Component.use(Router);
  260. module.exports = Component;
  261. /***/ }),
  262. /* 2 */
  263. /***/ (function(module, exports) {
  264. module.exports = {"name":"mokit","version":"3.1.3"}
  265. /***/ }),
  266. /* 3 */
  267. /***/ (function(module, exports, __webpack_require__) {
  268. (function (ntils) {
  269. /**
  270. * 空函数
  271. */
  272. ntils.noop = function () { };
  273. /**
  274. * 验证一个对象是否为NULL
  275. * @method isNull
  276. * @param {Object} obj 要验证的对象
  277. * @return {Boolean} 结果
  278. * @static
  279. */
  280. ntils.isNull = function (obj) {
  281. return obj === null || typeof obj === "undefined";
  282. };
  283. /**
  284. * 除去字符串两端的空格
  285. * @method trim
  286. * @param {String} str 源字符串
  287. * @return {String} 结果字符串
  288. * @static
  289. */
  290. ntils.trim = function (str) {
  291. if (this.isNull(str)) return str;
  292. if (str.trim) {
  293. return str.trim();
  294. } else {
  295. return str.replace(/(^[\\s]*)|([\\s]*$)/g, "");
  296. }
  297. };
  298. /**
  299. * 替换所有
  300. * @method replace
  301. * @param {String} str 源字符串
  302. * @param {String} str1 要替换的字符串
  303. * @param {String} str2 替换为的字符串
  304. * @static
  305. */
  306. ntils.replace = function (str, str1, str2) {
  307. if (this.isNull(str)) return str;
  308. return str.replace(new RegExp(str1, 'g'), str2);
  309. };
  310. /**
  311. * 从字符串开头匹配
  312. * @method startWith
  313. * @param {String} str1 源字符串
  314. * @param {String} str2 要匹配的字符串
  315. * @return {Boolean} 匹配结果
  316. * @static
  317. */
  318. ntils.startWith = function (str1, str2) {
  319. if (this.isNull(str1) || this.isNull(str2)) return false;
  320. return str1.indexOf(str2) === 0;
  321. };
  322. /**
  323. * 是否包含
  324. * @method contains
  325. * @param {String} str1 源字符串
  326. * @param {String} str2 检查包括字符串
  327. * @return {Boolean} 结果
  328. * @static
  329. */
  330. ntils.contains = function (str1, str2) {
  331. var self = this;
  332. if (this.isNull(str1) || this.isNull(str2)) return false;
  333. return str1.indexOf(str2) > -1;
  334. };
  335. /**
  336. * 从字符串结束匹配
  337. * @method endWidth
  338. * @param {String} str1 源字符串
  339. * @param {String} str2 匹配字符串
  340. * @return {Boolean} 匹配结果
  341. * @static
  342. */
  343. ntils.endWith = function (str1, str2) {
  344. if (this.isNull(str1) || this.isNull(str2)) return false;
  345. return str1.indexOf(str2) === (str1.length - str2.length);
  346. };
  347. /**
  348. * 是否包含属性
  349. * @method hasProperty
  350. * @param {Object} obj 对象
  351. * @param {String} name 属性名
  352. * @return {Boolean} 结果
  353. * @static
  354. */
  355. ntils.has = ntils.hasProperty = function (obj, name) {
  356. if (this.isNull(obj) || this.isNull(name)) return false;
  357. return (name in obj) || (obj.hasOwnProperty(name));
  358. };
  359. /**
  360. * 验证一个对象是否为Function
  361. * @method isFunction
  362. * @param {Object} obj 要验证的对象
  363. * @return {Boolean} 结果
  364. * @static
  365. */
  366. ntils.isFunction = function (obj) {
  367. if (this.isNull(obj)) return false;
  368. return typeof obj === "function";
  369. };
  370. /**
  371. * 验证一个对象是否为String
  372. * @method isString
  373. * @param {Object} obj 要验证的对象
  374. * @return {Boolean} 结果
  375. * @static
  376. */
  377. ntils.isString = function (obj) {
  378. if (this.isNull(obj)) return false;
  379. return typeof obj === 'string' || obj instanceof String;
  380. };
  381. /**
  382. * 验证一个对象是否为Number
  383. * @method isNumber
  384. * @param {Object} obj 要验证的对象
  385. * @return {Boolean} 结果
  386. * @static
  387. */
  388. ntils.isNumber = function (obj) {
  389. if (this.isNull(obj)) return false;
  390. return typeof obj === 'number' || obj instanceof Number;
  391. };
  392. /**
  393. * 验证一个对象是否为Boolean
  394. * @method isBoolean
  395. * @param {Object} obj 要验证的对象
  396. * @return {Boolean} 结果
  397. * @static
  398. */
  399. ntils.isBoolean = function (obj) {
  400. if (this.isNull(obj)) return false;
  401. return typeof obj === 'boolean' || obj instanceof Boolean;
  402. };
  403. /**
  404. * 验证一个对象是否为HTML Element
  405. * @method isElement
  406. * @param {Object} obj 要验证的对象
  407. * @return {Boolean} 结果
  408. * @static
  409. */
  410. ntils.isElement = function (obj) {
  411. if (this.isNull(obj)) return false;
  412. if (window.Element) {
  413. return obj instanceof Element;
  414. } else {
  415. return (obj.tagName && obj.nodeType && obj.nodeName && obj.attributes && obj.ownerDocument);
  416. }
  417. };
  418. /**
  419. * 验证一个对象是否为HTML Text Element
  420. * @method isText
  421. * @param {Object} obj 要验证的对象
  422. * @return {Boolean} 结果
  423. * @static
  424. */
  425. ntils.isText = function (obj) {
  426. if (this.isNull(obj)) return false;
  427. return obj instanceof Text;
  428. };
  429. /**
  430. * 验证一个对象是否为Object
  431. * @method isObject
  432. * @param {Object} obj 要验证的对象
  433. * @return {Boolean} 结果
  434. * @static
  435. */
  436. ntils.isObject = function (obj) {
  437. if (this.isNull(obj)) return false;
  438. return typeof obj === "object";
  439. };
  440. /**
  441. * 验证一个对象是否为Array或伪Array
  442. * @method isArray
  443. * @param {Object} obj 要验证的对象
  444. * @return {Boolean} 结果
  445. * @static
  446. */
  447. ntils.isArray = function (obj) {
  448. if (this.isNull(obj)) return false;
  449. var v1 = Object.prototype.toString.call(obj) === '[object Array]';
  450. var v2 = obj instanceof Array;
  451. var v3 = !this.isString(obj) && this.isNumber(obj.length) && this.isFunction(obj.splice);
  452. var v4 = !this.isString(obj) && this.isNumber(obj.length) && obj[0];
  453. return v1 || v2 || v3 || v4;
  454. };
  455. /**
  456. * 验证是不是一个日期对象
  457. * @method isDate
  458. * @param {Object} val 要检查的对象
  459. * @return {Boolean} 结果
  460. * @static
  461. */
  462. ntils.isDate = function (val) {
  463. if (this.isNull(val)) return false;
  464. return val instanceof Date;
  465. };
  466. /**
  467. * 验证是不是一个正则对象
  468. * @method isDate
  469. * @param {Object} val 要检查的对象
  470. * @return {Boolean} 结果
  471. * @static
  472. */
  473. ntils.isRegexp = function (val) {
  474. return val instanceof RegExp;
  475. };
  476. /**
  477. * 转换为数组
  478. * @method toArray
  479. * @param {Array|Object} array 伪数组
  480. * @return {Array} 转换结果数组
  481. * @static
  482. */
  483. ntils.toArray = function (array) {
  484. if (this.isNull(array)) return [];
  485. return Array.prototype.slice.call(array);
  486. };
  487. /**
  488. * 转为日期格式
  489. * @method toDate
  490. * @param {Number|String} val 日期字符串或整型数值
  491. * @return {Date} 日期对象
  492. * @static
  493. */
  494. ntils.toDate = function (val) {
  495. var self = this;
  496. if (self.isNumber(val))
  497. return new Date(val);
  498. else if (self.isString(val))
  499. return new Date(self.replace(self.replace(val, '-', '/'), 'T', ' '));
  500. else if (self.isDate(val))
  501. return val;
  502. else
  503. return null;
  504. };
  505. /**
  506. * 遍历一个对像或数组
  507. * @method each
  508. * @param {Object or Array} obj 要遍历的数组或对象
  509. * @param {Function} fn 处理函数
  510. * @return {void} 无返回值
  511. * @static
  512. */
  513. ntils.each = function (list, handler, scope) {
  514. if (this.isNull(list) || this.isNull(handler)) return;
  515. if (this.isArray(list)) {
  516. var listLength = list.length;
  517. for (var i = 0; i < listLength; i++) {
  518. var rs = handler.call(scope || list[i], i, list[i]);
  519. if (!this.isNull(rs)) return rs;
  520. }
  521. } else {
  522. for (var key in list) {
  523. var rs = handler.call(scope || list[key], key, list[key]);
  524. if (!this.isNull(rs)) return rs;
  525. }
  526. }
  527. };
  528. /**
  529. * 格式化日期
  530. * @method formatDate
  531. * @param {Date|String|Number} date 日期
  532. * @param {String} format 格式化字符串
  533. * @param {object} dict 反译字典
  534. * @return {String} 格式化结果
  535. * @static
  536. */
  537. ntils.formatDate = function (date, format, dict) {
  538. if (this.isNull(format) || this.isNull(date)) return date;
  539. date = this.toDate(date);
  540. dict = dict || {};
  541. var placeholder = {
  542. "M+": date.getMonth() + 1, //month
  543. "d+": date.getDate(), //day
  544. "h+": date.getHours(), //hour
  545. "m+": date.getMinutes(), //minute
  546. "s+": date.getSeconds(), //second
  547. "w+": date.getDay(), //week
  548. "q+": Math.floor((date.getMonth() + 3) / 3), //quarter
  549. "S": date.getMilliseconds() //millisecond
  550. }
  551. if (/(y+)/.test(format)) {
  552. format = format.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
  553. }
  554. for (var key in placeholder) {
  555. if (new RegExp("(" + key + ")").test(format)) {
  556. var value = placeholder[key];
  557. value = dict[value] || value;
  558. format = format.replace(RegExp.$1, RegExp.$1.length == 1
  559. ? value : ("00" + value).substr(("" + value).length));
  560. }
  561. }
  562. return format;
  563. };
  564. /**
  565. * 拷贝对象
  566. * @method copy
  567. * @param {Object} src 源对象
  568. * @param {Object} dst 目标对象
  569. * @static
  570. */
  571. ntils.copy = function (src, dst, igonres) {
  572. dst = dst || (this.isArray(src) ? [] : {});
  573. this.each(src, function (key) {
  574. if (igonres && igonres.indexOf(key) > -1) return;
  575. delete dst[key];
  576. if (Object.getOwnPropertyDescriptor) {
  577. try {
  578. Object.defineProperty(dst, key, Object.getOwnPropertyDescriptor(src, key));
  579. } catch (ex) {
  580. dst[key] = src[key];
  581. }
  582. } else {
  583. dst[key] = src[key];
  584. }
  585. })
  586. return dst;
  587. };
  588. /**
  589. * 深度克隆对象
  590. * @method clone
  591. * @param {Object} src 源对象
  592. * @return {Object} 新对象
  593. * @static
  594. */
  595. ntils.clone = function (src, igonres) {
  596. if (this.isNull(src) ||
  597. this.isString(src) ||
  598. this.isNumber(src) ||
  599. this.isBoolean(src) ||
  600. this.isDate(src)) {
  601. return src;
  602. }
  603. var objClone = src;
  604. try {
  605. objClone = new src.constructor();
  606. } catch (ex) { }
  607. this.each(src, function (key, value) {
  608. if (objClone[key] != value && !this.contains(igonres, key)) {
  609. if (this.isObject(value)) {
  610. objClone[key] = this.clone(value, igonres);
  611. } else {
  612. objClone[key] = value;
  613. }
  614. }
  615. }, this);
  616. ['toString', 'valueOf'].forEach(function (key) {
  617. if (this.contains(igonres, key)) return;
  618. this.defineFreezeProp(objClone, key, src[key]);
  619. }, this);
  620. return objClone;
  621. };
  622. /**
  623. * 合并对象
  624. * @method mix
  625. * @return 合并后的对象
  626. * @param {Object} dst 目标对象
  627. * @param {Object} src 源对象
  628. * @param {Array} igonres 忽略的属性名,
  629. * @param {Number} mode 模式
  630. */
  631. ntils.mix = function (dst, src, igonres, mode, igonreNull) {
  632. //根据模式来判断,默认是Obj to Obj的
  633. if (mode) {
  634. switch (mode) {
  635. case 1: // proto to proto
  636. return ntils.mix(dst.prototype, src.prototype, igonres, 0);
  637. case 2: // object to object and proto to proto
  638. ntils.mix(dst.prototype, src.prototype, igonres, 0);
  639. break; // pass through
  640. case 3: // proto to static
  641. return ntils.mix(dst, src.prototype, igonres, 0);
  642. case 4: // static to proto
  643. return ntils.mix(dst.prototype, src, igonres, 0);
  644. default: // object to object is what happens below
  645. }
  646. }
  647. //---
  648. src = src || {};
  649. dst = dst || (this.isArray(src) ? [] : {});
  650. this.keys(src).forEach(function (key) {
  651. if (this.contains(igonres, key)) return;
  652. if (igonreNull && this.isNull(src[key])) return;
  653. if (this.isObject(src[key]) &&
  654. (src[key].constructor == Object ||
  655. src[key].constructor == Array ||
  656. src[key].constructor == null)) {
  657. dst[key] = ntils.mix(dst[key], src[key], igonres, 0, igonreNull);
  658. } else {
  659. dst[key] = src[key];
  660. }
  661. }, this);
  662. return dst;
  663. };
  664. /**
  665. * 定义不可遍历的属性
  666. **/
  667. ntils.defineFreezeProp = function (obj, name, value) {
  668. try {
  669. Object.defineProperty(obj, name, {
  670. value: value,
  671. enumerable: false,
  672. configurable: true, //能不能重写定义
  673. writable: false //能不能用「赋值」运算更改
  674. });
  675. } catch (err) {
  676. obj[name] = value;
  677. }
  678. };
  679. /**
  680. * 获取所有 key
  681. */
  682. ntils.keys = function (obj) {
  683. if (Object.keys) return Object.keys(obj);
  684. var keys = [];
  685. this.each(obj, function (key) {
  686. keys.push(key);
  687. });
  688. return keys;
  689. };
  690. /**
  691. * 创建一个对象
  692. */
  693. ntils.create = function (proto, props) {
  694. if (Object.create) return Object.create(proto, props);
  695. var Cotr = function () { };
  696. Cotr.prototype = proto;
  697. var obj = new Cotr();
  698. if (props) this.copy(props, obj);
  699. return obj;
  700. };
  701. /**
  702. * 设置 proto
  703. * 在不支持 setPrototypeOf 也不支持 __proto__ 的浏览器
  704. * 中,会采用 copy 方式
  705. */
  706. ntils.setPrototypeOf = function (obj, proto) {
  707. if (Object.setPrototypeOf) {
  708. return Object.setPrototypeOf(obj, proto || this.create(null));
  709. } else {
  710. if (!('__proto__' in Object)) this.copy(proto, obj);
  711. obj.__proto__ = proto;
  712. }
  713. };
  714. /**
  715. * 获取 proto
  716. */
  717. ntils.getPrototypeOf = function (obj) {
  718. if (obj.__proto__) return obj.__proto__;
  719. if (Object.getPrototypeOf) return Object.getPrototypeOf(obj);
  720. if (obj.constructor) return obj.constructor.prototype;
  721. };
  722. /**
  723. * 是否深度相等
  724. */
  725. ntils.deepEqual = function (a, b) {
  726. if (a === b) return true;
  727. if (!this.isObject(a) || !this.isObject(b)) return false;
  728. var aKeys = this.keys(a);
  729. var bKeys = this.keys(b);
  730. if (aKeys.length !== bKeys.length) return false;
  731. var allKeys = aKeys.concat(bKeys);
  732. var checkedMap = this.create(null);
  733. var result = true;
  734. this.each(allKeys, function (i, key) {
  735. if (checkedMap[key]) return;
  736. if (!this.deepEqual(a[key], b[key])) result = false;
  737. checkedMap[key] = true;
  738. }, this);
  739. return result;
  740. };
  741. /**
  742. * 从一个数值循环到别一个数
  743. * @param {number} fromNum 开始数值
  744. * @param {Number} toNum 结束数值
  745. * @param {Number} step 步长值
  746. * @param {function} handler 执行函数
  747. * @returns {void} 无返回
  748. */
  749. ntils.fromTo = function (fromNum, toNum, step, handler) {
  750. if (!handler) handler = [step, step = handler][0];
  751. step = Math.abs(step || 1);
  752. if (fromNum < toNum) {
  753. for (var i = fromNum; i <= toNum; i += step) handler(i);
  754. } else {
  755. for (var i = fromNum; i >= toNum; i -= step) handler(i);
  756. }
  757. };
  758. /**
  759. * 生成一个Guid
  760. * @method newGuid
  761. * @return {String} GUID字符串
  762. * @static
  763. */
  764. ntils.newGuid = function () {
  765. var S4 = function () {
  766. return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
  767. };
  768. return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
  769. };
  770. /**
  771. * 对象变换
  772. **/
  773. ntils.map = function (list, fn) {
  774. var buffer = this.isArray(list) ? [] : {};
  775. this.each(list, function (name, value) {
  776. buffer[name] = fn(name, value);
  777. });
  778. return buffer;
  779. };
  780. /**
  781. * 通过路径设置属性值
  782. */
  783. ntils.setByPath = function (obj, path, value) {
  784. if (this.isNull(obj) || this.isNull(path) || path === '') {
  785. return;
  786. }
  787. if (!this.isArray(path)) {
  788. path = path.replace(/\[/, '.').replace(/\]/, '.').split('.');
  789. }
  790. this.each(path, function (index, name) {
  791. if (this.isNull(name) || name.length < 1) return;
  792. if (index === path.length - 1) {
  793. obj[name] = value;
  794. } else {
  795. obj[name] = obj[name] || {};
  796. obj = obj[name];
  797. }
  798. }, this);
  799. };
  800. /**
  801. * 通过路径获取属性值
  802. */
  803. ntils.getByPath = function (obj, path) {
  804. if (this.isNull(obj) || this.isNull(path) || path === '') {
  805. return obj;
  806. }
  807. if (!this.isArray(path)) {
  808. path = path.replace(/\[/, '.').replace(/\]/, '.').split('.');
  809. }
  810. this.each(path, function (index, name) {
  811. if (this.isNull(name) || name.length < 1) return;
  812. if (!this.isNull(obj)) obj = obj[name];
  813. }, this);
  814. return obj;
  815. };
  816. /**
  817. * 数组去重
  818. **/
  819. ntils.unique = function (array) {
  820. if (this.isNull(array)) return array;
  821. var newArray = [];
  822. this.each(array, function (i, value) {
  823. if (newArray.indexOf(value) > -1) return;
  824. newArray.push(value);
  825. });
  826. return newArray;
  827. };
  828. /**
  829. * 解析 function 的参数列表
  830. **/
  831. ntils.getFunctionArgumentNames = function (fn) {
  832. if (!fn) return [];
  833. var src = fn.toString();
  834. var parts = src.split(')')[0].split('=>')[0].split('(');
  835. return (parts[1] || parts[0]).split(',').map(function (name) {
  836. return name.trim();
  837. }).filter(function (name) {
  838. return name != 'function';
  839. });
  840. };
  841. /**
  842. * 缩短字符串
  843. */
  844. ntils.short = function (str, maxLength) {
  845. if (!str) return str;
  846. maxLength = maxLength || 40;
  847. var strLength = str.length;
  848. var trimLength = maxLength / 2;
  849. return strLength > maxLength ? str.substr(0, trimLength) + '...' + str.substr(strLength - trimLength) : str;
  850. };
  851. /**
  852. * 首字母大写
  853. */
  854. ntils.firstUpper = function (str) {
  855. if (this.isNull(str)) return;
  856. return str.substring(0, 1).toUpperCase() + str.substring(1);
  857. };
  858. /**
  859. * 编码正则字符串
  860. */
  861. ntils.escapeRegExp = function (str) {
  862. return str.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  863. };
  864. /**
  865. * 解析字符串为 dom
  866. * @param {string} str 字符串
  867. * @returns {HTMLNode} 解析后的 DOM
  868. */
  869. ntils.parseDom = function (str) {
  870. this._PDD_ = this._PDD_ || document.createElement('div');
  871. this._PDD_.innerHTML = ntils.trim(str);
  872. var firstNode = this._PDD_.childNodes[0];
  873. //先 clone 一份再通过 innerHTML 清空
  874. //否则 IE9 下,清空时会导出返回的 DOM 没有子结点
  875. if (firstNode) firstNode = firstNode.cloneNode(true);
  876. this._PDD_.innerHTML = '';
  877. return firstNode;
  878. };
  879. })(( false) ? (window.ntils = {}) : exports);
  880. /***/ }),
  881. /* 4 */
  882. /***/ (function(module, exports, __webpack_require__) {
  883. const utils = __webpack_require__(3);
  884. function ClassFactory(options) {
  885. //处理 options
  886. options = options || utils.create(null);
  887. options.$name = options.$name || 'Class';
  888. options.$extends = options.$extends || ClassFactory;
  889. options.$static = options.$static || utils.create(null);
  890. //处理父类 prototype
  891. var superPrototype = utils.isFunction(options.$extends) ?
  892. options.$extends.prototype : options.$extends;
  893. //定义新类
  894. var Class = function () {
  895. //处理 super
  896. if (!this.$super) {
  897. utils.defineFreezeProp(this, '$super', function () {
  898. if (this._super_called_) return this._super_ret_;
  899. this._super_called_ = true;
  900. if (utils.isFunction(options.$extends)) {
  901. this._super_ret_ = options.$extends.apply(this, arguments);
  902. //这几行确保可继承于数组
  903. if (this._super_ret_) {
  904. var proto = utils.getPrototypeOf(this);
  905. utils.setPrototypeOf(proto, this._super_ret_);
  906. }
  907. } else {
  908. this._super_ret_ = options.$extends;
  909. }
  910. return this._super_ret_;
  911. });
  912. for (var name in superPrototype) {
  913. var value = superPrototype[name];
  914. if (utils.isFunction(value)) {
  915. this.$super[name] = value.bind(this);
  916. } else {
  917. this.$super[name] = value;
  918. }
  919. }
  920. }
  921. //调用构造
  922. if (utils.isFunction(options.constructor) &&
  923. options.constructor !== Object) {
  924. return options.constructor.apply(this, arguments);
  925. } else {
  926. //如果没有实现 constructor 则调用父类构造
  927. this.$super.apply(this, arguments);
  928. }
  929. };
  930. //处理 prototype
  931. Class.prototype = utils.create(superPrototype);
  932. utils.copy(options, Class.prototype);
  933. utils.defineFreezeProp(Class.prototype, '$class', Class);
  934. //处理静态成员
  935. utils.copy(options.$static, Class);
  936. if (utils.isFunction(options.$extends)) {
  937. utils.setPrototypeOf(Class, options.$extends);
  938. }
  939. if (!options.$extends.$extend) {
  940. utils.copy(ClassFactory, Class);
  941. }
  942. utils.defineFreezeProp(Class, '$super', options.$extends);
  943. //--
  944. return Class;
  945. }
  946. //定义扩展方法
  947. ClassFactory.$extend = function (options) {
  948. options.$extends = this;
  949. return new ClassFactory(options);
  950. };
  951. ClassFactory.Class = ClassFactory;
  952. module.exports = ClassFactory;
  953. /***/ }),
  954. /* 5 */
  955. /***/ (function(module, exports, __webpack_require__) {
  956. /*istanbul ignore next*/'use strict';
  957. var Class = __webpack_require__(4);
  958. var utils = __webpack_require__(3);
  959. /**
  960. * Watcher 类
  961. * 通过「计算函数」、「执行函数」可以创建一个 Watcher 实例
  962. */
  963. var Watcher = new Class({
  964. /**
  965. * 通过「计算函数」、「执行函数」构建一个 Watcher 实例
  966. * @param {function} calcor 计算函数
  967. * @param {function} handler 处理函数
  968. * @param {boolean} first 是否自动执行第一次
  969. * @returns {void} 无返回
  970. */
  971. constructor: function /*istanbul ignore next*/constructor(calcor, handler, first) {
  972. if (!utils.isFunction(calcor) || !utils.isFunction(handler)) {
  973. throw new Error('Invalid parameters');
  974. }
  975. this.calcor = calcor;
  976. this.handler = handler;
  977. if (first) this.calc(true);
  978. },
  979. /**
  980. * 执行计算
  981. * @param {boolean} force 是否强制触发「计算函数」
  982. * @returns {Object} 计算后的值
  983. */
  984. calc: function /*istanbul ignore next*/calc(force) {
  985. var newValue = this.calcor();
  986. if (force || !utils.deepEqual(newValue, this.value)) {
  987. this.handler(newValue, this.value);
  988. }
  989. this.value = utils.clone(newValue);
  990. }
  991. });
  992. module.exports = Watcher;
  993. /***/ }),
  994. /* 6 */
  995. /***/ (function(module, exports, __webpack_require__) {
  996. /*istanbul ignore next*/'use strict';
  997. /*istanbul ignore next*/var _keys = __webpack_require__(7);
  998. var _keys2 = _interopRequireDefault(_keys);
  999. var _getOwnPropertyDescriptor = __webpack_require__(42);
  1000. var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor);
  1001. var _defineProperty = __webpack_require__(47);
  1002. var _defineProperty2 = _interopRequireDefault(_defineProperty);
  1003. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1004. var Class = __webpack_require__(4);
  1005. var utils = __webpack_require__(3);
  1006. var EventEmitter = __webpack_require__(50);
  1007. var OBSERVER_PROP_NAME = '_observer_';
  1008. var CHANGE_EVENT_NAME = 'change';
  1009. var EVENT_MAX_DISPATCH_LAYER = 10;
  1010. var IGNORE_REGEXPS = [/^\_(.*)\_$/i, /^\_\_/i];
  1011. /**
  1012. * 对象观察类,可以监控对象变化
  1013. * 目前方案问题:
  1014. * 对于父子关系和事件冒泡,目前方案如果用 delete 删除一个属性,无关真实删除关系,
  1015. * 即便调用 clearReference 也无法再清除关系,子对象的 parents 中会一直有一个引用,当前方案最高效
  1016. * 其它方法一:
  1017. * 将「关系」放入全局数组中,然后将 ob.parents 变成一个「属性」从全局数组件中 filter 出来,
  1018. * 基本和目前方法类似,但是关系在外部存领教,所以 clearReference 可清除。
  1019. * 其它方案二:
  1020. * 构造时添加到全局数组,每一个 observer change 时都让放到全局的 observer 遍历自身的,
  1021. * 检果事件源是不是自已的子对象,如果是则触发自身 change 事件,这样 ob 对象本身没有相关引用
  1022. * clearReference 时只从全局清除掉就行了,并且 delete 操作也不会影响,但效率稍差。
  1023. * 其它方案三:
  1024. * 给构造函数添加一个 deep 属性,只有 deep 的 ob 对象,才放入到全局数组中,检查时逻辑同方案二
  1025. * 但是因为要检查的对象会少很多,效率会更高一点。
  1026. */
  1027. var Observer = new Class({
  1028. $extends: EventEmitter,
  1029. /**
  1030. * 通过目标对象构造一个观察对象
  1031. * @param {Object} target 目标对象
  1032. * @param {Object} options 选项
  1033. * @returns {void} 无返回
  1034. */
  1035. constructor: function /*istanbul ignore next*/constructor(target, options) {
  1036. if (utils.isNull(target)) {
  1037. throw new Error('Invalid target');
  1038. }
  1039. options = options || {};
  1040. var observer = target[OBSERVER_PROP_NAME];
  1041. if (observer) {
  1042. utils.copy(options, observer.options);
  1043. //当时一个组件 A 的为组件 B 的 prop 时,A 更新不会触发 B 更新
  1044. //所在暂注释这里,另一种方法是更新 prop 指令,重写 excute 方法,而不是现在的 update 方法
  1045. // if (observer.options.root) {
  1046. // observer.parents.length = 0;
  1047. // }
  1048. observer.apply();
  1049. return observer;
  1050. }
  1051. EventEmitter.call(this);
  1052. utils.defineFreezeProp(this, 'options', options);
  1053. utils.defineFreezeProp(this, 'shadow', {});
  1054. utils.defineFreezeProp(this, 'target', target);
  1055. utils.defineFreezeProp(this, 'parents', []);
  1056. utils.defineFreezeProp(target, OBSERVER_PROP_NAME, this);
  1057. this.apply();
  1058. },
  1059. /**
  1060. * 添加一个属性,动态添中的属性,无法被观察,
  1061. * 但是通过 set 方法添加的属性可能被观察。
  1062. * @param {string} name 名称
  1063. * @param {Object} value 值
  1064. * @returns {void} 无返回
  1065. */
  1066. set: function /*istanbul ignore next*/set(name, value) {
  1067. if (utils.isFunction(value) || Observer.isIgnore(name)) {
  1068. return;
  1069. }
  1070. /*istanbul ignore next*/(0, _defineProperty2.default)(this.target, name, {
  1071. get: function /*istanbul ignore next*/get() {
  1072. return this[OBSERVER_PROP_NAME].shadow[name];
  1073. },
  1074. set: function /*istanbul ignore next*/set(value) {
  1075. var observer = this[OBSERVER_PROP_NAME];
  1076. var oldValue = observer.shadow[name];
  1077. if (oldValue === value) return;
  1078. if (utils.isObject(value)) {
  1079. var childObserver = new Observer(value);
  1080. observer.addChild(childObserver, name);
  1081. }
  1082. //移除旧值的父引用
  1083. //如果用 delete 删除属性将无法移除父子引用
  1084. if (oldValue && oldValue[OBSERVER_PROP_NAME]) {
  1085. observer.removeChild(oldValue[OBSERVER_PROP_NAME], name);
  1086. }
  1087. observer.shadow[name] = value;
  1088. observer.emitChange({ path: name, value: value });
  1089. },
  1090. configurable: true,
  1091. enumerable: true
  1092. });
  1093. this.target[name] = value;
  1094. },
  1095. /**
  1096. * 自动应用所有动态添加的属性
  1097. * @returns {void} 无返回
  1098. */
  1099. apply: function /*istanbul ignore next*/apply() {
  1100. if (utils.isArray(this.target)) {
  1101. this._wrapArray(this.target);
  1102. }
  1103. var names = this._getPropertyNames(this.target);
  1104. names.forEach(function (name) {
  1105. var desc = /*istanbul ignore next*/(0, _getOwnPropertyDescriptor2.default)(this.target, name);
  1106. if (!('value' in desc)) return;
  1107. this.set(name, this.target[name]);
  1108. }, this);
  1109. },
  1110. /**
  1111. * 清除所有父子引用
  1112. * @returns {void} 无返回
  1113. */
  1114. clearReference: function /*istanbul ignore next*/clearReference() {
  1115. utils.each(this.target, function (name, value) {
  1116. if (utils.isNull(value)) return;
  1117. var child = value[OBSERVER_PROP_NAME];
  1118. if (child) this.removeChild(child);
  1119. }, this);
  1120. },
  1121. /**
  1122. * 派发一个事件,事件会向父级对象冒泡
  1123. * @param {string} eventName 事件名称
  1124. * @param {Object} event 事件对象
  1125. * @returns {void} 无返回
  1126. */
  1127. dispatch: function /*istanbul ignore next*/dispatch(eventName, event) {
  1128. if (event._src_ === this) return;
  1129. event._src_ = event._src_ || this;
  1130. event._layer_ = event._layer_ || 0;
  1131. if (event._layer_++ >= EVENT_MAX_DISPATCH_LAYER) return;
  1132. this.emit(eventName, event);
  1133. if (!this.parents || this.parents.length < 1) return;
  1134. this.parents.forEach(function (item) {
  1135. if (!(item.name in item.parent.target)) {
  1136. return item.parent.removeChild(this);
  1137. }
  1138. var parentEvent = utils.copy(event);
  1139. parentEvent.path = item.name + '.' + event.path;
  1140. item.parent.dispatch(eventName, parentEvent);
  1141. }, this);
  1142. },
  1143. /**
  1144. * 添子观察者对象
  1145. * @param {Object} child 父对象
  1146. * @param {String} name 属性名
  1147. * @returns {void} 无返回
  1148. */
  1149. addChild: function /*istanbul ignore next*/addChild(child, name) {
  1150. if (utils.isNull(child) || utils.isNull(name)) {
  1151. throw new Error('Invalid paramaters');
  1152. }
  1153. if (child.options.root) return;
  1154. child.parents.push({ parent: this, name: name });
  1155. },
  1156. /**
  1157. * 移除子对象
  1158. * @param {Object} child 父对象
  1159. * @param {String} name 属性名
  1160. * @returns {void} 无返回
  1161. */
  1162. removeChild: function /*istanbul ignore next*/removeChild(child, name) {
  1163. if (utils.isNull(child)) {
  1164. throw new Error('Invalid paramaters');
  1165. }
  1166. var foundIndex = -1;
  1167. child.parents.forEach(function (item, index) {
  1168. if (item.parent === this && item.name === name) {
  1169. foundIndex = index;
  1170. }
  1171. }, this);
  1172. if (foundIndex > -1) {
  1173. child.parents.splice(foundIndex, 1);
  1174. }
  1175. },
  1176. /**
  1177. * 触发 change 事件
  1178. * @param {Object} event 事件对象
  1179. * @returns {void} 无返回
  1180. */
  1181. emitChange: function /*istanbul ignore next*/emitChange(event) {
  1182. this.dispatch(CHANGE_EVENT_NAME, event);
  1183. },
  1184. /**
  1185. * 获取所有成员名称列表
  1186. * @returns {Array} 所有成员名称列表
  1187. */
  1188. _getPropertyNames: function /*istanbul ignore next*/_getPropertyNames() {
  1189. var names = utils.isArray(this.target) ? this.target.map(function (item, index) {
  1190. return index;
  1191. }) : /*istanbul ignore next*/(0, _keys2.default)(this.target);
  1192. return names.filter(function (name) {
  1193. return name !== OBSERVER_PROP_NAME;
  1194. });
  1195. },
  1196. /**
  1197. * 包裹数组
  1198. * @param {array} array 源数组
  1199. * @returns {array} 处理后的数组
  1200. */
  1201. _wrapArray: function /*istanbul ignore next*/_wrapArray(array) {
  1202. utils.defineFreezeProp(array, 'push', function () {
  1203. var items = [].slice.call(arguments);
  1204. items.forEach(function (item) {
  1205. //这里也会触发对应 index 的 change 事件
  1206. this[OBSERVER_PROP_NAME].set(array.length, item);
  1207. }, this);
  1208. this[OBSERVER_PROP_NAME].emitChange({ path: 'length', value: this.length });
  1209. });
  1210. utils.defineFreezeProp(array, 'pop', function () {
  1211. var item = [].pop.apply(this, arguments);
  1212. this[OBSERVER_PROP_NAME].emitChange({ path: this.length, value: item });
  1213. this[OBSERVER_PROP_NAME].emitChange({ path: 'length', value: this.length });
  1214. return item;
  1215. });
  1216. utils.defineFreezeProp(array, 'unshift', function () {
  1217. var items = [].slice.call(arguments);
  1218. items.forEach(function (item) {
  1219. //这里也会触发对应 index 的 change 事件
  1220. this[OBSERVER_PROP_NAME].set(0, item);
  1221. }, this);
  1222. this[OBSERVER_PROP_NAME].emitChange({ path: 'length', value: this.length });
  1223. });
  1224. utils.defineFreezeProp(array, 'shift', function () {
  1225. var item = [].shift.apply(this, arguments);
  1226. this[OBSERVER_PROP_NAME].emitChange({ path: 0, value: item });
  1227. this[OBSERVER_PROP_NAME].emitChange({ path: 'length', value: this.length });
  1228. return item;
  1229. });
  1230. utils.defineFreezeProp(array, 'splice', function () {
  1231. var startIndex = arguments[0];
  1232. var endIndex = utils.isNull(arguments[1]) ? startIndex + arguments[1] : this.length - 1;
  1233. var items = [].splice.apply(this, arguments);
  1234. for (var i = startIndex; i <= endIndex; i++) {
  1235. this[OBSERVER_PROP_NAME].emitChange({ path: i, value: items[i - startIndex] });
  1236. }
  1237. this[OBSERVER_PROP_NAME].emitChange({ path: 'length', value: this.length });
  1238. return items;
  1239. });
  1240. utils.defineFreezeProp(array, 'set', function (index, value) {
  1241. if (index >= this.length) {
  1242. this[OBSERVER_PROP_NAME].emitChange({ path: 'length', value: this.length });
  1243. }
  1244. this[OBSERVER_PROP_NAME].set(index, value);
  1245. });
  1246. }
  1247. });
  1248. /**
  1249. * 观察一个对象
  1250. * @param {Object} target 目标对象
  1251. * @return {Observer} 观察者对象
  1252. */
  1253. Observer.observe = function (target) {
  1254. return new Observer(target);
  1255. };
  1256. /**
  1257. * 检查是不是忽略的属性名
  1258. * @param {string} word 待检查的字符串
  1259. * @returns {void} 无返回
  1260. */
  1261. Observer.isIgnore = function (word) {
  1262. return IGNORE_REGEXPS.some(function (re) /*istanbul ignore next*/{
  1263. return re.test(word);
  1264. });
  1265. };
  1266. module.exports = Observer;
  1267. /***/ }),
  1268. /* 7 */
  1269. /***/ (function(module, exports, __webpack_require__) {
  1270. module.exports = { "default": __webpack_require__(8), __esModule: true };
  1271. /***/ }),
  1272. /* 8 */
  1273. /***/ (function(module, exports, __webpack_require__) {
  1274. __webpack_require__(9);
  1275. module.exports = __webpack_require__(29).Object.keys;
  1276. /***/ }),
  1277. /* 9 */
  1278. /***/ (function(module, exports, __webpack_require__) {
  1279. // 19.1.2.14 Object.keys(O)
  1280. var toObject = __webpack_require__(10);
  1281. var $keys = __webpack_require__(12);
  1282. __webpack_require__(27)('keys', function () {
  1283. return function keys(it) {
  1284. return $keys(toObject(it));
  1285. };
  1286. });
  1287. /***/ }),
  1288. /* 10 */
  1289. /***/ (function(module, exports, __webpack_require__) {
  1290. // 7.1.13 ToObject(argument)
  1291. var defined = __webpack_require__(11);
  1292. module.exports = function (it) {
  1293. return Object(defined(it));
  1294. };
  1295. /***/ }),
  1296. /* 11 */
  1297. /***/ (function(module, exports) {
  1298. // 7.2.1 RequireObjectCoercible(argument)
  1299. module.exports = function (it) {
  1300. if (it == undefined) throw TypeError("Can't call method on " + it);
  1301. return it;
  1302. };
  1303. /***/ }),
  1304. /* 12 */
  1305. /***/ (function(module, exports, __webpack_require__) {
  1306. // 19.1.2.14 / 15.2.3.14 Object.keys(O)
  1307. var $keys = __webpack_require__(13);
  1308. var enumBugKeys = __webpack_require__(26);
  1309. module.exports = Object.keys || function keys(O) {
  1310. return $keys(O, enumBugKeys);
  1311. };
  1312. /***/ }),
  1313. /* 13 */
  1314. /***/ (function(module, exports, __webpack_require__) {
  1315. var has = __webpack_require__(14);
  1316. var toIObject = __webpack_require__(15);
  1317. var arrayIndexOf = __webpack_require__(18)(false);
  1318. var IE_PROTO = __webpack_require__(22)('IE_PROTO');
  1319. module.exports = function (object, names) {
  1320. var O = toIObject(object);
  1321. var i = 0;
  1322. var result = [];
  1323. var key;
  1324. for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
  1325. // Don't enum bug & hidden keys
  1326. while (names.length > i) if (has(O, key = names[i++])) {
  1327. ~arrayIndexOf(result, key) || result.push(key);
  1328. }
  1329. return result;
  1330. };
  1331. /***/ }),
  1332. /* 14 */
  1333. /***/ (function(module, exports) {
  1334. var hasOwnProperty = {}.hasOwnProperty;
  1335. module.exports = function (it, key) {
  1336. return hasOwnProperty.call(it, key);
  1337. };
  1338. /***/ }),
  1339. /* 15 */
  1340. /***/ (function(module, exports, __webpack_require__) {
  1341. // to indexed object, toObject with fallback for non-array-like ES3 strings
  1342. var IObject = __webpack_require__(16);
  1343. var defined = __webpack_require__(11);
  1344. module.exports = function (it) {
  1345. return IObject(defined(it));
  1346. };
  1347. /***/ }),
  1348. /* 16 */
  1349. /***/ (function(module, exports, __webpack_require__) {
  1350. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  1351. var cof = __webpack_require__(17);
  1352. // eslint-disable-next-line no-prototype-builtins
  1353. module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
  1354. return cof(it) == 'String' ? it.split('') : Object(it);
  1355. };
  1356. /***/ }),
  1357. /* 17 */
  1358. /***/ (function(module, exports) {
  1359. var toString = {}.toString;
  1360. module.exports = function (it) {
  1361. return toString.call(it).slice(8, -1);
  1362. };
  1363. /***/ }),
  1364. /* 18 */
  1365. /***/ (function(module, exports, __webpack_require__) {
  1366. // false -> Array#indexOf
  1367. // true -> Array#includes
  1368. var toIObject = __webpack_require__(15);
  1369. var toLength = __webpack_require__(19);
  1370. var toAbsoluteIndex = __webpack_require__(21);
  1371. module.exports = function (IS_INCLUDES) {
  1372. return function ($this, el, fromIndex) {
  1373. var O = toIObject($this);
  1374. var length = toLength(O.length);
  1375. var index = toAbsoluteIndex(fromIndex, length);
  1376. var value;
  1377. // Array#includes uses SameValueZero equality algorithm
  1378. // eslint-disable-next-line no-self-compare
  1379. if (IS_INCLUDES && el != el) while (length > index) {
  1380. value = O[index++];
  1381. // eslint-disable-next-line no-self-compare
  1382. if (value != value) return true;
  1383. // Array#indexOf ignores holes, Array#includes - not
  1384. } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
  1385. if (O[index] === el) return IS_INCLUDES || index || 0;
  1386. } return !IS_INCLUDES && -1;
  1387. };
  1388. };
  1389. /***/ }),
  1390. /* 19 */
  1391. /***/ (function(module, exports, __webpack_require__) {
  1392. // 7.1.15 ToLength
  1393. var toInteger = __webpack_require__(20);
  1394. var min = Math.min;
  1395. module.exports = function (it) {
  1396. return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
  1397. };
  1398. /***/ }),
  1399. /* 20 */
  1400. /***/ (function(module, exports) {
  1401. // 7.1.4 ToInteger
  1402. var ceil = Math.ceil;
  1403. var floor = Math.floor;
  1404. module.exports = function (it) {
  1405. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  1406. };
  1407. /***/ }),
  1408. /* 21 */
  1409. /***/ (function(module, exports, __webpack_require__) {
  1410. var toInteger = __webpack_require__(20);
  1411. var max = Math.max;
  1412. var min = Math.min;
  1413. module.exports = function (index, length) {
  1414. index = toInteger(index);
  1415. return index < 0 ? max(index + length, 0) : min(index, length);
  1416. };
  1417. /***/ }),
  1418. /* 22 */
  1419. /***/ (function(module, exports, __webpack_require__) {
  1420. var shared = __webpack_require__(23)('keys');
  1421. var uid = __webpack_require__(25);
  1422. module.exports = function (key) {
  1423. return shared[key] || (shared[key] = uid(key));
  1424. };
  1425. /***/ }),
  1426. /* 23 */
  1427. /***/ (function(module, exports, __webpack_require__) {
  1428. var global = __webpack_require__(24);
  1429. var SHARED = '__core-js_shared__';
  1430. var store = global[SHARED] || (global[SHARED] = {});
  1431. module.exports = function (key) {
  1432. return store[key] || (store[key] = {});
  1433. };
  1434. /***/ }),
  1435. /* 24 */
  1436. /***/ (function(module, exports) {
  1437. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  1438. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  1439. ? window : typeof self != 'undefined' && self.Math == Math ? self
  1440. // eslint-disable-next-line no-new-func
  1441. : Function('return this')();
  1442. if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
  1443. /***/ }),
  1444. /* 25 */
  1445. /***/ (function(module, exports) {
  1446. var id = 0;
  1447. var px = Math.random();
  1448. module.exports = function (key) {
  1449. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  1450. };
  1451. /***/ }),
  1452. /* 26 */
  1453. /***/ (function(module, exports) {
  1454. // IE 8- don't enum bug keys
  1455. module.exports = (
  1456. 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
  1457. ).split(',');
  1458. /***/ }),
  1459. /* 27 */
  1460. /***/ (function(module, exports, __webpack_require__) {
  1461. // most Object methods by ES6 should accept primitives
  1462. var $export = __webpack_require__(28);
  1463. var core = __webpack_require__(29);
  1464. var fails = __webpack_require__(38);
  1465. module.exports = function (KEY, exec) {
  1466. var fn = (core.Object || {})[KEY] || Object[KEY];
  1467. var exp = {};
  1468. exp[KEY] = exec(fn);
  1469. $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);
  1470. };
  1471. /***/ }),
  1472. /* 28 */
  1473. /***/ (function(module, exports, __webpack_require__) {
  1474. var global = __webpack_require__(24);
  1475. var core = __webpack_require__(29);
  1476. var ctx = __webpack_require__(30);
  1477. var hide = __webpack_require__(32);
  1478. var PROTOTYPE = 'prototype';
  1479. var $export = function (type, name, source) {
  1480. var IS_FORCED = type & $export.F;
  1481. var IS_GLOBAL = type & $export.G;
  1482. var IS_STATIC = type & $export.S;
  1483. var IS_PROTO = type & $export.P;
  1484. var IS_BIND = type & $export.B;
  1485. var IS_WRAP = type & $export.W;
  1486. var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
  1487. var expProto = exports[PROTOTYPE];
  1488. var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
  1489. var key, own, out;
  1490. if (IS_GLOBAL) source = name;
  1491. for (key in source) {
  1492. // contains in native
  1493. own = !IS_FORCED && target && target[key] !== undefined;
  1494. if (own && key in exports) continue;
  1495. // export native or passed
  1496. out = own ? target[key] : source[key];
  1497. // prevent global pollution for namespaces
  1498. exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
  1499. // bind timers to global for call from export context
  1500. : IS_BIND && own ? ctx(out, global)
  1501. // wrap global constructors for prevent change them in library
  1502. : IS_WRAP && target[key] == out ? (function (C) {
  1503. var F = function (a, b, c) {
  1504. if (this instanceof C) {
  1505. switch (arguments.length) {
  1506. case 0: return new C();
  1507. case 1: return new C(a);
  1508. case 2: return new C(a, b);
  1509. } return new C(a, b, c);
  1510. } return C.apply(this, arguments);
  1511. };
  1512. F[PROTOTYPE] = C[PROTOTYPE];
  1513. return F;
  1514. // make static versions for prototype methods
  1515. })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
  1516. // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
  1517. if (IS_PROTO) {
  1518. (exports.virtual || (exports.virtual = {}))[key] = out;
  1519. // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
  1520. if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
  1521. }
  1522. }
  1523. };
  1524. // type bitmap
  1525. $export.F = 1; // forced
  1526. $export.G = 2; // global
  1527. $export.S = 4; // static
  1528. $export.P = 8; // proto
  1529. $export.B = 16; // bind
  1530. $export.W = 32; // wrap
  1531. $export.U = 64; // safe
  1532. $export.R = 128; // real proto method for `library`
  1533. module.exports = $export;
  1534. /***/ }),
  1535. /* 29 */
  1536. /***/ (function(module, exports) {
  1537. var core = module.exports = { version: '2.5.1' };
  1538. if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
  1539. /***/ }),
  1540. /* 30 */
  1541. /***/ (function(module, exports, __webpack_require__) {
  1542. // optional / simple context binding
  1543. var aFunction = __webpack_require__(31);
  1544. module.exports = function (fn, that, length) {
  1545. aFunction(fn);
  1546. if (that === undefined) return fn;
  1547. switch (length) {
  1548. case 1: return function (a) {
  1549. return fn.call(that, a);
  1550. };
  1551. case 2: return function (a, b) {
  1552. return fn.call(that, a, b);
  1553. };
  1554. case 3: return function (a, b, c) {
  1555. return fn.call(that, a, b, c);
  1556. };
  1557. }
  1558. return function (/* ...args */) {
  1559. return fn.apply(that, arguments);
  1560. };
  1561. };
  1562. /***/ }),
  1563. /* 31 */
  1564. /***/ (function(module, exports) {
  1565. module.exports = function (it) {
  1566. if (typeof it != 'function') throw TypeError(it + ' is not a function!');
  1567. return it;
  1568. };
  1569. /***/ }),
  1570. /* 32 */
  1571. /***/ (function(module, exports, __webpack_require__) {
  1572. var dP = __webpack_require__(33);
  1573. var createDesc = __webpack_require__(41);
  1574. module.exports = __webpack_require__(37) ? function (object, key, value) {
  1575. return dP.f(object, key, createDesc(1, value));
  1576. } : function (object, key, value) {
  1577. object[key] = value;
  1578. return object;
  1579. };
  1580. /***/ }),
  1581. /* 33 */
  1582. /***/ (function(module, exports, __webpack_require__) {
  1583. var anObject = __webpack_require__(34);
  1584. var IE8_DOM_DEFINE = __webpack_require__(36);
  1585. var toPrimitive = __webpack_require__(40);
  1586. var dP = Object.defineProperty;
  1587. exports.f = __webpack_require__(37) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  1588. anObject(O);
  1589. P = toPrimitive(P, true);
  1590. anObject(Attributes);
  1591. if (IE8_DOM_DEFINE) try {
  1592. return dP(O, P, Attributes);
  1593. } catch (e) { /* empty */ }
  1594. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
  1595. if ('value' in Attributes) O[P] = Attributes.value;
  1596. return O;
  1597. };
  1598. /***/ }),
  1599. /* 34 */
  1600. /***/ (function(module, exports, __webpack_require__) {
  1601. var isObject = __webpack_require__(35);
  1602. module.exports = function (it) {
  1603. if (!isObject(it)) throw TypeError(it + ' is not an object!');
  1604. return it;
  1605. };
  1606. /***/ }),
  1607. /* 35 */
  1608. /***/ (function(module, exports) {
  1609. module.exports = function (it) {
  1610. return typeof it === 'object' ? it !== null : typeof it === 'function';
  1611. };
  1612. /***/ }),
  1613. /* 36 */
  1614. /***/ (function(module, exports, __webpack_require__) {
  1615. module.exports = !__webpack_require__(37) && !__webpack_require__(38)(function () {
  1616. return Object.defineProperty(__webpack_require__(39)('div'), 'a', { get: function () { return 7; } }).a != 7;
  1617. });
  1618. /***/ }),
  1619. /* 37 */
  1620. /***/ (function(module, exports, __webpack_require__) {
  1621. // Thank's IE8 for his funny defineProperty
  1622. module.exports = !__webpack_require__(38)(function () {
  1623. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  1624. });
  1625. /***/ }),
  1626. /* 38 */
  1627. /***/ (function(module, exports) {
  1628. module.exports = function (exec) {
  1629. try {
  1630. return !!exec();
  1631. } catch (e) {
  1632. return true;
  1633. }
  1634. };
  1635. /***/ }),
  1636. /* 39 */
  1637. /***/ (function(module, exports, __webpack_require__) {
  1638. var isObject = __webpack_require__(35);
  1639. var document = __webpack_require__(24).document;
  1640. // typeof document.createElement is 'object' in old IE
  1641. var is = isObject(document) && isObject(document.createElement);
  1642. module.exports = function (it) {
  1643. return is ? document.createElement(it) : {};
  1644. };
  1645. /***/ }),
  1646. /* 40 */
  1647. /***/ (function(module, exports, __webpack_require__) {
  1648. // 7.1.1 ToPrimitive(input [, PreferredType])
  1649. var isObject = __webpack_require__(35);
  1650. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  1651. // and the second argument - flag - preferred type is a string
  1652. module.exports = function (it, S) {
  1653. if (!isObject(it)) return it;
  1654. var fn, val;
  1655. if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  1656. if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
  1657. if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  1658. throw TypeError("Can't convert object to primitive value");
  1659. };
  1660. /***/ }),
  1661. /* 41 */
  1662. /***/ (function(module, exports) {
  1663. module.exports = function (bitmap, value) {
  1664. return {
  1665. enumerable: !(bitmap & 1),
  1666. configurable: !(bitmap & 2),
  1667. writable: !(bitmap & 4),
  1668. value: value
  1669. };
  1670. };
  1671. /***/ }),
  1672. /* 42 */
  1673. /***/ (function(module, exports, __webpack_require__) {
  1674. module.exports = { "default": __webpack_require__(43), __esModule: true };
  1675. /***/ }),
  1676. /* 43 */
  1677. /***/ (function(module, exports, __webpack_require__) {
  1678. __webpack_require__(44);
  1679. var $Object = __webpack_require__(29).Object;
  1680. module.exports = function getOwnPropertyDescriptor(it, key) {
  1681. return $Object.getOwnPropertyDescriptor(it, key);
  1682. };
  1683. /***/ }),
  1684. /* 44 */
  1685. /***/ (function(module, exports, __webpack_require__) {
  1686. // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
  1687. var toIObject = __webpack_require__(15);
  1688. var $getOwnPropertyDescriptor = __webpack_require__(45).f;
  1689. __webpack_require__(27)('getOwnPropertyDescriptor', function () {
  1690. return function getOwnPropertyDescriptor(it, key) {
  1691. return $getOwnPropertyDescriptor(toIObject(it), key);
  1692. };
  1693. });
  1694. /***/ }),
  1695. /* 45 */
  1696. /***/ (function(module, exports, __webpack_require__) {
  1697. var pIE = __webpack_require__(46);
  1698. var createDesc = __webpack_require__(41);
  1699. var toIObject = __webpack_require__(15);
  1700. var toPrimitive = __webpack_require__(40);
  1701. var has = __webpack_require__(14);
  1702. var IE8_DOM_DEFINE = __webpack_require__(36);
  1703. var gOPD = Object.getOwnPropertyDescriptor;
  1704. exports.f = __webpack_require__(37) ? gOPD : function getOwnPropertyDescriptor(O, P) {
  1705. O = toIObject(O);
  1706. P = toPrimitive(P, true);
  1707. if (IE8_DOM_DEFINE) try {
  1708. return gOPD(O, P);
  1709. } catch (e) { /* empty */ }
  1710. if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
  1711. };
  1712. /***/ }),
  1713. /* 46 */
  1714. /***/ (function(module, exports) {
  1715. exports.f = {}.propertyIsEnumerable;
  1716. /***/ }),
  1717. /* 47 */
  1718. /***/ (function(module, exports, __webpack_require__) {
  1719. module.exports = { "default": __webpack_require__(48), __esModule: true };
  1720. /***/ }),
  1721. /* 48 */
  1722. /***/ (function(module, exports, __webpack_require__) {
  1723. __webpack_require__(49);
  1724. var $Object = __webpack_require__(29).Object;
  1725. module.exports = function defineProperty(it, key, desc) {
  1726. return $Object.defineProperty(it, key, desc);
  1727. };
  1728. /***/ }),
  1729. /* 49 */
  1730. /***/ (function(module, exports, __webpack_require__) {
  1731. var $export = __webpack_require__(28);
  1732. // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
  1733. $export($export.S + $export.F * !__webpack_require__(37), 'Object', { defineProperty: __webpack_require__(33).f });
  1734. /***/ }),
  1735. /* 50 */
  1736. /***/ (function(module, exports, __webpack_require__) {
  1737. /*istanbul ignore next*/'use strict';
  1738. var utils = __webpack_require__(3);
  1739. var Class = __webpack_require__(4);
  1740. /**
  1741. * 事件触发器基类
  1742. */
  1743. var EventEmitter = new Class({
  1744. $extends: Function,
  1745. /**
  1746. * 构建一个一个事修的触发器对象
  1747. * @param {object} target 将代理的目标对象可以省略
  1748. * @returns {void} 无返回
  1749. */
  1750. constructor: function /*istanbul ignore next*/constructor(target) {
  1751. target = target || this;
  1752. var emitter = target._emitter_;
  1753. if (emitter) return emitter;
  1754. utils.defineFreezeProp(this, '_target_', target);
  1755. utils.defineFreezeProp(target, '_emitter_', this);
  1756. this._isNative_ = this._isNativeObject(this._target_);
  1757. this._listeners_ = this._listeners_ || {};
  1758. this.on = this.$on = this.$addListener = this.addListener;
  1759. this.off = this.$off = this.$removeListener = this.removeListener;
  1760. this.$emit = this.emit;
  1761. },
  1762. /**
  1763. * 检查是否原生支持事件
  1764. * @param {object} obj 对象
  1765. * @returns {void} 检查结果
  1766. */
  1767. _isNativeObject: function /*istanbul ignore next*/_isNativeObject(obj) {
  1768. return obj.addEventListener && obj.removeEventListener && obj.dispatchEvent;
  1769. },
  1770. /**
  1771. * 添加一个事件监听函数
  1772. * @param {string} name 事件名称
  1773. * @param {function} listener 事件处理函数
  1774. * @param {capture} capture 是否是捕获阶段事件(只在代理 dom 对象时有效)
  1775. * @returns {void} 无返回
  1776. */
  1777. addListener: function /*istanbul ignore next*/addListener(name, listener, capture) {
  1778. if (this._isNative_) {
  1779. this._addNativeEventListener(name, listener, capture);
  1780. }
  1781. this._listeners_[name] = this._listeners_[name] || [];
  1782. this._listeners_[name].push(listener);
  1783. if (this._listeners_[name].length > EventEmitter._maxListeners) {
  1784. throw new Error('The `' + name + '` event listener is not more than 10');
  1785. }
  1786. },
  1787. /**
  1788. * 移除「一个/一组/所有」事件监听函数
  1789. * @param {string} name 事件名称
  1790. * @param {function} listener 事件处理函数
  1791. * @param {capture} capture 是否是捕获阶段事件(只在代理 dom 对象时有效)
  1792. * @returns {void} 无返回
  1793. */
  1794. removeListener: function /*istanbul ignore next*/removeListener(name, listener, capture) {
  1795. if (name && listener) {
  1796. if (this._isNative_) {
  1797. this._removeNativeEventListener(name, listener, capture);
  1798. }
  1799. if (!this._listeners_[name]) return;
  1800. var index = this._listeners_[name].indexOf(listener);
  1801. this._listeners_[name].splice(index, 1);
  1802. } else if (name) {
  1803. if (this._isNative_ && this._listeners_[name]) {
  1804. this._listeners_[name].forEach(function (_listener) {
  1805. this.removeListener(name, _listener, capture);
  1806. }, this);
  1807. }
  1808. delete this._listeners_[name];
  1809. } else {
  1810. utils.each(this._listeners_, function (name) {
  1811. this.removeListener(name, null, capture);
  1812. }, this);
  1813. this._listeners_ = {};
  1814. }
  1815. },
  1816. /**
  1817. * 触发自身的一个事件
  1818. * @param {string} name 事件名称
  1819. * @param {object} data 传递的对象
  1820. * @param {string} canBubble 能否冒泡(只在代理 dom 对象时有效)
  1821. * @param {object} cancelAble 能否取消(只在代理 dom 对象时有效)
  1822. * @returns {void} 无返回
  1823. */
  1824. emit: function /*istanbul ignore next*/emit(name, data, canBubble, cancelAble) {
  1825. if (this._isNative_) {
  1826. return this._emitNativeEvent(name, data, canBubble, cancelAble);
  1827. }
  1828. if (!this._listeners_[name]) return;
  1829. var stopPropagation = false;
  1830. this._listeners_[name].forEach(function (handler) {
  1831. var rs = handler.call(this._target_, data);
  1832. if (rs === false) stopPropagation = true;
  1833. }, this);
  1834. return stopPropagation;
  1835. },
  1836. /**
  1837. * 添加 DOM 元素事件
  1838. * @param {string} name 事件名称
  1839. * @param {function} listener 事件处理函数
  1840. * @param {capture} capture 是否是捕获阶段事件
  1841. * @returns {void} 无返回
  1842. */
  1843. _addNativeEventListener: function /*istanbul ignore next*/_addNativeEventListener(name, listener, capture) {
  1844. this._target_.addEventListener(name, listener, capture);
  1845. //如果存在已注册的自定义 “组合事件”
  1846. var descriptor = EventEmitter._events[name];
  1847. if (descriptor) {
  1848. descriptor.addListener = descriptor.addListener || descriptor.on;
  1849. descriptor.addListener(this, name, listener, capture);
  1850. }
  1851. },
  1852. /**
  1853. * 移除 DOM 元素事件
  1854. * @param {string} name 事件名称
  1855. * @param {function} listener 事件处理函数
  1856. * @param {capture} capture 是否是捕获阶段事件
  1857. * @returns {void} 无返回
  1858. */
  1859. _removeNativeEventListener: function /*istanbul ignore next*/_removeNativeEventListener(name, listener, capture) {
  1860. this._target_.removeEventListener(name, listener, capture);
  1861. //如果存在已注册的自定义 “组合事件”
  1862. var descriptor = EventEmitter._events[name];
  1863. if (descriptor) {
  1864. descriptor.removeListener = descriptor.removeListener || descriptor.off;
  1865. descriptor.removeListener(this, name, listener, capture);
  1866. }
  1867. },
  1868. /**
  1869. * 触发 DOM 元素事件
  1870. * @param {string} name 事件名称
  1871. * @param {object} data 传递的对象
  1872. * @param {string} canBubble 能否冒泡
  1873. * @param {object} cancelAble 能否取消
  1874. * @returns {void} 无返回
  1875. */
  1876. _emitNativeEvent: function /*istanbul ignore next*/_emitNativeEvent(name, data, canBubble, cancelAble) {
  1877. var event = document.createEvent('HTMLEvents');
  1878. event.initEvent(name, canBubble, cancelAble);
  1879. utils.copy(data, event, ['data']);
  1880. event.data = data;
  1881. return this._target_.dispatchEvent(event);
  1882. }
  1883. });
  1884. //最多添加多少个 listener
  1885. EventEmitter._maxListeners = 10;
  1886. //所有自定义事件
  1887. EventEmitter._events = [];
  1888. /**
  1889. * 注册自定义事件(只在代理 dom 对象时有效)
  1890. * @param {object} descriptor 事件定义
  1891. * @returns {void} 无返回
  1892. */
  1893. EventEmitter.register = function (descriptor) {
  1894. var names = descriptor.name;
  1895. if (!names) return;
  1896. if (!utils.isArray(names)) names = names.split(',');
  1897. names.forEach(function (name) {
  1898. this._events[name] = descriptor;
  1899. }, this);
  1900. };
  1901. module.exports = EventEmitter;
  1902. /***/ }),
  1903. /* 51 */
  1904. /***/ (function(module, exports, __webpack_require__) {
  1905. /*istanbul ignore next*/'use strict';
  1906. var Compiler = __webpack_require__(52);
  1907. var Directive = __webpack_require__(53);
  1908. var Expression = __webpack_require__(54);
  1909. var Template = __webpack_require__(78);
  1910. var directives = __webpack_require__(55);
  1911. Template.Template = Template;
  1912. Template.Compiler = Compiler;
  1913. Template.Directive = Directive;
  1914. Template.directives = directives;
  1915. Template.Expression = Expression;
  1916. module.exports = Template;
  1917. /***/ }),
  1918. /* 52 */
  1919. /***/ (function(module, exports, __webpack_require__) {
  1920. /*istanbul ignore next*/'use strict';
  1921. var Class = __webpack_require__(4);
  1922. var Directive = __webpack_require__(53);
  1923. var utils = __webpack_require__(3);
  1924. var Expression = __webpack_require__(54);
  1925. var commonDirectives = __webpack_require__(55);
  1926. var DEFAULT_PREFIX = 'm';
  1927. /**
  1928. * 模板编译器
  1929. * 可以通过指定「前缀」或「指令集」构建实例
  1930. */
  1931. var Compiler = new Class({
  1932. /**
  1933. * 构造一个编译器
  1934. * @param {Object} options 选项
  1935. * @returns {void} 无返回
  1936. */
  1937. constructor: function /*istanbul ignore next*/constructor(options) {
  1938. options = options || {};
  1939. this.prefix = options.prefix || DEFAULT_PREFIX;
  1940. this.elementDirectives = {};
  1941. this.attributeDirectives = {};
  1942. this.registerDirectives(commonDirectives);
  1943. this.registerDirectives(options.directives);
  1944. },
  1945. /**
  1946. * 将字符串转成「驼峰」式
  1947. * @param {string} str 原始字符串
  1948. * @param {number} mode 1 大驼峰,0 小驼峰
  1949. * @return {string} 转换后的字符串
  1950. */
  1951. toCamelCase: function /*istanbul ignore next*/toCamelCase(str, mode) {
  1952. if (str) {
  1953. str = str.replace(/\-[a-z0-9]/g, function ($1) /*istanbul ignore next*/{
  1954. return $1.slice(1).toUpperCase();
  1955. });
  1956. str = str.replace(/^[a-z]/i, function ($1) {
  1957. return mode ? $1.toUpperCase() : $1.toLowerCase();
  1958. });
  1959. }
  1960. return str;
  1961. },
  1962. /**
  1963. * 将字符串转成分隔形式
  1964. * @param {string} str 原始字符串
  1965. * @return {string} 转换后的字符串
  1966. */
  1967. toSplitCase: function /*istanbul ignore next*/toSplitCase(str) {
  1968. if (str) {
  1969. str = str.replace(/([A-Z])/g, '-$1');
  1970. if (str[0] == '-') str = str.slice(1);
  1971. }
  1972. return str;
  1973. },
  1974. /**
  1975. * 添加指令
  1976. * @param {Object} directives 指令集
  1977. * @returns {void} 无返回
  1978. */
  1979. registerDirectives: function /*istanbul ignore next*/registerDirectives(directives) {
  1980. utils.each(directives, function (name, directive) {
  1981. name = this.toSplitCase(name);
  1982. var fullName = directive.options.prefix === false ? name : /*istanbul ignore next*/this.prefix + ':' + name;
  1983. if (directive.options.type == Directive.TE) {
  1984. this.elementDirectives[fullName.toUpperCase()] = directive;
  1985. } else {
  1986. this.attributeDirectives[fullName.toLowerCase()] = directive;
  1987. }
  1988. }, this);
  1989. },
  1990. /**
  1991. * 解析要 attr 指令信息
  1992. * @param {string} attrName 要解析的名称字符串
  1993. * @returns {Object} 解析后的对象
  1994. */
  1995. _parseAttrInfo: function /*istanbul ignore next*/_parseAttrInfo(attrName) {
  1996. /*istanbul ignore next*/var _this = this;
  1997. var parts = attrName.toLowerCase().split(':');
  1998. var info = {};
  1999. if (parts.length > 1) {
  2000. info.name = /*istanbul ignore next*/parts[0] + ':' + parts[1];
  2001. info.decorates = parts.slice(2).map(function (item) /*istanbul ignore next*/{
  2002. return (/*istanbul ignore next*/_this.toCamelCase(item)
  2003. );
  2004. });
  2005. } else {
  2006. info.name = parts[0];
  2007. info.decorates = [];
  2008. }
  2009. return info;
  2010. },
  2011. /**
  2012. * 创建一个指令实例
  2013. * @param {Directive} Directive 指令类
  2014. * @param {Object} options 指令构建选项
  2015. * @returns {Directive} 指令实例
  2016. */
  2017. _createDirectiveInstance: function /*istanbul ignore next*/_createDirectiveInstance(Directive, options) {
  2018. options.compiler = this;
  2019. options.prefix = this.prefix;
  2020. return new Directive(options);
  2021. },
  2022. /**
  2023. * 初始化一个编译完成的 handler
  2024. * @param {function} handler 编译后的的模板函数
  2025. * @returns {void} 无返回
  2026. */
  2027. _bindHandler: function /*istanbul ignore next*/_bindHandler(handler) {
  2028. //排序 directives
  2029. handler.directives = handler.directives.sort(function (a, b) {
  2030. return b.level - a.level;
  2031. });
  2032. //初始化 directives
  2033. var boundDirectives = [];
  2034. utils.each(handler.directives, function (index, directive) {
  2035. directive.index = index;
  2036. directive.bind();
  2037. boundDirectives.push(directive);
  2038. //移除完成绑定的指令对应的 attribute
  2039. if (directive.remove !== false && directive.attribute) {
  2040. directive.node.removeAttribute(directive.attribute.name);
  2041. }
  2042. //如果遇到一个「终态」指令,停止向下初始化
  2043. if (directive.final) {
  2044. return handler.final = true;
  2045. }
  2046. }, this);
  2047. handler.directives = boundDirectives;
  2048. },
  2049. /**
  2050. * 编译一个元素本身
  2051. * @param {function} handler 当前模板函数
  2052. * @param {HTMLNode} node 当前 HTML 结点
  2053. * @returns {void} 无返回
  2054. */
  2055. _compileElement: function /*istanbul ignore next*/_compileElement(handler, node) {
  2056. var ElementDirective = this.elementDirectives[node.nodeName.toUpperCase()];
  2057. if (!ElementDirective) return;
  2058. handler.directives.push(this._createDirectiveInstance(ElementDirective, {
  2059. handler: handler,
  2060. node: node
  2061. }));
  2062. },
  2063. /**
  2064. * 编译一个元素所有 attributes
  2065. * @param {function} handler 当前模板函数
  2066. * @param {HTMLNode} node 当前 HTML 结点
  2067. * @returns {void} 无返回
  2068. */
  2069. _compileAttributes: function /*istanbul ignore next*/_compileAttributes(handler, node) {
  2070. utils.toArray(node.attributes).forEach(function (attribute) {
  2071. var attrInfo = this._parseAttrInfo(attribute.name);
  2072. var AttrDirective = this.attributeDirectives[attrInfo.name] || this.attributeDirectives['*'];
  2073. if (!AttrDirective) return;
  2074. var directiveOptions = AttrDirective.options;
  2075. handler.directives.push(this._createDirectiveInstance(AttrDirective, {
  2076. handler: handler,
  2077. node: node,
  2078. attribute: attribute,
  2079. expression: directiveOptions.literal ? attribute.value : new Expression(attribute.value, directiveOptions.mixed),
  2080. decorates: attrInfo.decorates
  2081. }));
  2082. }, this);
  2083. },
  2084. /**
  2085. * 编译所有子结点
  2086. * @param {function} handler 当前模板函数
  2087. * @param {HTMLNode} node 当前 HTML 结点
  2088. * @returns {void} 无返回
  2089. */
  2090. _compileChildren: function /*istanbul ignore next*/_compileChildren(handler, node) {
  2091. if (handler.final) return;
  2092. utils.toArray(node.childNodes).forEach(function (childNode) {
  2093. if (childNode._compiled_) return;
  2094. var childHandler = this.compile(childNode);
  2095. childHandler.parent = this;
  2096. handler.children.push(childHandler);
  2097. }, this);
  2098. },
  2099. /**
  2100. * 编译一个模板
  2101. * @param {HTMLNode} node 模板根元素
  2102. * @param {Object} options 选项
  2103. * @returns {function} 模板函数
  2104. */
  2105. compile: function /*istanbul ignore next*/compile(node, options) {
  2106. if (!node) {
  2107. throw new Error('Invalid node for compile');
  2108. }
  2109. node._compiled_ = true;
  2110. options = options || {};
  2111. //定义编译结果函数
  2112. var handler = function handler(scope) {
  2113. if (utils.isNull(scope)) scope = {};
  2114. handler.directives.forEach(function (directive) {
  2115. directive.scope = scope;
  2116. directive.execute(scope);
  2117. }, this);
  2118. handler.children.forEach(function (childHandler) {
  2119. childHandler(scope);
  2120. }, this);
  2121. };
  2122. //--
  2123. handler.dispose = function () {
  2124. handler.directives.forEach(function (directive) {
  2125. directive.unbind();
  2126. }, this);
  2127. handler.children.forEach(function (childHandler) {
  2128. childHandler.dispose();
  2129. }, this);
  2130. };
  2131. handler.node = node;
  2132. //定义 children & directives
  2133. handler.directives = [];
  2134. handler.children = [];
  2135. //编译相关指令
  2136. if (options.element !== false) this._compileElement(handler, node);
  2137. if (options.attribute !== false) this._compileAttributes(handler, node);
  2138. this._bindHandler(handler);
  2139. if (options.children !== false) this._compileChildren(handler, node);
  2140. //返回编译后函数
  2141. return handler;
  2142. }
  2143. });
  2144. module.exports = Compiler;
  2145. /***/ }),
  2146. /* 53 */
  2147. /***/ (function(module, exports, __webpack_require__) {
  2148. /*istanbul ignore next*/'use strict';
  2149. var Class = __webpack_require__(4);
  2150. var utils = __webpack_require__(3);
  2151. var Expression = __webpack_require__(54);
  2152. /**
  2153. * 指令定义工场函数
  2154. * @param {Object} classOptions 选项
  2155. * @returns {Directive} 指令类
  2156. */
  2157. function Directive(classOptions) {
  2158. //处理指令选项
  2159. classOptions = classOptions || {};
  2160. classOptions.type = classOptions.type || Directive.TA;
  2161. classOptions.level = classOptions.level || Directive.LG;
  2162. //生成指令类
  2163. var DirectiveClass = new Class({
  2164. $extends: classOptions,
  2165. //指令构建函数
  2166. constructor: function /*istanbul ignore next*/constructor(instanceOptions) {
  2167. utils.copy(instanceOptions, this);
  2168. },
  2169. //挂载实例上的 options
  2170. options: classOptions,
  2171. //挂载实例核心方法
  2172. bind: classOptions.bind || utils.noop,
  2173. execute: classOptions.execute || function (scope) {
  2174. this.scope = scope;
  2175. if (this.options.type === Directive.TE) {
  2176. return this.update();
  2177. }
  2178. var newValue = this.options.literal ? this.attribute.value : this.expression.execute(scope);
  2179. if (!utils.deepEqual(this._value_, newValue)) {
  2180. this.update(newValue, this._value_);
  2181. this._value_ = newValue;
  2182. }
  2183. },
  2184. update: classOptions.update || utils.noop,
  2185. unbind: classOptions.unbind || utils.noop,
  2186. //挂载指令常用的类型
  2187. utils: utils,
  2188. Expression: Expression
  2189. });
  2190. //向指令类添加「指令定义信息」
  2191. DirectiveClass.options = classOptions;
  2192. utils.setPrototypeOf(DirectiveClass, classOptions);
  2193. return DirectiveClass;
  2194. }
  2195. //指令类型
  2196. Directive.TA = 'A';
  2197. Directive.TE = 'E';
  2198. //指令级别
  2199. Directive.LP = 3000; //prevent
  2200. Directive.LS = 2000; //statement
  2201. Directive.LE = 1000; //eleemtn
  2202. Directive.LG = 0; //general
  2203. Directive.LA = -1000; //any attribute
  2204. Directive.LC = -2000; //cloak
  2205. module.exports = Directive;
  2206. /***/ }),
  2207. /* 54 */
  2208. /***/ (function(module, exports, __webpack_require__) {
  2209. /*istanbul ignore next*/'use strict';
  2210. var Class = __webpack_require__(4);
  2211. var utils = __webpack_require__(3);
  2212. /**
  2213. * 表达式类型,将字符串构析为可执行表达式实例
  2214. */
  2215. var Expression = new Class({
  2216. /**
  2217. * 通过字符串构造一个表达式实例
  2218. * @param {string} code 代码字符串
  2219. * @param {boolean} mix 是否是混合代码
  2220. * @returns {void} 无返回
  2221. */
  2222. constructor: function /*istanbul ignore next*/constructor(code, mix) {
  2223. this.func = mix ? this._compileMixedCode(code) : this._compileCode(code);
  2224. },
  2225. /**
  2226. * 编译普通表达式代码
  2227. * @param {string} code 代码字符串
  2228. * @returns {function} 编辑后的函数
  2229. */
  2230. _compileCode: function /*istanbul ignore next*/_compileCode(code) {
  2231. code = this._escapeEOL(this._wrapCode(code));
  2232. return this._createFunction(code);
  2233. },
  2234. /**
  2235. * 编辑混合的表达式代码
  2236. * @param {string} code 代码字符串
  2237. * @returns {function} 编辑后的函数
  2238. */
  2239. _compileMixedCode: function /*istanbul ignore next*/_compileMixedCode(code) {
  2240. var statements = this._parseMixedCode(code);
  2241. code = this._escapeEOL(statements.join('+'));
  2242. return this._createFunction(code);
  2243. },
  2244. /**
  2245. * 通过符串代码创建一个可执行函数
  2246. * @param {string} code 代码字符串
  2247. * @returns {function} 创建的函数
  2248. */
  2249. _createFunction: function /*istanbul ignore next*/_createFunction(code) {
  2250. var func = new Function('utils', 'scope', 'with(scope){return ' + code + '}');
  2251. return func.bind(null, utils);
  2252. },
  2253. /**
  2254. * 解析混合代码字符串
  2255. * @param {string} code 混合代码字符串
  2256. * @returns {Array} 解析后的「token」列表
  2257. */
  2258. _parseMixedCode: function /*istanbul ignore next*/_parseMixedCode(code) {
  2259. var index = 0,
  2260. length = code.length;
  2261. var token = '',
  2262. isExpr = false,
  2263. tokens = [];
  2264. while (index <= length) {
  2265. var char = code[index++];
  2266. var nextChar = code[index];
  2267. if (utils.isNull(char)) {
  2268. if (token.length > 0) {
  2269. tokens.push('"' + this._escapeCode(token) + '"');
  2270. }
  2271. token = '';
  2272. isExpr = false;
  2273. } else if (!isExpr && char + nextChar == '{{') {
  2274. if (token.length > 0) {
  2275. tokens.push('"' + this._escapeCode(token) + '"');
  2276. }
  2277. token = '';
  2278. isExpr = true;
  2279. index++;
  2280. } else if (isExpr && char + nextChar == '}}') {
  2281. if (token.length > 0) {
  2282. tokens.push(this._wrapCode(token));
  2283. }
  2284. token = '';
  2285. isExpr = false;
  2286. index++;
  2287. } else {
  2288. token += char;
  2289. }
  2290. }
  2291. return tokens;
  2292. },
  2293. /**
  2294. * 转义处理代码字符串
  2295. * @param {string} code 源字符串
  2296. * @returns {string} 处理后的字符串
  2297. */
  2298. _escapeCode: function /*istanbul ignore next*/_escapeCode(code) {
  2299. return code.replace(/"/, '\\"').replace('\r\n', '\\r\\n').replace('\n', '\\n');
  2300. },
  2301. /**
  2302. * 转义换行符
  2303. * @param {string} code 源字符串
  2304. * @returns {string} 处理后的字符串
  2305. */
  2306. _escapeEOL: function /*istanbul ignore next*/_escapeEOL(code) {
  2307. return code.replace(/\n/gm, '\\\n');
  2308. },
  2309. /**
  2310. * 通过闭包和 try/cache 包裹代码
  2311. * 将模板中错误的代码直接显示在「模板中用到的位置」,更易于定位错误。
  2312. * @param {string} code 源字符串
  2313. * @returns {string} 处理后的字符串
  2314. */
  2315. _wrapCode: function /*istanbul ignore next*/_wrapCode(code) {
  2316. return '((function(){try{return (' + code + ')}catch(err){console.error(err);return err;}})())';
  2317. },
  2318. /**
  2319. * 通过 scope 对象执行表达式
  2320. * @param {Object} scope 上下文对象
  2321. * @returns {Object} 执行结果
  2322. */
  2323. execute: function /*istanbul ignore next*/execute(scope) {
  2324. if (utils.isNull(scope)) {
  2325. scope = {};
  2326. }
  2327. return this.func.call(scope, scope);
  2328. }
  2329. });
  2330. module.exports = Expression;
  2331. /***/ }),
  2332. /* 55 */
  2333. /***/ (function(module, exports, __webpack_require__) {
  2334. /*istanbul ignore next*/'use strict';
  2335. module.exports = {
  2336. '#text': __webpack_require__(56),
  2337. 'each': __webpack_require__(57),
  2338. 'if': __webpack_require__(59),
  2339. 'prop': __webpack_require__(60),
  2340. 'attr': __webpack_require__(61),
  2341. 'on': __webpack_require__(62),
  2342. 'html': __webpack_require__(63),
  2343. 'text': __webpack_require__(64),
  2344. 'prevent': __webpack_require__(65),
  2345. 'id': __webpack_require__(66),
  2346. 'cloak': __webpack_require__(67),
  2347. 'show': __webpack_require__(68),
  2348. 'model': __webpack_require__(69),
  2349. 'focus': __webpack_require__(76),
  2350. '*': __webpack_require__(77) //处理所有未知 attr
  2351. };
  2352. /***/ }),
  2353. /* 56 */
  2354. /***/ (function(module, exports, __webpack_require__) {
  2355. /*istanbul ignore next*/'use strict';
  2356. var Directive = __webpack_require__(53);
  2357. var Expression = __webpack_require__(54);
  2358. module.exports = new Directive({
  2359. type: Directive.TE,
  2360. prefix: false,
  2361. /**
  2362. * 初始化指令
  2363. * @returns {void} 无返回
  2364. */
  2365. bind: function /*istanbul ignore next*/bind() {
  2366. this.expr = new Expression(this.node.nodeValue, true);
  2367. this.node.nodeValue = '';
  2368. },
  2369. execute: function /*istanbul ignore next*/execute(scope) {
  2370. this.scope = scope;
  2371. var newValue = this.expr.execute(scope);
  2372. if (this.node.nodeValue !== newValue) {
  2373. this.node.nodeValue = newValue;
  2374. }
  2375. }
  2376. });
  2377. /***/ }),
  2378. /* 57 */
  2379. /***/ (function(module, exports, __webpack_require__) {
  2380. /*istanbul ignore next*/'use strict';
  2381. /*istanbul ignore next*/var _defineProperty = __webpack_require__(47);
  2382. var _defineProperty2 = _interopRequireDefault(_defineProperty);
  2383. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2384. var Directive = __webpack_require__(53);
  2385. var utils = __webpack_require__(3);
  2386. var Scope = __webpack_require__(58);
  2387. module.exports = new Directive({
  2388. level: Directive.LS + 1, //比 if 要高一个权重
  2389. final: true,
  2390. literal: true,
  2391. /**
  2392. * 初始化指令
  2393. * @returns {void} 无返回
  2394. */
  2395. bind: function /*istanbul ignore next*/bind() {
  2396. this.mountNode = document.createTextNode('');
  2397. this.node.parentNode.insertBefore(this.mountNode, this.node);
  2398. //虽然,bind 完成后,也会进行 attribute 的移除,
  2399. //但 each 指令必须先移除,否再进行 item 编译时 each 还会生效
  2400. this.node.removeAttribute(this.attribute.name);
  2401. this.node.parentNode.removeChild(this.node);
  2402. this.parseExpr();
  2403. this.eachItems = {};
  2404. },
  2405. parseExpr: function /*istanbul ignore next*/parseExpr() {
  2406. this.eachType = this.attribute.value.indexOf(' in ') > -1 ? 'in' : 'of';
  2407. var tokens = this.attribute.value.split(' ' + this.eachType + ' ');
  2408. var fnText = /*istanbul ignore next*/'with(scope){utils.each(' + tokens[1] + ',fn.bind(this,' + tokens[1] + '))}';
  2409. this.each = new Function('utils', 'scope', 'fn', fnText).bind(null, this.utils);
  2410. var names = tokens[0].split(',').map(function (name) {
  2411. return name.trim();
  2412. });
  2413. if (this.eachType == 'in') {
  2414. this.keyName = names[0];
  2415. this.valueName = names[1];
  2416. } else {
  2417. this.keyName = names[1];
  2418. this.valueName = names[0];
  2419. }
  2420. },
  2421. execute: function /*istanbul ignore next*/execute(scope) {
  2422. /*istanbul ignore next*/var _this = this;
  2423. var currentEachKeys = [];
  2424. var itemsFragment = document.createDocumentFragment();
  2425. var self = this;
  2426. this.each(scope, function (eachTarget, key) {
  2427. //创建新 scope,必须选创建再设置 prototype 或采用定义「属性」的方式
  2428. //因为指令参数指定的名称有可能和 scope 原有变量冲突
  2429. //将导致针对 watch 变量的赋值,从引用发循环
  2430. var newScope = new Scope(this.scope);
  2431. if (self.keyName) {
  2432. /*istanbul ignore next*/(0, _defineProperty2.default)(newScope, self.keyName, {
  2433. /*istanbul ignore next*/get: function get() {
  2434. return key;
  2435. }
  2436. });
  2437. }
  2438. //value 采用「属性」进行代理,否则将会使「双向」绑定无把回设值
  2439. if (self.valueName) {
  2440. /*istanbul ignore next*/(0, _defineProperty2.default)(newScope, self.valueName, {
  2441. /*istanbul ignore next*/get: function get() {
  2442. return eachTarget[key];
  2443. },
  2444. /*istanbul ignore next*/set: function set(value) {
  2445. eachTarget[key] = value;
  2446. }
  2447. });
  2448. }
  2449. var oldItem = this.eachItems[key];
  2450. if (oldItem) {
  2451. oldItem.handler(newScope);
  2452. } else {
  2453. var newItem = {};
  2454. //创建新元素
  2455. newItem.node = this.node.cloneNode(true);
  2456. itemsFragment.appendChild(newItem.node);
  2457. newItem.handler = this.compiler.compile(newItem.node);
  2458. newItem.handler(newScope);
  2459. this.eachItems[key] = newItem;
  2460. }
  2461. currentEachKeys.push(key);
  2462. }.bind(this));
  2463. utils.each(this.eachItems, function (key, item) {
  2464. if (currentEachKeys.some(function (k) /*istanbul ignore next*/{
  2465. return k == key;
  2466. })) return;
  2467. if (item.node.parentNode) {
  2468. item.node.parentNode.removeChild(item.node);
  2469. }
  2470. delete /*istanbul ignore next*/_this.eachItems[key];
  2471. }, this);
  2472. if (itemsFragment.childNodes.length > 0) {
  2473. this.mountNode.parentNode.insertBefore(itemsFragment, this.mountNode);
  2474. }
  2475. }
  2476. });
  2477. /***/ }),
  2478. /* 58 */
  2479. /***/ (function(module, exports, __webpack_require__) {
  2480. /*istanbul ignore next*/'use strict';
  2481. var utils = __webpack_require__(3);
  2482. var Scope = function Scope(parent, props) {
  2483. //新的 scope 因为「继承」了 _observer_
  2484. //所以在新 scope 上进行双向绑定时,将将值成功回写
  2485. //如果有天不须用 utils.cteate 继承法,需要注意 _observer_
  2486. //或在新 scope 上 defineProperty 代理 parentScope
  2487. var scope = utils.create(parent);
  2488. utils.copy(props, scope);
  2489. //将 func 绑定到原 scope 上;
  2490. utils.each(parent, function (key, value) {
  2491. if (!utils.isFunction(value)) return;
  2492. scope[key] = value.bind(parent);
  2493. });
  2494. return scope;
  2495. };
  2496. module.exports = Scope;
  2497. /***/ }),
  2498. /* 59 */
  2499. /***/ (function(module, exports, __webpack_require__) {
  2500. /*istanbul ignore next*/'use strict';
  2501. var Directive = __webpack_require__(53);
  2502. module.exports = new Directive({
  2503. level: Directive.LS,
  2504. final: true,
  2505. /**
  2506. * 初始化指令
  2507. * @returns {void} 无返回
  2508. */
  2509. bind: function /*istanbul ignore next*/bind() {
  2510. this.mountNode = document.createTextNode('');
  2511. this.node.parentNode.insertBefore(this.mountNode, this.node);
  2512. //虽然,bind 完成后,也会进行 attribute 的移除,
  2513. //但 if 指令必须先移除,否再进行 item 编译时 if 还会生效
  2514. this.node.removeAttribute(this.attribute.name);
  2515. this.node.parentNode.removeChild(this.node);
  2516. },
  2517. execute: function /*istanbul ignore next*/execute(scope) {
  2518. var newValue = this.expression.execute(scope);
  2519. if (newValue) {
  2520. //如果新计算的结果为 true 才执行
  2521. this._handler = this._handler || this.compiler.compile(this.node);
  2522. this._handler(scope);
  2523. var node = this.node.$substitute || this.node;
  2524. if (!node.parentNode) {
  2525. this.mountNode.parentNode.insertBefore(node, this.mountNode);
  2526. }
  2527. } else {
  2528. var _node = this.node.$substitute || this.node;
  2529. if (_node.parentNode) _node.parentNode.removeChild(_node);
  2530. }
  2531. }
  2532. });
  2533. /***/ }),
  2534. /* 60 */
  2535. /***/ (function(module, exports, __webpack_require__) {
  2536. /*istanbul ignore next*/'use strict';
  2537. var Directive = __webpack_require__(53);
  2538. module.exports = new Directive({
  2539. update: function /*istanbul ignore next*/update(value) {
  2540. var target = this.node.$target || this.node;
  2541. target[this.decorates[0]] = value;
  2542. }
  2543. // execute: function (scope) {
  2544. // this.scope = scope;
  2545. // let newValue = this.expression.execute(scope);
  2546. // let target = this.node.$target || this.node;
  2547. // target[this.decorates[0]] = newValue;
  2548. // }
  2549. });
  2550. /***/ }),
  2551. /* 61 */
  2552. /***/ (function(module, exports, __webpack_require__) {
  2553. /*istanbul ignore next*/'use strict';
  2554. var Directive = __webpack_require__(53);
  2555. module.exports = new Directive({
  2556. update: function /*istanbul ignore next*/update(value) {
  2557. var target = this.node.$target || this.node;
  2558. if (target.setAttribute) {
  2559. target.setAttribute(this.decorates[0], value);
  2560. } else {
  2561. target[this.decorates[0]] = value;
  2562. }
  2563. }
  2564. });
  2565. /***/ }),
  2566. /* 62 */
  2567. /***/ (function(module, exports, __webpack_require__) {
  2568. /*istanbul ignore next*/'use strict';
  2569. var Directive = __webpack_require__(53);
  2570. var EventEmitter = __webpack_require__(50);
  2571. var Scope = __webpack_require__(58);
  2572. module.exports = new Directive({
  2573. literal: true,
  2574. /**
  2575. * 初始化指令
  2576. * @returns {void} 无返回
  2577. */
  2578. bind: function /*istanbul ignore next*/bind() {
  2579. var attrValue = this.attribute.value || '';
  2580. if (attrValue.indexOf('(') < 0 && attrValue.indexOf(')') < 0) {
  2581. attrValue += '($event)';
  2582. }
  2583. this.expr = new this.Expression(attrValue);
  2584. var eventTarget = this.node.$target || this.node;
  2585. this.emiter = new EventEmitter(eventTarget);
  2586. this.emiter.addListener(this.decorates[0], function (event) {
  2587. if (this.utils.isNull(this.scope)) return;
  2588. this.expr.execute(new Scope(this.scope, {
  2589. $event: event
  2590. }));
  2591. }.bind(this), false);
  2592. },
  2593. unbind: function /*istanbul ignore next*/unbind() {
  2594. this.emiter.removeListener();
  2595. },
  2596. execute: function /*istanbul ignore next*/execute(scope) {
  2597. this.scope = scope;
  2598. }
  2599. });
  2600. /***/ }),
  2601. /* 63 */
  2602. /***/ (function(module, exports, __webpack_require__) {
  2603. /*istanbul ignore next*/'use strict';
  2604. var Directive = __webpack_require__(53);
  2605. module.exports = new Directive({
  2606. update: function /*istanbul ignore next*/update(newValue) {
  2607. this.node.innerHTML = newValue;
  2608. }
  2609. });
  2610. /***/ }),
  2611. /* 64 */
  2612. /***/ (function(module, exports, __webpack_require__) {
  2613. /*istanbul ignore next*/'use strict';
  2614. var Directive = __webpack_require__(53);
  2615. module.exports = new Directive({
  2616. update: function /*istanbul ignore next*/update(newValue) {
  2617. this.node.innerText = newValue;
  2618. }
  2619. });
  2620. /***/ }),
  2621. /* 65 */
  2622. /***/ (function(module, exports, __webpack_require__) {
  2623. /*istanbul ignore next*/'use strict';
  2624. var Directive = __webpack_require__(53);
  2625. module.exports = new Directive({
  2626. level: Directive.LP,
  2627. final: true
  2628. });
  2629. /***/ }),
  2630. /* 66 */
  2631. /***/ (function(module, exports, __webpack_require__) {
  2632. /*istanbul ignore next*/'use strict';
  2633. var Directive = __webpack_require__(53);
  2634. module.exports = new Directive({
  2635. literal: true,
  2636. update: function /*istanbul ignore next*/update(id) {
  2637. if (id in this.scope) {
  2638. throw new Error('Conflicting component id `' + id + '`');
  2639. }
  2640. this.scope[id] = this.node.$target || this.node;
  2641. }
  2642. });
  2643. /***/ }),
  2644. /* 67 */
  2645. /***/ (function(module, exports, __webpack_require__) {
  2646. /*istanbul ignore next*/'use strict';
  2647. var Directive = __webpack_require__(53);
  2648. module.exports = new Directive({
  2649. level: Directive.LC,
  2650. literal: true,
  2651. prefix: false,
  2652. bind: function /*istanbul ignore next*/bind() {
  2653. this.node.removeAttribute(this.attribute.name);
  2654. }
  2655. });
  2656. /***/ }),
  2657. /* 68 */
  2658. /***/ (function(module, exports, __webpack_require__) {
  2659. /*istanbul ignore next*/'use strict';
  2660. var Directive = __webpack_require__(53);
  2661. module.exports = new Directive({
  2662. update: function /*istanbul ignore next*/update(value) {
  2663. this.node.style.display = value ? '' : 'none';
  2664. }
  2665. });
  2666. /***/ }),
  2667. /* 69 */
  2668. /***/ (function(module, exports, __webpack_require__) {
  2669. /*istanbul ignore next*/'use strict';
  2670. var SelectDirective = __webpack_require__(70);
  2671. var EditableDirective = __webpack_require__(71);
  2672. var InputDirective = __webpack_require__(72);
  2673. var RadioDirective = __webpack_require__(73);
  2674. var CheckboxDirective = __webpack_require__(74);
  2675. var PropDirective = __webpack_require__(75);
  2676. var Directive = function Directive(options) {
  2677. var node = options.node;
  2678. var tagName = node.tagName;
  2679. if (options.decorates[0]) {
  2680. return new PropDirective(options);
  2681. } else if (tagName == 'INPUT') {
  2682. var type = node.getAttribute('type');
  2683. if (type == 'radio') {
  2684. return new RadioDirective(options);
  2685. } else if (type == 'checkbox') {
  2686. return new CheckboxDirective(options);
  2687. } else {
  2688. return new InputDirective(options);
  2689. }
  2690. } else if (tagName == 'TEXTAREA') {
  2691. return new InputDirective(options);
  2692. } else if (tagName == 'SELECT') {
  2693. return new SelectDirective(options);
  2694. } else if (node.isContentEditable) {
  2695. return new EditableDirective(options);
  2696. } else {
  2697. throw new Error( /*istanbul ignore next*/'Directive `model` cannot be used on `' + tagName + '`');
  2698. }
  2699. };
  2700. //手动添加 classOptions
  2701. Directive.options = {
  2702. level: Directive.LA
  2703. };
  2704. module.exports = Directive;
  2705. /***/ }),
  2706. /* 70 */
  2707. /***/ (function(module, exports, __webpack_require__) {
  2708. /*istanbul ignore next*/'use strict';
  2709. var Directive = __webpack_require__(53);
  2710. var EventEmitter = __webpack_require__(50);
  2711. var Scope = __webpack_require__(58);
  2712. module.exports = new Directive({
  2713. final: true,
  2714. /**
  2715. * 初始化指令
  2716. * @returns {void} 无返回
  2717. */
  2718. bind: function /*istanbul ignore next*/bind() {
  2719. this.backExpr = new this.Expression( /*istanbul ignore next*/this.attribute.value + '=_value_');
  2720. this.node.removeAttribute(this.attribute.name);
  2721. this._handler = this.compiler.compile(this.node);
  2722. this.emiter = new EventEmitter(this.node);
  2723. this.emiter.addListener('change', function () {
  2724. if (this.utils.isNull(this.scope)) return;
  2725. var selectedOptions = this.node.selectedOptions;
  2726. var value = this.node.multiple ? [].slice.call(selectedOptions).map(function (option) {
  2727. return option.value;
  2728. }, this) : selectedOptions[0].value;
  2729. this.backExpr.execute(new Scope(this.scope, {
  2730. _value_: value
  2731. }));
  2732. }.bind(this), false);
  2733. },
  2734. unbind: function /*istanbul ignore next*/unbind() {
  2735. this.emiter.removeListener();
  2736. },
  2737. execute: function /*istanbul ignore next*/execute(scope) {
  2738. this.scope = scope;
  2739. this._handler(scope);
  2740. var value = this.expression.execute(scope);
  2741. if (!this.utils.isArray(value)) value = [value];
  2742. [].slice.call(this.node.options).forEach(function (option) {
  2743. option.selected = value.indexOf(option.value) > -1;
  2744. }, this);
  2745. }
  2746. });
  2747. /***/ }),
  2748. /* 71 */
  2749. /***/ (function(module, exports, __webpack_require__) {
  2750. /*istanbul ignore next*/'use strict';
  2751. var Directive = __webpack_require__(53);
  2752. var EventEmitter = __webpack_require__(50);
  2753. var Scope = __webpack_require__(58);
  2754. module.exports = new Directive({
  2755. /**
  2756. * 初始化指令
  2757. * @returns {void} 无返回
  2758. */
  2759. bind: function /*istanbul ignore next*/bind() {
  2760. this.backExpr = new this.Expression( /*istanbul ignore next*/this.attribute.value + '=_value_');
  2761. this.emiter = new EventEmitter(this.node);
  2762. this.emiter.addListener('input', function () {
  2763. if (this.utils.isNull(this.scope)) return;
  2764. this.backExpr.execute(new Scope(this.scope, {
  2765. _value_: this.node.innerHTML
  2766. }));
  2767. }.bind(this), false);
  2768. },
  2769. unbind: function /*istanbul ignore next*/unbind() {
  2770. this.emiter.removeListener();
  2771. },
  2772. execute: function /*istanbul ignore next*/execute(scope) {
  2773. var value = this.expression.execute(scope);
  2774. if (this.node.innerHTML !== value) {
  2775. this.node.innerHTML = value;
  2776. }
  2777. }
  2778. });
  2779. /***/ }),
  2780. /* 72 */
  2781. /***/ (function(module, exports, __webpack_require__) {
  2782. /*istanbul ignore next*/'use strict';
  2783. var Directive = __webpack_require__(53);
  2784. var EventEmitter = __webpack_require__(50);
  2785. var Scope = __webpack_require__(58);
  2786. module.exports = new Directive({
  2787. /**
  2788. * 初始化指令
  2789. * @returns {void} 无返回
  2790. */
  2791. bind: function /*istanbul ignore next*/bind() {
  2792. this.backExpr = new this.Expression( /*istanbul ignore next*/this.attribute.value + '=_value_');
  2793. this.emiter = new EventEmitter(this.node);
  2794. this.emiter.addListener('input', function () {
  2795. if (this.utils.isNull(this.scope)) return;
  2796. this.backExpr.execute(new Scope(this.scope, {
  2797. _value_: this.node.value
  2798. }));
  2799. }.bind(this), false);
  2800. },
  2801. unbind: function /*istanbul ignore next*/unbind() {
  2802. this.emiter.removeListener();
  2803. },
  2804. execute: function /*istanbul ignore next*/execute(scope) {
  2805. var value = this.expression.execute(scope);
  2806. if (this.node.value !== value) {
  2807. this.node.value = value;
  2808. }
  2809. }
  2810. });
  2811. /***/ }),
  2812. /* 73 */
  2813. /***/ (function(module, exports, __webpack_require__) {
  2814. /*istanbul ignore next*/'use strict';
  2815. var Directive = __webpack_require__(53);
  2816. var EventEmitter = __webpack_require__(50);
  2817. var Scope = __webpack_require__(58);
  2818. module.exports = new Directive({
  2819. /**
  2820. * 初始化指令
  2821. * @returns {void} 无返回
  2822. */
  2823. bind: function /*istanbul ignore next*/bind() {
  2824. this.backExpr = new this.Expression( /*istanbul ignore next*/this.attribute.value + '=_value_');
  2825. this.emiter = new EventEmitter(this.node);
  2826. this.emiter.addListener('change', function () {
  2827. if (this.utils.isNull(this.scope)) return;
  2828. this.backExpr.execute(new Scope(this.scope, {
  2829. _value_: this.node.value
  2830. }));
  2831. }.bind(this), false);
  2832. },
  2833. unbind: function /*istanbul ignore next*/unbind() {
  2834. this.emiter.removeListener();
  2835. },
  2836. execute: function /*istanbul ignore next*/execute(scope) {
  2837. this.scope = scope;
  2838. var value = this.expression.execute(scope);
  2839. this.node.checked = value == this.node.value;
  2840. }
  2841. });
  2842. /***/ }),
  2843. /* 74 */
  2844. /***/ (function(module, exports, __webpack_require__) {
  2845. /*istanbul ignore next*/'use strict';
  2846. var Directive = __webpack_require__(53);
  2847. var EventEmitter = __webpack_require__(50);
  2848. var Scope = __webpack_require__(58);
  2849. module.exports = new Directive({
  2850. /**
  2851. * 初始化指令
  2852. * @returns {void} 无返回
  2853. */
  2854. bind: function /*istanbul ignore next*/bind() {
  2855. this.backExpr = new this.Expression( /*istanbul ignore next*/this.attribute.value + '=_value_');
  2856. this.emiter = new EventEmitter(this.node);
  2857. this.emiter.addListener('change', function () {
  2858. if (this.utils.isNull(this.scope)) return;
  2859. var value = this.expression.execute(this.scope);
  2860. if (this.utils.isArray(value) && this.node.checked) {
  2861. value.push(this.node.value);
  2862. } else if (this.utils.isArray(value) && !this.node.checked) {
  2863. var index = value.indexOf(this.node.value);
  2864. value.splice(index, 1);
  2865. } else {
  2866. this.backExpr.execute(new Scope(this.scope, {
  2867. _value_: this.node.checked
  2868. }));
  2869. }
  2870. }.bind(this), false);
  2871. },
  2872. unbind: function /*istanbul ignore next*/unbind() {
  2873. this.emiter.removeListener();
  2874. },
  2875. execute: function /*istanbul ignore next*/execute(scope) {
  2876. this.scope = scope;
  2877. var value = this.expression.execute(scope);
  2878. if (this.utils.isArray(value)) {
  2879. this.node.checked = value.indexOf(this.node.value) > -1;
  2880. } else {
  2881. this.node.checked = value;
  2882. }
  2883. }
  2884. });
  2885. /***/ }),
  2886. /* 75 */
  2887. /***/ (function(module, exports, __webpack_require__) {
  2888. /*istanbul ignore next*/'use strict';
  2889. var Directive = __webpack_require__(53);
  2890. var Scope = __webpack_require__(58);
  2891. module.exports = new Directive({
  2892. /**
  2893. * 初始化指令
  2894. * @returns {void} 无返回
  2895. */
  2896. bind: function /*istanbul ignore next*/bind() {
  2897. /*istanbul ignore next*/var _this = this;
  2898. this.target = this.node.$target;
  2899. this.backExpr = new this.Expression( /*istanbul ignore next*/this.attribute.value + '=_value_');
  2900. this.bindProp = this.decorates[0];
  2901. if (!this.target) {
  2902. throw new Error( /*istanbul ignore next*/'Directive `model:' + this.bindProp + '` cannot be used on `' + this.node.tagName + '`');
  2903. }
  2904. this.watcher = this.target.$watch(this.bindProp, function (value) {
  2905. if ( /*istanbul ignore next*/_this.utils.isNull( /*istanbul ignore next*/_this.scope)) return;
  2906. /*istanbul ignore next*/_this.backExpr.execute(new Scope( /*istanbul ignore next*/_this.scope, {
  2907. _value_: value
  2908. }));
  2909. });
  2910. },
  2911. unbind: function /*istanbul ignore next*/unbind() {
  2912. this.target.$unWatch(this.watcher);
  2913. },
  2914. update: function /*istanbul ignore next*/update(value) {
  2915. this.target[this.bindProp] = value;
  2916. }
  2917. });
  2918. /***/ }),
  2919. /* 76 */
  2920. /***/ (function(module, exports, __webpack_require__) {
  2921. /*istanbul ignore next*/'use strict';
  2922. var Directive = __webpack_require__(53);
  2923. module.exports = new Directive({
  2924. execute: function /*istanbul ignore next*/execute(scope) {
  2925. /*istanbul ignore next*/var _this = this;
  2926. var state = this.expression.execute(scope);
  2927. setTimeout(function () {
  2928. if (state) /*istanbul ignore next*/_this.node.focus();else /*istanbul ignore next*/_this.node.blur();
  2929. }, 0);
  2930. }
  2931. });
  2932. /***/ }),
  2933. /* 77 */
  2934. /***/ (function(module, exports, __webpack_require__) {
  2935. /*istanbul ignore next*/'use strict';
  2936. var Directive = __webpack_require__(53);
  2937. /**
  2938. * 通用的 attribute 指令
  2939. * 用于所有 attribute 的处理
  2940. * 例如:
  2941. * <div attr1="{{expr1}}" {{expr2}} {{attr3}}="{{expr3}}">
  2942. * </div>
  2943. */
  2944. module.exports = new Directive({
  2945. level: Directive.LA,
  2946. prefix: false,
  2947. literal: true,
  2948. remove: false,
  2949. /**
  2950. * 初始化指令
  2951. * @returns {void} 无返回
  2952. */
  2953. bind: function /*istanbul ignore next*/bind() {
  2954. this.computedName = this.attribute.name;
  2955. this.computedValue = this.attribute.value;
  2956. this.nameExpr = new this.Expression(this.attribute.name, true);
  2957. this.valueExpr = new this.Expression(this.attribute.value, true);
  2958. },
  2959. execute: function /*istanbul ignore next*/execute(scope) {
  2960. var target = this.node.$target || this.node;
  2961. var newComputedName = this.nameExpr.execute(scope);
  2962. if (this.computedName !== newComputedName) {
  2963. //移除旧名称
  2964. if (target.removeAttribute) {
  2965. target.removeAttribute(this.computedName);
  2966. }
  2967. //设置新名称
  2968. this.computedName = newComputedName;
  2969. if (!this.utils.isNull(this.computedName) && this.computedName.length > 0) {
  2970. if (target.setAttribute) {
  2971. target.setAttribute(this.computedName, this.computedValue || '');
  2972. }
  2973. }
  2974. }
  2975. var newComputeValue = this.valueExpr.execute(scope);
  2976. if (this.computedValue !== newComputeValue) {
  2977. this.computedValue = newComputeValue;
  2978. if (target.setAttribute) {
  2979. target.setAttribute(this.computedName, this.computedValue || '');
  2980. } else {
  2981. target[this.computedName] = this.computedValue;
  2982. }
  2983. }
  2984. }
  2985. });
  2986. /***/ }),
  2987. /* 78 */
  2988. /***/ (function(module, exports, __webpack_require__) {
  2989. /*istanbul ignore next*/'use strict';
  2990. var Class = __webpack_require__(4);
  2991. var Observer = __webpack_require__(6);
  2992. var EventEmitter = __webpack_require__(50);
  2993. var Compiler = __webpack_require__(52);
  2994. /**
  2995. * 模板类
  2996. * 可能通过 element 作为参数,创建一个模板实例
  2997. */
  2998. var Template = new Class({
  2999. $extends: EventEmitter,
  3000. /**
  3001. * 构建一个模板板实例
  3002. * @param {HTMLNode} element HTML 元素
  3003. * @param {Object} options 选项
  3004. * @returns {void} 无返回
  3005. */
  3006. constructor: function /*istanbul ignore next*/constructor(element, options) {
  3007. options = options || {};
  3008. EventEmitter.call(this);
  3009. this.options = options;
  3010. this.element = element;
  3011. this.compiler = options.compiler || new Compiler(options);
  3012. this.render = this.compiler.compile(this.element);
  3013. this.update = this.update.bind(this);
  3014. this._update = this._update.bind(this);
  3015. this._updateTimer = 0;
  3016. },
  3017. /**
  3018. * 更新当前模板 (会过滤不必要的更新)
  3019. * @returns {void} 无返回
  3020. */
  3021. update: function /*istanbul ignore next*/update() {
  3022. if (this._updateTimer) {
  3023. clearTimeout(this._updateTimer);
  3024. this._updateTimer = null;
  3025. }
  3026. this._updateTimer = setTimeout(this._update, 0);
  3027. },
  3028. /**
  3029. * 更新当前模板内部方法
  3030. * @returns {void} 无返回
  3031. */
  3032. _update: function /*istanbul ignore next*/_update() {
  3033. if (!this._updateTimer || !this.observer) return;
  3034. this.emit('update', this);
  3035. this.render(this.observer.target);
  3036. this._onBind();
  3037. },
  3038. /**
  3039. * 在绑定成功时
  3040. * @returns {void} 无返回
  3041. */
  3042. _onBind: function /*istanbul ignore next*/_onBind() {
  3043. if (this._bound) return;
  3044. this._bound = true;
  3045. this.emit('bind', this);
  3046. },
  3047. /**
  3048. * 将模板绑定到一个 scope
  3049. * @param {Object} scope 绑定的上下文对象
  3050. * @param {boolean} disableFirst 是否禁用第一次的自动渲染
  3051. * @returns {void} 无返回
  3052. */
  3053. bind: function /*istanbul ignore next*/bind(scope, disableFirst) {
  3054. if (!scope) return;
  3055. this.unbind();
  3056. this.observer = new Observer(scope, {
  3057. root: this.options.root
  3058. });
  3059. scope.$self = scope;
  3060. this.observer.on('change', this.update);
  3061. if (disableFirst) {
  3062. this._onBind();
  3063. } else {
  3064. this.update();
  3065. }
  3066. },
  3067. /**
  3068. * 解绑定
  3069. * @returns {void} 无返回
  3070. */
  3071. unbind: function /*istanbul ignore next*/unbind() {
  3072. if (!this.observer) return;
  3073. this.observer.removeListener('change', this.update);
  3074. this.observer.clearReference();
  3075. this.observer = null;
  3076. },
  3077. /**
  3078. * 释放
  3079. * @returns {void} 无返回
  3080. */
  3081. dispose: function /*istanbul ignore next*/dispose() {
  3082. this.unbind();
  3083. this.render.dispose();
  3084. }
  3085. });
  3086. module.exports = Template;
  3087. /***/ }),
  3088. /* 79 */
  3089. /***/ (function(module, exports, __webpack_require__) {
  3090. /*istanbul ignore next*/'use strict';
  3091. var Component = __webpack_require__(80);
  3092. var components = __webpack_require__(82);
  3093. var directives = __webpack_require__(51).directives;
  3094. Component.components = components;
  3095. Component.Component = Component;
  3096. Component.component = function (name, component) {
  3097. if (!component) return components[name];
  3098. components[name] = component;
  3099. };
  3100. Component.directive = function (name, directive) {
  3101. if (!directive) return directives[name];
  3102. directives[name] = directive;
  3103. };
  3104. module.exports = Component;
  3105. /***/ }),
  3106. /* 80 */
  3107. /***/ (function(module, exports, __webpack_require__) {
  3108. /*istanbul ignore next*/'use strict';
  3109. /*istanbul ignore next*/var _defineProperty = __webpack_require__(47);
  3110. var _defineProperty2 = _interopRequireDefault(_defineProperty);
  3111. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3112. var Class = __webpack_require__(4);
  3113. var Template = __webpack_require__(51);
  3114. var Watcher = __webpack_require__(5);
  3115. var utils = __webpack_require__(3);
  3116. var EventEmitter = __webpack_require__(50);
  3117. var Observer = __webpack_require__(6);
  3118. var ComponentDirective = __webpack_require__(81);
  3119. /**
  3120. * 组件类
  3121. * 用于定义一个新的组件
  3122. * @param {Object} classOpts 类选项
  3123. * @returns {Component} 组件类
  3124. */
  3125. function Component(classOpts) {
  3126. //处理组件选项
  3127. classOpts = classOpts || {};
  3128. //处理「继承」,目前的机制,只能用「合并类选项」
  3129. var mixes = classOpts.mixes;
  3130. delete classOpts.mixes;
  3131. if (mixes && !utils.isArray(mixes)) {
  3132. mixes = [mixes];
  3133. } else {
  3134. mixes = [];
  3135. }
  3136. var extendComponent = classOpts.extend || Component;
  3137. delete classOpts.extend;
  3138. //extend 会覆盖 mixes 中的同名成员
  3139. mixes.push(extendComponent);
  3140. //classOpts 会覆盖 extend 或 mixes 中的同名成员
  3141. mixes.push(classOpts);
  3142. var mixedClassOpts = {};
  3143. mixes.forEach(function (mixItem) {
  3144. if (mixItem instanceof Component || mixItem == Component) {
  3145. mixItem = mixItem.$options || {};
  3146. }
  3147. utils.mix(mixedClassOpts, mixItem);
  3148. });
  3149. classOpts = mixedClassOpts;
  3150. /**
  3151. * 定义组件类
  3152. * 可以通过 new ComponentClass() 创建组件实例
  3153. */
  3154. var ComponentClass = new Class({
  3155. $extends: extendComponent,
  3156. /**
  3157. * 组件类构造函数
  3158. * @param {object} instanceOpts 实例选项
  3159. * @returns {void} 无返回
  3160. */
  3161. constructor: function /*istanbul ignore next*/constructor(instanceOpts) {
  3162. /*istanbul ignore next*/var _this = this;
  3163. if (this == window) return new this.$class(instanceOpts);
  3164. EventEmitter.call(this);
  3165. instanceOpts = instanceOpts || {};
  3166. //创建组件实例时可以给实例添加成员
  3167. utils.each(instanceOpts, function (key, value) {
  3168. if (key in /*istanbul ignore next*/_this) return;
  3169. /*istanbul ignore next*/_this[key] = value;
  3170. });
  3171. this._onTemplateUpdate_ = this._onTemplateUpdate_.bind(this);
  3172. this._createdData_(classOpts.data);
  3173. this._createProperties_(classOpts.properties || classOpts.props);
  3174. this._createWatches_(classOpts.watches || classOpts.watch);
  3175. this.$directives = this.$directives || {};
  3176. this._importDirectives_(classOpts.directives);
  3177. this.$components = this.$components || {};
  3178. this._importComponents_(__webpack_require__(82));
  3179. this._importComponents_({
  3180. 'self': ComponentClass
  3181. });
  3182. this._importComponents_(classOpts.components);
  3183. utils.defineFreezeProp(this, '$children', []);
  3184. if (instanceOpts.parent) this.$setParent(instanceOpts.parent);
  3185. this.$callHook('init', [instanceOpts]);
  3186. Observer.observe(this);
  3187. if (classOpts.element) {
  3188. this.$mount();
  3189. } else {
  3190. this.$compile();
  3191. }
  3192. },
  3193. /**
  3194. * 设定父组件
  3195. * @param {Object} parent 父组件
  3196. * @returns {void} 无返回
  3197. */
  3198. $setParent: function /*istanbul ignore next*/$setParent(parent) {
  3199. if (this.$parent === parent) return;
  3200. if (this.$parent) {
  3201. this.$parent.$removeChild(this);
  3202. }
  3203. if (parent) {
  3204. parent.$addChild(this);
  3205. }
  3206. },
  3207. /**
  3208. * 添加子组件
  3209. * @param {Object} child 子组件
  3210. * @returns {void} 无返回
  3211. */
  3212. $addChild: function /*istanbul ignore next*/$addChild(child) {
  3213. if (!(child instanceof Component)) return;
  3214. this.$children.push(child);
  3215. utils.defineFreezeProp(child, '$parent', this);
  3216. utils.defineFreezeProp(child, '$root', this.$root || this);
  3217. },
  3218. /**
  3219. * 移除子组件
  3220. * @param {Object} child 子组件
  3221. * @returns {void} 无返回
  3222. */
  3223. $removeChild: function /*istanbul ignore next*/$removeChild(child) {
  3224. var index = this.$children.indexOf(child);
  3225. this.$children.splice(index, 1);
  3226. utils.defineFreezeProp(child, '$parent', null);
  3227. //utils.defineFreezeProp(child, '$root', null);
  3228. },
  3229. /**
  3230. * 获取根组件, 为了能通过 polyfill 处理 IE8 暂不用这种方式
  3231. */
  3232. get $root() {
  3233. if (this.$parent) {
  3234. return this.$parent.$root;
  3235. } else {
  3236. return this;
  3237. }
  3238. },
  3239. /**
  3240. * 导入用到的子组件类
  3241. * @param {Object} components 引入的组件
  3242. * @returns {void} 无返回
  3243. */
  3244. _importComponents_: function /*istanbul ignore next*/_importComponents_(components) {
  3245. utils.each(components, function (name, component) {
  3246. if (!component) return;
  3247. this.$components[name] = component;
  3248. this.$directives[name] = new ComponentDirective({
  3249. name: name,
  3250. component: component,
  3251. parent: this
  3252. });
  3253. }, this);
  3254. },
  3255. /**
  3256. * 导入一个用到的指令
  3257. * @param {Object} directives 引入的指令
  3258. * @returns {void} 无返回
  3259. */
  3260. _importDirectives_: function /*istanbul ignore next*/_importDirectives_(directives) {
  3261. utils.each(directives, function (name, directive) {
  3262. if (!directive) return;
  3263. this.$directives[name] = directive;
  3264. }, this);
  3265. },
  3266. /**
  3267. * 调用生命周期 hook
  3268. * @param {string} name 调用的 hook 名称
  3269. * @param {Array} args 调用 hook 的参数列表
  3270. * @returns {void} 无反回
  3271. */
  3272. $callHook: function /*istanbul ignore next*/$callHook(name, args) {
  3273. var hook = this[/*istanbul ignore next*/'on' + utils.firstUpper(name)];
  3274. if (!utils.isFunction(hook)) return;
  3275. hook.apply(this, args || []);
  3276. this.$emit( /*istanbul ignore next*/'$' + name, args);
  3277. },
  3278. /**
  3279. * 创建数据对象
  3280. * @param {Object} data 组件数据对象
  3281. * @returns {void} 无返回
  3282. */
  3283. _createdData_: function /*istanbul ignore next*/_createdData_(data) {
  3284. if (utils.isFunction(data)) {
  3285. this.$data = data.call(this);
  3286. } else {
  3287. this.$data = data || {};
  3288. }
  3289. utils.each(this.$data, function (name) {
  3290. /*istanbul ignore next*/(0, _defineProperty2.default)(this, name, {
  3291. configurable: true,
  3292. enumerable: true,
  3293. get: function /*istanbul ignore next*/get() {
  3294. if (!this.$data) return;
  3295. return this.$data[name];
  3296. },
  3297. set: function /*istanbul ignore next*/set(value) {
  3298. if (!this.$data) return;
  3299. this.$data[name] = value;
  3300. }
  3301. });
  3302. }, this);
  3303. },
  3304. /**
  3305. * 创建组件属性
  3306. * @param {Object} properties 属性定义对象
  3307. * @returns {void} 无返回
  3308. */
  3309. _createProperties_: function /*istanbul ignore next*/_createProperties_(properties) {
  3310. this.$properties = {};
  3311. utils.each(properties, function (name, descriptor) {
  3312. if (utils.isFunction(descriptor)) {
  3313. //get 简化写法
  3314. descriptor = {
  3315. get: descriptor
  3316. };
  3317. } else if (!utils.isObject(descriptor)) {
  3318. //基本类型
  3319. descriptor = {
  3320. value: descriptor
  3321. };
  3322. } else {
  3323. //通过 descriptor 定义 get/set/value
  3324. //不能直接用 descriptor,
  3325. //因为为会导到多个组件实例间的影响
  3326. descriptor = utils.copy(descriptor);
  3327. }
  3328. //如果 get/set 都没有,则自动生成
  3329. var hasGetterOrSetter = !!descriptor.get || !!descriptor.set;
  3330. if (!hasGetterOrSetter) {
  3331. descriptor.get = function () {
  3332. return descriptor.value;
  3333. };
  3334. descriptor.set = function (value) {
  3335. descriptor.value = value;
  3336. };
  3337. }
  3338. //定义为属性
  3339. /*istanbul ignore next*/(0, _defineProperty2.default)(this, name, {
  3340. configurable: true,
  3341. enumerable: true,
  3342. get: function /*istanbul ignore next*/get() {
  3343. if (!descriptor.get) {
  3344. throw new Error('Property `' + name + '` cannot be read');
  3345. }
  3346. return descriptor.get.call(this);
  3347. },
  3348. set: function /*istanbul ignore next*/set(value) {
  3349. if (!descriptor.set) {
  3350. throw new Error('Property `' + name + '` cannot be written');
  3351. }
  3352. if (descriptor.test && !descriptor.test(value)) {
  3353. throw new Error('Invalid value `' + value + '` for property `' + name + '`');
  3354. }
  3355. descriptor.set.call(this, value);
  3356. if (this._observer_) {
  3357. this._observer_.emitChange({
  3358. path: name,
  3359. value: value
  3360. });
  3361. }
  3362. }
  3363. });
  3364. this.$properties[name] = descriptor;
  3365. }, this);
  3366. },
  3367. /**
  3368. * 创建监控
  3369. * 为什么用 watches 而不是 watchers 或其它?
  3370. * 因为,这里仅是「监控配置」并且是「复数」
  3371. * @param {Object} watches 监控定义对象
  3372. * @returns {void} 无返回
  3373. */
  3374. _createWatches_: function /*istanbul ignore next*/_createWatches_(watches) {
  3375. this._watchers_ = this._watchers_ || [];
  3376. utils.each(watches, function (name, handler) {
  3377. this.$watch(name, handler);
  3378. }, this);
  3379. },
  3380. /**
  3381. * 在模板发生更新时
  3382. * @returns {void} 无返回
  3383. */
  3384. _onTemplateUpdate_: function /*istanbul ignore next*/_onTemplateUpdate_() {
  3385. this._watchers_.forEach(function (watcher) {
  3386. watcher.calc();
  3387. }, this);
  3388. },
  3389. /**
  3390. * 添加一个监控
  3391. * @param {string|function} path 计算函数或路径
  3392. * @param {function} handler 处理函数
  3393. * @returns {void} 无返回
  3394. */
  3395. $watch: function /*istanbul ignore next*/$watch(path, handler) {
  3396. if (!utils.isFunction(handler)) return;
  3397. var calcer = path;
  3398. if (!utils.isFunction(path)) {
  3399. calcer = function /*istanbul ignore next*/calcer() {
  3400. return utils.getByPath(this, path);
  3401. };
  3402. }
  3403. var watcher = new Watcher(calcer.bind(this), handler.bind(this));
  3404. this._watchers_.push(watcher);
  3405. return watcher;
  3406. },
  3407. /**
  3408. * 取消一个 watcher 对象
  3409. * @param {object} watcher 监控对象实例
  3410. * @returns {void} 无返回
  3411. */
  3412. $unWatch: function /*istanbul ignore next*/$unWatch(watcher) {
  3413. var index = this._watchers_.findIndex(function (w) /*istanbul ignore next*/{
  3414. return w === watcher;
  3415. });
  3416. this._watchers_.splice(index, 1);
  3417. },
  3418. /**
  3419. * 创建元素
  3420. * @returns {void} 无返回
  3421. */
  3422. _createElement_: function /*istanbul ignore next*/_createElement_() {
  3423. if (this._created_) return;
  3424. this._created_ = true;
  3425. this.$callHook('create');
  3426. utils.defineFreezeProp(this, '$element', this.element || ComponentClass.$template.cloneNode(true));
  3427. if (!this.$element || this.$element.nodeName === '#text') {
  3428. throw new Error('Invalid component template');
  3429. }
  3430. this.$callHook('created');
  3431. },
  3432. /**
  3433. * 编译自身模板并完成绑定
  3434. * @returns {void} 无返回
  3435. */
  3436. $compile: function /*istanbul ignore next*/$compile() {
  3437. if (this._compiled_) return;
  3438. this._compiled_ = true;
  3439. this._createElement_();
  3440. utils.defineFreezeProp(this, '_template_', new Template(this.$element, {
  3441. directives: this.$directives,
  3442. root: true
  3443. }));
  3444. this._template_.bind(this);
  3445. this._template_.on('update', this._onTemplateUpdate_);
  3446. this._template_.on('bind', function () {
  3447. if (!this.deferReady) this.$callHook('ready');
  3448. }.bind(this));
  3449. },
  3450. /**
  3451. * 向 DOM tree 中挂截组件
  3452. * @param {HTMLNode} mountNode 挂载点元素
  3453. * @param {append} append 是否 append 到挂载元素内
  3454. * @returns {void} 无返回
  3455. */
  3456. $mount: function /*istanbul ignore next*/$mount(mountNode, append) {
  3457. if (this._mounted_) return;
  3458. this.$compile();
  3459. this.$callHook('mount');
  3460. if (mountNode) {
  3461. mountNode.$substitute = this.$element;
  3462. this.$element._mountNode = mountNode;
  3463. if (append) {
  3464. mountNode.appendChild(this.$element);
  3465. } else if (mountNode.parentNode) {
  3466. mountNode.parentNode.insertBefore(this.$element, mountNode);
  3467. }
  3468. }
  3469. this._mounted_ = true;
  3470. this._removed_ = false;
  3471. this.$callHook('mounted');
  3472. },
  3473. /**
  3474. * 将组件添加到指定容器元素内
  3475. * @param {HTMLNode} node 容器元素
  3476. * @returns {void} 无返回
  3477. */
  3478. $appendTo: function /*istanbul ignore next*/$appendTo(node) {
  3479. this.$mount(node, true);
  3480. },
  3481. /**
  3482. * 移除组件
  3483. * @returns {void} 无返回
  3484. */
  3485. $remove: function /*istanbul ignore next*/$remove() {
  3486. if (this._removed_ || !this._mounted_) return;
  3487. this.$callHook('remove');
  3488. if (this.$element.parentNode) {
  3489. this.$element.parentNode.removeChild(this.$element);
  3490. }
  3491. this._removed_ = true;
  3492. this._mounted_ = false;
  3493. this.$callHook('removed');
  3494. },
  3495. /**
  3496. * 触发自身的一个事件并向上冒泡
  3497. * @param {string} name 事件名称
  3498. * @param {object} data 传递的对象
  3499. * @returns {void} 无返回
  3500. */
  3501. $dispatch: function /*istanbul ignore next*/$dispatch(name, data) {
  3502. var stopPropagation = this.$emit(name, data);
  3503. if (!stopPropagation && this.$parent) {
  3504. this.$parent.$dispatch(name, data);
  3505. }
  3506. },
  3507. /**
  3508. * 触发自身的一个事件并向下广播
  3509. * @param {string} name 事件名称
  3510. * @param {object} data 传递的对象
  3511. * @returns {void} 无返回
  3512. */
  3513. $broadcast: function /*istanbul ignore next*/$broadcast(name, data) {
  3514. var stopPropagation = this.$emit(name, data);
  3515. if (!stopPropagation && this.$children && this.$children.length > 0) {
  3516. this.$children.forEach(function (child) {
  3517. child.$broadcast(name, data);
  3518. }, this);
  3519. }
  3520. },
  3521. /**
  3522. * 释放组件
  3523. * @returns {void} 无返回
  3524. */
  3525. $dispose: function /*istanbul ignore next*/$dispose() {
  3526. this.$remove();
  3527. this._emitter_.off();
  3528. this.$children.forEach(function (child) {
  3529. child.$dispose();
  3530. }, this);
  3531. if (this.$parent) {
  3532. var index = this.$parent.$children.indexOf(this);
  3533. this.$parent.$children.splice(index, 1);
  3534. }
  3535. this.$callHook('dispose');
  3536. if (this._compiled_) {
  3537. this._template_.unbind();
  3538. }
  3539. this.$callHook('disposed');
  3540. for (var key in this) {
  3541. delete this[key];
  3542. }
  3543. ['_observer_', '$element', '$children', '$parent', '_template_'].forEach(function (key) {
  3544. delete this[key];
  3545. }, this);
  3546. utils.setPrototypeOf(this, null);
  3547. }
  3548. });
  3549. //保存类选项
  3550. ComponentClass.$options = classOpts;
  3551. ComponentClass.$template = utils.parseDom(classOpts.template);
  3552. //向 ComponentClass.prototype 上拷贝成员
  3553. utils.copy(classOpts, ComponentClass.prototype);
  3554. utils.copy(classOpts.methods, ComponentClass.prototype);
  3555. //使 ComponentClass instanceof Component === true
  3556. //IE9/10 下为 false,并且动态为 Component.prototype 添加的成员不会在 ComponentClass 上生效
  3557. utils.setPrototypeOf(ComponentClass, Component.prototype);
  3558. return ComponentClass;
  3559. }
  3560. //继承自 EventEmitter
  3561. Component.prototype = utils.create(EventEmitter.prototype);
  3562. //组件扩展方法,简单封装 extends
  3563. Component.extend = function (classOpts) {
  3564. return new Component(classOpts);
  3565. };
  3566. //定义扩展方法
  3567. Component.prototype.extend = function (classOpts) {
  3568. classOpts = classOpts || {};
  3569. classOpts.extend = this;
  3570. return new Component(classOpts);
  3571. };
  3572. //创建实例的方法
  3573. Component.prototype.create = function (instanceOpts) {
  3574. return new this(instanceOpts);
  3575. };
  3576. //针对包括 element 组件类的启动方法
  3577. Component.prototype.start = function (instanceOpts) {
  3578. if (!this.$options || !this.$options.element) {
  3579. throw new Error('Start method cannot be called');
  3580. }
  3581. return this.create(instanceOpts);
  3582. };
  3583. module.exports = Component;
  3584. /***/ }),
  3585. /* 81 */
  3586. /***/ (function(module, exports, __webpack_require__) {
  3587. /*istanbul ignore next*/'use strict';
  3588. var Template = __webpack_require__(51);
  3589. var Directive = Template.Directive;
  3590. /**
  3591. * 创建一个组件指令
  3592. * @param {object} options 选项
  3593. * @returns {object} 组件指令
  3594. */
  3595. function ComponentDirective(options) {
  3596. return new Directive({
  3597. type: Directive.TE,
  3598. literal: true,
  3599. final: true,
  3600. level: Directive.LE,
  3601. bind: function /*istanbul ignore next*/bind() {
  3602. this.component = new options.component({
  3603. deferReady: true,
  3604. parent: options.parent || this.scope
  3605. });
  3606. this.handleAttrs();
  3607. this.node.$target = this.component;
  3608. this.handler = this.compiler.compile(this.node, {
  3609. element: false,
  3610. children: false
  3611. });
  3612. this.handleContents();
  3613. this.component.$mount(this.node);
  3614. if (this.node.parentNode) {
  3615. this.node.parentNode.removeChild(this.node);
  3616. }
  3617. },
  3618. handleAttrs: function /*istanbul ignore next*/handleAttrs() {
  3619. this.attrs = [].slice.call(this.node.attributes);
  3620. var directiveRegexp = new RegExp('^' + this.prefix + ':', 'i');
  3621. this.attrs.forEach(function (attr) {
  3622. if (directiveRegexp.test(attr.name)) return;
  3623. if (attr.name in this.component.$properties) return;
  3624. this.component.$element.setAttribute(attr.name, attr.value);
  3625. this.node.removeAttribute(attr.name);
  3626. }, this);
  3627. },
  3628. handleContents: function /*istanbul ignore next*/handleContents() {
  3629. this.placeHandlers = [];
  3630. var places = [].slice.call(this.component.$element.querySelectorAll('[' + this.prefix + '\\:content]'));
  3631. places.forEach(function (place) {
  3632. //将内容插入到指定的「位置」
  3633. var contents = null;
  3634. var selector = place.getAttribute(this.prefix + ':content');
  3635. if (!selector) {
  3636. contents = [].slice.call(this.node.childNodes);
  3637. } else {
  3638. contents = [].slice.call(this.node.querySelectorAll(selector));
  3639. }
  3640. if (!contents || contents.length < 1) return;
  3641. place.innerHTML = '';
  3642. contents.forEach(function (content) {
  3643. place.appendChild(content.cloneNode(true));
  3644. }, this);
  3645. //编译插入后的子「内容模板」
  3646. var handler = this.compiler.compile(place);
  3647. this.placeHandlers.push(handler);
  3648. }, this);
  3649. },
  3650. execute: function /*istanbul ignore next*/execute(scope) {
  3651. this.handler(scope);
  3652. if (!this._ready_) {
  3653. this._ready_ = true;
  3654. this.component.$callHook('ready');
  3655. }
  3656. this.placeHandlers.forEach(function (handler) {
  3657. handler(scope);
  3658. }, this);
  3659. }
  3660. });
  3661. }
  3662. module.exports = ComponentDirective;
  3663. /***/ }),
  3664. /* 82 */
  3665. /***/ (function(module, exports, __webpack_require__) {
  3666. /*istanbul ignore next*/'use strict';
  3667. module.exports = {
  3668. View: __webpack_require__(83)
  3669. };
  3670. /***/ }),
  3671. /* 83 */
  3672. /***/ (function(module, exports, __webpack_require__) {
  3673. /*istanbul ignore next*/'use strict';
  3674. var Component = __webpack_require__(80);
  3675. var utils = __webpack_require__(3);
  3676. /**
  3677. * 内置视图组件
  3678. * 可以加载并显示其它组件,并可以指定「转场效果」
  3679. */
  3680. var View = new Component({
  3681. template: '<div></div>',
  3682. properties: {
  3683. /**
  3684. * 显示到视图中的组件
  3685. */
  3686. component: {
  3687. test: function /*istanbul ignore next*/test(value) {
  3688. if (!value) return false;
  3689. return value instanceof Component || utils.isString(value);
  3690. },
  3691. set: function /*istanbul ignore next*/set(component) {
  3692. if (this._transitioning) return;
  3693. this._transitioning = true;
  3694. //如果 value 是字符串则尝试从 $parent.components 中获取组件类
  3695. if (utils.isString(component)) {
  3696. if (this.$parent && this.$parent.$components) {
  3697. this.component = this.$parent.$components[component];
  3698. } else {
  3699. this.component = null;
  3700. }
  3701. return;
  3702. }
  3703. //声明新旧组件变量
  3704. var newComponentInstance = null;
  3705. var oldComponentInstance = this.componentInstance;
  3706. //创建新组件实例
  3707. if (utils.isFunction(component)) {
  3708. newComponentInstance = new component({
  3709. parent: this
  3710. });
  3711. } else {
  3712. component.$setParent(this);
  3713. newComponentInstance = component;
  3714. }
  3715. //通过转场控制器进行转场准备
  3716. this.transition.prep(newComponentInstance, oldComponentInstance);
  3717. //挂载新组件实例
  3718. newComponentInstance.$appendTo(this.$element);
  3719. //通过转场控制器进行转场
  3720. this.transition.go(newComponentInstance, oldComponentInstance, function () {
  3721. //触发相关事件
  3722. this.$emit('enter', newComponentInstance);
  3723. this.$emit('leave', oldComponentInstance);
  3724. //销毁旧组件实例
  3725. if (oldComponentInstance) {
  3726. oldComponentInstance.$dispose();
  3727. }
  3728. this._transitioning = false;
  3729. }.bind(this));
  3730. //暂存当前组件实例
  3731. this.componentInstance = newComponentInstance;
  3732. },
  3733. get: function /*istanbul ignore next*/get() {
  3734. return this._Component;
  3735. }
  3736. },
  3737. /**
  3738. * 视图的转场控制对象
  3739. */
  3740. transition: {
  3741. get: function /*istanbul ignore next*/get() {
  3742. return this._transition || View.transition;
  3743. },
  3744. set: function /*istanbul ignore next*/set(transition) {
  3745. if (this._transitioning) return;
  3746. if (!transition || utils.isFunction(transition.prep) && utils.isFunction(transition.go)) {
  3747. if (this._transition && utils.isFunction(this._transition.clean)) {
  3748. this._transition.clean(this);
  3749. }
  3750. if (transition && utils.isFunction(transition.init)) {
  3751. transition.init(this);
  3752. }
  3753. this._transition = transition;
  3754. } else {
  3755. throw new Error('Invalid transition');
  3756. }
  3757. }
  3758. }
  3759. },
  3760. /**
  3761. * 切换到指定的组件
  3762. * @param {Component} component 组件
  3763. * @param {transition} transition 转场控制组件
  3764. * @returns {void} 无返回
  3765. */
  3766. switchTo: function /*istanbul ignore next*/switchTo(component, transition) {
  3767. if (transition) {
  3768. this.transition = transition;
  3769. }
  3770. this.component = component;
  3771. }
  3772. });
  3773. /**
  3774. * 默认转场设置
  3775. */
  3776. View.transition = {
  3777. //init: function () { },
  3778. //clean: function () { },
  3779. /**
  3780. * 转场开始前的准备
  3781. * @param {Component} newComponent 新组件
  3782. * @param {Component} oldComponent 旧组件
  3783. * @returns {void} 无返回
  3784. */
  3785. prep: function /*istanbul ignore next*/prep(newComponent, oldComponent) {
  3786. if (oldComponent) oldComponent.$element.style.display = 'none';
  3787. },
  3788. /**
  3789. * 执行转场动画
  3790. * @param {Component} newComponent 新组件
  3791. * @param {Component} oldComponent 旧组件
  3792. * @param {Function} done 完成后的回调
  3793. * @returns {void} 无返回
  3794. */
  3795. go: function /*istanbul ignore next*/go(newComponent, oldComponent, done) {
  3796. done();
  3797. }
  3798. };
  3799. module.exports = View;
  3800. /***/ }),
  3801. /* 84 */
  3802. /***/ (function(module, exports, __webpack_require__) {
  3803. /*istanbul ignore next*/'use strict';
  3804. var mokit = __webpack_require__(1);
  3805. var items = __webpack_require__(85);
  3806. __webpack_require__(86);
  3807. var Toolbar = new mokit.Component({
  3808. template: __webpack_require__(88),
  3809. props: {
  3810. mditor: null
  3811. },
  3812. /*istanbul ignore next*/data: function data() {
  3813. return {
  3814. items: items.slice(0)
  3815. };
  3816. },
  3817. /*istanbul ignore next*/onReady: function onReady() {
  3818. this.bindCommands();
  3819. },
  3820. watch: {
  3821. /*istanbul ignore next*/items: function items() {
  3822. this.bindCommands();
  3823. }
  3824. },
  3825. /*istanbul ignore next*/bindCommands: function bindCommands() {
  3826. /*istanbul ignore next*/var _this = this;
  3827. if (!this.mditor) return;
  3828. this.items.forEach(function (item) {
  3829. /*istanbul ignore next*/_this.mditor.removeCommand(item.name);
  3830. /*istanbul ignore next*/_this.mditor.addCommand(item);
  3831. });
  3832. },
  3833. /*istanbul ignore next*/isActive: function isActive(item) {
  3834. return this.mditor && item.state && this.mditor[item.state];
  3835. },
  3836. /*istanbul ignore next*/exec: function exec(name, event) {
  3837. event.preventDefault();
  3838. this.mditor.execCommand(name, event);
  3839. },
  3840. /*istanbul ignore next*/getItem: function getItem(name) {
  3841. return this.items.find(function (item) /*istanbul ignore next*/{
  3842. return item.name === name;
  3843. });
  3844. },
  3845. /*istanbul ignore next*/removeItem: function removeItem(name) {
  3846. var index = this.items.findIndex(function (item) /*istanbul ignore next*/{
  3847. return item.name === name;
  3848. });
  3849. return this.items.splice(index, 1);
  3850. },
  3851. /*istanbul ignore next*/addItem: function addItem(item) {
  3852. this.items.push(item);
  3853. },
  3854. /*istanbul ignore next*/replaceItem: function replaceItem(name, newItem) {
  3855. var index = this.items.findIndex(function (item) /*istanbul ignore next*/{
  3856. return item.name === name;
  3857. });
  3858. var oldItem = this.items.splice(index, 1);
  3859. this.items.splice(index, 0, newItem);
  3860. return oldItem;
  3861. }
  3862. });
  3863. module.exports = Toolbar;
  3864. /***/ }),
  3865. /* 85 */
  3866. /***/ (function(module, exports) {
  3867. /*istanbul ignore next*/'use strict';
  3868. module.exports = [{
  3869. name: 'bold',
  3870. title: '粗体',
  3871. key: 'shift+alt+b',
  3872. /*istanbul ignore next*/handler: function handler() {
  3873. this.editor.wrapSelectText('**', '**');
  3874. }
  3875. }, {
  3876. name: 'italic',
  3877. title: '斜体',
  3878. key: 'shift+alt+i',
  3879. /*istanbul ignore next*/handler: function handler() {
  3880. this.editor.wrapSelectText('*', '*');
  3881. }
  3882. }, {
  3883. name: 'underline',
  3884. title: '下划线',
  3885. key: 'shift+alt+e',
  3886. /*istanbul ignore next*/handler: function handler() {
  3887. this.editor.wrapSelectText('<u>', '</u>');
  3888. }
  3889. }, {
  3890. name: 'strikethrough',
  3891. title: '删除线',
  3892. key: 'shift+alt+d',
  3893. /*istanbul ignore next*/handler: function handler() {
  3894. this.editor.wrapSelectText('~~', '~~');
  3895. }
  3896. }, {
  3897. name: 'header',
  3898. title: '标题',
  3899. key: 'shift+alt+1',
  3900. /*istanbul ignore next*/handler: function handler() {
  3901. this.editor.wrapSelectText('# ');
  3902. }
  3903. }, {
  3904. name: 'quote',
  3905. icon: 'quote-left',
  3906. title: '引用',
  3907. key: 'shift+alt+q',
  3908. /*istanbul ignore next*/handler: function handler() {
  3909. var selectText = this.editor.getSelectText();
  3910. if (selectText.length < 1) {
  3911. this.editor.wrapSelectText('> ');
  3912. return;
  3913. }
  3914. var textArray = selectText.split(this.EOL);
  3915. var buffer = [];
  3916. textArray.forEach(function (line) {
  3917. buffer.push('> ' + line + ' ');
  3918. });
  3919. this.editor.setSelectText(buffer.join(this.EOL) + this.EOL);
  3920. }
  3921. }, {
  3922. name: 'code',
  3923. title: '代码',
  3924. key: 'shift+alt+c',
  3925. /*istanbul ignore next*/handler: function handler() {
  3926. var lang = 'js' + this.EOL;
  3927. var before = '```' + lang;
  3928. var after = '``` ' + this.EOL;
  3929. var text = this.editor.getSelectText().trim();
  3930. if (text.length > 0) {
  3931. text += this.EOL;
  3932. }
  3933. this.editor.setSelectText(text);
  3934. this.editor.wrapSelectText(before, after);
  3935. var range = this.editor.getSelectRange();
  3936. var start = range.start - lang.length;
  3937. var end = range.start - this.EOL.length;
  3938. this.editor.setSelectRange(start, end);
  3939. }
  3940. }, {
  3941. name: 'list-ol',
  3942. title: '有序列表',
  3943. key: 'shift+alt+o',
  3944. /*istanbul ignore next*/handler: function handler() {
  3945. var selectText = this.editor.getSelectText();
  3946. if (selectText.length < 1) {
  3947. this.editor.wrapSelectText('1. ');
  3948. return;
  3949. }
  3950. var textArray = selectText.split(this.EOL);
  3951. var buffer = [];
  3952. for (var i = 0; i < textArray.length; i++) {
  3953. var line = textArray[i];
  3954. buffer.push(i + 1 + '. ' + line);
  3955. }
  3956. this.editor.setSelectText(buffer.join(this.EOL) + this.EOL);
  3957. }
  3958. }, {
  3959. name: 'list-ul',
  3960. title: '无序列表',
  3961. key: 'shift+alt+u',
  3962. /*istanbul ignore next*/handler: function handler() {
  3963. var selectText = this.editor.getSelectText();
  3964. if (selectText.length < 1) {
  3965. this.editor.wrapSelectText('- ');
  3966. return;
  3967. }
  3968. var textArray = selectText.split(this.EOL);
  3969. var buffer = [];
  3970. textArray.forEach(function (line) {
  3971. buffer.push('- ' + line);
  3972. });
  3973. this.editor.setSelectText(buffer.join(this.EOL) + this.EOL);
  3974. }
  3975. }, {
  3976. name: 'link',
  3977. title: '链接',
  3978. key: 'shift+alt+l',
  3979. /*istanbul ignore next*/handler: function handler() {
  3980. var text = this.editor.getSelectText();
  3981. if (!text || /^(https:|http:|ftp:|file:|mailto:|\/|\.)/i.test(text)) {
  3982. this.editor.wrapSelectText('[link](', ')');
  3983. if (!text) return;
  3984. var range = this.editor.getSelectRange();
  3985. var start = range.start - 6;
  3986. this.editor.setSelectRange(start, start + 4);
  3987. } else {
  3988. this.editor.wrapSelectText('[', ']()');
  3989. var _range = this.editor.getSelectRange();
  3990. var index = _range.end + 2;
  3991. this.editor.setSelectRange(index, index);
  3992. }
  3993. }
  3994. }, {
  3995. name: 'table',
  3996. title: '表格',
  3997. key: 'shift+alt+t',
  3998. /*istanbul ignore next*/handler: function handler() {
  3999. var buffer = ['column1 | column2 | column3 ', '------- | ------- | ------- ', 'column1 | column2 | column3 ', 'column1 | column2 | column3 ', 'column1 | column2 | column3 '];
  4000. this.editor.wrapSelectText(buffer.join(this.EOL) + this.EOL);
  4001. }
  4002. }, {
  4003. name: 'line',
  4004. title: '分隔线',
  4005. icon: 'minus',
  4006. key: 'shift+alt+h',
  4007. /*istanbul ignore next*/handler: function handler() {
  4008. this.editor.wrapSelectText('----' + this.EOL);
  4009. }
  4010. }, {
  4011. name: 'image',
  4012. title: '图片',
  4013. key: 'shift+alt+p',
  4014. /*istanbul ignore next*/handler: function handler() {
  4015. this.editor.wrapSelectText('![alt](', ')');
  4016. }
  4017. }, {
  4018. name: 'help',
  4019. title: '帮助',
  4020. icon: 'question',
  4021. key: 'shift+alt+/',
  4022. /*istanbul ignore next*/handler: function handler() {
  4023. window.open('http://mditor.com', '_blank');
  4024. }
  4025. }, {
  4026. name: 'toggleFullScreen',
  4027. title: '全屏',
  4028. icon: 'arrows-alt',
  4029. key: 'shift+alt+f',
  4030. control: true,
  4031. state: 'fullscreen',
  4032. owner: function /*istanbul ignore next*/owner(mditor) {
  4033. return mditor.$element;
  4034. },
  4035. /*istanbul ignore next*/handler: function handler() {
  4036. this.fullscreen = !this.fullscreen;
  4037. }
  4038. }, {
  4039. name: 'togglePreview',
  4040. title: '预览',
  4041. icon: 'desktop',
  4042. key: 'shift+alt+v',
  4043. control: true,
  4044. state: 'preview',
  4045. owner: function /*istanbul ignore next*/owner(mditor) {
  4046. return mditor.$element;
  4047. },
  4048. /*istanbul ignore next*/handler: function handler() {
  4049. this.preview = !this.preview;
  4050. if (this.preview) {
  4051. this._split = this.split;
  4052. this.split = false;
  4053. } else {
  4054. this.split = this._split;
  4055. }
  4056. }
  4057. }, {
  4058. name: 'toggleSplit',
  4059. title: '分屏',
  4060. icon: 'columns',
  4061. key: 'shift+alt+s',
  4062. control: true,
  4063. state: 'split',
  4064. owner: function /*istanbul ignore next*/owner(mditor) {
  4065. return mditor.$element;
  4066. },
  4067. /*istanbul ignore next*/handler: function handler() {
  4068. this.split = !this.split;
  4069. if (this.split) {
  4070. this.preview = false;
  4071. }
  4072. }
  4073. }];
  4074. /***/ }),
  4075. /* 86 */
  4076. /***/ (function(module, exports) {
  4077. // removed by extract-text-webpack-plugin
  4078. /***/ }),
  4079. /* 87 */,
  4080. /* 88 */
  4081. /***/ (function(module, exports) {
  4082. module.exports = "<ul class=\"toolbar\">\n <i m:each=\"item of items\" data-cmd=\"{{item.name}}\" m:on:click=\"exec(item.name,$event)\" class=\"item fa fa-{{item.icon || item.name}} {{isActive(item)?'active':''}} {{item.control?'control':''}}\" title=\"{{item.title || item.name}} {{item.key}}\"></i>\n</ul>"
  4083. /***/ }),
  4084. /* 89 */
  4085. /***/ (function(module, exports, __webpack_require__) {
  4086. /*istanbul ignore next*/'use strict';
  4087. var mokit = __webpack_require__(1);
  4088. var EventEmitter = mokit.EventEmitter;
  4089. var utils = __webpack_require__(3);
  4090. var Stack = __webpack_require__(90);
  4091. var commands = __webpack_require__(91);
  4092. __webpack_require__(92);
  4093. var ua = window.navigator.userAgent.toLowerCase();
  4094. var isIE = !!ua.match(/msie|trident\/7|edge/);
  4095. //const isWinPhone = ua.indexOf('windows phone') !== -1;
  4096. //const isIOS = !isWinPhone && !!ua.match(/ipad|iphone|ipod/);
  4097. module.exports = new mokit.Component({
  4098. template: __webpack_require__(93),
  4099. props: {
  4100. mditor: null,
  4101. value: null,
  4102. markExp: null
  4103. },
  4104. /*istanbul ignore next*/onReady: function onReady() {
  4105. /*istanbul ignore next*/var _this = this;
  4106. this.stack = new Stack();
  4107. setTimeout(function () {
  4108. /*istanbul ignore next*/_this.textareaEmitter = new EventEmitter( /*istanbul ignore next*/_this.textarea);
  4109. /*istanbul ignore next*/_this.stack.init({
  4110. value: /*istanbul ignore next*/_this.getValue()
  4111. });
  4112. }, 300);
  4113. this._bindCommands();
  4114. },
  4115. /*istanbul ignore next*/_bindCommands: function _bindCommands() {
  4116. /*istanbul ignore next*/var _this2 = this;
  4117. commands.forEach(function (item) {
  4118. /*istanbul ignore next*/_this2.mditor.removeCommand(item.name);
  4119. /*istanbul ignore next*/_this2.mditor.addCommand(item);
  4120. });
  4121. },
  4122. /*istanbul ignore next*/onCompositionStart: function onCompositionStart() {
  4123. this._compositionLock = true;
  4124. },
  4125. /*istanbul ignore next*/onCompositionEnd: function onCompositionEnd() {
  4126. /*istanbul ignore next*/var _this3 = this;
  4127. this._compositionLock = false;
  4128. setTimeout(function () /*istanbul ignore next*/{
  4129. return (/*istanbul ignore next*/_this3.onInput()
  4130. );
  4131. }, 300);
  4132. /**
  4133. * 在输入中文时,输入法「候选词面板」位置会发生定位错误
  4134. * 经过反复尝试发现了「规律」,第一次「侯选词」上屏后才会位置错误
  4135. * 在「候选词」上屏后让输入框「失去焦点再获取焦点」可「规避」这个 Bug
  4136. * 附上相关 issues
  4137. * https://github.com/electron/electron/issues/8894
  4138. * https://github.com/electron/electron/issues/4539
  4139. */
  4140. // this.textarea.blur();
  4141. // this.textarea.focus();
  4142. },
  4143. /*istanbul ignore next*/onInput: function onInput() {
  4144. /*istanbul ignore next*/var _this4 = this;
  4145. this.$emit('input');
  4146. if (this._changedTimer) {
  4147. clearTimeout(this._changedTimer);
  4148. this._changedTimer = null;
  4149. }
  4150. if (this._compositionLock) return;
  4151. this._changedTimer = setTimeout(function () {
  4152. if (! /*istanbul ignore next*/_this4._changedTimer) return;
  4153. /*istanbul ignore next*/_this4.stack.push({
  4154. value: /*istanbul ignore next*/_this4.getValue(),
  4155. range: /*istanbul ignore next*/_this4.getSelectRange()
  4156. });
  4157. /*istanbul ignore next*/_this4.$emit('changed');
  4158. }, 300);
  4159. },
  4160. /*istanbul ignore next*/undo: function undo() {
  4161. /*istanbul ignore next*/var _this5 = this;
  4162. var last = this.stack.last();
  4163. var item = this.stack.undo();
  4164. if (utils.isNull(item) || utils.isNull(item.value)) return;
  4165. var valGap = last.value.length - item.value.length;
  4166. this.value = item.value;
  4167. if (last.range) {
  4168. setTimeout(function () {
  4169. var start = last.range.start - valGap;
  4170. var end = last.range.end - valGap;
  4171. /*istanbul ignore next*/_this5.setSelectRange(start, end);
  4172. });
  4173. }
  4174. },
  4175. /*istanbul ignore next*/redo: function redo() {
  4176. /*istanbul ignore next*/var _this6 = this;
  4177. var item = this.stack.redo();
  4178. if (utils.isNull(item) || utils.isNull(item.value)) return;
  4179. this.value = item.value;
  4180. if (item.range) {
  4181. setTimeout(function () {
  4182. /*istanbul ignore next*/_this6.setSelectRange(item.range.start, item.range.end);
  4183. });
  4184. }
  4185. },
  4186. /*istanbul ignore next*/onPaste: function onPaste(event) {
  4187. this.$emit('paste', event);
  4188. },
  4189. /*istanbul ignore next*/onDragover: function onDragover(event) {
  4190. event.preventDefault();
  4191. this.$emit('dragover', event);
  4192. },
  4193. /*istanbul ignore next*/onDrop: function onDrop(event) {
  4194. event.preventDefault();
  4195. this.$emit('drop', event);
  4196. },
  4197. /*istanbul ignore next*/focus: function focus() {
  4198. this.textarea.focus();
  4199. },
  4200. /*istanbul ignore next*/blur: function blur() {
  4201. this.textarea.blur();
  4202. },
  4203. /*istanbul ignore next*/onScroll: function onScroll(event) {
  4204. this.syncScroll();
  4205. this.$emit('scroll', event);
  4206. },
  4207. /*istanbul ignore next*/syncScroll: function syncScroll(disTwice) {
  4208. /*istanbul ignore next*/var _this7 = this;
  4209. this.marks.scrollTop = this.textarea.scrollTop;
  4210. this.marks.scrollLeft = this.textarea.scrollLeft;
  4211. if (disTwice) return;
  4212. setTimeout(function () {
  4213. /*istanbul ignore next*/_this7.syncScroll(true);
  4214. }, 0);
  4215. },
  4216. /*istanbul ignore next*/applyMarks: function applyMarks(text) {
  4217. if (!text || !this.markExp) return;
  4218. text = text.replace(/\n$/g, '\n\n').replace(this.markExp, '<mark>$&</mark>');
  4219. if (isIE) {
  4220. // IE wraps whitespace differently in a div vs textarea, this fixes it
  4221. text = text.replace(/ /g, ' <wbr>');
  4222. }
  4223. return text;
  4224. },
  4225. /*istanbul ignore next*/activeMark: function activeMark(index) {
  4226. var marks = [].slice.call(this.marks.querySelectorAll('mark'));
  4227. if (marks.length < 1) return;
  4228. this.activeMarkIndex = utils.isNull(this.activeMarkIndex) ? -1 : this.activeMarkIndex;
  4229. if (utils.isNull(index)) {
  4230. this.activeMarkIndex++;
  4231. } else {
  4232. this.activeMarkIndex = index;
  4233. }
  4234. if (this.activeMarkIndex >= marks.length) {
  4235. this.activeMarkIndex = 0;
  4236. }
  4237. marks.forEach(function (mark) {
  4238. mark.classList.remove('active');
  4239. });
  4240. var activeMark = marks[this.activeMarkIndex];
  4241. activeMark.classList.add('active');
  4242. this.scrollToMark(activeMark);
  4243. },
  4244. /*istanbul ignore next*/scrollToMark: function scrollToMark(mark) {
  4245. // mark.scrollIntoView();
  4246. // this.textarea.scrollTop = this.marks.scrollTop;
  4247. // this.textarea.scrollTop -= 20;
  4248. this.textarea.scrollTop = mark.offsetTop - 20;
  4249. },
  4250. /*istanbul ignore next*/getValue: function getValue() {
  4251. return this.textarea.value;
  4252. },
  4253. /*istanbul ignore next*/setValue: function setValue(value) {
  4254. this.textarea.value = value;
  4255. },
  4256. /*istanbul ignore next*/getActiveElement: function getActiveElement() {
  4257. this.textarea.focus();
  4258. return document.activeElement;
  4259. },
  4260. /*istanbul ignore next*/getSelectRange: function getSelectRange() {
  4261. var box = this.getActiveElement();
  4262. return {
  4263. 'start': box.selectionStart,
  4264. 'end': box.selectionEnd
  4265. };
  4266. },
  4267. /*istanbul ignore next*/setSelectRange: function setSelectRange(start, end) {
  4268. var box = this.getActiveElement();
  4269. box.setSelectionRange(start, end);
  4270. },
  4271. /*istanbul ignore next*/getSelectText: function getSelectText() {
  4272. var box = this.getActiveElement();
  4273. var range = this.getSelectRange();
  4274. return box.value.substring(range.start, range.end);
  4275. },
  4276. /*istanbul ignore next*/setSelectText: function setSelectText(text) {
  4277. /*istanbul ignore next*/var _this8 = this;
  4278. var box = this.getActiveElement();
  4279. var range = this.getSelectRange();
  4280. box.setRangeText(text);
  4281. if (range.end == range.start) {
  4282. this.setSelectRange(range.start, range.end + text.length);
  4283. }
  4284. this.value = this.getValue();
  4285. this.onInput();
  4286. setTimeout(function () {
  4287. /*istanbul ignore next*/_this8.blur();
  4288. /*istanbul ignore next*/_this8.focus();
  4289. }, 0);
  4290. },
  4291. /*istanbul ignore next*/wrapSelectText: function wrapSelectText(before, after) {
  4292. before = before !== null && before !== undefined ? before : '';
  4293. after = after !== null && after !== undefined ? after : '';
  4294. var range = this.getSelectRange();
  4295. var text = this.getSelectText();
  4296. this.setSelectText(before + text + after);
  4297. var newStart = range.start + before.length;
  4298. var newEnd = range.end + before.length;
  4299. this.setSelectRange(newStart, newEnd);
  4300. },
  4301. /*istanbul ignore next*/insertBeforeText: function insertBeforeText(text) {
  4302. this.wrapSelectText(text);
  4303. },
  4304. /*istanbul ignore next*/insertAfterText: function insertAfterText(text) {
  4305. this.wrapSelectText('', text);
  4306. },
  4307. /*istanbul ignore next*/getBeforeText: function getBeforeText(length) {
  4308. var range = this.getSelectRange();
  4309. var end = range.start;
  4310. var start = end - length;
  4311. var value = this.getValue();
  4312. return value.substring(start, end);
  4313. },
  4314. /*istanbul ignore next*/getBeforeFirstCharIndex: function getBeforeFirstCharIndex(char) {
  4315. var range = this.getSelectRange();
  4316. var end = range.start;
  4317. var start = 0;
  4318. var value = this.getValue();
  4319. return value.substring(start, end).lastIndexOf(char);
  4320. },
  4321. /*istanbul ignore next*/getBeforeWord: function getBeforeWord() {
  4322. /*istanbul ignore next*/var _this9 = this;
  4323. var chars = [' ', '\t', this.mditor.EOL];
  4324. var start = 0;
  4325. chars.forEach(function (char) {
  4326. var index = /*istanbul ignore next*/_this9.getBeforeFirstCharIndex(char);
  4327. if (index + char.length > start) {
  4328. start = index + char.length;
  4329. }
  4330. });
  4331. var range = this.getSelectRange();
  4332. var value = this.getValue();
  4333. return value.substring(start, range.end);
  4334. },
  4335. /*istanbul ignore next*/getBeforeTextInLine: function getBeforeTextInLine() {
  4336. var start = this.getBeforeFirstCharIndex(this.mditor.EOL) + this.mditor.EOL.length;
  4337. var range = this.getSelectRange();
  4338. var value = this.getValue();
  4339. return value.substring(start, range.end);
  4340. },
  4341. /*istanbul ignore next*/selectBeforeText: function selectBeforeText(length) {
  4342. var range = this.getSelectRange();
  4343. this.setSelectRange(range.start - length, range.end);
  4344. },
  4345. /*istanbul ignore next*/selectAfterText: function selectAfterText(length) {
  4346. var range = this.getSelectRange();
  4347. this.setSelectRange(range.start, range.end + length);
  4348. },
  4349. /*istanbul ignore next*/selectBeforeTextInLine: function selectBeforeTextInLine() {
  4350. var start = this.getBeforeFirstCharIndex(this.mditor.EOL) + this.mditor.EOL.length;
  4351. var range = this.getSelectRange();
  4352. this.setSelectRange(start, range.end);
  4353. },
  4354. /*istanbul ignore next*/addIndent: function addIndent() {
  4355. /*istanbul ignore next*/var _this10 = this;
  4356. var selectText = this.getSelectText();
  4357. if (selectText.length < 1) {
  4358. this.insertBeforeText(this.mditor.INDENT);
  4359. return;
  4360. }
  4361. var textArray = selectText.split(this.mditor.EOL);
  4362. var buffer = [];
  4363. var lineCount = textArray.length - 1;
  4364. textArray.forEach(function (line, index) {
  4365. line = line.trim() !== '' ? /*istanbul ignore next*/_this10.mditor.INDENT + line : line;
  4366. if (index < lineCount || line.trim() !== '') {
  4367. buffer.push(line);
  4368. }
  4369. });
  4370. this.setSelectText(buffer.join(this.mditor.EOL));
  4371. },
  4372. /*istanbul ignore next*/removeIndent: function removeIndent() {
  4373. /*istanbul ignore next*/var _this11 = this;
  4374. var indentRegExp = new RegExp('^' + this.mditor.INDENT);
  4375. var selectText = this.getSelectText();
  4376. if (selectText.length < 1) {
  4377. this.selectBeforeTextInLine();
  4378. if (this.getSelectText().length > 0) {
  4379. event.clearSelected = true;
  4380. this.removeIndent();
  4381. }
  4382. return;
  4383. }
  4384. var textArray = selectText.split(this.mditor.EOL);
  4385. var buffer = [];
  4386. textArray.forEach(function (line) {
  4387. if (indentRegExp.test(line)) {
  4388. line = line.replace( /*istanbul ignore next*/_this11.mditor.INDENT, '');
  4389. }
  4390. buffer.push(line);
  4391. });
  4392. this.setSelectText(buffer.join(this.mditor.EOL));
  4393. if (event.clearSelected) {
  4394. var range = this.getSelectRange();
  4395. this.setSelectRange(range.end, range.end);
  4396. }
  4397. }
  4398. });
  4399. /***/ }),
  4400. /* 90 */
  4401. /***/ (function(module, exports, __webpack_require__) {
  4402. /*istanbul ignore next*/'use strict';
  4403. var Class = __webpack_require__(4).Class;
  4404. var utils = __webpack_require__(3);
  4405. var Stack = new Class({
  4406. /*istanbul ignore next*/constructor: function constructor(item) {
  4407. this.init(item);
  4408. },
  4409. /*istanbul ignore next*/init: function init(item) {
  4410. this.undoList = [item || {
  4411. value: null
  4412. }];
  4413. this.redoList = [];
  4414. },
  4415. /*istanbul ignore next*/push: function push(item) {
  4416. if (this.last() === item) return;
  4417. this.undoList.push(item);
  4418. },
  4419. /*istanbul ignore next*/last: function last() {
  4420. return this.undoList[this.undoList.length - 1];
  4421. },
  4422. /*istanbul ignore next*/undo: function undo() {
  4423. if (this.undoList.length > 1) {
  4424. var item = this.undoList.pop();
  4425. if (utils.isNull(item) || utils.isNull(item.value)) return;
  4426. this.redoList.push(item);
  4427. }
  4428. return this.last();
  4429. },
  4430. /*istanbul ignore next*/redo: function redo() {
  4431. var item = this.redoList.pop();
  4432. if (utils.isNull(item) || utils.isNull(item.value)) return;
  4433. this.undoList.push(item);
  4434. return item;
  4435. }
  4436. });
  4437. module.exports = Stack;
  4438. /***/ }),
  4439. /* 91 */
  4440. /***/ (function(module, exports) {
  4441. /*istanbul ignore next*/'use strict';
  4442. module.exports = [{
  4443. name: 'undo',
  4444. key: '{cmd}+z',
  4445. /*istanbul ignore next*/handler: function handler() {
  4446. this.editor.undo();
  4447. }
  4448. }, {
  4449. name: 'redo',
  4450. key: '{cmd}+shift+z',
  4451. /*istanbul ignore next*/handler: function handler() {
  4452. this.editor.redo();
  4453. }
  4454. }, {
  4455. name: 'h2',
  4456. key: 'shift+alt+2',
  4457. /*istanbul ignore next*/handler: function handler() {
  4458. this.editor.wrapSelectText('## ');
  4459. }
  4460. }, {
  4461. name: 'h3',
  4462. key: 'shift+alt+3',
  4463. /*istanbul ignore next*/handler: function handler() {
  4464. this.editor.wrapSelectText('### ');
  4465. }
  4466. }, {
  4467. name: 'h4',
  4468. key: 'shift+alt+4',
  4469. /*istanbul ignore next*/handler: function handler() {
  4470. this.editor.wrapSelectText('#### ');
  4471. }
  4472. }, {
  4473. name: 'h5',
  4474. key: 'shift+alt+5',
  4475. /*istanbul ignore next*/handler: function handler() {
  4476. this.editor.wrapSelectText('##### ');
  4477. }
  4478. }];
  4479. /***/ }),
  4480. /* 92 */
  4481. /***/ (function(module, exports) {
  4482. // removed by extract-text-webpack-plugin
  4483. /***/ }),
  4484. /* 93 */
  4485. /***/ (function(module, exports) {
  4486. module.exports = "<div class=\"editor\">\n <div class=\"backdrop\" m:id=\"marks\">\n <div class=\"inner\" m:html=\"applyMarks(value)\"></div>\n </div>\n <textarea class=\"textarea\" m:id=\"textarea\" m:model=\"value\" m:on:paste=\"onPaste\" m:on:dragover=\"onDragover\" m:on:drop=\"onDrop\"\n m:on:scroll=\"onScroll()\" m:on:input=\"onInput\" m:on:compositionStart=\"onCompositionStart\" m:on:compositionEnd=\"onCompositionEnd\"></textarea>\n</div>"
  4487. /***/ }),
  4488. /* 94 */
  4489. /***/ (function(module, exports, __webpack_require__) {
  4490. /*istanbul ignore next*/'use strict';
  4491. var mokit = __webpack_require__(1);
  4492. __webpack_require__(95);
  4493. var Viewer = new mokit.Component({
  4494. template: __webpack_require__(96),
  4495. /*istanbul ignore next*/data: function data() {
  4496. return {
  4497. html: '',
  4498. alert: '预览区域'
  4499. };
  4500. },
  4501. props: {
  4502. mditor: null,
  4503. value: {
  4504. /*istanbul ignore next*/get: function get() {
  4505. return this._value;
  4506. },
  4507. /*istanbul ignore next*/set: function set(value) {
  4508. /*istanbul ignore next*/var _this = this;
  4509. this._value = value;
  4510. var beforeEvent = { value: this._value };
  4511. this.$emit('beforeRender', beforeEvent);
  4512. this.mditor.parser.parse(beforeEvent.value, function (err, result) {
  4513. var afterEvent = { value: result || err };
  4514. /*istanbul ignore next*/_this.$emit('afterRender', afterEvent);
  4515. /*istanbul ignore next*/_this.html = afterEvent.value;
  4516. });
  4517. }
  4518. }
  4519. },
  4520. /*istanbul ignore next*/onClick: function onClick(event) {
  4521. event.preventDefault();
  4522. var tag = event.target;
  4523. if (tag.tagName == 'A') {
  4524. var href = tag.getAttribute('href');
  4525. if (href) window.open(href, '_blank');
  4526. }
  4527. }
  4528. });
  4529. module.exports = Viewer;
  4530. /***/ }),
  4531. /* 95 */
  4532. /***/ (function(module, exports) {
  4533. // removed by extract-text-webpack-plugin
  4534. /***/ }),
  4535. /* 96 */
  4536. /***/ (function(module, exports) {
  4537. module.exports = "<div class=\"viewer\" m:on:click=\"onClick\">\n <div m:show=\"html\" class=\"markdown-body\" m:html=\"html\"></div>\n <div m:show=\"!html\" class=\"alert\" m:html=\"alert\"></div>\n</div>"
  4538. /***/ }),
  4539. /* 97 */
  4540. /***/ (function(module, exports, __webpack_require__) {
  4541. /*istanbul ignore next*/'use strict';
  4542. var mokit = __webpack_require__(1);
  4543. var utils = __webpack_require__(3);
  4544. __webpack_require__(98);
  4545. var CHECK_REGEXP = /^\/[\s\S]+\/(i|g|m)*$/;
  4546. var Finder = new mokit.Component({
  4547. template: __webpack_require__(99),
  4548. props: {
  4549. mditor: null,
  4550. active: false,
  4551. findWord: '',
  4552. replaceWord: ''
  4553. },
  4554. /*istanbul ignore next*/onReady: function onReady() {
  4555. this.mditor.removeCommand('find');
  4556. this.mditor.addCommand({
  4557. name: 'find',
  4558. key: '{cmd}+f',
  4559. owner: this.mditor.$element,
  4560. handler: this.show.bind(this, null)
  4561. });
  4562. this.mditor.removeCommand('cancel-find');
  4563. this.mditor.addCommand({
  4564. name: 'cancel-find',
  4565. key: 'esc',
  4566. owner: this.mditor.$element,
  4567. handler: this.hide.bind(this)
  4568. });
  4569. },
  4570. /*istanbul ignore next*/hide: function hide() {
  4571. this.findWord = '';
  4572. this.replaceWord = '';
  4573. this.mditor.editor.markExp = null;
  4574. this.active = false;
  4575. },
  4576. /*istanbul ignore next*/show: function show(text) {
  4577. /*istanbul ignore next*/var _this = this;
  4578. this.active = true;
  4579. this.findWord = text || this.mditor.editor.getSelectText();
  4580. if (this.active) {
  4581. setTimeout(function () {
  4582. /*istanbul ignore next*/_this.findBox.focus();
  4583. }, 200);
  4584. }
  4585. this.mditor.editor.syncScroll();
  4586. },
  4587. watch: {
  4588. /*istanbul ignore next*/findWord: function findWord() {
  4589. /*istanbul ignore next*/var _this2 = this;
  4590. if (!this.mditor || !this.mditor.editor) return;
  4591. if (!this.findWord) {
  4592. this.mditor.editor.markExp = null;
  4593. } else {
  4594. this.mditor.editor.markExp = this.parseRegexp(this.findWord);
  4595. }
  4596. setTimeout(function () {
  4597. /*istanbul ignore next*/_this2.mditor.editor.activeMark(0);
  4598. }, 100);
  4599. }
  4600. },
  4601. /*istanbul ignore next*/parseRegexp: function parseRegexp(text, forceStr) {
  4602. if (!forceStr && CHECK_REGEXP.test(text)) {
  4603. try {
  4604. return new Function( /*istanbul ignore next*/'return ' + text)();
  4605. } catch (err) {
  4606. return this.parseRegexp(text, true);
  4607. }
  4608. } else {
  4609. return new RegExp(utils.escapeRegExp(text), 'gm');
  4610. }
  4611. },
  4612. /*istanbul ignore next*/find: function find() {
  4613. this.mditor.editor.activeMark();
  4614. },
  4615. /*istanbul ignore next*/replace: function replace() {
  4616. this.mditor.value = this.mditor.value.replace(this.mditor.editor.markExp, this.replaceWord || '');
  4617. },
  4618. /*istanbul ignore next*/onFindEnter: function onFindEnter(event) {
  4619. if (event.keyCode != 13) return;
  4620. event.preventDefault();
  4621. this.find();
  4622. },
  4623. /*istanbul ignore next*/onReplaceEnter: function onReplaceEnter(event) {
  4624. if (event.keyCode != 13) return;
  4625. event.preventDefault();
  4626. this.replace();
  4627. },
  4628. /*istanbul ignore next*/onCompositionEnd: function onCompositionEnd(event) {
  4629. event.target.blur();
  4630. event.target.focus();
  4631. }
  4632. });
  4633. module.exports = Finder;
  4634. /***/ }),
  4635. /* 98 */
  4636. /***/ (function(module, exports) {
  4637. // removed by extract-text-webpack-plugin
  4638. /***/ }),
  4639. /* 99 */
  4640. /***/ (function(module, exports) {
  4641. module.exports = "<div class=\"finder {{active?'active':''}}\">\n <div>\n <input m:id=\"findBox\" m:model=\"findWord\" m:on:keydown=\"onFindEnter\" m:on:compositionend=\"onCompositionEnd\" type=\"text\" placeholder=\"Find\">\n <i class=\"fa fa-search\" aria-hidden=\"true\" tabindex=\"-1\" m:on:click=\"find()\"></i>\n </div>\n <div>\n <input m:id=\"replaceBox\" m:model=\"replaceWord\" m:on:keydown=\"onReplaceEnter\" m:on:compositionend=\"onCompositionEnd\" type=\"text\"\n placeholder=\"Replace\">\n <i class=\"fa fa-exchange\" aria-hidden=\"true\" tabindex=\"-1\" m:on:click=\"replace()\"></i>\n </div>\n</div>"
  4642. /***/ }),
  4643. /* 100 */
  4644. /***/ (function(module, exports, __webpack_require__) {
  4645. /*istanbul ignore next*/'use strict';
  4646. var shortcuts = __webpack_require__(101);
  4647. var utils = __webpack_require__(3);
  4648. shortcuts.filter = function (event) {
  4649. return !!event.target;
  4650. };
  4651. var Shortcut = module.exports = function (mditor) {
  4652. utils.defineFreezeProp(this, 'mditor', mditor);
  4653. };
  4654. Shortcut.prototype._inRegion = function (target, owner) {
  4655. if (!target) return false;
  4656. owner = owner || this.mditor.editor.$element;
  4657. if (utils.isFunction(owner)) owner = owner(this.mditor);
  4658. return target === owner || this._inRegion(target.parentNode, owner);
  4659. };
  4660. Shortcut.prototype.bind = function (key, cmd, allowDefault, owner) {
  4661. /*istanbul ignore next*/var _this = this;
  4662. var mditor = this.mditor;
  4663. //检查参数
  4664. if (!key || !cmd) return;
  4665. key = key.replace('{cmd}', mditor.CMD);
  4666. shortcuts(key, function (event) {
  4667. if (! /*istanbul ignore next*/_this._inRegion(event.target, owner)) return;
  4668. //禁用浏览器默认快捷键
  4669. if (!allowDefault) {
  4670. event.preventDefault();
  4671. }
  4672. if (cmd instanceof Function) {
  4673. cmd.call(mditor, event);
  4674. } else {
  4675. mditor.execCommand(cmd, event);
  4676. }
  4677. setTimeout(function () {
  4678. mditor.focus();
  4679. }, 0);
  4680. });
  4681. };
  4682. Shortcut.prototype.unbind = function (key) {
  4683. shortcuts.unbind(key);
  4684. };
  4685. /***/ }),
  4686. /* 101 */
  4687. /***/ (function(module, exports, __webpack_require__) {
  4688. (function (global) {
  4689. var k,
  4690. _handlers = {},
  4691. _mods = {
  4692. 16: false,
  4693. 18: false,
  4694. 17: false,
  4695. 91: false
  4696. },
  4697. _scope = 'all',
  4698. // modifier keys
  4699. _MODIFIERS = {
  4700. '⇧': 16,
  4701. shift: 16,
  4702. '⌥': 18,
  4703. alt: 18,
  4704. option: 18,
  4705. '⌃': 17,
  4706. ctrl: 17,
  4707. control: 17,
  4708. '⌘': 91,
  4709. command: 91
  4710. },
  4711. // special keys
  4712. _MAP = {
  4713. backspace: 8,
  4714. tab: 9,
  4715. clear: 12,
  4716. enter: 13,
  4717. 'return': 13,
  4718. esc: 27,
  4719. escape: 27,
  4720. space: 32,
  4721. left: 37,
  4722. up: 38,
  4723. right: 39,
  4724. down: 40,
  4725. del: 46,
  4726. 'delete': 46,
  4727. home: 36,
  4728. end: 35,
  4729. pageup: 33,
  4730. pagedown: 34,
  4731. ',': 188,
  4732. '.': 190,
  4733. '/': 191,
  4734. '`': 192,
  4735. '-': 189,
  4736. '=': 187,
  4737. ';': 186,
  4738. '\'': 222,
  4739. '[': 219,
  4740. ']': 221,
  4741. '\\': 220
  4742. },
  4743. code = function (x) {
  4744. return _MAP[x] || x.toUpperCase().charCodeAt(0);
  4745. },
  4746. _downKeys = [];
  4747. for (k = 1; k < 20; k++) _MAP['f' + k] = 111 + k;
  4748. // IE doesn't support Array#indexOf, so have a simple replacement
  4749. function index(array, item) {
  4750. var i = array.length;
  4751. while (i--)
  4752. if (array[i] === item) return i;
  4753. return -1;
  4754. }
  4755. // for comparing mods before unassignment
  4756. function compareArray(a1, a2) {
  4757. if (a1.length != a2.length) return false;
  4758. for (var i = 0; i < a1.length; i++) {
  4759. if (a1[i] !== a2[i]) return false;
  4760. }
  4761. return true;
  4762. }
  4763. var modifierMap = {
  4764. 16: 'shiftKey',
  4765. 18: 'altKey',
  4766. 17: 'ctrlKey',
  4767. 91: 'metaKey'
  4768. };
  4769. function updateModifierKey(event) {
  4770. for (k in _mods) _mods[k] = event[modifierMap[k]];
  4771. };
  4772. // handle keydown event
  4773. function dispatch(event) {
  4774. var key, handler, k, i, modifiersMatch, scope;
  4775. key = event.keyCode;
  4776. if (index(_downKeys, key) == -1) {
  4777. _downKeys.push(key);
  4778. }
  4779. // if a modifier key, set the key.<modifierkeyname> property to true and return
  4780. if (key == 93 || key == 224) key = 91; // right command on webkit, command on Gecko
  4781. if (key in _mods) {
  4782. _mods[key] = true;
  4783. // 'assignKey' from inside this closure is exported to window.key
  4784. for (k in _MODIFIERS)
  4785. if (_MODIFIERS[k] == key) assignKey[k] = true;
  4786. return;
  4787. }
  4788. updateModifierKey(event);
  4789. // see if we need to ignore the keypress (filter() can can be overridden)
  4790. // by default ignore key presses if a select, textarea, or input is focused
  4791. if (!assignKey.filter.call(this, event)) return;
  4792. // abort if no potentially matching shortcuts found
  4793. if (!(key in _handlers)) return;
  4794. scope = getScope();
  4795. // for each potential shortcut
  4796. for (i = 0; i < _handlers[key].length; i++) {
  4797. handler = _handlers[key][i];
  4798. // see if it's in the current scope
  4799. if (handler.scope == scope || handler.scope == 'all') {
  4800. // check if modifiers match if any
  4801. modifiersMatch = handler.mods.length > 0;
  4802. for (k in _mods)
  4803. if ((!_mods[k] && index(handler.mods, +k) > -1) ||
  4804. (_mods[k] && index(handler.mods, +k) == -1)) modifiersMatch = false;
  4805. // call the handler and stop the event if neccessary
  4806. if ((handler.mods.length == 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91]) || modifiersMatch) {
  4807. if (handler.method(event, handler) === false) {
  4808. if (event.preventDefault) event.preventDefault();
  4809. else event.returnValue = false;
  4810. if (event.stopPropagation) event.stopPropagation();
  4811. if (event.cancelBubble) event.cancelBubble = true;
  4812. }
  4813. }
  4814. }
  4815. }
  4816. };
  4817. // unset modifier keys on keyup
  4818. function clearModifier(event) {
  4819. var key = event.keyCode,
  4820. k,
  4821. i = index(_downKeys, key);
  4822. // remove key from _downKeys
  4823. if (i >= 0) {
  4824. _downKeys.splice(i, 1);
  4825. }
  4826. if (key == 93 || key == 224) key = 91;
  4827. if (key in _mods) {
  4828. _mods[key] = false;
  4829. for (k in _MODIFIERS)
  4830. if (_MODIFIERS[k] == key) assignKey[k] = false;
  4831. }
  4832. };
  4833. function resetModifiers() {
  4834. for (k in _mods) _mods[k] = false;
  4835. for (k in _MODIFIERS) assignKey[k] = false;
  4836. };
  4837. // parse and assign shortcut
  4838. function assignKey(key, scope, method) {
  4839. var keys, mods;
  4840. keys = getKeys(key);
  4841. if (method === undefined) {
  4842. method = scope;
  4843. scope = 'all';
  4844. }
  4845. // for each shortcut
  4846. for (var i = 0; i < keys.length; i++) {
  4847. // set modifier keys if any
  4848. mods = [];
  4849. key = keys[i].split('+');
  4850. if (key.length > 1) {
  4851. mods = getMods(key);
  4852. key = [key[key.length - 1]];
  4853. }
  4854. // convert to keycode and...
  4855. key = key[0]
  4856. key = code(key);
  4857. // ...store handler
  4858. if (!(key in _handlers)) _handlers[key] = [];
  4859. _handlers[key].push({
  4860. shortcut: keys[i],
  4861. scope: scope,
  4862. method: method,
  4863. key: keys[i],
  4864. mods: mods
  4865. });
  4866. }
  4867. };
  4868. // unbind all handlers for given key in current scope
  4869. function unbindKey(key, scope) {
  4870. var multipleKeys, keys,
  4871. mods = [],
  4872. i, j, obj;
  4873. multipleKeys = getKeys(key);
  4874. for (j = 0; j < multipleKeys.length; j++) {
  4875. keys = multipleKeys[j].split('+');
  4876. if (keys.length > 1) {
  4877. mods = getMods(keys);
  4878. key = keys[keys.length - 1];
  4879. }
  4880. key = code(key);
  4881. if (scope === undefined) {
  4882. scope = getScope();
  4883. }
  4884. if (!_handlers[key]) {
  4885. return;
  4886. }
  4887. for (i in _handlers[key]) {
  4888. obj = _handlers[key][i];
  4889. // only clear handlers if correct scope and mods match
  4890. if (obj.scope === scope && compareArray(obj.mods, mods)) {
  4891. _handlers[key][i] = {};
  4892. }
  4893. }
  4894. }
  4895. };
  4896. // Returns true if the key with code 'keyCode' is currently down
  4897. // Converts strings into key codes.
  4898. function isPressed(keyCode) {
  4899. if (typeof (keyCode) == 'string') {
  4900. keyCode = code(keyCode);
  4901. }
  4902. return index(_downKeys, keyCode) != -1;
  4903. }
  4904. function getPressedKeyCodes() {
  4905. return _downKeys.slice(0);
  4906. }
  4907. function filter(event) {
  4908. var tagName = (event.target || event.srcElement).tagName;
  4909. // ignore keypressed in any elements that support keyboard data input
  4910. return !(tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA');
  4911. }
  4912. // initialize key.<modifier> to false
  4913. for (k in _MODIFIERS) assignKey[k] = false;
  4914. // set current scope (default 'all')
  4915. function setScope(scope) {
  4916. _scope = scope || 'all'
  4917. };
  4918. function getScope() {
  4919. return _scope || 'all'
  4920. };
  4921. // delete all handlers for a given scope
  4922. function deleteScope(scope) {
  4923. var key, handlers, i;
  4924. for (key in _handlers) {
  4925. handlers = _handlers[key];
  4926. for (i = 0; i < handlers.length;) {
  4927. if (handlers[i].scope === scope) handlers.splice(i, 1);
  4928. else i++;
  4929. }
  4930. }
  4931. };
  4932. // abstract key logic for assign and unassign
  4933. function getKeys(key) {
  4934. var keys;
  4935. key = key.replace(/\s/g, '');
  4936. keys = key.split(',');
  4937. if ((keys[keys.length - 1]) == '') {
  4938. keys[keys.length - 2] += ',';
  4939. }
  4940. return keys;
  4941. }
  4942. // abstract mods logic for assign and unassign
  4943. function getMods(key) {
  4944. var mods = key.slice(0, key.length - 1);
  4945. for (var mi = 0; mi < mods.length; mi++)
  4946. mods[mi] = _MODIFIERS[mods[mi]];
  4947. return mods;
  4948. }
  4949. // cross-browser events
  4950. function addEvent(object, event, method) {
  4951. if (object.addEventListener)
  4952. object.addEventListener(event, method, false);
  4953. else if (object.attachEvent)
  4954. object.attachEvent('on' + event, function () {
  4955. method(window.event)
  4956. });
  4957. };
  4958. // set the handlers globally on document
  4959. addEvent(document, 'keydown', function (event) {
  4960. dispatch(event)
  4961. }); // Passing _scope to a callback to ensure it remains the same by execution. Fixes #48
  4962. addEvent(document, 'keyup', clearModifier);
  4963. // reset modifiers to false whenever the window is (re)focused.
  4964. addEvent(window, 'focus', resetModifiers);
  4965. // store previously defined key
  4966. var previousKey = global.key;
  4967. // restore previously defined key and return reference to our key object
  4968. function noConflict() {
  4969. var k = global.key;
  4970. global.key = previousKey;
  4971. return k;
  4972. }
  4973. // set window.key and window.key.set/get/deleteScope, and the default filter
  4974. global.key = assignKey;
  4975. global.key.setScope = setScope;
  4976. global.key.getScope = getScope;
  4977. global.key.deleteScope = deleteScope;
  4978. global.key.filter = filter;
  4979. global.key.isPressed = isPressed;
  4980. global.key.getPressedKeyCodes = getPressedKeyCodes;
  4981. global.key.noConflict = noConflict;
  4982. global.key.unbind = unbindKey;
  4983. if (true) module.exports = key;
  4984. })(window);
  4985. /***/ }),
  4986. /* 102 */
  4987. /***/ (function(module, exports, __webpack_require__) {
  4988. /*istanbul ignore next*/'use strict';
  4989. var marked = __webpack_require__(103);
  4990. var Prism = __webpack_require__(104);
  4991. //language
  4992. __webpack_require__(105);
  4993. __webpack_require__(106);
  4994. __webpack_require__(107);
  4995. __webpack_require__(108);
  4996. __webpack_require__(109);
  4997. __webpack_require__(110);
  4998. __webpack_require__(111);
  4999. __webpack_require__(112);
  5000. __webpack_require__(113);
  5001. __webpack_require__(114);
  5002. __webpack_require__(115);
  5003. __webpack_require__(116);
  5004. __webpack_require__(117);
  5005. __webpack_require__(118);
  5006. __webpack_require__(119);
  5007. __webpack_require__(120);
  5008. __webpack_require__(121);
  5009. __webpack_require__(122);
  5010. __webpack_require__(123);
  5011. __webpack_require__(124);
  5012. __webpack_require__(125);
  5013. __webpack_require__(126);
  5014. __webpack_require__(127);
  5015. __webpack_require__(128);
  5016. __webpack_require__(129);
  5017. __webpack_require__(130);
  5018. __webpack_require__(131);
  5019. __webpack_require__(132);
  5020. __webpack_require__(133);
  5021. __webpack_require__(134);
  5022. __webpack_require__(135);
  5023. __webpack_require__(136);
  5024. __webpack_require__(137);
  5025. __webpack_require__(138);
  5026. __webpack_require__(139);
  5027. __webpack_require__(140);
  5028. __webpack_require__(141);
  5029. __webpack_require__(142);
  5030. __webpack_require__(143);
  5031. __webpack_require__(144);
  5032. __webpack_require__(145);
  5033. __webpack_require__(146);
  5034. __webpack_require__(147);
  5035. __webpack_require__(148);
  5036. __webpack_require__(149);
  5037. __webpack_require__(150);
  5038. //alias
  5039. Prism.languages.js = Prism.languages.javascript;
  5040. Prism.languages['c#'] = Prism.languages.csharp;
  5041. Prism.languages['f#'] = Prism.languages.fsharp;
  5042. Prism.languages.sh = Prism.languages.bash;
  5043. Prism.languages.md = Prism.languages.markdown;
  5044. Prism.languages.py = Prism.languages.python;
  5045. Prism.languages.yml = Prism.languages.yaml;
  5046. Prism.languages.rb = Prism.languages.ruby;
  5047. var Parser = function Parser(options) {
  5048. options = options || {};
  5049. this.options = options;
  5050. };
  5051. Parser.highlights = {};
  5052. Parser.marked = marked;
  5053. Parser.Prism = Prism;
  5054. //使标题解析 # 号可以无空格
  5055. marked.Lexer.rules.gfm.heading = marked.Lexer.rules.heading;
  5056. marked.Lexer.rules.tables.heading = marked.Lexer.rules.heading;
  5057. var renderer = new marked.Renderer();
  5058. Parser.renderer = renderer;
  5059. marked.setOptions({
  5060. renderer: renderer, gfm: true, tables: true, breaks: true, //可行尾不加两空格直接换行
  5061. pedantic: false,
  5062. sanitize: false,
  5063. smartLists: true,
  5064. smartypants: false,
  5065. mangle: false,
  5066. highlight: function /*istanbul ignore next*/highlight(code, lang, callback) {
  5067. if (Parser.highlights[lang]) {
  5068. var result = Parser.highlights[lang].parse(code, lang, callback);
  5069. if (!callback) return result;
  5070. } else if (Prism.languages[lang]) {
  5071. var _result = Prism.highlight(code, Prism.languages[lang]);
  5072. if (callback) return callback(null, _result);else return _result;
  5073. } else {
  5074. if (callback) //eslint-disable-line
  5075. return callback(null, code);else return code;
  5076. }
  5077. }
  5078. });
  5079. Parser.prototype.parse = function (mdText, callback) {
  5080. return marked(mdText, callback);
  5081. };
  5082. module.exports = Parser;
  5083. /***/ }),
  5084. /* 103 */
  5085. /***/ (function(module, exports, __webpack_require__) {
  5086. /* WEBPACK VAR INJECTION */(function(global) {/**
  5087. * marked - a markdown parser
  5088. * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
  5089. * https://github.com/chjj/marked
  5090. */
  5091. ;(function() {
  5092. /**
  5093. * Block-Level Grammar
  5094. */
  5095. var block = {
  5096. newline: /^\n+/,
  5097. code: /^( {4}[^\n]+\n*)+/,
  5098. fences: noop,
  5099. hr: /^( *[-*_]){3,} *(?:\n+|$)/,
  5100. heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,
  5101. nptable: noop,
  5102. lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,
  5103. blockquote: /^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,
  5104. list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
  5105. html: /^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,
  5106. def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,
  5107. table: noop,
  5108. paragraph: /^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,
  5109. text: /^[^\n]+/
  5110. };
  5111. block.bullet = /(?:[*+-]|\d+\.)/;
  5112. block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;
  5113. block.item = replace(block.item, 'gm')
  5114. (/bull/g, block.bullet)
  5115. ();
  5116. block.list = replace(block.list)
  5117. (/bull/g, block.bullet)
  5118. ('hr', '\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))')
  5119. ('def', '\\n+(?=' + block.def.source + ')')
  5120. ();
  5121. block.blockquote = replace(block.blockquote)
  5122. ('def', block.def)
  5123. ();
  5124. block._tag = '(?!(?:'
  5125. + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code'
  5126. + '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo'
  5127. + '|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b';
  5128. block.html = replace(block.html)
  5129. ('comment', /<!--[\s\S]*?-->/)
  5130. ('closed', /<(tag)[\s\S]+?<\/\1>/)
  5131. ('closing', /<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)
  5132. (/tag/g, block._tag)
  5133. ();
  5134. block.paragraph = replace(block.paragraph)
  5135. ('hr', block.hr)
  5136. ('heading', block.heading)
  5137. ('lheading', block.lheading)
  5138. ('blockquote', block.blockquote)
  5139. ('tag', '<' + block._tag)
  5140. ('def', block.def)
  5141. ();
  5142. /**
  5143. * Normal Block Grammar
  5144. */
  5145. block.normal = merge({}, block);
  5146. /**
  5147. * GFM Block Grammar
  5148. */
  5149. block.gfm = merge({}, block.normal, {
  5150. fences: /^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,
  5151. paragraph: /^/,
  5152. heading: /^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/
  5153. });
  5154. block.gfm.paragraph = replace(block.paragraph)
  5155. ('(?!', '(?!'
  5156. + block.gfm.fences.source.replace('\\1', '\\2') + '|'
  5157. + block.list.source.replace('\\1', '\\3') + '|')
  5158. ();
  5159. /**
  5160. * GFM + Tables Block Grammar
  5161. */
  5162. block.tables = merge({}, block.gfm, {
  5163. nptable: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,
  5164. table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/
  5165. });
  5166. /**
  5167. * Block Lexer
  5168. */
  5169. function Lexer(options) {
  5170. this.tokens = [];
  5171. this.tokens.links = {};
  5172. this.options = options || marked.defaults;
  5173. this.rules = block.normal;
  5174. if (this.options.gfm) {
  5175. if (this.options.tables) {
  5176. this.rules = block.tables;
  5177. } else {
  5178. this.rules = block.gfm;
  5179. }
  5180. }
  5181. }
  5182. /**
  5183. * Expose Block Rules
  5184. */
  5185. Lexer.rules = block;
  5186. /**
  5187. * Static Lex Method
  5188. */
  5189. Lexer.lex = function(src, options) {
  5190. var lexer = new Lexer(options);
  5191. return lexer.lex(src);
  5192. };
  5193. /**
  5194. * Preprocessing
  5195. */
  5196. Lexer.prototype.lex = function(src) {
  5197. src = src
  5198. .replace(/\r\n|\r/g, '\n')
  5199. .replace(/\t/g, ' ')
  5200. .replace(/\u00a0/g, ' ')
  5201. .replace(/\u2424/g, '\n');
  5202. return this.token(src, true);
  5203. };
  5204. /**
  5205. * Lexing
  5206. */
  5207. Lexer.prototype.token = function(src, top, bq) {
  5208. var src = src.replace(/^ +$/gm, '')
  5209. , next
  5210. , loose
  5211. , cap
  5212. , bull
  5213. , b
  5214. , item
  5215. , space
  5216. , i
  5217. , l;
  5218. while (src) {
  5219. // newline
  5220. if (cap = this.rules.newline.exec(src)) {
  5221. src = src.substring(cap[0].length);
  5222. if (cap[0].length > 1) {
  5223. this.tokens.push({
  5224. type: 'space'
  5225. });
  5226. }
  5227. }
  5228. // code
  5229. if (cap = this.rules.code.exec(src)) {
  5230. src = src.substring(cap[0].length);
  5231. cap = cap[0].replace(/^ {4}/gm, '');
  5232. this.tokens.push({
  5233. type: 'code',
  5234. text: !this.options.pedantic
  5235. ? cap.replace(/\n+$/, '')
  5236. : cap
  5237. });
  5238. continue;
  5239. }
  5240. // fences (gfm)
  5241. if (cap = this.rules.fences.exec(src)) {
  5242. src = src.substring(cap[0].length);
  5243. this.tokens.push({
  5244. type: 'code',
  5245. lang: cap[2],
  5246. text: cap[3] || ''
  5247. });
  5248. continue;
  5249. }
  5250. // heading
  5251. if (cap = this.rules.heading.exec(src)) {
  5252. src = src.substring(cap[0].length);
  5253. this.tokens.push({
  5254. type: 'heading',
  5255. depth: cap[1].length,
  5256. text: cap[2]
  5257. });
  5258. continue;
  5259. }
  5260. // table no leading pipe (gfm)
  5261. if (top && (cap = this.rules.nptable.exec(src))) {
  5262. src = src.substring(cap[0].length);
  5263. item = {
  5264. type: 'table',
  5265. header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */),
  5266. align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
  5267. cells: cap[3].replace(/\n$/, '').split('\n')
  5268. };
  5269. for (i = 0; i < item.align.length; i++) {
  5270. if (/^ *-+: *$/.test(item.align[i])) {
  5271. item.align[i] = 'right';
  5272. } else if (/^ *:-+: *$/.test(item.align[i])) {
  5273. item.align[i] = 'center';
  5274. } else if (/^ *:-+ *$/.test(item.align[i])) {
  5275. item.align[i] = 'left';
  5276. } else {
  5277. item.align[i] = null;
  5278. }
  5279. }
  5280. for (i = 0; i < item.cells.length; i++) {
  5281. item.cells[i] = item.cells[i].split(/ *\| */);
  5282. }
  5283. this.tokens.push(item);
  5284. continue;
  5285. }
  5286. // lheading
  5287. if (cap = this.rules.lheading.exec(src)) {
  5288. src = src.substring(cap[0].length);
  5289. this.tokens.push({
  5290. type: 'heading',
  5291. depth: cap[2] === '=' ? 1 : 2,
  5292. text: cap[1]
  5293. });
  5294. continue;
  5295. }
  5296. // hr
  5297. if (cap = this.rules.hr.exec(src)) {
  5298. src = src.substring(cap[0].length);
  5299. this.tokens.push({
  5300. type: 'hr'
  5301. });
  5302. continue;
  5303. }
  5304. // blockquote
  5305. if (cap = this.rules.blockquote.exec(src)) {
  5306. src = src.substring(cap[0].length);
  5307. this.tokens.push({
  5308. type: 'blockquote_start'
  5309. });
  5310. cap = cap[0].replace(/^ *> ?/gm, '');
  5311. // Pass `top` to keep the current
  5312. // "toplevel" state. This is exactly
  5313. // how markdown.pl works.
  5314. this.token(cap, top, true);
  5315. this.tokens.push({
  5316. type: 'blockquote_end'
  5317. });
  5318. continue;
  5319. }
  5320. // list
  5321. if (cap = this.rules.list.exec(src)) {
  5322. src = src.substring(cap[0].length);
  5323. bull = cap[2];
  5324. this.tokens.push({
  5325. type: 'list_start',
  5326. ordered: bull.length > 1
  5327. });
  5328. // Get each top-level item.
  5329. cap = cap[0].match(this.rules.item);
  5330. next = false;
  5331. l = cap.length;
  5332. i = 0;
  5333. for (; i < l; i++) {
  5334. item = cap[i];
  5335. // Remove the list item's bullet
  5336. // so it is seen as the next token.
  5337. space = item.length;
  5338. item = item.replace(/^ *([*+-]|\d+\.) +/, '');
  5339. // Outdent whatever the
  5340. // list item contains. Hacky.
  5341. if (~item.indexOf('\n ')) {
  5342. space -= item.length;
  5343. item = !this.options.pedantic
  5344. ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '')
  5345. : item.replace(/^ {1,4}/gm, '');
  5346. }
  5347. // Determine whether the next list item belongs here.
  5348. // Backpedal if it does not belong in this list.
  5349. if (this.options.smartLists && i !== l - 1) {
  5350. b = block.bullet.exec(cap[i + 1])[0];
  5351. if (bull !== b && !(bull.length > 1 && b.length > 1)) {
  5352. src = cap.slice(i + 1).join('\n') + src;
  5353. i = l - 1;
  5354. }
  5355. }
  5356. // Determine whether item is loose or not.
  5357. // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
  5358. // for discount behavior.
  5359. loose = next || /\n\n(?!\s*$)/.test(item);
  5360. if (i !== l - 1) {
  5361. next = item.charAt(item.length - 1) === '\n';
  5362. if (!loose) loose = next;
  5363. }
  5364. this.tokens.push({
  5365. type: loose
  5366. ? 'loose_item_start'
  5367. : 'list_item_start'
  5368. });
  5369. // Recurse.
  5370. this.token(item, false, bq);
  5371. this.tokens.push({
  5372. type: 'list_item_end'
  5373. });
  5374. }
  5375. this.tokens.push({
  5376. type: 'list_end'
  5377. });
  5378. continue;
  5379. }
  5380. // html
  5381. if (cap = this.rules.html.exec(src)) {
  5382. src = src.substring(cap[0].length);
  5383. this.tokens.push({
  5384. type: this.options.sanitize
  5385. ? 'paragraph'
  5386. : 'html',
  5387. pre: !this.options.sanitizer
  5388. && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
  5389. text: cap[0]
  5390. });
  5391. continue;
  5392. }
  5393. // def
  5394. if ((!bq && top) && (cap = this.rules.def.exec(src))) {
  5395. src = src.substring(cap[0].length);
  5396. this.tokens.links[cap[1].toLowerCase()] = {
  5397. href: cap[2],
  5398. title: cap[3]
  5399. };
  5400. continue;
  5401. }
  5402. // table (gfm)
  5403. if (top && (cap = this.rules.table.exec(src))) {
  5404. src = src.substring(cap[0].length);
  5405. item = {
  5406. type: 'table',
  5407. header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */),
  5408. align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
  5409. cells: cap[3].replace(/(?: *\| *)?\n$/, '').split('\n')
  5410. };
  5411. for (i = 0; i < item.align.length; i++) {
  5412. if (/^ *-+: *$/.test(item.align[i])) {
  5413. item.align[i] = 'right';
  5414. } else if (/^ *:-+: *$/.test(item.align[i])) {
  5415. item.align[i] = 'center';
  5416. } else if (/^ *:-+ *$/.test(item.align[i])) {
  5417. item.align[i] = 'left';
  5418. } else {
  5419. item.align[i] = null;
  5420. }
  5421. }
  5422. for (i = 0; i < item.cells.length; i++) {
  5423. item.cells[i] = item.cells[i]
  5424. .replace(/^ *\| *| *\| *$/g, '')
  5425. .split(/ *\| */);
  5426. }
  5427. this.tokens.push(item);
  5428. continue;
  5429. }
  5430. // top-level paragraph
  5431. if (top && (cap = this.rules.paragraph.exec(src))) {
  5432. src = src.substring(cap[0].length);
  5433. this.tokens.push({
  5434. type: 'paragraph',
  5435. text: cap[1].charAt(cap[1].length - 1) === '\n'
  5436. ? cap[1].slice(0, -1)
  5437. : cap[1]
  5438. });
  5439. continue;
  5440. }
  5441. // text
  5442. if (cap = this.rules.text.exec(src)) {
  5443. // Top-level should never reach here.
  5444. src = src.substring(cap[0].length);
  5445. this.tokens.push({
  5446. type: 'text',
  5447. text: cap[0]
  5448. });
  5449. continue;
  5450. }
  5451. if (src) {
  5452. throw new
  5453. Error('Infinite loop on byte: ' + src.charCodeAt(0));
  5454. }
  5455. }
  5456. return this.tokens;
  5457. };
  5458. /**
  5459. * Inline-Level Grammar
  5460. */
  5461. var inline = {
  5462. escape: /^\\([\\`*{}\[\]()#+\-.!_>])/,
  5463. autolink: /^<([^ >]+(@|:\/)[^ >]+)>/,
  5464. url: noop,
  5465. tag: /^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,
  5466. link: /^!?\[(inside)\]\(href\)/,
  5467. reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/,
  5468. nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,
  5469. strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,
  5470. em: /^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
  5471. code: /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,
  5472. br: /^ {2,}\n(?!\s*$)/,
  5473. del: noop,
  5474. text: /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/
  5475. };
  5476. inline._inside = /(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/;
  5477. inline._href = /\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/;
  5478. inline.link = replace(inline.link)
  5479. ('inside', inline._inside)
  5480. ('href', inline._href)
  5481. ();
  5482. inline.reflink = replace(inline.reflink)
  5483. ('inside', inline._inside)
  5484. ();
  5485. /**
  5486. * Normal Inline Grammar
  5487. */
  5488. inline.normal = merge({}, inline);
  5489. /**
  5490. * Pedantic Inline Grammar
  5491. */
  5492. inline.pedantic = merge({}, inline.normal, {
  5493. strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
  5494. em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/
  5495. });
  5496. /**
  5497. * GFM Inline Grammar
  5498. */
  5499. inline.gfm = merge({}, inline.normal, {
  5500. escape: replace(inline.escape)('])', '~|])')(),
  5501. url: /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,
  5502. del: /^~~(?=\S)([\s\S]*?\S)~~/,
  5503. text: replace(inline.text)
  5504. (']|', '~]|')
  5505. ('|', '|https?://|')
  5506. ()
  5507. });
  5508. /**
  5509. * GFM + Line Breaks Inline Grammar
  5510. */
  5511. inline.breaks = merge({}, inline.gfm, {
  5512. br: replace(inline.br)('{2,}', '*')(),
  5513. text: replace(inline.gfm.text)('{2,}', '*')()
  5514. });
  5515. /**
  5516. * Inline Lexer & Compiler
  5517. */
  5518. function InlineLexer(links, options) {
  5519. this.options = options || marked.defaults;
  5520. this.links = links;
  5521. this.rules = inline.normal;
  5522. this.renderer = this.options.renderer || new Renderer;
  5523. this.renderer.options = this.options;
  5524. if (!this.links) {
  5525. throw new
  5526. Error('Tokens array requires a `links` property.');
  5527. }
  5528. if (this.options.gfm) {
  5529. if (this.options.breaks) {
  5530. this.rules = inline.breaks;
  5531. } else {
  5532. this.rules = inline.gfm;
  5533. }
  5534. } else if (this.options.pedantic) {
  5535. this.rules = inline.pedantic;
  5536. }
  5537. }
  5538. /**
  5539. * Expose Inline Rules
  5540. */
  5541. InlineLexer.rules = inline;
  5542. /**
  5543. * Static Lexing/Compiling Method
  5544. */
  5545. InlineLexer.output = function(src, links, options) {
  5546. var inline = new InlineLexer(links, options);
  5547. return inline.output(src);
  5548. };
  5549. /**
  5550. * Lexing/Compiling
  5551. */
  5552. InlineLexer.prototype.output = function(src) {
  5553. var out = ''
  5554. , link
  5555. , text
  5556. , href
  5557. , cap;
  5558. while (src) {
  5559. // escape
  5560. if (cap = this.rules.escape.exec(src)) {
  5561. src = src.substring(cap[0].length);
  5562. out += cap[1];
  5563. continue;
  5564. }
  5565. // autolink
  5566. if (cap = this.rules.autolink.exec(src)) {
  5567. src = src.substring(cap[0].length);
  5568. if (cap[2] === '@') {
  5569. text = cap[1].charAt(6) === ':'
  5570. ? this.mangle(cap[1].substring(7))
  5571. : this.mangle(cap[1]);
  5572. href = this.mangle('mailto:') + text;
  5573. } else {
  5574. text = escape(cap[1]);
  5575. href = text;
  5576. }
  5577. out += this.renderer.link(href, null, text);
  5578. continue;
  5579. }
  5580. // url (gfm)
  5581. if (!this.inLink && (cap = this.rules.url.exec(src))) {
  5582. src = src.substring(cap[0].length);
  5583. text = escape(cap[1]);
  5584. href = text;
  5585. out += this.renderer.link(href, null, text);
  5586. continue;
  5587. }
  5588. // tag
  5589. if (cap = this.rules.tag.exec(src)) {
  5590. if (!this.inLink && /^<a /i.test(cap[0])) {
  5591. this.inLink = true;
  5592. } else if (this.inLink && /^<\/a>/i.test(cap[0])) {
  5593. this.inLink = false;
  5594. }
  5595. src = src.substring(cap[0].length);
  5596. out += this.options.sanitize
  5597. ? this.options.sanitizer
  5598. ? this.options.sanitizer(cap[0])
  5599. : escape(cap[0])
  5600. : cap[0]
  5601. continue;
  5602. }
  5603. // link
  5604. if (cap = this.rules.link.exec(src)) {
  5605. src = src.substring(cap[0].length);
  5606. this.inLink = true;
  5607. out += this.outputLink(cap, {
  5608. href: cap[2],
  5609. title: cap[3]
  5610. });
  5611. this.inLink = false;
  5612. continue;
  5613. }
  5614. // reflink, nolink
  5615. if ((cap = this.rules.reflink.exec(src))
  5616. || (cap = this.rules.nolink.exec(src))) {
  5617. src = src.substring(cap[0].length);
  5618. link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
  5619. link = this.links[link.toLowerCase()];
  5620. if (!link || !link.href) {
  5621. out += cap[0].charAt(0);
  5622. src = cap[0].substring(1) + src;
  5623. continue;
  5624. }
  5625. this.inLink = true;
  5626. out += this.outputLink(cap, link);
  5627. this.inLink = false;
  5628. continue;
  5629. }
  5630. // strong
  5631. if (cap = this.rules.strong.exec(src)) {
  5632. src = src.substring(cap[0].length);
  5633. out += this.renderer.strong(this.output(cap[2] || cap[1]));
  5634. continue;
  5635. }
  5636. // em
  5637. if (cap = this.rules.em.exec(src)) {
  5638. src = src.substring(cap[0].length);
  5639. out += this.renderer.em(this.output(cap[2] || cap[1]));
  5640. continue;
  5641. }
  5642. // code
  5643. if (cap = this.rules.code.exec(src)) {
  5644. src = src.substring(cap[0].length);
  5645. out += this.renderer.codespan(escape(cap[2], true));
  5646. continue;
  5647. }
  5648. // br
  5649. if (cap = this.rules.br.exec(src)) {
  5650. src = src.substring(cap[0].length);
  5651. out += this.renderer.br();
  5652. continue;
  5653. }
  5654. // del (gfm)
  5655. if (cap = this.rules.del.exec(src)) {
  5656. src = src.substring(cap[0].length);
  5657. out += this.renderer.del(this.output(cap[1]));
  5658. continue;
  5659. }
  5660. // text
  5661. if (cap = this.rules.text.exec(src)) {
  5662. src = src.substring(cap[0].length);
  5663. out += this.renderer.text(escape(this.smartypants(cap[0])));
  5664. continue;
  5665. }
  5666. if (src) {
  5667. throw new
  5668. Error('Infinite loop on byte: ' + src.charCodeAt(0));
  5669. }
  5670. }
  5671. return out;
  5672. };
  5673. /**
  5674. * Compile Link
  5675. */
  5676. InlineLexer.prototype.outputLink = function(cap, link) {
  5677. var href = escape(link.href)
  5678. , title = link.title ? escape(link.title) : null;
  5679. return cap[0].charAt(0) !== '!'
  5680. ? this.renderer.link(href, title, this.output(cap[1]))
  5681. : this.renderer.image(href, title, escape(cap[1]));
  5682. };
  5683. /**
  5684. * Smartypants Transformations
  5685. */
  5686. InlineLexer.prototype.smartypants = function(text) {
  5687. if (!this.options.smartypants) return text;
  5688. return text
  5689. // em-dashes
  5690. .replace(/---/g, '\u2014')
  5691. // en-dashes
  5692. .replace(/--/g, '\u2013')
  5693. // opening singles
  5694. .replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018')
  5695. // closing singles & apostrophes
  5696. .replace(/'/g, '\u2019')
  5697. // opening doubles
  5698. .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c')
  5699. // closing doubles
  5700. .replace(/"/g, '\u201d')
  5701. // ellipses
  5702. .replace(/\.{3}/g, '\u2026');
  5703. };
  5704. /**
  5705. * Mangle Links
  5706. */
  5707. InlineLexer.prototype.mangle = function(text) {
  5708. if (!this.options.mangle) return text;
  5709. var out = ''
  5710. , l = text.length
  5711. , i = 0
  5712. , ch;
  5713. for (; i < l; i++) {
  5714. ch = text.charCodeAt(i);
  5715. if (Math.random() > 0.5) {
  5716. ch = 'x' + ch.toString(16);
  5717. }
  5718. out += '&#' + ch + ';';
  5719. }
  5720. return out;
  5721. };
  5722. /**
  5723. * Renderer
  5724. */
  5725. function Renderer(options) {
  5726. this.options = options || {};
  5727. }
  5728. Renderer.prototype.code = function(code, lang, escaped) {
  5729. if (this.options.highlight) {
  5730. var out = this.options.highlight(code, lang);
  5731. if (out != null && out !== code) {
  5732. escaped = true;
  5733. code = out;
  5734. }
  5735. }
  5736. if (!lang) {
  5737. return '<pre><code>'
  5738. + (escaped ? code : escape(code, true))
  5739. + '\n</code></pre>';
  5740. }
  5741. return '<pre><code class="'
  5742. + this.options.langPrefix
  5743. + escape(lang, true)
  5744. + '">'
  5745. + (escaped ? code : escape(code, true))
  5746. + '\n</code></pre>\n';
  5747. };
  5748. Renderer.prototype.blockquote = function(quote) {
  5749. return '<blockquote>\n' + quote + '</blockquote>\n';
  5750. };
  5751. Renderer.prototype.html = function(html) {
  5752. return html;
  5753. };
  5754. Renderer.prototype.heading = function(text, level, raw) {
  5755. return '<h'
  5756. + level
  5757. + ' id="'
  5758. + this.options.headerPrefix
  5759. + raw.toLowerCase().replace(/[^\w]+/g, '-')
  5760. + '">'
  5761. + text
  5762. + '</h'
  5763. + level
  5764. + '>\n';
  5765. };
  5766. Renderer.prototype.hr = function() {
  5767. return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
  5768. };
  5769. Renderer.prototype.list = function(body, ordered) {
  5770. var type = ordered ? 'ol' : 'ul';
  5771. return '<' + type + '>\n' + body + '</' + type + '>\n';
  5772. };
  5773. Renderer.prototype.listitem = function(text) {
  5774. return '<li>' + text + '</li>\n';
  5775. };
  5776. Renderer.prototype.paragraph = function(text) {
  5777. return '<p>' + text + '</p>\n';
  5778. };
  5779. Renderer.prototype.table = function(header, body) {
  5780. return '<table>\n'
  5781. + '<thead>\n'
  5782. + header
  5783. + '</thead>\n'
  5784. + '<tbody>\n'
  5785. + body
  5786. + '</tbody>\n'
  5787. + '</table>\n';
  5788. };
  5789. Renderer.prototype.tablerow = function(content) {
  5790. return '<tr>\n' + content + '</tr>\n';
  5791. };
  5792. Renderer.prototype.tablecell = function(content, flags) {
  5793. var type = flags.header ? 'th' : 'td';
  5794. var tag = flags.align
  5795. ? '<' + type + ' style="text-align:' + flags.align + '">'
  5796. : '<' + type + '>';
  5797. return tag + content + '</' + type + '>\n';
  5798. };
  5799. // span level renderer
  5800. Renderer.prototype.strong = function(text) {
  5801. return '<strong>' + text + '</strong>';
  5802. };
  5803. Renderer.prototype.em = function(text) {
  5804. return '<em>' + text + '</em>';
  5805. };
  5806. Renderer.prototype.codespan = function(text) {
  5807. return '<code>' + text + '</code>';
  5808. };
  5809. Renderer.prototype.br = function() {
  5810. return this.options.xhtml ? '<br/>' : '<br>';
  5811. };
  5812. Renderer.prototype.del = function(text) {
  5813. return '<del>' + text + '</del>';
  5814. };
  5815. Renderer.prototype.link = function(href, title, text) {
  5816. if (this.options.sanitize) {
  5817. try {
  5818. var prot = decodeURIComponent(unescape(href))
  5819. .replace(/[^\w:]/g, '')
  5820. .toLowerCase();
  5821. } catch (e) {
  5822. return '';
  5823. }
  5824. if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0) {
  5825. return '';
  5826. }
  5827. }
  5828. var out = '<a href="' + href + '"';
  5829. if (title) {
  5830. out += ' title="' + title + '"';
  5831. }
  5832. out += '>' + text + '</a>';
  5833. return out;
  5834. };
  5835. Renderer.prototype.image = function(href, title, text) {
  5836. var out = '<img src="' + href + '" alt="' + text + '"';
  5837. if (title) {
  5838. out += ' title="' + title + '"';
  5839. }
  5840. out += this.options.xhtml ? '/>' : '>';
  5841. return out;
  5842. };
  5843. Renderer.prototype.text = function(text) {
  5844. return text;
  5845. };
  5846. /**
  5847. * Parsing & Compiling
  5848. */
  5849. function Parser(options) {
  5850. this.tokens = [];
  5851. this.token = null;
  5852. this.options = options || marked.defaults;
  5853. this.options.renderer = this.options.renderer || new Renderer;
  5854. this.renderer = this.options.renderer;
  5855. this.renderer.options = this.options;
  5856. }
  5857. /**
  5858. * Static Parse Method
  5859. */
  5860. Parser.parse = function(src, options, renderer) {
  5861. var parser = new Parser(options, renderer);
  5862. return parser.parse(src);
  5863. };
  5864. /**
  5865. * Parse Loop
  5866. */
  5867. Parser.prototype.parse = function(src) {
  5868. this.inline = new InlineLexer(src.links, this.options, this.renderer);
  5869. this.tokens = src.reverse();
  5870. var out = '';
  5871. while (this.next()) {
  5872. out += this.tok();
  5873. }
  5874. return out;
  5875. };
  5876. /**
  5877. * Next Token
  5878. */
  5879. Parser.prototype.next = function() {
  5880. return this.token = this.tokens.pop();
  5881. };
  5882. /**
  5883. * Preview Next Token
  5884. */
  5885. Parser.prototype.peek = function() {
  5886. return this.tokens[this.tokens.length - 1] || 0;
  5887. };
  5888. /**
  5889. * Parse Text Tokens
  5890. */
  5891. Parser.prototype.parseText = function() {
  5892. var body = this.token.text;
  5893. while (this.peek().type === 'text') {
  5894. body += '\n' + this.next().text;
  5895. }
  5896. return this.inline.output(body);
  5897. };
  5898. /**
  5899. * Parse Current Token
  5900. */
  5901. Parser.prototype.tok = function() {
  5902. switch (this.token.type) {
  5903. case 'space': {
  5904. return '';
  5905. }
  5906. case 'hr': {
  5907. return this.renderer.hr();
  5908. }
  5909. case 'heading': {
  5910. return this.renderer.heading(
  5911. this.inline.output(this.token.text),
  5912. this.token.depth,
  5913. this.token.text);
  5914. }
  5915. case 'code': {
  5916. return this.renderer.code(this.token.text,
  5917. this.token.lang,
  5918. this.token.escaped);
  5919. }
  5920. case 'table': {
  5921. var header = ''
  5922. , body = ''
  5923. , i
  5924. , row
  5925. , cell
  5926. , flags
  5927. , j;
  5928. // header
  5929. cell = '';
  5930. for (i = 0; i < this.token.header.length; i++) {
  5931. flags = { header: true, align: this.token.align[i] };
  5932. cell += this.renderer.tablecell(
  5933. this.inline.output(this.token.header[i]),
  5934. { header: true, align: this.token.align[i] }
  5935. );
  5936. }
  5937. header += this.renderer.tablerow(cell);
  5938. for (i = 0; i < this.token.cells.length; i++) {
  5939. row = this.token.cells[i];
  5940. cell = '';
  5941. for (j = 0; j < row.length; j++) {
  5942. cell += this.renderer.tablecell(
  5943. this.inline.output(row[j]),
  5944. { header: false, align: this.token.align[j] }
  5945. );
  5946. }
  5947. body += this.renderer.tablerow(cell);
  5948. }
  5949. return this.renderer.table(header, body);
  5950. }
  5951. case 'blockquote_start': {
  5952. var body = '';
  5953. while (this.next().type !== 'blockquote_end') {
  5954. body += this.tok();
  5955. }
  5956. return this.renderer.blockquote(body);
  5957. }
  5958. case 'list_start': {
  5959. var body = ''
  5960. , ordered = this.token.ordered;
  5961. while (this.next().type !== 'list_end') {
  5962. body += this.tok();
  5963. }
  5964. return this.renderer.list(body, ordered);
  5965. }
  5966. case 'list_item_start': {
  5967. var body = '';
  5968. while (this.next().type !== 'list_item_end') {
  5969. body += this.token.type === 'text'
  5970. ? this.parseText()
  5971. : this.tok();
  5972. }
  5973. return this.renderer.listitem(body);
  5974. }
  5975. case 'loose_item_start': {
  5976. var body = '';
  5977. while (this.next().type !== 'list_item_end') {
  5978. body += this.tok();
  5979. }
  5980. return this.renderer.listitem(body);
  5981. }
  5982. case 'html': {
  5983. var html = !this.token.pre && !this.options.pedantic
  5984. ? this.inline.output(this.token.text)
  5985. : this.token.text;
  5986. return this.renderer.html(html);
  5987. }
  5988. case 'paragraph': {
  5989. return this.renderer.paragraph(this.inline.output(this.token.text));
  5990. }
  5991. case 'text': {
  5992. return this.renderer.paragraph(this.parseText());
  5993. }
  5994. }
  5995. };
  5996. /**
  5997. * Helpers
  5998. */
  5999. function escape(html, encode) {
  6000. return html
  6001. .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&amp;')
  6002. .replace(/</g, '&lt;')
  6003. .replace(/>/g, '&gt;')
  6004. .replace(/"/g, '&quot;')
  6005. .replace(/'/g, '&#39;');
  6006. }
  6007. function unescape(html) {
  6008. // explicitly match decimal, hex, and named HTML entities
  6009. return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g, function(_, n) {
  6010. n = n.toLowerCase();
  6011. if (n === 'colon') return ':';
  6012. if (n.charAt(0) === '#') {
  6013. return n.charAt(1) === 'x'
  6014. ? String.fromCharCode(parseInt(n.substring(2), 16))
  6015. : String.fromCharCode(+n.substring(1));
  6016. }
  6017. return '';
  6018. });
  6019. }
  6020. function replace(regex, opt) {
  6021. regex = regex.source;
  6022. opt = opt || '';
  6023. return function self(name, val) {
  6024. if (!name) return new RegExp(regex, opt);
  6025. val = val.source || val;
  6026. val = val.replace(/(^|[^\[])\^/g, '$1');
  6027. regex = regex.replace(name, val);
  6028. return self;
  6029. };
  6030. }
  6031. function noop() {}
  6032. noop.exec = noop;
  6033. function merge(obj) {
  6034. var i = 1
  6035. , target
  6036. , key;
  6037. for (; i < arguments.length; i++) {
  6038. target = arguments[i];
  6039. for (key in target) {
  6040. if (Object.prototype.hasOwnProperty.call(target, key)) {
  6041. obj[key] = target[key];
  6042. }
  6043. }
  6044. }
  6045. return obj;
  6046. }
  6047. /**
  6048. * Marked
  6049. */
  6050. function marked(src, opt, callback) {
  6051. if (callback || typeof opt === 'function') {
  6052. if (!callback) {
  6053. callback = opt;
  6054. opt = null;
  6055. }
  6056. opt = merge({}, marked.defaults, opt || {});
  6057. var highlight = opt.highlight
  6058. , tokens
  6059. , pending
  6060. , i = 0;
  6061. try {
  6062. tokens = Lexer.lex(src, opt)
  6063. } catch (e) {
  6064. return callback(e);
  6065. }
  6066. pending = tokens.length;
  6067. var done = function(err) {
  6068. if (err) {
  6069. opt.highlight = highlight;
  6070. return callback(err);
  6071. }
  6072. var out;
  6073. try {
  6074. out = Parser.parse(tokens, opt);
  6075. } catch (e) {
  6076. err = e;
  6077. }
  6078. opt.highlight = highlight;
  6079. return err
  6080. ? callback(err)
  6081. : callback(null, out);
  6082. };
  6083. if (!highlight || highlight.length < 3) {
  6084. return done();
  6085. }
  6086. delete opt.highlight;
  6087. if (!pending) return done();
  6088. for (; i < tokens.length; i++) {
  6089. (function(token) {
  6090. if (token.type !== 'code') {
  6091. return --pending || done();
  6092. }
  6093. return highlight(token.text, token.lang, function(err, code) {
  6094. if (err) return done(err);
  6095. if (code == null || code === token.text) {
  6096. return --pending || done();
  6097. }
  6098. token.text = code;
  6099. token.escaped = true;
  6100. --pending || done();
  6101. });
  6102. })(tokens[i]);
  6103. }
  6104. return;
  6105. }
  6106. try {
  6107. if (opt) opt = merge({}, marked.defaults, opt);
  6108. return Parser.parse(Lexer.lex(src, opt), opt);
  6109. } catch (e) {
  6110. e.message += '\nPlease report this to https://github.com/chjj/marked.';
  6111. if ((opt || marked.defaults).silent) {
  6112. return '<p>An error occured:</p><pre>'
  6113. + escape(e.message + '', true)
  6114. + '</pre>';
  6115. }
  6116. throw e;
  6117. }
  6118. }
  6119. /**
  6120. * Options
  6121. */
  6122. marked.options =
  6123. marked.setOptions = function(opt) {
  6124. merge(marked.defaults, opt);
  6125. return marked;
  6126. };
  6127. marked.defaults = {
  6128. gfm: true,
  6129. tables: true,
  6130. breaks: false,
  6131. pedantic: false,
  6132. sanitize: false,
  6133. sanitizer: null,
  6134. mangle: true,
  6135. smartLists: false,
  6136. silent: false,
  6137. highlight: null,
  6138. langPrefix: 'lang-',
  6139. smartypants: false,
  6140. headerPrefix: '',
  6141. renderer: new Renderer,
  6142. xhtml: false
  6143. };
  6144. /**
  6145. * Expose
  6146. */
  6147. marked.Parser = Parser;
  6148. marked.parser = Parser.parse;
  6149. marked.Renderer = Renderer;
  6150. marked.Lexer = Lexer;
  6151. marked.lexer = Lexer.lex;
  6152. marked.InlineLexer = InlineLexer;
  6153. marked.inlineLexer = InlineLexer.output;
  6154. marked.parse = marked;
  6155. if (true) {
  6156. module.exports = marked;
  6157. } else if (typeof define === 'function' && define.amd) {
  6158. define(function() { return marked; });
  6159. } else {
  6160. this.marked = marked;
  6161. }
  6162. }).call(function() {
  6163. return this || (typeof window !== 'undefined' ? window : global);
  6164. }());
  6165. /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
  6166. /***/ }),
  6167. /* 104 */
  6168. /***/ (function(module, exports) {
  6169. /* WEBPACK VAR INJECTION */(function(global) {
  6170. /* **********************************************
  6171. Begin prism-core.js
  6172. ********************************************** */
  6173. var _self = (typeof window !== 'undefined')
  6174. ? window // if in browser
  6175. : (
  6176. (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
  6177. ? self // if in worker
  6178. : {} // if in node js
  6179. );
  6180. /**
  6181. * Prism: Lightweight, robust, elegant syntax highlighting
  6182. * MIT license http://www.opensource.org/licenses/mit-license.php/
  6183. * @author Lea Verou http://lea.verou.me
  6184. */
  6185. var Prism = (function(){
  6186. // Private helper vars
  6187. var lang = /\blang(?:uage)?-(\w+)\b/i;
  6188. var uniqueId = 0;
  6189. var _ = _self.Prism = {
  6190. manual: _self.Prism && _self.Prism.manual,
  6191. util: {
  6192. encode: function (tokens) {
  6193. if (tokens instanceof Token) {
  6194. return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias);
  6195. } else if (_.util.type(tokens) === 'Array') {
  6196. return tokens.map(_.util.encode);
  6197. } else {
  6198. return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\u00a0/g, ' ');
  6199. }
  6200. },
  6201. type: function (o) {
  6202. return Object.prototype.toString.call(o).match(/\[object (\w+)\]/)[1];
  6203. },
  6204. objId: function (obj) {
  6205. if (!obj['__id']) {
  6206. Object.defineProperty(obj, '__id', { value: ++uniqueId });
  6207. }
  6208. return obj['__id'];
  6209. },
  6210. // Deep clone a language definition (e.g. to extend it)
  6211. clone: function (o) {
  6212. var type = _.util.type(o);
  6213. switch (type) {
  6214. case 'Object':
  6215. var clone = {};
  6216. for (var key in o) {
  6217. if (o.hasOwnProperty(key)) {
  6218. clone[key] = _.util.clone(o[key]);
  6219. }
  6220. }
  6221. return clone;
  6222. case 'Array':
  6223. return o.map(function(v) { return _.util.clone(v); });
  6224. }
  6225. return o;
  6226. }
  6227. },
  6228. languages: {
  6229. extend: function (id, redef) {
  6230. var lang = _.util.clone(_.languages[id]);
  6231. for (var key in redef) {
  6232. lang[key] = redef[key];
  6233. }
  6234. return lang;
  6235. },
  6236. /**
  6237. * Insert a token before another token in a language literal
  6238. * As this needs to recreate the object (we cannot actually insert before keys in object literals),
  6239. * we cannot just provide an object, we need anobject and a key.
  6240. * @param inside The key (or language id) of the parent
  6241. * @param before The key to insert before. If not provided, the function appends instead.
  6242. * @param insert Object with the key/value pairs to insert
  6243. * @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted.
  6244. */
  6245. insertBefore: function (inside, before, insert, root) {
  6246. root = root || _.languages;
  6247. var grammar = root[inside];
  6248. if (arguments.length == 2) {
  6249. insert = arguments[1];
  6250. for (var newToken in insert) {
  6251. if (insert.hasOwnProperty(newToken)) {
  6252. grammar[newToken] = insert[newToken];
  6253. }
  6254. }
  6255. return grammar;
  6256. }
  6257. var ret = {};
  6258. for (var token in grammar) {
  6259. if (grammar.hasOwnProperty(token)) {
  6260. if (token == before) {
  6261. for (var newToken in insert) {
  6262. if (insert.hasOwnProperty(newToken)) {
  6263. ret[newToken] = insert[newToken];
  6264. }
  6265. }
  6266. }
  6267. ret[token] = grammar[token];
  6268. }
  6269. }
  6270. // Update references in other language definitions
  6271. _.languages.DFS(_.languages, function(key, value) {
  6272. if (value === root[inside] && key != inside) {
  6273. this[key] = ret;
  6274. }
  6275. });
  6276. return root[inside] = ret;
  6277. },
  6278. // Traverse a language definition with Depth First Search
  6279. DFS: function(o, callback, type, visited) {
  6280. visited = visited || {};
  6281. for (var i in o) {
  6282. if (o.hasOwnProperty(i)) {
  6283. callback.call(o, i, o[i], type || i);
  6284. if (_.util.type(o[i]) === 'Object' && !visited[_.util.objId(o[i])]) {
  6285. visited[_.util.objId(o[i])] = true;
  6286. _.languages.DFS(o[i], callback, null, visited);
  6287. }
  6288. else if (_.util.type(o[i]) === 'Array' && !visited[_.util.objId(o[i])]) {
  6289. visited[_.util.objId(o[i])] = true;
  6290. _.languages.DFS(o[i], callback, i, visited);
  6291. }
  6292. }
  6293. }
  6294. }
  6295. },
  6296. plugins: {},
  6297. highlightAll: function(async, callback) {
  6298. var env = {
  6299. callback: callback,
  6300. selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
  6301. };
  6302. _.hooks.run("before-highlightall", env);
  6303. var elements = env.elements || document.querySelectorAll(env.selector);
  6304. for (var i=0, element; element = elements[i++];) {
  6305. _.highlightElement(element, async === true, env.callback);
  6306. }
  6307. },
  6308. highlightElement: function(element, async, callback) {
  6309. // Find language
  6310. var language, grammar, parent = element;
  6311. while (parent && !lang.test(parent.className)) {
  6312. parent = parent.parentNode;
  6313. }
  6314. if (parent) {
  6315. language = (parent.className.match(lang) || [,''])[1].toLowerCase();
  6316. grammar = _.languages[language];
  6317. }
  6318. // Set language on the element, if not present
  6319. element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
  6320. // Set language on the parent, for styling
  6321. parent = element.parentNode;
  6322. if (/pre/i.test(parent.nodeName)) {
  6323. parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
  6324. }
  6325. var code = element.textContent;
  6326. var env = {
  6327. element: element,
  6328. language: language,
  6329. grammar: grammar,
  6330. code: code
  6331. };
  6332. _.hooks.run('before-sanity-check', env);
  6333. if (!env.code || !env.grammar) {
  6334. if (env.code) {
  6335. _.hooks.run('before-highlight', env);
  6336. env.element.textContent = env.code;
  6337. _.hooks.run('after-highlight', env);
  6338. }
  6339. _.hooks.run('complete', env);
  6340. return;
  6341. }
  6342. _.hooks.run('before-highlight', env);
  6343. if (async && _self.Worker) {
  6344. var worker = new Worker(_.filename);
  6345. worker.onmessage = function(evt) {
  6346. env.highlightedCode = evt.data;
  6347. _.hooks.run('before-insert', env);
  6348. env.element.innerHTML = env.highlightedCode;
  6349. callback && callback.call(env.element);
  6350. _.hooks.run('after-highlight', env);
  6351. _.hooks.run('complete', env);
  6352. };
  6353. worker.postMessage(JSON.stringify({
  6354. language: env.language,
  6355. code: env.code,
  6356. immediateClose: true
  6357. }));
  6358. }
  6359. else {
  6360. env.highlightedCode = _.highlight(env.code, env.grammar, env.language);
  6361. _.hooks.run('before-insert', env);
  6362. env.element.innerHTML = env.highlightedCode;
  6363. callback && callback.call(element);
  6364. _.hooks.run('after-highlight', env);
  6365. _.hooks.run('complete', env);
  6366. }
  6367. },
  6368. highlight: function (text, grammar, language) {
  6369. var tokens = _.tokenize(text, grammar);
  6370. return Token.stringify(_.util.encode(tokens), language);
  6371. },
  6372. matchGrammar: function (text, strarr, grammar, index, startPos, oneshot, target) {
  6373. var Token = _.Token;
  6374. for (var token in grammar) {
  6375. if(!grammar.hasOwnProperty(token) || !grammar[token]) {
  6376. continue;
  6377. }
  6378. if (token == target) {
  6379. return;
  6380. }
  6381. var patterns = grammar[token];
  6382. patterns = (_.util.type(patterns) === "Array") ? patterns : [patterns];
  6383. for (var j = 0; j < patterns.length; ++j) {
  6384. var pattern = patterns[j],
  6385. inside = pattern.inside,
  6386. lookbehind = !!pattern.lookbehind,
  6387. greedy = !!pattern.greedy,
  6388. lookbehindLength = 0,
  6389. alias = pattern.alias;
  6390. if (greedy && !pattern.pattern.global) {
  6391. // Without the global flag, lastIndex won't work
  6392. var flags = pattern.pattern.toString().match(/[imuy]*$/)[0];
  6393. pattern.pattern = RegExp(pattern.pattern.source, flags + "g");
  6394. }
  6395. pattern = pattern.pattern || pattern;
  6396. // Don’t cache length as it changes during the loop
  6397. for (var i = index, pos = startPos; i < strarr.length; pos += strarr[i].length, ++i) {
  6398. var str = strarr[i];
  6399. if (strarr.length > text.length) {
  6400. // Something went terribly wrong, ABORT, ABORT!
  6401. return;
  6402. }
  6403. if (str instanceof Token) {
  6404. continue;
  6405. }
  6406. pattern.lastIndex = 0;
  6407. var match = pattern.exec(str),
  6408. delNum = 1;
  6409. // Greedy patterns can override/remove up to two previously matched tokens
  6410. if (!match && greedy && i != strarr.length - 1) {
  6411. pattern.lastIndex = pos;
  6412. match = pattern.exec(text);
  6413. if (!match) {
  6414. break;
  6415. }
  6416. var from = match.index + (lookbehind ? match[1].length : 0),
  6417. to = match.index + match[0].length,
  6418. k = i,
  6419. p = pos;
  6420. for (var len = strarr.length; k < len && (p < to || (!strarr[k].type && !strarr[k - 1].greedy)); ++k) {
  6421. p += strarr[k].length;
  6422. // Move the index i to the element in strarr that is closest to from
  6423. if (from >= p) {
  6424. ++i;
  6425. pos = p;
  6426. }
  6427. }
  6428. /*
  6429. * If strarr[i] is a Token, then the match starts inside another Token, which is invalid
  6430. * If strarr[k - 1] is greedy we are in conflict with another greedy pattern
  6431. */
  6432. if (strarr[i] instanceof Token || strarr[k - 1].greedy) {
  6433. continue;
  6434. }
  6435. // Number of tokens to delete and replace with the new match
  6436. delNum = k - i;
  6437. str = text.slice(pos, p);
  6438. match.index -= pos;
  6439. }
  6440. if (!match) {
  6441. if (oneshot) {
  6442. break;
  6443. }
  6444. continue;
  6445. }
  6446. if(lookbehind) {
  6447. lookbehindLength = match[1].length;
  6448. }
  6449. var from = match.index + lookbehindLength,
  6450. match = match[0].slice(lookbehindLength),
  6451. to = from + match.length,
  6452. before = str.slice(0, from),
  6453. after = str.slice(to);
  6454. var args = [i, delNum];
  6455. if (before) {
  6456. ++i;
  6457. pos += before.length;
  6458. args.push(before);
  6459. }
  6460. var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias, match, greedy);
  6461. args.push(wrapped);
  6462. if (after) {
  6463. args.push(after);
  6464. }
  6465. Array.prototype.splice.apply(strarr, args);
  6466. if (delNum != 1)
  6467. _.matchGrammar(text, strarr, grammar, i, pos, true, token);
  6468. if (oneshot)
  6469. break;
  6470. }
  6471. }
  6472. }
  6473. },
  6474. tokenize: function(text, grammar, language) {
  6475. var strarr = [text];
  6476. var rest = grammar.rest;
  6477. if (rest) {
  6478. for (var token in rest) {
  6479. grammar[token] = rest[token];
  6480. }
  6481. delete grammar.rest;
  6482. }
  6483. _.matchGrammar(text, strarr, grammar, 0, 0, false);
  6484. return strarr;
  6485. },
  6486. hooks: {
  6487. all: {},
  6488. add: function (name, callback) {
  6489. var hooks = _.hooks.all;
  6490. hooks[name] = hooks[name] || [];
  6491. hooks[name].push(callback);
  6492. },
  6493. run: function (name, env) {
  6494. var callbacks = _.hooks.all[name];
  6495. if (!callbacks || !callbacks.length) {
  6496. return;
  6497. }
  6498. for (var i=0, callback; callback = callbacks[i++];) {
  6499. callback(env);
  6500. }
  6501. }
  6502. }
  6503. };
  6504. var Token = _.Token = function(type, content, alias, matchedStr, greedy) {
  6505. this.type = type;
  6506. this.content = content;
  6507. this.alias = alias;
  6508. // Copy of the full string this token was created from
  6509. this.length = (matchedStr || "").length|0;
  6510. this.greedy = !!greedy;
  6511. };
  6512. Token.stringify = function(o, language, parent) {
  6513. if (typeof o == 'string') {
  6514. return o;
  6515. }
  6516. if (_.util.type(o) === 'Array') {
  6517. return o.map(function(element) {
  6518. return Token.stringify(element, language, o);
  6519. }).join('');
  6520. }
  6521. var env = {
  6522. type: o.type,
  6523. content: Token.stringify(o.content, language, parent),
  6524. tag: 'span',
  6525. classes: ['token', o.type],
  6526. attributes: {},
  6527. language: language,
  6528. parent: parent
  6529. };
  6530. if (env.type == 'comment') {
  6531. env.attributes['spellcheck'] = 'true';
  6532. }
  6533. if (o.alias) {
  6534. var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias];
  6535. Array.prototype.push.apply(env.classes, aliases);
  6536. }
  6537. _.hooks.run('wrap', env);
  6538. var attributes = Object.keys(env.attributes).map(function(name) {
  6539. return name + '="' + (env.attributes[name] || '').replace(/"/g, '&quot;') + '"';
  6540. }).join(' ');
  6541. return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + '</' + env.tag + '>';
  6542. };
  6543. if (!_self.document) {
  6544. if (!_self.addEventListener) {
  6545. // in Node.js
  6546. return _self.Prism;
  6547. }
  6548. // In worker
  6549. _self.addEventListener('message', function(evt) {
  6550. var message = JSON.parse(evt.data),
  6551. lang = message.language,
  6552. code = message.code,
  6553. immediateClose = message.immediateClose;
  6554. _self.postMessage(_.highlight(code, _.languages[lang], lang));
  6555. if (immediateClose) {
  6556. _self.close();
  6557. }
  6558. }, false);
  6559. return _self.Prism;
  6560. }
  6561. //Get current script and highlight
  6562. var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop();
  6563. if (script) {
  6564. _.filename = script.src;
  6565. if (!_.manual && !script.hasAttribute('data-manual')) {
  6566. if(document.readyState !== "loading") {
  6567. if (window.requestAnimationFrame) {
  6568. window.requestAnimationFrame(_.highlightAll);
  6569. } else {
  6570. window.setTimeout(_.highlightAll, 16);
  6571. }
  6572. }
  6573. else {
  6574. document.addEventListener('DOMContentLoaded', _.highlightAll);
  6575. }
  6576. }
  6577. }
  6578. return _self.Prism;
  6579. })();
  6580. if (typeof module !== 'undefined' && module.exports) {
  6581. module.exports = Prism;
  6582. }
  6583. // hack for components to work correctly in node.js
  6584. if (typeof global !== 'undefined') {
  6585. global.Prism = Prism;
  6586. }
  6587. /* **********************************************
  6588. Begin prism-markup.js
  6589. ********************************************** */
  6590. Prism.languages.markup = {
  6591. 'comment': /<!--[\s\S]*?-->/,
  6592. 'prolog': /<\?[\s\S]+?\?>/,
  6593. 'doctype': /<!DOCTYPE[\s\S]+?>/i,
  6594. 'cdata': /<!\[CDATA\[[\s\S]*?]]>/i,
  6595. 'tag': {
  6596. pattern: /<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\s\S])*\1|[^\s'">=]+))?)*\s*\/?>/i,
  6597. inside: {
  6598. 'tag': {
  6599. pattern: /^<\/?[^\s>\/]+/i,
  6600. inside: {
  6601. 'punctuation': /^<\/?/,
  6602. 'namespace': /^[^\s>\/:]+:/
  6603. }
  6604. },
  6605. 'attr-value': {
  6606. pattern: /=(?:('|")[\s\S]*?(\1)|[^\s>]+)/i,
  6607. inside: {
  6608. 'punctuation': /[=>"']/
  6609. }
  6610. },
  6611. 'punctuation': /\/?>/,
  6612. 'attr-name': {
  6613. pattern: /[^\s>\/]+/,
  6614. inside: {
  6615. 'namespace': /^[^\s>\/:]+:/
  6616. }
  6617. }
  6618. }
  6619. },
  6620. 'entity': /&#?[\da-z]{1,8};/i
  6621. };
  6622. Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
  6623. Prism.languages.markup['entity'];
  6624. // Plugin to make entity title show the real entity, idea by Roman Komarov
  6625. Prism.hooks.add('wrap', function(env) {
  6626. if (env.type === 'entity') {
  6627. env.attributes['title'] = env.content.replace(/&amp;/, '&');
  6628. }
  6629. });
  6630. Prism.languages.xml = Prism.languages.markup;
  6631. Prism.languages.html = Prism.languages.markup;
  6632. Prism.languages.mathml = Prism.languages.markup;
  6633. Prism.languages.svg = Prism.languages.markup;
  6634. /* **********************************************
  6635. Begin prism-css.js
  6636. ********************************************** */
  6637. Prism.languages.css = {
  6638. 'comment': /\/\*[\s\S]*?\*\//,
  6639. 'atrule': {
  6640. pattern: /@[\w-]+?.*?(;|(?=\s*\{))/i,
  6641. inside: {
  6642. 'rule': /@[\w-]+/
  6643. // See rest below
  6644. }
  6645. },
  6646. 'url': /url\((?:(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,
  6647. 'selector': /[^\{\}\s][^\{\};]*?(?=\s*\{)/,
  6648. 'string': {
  6649. pattern: /("|')(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
  6650. greedy: true
  6651. },
  6652. 'property': /(\b|\B)[\w-]+(?=\s*:)/i,
  6653. 'important': /\B!important\b/i,
  6654. 'function': /[-a-z0-9]+(?=\()/i,
  6655. 'punctuation': /[(){};:]/
  6656. };
  6657. Prism.languages.css['atrule'].inside.rest = Prism.util.clone(Prism.languages.css);
  6658. if (Prism.languages.markup) {
  6659. Prism.languages.insertBefore('markup', 'tag', {
  6660. 'style': {
  6661. pattern: /(<style[\s\S]*?>)[\s\S]*?(?=<\/style>)/i,
  6662. lookbehind: true,
  6663. inside: Prism.languages.css,
  6664. alias: 'language-css'
  6665. }
  6666. });
  6667. Prism.languages.insertBefore('inside', 'attr-value', {
  6668. 'style-attr': {
  6669. pattern: /\s*style=("|').*?\1/i,
  6670. inside: {
  6671. 'attr-name': {
  6672. pattern: /^\s*style/i,
  6673. inside: Prism.languages.markup.tag.inside
  6674. },
  6675. 'punctuation': /^\s*=\s*['"]|['"]\s*$/,
  6676. 'attr-value': {
  6677. pattern: /.+/i,
  6678. inside: Prism.languages.css
  6679. }
  6680. },
  6681. alias: 'language-css'
  6682. }
  6683. }, Prism.languages.markup.tag);
  6684. }
  6685. /* **********************************************
  6686. Begin prism-clike.js
  6687. ********************************************** */
  6688. Prism.languages.clike = {
  6689. 'comment': [
  6690. {
  6691. pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
  6692. lookbehind: true
  6693. },
  6694. {
  6695. pattern: /(^|[^\\:])\/\/.*/,
  6696. lookbehind: true
  6697. }
  6698. ],
  6699. 'string': {
  6700. pattern: /(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
  6701. greedy: true
  6702. },
  6703. 'class-name': {
  6704. pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,
  6705. lookbehind: true,
  6706. inside: {
  6707. punctuation: /(\.|\\)/
  6708. }
  6709. },
  6710. 'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
  6711. 'boolean': /\b(true|false)\b/,
  6712. 'function': /[a-z0-9_]+(?=\()/i,
  6713. 'number': /\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,
  6714. 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,
  6715. 'punctuation': /[{}[\];(),.:]/
  6716. };
  6717. /* **********************************************
  6718. Begin prism-javascript.js
  6719. ********************************************** */
  6720. Prism.languages.javascript = Prism.languages.extend('clike', {
  6721. 'keyword': /\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,
  6722. 'number': /\b-?(0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,
  6723. // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
  6724. 'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\s*\()/i,
  6725. 'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/
  6726. });
  6727. Prism.languages.insertBefore('javascript', 'keyword', {
  6728. 'regex': {
  6729. pattern: /(^|[^/])\/(?!\/)(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,
  6730. lookbehind: true,
  6731. greedy: true
  6732. },
  6733. // This must be declared before keyword because we use "function" inside the look-forward
  6734. 'function-variable': {
  6735. pattern: /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)\s*=>))/i,
  6736. alias: 'function'
  6737. }
  6738. });
  6739. Prism.languages.insertBefore('javascript', 'string', {
  6740. 'template-string': {
  6741. pattern: /`(?:\\\\|\\?[^\\])*?`/,
  6742. greedy: true,
  6743. inside: {
  6744. 'interpolation': {
  6745. pattern: /\$\{[^}]+\}/,
  6746. inside: {
  6747. 'interpolation-punctuation': {
  6748. pattern: /^\$\{|\}$/,
  6749. alias: 'punctuation'
  6750. },
  6751. rest: Prism.languages.javascript
  6752. }
  6753. },
  6754. 'string': /[\s\S]+/
  6755. }
  6756. }
  6757. });
  6758. if (Prism.languages.markup) {
  6759. Prism.languages.insertBefore('markup', 'tag', {
  6760. 'script': {
  6761. pattern: /(<script[\s\S]*?>)[\s\S]*?(?=<\/script>)/i,
  6762. lookbehind: true,
  6763. inside: Prism.languages.javascript,
  6764. alias: 'language-javascript'
  6765. }
  6766. });
  6767. }
  6768. Prism.languages.js = Prism.languages.javascript;
  6769. /* **********************************************
  6770. Begin prism-file-highlight.js
  6771. ********************************************** */
  6772. (function () {
  6773. if (typeof self === 'undefined' || !self.Prism || !self.document || !document.querySelector) {
  6774. return;
  6775. }
  6776. self.Prism.fileHighlight = function() {
  6777. var Extensions = {
  6778. 'js': 'javascript',
  6779. 'py': 'python',
  6780. 'rb': 'ruby',
  6781. 'ps1': 'powershell',
  6782. 'psm1': 'powershell',
  6783. 'sh': 'bash',
  6784. 'bat': 'batch',
  6785. 'h': 'c',
  6786. 'tex': 'latex'
  6787. };
  6788. Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) {
  6789. var src = pre.getAttribute('data-src');
  6790. var language, parent = pre;
  6791. var lang = /\blang(?:uage)?-(?!\*)(\w+)\b/i;
  6792. while (parent && !lang.test(parent.className)) {
  6793. parent = parent.parentNode;
  6794. }
  6795. if (parent) {
  6796. language = (pre.className.match(lang) || [, ''])[1];
  6797. }
  6798. if (!language) {
  6799. var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
  6800. language = Extensions[extension] || extension;
  6801. }
  6802. var code = document.createElement('code');
  6803. code.className = 'language-' + language;
  6804. pre.textContent = '';
  6805. code.textContent = 'Loading…';
  6806. pre.appendChild(code);
  6807. var xhr = new XMLHttpRequest();
  6808. xhr.open('GET', src, true);
  6809. xhr.onreadystatechange = function () {
  6810. if (xhr.readyState == 4) {
  6811. if (xhr.status < 400 && xhr.responseText) {
  6812. code.textContent = xhr.responseText;
  6813. Prism.highlightElement(code);
  6814. }
  6815. else if (xhr.status >= 400) {
  6816. code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
  6817. }
  6818. else {
  6819. code.textContent = '✖ Error: File does not exist or is empty';
  6820. }
  6821. }
  6822. };
  6823. xhr.send(null);
  6824. });
  6825. };
  6826. document.addEventListener('DOMContentLoaded', self.Prism.fileHighlight);
  6827. })();
  6828. /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
  6829. /***/ }),
  6830. /* 105 */
  6831. /***/ (function(module, exports) {
  6832. Prism.languages.java = Prism.languages.extend('clike', {
  6833. 'keyword': /\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/,
  6834. 'number': /\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+(?:e[+-]?\d+)?[df]?\b/i,
  6835. 'operator': {
  6836. pattern: /(^|[^.])(?:\+[+=]?|-[-=]?|!=?|<<?=?|>>?>?=?|==?|&[&=]?|\|[|=]?|\*=?|\/=?|%=?|\^=?|[?:~])/m,
  6837. lookbehind: true
  6838. }
  6839. });
  6840. Prism.languages.insertBefore('java','function', {
  6841. 'annotation': {
  6842. alias: 'punctuation',
  6843. pattern: /(^|[^.])@\w+/,
  6844. lookbehind: true
  6845. }
  6846. });
  6847. /***/ }),
  6848. /* 106 */
  6849. /***/ (function(module, exports) {
  6850. Prism.languages.csharp = Prism.languages.extend('clike', {
  6851. 'keyword': /\b(abstract|as|async|await|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|virtual|void|volatile|while|add|alias|ascending|async|await|descending|dynamic|from|get|global|group|into|join|let|orderby|partial|remove|select|set|value|var|where|yield)\b/,
  6852. 'string': [
  6853. {
  6854. pattern: /@("|')(\1\1|\\\1|\\?(?!\1)[\s\S])*\1/,
  6855. greedy: true
  6856. },
  6857. {
  6858. pattern: /("|')(\\?.)*?\1/,
  6859. greedy: true
  6860. }
  6861. ],
  6862. 'number': /\b-?(0x[\da-f]+|\d*\.?\d+f?)\b/i
  6863. });
  6864. Prism.languages.insertBefore('csharp', 'keyword', {
  6865. 'generic-method': {
  6866. pattern: /[a-z0-9_]+\s*<[^>\r\n]+?>\s*(?=\()/i,
  6867. alias: 'function',
  6868. inside: {
  6869. keyword: Prism.languages.csharp.keyword,
  6870. punctuation: /[<>(),.:]/
  6871. }
  6872. },
  6873. 'preprocessor': {
  6874. pattern: /(^\s*)#.*/m,
  6875. lookbehind: true,
  6876. alias: 'property',
  6877. inside: {
  6878. // highlight preprocessor directives as keywords
  6879. 'directive': {
  6880. pattern: /(\s*#)\b(define|elif|else|endif|endregion|error|if|line|pragma|region|undef|warning)\b/,
  6881. lookbehind: true,
  6882. alias: 'keyword'
  6883. }
  6884. }
  6885. }
  6886. });
  6887. /***/ }),
  6888. /* 107 */
  6889. /***/ (function(module, exports) {
  6890. /**
  6891. * Original by Aaron Harun: http://aahacreative.com/2012/07/31/php-syntax-highlighting-prism/
  6892. * Modified by Miles Johnson: http://milesj.me
  6893. *
  6894. * Supports the following:
  6895. * - Extends clike syntax
  6896. * - Support for PHP 5.3+ (namespaces, traits, generators, etc)
  6897. * - Smarter constant and function matching
  6898. *
  6899. * Adds the following new token classes:
  6900. * constant, delimiter, variable, function, package
  6901. */
  6902. Prism.languages.php = Prism.languages.extend('clike', {
  6903. 'keyword': /\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i,
  6904. 'constant': /\b[A-Z0-9_]{2,}\b/,
  6905. 'comment': {
  6906. pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
  6907. lookbehind: true
  6908. }
  6909. });
  6910. // Shell-like comments are matched after strings, because they are less
  6911. // common than strings containing hashes...
  6912. Prism.languages.insertBefore('php', 'class-name', {
  6913. 'shell-comment': {
  6914. pattern: /(^|[^\\])#.*/,
  6915. lookbehind: true,
  6916. alias: 'comment'
  6917. }
  6918. });
  6919. Prism.languages.insertBefore('php', 'keyword', {
  6920. 'delimiter': {
  6921. pattern: /\?>|<\?(?:php|=)?/i,
  6922. alias: 'important'
  6923. },
  6924. 'variable': /\$\w+\b/i,
  6925. 'package': {
  6926. pattern: /(\\|namespace\s+|use\s+)[\w\\]+/,
  6927. lookbehind: true,
  6928. inside: {
  6929. punctuation: /\\/
  6930. }
  6931. }
  6932. });
  6933. // Must be defined after the function pattern
  6934. Prism.languages.insertBefore('php', 'operator', {
  6935. 'property': {
  6936. pattern: /(->)[\w]+/,
  6937. lookbehind: true
  6938. }
  6939. });
  6940. // Add HTML support if the markup language exists
  6941. if (Prism.languages.markup) {
  6942. // Tokenize all inline PHP blocks that are wrapped in <?php ?>
  6943. // This allows for easy PHP + markup highlighting
  6944. Prism.hooks.add('before-highlight', function(env) {
  6945. if (env.language !== 'php' || !/(?:<\?php|<\?)/ig.test(env.code)) {
  6946. return;
  6947. }
  6948. env.tokenStack = [];
  6949. env.backupCode = env.code;
  6950. env.code = env.code.replace(/(?:<\?php|<\?)[\s\S]*?(?:\?>|$)/ig, function(match) {
  6951. var i = env.tokenStack.length;
  6952. // Check for existing strings
  6953. while (env.backupCode.indexOf('___PHP' + i + '___') !== -1)
  6954. ++i;
  6955. // Create a sparse array
  6956. env.tokenStack[i] = match;
  6957. return '___PHP' + i + '___';
  6958. });
  6959. // Switch the grammar to markup
  6960. env.grammar = Prism.languages.markup;
  6961. });
  6962. // Restore env.code for other plugins (e.g. line-numbers)
  6963. Prism.hooks.add('before-insert', function(env) {
  6964. if (env.language === 'php' && env.backupCode) {
  6965. env.code = env.backupCode;
  6966. delete env.backupCode;
  6967. }
  6968. });
  6969. // Re-insert the tokens after highlighting
  6970. Prism.hooks.add('after-highlight', function(env) {
  6971. if (env.language !== 'php' || !env.tokenStack) {
  6972. return;
  6973. }
  6974. // Switch the grammar back
  6975. env.grammar = Prism.languages.php;
  6976. for (var i = 0, keys = Object.keys(env.tokenStack); i < keys.length; ++i) {
  6977. var k = keys[i];
  6978. var t = env.tokenStack[k];
  6979. // The replace prevents $$, $&, $`, $', $n, $nn from being interpreted as special patterns
  6980. env.highlightedCode = env.highlightedCode.replace('___PHP' + k + '___',
  6981. "<span class=\"token php language-php\">" +
  6982. Prism.highlight(t, env.grammar, 'php').replace(/\$/g, '$$$$') +
  6983. "</span>");
  6984. }
  6985. env.element.innerHTML = env.highlightedCode;
  6986. });
  6987. }
  6988. /***/ }),
  6989. /* 108 */
  6990. /***/ (function(module, exports) {
  6991. Prism.languages.python= {
  6992. 'triple-quoted-string': {
  6993. pattern: /"""[\s\S]+?"""|'''[\s\S]+?'''/,
  6994. alias: 'string'
  6995. },
  6996. 'comment': {
  6997. pattern: /(^|[^\\])#.*/,
  6998. lookbehind: true
  6999. },
  7000. 'string': {
  7001. pattern: /("|')(?:\\\\|\\?[^\\\r\n])*?\1/,
  7002. greedy: true
  7003. },
  7004. 'function' : {
  7005. pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_][a-zA-Z0-9_]*(?=\()/g,
  7006. lookbehind: true
  7007. },
  7008. 'class-name': {
  7009. pattern: /(\bclass\s+)[a-z0-9_]+/i,
  7010. lookbehind: true
  7011. },
  7012. 'keyword' : /\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/,
  7013. 'boolean' : /\b(?:True|False)\b/,
  7014. 'number' : /\b-?(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,
  7015. 'operator' : /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,
  7016. 'punctuation' : /[{}[\];(),.:]/
  7017. };
  7018. /***/ }),
  7019. /* 109 */
  7020. /***/ (function(module, exports) {
  7021. Prism.languages.json = {
  7022. 'property': /"(?:\\.|[^\\"])*"(?=\s*:)/ig,
  7023. 'string': /"(?!:)(?:\\.|[^\\"])*"(?!:)/g,
  7024. 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?)\b/g,
  7025. 'punctuation': /[{}[\]);,]/g,
  7026. 'operator': /:/g,
  7027. 'boolean': /\b(true|false)\b/gi,
  7028. 'null': /\bnull\b/gi
  7029. };
  7030. Prism.languages.jsonp = Prism.languages.json;
  7031. /***/ }),
  7032. /* 110 */
  7033. /***/ (function(module, exports) {
  7034. Prism.languages.yaml={scalar:{pattern:/([\-:]\s*(![^\s]+)?[ \t]*[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)[^\r\n]+(?:\3[^\r\n]+)*)/,lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:/(\s*(?:^|[:\-,[{\r\n?])[ \t]*(![^\s]+)?[ \t]*)[^\r\n{[\]},#\s]+?(?=\s*:\s)/,lookbehind:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(\d{4}-\d\d?-\d\d?([tT]|[ \t]+)\d\d?:\d{2}:\d{2}(\.\d*)?[ \t]*(Z|[-+]\d\d?(:\d{2})?)?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(:\d{2}(\.\d*)?)?)(?=[ \t]*($|,|]|}))/m,lookbehind:!0,alias:"number"},"boolean":{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(true|false)[ \t]*(?=$|,|]|})/im,lookbehind:!0,alias:"important"},"null":{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(null|~)[ \t]*(?=$|,|]|})/im,lookbehind:!0,alias:"important"},string:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')(?=[ \t]*($|,|]|}))/m,lookbehind:!0,greedy:!0},number:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)[+\-]?(0x[\da-f]+|0o[0-7]+|(\d+\.?\d*|\.?\d+)(e[\+\-]?\d+)?|\.inf|\.nan)[ \t]*(?=$|,|]|})/im,lookbehind:!0},tag:/![^\s]+/,important:/[&*][\w]+/,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./};
  7035. /***/ }),
  7036. /* 111 */
  7037. /***/ (function(module, exports) {
  7038. Prism.languages.perl = {
  7039. 'comment': [
  7040. {
  7041. // POD
  7042. pattern: /(^\s*)=\w+[\s\S]*?=cut.*/m,
  7043. lookbehind: true
  7044. },
  7045. {
  7046. pattern: /(^|[^\\$])#.*/,
  7047. lookbehind: true
  7048. }
  7049. ],
  7050. // TODO Could be nice to handle Heredoc too.
  7051. 'string': [
  7052. // q/.../
  7053. {
  7054. pattern: /\b(?:q|qq|qx|qw)\s*([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1/,
  7055. greedy: true
  7056. },
  7057. // q a...a
  7058. {
  7059. pattern: /\b(?:q|qq|qx|qw)\s+([a-zA-Z0-9])(?:[^\\]|\\[\s\S])*?\1/,
  7060. greedy: true
  7061. },
  7062. // q(...)
  7063. {
  7064. pattern: /\b(?:q|qq|qx|qw)\s*\((?:[^()\\]|\\[\s\S])*\)/,
  7065. greedy: true
  7066. },
  7067. // q{...}
  7068. {
  7069. pattern: /\b(?:q|qq|qx|qw)\s*\{(?:[^{}\\]|\\[\s\S])*\}/,
  7070. greedy: true
  7071. },
  7072. // q[...]
  7073. {
  7074. pattern: /\b(?:q|qq|qx|qw)\s*\[(?:[^[\]\\]|\\[\s\S])*\]/,
  7075. greedy: true
  7076. },
  7077. // q<...>
  7078. {
  7079. pattern: /\b(?:q|qq|qx|qw)\s*<(?:[^<>\\]|\\[\s\S])*>/,
  7080. greedy: true
  7081. },
  7082. // "...", `...`
  7083. {
  7084. pattern: /("|`)(?:[^\\]|\\[\s\S])*?\1/,
  7085. greedy: true
  7086. },
  7087. // '...'
  7088. // FIXME Multi-line single-quoted strings are not supported as they would break variables containing '
  7089. {
  7090. pattern: /'(?:[^'\\\r\n]|\\.)*'/,
  7091. greedy: true
  7092. }
  7093. ],
  7094. 'regex': [
  7095. // m/.../
  7096. {
  7097. pattern: /\b(?:m|qr)\s*([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1[msixpodualngc]*/,
  7098. greedy: true
  7099. },
  7100. // m a...a
  7101. {
  7102. pattern: /\b(?:m|qr)\s+([a-zA-Z0-9])(?:[^\\]|\\.)*?\1[msixpodualngc]*/,
  7103. greedy: true
  7104. },
  7105. // m(...)
  7106. {
  7107. pattern: /\b(?:m|qr)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngc]*/,
  7108. greedy: true
  7109. },
  7110. // m{...}
  7111. {
  7112. pattern: /\b(?:m|qr)\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngc]*/,
  7113. greedy: true
  7114. },
  7115. // m[...]
  7116. {
  7117. pattern: /\b(?:m|qr)\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngc]*/,
  7118. greedy: true
  7119. },
  7120. // m<...>
  7121. {
  7122. pattern: /\b(?:m|qr)\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngc]*/,
  7123. greedy: true
  7124. },
  7125. // The lookbehinds prevent -s from breaking
  7126. // FIXME We don't handle change of separator like s(...)[...]
  7127. // s/.../.../
  7128. {
  7129. pattern: /(^|[^-]\b)(?:s|tr|y)\s*([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\2(?:[^\\]|\\[\s\S])*?\2[msixpodualngcer]*/,
  7130. lookbehind: true,
  7131. greedy: true
  7132. },
  7133. // s a...a...a
  7134. {
  7135. pattern: /(^|[^-]\b)(?:s|tr|y)\s+([a-zA-Z0-9])(?:[^\\]|\\[\s\S])*?\2(?:[^\\]|\\[\s\S])*?\2[msixpodualngcer]*/,
  7136. lookbehind: true,
  7137. greedy: true
  7138. },
  7139. // s(...)(...)
  7140. {
  7141. pattern: /(^|[^-]\b)(?:s|tr|y)\s*\((?:[^()\\]|\\[\s\S])*\)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngcer]*/,
  7142. lookbehind: true,
  7143. greedy: true
  7144. },
  7145. // s{...}{...}
  7146. {
  7147. pattern: /(^|[^-]\b)(?:s|tr|y)\s*\{(?:[^{}\\]|\\[\s\S])*\}\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngcer]*/,
  7148. lookbehind: true,
  7149. greedy: true
  7150. },
  7151. // s[...][...]
  7152. {
  7153. pattern: /(^|[^-]\b)(?:s|tr|y)\s*\[(?:[^[\]\\]|\\[\s\S])*\]\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngcer]*/,
  7154. lookbehind: true,
  7155. greedy: true
  7156. },
  7157. // s<...><...>
  7158. {
  7159. pattern: /(^|[^-]\b)(?:s|tr|y)\s*<(?:[^<>\\]|\\[\s\S])*>\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngcer]*/,
  7160. lookbehind: true,
  7161. greedy: true
  7162. },
  7163. // /.../
  7164. // The look-ahead tries to prevent two divisions on
  7165. // the same line from being highlighted as regex.
  7166. // This does not support multi-line regex.
  7167. {
  7168. pattern: /\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|x)\b))/,
  7169. greedy: true
  7170. }
  7171. ],
  7172. // FIXME Not sure about the handling of ::, ', and #
  7173. 'variable': [
  7174. // ${^POSTMATCH}
  7175. /[&*$@%]\{\^[A-Z]+\}/,
  7176. // $^V
  7177. /[&*$@%]\^[A-Z_]/,
  7178. // ${...}
  7179. /[&*$@%]#?(?=\{)/,
  7180. // $foo
  7181. /[&*$@%]#?((::)*'?(?!\d)[\w$]+)+(::)*/i,
  7182. // $1
  7183. /[&*$@%]\d+/,
  7184. // $_, @_, %!
  7185. // The negative lookahead prevents from breaking the %= operator
  7186. /(?!%=)[$@%][!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/
  7187. ],
  7188. 'filehandle': {
  7189. // <>, <FOO>, _
  7190. pattern: /<(?![<=])\S*>|\b_\b/,
  7191. alias: 'symbol'
  7192. },
  7193. 'vstring': {
  7194. // v1.2, 1.2.3
  7195. pattern: /v\d+(\.\d+)*|\d+(\.\d+){2,}/,
  7196. alias: 'string'
  7197. },
  7198. 'function': {
  7199. pattern: /sub [a-z0-9_]+/i,
  7200. inside: {
  7201. keyword: /sub/
  7202. }
  7203. },
  7204. 'keyword': /\b(any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|say|state|sub|switch|undef|unless|until|use|when|while)\b/,
  7205. 'number': /\b-?(0x[\dA-Fa-f](_?[\dA-Fa-f])*|0b[01](_?[01])*|(\d(_?\d)*)?\.?\d(_?\d)*([Ee][+-]?\d+)?)\b/,
  7206. 'operator': /-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor)\b/,
  7207. 'punctuation': /[{}[\];(),:]/
  7208. };
  7209. /***/ }),
  7210. /* 112 */
  7211. /***/ (function(module, exports) {
  7212. Prism.languages.go = Prism.languages.extend('clike', {
  7213. 'keyword': /\b(break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,
  7214. 'builtin': /\b(bool|byte|complex(64|128)|error|float(32|64)|rune|string|u?int(8|16|32|64|)|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(ln)?|real|recover)\b/,
  7215. 'boolean': /\b(_|iota|nil|true|false)\b/,
  7216. 'operator': /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
  7217. 'number': /\b(-?(0x[a-f\d]+|(\d+\.?\d*|\.\d+)(e[-+]?\d+)?)i?)\b/i,
  7218. 'string': {
  7219. pattern: /("|'|`)(\\?.|\r|\n)*?\1/,
  7220. greedy: true
  7221. }
  7222. });
  7223. delete Prism.languages.go['class-name'];
  7224. /***/ }),
  7225. /* 113 */
  7226. /***/ (function(module, exports) {
  7227. (function(Prism) {
  7228. var insideString = {
  7229. variable: [
  7230. // Arithmetic Environment
  7231. {
  7232. pattern: /\$?\(\([\s\S]+?\)\)/,
  7233. inside: {
  7234. // If there is a $ sign at the beginning highlight $(( and )) as variable
  7235. variable: [{
  7236. pattern: /(^\$\(\([\s\S]+)\)\)/,
  7237. lookbehind: true
  7238. },
  7239. /^\$\(\(/,
  7240. ],
  7241. number: /\b-?(?:0x[\dA-Fa-f]+|\d*\.?\d+(?:[Ee]-?\d+)?)\b/,
  7242. // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
  7243. operator: /--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,
  7244. // If there is no $ sign at the beginning highlight (( and )) as punctuation
  7245. punctuation: /\(\(?|\)\)?|,|;/
  7246. }
  7247. },
  7248. // Command Substitution
  7249. {
  7250. pattern: /\$\([^)]+\)|`[^`]+`/,
  7251. inside: {
  7252. variable: /^\$\(|^`|\)$|`$/
  7253. }
  7254. },
  7255. /\$(?:[a-z0-9_#\?\*!@]+|\{[^}]+\})/i
  7256. ],
  7257. };
  7258. Prism.languages.bash = {
  7259. 'shebang': {
  7260. pattern: /^#!\s*\/bin\/bash|^#!\s*\/bin\/sh/,
  7261. alias: 'important'
  7262. },
  7263. 'comment': {
  7264. pattern: /(^|[^"{\\])#.*/,
  7265. lookbehind: true
  7266. },
  7267. 'string': [
  7268. //Support for Here-Documents https://en.wikipedia.org/wiki/Here_document
  7269. {
  7270. pattern: /((?:^|[^<])<<\s*)(?:"|')?(\w+?)(?:"|')?\s*\r?\n(?:[\s\S])*?\r?\n\2/g,
  7271. lookbehind: true,
  7272. greedy: true,
  7273. inside: insideString
  7274. },
  7275. {
  7276. pattern: /(["'])(?:\\\\|\\?[^\\])*?\1/g,
  7277. greedy: true,
  7278. inside: insideString
  7279. }
  7280. ],
  7281. 'variable': insideString.variable,
  7282. // Originally based on http://ss64.com/bash/
  7283. 'function': {
  7284. pattern: /(^|\s|;|\||&)(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|npm|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|\s|;|\||&)/,
  7285. lookbehind: true
  7286. },
  7287. 'keyword': {
  7288. pattern: /(^|\s|;|\||&)(?:let|:|\.|if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)(?=$|\s|;|\||&)/,
  7289. lookbehind: true
  7290. },
  7291. 'boolean': {
  7292. pattern: /(^|\s|;|\||&)(?:true|false)(?=$|\s|;|\||&)/,
  7293. lookbehind: true
  7294. },
  7295. 'operator': /&&?|\|\|?|==?|!=?|<<<?|>>|<=?|>=?|=~/,
  7296. 'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];]/
  7297. };
  7298. var inside = insideString.variable[1].inside;
  7299. inside['function'] = Prism.languages.bash['function'];
  7300. inside.keyword = Prism.languages.bash.keyword;
  7301. inside.boolean = Prism.languages.bash.boolean;
  7302. inside.operator = Prism.languages.bash.operator;
  7303. inside.punctuation = Prism.languages.bash.punctuation;
  7304. })(Prism);
  7305. /***/ }),
  7306. /* 114 */
  7307. /***/ (function(module, exports) {
  7308. Prism.languages.fsharp = Prism.languages.extend('clike', {
  7309. 'comment': [
  7310. {
  7311. pattern: /(^|[^\\])\(\*[\s\S]*?\*\)/,
  7312. lookbehind: true
  7313. },
  7314. {
  7315. pattern: /(^|[^\\:])\/\/.*/,
  7316. lookbehind: true
  7317. }
  7318. ],
  7319. 'keyword': /\b(?:let|return|use|yield)(?:!\B|\b)|\b(abstract|and|as|assert|base|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|global|if|in|inherit|inline|interface|internal|lazy|match|member|module|mutable|namespace|new|not|null|of|open|or|override|private|public|rec|select|static|struct|then|to|true|try|type|upcast|val|void|when|while|with|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|include|method|mixin|object|parallel|process|protected|pure|sealed|tailcall|trait|virtual|volatile)\b/,
  7320. 'string': {
  7321. pattern: /(?:"""[\s\S]*?"""|@"(?:""|[^"])*"|("|')(?:\\\1|\\?(?!\1)[\s\S])*\1)B?/,
  7322. greedy: true
  7323. },
  7324. 'number': [
  7325. /\b-?0x[\da-fA-F]+(un|lf|LF)?\b/,
  7326. /\b-?0b[01]+(y|uy)?\b/,
  7327. /\b-?(\d*\.?\d+|\d+\.)([fFmM]|[eE][+-]?\d+)?\b/,
  7328. /\b-?\d+(y|uy|s|us|l|u|ul|L|UL|I)?\b/
  7329. ]
  7330. });
  7331. Prism.languages.insertBefore('fsharp', 'keyword', {
  7332. 'preprocessor': {
  7333. pattern: /^[^\r\n\S]*#.*/m,
  7334. alias: 'property',
  7335. inside: {
  7336. 'directive': {
  7337. pattern: /(\s*#)\b(else|endif|if|light|line|nowarn)\b/,
  7338. lookbehind: true,
  7339. alias: 'keyword'
  7340. }
  7341. }
  7342. }
  7343. });
  7344. /***/ }),
  7345. /* 115 */
  7346. /***/ (function(module, exports) {
  7347. Prism.languages.typescript = Prism.languages.extend('javascript', {
  7348. // From JavaScript Prism keyword list and TypeScript language spec: https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#221-reserved-words
  7349. 'keyword': /\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield|false|true|module|declare|constructor|string|Function|any|number|boolean|Array|enum|symbol|namespace|abstract|require|type)\b/
  7350. });
  7351. Prism.languages.ts = Prism.languages.typescript;
  7352. /***/ }),
  7353. /* 116 */
  7354. /***/ (function(module, exports) {
  7355. (function (Prism) {
  7356. var inside = {
  7357. 'url': /url\((["']?).*?\1\)/i,
  7358. 'string': {
  7359. pattern: /("|')(?:[^\\\r\n]|\\(?:\r\n|[\s\S]))*?\1/,
  7360. greedy: true
  7361. },
  7362. 'interpolation': null, // See below
  7363. 'func': null, // See below
  7364. 'important': /\B!(?:important|optional)\b/i,
  7365. 'keyword': {
  7366. pattern: /(^|\s+)(?:(?:if|else|for|return|unless)(?=\s+|$)|@[\w-]+)/,
  7367. lookbehind: true
  7368. },
  7369. 'hexcode': /#[\da-f]{3,6}/i,
  7370. 'number': /\b\d+(?:\.\d+)?%?/,
  7371. 'boolean': /\b(?:true|false)\b/,
  7372. 'operator': [
  7373. // We want non-word chars around "-" because it is
  7374. // accepted in property names.
  7375. /~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.+|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/
  7376. ],
  7377. 'punctuation': /[{}()\[\];:,]/
  7378. };
  7379. inside['interpolation'] = {
  7380. pattern: /\{[^\r\n}:]+\}/,
  7381. alias: 'variable',
  7382. inside: Prism.util.clone(inside)
  7383. };
  7384. inside['func'] = {
  7385. pattern: /[\w-]+\([^)]*\).*/,
  7386. inside: {
  7387. 'function': /^[^(]+/,
  7388. rest: Prism.util.clone(inside)
  7389. }
  7390. };
  7391. Prism.languages.stylus = {
  7392. 'comment': {
  7393. pattern: /(^|[^\\])(\/\*[\s\S]*?\*\/|\/\/.*)/,
  7394. lookbehind: true
  7395. },
  7396. 'atrule-declaration': {
  7397. pattern: /(^\s*)@.+/m,
  7398. lookbehind: true,
  7399. inside: {
  7400. 'atrule': /^@[\w-]+/,
  7401. rest: inside
  7402. }
  7403. },
  7404. 'variable-declaration': {
  7405. pattern: /(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:(?:\{[^}]*\}|.+)|$)/m,
  7406. lookbehind: true,
  7407. inside: {
  7408. 'variable': /^\S+/,
  7409. rest: inside
  7410. }
  7411. },
  7412. 'statement': {
  7413. pattern: /(^[ \t]*)(?:if|else|for|return|unless)[ \t]+.+/m,
  7414. lookbehind: true,
  7415. inside: {
  7416. keyword: /^\S+/,
  7417. rest: inside
  7418. }
  7419. },
  7420. // A property/value pair cannot end with a comma or a brace
  7421. // It cannot have indented content unless it ended with a semicolon
  7422. 'property-declaration': {
  7423. pattern: /((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)[^{\r\n]*(?:;|[^{\r\n,](?=$)(?!(\r?\n|\r)(?:\{|\2[ \t]+)))/m,
  7424. lookbehind: true,
  7425. inside: {
  7426. 'property': {
  7427. pattern: /^[^\s:]+/,
  7428. inside: {
  7429. 'interpolation': inside.interpolation
  7430. }
  7431. },
  7432. rest: inside
  7433. }
  7434. },
  7435. // A selector can contain parentheses only as part of a pseudo-element
  7436. // It can span multiple lines.
  7437. // It must end with a comma or an accolade or have indented content.
  7438. 'selector': {
  7439. pattern: /(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t]+)))/m,
  7440. lookbehind: true,
  7441. inside: {
  7442. 'interpolation': inside.interpolation,
  7443. 'punctuation': /[{},]/
  7444. }
  7445. },
  7446. 'func': inside.func,
  7447. 'string': inside.string,
  7448. 'interpolation': inside.interpolation,
  7449. 'punctuation': /[{}()\[\];:.]/
  7450. };
  7451. }(Prism));
  7452. /***/ }),
  7453. /* 117 */
  7454. /***/ (function(module, exports) {
  7455. /* FIXME :
  7456. :extend() is not handled specifically : its highlighting is buggy.
  7457. Mixin usage must be inside a ruleset to be highlighted.
  7458. At-rules (e.g. import) containing interpolations are buggy.
  7459. Detached rulesets are highlighted as at-rules.
  7460. A comment before a mixin usage prevents the latter to be properly highlighted.
  7461. */
  7462. Prism.languages.less = Prism.languages.extend('css', {
  7463. 'comment': [
  7464. /\/\*[\s\S]*?\*\//,
  7465. {
  7466. pattern: /(^|[^\\])\/\/.*/,
  7467. lookbehind: true
  7468. }
  7469. ],
  7470. 'atrule': {
  7471. pattern: /@[\w-]+?(?:\([^{}]+\)|[^(){};])*?(?=\s*\{)/i,
  7472. inside: {
  7473. 'punctuation': /[:()]/
  7474. }
  7475. },
  7476. // selectors and mixins are considered the same
  7477. 'selector': {
  7478. pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\([^{}]*\)|[^{};@])*?(?=\s*\{)/,
  7479. inside: {
  7480. // mixin parameters
  7481. 'variable': /@+[\w-]+/
  7482. }
  7483. },
  7484. 'property': /(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/i,
  7485. 'punctuation': /[{}();:,]/,
  7486. 'operator': /[+\-*\/]/
  7487. });
  7488. // Invert function and punctuation positions
  7489. Prism.languages.insertBefore('less', 'punctuation', {
  7490. 'function': Prism.languages.less.function
  7491. });
  7492. Prism.languages.insertBefore('less', 'property', {
  7493. 'variable': [
  7494. // Variable declaration (the colon must be consumed!)
  7495. {
  7496. pattern: /@[\w-]+\s*:/,
  7497. inside: {
  7498. "punctuation": /:/
  7499. }
  7500. },
  7501. // Variable usage
  7502. /@@?[\w-]+/
  7503. ],
  7504. 'mixin-usage': {
  7505. pattern: /([{;]\s*)[.#](?!\d)[\w-]+.*?(?=[(;])/,
  7506. lookbehind: true,
  7507. alias: 'function'
  7508. }
  7509. });
  7510. /***/ }),
  7511. /* 118 */
  7512. /***/ (function(module, exports) {
  7513. (function(Prism) {
  7514. Prism.languages.sass = Prism.languages.extend('css', {
  7515. // Sass comments don't need to be closed, only indented
  7516. 'comment': {
  7517. pattern: /^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t]+.+)*/m,
  7518. lookbehind: true
  7519. }
  7520. });
  7521. Prism.languages.insertBefore('sass', 'atrule', {
  7522. // We want to consume the whole line
  7523. 'atrule-line': {
  7524. // Includes support for = and + shortcuts
  7525. pattern: /^(?:[ \t]*)[@+=].+/m,
  7526. inside: {
  7527. 'atrule': /(?:@[\w-]+|[+=])/m
  7528. }
  7529. }
  7530. });
  7531. delete Prism.languages.sass.atrule;
  7532. var variable = /((\$[-_\w]+)|(#\{\$[-_\w]+\}))/i;
  7533. var operator = [
  7534. /[+*\/%]|[=!]=|<=?|>=?|\b(?:and|or|not)\b/,
  7535. {
  7536. pattern: /(\s+)-(?=\s)/,
  7537. lookbehind: true
  7538. }
  7539. ];
  7540. Prism.languages.insertBefore('sass', 'property', {
  7541. // We want to consume the whole line
  7542. 'variable-line': {
  7543. pattern: /^[ \t]*\$.+/m,
  7544. inside: {
  7545. 'punctuation': /:/,
  7546. 'variable': variable,
  7547. 'operator': operator
  7548. }
  7549. },
  7550. // We want to consume the whole line
  7551. 'property-line': {
  7552. pattern: /^[ \t]*(?:[^:\s]+ *:.*|:[^:\s]+.*)/m,
  7553. inside: {
  7554. 'property': [
  7555. /[^:\s]+(?=\s*:)/,
  7556. {
  7557. pattern: /(:)[^:\s]+/,
  7558. lookbehind: true
  7559. }
  7560. ],
  7561. 'punctuation': /:/,
  7562. 'variable': variable,
  7563. 'operator': operator,
  7564. 'important': Prism.languages.sass.important
  7565. }
  7566. }
  7567. });
  7568. delete Prism.languages.sass.property;
  7569. delete Prism.languages.sass.important;
  7570. // Now that whole lines for other patterns are consumed,
  7571. // what's left should be selectors
  7572. delete Prism.languages.sass.selector;
  7573. Prism.languages.insertBefore('sass', 'punctuation', {
  7574. 'selector': {
  7575. pattern: /([ \t]*)\S(?:,?[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,?[^,\r\n]+)*)*/,
  7576. lookbehind: true
  7577. }
  7578. });
  7579. }(Prism));
  7580. /***/ }),
  7581. /* 119 */
  7582. /***/ (function(module, exports) {
  7583. (function(Prism) {
  7584. var handlebars_pattern = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/g;
  7585. Prism.languages.handlebars = Prism.languages.extend('markup', {
  7586. 'handlebars': {
  7587. pattern: handlebars_pattern,
  7588. inside: {
  7589. 'delimiter': {
  7590. pattern: /^\{\{\{?|\}\}\}?$/i,
  7591. alias: 'punctuation'
  7592. },
  7593. 'string': /(["'])(\\?.)*?\1/,
  7594. 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?)\b/,
  7595. 'boolean': /\b(true|false)\b/,
  7596. 'block': {
  7597. pattern: /^(\s*~?\s*)[#\/]\S+?(?=\s*~?\s*$|\s)/i,
  7598. lookbehind: true,
  7599. alias: 'keyword'
  7600. },
  7601. 'brackets': {
  7602. pattern: /\[[^\]]+\]/,
  7603. inside: {
  7604. punctuation: /\[|\]/,
  7605. variable: /[\s\S]+/
  7606. }
  7607. },
  7608. 'punctuation': /[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/,
  7609. 'variable': /[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~\s]+/
  7610. }
  7611. }
  7612. });
  7613. // Comments are inserted at top so that they can
  7614. // surround markup
  7615. Prism.languages.insertBefore('handlebars', 'tag', {
  7616. 'handlebars-comment': {
  7617. pattern: /\{\{![\s\S]*?\}\}/,
  7618. alias: ['handlebars','comment']
  7619. }
  7620. });
  7621. // Tokenize all inline Handlebars expressions that are wrapped in {{ }} or {{{ }}}
  7622. // This allows for easy Handlebars + markup highlighting
  7623. Prism.hooks.add('before-highlight', function(env) {
  7624. if (env.language !== 'handlebars') {
  7625. return;
  7626. }
  7627. env.tokenStack = [];
  7628. env.backupCode = env.code;
  7629. env.code = env.code.replace(handlebars_pattern, function(match) {
  7630. var i = env.tokenStack.length;
  7631. // Check for existing strings
  7632. while (env.backupCode.indexOf('___HANDLEBARS' + i + '___') !== -1)
  7633. ++i;
  7634. // Create a sparse array
  7635. env.tokenStack[i] = match;
  7636. return '___HANDLEBARS' + i + '___';
  7637. });
  7638. });
  7639. // Restore env.code for other plugins (e.g. line-numbers)
  7640. Prism.hooks.add('before-insert', function(env) {
  7641. if (env.language === 'handlebars') {
  7642. env.code = env.backupCode;
  7643. delete env.backupCode;
  7644. }
  7645. });
  7646. // Re-insert the tokens after highlighting
  7647. // and highlight them with defined grammar
  7648. Prism.hooks.add('after-highlight', function(env) {
  7649. if (env.language !== 'handlebars') {
  7650. return;
  7651. }
  7652. for (var i = 0, keys = Object.keys(env.tokenStack); i < keys.length; ++i) {
  7653. var k = keys[i];
  7654. var t = env.tokenStack[k];
  7655. // The replace prevents $$, $&, $`, $', $n, $nn from being interpreted as special patterns
  7656. env.highlightedCode = env.highlightedCode.replace('___HANDLEBARS' + k + '___', Prism.highlight(t, env.grammar, 'handlebars').replace(/\$/g, '$$$$'));
  7657. }
  7658. env.element.innerHTML = env.highlightedCode;
  7659. });
  7660. }(Prism));
  7661. /***/ }),
  7662. /* 120 */
  7663. /***/ (function(module, exports) {
  7664. Prism.languages.applescript = {
  7665. 'comment': [
  7666. // Allow one level of nesting
  7667. /\(\*(?:\(\*[\s\S]*?\*\)|[\s\S])*?\*\)/,
  7668. /--.+/,
  7669. /#.+/
  7670. ],
  7671. 'string': /"(?:\\?.)*?"/,
  7672. 'number': /\b-?\d*\.?\d+([Ee]-?\d+)?\b/,
  7673. 'operator': [
  7674. /[&=≠≤≥*+\-\/÷^]|[<>]=?/,
  7675. /\b(?:(?:start|begin|end)s? with|(?:(?:does not|doesn't) contain|contains?)|(?:is|isn't|is not) (?:in|contained by)|(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?|(?:(?:does not|doesn't) come|comes) (?:before|after)|(?:is|isn't|is not) equal(?: to)?|(?:(?:does not|doesn't) equal|equals|equal to|isn't|is not)|(?:a )?(?:ref(?: to)?|reference to)|(?:and|or|div|mod|as|not))\b/
  7676. ],
  7677. 'keyword': /\b(?:about|above|after|against|apart from|around|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|continue|copy|does|eighth|else|end|equal|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|my|ninth|of|on|onto|out of|over|prop|property|put|repeat|return|returning|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/,
  7678. 'class': {
  7679. pattern: /\b(?:alias|application|boolean|class|constant|date|file|integer|list|number|POSIX file|real|record|reference|RGB color|script|text|centimetres|centimeters|feet|inches|kilometres|kilometers|metres|meters|miles|yards|square feet|square kilometres|square kilometers|square metres|square meters|square miles|square yards|cubic centimetres|cubic centimeters|cubic feet|cubic inches|cubic metres|cubic meters|cubic yards|gallons|litres|liters|quarts|grams|kilograms|ounces|pounds|degrees Celsius|degrees Fahrenheit|degrees Kelvin)\b/,
  7680. alias: 'builtin'
  7681. },
  7682. 'punctuation': /[{}():,¬«»《》]/
  7683. };
  7684. /***/ }),
  7685. /* 121 */
  7686. /***/ (function(module, exports) {
  7687. Prism.languages.actionscript = Prism.languages.extend('javascript', {
  7688. 'keyword': /\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with|dynamic|each|final|get|include|namespace|native|override|set|static)\b/,
  7689. 'operator': /\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/
  7690. });
  7691. Prism.languages.actionscript['class-name'].alias = 'function';
  7692. if (Prism.languages.markup) {
  7693. Prism.languages.insertBefore('actionscript', 'string', {
  7694. 'xml': {
  7695. pattern: /(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\\1|\\?(?!\1)[\s\S])*\2)*\s*\/?>/,
  7696. lookbehind: true,
  7697. inside: {
  7698. rest: Prism.languages.markup
  7699. }
  7700. }
  7701. });
  7702. }
  7703. /***/ }),
  7704. /* 122 */
  7705. /***/ (function(module, exports) {
  7706. Prism.languages.aspnet = Prism.languages.extend('markup', {
  7707. 'page-directive tag': {
  7708. pattern: /<%\s*@.*%>/i,
  7709. inside: {
  7710. 'page-directive tag': /<%\s*@\s*(?:Assembly|Control|Implements|Import|Master(?:Type)?|OutputCache|Page|PreviousPageType|Reference|Register)?|%>/i,
  7711. rest: Prism.languages.markup.tag.inside
  7712. }
  7713. },
  7714. 'directive tag': {
  7715. pattern: /<%.*%>/i,
  7716. inside: {
  7717. 'directive tag': /<%\s*?[$=%#:]{0,2}|%>/i,
  7718. rest: Prism.languages.csharp
  7719. }
  7720. }
  7721. });
  7722. // Regexp copied from prism-markup, with a negative look-ahead added
  7723. Prism.languages.aspnet.tag.pattern = /<(?!%)\/?[^\s>\/]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\s\S])*\1|[^\s'">=]+))?)*\s*\/?>/i;
  7724. // match directives of attribute value foo="<% Bar %>"
  7725. Prism.languages.insertBefore('inside', 'punctuation', {
  7726. 'directive tag': Prism.languages.aspnet['directive tag']
  7727. }, Prism.languages.aspnet.tag.inside["attr-value"]);
  7728. Prism.languages.insertBefore('aspnet', 'comment', {
  7729. 'asp comment': /<%--[\s\S]*?--%>/
  7730. });
  7731. // script runat="server" contains csharp, not javascript
  7732. Prism.languages.insertBefore('aspnet', Prism.languages.javascript ? 'script' : 'tag', {
  7733. 'asp script': {
  7734. pattern: /(<script(?=.*runat=['"]?server['"]?)[\s\S]*?>)[\s\S]*?(?=<\/script>)/i,
  7735. lookbehind: true,
  7736. inside: Prism.languages.csharp || {}
  7737. }
  7738. });
  7739. /***/ }),
  7740. /* 123 */
  7741. /***/ (function(module, exports) {
  7742. Prism.languages.basic = {
  7743. 'string': /"(?:""|[!#$%&'()*,\/:;<=>?^_ +\-.A-Z\d])*"/i,
  7744. 'comment': {
  7745. pattern: /(?:!|REM\b).+/i,
  7746. inside: {
  7747. 'keyword': /^REM/i
  7748. }
  7749. },
  7750. 'number': /(?:\b|\B[.-])(?:\d+\.?\d*)(?:E[+-]?\d+)?/i,
  7751. 'keyword': /\b(?:AS|BEEP|BLOAD|BSAVE|CALL(?: ABSOLUTE)?|CASE|CHAIN|CHDIR|CLEAR|CLOSE|CLS|COM|COMMON|CONST|DATA|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DIM|DO|DOUBLE|ELSE|ELSEIF|END|ENVIRON|ERASE|ERROR|EXIT|FIELD|FILES|FOR|FUNCTION|GET|GOSUB|GOTO|IF|INPUT|INTEGER|IOCTL|KEY|KILL|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|MKDIR|NAME|NEXT|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPTION BASE|OUT|POKE|PUT|READ|REDIM|REM|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SHARED|SINGLE|SELECT CASE|SHELL|SLEEP|STATIC|STEP|STOP|STRING|SUB|SWAP|SYSTEM|THEN|TIMER|TO|TROFF|TRON|TYPE|UNLOCK|UNTIL|USING|VIEW PRINT|WAIT|WEND|WHILE|WRITE)(?:\$|\b)/i,
  7752. 'function': /\b(?:ABS|ACCESS|ACOS|ANGLE|AREA|ARITHMETIC|ARRAY|ASIN|ASK|AT|ATN|BASE|BEGIN|BREAK|CAUSE|CEIL|CHR|CLIP|COLLATE|COLOR|CON|COS|COSH|COT|CSC|DATE|DATUM|DEBUG|DECIMAL|DEF|DEG|DEGREES|DELETE|DET|DEVICE|DISPLAY|DOT|ELAPSED|EPS|ERASABLE|EXLINE|EXP|EXTERNAL|EXTYPE|FILETYPE|FIXED|FP|GO|GRAPH|HANDLER|IDN|IMAGE|IN|INT|INTERNAL|IP|IS|KEYED|LBOUND|LCASE|LEFT|LEN|LENGTH|LET|LINE|LINES|LOG|LOG10|LOG2|LTRIM|MARGIN|MAT|MAX|MAXNUM|MID|MIN|MISSING|MOD|NATIVE|NUL|NUMERIC|OF|OPTION|ORD|ORGANIZATION|OUTIN|OUTPUT|PI|POINT|POINTER|POINTS|POS|PRINT|PROGRAM|PROMPT|RAD|RADIANS|RANDOMIZE|RECORD|RECSIZE|RECTYPE|RELATIVE|REMAINDER|REPEAT|REST|RETRY|REWRITE|RIGHT|RND|ROUND|RTRIM|SAME|SEC|SELECT|SEQUENTIAL|SET|SETTER|SGN|SIN|SINH|SIZE|SKIP|SQR|STANDARD|STATUS|STR|STREAM|STYLE|TAB|TAN|TANH|TEMPLATE|TEXT|THERE|TIME|TIMEOUT|TRACE|TRANSFORM|TRUNCATE|UBOUND|UCASE|USE|VAL|VARIABLE|VIEWPORT|WHEN|WINDOW|WITH|ZER|ZONEWIDTH)(?:\$|\b)/i,
  7753. 'operator': /<[=>]?|>=?|[+\-*\/^=&]|\b(?:AND|EQV|IMP|NOT|OR|XOR)\b/i,
  7754. 'punctuation': /[,;:()]/
  7755. };
  7756. /***/ }),
  7757. /* 124 */
  7758. /***/ (function(module, exports) {
  7759. Prism.languages.c = Prism.languages.extend('clike', {
  7760. 'keyword': /\b(_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,
  7761. 'operator': /\-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|?\||[~^%?*\/]/,
  7762. 'number': /\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)[ful]*\b/i
  7763. });
  7764. Prism.languages.insertBefore('c', 'string', {
  7765. 'macro': {
  7766. // allow for multiline macro definitions
  7767. // spaces after the # character compile fine with gcc
  7768. pattern: /(^\s*)#\s*[a-z]+([^\r\n\\]|\\.|\\(?:\r\n?|\n))*/im,
  7769. lookbehind: true,
  7770. alias: 'property',
  7771. inside: {
  7772. // highlight the path of the include statement as a string
  7773. 'string': {
  7774. pattern: /(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/,
  7775. lookbehind: true
  7776. },
  7777. // highlight macro directives as keywords
  7778. 'directive': {
  7779. pattern: /(#\s*)\b(define|defined|elif|else|endif|error|ifdef|ifndef|if|import|include|line|pragma|undef|using)\b/,
  7780. lookbehind: true,
  7781. alias: 'keyword'
  7782. }
  7783. }
  7784. },
  7785. // highlight predefined macros as constants
  7786. 'constant': /\b(__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/
  7787. });
  7788. delete Prism.languages.c['class-name'];
  7789. delete Prism.languages.c['boolean'];
  7790. /***/ }),
  7791. /* 125 */
  7792. /***/ (function(module, exports) {
  7793. // Based on Free Pascal
  7794. /* TODO
  7795. Support inline asm ?
  7796. */
  7797. Prism.languages.pascal = {
  7798. 'comment': [
  7799. /\(\*[\s\S]+?\*\)/,
  7800. /\{[\s\S]+?\}/,
  7801. /\/\/.*/
  7802. ],
  7803. 'string': {
  7804. pattern: /(?:'(?:''|[^'\r\n])*'|#[&$%]?[a-f\d]+)+|\^[a-z]/i,
  7805. greedy: true
  7806. },
  7807. 'keyword': [
  7808. {
  7809. // Turbo Pascal
  7810. pattern: /(^|[^&])\b(?:absolute|array|asm|begin|case|const|constructor|destructor|do|downto|else|end|file|for|function|goto|if|implementation|inherited|inline|interface|label|nil|object|of|operator|packed|procedure|program|record|reintroduce|repeat|self|set|string|then|to|type|unit|until|uses|var|while|with)\b/i,
  7811. lookbehind: true
  7812. },
  7813. {
  7814. // Free Pascal
  7815. pattern: /(^|[^&])\b(?:dispose|exit|false|new|true)\b/i,
  7816. lookbehind: true
  7817. },
  7818. {
  7819. // Object Pascal
  7820. pattern: /(^|[^&])\b(?:class|dispinterface|except|exports|finalization|finally|initialization|inline|library|on|out|packed|property|raise|resourcestring|threadvar|try)\b/i,
  7821. lookbehind: true
  7822. },
  7823. {
  7824. // Modifiers
  7825. pattern: /(^|[^&])\b(?:absolute|abstract|alias|assembler|bitpacked|break|cdecl|continue|cppdecl|cvar|default|deprecated|dynamic|enumerator|experimental|export|external|far|far16|forward|generic|helper|implements|index|interrupt|iochecks|local|message|name|near|nodefault|noreturn|nostackframe|oldfpccall|otherwise|overload|override|pascal|platform|private|protected|public|published|read|register|reintroduce|result|safecall|saveregisters|softfloat|specialize|static|stdcall|stored|strict|unaligned|unimplemented|varargs|virtual|write)\b/i,
  7826. lookbehind: true
  7827. }
  7828. ],
  7829. 'number': [
  7830. // Hexadecimal, octal and binary
  7831. /[+-]?(?:[&%]\d+|\$[a-f\d]+)/i,
  7832. // Decimal
  7833. /([+-]|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?/i
  7834. ],
  7835. 'operator': [
  7836. /\.\.|\*\*|:=|<[<=>]?|>[>=]?|[+\-*\/]=?|[@^=]/i,
  7837. {
  7838. pattern: /(^|[^&])\b(?:and|as|div|exclude|in|include|is|mod|not|or|shl|shr|xor)\b/,
  7839. lookbehind: true
  7840. }
  7841. ],
  7842. 'punctuation': /\(\.|\.\)|[()\[\]:;,.]/
  7843. };
  7844. /***/ }),
  7845. /* 126 */
  7846. /***/ (function(module, exports) {
  7847. Prism.languages.vim = {
  7848. 'string': /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\r\n]|'')*'/,
  7849. 'comment': /".*/,
  7850. 'function': /\w+(?=\()/,
  7851. 'keyword': /\b(?:ab|abbreviate|abc|abclear|abo|aboveleft|al|all|arga|argadd|argd|argdelete|argdo|arge|argedit|argg|argglobal|argl|arglocal|ar|args|argu|argument|as|ascii|bad|badd|ba|ball|bd|bdelete|be|bel|belowright|bf|bfirst|bl|blast|bm|bmodified|bn|bnext|bN|bNext|bo|botright|bp|bprevious|brea|break|breaka|breakadd|breakd|breakdel|breakl|breaklist|br|brewind|bro|browse|bufdo|b|buffer|buffers|bun|bunload|bw|bwipeout|ca|cabbrev|cabc|cabclear|caddb|caddbuffer|cad|caddexpr|caddf|caddfile|cal|call|cat|catch|cb|cbuffer|cc|ccl|cclose|cd|ce|center|cex|cexpr|cf|cfile|cfir|cfirst|cgetb|cgetbuffer|cgete|cgetexpr|cg|cgetfile|c|change|changes|chd|chdir|che|checkpath|checkt|checktime|cla|clast|cl|clist|clo|close|cmapc|cmapclear|cnew|cnewer|cn|cnext|cN|cNext|cnf|cnfile|cNfcNfile|cnorea|cnoreabbrev|col|colder|colo|colorscheme|comc|comclear|comp|compiler|conf|confirm|con|continue|cope|copen|co|copy|cpf|cpfile|cp|cprevious|cq|cquit|cr|crewind|cuna|cunabbrev|cu|cunmap|cw|cwindow|debugg|debuggreedy|delc|delcommand|d|delete|delf|delfunction|delm|delmarks|diffg|diffget|diffoff|diffpatch|diffpu|diffput|diffsplit|diffthis|diffu|diffupdate|dig|digraphs|di|display|dj|djump|dl|dlist|dr|drop|ds|dsearch|dsp|dsplit|earlier|echoe|echoerr|echom|echomsg|echon|e|edit|el|else|elsei|elseif|em|emenu|endfo|endfor|endf|endfunction|endfun|en|endif|endt|endtry|endw|endwhile|ene|enew|ex|exi|exit|exu|exusage|f|file|files|filetype|fina|finally|fin|find|fini|finish|fir|first|fix|fixdel|fo|fold|foldc|foldclose|folddoc|folddoclosed|foldd|folddoopen|foldo|foldopen|for|fu|fun|function|go|goto|gr|grep|grepa|grepadd|ha|hardcopy|h|help|helpf|helpfind|helpg|helpgrep|helpt|helptags|hid|hide|his|history|ia|iabbrev|iabc|iabclear|if|ij|ijump|il|ilist|imapc|imapclear|in|inorea|inoreabbrev|isearch|isp|isplit|iuna|iunabbrev|iu|iunmap|j|join|ju|jumps|k|keepalt|keepj|keepjumps|kee|keepmarks|laddb|laddbuffer|lad|laddexpr|laddf|laddfile|lan|language|la|last|later|lb|lbuffer|lc|lcd|lch|lchdir|lcl|lclose|let|left|lefta|leftabove|lex|lexpr|lf|lfile|lfir|lfirst|lgetb|lgetbuffer|lgete|lgetexpr|lg|lgetfile|lgr|lgrep|lgrepa|lgrepadd|lh|lhelpgrep|l|list|ll|lla|llast|lli|llist|lmak|lmake|lm|lmap|lmapc|lmapclear|lnew|lnewer|lne|lnext|lN|lNext|lnf|lnfile|lNf|lNfile|ln|lnoremap|lo|loadview|loc|lockmarks|lockv|lockvar|lol|lolder|lop|lopen|lpf|lpfile|lp|lprevious|lr|lrewind|ls|lt|ltag|lu|lunmap|lv|lvimgrep|lvimgrepa|lvimgrepadd|lw|lwindow|mak|make|ma|mark|marks|mat|match|menut|menutranslate|mk|mkexrc|mks|mksession|mksp|mkspell|mkvie|mkview|mkv|mkvimrc|mod|mode|m|move|mzf|mzfile|mz|mzscheme|nbkey|new|n|next|N|Next|nmapc|nmapclear|noh|nohlsearch|norea|noreabbrev|nu|number|nun|nunmap|omapc|omapclear|on|only|o|open|opt|options|ou|ounmap|pc|pclose|ped|pedit|pe|perl|perld|perldo|po|pop|popu|popu|popup|pp|ppop|pre|preserve|prev|previous|p|print|P|Print|profd|profdel|prof|profile|promptf|promptfind|promptr|promptrepl|ps|psearch|pta|ptag|ptf|ptfirst|ptj|ptjump|ptl|ptlast|ptn|ptnext|ptN|ptNext|ptp|ptprevious|ptr|ptrewind|pts|ptselect|pu|put|pw|pwd|pyf|pyfile|py|python|qa|qall|q|quit|quita|quitall|r|read|rec|recover|redi|redir|red|redo|redr|redraw|redraws|redrawstatus|reg|registers|res|resize|ret|retab|retu|return|rew|rewind|ri|right|rightb|rightbelow|rub|ruby|rubyd|rubydo|rubyf|rubyfile|ru|runtime|rv|rviminfo|sal|sall|san|sandbox|sa|sargument|sav|saveas|sba|sball|sbf|sbfirst|sbl|sblast|sbm|sbmodified|sbn|sbnext|sbN|sbNext|sbp|sbprevious|sbr|sbrewind|sb|sbuffer|scripte|scriptencoding|scrip|scriptnames|se|set|setf|setfiletype|setg|setglobal|setl|setlocal|sf|sfind|sfir|sfirst|sh|shell|sign|sil|silent|sim|simalt|sla|slast|sl|sleep|sm|smagic|sm|smap|smapc|smapclear|sme|smenu|sn|snext|sN|sNext|sni|sniff|sno|snomagic|snor|snoremap|snoreme|snoremenu|sor|sort|so|source|spelld|spelldump|spe|spellgood|spelli|spellinfo|spellr|spellrepall|spellu|spellundo|spellw|spellwrong|sp|split|spr|sprevious|sre|srewind|sta|stag|startg|startgreplace|star|startinsert|startr|startreplace|stj|stjump|st|stop|stopi|stopinsert|sts|stselect|sun|sunhide|sunm|sunmap|sus|suspend|sv|sview|syncbind|t|tab|tabc|tabclose|tabd|tabdo|tabe|tabedit|tabf|tabfind|tabfir|tabfirst|tabl|tablast|tabm|tabmove|tabnew|tabn|tabnext|tabN|tabNext|tabo|tabonly|tabp|tabprevious|tabr|tabrewind|tabs|ta|tag|tags|tc|tcl|tcld|tcldo|tclf|tclfile|te|tearoff|tf|tfirst|th|throw|tj|tjump|tl|tlast|tm|tm|tmenu|tn|tnext|tN|tNext|to|topleft|tp|tprevious|tr|trewind|try|ts|tselect|tu|tu|tunmenu|una|unabbreviate|u|undo|undoj|undojoin|undol|undolist|unh|unhide|unlet|unlo|unlockvar|unm|unmap|up|update|verb|verbose|ve|version|vert|vertical|vie|view|vim|vimgrep|vimgrepa|vimgrepadd|vi|visual|viu|viusage|vmapc|vmapclear|vne|vnew|vs|vsplit|vu|vunmap|wa|wall|wh|while|winc|wincmd|windo|winp|winpos|win|winsize|wn|wnext|wN|wNext|wp|wprevious|wq|wqa|wqall|w|write|ws|wsverb|wv|wviminfo|X|xa|xall|x|xit|xm|xmap|xmapc|xmapclear|xme|xmenu|XMLent|XMLns|xn|xnoremap|xnoreme|xnoremenu|xu|xunmap|y|yank)\b/,
  7852. 'builtin': /\b(?:autocmd|acd|ai|akm|aleph|allowrevins|altkeymap|ambiwidth|ambw|anti|antialias|arab|arabic|arabicshape|ari|arshape|autochdir|autoindent|autoread|autowrite|autowriteall|aw|awa|background|backspace|backup|backupcopy|backupdir|backupext|backupskip|balloondelay|ballooneval|balloonexpr|bdir|bdlay|beval|bex|bexpr|bg|bh|bin|binary|biosk|bioskey|bk|bkc|bomb|breakat|brk|browsedir|bs|bsdir|bsk|bt|bufhidden|buflisted|buftype|casemap|ccv|cdpath|cedit|cfu|ch|charconvert|ci|cin|cindent|cink|cinkeys|cino|cinoptions|cinw|cinwords|clipboard|cmdheight|cmdwinheight|cmp|cms|columns|com|comments|commentstring|compatible|complete|completefunc|completeopt|consk|conskey|copyindent|cot|cpo|cpoptions|cpt|cscopepathcomp|cscopeprg|cscopequickfix|cscopetag|cscopetagorder|cscopeverbose|cspc|csprg|csqf|cst|csto|csverb|cuc|cul|cursorcolumn|cursorline|cwh|debug|deco|def|define|delcombine|dex|dg|dict|dictionary|diff|diffexpr|diffopt|digraph|dip|dir|directory|dy|ea|ead|eadirection|eb|ed|edcompatible|ef|efm|ei|ek|enc|encoding|endofline|eol|ep|equalalways|equalprg|errorbells|errorfile|errorformat|esckeys|et|eventignore|expandtab|exrc|fcl|fcs|fdc|fde|fdi|fdl|fdls|fdm|fdn|fdo|fdt|fen|fenc|fencs|fex|ff|ffs|fileencoding|fileencodings|fileformat|fileformats|fillchars|fk|fkmap|flp|fml|fmr|foldcolumn|foldenable|foldexpr|foldignore|foldlevel|foldlevelstart|foldmarker|foldmethod|foldminlines|foldnestmax|foldtext|formatexpr|formatlistpat|formatoptions|formatprg|fp|fs|fsync|ft|gcr|gd|gdefault|gfm|gfn|gfs|gfw|ghr|gp|grepformat|grepprg|gtl|gtt|guicursor|guifont|guifontset|guifontwide|guiheadroom|guioptions|guipty|guitablabel|guitabtooltip|helpfile|helpheight|helplang|hf|hh|hi|hidden|highlight|hk|hkmap|hkmapp|hkp|hl|hlg|hls|hlsearch|ic|icon|iconstring|ignorecase|im|imactivatekey|imak|imc|imcmdline|imd|imdisable|imi|iminsert|ims|imsearch|inc|include|includeexpr|incsearch|inde|indentexpr|indentkeys|indk|inex|inf|infercase|insertmode|isf|isfname|isi|isident|isk|iskeyword|isprint|joinspaces|js|key|keymap|keymodel|keywordprg|km|kmp|kp|langmap|langmenu|laststatus|lazyredraw|lbr|lcs|linebreak|lines|linespace|lisp|lispwords|listchars|loadplugins|lpl|lsp|lz|macatsui|magic|makeef|makeprg|matchpairs|matchtime|maxcombine|maxfuncdepth|maxmapdepth|maxmem|maxmempattern|maxmemtot|mco|mef|menuitems|mfd|mh|mis|mkspellmem|ml|mls|mm|mmd|mmp|mmt|modeline|modelines|modifiable|modified|more|mouse|mousef|mousefocus|mousehide|mousem|mousemodel|mouses|mouseshape|mouset|mousetime|mp|mps|msm|mzq|mzquantum|nf|nrformats|numberwidth|nuw|odev|oft|ofu|omnifunc|opendevice|operatorfunc|opfunc|osfiletype|pa|para|paragraphs|paste|pastetoggle|patchexpr|patchmode|path|pdev|penc|pex|pexpr|pfn|ph|pheader|pi|pm|pmbcs|pmbfn|popt|preserveindent|previewheight|previewwindow|printdevice|printencoding|printexpr|printfont|printheader|printmbcharset|printmbfont|printoptions|prompt|pt|pumheight|pvh|pvw|qe|quoteescape|readonly|remap|report|restorescreen|revins|rightleft|rightleftcmd|rl|rlc|ro|rs|rtp|ruf|ruler|rulerformat|runtimepath|sbo|sc|scb|scr|scroll|scrollbind|scrolljump|scrolloff|scrollopt|scs|sect|sections|secure|sel|selection|selectmode|sessionoptions|sft|shcf|shellcmdflag|shellpipe|shellquote|shellredir|shellslash|shelltemp|shelltype|shellxquote|shiftround|shiftwidth|shm|shortmess|shortname|showbreak|showcmd|showfulltag|showmatch|showmode|showtabline|shq|si|sidescroll|sidescrolloff|siso|sj|slm|smartcase|smartindent|smarttab|smc|smd|softtabstop|sol|spc|spell|spellcapcheck|spellfile|spelllang|spellsuggest|spf|spl|splitbelow|splitright|sps|sr|srr|ss|ssl|ssop|stal|startofline|statusline|stl|stmp|su|sua|suffixes|suffixesadd|sw|swapfile|swapsync|swb|swf|switchbuf|sws|sxq|syn|synmaxcol|syntax|tabline|tabpagemax|tabstop|tagbsearch|taglength|tagrelative|tagstack|tal|tb|tbi|tbidi|tbis|tbs|tenc|term|termbidi|termencoding|terse|textauto|textmode|textwidth|tgst|thesaurus|tildeop|timeout|timeoutlen|title|titlelen|titleold|titlestring|toolbar|toolbariconsize|top|tpm|tsl|tsr|ttimeout|ttimeoutlen|ttm|tty|ttybuiltin|ttyfast|ttym|ttymouse|ttyscroll|ttytype|tw|tx|uc|ul|undolevels|updatecount|updatetime|ut|vb|vbs|vdir|verbosefile|vfile|viewdir|viewoptions|viminfo|virtualedit|visualbell|vop|wak|warn|wb|wc|wcm|wd|weirdinvert|wfh|wfw|whichwrap|wi|wig|wildchar|wildcharm|wildignore|wildmenu|wildmode|wildoptions|wim|winaltkeys|window|winfixheight|winfixwidth|winheight|winminheight|winminwidth|winwidth|wiv|wiw|wm|wmh|wmnu|wmw|wop|wrap|wrapmargin|wrapscan|writeany|writebackup|writedelay|ww|noacd|noai|noakm|noallowrevins|noaltkeymap|noanti|noantialias|noar|noarab|noarabic|noarabicshape|noari|noarshape|noautochdir|noautoindent|noautoread|noautowrite|noautowriteall|noaw|noawa|nobackup|noballooneval|nobeval|nobin|nobinary|nobiosk|nobioskey|nobk|nobl|nobomb|nobuflisted|nocf|noci|nocin|nocindent|nocompatible|noconfirm|noconsk|noconskey|nocopyindent|nocp|nocscopetag|nocscopeverbose|nocst|nocsverb|nocuc|nocul|nocursorcolumn|nocursorline|nodeco|nodelcombine|nodg|nodiff|nodigraph|nodisable|noea|noeb|noed|noedcompatible|noek|noendofline|noeol|noequalalways|noerrorbells|noesckeys|noet|noex|noexpandtab|noexrc|nofen|nofk|nofkmap|nofoldenable|nogd|nogdefault|noguipty|nohid|nohidden|nohk|nohkmap|nohkmapp|nohkp|nohls|noic|noicon|noignorecase|noim|noimc|noimcmdline|noimd|noincsearch|noinf|noinfercase|noinsertmode|nois|nojoinspaces|nojs|nolazyredraw|nolbr|nolinebreak|nolisp|nolist|noloadplugins|nolpl|nolz|noma|nomacatsui|nomagic|nomh|noml|nomod|nomodeline|nomodifiable|nomodified|nomore|nomousef|nomousefocus|nomousehide|nonu|nonumber|noodev|noopendevice|nopaste|nopi|nopreserveindent|nopreviewwindow|noprompt|nopvw|noreadonly|noremap|norestorescreen|norevins|nori|norightleft|norightleftcmd|norl|norlc|noro|nors|noru|noruler|nosb|nosc|noscb|noscrollbind|noscs|nosecure|nosft|noshellslash|noshelltemp|noshiftround|noshortname|noshowcmd|noshowfulltag|noshowmatch|noshowmode|nosi|nosm|nosmartcase|nosmartindent|nosmarttab|nosmd|nosn|nosol|nospell|nosplitbelow|nosplitright|nospr|nosr|nossl|nosta|nostartofline|nostmp|noswapfile|noswf|nota|notagbsearch|notagrelative|notagstack|notbi|notbidi|notbs|notermbidi|noterse|notextauto|notextmode|notf|notgst|notildeop|notimeout|notitle|noto|notop|notr|nottimeout|nottybuiltin|nottyfast|notx|novb|novisualbell|nowa|nowarn|nowb|noweirdinvert|nowfh|nowfw|nowildmenu|nowinfixheight|nowinfixwidth|nowiv|nowmnu|nowrap|nowrapscan|nowrite|nowriteany|nowritebackup|nows|invacd|invai|invakm|invallowrevins|invaltkeymap|invanti|invantialias|invar|invarab|invarabic|invarabicshape|invari|invarshape|invautochdir|invautoindent|invautoread|invautowrite|invautowriteall|invaw|invawa|invbackup|invballooneval|invbeval|invbin|invbinary|invbiosk|invbioskey|invbk|invbl|invbomb|invbuflisted|invcf|invci|invcin|invcindent|invcompatible|invconfirm|invconsk|invconskey|invcopyindent|invcp|invcscopetag|invcscopeverbose|invcst|invcsverb|invcuc|invcul|invcursorcolumn|invcursorline|invdeco|invdelcombine|invdg|invdiff|invdigraph|invdisable|invea|inveb|inved|invedcompatible|invek|invendofline|inveol|invequalalways|inverrorbells|invesckeys|invet|invex|invexpandtab|invexrc|invfen|invfk|invfkmap|invfoldenable|invgd|invgdefault|invguipty|invhid|invhidden|invhk|invhkmap|invhkmapp|invhkp|invhls|invhlsearch|invic|invicon|invignorecase|invim|invimc|invimcmdline|invimd|invincsearch|invinf|invinfercase|invinsertmode|invis|invjoinspaces|invjs|invlazyredraw|invlbr|invlinebreak|invlisp|invlist|invloadplugins|invlpl|invlz|invma|invmacatsui|invmagic|invmh|invml|invmod|invmodeline|invmodifiable|invmodified|invmore|invmousef|invmousefocus|invmousehide|invnu|invnumber|invodev|invopendevice|invpaste|invpi|invpreserveindent|invpreviewwindow|invprompt|invpvw|invreadonly|invremap|invrestorescreen|invrevins|invri|invrightleft|invrightleftcmd|invrl|invrlc|invro|invrs|invru|invruler|invsb|invsc|invscb|invscrollbind|invscs|invsecure|invsft|invshellslash|invshelltemp|invshiftround|invshortname|invshowcmd|invshowfulltag|invshowmatch|invshowmode|invsi|invsm|invsmartcase|invsmartindent|invsmarttab|invsmd|invsn|invsol|invspell|invsplitbelow|invsplitright|invspr|invsr|invssl|invsta|invstartofline|invstmp|invswapfile|invswf|invta|invtagbsearch|invtagrelative|invtagstack|invtbi|invtbidi|invtbs|invtermbidi|invterse|invtextauto|invtextmode|invtf|invtgst|invtildeop|invtimeout|invtitle|invto|invtop|invtr|invttimeout|invttybuiltin|invttyfast|invtx|invvb|invvisualbell|invwa|invwarn|invwb|invweirdinvert|invwfh|invwfw|invwildmenu|invwinfixheight|invwinfixwidth|invwiv|invwmnu|invwrap|invwrapscan|invwrite|invwriteany|invwritebackup|invws|t_AB|t_AF|t_al|t_AL|t_bc|t_cd|t_ce|t_Ce|t_cl|t_cm|t_Co|t_cs|t_Cs|t_CS|t_CV|t_da|t_db|t_dl|t_DL|t_EI|t_F1|t_F2|t_F3|t_F4|t_F5|t_F6|t_F7|t_F8|t_F9|t_fs|t_IE|t_IS|t_k1|t_K1|t_k2|t_k3|t_K3|t_k4|t_K4|t_k5|t_K5|t_k6|t_K6|t_k7|t_K7|t_k8|t_K8|t_k9|t_K9|t_KA|t_kb|t_kB|t_KB|t_KC|t_kd|t_kD|t_KD|t_ke|t_KE|t_KF|t_KG|t_kh|t_KH|t_kI|t_KI|t_KJ|t_KK|t_kl|t_KL|t_kN|t_kP|t_kr|t_ks|t_ku|t_le|t_mb|t_md|t_me|t_mr|t_ms|t_nd|t_op|t_RI|t_RV|t_Sb|t_se|t_Sf|t_SI|t_so|t_sr|t_te|t_ti|t_ts|t_ue|t_us|t_ut|t_vb|t_ve|t_vi|t_vs|t_WP|t_WS|t_xs|t_ZH|t_ZR)\b/,
  7853. 'number': /\b(?:0x[\da-f]+|\d+(?:\.\d+)?)\b/i,
  7854. 'operator': /\|\||&&|[-+.]=?|[=!](?:[=~][#?]?)?|[<>]=?[#?]?|[*\/%?]|\b(?:is(?:not)?)\b/,
  7855. 'punctuation': /[{}[\](),;:]/
  7856. };
  7857. /***/ }),
  7858. /* 127 */
  7859. /***/ (function(module, exports) {
  7860. // issues: nested multiline comments
  7861. Prism.languages.swift = Prism.languages.extend('clike', {
  7862. 'string': {
  7863. pattern: /("|')(\\(?:\((?:[^()]|\([^)]+\))+\)|\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
  7864. greedy: true,
  7865. inside: {
  7866. 'interpolation': {
  7867. pattern: /\\\((?:[^()]|\([^)]+\))+\)/,
  7868. inside: {
  7869. delimiter: {
  7870. pattern: /^\\\(|\)$/,
  7871. alias: 'variable'
  7872. }
  7873. // See rest below
  7874. }
  7875. }
  7876. }
  7877. },
  7878. 'keyword': /\b(as|associativity|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic(?:Type)?|else|enum|extension|fallthrough|final|for|func|get|guard|if|import|in|infix|init|inout|internal|is|lazy|left|let|mutating|new|none|nonmutating|operator|optional|override|postfix|precedence|prefix|private|Protocol|public|repeat|required|rethrows|return|right|safe|self|Self|set|static|struct|subscript|super|switch|throws?|try|Type|typealias|unowned|unsafe|var|weak|where|while|willSet|__(?:COLUMN__|FILE__|FUNCTION__|LINE__))\b/,
  7879. 'number': /\b([\d_]+(\.[\de_]+)?|0x[a-f0-9_]+(\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,
  7880. 'constant': /\b(nil|[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,
  7881. 'atrule': /@\b(IB(?:Outlet|Designable|Action|Inspectable)|class_protocol|exported|noreturn|NS(?:Copying|Managed)|objc|UIApplicationMain|auto_closure)\b/,
  7882. 'builtin': /\b([A-Z]\S+|abs|advance|alignof(?:Value)?|assert|contains|count(?:Elements)?|debugPrint(?:ln)?|distance|drop(?:First|Last)|dump|enumerate|equal|filter|find|first|getVaList|indices|isEmpty|join|last|lexicographicalCompare|map|max(?:Element)?|min(?:Element)?|numericCast|overlaps|partition|print(?:ln)?|reduce|reflect|reverse|sizeof(?:Value)?|sort(?:ed)?|split|startsWith|stride(?:of(?:Value)?)?|suffix|swap|toDebugString|toString|transcode|underestimateCount|unsafeBitCast|with(?:ExtendedLifetime|Unsafe(?:MutablePointers?|Pointers?)|VaList))\b/
  7883. });
  7884. Prism.languages.swift['string'].inside['interpolation'].inside.rest = Prism.util.clone(Prism.languages.swift);
  7885. /***/ }),
  7886. /* 128 */
  7887. /***/ (function(module, exports) {
  7888. Prism.languages.objectivec = Prism.languages.extend('c', {
  7889. 'keyword': /\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while|in|self|super)\b|(@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,
  7890. 'string': /("|')(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|@"(\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
  7891. 'operator': /-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/
  7892. });
  7893. /***/ }),
  7894. /* 129 */
  7895. /***/ (function(module, exports) {
  7896. Prism.languages.sql= {
  7897. 'comment': {
  7898. pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
  7899. lookbehind: true
  7900. },
  7901. 'string' : {
  7902. pattern: /(^|[^@\\])("|')(?:\\?[\s\S])*?\2/,
  7903. greedy: true,
  7904. lookbehind: true
  7905. },
  7906. 'variable': /@[\w.$]+|@("|'|`)(?:\\?[\s\S])+?\1/,
  7907. 'function': /\b(?:COUNT|SUM|AVG|MIN|MAX|FIRST|LAST|UCASE|LCASE|MID|LEN|ROUND|NOW|FORMAT)(?=\s*\()/i, // Should we highlight user defined functions too?
  7908. 'keyword': /\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR VARYING|CHARACTER (?:SET|VARYING)|CHARSET|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMN|COLUMNS|COMMENT|COMMIT|COMMITTED|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS|CONTAINSTABLE|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|DATA(?:BASES?)?|DATE(?:TIME)?|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITER(?:S)?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE(?: PRECISION)?|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE KEY|ELSE|ENABLE|ENCLOSED BY|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPE(?:D BY)?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|IDENTITY(?:_INSERT|COL)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTO|INVOKER|ISOLATION LEVEL|JOIN|KEYS?|KILL|LANGUAGE SQL|LAST|LEFT|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MODIFIES SQL DATA|MODIFY|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL(?: CHAR VARYING| CHARACTER(?: VARYING)?| VARCHAR)?|NATURAL|NCHAR(?: VARCHAR)?|NEXT|NO(?: SQL|CHECK|CYCLE)?|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READ(?:S SQL DATA|TEXT)?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEATABLE|REPLICATION|REQUIRE|RESTORE|RESTRICT|RETURNS?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE MODE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|START(?:ING BY)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED BY|TEXT(?:SIZE)?|THEN|TIMESTAMP|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNPIVOT|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?)\b/i,
  7909. 'boolean': /\b(?:TRUE|FALSE|NULL)\b/i,
  7910. 'number': /\b-?(?:0x)?\d*\.?[\da-f]+\b/,
  7911. 'operator': /[-+*\/=%^~]|&&?|\|?\||!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
  7912. 'punctuation': /[;[\]()`,.]/
  7913. };
  7914. /***/ }),
  7915. /* 130 */
  7916. /***/ (function(module, exports) {
  7917. Prism.languages.scheme = {
  7918. 'comment' : /;.*/,
  7919. 'string' : {
  7920. pattern: /"(?:[^"\\\r\n]|\\.)*?"|'[^('\s]*/,
  7921. greedy: true
  7922. },
  7923. 'keyword' : {
  7924. pattern : /(\()(?:define(?:-syntax|-library|-values)?|(?:case-)?lambda|let(?:\*|rec)?(?:-values)?|else|if|cond|begin|delay(?:-force)?|parameterize|guard|set!|(?:quasi-)?quote|syntax-rules)/,
  7925. lookbehind : true
  7926. },
  7927. 'builtin' : {
  7928. pattern : /(\()(?:(?:cons|car|cdr|list|call-with-current-continuation|call\/cc|append|abs|apply|eval)\b|null\?|pair\?|boolean\?|eof-object\?|char\?|procedure\?|number\?|port\?|string\?|vector\?|symbol\?|bytevector\?)/,
  7929. lookbehind : true
  7930. },
  7931. 'number' : {
  7932. pattern: /(\s|\))[-+]?\d*\.?\d+(?:\s*[-+]\s*\d*\.?\d+i)?\b/,
  7933. lookbehind: true
  7934. },
  7935. 'boolean' : /#[tf]/,
  7936. 'operator': {
  7937. pattern: /(\()(?:[-+*%\/]|[<>]=?|=>?)/,
  7938. lookbehind: true
  7939. },
  7940. 'function' : {
  7941. pattern : /(\()[^\s()]*(?=\s)/,
  7942. lookbehind : true
  7943. },
  7944. 'punctuation' : /[()]/
  7945. };
  7946. /***/ }),
  7947. /* 131 */
  7948. /***/ (function(module, exports) {
  7949. /**
  7950. * Original by Samuel Flores
  7951. *
  7952. * Adds the following new token classes:
  7953. * constant, builtin, variable, symbol, regex
  7954. */
  7955. (function(Prism) {
  7956. Prism.languages.ruby = Prism.languages.extend('clike', {
  7957. 'comment': [
  7958. /#(?!\{[^\r\n]*?\}).*/,
  7959. /^=begin(?:\r?\n|\r)(?:.*(?:\r?\n|\r))*?=end/m
  7960. ],
  7961. 'keyword': /\b(alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/
  7962. });
  7963. var interpolation = {
  7964. pattern: /#\{[^}]+\}/,
  7965. inside: {
  7966. 'delimiter': {
  7967. pattern: /^#\{|\}$/,
  7968. alias: 'tag'
  7969. },
  7970. rest: Prism.util.clone(Prism.languages.ruby)
  7971. }
  7972. };
  7973. Prism.languages.insertBefore('ruby', 'keyword', {
  7974. 'regex': [
  7975. {
  7976. pattern: /%r([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1[gim]{0,3}/,
  7977. greedy: true,
  7978. inside: {
  7979. 'interpolation': interpolation
  7980. }
  7981. },
  7982. {
  7983. pattern: /%r\((?:[^()\\]|\\[\s\S])*\)[gim]{0,3}/,
  7984. greedy: true,
  7985. inside: {
  7986. 'interpolation': interpolation
  7987. }
  7988. },
  7989. {
  7990. // Here we need to specifically allow interpolation
  7991. pattern: /%r\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}[gim]{0,3}/,
  7992. greedy: true,
  7993. inside: {
  7994. 'interpolation': interpolation
  7995. }
  7996. },
  7997. {
  7998. pattern: /%r\[(?:[^\[\]\\]|\\[\s\S])*\][gim]{0,3}/,
  7999. greedy: true,
  8000. inside: {
  8001. 'interpolation': interpolation
  8002. }
  8003. },
  8004. {
  8005. pattern: /%r<(?:[^<>\\]|\\[\s\S])*>[gim]{0,3}/,
  8006. greedy: true,
  8007. inside: {
  8008. 'interpolation': interpolation
  8009. }
  8010. },
  8011. {
  8012. pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,
  8013. lookbehind: true,
  8014. greedy: true
  8015. }
  8016. ],
  8017. 'variable': /[@$]+[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/,
  8018. 'symbol': /:[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/
  8019. });
  8020. Prism.languages.insertBefore('ruby', 'number', {
  8021. 'builtin': /\b(Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|File|Fixnum|Float|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,
  8022. 'constant': /\b[A-Z][a-zA-Z_0-9]*(?:[?!]|\b)/
  8023. });
  8024. Prism.languages.ruby.string = [
  8025. {
  8026. pattern: /%[qQiIwWxs]?([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1/,
  8027. greedy: true,
  8028. inside: {
  8029. 'interpolation': interpolation
  8030. }
  8031. },
  8032. {
  8033. pattern: /%[qQiIwWxs]?\((?:[^()\\]|\\[\s\S])*\)/,
  8034. greedy: true,
  8035. inside: {
  8036. 'interpolation': interpolation
  8037. }
  8038. },
  8039. {
  8040. // Here we need to specifically allow interpolation
  8041. pattern: /%[qQiIwWxs]?\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/,
  8042. greedy: true,
  8043. inside: {
  8044. 'interpolation': interpolation
  8045. }
  8046. },
  8047. {
  8048. pattern: /%[qQiIwWxs]?\[(?:[^\[\]\\]|\\[\s\S])*\]/,
  8049. greedy: true,
  8050. inside: {
  8051. 'interpolation': interpolation
  8052. }
  8053. },
  8054. {
  8055. pattern: /%[qQiIwWxs]?<(?:[^<>\\]|\\[\s\S])*>/,
  8056. greedy: true,
  8057. inside: {
  8058. 'interpolation': interpolation
  8059. }
  8060. },
  8061. {
  8062. pattern: /("|')(#\{[^}]+\}|\\(?:\r?\n|\r)|\\?.)*?\1/,
  8063. greedy: true,
  8064. inside: {
  8065. 'interpolation': interpolation
  8066. }
  8067. }
  8068. ];
  8069. }(Prism));
  8070. /***/ }),
  8071. /* 132 */
  8072. /***/ (function(module, exports) {
  8073. /* TODO
  8074. Add support for variables inside double quoted strings
  8075. Add support for {php}
  8076. */
  8077. (function(Prism) {
  8078. var smarty_pattern = /\{\*[\s\S]+?\*\}|\{[\s\S]+?\}/g;
  8079. var smarty_litteral_start = '{literal}';
  8080. var smarty_litteral_end = '{/literal}';
  8081. var smarty_litteral_mode = false;
  8082. Prism.languages.smarty = Prism.languages.extend('markup', {
  8083. 'smarty': {
  8084. pattern: smarty_pattern,
  8085. inside: {
  8086. 'delimiter': {
  8087. pattern: /^\{|\}$/i,
  8088. alias: 'punctuation'
  8089. },
  8090. 'string': /(["'])(?:\\?.)*?\1/,
  8091. 'number': /\b-?(?:0x[\dA-Fa-f]+|\d*\.?\d+(?:[Ee][-+]?\d+)?)\b/,
  8092. 'variable': [
  8093. /\$(?!\d)\w+/,
  8094. /#(?!\d)\w+#/,
  8095. {
  8096. pattern: /(\.|->)(?!\d)\w+/,
  8097. lookbehind: true
  8098. },
  8099. {
  8100. pattern: /(\[)(?!\d)\w+(?=\])/,
  8101. lookbehind: true
  8102. }
  8103. ],
  8104. 'function': [
  8105. {
  8106. pattern: /(\|\s*)@?(?!\d)\w+/,
  8107. lookbehind: true
  8108. },
  8109. /^\/?(?!\d)\w+/,
  8110. /(?!\d)\w+(?=\()/
  8111. ],
  8112. 'attr-name': {
  8113. // Value is made optional because it may have already been tokenized
  8114. pattern: /\w+\s*=\s*(?:(?!\d)\w+)?/,
  8115. inside: {
  8116. "variable": {
  8117. pattern: /(=\s*)(?!\d)\w+/,
  8118. lookbehind: true
  8119. },
  8120. "operator": /=/
  8121. }
  8122. },
  8123. 'punctuation': [
  8124. /[\[\]().,:`]|\->/
  8125. ],
  8126. 'operator': [
  8127. /[+\-*\/%]|==?=?|[!<>]=?|&&|\|\|?/,
  8128. /\bis\s+(?:not\s+)?(?:div|even|odd)(?:\s+by)?\b/,
  8129. /\b(?:eq|neq?|gt|lt|gt?e|lt?e|not|mod|or|and)\b/
  8130. ],
  8131. 'keyword': /\b(?:false|off|on|no|true|yes)\b/
  8132. }
  8133. }
  8134. });
  8135. // Comments are inserted at top so that they can
  8136. // surround markup
  8137. Prism.languages.insertBefore('smarty', 'tag', {
  8138. 'smarty-comment': {
  8139. pattern: /\{\*[\s\S]*?\*\}/,
  8140. alias: ['smarty','comment']
  8141. }
  8142. });
  8143. // Tokenize all inline Smarty expressions
  8144. Prism.hooks.add('before-highlight', function(env) {
  8145. if (env.language !== 'smarty') {
  8146. return;
  8147. }
  8148. env.tokenStack = [];
  8149. env.backupCode = env.code;
  8150. env.code = env.code.replace(smarty_pattern, function(match) {
  8151. // Smarty tags inside {literal} block are ignored
  8152. if(match === smarty_litteral_end) {
  8153. smarty_litteral_mode = false;
  8154. }
  8155. if(!smarty_litteral_mode) {
  8156. if(match === smarty_litteral_start) {
  8157. smarty_litteral_mode = true;
  8158. }
  8159. var i = env.tokenStack.length;
  8160. // Check for existing strings
  8161. while (env.backupCode.indexOf('___SMARTY' + i + '___') !== -1)
  8162. ++i;
  8163. // Create a sparse array
  8164. env.tokenStack[i] = match;
  8165. return '___SMARTY' + i + '___';
  8166. }
  8167. return match;
  8168. });
  8169. });
  8170. // Restore env.code for other plugins (e.g. line-numbers)
  8171. Prism.hooks.add('before-insert', function(env) {
  8172. if (env.language === 'smarty') {
  8173. env.code = env.backupCode;
  8174. delete env.backupCode;
  8175. }
  8176. });
  8177. // Re-insert the tokens after highlighting
  8178. // and highlight them with defined grammar
  8179. Prism.hooks.add('after-highlight', function(env) {
  8180. if (env.language !== 'smarty') {
  8181. return;
  8182. }
  8183. for (var i = 0, keys = Object.keys(env.tokenStack); i < keys.length; ++i) {
  8184. var k = keys[i];
  8185. var t = env.tokenStack[k];
  8186. // The replace prevents $$, $&, $`, $', $n, $nn from being interpreted as special patterns
  8187. env.highlightedCode = env.highlightedCode.replace('___SMARTY' + k + '___', Prism.highlight(t, env.grammar, 'smarty').replace(/\$/g, '$$$$'));
  8188. }
  8189. env.element.innerHTML = env.highlightedCode;
  8190. });
  8191. }(Prism));
  8192. /***/ }),
  8193. /* 133 */
  8194. /***/ (function(module, exports) {
  8195. Prism.languages.smalltalk = {
  8196. 'comment': /"(?:""|[^"])+"/,
  8197. 'string': /'(?:''|[^'])+'/,
  8198. 'symbol': /#[\da-z]+|#(?:-|([+\/\\*~<>=@%|&?!])\1?)|#(?=\()/i,
  8199. 'block-arguments': {
  8200. pattern: /(\[\s*):[^\[|]*?\|/,
  8201. lookbehind: true,
  8202. inside: {
  8203. 'variable': /:[\da-z]+/i,
  8204. 'punctuation': /\|/
  8205. }
  8206. },
  8207. 'temporary-variables': {
  8208. pattern: /\|[^|]+\|/,
  8209. inside: {
  8210. 'variable': /[\da-z]+/i,
  8211. 'punctuation': /\|/
  8212. }
  8213. },
  8214. 'keyword': /\b(?:nil|true|false|self|super|new)\b/,
  8215. 'character': {
  8216. pattern: /\$./,
  8217. alias: 'string'
  8218. },
  8219. 'number': [
  8220. /\d+r-?[\dA-Z]+(?:\.[\dA-Z]+)?(?:e-?\d+)?/,
  8221. /(?:\B-|\b)\d+(?:\.\d+)?(?:e-?\d+)?/
  8222. ],
  8223. 'operator': /[<=]=?|:=|~[~=]|\/\/?|\\\\|>[>=]?|[!^+\-*&|,@]/,
  8224. 'punctuation': /[.;:?\[\](){}]/
  8225. };
  8226. /***/ }),
  8227. /* 134 */
  8228. /***/ (function(module, exports) {
  8229. /* TODO
  8230. Add support for Markdown notation inside doc comments
  8231. Add support for nested block comments...
  8232. Match closure params even when not followed by dash or brace
  8233. Add better support for macro definition
  8234. */
  8235. Prism.languages.rust = {
  8236. 'comment': [
  8237. {
  8238. pattern: /(^|[^\\])\/\*[\s\S]*?\*\//,
  8239. lookbehind: true
  8240. },
  8241. {
  8242. pattern: /(^|[^\\:])\/\/.*/,
  8243. lookbehind: true
  8244. }
  8245. ],
  8246. 'string': [
  8247. {
  8248. pattern: /b?r(#*)"(?:\\?.)*?"\1/,
  8249. greedy: true
  8250. },
  8251. {
  8252. pattern: /b?("|')(?:\\?.)*?\1/,
  8253. greedy: true
  8254. }
  8255. ],
  8256. 'keyword': /\b(?:abstract|alignof|as|be|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|match|mod|move|mut|offsetof|once|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\b/,
  8257. 'attribute': {
  8258. pattern: /#!?\[.+?\]/,
  8259. greedy: true,
  8260. alias: 'attr-name'
  8261. },
  8262. 'function': [
  8263. /[a-z0-9_]+(?=\s*\()/i,
  8264. // Macros can use parens or brackets
  8265. /[a-z0-9_]+!(?=\s*\(|\[)/i
  8266. ],
  8267. 'macro-rules': {
  8268. pattern: /[a-z0-9_]+!/i,
  8269. alias: 'function'
  8270. },
  8271. // Hex, oct, bin, dec numbers with visual separators and type suffix
  8272. 'number': /\b-?(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(\d(_?\d)*)?\.?\d(_?\d)*([Ee][+-]?\d+)?)(?:_?(?:[iu](?:8|16|32|64)?|f32|f64))?\b/,
  8273. // Closure params should not be confused with bitwise OR |
  8274. 'closure-params': {
  8275. pattern: /\|[^|]*\|(?=\s*[{-])/,
  8276. inside: {
  8277. 'punctuation': /[\|:,]/,
  8278. 'operator': /[&*]/
  8279. }
  8280. },
  8281. 'punctuation': /[{}[\];(),:]|\.+|->/,
  8282. 'operator': /[-+*\/%!^=]=?|@|&[&=]?|\|[|=]?|<<?=?|>>?=?/
  8283. };
  8284. /***/ }),
  8285. /* 135 */
  8286. /***/ (function(module, exports) {
  8287. Prism.languages.r = {
  8288. 'comment': /#.*/,
  8289. 'string': {
  8290. pattern: /(['"])(?:\\?.)*?\1/,
  8291. greedy: true
  8292. },
  8293. 'percent-operator': {
  8294. // Includes user-defined operators
  8295. // and %%, %*%, %/%, %in%, %o%, %x%
  8296. pattern: /%[^%\s]*%/,
  8297. alias: 'operator'
  8298. },
  8299. 'boolean': /\b(?:TRUE|FALSE)\b/,
  8300. 'ellipsis': /\.\.(?:\.|\d+)/,
  8301. 'number': [
  8302. /\b(?:NaN|Inf)\b/,
  8303. /\b(?:0x[\dA-Fa-f]+(?:\.\d*)?|\d*\.?\d+)(?:[EePp][+-]?\d+)?[iL]?\b/
  8304. ],
  8305. 'keyword': /\b(?:if|else|repeat|while|function|for|in|next|break|NULL|NA|NA_integer_|NA_real_|NA_complex_|NA_character_)\b/,
  8306. 'operator': /->?>?|<(?:=|<?-)?|[>=!]=?|::?|&&?|\|\|?|[+*\/^$@~]/,
  8307. 'punctuation': /[(){}\[\],;]/
  8308. };
  8309. /***/ }),
  8310. /* 136 */
  8311. /***/ (function(module, exports) {
  8312. Prism.languages.d = Prism.languages.extend('clike', {
  8313. 'string': [
  8314. // r"", x""
  8315. /\b[rx]"(\\.|[^\\"])*"[cwd]?/,
  8316. // q"[]", q"()", q"<>", q"{}"
  8317. /\bq"(?:\[[\s\S]*?\]|\([\s\S]*?\)|<[\s\S]*?>|\{[\s\S]*?\})"/,
  8318. // q"IDENT
  8319. // ...
  8320. // IDENT"
  8321. /\bq"([_a-zA-Z][_a-zA-Z\d]*)(?:\r?\n|\r)[\s\S]*?(?:\r?\n|\r)\1"/,
  8322. // q"//", q"||", etc.
  8323. /\bq"(.)[\s\S]*?\1"/,
  8324. // Characters
  8325. /'(?:\\'|\\?[^']+)'/,
  8326. /(["`])(\\.|(?!\1)[^\\])*\1[cwd]?/
  8327. ],
  8328. 'number': [
  8329. // The lookbehind and the negative look-ahead try to prevent bad highlighting of the .. operator
  8330. // Hexadecimal numbers must be handled separately to avoid problems with exponent "e"
  8331. /\b0x\.?[a-f\d_]+(?:(?!\.\.)\.[a-f\d_]*)?(?:p[+-]?[a-f\d_]+)?[ulfi]*/i,
  8332. {
  8333. pattern: /((?:\.\.)?)(?:\b0b\.?|\b|\.)\d[\d_]*(?:(?!\.\.)\.[\d_]*)?(?:e[+-]?\d[\d_]*)?[ulfi]*/i,
  8334. lookbehind: true
  8335. }
  8336. ],
  8337. // In order: $, keywords and special tokens, globally defined symbols
  8338. 'keyword': /\$|\b(?:abstract|alias|align|asm|assert|auto|body|bool|break|byte|case|cast|catch|cdouble|cent|cfloat|char|class|const|continue|creal|dchar|debug|default|delegate|delete|deprecated|do|double|else|enum|export|extern|false|final|finally|float|for|foreach|foreach_reverse|function|goto|idouble|if|ifloat|immutable|import|inout|int|interface|invariant|ireal|lazy|long|macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|real|ref|return|scope|shared|short|static|struct|super|switch|synchronized|template|this|throw|true|try|typedef|typeid|typeof|ubyte|ucent|uint|ulong|union|unittest|ushort|version|void|volatile|wchar|while|with|__(?:(?:FILE|MODULE|LINE|FUNCTION|PRETTY_FUNCTION|DATE|EOF|TIME|TIMESTAMP|VENDOR|VERSION)__|gshared|traits|vector|parameters)|string|wstring|dstring|size_t|ptrdiff_t)\b/,
  8339. 'operator': /\|[|=]?|&[&=]?|\+[+=]?|-[-=]?|\.?\.\.|=[>=]?|!(?:i[ns]\b|<>?=?|>=?|=)?|\bi[ns]\b|(?:<[<>]?|>>?>?|\^\^|[*\/%^~])=?/
  8340. });
  8341. Prism.languages.d.comment = [
  8342. // Shebang
  8343. /^\s*#!.+/,
  8344. // /+ +/
  8345. {
  8346. // Allow one level of nesting
  8347. pattern: /(^|[^\\])\/\+(?:\/\+[\s\S]*?\+\/|[\s\S])*?\+\//,
  8348. lookbehind: true
  8349. }
  8350. ].concat(Prism.languages.d.comment);
  8351. Prism.languages.insertBefore('d', 'comment', {
  8352. 'token-string': {
  8353. // Allow one level of nesting
  8354. pattern: /\bq\{(?:|\{[^}]*\}|[^}])*\}/,
  8355. alias: 'string'
  8356. }
  8357. });
  8358. Prism.languages.insertBefore('d', 'keyword', {
  8359. 'property': /\B@\w*/
  8360. });
  8361. Prism.languages.insertBefore('d', 'function', {
  8362. 'register': {
  8363. // Iasm registers
  8364. pattern: /\b(?:[ABCD][LHX]|E[ABCD]X|E?(?:BP|SP|DI|SI)|[ECSDGF]S|CR[0234]|DR[012367]|TR[3-7]|X?MM[0-7]|R[ABCD]X|[BS]PL|R[BS]P|[DS]IL|R[DS]I|R(?:[89]|1[0-5])[BWD]?|XMM(?:[89]|1[0-5])|YMM(?:1[0-5]|\d))\b|\bST(?:\([0-7]\)|\b)/,
  8365. alias: 'variable'
  8366. }
  8367. });
  8368. /***/ }),
  8369. /* 137 */
  8370. /***/ (function(module, exports) {
  8371. Prism.languages.dart = Prism.languages.extend('clike', {
  8372. 'string': [
  8373. {
  8374. pattern: /r?("""|''')[\s\S]*?\1/,
  8375. greedy: true
  8376. },
  8377. {
  8378. pattern: /r?("|')(\\?.)*?\1/,
  8379. greedy: true
  8380. }
  8381. ],
  8382. 'keyword': [
  8383. /\b(?:async|sync|yield)\*/,
  8384. /\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|default|deferred|do|dynamic|else|enum|export|external|extends|factory|final|finally|for|get|if|implements|import|in|library|new|null|operator|part|rethrow|return|set|static|super|switch|this|throw|try|typedef|var|void|while|with|yield)\b/
  8385. ],
  8386. 'operator': /\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/
  8387. });
  8388. Prism.languages.insertBefore('dart','function',{
  8389. 'metadata': {
  8390. pattern: /@\w+/,
  8391. alias: 'symbol'
  8392. }
  8393. });
  8394. /***/ }),
  8395. /* 138 */
  8396. /***/ (function(module, exports) {
  8397. (function(Prism) {
  8398. // Ignore comments starting with { to privilege string interpolation highlighting
  8399. var comment = /#(?!\{).+/,
  8400. interpolation = {
  8401. pattern: /#\{[^}]+\}/,
  8402. alias: 'variable'
  8403. };
  8404. Prism.languages.coffeescript = Prism.languages.extend('javascript', {
  8405. 'comment': comment,
  8406. 'string': [
  8407. // Strings are multiline
  8408. {
  8409. pattern: /'(?:\\?[^\\])*?'/,
  8410. greedy: true
  8411. },
  8412. {
  8413. // Strings are multiline
  8414. pattern: /"(?:\\?[^\\])*?"/,
  8415. greedy: true,
  8416. inside: {
  8417. 'interpolation': interpolation
  8418. }
  8419. }
  8420. ],
  8421. 'keyword': /\b(and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,
  8422. 'class-member': {
  8423. pattern: /@(?!\d)\w+/,
  8424. alias: 'variable'
  8425. }
  8426. });
  8427. Prism.languages.insertBefore('coffeescript', 'comment', {
  8428. 'multiline-comment': {
  8429. pattern: /###[\s\S]+?###/,
  8430. alias: 'comment'
  8431. },
  8432. // Block regexp can contain comments and interpolation
  8433. 'block-regex': {
  8434. pattern: /\/{3}[\s\S]*?\/{3}/,
  8435. alias: 'regex',
  8436. inside: {
  8437. 'comment': comment,
  8438. 'interpolation': interpolation
  8439. }
  8440. }
  8441. });
  8442. Prism.languages.insertBefore('coffeescript', 'string', {
  8443. 'inline-javascript': {
  8444. pattern: /`(?:\\?[\s\S])*?`/,
  8445. inside: {
  8446. 'delimiter': {
  8447. pattern: /^`|`$/,
  8448. alias: 'punctuation'
  8449. },
  8450. rest: Prism.languages.javascript
  8451. }
  8452. },
  8453. // Block strings
  8454. 'multiline-string': [
  8455. {
  8456. pattern: /'''[\s\S]*?'''/,
  8457. greedy: true,
  8458. alias: 'string'
  8459. },
  8460. {
  8461. pattern: /"""[\s\S]*?"""/,
  8462. greedy: true,
  8463. alias: 'string',
  8464. inside: {
  8465. interpolation: interpolation
  8466. }
  8467. }
  8468. ]
  8469. });
  8470. Prism.languages.insertBefore('coffeescript', 'keyword', {
  8471. // Object property
  8472. 'property': /(?!\d)\w+(?=\s*:(?!:))/
  8473. });
  8474. delete Prism.languages.coffeescript['template-string'];
  8475. }(Prism));
  8476. /***/ }),
  8477. /* 139 */
  8478. /***/ (function(module, exports) {
  8479. (function (Prism) {
  8480. var variable = /%%?[~:\w]+%?|!\S+!/;
  8481. var parameter = {
  8482. pattern: /\/[a-z?]+(?=[ :]|$):?|-[a-z]\b|--[a-z-]+\b/im,
  8483. alias: 'attr-name',
  8484. inside: {
  8485. 'punctuation': /:/
  8486. }
  8487. };
  8488. var string = /"[^"]*"/;
  8489. var number = /(?:\b|-)\d+\b/;
  8490. Prism.languages.batch = {
  8491. 'comment': [
  8492. /^::.*/m,
  8493. {
  8494. pattern: /((?:^|[&(])[ \t]*)rem\b(?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,
  8495. lookbehind: true
  8496. }
  8497. ],
  8498. 'label': {
  8499. pattern: /^:.*/m,
  8500. alias: 'property'
  8501. },
  8502. 'command': [
  8503. {
  8504. // FOR command
  8505. pattern: /((?:^|[&(])[ \t]*)for(?: ?\/[a-z?](?:[ :](?:"[^"]*"|\S+))?)* \S+ in \([^)]+\) do/im,
  8506. lookbehind: true,
  8507. inside: {
  8508. 'keyword': /^for\b|\b(?:in|do)\b/i,
  8509. 'string': string,
  8510. 'parameter': parameter,
  8511. 'variable': variable,
  8512. 'number': number,
  8513. 'punctuation': /[()',]/
  8514. }
  8515. },
  8516. {
  8517. // IF command
  8518. pattern: /((?:^|[&(])[ \t]*)if(?: ?\/[a-z?](?:[ :](?:"[^"]*"|\S+))?)* (?:not )?(?:cmdextversion \d+|defined \w+|errorlevel \d+|exist \S+|(?:"[^"]*"|\S+)?(?:==| (?:equ|neq|lss|leq|gtr|geq) )(?:"[^"]*"|\S+))/im,
  8519. lookbehind: true,
  8520. inside: {
  8521. 'keyword': /^if\b|\b(?:not|cmdextversion|defined|errorlevel|exist)\b/i,
  8522. 'string': string,
  8523. 'parameter': parameter,
  8524. 'variable': variable,
  8525. 'number': number,
  8526. 'operator': /\^|==|\b(?:equ|neq|lss|leq|gtr|geq)\b/i
  8527. }
  8528. },
  8529. {
  8530. // ELSE command
  8531. pattern: /((?:^|[&()])[ \t]*)else\b/im,
  8532. lookbehind: true,
  8533. inside: {
  8534. 'keyword': /^else\b/i
  8535. }
  8536. },
  8537. {
  8538. // SET command
  8539. pattern: /((?:^|[&(])[ \t]*)set(?: ?\/[a-z](?:[ :](?:"[^"]*"|\S+))?)* (?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,
  8540. lookbehind: true,
  8541. inside: {
  8542. 'keyword': /^set\b/i,
  8543. 'string': string,
  8544. 'parameter': parameter,
  8545. 'variable': [
  8546. variable,
  8547. /\w+(?=(?:[*\/%+\-&^|]|<<|>>)?=)/
  8548. ],
  8549. 'number': number,
  8550. 'operator': /[*\/%+\-&^|]=?|<<=?|>>=?|[!~_=]/,
  8551. 'punctuation': /[()',]/
  8552. }
  8553. },
  8554. {
  8555. // Other commands
  8556. pattern: /((?:^|[&(])[ \t]*@?)\w+\b(?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,
  8557. lookbehind: true,
  8558. inside: {
  8559. 'keyword': /^\w+\b/i,
  8560. 'string': string,
  8561. 'parameter': parameter,
  8562. 'label': {
  8563. pattern: /(^\s*):\S+/m,
  8564. lookbehind: true,
  8565. alias: 'property'
  8566. },
  8567. 'variable': variable,
  8568. 'number': number,
  8569. 'operator': /\^/
  8570. }
  8571. }
  8572. ],
  8573. 'operator': /[&@]/,
  8574. 'punctuation': /[()']/
  8575. };
  8576. }(Prism));
  8577. /***/ }),
  8578. /* 140 */
  8579. /***/ (function(module, exports) {
  8580. Prism.languages.cpp = Prism.languages.extend('c', {
  8581. 'keyword': /\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,
  8582. 'boolean': /\b(true|false)\b/,
  8583. 'operator': /[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/
  8584. });
  8585. Prism.languages.insertBefore('cpp', 'keyword', {
  8586. 'class-name': {
  8587. pattern: /(class\s+)[a-z0-9_]+/i,
  8588. lookbehind: true
  8589. }
  8590. });
  8591. /***/ }),
  8592. /* 141 */
  8593. /***/ (function(module, exports) {
  8594. Prism.languages.lua = {
  8595. 'comment': /^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,
  8596. // \z may be used to skip the following space
  8597. 'string': {
  8598. pattern: /(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[\s\S]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,
  8599. greedy: true
  8600. },
  8601. 'number': /\b0x[a-f\d]+\.?[a-f\d]*(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|\.?\d*(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,
  8602. 'keyword': /\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,
  8603. 'function': /(?!\d)\w+(?=\s*(?:[({]))/,
  8604. 'operator': [
  8605. /[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/,
  8606. {
  8607. // Match ".." but don't break "..."
  8608. pattern: /(^|[^.])\.\.(?!\.)/,
  8609. lookbehind: true
  8610. }
  8611. ],
  8612. 'punctuation': /[\[\](){},;]|\.+|:+/
  8613. };
  8614. /***/ }),
  8615. /* 142 */
  8616. /***/ (function(module, exports) {
  8617. Prism.languages.livescript = {
  8618. 'interpolated-string': {
  8619. pattern: /("""|")(?:\\[\s\S]|(?!\1)[^\\])*\1/,
  8620. greedy: true,
  8621. inside: {
  8622. 'variable': {
  8623. pattern: /(^|[^\\])#[a-z_](?:-?[a-z]|\d)*/m,
  8624. lookbehind: true
  8625. },
  8626. 'interpolation': {
  8627. pattern: /(^|[^\\])#\{[^}]+\}/m,
  8628. lookbehind: true,
  8629. inside: {
  8630. 'interpolation-punctuation': {
  8631. pattern: /^#\{|\}$/,
  8632. alias: 'variable'
  8633. }
  8634. // See rest below
  8635. }
  8636. },
  8637. 'string': /[\s\S]+/
  8638. }
  8639. },
  8640. 'comment': [
  8641. {
  8642. pattern: /(^|[^\\])\/\*[\s\S]*?\*\//,
  8643. lookbehind: true,
  8644. greedy: true
  8645. },
  8646. {
  8647. pattern: /(^|[^\\])#.*/,
  8648. lookbehind: true,
  8649. greedy: true
  8650. }
  8651. ],
  8652. 'string': [
  8653. {
  8654. pattern: /('''|')(?:\\[\s\S]|(?!\1)[^\\])*\1/,
  8655. greedy: true
  8656. },
  8657. {
  8658. pattern: /<\[[\s\S]*?\]>/,
  8659. greedy: true
  8660. },
  8661. /\\[^\s,;\])}]+/
  8662. ],
  8663. 'regex': [
  8664. {
  8665. pattern: /\/\/(\[.+?]|\\.|(?!\/\/)[^\\])+\/\/[gimyu]{0,5}/,
  8666. greedy: true,
  8667. inside: {
  8668. 'comment': {
  8669. pattern: /(^|[^\\])#.*/,
  8670. lookbehind: true
  8671. }
  8672. }
  8673. },
  8674. {
  8675. pattern: /\/(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}/,
  8676. greedy: true
  8677. }
  8678. ],
  8679. 'keyword': {
  8680. pattern: /(^|(?!-).)\b(?:break|case|catch|class|const|continue|default|do|else|extends|fallthrough|finally|for(?: ever)?|function|if|implements|it|let|loop|new|null|otherwise|own|return|super|switch|that|then|this|throw|try|unless|until|var|void|when|while|yield)(?!-)\b/m,
  8681. lookbehind: true
  8682. },
  8683. 'keyword-operator': {
  8684. pattern: /(^|[^-])\b(?:(?:delete|require|typeof)!|(?:and|by|delete|export|from|import(?: all)?|in|instanceof|is(?:nt| not)?|not|of|or|til|to|typeof|with|xor)(?!-)\b)/m,
  8685. lookbehind: true,
  8686. alias: 'operator'
  8687. },
  8688. 'boolean': {
  8689. pattern: /(^|[^-])\b(?:false|no|off|on|true|yes)(?!-)\b/m,
  8690. lookbehind: true
  8691. },
  8692. 'argument': {
  8693. // Don't match .&. nor &&
  8694. pattern: /(^|(?!\.&\.)[^&])&(?!&)\d*/m,
  8695. lookbehind: true,
  8696. alias: 'variable'
  8697. },
  8698. 'number': /\b(?:\d+~[\da-z]+|\d[\d_]*(?:\.\d[\d_]*)?(?:[a-z]\w*)?)/i,
  8699. 'identifier': /[a-z_](?:-?[a-z]|\d)*/i,
  8700. 'operator': [
  8701. // Spaced .
  8702. {
  8703. pattern: /( )\.(?= )/,
  8704. lookbehind: true
  8705. },
  8706. // Full list, in order:
  8707. // .= .~ .. ...
  8708. // .&. .^. .<<. .>>. .>>>.
  8709. // := :: ::=
  8710. // &&
  8711. // || |>
  8712. // < << <<< <<<<
  8713. // <- <-- <-! <--!
  8714. // <~ <~~ <~! <~~!
  8715. // <| <= <?
  8716. // > >> >= >?
  8717. // - -- -> -->
  8718. // + ++
  8719. // @ @@
  8720. // % %%
  8721. // * **
  8722. // ! != !~=
  8723. // !~> !~~>
  8724. // !-> !-->
  8725. // ~ ~> ~~> ~=
  8726. // = ==
  8727. // ^ ^^
  8728. // / ?
  8729. /\.(?:[=~]|\.\.?)|\.(?:[&|^]|<<|>>>?)\.|:(?:=|:=?)|&&|\|[|>]|<(?:<<?<?|--?!?|~~?!?|[|=?])?|>[>=?]?|-(?:->?|>)?|\+\+?|@@?|%%?|\*\*?|!(?:~?=|--?>|~?~>)?|~(?:~?>|=)?|==?|\^\^?|[\/?]/
  8730. ],
  8731. 'punctuation': /[(){}\[\]|.,:;`]/
  8732. };
  8733. Prism.languages.livescript['interpolated-string'].inside['interpolation'].inside.rest = Prism.languages.livescript;
  8734. /***/ }),
  8735. /* 143 */
  8736. /***/ (function(module, exports) {
  8737. (function(Prism) {
  8738. var funcPattern = /\\([^a-z()[\]]|[a-z\*]+)/i,
  8739. insideEqu = {
  8740. 'equation-command': {
  8741. pattern: funcPattern,
  8742. alias: 'regex'
  8743. }
  8744. };
  8745. Prism.languages.latex = {
  8746. 'comment': /%.*/m,
  8747. // the verbatim environment prints whitespace to the document
  8748. 'cdata': {
  8749. pattern: /(\\begin\{((?:verbatim|lstlisting)\*?)\})([\s\S]*?)(?=\\end\{\2\})/,
  8750. lookbehind: true
  8751. },
  8752. /*
  8753. * equations can be between $ $ or \( \) or \[ \]
  8754. * (all are multiline)
  8755. */
  8756. 'equation': [
  8757. {
  8758. pattern: /\$(?:\\?[\s\S])*?\$|\\\((?:\\?[\s\S])*?\\\)|\\\[(?:\\?[\s\S])*?\\\]/,
  8759. inside: insideEqu,
  8760. alias: 'string'
  8761. },
  8762. {
  8763. pattern: /(\\begin\{((?:equation|math|eqnarray|align|multline|gather)\*?)\})([\s\S]*?)(?=\\end\{\2\})/,
  8764. lookbehind: true,
  8765. inside: insideEqu,
  8766. alias: 'string'
  8767. }
  8768. ],
  8769. /*
  8770. * arguments which are keywords or references are highlighted
  8771. * as keywords
  8772. */
  8773. 'keyword': {
  8774. pattern: /(\\(?:begin|end|ref|cite|label|usepackage|documentclass)(?:\[[^\]]+\])?\{)[^}]+(?=\})/,
  8775. lookbehind: true
  8776. },
  8777. 'url': {
  8778. pattern: /(\\url\{)[^}]+(?=\})/,
  8779. lookbehind: true
  8780. },
  8781. /*
  8782. * section or chapter headlines are highlighted as bold so that
  8783. * they stand out more
  8784. */
  8785. 'headline': {
  8786. pattern: /(\\(?:part|chapter|section|subsection|frametitle|subsubsection|paragraph|subparagraph|subsubparagraph|subsubsubparagraph)\*?(?:\[[^\]]+\])?\{)[^}]+(?=\}(?:\[[^\]]+\])?)/,
  8787. lookbehind: true,
  8788. alias: 'class-name'
  8789. },
  8790. 'function': {
  8791. pattern: funcPattern,
  8792. alias: 'selector'
  8793. },
  8794. 'punctuation': /[[\]{}&]/
  8795. };
  8796. })(Prism);
  8797. /***/ }),
  8798. /* 144 */
  8799. /***/ (function(module, exports) {
  8800. Prism.languages.groovy = Prism.languages.extend('clike', {
  8801. 'keyword': /\b(as|def|in|abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|trait|transient|try|void|volatile|while)\b/,
  8802. 'string': [
  8803. {
  8804. pattern: /("""|''')[\s\S]*?\1|(\$\/)(\$\/\$|[\s\S])*?\/\$/,
  8805. greedy: true
  8806. },
  8807. {
  8808. pattern: /("|'|\/)(?:\\?.)*?\1/,
  8809. greedy: true
  8810. }
  8811. ],
  8812. 'number': /\b(?:0b[01_]+|0x[\da-f_]+(?:\.[\da-f_p\-]+)?|[\d_]+(?:\.[\d_]+)?(?:e[+-]?[\d]+)?)[glidf]?\b/i,
  8813. 'operator': {
  8814. pattern: /(^|[^.])(~|==?~?|\?[.:]?|\*(?:[.=]|\*=?)?|\.[@&]|\.\.<|\.{1,2}(?!\.)|-[-=>]?|\+[+=]?|!=?|<(?:<=?|=>?)?|>(?:>>?=?|=)?|&[&=]?|\|[|=]?|\/=?|\^=?|%=?)/,
  8815. lookbehind: true
  8816. },
  8817. 'punctuation': /\.+|[{}[\];(),:$]/
  8818. });
  8819. Prism.languages.insertBefore('groovy', 'string', {
  8820. 'shebang': {
  8821. pattern: /#!.+/,
  8822. alias: 'comment'
  8823. }
  8824. });
  8825. Prism.languages.insertBefore('groovy', 'punctuation', {
  8826. 'spock-block': /\b(setup|given|when|then|and|cleanup|expect|where):/
  8827. });
  8828. Prism.languages.insertBefore('groovy', 'function', {
  8829. 'annotation': {
  8830. alias: 'punctuation',
  8831. pattern: /(^|[^.])@\w+/,
  8832. lookbehind: true
  8833. }
  8834. });
  8835. // Handle string interpolation
  8836. Prism.hooks.add('wrap', function(env) {
  8837. if (env.language === 'groovy' && env.type === 'string') {
  8838. var delimiter = env.content[0];
  8839. if (delimiter != "'") {
  8840. var pattern = /([^\\])(\$(\{.*?\}|[\w\.]+))/;
  8841. if (delimiter === '$') {
  8842. pattern = /([^\$])(\$(\{.*?\}|[\w\.]+))/;
  8843. }
  8844. // To prevent double HTML-encoding we have to decode env.content first
  8845. env.content = env.content.replace(/&lt;/g, '<').replace(/&amp;/g, '&');
  8846. env.content = Prism.highlight(env.content, {
  8847. 'expression': {
  8848. pattern: pattern,
  8849. lookbehind: true,
  8850. inside: Prism.languages.groovy
  8851. }
  8852. });
  8853. env.classes.push(delimiter === '/' ? 'regex' : 'gstring');
  8854. }
  8855. }
  8856. });
  8857. /***/ }),
  8858. /* 145 */
  8859. /***/ (function(module, exports) {
  8860. Prism.languages.graphql = {
  8861. 'comment': /#.*/,
  8862. 'string': {
  8863. pattern: /"(?:\\.|[^\\"])*"/,
  8864. greedy: true
  8865. },
  8866. 'number': /(?:\B-|\b)\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/,
  8867. 'boolean': /\b(?:true|false)\b/,
  8868. 'variable': /\$[a-z_]\w*/i,
  8869. 'directive': {
  8870. pattern: /@[a-z_]\w*/i,
  8871. alias: 'function'
  8872. },
  8873. 'attr-name': /[a-z_]\w*(?=\s*:)/i,
  8874. 'keyword': [
  8875. {
  8876. pattern: /(fragment\s+(?!on)[a-z_]\w*\s+|\.\.\.\s*)on\b/,
  8877. lookbehind: true
  8878. },
  8879. /\b(?:query|fragment|mutation)\b/
  8880. ],
  8881. 'operator': /!|=|\.{3}/,
  8882. 'punctuation': /[!(){}\[\]:=,]/
  8883. };
  8884. /***/ }),
  8885. /* 146 */
  8886. /***/ (function(module, exports) {
  8887. Prism.languages.nginx = Prism.languages.extend('clike', {
  8888. 'comment': {
  8889. pattern: /(^|[^"{\\])#.*/,
  8890. lookbehind: true
  8891. },
  8892. 'keyword': /\b(?:CONTENT_|DOCUMENT_|GATEWAY_|HTTP_|HTTPS|if_not_empty|PATH_|QUERY_|REDIRECT_|REMOTE_|REQUEST_|SCGI|SCRIPT_|SERVER_|http|server|events|location|include|accept_mutex|accept_mutex_delay|access_log|add_after_body|add_before_body|add_header|addition_types|aio|alias|allow|ancient_browser|ancient_browser_value|auth|auth_basic|auth_basic_user_file|auth_http|auth_http_header|auth_http_timeout|autoindex|autoindex_exact_size|autoindex_localtime|break|charset|charset_map|charset_types|chunked_transfer_encoding|client_body_buffer_size|client_body_in_file_only|client_body_in_single_buffer|client_body_temp_path|client_body_timeout|client_header_buffer_size|client_header_timeout|client_max_body_size|connection_pool_size|create_full_put_path|daemon|dav_access|dav_methods|debug_connection|debug_points|default_type|deny|devpoll_changes|devpoll_events|directio|directio_alignment|disable_symlinks|empty_gif|env|epoll_events|error_log|error_page|expires|fastcgi_buffer_size|fastcgi_buffers|fastcgi_busy_buffers_size|fastcgi_cache|fastcgi_cache_bypass|fastcgi_cache_key|fastcgi_cache_lock|fastcgi_cache_lock_timeout|fastcgi_cache_methods|fastcgi_cache_min_uses|fastcgi_cache_path|fastcgi_cache_purge|fastcgi_cache_use_stale|fastcgi_cache_valid|fastcgi_connect_timeout|fastcgi_hide_header|fastcgi_ignore_client_abort|fastcgi_ignore_headers|fastcgi_index|fastcgi_intercept_errors|fastcgi_keep_conn|fastcgi_max_temp_file_size|fastcgi_next_upstream|fastcgi_no_cache|fastcgi_param|fastcgi_pass|fastcgi_pass_header|fastcgi_read_timeout|fastcgi_redirect_errors|fastcgi_send_timeout|fastcgi_split_path_info|fastcgi_store|fastcgi_store_access|fastcgi_temp_file_write_size|fastcgi_temp_path|flv|geo|geoip_city|geoip_country|google_perftools_profiles|gzip|gzip_buffers|gzip_comp_level|gzip_disable|gzip_http_version|gzip_min_length|gzip_proxied|gzip_static|gzip_types|gzip_vary|if|if_modified_since|ignore_invalid_headers|image_filter|image_filter_buffer|image_filter_jpeg_quality|image_filter_sharpen|image_filter_transparency|imap_capabilities|imap_client_buffer|include|index|internal|ip_hash|keepalive|keepalive_disable|keepalive_requests|keepalive_timeout|kqueue_changes|kqueue_events|large_client_header_buffers|limit_conn|limit_conn_log_level|limit_conn_zone|limit_except|limit_rate|limit_rate_after|limit_req|limit_req_log_level|limit_req_zone|limit_zone|lingering_close|lingering_time|lingering_timeout|listen|location|lock_file|log_format|log_format_combined|log_not_found|log_subrequest|map|map_hash_bucket_size|map_hash_max_size|master_process|max_ranges|memcached_buffer_size|memcached_connect_timeout|memcached_next_upstream|memcached_pass|memcached_read_timeout|memcached_send_timeout|merge_slashes|min_delete_depth|modern_browser|modern_browser_value|mp4|mp4_buffer_size|mp4_max_buffer_size|msie_padding|msie_refresh|multi_accept|open_file_cache|open_file_cache_errors|open_file_cache_min_uses|open_file_cache_valid|open_log_file_cache|optimize_server_names|override_charset|pcre_jit|perl|perl_modules|perl_require|perl_set|pid|pop3_auth|pop3_capabilities|port_in_redirect|post_action|postpone_output|protocol|proxy|proxy_buffer|proxy_buffer_size|proxy_buffering|proxy_buffers|proxy_busy_buffers_size|proxy_cache|proxy_cache_bypass|proxy_cache_key|proxy_cache_lock|proxy_cache_lock_timeout|proxy_cache_methods|proxy_cache_min_uses|proxy_cache_path|proxy_cache_use_stale|proxy_cache_valid|proxy_connect_timeout|proxy_cookie_domain|proxy_cookie_path|proxy_headers_hash_bucket_size|proxy_headers_hash_max_size|proxy_hide_header|proxy_http_version|proxy_ignore_client_abort|proxy_ignore_headers|proxy_intercept_errors|proxy_max_temp_file_size|proxy_method|proxy_next_upstream|proxy_no_cache|proxy_pass|proxy_pass_error_message|proxy_pass_header|proxy_pass_request_body|proxy_pass_request_headers|proxy_read_timeout|proxy_redirect|proxy_redirect_errors|proxy_send_lowat|proxy_send_timeout|proxy_set_body|proxy_set_header|proxy_ssl_session_reuse|proxy_store|proxy_store_access|proxy_temp_file_write_size|proxy_temp_path|proxy_timeout|proxy_upstream_fail_timeout|proxy_upstream_max_fails|random_index|read_ahead|real_ip_header|recursive_error_pages|request_pool_size|reset_timedout_connection|resolver|resolver_timeout|return|rewrite|root|rtsig_overflow_events|rtsig_overflow_test|rtsig_overflow_threshold|rtsig_signo|satisfy|satisfy_any|secure_link_secret|send_lowat|send_timeout|sendfile|sendfile_max_chunk|server|server_name|server_name_in_redirect|server_names_hash_bucket_size|server_names_hash_max_size|server_tokens|set|set_real_ip_from|smtp_auth|smtp_capabilities|so_keepalive|source_charset|split_clients|ssi|ssi_silent_errors|ssi_types|ssi_value_length|ssl|ssl_certificate|ssl_certificate_key|ssl_ciphers|ssl_client_certificate|ssl_crl|ssl_dhparam|ssl_engine|ssl_prefer_server_ciphers|ssl_protocols|ssl_session_cache|ssl_session_timeout|ssl_verify_client|ssl_verify_depth|starttls|stub_status|sub_filter|sub_filter_once|sub_filter_types|tcp_nodelay|tcp_nopush|timeout|timer_resolution|try_files|types|types_hash_bucket_size|types_hash_max_size|underscores_in_headers|uninitialized_variable_warn|upstream|use|user|userid|userid_domain|userid_expires|userid_name|userid_p3p|userid_path|userid_service|valid_referers|variables_hash_bucket_size|variables_hash_max_size|worker_connections|worker_cpu_affinity|worker_priority|worker_processes|worker_rlimit_core|worker_rlimit_nofile|worker_rlimit_sigpending|working_directory|xclient|xml_entities|xslt_entities|xslt_stylesheet|xslt_types)\b/i,
  8893. });
  8894. Prism.languages.insertBefore('nginx', 'keyword', {
  8895. 'variable': /\$[a-z_]+/i
  8896. });
  8897. /***/ }),
  8898. /* 147 */
  8899. /***/ (function(module, exports) {
  8900. Prism.languages.erlang = {
  8901. 'comment': /%.+/,
  8902. 'string': {
  8903. pattern: /"(?:\\?.)*?"/,
  8904. greedy: true
  8905. },
  8906. 'quoted-function': {
  8907. pattern: /'(?:\\.|[^'\\])+'(?=\()/,
  8908. alias: 'function'
  8909. },
  8910. 'quoted-atom': {
  8911. pattern: /'(?:\\.|[^'\\])+'/,
  8912. alias: 'atom'
  8913. },
  8914. 'boolean': /\b(?:true|false)\b/,
  8915. 'keyword': /\b(?:fun|when|case|of|end|if|receive|after|try|catch)\b/,
  8916. 'number': [
  8917. /\$\\?./,
  8918. /\d+#[a-z0-9]+/i,
  8919. /(?:\b|-)\d*\.?\d+([Ee][+-]?\d+)?\b/
  8920. ],
  8921. 'function': /\b[a-z][\w@]*(?=\()/,
  8922. 'variable': {
  8923. // Look-behind is used to prevent wrong highlighting of atoms containing "@"
  8924. pattern: /(^|[^@])(?:\b|\?)[A-Z_][\w@]*/,
  8925. lookbehind: true
  8926. },
  8927. 'operator': [
  8928. /[=\/<>:]=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:bnot|div|rem|band|bor|bxor|bsl|bsr|not|and|or|xor|orelse|andalso)\b/,
  8929. {
  8930. // We don't want to match <<
  8931. pattern: /(^|[^<])<(?!<)/,
  8932. lookbehind: true
  8933. },
  8934. {
  8935. // We don't want to match >>
  8936. pattern: /(^|[^>])>(?!>)/,
  8937. lookbehind: true
  8938. }
  8939. ],
  8940. 'atom': /\b[a-z][\w@]*/,
  8941. 'punctuation': /[()[\]{}:;,.#|]|<<|>>/
  8942. };
  8943. /***/ }),
  8944. /* 148 */
  8945. /***/ (function(module, exports) {
  8946. Prism.languages.powershell = {
  8947. 'comment': [
  8948. {
  8949. pattern: /(^|[^`])<#[\s\S]*?#>/,
  8950. lookbehind: true
  8951. },
  8952. {
  8953. pattern: /(^|[^`])#.*/,
  8954. lookbehind: true
  8955. }
  8956. ],
  8957. 'string': [
  8958. {
  8959. pattern: /"(`?[\s\S])*?"/,
  8960. greedy: true,
  8961. inside: {
  8962. 'function': {
  8963. pattern: /[^`]\$\(.*?\)/,
  8964. // Populated at end of file
  8965. inside: {}
  8966. }
  8967. }
  8968. },
  8969. {
  8970. pattern: /'([^']|'')*'/,
  8971. greedy: true
  8972. }
  8973. ],
  8974. // Matches name spaces as well as casts, attribute decorators. Force starting with letter to avoid matching array indices
  8975. 'namespace': /\[[a-z][\s\S]*?\]/i,
  8976. 'boolean': /\$(true|false)\b/i,
  8977. 'variable': /\$\w+\b/i,
  8978. // Cmdlets and aliases. Aliases should come last, otherwise "write" gets preferred over "write-host" for example
  8979. // Get-Command | ?{ $_.ModuleName -match "Microsoft.PowerShell.(Util|Core|Management)" }
  8980. // Get-Alias | ?{ $_.ReferencedCommand.Module.Name -match "Microsoft.PowerShell.(Util|Core|Management)" }
  8981. 'function': [
  8982. /\b(Add-(Computer|Content|History|Member|PSSnapin|Type)|Checkpoint-Computer|Clear-(Content|EventLog|History|Item|ItemProperty|Variable)|Compare-Object|Complete-Transaction|Connect-PSSession|ConvertFrom-(Csv|Json|StringData)|Convert-Path|ConvertTo-(Csv|Html|Json|Xml)|Copy-(Item|ItemProperty)|Debug-Process|Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Disconnect-PSSession|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Enter-PSSession|Exit-PSSession|Export-(Alias|Clixml|Console|Csv|FormatData|ModuleMember|PSSession)|ForEach-Object|Format-(Custom|List|Table|Wide)|Get-(Alias|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Culture|Date|Event|EventLog|EventSubscriber|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|WmiObject)|Group-Object|Import-(Alias|Clixml|Csv|LocalizedData|Module|PSSession)|Invoke-(Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)|Join-Path|Limit-EventLog|Measure-(Command|Object)|Move-(Item|ItemProperty)|New-(Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy)|Out-(Default|File|GridView|Host|Null|Printer|String)|Pop-Location|Push-Location|Read-Host|Receive-(Job|PSSession)|Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Remove-(Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)|Rename-(Computer|Item|ItemProperty)|Reset-ComputerMachinePassword|Resolve-Path|Restart-(Computer|Service)|Restore-Computer|Resume-(Job|Service)|Save-Help|Select-(Object|String|Xml)|Send-MailMessage|Set-(Alias|Content|Date|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)|Show-(Command|ControlPanelItem|EventLog)|Sort-Object|Split-Path|Start-(Job|Process|Service|Sleep|Transaction)|Stop-(Computer|Job|Process|Service)|Suspend-(Job|Service)|Tee-Object|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)|Trace-Command|Unblock-File|Undo-Transaction|Unregister-(Event|PSSessionConfiguration)|Update-(FormatData|Help|List|TypeData)|Use-Transaction|Wait-(Event|Job|Process)|Where-Object|Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning))\b/i,
  8983. /\b(ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i
  8984. ],
  8985. // per http://technet.microsoft.com/en-us/library/hh847744.aspx
  8986. 'keyword': /\b(Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,
  8987. 'operator': {
  8988. pattern: /(\W?)(!|-(eq|ne|gt|ge|lt|le|sh[lr]|not|b?(and|x?or)|(Not)?(Like|Match|Contains|In)|Replace|Join|is(Not)?|as)\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,
  8989. lookbehind: true
  8990. },
  8991. 'punctuation': /[|{}[\];(),.]/
  8992. };
  8993. // Variable interpolation inside strings, and nested expressions
  8994. Prism.languages.powershell.string[0].inside.boolean = Prism.languages.powershell.boolean;
  8995. Prism.languages.powershell.string[0].inside.variable = Prism.languages.powershell.variable;
  8996. Prism.languages.powershell.string[0].inside.function.inside = Prism.util.clone(Prism.languages.powershell);
  8997. /***/ }),
  8998. /* 149 */
  8999. /***/ (function(module, exports) {
  9000. Prism.languages.makefile = {
  9001. 'comment': {
  9002. pattern: /(^|[^\\])#(?:\\(?:\r\n|[\s\S])|.)*/,
  9003. lookbehind: true
  9004. },
  9005. 'string': {
  9006. pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
  9007. greedy: true
  9008. },
  9009. // Built-in target names
  9010. 'builtin': /\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,
  9011. // Targets
  9012. 'symbol': {
  9013. pattern: /^[^:=\r\n]+(?=\s*:(?!=))/m,
  9014. inside: {
  9015. 'variable': /\$+(?:[^(){}:#=\s]+|(?=[({]))/
  9016. }
  9017. },
  9018. 'variable': /\$+(?:[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,
  9019. 'keyword': [
  9020. // Directives
  9021. /-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,
  9022. // Functions
  9023. {
  9024. pattern: /(\()(?:addsuffix|abspath|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:s|list)?)(?=[ \t])/,
  9025. lookbehind: true
  9026. }
  9027. ],
  9028. 'operator': /(?:::|[?:+!])?=|[|@]/,
  9029. 'punctuation': /[:;(){}]/
  9030. };
  9031. /***/ }),
  9032. /* 150 */
  9033. /***/ (function(module, exports) {
  9034. Prism.languages.markdown = Prism.languages.extend('markup', {});
  9035. Prism.languages.insertBefore('markdown', 'prolog', {
  9036. 'blockquote': {
  9037. // > ...
  9038. pattern: /^>(?:[\t ]*>)*/m,
  9039. alias: 'punctuation'
  9040. },
  9041. 'code': [
  9042. {
  9043. // Prefixed by 4 spaces or 1 tab
  9044. pattern: /^(?: {4}|\t).+/m,
  9045. alias: 'keyword'
  9046. },
  9047. {
  9048. // `code`
  9049. // ``code``
  9050. pattern: /``.+?``|`[^`\n]+`/,
  9051. alias: 'keyword'
  9052. }
  9053. ],
  9054. 'title': [
  9055. {
  9056. // title 1
  9057. // =======
  9058. // title 2
  9059. // -------
  9060. pattern: /\w+.*(?:\r?\n|\r)(?:==+|--+)/,
  9061. alias: 'important',
  9062. inside: {
  9063. punctuation: /==+$|--+$/
  9064. }
  9065. },
  9066. {
  9067. // # title 1
  9068. // ###### title 6
  9069. pattern: /(^\s*)#+.+/m,
  9070. lookbehind: true,
  9071. alias: 'important',
  9072. inside: {
  9073. punctuation: /^#+|#+$/
  9074. }
  9075. }
  9076. ],
  9077. 'hr': {
  9078. // ***
  9079. // ---
  9080. // * * *
  9081. // -----------
  9082. pattern: /(^\s*)([*-])([\t ]*\2){2,}(?=\s*$)/m,
  9083. lookbehind: true,
  9084. alias: 'punctuation'
  9085. },
  9086. 'list': {
  9087. // * item
  9088. // + item
  9089. // - item
  9090. // 1. item
  9091. pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,
  9092. lookbehind: true,
  9093. alias: 'punctuation'
  9094. },
  9095. 'url-reference': {
  9096. // [id]: http://example.com "Optional title"
  9097. // [id]: http://example.com 'Optional title'
  9098. // [id]: http://example.com (Optional title)
  9099. // [id]: <http://example.com> "Optional title"
  9100. pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,
  9101. inside: {
  9102. 'variable': {
  9103. pattern: /^(!?\[)[^\]]+/,
  9104. lookbehind: true
  9105. },
  9106. 'string': /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,
  9107. 'punctuation': /^[\[\]!:]|[<>]/
  9108. },
  9109. alias: 'url'
  9110. },
  9111. 'bold': {
  9112. // **strong**
  9113. // __strong__
  9114. // Allow only one line break
  9115. pattern: /(^|[^\\])(\*\*|__)(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/,
  9116. lookbehind: true,
  9117. inside: {
  9118. 'punctuation': /^\*\*|^__|\*\*$|__$/
  9119. }
  9120. },
  9121. 'italic': {
  9122. // *em*
  9123. // _em_
  9124. // Allow only one line break
  9125. pattern: /(^|[^\\])([*_])(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/,
  9126. lookbehind: true,
  9127. inside: {
  9128. 'punctuation': /^[*_]|[*_]$/
  9129. }
  9130. },
  9131. 'url': {
  9132. // [example](http://example.com "Optional title")
  9133. // [example] [id]
  9134. pattern: /!?\[[^\]]+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)| ?\[[^\]\n]*\])/,
  9135. inside: {
  9136. 'variable': {
  9137. pattern: /(!?\[)[^\]]+(?=\]$)/,
  9138. lookbehind: true
  9139. },
  9140. 'string': {
  9141. pattern: /"(?:\\.|[^"\\])*"(?=\)$)/
  9142. }
  9143. }
  9144. }
  9145. });
  9146. Prism.languages.markdown['bold'].inside['url'] = Prism.util.clone(Prism.languages.markdown['url']);
  9147. Prism.languages.markdown['italic'].inside['url'] = Prism.util.clone(Prism.languages.markdown['url']);
  9148. Prism.languages.markdown['bold'].inside['italic'] = Prism.util.clone(Prism.languages.markdown['italic']);
  9149. Prism.languages.markdown['italic'].inside['bold'] = Prism.util.clone(Prism.languages.markdown['bold']);
  9150. /***/ }),
  9151. /* 151 */
  9152. /***/ (function(module, exports) {
  9153. // removed by extract-text-webpack-plugin
  9154. /***/ }),
  9155. /* 152 */,
  9156. /* 153 */,
  9157. /* 154 */,
  9158. /* 155 */,
  9159. /* 156 */,
  9160. /* 157 */,
  9161. /* 158 */
  9162. /***/ (function(module, exports) {
  9163. // removed by extract-text-webpack-plugin
  9164. /***/ }),
  9165. /* 159 */
  9166. /***/ (function(module, exports) {
  9167. // removed by extract-text-webpack-plugin
  9168. /***/ }),
  9169. /* 160 */
  9170. /***/ (function(module, exports) {
  9171. // removed by extract-text-webpack-plugin
  9172. /***/ }),
  9173. /* 161 */,
  9174. /* 162 */
  9175. /***/ (function(module, exports) {
  9176. module.exports = "<div tabindex=\"1\" class=\"mditor {{split?'split':''}} {{preview?'preview':''}} {{fullscreen?'fullscreen':''}}\" style=\"width:{{width}};height:{{height}}\">\n <div class=\"head\" m:on:dblclick=\"onHeadDblClick\">\n <m:toolbar m:id=\"toolbar\" m:prop:mditor=\"self\"></m:toolbar>\n </div>\n <div class=\"body\">\n <m:editor m:id=\"editor\" m:prop:mditor=\"self\" m:model:value=\"value\" m:on:scroll=\"syncScroll\" m:on:changed=\"onChanged\" m:on:input=\"onInput\" m:on:paste=\"onPaste\"></m:editor>\n <m:viewer m:id=\"viewer\" m:prop:mditor=\"self\" m:model:value=\"value\"></m:viewer>\n <m:finder m:id=\"finder\" m:prop:mditor=\"self\"></m:viewer>\n </div>\n</div>"
  9177. /***/ })
  9178. /******/ ]);
  9179. //# sourceMappingURL=mditor.js.map